
function formCheck(formName){
  ValidOk = true;
  var count = 0;
  while(count < formName.elements.length){
    var fieldType = formName.elements[count].type;
    var theFieldName = formName.elements[count].name;
    var fieldName = formName.elements[formName.elements[count].name];
	switch(fieldType){
	  case 'text':
	    if(theFieldName == 'txtFirstName')
		  strCheck(fieldName,1,'First Name');
		if(theFieldName == 'txtLastName')
		  strCheck(fieldName,1,'Last Name');
		if(theFieldName == 'txtCompanyName')
		  strCheck(fieldName,1,'Company Name');
		if(theFieldName == 'txtAddress1')
		  strCheck(fieldName,1,'Address');
		if(theFieldName == 'txtSuburb')
		  strCheck(fieldName,1,'Suburb');
		if(theFieldName == 'txtState')
		  strCheck(fieldName,1,'State');
		if(theFieldName == 'txtCountry')
		  strCheck(fieldName,1,'Country');
		if(theFieldName == 'txtPostcode')
		   strCheckEmpty(fieldName,1,'postcode');
		if(theFieldName == 'txtPhoneNumber')
		  strCheckEmpty(fieldName,1,'phone number');
		if(theFieldName == 'txtEmail')
		  emailCheck(fieldName,'valid Email address');
		if(theFieldName == 'txtWhereHeard')
		  strCheck(fieldName,1,'Please enter Where did you hear about us');
	  break;
	}
	if(ValidOk == false){
	  break;
	}
	count++;
  }
  if (ValidOk == true){
    return true;
  }else{
  	return false;
  }
}
