var Util=new Object();Util.openWindow=function(url,width,height,left,top){if(left==null){left="250px";}
if(top==null){top="150px";}
if(width==null){width="500px";}
if(height==null){height="500px";}
var param="height="+height+",width="+width+",left="+left+",top="+top+",resizable=yes,scrollbars=yes,status=no,toolbar=no,menubar=no,location=no";window.open(url,"",param);};Util.htmlEncode=function(text){return text.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;");};Util.trim=function(text){if(typeof(text)=="string"){return text.replace(/^\s*|\s*$/g,"");}else{return text;}};Util.isEmpty=function(val){switch(typeof(val)){case"string":return Util.trim(val).length==0?true:false;break;case"number":return val==0;break;case"object":return val==null;break;case"array":return val.length==0;break;default:return true;}};if(typeof specialCharacter=="undefined"){var specialCharacter=new Array("≤","≥","ºC","℃","°");}
Util.isChinese=function(str){for(var i=0;i<specialCharacter.length;i++){reg=new RegExp(specialCharacter[i],"g");str=str.replace(reg,"");}
var re=/^[\x00-\x7F]*$/;if(!re.test(str)){return true;}else{return false;}};Util.isNumber=function(val){if(val==null){return false;}
reg=/^[\d|\.|,]+$/;return reg.test(val);};Util.isFloat=function(val){if(val==null){return false;}
reg=/^[\d\.]+$/;return reg.test(val);};Util.isInt=function(val){if(val==null){return false;}
reg=/\D+/;return!reg.test(val);};Util.isEmail=function(email){if(val==null){return false;}
reg1=/([\w-\.]+)@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.)|(([\w-]+\.)+))([a-zA-Z]{2,4}|[0-9]{1,3})(\]?)/;return reg1.test(email);};Util.isTel=function(tel){if(val==null){return false;}
reg=/^[\d|\-|\s|\_]+$/;return reg.test(tel);};Util.isDateTime=function(val){if(val==null){return false;}
reg=/^\d{4}-\d{2}-\d{2}\s\d{2}:\d{2}$/;return reg.test(val);};Util.isDate=function(val){if(val==null){return false;}
reg=/^\d{4}-\d{2}-\d{2}$/;return reg.test(val);};Util.isUrl=function(val){if(val==null){return false;}
reg=/^https?:\/\/.+$/i;return reg.test(val);};Util.fixEvent=function(e){evt=(typeof e=="undefined")?window.event:e;return evt;};Util.getQueryParams=function(){var startIndex=location.href.lastIndexOf("?");var endIndex=location.href.length;var params={};if(startIndex!=-1){var tmps=location.href.substring(startIndex+1,endIndex).split("&");$.each(tmps,function(i,n){v=n.split("=");params[v[0]]=v[1];});}
return params;};Util.srcElement=function(e){if(typeof e=="undefined"){e=window.event;}
src=document.all?e.srcElement:e.target;return src;};Util.setCookie=function(name,value,minutes,path){var cookie=new Array();cookie.push(name+"="+encodeURIComponent(value));if(minutes&&Util.isInt(minutes)){var expires=new Date();expires.setTime(expires.getTime()+minutes*60000);cookie.push("expires="+expires.toGMTString());}
if(path){cookie.push("path="+path);}else{cookie.push("path=/");}
document.cookie=cookie.join("; ");};Util.getCookie=function(name){cookies=document.cookie.split("; ");for(i=0;i<cookies.length;i++){cookie=cookies[i].split("=");if(name==cookie[0]){return decodeURIComponent(cookie[1]);}}
return"";};Util.removeCookie=function(name){document.cookie=name+"=; expires=Fri, 31 Dec 1999 23:59:59 GMT;";};Util.setImgWH=function(img,imgW,imgH){var imgObj=new Image();imgObj.onload=function(){if(imgObj.width!=0&&imgObj.height!=0){if(imgObj.width>=imgW||imgObj.height>=imgH){var iHeight=imgObj.height*imgW/imgObj.width;if(iHeight<=imgH){img.width=imgW;img.height=iHeight;}else{var iWidth=imgObj.width*imgH/imgObj.height;img.width=iWidth;img.height=imgH;}}else{}}else{img.width=imgW;img.height=imgH;}}
imgObj.src=img.src;};Util.checkAll=function(toggleObj,checkboxName){if($(toggleObj).attr("checked")){$(":checkbox[name='"+checkboxName+"']:not(:disabled)").attr("checked","checked");}else{$(":checkbox[name='"+checkboxName+"']:not(:disabled)").removeAttr("checked");}};Util.chkedChild=function(toggleObj,checkboxName){$(":checkbox[name='"+checkboxName+"']:not(:disabled)").click(function(){if(!$(this).attr("checked")){$(toggleObj).removeAttr("checked");}else if($(":checkbox[name='"+checkboxName+"']:not(:disabled)").length==$(":checkbox[name='"+checkboxName+"']:checked:not(:disabled)").length){$(toggleObj).attr("checked","true");}});}
Util.isChecked=function(name){if($("[name='"+name+"']:checked").size()>0){return true;}else{return false;}};Util.loadValidateCode=function(form,imgId,url){if(form&&form.validateCodeKey&&document.getElementById(imgId)){var date=new Date();var key=date.getTime()+Math.random();form.validateCodeKey.value=key;document.getElementById(imgId).src=url+"?hi_vc_key="+key;}};Util.imgZoom=function(img){var zoom=parseInt(img.style.zoom,10)||100;zoom+=event.wheelDelta/12;if(zoom>0){img.style.zoom=zoom+"%";}
return false;}
var cnenCode={65281:33,183:64,8230:94,8212:38,65288:40,65289:41,8212:95,65306:58,65307:59,8220:34,8221:34,8216:39,124:124,12289:92,12298:60,65292:44,12299:62,12290:46,65311:63,8217:39,12304:91,12305:93};Util.replaceCn=function(str){var result="";var charCode=0;var char_="";for(var i=0;i<str.length;i++){charCode=str.charCodeAt(i);if(charCode==12288){char_=String.fromCharCode(charCode-12256);result+=char_;continue;}
if(charCode>65280&&charCode<65375){charCode=charCode-65248;}
if(cnenCode[charCode])
char_=String.fromCharCode(cnenCode[charCode]);else
char_=String.fromCharCode(charCode);result+=char_;}
return result;}
Util.replaceCnToEn=function(id){var description=$.trim($("#"+id).val());description=Util.replaceCn(description);$("#"+id).val(description);return description;};
