$(document).ready(function() {	
	//Set Default State of each portfolio piece
	//$(".paging").show();
	$(".paging_img a:first").addClass("active");	
		
	//Get size of images, how many there are, then determin the size of the image reel.
	//Banner small
	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 + Slider Function
	rotateNormal = function(){	
		var triggerID = $active.attr("rel") - 1; //Get number of times to slide
		
		
	
		var image_reelPosition = triggerID * imageWidth; //Determines the distance the image reel needs to slide
		

		$(".paging_img a").removeClass('active'); //Remove all active class
		
		$active.addClass('active'); //Add active class (the $active is declared in the rotateSwitch function)
		
		
		//Slider Animation
		$(".image_reel").animate({ 
			left: -image_reelPosition
		}, 800 );
		
		
		
	}; 
	
	//Rotation + Timing Event
	rotateSwitchNormale = function(){		
		play = setInterval(function(){ //Set timer - this will repeat itself every 3 seconds
			$active = $('.paging_img a.active').next();
			
			if ( $active.length === 0) { //If paging reaches the end...
				$active = $('.paging_img a:first'); //go back to first
			}
			
			rotateNormal(); //Trigger the paging and slider function
		}, 8000); //Timer speed in milliseconds (3 seconds)
	};
	
	rotateSwitchNormale(); //Run function on launch
	
	
			
});



$(document).ready(function(){	
	$("#slider").easySlider({
		auto: true,
		continuous: true,
		speed:4000		
	});
});	



