			function emailCheck(emailStr) {
			var emailPat=/^(.+)@(.+)$/
			var specialChars="\\(\\)<>@,;:\\\\\\\"\\.\\[\\]"
			var validChars="\[^\\s" + specialChars + "\]"
			var quotedUser="(\"[^\"]*\")"
			var ipDomainPat=/^\[(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})\]$/
			var atom=validChars + '+'
			var word="(" + atom + "|" + quotedUser + ")"
			// The following pattern describes the structure of the user
			var userPat=new RegExp("^" + word + "(\\." + word + ")*$")
			var domainPat=new RegExp("^" + atom + "(\\." + atom +")*$")
			var matchArray=emailStr.match(emailPat)
			if (matchArray==null) {
			alert("L'email non é corretta")
			return false
			}
			var user=matchArray[1]
			var domain=matchArray[2]

			// See if "user" is valid 
			if (user.match(userPat)==null) {
				// user is not valid
				alert("L'email non é corretta")
				return false
			}
			var IPArray=domain.match(ipDomainPat)
			if (IPArray!=null) {
				// this is an IP address
				  for (var i=1;i<=4;i++) {
					if (IPArray[i]>255) {
						alert("L'email non é corretta")
					return false
					}
				}
				return true
			}

			// Domain is symbolic name
			var domainArray=domain.match(domainPat)
			if (domainArray==null) {
				alert("L'email non é corretta")
				return false
			}
			var atomPat=new RegExp(atom,"g")
			var domArr=domain.match(atomPat)
			var len=domArr.length
			if (domArr[domArr.length-1].length<2 || 
				domArr[domArr.length-1].length>3) {
			   // the address must end in a two letter or three letter word.
			   alert("L'email non é corretta")
			   return false
			}

			// Make sure there's a host name preceding the domain.
			if (len<2) {
			   var errStr="L'email non é corretta"
			   alert(errStr)
			   return false
			}

			// If we've gotten this far, everything's valid!
			return true;
		}

		function formchecker()
		{

		if(form.rag.value=="")
		{
			alert("Inserire la ragione sociale (se sei un privato scrivi 'Privato')");
			form.rag.focus();
			return false;
		}

		if(form.nome.value=="")
		{
			alert("Inserire il nome");
			form.nome.focus();
			return false;
		}

		if(form.cognome.value=="")
		{
			alert("Inserire il cognome");
			form.cognome.focus();
			return false;
		}

		if(form.citta.value=="")
		{
			alert("Inserire la città");
			form.citta.focus();
			return false;
		}

		if(form.cap.value=="")
		{
			alert("Inserire il CAP");
			form.cap.focus();
			return false;
		}

		if(form.email.value=="")
		{
			alert("Inserire la mail");
			form.email.focus();
			return false;
		}
		else
		{
			if(emailCheck(form.email.value)==false) return false;
		}

		if(form.telefono.value=="")
		{
			alert("Inserire il telefono");
			form.telefono.focus();
			return false;
		}

		if(form.select.selectedIndex==0)
		{
			alert("Selezionare il campo 'come ci hai conosciuti?'");
			form.select.focus();
			return false;
		}

		return true;
	}

	function numeralsOnly(evt) 
	{
		evt = (evt) ? evt : event;
		var charCode = (evt.charCode) ? evt.charCode : ((evt.keyCode) ? evt.keyCode : 
			((evt.which) ? evt.which : 0));
		if (charCode > 31 && (charCode < 48 || charCode > 57)) {
			alert("Puoi inserire solo numeri");
			return false;
		}
		return true;
	}