var xWin = null; function isPopupBlocked() { xWin=window.open('/index.html','xWin','width=1,height=1'); setTimeout("testWin()",700); } function testWin() { if ((xWin==null) ||(typeof(xWin)=="undefined") ||(typeof(xWin.location.hash)!="string")) { alert('We have detected that you are using popup blocking software.\n This website needs to open a window to your internet Banking Website.\n Please disable your popup blocker.'); } window.focus(); xWin.close(); } function required() { this.aa = new Array("amount", "Donation amount"); this.ab = new Array("paymentVia", "Payment Via"); } function validateReferenceNumber(form) { var payee; var info = getValue(mform.payeeId); if (info.length > 0) { payee = getPayee(info); } return validateBillAccNoAndRefNo(payee,form); } function validateBillAccNoAndRefNo(payee,form) { var billRefNoObj = new Array(); var theform = document.forms[0]; for (k=3; k<25; k++){ billRefNoObj[k] = ''; } k=3; for (k=3; k<25; k++){ fieldname = "billRefNo" + k.toString(10); for (i=0; i 0) { limit = limit + "."; for (i = 0; i < frac; i++) { limit = limit + "9"; } } if (isNaN(parseFloat(min, 10))) min = parseFloat(limit, 10) * -1; if (isNaN(parseFloat(max, 10))) max = parseFloat(limit, 10); if ((parseFloat(field.value, 10) < min) || (parseFloat(field.value, 10) > max)) { field.select(); field.focus(); alert(formatText("The Minimum Amount of Donation is RM10.00.\n\nThank You.", fieldName, toNumeric(min.toString(),frac), toNumeric(max.toString(),frac))); return false; } field.value = toNumeric(field.value, frac); } return true; } function toCancel(thisForm) { thisForm.target="_self"; thisForm.action = "/TIBSEPWeb/fpxPaymentToNGO_add.do"; thisForm.onsubmit = "return true;"; } function redirect() { window.location.href="/TIBSEPWeb/fpxPaymentToNGO_view.do"; return false; } function getPayee(info) { sArray = info.split("|"); payee = { payeeId : sArray[0], billAccNoLabel : sArray[1], billRefNo1Flag : sArray[2], billRefNo1Label : sArray[3], billRefNo2Flag : sArray[4], billRefNo2Label : sArray[5], billAccNo : sArray[6], billNickname : sArray[7] } return payee; } function checkPayee() { info = getValue(mform.payeeId); billRefNo1 = getObject("billRefNo1"); billRefNo1Value = billRefNo1 ? getValue(billRefNo1) : ""; billRefNo2 = getObject("billRefNo2"); billRefNo2Value = billRefNo2 ? getValue(billRefNo2) : ""; if (info.length > 0) { payee = getPayee(info); //check for special payee eg. BCB Leasing DisplayBillRefNo(payee.payeeId); isSelect = getDescListResponse(); if (isSelect) { changeToSelect(billRefNo1, getDescList(), mform.billRefNo1.name, mform.billRefNo1.name, getObject("billRefNo1Input")); } else { if (billRefNo1 && billRefNo1.type == "select-one") { changeToText(billRefNo1, mform.billRefNo1.id, mform.billRefNo1.name, getObject("billRefNo1Input")); } } isSelect = getDescListResponse2(); if (isSelect) { if (getListLinked() && (billRefNo1Value != "")) { changeToSelect(billRefNo2, getBillRef2List(getDescList(), billRefNo1Value), mform.billRefNo2.id, mform.billRefNo2.name, getObject("billRefNo2Input")); } else { changeToSelect(billRefNo2, getDescList2(), mform.billRefNo2.id, mform.billRefNo2.name, getObject("billRefNo2Input")); } } else { if (billRefNo2.type == "select-one") { changeToText(billRefNo2, mform.billRefNo2.id, mform.billRefNo2.name, getObject("billRefNo2Input")); } } } } function checkRef(field) { var info = getValue(mform.payeeId); var isSelect = false; var isLinked = false; var list = new Array(); getElementsValue(mform.billRefNo1, mform.billRefNo2) if (info.length > 0) { payee = getPayee(info); DisplayBillRefNo(payee.payeeId); if (billRefNo1.name == field.name) { isSelect = getDescListResponse(); list = getDescList(); isLinked = getListLinked(); if (isLinked) { changeToSelect(billRefNo2, getBillRef2List(list, billRefNo1Value), mform.billRefNo2.id, mform.billRefNo2.name, getObject("billRefNo2Input"), "false"); } } else { isSelect = getDescListResponse2(); if (getListLinked()) { list = getBillRef2List(getDescList(), billRefNo1Value); } else { list = getDescList2(); } } if (isSelect) { setAmount(list, getValue(field)); } } } function setAmount(optArry, value) { for (i=0; i < optArry.length ; i++) { if ((optArry[i].length>= 3) && (optArry[i][2] != '')) { if (optArry[i][0] == value) { setValue(mform.amount, optArry[i][2]); break; } } } } function getBillRef2List(optArry, value) { for (i=0; i < optArry.length ; i++) { if (optArry[i].length== 4) { if (optArry[i][0] == value) { return optArry[i][3]; break; } } } return new Array(); } function changeToSelect(oldChild, optArry, id, name, obj) { var newChild=document.createElement("select"); newChild.setAttribute("id", id); newChild.setAttribute("name", name); newChild.onchange=function() { checkRef(this);}; option=document.createElement("option"); option.innerHTML="Please Select"; option.value=""; option.label="Please Select"; newChild.appendChild(option); for (i=0; i < optArry.length; i++) { option = document.createElement("option"); option.innerHTML = optArry[i][1]; option.value = optArry[i][0]; option.label = optArry[i][1]; newChild.appendChild(option); } obj.replaceChild(newChild, oldChild); } function changeToText(oldChild, id, name, obj) { var newChild = document.createElement("input"); newChild.setAttribute("type", "text"); newChild.setAttribute("id", id); newChild.setAttribute("name", name); obj.replaceChild(newChild, oldChild); } function validKeyDown(event) { var arg = getKeyValue(event); return (arg > 31 || arg == 8 || arg == 13); } function validKeyPress(event) { var arg = getKeyValue(event); return (arg < 128 && arg != 38); }