$(document).ready(function() {
	$(".slide_navi").show();
	$(".slide_navi a:first").addClass("active");
	var imageWidth = $(".slide_view").width();
	var imageSum = $(".image_reel img").size();
	var imageReelWidth = imageWidth * imageSum;
	$(".image_reel").css({'width' : imageReelWidth});
	rotate = function(){    
		var triggerID = $active.attr("rel") - 1;
		var image_reelPosition = triggerID * imageWidth;
		$(".slide_navi a").removeClass('active');
		$active.addClass('active');
		$(".image_reel").animate({ 
		left: -image_reelPosition
		}, 500 );
	}; 
	rotateSwitch = function(){        
		play = setInterval(function(){
		$active = $('.slide_navi a.active').next();
		if ( $active.length === 0) {
			$active = $('.slide_navi a:first');
		}
		rotate();
		}, 5000);
	};
	
	rotateSwitch();
	
	$(".image_reel a").hover(function() {
		clearInterval(play);
		}, function() {
		rotateSwitch();
	});    
	
	$(".slide_navi a").click(function() {    
		$active = $(this);
		clearInterval(play);
		rotate();
		rotateSwitch();
		return false;
	});    
	
});

