/*
 * ux.ManagedIFrame for ExtJS Library 3.1+
 * Copyright(c) 2008-2009 Active Group, Inc.
 * licensing@theactivegroup.com
 * http://licensing.theactivegroup.com
 */
Ext.namespace("Ext.ux.plugin");Ext.onReady(function(){var a=Ext.util.CSS;if(a){a.getRule(".x-hide-nosize")||a.createStyleSheet(".x-hide-nosize{height:0px!important;width:0px!important;border:none!important;zoom:1;}.x-hide-nosize * {height:0px!important;width:0px!important;border:none!important;zoom:1;}");a.refreshCache()}});(function(){var h=Ext.Element,b=Ext.lib.Anim,a=h.prototype;var g="visibility",e="display",c="hidden",i="none";var f={};f.El={setDisplayed:function(k){var j=this;j.visibilityCls?(j[k!==false?"removeClass":"addClass"](j.visibilityCls)):a.setDisplayed.call(j,k);return j},isDisplayed:function(){return !(this.hasClass(this.visibilityCls)||this.isStyle(e,i))},fixDisplay:function(){var j=this;a.fixDisplay.call(j);j.visibilityCls&&j.removeClass(j.visibilityCls)},isVisible:function(k){var l=this.visible||(!this.isStyle(g,c)&&(this.visibilityCls?!this.hasClass(this.visibilityCls):!this.isStyle(e,i)));if(k!==true||!l){return l}var n=this.dom.parentNode,j=/^body/i;while(n&&!j.test(n.tagName)){if(!Ext.fly(n,"_isVisible").isVisible()){return false}n=n.parentNode}return true},isStyle:a.isStyle||function(j,k){return this.getStyle(j)==k}};Ext.override(h.Flyweight,f.El);Ext.ux.plugin.VisibilityMode=function(k){Ext.apply(this,k||{});var j=Ext.util.CSS;if(j&&!Ext.isIE&&this.fixMaximizedWindow!==false&&!Ext.ux.plugin.VisibilityMode.MaxWinFixed){j.updateRule(".x-window-maximized-ct","overflow","");Ext.ux.plugin.VisibilityMode.MaxWinFixed=true}};Ext.extend(Ext.ux.plugin.VisibilityMode,Object,{bubble:true,fixMaximizedWindow:true,elements:null,visibilityCls:"x-hide-nosize",hideMode:"nosize",ptype:"uxvismode",init:function(p){var k=this.hideMode||p.hideMode,n=this,j=Ext.Container.prototype.bubble,l=function(){var r=[this.collapseEl,this.actionMode].concat(n.elements||[]);Ext.each(r,function(s){n.extend(this[s]||s)},this);var q={visFixed:true,animCollapse:false,animFloat:false,hideMode:k,defaults:this.defaults||{}};q.defaults.hideMode=k;Ext.apply(this,q);Ext.apply(this.initialConfig||{},q)};p.on("render",function(){if(n.bubble!==false&&this.ownerCt){j.call(this.ownerCt,function(){this.visFixed||this.on("afterlayout",l,this,{single:true})})}l.call(this)},p,{single:true})},extend:function(j,k){j&&Ext.each([].concat(j),function(l){if(l&&l.dom){if("visibilityCls" in l){return}Ext.apply(l,f.El);l.visibilityCls=k||this.visibilityCls}},this);return this}});Ext.preg&&Ext.preg("uxvismode",Ext.ux.plugin.VisibilityMode);Ext.provide&&Ext.provide("uxvismode")})();(function(){var z=Ext.Element,ag,T=Ext.lib.Dom,t=Ext.lib.Anim,C=Ext.EventManager,p=Ext.lib.Event,ac=document,P=function(){},G=Object.prototype,i=G.toString,V="[object HTMLDocument]";if(!Ext.elCache||parseInt(Ext.version.replace(/\./g,""),10)<311){alert("Ext Release "+Ext.version+" is not supported")}Ext._documents={};Ext._documents[Ext.id(document,"_doc")]=Ext.elCache;var Z=T.resolveDocumentCache=function(E,aE){var aC=at(E),aF=Ext.isDocument(aC)?Ext.id(aC):aE,A=Ext._documents[aF]||null,aD,aB;if(!A&&aC&&(aB=aC.parentWindow||aC.defaultView)){if(aD=aB.frameElement){aF=aD.id||aD.name}}return A||Ext._documents[aF]||(aF?Ext._documents[aF]={}:null)},W=T.clearDocumentCache=function(A){delete Ext._documents[A]};z.addMethods||(z.addMethods=function(A){Ext.apply(z.prototype,A||{})});Ext.removeNode=function(aE){var aD=aE?aE.dom||aE:null;if(aD&&aD.tagName!="BODY"){var aB,aC,A=Z(aD),E;if((aC=A[aD.id])&&(aB=aC.el)){if(aB.dom){Ext.enableNestedListenerRemoval?C.purgeElement(aB.dom,true):C.removeAll(aB.dom)}delete A[aD.id];delete aB.dom;delete aB._context;aB=null}(E=aD.parentElement||aD.parentNode)&&E.removeChild(aD);aD=null}};var ai=function(aF,aD){var aE=typeof aF==="function"?aF:function aC(){};var aB=aE._ovl;if(!aB){aB={base:aE};aB[aE.length||0]=aE;aE=function aC(){var aI=arguments.callee._ovl;var aH=aI[arguments.length]||aI.base;return aH&&aH!=arguments.callee?aH.apply(this,arguments):undefined}}var aG=[].concat(aD);for(var E=0,A=aG.length;E<A;++E){aB[aG[E].length]=aG[E]}aE._ovl=aB;var aC=null;return aE};Ext.applyIf(Ext,{overload:ai(ai,[function(A){return ai(null,A)},function(aB,E,A){return aB[E]=ai(aB[E],A)}]),isArray:function(A){return !!A&&i.apply(A)=="[object Array]"},isObject:function(A){return !!A&&typeof A=="object"},isDocument:function(E,A){var aD=E?E.dom||E:null;var aC=i.apply(aD)==V||(aD&&aD.nodeType==9);if(aC&&A){try{aC=!!aD.location}catch(aB){return false}}return aC},isWindow:function(A){var E=A?A.dom||A:null;return E?!!E.navigator||i.apply(E)=="[object Window]":false},isIterable:function(A){if(Ext.isArray(A)||A.callee){return true}if(/NodeList|HTMLCollection/.test(i.call(A))){return true}return((typeof A.nextNode!="undefined"||A.item)&&Ext.isNumber(A.length))},isElement:function(A){return A&&Ext.type(A)=="element"},isEvent:function(A){return i.apply(A)=="[object Event]"||(Ext.isObject(A)&&!Ext.type(o.constructor)&&(window.event&&A.clientX&&A.clientX==window.event.clientX))},isFunction:function(A){return !!A&&typeof A=="function"},isEventSupported:function(aC,aD){var aB={select:"input",change:"input",submit:"form",reset:"form",load:"img",error:"img",abort:"img"},A={},aE=/^on/i,E=function(aH,aG){var aF=Ext.getDom(aG);return(aF?(Ext.isElement(aF)||Ext.isDocument(aF)?aF.nodeName.toLowerCase():aG.self?"#window":aG||"#object"):aG||"div")+":"+aH};return function(aJ,aL){aJ=(aJ||"").replace(aE,"");var aK,aI=false;var aG="on"+aJ;var aF=(aL?aL:aB[aJ])||"div";var aH=E(aJ,aF);if(aH in A){return A[aH]}aK=Ext.isString(aF)?ac.createElement(aF):aL;aI=(!!aK&&(aG in aK));aI||(aI=window.Event&&!!(String(aJ).toUpperCase() in window.Event));if(!aI&&aK){aK.setAttribute&&aK.setAttribute(aG,"return;");aI=Ext.isFunction(aK[aG])}A[aH]=aI;aK=null;return aI}}()});var w=function(A){return z[(A.tagName||"-").toUpperCase()]||z};var ao;function af(A,E){if(!ao){ao=new Ext.Element.Flyweight()}ao.dom=Ext.getDom(A,null,E);return ao}Ext.apply(Ext,{get:z.get=function(aB,aD){if(!aB){return null}Ext.isDocument(aD)||(aD=ac);var E,aG,aF,A=Z(aD);if(typeof aB=="string"){aG=Ext.getDom(aB,null,aD);if(!aG){return null}if(A[aB]&&A[aB].el){E=A[aB].el;E.dom=aG}else{E=z.addToCache(new (w(aG))(aG,null,aD))}return E}else{if(aB instanceof z){A=Z(aB);aB.dom=aB.getDocument().getElementById(aB.id)||aB.dom;if(aB.dom){(A[aB.id]||(A[aB.id]={data:{},events:{}})).el=aB}return aB}else{if(aB.tagName||Ext.isWindow(aB)){A=Z(aB);aF=Ext.id(aB);if(A[aF]&&(E=A[aF].el)){E.dom=aB}else{E=z.addToCache(new (w(aB))(aB,null,aD),null,A);aB.navigator&&(A[aF].skipGC=true)}return E}else{if(Ext.isDocument(aB)){if(!Ext.isDocument(aB,true)){return false}A=Z(aB);if(A[Ext.id(aB)]&&A[aB.id].el){return A[aB.id].el}var aC=function(){};aC.prototype=z.prototype;var aE=new aC();aE.dom=aB;aE.id=Ext.id(aB,"_doc");aE._isDoc=true;z.addToCache(aE,null,A);A[aE.id].skipGC=true;return aE}else{if(aB.isComposite){return aB}else{if(Ext.isArray(aB)){return Ext.get(aD,aD).select(aB)}}}}}}return null},getDom:function(E,A,aD){var aC=aD||ac;if(!E||!aC){return null}if(E.dom){return E.dom}else{if(Ext.isString(E)){var aB=aC.getElementById(E);if(aB&&Ext.isIE&&A){if(E==aB.getAttribute("id")){return aB}else{return null}}return aB}else{return E}}},getBody:function(E){var A=T.getDocument(E)||ac;return Ext.get(A.body||A.documentElement)},getDoc:Ext.overload([Ext.getDoc,function(A){return Ext.get(A,A)}])});z.data=function(E,A,aB){E=z.get(E);if(!E){return null}var aC=Z(E)[E.id].data;if(arguments.length==2){return aC[A]}else{return(aC[A]=aB)}};z.addToCache=function(E,aC,A){aC=aC||E.id;var aB=A||Z(E);aB[aC]={el:E,data:{},events:{}};return E};var ak={},ab=/(-[a-z])/gi,O=function(A,E){return E.charAt(1).toUpperCase()},L=/alpha\(opacity=(.*)\)/i,v=/^\s+|\s+$/g,av=/marginRight/,k=Ext.isIE?"styleFloat":"cssFloat",c=ac.defaultView,aj="visibilityMode",B=z.DISPLAY,s="originalDisplay",H="padding",am="margin",ar="border",S="-left",ay="-right",ad="-top",Y="-bottom",f="-width",ax=Math,I="opacity",h="visibility",a="display",au="hidden",ah="none",x="isClipped",aq="overflow",N="overflow-x",K="overflow-y",R="originalClip",u="x-masked",X="x-masked-relative",r={l:ar+S+f,r:ar+ay+f,t:ar+ad+f,b:ar+Y+f},ap={l:H+S,r:H+ay,t:H+ad,b:H+Y},j={l:am+S,r:am+ay,t:am+ad,b:am+Y},aA=z.data,al=Ext.getDom,F=Ext.get,b=Ext.DomHelper,D=/^(?:scope|delay|buffer|single|stopEvent|preventDefault|stopPropagation|normalized|args|delegate)$/,q=Ext.util.CSS,az=function(E){var A=aA(E,s);if(A===undefined){aA(E,s,A="")}return A},Q=function(E){var A=aA(E,aj);if(A===undefined){aA(E,aj,A=1)}return A};function l(A){return ak[A]||(ak[A]=A=="float"?k:A.replace(ab,O))}z.addMethods({getDocument:function(){return this._context||(this._context=at(this))},remove:function(E,A){var aB=this.dom;this.isMasked()&&this.unmask();if(aB){Ext.removeNode(aB);delete this._context;delete this.dom}},appendChild:function(A,E){return F(A,E||this.getDocument()).appendTo(this)},appendTo:function(A,E){al(A,false,E||this.getDocument()).appendChild(this.dom);return this},insertBefore:function(A,E){(A=al(A,false,E||this.getDocument())).parentNode.insertBefore(this.dom,A);return this},insertAfter:function(A,E){(A=al(A,false,E||this.getDocument())).parentNode.insertBefore(this.dom,A.nextSibling);return this},insertFirst:function(E,A){E=E||{};if(E.nodeType||E.dom||typeof E=="string"){E=al(E);this.dom.insertBefore(E,this.dom.firstChild);return !A?F(E):E}else{return this.createChild(E,this.dom.firstChild,A)}},replace:function(A,E){A=F(A,E||this.getDocument());this.insertBefore(A);A.remove();return this},replaceWith:function(A,aB){var E=this;if(A.nodeType||A.dom||typeof A=="string"){A=al(A,false,aB||E.getDocument());E.dom.parentNode.insertBefore(A,E.dom)}else{A=b.insertBefore(E.dom,A)}var aC=Z(E);Ext.removeNode(E.dom);E.id=Ext.id(E.dom=A);z.addToCache(E.isFlyweight?new (w(E.dom))(E.dom,null,aC):E);return E},insertHtml:function(E,aB,A){var aC=b.insertHtml(E,this.dom,aB);return A?Ext.get(aC,at(aC)):aC},setVisibilityMode:function(A){aA(this.dom,aj,A);return this},setVisible:function(aD,E){var aB=this,aC=aB.dom,A=Q(this.dom)==B;if(!E||!aB.anim){if(A){aB.setDisplayed(aD)}else{aB.fixDisplay();aC.style.visibility=aD?"visible":au}}else{if(aD){aB.setOpacity(0.01);aB.setVisible(true)}aB.anim({opacity:{to:(aD?1:0)}},aB.preanim(arguments,1),null,0.35,"easeIn",function(){if(!aD){aC.style[A?a:h]=(A)?ah:au;Ext.fly(aC).setOpacity(1)}})}return aB},setDisplayed:function(A){if(typeof A=="boolean"){A=A?az(this.dom):ah}this.setStyle(a,A);return this},fixDisplay:function(){var A=this;if(A.isStyle(a,ah)){A.setStyle(h,au);A.setStyle(a,az(this.dom));if(A.isStyle(a,ah)){A.setStyle(a,"block")}}},enableDisplayMode:function(A){this.setVisibilityMode(z.DISPLAY);if(!Ext.isEmpty(A)){aA(this.dom,s,A)}return this},scrollIntoView:function(aB,aE){var aJ=this.getDocument();var aK=Ext.getDom(aB,null,aJ)||Ext.getBody(aJ).dom;var aD=this.dom;var aC=this.getOffsetsTo(aK),aO=this.getScroll(),aG=aC[0]+aO.left,aN=aC[1]+aO.top,aL=aN+aD.offsetHeight,E=aG+aD.offsetWidth;var A=aK.clientHeight;var aH=parseInt(aK.scrollTop,10);var aM=parseInt(aK.scrollLeft,10);var aF=aH+A;var aI=aM+aK.clientWidth;if(aD.offsetHeight>A||aN<aH){aK.scrollTop=aN}else{if(aL>aF){aK.scrollTop=aL-A}}aK.scrollTop=aK.scrollTop;if(aE!==false){if(aD.offsetWidth>aK.clientWidth||aG<aM){aK.scrollLeft=aG}else{if(E>aI){aK.scrollLeft=E-aK.clientWidth}}aK.scrollLeft=aK.scrollLeft}return this},contains:function(A){try{return !A?false:T.isAncestor(this.dom,A.dom?A.dom:A)}catch(E){return false}},getScroll:function(){var aF=this.dom,aE=this.getDocument(),A=aE.body,aB=aE.documentElement,E,aD,aC;if(Ext.isDocument(aF)||aF==A){if(Ext.isIE&&T.docIsStrict(aE)){E=aB.scrollLeft;aD=aB.scrollTop}else{E=window.pageXOffset;aD=window.pageYOffset}aC={left:E||(A?A.scrollLeft:0),top:aD||(A?A.scrollTop:0)}}else{aC={left:aF.scrollLeft,top:aF.scrollTop}}return aC},getStyle:function(){var A=c&&c.getComputedStyle?function E(aH){var aE=!this._isDoc?this.dom:null,aB,aD,aC,aF,aG=Ext.isWebKit,aF;if(!aE||!aE.style){return null}aH=l(aH);if(aG&&av.test(aH)){aF=this.getStyle(a);aE.style.display="inline-block"}aC=(aB=aE.style[aH])?aB:(aD=c.getComputedStyle(aE,""))?aD[aH]:null;if(aG){if(aC=="rgba(0, 0, 0, 0)"){aC="transparent"}else{if(aF){aE.style.display=aF}}}return aC}:function E(aF){var aD=!this._isDoc?this.dom:null,aB,aC;if(!aD||!aD.style){return null}if(aF==I){if(aD.style.filter.match){if(aB=aD.style.filter.match(L)){var aE=parseFloat(aB[1]);if(!isNaN(aE)){return aE?aE/100:0}}}return 1}aF=l(aF);return aD.style[aF]||((aC=aD.currentStyle)?aC[aF]:null)};var E=null;return A}(),setStyle:function(aD,aC){if(this._isDoc||Ext.isDocument(this.dom)){return this}var E,aB,A;if(!Ext.isObject(aD)){E={};E[aD]=aC;aD=E}for(aB in aD){aC=aD[aB];aB==I?this.setOpacity(aC):this.dom.style[l(aB)]=aC}return this},center:function(A){return this.alignTo(A||this.getDocument(),"c-c")},mask:function(E,aE){var aG=this,aC=aG.dom,aF=Ext.DomHelper,aD="ext-el-mask-msg",A,aH;if(aG.getStyle("position")=="static"){aG.addClass(X)}if((A=aA(aC,"maskMsg"))){A.remove()}if((A=aA(aC,"mask"))){A.remove()}aH=aF.append(aC,{cls:"ext-el-mask"},true);aA(aC,"mask",aH);aG.addClass(u);aH.setDisplayed(true);if(typeof E=="string"){var aB=aF.append(aC,{cls:aD,cn:{tag:"div"}},true);aA(aC,"maskMsg",aB);aB.dom.className=aE?aD+" "+aE:aD;aB.dom.firstChild.innerHTML=E;aB.setDisplayed(true);aB.center(aG)}if(Ext.isIE&&!(Ext.isIE7&&Ext.isStrict)&&aG.getStyle("height")=="auto"){aH.setSize(undefined,aG.getHeight())}return aH},unmask:function(){var aB=this,aC=aB.dom,A=aA(aC,"mask"),E=aA(aC,"maskMsg");if(A){if(E){E.remove();aA(aC,"maskMsg",undefined)}A.remove();aA(aC,"mask",undefined)}aB.removeClass([u,X])},isMasked:function(){var A=aA(this.dom,"mask");return A&&A.isVisible()},getCenterXY:function(){return this.getAlignToXY(this.getDocument(),"c-c")},getAnchorXY:function(aD,aI,aN){aD=(aD||"tl").toLowerCase();aN=aN||{};var aH=this,aK=this.getDocument(),E=aH.dom==aK.body||aH.dom==aK,aL=aN.width||E?T.getViewWidth(false,aK):aH.getWidth(),aF=aN.height||E?T.getViewHeight(false,aK):aH.getHeight(),aM,A=Math.round,aB=aH.getXY(),aJ=aH.getScroll(),aG=E?aJ.left:!aI?aB[0]:0,aE=E?aJ.top:!aI?aB[1]:0,aC={c:[A(aL*0.5),A(aF*0.5)],t:[A(aL*0.5),0],l:[0,A(aF*0.5)],r:[aL,A(aF*0.5)],b:[A(aL*0.5),aF],tl:[0,0],bl:[0,aF],br:[aL,aF],tr:[aL,0]};aM=aC[aD];return[aM[0]+aG,aM[1]+aE]},anchorTo:function(E,aE,aB,A,aG,aH){var aF=this,aD=aF.dom;function aC(){af(aD).alignTo(E,aE,aB,A);Ext.callback(aH,af(aD))}Ext.EventManager.onWindowResize(aC,aF);if(!Ext.isEmpty(aG)){Ext.EventManager.on(window,"scroll",aC,aF,{buffer:!isNaN(aG)?aG:50})}aC.call(aF);return aF},getScroll:function(){var aF=this.dom,aE=this.getDocument(),A=aE.body,aB=aE.documentElement,E,aD,aC;if(aF==aE||aF==A){if(Ext.isIE&&T.docIsStrict(aE)){E=aB.scrollLeft;aD=aB.scrollTop}else{E=window.pageXOffset;aD=window.pageYOffset}aC={left:E||(A?A.scrollLeft:0),top:aD||(A?A.scrollTop:0)}}else{aC={left:aF.scrollLeft,top:aF.scrollTop}}return aC},getAlignToXY:function(aC,aO,aP){var a3;aC=Ext.get(aC,a3=this.getDocument());if(!aC||!aC.dom){throw"Element.getAlignToXY with an element that doesn't exist"}aP=aP||[0,0];aO=(aO=="?"?"tl-bl?":(!/-/.test(aO)&&aO!=""?"tl-"+aO:aO||"tl-bl")).toLowerCase();var aY=this,aV=aY.dom,a0,aZ,aH,aG,aJ,aT,aM,aK=T.getViewWidth(false,a3)-10,aU=T.getViewHeight(false,a3)-10,E,aD,aE,aF,aL,aN,aX=a3.documentElement,aI=a3.body,aS=(aX.scrollLeft||aI.scrollLeft||0)+5,aR=(aX.scrollTop||aI.scrollTop||0)+5,aW=false,aB="",A="",aQ=aO.match(/^([a-z]+)-([a-z]+)(\?)?$/);if(!aQ){throw"Element.getAlignToXY with an invalid alignment "+aO}aB=aQ[1];A=aQ[2];aW=!!aQ[3];a0=aY.getAnchorXY(aB,true);aZ=aC.getAnchorXY(A,false);aH=aZ[0]-a0[0]+aP[0];aG=aZ[1]-a0[1]+aP[1];if(aW){aJ=aY.getWidth();aT=aY.getHeight();aM=aC.getRegion();E=aB.charAt(0);aD=aB.charAt(aB.length-1);aE=A.charAt(0);aF=A.charAt(A.length-1);aL=((E=="t"&&aE=="b")||(E=="b"&&aE=="t"));aN=((aD=="r"&&aF=="l")||(aD=="l"&&aF=="r"));if(aH+aJ>aK+aS){aH=aN?aM.left-aJ:aK+aS-aJ}if(aH<aS){aH=aN?aM.right:aS}if(aG+aT>aU+aR){aG=aL?aM.top-aT:aU+aR-aT}if(aG<aR){aG=aL?aM.bottom:aR}}return[aH,aG]},adjustForConstraints:function(aB,A,E){return this.getConstrainToXY(A||this.getDocument(),false,E,aB)||aB},getConstrainToXY:function(E,A,aB,aD){var aC={top:0,left:0,bottom:0,right:0};return function(aF,aS,aH,aJ){var aW=this.getDocument();aF=Ext.get(aF,aW);aH=aH?Ext.applyIf(aH,aC):aC;var aR,aV,aQ=0,aP=0;if(aF.dom==aW.body||aF.dom==aW){aR=T.getViewWidth(false,aW);aV=T.getViewHeight(false,aW)}else{aR=aF.dom.clientWidth;aV=aF.dom.clientHeight;if(!aS){var aO=aF.getXY();aQ=aO[0];aP=aO[1]}}var aN=aF.getScroll();aQ+=aH.left+aN.left;aP+=aH.top+aN.top;aR-=aH.right;aV-=aH.bottom;var aT=aQ+aR;var aE=aP+aV;var aG=aJ||(!aS?this.getXY():[this.getLeft(true),this.getTop(true)]);var aL=aG[0],aK=aG[1];var aM=this.dom.offsetWidth,aU=this.dom.offsetHeight;var aI=false;if((aL+aM)>aT){aL=aT-aM;aI=true}if((aK+aU)>aE){aK=aE-aU;aI=true}if(aL<aQ){aL=aQ;aI=true}if(aK<aP){aK=aP;aI=true}return aI?[aL,aK]:false}}(),getCenterXY:function(){return this.getAlignToXY(Ext.getBody(this.getDocument()),"c-c")},center:function(A){return this.alignTo(A||Ext.getBody(this.getDocument()),"c-c")},findParent:function(aG,aF,E){var aD=this.dom,aC=this.getDocument(),A=aC.body,aE=0,aB;if(Ext.isGecko&&i.call(aD)=="[object XULElement]"){return null}aF=aF||50;if(isNaN(aF)){aB=Ext.getDom(aF,null,aC);aF=Number.MAX_VALUE}while(aD&&aD.nodeType==1&&aE<aF&&aD!=A&&aD!=aB){if(Ext.DomQuery.is(aD,aG)){return E?Ext.get(aD,aC):aD}aE++;aD=aD.parentNode}return null},clip:function(){var A=this,E=A.dom;if(!aA(E,x)){aA(E,x,true);aA(E,R,{o:A.getStyle(aq),x:A.getStyle(N),y:A.getStyle(K)});A.setStyle(aq,au);A.setStyle(N,au);A.setStyle(K,au)}return A},unclip:function(){var A=this,aB=A.dom;if(aA(aB,x)){aA(aB,x,false);var E=aA(aB,R);if(E.o){A.setStyle(aq,E.o)}if(E.x){A.setStyle(N,E.x)}if(E.y){A.setStyle(K,E.y)}}return A},getViewSize:function(){var aB=this.getDocument(),aC=this.dom,A=(aC==aB||aC==aB.body);if(A){var E=Ext.lib.Dom;return{width:E.getViewWidth(),height:E.getViewHeight()}}else{return{width:aC.clientWidth,height:aC.clientHeight}}},getStyleSize:function(){var aD=this,A,aC,aF=this.getDocument(),aG=this.dom,E=(aG==aF||aG==aF.body),aB=aG.style;if(E){var aE=Ext.lib.Dom;return{width:aE.getViewWidth(),height:aE.getViewHeight()}}if(aB.width&&aB.width!="auto"){A=parseFloat(aB.width);if(aD.isBorderBox()){A-=aD.getFrameWidth("lr")}}if(aB.height&&aB.height!="auto"){aC=parseFloat(aB.height);if(aD.isBorderBox()){aC-=aD.getFrameWidth("tb")}}return{width:A||aD.getWidth(true),height:aC||aD.getHeight(true)}}});Ext.isDefined(z.collectorThreadId)&&clearInterval(z.collectorThreadId);function n(){if(!Ext.enableGarbageCollector){clearInterval(z.collectorThreadId)}else{var A,aC,aE,aD,aB=Ext.elCache;for(A in aB){aD=aB[A];if(aD.skipGC){continue}aC=aD.el;aE=aC.dom;if(!aE||!aE.parentNode||(!aE.offsetParent&&!ac.getElementById(A))){if(Ext.enableListenerCollection){Ext.EventManager.removeAll(aE)}delete aB[A]}}if(Ext.isIE){var E={};for(A in aB){E[A]=aB[A]}Ext.elCache=Ext._documents[Ext.id(document)]=E;E=null}}}if(Ext.enableGarbageCollector){z.collectorThreadId=setInterval(n,30000)}Ext.apply(T,{getDocument:function(aB,aC){var aD=null;try{aD=Ext.getDom(aB,null,null)}catch(E){}var A=Ext.isDocument(aD);if(A){if(aC){return Ext.isDocument(aD,aC)?aD:null}return aD}return aD?aD.ownerDocument||aD.document:null},docIsStrict:function(A){return(Ext.isDocument(A)?A:this.getDocument(A)).compatMode=="CSS1Compat"},getViewWidth:Ext.overload([T.getViewWidth||function(A){},function(){return this.getViewWidth(false)},function(A,E){return A?this.getDocumentWidth(E):this.getViewportWidth(E)}]),getViewHeight:Ext.overload([T.getViewHeight||function(A){},function(){return this.getViewHeight(false)},function(A,E){return A?this.getDocumentHeight(E):this.getViewportHeight(E)}]),getDocumentHeight:Ext.overload([T.getDocumentHeight||P,function(A){if(A=this.getDocument(A)){return Math.max(!this.docIsStrict(A)?A.body.scrollHeight:A.documentElement.scrollHeight,this.getViewportHeight(A))}return undefined}]),getDocumentWidth:Ext.overload([T.getDocumentWidth||P,function(A){if(A=this.getDocument(A)){return Math.max(!this.docIsStrict(A)?A.body.scrollWidth:A.documentElement.scrollWidth,this.getViewportWidth(A))}return undefined}]),getViewportHeight:Ext.overload([T.getViewportHeight||P,function(A){if(A=this.getDocument(A)){if(Ext.isIE){return this.docIsStrict(A)?A.documentElement.clientHeight:A.body.clientHeight}else{return A.defaultView.innerHeight}}return undefined}]),getViewportWidth:Ext.overload([T.getViewportWidth||P,function(A){if(A=this.getDocument(A)){return !this.docIsStrict(A)&&!Ext.isOpera?A.body.clientWidth:Ext.isIE?A.documentElement.clientWidth:A.defaultView.innerWidth}return undefined}]),getXY:Ext.overload([T.getXY||P,function(A,aC){A=Ext.getDom(A,null,aC);var aB=this.getDocument(A),E=aB?(aB.body||aB.documentElement):null;if(!A||!E||A==E){return[0,0]}return this.getXY(A)}])});var at=T.getDocument,e=z._flyweights;Ext.fly=z.fly=function(aB,A,aC){var E=null;A=A||"_global";if(aB=Ext.getDom(aB,null,aC)){(E=e[A]=(e[A]||new z.Flyweight())).dom=aB;Ext.isDocument(aB)&&(E._isDoc=true)}return E};var J=function(){};J.prototype=z.prototype;z.Flyweight=function(A){this.dom=A};z.Flyweight.prototype=new J();z.Flyweight.prototype.isFlyweight=true;function g(aB,aD,aG,aC,E,aI){aB=Ext.getDom(aB);if(!aB){return}var A=Ext.get(aB).id,aH=(Z(aB)[A]||{}).events||{},aE;aE=p.on(aB,aD,E);aH[aD]=aH[aD]||[];aH[aD].push([aG,E,aI,aE,aC]);if(aD=="mousewheel"&&aB.addEventListener){var aF=["DOMMouseScroll",E,false];aB.addEventListener.apply(aB,aF);Ext.EventManager.addListener(window,"beforeunload",function(){aB.removeEventListener.apply(aB,aF)})}if(aD=="mousedown"&&Ext.isDocument(aB)){Ext.EventManager.stoppedMouseDownEvent.addListener(E)}}function U(A,E){return function(){var aB=Ext.toArray(arguments);if(E.target==Ext.EventObject.setEvent(aB[0]).target){A.apply(this,aB)}}}function M(E,aB,A){return function(aC){A.delay(aB.buffer,E,null,[new Ext.EventObjectImpl(aC)])}}function an(aD,aC,A,aB,E){return function(aE){Ext.EventManager.removeListener(aC,A,aB,E);aD(aE)}}function aw(E,aB,A){return function(aD){var aC=new Ext.util.DelayedTask(E);(A.tasks||(A.tasks=[])).push(aC);aC.delay(aB.delay||10,E,null,[new Ext.EventObjectImpl(aD)])}}function ae(aE,aD,A,aG,aH){var E=!Ext.isObject(A)?{}:A,aB=Ext.getDom(aE),aC;aG=aG||E.fn;aH=aH||E.scope;if(!aB){throw'Error listening for "'+aD+'". Element "'+aE+"\" doesn't exist."}function aF(aJ){if(!window.Ext){return}aJ=Ext.EventObject.setEvent(aJ);var aI;if(E.delegate){if(!(aI=aJ.getTarget(E.delegate,aB))){return}}else{aI=aJ.target}if(E.stopEvent){aJ.stopEvent()}if(E.preventDefault){aJ.preventDefault()}if(E.stopPropagation){aJ.stopPropagation()}if(E.normalized){aJ=aJ.browserEvent}aG.call(aH||aB,aJ,aI,E)}if(E.target){aF=U(aF,E)}if(E.delay){aF=aw(aF,E,aG)}if(E.single){aF=an(aF,aB,aD,aG,aH)}if(E.buffer){aC=new Ext.util.DelayedTask(aF);aF=M(aF,E,aC)}g(aB,aD,aG,aC,aF,aH);return aF}Ext.apply(C,{addListener:C.on=function(aB,A,aD,aC,E){if(Ext.isObject(A)){var aG=A,aE,aF;for(aE in aG){aF=aG[aE];if(!D.test(aE)){if(Ext.isFunction(aF)){ae(aB,aE,aG,aF,aG.scope)}else{ae(aB,aE,aF)}}}}else{ae(aB,A,E,aD,aC)}},removeListener:C.un=function(aF,aG,aK,aM){var aB=Ext.getDom(aF);aB&&Ext.get(aB);var aL=aB?Z(aB):{},aI=aB&&((aL[aB.id]||{events:{}}).events)[aG]||[],A,aE,aC,aD,E,aH,aJ;for(aE=0,aH=aI.length;aE<aH;aE++){if(Ext.isArray(aJ=aI[aE])&&aJ[0]==aK&&(!aM||aJ[2]==aM)){aJ[4]&&aJ[4].cancel();aD=aK.tasks&&aK.tasks.length;if(aD){while(aD--){aK.tasks[aD].cancel()}delete aK.tasks}A=aJ[1];p.un(aB,aG,p.extAdapter?aJ[3]:A);if(aG=="mousewheel"&&aB.addEventListener&&A){aB.removeEventListener("DOMMouseScroll",A,false)}if(aG=="mousedown"&&aB==ac&&A){Ext.EventManager.stoppedMouseDownEvent.removeListener(A)}aI.splice(aE,1);if(aI.length===0){delete aL[aB.id].events[aG]}for(aD in aL[aB.id].events){return false}aL[aB.id].events={};return false}}},removeAll:function(aB){if(!(aB=Ext.getDom(aB))){return}var E=aB.id,aJ=Z(aB)||{},aK=aJ[E]||{},aI=aK.events||{},aF,aE,aG,aC,aH,aD,A;for(aC in aI){if(aI.hasOwnProperty(aC)){aF=aI[aC];for(aE=0,aG=aF.length;aE<aG;aE++){aH=aF[aE];aH[4]&&aH[4].cancel();if(aH[0].tasks&&(aD=aH[0].tasks.length)){while(aD--){aH[0].tasks[aD].cancel()}delete aH.tasks}A=aH[1];p.un(aB,aC,p.extAdapter?aH[3]:A);if(aB.addEventListener&&A&&aC=="mousewheel"){aB.removeEventListener("DOMMouseScroll",A,false)}if(A&&aB==ac&&aC=="mousedown"){Ext.EventManager.stoppedMouseDownEvent.removeListener(A)}}}}aJ[E]&&(aJ[E].events={})},getListeners:function(aB,E){aB=Ext.getDom(aB);if(!aB){return}var aD=(Ext.get(aB)||{}).id,A=Z(aB),aC=(A[aD]||{}).events||{};return aC[E]||null},purgeElement:function(aB,A,aD){aB=Ext.getDom(aB);var E=aB.id,aG=Z(aB),aH=(aG[E]||{}).events||{},aC,aF,aE;if(aD){if(aH.hasOwnProperty(aD)){aF=aH[aD];for(aC=0,aE=aF.length;aC<aE;aC++){C.removeListener(aB,aD,aF[aC][0])}}}else{C.removeAll(aB)}if(A&&aB&&aB.childNodes){for(aC=0,aE=aB.childNodes.length;aC<aE;aC++){C.purgeElement(aB.childNodes[aC],A,aD)}}}});p.getListeners=function(E,A){return Ext.EventManager.getListeners(E,A)};Ext.provide&&Ext.provide("multidom")})();(function(){var El=Ext.Element,ElFrame,ELD=Ext.lib.Dom,EMPTYFN=function(){},OP=Object.prototype,addListener=function(){var handler;if(window.addEventListener){handler=function F(el,eventName,fn,capture){el.addEventListener(eventName,fn,!!capture)}}else{if(window.attachEvent){handler=function F(el,eventName,fn,capture){el.attachEvent("on"+eventName,fn)}}else{handler=function F(){}}}var F=null;return handler}(),removeListener=function(){var handler;if(window.removeEventListener){handler=function F(el,eventName,fn,capture){el.removeEventListener(eventName,fn,(capture))}}else{if(window.detachEvent){handler=function F(el,eventName,fn){el.detachEvent("on"+eventName,fn)}}else{handler=function F(){}}}var F=null;return handler}();if(typeof ELD.getDocument!="function"){alert("MIF 2.1.1 requires multidom support")}if(!Ext.elCache||parseInt(Ext.version.replace(/\./g,""),10)<311){alert("Ext Release "+Ext.version+" is not supported")}Ext.ns("Ext.ux.ManagedIFrame","Ext.ux.plugin");var MIM,MIF=Ext.ux.ManagedIFrame,MIFC;var frameEvents=["documentloaded","domready","focus","blur","resize","scroll","unload","scroll","exception","message","reset"];var reSynthEvents=new RegExp("^("+frameEvents.join("|")+")","i");Ext.ux.ManagedIFrame.Element=Ext.extend(Ext.Element,{constructor:function(element,forceNew,doc){var d=doc||document;var elCache=ELD.resolveDocumentCache(d);var dom=Ext.getDom(element,false,d);if(!dom||!(/^(iframe|frame)/i).test(dom.tagName)){return null}var id=Ext.id(dom);this.dom=dom;this.id=id;(elCache[id]||(elCache[id]={el:this,events:{},data:{}})).el=this;this.dom.name||(this.dom.name=this.id);if(Ext.isIE){document.frames&&(document.frames[this.dom.name]||(document.frames[this.dom.name]=this.dom))}this.dom.ownerCt=this;MIM.register(this);if(!this._observable){(this._observable=new Ext.util.Observable()).addEvents("documentloaded","domready","exception","resize","message","blur","focus","unload","scroll","reset");this._observable.addEvents("_docready","_docload")}var H=Ext.isIE?"onreadystatechange":"onload";this.dom[H]=this.loadHandler.createDelegate(this);this.dom.onerror=this.loadHandler.createDelegate(this)},destructor:function(){this.dom[Ext.isIE?"onreadystatechange":"onload"]=this.dom.onerror=EMPTYFN;MIM.deRegister(this);this.removeAllListeners();Ext.destroy(this.frameShim,this.DDM);this.hideMask(true);delete this.loadMask;this.reset();this.manager=null;this.dom.ownerCt=null},cleanse:function(forceReclean,deep){if(this.isCleansed&&forceReclean!==true){return this}var d=this.dom,n=d.firstChild,nx;while(d&&n){nx=n.nextSibling;deep&&Ext.fly(n).cleanse(forceReclean,deep);Ext.removeNode(n);n=nx}this.isCleansed=true;return this},src:null,CSS:null,manager:null,disableMessaging:true,domReadyRetries:7500,focusOnLoad:Ext.isIE,eventsFollowFrameLinks:true,_domCache:null,remove:function(){this.destructor.apply(this,arguments);ElFrame.superclass.remove.apply(this,arguments)},getDocument:function(){return this.dom?this.dom.ownerDocument:document},submitAsTarget:function(submitCfg){var opt=submitCfg||{},D=this.getDocument(),form=Ext.getDom(opt.form?opt.form.form||opt.form:null,false,D)||Ext.DomHelper.append(D.body,{tag:"form",cls:"x-hidden x-mif-form",encoding:"multipart/form-data"}),formFly=Ext.fly(form,"_dynaForm"),formState={target:form.target||"",method:form.method||"",encoding:form.encoding||"",enctype:form.enctype||"",action:form.action||""},encoding=opt.encoding||form.encoding,method=opt.method||form.method||"POST";formFly.set({target:this.dom.name,method:method,encoding:encoding,action:opt.url||opt.action||form.action});if(method=="POST"||!!opt.enctype){formFly.set({enctype:opt.enctype||form.enctype||encoding})}var hiddens,hd,ps;if(opt.params&&(ps=Ext.isFunction(opt.params)?opt.params():opt.params)){hiddens=[];Ext.iterate(ps=typeof ps=="string"?Ext.urlDecode(ps,false):ps,function(n,v){Ext.fly(hd=D.createElement("input")).set({type:"hidden",name:n,value:v});form.appendChild(hd);hiddens.push(hd)})}opt.callback&&this._observable.addListener("_docready",opt.callback,opt.scope,{single:true});this._frameAction=true;this._targetURI=location.href;this.showMask();(function(){form.submit();hiddens&&Ext.each(hiddens,Ext.removeNode,Ext);if(formFly.hasClass("x-mif-form")){formFly.remove()}else{formFly.set(formState)}delete El._flyweights._dynaForm;formFly=null;this.hideMask(true)}).defer(100,this);return this},resetUrl:(function(){return Ext.isIE&&Ext.isSecure?Ext.SSL_SECURE_URL:"about:blank"})(),setSrc:function(url,discardUrl,callback,scope){var src=url||this.src||this.resetUrl;var O=this._observable;this._unHook();Ext.isFunction(callback)&&O.addListener("_docload",callback,scope||this,{single:true});this.showMask();(discardUrl!==true)&&(this.src=src);var s=this._targetURI=(Ext.isFunction(src)?src()||"":src);try{this._frameAction=true;this.dom.src=s;this.checkDOM()}catch(ex){O.fireEvent.call(O,"exception",this,ex)}return this},setLocation:function(url,discardUrl,callback,scope){var src=url||this.src||this.resetUrl;var O=this._observable;this._unHook();Ext.isFunction(callback)&&O.addListener("_docload",callback,scope||this,{single:true});this.showMask();var s=this._targetURI=(Ext.isFunction(src)?src()||"":src);if(discardUrl!==true){this.src=src}try{this._frameAction=true;this.getWindow().location.replace(s);this.checkDOM()}catch(ex){O.fireEvent.call(O,"exception",this,ex)}return this},reset:function(src,callback,scope){this._unHook();var loadMaskOff=false,s=src,win=this.getWindow(),O=this._observable;if(this.loadMask){loadMaskOff=this.loadMask.disabled;this.loadMask.disabled=false}this.hideMask(true);if(win){this.isReset=true;var cb=callback;O.addListener("_docload",function(frame){if(this.loadMask){this.loadMask.disabled=loadMaskOff}Ext.isFunction(cb)&&(cb=cb.apply(scope||this,arguments));O.fireEvent("reset",this)},this,{single:true});Ext.isFunction(s)&&(s=src());s=this._targetURI=Ext.isEmpty(s,true)?this.resetUrl:s;win.location?(win.location.href=s):O.fireEvent("_docload",this)}return this},scriptRE:/(?:<script.*?>)((\n|\r|.)*?)(?:<\/script>)/gi,update:function(content,loadScripts,callback,scope){loadScripts=loadScripts||this.getUpdater().loadScripts||false;content=Ext.DomHelper.markup(content||"");content=loadScripts===true?content:content.replace(this.scriptRE,"");var doc;if((doc=this.getFrameDocument())&&!!content.length){this._unHook();this.src=null;this.showMask();Ext.isFunction(callback)&&this._observable.addListener("_docload",callback,scope||this,{single:true});this._targetURI=location.href;doc.open();this._frameAction=true;doc.write(content);doc.close();this.checkDOM()}else{this.hideMask(true);Ext.isFunction(callback)&&callback.call(scope,this)}return this},execCommand:function(command,userInterface,value,validate){var doc,assert;if((doc=this.getFrameDocument())&&!!command){try{Ext.isIE&&this.getWindow().focus();assert=validate&&Ext.isFunction(doc.queryCommandEnabled)?doc.queryCommandEnabled(command):true;return assert&&doc.execCommand(command,!!userInterface,value)}catch(eex){return false}}return false},setDesignMode:function(active){var doc;(doc=this.getFrameDocument())&&(doc.designMode=(/on|true/i).test(String(active))?"on":"off")},getUpdater:function(){return this.updateManager||(this.updateManager=new MIF.Updater(this))},getHistory:function(){var h=null;try{h=this.getWindow().history}catch(eh){}return h},get:function(el){var doc=this.getFrameDocument();return doc?Ext.get(el,doc):doc=null},fly:function(el,named){var doc=this.getFrameDocument();return doc?Ext.fly(el,named,doc):null},getDom:function(el){var d;if(!el||!(d=this.getFrameDocument())){return(d=null)}return Ext.getDom(el,d)},select:function(selector,unique){var d;return(d=this.getFrameDocument())?Ext.Element.select(selector,unique,d):d=null},query:function(selector){var d;return(d=this.getFrameDocument())?Ext.DomQuery.select(selector,d):null},removeNode:Ext.removeNode,_renderHook:function(){this._windowContext=null;this.CSS=this.CSS?this.CSS.destroy():null;this._hooked=false;try{if(this.writeScript('(function(){(window.hostMIF = parent.document.getElementById("'+this.id+'").ownerCt)._windowContext='+(Ext.isIE?"window":'{eval:function(s){return new Function("return ("+s+")")();}}')+";})()")){var w,p=this._frameProxy,D=this.getFrameDocument();if(w=this.getWindow()){p||(p=this._frameProxy=this._eventProxy.createDelegate(this));addListener(w,"focus",p);addListener(w,"blur",p);addListener(w,"resize",p);addListener(w,"unload",p);D&&addListener(Ext.isIE?w:D,"scroll",p)}D&&(this.CSS=new Ext.ux.ManagedIFrame.CSS(D))}}catch(ex){}return this.domWritable()},_unHook:function(){if(this._hooked){var id,el,c=this._domCache;if(c){for(id in c){el=c[id].el;el&&el.removeAllListeners&&el.removeAllListeners();el&&(c[id].el=el=null);delete c[id].data;delete c[id]}}this._windowContext&&(this._windowContext.hostMIF=null);this._windowContext=null;var w,p=this._frameProxy;if(p&&this.domWritable()&&(w=this.getWindow())){removeListener(w,"focus",p);removeListener(w,"blur",p);removeListener(w,"resize",p);removeListener(w,"unload",p);removeListener(Ext.isIE?w:this.getFrameDocument(),"scroll",p)}}MIM._flyweights={};this._domCache=null;ELD.clearDocumentCache&&ELD.clearDocumentCache(this.id);this.CSS=this.CSS?this.CSS.destroy():null;this.domFired=this._frameAction=this.domReady=this._hooked=false},_windowContext:null,getFrameDocument:function(){var win=this.getWindow(),doc=null;try{doc=(Ext.isIE&&win?win.document:null)||this.dom.contentDocument||window.frames[this.dom.name].document||null}catch(gdEx){this._domCache=null;ELD.clearDocumentCache&&ELD.clearDocumentCache(this.id);return false}doc=(doc&&Ext.isFunction(ELD.getDocument))?ELD.getDocument(doc,true):doc;if(doc){this._domCache||(this._domCache=ELD.resolveDocumentCache(doc,this.id))}return doc},getDoc:function(){var D=this.getFrameDocument();return Ext.get(D,D)},getBody:function(){var d;return(d=this.getFrameDocument())?this.get(d.body||d.documentElement):null},getDocumentURI:function(){var URI,d;try{URI=this.src&&(d=this.getFrameDocument())?d.location.href:null}catch(ex){}return URI||(Ext.isFunction(this.src)?this.src():this.src)},getWindowURI:function(){var URI,w;try{URI=(w=this.getWindow())?w.location.href:null}catch(ex){}return URI||(Ext.isFunction(this.src)?this.src():this.src)},getWindow:function(){var dom=this.dom,win=null;try{win=dom.contentWindow||window.frames[dom.name]||null}catch(gwEx){}return win},scrollChildIntoView:function(child,container,hscroll){this.fly(child,"_scrollChildIntoView").scrollIntoView(this.getDom(container)||this.getBody().dom,hscroll);return this},print:function(){try{var win;if(win=this.getWindow()){Ext.isIE&&win.focus();win.print()}}catch(ex){throw new MIF.Error("printexception",ex.description||ex.message||ex)}return this},domWritable:function(){return !!Ext.isDocument(this.getFrameDocument(),true)&&!!this._windowContext},execScript:function(block,useDOM){try{if(this.domWritable()){if(useDOM){this.writeScript(block)}else{return this._windowContext.eval(block)}}else{throw new MIF.Error("execscript-secure-context")}}catch(ex){this._observable.fireEvent.call(this._observable,"exception",this,ex);return false}return true},writeScript:function(block,attributes){attributes=Ext.apply({},attributes||{},{type:"text/javascript",text:block});try{var head,script,doc=this.getFrameDocument();if(doc&&typeof doc.getElementsByTagName!="undefined"){if(!(head=doc.getElementsByTagName("head")[0])){head=doc.createElement("head");doc.getElementsByTagName("html")[0].appendChild(head)}if(head&&(script=doc.createElement("script"))){for(var attrib in attributes){if(attributes.hasOwnProperty(attrib)&&attrib in script){script[attrib]=attributes[attrib]}}return !!head.appendChild(script)}}}catch(ex){this._observable.fireEvent.call(this._observable,"exception",this,ex)}finally{script=head=null}return false},loadFunction:function(fn,useDOM,invokeIt){var name=fn.name||fn;var fnSrc=fn.fn||window[fn];name&&fnSrc&&this.execScript(name+"="+fnSrc,useDOM);invokeIt&&this.execScript(name+"()")},loadHandler:function(e,target){var rstatus=(this.dom||{}).readyState||(e||{}).type;if(this.eventsFollowFrameLinks||this._frameAction||this.isReset){switch(rstatus){case"domready":case"DOMFrameContentLoaded":case"domfail":this._onDocReady(rstatus);break;case"load":case"complete":this._onDocLoaded(rstatus);break;case"error":this._observable.fireEvent.apply(this._observable,["exception",this].concat(arguments));break;default:}this.frameState=rstatus}},_onDocReady:function(eventName){var w,obv=this._observable,D;if(!this.isReset&&this.focusOnLoad&&(w=this.getWindow())){w.focus()}obv.fireEvent("_docready",this);(D=this.getDoc())&&(D.isReady=true);if(!this.domFired&&(this._hooked=this._renderHook())){this.domFired=true;this.isReset||obv.fireEvent.call(obv,"domready",this)}this.domReady=true;this.hideMask()},_onDocLoaded:function(eventName){var obv=this._observable,w;this.domReady||this._onDocReady("domready");obv.fireEvent("_docload",this);this.isReset||obv.fireEvent("documentloaded",this);this.hideMask(true);this._frameAction=this.isReset=false},checkDOM:function(win){if(Ext.isGecko){return}var n=0,frame=this,domReady=false,b,l,d,max=this.domReadyRetries||2500,polling=false,startLocation=(this.getFrameDocument()||{location:{}}).location.href;(function(){d=frame.getFrameDocument()||{location:{}};polling=(d.location.href!==startLocation||d.location.href===frame._targetURI);if(frame.domReady){return}domReady=polling&&((b=frame.getBody())&&!!(b.dom.innerHTML||"").length)||false;if(d.location.href&&!domReady&&(++n<max)){setTimeout(arguments.callee,2);return}frame.loadHandler({type:domReady?"domready":"domfail"})})()},filterEventOptionsRe:/^(?:scope|delay|buffer|single|stopEvent|preventDefault|stopPropagation|normalized|args|delegate)$/,addListener:function(eventName,fn,scope,options){if(typeof eventName=="object"){var o=eventName;for(var e in o){if(this.filterEventOptionsRe.test(e)){continue}if(typeof o[e]=="function"){this.addListener(e,o[e],o.scope,o)}else{this.addListener(e,o[e].fn,o[e].scope,o[e])}}return}if(reSynthEvents.test(eventName)){var O=this._observable;if(O){O.events[eventName]||(O.addEvents(eventName));O.addListener.call(O,eventName,fn,scope||this,options)}}else{ElFrame.superclass.addListener.call(this,eventName,fn,scope||this,options)}return this},removeListener:function(eventName,fn,scope){var O=this._observable;if(reSynthEvents.test(eventName)){O&&O.removeListener.call(O,eventName,fn,scope||this,options)}else{ElFrame.superclass.removeListener.call(this,eventName,fn,scope||this)}return this},removeAllListeners:function(){Ext.EventManager.removeAll(this.dom);var O=this._observable;O&&O.purgeListeners.call(this._observable);return this},showMask:function(msg,msgCls,maskCls){var lmask=this.loadMask;if(lmask&&!lmask.disabled){this.mask(msg||lmask.msg,msgCls||lmask.msgCls,maskCls||lmask.maskCls,lmask.maskEl)}},hideMask:function(forced){var tlm=this.loadMask||{};if(forced||(tlm.hideOnReady&&this.domReady)){this.unmask()}},mask:function(msg,msgCls,maskCls,maskEl){this._mask&&this.unmask();var p=Ext.get(maskEl)||this.parent(".ux-mif-mask-target")||this.parent();if(p.getStyle("position")=="static"&&!p.select("iframe,frame,object,embed").elements.length){p.addClass("x-masked-relative")}p.addClass("x-masked");this._mask=Ext.DomHelper.append(p,{cls:maskCls||"ux-mif-el-mask"},true);this._mask.setDisplayed(true);this._mask._agent=p;if(typeof msg=="string"){this._maskMsg=Ext.DomHelper.append(p,{cls:msgCls||"ux-mif-el-mask-msg",style:{visibility:"hidden"},cn:{tag:"div",html:msg}},true);this._maskMsg.setVisibilityMode(Ext.Element.VISIBILITY).center(p).setVisible(true)}if(Ext.isIE&&!(Ext.isIE7&&Ext.isStrict)&&this.getStyle("height")=="auto"){this._mask.setSize(undefined,this._mask.getHeight())}return this._mask},unmask:function(){var a;if(this._mask){(a=this._mask._agent)&&a.removeClass(["x-masked-relative","x-masked"]);if(this._maskMsg){this._maskMsg.remove();delete this._maskMsg}this._mask.remove();delete this._mask}},createFrameShim:function(imgUrl,shimCls){this.shimCls=shimCls||this.shimCls||"ux-mif-shim";this.frameShim||(this.frameShim=this.next("."+this.shimCls)||Ext.DomHelper.append(this.dom.parentNode,{tag:"img",src:imgUrl||Ext.BLANK_IMAGE_URL,cls:this.shimCls,galleryimg:"no"},true));this.frameShim&&(this.frameShim.autoBoxAdjust=false);return this.frameShim},toggleShim:function(show){var shim=this.frameShim||this.createFrameShim();var cls=this.shimCls+"-on";!show&&shim.removeClass(cls);show&&!shim.hasClass(cls)&&shim.addClass(cls)},load:function(loadCfg){var um;if(um=this.getUpdater()){if(loadCfg&&loadCfg.renderer){um.setRenderer(loadCfg.renderer);delete loadCfg.renderer}um.update.apply(um,arguments)}return this},_eventProxy:function(e){if(!e){return}e=Ext.EventObject.setEvent(e);var be=e.browserEvent||e,er,args=[e.type,this];if(!be.eventPhase||(be.eventPhase==(be.AT_TARGET||2))){if(e.type=="resize"){var doc=this.getFrameDocument();doc&&(args.push({height:ELD.getDocumentHeight(doc),width:ELD.getDocumentWidth(doc)},{height:ELD.getViewportHeight(doc),width:ELD.getViewportWidth(doc)},{height:ELD.getViewHeight(false,doc),width:ELD.getViewWidth(false,doc)}))}er=this._observable?this._observable.fireEvent.apply(this._observable,args.concat(Array.prototype.slice.call(arguments,0))):null;(e.type=="unload")&&this._unHook()}return er},sendMessage:function(message,tag,origin){},postMessage:function(message,ports,origin){}});ElFrame=Ext.Element.IFRAME=Ext.Element.FRAME=Ext.ux.ManagedIFrame.Element;var fp=ElFrame.prototype;Ext.override(ElFrame,{on:fp.addListener,un:fp.removeListener,getUpdateManager:fp.getUpdater});Ext.ux.ManagedIFrame.ComponentAdapter=function(){};Ext.ux.ManagedIFrame.ComponentAdapter.prototype={version:2.01,defaultSrc:null,title:"&#160;",unsupportedText:"Inline frames are NOT enabled/supported by your browser.",hideMode:!Ext.isIE&&!!Ext.ux.plugin.VisibilityMode?"nosize":"display",animCollapse:Ext.isIE,animFloat:Ext.isIE,frameConfig:null,focusOnLoad:false,frameEl:null,useShim:false,autoScroll:true,autoLoad:null,getId:function(){return this.id||(this.id="mif-comp-"+(++Ext.Component.AUTO_ID))},stateEvents:["documentloaded"],stateful:false,setAutoScroll:function(auto){var scroll=Ext.value(auto,this.autoScroll===true);this.rendered&&this.getFrame()&&this.frameEl.setOverflow((this.autoScroll=scroll)?"auto":"hidden");return this},getContentTarget:function(){return this.getFrame()},getFrame:function(){if(this.rendered){if(this.frameEl){return this.frameEl}var f=this.items&&this.items.first?this.items.first():null;f&&(this.frameEl=f.frameEl);return this.frameEl}return null},getFrameWindow:function(){return this.getFrame()?this.frameEl.getWindow():null},getFrameDocument:function(){return this.getFrame()?this.frameEl.getFrameDocument():null},getFrameDoc:function(){return this.getFrame()?this.frameEl.getDoc():null},getFrameBody:function(){return this.getFrame()?this.frameEl.getBody():null},resetFrame:function(){this.getFrame()&&this.frameEl.reset.apply(this.frameEl,arguments);return this},submitAsTarget:function(submitCfg){this.getFrame()&&this.frameEl.submitAsTarget.apply(this.frameEl,arguments);return this},load:function(loadCfg){if(loadCfg&&this.getFrame()){var args=arguments;this.resetFrame(null,function(){loadCfg.submitAsTarget?this.submitAsTarget.apply(this,args):this.frameEl.load.apply(this.frameEl,args)},this)}this.autoLoad=loadCfg;return this},doAutoLoad:function(){this.autoLoad&&this.load(typeof this.autoLoad=="object"?this.autoLoad:{url:this.autoLoad})},getUpdater:function(){return this.getFrame()?this.frameEl.getUpdater():null},setSrc:function(url,discardUrl,callback,scope){this.getFrame()&&this.frameEl.setSrc.apply(this.frameEl,arguments);return this},setLocation:function(url,discardUrl,callback,scope){this.getFrame()&&this.frameEl.setLocation.apply(this.frameEl,arguments);return this},getState:function(){var URI=this.getFrame()?this.frameEl.getDocumentURI()||null:null;var state=this.supr().getState.call(this);state=Ext.apply(state||{},{defaultSrc:Ext.isFunction(URI)?URI():URI,autoLoad:this.autoLoad});return state},setMIFEvents:function(){this.addEvents("documentloaded","domready","exception","message","blur","focus","scroll","resize","unload","reset")},sendMessage:function(message,tag,origin){},onAdd:function(C){C.relayTarget&&this.suspendEvents(true)},initRef:function(){if(this.ref){var t=this,levels=this.ref.split("/"),l=levels.length,i;for(i=0;i<l;i++){if(t.ownerCt){t=t.ownerCt}}this.refName=levels[--i];t[this.refName]||(t[this.refName]=this);this.refOwner=t}}};Ext.ux.ManagedIFrame.Component=Ext.extend(Ext.BoxComponent,{ctype:"Ext.ux.ManagedIFrame.Component",initComponent:function(){var C={monitorResize:this.monitorResize||(this.monitorResize=!!this.fitToParent),plugins:(this.plugins||[]).concat(this.hideMode==="nosize"&&Ext.ux.plugin.VisibilityMode?[new Ext.ux.plugin.VisibilityMode({hideMode:"nosize",elements:["bwrap"]})]:[])};MIF.Component.superclass.initComponent.call(Ext.apply(this,Ext.apply(this.initialConfig,C)));this.setMIFEvents()},onRender:function(ct,position){var frCfg=this.frameCfg||this.frameConfig||(this.relayTarget?{name:this.relayTarget.id}:{})||{};var frDOM=frCfg.autoCreate||frCfg;frDOM=Ext.apply({tag:"iframe",id:Ext.id()},frDOM);var el=Ext.getDom(this.el);(el&&el.tagName=="iframe")||(this.autoEl=Ext.apply({name:frDOM.id,frameborder:0},frDOM));MIF.Component.superclass.onRender.apply(this,arguments);if(this.unsupportedText){ct.child("noframes")||ct.createChild({tag:"noframes",html:this.unsupportedText||null})}var frame=this.el;var F;if(F=this.frameEl=(this.el?new MIF.Element(this.el.dom,true):null)){(F.ownerCt=(this.relayTarget||this)).frameEl=F;F.addClass("ux-mif");if(this.loadMask){var mEl=this.loadMask.maskEl;F.loadMask=Ext.apply({disabled:false,hideOnReady:false,msgCls:"ext-el-mask-msg x-mask-loading",maskCls:"ext-el-mask"},{maskEl:F.ownerCt[String(mEl)]||F.parent("."+String(mEl))||F.parent(".ux-mif-mask-target")||mEl},Ext.isString(this.loadMask)?{msg:this.loadMask}:this.loadMask);Ext.get(F.loadMask.maskEl)&&Ext.get(F.loadMask.maskEl).addClass("ux-mif-mask-target")}F.disableMessaging=Ext.value(frCfg.disableMessaging,true);F._observable&&(this.relayTarget||this).relayEvents(F._observable,frameEvents.concat(this._msgTagHandlers||[]));delete this.contentEl}},afterRender:function(container){MIF.Component.superclass.afterRender.apply(this,arguments);if(this.fitToParent&&!this.ownerCt){var pos=this.getPosition(),size=(Ext.get(this.fitToParent)||this.getEl().parent()).getViewSize();this.setSize(size.width-pos[0],size.height-pos[1])}this.getEl().setOverflow("hidden");this.setAutoScroll();var F;if(F=this.frameEl){var ownerCt=this.ownerCt;while(ownerCt){ownerCt.on("afterlayout",function(container,layout){Ext.each(["north","south","east","west"],function(region){var reg;if((reg=layout[region])&&reg.split&&reg.split.dd&&!reg._splitTrapped){reg.split.dd.endDrag=reg.split.dd.endDrag.createSequence(MIM.hideShims,MIM);reg.split.on("beforeresize",MIM.showShims,MIM);reg._splitTrapped=MIM._splitTrapped=true}},this)},this,{single:true});ownerCt=ownerCt.ownerCt}if(!!this.ownerCt||this.useShim){this.frameShim=F.createFrameShim()}this.getUpdater().showLoadIndicator=this.showLoadIndicator||false;var resumeEvents=this.relayTarget&&this.ownerCt?this.ownerCt.resumeEvents.createDelegate(this.ownerCt):null;if(this.autoload){this.doAutoLoad()}else{if(this.frameMarkup||this.html){F.update(this.frameMarkup||this.html,true,resumeEvents);delete this.html;delete this.frameMarkup;return}else{if(this.defaultSrc){F.setSrc(this.defaultSrc,false)}else{F.reset(null,resumeEvents);return}}}resumeEvents&&resumeEvents()}},beforeDestroy:function(){var F;if(F=this.getFrame()){F.remove();this.frameEl=this.frameShim=null}this.relayTarget&&(this.relayTarget.frameEl=null);MIF.Component.superclass.beforeDestroy.call(this)}});Ext.override(MIF.Component,MIF.ComponentAdapter.prototype);Ext.reg("mif",MIF.Component);function embed_MIF(config){config||(config={});config.layout="fit";config.items={xtype:"mif",ref:"mifChild",useShim:true,autoScroll:Ext.value(config.autoScroll,this.autoScroll),defaultSrc:Ext.value(config.defaultSrc,this.defaultSrc),frameMarkup:Ext.value(config.html,this.html),loadMask:Ext.value(config.loadMask,this.loadMask),focusOnLoad:Ext.value(config.focusOnLoad,this.focusOnLoad),frameConfig:Ext.value(config.frameConfig||config.frameCfg,this.frameConfig),relayTarget:this};delete config.html;this.setMIFEvents();return config}Ext.ux.ManagedIFrame.Panel=Ext.extend(Ext.Panel,{ctype:"Ext.ux.ManagedIFrame.Panel",bodyCssClass:"ux-mif-mask-target",constructor:function(config){MIF.Panel.superclass.constructor.call(this,embed_MIF.call(this,config))}});Ext.override(MIF.Panel,MIF.ComponentAdapter.prototype);Ext.reg("iframepanel",MIF.Panel);Ext.ux.ManagedIFrame.Portlet=Ext.extend(Ext.ux.ManagedIFrame.Panel,{ctype:"Ext.ux.ManagedIFrame.Portlet",anchor:"100%",frame:true,collapseEl:"bwrap",collapsible:true,draggable:true,cls:"x-portlet"});Ext.reg("iframeportlet",MIF.Portlet);Ext.ux.ManagedIFrame.Window=Ext.extend(Ext.Window,{ctype:"Ext.ux.ManagedIFrame.Window",bodyCssClass:"ux-mif-mask-target",constructor:function(config){MIF.Window.superclass.constructor.call(this,embed_MIF.call(this,config))}});Ext.override(MIF.Window,MIF.ComponentAdapter.prototype);Ext.reg("iframewindow",MIF.Window);Ext.ux.ManagedIFrame.Updater=Ext.extend(Ext.Updater,{showLoading:function(){this.showLoadIndicator&&this.el&&this.el.mask(this.indicatorText)},hideLoading:function(){this.showLoadIndicator&&this.el&&this.el.unmask()},updateComplete:function(response){MIF.Updater.superclass.updateComplete.apply(this,arguments);this.hideLoading()},processFailure:function(response){MIF.Updater.superclass.processFailure.apply(this,arguments);this.hideLoading()}});var styleCamelRe=/(-[a-z])/gi;var styleCamelFn=function(m,a){return a.charAt(1).toUpperCase()};Ext.ux.ManagedIFrame.CSS=function(hostDocument){var doc;if(hostDocument){doc=hostDocument;return{rules:null,destroy:function(){return doc=null},createStyleSheet:function(cssText,id){var ss;if(!doc){return}var head=doc.getElementsByTagName("head")[0];var rules=doc.createElement("style");rules.setAttribute("type","text/css");Ext.isString(id)&&rules.setAttribute("id",id);if(Ext.isIE){head.appendChild(rules);ss=rules.styleSheet;ss.cssText=cssText}else{try{rules.appendChild(doc.createTextNode(cssText))}catch(e){rules.cssText=cssText}head.appendChild(rules);ss=rules.styleSheet?rules.styleSheet:(rules.sheet||doc.styleSheets[doc.styleSheets.length-1])}this.cacheStyleSheet(ss);return ss},removeStyleSheet:function(id){if(!doc||!id){return}var existing=doc.getElementById(id);if(existing){existing.parentNode.removeChild(existing)}},swapStyleSheet:function(id,url){if(!doc){return}this.removeStyleSheet(id);var ss=doc.createElement("link");ss.setAttribute("rel","stylesheet");ss.setAttribute("type","text/css");Ext.isString(id)&&ss.setAttribute("id",id);ss.setAttribute("href",url);doc.getElementsByTagName("head")[0].appendChild(ss)},refreshCache:function(){return this.getRules(true)},cacheStyleSheet:function(ss,media){this.rules||(this.rules={});try{Ext.each(ss.cssRules||ss.rules||[],function(rule){this.hashRule(rule,ss,media)},this);Ext.each(ss.imports||[],function(sheet){sheet&&this.cacheStyleSheet(sheet,this.resolveMedia([sheet,sheet.parentStyleSheet]))},this)}catch(e){}},hashRule:function(rule,sheet,mediaOverride){var mediaSelector=mediaOverride||this.resolveMedia(rule);if(rule.cssRules||rule.rules){this.cacheStyleSheet(rule,this.resolveMedia([rule,rule.parentRule]))}if(rule.styleSheet){this.cacheStyleSheet(rule.styleSheet,this.resolveMedia([rule,rule.ownerRule,rule.parentStyleSheet]))}rule.selectorText&&Ext.each((mediaSelector||"").split(","),function(media){this.rules[((media?media.trim()+":":"")+rule.selectorText).toLowerCase()]=rule},this)},resolveMedia:function(rule){var media;Ext.each([].concat(rule),function(r){if(r&&r.media&&r.media.length){media=r.media;return false}});return media?(Ext.isIE?String(media):media.mediaText):""},getRules:function(refreshCache){if(!this.rules||refreshCache){this.rules={};if(doc){var ds=doc.styleSheets;for(var i=0,len=ds.length;i<len;i++){try{this.cacheStyleSheet(ds[i])}catch(e){}}}}return this.rules},getRule:function(selector,refreshCache,mediaSelector){var rs=this.getRules(refreshCache);if(Ext.type(mediaSelector)=="string"){mediaSelector=mediaSelector.trim()+":"}else{mediaSelector=""}if(!Ext.isArray(selector)){return rs[(mediaSelector+selector).toLowerCase()]}var select;for(var i=0;i<selector.length;i++){select=(mediaSelector+selector[i]).toLowerCase();if(rs[select]){return rs[select]}}return null},updateRule:function(selector,property,value,mediaSelector){Ext.each((mediaSelector||"").split(","),function(mediaSelect){if(!Ext.isArray(selector)){var rule=this.getRule(selector,false,mediaSelect);if(rule){rule.style[property.replace(camelRe,camelFn)]=value;return true}}else{for(var i=0;i<selector.length;i++){if(this.updateRule(selector[i],property,value,mediaSelect)){return true}}}return false},this)}}}};Ext.ux.ManagedIFrame.Manager=function(){var frames={};var implementation={_DOMFrameReadyHandler:function(e){try{var $frame;if($frame=e.target.ownerCt){$frame.loadHandler.call($frame,e)}}catch(rhEx){}},shimCls:"ux-mif-shim",register:function(frame){frame.manager=this;frames[frame.id]=frames[frame.name]={ref:frame};return frame},deRegister:function(frame){delete frames[frame.id];delete frames[frame.name]},hideShims:function(){var mm=MIF.Manager;mm.shimsApplied&&Ext.select("."+mm.shimCls,true).removeClass(mm.shimCls+"-on");mm.shimsApplied=false},showShims:function(){var mm=MIF.Manager;!mm.shimsApplied&&Ext.select("."+mm.shimCls,true).addClass(mm.shimCls+"-on");mm.shimsApplied=true},getFrameById:function(id){return typeof id=="string"?(frames[id]?frames[id].ref||null:null):null},getFrameByName:function(name){return this.getFrameById(name)},getFrameHash:function(frame){return frames[frame.id]||frames[frame.id]||null},_flyweights:{},destroy:function(){if(document.addEventListener&&!Ext.isOpera){window.removeEventListener("DOMFrameContentLoaded",this._DOMFrameReadyHandler,false)}delete this._flyweights}};document.addEventListener&&!Ext.isOpera&&window.addEventListener("DOMFrameContentLoaded",implementation._DOMFrameReadyHandler,false);Ext.EventManager.on(window,"beforeunload",implementation.destroy,implementation);return implementation}();MIM=MIF.Manager;MIM.showDragMask=MIM.showShims;MIM.hideDragMask=MIM.hideShims;var winDD=Ext.Window.DD;Ext.override(winDD,{startDrag:winDD.prototype.startDrag.createInterceptor(MIM.showShims),endDrag:winDD.prototype.endDrag.createInterceptor(MIM.hideShims)});Ext.ux.ManagedIFramePanel=MIF.Panel;Ext.ux.ManagedIFramePortlet=MIF.Portlet;Ext.ux.ManagedIframe=function(el,opt){var args=Array.prototype.slice.call(arguments,0),el=Ext.get(args[0]),config=args[0];if(el&&el.dom&&el.dom.tagName=="IFRAME"){config=args[1]||{}}else{config=args[0]||args[1]||{};el=config.autoCreate?Ext.get(Ext.DomHelper.append(config.autoCreate.parent||Ext.getBody(),Ext.apply({tag:"iframe",frameborder:0,cls:"x-mif",src:(Ext.isIE&&Ext.isSecure)?Ext.SSL_SECURE_URL:"about:blank"},config.autoCreate))):null;if(el&&config.unsupportedText){Ext.DomHelper.append(el.dom.parentNode,{tag:"noframes",html:config.unsupportedText})}}var mif=new MIF.Element(el,true);if(mif){Ext.apply(mif,{disableMessaging:Ext.value(config.disableMessaging,true),loadMask:!!config.loadMask?Ext.apply({msg:"Loading..",msgCls:"x-mask-loading",maskEl:null,hideOnReady:false,disabled:false},config.loadMask):false,_windowContext:null,eventsFollowFrameLinks:Ext.value(config.eventsFollowFrameLinks,true)});config.listeners&&mif.on(config.listeners);if(!!config.html){mif.update(config.html)}else{!!config.src&&mif.setSrc(config.src)}}return mif};Ext.ux.ManagedIFrame.Error=Ext.extend(Ext.Error,{constructor:function(message,arg){this.arg=arg;Ext.Error.call(this,message)},name:"Ext.ux.ManagedIFrame"});Ext.apply(Ext.ux.ManagedIFrame.Error.prototype,{lang:{"documentcontext-remove":"An attempt was made to remove an Element from the wrong document context.","execscript-secure-context":"An attempt was made at script execution within a document context with limited access permissions.",printexception:"An Error was encountered attempting the print the frame contents (document access is likely restricted)."}});Ext.onReady(function(){var CSS=new Ext.ux.ManagedIFrame.CSS(document),rules=[];CSS.getRule(".ux-mif-fill")||(rules.push(".ux-mif-fill{height:100%;width:100%;}"));CSS.getRule(".ux-mif-mask-target")||(rules.push(".ux-mif-mask-target{position:relative;zoom:1;}"));CSS.getRule(".ux-mif-el-mask")||(rules.push(".ux-mif-el-mask {z-index: 100;position: absolute;top:0;left:0;-moz-opacity: 0.5;opacity: .50;*filter: alpha(opacity=50);width: 100%;height: 100%;zoom: 1;} ",".ux-mif-el-mask-msg {z-index: 1;position: absolute;top: 0;left: 0;border:1px solid;background:repeat-x 0 -16px;padding:2px;} ",".ux-mif-el-mask-msg div {padding:5px 10px 5px 10px;border:1px solid;cursor:wait;} "));if(!CSS.getRule(".ux-mif-shim")){rules.push(".ux-mif-shim {z-index:8500;position:absolute;top:0px;left:0px;background:transparent!important;overflow:hidden;display:none;}");rules.push(".ux-mif-shim-on{width:100%;height:100%;display:block;zoom:1;}");rules.push(".ext-ie6 .ux-mif-shim{margin-left:5px;margin-top:3px;}")}!!rules.length&&CSS.createStyleSheet(rules.join(" "),"mifCSS")});Ext.provide&&Ext.provide("mif")})();Ext.namespace("biogps.utils");if(!Ext.isDefined(Array.prototype.each)){Array.prototype.each=function(e){var c=this.length,b,a=this.length;for(c=0;c<a;c++){if((b=this[c])){e(b)}}}}if(!Ext.isDefined(Array.prototype.walk)){Array.prototype.walk=function(e){var b=[],c=this.length;while(c--){b.push(e(this[c]))}return b.reverse()}}if(!Ext.isDefined(Array.prototype.equals)){Array.prototype.equals=function(b){if(this.length!=b.length){return false}for(var c=0;c<this.length;++c){if(this[c]!==b[c]){return false}}return true}}if(!Ext.isDefined(String.prototype.startsWith)){String.prototype.startsWith=function(b,a){if(a==false){return;(b==this.substring(0,b.length))}else{return(b.toLowerCase()==this.substring(0,b.length).toLowerCase())}}}if(!Ext.isDefined(String.prototype.endsWith)){String.prototype.endsWith=function(b,a){if(a==false){return(b==this.substring(this.length-b.length))}else{return;(b.toLowerCase()==this.substring(this.length-b.length).toLowerCase())}}}biogps.isEmptyObject=function(b){for(var a in b){return false}return true};biogps.Messenger=function(a){Ext.apply(this,a);biogps.Messenger.superclass.constructor.call(this);this.addEvents({genelistrendered:true});this.addEvents({genereportrendered:true})};Ext.extend(biogps.Messenger,Ext.util.Observable,{});biogps.Messenger=new biogps.Messenger();biogps.evtEmptyFn=function(){console.log(arguments)};Ext.BLANK_IMAGE_URL=(function(){if(Ext.isIE8||Ext.isGecko||Ext.isOpera||Ext.isChrome||Ext.isSafari){return"data:image/gif;base64,R0lGODlhAQABAID/AMDAwAAAACH5BAEAAAAALAAAAAABAAEAAAICRAEAOw=="}else{return"/assets/img/s.gif"}})();Ext.SSL_SECURE_URL="https://biogps.gnf.org/assets/img/s.gif";Ext.USE_NATIVE_JSON=true;biogps.error=function(a){Ext.MessageBox.show({title:"Error",msg:a,buttons:Ext.Msg.OK,icon:Ext.MessageBox.ERROR})};biogps.warning=function(a){Ext.MessageBox.show({title:"Warning",msg:a,buttons:Ext.Msg.OK,icon:Ext.MessageBox.WARNING})};biogps.ajaxfailure=function(f,a,b){if(biogps.bequietonfailure){return}biogps.failedajax=[f,a,b];var e=f;if(f&&f.status){e=f}else{if(a.status){e=a}else{if(b.status){e=b}else{e=f}}}var c=a.url;if(!c&&a.argument){c=a.argument.url}var g='Failed to access "'+c+'" with:<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Error code: '+(e.status?e.status.toString():"None")+"<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Error message: "+(e.statusText?e.statusText.toString():"None")+"<br>";Ext.MessageBox.alert("Ajax Error",g)};biogps.ajaxfailure2=function(c,a,b){biogps.ajaxfailure(b,a)};biogps.formfailure=function(c,e,b,a){Ext.MessageBox.hide();if(c.result){if(c.result.error){if(typeof(c.result.error)=="string"){e+="<br><br>&nbsp;&nbsp;&nbsp;&nbsp;"+c.result.error}else{if(c.result.error.error_code){e+="<br><br>&nbsp;&nbsp;&nbsp;&nbsp;Error Code: "+c.result.error.error_code;if(c.result.error.error_msg){e+="<br><br>&nbsp;&nbsp;&nbsp;&nbsp;Error Msg: "+c.result.error.error_msg}if(c.result.error.errorreport_id){e+='<br><br>&nbsp;&nbsp;&nbsp;&nbsp;<a href="/utils/errorreport/'+c.result.error.errorreport_id+'" target="_blank">View detailed error report.</a>'}}else{e+="<br><br>&nbsp;&nbsp;&nbsp;&nbsp;"+c.result.error.toString()}}}else{if(c.result.data){if(c.result.data.status){e+="<br><br>&nbsp;&nbsp;&nbsp;&nbsp;Error Code: "+c.result.data.status}}}}else{if(c.response.responseText){Ext.getBody().dom.innerHTML=c.response.responseText;return}else{if(c.response.statusText){e+="<br><br>&nbsp;&nbsp;&nbsp;&nbsp;Reason: "+c.response.statusText}else{e+="<br><br>&nbsp;&nbsp;&nbsp;&nbsp;Reason: timeout."}}}Ext.MessageBox.show({title:"Error",msg:e,buttons:Ext.Msg.OK,fn:b,scope:a,icon:Ext.MessageBox.ERROR})};biogps.callRemoteService=function(e){var b=e.url;var f=e.params||{};var h=e.fn||Ext.emptyFn;var l=e.failure||Ext.emptyFn;var p=e.scope;var a=e.method||"GET";var c=(e.disableCaching==null)?true:e.disableCaching;var k=(e.ignorefailure==null)?false:e.ignorefailure;var j=e.timeout||30000;var i=e.type||"json";if(i=="json"){var g=Ext.data.JsonStore}else{var g=Ext.data.Store}var n=new g({proxy:new Ext.data.HttpProxy({method:a,disableCaching:c,timeout:j,url:b}),baseParams:f,fields:[],autoLoad:true});n.on("load",h,p);if(!k){n.on("exception",function(v,t,u,r,q,s){biogps.ajaxException(v,t,u,r,q,s);l(n)},p)}};biogps.ajaxException=function(a,j,f,k,g,e){biogps.ding=arguments;if(j=="remote"){biogps.error(g.error||"None")}else{var b=k.url;var h=g.status||"None";var i=g.responseText||g.statusText||"None";var c='Failed to access "'+b+'" with:<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Error code: '+h+"<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Error message: "+i+"<br>";Ext.MessageBox.alert("Ajax Error",c)}};biogps.setTitle=function(b){var e="";var c="";switch(b){default:break;case"about":e="About";break;case"terms":e="Terms of Use";break;case"help":e="Help";break;case"faq":e="FAQ";break;case"downloads":e="Downloads";break;case"iphone":e="iPhone";break;case"search":break;case"searchresult":e="Search Result";if(biogps.resultpage&&biogps.resultpage.rendered){e="Search Result ({0})";e=String.format(e,biogps.resultpage.totalCount)}else{biogps.Messenger.on("genelistrendered",function(){biogps.setTitle("result");biogps.clearListeners(biogps.Messenger,"genelistrendered")})}break;case"genereport":e="Gene Report";if(biogps.GeneReportMgr&&biogps.GeneReportMgr.rendered){c=biogps.GeneReportMgr.makeTitle()}else{biogps.Messenger.on("genereportrendered",function(){biogps.setTitle("genereport");biogps.clearListeners(biogps.Messenger,"genereportrendered")})}break;case"pluginlibrary":e="Plugin Library";break;case"mystuff":e="My Stuff";break}var f=100;var a="BioGPS";if(e.length==""){e="BioGPS - your Gene Portal System"}else{if(c==""){e+=" | "+a}else{if(c.length>f){c=c.substring(0,97)+"..."}e=c+" | "+e+" | "+a}}document.title=e};function createBox(a,b){return['<div class="msg">','<div class="x-box-mc"><h3>',a,"</h3>",b,"</div>","</div>"].join("")}var msgCt;biogps.showmsg=function(e,c){if(!msgCt){msgCt=Ext.DomHelper.insertFirst(document.body,{id:"msg-div"},true)}msgCt.alignTo(document,"t-t");var b=String.format.apply(String,Array.prototype.slice.call(arguments,1));var a=Ext.DomHelper.append(msgCt,{html:createBox(e,b)},true);a.slideIn("t").pause(1).ghost("t",{remove:true})};biogps.require_user_logged_in=function(){if(biogps.usrMgr.is_anonymoususer){Ext.MessageBox.alert("Alert","This function is only available for registered users.");return false}else{return true}};biogps.whydisabled=function(b,c){if(b.el){var a=b.el.mask("Why disabled?","whydisabled_msg");biogps.msk=a;var e=Ext.DomQuery.selectNode('div[class="ext-el-mask-msg whydisabled_msg"]',b.el.dom);e=e||b.el;new Ext.ToolTip({target:e,html:c,title:"Why disabled?",dismissDelay:15000,autoHide:true,closable:true,draggable:true})}};biogps.clearListeners=function(c,a){if(c.events){var b=c.events[a.toLowerCase()];if(typeof b=="object"){b.clearListeners()}}};biogps.setCookies=function(){var a=new Ext.state.CookieProvider();a.set("test","cookietest");if(!a.readCookies().test){alert("Warning: many features will not work as expected unless you enable cookies. Please enable cookies on your browser and refresh the page again.")}a.clear("test");Ext.state.Manager.setProvider(a)};biogps.initHistory=function(){Ext.History.init();Ext.History.on("change",biogps.dispatcher_by_hash)};biogps.init=function(){biogps.setCookies();coreDispatcher.bindHotKey();biogps.initHistory();Ext.QuickTips.init();if(coreDispatcher.delayedAction){_gaq.push(["_trackEvent","coreDispatcher.delayedExecute","delayedCallback"]);coreDispatcher.delayedAction()}};biogps.mainUI_init=function(){biogps.initInfobar();biogps.usrMgr.init()};biogps.mainUI_postinit=function(){biogps.initLogo()};biogps.getlastsearch=function(){var a=new Ext.data.JsonStore({url:"/service/getlastsearch/",fields:[{name:"symbol"},{name:"id"}],autoLoad:true});a.on("load",function(){var b=a.reader.jsonData;if(isArray(b)&&b.length>0){biogps.genelist_panel.loadGeneList({geneList:a.reader.jsonData})}},this)};_reuse_exist_tab=function(a){var b=Ext.get("welcome");if(b&&b.isVisible()){b.hide()}if(biogps.centerTab.getActiveTab().id==a){return true}var c=biogps.centerTab.getItem(a);if(c&&!c.disabled){biogps.centerTab.suspendEvents();biogps.centerTab.setActiveTab(a);biogps.centerTab.resumeEvents();return true}return false};biogps.dispatcher_by_hash=function(g){var f=Ext.urlDecode(g);if(f){var e=f["goto"];if(e){e=e.toLowerCase()}switch(e){default:var b=Ext.get("welcome");if(b&&!b.isVisible()){b.show()}biogps.setTitle(e);break;case"about":if(!_reuse_exist_tab("infotab_about")){biogps.showInfoPage("about")}biogps.setTitle(e);break;case"terms":if(!_reuse_exist_tab("infotab_terms")){biogps.showInfoPage("terms")}biogps.setTitle(e);break;case"help":if(!_reuse_exist_tab("infotab_help")){biogps.showInfoPage("help")}biogps.setTitle(e);break;case"faq":if(!_reuse_exist_tab("infotab_faq")){biogps.showInfoPage("faq")}biogps.setTitle(e);break;case"downloads":if(!_reuse_exist_tab("infotab_downloads")){biogps.showInfoPage("downloads")}biogps.setTitle(e);break;case"iphone":if(!_reuse_exist_tab("infotab_iphone")){biogps.showInfoPage("iphone")}biogps.setTitle(e);break;case"search":var a;var h;if(f.qtype=="keyword"){a="keyword"}else{if(f.qtype=="interval"){a="interval";var j=biogps.GENOMEASSEMBLY[f.genome]||"mouse"}else{a="symbolanno"}}h=f.query;if(h){if(biogps.searchform){if(a=="interval"){biogps.searchform.items.get(0).setActiveTab("searchbyinterval");biogps.searchform.form.setValues({genomeinternal_string:h,genomeassembly:j})}else{h=h.replace(/[\+,|]+/g,"\n");biogps.searchform.items.get(0).setActiveTab("searchbyanno");biogps.searchform.form.setValues({query:h,qtype:a})}biogps.doSearch()}}else{_reuse_exist_tab("search_panel")}biogps.setTitle(e);break;case"searchresult":_reuse_exist_tab("result_panel");biogps.setTitle(e);break;case"genereport":var c=f.id;var i=[];if(c){if(isString(c)){i=c.replace(/[\+|]+/g,",").split(",")}else{if(isArray(c)){i=c}}}if(i.length>0){if(!_reuse_exist_tab("report_panel")||(i.join(",")!=biogps.GeneReportMgr.getGeneidList().join(","))){biogps.renderGeneReport2(i,true)}}else{_reuse_exist_tab("report_panel")}biogps.setTitle(e,i);break;case"pluginlibrary":if(!_reuse_exist_tab("pluginbrowse_panel")){biogps.renderPluginBrowsePanel(false,f);biogps.setTitle(e)}else{biogps.currentLibrary.dispatcher_by_params(f)}break;case"mystuff":if(!_reuse_exist_tab("mystuff_panel")){biogps.renderMyStuffPanel()}biogps.setTitle(e);break}}else{Ext.History.add("goto=welcome")}};biogps.dispatcher=function(){var a=window.location.hash;if(a.length>0&&a.substring(0,1)=="#"){a=a.substring(1);biogps.dispatcher_by_hash(a)}else{Ext.History.add("goto=search")}};biogps.initMsgTicker=function(){var a=Ext.get("center_panel");if(a){var b=Ext.get("msg-ct");b.anchorTo(a.first(),"tr",[-300,0],false,false);var e=0;var h=Ext.get("msg"),c=Ext.get("msg-inner"),g=null;c.addClassOnOver("msg-over");h.on("click",function(){if(g.action){g.action()}else{if(g.url){window.open(g.url)}}});function i(){c.update(g.text);h.slideIn("b")}function f(j){if(isArray(biogps.ticker_msgs)&&biogps.ticker_msgs.length>0){if(!c.hasClass("msg-over")){g=biogps.ticker_msgs[j];if(h.isVisible()){h.slideOut("b",{callback:i})}else{i()}}}}setInterval(function(){e=biogps.ticker_msgs[e+1]?e+1:0;f(e)},5000);f(0)}};biogps.setupUpdator=function(){var a={run:function(){biogps.callRemoteService({url:"/tickermsgs/",fn:function(c){var e=[{text:"Welcome to BioGPS site."}];if(c.reader.jsonData.cnt_user_all){e.push({text:String.format("There are currently {0} registered users.",c.reader.jsonData.cnt_user_all)})}if(c.reader.jsonData.cnt_newuser_lastweek&&c.reader.jsonData.cnt_newuser_lastweek>0){e.push({text:String.format("{0} new users registered in the last week.",c.reader.jsonData.cnt_newuser_lastweek)})}if(c.reader.jsonData.cnt_user_lastweek){e.push({text:String.format("There are {0} users visited BioGPS last week.",c.reader.jsonData.cnt_user_lastweek)})}if(c.reader.jsonData.cnt_plugins){e.push({text:String.format("There are {0} registered plugins in the plugin library.",c.reader.jsonData.cnt_plugins)})}if(c.reader.jsonData.cnt_layouts){e.push({text:String.format("BioGPS users have created {0} custom user layouts.",c.reader.jsonData.cnt_layouts)})}biogps.ticker_msgs=e},ignorefailure:true})},interval:300*1000};var b=new Ext.util.TaskRunner();b.start(a)};biogps.initLogo=function(){var a=Ext.get("biogps-logo");if(a){function c(){if(!biogps.logopanel){var f=a.getLeft();var e=a.getBottom();var g=9;biogps.logopanel=new Ext.Panel({id:"logopanel",layout:"fit",floating:true,renderTo:Ext.getBody(),shadow:false,x:f,y:e,width:172,height:83,html:String.format('<img width="100%" height="100%" src="/assets/img/logos/logo{0}.png" alt="logo" />',Math.ceil(Math.random()*100%g)),listeners:{render:function(h){h.el.fadeIn({duration:0.5})}}})}}function b(){if(biogps.logopanel){biogps.logopanel.el.fadeOut({duration:0.5,callback:function(){if(biogps.logopanel&&biogps.logopanel.destroy){biogps.logopanel.destroy()}biogps.logopanel=null}})}}a.hover(c,b,this)}};biogps.GENOMEASSEMBLY={hg18:"human",mm9:"mouse",rn4:"rat",dm3:"drosophila"};biogps.TAXONOMY_LIST=new Ext.data.SimpleStore({fields:["name","taxid"],data:[["human",9606],["mouse",10090],["rat",10116],["drosophila",7227]]});biogps.PLUGINKEYWORDS_common=[{key:"{{EntrezGene}}",text:"Entrez GeneID"},{key:"{{Symbol}}",text:"Symbol"},{key:"{{EnsemblGene}}",text:"Ensembl GeneID"},{key:"{{Unigene}}",text:"UniGene ID"},{key:"{{Uniprot}}",text:"Uniprot ID"},{key:"{{Refseq_mRNA}}",text:"RefSeq Transcript"},{key:"{{Refseq_protein}}",text:"RefSeq Protein"},{key:"{{PDB}}",text:"PDB ID"}];biogps.PLUGINKEYWORDS_other=[{key:"{{FLYBASE}}",text:"FLYBASE",allowedSpecies:["drosophila"]},{key:"{{assembly}}",text:"Genome Assembly"},{key:"{{genomelocation}}",text:"Genomic Location"},{key:"{{chr}}",text:"Chromosome"},{key:"{{gstart}}",text:"Genomic Start Position"},{key:"{{gend}}",text:"Genomic End Position"},{key:"{{Aliases}}",text:"Aliases"},{key:"{{HGNC}}",text:"HGNC",allowedSpecies:["human"]},{key:"{{HPRD}}",text:"HPRD",allowedSpecies:["human"]},{key:"{{MGI}}",text:"MGI",allowedSpecies:["mouse"]},{key:"{{MIM}}",text:"OMIM",allowedSpecies:["human"]},{key:"{{RATMAP}}",text:"RATMAP",allowedSpecies:["rat"]},{key:"{{RGD}}",text:"RGD",allowedSpecies:["rat"]},{key:"{{TAIR}}",text:"TAIR",allowedSpecies:["arabidopsis"]},{key:"{{WormBase}}",text:"WormBase",allowedSpecies:["c. elegans"]},{key:"{{ZFIN}}",text:"ZFIN",allowedSpecies:["zebrafish"]}];Ext.override(Ext.form.CheckboxGroup,{getRawValue:function(){var a=[];this.eachItem(function(b){if(b.checked){a.push(b.getRawValue())}});return a}});biogps.get_sessionid=function(){var c=document.cookie;var e="sessionid=";var b=c.indexOf(e);if(b==-1){return""}else{var f=b+e.length;var a=c.substring(b).indexOf(";");if(a==-1){return c.substring(f)}else{return c.substring(f,b+a)}}};function deepObjCopy(a){var b=new Object();if(typeof(a)=="object"){if(typeof(a.length)!="undefined"){var b=new Array()}for(var c in a){if(typeof(a[c])=="object"){b[c]=deepObjCopy(a[c])}else{if(typeof(a[c])=="string"){b[c]=a[c]}else{if(typeof(a[c])=="number"){b[c]=a[c]}else{if(typeof(a[c])=="boolean"){((a[c]==true)?b[c]=true:b[c]=false)}}}}}}return b}if(!Ext.isArray&&isArray){Ext.isArray=isArray}function isArray(){if(typeof arguments[0]=="object"){var a=arguments[0].constructor.toString().match(/array/i);return(a!=null)}return false}function isString(){if(typeof arguments[0]=="string"){return true}if(typeof arguments[0]=="object"){var a=arguments[0].constructor.toString().match(/string/i);return(a!=null)}return false}biogps.utils.toggleScrollbar=function(a,b){if(b){a.setStyle("overflow","hidden")}else{a.setStyle("overflow","auto")}};biogps.utils.loadGeneList=function(a){if(Ext.isArray(a)&&a.length>0&&biogps.genelist_panel){biogps.genelist_panel.loadFromGeneIDList(a)}};biogps.renderPluginBrowsePanel=function(a,e){var c=Ext.getCmp("center_panel");var i="pluginbrowse_panel";var b=c.getItem(i);var g=false;if(!b){b=c.add({title:"Plugin Library",id:i,closable:true,layout:"fit",autoScroll:true});var f=function(){if(Ext.get("pluginbrowse_panel")){biogps.renderPluginBrowsePanel(a=true)}};biogps.usrMgr.linkWithAuthentication(f);b.on("destroy",function(){biogps.usrMgr.unlinkWithAuthentication(f);biogps.currentPluginRenderer=null;delete biogps.currentPluginRenderer;var k;for(var j=0;j<Windows.windows.length;j++){k=Windows.windows[j];if(k.getId().startsWith("preview")){k.close()}}});g=true}biogps.centerTab.suspendEvents();biogps.centerTab.setActiveTab(b);biogps.centerTab.resumeEvents();if(g||a){var h=new Ext.LoadMask(biogps.centerTab.body,{msg:"Loading Plugin Library...",removeMask:true});h.show();b.load({url:"/plugin/browse",scripts:true,nocache:true,callback:function(l,n,j,k){if(n){if(initLibrary){initLibrary(e)}}else{biogps.ajaxfailure(null,j)}}})}else{biogps.currentLibrary.setActiveItem("library-home","breadcrumb")}};Ext.Element.addMethods({autoHeight:function(a,c,b,f){var e=this.getHeight();this.clip();this.setHeight(1);setTimeout(function(){var g=parseInt(this.dom.scrollHeight,10);if(!a){this.setHeight(g);this.unclip();if(typeof b=="function"){b()}}else{this.setHeight(e);this.setHeight(g,a,c,function(){this.unclip();if(typeof b=="function"){b()}}.createDelegate(this),f)}}.createDelegate(this),0);return this}});biogps.staticpage_data=new Ext.util.MixedCollection();biogps.staticpage_data.addAll([{title:"About BioGPS",id:"about",content:"/about/?mode=div"},{title:"Terms of Use",id:"terms",content:"/terms/?mode=div"},{title:"Help",id:"help",content:"/help/?mode=div"},{title:"FAQ",id:"faq",content:"/faq/?mode=div"},{title:"Downloads",id:"downloads",content:"/downloads/?mode=div"},{title:"Blog",id:"blog",icon:"/assets/img/blogger_16.gif",url:"http://biogps.blogspot.com/"},{title:"iPhone App",icon:"/assets/img/icons/phone.gif",id:"iphone",content:"/iphone/?mode=div"}]);biogps.showInfoPage=function(a){var e=biogps.staticpage_data.get(a);if(e){var b=Ext.getCmp("center_panel");var c="infotab_"+e.id;var f=b.getItem(c);if(!f){f=b.add({title:e.title,id:c,closable:true,autoScroll:true})}b.setActiveTab(f);f.load({url:e.content,scripts:true})}};biogps.initInfobar=function(){var a=Ext.get("info_bar");for(var c=0;c<biogps.staticpage_data.length;c++){var e=biogps.staticpage_data.get(c);var b=e.title;var b=e.icon?e.title+String.format('&nbsp;<img src="{0}">',e.icon):e.title;if(e.url){var f=a.createChild({tag:"a",id:"infobar_"+e.id,style:"padding-right:20px",href:e.url,target:"_blank",html:b})}else{var f=a.createChild({tag:"a",id:"infobar_"+e.id,style:"padding-right:20px",href:"#goto="+e.id,html:b});f.on("click",function(h,g){h.stopEvent();var i=biogps.staticpage_data.get(g.id.substring("infobar_".length));Ext.History.add("goto="+i.id);_gaq.push(["_trackPageview","/#"+i.id]);_gaq.push(["_trackEvent","BioGPS",i.id])},this)}}var f=a.createChild({tag:"a",style:"padding-right:20px",href:"javascript:void(null);",html:"Email updates"});f.on("click",function(g,h){biogps.subscribeGoogleGroups(g,Ext.get(h))},this)};biogps.subscribeGoogleGroups=function(a,e){if(biogps.subscribepanel){biogps.subscribepanel.destroy();return}biogps.subscribepanel=new Ext.ToolTip({target:e,bodyStyle:"background-color:white; padding: 3px 3px 5px 5px;",html:'<img src="http://groups.google.com/groups/img/3nb/groups_bar.gif" height=26 width=132 alt="Google Groups"><p style="padding-bottom:2px"><a href="http://groups.google.com/group/biogps-announce" target="_blank"><b>biogps-announce</b></a>: (low-volume list for news and announcements)</p><form action="http://groups.google.com/group/biogps-announce/boxsubscribe" target="_blank">&nbsp;&nbsp;&nbsp;&nbsp;Email: <input type=text name=email><button style="font-size: 8pt" type=submit name="sub"> Subscribe</button></form>',mouseOffset:[0,25],showDelay:10000000000,trackMouse:false,autoHide:false,closable:true,draggable:true});biogps.subscribepanel.on("destroy",function(){biogps.subscribepanel=null});biogps.subscribepanel.on("hide",function(){biogps.subscribepanel.destroy()});if(a.getXY){biogps.subscribepanel.targetXY=a.getXY()}else{biogps.subscribepanel.targetXY=[a.pageX,a.pageY]}var c=e.getX();var b=e.getY()-120;biogps.subscribepanel.showAt([c,b])};biogps.UserManager=function(a){Ext.apply(this,a);biogps.UserManager.superclass.constructor.call(this);this.userName=null;this.firstName=null;this.lastName=null;this.name=null;this.can_share=false;this.is_gnf_user=false;this.is_nvs_user=false;this.profile={};this.is_anonymoususer=true;this.authUrl="/auth/login/";this.loginbarEl="login-bar";this.loginEl="login";this.logoutEl="logout";this.logoutUrl="/authx/logout/";this.getuserdataUrl="/authx/getuserdata";this.saveprofileUrl="/authx/saveprofile";this.loginwin=null;this.addEvents({authenticateduser:true});this.addEvents({anonymoususer:true});this.addEvents({login:true});this.addEvents({logout:true})};Ext.extend(biogps.UserManager,Ext.util.Observable,{init:function(){this.on("authenticateduser",function(){biogps.dispatcher()});this.on("anonymoususer",function(){this.setAnonymousUser();biogps.dispatcher()});this.loadSavedUserData()},setAnonymousUser:function(){this.userName=null;this.firstName=null;this.lastName=null;this.name=null;this.can_share=false;this.is_gnf_user=false;this.is_nvs_user=false;this.profile={};this.profile.defaultlayout=biogps.LayoutMgr.defaultlayout_for_anonymoususer;biogps.LayoutMgr.loadAllLayout({layout_id:biogps.alt_defaultlayout});this.is_anonymoususer=true;this.fireEvent("logout")},doLogin:function(){Ext.getCmp("loginform").getForm().submit({url:this.authUrl,method:"POST",success:function(a,b){afterLogin(b.result.data)},failure:function(a,b){Ext.MessageBox.hide();Ext.MessageBox.show({title:"Error",msg:"Network Error! Try again.",buttons:Ext.Msg.OK,icon:Ext.MessageBox.ERROR});Ext.getBody().dom.innerHTML=b.response.responseText}})},loginSuccess:function(b){this.is_anonymoususer=false;this.userName=b.username;this.firstName=b.firstname;this.lastName=b.lastname;this.name=b.name;this.can_share=b.can_share||false;this.is_gnf_user=b.is_gnf_user||false;this.is_nvs_user=b.is_nvs_user||false;if(isString(b.profile)){this.profile=Ext.util.JSON.decode(b.profile)}else{this.profile=b.profile}biogps.LayoutMgr.loadAllLayout({layout_id:biogps.alt_defaultlayout});var a=String.format('<div>Hello&nbsp;<a href="/profile/" title="Manage your account in a new window"><span id="login_div_username">{0}</span></a>&nbsp;/&nbsp;<a id="logout" href="javascript:biogps.usrMgr.logout()">Logout</a></div>',this.firstName||this.userName);Ext.get(this.loginbarEl).update(a,false,function(){var c=Ext.get("login_div_username");if(c){var e=100;while(c.getTextWidth()>110&&e>70){e=e-1;c.setStyle({"font-size":e.toString()+"%"})}}});this.fireEvent("login")},loginFail:function(){Ext.MessageBox.show({title:"Error",msg:"Login failed! Please try again.",buttons:Ext.Msg.OK,icon:Ext.MessageBox.ERROR,fn:function(){var a=Ext.getCmp("loginform").form;a.reset();a.items.get(0).focus()}})},updateUserInfo:function(){},saveUserProfile:function(a){if(a==null){a={}}a.showmsg=(a.showmsg==null)?true:a.showmsg;a.msg=(a.msg==null)?"Your profile was just saved!":a.msg;biogps.callRemoteService({url:this.saveprofileUrl,params:{userprofile:Ext.util.JSON.encode(this.profile)},fn:function(b){var c=b.reader.jsonData;if(c.success){if(a.showmsg){biogps.showmsg("",a.msg)}if(a.callback){a.callback.call(a.scope||this)}}else{biogps.showmsg("","Your profile failed to save!")}},method:"POST",scope:this})},addSharedLayout:function(a){if(!this.profile.sharedlayouts.include(a)){this.profile.sharedlayouts.push(a);this.saveUserProfile({msg:'Your "shared layouts" list was updated!',callback:function(){biogps.LayoutMgr.loadAllLayout({noEventFired:true})},scope:this})}},removeSharedLayout:function(a){if(this.profile.sharedlayouts.include(a)){this.profile.sharedlayouts.remove(a);this.saveUserProfile({msg:'Your "shared layouts" list was updated!',callback:function(){biogps.LayoutMgr.loadAllLayout({noEventFired:true})},scope:this})}},logout:function(){var a=new Ext.data.JsonStore({url:this.logoutUrl,fields:[],autoLoad:true});a.on("load",function(b){this.setAnonymousUser();this.setLoginLink();this.setWelcomeLogout();this.fireEvent("logout")},this);a.on("loadexception",biogps.ajaxfailure2,this)},loadSavedUserData:function(){var b=Ext.get(this.loginbarEl);var a=b.createChild({tag:"div",cls:"loading-indicator",html:"Checking user..."});var c=new Ext.data.JsonStore({url:this.getuserdataUrl,fields:[],autoLoad:true});c.on("load",function(f){a.remove();var e=f.reader.jsonData;if(e.username){this.is_anonymoususer=false;this.loginSuccess(e);this.fireEvent("authenticateduser")}else{this.setLoginLink();this.is_anonymoususer=true;this.fireEvent("anonymoususer")}},this);c.on("loadexception",biogps.ajaxfailure,this)},setLoginLink:function(){this.setLoginLink_newpage()},setLoginLink_newpage:function(){Ext.get(this.loginbarEl).update('<div><a id="login" href="javascript:biogps.usrMgr.gotoLoginPage()">Login here</a>&nbsp;or&nbsp;<a href="/auth/signup">Sign up</a></div>')},gotoLoginPage:function(){var a="/auth/login?next="+encodeURIComponent(window.location.href);window.location=a},setLoginLink_inpage:function(){Ext.get(this.loginbarEl).update('<a id="login" href="javascript:biogps.usrMgr.showLoginWin()"><b>Login here</b></a>&nbsp;or&nbsp;<a href="/auth/signup"><b>Sign up</b></a>')},setWelcomeLogout:function(){Ext.get("welcome-loggedin").update('<h4>Logged Out</h4><p>Your session has ended.<br><br><a href="/auth/login/">Login again</a></p>')},maskForAnonymous:function(a){var e=a.targetEl;var c=a.msg;var b=a.msg2;var f="<b>"+c+"</b>";f+="<br />Either <a href='javascript:biogps.usrMgr.gotoLoginPage()';>login</a> or <a href='/auth/signup'>create a free account</a>.<br />";if(b){f+="<br />"+b}e.mask(f,"maskBox")},showLoginWin:function(b){var a=b||Ext.get(this.loginEl);if(!this.loginwin){this.loginwin=new biogps.LoginWin()}this.loginwin.show(a)},linkWithAuthentication:function(b,a){this.on("login",b,a);this.on("logout",b,a)},unlinkWithAuthentication:function(b,a){this.un("login",b,a);this.un("logout",b,a)}});biogps.usrMgr=new biogps.UserManager();biogps.LoginWin=function(a){Ext.apply(this,a);this.loginform=new Ext.FormPanel({id:"loginform",labelWidth:75,autoHeight:true,bodyStyle:"padding:5px 5px 5px 5px",width:320,border:false,plain:true,items:[{xtype:"fieldset",title:"BioGPS user account",autoHeight:true,items:[{xtype:"textfield",fieldLabel:"Username",id:"loginfield_username",name:"username",width:210,allowBlank:true},{xtype:"textfield",fieldLabel:"Password",id:"loginfield_password",name:"password",width:210,inputType:"password",allowBlank:false},{xtype:"checkbox",boxLabel:"Remember me on this computer.",name:"remember",border:false,labelSeparator:""}]}],buttons:[{text:"Login",id:"login_button",handler:function(){this.doLogin()},scope:this},{text:"Close",handler:function(){this.hide()},scope:this}]});biogps.LoginWin.superclass.constructor.call(this,{title:"User login",layout:"fit",width:360,height:200,autoHeight:true,plain:true,modal:true,stateful:false,closeAction:"hide",listeners:{show:{buffer:10,fn:function(c){this.loginform.form.items.get(0).focus();var b=new Ext.KeyMap(c.items.get(0).getEl(),{key:13,stopEvent:true,fn:function(){this.doLogin()},scope:c})}}},items:[this.loginform]})};Ext.extend(biogps.LoginWin,Ext.Window,{doLogin:function(){if(!this.loginform.form.isValid()){Ext.MessageBox.show({title:"Error",msg:"Wrong input! Correct and try again.",buttons:Ext.Msg.OK,icon:Ext.MessageBox.ERROR})}else{this.body.mask("Authenticating...");this.loginform.form.submit({url:biogps.usrMgr.authUrl,method:"POST",success:function(a,c){this.body.unmask();var b=c.result.data;if(b.name!="Bad Login"){this.hide();biogps.usrMgr.loginSuccess(b)}else{biogps.usrMgr.loginFail()}},failure:function(a,b){this.body.unmask();biogps.formfailure(b,"Network Error! Try again.",function(){a.reset()})},scope:this})}}});biogps.Gene=function(a){this.id="";Ext.apply(this,a);biogps.Gene.superclass.constructor.call(this);this.addEvents({beforeload:true});this.addEvents({load:true});this.fireEvent("beforeload")};Ext.extend(biogps.Gene,Ext.util.Observable,{load:function(a){biogps.callRemoteService({url:"/boc/getgeneidentifiers/?format=json&geneid="+(a||this.id),fn:function(b){Ext.apply(this,b.reader.jsonData);this.fireEvent("load",this)},scope:this})},getEntryGene:function(c){var g=null;if(isArray(c)){g=c}else{if(isString(c)){g=[c]}else{if(this.EntrySpecies){g=[this.EntrySpecies]}else{g=this.SpeciesList}}}var e=null;if(g&&this.EntryGeneID){for(var b=0;b<g.length;b++){var f=this[g[b]];if(isArray(f)){for(var a=0;a<f.length;a++){if((f[a].EntrezGene==this.EntryGeneID)||(f[a].EnsemblGene==this.EntryGeneID)){return f[a]}}}}}}});biogps.loadSampleGene=function(a){var e,f,c,b;e=a.id||1017;f=a.callback||Ext.emptyFn;c=a.scope;b=a.species;if(b&&biogps.SAMPLE_GENE&&biogps.SAMPLE_GENE[b]){e=biogps.SAMPLE_GENE[b]}if(!(biogps.sample_gene&&biogps.sample_gene.id==e)){biogps.sample_gene=new biogps.Gene({id:e});biogps.sample_gene.on("load",f,c);biogps.sample_gene.load()}else{f.call(c)}};biogps.Plugin=function(a){this.id="";this.title="";this.url="";this.author="";this.author_url="";this.type="iframe";this.description="";this.options={};this.useroptions=null;this.runtimeoptions=null;this.permission=null;this.lastmodified="";this.tags="";this.usage_percent={};this.left;this.top;this.width;this.height;this.separator="+";Ext.apply(this,a);if(this.options&&isString(this.options)){this.options=Ext.util.JSON.decode(this.options)}if(this.options==""|this.options==null){this.options={}}biogps.Plugin.superclass.constructor.call(this);if(this.useroptions&&this.useroptions.currentSpecies){this.runtimeoptions=this.runtimeoptions||{};this.runtimeoptions.currentSpecies=this.useroptions.currentSpecies}this.addEvents({load:true});this.addEvents({keyworderror:true});this.addEvents({error:true});this.is_secure_cookie_set=function(){var b=document.cookie.split(";").walk(function(c){return c.trim()});return b.indexOf("secure_plugin_client_session="+biogps.get_sessionid())!=-1};this.set_secure_cookie=function(){if(!this.is_secure_cookie_set()){biogps.callRemoteService({url:"/utils/d9d7fd01be668950e3ea61c574e8eca9/",fn:function(){this.fireEvent("secure_cookie_set")},scope:this})}}};Ext.extend(biogps.Plugin,Ext.util.Observable,{load:function(a){a=a||this.id;biogps.callRemoteService({url:"/plugin/"+a.toString()+"/",fn:function(b){var c=b.reader.jsonData;if(c.totalCount==1){this.id=c.items[0].pk;this.title=c.items[0].fields.title;this.url=c.items[0].fields.url;this.author=c.items[0].fields.author;this.author_url=c.items[0].fields.author_url;this.type=c.items[0].fields.type;this.description=c.items[0].fields.description;if(c.items[0].fields.options===null){this.options={}}else{if(isString(c.items[0].fields.options)&&(c.items[0].fields.options!="")){this.options=Ext.util.JSON.decode(c.items[0].fields.options)}else{this.options=c.items[0].fields.options}}this.permission=c.items[0].fields.permission;this.lastmodified=c.items[0].fields.lastmodified;this.created=c.items[0].fields.created;this.tags=c.items[0].fields.tags;this.is_shared=c.items[0].fields.is_shared;this.usage_percent=c.items[0].fields.usage_percent;this.fireEvent("load",this)}else{this.fireEvent("loadfailed",a)}},scope:this})},getKeywords:function(a){a=a||this.url;if(a){var b=a.match(/(\{\{[\w|]+\}\})/g);return b}else{return null}},getPreviewUrl:function(){return this.geturl(biogps.sample_gene)},geturl:function(j){var e=null;var g;var h;if(j){var f=this.getKeywords();if(f&&f.length>0){var c=this.getCurrrentSpecies(j,true);if(c){this.current_species=c;var a=j[c][0];e=this.url;if(a){for(var b=0;b<f.length;b++){g=f[b];h=g.substring(2,g.length-2);h.split("|").each(function(i){i=i.trim();if(a[i]){var l=a[i];if(isArray(l)){l=l.join(this.separator)}e=e.replace(g,l)}},this)}}}}}else{throw new Ext.Error("no-sample-gene","plugin.geturl(gene) was called without a value for 'gene'.")}if(this.getKeywords(e)!=null){this.fireEvent("keyworderror");return}else{if(this.options.securityAware==true){this.set_secure_cookie()}}return e},isValidUrl:function(){return(this.validateUrl()==true)},validateUrl:function(){var e=true;var h=null;var b=this.getKeywords();if(b&&Ext.isArray(b)){var g=[];var c,f;biogps.PLUGINKEYWORDS_common.concat(biogps.PLUGINKEYWORDS_other).each(function(i){g.push(i.key.substring(2,i.key.length-2))});g.push("EntrezGeneID");for(var a=0;a<b.length;a++){c=b[a];f=c.substring(2,c.length-2);f.split("|").each(function(i){if(g.indexOf(i.trim())==-1){e=false}h=String.format('Un-recognized keyword: "{0}".',i)})}}if(e){return true}else{return h}},hasPositioning:function(){return(this.top&&this.left&&this.width&&this.height)!=null},getPositioning:function(){return{left:this.left,top:this.top,width:this.width,height:this.height}},isOneSpeciesOnly:function(){return(this.options.allowedSpecies!=null&&this.options.allowedSpecies.length==1)},getAllowedSpecies:function(a){var b=this.options.allowedSpecies?this.options.allowedSpecies:biogps.AVAILABLE_SPECIES;if(b.length>1&&a==true&&this.useroptions&&this.useroptions.speciesOnly&&b.indexOf(this.useroptions.speciesOnly)!=-1){b=[this.useroptions.speciesOnly]}return b},isSpeciesAllowed:function(a){return(this.getAllowedSpecies().indexOf(a)!=-1)},getAvailableSpecies:function(g,a){var b=this.getAllowedSpecies(a);var e=[];var f=g.SpeciesList;if(f){for(var c=0;c<b.length;c++){if(f.indexOf(b[c])!=-1){e.push(b[c])}}}return e},getCurrrentSpecies:function(e,a){var b=this.getAvailableSpecies(e,a);var c=null;if(this.runtimeoptions&&this.runtimeoptions.currentSpecies&&b.indexOf(this.runtimeoptions.currentSpecies)!=-1){c=this.runtimeoptions.currentSpecies}else{if(b.length>0){if(e.EntrySpecies&&b.indexOf(e.EntrySpecies)!=-1){c=e.EntrySpecies}else{c=b[0]}}}return c},getAllowedSpeciesOnKeyword:function(){var e=null;var b=this.getKeywords();if(b&&Ext.isArray(b)){var c,g;var f=new Ext.util.MixedCollection(false,function(h){return h.key.substring(2,h.key.length-2)});f.addAll(biogps.PLUGINKEYWORDS_common.concat(biogps.PLUGINKEYWORDS_other));for(var a=0;a<b.length;a++){c=b[a];g=c.substring(2,c.length-2);g.split("|").each(function(i){var h=f.get(i);if(h&&Ext.isArray(h.allowedSpecies)){e=h.allowedSpecies}})}}return e},formatPermission:function(){var a="";if(this.permission){if(this.permission.R){if(this.permission.R.indexOf("BioGPS Users")>=0){a="biogpsusers"}else{if(this.permission.R.indexOf("Novartis Users")>=0){a="novartisusers"}else{if(this.permission.R.indexOf("GNF Users")>=0){a="gnfusers"}}}}else{if(this.permission.F){a="friendusers"}}}else{a="myself"}return a},render_preview:function(c,b){if(!b){if(this.type=="iframe"){var a=this.geturl(c);if(a){window.open(a,"","scrollbars=yes,menubar=no,height=600,width=800,resizable=yes,toolbar=no,location=no,status=no")}}}else{}},preview:function(a){if(biogps.sample_gene){this.render_preview(biogps.sample_gene,a)}else{biogps.sample_gene=new biogps.Gene({id:1017});biogps.sample_gene.on("load",function(b){this.render_preview(b,a)},this);biogps.sample_gene.load()}},show:function(a){},showFlagAsInappropriateForm:function(a){if(this.id){if(!this.flagformwin){this.flagformwin=new Ext.Window({title:"Flag plugin",layout:"fit",width:380,labelWidth:150,constrain:true,constrainHeader:true,renderTo:a,autoHeight:true,stateful:false,plain:true,ownerCmp:this,listeners:{show:{buffer:0,fn:function(c){c.center();setTimeout(function(){c.items.get(0).items.get(0).focus()},10);var b=new Ext.KeyMap(c.getEl(),[{key:13,stopEvent:true,fn:function(){this.ownerCmp.flagAsInappropriate()},scope:c}])}}},items:[new Ext.FormPanel({id:"newlayoutform",labelWidth:120,autoHeight:true,bodyStyle:"padding:5px 5px 5px 5px",border:false,items:[{xtype:"label",html:"<b>Note:</b>&nbsp;If you believe that the content displayed in this plugin are inappropriate or irrelevant, please enter a brief description below.  Flagged plugins will be reviewed by a moderator. <br/><br/>"},{xtype:"radiogroup",fieldLabel:"Reason:",labelSeparator:"",hidden:false,disabled:false,columns:1,vertical:true,items:[{inputValue:"broken",name:"reason",boxLabel:"Broken plugin",checked:true},{inputValue:"inappropriate",boxLabel:"Inappropriate or offensive content",name:"reason",checked:false}]},{fieldLabel:"Your comments (optional)",xtype:"textarea",anchor:"90%",name:"comment",value:"",allowBlank:true},{xtype:"label",hidden:true,style:"color:red"}],buttons:[{text:"Flag now",handler:this.flagAsInappropriate,scope:this},{text:"Cancel",handler:function(){this.flagformwin.destroy()},scope:this}]})]})}this.flagformwin.on("destroy",function(){this.flagformwin=null},this);this.flagformwin.show();biogps.flagformwin=this.flagformwin}},flagAsInappropriate:function(){if(this.id&&this.flagformwin){var b=this.flagformwin.items.get(0);var a=this.flagformwin.items.get(0).items.get(3);if(b&&a){a.show();a.setText("Submitting...");b.form.submit({url:String.format("/plugin/{0}/flag/",this.id),method:"POST",timeout:60,success:function(c,e){if(e.result&&e.result.success){if(e.result.msg){a.setText(e.result.msg)}else{a.setText("Success.")}b.buttons[0].disable();b.buttons[1].setText("Done!")}},failure:function(c,e){biogps.formfailure(e,"Submitting flag failed!")}})}}},join:function(a){this.store=a}});biogps.Layout=function(a){this.id="";this.layout_name="";this.author="";this.description="";this.created="";this.lastmodified="";this.layout_data=[];Ext.apply(this,a);biogps.Layout.superclass.constructor.call(this);this.addEvents({beforeload:true,load:true,loadfailed:true,saved:true,savefailed:true,"delete":true,deletefailed:true,pluginadded:true,pluginaddfailed:true});this.layout_modified=false};Ext.extend(biogps.Layout,Ext.util.Observable,{load:function(b,a){b=b||this.id;a=a?1:0;if(b){this.fireEvent("beforeload");biogps.callRemoteService({url:String.format("/layout/{0}/?loadplugin={1}",b,a),fn:function(c){if(c.reader.jsonData.totalCount!=1){this.fireEvent("loadfailed",b)}else{var e=c.reader.jsonData.items[0].fields;e.id=c.reader.jsonData.items[0].pk;if(isString(e.layout_data)){e.layout_data=Ext.util.JSON.decode(e.layout_data)}Ext.apply(this,e);this.fireEvent("load",this)}},scope:this})}},isMyLayout:function(){return !this.isSharedLayout()},isSharedLayout:function(){return(this.is_shared==true)},isDefault:function(){return(this.layout_id==biogps.usrMgr.profile.defaultlayout)},save:function(){var b={layout_id:this.id,layout_name:this.layout_name,description:this.description,layout_data:Ext.util.JSON.encode(this.layout_data)};var a=new Ext.data.JsonStore({url:"/layout/update/",baseParams:b,method:"POST",fields:[],autoLoad:true});a.on("load",function(){var c=a.reader.jsonData;if(c.success){this.fireEvent("saved",c)}else{this.fireEvent("savefailed",c)}},this);a.on("loadexception",biogps.ajaxfailure,this)},saveas:function(b){var c={layout_name:b||this.layout_name,description:this.description,layout_data:Ext.util.JSON.encode(this.layout_data)};var a=new Ext.data.JsonStore({url:"/layout/add/",baseParams:c,method:"POST",fields:[],autoLoad:true});a.on("load",function(){var e=a.reader.jsonData;if(e.success){this.fireEvent("saved",e)}else{this.fireEvent("savefailed",e)}},this);a.on("loadexception",biogps.ajaxfailure,this)},"delete":function(){var a=new Ext.data.JsonStore({url:"/layout/delete/",baseParams:{layout_id:this.id},method:"POST",fields:[],autoLoad:true});a.on("load",function(b){var c=b.reader.jsonData;if(c.success){this.fireEvent("deleted",this)}else{this.fireEvent("deletefailed",c)}},this);a.on("loadexception",biogps.ajaxfailure,this)},addPlugin:function(a){if(isArray(this.layout_data)){this.layout_data.push({id:a.id})}this.on("saved",function(){this.fireEvent("pluginadded")},this);this.on("savefailed",function(){this.fireEvent("pluginaddfailed")},this);this.save()},quickAddPlugin:function(a){var c=Math.round(Math.random()*225),b=Math.round(Math.random()*400),e={id:a.id,author:a.author,author_url:a.author_url,title:a.title,url:a.url,type:a.type,options:a.options,description:a.description,lastmodified:a.lastmodified,top:c,left:b,width:350*2,height:250};if(isArray(this.layout_data)){this.layout_data.push(e)}this.layout_modified=true;biogps.GeneReportMgr.updateAll()},quickAddPlugin_byID:function(b){var a=new biogps.Plugin({id:b});a.on("load",function(c){this.quickAddPlugin(c)},this);a.on("loadfailed",function(c){biogps.error(String.format('Failed to load plugin by id "{0}".',c))},this);a.load()}});biogps.LayoutMgr=function(a){this.currentLayout=null;this.availableLayouts=null;this.currentLayoutLoaded=false;this.availableLayoutsLoaded=false;this.layoutloading=false;this.layoutchanged=false;this.defaultlayout_for_anonymoususer=83;this.addEvents({currentlayoutloaded:true});this.addEvents({currentlayoutloadingfailed:true});this.addEvents({availablelayoutupdated:true});this.addEvents({layoutloaded:true})};Ext.extend(biogps.LayoutMgr,Ext.util.Observable,{loadLayout:function(b){var a=new biogps.Layout({id:b});a.on("load",function(){this.currentLayout=a;this.currentLayoutLoaded=true;this.fireEvent("currentlayoutloaded")},this);a.on("loadfailed",function(c){this.currentLayoutLoaded=true;this.fireEvent("currentlayoutloaded")},this);this.currentLayoutLoaded=false;a.load(b,true)},loadAvailableLayout:function(){var a=new Ext.data.Store({proxy:new Ext.data.HttpProxy({url:"/layoutlist/all/?userselected=1",method:"GET"}),autoload:true,reader:new Ext.data.JsonReader({id:"pk",root:"items",fields:[{name:"layout_name",mapping:"fields.layout_name",type:"string"},{name:"layout_data",mapping:"fields.layout_data"},{name:"author",mapping:"fields.author",type:"string"},{name:"author_url",mapping:"fields.author_url",type:"string"},{name:"description",mapping:"fields.description",type:"string"},{name:"is_shared",mapping:"fields.is_shared",type:"boolean"},{name:"lastmodified",mapping:"fields.lastmodified",type:"date",dateFormat:"Y-m-d H:i:s"},{name:"created",mapping:"fields.created",type:"date",dateFormat:"Y-m-d H:i:s"}]})});a.setDefaultSort("layout_name","desc");a.on("load",function(b){var f=[];var e;for(var c=0;c<b.getCount();c++){e=new biogps.Layout(b.getAt(c).data);if(isString(e.layout_data)){e.layout_data=Ext.decode(e.layout_data)}f.push(e);f[c].id=b.getAt(c).id}this.availableLayouts=f;this.availableLayoutsLoaded=true;this.fireEvent("availablelayoutupdated")},this);a.on("loadexception",biogps.ajaxfailure,this);this.availableLayoutsLoaded=false;a.load()},loadAllLayout:function(a){if(a&&a.layout_id){var b=a.layout_id}else{var b=biogps.usrMgr.profile.defaultlayout}this.layoutloading=true;this.on("currentlayoutloaded",function(){if(this.availableLayoutsLoaded){this.layoutchanged=false;this.layoutloading=false;if(!(a&&a.noEventFired)){this.fireEvent("layoutloaded")}}biogps.clearListeners(this,"currentlayoutloaded")},this);this.on("availablelayoutupdated",function(){if(this.currentLayoutLoaded){this.layoutchanged=false;this.layoutloading=false;if(!(a&&a.noEventFired)){this.fireEvent("layoutloaded")}}biogps.clearListeners(this,"availablelayoutupdated")},this);this.loadLayout(b);this.loadAvailableLayout()},reloadAvailableLayout:function(){var a=function(){biogps.GeneReportMgr.markLayoutChanged();this.un("availablelayoutupdated",a)};this.on("availablelayoutupdated",a,this);this.loadAvailableLayout()},createNewLayout:function(){}});biogps.LayoutMgr=new biogps.LayoutMgr();biogps.renderPluginBrowsePanel=function(a,c){var h="pluginbrowse_panel";var b=biogps.centerTab.getItem(h);var f=false;if(!b){b=biogps.centerTab.add({title:"Plugin Library",id:h,closable:true,layout:"fit",autoScroll:true});var e=function(){if(Ext.get("pluginbrowse_panel")){biogps.renderPluginBrowsePanel(a=true)}};biogps.usrMgr.linkWithAuthentication(e);b.on("destroy",function(){biogps.usrMgr.unlinkWithAuthentication(e);biogps.currentPluginRenderer=null;delete biogps.currentPluginRenderer});f=true}biogps.centerTab.suspendEvents();biogps.centerTab.setActiveTab(b);biogps.centerTab.resumeEvents();if(f||a){var g=new Ext.LoadMask(biogps.centerTab.body,{msg:"Loading Plugin Library...",removeMask:true});g.show();b.load({url:"/plugin/browse",scripts:true,nocache:true,callback:function(k,l,i,j){if(l){if(initLibrary){initLibrary(c)}}else{biogps.ajaxfailure(null,i)}}})}else{biogps.currentLibrary.setActiveItem("library-home","breadcrumb")}};biogps.PluginLibrary=function(a){this.id="";this.currentItem="library-home";this.mask=new Ext.LoadMask("pluginbrowse_panel",{msg:"Loading plugin data..."});this.mask.show();Ext.apply(this,a);biogps.currentLibrary=this;biogps.PluginLibrary.superclass.constructor.call(this)};Ext.extend(biogps.PluginLibrary,Ext.Panel,{setActiveItem:function(r,p){var h=Ext.getCmp("library-add");var e=Ext.getCmp("library-browse");var b=Ext.getCmp("library-plugin");var a=Ext.getCmp("library-header");var k=Ext.getCmp("library-search");var i=Ext.getCmp("library-home");var j=Ext.getCmp("library-edit");var c=Ext.getCmp("btn-library-home");var q=Ext.getCmp("btn-library-browse");var n=Ext.getCmp("btn-library-plugin");var g=Ext.getCmp("btn-library-edit");var f=Ext.getCmp("btn-library-add");i.hide();e.hide();b.hide();j.hide();h.hide();c.removeClass("activeBreadcrumb");q.removeClass("activeBreadcrumb");n.removeClass("activeBreadcrumb");g.removeClass("activeBreadcrumb");f.removeClass("activeBreadcrumb");if(r=="library-home"){a.show();if(p=="delete"){n.hide();g.hide()}}else{a.hide()}if(r=="library-browse"){Ext.getCmp("library-browse-nav").show();q.show();if(p!="breadcrumb"){n.hide();g.hide()}}else{Ext.getCmp("library-browse-nav").hide()}if(r=="library-plugin"){n.show();if(p=="library-home"){q.hide()}if(p!="breadcrumb"){g.hide()}}if(r=="library-edit"){g.show()}if(r=="library-add"||r=="library-edit"){Ext.getCmp("library-search").hide()}else{Ext.getCmp("library-search").show()}if(r=="library-add"&&biogps.usrMgr.is_anonymoususer){h.on("show",function(){biogps.usrMgr.maskForAnonymous({targetEl:h.body,msg:"You must be logged in to add a plugin.",msg2:"Or you can go <a href='javascript:navHandler(\"home\");'>back to the Library</a>."})},this)}Ext.getCmp(r).show();var l="btn-"+r;Ext.getCmp(l).addClass("activeBreadcrumb");this.currentItem=r;this.hash_history();this.setSize();this.ownerCt.doLayout(true);this.libDone();return true},libLoading:function(){this.mask.show()},libDone:function(){this.mask.hide()},hash_history:function(){var a="goto=pluginlibrary&t="+this.currentItem;if((this.currentItem=="library-plugin"||this.currentItem=="library-edit")&&this.plugin){a=a+"&p="+this.plugin.id}else{if(this.currentItem=="library-browse"){var b={sort:biogps.pluginStore.lastOptions.params.mysort,start:biogps.pluginStore.lastOptions.params.start,limit:biogps.pluginStore.lastOptions.params.limit,scope:biogps.pluginStore.lastOptions.params.scope,dir:biogps.pluginStore.lastOptions.params.dir};if(biogps.pluginStore.lastOptions.params.search){b.search=biogps.pluginStore.lastOptions.params.search}else{if(biogps.pluginStore.lastOptions.params.tags){b.tags=biogps.pluginStore.lastOptions.params.tags}}a=a+"&"+Ext.urlEncode(b)}}Ext.History.suspendEvents();biogps.centerTab.suspendEvents();Ext.History.add(a,true);biogps.setTitle("pluginlibrary");setTimeout("Ext.History.resumeEvents()",60);biogps.centerTab.resumeEvents()},dispatcher_by_params:function(b){if(b.t){if(b.t=="library-plugin"||b.t=="library-edit"){if(b.p){if(!(this.plugin&&b.p==this.plugin.id)){this.renderPluginById(b.p,"history")}else{this.setActiveItem(b.t,"history")}}}else{if(b.t=="library-browse"){var a={params:{mysort:b.sort,start:parseInt(b.start),limit:parseInt(b.limit),scope:b.scope,dir:b.dir}};if(b.search){a.params.search=b.search}else{if(b.tags){a.params.tags=b.tags}}biogps.pluginStore.load(a);this.setActiveItem(b.t,"history")}else{this.setActiveItem(b.t,"history")}}}else{this.setActiveItem("library-home","history")}},setBrowseTitle:function(b){var a=b+" &nbsp; &raquo;";Ext.getCmp("btn-library-browse").setText(a);Ext.getCmp("library-browse").setTitle(b)},setPluginTitle:function(b){var a=b;Ext.getCmp("btn-library-plugin").setText(a)},setPluginEditTitle:function(b){var a="&raquo; &nbsp; Edit "+b;Ext.getCmp("btn-library-edit").setText(a)},queryPlugins:function(a){if(a){a.cancelBubble=true}var e=Ext.getCmp("library-search").getForm().getValues();var f=e.query.trim();var c=null;if(f&&f!="Search the Plugin Library"){c="all";var b={params:{search:f,scope:c}};biogps.pluginStore.load(b);this.setActiveItem("library-browse","library-home");_gaq.push(["_trackPageview","/pluginlibrary/search/?query="+f])}return false},browsePluginsBy:function(b,c){if(b){var a={params:{mysort:b}};biogps.pluginStore.load(a);this.setActiveItem("library-browse",c);_gaq.push(["_trackPageview","/pluginlibrary/browse/"])}},browsePluginsByTag:function(a,c){if(a){var b={params:{tags:a}};biogps.pluginStore.load(b);this.setActiveItem("library-browse",c);_gaq.push(["_trackPageview","/pluginlibrary/search/?tag="+query])}},sortPluginList:function(c,b){if(c&&b){var a=biogps.pluginStore.lastOptions;a.params.mysort=c;a.params.dir=b;biogps.pluginStore.load(a)}},renderPluginById:function(i,h){var g,c,b,e,a,f;a=f=false;if(i){c=function(){a=true;e.call(this)};b=function(j){f=true;biogps.loadSampleGene({species:(j.options&&j.options.allowedSpecies&&Ext.isArray(j.options.allowedSpecies))?j.options.allowedSpecies[0]:null,callback:c,scope:this})};postPluginLoadFail=function(j){this.libDone();Ext.MessageBox.show({title:"Plugin Not Found",msg:"Oops! This plugin may not exist or you may not have permission to use it.",buttons:Ext.Msg.OK,icon:Ext.MessageBox.ERROR})};e=function(){if(a&&f){this.plugin=g;markup=this.markupPluginTemplate(g,"large");Ext.getCmp("library-plugin").el.update(markup);if(!biogps.usrMgr.is_anonymoususer){var l=new Ext.Button({text:"&nbsp; Add to my Layout &nbsp;",handler:this.showAddToLayoutMenu,applyTo:"plugin-add-to-layout",scale:"medium",cls:"add-to-layout-btn",scope:this});var j=Ext.get("flag-button");j.on("click",function(){g.showFlagAsInappropriateForm(this.el)},this);j.show();if(!g.is_shared){var p=new Ext.Button({text:"Edit this plugin",handler:this.showPluginEditForm.createDelegate(this,[g]),applyTo:"plugin-add-to-layout",scope:this})}}else{note=Ext.get("plugin-add-to-layout");note.insertHtml("beforeEnd","Login to use this plugin in a layout.");note.addClass("login-note")}if(g.type=="div"){var k=g.getPreviewUrl(),n=false;k=k+"&container=library-plugin-preview";if(k.startsWith("http://")){n=k.startsWith("http://plugins.gnf.org/");k="/utils/proxy?url="+k.replace("&","%26");if(this.plugin.options.securityAware){k+="&secure=1"}}else{n=true}Ext.get("library-plugin-preview").load({url:k,scripts:n})}this.setPluginTitle(g.title);this.setActiveItem("library-plugin",h);_gaq.push(["_trackPageview","/pluginlibrary/plugin/"+g.id])}};this.libLoading();g=new biogps.Plugin({id:i});g.on("load",b,this);g.on("loadfailed",postPluginLoadFail,this);g.load()}},markupPluginTemplate:function(h,e){if(h&&e){var c=h.getAllowedSpecies().join(", ");var g="";if(h.tags){var b=new Array();h.tags.split(" ").each(function(i){b.push("<a href=\"javascript:biogps.currentLibrary.browsePluginsByTag('"+i+"','library-plugin')\" title=\"click to view plugins with this tag\">"+i+"</a>")});g=b.join(" | ")}else{g="none"}var f={url:this.markHighlight(h.url),previewUrl:h.getPreviewUrl(),id:h.id,title:this.markHighlight(h.title),description:this.markHighlight(h.description),author:this.markHighlight(h.author),author_url:h.author_url,rolepermission:this.plugin.formatPermission(),lastmodified:h.lastmodified,created:h.created,tags:g,allowedspecies:c,usage:h.usage_percent,mobile_url:false,certified_owner:false};if(h.options){if(h.options.mobile_url){f.mobile_url=h.options.mobile_url}if(h.options.certified_owner){f.certified_owner=h.options.certified_owner}}var a=biogps.pluginTpls[e].apply(f);return a}},markHighlight:function(c){var e=["red","blue","green","aqua","purple","fuchsia","black","gray","lime","maroon","navy","olive","silver","teal"];if(this.highlight){var a;for(var b=0;b<this.highlight.length;b++){a=e[b%e.length];c=c.replace(new RegExp("("+this.highlight[b].trim()+")","gi"),'<span class="highlight" style="color:'+a+';">$1</span>')}}return c},showPluginEditForm:function(c){if(!c){return false}var b=new biogps.PluginEditPanel({id:"pluginmodify_"+c.id.toString(),modifyonly:true});var a=Ext.getCmp("library-edit");a.items.each(function(e){a.remove(e)});a.add(b);b.on("afterlayout",b.fillPluginForm.createDelegate(b,[c]));a.doLayout();this.setPluginEditTitle(c.title);this.setActiveItem("library-edit","library-plugin");_gaq.push(["_trackPageview","/pluginlibrary/edit/"+c.id])},showAddToLayoutMenu:function(c,a){a.stopEvent();this.layoutmenu=null;if(!this.layoutmenu){this.layoutmenu=new Ext.menu.Menu({items:[{text:"New layout",layout:null,plugindata:this.plugin,group:"selectedlayout",handler:this.onAddToNewLayout,scope:this},"-"]});for(var b=0;b<biogps.LayoutMgr.availableLayouts.length;b++){var e=biogps.LayoutMgr.availableLayouts[b];if(e.isMyLayout()){this.layoutmenu.add({text:e.layout_name,layout:e,group:"selectedlayout",handler:this.onAddToLayout,scope:this})}}}this.layoutmenu.showAt(a.getXY())},onAddToLayout:function(a,b){b.stopEvent();if(this.plugin){if(a.layout&&this.el){a.layout.on("pluginadded",function(){this.el.mask(String.format('This plugin was added to layout "{0}".',a.layout.layout_name));biogps.GeneReportMgr.refreshLayout(a.layout);var c=this.el;setTimeout(function(){c.unmask()},1000);biogps.clearListeners(a.layout,"pluginadded")},this);a.layout.on("pluginaddfailed",function(c){},this);this.el.mask(String.format('Adding this plugin to layout "{0}"...',a.layout.layout_name));a.layout.addPlugin(this.plugin)}}return true},onAddToNewLayout:function(a,b){b.stopEvent();if(this.plugin&&this.el){if(!this.newlayoutwin){this.newlayoutwin=new Ext.Window({title:"Create a new layout",layout:"fit",width:380,labelWidth:200,constrain:true,constrainHeader:true,renderTo:this.el,autoHeight:true,stateful:false,plain:true,ownerCmp:this,listeners:{show:{buffer:0,fn:function(e){e.center();setTimeout(function(){e.items.get(0).items.get(0).focus()},10);var c=new Ext.KeyMap(e.getEl(),[{key:13,stopEvent:true,fn:function(){this.ownerCmp.saveNewLayout()},scope:e}])}}},items:new Ext.FormPanel({id:"newlayoutform",labelWidth:120,autoHeight:true,bodyStyle:"padding:5px 5px 5px 5px",border:false,items:[{xtype:"textfield",anchor:"90%",fieldLabel:"Name your layout",id:this.id+"_field_name",name:"layout_name",allowBlank:false},{fieldLabel:"Description",xtype:"textarea",anchor:"90%",id:this.id+"_field_description",name:"description",value:"",allowBlank:true}],buttons:[{text:"Save",handler:this.saveNewLayout,scope:this},{text:"Cancel",handler:function(){this.newlayoutwin.destroy()},scope:this}]})})}this.newlayoutwin.on("destroy",function(){this.newlayoutwin=null},this);this.newlayoutwin.show()}return true},saveNewLayout:function(){if(this.plugin&&this.newlayoutwin&&this.newlayoutwin.rendered){var b=this.newlayoutwin.items.get(0);if(!(b.form.isValid())){Ext.MessageBox.show({title:"Error",msg:"Missing or wrong input layout name! Correct and try again.",buttons:Ext.Msg.OK,icon:Ext.MessageBox.ERROR});b.form.reset();b.items.get(0).focus()}else{var a=new biogps.Layout(b.form.getValues());a.layout_data=[{id:this.plugin.id}];a.on("saved",function(){this.newlayoutwin.destroy();this.el.mask(String.format('This plugin was added to layout "{0}".',a.layout_name));biogps.LayoutMgr.loadAvailableLayout();biogps.GeneReportMgr.markLayoutChanged();var c=this.el;setTimeout(function(){c.unmask()},1000);biogps.clearListeners(a,"saved")},this);a.on("savefailed",function(c){this.el.unmask();this.newlayoutwin.center();biogps.formfailure({result:c},"Saving Layout failed! Try again.",function(){if(this.newlayoutwin.rendered){this.newlayoutwin.items.get(0).form.reset();this.newlayoutwin.items.get(0).items.get(0).focus()}},this)},this);this.el.mask(String.format('Saving new layout "{0}"...',a.layout_name));a.saveas()}}}});biogps.pluginJsonStore=function(a){Ext.data.JsonStore.superclass.constructor.call(this,Ext.apply(a,{proxy:a.proxy||(!a.data?new Ext.data.HttpProxy({url:a.url,method:a.method}):undefined),reader:new biogps.pluginJsonReader(a,a.fields)}))};Ext.extend(biogps.pluginJsonStore,Ext.data.Store);biogps.pluginJsonReader=function(a,b){a=a||{};biogps.pluginJsonReader.superclass.constructor.call(this,a,b||a.fields)};Ext.extend(biogps.pluginJsonReader,Ext.data.JsonReader,{readRecords:function(b){this.jsonData=b;if(b.metaData){this.onMetaChange(b.metadata)}var A=this.meta,r=this.recordType,k=r.prototype.fields,z=k.items,t=k.length,w;var q=this.getRoot(b),p=q.length,l=p,x=true;if(A.totalProperty){w=parseInt(this.getTotal(b),10);if(!isNaN(w)){l=w}}if(A.successProperty){w=this.getSuccess(b);if(w===false||w==="false"){x=false}}var g=[];for(var h=0;h<p;h++){var e=q[h];var u={};var a=this.getId(e);var j=new biogps.Plugin(e.fields);j.id=e.pk;j.json=e;j.data=e.fields;j.data.id=e.pk;g[h]=j}return{success:x,records:g,totalRecords:l}}});biogps.PluginEditPanel=function(a){this.pluginbox=null;Ext.apply(this,a);biogps.PluginEditPanel.superclass.constructor.call(this,{id:this.id+"_form",title:this.modifyonly?"Edit your own plugin":"Create your own plugin",cls:"centerMargins",labelWidth:110,stateful:false,defaultType:"textfield",width:"90%",autoHeight:true,border:false,trackResetOnLoad:this.modifyonly,items:[{xtype:"fieldset",cls:"roundBoxBlue",autoHeight:true,defaults:{anchor:"90%"},defaultType:"textfield",items:[{fieldLabel:"Title*",id:this.id+"_field_title",name:"title",maxLength:100,allowBlank:false},{fieldLabel:"URL template*",id:this.id+"_field_url",name:"url",maxLength:500,value:"",allowBlank:false,validator:this.validateURLTemplate,listeners:{render:this.addURLHelp,blur:function(b){this.toggleSpeciesBasedOnKeyword(b.getValue());return false},scope:this}},{xtype:"box",autoEl:{tag:"div",cls:"details",html:'<h5>Template Syntax Explained</h5>                     <p>You need to supply the URL to the website you want to add                     as a plugin, including one (or more) keywords. When you then                     use your plugin in a layout, the appropriate identifier for                     your gene of interest will be substituted in.</p><br />                     <p>For example, to make a simple Google search plugin, you would                     type in the URL below, then click                     the "Add Keyword" button and select whichever identifier you want.<br />                     <b>http://www.google.com/search?q=</b></p><br />                     <p>Once you have picked an identifier, the URL template                     will then look like this:<br />                     <b>http://www.google.com/search?q={{Symbol}}</b></p><br />                     <p>When the plugin is then used in a layout to look at a gene,                     BioGPS will automatically insert the correct value. For                     example, if you used the UniGene ID keyword and the user                     is looking at CDK2, the actual URL that will load would be                     this:<br />                     <b>http://www.google.com/search?q=Hs.19192</b></p><br />                     <p>If you want to test your URL template before saving, just hit                     the "Preview" button at the bottom of this page.                     </p>'}}]},{xtype:"fieldset",cls:"roundBox",autoHeight:true,defaults:{anchor:"90%"},defaultType:"textfield",items:[{fieldLabel:"Description",xtype:"textarea",id:this.id+"_field_description",name:"description",autoHeight:false,height:75,value:"",grow:false,allowBlank:true},{fieldLabel:"Tags (categories)",id:this.id+"_field_tags",name:"tags",allowBlank:true},{xtype:"box",autoEl:{tag:"div",cls:"details",html:'Enter words to help categorize your plugin. Separate them with a single space.<br />                     Example: "<b>exon structure gene</b>" will make your plugin                     show up in each of those three categories.'}},{xtype:"checkboxgroup",name:"allowedspeciesGroup",fieldLabel:"Species allowed:",labelSeparator:"",listeners:{change:function(b){this.hideSpeciesMsgTip()},scope:this},columns:biogps.AVAILABLE_SPECIES.walk(function(b){return 80}),items:biogps.AVAILABLE_SPECIES.walk(function(b){return{name:"allowedspecies",inputValue:b,boxLabel:b.capitalize(),checked:true}})},{xtype:"radiogroup",name:"rolepermission",fieldLabel:"Visible to:",allowBlank:false,labelSeparator:"",hidden:false,disabled:false,columns:biogps.usrMgr.is_gnf_user?[100,120,70,125,100]:[100,100,10,10,100],height:30,listeners:{render:function(b){if(!biogps.usrMgr.can_share&&!biogps.usrMgr.is_anonymoususer){biogps.whydisabled(b,'You need to provide us your full name and affiliation information before you can share your plugin with others. Click <b><a href="/auth/account/edit" target="_blank">here</a></b> to edit your account information.')}}},items:[{inputValue:"biogpsusers",name:"rolepermission",boxLabel:"Everyone",checked:biogps.usrMgr.can_share},{inputValue:"friendusers",name:"rolepermission",boxLabel:"Only Friends"},{inputValue:"gnfusers",hidden:!biogps.usrMgr.is_gnf_user,disabled:!biogps.usrMgr.is_gnf_user,hideParent:true,name:"rolepermission",boxLabel:"GNF"},{inputValue:"novartisusers",hidden:!biogps.usrMgr.is_gnf_user,disabled:!biogps.usrMgr.is_gnf_user,hideParent:true,name:"rolepermission",boxLabel:"Novartis & GNF"},{inputValue:"myself",boxLabel:"Only Me",name:"rolepermission",checked:!biogps.usrMgr.can_share}]}]}],buttons:[{text:this.modifyonly?"Save Edits":"Save New",handler:this.doSavePlugin,style:"font-weight: bold",scope:this},{text:"Cancel",handler:this.cancelEdit,hidden:!this.modifyonly,scope:this},{text:"Preview",handler:this.previewPlugin,scope:this},{text:"Clear",handler:this.doClearForm,hidden:this.modifyonly,scope:this},{text:"Delete",hidden:!this.modifyonly,handler:this.deletePlugin,scope:this}]});this.on("afterlayout",function(){this.addScreencastLink()},this)};Ext.extend(biogps.PluginEditPanel,Ext.FormPanel,{addURLHelp:function(b){if(!this.urlhelp){var e=b.container;var a=e.createChild({tag:"div",cls:"keyword-btn"});this.keywordmenu=new Ext.menu.Menu({cls:"no-icon-menu"});this.keywordmenu.add('<b class="menu-title">Available keywords:</b>');for(var c=0;c<biogps.PLUGINKEYWORDS_common.length;c++){this.keywordmenu.add({text:biogps.PLUGINKEYWORDS_common[c].text,keyword:biogps.PLUGINKEYWORDS_common[c].key,handler:this.appendKeyword,scope:this})}this.subkeywordmenu=new Ext.menu.Menu({cls:"no-icon-menu"});for(var c=0;c<biogps.PLUGINKEYWORDS_other.length;c++){this.subkeywordmenu.add({text:biogps.PLUGINKEYWORDS_other[c].text,keyword:biogps.PLUGINKEYWORDS_other[c].key,handler:this.appendKeyword,scope:this})}this.keywordmenu.add("-");this.keywordmenu.add({text:"more keywords",menu:this.subkeywordmenu,handler:function(){return false}});this.urlhelp=new Ext.Toolbar.Button({renderTo:a,iconCls:"icon-help",text:"Add Keyword",handler:function(){this.showMenu()},menu:this.keywordmenu})}},addScreencastLink:function(){if(!this.screencast){var a='<a class="roundButton right" href="http://plugins.gnf.org/screencasts/plugin_registration/">Watch the Screencast</a>';this.screencast=this.header.insertHtml("afterBegin",a,true)}},appendKeyword:function(c,b){if(c.keyword){var a=this.form.getValues().url+c.keyword;this.form.setValues({url:a});this.toggleSpeciesBasedOnKeyword(a)}},validateURLTemplate:function(b){var c=b.trim();var e=new biogps.Plugin();e.url=c;var a=e.validateUrl();return a},toggleSpeciesBasedOnKeyword:function(a){var c=a.trim();var f=new biogps.Plugin();f.url=c;var e=f.getAllowedSpeciesOnKeyword();if(Ext.isArray(e)){var b=this.form.findField("allowedspeciesGroup").getRawValue();if(!b.sort().equals(e.sort())){this.setSpeciesGroup(e);this.showSpeciesMsgTip('<img style="vertical-align:text-top;" src="/assets/img/information.png" />&nbsp;"Allowed species" has been changed based on the keyword used in URL template.');return true}}this.hideSpeciesMsgTip();return false},showSpeciesMsgTip:function(a){var c=this.form.findField("allowedspeciesGroup");var b=c.items.get(c.items.length-1).getEl().parent();if(!this.species_msgtip){this.species_msgtip=new Ext.ToolTip({anchor:"left",anchorOffset:0,renderTo:c.getEl(),html:a,maxWidth:230,anchorToTarget:true,dismissDelay:0,autoHide:false});this.species_msgtip.showAt(this.species_msgtip.el.getAlignToXY(b,"l-tr",[20,-5]))}else{if(this.species_msgtip.hidden){this.species_msgtip.show()}this.species_msgtip.body.update(a);this.species_msgtip.doAutoWidth()}},hideSpeciesMsgTip:function(){if(this.species_msgtip){this.species_msgtip.hide();delete this.species_msgtip}},cancelEdit:function(b,a){if(this.modifyonly&&this.form.isDirty()){Ext.MessageBox.confirm("Confirm","Cancel modification? Unsaved changes will be discarded.",function(c){if(c=="yes"){biogps.currentLibrary.setActiveItem("library-plugin","library-edit");_gaq.push(["_trackPageview","/pluginlibrary/edit/cancel/"])}},this)}else{biogps.currentLibrary.setActiveItem("library-plugin","library-edit")}},previewPlugin:function(){var a=new biogps.Plugin(this.form.getValues());if(a.allowedspecies){if(isArray(a.allowedspecies)){a.options.allowedSpecies=a.allowedspecies}else{a.options.allowedSpecies=[a.allowedspecies]}}biogps.loadSampleGene({species:a.options.allowedSpecies.length>0?a.options.allowedSpecies[0]:null,callback:function(){if(!a.geturl(biogps.sample_gene)){Ext.MessageBox.show({title:"Error",msg:"Can not interpret the URL template. Please make sure the substitutable keyword is correct.",buttons:Ext.Msg.OK,icon:Ext.MessageBox.ERROR})}else{a.render_preview(biogps.sample_gene,Ext.get("pluginboxcontainer"))}},scope:this})},doSavePlugin:function(){if(this.modifyonly){Ext.MessageBox.confirm("Confirm",String.format('Update plugin "{0}"?',this.form.getValues().title),function(a){if(a=="yes"){this.submitPluginForm()}},this)}else{this.submitPluginForm()}},handleDupPluginAtSave:function(e){if(e&&e.length>0){var c,b;var a="<p><br />";e.each(function(f){a+='<a href="#goto=pluginlibrary&t=library-plugin&p='+f.id.toString()+'" onclick="javascript:Ext.Msg.hide();">'+f.text+"</a><br />"});a+="</p>";if(e.length==1){c="Duplicated plugin found";b="We detected that there is an existing plugin with exactly the same URL template as you provided. You can click the link below to view this existing plugin: "+a+'<p><br />Click "Yes" to save it anyway, or "No" to cancel the saving.</p>'}else{c="Duplicated plugins found";b="We detected that there are "+e.length.toString()+" existing plugins with exactly the same URL template as you provided. You can click the links below to view the existing plugins: "+a+'<p><br />Click "Yes" to save it anyway, or "No" to cancel the saving.</p>'}Ext.Msg.confirm(c,b,function(f){if(f=="yes"){this.submitPluginForm({allowdup:true})}},this)}},submitPluginForm:function(a){var e=this.form;if(!e.isValid()){Ext.MessageBox.show({title:"Error",msg:"Wrong input! Correct and try again.",buttons:Ext.Msg.OK,icon:Ext.MessageBox.ERROR});e.reset()}else{if(this.modifyonly&&!this.current_pluginid){Ext.MessageBox.show({title:"Error",msg:"Missing plugin id for updating this plugin! Reload this plugin and try again.",buttons:Ext.Msg.OK,icon:Ext.MessageBox.ERROR})}else{var f=new biogps.Plugin(e.getValues());var c=f.validateUrl();if(c==true){this.toggleSpeciesBasedOnKeyword(f.url);e.getEl().mask(this.modifyonly?"Save your modification...":"Submit your new plugin...");var b={};if(this.modifyonly){Ext.apply(b,{plugin_id:this.current_pluginid})}if(a&&a.allowdup){Ext.apply(b,{allowdup:"1"})}e.submit({url:this.modifyonly?"/plugin/update/":"/plugin/add/",method:"POST",params:b,success:function(i,j){i.getEl().unmask();i.getEl().mask(this.modifyonly?"Your plugin was updated!":"Your plugin was saved!");_gaq.push(["_trackPageview","/pluginlibrary/edit/save/"]);setTimeout(function(){i.getEl().unmask()},1000);if(!this.modifyonly&&!this.current_pluginid){this.current_pluginid=j.result.plugin_id;i.reset()}var h=this.modifyonly?"library-edit":"library-add";biogps.currentLibrary.renderPluginById(this.current_pluginid,h)},failure:function(h,i){h.getEl().unmask();if(i.result.dup_plugins){this.handleDupPluginAtSave(i.result.dup_plugins)}else{biogps.formfailure(i,this.modifyonly?'"updatePlugin" service failed!':'"addPlugin" service failed!')}},scope:this})}else{var g="Invalid URL template. ";if(Ext.isString(c)){g+=c}else{g+="Please make sure the substitutable keyword is correct."}Ext.MessageBox.show({title:"Error",msg:g,buttons:Ext.Msg.OK,icon:Ext.MessageBox.ERROR})}}}},doClearForm:function(){if(this.modifyonly){Ext.MessageBox.confirm("Confirm",String.format('Clear all values for plugin "{0}"?',this.form.getValues().title),function(a){if(a=="yes"){this.form.reset()}},this)}else{this.form.reset()}},setSpeciesGroup:function(c){var b=this.form.findField("allowedspeciesGroup");var a=[];b.eachItem(function(e){a.push(c.indexOf(e.inputValue)!=-1)});b.setValue(a)},fillPluginForm:function(c){var b=this.form;b.setValues({url:c.url,title:c.title,description:c.description,tags:c.tags,rolepermission:c.formatPermission()});var a=c.getAllowedSpecies();this.setSpeciesGroup(a);this.current_pluginid=c.id},deletePlugin:function(){if(!this.modifyonly){return false}var c=this.current_pluginid;var b=this.form.getValues().title;biogps.callRemoteService({url:"/plugin/"+c+"/usage/",scope:this,fn:function(f){var e=f.reader.jsonData;var g=String.format('Are you SURE you want to delete the "{0}" plugin?<br />This action CANNOT be undone!',b);if(e[0]>0||e[1]>0){g+=String.format("<br /><br />Usage info: this plugin is currently used in [<b>{0}</b>] of your own layouts and [<b>{1}</b>] of others'.",e[0],e[1])}else{g+="<br /><br />Usage info: this plugin is currently not used in any layout."}Ext.MessageBox.confirm("Confirm",g,function(h){if(h=="yes"){a(this)}},this)}});function a(f){var e=new Ext.data.JsonStore({url:"/plugin/delete/",baseParams:{plugin_id:c},method:"POST",fields:[],autoLoad:true});f.body.mask(String.format('Delete plugin "{0}"...',b));e.on("load",function(g){var h=g.reader.jsonData;if(h.success){f.body.unmask();f.body.mask("You plugin was deleted!");_gaq.push(["_trackPageview","/pluginlibrary/edit/delete/"]);setTimeout(function(){f.body.unmask();biogps.currentLibrary.setActiveItem("library-home","delete")},1500)}else{f.body.unmask();Ext.MessageBox.show({title:"Error",msg:h.error?h.error:"",buttons:Ext.Msg.OK,icon:Ext.MessageBox.ERROR})}},f);e.on("loadexception",biogps.ajaxfailure,f)}}});function initLibrary(f){var e=Ext.getCmp("pluginbrowse_panel");biogps.pluginStore=new biogps.pluginJsonStore({url:"/plugin/",method:"GET",root:"items",totalProperty:"totalCount",id:"pk",fields:[],listeners:{beforeload:{scope:this,fn:function(l,j){biogps.currentLibrary.body.mask("Loading...");biogps.currentLibrary.setBrowseTitle("Loading");if(!j.params.start){j.params.start=0}if(!j.params.limit){j.params.limit=50}if(!j.params.scope){j.params.scope="all"}if(!j.params.dir){j.params.dir="DESC"}if(!j.params.mysort){if(biogps.currentLibrary.sortCombo&&biogps.currentLibrary.sortCombo.getValue()){j.params.mysort=biogps.currentLibrary.sortCombo.getValue();var k=biogps.currentLibrary.sortCombo.store.query("sortby",j.params.mysort);j.params.dir=k.items[0].data.direction}else{j.params.mysort="popularity"}}}},load:{scope:this,fn:function(k){biogps.currentLibrary.body.unmask();if(k.getTotalCount()===1){var j=k.getAt(0);biogps.currentLibrary.renderPluginById(j.id,"library-home")}else{var n=k.lastOptions.params;var l="";if(n.tags){l="plugins tagged with '"+n.tags+"'"}else{if(n.search){l="results for '"+n.search+"'"}else{l="Plugins"}}if(n.mysort=="created"){l="Newest "+l}else{if(n.mysort=="lastmodified"){l="Recently Updated "+l}else{if(n.mysort=="popularity"){l="Most Popular "+l}else{if(n.mysort=="title"){l="Alphabetical "+l}else{if(n.mysort=="author"){l="By Author "+l}}}}}biogps.currentLibrary.setBrowseTitle(l);Ext.getCmp("library-browse-sort").setValue(n.mysort);biogps.currentLibrary.hash_history()}}}}});biogps.pluginTpls=new Array();var i=new Ext.XTemplate('<tpl for=".">','<a class="pluginbox {[("permission" in values) ? this.isGNF(values.permission) : "myself"]}','" href="javascript:biogps.currentLibrary.renderPluginById({id},\'library-browse\')">','<span class="name">{title}</span><br />','<span class="url">{[shortUrl(values.url)]}</span>',"</a></tpl>",{isGNF:function(j){return(j.R[0]==="GNF Users")?"gnfusers":""}});biogps.pluginTpls.small=i.compile();var c=new Ext.XTemplate('<tpl for=".">','<a class="roundBoxBlue pluginbox-medium {rolepermission}" ',"href=\"javascript:biogps.currentLibrary.renderPluginById({id},'library-browse')\">",'<span class="author">Registered by {author}</span>','<span class="name">{title}</span><br />','<tpl if="1 <= values.usage_percent.layouts">','<span class="usage">Layout Popularity: {values.usage_percent.layouts:round(0)}</span>',"</tpl>",'<p class="description">{description}</p>','<p class="url">{[colorShortUrl(values.url)]}</p>',"</a></tpl>",{isGNF:function(j){return(j.R[0]==="GNF Users")?"gnfusers":""}});biogps.pluginTpls.medium=c.compile();var h=new Ext.XTemplate('<div class="roundBoxBlue basics {rolepermission}">','<div class="preview">','<div id="library-plugin-preview">','<iframe src="{previewUrl}"></iframe>',"</div>","<p>Preview of CDK2 gene data</p>","</div>",'<tpl if="certified_owner">','<a class="certified_owner_badge" title="Certified Owners also maintain the plugin website. Click to read more."',' href="http://biogps.blogspot.com/2010/06/taking-ownership-of-your-plugin.html" target="_blank"></a>',"</tpl>","<h1>{title}</h1>",'<tpl if="certified_owner">','<p class="author">Maintained by <a href="{author_url}">{author}</a>, Certified Owner</p>',"</tpl>",'<tpl if="!certified_owner">','<p class="author">Registered by <a href="{author_url}">{author}</a></p>',"</tpl>",'<tpl if="1 <= values.usage.layouts">','<p class="attribute"><span class="attribute-name">Layout Popularity:</span>'," {values.usage.layouts:round(0)}</p>","</tpl>",'<p class="attribute"><span class="attribute-name">Tags (keywords):</span> '," {tags}</p>",'<p class="attribute"><span class="attribute-name">Species:</span> '," {allowedspecies}</p>",'<p class="url attribute">{[colorShortUrl(values.url)]}</p>','<tpl if="mobile_url">','<p class="url attribute"><span class="attribute-name">Mobile:</span> {[colorShortUrl(values.mobile_url)]}</p>',"</tpl>",'<div><div id="plugin-add-to-layout"></div></div>','<div class="permission"></div>','<div class="clear"></div>',"</div>",'<div class="roundBox details">',"<h4>Long Description</h4>",'<p class="description">{description}</p>','<p class="timestamp">Updated {lastmodified}<br />Created {created}</p>','<div class="clear"></div>',"</div>",'<div class="details noBorder">','<a id="flag-button" class="roundButton" style="visibility: hidden;">','<img src="/assets/img/flag_red.png"/>',"Flag as Broken or Inappropriate","</a>","</div>");biogps.pluginTpls.large=h.compile();var b=new biogps.PluginLibrary({id:"pluginlibrary_card",layout:"anchor",autoScroll:true,bodyStyle:"padding:5px",border:false,defaults:{border:false},tbar:[{id:"btn-library-home",text:"Library &nbsp; &raquo;",cls:"activeBreadcrumb",handler:navHandler.createDelegate(this,["home"])},{id:"btn-library-browse",text:"Browse &raquo;",handler:navHandler.createDelegate(this,["browse"]),hidden:true},{id:"btn-library-plugin",text:"Plugin",handler:navHandler.createDelegate(this,["plugin"]),hidden:true},{id:"btn-library-edit",text:"Edit Plugin",handler:navHandler.createDelegate(this,["edit"]),hidden:true},"->",{id:"btn-library-add",text:"Add a Plugin",handler:navHandler.createDelegate(this,["add"])}],items:[{id:"library-header",contentEl:"pluginheader"},{id:"library-search",xtype:"form",baseCls:"x-window",cls:"x-window-plain x-window-dlg",frame:true,title:"   ",onSubmit:Ext.emptyFn,keys:{key:13,stopEvent:true,fn:function(){biogps.currentLibrary.queryPlugins()}},items:[{xtype:"panel",layout:"column",border:false,items:[{xtype:"textfield",name:"query",cls:"search_field",id:"plugin_query",emptyText:"Search the Plugin Library",columnWidth:1},{xtype:"panel",border:false,width:75,items:[{xtype:"button",type:"submit",text:"SEARCH",cls:"right",handler:function(){biogps.currentLibrary.queryPlugins()}}]}]},{id:"library-search-advanced",xtype:"panel",title:"Advanced",collapsed:true,collapsible:true,titleCollapse:true,hideCollapseTool:true,baseCls:"form-group",items:[{xtype:"checkbox",id:"scope_my",boxLabel:"My Plugins",checked:true},{xtype:"checkbox",id:"scope_shared",boxLabel:"Shared Plugins",checked:true}]}]},{id:"library-add",hidden:true,height:650,items:new biogps.PluginEditPanel({id:"pluginadd",pluginbox:this,modifyonly:false})},{id:"library-home",contentEl:"pluginhome"},{id:"library-browse",title:"Browse",hidden:true,items:new Ext.DataView({tpl:biogps.pluginTpls.medium,store:biogps.pluginStore,itemSelector:"div.plugindetails"})},{id:"library-plugin",contentEl:"pluginpage",hidden:true},{id:"library-edit",hidden:true,items:[{html:""}]}],bbar:new Ext.PagingToolbar({id:"library-browse-nav",store:biogps.pluginStore,autoHeight:true,pageSize:50,displayInfo:true,displayMsg:"Plugins {0} - {1} of {2}",emptyMsg:"No plugins to display",hidden:true})});e.add(b);e.doLayout();biogps.centerTab.body.unmask();var g=new Ext.data.ArrayStore({fields:["sortby","direction","sortbyName"],data:[["popularity","DESC","Most Popular"],["created","DESC","Newest first"],["lastmodified","DESC","Recently Updated"],["title","ASC","Plugin Name"],["author","ASC","Author"]]});var a=new Ext.form.ComboBox({id:"library-browse-sort",store:g,valueField:"sortby",displayField:"sortbyName",mode:"local",editable:false,triggerAction:"all",width:125,listWidth:125,listeners:{select:function(l,k,j){biogps.currentLibrary.sortPluginList(k.data.sortby,k.data.direction)}}});Ext.getCmp("library-browse-nav").add(a);biogps.currentLibrary.sortCombo=a;Ext.getCmp("library-search-advanced").hide();if(f){biogps.currentLibrary.dispatcher_by_params(f)}else{biogps.currentLibrary.hash_history();biogps.currentLibrary.mask.hide();_gaq.push(["_trackPageview","/pluginlibrary/"])}}var navHandler=function(b){var a="library-"+b;biogps.currentLibrary.setActiveItem(a,"breadcrumb")};var shortUrl=function(a){var b=a.replace(/.*\:\/\//,"").replace(/\/.*/,"");if(b==""){b="biogps.gnf.org"}return b};var colorShortUrl=function(a){var c=a.split("://");if(c.length==1){c[1]="biogps.gnf.org"+c[0];c[0]="http"}var b=c[1].split("/");b[0]=b[0]+"</span>";return c[0]+'://<span class="domain">'+b.join("/")};function disableEnterKey(b){var a;if(window.event){a=window.event.keyCode}else{a=b.which}if(a==13){return false}else{return true}}biogps.PluginQuickAdd=function(a){this.grp=null;Ext.apply(this,a);this.pluginStore=new biogps.pluginJsonStore({url:"/plugin/",method:"GET",root:"items",totalProperty:"totalCount",id:"pk",fields:[],listeners:{beforeload:{scope:this,fn:function(c,b){if(!b.params.scope){b.params.scope="all"}if(!b.params.dir){b.params.dir="DESC"}if(!b.params.mysort){b.params.mysort="popularity"}}}}});this.pluginTpl=new Ext.XTemplate('<tpl for=".">','<div class="x-combo-list-item pluginbox-quick {rolepermission}">','<span class="name">{title}</span><br />','<tpl if="1 <= values.usage_percent.layouts">','<span class="usage">Layout Popularity: {values.usage_percent.layouts:round(0)}</span>',"</tpl>",'<span class="detailLink"><a href="#goto=pluginlibrary&t=library-plugin&p={id}" onclick="biogps.GeneReportMgr.collapseQuickLists();event.cancelBubble=true;">Details</a></span>','<p class="url">{[shortUrl(values.url)]}</p>',"</div></tpl>");biogps.PluginQuickAdd.superclass.constructor.call(this,{emptyText:"Add a Plugin",loadingText:"Searching...",store:this.pluginStore,tpl:this.pluginTpl,pageSize:5,minChars:0,lazyInit:false,displayField:"title",queryParam:"search",listAlign:"tr-br?",listWidth:250,width:100,onSelect:function(b){this.collapse();this.grp.grlayout.quickAddPlugin(b)}})};Ext.extend(biogps.PluginQuickAdd,Ext.form.ComboBox,{});biogps.renderMyStuffPanel=function(a){var c=Ext.getCmp("center_panel");var g="mystuff_panel";var b=c.getItem(g);var f=false;if(!b){b=c.add({title:"My Stuff",id:g,closable:true,layout:"fit",autoScroll:true});var e=function(){if(Ext.get(g)){biogps.renderMyStuffPanel(a=true)}};biogps.usrMgr.linkWithAuthentication(e);b.on("destroy",function(){biogps.usrMgr.unlinkWithAuthentication(e)});f=true}c.setActiveTab(b);if(f||a){b.load({url:"/mystuff/",scripts:true,nocache:true,callback:function(j,k,h,i){if(k){if(onPanelLoad){onPanelLoad()}}else{biogps.ajaxfailure(null,h)}}})}};biogps.renderSearchForm=function(f){var c=Ext.get(f);c.createChild({tag:"h2",html:"Search genes by:"});var a=new Ext.data.SimpleStore({fields:["unit","factor"],data:[["bp",1],["Kb",1000],["Mb",1000000]]});biogps.searchform=new Ext.FormPanel({id:"searchform",border:false,width:475,labelWidth:120,style:"padding:15px 0 5px 15px",items:[{xtype:"tabpanel",id:"searchformtab",activeTab:0,plain:true,border:true,deferredRender:false,defaults:{autoHeight:true,bodyStyle:"padding:10px",border:Ext.isIE6?true:false},listeners:{tabchange:{fn:b,scope:this},render:function(h){var g=new Ext.KeyMap(h.getEl(),{key:13,ctrl:true,stopEvent:true,fn:function(){biogps.doSearch()},scope:this})}},items:[{title:"Annotation",layout:"form",id:"searchbyanno",defaultType:"textfield",items:[{xtype:"radio",boxLabel:"Symbol Or Accession",checked:true,name:"qtype",inputValue:"symbolanno",fieldLabel:"Type"},{xtype:"radio",boxLabel:"Keyword",name:"qtype",inputValue:"keyword",labelSeparator:""},{xtype:"textarea",height:187,width:300,fieldLabel:"Query",name:"query",style:"overflow:auto",id:"query",value:""},{xtype:"label",html:"Try some sample queries? Click these links: <p><div style=\"padding-left: 125px\"><table style=\"font-size: 0.8em\"><tr><td><a tabindex=1000 href=\"javascript:biogps.setSampleQuery({qtype:'symbolanno', query:'CDK2\\nCDK3'});\">Gene Symbol(s)</a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</td><td><a  tabindex=1001 href=\"javascript:biogps.setSampleQuery({qtype:'keyword', query:'BTK'});\">Keyword queries</a></td></tr><tr><td><a  tabindex=1002 href=\"javascript:biogps.setSampleQuery({qtype:'symbolanno', query:'CDK?'});\">Wildcard queries</a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</td><td><a  tabindex=1003 href=\"javascript:biogps.setSampleQuery({qtype:'symbolanno', query:'1007_s_at\\n1053_at\\n117_at\\n121_at\\n1255_g_at\\n1294_at\\n1316_at\\n1320_at\\n1405_i_at\\n1431_at'});\">Affymetrix IDs</a></td></tr><tr><td><a  tabindex=1004 href=\"javascript:biogps.setSampleQuery({qtype:'symbolanno', query:'GO:0006275'});\">Gene Ontology</a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</td><td><a  tabindex=1005 href=\"javascript:biogps.setSampleQuery({qtype:'symbolanno', query:'IPR008351'});\">Interpro</a></td></tr></table></div></p>"}]},{title:"Genome Interval",layout:"form",id:"searchbyinterval",items:[{xtype:"textfield",layout:"form",fieldLabel:"Enter a string",id:"genomeinternal_string",name:"genomeinternal_string",listeners:{render:function(g){if(g.container){g.container.createChild({tag:"p",html:"example: <a href=\"javascript:biogps.setSampleQuery({genomeassembly:'mouse', genomeinternal_string:'chrX:151,073,054-151,383,976'});\">chrX:151,073,054-151,383,976</a>"})}}},width:300,regex:new RegExp("^s*(chr.+)s*:s*([0-9,]+)s*-s*([0-9,]+)s*$","i"),regexText:'Invalid format! Should be something like "chrX:151,073,054-151,383,976" (case-insensitive).'},{html:'<p><label class="x-form-item label">or</label></p><p><label class="x-form-item label">Enter numbers:</label></p>',border:false,labelSeparator:""},{xtype:"textfield",fieldLabel:"&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;chr",name:"genomeinterval_chr",width:50,maxLength:10},{xtype:"textfield",fieldLabel:"&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;start",name:"genomeinterval_start",width:100,regex:new RegExp("^[,0-9]+$"),regexText:"Invalid format! Should be number only."},{xtype:"textfield",fieldLabel:"&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;end",name:"genomeinterval_end",width:100,regex:new RegExp("^[,0-9]+$"),regexText:"Invalid format! Should be number only."},{xtype:"combo",fieldLabel:"&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;unit",labelAlign:"left",store:a,width:50,displayField:"unit",name:"genomeinterval_unit",value:"Mb",typeAhead:false,mode:"local",triggerAction:"all",editable:false,forceSelection:true,selectOnFocus:true},{xtype:"radio",boxLabel:"Human (hg19)",id:"genome1",name:"genomeassembly",inputValue:"human",fieldLabel:"Genome Assembly"},{xtype:"radio",boxLabel:"Mouse (mm9)",checked:true,id:"genome2",name:"genomeassembly",inputValue:"mouse",labelSeparator:""},{xtype:"radio",boxLabel:"Rat (rn4)",id:"genome3",name:"genomeassembly",inputValue:"rat",labelSeparator:""},{xtype:"radio",boxLabel:"Drosophila (dm3)",id:"genome4",name:"genomeassembly",inputValue:"drosophila",labelSeparator:""}]}]}],buttons:[{text:"Search",type:"submit",handler:function(){biogps.doSearch()}},{text:"Reset",type:"reset",handler:function(){biogps.searchform.getForm().reset()}}]});biogps.searchform.getForm().on("beforeaction",function(){_gaq.push(["_trackPageview","/search"]);_gaq.push(["_trackEvent","BioGPS","Search"])});var e=new Ext.Panel({layout:"column",height:"100%",border:false,renderTo:c,items:[biogps.searchform,{id:"col_info",plain:true,border:false,bodyStyle:"padding:35px 0 25px 35px"}]});function b(h,g){if(g.title=="Genome Interval"){if(!g.hintenabled_2){Ext.QuickTips.register({target:Ext.get("genomeinternal_string"),text:'example "chrX:151,073,054-151,383,976"',title:"Hint"});Ext.QuickTips.enable();g.hintenabled_2=true}Ext.getCmp("genomeinternal_string").focus()}else{if(!g.hintenabled_1){Ext.QuickTips.register({target:Ext.get("query"),text:'For Symbol or accession searches, query terms can be separated by a space or a newline.<br>For Keyword searches, query terms on a single line are interpreted as a phrase.<br>Wildcards: "?" substitutes for a single character, "*" substitutes for any number of characters.',title:"Hint"});Ext.QuickTips.enable();g.hintenabled_1=true}if(!coreDispatcher.showWelcome){Ext.getCmp("query").focus()}}}};biogps.doSearch=function(a){if(biogps.resultpage&&biogps.resultpage.genelistrendered){biogps.resultpage.genelistrendered=false}var c=biogps.searchform;var f;if(a){c.form.setValues(a);f=a.target;if(a.searchby){c.items.get(0).setActiveTab(a.searchby)}}var b=c.items.get(0).getActiveTab().id;setFocus=function(){if(f){var g=Ext.get(f);if(g){g.focus()}}else{if(b=="searchbyanno"){Ext.getCmp("query").focus()}else{Ext.getCmp("genomeinternal_string").focus()}}};if(!c.getForm().isValid()){Ext.MessageBox.show({title:"Error",msg:"Wrong input! Correct and try again.",buttons:Ext.Msg.OK,fn:setFocus,icon:Ext.MessageBox.ERROR})}else{if(b=="searchbyanno"){var e=c.getForm().getValues().query.trim();if(e==""){c.getForm().setValues({query:""});return}else{if(e.length>biogps.MAX_QUERY_LENGTH){Ext.MessageBox.show({title:"Error",msg:String.format("Your query is too large (>{0}k characters). Modify your query and try again.",biogps.MAX_QUERY_LENGTH/1000),buttons:Ext.Msg.OK,fn:setFocus,icon:Ext.MessageBox.ERROR});return}}}c.getForm().submit({url:"/boc/",waitMsg:"Searching database...",method:"POST",timeout:120,params:{searchby:b},success:function(g,h){Ext.MessageBox.hide();if(h.result.data.geneList&&h.result.data.geneList.length==0){Ext.MessageBox.show({title:"Not found",msg:"Your query does not return any record. Try again.",buttons:Ext.Msg.OK,fn:setFocus,icon:Ext.MessageBox.WARNING})}else{biogps.genelist_panel.loadGeneList(h.result.data);biogps.renderSearchResult("resultpanel","center_panel",h.result.data)}},failure:function(g,h){biogps.formfailure(h,"Searching database failed!")}})}};biogps.setSampleQuery=function(a){if(biogps.searchform){biogps.searchform.form.setValues(a)}};biogps.renderTipBox=function(a){if(isArray(biogps.tip_array)&&biogps.tip_array.length>0){var b=Ext.fly(a).createChild({tag:"div",id:"tipbox_container",style:"padding:35px 5px 25px 5px;"});if(!Ext.state.Manager.get("hideTipBox")){var c=new biogps.TipBox({id:"tipbox"});c.render(b)}else{biogps.makeShowTipBoxLink(b)}}};biogps.makeShowTipBoxLink=function(a){var b=a.createChild({tag:"div",style:"padding:4px 0px 0px 5px"});b.update('<img src="/assets/img/information.png" align="absmiddle"/>&nbsp;<span style="font: 8pt Tahoma; font-weight:bold;">Tip of the Day:</span>&nbsp;');var c=b.createChild({tag:"a",href:"#",style:"font: 8pt Tahoma;",html:"[show]"});c.on("click",function(h,g){h.stopEvent();Ext.state.Manager.clear("hideTipBox");var i=new biogps.TipBox({id:"tipbox"});var f=Ext.fly("tipbox_container");f.dom.innerHtml="";while(f.first()){f.first().remove()}i.render(f)},this)};biogps.TipBox=function(a){this.id="";Ext.apply(this,a);biogps.TipBox.superclass.constructor.call(this,{width:300,bodyStyle:"padding:5px 5px 5px 15px",html:"",tbar:new Ext.Toolbar({style:"background:#ffffff;",items:[" ",'<img src="/assets/img/information.png" align="absmiddle"/>'," ","<b>Tip of the Day:</b>","->",{text:"prev",handler:this.prevTip,scope:this}," ","|"," ",{text:"next",handler:this.nextTip,scope:this},"    ",{text:"close",handler:this.closeBox,scope:this}]})});this.current_idx=Math.floor(Math.random()*1000%biogps.tip_array.length);this.on("render",function(){this.el.fadeIn({duration:1});this.showTip()},this)};Ext.extend(biogps.TipBox,Ext.Panel,{showTip:function(){this.body.update(String.format("{0}",biogps.tip_array[this.current_idx]))},nextTip:function(){this.current_idx=this.current_idx+1;if(this.current_idx>biogps.tip_array.length-1){this.current_idx=0}this.showTip()},prevTip:function(){this.current_idx=this.current_idx-1;if(this.current_idx<0){this.current_idx=biogps.tip_array.length-1}this.showTip()},closeBox:function(){if(this.el){this.el.fadeOut({duration:1,callback:function(){this.destroy();Ext.fly("tipbox_container").dom.innerHtml="";biogps.makeShowTipBoxLink(Ext.fly("tipbox_container"));Ext.state.Manager.set("hideTipBox",true)},scope:this})}}});biogps.renderFeedBox=function(b){var a=Ext.fly(b).createChild({tag:"div",style:"padding:5px 0px 0px 5px"});a.setSize(305,"auto");var c=new Ext.Panel();c.on("render",function(e){e.load({url:"/utils/feedbox/",scripts:true})});c.render(a)};NodeMouseEventPlugin=Ext.extend(Object,{init:function(a){if(!a.rendered){a.on("render",function(){this.init(a)},this);return}this.tree=a;a.body.on("mouseover",this.onTreeMouseover,this,{delegate:"li.x-tree-node"})},onTreeMouseover:function(c,b,g){var a=Ext.fly(b).down("div.x-tree-node-el");if(a){var f=a.getAttribute("tree-node-id","ext");if(f){this.tree.fireEvent("mouseover",this.tree.getNodeById(f),c)}}}});biogps.ListPanelBase=function(a){this.ibar=[];var b={border:false,split:true,width:225,minSize:175,maxSize:400,rootVisible:false,lines:true,baseAtrchecked:true,collapseFirst:false,plugins:new NodeMouseEventPlugin()};Ext.apply(this,b);Ext.apply(this,a);biogps.ListPanelBase.superclass.constructor.call(this);this.on("mouseover",function(e,c){if(e.isLeaf()){this.toggleNodeInlineToolBar(e)}c.stopEvent();return false},this);this.getSelectionModel().on("beforeselect",function(e,c){return c.isLeaf()},this);this.on("checkchange",function(e,c){if(!e.isLeaf()&&e.parentNode==this.root&&e.childNodes.length>0){e.childNodes.each(function(f){f.ui.toggleCheck(c)})}},this)};Ext.extend(biogps.ListPanelBase,Ext.tree.TreePanel,{afterRender:function(){biogps.ListPanelBase.superclass.afterRender.call(this);this.el.on("contextmenu",function(a){a.preventDefault()})},toggleNodeInlineToolBar:function(b){if(b){var c=b.ui.getAnchor();var a=Ext.get(c.parentNode);c=Ext.get(c);var e=(a.last().id==b.id+"_ibar")?a.last():null;if(!e){e=a.createChild({tag:"div",id:b.id+"_ibar",cls:"node-inline-toolbar"});this.ibar.each(function(f){var g=e.createChild({tag:"button",cls:"node-inline-btn "+f.iconCls});g.on("click",function(h){f.fn.call(f.scope,b)},this,{stopPropagation:true,stopEvent:true,preventDefault:true})},this)}}},removeNode:function(b,c){var a;if(b.id){a=b}else{a=this.getNodeById(b)}if(a){a.unselect();if(!c){Ext.fly(a.ui.elNode).ghost("l",{callback:function(){this.remove()},scope:a,duration:0.4})}else{a.remove()}}}});biogps.GeneListPanel=function(){biogps.GeneListPanel.superclass.constructor.call(this,{id:"genelist-tree",region:"center",lines:false,root:new Ext.tree.TreeNode("GeneList Viewer"),tbar:[{iconCls:"icon-showreport",text:"View",handler:function(){this.showGeneReport()},tooltip:"View Gene Report",scope:this},{iconCls:"icon-undo",text:"Undo",handler:this.loadLastGeneList,tooltip:"Load last gene list",scope:this},{text:"Save",iconCls:"icon-save",id:"genelist_save_btn",handler:this.saveGeneSet,tooltip:"Save selected genes",disabled:true,scope:this}],ibar:[{iconCls:"icon-remove-small",fn:function(a){this.removeNode(a)},scope:this}]});this.createRoot();this.on({beforeremove:function(){this.last_geneList=this.getCurrentGeneList()},remove:function(){this.updateRoot()},scope:this});this.addEvents({geneclicked:true});this.on("click",function(b,a){if(b.isLeaf()){this.fireEvent("geneclicked",b.attributes)}},this);biogps.usrMgr.linkWithAuthentication(this.init,this)};Ext.extend(biogps.GeneListPanel,biogps.ListPanelBase,{init:function(){if(biogps.usrMgr.is_anonymoususer){this.getTopToolbar().items.get("genelist_save_btn").disable()}else{this.getTopToolbar().items.get("genelist_save_btn").enable()}},createRoot:function(){this.genelist_node=this.root.appendChild(new Ext.tree.TreeNode({text:"All Genes",cls:"node-root-el",checked:false,expanded:true}))},getCurrentGeneList:function(){var c=[];var a=this.genelist_node.childNodes;if(a.length>0){for(var b=0;b<a.length;b++){c.push(a[b].attributes)}}return c},removeAll:function(){this.last_geneList=this.getCurrentGeneList();this.root.removeChild(this.genelist_node);this.createRoot()},updateRoot:function(){this.genelist_node.setText(String.format("All ({0})",this.genelist_node.childNodes.length))},addGene:function(a,b,f){var e=this.getNodeById(a.id);if(e){if(!b){e.select();e.ui.highlight()}return}Ext.apply(a,{iconCls:"icon-gene",checked:false,leaf:true,qtip:"GeneID: "+a.id+"<br>"+a.name,id:a.id});var c=new Ext.tree.TreeNode(a);this.genelist_node.appendChild(c);if(!b){if(!f){Ext.fly(c.ui.elNode).slideIn("l",{callback:c.select,scope:c,duration:0.4})}else{c.select()}}return c},mergeGeneList:function(e,c){var b=e.concat(c).sort(function(g,f){return g.symbol>f.symbol});for(var a=1;a<b.length;a++){if(b[a-1].id==b[a].id){b.splice(a,1);a=a-1}}return b},loadGeneList:function(c,f){var e;if(f){e=this.mergeGeneList(this.getCurrentGeneList(),c.geneList)}else{e=c.geneList}var a=1000;if(e.length>a){biogps.warning(String.format("At most {0} genes can be loaded at left-side panel. {1} extra genes are excluded.",a,e.length-a))}this.removeAll();for(var b=0;b<Math.min(e.length,a);b++){gid=e[b].id;gsymbol=e[b].symbol;gname=e[b].name;this.addGene({id:gid,symbol:gsymbol,name:gname,text:gsymbol},true,true)}this.updateRoot();this.expand(true);this.doLayout()},loadLastGeneList:function(){if(this.last_geneList&&this.last_geneList.length>0){this.loadGeneList({geneList:this.last_geneList})}},loadFromGeneIDList:function(b){var a=new Ext.LoadMask(this.ownerCt.getEl(),{msg:"Loading gene list..."});a.show();biogps.callRemoteService({url:"/service/getgenelist/",params:{genelist:b.join(",")},method:"POST",timeout:90000,fn:function(e){var c=e.reader.jsonData;this.loadGeneList(c);a.hide();a.destroy()},scope:this})},getSelectedGenes:function(){var a=[];this.genelist_node.eachChild(function(b){if(b.ui.checkbox.checked){a.push(b.id)}});return a},showGeneReport:function(b){if(b&&b.id){var a=[b.id]}else{var a=this.getSelectedGenes()}_gaq.push(["_trackEvent","BioGPS","GR_by_view_btn",a.length+""]);if(a.length==0){biogps.error("You did not select any gene. Please select and try again.")}else{if(a.length>10){biogps.error("You can only render at most 10 gene reports at one time. Please select fewer genes and try again.")}else{biogps.renderGeneReport2(a)}}},saveGeneSet:function(){var a=this.getSelectedGenes();biogps.GeneSetMgr.saveGeneSet(a,this.tbar)}});biogps.GeneSetMgr=function(a){this.id="";Ext.apply(this,a);biogps.GeneSetMgr.superclass.constructor.call(this);this.addEvents({genesetsaved:true});this.on("genesetsaved",function(){biogps.geneset_panel.load()})};Ext.extend(biogps.GeneSetMgr,Ext.util.Observable,{doGenesetSave:function(b){if(!(biogps.genesetsavewin&&biogps.genesetsavewin.el.parent())){return}var c,g;var h="POST";switch(b.mode){case"new":var a=b.geneList;c="/geneset/";g={data:Ext.util.JSON.encode(a)};break;case"union":var e=b.genesetid;c="/geneset/union/";g={genesetid:e};break;case"intersection":var e=b.genesetid;c="/geneset/intersection/";g={genesetid:e};break;case"update":var f=b.geneset;c="/geneset/"+f.genesetid+"/";h="PUT";break;default:return}if(!(Ext.getCmp("genesetsaveform_name").isValid())){biogps.error("Missing or wrong input gene list name! Correct and try again.");Ext.getCmp("genesetsaveform").form.reset()}else{biogps.genesetsavewin.body.mask("Saving gene list...");Ext.getCmp("genesetsaveform").getForm().submit({url:c,params:g,method:h,scope:this,success:function(j,k){if(k.result.success){var i=Ext.getCmp("genesetsaveform_name").getValue();biogps.genesetsavewin.body.unmask();biogps.genesetsavewin.body.mask(String.format('Gene list "{0}" saved!',i));setTimeout(function(){biogps.genesetsavewin.body.unmask();biogps.genesetsavewin.close()},1000);this.fireEvent("genesetsaved")}else{biogps.genesetsavewin.body.unmask();biogps.formfailure(k,errmsg="Saving Gene list failed! Try again.",onclose=function(){if(biogps.genesetsavewin){biogps.genesetsavewin.items.get(0).form.reset()}biogps.genesetsavewin.items.get(0).items.get(0).focus()})}},failure:function(i,j){biogps.genesetsavewin.body.unmask();biogps.formfailure(j,errmsg="Saving Gene list failed! Try again.",onclose=function(){Ext.getCmp("genesetsaveform").form.reset();Ext.getCmp("genesetsaveform").items.get(0).focus()})}})}},showSaveWin:function(c){var i=c.targetEl;var f=function(){this.doGenesetSave(c)};var j,h,g;if(c.mode=="new"){var a=c.geneList;if(a.length==0){biogps.error("You did not select any gene to save. Please try again.");return}else{if(a.length>1000){biogps.error("You can save at most 1000 genes in one gene list. Please select less genes and try again.");return}}j=String.format("Save selected Genes ({0})",a.length)}else{if(c.mode=="union"||c.mode=="intersection"){var b=c.genesetid;if(!isArray(b)||b.length<2){biogps.error("Select at least two gene lists for operation.");return}else{if(b.length>100){biogps.error("At most 100 gene lists can be operated at once.");return}}j=String.format("Take {0} of selected gene lists ({1})",c.mode,b.length);h=String.format("{0}_Gene_List_{1}",Ext.util.Format.capitalize(c.mode),Ext.util.Format.date(new Date(),"mdY"));g=String.format("This gene list is created by taking {0} from ({1})",c.mode,b.join(", "))}else{if(c.mode=="update"){var e=c.geneset;j="Update geneset";h=e.name;g=e.description}else{return}}}biogps.genesetsavewin=new Ext.Window({title:j,layout:"fit",width:380,labelWidth:200,modal:true,autoHeight:true,stateful:false,plain:true,grp:this,listeners:{show:{buffer:10,fn:function(l){var k=new Ext.KeyMap(l.getEl(),[{key:13,stopEvent:true,fn:f,scope:this.grp},{key:27,stopEvent:true,fn:function(){biogps.genesetsavewin.close()}}]);l.items.get(0).items.get(0).focus()}},destroy:function(){delete biogps.genesetsavewin}},items:new Ext.FormPanel({id:"genesetsaveform",labelWidth:120,autoHeight:true,bodyStyle:"padding:5px",border:false,items:[{xtype:"textfield",anchor:"90%",fieldLabel:"Name your Gene list",id:"genesetsaveform_name",name:"name",value:h,allowBlank:false},{fieldLabel:"Description",xtype:"textarea",anchor:"90%",id:"genesetsaveform_description",name:"description",value:g,height:100,allowBlank:true}],buttons:[{text:"Save",handler:f,scope:this},{text:"Cancel",handler:function(){biogps.genesetsavewin.close()}}]})});biogps.genesetsavewin.show(i)},saveGeneSet:function(a,b){this.showSaveWin({mode:"new",targetEl:b,geneList:a})},unionGeneSet:function(a,b){this.showSaveWin({mode:"union",targetEl:b,genesetid:a})},intersectionGeneSet:function(a,b){biogps.callRemoteService({url:"/geneset/intersection/",params:{genesetid:a,validate:"1"},method:"POST",fn:function(c){if(c.reader.jsonData.success){this.showSaveWin({mode:"intersection",targetEl:b,genesetid:a})}else{biogps.error(c.reader.jsonData.error?c.reader.jsonData.error:"Failed to perform intersection on selected gene sets.")}},scope:this})},editGeneSet:function(a,b){this.showSaveWin({mode:"update",targetEl:b,geneset:a})},deleteGeneSet:function(b,e,a){var c=String.format('Are you SURE you want to delete the "{0}" gene list?<br />This action CANNOT be undone!',b.name);Ext.MessageBox.confirm("Confirm",c,function(f){if(f=="yes"){biogps.callRemoteService({url:"/geneset/"+b.genesetid+"/",method:"DELETE",fn:e,scope:a})}},this)},loadGenes:function(b,c,a){biogps.callRemoteService({url:"/geneset/"+b.genesetid+"/?geneinfo=1",method:"GET",fn:c,scope:a})},loadGeneSets:function(a,f,g,e,c){var b;if(f=="intersection"){b="/geneset/intersection/"}else{if(f=="union"){b="/geneset/union/"}else{biogps.error("Unknown mode parameter: "+f);return}}biogps.callRemoteService({url:b,params:{genesetid:a,geneinfo:1},method:"POST",fn:g,failure:c,scope:this})}});biogps.GeneSetMgr=new biogps.GeneSetMgr();Ext.override(Ext.tree.MultiSelectionModel,{onNodeClick:function(a,b){this.select(a,b,true)},select:function(a,c,b){if(this.isSelected(a)){this.lastSelNode=a;this.unselect(a);return a}this.selNodes.push(a);this.selMap[a.id]=a;this.lastSelNode=a;a.ui.onSelectedChange(true);this.fireEvent("selectionchange",this,this.selNodes);return a}});biogps.GeneSetPanel=function(){biogps.GeneSetPanel.superclass.constructor.call(this,{id:"geneset-tree",region:"south",title:"Saved Gene Lists",lines:true,height:300,selModel:new Ext.tree.MultiSelectionModel(),simpleSelect:true,root:new Ext.tree.TreeNode("GeneSet Viewer"),tbar:[new Ext.Toolbar.SplitButton({text:"Load",handler:this.union,scope:this,tooltip:"Load genes from selected gene list",iconCls:"icon-load",menu:{items:[{text:"Union",handler:this.union,scope:this,iconCls:"icon-intersection"},{text:"Intersection",handler:this.intersection,scope:this,iconCls:"icon-intersection"},"-","Options:",{text:"Append genes",id:"cbx_genelist_appending",checked:false,listeners:{render:{fn:function(a){this.cbx_genelist_appending=a},scope:this}},handler:function(b,a){b.setChecked(!b.checked);return false},scope:this}]}})],ibar:[{iconCls:"icon-edit-small",fn:this.edit,scope:this},{iconCls:"icon-remove-small",fn:this.remove,scope:this}]});this.createRoot();biogps.usrMgr.linkWithAuthentication(this.init,this);this.on({remove:function(){this.updateRoot()},click:function(b,a){if(b.isLeaf()){b.ui.checkbox.checked=!b.ui.checkbox.checked}},checkchange:function(b,a){if(b.parentNode==this.root&&b.childNodes.length>0){b.childNodes.each(function(c){c.ui.toggleCheck(a)})}else{if(b.isLeaf()){if(a){this.selModel.select(b);b.ui.highlight()}else{this.selModel.unselect(b)}}}},scope:this});this.on("dblclick",function(b,a){this.loadOneGeneset(b);b.ui.toggleCheck(true)},this)};Ext.extend(biogps.GeneSetPanel,biogps.ListPanelBase,{init:function(){if(biogps.usrMgr.is_anonymoususer){this.removeAll();this.mylist.appendChild(new Ext.tree.TreeNode({text:"Available after logging in.",disabled:true}));this.getTopToolbar().disable();this.mylist.disable()}else{this.load()}},isGenesetNode:function(a){return a&&a.attributes.genesetid},createRoot:function(){this.mylist=this.root.appendChild(new Ext.tree.TreeNode({text:"All Gene Lists",cls:"node-root-el",checked:false,expanded:true}))},getSelectedGeneSets:function(a){var b=[];this.mylist.eachChild(function(c){if(c.ui.checkbox.checked){if(a){b.push(c)}else{b.push(c.attributes.genesetid)}}});return b},onlyOneSelected:function(){var a=this.getSelectedGeneSets(returnnodes=true);if(a.length==0){biogps.error("Please select a gene list first.")}else{if(a.length>1){biogps.error("Please select only one gene list to continue.")}else{return a[0]}}},removeAll:function(){this.suspendEvents();this.root.removeChild(this.mylist);this.resumeEvents();this.createRoot()},updateRoot:function(){this.root.firstChild.setText(String.format("All ({0})",this.mylist.childNodes.length))},addNode:function(a,b,f){var e=this.getNodeById(a.id);if(e){if(!b){e.select();e.ui.highlight()}return}Ext.apply(a,{iconCls:"icon-geneset",checked:false,leaf:true,qtip:a.description,id:"geneset_"+a.genesetid,text:a.name+" ("+a.size+")"});var c=new Ext.tree.TreeNode(a);this.mylist.appendChild(c);if(!b){if(!f){Ext.fly(c.ui.elNode).slideIn("l",{callback:c.select,scope:c,duration:0.4})}else{c.select()}}return c},load:function(b){biogps.callRemoteService({url:"/getmygenesets/",fn:a,scope:this});function a(e){var c=e.reader.jsonData;this.removeAll();for(var f=0;f<c.length;f++){this.addNode({genesetid:c[f].id,name:c[f].name,description:Ext.util.Format.ellipsis(c[f].description,100),size:c[f].size},true,true)}this.updateRoot();this.expand(true);this.doLayout()}},edit:function(a){if(!(a&&a.attributes)){a=this.onlyOneSelected()}if(a&&a.attributes.genesetid){biogps.GeneSetMgr.editGeneSet(a.attributes,this.tbar)}},remove:function(a){if(!(a&&a.attributes)){a=this.onlyOneSelected()}if(a&&a.attributes.genesetid){biogps.GeneSetMgr.deleteGeneSet(a.attributes,b,this)}function b(c){data=c.reader.jsonData;if(data.success){this.removeNode(a.id)}else{biogps.error(data.error?data.error:"")}}},getLoadAppendingFlag:function(){return this.cbx_genelist_appending?this.cbx_genelist_appending.checked:false},loadOneGeneset:function(a){if(a&&a.attributes.genesetid){var b=new Ext.LoadMask(this.ownerCt.getEl(),{msg:"Loading gene list..."});b.show();var e=this.getLoadAppendingFlag();if(a.attributes.cachedGeneList){biogps.genelist_panel.loadGeneList(a.attributes.cachedGeneList,e);b.hide();b.destroy()}else{function c(g){geneset=g.reader.jsonData;var f={totalCount:geneset.data.length,geneList:geneset.data};a.attributes.cachedGeneList=f;biogps.genelist_panel.loadGeneList(f,e);b.hide();b.destroy()}biogps.GeneSetMgr.loadGenes(a.attributes,c,this)}}},loadGeneSets:function(f){var b=this.getSelectedGeneSets();if(!isArray(b)||b.length==0){biogps.error("Please select a gene list first.");return}if(f=="intersection"&&b.length<2){biogps.error("Select at least two gene lists for operation.");return}if(b.length==1&&f!="intersection"){var c=this.onlyOneSelected();this.loadOneGeneset(c);return}var e=new Ext.LoadMask(this.ownerCt.getEl(),{msg:"Loading gene list..."});e.show();var h=this.getLoadAppendingFlag();function g(j){genedata=j.reader.jsonData;var i={totalCount:genedata.genes.length,geneList:genedata.genes};biogps.genelist_panel.loadGeneList(i,h);e.hide();e.destroy()}function a(){e.hide();e.destroy()}biogps.GeneSetMgr.loadGeneSets(b,f,g,this,a)},intersection:function(){this.loadGeneSets(mode="intersection")},union:function(){this.loadGeneSets(mode="union")}});biogps.renderSearchResult=function(f,c,a){var b=Ext.get(f);var e=Ext.getCmp(c);Ext.getCmp("result_panel").enable();if(!b){b=Ext.getBody().createChild({tag:"div",id:f});e.add({contentEl:f,title:"Search Result",layout:"fit",closable:true,autoScroll:true});e.doLayout();e.setActiveTab(e.items.getCount()-1)}if(a.geneList.length>1){Ext.History.add("goto=searchresult");e.setActiveTab("result_panel")}b.dom.innerHTML="";biogps.resultpage=new biogps.GeneResultPage(a);biogps.resultpage.render(b.dom)};biogps.GeneResultPage=function(b){this.totalCount;this.resultPerPage;this.currentPage;this.geneList;Ext.apply(this,b);var a=this.totalCount>1?"s":"";this.start=this.resultPerPage*(this.currentPage-1)+1;this.end=Math.min(this.totalCount,this.start+this.resultPerPage-1);this.totalPage=Math.ceil(this.totalCount/this.resultPerPage);biogps.GeneResultPage.superclass.constructor.call(this,{border:false});this.on("render",this.renderGeneList2,this)};Ext.extend(biogps.GeneResultPage,Ext.Panel,{renderGeneList:function(){var c,e;if(this.rendered){c='<table id="generesult_table" class="generesult_table" cellspacing="0">';c+='<thead><tr><th scope="col">no.</th><th scope="col">symbol</th><th scope="col">id</th><th scope="col">name</th></tr></thead><tbody>';for(var b=0;b<this.geneList.length;b++){e=this.geneList[b];if(b%2==0){c+=String.format('<tr onclick="biogps.renderGeneReport2(\'{0}\')"><th scope="row">{1}</th><td>{2}</td><td>{3}</td><td>{4}</td></tr>',e.id,b+1,e.symbol,e.id,e.name)}else{c+=String.format('<tr class="odd" onclick="biogps.renderGeneReport2(\'{0}\')"><th scope="row">{1}</th><td class="alt">{2}</td><td class="alt">{3}</td><td class="alt">{4}</td></tr>',e.id,b+1,e.symbol,e.id,e.name)}}c+="</tbody></table>";var a=this.geneList;this.body.update(c,false,function(){biogps.Messenger.fireEvent("genelistrendered");biogps.resultpage.genelistrendered=true;if(a.length==1){biogps.renderGeneReport2(a[0].id)}else{if(Ext.isIE){Ext.History.add("goto=searchresult")}}},this)}},renderGeneList2:function(){var h=[9606,10090,10116,7227,6239,7955,3702];var g={"9606":"Hs","10090":"Mm","10116":"Rn","7227":"Dm","6239":"Ce","7955":"Dr","3702":"At"};var c={"9606":"human","10090":"mouse","10116":"rat","7227":"drosophila","6239":"c. elegans","7955":"zebrafish","3702":"arabidopsis"};var b={human:"H. sapiens (human)",mouse:"M. musculus (mouse)",rat:"R. norvegicus (rat)",drosophila:"D. melanogaster (fruitfly)","c. elegans":"C. elegans (roundworm)",zebrafish:"D. rerio (zebrafish)",arabidopsis:"A. thaliana (thale cress)"};var e=new Ext.XTemplate('<p style="color:blue;padding: 5px 15px 0 15px;font-size:16px;font-family:\'comic sans ms\', sans-serif;"><img src="/assets/img/message.png" /><span id="new_feature_header">We improved this page! <a id="new_feature_link" style="color:blue" href="javascript:void(0);">Show me.</a></span></p>','<p class="generesult_header">Your query ','<tpl if="this.useInlineQuery">','(<span class="generesult_query">"{query:ellipsis(50)}"</span>) ',"</tpl>","returns {totalCount} record{this.plural}:</p>",'<table id="generesult_table" class="generesult_table" cellspacing="0">','<thead><tr><th scope="col">no.</th><tpl if="!this.useInlineQuery"><th scope="col">query<img src="/assets/img/new2.png" /></th></tpl><th scope="col">symbol</th><th scope="col">id</th><th scope="col" style="max-width:450px;">name</th><th scope="col">homologene&nbsp;<img src="/assets/img/new2.png" /></th></tr></thead><tbody>','<tpl for="geneList">','<tr class="{[xindex % 2 === 0 ? "even" : "odd"]}"><th scope="row" onclick="biogps.renderGeneReport2(\'{id}\')">{#}</th><tpl if="!this.useInlineQuery"><td onclick="biogps.renderGeneReport2(\'{id}\')">{key}</td></tpl><td onclick="biogps.renderGeneReport2(\'{id}\')">{symbol}</td><td onclick="biogps.renderGeneReport2(\'{id}\')">{id}</td><td style="max-width:450px;" onclick="biogps.renderGeneReport2(\'{id}\')">{name}</td><td class="homologene_td">{[this.fmtHomologene(values)]}</td></tr>',"</tpl>","</tbody></table>",'<div id="temp_for_notfound"></div>','<tpl if="values.notfound">','<p class="notfound_footer">Found no matches for {[values.notfound.length]} query term{[values.notfound.length>1?"s":""]}:<img src="/assets/img/new2.png" /><br />','<span class="notfound_hint">(Try wildcard query or keyword query?)</span><br />','<tpl for="notfound">','<div class="notfound_term">{.}</div>',"</tpl>","</p>","</tpl>",{compiled:true,disableFormats:false,useInlineQuery:(this.qtype=="keyword"||this.qtype=="interval"),plural:this.totalCount>1?"s":"",fmtHomologene:function(t){var n=t.homologene;var p="";if(n){for(var r=0;r<h.length;r++){var l=h[r];var u=false;for(var q=0;q<n.genes.length;q++){var s=n.genes[q];if(parseInt(l)==parseInt(s[0])){p+=String.format('<span class="species_available{0}"><a href="javascript:biogps.renderGeneReport2(\'{1}\')" title="{2}">{3}</a></span>',(s[1]==t.id)?" current_species":"",s[1],b[c[l]],g[l]);u=true}}if(!u){p+=String.format('<a href="javascript:void(null);" title="{0}"><span class="species_unavailable">{1}</span></a>',b[c[l]],g[l])}}p+=String.format('&nbsp;&nbsp;<span class="homologene_id">(<a href="http://www.ncbi.nlm.nih.gov/homologene/{0}" title="View NCBI HomoloGene record" target="_blank">{1}</a>)</span>',n.id,n.id)}else{var k=t.taxid.toString();for(var r=0;r<h.length;r++){var l=h[r];if(l==k){p+=String.format('<span class="species_available current_species"><a href="javascript:biogps.renderGeneReport2(\'{0}\')" title="{1}">{2}</a></span>',t.id,b[c[l]],g[l])}else{p+=String.format('<span class="species_invisible">{0}</span>',g[l])}}}return p}});if(this.rendered){var f=e.apply(this);var a=this.geneList;this.body.update(f,false,function(){var i=Ext.get("generesult_table");sorttable.makeSortable(i.dom);new Ext.ToolTip({title:new_feature_title,target:"new_feature_header",anchor:"left",html:new_feature_html,width:400,dismissDelay:0,hideDelay:5000,autoHide:true,closable:true});biogps.Messenger.fireEvent("genelistrendered");biogps.resultpage.genelistrendered=true;if(a.length==1){biogps.renderGeneReport2(a[0].id)}else{if(Ext.isIE){Ext.History.add("goto=searchresult")}}},this)}}});var new_feature_title='<span style="font-size:14px;padding-bottom: 5px;">New features</span>';var new_feature_html='<ul class="feedentry" style="font-size:14px;text-indent: 5px;"><li style="padding-bottom: 5px;">The order of the genes matches the original order of your query terms.</li><li style="padding-bottom: 5px;">Matched query term or terms are listed in the "QUERY" column.</li><li style="padding-bottom: 5px;">Each column in the results table is sortable.</li><li style="padding-bottom: 5px;">The new "HOMOLOGENE" column shows all available species for each gene orthology group and provides quick access to view the species-specific gene reports.</li><li style="padding-bottom: 5px;">Unmatched query terms, if any, will be shown below the results table.</li></ul><p><a href="http://biogps.blogspot.com/2010/07/improved-search-result-page.html" target="_blank">More details in our blog post.</a>';biogps.portletGroup=Ext.WindowGroup();biogps.portletGroup.zseed=1000;biogps.Portlet=function(a){this.id;this.plugin;this.gene;this.renderTo;var b={manager:biogps.portletGroup,xtype:"biogpsportlet",maximizable:true,collapsible:false,constrainHeader:true,shadow:Ext.isIE,animCollapse:false,autoScroll:true,bodyCssClass:"portlet-body",hideCollapseTool:true,hideMode:"display",renderTo:this.container,defaultSrc:"/assets/img/s.gif",tools:[{id:"gear",handler:function(c,e){this.showOptionMenu(e)},scope:this,qtip:"More options"}]};Ext.apply(this,a,b);this.x=this.x||0;this.y=this.y||0;this.width=this.width||(350*2);this.height=this.height||250;biogps.Portlet.superclass.constructor.call(this);this.flag_bypasspluginsync=false;this.addEvents({contentload:true});this.addEvents({speciesswitch:true});this.on({contentload:function(){this.onContentLoad()},documentloaded:function(){this.fireEvent("contentload")},resize:function(){if(!this.flag_bypasspluginsync){this.syncSize()}this.fixHeaderText();this.toFront()},move:function(){if(!this.flag_bypasspluginsync){this.syncLocation()}},maximize:function(){biogps.utils.toggleScrollbar(biogps.centerTab.get("report_panel").body,true)},restore:function(){biogps.utils.toggleScrollbar(biogps.centerTab.get("report_panel").body,false)},show:function(){this.renderSpeciesSelector();this.syncLocation();this.syncSize();if(Ext.isIE){var c=new Ext.util.DelayedTask(function(){this.loadContent()},this);c.delay(0)}else{this.loadContent()}},scope:this})};Ext.extend(biogps.Portlet,Ext.ux.ManagedIFrame.Window,{maximize:function(){if(!this.maximized){this.expand(false);this.restoreSize=this.getSize();this.restorePos=this.getPosition(true);if(this.maximizable){this.tools.maximize.hide();this.tools.restore.show()}this.maximized=true;this.el.disableShadow();if(this.dd){this.dd.lock()}if(this.collapsible){this.tools.toggle.hide()}var b=biogps.centerTab.get("report_panel");var f=this.container.getBox();var c=b.body.getBox();var e=f.width;var g=Math.max(c.y,f.y);var a=c.y+c.height-g;this.flag_bypasspluginsync=true;this.setPagePosition(f.x,g);this.setSize(e,a);this.flag_bypasspluginsync=false;if(this.plugin){if(!this.plugin.useroptions){this.plugin.useroptions={}}this.plugin.useroptions.maximized=true}this.fireEvent("maximize",this)}return this},restore:function(){this.flag_bypasspluginsync=true;this.constructor.superclass.restore.call(this);this.flag_bypasspluginsync=false;if(this.plugin&&this.plugin.useroptions){delete this.plugin.useroptions.maximized;if(biogps.isEmptyObject(this.plugin.useroptions)){this.plugin.useroptions=null}}},close:function(b){if(b&&b.bypass_confirmation){if(b.suspend_events){this.suspendEvents()}this.constructor.superclass.close.call(this);if(b.suspend_events){this.resumeEvents()}}else{var a=Ext.MessageBox.confirm("Remove Plugin?",String.format('Are you sure that you want to remove <br />this plugin "{0}" from your layout? <br /><br /> Remember to click "options-->Save" to make it PERMANENT.',this.title),function(c){if(c=="yes"){if(b&&b.suspend_events){this.suspendEvents()}this.constructor.superclass.close.call(this);if(b&&b.suspend_events){this.resumeEvents()}}},this)}},focus:Ext.emptyFn,fixHeaderText:function(){var b=this.header.down("span.x-window-header-text");var a=b.getTextWidth();var e=this.species_button?this.species_button.el:this.tools.gear;var c=e.getX()-2-b.getX()-5;if(a>c){b.setStyle({display:"block",overflow:"hidden"});b.setWidth(c);Ext.QuickTips.register({target:b,text:this.title,dismissDelay:0})}else{b.setStyle({display:"inline",overflow:"visible"});b.setWidth(a);Ext.QuickTips.unregister(b)}},showError:function(a){this.items.clear();this.body.update(a)},_loadContent:function(){switch(this.plugin.type){case"div":var a=this.body.getUpdater();a.on({beforeupdate:this.showLoading,update:function(){this.fireEvent("contentload")},options:{single:true},scope:this});this.items.clear();if(this.html){a.update(this.html)}else{if(this.url){var b,c;b=this.url+"&container="+this.body.id;if(b.startsWith("http://")){c=b.startsWith("http://plugins.gnf.org/")||b.startsWith("http://plugins-dev.gnf.org/");if(this.plugin.options.securityAware){b+="&host="+location.host}b="/utils/proxy?url="+b.replace(/&/g,"%26");if(this.plugin.options.securityAware){b+="&secure=1"}}else{c=true}a.update({url:b,scripts:c})}else{a.update("HTML content is not available!")}}break;case"iframe":this.setSrc(this.url);break}},loadContent:function(){if(this.plugin.url){this.showLoading();this.url=this.plugin.geturl(this.gene);this.updateCurrentSpecies();if(this.url){if(this.plugin.type=="iframe"&&this.plugin.options.securityAware&&!this.plugin.is_secure_cookie_set()){this.plugin.on("secure_cookie_set",function(){this._loadContent()},this,{single:true});this.plugin.set_secure_cookie()}else{this._loadContent()}}else{var a=this.gene.getEntryGene();var b=String.format("This plugin is not available for this gene: {0}({1}, {2})",a.Symbol,this.gene.EntrySpecies,this.gene.EntryGeneID);this.showError(b);this.fireEvent("contentload")}}else{var b="This plugin {0}(id: {1}) is not loaded correctly.                            Either you have deleted it already or you don't have the privilege to access it.                           <br /><br />If this is your own layout, you might want to remove it from this layout by closing this plugin window.</p>";this.showError(String.format(b,this.plugin.title?'"'+this.plugin.title+'"':"",this.plugin.id))}if(this.plugin.title){this.setTitle(this.plugin.title);this.fixHeaderText()}},showLoading:function(){this.setIconClass("icon-loading")},onContentLoad:function(){this.setIconClass("icon-home")},refresh:function(){this.loadContent()},syncSize:function(){if(this.plugin&&!this.maximized&&!this.collapsed){Ext.apply(this.plugin,this.getSize())}},syncLocation:function(){if(this.plugin&&!this.maximized&&!this.collapsed){var a=this.getPosition(local=true);Ext.apply(this.plugin,{left:a[0],top:a[1]})}},update:function(a){if(a.width!=null&&a.height!=null){this.setSize(parseInt(a.width),parseInt(a.height))}if(a.top!=null&&a.left!=null){var e=this.container.getAnchorXY();var c=e[0]+parseInt(a.left);var b=e[1]+parseInt(a.top);this.getPositionEl().moveTo(c,b,a.animate);if(!a.animate){this.fireEvent("move",this,c,b)}}if(a.minimized&&!this.collapsed){this.collapse()}if(a.maximized&&!this.maximized){this.maximize()}},getLayoutData:function(){var a=this.plugin.getPositioning();var b={id:this.plugin.id,left:a.left,top:a.top,height:a.height,width:a.width};if(this.plugin.useroptions){b.useroptions=this.plugin.useroptions}if(this.plugin&&this.plugin.runtimeoptions&&this.plugin.runtimeoptions.currentSpecies){if(!b.useroptions){b.useroptions={}}b.useroptions.currentSpecies=this.plugin.runtimeoptions.currentSpecies}return b},toggleFrame:function(){},showOptionMenu:function(c){if(!c.menu){var b=function(f){f.tip=new Ext.ToolTip({target:f.getEl().getAttribute("id"),delegate:".x-menu-item",trackMouse:true,renderTo:document.body,text:"text",listeners:{beforeshow:function e(h){var g=f.ownerCt.findById(h.triggerElement.id);if(!g.initialConfig.qtip){return false}h.body.dom.innerHTML=g.initialConfig.qtip}}})};var a=new Ext.menu.Menu();a.add({text:"Open in browser",qtip:"Open this plugin in a new browser window",iconCls:"icon-pagego",handler:function(){window.open(this.url)},scope:this,listeners:{afterrender:b}});a.add({text:"Plugin details",qtip:"Show plugin details",iconCls:"icon-info",handler:function(){this.showInfo(c)},scope:this,listeners:{afterrender:b}});a.add({text:"Refresh",iconCls:"icon-refresh",qtip:"Refresh this plugin",handler:function(e,f){this.refresh()},scope:this,listeners:{afterrender:b}});a.add({text:"Flag plugin",qtip:"Flag as broken or inappropriate",iconCls:"icon-flag",handler:function(){this.flagit()},scope:this,listeners:{afterrender:b}});c.menu=a}c.menu.show(c)},showInfo:function(a){var b=new Ext.Template('<table width="100%">','<tr><td class="genesummary_head" colspan="2">Plugin details:<br></td></tr>','<tr><td class="genesummary_name">Title:</td><td class="genesummary_text">{title}</td></tr>','<tr><td class="genesummary_name">ID:</td><td class="genesummary_text">{id}</td></tr>','<tr><td class="genesummary_name">URL:</td><td class="genesummary_text"><div style="width:100%; overflow:auto;">{realurl}</div></td></tr>','<tr><td class="genesummary_name">URL tpl:</td><td class="genesummary_text"><div style="width:100%; overflow:auto;">[<a href="{url}" target="_blank">mouse over to see</a>]</div></td></tr>','<tr><td class="genesummary_name">Type:</td><td class="genesummary_text">{type}</td></tr>','<tr><td class="genesummary_name">Registered by:</td><td class="genesummary_text"><a href="{author_url}">{author}</a></td></tr>','<tr><td class="genesummary_name">Description:</td><td class="genesummary_text">{description}</td></tr>',"</table>").compile();if(this.infopanel){this.infopanel.destroy();this.infopanel=null;return}a=a||this.tools.help;this.infopanel=new Ext.Panel({id:this.id+"_infopanel",layout:"fit",floating:true,renderTo:this.el,width:250,html:b.apply(Ext.apply({realurl:this.url?'[<a href="'+this.url+'" target="_blank">open in a new window</a>]':"NA"},this.plugin)),frame:true,buttonAlign:"center",buttons:[{text:"OK",handler:function(){this.infopanel.destroy();this.infopanel=null},scope:this}]});this.infopanel.on("show",function(){this.infopanel.el.alignTo(a,"tr-br",[0,7])},this);this.infopanel.show()},sameAs:function(a){return((this.plugin.id==a.id))},flagit:function(){if(this.plugin){this.plugin.showFlagAsInappropriateForm(this.el)}},isOverlapWith:function(c,e){var b=this.getBox(local=true);var a=c.getBox(local=true);if(e){console.log(b.x+b.width,a.x,b.x+b.width>a.x,a.x+a.width,b.x,a.x+a.width>b.x,b.y+b.height,a.y,b.y+b.height>a.y,a.y+a.height,b.y,a.y+a.height>b.y)}if(((b.x+b.width>a.x&&a.x+a.width>b.x)&&(b.y+b.height>a.y&&a.y+a.height>b.y))){return true}else{return false}},getPositionNextTo:function(c,f){var e=this.getBox(local=true);var g=c.getBox(local=true);var b=g.x+g.width+5;var a=g.y;if(b+e.width>f){b=0;a=g.y+g.height+5}return{x:b,y:a}},renderSpeciesSelector:function(){var g,b,e;if(this.plugin){g=this.plugin.getAvailableSpecies(this.gene,applyuseroptions=true);if(g.length>0){b=new Ext.menu.Menu();var f=this;var c=Math.round(Math.random()*100,0).toString();var a={human:"H. sapiens (human)",mouse:"M. musculus (mouse)",rat:"R. norvegicus (rat)",drosophila:"D. melanogaster (fruitfly)","c. elegans":"C. elegans (roundworm)",zebrafish:"D. rerio (zebrafish)",arabidopsis:"A. thaliana (thale cress)"};biogps.AVAILABLE_SPECIES.each(function(h){b.add({text:a[h],value:h,checked:false,disabled:g.indexOf(h)==-1,group:c+"_selectedspecies",handler:f.onSpeciesSwitch,scope:f})});e=new Ext.Button({text:"",menu:b,cls:"x-tool-species"});e.on("click",function(h){h.showMenu()});e.on("mouseover",function(i){var h=Ext.fly(Ext.DomQuery.selectNode("span.x-tool-species-label",i.getEl().dom));if(h){h.addClass("x-tool-species-label-over")}},this);e.on("mouseout",function(i){var h=Ext.fly(Ext.DomQuery.selectNode("span.x-tool-species-label",i.getEl().dom));if(h){h.removeClass("x-tool-species-label-over")}},this);e.render(this.header);this.species_menu=b;this.species_button=e}}},onSpeciesSwitch:function(b,a){if(!b.checked){var c=b.value;if(this.plugin){this.plugin.runtimeoptions=this.plugin.runtimeoptions||{};this.plugin.runtimeoptions.currentSpecies=c;this.loadContent();this.fireEvent("speciesswitch",this)}}},updateCurrentSpecies:function(){if(this.species_button&&this.species_menu){var c=this.plugin.current_species;var a={human:'<span class="x-tool-species-label">Species:&nbsp;Hs&nbsp;</span>',mouse:'<span class="x-tool-species-label">Species:&nbsp;Mm</span>',rat:'<span class="x-tool-species-label">Species:&nbsp;Rn</span>',drosophila:'<span class="x-tool-species-label">Species:&nbsp;Dm</span>',"c. elegans":'<span class="x-tool-species-label">Species:&nbsp;Ce</span>',zebrafish:'<span class="x-tool-species-label">Species:&nbsp;Dr</span>',arabidopsis:'<span class="x-tool-species-label">Species:&nbsp;At</span>'};this.species_button.setText(a[c]);for(var b=0;b<this.species_menu.items.length;b++){var e=this.species_menu.items.get(b);e.setChecked(e.value==c)}}}});Ext.reg("biogpsportlet",biogps.Portlet);biogps.GeneReportMgr=Ext.apply(new Ext.util.MixedCollection(),{rendered:false,populateGeneListPanel:false,register:function(){for(var a=0,b;b=arguments[a];a++){this.add(b)}},unregister:function(){for(var a=0,b;b=arguments[a];a++){this.remove(this.lookup(b))}},lookup:function(a){return typeof a=="object"?a:this.get(a)},getGeneidList:function(){var a=[];this.each(function(b){a.push(b.geneid)});return(a)},makeTitle:function(){var a="";if(this.length==1){a=this.getReport(0).title}else{if(this.length>1){var b=[];this.each(function(e){var c=e.gene.getEntryGene();if(c){b.push(c.Symbol)}});a=b.join(" , ")}}return(a)},getReport:function(a){return this.get(a)},collapseQuickLists:function(){this.each(function(a){a.grp_tbar.quickPluginBox.collapse()})},updateAll:function(){this.each(function(a){a.updatePage(true)})},refreshAll:function(){if(biogps.centerTab.activeTab.id!="report_panel"){biogps.centerTab.setActiveTab("report_panel")}this.each(function(a){a.grp_tbar.createLayoutMenu();a.renderPage()})},refreshLayout:function(a){this.each(function(b){if(b){if(b.grlayout.layout_id==a.layout_id){if(biogps.centerTab.activeTab.id=="report_panel"){b.refresh(updateonly=true)}else{b.need_refresh=true}}}})},refreshMarked:function(){this.each(function(a){if(a&&a.need_refresh){a.refresh(updateonly=true);a.need_refresh=false;delete a.need_refresh}})},removeAll:function(){biogps.portletGroup.each(function(a){a.close({bypass_confirmation:true,suspend_events:true})});this.each(function(a){a.destroy()});this.clear();this.populateGeneListPanel=false},markLayoutChanged:function(){this.each(function(a){if(a.grp_tbar){a.grp_tbar.layoutmenu_need_sync=true}})},bindLayoutMgr:function(){biogps.clearListeners(biogps.LayoutMgr,"layoutloaded");biogps.LayoutMgr.on("layoutloaded",function(){biogps.GeneReportMgr.refreshAll()})},render:function(h,g){if(biogps.LayoutMgr.layoutloading){var e=new Ext.util.DelayedTask();e.delay(100,function(){this.render(h,g)},this)}else{this.removeAll();this.rendered=false;if(biogps.genelist_panel.genelist_node&&biogps.genelist_panel.genelist_node.childNodes.length==0){this.populateGeneListPanel=true}Ext.fly(g).dom.innerHTML="";for(var b=0;b<h.length;b++){var f=new biogps.GeneReportPage({geneid:h[b]});f.render(Ext.fly(g).dom);this.register(f)}this.bindLayoutMgr();var c=new Ext.util.TaskRunner();var a={run:function(n){var k=true;for(var l=0;l<this.length;l++){var j=this.getReport(l);if(!(j&&j.rendered)){k=false;break}}if(k){this.rendered=true;biogps.Messenger.fireEvent("genereportrendered");c.stop(a)}},scope:this,interval:50};c.start(a)}}});biogps.renderGeneReport=function(h,e,g){var a=Ext.getCmp(h);var b=a.getEl();var f=Ext.getCmp(e);if(!a){a=Ext.getBody().createChild({tag:"div",id:h});f.add({contentEl:h,title:"Gene Report",layout:"fit",closable:true,autoScroll:true});f.doLayout();biogps.centerTab.suspendEvents();f.setActiveTab(f.items.getCount()-1);biogps.centerTab.resumeEvents()}else{a.enable()}biogps.centerTab.suspendEvents();f.setActiveTab(h);biogps.centerTab.resumeEvents();var c=new Ext.LoadMask(f.getEl(),{msg:"Rendering..."});c.show();biogps.GeneReportMgr.render(g,"reportpanel");c.hide();c.destroy()};biogps.renderGeneReport2=function(a,e){e=e?e:false;if(isArray(a)){var c=a}else{var c=[a]}if(!e){var b="goto=genereport&id="+c.join(",");if(b==Ext.History.getToken()){biogps.renderGeneReport("report_panel","center_panel",c)}else{Ext.History.add(b)}}else{biogps.renderGeneReport("report_panel","center_panel",c)}};biogps.GeneReportToolbar=function(a){this.grp=null;Ext.apply(this,a);this.initLayoutMenu();this.initOptionMenu();this.geneTitle=new Ext.Toolbar.TextItem({text:" ",cls:"gene-report-title"});this.notification=new Ext.Toolbar.TextItem({text:" "});this.layout_icon=new Ext.Toolbar.TextItem({text:" "});this.quickPluginBox=new biogps.PluginQuickAdd({grp:this.grp});biogps.GeneReportToolbar.superclass.constructor.call(this,{cls:"gene-report-header",items:[this.geneTitle,"->",this.notification,this.layout_icon,"current layout:"," ",this.layoutbutton,"|"," ",{text:"options",menu:this.optionmenu},this.quickPluginBox]});this.layoutmenu_need_sync=false};Ext.extend(biogps.GeneReportToolbar,Ext.Toolbar,{initLayoutMenu:function(){this.layoutmenu=new Ext.menu.Menu();this.layoutmenu.on("beforeshow",function(){if(this.layoutmenu_need_sync){this.createLayoutMenu();this.layoutmenu_need_sync=false}},this);if(this.grp&&this.grp.grlayout&&this.grp.grlayout.layout_name){var a=this.grp.grlayout.layout_name}else{var a="click to select"}this.layoutbutton=new Ext.Toolbar.Button({text:String.format("<b>{0}</b>",a),menu:this.layoutmenu});this.createLayoutMenu()},initOptionMenu:function(){this.optionmenu=new Ext.menu.Menu({items:[{text:"Tile windows",handler:function(){this.grp.tilePluginWindows("area")},scope:this},{text:"Tile windows (compact)",handler:function(){this.grp.tilePluginWindows_compact()},scope:this},{text:"Open all in browser",handler:function(){this.grp.openAllInBrowser()},scope:this},{text:"Refresh/Revert",handler:function(){this.grp.refresh()},scope:this},{text:"Save",id:"lmenu_save",handler:function(){this.grp.saveCurrentLayout()},scope:this},{text:"Save as new...",id:"lmenu_saveas",handler:function(){this.grp.saveAsNewLayout()},scope:this}]});this.optionmenu.on("beforeshow",function(){if(biogps.usrMgr.is_anonymoususer){this.optionmenu.items.get("lmenu_saveas").disable()}else{this.optionmenu.items.get("lmenu_saveas").enable()}if(biogps.usrMgr.is_anonymoususer||(this.grp&&this.grp.grlayout.isSharedLayout())){this.optionmenu.items.get("lmenu_save").disable()}else{this.optionmenu.items.get("lmenu_save").enable()}},this)},createLayoutMenu:function(){if(!this.layoutmenu){return}this.layoutmenu.removeAll();this.layoutmenu.add('<b class="menu-title">My layouts:</b>');var a=[];var c=0;var e;for(var b=0;b<biogps.LayoutMgr.availableLayouts.length;b++){e=biogps.LayoutMgr.availableLayouts[b];if(e.is_shared){a.push(e)}else{this.layoutmenu.add({text:e.layout_name,checked:(biogps.LayoutMgr.currentLayout!=null&&(e.id==biogps.LayoutMgr.currentLayout.id)),value:e.id,group:"selectedlayout",checkHandler:this.onLayoutSwitch,scope:this});c+=1}}if(c==0){this.layoutmenu.add({text:"you don't have any yet",disabled:true})}if(a.length>0){this.layoutmenu.add('<b class="menu-title">Shared layouts:</b>');for(var b=0;b<a.length;b++){e=a[b];this.layoutmenu.add({text:e.layout_name,checked:(biogps.LayoutMgr.currentLayout!=null&&e.id==biogps.LayoutMgr.currentLayout.id),value:e.id,group:"selectedlayout",checkHandler:this.onLayoutSwitch,scope:this})}}},updateLayoutMenu:function(){biogps.LayoutMgr.reloadAvailableLayout()},setLayoutName:function(a){this.layoutbutton.setText(String.format("<b>{0}</b>",a))},setGeneTitle:function(a){if(a.length>60){a=a.substring(0,55)+"..."}if(this.geneTitle.rendered){this.geneTitle.setText(a)}else{this.geneTitle.on("render",function(){this.setGeneTitle(a)},this,{single:true})}},notify:function(a){if(a.startsWith("Error")){a='<font color="red">'+a+"</font>"}if(this.notification.rendered){this.notification.setText(a)}else{this.notification.on("render",function(){this.notify(a)},this,{single:true})}},setLayoutIcon:function(a,b){if(this.layout_icon.rendered){this.layout_icon.el.addClass(a);Ext.QuickTips.register({target:this.layout_icon.el,text:b,dismissDelay:0})}else{this.layout_icon.on("render",function(){this.setLayoutIcon(a,b)},this,{single:true})}},removeLayoutIcon:function(a){if(this.layout_icon.rendered){this.layout_icon.setText("");this.layout_icon.el.removeClass(a);Ext.QuickTips.unregister(this.layout_icon.el)}},onLayoutSwitch:function(b,a){if(a){this.grp.switchLayout(b.value)}}});biogps.GeneReportPage=function(a){this.title="";this.gene=null;this.geneid=null;this.grlayout=biogps.LayoutMgr.currentLayout;this.showframe=true;Ext.apply(this,a);this.id="grp_"+this.geneid,this.globalPortletIndex=0;this.addEvents({load:true});this.portlets=new Array();this.reportRendered=false;this.layout_modified_icon="icon-layout-alert";this.flag_donotsynclayout=false;this.flag_bypassclosecallback=false;this.gene=new biogps.Gene({id:this.geneid});this.grp_tbar=new biogps.GeneReportToolbar({grp:this,id:this.id+"_tbar"});biogps.GeneReportPage.superclass.constructor.call(this,{border:true,cls:"gene-report-page",autoWidth:true,height:100,deferredRender:true,autoScroll:this.showframe,autoEl:true,tbar:this.grp_tbar});this.on("render",this.renderPage,this);this.store=new Ext.data.JsonStore({url:"/boc/getgeneidentifiers/?geneid="+this.geneid+"&format=json",fields:[],autoLoad:true});this.store.on("beforeload",this.showLoading,this);this.store.on("load",function(b){this.gene=Ext.apply(this.gene,b.reader.jsonData);this.addTabs();if(biogps.GeneReportMgr.populateGeneListPanel){var e=this.gene.getEntryGene();if(e){var c={};c.id=e.EntrezGene||e.EnsemblGene;if(c.id){c.name=e.Description||"";c.symbol=e.Symbol||"";biogps.genelist_panel.addGene({id:c.id,symbol:c.symbol,name:c.name,text:c.symbol},true,true)}}}},this);this.store.on("loadexception",biogps.ajaxfailure,this)};Ext.extend(biogps.GeneReportPage,Ext.Panel,{showLoading:function(){this.add({title:"Please wait...",id:"tmp_loading",height:100});this.loadmask=new Ext.LoadMask(this.getEl(),{msg:"Loading..."});this.loadmask.show()},removeLoading:function(){if(this.loadmask){this.loadmask.hide();this.loadmask.disable();this.remove("tmp_loading",true)}},addTabs:function(){if(this.gene){if(biogps.LayoutMgr.layoutloading){var b=new Ext.util.DelayedTask();b.delay(100,function(){this.addTabs()},this)}else{this.removeLoading();var e=this.gene.getEntryGene();var c=e.Symbol;var a=e.Description||"no description";if(a.length>100){a=a.substring(0,96)+"..."}var f=String.format("{0} ({1})",(c||this.geneid),a);this.setTitle(f);this.grp_tbar.setGeneTitle(f);this.doLayout()}}},checkLayout:function(){if(!this.grlayout){this.grp_tbar.notify("Error: This layout is not available! Please select another one using the layout menu on the right side.");return false}else{if(!this.grlayout.layout_data||this.grlayout.layout_data.length==0){this.grp_tbar.notify("Error: This layout does not contain any plugin. Please select another one using the layout menu on the right side.");return false}}return true},setInitialCanvasHeight:function(){var c;var e=0;for(var b=0;b<this.grlayout.layout_data.length;b++){c=new biogps.Plugin(this.grlayout.layout_data[b]);if(c.hasPositioning()){var a=parseInt(c.top);e=Math.max(e,a+c.height)}}this.height=e+120;this.setCanvasHeight(this.height)},createNewPortlet:function(c){var e;var b=!c.hasPositioning();var a="win_"+this.geneid+"_"+this.globalPortletIndex.toString();this.globalPortletIndex++;e=new biogps.Portlet({id:a,plugin:c,gene:this.gene,x:c.left,y:c.top,width:c.width,height:c.height,renderTo:this.body.id});e.show();e.on("resize",this.onPortletResize,this);e.on("move",this.onPortletMove,this);e.on("close",this.onPortletRemove,this);e.on("maximize",this.onPortletToggleMaximize,this);e.on("restore",this.onPortletToggleMaximize,this);e.on("speciesswitch",function(f){this.syncLayout()},this);e.firsttime=b;return e},postPageRendered:function(){this.updateSize();this.grp_tbar.setLayoutName(this.grlayout.layout_name);if(this.portlets.length==0){this.grp_tbar.notify("Error: This layout does not contain any plugin.");return}else{this.grp_tbar.notify("")}this.placeFirstTimePlugin();this.reportRendered=true;this.flag_donotsynclayout=false;if(this.grlayout.layout_modified){this.markLayoutModified()}else{this.markLayoutSaved()}var a=new Ext.util.DelayedTask(function(){this.flag_donotsynclayout=true;this.portlets.each(function(b){if(b.plugin.useroptions&&b.plugin.useroptions.maximized){b.maximize()}});this.flag_donotsynclayout=false},this);a.delay(500);_gaq.push(["_trackPageview","/gene/"+this.geneid.toString()]);_gaq.push(["_trackEvent","BioGPS","GeneReport",this.geneid.toString()])},renderPage:function(){if(!this.gene.getEntryGene()){var f=new Ext.util.DelayedTask();f.delay(100,function(){this.renderPage()},this)}else{this.cleanPage();this.grlayout=biogps.LayoutMgr.currentLayout;if(this.checkLayout()==false){return}this.globalPortletIndex=0;var e;var g;var a;this.setInitialCanvasHeight();this.portlets=[];var c=false;for(var b=0;b<this.grlayout.layout_data.length;b++){e=new biogps.Plugin(this.grlayout.layout_data[b]);g=this.createNewPortlet(e);this.portlets.push(g)}this.postPageRendered()}},updatePage:function(c){this.reportRendered=false;this.flag_donotsynclayout=true;var k=new Array(),g,e,f,h,b,a;this.setInitialCanvasHeight();for(e=0;e<this.portlets.length;e++){delete this.portlets[e].keep_flag}for(f=0;f<this.grlayout.layout_data.length;f++){b=new biogps.Plugin(this.grlayout.layout_data[f]);b.existed_flag=false;for(e=0;e<this.portlets.length;e++){g=this.portlets[e];if(!g.removed&&g.sameAs(b)&&!g.keep_flag){if(!c){if(!Ext.isIE6){b.animate={duration:0.35,callback:function(i){this.updateSize();var j=Ext.getCmp(i.id);j.syncSize();j.syncLocation()},scope:this}}g.update(b);g.loadContent()}g.keep_flag=true;k.push(g);b.existed_flag=true;break}}if(!b.existed_flag){h=this.createNewPortlet(b);k.push(h)}}for(e=0;e<this.portlets.length;e++){g=this.portlets[e];if(!g.keep_flag){g.close({bypass_confirmation:true,suspend_events:true});g=null;delete g}}this.portlets=k;this.postPageRendered()},cleanPage:function(){for(var a=0;a<this.portlets.length;a++){this.portlets[a].close({bypass_confirmation:true,suspend_events:true})}this.portlets=[];this.body.dom.innerHTML="";this.reportRendered=false},setCanvasHeight:function(a){this.setHeight(a)},updateSize:function(){var b;this.doLayout();var e=0;for(var a=0;a<this.portlets.length;a++){b=this.portlets[a];if(b.removed){continue}var c=b.getBox(local=true);if(c.y==0&&c.height==0){c=b.plugin.getPositioning();c.y=c.top}e=Math.max(e,c.y+c.height)}e=e+100;this.setCanvasHeight(e)},onPortletResize:function(a){if(Ext.isIE&&a.xtype!="biogpsportlet"){return}this.updateSize();this.syncLayout()},onPortletMove:function(a){this.updateSize();this.syncLayout()},onPortletToggleMaximize:function(a){this.syncLayout()},onPortletRemove:function(b){if(!this.flag_bypassclosecallback){var a=this.portlets.indexOf(b);this.portlets.remove(b);if(this.grlayout.layout_data[a].id==b.plugin.id){this.grlayout.layout_data.remove(this.grlayout.layout_data[a])}this.updateSize();this.syncLayout()}},refresh:function(a){this.reloadLayoutData({refreshRender:true,updateonly:a})},getBiogpsLayout:function(a){if(a&&a.positionOnly){this.grlayout.layout_data=this.getLayoutData()}else{var c=[];for(var b=0;b<this.portlets.length;b++){if(!this.portlets[b].removed){c.push(this.portlets[b].plugin)}}this.grlayout.layout_data=c}return this.grlayout},getLayoutData:function(){var b=[];for(var a=0;a<this.portlets.length;a++){if(!this.portlets[a].removed){b.push(this.portlets[a].getLayoutData())}}return b},syncLayout:function(){if(!this.flag_donotsynclayout&&this.grlayout.id==biogps.LayoutMgr.currentLayout.id){biogps.LayoutMgr.currentLayout=this.getBiogpsLayout();this.markLayoutModified()}},markLayoutModified:function(){var a="Layout has been modified.<br /> ";if(biogps.usrMgr.is_anonymoususer){a+="You need to login to save the changes."}else{if(biogps.LayoutMgr.currentLayout.isMyLayout()){a+='To save changes, click "options"-&gt;"Save".'}else{a+='To save changes, click "options"-&gt;"Save as new..."'}}a+='<br />To revert the changes, click "options"-&gt;"Refresh/Revert".';biogps.LayoutMgr.currentLayout.layout_modified=true;this.grp_tbar.setLayoutIcon(this.layout_modified_icon,a)},markLayoutSaved:function(){biogps.LayoutMgr.currentLayout.layout_modified=false;this.grp_tbar.removeLayoutIcon(this.layout_modified_icon)},reloadLayoutData:function(a){biogps.LayoutMgr.on("currentlayoutloaded",function(){biogps.clearListeners(biogps.LayoutMgr,"currentlayoutloaded");this.grlayout=biogps.LayoutMgr.currentLayout;if(a&&a.refreshRender){if(a.updateonly){this.updatePage()}else{this.renderPage()}}},this);biogps.LayoutMgr.loadLayout(this.grlayout.id);var c=new Ext.util.MixedCollection();c.addAll(biogps.LayoutMgr.availableLayouts);var b=c.get(this.grlayout.id);if(b){b.load()}delete c},saveCurrentLayout:function(a){a=a||{};if(!this.grlayout||biogps.require_user_logged_in()==false){return}var b=this.getBiogpsLayout({positionOnly:true});if(b.layout_data.length==0&&!a.saveEmptyLayout&&!a.quiet){var c=false;Ext.MessageBox.confirm("Save an empty Layout?",String.format('The layout "{0}" you are trying to save does not contain any plugin. Click "Yes" to save it anyway?',b.layout_name),function(e){if(e=="yes"){this.saveCurrentLayout({saveEmptyLayout:true})}},this);return}b.on("saved",function(e){this.reloadLayoutData();this.markLayoutSaved();if(!a.quiet){this.body.unmask();this.body.mask(String.format('Layout "{0}" saved!',biogps.LayoutMgr.currentLayout.layout_name));var f=this.body;setTimeout(function(){f.unmask()},1000)}},this);b.on("savefailed",function(f){if(a.quiet){return}if(f.error=="Layout does not exist."){var e=Ext.MessageBox.confirm("Save as a new Layout?",String.format('The layout "{0}" you are trying to save does not exist (likely this is a shared layout from others), but you can save a copy of this layout to your profile. Continue?',biogps.LayoutMgr.currentLayout.layout_name),function(g){if(g=="yes"){this.saveAsNewLayout()}},this)}else{Ext.MessageBox.alert("Error",String.format('Saving Layout failed with the error message: <br><br>"{0}"',(f.error||"[None]")))}this.body.unmask()},this);b.save()},saveAsNewLayout:function(a){if(!this.grlayout||biogps.require_user_logged_in()==false){return}var c=this.getLayoutData();biogps.layoutsavewin=new Ext.Window({title:"Save current layout",layout:"fit",width:320,labelWidth:200,modal:true,autoHeight:true,stateful:false,plain:true,grp:this,listeners:{show:{buffer:10,fn:function(f){f.items.get(0).items.get(0).focus();var e=new Ext.KeyMap(f.getEl(),[{key:13,stopEvent:true,fn:b,scope:this.grp},{key:27,stopEvent:true,fn:function(){biogps.layoutsavewin.close();delete biogps.layoutsavewin}}])}}},items:new Ext.FormPanel({id:"layoutsaveform",labelWidth:120,autoHeight:true,bodyStyle:"padding:5px 5px 5px 5px",border:false,items:[{xtype:"textfield",anchor:"90%",fieldLabel:"Name your layout",id:"layoutsaveform_name",name:"layout_name",allowBlank:false}],buttons:[{text:"Save",handler:b,scope:this},{text:"Cancel",handler:function(){biogps.layoutsavewin.close();delete biogps.layoutsavewin}}]})});biogps.layoutsavewin.show(this.grp_tbar.optionmenu.el);biogps.layoutsavewin.focus();function b(){if(!(Ext.getCmp("layoutsaveform_name").isValid())){Ext.MessageBox.show({title:"Error",msg:"Missing or wrong input layout name! Correct and try again.",buttons:Ext.Msg.OK,icon:Ext.MessageBox.ERROR});Ext.getCmp("layoutsaveform").form.reset()}else{biogps.layoutsavewin.body.mask("Saving layout...");Ext.getCmp("layoutsaveform").getForm().submit({url:"/layout/add/",params:{layout_data:Ext.util.JSON.encode(c),description:this.grlayout.description},method:"POST",scope:this,success:function(f,g){if(g.result.success){var e=Ext.getCmp("layoutsaveform_name").getValue();biogps.layoutsavewin.body.unmask();biogps.layoutsavewin.body.mask(String.format('Layout "{0}" saved!',e));this.grp_tbar.updateLayoutMenu();var h=g.result.layout_id;this.switchLayout(h);setTimeout(function(){biogps.layoutsavewin.body.unmask();biogps.layoutsavewin.close()},1000)}else{biogps.layoutsavewin.body.unmask();biogps.formfailure(g,"Saving Layout failed! Try again.",function(){if(biogps.layoutsavewin){biogps.layoutsavewin.items.get(0).form.reset()}biogps.layoutsavewin.items.get(0).items.get(0).focus()})}},failure:function(e,f){biogps.layoutsavewin.body.unmask();biogps.formfailure(f,"Saving Layout failed! Try again.",function(){Ext.getCmp("layoutsaveform").form.reset();Ext.getCmp("layoutsaveform").items.get(0).focus()})}})}}},onLayoutSwitch:function(b,a){if(a){this.switchLayout(b.value)}},switchLayout:function(a){biogps.LayoutMgr.on("currentlayoutloaded",function(){biogps.clearListeners(biogps.LayoutMgr,"currentlayoutloaded");this.grlayout=biogps.LayoutMgr.currentLayout;this.updatePage()},this);biogps.LayoutMgr.loadLayout(a);biogps.usrMgr.profile.defaultlayout=a;if(!biogps.usrMgr.is_anonymoususer){biogps.usrMgr.saveUserProfile()}},placeFirstTimePlugin:function(){var l=this.body.getHeight();var h=0;for(var g=0;g<this.portlets.length;g++){if(this.portlets[g].firsttime){l+=this.portlets[g].getBox(true).height;h+=1}}if(h==this.portlets.length){this.tilePluginWindows();for(var g=0;g<this.portlets.length;g++){this.portlets[g].firsttime=false}}else{this.setCanvasHeight(l);var e=this.body.getWidth();for(var g=0;g<this.portlets.length;g++){if(this.portlets[g].firsttime){for(var f=0;f<this.portlets.length;f++){if(!this.portlets[f].firsttime){var n=this.portlets[g].getPositionNextTo(this.portlets[f],e);this.portlets[g].update({top:n.y,left:n.x});var a=false;for(var c=0;c<this.portlets.length;c++){if(f!=c&&!this.portlets[c].firsttime&&this.portlets[g].isOverlapWith(this.portlets[c])){a=true;break}}if(!a){this.portlets[g].firsttime=false;break}}}}}this.updateSize()}if(h>0){var b=new Ext.util.DelayedTask(function(){this.saveCurrentLayout({quiet:true})},this);b.delay(2000)}},tilePluginWindows_compact:function(a){var c=350;var f=250;for(var e=0;e<this.portlets.length;e++){this.portlets[e].update({width:c,height:f})}this.setCanvasHeight(f*this.portlets.length);this.portlets[0].update({top:0,left:0});var b=this.body.getWidth();var g;for(var e=1;e<this.portlets.length;e++){g=this.portlets[e].getPositionNextTo(this.portlets[e-1],b);this.portlets[e].update({top:g.y,left:g.x})}this.updateSize()},tilePluginWindows:function(c){var h=0;for(var g=0;g<this.portlets.length;g++){h+=this.portlets[g].getBox().height}this.setCanvasHeight(h);var a=[];if(c=="area"){var n=[];var l;for(var g=0;g<this.portlets.length;g++){l=this.portlets[g].getBox();n.push([-1*l.width*l.height,g,this.portlets[g].plugin.title])}n=n.sort(function(j,i){return(j[0]-i[0])});for(var g=0;g<n.length;g++){a.push(n[g][1])}}else{for(var g=0;g<this.portlets.length;g++){a.push(g)}}this.portlets[a[0]].update({top:0,left:0});var e=this.body.getWidth();var k;var f;for(var g=1;g<a.length;g++){f=a[g];k=this.portlets[a[g]].getPositionNextTo(this.portlets[a[g-1]],e);this.portlets[a[g]].update({top:k.y,left:k.x})}this.updateSize()},openAllInBrowser:function(b){var c;if(!b&&this.portlets.length>=3){Ext.MessageBox.confirm("Confirmation",String.format('You are about to open {0} plugins in separate browser windows or tabs. Click "Yes" to continue.',this.portlets.length),function(e){if(e=="yes"){this.openAllInBrowser(true)}},this)}else{for(var a=0;a<this.portlets.length;a++){c=this.portlets[a];if(c.url){window.open(c.url)}}}}});Ext.reg("grpage",biogps.GeneReportPage);biogps.renderMainUI=function(){Ext.form.Field.prototype.msgTarget="side";setTimeout(function(){Ext.get("loading").hide();Ext.get("loading-mask").fadeOut({remove:false})},0);biogps.mainUI_init();biogps.genelist_panel=new biogps.GeneListPanel();biogps.genelist_panel.on("geneclicked",function(b){biogps.renderGeneReport2([b.id])});biogps.geneset_panel=new biogps.GeneSetPanel();var a=new Ext.Viewport({layout:"border",items:[new Ext.BoxComponent({region:"north",el:"header",height:32}),{region:"south",contentEl:"south",id:"log_panel",split:true,height:21,minSize:5,maxSize:200,collapsible:true,collapsed:false,frame:false,header:false,collapseMode:"mini",title:"South",margins:"0 0 0 0"},{region:"west",id:"west-panel",title:"Current Gene List",split:true,width:185,minSize:100,maxSize:400,collapsible:true,collapseMode:"mini",margins:"0 0 0 5",layout:"border",layoutConfig:{animate:true},items:[biogps.genelist_panel,biogps.geneset_panel]},new Ext.TabPanel({region:"center",id:"center_panel",deferredRender:false,enableTabScroll:true,activeTab:0,defaults:{autoScroll:true},items:[{contentEl:"searchpanel",id:"search_panel",title:"Search",autoScroll:true},{contentEl:"resultpanel",name:"result_panel",id:"result_panel",title:"Search Result",layout:"fit",disabled:true,autoScroll:true},{contentEl:"reportpanel",id:"report_panel",bodyCssClass:"report_panel_back",layout:"fit",disabled:true,title:"Gene Report",autoScroll:true}]})]});biogps.centerTab=Ext.getCmp("center_panel");biogps.centerTab.on("tabchange",function(e,b){switch(b.id){case"search_panel":Ext.History.add("goto=search");break;case"result_panel":Ext.History.add("goto=searchresult");break;case"report_panel":var c=biogps.GeneReportMgr.getGeneidList();if(c.length>0){Ext.History.add("goto=genereport&id="+c.join(","))}biogps.GeneReportMgr.refreshMarked();break;case"infotab_help":Ext.History.add("goto=help");break;case"infotab_faq":Ext.History.add("goto=faq");break;case"infotab_downloads":Ext.History.add("goto=downloads");break;case"infotab_about":Ext.History.add("goto=about");break;case"infotab_terms":Ext.History.add("goto=terms");break;case"pluginbrowse_panel":if(biogps.currentLibrary){biogps.currentLibrary.hash_history()}else{Ext.History.add("goto=pluginlibrary")}break;case"mystuff_panel":Ext.History.add("goto=mystuff");break;case"infotab_iphone":Ext.History.add("goto=iphone");break}},this);biogps.renderSearchForm("searchpanel");biogps.renderFeedBox(Ext.getCmp("col_info").body);biogps.renderTipBox(Ext.getCmp("col_info").body);biogps.mainUI_postinit()};Ext.onReady(function(){if(Ext.get("history-form")){if(window.coreDispatcher&&!coreDispatcher.showWelcome){Ext.get("welcome").hide()}biogps.init();biogps.renderMainUI()}});var stIsIE=
/*@cc_on!@*/
false;sorttable={init:function(){if(arguments.callee.done){return}arguments.callee.done=true;if(_timer){clearInterval(_timer)}if(!document.createElement||!document.getElementsByTagName){return}sorttable.DATE_RE=/^(\d\d?)[\/\.-](\d\d?)[\/\.-]((\d\d)?\d\d)$/;forEach(document.getElementsByTagName("table"),function(a){if(a.className.search(/\bsortable\b/)!=-1){sorttable.makeSortable(a)}})},makeSortable:function(b){if(b.getElementsByTagName("thead").length==0){the=document.createElement("thead");the.appendChild(b.rows[0]);b.insertBefore(the,b.firstChild)}if(b.tHead==null){b.tHead=b.getElementsByTagName("thead")[0]}if(b.tHead.rows.length!=1){return}sortbottomrows=[];for(var a=0;a<b.rows.length;a++){if(b.rows[a].className.search(/\bsortbottom\b/)!=-1){sortbottomrows[sortbottomrows.length]=b.rows[a]}}if(sortbottomrows){if(b.tFoot==null){tfo=document.createElement("tfoot");b.appendChild(tfo)}for(var a=0;a<sortbottomrows.length;a++){tfo.appendChild(sortbottomrows[a])}delete sortbottomrows}headrow=b.tHead.rows[0].cells;for(var a=0;a<headrow.length;a++){if(!headrow[a].className.match(/\bsorttable_nosort\b/)){mtch=headrow[a].className.match(/\bsorttable_([a-z0-9]+)\b/);if(mtch){override=mtch[1]}if(mtch&&typeof sorttable["sort_"+override]=="function"){headrow[a].sorttable_sortfunction=sorttable["sort_"+override]}else{headrow[a].sorttable_sortfunction=sorttable.guessType(b,a)}headrow[a].sorttable_columnindex=a;headrow[a].sorttable_tbody=b.tBodies[0];dean_addEvent(headrow[a],"click",function(f){if(this.className.search(/\bsorttable_sorted\b/)!=-1){sorttable.reverse(this.sorttable_tbody);this.className=this.className.replace("sorttable_sorted","sorttable_sorted_reverse");this.removeChild(document.getElementById("sorttable_sortfwdind"));sortrevind=document.createElement("span");sortrevind.id="sorttable_sortrevind";sortrevind.innerHTML=stIsIE?'&nbsp<font face="webdings">5</font>':"&nbsp;&#x25B4;";this.appendChild(sortrevind);return}if(this.className.search(/\bsorttable_sorted_reverse\b/)!=-1){sorttable.reverse(this.sorttable_tbody);this.className=this.className.replace("sorttable_sorted_reverse","sorttable_sorted");this.removeChild(document.getElementById("sorttable_sortrevind"));sortfwdind=document.createElement("span");sortfwdind.id="sorttable_sortfwdind";sortfwdind.innerHTML=stIsIE?'&nbsp<font face="webdings">6</font>':"&nbsp;&#x25BE;";this.appendChild(sortfwdind);return}theadrow=this.parentNode;forEach(theadrow.childNodes,function(e){if(e.nodeType==1){e.className=e.className.replace("sorttable_sorted_reverse","");e.className=e.className.replace("sorttable_sorted","")}});sortfwdind=document.getElementById("sorttable_sortfwdind");if(sortfwdind){sortfwdind.parentNode.removeChild(sortfwdind)}sortrevind=document.getElementById("sorttable_sortrevind");if(sortrevind){sortrevind.parentNode.removeChild(sortrevind)}this.className+=" sorttable_sorted";sortfwdind=document.createElement("span");sortfwdind.id="sorttable_sortfwdind";sortfwdind.innerHTML=stIsIE?'&nbsp<font face="webdings">6</font>':"&nbsp;&#x25BE;";this.appendChild(sortfwdind);row_array=[];col=this.sorttable_columnindex;rows=this.sorttable_tbody.rows;for(var c=0;c<rows.length;c++){row_array[row_array.length]=[sorttable.getInnerText(rows[c].cells[col]),rows[c]]}row_array.sort(this.sorttable_sortfunction);tb=this.sorttable_tbody;for(var c=0;c<row_array.length;c++){tb.appendChild(row_array[c][1])}delete row_array})}}},guessType:function(c,b){sortfn=sorttable.sort_alpha;for(var a=0;a<c.tBodies[0].rows.length;a++){text=sorttable.getInnerText(c.tBodies[0].rows[a].cells[b]);if(text!=""){if(text.match(/^-?[�$�]?[\d,.]+%?$/)){return sorttable.sort_numeric}possdate=text.match(sorttable.DATE_RE);if(possdate){first=parseInt(possdate[1]);second=parseInt(possdate[2]);if(first>12){return sorttable.sort_ddmm}else{if(second>12){return sorttable.sort_mmdd}else{sortfn=sorttable.sort_ddmm}}}}}return sortfn},getInnerText:function(b){hasInputs=(typeof b.getElementsByTagName=="function")&&b.getElementsByTagName("input").length;if(b.getAttribute("sorttable_customkey")!=null){return b.getAttribute("sorttable_customkey")}else{if(typeof b.textContent!="undefined"&&!hasInputs){return b.textContent.replace(/^\s+|\s+$/g,"")}else{if(typeof b.innerText!="undefined"&&!hasInputs){return b.innerText.replace(/^\s+|\s+$/g,"")}else{if(typeof b.text!="undefined"&&!hasInputs){return b.text.replace(/^\s+|\s+$/g,"")}else{switch(b.nodeType){case 3:if(b.nodeName.toLowerCase()=="input"){return b.value.replace(/^\s+|\s+$/g,"")}case 4:return b.nodeValue.replace(/^\s+|\s+$/g,"");break;case 1:case 11:var c="";for(var a=0;a<b.childNodes.length;a++){c+=sorttable.getInnerText(b.childNodes[a])}return c.replace(/^\s+|\s+$/g,"");break;default:return""}}}}}},reverse:function(a){newrows=[];for(var b=0;b<a.rows.length;b++){newrows[newrows.length]=a.rows[b]}for(var b=newrows.length-1;b>=0;b--){a.appendChild(newrows[b])}delete newrows},sort_numeric:function(e,c){aa=parseFloat(e[0].replace(/[^0-9.-]/g,""));if(isNaN(aa)){aa=0}bb=parseFloat(c[0].replace(/[^0-9.-]/g,""));if(isNaN(bb)){bb=0}return aa-bb},sort_alpha:function(e,c){if(e[0]==c[0]){return 0}if(e[0]<c[0]){return -1}return 1},sort_ddmm:function(e,c){mtch=e[0].match(sorttable.DATE_RE);y=mtch[3];m=mtch[2];d=mtch[1];if(m.length==1){m="0"+m}if(d.length==1){d="0"+d}dt1=y+m+d;mtch=c[0].match(sorttable.DATE_RE);y=mtch[3];m=mtch[2];d=mtch[1];if(m.length==1){m="0"+m}if(d.length==1){d="0"+d}dt2=y+m+d;if(dt1==dt2){return 0}if(dt1<dt2){return -1}return 1},sort_mmdd:function(e,c){mtch=e[0].match(sorttable.DATE_RE);y=mtch[3];d=mtch[2];m=mtch[1];if(m.length==1){m="0"+m}if(d.length==1){d="0"+d}dt1=y+m+d;mtch=c[0].match(sorttable.DATE_RE);y=mtch[3];d=mtch[2];m=mtch[1];if(m.length==1){m="0"+m}if(d.length==1){d="0"+d}dt2=y+m+d;if(dt1==dt2){return 0}if(dt1<dt2){return -1}return 1},shaker_sort:function(h,f){var a=0;var e=h.length-1;var j=true;while(j){j=false;for(var c=a;c<e;++c){if(f(h[c],h[c+1])>0){var g=h[c];h[c]=h[c+1];h[c+1]=g;j=true}}e--;if(!j){break}for(var c=e;c>a;--c){if(f(h[c],h[c-1])<0){var g=h[c];h[c]=h[c-1];h[c-1]=g;j=true}}a++}}};if(document.addEventListener){document.addEventListener("DOMContentLoaded",sorttable.init,false);
/*@cc_on @*/
/*@if (@_win32)
    document.write("<script id=__ie_onload defer src=javascript:void(0)><\/script>");
    var script = document.getElementById("__ie_onload");
    script.onreadystatechange = function() {
        if (this.readyState == "complete") {
            sorttable.init(); // call the onload handler
        }
    };
/*@end @*/
}if(/WebKit/i.test(navigator.userAgent)){var _timer=setInterval(function(){if(/loaded|complete/.test(document.readyState)){sorttable.init()}},10)}window.onload=sorttable.init;function dean_addEvent(b,e,c){if(b.addEventListener){b.addEventListener(e,c,false)}else{if(!c.$$guid){c.$$guid=dean_addEvent.guid++}if(!b.events){b.events={}}var a=b.events[e];if(!a){a=b.events[e]={};if(b["on"+e]){a[0]=b["on"+e]}}a[c.$$guid]=c;b["on"+e]=handleEvent}}dean_addEvent.guid=1;function removeEvent(a,c,b){if(a.removeEventListener){a.removeEventListener(c,b,false)}else{if(a.events&&a.events[c]){delete a.events[c][b.$$guid]}}}function handleEvent(e){var c=true;e=e||fixEvent(((this.ownerDocument||this.document||this).parentWindow||window).event);var a=this.events[e.type];for(var b in a){this.$$handleEvent=a[b];if(this.$$handleEvent(e)===false){c=false}}return c}function fixEvent(a){a.preventDefault=fixEvent.preventDefault;a.stopPropagation=fixEvent.stopPropagation;return a}fixEvent.preventDefault=function(){this.returnValue=false};fixEvent.stopPropagation=function(){this.cancelBubble=true};if(!Array.forEach){Array.forEach=function(e,c,b){for(var a=0;a<e.length;a++){c.call(b,e[a],a,e)}}}Function.prototype.forEach=function(a,e,c){for(var b in a){if(typeof this.prototype[b]=="undefined"){e.call(c,a[b],b,a)}}};String.forEach=function(a,c,b){Array.forEach(a.split(""),function(f,e){c.call(b,f,e,a)})};var forEach=function(a,e,b){if(a){var c=Object;if(a instanceof Function){c=Function}else{if(a.forEach instanceof Function){a.forEach(e,b);return}else{if(typeof a=="string"){c=String}else{if(typeof a.length=="number"){c=Array}}}}c.forEach(a,e,b)}};