﻿var AsyncBox={Icon:true,Fixed:false,Flash:false,autoReset:false,inFrame:true,zIndex:1000020,minWidth:330,maxWidth:700,Move:{Enable:true,Limit:true,Clone:true},Cover:{opacity:0.1,background:'#000'},Wait:{Enable:true,text:'加载中...'},Language:{OK:'确 定',NO:' 否 ',YES:' 是 ',CANCEL:'取 消',CLOSE:'关闭'}};(function(D){var j=AsyncBox,i=document,k="asyncbox_",w=false,F=false,c=[],g=[],h=[],n=[],I,N=!!window.ActiveXObject&&!window.XMLHttpRequest;function L(R){return i.getElementById(R)}function d(){var R=i.body,S=i.documentElement;return{x:Math.max(R.scrollWidth,S.clientWidth),y:Math.max(R.scrollHeight,S.clientHeight),top:Math.max(S.scrollTop,R.scrollTop),left:Math.max(S.scrollLeft,R.scrollLeft),width:S.clientWidth,height:S.clientHeight}}D(function(){J();if(j.Fixed){N&&D("body").css("backgroundAttachment")!=="fixed"&&D("html").css({backgroundImage:"url(about:blank)",backgroundAttachment:"fixed"});I=I}});function J(){D("body").append(['<div id="'+k+'cover" unselectable="on" style="opacity:',j.Cover.opacity,";filter:alpha(opacity=",j.Cover.opacity*100,");background:",j.Cover.background,'">',j.inFrame?"<!--[if IE 6]><div><iframe></iframe></div><div></div><![endif]-->":"","</div>",'<div id="'+k+'clone"></div>','<div id="'+k+'focus"></div>','<div id="'+k+'load"><div><span></span></div></div>'].join(""))}I={fixed:N?function(S,T){var R=S.style,W="document.documentElement",V=S.offsetTop-T.top,U=S.offsetLeft-T.left;this.absolute(S);R.setExpression("top","eval("+W+".scrollTop + "+V+') + "px"');R.setExpression("left","eval("+W+".scrollLeft + "+U+') + "px"')}:function(R){R.style.position="fixed"},absolute:N?function(S){var R=S.style;R.position="absolute";R.removeExpression("left");R.removeExpression("top")}:function(R){R.style.position="absolute"}};function G(R){o(D.extend({title:"提示",content:"",top:-1,right:-1,bottom:-1,left:-1,width:"auto",height:"auto",layout:k+"auto",tipsbar:false,btnsbar:false,pageMode:false,htmlMode:false,inputMode:false,drag:true,flash:true,modal:true,autoReset:true,scrolling:"auto",callback:function(){}},R))}function Q(){return true}function o(R){if(Q()){var T=R.id,S=L(T);if(S){H(R);S.style.zIndex=j.zIndex++;S.style.visibility="visible"}else{h.push(R.id);H(R);D("body").append("<div id="+T+" class="+R.layout+' style="top:0;z-index:'+(j.zIndex++)+'">'+v(R)+"</div>");M(R);l(R);f(R);D("#"+T).mousedown(function(U){if(U.which==1){this.style.zIndex=j.zIndex++}});j.Move.Enable&&R.drag&&p(R)}}}function p(T){var ad=T.id,ae=el=L(ad),V=els=el.style,U,ac,Z,af,ai,ag,aa,W,ab,X,Y=L(k+"clone"),R=Y.style;D("#"+ad+"_header").mousedown(function(aj){if(aj.which==1&&aj.target.tagName!="A"){U=d();B(T,true);el=ae,els=ae.style;ac={top:el.offsetTop,left:el.offsetLeft,width:el.offsetWidth,height:el.offsetHeight};j.Move.Clone&&(!N&&j.Fixed&&(R.position="fixed"),R.top=ac.top+"px",R.left=ac.left+"px",R.width=ac.width-2+"px",R.height=ac.height-2+"px",R.display="block",el=Y,els=Y.style);aa=aj.clientX-ac.left;W=aj.clientY-ac.top;j.Move.Limit&&(!N&&j.Fixed?(Z=af=0,ai=U.height-ac.height,ag=U.width-ac.width):(Z=U.top,af=U.left,ai=U.height+Z-ac.height,ag=U.width+af-ac.width));el.setCapture?(el.setCapture(),el.onmousemove=function(ak){S(ak||event)},el.onmouseup=ah):(D(i).bind("mousemove",S).bind("mouseup",ah));aj.preventDefault()}});function S(aj){ab=aj.clientX-aa,X=aj.clientY-W;j.Move.Limit&&(ab<=af?ab=af:ab>=ag&&(ab=ag),X<=Z?X=Z:X>=ai&&(X=ai));els.top=X+"px",els.left=ab+"px"}function ah(){B(false);j.Move.Clone&&(j.Flash?O(ae,{top:el.offsetTop,left:el.offsetLeft}):(V.top=el.offsetTop+"px",V.left=el.offsetLeft+"px"),R.display="none");N&&j.Fixed&&E(ae);el.releaseCapture?(el.releaseCapture(),el.onmousemove=null,el.onmouseup=null):(D(i).unbind("mousemove",S).unbind("mouseup",ah))}}function B(S,R){var U=L(k+"focus"),T=U.style;S?S.pageMode&&!j.Move.Clone&&R&&(T.display="block"):T.display="none"}function H(R){if(R.modal){c.push(j.zIndex);g.push(R.id);D.cover(true,j.zIndex)}}function v(R){var T=R.pageMode||R.htmlMode?"b_m_m":"a_m_m",S=R.pageMode||R.htmlMode?"b_btnsbar_m":"a_btnsbar_m",U="";R.data&&(typeof R.data=="string"?U="?"+R.data:U="?"+D.param(R.data));return[(j.inFrame&&R.pageMode||R.htmlMode)?'<!--[if IE 6]><iframe class="'+k+'select"></iframe><![endif]-->':"",R.inputMode?"":'<input id="'+R.id+'_Focus" type="button" style="position:absolute;z-index:-5">','<table class="'+k+'table" border="0" cellspacing="0" cellpadding="0">',"<tbody>","<tr>",'<td class="b_t_l" id="'+R.id+'_left"></td>','<td class="b_t_m" id="'+R.id+'_header">','<div class="'+k+'title">',"<ul>",j.Icon?'<li class="'+k+'title_icon"></li>':"",'<li class="'+k+'title_tips"><strong>',R.title,"&nbsp;</strong></li>",'<li style="padding-left:30px">','<a id="'+R.id+'_close" class="'+k+'close" href="javascript:void(0)" title="'+j.Language.CLOSE+'">'+j.Language.CLOSE+"</a>","</li>","</ul>","</div>","</td>",'<td class="b_t_r" id="'+R.id+'_right"></td>',"</tr>",R.tipsbar?'<tr><td class="b_tipsbar_l"></td><td class="b_tipsbar_m" id="'+R.id+'_tipsbar" valign="top"><div class="b_tipsbar_layout"><ul><li class="b_tipsbar_title">'+R.tipsbar.title+'</li><li class="b_tipsbar_content">'+R.tipsbar.content+'</li></ul></div></td><td class="b_tipsbar_r"></td></tr>':"","<tr>",'<td class="b_m_l"></td>','<td class="'+T+'">',R.pageMode?"":R.inputMode?'<div class="'+k+'prompt"><ul><li>'+R.inputMode.tips+"</li><li>"+(R.textType=="text"?'<input type="text" id="'+R.id+'_Text" value="'+R.inputMode.content+'" size="60" />':"")+(R.textType=="textarea"?'<textarea cols="60" rows="10" id="'+R.id+'_Text">'+R.inputMode.content+"</textarea>":"")+(R.textType=="password"?'<input type="password" id="'+R.id+'_Text" value="'+R.inputMode.content+'" size="40" />':"")+"</li></ul></div>":R.htmlMode?'<div id="'+R.id+'_content" style="overflow:'+((R.scrolling=="yes"||R.scrolling=="auto")?"auto":"hidden")+'">'+R.html+"</div>":'<div id="'+R.id+'_content" style="overflow:hidden;overflow-y:auto"><div class="'+R.icon+'"><span></span>'+R.content+"</div</div>",R.pageMode?'<iframe frameborder="0" id="'+R.id+'_content" name="'+R.id+'_content" width="100%" src="'+R.url+U+'" scrolling="'+R.scrolling+'"></iframe>':"","</td>",'<td class="b_m_r"></td>',"</tr>",R.btnsbar?'<tr><td class="b_btnsbar_l"></td><td class="'+S+'" id="'+R.id+'_btnsbar"><div class="'+k+'btn_layout">'+t(R)+'</div></td><td class="b_btnsbar_r"></td></tr>':"","<tr>",'<td class="b_b_l"></td>','<td id="'+R.id+'_bottom" class="b_b_m"></td>','<td class="b_b_r"></td>',"</tr>","</tbody>","</table>",j.Wait.Enable&&R.pageMode?'<div class="'+k+'wait" id="'+R.id+'_wait"><span></span>'+j.Wait.text+"</div>":""].join("")}function O(S,R){D(S).animate(R,300,function(){N&&j.Fixed&&E(S)})}function t(R){if(R.btnsbar){var S=[];D.each(R.btnsbar,function(U,T){S.push('<a id="',R.id,"_",T.action,'"class="',k,'btn"',N?'href="javascript:void(0)"':"","><span>&nbsp;",T.text,"&nbsp;</span></a>")});return S.join("")}}function l(R){R.inputMode?D("#"+R.id+"_Text").focus().select():D("#"+R.id+"_Focus").focus().remove()}function f(R){var T,S=D.btn.CLOSE.concat(R.btnsbar);D.each(S,function(V,U){D("#"+R.id+"_"+U.action).click(function(W){this.disabled=true;if(R.inputMode){T=R.callback(U.action,L(R.id+"_Text").value)}else{if(R.pageMode){T=R.callback(U.action,D.box(R.id),D.returnValue)}else{if(R.htmlMode){T=R.callback(U.action,D.returnValue)}else{T=R.callback(U.action)}}}if(typeof T=="undefined"||T){if(R.pageMode&&R.closeType!="hide"){r(R.id+"_content")}D.close(R.id,R.closeType)}this.disabled=false;W.preventDefault()})})}function r(U){var S=L(U),R=D.iframe(U);if(S){S.src="about:blank";try{R.doc.write("");R.doc.clear();R.doc.close()}catch(T){}}}function M(R){C(R);a(R);j.Fixed&&E(L(R.id))}function A(R){if(j.Wait.Enable&&R.pageMode){D("#"+R.id+"_content").one("load",function(){D("#"+R.id+"_wait").remove()})}}function C(R){var W=R.id,T=L(W),S=T.style,U=d();if(R.pageMode||R.htmlMode){if(R.width!="auto"){S.width=R.width+"px"}if(R.height!="auto"){S.height=R.height+"px"}var V=D("#"+W+"_content");if(R.width>0&&R.htmlMode){V.width(R.width-D("#"+W+"_left").outerWidth()-D("#"+W+"_right").outerWidth())}if(R.height>0){V.height(R.height-D("#"+W+"_header").outerHeight()-D("#"+W+"_tipsbar").outerHeight()-D("#"+W+"_btnsbar").outerHeight()-D("#"+W+"_bottom").outerHeight())}A(R)}else{if(T.offsetWidth<j.minWidth&&!R.inputMode){T.className=k+"normal";S.width=j.minWidth+"px"}else{if(T.offsetWidth>j.maxWidth){T.className=k+"normal";S.width=j.maxWidth+"px"}}if(T.offsetHeight>U.height){D.size(R.id,T.offsetWidth,U.height)}}S.width=T.offsetWidth+"px"}function x(ab,aa,W){var T=aa||d();if(T.x>T.width||T.y>T.height){T=d()}var S=ab.id,U=L(S),X=U.style,Z=U.offsetHeight>T.height/2?(T.height-U.offsetHeight)/2:T.height*0.382-U.offsetHeight/2,Y=pt=!N&&j.Fixed?Z:T.top+Z,R=T.width-U.offsetWidth,V=pl=!N&&j.Fixed?R/2:T.left+R/2;if(!N&&j.Fixed){if(ab.top>=0){Y=ab.top}if(ab.right>=0){V=R-ab.right}if(ab.bottom>=0){Y=T.height-U.offsetHeight-ab.bottom}if(ab.left>=0){V=ab.left}}else{if(ab.top>=0){Y=T.top+ab.top}if(ab.right>=0){V=T.left+R-ab.right}if(ab.bottom>=0){Y=T.top+T.height-U.offsetHeight-ab.bottom}if(ab.left>=0){V=T.left+ab.left}}Y=Y<=0?0:Y;V=V<=0?0:V;if(W){O(U,{top:Y,left:V})}else{X.top=Y+"px",X.left=V+"px"}}function a(R){x(R,null,false);if(j.autoReset&&R.autoReset){u(R)}N&&j.Fixed&&E(L(R.id))}function u(R){var S=new Object();S.id=R.id;S.top=R.top;S.right=R.right;S.bottom=R.bottom;S.left=R.left;S.flash=R.flash;n.push(S);if(n.length>0&&!w){D(window).bind("resize",K),w=true}}var e,m,K=function(){e&&clearTimeout(e);if(w){m=d();e=setTimeout(function(){D.each(n,function(S){var R={},T=n[S];R.id=T.id;R.top=T.top;R.left=T.left;R.right=T.right;R.bottom=T.bottom;if(j.Flash&&T.flash){x(R,m,true)}else{x(R,m,false)}});clearTimeout(e)},100)}};function E(R){I.fixed(R,d())}D.btn={OK:[{text:j.Language.OK,action:"ok"}],NO:[{text:j.Language.NO,action:"no"}],YES:[{text:j.Language.YES,action:"yes"}],CLOSE:[{title:j.Language.CLOSE,action:"close"}],CANCEL:[{text:j.Language.CANCEL,action:"cancel"}]};D.btn.OKCANCEL=D.btn.OK.concat(D.btn.CANCEL);D.btn.YESNO=D.btn.YES.concat(D.btn.NO);D.btn.YESNOCANCEL=D.btn.YES.concat(D.btn.NO).concat(D.btn.CANCEL);D.cover=function(R,S){var U=D("#"+k+"cover"),T=L(k+"cover").style;if(R){F=R;T.zIndex=S||j.zIndex;j.Flash?(U.fadeTo(500,j.Cover.opacity)):U.show()}else{F=R;j.Flash?U.fadeOut(300):U.hide();c=[]}};D.close=function(T,S){var R=L(T);if(R){if(S!="hide"){n.length>0&&(n=z(n,T,"id"))}else{R.style.visibility="hidden"}w&&n.length==0&&(D(window).unbind("resize",K),w=false,n=[]);if(F){for(b in g){if(g[b]==T){g=z(g,T);if(c.length>1&&g.length!=0){c.pop();D.cover(true,c[c.length-1])}else{D.cover(false)}}}}D(R).remove()}};D.size=function(V,T,R){var S=L(V);if(S&&S.offsetWidth!=T||S.offsetHeight!=R){var U={id:S.id,width:T,height:R,pageMode:true,htmlMode:true};C(U);a(U);N&&j.Fixed&&E(S)}};D.iframe=function(R){return L(R).contentWindow};D.box=function(R){return D.iframe(R+"_content")};D.reload=function(U,R){var S=L(U+"_content");try{S.src=R||D.box(U).location.href}catch(T){S.src=S.src}};D.AsyncBox=function(S){var R=L(S);return(R&&R.style.visibility!="hidden"&&R.style.display!="none")?true:false};function z(R,T,S){return D.grep(R,function(U){return S?U[S]!=T:U!=T})}function q(U,V,T,S){if(D.isFunction(V)){T=V;V=undefined}var W=k+S,R={id:W,icon:W,title:V,content:U,layout:k+"auto",callback:T};if(S=="alert"||"success"||"error"){R.btnsbar=D.btn.OK}switch(S){case"confirm":R.btnsbar=D.btn.OKCANCEL;break;case"warning":R.btnsbar=D.btn.YESNOCANCEL;break}G(R)}D.alert=j.alert=function(S,T,R){q(S,T,R,"alert")};D.confirm=j.confirm=function(S,T,R){q(S,T,R,"confirm")};D.prompt=j.prompt=function(W,R,V,U,T){var S={id:k+"prompt",title:W,inputMode:{tips:R||"",content:V||""},textType:U,btnsbar:D.btn.OKCANCEL,callback:T};G(S)};D.open=j.open=function(R){R.id=R.id||k+j.zIndex;if(R.url){R.pageMode=true}else{if(R.html){R.htmlMode=true}}if(R.width){R.layout=k+"normal"}G(R)};D.success=j.success=function(S,T,R){q(S,T,R,"success")};D.warning=j.warning=function(S,T,R){q(S,T,R,"warning")};D.error=j.error=function(S,T,R){q(S,T,R,"error")};D.tips=j.tips=function(S,R,T,F){if(D.isPlainObject(R)){F=R;R=null}if(D.isPlainObject(T)){F=T;T=null}y(S,R||"alert",T,F)};function P(R,F){if(D.isPlainObject(F)){if(F.top!=undefined){R.style.top=F.top+"px"}if(F.left!=undefined){R.style.left=F.left+"px"}if(F.bottom!=undefined){R.style.bottom=F.bottom+"px"}if(F.right!=undefined){R.style.right=F.right+"px"}}else{var S=d(),U=S.height*0.382-R.offsetHeight/2,T=S.left+(S.width-R.offsetWidth)/2;R.style.top=S.top+U+"px";R.style.left=T+"px"}j.Fixed&&E(R)}function y(T,S,U,F){var R=L("asynctips_"+S),PO,EA={top:d().top,opacity:0};if(D.isPlainObject(F)){if(F.offset){PO=F.offset}if(F.animate){EA=F.animate}};if(R){L("asynctips_"+S+"_content").innerHTML=T}else{D("body").append(['<div id="asynctips_',S,'" class="asynctips">','<table border="0" cellspacing="0" cellpadding="0">',"<tr>",'<td class="asynctips_left"></td>','<td class="asynctips_',S,'"><span></span></td>','<td class="asynctips_middle" id="asynctips_'+S+'_content">',T,"</td>",'<td class="asynctips_right"></td>',"</tr>","</table>","</div>"].join(""));R=L("asynctips_"+S)}P(R,PO);setTimeout(function(){D(R).stop(true).animate(EA,function(){D(this).remove()})},U||1500)}})(jQuery);

