var RedBox={overlay:true,onDisplay:null,showInline:function(A){this.appearWindow();this.cloneWindowContents(A)},showHtml:function(A){this.appearWindow();this.htmlWindowContents(A)},appearWindow:function(){var C=$("RB_loading");if(C&&C.visible()){C.hide()}else{this.showOverlay()}var B={duration:0.4,queue:"end"},A=$("RB_window");if(this.onDisplay){B.afterFinish=this.onDisplay}new Effect.Appear(A,B);A.scrollTo()},loading:function(){this.showOverlay();var A=$("RB_loading");if(A){A.show()}this.setWindowPosition()},close:function(){new Effect.Fade("RB_window",{duration:0.4});if(this.overlay){new Effect.Fade("RB_overlay",{duration:0.4})}},showOverlay:function(){var B=$("RB_redbox");if(!B){B=new Element("DIV",{id:"RB_redbox",align:"center"});$(document.body).insert(B);var A=new Element("DIV",{id:"RB_overlay"}).hide();B.insert({top:new Element("DIV",{id:"RB_window"}).hide()}).insert({top:A});if(this.overlay){A.insert({top:new Element("DIV",{id:"RB_loading"}).hide()})}}if(this.overlay){this.setOverlaySize();new Effect.Appear("RB_overlay",{duration:0.4,to:0.6,queue:"end"})}},setOverlaySize:function(){if(window.innerHeight&&window.scrollMaxY){yScroll=window.innerHeight+window.scrollMaxY}else{if(document.body.scrollHeight>document.body.offsetHeight){yScroll=document.body.scrollHeight}else{yScroll=document.body.offsetHeight}}Element.setStyle("RB_overlay",{height:yScroll+"px"})},setWindowPosition:function(){var B=$("RB_window");var C=B.getDimensions(),A=document.viewport.getDimensions();B.setStyle({width:"auto",height:"auto",left:((A.width-C.width)/2)+"px",top:((A.height-C.height)/2)+"px"})},cloneWindowContents:function(A){$("RB_window").appendChild($($(A).cloneNode(true)).setStyle({display:"block"}));this.setWindowPosition()},htmlWindowContents:function(A){$("RB_window").update(A);this.setWindowPosition()},getWindowContents:function(){var A=$("RB_window");return A.visible()?A.down():null},overlayVisible:function(){var A=$("RB_overlay");return A&&A.visible()}};