// <![CDATA[
$(document).ready(function() {
						   
	//CAROUSELL SPORT
	jQuery('#jcarousel-sport').jcarousel();

	//CAROUSELL HOME SLIDER		
	jQuery('#jcarousel-home-slider').jcarousel({
		scroll: 1,
		auto: 7,
		wrap: 'last',
		buttonNextHTML: null,
		buttonPrevHTML: null
	});
	
	//FADE CAROUSELL SPORT IMG
	$(".jcarousel-skin-sport li img").fadeTo("slow", 0.6);
		$(".jcarousel-skin-sport li img").hover(function(){
		$(this).fadeTo("fast", 1.0);
		},function(){
		$(this).fadeTo("fast", 0.6);
	});
	//FADE LISTA SPORT
	$(".list-sport li img").fadeTo("slow", 0.6);
		$(".list-sport li img").hover(function(){
		$(this).fadeTo("fast", 1.0);
		},function(){
		$(this).fadeTo("fast", 0.6);
	});
	//FADE MARCHI
	$(".list-marchi li img").fadeTo("slow", 0.6);
		$(".list-marchi li img").hover(function(){
		$(this).fadeTo("fast", 1.0);
		},function(){
		$(this).fadeTo("fast", 0.6);
	});
	
	//TABS
	$("ul.tabs").tabs("div.panes > div");
	
	//Scroll the menu on mouse move above the #shop-wrap layer
	$('#shop-wrap').mousemove(function(e) {

		//Sidebar Offset, Top value
		var s_top = parseInt($('#shop-wrap').offset().top);		
		
		//Sidebar Offset, Bottom value
		var s_bottom = parseInt($('#shop-wrap').height() + s_top);
	
		//Roughly calculate the height of the menu by multiply height of a single LI with the total of LIs
		var mheight = parseInt($('#shop-scroll li').height() * $('#shop-scroll li').length);
	
		//I used this coordinate and offset values for debuggin
		$('#debugging_mouse_axis').html("X Axis : " + e.pageX + " | Y Axis " + e.pageY);
		$('#debugging_status').html(Math.round(((s_top - e.pageY)/495) * mheight / 2));
			
		//Calculate the top value
		//This equation is not the perfect, but it 's very close	
		var top_value = Math.round(( (s_top - e.pageY)/495) * mheight / 2);
		
		//Animate the #menu by chaging the top value
		$('#shop-scroll').animate({top: top_value}, { queue:false, duration:200});
	});
	
	//IMAGE CYCLE
	$('.slideshow').cycle({
		fx: 'fade'
	});
	$('.slideshow-control').cycle({
		fx: 'fade',
		prev:'#slide_prev', 
		next:'#slide_next'
	});
	
	//SLIDER ARCHIVIO NEWS
	//	Scrolled by user interaction
	$('#news').carouFredSel({
		prev: '#prev',
		next: '#next',
		pagination: "#pager",
		auto:false,
		circular:false,
		infinite:false,
		direction : "up",
		items : {
			visible: 5
			},						
			scroll : {
				items : 5,
				fx : "scroll"
			},
			auto : {
				play: false	
		}
	});

  
});
