// Generic Functions And Global Variables
var errorFree;
var theError;
var submitted = false;
var contact;
var mybgColor =  'C0C0C0';

//Removes Commas from numeric fields
function strip_commas(field) {
    re = /[,$]/gi;
    str = field.value;
    field.value = str.replace(re, "");
}

function launchCalc(calc_name) 
{
    if(arguments.length > 1) mybgColor = arguments[1];
    else  mybgColor = "FFFFFF";
    popupObj = window.open ('http://CommonElements.iLeads.com/Calculators/' + calc_name + '?color=' + mybgColor,'Form','toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=0,width=625,height=375');
    //popupObj = window.open ('/' + calc_name + '?color=' + mybgColor,'Form','toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=0,width=625,height=375');
    popupObj.focus();
}

function HeightInInches(feet, inches, height) {
    if(!isNaN(feet.value) && !isNaN(inches.value)) {
	height.value = (feet.value * 12) + inches.value;
    }
}

function req_text(field, msg) {
    if(field.value.length == 0) {
	addMsg(field, msg);
    }
}

function limit_textlength(field, length, msg) {
    if(field.value.length > length) {
	field.value = field.value.substr(0, length);
	if(msg.length > 0) alert(msg);
    }
}

function req_phone_3_fields(ac, pre, num, msg) {
    if(ac.value.length != 3 || isNaN(ac.value)) {
	addMsg(ac, msg);
    }
    else if(pre.value.length != 3 || isNaN(pre.value)) {
	addMsg(pre, msg);
    }
    else if(num.value.length != 4  || isNaN(num.value)) {
	addMsg(num, msg);
    }
}

function req_number(field, msg) {
    strip_commas(field);
    if(field.value.length == 0 || isNaN(field.value)) {
	addMsg(field, msg);
    }
}


function req_number_min_amt(field, amt, msg) {

    strip_commas(field);
    if(field.value.length == 0 || isNaN(field.value)) {
	addMsg(field, msg);
    }
    else if(field.value < amt) {
	addMsg(field, msg + " (Must be greater than: " + amt + ")");
    }
}

function req_one_number(field1, field2, msg) {
    strip_commas(field1);
    strip_commas(field2);
    if((field1.value.length == 0 || isNaN(field1.value)) && (field2.value.length == 0 || isNaN(field2.value))) {
	addMsg(field1, msg);
    }
}

function opt_number(field, msg, zeroed) {
    strip_commas(field);
    if(field.value.length != 0 && isNaN(field.value)) {
	addMsg(field, msg + " (not required)");
    }
    else if(field.value.length == 0 && zeroed) {
	field.value = 0;
    }
}

function req_number_length(field, length, msg) {
    strip_commas(field);
    if(field.value.length != length || isNaN(field.value)) {
	addMsg(field, msg);
    }
}

function opt_number_length(field, length, msg) {
    strip_commas(field);
    if(field.value.length != 0 && (field.value.length != length || isNaN(field.value))) {
	addMsg(field, msg + " (not required)");
    }
}

//Checks if a certain combo option is selected and throws an error if it is
function req_combo(combo, index, msg) {
    //alert(index + " - " + combo.options[index].selected);
    if(combo.options[index].selected) {
	addMsg(combo, msg);
	return false;
    }
    return true;
}

//Checks a text field if a certain combo option is selected
function req_text_w_combo(combo, index, field, msg) {
    if(combo.options[index].selected && field.value.length == 0) {
	addMsg(field, msg);
    }
}

//Checks a numeric field if a certain combo option is selected
function req_number_w_combo(combo, index, field, msg) {
    strip_commas(field);
    if(combo.options[index].selected && (field.value.length == 0 || isNaN(field.value))) {
	addMsg(field, msg);
    }
}
//URL   "http://.+\..+\..+"
//Email ".+@.+\..+"
var ValidEmailChars = "!#$%&'*+\-./=?A-Za-z0-9^_`{}|~";
var EmailRegExp = "^[" + ValidEmailChars + "]+@[" + ValidEmailChars + "]+\.[" + ValidEmailChars + "]+$";
function req_regexp(field, exp_text, msg) {
    req_regexpRE = new RegExp(exp_text);
    if(!req_regexpRE.test(field.value)) {
	addMsg(field, msg);
    }
}


