//jquery

	//Popup loop 10 years-lulahop
	//Paging + Slider Function
function generate_loop_10(){

var dfrtge=1;	

	$(".sidebar4_b").css({opacity: 0});	

	rotate_loop1 = function(){	
		//Slider Animation1
		$(".sidebar4_b").animate({opacity: 1},800);
		dfrtge=2;
	};
	rotate_loop2 = function(){	
		//Slider Animation1
		$(".sidebar4_b").animate({opacity: 0},800);
		dfrtge=1;
	}; 	
	
	//Rotation + Timing Event
	rotateSwitch_loop = function(){		
		play_loop = setInterval(function(){ //Set timer - this will repeat itself every 3 seconds
			if(	dfrtge==1){						 
				rotate_loop1(); //Trigger the paging and slider function
			}else{
				rotate_loop2(); //Trigger the paging and slider function				
			}
		}, 4000); //Timer speed in milliseconds (3 seconds)
	};
	
	rotateSwitch_loop(); //Run function on launch
	
	//On Hover
	$(".sidebar4_b").hover(function() {
		clearInterval(play_loop); //Stop the rotation
	}, function() {
		rotateSwitch_loop(); //Resume rotation
	});	
	
}



$(document).ready(function() {
	//Set Default State
	$(".image_reel10").show();
	$(".image_reel10 img:first").addClass("active");
	//Get size of images, how many there are, then determin the size of the image reel.
	var imageWidth = $(".window10").width();	
						   
	var image_reelPosition1 = 130;
	var image_reelPosition2 = 0;

	$(".image_reel").hover(function() {	
		$(this).css({ left: -image_reelPosition1});
	},function(){
        $(this).css({ left: image_reelPosition2});		
	});	
	
	//Paging + Slider Function
	rotate = 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

		$(".image_reel10 img").removeClass('active'); //Remove all active class
		$active.addClass('active'); //Add active class (the $active is declared in the rotateSwitch function)
		
		//Slider Animation1
		$(".image_reel10").fadeTo("slow", 0, function () {
			$(this).css({ left: -image_reelPosition});	
			$(this).fadeTo("slow", 1);
		});
		
	}; 
	
	//Rotation + Timing Event
	rotateSwitch = function(){		
		play = setInterval(function(){ //Set timer - this will repeat itself every 3 seconds
			$active = $('.image_reel10 img.active').next();
			if ( $active.length === 0) { //If paging reaches the end...
				$active = $('.image_reel10 img:first'); //go back to first
			}
			rotate(); //Trigger the paging and slider function
		}, 4000); //Timer speed in milliseconds (3 seconds)
	};
	
	rotateSwitch(); //Run function on launch
	
	//On Hover
	$(".image_reel10 img").hover(function() {
		clearInterval(play); //Stop the rotation
	}, function() {
		rotateSwitch(); //Resume rotation
	});
	
});
