dsoHTMLoan.async=false; dsoHTMCommon.async=false; function loan_application() { try { //dsoHTMCommon.load("../data/3_1_loan_common.xml"); //jsp_url.innerHTML = dsoHTMCommon.selectSingleNode("//row/common/jsp_url").text; //asp_url.innerHTML = dsoHTMCommon.selectSingleNode("//row/common/asp_url").text; dsoHTMLoan.load("data/3_1_loan_loan_application.xml"); welcome.innerHTML = dsoHTMLoan.selectSingleNode("//row/loan_application/welcome").text; form_title_1.innerHTML = dsoHTMLoan.selectSingleNode("//row/loan_application/form_title_1").text; form_subtitle_1.innerHTML = dsoHTMLoan.selectSingleNode("//row/loan_application/form_subtitle_1").text; form_subdesc_1a.innerHTML = dsoHTMLoan.selectSingleNode("//row/loan_application/form_subdesc_1a").text; form_subdesc_1b.innerHTML = dsoHTMLoan.selectSingleNode("//row/loan_application/form_subdesc_1b").text; form_subdesc_1c.innerHTML = dsoHTMLoan.selectSingleNode("//row/loan_application/form_subdesc_1c").text; form_subdesc_1d.innerHTML = dsoHTMLoan.selectSingleNode("//row/loan_application/form_subdesc_1d").text; form_subtitle_2.innerHTML = dsoHTMLoan.selectSingleNode("//row/loan_application/form_subtitle_2").text; //form_subdesc_2.innerHTML = dsoHTMLoan.selectSingleNode("//row/loan_application/form_subdesc_2").text; form_subtitle_3.innerHTML = dsoHTMLoan.selectSingleNode("//row/loan_application/form_subtitle_3").text; //form_subdesc_3.innerHTML = dsoHTMLoan.selectSingleNode("//row/loan_application/form_subdesc_3").text; //form_subtitle_4.innerHTML = dsoHTMLoan.selectSingleNode("//row/loan_application/form_subtitle_4").text; //form_subdesc_4.innerHTML = dsoHTMLoan.selectSingleNode("//row/loan_application/form_subdesc_4").text; //form_subtitle_5.innerHTML = dsoHTMLoan.selectSingleNode("//row/loan_application/form_subtitle_5").text; //form_subdesc_5a.innerHTML = dsoHTMLoan.selectSingleNode("//row/loan_application/form_subdesc_5a").text; //form_subdesc_5b.innerHTML = dsoHTMLoan.selectSingleNode("//row/loan_application/form_subdesc_5b").text; //form_subdesc_5c.innerHTML = dsoHTMLoan.selectSingleNode("//row/loan_application/form_subdesc_5c").text; form_subtitle_6.innerHTML = dsoHTMLoan.selectSingleNode("//row/loan_application/form_subtitle_6").text; //form_subdesc_6.innerHTML = dsoHTMLoan.selectSingleNode("//row/loan_application/form_subdesc_6").text; form_subtitle_7.innerHTML = dsoHTMLoan.selectSingleNode("//row/loan_application/form_subtitle_7").text; //form_subdesc_7.innerHTML = dsoHTMLoan.selectSingleNode("//row/loan_application/form_subdesc_7").text; //form_subtitle_8.innerHTML = dsoHTMLoan.selectSingleNode("//row/loan_application/form_subtitle_8").text; //form_subdesc_8.innerHTML = dsoHTMLoan.selectSingleNode("//row/loan_application/form_subdesc_8").text; //form_title_2.innerHTML = dsoHTMLoan.selectSingleNode("//row/loan_application/form_title_2").text; //form_subtitle_9.innerHTML = dsoHTMLoan.selectSingleNode("//row/loan_application/form_subtitle_9").text; //form_subdesc_9.innerHTML = dsoHTMLoan.selectSingleNode("//row/loan_application/form_subdesc_9").text; //form_subdesc_9a.innerHTML = dsoHTMLoan.selectSingleNode("//row/loan_application/form_subdesc_9a").text; //form_subdesc_9b.innerHTML = dsoHTMLoan.selectSingleNode("//row/loan_application/form_subdesc_9b").text; //form_subdesc_9c.innerHTML = dsoHTMLoan.selectSingleNode("//row/loan_application/form_subdesc_9c").text; //form_subtitle_10.innerHTML = dsoHTMLoan.selectSingleNode("//row/loan_application/form_subtitle_10").text; //form_subdesc_10.innerHTML = dsoHTMLoan.selectSingleNode("//row/loan_application/form_subdesc_10").text; //form_subtitle_11.innerHTML = dsoHTMLoan.selectSingleNode("//row/loan_application/form_subtitle_11").text; //form_subdesc_11.innerHTML = dsoHTMLoan.selectSingleNode("//row/loan_application/form_subdesc_11").text; form_title_3.innerHTML = dsoHTMLoan.selectSingleNode("//row/loan_application/form_title_3").text; form_subtitle_12.innerHTML = dsoHTMLoan.selectSingleNode("//row/loan_application/form_subtitle_12").text; //form_subdesc_12.innerHTML = dsoHTMLoan.selectSingleNode("//row/loan_application/form_subdesc_12").text; //form_subdesc_12a.innerHTML = dsoHTMLoan.selectSingleNode("//row/loan_application/form_subdesc_12a").text; //form_subdesc_12b.innerHTML = dsoHTMLoan.selectSingleNode("//row/loan_application/form_subdesc_12b").text; //form_subdesc_12c.innerHTML = dsoHTMLoan.selectSingleNode("//row/loan_application/form_subdesc_12c").text; //form_subdesc_12d.innerHTML = dsoHTMLoan.selectSingleNode("//row/loan_application/form_subdesc_12d").text; form_subtitle_13.innerHTML = dsoHTMLoan.selectSingleNode("//row/loan_application/form_subtitle_13").text; form_subdesc_13.innerHTML = dsoHTMLoan.selectSingleNode("//row/loan_application/form_subdesc_13").text; form_subtitle_14.innerHTML = dsoHTMLoan.selectSingleNode("//row/loan_application/form_subtitle_14").text; form_subdesc_14.innerHTML = dsoHTMLoan.selectSingleNode("//row/loan_application/form_subdesc_14").text; form_subtitle_15.innerHTML = dsoHTMLoan.selectSingleNode("//row/loan_application/form_subtitle_15").text; //form_subdesc_15.innerHTML = dsoHTMLoan.selectSingleNode("//row/loan_application/form_subdesc_15").text; form_subtitle_16.innerHTML = dsoHTMLoan.selectSingleNode("//row/loan_application/form_subtitle_16").text; //form_subdesc_16.innerHTML = dsoHTMLoan.selectSingleNode("//row/loan_application/form_subdesc_16").text; form_subtitle_17.innerHTML = dsoHTMLoan.selectSingleNode("//row/loan_application/form_subtitle_17").text; //form_subdesc_17.innerHTML = dsoHTMLoan.selectSingleNode("//row/loan_application/form_subdesc_17").text; form_subtitle_18.innerHTML = dsoHTMLoan.selectSingleNode("//row/loan_application/form_subtitle_18").text; //form_subdesc_18.innerHTML = dsoHTMLoan.selectSingleNode("//row/loan_application/form_subdesc_18").text; form_subtitle_19.innerHTML = dsoHTMLoan.selectSingleNode("//row/loan_application/form_subtitle_19").text; //form_subdesc_19.innerHTML = dsoHTMLoan.selectSingleNode("//row/loan_application/form_subdesc_19").text; form_subtitle_20.innerHTML = dsoHTMLoan.selectSingleNode("//row/loan_application/form_subtitle_20").text; //form_subdesc_20.innerHTML = dsoHTMLoan.selectSingleNode("//row/loan_application/form_subdesc_20").text; //form_subtitle_21.innerHTML = dsoHTMLoan.selectSingleNode("//row/loan_application/form_subtitle_21").text; //form_subdesc_21.innerHTML = dsoHTMLoan.selectSingleNode("//row/loan_application/form_subdesc_21").text; //appendix_1.innerHTML = dsoHTMLoan.selectSingleNode("//row/loan_application/appendix_1").text; //appendix_2.innerHTML = dsoHTMLoan.selectSingleNode("//row/loan_application/appendix_2").text; //appendix_3.innerHTML = dsoHTMLoan.selectSingleNode("//row/loan_application/appendix_3").text; //appendix_4.innerHTML = dsoHTMLoan.selectSingleNode("//row/loan_application/appendix_4").text; //appendix_remark.innerHTML = dsoHTMLoan.selectSingleNode("//row/loan_application/appendix_remark").text; } catch(e) { } } function check_value() { //alert('xxxx:'+document.form_loan.surname.value) //return; //saveFromData(document.getElementById('surname').value, document.getElementById('given_name').value) /*if (!((document.getElementById('title_init_1').checked) || (document.getElementById('title_init_2').checked) || (document.getElementById('title_init_3').checked) || (document.getElementById('title_init_4').checked))) { alert('Please fill in \"Title\" field.'); return; }*/ if (!((document.form_loan.title_init_1.checked) || (document.form_loan.title_init_2.checked) || (document.form_loan.title_init_3.checked) || (document.form_loan.title_init_4.checked))) { document.form_loan.title_init_1.focus(); alert('Please fill in \"Title\" field.'); return; } if (document.form_loan.surname.value == '') { document.form_loan.surname.focus(); alert('Please fill in \"Surname\" field.'); return; } if (document.form_loan.given_name.value == '') { document.form_loan.given_name.focus(); alert('Please fill in \"Given Name\" field.'); return; } // if (document.form_loan.hkid_1.value == '') { // document.form_loan.hkid_1.focus(); // alert('Please fill in \"HKID\" field.'); // return; // } // if (document.form_loan.hkid_2.value == '') { // document.form_loan.hkid_2.focus(); // alert('Please fill in \"HKID\" field.'); // return; // } // if (document.form_loan.hkid_3.value == '') { // document.form_loan.hkid_3.focus(); // alert('Please fill in \"HKID\" field.'); // return; // } // document.form_loan.hkid.value = document.form_loan.hkid_1.value + document.form_loan.hkid_2.value + "(" + document.form_loan.hkid_3.value + ")"; // if (!(isHKIDorPassport(document.form_loan.hkid.value,1))) { // alert('Please fill in correct \"HKID\" field.'); // return; // } // if ((document.form_loan.dd.value == '') && (document.form_loan.mm.value == '') && (document.form_loan.yyyy.value == '')) { // alert('Please fill in \"Date of Birth\"\' field.'); // return; // } // document.form_loan.date_of_birth.value = document.form_loan.dd.value + '-' + document.form_loan.mm.value + '-' + document.form_loan.yyyy.value; if (document.form_loan.contact_phone.value == '') { document.form_loan.contact_phone.focus(); alert('Please fill in \"contact phone\" field.'); return; }else{ if(validatePhoneNo(document.form_loan.contact_phone.value)==false){ document.form_loan.contact_phone.focus(); alert('Please fill an valid \"contact phone\" field.'); return; } } if (document.form_loan.email.value == '') { //alert('Please fill in \"Email Address\" field.'); //return; }else{ if(isEmailValid(document.form_loan.email.value)==false){ alert('Please fill an valid \"Email Address\" field.'); return; } } if (document.form_loan.purchase_price.value!= '') { if (!(chk_positive_value(document.form_loan.purchase_price.value, true))) { document.form_loan.purchase_price.focus(); alert('\"Purchase Price\" field need to input numeric which greater than zero.'); return; } } if (document.form_loan.os_loan_amount.value!= '') { if (!(chk_positive_value(document.form_loan.os_loan_amount.value, true))) { document.form_loan.os_loan_amount.focus(); alert('\"O/S Loan Amount\" field need to input numeric which greater than zero.'); return; } } // if (document.form_loan.income.value == '') { // alert('Please fill in \"Monthly Income\" field.'); // return; // } // if (!(chk_positive_value(document.form_loan.income.value, true))) { // alert('\"Monthly Income\" field need to input numeric which greater than zero.'); // return; // } /* if (document.form_loan.loan_type.selectedIndex == 0) { alert('Please select \"Loan Type\" field.'); return; } if (document.form_loan.loan_amount.value == '') { alert('Please fill in \"Loan Amount\" field.'); return; } if (!(chk_positive_value(document.form_loan.loan_amount.value, true))) { alert('\"Loan Amount\" field need to input numeric which greater than zero.'); return; } if (document.form_loan.tendor.value == '') { alert('Please fill in \"Tendor\" field.'); return; } if (!(chk_integer_value(document.form_loan.tendor.value, true))) { alert('\"Tendor\" field need to input numeric.'); return; } if (document.form_loan.property_type.selectedIndex == 0) { alert('Please select \"Property Type\" field.'); return; } if (document.form_loan.area.value == '') { alert('Please fill in \"Area\" field.'); return; } if (document.form_loan.district.value == '') { alert('Please fill in \"District\" field.'); return; } if (document.form_loan.estate.value == '') { alert('Please fill in \"Estate / Court\" field.'); return; } if (document.form_loan.block.value == '') { alert('Please fill in \"Block\" field.'); return; } if (document.form_loan.floor.value == '') { alert('Please fill in \"Floor\" field.'); return; } if (document.form_loan.unit.value == '') { alert('Please fill in \"Unit\" field.'); return; } */ //if (document.form_loan.appendix.checked==false) { // alert('Please ticked and read and understand when submitting the form.'); // return; //} document.form_loan.action = "3_1_mortgages_loan_application_confirm.jsp"; document.form_loan.submit(); } function reset_value() { document.form_loan.surname.value = ''; document.form_loan.given_name.value = ''; document.form_loan.title_init_1.checked=false; document.form_loan.title_init_2.checked=false; document.form_loan.title_init_3.checked=false; document.form_loan.title_init_4.checked=false; document.form_loan.contact_phone.value = ''; document.form_loan.email.value = ''; //document.form_loan.loan_type.selectedIndex = 0; //document.form_loan.loan_amount.value = ''; //document.form_loan.tendor.value = ''; document.form_loan.property_type.selectedIndex = 0; document.form_loan.purchase_price.value = ''; document.form_loan.os_loan_amount.value = ''; document.form_loan.area.value = ''; document.form_loan.district.value = ''; document.form_loan.estate.value = ''; document.form_loan.block.value = ''; document.form_loan.floor.value = ''; document.form_loan.unit.value = ''; //document.form_loan.appendix.checked=true; //document.form_loan.address.value = ''; } function saveFromData(str1, str2) { var surname = str1; var given_name = str2; var SOAPrequest = new ActiveXObject("Msxml2.XMLHTTP"); SOAPrequest.open("POST","../3_1_mortgage/3_1_mortgages_loan_application_save.jsp",false); SOAPrequest.setrequestHeader("SOAPMethodName","urn:ckwb:client#view"); var SOAPrequestStr = "" + "" + surname + "" + "" + given_name + "" + ""; alert(SOAPrequestStr); SOAPrequest.send(SOAPrequestStr); if (SOAPrequest.status != 200) alert("Error!! " + SOAPrequest.statusText + "\n" + SOAPrequest.responseText); var xmldoc = new ActiveXObject("Msxml2.DOMDocument"); xmldoc.async = false; if (!xmldoc.load(SOAPrequest.responseXML)) alert('Error!!'); var oNodeLists = xmldoc.selectNodes("//row"); var str = "" if (oNodeLists.length>=0){ alert('Jackie') } } function chk_percentage(input_value, exclude_zero) { if (input_value == parseFloat(input_value)) { if (exclude_zero) { if ((input_value > 0) && (input_value <= 100)) { return true; } } else { if ((input_value >= 0) && (input_value <= 100)) { return true; } } } return false; } function chk_positive_value(input_value, exclude_zero) { if (input_value == parseFloat(input_value)) { if (exclude_zero) { if (input_value > 0) { return true; } } else { if (input_value >= 0) { return true; } } } return false; } function chk_integer_value(input_value) { if (input_value == parseInt(input_value)) { return true; } return false; } function chk_range_value(input_value, min_value, max_value, inclusive) { if (input_value == parseFloat(input_value)) { if (inclusive) { if ((input_value >= min_value) && (input_value <= max_value)) { return true; } } else { if ((input_value > min_value) && (input_value < max_value)) { return true; } } } return false; } function formatCurrency(num) { num = num.toString().replace(/\$|\,/g,''); if(isNaN(num)) num = "0"; sign = (num == (num = Math.abs(num))); num = Math.floor(num*100+0.50000000001); cents = num%100; num = Math.floor(num/100).toString(); if(cents<10) cents = "0" + cents; for (var i = 0; i < Math.floor((num.length-(1+i))/3); i++) num = num.substring(0,num.length-(4*i+3))+','+ num.substring(num.length-(4*i+3)); return (num + '.' + cents); } function isHKIDorPassport(str,type) { // check the valid HKID or Passport var v_char = "1234567890A"; var v_1char = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"; var v_27char = "1234567890()"; var v_8char = "1234567890"; var str_temp2 = String(""); switch (type) { case true : if ((str.length != 8) && (str.length != 9)){ return false; } if (str.length == 8) { v_temp = str.charAt(0); v_temp = v_temp.toUpperCase(); if (v_1char.indexOf(v_temp) == -1) { return false; } for (var k=1;k<7;k++) { v_temp = str.charAt(k); v_temp = v_temp.toLowerCase(); if (v_27char.indexOf(v_temp) == -1) { return false; } } v_temp = str.charAt(7); v_temp = v_temp.toUpperCase(); if (v_char.indexOf(v_temp) == -1) { return false; } str_temp2 = str.substr(0,7) + "(" + str.substr(7,8) + ")"; } if (str.length == 9) { v_temp = str.charAt(0); v_temp = v_temp.toUpperCase(); v_temp1 = str.charAt(1); v_temp1 = v_temp1.toUpperCase(); if ((v_1char.indexOf(v_temp) == -1) || (v_1char.indexOf(v_temp1) == -1)) { return false; } for (var k=2;k<8;k++) { v_temp = str.charAt(k); v_temp = v_temp.toLowerCase(); if (v_27char.indexOf(v_temp) == -1) { return false; } } v_temp = str.charAt(8); v_temp = v_temp.toUpperCase(); if (v_char.indexOf(v_temp) == -1) { return false; } str_temp2 = str.substr(0,8) + "(" + str.substr(8,9) + ")"; } var pos = str_temp2.indexOf("("); var pos1 = str_temp2.indexOf(")"); var len = str_temp2.length; if (pos < 7 || pos > 8 || pos != (pos1 - 2) || len != (pos1 + 1)) { return false; } else { var id = " " + str_temp2.toLowerCase(); str_temp2 = id.substr(pos-7,10); var num = 0; for (var i=0; i < 8; i++){ var x = str_temp2.charCodeAt(i); if (x==32) { num += 36*(9-i); } else if (x>32 && x<58) { num += (x-48)*(9-i); } else { num += (x-87)*(9-i); } } x = num % 11; if (x != 0) {x = (11 - x);} if (x == 10) {x = 'A';} if (String(str_temp2.charAt(9).toUpperCase()) != String(x)) { return false; } } break; case false : for (var k=0;k