function setComma(str) { return Number(String(str).replace(/\..*|[^\d]/g, "")).toLocaleString().slice(0,-3); } function add_favorite(url, title) { window.external.AddFavorite(url, title); } function IS_ENTER (obj, event) { var keyCode = event.keyCode ? event.keyCode : event.which ? event.which : event.charCode; if (keyCode == 13) { return true; } else { return false; } } function OpenWindow(sURL, width, height, etc) { var top = (screen.height-height)/2; var left = (screen.width -width )/2; window.open(sURL, "", "top="+top+", left="+left+", width="+width+", height="+height+","+ "scrollbar=auto, "+etc); } function OpenModal(sURL, curVal, width, height, etc) { var top = (screen.height-height)/2; var left = (screen.width -width )/2; newVal = showModalDialog(sURL, curVal, 'dialogHeight:'+height+'px; dialogWidth:'+width+'px; scrolling:no; resizable:no; status:no'); return newVal; } function resizeDialogToContent() { var s_w = screen.width; var s_h = screen.height; var dw = window.dialogWidth; while (isNaN(dw)) { dw = dw.substr(0,dw.length-1); } difw = dw - this.document.body.clientWidth; window.dialogWidth = this.document.body.scrollWidth+difw+'px'; var dh = window.dialogHeight; while (isNaN(dh)) { dh = dh.substr(0,dh.length-1); } difh = dh - this.document.body.clientHeight; window.dialogHeight = this.document.body.scrollHeight+difh+'px'; window.dialogTop = (s_h - this.document.body.scrollHeight+difh) /2 window.dialogLeft = (s_w - this.document.body.scrollWidth+difw) /2 } function commaSplit(srcNumber) { var txtNumber = '' + srcNumber; var rxSplit = new RegExp('([0-9])([0-9][0-9][0-9][,.])'); var arrNumber = txtNumber.split('.'); arrNumber[0] += '.'; do { arrNumber[0] = arrNumber[0].replace(rxSplit, '$1,$2'); } while (rxSplit.test(arrNumber[0])); if (arrNumber.length > 1) { return arrNumber.join(''); } else { return arrNumber[0].split('.')[0]; } }