//**************************************************
// postProcess.js 
//
// last modified 20060505 by karen clement:
// -removed personal and competitor email filters
// -archived as postprocess-20060417-withfilters.js
//
//**************************************************




//**************************************************
// postProcess() - validate, store data in hidden fields
//**************************************************
function postProcess()
{
	
	var debug = false;
	if(debug) alert("postprocess.js\nDebug mode on");

	
	if(debug) alert("postProcess()");
	
//**************************************************
// Data validation / error checking
//**************************************************

	//country validation
	if(debug) alert("postProcess() - Country validation");	
	fieldCountry = document._mktf.M1_Country
	CountryStr = trim(fieldCountry.value);         

	if ((CountryStr == "-") || (CountryStr == ""))
	{
		fieldCountry.focus();
		alert("Country is a required field. Please enter a value.");
		return false;
	}
	

//**************************************************
// Extra email validation
//**************************************************
	
	//is it hidden? then the user can't change it anyway so don't bother running this check
	if(debug) alert("document._mktf.PRIMARY_EMAIL_ADDR.value = " + document._mktf.PRIMARY_EMAIL_ADDR.value);	
	if(debug) alert("document._mktf.PRIMARY_EMAIL_ADDR.type = " + document._mktf.PRIMARY_EMAIL_ADDR.type);
	if(document._mktf.PRIMARY_EMAIL_ADDR.type != "hidden")
	{
		//Added extra validation for an email that is missing periods
		//Modified November 21, 2005 by Karen Clement
		if(debug) alert("postProcess() - Email validation for periods");		
			
		if (!extraEmailValidation(document._mktf.PRIMARY_EMAIL_ADDR.value))
		{
			alert("Error: Invalid email address. Please type a valid email address for field \"Email Address\".");
			document._mktf.PRIMARY_EMAIL_ADDR.focus();	//set focus to email field
			document._mktf.PRIMARY_EMAIL_ADDR.value = "";	//clear email field
			return false;
		}

	} //End of email validation
	
	
//**************************************************
// Store data in hidden fields
//**************************************************

	if(debug) alert("postProcess() - Store data in hidden fields");	
	
	//Store country in hidden field
	document._mktf.COUNTRY.value = document._mktf.M1_Country.options[document._mktf.M1_Country.options.selectedIndex].value;
	if(debug) alert("document._mktf.COUNTRY.value = " + document._mktf.COUNTRY.value);

	if(debug) alert("postprocess.js\nTurning Debug mode off...");
	var debug = false;
	
	return true;
}