function Validator(theForm) 

{
 if (theForm.name.value == "")
	 { 
		    alert("Please enter a value for the \NAME\ field.");
		    theForm.name.focus(); 
		    return (false);
	 }

 if (theForm.email.value == "")
	 {
		 alert("Please enter a value for the \Email\ field.");
		 theForm.email.focus(); 
		 return (false);
	 }

if (theForm.city.value == "")
	 { 
		  alert("Please enter a value for the \City\ field.");
		  theForm.city.focus(); 
		  return (false);
	 }

 if (theForm.telephone.value == "")
	 { 
		  alert("Please enter a value for the \Phone\ field.");
		  theForm.telephone.focus(); 
		  return (false);
	 }

if (! isEmail (theForm.email.value))
	 {	
		alert("Please enter a valid Email id in the \"Email\" field."); 
		theForm.email.focus();
		 return (false);
	 }

if (theForm.name.value.length > 50)

 { 
		alert("Please enter at most 50 characters in the \NAME\ field."); 
		theForm.name.focus(); 
		return (false);
 }

if (theForm.email.value.length > 50)
 { 
		alert("Please enter at most 50 characters in the \EMAIL\ field."); 
		theForm.email.focus(); 
		return (false);
 } 



var cValue = theForm.name.value; 
var allSpace = true; 
for (i=0; i < cValue.length; i++) 
{ ch = cValue.charAt(i); 
if ( ch == ' ') allSpace = true; 
else { allSpace = false; break;
 } 
}
 if (allSpace) 
{
		 alert("All Spaces not allowed in the NAME field.");
		 theForm.name.focus();
   		 return (false); 
} 

var cValue = theForm.email.value; 
var allSpace = true;
for (i=0; i < cValue.length; i++)
 
	{ ch = cValue.charAt(i); if ( ch == ' ') allSpace = true; 
	else
	 {
		 allSpace = false; break; 
	} 

}
 if (allSpace) 
{ 
		alert("All Spaces not allowed in the EMAIL field.");
		theForm.email.focus(); 
		return (false);
 }

if (allSpace)
 { 
		alert("All Spaces not allowed in the EMAIL field.");
		return (false);
 } 

return (true); 
} 


