$(document).ready(function() {
	

	$("#projectOverview").tablesorter(); 
	
	
	scroller();

});


function scroller() {
	if (document.getElementById("scrollerWrapper") && document.getElementById("scroller2")) {
		width = parseInt($("#scroller1").css("width"));
		pos1 = $("#scroller1").position().left;
		pos2 = $("#scroller2").position().left;
		scrollInt=setInterval("doScroll()",60)
	
		$("#scrollingHotSpotLeft").mouseover(function() {
			scrollingSpeed = 9;//9
		});
		
		$("#scrollingHotSpotLeft").mouseout(function() {
			scrollingSpeed = 3;//3
		});
		
		$("#scrollingHotSpotRight").mouseover(function() {
			scrollingSpeed = -9;//-9
		});
		
		$("#scrollingHotSpotRight").mouseout(function() {
			scrollingSpeed = -3;//-3
		});
		
		$("div#makeMeScrollable .sliderCase").mouseover(function() {
			scrollingSpeed = 0;//0
		});
		$("div#makeMeScrollable .sliderCase").mouseout(function() {
			if(!scrollPopup) {
				scrollingSpeed = -3;//-3
			}	
		});
	}
}

var scrollingSpeed = -3;//-3
var scrollPopup = false;
var pos1, pos2, width;
function doScroll() {
	pos1 = pos1 + scrollingSpeed;
	pos2 = pos2 + scrollingSpeed;
	$("#scroller1").css( { "left": pos1 + "px" } );
	$("#scroller2").css( { "left": pos2 + "px" } );
	
	if (pos1 < (width * -1)) {
		pos1 = pos2 + width;
		$("#scroller1").css( { "left": pos1 + "px" } );
	}
	if (pos2 < (width * -1)) {
		pos2 = pos1 + width;
		$("#scroller2").css( { "left": pos2 + "px" } );
	}
	if (pos1 > width) {
		pos1 = pos2 - width;
		$("#scroller1").css( { "left": pos1 + "px" } );
	}
	if (pos2 > width) {
		pos2 = pos1 - width;
		$("#scroller2").css( { "left": pos2 + "px" } );
	}
}