function checkbox_validator(form, box, msg)
{
    if(form.elements[box] != null && form.elements[box].type != "hidden") {
	if(isNaN(form.elements[box].length)) {
	    if(form.elements[box].checked) {
		return true;
	    }
	    addMsg(form.elements[box], msg);
	}
	else {
	    for(var i = 0; i < form.elements[box].length; i++) {
		if(form.elements[box][i].checked) {
		    return true;
		}
	    }
	    addMsg(form.elements[box][0], msg);
	}
    }
    else {
	return true;
    }
    return false;
}


    function checkbox_allchecked_q(form, box)
{
    if(isNaN(form.elements[box].length)) {
	if(!form.elements[box].checked) {
	    return false;
	}
    }
    else {
	for(var i = 0; i < form.elements[box].length; i++) {
	    if(!form.elements[box][i].checked) {
		return false;
	    }
	}
    }
    return true;
}


function checkbox_anychecked_q(form, box)
{
    if(isNaN(form.elements[box].length)) {
	if(form.elements[box].checked) {
	    return true;
	}
    }
    else {
	for(var i = 0; i < form.elements[box].length; i++) {
	    if(form.elements[box][i].checked) {
		return true;
	    }
	}
    }
    return false;
}


function check_All(form, box) {
    if(isNaN(form.elements[box].length)) {
	form.elements[box].checked = true;
    }
    else {
	for(var i = 0; i < form.elements[box].length; i++) {
	    form.elements[box][i].checked = true;
	}
    }
}


function uncheck_All(form, box) {
    
    if(isNaN(form.elements[box].length)) {
	form.elements[box].checked = false;
    }
    else {
	for(var i = 0; i < form.elements[box].length; i++) {
	    form.elements[box][i].checked = false;
	}
    }
}

//Checks to see if we have a proper credit card number
function chk_creditcard(field, req) {

    var badCC = false;

    if(field.value == '4222222222222') {
	return true;
    }

    if(field.value.length < 15 && req) {
	addMsg(field, "Credit Card Number");
    }
    else if (field.value.length != 0){
	var multi = 2;
	var total = 0;
	var preSum;
	var newSum;
	for(i = field.value.length - 1; i >= 0; i--) {
	    if(multi == 1) multi = 2;
	    else multi = 1;
	    
	    preSum = String(multi * parseInt(field.value.charAt(i)));
	    newSum = 0;
	    for(j = preSum.length - 1; j >= 0; j--) {
		newSum = newSum + parseInt(preSum.charAt(j));
	    }
	    
	    total = total + newSum;
	}
	if((total%10) != 0) {
	    addMsg(field, "Invalid Credit Card Number");
	}
    }

    if(badCC) {
    }
}

function req_password(Pass1, Pass2) {
    if(Pass1.value.length == 0) {
	addMsg(Pass1, "Password");
    }
    if(Pass2.value.length == 0) {
	addMsg(Pass2, "Re-Type Password");
    }
    if(!(Pass1.value.length == 0 || Pass2.value.length == 0) && Pass1.value != Pass2.value) {
	addMsg(Pass1, "Passwords Must Match");
    }
}

function req_email(email1, email2) {

//      if(email1.value.length == 0) {
//  	addMsg(email1, "Email Address");
//      }
    req_regexp(email1, EmailRegExp, "Email Address");
//      if(email2.value.length == 0) {
//  	addMsg(email2, "Confirm Email Address");
//      }
    req_regexp(email2, EmailRegExp, "Confirm Email Address");
    if(!(email1.value.length == 0 || email2.value.length == 0) && email1.value != email2.value) {
	addMsg(email1, "Email Addresses Must Match");
    }
}

//Checks checkboxes with different names to see if any are selected
function ValMultiCheckBox(TheForm, List, msg) {
    for(i=0; i < List.length; i++) {
	if(checkbox_anychecked_q(TheForm, List[i])){
	    return true;
	}
    }
    if(isNaN(TheForm.elements[List[0]].length)) {
	addMsg(TheForm.elements[List[0]], msg);
    }
    else {
	addMsg(TheForm.elements[List[0]][0], msg);
    }
}

function addMsg(control, msg) {
    theError += "\n    -" + msg;
    if(errorFree) {
	control.focus();
    }
    errorFree = false;
}

