/*-----------------------------------------------*/
/*------------ 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 ------------------------*/
/*-----------------------------------------------*/

function Zoom(UrlZoom,larghezza,altezza){

createXMLHttpRequest();

		if (document.getElementById("Zoom")!=null){

			var ElementoSfondoImmagine = document.getElementById("Zoom_0");
			ElementoSfondoImmagine.style.display = "none";
			ElementoSfondoImmagine.style.display = "block";

			var ElementoImmagine = document.getElementById("Zoom");
			ElementoImmagine.style.display = "none";
			ElementoImmagine.style.display = "block";
			ElementoImmagine.style.width = larghezza+"px";
			ElementoImmagine.style.height = altezza+"px";

//			ElementoImmagine.style.left = ((screen.width)/2)-(parseInt(larghezza/2))+"px";
//			ElementoImmagine.style.top = ((screen.height)/2)-(parseInt(altezza/2))+"px";	

			ElementoImmagine.style.marginLeft = "-"+(parseInt(larghezza/2))+"px";
			ElementoImmagine.style.marginTop = "-"+(parseInt(altezza/2))+"px";
			
		}

		var	postData = ""
		postData = postData + ""

		xmlHttp.open("POST", "zoom.asp"+UrlZoom, true);
		xmlHttp.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
		xmlHttp.setRequestHeader("Content-length", postData.length);
		xmlHttp.setRequestHeader("Connection", "close");
		xmlHttp.onreadystatechange = handleStateZoom;
		xmlHttp.send(postData);

}

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);
		}

}

/*-----------------------------------------------*/
/*-----------------------------------------------*/
/*-----------------------------------------------*/
