<!--

var reload_monitor=2;

lstart=20
ustart=20
speed_loop=500
speed_click=50
speed_mouseout=50
pr_step=5

function checkBrowser(){
	this.ver=navigator.appVersion
	this.dom=document.getElementById?1:0
	this.ie5=(this.ver.indexOf("MSIE 5")>-1 && this.dom)?1:0;
	this.ie4=(document.all && !this.dom)?1:0;
	this.ns5=(this.dom && parseInt(this.ver) >= 5) ?1:0;
	this.ns4=(document.layers && !this.dom)?1:0;
	this.bw=(this.ie5 || this.ie4 || this.ns4 || this.ns5)
	return this
}
var bw=new checkBrowser();

function Getobj(obj,nest){
   return(bw.dom?document.getElementById(obj):bw.ie4?document.all[obj]:bw.ns4?eval(nest+'document.'+obj):0);
   }
function Getstyle(obj,nest){
   return(bw.dom?document.getElementById(obj).style:bw.ie4?document.all[obj].style:bw.ns4?eval(nest+'document.'+obj):0);
   }

function makeObj(obj,nest){
   nest=(!nest) ? '':'document.'+nest+'.'
 //  this.el=document.getElementById(obj);
//   this.el=bw.dom?document.getElementById(obj):bw.ie4?document.all[obj]:bw.ns4?eval(nest+'document.'+obj):0;
//   this.css=document.getElementById(obj).style;
//   this.css=bw.dom?document.getElementById(obj).style:bw.ie4?document.all[obj].style:bw.ns4?eval(nest+'document.'+obj):0;
   this.el=Getobj(obj,nest);
   this.css=Getstyle(obj,nest);
   this.scrollHeight=this.el.offsetHeight;
   this.scrollWidth=this.el.offsetWidth;
   this.lTextScroll=lTextScroll;
   this.cTextScroll=cTextScroll;
   this.moveIt=f_moveIt; 
   this.x;
   this.y;
   this.obj = obj + "Object";
   eval(this.obj + "=this");
   return this;
   }

function f_moveIt(x,y){
   this.x=x;
   this.y=y;
   this.css.left=this.x;
   this.css.top=this.y;
   }

function textScrollInit(current,verso,divtesto){
   oTextCont=new makeObj(current+'_cont');
   oTextCont.css.visibility='visible';
   if(divtesto=='')
      oTextScroll=new makeObj(current+'_text',current+'_cont');
   else
      oTextScroll=new makeObj(divtesto,current+'_cont');
   if(verso=='v')
      oTextScroll.moveIt(0,lstart);
   else
      oTextScroll.moveIt(ustart,0);
   return(oTextScroll);
   }

function cTextScroll(direction,verso){
   if(verso=='v'){
      if(direction=='up'){
         if(this.y>-this.scrollHeight){
            this.moveIt(0,this.y-pr_step); 
   	   }
         }
      else {
         if(this.y<this.scrollHeight){
            this.moveIt(0,this.y+pr_step);
    	    }
         }
      }
   else {
      if(direction=='le'){
         if(this.x>-this.scrollWidth){
            this.moveIt(this.x-pr_step,0); 
   	   }
         }
      else {
         if(this.x<this.scrollWidth){
            this.moveIt(this.x+pr_step,0);
    	    }
         }
      }
   }

function lTextScroll(direction,modo){
   if(modo=='stop'){
      if(direction=='up')
         clearInterval(txt_skr_up);
      else
         clearInterval(txt_skr_dw);
      }
   else {
      if(direction=='up'){
         if(this.y>-this.scrollHeight){
	    if(txt_skr_up!= undefined)
	       clearInterval(txt_skr_up);
            this.moveIt(0,this.y-pr_step)
            txt_skr_up=setInterval(this.obj+".lTextScroll('"+direction+"','"+modo+"')",speed_mouseover);
            }
         }
      else {
         if(this.y>-this.scrollHeight){
	    if(txt_skr_dw!= undefined)
	       clearInterval(txt_skr_dw);
            this.moveIt(0,this.y+pr_step)
            txt_skr_dw=setInterval(this.obj+".lTextScroll('"+direction+"','"+modo+"')",speed_mouseover);
            }
         }
      }
   }

function change_contents(dove,cosa){
   var changer_div=Getobj(dove);
//   var changer_style=Getstyle(dove);
   changer_div.innerHTML=cosa;
   }

function swap_contents(originale,modifica){
   var changer_orig=Getobj(originale);
   var changer_orig_style=Getstyle(originale);
   var changer_mod=Getobj(modifica);
   var changer_mod_style=Getstyle(modifica);
   change_mod_style.left=changer_orig_style.left;
   change_mod_style.top=changer_orig_style.top;
   change_orig_style.visibility='hidden';
   change_mod_style.visibility='visible';
   }

function renderMenu(base,quale,s){
   /* us lo standard DOM . Probabilmente incompatibili coi vecchi browser */
   buf='';
   if(quale!='vuoto'){
      thismenu=menu[quale];
      document.getElementById(base).style.left=mposiz[quale];
      for(i=0;i<thismenu.length;i++){
         if(thismenu[i]['name']==s)
            buf=buf+"<p style='color:rgb(145,0,31);font-size:7pt'>&nbsp;&nbsp;"+thismenu[i]['label']+"</p>";
         else
            buf=buf+"<a href='"+thismenu[i]['link']+"'>&nbsp;&nbsp;"+thismenu[i]['label']+"</a><br>";
	 }
      }
   else buf='&nbsp;';
   document.getElementById(base).innerHTML=buf;
   }
//var xmlHttp;
function getMenu (serv,gsid){
   G_SID = gsid;
   xmlHttp=GetXmlHttpObject();
   if (xmlHttp==null){
      alert ("Browser does not support HTTP Request");
      return;
      }
   var url="/php/MON_controlli.php?G_SID="+G_SID+"&_codi_serv="+serv+"&menu=1&rnd=" + Math.random();
   xmlHttp.open("GET",url,true);
   xmlHttp.onreadystatechange=updateMenu;
   xmlHttp.send(null);
   } 

function updateMenu() { 
   if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete"){ 
      resp=xmlHttp.responseText;
      //alert(resp);
      eval(resp);
      //document.getElementById('menu_h').innerHTML=resp;
      //alert(xmlHttp);
      //alert(xmlHttp.responseText);
      }
   }

function getNews (gsid){
   //G_SID = gsid;
   newsObj=GetXmlHttpObject();
   if (newsObj==null){
      alert ("Browser does not support HTTP Request");
      return;
      }
   var unreach = (document.getElementById('unreach') ? document.getElementById('unreach').value : 0);
   var url=proxy_js+"MON_monitor.php?G_SID="+gsid+"&bg=1"+"&unreach="+unreach+url_random();
   newsObj.open("GET",url,true);
   newsObj.onreadystatechange=updateNews;
   newsObj.send(null);
   setTimeout('getNews(\''+gsid+'\')',delay);
   } 

function updateNews() { 
   if (newsObj.readyState==4 || newsObj.readyState=="complete") { 
      resp=newsObj.responseText;
      eval(resp);
      }
   }



//->

