
/******************************************
* Scrollable content script II- © Dynamic Drive (www.dynamicdrive.com)
* Visit http://www.dynamicdrive.com/ for full source code
* This notice must stay intact for use
******************************************/

iens6=document.all||document.getElementById
ns4=document.layers

//specify speed of scroll (greater=faster)
//defines the amount of pixels by which to scroll (or "jump per scroll")
var vspeed = 1;

//another way to adjust scroll speed (greater=slower), default = 20
//defines milliseconds between scrolls
var vtimeout = 30;

//var vobj = null;
//var contentheight = null;

//var btnUp = null;
//var btnDown = null;

function movedown(strDivID){
	var vobj = getvobj(strDivID);
	var contentheight = getcontent_height(strDivID);
	if (iens6&&parseInt(vobj.style.top)>=(contentheight*(-1)+150))
	vobj.style.top=parseInt(vobj.style.top)-vspeed+"px"
	else if (ns4&&vobj.top>=(contentheight*(-1)+150))
	vobj.top-=vspeed
	movedownvar=setTimeout("movedown('" + strDivID + "')",vtimeout)
}

function moveup(strDivID){
	var vobj = getvobj(strDivID);
	if (iens6&&parseInt(vobj.style.top)<=0)
	vobj.style.top=parseInt(vobj.style.top)+vspeed+"px"
	else if (ns4&&vobj.top<=0)
	vobj.top+=vspeed
	moveupvar=setTimeout("moveup('" + strDivID + "')",vtimeout)
}

function vscroll(strDivID){
	var vobj = getvobj(strDivID);
	var contentheight = getcontent_height(strDivID);
	if (iens6&&parseInt(vobj.style.top)>=(contentheight*(-1)+150))
	vobj.style.top=parseInt(vobj.style.top)-coord+"px"
	else if (ns4&&vobj.top>=(contentheight*(-1)+150))
	vobj.top=coord
}

function getvobj(strDivID)
{
	var obj = null;
	if (iens6){
		obj=document.getElementById ? document.getElementById(strDivID) : document.all(strDivID)
	}
	else if (ns4){
		obj=document.nscontainer.document.nscontent
	}
	return obj;
}

function getcontent_height(strDivID){
	var vobj = getvobj(strDivID);
	var vobjheight = null;
	if (iens6){
		vobjheight=vobj.offsetHeight;
	}
	else if (ns4){
		vobjheight=vobj.clip.height;
	}
	
	return vobjheight;
}
