// JavaScript Document
//Validates the 3 submission forums
function validateEmail(field) {
	with (field){
		if (/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(value)){
			return (true)
		}
		return (false)
	}
}

function validate_required(field,alerttxt){
	with (field){
		if (value==null||value=="")
  			{if(alerttxt!=null){alert(alerttxt);}return false}
		else {return true}
	}
}
function validate_form(thisform){
	with (thisform){
		if (validateEmail(email)==false)
			{alert("Invalid E-mail Address. \nPlease enter a Valid Email Address.");email.focus();return false}	
		if (validate_required(interest,"Please tell us what your interest in us is.")==false)
			{interest.focus();return false}
		if (validate_required(hearAbout,"Please tell us how you found about us.")==false)
			{hearAbout.focus();return false}
	} 
}
function valNewProj(thisform) {
	with (thisform){
		if (validate_required(catSel,"Please select a project category.")==false)
			{catSel.focus();return false}
		re=/^[a-zA-Z_ 0-9]*$/;
		if(projectName.value==null || projectName.value=="") {
			alert("Please name this project.");
			projectName.focus();
			//catSel.selectedIndex=0;
			return false;
		}else if(!re.exec(projectName.value)) {
			alert("Only Alphanumeric characters or Underscore allowed");
			projectName.focus();
			//catSel.selectedIndex=0;
			return false;
		} else {return true;}
		
	}
} 
