perfUI.widgets.panel=function(A,K,F){var C=YAHOO.util.Dom;var H=perfUI.util.addEl;var L=YAHOO.util.Event;var Q=null;var D=null;var E=null;var G=null;var J=null;var M=null;var I=null;var O=null;var N=10;var P=false;var B=false;this.container=A||null;this.width=K||"auto";this.height=F||"auto";this.panelCss="";this.elementCss="yui-panel";this.headerCss="hd";this.bodyCss="bd";this.footerCss="ft";this.modal=true;this.afterRenderComplete=new YAHOO.util.CustomEvent("afterRenderComplete",this);this.onShowEvent=new YAHOO.util.CustomEvent("onShowEvent",this);this.onHideEvent=new YAHOO.util.CustomEvent("onHideEvent",this);this.afterRenderComplete.subscribe(function(){B=true},this);this.isRendered=function(){return B};this.setMask=function(R){Q=R};this.getMask=function(){return Q};this.setElement=function(R){D=R};this.getElement=function(){return D};this.setHeader=function(R){if(!R||(typeof R=="string"&&R.trim().length==0)){M=""}else{E=R}};this.setDraggable=function(R){R=(R==null?true:R);if(!this.isRendered()){P=R}else{if(R){if(this.getHeader()){if(!this.dragDrop){this.dragDrop=new YAHOO.util.DD(this.container)}this.dragDrop.setHandleElId(this.getHeader())}}else{if(this.dragDrop&&this.getHeader()){this.dragDrop.unreg()}}}};this.getHeader=function(){return E};this.setHeaderTemplate=function(R){M=R};this.getHeaderTemplate=function(){return M};this.setBodyTemplate=function(R){I=R};this.getBodyTemplate=function(){return I};this.setFooterTemplate=function(R){O=R};this.getFooterTemplate=function(){return O};this.setBody=function(R){if(!R||(typeof R=="string"&&R.trim().length==0)){I=""}else{G=R}};this.getBody=function(){return G};this.setFooter=function(R){if(!R||(typeof R=="string"&&R.trim().length==0)){O=""}else{J=R}};this.getFooter=function(){return J};this.isDraggable=function(){return P};this.makeModal=function(){var R=this.getMask();var S=this.getElement();C.setStyle(this.container,"position","absolute");if(!R){var R=new perfUI.widgets.panelMask();this.setMask(R);R.stack(this.container)}var T=function(){var U=this.getMask();if(U){U.destroy()}U=null}};this.center=function(){var U=this.container;var V=U.offsetWidth,T=U.offsetHeight,S=C.getViewportWidth(),W=C.getViewportHeight(),R,X;if(V<S){R=(S/2)-(V/2)+C.getDocumentScrollLeft()}else{R=N+C.getDocumentScrollLeft()}if(T<W){X=(W/2)-(T/2)+C.getDocumentScrollTop()}else{X=N+C.getDocumentScrollTop()}C.setXY(U,[parseInt(R,10),parseInt(X,10)])}};perfUI.widgets.panel.prototype.render=function(){var H=perfUI.util.addEl;var G=this.getHeaderTemplate();var F=this.getBodyTemplate();var B=this.getFooterTemplate();var E=this.getElement();if(!E){E=H(this.container,"div",{"class":this.elementCss});E.style.display="none";E.style.width=this.width;this.setElement(E);if(this.getHeader()){E.appendChild(this.getHeader())}else{if(G!=null){var C=H(E,"div",{"class":this.headerCss,"innerHTML":G});this.setHeader(C)}}if(this.getHeader()==null&&this.isDraggable()){var C=H(E,"div",{"class":this.headerCss,"innerHTML":"&nbsp;","style":"background-color:#023F8F;width:100%"});this.setHeader(C)}if(this.isDraggable()){this.dragDrop=new YAHOO.util.DD(this.container);this.dragDrop.setHandleElId(this.getHeader())}if(this.getBody()){E.appendChild(this.getBody())}else{if(F!=null){var A=H(E,"div",{"class":this.bodyCss,"innerHTML":F});this.setBody(A)}}if(this.getFooter()){E.appendChild(this.getFooter())}else{if(B!=null){var D=H(E,"div",{"class":this.footerCss,"innerHTML":B});this.setFooter(D)}}if(this.modal){this.makeModal()}this.afterRenderComplete.fire()}};perfUI.widgets.panel.prototype.hide=function(){var A=this.getMask();if(A){A.hide()}var B=this.getElement();B.style.display="none";this.onHideEvent.fire()};perfUI.widgets.panel.prototype.show=function(){this.center();var A=this.getMask();if(A){A.show()}var B=this.getElement();B.style.display="block";B.style.visibility="inherit";this.onShowEvent.fire()};perfUI.widgets.panelMask=function(){var B=YAHOO.util.Dom;var E=perfUI.util.addEl;var A=null;var D="mask";var C="masked";this.useOpaqueEmbed=true;this.getElement=function(){return A};this.setOpaqueEmbed=function(G){if(!G){G=document.body}var H=G.getElementsByTagName("embed");for(var F=0;F<H.length;F++){H[F].setAttribute("wmode","opaque")}var I=G.getElementsByTagName("object");for(var F=0;F<I.length;F++){if(!B.hasClass(I[F],"hide-object-tag")){B.addClass(I[F],"hide-object-tag")}}};this.showObjectTags=function(G){if(!G){G=document.body}var H=G.getElementsByTagName("object");for(var F=0;F<H.length;F++){B.removeClass(H[F],"hide-object-tag")}};this.hide=function(){A.style.display="none";B.removeClass(document.body,C);this.showObjectTags()};this.show=function(){if(this.useOpaqueEmbed){this.setOpaqueEmbed()}B.addClass(document.body,C);this.size();A.style.display="block"};this.size=function(){A.style.height=B.getDocumentHeight()+"px";A.style.width=B.getDocumentWidth()+"px";A.innerHTML="";this.divToMask(A)};this.stack=function(G){var H=B.getStyle(G,"zIndex");var F=B.getStyle(A,"zIndex");if(YAHOO.lang.isUndefined(H)||isNaN(H)||H<=0){H=999;B.setStyle(G,"zIndex",String(H))}if(YAHOO.lang.isUndefined(F)||isNaN(F)){F=998;B.setStyle(A,"zIndex",String(F))}if(H<F){B.setStyle(G,"zIndex",String(F+1))}else{B.setStyle(A,"zIndex",String(H-1))}};this.destroy=function(){document.body.removeChild(A,true)};this.init=function(){var F=null;F=document.createElement("div");F.innerHTML="&#160;";A=F.cloneNode(true);this.divToMask(A);document.body.insertBefore(A,document.body.firstChild);if(YAHOO.env.ua.gecko&&this.platform=="mac"){B.addClass(A,"block-scrollbars")}YAHOO.util.Event.addListener(window,"resize",this.size,this,true)};this.divToMask=function(K){var J,I,H;var F=document.body.scrollWidth;F=F>2000?2000:F;var G=document.body.scrollHeight;K.style.position="absolute";K.style.top="0";K.style.left="0";if(YAHOO.env.ua.ie==0){K.style.opacity="0.7";K.style.backgroundColor="black"}else{K.style.overflow="hidden";for(I=0;I<F;I+=500){for(H=0;H<G;H+=500){if(YAHOO.env.ua.ie>=7){J=K.appendChild(document.createElement("IMG"));J.src="/images/v3/dov.png"}if(YAHOO.env.ua.ie==6){J=K.appendChild(document.createElement("DIV"));J.style.filter="progid:DXImageTransform.Microsoft.AlphaImageLoader(src='/images/v3/dov.png',sizingMethod='scale')"}J.style.position="absolute";J.style.top=H+"px";J.style.left=I+"px";J.style.height="500px";J.style.width="500px"}}}};this.init()};perfUI.widgets.modalEditor=function(B,A,F){perfUI.widgets.modalEditor.superclass.constructor.call(this,B,A,F);var C=this;var H=perfUI.util.addEl;var E=YAHOO.util.Dom;var D=null;var G=function(){C.buildEditorFooter();C.afterRenderComplete.fire()};this.editorPreviewContainer=null;this.editorWidth=A?(A-20):500;this.editorHeight=F?(F-70):365;this.onSubmitContent=new YAHOO.util.CustomEvent("onSubmitContent",this);this.getEditor=function(){return D};this.setEditor=function(I){D=I};this.hideEditor=function(){var I=this.getEditor();if(I!=null){I.setContent("");I.hideAll()}};this.showEditor=function(){var I=this.getEditor();if(I!=null){I.show()}};this.show=function(){perfUI.widgets.modalEditor.superclass.show.call(this);this.showEditor();this.center()};this.hide=function(){this.hideEditor();perfUI.widgets.modalEditor.superclass.hide.call(this)};this.buildEditorFooter=function(){var Q=this.getBody();var P=this.getFooter();P.innerHTML="";var U=this.getEditor();var R=U.getContainer();R.style.display="block";var N=this.editorPreviewContainer;N.style.display="none";var T=H(P,"center");var J=perfTranslator.getValue(320);var K=H(T,"button",{"class":"buttonnew","value":(J.trim().length>0?J:"Submit")});var I=function(){M();this.submitContent()};YAHOO.util.Event.addListener(K,"click",I,this,true);var S=perfTranslator.getValue(701);var O=H(T,"button",{"class":"buttonnew","value":(S.trim().length>0?S:"Cancel")});YAHOO.util.Event.addListener(O,"click",this.hide,this,true);var L=perfTranslator.getValue(434);var W=H(T,"a",{"innerHTML":(L.trim().length>0?L:"Preview")});PERF.makeLink(W);var V=function(){var Y=C.getContent();var a={url:"/api/callna.asp",params:"?function=CustomEncode"};var Z=function(c){};var X=function(c){var d=c.responseXML;var h="";try{h=d.getElementsByTagName("response")[0].childNodes[0].nodeValue}catch(g){}N.innerHTML=h;var f=perfTranslator.getValue(784);O.value=f.trim().length>0?f:"Edit";YAHOO.util.Event.removeListener(O,"click");YAHOO.util.Event.addListener(O,"click",M);W.style.display="none";R.style.display="none";N.style.display="block"};var b={success:X,failure:Z,scope:C};Y="html="+Url.encode(Y);YAHOO.util.Connect.asyncRequest("POST",a.url+a.params,b,Y)};var M=function(){O.value=S.trim().length>0?S:"Cancel";YAHOO.util.Event.addListener(O,"click",C.hide,C,true);W.style.display="inline";N.style.display="none";R.style.display="block"};YAHOO.util.Event.addListener(W,"click",V,this,true)};this.getContent=function(){var I=this.getEditor();if(I){return I.getContent({format:"raw"})}};this.setContent=function(I){var J=this.getEditor();if(J){J.setContent(I,{format:"raw"})}};this.render=function(){var I=this.getEditor();if(I!=null){I.render()}};this.init=function(){if(!E.hasClass(this.container,"postCommentEditor")){E.addClass(this.container,"postCommentEditor")}if(!E.hasClass(document.body,"yui-skin-sam")){E.addClass(document.body,"yui-skin-sam")}this.setBody();this.setFooter();perfUI.widgets.modalEditor.superclass.render.call(this);this.initPerfEditor()};this.initPerfEditor=function(){var L=this.getBody();var K=H(L,"textarea",{"id":"perfEditor"});var I=String(this.width).indexOf("px")>0?this.width.substr(0,this.width.indexOf("px")):this.width;var J=new perfUI.widgets.perfEditor(K.id,null,Number(this.editorWidth),this.editorHeight);this.setEditor(J);J.onInit.add(G);this.editorPreviewContainer=H(L,"div");this.editorPreviewContainer.style.display="none";this.editorPreviewContainer.className="previewPost"};this.init()};YAHOO.extend(perfUI.widgets.modalEditor,perfUI.widgets.panel);perfUI.widgets.modalEditor.prototype.submitContent=function(){this.onSubmitContent.fire()}
