$(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();

	if ($("#arrow1").length>0) {
		//var leftArrow=((larghezza-760)/2)+100;
		//$("#arrow").css('left',leftArrow);
		$("#arrow1").animate({top: "55px"}, 500);
		$("#arrow2").animate({top: "55px"}, 500);
		setTimeout('muoviFreccia()',2000);
	}

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

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

	if ($("#banner-app").length>0) {
		$("#banner-app").animate({top: 0}, 600);		
	}


});

function posizioneBanner() {
	scrollAmount=$(window).scrollTop();
	$("#banner-app").stop(true, false).animate({"top": scrollAmount + "px"}, 200);
}

$(window).scroll(function() {
	posizioneBanner();
});


function muoviFreccia() {
	setInterval('spostaFreccia(\'1\')',1000);	
	setInterval('spostaFreccia(\'2\')',1000);	
}
function spostaFreccia(num) {
	$("#arrow"+num).animate({top: "80px"}, 400, function() {
		$("#arrow"+num).animate({top: "50px"}, 400);											 
	});
}
