// Copyright (C) 2008,2009 Dwain Blazej

// ----------------------------------------
// Globals to customize.

// Where to send payment forms.
// var paymentSubmit='https://www.sandbox.paypal.com/cgi-bin/webscr';
var paymentSubmit='https://www.paypal.com/cgi-bin/webscr';

var paypalReturnUrl='http://lapedsoc.org/form/paypal_return.html';

// "Date()" month is **ZERO** based, so May is "4".
// Date(2010,8,17 + 1); is for when the last day of early registration is SEPTEMBER 17 2010-9-17
// var lateRegistrationDate=new Date(2010,8,17 + 1); // + 1 for first day of lateness.
var lateRegistrationDate=new Date(2011,8,1 + 1); // + 1 for first day of lateness.

var paypal_item_name_prefix='68th Annual Brenemann Lectures: Tuition for'
var paypal_item_number_prefix='2011_Brennemann'

// NB: edit the dollar amounts in function submitEnrollForm
// Note: Javascript at the bottom of the html document puts a line through the old price when the early registration has passed.

// User special variable "onerror" to customize error handler.
// onerror=handleError;

// For browser compatibility, not using JSON.
var friday = new Object();
// For 3 preferences: friday.preferences = ['friday0','friday1','friday2'];
friday.preferences = ['friday0','friday1'];
friday.baseID = 'friday';
friday.readName = 'Friday';


var saturday = new Object();
// For 3 preferences: saturday.preferences = ['saturday0','saturday1','saturday2'];
saturday.preferences = ['saturday0','saturday1'];
saturday.baseID = 'saturday';
saturday.readName = 'Saturday';

// Disable Round Table: var sessions = [];
var sessions = [friday, saturday];

var lunch_price=25;
// ----------------------------------------
// Globals that don't need customization.

var paymentSend='payment@';
// Anti-Spambot crawler.
paymentSend+='lap' + 'edsoc' + '.org';

// Where to email bugs.
var problemReportEmail='lapedsoc+bug@';
// Anti-Spambot crawler.
problemReportEmail += 'gmail.com';

var currentDate=new Date();
// var currentDate=new Date(2009,8,22 + 1,0,1);  // For testing.
var isLate=false;
if (currentDate.valueOf() >= lateRegistrationDate.valueOf()) {
	isLate=true;
}

// Text messages describing to the user what needs to be corrected before submitting the form.
var correctionMessages = new Array();

// Array of getElementById that are highlighted as problems.
var problemIDs = new Array();
// highlightID: html id='' string of document element to highlight.
// colorForProblem='#ffc4be';
var colorForProblem='#fdff89';


// Name of the registrant.
var registrantName='';

// Name used to register at the affiliated hotel.
var hotelRegistrationName='';


var isRequiredText='';
// ----------------------------------------
// Preload Alert icon next to correction text.
var imageButtonAddDonationNormal = new Image();
imageButtonAddDonationNormal.src = '../images/alert.gif';


// ----------------------------------------
// Begin: Interative 'Enroll Now' buttons
var imageEnrollOut = new Image();
imageEnrollOut.src = '../images/btn_enrollBrown_LG.gif';
function enrollOut(obj) {
	obj.src = imageEnrollOut.src;
}

var imageEnrollOver = new Image();
imageEnrollOver.src = '../images/btn_enroll_LG.gif';
function enrollOver(obj) {
	obj.src = imageEnrollOver.src;
}

var imageEnrollDown = new Image();
imageEnrollDown.src = '../images/btn_enroll_LG_down.gif';
function enrollDown(obj) {
	obj.src = imageEnrollDown.src;
}

var imagePleaseWait = new Image();
imagePleaseWait.src = '../images/interface/button/please wait - disabled.png';
function pleaseWait(obj) {
	obj.src = imagePleaseWait.src;
}

function enrollUp(obj) {
	enrollOut(obj);
}

// End: Interative 'Enroll Now' buttons
// ----------------------------------------


// ----------------------------------------
// Begin: Interative preference seleciton lists

