function setJsStatus() { var li = document.getElementsByTagName("input"); for ( var i = 0; i < li.length; i++ ) { var cid = li[i].id; if (cid.indexOf("jsStatus")>=0) { li[i].value="1"; } } } function unsetJsStatus() { var li = document.getElementsByTagName("input"); for ( var i = 0; i < li.length; i++ ) { var cid = li[i].id; if (cid.indexOf("jsStatus")>=0) { li[i].value="0"; } } } // no right click document.oncontextmenu=function() {return false;}; /* This function is used to change the style class of an element */ function swapClass(obj, newStyle) { obj.className = newStyle; } function isUndefined(value) { var undef; return value == undef; } function checkAll(theForm) { // check all the checkboxes in the list for (var i=0;i */ function move(list,to) { var total=list.options.length; index = list.selectedIndex; if (index == -1) return false; if (to == +1 && index == total-1) return false; if (to == -1 && index == 0) return false; to = index+to; var opts = new Array(); for (i=0; i */ function selectAll(elementId) { var element = document.getElementById(elementId); len = element.length; if (len != 0) { for (i = 0; i < len; i++) { element.options[i].selected = true; } } } /* This function is used to select a checkbox by passing * in the checkbox id */ function toggleChoice(elementId) { var element = document.getElementById(elementId); if (element.checked) { element.checked = false; } else { element.checked = true; } } /* This function is used to select a radio button by passing * in the radio button id and index you want to select */ function toggleRadio(elementId, index) { var element = document.getElementsByName(elementId)[index]; element.checked = true; } /* This function is used to open a pop-up window */ function openWindow(url, winTitle, winParams) { winName = window.open(url, winTitle, winParams); winName.focus(); } /* This function is to open search results in a pop-up window */ function openSearch(url, winTitle) { var screenWidth = parseInt(screen.availWidth); var screenHeight = parseInt(screen.availHeight); var winParams = "width=" + screenWidth + ",height=" + screenHeight; winParams += ",left=0,top=0,toolbar,scrollbars,resizable,status=yes"; openWindow(url, winTitle, winParams); } /* This function is used to set cookies */ function setCookie(name,value,expires,path,domain,secure) { document.cookie = name + "=" + escape (value) + ((expires) ? "; expires=" + expires.toGMTString() : "") + ((path) ? "; path=" + path : "") + ((domain) ? "; domain=" + domain : "") + ((secure) ? "; secure" : ""); } /* This function is used to get cookies */ function getCookie(name) { var prefix = name + "=" var start = document.cookie.indexOf(prefix) if (start==-1) { return null; } var end = document.cookie.indexOf(";", start+prefix.length) if (end==-1) { end=document.cookie.length; } var value=document.cookie.substring(start+prefix.length, end) return unescape(value); } /* This function is used to delete cookies */ function deleteCookie(name,path,domain) { if (getCookie(name)) { document.cookie = name + "=" + ((path) ? "; path=" + path : "") + ((domain) ? "; domain=" + domain : "") + "; expires=Thu, 01-Jan-70 00:00:01 GMT"; } } // This function is for stripping leading and trailing spaces function trim(str) { if (str != null) { var i; for (i=0; i=0; i--) { if (str.charAt(i)!=" ") { str=str.substring(0,i+1); break; } } if (str.charAt(0)==" ") { return ""; } else { return str; } } } // This function is a generic function to create form elements function createFormElement(element, type, name, id, value, parent) { var e = document.createElement(element); e.setAttribute("name", name); e.setAttribute("type", type); e.setAttribute("id", id); e.setAttribute("value", value); parent.appendChild(e); } function confirmDelete(obj) { var msg = "Are you sure you want to delete this " + obj + "?"; ans = confirm(msg); if (ans) { return true; } else { return false; } } // NEW FUNCTION function hideWindowStatus() { // hide window status on tag addMouseOverHandler(document.getElement); } function addMouseOverHandler(elements) { for (i=0; i 31 && (charCode < 48 || charCode > 57)) { status = "This field accepts numbers only."; return false; } status = ""; return true; } /* // ony accept number and letter function checkIt2(evt) { Evt = (evt) ? evt : window.event; var charCode = (evt.which) ? evt.which : evt.keyCode; keyChar= String.fromCharCode(charCode); charCheck = /[?<>=+`~_!@#$%^&*()|"';:\/{}\[\]\\\-]/; //this will be confusing return !charCheck.test(keychar); if(!charCheck.test(keychar)){ status = ""; return true; } else{ status = "This field accepts numbers and letters only."; return false; } if ( charCode == 8 ||charCode == 32 || (charCode>=48 && charCode<=57) || (charCode>=65 && charCode<=90) || (charCode>=97 && charCode<=122) ) { status = ""; return true; } status = "This field accepts numbers and letters only."; return false; }*/ function checkIt2(e) { var keynum; var keychar; var numcheck; if(window.event) // IE { keynum = e.keyCode; } else if(e.which) // Netscape/Firefox/Opera { keynum = e.which; } keychar = String.fromCharCode(keynum); charCheck = /[?<>=+`~_!@#$%^&*()|"';:\/{}\[\]\\\-]/; return !charCheck.test(keychar); } function formatmoney(thisone, d, t){ if(thisone.value.indexOf(t)<0){ var wd="w"; var amount=""; if (d!=".") thisone.value = thisone.value.replace(d, "."); // convert number into java format (decimal separator is '.') if ( (thisone.value.indexOf(".")>14) ^ (thisone.value.indexOf(".")<0 && thisone.value.length>15) ) { alert(error_money_value); thisone.value = "0"; } if (thisone.value.length==0) thisone.value=0; var tnumber=parseFloat(thisone.value); tnumber=tnumber.toFixed(2); tempnum=tnumber.toString(); amount = tempnum.substring(0, tempnum.length-3); decimal = tempnum.substring(tempnum.length-2, tempnum.length); newAmount = ""; for (i=amount.length;i>0;i--) { tchar = amount.charAt(i-1); if ( (amount.length-i)%3==0 && amount.length!=i ) { newAmount = tchar + t + newAmount; } else { newAmount = tchar + newAmount; } } thisone.value=newAmount + d + decimal; } } function unformatmoney(thisone, d, t) { var strValue = thisone.value; while (strValue.indexOf(t)>=0) { strValue = strValue.replace(t, ""); } if (t!=",") strValue = strValue.replace(d, "."); // convert number into java format (decimal separator is '.') if (strValue=="") thisone.value="" else if (parseFloat(strValue)==0) thisone.value="" else thisone.value = parseFloat(strValue).toString(); if (t!=",") thisone.value = thisone.value.replace(".", d); } function keypressmoney(thisone, evt, d) { Evt = (evt) ? evt : window.event; var charCode = (evt.which) ? evt.which : evt.keyCode; var dCode; if (d == ".") dCode=46 else dCode=44; if (charCode == dCode) { // decimal separator if (thisone.value.indexOf(d)<0) return true; else return false; } else if (charCode>=37 && charCode<=40) { // arrow keycode return true; } else if (charCode > 31 && (charCode < 48 || charCode > 57)) { status = "This field accepts numbers only."; return false; } status = ""; return true; } function startup() { var newWin = window.open("/paninbib/login.jsp", "_blank", "menubar=no,toolbar=no,location=no,status=yes,resizable=no,scrollbars=yes,width="+screen.availWidth+",height="+screen.availHeight+""); newWin.moveTo(0,0); window.opener=''; window.close(); } function report() { var newwindow; var width = 600; var height = 500 var top = parseInt((screen.availHeight/2)-(height/2)); var left = parseInt((screen.availWidth/2)-(width/2)); newwindow = window.open("/paninbib/reportFinancialTransaction.html", "_blank", "menubar=no,toolbar=no,location=no,status=yes,resizable=no,scrollbars=yes,width="+width+",height="+height+",top="+top+",left="+left+",screenX="+left+",screenY="+top+",alwaysRaised=yes"); } function reportPln() { var newwindow; var width = 600; var height = 500 var top = parseInt((screen.availHeight/2)-(height/2)); var left = parseInt((screen.availWidth/2)-(width/2)); newwindow = window.open("/paninbib/reportFinancialTransactionPln.html", "_blank", "menubar=no,toolbar=no,location=no,status=yes,resizable=no,scrollbars=yes,width="+width+",height="+height+",top="+top+",left="+left+",screenX="+left+",screenY="+top+",alwaysRaised=yes"); } function Print(){ window.print(); } function Focus(){ window.focus(); } function setCheckToken() { var li = document.getElementsByTagName("input"); for ( var i = 0; i < li.length; i++ ) { var cid = li[i].id; if (cid.indexOf("checkToken")>=0) { li[i].value="1"; } } } // Mencegah double submit var requestSubmitted = false; function submitRequest() { if (!requestSubmitted ) { requestSubmitted = true; return true; } return false; } // Untuk menggantikan fungsi require_field pada tapestry, sebagai bantuan pencegah double submit function requireField(event, id, errMsg) { var field = document.getElementById(id); if ( field.value.length == 0 ) { requestSubmitted = false; Tapestry.set_focus(field); window.alert(errMsg); event.abort = true; event.cancel_handlers = true; } } // Show the document's title on the status bar window.defaultStatus=document.title; window.status='Panin Bussiness Internet Banking';