var clipwidth = 264;
var scrollerspeed=3; // (larger is faster 1-10)
var pauseit=1;
var copyspeed=scrollerspeed;
var actualwidth='';
var pausespeed=(pauseit==0)? copyspeed: 0;

function initialiseScroller(){
	var scrollerContainer = document.getElementById("thumbs_container");
	if(scrollerContainer) {
		scrollerContainer.onmouseover = function() {
			copyspeed = pausespeed;
		}
		scrollerContainer.onmouseout = function() {
			copyspeed = scrollerspeed;
		}
		var scrollerwidth = scrollerContainer.style.width;
	}

	var rightScroller = document.getElementById("rightScroller");
	if (rightScroller) {
		rightScroller.onmouseover = function() {
			lefttime2 = setInterval('scrollRight()',20);
		}
		rightScroller.onmouseout = function() {
			clearTimeout(lefttime2);
		}
	}
	
	var leftScroller = document.getElementById("leftScroller");
	if (leftScroller) {
		leftScroller.onmouseover = function() {
			lefttime=setInterval('scrollLeft()',20);
		}
		leftScroller.onmouseout = function() {
			clearTimeout(lefttime);
		}
	}
	
	var scroller=document.getElementById("thumbs");
	if(scroller) {
		scroller.style.left="0px";
		actualwidth=scroller.offsetWidth;
	}
}
function scrollRight(){
	var scroller=document.getElementById("thumbs");		
	if(scroller) {	
		if (parseInt(scroller.style.left)>(actualwidth*(-1)+clipwidth)) {
			scroller.style.left=parseInt(scroller.style.left)-copyspeed+"px";
		}
	}
}
function scrollLeft(){
	var scroller=document.getElementById("thumbs");
	if(scroller) {
		if (parseInt(scroller.style.left)<0) {
			scroller.style.left=parseInt(scroller.style.left)+copyspeed+"px";
		}
	}
}

addLoadEvent(initialiseScroller);