/*
changeYN; array length two, containing element IDs.
	if the first element is checked then enable widgets
	if the second element is checked then disable widgets
widgets; array, containing element IDs.
	Elements to enable or disable.
*/
function changeDisabled(changeYN, widgets) {
	if (document.getElementById(changeYN[0]).checked) {
		for(var i=0;i <widgets.length; i++) {
			document.getElementById(widgets[i]).disabled = false;
		}
	} else if (document.getElementById(changeYN[1]).checked) {
		for(var i=0;i <widgets.length; i++) {
			document.getElementById(widgets[i]).disabled = true;
		}
	} else {
		var elts;
		for(var i=0; i<changeYN.length; i++) {
			elts = elts + widgets[i];
		}
		throw('changeDisabled: No setting selected from elements: ' + elts); 
	}

}

// End: Interative preference seleciton lists
// ----------------------------------------

// Begin: Lib
// ----------------------------------------

function debugMessage(msg) {
	// var x = document.getElementById('debugID')
	// x.innerHTML = x.innerHTML + msg;
	// document.getElementById('debugID').innerHTML += '<div bgcolor="#fdff89">' + msg + '</div><br />';
	document.getElementById('debugID').style.backgroundColor='#fdff89';
	document.getElementById('debugID').innerHTML += '<div>' + msg + '</div>';

}

// ----------------------------------------
// End: Lib



// ----------------------------------------
// Begin: Form validity feedback.

// If form is invalid, display correction information to user then return 'false'.
// Otherwise, return true.
function allowSubmit() {
	var issue;
	if (correctionMessages.length > 0) {
		if (correctionMessages.length == 1) {
			issue = 'issue';
		} else {
			issue = 'issues';
		}
		var msgHeading = 'Please address the following ' + issue + ' then click the \"Enroll Now\" button again:';
		// debugMessage('Correctionmessages length is ' + correctionMessages.length);
		var listOfCorrections = '<ul>';
		for(var i=0; i<correctionMessages.length; i++) {
			listOfCorrections += '<li class="problem">' + correctionMessages[i] + '</li>';
		}
		listOfCorrections += '</ul>';

		var elt = document.getElementById('correctionMessageID');
		highlightProblem('correctionMessageID');
		// Using table instead of iframe because table has better browser support.
		elt.innerHTML = '<p><table width="100%" class="problem"><tr><td align="center" valign="top" rowspan="2"><img src="../images/alert.gif" alt="[Alert]"></td><th align="left">' +  msgHeading + '</th></tr><tr><td>' + listOfCorrections + '</td></tr></table></p>';
		// location.href='#correctionMessageID';
		location.hash='correctionMessageID';
		return false;
	} else {
		// Clean current page.
		resetCorrectionFeedback();
		return true;
	}		
}

function highlightProblem(highlightID) {
	problemIDs.push(highlightID);
	// document.getElementById(highlightID).bgColor=;
	document.getElementById(highlightID).style.backgroundColor=colorForProblem;
	//document.getElementById(highlightID).className += 'problem';
}

function resetCorrectionFeedback() {
	var elt = document.getElementById('correctionMessageID')
	elt.style.backgroundColor='';
	elt.innerHTML = '';

	for(var i=0; i<problemIDs.length; i++) {
		// document.getElementById(highlightID).bgColor='';
		//document.getElementById(i).style.backgroundColor='';
		document.getElementById(problemIDs[i]).style.backgroundColor='';
	}
	problemIDs = [];
	correctionMessages = [];
	// Doing this causes the error message to disappear: location.hash='';
}

// End: Form validity feedback.
// ----------------------------------------

// ----------------------------------------
// Begin: Form validity checks.
function requiredText(form, contextID, correctionMessage) {
	var givenText = form.requiredTextValue.value
	givenText = trimExtraSpaces(givenText);

	if (givenText.length == 0) {
		highlightProblem(contextID);
		correctionMessages.push(correctionMessage);
		// if (window.focus) form.requiredTextValue.focus();
		return false;
	} else {
		isRequiredText='t';
	}
	return true;
}

/*
num: positive integer
return: ordinal html string of num.
*/
function numToHtmlOrdinal(num) {
	switch(num)	{
	case 1:
		return('1<sup><font size="1">st</font></sup>');
	case 2:
		return('2<sup><font size="1">nd</font></sup>');
	case 3:
		return('3<sup><font size="1">rd</font></sup>');
	default:
		return(num + '<sup><font size="1">th</font></sup>');
	}
}

