function mycarousel_initCallback(carousel) {
    $('.slider-nav a').bind('click', function() {
        carousel.scroll(jQuery.jcarousel.intval(jQuery(this).text()));
        return false;
    });
};





$(function(){
	
	if ( $.browser.msie && $.browser.version.substr(0,1) == 6 ) {
		DD_belatedPNG.fix('#navigation a, #navigation a:hover, #navigation a.active, .dd-b, .dd');
	}
	
	$('#navigation > ul > li').hover(function(){
	$(this).find('.dd-holder').show();
	$(this).find('a:eq(0)').addClass('hover');
	},
	function(){
		$(this).find('.dd-holder').hide();
		$(this).find('a:eq(0)').removeClass('hover');
	});

	$('.slider-content ul').jcarousel({
		start: 1,
		auto: 0,
		wrap: "none",
		scroll: 3,
		visible: 3,
		initCallback: mycarousel_initCallback,
        buttonNextHTML: null,
        buttonPrevHTML: null
	});

    $('.slider-nav ul li a').click(function(){
    $('.slider-nav ul li a').removeClass('active');
    $(this).addClass('active');
    });

    $('#coin-slider').coinslider({
	width: 676, // width of slider panel
    height: 448, // height of slider panel
    spw: 9, // squares per width
    sph: 9, // squares per height
    delay: 3000, // delay between images in ms
    sDelay: 30, // delay beetwen squares in ms
    opacity: 0.7, // opacity of title and navigation
    titleSpeed: 500, // speed of title appereance in ms
    effect: 'rain', // random, swirl, rain, straight
    navigation: true, // prev next and buttons
    links : false, // show images as links
    hoverPause: true // pause on hover
    });

                //Examples of how to assign the ColorBox event to elements
		$("a[rel='hotel-chianti']").colorbox();
                $(".fotogall").colorbox();
		$(".testi").colorbox();
                /*
				$("a[rel='example2']").colorbox({transition:"fade"});
				$("a[rel='example3']").colorbox({transition:"none", width:"75%", height:"75%"});
				$("a[rel='example4']").colorbox({slideshow:true});
				$(".example5").colorbox();
				$(".example6").colorbox({iframe:true, innerWidth:425, innerHeight:344});
				$(".example7").colorbox({width:"80%", height:"80%", iframe:true});
				$(".example8").colorbox({width:"50%", inline:true, href:"#puntale-da-pesca"});
				$(".example9").colorbox({
					onOpen:function(){ alert('onOpen: colorbox is about to open'); },
					onLoad:function(){ alert('onLoad: colorbox has started to load the targeted content'); },
					onComplete:function(){ alert('onComplete: colorbox has displayed the loaded content'); },
					onCleanup:function(){ alert('onCleanup: colorbox has begun the close process'); },
					onClosed:function(){ alert('onClosed: colorbox has completely closed'); }
				});

				//Example of preserving a JavaScript event for inline calls.
				$("#click").click(function(){
					$('#click').css({"background-color":"#f00", "color":"#fff", "cursor":"inherit"}).text("Open this window again and this message will still be here.");
					return false;
				});
	            */



$("a.fotogall").hover(
function () {
    $(this).find("img:last").stop().animate({ opacity: 0.5 }, 200);
    $(this).append($("<div class='fotogalltext'><span>Gallery</span></div>"));
  },
  function () {
    $(this).find("img:last").stop().animate({ opacity: 1 }, 200);
    $(this).find("div:last").remove();
  }
);

$("a.fotogallhome").hover(
function () {
    $(this).find("img:last").stop().animate({ opacity: 0.5 }, 200);
  },
  function () {
    $(this).find("img:last").stop().animate({ opacity: 1 }, 200);
  }
);

$('.date-pick').datePicker({autoFocusNextInput: true});

});



