﻿function durativeScrollUp(idvalue)
{
	eval("window.intervalScrollUp_"+idvalue+"=this;");

	var oDiv = document.getElementById(idvalue);
	this.realHeight = oDiv.scrollHeight;

	oDiv.innerHTML = oDiv.innerHTML + oDiv.innerHTML;
	with(oDiv)
	{
		style.overflow = "hidden";
		//style.height = this.realHeight;
		style.overflowX = "visible";
		style.overflowY = "hidden";
	}
	this.oRoll = oDiv;
	this.frequency = 20;
	this.tempPixel = 0;
	
	var ifPlay = true;

	this.scroll = function ()
	{
		if ( ifPlay )
		{
			this.tempPixel = this.oRoll.scrollTop;
			this.oRoll.scrollTop += 1;
			if(this.tempPixel == this.oRoll.scrollTop) {
				//this.oRoll.scrollTop = this.oRoll.scrollHeight / 2 - this.oRoll.offsetHeight;
				this.oRoll.scrollTop = this.oRoll.scrollHeight - this.oRoll.offsetHeight - this.realHeight;
				this.oRoll.scrollTop += 1;
			}
		}
		window.setTimeout("intervalScrollUp_"+ idvalue +".scroll()", eval("intervalScrollUp_"+idvalue).frequency); 
	}

	this.oRoll.onmouseover = function() {ifPlay = false;}
	this.oRoll.onmouseout = function() {ifPlay = true;}
}

//window.onload = function()
//{
//	document.getElementById('productscroll').getElementsByTagName('ol')[0].id = 'scrollObjId';
//	var scrollObj2 = new durativeScrollUp("scrollObjId");
//	scrollObj2.frequency = 30;
//	scrollObj2.scroll();
//}

