var RootElement1;
var nodecount;
var Nodo;
var mouseY = "";
var mouseX = "";
var sezione = '';
var testo;
var nodoValore = '';
var video='';

var ns = (document.layers)? true:false
var ie = (document.all)? true:false

if(screen.width==800){
var regles=new Array();
if (document.styleSheets[0].cssRules) regles=document.styleSheets[0].cssRules
else if (document.styleSheets[0].rules) regles = document.styleSheets[0].rules
for(i=0;i<2;i++){
regles[i].style.fontSize =  "9px";
}
var video=0
}
else{var video=1}

function MM_openBrWindow(theURL,winName,features) {
window.open(theURL,winName,features);
}

document.onmousemove = mouseMoveHandler;

function mouseMoveHandler () {
	window.status="ASL COMO";
}

/*function avvio(){
if(append==1){; return;}
setTimeout("avvio()",50);
}*/

function MouseInit()
{
/* MSIE, Konqueror, Opera : */
  if (document.all)
    window.onmousemove=mousemove;
/* Netscape, Mozilla : */
  else
  {
/* Netscape6, Mozilla : */
    if (typeof(document.addEventListener)=="function")
      document.addEventListener("mousemove",mousemove,true);
/* Netscape4 : */
    else
    {
      window.captureEvents(Event.MOUSEMOVE);
      window.onmousemove=mousemove;
    }
  }
}

function mousemove(event)
{
/* MSIE, Opera : */
  if (document.all)
  {
    mouseX=event.clientX;
    mouseY=event.clientY;	
    if (document.body.scrollLeft)
      mouseX+=document.body.scrollLeft;
    if (document.body.scrollTop)
      mouseY+=document.body.scrollTop;
  }
/* Netscape, Mozilla : */
  else
  {
    mouseX=event.pageX;
    mouseY=event.pageY;
  }

}

NumFile = 0

function loadContent(file){	
	var Body = document.getElementsByTagName("body").item(0);	
	Script = document.createElement("script");
	Script.type = "text/javascript";
	Script.id = "loadscript"+(NumFile)+1;
	Script.src = "css_js/"+file+".js";	
	if (Body){
	  Body.appendChild(Script);	
	}		
}

function attesa(){
document.getElementById('mbody').style.cursor = "wait"
}

function TemineAttesa(){
document.getElementById('mbody').style.cursor = "default"
}
////////////////////////////////////////////////////////////////////////////////////////
//---------------------------Fine Home ---------------------------------------------////
///////////////////////////////////////////////////////////////////////////////////////

////////////////////////////////////////////////////////////////////////////////////////
//---------------------------Inizio Link -------------------------------------------////
///////////////////////////////////////////////////////////////////////////////////////
var loc
function visualLink(loc){
	if (loc=='ProvComo'){
					document.getElementById("visProvComo").style.display = "block";
					document.getElementById("visProvComo").style.color = "red"
					document.getElementById("visRegLomb").style.display = "none";
					document.getElementById("visMinisteri").style.display = "none";	
					document.getElementById("visOrgInt").style.display = "none";	
					document.getElementById("visAss").style.display = "none";			
		}
	if (loc=='RegLomb'){
					document.getElementById("visRegLomb").style.display = "block";
					document.getElementById("visRegLomb").style.color = "red"	
					document.getElementById("visProvComo").style.display = "none";
					document.getElementById("visMinisteri").style.display = "none";
					document.getElementById("visOrgInt").style.display = "none";	
					document.getElementById("visAss").style.display = "none";		
		}
	if (loc=='Ministeri'){
					document.getElementById("visMinisteri").style.display = "block";
					document.getElementById("visMinisteri").style.color = "red"		
					document.getElementById("visProvComo").style.display = "none";
					document.getElementById("visRegLomb").style.display = "none";
					document.getElementById("visOrgInt").style.display = "none";	
					document.getElementById("visAss").style.display = "none";		
		}
	if (loc=='OrgInt'){
					document.getElementById("visOrgInt").style.display = "block";
					document.getElementById("visOrgInt").style.color = "red"	
					document.getElementById("visProvComo").style.display = "none";
					document.getElementById("visRegLomb").style.display = "none";
					document.getElementById("visMinisteri").style.display = "none";	
					document.getElementById("visAss").style.display = "none";	
		}		
	if (loc=='Ass'){
					document.getElementById("visAss").style.display = "block";
					document.getElementById("visAss").style.color = "red"	
					document.getElementById("visProvComo").style.display = "none";
					document.getElementById("visRegLomb").style.display = "none";
					document.getElementById("visMinisteri").style.display = "none";
					document.getElementById("visOrgInt").style.display = "none";		
		}							
}	

function visualizza(url){
document.getElementById("main").innerHTML = "<iframe width='393' height='730' src='"+url+"' name='Ifmain' id=Ifmain' frameborder='0' scrolling='No' onLoad='resizeIframe(this)'></iframe>";
}

function resizeIframe(objIframe){
altezza = objIframe.contentWindow.document.body.scrollHeight
if(altezza>objIframe.height){objIframe.style.height = objIframe.contentWindow.document.body.scrollHeight};
}
////////////////////////////////////////////////////////////////////////////////////////
//---------------------------Fine Link ---------------------------------------------////
///////////////////////////////////////////////////////////////////////////////////////

