// Javascript by Alexander Nietzen M... alex@webeditors.com
// Open Source

// validate the form area to make sure that they fill out all fields.
function VALIDATE_FORM_FIELDS() {
// Check for Required Fields

//make sure first name is more then just a space
if (document.validate.first_name.value.replace(/ /g,"") == "") {
        alert("Required information is missing \n Please enter your first name");
        document.validate.first_name.focus();
        return false;
}


else if (document.validate.last_name.value.replace(/ /g,"") == "") {
        alert("Required information is missing \n Please enter your last name");
        document.validate.last_name.focus();
        return false;
}


else if (document.validate.org.value.replace(/ /g,"") == "") {
        alert("Required information is missing \n Please enter your organization");
        document.validate.org.focus();
        return false;
}


else if (document.validate.state.value.replace(/ /g,"") == "") {
        alert("Required information is missing \n Please enter your state");
        document.validate.state.focus();
        return false;
}


else if (document.validate.title.value.replace(/ /g,"") == "") {
        alert("Required information is missing \n Please enter your title");
        document.validate.title.focus();
        return false;
}


else if (document.validate.email.value.replace(/ /g,"") == "") {
        alert("Required information is missing \n Please enter your email address");
        document.validate.email.focus();
        return false;
}


//check to make sure they selected a radio
//else if (document.validate.payment[0].checked == false && document.validate.payment[1].checked == false && document.validate.payment[2].checked == false && document.validate.payment[3].checked == false) {
//    alert(" Error: \n You didn't select a Payment Type\n Please select one");
//    document.validate.payment[0].focus();
//	if (window.scrollBy) window.scrollBy(0,-30);
//    return false;
//}

// lets define the valid e-mail address
    var email_pattern = /^[\w\-_\.]+@[\w\-\.]+\.[a-z]{2,7}$/i;
// checks for a word charachter or '-' one or more times followed by an '@' followed by [a-z] [A-Z] or [0-9] or '-' one or more times followed by a "." followed by a word character or "." one for more times.
    var email_result;
    email_result = email_pattern.exec(document.validate.email.value);
if (email_result) {
         // good to go!
         }
         else  {
         alert("Bad e-mail address! \n   Please try again.");
            document.validate.email.focus();
            return false;
      }

	  
	return true;
	


}//close function
// WWW: http://www.mattkruse.com/
// Function to auto-tab phone field
// -------------------------------------------------------------------
//alert(document.validate.);

//-->