function finish_Validation (theForm) {
   if(!errorFree) {
       alert(theError);
       return false;
   }
   else if(!submitted) {
       submitted = true;
       return true;
   }
   return false;
}


//Site Specific Functions

function CheckRegion(theBox) {
    if(theBox.checked) {
	check_All(theBox.form, "Region" + theBox.value) ;
    }
    else {
	uncheck_All(theBox.form, "Region" + theBox.value);
    }
}


function CheckStateBox(theBox) {
    if(checkbox_allchecked_q(theBox.form, theBox.name)) {
	check_All(theBox.form, "Reg" + theBox.name.substr(theBox.name.length-1)) ;
    }
    else {
	uncheck_All(theBox.form, "Reg" + theBox.name.substr(theBox.name.length-1));
    }
}

function CheckWholeState(theBox) {
    if(theBox.checked) {
	check_All(theBox.form, "Zone") ;
    }
    else {
	uncheck_All(theBox.form, "Zone");
    }
}


function CheckZoneBox(theBox) {
    if(checkbox_allchecked_q(theBox.form, theBox.name)) {
	check_All(theBox.form, "WholeState") ;
    }
    else {
	uncheck_All(theBox.form, "WholeState");
    }
}


function CheckPushWholeState(theBox) {
    if(theBox.checked) {
	check_All(theBox.form, "Zone");
    }
    else {
	uncheck_All(theBox.form, "Zone");
    }

    if(isNaN(theBox.form.elements["Zone"].length)) {
	check_All(theBox.form, "Zone" + theBox.form.elements["Zone"].value);
    }
    else {
	for(var i = 0; i < theBox.form.elements["Zone"].length; i++) {
	    check_All(theBox.form, "Zone" + theBox.form.elements["Zone"][i].value);
	}
    }
}


function CheckPushZoneBox(theBox, zoneID) {
    if(checkbox_allchecked_q(theBox.form, theBox.name)) {
	check_All(theBox.form, "WholeState") ;
    }
    else {
	uncheck_All(theBox.form, "WholeState");
    }
    if(theBox.checked) {
	check_All(theBox.form, "Zone"+zoneID) ;
    }
    else {
	uncheck_All(theBox.form, "Zone"+zoneID);
    }
}


function CheckPushAreaCodeBox(theBox) {
    if(checkbox_allchecked_q(theBox.form, theBox.name)) {
	if(isNaN(theBox.form.elements["Zone"].length)) {
	    theBox.form.elements["Zone"].checked = true;
	}
	else {
	    for(var i = 0; i < theBox.form.elements["Zone"].length; i++) {
		if(theBox.form.elements["Zone"][i].value == theBox.name.substr(4)) {
		    theBox.form.elements["Zone"][i].checked = true;
		}
	    }
	}
    }
    else {
	if(isNaN(theBox.form.elements["Zone"].length)) {
	    theBox.form.elements["Zone"].checked = false;
	}
	else {
	    for(var i = 0; i < theBox.form.elements["Zone"].length; i++) {
		if(theBox.form.elements["Zone"][i].value == theBox.name.substr(4)) {
		    theBox.form.elements["Zone"][i].checked = false;
		}
	    }
	}
    }
    if(checkbox_allchecked_q(theBox.form, "Zone")) {
	check_All(theBox.form, "WholeState") ;
    }
    else {
	uncheck_All(theBox.form, "WholeState");
    }
}


function InitPushAreaCodes(ACForm) {
    for(i = 0; i < ACForm.elements["Zone"].length; i++) {
	if(checkbox_allchecked_q(ACForm, "Zone"+ACForm.elements["Zone"][i].value)) {
	    ACForm.elements["Zone"][i].checked = true;
	}
	else {
	    ACForm.elements["Zone"][i].checked = false;
	}
    }
    if(checkbox_allchecked_q(ACForm, "Zone")) {
	check_All(ACForm, "WholeState") ;
    }
    else {
	uncheck_All(ACForm, "WholeState");
    }
}


function ValFieldList(TheForm) {
    errorFree = true;
    theError = "You have entered in the following information improperly:\n";

    ValMultiCheckBox(TheForm, new Array("Fields","DefaultFields"), "Please Choose Atleast One Field to View");

    return finish_Validation(TheForm);
}


