function clickclear(thisfield, defaulttext) {
if (thisfield.value == defaulttext) {
thisfield.value ="";
}
}
function clickrecall(thisfield, defaulttext) {
if (thisfield.value == "") {
thisfield.value = defaulttext;
}
}

function isValidEmail(str) {

   return (str.indexOf("@") > 0);

}
function IsNumeric(sText)

{
   var ValidChars = "0123456789.";
   var IsNumber=true;
   var Char;

 
   for (i = 0; i < sText.length && IsNumber == true; i++) 
      { 
      Char = sText.charAt(i); 
      if (ValidChars.indexOf(Char) == -1) 
         {
         IsNumber = false;
         }
      }
   return IsNumber;
   
   }
function alltrim(str) 
{
                return str.replace(/^\s+|\s+$/g, '');
 }



function validContactForm()
{

if(alltrim(document.form1.phone.value) == "Phone*" )
	{
		alert("Please enter your phone number in full, including area code and no spaces.");
		document.form1.phone.focus();
		return false;
	}

if(alltrim(document.form1.phone.value) == "" )
	{
		alert("Please enter your phone number in full, including area code and no spaces.");
		document.form1.phone.focus();
		return false;
	}
	
if (!IsNumeric(document.form1.phone.value))
{

alert ("Please enter your phone number in full, including area code and no spaces.");
document.form1.phone.focus();
return false;
}
//alert(document.form1.phone.value.length);	 
if ((document.form1.phone.value.length < 8)) {
alert ("Phone no. should be minimum 8 characters.");
document.form1.phone.focus();
return false;
}



if (document.form1.email.value=="Email*")
{
alert ("please enter your email.")
document.form1.email.focus();
return false;
}



emailExp= /^\w+(\-\w+)*(\.\w+(\-\w+)*)*@\w+(\-\w+)*(\.\w+(\-\w+)*)+$/;
	 	 if (!(emailExp.test(document.form1.email.value)))
		{ 
			   alert("Invalid email address");
			   document.form1.email.focus();
			   return false;  
		} 
		
	
	
if (document.form1.suburb.value=="Suburb*")
{
alert ("please enter your suburb.")
document.form1.suburb.focus();
return false;
}
	
		







}


function validContactForm1()
{

if(alltrim(document.frm.phone1.value) == "Phone*" )
	{
		alert("Please enter your phone number in full, including area code and no spaces.");
		document.frm.phone1.focus();
		return false;
	}

if(alltrim(document.frm.phone1.value) == "" )
	{
		alert("Please enter your phone number in full, including area code and no spaces.");
		document.frm.phone1.focus();
		return false;
	}
	
if (!IsNumeric(document.frm.phone1.value))
{

alert ("Please enter your phone number in full, including area code and no spaces.");
document.frm.phone1.focus();
return false;
}
//alert(document.frm.phone.value.length);	 
if ((document.frm.phone1.value.length < 8)) {
alert ("Phone no. should be minimum 8 characters.");
document.frm.phone1.focus();
return false;
}



if (document.frm.email1.value=="Email*")
{
alert ("please enter your email.")
document.frm.email1.focus();
return false;
}



emailExp= /^\w+(\-\w+)*(\.\w+(\-\w+)*)*@\w+(\-\w+)*(\.\w+(\-\w+)*)+$/;
	 	 if (!(emailExp.test(document.frm.email1.value)))
		{ 
			   alert("Invalid email address");
			   document.frm.email1.focus();
			   return false;  
		} 





}
