<!-- // engage cloaking device

var exclusions=['company','url','interested','comment','mobile']; // fields NOT to be validated

function validate(frmName){
	// RL 08/02/2002 for CharStar
	// Simple Form Validation
	var VALID = true;
	var strList = "";
	var frmEl = "";
	var nvc = 1;
	var excl = false;
	var IsGroup = false;
	var IsGroupChecked = false;
	/**
	* Scans through all the elements in the form. Checks to see whether the field is required
	* if required and empty then field is added to the error message at the end
	*/
	for(i = 0; i < frmName.length; i++){
		frmEl = frmName.elements[i];
		excl = false;
		// Check to see whether this is a required field
		for(j=0; j < exclusions.length; j++){if(frmEl.name == exclusions[j]){excl = true;}}
	
		// if the field is required (i.e. not excluded) then add its details to the message
		if(!excl){
			if(frmEl.value == ''){
				strList += "\n\t" + nvc++ + ". " + frmEl.name + "\n";
				VALID = false;
			}
		}
		
		// extra function for category checkbox chooser
		if(frmEl.name.indexOf('cat_')==0){
			IsGroup = true;
			if(frmEl.checked){ IsGroupChecked = true;}
		}
	}	
	if((IsGroup)&&(!IsGroupChecked)){
		strList += "\n\t" + nvc++ + ". Choose at least one Group";
		VALID = false;
	}

	// if the form has not been filled in correctly, display message and stop form submission
	if(!VALID){
		alert("Please fill in the required information listed below: \n" + strList);
	}
	// else just exit function naturally
	return VALID
}

function checkEmail(frmField){
	if((frmField.value != '')&&((frmField.value.indexOf('@') < 0) || (frmField.value.indexOf('.') < 0))){	
		frmField.select();
		frmField.focus();
		//alert("This email address is not correct. \n Please update it")
	}
}

function checkTel(frmField){
	// remove spaces and any other non-numeric characters
	frmField.value = frmField.value.replace(/[^0-9 ]/g,"");
}

// disengage -->