function setLayout()
{
    var top = ($(document.body).height()-525)/2;
    var left = ($(document.body).width()-1024)/2;
    $('.bg_top').height(top - top%25);
    $('.bg_bottom').height(($(document.body).height() - top - (525 - top%25)));
    $('.centrale').css('margin', 0);
    
    left = left + (25 - left%25);

    if(left < 0) left = 0;

    $('.centrale').css('left', left);
    
    $('.bg_top').width($(document.body).width());
    $('.bg_bottom').width($(document.body).width());

    if($('.bg_top').width() < 1024) $('.bg_top').width(1024);
    if($('.bg_bottom').width() < 1024) $('.bg_bottom').width(1024);
}

function fade()
{	
    $("#prev").addClass("jcarousel-disabled-vertical");  

    $(".jcarousellite").jCarouselLite({
        btnNext: "#next",
        btnPrev: "#prev",
        vertical: true,
        circular: false,
        scroll:3
    });

    /*$(".riv").fadeTo("slow", 0.3); // Setto l'opacita'  a 30%*/
    
    $(".riv").hover(function(){
	  $(".riv").not(this).fadeTo(1, 0.3);
    },function(){
      $(".riv").not(this).fadeTo(1, 1.0);
    });

}

$(document).ready(function()
{   
    setLayout();

	$("#main").css('overflow','hidden')

    fade();	
    
    $("a.ajax").click(function(){
      $(".contenuti").load('ajax.php?do='+this.id);
      return false;
    });

});

$(window).resize(function() {
    setLayout();
}); 

