function TrimString (strVal) { strTmp = strVal + ""; if (strTmp.length == 0) return (strTmp); reVal = /^(\s|กก)*/; strTmp = strTmp.replace (reVal, ''); reVal = /(\s|กก)*$/; return (strTmp.replace (reVal, '')); } function CheckEmail (strEmail) { strEmail = (TrimString (strEmail)); if (strEmail.length == 0) return (false); reVal = /^[\-!#\$%&'\*\+\\\.\/0-9=\?A-Z\^_`a-z{|}~]+@[\-!#\$%&'\*\+\\\.\/0-9=\?A-Z\^_`a-z{|}~]+(\.[\-!#\$%&'\*\+\\\.\/0-9=\?A-Z\^_`a-z{|}~]+)+$/; return (reVal.test (strEmail)); } function OrtOpenCenterWindow (URL, Name, Features) { var nWidth; var nHeight; var nLeft; var nTop; var strVal; var nPos; var strComb; var i; var chVal; nLeft = 0; nTop = 0; if (Features == null) return (window.open (URL, Name, Features)); strVal = Features.toUpperCase (); if (strVal.indexOf ("LEFT", 0) >= 0 || strVal.indexOf ("TOP", 0) >= 0) return (window.open (URL, Name, Features)); if ((nPos = strVal.indexOf ("WIDTH", 0)) < 0) return (window.open (URL, Name, Features)); if ((nPos = strVal.indexOf ("=", nPos)) < 0) return (window.open (URL, Name, Features)); strComb = ""; for (i = nPos + 1; i < Features.length; i ++) { chVal = Features.charAt (i); if (chVal == " " || (chVal >= "0" && chVal <= "9")) strComb += chVal; else break; } if ((nWidth = eval (TrimString (strComb))) <= 0) return (window.open (URL, Name, Features)); if ((nPos = strVal.indexOf ("HEIGHT", 0)) < 0) return (window.open (URL, Name, Features)); if ((nPos = strVal.indexOf ("=", nPos)) < 0) return (window.open (URL, Name, Features)); strComb = ""; for (i = nPos + 1; i < Features.length; i ++) { chVal = Features.charAt (i); if (chVal == " " || (chVal >= "0" && chVal <= "9")) strComb += chVal; else break; } if ((nHeight = eval (TrimString (strComb))) <= 0) return (window.open (URL, Name, Features)); nLeft = (window.screen.width - nWidth) / 2; nTop = (window.screen.height - nHeight) / 2; Features += ",left=" + nLeft + ",top=" + nTop; return (window.open (URL, Name, Features)); }