var scroller = {
	init:   function() {
		//collect the variables
		scroller.docH = document.getElementById("copycontent").offsetHeight;
		scroller.contH = document.getElementById("copybox").offsetHeight;
		scroller.scrollAreaH = document.getElementById("scrollArea").offsetHeight;
		
		//calculate height of scroller and resize the scroller div
		//(however, we make sure that it isn't to small for long pages)
		//scroller.scrollH = (scroller.contH * scroller.scrollAreaH) / scroller.docH;
		//if(scroller.scrollH < 15) scroller.scrollH = 15;
		//document.getElementById("scroller").style.height = Math.round(scroller.scrollH) + "px";
		
		//in this particular case, we don't want to resize the scoller
		scroller.scrollH = 25;
		
		//what is the effective scroll distance once the scoller's height has been taken into account
		scroller.scrollDist = Math.round(scroller.scrollAreaH-scroller.scrollH);
		
		//make the scroller div draggable
		Drag.init(document.getElementById("scroller"),null,0,0,-1,scroller.scrollDist);
		
		//add ondrag function
		document.getElementById("scroller").onDrag = function (x,y) {
			var scrollY = parseInt(document.getElementById("scroller").style.top);
			var docY = 0 - (scrollY * (scroller.docH - scroller.contH) / scroller.scrollDist);
			document.getElementById("copycontent").style.top = docY + "px";
		}
	}
}

onload = scroller.init;

function relocateScroller(scrollY_Moz, scrollY_IE) {
	if (navigator.appName.indexOf("Internet Explorer") > -1) { scrollY = scrollY_IE }
	else { scrollY = scrollY_Moz; }

	document.getElementById("scroller").style.top = scrollY + "px";
	var docY = 0 - (scrollY * (scroller.docH - scroller.contH) / scroller.scrollDist);
	document.getElementById("copycontent").style.top = (docY) + "px";	
}

