var animationTime=300,exBackground,asynchronous,ajaxLoading=true,ajaxLoadingDiv;function loadBackground(){exBackground=$('<div style="display:none; background:#FFFFFF; position:absolute; left:0px; top:0px; z-index:9998; width:1000px; height:600px; filter:alpha(opacity=50);-moz-opacity:0.5;-khtml-opacity: 0.5;opacity: 0.5;"></div>');$("body").append(exBackground)}function loadAjaxLoading(){ajaxLoadingDiv=$('<div id="divLoading" style="width:229px; height:67px; background:url(../../images/loading_bg.jpg); position:absolute; left:0px; top:0px; z-index:10001; display:none;"><div style="padding:18px 0px 0px 18px; text-align:left;"><img src="../../images/loading.gif" /></div></div>');ajaxLoadingDiv.appendTo("body")}function showAjaxBox(){if(!asynchronous)return;var c=(self.document.documentElement.clientWidth-229)/2,d=(self.document.documentElement.clientHeight-67)/2+self.document.documentElement.scrollTop;exBackground.css("width",self.document.documentElement.clientWidth);var b=self.document.documentElement.scrollHeight,a=self.document.documentElement.clientHeight;if(b<a)exBackground.css("height",a);else exBackground.css("height",b);ajaxLoadingDiv.css("left",c+"px");ajaxLoadingDiv.css("top",d+"px");window.status="Loading...";exBackground.show();ajaxLoadingDiv.show()}$(function(){var i="btnDeleteAll_focus",h="btnAdd_focus",g="btnReturn_focus",f="btnOK_focus",e="btnCancel_focus",d="btnSms_focus",c="btnExport_focus",b="btnSearch_focus",a="text_focus",k=".textarea, .text",j=".datalist tr:gt(0)";$(j).live("mouseover",function(){setColor(this,true)});$(j).live("mouseout",function(){setColor(this,false)});$(k).focus(function(){$(this).addClass(a)});$(k).blur(function(){$(this).removeClass(a)});$("#btnSearch").hover(function(){$(this).addClass(b)},function(){$(this).removeClass(b)});$("#btnExport").hover(function(){$(this).addClass(c)},function(){$(this).removeClass(c)});$("#btnSms").hover(function(){$(this).addClass(d)},function(){$(this).removeClass(d)});$("#btnCancel").hover(function(){$(this).addClass(e)},function(){$(this).removeClass(e)});$("#btnOK").hover(function(){$(this).addClass(f)},function(){$(this).removeClass(f)});$("#btnReturn").hover(function(){$(this).addClass(g)},function(){$(this).removeClass(g)});$(".btnAdd").hover(function(){$(this).addClass(h)},function(){$(this).removeClass(h)});$("#btnDeleteAll").hover(function(){$(this).addClass(i)},function(){$(this).removeClass(i)});try{AjaxPro.onLoading=function(a){asynchronous=a;if(!ajaxLoading)return;if(a){if(window.status=="Loading...")return;exBackground==null&&loadBackground();ajaxLoadingDiv==null&&loadAjaxLoading();setTimeout("showAjaxBox()",500)}else{window.status="";exBackground.hide();ajaxLoadingDiv.fadeOut(100)}}}catch(l){}});$.fn.vc=function(c,h,f,e,d,g){var b=true,a="正确";this.each(function(){var m="个字符（注意：一个汉字视为2两个字符）。",l="请正确的输入您的",k=null,i=false,j=this.value;if(h&&j==""){a=c+"必须填写";b=i}else if(d=="number"){if(j!=""&&isNaN(j)){a=c+"只能输入数字。";b=i}if(f!=k)if(j!=""&&parseFloat(j)<f){a=c+"的值不能小于"+f;b=i}if(e!=k)if(j!=""&&parseFloat(j)>e){a=c+"的值不能大于"+e;b=i}}else{if(j!=""&&d!=k&&d=="phone"&&!isPhone(j)){a=l+c+"号码。";b=i}if(j!=""&&d!=k&&d=="email"&&!isEMail(j)){a=l+c;b=i}if(j!=""&&d!=k&&d=="date"&&!isDate(j)){a="请输入正确的日期格式。（例如2010-10-01）。";b=i}if(j!=""&&f!=0&&getByteCount(j)<f){a=c+"至少要填写"+f+m;b=i}if(j!=""&&e!=0&&getByteCount(j)>e){a=c+"至多能填写"+e+m;b=i}}if(g!=k)$("#"+g).html(a);else if(!b)try{this.select();this.focus();alert(a)}catch(n){}});return b};function getByteCount(b){var a=0;for(i=0;i<b.length;i++)if(b.charAt(i).charCodeAt()<=255)a++;else a=a+2;return a}function isChinese(b){var a=/^[\u0391-\uFFE5]+$/;return a.test(b)}function isDate(b){if(b=="")return false;var d=/^(\d{4})(-|\/)(\d{1,2})\2(\d{1,2})$/;if(!d.test(b))return false;else{var a=b.match(d),c=new Date(a[1],a[3]-1,a[4]);return c.getFullYear()==a[1]&&c.getMonth()+1==a[3]&&c.getDate()==a[4]}}function isPhone(b){var a=/(^[0-9]{3,4}\-[0-9]{7,8}(-[0-9]{1,4})$)|(^[0-9]{3,4}\-[0-9]{7,8}$)|(^[0-9]{7,8}(-[0-9]{1,4})$)|(^[0-9]{7,8}$)|(^\([0-9]{3,4}\)[0-9]{3,8}(-[0-9]{1,4})$)|(^\([0-9]{3,4}\)[0-9]{3,8}$)|(^0{0,1}1[8,3,5][0-9]{9}$)/;return a.test(b)}function isEMail(b){var a=/^[a-zA-Z0-9_-]+@[a-zA-Z0-9_-]+(\.[a-zA-Z0-9_-]+)+$/;return a.test(b)}function go(a,b){if(b)window.parent.location.href=a;else document.location.href=a}function switchCode(a){a.src="../validatecode.aspx?"+Math.random()}function getRadio(a){return $("input[name='"+a+"']:checked").val()}function setRadio(a,b){$("input[name='"+a+"'][value='"+b+"']").attr("checked",true)}function getCheckBox(b){var a=[];$("input[name='"+b+"']:checked").each(function(){a.push(this.value);return true});return a.join(",")}function getCheckBoxList(b){var a=[];$(b+" input:checked").each(function(){a.push(this.value);return true});return a.join(",")}function setCheckBox(c,a){var b="input[name='";if(a==null||a=="")$(b+c+"']:checked").attr("checked",false);else{a=","+a+",";$(b+c+"']").each(function(){this.checked=a.indexOf(","+this.value+",")!=-1})}}function setColor(d,c){var a="#FFFFFF",b=d.childNodes;if(c)a="#FFFFCC";for(i=0;i<b.length;i++)b[i].style.backgroundColor=a}function selectAll(b){var a=document.getElementsByName("chkSelected");for(i=0;i<a.length;i++)if(b==null)a[i].checked=!a[i].checked;else a[i].checked=b}function pad(c,b){var a=""+c;while(a.length<b)a="0"+a;return a}function getSearchValues(c){for(var b=[],a=0;a<c.length;a++)b.push($("#"+c[a]).val());return b.join("\n")}function _setFeature(c){var b="../../images/";ajaxLoading=true;var e=c.value,a=c.request.args,d=b+a.state+".gif";if(errors(e))d=b+e.Tag[0]+".gif";$("#bool"+a.category+"_"+a.id).attr("src",d)}Date.prototype.format=function(b){var a=this,d={"M+":a.getMonth()+1,"d+":a.getDate(),"h+":a.getHours(),"m+":a.getMinutes(),"s+":a.getSeconds(),"q+":Math.floor((a.getMonth()+3)/3),S:a.getMilliseconds()};if(/(y+)/.test(b))b=b.replace(RegExp.$1,(a.getFullYear()+"").substr(4-RegExp.$1.length));for(var c in d)if((new RegExp("("+c+")")).test(b))b=b.replace(RegExp.$1,RegExp.$1.length==1?d[c]:("00"+d[c]).substr((""+d[c]).length));return b};function parseDate(b){if(typeof b=="string"){var a=b.match(/^ *(\d{4})-(\d{1,2})-(\d{1,2}) *$/);if(a&&a.length>3)return new Date(parseInt(a[1]),parseInt(a[2])-1,parseInt(a[3]));a=b.match(/^ *(\d{4})-(\d{1,2})-(\d{1,2}) +(\d{1,2}):(\d{1,2}):(\d{1,2}) *$/);if(a&&a.length>6)return new Date(parseInt(a[1]),parseInt(a[2])-1,parseInt(a[3]),parseInt(a[4]),parseInt(a[5]),parseInt(a[6]));a=b.match(/^ *(\d{4})-(\d{1,2})-(\d{1,2}) +(\d{1,2}):(\d{1,2}):(\d{1,2})\.(\d{1,9}) *$/);if(a&&a.length>7)return new Date(parseInt(a[1]),parseInt(a[2])-1,parseInt(a[3]),parseInt(a[4]),parseInt(a[5]),parseInt(a[6]),parseInt(a[7]))}return null}function getDate(b,a){if(b==null||b=="")return"";if(a==null||a=="")a="yyyy-MM-dd";return parseDate(b).format(a)}function errors(b){var d="#validate",a=false,c="系统正忙，请稍候再试。";if(b==null){alert(c);return a}switch(b.Code){case-1:return true;case-2:alert("验证码填写错误。");$(d).select();$(d).focus();$(".validatecode").click();return a;case-3:alert("登录已超时，请重新登录。");return a;case-4:alert("你不具备添加权限，请联系网站高级管理员。");return a;case-5:alert("你不具备修改权限，请联系网站高级管理员。");return a;case-6:alert("你不具备删除权限，请联系网站高级管理员。");return a;case-7:alert("你不具备审权限，请联系网站高级管理员。");return a;case-20:alert("删除数据失败，请联系管理员。");return a;case-21:alert("数据不存在，可能已经被删除。请联系高级管理员。");return a;case-22:alert("系统中已经存在用户名“"+b.Tag[0]+"”，请重新选择。");return a;case-23:alert("系统中已经存在值“"+b.Tag[0]+"”，请重新填写。");return a;case-24:alert("获取SMTP信息失败。");return a;case-25:alert("获取邮件信息失败。");return a;case-26:alert("请选择群发群体。");return a;case-40:alert("用户名或密码填写错误。");return a;case-41:alert("该帐户已被超级管理员停用。请联系超级管理员。");return a;case-42:alert("此IP被限制为禁止登陆。");return a;case-100:alert(c);return a;default:alert(b.Tag[0]);return a}};
