 /* Function: clearDefaults(fieldName) 	Author: John Weber		fieldName - this is the field that you will be clearing.  Recommended usage: onfocus="clearDefaults(this.id);"  		This funtion will clear a field when a user interacts with it, only if "[" is the first character.	This should prevent the field from reclearing if they would like to edit it. */ var globalTempValue = ""; var globalTempID = ""; function clearDefaults(fieldName){   var re = /^[\[]/;    // for the onblur action, if the field is empty.  if(document.getElementById(fieldName).value == '' && document.getElementById(fieldName).id == globalTempID && globalTempValue.match(re)){   document.getElementById(fieldName).value = globalTempValue;    // for the onfocus action.  } else {   globalTempValue = document.getElementById(fieldName).value;   globalTempID = document.getElementById(fieldName).id;      if((document.getElementById(fieldName).value.match(re)))     document.getElementById(fieldName).value = "";  } }  /* Function: checkForm(formName) 	Author: John Weber		formName - this is the name of the form you are checking, I would recommend using:  onsubmit="return checkForm(this.id);" 		This function will only reject fields that have an * remaining as the last character.	It also will reject incorrect emails in input fields with "Email" in their name (that are required).	It WILL NOT reject blank fields, I would recommend putting CF Validation on process page for this feature. */  function checkForm(formName){  // Set the form name  theForm = eval("document.forms['" + formName + "']");     // Loop through all form elements   for(i=0; i<theForm.elements.length; i++){      	  // Validate pertaining to Text and Textarea fields only	  if(theForm.elements[i].type == "text" || theForm.elements[i].type == "textarea"){       	   //If the field has a * at the end, tell the user to fill it out	   re = /\*$/	   if(theForm.elements[i].value.match(re)) {	  	alert("Please fill in the " + theForm.elements[i].id.replace("form","").replace("_"," ") + " field.");		return false;		}			   //If the field has an "Email" in the id, make sure they have a correct email address	   re = /^[\w-\.]+@([\w-]+\.)+[\w-]{2,4}$/	   if(theForm.elements[i].id.search("Email") > 0) {	  	if(!theForm.elements[i].value.match(re)){		 alert("Please enter in a valid Email.");		 return false;		}	   }      }   }   return 1; }