function addLoadEvent(func) {
  var oldonload = window.onload;
  if (typeof window.onload != 'function') {
    window.onload = func;
  } else {
    window.onload = function() {
      oldonload();
      func();
    }
  }
}
var scroll = {
	config : {
		scrollDiv : 'scrolllist',
		scrollElement : 'li',
		distance: 1,
		theMargin: 0
	},
	grabWidths : function(){
		var scrollSection = document.getElementById(scroll.config.scrollDiv);
		if (!scrollSection) return false;
		var theElements = scrollSection.getElementsByTagName(scroll.config.scrollElement);
		for (i=0; i<theElements.length; i++){
			var theWidth = theElements[i].offsetWidth;
			theElements[i].myWidth = theWidth;
		}
	},
	moveToBack : function(elem){
		elem.style.marginLeft = "8px";
		var parent = elem.parentNode;
		var holdIt = parent.removeChild(elem);
		parent.appendChild(holdIt);
	},
	slide : function(){
		var scrollSection = document.getElementById(scroll.config.scrollDiv);
		if (!scrollSection) return false;
		var theElements = scrollSection.getElementsByTagName(scroll.config.scrollElement);
		if (theElements[0].movement){
			clearTimeout(theElements[0].movement);
		}
		var theWidth = parseInt(theElements[0].offsetWidth) * -1;
		if (scroll.config.theMargin > theWidth - 8){
			scroll.config.theMargin = scroll.config.theMargin - scroll.config.distance;
			theElements[0].style.marginLeft = scroll.config.theMargin + "px";
			theElements[0].movement = setTimeout("scroll.slide(), 120");
		}else{
			scroll.moveToBack(theElements[0]);
			scroll.config.theMargin = 0;
			scroll.config.theMargin = scroll.config.theMargin - scroll.config.distance;
			theElements[0].style.marginLeft = scroll.config.theMargin+ "px";
			theElements[0].movement = setTimeout("scroll.slide(), 120");
		}
	},
	stopSlide : function(){
		var scrollSection = document.getElementById(scroll.config.scrollDiv);
		var theElements = scrollSection.getElementsByTagName(scroll.config.scrollElement);
		clearTimeout(theElements[0].movement);
	},
	init: function(){
		scroll.slide();
		var scrollSection = document.getElementById(scroll.config.scrollDiv);
		if (!scrollSection) return false;
		var theElements = scrollSection.getElementsByTagName(scroll.config.scrollElement);
		for (var i=0; i<theElements.length; i++){
			theElements[i].onmouseover = function(){
				scroll.stopSlide();
			}
			theElements[i].onmouseout = function(){
				scroll.slide();
			}	
		}
	}

}
addLoadEvent(scroll.init);
