var isHover = false;
var masterTimeout;
$(document).ready(function(){
	//Change Scene every 5 seconde
		setInterval("ChangeScene();", 5000);
	//Don't do animation when mouse is over...
		$(".videothumb").hover(function(){isHover = true;}, function(){isHover = false;});
});

//Animate the scenes from right to left
	function ChangeScene(){
		if (!isHover) {
			var scenes = $(".scrolling");
			var currentMargin = parseInt(scenes.css("marginLeft").replace("px", ""));
			scenes.animate({
				"marginLeft": (currentMargin - 760)
			}, "slow", switchScenes);
		}
	}

//Take the first 5 scenes and put it at the end.
	function switchScenes(){
		$(".scrolling").css("marginLeft", 0);
	    $(".scrolling .videothumb:lt(4)").appendTo(".scrolling");
	}
