/* slideshow
- - - - - - - - - - - - - - - - - - - - */
function slideSwitch() {
    var $active = $('#slideshow DIV.active');

    if ( $active.length == 0 ) $active = $('#slideshow DIV:last');
    var $next =  $active.next().length ? $active.next()
        : $('#slideshow DIV:first');
    $active.addClass('last-active');
    $next.css({opacity: 0.0})
        .addClass('active')
        .animate({opacity: 1.0}, 1000, function() {
            $active.removeClass('active last-active');
        });
}

/* gestione tab */
function gestioneTab(){
	$(".index").hide();
	$("ul.tabs li a").click(function(){
	$(".index").hide();							 
		tab = $(this).attr("name");
		ind = $("ul.tabs li a").index($(this));
		if ($(".index").width(0))
		 {
		$(tab).animate({ width: "100%", dispay:"block"}, 700 );
		$("#wrap_corpo").show ('normal');}
		else
			{$(tab).animate({ width: "0px"}, 700 );}
		return false;
	});
	$("#titolo span a").click(function () {
		$(".index").fadeOut("normal");	  
		});
}

/* Center
- - - - - - - - - - - - - - - - - - - - */
function center() {
	if ($(".index").width(0))
		 {
		$(".index").animate({ width: "100%", display:"block",}, 700 );
		}
		$("#titolo").show ('normal');
		$("#wrap_corpo").show ('normal');
						 //$(".center").css("width", "100%");
						 //$("#wrap_corpo").css("display", "block");
						   $("#titolo span a").click(function () {
		$(".index").fadeOut("normal");	  
		});
}


/* sticky footer
- - - - - - - - - - - - - - - - - - - - */
function AllineamentoFooter(){
	$("ul.tabs li a").click(function() {
	if($("body").height()+50 > $(window).height()){
		$("#wrap_footer").addClass("relative");
	} else {
		$("#wrap_footer").removeClass("relative");
	}
	});
	
	$("#titolo span a").click(function() {
		$("#wrap_footer").removeClass("relative");
	});
}

/* sticky footer
- - - - - - - - - - - - - - - - - - - - */
function AllineamentoFooter2(){
	if($("body").height()+50 > $(window).height()){
		$("#wrap_footer").addClass("relative");
	} else {
		$("#wrap_footer").removeClass("relative");
	}
	
	$("#titolo span a").click(function() {
		$("#wrap_footer").removeClass("relative");
	});
}


/* Center
- - - - - - - - - - - - - - - - - - - - */
function slideShow() {
	$("#wrap_corpo").show ('normal');
}

/* document ready
- - - - - - - - - - - - - - - - - - - - */
$(document).ready(function(){				  
	setInterval( "slideSwitch()", 10000 );
	AllineamentoFooter2();
});


/* window load
- - - - - - - - - - - - - - - - - - - - */
$(window).load(function(){	
	center();
	AllineamentoFooter2();
});


/* window resize
- - - - - - - - - - - - - - - - - - - - */
$(window).resize(function(){
	
});
