$(document).ready(function(){
	$('#menu li ').hover(
		function () {
			//show its submenu
			$(this).find("ul").slideDown(100);

		}, 
		function () {
			//hide its submenu
			$(this).find("ul").slideUp(100);			
		}
	);

});
function resizeSlide(){
	var heightW=$(window).height();
	var widthW=$(window).width();
	$('#bg').css('height',heightW+'px');
	$('#bg').css('width',widthW+'px');
	$('#areaClick').css('height',heightW+'px');
	$('#areaClick').css('width',widthW+'px');	
	$("#testo").css("height",heightW-83 +"px");
	$('.cont').jScrollPane();
	$('#returnClick').css('height',heightW+'px');
	$('#returnClick').css('width',widthW+'px');	

	$('#colDX').css('height',heightW+'px');
	$('#colSX').css('height',heightW+'px');
	$("#bg").find('img').each( function() {	
		$(this).css('width', 'auto');
		$(this).css('height', heightW+ 'px');
		var largIMG=$(this).width();
		if (largIMG<widthW) {
		$(this).css('width', widthW+ 'px');
		$(this).css('height', 'auto');
		}
	});	
}
function slideShow() {
    var $active = $('#bg IMG.active');
    if ( $active.length == 0 ) $active = $('#bg IMG:last');
    // use this to pull the images in the order they appear in the markup
    var $next =  $active.next().length ? $active.next()
        : $('#bg IMG:first');
    	$active.addClass('last-active');
    	$next.css({opacity: 0.0})
        .addClass('active')
        .animate({opacity: 1.0}, 1000, function() {
        $active.removeClass('active last-active');
    });
}
 




$(window).load(function() {
  if (jQuery.browser.safari && document.readyState != "complete"){
    setTimeout( arguments.callee, 100 );
    return;
  }
resizeSlide();

var marginSXBOX=($(window).width()/2)+465;
var marginSXARR=($(window).width()-1020)/2;

$("#nascondibox").click(function(){
	$("#nascondibox").fadeOut();
	setTimeout(function() {$(".box").animate({"left": "-=" +marginSXBOX+ "px"}, "slow");}, 500); 
	setTimeout(function() {$("#Arrow").animate({"left": "-=" +marginSXARR+ "px"}, "slow");}, 500);
	setTimeout(function() {$("#mostrabox").fadeIn();}, 1500); return false;
})

$("#mostrabox").click(function(){
	$("#mostrabox").fadeOut();
	setTimeout(function() {$(".box").animate({"left": "+=" +marginSXBOX+ "px"}, "slow");}, 500); 
	setTimeout(function() {$("#Arrow").animate({"left": "+=" +marginSXARR+ "px"}, "slow");}, 500);
	setTimeout(function() {$("#nascondibox").fadeIn();}, 1500); return false;
  return false;
});

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

		$(document).ready(function() {
			$("a[rel=example_group]").fancybox({
				'transitionIn'		: 'none',
				'transitionOut'		: 'none',
				'titlePosition' 	: 'over',
				'overlayShow'	:	true
			});
		});




