var contactme_fields=
	[
		'Nome e cognome',
		'Email',
		'Telefono',
		'Messaggio',
	];

$(document).ready
(
	function()
	{
		$('#contactme_form .Button').click
		(
			function (event)
			{
				var error=false;
				var email_regexp= /^[\w\.=-]+@[\w\.-]+\.[\w]{2,3}$/;

				$.each
				(
					$('#contactme_form .contactme_field'), function (i, val)
					{
						if (!error)
						{
							if ( (i==1) && (!email_regexp.test($(this).val())) )
								error=true;
							else if ($(this).val()=='')
								error=true;

							if (error)
								alert (contactme_fields[i]+': inserire un valore valido');
						}

					}
				);

				if (error)
					return false;
				else
					$('#contactme_form form').submit();
			}
		);

	}
);
