// JavaScript Document

$(document).ready(function(){
	
	var num = 0;
	//Get size of the image, how many images there are, then determin the size of the image reel.
	var imageWidth = $(".window").width();
	var imageSum = $(".image_reel img").size();
	var imageReelWidth = imageWidth * imageSum;
	
	//Adjust the image reel to its new size
	$(".image_reel").css({'width' : imageReelWidth});
	
	//Paging  and Slider Function
	rotate = function(){
		var image_reelPosition = num*imageWidth; //Determines the distance the image reel needs to slide
		
		//Slider Animation
		$(".image_reel").animate({
			left: -image_reelPosition
		}, 500 );
	}; 
	

	
	//Rotation  and Timing Event
	rotateSwitch = function(){
		play = setInterval(function(){ //Set timer - this will repeat itself every 7 seconds
			num = num+1;
			if(num>=11){
				num=0;
			}
			rotate(); //Trigger the paging and slider function
		}, 5000); //Timer speed in milliseconds (7 seconds)
	};
	
	rotateSwitch(); //Run function on launch
	
	
	
});
