var scrllTmr;
var overScroll = false;
window.onload = function(){
if (document.getElementById('scroll')){
	document.getElementById('scroll').onmouseover = function (){
    overScroll = true;
  };

	document.getElementById('scroll').onmouseout = function (){
    overScroll = false;
  };
  	document.getElementById('stock').style.width = document.getElementById('stock').offsetWidth+'px';

  	cur_w = (parseInt(document.getElementById('stock').style.width))/3;
	w = cur_w;
	lft = 0;
	document.getElementById('scrollme').style.marginLeft = lft + "px";
	scrollStep(cur_w,w,-5);
  };
}

function scrollStep(cur_w,w,lft){
	if(lft < w * -1)
		lft = 0;
  if (!overScroll) {
   document.getElementById('scrollme').style.marginLeft = lft + "px";
  } else {
   lft+=1;
  };
	if(scrllTmr)
		clearTimeout(scrllTmr);
	scrllTmr = setTimeout('scrollStep(cur_w,w,' + (lft - 1) + ')', 5);
}
