function trim(stringToTrim) { var i, j //left trim for(i=0; i=i; j--) { if (stringToTrim.charAt(j) != " " || stringToTrim.charAt(i) != "\n") break } return stringToTrim.substring(i, j + 1) } function win(a,b,c,d) { dowin=window.open(a,b,'width='+c+',height='+d+',resizable=1,scrollbars=1,status=0,menubar=1'); dowin.creator=self; } //-----------------------------------------Control------------------------------------------------------ function onlyNum() { if(!((event.keyCode>=48&&event.keyCode<=57)||(event.keyCode>=96&&event.keyCode<=105)||(event.keyCode==8 || event.keyCode==190 || event.keyCode==110 || event.keyCode==46))) { event.returnValue=false; } } function onlyEng() { if(!((event.keyCode>=65&&event.keyCode<=90)||(event.keyCode==8 || event.keyCode==190))) { event.returnValue=false; } } function validateDate(year, month, day) { var regex = new RegExp(/S/); if(regex.test(day)&& regex.test(month) && regex.test(year)) { var regExp = new RegExp(/d/); if(!regExp.test(day)|| !regExp.test(month) || !regExp.test(year)) return ("The date fields contains non-number."); var tempDateValue = year + "/" + month + "/" + day; if(tempDateValue.length < 6||tempDateValue.length > 10) return ("The length of date fields is invalid."); var tempDate = new Date(tempDateValue); if(isNaN(tempDate)) return ("The scope of date fields is invalid."); if(parseInt(year) > 1900 && parseInt(year) < 2500 && ((tempDate.getUTCFullYear()).toString()==year) && (tempDate.getMonth()==parseInt(month)-1) && (tempDate.getDate()==parseInt(day))) return ("The date fields is OK."); else return ("The date fields is invalid."); } } //-----------------------------------------Control-------------------------------------------------------- function do_confirm_link(link,msg) { var x=window.confirm(msg); if (x) { window.location.href = link; } } function doConfirmRun(msg,obj) { var x=window.confirm(msg); if (x) { eval(obj); } } function GookieVal(offset) { var endstr = document.cookie.indexOf (";", offset); if (endstr == -1) endstr = document.cookie.length; return unescape(document.cookie.substring(offset, endstr)); } function Gookie(name) { var arg = name + "="; var alen = arg.length; var clen = document.cookie.length; var i = 0; while (i < clen) { var j = i + alen; if (document.cookie.substring(i, j) == arg) return GookieVal (j); i = document.cookie.indexOf(" ", i) + 1; if (i == 0) break; } return null; } function Sookie(name, value) { var argv = Sookie.arguments; var argc = Sookie.arguments.length; var expires = (argc > 2) ? argv[2] : null; var path = (argc > 3) ? argv[3] : null; var domain = (argc > 4) ? argv[4] : null; var secure = (argc > 5) ? argv[5] : false; document.cookie = name + "=" + escape (value) + ((expires == null) ? "" : ("; expires=" + expires.toGMTString())) + ((path == null) ? "" : ("; path=" + path)) + ((domain == null) ? "" : ("; domain=" + domain)) + ((secure == true) ? "; secure" : ""); } function Dookie(name) { var exp = new Date(); exp.setTime (exp.getTime() - 1); var cval = Gookie (name); document.cookie = name + "=" + cval + "; expires=" + exp.toGMTString(); } function SetCookie(COOKIENAME,DATAIS) { var expdate = new Date(); // 設定期限為一年後 expdate.setTime(expdate.getTime() + (24 * 60 * 60 * 1000 * 365)); Sookie(COOKIENAME, DATAIS, expdate, "/", null, false); } function GetCookie(COOKIENAME){ return Gookie(COOKIENAME)? Gookie(COOKIENAME) : ''; } function do_search_change(nameis,valueis) { SetCookie(nameis,valueis); } function ShowHide(l){ if(document.getElementById(l).style.display=="none"){ document.getElementById(l).style.display=""; } else{ document.getElementById(l).style.display="none"; } } function showDiv(sDivID, bState) { var oDiv = document.getElementById(sDivID); /*@cc_on @if (@_jscript_version >= 5) try { var oIframe = document.getElementById('HelpFrame'); oIframe.scrolling = 'no'; } catch (e) { var oIframe = document.createElement('iframe'); var oParent = oDiv.parentNode; oIframe.id = 'HelpFrame'; oParent.appendChild(oIframe); } oIframe.frameborder = 0; oIframe.style.position = 'absolute'; oIframe.style.top = 0; oIframe.style.left = 0; oIframe.style.display = 'none'; @end @*/ if (bState) { oDiv.style.display = 'block'; /*@cc_on @if (@_jscript_version >= 5) oIframe.style.top = oDiv.style.top; oIframe.style.left = oDiv.style.left; oIframe.style.zIndex = oDiv.style.zIndex - 1; oIframe.style.width = parseInt(oDiv.offsetWidth); oIframe.style.height = parseInt(oDiv.offsetHeight); oIframe.style.display = 'block'; @end @*/ } else { /*@cc_on @if (@_jscript_version >= 5) oIframe.style.display = 'none'; @end @*/ oDiv.style.display = 'none'; } } function ShowMe(l){ document.getElementById(l).style.display=""; } function HideMe(l){ document.getElementById(l).style.display="none"; } function focus_select(sel,selval) { for (l=0; lX'; str+=''; str+=''; document.write(str); } endTable=function() { var str=''; str+=''; document.write(str); } openAddOn=function(idis) { $('#editlayer_'+idis).slideUp('fast'); $('#editlayer_'+idis).slideDown('slow'); } closeAddOn=function(idis) { $('#editlayer_'+idis).slideUp('slow'); } imageAddOn=function(sid,idis,url) { startTable(idis); document.write(""); endTable(); } getMenu2=function(idis) { var str=''; document.write(str); } getMenu=function(url,sid,refvar) { var ondata=$("#funclist"+refvar).html(); if(ondata=="") { $.post(url, {sid: ""+sid, subdata: "1",search_id: ""+refvar, time: ""+(new Date()).getTime() } , function(data) { htmljson=getVarArray(data); html=htmljson[0]; json=getJSON(htmljson[1]); $("#funclist"+refvar).html(trim(html)); $("#funclist"+refvar).fadeTo("fast","0.1"); $("#funclist"+refvar).fadeTo("fast","1"); try { getLeftMenu(); } catch(error) { } } ,"html"); } else { $("#funclist"+refvar).fadeTo("fast","0.1"); $("#funclist"+refvar).hide(); $("#funclist"+refvar).html(""); } // end if } showMenu=function(idis,url) { showedit(idis,url); void(0); } getVarArray=function(data) { htmljson=data.split("[SYSVAR]"); return htmljson; } getJSON=function(jstr) { return eval('(' + jstr + ')'); } getFormValuesForJQ=function(fname,sid,prgurl,runprg) { var str = ""; var qstr=$('#'+fname+'').serialize()+'&sid='+sid+'&'; str='$.post("'+prgurl+'","'+qstr+'", \nfunction(data) { \n'+runprg+'\n } ,"html");'; return str; } function print_r(theObj){ if(theObj.constructor == Array || theObj.constructor == Object){ document.write("") } } function stoperror() { return true; } window.onerror=stoperror $.fn.serializeObject = function() { var o = {}; var a = this.serializeArray(); $.each(a, function() { if (o[this.name]) { if (!o[this.name].push) { o[this.name] = [o[this.name]]; } o[this.name].push(this.value || ''); } else { o[this.name] = this.value || ''; } }); return o; }; function removeStrList(varis,removekey) { var varis1=','+varis+','; var removekey1=','+removekey1+','; var resultvar=varis1.split(removekey).join(''); var newresultvar=''; var rearray=resultvar.split(','); var len=rearray.length; for(var i=0;i