var xmlhttp;

function loadXMLDoc(url)
{
xmlhttp=null;
document.getElementById('contatti').innerHTML="<IMG alt= 'Caricamento...' src='immagini/grafica/throbber.gif' hspace='200' vspace='20'>";

	if (window.XMLHttpRequest)
	{// code for Firefox, Opera, IE7, etc.
	xmlhttp=new XMLHttpRequest();
	}
	else if (window.ActiveXObject)
  		{// code for IE6, IE5
		xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
		}

	if (xmlhttp!=null)
  	{
  	xmlhttp.onreadystatechange=cambiaCanale;
  	xmlhttp.open("GET",url,true);
  	xmlhttp.send(null);
	}
	else
  	{
  	alert("Your browser does not support XMLHTTP.");
  	}
}

function cambiaCanale()
{
		//controllo se il browser è IE
		function isIE()
		{
		if(navigator.userAgent.toLowerCase().indexOf("msie") != -1)
		{
		return true;
		} 
		}
	
		//faccio apparire la casella in maniera sfumata
		function ingresso(op, id, durata)
		{
		immagine=document.getElementById(id);

		if(isIE())
		{
		immagine.style.filter='alpha(opacity='+op*1+')';
		}
		else
		{
		immagine.style.opacity = op/100;
		}
		op++
		if(op <= 100)
		{
		setTimeout(function() {ingresso(op, id, durata)}, durata)
		}
		}

if (xmlhttp.readyState==4)
{// 4 = "loaded"
	if (xmlhttp.status==200)
	{// 200 = "OK" (0 = "OK" se offline!)
	ingresso(30, 'contatti', 10);
	document.getElementById('contatti').innerHTML=xmlhttp.responseText;
	}
else
	{
	alert("Problem retrieving data:" + xmlhttp.statusText);
	}
}

}