var WebCore=window.WebCore||{};WebCore.Utils=WebCore.Utils||{};WebCore.Utils.Cookies=(function(){var resolveOptions,assembleOptionsString,parseCookies,constructor,defaultOptions={expiresAt:null,path:'/',domain:null,secure:false};resolveOptions=function(options){var returnValue,expireDate;if(typeof options!=='object'||options===null){returnValue=defaultOptions;}else{returnValue={expiresAt:defaultOptions.expiresAt,path:defaultOptions.path,domain:defaultOptions.domain,secure:defaultOptions.secure};if(typeof options.expiresAt==='object'&&options.expiresAt instanceof Date){returnValue.expiresAt=options.expiresAt;}else if(typeof options.hoursToLive==='number'&&options.hoursToLive!==0){expireDate=new Date();expireDate.setTime(expireDate.getTime()+(options.hoursToLive*60*60*1000));returnValue.expiresAt=expireDate;}if(typeof options.path==='string'&&options.path!==''){returnValue.path=options.path;}if(typeof options.domain==='string'&&options.domain!==''){returnValue.domain=options.domain;}if(options.secure===true){returnValue.secure=options.secure;}}return returnValue;};assembleOptionsString=function(options){options=resolveOptions(options);return((typeof options.expiresAt==='object'&&options.expiresAt instanceof Date?'; expires='+options.expiresAt.toGMTString():'')+'; path='+options.path+(typeof options.domain==='string'?'; domain='+options.domain:'')+(options.secure===true?'; secure':''));};parseCookies=function(){var cookies={},i,pair,name,value,separated=document.cookie.split(';'),unparsedValue;for(i=0;i<separated.length;i=i+1){pair=separated[i].split('=');name=pair[0].replace(/^\s*/,'').replace(/\s*$/,'');try{value=decodeURIComponent(pair[1]);}catch(e1){value=pair[1];}if(typeof JSON==='object'&&JSON!==null&&typeof JSON.Parse==='function'){try{unparsedValue=value;value=JSON.Parse(value);}catch(e2){value=unparsedValue;}}cookies[name]=value;}return cookies;};constructor=function(){};constructor.prototype.get=function(cookieName){var returnValue,item,cookies=parseCookies();if(typeof cookieName==='string'){returnValue=(typeof cookies[cookieName]!=='undefined')?cookies[cookieName]:null;}else if(typeof cookieName==='object'&&cookieName!==null){returnValue={};for(item in cookieName){if(typeof cookies[cookieName[item]]!=='undefined'){returnValue[cookieName[item]]=cookies[cookieName[item]];}else{returnValue[cookieName[item]]=null;}}}else{returnValue=cookies;}return returnValue;};constructor.prototype.filter=function(cookieNameRegExp){var cookieName,returnValue={},cookies=parseCookies();if(typeof cookieNameRegExp==='string'){cookieNameRegExp=new RegExp(cookieNameRegExp);}for(cookieName in cookies){if(cookieName.match(cookieNameRegExp)){returnValue[cookieName]=cookies[cookieName];}}return returnValue;};constructor.prototype.set=function(cookieName,value,options){if(typeof options!=='object'||options===null){options={};}if(typeof value==='undefined'||value===null){value='';options.hoursToLive=-8760;}else if(typeof value!=='string'){if(typeof JSON==='object'&&JSON!==null&&typeof JSON.String==='function'){value=JSON.String(value);}else{return;throw new Error('cookies.set() received non-string value and could not serialize.');}}var optionsString=assembleOptionsString(options);document.cookie=cookieName+'='+encodeURIComponent(value)+optionsString;};constructor.prototype.del=function(cookieName,options){var allCookies={},name;if(typeof options!=='object'||options===null){options={};}if(typeof cookieName==='boolean'&&cookieName===true){allCookies=this.get();}else if(typeof cookieName==='string'){allCookies[cookieName]=true;}for(name in allCookies){if(typeof name==='string'&&name!==''){this.set(name,null,options);}}};constructor.prototype.test=function(){var returnValue=false,testName='cT',testValue='data';this.set(testName,testValue);if(this.get(testName)===testValue){this.del(testName);returnValue=true;}return returnValue;};constructor.prototype.setOptions=function(options){if(typeof options!=='object'){options=null;}defaultOptions=resolveOptions(options);};return new constructor();})();(function(){if(window.jQuery){(function($){$.Cookies=WebCore.Utils.Cookies;var extensions={cookify:function(options){return this.each(function(){var i,nameAttrs=['name','id'],name,$this=$(this),value;for(i in nameAttrs){if(!isNaN(i)){name=$this.attr(nameAttrs[i]);if(typeof name==='string'&&name!==''){if($this.is(':checkbox, :radio')){if($this.attr('checked')){value=$this.val();}}else if($this.is(':input')){value=$this.val();}else{value=$this.html();}if(typeof value!=='string'||value===''){value=null;}$.Cookies.set(name,value,options);break;}}}});},cookieFill:function(){return this.each(function(){var n,getN,nameAttrs=['name','id'],name,$this=$(this),value;getN=function(){n=nameAttrs.pop();return!!n;};while(getN()){name=$this.attr(n);if(typeof name==='string'&&name!==''){value=$.Cookies.get(name);if(value!==null){if($this.is(':checkbox, :radio')){if($this.val()===value){$this.attr('checked','checked');}else{$this.removeAttr('checked');}}else if($this.is(':input')){$this.val(value);}else{$this.html(value);}}break;}}});},cookieBind:function(options){return this.each(function(){var $this=$(this);$this.cookieFill().change(function(){$this.cookify(options);});});}};$.each(extensions,function(i){$.fn[i]=this;});})(window.jQuery);}})();

