var n, ie, ns6, timSpeed, contHeight;
timSpeed=150;
contHeight=50;
var ScrollCounter = 0;
var scrollDirection = -1;  // 1 = down ; -1 = up
var defaultScrollSpeed = 1;
var fastScrollSpeed = 3;
var scrollingSpeed = 1;
var scrollBounce = 1;
var scrollTim;
var active=0;

// Detect browser
if (document.layers) { n = 1; ie = 0; ns6 = 0; } 
else if (document.all) { n = 0; ie = 1; ns6 = 0; } 
else if (document.getElementById) { ns6 = 1; n = 0; ie = 0; }

function makeScrollObj(obj,nest){
	nest=(!nest) ? '':'document.'+nest+'.'
	
	if ( n )   { this.css = eval(nest+'document.'+obj); } 
	
	if ( ie )  { this.css = eval('document.all.'+obj+'.style'); }
	
	if ( ns6 ) { this.css = document.getElementById(obj).style; }
	
	var scrollHeight = 0;
	
	if (n )  scrollHeight = this.css.document.height;
	if (ie)  scrollHeight = eval('document.all.'+obj+'.offsetHeight');
	if (ns6) scrollHeight = this.css.height;
	
	if( ! scrollHeight) scrollHeight = 300;
		
	this.scrollHeight = scrollHeight;
	this.top = b_gettop;
	this.setTop = setTop;
	return this;
}

function setTop( top ){
	if (n )  this.css.top = top;
	if (ie)  this.css.pixelTop = top;
	if (ns6) this.css.top = top + "px";
}

function b_gettop(){
	
	var gleft = 0;

	if (n )  gleft = eval(this.css.top);
	if (ie)  gleft = eval(this.css.pixelTop);
	if (ns6) { gleft = eval("this.css.top");  if (gleft.indexOf("px") > 0){gleft = gleft.split("px"); gleft = parseInt(gleft[0]);} }

	return gleft;
}

function scroll() {
	
	ScrollCounter++;
	
	if (scrollBounce) scrollDirection = -1; 
	
	var speed = scrollingSpeed * scrollDirection;

	var way = ( speed  > 0 ) ? 1 : 0;
	
	if ( scrollBounce ) {
		 
		if(  oScroll[active].top() < (-oScroll[active].scrollHeight) ) {
			oScroll[active].setTop(contHeight + 5);
		} else {
			oScroll[active].setTop(oScroll[active].top() + speed);
		}
	}		
	else {
	 	if( (!way && oScroll[active].top()>-oScroll[active].scrollHeight+contHeight) || (oScroll[active].top()<0 && way) ) {
			oScroll[active].setTop(oScroll[active].top() + speed);
		}
	}

	scrollTim = setTimeout("scroll()", timSpeed);

}

function noScroll() {
	clearTimeout(scrollTim);
}

function changeActive(num){
	oScroll[active].css.visibility='hidden';
	active=num;
	oScroll[active].setTop(0);
	oScroll[active].css.visibility='visible';
}

function scrollInit() {

	oScroll = new Array()
	oScroll[0] = new makeScrollObj('divScroll1','divCont');
	oScroll[0].css.visibility='visible';
	oScroll[active].setTop(contHeight + 5);
	scroll();
}

function fastScrollUp() {
	scrollBounce = 0; scrollDirection=1; scrollingSpeed = fastScrollSpeed;
}

function fastScrollDown() {
	scrollBounce = 0; scrollDirection = -1; scrollingSpeed = fastScrollSpeed;
}

function scrollReset() {
	scrollBounce = 1;
	scrollingSpeed = defaultScrollSpeed;
}

onload = scrollInit;



var n, ie, ns6, timSpeed, contHeight;
timSpeed=150;
contHeight=50;
var ScrollCounter = 0;
var scrollDirection = -1;  // 1 = down ; -1 = up
var defaultScrollSpeed = 1;
var fastScrollSpeed = 3;
var scrollingSpeed = 1;
var scrollBounce = 1;
var scrollTim;
var active=0;

// Detect browser
if (document.layers) { n = 1; ie = 0; ns6 = 0; } 
else if (document.all) { n = 0; ie = 1; ns6 = 0; } 
else if (document.getElementById) { ns6 = 1; n = 0; ie = 0; }

function makeScrollObj(obj,nest){
	nest=(!nest) ? '':'document.'+nest+'.'
	
	if ( n )   { this.css = eval(nest+'document.'+obj); } 
	
	if ( ie )  { this.css = eval('document.all.'+obj+'.style'); }
	
	if ( ns6 ) { this.css = document.getElementById(obj).style; }
	
	var scrollHeight = 0;
	
	if (n )  scrollHeight = this.css.document.height;
	if (ie)  scrollHeight = eval('document.all.'+obj+'.offsetHeight');
	if (ns6) scrollHeight = this.css.height;
	
	if( ! scrollHeight) scrollHeight = 300;
		
	this.scrollHeight = scrollHeight;
	this.top = b_gettop;
	this.setTop = setTop;
	return this;
}

function setTop( top ){
	if (n )  this.css.top = top;
	if (ie)  this.css.pixelTop = top;
	if (ns6) this.css.top = top + "px";
}

function b_gettop(){
	
	var gleft = 0;

	if (n )  gleft = eval(this.css.top);
	if (ie)  gleft = eval(this.css.pixelTop);
	if (ns6) { gleft = eval("this.css.top");  if (gleft.indexOf("px") > 0){gleft = gleft.split("px"); gleft = parseInt(gleft[0]);} }

	return gleft;
}

function scroll() {
	
	ScrollCounter++;
	
	if (scrollBounce) scrollDirection = -1; 
	
	var speed = scrollingSpeed * scrollDirection;

	var way = ( speed  > 0 ) ? 1 : 0;
	
	if ( scrollBounce ) {
		 
		if(  oScroll[active].top() < (-oScroll[active].scrollHeight) ) {
			oScroll[active].setTop(contHeight + 5);
		} else {
			oScroll[active].setTop(oScroll[active].top() + speed);
		}
	}		
	else {
	 	if( (!way && oScroll[active].top()>-oScroll[active].scrollHeight+contHeight) || (oScroll[active].top()<0 && way) ) {
			oScroll[active].setTop(oScroll[active].top() + speed);
		}
	}

	scrollTim = setTimeout("scroll()", timSpeed);

}

function noScroll() {
	clearTimeout(scrollTim);
}

function changeActive(num){
	oScroll[active].css.visibility='hidden';
	active=num;
	oScroll[active].setTop(0);
	oScroll[active].css.visibility='visible';
}

function scrollInit() {

	oScroll = new Array()
	oScroll[0] = new makeScrollObj('divScroll1','divCont');
	oScroll[0].css.visibility='visible';
	oScroll[active].setTop(contHeight + 5);
	scroll();
}

function fastScrollUp() {
	scrollBounce = 0; scrollDirection=1; scrollingSpeed = fastScrollSpeed;
}

function fastScrollDown() {
	scrollBounce = 0; scrollDirection = -1; scrollingSpeed = fastScrollSpeed;
}

function scrollReset() {
	scrollBounce = 1;
	scrollingSpeed = defaultScrollSpeed;
}

onload = scrollInit;
