// begin absolutely positioned scrollable area object scripts 
// Extension developed by Robert Brown 
// Extension developed by David G. Miles 
// Original Scrollable Area code developed by Thomas Brattli 
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=60
var move=0


var loop, timer, mouseout
var btnDown,btnUp
 
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 + 'px'
    this.css.top=this.y + 'px' 
} 
 
function MoveAreaDown(){ 
	if(this.y>-this.scrollHeight+objContainer.clipHeight){ 
		btnUp.style.display = 'block'
    this.MoveArea(0,this.y-move) 
		if(loop) {
			if(move>0) setTimeout(this.obj+".down("+move+")",speed)
			else setTimeout(this.obj+".up("+move+")",speed)
		}
	} 
	else {
		CeaseScroll()
		btnDown.style.display = 'none'
	}
} 
function MoveAreaUp(){ 
	if(this.y<0){ 
		btnDown.style.display = 'block'
		if(this.y-move<0) toMove = this.y-move
		else toMove = 0
    this.MoveArea(0,toMove) 
		if(loop) {
			if(move>0) setTimeout(this.obj+".down("+move+")",speed)
			else setTimeout(this.obj+".up("+move+")",speed)
		}
	} 
	else {
		CeaseScroll()
		btnUp.style.display = 'none'
	}
} 
 
function PerformScroll(){ 
	if(initialised){ 
		loop=true; 
		if(move>0) objScroller.down() 
		else objScroller.up() 
	} 
} 
 
function CeaseScroll(){ 
    loop=false 
    if(timer) clearTimeout(timer) 
} 
var initialised; 
function InitialiseScrollableArea(){ 
		stopSafari()
    objContainer=new ConstructObject('scrollerContainerSubnav') 
    objScroller=new ConstructObject('scrollerContentSubnav','scrollerContainerSubnav') 
    objScroller.MoveArea(0,0) 
    objContainer.css.visibility='visible' 
    initialised=true; 
		btnUp = document.getElementById('scrollerUpSubnav')
		btnDown = document.getElementById('scrollerDownSubnav')
		if(objScroller.y<-objScroller.scrollHeight+objContainer.clipHeight){
			btnDown.style.display = 'none'
//			document.getElementById('scrollerController').style.display = 'none'
		}
} 
 
function GetMove(theEvent){ 
		y = theEvent.offsetY?theEvent.offsetY:theEvent.layerY
		if(!y) y = 0
		return -Math.round(10*(177 - y)/177,0);
} 
 
function ChangeMove(x){ 
		move = x
} 
 
function OnMouseMove(theEvent){ 
		ChangeMove(GetMove(theEvent))
		if(!loop) PerformScroll()
} 
 
function GetMoveScroller(theEvent){ 
		y = theEvent.offsetY?theEvent.offsetY:theEvent.layerY
		y = y + objScroller.y
		if(!y) y = 0
		return -Math.round(10*(177 - y)/177,0)
} 	
 
function OnMouseMoveScroller(theEvent){ 
		ChangeMove(GetMoveScroller(theEvent))
		if(mouseout) clearTimeout(mouseout)
		if(!loop) PerformScroll()
} 	
 
function OnMouseOut(){ 
		mouseout = setTimeout("CeaseScroll()",100)
} 	
// end absolutely positioned scrollable area object scripts 
						
function doNothing(){
	//do nothing
}
function stopSafari(){
	//remove page scrolling for safari as it doesn't work
	if(navigator.userAgent.toLowerCase().indexOf("safari") != -1){
		theScroller = document.getElementById('scrollerContentSubnav');
		theScroller.onmouseover = doNothing;
		theScroller.onmousemove = doNothing;
		theScroller.onmouseout = doNothing;
	}
}