 
///// Main Function ///////////////////////////////////////////////////////////////

// This form validation is for pages accessable to 'trusted' people. Generally beyond a login screen.
function validatePage() {
  var pageIsValid = true;
   document.getElementById(errorBox).value = ""; // clear any previous errors. 
   
 // Make sure password, and confirm password match, otherwise send them back. jrs 03/20/06
 // if (document.form.Confirm.value != document.frmProfiles.Password.value){
//	alert( "Your passwords do NOT match, please make sure both the 'New Password' and the 'Confirm New Password' are the same.");
//	return (false);
//  }
 // Enforce only characters and numbers in loginname and password

   pageIsValid = validateForAcceptableFormat( "ownerName", 1, 50, "name" ) && pageIsValid;
   pageIsValid = validateForAcceptableFormat( "businessName", 1, 50, "name" ) && pageIsValid;
   pageIsValid = validateForAcceptableFormat( "businessAddress", 5, 50, "address" ) && pageIsValid;
   pageIsValid = validateForAcceptableFormat( "phone", 8, 14, "phone" ) && pageIsValid;
   pageIsValid = validateForAcceptableFormat( "fax", 0, 14, "optionalphone" ) && pageIsValid;
   pageIsValid = validateForAcceptableFormat( "email", 6, 50, "email" ) && pageIsValid;
   pageIsValid = validateForAcceptableFormat( "txtSubject", 5, 50, "text" ) && pageIsValid;
   pageIsValid = validateForAcceptableFormat( "txaBody", 5, 10000, "text" ) && pageIsValid;



  ////////////////////////////////////////////////// 
  // Finished with validation, either send 'em forward or send 'em back! 
  if (pageIsValid ) { 
 
    document.getElementById(errorBox+"Span").style.visibility = 'hidden';
    document.getElementById("frmProfilesID").submit(); 
    return (true); 
  } else { 
    alert( "Form could not be processed, please correct the errors found." ); 
	document.getElementById(errorBox+"Span").style.visibility = 'visible';
    return (false); 
  } 
  document.getElementById(errorBox+"Span").style.visibility = 'visible';
  return (false); 
} 





