function isBlank(element)



{



 theElement = eval('document.mailForm.'+ element +'.value.length');



 if (theElement == 0) return 1;



 else return 0;



}







function isChecked(element)



{



 var theElement = eval('document.mailForm.'+ element);



 if (theElement.checked)  return 1;



 else return 0;



}







function checkNum(aNum)



{



theElement = eval('document.mailForm.' + aNum)



var num = parseInt(theElement.value);



if (isNaN(num)) return 1;



else return 0;



}







function replace()



{



location.replace('tester.html');



}







function validation()



{



errorMsg = 'Please complete/correct the following: \n\n'; 



 var proceed = 0;





 if (isBlank('telephone')) { errorMsg += 'telephone\n'; proceed = 1; }



 if (isBlank('email')) { errorMsg += 'email\n'; proceed = 1; }



 else if(document.mailForm.email.value.indexOf('@') == -1) { errorMsg += 'Incorrect Email address\n'; proceed = 1; }



 if (!isBlank('fax') && checkNum('fax'))



 { errorMsg += 'Incorrect Fax Number'; proceed = 1; }



 if (!isBlank('telephone') && checkNum('telephone'))



 { errorMsg += 'Incorrect Telephone Number'; proceed = 1; }



 if (proceed == 1) { alert(errorMsg); }



 else



 {



document.mailForm.submit();



  //setTimeout('replace()',5000);



  //location.replace('home.html')



 }







}
