/*-----------------------------------------------*/
/*------------ INIZIALIZZO OGGETTO --------------*/
/*-----------------------------------------------*/

var xmlHttp;

function createXMLHttpRequest(){

	if (window.XMLHttpRequest) {
	   xmlHttp = new XMLHttpRequest();
	} else if (window.ActiveXObject) { // IE
	   xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
	} else {
	   alert('Impossibile continuare: il tuo browser non supporta XMLHttpRequest');
	}

}
/*-----------------------------------------------*/
/*-----------------------------------------------*/
/*-----------------------------------------------*/

/*-----------------------------------------------*/
/*------------ IMMAGINE PRELOAD -----------------*/
/*-----------------------------------------------*/

Testo_Check_Av = "";
Testo_Check_Av = Testo_Check_Av + "<table border='0' cellpadding='0' cellspacing='0' style='margin-top:5px;width:100%; FONT-SIZE: 11px;COLOR: #000000; FONT-FAMILY: Trebuchet MS, Verdana;'>"
Testo_Check_Av = Testo_Check_Av + "<tr><td>"
Testo_Check_Av = Testo_Check_Av + "<center>loading</center>"
Testo_Check_Av = Testo_Check_Av + "</td></tr>"
Testo_Check_Av = Testo_Check_Av + "</table>"

/*-----------------------------------------------*/
/*-----------------------------------------------*/
/*-----------------------------------------------*/

/*-----------------------------------------------*/
/*------------ BookItTop ------------------------*/
/*-----------------------------------------------*/




/*-----------------------------------------------*/
/*------------ POPUP ----------------------------*/
/*-----------------------------------------------*/

function VisualizzaPopUp(){

		createXMLHttpRequest();

		if (document.getElementById("PopUp_0")!=null){
			var ElementoImmagine = document.getElementById("PopUp_0");
			ElementoImmagine.style.display = "none";
			ElementoImmagine.style.display = "block";
			ElementoImmagine.focus();
		}

		if (document.getElementById("PopUp_1")!=null){
			var ElementoImmagine = document.getElementById("PopUp_1");
			ElementoImmagine.style.display = "none";
			ElementoImmagine.style.display = "block";
			ElementoImmagine.focus();
		}

		setTimeout("document.getElementById('PopUp_0').style.display = 'none';",6000);
		setTimeout("document.getElementById('PopUp_1').style.display = 'none';",6000);

}

function ChiudiPopUp(){

		if (document.getElementById("PopUp_0")!=null){
			var ElementoImmagine = document.getElementById("PopUp_0");
			ElementoImmagine.style.display = "none";
		}

		if (document.getElementById("PopUp_1")!=null){
			var ElementoImmagine = document.getElementById("PopUp_1");
			ElementoImmagine.style.display = "none";
		}

}

/*-----------------------------------------------*/
/*-----------------------------------------------*/
/*-----------------------------------------------*/

/*-----------------------------------------------*/
/*------------ ZOOM IMMAGINE --------------------*/
/*-----------------------------------------------*/


function Zoom(NomeElemento,Destinazione,UrlFile){
	
//	document.images[Destinazione].src='ICONE/loading/7.gif';
	
	if ( document.getElementById("fotografia_selezionata") != null ){
	
		nome_elemento_evidenziato = document.getElementById("fotografia_selezionata").value ;
		nome_elemento_da_evidenziare = NomeElemento ;
		
		if ( nome_elemento_evidenziato != "" ){
		
			document.getElementById(nome_elemento_evidenziato).style.color = "#000000";
			document.getElementById(nome_elemento_evidenziato).style.textDecoration = "none";
		
		}
			
		document.getElementById("fotografia_selezionata").value = NomeElemento ;
		
		document.getElementById(nome_elemento_da_evidenziare).style.color = "#BFBEC3";
		document.getElementById(nome_elemento_da_evidenziare).style.textDecoration = "underline";
		document.getElementById(nome_elemento_da_evidenziare).focus();
		
		document.images[Destinazione].src = UrlFile;
				
	}

}
function handleStateZoom(){

Messaggio = "";
Messaggio = Messaggio + "<table border='0' cellpadding='0' cellspacing='0' style='width:100%; FONT-SIZE: 11px;COLOR: #000000; FONT-FAMILY: Trebuchet MS, Verdana;'>"
Messaggio = Messaggio + "  <tr><td>"
Messaggio = Messaggio + "<center>Impossibile visualizzare il contenuto richiesto ....</center>"
Messaggio = Messaggio + "  </td></tr>"
Messaggio = Messaggio + "</table>"

		if (xmlHttp.readyState==4){

			if (xmlHttp.status == 200){

				document.getElementById("Zoom").innerHTML = xmlHttp.responseText;

			}else{

				// INTERCETTO ERRORE E VISUALIZZO
				handleErrFullPage(xmlHttp.responseText);
				//-------------------------------
				
				document.getElementById("Zoom").innerHTML = Messaggio;
			}
		
		}else{
				
			document.getElementById("Zoom").innerHTML = Testo_Check_Av
			
		}


}

/*-----------------------------------------------*/
/*-----------------------------------------------*/
/*-----------------------------------------------*/

/*-----------------------------------------------*/
/*--- GESTIONE E VISUALIZZAZIONE ERRORI ---------*/
/*-----------------------------------------------*/

function handleErrFullPage(strIn) {	

        var errorWin;

        // Create new window and display error
        try {
			errorWin = window.open('', 'errorWin');
			errorWin.document.body.innerHTML = strIn;
        }
        // If pop-up gets blocked, inform user
        catch(e) {
			alert(strIn);
		}

}

/*-----------------------------------------------*/
/*-----------------------------------------------*/
/*-----------------------------------------------*/