if(!this.JSON){this.JSON={}}(function(){"use strict";function f(n){return n<10?'0'+n:n}if(typeof Date.prototype.toJSON!=='function'){Date.prototype.toJSON=function(key){return isFinite(this.valueOf())?this.getUTCFullYear()+'-'+f(this.getUTCMonth()+1)+'-'+f(this.getUTCDate())+'T'+f(this.getUTCHours())+':'+f(this.getUTCMinutes())+':'+f(this.getUTCSeconds())+'Z':null};String.prototype.toJSON=Number.prototype.toJSON=Boolean.prototype.toJSON=function(key){return this.valueOf()}}var cx=/[\u0000\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,escapable=/[\\\"\x00-\x1f\x7f-\x9f\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,gap,indent,meta={'\b':'\\b','\t':'\\t','\n':'\\n','\f':'\\f','\r':'\\r','"':'\\"','\\':'\\\\'},rep;function quote(string){escapable.lastIndex=0;return escapable.test(string)?'"'+string.replace(escapable,function(a){var c=meta[a];return typeof c==='string'?c:'\\u'+('0000'+a.charCodeAt(0).toString(16)).slice(-4)})+'"':'"'+string+'"'}function str(key,holder){var i,k,v,length,mind=gap,partial,value=holder[key];if(value&&typeof value==='object'&&typeof value.toJSON==='function'){value=value.toJSON(key)}if(typeof rep==='function'){value=rep.call(holder,key,value)}switch(typeof value){case'string':return quote(value);case'number':return isFinite(value)?String(value):'null';case'boolean':case'null':return String(value);case'object':if(!value){return'null'}gap+=indent;partial=[];if(Object.prototype.toString.apply(value)==='[object Array]'){length=value.length;for(i=0;i<length;i+=1){partial[i]=str(i,value)||'null'}v=partial.length===0?'[]':gap?'[\n'+gap+partial.join(',\n'+gap)+'\n'+mind+']':'['+partial.join(',')+']';gap=mind;return v}if(rep&&typeof rep==='object'){length=rep.length;for(i=0;i<length;i+=1){k=rep[i];if(typeof k==='string'){v=str(k,value);if(v){partial.push(quote(k)+(gap?': ':':')+v)}}}}else{for(k in value){if(Object.hasOwnProperty.call(value,k)){v=str(k,value);if(v){partial.push(quote(k)+(gap?': ':':')+v)}}}}v=partial.length===0?'{}':gap?'{\n'+gap+partial.join(',\n'+gap)+'\n'+mind+'}':'{'+partial.join(',')+'}';gap=mind;return v}}if(typeof JSON.String!=='function'){JSON.String=function(value,replacer,space){var i;gap='';indent='';if(typeof space==='number'){for(i=0;i<space;i+=1){indent+=' '}}else if(typeof space==='string'){indent=space}rep=replacer;if(replacer&&typeof replacer!=='function'&&(typeof replacer!=='object'||typeof replacer.length!=='number')){throw new Error('JSON.String');}return str('',{'':value})}}if(typeof JSON.Parse!=='function'){JSON.Parse=function(text,reviver){var j;function walk(holder,key){var k,v,value=holder[key];if(value&&typeof value==='object'){for(k in value){if(Object.hasOwnProperty.call(value,k)){v=walk(value,k);if(v!==undefined){value[k]=v}else{delete value[k]}}}}return reviver.call(holder,key,value)}text=String(text);cx.lastIndex=0;if(cx.test(text)){text=text.replace(cx,function(a){return'\\u'+('0000'+a.charCodeAt(0).toString(16)).slice(-4)})}if(/^[\],:{}\s]*$/.test(text.replace(/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g,'@').replace(/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g,']').replace(/(?:^|:|,)(?:\s*\[)+/g,''))){j=eval('('+text+')');return typeof reviver==='function'?walk({'':j},''):j}throw new SyntaxError('JSON.Parse');}}}());

function Dictionary(){var me=this;this.CompareMode=1;this.Count=0;this.arrKeys=new Array();this.arrValues=new Array();this.ThrowException=true;this.Item=function(){var key=arguments[0],idx=GetElementIndexInArray(me.arrKeys,key);if(idx!=-1){if(arguments.length==2){me.arrValues[idx]=arguments[1]}return me.arrValues[idx]}else{return null;if(me.ThrowException){throw"在获取键对应的值时发生错误，键不存在。";}}};this.Keys=function(){return me.arrKeys};this.Values=function(){return me.arrValues};this.Add=function(key,value){if(CheckKey(key)){me.arrKeys[me.Count]=key;me.arrValues[me.Count]=value;me.Count++}else{if(me.ThrowException){throw"在将键和值添加到字典时发生错误，可能是键无效或者键已经存在。";}}};this.BatchAdd=function(keys,values){var bSuccessed=false;if(keys!=null&&keys!=undefined&&values!=null&&values!=undefined){if(keys.length==values.length&&keys.length>0){var allKeys=me.arrKeys.concat(keys);if(!IsArrayElementRepeat(allKeys)){me.arrKeys=allKeys;me.arrValues=me.arrValues.concat(values);me.Count=me.arrKeys.length;bSuccessed=true}}}return bSuccessed};this.Clear=function(){if(me.Count!=0){me.arrKeys.splice(0,me.Count);me.arrValues.splice(0,me.Count);me.Count=0}};this.ContainsKey=function(key){return GetElementIndexInArray(me.arrKeys,key)!=-1};this.ContainsValue=function(value){return GetElementIndexInArray(me.arrValues,value)!=-1};this.Remove=function(key){var idx=GetElementIndexInArray(me.arrKeys,key);if(idx!=-1){me.arrKeys.splice(idx,1);me.arrValues.splice(idx,1);me.Count--;return true}else{return false}};this.TryGetValue=function(key,defaultValue){var idx=GetElementIndexInArray(me.arrKeys,key);if(idx!=-1){return me.arrValues[idx]}return defaultValue};this.ToString=function(){if(me.Count==0){return""}else{return me.arrKeys.toString()+";"+me.arrValues.toString()}};function CheckKey(key){if(key==null||key==undefined||key==""||key==NaN){return false}return!me.ContainsKey(key)};function GetElementIndexInArray(arr,e){var idx=-1;var i;if(!(arr==null||arr==undefined||typeof(arr)!="object")){try{for(i=0;i<arr.length;i++){var bEqual;if(me.CompareMode==0){bEqual=(arr[i]===e)}else{bEqual=(arr[i]==e)}if(bEqual){idx=i;break}}}catch(err){}}return idx};function IsArrayElementRepeat(arr){var bRepeat=false;if(arr!=null&&arr!=undefined&&typeof(arr)=="object"){var i;for(i=0;i<arr.length-1;i++){var bEqual;if(me.CompareMode==0){bEqual=(arr[i]===arr[i+1])}else{bEqual=(arr[i]==arr[i+1])}if(bEqual){bRepeat=true;break}}}return bRepeat}};

(function($){$.includeMany=function(urls,finaly){var onload=function(callback,data){if(typeof urls.length!='undefined'){if(urls.length==0){return $.isFunction(finaly)?finaly(data):null}urls.shift();return $.includeMany.load(urls,onload)}for(var item in urls){urls[item](data);delete urls[item];var count=0;for(var i in urls){count++}return(count==0)?($.isFunction(finaly)?finaly(data):null):$.includeMany.load(urls,onload)}};$.includeMany.load(urls,onload)};$.includeMany.load=function(urls,onload){if(typeof urls=='object'&&typeof urls.length=='undefined'){for(var item in urls){return $.include.load(item,onload,urls[item].callback)}};urls=$.makeArray(urls);$.include.load(urls[0],onload,null)};$.include=function(urls,finaly,sign){var luid=$.include.luid++;var onload=function(callback,data){if($.isFunction(callback)){callback(data)}if(--$.include.counter[luid]==0&&$.isFunction(finaly)){finaly()}};if(typeof urls=='object'&&typeof urls.length=='undefined'){$.include.counter[luid]=0;for(var item in urls){$.include.counter[luid]++};return $.each(urls,function(url,callback){$.include.load(url,onload,callback,sign)})};urls=$.makeArray(urls);$.include.counter[luid]=urls.length;$.each(urls,function(){$.include.load(this,onload,null,sign)})};$.extend($.include,{luid:0,counter:[],load:function(url,onload,callback,sign,elm){if($.include.exist(url)){return onload(callback)}if(/.css/.test(url)){$.include.loadCSS(url,onload,callback,sign)}else if(/.js/.test(url)){$.include.loadJS(url,onload,callback,sign)}else{$.get(url,function(data){onload(callback,data)})}},loadCSS:function(url,onload,callback,sign){var css=$("<link>");css.attr("type","text/css");css.attr("rel","stylesheet");if(sign){css.attr("sign",sign)}css.attr("href",url);css=css.get(0);$("head").get(0).appendChild(css);$.browser.msie?$.include.IEonload(css,onload,callback):onload(callback)},loadJS:function(url,onload,callback,sign,elm){var js=$("<script>");js.attr("type","text/javascript");if(sign){js.attr("sign",sign)}js.attr("src",url);js=js.get(0);$.browser.msie?$.include.IEonload(js,onload,callback):js.onload=function(){onload(callback);$(js).unbind()};if(elm){$(elm).get(0).appendChild(js)}else{$("head").get(0).appendChild(js)}},IEonload:function(elm,onload,callback){elm.onreadystatechange=function(){if(this.readyState=='loaded'||this.readyState=='complete'){onload(callback);$(elm).unbind()}}},exist:function(url){var fresh=false;url=url.toLowerCase();if(/.css/.test(url)){$("head link[href!='']").each(function(){if(this.href.toLowerCase()==url){return fresh=true}})}else if(/.js/.test(url)){$("head script[src!='']").each(function(){if(this.src.toLowerCase()==url){return fresh=true}})}return fresh}})})(jQuery);

var ___Dictionary = new Dictionary();

(function ($) {
    $.extend({
        Storage: {
            Data: null,
            Name: location.hostname,
            isLocalStorage: (window.localStorage || window.globalStorage && window.globalStorage[location.hostname]),
            init: function () {
                if (!this.Data) {
                    try {
                        this.Data = document.createElement("input");
                        this.Data.type = "hidden";
                        this.Data.style.display = "none";
                        this.Data.addBehavior("#default#userData");
                        $("body").append(this.Data);
                        var date = new Date();
                        date.setDate(date.getDate() + 1);
                        this.Data.expires = date.toUTCString();
                    } catch (e) {
                        return false
                    }

                }
                return true;
            },
            setItem: function (Key, value) {
                if (this.isLocalStorage) {
                    window.localStorage.setItem(Key, value);
                } else {
                    if (this.init()) {
                        this.Data.load(this.Name);
                        this.Data.setAttribute(Key, value);
                        this.Data.save(this.Name)
                    }
                }
            },
            getItem: function (Key) {
                if (this.isLocalStorage) {
                    return window.localStorage.getItem(Key);
                } else {
                    if (this.init()) {
                        this.Data.load(this.Name);
                        return this.Data.getAttribute(Key);
                    }
                }
            },
            remove: function (Key) {
                if (this.isLocalStorage) {
                    window.localStorage.removeItem(Key);
                } else {
                    if (this.init()) {
                        this.Data.load(this.Name);
                        this.Data.removeAttribute(Key);
                        this.Data.save(this.Name);
                    }
                }
            },
            clear: function () {
                if (this.isLocalStorage) {
                    window.localStorage.clear();
                } else {
                    if (this.init()) {
                        this.Data.load(this.Name);
                        var now = new Date();
                        now = new Date(now.getTime() - 1);
                        this.Data.expires = now.toUTCString();
                        this.Data.save(this.Name);
                    }
                }
            }

        }
    });
    $.extend({
        GetStorage: function (Key) {
            return $.Storage.getItem(Key)
        },
        GetJSonStorage: function (Key) {
            return JSON.Parse($.Storage.getItem(Key))
        },
        GetIntStorage: function (Key) {
            var val = parseInt($.Storage.getItem(Key));
            if (val == NaN) {
                val = 0
            }
            return val
        },
        SetStorage: function (Key, Val) {
            return $.Storage.setItem(Key, Val)
        },
        SetJSonStorage: function (Key, Val) {
            return $.Storage.setItem(Key, JSON.String(Val))
        }
    })
})(jQuery);

(function ($) {
   $.Ext = $.extend({
        Get: function (elm) {
            if (typeof element == "string") {
                elm = document.getElementById(elm)
            }
            return elm
        },
        FileFromPath: function (file) {
            return file.replace(/.*(\/|\\)/, "")
        },
        GetExt: function (file) {
            return (/[.]/.exec(file)) ? /[^.]+$/.exec(file.toLowerCase()) : ''
        },
        switchDisplay: function (elm, style) {
            if (elm) {
                var $elm = $(elm);
                $elm.each(function () {
                    if ($(this).is(":visible")) {
                        $(this).hide()
                    } else {
                        $(this).show()
                    }
                })
            }
            if (style) {
                $elm.css("display", style)
            }
        },
        GetUrlKey: function () {
            return window.location.pathname.replace(/(\/)/gi, ".")
        },
        GetReURL: function () {
            var URL;
            if (document.referrer.length > 0) {
                URL = document.referrer
            }
            try {
                if (URL.length == 0 && opener.location.href.length > 0) {
                    URL = opener.location.href
                }
            } catch (e) {
                if (arguments.length > 0) {
                    return arguments[0]
                }
            }
            return URL
        },
        GetHashCode: function (input, caseSensitive) {
            if (!caseSensitive) {
                input = input.toLowerCase()
            }
            var hash = 1315423911,
                i, ch;
            for (i = input.length - 1; i >= 0; i--) {
                ch = input.charCodeAt(i);
                hash ^= ((hash << 5) + ch + (hash >> 2))
            }
            return (hash & 0x7FFFFFFF)
        },
        GetRandom: function (index) {
            var Range = 10000;
            if (index) {
                Range = Math.pow(10, index)
            }
            var Rand = Math.random();
            return (Math.round(Rand * Range))
        },
        RandPassword: function () {
            var text = ['abcdefghijklmnopqrstuvwxyz', 'ABCDEFGHIJKLMNOPQRSTUVWXYZ', '1234567890', '~!@#$%^&*()_+";",./?<>'];
            var rand = function (min, max) {
                return Math.floor(Math.max(min, Math.random() * (max + 1)))
            };
            var len = rand(8, 16);
            var txt = '';
            for (i = 0; i < len; ++i) {
                var strpos = rand(0, 3);
                txt += text[strpos].charAt(rand(0, text[strpos].length))
            }
            return txt
        },
        RemoveHtml: function (inString) {
            var d = document.createElement("DIV");
            d.innerHTML = inString;
            d.id = "TempRemoveHtmlContent";
            d.style.display = "none";
            return d.innerText
        },
        Redirect: function (url) {
            window.location.href = url
        },
        Q: function (item) {
            var Value = location.search.match(new RegExp("[\?\&]" + item + "=([^\&]*)(\&?)", "i"));
            return Value ? Value[1] : Value
        },
        getURLParam: function (Key) {
            var url = location.href.replace(location.hash, "");
            var ParaString = url.substring(url.indexOf("?") + 1, url.length);
            return this.getParam(ParaString, Key)
        },
        getParam: function (String, Key) {
            if (typeof (String) != "string") return "";
            var Param = String.split("&");
            for (var i = 0; i < Param.length; i++) {
                var P = Param[i].split("=", 2);
                if (P[0].toLowerCase() == Key.toLowerCase()) {
                    if (P.length == 2) return unescape(P[1]);
                    else return ""
                }
            }
            return ""
        },
        Boolean: function (Data) {
            if (Data == null || Data == "" || Data == undefined) {
                return false
            }
            if (Data > 0 || Data == "1" || Data.toLowerCase() == "true") {
                return true
            }
            if (Data == 0 || Data == "0" || Data.toLowerCase() == "false") {
                return false
            }
        },
        LTrim: function (String) {
            return (String || "").replace(/^(\s|\u00A0)+/g, '')
        },
        RTrim: function (String) {
            return (String || "").replace(/(\s|\u00A0)+$/g, '')
        },
        Trim: function (String) {
            return $.trim(String)
        },
        Import: function () { },
        DoTimeout: function (Action, Times) {
            if (typeof (Times) != "number") {
                Times = 600
            }
            if ($.isFunction(Action)) {
                Action()
            } else {
                if (Action.toLowerCase().indexOf("go:") > -1) {
                    setTimeout("window.location='" + Action.replace("go:", "").replace("Go:", "").replace("GO:", "") + "'", Times);
                    return
                }
                setTimeout("$.alert('" + Action.replace("alert:", "").replace("Alert:", "") + "')", Times)
            }
        },
        setElement: function (elem, status) {
            if (status) {
                status = status.toLowerCase()
            } else {
                return false
            }
            var E = $(elem);
            if ((typeof (E) != "object") || (E == null)) return false;
            switch (status) {
                case "yes":
                    E.attr("disabled", false);
                    break;
                case "no":
                    E.attr("disabled", true);
                    break;
                case "show":
                    E.show();
                    break;
                case "hide":
                    E.hide();
                    break;
                case "display":
                    E.css("display", "inline");
                    break
            }
        },
        LimitLen: function (theValue, Min, Max) {
            if (!theValue || !Min || !Max) {
                return false
            }
            theValue = this.Trim(theValue);
            if (theValue == "") return false;
            if ((theValue.length < Min) || (theValue.length > Max)) {
                return false
            } else {
                return true
            }
        },
        DisableKeyDown: function () {
            if ((window.event.altKey) && ((window.event.keyCode == 37) || (window.event.keyCode == 39))) {
                event.returnValue = false
            }
            if (event.keyCode == 116) {
                event.keyCode = 0;
                event.returnValue = false
            }
            if (event.keyCode == 122) {
                event.keyCode = 0;
                event.returnValue = false
            }
            if ((event.ctrlKey) && (event.keyCode == 7)) {
                event.returnValue = false
            }
            if ((event.shiftKey) && (event.keyCode == 121)) {
                event.returnValue = false
            }
        },
        IsPwdQuestion: function (Str) {
            var reg = /^([\u4E00-\u9FA5]|[0-9a-zA-Z ])+$/;
            if (!reg.test(Str)) {
                return false
            }
            return true
        },
        IsMobile: function (Str) {
            var reg = /^13[0-9]{9}$/;
            if (!reg.test(Str)) {
                return false
            }
            return true
        },
        IsEMail: function (Str) {
            var reg = /^([a-zA-Z0-9]+[_|\-|\.]?)*[a-zA-Z0-9]+@([a-zA-Z0-9]+[_|\-|\.]?)*[a-zA-Z0-9]+\.[a-zA-Z]{2,3}$/;
            if (!reg.test(Str)) {
                return false
            }
            return true
        },
        IsNullOrEmpty: function (Str) {
            var bCheck = true;
            Str = Trim(Str);
            if (Str == "") bCheck = false;
            return bCheck
        },
        IsAccountChar: function (Str) {
            var reg = /^[a-zA-Z0-9][a-zA-Z0-9._-]{0,15}$/;
            if (!reg.test(Str)) return false;
            else return true
        },
        JsonToXmlDom: function (Json) {
            var xmlDom = this.createXmlDom();
            xmlDom.async = "false";
            if (!$.browser.opera) {
                var xmlProperty = xmlDom.createProcessingInstruction("xml", "version=\"1.0\" encoding=\"utf-8\"");
                xmlDom.appendChild(xmlProperty)
            }
            var RootTagName, objField, TextValue;
            if (arguments.length == 2) {
                RootTagName = arguments[1]
            } else {
                RootTagName = "root"
            }
            var Root = xmlDom.createElement(RootTagName);
            for (var Key in Json) {
                objField = xmlDom.createElement(Key);
                TextValue = xmlDom.createTextNode(Json[Key]);
                objField.appendChild(TextValue);
                Root.appendChild(objField)
            }
            xmlDom.appendChild(Root);
            return xmlDom
        },
        XmlDomToStirng: function (xmlDom) {
            if ($.browser.msie) {
                return xmlDom.xml
            }
            return (new XMLSerializer()).serializeToString(xmlDom)
        },
        createXmlDom: function (xmlsTry) {
            var xmlDom = false;
            if (document.implementation && document.implementation.createDocument) {
                xmlDom = document.implementation.createDocument("text/xml", "", null)
            } else {
                var aVersions = ["Microsoft.XMLDOM", "MSXML2.DOMDocument.6.0", "MSXML2.DOMDocument.5.0", "Msxml2.DOMDocument.4.0", "MSXML2.DOMDocument.3.0", "MSXML2.DOMDocument"];
                for (var i = 0; i < aVersions.length; i++) {
                    try {
                        xmlDom = new ActiveXObject(aVersions[i]);
                        if (xmlDom) {
                            break
                        }
                    } catch (e) { }
                }
            }
            if (xmlsTry != null) {
                xmlDom.async = false;
                if (!$.browser.msie) {
                    var oParser = new DOMParser();
                    xmlDom = oParser.parseFromString(xmlsTry, "text/xml")
                } else {
                    if ($.browser.version == '7.0') {
                        xmlDom.loadXML(xmlsTry)
                    } else {
                        if (window.XMLHttpRequest) {
                            xmlDom.loadXML(xmlsTry)
                        } else {
                            xmlDom.load(xmlsTry)
                        }
                    }
                }
            }
            return xmlDom
        }
    })
})(jQuery);

(function ($) {
    $.fn.extend({
        disabled: function (value) {
            if (!value) {
                value = true;
            }
            return $(this).attr("disabled", value);
        },
        enabled: function (value) {
            if (!value) {
                value = false;
            }
            return $(this).attr("disabled", value);
        },
        color: function (value) {
            return $(this).css("color", value);
        }
    });
    $.fn.Checkbox = function (options) {
        this.defaults = {
            checkall: "input.CheckALL",
            group: ":checkbox[name='CheckBoxItems']",
            cssSelected: "Selected"
        };
        var o = $(this),
            bool = false;
        switch (typeof (options)) {
        case "number":
            break;
        case "string":
            break;
        case "object":
            bool = true;
            break;
        default:
            bool = true;
        }
        options = $.extend(this.defaults, options);
        var SelectedIndex = -1,
            Index = -1,
            endIndex;
        if (bool) {
            $(options.checkall, o).attr("checked", false).live("click", function () {
                o.find(options.group).attr("checked", this.checked).parents("tr").toggleClass(options.cssSelected);
            });
            $(o).find(options.group).live("click", function (evt) {
                var $Items = o.find(options.group);
                var $ALL = o.find(options.checkall).attr("checked", $Items.length == $Items.filter(":checked").length);
                var $TRs = $(this).parents("tr:visible");
                Index = $TRs.index() - 1;
                if (evt.shiftKey) {
                    SelectedIndex = $ALL.attr("SelectedIndex");
                    endIndex = $ALL.attr("isSelect");
                    if (SelectedIndex == undefined) {
                        SelectedIndex = -1
                    } else {
                        SelectedIndex = parseInt(SelectedIndex);
                    }
                    if (endIndex != undefined && endIndex != "false") {
                        endIndex = true;
                    } else {
                        endIndex = false;
                    }
                    if (SelectedIndex == -1 || endIndex == false) {
                        SelectedIndex = Index;
                        endIndex = true;
                    } else {
                        if (SelectedIndex > Index) {
                            endIndex = SelectedIndex;
                            SelectedIndex = Index;
                            Index = endIndex;
                        }
                        $Items.slice(SelectedIndex, Index).attr("checked", $Items.eq(SelectedIndex).attr("checked"));
                        $Items.slice((SelectedIndex + 1), Index).parents("tr:visible").toggleClass(options.cssSelected);
                        SelectedIndex = Index;
                        endIndex = false;
                    }
                    $ALL.attr({
                        "SelectedIndex": SelectedIndex,
                        "isSelect": endIndex
                    });
                }
                $TRs.toggleClass(options.cssSelected);
            });
        }
        return this;
    };
    $.fn.inputFocus = function (options) {
        options = $.extend({
            cssFocus: "InputFocus",
            cssChange: "InputChange",
            cssVisited: "InputVisited"
        }, options);
        $(this).live("blur", function () {
            if ($(this).val() != this.defaultValue) {
                $(this).addClass(options.cssChange).removeClass(options.cssFocus + " " + options.cssVisited);
            } else {
                $(this).addClass(options.cssVisited).removeClass(options.cssFocus + " " + options.InputChange);
            }
        }).live("focus", function () {
            if (!$(this).attr("isFocus")) {
                $(this).attr("isFocus", true);
                this.defaultValue = $(this).val();
            }
            $(this).addClass(options.cssFocus).removeClass(options.cssChange + " " + options.cssVisited);
        }).live("dblclick", function () {
            var defaultValue = this.defaultValue;
            var o = $(this);
            if (o.val() != defaultValue) {
                $.confirm("是否还原初始值!", '确认', function (e) {
                    if (e == "ok") {
                        o.val(defaultValue);
                        o.addClass(options.cssVisited).removeClass(options.cssFocus + " " + options.InputChange);
                    }
                });
            }
        });
        return this;
    };
    $.fn.Buttons = function (options) {
        var o, text;
        $(this).each(function () {
            o = $(this), text = o.text(),title = o.attr("title");
            if(o.attr("href") == "#"){
              o.attr("href","javascript:void(0)")
            }
            if(title) {
               title = "title='"+ title +"'",o.attr("title","")
            }
            if(o.find("span").length == 0){
               o.html("<span "+ title +">" + text + "</span>");
            }
        });
        return this;
    };
    $.fn.ValiDate = function (options) {
        var o;
        $(this).each(function () {

        });
        return this;
    };
    $.fn.addTab = function (options) {
        options = $.extend({
            title: false,
            id: false,
            select: true,
            close: true
        }, options);
        var o = this;
        var LiCount = $("ul > li", $(o)).length + 1;
        if (!options.title || options.title == "") {
            options.title = "标签 - " + LiCount;
        }
        if (!options.id || options.id == "") {
            options.id = "Tabs_" + LiCount;
        }
        if ($("#" + options.id).length > 0) {
            $(o).tabs("select", $("#" + options.id).index() - 1);
            return;
        }
        var $tabs = $(o).tabs({
            tabTemplate: "<li><a href=\"#{href}\">#{label}</a><span class=\"ui-icon ui-icon-close\"></span></li>",
            add: function (event, ui) {
                if (options.select) {
                    $tabs.tabs("select", ui.index);
                }
            }
        });
        $tabs.tabs("add", "#" + options.id, options.title);
        if (options.close) {
            $("span.ui-icon-close", $tabs).live("click", function () {
                var index = $("ul > li", $tabs).index($(this).parent());
                if (index > -1) {
                    $tabs.tabs("remove", index);
                }
            });
        }
        return $("#" + options.id).addClass("MultiPage");
    };

    $.fn.Tabs = function () {
        var o = this,
            obj = $("ul > li", o).filter(".ui-tabs-selected").find("a");
        var Length = arguments.length;
        var Index = obj.parent().index();
        if (Length > 0) {
            if ($.isPlainObject(arguments[0])) {} else {
                if (isNaN(parseInt(arguments[0]))) {
                    if (Length == 3) {
                        if (isNaN(parseInt(arguments[2]))) {
                            obj = $("ul > li", o).find("a[href=" + arguments[2] + "]");
                            Index = obj.parent().index();
                        } else {
                            obj = $("ul > li", o).eq(arguments[2]).find("a");
                            Index = arguments[2];
                        }
                    }
                    if (Length == 2) {
                        if (isNaN(parseInt(arguments[1]))) {
                            obj = $("ul > li", o).find("a[href=" + arguments[1] + "]");
                            Index = obj.parent().index();
                        } else {
                            obj = $("ul > li", o).eq(arguments[1]).find("a");
                            Index = arguments[1];
                        }
                    }
                    switch (arguments[0]) {
                    case "Title":
                        obj.html(arguments[1]);
                        break;
                    case "Select":
                        $(o).tabs("select", Index);
                        break;
                    case "Close":
                        $(o).tabs("remove", Index);
                        break;
                    case "Panel":
                        return obj.attr("href");
                        break;
                    }
                } else {
                    $(o).tabs("select", arguments[0]);
                }
            }
        }
        return o;
    };
    $.fn.PromptError = function (options) {
        var opts = {
            title: "错误信息提示",
            ErrorReason: "产生错误的可能原因：",
            Ico: "Wrong"
        };
        if (!$.isPlainObject(options)) {
            opts.Message = options;
        } else {
            options = $.extend(opts, options);
        }
        return $(this).PromptMessage(options);
    };
    $.fn.PromptSuccess = function (options) {
        var opts = {
            title: "成功信息提示",
            Ico: "Success",
            Message: ""
        };
        if (!$.isPlainObject(options)) {
            opts.Message = options;
        } else {
            options = $.extend(opts, options);
        }
        return $(this).PromptMessage(options);
    };
    $.fn.PromptMessage = function (options) {
        var opts = {
            css: "Showms",
            title: "系统提示",
            ErrorReason: "",
            Ico: "Message",
            Message: "",
            Btn: "<< 返回一上页",
            Run: "back",
            draggable: true,
            revert: true
        };
        if (!$.isPlainObject(options)) {
            opts.Message = options;
        } else {
            options = $.extend(opts, options);
        }
        var $This = $(this);
        var $Prompt = $(this).find("#PromptMessage");
        if (options.Ico == "Wrong") {
            if (!options.ErrorReason) {
                options.ErrorReason = "产生错误的可能原因：<br />"
            }
            if (!options.title) {
                options.title = "出错了"
            }
        }
        if ($Prompt.length == 0) {
            $Prompt = $("<div>").attr({
                id: "PromptMessage"
            }).append("<dl class=\"ContentBox\"><dd class=\"Content\"><div class=\"MS\"><dl><dt class=\"TitBox\"><em class=\"Ico\"></em><em class=\"Text\"></em><em class=\"Close\"></em></dt><dd class=\"Message\"></dd><dd class=\"Btn\"></dd></dl></div></dd></dl>").hide();
        }
        $This.empty().append($Prompt);
        if (options.Message.toLowerCase().indexOf("<li>") == -1) {
            options.Message = "<li>" + options.Message + "</li>";
        }
        if (options.Message.toLowerCase().indexOf("<ul>") == -1) {
            options.Message = "<ul>" + options.Message + "</ul>";
        }
        $Prompt.addClass(options.css).find("div.MS > dl").addClass(options.Ico).find("em.Ico").addClass("Tit" + options.Ico).end().find("em.Text").html(options.title).end().find("dd.Message").html(options.ErrorReason + options.Message);
        if (typeof (options.Run) == "string") {
            switch (options.Run) {
            case "close":
                options.Run = "javascript:window.close();";
                break;
            case "back":
                options.Run = "javascript:window.back();";
                break;
            default:
                if (options.Run == "") {
                    options.Run = "/";
                    options.Run == "<< 返回首页"
                }
            }
            $Prompt.find("dd.Btn").html("<a href=\"" + options.Run + "\"><span>" + options.Btn + "</span></a>");
        }
        if ($.isFunction(options.Run)) {
            $Prompt.find("dd.Btn").html("<a href=\"JavaScript:\"><span>" + options.Btn + "</span></a>").find("a").unbind("click").click(function () {
                options.Run();
            });
        }
        if (opts.draggable) {
            try {
                $Prompt.draggable({
                    handle: $Prompt.find("dt.TitBox"),
                    revert: options.revert
                });
            } catch (d) {}
        }
        $.include("/Prompt/Prompts.css", function () {
            $Prompt.find("em.Close").click(function () {
                window.close();
            });
        });
        $Prompt.stop(true, true).fadeIn(100);
        return this;
    };
    $.fn.Serialize = function () {
        return $.Param(this.serializeArray(), true);
    };
    $.fn.JSon = function () {
        return $.JSon(this.Serialize());
    };
})(jQuery);

(function ($) {
    $.extend({
        FormatType: function (Json) {
            if ($.isPlainObject(Json)) {
                $.each(Json, function (i, o) {
                    if ($.isPlainObject(o)) {
                        $.FormatType(o)
                    } else {
                        if ($.isArray(o)) {
                            for (x in o) {
                                o[x] = FormatValue(o[x])
                            }
                            Json[i] = o
                        } else {
                            Json[i] = FormatValue(o)
                        }
                    }
                })
            }
            return Json;

            function FormatValue(val) {
                switch (val) {
                case "true":
                    return true;
                case "false":
                    return false;
                case "True":
                    return true;
                case "False":
                    return false;
                case "":
                    return "";
                case null:
                    return "";
                default:
                    if (!isNaN(parseInt(val))) {
                        return parseInt(val)
                    }
                }
                return val
            }
        },
        JSON: function (string) {
            return JSON.Parse(string)
        },
        JSon: function (string, overwrite) {
            if (!string) {
                return {}
            }
            var obj = {},
                pairs = string.split("&"),
                d = decodeURIComponent,
                name, value;
            $.each(pairs, function (i, pair) {
                pair = pair.split('=');
                name = d(pair[0]);
                value = d(pair[1]);
                obj[name] = overwrite || !obj[name] ? value : [].concat(obj[name]).concat(value)
            });
            return obj
        },
        Param: function (a, traditional) {
            return $.param(a);
        },
        Shadow: function (options) {
            var $ShadowLayer;
            switch (typeof (options)) {
            case "boolean":
                CreateShadow();
                if (options) {
                    $ShadowLayer.show()
                } else {
                    $ShadowLayer.hide()
                }
                break;
            case "string":
                switch (options) {
                case "Shadow":
                    CreateShadow({
                        isTips: false
                    }).show();
                    break
                }
                break;
            default:
                CreateShadow(options)
            }
            return $ShadowLayer;

            function CreateShadow(options) {
                options = $.extend({}, {
                    elem: "ShadowLayer",
                    text: "数据加载中，请稍后...",
                    isTips: true,
                    isText: true
                }, options);
                $ShadowLayer = $("#" + options.elem);
                var zIndex = 2001;
                if (options.zIndex) {
                    zIndex = parseInt(options.zIndex)
                }
                var txtCSS = {
                    position: "absolute",
                    zIndex: zIndex + 2,
                    background: "url(/Images/Progress/Loading.gif) 3px Center No-Repeat #ffffe1",
                    fontSize: "12px",
                    border: "1px solid #98b1c8",
                    padding: "4px 8px 4px 24px",
                    color: "#000",
                    cursor: "wait"
                };
                if (options.txtCSS) {
                    $.extend(txtCSS, options.txtCSS)
                }
                if (!txtCSS.bottom && !txtCSS.top) {
                    txtCSS.top = 10
                }
                if (!txtCSS.left && !txtCSS.right) {
                    txtCSS.right = 10
                }
                if ($ShadowLayer.length == 0) {
                    $ShadowLayer = $("<div>").attr("id", options.elem).css({
                        position: "absolute",
                        zIndex: zIndex,
                        top: "0px",
                        left: "0px"
                    }).appendTo("body");
                    $("<div>").css({
                        position: "absolute",
                        zIndex: zIndex + 1,
                        width: "100%",
                        height: "100%",
                        top: "0px",
                        left: "0px",
                        backgroundColor: "#000",
                        opacity: 0.1
                    }).appendTo($ShadowLayer);
                    if (options.isText) {
                        $("<div>").css(txtCSS).html(options.text).appendTo($ShadowLayer)
                    }
                    if ($.browser.msie && (parseInt($.browser.version) < 7)) {
                        $("<iframe>").attr({
                            hideFocus: true,
                            frameBorder: 0,
                            src: "javascript:void(0)"
                        }).css({
                            width: "100%",
                            height: "100%",
                            position: "absolute",
                            left: "0px",
                            top: "0px",
                            opacity: 0,
                            filter: "progid:DXImageTransform.Microsoft.Alpha(opacity=0)"
                        }).appendTo($ShadowLayer)
                    }
                    $ShadowLayer.hide();
                    $(window).unbind("resize").bind("resize", reSizeHdl);
                    reSizeHdl()
                }
                if (options.isTips) {
                    $ShadowLayer.find("div:eq(1)").show()
                } else {
                    $ShadowLayer.find("div:eq(1)").hide()
                }
                return $ShadowLayer
            };

            function isDTD(doc) {
                return ('CSS1Compat' == (doc.compatMode || 'CSS1Compat'))
            };

            function reSizeHdl() {
                if ($ShadowLayer.length == 0) {
                    return
                }
                var rel = isDTD(window.document) ? window.document.documentElement : window.document.body;
                $ShadowLayer.css({
                    width: Math.max(rel.scrollWidth, rel.clientWidth, window.document.scrollWidth || 0) - 1,
                    height: Math.max(rel.scrollHeight, rel.clientHeight, window.document.scrollHeight || 0) - 1
                })
            }
        },
        LoadScript: function (url, callback, async) {
            var IDCode = "JS_" + $.Ext.GetHashCode(url.toLowerCase().replace(/(\/)/gi, "_"));
            var isLoad = $("head").data(IDCode);
            if (isLoad) {
                return this
            }
            if (!$.isFunction(callback)) {
                async = callback
            }
            if (typeof (async) == "undefined") {
                async = false
            }
            $.ajax({
                type: "GET",
                url: url,
                data: null,
                async: async,
                global: false,
                dataType: "script",
                error: function (XMLHttpRequest, textStatus, errorThrown) {
                    $.alert("错误信息：" + XMLHttpRequest.status)
                },
                success: function (data, textStatus) {
                    $("head").data(IDCode, true);
                    if ($.isFunction(callback)) {
                        callback()
                    }
                }
            });
            return this
        },
        GetDictionary: function (Key) {
            if (___Dictionary.Count > 0) {
                if (___Dictionary.ContainsKey(Key)) {
                    return ___Dictionary.Item(Key)
                }
            }
            var JSon = $.GetJSonStorage(Key);
            if (JSon) {
                if (JSon.arrKeys) {
                    var oJSon = new Dictionary();
                    oJSon.arrKeys = JSon.arrKeys;
                    oJSon.arrValues = JSon.arrValues;
                    oJSon.Count = parseInt(JSon.Count);
                    JSon = oJSon
                }
                ___Dictionary.Add(Key, JSon);
                return JSon
            }
            return new Dictionary()
        },
        SetDictionary: function (Key, Val) {
            if (___Dictionary.ContainsKey(Key)) {
                ___Dictionary.Item(Key, Val)
            } else {
                ___Dictionary.Add(Key, Val)
            }
            $.SetJSonStorage(Key, Val)
        },
        InitRegion: function (Key) {
            if (!Key) {
                Key = ""
            }
            var Country, Zone, Province , City, elm, e, ID = "#" + Key;
            if ($.browser.msie && parseInt($.browser.version) > 6) {
                Country = $.GetJSonStorage("Country");
                Zone= $.GetJSonStorage("Zone");
                Province = $.GetJSonStorage("Province");
            }
            var $Country = $(ID + "Country"),
                $Zone = $(ID + "Zone"),
                $Province = $(ID + "Province"),
                $City = $(ID + "City"),
                $Area = $(ID + "Area");
            var opts = {
                type: "POST",
                url: "/Ajax.aspx",
                data: {},
                dataType: "json",
                global: false,
                error: function (request, textStatus, thrownError) {
                    if (textStatus) {
                        $.alert("HTTP " + textStatus);
                    } else {
                        $.alert("错误:" + thrownError);
                    }
                }
            };
            if ($Country.length > 0) {
                if (Country) {
                    $.each(Country, function (i, Rs) {
                        $Country[0].options.add(new Option(Rs.Country, Rs.Country))
                    })
                } else {
                    $Country.find("option:gt(0)").remove().end();
                    $Country[0].options.add(new Option("中华人民共和国", "中华人民共和国"))
                }
                if ($Country.attr("fieldValue")) {
                    $Country.val($Country.attr("fieldValue"))
                }

            };
            if ((!Zone || Zone.length ==0)||(!Province || Province.length ==0)) {
                $.ajax($.extend({}, opts, {
                    data: {
                        Action: "Region"
                    },
                    success: function (data) {
                        if (data.Zone) {
                            Zone = data.Zone;
                            InitZone();
                            try{ $.SetJSonStorage("Zone", Zone) } catch(e) {}
                        }
                        if (data.Province) {
                            Province = data.Province;
                            InitProvince();
                            try{ $.SetJSonStorage("Province", Province) } catch(e) {}
                        }
                    }
                }))
            } else {
                InitZone();
                InitProvince();
            };

            function InitZone() {
                if (Zone) {
                    if ($Zone.length > 0) {
                        $Zone.find("option:gt(0)").remove().end();
                        $.each(Zone, function (i, Rs) {
                            $Zone[0].options.add(new Option(Rs.Zone, Rs.Zone))
                        });
                        if ($Zone.attr("fieldValue")) {
                            $Zone.val($Zone.attr("fieldValue"))
                        }
                    }
                };
            }

            function InitProvince() {
                if (Province) {
                    if ($Province.length > 0) {
                        $Province.find("option:gt(0)").remove().end();
                        $.each(Province, function (i, Rs) {
                           $Province[0].options.add(new Option(Rs.Province, Rs.Province))
                        });
                        if ($Province.attr("fieldValue")) {
                            $Province.val($Province.attr("fieldValue"));
                            $.ajax($.extend({}, opts, {
                                data: {
                                    Action: "City",
                                    Province: $Province.attr("fieldValue")
                                },
                                success: function (data) {
                                    if (data.City) {
                                        if ($City.length > 0) {
                                            $.each(data.City, function (i, Rs) {
                                               $City[0].options.add(new Option(Rs.City, Rs.City))
                                            })
                                        }
                                    }
                                    $City.find("option:eq(0)").text("请选择城市");
                                    if ($City.attr("fieldValue")) {
                                        $City.val($City.attr("fieldValue"));
                                        $.ajax($.extend({}, opts, {
                                            data: {
                                                Action: "Area",
                                                City: $City.attr("fieldValue")
                                            },
                                            success: function (data) {
                                                if (data.Area) {
                                                    if ($Area.length > 0) {
                                                        $.each(data.Area, function (i, Rs) {
                                                           $Area[0].options.add(new Option(Rs.Area, Rs.Area))
                                                        })
                                                    }
                                                }
                                                $Area.find("option:eq(0)").text("请选择县区");
                                                if ($Area.attr("fieldValue")) {
                                                    $Area.val($Area.attr("fieldValue"))
                                                }
                                            }
                                        }))
                                    }
                                }
                            }))
                        };
                    }
                };
            }

            BindZone();
            BindProvince();
            BindCity();

            function BindZone() {
                $Zone.unbind("change").change(function () {
                    if (Province) {
                        if ($Province.length > 0) {
                            $Province.find("option:gt(0)").remove().end();
                            var val = $(this).val();
                            $.each(Province, function (i, Rs) {
                                if (Rs.Zone != val && val != "") {
                                    return
                                }
                                $Province[0].options.add(new Option(Rs.Province, Rs.Province))
                            })
                        }
                    }
                    $Province.val("");
                    $City.find("option:gt(0)").remove();
                    $Area.hide().find("option:gt(0)").remove()
                })
            };

            function BindProvince() {
                $Province.unbind("change").change(function () {
                    var ZoneVal, val = $(this).val();
                    $.each(Province, function (i, Rs) {
                        if (Rs.Province == val) {
                            ZoneVal = Rs.Zone;
                            return
                        }
                    });
                    $Zone.val(ZoneVal);
                    $City.find("option:gt(0)").remove();
                    if (val) {
                        $City.find("option:eq(0)").text("数据加载中..")
                    } else {
                        $City.find("option:eq(0)").text("请选择城市")
                    }
                    if ($Area.length > 0) {
                        $Area.hide().find("option:gt(0)").remove()
                    }
                    if (val) {
                        $.ajax($.extend({}, opts, {
                            data: {
                                Action: "City",
                                Province: val
                            },
                            success: function (data) {
                                if (data.City) {
                                    if ($City.length > 0) {
                                        $.each(data.City, function (i, Rs) {
                                            $City[0].options.add(new Option(Rs.City, Rs.City))
                                        })
                                    }
                                }
                                $City.find("option:eq(0)").text("请选择城市")
                            }
                        }))
                    }
                })
            };

            function BindCity() {
                $City.unbind("change").change(function () {
                    var val = $(this).val();
                    if ($Area.length > 0) {
                        $Area.hide().find("option:gt(0)").remove()
                    };
                    if (val) {
                        $.ajax($.extend({}, opts, {
                            data: {
                                Action: "Area",
                                City: val
                            },
                            success: function (data) {
                                var isShow = false,
                                    isArea = false;
                                if (data.Area && !$.isEmptyObject(data.Area)) {
                                    if ($Area.length == 0) {
                                        $Area = $("<select>").attr({
                                            id: Key + "Area",
                                            name: Key + "Area"
                                        }).insertAfter($City);
                                        $Area[0].options.add(new Option("请选择县区", ""))
                                    } else {
                                        isArea = true
                                    }
                                    $.each(data.Area, function (i, Rs) {
                                        if (Rs.Area) {
                                            $Area[0].options.add(new Option(Rs.Area, Rs.Area))
                                            if (!isArea) {
                                                isShow = true
                                            }
                                        }
                                    });
                                    if (isShow) {
                                        $Area.show()
                                    } else {
                                        $Area.hide()
                                    }
                                }
                            }
                        }))
                    }
                })
            }
        },
        formatDate: function (val, T) {
            if (val && T) {
                return (new Date(Date.parse(val.replace(/-/g, "/")))).format(T)
            }
        }
    })
})(jQuery);

$(function () { Date.prototype.format = function (format) { var o = { "M+": this.getMonth() + 1, "d+": this.getDate(), "h+": this.getHours(), "m+": this.getMinutes(), "s+": this.getSeconds(), "q+": Math.floor((this.getMonth() + 3) / 3), "S": this.getMilliseconds() }; if (/(y+)/.test(format)) { format = format.replace(RegExp.$1, (this.getFullYear() + "").substr(4 - RegExp.$1.length)) } for (var i in o) { if (new RegExp("(" + i + ")").test(format)) { format = format.replace(RegExp.$1, RegExp.$1.length == 1 ? o[i] : ("00" + o[i]).substr(("" + o[i]).length)) } } return format }; String.prototype.format = function () { if (arguments.length == 0) { return null } var out = arguments[0]; for (var i = 1; i < arguments.length; i++) { var re = new RegExp("\\{" + (i - 1) + "\\}", "gm"); out = out.replace(re, arguments[i]) } return out } });
