function E(elementid) { var obj; try { obj = document.getElementById(elementid); } catch (err) { alert(elementid+" NOT Found!","System"); } return obj; } function getE(elementid){ return E(elementid); } function setDisplays(es,s){ for(var n=0;n0 ) return 1; if ( isFirefox=navigator.userAgent.indexOf("Firefox")>0 ) return 2; if ( isSafari=navigator.userAgent.indexOf("Safari")>0 ) //google return 3; if ( isCamino=navigator.userAgent.indexOf("Camino")>0 ) return 4; if ( isMozilla=navigator.userAgent.indexOf("Gecko/")>0) return 5; return 0; } RegExp.escape = function(text) { if (!arguments.callee.sRE) { var specials = [ '/', '.', '*', '+', '?', '|', '(', ')', '[', ']', '{', '}', '\\' ]; arguments.callee.sRE = new RegExp( '(\\' + specials.join('|\\') + ')', 'g' ); } return text.replace(arguments.callee.sRE, '\\$1'); } function urlEncode(str){ return encodeURIComponent(str); } function debugObj(obj) { var props = ""; for(var p in obj){ if(typeof(obj[p])=="function"){ obj[p](); }else{ props+= p + "=" + obj[p] + "\t"; } } alert(props); } function onRun(fun, run_stop_cond, stop_cond){ var timeout=30000; var timeper = 250; var timecounter=0; var t=window.setInterval( function(){ //E("debugstr").innerHTML+="."; timecounter+=timeper; if(stop_cond()||timecounter>timeout){ window.clearInterval(t); return; } if(run_stop_cond()){ window.clearInterval(t); fun(); return; } } ,timeper ); } function reloadVerify(imgid){ E(imgid).src="code.php?t="+getTimer(); } //得到字符长度,英文1,中文2 function getLength(input) { var i,cnt = 0; var temp = input; for ( i=0; i=4 ) { cnt+=2; } else { cnt++; } } return cnt; } function isSucceed(calldata){ return (calldata.substring(0,3)=='_Y_'); } function getCallBackData(calldata){ if(calldata=="")return""; var reg = /_Y_(.[^_Y_]*)_Y_/; var result = reg.exec(calldata); if(result){ return (result[1]); }else{ return (""); } } function selectAll(formid,b){ var oForm=E(formid); for (var i = 0; i < oForm.elements.length; i++) { if(oForm.elements[i].type=="checkbox"&&!oForm.elements[i].disabled){ oForm.elements[i].checked = b; } } } function initMouseEvent(targetDivName){ try{ var divObjs =document.getElementsByTagName('div'); for(var i=0; i"; } function correctPNG() { for(var i=0; i" img.outerHTML = strNewHTML i = i-1 }; }; }; if(navigator.userAgent.indexOf("MSIE")>-1) { window.attachEvent("onload", correctPNG); }; function checkSearchKeyPressEnter(eventobject,objid){var eve=eventobject||window.event;if(eve.keyCode==13) {searchproducts(objid);}} function searchproducts(objid){objid=objid==undefined?"keyword":objid;window.location.href = "search.php?k="+urlEncode(E(objid).value);} function search_InitPage(objid){objid=objid==undefined?"keyword":objid;if(E(objid)){E(objid).onkeyup = function(event){checkSearchKeyPressEnter(event,objid);};}} $(document).ready(function(e){search_InitPage();});