// Browser check (needed)
function checkBrowser()
{
this.agent=navigator.userAgent;
this.ver=navigator.appVersion;
this.dom=document.getElementById?1:0;
this.win=this.agent.indexOf('Windows')>-1;
this.mac=this.agent.indexOf("Mac")>-1;
this.ie4=(document.all && !this.dom)?1:0;
this.ie5=(this.ver.indexOf('MSIE 5')>-1 && this.dom)?1:0;
this.ie6=(this.ver.indexOf('MSIE 6')>-1 && this.dom)?1:0;
this.ie7=(this.ver.indexOf('MSIE 7')>-1 && this.dom)?1:0;
this.ie8=(this.ver.indexOf('MSIE 8')>-1 && this.dom)?1:0;
this.ie4mac=(this.ie4 && this.mac);
this.ie5mac=(this.ie5 && this.mac);
this.ns4=(document.layers && !this.dom)?1:0;
this.ns6=(this.dom && parseInt(this.ver) >= 5)?1:0;
this.ie=(this.ie4 || this.ie5 || this.ie6 || this.ie7 || this.ie8 || this.ie4mac || this.ie5mac);
this.ns=(this.ns4 || this.ns6);
this.w3c=(this.ie5 || this.ie6 || this.ie7 || this.ie8 || this.ns6 || this.ie5mac);
this.bw=(this.ie4 || this.ie5 || this.ie6 || this.ie7 || this.ie8 || this.ns4 || this.ns6);
return this;
}
var bw=new checkBrowser();

var scrolltimer = 0; // variable for setTimeout
var scrollspeed = 150; // if you want the scroll speed to move faster you can set this lower
var scrollables = 1; // number of scrollable content

// Makes crossbrowser object
function makeObject(obj,nest)
{
if (bw.ns4) nestedobject=(!nest)?document.layers[obj]:document.layers[nest].document.layers[obj];
this.css=bw.w3c?document.getElementById(obj).style:bw.ie4?document.all[obj].style:bw.ns4?nestedobject:0;
this.oref=bw.w3c?document.getElementById(obj):bw.ie4?document.all[obj]:bw.ns4?nestedobject:0;
this.moveIt=b_moveIt; this.x; this.y;
this.objWidth=b_objWidth;
this.objHeight=b_objHeight;
return this;
}

// Moves the object
function b_moveIt(x,y)
{
this.x=x; this.y=y;
this.css.left=this.x;
this.css.top=this.y;
}

// Get object width
function b_objWidth()
{
if (bw.ns4) if (this.oref.width) return this.oref.width; else return this.oref.clip.width;
if (bw.ie) if (this.css.pixelWidth) return this.css.pixelWidth; else return this.oref.offsetWidth;
if (bw.ns6) if (this.css.width) return parseInt(this.css.width); else return this.oref.offsetWidth;
}

// Get object height
function b_objHeight()
{
if (bw.ns4) if (this.oref.height) return this.oref.height; else return this.oref.clip.height;
if (bw.ie) if (this.css.pixelHeight) return this.css.pixelHeight; else return this.oref.offsetHeight;
if (bw.ns6) if (this.css.height) return parseInt(this.css.height); else return this.oref.offsetHeight;
}

// horizontal scroll
function hscroll(num,speed)
{
if (isLoaded)
{
if (speed>0 && oContent[num].x>-oContent[num].objWidth()+oContainer[num].objWidth()) oContent[num].moveIt(oContent[num].x-speed,oContent[num].y);
else if (speed<0 && oContent[num].x<0) oContent[num].moveIt(oContent[num].x-speed,oContent[num].y);
scrolltimer=setTimeout('hscroll('+num+','+speed+')',scrollspeed);
}
}

function vscroll(num,speed)
{
if (isLoaded)
{
if (speed>0 && oContent[num].y>-oContent[num].objHeight()+oContainer[num].objHeight()) oContent[num].moveIt(oContent[num].x,oContent[num].y-speed);
else if (speed<0 && oContent[num].y<0) oContent[num].moveIt(oContent[num].x,oContent[num].y-speed);
scrolltimer=setTimeout('vscroll('+num+','+speed+')',scrollspeed);
}
}


// disable scroll
function noscroll() { clearTimeout(scrolltimer); }

// Resize fix for Netscape 4+
function resizeFix() { setTimeout('history.go(0)',200); }

// Initiates page
var isLoaded=false;
function scrollInit()
{
oContainer=new Array();
oContent=new Array();
oControl=new Array();
for (var i=1;i<=scrollables;i++)
{
oContainer[i]=new makeObject('divContainer'+i);
oContent[i]=new makeObject('divContent'+i,'divContainer'+i);
oControl[i]=new makeObject('divControl'+i);
if (bw.ns6) oContent[i].css.position='relative'; // scrollbar hack for NS6
oContent[i].moveIt(0,0);
oContainer[i].css.visibility='visible';
}
if (bw.ns4) window.onresize = resizeFix;
isLoaded=true;
}
