function HideablePanel(){this.mContainer=null;this.mPositionRefernceElement=null;this.mPanel=null;this.mBody=null;this.mCloseButton=null;this.mDimensions=null;this.mAnimate=true;this.mIsHidden=false;this.CLASSNAME="hideablePanel";this.CLASSNAME_BODY="body";this.CLASSNAME_HIDE_BUTTON="closeButton";this.DEFAULT_ZINDEX=999999;this.HIDE_TEXT="Close";this.HIDE_INSTRCUTIONS="Click to close!";this.init=function(){if(!this.mPanel){this.mPanel=$(document.createElement("div"));this.mContainer.appendChild(this.mPanel)}if(!this.mBody){this.mBody=$(document.createElement("div"));this.mPanel.appendChild(this.mBody)}this.mCloseButton=$(document.createElement("a"));this.mCloseButton.href="javascript: var closeButton;";this.mCloseButton.title=this.HIDE_INSTRCUTIONS;this.mPanel.addClassName(this.CLASSNAME);this.mBody.addClassName(this.CLASSNAME_BODY);this.mCloseButton.addClassName(this.CLASSNAME_HIDE_BUTTON);this.mPanel.appendChild(this.mCloseButton);var A=this;this.mCloseButton.onclick=function(){A.hide()};this.mPanel.style.position="absolute";this.mPanel.style.top=0+"px";this.mPanel.style.left=0+"px";this.mPanel.style.overflow="hidden";this.mPanel.style.zIndex=this.DEFAULT_ZINDEX;this.mCloseButton.style.position="absolute";this.mCloseButton.style.right=20+"px";this.mCloseButton.style.top=10+"px";if(!this.mCloseButton.style.backgroundImage){this.mCloseButton.update(this.HIDE_TEXT)}this.mPanel.style.width=0+"px";this.mPanel.style.height=0+"px";this.mBody.style.overflow="auto";this.mPanel.hide();this.mIsHidden=true};this.render=function(A){if(A){this.mContainer=A;this.init()}};this.associate=function(A){if(A){A=$(A);this.mContainer=A.up();this.mPanel=A;this.mBody=A.immediateDescendants()[0];this.init()}};this.hide=function(){this.mIsHidden=true;if(this.mAnimate==true){ElementEffects.animateElementGrowth(this.mPanel,[this.mDimensions[0],0],55,0.45)}else{this.mPanel.hide()}};this.show=function(){this.mIsHidden=false;this.mPanel.show();this.updatePosition();if(this.mAnimate==true){this.mPanel.style.width=this.mDimensions[0]+"px";this.mPanel.style.height=0+"px";ElementEffects.animateElementGrowth(this.mPanel,this.mDimensions,55,0.45)}};this.toggle=function(){if(this.mIsHidden==true){this.show()}else{this.hide()}};this.updatePosition=function(){if(this.mPanel&&this.mPositionRefernceElement){var C=this.mPositionRefernceElement.cumulativeOffset();var A=jshGetWindowSize();var B=$([0,0]);B[0]=C[0];B[1]=C[1]+this.mPositionRefernceElement.getHeight();if((B[0]+this.mDimensions[0])>A[0]){B[0]=C[0]+this.mPositionRefernceElement.getWidth()-this.mDimensions[0];if((B[0]+this.mDimensions[0])>A[0]){B[0]=(A[0]-this.mDimensions[0])}}this.mPanel.style.left=B[0]+"px";this.mPanel.style.top=B[1]+"px"}};this.setPostionRefernceElement=function(A){this.mPositionRefernceElement=$(A);this.updatePosition()};this.setDimensions=function(A){this.mDimensions=A;if(this.mPanel){this.mPanel.style.width=this.mDimensions[0]+"px";this.mPanel.style.height=this.mDimensions[1]+"px";var B=jshBorderOffset(this.mBody,[0,0]);this.mBody.style.width=(this.mDimensions[0]-B[0])+"px";this.mBody.style.height=(this.mDimensions[1]-B[1])+"px"}this.updatePosition()};this.setAnimate=function(A){this.mAnimate=A}};
