
var userAgent=navigator.userAgent.toLowerCase();var is_opera=userAgent.indexOf('opera')!=-1&&opera.version();var is_moz=(navigator.product=='Gecko')&&userAgent.substr(userAgent.indexOf('firefox')+8,3);var is_ie=(userAgent.indexOf('msie')!=-1&&!is_opera)&&userAgent.substr(userAgent.indexOf('msie')+5,3);var time_close={obj:null}
var dateRemeber={x:0,y:0}
settings={tl:{radius:5},tr:{radius:5},bl:{radius:5},br:{radius:5},antiAlias:true,autoPad:false}
if(!Array.prototype.push){Array.prototype.push=function(){var startLength=this.length;for(var i=0;i<arguments.length;i++)this[startLength+i]=arguments[i];return this.length;}};function G(){var elements=new Array();for(var i=0;i<arguments.length;i++){var element=arguments[i];if(typeof element=='string')element=document.getElementById(element);if(arguments.length==1)return element;elements.push(element);};return elements;};Function.prototype.bindAsEventListener=function(object){var __method=this;return function(event){__method.call(object,event||window.event);};};Object.extend=function(destination,source){for(property in source){destination[property]=source[property];};return destination;};if(!window.Event){var Event=new Object();};Object.extend(Event,{observers:false,element:function(event){return event.target||event.srcElement;},isLeftClick:function(event){return(((event.which)&&(event.which==1))||((event.button)&&(event.button==1)));},pointerX:function(event){return(event.pageX||(event.clientX+(document.documentElement.scrollLeft||document.body.scrollLeft))+dateRemeber.x);},pointerY:function(event){return(event.pageY||(event.clientY+(document.documentElement.scrollTop)))+dateRemeber.y;},stop:function(event){if(event.preventDefault){event.preventDefault();event.stopPropagation();}else{event.returnValue=false;event.cancelBubble=true;};},findElement:function(event,tagName){var element=Event.element(event);while(element.parentNode&&(!element.tagName||(element.tagName.toUpperCase()!=tagName.toUpperCase())))element=element.parentNode;return element;},_observeAndCache:function(element,name,observer,useCapture){if(!this.observers)this.observers=[];if(element!=null&&element.addEventListener){this.observers.push([element,name,observer,useCapture]);element.addEventListener(name,observer,useCapture);}else if(element!=null&&element.attachEvent){this.observers.push([element,name,observer,useCapture]);element.attachEvent('on'+name,observer);};},unloadCache:function(){if(!Event.observers)return;for(var i=0;i<Event.observers.length;i++){Event.stopObserving.apply(this,Event.observers[i]);Event.observers[i][0]=null;};Event.observers=false;},observe:function(element,name,observer,useCapture){var element=G(element);useCapture=useCapture||false;if(name=='keypress'&&(navigator.appVersion.match(/Konqueror|Safari|KHTML/)||element.attachEvent))name='keydown';this._observeAndCache(element,name,observer,useCapture);},stopObserving:function(element,name,observer,useCapture){var element=G(element);useCapture=useCapture||false;if(name=='keypress'&&(navigator.appVersion.match(/Konqueror|Safari|KHTML/)||element.detachEvent))name='keydown';if(element.removeEventListener){element.removeEventListener(name,observer,useCapture);}
else if(element.detachEvent){element.detachEvent('on'+name,observer);};}});Event.observe(window,'unload',Event.unloadCache,false);var PUClass=function(){var _class=function(){this.initialize.apply(this,arguments);};for(i=0;i<arguments.length;i++){superClass=arguments[i];for(member in superClass.prototype){_class.prototype[member]=superClass.prototype[member];};};_class.child=function(){return new PUClass(this);};_class.extend=function(f){for(property in f){_class.prototype[property]=f[property];};};return _class;};function space(flag){if(flag=="begin"){var ele=document.getElementById("ft");if(typeof(ele)!="undefined"&&ele!=null)ele.id="ft_popup";ele=document.getElementById("usrbar");if(typeof(ele)!="undefined"&&ele!=null)ele.id="usrbar_popup";}else if(flag=="end"){var ele=document.getElementById("ft_popup");if(typeof(ele)!="undefined"&&ele!=null)ele.id="ft";ele=document.getElementById("usrbar_popup");if(typeof(ele)!="undefined"&&ele!=null)ele.id="usrbar";};};var Popup=new PUClass();Popup.prototype={iframeIdName:'ifr_popup',initialize:function(config){this.config=Object.extend({contentType:1,isHaveTitle:true,scrollType:'no',isBackgroundCanClick:false,isSupportDraging:true,isShowShadow:true,isReloadOnClose:true,width:400,height:300,haveclose:true,BackgroundClickClose:false,BackgroundScroll:false},config||{});this.info={shadowWidth:4,title:"",contentUrl:"",contentHtml:"",callBack:null,parameter:null,confirmCon:"",alertCon:"",someHiddenTag:"select,object,embed",someHiddenEle:"",overlay:0,coverOpacity:40,time_out:0,time_out_handle:null};this.color={cColor:"#EEEEEE",bColor:"#FFFFFF",tColor:"#FF8814",wColor:"#FFFFFF"};this.dropClass=null;this.someToHidden=[];if(!this.config.isHaveTitle)this.config.isSupportDraging=false;this.iniBuild();},setContent:function(arrt,val){if(val!=''){switch(arrt){case'width':this.config.width=val;break;case'height':this.config.height=val;break;case'title':this.info.title=val;break;case'contentUrl':this.info.contentUrl=val;break;case'contentHtml':this.info.contentHtml=val;break;case'callBack':this.info.callBack=val;break;case'parameter':this.info.parameter=val;break;case'confirmCon':this.info.confirmCon=val;break;case'alertCon':this.info.alertCon=val;break;case'someHiddenTag':this.info.someHiddenTag=val;break;case'someHiddenEle':this.info.someHiddenEle=val;break;case'overlay':this.info.overlay=val;break;case'time_out':this.info.time_out=val;break;case'fixTop':this.info.fixTop=val;break;};};},iniBuild:function(){G('dialogCase')?G('dialogCase').parentNode.removeChild(G('dialogCase')):function(){};var oDiv=document.createElement('span');oDiv.id='dialogCase';document.body.appendChild(oDiv);},build:function(){time_close.obj=this;var baseZIndex=10001+this.info.overlay*10;var showZIndex=baseZIndex+2;this.iframeIdName='ifr_popup'+this.info.overlay;var path=static_url_prefix+"/images/";var titleimg=static_url_prefix+"/images/titles.gif"
var titleshowimg="";if(this.config.contentType==3)
{titleshowimg=static_url_prefix+"/images/confirm.gif";}
else if(this.config.contentType==4)
{titleshowimg=static_url_prefix+"/images/titlel.gif";}else
{titleshowimg=static_url_prefix+"/images/titlel.gif";}
var close=this.config.haveclose?'<input type="image" id="dialogBoxClose" src="'+path+'close.gif" border="0" width="16px" height="16px" align="absmiddle" title="关闭"/>':"";var cB='filter: alpha(opacity='+this.info.coverOpacity+');opacity:'+this.info.coverOpacity/100+';';var bodywidth=document.documentElement.clientWidth;var cover='<div id="dialogBoxBG" style="position:absolute;top:0px;left:0px;width:'+bodywidth+'px;height:100%;z-index:'+baseZIndex+';'+cB+'background-color:'+this.color.cColor+';display:none;"></div>';if(this.config.isHaveTitle){var mainBox='<div id="dialogBox" style="border:1px solid '+this.color.tColor+';display:none;z-index:'+showZIndex+';position:relative;width:'+this.config.width+'px; background-image:url('+titleimg+'); background-repeat:repeat-x"><table width="100%" border="0" cellpadding="0" cellspacing="0">';mainBox+='<tr height="20"><td><table style="height:20px;" width="100%; border="0" cellpadding="0" cellspacing="0" ><tr>'+'<td width="20" height="20" align="center"><img src="'+titleshowimg+'" /></td><td id="dialogBoxTitle" style="color:'+this.color.wColor+';font-size:14px;font-weight:bold;">'+this.info.title+'&nbsp;</td>'+'<td id="dialogClose" width="20" align="right" valign="middle">'+close+'</td><td width="6"></td></tr></table></td></tr>';}else{var mainBox='<div id="dialogBox" style="display:none;z-index:'+showZIndex+';position:relative;width:'+this.config.width+'px;"><table width="100%" border="0" cellpadding="0" cellspacing="0">';}
mainBox+='<tr style="valign="top" bgcolor="'+this.color.bColor+'"><td id="dialogBody" style="position:relative;"></td></tr></table></div>'+'<div id="dialogBoxShadow" style="display:none;z-index:'+baseZIndex+'"></div>';if(!this.config.isBackgroundCanClick){G('dialogCase').innerHTML=cover+mainBox;G('dialogBoxBG').style.height=document.body.scrollHeight+"px";if(this.config.BackgroundClickClose)
Event.observe(G('dialogBoxBG'),"click",this.reset.bindAsEventListener(this),false);}else G('dialogCase').innerHTML=mainBox;Event.observe(G('dialogBoxClose'),"click",this.reset.bindAsEventListener(this),false);if(this.config.isSupportDraging){dropClass=new Dragdrop(this.config.width,this.config.height,this.info.shadowWidth,this.config.isSupportDraging,this.config.contentType);G("dialogBoxTitle").style.cursor="move";};if(this.config.BackgroundScroll){document.body.style.overflow="hidden";document.body.scroll="no";}
this.lastBuild();},lastBuild:function()
{var okbuttonimg=static_url_prefix+"/images/okbutton.gif";var cancelbuttonimg=static_url_prefix+"/images/cancelbutton.gif";var confirm='<div style="width:100%;height:100%;text-align:center;"><div style="margin:20px 20px 0 20px;font-size:14px;line-height:16px;color:#000000;" id="_con_msg">'+this.info.confirmCon+'</div><div style="margin:20px;"><input id="dialogOk" type="image" src="'+okbuttonimg+'" />&nbsp;<input id="dialogCancel" type="image" src="'+cancelbuttonimg+'" /></div></div>';var alert='<div style="width:100%;height:100%;text-align:center;"><div style="margin:20px 20px 0 20px;font-size:14px;line-height:16px;color:#000000;">'+this.info.alertCon+'</div><div style="margin:20px;"><input id="dialogYES" type="image" src='+okbuttonimg+' /></div></div>';var baseZIndex=10001+this.info.overlay*10;var coverIfZIndex=baseZIndex+4;if(this.config.contentType==1){var openIframe="<iframe width='100%' style='height:"+this.config.height+"px' name='"+this.iframeIdName+"' id='"+this.iframeIdName+"' src='"+this.info.contentUrl+"' frameborder='0' scrolling='"+this.config.scrollType+"'></iframe>";var coverIframe="<div id='iframeBG' style='position:absolute;top:0px;left:0px;width:1px;height:1px;z-index:"+coverIfZIndex+";filter: alpha(opacity=00);opacity:0.00;background-color:#ffffff;'><div>";G("dialogBody").innerHTML=openIframe+coverIframe;}else if(this.config.contentType==2){G("dialogBody").innerHTML=this.info.contentHtml;}else if(this.config.contentType==3){G("dialogBody").innerHTML=confirm;Event.observe(G('dialogOk'),"click",this.forCallback.bindAsEventListener(this),false);Event.observe(G('dialogCancel'),"click",this.close.bindAsEventListener(this),false);}else if(this.config.contentType==4){G("dialogBody").innerHTML=alert;Event.observe(G('dialogYES'),"click",this.close.bindAsEventListener(this),false);};},reBuild:function(){if(this.info.time_out!=0)
{if(this.info.time_out_handle!=null)
{clearTimeout(this.info.time_out_handle);}
var times=Math.ceil(this.info.time_out);this.info.time_out_handle=setTimeout("time_close.obj.reset()",times);}
this.lastBuild();},show:function(){if(this.info.time_out!=0)
{if(this.info.time_out_handle!=null)
{clearTimeout(this.info.time_out_handle);}
var times=Math.ceil(this.info.time_out);this.info.time_out_handle=setTimeout("time_close.obj.close()",times);}
this.hiddenSome();this.middle();if(this.config.isShowShadow)this.shadow();if(this.config.isHaveTitle){var divObj=G("dialogBox");var cornersObj=new curvyCorners(settings,divObj);cornersObj.applyCornersToAll();}},forCallback:function(){if(this.info.callBack!=null)
{return this.info.callBack(this.info.parameter,this);}},shadow:function(){var oShadow=G('dialogBoxShadow');var oDialog=G('dialogBox');oShadow['style']['position']="absolute";oShadow['style']['background']="#000";oShadow['style']['display']="";oShadow['style']['opacity']="0.2";oShadow['style']['filter']="alpha(opacity=20)";oShadow['style']['top']=oDialog.offsetTop+this.info.shadowWidth+"px";oShadow['style']['left']=oDialog.offsetLeft+this.info.shadowWidth+"px";oShadow['style']['width']=Math.ceil(oDialog.offsetWidth)+Math.ceil(1)+"px";oShadow['style']['height']=Math.ceil(oDialog.offsetHeight)+Math.ceil(2)+"px";},set_loadingmsg:function(msg)
{try{G("_con_msg").innerHTML=msg
G("dialogOK").disabled=true;G("dialogCancel").disabled=true;}
catch(e){}},set_text:function(msg)
{G("_con_msg").innerHTML=msg;},set_loading_end:function(msg)
{try{G("_con_msg").innerHTML=msg
G("dialogOK").disabled=false;G("dialogCancel").disabled=false;this.info.callBack=null;}
catch(e){}},onloading_start:function()
{var div=document.createElement("div");div.setAttribute("id","loading_div");var oShadow=G('dialogBoxShadow');var oDialog=G('dialogBox');oShadow.style.display='none';oShadow.parentNode.appendChild(div);div['style']['position']="absolute";div['style']['display']="";div['style']['opacity']="0.8";div['style']['filter']="alpha(opacity=80)";div['style']['top']=oDialog.offsetTop+this.info.shadowWidth+"px";div['style']['left']=oDialog.offsetLeft+this.info.shadowWidth+"px";div['style']['width']=oDialog.offsetWidth+"px";div['style']['height']="auto";div['style']['color']="#000000";div['style']['zIndex']="90000";div.setAttribute("align","center");oDialog.style.display='none';var divs=document.createElement("div");div.appendChild(divs);divs.innerHTML="<img src='"+static_url_prefix+"/images/loading3.gif'><br />图片上传中....";},onloading_end:function()
{var oShadow=G('dialogBoxShadow');var oDialog=G('dialogBox');try
{var div=document.getElementById("loading_div");if(typeof div!="undefined")
{oShadow.parentNode.appendChild(div);}}catch(e){}
oShadow.style.display='';oDialog.style.display='';},middle:function(){if(!this.config.isBackgroundCanClick)G('dialogBoxBG').style.display='';var oDialog=G('dialogBox');oDialog['style']['position']="absolute";oDialog['style']['display']='';var sClientWidth=document.documentElement.clientWidth;var sClientHeight=document.documentElement.clientHeight;var sleft=(document.documentElement.clientWidth/2)-(oDialog.offsetWidth/2);if(this.config.fixTop){var sTop=this.config.fixTop;}else{var sScrollTop=((is_ie&&is_ie<7)?document.documentElement.scrollTop:(document.documentElement.scrollTop||document.body.scrollTop));var iTop=-80+(sClientHeight/2+sScrollTop)-(oDialog.offsetHeight/2);var sTop=iTop>0?iTop:(sClientHeight/2+sScrollTop)-(oDialog.offsetHeight/2);if(sTop<1)sTop="20";}
if(sleft<1)sleft="20";oDialog['style']['left']=sleft+"px";oDialog['style']['top']=sTop+"px";},reset:function(){if(this.config.isReloadOnClose){if(top.location.href.indexOf('?')>-1){if(top.location.href.indexOf('_m=1')==-1)
top.location.href=top.location.href+'&_m=1';else
top.location.href=top.location.href;}else{top.location.href=top.location.href+'?_m=1';}};this.close();},close:function(){if(this.info.time_out_handle!=null)
{clearTimeout(this.info.time_out_handle);}
this.onloading_end();var oShadow=G('dialogBoxShadow');G('dialogBox').style.display='none';document.body.style.overflow="";document.body.scroll="";dateRemeber={x:0,y:0};if(!this.config.isBackgroundCanClick)G('dialogBoxBG').style.display='none';if(this.config.isShowShadow)G('dialogBoxShadow').style.display='none';G('dialogBody').innerHTML='';oShadow.innerHTML="";this.showSome();},hiddenSome:function(){var tag=this.info.someHiddenTag.split(",");if(tag.length==1&&tag[0]=="")tag.length=0;for(var i=0;i<tag.length;i++){this.hiddenTag(tag[i]);};var ids=this.info.someHiddenEle.split(",");if(ids.length==1&&ids[0]=="")ids.length=0;for(var i=0;i<ids.length;i++){this.hiddenEle(ids[i]);};space("begin");},hiddenTag:function(tagName){var ele=document.getElementsByTagName(tagName);if(ele!=null){for(var i=0;i<ele.length;i++){if(ele[i].style.display!="none"&&ele[i].style.visibility!='hidden'){ele[i].style.visibility='hidden';this.someToHidden.push(ele[i]);};};};},hiddenEle:function(id){var ele=document.getElementById(id);if(typeof(ele)!="undefined"&&ele!=null){ele.style.visibility='hidden';this.someToHidden.push(ele);}},showSome:function(){for(var i=0;i<this.someToHidden.length;i++){this.someToHidden[i].style.visibility='visible';};space("end");}};var Dragdrop=new PUClass();Dragdrop.prototype={initialize:function(width,height,shadowWidth,showShadow,contentType){this.dragData=null;this.dragDataIn=null;this.backData=null;this.width=width;this.height=height;this.shadowWidth=shadowWidth;this.showShadow=showShadow;this.contentType=contentType;this.IsDraging=false;this.oObj=G('dialogBox');Event.observe(G('dialogBoxTitle'),"mousedown",this.moveStart.bindAsEventListener(this),false);},moveStart:function(event){this.IsDraging=true;if(this.contentType==1){G("iframeBG").style.display="";G("iframeBG").style.width=this.width;G("iframeBG").style.height=this.height;};Event.observe(document,"mousemove",this.mousemove.bindAsEventListener(this),false);Event.observe(document,"mouseup",this.mouseup.bindAsEventListener(this),false);if(!document.all){try{objIframe=document.getElementsByTagName("iframe");for(var i=0;i<objIframe.length;i++){if(objIframe[i].id.indexOf(Popup.prototype.iframeIdName)<0)
continue;Event.observe(objIframe[i].contentWindow.document,"mousemove",this.mousemove.bindAsEventListener(this),false);Event.observe(objIframe[i].contentWindow.document,"mouseover",this.iframeMouseOver.bindAsEventListener(this),false);Event.observe(objIframe[i].contentWindow.document,"mouseout",this.iframeMouseOut.bindAsEventListener(this),false);}}catch(e){}}
Event.observe(document,"selectstart",this.returnFalse,false);this.dragData={x:Event.pointerX(event),y:Event.pointerY(event)};this.backData={x:parseInt(this.oObj.style.left),y:parseInt(this.oObj.style.top)};},iframeMouseOver:function(){dateRemeber={x:-1000,y:-1000};},iframeMouseOut:function(){dateRemeber={x:0,y:0};},mousemove:function(event){if(!this.IsDraging)return;var iLeft=Event.pointerX(event)-this.dragData["x"]+parseInt(this.oObj.style.left);var iTop=Event.pointerY(event)-this.dragData["y"]+parseInt(this.oObj.style.top);if(this.dragData["y"]<parseInt(this.oObj.style.top))
iTop=iTop-12;else if(this.dragData["y"]>parseInt(this.oObj.style.top)+25)
iTop=iTop+12;this.oObj.style.left=iLeft+"px";this.oObj.style.top=iTop+"px";if(this.showShadow){G('dialogBoxShadow').style.left=iLeft+this.shadowWidth+"px";G('dialogBoxShadow').style.top=iTop+this.shadowWidth+"px";};this.dragData={x:Event.pointerX(event),y:Event.pointerY(event)};document.body.style.cursor="move";},mouseup:function(event){if(!this.IsDraging)return;if(this.contentType==1)G("iframeBG").style.display="none";document.onmousemove=null;document.onmouseup=null;var mousX=Event.pointerX(event)-(document.documentElement.scrollLeft||document.body.scrollLeft);var mousY=Event.pointerY(event)-(document.documentElement.scrollTop);if(mousX<1||mousY<1||mousX>document.body.clientWidth||mousY>document.body.clientHeight){this.oObj.style.left=this.backData["x"];this.oObj.style.top=this.backData["y"];if(this.showShadow){G('dialogBoxShadow').style.left=this.backData.x+this.shadowWidth;G('dialogBoxShadow').style.top=this.backData.y+this.shadowWidth;};};this.IsDraging=false;document.body.style.cursor="";Event.stopObserving(document,"selectstart",this.returnFalse,false);},returnFalse:function(){return false;}};