﻿$(document).ready(function() {
    $(".show_paging").show(); 
 	$(".show_paging a:first").addClass("active"); 
	var imageWidth = $(".show_window").width(); 
	var imageSum = $(".show_image_reel img").size(); 
	var imageReelWidth = imageWidth * imageSum; 
 	$(".show_image_reel").css({'width' : imageReelWidth}); 
	rotate = function(){	
 		var triggerID = $active.attr("rel") - 1;  
		var image_reelPosition = triggerID * imageWidth; 
		
  		$(".show_paging a").removeClass('active');  
		$active.addClass('active'); 
        $(".show_image_reel").animate({left: -image_reelPosition }, 1000); 
        
	};
	rotateSwitch = function(){ 
		 		play = setInterval(function(){$active = $('.show_paging a.active').next(); 
			                        if ($active.length === 0)
			                        {  				                            
                                        $(".show_image_reel").animate({left:1},10);
	                                    $active = $('.show_paging a:first');  
 			                        } 	
		                            rotate(); }, 2000);}; 	
 	rotateSwitch();  
	$(".show_image_reel a").hover(function() { 	
	                        clearInterval(play);  	}, function() { 
		                    rotateSwitch(); 
 	                        });	 	
  	$(".show_paging a").click(function() {	 
  	                
	                $active = $(this);  
	  		        clearInterval(play);   	
	                rotate();   	
	                rotateSwitch();  
	                $(this).fadeIn(1000);	
 		            return false;  	});	
 	 });///Document End