function requireRSVP(baseID, eventDesc) {
	RSVP=''
	if (document.getElementById(baseID + 'Yes').checked) {
		RSVP='Yes';
	}
	if (document.getElementById(baseID + 'No').checked) {
		RSVP='No';
	}
	if (document.getElementById(baseID + 'Maybe').checked) {
		RSVP='Maybe';
	}
	if (RSVP == '') {
		highlightProblem(baseID);
		correctionMessages.push('Will you attend the '+ eventDesc + '?');
	}
	return(RSVP);
}

/*
baseID: the text name from which associated document IDs are derived.
readName: the name the human reader sees.
preferences: array of element IDs in order of preference (first to last).
*/
function validateAttendanceSpecified(baseID, readName, preferences) {
	if (
		(! document.getElementById(baseID + 'Yes').checked)
		&&
		(! document.getElementById(baseID + 'No').checked)
	) {
		highlightProblem(baseID + 'Attending');
		correctionMessages.push('Will you attend the '+ readName + ' round table?  Please select \"Yes\" or \"No\".');
		/* Disabled in favor of requiredText using focus.
		if (window.focus) document.getElementById(baseID + 'Yes').focus;
		*/
	}

	// minSelected=0 if only first preference required
	// minSelected=1 if both first and second preference required.
	var minSelected = 1;

	if (document.getElementById(baseID + 'Yes').checked) {
		// If selected 'Yes' to attending, then ensure minimun number of preferences are also selected.
		for (var i=0; i <= minSelected; i++) {
			var elt = document.getElementById(preferences[i]);
			var selectedValue = elt.options[elt.selectedIndex].value;

			// var selectedText = elt.options[elt.selectedIndex].text;
			// document.getElementById('debugID').innerHTML = '<p>' + baseID + i + ' selectedValue is ' + selectedValue + '  selectedText is ' + selectedText + '</p>';

			if (selectedValue == '' || selectedValue == 'none') {
				highlightProblem(baseID + i + 'Area');
				correctionMessages.push('You selected \"Yes\" for the ' + readName + ' Round Table, so you must also select your ' + numToHtmlOrdinal(i + 1) + ' preference.');
			}
		}

		// ........................................
		// Ensure preferences are specified in order, without leaving blank higher prioritiy selections.
		// Skip checking of first element because that selection is already cheked to coincide with a 'Yes' selection.  This also removes a corner case.
		// Skip cheking of second element since the first elt is guaranteed from previous check to have a value.
		var i=2;
		if (i > (minSelected + 1)) {
			// Only check element with index (minSelected + 2) or greater, because  (minSelected + 2) looks to see if (minSelected + 1) is unselected.
			for (; i<preferences.length; i++) {
				var currentValue = document.getElementById(preferences[i]).value;
				if (currentValue != '' && currentValue != 'none') {
					var previousValue = document.getElementById(preferences[i-1]).value;
					if (previousValue == '' || previousValue == 'none') {
						// Make notice of the selection prior this iteration's value of i.
						highlightProblem(baseID + (i - 1) + 'Area');
						correctionMessages.push('For the ' + readName + ' Round Table, you skipped your ' + numToHtmlOrdinal(i) + ' preference.');			
					}
				}
			}
		}

		// ........................................
		// Make sure the same preference is not selected more than once.
		var reportedConflicts = [];  // Do not make duplicate reports.
		for (var i= preferences.length - 1; i>=0; i--) {
			var checkValue = document.getElementById(preferences[i]).value;
			// debugMessage('i=' + i + '; checkValue=' + checkValue + '; reportedConflicts gives ' + reportedConflicts.indexOf(checkValue) + '<br />');
			if (reportedConflicts.indexOf(checkValue) < 0) {
				for (var j=0; j<preferences.length; j++) {
					if (checkValue != '' && checkValue != 'none' && i != j) {
						if (checkValue == document.getElementById(preferences[j]).value) {
							highlightProblem(baseID + i + 'Area');
							correctionMessages.push('For the ' + readName + ' Round Table, your ' + numToHtmlOrdinal(i + 1) + ' preference is the same session as your ' + numToHtmlOrdinal(j+1) + ' preference.');
							reportedConflicts.push(checkValue);
						}
					}
				}
			} else {
				// debugMessage('Skiping already reported ' + checkValue + '<br />');
			}
		}
	}
}
// ----------------------------------------
// End: Form validity checks.


// ----------------------------------------
// Begin: Helper functions.

