$(document).ready(function(){  
	$('a.lb').colorbox();
	$('footer a.lb, .accetto .lb').colorbox({width:"600px", height:"500px", iframe:true });
	$('#colDx a.lb').colorbox({width:"500px", height:"400px", iframe:true });	
	$('a.yt').colorbox({width:"850px", height:"510px", iframe:true });	
	
	$("a.blank, .cataloghi a.download").click( function() { $(this).attr("target", "_blank") });
	$('.cataloghi a.sfoglia').colorbox({width:"100%", height:"100%", iframe:true });
	
	$('.gallery a.lb').colorbox({rel:'gal'});
	
	var bg = "<span class='bg'></span>";
	$("#pagePop, .cataloghi").append(bg);
	
	$(".cataloghi").hover(
		function() { $(this).addClass("over"); },
		function() { $(this).removeClass("over")
	});
	
	if($("#mainPage h1").length != 0) {
		Cufon.replace('#mainPage h1', { hover: true });
	}
	//Cufon.refresh("h1")
	
	
	$("#site").prepend("<div id='colBg'></div><div id='sensibleDiv'></div>");
	$("#colBg").css("opacity", "0");
	
	$("#mainHeader, #mainFooter, #sensibleDiv").hover( 
		function() {
			$("#colBg").stop().animate({opacity:.8}, 500);
			$("#pMenu").show();
	},	function() {
			$("#colBg").stop().animate({opacity:0}, 500);
			$("#pMenu").hide();
	});
	
	
	
	
	
	
	
	
	
	
	
	
	
	$("#footerDescription h1").live("click", function() {
		resize();
		$(this).closest("#footerDescription").toggleClass("open").find("p").toggle(
			function() {
				$("#footerDescription .bg").stop().animate({opacity:.8}, 200);
			}																		   
		);
		
	});
	
	$(window).bind("resize", resize);
});

function resize() {
	if($("#footerDescription").length!=0) {
		$("#footerDescription").css("width",$("body").width()-80-198);	
	}
}
