function isEmailAddr(email)
{
  var result = false
  var theStr = new String(email)
  var index = theStr.indexOf("@");
  if (index > 0)
  {
    var pindex = theStr.indexOf(".",index);
    if ((pindex > index+1) && (theStr.length > pindex+1))
	result = true;
  }
  return result;
}

function validate()
{

  if (document.Form1.Email.value == "")
  {
    alert("Please enter your Email address.");
    document.Form1.Email.focus();
    return (false);
  }

  if (!isEmailAddr(document.Form1.Email.value))
  {
    alert("Please enter a valid Email address.");
    document.Form1.Email.focus();
    return (false);
  }
  
  if (document.Form1.FirstName.value == "")
{
	alert("Please enter your First Name.")
	document.Form1.FirstName.focus();
	return false;
}

var checkOK = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ ";
  var checkStr = document.Form1.FirstName.value;
  var allValid = true;
  var decPoints = 0;
  var allNum = "";
  for (i = 0;  i < checkStr.length;  i++)
  {
    ch = checkStr.charAt(i);
    for (j = 0;  j < checkOK.length;  j++)
      if (ch == checkOK.charAt(j))
        break;
    if (j == checkOK.length)
    {
      allValid = false;
      break;
    }
    if (ch == ".")
    {
      allNum += ".";
      decPoints++;
    }
    else if (ch != ",")
      allNum += ch;
  }
  if (!allValid)
  {
    alert("Please enter only alphabets in the First Name field.");
    document.Form1.FirstName.focus();
    return (false);
  }

if (document.Form1.LastName.value == "")
{
	alert("Please enter your Last Name.")
	document.Form1.LastName.focus();
	return false;
}

var checkOK = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ ";
  var checkStr = document.Form1.LastName.value;
  var allValid = true;
  var decPoints = 0;
  var allNum = "";
  for (i = 0;  i < checkStr.length;  i++)
  {
    ch = checkStr.charAt(i);
    for (j = 0;  j < checkOK.length;  j++)
      if (ch == checkOK.charAt(j))
        break;
    if (j == checkOK.length)
    {
      allValid = false;
      break;
    }
    if (ch == ".")
    {
      allNum += ".";
      decPoints++;
    }
    else if (ch != ",")
      allNum += ch;
  }
  if (!allValid)
  {
    alert("Please enter only alphabets in the Last Name field.");
    document.Form1.LastName.focus();
    return (false);
  }
  
  if (document.Form1.Country.value == "")
  {
	alert("Please enter your Country of Residence.")
	document.Form1.Country.focus();
	return false;
  }
  
  if (document.Form1.City.value == "")
  {
	alert("Please enter your City of Residence.")
	document.Form1.City.focus();
	return false;
  }
  
  if (document.Form1.Address.value == "")
  {
	alert("Please enter your Address.")
	document.Form1.Address.focus();
	return false;
  }
  
  if (document.Form1.Telephone.value == "")
  {
    alert("Please enter your Telephone.");
    document.Form1.Telephone.focus();
    return (false);
  }
  
  var checkOK = "0123456789";
  var checkStr = document.Form1.Telephone.value;
  var allValid = true;
  var decPoints = 0;
  var allNum = "";
  for (i = 0;  i < checkStr.length;  i++)
  {
    ch = checkStr.charAt(i);
    for (j = 0;  j < checkOK.length;  j++)
      if (ch == checkOK.charAt(j))
        break;
    if (j == checkOK.length)
    {
      allValid = false;
      break;
    }
    if (ch == ".")
    {
      allNum += ".";
      decPoints++;
    }
    else if (ch != ",")
      allNum += ch;
  }
	if (!allValid)
	{
		alert("Please enter only numbers in the Telephone field.");
		document.Form1.Telephone.focus();
	    return false;
	}
  
 
  
  if (document.Form1.Mobile.value == "")
  {
    alert("Please enter your Mobile.");
    document.Form1.Mobile.focus();
    return (false);
  }
  
  if (document.Form1.Passport.value == "")
  {
    alert("Please enter your Passport Number.");
    document.Form1.Passport.focus();
    return (false);
  }
  



  
  if (document.Form1.Driverlicense.value == "")
  {
    alert("Please enter your Driver License.");
    document.Form1.Driverlicense.focus();
    return (false);
  }
  

  
  a = document.Form1.IAGREE.checked;

	if (a==false)
	{
		alert("Please accept the Rental Policy checkbox.");
		document.Form1.IAGREE.focus() ;
		return false;
	}

}