function validateAttendance(form) {
	for (var i=0; i< sessions.length; i++) {
		validateAttendanceSpecified(sessions[i].baseID, sessions[i].readName, sessions[i].preferences)
	}
}


// Encode the selected "Round Table Sessions" and lunch selection.
function paypalOptionEncode(form) {
	setHiddenInputInForm(form,'on0', 'Name');
	setHiddenInputInForm(form,'os0', '[Meeting: ' + registrantName + '][Hotel: ' + hotelRegistrationName + ']');

	var optionSelection = '';
	// debugMessage('Debug 5: ' + optionSelection);
	optionSelection+='\[Sessions: ';

	for (var i=0; i< sessions.length; i++) {
		if (i != 0) {
			// Space pad each session.
			//optionSelection += '   ';
		}
		optionSelection += '\[' + sessions[i].readName + ': ';
		// debugMessage('Debug 10: ' + optionSelection);
		// debugMessage('Debug 12: sessions[i].preferences.length=' + sessions[i].preferences.length);
		if (! document.getElementById(sessions[i].baseID + 'Yes').checked) {
			optionSelection += 'none';
		} else {
			var pref;
			for (var j=0; j<sessions[i].preferences.length; j++) {
				// debugMessage('Debug 15: preference ID=' + sessions[i].preferences[j]);
				if (document.getElementById(sessions[i].preferences[j]).disabled) {
					throw('paypalOptionEncode: Preference ' + sessions[i].preferences[j] + ' disabled yet value queried.');
				} else {
					pref = document.getElementById(sessions[i].preferences[j]).value;
					if (pref != '' && pref != 'none') {
						if (j != 0) {
							// Comma and space separate values.
							optionSelection += ', ';
						}
						optionSelection += pref;
					}
				}
			}
		}
		optionSelection += '\]';
	}
	// debugMessage("optionSelection=" + optionSelection);

	if (sessions.length == 0){
		optionSelection+='Not yet announced.';
	}
	optionSelection += '\]'; // Close "Round Table Sessions" info.

	optionSelection+=' \[Lunch '
	optionSelection+=' \[Fri: ' + document.getElementById('fridayLunch').value + '\]';
	optionSelection+=' \[Sat: ' + document.getElementById('saturdayLunch').value + '\]';
	optionSelection+=' \]'

	// Using ID gets the first found document ID, regardless of form used.
	// var requiredName = document.getElementById('requiredTextName').value;
	// var requiredValue = document.getElementById('requiredTextValue').value;
	// typeof(requiredName) != "undefined"

	if (isRequiredText=='t'){
		optionSelection+='  \[' + form.requiredTextName.value + ': ' + form.requiredTextValue.value + '\]';
	}

	optionSelection+=' \[Reception RSVP: ' + receptionRSVP + '\]';


	if (!form.os1) {
		setHiddenInputInForm(form,'os1','','os1');	// Max 200 chars.
	}
	setHiddenInputInForm(form,'on1','Options');
	form.os1.value = optionSelection;
	return true;
}



function processForm(form, customizeForm, customValidationFunc) {
	if (! supportedBrowser()) { return true; } // This "true" code path is for unsupported browser using the unmodified form.action.
	resetCorrectionFeedback();

	if (form == undefined) {
		throw('processForm: Form undefined.');
	}

	// Using a global variable: Name of the registrant.
	registrantName=trimExtraSpaces(document.getElementById('idRegistrantName').value);
	if (registrantName == ''){
		highlightProblem('idRegistrantNameHighlight');
		correctionMessages.push('You must enter the name of the person you are registering (probably your own name).');
		if (document.getElementById('idRegistrantName').focus) document.getElementById('idRegistrantName').focus();
	}

	hotelRegistrationName=trimExtraSpaces(document.getElementById('idHotelRegistrationName').value);

	receptionRSVP = requireRSVP('idReceptionAttendance', 'evening reception on Friday, September 23 on the William D. Evans Sternwheeler');

	validateAttendance(form);
	
	if (customValidationFunc != undefined) {
		if (typeof customValidationFunc == 'function') {
			customValidationFunc();
		} else {
			throw('processForm: Function expected.');
		}
	}

	if (allowSubmit()) {
		// While the document is in "get" mode, IE v6  creates a URL for all the name value pairs.  The URL gets truncated when long.  To get around this limitation, change form method from "get" to "post" before making other additions to the form.
		form.method='post';
		paypalOptionEncode(form);
		formConfigure(form, customizeForm);
		return true;
	} else {
		return false;
	}

}
// object	form
// string	Name, Value
// string	id: Optional.
function setHiddenInputInForm(form,name,value,id) {
	var existing_elt = getElementByName(form,name);
	if (existing_elt) {
		existing_elt.value = value;
		if (id) {
			existing_elt.id = id;
		}
	} else {
		var new_element = document.createElement('input');
		new_element.setAttribute('type', 'hidden');
		new_element.setAttribute('name', name);
		new_element.setAttribute('value', value);
		if (id) {
			new_element.setAttribute('id', id);
		}
		// document.forms['form_name'].appendChild(new_element); 
		if (! form.appendChild(new_element)) {
			throw('setHiddenInputInForm: failed to append to form name=' + name + ' value=' + value);
		} else {
			// debugMessage('Added name=' + new_element.name + ' value=' + new_element.value);
		}
	}
}

