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=50

function autoscr(){
	if(AutoScroll){
		PerformScroll(1);
		startAutoScroll()
	}else{
		clearAutoScroll()
	}	
}

function clearAutoScroll(){
	AutoScroll = false
	if(atimer) clearTimeout(atimer) 
}

function startAutoScroll(){
	atimer = setTimeout('autoscr()',speed);
}
 
var loop, timer, atimer, dontmove, t_1, t_2, t_3
 
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.clipHeight=bw.ns4?this.css.clip.height:this.el.offsetHeight 
    this.up=MoveAreaUp;this.down=MoveAreaDown; 
    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 
    this.css.top=this.y 
} 
function magic(pos,move,dir){
		 objScroller1.MoveArea(0,pos-move*2)
		 objScroller2.MoveArea(0,pos-move*2)	
		 objScroller3.MoveArea(0,pos-move*2)	
		 dontmove=true
		 if(loop) {
			 clearTimeout(t_1); clearTimeout(t_2); clearTimeout(t_3);
			 t_1 = setTimeout("objScroller1."+dir+"("+move+")",speed) 
			 t_2 = setTimeout("objScroller2."+dir+"("+move+")",speed) 
			 t_3 = setTimeout("objScroller3."+dir+"("+move+")",speed) 
		 }

}
function getTimerName(obj){
	if(obj=="scrollContentObject")return "1";
	if(obj=="scrollContent_2Object")return "2";
	if(obj=="scrollContent_3Object")return "3";
}
var t_cur,t_name;
function MoveAreaDown(move){ 
	if(this.obj=="scrollContent_3Object" && this.y<-this.scrollHeight*2){
		magic(0,move,"down");
	}else{
		if(this.y>-this.scrollHeight*3+objContainer.clipHeight){ 
			this.MoveArea(0,this.y-move) 
			if(loop) {
				t_name = getTimerName(this.obj);
				eval("t_cur = t_" + t_name);
				if(t_cur)clearTimeout(t_cur)
				eval("t_"+t_name+"=setTimeout('objScroller"+t_name+".down("+move+")',"+speed+");");
			}
		}
	}
} 
function MoveAreaUp(move){ 
	if(this.obj=="scrollContentObject" && this.y>0){
		magic(-this.scrollHeight*2,move,"up");
	}else{
   	 	this.MoveArea(0,this.y-move) 
   	 	if(loop) {
			t_name = getTimerName(this.obj);
			eval("t_cur = t_" + t_name);
			if(t_cur)clearTimeout(t_cur)
			eval("t_"+t_name+"=setTimeout('objScroller"+t_name+".up("+move+")',"+speed+");");
		}
	}
} 

function PerformScroll(speed){ 
	dontmove=false
	if(initialised){ 
		clearAutoScroll();
		//CeaseScroll()
		loop=true; 
		if(speed>0) {
			if(!dontmove)objScroller1.down(speed) 
			if(!dontmove)objScroller2.down(speed) 
			if(!dontmove)objScroller3.down(speed) 
		}else{
			if(!dontmove)objScroller1.up(speed) 
			if(!dontmove)objScroller2.up(speed) 
			if(!dontmove)objScroller3.up(speed) 
		}
	} 
} 
 
function CeaseScroll(){ 
    loop=false 
    if(t_1) clearTimeout(t_1)	
    if(t_2) clearTimeout(t_2)	
    if(t_3) clearTimeout(t_3)	
	AutoScroll=true
	startAutoScroll();
} 
var initialised; 
var AutoScroll;
function InitialiseScrollableArea(obj,as)
  
 {
    // alert(1); 
	AutoScroll=as;
    objContainer=new ConstructObject(obj) 
	objScroller1=new ConstructObject('scrollContent',obj) 
	objScroller1.MoveArea(0,0) 
	if(AutoScroll){
		objScroller2=new ConstructObject('scrollContent_2',obj) 
		objScroller3=new ConstructObject('scrollContent_3',obj) 
		objScroller2.MoveArea(0,0)
		objScroller3.MoveArea(0,0)
	}
    objContainer.css.visibility='visible'
     

    initialised=true; 
	
	if(AutoScroll)startAutoScroll();
} 


