// JavaScript Document
$(document).ready(function(){
				
				//jQuery.fn.stripTags = function() { return this.replaceWith( this.html().replace(/<\/?[^>]+>/gi, '') ); };
				//$(".stripThis").stripTags();
	//$('.featureTease').html('');
	
	$('.featureItem').hover(function(){
		$(this).find('.hoverGrunge').each(function(i){
			$(this).stop(true, true).fadeIn("medium");
		});
		$(this).find('.featureTitle').each(function(i){
		$(this).stop(true, true).animate({bottom: "0"}, 250);
		});
		}, 
		function(){
		$(this).find('.hoverGrunge').each(function(i){
		$(this).stop(true, true).fadeOut("medium");
		});
		$(this).find('.featureTitle').each(function(i){
		$(this).stop(true, true).animate({bottom: "-90"}, 250);
		});
		});
	
	var speed = 5000;
	//grab the width and calculate left value
	var item_width = $('#featureArea ul li').outerWidth(); 
	var left_value = item_width * (-1); 

    //move the last item before first item, just in case user click prev button
	$('#featureArea ul li:first').before($('#featureArea ul li:last'));
	 
	
	//set the default item to the correct position 
	$('#featureArea ul').css({'left' : left_value});
	
 //if user clicked on prev button
	$('#featureLeft').click(function() {

		//get the right position            
		var left_indent = parseInt($('#featureArea ul').css('left')) + item_width;

		//slide the item            
		$('#featureArea ul').stop(true, true).animate({'left' : left_indent},function(){    

            //move the last item and put it as first item            	
			$('#featureArea ul li:first').before($('#featureArea ul li:last'));           

			//set the default item to correct position
			$('#featureArea ul').css({'left' : left_value});
		
		});

		//cancel the link behavior            
		return false;
            
	});
	    
		//if user clicked on next button
	$('#featureRight').click(function() {
		
		//get the right position
		var left_indent = parseInt($('#featureArea ul').css('left')) - item_width;
		
		//slide the item
		$('#featureArea ul').stop(true, true).animate({'left' : left_indent}, function () {
            
            //move the first item and put it as last item
			$('#featureArea ul li:last').after($('#featureArea ul li:first'));                 	
			
			//set the default item to correct position
			$('#featureArea ul').css({'left' : left_value});
		
		});
		         
		//cancel the link behavior
		return false;
		
	});   
	$(function()
{
	$('#scrollWrapper').jScrollPane({showArrows:true});
});
	
});