function elenco(vis){
if(vis=='show'){
document.getElementById("elenco").style.display = 'block';
document.getElementById("elencostrut").href = 'javascript:elenco(\'hidden\')';
}
else{
document.getElementById("elenco").style.display = 'none';
document.getElementById("elencostrut").href = 'javascript:elenco(\'show\')';
}
}

function hide(){document.getElementById("popup").style.visibility = 'hidden';}

function tabellaServizi(telefono,indirizzo,titolo,inforetta,tipo,data){
	if(tipo=="TA"){tipo="Info"}
	else{
	retta = inforetta.split("|")
	tipo1="Retta Min"
	tipo2="Retta Max"
	}
    mouseX=event.clientX;
    mouseY=event.clientY;	
    if (document.body.scrollLeft)
      	mouseX+=document.body.scrollLeft;
    if (document.body.scrollTop)
      	mouseY+=document.body.scrollTop; 

	document.getElementById("popup").style.visibility = "visible";

	indirizzo = indirizzo.replace("'","&rsquo;")

	tabella =   '<table border="1" bordercolor="#000000" cellpadding="0" cellspacing="0"><tr>'
	tabella = tabella + '<td><table width="350" bgcolor="#ffffff" border="0" cellpadding="0" cellspacing="0">'
	tabella = tabella + '<tr><td colspan="2"><table width="100%" border="0" cellpadding="0" cellspacing="0"><tr bgcolor="#77C8E3"><td style="padding-left:2px" class="testoInfo"><strong>'+unescape(titolo)+'</strong></td><td align="right"><a onclick="hide()" style="cursor:hand;" onfocus="this.blur()" title="Chiudi Finestra Informativa"><img src="../images/close_dwn.gif" alt="" border="0" hspace="5" vspace="2" onmouseover="this.src=\'../images/close_up.gif\';" onmouseout="this.src=\'../images/close_dwn.gif\';" title="Chiudi Finestra Informativa"></a></td></tr></table></td></tr>'
	tabella = tabella + '<tr><td colspan="2" width="1" bgcolor="#000000" height="2"></td></tr>'
	tabella = tabella + '<tr><td class="testoInfo" width="100" valign="top" style="padding-left:2px;padding-top:2px;padding-bottom:2px">Indirizzo :</td><td valign="top" class="testoInfo" width="350" style="padding-top:2px;padding-bottom:2px">'+unescape(indirizzo)+'</td></tr><tr><td colspan="2" height="1" bgcolor="#000000"></td></tr><tr><td class="testoInfo" valign="top" style="padding-left:2px;padding-top:2px;padding-bottom:2px">Telefono :</td>'
	tabella = tabella + '<td valign="top" class="testoInfo" style="padding-top:2px;padding-bottom:2px">'+telefono+'</td></tr><tr><td colspan="2" height="1" bgcolor="#000000"></td></tr>'
	if(tipo=="RETTA"){
	tabella = tabella + '<tr><td class="testoInfo" valign="top" style="padding-left:2px;padding-top:2px;padding-bottom:2px" colspan="2"><strong>Retta Giornaliera</strong></td></tr>'
	tabella = tabella + '<tr><td colspan="2" width="1" bgcolor="#000000" height="1"></td></tr>'
	tabella = tabella + '<tr><td class="testoInfo" width="100" valign="top" style="padding-left:2px;padding-top:2px;padding-bottom:2px">'+tipo1+' :</td><td valign="top" class="testoInfo" width="350" style="padding-top:2px;padding-bottom:2px">&euro;&nbsp;'+retta[0]+'</td></tr>'
	tabella = tabella + '<tr><td class="testoInfo" width="100" valign="top" style="padding-left:2px;padding-top:2px;padding-bottom:2px">'+tipo2+' :</td><td valign="top" class="testoInfo" width="350" style="padding-top:2px;padding-bottom:2px">&euro;&nbsp;'+retta[1]+'</td></tr>'
	tabella = tabella + '<tr><td colspan="2" height="1" bgcolor="#000000"></td></tr>'
	tabella = tabella + '<tr><td class="testoInfo" valign="top" style="padding-left:2px;padding-top:2px;padding-bottom:2px" colspan="2"><strong>Data Aggiornamento : '+data+'</strong></td></tr>'
	}
	else{tabella = tabella + '<tr><td class="testoInfo" width="100" valign="top" style="padding-left:2px;padding-top:2px;padding-bottom:2px">'+tipo+' :</td><td valign="top" class="testoInfo" width="350" style="padding-top:2px;padding-bottom:2px">'+unescape(inforetta)+'</td></tr>'}	
	tabella = tabella + '</table></td></tr></table>';

	
	document.getElementById("popup").style.top = mouseY+10;
	document.getElementById("popup").style.left = mouseX+30;
	document.getElementById("popup").innerHTML = tabella;
}

	//funzione per apertura/chiusura tabs nella sezione "gare"
	function scambiaTabsGare (tabdascambiare)
	{
	
	if (document.getElementById(tabdascambiare).style.display=='none')
	   {
	   //Aperto
	   document.getElementById(tabdascambiare).style.display='';
	   document.getElementById("IMGv"+tabdascambiare).style.display='';
	   document.getElementById("IMGo"+tabdascambiare).style.display='none';
	   }	
	   else
	   {
	   //Chiuso
	   document.getElementById(tabdascambiare).style.display='none';
	   document.getElementById("IMGv"+tabdascambiare).style.display='none';
	   document.getElementById("IMGo"+tabdascambiare).style.display='';

	   }
	}
