var loop, timer
var initialised,delay
var bw
delay=100

function verifyCompatibleBrowser(){
    this.ver=navigator.appVersion
    this.dom=document.getElementById?1:0
    this.ope=(this.ver.indexOf("Opera")>-1)
	this.ie6=(this.ver.indexOf("MSIE 6")>-1 && this.dom)?1:0;
    this.ie4=(document.all && !this.dom)?1:0;
	this.ie5=((this.ver.indexOf("MSIE 5")>-1 && this.dom) || this.ie4 || this.ie6 || this.ope)?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
}


function CreaScroll(obj,nest){
    nest=(!nest) ? '':'document.'+nest+'.'
    this.el=bw.dom?document.getElementById(obj):bw.ie4?document.all[obj]:bw.ns4?eval(nest+'document.'+obj):0;
	this.css=bw.dom?document.getElementById(obj).style:bw.ie4?document.all[obj].style:bw.ns4?eval(nest+'document.'+obj):0;
    this.scrollHeight=bw.ns4?this.css.document.height:this.el.offsetHeight
    this.clipHeight=bw.ns4?this.css.clip.height:this.el.offsetHeight
	this.up=MoveAreaUp;this.down=MoveAreaDown;
	this.left=MoveAreaLeft; this.right=MoveAreaRight;
    this.MoveArea=MoveArea; this.x; this.y;
    this.obj = obj + "Object"
    eval(this.obj + "=this")
    return this
}

function CreaContenitore(obj){
    this.el=bw.dom?document.getElementById(obj):bw.ie4?document.all[obj]:bw.ns4?eval('document.'+obj):0;
    this.css=bw.dom?document.getElementById(obj).style:bw.ie4?document.all[obj].style:bw.ns4?eval('document.'+obj):0;
    //this.clipHeight=bw.ns4?this.css.clip.height:this.el.offsetHeight
	this.obj = obj + "Object"
    eval(this.obj + "=this")
    return this
}



function MoveArea(x,y){
    this.x=x;this.y=y
    this.css.left=this.x
    this.css.top=this.y
}

function MoveAreaDown(passo,altezza){
	if(this.y>-altezza){
    this.MoveArea(0,this.y-passo)
    if(loop) setTimeout(this.obj+".down(" + passo + "," + altezza + ")",delay)
	}
}
function MoveAreaUp(passo){
	if(this.y<0){

	this.MoveArea(0,this.y-passo)
    if(loop) setTimeout(this.obj+".up(" + passo + ")",delay)
	}
}

function MoveAreaLeft(passo,altezza){
	if(this.x>-altezza){
    this.MoveArea(this.x-passo,0)
    if(loop) setTimeout(this.obj+".left(" + passo + "," + altezza + ")",delay)
	}
}
function MoveAreaRight(passo){
	if(this.x<0){

	this.MoveArea(this.x-passo,0)
    if(loop) setTimeout(this.obj+".right(" + passo + ")",delay)
	}
}



function PerformScroll(passo,oggetto,altezza)
{
 if(initialised)
 {
  loop=true;
  if(passo>0)
  {
   oggetto.down(passo,altezza)
  }
  else
  {
   oggetto.up(passo)
  }
 }
}

function PerformLaterale(passo,oggetto,altezza)
{
 if(initialised)
 {
  loop=true;
  if(passo>0)
  {
   oggetto.left(passo,altezza)
  }
  else
  {
   oggetto.right(passo)
  }
 }
}


function CeaseScroll(){
    loop=false
    if(timer) clearTimeout(timer)
}

function Posiziona(oggetto, left,top) //vuole il nome della div, la distanza dal bordo sinistro e la distanza dal bordo destro
{
	if (bw.ns4){
	//left-=1
	eval('document.'+oggetto+'.left='+left)
	eval('document.'+oggetto+'.top='+top)
    eval("document."+oggetto+".visibility='visible'")
	}

	if (bw.ns5){
	//left-=1
	top-=1
	document.getElementById(oggetto).style.left=left
	document.getElementById(oggetto).style.top=top
	document.getElementById(oggetto).style.visibility='visible'
	}

	if (bw.ie5 || bw.ie4){
	document.all[oggetto].style.left=left
	document.all[oggetto].style.top=top
	document.all[oggetto].style.visibility='visible'
	}



}

function mostra(oggetto,pswitch)
{
 if (pswitch=="si")
  {pswitch='visible'}
 else
  {pswitch='hidden'}

 if(bw.ns4)
 {
  eval("document."+oggetto+".visibility='"+pswitch+"'")
 }
 if(bw.ns5)
 {
  document.getElementById(oggetto).style.visibility=pswitch
 }
 if(bw.ie5 || bw.ie4)
 {
  	document.all[oggetto].style.visibility=pswitch
 }
}

function oset (padre, figlio)
{ 
 if (bw.ie5) {return eval(figlio+".el.offsetHeight-"+ padre +".el.offsetHeight-5")} 
 if (bw.ns4) {return eval(figlio+".css.document.height-"+ padre +".css.clip.height-5")}
 if (bw.ns5) {return eval(figlio+".el.offsetHeight-"+ padre +".el.offsetHeight")}
}


function osetlar (padre, figlio)
{ 
 if (bw.ie5) {return eval(figlio+".el.offsetWidth-"+ padre +".el.offsetWidth-5")} 
 if (bw.ns4) {return eval(figlio+".css.document.width-"+ padre +".css.clip.width-5")}
 if (bw.ns5) {return eval(figlio+".el.offsetWidth-"+ padre +".el.offsetWidth")}
}

