/*! * artdialog basic * date: 2011-09-04 30:36 * http://code.google.com/p/artdialog/ * (c) 2009-2011 tangbin, http://www.planeart.cn */ ;(function(window,undefined){if(window.jquery)return jquery;var $=window.art=function(selector,content){return new $.fn.init(selector,content);},readybound=false,readylist=[],domcontentloaded,timerid,isopacity='opacity'in document.documentelement.style,quickexpr=/^(?:[^<]*(<[\w\w]+>)[^>]*$|#([\w\-]+)$)/,rclass=/[\n\t]/g,ralpha=/alpha\([^)]*\)/i,ropacity=/opacity=([^)]*)/,rfxnum=/^([+-]=)?([\d+-.]+)(.*)$/;if(window.$===undefined)window.$=$;$.fn=$.prototype={constructor:$,ready:function(callback){$.bindready();if($.isready){callback.call(document,$);}else if(readylist){readylist.push(callback);};return this;},hasclass:function(name){var classname=' '+name+' ';if((' '+this[0].classname+' ').replace(rclass,' ').indexof(classname)>-1)return true;return false;},addclass:function(name){if(!this.hasclass(name))this[0].classname+=' '+name;return this;},removeclass:function(name){var elem=this[0];if(!name){elem.classname='';}else if(this.hasclass(name)){elem.classname=elem.classname.replace(name,' ');};return this;},css:function(name,value){var i,elem=this[0],obj=arguments[0];if(typeof name==='string'){if(value===undefined){return $.css(elem,name);}else{name==='opacity'?$.opacity.set(elem,value):elem.style[name]=value;};}else{for(i in obj){i==='opacity'?$.opacity.set(elem,obj[i]):elem.style[i]=obj[i];};};return this;},show:function(){return this.css('display','block');},hide:function(){return this.css('display','none');},offset:function(){var elem=this[0],box=elem.getboundingclientrect(),doc=elem.ownerdocument,body=doc.body,docelem=doc.documentelement,clienttop=docelem.clienttop||body.clienttop||0,clientleft=docelem.clientleft||body.clientleft||0,top=box.top+(self.pageyoffset||docelem.scrolltop)-clienttop,left=box.left+(self.pagexoffset||docelem.scrollleft)-clientleft;return{left:left,top:top};},html:function(content){var elem=this[0];if(content===undefined)return elem.innerhtml;$.cleandata(elem.getelementsbytagname('*'));elem.innerhtml=content;return this;},remove:function(){var elem=this[0];$.cleandata(elem.getelementsbytagname('*'));$.cleandata([elem]);elem.parentnode.removechild(elem);return this;},bind:function(type,callback){$.event.add(this[0],type,callback);return this;},unbind:function(type,callback){$.event.remove(this[0],type,callback);return this;}};$.fn.init=function(selector,context){var match,elem;context=context||document;if(!selector)return this;if(selector.nodetype){this[0]=selector;return this;};if(selector==='body'&&context.body){this[0]=context.body;return this;};if(selector==='head'||selector==='html'){this[0]=context.getelementsbytagname(selector)[0];return this;};if(typeof selector==='string'){match=quickexpr.exec(selector);if(match&&match[2]){elem=context.getelementbyid(match[2]);if(elem&&elem.parentnode)this[0]=elem;return this;};};if(typeof selector==='function')return $(document).ready(selector);this[0]=selector;return this;};$.fn.init.prototype=$.fn;$.noop=function(){};$.iswindow=function(obj){return obj&&typeof obj==='object'&&'setinterval'in obj;};$.isarray=function(obj){return object.prototype.tostring.call(obj)==='[object array]';};$.fn.find=function(expr){var value,elem=this[0],classname=expr.split('.')[1];if(classname){if(document.getelementsbyclassname){value=elem.getelementsbyclassname(classname);}else{value=getelementsbyclassname(classname,elem);};}else{value=elem.getelementsbytagname(expr);};return $(value[0]);};function getelementsbyclassname(classname,node,tag){node=node||document;tag=tag||'*';var i=0,j=0,classelements=[],els=node.getelementsbytagname(tag),elslen=els.length,pattern=new regexp("(^|\\s)"+classname+"(\\s|$)");for(;i=that.options.speed+that.starttime){that.now=that.end;that.state=that.pos=1;that.update();that.options.curanim[that.prop]=true;for(var i in that.options.curanim){if(that.options.curanim[i]!==true){done=false;};};if(done)that.options.callback.call(that.elem);return false;}else{var n=t-that.starttime;that.state=n/that.options.speed;that.pos=$.easing[that.options.easing](that.state,n,0,1,that.options.speed);that.now=that.start+((that.end-that.start)*that.pos);that.update();return true;};},update:function(){var that=this;if(that.prop==='opacity'){$.opacity.set(that.elem,that.now);}else if(that.elem.style&&that.elem.style[that.prop]!=null){that.elem.style[that.prop]=that.now+that.unit;}else{that.elem[that.prop]=that.now;};}};$.fx.now=function(){return new date().gettime();};$.easing={linear:function(p,n,firstnum,diff){return firstnum+diff*p;},swing:function(p,n,firstnum,diff){return((-math.cos(p*math.pi)/2)+0.5)*diff+firstnum;}};$.fx.tick=function(){var timers=$.timers;for(var i=0;i=0;i--){if(timers[i].elem===this[0])timers.splice(i,1);};return this;};return $}(window));;(function($,window,undefined){$.noop=$.noop||function(){};var _box,_thisscript,_skin,_path,_count=0,_$window=$(window),_$document=$(document),_$html=$('html'),_$body=$(function(){_$body=$('body')}),_elem=document.documentelement,_isie6=window.vbarray&&!window.xmlhttprequest,_ismobile='createtouch'in document&&!('onmousemove'in _elem)||/(iphone|ipad|ipod)/i.test(navigator.useragent),_expando='artdialog'+(new date).gettime();var artdialog=function(config,ok,cancel){config=config||{};if(typeof config==='string'||config.nodetype===1){config={content:config,fixed:!_ismobile};};var api,buttons=[],defaults=artdialog.defaults,elem=config.follow=this.nodetype===1&&this||config.follow;for(var i in defaults){if(config[i]===undefined)config[i]=defaults[i];};$.each({ok:"yesfn",cancel:"nofn",close:"closefn",init:"initfn",okval:"yestext",cancelval:"notext"},function(i,o){config[i]=config[i]!==undefined?config[i]:config[o]});if(typeof elem==='string')elem=$(elem)[0];config.id=elem&&elem[_expando+'follow']||config.id||_expando+_count;api=artdialog.list[config.id];if(elem&&api)return api.follow(elem).focus();if(api)return api.focus();if(_ismobile)config.fixed=false;if(!$.isarray(config.button)){config.button=config.button?[config.button]:[];};if(ok!==undefined)config.ok=ok;if(cancel!==undefined)config.cancel=cancel;config.ok&&config.button.push({name:config.okval,callback:config.ok,focus:true});config.cancel&&config.button.push({name:config.cancelval,callback:config.cancel});artdialog.defaults.zindex=config.zindex;_count++;return artdialog.list[config.id]=_box?_box._init(config):new artdialog.fn._init(config);};artdialog.fn=artdialog.prototype={version:'4.1.2',_init:function(config){var that=this,dom,icon=config.icon,iconbg=icon&&(_isie6?{png:'../css/icons/'+icon+'.png'}:{backgroundimage:'url(\''+config.path+'/../css/icons/'+icon+'.png\')'});that._isrun=true;that.config=config;that.dom=dom=that.dom||that._getdom();dom.wrap.addclass(config.skin);dom.close[config.cancel===false?'hide':'show']();dom.icon[0].style.display=icon?'':'none';dom.iconbg.css(iconbg||{background:'none'});dom.se.css('cursor',config.resize?'se-resize':'auto');dom.title.css('cursor',config.drag?'move':'auto');dom.content.css('padding',config.padding);that[config.show?'show':'hide'](true);that.button(config.button).title(config.title).content(config.content,config.iframe).size(config.width,config.height).time(config.time);config.follow?that.follow(config.follow):that.position(config.left,config.top);that.focus(config.focus);config.lock&&that.lock();that._addevent();that._ie6pngfix();_box=null;config.init&&config.init.call(that,window);return that;},content:function(msg,url){var prev,next,parent,display,that=this,dom=that.dom,wrap=dom.wrap[0],width=wrap.offsetwidth,height=wrap.offsetheight,left=parseint(wrap.style.left),top=parseint(wrap.style.top),csswidth=wrap.style.width,$content=dom.content,content=$content[0],iframe=null,isiframe=typeof url=='string'&&url!='',iframrid='atrdialogiframe_'+that.config.id,ifrbox;that._elemback&&that._elemback();if(isiframe){if(typeof pc_hash=='string')url+=(url.indexof('?')>-1?'&':'?')+'pc_hash='+pc_hash;iframe=document.createelement('iframe');iframe.setattribute("frameborder",0,0);iframe.setattribute("width",'100%');iframe.setattribute("height",'100%');iframe.setattribute("id",iframrid);iframe.src=url;msg=iframe;$ready=function(){try{ifrbox=document.getelementbyid(iframrid).contentwindow.document;ifrwidth=that.config.width==='auto'?math.max(ifrbox.documentelement.scrollwidth,ifrbox.body.scrollwidth)+18:that.config.width;ifrheight=that.config.height==='auto'?math.max(ifrbox.documentelement.scrollheight,ifrbox.body.scrollheight):that.config.height;that.position(0,0);that.size(ifrwidth,ifrheight);that.position(that.config.left,that.config.top);}catch(e){};};if(document.addeventlistener)iframe.addeventlistener('load',$ready,false);else if(document.attachevent)iframe.attachevent('onload',$ready);that.dom.content.css('padding',0);that.dom.content.css('width','100%');that.dom.content.css('height','100%');};wrap.style.width='auto';if(msg===undefined)return content;if(typeof msg==='string'){$content.html(msg);}else if(msg&&msg.nodetype===1){display=msg.style.display;prev=msg.previoussibling;next=msg.nextsibling;parent=msg.parentnode;that._elemback=function(){if(prev&&prev.parentnode){prev.parentnode.insertbefore(msg,prev.nextsibling);}else if(next&&next.parentnode){next.parentnode.insertbefore(msg,next);}else if(parent){parent.appendchild(msg);};msg.style.display=display;that._elemback=null;};$content.html('');content.appendchild(msg);msg.style.display='block';if(isiframe)that.data.iframe=msg.contentwindow;};if(!arguments[1]){if(that.config.follow){that.follow(that.config.follow);}else{width=wrap.offsetwidth-width;height=wrap.offsetheight-height;left=left-width/2;top=top-height/2;if(isnan(left))return that;wrap.style.left=math.max(left,0)+'px';wrap.style.top=math.max(top,0)+'px';};if(csswidth&&csswidth!=='auto'){wrap.style.width=wrap.offsetwidth+'px';};that._autopositiontype();};that._ie6selectfix();that._runscript(content);return that;},data:{},title:function(text){var dom=this.dom,wrap=dom.wrap,title=dom.title,classname='aui_state_notitle';if(text===undefined)return title[0];if(text===false){title.hide().html('');wrap.addclass(classname);}else{title.show().html(text||'');wrap.removeclass(classname);};return this;},position:function(left,top){var that=this,config=that.config,wrap=that.dom.wrap[0],isfixed=_isie6?false:config.fixed,ie6fixed=_isie6&&that.config.fixed,docleft=_$document.scrollleft(),doctop=_$document.scrolltop(),dl=isfixed?0:docleft,dt=isfixed?0:doctop,ww=_$window.width(),wh=_$window.height(),ow=wrap.offsetwidth,oh=wrap.offsetheight,style=wrap.style;if(left||left===0){that._left=left.tostring().indexof('%')!==-1?left:null;left=that._tonumber(left,ww-ow);if(typeof left==='number'){left=ie6fixed?(left+=docleft):left+dl;style.left=math.max(left,dl)+'px';}else if(typeof left==='string'){style.left=left;};};if(top||top===0){that._top=top.tostring().indexof('%')!==-1?top:null;top=that._tonumber(top,wh-oh);if(typeof top==='number'){top=ie6fixed?(top+=doctop):top+dt;style.top=math.max(top,dt)+'px';}else if(typeof top==='string'){style.top=top;};};if(left!==undefined&&top!==undefined){that._follow=null;that._autopositiontype();};return that;},size:function(width,height){var maxwidth,maxheight,scalewidth,scaleheight,that=this,config=that.config,dom=that.dom,wrap=dom.wrap,main=dom.main,wrapstyle=wrap[0].style,style=main[0].style;if(width){that._width=width.tostring().indexof('%')!==-1?width:null;maxwidth=_$window.width()-wrap[0].offsetwidth+main[0].offsetwidth;scalewidth=that._tonumber(width,maxwidth);try{width=math.min(parseint(scalewidth),maxwidth);width=isnan(width)?'auto':width;}catch(e){width=scalewidth};if(typeof width==='number'){wrapstyle.width='auto';style.width=math.max(that.config.minwidth,width)+'px';wrapstyle.width=wrap[0].offsetwidth+'px';}else if(typeof width==='string'){style.width=width;width==='auto'&&wrap.css('width','auto');};};if(height){that._height=height.tostring().indexof('%')!==-1?height:null;maxheight=_$window.height()-wrap[0].offsetheight+main[0].offsetheight;scaleheight=that._tonumber(height,maxheight);try{height=math.min(parseint(scaleheight),maxheight);height=isnan(height)?'auto':height;}catch(e){height=scaleheight};if(typeof height==='number'){style.height=math.max(that.config.minheight,height)+'px';}else if(typeof height==='string'){style.height=height;};};that._ie6selectfix();return that;},follow:function(elem){var $elem,that=this,config=that.config;if(typeof elem==='string'||elem&&elem.nodetype===1){$elem=$(elem);elem=$elem[0];};if(!elem||!elem.offsetwidth&&!elem.offsetheight){return that.position(that._left,that._top);};var expando=_expando+'follow',winwidth=_$window.width(),winheight=_$window.height(),docleft=_$document.scrollleft(),doctop=_$document.scrolltop(),offset=$elem.offset(),width=elem.offsetwidth,height=elem.offsetheight,isfixed=_isie6?false:config.fixed,left=isfixed?offset.left-docleft:offset.left,top=isfixed?offset.top-doctop:offset.top,wrap=that.dom.wrap[0],style=wrap.style,wrapwidth=wrap.offsetwidth,wrapheight=wrap.offsetheight,setleft=left-(wrapwidth-width)/2,settop=top+height,dl=isfixed?0:docleft,dt=isfixed?0:doctop;setleft=setleftwinwidth)&&(left-wrapwidth>dl)?left-wrapwidth+width:setleft;settop=(settop+wrapheight>winheight+dt)&&(top-wrapheight>dt)?top-wrapheight:settop;style.left=setleft+'px';style.top=settop+'px';that._follow&&that._follow.removeattribute(expando);that._follow=elem;elem[expando]=config.id;that._autopositiontype();return that;},button:function(){var that=this,ags=arguments,dom=that.dom,wrap=dom.wrap,buttons=dom.buttons,elem=buttons[0],strongbutton='aui_state_highlight',listeners=that._listeners=that._listeners||{},list=$.isarray(ags[0])?ags[0]:[].slice.call(ags);if(ags[0]===undefined)return elem;$.each(list,function(i,val){var name=val.name,isnewbutton=!listeners[name],button=!isnewbutton?listeners[name].elem:document.createelement('button');if(!listeners[name])listeners[name]={};if(val.callback)listeners[name].callback=val.callback;if(val.classname)button.classname=val.classname;if(val.focus){that._focus&&that._focus.removeclass(strongbutton);that._focus=$(button).addclass(strongbutton);that.focus();};button[_expando+'callback']=name;button.disabled=!!val.disabled;if(isnewbutton){button.innerhtml=name;listeners[name].elem=button;elem.appendchild(button);};});buttons[0].style.display=list.length?'':'none';that._ie6selectfix();return that;},show:function(){this.dom.wrap.show();!arguments[0]&&this._lockmaskwrap&&this._lockmaskwrap.show();return this;},hide:function(){this.dom.wrap.hide();!arguments[0]&&this._lockmaskwrap&&this._lockmaskwrap.hide();return this;},close:function(){if(!this._isrun)return this;var that=this,dom=that.dom,wrap=dom.wrap,list=artdialog.list,fn=that.config.close,follow=that.config.follow;that.time();if(typeof fn==='function'&&fn.call(that,window)===false){return that;};that.unlock();that._elemback&&that._elemback();wrap[0].classname=wrap[0].style.csstext='';dom.title.html('');dom.content.html('');dom.buttons.html('');if(artdialog.focus===that)artdialog.focus=null;if(follow)follow.removeattribute(_expando+'follow');delete list[that.config.id];that._removeevent();that.hide(true)._setabsolute();for(var i in that){if(that.hasownproperty(i)&&i!=='dom')delete that[i];};_box?wrap.remove():_box=that;return that;},time:function(second){var that=this,cancel=that.config.cancelval,timer=that._timer;timer&&cleartimeout(timer);if(second){that._timer=settimeout(function(){that._click(cancel);},1000*second);};return that;},focus:function(){var elemfocus,that=this,dom=that.dom,wrap=dom.wrap,top=artdialog.focus,index=artdialog.defaults.zindex++;wrap.css('zindex',index);that._lockmask&&that._lockmask.css('zindex',index-1);top&&top.dom.wrap.removeclass('aui_state_focus');artdialog.focus=that;wrap.addclass('aui_state_focus');if(!arguments[0]){try{elemfocus=that._focus&&that._focus[0]||dom.close[0];elemfocus&&elemfocus.focus();}catch(e){};};return that;},lock:function(){if(this._lock)return this;var that=this,index=artdialog.defaults.zindex-1,wrap=that.dom.wrap,config=that.config,docwidth=_$document.width(),docheight=_$document.height(),lockmaskwrap=that._lockmaskwrap||$(_$body[0].appendchild(document.createelement('div'))),lockmask=that._lockmask||$(lockmaskwrap[0].appendchild(document.createelement('div'))),domtxt='(document).documentelement',sizecss=_ismobile?'width:'+docwidth+'px;height:'+docheight+'px':'width:100%;height:100%',ie6css=_isie6?'position:absolute;left:expression('+domtxt+'.scrollleft);top:expression('+domtxt+'.scrolltop);width:expression('+domtxt+'.clientwidth);height:expression('+domtxt+'.clientheight)':'';that.focus(true);wrap.addclass('aui_state_lock');lockmaskwrap[0].style.csstext=sizecss+';position:fixed;z-index:'+index+';top:0;left:0;overflow:hidden;'+ie6css;lockmask[0].style.csstext='height:100%;background:'+config.background+';filter:alpha(opacity=0);opacity:0';if(_isie6)lockmask.html('');lockmask.stop();lockmask.bind('click',function(){that._reset();}).bind('dblclick',function(){that.close();});if(config.duration===0){lockmask.css({opacity:config.opacity});}else{lockmask.animate({opacity:config.opacity},config.duration);};that._lockmaskwrap=lockmaskwrap;that._lockmask=lockmask;that._lock=true;return that;},unlock:function(){var that=this,lockmaskwrap=that._lockmaskwrap,lockmask=that._lockmask;if(!that._lock)return that;var style=lockmaskwrap[0].style;var un=function(){if(_isie6){style.removeexpression('width');style.removeexpression('height');style.removeexpression('left');style.removeexpression('top');};style.csstext='display:none';_box&&lockmaskwrap.remove();};lockmask.stop().unbind();that.dom.wrap.removeclass('aui_state_lock');if(!that.config.duration){un();}else{lockmask.animate({opacity:0},that.config.duration,un);};that._lock=false;return that;},_getdom:function(){var wrap=document.createelement('div');wrap.style.csstext='position:absolute;left:0;top:0';wrap.innerhtml=artdialog.templates;document.body.appendchild(wrap);var name,i=0,dom={wrap:$(wrap)},els=wrap.getelementsbytagname('*'),elslen=els.length;for(;i'+''+''+''+''+''+''+''+''+''+''+''+''+''+''+''+''+''+''+'
'+'
'+''+''+''+''+''+''+''+''+''+''+''+''+''+'
'+'
'+'
'+''+'\xd7'+''+'
'+'
'+'
'+'
'+'
'+'
'+'
'+'
'+'';artdialog.defaults={content:'
loading..
',title:'\u6d88\u606f',button:null,ok:null,cancel:null,init:null,close:null,okval:'\u786e\u5b9a',cancelval:'\u53d6\u6d88',width:'auto',height:'auto',minwidth:96,minheight:32,padding:'20px 25px',skin:'',icon:null,time:null,esc:true,focus:true,show:true,follow:null,path:_path,lock:true,background:'#000',opacity:.7,duration:300,fixed:false,left:'50%',top:'38.2%',zindex:1987,resize:true,drag:true};window.artdialog=$.dialog=$.artdialog=artdialog;}((window.jquery&&(window.art=jquery))||window.art,this));;(function($){var _dragevent,_use,_$window=$(window),_$document=$(document),_elem=document.documentelement,_isie6=!-[1,]&&!('minwidth'in _elem.style),_islosecapture='onlosecapture'in _elem,_issetcapture='setcapture'in _elem;artdialog.dragevent=function(){var that=this,proxy=function(name){var fn=that[name];that[name]=function(){return fn.apply(that,arguments);};};proxy('start');proxy('move');proxy('end');};artdialog.dragevent.prototype={onstart:$.noop,start:function(event){_$document.bind('mousemove',this.move).bind('mouseup',this.end);this._sclientx=event.clientx;this._sclienty=event.clienty;this.onstart(event.clientx,event.clienty);return false;},onmove:$.noop,move:function(event){this._mclientx=event.clientx;this._mclienty=event.clienty;this.onmove(event.clientx-this._sclientx,event.clienty-this._sclienty);return false;},onend:$.noop,end:function(event){_$document.unbind('mousemove',this.move).unbind('mouseup',this.end);this.onend(event.clientx,event.clienty);return false;}};_use=function(event){var limit,startwidth,startheight,startleft,starttop,isresize,api=artdialog.focus,config=api.config,dom=api.dom,wrap=dom.wrap,title=dom.title,main=dom.main;var clsselect='getselection'in window?function(){window.getselection().removeallranges();}:function(){try{document.selection.empty();}catch(e){};};_dragevent.onstart=function(x,y){if(isresize){startwidth=main[0].offsetwidth;startheight=main[0].offsetheight;}else{startleft=wrap[0].offsetleft;starttop=wrap[0].offsettop;};_$document.bind('dblclick',_dragevent.end);!_isie6&&_islosecapture?title.bind('losecapture',_dragevent.end):_$window.bind('blur',_dragevent.end);_issetcapture&&title[0].setcapture();wrap.addclass('aui_state_drag');api.focus();};_dragevent.onmove=function(x,y){if(isresize){var wrapstyle=wrap[0].style,style=main[0].style,width=x+startwidth,height=y+startheight;wrapstyle.width='auto';style.width=math.max(0,width)+'px';wrapstyle.width=wrap[0].offsetwidth+'px';style.height=math.max(0,height)+'px';}else{var style=wrap[0].style,left=x+startleft,top=y+starttop;config.left=math.max(limit.minx,math.min(limit.maxx,left));config.top=math.max(limit.miny,math.min(limit.maxy,top));style.left=config.left+'px';style.top=config.top+'px';};clsselect();api._ie6selectfix();};_dragevent.onend=function(x,y){_$document.unbind('dblclick',_dragevent.end);!_isie6&&_islosecapture?title.unbind('losecapture',_dragevent.end):_$window.unbind('blur',_dragevent.end);_issetcapture&&title[0].releasecapture();_isie6&&api._autopositiontype();wrap.removeclass('aui_state_drag');};isresize=event.target===dom.se[0]?true:false;limit=(function(){var maxx,maxy,wrap=api.dom.wrap[0],fixed=wrap.style.position==='fixed',ow=wrap.offsetwidth,oh=wrap.offsetheight,ww=_$window.width(),wh=_$window.height(),dl=fixed?0:_$document.scrollleft(),dt=fixed?0:_$document.scrolltop(),maxx=ww-ow+dl;maxy=wh-oh+dt;return{minx:dl,miny:dt,maxx:maxx,maxy:maxy};})();_dragevent.start(event);};_$document.bind('mousedown',function(event){var api=artdialog.focus;if(!api)return;var target=event.target,config=api.config,dom=api.dom;if(config.drag!==false&&target===dom.title[0]||config.resize!==false&&target===dom.se[0]){_dragevent=_dragevent||new artdialog.dragevent();_use(event);return false;};});})(window.jquery||window.art);