function oggettoAjax() {
var XHR = null;
var browserUtente = navigator.userAgent.toUpperCase();
 if(typeof(XMLHttpRequest) === "function" || typeof(XMLHttpRequest) === "object")
 {
 XHR = new XMLHttpRequest();
 }
 else if(window.ActiveXObject && browserUtente.indexOf("MSIE 4") < 0) 
 {
         if(browserUtente.indexOf("MSIE 5") < 0)
         {XHR = new ActiveXObject("Msxml2.XMLHTTP");}
         else
         {XHR = new ActiveXObject("Microsoft.XMLHTTP");}
 }
return XHR;
} 

function prendiElementoDaId(id_elemento) {
 var elemento;
 if(document.getElementById)
  {elemento = document.getElementById(id_elemento);}
 else
  {elemento = document.all[id_elemento];}
 return elemento;
}


// Variabili per settare il timer
var timerID = 0;
var tStart  = null;
var timeout = 4;

function UpdateTimer() {
   if(timerID) {
      clearTimeout(timerID);
      clockID  = 0;
   }

   if(!tStart)
      tStart   = new Date();

   var   tDate = new Date();
   var   tDiff = tDate.getTime() - tStart.getTime();

   tDate.setTime(tDiff);
   //var tempo = prendiElementoDaId("numero");
   //tempo.innerHTML = tDate.getSeconds();
      if (tDate.getSeconds()>timeout) {
	     XMLHTTP.onreadystatechange = function(){return;};
	     XMLHTTP.abort();
	     var errore = prendiElementoDaId("modelli");
         errore.innerHTML = '<font color="#FF0000" style="font-family:Verdana, Arial, Helvetica, sans-serif; font-size:11px"><b>Server does not answer... <span style="cursor:pointer; color:#095471" onclick="Richiesta();">Try again</span></b></font>';
         var loader = prendiElementoDaId("loader");
         loader.innerHTML = '';
      }
      else {
         timerID = setTimeout("UpdateTimer()", 1000);
      }
}

function StartTimer() {
   tStart   = new Date();
   timerID  = setTimeout("UpdateTimer()", 1000);
}

function StopTimer() {
   if(timerID) {
      clearTimeout(timerID);
      timerID  = 0;
   }
   tStart = null;
}

function ResetTimer() {
	if (XMLHTTP.readyState == 4) {
		StopTimer();
	}
	else {
        tStart = null;
	}
}


// QUESTO CODICE SERVE PER IL MENU' ESPANDIBILE
function roll(id) {
if(document.getElementsByTagName && document.getElementById) {
   document.getElementById(id).setAttribute('src','image/freccina2.gif');
   }
}
function restore(id) {
if(document.getElementsByTagName && document.getElementById) {
   document.getElementById(id).setAttribute('src','image/freccina.gif');
   }
}
var sottomenu="";
function dettagli(id) {
if(document.getElementsByTagName && document.getElementById) {
   var aperti = document.getElementById('sottomenu').getAttribute('name');
   var id1=id+" cartucce";
   var id2=id+" toner";
   if (document.getElementById(id1).className=='nascosto') {
     if (aperti!='') {
     document.getElementById(aperti+" cartucce").className="nascosto";
     document.getElementById(aperti+" toner").className="nascosto";
	    if (aperti=="Xerox") {
        document.getElementById(aperti+" solid").className="nascosto";
        }
     }
   document.getElementById(id1).className="visibile";
   document.getElementById(id2).className="visibile";
	    if (id=="Xerox") {
        document.getElementById(id+" solid").className="visibile";
        }
   document.getElementById("sottomenu").setAttribute('name',id);
   }
   else {
   document.getElementById(id1).className="nascosto";
   document.getElementById(id2).className="nascosto";
	    if (id=="Xerox") {
        document.getElementById(id+" solid").className="nascosto";
        }
   document.getElementById("sottomenu").setAttribute('name','');
   }
}}