function LoadContent(section) {
	
	var location = 'content';
	var loader = location + '_loader';
	
	//Carico il contenuto all'interno del div 'content'
	if (($(location) != null) && ($(loader) != null)) {
	    new Effect.Fade(location, { 
			duration: 0.3, 
			afterFinish: function () {
				new Effect.Appear(loader, { 
					  duration: 0.3, 
					  afterFinish: function () {
						  new Ajax.Updater(location, 'index.php', {
							method: 'post',
							asynchronous: true,
							parameters: 'section=' + section,
													
							onComplete : function() {
								
								new Effect.Fade(loader, { 
									duration: 0.5, 
									afterFinish: function () {
										new Effect.Appear(location, { 
										  duration: 0.3
									    });
									}
								});
							}
						 });
													  
					  }
				 });

				}
		});	
	}
}




//Funzione di Invio Mail
function SendMail() {

	var mittente = '';
	var email = '';
	var titolo = '';
	var testo = '';
	var mittente_valid = false;
	var email_valid = false;
	var titolo_valid = false;
	var testo_valid = false;
	
	mittente = $('mittente').value;
	testo = $('testo').value;
	email = $('email').value;
	titolo = $('title').value;

	if (mittente != '') {
		mittente_valid = true;
	}
	
	if (testo != '') {
		testo_valid = true;
	}
	if (titolo != '') {
		titolo_valid = true;
	}
	
	if ((email.indexOf('@') > -1) && (email.indexOf('.') > -1) && (email.indexOf(' ') == -1) && (email != ''))
		email_valid = true;


	if ((mittente_valid) && (testo_valid) && (email_valid) && (titolo_valid)) {
		$('message_sent').innerHTML = 'Grazie per averci inviato un messaggio!';

		new Ajax.Request('index.php',
					 {
						method: 'post',
						parameters: 'section=sendmail&mittente=' + mittente + '&titolo=' + titolo + '&email=' + email + '&testo=' + testo,
							asynchronous: false,
							onComplete : function(transport) { 
												
												new Effect.Appear('message_sent', 
													{
														duration: 1.2,
														afterFinish: function() {
														var pause=setTimeout("Effect.Fade('message_sent',{duration: 1.2})",3000);
														}				
													});
										},
							onFailure : function() { alert('Error!'); }
						 }
			);
		
		//Sbianco i 4 campi della form
	 $('mittente').value = '';
	 $('title').value = '';
	 $('email').value = '';
	 $('testo').value = '';
	 
	 
	} else {
		if ((email != '') && ((email.indexOf('@') == -1) || (email.indexOf('.') == -1) || (email.indexOf(' ') > -1)))
			error_message = 'Formato email non corretto';
		else
			error_message = 'Informazioni mancanti';
			
		$('message_sent').innerHTML = error_message;
		Effect.Appear('message_sent',{duration: 1.2});
		var pause = setTimeout("Effect.Fade('message_sent',{duration: 1.2})",3000);
	}
}
//Funzione per l'utilizzo della lightwindow
function LoadSlide(filecode,description){
	myLightWindow = new lightwindow({wheight : document.height});
	myLightWindow.activateWindow({
	href: 'http://www.aisped.com/template/images/calendario2009/'+filecode+'.jpg', 
		title: description,
		loadingAnimation: true,
		width: 389,
		height: 600
		});
}
