

function show_msg(id)
{
	document.getElementById('panel_ins').style.display='none';
	document.getElementById('panel_ris').style.display='none';
	document.getElementById('panel_msg').style.display='block';
	
	
			xmlHttp.open('GET', 'showmsg_ajax.php?id='+id, true);
	
		xmlHttp.onreadystatechange = stateChangedsd2; 
														
		xmlHttp.send(null);
}



function stateChangedsd2() {

	if(xmlHttp.readyState == 4) 
	{
	
		//Stato OK
		if (xmlHttp.status == 200) 
		{
			
			var risp = xmlHttp.responseText;
			
			if(risp!="")
			{
				risp=risp.replace(/^\s*/gi,"");
				
			
				//Le coppie di valori nella stringa di risposta sono separate da ;
				var values = risp.split('|');
				var limit = values.length-1;
				
				if(values[4]==2)
				{
					var cancella='<input type="button" id="rispondi_verde" value="Cancella" onclick="conf_redir(\''+values[1]+'\','+values[3]+')" />';
				}
				else
				{
					var cancella='';
				}
				
				document.getElementById('aut_msg').innerHTML = values[0];
				document.getElementById('tit_msg').innerHTML = values[1];
				document.getElementById('testo_msg').innerHTML = values[2];
				document.getElementById('btn_rispondi').innerHTML = '<input type="button" id="rispondi_verde" value="Rispondi" onclick="show_ris('+values[3]+')" /> '+cancella;
				document.location.href="#div_msg";
		
			}
			
		} 
		else 
		{
			alert(xmlHttp);
		}
	}
}


function getXmlHttpObject()
{
  var xmlHttp=null;
  try
    {
    // Firefox, Opera 8.0+, Safari
    xmlHttp=new XMLHttpRequest();
    }
  catch (e)
    {
    // Internet Explorer
    try
      {
      xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
      }
    catch (e)
      {
      xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
      }
    }
  return xmlHttp;
}

