
<!-- 
// isEmail (STRING s [, BOOLEAN emptyOK])
// whitespace characters
var whitespace = " \t\n\r";
// 
// Email address must be of form a@b.c ... in other words:
// * there must be at least one character before the @
// * there must be at least one character before and after the .
// * the characters @ and . are both required
function isValidEmail(s)
{   
if (isEmpty(s)) return false;
// is s whitespace?
if (isWhitespace(s)) return false;
// there must be >= 1 character before @, so we
// start looking at character position 1 
// (i.e. second character)
var i = 1;
var sLength = s.length;
// look for @
while ((i < sLength) && (s.charAt(i) != "@"))
{ i++
}
if ((i >= sLength) || (s.charAt(i) != "@")) return false;
else i += 2;
// look for .
while ((i < sLength) && (s.charAt(i) != "."))
{ i++
}
// there must be at least one character after the .
if ((i >= sLength - 1) || (s.charAt(i) != ".")) return false;
else return true;
}
// Check whether string s is empty.
function isEmpty(s)
{   
return ((s == null) || (s.length == 0))
}
// Returns true if string s is empty or 
// whitespace characters only.
function isWhitespace(s)
{   
var i;
// Is s empty?
if (isEmpty(s)) return true;
// Search through string's characters one by one
// until we find a non-whitespace character.
// When we do, return false; if we don't, return true.
for (i = 0; i < s.length; i++)
{   
// Check that current character isn't whitespace.
var c = s.charAt(i);
if (whitespace.indexOf(c) == -1) return false;
}
// All characters are whitespace.
return true;
}

function checkForm()

{ 

if (!isValidEmail(document.subscribeForm.elements['email'].value)) {
document.subscribeForm.elements['email'].style.backgroundColor='yellow';
alert("Please enter a contact email address e.g. (name@host.com)");
document.subscribeForm.elements['email'].focus();
return false;}

if(document.subscribeForm.elements['first_name'].value == 0){
document.subscribeForm.elements['first_name'].style.backgroundColor='yellow';
alert("Please enter your first name");
return false;
document.first_name.elements['first_name'].focus();
}else {
document.subscribeForm.elements['first_name'].style.backgroundColor='white';
}

if(document.subscribeForm.elements['last_name'].value == 0){
document.subscribeForm.elements['last_name'].style.backgroundColor='yellow';
alert("Please enter your last name");
return false;
document.first_name.elements['last_name'].focus();
}else {
document.subscribeForm.elements['last_name'].style.backgroundColor='white';
}



if(document.subscribeForm.elements['company'].value == 0){
document.subscribeForm.elements['company'].style.backgroundColor='yellow';
alert("Please enter your company's name");
return false;
document.first_name.elements['company'].focus();
}else {
document.subscribeForm.elements['company'].style.backgroundColor='white';
}

if(document.subscribeForm.elements['phone'].value == 0){
document.subscribeForm.elements['phone'].style.backgroundColor='yellow';
alert("Please enter a contact number");
return false;
document.first_name.elements['phone'].focus();
}else {
document.subscribeForm.elements['phone'].style.backgroundColor='white';
}

if(document.subscribeForm.elements['zip'].value == 0){
document.subscribeForm.elements['zip'].style.backgroundColor='yellow';
alert("Please enter the postcode of the suburb where your business is located");
return false;
document.first_name.elements['zip'].focus();
}else {
document.subscribeForm.elements['zip'].style.backgroundColor='white';
}

if(document.subscribeForm.elements['state'].value == 0){
document.subscribeForm.elements['state'].style.backgroundColor='yellow';
alert("Please choose the state where your business is located");
return false;
document.first_name.elements['state'].focus();
}else {
document.subscribeForm.elements['state'].style.backgroundColor='white';
}

if(document.subscribeForm.elements['title'].value == 0){
document.subscribeForm.elements['title'].style.backgroundColor='yellow';
alert("What position do you currently hold in your business?");
return false;
document.first_name.elements['title'].focus();
}else {
document.subscribeForm.elements['title'].style.backgroundColor='white';
}

if(document.subscribeForm.elements['description'].value == 0){
document.subscribeForm.elements['description'].style.backgroundColor='yellow';
alert("Please type in your enquiry");
return false;
document.first_name.elements['description'].focus();
}else {
document.subscribeForm.elements['description'].style.backgroundColor='white';
}

}
//--> 