function validator(theForm)
{

  if (theForm.name.value == "")
  {
    alert("Please enter a value for the \"Name\" field.");
    theForm.name.focus();
    return (false);
  }

  if (theForm.name.value.length < 1)
  {
    alert("Please enter at least 1 characters in 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.email.value.length < 1)
  {
    alert("Please enter at least 1 characters in the \"Email\" field.");
    theForm.email.focus();
    return (false);
  }
  
  if(!IsEmail(theForm.email,'Please enter valid email'))
  {
    return false;
  }
  if (theForm.city.value == "")
  {
    alert("Please enter a value for the \"City\" field.");
    theForm.city.focus();
    return (false);
  }
   if (theForm.country.value == '0')
  {
    alert("Please Select the Country.");
    theForm.country.focus();
    return (false);
  }
   if (theForm.phone_day.value == "")
  {
    alert("Please enter a value for the \"Phone No\" field.");
    theForm.phone_day.focus();
    return (false);
  }
  return (true);
}
function IsEmail(fld,msg)
{
	var regex = /^[\w]+(\.[\w]+)*@([\w-]+\.)+[a-zA-Z]{2,7}$/ ;
	if(!regex.test(fld.value))
	{
		alert(msg);
		fld.focus();
		return false;
	}
	return true;
}

