// JavaScript Document
$(document).ready(function(){
	$('#top').slideDown("slow",function(){
		$("#header").fadeIn(1600,function(){
			$('#marchio').show("slow",function(){
				$('#linee').show("slow",function(){
					$('#contatti').show("slow",function(){
						$('#links').fadeIn("slow",function(){
							$('#footer').slideDown("slow",function(){
								//do nothing...
								Pulse('cartolina');
							});
						});
					});
				});
			});
			
		});
	});
});

function Pulse(id){
	$("#"+id).animate({ 
			opacity: 0.1
		  }, 1000 )
			  .animate({ 
			opacity: 1
		  }, 1000, function(){Pulse(this.id)});
}

function SendMail(formName){
	var theForm = $("form#"+formName);
	var parameters = theForm.serialize();
	
	$.ajax({
		global: true,
		type: "POST",
		url: "sendmail.php",
		data: parameters,
		dataType: "text",
		beforeSend: function(){
				$("#advice").html('Invio del messagio in corso...');
				$("#advice").show("fast");
			},
		success: function(data, textStatus){
					$("#advice").html(data);
					setTimeout(function(){
							$("#advice").hide("fast");
						}, 2000);
				},
		error: function(XMLHttpRequest, textStatus, errorThrown){
					//alert(XMLHttpRequest);
					alert(textStatus);
					//alert(errorThrown);
				}
	});
}

