var scrllTmr;
function goLeft(){
	//set style
	document.getElementById('topWindow').style.overflow = 'hidden';
	document.getElementById('tops').style.float = 'left';
	document.getElementById('tops').style.position = 'relative';

	//get canvas
	totalImages = 5;
    marginRight = 10;
    totalWidth = parseInt($(".imgWidths").html()) + (totalImages * marginRight);
    $(".topWindow .tops").css("width",totalWidth+'px');
    topWindowWidth = $(".topWindow").css("width");
    cw = parseInt(topWindowWidth.substr(0,(topWindowWidth.length-2)));
	w = totalWidth;
	
	//start scroll	
	end = 0;
	lft = parseInt(document.getElementById('tops').style.left);
	//alert(lft);
	document.getElementById('tops').style.left = lft + "px";
	scrollStepLeft(cw,w,lft,end);
}
function scrollStepLeft(cw,w,lft,end){
	//calc and do step
	document.getElementById('tops').style.left = lft + "px";
	
	//wait and do next...
	if(scrllTmr)
		clearTimeout(scrllTmr);
	if (parseInt(lft) < end) {
		scrllTmr = setTimeout('scrollStepLeft(cw,w,' + (parseInt(lft) + 10) + ',end)',1);
	} else {
		clearTimeout(scrllTmr);
	}
}

function goRight(){
	//set style
	document.getElementById('topWindow').style.overflow = 'hidden';
	document.getElementById('tops').style.float = 'left';
	document.getElementById('tops').style.position = 'relative';

	//get canvas
	totalImages = 5;
    marginRight = 10;
    totalWidth = parseInt($(".imgWidths").html()) + (totalImages * marginRight);
    $(".topWindow .tops").css("width",totalWidth+'px');
    topWindowWidth = $(".topWindow").css("width");
    cw = parseInt(topWindowWidth.substr(0,(topWindowWidth.length-2)));
	w = totalWidth;
	
	//start scroll	
	end = (w-cw)*-1;
	lft = parseInt(document.getElementById('tops').style.left);
	if(lft!=lft-0) {	
		lft = "0";
	} else {
		lft = parseInt(document.getElementById('tops').style.left);
	}
	document.getElementById('tops').style.left = lft + "px";
	scrollStepRight(cw,w,lft,end);
}
function scrollStepRight(cw,w,lft,end){
	//calc and do step
	document.getElementById('tops').style.left = lft + "px";
	
	//wait and do next...
	if(scrllTmr)
		clearTimeout(scrllTmr);
	if (end < lft) {
		scrllTmr = setTimeout('scrollStepRight(cw,w,' + (lft - 10) + ',end)',1);
	} else {
		clearTimeout(scrllTmr);
	}
}