function CheckDefaultFields() {
    var FieldBoxes = document.ChooseFields.Fields;
    var Defaults = true;
    for(i = 0; i < FieldBoxes.length; i++) {
	if(FieldBoxes[i].IsDefault == 1 && !FieldBoxes[i].checked || FieldBoxes[i].IsDefault == 0 && FieldBoxes[i].checked) {
	    Defaults = false;
	}
    }
    if(Defaults) {
	document.ChooseFields.DefaultFields.checked = true;
    }
    else {
	document.ChooseFields.DefaultFields.checked = false;
    }
}


function UseDefaultFields() {
    var FieldBoxes = document.ChooseFields.Fields;
    if(document.ChooseFields.DefaultFields.checked) {
	for(i = 0; i < FieldBoxes.length; i++) {
	    FieldBoxes[i].checked = FieldBoxes[i].IsDefault == 1;
	}
    }
}


function ValSignUp(TheForm) {

    errorFree = true;
    theError = "You have entered in the following information improperly:\n";

    req_text(TheForm.FirstName, "First Name");
    req_text(TheForm.LastName, "Last Name");
    req_text(TheForm.Company, "Company Name");
    req_text(TheForm.Address, "Street Address");
    req_text(TheForm.City, "City");
    req_combo(TheForm.State, 0, "State");
    req_number_length(TheForm.Zip, 5, "Zip Code");
    req_phone_3_fields(TheForm.PhoneAC, TheForm.PhonePre, TheForm.PhoneNum, "Phone");
    req_phone_3_fields(TheForm.FaxAC, TheForm.FaxPre, TheForm.FaxNum, "Fax");
    req_email(TheForm.email, TheForm.email2);
    //req_regexp(TheForm.email, EmailRegExp, "Email Address");
    req_password(TheForm.Pass1, TheForm.Pass2);
    req_combo(TheForm.DeliveryType, 0, "Delivery Type");
    
    ValMultiCheckBox(TheForm, StatesList, "Please Choose a State");

    return finish_Validation(TheForm);
}


function ValUserUpdate(TheForm) {

    errorFree = true;
    theError = "You have entered in the following information improperly:\n";

    req_text(TheForm.FirstName, "First Name");
    req_text(TheForm.LastName, "Last Name");
    req_text(TheForm.Company, "Company Name");
    req_text(TheForm.Address, "Street Address");
    req_text(TheForm.City, "City");
    req_combo(TheForm.State, 0, "State");
    req_number_length(TheForm.Zip, 5, "Zip Code");
    req_phone_3_fields(TheForm.PhoneAC, TheForm.PhonePre, TheForm.PhoneNum, "Phone");
    req_phone_3_fields(TheForm.FaxAC, TheForm.FaxPre, TheForm.FaxNum, "Fax");
    req_regexp(TheForm.email, EmailRegExp, "Email Address");
    req_combo(TheForm.DeliveryType, 0, "Delivery Type");

    return finish_Validation(TheForm);
}


function ValChangeStates(TheForm) {

    errorFree = true;
    theError = "You have entered in the following information improperly:\n";
    
    ValMultiCheckBox(TheForm, StatesList, "Please Choose a State");

    return finish_Validation(TheForm);
}


function LoadRegions() {
    for(i=0; i < StatesList.length; i++) {
	if(isNaN(document.forms[0].elements[StatesList[i]].length)) {
	    CheckStateBox(document.forms[0].elements[StatesList[i]]);
	}
	else {
	    CheckStateBox(document.forms[0].elements[StatesList[i]][0]);
	}
    }
}


function ValZoneList(TheForm) {

    errorFree = true;
    theError = "You have entered in the following information improperly:\n";

    ValMultiCheckBox(TheForm, new Array("Zone", "WholeState"), "Please Choose Atleast One Zone to View (or choose WHOLE STATE at top)");

    return finish_Validation(TheForm);
}


function ValLeadView(TheForm) {

    errorFree = true;
    theError = "";

    ValMultiCheckBox(TheForm, ChkBoxes, "Please Choose Atleast One Lead To Add to Your Cart");

//      if() {
//  	alert('Not Functional Yet'); 
//      }
    return finish_Validation(TheForm);
}


