var xmlhttp;

function loadXMLDoc(url)
{
xmlhttp=null;


	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=cambiaContenuti;
  	xmlhttp.open("GET",url,true);
  	xmlhttp.send(null);
	}
	else
  	{
  	alert("Your browser does not support XMLHTTP.");
  	}
}

function cambiaContenuti()
{
		//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*10+')';
		}
		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(40, 'contenuti', 10);
	document.getElementById('contenuti').innerHTML=xmlhttp.responseText;
	}
else
	{
	alert("Problem retrieving data:" + xmlhttp.statusText);
	}
}

}

function cambiaColore(id, i, b)
{

	immagine =  new Array(8);
	immagine[0]= "url('immagini/grafica/netvpg.png')";
	immagine[1]= "url('immagini/grafica/albiral.png')";
	immagine[2]= "url('immagini/grafica/masterclock.png')";
	immagine[3]= "url('immagini/grafica/omnitek.png')";
	immagine[4]= "url('immagini/grafica/satcomm.png')";
	immagine[5]= "url('immagini/grafica/ptf.png')";
	immagine[6]= "url('immagini/grafica/lightware.png')";
	immagine[7]= "url('immagini/grafica/barco.png')";
	
	bordo =  new Array(8);
	bordo[0]= "1px solid #c0c0c0";
	bordo[1]= "1px solid #ff4500";
	bordo[2]= "1px solid blue";
	bordo[3]= "1px solid black";
	bordo[4]= "1px solid red";
	bordo[5]= "1px solid gray";
	bordo[6]= "1px solid #464644";
	bordo[7]= "1px solid red";
		
	corrente= window.document.getElementById(id); 
	var l;	
	
	for(l=0; l<8; l++)
	{
	elemento = document.getElementById('scelte').getElementsByTagName('div')[l];
	elemento.style.backgroundImage="url('')";
	elemento.style.zIndex=1;
	}
	
	corrente.style.zIndex=3;
	corrente.style.backgroundImage= immagine[i];
	document.getElementById('contenuti').style.borderTop= bordo[b];
	
}