jQuery(document).ready(function(){
	var slidetime = 800;
	var slidewidth = jQuery("#feature-slider-content").width() + jQuery("#feature-slider-content li").outerWidth() - jQuery("#feature-slider-content li").width();
	var slidenum = slidewidth / jQuery("#feature-slider-content li").outerWidth();
	var slidemax = jQuery("#feature-slider-content li").size() / slidenum * slidewidth - slidewidth;
	
	jQuery("#feature li a img").parent().addClass("image-thumb");
			
	jQuery("#feature-slider-controls #slide-previous").click(function(){
		if(jQuery("#feature-slider-content ul").css('margin-left') != '0px' ){
			jQuery("#feature-slider-content ul").filter(':not(:animated)').animate({
				marginLeft: "+="+slidewidth+"px"
			}, slidetime);
		}
	});
	
	jQuery("#feature-slider-controls #slide-next").click(function(){
		if(jQuery("#feature-slider-content ul").css('margin-left') != '-'+slidemax+'px'){
			jQuery("#feature-slider-content ul").filter(':not(:animated)').animate({
				marginLeft: "-="+slidewidth+"px"
			}, slidetime);
		}else{
			jQuery("#feature-slider-content ul").filter(':not(:animated)').animate({
				marginLeft: "0"
			}, slidetime);
		}
	});
	
	jQuery("#feature-slider-controls #slide-previous").hover(function(){
		jQuery(this).stop().animate({
			paddingRight: "5px"
		}, 100);
	},function(){
		jQuery(this).stop().animate({
			paddingRight: "0"
		}, 100);
	});
	
	jQuery("#feature-slider-controls #slide-next").hover(function(){
		jQuery(this).stop().animate({
			paddingLeft: "5px"
		}, 100);
	},function(){
		jQuery(this).stop().animate({
			paddingLeft: "0"
		}, 100);
	});
	
	jQuery("#feature #feature-slides img").hover(function(){
		jQuery(this).stop().animate({
			opacity: "0.15"
		}, 200);
	},function(){
		jQuery(this).stop().animate({
			opacity: "1.0"
		}, 200);
	});
	
	jQuery("a.image-thumb img").hover(function(){
		jQuery(this).stop().animate({
			opacity: "0.15"
		}, 200);
	},function(){
		jQuery(this).stop().animate({
			opacity: "1.0"
		}, 200);
	});
});