/************************************************ Required field(s) validation v1.10- By NavSurf* Visit Nav Surf at http://navsurf.com* Visit http://www.dynamicdrive.com/ for full source code***********************************************/

function formValidate (formobj) {	// Enter name of mandatory fields	var fieldRequired = Array("contact-name", "telephone-number", "company-address", "postcode", "how-did-you-find-us", "security_code");	// Enter field description to appear in the dialog box	var fieldDescription = Array("Contact Name", "Telephone Number", "Company Address", "Post Code", "How did you find us?", "Security Code");	// dialog message	var alertMsg = "Please complete the following fields:\n";		var l_Msg = alertMsg.length;		for (var i = 0; i < fieldRequired.length; i++){		var obj = formobj.elements[fieldRequired[i]];		if (obj){			if (obj.type == null){				var blnchecked = false;				for (var j = 0; j < obj.length; j++){					if (obj[j].checked){						blnchecked = true;					}				}				if (!blnchecked){					alertMsg += " - " + fieldDescription[i] + "\n";				}				continue;			}			switch(obj.type){			case "select-one":				if (obj.selectedIndex == 0 || obj.options[obj.selectedIndex].text == ""){					alertMsg += " - " + fieldDescription[i] + "\n";				}

				// if the visitor has selected "Other..."
				if ((obj.name == "how-did-you-find-us" && obj.value == "other")){
					// ... and if the visitor hasn't entered something into the text field...
					if (formobj.elements['specify-where-you-found-us'].value == "" || formobj.elements['specify-where-you-found-us'].value == null){						alertMsg += " - " + fieldDescription[i] + " Please specify" + "\n";					}
				}
				break;			case "select-multiple":				if (obj.selectedIndex == -1){					alertMsg += " - " + fieldDescription[i] + "\n";				}				break;			case "text":			case "textarea":				if (obj.value == "" || obj.value == null){					alertMsg += " - " + fieldDescription[i] + "\n";				}				break;			default:			}		}	}	if (alertMsg.length == l_Msg){		return true;	}else{		alert(alertMsg);		return false;	}}