$(document).ready(function(){

	var altezza = $(document).height();
	var larghezza = $(document).width();

	$(".blackBody").hide();
	$(".blackBody").animate({opacity: 0}, 0);
	$(".blackBody").css("height",altezza+"px");
	$("#msg-offerta").hide();
	//$("#msg-offerta").animate({opacity: 0}, 0);

	/*$("#autoNews1").hide();														
	$("#autoNews2").hide();														
	$("#autoNews3").hide();														
	$("#autoNews4").hide();														
	$("#autoNews5").hide();	*/													

	setTimeout('showInterstitial('+larghezza+','+altezza+')',300);


	/*$('#bollo-offerta a').click(function(event) {
		$("#msg-offerta").show();
		var leftMsg=(larghezza-350)/2;
		$("#msg-offerta").css('left', leftMsg+'px');
		$(".blackBody").show().animate({opacity: 0.9}, 500, function() {
			//alert("eccomi");
			$("#msg-offerta").animate({top: "220px"}, 500);															 
		});
		event.preventDefault();
	});*/

	$('#msg-offerta a.closeLink').click(function(event) {
		$("#msg-offerta").hide();
		$(".blackBody").show().animate({opacity: 0}, 500, function() {
			$(".blackBody").hide();
		});
		
		/*$("#msg-offerta").animate({opacity: 0}, 500, function() {
			$(".blackBody").show().animate({opacity: 0}, 500, function() {
				$(".blackBody").hide();
				$("#msg-offerta").hide();
			});
		});*/															 
		event.preventDefault();
	});
});

function showInterstitial(larghezza, altezza) {
	//$("#msg-offerta").show();
	var leftMsg=(larghezza-585)/2;
	var topMsg=50;
	//era 370
	$("#msg-offerta").css('top', topMsg+'px');
	$("#msg-offerta").css('left', leftMsg+'px');
	$(".blackBody").show().animate({opacity: 0.8}, 500, function() {
		/*$("#msg-offerta").show().animate({opacity: 1}, 500, function() {
			$(".closeLink").get(0).style.filter="";													
		});*/
		$("#msg-offerta").show();
	});
}
