// pretty photo

$(document).ready(function(){
	$("a[rel^='prettyPhoto']").each(function() {	
		var $image = $(this).contents("img");
			$hoverclass = 'hover_video';

	if($(this).attr('href').match(/(jpg|gif|jpeg|png|tif)/)) 
	$hoverclass = 'hover_image';
		
	if ($image.length > 0)
	{	
		var $hoverbg = $("<span class='"+$hoverclass+"'></span>").appendTo($(this));
		
			$(this).bind('mouseenter', function(){
			$height = $image.height();
			$width = $image.width();
			$pos =  $image.position();		
			$hoverbg.css({height:$height, width:$width, top:$pos.top, left:$pos.left});
		});
	}

});	

$("a[rel^='prettyPhoto']").contents("img").hover(function() {
		$(this).stop().animate({"opacity": "0.2"}, 300);
		},function() {
		$(this).stop().animate({"opacity": "1"}, 300);
	});
});


// slide in home	
	
	if (jQuery().slides) {
		
		jQuery("#slider").hover( function() {
			jQuery('.slides-nav').fadeIn(400);
		}, function () {
			jQuery('.slides-nav').fadeOut(400);
		});
		
	}
	

		$(function(){
			$('#slider').slides({
				preload: true,
				preloadImage: 'images/loading.gif',
				play: 4000,
				pause: 1000,
				hoverPause: true,
				effect: 'fade',
				fadeSpeed: 800,
				crossfade: true,
				generatePagination: false,
				animationStart: function(current){
					$('.caption').animate({
						bottom:-120
					},100);
					if (window.console && console.log) {
						// example return of current slide number
						console.log('animationStart on slide: ', current);
					};
				},
				animationComplete: function(current){
					$('.caption').animate({
						bottom:40
					},200);
					if (window.console && console.log) {
						// example return of current slide number
						console.log('animationComplete on slide: ', current);
					};
				},
				slidesLoaded: function() {
					$('.caption').animate({
						bottom:40
					},200);
				}
			});
		});


// Tabs servizi struttura
$(function() {
	// setup ul.tabs to work as tabs for each div directly under div.panes
	$("ul.tabs").tabs("div.panes > div");
	$("ul.tabs").tabs("div.panes > div");
});


// accordion - continua a leggere in descrizione struttura
// commenti
$(document).ready(function () {
    $('a.accordion').click(function () {
	$('div.post').slideToggle('medium');
    });
});


