// Original Code Copyright 2006 by e-QualIT.  All rights reserved.
<!-- Hide
var blnAppealCodeSet = false;
function checkLogonSubord(fncTop) {
	if (fncTop != "") {
		fncTop = fncTop.toLowerCase();
		if (fncTop.indexOf("logon.aspx") == -1) {
			top.location.href="https://www.pkpfoundation.org/pkpfnet/Logon.aspx";
		}
	}
}
function formatCurrency(inStr) {
	retStr = inStr.toString();
	if (! isNaN(retStr)) {
		arrTmp = retStr.split(".");
		if (retStr != arrTmp[0]) {
			if (arrTmp[1].length == 1) {
				retStr = retStr + "0";
			} else {
				if (arrTmp[1].length > 2) {
					retStr = arrTmp[0] + "." + arrTmp[1].substr(0,2);
				}
			}
		} else {
			if (retStr != "") {
				retStr = retStr + ".00";
			} else {
				retStr = "0.00";
			}
		}
	} else {
		retStr = "0.00";
	}
	return retStr;
}
// Step 1
function setDonationSource(fncField) {
	if (fncField) {
		if (donTgtForm) {
			var fncVal = remAllSpaces(fncField.value);
			donTgtForm.DonationSource.value = fncVal;
		}
	}
}
function setPaidAmount(fncField) {
	if (fncField) {
		if (! fncField.disabled) {
			var fncDiv = document.getElementById("eQPaidAmount");
			if (donTgtForm) {
				var fncVal = remAllSpaces(fncField.value);
				if (fncVal == "") {
					donFncForm.PaidAmount.disabled = false;
					donFncForm.PaidAmount.value = "10.00";
					if (fncDiv) {
						fncDiv.style.visibility = "visible";
					}
					donFncForm.PaidAmount.focus();
				} else {
					if (fncDiv) {
						if (checkRadioVal("selPaidAmount","")) {
							donFncForm.PaidAmount.disabled = false;
							fncDiv.style.visibility = "visible";
						} else {
							fncDiv.style.visibility = "hidden";
							donFncForm.PaidAmount.disabled = true;
						}
					}
					fncVal = fncVal.replace(/,/g, "");
					tgtDVal = 5;
					strDVal = "5.00";
					if (donTgtForm.AppealCode.value.indexOf("WEBR") != -1) {
						tgtDVal = 5;
						strDVal = "5.00";
					}
					if (! isNaN(fncVal)) {
						if (parseFloat(fncVal) >= tgtDVal) {
							fncVal = formatCurrency(fncVal);
							donFncForm.PaidAmount.value = fncVal;
							donTgtForm.PaidAmount.value = fncVal;
							var summDiv = document.getElementById("eQGiftSumm");
							if (summDiv) {
								if (summDiv.style.visibility == "visible") {
									setNumPayments(donFncForm.NumPayments);
								}
							}
						} else {
							 if (blnAppealCodeSet) {
								 aWin = alert("The Gift Amount must be at least $"+strDVal+".");
								 donFncForm.PaidAmount.focus();
							 }
							return true;
						}
					} else {
						aWin = alert("The Gift Amount must be at least $"+strDVal+".");
						donFncForm.PaidAmount.focus();
						return true;
					}
				}
				setBBL();
			} else {
				aWin = alert("The target form cannot be found!");
				return true;
			}
		}
	}
	return false;
}
function setAppCode(fncField) {
	if (fncField) {
		if (donTgtForm) {
			var fncVal = fncField.options[fncField.selectedIndex].value;
			donTgtForm.eQAppCode.value = fncVal;
			donTgtForm.AppealCode.value = fncVal;
			fncForm = donFncForm;
			if (fncForm)
			{
				fncForm.GiftType.disabled = false;
				fncForm.GiftType.options[0].disabled = false;
				if (fncVal.toUpperCase().indexOf("WEBR") != -1)
				{
					fncForm.GiftType.selectedIndex = 1;
					fncForm.GiftType.options[0].disabled = true;
				} else {
					fncForm.GiftType.selectedIndex = 0;
					if (fncField.selectedIndex > 0) {
						fncForm.GiftType.disabled = true;
					}
				}
				blnRes = setAppealCode(fncForm.GiftType);
			}
		}
	}
}
function setAppealCode(fncField) {
	if (fncField) {
		if (donTgtForm) {
			var fncVal = fncField.options[fncField.selectedIndex].value;
			var fncDate = new Date();
			var dStr = fncDate.getYear().toString();
			var preDate = dStr.substr(dStr.length-2,dStr.length-1);
			var payOpts = donFncForm.NumPayments;
			switch(fncVal) {
				case "1Time":
				for (var i=1;i<61;i++) {
					strI = i.toString();
					tmpRes = removeOption(payOpts,strI);
				}
				tmpRes = addOption(payOpts,"1","1");
				donFncForm.NumPayments.selectedIndex = 1;
				donFncForm.NumPayments.disabled = true;
				donTgtForm.GiftType.value = fncVal;
				fncForm = donFncForm;
				if (fncForm)
				{
					fncAppCodeField = fncForm.eQAppCode;
					if (fncAppCodeField) {
						if (fncAppCodeField.options[fncAppCodeField.selectedIndex].value == "N/A")
						{
							donTgtForm.AppealCode.value = preDate + "WEB";
						}
					} else {
						donTgtForm.AppealCode.value = preDate + "WEB";
					}
				} else {
					donTgtForm.AppealCode.value = preDate + "WEB";
				}
				donTgtForm.eQFreq.value = "";
				donTgtForm.NumPayments.value = "1";
				break;
				case "R:Mon":
				donFncForm.NumPayments.disabled = false;
				donFncForm.NumPayments.selectedIndex = 0;
				donTgtForm.GiftType.value = fncVal;
				if (donTgtForm.AppealCode.value.toUpperCase().indexOf("WEBR") == -1)
				{
					donTgtForm.AppealCode.value = preDate + "WEBR";
				}
				donTgtForm.eQFreq.value = "MONT";
				donTgtForm.NumPayments.value = "0";
				for (var i=1;i<61;i++) {
					strI = i.toString();
					tmpRes = removeOption(payOpts,strI);
				}
				for (i=2;i<61;i++) {
					strI = i.toString();
					tmpRes = addOption(payOpts,strI,strI);
				}
				break;
				case "R:Qtr":
				donFncForm.NumPayments.disabled = false;
				donFncForm.NumPayments.selectedIndex = 0;
				donTgtForm.GiftType.value = fncVal;
				if (donTgtForm.AppealCode.value.toUpperCase().indexOf("WEBR") == -1)
				{
					donTgtForm.AppealCode.value = preDate + "WEBR";
				}
				donTgtForm.eQFreq.value = "QTER";
				donTgtForm.NumPayments.value = "0";
				for (var j=1;j<61;j++) {
					strJ = j.toString();
					tmpRes = removeOption(payOpts,strJ);
				}
				for (j=2;j<21;j++) {
					strJ = j.toString();
					tmpRes = addOption(payOpts,strJ,strJ);
				}
				break;
				case "R:Ann":
				donFncForm.NumPayments.disabled = false;
				donFncForm.NumPayments.selectedIndex = 0;
				donTgtForm.GiftType.value = fncVal;
				if (donTgtForm.AppealCode.value.toUpperCase().indexOf("WEBR") == -1)
				{
					donTgtForm.AppealCode.value = preDate + "WEBR";
				}
				donTgtForm.eQFreq.value = "YEAR";
				donTgtForm.NumPayments.value = "0";
				for (var i=1;i<61;i++) {
					strI = i.toString();
					tmpRes = removeOption(payOpts,strI);
				}
				for (i=2;i<6;i++) {
					strI = i.toString();
					tmpRes = addOption(payOpts,strI,strI);
				}
				break;
			}
			var summDiv = document.getElementById("eQGiftSumm");
			if (summDiv) {
				if (summDiv.style.visibility == "visible") {
					setNumPayments(donFncForm.NumPayments);
				}
			}
			blnAppealCodeSet = true;
		}
	}
}
function setPursuantAppealCode(fncField) {
	if (fncField) {
		if (donTgtForm) {
			var fncVal = fncField.options[fncField.selectedIndex].value;
			var fncDate = new Date();
			var dStr = fncDate.getYear().toString();
			var preDate = dStr.substr(dStr.length-2,dStr.length-1);
			var payOpts = donFncForm.NumPayments;
			switch(fncVal) {
				case "1Time":
				for (var i=1;i<61;i++) {
					strI = i.toString();
					tmpRes = removeOption(payOpts,strI);
				}
				tmpRes = addOption(payOpts,"1","1");
				donFncForm.NumPayments.selectedIndex = 1;
				donFncForm.NumPayments.disabled = true;
				donTgtForm.GiftType.value = fncVal;
				donTgtForm.AppealCode.value = preDate + "LWEB";
				donTgtForm.eQFreq.value = "";
				donTgtForm.NumPayments.value = "1";
				break;
				case "R:Mon":
				donFncForm.NumPayments.disabled = false;
				donFncForm.NumPayments.selectedIndex = 0;
				donTgtForm.GiftType.value = fncVal;				
				donTgtForm.AppealCode.value = preDate + "LWEBR";
				donTgtForm.eQFreq.value = "MONT";
				donTgtForm.NumPayments.value = "0";
				for (var i=1;i<61;i++) {
					strI = i.toString();
					tmpRes = removeOption(payOpts,strI);
				}
				for (i=2;i<61;i++) {
					strI = i.toString();
					tmpRes = addOption(payOpts,strI,strI);
				}
				break;
				case "R:Qtr":
				donFncForm.NumPayments.disabled = false;
				donFncForm.NumPayments.selectedIndex = 0;
				donTgtForm.GiftType.value = fncVal;
				donTgtForm.AppealCode.value = preDate + "LWEBR";
				donTgtForm.eQFreq.value = "QTER";
				donTgtForm.NumPayments.value = "0";
				for (var j=1;j<61;j++) {
					strJ = j.toString();
					tmpRes = removeOption(payOpts,strJ);
				}
				for (j=2;j<21;j++) {
					strJ = j.toString();
					tmpRes = addOption(payOpts,strJ,strJ);
				}
				break;
				case "R:Ann":
				donFncForm.NumPayments.disabled = false;
				donFncForm.NumPayments.selectedIndex = 0;
				donTgtForm.GiftType.value = fncVal;				
				donTgtForm.AppealCode.value = preDate + "LWEBR";
				donTgtForm.eQFreq.value = "YEAR";
				donTgtForm.NumPayments.value = "0";
				for (var i=1;i<61;i++) {
					strI = i.toString();
					tmpRes = removeOption(payOpts,strI);
				}
				for (i=2;i<6;i++) {
					strI = i.toString();
					tmpRes = addOption(payOpts,strI,strI);
				}
				break;
			}
			var summDiv = document.getElementById("eQGiftSumm");
			if (summDiv) {
				if (summDiv.style.visibility == "visible") {
					setNumPayments(donFncForm.NumPayments);
				}
			}
			blnAppealCodeSet = true;
		}
	}
}
function setNumPayments(fncField) {
	if (fncField) {
		if (donTgtForm) {
			var fncVal = fncField.options[fncField.selectedIndex].value;
			donTgtForm.NumPayments.value = fncVal;
			if (! isNaN(fncVal)) {
				var strDiv = "";
				var tgtDiv = document.getElementById("eQGiftSumm");
				if (tgtDiv) {
					var curDT = new Date();
					var curMon = (curDT.getMonth()+1).toString();
					var curDay = curDT.getDate().toString();
					var curYr = curDT.getYear().toString();
					var curDate = curMon + "/" + curDay + "/" + curYr;
					var curDaySuff = "";
					var lastDig = curDay.substr(curDay.length-1,1);
					switch(lastDig) {
						case "1":
						curDaySuff = "st";
						if (curDay == "11") {
							curDaySuff = "th";
						}
						break;
						case "2":
						curDaySuff = "nd";
						if (curDay == "12") {
							curDaySuff = "th";
						}
						break;
						case "3":
						curDaySuff = "rd";
						if (curDay == "13") {
							curDaySuff = "th";
						}
						break;						
						default:
						curDaySuff = "th";
						break;
					}
					var strPA = donTgtForm.PaidAmount.value;
					var strGT = donFncForm.GiftType.options[donFncForm.GiftType.selectedIndex].value;
					var strTFT = "";
					var strTF = "";
					if (strGT.indexOf("R:") != -1) {
						strTF = "monthly";
						strTFT = "months";
						if (strGT.indexOf("Qtr") != -1) {
							strTF = "quarterly";
							strTFT = "quarters";
						}
						if (strGT.indexOf("Ann") != -1) {
							strTF = "yearly";
							strTFT = "years";
						}						
					}
					if (strPA != "") {
						var numPay = parseInt(fncVal);
						var fltPA  = parseFloat(strPA);
						var totAmt = numPay*fltPA;
						var strDiv = "";
						switch(numPay) {
							case 0:
							strDiv = "You have elected to make gifts of $" + strPA + " each, beginning as of " + curDate + " and recurring on a " + strTF + " basis, until you cancel this gift."
							break;
							case 1:
							strDiv = "You have elected to make a one time gift of $" + strPA + "."						
							break;						
							default:
							strDiv = "You have elected to make gifts of $" + strPA + " each, beginning as of " + curDate + " and recurring on a " + strTF + " basis for an additional " + (numPay-1).toString() + " " + strTFT + ". The recurring payments will be automatically processed on or about the " + curDay + curDaySuff + " of each collection period.  The total amount donated over the life of this gift will be $" + formatCurrency(totAmt) + "."
							break;
						}
						tgtDiv.innerHTML = strDiv;
						tgtDiv.style.visibility = "visible";
					}
				}
			}
		}
	}
}
function setFundCode(fncField) {
	if (fncField) {
		if (donTgtForm) {
			var fncVal = fncField.options[fncField.selectedIndex].value;
			donTgtForm.FundCode.value = fncVal;
			var fncNameLabel = document.getElementById("eQhnrname_label");
			var fncNameField = document.getElementById("eQhnrname");
			var fncAddrLabel = document.getElementById("eQhnraddr_label");
			var fncAddrField = document.getElementById("eQhnraddr");
			if (fncNameLabel && fncNameField && fncAddrLabel && fncAddrField) {
				// Handles new eQHonMem field
				var eQFld = donTgtForm.eQHonMem;
				if (eQFld) {
					fncVal = eQFld.value;
				}
				// End eQHonMem
				switch(fncVal) {
					case "HONOR":
					fncNameLabel.style.visibility = "visible";
					fncNameField.style.visibility = "visible";
					fncAddrLabel.style.visibility = "visible";
					fncAddrField.style.visibility = "visible";
					break;
					case "MEMOR":
					donFncForm.HonoreeAddr.value = "";
					donTgtForm.HonoreeAddr.value = "";
					fncNameLabel.style.visibility = "visible";
					fncNameField.style.visibility = "visible";
					fncAddrLabel.style.visibility = "hidden";
					fncAddrField.style.visibility = "hidden";
					break;
					default:
					donFncForm.HonoreeName.value = "";
					donTgtForm.HonoreeName.value = "";
					donFncForm.HonoreeAddr.value = "";
					donTgtForm.HonoreeAddr.value = "";
					fncNameLabel.style.visibility = "hidden";
					fncNameField.style.visibility = "hidden";
					fncAddrLabel.style.visibility = "hidden";
					fncAddrField.style.visibility = "hidden";
					break;					
				}
				var summDiv = document.getElementById("eQGiftSumm");
				if (summDiv) {
					if (summDiv.style.visibility != "visible") {
						setNumPayments(donFncForm.NumPayments);
					}
				}
			}
		}
	}
}
function seteQHonMem(fncField) {
	if (fncField) {
		if (donTgtForm) {
			var fncVal = fncField.value;
			donTgtForm.eQHonMem.value = fncVal;
			var fncNameLabel = document.getElementById("eQhnrname_label");
			var fncNameField = document.getElementById("eQhnrname");
			var fncAddrLabel = document.getElementById("eQhnraddr_label");
			var fncAddrField = document.getElementById("eQhnraddr");
			if (fncNameLabel && fncNameField && fncAddrLabel && fncAddrField) {
				switch(fncVal) {
					case "HONOR":
					fncNameLabel.style.visibility = "visible";
					fncNameField.style.visibility = "visible";
					fncAddrLabel.style.visibility = "visible";
					fncAddrField.style.visibility = "visible";
					break;
					case "MEMOR":
					donFncForm.HonoreeAddr.value = "";
					donTgtForm.HonoreeAddr.value = "";
					fncNameLabel.style.visibility = "visible";
					fncNameField.style.visibility = "visible";
					fncAddrLabel.style.visibility = "hidden";
					fncAddrField.style.visibility = "hidden";
					break;
					default:
					donFncForm.HonoreeName.value = "";
					donTgtForm.HonoreeName.value = "";
					donFncForm.HonoreeAddr.value = "";
					donTgtForm.HonoreeAddr.value = "";
					fncNameLabel.style.visibility = "hidden";
					fncNameField.style.visibility = "hidden";
					fncAddrLabel.style.visibility = "hidden";
					fncAddrField.style.visibility = "hidden";
					break;					
				}
			}
		}
	}
}
function setHonoreeName(fncField) {
	if (fncField) {
		if (setTextField(fncField, true)) {
			if (document.getElementById("eQhnraddr").style.visibility == "visible") {
				donFncForm.HonoreeAddr.disabled = false;
				donFncForm.HonoreeAddr.focus();
			}
		} else {
			if (document.getElementById("eQhnraddr").style.visibility == "visible") {
				donFncForm.HonoreeAddr.disabled = true;
				donFncForm.HonoreeName.focus();
			}
		}
	}
}
// End Step 1
// Step 2
function setTgtYesNo(fncField, fncStep) {
	if (fncField && ! isNaN(fncStep)) {
		if (donTgtForm) {
			var fncVal = trim(fncField.value);
			if (fncVal != "") {
				tgtField = eval("donTgtForm." + fncField.name);
				if (tgtField) {
					tgtField.value = fncVal;
					donTgtForm.eQdonStep.value = fncStep;
					if (donTgtForm.name == "regSys" && tgtField.name == "eQKnowsBadgeNum" && fncVal == "N") {
						tgtField = donTgtForm.eQSelChapterCode;
						tgtField.value = "";
						tgtField = donTgtForm.eQBadgeNum;
						tgtField.value = "";
						aWin = alert("You MUST either know your Member Number or your Badge Number to register!");						
					}
					donTgtForm.submit();					
				}
			}
		}
	}
}
function setChapterCode(fncField) {
	if (fncField) {
		if (donTgtForm) {
			var fncVal = trim(fncField.value);
			fncVal = digitsOnly(fncVal);
			if (fncField.value == fncVal && fncVal != "" && ! isNaN(fncVal) && fncVal.length == 3 ) {
				var tgtField = donTgtForm.eQSelChapterCode;
				if (tgtField) {
					tgtField.value = "";
				}
				tgtField = donTgtForm.eQChapterCode;
				if (tgtField) {
					tgtField.value = fncVal;
				}				
			} else {
				fncField.value = fncVal;
				aWin = alert("The first part of the Member Number MUST be 3 numeric digits!");
				fncField.focus();
			}
		}
	}
}
function setBadgeNumber(fncField) {
	if (fncField) {
		if (donTgtForm) {
			var fncVal = trim(fncField.value);
			fncVal = digitsOnly(fncVal);
			if (fncField.value == fncVal && fncVal != "" && ! isNaN(fncVal) && fncVal.length == 4 ) {
				var blnBadgeNum = false;
				if (fncField.name == "eQBadgeNum") {
					blnBadgeNum = true;
				}
				var tgtField = donFncForm.eQBadgeNumber;
				if (tgtField && blnBadgeNum) {
					tgtField.value = fncVal;
				}
				tgtField = donTgtForm.eQBadgeNum;
				if (tgtField) {
					if (blnBadgeNum) {
						tgtField.value = fncVal;
					} else {
						tgtField.value = "";
					}
				}
				tgtField = donTgtForm.eQBadgeNumber;
				if (tgtField) {
					tgtField.value = fncVal;
				}
				setMemberNum(donTgtForm.MemberNum, fncField, donTgtForm.eQChapterCode, tgtField);
			} else {
				fncField.value = fncVal;
				aWin = alert("The Badge Number MUST be 4 numeric digits!");
				fncField.focus();
			}
		}
	}
}
function setMemberNum(srcField, tgtFld, fldChapCode, fldBadgeNumber) {
	if (srcField && fldChapCode && fldBadgeNumber) {
		var fncChapCode = trim(fldChapCode.value);
		var fncBadge = trim(fldBadgeNumber.value);
		if (! isNaN(fncChapCode) && fncChapCode.length == 3 && ! isNaN(fncBadge) && fncBadge.length == 4) {
			if (donFncForm && donTgtForm) {
				var fncMemberNum = fncChapCode + "-" + fncBadge;
				check_mnum(srcField, null, tgtFld, "pkpProfileInfo", fncMemberNum);
			}
		}
	}
}
function changeMNum() {
	if (donTgtForm) {
		if (donTgtForm.name == "donSys") {
			donTgtForm.eQdonStep.value = "2";
		}
		donTgtForm.MemberNum.value = "";
		donTgtForm.submit();
	}
}
function setCountryCode(fncField) {
	setComboBox(fncField);
	var fncVal = fncField.value;
	donFncForm.State.disabled = false;
	if (fncVal != "" && fncVal != "UNITED STATES" && fncVal != "CANADA") {
		donFncForm.State.selectedIndex = 0;
		donFncForm.State.disabled = true;
	}
}
function setEMail(fncField) {
	var fncVal = trim(fncField.value);
	if (validEmail(fncVal)) {
		setTextField(fncField, true);
	} else {
		fncField.value = fncVal;
		aWin = alert("You must enter a valid e-mail address!");
		fncField.focus();
	}
}
function checkAdmEMail(fncField) {
	var fncVal = trim(fncField.value);
	if (validEmail(fncVal)) {
		setTextField(fncField, true);
	} else {
		setTextField(fncField, false);
	}
}
// End Step 2
// Step 3
function setPaidSource (fncField) {
	if (fncField) {
		if (donTgtForm) {
			tgtField = eval("donTgtForm."+fncField.name);
			if (tgtField) {
				tgtField.value = fncField.value;
				var tgtDiv = document.getElementById("eQCredit");
				var tgtDiv2  = document.getElementById("eQACH");
				if (tgtDiv && tgtDiv2) {
					if (checkRadioVal("PaidSource","ACH")) {
						// ACH Selected
						tgtDiv.style.visibility = "hidden";
						tgtDiv2.style.visibility = "visible";
						// Destroy Credit Info
						donTgtForm.eQCardNumber.value = "";
						donTgtForm.eQExpMon.value = "";
						donTgtForm.eQExpYr.value = "";
						donTgtForm.PaidCCExpDate.value = "";
						donTgtForm.eQSecurityCode.value = "";
					} else {
						// Credit Selected
						tgtDiv.style.visibility = "visible";
						tgtDiv2.style.visibility = "hidden";
						// Destroy ACH Info
						donTgtForm.eQBankName.value = "";
						donTgtForm.eQAccountType.value = "";
						donTgtForm.eQRoutingNum.value = ""; 
						donTgtForm.eQAccountNum.value = "";
					}
				}
			} else {
				aWin = alert("The target field cannot be found!");
			}
		} else {
			aWin = alert("The target form cannot be found!");
		}
	}
}
function setCardNumber(fncField) {
	if (fncField) {
		if (donTgtForm) {
			var fncVal = trim(fncField.value);
			fncVal = digitsOnly(fncVal);
			if (fncField.value == fncVal && fncVal != "" && ! isNaN(fncVal) && (fncVal.length > 14 && fncVal.length < 17)) {
				setTextField(fncField, false);
			} else {
				fncField.value = fncVal;
				aWin = alert("Your Card Number must be 15 or 16 numeric digits!");
				fncField.focus();
			}
		}
	}
}
function setExpMon(fncField) {
	if (fncField) {
		if (donTgtForm) {
			if (setComboBox(fncField)) {
				var fncYr = donTgtForm.eQExpYr.value;
				if (fncYr.length == 4 && ! isNaN(fncYr)) {
					setExpYr(donFncForm.eQExpYr);
				}
			}
		}
	}
}
function setExpYr(fncYrField) {
	if (fncYrField) {
		if (donTgtForm) {
			if (setComboBox(fncYrField)) {
				var fncMon = donTgtForm.eQExpMon.value;
				if (fncMon.length == 2 && !isNaN(fncMon)) {
					var fncYr = eval("donTgtForm."+fncYrField.name+".value");
					var tgtFld = donTgtForm.PaidCCExpDate;
					if (tgtFld) {
						tgtFld.value = fncMon + "/" + fncYr;
					}
				} else {
					aWin = alert("You must select the Card Expiration Month!");
					donFncForm.eQExpMon.focus();
				}
			}
		}
	}
}
function setSecCode(fncField) {
	if (fncField) {
		if (donTgtForm) {
			var fncVal = trim(fncField.value);
			fncVal = digitsOnly(fncVal);
			if (fncField.value == fncVal && fncVal != "" && ! isNaN(fncVal) && (fncVal.length > 2 && fncVal.length < 5)) {
				setTextField(fncField, false);
			} else {
				fncField.value = fncVal;
				aWin = alert("Your Security Code must be 3 or 4 numeric digits!");
				fncField.focus();
			}
		}
	}
}
function setRoutingNum(fncField) {
	if (fncField) {
		if (donTgtForm) {
			var fncVal = trim(fncField.value);
			fncVal = digitsOnly(fncVal);
			fncField.value = fncVal;
			if (fncVal != "" && ! isNaN(fncVal) && fncVal.length == 9) {
				setTextField(fncField, false);
			} else {
				aWin = alert("Your Routing Number must be 9 numeric digits!");
				fncField.focus();
			}
		}
	}
}
// End Step 3
// Step 4

