function MM_callJS(jsStr) {
  return eval(jsStr);
}
function verifyCompatibleBrowser(){
    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;
}
bw=new verifyCompatibleBrowser()
var speed=20;
var loop, timer;

function ConstructObject(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.scrollWidth=bw.ns4?this.css.document.width:this.el.offsetWidth;

    this.clipHeight=bw.ns4?this.css.clip.height:this.el.offsetHeight;
    this.clipWidth=bw.ns4?this.css.clip.height:this.el.offsetWidth;


    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 ____MoveArea(x,y){
    this.x=x;
    this.y=y;
    this.css.left=this.x.toString()+"px";
    this.css.top=this.y.toString()+"px";
}

function MoveArea(x,y){

	var x1,x2,s,f,d;

	if (this.x == undefined)
		this.x=0;

	if (x<this.x) {

		f=x;
		s=this.x;

		for (d = s; d >= f ; d=d-3) {
		    this.css.left=d.toString()+"px";
		}

	} else if (x>this.x) {

		f=x;
		s=this.x;

		for (d = s; d <= f ; d++) {
		    this.css.left=d.toString()+"px";
		}

	} else {

    	this.css.left=x.toString()+"px";

    }

	this.x=x;
	this.y=y;
	this.css.top=this.y.toString()+"px";

}

var obj=1;

function MoveAreaDown(move)
{

    eval("objContainer=objContainer"+obj);

    if(this.y>-this.scrollHeight+objContainer.clipHeight)
    {
        this.MoveArea(this.x,this.y-move);
        if(loop) {
            timer=setTimeout(this.obj+".down("+move+")",speed);
        }
    }
}

function MoveAreaUp(move){

    if(this.y<0){
        this.MoveArea(this.x,this.y-move);
        if(loop) {
            timer=setTimeout(this.obj+".up("+move+")",speed);
        }
    }
}



function MoveAreaRight(move)
{

    eval("objContainer=objContainer"+obj);

    if(this.x>-this.scrollWidth+objContainer.clipWidth)
    {
        this.MoveArea(this.x-move,this.y);
        if(loop) {
            timer=setTimeout(this.obj+".right("+move+")",speed);
        }
    }
}

function MoveAreaLeft(move){

    if(this.x<0)
    {
        this.MoveArea(this.x-move,this.y);
        if(loop)
        {
            timer=setTimeout(this.obj+".left("+move+")",speed);
        }
    }
}


function PerformScroll(speed,id,direccion)
{

    if(typeof initialised[id] != "undefined")
    {
        CeaseScroll();
        loop=true;
        eval("objScroller=objScroller"+id);
        obj=id;
        if (typeof direccion == "undefined" || direccion==0)
        {
            if(speed>0) objScroller.down(speed);
            else objScroller.up(speed);
        } else {
            if(speed>0) {objScroller.right(speed);}
            else {objScroller.left(speed);}
        }
    }
}
var parando=false;

function CeaseScroll() {
    loop=false;
    if(timer>0) clearTimeout(timer);
}
var initialised=Array();

function Sublime_InitScrollableArea() {
    var i;
    for (i=1;i<20;i++) {
        ind=i;
        o=getObj("divContainer"+i);
        if (o!=null) {
            aux_objContainer=new ConstructObject('divContainer'+ind);
            aux_objScroller=new ConstructObject('divContent'+ind,'divContainer'+ind);
            aux_objScroller.MoveArea(0,0);
            aux_objContainer.css.visibility='visible';
            eval("objContainer"+ind+"=aux_objContainer");
            eval("objScroller"+ind+"=aux_objScroller");
            initialised[ind]=true;
        }
    }
}