var scrTimer = 20; // interval between calls to scroll onmouseover
var scrTmId=0;	// for setTimeouts


// amount of scroll per loop during onmouseover
var movr_inc = 4;		// higher number for faster scroll

function stopScroll() {
	clearTimeout(scrTmId);
	scrTmId = 0;
}


function loadScrLyr(num,lyr,id) {
	if (!pgLoaded) return; // avoid not loaded errors
	if (typeof wndo[num].cnt != "undefined") wndo[num].cnt.hide();
	wndo[num].cnt = new dw_scrollObj(lyr,id);
	wndo[num].cnt.show();
	wndo[num].cnt.shiftTo(0,0);	// restore top/left to 0 
	wndo[num].maxX = wndo[num].cnt.width - wndo[num].width;
	wndo[num].maxY = wndo[num].cnt.height - wndo[num].height
} 


// These functions are for onmouseover scrolling
function inchDown(num,inc) {
	if (!pgLoaded||!wndo[num]) return;
	if (scrTmId) clearTimeout(scrTmId);
	var y = parseInt(wndo[num].cnt.css.top);
	if (y>-wndo[num].maxY) { 
		wndo[num].cnt.shiftBy(0,-inc);
		scrTmId = setTimeout("inchDown("+num+","+inc+")",scrTimer);	
	}
}

function inchUp(num,inc) {
	if (!pgLoaded||!wndo[num]) return;
	if (scrTmId) clearTimeout(scrTmId);
	var y = parseInt(wndo[num].cnt.css.top);
	if (y<0) { 
		wndo[num].cnt.shiftBy(0,inc);
		scrTmId = setTimeout("inchUp("+num+","+inc+")",scrTimer);	
  }
}


