var re_try_time = 1000;var NS = (navigator.appName == "Netscape");var IE = (navigator.appName == "Microsoft Internet Explorer");var main_tout = null; // main timeout idfunction show(layer) {  if (NS && document[layer] || IE && document.all[layer]) {  // html code has been read ...              if (NS) document[layer].visibility = "show";    else  document.all[layer].style.visibility = "visible";   }   else setTimeout("show("+layer+")", re_try_time); }function hide(layer) {  if (NS && document[layer] || IE && document.all[layer])  // html code has been read ...         if (NS) document[layer].visibility = "hide";   else  document.all[layer].style.visibility = "hidden";  else setTimeout("hide("+layer+")", re_try_time); }    function moveBy(layer, x, y) {            if (NS && document[layer] || IE && document.all[layer]) // html code has been read ...   if (NS) {       //alert("PRIMA left: "+document[layer].left+"\ntop: "+document[layer].top);       document[layer].left = document[layer].left+x;        document[layer].top  = document[layer].top+y;        //alert("DOPO left: "+document[layer].left+"\ntop: "+document[layer].top);   }       else {       //alert("PRIMA left: "+document.all[layer].style.pixelLeft+"\ntop: "+document.all[layer].style.pixelTop);       document.all[layer].style.pixelLeft = document.all[layer].style.pixelLeft+x;       document.all[layer].style.pixelTop  = document.all[layer].style.pixelTop+y;       //alert("DOPO left: "+document.all[layer].style.pixelLeft+"\ntop: "+document.all[layer].style.pixelTop);   }     else setTimeout("moveBy("+layer+","+dimx+","+dimy+")", re_try_time);       }       function moveTo(layer, x, y) {            if (NS && document[layer] || IE && document.all[layer]) // html code has been read ...   if (NS) {       document[layer].left = x;        document[layer].top  = y;    }       else {       document.all[layer].style.pixelLeft = x;       document.all[layer].style.pixelTop  = y;   }          else setTimeout("move("+layer+","+dimx+","+dimy+")", re_try_time);        }         function getLeft(layer) {            var data=0;        if (NS && document[layer] || IE && document.all[layer]) { // html code has been read ...    if (NS) data = document[layer].left;            else  data = document.all[layer].style.pixelLeft;  }   else setTimeout("getLeft("+layer+")", re_try_time);         return data;}               function getTop(layer) {            var data=0;        if (NS && document[layer] || IE && document.all[layer]) { // html code has been read ...    if (NS) data = document[layer].top;            else  data = document.all[layer].style.pixelTop;  }   else setTimeout("getTop("+layer+")", re_try_time);         return data;}         /*function getHeight(layer) {            var data=0;        if (NS && document[layer] || IE && document.all[layer]) { // html code has been read ...    if (NS) data = document[layer].height;            else  data = document.all[layer].style.height;   alert(document[layer].style.height);   //str="";   //for (i in document[layer]) str+=i+"\n";   //alert(str+" "+data);  }   else setTimeout("getHeight("+layer+")", re_try_time);         return data;}         function getWidth(layer) {            var data=0;        if (NS && document[layer] || IE && document.all[layer]) { // html code has been read ...    if (NS) data = document[layer].width;            else  data = document.all[layer].style.width;  }   else setTimeout("getWidth("+layer+")", re_try_time);         return data;}         */function resizeBy(layer, x, y) {            if (NS && document[layer] || IE && document.all[layer]) // html code has been read ...   if (NS) { // ?       document[layer].document.width = document[layer].document.width+x;        document[layer].document.height  = document[layer].document.height+y;    }       else {      // ok       document.all[layer].style.width = parseInt(document.all[layer].style.width)+x;       document.all[layer].style.height  = parseInt(document.all[layer].style.height)+y;   }     else setTimeout("resizeBy("+layer+","+x+","+y+")", re_try_time);       }       function resizeTo(layer, x, y) {            if (NS && document[layer] || IE && document.all[layer]) // html code has been read ...   if (NS) { // ?       document[layer].document.width = x;        document[layer].document.height  = y;    }       else {      // ok       document.all[layer].style.width = x;       document.all[layer].style.height  = y;   }     else setTimeout("resizeTo("+layer+","+x+","+y+")", re_try_time);       }   function getClipX0(layer) {                                                                var data=0;        if (NS && document[layer] || IE && document.all[layer]) { // html code has been read ...    if (NS) data = document[layer].clip.left;           else  data = document.all[layer].style.clip.match(/\d+/g)[3];  }   else setTimeout("getClipX0("+layer+")", re_try_time);         return parseInt(data);}     function getClipY0(layer) {                                                                var data=0;        if (NS && document[layer] || IE && document.all[layer]) { // html code has been read ...    if (NS) data = document[layer].clip.top;           else  data = document.all[layer].style.clip.match(/\d+/g)[0];  }   else setTimeout("getClipY0("+layer+")", re_try_time);         return parseInt(data);}     function getClipX1(layer) {                                                                var data=0;        if (NS && document[layer] || IE && document.all[layer]) { // html code has been read ...    if (NS) data = document[layer].clip.right;           else  data = document.all[layer].style.clip.match(/\d+/g)[1];  }   else setTimeout("getClipX1("+layer+")", re_try_time);         return parseInt(data);}                 function getClipY1(layer) {                                                                var data=0;        if (NS && document[layer] || IE && document.all[layer]) { // html code has been read ...    if (NS) data = document[layer].clip.bottom;           else  data = document.all[layer].style.clip.match(/\d+/g)[2];  }   else setTimeout("getClipY1("+layer+")", re_try_time);         return parseInt(data); }     function setClip(layer, x0, y0, x1, y1) {                                                                if (NS && document[layer] || IE && document.all[layer]) { // html code has been read ...    if (NS) {     //alert("PRIMA\nleft: "+document[layer].clip.left+"\ntop: "+document[layer].clip.top+"\nright: "+document[layer].clip.right+"\nbottom: "+document[layer].clip.bottom);       document[layer].clip.left   = x0;        document[layer].clip.top    = y0;        document[layer].clip.right  = x1;          document[layer].clip.bottom = y1;       //alert("DOPO\nleft: "+document[layer].clip.left+"\ntop: "+document[layer].clip.top+"\nright: "+document[layer].clip.right+"\nbottom: "+document[layer].clip.bottom);     }         else {    // alert("PRIMA \nleft: "+getClipX0(layer)+"\ntop: "+getClipY0(layer)+"\nright: "+getClipX1(layer)+"\nbottom: "+getClipY1(layer));    document.all[layer].style.clip="Rect("+y0+"px "+x1+"px "+y1+"px "+x0+"px)"    //alert("DOPO \nleft: "+getClipX0(layer)+"\ntop: "+getClipY0(layer)+"\nright: "+getClipX1(layer)+"\nbottom: "+getClipY1(layer));   }   if (MAC && IE) {     moveBy(layer, -1, -1); // to prevent MAC & IE sleeping !!!     moveBy(layer, 1, 1);      }    }   else setTimeout("setClip("+layer+","+x0+","+y0+","+x1+","+y1+")", re_try_time);       }     function scrollH(layer, offset) {  if (NS && document[layer] || IE && document.all[layer]) {// html code has been read ...            moveBy(layer, -offset, 0);          setClip(layer, (getClipX0(layer)+offset), getClipY0(layer), (getClipX1(layer)+offset), getClipY1(layer));          if (main_tout!=null) clearTimeout(main_tout);  }   else main_tout=setTimeout("scrollH("+layer+","+offset+")", re_try_time); }                                                  function scrollV(layer, offset) {  if (NS && document[layer] || IE && document.all[layer]) {// html code has been read ...            moveBy(layer, 0, -offset);          setClip(layer, getClipX0(layer), getClipY0(layer)+offset, getClipX1(layer), getClipY1(layer)+offset);     if (main_tout!=null) clearTimeout(main_tout);  }   else main_tout=setTimeout("scrollV("+layer+","+offset+")", re_try_time); }                                                  function setBody(layer, body) {  if (NS && document[layer] || IE && document.all[layer]) // html code has been read ...           if (NS) {                	document[layer].document.write(body);     	document[layer].document.close();   }   else {     	document.all[layer].innerHTML = body;   }  else setTimeout("setBody("+layer+","+body+")", re_try_time); }                                                  function setZindex(layer, index) {;//}                                                  /* Scroll Object */function Scroll(layer, delay, offset, width, height, loop) {	    this.layer = layer;    this.loop = (loop)?true:false;        this.x0 = getClipX0(layer);     // position and dimension...    this.y0 = getClipY0(layer);    this.x1 = getClipX1(layer);    this.y1 = getClipY1(layer);    this.X0 = getClipX0(this.layer);    this.X1 = getClipX1(this.layer);    this.Y0 = getClipY0(this.layer);    this.Y1 = getClipY1(this.layer);    //alert("x0:"+this.x0+" \ny0: "+this.y0+" \nx1: "+this.x1+" \ny1: "+this.y1+"\nX0: "+this.X0+"\nX1: "+this.X1+"\nY0: "+this.Y0+"\nY1: "+this.Y1)    this.x = getLeft(layer);    this.y = getTop(layer);    this.dimx = width;    this.dimy = height;    //alert("x:"+this.x+" \ny: "+this.y+" \ndimx: "+this.dimx+" \ndimy: "+this.dimy)        this.delay = delay;           // scrolling parameters    this.offset = offset;         this.direction = null;    this.scroll_type = null;    this.timeout_id = null;         this.scrolling = scrolling;   // methods    this.start = start; 	    this.stop = stop; 	    this.reset = reset; 	        this.name = layer + "Var"; // in questo modo posso sapere con che nome e' stato istanziato l'oggetto per poterne richiamare i metodi con setInterval o setTimeout    eval(this.name + " = this"); //      esempio:   this.timer = setInterval(this.name + ".step()", interval);    }	                                         function start(dir, delay) {/* direction: 0 ^      -              1 >      +              2 v      +              3 <      -*/    if(delay) this.delay=delay; // set new delay if specified  this.direction = dir;  this.offset = (dir==1||dir==2)?Math.abs(this.offset):-Math.abs(this.offset); // set offset sign according to direction (RIGHT, DOWN : positive; UP, LEFT : negative)  this.scroll_type = (dir==0||dir==2)?'scrollV':'scrollH'; // set function name according to direction (UP/DOWN, LEFT/RIGHT)  var doscroll = true;    this.x0 = getClipX0(this.layer);  this.x1 = getClipX1(this.layer);  this.y0 = getClipY0(this.layer);  this.y1 = getClipY1(this.layer);    //alert(" x0:"+this.x0+"\ny0:"+this.y0+"\nx1:"+this.x1+"\ny1:"+this.y1+"\nx:"+this.x+"\ny:"+this.y+"\nwidth:"+this.dimx+"\nheight:"+this.dimy);          switch (this.direction) {  	case 0:    	         if (this.y0 + this.offset <= 0) doscroll=false;                 break;  	case 2:    	         if (this.y1 + this.offset >= this.dimy) doscroll=false;  	         break;  	case 1:    	         if (this.x1 + this.offset  >= this.dimx) doscroll=false;  	         break;  	case 3:    	         if (this.x0 + this.offset  <= 0) doscroll=false;  	         break;                             }	    if (doscroll) {                 if (this.scroll_type=='scrollV') scrollV(this.layer,this.offset); // perform the scroll!   else scrollH(this.layer,this.offset);    this.timeout_id=setTimeout(this.name+".scrolling()",this.delay); // scrolling!  }  else {                   switch (this.direction) {  	case 0:  scrollV(this.layer, -this.y0);                 break;                   	case 2:  scrollV(this.layer, (this.dimy-this.y1));                 break;                   	case 1:  scrollH(this.layer, (this.dimx-this.x1));  	         break;                                     	           	case 3:  scrollH(this.layer, -this.x0);  	         break;                             	        }       if (this.loop) {           this.reset();          this.timeout_id=setTimeout(this.name+".scrolling()",this.delay); // scrolling!     }      	  }} function scrolling () {  //alert("direction:"+this.direction+"\ny:"+this.y+"\ny0:"+this.y0+"\noffset:"+this.offset);	  var doscroll = true;	  this.x0 = getClipX0(this.layer);  this.x1 = getClipX1(this.layer);  this.y0 = getClipY0(this.layer);  this.y1 = getClipY1(this.layer);    switch (this.direction) {  	case 0:    	         if (this.y0 + this.offset <= 0) doscroll=false;                 break;  	case 2:    	         if (this.y1 + this.offset >= this.dimy) doscroll=false;  	         break;  	case 1:    	         if (this.x1 + this.offset  >= this.dimx) doscroll=false;  	         break;  	case 3:    	         if (this.x0 + this.offset  <= 0) doscroll=false;  	         break;                             }	    if (doscroll) {                 if (this.scroll_type=='scrollV') scrollV(this.layer,this.offset); // perform the scroll!   else scrollH(this.layer,this.offset);    this.timeout_id=setTimeout(this.name+".scrolling()",this.delay); // scrolling!  }  else {         //alert(" x0:"+this.x0+"\ny0:"+this.y0+"\nx1:"+this.x1+"\ny1:"+this.y1+"\nx:"+this.x+"\ny:"+this.y+"\nwidth:"+this.dimx+"\nheight:"+this.dimy);            switch (this.direction) {  	case 0:  scrollV(this.layer, -this.y0);                 break;                   	case 2:  scrollV(this.layer, (this.dimy-this.y1));                 break;                   	case 1:  scrollH(this.layer, (this.dimx-this.x1));  	         break;                                     	           	case 3:  scrollH(this.layer, -this.x0);  	         break;                               }    if (this.loop) {      	  this.reset();     	  this.timeout_id=setTimeout(this.name+".scrolling()",this.delay); // scrolling!     }  	  }}	function stop() {  if (this.timeout_id!=null) {     if (MAC && NS) setTimeout("clearTimeout("+this.name+".timeout_id)", this.delay);	     else clearTimeout(this.timeout_id);     this.timeout_id=null;  }	}	           function reset() {   this.stop();   moveTo(this.layer,this.x,this.y);   	   setClip(this.layer, this.X0, this.Y0, this.X1, this.Y1); }	