var upH2 = 9; // Height of up-arrow
var upW2 = 5; // Width of up-arrow
var downH2 = 9; // Height of down-arrow
var downW2 = 5; // Width of down-arrow
var dragH2 = 26; // Height of scrollbar
var dragW2 = 17; // Width of scrollbar
var scrollH2 = 135; // Height of scrollbar
var speed2 = 4; // Scroll speed

// And now... go to the bottom of the page...
var clickUp2 = false; // If click on up-arrow
var clickDown2 = false; // If click on down-arrow
var clickDrag2 = false; // If click on scrollbar
var clickAbove2 = false; // If click above scrollbar
var clickBelow2 = false; // If click below scrollbar

var timer2 = setTimeout("",500); // Repeat variable
var upL2; // Up-arrow X
var upT2; // Up-arrow Y
var downL2; // Down-arrow X
var downT2; // Down-arrow Y
var dragL2; // Scrollbar X
var dragT2; // Scrollbar Y
var rulerL2; // Ruler X
var rulerT2; // Ruler Y
var contentT2; // Content layer Y;
var contentH2; // Content height
var contentClipH2; // Content clip height
var scrollLength2; // Number of pixels scrollbar should move
var startY2; // Keeps track of offset between mouse and span

// Reads content layer top
function getT2(){
	if(ie4)
		contentT2 = document.all.content3.style.pixelTop;
	else if(nn4)
		contentT2 = document.contentClip.document.divcontent3.document.content3.top;
	else if(dom)
		contentT2 = parseInt(document.getElementById("content3").style.top);
}

// Reads mouse X and Y coordinates

// Moves the layer
function moveTo2(){
	if(ie4){
		document.all.content3.style.top = contentT2;
		document.all.ruler2.style.top = dragT2;
		document.all.drag2.style.top = dragT2;
	}
	else if(nn4){
		document.contentClip.document.divcontent3.document.content3.top = contentT2;
		document.ruler2.top = dragT2;
		document.drag2.top = dragT2;
	}
	else if(dom){
		document.getElementById("content3").style.top = contentT2 + "px";
		document.getElementById("drag2").style.top = dragT2 + "px";
		document.getElementById("ruler2").style.top = dragT2 + "px";
	}
}

// Scrolls up
function scrollUp2(){
	getT2();
	if(clickAbove2){
		if(dragT2 <= (mouseY-(dragH2/2)))
			return up();
	}
	
	if(clickUp2){
		if(contentT2 < 0){
			dragT2 = dragT2 - (speed2*scrollLength2);
			
			if(dragT2 < (rulerT2))
				dragT2 = rulerT2;
				
			contentT2 = contentT2 + speed2;
			if(contentT2 > 0)
				contentT2 = 0;
			
			moveTo2();
			timer2 = setTimeout("scrollUp2()",25);
		}
	}
	return false;
}

// Scrolls down
function scrollDown2(){
	getContent2();
	getT2();
	
	if(clickBelow2){
		if(dragT2 >= (mouseY-(dragH2/2)))
			return up();
	}

	if(clickDown2){
		if(contentT2 > -(contentH2 - contentClipH2)){			
			dragT2 = dragT2 + (speed2*scrollLength2);
			if(dragT2 > (rulerT2 + scrollH2 - dragH2))
				dragT2 = (rulerT2 + scrollH2 - dragH2);
			
			contentT2 = contentT2 - speed2;
			if(contentT2 < -(contentH2 - contentClipH2))
				contentT2 = -(contentH2 - contentClipH2);
			
			moveTo2();
			timer2 = setTimeout("scrollDown2()",25);
		}
	}
	return false;
}

// reloads page to position the layers again

function getContent2(){
	if (ie4){
		// Height of content layer and clip layer
		contentH2 = parseInt(document.all.content3.scrollHeight);
		contentClipH2 = parseInt(document.all.divcontent3.style.height);
	}
	else if (nn4){
		// Height of content layer and clip layer
		contentH2 = document.contentClip.document.divcontent3.document.content3.clip.bottom;
		contentClipH2 = document.contentClip.document.divcontent3.clip.bottom;	
	}
	else if(dom){
		contentH2 = parseInt(document.getElementById("content3").offsetHeight);
		contentClipH2 = parseInt(document.getElementById("divcontent3").offsetHeight);
	}
	// Number of pixels scrollbar should move
	scrollLength2 = ((scrollH2-dragH2)/(contentH2-contentClipH2));
}

// Preload
function eventLoader2(){
	if(ie4){
		// Up-arrow X and Y variables
		upL2 = document.all.up2.style.pixelLeft;
		upT2 = document.all.up2.style.pixelTop;		
		// Down-arrow X and Y variables
		downL2 = document.all.down2.style.pixelLeft;
		downT2 = document.all.down2.style.pixelTop;
		// Scrollbar X and Y variables
		dragL2 = document.all.drag2.style.pixelLeft;
		dragT2 = document.all.drag2.style.pixelTop;		
		// Ruler Y variable
		rulerT2 = document.all.ruler2.style.pixelTop;
	}
	else if(nn4){
		// Up-arrow X and Y variables
		upL2 = document.up2.left;
		upT2 = document.up2.top;		
		// Down-arrow X and Y variables
		downL2 = document.down2.left;
		downT2 = document.down2.top;		
		// Scrollbar X and Y variables
		dragL2 = document.drag2.left;
		dragT2 = document.drag2.top;		
		// Ruler Y variable
		rulerT2 = document.ruler2.top;
	}
	else if(dom){
		// Up-arrow X and Y variables
		upL2 = parseInt(document.getElementById("up2").style.left);
		upT2 = parseInt(document.getElementById("up2").style.top);
		// Down-arrow X and Y variables
		downL2 = parseInt(document.getElementById("down2").style.left);
		downT2 = parseInt(document.getElementById("down2").style.top);
		// Scrollbar X and Y variables
		dragL2 = parseInt(document.getElementById("drag2").style.left);
		dragT2 = parseInt(document.getElementById("drag2").style.top);
		// Ruler Y variable
		rulerT2 = parseInt(document.getElementById("ruler2").style.top);
		document.getElementById("content3").style.top = 0 + "px";	
	}
	getContent2();

}
