// <%@ LANGUAGE=JSCRIpT%>
// <%

function validateRequiredValue(value, element, description) {
	if (value=="") {
		alert("No entry for required field - "+description);
		element.focus();
		return false;
	} else {
		return true;
	}
}

function validateRequiredTextVar(element, description) {

	return validateRequiredValue(element.value, element, description);
}

function validateRequiredSelectVarWithOther(selectelement, otherelement, otheroptiontext,description) {
	var value=selectelement.options[selectelement.selectedIndex].value;
	if (value==otheroptiontext) {
		value=otherelement.value;
		return validateRequiredValue(value, otherelement, description);
	} else {
		return validateRequiredValue(value, selectelement, description);
	}
	
 	
}
function validateRequiredSelectVar(element, description) {
	var value=selectelement.options[selectelement.selectedIndex].value;
	if (value==otheroptiontext) value=otherelement.text;
	
 	return validateRequiredValue(value, element, description);
}
function validateEmail(input){  
 var filter=/^.+@.+\..{2,3}$/

 if (filter.test(input))
    return true;
 else {    
    return false;
 }
}

function validateRequiredRadio(radio,errormessage){
// set var radio_choice to false
var radio_choice = false;
// Loop from zero to the one minus the number of radio button selections
for (counter = 0; counter < radio.length; counter++){
	// If a radio button has been selected it will return true
	// (If not it will return false)
	if (radio[counter].checked){
		radio_choice = true; 
	}
}
if (!radio_choice){
	// If there were no selections made display an alert box 
	alert(errormessage);	
	return (false);
}
return (true);
}
