$(document).ready(function(){
	$.ajax({
		type: "GET", 
		url: 'birdwatching.php',
		//data: formdata,
		timeout: 10000,
		dataType: "html",
		beforeSend:  function() {
			$('#twit_loader').css('opacity','0');
			$('#twit_loader').css('display','block');
			$('#twit_loader').animate({ opacity: "1" }, "slow");
		},
		complete:  function() {
			
		},
		error: function (xhr, desc, exceptionobj) {
			//alert(xhr.responseText);
			data='<div id="twit_err">Si &egrave; verificato un errore durante la connessione a Facebook. Prova a ricaricare la pagina.</div>';
			$('.linkhead.twitter').append(data);
			$('#twit_loader').animate({ opacity: "0" }, "fast", function() {
				$(this).remove();
			});
		},
		success: function(data){
			var output="";
				
			if (data=='ERROR'){//errore di compilazione form
				data='<div id="twit_err">Si &egrave; verificato un errore durante la  connessione a Facebook. Prova a ricaricare la pagina.</div>';
			}
			$('.linkhead.twitter').append(data);
			$('#twit_loader').animate({ opacity: "0" }, "fast", function() {
				$(this).remove();
				$('.linkhead.twitter').cycle({ 
			    timeout: 6000,
			    speed: 1200,
			    sync: true,
			    pause: true
				});
			});
		}
  }); 
});