// End Step 4
var n = 0;
function verDonation(fncStep) {
	var blnOK = false;
	var blnErr = false;
	var lngStep = 0;
	var arrFldNames;
	if (! isNaN(fncStep)) {
		lngStep = parseInt(fncStep);
		if (donTgtForm) {
			switch(lngStep) {
				case 1:
				arrFldNames = Array("PaidAmount","AppealCode","NumPayments","FundCode","HonoreeName","HonoreeAddr");
				for (var i=0;i<4;i++) {
					var curVal = eval("donTgtForm."+arrFldNames[i]+".value");
					if (i == 0) {
						blnAppealCodeSet = true;
						if (! donFncForm.PaidAmount.disabled) {
							blnErr = setPaidAmount(donFncForm.PaidAmount);
							if (blnErr) {
								break;
							}
						}
					}
					if (i == 3) {
						var fCode = curVal;
					}
					if (trim(curVal) == "") {
						blnErr = true;
						aWin = alert("An error occurred. Please contact the system administrator.");
						break;
					}
				}
				if (! blnErr) {
					// Handles new eQHonMem field
					var eQFld = donTgtForm.eQHonMem;
					if (eQFld) {
						fCode = eQFld.value;
					}
					// End eQHonMem
					if (fCode == "HONOR" || fCode == "MEMOR") {
						curVal = eval("donTgtForm."+arrFldNames[4]+".value");
						if (trim(curVal) == "") {
							blnErr = true;
							aWin = alert("The Honoree Name cannot be blank!");
							donFncForm.HonoreeName.focus();
						}
						if (fCode == "HONOR" && ! blnErr) {
							curVal = eval("donTgtForm."+arrFldNames[5]+".value");
							if (trim(curVal) == "") {
								blnErr = true;
								aWin = alert("The Honoree Address cannot be blank!");
								donFncForm.HonoreeAddr.focus();
							}
						}
					}
				}
				break;
				case 2:
				arrFldNames = Array("MemberNum","CompanyName","FirstName","LastName","Address1","CountryCode","City","State","Zip","HomePhone","EMail");
				var defCurFld = donFncForm.eQChapterCode;
				var defCurFld2 = donFncForm.eQBadgeNum;
				var defCurFld3 = donFncForm.FirstName;
				for (var i=0;i<arrFldNames.length;i++) {
					var curVal = eval("donTgtForm."+arrFldNames[i]+".value");
					var curFld = eval("donFncForm."+arrFldNames[i]);
					if (trim(curVal) == "") {
						blnErr = true;
						switch(i) {
							case 0:
							if (donTgtForm.eQPKPMember.value == "Y" && (donTgtForm.eQKnowsMNum.value == "Y" || donTgtForm.eQKnowsBadgeNum.value == "Y")) {
									aWin = alert("Your Member Number has not been recorded properly.\nPlease check your entries and/or click 'Correct the entered\nMember Number' to correct it.");
									if (defCurFld && defCurFld.disabled == false) {
										defCurFld.focus();
									} else {
										if (defCurFld2 && defCurFld2.disabled == false) {
											defCurFld2.focus();
										} else {
											defCurFld3.focus();
										}
									}
							} else {
								blnErr = false;
							}
							break;
							case 1:
							if (donTgtForm.DonationSource.value == "Company") {
								aWin = alert("You must make an entry in this field!");
								curFld.focus();
							} else {
								blnErr = false;
							}
							break;
							case 5:
							aWin = alert("You must make a selection!");
							curFld.focus();
							break;
							case 7:
							var tmpVal = donTgtForm.CountryCode.value;
							if (tmpVal == "UNITED STATES" || tmpVal == "CANADA") {
								aWin = alert("You must make a selection!");
								curFld.focus();
							} else {
								blnErr = false;
							}
							break;
							case 8:
							var tmpVal = donTgtForm.CountryCode.value;
							if (tmpVal == "UNITED STATES" || tmpVal == "CANADA") {
								aWin = alert("You must make an entry in this field!");
								curFld.focus();
							} else {
								blnErr = false;
							}
							break;
							default:
							aWin = alert("You must make an entry in this field!");
							curFld.focus();
							break;
						}
						if (blnErr) {
							break;
						}
					}
				}
				if (! blnErr) {
					curVal = donTgtForm.EMail.value;
					if (! validEmail(curVal)) {
						blnErr = true;
						aWin = alert("You must enter a valid e-mail address!");
						donFncForm.EMail.focus();
					}
				}
				break;
				case 3:
				arrFldNames = Array("eQCardNumber","PaidCCExpDate","eQSecurityCode","eQBankName","eQRoutingNum","eQAccountNum");
				var stepMD = donTgtForm.PaidSource.value;
				if (stepMD == "ACH") {
					// ACH Selected: Destroy Credit Info
					donTgtForm.eQCardNumber.value = "";
					donTgtForm.eQExpMon.value = "";
					donTgtForm.eQExpYr.value = "";
					donTgtForm.PaidCCExpDate.value = "";
					donTgtForm.eQSecurityCode.value = "";
					for (var i=3;i<arrFldNames.length;i++) {
						var curVal = eval("donTgtForm."+arrFldNames[i]+".value");
						var curFld = eval("donFncForm."+arrFldNames[i]);
						if (trim(curVal) == "") {
							blnErr = true;
							aWin = alert("You must make an entry in this field!");
							curFld.focus();
							break;
						}
					}
				} else {
					// Credit Selected: Destroy ACH Info
					donTgtForm.eQBankName.value = "";
					donTgtForm.eQAccountType.value = "";
					donTgtForm.eQRoutingNum.value = ""; 
					donTgtForm.eQAccountNum.value = "";
					for (var i=0;i<3;i++) {
						var curVal = eval("donTgtForm."+arrFldNames[i]+".value");
						var curFld = eval("donFncForm."+arrFldNames[i]);
						if (trim(curVal) == "") {
							blnErr = true;
							if (i != 1) {
								aWin = alert("You must make an entry in this field!");
								curFld.focus();
							} else {
								aWin = alert("You must make selections to determine your Card Expiration Date!");
								donFncForm.eQExpMon.focus();
							}
							break;
						}
					}
				}
				break;
				case 4:
				if (donFncForm.GiftAuth.checked == false) {
					blnErr = true;
					aWin = alert("You must check the box to authorize your gift transaction(s)!");
				}
				break;
			}
			blnOK = ! blnErr;
		}
	}
	if (blnOK) {
		if (lngStep == 4) {
			var ip = donTgtForm.IPAddr.value;
//			if (ip == "74.133.43.169") {
				donTgtForm.submit();
//			}
		} else {
			donTgtForm.submit();
		}
	}
}
function verAdmDonation(fncStep) {
	var blnOK = false;
	var blnErr = false;
	var lngStep = 0;
	var arrFldNames;
	if (! isNaN(fncStep)) {
		lngStep = parseInt(fncStep);
		if (donTgtForm) {
			switch(lngStep) {
				case 1:
				arrFldNames = Array("PaidAmount","AppealCode","NumPayments","FundCode","HonoreeName","HonoreeAddr");
				for (var i=0;i<4;i++) {
					var curVal = eval("donTgtForm."+arrFldNames[i]+".value");
					if (i == 3) {
						var fCode = curVal;
					}
					if (trim(curVal) == "") {
						blnErr = true;
						aWin = alert("An error occurred. Please contact the system administrator.");
						break;
					}
				}
				if (! blnErr) {
					// Handles new eQHonMem field
					var eQFld = donTgtForm.eQHonMem;
					if (eQFld) {
						fCode = eQFld.value;
					}
					// End eQHonMem
					if (fCode == "HONOR" || fCode == "MEMOR") {
						curVal = eval("donTgtForm."+arrFldNames[4]+".value");
						if (trim(curVal) == "") {
							blnErr = true;
							aWin = alert("The Honoree Name cannot be blank!");
							donFncForm.HonoreeName.focus();
						}
						if (fCode == "HONOR" && ! blnErr) {
							curVal = eval("donTgtForm."+arrFldNames[5]+".value");
							if (trim(curVal) == "") {
								blnErr = true;
								aWin = alert("The Honoree Address cannot be blank!");
								donFncForm.HonoreeAddr.focus();
							}
						}
					}
				}
				break;
				case 2:
				arrFldNames = Array("MemberNum","CompanyName","FirstName","LastName","Address1","CountryCode","City","State","Zip","HomePhone");
				var defCurFld = donFncForm.eQChapterCode;
				var defCurFld2 = donFncForm.eQBadgeNum;
				var defCurFld3 = donFncForm.FirstName;
				for (var i=0;i<arrFldNames.length;i++) {
					var curVal = eval("donTgtForm."+arrFldNames[i]+".value");
					var curFld = eval("donFncForm."+arrFldNames[i]);
					if (trim(curVal) == "") {
						blnErr = true;
						switch(i) {
							case 0:
							if (donTgtForm.eQPKPMember.value == "Y" && (donTgtForm.eQKnowsMNum.value == "Y" || donTgtForm.eQKnowsBadgeNum.value == "Y")) {
									aWin = alert("Your Member Number has not been recorded properly.\nPlease check your entries and/or click 'Correct the entered\nMember Number' to correct it.");
									if (defCurFld && defCurFld.disabled == false) {
										defCurFld.focus();
									} else {
										if (defCurFld2 && defCurFld2.disabled == false) {
											defCurFld2.focus();
										} else {
											defCurFld3.focus();
										}
									}
							} else {
								blnErr = false;
							}
							break;
							case 1:
							if (donTgtForm.DonationSource.value == "Company") {
								aWin = alert("You must make an entry in this field!");
								curFld.focus();
							} else {
								blnErr = false;
							}
							break;
							case 5:
							aWin = alert("You must make a selection!");
							curFld.focus();
							break;
							case 7:
							var tmpVal = donTgtForm.CountryCode.value;
							if (tmpVal == "UNITED STATES" || tmpVal == "CANADA") {
								aWin = alert("You must make a selection!");
								curFld.focus();
							} else {
								blnErr = false;
							}
							break;
							case 8:
							var tmpVal = donTgtForm.CountryCode.value;
							if (tmpVal == "UNITED STATES" || tmpVal == "CANADA") {
								aWin = alert("You must make an entry in this field!");
								curFld.focus();
							} else {
								blnErr = false;
							}
							break;
							default:
							aWin = alert("You must make an entry in this field!");
							curFld.focus();
							break;
						}
						if (blnErr) {
							break;
						}
					}
				}
				break;
				case 3:
				arrFldNames = Array("eQCardNumber","PaidCCExpDate","eQSecurityCode","eQBankName","eQRoutingNum","eQAccountNum");
				var stepMD = donTgtForm.PaidSource.value;
				if (stepMD == "ACH") {
					// ACH Selected: Destroy Credit Info
					donTgtForm.eQCardNumber.value = "";
					donTgtForm.eQExpMon.value = "";
					donTgtForm.eQExpYr.value = "";
					donTgtForm.PaidCCExpDate.value = "";
					donTgtForm.eQSecurityCode.value = "";
					for (var i=3;i<arrFldNames.length;i++) {
						var curVal = eval("donTgtForm."+arrFldNames[i]+".value");
						var curFld = eval("donFncForm."+arrFldNames[i]);
						if (trim(curVal) == "") {
							blnErr = true;
							aWin = alert("You must make an entry in this field!");
							curFld.focus();
							break;
						}
					}
				} else {
					// Credit Selected: Destroy ACH Info
					donTgtForm.eQBankName.value = "";
					donTgtForm.eQAccountType.value = "";
					donTgtForm.eQRoutingNum.value = ""; 
					donTgtForm.eQAccountNum.value = "";
					for (var i=0;i<2;i++) {
						var curVal = eval("donTgtForm."+arrFldNames[i]+".value");
						var curFld = eval("donFncForm."+arrFldNames[i]);
						if (trim(curVal) == "") {
							blnErr = true;
							if (i != 1) {
								aWin = alert("You must make an entry in this field!");
								curFld.focus();
							} else {
								aWin = alert("You must make selections to determine your Card Expiration Date!");
								donFncForm.eQExpMon.focus();
							}
							break;
						}
					}
				}
				break;
				case 4:
				if (donFncForm.GiftAuth.checked == false) {
					blnErr = true;
					aWin = alert("You must check the box to authorize your gift transaction(s)!");
				}
				break;
			}
			blnOK = ! blnErr;
		}
	}
	if (blnOK) {
		if (lngStep == 4) {
			var ip = donTgtForm.IPAddr.value;
//			if (ip == "74.133.43.169") {
				donTgtForm.submit();
//			}
		} else {
			donTgtForm.submit();
		}
	}
}
function setTextField(fncField, blnReq) {
	var blnOK = false;
	if (fncField) {
		if (donTgtForm) {
			var fncVal = trim(fncField.value);
			if (fncVal != "" || (fncVal == "" && ! blnReq)) {
				fncField.value = fncVal;
				var tgtField = eval("donTgtForm."+fncField.name);
				if (tgtField) {
					blnOK = true;
					if (fncField.name == "EMail") {
						fncVal = fncVal.toLowerCase();
					}
					fncField.value = fncVal;
					tgtField.value = fncVal;
					return blnOK;
				} else {
					aWin = alert("The field does not exist in the 'target' form!");
					return blnOK;
				}
			} else {
				fncField.value = fncVal;
				aWin = alert("You must make an entry in this field!");
				fncField.focus();
				return blnOK;
			}
		}
	}
}
function setComboBox(fncField) {
	var blnRes = false;
	if (fncField) {
		if (donTgtForm) {
			var tgtField = eval("donTgtForm." + fncField.name);
			if (tgtField) {
				var fncVal = fncField.options[fncField.selectedIndex].value;
				tgtField.value = fncVal;
				if (fncVal == "") {
					aWin = alert("You must make a selection!");
					fncField.focus();
				} else {
					if (fncField.name == "eQSelChapterCode") {
						tgtField = donFncForm.eQChapterCode;
						if (tgtField) {
							tgtField.value = fncVal;
							tgtField.disabled = true;
						}
						tgtField = donTgtForm.eQChapterCode;
						if (tgtField) {
							tgtField.value = fncVal;
						}
					}
					blnRes = true;
				}
			}
		}
	}
	return blnRes;
}
function addOption(selFld, newVal, newText) {
	//	selFld is the Select Field to modify
	//	newVal is new option.value
	//	newText is new option.text
	if (selFld.options) {
		if (newVal != "" && newText != "" && (! isNaN(newVal))) {
			objOpt = document.createElement("OPTION");
			objOpt.value = newVal;
			objOpt.text = newText;
			selFld.options.add(objOpt);
			return true;
		} else {
			return false;
		}
	} else {
		return false;
	}
}
function removeOption(selFld, tgtVal) {
	//	selFld is the Select Field to modify
	//	tgtVal is the option.value of the option to remove
	blnRes = false;
	if (selFld.options) {
		if (tgtVal != "" && (! isNaN(tgtVal))) {
			for (var i=1;i<selFld.options.length;i++) {
				if (selFld.options[i].value == tgtVal) {
					selFld.options[i] = null;
					blnRes = true;
					break;
				}
			}
		} else {
			return false;
		}
	} else {
		return false;
	}
	return blnRes;
}
function remAllSpaces(inStr) {
	if (inStr != null) {
		inStr = inStr.replace(/\s/g, "");
	}
	return inStr
}
function trim(inStr) {
	if (inStr != null) {
		inStr = inStr.toString();
		var reBeg = /^\s/;
		var reEnd = /\s$/;
		while (inStr.length > 0) {
			if (inStr.match(reBeg) == null) {
				break;
			}
			inStr = inStr.replace(reBeg,"");
		}
		while (inStr.length > 0) {
			if (inStr.match(reEnd) == null) {
				break;
			}
			inStr = inStr.replace(reEnd,"");
		}
	}
	return inStr;
}
function digitsOnly(inStr) {
	if (inStr != null) {
		inStr = inStr.toString();
		rePat = /[^0-9]/g;
		inStr = inStr.replace(rePat,"");
	}
	return inStr;
}
function validEmail(inStr) {
	var blnRes = false;
	if (inStr != null) {
		inStr = inStr.toString();
		rePat = /^[_a-zA-Z0-9-]+(\.[_a-zA-Z0-9-]+)*@[a-zA-Z0-9-]+(\.[a-zA-Z0-9-]+)*\.(([0-9]{1,3})|([a-zA-Z]{2,6})|(aero|coop|info|museum|name))$/;
		matches = inStr.match(rePat);
		if (matches) {
			blnRes = true;
		}
	}
	return blnRes;
}
function checkRadioVal(fncFName, fncVal) {
	var blnEql = false;
	var varRad = document.getElementsByName(fncFName);
	if (varRad) {
		for (var i=0;i<varRad.length;i++) {
			if (varRad[i].checked) {
				if (varRad[i].value == fncVal) {
					blnEql = true;
					break;
				}
			}
		}
	}
	return blnEql;
}
function setDonFields(fncStep) {
	var tgtDiv = null;
	var tgtDivLab = null;
	var tgtDiv2 = null;
	var tgtDivLab2 = null;
	if (donFncForm && donTgtForm && ! isNaN(fncStep)) {
		switch(fncStep) {
			case "1":
			// Set PaidAmount
			tgtDiv = document.getElementById("eQPaidAmount");
			if (tgtDiv) {
				if (checkRadioVal("selPaidAmount","")) {
					tgtDiv.style.visibility = "visible";
				} else {
					tgtDiv.style.visibility = "hidden";
				}
			}
			// End PaidAmount
			// Handle eQGiftSumm
			tgtDiv = document.getElementById("eQGiftSumm");
			if (tgtDiv) {
				setNumPayments(donFncForm.NumPayments);
			}
			// End eQGiftSumm
			// Handle Honoree Name and Addr
			tgtDivLab = document.getElementById("eQhnrname_label");
			tgtDiv = document.getElementById("eQhnrname");
			tgtDivLab2 = document.getElementById("eQhnraddr_label");
			tgtDiv2 = document.getElementById("eQhnraddr");
			if (tgtDivLab && tgtDiv && tgtDivLab2 && tgtDiv2 && donTgtForm.FundCode) {
				var strFC = donTgtForm.FundCode.value;
				// Handles new eQHonMem field
				var eQFld = donTgtForm.eQHonMem;
				if (eQFld) {
					strFC = eQFld.value;
				}
				// End eQHonMem
				if (strFC == "HONOR" || strFC == "MEMOR") {
					tgtDivLab.style.visibility = "visible";
					tgtDiv.style.visibility = "visible";
					if (strFC == "HONOR") {
						tgtDivLab2.style.visibility = "visible";
						tgtDiv2.style.visibility = "visible";
					} else {
						tgtDivLab2.style.visibility = "hidden";
						tgtDiv2.style.visibility = "hidden";
					}
				} else {
					tgtDivLab.style.visibility = "hidden";
					tgtDiv.style.visibility = "hidden";
					tgtDivLab2.style.visibility = "hidden";
					tgtDiv2.style.visibility = "hidden";
				}
			}
			// End Honoree
			// Handle Brick Campaign
			if (donTgtForm.eQDonationIntent) {
				if (donTgtForm.eQDonationIntent.value == "eQbrick") {
					shwDiv = document.getElementById("eQbrick");				
					hidDiv = document.getElementById("eQstd");
				} else {
					hidDiv = document.getElementById("eQbrick");
					shwDiv = document.getElementById("eQstd");
				}
				if (shwDiv) {
					shwDiv.className = "";
				}
				if (hidDiv) {
					hidDiv.className = "eQnone";
				}
			}
			// End Brick
			// Handle Admin Custom Appeal Codes
			if (donFncForm.eQAppCode) {
				eQAppCodeFld = donFncForm.eQAppCode;
				eQAppCodeVal = eQAppCodeFld.options[eQAppCodeFld.selectedIndex].value;
				if (eQAppCodeVal.toUpperCase().indexOf("WEBR") == -1 && eQAppCodeVal != "N/A")
				{
					donFncForm.GiftType.disabled = true;
				}
			}
			// End Admin Custom Appeal Codes
			// BBL Level
			setBBL();
			// End BBL
			break;
			case "2":
			var blnMemberNum = false;
			if (donTgtForm.MemberNum.value.length == 8) {
				blnMemberNum = true;
			}
			if (donTgtForm.eQSelChapterCode.value != "" || blnMemberNum) {
				if (donFncForm.eQChapterCode) {
					donFncForm.eQChapterCode.disabled = true;
				}
			}
			if (donTgtForm.eQBadgeNum.value != "" || blnMemberNum) {
				if (donFncForm.eQBadgeNumber) {
					donFncForm.eQBadgeNumber.disabled = true;
				}
			}
			if (donTgtForm.eQPKPMember.value == "Y" && (donTgtForm.eQKnowsMNum.value == "Y" || donTgtForm.eQKnowsBadgeNum.value == "Y") && ! blnMemberNum) {
				if (donFncForm.CompanyName) {
					donFncForm.CompanyName.disabled = true;
				}
				donFncForm.FirstName.disabled = true;
				donFncForm.LastName.disabled = true;
				donFncForm.Address1.disabled = true;
				donFncForm.Address2.disabled = true;
				donFncForm.CountryCode.disabled = true;
				donFncForm.City.disabled = true;
				donFncForm.State.disabled = true;
				donFncForm.Zip.disabled = true;
				donFncForm.HomePhone.disabled = true;
				donFncForm.WorkPhone.disabled = true;
				donFncForm.WorkPhoneExt.disabled = true;
				donFncForm.EMail.disabled = true;
			}
			if (donTgtForm.CountryCode.value != "UNITED STATES" && donTgtForm.CountryCode.value != "CANADA") {
				donFncForm.State.disabled = true;
			}
			break;
			case "3":
			tgtDiv = document.getElementById("eQCredit");
			tgtDiv2  = document.getElementById("eQACH");
			if (tgtDiv && tgtDiv2) {
				if (checkRadioVal("PaidSource","ACH")) {
					// ACH Selected
					tgtDiv.style.visibility = "hidden";
					tgtDiv2.style.visibility = "visible";
				} else {
					// Credit Selected
					tgtDiv.style.visibility = "visible";
					tgtDiv2.style.visibility = "hidden";
				}
			}
			break;
		}
	}
}
function prevStep(fncStep) {
	if (! isNaN(fncStep)) {
		if (fncStep >=1 && fncStep <= 4) {
			if (donTgtForm) {
				donTgtForm.eQdonStep.value = fncStep;
				donTgtForm.submit();
			}
		}
	}
}
function fixStep(fncStep) {
	if (! isNaN(fncStep)) {
		if (fncStep >=1 && fncStep < 4) {
			if (donTgtForm) {
				donTgtForm.eQdonStep.value = fncStep;
				donTgtForm.submit();
			}
		}
	}
}
function eQgetCursor(e) {
	e = e || window.event;
	var cursor = {x:0, y:0};
	if (e.pageX || e.pageY) {
		cursor.x = e.pageX;
		cursor.y = e.pageY;
	} else {
		cursor.x = e.clientX + (document.documentElement.scrollLeft || document.body.scrollLeft) - document.documentElement.clientLeft;
		cursor.y = e.clientY + (document.documentElement.scrollTop || document.body.scrollTop) - document.documentElement.clientTop;
  }
	return cursor;
}

