//pop up submit script
function redirectOutput(myForm) {
var w = window.open('about:blank','Popup_Window','width=600,height=400,resizable=yes, scrollbars=yes');
myForm.target = 'Popup_Window';
return true;
}

//form validation script
function formValidator(thisform){
	// Make quick references to our fields
	var fname = document.getElementById('fname');
	var email = document.getElementById('email');
	
	// Check each input in the order that it appears in the form!
	if((isEmpty(fname, "Please fill in first name"))==false)
	{return false;}
	if((isEmpty(email, "Please fill in email"))==false)
	{return false;}
	if((emailValidator(email, "Please enter a valid email address"))==false)
	{return false;}
	
	//redirectOutput(thisform);
    //dismissbox();

}

function isEmpty(elem, helperMsg){
	if(elem.value.length == 0){
		alert(helperMsg);
		elem.focus(); // set the focus to this input
		return false;
	}
	else{return true;}
}

function emailValidator(elem, helperMsg){
	var emailExp = /^[\w\-\.\+]+\@[a-zA-Z0-9\.\-]+\.[a-zA-z0-9]{2,4}$/;
	if(elem.value.match(emailExp)){
		return true;
	}else{
		alert(helperMsg);
		elem.focus();
		return false;
	}
}