function UnCheckSpecificBoxes(PrimaryBox, OtherBox) {
    var form = PrimaryBox.form
    if(eval(OtherBox + 'Leads')) {
	if(isNaN(form.elements[OtherBox].length)) {
	    if(PrimaryBox.value == form.elements[OtherBox].value) {
		form.elements[OtherBox].checked = false;
	    }
	}
	else {
	    for(var i = 0; i < form.elements[OtherBox].length; i++) {
		if(PrimaryBox.value == form.elements[OtherBox][i].value) {
		    form.elements[OtherBox][i].checked = false;
		}
	    }
	}
    }
}


function UnCheckOpposingBoxes(PrimaryBox, OtherBox) {
    var form = PrimaryBox.form;
    if(isNaN(form.elements[OtherBox].length)) {
	if(PrimaryBox.value == form.elements[OtherBox].value) {
	    form.elements[OtherBox].checked = false;
	}
    }
    else {
	for(var i = 0; i < form.elements[OtherBox].length; i++) {
	    if(PrimaryBox.value == form.elements[OtherBox][i].value) {
		form.elements[OtherBox][i].checked = false;
	    }
	}
    }
}


function ValSpecialBox(TheForm, msg1, msg2) {

    errorFree = true;
    theError = "You have entered in the following information improperly:\n";

    var OkToSubmit = checkbox_validator(TheForm, "SpecialBox", msg1);

    //= finish_Validation(TheForm);

    //alert(OkToSubmit);
    if(OkToSubmit) {
	if(msg2 != '') {
	    return confirm(msg2);
	}
    }
    else {
	alert(msg1);
    }

    return OkToSubmit;
}

function ValCCInfo(TheForm) {
    errorFree = true;
    theError = "You have entered in the following information improperly:\n";

    req_text(TheForm.BillingFirstName, "Billing First Name")
    req_text(TheForm.BillingLastName, "Billing Last Name")
    req_text(TheForm.BillingAddress, "Billing Address")
    req_text(TheForm.BillingCity, "Billing City")
    req_combo(TheForm.BillingState, 0, "Billing State")
    req_number_length(TheForm.BillingZip, 5, "Billing Zip")
    req_combo(TheForm.CCType, 0, "Credit Card Type");
    chk_creditcard(TheForm.CCNum, true);
    MonthOk = req_combo(TheForm.CCExpMonth, 0, "Credit Card Expiration Month");
    YearOk = req_combo(TheForm.CCExpYear, 0, "Credit Card Expiration Year");

    Today = new Date();
    if(MonthOk && YearOk && TheForm.CCExpMonth[TheForm.CCExpMonth.selectedIndex].value < (parseInt(Today.getMonth())+1) && TheForm.CCExpYear[TheForm.CCExpYear.selectedIndex].value <= Today.getYear()) {
	addMsg(TheForm.CCExpMonth, "Your Credit Card has Expired");
    }

    return finish_Validation(TheForm);
}

function CheckReplacements(TheForm) {

    errorFree = true;
    theError = "You have entered in the following information improperly:\n";

    req_number(TheForm.LeadID, "LeadID for Returned Lead");
    req_text(TheForm.ReplacementReason, "Reason for Return");
    //return false;
    return finish_Validation(TheForm);
}

function CheckChangePass(TheForm) {

    errorFree = true;
    theError = "You have entered in the following information improperly:\n";

    req_text(TheForm.CurrPass, "Your CurrentPassword");
    req_password(TheForm.NewPass1, TheForm.NewPass2);

    return finish_Validation(TheForm);
}


