function sendForm(nameOfForm) {

//-->> Do not forget to set up the following CSS styles <<---
// --> 1) #warningText	{ color: red; font-size: 14px; font-family: Arial, Helvetica, Geneva, Swiss, SunSans-Regular; margin-top: 8px; display: none }
// --> 2) .formText		{ color: #797979; font-weight: bold; font-size: 11px; font-family: Arial, Helvetica, Geneva, Swiss, SunSans-Regular }
// --> 3) .FormTextFail	{ color: red; font-weight: bold; font-size: 11px; font-family: Arial, Helvetica, Geneva, Swiss, SunSans-Regular }


//Set all variables--------
send = "yes"
formList = ""
x = 0
formElementName = ""
emailError = "no"
filter = /^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/
FormNameUsed = nameOfForm
tempRadioName = ""
//-------------------------

// Check all elements

while (x < document.forms[FormNameUsed].elements.length) {
	 
	formElementName = document.forms[FormNameUsed].elements[x].name + "C"  // Needed to fix crappy IE
	formElementNameR = document.forms[FormNameUsed].elements[x].name       // Holds the original name of field
	formElementValue = document.forms[FormNameUsed].elements[x].value	   // Holds the value of the field	
	formElementType = document.forms[FormNameUsed].elements[x].type		   // Holds the element type

	if (formElementNameR != tempRadioName) {
		emailError = "no" }
              
    // Lets change the colour on blank fields    
    if (document.getElementById(formElementName)) {
        
        // Check to see if a tick box needs checking
        if (formElementType == "checkbox") {
        
        	toCheck = eval("document.forms[FormNameUsed]."+formElementNameR+".checked")
        	
        	if (toCheck) {
						emailError = "no"   }  // Passed
					else {
						emailError = "yes"  } // Error
						        
			} // verification complete
        
    
		// Check to see if it's a radio button AND that it has not yet been checked
		if (formElementType == "radio" && formElementNameR != tempRadioName) {	
														
			fieldLength = eval("document.forms[FormNameUsed]."+formElementNameR+".length")	
			
			for (var i=0; i< fieldLength ; i++) {

				toCheck = eval("document.forms[FormNameUsed]."+formElementNameR+"[i].checked")
				
					if (toCheck) {
						emailError = "no" 
						break				}  // Passed
					else {
						emailError = "yes"  } // Error
						
						}
						
					tempRadioName = formElementNameR // Store the radio group name to prevent re-checking
			} // verification complete
				
    
		//Check to see if an email address needs verifying
		if (formElementName.match("email")) {
    	
    		// We have got an email to verify		
			str = eval("document.forms[FormNameUsed]."+formElementNameR+".value")
												
			if (filter.test(str)){
				emailError = "no" }  // Passed
			else {
				emailError = "yes" } // Error
    		} // verification complete
    		
    		    		
		//Check to see if field should be numeric
		if (formElementName.match("num")) {
    	    	
    		// We have got mumeric field to verify		
			valueToCheck = eval("document.forms[FormNameUsed]."+formElementNameR+".value")
			
			if (isNaN(valueToCheck)){
				emailError = "yes" }  // Error
    		} // verification complete
    		
    	
    	//Check to see if passwords should match
		if (formElementName.match("pswd")) {
    	    	    	    
    		// We have got a password field to verify		
			valueToCheck = eval("document.forms[FormNameUsed]."+formElementNameR+".value")
			valueToCheck2 = eval("document.forms[FormNameUsed].pswd2.value")
						
			if (valueToCheck != valueToCheck2){
				emailError = "yes" }  // Error
    		} // verification complete


    	// Check for uncompleted fields
    		if (document.forms[FormNameUsed].elements[x].value == "" || emailError == "yes") {
    		
    			// means the field has failed and the colour set to error
    			document.getElementById(formElementName).className = "FormTextFail"
    			document.forms[FormNameUsed].elements[x].className = "formTextInputFail"
    			
    			
    			// --> ONLY USE IF YOU WANT THE FIELD NAME TO SHOW IN THE FIELD -->  document.getElementById(formElementName).value = formElementNameR
    			send = "no"
    				}
    		else {
    			// means the field has passed so set the colour to normal
    			document.getElementById(formElementName).className = "FormText"
    			document.forms[FormNameUsed].elements[x].className = "formTextInput"
    		}
		}
	x ++   // Get the next form element  
	}
   
// Send the form if it has passed OR display error if it hasn't
if (send=="no") {
document.getElementById('warningText').style.display="block"
return false  // form failed

}

if (send == "yes") {
return true  // form sent

}
}
