
(function(){if(window.ymPrompt)return;window.ymPrompt={version:'4.0',pubDate:'2009-02-16',apply:function(o,c,d){if(d)ymPrompt.apply(o,d);if(o&&c&&typeof c=='object')for(var p in c)o[p]=c[p];return o;},eventList:[]};var initFn=['setDefaultCfg','show'],_initFn={},t;while(t=initFn.shift())ymPrompt[t]=eval('0,function(){_initFn.'+t+'=arguments}');var isIE=!+'\v1';var isCompat=document.compatMode=='CSS1Compat';var IE6=isIE&&/MSIE (\d)\./.test(navigator.userAgent)&&parseInt(RegExp.$1)<7;var useFixed=!isIE||(!IE6&&isCompat);var $=function(id){return document.getElementById(id)};var $height=function(obj){return parseInt(obj.style.height)||obj.offsetHeight};var addEvent=(function(){return new Function('env','fn','obj',['obj=obj||document;',window.attachEvent?"obj.attachEvent('on'+env,fn)":'obj.addEventListener(env,fn,false)',';ymPrompt.eventList.push([env,fn,obj])'].join(''))})();var detachEvent=(function(){return new Function('env','fn','obj',['obj=obj||document;',window.attachEvent?"obj.detachEvent('on'+env,fn)":'obj.removeEventListener(env,fn,false)'].join(''))})();var setStyle=function(el,n,v){if(!el)return;if(typeof n=='object'){for(var i in n)setStyle(el,i,n[i]);return;}
if(el instanceof Array||/htmlcollection|nodelist/i.test(''+el)){for(var i=el.length-1;i>=0;i--)setStyle(el[i],n,v);return;}
try{el.style[n]=v}catch(e){}};var btnIndex=0,btnCache,seed=0;var mkBtn=function(txt,sign,autoClose,id){if(!txt)return;if(txt instanceof Array){var item,t=[],dftBtn={OK:[curCfg.okTxt,'ok'],CANCEL:[curCfg.cancelTxt,'cancel']};while(txt.length)(item=txt.shift())&&t[t.push(mkBtn.apply(null,dftBtn[item]||item))-1]||t.pop();return t;}
id=id||'ymPrompt_btn_'+seed++;autoClose=autoClose==undefined?'undefined':!!autoClose;return{id:id,html:"<input type='button' id='"+id+"' onclick='ymPrompt.doHandler(\""+sign+"\","+autoClose+")' style='cursor:pointer' class='btnStyle handler' value='"+txt+"' />"};};var joinBtn=function(btn){if(!btn)return btnCache='';if(!(btn instanceof Array))btn=[btn];if(!btn.length)return btnCache='';btnCache=btn.concat();var html=[];while(btn.length)html.push(btn.shift().html);return html.join('&nbsp;&nbsp;');}
var dftCfg={titleBar:true,fixPosition:true,dragOut:false,autoClose:true,showMask:true,maskAlphaColor:'#000',maskAlpha:0.1,winAlpha:0.8,title:'标题',message:'内容',width:300,height:185,winPos:'c',iframe:false,btn:null,closeBtn:true,closeTxt:'关闭',okTxt:' 确 定 ',cancelTxt:' 取 消 ',icoCls:'',handler:function(){}},curCfg={};(function(){var rootEl=document.body;if(!rootEl||typeof rootEl!='object')return addEvent('load',arguments.callee,window);rootEl=isCompat?document.documentElement:rootEl;var noFS=/body/i.test(document.body);if(!isIE&&!noFS)return;var saveWinInfo=function(){ymPrompt.apply(dragVar,{_offX:ym_win.offsetLeft-rootEl.scrollLeft,_offY:ym_win.offsetTop-rootEl.scrollTop});};var maskStyle='position:absolute;top:0;left:0;display:none;text-align:center';var div=document.createElement('div');div.innerHTML=["<div id='maskLevel' style=\'"+maskStyle+';z-index:10000;\'></div>',IE6?("<iframe id='maskIframe' style='"+maskStyle+";z-index:9999;filter:alpha(opacity=0);opacity:0'></iframe>"):'',"<div id='ym-window' style='position:absolute;z-index:10001;display:none'>",IE6?"<iframe style='width:100%;height:100%;position:absolute;top:0;left:0;z-index:-1'></iframe>":'',"<div class='ym-tl' id='ym-tl'><div class='ym-tr'><div class='ym-tc' style='cursor:move;'><div class='ym-header-text'></div><div class='ym-header-tools'></div></div></div></div>","<div class='ym-ml' id='ym-ml'><div class='ym-mr'><div class='ym-mc'><div class='ym-body'></div></div></div></div>","<div class='ym-ml' id='ym-btnl'><div class='ym-mr'><div class='ym-btn'></div></div></div>","<div class='ym-bl' id='ym-bl'><div class='ym-br'><div class='ym-bc'></div></div></div>","</div>"].join('');document.body.appendChild(div),div=null;var dragVar={};var maskLevel=$('maskLevel');var ym_win=$('ym-window');var ym_headbox=$('ym-tl');var ym_head=ym_headbox.firstChild.firstChild;var ym_hText=ym_head.firstChild;var ym_hTool=ym_hText.nextSibling;var ym_body=$('ym-ml').firstChild.firstChild.firstChild;var ym_btn=$('ym-btnl');var ym_btnContent=ym_btn.firstChild.firstChild;var ym_bottom=$('ym-bl');var maskEl=[maskLevel];IE6&&maskEl.push($('maskIframe'));var getWinSize=function(){return[Math.max(rootEl.scrollWidth,rootEl.clientWidth),Math.max(rootEl.scrollHeight,rootEl.clientHeight)]};var winSize=getWinSize();var bindEl=ym_head.setCapture&&ym_head;var mEvent=function(e){e=e||window.event;var sLeft=dragVar.offX+(e.x||e.pageX);var sTop=dragVar.offY+(e.y||e.pageY);if(!curCfg.dragOut){var flag=curCfg.fixPosition&&useFixed;var sl=flag?0:rootEl.scrollLeft,st=flag?0:rootEl.scrollTop;sLeft=Math.min(Math.max(sLeft,sl),rootEl.clientWidth-ym_win.offsetWidth+sl);sTop=Math.min(Math.max(sTop,st),rootEl.clientHeight-ym_win.offsetHeight+st);}else if(curCfg.showMask&&''+winSize!=''+getWinSize())
resizeMask(true);setStyle(ym_win,{left:sLeft+'px',top:sTop+'px'});};var uEvent=function(){noFS&&curCfg.winAlpha!=1&&setStyle(ym_win,isIE?{filter:'Alpha(opacity=100)'}:{opacity:1});detachEvent("mousemove",mEvent,bindEl);detachEvent("mouseup",uEvent,bindEl);saveWinInfo();bindEl&&(detachEvent("losecapture",uEvent,bindEl),bindEl.releaseCapture());rootEl.style.cursor=rootEl._cursor;};addEvent('mousedown',function(e){rootEl._cursor=rootEl.style.cursor||'';rootEl.style.cursor='pointer';e=e||window.event;noFS&&curCfg.winAlpha!=1&&setStyle(ym_win,isIE?{filter:'Alpha(opacity='+curCfg.winAlpha*100+')'}:{opacity:curCfg.winAlpha});ymPrompt.apply(dragVar,{offX:ym_win.offsetLeft-(e.x||e.pageX),offY:ym_win.offsetTop-(e.y||e.pageY)});addEvent("mousemove",mEvent,bindEl);addEvent("mouseup",uEvent,bindEl);bindEl&&(addEvent("losecapture",uEvent,bindEl),bindEl.setCapture());},ym_head);var keydownEvent=function(e){var e=e||event,keyCode=e.keyCode;if(keyCode==27)destroy();if(btnCache){var l=btnCache.length,nofocus;document.activeElement&&document.activeElement.id!=btnCache[btnIndex].id&&(nofocus=true);if(keyCode==9||keyCode==39)nofocus&&(btnIndex=-1),$(btnCache[++btnIndex==l?(--btnIndex):btnIndex].id).focus();if(keyCode==37)nofocus&&(btnIndex=l),$(btnCache[--btnIndex<0?(++btnIndex):btnIndex].id).focus();if(keyCode==13)return true;}
return keyEvent(e,(keyCode>110&&keyCode<123)||keyCode==9||keyCode==13);};var scrollEvent=function(){setStyle(ym_win,{left:dragVar._offX+rootEl.scrollLeft+'px',top:dragVar._offY+rootEl.scrollTop+'px'});};var keyEvent=function(e,d){e=e||event;if(!d&&/input|select|textarea/i.test((e.srcElement||e.target).tagName))return true;try{e.returnValue=false;e.keyCode=0;}catch(ex){e.preventDefault&&e.preventDefault();}
return false;};maskLevel.oncontextmenu=ym_win.onselectstart=ym_win.oncontextmenu=keyEvent;var resizeMask=function(noDelay){setStyle(maskEl,'display','none');var size=getWinSize();var resize=function(){setStyle(maskEl,{width:size[0]+'px',height:size[1]+'px',display:''});};isIE?noDelay===true?resize():setTimeout(resize,0):resize();setWinSize();};var maskVisible=function(visible){if(!curCfg.showMask)return;(visible===false?detachEvent:addEvent)("resize",resizeMask,window);if(visible===false)return setStyle(maskEl,'display','none');setStyle(maskLevel,{background:curCfg.maskAlphaColor,filter:'Alpha(opacity='+curCfg.maskAlpha*100+')',opacity:curCfg.maskAlpha});resizeMask(true);};var getPos=function(f){var flag=curCfg.fixPosition&&useFixed;var pos=[rootEl.clientWidth-ym_win.offsetWidth,rootEl.clientHeight-ym_win.offsetHeight,flag?0:rootEl.scrollLeft,flag?0:rootEl.scrollTop];var arr=f.replace(/\{(\d)\}/g,function(s,s1){return pos[s1]}).split(',');return[eval(arr[0]),eval(arr[1])];};var posMap={c:'{0}/2+{2},{1}/2+{3}',l:'{2},{1}/2+{3}',r:'{0}+{2},{1}/2+{3}',t:'{0}/2+{2},{3}',b:'{0}/2,{1}+{3}',lt:'{2},{3}',lb:'{2},{1}+{3}',rb:'{0}+{2},{1}+{3}',rt:'{0}+{2},{3}'};var setWinSize=function(w,h){if(!ym_win||ym_win.style.display=='none')return;curCfg.height=parseInt(h)||curCfg.height;curCfg.width=parseInt(w)||curCfg.width;setStyle(ym_win,{left:0,top:0,width:curCfg.width+'px',height:curCfg.height+'px'});var pos=posMap[curCfg.winPos];pos=pos?getPos(pos):curCfg.winPos;if(!(pos instanceof Array))pos=getPos(posMap['c']);setStyle(ym_win,{top:pos[1]+'px',left:pos[0]+'px'});saveWinInfo();setStyle(ym_body,'height',curCfg.height-$height(ym_headbox)-$height(ym_btn)-$height(ym_bottom)+'px');};var _obj=[];var winVisible=function(visible){var fn=visible===false?detachEvent:addEvent;if(curCfg.fixPosition&&!useFixed)fn('scroll',scrollEvent,window);setStyle(ym_win,'position',curCfg.fixPosition&&useFixed?'fixed':'absolute');fn('keydown',keydownEvent);if(visible===false){setStyle(ym_win,'display','none');setStyle(_obj,'visibility','visible');_obj=[];return;}
isIE&&setStyle(ym_win,'filter','');for(var o=document.getElementsByTagName('object'),i=o.length-1;i>-1;i--)o[i].style.visibility!='hidden'&&_obj.push(o[i])&&(o[i].style.visibility='hidden');setStyle([ym_hText,ym_hTool],'display',(curCfg.titleBar?'':'none'));ym_head.className='ym-tc'+(curCfg.titleBar?'':' ym-ttc');ym_hText.innerHTML=curCfg.title;ym_hTool.innerHTML=curCfg.closeBtn?"<div class='ymPrompt_close'  onclick='ymPrompt.close()'><strong>×</strong></div>":'';ym_body.innerHTML=!curCfg.iframe?('<div class="ym-content">'+curCfg.message+'</div>'):"<iframe width='100%' height='100%' border='0' frameborder='0' src='"+curCfg.message+"'></iframe>";(function(el,obj){for(var i in obj)try{el[i]=obj[i]}catch(e){}})(ym_body.firstChild,curCfg.iframe);ym_body.className="ym-body "+curCfg.icoCls;setStyle(ym_btn,'display',((ym_btnContent.innerHTML=joinBtn(mkBtn(curCfg.btn)))?'':'none'));setStyle(ym_win,'display','');setWinSize();btnCache&&$(btnCache[btnIndex=0].id).focus();};var isShow=false;var init=function(){isShow=true;maskVisible();winVisible();};var destroy=function(){isShow=false;maskVisible(false);winVisible(false);};ymPrompt.apply(ymPrompt,{close:destroy,getPage:function(){return curCfg.iframe?ym_body.firstChild:null},show:function(args,fargs){if(isShow)ymPrompt.doHandler('close',curCfg.autoClose,true);var a=[].slice.call(args,0),o={};if(typeof a[0]!='object'){var cfg=['message','width','height','title','handler','maskAlphaColor','maskAlpha','iframe','icoCls','btn','autoClose','fixPosition','dragOut','titleBar','showMask','winPos','winAlpha'];for(var i=0,l=a.length;i<l;i++)if(a[i])o[cfg[i]]=a[i];}else{o=a[0];}
ymPrompt.apply(curCfg,ymPrompt.apply({},o,fargs),ymPrompt.setDefaultCfg());for(var i in curCfg)curCfg[i]=curCfg[i]!=null?curCfg[i]:ymPrompt.cfg[i];init();},doHandler:function(sign,autoClose,closeFirst){if(autoClose==undefined?curCfg.autoClose:autoClose)destroy();try{(curCfg.handler)(sign)}catch(e){};},resizeWin:setWinSize,setDefaultCfg:function(cfg){return ymPrompt.cfg=ymPrompt.apply({},cfg,ymPrompt.apply({},ymPrompt.cfg,dftCfg));},getButtons:function(){var btns=btnCache||[],btn,rBtn=[];while(btn=btns.shift())rBtn.push($(btn.id));return rBtn;}});ymPrompt.setDefaultCfg();for(var i in _initFn)ymPrompt[i].apply(null,_initFn[i]);addEvent('unload',function(){while(ymPrompt.eventList.length)detachEvent.apply(null,ymPrompt.eventList.shift());},window);})();})();ymPrompt.apply(ymPrompt,{alert:function(){ymPrompt.show(arguments,{icoCls:'ymPrompt_alert',btn:['OK']});},succeedInfo:function(){ymPrompt.show(arguments,{icoCls:'ymPrompt_succeed',btn:['OK']});},errorInfo:function(){ymPrompt.show(arguments,{icoCls:'ymPrompt_error',btn:['OK']});},confirmInfo:function(){ymPrompt.show(arguments,{icoCls:'ymPrompt_confirm',btn:['OK','CANCEL']});},win:function(){ymPrompt.show(arguments);}});