  function isblank(s)
{
    for(var i = 0; i < s.length; i++) {
        var c = s.charAt(i);
        if ((c != ' ') && (c != '\n') && (c != '\t')) return false;
    }
    return true;
}
function isValidEmail(e)
{
	var alnum="a-zA-Z0-9";
	exp="^[^@\\s]+@(["+alnum+"+\\-]+\\.)+["+alnum+"]["+alnum+"]["+alnum+"]?$";
	emailregexp = new RegExp(exp);

	result = e.match(emailregexp);
	if (result != null)
	{
		return true;
	}
	else
	{
		return false;
	}
}

function isValidNumber(numval)
{
	if (numval==""){return false;}
	var myRegExp = new RegExp("^[/+|/-]?[0-9]*[/.]?[0-9]*$");
	return myRegExp.test(numval);
}

function Validate()
{
	if (document.Form.nametitle.selectedIndex == 0)
  {
    alert("Please select Your Title.");
    Form.nametitle.focus();
    return (false);
  }
	if (isblank(document.getElementById("name").value))
	{
		alert("Enter Name!");
		document.getElementById("name").focus();
		return false;
	}
	else if (!isValidNumber(document.getElementById("telephone").value))
	{
		alert("Enter Valid Phone Number!");
		document.getElementById("telephone").focus();
		return false;
	}
	else if (!isValidEmail(document.getElementById("email").value))
	{
		alert("Enter Valid Email ID!");
		document.getElementById("email").focus();
		return false;
	}
  if (document.Form.dob_day.selectedIndex == 0)
  {
    alert("Please select Day of Birth.");
    Form.dob_day.focus();
    return (false);
  }

  if (document.Form.dob_month.selectedIndex == 0)
  {
    alert("Please select Month of Birth.");
    Form.dob_month.focus();
    return (false);
  }

  if (document.Form.dob_year.selectedIndex == 0)
  {
    alert("Please select Year of Birth.");
    Form.dob_year.focus();
    return (false);
  }

  if (document.Form.tob_hour.selectedIndex == 0)
  {
    alert("Please select Hour of birth.");
    Form.tob_hour.focus();
    return (false);
  }

  if (document.Form.tob_minute.selectedIndex == 0)
  {
    alert("Please select Minute or Birth.");
    Form.tob_minute.focus();
    return (false);
  }

  if (document.Form.tob_ampm.selectedIndex == 0)
  {
    alert("Please select one of the other options AM or PM.");
    Form.tob_ampm.focus();
    return (false);
  }
	else if (isblank(document.getElementById("placeofbirth").value))
	{
		alert("Please Enter Place or Birth!");
		document.getElementById("placeofbirth").focus();
		return false;
	}
	
	else if (isblank(document.getElementById("stateofbirth").value))
	{
		alert("Please Enter State or Birth");
		document.getElementById("stateofbirth").focus();
		return false;
	}else if (isblank(document.getElementById("countryofbirth").value))
	{
		alert("Please Enter Country or Birth!");
		document.getElementById("countryofbirth").focus();
		return false;
	}

	else if (isblank(document.getElementById("query").value))
	{
		alert("Pleasee enter your Question!");
		document.getElementById("query").focus();
		return false;
	}
	
	
	else if (document.Form.BotBootInput.value!=specimanSignature)
	{
		alert("Spam Validation Failed!");
		document.Form.BotBootInput.focus();
		newSpeciman();
		return false;
	}
	else
	{
		return true;
	}
}
function newSpeciman()
{
	specimanSignature = Math.ceil(Math.random() * 100000);
	document.getElementById('BotBootInputImage').innerHTML = specimanSignature;
}
