
if ((navigator.appName=="Microsoft Internet Explorer") && ((navigator.appVersion.indexOf("MSIE 6.0")!='-1') || (navigator.appVersion.indexOf("MSIE 5.5")!='-1'))){
   alert("Attenzione : Non č possibile eseguire una istanza XMLHTTP - il sito potrebbe non dare errori, bloccarsi o essere visualizzato in modo corretto - Aggiornare il browser alla versione 7.0 o successiva");
}


function nulla(){

}

// funzione per prendere un elemento con id univoco
function prendiElementoDaId(id_elemento) {
  var elementoTmp;
  if(document.getElementById){
    elementoTmp = document.getElementById(id_elemento);
  } else {
    elementoTmp = document.all[id_elemento];
  }
  return elementoTmp;
}

	// funzione per assegnare un oggetto XMLHttpRequest
		function assegnaXMLHttpRequest() {
      var XHR = null;
      if (window.ActiveXObject) { // IE
        try {
            XHR = new ActiveXObject("Msxml2.XMLHTTP");
        } catch (e) {
            try {
              XHR = new ActiveXObject("Microsoft.XMLHTTP");
            } catch (e) {
                alert("Errore: l'ActiveX non verrā eseguito - Verificare le impostazioni del Browser attivando l'esecuzione ActiveX");
            }
        }
      } else if (window.XMLHttpRequest) { // Mozilla, Safari,...
        XHR = new XMLHttpRequest();
      }
      if (XHR==null) {
        alert("Attenzione : Non č possibile eseguire una istanza XMLHTTP - l'ActiveX non verrā eseguito - Verificare le impostazioni del Browser attivando l'esecuzione ActiveX");
        return false;
      } else {
        return XHR;
      }
    }


  function loadajax(TmpUrl,TmpDiv,TmpZoom,TmpZoomTitolo) {
  if ((navigator.appName=="Microsoft Internet Explorer") && ((navigator.appVersion.indexOf("MSIE 6.0")!='-1') || (navigator.appVersion.indexOf("MSIE 5.5")!='-1'))){
    alert("Attenzione: Non č possibile eseguire una istanza XMLHTTP - l'ActiveX non verrā eseguito - Aggiornare il browser alla versione 7.0 o successiva");
    return false;
  }
    var
    ajax = assegnaXMLHttpRequest(),
    elemento = prendiElementoDaId(TmpDiv),
    usaLink = true;
    if (TmpZoom!='') {
      document.getElementById('mainopaco').style.display='inline';
      document.getElementById(TmpZoom).style.display='inline';
      document.getElementById(TmpZoom + '-titolo').innerHTML= TmpZoomTitolo;
    } else {
      elemento.style.display='inline';
    }


  // se l'oggetto XMLHttpRequest non č nullo
  if(ajax) {
    usaLink = false;
    ajax.open("GET", TmpUrl, true);
    // rimozione dell'header "connection" come "keep alive"
    ajax.setRequestHeader("connection", "close");
    // impostazione controllo e stato della richiesta
    ajax.onreadystatechange = function() {
      // verifica dello stato
      if(ajax.readyState === readyState.COMPLETATO) {
        // verifica della risposta da parte del server
        if(statusText[ajax.status] === "OK")
          // operazione avvenuta con successo
          elemento.innerHTML = ajax.responseText;
        else {
          // errore di caricamento
          elemento.innerHTML = "Impossibile effettuare l'operazione richiesta.<br />";
          elemento.innerHTML += "Errore riscontrato: " + statusText[ajax.status];
        }
      }
    }
    ajax.send(null);
  }
  return usaLink;
  }




/** OGGETTI / ARRAY */

	// oggetto di verifica stato
		var readyState = {
			INATTIVO:	0,
			INIZIALIZZATO:	1,
			RICHIESTA:	2,
			RISPOSTA:	3,
			COMPLETATO:	4
		};

	// array descrittivo dei codici restituiti dal server
	// [la scelta dell' array č per evitare problemi con vecchi browsers]
		var statusText = new Array();
		statusText[100] = "Continue";
		statusText[101] = "Switching Protocols";
		statusText[200] = "OK";
		statusText[201] = "Created";
		statusText[202] = "Accepted";
		statusText[203] = "Non-Authoritative Information";
		statusText[204] = "No Content";
		statusText[205] = "Reset Content";
		statusText[206] = "Partial Content";
		statusText[300] = "Multiple Choices";
		statusText[301] = "Moved Permanently";
		statusText[302] = "Found";
		statusText[303] = "See Other";
		statusText[304] = "Not Modified";
		statusText[305] = "Use Proxy";
		statusText[306] = "(unused, but reserved)";
		statusText[307] = "Temporary Redirect";
		statusText[400] = "Bad Request";
		statusText[401] = "Unauthorized";
		statusText[402] = "Payment Required";
		statusText[403] = "Forbidden";
		statusText[404] = "Not Found";
		statusText[405] = "Method Not Allowed";
		statusText[406] = "Not Acceptable";
		statusText[407] = "Proxy Authentication Required";
		statusText[408] = "Request Timeout";
		statusText[409] = "Conflict";
		statusText[410] = "Gone";
		statusText[411] = "Length Required";
		statusText[412] = "Precondition Failed";
		statusText[413] = "Request Entity Too Large";
		statusText[414] = "Request-URI Too Long";
		statusText[415] = "Unsupported Media Type";
		statusText[416] = "Requested Range Not Satisfiable";
		statusText[417] = "Expectation Failed";
		statusText[500] = "Internal Server Error";
		statusText[501] = "Not Implemented";
		statusText[502] = "Bad Gateway";
		statusText[503] = "Service Unavailable";
		statusText[504] = "Gateway Timeout";
		statusText[505] = "HTTP Version Not Supported";
		statusText[509] = "Bandwidth Limit Exceeded";


function VerificaOpaco(){
      if (document.getElementById('zoom1').style.display == 'inline' || document.getElementById('zoom2').style.display == 'inline') {
        document.getElementById('mainopaco').style.display='inline';
      } else {
        document.getElementById('mainopaco').style.display='none';
      }
    }



