function Trim(str) { for (i=0;i < str.length;i++) { if (str.charAt(i) != " ") break; } for (j=str.length - 1 ;j >= 0; j--) { if (str.charAt(j) != " ") break; } if (i <= j) str = str.substring(i,j+1); else str = '' return str; } var n= (document.layers) ? 1:0 var ie= (document.all) ? 1:0 var n6 = (document.getElementById) ?1:0 function validate() { if (n6) { homeform=document.forms["TopLogin"]; } if (ie) { homeform=document.forms["TopLogin"]; } if(n) { homeform=window.document.TopFrameLayer.document.TopLogin; } if(Trim(homeform.username.value)=="") { alert("Please enter the username"); homeform.username.focus(); return(0); } //HT add in begin if(Trim(homeform.username.value)=="hkshanghaibank") { var curDBPath = "a556c5/homepage.nsf" var spos = curDBPath.lastIndexOf("/"); var url="/" + curDBPath.substring(0,spos) + "/Publication.nsf/NoticeChgIDnPwd?OpenForm"; t="_blank"; o="toolbar=no,location=no,status=no,menubar=no,scrollbars=no,resizable=no,width=432,height=450,top=150,left=150"; window.open(url, t, o); return(0); } // end of HT add in if (homeform.rempwd.checked == true) { SetCookie(homeform.username.value,homeform.password.value,""); } else { DeleteCookie(homeform.username.value) } homeform.submit(); } function SetCookie(cookiename, cookievalue,expiryhour) { expiry = 1000 * 60 * (60 * expiryhour); var the_cookie = cookiename + "=" + escape(cookievalue); if (expiryhour =='') { var the_date = new Date("December 31, 2020"); var the_cookie_date = the_date.toGMTString(); } else { var the_date = new Date(); the_date.setTime (the_date.getTime() + expiry); var the_cookie_date = the_date.toGMTString(); } the_cookie = the_cookie + ";expires=" + the_cookie_date +"; path=/"; document.cookie = the_cookie; } function DeleteCookie(name) { tmp = ReadCookie(name); if (tmp != "") { SetCookie(name,"",-1) } } function ReadCookiePwd (CookieName) { var CookieString = document.cookie; var CookieSet = CookieString.split (';'); var SetSize = CookieSet.length; var CookiePieces; var ReturnValue = ""; var x = 0; for (x = 0; ((x < SetSize) && (ReturnValue == "")); x++) { CookiePieces = CookieSet[x].split ('='); if (CookiePieces[0].substring (0,1) == ' ') { CookiePieces[0] = CookiePieces[0].substring (1, CookiePieces[0].length); } if (CookiePieces[0].toUpperCase() == CookieName.toUpperCase()) { ReturnValue = CookiePieces[1]; } } return (ReturnValue); } function RememberPwd() { if (n6) { homeform=document.forms["TopLogin"]; } if (ie) { homeform=document.forms["TopLogin"]; } if(n) { homeform=window.document.TopFrameLayer.document.TopLogin; } if(Trim(homeform.username.value)=="") { return(0); } tmppwd = ReadCookiePwd(homeform.username.value); if (tmppwd != "") { homeform.password.value = tmppwd; homeform.rempwd.checked = true; } } function searchvalidate() { homeform=document.forms["SearchEntry"]; if(Trim(homeform.searchstring.value)=="") { alert("Please enter the text to search"); homeform.searchstring.focus(); return(0); } var TDBPath = "a556c5/homepage.nsf" var docid = 'F534C25586601DCA4825779700248E1C' ; var spos = TDBPath.lastIndexOf("/"); var DBPath = "/" + TDBPath.substring(0,spos) + "/search.nsf/SearchResults?openform&docid="+docid+"&searchstr=" var stringval = homeform.searchstring.value; window.location.href=DBPath+stringval; } function radioGet(checkObj) { retVal = new Array(); var j = 0; for(var i=0; i-1) { pos=strReplace.indexOf(out); strReplace = "" + (strReplace.substring(0, pos) + add + strReplace.substring((pos + out.length), strReplace.length)); } return strReplace; } function Homesearchvalidate() { homeform=document.forms["SearchEntry"]; if(Trim(homeform.searchstring.value)=="") { alert("Please enter the text to search"); homeform.searchstring.focus(); return(0); } var TDBPath = "a556c5/homepage.nsf" var spos = TDBPath.lastIndexOf("/"); var stringval = homeform.searchstring.value; var docid = 'F534C25586601DCA4825779700248E1C' ; retval = radioGet(homeform.searchselect); var exturl = 'http://www.google.com/search?hl=en&ie=UTF-8&oe=UTF-8&q=##Query' ; if (retval == '1') { var DBPath = "/" + TDBPath.substring(0,spos) + "/search.nsf/SearchResults?openform&docid="+docid+"&searchstr=" //window.location.href=DBPath+stringval; searchWindow = window.open("","searchWindow",DBPath); document.form.target = "searchWindow"; document.form.submit(); searchWindow.focus(); //window.open(DBPath+stringval); } else { //var exturlstr = replaceChars(exturl,'##Query',stringval); //search outside - Google directly var exturlstr = replaceChars("http://www.google.com/search?hl=en&ie=UTF-8&oe=UTF-8&q=##Query",'##Query',stringval); var DBPath = "/" + TDBPath.substring(0,spos) + "/search.nsf/HomeSearch?createdocument&searchstr=" NewWindow(exturlstr,'ExternalSearch',0,0) ; window.location.href="/"+TDBPath; } } function HTsearchvalidate() { homeform=document.forms["SearchEntry"]; //homeform=document.forms[1]; if(Trim(homeform.searchstring.value)=="") { alert("Please enter the text to search"); homeform.searchstring.focus(); return (0); } var TDBPath = "a556c5/homepage.nsf" var spos = TDBPath.lastIndexOf("/"); var stringval = homeform.searchstring.value; var docid = 'F534C25586601DCA4825779700248E1C' ; //retval = radioGet(homeform.searchselect); retval = homeform.select.options[homeform.select.selectedIndex].value var exturl = 'http://www.google.com/search?hl=en&ie=UTF-8&oe=UTF-8&q=##Query' ; if (retval == 'The Asian Banker') { var DBPath = "/" + TDBPath.substring(0,spos) + "/search.nsf/frmQSResults?openform&docid="+docid+"&searchstr=" window.open(DBPath+stringval); } else { //var exturlstr = replaceChars(exturl,'##Query',stringval); //search outside - Google directly var exturlstr = replaceChars("http://www.google.com/search?hl=en&ie=UTF-8&oe=UTF-8&q=##Query",'##Query',stringval); NewWindow(exturlstr,'ExternalSearch',0,0) ; //window.location.href="/"+TDBPath; } } function testsearchvalidate() { homeform=document.forms["SearchEntry"]; if(Trim(homeform.searchstring.value)=="") { alert("Please enter the text to search"); homeform.searchstring.focus(); return(0); } var TDBPath = "a556c5/homepage.nsf" var spos = TDBPath.lastIndexOf("/"); var stringval = homeform.searchstring.value; var docid = 'F534C25586601DCA4825779700248E1C' ; retval = radioGet(homeform.searchselect); var exturl = 'http://www.google.com/search?hl=en&ie=UTF-8&oe=UTF-8&q=##Query' ; if (retval == '1') { var DBPath = "/" + TDBPath.substring(0,spos) + "/search.nsf/frmQSResults?openform&docid="+docid+"&searchstr=" window.open(DBPath+stringval); } else { //var exturlstr = replaceChars(exturl,'##Query',stringval); //search outside - Google directly var exturlstr = replaceChars("http://www.google.com/search?hl=en&ie=UTF-8&oe=UTF-8&q=##Query",'##Query',stringval); NewWindow(exturlstr,'ExternalSearch',0,0) ; window.location.href="/"+TDBPath; } } function checkKey(e){ if ((e.keyCode) == 13) { HTsearchvalidate() } }