// JavaScript Document

// Form Validation

// counter
var i = 0;
// return value
var success = true;
// list of competitor domain names
var badDomains = Array();
badDomains[0] = "secova.com";
badDomains[1] = "hotmail.com";
badDomains[2] = "yahoo.com";
badDomains[3] = "att.net";
badDomains[4] = "comcast.com";
badDomains[5] = "gmail.com";
badDomains[6] = "consova.com";
badDomains[7] = "verifysolutions.com";
badDomains[8] = "budco.com";
badDomains[9] = "budcohealthcareservices.com";
badDomains[10] = "aetna.com";
badDomains[11] = "adp.com";
badDomains[12] = "buckconsultants.com";
badDomains[13] = "acs-inc.com";
badDomains[14] = "impact-interactive.com";
badDomains[15] = "chapmankelly.com";
badDomains[16] = "bmiaudit.com";
badDomains[17] = "healthaudit.com";
badDomains[18] = "hdminc.com";
badDomains[19] = "benefitexpress.info";
badDomains[20] = "mercer.com";
badDomains[21] = "aon.com";
badDomains[21] = "itlldogolf.com";
badDomains[22] = "comcast.net";
function fcnValidateForm() {

// the form
var f=document.forms[0];

// for all the form controls
for ( i=0; i<f.elements.length; i++ ) {
	// set the border to normal
	f.elements[i].style.border="1px solid #999999";
}

// for all the form controls
for ( i=0; i<f.elements.length; i++ ) {
	// if the field is empty and it is not a hidden field
	if (( f.elements[i].value == "" ) && (f.elements[i].type != "hidden")){
		// highlight it and return false and exit
		f.elements[i].style.border="1px solid red";
		return false;
	}
}

// ok, so far we know all the fields are filled in, but we need to check the email
var email = f.email.value;
var emailSplit = email.split('@');
// emailSplit should split into exactly two parts, if not, it's invalid
if (emailSplit.length != 2) {
	// not a valid email
	f.email.style.border="1px solid red";
	return false;
} else {
	// check for bad domains
	for ( i=0; i<badDomains.length; i++ ) {
		if (emailSplit[1].toLowerCase()==badDomains[i]) {
			// bad domain, don't submit
			alert("We could not register you at this time.  For immediate assistance please contact us at 214.965.5809.  Thank-you and all the best.");
			return false;
		}
	}
}
// alert("data successfully validates");
// return true;
f.submit();
document.forms[0].submit();
}