// JavaScript Document


<!-- Begin -->
function checkevent(theForm){
		var f = document.eventorder;
		/*Billing Information Validation*/				
		if (f.fname.value==""){
			alert("You must enter your FIRST NAME");
			f.fname.focus();
			return false;
		}
		if (f.lname.value == ""){
			alert("You must enter your LAST NAME");
			f.lname.focus();
			return false;			
		}
		if (/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(f.email.value)){
		
		}else{
			alert("Invalid E-mail Address! Please re-enter.");
			f.email.focus();
			return false;
		}
		if (f.phone.value == ""){
			alert("You must enter your Phone Number");
			f.phone.focus();
            return false;
		}
		if(f.phone.value != ""){
			var ssth=f.BillPhone.value
			var matchArrth = ssth.match(/^(\d{3})-?\d{3}-?\d{4}$/);
			var numDashesth = ssth.split('-').length - 1 ;
			if (matchArrth == null || numDashesth == 1) {
			alert("Please enter your Telephone number in the following format: NNN-NNN-NNNN.");
			f.BillPhone.focus();
			return false;
			}
		}
		if (f.organization.value == ""){
			alert("Please enter the organization or affiliation.");
			f.organization.focus();
			return false;		
		}
		if (f.address.value == ""){
			alert("Please enter the Street Address.");
			f.address.focus();
			return false;		
		}
		if (f.city.value == ""){
			alert("Please enter the City.");
			f.city.focus();
			return false;		
		}
		if (f.state.value == ""){
			alert("Please enter the State");
			f.state.focus();
			return false;		
		}
		if (f.dateofengage.value == ""){
			alert ("Please enter the date you wish to schedule the event");
			f.dateofengage.focus();
			return false;		
		}
		if (f.eventoccur.value == ""){
			alert ("Please enter the venue you wish this event to occur");
			f.eventoccur.focus();
			return false;
		}
		if (f.attendance.value == ""){
			alert ("Please enter the expected number in attendance");
			f.attendance.focus();
			return false;
		}
		if (f.zipcode.value ==""){
			alert ("Please enter the zipcode.");
			f.zipcode.focus();
			return false;		
		}else{
				var field = f.zipcode.value;
				var valid = "0123456789-";
				var hyphencount = 0;
				
					if (field.length!=5 && field.length!=10) {
						alert("Please enter your 5 digit or 5 digit+4 zip code.");
						f.zipcode.focus();
						return false;
					}
				for (var i=0; i < field.length; i++) {
					temp = "" + field.substring(i, i+1);
					if (temp == "-") hyphencount++;
					if (valid.indexOf(temp) == "-1") {
						alert("Invalid characters in your zip code.  Please try again.");
						f.zipcode.focus();
						return false;
					}
					if ((hyphencount > 1) || ((field.length==10) && ""+field.charAt(5)!="-")) {
						alert("The hyphen character should be used with a properly formatted 5 digit+four zip code, like '12345-6789'.   Please try again.");
						f.zipcode.focus();
						return false;
				   }
				}
						
		}
	
}