function formConfigure(form, customizeForm) {
	if (customizeForm == undefined) {
		throw('formConfigure: Form not customized.');
		return false;
	} else if (typeof customizeForm != 'function') {
		throw('formConfigure: Form not customization not given a function.');
		return false;
	} else {
		customizeForm();
	}

	// For information about the PayPal values, see "Website Payments Standard":
	// https://cms.paypal.com/us/cgi-bin/?cmd=_render-content&content_ID=developer/e_howto_html_Appx_websitestandard_htmlvariables


	// These values customized.
	// setHiddenInputInForm(form,'item_name','');  // Max 127 chars.
	// setHiddenInputInForm(form,'item_number','');  // Max 127 chars.
	// setHiddenInputInForm(form,'amount','');

	// Add cost of lunch.
	var lunches = ['fridayLunch', 'saturdayLunch'];
	for ( var i=0; i <lunches.length; i++ ) {
		var elt=getElementByName(form,'amount')
		// debugMessage(lunches[i]+':\t'+document.getElementById(lunches[i]).value);
		if (document.getElementById(lunches[i]).value != 'none') {
			// debugMessage('value text: '+elt.value+'\t value float: '+parseFloat(elt.value));			
			elt.value = parseFloat(elt.value) + lunch_price;
		}
	}

	setHiddenInputInForm(form,'cmd','_xclick');	
	setHiddenInputInForm(form,'add','1');
	setHiddenInputInForm(form,'business', paymentSend);
	setHiddenInputInForm(form,'return',paypalReturnUrl);
	setHiddenInputInForm(form,'cbt_shipping','Return to Los Angeles Pediatric Society');
	setHiddenInputInForm(form,'cancel_return','http://lapedsoc.org/form/paypal_cancel.html');  // Max 60 chars.
	setHiddenInputInForm(form,'shipping','0.00');
	setHiddenInputInForm(form,'no_shipping','0');
	setHiddenInputInForm(form,'no_note','0'); // "0" (default) payer is prompted to include a note, 1 no note.  Max note length is 255 chars.
	setHiddenInputInForm(form,'cn','Leave any special instructions.'); // Label above payer's leave a note text box..  Max 40 chars.  Default "Add Instructions to Seller"
	setHiddenInputInForm(form,'currency_code','USD');
	setHiddenInputInForm(form,'tax','0.00');
	setHiddenInputInForm(form,'lc','US'); // Language for PayPal login page.
	setHiddenInputInForm(form,'cpp_headerback_color','d7c9c9'); // Optional: background color for the header of the payment page.

	setHiddenInputInForm(form,'cpp_headerborder_color','bda0a0');


	// If no existing window called paypall, a new window will be created.
	// form.target='paypal';
	form.action = paymentSubmit;
	return true;
}

// End: Helper functions.
// ----------------------------------------


// ----------------------------------------
// Begin: Form submit entry points.
//

