<!-- for msn vanderbilt

function FrontPage_Form1_Validator(theForm){

// Canada duplication quick fix
if(theForm.Country.value == "Canada" && theForm.Country.selectedIndex > 5){
	theForm.Country.selectedIndex = 2;
	prepareForm();
}

var postalcode = theForm.Postal_Code1.value;
var postalcode2 = theForm.Postal_Code2.value;

  if (theForm.Title.selectedIndex == 0){
    alert("Please select your Title.");
    theForm.Title.focus();
    return (false);
  }
  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.Highest_Degree_Earned.selectedIndex == 0){
    alert("Please select your Highest_Degree_Earned.");
    theForm.Highest_Degree_Earned.focus();
    return (false);
  }
  if (theForm.Specialization.selectedIndex == 0){
    alert("Please select your Specializaton.");
    theForm.Specialization.focus();
    return (false);
  }
  if (theForm.Country.selectedIndex == 0){
    alert("Please select your Country.");
    theForm.Country.focus();
    return (false);
  }

// ***** US VALIDATION *****
if (theForm.Country.value == "United States"){
	if (theForm.us_State.selectedIndex == 0){
    	alert("Please select your State.");
    	theForm.us_State.focus();
    	return (false);
  	}
	if (theForm.Zip1.value == ""){
    	alert("Please enter your Zip Code.");
		theForm.Zip1.focus();
    	return (false);
	}
}

// ***** CANADA VALIDATION *****
if (theForm.Country.value == "Canada"){
	if (theForm.Province.value == "none"){
    	alert("Please select your Province.");
    	theForm.Province.focus();
    	return (false);
  	}
	if (theForm.Postal_Code1.value == ""  || theForm.Postal_Code2.value == ""){
    	alert("Please enter your Postal Code.");
    	theForm.Postal_Code1.focus();
    	return (false);
  	}
	if (postalcode.search(/^[a-zA-Z]\d[a-zA-Z]$/) == -1 || postalcode2.search(/^\d[a-zA-Z]\d$/) == -1){
	  	alert("This is not a valid Postal Code.  Please try again.");
		theForm.Postal_Code1.focus();
		return false;
	}
}

// ***** address and city *****
  if (theForm.Address.value == ""){
    alert("Please enter your Address.");
    theForm.Address.focus();
    return (false);
  }
  if (theForm.City.value == ""){
    alert("Please enter your City.");
    theForm.City.focus();
    return (false);
  }

// ***** DAYTIME PHONE VALIDATION *****
if (theForm.Country.value == "Canada"){
	if (theForm.Can_Primary_Phone_1.value == "" || theForm.Can_Primary_Phone_2.value == "" || theForm.Can_Primary_Phone_3.value == ""){
  		alert("Please enter a value for the Work Phone field.");
		theForm.Can_Primary_Phone_1.focus();
  		return (false);
	}
	if (theForm.Can_Primary_Phone_1.value.length < 3){
  		alert("You Phone Number appears to be missing one or more digits.  Please complete the number and try again.");
		theForm.Can_Primary_Phone_1.focus();
  		return (false);
	}
	if (theForm.Can_Primary_Phone_2.value.length < 3){
  		alert("You Phone Number appears to be missing one or more digits.  Please complete the number and try again.");
		theForm.Can_Primary_Phone_2.focus();
  		return (false);
	}
	if (theForm.Can_Primary_Phone_3.value.length < 4){
  		alert("You Phone Number appears to be missing one or more digits.  Please complete the number and try again.");
		theForm.Can_Primary_Phone_3.focus();
  		return (false);
	}
}else if (theForm.Country.value == "United States"){
	if (theForm.us_Primary_Phone_1.value == "" || theForm.us_Primary_Phone_2.value == "" || theForm.us_Primary_Phone_3.value == ""){
  		alert("Please enter a value for the Work Phone field.");
		theForm.us_Primary_Phone_1.focus();
  		return (false);
	}
	if (theForm.us_Primary_Phone_1.value.length < 3){
  		alert("You Phone appears to be missing one or more digits.  Please complete the number and try again.");
		theForm.us_Primary_Phone_1.focus();
  		return (false);
	}
	if (theForm.us_Primary_Phone_2.value.length < 3){
  		alert("You Phone Number appears to be missing one or more digits.  Please complete the number and try again.");
		theForm.us_Primary_Phone_2.focus();
  		return (false);
	}
	if (theForm.us_Primary_Phone_3.value.length < 4){
  		alert("You Phone Number appears to be missing one or more digits.  Please complete the number and try again.");
		theForm.us_Primary_Phone_3.focus();
  		return (false);
	}
}else{
	if (theForm.Int_Primary_Phone.value == ""){
  		alert("Please enter a value for the Work Phone field.");
		theForm.Int_Primary_Phone.focus();
  		return (false);
	}
}

