var scrollboxes = new Object();
function scroll_init(id){
	var box = null;
	if (document.all)
		box = document.all[id];
	else if (document.getElementById)
		box = document.getElementById(id);
	if (!box||!box.offsetHeight||!box.scrollHeight)return;
	if (box.offsetHeight>=box.scrollHeight)return;

	var content = box.innerHTML;
	box.innerHTML = "<table cellpadding='0' cellspacing='0' border='0'><tbody><tr><td><div style='overflow: hidden; height: "+(box.offsetHeight-2)+"px;'>"+content+"</div></td><td width='15' valign='bottom'><img src='images/scroll_up.gif' onmousedown='scroll_up_start(\""+id+"\");' onmouseup='scroll_up_stop(\""+id+"\");' style='margin-bottom: 3px;cursor:pointer;' /><br /><img src='images/scroll_down.gif' onmouseup='scroll_down_stop(\""+id+"\");' onmousedown='scroll_down_start(\""+id+"\");' style='margin-bottom: 3px;cursor:pointer;' /></td></tr></tbody></table>";

	eval("scrollboxes."+id+"=box");
	eval("scrollboxes."+id+"_timer=0");
}

function scroll_down(id,speed){
	eval("var box = scrollboxes."+id);
	var container = box.firstChild.firstChild.firstChild.firstChild.firstChild;
	container.scrollTop+=speed;
	if (speed<40)speed++;
	var tm = window.setTimeout("scroll_down('"+id+"',"+speed+");",50);
	eval("scrollboxes."+id+"_timer=tm");
}

function scroll_down_start(id){
	scroll_up_stop(id);
	var tm = window.setTimeout("scroll_down('"+id+"',1);",50);
	eval("scrollboxes."+id+"_timer=tm");
}

function scroll_down_stop(id){
	eval("var tm = scrollboxes."+id+"_timer");
	window.clearTimeout(tm);
}

function scroll_up(id,speed){
	eval("var box = scrollboxes."+id);
	var container = box.firstChild.firstChild.firstChild.firstChild.firstChild;
	var top = container.scrollTop-speed;
	if (top<0)top = 0;
	container.scrollTop = top;
	if (speed<40)speed++;
	var tm = window.setTimeout("scroll_up('"+id+"',"+speed+");",50);
	eval("scrollboxes."+id+"_timer=tm");
}

function scroll_up_start(id){
	scroll_down_stop(id);
	var tm = window.setTimeout("scroll_up('"+id+"',1);",50);
	eval("scrollboxes."+id+"_timer=tm");
}

function scroll_up_stop(id){
	eval("var tm = scrollboxes."+id+"_timer");
	window.clearTimeout(tm);
}

