//*******************************
//* Script generali i siti      *
//*******************************

visibile = 1;


	function illumina(id)
	{
		old = document.getElementById("img_" + id).src;
		src_nuovo = old.substring(0, old.length - 4) + "_sel" + old.substring(old.length - 4);
		document.getElementById("img_" + id).src = src_nuovo;
	}

	function spegni(id)
	{
		old = document.getElementById("img_" + id).src;
		src_nuovo = old.substring(0, old.length - 8) + ".jpg";
		document.getElementById("img_" + id).src = src_nuovo;
	}

	function ShowPage(numero)
	{
		try{
			document.getElementById("page_Descrizione_" + visibile).style.visibility = "hidden";
			document.getElementById("pager_" + visibile).style.fontWeight = "normal";
		}catch(e){}
		
		try{
			document.getElementById("page_Descrizione_" + numero).style.visibility = "visible";
			document.getElementById("pager_" + numero).style.fontWeight = "bold";
		}catch(e){}
		
		visibile = numero;
	}
	
	function ShowPage2(numero, id)
	{
	    try
	    {
	        document.getElementById("pager_" + id + "_" + visibile).style.fontWeight = "normal";
	    }	 
	    catch(e){}
	    
	    try
	    {
	        //contenuto nuovo
	        temp = eval("listaContenuti_" + id + "[" + (numero - 1) + "]").replace(/''/g,'"');
	        //alert(temp);
	        document.getElementById(id).innerHTML = temp;
	        document.getElementById("pager_" + id + "_" + numero).style.fontWeight = "bold";	        
	    }	 
	    catch(e){}
	    
	    visibile = numero;
	}
	
	roll_mostrato = ""
	function mostra_roll(id)
	{
	    document.getElementById("rollover_" + id).style.visibility = "visible";
	    roll_mostrato = id
	}
	
	function nascondi_roll(id)
	{
	    if(roll_mostrato != "")
	        document.getElementById("rollover_" + roll_mostrato).style.visibility = "hidden";
	}
	
	
	nascosto = "";
	
	function nascondi_layer(id)
	{
		if(document.getElementById(id) != null)
			document.getElementById(id).style.visibility = "hidden";
	}
	
	function visualizza_layer(id)
	{
		if(nascosto != id){
			document.getElementById(id).style.visibility = "visible";
		}
	}

	/*function PopGallery(path, num) {

		if(path == '')
			return;
			
	    //document.getElementById("img_testata").src = path;
	    window.open('<%=UiUtils.GetPath%>/popup/popgallery.aspx?ID=<%=m_oPagina.UniqueID%>&Path=' + path,'Photogallery','scrollbars=no,resizable=no,status=no,location=no,toolbar=no,width=400,height=400,top=0,left=0');
        return;
        
		temp = nascosto;
		nascosto = "layer_trasp_" + num;
		nascondi_layer(nascosto);
		if(temp != ""){
			visualizza_layer(temp);
			//document.getElementById(temp).innerHTML = "<img src=" + path + ">";
		}
	}*/
	
	function show_photo(path, id)
	{
	    location.href = "gallery.aspx?ID=<%=m_oPagina.UniqueID%>&path=" + path + "&IDF=" + id
	}

    function check_sel(obj)
    {
	    m_oggetto = document.getElementById(obj);
	    if(!m_oggetto.checked)
	    {
		    alert("Devi accettare la nota informativa");
		    return false;
	    }
	    else
	    {
		    return true;
	    }
    }
    
    //script per la vignetta
	function showhint(hint){
		//hint non deve contenere '  ,usare il carattere ^
	    //per le " usare il carattere \"
	    document.getElementById("hint_div").style.display = "block";

	    var scroll = getScrollXY();

	    /*if (IE) {*/
	    document.getElementById("hint_div").style.top = window.event.clientY + scroll[1] - 34 + "px";
	    document.getElementById("hint_div").style.left = window.event.clientX + scroll[0] - 34 + "px";
	    /*}
	    else {
	        document.getElementById("hint_div").style.top = e.pageY - 34 + "px";
	        document.getElementById("hint_div").style.left = e.pageX - 6 + "px";
	        alert(e.pageY);
	        alert(e.pageX);
	    }*/
	    
		document.getElementById("hint_div_text").innerHTML = "<nobr>" + hint.replace(/"^"/g,"'") + "</nobr>";
    }

    function getScrollXY() {
        var scrOfX = 0, scrOfY = 0;
        if (typeof (window.pageYOffset) == 'number') {
            //Netscape compliant
            scrOfY = window.pageYOffset;
            scrOfX = window.pageXOffset;
        } else if (document.body && (document.body.scrollLeft || document.body.scrollTop)) {
            //DOM compliant
            scrOfY = document.body.scrollTop;
            scrOfX = document.body.scrollLeft;
        } else if (document.documentElement && (document.documentElement.scrollLeft || document.documentElement.scrollTop)) {
            //IE6 standards compliant mode
            scrOfY = document.documentElement.scrollTop;
            scrOfX = document.documentElement.scrollLeft;
        }
        return [scrOfX, scrOfY];
    }
	
	function hidehint(){
	    document.getElementById("hint_div").style.display = "none";
		document.getElementById("hint_div_text").innerHTML = "";
	}
	//---

	function popfiera(id){
		window.open('<%=UiUtils.GetPath%>/popup/pop_fiere.aspx?ID=' + id,'Fiere','scrollbars=no,resizable=no,status=no,location=no,toolbar=no,width=380,height=400,top=0,left=0');
	}

	function pop_evento(id){	    
		window.open('<%=UiUtils.GetPath%>/popup/popEvento.aspx?ID=' + id,'Evento','scrollbars=no,resizable=no,status=no,location=no,toolbar=no,width=400,height=450,top=0,left=0');
	}


    function popnota() {
	    window.open('<%=UiUtils.GetPath%>/popup/NotaInfo.htm','NotaInformativa','scrollbars=no,resizable=no,width=300,height=300,status=no,location=no,toolbar=no');
    }

    function PopMarcialonga() {
	    window.open('<%=UiUtils.GetPath%>/popup/Marcialonga.htm','Marcialonga','scrollbars=no,resizable=no,width=600,height=400,status=no,location=no,toolbar=no');
    }
    
     function PopMichelin(UrlDestinazione) {
	    window.open(UrlDestinazione,'Michelin','scrollbars=yes,resizable=no,width=500,height=650,status=no,location=no,toolbar=no');
    }

	function pop_layer(){
	    return;
		document.getElementById("div_layer").style.visibility = "visible";
	}
	
	function chiudi_layer()
	{
		document.getElementById("div_layer").style.visibility = "hidden";
	}
	
	
    //funzioni per i meni a sparizione
	var v_TimeOutID;
	var aperto = "";
	var da_non_chiudere = "";
	
	function apri_menu(menu)
	{
	    //if(aperto != "" && aperto != da_non_chiudere)
	    //    chiudi_menu(aperto);
	    //alert(menu + "-" + da_non_chiudere);
	    if(aperto != "")
	        chiudi_menu(aperto);	    
	    if(da_non_chiudere != "" && menu != da_non_chiudere)
	        chiudi_menu(da_non_chiudere);
	        
	    ferma_timer();
	    document.getElementById(menu).style.display = "inline";
	    aperto = menu;
	    
	    temp_menu = menu.substring(8);
	    //alert(temp_menu);
	    document.getElementById('menu_' + temp_menu).style.backgroundColor = "";
	    document.getElementById('menu_' + temp_menu).style.color = "#907436";
	}
	
	function chiudi_menu(menu)
	{
	    document.getElementById(menu).style.display = "none";
	    temp_menu = menu.substring(8);
	    //alert(temp_menu);
	    document.getElementById('menu_' + temp_menu).style.color = "";
	    document.getElementById('menu_' + temp_menu).style.backgroundColor = "";
	    
	    aperto = "";
	    
	    if(da_non_chiudere != "" && da_non_chiudere != menu)
	        apri_menu(da_non_chiudere);
	}
	
	function avvia_timer(menu)
	{
	    v_TimeOutID = setTimeout("chiudi_menu('" + menu + "')",250);
	}
	
	function ferma_timer()
	{
	    window.clearTimeout(v_TimeOutID);
	}

    function load()
    {
    }

    function GUnload()
    {
    }