﻿var Base={};function Namespace(b){var e=Object.prototype.toString,g,f,d=Base;if(!e.call(b)=="[object String]"){return b}f=b.split(".");g=f[0]=="WW"?1:0;for(var c=g,a=f.length;c<a;c++){if(d[f[c]]==undefined){d[f[c]]={}}d=d[f[c]]}}function Alias(a){window[a]=Base}function mix(d,c,f,g){f=f==undefined?true:f;for(var e in c){if(typeof d[e]!="undefined"){if(f){if(g){d[e]=arguments.callee({},c[e],g,f)}else{d[e]=c[e]}}else{continue}}else{if(g){d[e]=arguments.callee({},c[e],g,f)}else{d[e]=c[e]}}}return d}function Create(){return function(){if(this.init){return this.init.apply(this,arguments)}}}function Extend(e,c,g){var b=new Function(),f=e.prototype,a;b.prototype=c.prototype;e.prototype=new b();a=e.prototype;for(var d in f){if(a[d]!=undefined){a[d]=f[d]}}mix(a,g);a.constructor=e;return e}function G(a){return document.getElementById(a)}function C(a){return document.createElement(a)}Namespace("C");(function(){var a=Object.prototype.toString;mix(Base.C,{isUndefined:function(b){return typeof b==="undefined"},isString:function(b){return a.call(b)==="[object String]"},isArray:function(b){return a.call(b)==="[object Array]"},isFunction:function(b){return typeof b==="function"},isNumber:function(b){return typeof b==="[object Number]"},empty:function(){}})})();Namespace("S");(function(){var a=/^\s+|\s+$/g;mix(Base.S,{trim:function(b){return b.replace(a,"")}})})();Namespace("E");(function(){function a(c){if(c.stopPropagation){c.stopPropagation()}else{c.cancelBubble=true}}function b(c){if(c.preventDefault){c.preventDefault()}else{c.returnValue=false}}mix(Base.E,{eventGuid:0,eventCache:{},fireEvent:function(d,c){var e;if(document.createEvent){e=document.createEvent("HTMLEvents");e.initEvent(c,true,true);d.dispatchEvent(e)}else{c="on"+c;e=document.createEventObject(c);d.fireEvent(c,e)}},addEvent:(function(){function c(k,n){var m=this.guid,h=Base.E.eventCache,o=h[m],d="on"+k.type,j=o[d];if(n){n.call(this,k)}if(!j||j.length==0){return}for(var g=0,f=j.length;g<f;g++){if(j[g].call(this,k)===false){a(k);b(k)}}}return function(j,i,e){var f,h,k,d,g=Base.E.eventCache;i="on"+i;if(Base.C.isUndefined(j.guid)){j.guid=Base.E.eventGuid++;k=j[i]}f=j.guid;if(Base.C.isUndefined(g[f])){g[f]={}}h=g[f];if(!h[i]){h[i]=[]}d=h[i];h[i].push(e);j[i]=function(l){l=l||window.event;c.call(this,l,k)}}})(),removeEvent:function(k,j,e){var h,c,g=Base.E.eventCache;j="on"+j;if(Base.C.isUndefined(k.guid)){return}guid=k.guid;h=g[guid];c=h[j];if(e&&c.length!==0){for(var f=0,d=c.length;f<d;f++){if(e==c[f]){c.splice(f,1)}}}else{delete h[j]}},contains:function(c,f){try{if(c.compareDocumentPosition){return c.compareDocumentPosition(f)==20||c.compareDocumentPosition(f)==0}else{return c.contains(f)}}catch(d){}},hoverRelated:function(c,d){d=d||window.event;if(d.relatedTarget){return Base.E.contains(c,d.relatedTarget)}else{return d.type=="mouseover"?Base.E.contains(c,d.fromElement):Base.E.contains(c,d.toElement)}}})})();Namespace("D");(function(){mix(Base.D,{hasClass:function(c,a){var d=c.className,b=new RegExp("(^|\\s+)"+a+"(\\s+|$)");return b.test(d)},addClass:function(b,a){var c=b.className;if(Base.S.trim(c)===""){b.className=a}else{b.className+=" "+a}},removeClass:function(c,a){var b;if(Base.D.hasClass(c,a)){b=new RegExp("(^|\\s+)"+a+"(\\s+|$)");c.className=c.className.replace(b,"")}},getStyle:function(b,a){var c;if(b.currentStyle){c=b.currentStyle[a]}else{c=document.defaultView.getComputedStyle(b,null)[a]}return c}})})();Namespace("A");(function(){var a=Array.prototype;mix(Base.A,{each:function(b,e){for(var d=0,c=b.length;d<c;d++){e.call(this,d,b[d])}return b},map:a.map?function(b,d,c){return b.map(d,c)}:function(){},filter:function(c,d){var b=[];Base.A.each(c,function(e,f){if(d.call(this,e,f)){b.push(f)}});return b},indexOf:function(){},indexLastOf:function(){},build:function(f){var b,h=Array.prototype.slice;try{b=h.call(f,0)}catch(g){b=[];for(var d=0,c=f.length;d<c;d++){b.push(f[d])}}return b}})})();Namespace("B");(function(){mix(Base.B,{doc:document.compatMode=="CSS1Compat"?document.documentElement:document.body,ie:window.attachEvent&&!window.opera,ie6:navigator.appVersion.indexOf("MSIE 6.")>=0,firefox:navigator.userAgent.indexOf("Gecko")>-1&&navigator.userAgent.indexOf("KHTML")==-1,opare:!!window.opera,positionX:function(a){return a.getBoundingClientRect().left+Base.B.scrollX()-document.documentElement.clientLeft},positionY:function(a){return a.getBoundingClientRect().top+Base.B.scrollY()-document.documentElement.clientTop},scrollX:function(){return !Base.C.isUndefined(window.pageXOffset)?window.pageXOffset:this.doc.scrollLeft},scrollY:function(){return !Base.C.isUndefined(window.pageYOffset)?window.pageYOffset:this.doc.scrollTop},mouseX:function(a){return a.pageX?a.pageX:a.clientX+Base.B.scrollX()},mouseY:function(a){return a.pageY?a.pageY:a.clientY+Base.B.scrollY()}})})();Namespace("U");(function(){var a=Create();mix(a.prototype,{elem:null,normal:"",disabled:"dis",value:"\u786e\u5b9a",isDisabled:false,event:null,init:function(c){mix(this,c);var b=this.elem=C("a");b.href="#";this.setValue(this.value);if(this.isDisabled){this.disable()}else{Base.D.addClass(b,this.normal)}this.addEvent();return this},setValue:function(b){this.elem.innerHTML=b},disable:function(){this.isDisabled=true;Base.D.addClass(this.elem,this.disabled)},enable:function(){this.isDisabled=false;Base.D.removeClass(this.elem,this.disabled)},addEvent:function(){var c=this;for(var b in this.event){Base.E.addEvent(this.elem,b,(function(){var d=b;return function(){if(c.isDisabled){return false}c.event[d].call(this);return false}})())}},reAddEvent:function(b,c){Base.E.removeEvent(this.elem,b);Base.E.addEvent(this.elem,b,c)},remove:function(){this.elem.parentNode.removeChild(this.elem)}});mix(Base.U,{Button:a})})();(function(){var a=Create();mix(a.prototype,{elem:null,moveElem:null,down:Base.C.empty,move:Base.C.empty,up:Base.C.empty,init:function(b){mix(this,b);this.moveElem=this.moveElem==null?this.elem:this.moveElem;this.mousedown()},mousedown:function(){var b=this;Base.E.addEvent(this.elem,"mousedown",function(c){try{document.body.setCapture()}catch(c){}b.getInfo(c);b.down(b.moveElem,b);b.moveElem.style.cssText+=";position:absolute;top:"+(b.posY-b.marginTop)+"px;left:"+(b.posX-b.marginLeft)+"px;";b.mousemove();b.mouseup();return false})},getInfo:function(b){this.posX=Base.B.positionX(this.moveElem);this.posY=Base.B.positionY(this.moveElem);this.fixX=Base.B.mouseX(b)-this.posX;this.fixY=Base.B.mouseY(b)-this.posY;this.marginTop=parseInt(Base.D.getStyle(this.moveElem,"marginTop"));this.marginLeft=parseInt(Base.D.getStyle(this.moveElem,"marginLeft"))},moveEvent:function(b){this.moveElem.style.cssText+=";top:"+(Base.B.mouseY(b)-this.fixY-this.marginTop)+"px;left:"+(Base.B.mouseX(b)-this.fixX-this.marginLeft)+"px;"},mousemove:function(){var d=this,c=true,b;Base.E.addEvent(document,"mousemove",function(f){b=d.move(d.moveElem,d);if(c){if(b!==false){d.moveEvent(f)}}c=!c;return false})},mouseup:function(){var b=this;Base.E.addEvent(document,"mouseup",function(){try{document.body.releaseCapture()}catch(c){}b.up(b.moveElem,b);Base.E.removeEvent(document,"mousemove");Base.E.removeEvent(document,"mouseup");return false})}});mix(Base.U,{Drag:a})})();(function(){var a=Create();mix(a.prototype,{init:function(b,e){var d=this.layer=C("div"),c=document.documentElement,b=b||"#000",e=0.5;if(Base.B.ie6){this.createIframe()}d.style.cssText+=";filter:alpha(opacity="+e*100+")";setTimeout(function(){d.style.cssText+=";width:"+c.clientWidth+"px;height:"+(c.scrollHeight>c.clientHeight?c.scrollHeight:c.clientHeight)+"px;background:"+b+";opacity:"+e+";position:absolute;top:0;left:0;z-index:999"},0);return this},createIframe:function(){this.layer.innerHTML='<iframe style="width:100%;height:100%;position:absolute;top:0;left:0;z-index:-1;filter:alpha(opacity=0)" src=""></iframe>'},close:function(){this.layer.innerHTML="";this.layer.parentNode.removeChild(this.layer)}});mix(Base.U,{mask:a})})();(function(){var a=Create(),b=[];mix(a.prototype,{dialogWrap:null,title:"\u6807\u9898",message:"",html:"",width:0,iframe:[],fixTitleHeight:80,tipsFixTitleHeight:30,loading:true,mask:true,top:0,left:0,unique:false,type:"confirm",autoClose:0,confirmDisabled:false,cancelDisabled:false,confirmValue:"\u786e\u5b9a",cancelValue:"\u53d6\u6d88",callback:Base.C.empty,drag:false,closeButtonEvent:Base.C.empty,afterClose:Base.C.empty,addButton:[],frameLoaded:null,frameAutoSize:false,init:function(c){mix(this,c);this.show()},createWrap:function(){var c=C("div");Base.D.addClass(c,"mask_layer_wrap");return c},createCloseBg:function(){var c=C("div");Base.D.addClass(c,"mask_layer_close");return c},createCloseButton:function(){var c=C("a"),d=this;c.href="#";c.hideFocus=true;Base.D.addClass(c,"mask_layer_close_bn");Base.E.addEvent(c,"click",function(f){if(d.closeButtonEvent()===false){return}d.close();return false});return c},createTitle:function(){var c=C("div");Base.D.addClass(c,"mask_layer_title");c.innerHTML="<h3>"+this.title+"</h3>";return c},hasIframe:function(c){var d=c.getElementsByTagName("iframe");if(d.length!=0){this.iframe=Base.A.build(d)}return d.length!=0},createLoading:function(){var c=C("div");Base.D.addClass(c,"mask_layer_loading");return c},createFooter:function(){var c=C("div");if(this.type=="tips"){return c}Base.D.addClass(c,"layer_bt_wrap");this.layerType(c);this.addButtonEvent(c);return c},createContent:function(){var c=C("div");Base.D.addClass(c,"mask_layer_con");Base.D.addClass(c,"mask_layer_temp");c.innerHTML=this.message;document.body.appendChild(c);this.width=c.offsetWidth;this.height=c.offsetHeight+(this.type=="tips"?this.tipsFixTitleHeight:this.fixTitleHeight);Base.D.removeClass(c,"mask_layer_temp");return c},reflow:function(c){var d=this.dialogContent;if(c){this.message='<div style="width:'+c.width+"px;height:"+c.height+'px;"></div>'}else{this.message=this.dialogContent.innerHTML}document.body.removeChild(this.createContent());this.wrapStyle(this.dialogWrap);this.dialogContent=d},iframeLoad:function(){var f=this,d=this.iframe,e=0,c=d.length;(function(){var g=d[e],i=arguments.callee,h;if(g.attachEvent&&!window.opare){g.attachEvent("onload",function(){h=arguments.callee;e++;if(e==c){f.removeLoading();if(f.frameLoaded){f.frameLoaded();f.frameLoaded=null}if(f.frameAutoSize){try{f.synchronousFrameSize(g)}catch(j){}}g.detachEvent("onload",h);if(f.frameAutoSize){g.attachEvent("onload",function(){try{f.synchronousFrameSize(g)}catch(k){}})}}else{i()}})}else{g.onload=function(){e++;if(e==c){f.removeLoading();if(f.frameLoaded){f.frameLoaded();f.frameLoaded=null}if(f.frameAutoSize){try{f.synchronousFrameSize(g)}catch(j){}}g.onload=null;if(f.frameAutoSize){g.onload=function(){try{f.synchronousFrameSize(g)}catch(k){}}}}else{i()}}}})()},synchronousFrameSize:function(e){var c;if(e.attachEvent&&!window.opare){c={height:e.contentWindow.document.body.scrollHeight,width:e.contentWindow.document.body.scrollWidth}}else{if(Base.B.firefox){var d=Math.min(e.contentWindow.document.documentElement.scrollHeight,e.contentWindow.document.body.scrollHeight);c={height:d,width:e.contentWindow.document.documentElement.scrollWidth}}else{c={height:e.contentWindow.document.documentElement.scrollHeight,width:e.contentWindow.document.documentElement.scrollWidth}}}e.style.cssText+=";width:"+c.width+"px;height:"+c.height+"px;";this.reflow(c)},setMask:function(){var c=this.maskLayer=new Base.U.mask().layer;document.body.appendChild(c)},wrapStyle:function(c){c.style.cssText+=";width:"+this.width+"px;height:"+this.height+"px;top:"+(Base.B.doc.clientHeight/2+Base.B.scrollY())+"px;left:"+(Base.B.doc.clientWidth/2+Base.B.scrollX())+"px;margin-top:-"+(this.height/2-this.top)+"px;margin-left:-"+(this.width/2-this.left)+"px;"},dragEvent:function(){var c=this;new Base.U.Drag({elem:c.dialogTitle,moveElem:c.dialogWrap,down:function(d,e){document.body.style.cursor="move"},up:function(d,e){document.body.style.cursor="default"}})},show:function(){var e=document.createDocumentFragment(),h,i,g,d,c,f;if(this.unique){this.filterUnique()}b.push(this);if(this.dialogWrap){this.dialogWrap.style.display="block";if(this.mask&&this.maskLayer){this.maskLayer.style.display="block"}return}h=this.dialogWrap=this.createWrap();if(this.html!==""){this.fixTitleHeight=50;this.tipsFixTitleHeight=0;this.message=this.html;f=this.dialogContent=this.createContent();dialogFooter=this.dialogFooter=this.createFooter();if(this.hasIframe(f)){if(this.loading){c=this.dialogLoading=this.createLoading();e.appendChild(c)}this.iframeLoad()}e.appendChild(f);e.appendChild(dialogFooter)}else{i=this.dialogCloseBg=this.createCloseBg();g=this.dialogCloseButton=this.createCloseButton();d=this.dialogTitle=this.createTitle();f=this.dialogContent=this.createContent();dialogFooter=this.dialogFooter=this.createFooter();if(this.hasIframe(f)){if(this.loading){c=this.dialogLoading=this.createLoading();e.appendChild(c)}this.iframeLoad()}e.appendChild(i);e.appendChild(g);e.appendChild(d);e.appendChild(f);e.appendChild(dialogFooter)}h.appendChild(e);this.wrapStyle(h);if(this.mask){this.setMask()}if(this.drag){this.dragEvent()}document.body.appendChild(h);this.checkAutoClose()},checkAutoClose:function(){var c=this;if(this.autoClose>0){setTimeout(function(){if(c.callback){if(c.callback.call(c)==false){return}}c.close()},this.autoClose)}},createButton:function(c){return new WW.U.Button(c)},layerType:function(d){var f=this,c,e;switch(this.type){case"alert":c=this.createButton({normal:"confirm",disabled:"dis",value:f.confirmValue,isDisabled:f.confirmDisabled,event:{click:function(){this.blur();if(f.callback){if(f.callback.call(f,true)!==false){f.close()}}else{f.close()}}}});f.confirmButton=c.elem;d.appendChild(f.confirmButton);break;case"confirm":c=this.createButton({normal:"confirm",disabled:"dis",value:f.confirmValue,isDisabled:f.confirmDisabled,event:{click:function(){this.blur();if(f.callback){if(f.callback.call(f,true)!==false){f.close()}}else{f.close()}}}});e=this.createButton({normal:"cancel",value:f.cancelValue,isDisabled:f.cancelDisabled,event:{click:function(){this.blur();if(f.callback){if(f.callback.call(f,false)!==false){f.close()}}else{f.close()}}}});f.confirmButton=c;f.cancelButton=e;d.appendChild(f.confirmButton.elem);d.appendChild(f.cancelButton.elem);break}},addButtonEvent:function(f){var e=this.addButton;for(var d=0,c=e.length;d<c;d++){f.appendChild(this.createButton(e[d]).elem)}},filterUnique:function(){for(var d=0,c=b.length;d<c;d++){b[d].close()}b=[]},removeLoading:function(){if(this.dialogLoading&&this.dialogLoading.parentNode){this.dialogLoading.parentNode.removeChild(this.dialogLoading);this.dialogLoading=null}},hide:function(){if(this.mask&&this.maskLayer){this.maskLayer.style.display="none"}if(this.dialogWrap){this.dialogWrap.style.display="none"}},close:function(){if(this.mask&&this.maskLayer){this.maskLayer.innerHTML="";document.body.removeChild(this.maskLayer);this.maskLayer=null}if(this.dialogWrap){this.dialogWrap.innerHTML="";document.body.removeChild(this.dialogWrap);this.dialogWrap=null}this.afterClose()}});mix(Base.U,{Dialog:a});mix(Base.U,{Tips:function(h,j,k,i,e){var c,e=e||{},d,f,g;switch(h){case"dark":d="dark";break;case"green":d="green";break;case"yellow":d="yellow";break;case"red":d="red";break;case"blue":d="blue";break}if(i){f='<table class="tipShadow pointer">'}else{f='<table class="tipShadow">'}f+='		<tr><td class="border"></td><td class="border"></td><td class="border"></td></tr>';f+="		<tr>";f+='			<td class="sideBorder"></td>';f+='			<td class="tipShadowContent">';f+='				<div class="icon '+d+'"></div>';if(!k){if(Base.B.ie){f+='				<div class = "title" style="height:24px;line-height:24px;">'+j+"</div>"}else{f+='				<div class = "title" style="height:30px;line-height:30px;">'+j+"</div>"}}else{f+='				<div class = "title">'+j+"</div>";f+='				<div class = "message">'+k+"</div>"}f+='					<div style="clear:both"></div>';f+="			</td>";f+='			<td class="sideBorder"></td>';f+="		</tr>";f+='		<tr><td class="border"></td><td class="border"></td><td class="border"></td></tr>';f+="	</table>";c={type:"tips",mask:false,html:f};mix(c,e,false);g=new Base.U.Dialog(c);if(i){Base.E.addEvent(g.dialogWrap,"click",function(){g.close()})}return g}})})();Alias("WW");