// Form onsubmit action 
function submitEnrollForm(form, idInputHighlight) {
	if (! supportedBrowser()) { return true; } else { form.action='#'; }

	switch(form.name)	{
	case 'formPhysicianMember':
		setHiddenInputInForm(form,'item_name',paypal_item_name_prefix + ' LAPS member physician.');
		setHiddenInputInForm(form,'item_number',paypal_item_number_prefix + '-10_01', 'idPaypalItemNumber');  // Max 127 chars.
		if (! isLate) {
			setHiddenInputInForm(form,'amount','525.00');
		} else {
			setHiddenInputInForm(form,'amount','575.00');
		}
		break;
	case 'formPhysicianNonMember':
		setHiddenInputInForm(form,'item_name',paypal_item_name_prefix + ' non-member physician.');  // Max 127 chars.
		setHiddenInputInForm(form,'item_number',paypal_item_number_prefix + '-20_01','idPaypalItemNumber');  // Max 127 chars.
		if (! isLate) {
			setHiddenInputInForm(form,'amount','575.00');
		} else {
			setHiddenInputInForm(form,'amount','625.00');
		}
		break;
	case 'formPediatricResident':
//		var customValidationFunc =  function() {
//			requiredText(form, idInputHighlight, 'Please fill in the \"Hospital\" field with the name of the hospital you are currently in residency with.');
//		}
		setHiddenInputInForm(form,'item_name',paypal_item_name_prefix + ' pediatric resident.');  // Max 127 chars.
		setHiddenInputInForm(form,'item_number',paypal_item_number_prefix + '-30_01','idPaypalItemNumber');  // Max 127 chars.
		if (! isLate) {
			setHiddenInputInForm(form,'amount','100.00');
		} else {
			setHiddenInputInForm(form,'amount','150.00');
		}
		break;
	case 'formAlliedCategory':
//		var customValidationFunc =  function() {
//			requiredText(form, idInputHighlight, 'Please fill in the \"Category\" field with a description of the type of work you do.');
//		}
		setHiddenInputInForm(form,'item_name',paypal_item_name_prefix + ' allied health personnel.');  // Max 127 chars.
		setHiddenInputInForm(form,'item_number',paypal_item_number_prefix + '-40_01','idPaypalItemNumber');  // Max 127 chars.
		if (! isLate) {
			setHiddenInputInForm(form,'amount','275.00');
		} else {
			setHiddenInputInForm(form,'amount','325.00');
		}
		break;
// 	case 'formLayPerson':
// 		setHiddenInputInForm(form,'item_name',paypal_item_name_prefix + ' Lay Person / Parent / Teacher / Counselor.');  // Max 127 chars.
// 		setHiddenInputInForm(form,'item_number',paypal_item_number_prefix + '-45_01','idPaypalItemNumber');  // Max 127 chars.
// 		if (! isLate) {
// 			setHiddenInputInForm(form,'amount','250.00');
// 		} else {
// 			setHiddenInputInForm(form,'amount','300.00');
// 		}
// 		break;
	case 'formEmeritusMember':
		setHiddenInputInForm(form,'item_name',paypal_item_name_prefix + ' physician emeritus with LAPS.');  // Max 127 chars.
		setHiddenInputInForm(form,'item_number',paypal_item_number_prefix + '-50_01','idPaypalItemNumber');  // Max 127 chars.
		if (! isLate) {
			setHiddenInputInForm(form,'amount','200.00');
		} else {
			setHiddenInputInForm(form,'amount','250.00');
		}
		break;
	case 'formEmeritusNonMember':
		setHiddenInputInForm(form,'item_name',paypal_item_name_prefix + ' physician emeritus with LAPS.');  // Max 127 chars.
		setHiddenInputInForm(form,'item_number',paypal_item_number_prefix + '-60_01','idPaypalItemNumber');  // Max 127 chars.
		if (! isLate) {
			setHiddenInputInForm(form,'amount','250.00');
		} else {
			setHiddenInputInForm(form,'amount','300.00');
		}
		break;
	default:
		throw('submitEnrollForm: Unexpected form name "' + form.name + '"');
		return(false);
	}

	if (! customizeForm) {
		var customizeForm = function() {};
	}

	if (! customValidationFunc) {
		var customValidationFunc = function() {};
	}


	if (isLate) {
		// Change item_number to show it is a late item.
		var elt = document.getElementById('idPaypalItemNumber');
		if (elt) {
			elt.setAttribute('value', elt.getAttribute('value').replace(/_01$/i, '_02'));
		} else {
			throw('unable to find \'idPaypalItemNumber\'');
		}
	}
	return(processForm(form, customizeForm, customValidationFunc));


}

// ----------------------------------------
// End: Form submit entry points.