// JavaScript/XML Code
var xmlREQ;
var xV;
var xV1
var xN;
var xL;
var xForm;
function getXMLHttpRequest() {
	if (typeof XMLHttpRequest != "object") {
		try {
			fncREQ = new ActiveXObject("Msxml2.XMLHTTP");
		} catch (e) {
			try {
				fncREQ = new ActiveXObject("Microsoft.XMLHTTP");
			} catch (e) {
				try {
					fncREQ = new XMLHttpRequest();
				} catch(e) {
					fncREQ = null;
				}
			}
		}
	} else {
		try {
			fncREQ = new XMLHttpRequest();
		} catch (e) {
			fncREQ = null;
		}
	}
	return fncREQ;
}
function processXMLReqChange() {
	// only if req shows "complete"
	if (xmlREQ.readyState == 4) {
		// only if "OK"
		if (xmlREQ.status == 200) {
			// ...processing statements go here...
			xmlRES = xmlREQ.responseText.split("\n");
			if (xmlRES.length > 0) {
				fName = xmlRES[0];
				var xV = parseInt(xmlRES[xmlRES.length-1]);
				eval(fName + "(null," + xV + ",'" + xL + "','',0)");
			} else {
				aWin = alert("There was a problem parsing the data!");
			}
		} else {
			aWin = alert("There was a problem retrieving the XML data:\n" + xmlREQ.statusText);
		}
	}
}
function getXMLResp(strURL,args) {
	xmlREQ = getXMLHttpRequest();
	if (xmlREQ) {
		strURL = strURL + "?" + args;
		xmlREQ.onreadystatechange = processXMLReqChange;
		xmlREQ.open("GET", strURL, true);
		xmlREQ.send(null);
	} else {
		aWin = alert("Your browser does not support a nesessary component of this system.\nPlease update your browser and try again.");
	}
}
function postXMLResp(strURL,args) {
	xmlREQ = getXMLHttpRequest();
	if (xmlREQ) {
		xmlREQ.onreadystatechange = processXMLReqChange;
		xmlREQ.open("POST", strURL, true);
		// For POST, MUST set Content Type to "application/x-www-form-urlencoded; charset=UTF-8" after the .open call
		xmlREQ.setRequestHeader("Content-Type","application/x-www-form-urlencoded; charset=UTF-8");
		xmlREQ.send(args);
	} else {
		aWin = alert("Your browser does not support a nesessary component of this system.\nPlease update your browser and try again.");
	}
}
function checkDUP(fxF, fxR, fxL, fxT, fxPi) {
//	fxF: the actual orignating Field
//	From fxF we can set fxV, fxN, and the 'form'
//	fxV: field val (str), fxN: table field name (str) Note: field name and table field name MUST be the same
//	fxR: XML Response Value (int 1|0), fxL: form field label (str)
//	fxT: table name (str), fxPi: primary key val (int|0)
	if (fxF) {
		fxV = fxF.value;
		fxN = fxF.name;
		form = fxF.form;
	}
	if (fxR != "" && fxL != "") {
		if (fxR == 1) {
			aWin = alert("This " + fxL + " value is already in use.  Each " + fxL +" must be unique!");
			xL = "";
			xmlFLD = eval("form.elements['"+fxN+"']");
			xmlFLD.focus();
		}
	} else {
		xN = fxN;
		xL = fxL;
		if (fxV != "" && fxN != "" && fxT != "") {
			strURL = "/asp/includes/checkDUP.asp"
			args = "f=" + escape(fxN) + "&v=" + escape(fxV) + "&t=" + escape(fxT)
			if (fxPi > 0) {
				args = args + "&i=" + fxPi;
			}
			postXMLResp(strURL,args);
		}
	}
}
function check_mnum(fxF, fxR, fxL, fxT, fxV) {
//	fxF: the Field to be used to determine fxN and the 'form'
//	From fxF we can set fxN, and the 'form'
//	fxV: field val (str), fxN: table field name (str) Note: field name and table field name MUST be the same
//	fxR: XML Response Value (int 1|0), fxL: form field to capture focus on error
//	fxT: table name (str)
	if (fxF != null && fxV != "") {
		xV1 = fxV;
		fxN = fxF.name;
		xForm = fxF.form;
		if (fxL != null && fxL != "") {
			xL = fxL;
		}
	}
	if (fxR != null) {
		if (fxR == 0) {
			aWin = alert("The Member Number you entered is NOT valid.\nPlease check your entried and try again.");
			xL.focus();
		} else {
			var blnRes = false;
			if (donFncForm.MemberNum) {
				donFncForm.MemberNum.value = xV1;
			}
			if (donTgtForm.MemberNum) {
				donTgtForm.MemberNum.value = xV1;
				blnRes = true;
			}
			if (blnRes) {
				if (donTgtForm.name == "donSys") {
					donTgtForm.eQdonStep.value = "2";
				}
				donTgtForm.submit();
			}
		}
	} else {
		xN = fxN;
		if (fxV != "" && fxN != "" && fxT != "") {
			strURL = "/asp/pkpfnet/check_mnum.asp";
			args = "t=" + fxT + "&f=" + fxN + "&v=" + fxV;
			postXMLResp(strURL,args);
		}
	}
}
// End JavaScript/XML Code
// Registration Code
function setRegFields(fncStep) {
	if (donFncForm && donTgtForm && ! isNaN(fncStep)) {
		switch(fncStep) {
			default:
			var blnMemberNum = false;
			if (donTgtForm.MemberNum.value.length == 8) {
				blnMemberNum = true;
			}
			if (donTgtForm.eQSelChapterCode.value != "" || blnMemberNum) {
				if (donFncForm.eQChapterCode) {
					donFncForm.eQChapterCode.disabled = true;
				}
			}
			if (donTgtForm.eQBadgeNum.value != "" || blnMemberNum) {
				if (donFncForm.eQBadgeNumber) {
					donFncForm.eQBadgeNumber.disabled = true;
				}
			}
			if (((donTgtForm.eQKnowsMNum.value == "Y" || donTgtForm.eQKnowsBadgeNum.value == "Y") || (donTgtForm.eQKnowsMNum.value == "N" && donTgtForm.eQKnowsBadgeNum.value == "N")) && ! blnMemberNum) {
				donFncForm.FirstName.disabled = true;
				donFncForm.LastName.disabled = true;
				donFncForm.Address1.disabled = true;
				donFncForm.Address2.disabled = true;
				donFncForm.CountryCode.disabled = true;
				donFncForm.City.disabled = true;
				donFncForm.State.disabled = true;
				donFncForm.Zip.disabled = true;
				donFncForm.HomePhone.disabled = true;
				donFncForm.WorkPhone.disabled = true;
				donFncForm.WorkPhoneExt.disabled = true;
				donFncForm.EMail.disabled = true;
				donFncForm.userPWord.disabled = true;
				donFncForm.userPWord_Confirm.disabled = true;
			}
			if (donTgtForm.CountryCode.value != "UNITED STATES" && donTgtForm.CountryCode.value != "CANADA") {
				donFncForm.State.disabled = true;
			}
			break;
		}
	}
}
function verRegister(fncStep) {
	var blnOK = false;
	var blnErr = false;
	var lngStep = 0;
	var arrFldNames;
	if (! isNaN(fncStep)) {
		lngStep = parseInt(fncStep);
		if (donTgtForm) {
			arrFldNames = Array("MemberNum","FirstName","LastName","Address1","CountryCode","City","State","Zip","HomePhone","EMail","userPWord","userPWord_Confirm");
			var defCurFld = donFncForm.eQChapterCode;
			var defCurFld2 = donFncForm.eQBadgeNum;
			var defCurFld3 = donFncForm.FirstName;
			for (var i=0;i<arrFldNames.length;i++) {
				var curVal = eval("donTgtForm."+arrFldNames[i]+".value");
				var curFld = eval("donFncForm."+arrFldNames[i]);
				if (trim(curVal) == "") {
					blnErr = true;
					switch(i) {
						case 0:
						if (donTgtForm.eQPKPMember.value == "Y" && (donTgtForm.eQKnowsMNum.value == "Y" || donTgtForm.eQKnowsBadgeNum.value == "Y")) {
								aWin = alert("Your Member Number has not been recorded properly.\nPlease check your entries and/or click 'Correct the entered\nMember Number' to correct it.");
								if (defCurFld && defCurFld.disabled == false) {
									defCurFld.focus();
								} else {
									if (defCurFld2 && defCurFld2.disabled == false) {
										defCurFld2.focus();
									} else {
										defCurFld3.focus();
									}
								}
						} else {
							blnErr = false;
						}
						break;
						case 4:
						aWin = alert("You must make a selection!");
						curFld.focus();
						break;
						case 6:
						var tmpVal = donTgtForm.CountryCode.value;
						if (tmpVal == "UNITED STATES" || tmpVal == "CANADA") {
							aWin = alert("You must make a selection!");
							curFld.focus();
						} else {
							blnErr = false;
						}
						break;
						case 7:
						var tmpVal = donTgtForm.CountryCode.value;
						if (tmpVal == "UNITED STATES" || tmpVal == "CANADA") {
							aWin = alert("You must make an entry in this field!");
							curFld.focus();
						} else {
							blnErr = false;
						}
						break;
						default:
						aWin = alert("You must make an entry in this field!");
						curFld.focus();
						break;
					}
					if (blnErr) {
						break;
					}
				}
			}
			if (! blnErr) {
				curVal = donTgtForm.EMail.value;
				if (! validEmail(curVal)) {
					blnErr = true;
					aWin = alert("You must enter a valid e-mail address!");
					donFncForm.EMail.focus();
				}
				if (! blnErr) {
					for (var i=10;i<12;i++) {
						var curVal = eval("donTgtForm."+arrFldNames[i]+".value");
						var curFld = eval("donFncForm."+arrFldNames[i]);
						switch(i) {
							case 10:
							var tmpVal = trim(donTgtForm.userPWord_Confirm.value);
							if (curVal == "" || curVal != tmpVal || curVal.length < 6) {
								blnErr = true;
								aWin = alert("Your Password and Confirm Password entries must each be at least 6 and not more than 20 characters and must match!");
								curFld.focus();
							}
							break;
							case 11:
							var tmpVal = trim(donTgtForm.userPWord.value);
							if (curVal == "" || curVal != tmpVal || curVal.length < 6) {
								blnErr = true;
								aWin = alert("Your Password and Confirm Password entries must each be at least 6 and not more than 20 characters and must match!");
								curFld.focus();
							}
							break;
						}
						if (blnErr) {
							break;
						}
					}
				}
			}
			blnOK = ! blnErr;
		}
	}
	if (blnOK) {
		donTgtForm.eQdonStep.value = "2"
		donTgtForm.submit();
	}
}
// End Registration

