function isEmailAddr (s){ 
	var rv = false
	if ((s == null) || (s.length == 0)){ 
       	rv = false;
 	}else{
		var reEmail =/([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/;
		//reEmail = /.+\@.+\..+$/
		
		rv = reEmail.test(s)
    }
	if(rv){
		return rv
	}else{
		return false
	}
}

function validateRadio(theRadio){
	// 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 < theRadio.length; counter++){
		// If a radio button has been selected it will return true
		// (If not it will return false)
		if (theRadio[counter].checked){
			radio_choice = true; 
			strRadioValue = theRadio[counter].value;
		}
	}
	if(!radio_choice){
		return (false);
	}
	    return (true);
}

function validateSelect(selectbox){
	var iSelect = selectbox.options[selectbox.selectedIndex].value ;
	if(iSelect == 0){
		return false;
	}else{
		return true;
	}
}

var strRadioValue;
function validation(theForm){
	if (theForm.name.value == ""){
    	alert("Please enter your name.");
    	theForm.name.focus();
    	return (false);
  	}
  	if (!isEmailAddr(theForm.email_from.value)){
    	alert("Please enter a complete email address in the form: yourname@yourdomain.com");
    	theForm.email_from.focus();
    	return (false);
 	}
	if (!validateSelect(theForm.type)){
    	alert("Please select an option.");
    	theForm.type.focus();
    	return (false);
 	}
	strRadioValue="";
	if (!validateRadio(theForm.choose_one)){
		alert("Please select an option."); 
		theForm.choose_one[0].focus();
		return false;
	}
	if(strRadioValue == "Other" && theForm.choose_one_other.value == ""){
    	alert("Please enter other option.");
    	theForm.choose_one_other.focus();
    	return (false);
	}
	return (true);
}

