// JavaScript Document


function checkForm(theForm){

	
	var domain = "www.nasep.org";
	var appPath = "/venue/Submission";
			
			
	if(theForm.venue.value == ""){
		alert('Please enter your venue\'s name.');
		theForm.venue.focus();
		return false;
	}
	
	if(theForm.name.value == ""){
		alert('Please enter your name.');
		theForm.name.focus();
		return false;
	}
	
	if(theForm.phone.value == ""){
		alert('Please enter your phone number.');
		theForm.phone.focus();
		return false;
	}
	
	if(theForm.website.value == ""){
		alert('Please enter your website address.');
		theForm.venue.focus();
		return false;
	}
	
	if(theForm.email.value == ""){
		alert('Please enter your email address.');
		theForm.email.focus();
		return false;
		
	} else {
		
		var filter=/^([\w-]+(?:\.[\w-]+)*)@((?:[\w-]+\.)*\w[\w-]{0,66})\.([a-z]{2,6}(?:\.[a-z]{2})?)$/i
		var str=theForm.email.value.trim();
		if(!filter.test(str)){
			alert('Please check you email address');
			theForm.email.focus();
			return false;
		}
	}
	
	if(theForm.address.value == ""){
		alert('Please enter your mailing address so we can send you checks.');
		theForm.address.focus();
		return false;
	}
	
	theForm.action = 'http://' + domain + appPath;
	theForm.submit();
	return true;

}

String.prototype.trim = function() { return this.replace(/^\s+|\s+$/g, ""); };