function $() {
	var elements = new Array();
	for (var i = 0; i < arguments.length; i++) {
		var element = arguments[i];
		if (typeof element == 'string'){ element = document.getElementById(element); }
		if (arguments.length == 1){ return element; }
		elements.push(element);
	}
	return elements;
}

/**/
/* This is the scrollbar function */
/**/
//We wrap all the code in an object so that it doesn't interfere with any other code


var newsScroller = {
	init: function(){
		//collect the variables
		newsScroller.docH = $("holder").offsetHeight;
		newsScroller.contH = $("text").offsetHeight;
		newsScroller.scrollAreaH = $("scrollArea").offsetHeight;
		docY = 0; scrollY = 0;
		
		//calculate height of scroller and resize the scroller div
		//(however, we make sure that it isn't to small for long pages)
		newsScroller.scrollH = (newsScroller.contH * newsScroller.scrollAreaH) / newsScroller.docH;
		if(newsScroller.scrollH < 5) newsScroller.scrollH = 15;
		$("scroller").style.height = Math.round(newsScroller.scrollH) + "px";

		//what is the effective scroll distance once the scoller's height has been taken into account
		newsScroller.scrollDist = Math.round(newsScroller.scrollAreaH-newsScroller.scrollH);

		//make the scroller div draggable
		Drag.init($("scroller"),null,0,0,0,newsScroller.scrollDist);

		//add ondrag function
		$("scroller").onDrag = function (x,y) {
			scrollY = parseInt($("scroller").style.top);
			docY = 0 - (scrollY * (newsScroller.docH - newsScroller.contH) / newsScroller.scrollDist);
			$("holder").style.top = docY + "px";
		}
	}
}

onload = newsScroller.init;