$(document).ready(function(){  
	$('#footer a:not(.info), .accetto a').colorbox({width:"600px", height:"500px", iframe:true });
	$('a.sfoglia').colorbox({width:"990px", height:"600px", iframe:true });
	$('.info').colorbox({width:"500px", height:"350px", iframe:true });	
	$('a.lb').colorbox();
	$("a.blank").click( function() { $(this).attr("target", "_blank") });
	
	$(".fbShare, .twShare").click( function() {
		var u=location.href;
		$(this).hasClass("fbShare") ? window.open('http://www.facebook.com/sharer.php?u='+encodeURIComponent(u)+'&src=sp', '','') :
		$(this).hasClass("twShare") ? window.open('http://twitter.com/home?status=Currently%20reading%20'+encodeURIComponent(u), '','') : "";
		return false;
	});
	
	
	$("#catMenu li").hover( function() { $(this).addClass("over"); }, function() { $(this).removeClass("over"); });
	$("#catMenu li").click( function() { window.location = $(this).find("a").attr("href"); });
	
	
	$(".scheda p.open a, .scheda .close").click( function() {
		$(".scheda .content").stop().toggle( "blind", "fast" );
		$(".scheda").toggleClass("opened");
		return false;
	});
	
	$(".finiture li a").hover( function() {
		$(this).closest("li").addClass("over");
		var img = $(this).attr("href");
		var title = $(this).find("img").attr("alt");
		$(this).closest("li").append("<div class='pop'><img src='"+img+"' alt='' /><h4>"+title+"</h4></div>");
	}, function() {
		$(this).closest("li").removeClass("over");
		$(".finiture .pop").remove();
	});
	$(".finiture li a").click( function() { return false; });
	
	/* natale!!!111
	$(document).snowfall({flakeCount : 100, maxSpeed : 5});*/
	
});

function slideSwitch() {
    var $active = $('#slideshow li.active');

    if ( $active.length == 0 ) $active = $('#slideshow li:last');

    var $next =  $active.next().length ? $active.next()
        : $('#slideshow li:first');

    $active.addClass('last-active');

    $next.css({opacity: 0.0})
        .addClass('active')
        .animate({opacity: 1.0}, 1000, function() {
            $active.removeClass('active last-active');
        });
}

function mycarousel_initCallback(carousel) {
    jQuery('.carousel .next').bind('click', function() {
        carousel.next();
        return false;
    });
    jQuery('.carousel .prev').bind('click', function() {
		carousel.prev();
        return false;
    });
};



