$(document).ready(function(){
/* TAB ALTO */
$("ul.tab-homealto").tabs("div.panel-boxhome > div.panel",
	{
		effect: 'fade',
		rotate: true,
		fadeOutSpeed: "slow",
		tabs:'li'
	}
).slideshow({
	autoplay: true,
	interval: 10000
});
/* FINE TAB ALTO */
$('.news-carousel').cycle({
	fx: 'fade',
	timeout: 4000,
	pause: true 
});
$('.slidealto').mosaic({
	speed : 350,
	animation	:	'slide',
	hover_x: '-260px'	
});
$('.slidemedio').mosaic({
	speed : 350,
	animation	:	'slide',
	hover_x: '-230px'	
});
$("#home-tab").scrollable({
	vertical: true,
	keyboard: 'static',
	onSeek: function(event, i) {
		horizontal.eq(i).data("scrollable").focus();
        }
}).navigator("#home-tab_navi");
var horizontal = $(".scrollable").scrollable({ circular: true }).navigator(".navi");

horizontal.eq(0).data("scrollable").focus();

$('.base').mouseenter(function(){
if($(this).hasClass("precedente")){
$(this).parent('.scrollable').find('.navbtn.precedente').show();
}
if($(this).hasClass("prossimo")){
$(this).parent('.scrollable').find('.navbtn.prossimo').show();
}
});


$('.navbtn').mouseleave(function(){
if($(this).hasClass("precedente")){
$(this).hide();
}
if($(this).hasClass("prossimo")){
$(this).hide();
}
});


$('.navbtn').click(function(){
var total= $(this).parent('.scrollable').data("scrollable").getSize();
		var indx= $(this).parent('.scrollable').data("scrollable").getIndex();
		if($(this).hasClass("prossimo")){
			$(this).parent('.scrollable').data("scrollable").next();

		}
		if($(this).hasClass("precedente")){
			$(this).parent('.scrollable').data("scrollable").prev();

		}
});

});

$(window).load(function(){ $(".navi").each(function(index) {
   var offset=parseInt($(this).width()/2);
   $(this).css('margin-left' , '-'+offset+'px' );;
  });
});