// Logon Code
function verLogin(fncForm) {
	strMN = trim(fncForm.MemberNum.value);
	strUPW = trim(fncForm.userPWord.value);
	if ((strMN.length == 8 && strMN.indexOf("-") == 3) && (strUPW.length > 5 && strUPW.length < 21)) {
		varMN = strMN.split("-");
		if ((! isNaN(varMN[0])) && (! isNaN(varMN[1]))) {
			return true;
		} else {
			aWin = alert("Your Member Number and/or your Password are not valid.\nThe Member Number must be 8 characters consisting of 3 digits, a hyphen and 4 more digits, i.e., ###-####.\nThe Password must be at least 6 but not more than 20 characters (no spaces).");
			return false;
		}
	} else {
		aWin = alert("Your Member Number and/or your Password are not valid.\nThe Member Number must be 8 characters consisting of 3 digits, a hyphen and 4 more digits, i.e., ###-####.\nThe Password must be at least 6 but not more than 20 characters (no spaces).");
		return false;
	}
}
function verForgot(srcForm,tgtForm) {
	if (srcForm && tgtForm) {
		strMN = srcForm.MemberNum.value;
		if (strMN.length == 8 && strMN.indexOf("-") == 3) {
			varMN = strMN.split("-");
			if ((! isNaN(varMN[0])) && (! isNaN(varMN[1]))) {
				tgtForm.MemberNum.value = strMN;
				tgtForm.submit();
			} else {
				aWin = alert("Your Member Number is not valid.\nThe Member Number must be 8 characters consisting of 3 digits, a hyphen and 4 more digits, i.e., ###-####.");
				return false;
			}
		} else {
			aWin = alert("Please enter your 8 character 'Member Number' above and click 'Forgot Password' again.");
			return false;
		}
	}
}
// End Logon
// National Scholarship and International Fellowship Functions
function setAwards(fncFld) {
	fncForm = fncFld.form;
	if (fncForm) {
		tgtFld = fncForm.awards;
		if (tgtFld) {
			srcFld1 = fncForm.spring_awards;
			srcFld2 = fncForm.fall_awards;
			if (srcFld1 || srcFld2) {
				numSel = 0;
				tgtStr = "";
				if (srcFld1) {
					for (x=0;x<srcFld1.options.length;x++) {
						if (srcFld1.options[x].selected) {
							if (numSel > 0) {
								tgtStr = tgtStr + ",";
							}
							tgtStr = tgtStr + srcFld1.options[x].value;
							numSel++;
						}
					}
				}
				if (srcFld2) {
					for (x=0;x<srcFld2.options.length;x++) {
						if (srcFld2.options[x].selected) {
							if (numSel > 0) {
								tgtStr = tgtStr + ",";
							}
							tgtStr = tgtStr + srcFld2.options[x].value;
							numSel++;
						}
					}
				}
				tgtFld.value = tgtStr;
			}
		}
	}
}
// End NS and IF Functions
// End e-QualIT Code
// Macromedia Code follows
var ns4 = document.layers;
var ns6 = document.getElementById && !document.all;
var ie4 = document.all;
offsetX = 0;
offsetY = -40;
var toolTipSTYLE="";
function initToolTips()
{
  if(ns4||ns6||ie4)
  {
    if(ns4) toolTipSTYLE = document.toolTipLayer;
    else if(ns6) toolTipSTYLE = document.getElementById("toolTipLayer").style;
    else if(ie4) toolTipSTYLE = document.all.toolTipLayer.style;
    if(ns4) document.captureEvents(Event.MOUSEMOVE);
    else
    {
      toolTipSTYLE.visibility = "visible";
      toolTipSTYLE.display = "none";
    }
    document.onmousemove = moveToMouseLoc;
  }
}
function toolTip(msg, fg, bg)
{
  if(toolTip.arguments.length < 1) // hide
  {
    if(ns4) toolTipSTYLE.visibility = "hidden";
    else toolTipSTYLE.display = "none";
  }
  else // show
  {
    if(!fg) fg = "#666666";
    if(!bg) bg = "#FFFFFF";
    var content =
    '<table border="0" cellspacing="0" cellpadding="1" bgcolor="' + fg + '"><td>' +
    '<table border="0" cellspacing="0" cellpadding="1" bgcolor="' + bg + 
    '"><td align="center"><span style="font-face:sans-serif;color:"' + fg +
    ';font-size:-2">&nbsp\;' + msg +
    '&nbsp\;</span></td></table></td></table>';
    if(ns4)
    {
      toolTipSTYLE.document.write(content);
      toolTipSTYLE.document.close();
      toolTipSTYLE.visibility = "visible";
    }
    if(ns6)
    {
      document.getElementById("toolTipLayer").innerHTML = content;
      toolTipSTYLE.display='block'
    }
    if(ie4)
    {
      document.all("toolTipLayer").innerHTML=content;
      toolTipSTYLE.display='block'
    }
  }
}
function moveToMouseLoc(e)
{
	var cursor = eQgetCursor(e);
  toolTipSTYLE.left = cursor.x + offsetX + "px";
  toolTipSTYLE.top = cursor.y + offsetY + "px";
  return true;
}
// End Macromedia
// Original Code Copyright 2006 by e-QualIT.  All rights reserved.
function valTextField(fncField, blnReq) {
	var blnOK = false;
	if (fncField) {
		var fncVal = trim(fncField.value);
		if (fncVal != "" || (fncVal == "" && ! blnReq)) {
			fncField.value = fncVal;
			blnOK = true;
			return blnOK;
		} else {
			fncField.value = fncVal;
			aWin = alert("You must make an entry in this field!");
			fncField.focus();
			return blnOK;
		}
	}
}
function valComboBox(fncField) {
	var blnRes = false;
	if (fncField) {
		var fncVal = fncField.options[fncField.selectedIndex].value;
		if (fncVal == "") {
			aWin = alert("You must make a selection!");
			fncField.focus();
		} else {
			blnRes = true;
		}
	}
	return blnRes;
}
function matchPat(fncMatchVal, fncMatchPat) {
	var blnMatch = false;
	if (fncMatchVal != "") {
		var fncRE = new RegExp(fncMatchPat, "i");
		var regRes = fncMatchVal.match(fncRE);
		if (regRes != null) {
			blnMatch = true;
		}
	}
	return blnMatch;
}
function valYear(fncField, fncMin, fncMax) {
	var blnOK = false;
	var alertMsg = "You must enter a valid year";
	if (fncField) {
		var fncVal = trim(fncField.value);
		if (matchPat(fncVal, "^\\d{4}$")) {
			fncVal = parseFloat(fncVal);
			if (fncMin != null && fncMax != null) {
				if (fncVal >= fncMin && fncVal <= fncMax) {
					blnOK = true;
				} else {
					alertMsg = alertMsg + "\nbetween " + fncMin + " and " + fncMax & "inclusive.";
				}
			} else {
				if (fncMin == null && fncMax == null) {
					blnOK = true;
					alertMsg = alertMsg + ".";
				} else {
					if (fncMin != null) {
						if (fncVal >= fncMin) {
							blnOK = true;
						} else {
							alertMsg = alertMsg + " >= " + fncMin + ".";
						}
					} else {
						if (fncVal <= fncMax) {
							blnOK = true;
						} else {
							alertMsg = alertMsg + " <= " + fncMax + ".";
						}
					}
				}
			}
		} else {
			alertMsg = alertMsg + ".";
		}
	} else {
		alertMsg = alertMsg + ".";
	}
	if (! blnOK) {
		fncField.value = "";
		fncField.focus();
		aWin = alert(alertMsg);
	}
	return blnOK;
}
function valEmail(fncField) {
	var fncVal = trim(fncField.value);
	if (! validEmail(fncVal)) {
		fncField.value = fncVal;
		aWin = alert("You must enter a valid e-mail address!");
		fncField.focus();
	}
}
function valDate(fncField, fncPat) {
	var blnOK = false;
	var alertMsg = "You must enter a valid date in the " + fncPat + " format.";
	if (fncField) {
		var fncVal = trim(fncField.value);
		if (fncPat == "mm/dd/yyyy") {
			if (matchPat(fncVal, "^\\d{2}/\\d{2}/\\d{4}$")) {
				blnOK = true;
			}
		} else {
			if (fncPat == "mm/yyyy") {
				if (matchPat(fncVal, "^\\d{2}/\\d{4}$")) {
					blnOK = true;
				}
			}
			if (fncPat == "mm/yyyy or 'Present'") {
				if (matchPat(fncVal, "^\\d{2}/\\d{4}$") || matchPat(fncVal, "^Present$")) {
					blnOK = true;
				}
			}
		}
	}
	if (! blnOK) {
		fncField.focus();
		aWin = alert(alertMsg);
	}
	return blnOK;
}
// AJAX KeepAlive
var kalREQ;
var kV;
var kAlive;
function processKAXMLReqChange() {
	// only if req shows "complete"
	if (kalREQ.readyState == 4) {
		// only if "OK"
		if (kalREQ.status == 200) {
			// ...processing statements go here...
			xmlKARES = kalREQ.responseText.split("\n");
			if (xmlKARES.length > 0) {
				fName = xmlKARES[0];
				kV = xmlKARES[1];
				eval(fName + "(" + kV + ")");
			} else {
				aWin = alert("There was a problem parsing the data!");
			}
		} else {
			aWin = alert("There was a problem retrieving the XML data:\n" + kalREQ.statusText);
		}
	}
}
function postKAXMLResp(strURL,args) {
	kalREQ = getXMLHttpRequest();
	if (kalREQ) {
		kalREQ.onreadystatechange = processKAXMLReqChange;
		kalREQ.open("POST", strURL, true);
		// For POST, MUST set Content Type to "application/x-www-form-urlencoded; charset=UTF-8" after the .open call
		kalREQ.setRequestHeader("Content-Type","application/x-www-form-urlencoded; charset=UTF-8");
		kalREQ.send(args);
	}
}
function keepAlive(fx1) {
//	fx1: dummy variable (null| !null)
	if (fx1 == null) {
		strURL = "/asp/includes/keepAlive.asp";
		args = "f="+Math.random();
		postKAXMLResp(strURL,args);
	} else {
		if (kAlive) {
			clearTimeout(kAlive);
		}
		var strHref = location.href.toLowerCase();
		if (strHref.indexOf("_application.asp") != -1) {
			kAlive = setTimeout("keepAlive(" + null + ")", 900000);
		}
	}
}
if (kAlive) {
	clearTimeout(kAlive);
}
var strHref2 = location.href.toLowerCase();
if (strHref2.indexOf("_application.asp") != -1) {
	keepAlive(null);
}
// End AJAX KeepAlive
// Limit textarea input
function setMaxLength() {
	var x = document.getElementsByTagName("textarea");
	var counter = document.createElement("div");
	counter.className = "counter";
	for (var i=0;i<x.length;i++) {
		if (x[i].getAttribute("maxlength")) {
			var counterClone = counter.cloneNode(true);
			counterClone.relatedElement = x[i];
			counterClone.innerHTML = "<span>0</span> of "+x[i].getAttribute("maxlength")+" chars max";
			x[i].parentNode.insertBefore(counterClone,x[i].nextSibling);
			x[i].relatedElement = counterClone.getElementsByTagName("span")[0];
			x[i].onkeyup = x[i].onchange = checkMaxLength;
			x[i].onkeyup();
		}
	}
}
function checkMaxLength() {
	var maxLength = this.getAttribute("maxlength");
	var currentLength = this.value.length;
	if (currentLength > maxLength) {
		this.relatedElement.className = "toomuch";
	} else {
		this.relatedElement.className = "";
	}
	this.relatedElement.firstChild.nodeValue = currentLength;
}
// End textarea
// Brick Campaign Code
function setDonationIntent(fncField) {
	if (fncField) {
		if (donTgtForm) {
			var fncVal = remAllSpaces(fncField.value);
			if (fncVal == "eQbrick") {
				shwDiv = document.getElementById("eQbrick");				
				hidDiv = document.getElementById("eQstd");
			} else {
				hidDiv = document.getElementById("eQbrick");
				shwDiv = document.getElementById("eQstd");
			}
			if (shwDiv) {
				shwDiv.className = "";
			}
			if (hidDiv) {
				hidDiv.className = "eQnone";
			}
			donTgtForm.eQDonationIntent.value = fncVal;
		}
	}
}
function setPdAmtTotal() {
	var brkStr = donTgtForm.eQBrickAmount.value;
	var othStr = donTgtForm.eQOtherAmount.value;
	var brkVal = 0.00;
	if (brkStr != "") {
		brkVal = parseFloat(brkStr);
	}
	var othVal = 0.00;
	if (othStr != "") {
		othVal = parseFloat(othStr);
	}
	var paVal = brkVal + othVal;
	var paStr = formatCurrency(paVal.toString());
	donFncForm.eQTotalAmount.value = paStr;
	donFncForm.PaidAmount.value = paStr;
	donTgtForm.PaidAmount.value = paStr;
}
function setNumBricks(fncField) {
	var fncVal = fncField.options[fncField.selectedIndex].value;
	var brkVal = fncVal * 250.00;
	var brkStr = formatCurrency(brkVal.toString());
	var OthAmtSel = donFncForm.eQBrickSponsorship.selectedIndex;
	donTgtForm.eQNumBricks.value = fncVal;
	if (OthAmtSel == 0) {
		donTgtForm.eQNumItems.value = fncVal;
	} else {
		donTgtForm.eQNumItems.value = parseInt(fncVal) + 1;
	}
	donFncForm.eQBrickAmount.value = brkStr;
	donTgtForm.eQBrickAmount.value = brkStr;
	setPdAmtTotal();
	fncField.focus();
}
function setOtherAmount(fncField) {
	var strVal = fncField.options[fncField.selectedIndex].value;
	var fncArr = strVal.split(":");
	var fncIdx = parseInt(fncArr[0]);
	var fncVal = parseInt(fncArr[1]);
	var othStr = formatCurrency(fncVal.toString());
	donTgtForm.eQBrickSponsorship.value = strVal;
	donFncForm.eQOtherAmount.value = othStr;
	donTgtForm.eQOtherAmount.value = othStr;
	donTgtForm.eQBrickSponsorshipText.value = "";
	if (fncIdx > 0) {
		donTgtForm.eQBrickSponsorshipText.value = fncField.options[fncField.selectedIndex].text;
		var tgtDiv = document.getElementById("eQFirst");
		if (tgtDiv) {
			tgtDiv.innerHTML = "1 (OSO)";
		}
		var curNum = donTgtForm.eQNumBricks.value;
		if (! isNaN(curNum)) {
			donTgtForm.eQNumItems.value = parseInt(curNum) + 1;
		}
	} else {
		var tgtDiv = document.getElementById("eQFirst");
		if (tgtDiv) {
			tgtDiv.innerHTML = "1";
		}
		var curNum = donTgtForm.eQNumBricks.value;
		if (! isNaN(curNum)) {
			donTgtForm.eQNumItems.value = curNum;
		}
	}
	setPdAmtTotal();
	fncField.focus();
}
function setUCTextField(fncField, fncLine) {
	var fncVal = trim(fncField.value);
	if (fncVal != "") {
		fncField.value = fncVal.toUpperCase();
		setTextField(fncField, true);
	} else {
		if (fncLine > 1) {
			setTextField(fncField, false);
		} else {
			setTextField(fncField, true);
		}
	}
}
function checkPrevInsc(fncCurIdx) {
	blnRes = false;
	if (! isNaN(fncCurIdx)) {
		tgtFld = eval("donTgtForm.eQLine_" + fncCurIdx + "_1");
		frmFld = eval("donFncForm.eQLine_" + fncCurIdx + "_1");
		if (tgtFld) {
			if (tgtFld.value != "") {
				blnRes = true;
			} else {
				if (frmFld) {
					aWin = alert("You must complete the previous inscription before attempting to 'Inscribe Another'!");
					frmFld.focus();
				}
			}
		}
	}
	return blnRes;
}
function addInscRow(strNumBricks, strNumInscribe) {
	if (! isNaN(strNumBricks) && ! isNaN(strNumInscribe)) {
		fncNumBricks = parseInt(strNumBricks);
		fncNumInscribe = parseInt(strNumInscribe);
		blnCont = checkPrevInsc(strNumInscribe);
		if (blnCont) {
			if (fncNumInscribe < fncNumBricks) {
				tgtNumInscribe = fncNumInscribe+1;
				tgtElem = document.getElementById("eQLine" + tgtNumInscribe.toString());
				if (tgtElem) {
					tgtElem.className = "";
					donTgtForm.eQNumInscribe.value = tgtNumInscribe;
					tgtElem = document.getElementById("eQLine_" + tgtNumInscribe.toString() + "_1");
					if (tgtElem) {
						tgtElem.focus();
					}
				}
			} else {
				aWin = alert("You have already inscribed all of your items!");
			}
		}	
	}
}
function delInscRow(fncLineNum) {
	if (! isNaN(fncLineNum)) {
		blnCont = window.confirm("Are you sure you want to delete Brick " + fncLineNum + "'s inscription?");
		if (blnCont) {
			for (j=1;j<4;j++) {
				tgtElem = document.getElementById("eQLine_" + fncLineNum.toString() + "_" + j.toString());
				if (tgtElem) {
					tgtElem.value = "";
					setTextField(tgtElem, false);
				}
			}
			tgtElem = document.getElementById("eQLine" + fncLineNum.toString());
			if (tgtElem) {
				tgtElem.className = "eQnone";
				donTgtForm.eQNumInscribe.value = parseInt(donTgtForm.eQNumInscribe.value) - 1;
			}
		}
	}
}
function setBrickAppealCode(fncField) {
	if (fncField) {
		if (donTgtForm) {
			var fncVal = fncField.options[fncField.selectedIndex].value;
			var fncDate = new Date();
			var dStr = fncDate.getYear().toString();
			var preDate = dStr.substr(dStr.length-2,dStr.length-1);
			var payOpts = donFncForm.NumPayments;
			switch(fncVal) {
				case "1Time":
				for (var i=1;i<61;i++) {
					strI = i.toString();
					tmpRes = removeOption(payOpts,strI);
				}
				tmpRes = addOption(payOpts,"1","1");
				donFncForm.NumPayments.selectedIndex = 1;
				donFncForm.NumPayments.disabled = true;
				donTgtForm.GiftType.value = fncVal;
				donTgtForm.AppealCode.value = preDate + "BRKWEB";
				donTgtForm.eQFreq.value = "";
				donTgtForm.NumPayments.value = "1";
				break;
				case "R:Mon":
				donFncForm.NumPayments.disabled = false;
				donFncForm.NumPayments.selectedIndex = 0;
				donTgtForm.GiftType.value = fncVal;				
				donTgtForm.AppealCode.value = preDate + "BRKWEBR";
				donTgtForm.eQFreq.value = "MONT";
				donTgtForm.NumPayments.value = "0";
				for (var i=1;i<61;i++) {
					strI = i.toString();
					tmpRes = removeOption(payOpts,strI);
				}
				for (i=2;i<61;i++) {
					strI = i.toString();
					tmpRes = addOption(payOpts,strI,strI);
				}
				break;
				case "R:Qtr":
				donFncForm.NumPayments.disabled = false;
				donFncForm.NumPayments.selectedIndex = 0;
				donTgtForm.GiftType.value = fncVal;
				donTgtForm.AppealCode.value = preDate + "BRKWEBR";
				donTgtForm.eQFreq.value = "QTER";
				donTgtForm.NumPayments.value = "0";
				for (var j=1;j<61;j++) {
					strJ = j.toString();
					tmpRes = removeOption(payOpts,strJ);
				}
				for (j=2;j<21;j++) {
					strJ = j.toString();
					tmpRes = addOption(payOpts,strJ,strJ);
				}
				break;
				case "R:Ann":
				donFncForm.NumPayments.disabled = false;
				donFncForm.NumPayments.selectedIndex = 0;
				donTgtForm.GiftType.value = fncVal;				
				donTgtForm.AppealCode.value = preDate + "BRKWEBR";
				donTgtForm.eQFreq.value = "YEAR";
				donTgtForm.NumPayments.value = "0";
				for (var i=1;i<61;i++) {
					strI = i.toString();
					tmpRes = removeOption(payOpts,strI);
				}
				for (i=2;i<6;i++) {
					strI = i.toString();
					tmpRes = addOption(payOpts,strI,strI);
				}
				break;
			}
			var summDiv = document.getElementById("eQGiftSumm");
			if (summDiv) {
				if (summDiv.style.visibility == "visible") {
					setNumPayments(donFncForm.NumPayments);
				}
			}
			blnAppealCodeSet = true;
		}
	}
}
function verBrickDonation(fncStep) {
	var blnOK = false;
	var blnErr = false;
	var lngStep = 0;
	var arrFldNames;
	if (! isNaN(fncStep)) {
		lngStep = parseInt(fncStep);
		if (donTgtForm) {
			switch(lngStep) {
				case 1:
				arrFldNames = Array("PaidAmount","AppealCode","NumPayments","FundCode","HonoreeName","HonoreeAddr");
				for (var i=0;i<4;i++) {
					var curVal = eval("donTgtForm."+arrFldNames[i]+".value");
					if (i == 0) {
						blnAppealCodeSet = true;
						if (! donFncForm.PaidAmount.disabled) {
							blnErr = setPaidAmount(donFncForm.PaidAmount);
							if (blnErr) {
								break;
							}
						} else {
							if (curVal != "" && ! isNaN(curVal)) {
								if (parseFloat(curVal) == 0) {
									blnErr = true;
									aWin = alert("You must select at least 1 Brick and/or an 'Other Sponsorship Opportunity'!");
									break;
								}
							} else {
								blnErr = true;
								aWin = alert("You must select at least 1 Brick and/or an 'Other Sponsorship Opportunity'!");
								break;
							}
						}
					}
					if (i == 3) {
						var fCode = curVal;
					}
					if (trim(curVal) == "") {
						blnErr = true;
						aWin = alert("An error occurred. Please contact the system administrator.");
						break;
					}
				}
				if (! blnErr) {
					// Handles new eQHonMem field
					var eQFld = donTgtForm.eQHonMem;
					if (eQFld) {
						fCode = eQFld.value;
					}
					// End eQHonMem
					if (fCode == "HONOR" || fCode == "MEMOR") {
						curVal = eval("donTgtForm."+arrFldNames[4]+".value");
						if (trim(curVal) == "") {
							blnErr = true;
							aWin = alert("The Honoree Name cannot be blank!");
							donFncForm.HonoreeName.focus();
						}
						if (fCode == "HONOR" && ! blnErr) {
							curVal = eval("donTgtForm."+arrFldNames[5]+".value");
							if (trim(curVal) == "") {
								blnErr = true;
								aWin = alert("The Honoree Address cannot be blank!");
								donFncForm.HonoreeAddr.focus();
							}
						}
					}
				}
				// Handle Brick specific
				if (! blnErr) {
					fCode = "";
					eQFld = donTgtForm.eQDonationIntent;
					if (eQFld) {
						fCode = eQFld.value;
					}
					if (fCode == "eQbrick") {
						fCode = "";
						eQFld = donTgtForm.eQNumInscribe;
						if (eQFld) {
							fCode = eQFld.value;
						}
						if (! isNaN(fCode)) {
							var loopIdx = parseInt(fCode);
							for (i=1;i<=loopIdx;i++) {
								eQFld = eval("donTgtForm.eQLine_" + i.toString() + "_1");
								eQFocusFld = eval("donFncForm.eQLine_" + i.toString() + "_1");
								if (eQFld) {
									fCode = trim(eQFld.value);
									if (fCode == "") {
										blnErr = true;
										aWin = alert("You must make an entry in this field!");
										if (eQFocusFld) {
											eQFocusFld.focus();
										}
										break;
									}
								}
							}
							if (! blnErr) {
								eQFld = donTgtForm.eQNumItems;
								if (eQFld) {
									fCode = eQFld.value;
									if (! isNaN(fCode)) {
										fncNI = parseInt(fCode)
										if (fncNI < loopIdx) {
											blnErr = true;
											aWin = alert("You have entered more inscritpions than you currently have items!\nYou must delete an inscription.");
										}
									}
								}
							}
						}
					}
				}
				// End Brick
				break;
				case 2:
				arrFldNames = Array("MemberNum","CompanyName","FirstName","LastName","Address1","CountryCode","City","State","Zip","HomePhone","EMail");
				var defCurFld = donFncForm.eQChapterCode;
				var defCurFld2 = donFncForm.eQBadgeNum;
				var defCurFld3 = donFncForm.FirstName;
				for (var i=0;i<arrFldNames.length;i++) {
					var curVal = eval("donTgtForm."+arrFldNames[i]+".value");
					var curFld = eval("donFncForm."+arrFldNames[i]);
					if (trim(curVal) == "") {
						blnErr = true;
						switch(i) {
							case 0:
							if (donTgtForm.eQPKPMember.value == "Y" && (donTgtForm.eQKnowsMNum.value == "Y" || donTgtForm.eQKnowsBadgeNum.value == "Y")) {
									aWin = alert("Your Member Number has not been recorded properly.\nPlease check your entries and/or click 'Correct the entered\nMember Number' to correct it.");
									if (defCurFld && defCurFld.disabled == false) {
										defCurFld.focus();
									} else {
										if (defCurFld2 && defCurFld2.disabled == false) {
											defCurFld2.focus();
										} else {
											defCurFld3.focus();
										}
									}
							} else {
								blnErr = false;
							}
							break;
							case 1:
							if (donTgtForm.DonationSource.value == "Company") {
								aWin = alert("You must make an entry in this field!");
								curFld.focus();
							} else {
								blnErr = false;
							}
							break;
							case 5:
							aWin = alert("You must make a selection!");
							curFld.focus();
							break;
							case 7:
							var tmpVal = donTgtForm.CountryCode.value;
							if (tmpVal == "UNITED STATES" || tmpVal == "CANADA") {
								aWin = alert("You must make a selection!");
								curFld.focus();
							} else {
								blnErr = false;
							}
							break;
							case 8:
							var tmpVal = donTgtForm.CountryCode.value;
							if (tmpVal == "UNITED STATES" || tmpVal == "CANADA") {
								aWin = alert("You must make an entry in this field!");
								curFld.focus();
							} else {
								blnErr = false;
							}
							break;
							default:
							aWin = alert("You must make an entry in this field!");
							curFld.focus();
							break;
						}
						if (blnErr) {
							break;
						}
					}
				}
				if (! blnErr) {
					curVal = donTgtForm.EMail.value;
					if (! validEmail(curVal)) {
						blnErr = true;
						aWin = alert("You must enter a valid e-mail address!");
						donFncForm.EMail.focus();
					}
				}
				break;
				case 3:
				arrFldNames = Array("eQCardNumber","PaidCCExpDate","eQSecurityCode","eQBankName","eQRoutingNum","eQAccountNum");
				var stepMD = donTgtForm.PaidSource.value;
				if (stepMD == "ACH") {
					// ACH Selected: Destroy Credit Info
					donTgtForm.eQCardNumber.value = "";
					donTgtForm.eQExpMon.value = "";
					donTgtForm.eQExpYr.value = "";
					donTgtForm.PaidCCExpDate.value = "";
					donTgtForm.eQSecurityCode.value = "";
					for (var i=3;i<arrFldNames.length;i++) {
						var curVal = eval("donTgtForm."+arrFldNames[i]+".value");
						var curFld = eval("donFncForm."+arrFldNames[i]);
						if (trim(curVal) == "") {
							blnErr = true;
							aWin = alert("You must make an entry in this field!");
							curFld.focus();
							break;
						}
					}
				} else {
					// Credit Selected: Destroy ACH Info
					donTgtForm.eQBankName.value = "";
					donTgtForm.eQAccountType.value = "";
					donTgtForm.eQRoutingNum.value = ""; 
					donTgtForm.eQAccountNum.value = "";
					for (var i=0;i<3;i++) {
						var curVal = eval("donTgtForm."+arrFldNames[i]+".value");
						var curFld = eval("donFncForm."+arrFldNames[i]);
						if (trim(curVal) == "") {
							blnErr = true;
							if (i != 1) {
								aWin = alert("You must make an entry in this field!");
								curFld.focus();
							} else {
								aWin = alert("You must make selections to determine your Card Expiration Date!");
								donFncForm.eQExpMon.focus();
							}
							break;
						}
					}
				}
				break;
				case 4:
				if (donFncForm.GiftAuth.checked == false) {
					blnErr = true;
					aWin = alert("You must check the box to authorize your gift transaction(s)!");
				}
				break;
			}
			blnOK = ! blnErr;
		}
	}
	if (blnOK) {
		if (lngStep == 4) {
			var ip = donTgtForm.IPAddr.value;
//			if (ip == "74.133.43.169") {
				donTgtForm.submit();
//			}
		} else {
			donTgtForm.submit();
		}
	}
}
// End Brick
// Bridge Builder Society
function setBBL() {
//	tgtElem = parent.document.getElementById("bbl");
	tgtElem = document.getElementById("bblLevel");
//	tgtIcon = document.getElementById("bbli");
	if (tgtElem) {
		pdAmt = 0;
		var tgtText = "";
		if (donTgtForm) {
			tgtFld = donTgtForm.PaidAmount;
			if (tgtFld) {
				pdAmt = parseInt(tgtFld.value);
			}
		}
		if (pdAmt < 250) {
		    tgtText = "Level: None";
		} else {
			if (pdAmt >= 250 && pdAmt < 500) {
			    tgtText = "Level: Ruby"
			} else {
				if (pdAmt >= 500 && pdAmt < 1000) {
			        tgtText = "Level: Pearl"
			    } else {
					if (pdAmt >= 1000 && pdAmt < 2500) {
					    tgtText = "Level: Emerald"
					} else {
						if (pdAmt >= 2500) {
			                tgtText = "Level: Diamond"
			    		}
					}
				}
			}
		}
		tgtElem.innerText = tgtText;
	}
}
// End Bridge Builder
// Telefund
function setTelefundAppealCode(fncField) {
	if (fncField) {
		if (donTgtForm) {
			var fncVal = fncField.options[fncField.selectedIndex].value;
			var fncDate = new Date();
			var dStr = fncDate.getYear().toString();
			var preDate = dStr.substr(dStr.length-2,dStr.length-1);
			var payOpts = donFncForm.NumPayments;
			switch(fncVal) {
				case "1Time":
				for (var i=1;i<61;i++) {
					strI = i.toString();
					tmpRes = removeOption(payOpts,strI);
				}
				tmpRes = addOption(payOpts,"1","1");
				donFncForm.NumPayments.selectedIndex = 1;
				donFncForm.NumPayments.disabled = true;
				donTgtForm.GiftType.value = fncVal;
				donTgtForm.AppealCode.value = preDate + "EMMAWEB";
				donTgtForm.eQFreq.value = "";
				donTgtForm.NumPayments.value = "1";
				break;
				case "R:Mon":
				donFncForm.NumPayments.disabled = false;
				donFncForm.NumPayments.selectedIndex = 0;
				donTgtForm.GiftType.value = fncVal;				
				donTgtForm.AppealCode.value = preDate + "EMMAWEBR";
				donTgtForm.eQFreq.value = "MONT";
				donTgtForm.NumPayments.value = "0";
				for (var i=1;i<61;i++) {
					strI = i.toString();
					tmpRes = removeOption(payOpts,strI);
				}
				for (i=2;i<61;i++) {
					strI = i.toString();
					tmpRes = addOption(payOpts,strI,strI);
				}
				break;
				case "R:Qtr":
				donFncForm.NumPayments.disabled = false;
				donFncForm.NumPayments.selectedIndex = 0;
				donTgtForm.GiftType.value = fncVal;
				donTgtForm.AppealCode.value = preDate + "EMMAWEBR";
				donTgtForm.eQFreq.value = "QTER";
				donTgtForm.NumPayments.value = "0";
				for (var j=1;j<61;j++) {
					strJ = j.toString();
					tmpRes = removeOption(payOpts,strJ);
				}
				for (j=2;j<21;j++) {
					strJ = j.toString();
					tmpRes = addOption(payOpts,strJ,strJ);
				}
				break;
				case "R:Ann":
				donFncForm.NumPayments.disabled = false;
				donFncForm.NumPayments.selectedIndex = 0;
				donTgtForm.GiftType.value = fncVal;				
				donTgtForm.AppealCode.value = preDate + "EMMAWEBR";
				donTgtForm.eQFreq.value = "YEAR";
				donTgtForm.NumPayments.value = "0";
				for (var i=1;i<61;i++) {
					strI = i.toString();
					tmpRes = removeOption(payOpts,strI);
				}
				for (i=2;i<6;i++) {
					strI = i.toString();
					tmpRes = addOption(payOpts,strI,strI);
				}
				break;
			}
			var summDiv = document.getElementById("eQGiftSumm");
			if (summDiv) {
				if (summDiv.style.visibility == "visible") {
					setNumPayments(donFncForm.NumPayments);
				}
			}
			blnAppealCodeSet = true;
		}
	}
}
// End Telefund
// End e-QualIT
// Unhide -->