// ***** EVENING PHONE VALIDATION *****
if (theForm.Country.value == "Canada"){
	if (theForm.Can_Primary_Phone_1.value == "" || theForm.Can_Primary_Phone_2.value == "" || theForm.Can_Primary_Phone_3.value == ""){
  		alert("Please enter a value for the Primary Phone field.");
		theForm.Can_Primary_Phone_1.focus();
  		return (false);
	}
}else if (theForm.Country.value == "United States"){
	if (theForm.us_Primary_Phone_1.value == "" || theForm.us_Primary_Phone_2.value == "" || theForm.us_Primary_Phone_3.value == ""){
  		alert("Please enter a value for the Primary Phone field.");
		theForm.us_Primary_Phone_1.focus();
  		return (false);
	}
}else{
	if (theForm.Int_Primary_Phone.value == ""){
  		alert("Please enter a value for the Primary Phone field.");
		theForm.Int_Primary_Phone.focus();
  		return (false);
	}
}

//   SET VALUE OF HIDDEN FIELDS 
  if (theForm.Country.value == "Canada"){
	theForm.Region.value = "Canada";
	
	// This is the Canadian Work phone section.  The resulting value is Primary_Phone
	theForm.Primary_Phone.value = theForm.Can_Primary_Phone_1.value + theForm.Can_Primary_Phone_2.value + theForm.Can_Primary_Phone_3.value;
	// This is the Work Phone's extension.  The resulting value is Extension	
	theForm.Extension.value = theForm.Can_Primary_Ext.value;
	
	//This is the Canadian Home phone section.  The resulting value passes as Secondary_Phone
	theForm.Secondary_Phone.value = theForm.Can_Secondary_Phone_1.value + theForm.Can_Secondary_Phone_2.value + theForm.Can_Secondary_Phone_3.value;
	//theForm.Extension_2.value = theForm.Can_Secondary_Ext.value;
	
	//This is the Canadian Cellphone section.  The resulting value passes as cellphone
	theForm.Cell_Phone.value = theForm.can_cell_1.value + theForm.can_cell_1.value + theForm.can_cell_3.value;
	
	theForm.Zip.value = theForm.Postal_Code1.value + theForm.Postal_Code2.value;
	
	theForm.State.value = theForm.Province.value;
}else if (theForm.Country.value == "United States"){
	theForm.Region.value = "United States";

	// This is the USA Work phone section.  The resulting value is Primary_Phone
	theForm.Primary_Phone.value = theForm.us_Primary_Phone_1.value + theForm.us_Primary_Phone_2.value + theForm.us_Primary_Phone_3.value;
	// This is the USA Work Phone's extension.  The resulting value is Extension
	theForm.Extension.value = theForm.us_Primary_Ext.value;
	//This is the USA Home phone section.  The resulting value passes as Secondary_Phone
	theForm.Secondary_Phone.value = theForm.us_Secondary_Phone_1.value + theForm.us_Secondary_Phone_2.value + theForm.us_Secondary_Phone_3.value;
	//theForm.Extension_2.value = theForm.us_Secondary_Ext.value;

	//This is the USA Cellphone section.  The resulting value passes as cellphone
	theForm.Cell_Phone.value = theForm.us_cell_1.value + theForm.us_cell_2.value + theForm.us_cell_3.value;

	theForm.Zip.value = theForm.Zip1.value + theForm.Zip2.value;

	theForm.State.value = theForm.us_State.value;
}else{
	theForm.Region.value = "International";
	// This is the International Work phone section.  The resulting value is Primary_Phone
	theForm.Primary_Phone.value = theForm.Int_Primary_Phone.value;
	// This is the International Work Phone's extension.  The resulting value is Extension
	theForm.Secondary_Phone.value = theForm.Int_Secondary_phone.value;
	//This is the International Cellphone section.  The resulting value passes as cellphone
	theForm.Cell_Phone.value = theForm.Int_Cellular_phone.value;
	theForm.State.value = " ";
}

// check e-mail
  if (theForm.Email.value == ""){
    alert("Please enter a value for the Email field.");
    theForm.Email.focus();
    return (false);
  }else{
	var emailfilter = /^\w+[\+\.\w-]*@([\w-]+\.)*\w+[\w-]*\.([a-z]{2,4}|\d+)$/i;
	var returnval = emailfilter.test(theForm.Email.value);

	if (returnval == false){
		alert("Please enter a valid Email address.");
		theForm.Email.focus();
		return false;
	}
  }

  return (true);

}


function numbersonly(myfield, e, dec){
var key;
var keychar;
if (window.event)
 key = window.event.keyCode;
else if (e)
 key = e.which;
else
 return true;
keychar = String.fromCharCode(key);
if ((key==null) || (key==0) || (key==8) || 
 (key==9) || (key==13) || (key==27) )
 return true;
else if ((("0123456789").indexOf(keychar) > -1))
 return true;
else if (dec && (keychar == "."))
 {
 myfield.form.elements[dec].focus();
 return false;
 }
else
 return false;
}

function chgSpc(spc){
		var temp1 = document.forms[0].Access_Code.value.split("-");
	if(spc.value == "Healthcare"){
		temp1[1] = "HCMBA";
		document.forms[0].action.value = "http://ekgleads.embanet.com/ekg/neu/hcmba/confirm.pl";
	}else{
		temp1[1] = "MBA";
		document.forms[0].action.value = "http://ekgleads.embanet.com/ekg/neu/mba/confirm.pl";
	}

	var newAC = temp1.join("-");
	document.forms[0].Access_Code.value = newAC;

//end
}
