 <!--
function frmContact_Validator(theForm)
{
 var alertsay = ""; 
  
 if (theForm.txtFirstName.value == "")
{
alert("Please enter your First Name.");
theForm.txtFirstName.focus();
return (false);
}

if (theForm.txtSurname.value == "")
{
alert("Please enter your Surname");
theForm.txtSurname.focus();
return (false);
}

if (theForm.txtCompanyName.value == "")
{
alert("Please enter the name of your company.");
theForm.txtCompanyName.focus();
return (false);
}


 if (theForm.txtAddress.value == "")
{
alert("Please enter your Address");
theForm.txtAddress.focus();
return (false);
}


 if (theForm.txtSuburb.value == "")
{
alert("Please enter your Suburb");
theForm.txtSuburb.focus();
return (false);
}


 if (theForm.txtPostCode.value == "")
{
alert("Please enter your Postcode.");
theForm.txtPostCode.focus();
return (false);
}


 if (theForm.cboCountry.value == "")
{
alert("Please select your country from the list provided.");
theForm.cboCountry.focus();
return (false);
}
 if (theForm.txtTelephone.value == "")
{
alert("Please enter your contact phone number.");
theForm.txtTelephone.focus();
return (false);
}

   
var checkOK = "0123456789";
var checkStr = theForm.txtTelephone.value;
var allValid = true;
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 += ch;
}
if (!allValid)
{
alert("Please enter only digit characters in the \"Telephone\" field.");
theForm.txtTelephone.focus();
return (false);
}
 
 if (theForm.txtEmail.value == "")
{
alert("Please enter your email address.");
theForm.txtEmail.focus();
return (false);
}
  
 // check if email field is blank
if (theForm.txtEmail.value == "")
{
alert("Please enter a valid email address");
theForm.txtEmail.focus();
return (false);
}
 // test if valid email address, must have @ and .
var checkEmail = "@.";
var checkStr = theForm.txtEmail.value;
var EmailValid = false;
var EmailAt = -1;
var EmailPeriod = -1;
for (i = 0;  i < checkStr.length;  i++)
{
	ch = checkStr.charAt(i);
	if (ch == "@")
		EmailAt = i;
	if (ch == ".") 
		EmailPeriod = i;
 }
	// if both the @ and . were in the string
if ((EmailAt > -1) && (EmailPeriod > -1) && (EmailAt < EmailPeriod))	EmailValid = true;

if (!EmailValid)
{
alert("The \"email\" field must contain an \"@\" and a \".\".");
theForm.txtEmail.focus();
return (false);
}


var checkOK = "0123456789";
var checkStr = theForm.txtPhone.value;
var allValid = true;
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 += ch;
}
if (!allValid)
{
alert("Please only use numbers and include the international dialing code i.e. 61282698500 for Australia. No spaces or symbols between numbers.");
theForm.txtPhone.focus();
return (false);
}

  return (true);
}
 
