$(document).ready(function() {

	$(".paging_hhh").show();
 	$(".paging_hhh a:first").addClass("active_hhh");
 

	var imageWidth_hhh = $(".window_hhh").width();
	var imageSum_hhh = $(".image_reel_hhh img").size();
	var imageReelWidth_hhh = imageWidth_hhh * imageSum_hhh;
 
	$(".image_reel_hhh").css({'width' : imageReelWidth_hhh});
 
	rotate_hhh = function(){	
		var triggerID_hhh = $active_hhh.attr("rel") - 1; //Get number of times to slide
		var image_reel_hhhPosition = triggerID_hhh * imageWidth_hhh; //Determines the distance the image reel needs to slide
		$(".paging_hhh a").removeClass('active_hhh'); //Remove all active_hhh class
		$active_hhh.addClass('active_hhh'); //Add active_hhh class (the $active_hhh is declared in the rotateSwitch_hhh function)
 
		//Slider Animation
		$(".image_reel_hhh").animate({ 
			left: -image_reel_hhhPosition
		}, 536 );
	}; 
 
	
 
	//Rotation + Timing Event
	rotateSwitch_hhh = function(){		
		play_hhh = setInterval(function(){ //Set timer - this will repeat itself every 3 seconds
			$active_hhh = $('.paging_hhh a.active_hhh').next();
			if ( $active_hhh.length === 0) { //If paging_hhh reaches the end...
				$active_hhh = $('.paging_hhh a:first'); //go back to first
			}
 
			rotate_hhh(); //Trigger the paging_hhh and slider function
		}, 4500); //Timer speed in milliseconds (4 seconds)
	};
 
	
 
	rotateSwitch_hhh(); //Run function on launch
	//On Hover
	$(".image_reel_hhh a").hover(function() {
		clearInterval(play_hhh); //Stop the rotation
 
	}, function() {
		rotateSwitch_hhh(); //Resume rotation
 
	});	
	//On Click
 
	$(".paging_hhh a").click(function() {	
 		$active_hhh = $(this); //Activate the clicked paging_hhh 		

 		clearInterval(play_hhh); //Stop the rotation
 		rotate_hhh(); //Trigger rotation immediately
 		rotateSwitch_hhh(); // Resume rotation
 		return false; //Prevent browser jump to link anchor
 	});	
});

