var upIter;
var downIter;

function newwin(url) {
	window.open(url,"","width=800,height=600,location,scrollbars,resizable")
	return;
}

function hasScrollbars(obj) {
	return (obj[0].scrollHeight > obj[0].clientHeight);
}

function setupScrollers(area, step, top, bottom) {
	setupScrollers(area, step, top, bottom, 70);
}

function setupScrollers(area, step, top, bottom, scroll_speed) {
	top.mousedown(function() {
		upIter = setInterval(function() { scrollUp(area, step) }, scroll_speed);
	}).mouseup(function(){
		clearInterval(upIter);
	});
	bottom.mousedown(function() {
		downIter = setInterval(function() { scrollDown(area, step) }, scroll_speed);
	}).mouseup(function(){
		clearInterval(downIter);
	});
}

function scrollUp(area, step) {
	if(area[0].scrollTop > 0)
		area[0].scrollTop -= step;
	if(area[0].scrollTop < 0)
		area[0].scrollTop = 0;
}

function scrollDown(area, step) {
	if(area[0].scrollTop < area[0].scrollHeight)
		area[0].scrollTop += step;
	if(area[0].scrollTop > area[0].scrollHeight)
		area[0].scrollTop = area[0].scrollHeight;
}

$(document).ready(function() {
/*	var contentArea = $("#content");
	if(hasScrollbars(contentArea)) {
		$("#scrollers").show();
		setupScrollers(contentArea, 10, $("#scroll_up"), $("#scroll_down"), 70);
	}*/
});

