$(document).ready(function(){
	$("#content_sub").corner("15px");
	$(".callout").corner("15px");
   var path = location.pathname.substring(location.pathname.lastIndexOf("/"), location.pathname.length);
if ( path.length > 1 ) {
     $('#content_sub .sub_nav a[@href$="' + path + '"]').attr('class', 'selected');
	 } else if ( path == "/" ) {
     $('#content_sub .sub_nav a[@href$="index.php"]').attr('class', 'selected');
	 }
 });

function Form_Validator(theForm) {
	var emailOK;

	if (theForm.first_name.value == ""){
		alert("Please enter your first name.");
		theForm.first_name.focus();
		return false;
	}	
	if (theForm.last_name.value == ""){
		alert("Please enter your last name.");
		theForm.last_name.focus();
		return false;
	}
	if (theForm.title.value == ""){
		alert("Please enter your title.");
		theForm.title.focus();
		return false;
	}
	if (theForm.company.value == ""){
		alert("Please enter your company name.");
		theForm.company.focus();
		return false;
	}
	if (theForm.email.value == ""){
		alert("Please enter your email address.");
		theForm.email.focus();
        	return false;
  	}
	if (theForm.phone.value == ""){
		alert("Please enter your business phone number.");
		theForm.phone.focus();
		return false;
	}
	if (theForm.etailing_group_White_Paper) {
		if (!(theForm.etailing_group_White_Paper.checked) && !(theForm.Commerce_Consortium_White_Paper.checked)) {
			alert("Please indicate which White Paper(s) you would like to receive.");
			return false;
		}
	}

	emailOK = validemail(theForm.email.value, theForm);
  
	if (!emailOK)
	{
		return (false);
	}

return (true);
}

function validemail(emailaddress, theForm)
{
// this function checks the email address against the array of domains
//   1. change "strErrorMsg" to suit your needs
//   2. add domains to the aDomains array

var strErrorMsg = "Please provide a valid corporate email address (no Hotmail, Yahoo! Mail, Gmail, AOL or competitor's addresses)."; 
var emailDomain; var nStart;

// create array of email domains to check
var aDomains = new Array(9); // change this to match the length of your list
// add your list below
aDomains[0] = "yahoo.com";
aDomains[1] = "hotmail.com";
aDomains[2] = "gmail.com";
aDomains[3] = "aol.com";
aDomains[4] = "baynote.com";
aDomains[5] = "coremetrics.com";
aDomains[6] = "certona.com";
aDomains[7] = "aggregateknowledge.com";
aDomains[8] = "proclivitysystems.com";

// loop thru domains, if a match is found, display error and return
for(i=0; i<aDomains.length; i++){
	nStart = emailaddress.indexOf("@");
	if(nStart == -1){
		alert(strErrorMsg);
		theForm.email.focus();
		return (false);
	}		
	nStart++;
	emailDomain = emailaddress.substr(nStart);
	if(emailDomain == aDomains[i]){
		alert(strErrorMsg);
		theForm.email.focus();
		return (false);
	}
}
return (true);
}

