﻿// JScript File
var sRepeat=null
function doScroller(dir, src, amount) 
{
	// 3 arguments, dir: scroll "up" or "down", 
	// src is the string id of positioned element
	// amount (optional) is number of pixels to scroll 
	if (window.document.readyState!="loading")
	{
	    var divSrc = document.getElementById(src);
	    if (amount==null) amount=10;
	    
	    //alert("offsetTop = " + divSrc.offsetTop);
	    
	    if (dir=="down") 
	    {
		    divSrc.style.top = divSrc.offsetTop - amount + "px";
		    
		    if (-divSrc.offsetTop>=divSrc.offsetHeight-divSrc.offsetParent.offsetHeight)
		    {
			    divSrc.style.top=-divSrc.offsetHeight+divSrc.offsetParent.offsetHeight + "px";
			}			
	    }
	    else 
	    {
		    divSrc.style.top = divSrc.offsetTop + amount + "px";
		    if (divSrc.offsetTop>0) divSrc.style.top = 0 + "px";
	    }
	    
	    if (sRepeat==null)
		    sRepeat = setInterval("doScroller('" + dir + "','" + src + "'," + amount + ")",100);
	}
	
	return false;
}

window.document.onmouseup = new Function("clearInterval(sRepeat);sRepeat=null");
window.document.ondragstart = new Function("return false");

