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 CreateScroll(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 CreateContainer(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(step,heigth){
        if(this.y>-heigth){
    this.MoveArea(0,this.y-step)
    if(loop) setTimeout(this.obj+".down(" + step + "," + heigth + ")",delay)
        }
}
function MoveAreaUp(step){
        if(this.y<0){

        this.MoveArea(0,this.y-step)
    if(loop) setTimeout(this.obj+".up(" + step + ")",delay)
        }
}

function MoveAreaLeft(step,heigth){
        if(this.x>-heigth){
    this.MoveArea(this.x-step,0)
    if(loop) setTimeout(this.obj+".left(" + step + "," + heigth + ")",delay)
        }
}
function MoveAreaRight(step){
        if(this.x<0){

        this.MoveArea(this.x-step,0)
    if(loop) setTimeout(this.obj+".right(" + step + ")",delay)
        }
}



function PerformScroll(step,obj,heigth)
{
 if(initialised)
 {
  loop=true;
  if(step>0)
  {
   obj.down(step,heigth)
  }
  else
  {
   obj.up(step)
  }
 }
}

function PerformLaterale(step,obj,heigth)
{
delay=50;
 if(initialised)
 {
  loop=true;
  if(step>0)
  {
   obj.left(step,heigth)
  }
  else
  {
   obj.right(step)
  }
 }
}


function CeaseScroll(){
    loop=false
    if(timer) clearTimeout(timer)
}

function PotisionScroll(obj, left,top, bars) 
{
        if (bw.ns4){
        //left-=1
        eval('document.'+obj+'.left='+left)
        eval('document.'+obj+'.top='+top)
		eval("document."+obj+".visibility='visible'")
        }

        if (bw.ns5){
        //left-=1
			top-=1
			document.getElementById(obj).style.left=left
			document.getElementById(obj).style.top=top
			document.getElementById(obj).style.visibility='visible'
			document.getElementById(bars).style.top=top
			document.getElementById(bars).style.left= left + document.getElementById(obj).offsetWidth
			document.getElementById(bars).style.height = document.getElementById(obj).offsetHeight + "px"
			document.getElementById(bars).style.visibility='visible'
        }

        if (bw.ie5 || bw.ie4){
			document.all[obj].style.left=left
			document.all[obj].style.top=top
			document.all[obj].style.visibility='visible'
	        document.all[bars].style.top=top
			document.all[bars].style.left = left + document.all[obj].offsetWidth
			document.all[bars].style.height = document.all[obj].offsetHeight + "px"
			document.all[bars].style.visibility='visible'

        }


}

function SetScrollerWidth(obj, w)
{
	 	if (bw.ns4){
        //left-=1
        eval('document.'+obj+'.width='+w)
       
        }

        if (bw.ns5){
			document.getElementById(obj).style.width=w
        }

        if (bw.ie5 || bw.ie4){
			document.all[obj].style.width=w

        }	
}

function SetScrollerIndex(obj, w)
{
	 	if (bw.ns4){
        //left-=1
        eval('document.'+obj+'.zindex='+w)
       
        }

        if (bw.ns5){
			document.getElementById(obj).style.zindex=w
        }

        if (bw.ie5 || bw.ie4){
			document.all[obj].style.zindex=w

        }	
}


function showlayer(obj,pswitch)
{
 if (pswitch=="yes")
  {pswitch='visible'}
 else
  {pswitch='hidden'}

 if(bw.ns4)
 {
  eval("document."+obj+".visibility='"+pswitch+"'")
 }
 if(bw.ns5)
 {
  document.getElementById(obj).style.visibility=pswitch
 }
 if(bw.ie5 || bw.ie4)
 {
        document.all[obj].style.visibility=pswitch
 }
}

function mostra(obj,pswitch)
{
 if (pswitch=="si")
  {pswitch='visible'}
 else
  {pswitch='hidden'}

 if(bw.ns4)
 {
  eval("document."+obj+".visibility='"+pswitch+"'")
 }
 if(bw.ns5)
 {
  document.getElementById(obj).style.visibility=pswitch
 }
 if(bw.ie5 || bw.ie4)
 {
        document.all[obj].style.visibility=pswitch
 }
}

function oset (par, child)
{ 
 if (bw.ie5) {return eval(child+".el.offsetHeight-"+ par +".el.offsetHeight-5")} 
 if (bw.ns4) {return eval(child+".css.document.height-"+ par +".css.clip.height-5")}
 if (bw.ns5) {return eval(child+".el.offsetHeight-"+ par +".el.offsetHeight")}
}


function osetlar (par, child)
{ 
 if (bw.ie5) {return eval(child+".el.offsetWidth-"+ par +".el.offsetWidth-5")} 
 if (bw.ns4) {return eval(child+".css.document.width-"+ par +".css.clip.width-5")}
 if (bw.ns5) {return eval(child+".el.offsetWidth-"+ par +".el.offsetWidth")}
}
