
$(document).ready(function()
	{

	//Suggerimento email
	$('#mittente_email').addClass('velato').focus(function()
		{
		if ((this.value == 'Inserite la Vostra e-mail') || (this.value == 'Votre e-mail') || (this.value == 'Yours e-mail') )
			{
			$(this).removeClass('velato').val('');
			}
		
		}).blur(function()
			{
			if (this.value == '') 
				{
				$(this).addClass('velato').val('Inserite la Vostra e-mail');
				};
			});
			
	//Verifica formale indirizzo mail
	$('form :input').blur(function()
		{
		if ($(this).is('.obbligatorio'))
			{
			if (this.value == '')
				{
				$(this).addClass('alert');
				}
			else 
				{
				$(this).removeClass('alert');
				};
			};
		
		if ($(this).is('#mittente_email'))
			{
			//var $listItem = $(this).parents('li:first');
			if (this.value != '' && !/.+@.+\.[a-zA-Z]{2,4}$/.test(this.value))
				{
				//alert('Indirizzo e-mail non valido');
				$(this).addClass('alert');
				};
			};
			

		});
		
		
		
	//Verifica dei campiti all'invio del modulo
	$(document).ready(function()
		{
		$('form').submit(function()
			{
			$('#submit-message').remove();
			$(':input.obbligatorio').trigger('blur');
			var numWarnings = $('.alert', this).length;
			if (numWarnings)
				{
				//alert('Per inviare il modulo è necessario correggere i campi evidenziati in rosso')
				$('#errmsg').text('E\' Necessario indicare il nome e un indirizzo e-mail corretto').addClass('evidenzia');
				return false;
				}
			});
		});
	

	
	
	});