function CartAddPopup() {
    //alert('hey');
    var ExclusiveArray = new Array();
    var NonExclusiveArray = new Array();
    var ExclusiveList = "";
    var NonExclusiveList = "";

    if(ExclusiveLeads) {
	var form = document.browseleads;
	var box = 'Exclusive';
	
	if(isNaN(form.elements[box].length)) {
	    if(form.elements[box].checked) {
		ExclusiveArray.push(form.elements[box].value);
	    }
	}
	else {
	    for(var i = 0; i < form.elements[box].length; i++) {
		if(form.elements[box][i].checked) {
		    ExclusiveArray.push(form.elements[box][i].value);
		}
	    }
	}
	if(ExclusiveArray.length > 0) {
	    ExclusiveList = 'Exclusive=' + ExclusiveArray.join() + '&';
	}
    }

    if(NonExclusiveLeads) {
	var form = document.browseleads;
	var box = 'NonExclusive';
	
	if(isNaN(form.elements[box].length)) {
	    if(form.elements[box].checked) {
		NonExclusiveArray.push(form.elements[box].value);
	    }
	}
	else {
	    for(var i = 0; i < form.elements[box].length; i++) {
		if(form.elements[box][i].checked) {
		    NonExclusiveArray.push(form.elements[box][i].value);
		}
	    }
	}
	if(NonExclusiveArray.length > 0) {
	    NonExclusiveList = 'NonExclusive=' + NonExclusiveArray.join() + '&';
	}
    }

    //alert('CartAddPopup.cfm?' + ExclusiveList + NonExclusiveList);

    if(ExclusiveArray.length > 0 || NonExclusiveArray.length > 0) {
	CartAddPopup = window.open ('CartAddPopup.cfm?' + ExclusiveList + NonExclusiveList,'CartAddPopup','toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=1,width=400,height=150');
	CartAddPopup.focus();
    }
    return true;
}

function ValCheckOut(TheForm, CheckCCInfo) {
    errorFree = true;
    theError = "You have entered in the following information improperly:\n";

    if(CheckCCInfo) {
	req_text(TheForm.BillingFirstName, "Billing First Name");
	req_text(TheForm.BillingLastName, "Billing Last Name");
	req_text(TheForm.BillingAddress, "Billing Address");
	req_text(TheForm.BillingCity, "Billing City");
	req_combo(TheForm.BillingState, 0, "Billing State");
	req_number_length(TheForm.BillingZip, 5, "Billing Zip");
	req_combo(TheForm.CCType, 0, "Credit Card Type");
	chk_creditcard(TheForm.CCNum, true);
	MonthOk = req_combo(TheForm.CCExpMonth, 0, "Credit Card Expiration Month");
	YearOk = req_combo(TheForm.CCExpYear, 0, "Credit Card Expiration Year");

	Today = new Date();
	if(MonthOk && YearOk && TheForm.CCExpMonth[TheForm.CCExpMonth.selectedIndex].value < (parseInt(Today.getMonth())+1) && TheForm.CCExpYear[TheForm.CCExpYear.selectedIndex].value <= Today.getYear()) {
	    addMsg(TheForm.CCExpMonth, "Your Credit Card has Expired");
	}
    }

    req_regexp(TheForm.email, EmailRegExp, "Enter Your Email Address");
    req_text(TheForm.pass1, "Enter Your Password");

    return finish_Validation(TheForm);
}

function ValConfigPushDelivery(TheForm, CheckZones, LeadType) {
    errorFree = true;
    theError = "You have entered in the following information improperly:\n";

    //Make sure that they really don't want Automatic Delivery
    var confirmMsg = "You have stated that you DO NOT want\nleads automatically delivered to you.\n\nClick OK to continue,\nClick Cancel to change your selection."
    if(!TheForm.TurnOnPush.checked) {
	if(!confirm(confirmMsg)) {
	    return false;
	}
	else {
	    return true;
	}
    }
    checkbox_validator(TheForm, "ReadTerms", "You must agree to the terms Leads Direct Usage Agreement");
    if(CheckZones) {
	ValMultiCheckBox(TheForm, ZonesList, "Please choose at least one AreaCode");
    }
    req_number(TheForm.MaxLeadsPerDay, "Set your Max Leads Per Day");
    req_number(TheForm.MaxChargePerDay, "Set your Max Charge Per Day");
    checkbox_validator(TheForm, "DaysOfTheWeek", "You must choose at least one day per week to receive leads");
    if(LeadType == 1) {
	checkbox_validator(TheForm, "LTV", "Choosr an LTV filter");
	checkbox_validator(TheForm, "LoanAmount", "Choose a Loan Amount filter");
	/*
	  if(!TheForm.Poor.checked && !TheForm.Excellent.checked) {
	      addMsg(TheForm.Poor, "Choose a Credit Filter");
	  }
	*/
	/*
	  if(!TheForm.SecondETC.checked && !TheForm.NewPurchase.checked) {
	      addMsg(TheForm.SecondETC, "Choose a Credit Filter");
	  }
	*/
    }
    return finish_Validation(TheForm);
}
