$(window).load(function() {
    $('#nslider').nivoSlider({
        effect:'random', //Specify sets like: 'fold,fade,sliceDown'
     	pauseTime:5000,
        keyboardNav:true, //Use left - right arrows
        pauseOnHover:true, //Stop animation while hovering
        manualAdvance:false, //Force manual transitions
        controlNav:false, // 1,2,3... navigation
        prevText: 'Indietro', // Prev directionNav text
        nextText: 'Avanti', // Next directionNav text
        beforeChange: function(){}, // Triggers before a slide transition
        afterChange: function(){}, // Triggers after a slide transition
        slideshowEnd: function(){}, // Triggers after all slides have been shown
        lastSlide: function(){}, // Triggers when last slide is shown
        afterLoad: function(){} // Triggers when slider has loaded
    });
});
$(document).ready(function(){
	$(".galleria").colorbox({transition:"fade"});
    jQuery("a[rel='external']").each(function(i){
    	if (typeof jQuery(this).attr('title') == "undefined" )
    		jQuery(this).attr('title',jQuery(this).attr('href')+' (apre in nuova finestra)');
    	else
    		jQuery(this).attr('title',jQuery(this).attr('title')+' (apre in nuova finestra)');
    	jQuery(this).append('<span class="external" title="'+jQuery(this).attr('title')+'"></span>').click(function(){
    		window.open(jQuery(this).attr('href')); return false;
    	});
    });
	$("#navigation ul li").hover(function(){
		$(this).children('ul').show();
	},function(){
		$(this).children('ul').hide();
	});
    $('#slider').cycle({
		fx:     'scrollHorz',
	    timeout: 5000,
	    prev: '.previous',
		next: '.next'
	});
    $("#paggalleria ul li a").append("<div>&nbsp;</div>");
    $("#slider ul li a").append("<div>&nbsp;</div>"); //Only shows drop down trigger when js is enabled - Adds empty span tag after ul.subnav

});
