
function Scrollbar(t, c){
var container, content;
this.container=document.getElementById(t);
this.content=document.getElementById(c);
this.content.style.top=0;
this.height=this.content.offsetHeight;
this.step=1;


this.containerHeight=this.container.offsetHeight;

this.speed=arguments[2] ? arguments[2] : 200;
this.dir='down';
this.stopscroll=true;

this.scrolls=function(){
	dir=arguments[0] ? arguments[0] : this.dir;
	if(dir=='down'){
		//if(parseInt(this.content.style.top)>(this.height*(-1)+1)){ //if scroller hasn't reached the end of its height
		if(parseInt(this.content.style.top)>(this.height*(-1)+ this.containerHeight)){
			this.content.style.top=parseInt(this.content.style.top)-this.step +"px"; //move scroller upwards
		}
	}
	else if(dir=='up'){
		if(parseInt(this.content.style.top)<=0){ //if scroller hasn't reached the end of its height
			this.content.style.top=parseInt(this.content.style.top)+this.step +"px"; //move scroller upwards
		}
	}
	else{
	}
}

this.scrolling=function(dir){
	this.dir=dir;
	this.stopscroll=false;
	scrolling();
}

this.up=function(){
	this.scrolling('up');
}

this.down=function(){
	this.scrolling('down');
}

this.pause=function(){
	this.stopscroll=true;
}

}



function scrollbar1(t, c){
var container, content;
this.container=document.getElementById(t);
this.content=document.getElementById(c);
this.content.style.top=0;
this.height=this.content.offsetHeight;

var os=getoffset(this.content);
this.height=os[3]-os[1];

alert(this.height);
this.containerHeight=this.container.offsetHeight;

this.speed=arguments[2] ? arguments[2] : 200;
this.dir='down';
this.stopscroll=true;

this.scrolls=function(){
	dir=arguments[0] ? arguments[0] : this.dir;
	if(dir=='down'){
		//if(parseInt(this.content.style.top)>(this.height*(-1)+1)){ //if scroller hasn't reached the end of its height
		if(parseInt(this.content.style.top)>(this.height*(-1)+ this.containerHeight)){
			this.content.style.top=parseInt(this.content.style.top)-1 +"px"; //move scroller upwards
		}
	}
	else if(dir=='up'){
		if(parseInt(this.content.style.top)<=0){ //if scroller hasn't reached the end of its height
			this.content.style.top=parseInt(this.content.style.top)+1 +"px"; //move scroller upwards
		}
	}
	else{
	}
}

this.scrolling=function(dir){
	this.dir=dir;
	this.stopscroll=false;
	scrolling();
}

this.up=function(){
	this.scrolling('up');
}

this.down=function(){
	this.scrolling('down');
}

this.pause=function(){
	this.stopscroll=true;
}

}