/********************************************************************************
Copyright (C) 1999 Thomas Brattli
This script is made by and copyrighted to Thomas Brattli at www.bratta.com
Visit for more great scripts. This may be used freely as long as this msg is intact!
I will also appriciate any links you could give me.
********************************************************************************/
//Default browsercheck, added to all scripts!
function checkBrowser(){
	this.dom= (document.getElementById)
	this.op=  (navigator.userAgent.indexOf('Opera')>-1)
	this.ie4= (document.all && !this.dom && !this.op)
	this.ie5= (document.all && this.dom && !this.op)
	this.ns4= (document.layers && !this.dom)
	this.ns5= (!document.all && this.dom && !this.op)
	this.ns6= (this.ns5)
	this.bw=  (this.ie4 || this.ie5 || this.ns4 || this.ns6 || this.op)
	return this
}
bw= new checkBrowser()

/***** variables *****/
timSpeed=50    //The timeout in milliseconds.
contHeight=255 //The height of the container (change this when it scrolls too much or too little)

/*********************************************************************************
This is the object constructor function, which applies 
methods and properties to the Cross-browser layer object
*********************************************************************************/
function makeScrollObj(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.height=bw.ns4?this.css.document.height:this.el.offsetHeight
	this.top=b_gettop										
	return this
}
//Getting the top for the top method
function b_gettop(){
	var gleft=(bw.ns4) ? eval(this.css.top):(bw.ie4)?eval(this.css.pixelTop):parseInt(this.css.top);
	return gleft;
}
//Variables
var scrollTim=null;
var active=0;
/*********************************************************************************
The scroll function. Checks what way to scroll and checks if the
layer is not already on top or bottom.
*********************************************************************************/
function scroll(speed){
	clearTimeout(scrollTim)
	way=speed>0?1:0
	if((!way && oScroll[active].top()>-oScroll[active].height+contHeight) || (oScroll[active].top()<0 && way)){
		oScroll[active].css.top=oScroll[active].top()+speed
		scrollTim=setTimeout("scroll("+speed+")",timSpeed)
	} 
}
//Clears the timeout so the scroll stops, this is called onmouseout.
function noScroll(){
	clearTimeout(scrollTim)
}
/*********************************************************************************
Changes the active layer. Hides the one that's visible and
shows the "new" one. Also set's the new layers top to
0 so it starts at top.
*********************************************************************************/
function changeActive(num){
	oScroll[active].css.visibility='hidden'
	active=num
	oScroll[active].css.top=0
	oScroll[active].css.visibility='visible'
}
/*********************************************************************************
Initilizes the page, makes a oScroll Array and calls the object constructor.
Here you can add as many scrollObjects as you want
*********************************************************************************/
function scrollInit(){
	oScroll=new Array()
	oScroll[0]=new	makeScrollObj('divScroll1','divPagescrollCont')	
	for(var i=0;i<oScroll.length;i++)oScroll[i].css.top=0 
	oScroll[0].css.visibility='visible';
	
	/*if (oScroll.height < contHeight){
	hide(divUp);
	hide(divDown);
	}*/
}

function showHide(div,nest){
	obj=bw.dom?document.getElementById(div).style:bw.ie4?document.all[div].style:bw.ns4?nest?document[nest].document[div]:document[div]:0; 
	if(obj.visibility=='visible' || obj.visibility=='show') obj.visibility='hidden'
	else obj.visibility='visible'
}
//Shows the div
function show(div,nest){
	obj=bw.dom?document.getElementById(div).style:bw.ie4?document.all[div].style:bw.ns4?nest?document[nest].document[div]:document[div]:0; 
	obj.visibility='visible'
}
//Hides the div
function hide(div,nest){
	obj=bw.dom?document.getElementById(div).style:bw.ie4?document.all[div].style:bw.ns4?nest?document[nest].document[div]:document[div]:0; 
	obj.visibility='hidden'
}

//rollover function
if (document.images) {  
	
	upon = new Image();
	upon.src   = "images/up.gif";	
	upoff = new Image(); 
	upoff.src   = "images/up.gif";
	
	downon = new Image();
	downon.src   = "images/down.gif"; 	
	downoff = new Image(); 
	downoff.src   = "images/down.gif";  
	
	homelogoson = new Image();
	homelogoson.src   = "images/home_logos_rollover.jpg";	
	homelogosoff = new Image(); 
	homelogosoff.src   = "images/home_logos.jpg";
}

function rollOn(img){    
    if (document.images) {
        document[img].src=eval(img + "on.src");
    }
}

function rollOff(img){    
    if (document.images) {
		document[img].src=eval(img + "off.src");
	}
}

