jQuery(document).ready(function() {

var total = jQuery("ul#fc_cat_scroll li").size();

if (total==1) {

		} else {
	
	
	//rotation speediop and timer
	var speediop = 2500;
	var runistervr = setInterval('rotater()', speediop);	
	
	//grab the width and calcul#fc_cat_scrollate left value
	var item_widthester = jQuery('.slideser ul#fc_cat_scroll li').outerWidth(); 
	var left_valueecipe = (20 + item_widthester) * (-1); 
        
    //move the last item before first item, just in case user click prev button
	jQuery('.slideser ul#fc_cat_scroll li:first').before(jQuery('.slideser ul#fc_cat_scroll li:last'));
	
	//set the defaul#fc_cat_scrollt item to the correct position 
	jQuery('.slideser ul#fc_cat_scroll').css({'left' : left_valueecipe});

    //if user clicked on prev button
	jQuery('#prev2').click(function() {

		//get the right position            
		var left_indented = parseInt(jQuery('.slideser ul#fc_cat_scroll').css('left')) + item_widthester;

		//slide the item            
		jQuery('.slideser ul#fc_cat_scroll').animate({'left' : left_indented}, 200,function(){    

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

			//set the defaul#fc_cat_scrollt item to correct position
			jQuery('.slideser ul#fc_cat_scroll').css({'left' : left_valueecipe});
		
		});

		//cancel the link behavior            
		return false;
            
	});

 
    //if user clicked on next button
	jQuery('#next2').click(function() {
		
		//get the right position
		var left_indented = parseInt(jQuery('.slideser ul#fc_cat_scroll').css('left')) - item_widthester;
		
		//slide the item
		jQuery('.slideser ul#fc_cat_scroll').animate({'left' : left_indented}, 200, function () {
            
            //move the first item and put it as last item
			jQuery('.slideser ul#fc_cat_scroll li:last').after(jQuery('.slideser ul#fc_cat_scroll li:first'));                 	
			
			//set the defaul#fc_cat_scrollt item to correct position
			jQuery('.slideser ul#fc_cat_scroll').css({'left' : left_valueecipe});
		
		});
		         
		//cancel the link behavior
		return false;
		
	});        
	
	//if mouse hover, pause the auto rotation, otherwise rotater it
	jQuery('.slideser').hover(
		
		function() {
			clearInterval(runistervr);
		}, 
		function() {
			runistervr = setInterval('rotater()', speediop);	
		}
	); 

	
	
	
	}
	
        
});

//a simple function to click next link
//a timer will call this function, and the rotation will begin :)  
function rotater() {
	jQuery('#next2').click();
}
