From d106c12aa2525b4fd6aed0ebf0923c6d6e8351e7 Mon Sep 17 00:00:00 2001 From: Gabriele Date: Wed, 5 Nov 2014 23:00:00 +0100 Subject: [PATCH] Restricts hacks and workarounds to IE < 9 --- src/webui/www/public/scripts/mocha-yc.js | 2 +- src/webui/www/public/scripts/mocha.js | 78 ++++++++++++------------ 2 files changed, 41 insertions(+), 39 deletions(-) diff --git a/src/webui/www/public/scripts/mocha-yc.js b/src/webui/www/public/scripts/mocha-yc.js index ebc98b4ae..0008ca7d2 100644 --- a/src/webui/www/public/scripts/mocha-yc.js +++ b/src/webui/www/public/scripts/mocha-yc.js @@ -1 +1 @@ -var MUI=MochaUI=new Hash({version:"0.9.6 development",options:new Hash({theme:"default",advancedEffects:false,standardEffects:true}),path:{source:"scripts/source/",themes:"themes/",plugins:"plugins/"},themePath:function(){return MUI.path.themes+MUI.options.theme+"/"},files:new Hash()});MUI.files[MUI.path.source+"Core/Core.js"]="loaded";MUI.extend({Windows:{instances:new Hash()},ieSupport:"excanvas",updateContent:function(c){var c=$extend({element:null,childElement:null,method:null,data:null,title:null,content:null,loadMethod:null,url:null,scrollbars:null,padding:null,require:{},onContentLoaded:$empty},c);c.require=$extend({css:[],images:[],js:[],onload:null},c.require);var b={};if(!c.element){return}var d=c.element;if(MUI.Windows.instances.get(d.id)){b.recipient="window"}else{b.recipient="panel"}var a=d.retrieve("instance");if(c.title){a.titleEl.set("html",c.title)}var e=a.contentEl;b.contentContainer=c.childElement!=null?c.childElement:a.contentEl;var g=a.contentWrapperEl;if(!c.loadMethod){if(!a.options.loadMethod){if(!c.url){c.loadMethod="html"}else{c.loadMethod="xhr"}}else{c.loadMethod=a.options.loadMethod}}var f=c.scrollbars||a.options.scrollbars;if(b.contentContainer==a.contentEl){g.setStyles({overflow:f!=false&&c.loadMethod!="iframe"?"auto":"hidden"})}if(c.padding!=null){e.setStyles({"padding-top":c.padding.top,"padding-bottom":c.padding.bottom,"padding-left":c.padding.left,"padding-right":c.padding.right})}if(b.contentContainer==e){e.empty().show();e.getAllNext(".column").destroy();e.getAllNext(".columnHandle").destroy()}b.onContentLoaded=function(){if(c.require.js.length||typeof c.require.onload=="function"){new MUI.Require({js:c.require.js,onload:function(){if(Browser.Engine.presto){c.require.onload.delay(100)}else{c.require.onload()}c.onContentLoaded?c.onContentLoaded():a.fireEvent("onContentLoaded",d)}.bind(this)})}else{c.onContentLoaded?c.onContentLoaded():a.fireEvent("onContentLoaded",d)}};if(c.require.css.length||c.require.images.length){new MUI.Require({css:c.require.css,images:c.require.images,onload:function(){this.loadSelect(a,c,b)}.bind(this)})}else{this.loadSelect(a,c,b)}},loadSelect:function(a,c,b){switch(c.loadMethod){case"xhr":this.updateContentXHR(a,c,b);break;case"iframe":this.updateContentIframe(a,c,b);break;case"html":default:this.updateContentHTML(a,c,b);break}},updateContentXHR:function(a,c,b){var f=a.contentEl;var e=b.contentContainer;var d=b.onContentLoaded;new Request.HTML({url:c.url,update:e,method:c.method!=null?c.method:"get",data:c.data!=null?new Hash(c.data).toQueryString():"",evalScripts:a.options.evalScripts,evalResponse:a.options.evalResponse,onRequest:function(){if(b.recipient=="window"&&e==f){a.showSpinner()}else{if(b.recipient=="panel"&&e==f&&$("spinner")){$("spinner").show()}}}.bind(this),onFailure:function(g){if(e==f){var j=new RegExp("[\n\rs]*(.*)[\n\rs]*","gmi");var h=j.exec(g.responseText);if(!h){h="Unknown"}e.set("html","

Error: "+h[1]+"

");if(b.recipient=="window"){a.hideSpinner()}else{if(b.recipient=="panel"&&$("spinner")){$("spinner").hide()}}}}.bind(this),onSuccess:function(){if(e==f){if(b.recipient=="window"){a.hideSpinner()}else{if(b.recipient=="panel"&&$("spinner")){$("spinner").hide()}}}Browser.Engine.trident4?d.delay(750):d()}.bind(this),onComplete:function(){}.bind(this)}).send()},updateContentIframe:function(a,c,b){var f=a.contentEl;var e=b.contentContainer;var g=a.contentWrapperEl;var d=b.onContentLoaded;if(a.options.contentURL==""||e!=f){return}a.iframeEl=new Element("iframe",{id:a.options.id+"_iframe",name:a.options.id+"_iframe","class":"mochaIframe",src:c.url,marginwidth:0,marginheight:0,frameBorder:0,scrolling:"auto",styles:{height:g.offsetHeight-g.getStyle("border-top").toInt()-g.getStyle("border-bottom").toInt(),width:a.panelEl?g.offsetWidth-g.getStyle("border-left").toInt()-g.getStyle("border-right").toInt():"100%"}}).injectInside(f);a.iframeEl.addEvent("load",function(h){if(b.recipient=="window"){a.hideSpinner()}else{if(b.recipient=="panel"&&e==f&&$("spinner")){$("spinner").hide()}}Browser.Engine.trident4?d.delay(50):d()}.bind(this));if(b.recipient=="window"){a.showSpinner()}else{if(b.recipient=="panel"&&e==f&&$("spinner")){$("spinner").show()}}},updateContentHTML:function(a,c,b){var f=a.contentEl;var e=b.contentContainer;var d=b.onContentLoaded;var g=new Array("element","textnode","whitespace","collection");if(g.contains($type(c.content))){c.content.inject(e)}else{e.set("html",c.content)}if(e==f){if(b.recipient=="window"){a.hideSpinner()}else{if(b.recipient=="panel"&&$("spinner")){$("spinner").hide()}}}Browser.Engine.trident4?d.delay(50):d()},reloadIframe:function(a){Browser.Engine.gecko?$(a).src=$(a).src:top.frames[a].location.reload(true)},roundedRect:function(f,d,j,h,c,b,g,e){f.fillStyle="rgba("+g.join(",")+","+e+")";f.beginPath();f.moveTo(d,j+b);f.lineTo(d,j+c-b);f.quadraticCurveTo(d,j+c,d+b,j+c);f.lineTo(d+h-b,j+c);f.quadraticCurveTo(d+h,j+c,d+h,j+c-b);f.lineTo(d+h,j+b);f.quadraticCurveTo(d+h,j,d+h-b,j);f.lineTo(d+b,j);f.quadraticCurveTo(d,j,d,j+b);f.fill()},triangle:function(e,c,h,g,b,f,d){e.beginPath();e.moveTo(c+g,h);e.lineTo(c,h+b);e.lineTo(c+g,h+b);e.closePath();e.fillStyle="rgba("+f.join(",")+","+d+")";e.fill()},circle:function(d,b,g,f,e,c){d.beginPath();d.arc(b,g,f,0,Math.PI*2,true);d.fillStyle="rgba("+e.join(",")+","+c+")";d.fill()},notification:function(a){new MUI.Window({loadMethod:"html",closeAfter:1500,type:"notification",addClass:"notification",content:a,width:220,height:40,y:53,padding:{top:10,right:12,bottom:10,left:12},shadowBlur:5})},toggleAdvancedEffects:function(a){if(MUI.options.advancedEffects==false){MUI.options.advancedEffects=true;if(a){this.toggleAdvancedEffectsLink=new Element("div",{"class":"check",id:"toggleAdvancedEffects_check"}).inject(a)}}else{MUI.options.advancedEffects=false;if(this.toggleAdvancedEffectsLink){this.toggleAdvancedEffectsLink.destroy()}}},toggleStandardEffects:function(a){if(MUI.options.standardEffects==false){MUI.options.standardEffects=true;if(a){this.toggleStandardEffectsLink=new Element("div",{"class":"check",id:"toggleStandardEffects_check"}).inject(a)}}else{MUI.options.standardEffects=false;if(this.toggleStandardEffectsLink){this.toggleStandardEffectsLink.destroy()}}},underlayInitialize:function(){var a=new Element("div",{id:"windowUnderlay",styles:{height:parent.getCoordinates().height,opacity:0.01,display:"none"}}).inject(document.body)},setUnderlaySize:function(){$("windowUnderlay").setStyle("height",parent.getCoordinates().height)}});function fixPNG(e){if(Browser.Engine.trident4&&document.body.filters){var b=(e.id)?"id='"+e.id+"' ":"";var d=(e.className)?"class='"+e.className+"' ":"";var f=(e.title)?"title='"+e.title+"' ":"title='"+e.alt+"' ";var c="display:inline-block;"+e.style.cssText;var a="";e.outerHTML=a}}document.addEvent("mousedown",function(a){MUI.blurAll.delay(50)});window.addEvent("domready",function(){MUI.underlayInitialize()});window.addEvent("resize",function(){if($("windowUnderlay")){MUI.setUnderlaySize()}else{MUI.underlayInitialize()}});Element.implement({hide:function(){this.setStyle("display","none");return this},show:function(){this.setStyle("display","block");return this}});Element.implement({shake:function(b,h){b=b||3;h=h||500;h=(h/50).toInt()-1;var e=this.getParent();if(e!=$(document.body)&&e.getStyle("position")=="static"){e.setStyle("position","relative")}var a=this.getStyle("position");if(a=="static"){this.setStyle("position","relative");a="relative"}if(Browser.Engine.trident){e.setStyle("height",e.getStyle("height"))}var g=this.getPosition(e);if(a=="relative"&&!Browser.Engine.presto){g.x-=e.getStyle("paddingLeft").toInt();g.y-=e.getStyle("paddingTop").toInt()}var f=this.retrieve("morph");if(f){f.cancel();var c=f.options}var f=this.get("morph",{duration:50,link:"chain"});for(var d=0;d]*>([\s\S]*?)<\/body>/i);c=(b)?b[1]:c;var a=new Element("div");return a.set("html",c)}});MUI.getCSSRule=function(b){for(var c=0;c=200)&&(a<300))}});Browser.Request=function(){return $try(function(){return new ActiveXObject("MSXML2.XMLHTTP")},function(){return new XMLHttpRequest()})}}MUI.Require=new Class({Implements:[Options],options:{css:[],images:[],js:[],onload:$empty},initialize:function(a){this.setOptions(a);var a=this.options;this.assetsToLoad=a.css.length+a.images.length+a.js.length;this.assetsLoaded=0;var b=0;if(a.css.length){a.css.each(function(c){this.getAsset(c,function(){if(b==a.css.length-1){if(this.assetsLoaded==this.assetsToLoad-1){this.requireOnload()}else{this.assetsLoaded++;this.requireContinue.delay(50,this)}}else{b++;this.assetsLoaded++}}.bind(this))}.bind(this))}else{if(!a.js.length&&!a.images.length){this.options.onload();return true}else{this.requireContinue.delay(50,this)}}},requireOnload:function(){this.assetsLoaded++;if(this.assetsLoaded==this.assetsToLoad){this.options.onload();return true}},requireContinue:function(){var a=this.options;if(a.images.length){a.images.each(function(b){this.getAsset(b,this.requireOnload.bind(this))}.bind(this))}if(a.js.length){a.js.each(function(b){this.getAsset(b,this.requireOnload.bind(this))}.bind(this))}},getAsset:function(b,c){if(MUI.files[b]=="loaded"){if(typeof c=="function"){c()}return true}else{if(MUI.files[b]=="loading"){var d=0;var a=(function(){d++;if(MUI.files[b]=="loading"&&d<"100"){return}$clear(a);if(typeof c=="function"){c()}}).periodical(50)}else{MUI.files[b]="loading";properties={onload:c!="undefined"?c:$empty};var e=properties.onload;properties.onload=function(){MUI.files[b]="loaded";if(e){e()}}.bind(this);switch(b.match(/\.\w+$/)[0]){case".js":return Asset.javascript(b,properties);case".css":return Asset.css(b,properties);case".jpg":case".png":case".gif":return Asset.image(b,properties)}alert('The required file "'+b+'" could not be loaded')}}}});$extend(Asset,{javascript:function(f,d){d=$extend({onload:$empty,document:document,check:$lambda(true)},d);if($(d.id)){d.onload();return $(d.id)}var b=new Element("script",{src:f,type:"text/javascript"});var e=d.onload.bind(b),a=d.check,g=d.document;delete d.onload;delete d.check;delete d.document;if(!Browser.Engine.webkit419&&!Browser.Engine.presto){b.addEvents({load:e,readystatechange:function(){if(Browser.Engine.trident&&["loaded","complete"].contains(this.readyState)){e()}}}).setProperties(d)}else{var c=(function(){if(!$try(a)){return}$clear(c);Browser.Engine.presto?e.delay(500):e()}).periodical(50)}return b.inject(g.head)},css:function(b,a){a=$extend({id:null,media:"screen",onload:$empty},a);new Request({method:"get",url:b,onComplete:function(c){var d=new Element("link",{id:a.id,rel:"stylesheet",media:a.media,type:"text/css",href:b}).inject(document.head);a.onload()}.bind(this),onFailure:function(c){},onSuccess:function(){}.bind(this)}).send()}});MUI.extend({newWindowsFromJSON:function(a){new MUI.Require({js:[MUI.path.source+"Window/Windows-from-json.js"],onload:function(){new MUI.newWindowsFromJSON(a)}})},arrangeCascade:function(){new MUI.Require({js:[MUI.path.source+"Window/Arrange-cascade.js"],onload:function(){new MUI.arrangeCascade()}})},arrangeTile:function(){new MUI.Require({js:[MUI.path.source+"Window/Arrange-tile.js"],onload:function(){new MUI.arrangeTile()}})},saveWorkspace:function(){new MUI.Require({js:[MUI.path.source+"Layout/Workspaces.js"],onload:function(){new MUI.saveWorkspace()}})},loadWorkspace:function(){new MUI.Require({js:[MUI.path.source+"Layout/Workspaces.js"],onload:function(){new MUI.loadWorkspace()}})},Themes:{init:function(a){new MUI.Require({js:[MUI.path.source+"Utilities/Themes.js"],onload:function(){MUI.Themes.init(a)}})}}});MUI.files[MUI.path.source+"Utilities/Themes.js"]=1;MUI.Themes={init:function(a){this.newTheme=a.toLowerCase();if(!this.newTheme||this.newTheme==null||this.newTheme==MUI.options.theme.toLowerCase()){return}if($("spinner")){$("spinner").show()}this.oldURIs=[];this.oldSheets=[];$$("link").each(function(c){var b=c.get("href");if(b.contains(MUI.path.themes+MUI.options.theme)){this.oldURIs.push(b);this.oldSheets.push(c)}}.bind(this));this.newSheetURLs=this.oldURIs.map(function(c,b){return c.replace("/"+MUI.options.theme+"/","/"+MUI.Themes.newTheme+"/")}.bind(this));this.sheetsToLoad=this.oldURIs.length;this.sheetsLoaded=0;this.newSheets=[];this.newSheetURLs.each(function(d){var b=d;var c=new Request({method:"get",url:b,onComplete:function(e){var f=new Element("link",{rel:"stylesheet",media:"screen",type:"text/css",href:b});this.newSheets.push(f)}.bind(this),onFailure:function(e){this.themeLoadSuccess=false;if($("spinner")){$("spinner").hide()}MUI.notification("Stylesheets did not load.")},onSuccess:function(){this.sheetsLoaded++;if(this.sheetsLoaded==this.sheetsToLoad){this.updateThemeStylesheets();this.themeLoadSuccess=true}}.bind(this)});c.send()}.bind(this))},updateThemeStylesheets:function(){this.oldSheets.each(function(a){a.destroy()});this.newSheets.each(function(a){MUI.files[a.get("href")]=1;a.inject(document.head)});if(Browser.Engine.trident){this.redraw.delay(1250,this)}else{this.redraw.delay(250,this)}},redraw:function(){$$(".replaced").removeClass("replaced");$$(".mocha").each(function(c){var b=c.retrieve("instance");b.setColors();b.drawWindow()});if(MUI.Dock){if(MUI.Dock.options.useControls){MUI.Dock.setDockColors();MUI.Dock.renderDockControls()}}if(MUI.Desktop.desktop){var a=(function(){if(MUI.Desktop.desktop.getStyle("overflow")!="hidden"){return}$clear(a);MUI.Desktop.setDesktopSize()}).periodical(50)}if($("spinner")){$("spinner").hide()}MUI.options.theme=this.newTheme}};window.addEvent("load",function(){if($("themeControl")){$("themeControl").getElements("option").setProperty("selected","false");if($("chooseTheme")){$("chooseTheme").setProperty("selected","true")}}});MUI.files[MUI.path.source+"Window/Window.js"]="loading";MUI.extend({Windows:{instances:new Hash(),indexLevel:100,windowIDCount:0,windowsVisible:true,focusingWindow:false}});MUI.Windows.windowOptions={id:null,title:"New Window",icon:false,type:"window",require:{css:[],images:[],js:[],onload:null},loadMethod:null,method:"get",contentURL:null,data:null,closeAfter:false,evalScripts:true,evalResponse:false,content:"Window content",toolbar:false,toolbarPosition:"top",toolbarHeight:29,toolbarURL:"pages/lipsum.html",toolbarData:null,toolbarContent:"",toolbarOnload:$empty,toolbar2:false,toolbar2Position:"bottom",toolbar2Height:29,toolbar2URL:"pages/lipsum.html",toolbar2Data:null,toolbar2Content:"",toolbar2Onload:$empty,container:null,restrict:true,shape:"box",collapsible:true,minimizable:true,maximizable:true,closable:true,storeOnClose:false,modalOverlayClose:true,draggable:null,draggableGrid:false,draggableLimit:false,draggableSnap:false,resizable:null,resizeLimit:{x:[250,2500],y:[125,2000]},addClass:"",width:300,height:125,headerHeight:25,footerHeight:25,cornerRadius:8,x:null,y:null,scrollbars:true,padding:{top:10,right:12,bottom:10,left:12},shadowBlur:5,shadowOffset:{x:0,y:1},controlsOffset:{right:6,top:6},useCanvas:true,useCanvasControls:true,useSpinner:true,headerStartColor:[250,250,250],headerStopColor:[229,229,229],bodyBgColor:[229,229,229],minimizeBgColor:[255,255,255],minimizeColor:[0,0,0],maximizeBgColor:[255,255,255],maximizeColor:[0,0,0],closeBgColor:[255,255,255],closeColor:[0,0,0],resizableColor:[254,254,254],onBeforeBuild:$empty,onContentLoaded:$empty,onFocus:$empty,onBlur:$empty,onResize:$empty,onMinimize:$empty,onMaximize:$empty,onRestore:$empty,onClose:$empty,onCloseComplete:$empty};MUI.Windows.windowOptionsOriginal=$merge(MUI.Windows.windowOptions);MUI.Window=new Class({Implements:[Events,Options],options:MUI.Windows.windowOptions,initialize:function(a){this.setOptions(a);var a=this.options;$extend(this,{mochaControlsWidth:0,minimizebuttonX:0,maximizebuttonX:0,closebuttonX:0,headerFooterShadow:a.headerHeight+a.footerHeight+(a.shadowBlur*2),oldTop:0,oldLeft:0,isMaximized:false,isMinimized:false,isCollapsed:false,timestamp:$time()});if(a.type!="window"){a.container=document.body;a.minimizable=false}if(!a.container){a.container=MUI.Desktop&&MUI.Desktop.desktop?MUI.Desktop.desktop:document.body}if(a.resizable==null){if(a.type!="window"||a.shape=="gauge"){a.resizable=false}else{a.resizable=true}}if(a.draggable==null){a.draggable=a.type!="window"?false:true}if(a.shape=="gauge"||a.type=="notification"){a.collapsible=false;a.maximizable=false;a.contentBgColor="transparent";a.scrollbars=false;a.footerHeight=0}if(a.type=="notification"){a.closable=false;a.headerHeight=0}if(MUI.Dock&&$(MUI.options.dock)){if(MUI.Dock.dock&&a.type!="modal"&&a.type!="modal2"){a.minimizable=a.minimizable}}else{a.minimizable=false}a.maximizable=MUI.Desktop&&MUI.Desktop.desktop&&a.maximizable&&a.type!="modal"&&a.type!="modal2";if(this.options.type=="modal2"){this.options.shadowBlur=0;this.options.shadowOffset={x:0,y:0};this.options.useSpinner=false;this.options.useCanvas=false;this.options.footerHeight=0;this.options.headerHeight=0}a.id=a.id||"win"+(++MUI.Windows.windowIDCount);this.windowEl=$(a.id);if(a.require.css.length||a.require.images.length){new MUI.Require({css:a.require.css,images:a.require.images,onload:function(){this.newWindow()}.bind(this)})}else{this.newWindow()}return this},saveValues:function(){var a=this.windowEl.getCoordinates();this.options.x=a.left.toInt();this.options.y=a.top.toInt()},newWindow:function(d){var b=MUI.Windows.instances;var k=MUI.Windows.instances.get(this.options.id);var l=this.options;if(k){var j=k}if(this.windowEl&&!this.isClosing){if(j.isMinimized){MUI.Dock.restoreMinimized(this.windowEl)}else{if(j.isCollapsed){MUI.collapseToggle(this.windowEl);setTimeout(MUI.focusWindow.pass(this.windowEl,this),10)}else{if(this.windowEl.hasClass("windowClosed")){if(j.check){j.check.show()}this.windowEl.removeClass("windowClosed");this.windowEl.setStyle("opacity",0);this.windowEl.addClass("mocha");if(MUI.Dock&&$(MUI.options.dock)&&j.options.type=="window"){var g=$(j.options.id+"_dockTab");if(g!=null){g.show()}MUI.Desktop.setDesktopSize()}j.displayNewWindow()}else{var h=document.getCoordinates();if(this.windowEl.getStyle("left").toInt()>h.width||this.windowEl.getStyle("top").toInt()>h.height){MUI.centerWindow(this.windowEl)}setTimeout(MUI.focusWindow.pass(this.windowEl,this),10);if(MUI.options.standardEffects==true){this.windowEl.shake()}}}}return}else{b.set(l.id,this)}this.isClosing=false;this.fireEvent("onBeforeBuild");MUI.Windows.indexLevel++;this.windowEl=new Element("div",{"class":"mocha",id:l.id,styles:{position:"absolute",width:l.width,height:l.height,display:"block",opacity:0,zIndex:MUI.Windows.indexLevel+=2}});this.windowEl.store("instance",this);this.windowEl.addClass(l.addClass);if(l.type=="modal2"){this.windowEl.addClass("modal2")}if(Browser.Engine.trident&&l.shape=="gauge"){this.windowEl.setStyle("backgroundImage","url(../images/spacer.gif)")}if((this.options.type=="modal"||l.type=="modal2")&&Browser.Platform.mac&&Browser.Engine.gecko){if(/Firefox[\/\s](\d+\.\d+)/.test(navigator.userAgent)){var c=new Number(RegExp.$1);if(c<3){this.windowEl.setStyle("position","fixed")}}}if(l.loadMethod=="iframe"){l.padding={top:0,right:0,bottom:0,left:0}}this.insertWindowElements();this.titleEl.set("html",l.title);this.contentWrapperEl.setStyle("overflow","hidden");this.contentEl.setStyles({"padding-top":l.padding.top,"padding-bottom":l.padding.bottom,"padding-left":l.padding.left,"padding-right":l.padding.right});if(l.shape=="gauge"){if(l.useCanvasControls){this.canvasControlsEl.setStyle("visibility","hidden")}else{this.controlsEl.setStyle("visibility","hidden")}this.windowEl.addEvent("mouseover",function(){this.mouseover=true;var m=function(){if(this.mouseover!=false){if(l.useCanvasControls){this.canvasControlsEl.setStyle("visibility","visible")}else{this.controlsEl.setStyle("visibility","visible")}this.canvasHeaderEl.setStyle("visibility","visible");this.titleEl.show()}};m.delay(0,this)}.bind(this));this.windowEl.addEvent("mouseleave",function(){this.mouseover=false;if(this.options.useCanvasControls){this.canvasControlsEl.setStyle("visibility","hidden")}else{this.controlsEl.setStyle("visibility","hidden")}this.canvasHeaderEl.setStyle("visibility","hidden");this.titleEl.hide()}.bind(this))}this.windowEl.inject(l.container);this.setColors();if(l.type!="notification"){this.setMochaControlsWidth()}MUI.updateContent({element:this.windowEl,content:l.content,method:l.method,url:l.contentURL,data:l.data,onContentLoaded:null,require:{js:l.require.js,onload:l.require.onload}});if(this.options.toolbar==true){MUI.updateContent({element:this.windowEl,childElement:this.toolbarEl,content:l.toolbarContent,loadMethod:"xhr",method:l.method,url:l.toolbarURL,data:l.toolbarData,onContentLoaded:l.toolbarOnload})}if(this.options.toolbar2==true){MUI.updateContent({element:this.windowEl,childElement:this.toolbar2El,content:l.toolbar2Content,loadMethod:"xhr",method:l.method,url:l.toolbar2URL,data:l.toolbar2Data,onContentLoaded:l.toolbar2Onload})}this.drawWindow();this.attachDraggable();this.attachResizable();this.setupEvents();if(l.resizable){this.adjustHandles()}if(l.container==document.body||l.container==MUI.Desktop.desktop){var a=window.getSize()}else{var a=$(this.options.container).getSize()}if(!l.y){if(MUI.Desktop&&MUI.Desktop.desktop){var e=(a.y*0.5)-(this.windowEl.offsetHeight*0.5);if(e<-l.shadowBlur){e=-l.shadowBlur}}else{var e=window.getScroll().y+(window.getSize().y*0.5)-(this.windowEl.offsetHeight*0.5);if(e<-l.shadowBlur){e=-l.shadowBlur}}}else{var e=l.y-l.shadowBlur}if(!this.options.x){var f=(a.x*0.5)-(this.windowEl.offsetWidth*0.5);if(f<-l.shadowBlur){f=-l.shadowBlur}}else{var f=l.x-l.shadowBlur}this.windowEl.setStyles({top:e,left:f});this.opacityMorph=new Fx.Morph(this.windowEl,{duration:350,transition:Fx.Transitions.Sine.easeInOut,onComplete:function(){if(Browser.Engine.trident){this.drawWindow()}}.bind(this)});this.displayNewWindow();this.morph=new Fx.Morph(this.windowEl,{duration:200});this.windowEl.store("morph",this.morph);this.resizeMorph=new Fx.Elements([this.contentWrapperEl,this.windowEl],{duration:400,transition:Fx.Transitions.Sine.easeInOut,onStart:function(){this.resizeAnimation=this.drawWindow.periodical(20,this)}.bind(this),onComplete:function(){$clear(this.resizeAnimation);this.drawWindow();if(this.iframeEl){this.iframeEl.setStyle("visibility","visible")}}.bind(this)});this.windowEl.store("resizeMorph",this.resizeMorph);if($(this.windowEl.id+"LinkCheck")){this.check=new Element("div",{"class":"check",id:this.options.id+"_check"}).inject(this.windowEl.id+"LinkCheck")}if(this.options.closeAfter!=false){MUI.closeWindow.delay(this.options.closeAfter,this,this.windowEl)}if(MUI.Dock&&$(MUI.options.dock)&&this.options.type=="window"){MUI.Dock.createDockTab(this.windowEl)}},displayNewWindow:function(){options=this.options;if(options.type=="modal"||options.type=="modal2"){MUI.currentModal=this.windowEl;if(Browser.Engine.trident4){$("modalFix").show()}$("modalOverlay").show();if(MUI.options.advancedEffects==false){$("modalOverlay").setStyle("opacity",0.6);this.windowEl.setStyles({zIndex:11000,opacity:1})}else{MUI.Modal.modalOverlayCloseMorph.cancel();MUI.Modal.modalOverlayOpenMorph.start({opacity:0.6});this.windowEl.setStyles({zIndex:11000});this.opacityMorph.start({opacity:1})}$$(".dockTab").removeClass("activeDockTab");$$(".mocha").removeClass("isFocused");this.windowEl.addClass("isFocused")}else{if(MUI.options.advancedEffects==false){this.windowEl.setStyle("opacity",1);setTimeout(MUI.focusWindow.pass(this.windowEl,this),10)}else{if(Browser.Engine.trident){this.drawWindow(false)}this.opacityMorph.start({opacity:1});setTimeout(MUI.focusWindow.pass(this.windowEl,this),10)}}},setupEvents:function(){var a=this.windowEl;if(this.closeButtonEl){this.closeButtonEl.addEvent("click",function(b){new Event(b).stop();MUI.closeWindow(a)}.bind(this))}if(this.options.type=="window"){a.addEvent("mousedown",function(b){if(Browser.Engine.trident){new Event(b).stop()}MUI.focusWindow(a);if(a.getStyle("top").toInt()<-this.options.shadowBlur){a.setStyle("top",-this.options.shadowBlur)}}.bind(this))}if(this.minimizeButtonEl){this.minimizeButtonEl.addEvent("click",function(b){new Event(b).stop();MUI.Dock.minimizeWindow(a)}.bind(this))}if(this.maximizeButtonEl){this.maximizeButtonEl.addEvent("click",function(b){new Event(b).stop();if(this.isMaximized){MUI.Desktop.restoreWindow(a)}else{MUI.Desktop.maximizeWindow(a)}}.bind(this))}if(this.options.collapsible==true){this.titleEl.addEvent("selectstart",function(b){b=new Event(b).stop()}.bind(this));if(Browser.Engine.trident){this.titleBarEl.addEvent("mousedown",function(b){this.titleEl.setCapture()}.bind(this));this.titleBarEl.addEvent("mouseup",function(b){this.titleEl.releaseCapture()}.bind(this))}this.titleBarEl.addEvent("dblclick",function(b){b=new Event(b).stop();MUI.collapseToggle(this.windowEl)}.bind(this))}},attachDraggable:function(){var a=this.windowEl;if(!this.options.draggable){return}this.windowDrag=new Drag.Move(a,{handle:this.titleBarEl,container:this.options.restrict==true?$(this.options.container):false,grid:this.options.draggableGrid,limit:this.options.draggableLimit,snap:this.options.draggableSnap,onStart:function(){if(this.options.type!="modal"&&this.options.type!="modal2"){MUI.focusWindow(a);$("windowUnderlay").show()}if(this.iframeEl){if(!Browser.Engine.trident){this.iframeEl.setStyle("visibility","hidden")}else{this.iframeEl.hide()}}}.bind(this),onComplete:function(){if(this.options.type!="modal"&&this.options.type!="modal2"){$("windowUnderlay").hide()}if(this.iframeEl){if(!Browser.Engine.trident){this.iframeEl.setStyle("visibility","visible")}else{this.iframeEl.show()}}this.saveValues()}.bind(this)})},attachResizable:function(){var a=this.windowEl;if(!this.options.resizable){return}this.resizable1=this.windowEl.makeResizable({handle:[this.n,this.ne,this.nw],limit:{y:[function(){return this.windowEl.getStyle("top").toInt()+this.windowEl.getStyle("height").toInt()-this.options.resizeLimit.y[1]}.bind(this),function(){return this.windowEl.getStyle("top").toInt()+this.windowEl.getStyle("height").toInt()-this.options.resizeLimit.y[0]}.bind(this)]},modifiers:{x:false,y:"top"},onStart:function(){this.resizeOnStart();this.coords=this.contentWrapperEl.getCoordinates();this.y2=this.coords.top.toInt()+this.contentWrapperEl.offsetHeight}.bind(this),onDrag:function(){this.coords=this.contentWrapperEl.getCoordinates();this.contentWrapperEl.setStyle("height",this.y2-this.coords.top.toInt());this.resizeOnDrag()}.bind(this),onComplete:function(){this.resizeOnComplete()}.bind(this)});this.resizable2=this.contentWrapperEl.makeResizable({handle:[this.e,this.ne],limit:{x:[this.options.resizeLimit.x[0]-(this.options.shadowBlur*2),this.options.resizeLimit.x[1]-(this.options.shadowBlur*2)]},modifiers:{x:"width",y:false},onStart:function(){this.resizeOnStart()}.bind(this),onDrag:function(){this.resizeOnDrag()}.bind(this),onComplete:function(){this.resizeOnComplete()}.bind(this)});this.resizable3=this.contentWrapperEl.makeResizable({container:this.options.restrict==true?$(this.options.container):false,handle:this.se,limit:{x:[this.options.resizeLimit.x[0]-(this.options.shadowBlur*2),this.options.resizeLimit.x[1]-(this.options.shadowBlur*2)],y:[this.options.resizeLimit.y[0]-this.headerFooterShadow,this.options.resizeLimit.y[1]-this.headerFooterShadow]},modifiers:{x:"width",y:"height"},onStart:function(){this.resizeOnStart()}.bind(this),onDrag:function(){this.resizeOnDrag()}.bind(this),onComplete:function(){this.resizeOnComplete()}.bind(this)});this.resizable4=this.contentWrapperEl.makeResizable({handle:[this.s,this.sw],limit:{y:[this.options.resizeLimit.y[0]-this.headerFooterShadow,this.options.resizeLimit.y[1]-this.headerFooterShadow]},modifiers:{x:false,y:"height"},onStart:function(){this.resizeOnStart()}.bind(this),onDrag:function(){this.resizeOnDrag()}.bind(this),onComplete:function(){this.resizeOnComplete()}.bind(this)});this.resizable5=this.windowEl.makeResizable({handle:[this.w,this.sw,this.nw],limit:{x:[function(){return this.windowEl.getStyle("left").toInt()+this.windowEl.getStyle("width").toInt()-this.options.resizeLimit.x[1]}.bind(this),function(){return this.windowEl.getStyle("left").toInt()+this.windowEl.getStyle("width").toInt()-this.options.resizeLimit.x[0]}.bind(this)]},modifiers:{x:"left",y:false},onStart:function(){this.resizeOnStart();this.coords=this.contentWrapperEl.getCoordinates();this.x2=this.coords.left.toInt()+this.contentWrapperEl.offsetWidth}.bind(this),onDrag:function(){this.coords=this.contentWrapperEl.getCoordinates();this.contentWrapperEl.setStyle("width",this.x2-this.coords.left.toInt());this.resizeOnDrag()}.bind(this),onComplete:function(){this.resizeOnComplete()}.bind(this)})},resizeOnStart:function(){$("windowUnderlay").show();if(this.iframeEl){if(!Browser.Engine.trident){this.iframeEl.setStyle("visibility","hidden")}else{this.iframeEl.hide()}}},resizeOnDrag:function(){if(Browser.Engine.gecko){this.windowEl.getElements(".panel").each(function(a){a.store("oldOverflow",a.getStyle("overflow"));a.setStyle("overflow","visible")})}this.drawWindow();this.adjustHandles();if(Browser.Engine.gecko){this.windowEl.getElements(".panel").each(function(a){a.setStyle("overflow",a.retrieve("oldOverflow"))})}},resizeOnComplete:function(){$("windowUnderlay").hide();if(this.iframeEl){if(!Browser.Engine.trident){this.iframeEl.setStyle("visibility","visible")}else{this.iframeEl.show();this.iframeEl.setStyle("width","99%");this.iframeEl.setStyle("height",this.contentWrapperEl.offsetHeight);this.iframeEl.setStyle("width","100%");this.iframeEl.setStyle("height",this.contentWrapperEl.offsetHeight)}}if(this.contentWrapperEl.getChildren(".column")!=null){MUI.rWidth(this.contentWrapperEl);this.contentWrapperEl.getChildren(".column").each(function(a){MUI.panelHeight(a)})}this.fireEvent("onResize",this.windowEl)},adjustHandles:function(){var d=this.options.shadowBlur;var j=d*2;var k=this.options.shadowOffset;var e=d-k.y-1;var g=d+k.x-1;var a=d+k.y-1;var c=d-k.x-1;var f=this.windowEl.getCoordinates();var b=f.width-j+2;var h=f.height-j+2;this.n.setStyles({top:e,left:c+10,width:b-20});this.e.setStyles({top:e+10,right:g,height:h-30});this.s.setStyles({bottom:a,left:c+10,width:b-30});this.w.setStyles({top:e+10,left:c,height:h-20});this.ne.setStyles({top:e,right:g});this.se.setStyles({bottom:a,right:g});this.sw.setStyles({bottom:a,left:c});this.nw.setStyles({top:e,left:c})},detachResizable:function(){this.resizable1.detach();this.resizable2.detach();this.resizable3.detach();this.resizable4.detach();this.resizable5.detach();this.windowEl.getElements(".handle").hide()},reattachResizable:function(){this.resizable1.attach();this.resizable2.attach();this.resizable3.attach();this.resizable4.attach();this.resizable5.attach();this.windowEl.getElements(".handle").show()},insertWindowElements:function(){var d=this.options;var a=d.height;var e=d.width;var f=d.id;var b={};if(Browser.Engine.trident4){b.zIndexFixEl=new Element("iframe",{id:f+"_zIndexFix","class":"zIndexFix",scrolling:"no",marginWidth:0,marginHeight:0,src:"",styles:{position:"absolute"}}).inject(this.windowEl)}b.overlayEl=new Element("div",{id:f+"_overlay","class":"mochaOverlay",styles:{position:"absolute",top:0,left:0}}).inject(this.windowEl);b.titleBarEl=new Element("div",{id:f+"_titleBar","class":"mochaTitlebar",styles:{cursor:d.draggable?"move":"default"}}).inject(b.overlayEl,"top");b.titleEl=new Element("h3",{id:f+"_title","class":"mochaTitle"}).inject(b.titleBarEl);if(d.icon!=false){b.titleEl.setStyles({"padding-left":28,background:"url("+d.icon+") 5px 4px no-repeat"})}b.contentBorderEl=new Element("div",{id:f+"_contentBorder","class":"mochaContentBorder"}).inject(b.overlayEl);if(d.toolbar){b.toolbarWrapperEl=new Element("div",{id:f+"_toolbarWrapper","class":"mochaToolbarWrapper",styles:{height:d.toolbarHeight}}).inject(b.contentBorderEl,d.toolbarPosition=="bottom"?"after":"before");if(d.toolbarPosition=="bottom"){b.toolbarWrapperEl.addClass("bottom")}b.toolbarEl=new Element("div",{id:f+"_toolbar","class":"mochaToolbar",styles:{height:d.toolbarHeight}}).inject(b.toolbarWrapperEl)}if(d.toolbar2){b.toolbar2WrapperEl=new Element("div",{id:f+"_toolbar2Wrapper","class":"mochaToolbarWrapper",styles:{height:d.toolbar2Height}}).inject(b.contentBorderEl,d.toolbar2Position=="bottom"?"after":"before");if(d.toolbar2Position=="bottom"){b.toolbar2WrapperEl.addClass("bottom")}b.toolbar2El=new Element("div",{id:f+"_toolbar2","class":"mochaToolbar",styles:{height:d.toolbar2Height}}).inject(b.toolbar2WrapperEl)}b.contentWrapperEl=new Element("div",{id:f+"_contentWrapper","class":"mochaContentWrapper",styles:{width:e+"px",height:a+"px"}}).inject(b.contentBorderEl);if(this.options.shape=="gauge"){b.contentBorderEl.setStyle("borderWidth",0)}b.contentEl=new Element("div",{id:f+"_content","class":"mochaContent"}).inject(b.contentWrapperEl);if(this.options.useCanvas==true&&Browser.Engine.trident!=true){b.canvasEl=new Element("canvas",{id:f+"_canvas","class":"mochaCanvas",width:10,height:10}).inject(this.windowEl)}if(this.options.useCanvas==true&&Browser.Engine.trident){b.canvasEl=new Element("canvas",{id:f+"_canvas","class":"mochaCanvas",width:50000,height:20000,styles:{position:"absolute",top:0,left:0}}).inject(this.windowEl);if(MUI.ieSupport=="excanvas"){G_vmlCanvasManager.initElement(b.canvasEl);b.canvasEl=this.windowEl.getElement(".mochaCanvas")}}b.controlsEl=new Element("div",{id:f+"_controls","class":"mochaControls"}).inject(b.overlayEl,"after");if(d.useCanvasControls==true){b.canvasControlsEl=new Element("canvas",{id:f+"_canvasControls","class":"mochaCanvasControls",width:14,height:14}).inject(this.windowEl);if(Browser.Engine.trident&&MUI.ieSupport=="excanvas"){G_vmlCanvasManager.initElement(b.canvasControlsEl);b.canvasControlsEl=this.windowEl.getElement(".mochaCanvasControls")}}if(d.closable){b.closeButtonEl=new Element("div",{id:f+"_closeButton","class":"mochaCloseButton mochaWindowButton",title:"Close"}).inject(b.controlsEl)}if(d.maximizable){b.maximizeButtonEl=new Element("div",{id:f+"_maximizeButton","class":"mochaMaximizeButton mochaWindowButton",title:"Maximize"}).inject(b.controlsEl)}if(d.minimizable){b.minimizeButtonEl=new Element("div",{id:f+"_minimizeButton","class":"mochaMinimizeButton mochaWindowButton",title:"Minimize"}).inject(b.controlsEl)}if(d.useSpinner==true&&d.shape!="gauge"&&d.type!="notification"){b.spinnerEl=new Element("div",{id:f+"_spinner","class":"mochaSpinner",width:16,height:16}).inject(this.windowEl,"bottom")}if(this.options.shape=="gauge"){b.canvasHeaderEl=new Element("canvas",{id:f+"_canvasHeader","class":"mochaCanvasHeader",width:this.options.width,height:26}).inject(this.windowEl,"bottom");if(Browser.Engine.trident&&MUI.ieSupport=="excanvas"){G_vmlCanvasManager.initElement(b.canvasHeaderEl);b.canvasHeaderEl=this.windowEl.getElement(".mochaCanvasHeader")}}if(Browser.Engine.trident){b.overlayEl.setStyle("zIndex",2)}if(Browser.Platform.mac&&Browser.Engine.gecko){if(/Firefox[\/\s](\d+\.\d+)/.test(navigator.userAgent)){var c=new Number(RegExp.$1);if(c<3){b.overlayEl.setStyle("overflow","auto")}}}if(d.resizable){b.n=new Element("div",{id:f+"_resizeHandle_n","class":"handle",styles:{top:0,left:10,cursor:"n-resize"}}).inject(b.overlayEl,"after");b.ne=new Element("div",{id:f+"_resizeHandle_ne","class":"handle corner",styles:{top:0,right:0,cursor:"ne-resize"}}).inject(b.overlayEl,"after");b.e=new Element("div",{id:f+"_resizeHandle_e","class":"handle",styles:{top:10,right:0,cursor:"e-resize"}}).inject(b.overlayEl,"after");b.se=new Element("div",{id:f+"_resizeHandle_se","class":"handle cornerSE",styles:{bottom:0,right:0,cursor:"se-resize"}}).inject(b.overlayEl,"after");b.s=new Element("div",{id:f+"_resizeHandle_s","class":"handle",styles:{bottom:0,left:10,cursor:"s-resize"}}).inject(b.overlayEl,"after");b.sw=new Element("div",{id:f+"_resizeHandle_sw","class":"handle corner",styles:{bottom:0,left:0,cursor:"sw-resize"}}).inject(b.overlayEl,"after");b.w=new Element("div",{id:f+"_resizeHandle_w","class":"handle",styles:{top:10,left:0,cursor:"w-resize"}}).inject(b.overlayEl,"after");b.nw=new Element("div",{id:f+"_resizeHandle_nw","class":"handle corner",styles:{top:0,left:0,cursor:"nw-resize"}}).inject(b.overlayEl,"after")}$extend(this,b)},setColors:function(){if(this.options.useCanvas==true){var c=/\?(.*?)\)/;if(this.titleBarEl.getStyle("backgroundImage")!="none"){var d=this.titleBarEl.getStyle("backgroundImage");d=d.match(c)[1];d=d.parseQueryString();var a=d.from;var b=d.to.replace(/\"/,"");this.options.headerStartColor=new Color(a);this.options.headerStopColor=new Color(b);this.titleBarEl.addClass("replaced")}else{if(this.titleBarEl.getStyle("background-color")!==""&&this.titleBarEl.getStyle("background-color")!=="transparent"){this.options.headerStartColor=new Color(this.titleBarEl.getStyle("background-color")).mix("#fff",20);this.options.headerStopColor=new Color(this.titleBarEl.getStyle("background-color")).mix("#000",20);this.titleBarEl.addClass("replaced")}}if(this.windowEl.getStyle("background-color")!==""&&this.windowEl.getStyle("background-color")!=="transparent"){this.options.bodyBgColor=new Color(this.windowEl.getStyle("background-color"));this.windowEl.addClass("replaced")}if(this.options.resizable&&this.se.getStyle("background-color")!==""&&this.se.getStyle("background-color")!=="transparent"){this.options.resizableColor=new Color(this.se.getStyle("background-color"));this.se.addClass("replaced")}}if(this.options.useCanvasControls==true){if(this.minimizeButtonEl){if(this.minimizeButtonEl.getStyle("color")!==""&&this.minimizeButtonEl.getStyle("color")!=="transparent"){this.options.minimizeColor=new Color(this.minimizeButtonEl.getStyle("color"))}if(this.minimizeButtonEl.getStyle("background-color")!==""&&this.minimizeButtonEl.getStyle("background-color")!=="transparent"){this.options.minimizeBgColor=new Color(this.minimizeButtonEl.getStyle("background-color"));this.minimizeButtonEl.addClass("replaced")}}if(this.maximizeButtonEl){if(this.maximizeButtonEl.getStyle("color")!==""&&this.maximizeButtonEl.getStyle("color")!=="transparent"){this.options.maximizeColor=new Color(this.maximizeButtonEl.getStyle("color"))}if(this.maximizeButtonEl.getStyle("background-color")!==""&&this.maximizeButtonEl.getStyle("background-color")!=="transparent"){this.options.maximizeBgColor=new Color(this.maximizeButtonEl.getStyle("background-color"));this.maximizeButtonEl.addClass("replaced")}}if(this.closeButtonEl){if(this.closeButtonEl.getStyle("color")!==""&&this.closeButtonEl.getStyle("color")!=="transparent"){this.options.closeColor=new Color(this.closeButtonEl.getStyle("color"))}if(this.closeButtonEl.getStyle("background-color")!==""&&this.closeButtonEl.getStyle("background-color")!=="transparent"){this.options.closeBgColor=new Color(this.closeButtonEl.getStyle("background-color"));this.closeButtonEl.addClass("replaced")}}}},drawWindow:function(b){if(this.drawingWindow==true){return}this.drawingWindow=true;if(this.isCollapsed){this.drawWindowCollapsed(b);return}var g=this.windowEl;var m=this.options;var c=m.shadowBlur;var j=c*2;var l=this.options.shadowOffset;this.overlayEl.setStyles({width:this.contentWrapperEl.offsetWidth});if(this.iframeEl){this.iframeEl.setStyle("height",this.contentWrapperEl.offsetHeight)}var d=this.contentBorderEl.getStyle("border-top").toInt()+this.contentBorderEl.getStyle("border-bottom").toInt();var f=this.toolbarWrapperEl?this.toolbarWrapperEl.getStyle("height").toInt()+this.toolbarWrapperEl.getStyle("border-top").toInt():0;var e=this.toolbar2WrapperEl?this.toolbar2WrapperEl.getStyle("height").toInt()+this.toolbar2WrapperEl.getStyle("border-top").toInt():0;this.headerFooterShadow=m.headerHeight+m.footerHeight+j;var h=this.contentWrapperEl.getStyle("height").toInt()+this.headerFooterShadow+f+e+d;var a=this.contentWrapperEl.getStyle("width").toInt()+j;this.windowEl.setStyles({height:h,width:a});this.overlayEl.setStyles({height:h,top:c-l.y,left:c-l.x});if(this.options.useCanvas==true){if(Browser.Engine.trident){this.canvasEl.height=20000;this.canvasEl.width=50000}this.canvasEl.height=h;this.canvasEl.width=a}if(Browser.Engine.trident4){this.zIndexFixEl.setStyles({width:a,height:h})}this.titleBarEl.setStyles({width:a-j,height:m.headerHeight});if(m.useSpinner==true&&m.shape!="gauge"&&m.type!="notification"){this.spinnerEl.setStyles({left:c-l.x+3,bottom:c+l.y+4})}if(this.options.useCanvas!=false){var k=this.canvasEl.getContext("2d");k.clearRect(0,0,a,h);switch(m.shape){case"box":this.drawBox(k,a,h,c,l,b);break;case"gauge":this.drawGauge(k,a,h,c,l,b);break}if(m.resizable){MUI.triangle(k,a-(c+l.x+17),h-(c+l.y+18),11,11,m.resizableColor,1)}if(Browser.Engine.trident){MUI.triangle(k,0,0,10,10,m.resizableColor,0)}}if(m.type!="notification"&&m.useCanvasControls==true){this.drawControls(a,h,b)}if(MUI.Desktop&&this.contentWrapperEl.getChildren(".column").length!=0){MUI.rWidth(this.contentWrapperEl);this.contentWrapperEl.getChildren(".column").each(function(n){MUI.panelHeight(n)})}this.drawingWindow=false;return this},drawWindowCollapsed:function(b){var e=this.windowEl;var k=this.options;var c=k.shadowBlur;var f=c*2;var j=k.shadowOffset;var d=k.headerHeight+f+2;var g=d;var a=this.contentWrapperEl.getStyle("width").toInt()+f;this.windowEl.setStyle("height",g);this.overlayEl.setStyles({height:g,top:c-j.y,left:c-j.x});if(Browser.Engine.trident4){this.zIndexFixEl.setStyles({width:a,height:g})}this.windowEl.setStyle("width",a);this.overlayEl.setStyle("width",a);this.titleBarEl.setStyles({width:a-f,height:k.headerHeight});if(this.options.useCanvas!=false){this.canvasEl.height=g;this.canvasEl.width=a;var h=this.canvasEl.getContext("2d");h.clearRect(0,0,a,g);this.drawBoxCollapsed(h,a,g,c,j,b);if(k.useCanvasControls==true){this.drawControls(a,g,b)}if(Browser.Engine.trident){MUI.triangle(h,0,0,10,10,k.resizableColor,0)}}this.drawingWindow=false;return this},drawControls:function(g,e,h){var f=this.options;var d=f.shadowBlur;var c=f.shadowOffset;var b=f.controlsOffset;this.controlsEl.setStyles({right:d+c.x+b.right,top:d-c.y+b.top});this.canvasControlsEl.setStyles({right:d+c.x+b.right,top:d-c.y+b.top});this.closebuttonX=f.closable?this.mochaControlsWidth-7:this.mochaControlsWidth+12;this.maximizebuttonX=this.closebuttonX-(f.maximizable?19:0);this.minimizebuttonX=this.maximizebuttonX-(f.minimizable?19:0);var a=this.canvasControlsEl.getContext("2d");a.clearRect(0,0,100,100);if(this.options.closable){this.closebutton(a,this.closebuttonX,7,f.closeBgColor,1,f.closeColor,1)}if(this.options.maximizable){this.maximizebutton(a,this.maximizebuttonX,7,f.maximizeBgColor,1,f.maximizeColor,1)}if(this.options.minimizable){this.minimizebutton(a,this.minimizebuttonX,7,f.minimizeBgColor,1,f.minimizeColor,1)}if(Browser.Engine.trident){MUI.circle(a,0,0,3,this.options.resizableColor,0)}},drawBox:function(h,a,g,c,j,b){var k=this.options;var f=c*2;var d=this.options.cornerRadius;if(b!=false){for(var e=0;e<=c;e++){MUI.roundedRect(h,j.x+e,j.y+e,a-(e*2)-j.x,g-(e*2)-j.y,d+(c-e),[0,0,0],e==c?0.29:0.065+(e*0.01))}}this.bodyRoundedRect(h,c-j.x,c-j.y,a-f,g-f,d,k.bodyBgColor);if(this.options.type!="notification"){this.topRoundedRect(h,c-j.x,c-j.y,a-f,k.headerHeight,d,k.headerStartColor,k.headerStopColor)}},drawBoxCollapsed:function(h,a,g,c,j,b){var k=this.options;var f=c*2;var d=k.cornerRadius;if(b!=false){for(var e=0;e<=c;e++){MUI.roundedRect(h,j.x+e,j.y+e,a-(e*2)-j.x,g-(e*2)-j.y,d+(c-e),[0,0,0],e==c?0.3:0.06+(e*0.01))}}this.topRoundedRect2(h,c-j.x,c-j.y,a-f,k.headerHeight+2,d,k.headerStartColor,k.headerStopColor)},drawGauge:function(g,a,f,c,h,b){var j=this.options;var d=(a*0.5)-(c)+16;if(b!=false){for(var e=0;e<=c;e++){MUI.circle(g,a*0.5+h.x,(f+j.headerHeight)*0.5+h.x,(a*0.5)-(e*2)-h.x,[0,0,0],e==c?0.75:0.075+(e*0.04))}}MUI.circle(g,a*0.5-h.x,(f+j.headerHeight)*0.5-h.y,(a*0.5)-c,j.bodyBgColor,1);this.canvasHeaderEl.setStyles({top:c-h.y,left:c-h.x});var g=this.canvasHeaderEl.getContext("2d");g.clearRect(0,0,a,100);g.beginPath();g.lineWidth=24;g.lineCap="round";g.moveTo(13,13);g.lineTo(a-(c*2)-13,13);g.strokeStyle="rgba(0, 0, 0, .65)";g.stroke()},bodyRoundedRect:function(d,c,g,f,b,a,e){d.fillStyle="rgba("+e.join(",")+", 1)";d.beginPath();d.moveTo(c,g+a);d.lineTo(c,g+b-a);d.quadraticCurveTo(c,g+b,c+a,g+b);d.lineTo(c+f-a,g+b);d.quadraticCurveTo(c+f,g+b,c+f,g+b-a);d.lineTo(c+f,g+a);d.quadraticCurveTo(c+f,g,c+f-a,g);d.lineTo(c+a,g);d.quadraticCurveTo(c,g,c,g+a);d.fill()},topRoundedRect:function(j,g,f,a,h,e,c,d){var b=j.createLinearGradient(0,0,0,h);b.addColorStop(0,"rgb("+c.join(",")+")");b.addColorStop(1,"rgb("+d.join(",")+")");j.fillStyle=b;j.beginPath();j.moveTo(g,f);j.lineTo(g,f+h);j.lineTo(g+a,f+h);j.lineTo(g+a,f+e);j.quadraticCurveTo(g+a,f,g+a-e,f);j.lineTo(g+e,f);j.quadraticCurveTo(g,f,g,f+e);j.fill()},topRoundedRect2:function(j,g,f,a,h,e,c,d){if(navigator.userAgent.toLowerCase().indexOf("chrome")>-1){j.fillStyle="rgba("+d.join(",")+", 1)"}else{var b=j.createLinearGradient(0,this.options.shadowBlur-1,0,h+this.options.shadowBlur+3);b.addColorStop(0,"rgb("+c.join(",")+")");b.addColorStop(1,"rgb("+d.join(",")+")");j.fillStyle=b}j.beginPath();j.moveTo(g,f+e);j.lineTo(g,f+h-e);j.quadraticCurveTo(g,f+h,g+e,f+h);j.lineTo(g+a-e,f+h);j.quadraticCurveTo(g+a,f+h,g+a,f+h-e);j.lineTo(g+a,f+e);j.quadraticCurveTo(g+a,f,g+a-e,f);j.lineTo(g+e,f);j.quadraticCurveTo(g,f,g,f+e);j.fill()},maximizebutton:function(e,c,h,b,g,f,d){e.beginPath();e.arc(c,h,7,0,Math.PI*2,true);e.fillStyle="rgba("+b.join(",")+","+g+")";e.fill();e.strokeStyle="rgba("+f.join(",")+","+d+")";e.lineWidth=2;e.beginPath();e.moveTo(c,h-3.5);e.lineTo(c,h+3.5);e.moveTo(c-3.5,h);e.lineTo(c+3.5,h);e.stroke()},closebutton:function(e,c,h,b,g,f,d){e.beginPath();e.arc(c,h,7,0,Math.PI*2,true);e.fillStyle="rgba("+b.join(",")+","+g+")";e.fill();e.strokeStyle="rgba("+f.join(",")+","+d+")";e.lineWidth=2;e.beginPath();e.moveTo(c-3,h-3);e.lineTo(c+3,h+3);e.moveTo(c+3,h-3);e.lineTo(c-3,h+3);e.stroke()},minimizebutton:function(e,c,h,b,g,f,d){e.beginPath();e.arc(c,h,7,0,Math.PI*2,true);e.fillStyle="rgba("+b.join(",")+","+g+")";e.fill();e.strokeStyle="rgba("+f.join(",")+","+d+")";e.lineWidth=2;e.beginPath();e.moveTo(c-3.5,h);e.lineTo(c+3.5,h);e.stroke()},setMochaControlsWidth:function(){this.mochaControlsWidth=0;var a=this.options;if(a.minimizable){this.mochaControlsWidth+=(this.minimizeButtonEl.getStyle("margin-left").toInt()+this.minimizeButtonEl.getStyle("width").toInt())}if(a.maximizable){this.mochaControlsWidth+=(this.maximizeButtonEl.getStyle("margin-left").toInt()+this.maximizeButtonEl.getStyle("width").toInt())}if(a.closable){this.mochaControlsWidth+=(this.closeButtonEl.getStyle("margin-left").toInt()+this.closeButtonEl.getStyle("width").toInt())}this.controlsEl.setStyle("width",this.mochaControlsWidth);if(a.useCanvasControls==true){this.canvasControlsEl.setProperty("width",this.mochaControlsWidth)}},hideSpinner:function(){if(this.spinnerEl){this.spinnerEl.hide()}return this},showSpinner:function(){if(this.spinnerEl){this.spinnerEl.show()}return this},close:function(){if(!this.isClosing){MUI.closeWindow(this.windowEl)}return this},minimize:function(){MUI.Dock.minimizeWindow(this.windowEl);return this},maximize:function(){if(this.isMinimized){MUI.Dock.restoreMinimized(this.windowEl)}MUI.Desktop.maximizeWindow(this.windowEl);return this},restore:function(){if(this.isMinimized){MUI.Dock.restoreMinimized(this.windowEl)}else{if(this.isMaximized){MUI.Desktop.restoreWindow(this.windowEl)}}return this},resize:function(a){MUI.resizeWindow(this.windowEl,a);return this},center:function(){MUI.centerWindow(this.windowEl);return this},hide:function(){this.windowEl.setStyle("display","none");return this},show:function(){this.windowEl.setStyle("display","block");return this}});MUI.extend({closeWindow:function(c){var a=c.retrieve("instance");if(c!=$(c)||a.isClosing){return}a.isClosing=true;a.fireEvent("onClose",c);if(a.options.storeOnClose){this.storeOnClose(a,c);return}if(a.check){a.check.destroy()}if((a.options.type=="modal"||a.options.type=="modal2")&&Browser.Engine.trident4){$("modalFix").hide()}if(MUI.options.advancedEffects==false){if(a.options.type=="modal"||a.options.type=="modal2"){$("modalOverlay").setStyle("opacity",0)}MUI.closingJobs(c);return true}else{if(Browser.Engine.trident){a.drawWindow(false)}if(a.options.type=="modal"||a.options.type=="modal2"){MUI.Modal.modalOverlayCloseMorph.start({opacity:0})}var b=new Fx.Morph(c,{duration:120,onComplete:function(){MUI.closingJobs(c);return true}.bind(this)});b.start({opacity:0.4})}},closingJobs:function(e){var d=MUI.Windows.instances;var a=d.get(e.id);e.setStyle("visibility","hidden");if(Browser.Engine.trident){e.dispose()}else{e.destroy()}a.fireEvent("onCloseComplete");if(a.options.type!="notification"){var c=this.getWindowWithHighestZindex();this.focusWindow(c)}d.erase(a.options.id);if(this.loadingWorkspace==true){this.windowUnload()}if(MUI.Dock&&$(MUI.options.dock)&&a.options.type=="window"){var b=$(a.options.id+"_dockTab");if(b!=null){MUI.Dock.dockSortables.removeItems(b).destroy()}MUI.Desktop.setDesktopSize()}},storeOnClose:function(a,d){if(a.check){a.check.hide()}d.setStyles({zIndex:-1});d.addClass("windowClosed");d.removeClass("mocha");if(MUI.Dock&&$(MUI.options.dock)&&a.options.type=="window"){var c=$(a.options.id+"_dockTab");if(c!=null){c.hide()}MUI.Desktop.setDesktopSize()}a.fireEvent("onCloseComplete");if(a.options.type!="notification"){var b=this.getWindowWithHighestZindex();this.focusWindow(b)}a.isClosing=false},closeAll:function(){$$(".mocha").each(function(a){this.closeWindow(a)}.bind(this))},collapseToggle:function(c){var a=c.retrieve("instance");var b=c.getElements(".handle");if(a.isMaximized==true){return}if(a.isCollapsed==false){a.isCollapsed=true;b.hide();if(a.iframeEl){a.iframeEl.setStyle("visibility","hidden")}a.contentBorderEl.setStyles({visibility:"hidden",position:"absolute",top:-10000,left:-10000});if(a.toolbarWrapperEl){a.toolbarWrapperEl.setStyles({visibility:"hidden",position:"absolute",top:-10000,left:-10000})}a.drawWindowCollapsed()}else{a.isCollapsed=false;a.drawWindow();a.contentBorderEl.setStyles({visibility:"visible",position:null,top:null,left:null});if(a.toolbarWrapperEl){a.toolbarWrapperEl.setStyles({visibility:"visible",position:null,top:null,left:null})}if(a.iframeEl){a.iframeEl.setStyle("visibility","visible")}b.show()}},toggleWindowVisibility:function(){MUI.Windows.instances.each(function(a){if(a.options.type=="modal"||a.options.type=="modal2"||a.isMinimized==true){return}var b=$(a.options.id);if(b.getStyle("visibility")=="visible"){if(a.iframe){a.iframeEl.setStyle("visibility","hidden")}if(a.toolbarEl){a.toolbarWrapperEl.setStyle("visibility","hidden")}a.contentBorderEl.setStyle("visibility","hidden");b.setStyle("visibility","hidden");MUI.Windows.windowsVisible=false}else{b.setStyle("visibility","visible");a.contentBorderEl.setStyle("visibility","visible");if(a.iframe){a.iframeEl.setStyle("visibility","visible")}if(a.toolbarEl){a.toolbarWrapperEl.setStyle("visibility","visible")}MUI.Windows.windowsVisible=true}}.bind(this))},focusWindow:function(e,c){MUI.Windows.focusingWindow=true;var b=function(){MUI.Windows.focusingWindow=false};b.delay(170,this);if($$(".mocha").length==0){return}if(e!=$(e)||e.hasClass("isFocused")){return}var d=MUI.Windows.instances;var a=d.get(e.id);if(a.options.type=="notification"){e.setStyle("zIndex",11001);return}MUI.Windows.indexLevel+=2;e.setStyle("zIndex",MUI.Windows.indexLevel);$("windowUnderlay").setStyle("zIndex",MUI.Windows.indexLevel-1).inject($(e),"after");d.each(function(f){if(f.windowEl.hasClass("isFocused")){f.fireEvent("onBlur",f.windowEl)}f.windowEl.removeClass("isFocused")});if(MUI.Dock&&$(MUI.options.dock)&&a.options.type=="window"){MUI.Dock.makeActiveTab()}e.addClass("isFocused");if(c!=false){a.fireEvent("onFocus",e)}},getWindowWithHighestZindex:function(){this.highestZindex=0;$$(".mocha").each(function(a){this.zIndex=a.getStyle("zIndex");if(this.zIndex>=this.highestZindex){this.highestZindex=this.zIndex}}.bind(this));$$(".mocha").each(function(a){if(a.getStyle("zIndex")==this.highestZindex){this.windowWithHighestZindex=a}}.bind(this));return this.windowWithHighestZindex},blurAll:function(){if(MUI.Windows.focusingWindow==false){$$(".mocha").each(function(b){var a=b.retrieve("instance");if(a.options.type!="modal"&&a.options.type!="modal2"){b.removeClass("isFocused")}});$$(".dockTab").removeClass("activeDockTab")}},centerWindow:function(f){if(!f){MUI.Windows.instances.each(function(g){if(g.windowEl.hasClass("isFocused")){f=g.windowEl}})}var a=f.retrieve("instance");var b=a.options;var d=b.container.getCoordinates();var c=window.getScroll().y+(window.getSize().y*0.5)-(f.offsetHeight*0.5);if(c<-a.options.shadowBlur){c=-a.options.shadowBlur}var e=(d.width*0.5)-(f.offsetWidth*0.5);if(e<-a.options.shadowBlur){e=-a.options.shadowBlur}if(MUI.options.advancedEffects==true){a.morph.start({top:c,left:e})}else{f.setStyles({top:c,left:e})}},resizeWindow:function(f,j){var g=f.retrieve("instance");$extend({width:null,height:null,top:null,left:null,centered:true},j);var c=f.getStyle("width").toInt();var h=f.getStyle("height").toInt();var d=f.getStyle("top").toInt();var b=f.getStyle("left").toInt();if(j.centered){var e=j.top||d-((j.height-h)*0.5);var a=j.left||b-((j.width-c)*0.5)}else{var e=j.top||d;var a=j.left||b}if(MUI.options.advancedEffects==false){f.setStyles({top:e,left:a});g.contentWrapperEl.setStyles({height:j.height,width:j.width});g.drawWindow();if(g.iframeEl){if(!Browser.Engine.trident){g.iframeEl.setStyle("visibility","visible")}else{g.iframeEl.show()}}}else{f.retrieve("resizeMorph").start({"0":{height:j.height,width:j.width},"1":{top:e,left:a}})}return g},dynamicResize:function(d){var a=d.retrieve("instance");var c=a.contentWrapperEl;var b=a.contentEl;c.setStyles({height:b.offsetHeight,width:b.offsetWidth});a.drawWindow()}});document.addEvent("keydown",function(a){if(a.key=="q"&&a.control&&a.alt){MUI.toggleWindowVisibility()}});MUI.files[MUI.path.source+"Window/Modal.js"]="loaded";MUI.Modal=new Class({Extends:MUI.Window,options:{type:"modal"},initialize:function(a){if(!$("modalOverlay")){this.modalInitialize();window.addEvent("resize",function(){this.setModalSize()}.bind(this))}this.parent(a)},modalInitialize:function(){var a=new Element("div",{id:"modalOverlay",styles:{height:document.getCoordinates().height,opacity:0.6}}).inject(document.body);a.setStyles({position:Browser.Engine.trident4?"absolute":"fixed"});a.addEvent("click",function(d){var c=MUI.Windows.instances.get(MUI.currentModal.id);if(c.options.modalOverlayClose==true){MUI.closeWindow(MUI.currentModal)}});if(Browser.Engine.trident4){var b=new Element("iframe",{id:"modalFix",scrolling:"no",marginWidth:0,marginHeight:0,src:"",styles:{height:document.getCoordinates().height}}).inject(document.body)}MUI.Modal.modalOverlayOpenMorph=new Fx.Morph($("modalOverlay"),{duration:150});MUI.Modal.modalOverlayCloseMorph=new Fx.Morph($("modalOverlay"),{duration:150,onComplete:function(){$("modalOverlay").hide();if(Browser.Engine.trident4){$("modalFix").hide()}}.bind(this)})},setModalSize:function(){$("modalOverlay").setStyle("height",document.getCoordinates().height);if(Browser.Engine.trident4){$("modalFix").setStyle("height",document.getCoordinates().height)}}});MUI.files[MUI.path.source+"Window/Windows-from-html.js"]="loaded";MUI.extend({NewWindowsFromHTML:function(){$$(".mocha").each(function(b){if(Browser.Engine.presto||Browser.Engine.trident5){b.hide()}var d=b.getElement("h3.mochaTitle");if(Browser.Engine.presto){b.show()}var c=b.getStyles("height","width");var a={id:b.getProperty("id"),height:c.height.toInt(),width:c.width.toInt(),x:b.getStyle("left").toInt(),y:b.getStyle("top").toInt()};if(d){a.title=d.innerHTML;d.destroy()}a.content=b.innerHTML;b.destroy();new MUI.Window(a,true)}.bind(this))}});MUI.files[MUI.path.source+"Window/Windows-from-json.js"]="loaded";MUI.extend({newWindowsFromJSON:function(newWindows){newWindows.each(function(options){var temp=new Hash(options);temp.each(function(value,key,hash){if($type(value)!="string"){return}if(value.substring(0,8)=="function"){eval("options."+key+" = "+value)}});new MUI.Window(options)})}});MUI.files[MUI.path.source+"Window/Arrange-cascade.js"]="loaded";MUI.extend({arrangeCascade:function(){var g=30;var a=20;var k=50;var c=40;var j=document.getCoordinates();var d=0;MUI.Windows.instances.each(function(l){if(!l.isMinimized&&l.options.draggable){d++}});if((k*(d+1))>=(j.height-g)){var e=(j.height-g)/(d+1)}else{var e=k}if((c*(d+1))>=(j.width-a-20)){var b=(j.width-a-20)/(d+1)}else{var b=c}var h=a;var f=g;$$(".mocha").each(function(n){var l=n.retrieve("instance");if(!l.isMinimized&&!l.isMaximized&&l.options.draggable){id=n.id;MUI.focusWindow(n);h+=b;f+=e;if(MUI.options.advancedEffects==false){n.setStyles({top:f,left:h})}else{var m=new Fx.Morph(n,{duration:550});m.start({top:f,left:h})}}}.bind(this))}});MUI.files[MUI.path.source+"Window/Arrange-tile.js"]="loaded";MUI.extend({arrangeTile:function(){var g=30;var b=20;var j=10;var f=80;var a=MUI.Windows.instances;var l=0;a.each(function(o){if(!o.isMinimized&&!o.isMaximized){l++}});var h=3;var n=Math.ceil(l/h);var k=document.getCoordinates();var e=((k.width-b)/h);var d=((k.height-g)/n);var m=0;var c=0;a.each(function(x){if(!x.isMinimized&&!x.isMaximized&&x.options.draggable){var t=x.contentWrapperEl;var o=t.getCoordinates();var w=x.windowEl.getCoordinates();var s=o.top-w.top;var v=w.height-o.height-s;var r=o.left-w.left;var y=w.width-o.width-r;var p=(j+(c*e));var u=(f+(m*d));x.drawWindow();MUI.focusWindow(x.windowEl);if(MUI.options.advancedEffects==false){x.windowEl.setStyles({top:u,left:p})}else{var q=new Fx.Morph(x.windowEl,{duration:550});q.start({top:u,left:p})}if(++c===h){m++;c=0}}}.bind(this))}});MUI.files[MUI.path.source+"Components/Tabs.js"]="loaded";MUI.extend({initializeTabs:function(a){$(a).setStyle("list-style","none");$(a).getElements("li").addEvent("click",function(b){MUI.selected(this,a)})},selected:function(b,a){$(a).getChildren().each(function(c){c.removeClass("selected")});b.addClass("selected")}});MUI.files[MUI.path.source+"Layout/Layout.js"]="loaded";MUI.extend({Columns:{instances:new Hash(),columnIDCount:0},Panels:{instances:new Hash(),panelIDCount:0}});MUI.Desktop={options:{desktop:"desktop",desktopHeader:"desktopHeader",desktopFooter:"desktopFooter",desktopNavBar:"desktopNavbar",pageWrapper:"pageWrapper",page:"page",desktopFooter:"desktopFooterWrapper"},initialize:function(){this.desktop=$(this.options.desktop);this.desktopHeader=$(this.options.desktopHeader);this.desktopNavBar=$(this.options.desktopNavBar);this.pageWrapper=$(this.options.pageWrapper);this.page=$(this.options.page);this.desktopFooter=$(this.options.desktopFooter);if(this.desktop){($$("body")).setStyles({overflow:"hidden",height:"100%",margin:0});($$("html")).setStyles({overflow:"hidden",height:"100%"})}if(!MUI.Dock){this.setDesktopSize()}this.menuInitialize();window.addEvent("resize",function(a){this.onBrowserResize()}.bind(this));if(MUI.myChain){MUI.myChain.callChain()}},menuInitialize:function(){if(Browser.Engine.trident4&&this.desktopNavBar){this.desktopNavBar.getElements("li").each(function(a){a.addEvent("mouseenter",function(){this.addClass("ieHover")});a.addEvent("mouseleave",function(){this.removeClass("ieHover")})})}},onBrowserResize:function(){this.setDesktopSize();setTimeout(function(){MUI.Windows.instances.each(function(a){if(a.isMaximized){if(a.iframeEl){a.iframeEl.setStyle("visibility","hidden")}var d=document.getCoordinates();var b=a.contentBorderEl.getStyle("border-top").toInt()+a.contentBorderEl.getStyle("border-bottom").toInt();var c=a.toolbarWrapperEl?a.toolbarWrapperEl.getStyle("height").toInt()+a.toolbarWrapperEl.getStyle("border-top").toInt():0;a.contentWrapperEl.setStyles({height:d.height-a.options.headerHeight-a.options.footerHeight-b-c,width:d.width});a.drawWindow();if(a.iframeEl){a.iframeEl.setStyles({height:a.contentWrapperEl.getStyle("height")});a.iframeEl.setStyle("visibility","visible")}}}.bind(this))}.bind(this),100)},setDesktopSize:function(){var d=window.getCoordinates();var b=$(MUI.options.dockWrapper);if(this.desktop){this.desktop.setStyle("height",d.height)}if(this.pageWrapper){var a=MUI.dockVisible?b.offsetHeight:0;var c=d.height;c-=this.pageWrapper.getStyle("border-top").toInt();c-=this.pageWrapper.getStyle("border-bottom").toInt();if(this.desktopHeader){c-=this.desktopHeader.offsetHeight}if(this.desktopFooter){c-=this.desktopFooter.offsetHeight}c-=a;if(c<0){c=0}this.pageWrapper.setStyle("height",c)}if(MUI.Columns.instances.getKeys().length>0){MUI.Desktop.resizePanels()}},resizePanels:function(){MUI.panelHeight();MUI.rWidth()},maximizeWindow:function(f){var g=MUI.Windows.instances.get(f.id);var j=g.options;var c=g.windowDrag;if(f!=$(f)||g.isMaximized){return}if(g.isCollapsed){MUI.collapseToggle(f)}g.isMaximized=true;if(g.options.restrict){c.detach();if(j.resizable){g.detachResizable()}g.titleBarEl.setStyle("cursor","default")}if(j.container!=this.desktop){this.desktop.grab(f);if(this.options.restrict){c.container=this.desktop}}g.oldTop=f.getStyle("top");g.oldLeft=f.getStyle("left");var d=g.contentWrapperEl;d.oldWidth=d.getStyle("width");d.oldHeight=d.getStyle("height");if(g.iframeEl){if(!Browser.Engine.trident){g.iframeEl.setStyle("visibility","hidden")}else{g.iframeEl.hide()}}var b=document.getCoordinates();var j=g.options;var e=j.shadowBlur;var h=j.shadowOffset;var a=b.height-j.headerHeight-j.footerHeight;a-=g.contentBorderEl.getStyle("border-top").toInt();a-=g.contentBorderEl.getStyle("border-bottom").toInt();a-=(g.toolbarWrapperEl?g.toolbarWrapperEl.getStyle("height").toInt()+g.toolbarWrapperEl.getStyle("border-top").toInt():0);MUI.resizeWindow(f,{width:b.width,height:a,top:h.y-e,left:h.x-e});g.fireEvent("onMaximize",f);if(g.maximizeButtonEl){g.maximizeButtonEl.setProperty("title","Restore")}MUI.focusWindow(f)},restoreWindow:function(d){var a=d.retrieve("instance");if(d!=$(d)||!a.isMaximized){return}var b=a.options;a.isMaximized=false;if(b.restrict){a.windowDrag.attach();if(b.resizable){a.reattachResizable()}a.titleBarEl.setStyle("cursor","move")}if(a.iframeEl){if(!Browser.Engine.trident){a.iframeEl.setStyle("visibility","hidden")}else{a.iframeEl.hide()}}var c=a.contentWrapperEl;MUI.resizeWindow(d,{width:c.oldWidth,height:c.oldHeight,top:a.oldTop,left:a.oldLeft});a.fireEvent("onRestore",d);if(a.maximizeButtonEl){a.maximizeButtonEl.setProperty("title","Maximize")}}};MUI.Column=new Class({Implements:[Events,Options],options:{id:null,container:null,placement:null,width:null,resizeLimit:[],sortable:true,onResize:$empty,onCollapse:$empty,onExpand:$empty},initialize:function(b){this.setOptions(b);$extend(this,{timestamp:$time(),isCollapsed:false,oldWidth:0});if(this.options.id==null){this.options.id="column"+(++MUI.Columns.columnIDCount)}var b=this.options;var g=MUI.Columns.instances;var d=g.get(b.id);if(b.container==null){b.container=MUI.Desktop.pageWrapper}else{$(b.container).setStyle("overflow","hidden")}if(typeof this.options.container=="string"){this.options.container=$(this.options.container)}if(d){var a=d}if(this.columnEl){return}else{g.set(b.id,this)}if($(b.container).getElement(".pad")!=null){$(b.container).getElement(".pad").hide()}if($(b.container).getElement(".mochaContent")!=null){$(b.container).getElement(".mochaContent").hide()}this.columnEl=new Element("div",{id:this.options.id,"class":"column expanded",styles:{width:b.placement=="main"?null:b.width}}).inject($(b.container));this.columnEl.store("instance",this);var c=this.columnEl.getParent();var f=c.getStyle("height").toInt();this.columnEl.setStyle("height",f);if(this.options.sortable){if(!this.options.container.retrieve("sortables")){var e=new Sortables(this.columnEl,{opacity:1,handle:".panel-header",constrain:false,revert:false,onSort:function(){$$(".column").each(function(h){h.getChildren(".panelWrapper").each(function(j){j.getElement(".panel").removeClass("bottomPanel")});if(h.getChildren(".panelWrapper").getLast()){h.getChildren(".panelWrapper").getLast().getElement(".panel").addClass("bottomPanel")}MUI.panelHeight()}.bind(this))}.bind(this)});this.options.container.store("sortables",e)}else{this.options.container.retrieve("sortables").addLists(this.columnEl)}}if(b.placement=="main"){this.columnEl.addClass("rWidth")}switch(this.options.placement){case"left":this.handleEl=new Element("div",{id:this.options.id+"_handle","class":"columnHandle"}).inject(this.columnEl,"after");this.handleIconEl=new Element("div",{id:b.id+"_handle_icon","class":"handleIcon"}).inject(this.handleEl);addResizeRight(this.columnEl,b.resizeLimit[0],b.resizeLimit[1]);break;case"right":this.handleEl=new Element("div",{id:this.options.id+"_handle","class":"columnHandle"}).inject(this.columnEl,"before");this.handleIconEl=new Element("div",{id:b.id+"_handle_icon","class":"handleIcon"}).inject(this.handleEl);addResizeLeft(this.columnEl,b.resizeLimit[0],b.resizeLimit[1]);break}if(this.handleEl!=null){this.handleEl.addEvent("dblclick",function(){this.columnToggle()}.bind(this))}MUI.rWidth()},columnToggle:function(){var a=this.columnEl;if(this.isCollapsed==false){this.oldWidth=a.getStyle("width").toInt();this.resize.detach();this.handleEl.removeEvents("dblclick");this.handleEl.addEvent("click",function(){this.columnToggle()}.bind(this));this.handleEl.setStyle("cursor","pointer").addClass("detached");a.setStyle("width",0);this.isCollapsed=true;a.addClass("collapsed");a.removeClass("expanded");MUI.rWidth();this.fireEvent("onCollapse")}else{a.setStyle("width",this.oldWidth);this.isCollapsed=false;a.addClass("expanded");a.removeClass("collapsed");this.handleEl.removeEvents("click");this.handleEl.addEvent("dblclick",function(){this.columnToggle()}.bind(this));this.resize.attach();this.handleEl.setStyle("cursor",Browser.Engine.webkit?"col-resize":"e-resize").addClass("attached");MUI.rWidth();this.fireEvent("onExpand")}}});MUI.Column.implement(new Options,new Events);MUI.Panel=new Class({Implements:[Events,Options],options:{id:null,title:"New Panel",column:null,require:{css:[],images:[],js:[],onload:null},loadMethod:null,contentURL:null,method:"get",data:null,evalScripts:true,evalResponse:false,content:"Panel content",tabsURL:null,tabsData:null,tabsOnload:$empty,header:true,headerToolbox:false,headerToolboxURL:"pages/lipsum.html",headerToolboxOnload:$empty,height:125,addClass:"",scrollbars:true,padding:{top:8,right:8,bottom:8,left:8},collapsible:true,onBeforeBuild:$empty,onContentLoaded:$empty,onResize:$empty,onCollapse:$empty,onExpand:$empty},initialize:function(b){this.setOptions(b);$extend(this,{timestamp:$time(),isCollapsed:false,oldHeight:0,partner:null});if(this.options.id==null){this.options.id="panel"+(++MUI.Panels.panelIDCount)}var f=MUI.Panels.instances;var c=f.get(this.options.id);var b=this.options;if(c){var a=c}if(this.panelEl){return}else{f.set(this.options.id,this)}this.fireEvent("onBeforeBuild");if(b.loadMethod=="iframe"){b.padding={top:0,right:0,bottom:0,left:0}}this.showHandle=true;if($(b.column).getChildren().length==0){this.showHandle=false}this.panelWrapperEl=new Element("div",{id:this.options.id+"_wrapper","class":"panelWrapper expanded"}).inject($(b.column));this.panelEl=new Element("div",{id:this.options.id,"class":"panel expanded",styles:{height:b.height}}).inject(this.panelWrapperEl);this.panelEl.store("instance",this);this.panelEl.addClass(b.addClass);this.contentEl=new Element("div",{id:b.id+"_pad","class":"pad"}).inject(this.panelEl);this.contentWrapperEl=this.panelEl;this.contentEl.setStyles({"padding-top":b.padding.top,"padding-bottom":b.padding.bottom,"padding-left":b.padding.left,"padding-right":b.padding.right});this.panelHeaderEl=new Element("div",{id:this.options.id+"_header","class":"panel-header",styles:{display:b.header?"block":"none"}}).inject(this.panelEl,"before");var d=MUI.Columns.instances;var e=d.get(this.options.column);if(e.options.sortable){this.panelHeaderEl.setStyle("cursor","move");e.options.container.retrieve("sortables").addItems(this.panelWrapperEl)}if(this.options.collapsible){this.collapseToggleInit()}if(this.options.headerToolbox){this.panelHeaderToolboxEl=new Element("div",{id:b.id+"_headerToolbox","class":"panel-header-toolbox"}).inject(this.panelHeaderEl)}this.panelHeaderContentEl=new Element("div",{id:b.id+"_headerContent","class":"panel-headerContent"}).inject(this.panelHeaderEl);this.titleEl=new Element("h2",{id:b.id+"_title"}).inject(this.panelHeaderContentEl);this.handleEl=new Element("div",{id:b.id+"_handle","class":"horizontalHandle",styles:{display:this.showHandle==true?"block":"none"}}).inject(this.panelEl,"after");this.handleIconEl=new Element("div",{id:b.id+"_handle_icon","class":"handleIcon"}).inject(this.handleEl);addResizeBottom(b.id);if(b.require.css.length||b.require.images.length){new MUI.Require({css:b.require.css,images:b.require.images,onload:function(){this.newPanel()}.bind(this)})}else{this.newPanel()}},newPanel:function(){options=this.options;if(this.options.headerToolbox){MUI.updateContent({element:this.panelEl,childElement:this.panelHeaderToolboxEl,loadMethod:"xhr",url:options.headerToolboxURL,onContentLoaded:options.headerToolboxOnload})}if(options.tabsURL==null){this.titleEl.set("html",options.title)}else{this.panelHeaderContentEl.addClass("tabs");MUI.updateContent({element:this.panelEl,childElement:this.panelHeaderContentEl,loadMethod:"xhr",url:options.tabsURL,data:options.tabsData,onContentLoaded:options.tabsOnload})}MUI.updateContent({element:this.panelEl,content:options.content,method:options.method,data:options.data,url:options.contentURL,onContentLoaded:null,require:{js:options.require.js,onload:options.require.onload}});$(options.column).getChildren(".panelWrapper").each(function(a){a.getElement(".panel").removeClass("bottomPanel")});$(options.column).getChildren(".panelWrapper").getLast().getElement(".panel").addClass("bottomPanel");MUI.panelHeight(options.column,this.panelEl,"new")},collapseToggleInit:function(a){var a=this.options;this.panelHeaderCollapseBoxEl=new Element("div",{id:a.id+"_headerCollapseBox","class":"toolbox"}).inject(this.panelHeaderEl);if(a.headerToolbox){this.panelHeaderCollapseBoxEl.addClass("divider")}this.collapseToggleEl=new Element("div",{id:a.id+"_collapseToggle","class":"panel-collapse icon16",styles:{width:16,height:16},title:"Collapse Panel"}).inject(this.panelHeaderCollapseBoxEl);this.collapseToggleEl.addEvent("click",function(f){var b=this.panelEl;var c=this.panelWrapperEl;var g=MUI.Panels.instances;var e=[];c.getAllPrevious(".panelWrapper").each(function(j){var h=g.get(j.getElement(".panel").id);if(h.isCollapsed==false){e.push(j.getElement(".panel").id)}});c.getAllNext(".panelWrapper").each(function(j){var h=g.get(j.getElement(".panel").id);if(h.isCollapsed==false){e.push(j.getElement(".panel").id)}});if(this.isCollapsed==false){var d=MUI.Columns.instances.get($(a.column).id);if(e.length==0&&d.options.placement!="main"){var d=MUI.Columns.instances.get($(a.column).id);d.columnToggle();return}else{if(e.length==0&&d.options.placement=="main"){return}}this.oldHeight=b.getStyle("height").toInt();if(this.oldHeight<10){this.oldHeight=20}this.contentEl.setStyle("position","absolute");b.setStyle("height",0);this.isCollapsed=true;c.addClass("collapsed");c.removeClass("expanded");MUI.panelHeight(a.column,b,"collapsing");MUI.panelHeight();this.collapseToggleEl.removeClass("panel-collapsed");this.collapseToggleEl.addClass("panel-expand");this.collapseToggleEl.setProperty("title","Expand Panel");this.fireEvent("onCollapse")}else{this.contentEl.setStyle("position",null);b.setStyle("height",this.oldHeight);this.isCollapsed=false;c.addClass("expanded");c.removeClass("collapsed");MUI.panelHeight(this.options.column,b,"expanding");MUI.panelHeight();this.collapseToggleEl.removeClass("panel-expand");this.collapseToggleEl.addClass("panel-collapsed");this.collapseToggleEl.setProperty("title","Collapse Panel");this.fireEvent("onExpand")}}.bind(this))}});MUI.Panel.implement(new Options,new Events);MUI.extend({panelHeight:function(a,c,b){if(a!=null){MUI.panelHeight2($(a),c,b)}else{$$(".column").each(function(d){MUI.panelHeight2(d)}.bind(this))}},panelHeight2:function(e,m,f){var b=MUI.Panels.instances;var j=e.getParent();var h=j.getStyle("height").toInt();if(Browser.Engine.trident4&&j==MUI.Desktop.pageWrapper){h-=1}e.setStyle("height",h);var g=[];e.getChildren(".panelWrapper").each(function(n){g.push(n.getElement(".panel"))}.bind(this));var k=[];e.getChildren(".expanded").each(function(n){k.push(n.getElement(".panel"))}.bind(this));var c=[];var d;var a=0;this.panelsTotalHeight=0;this.height=0;g.each(function(n){instance=b.get(n.id);if(n.getParent().hasClass("expanded")&&n.getParent().getNext(".expanded")){instance.partner=n.getParent().getNext(".expanded").getElement(".panel");instance.resize.attach();instance.handleEl.setStyles({display:"block",cursor:Browser.Engine.webkit?"row-resize":"n-resize"}).removeClass("detached")}else{instance.resize.detach();instance.handleEl.setStyles({display:"none",cursor:null}).addClass("detached")}if(n.getParent().getNext(".panelWrapper")==null){instance.handleEl.hide()}}.bind(this));e.getChildren().each(function(n){n.getChildren().each(function(p){if(p.hasClass("panel")){var o=b.get(p.id);anyNextSiblingsExpanded=function(q){var r;q.getParent().getAllNext(".panelWrapper").each(function(s){var t=b.get(s.getElement(".panel").id);if(t.isCollapsed==false){r=true}}.bind(this));return r}.bind(this);anyExpandingNextSiblingsExpanded=function(q){var r;m.getParent().getAllNext(".panelWrapper").each(function(s){var t=b.get(s.getElement(".panel").id);if(t.isCollapsed==false){r=true}}.bind(this));return r}.bind(this);anyNextContainsChanging=function(r){var q=[];r.getParent().getAllNext(".panelWrapper").each(function(t){q.push(t.getElement(".panel"))}.bind(this));var s=q.contains(m);return s}.bind(this);nextExpandedChanging=function(q){var r;if(q.getParent().getNext(".expanded")){if(q.getParent().getNext(".expanded").getElement(".panel")==m){r=true}}return r};if(f=="new"){if(!o.isCollapsed&&p!=m){c.push(p);this.panelsTotalHeight+=p.offsetHeight.toInt()}}else{if(f==null||f=="collapsing"){if(!o.isCollapsed&&(!anyNextContainsChanging(p)||!anyNextSiblingsExpanded(p))){c.push(p);this.panelsTotalHeight+=p.offsetHeight.toInt()}}else{if(f=="expanding"&&!o.isCollapsed&&p!=m){if(!anyNextContainsChanging(p)||(!anyExpandingNextSiblingsExpanded(p)&&nextExpandedChanging(p))){c.push(p);this.panelsTotalHeight+=p.offsetHeight.toInt()}}}}if(p.style.height){this.height+=p.getStyle("height").toInt()}}else{this.height+=p.offsetHeight.toInt()}}.bind(this))}.bind(this));var l=e.offsetHeight.toInt()-this.height;this.height=0;e.getChildren().each(function(n){this.height+=n.offsetHeight.toInt()}.bind(this));var l=e.offsetHeight.toInt()-this.height;c.each(function(n){var p=this.panelsTotalHeight/n.offsetHeight.toInt();var o=n.getStyle("height").toInt()+(l/p);if(o<1){o=0}n.setStyle("height",o)}.bind(this));this.height=0;e.getChildren().each(function(n){n.getChildren().each(function(o){this.height+=o.offsetHeight.toInt();if(o.hasClass("panel")&&o.getStyle("height").toInt()>a){d=o;a=o.getStyle("height").toInt()}}.bind(this))}.bind(this));var l=e.offsetHeight.toInt()-this.height;if(l!=0&&a>0){d.setStyle("height",d.getStyle("height").toInt()+l);if(d.getStyle("height")<1){d.setStyle("height",0)}}j.getChildren(".columnHandle").each(function(p){var o=p.getParent();if(o.getStyle("height").toInt()<1){return}var n=o.getStyle("height").toInt()-p.getStyle("border-top").toInt()-p.getStyle("border-bottom").toInt();if(Browser.Engine.trident4&&o==MUI.Desktop.pageWrapper){n-=1}p.setStyle("height",n)});k.each(function(n){MUI.resizeChildren(n)}.bind(this))},resizeChildren:function(b){var d=MUI.Panels.instances;var a=d.get(b.id);var c=a.contentWrapperEl;if(a.iframeEl){if(!Browser.Engine.trident){a.iframeEl.setStyles({height:c.getStyle("height"),width:c.offsetWidth-c.getStyle("border-left").toInt()-c.getStyle("border-right").toInt()})}else{a.iframeEl.setStyles({height:c.getStyle("height"),width:c.offsetWidth-c.getStyle("border-left").toInt()-c.getStyle("border-right").toInt()-1});a.iframeEl.setStyles({width:c.offsetWidth-c.getStyle("border-left").toInt()-c.getStyle("border-right").toInt()})}}},rWidth:function(a){if(a==null){var a=MUI.Desktop.desktop}a.getElements(".rWidth").each(function(e){var b=e.offsetWidth.toInt();b-=e.getStyle("border-left").toInt();b-=e.getStyle("border-right").toInt();var d=e.getParent();this.width=0;d.getChildren().each(function(g){if(g.hasClass("mocha")!=true){this.width+=g.offsetWidth.toInt()}}.bind(this));var c=d.offsetWidth.toInt()-this.width;var f=b+c;if(f<1){f=0}e.setStyle("width",f);e.getChildren(".panel").each(function(g){g.setStyle("width",f-g.getStyle("border-left").toInt()-g.getStyle("border-right").toInt());MUI.resizeChildren(g)}.bind(this))})}});function addResizeRight(d,c,b){if(!$(d)){return}d=$(d);var f=MUI.Columns.instances;var a=f.get(d.id);var e=d.getNext(".columnHandle");e.setStyle("cursor",Browser.Engine.webkit?"col-resize":"e-resize");if(!c){c=50}if(!b){b=250}if(Browser.Engine.trident){e.addEvents({mousedown:function(){e.setCapture()},mouseup:function(){e.releaseCapture()}})}a.resize=d.makeResizable({handle:e,modifiers:{x:"width",y:false},limit:{x:[c,b]},onStart:function(){d.getElements("iframe").setStyle("visibility","hidden");d.getNext(".column").getElements("iframe").setStyle("visibility","hidden")}.bind(this),onDrag:function(){if(Browser.Engine.gecko){$$(".panel").each(function(g){if(g.getElements(".mochaIframe").length==0){g.hide()}})}MUI.rWidth(d.getParent());if(Browser.Engine.gecko){$$(".panel").show()}if(Browser.Engine.trident4){d.getChildren().each(function(h){var g=$(d).getStyle("width").toInt();g-=h.getStyle("border-right").toInt();g-=h.getStyle("border-left").toInt();g-=h.getStyle("padding-right").toInt();g-=h.getStyle("padding-left").toInt();h.setStyle("width",g)}.bind(this))}}.bind(this),onComplete:function(){MUI.rWidth(d.getParent());d.getElements("iframe").setStyle("visibility","visible");d.getNext(".column").getElements("iframe").setStyle("visibility","visible");a.fireEvent("onResize")}.bind(this)})}function addResizeLeft(d,c,b){if(!$(d)){return}d=$(d);var g=MUI.Columns.instances;var a=g.get(d.id);var f=d.getPrevious(".columnHandle");f.setStyle("cursor",Browser.Engine.webkit?"col-resize":"e-resize");var e=d.getPrevious(".column");if(!c){c=50}if(!b){b=250}if(Browser.Engine.trident){f.addEvents({mousedown:function(){f.setCapture()},mouseup:function(){f.releaseCapture()}})}a.resize=d.makeResizable({handle:f,modifiers:{x:"width",y:false},invert:true,limit:{x:[c,b]},onStart:function(){$(d).getElements("iframe").setStyle("visibility","hidden");e.getElements("iframe").setStyle("visibility","hidden")}.bind(this),onDrag:function(){MUI.rWidth(d.getParent())}.bind(this),onComplete:function(){MUI.rWidth(d.getParent());$(d).getElements("iframe").setStyle("visibility","visible");e.getElements("iframe").setStyle("visibility","visible");a.fireEvent("onResize")}.bind(this)})}function addResizeBottom(b){if(!$(b)){return}var b=$(b);var d=MUI.Panels.instances;var a=d.get(b.id);var c=a.handleEl;c.setStyle("cursor",Browser.Engine.webkit?"row-resize":"n-resize");partner=a.partner;min=0;max=function(){return b.getStyle("height").toInt()+partner.getStyle("height").toInt()}.bind(this);if(Browser.Engine.trident){c.addEvents({mousedown:function(){c.setCapture()},mouseup:function(){c.releaseCapture()}})}a.resize=b.makeResizable({handle:c,modifiers:{x:false,y:"height"},limit:{y:[min,max]},invert:false,onBeforeStart:function(){partner=a.partner;this.originalHeight=b.getStyle("height").toInt();this.partnerOriginalHeight=partner.getStyle("height").toInt()}.bind(this),onStart:function(){if(a.iframeEl){if(!Browser.Engine.trident){a.iframeEl.setStyle("visibility","hidden");partner.getElements("iframe").setStyle("visibility","hidden")}else{a.iframeEl.hide();partner.getElements("iframe").hide()}}}.bind(this),onDrag:function(){partnerHeight=partnerOriginalHeight;partnerHeight+=(this.originalHeight-b.getStyle("height").toInt());partner.setStyle("height",partnerHeight);MUI.resizeChildren(b,b.getStyle("height").toInt());MUI.resizeChildren(partner,partnerHeight);b.getChildren(".column").each(function(e){MUI.panelHeight(e)});partner.getChildren(".column").each(function(e){MUI.panelHeight(e)})}.bind(this),onComplete:function(){partnerHeight=partnerOriginalHeight;partnerHeight+=(this.originalHeight-b.getStyle("height").toInt());partner.setStyle("height",partnerHeight);MUI.resizeChildren(b,b.getStyle("height").toInt());MUI.resizeChildren(partner,partnerHeight);b.getChildren(".column").each(function(f){MUI.panelHeight(f)});partner.getChildren(".column").each(function(f){MUI.panelHeight(f)});if(a.iframeEl){if(!Browser.Engine.trident){a.iframeEl.setStyle("visibility","visible");partner.getElements("iframe").setStyle("visibility","visible")}else{a.iframeEl.show();partner.getElements("iframe").show();var e=a.iframeEl.getStyle("width").toInt();a.iframeEl.setStyle("width",e-1);MUI.rWidth();a.iframeEl.setStyle("width",e)}}a.fireEvent("onResize")}.bind(this)})}MUI.extend({closeColumn:function(b){var d=MUI.Columns.instances;var a=d.get(b.id);if(b!=$(b)||a.isClosing){return}a.isClosing=true;if(a.options.sortable){a.container.retrieve("sortables").removeLists(this.columnEl)}var c=b.getChildren(".panel");c.each(function(e){MUI.closePanel($(e.id))}.bind(this));if(Browser.Engine.trident){b.dispose();if(a.handleEl!=null){a.handleEl.dispose()}}else{b.destroy();if(a.handleEl!=null){a.handleEl.destroy()}}if(MUI.Desktop){MUI.Desktop.resizePanels()}d.erase(a.options.id);return true},closePanel:function(f){var e=MUI.Panels.instances;var a=e.get(f.id);if(f!=$(f)||a.isClosing){return}var b=a.options.column;a.isClosing=true;var c=MUI.Columns.instances;var d=c.get(b);if(d.options.sortable){d.options.container.retrieve("sortables").removeItems(a.panelWrapperEl)}a.panelWrapperEl.destroy();if(MUI.Desktop){MUI.Desktop.resizePanels()}$(b).getChildren(".panelWrapper").each(function(g){g.getElement(".panel").removeClass("bottomPanel")});$(b).getChildren(".panelWrapper").getLast().getElement(".panel").addClass("bottomPanel");e.erase(a.options.id);return true}});MUI.files[MUI.path.source+"Layout/Dock.js"]="loaded";MUI.options.extend({dockWrapper:"dockWrapper",dock:"dock"});MUI.extend({minimizeAll:function(){$$(".mocha").each(function(b){var a=b.retrieve("instance");if(!a.isMinimized&&a.options.minimizable==true){MUI.Dock.minimizeWindow(b)}}.bind(this))}});MUI.Dock={options:{useControls:true,dockPosition:"bottom",trueButtonColor:[70,245,70],enabledButtonColor:[115,153,191],disabledButtonColor:[170,170,170]},initialize:function(a){if(!MUI.Desktop){return}MUI.dockVisible=true;this.dockWrapper=$(MUI.options.dockWrapper);this.dock=$(MUI.options.dock);this.autoHideEvent=null;this.dockAutoHide=false;if(!this.dockWrapper){return}if(!this.options.useControls){if($("dockPlacement")){$("dockPlacement").setStyle("cursor","default")}if($("dockAutoHide")){$("dockAutoHide").setStyle("cursor","default")}}this.dockWrapper.setStyles({display:"block",position:"absolute",top:null,bottom:MUI.Desktop.desktopFooter?MUI.Desktop.desktopFooter.offsetHeight:0,left:0});if(this.options.useControls){this.initializeDockControls()}if($("dockLinkCheck")){this.sidebarCheck=new Element("div",{"class":"check",id:"dock_check"}).inject($("dockLinkCheck"))}this.dockSortables=new Sortables("#dockSort",{opacity:1,constrain:true,clone:false,revert:false});MUI.Desktop.setDesktopSize();if(MUI.myChain){MUI.myChain.callChain()}},initializeDockControls:function(){this.setDockColors();if(this.options.useControls){var b=new Element("canvas",{id:"dockCanvas",width:"15",height:"18"}).inject(this.dock);if(Browser.Engine.trident&&MUI.ieSupport=="excanvas"){G_vmlCanvasManager.initElement(b)}}var a=$("dockPlacement");var c=$("dockAutoHide");a.setProperty("title","Position Dock Top");a.addEvent("click",function(){this.moveDock()}.bind(this));c.setProperty("title","Turn Auto Hide On");c.addEvent("click",function(e){if(this.dockWrapper.getProperty("dockPosition")=="top"){return false}var d=$("dockCanvas").getContext("2d");this.dockAutoHide=!this.dockAutoHide;if(this.dockAutoHide){$("dockAutoHide").setProperty("title","Turn Auto Hide Off");MUI.circle(d,5,14,3,this.options.trueButtonColor,1);this.autoHideEvent=function(g){if(!this.dockAutoHide){return}if(!MUI.Desktop.desktopFooter){var f=this.dockWrapper.offsetHeight;if(f<25){f=25}}else{if(MUI.Desktop.desktopFooter){var f=this.dockWrapper.offsetHeight+MUI.Desktop.desktopFooter.offsetHeight;if(f<25){f=25}}}if(!MUI.Desktop.desktopFooter&&g.client.y>(document.getCoordinates().height-f)){if(!MUI.dockVisible){this.dockWrapper.show();MUI.dockVisible=true;MUI.Desktop.setDesktopSize()}}else{if(MUI.Desktop.desktopFooter&&g.client.y>(document.getCoordinates().height-f)){if(!MUI.dockVisible){this.dockWrapper.show();MUI.dockVisible=true;MUI.Desktop.setDesktopSize()}}else{if(MUI.dockVisible){this.dockWrapper.hide();MUI.dockVisible=false;MUI.Desktop.setDesktopSize()}}}}.bind(this);document.addEvent("mousemove",this.autoHideEvent)}else{$("dockAutoHide").setProperty("title","Turn Auto Hide On");MUI.circle(d,5,14,3,this.options.enabledButtonColor,1);document.removeEvent("mousemove",this.autoHideEvent)}}.bind(this));this.renderDockControls();if(this.options.dockPosition=="top"){this.moveDock()}},setDockColors:function(){var c=MUI.getCSSRule(".dockButtonEnabled");if(c&&c.style.backgroundColor){this.options.enabledButtonColor=new Color(c.style.backgroundColor)}var a=MUI.getCSSRule(".dockButtonDisabled");if(a&&a.style.backgroundColor){this.options.disabledButtonColor=new Color(a.style.backgroundColor)}var b=MUI.getCSSRule(".dockButtonTrue");if(b&&b.style.backgroundColor){this.options.trueButtonColor=new Color(b.style.backgroundColor)}},renderDockControls:function(){var a=$("dockCanvas").getContext("2d");a.clearRect(0,0,100,100);MUI.circle(a,5,4,3,this.options.enabledButtonColor,1);if(this.dockWrapper.getProperty("dockPosition")=="top"){MUI.circle(a,5,14,3,this.options.disabledButtonColor,1)}else{if(this.dockAutoHide){MUI.circle(a,5,14,3,this.options.trueButtonColor,1)}else{MUI.circle(a,5,14,3,this.options.enabledButtonColor,1)}}},moveDock:function(){var a=$("dockCanvas").getContext("2d");if(this.dockWrapper.getStyle("position")!="relative"){this.dockWrapper.setStyles({position:"relative",bottom:null});this.dockWrapper.addClass("top");MUI.Desktop.setDesktopSize();this.dockWrapper.setProperty("dockPosition","top");a.clearRect(0,0,100,100);MUI.circle(a,5,4,3,this.options.enabledButtonColor,1);MUI.circle(a,5,14,3,this.options.disabledButtonColor,1);$("dockPlacement").setProperty("title","Position Dock Bottom");$("dockAutoHide").setProperty("title","Auto Hide Disabled in Top Dock Position");this.dockAutoHide=false}else{this.dockWrapper.setStyles({position:"absolute",bottom:MUI.Desktop.desktopFooter?MUI.Desktop.desktopFooter.offsetHeight:0});this.dockWrapper.removeClass("top");MUI.Desktop.setDesktopSize();this.dockWrapper.setProperty("dockPosition","bottom");a.clearRect(0,0,100,100);MUI.circle(a,5,4,3,this.options.enabledButtonColor,1);MUI.circle(a,5,14,3,this.options.enabledButtonColor,1);$("dockPlacement").setProperty("title","Position Dock Top");$("dockAutoHide").setProperty("title","Turn Auto Hide On")}},createDockTab:function(e){var a=e.retrieve("instance");var d=new Element("div",{id:a.options.id+"_dockTab","class":"dockTab",title:b}).inject($("dockClear"),"before");d.addEvent("mousedown",function(f){new Event(f).stop();this.timeDown=$time()});d.addEvent("mouseup",function(f){this.timeUp=$time();if((this.timeUp-this.timeDown)<275){if(MUI.Windows.windowsVisible==false){MUI.toggleWindowVisibility();if(a.isMinimized==true){MUI.Dock.restoreMinimized.delay(25,MUI.Dock,e)}else{MUI.focusWindow(e)}return}if(a.isMinimized==true){MUI.Dock.restoreMinimized.delay(25,MUI.Dock,e)}else{if(a.windowEl.hasClass("isFocused")&&a.options.minimizable==true){MUI.Dock.minimizeWindow(e)}else{MUI.focusWindow(e)}var g=document.getCoordinates();if(e.getStyle("left").toInt()>g.width||e.getStyle("top").toInt()>g.height){MUI.centerWindow(e)}}}});this.dockSortables.addItems(d);var b=a.titleEl.innerHTML;var c=new Element("div",{id:a.options.id+"_dockTabText","class":"dockText"}).set("html",b.substring(0,19)+(b.length>19?"...":"")).inject($(d));if(a.options.icon!=false){}MUI.Desktop.setDesktopSize()},makeActiveTab:function(){var c=MUI.getWindowWithHighestZindex();var a=c.retrieve("instance");$$(".dockTab").removeClass("activeDockTab");if(a.isMinimized!=true){a.windowEl.addClass("isFocused");var b=$(a.options.id+"_dockTab");if(b!=null){b.addClass("activeDockTab")}}else{a.windowEl.removeClass("isFocused")}},minimizeWindow:function(c){if(c!=$(c)){return}var a=c.retrieve("instance");a.isMinimized=true;if(a.iframeEl){if(!Browser.Engine.trident){a.iframeEl.setStyle("visibility","hidden")}else{a.iframeEl.hide()}}a.contentBorderEl.setStyle("visibility","hidden");if(a.toolbarWrapperEl){a.toolbarWrapperEl.hide()}c.setStyle("visibility","hidden");if(Browser.Platform.mac&&Browser.Engine.gecko){if(/Firefox[\/\s](\d+\.\d+)/.test(navigator.userAgent)){var b=new Number(RegExp.$1);if(b<3){a.contentWrapperEl.setStyle("overflow","hidden")}}}MUI.Desktop.setDesktopSize();setTimeout(function(){c.setStyle("zIndex",1);c.removeClass("isFocused");this.makeActiveTab()}.bind(this),100);a.fireEvent("onMinimize",c)},restoreMinimized:function(b){var a=b.retrieve("instance");if(a.isMinimized==false){return}if(MUI.Windows.windowsVisible==false){MUI.toggleWindowVisibility()}MUI.Desktop.setDesktopSize();if(a.options.scrollbars==true&&!a.iframeEl){a.contentWrapperEl.setStyle("overflow","auto")}if(a.isCollapsed){MUI.collapseToggle(b)}b.setStyle("visibility","visible");a.contentBorderEl.setStyle("visibility","visible");if(a.toolbarWrapperEl){a.toolbarWrapperEl.show()}if(a.iframeEl){if(!Browser.Engine.trident){a.iframeEl.setStyle("visibility","visible")}else{a.iframeEl.show()}}a.isMinimized=false;MUI.focusWindow(b);a.fireEvent("onRestore",b)}};MUI.files[MUI.path.source+"Layout/Workspaces.js"]="loaded";MUI.extend({saveWorkspace:function(){this.cookie=new Hash.Cookie("mochaUIworkspaceCookie",{duration:3600});this.cookie.empty();MUI.Windows.instances.each(function(a){a.saveValues();this.cookie.set(a.options.id,{id:a.options.id,top:a.options.y,left:a.options.x,width:a.contentWrapperEl.getStyle("width").toInt(),height:a.contentWrapperEl.getStyle("height").toInt()})}.bind(this));this.cookie.save();new MUI.Window({loadMethod:"html",type:"notification",addClass:"notification",content:"Workspace saved.",closeAfter:"1400",width:200,height:40,y:53,padding:{top:10,right:12,bottom:10,left:12},shadowBlur:5,bodyBgColor:[255,255,255]})},windowUnload:function(){if($$(".mocha").length==0&&this.myChain){this.myChain.callChain()}},loadWorkspace2:function(workspaceWindows){workspaceWindows.each(function(workspaceWindow){windowFunction=eval("MUI."+workspaceWindow.id+"Window");if(windowFunction){eval("MUI."+workspaceWindow.id+"Window({width:"+workspaceWindow.width+",height:"+workspaceWindow.height+"});");var windowEl=$(workspaceWindow.id);windowEl.setStyles({top:workspaceWindow.top,left:workspaceWindow.left});var instance=windowEl.retrieve("instance");instance.contentWrapperEl.setStyles({width:workspaceWindow.width,height:workspaceWindow.height});instance.drawWindow()}}.bind(this));this.loadingWorkspace=false},loadWorkspace:function(){cookie=new Hash.Cookie("mochaUIworkspaceCookie",{duration:3600});workspaceWindows=cookie.load();if(!cookie.getKeys().length){new MUI.Window({loadMethod:"html",type:"notification",addClass:"notification",content:"You have no saved workspace.",closeAfter:"1400",width:220,height:40,y:25,padding:{top:10,right:12,bottom:10,left:12},shadowBlur:5,bodyBgColor:[255,255,255]});return}if($$(".mocha").length!=0){this.loadingWorkspace=true;this.myChain=new Chain();this.myChain.chain(function(){$$(".mocha").each(function(a){this.closeWindow(a)}.bind(this))}.bind(this),function(){this.loadWorkspace2(workspaceWindows)}.bind(this));this.myChain.callChain()}else{this.loadWorkspace2(workspaceWindows)}}}); \ No newline at end of file +var MUI=MochaUI=new Hash({version:"0.9.6 development",options:new Hash({theme:"default",advancedEffects:false,standardEffects:true}),path:{source:"scripts/source/",themes:"themes/",plugins:"plugins/"},themePath:function(){return MUI.path.themes+MUI.options.theme+"/"},files:new Hash()});MUI.files[MUI.path.source+"Core/Core.js"]="loaded";MUI.extend({Windows:{instances:new Hash()},ieSupport:"excanvas",ieLegacySupport:Browser.Engine.trident&&Browser.version<9,updateContent:function(c){var c=$extend({element:null,childElement:null,method:null,data:null,title:null,content:null,loadMethod:null,url:null,scrollbars:null,padding:null,require:{},onContentLoaded:$empty},c);c.require=$extend({css:[],images:[],js:[],onload:null},c.require);var b={};if(!c.element){return}var d=c.element;if(MUI.Windows.instances.get(d.id)){b.recipient="window"}else{b.recipient="panel"}var a=d.retrieve("instance");if(c.title){a.titleEl.set("html",c.title)}var e=a.contentEl;b.contentContainer=c.childElement!=null?c.childElement:a.contentEl;var g=a.contentWrapperEl;if(!c.loadMethod){if(!a.options.loadMethod){if(!c.url){c.loadMethod="html"}else{c.loadMethod="xhr"}}else{c.loadMethod=a.options.loadMethod}}var f=c.scrollbars||a.options.scrollbars;if(b.contentContainer==a.contentEl){g.setStyles({overflow:f!=false&&c.loadMethod!="iframe"?"auto":"hidden"})}if(c.padding!=null){e.setStyles({"padding-top":c.padding.top,"padding-bottom":c.padding.bottom,"padding-left":c.padding.left,"padding-right":c.padding.right})}if(b.contentContainer==e){e.empty().show();e.getAllNext(".column").destroy();e.getAllNext(".columnHandle").destroy()}b.onContentLoaded=function(){if(c.require.js.length||typeof c.require.onload=="function"){new MUI.Require({js:c.require.js,onload:function(){if(Browser.Engine.presto){c.require.onload.delay(100)}else{c.require.onload()}c.onContentLoaded?c.onContentLoaded():a.fireEvent("onContentLoaded",d)}.bind(this)})}else{c.onContentLoaded?c.onContentLoaded():a.fireEvent("onContentLoaded",d)}};if(c.require.css.length||c.require.images.length){new MUI.Require({css:c.require.css,images:c.require.images,onload:function(){this.loadSelect(a,c,b)}.bind(this)})}else{this.loadSelect(a,c,b)}},loadSelect:function(a,c,b){switch(c.loadMethod){case"xhr":this.updateContentXHR(a,c,b);break;case"iframe":this.updateContentIframe(a,c,b);break;case"html":default:this.updateContentHTML(a,c,b);break}},updateContentXHR:function(a,c,b){var f=a.contentEl;var e=b.contentContainer;var d=b.onContentLoaded;new Request.HTML({url:c.url,update:e,method:c.method!=null?c.method:"get",data:c.data!=null?new Hash(c.data).toQueryString():"",evalScripts:a.options.evalScripts,evalResponse:a.options.evalResponse,onRequest:function(){if(b.recipient=="window"&&e==f){a.showSpinner()}else{if(b.recipient=="panel"&&e==f&&$("spinner")){$("spinner").show()}}}.bind(this),onFailure:function(g){if(e==f){var j=new RegExp("[\n\rs]*(.*)[\n\rs]*","gmi");var h=j.exec(g.responseText);if(!h){h="Unknown"}e.set("html","

Error: "+h[1]+"

");if(b.recipient=="window"){a.hideSpinner()}else{if(b.recipient=="panel"&&$("spinner")){$("spinner").hide()}}}}.bind(this),onSuccess:function(){if(e==f){if(b.recipient=="window"){a.hideSpinner()}else{if(b.recipient=="panel"&&$("spinner")){$("spinner").hide()}}}Browser.Engine.trident4?d.delay(750):d()}.bind(this),onComplete:function(){}.bind(this)}).send()},updateContentIframe:function(a,c,b){var f=a.contentEl;var e=b.contentContainer;var g=a.contentWrapperEl;var d=b.onContentLoaded;if(a.options.contentURL==""||e!=f){return}a.iframeEl=new Element("iframe",{id:a.options.id+"_iframe",name:a.options.id+"_iframe","class":"mochaIframe",src:c.url,marginwidth:0,marginheight:0,frameBorder:0,scrolling:"auto",styles:{height:g.offsetHeight-g.getStyle("border-top").toInt()-g.getStyle("border-bottom").toInt(),width:a.panelEl?g.offsetWidth-g.getStyle("border-left").toInt()-g.getStyle("border-right").toInt():"100%"}}).injectInside(f);a.iframeEl.addEvent("load",function(h){if(b.recipient=="window"){a.hideSpinner()}else{if(b.recipient=="panel"&&e==f&&$("spinner")){$("spinner").hide()}}Browser.Engine.trident4?d.delay(50):d()}.bind(this));if(b.recipient=="window"){a.showSpinner()}else{if(b.recipient=="panel"&&e==f&&$("spinner")){$("spinner").show()}}},updateContentHTML:function(a,c,b){var f=a.contentEl;var e=b.contentContainer;var d=b.onContentLoaded;var g=new Array("element","textnode","whitespace","collection");if(g.contains($type(c.content))){c.content.inject(e)}else{e.set("html",c.content)}if(e==f){if(b.recipient=="window"){a.hideSpinner()}else{if(b.recipient=="panel"&&$("spinner")){$("spinner").hide()}}}Browser.Engine.trident4?d.delay(50):d()},reloadIframe:function(a){Browser.Engine.gecko?$(a).src=$(a).src:top.frames[a].location.reload(true)},roundedRect:function(f,d,j,h,c,b,g,e){f.fillStyle="rgba("+g.join(",")+","+e+")";f.beginPath();f.moveTo(d,j+b);f.lineTo(d,j+c-b);f.quadraticCurveTo(d,j+c,d+b,j+c);f.lineTo(d+h-b,j+c);f.quadraticCurveTo(d+h,j+c,d+h,j+c-b);f.lineTo(d+h,j+b);f.quadraticCurveTo(d+h,j,d+h-b,j);f.lineTo(d+b,j);f.quadraticCurveTo(d,j,d,j+b);f.fill()},triangle:function(e,c,h,g,b,f,d){e.beginPath();e.moveTo(c+g,h);e.lineTo(c,h+b);e.lineTo(c+g,h+b);e.closePath();e.fillStyle="rgba("+f.join(",")+","+d+")";e.fill()},circle:function(d,b,g,f,e,c){d.beginPath();d.arc(b,g,f,0,Math.PI*2,true);d.fillStyle="rgba("+e.join(",")+","+c+")";d.fill()},notification:function(a){new MUI.Window({loadMethod:"html",closeAfter:1500,type:"notification",addClass:"notification",content:a,width:220,height:40,y:53,padding:{top:10,right:12,bottom:10,left:12},shadowBlur:5})},toggleAdvancedEffects:function(a){if(MUI.options.advancedEffects==false){MUI.options.advancedEffects=true;if(a){this.toggleAdvancedEffectsLink=new Element("div",{"class":"check",id:"toggleAdvancedEffects_check"}).inject(a)}}else{MUI.options.advancedEffects=false;if(this.toggleAdvancedEffectsLink){this.toggleAdvancedEffectsLink.destroy()}}},toggleStandardEffects:function(a){if(MUI.options.standardEffects==false){MUI.options.standardEffects=true;if(a){this.toggleStandardEffectsLink=new Element("div",{"class":"check",id:"toggleStandardEffects_check"}).inject(a)}}else{MUI.options.standardEffects=false;if(this.toggleStandardEffectsLink){this.toggleStandardEffectsLink.destroy()}}},underlayInitialize:function(){var a=new Element("div",{id:"windowUnderlay",styles:{height:parent.getCoordinates().height,opacity:0.01,display:"none"}}).inject(document.body)},setUnderlaySize:function(){$("windowUnderlay").setStyle("height",parent.getCoordinates().height)}});function fixPNG(e){if(Browser.Engine.trident4&&document.body.filters){var b=(e.id)?"id='"+e.id+"' ":"";var d=(e.className)?"class='"+e.className+"' ":"";var f=(e.title)?"title='"+e.title+"' ":"title='"+e.alt+"' ";var c="display:inline-block;"+e.style.cssText;var a="";e.outerHTML=a}}document.addEvent("mousedown",function(a){MUI.blurAll.delay(50)});window.addEvent("domready",function(){MUI.underlayInitialize()});window.addEvent("resize",function(){if($("windowUnderlay")){MUI.setUnderlaySize()}else{MUI.underlayInitialize()}});Element.implement({hide:function(){this.setStyle("display","none");return this},show:function(){this.setStyle("display","block");return this}});Element.implement({shake:function(b,h){b=b||3;h=h||500;h=(h/50).toInt()-1;var e=this.getParent();if(e!=$(document.body)&&e.getStyle("position")=="static"){e.setStyle("position","relative")}var a=this.getStyle("position");if(a=="static"){this.setStyle("position","relative");a="relative"}if(MUI.ieLegacySupport){e.setStyle("height",e.getStyle("height"))}var g=this.getPosition(e);if(a=="relative"&&!Browser.Engine.presto){g.x-=e.getStyle("paddingLeft").toInt();g.y-=e.getStyle("paddingTop").toInt()}var f=this.retrieve("morph");if(f){f.cancel();var c=f.options}var f=this.get("morph",{duration:50,link:"chain"});for(var d=0;d]*>([\s\S]*?)<\/body>/i);c=(b)?b[1]:c;var a=new Element("div");return a.set("html",c)}});MUI.getCSSRule=function(b){for(var c=0;c=200)&&(a<300))}});Browser.Request=function(){return $try(function(){return new ActiveXObject("MSXML2.XMLHTTP")},function(){return new XMLHttpRequest()})}}MUI.Require=new Class({Implements:[Options],options:{css:[],images:[],js:[],onload:$empty},initialize:function(a){this.setOptions(a);var a=this.options;this.assetsToLoad=a.css.length+a.images.length+a.js.length;this.assetsLoaded=0;var b=0;if(a.css.length){a.css.each(function(c){this.getAsset(c,function(){if(b==a.css.length-1){if(this.assetsLoaded==this.assetsToLoad-1){this.requireOnload()}else{this.assetsLoaded++;this.requireContinue.delay(50,this)}}else{b++;this.assetsLoaded++}}.bind(this))}.bind(this))}else{if(!a.js.length&&!a.images.length){this.options.onload();return true}else{this.requireContinue.delay(50,this)}}},requireOnload:function(){this.assetsLoaded++;if(this.assetsLoaded==this.assetsToLoad){this.options.onload();return true}},requireContinue:function(){var a=this.options;if(a.images.length){a.images.each(function(b){this.getAsset(b,this.requireOnload.bind(this))}.bind(this))}if(a.js.length){a.js.each(function(b){this.getAsset(b,this.requireOnload.bind(this))}.bind(this))}},getAsset:function(b,c){if(MUI.files[b]=="loaded"){if(typeof c=="function"){c()}return true}else{if(MUI.files[b]=="loading"){var d=0;var a=(function(){d++;if(MUI.files[b]=="loading"&&d<"100"){return}$clear(a);if(typeof c=="function"){c()}}).periodical(50)}else{MUI.files[b]="loading";properties={onload:c!="undefined"?c:$empty};var e=properties.onload;properties.onload=function(){MUI.files[b]="loaded";if(e){e()}}.bind(this);switch(b.match(/\.\w+$/)[0]){case".js":return Asset.javascript(b,properties);case".css":return Asset.css(b,properties);case".jpg":case".png":case".gif":return Asset.image(b,properties)}alert('The required file "'+b+'" could not be loaded')}}}});$extend(Asset,{javascript:function(f,d){d=$extend({onload:$empty,document:document,check:$lambda(true)},d);if($(d.id)){d.onload();return $(d.id)}var b=new Element("script",{src:f,type:"text/javascript"});var e=d.onload.bind(b),a=d.check,g=d.document;delete d.onload;delete d.check;delete d.document;if(!Browser.Engine.webkit419&&!Browser.Engine.presto){b.addEvents({load:e,readystatechange:function(){if(MUI.ieLegacySupport&&["loaded","complete"].contains(this.readyState)){e()}}}).setProperties(d)}else{var c=(function(){if(!$try(a)){return}$clear(c);Browser.Engine.presto?e.delay(500):e()}).periodical(50)}return b.inject(g.head)},css:function(b,a){a=$extend({id:null,media:"screen",onload:$empty},a);new Request({method:"get",url:b,onComplete:function(c){var d=new Element("link",{id:a.id,rel:"stylesheet",media:a.media,type:"text/css",href:b}).inject(document.head);a.onload()}.bind(this),onFailure:function(c){},onSuccess:function(){}.bind(this)}).send()}});MUI.extend({newWindowsFromJSON:function(a){new MUI.Require({js:[MUI.path.source+"Window/Windows-from-json.js"],onload:function(){new MUI.newWindowsFromJSON(a)}})},arrangeCascade:function(){new MUI.Require({js:[MUI.path.source+"Window/Arrange-cascade.js"],onload:function(){new MUI.arrangeCascade()}})},arrangeTile:function(){new MUI.Require({js:[MUI.path.source+"Window/Arrange-tile.js"],onload:function(){new MUI.arrangeTile()}})},saveWorkspace:function(){new MUI.Require({js:[MUI.path.source+"Layout/Workspaces.js"],onload:function(){new MUI.saveWorkspace()}})},loadWorkspace:function(){new MUI.Require({js:[MUI.path.source+"Layout/Workspaces.js"],onload:function(){new MUI.loadWorkspace()}})},Themes:{init:function(a){new MUI.Require({js:[MUI.path.source+"Utilities/Themes.js"],onload:function(){MUI.Themes.init(a)}})}}});MUI.files[MUI.path.source+"Utilities/Themes.js"]=1;MUI.Themes={init:function(a){this.newTheme=a.toLowerCase();if(!this.newTheme||this.newTheme==null||this.newTheme==MUI.options.theme.toLowerCase()){return}if($("spinner")){$("spinner").show()}this.oldURIs=[];this.oldSheets=[];$$("link").each(function(c){var b=c.get("href");if(b.contains(MUI.path.themes+MUI.options.theme)){this.oldURIs.push(b);this.oldSheets.push(c)}}.bind(this));this.newSheetURLs=this.oldURIs.map(function(c,b){return c.replace("/"+MUI.options.theme+"/","/"+MUI.Themes.newTheme+"/")}.bind(this));this.sheetsToLoad=this.oldURIs.length;this.sheetsLoaded=0;this.newSheets=[];this.newSheetURLs.each(function(d){var b=d;var c=new Request({method:"get",url:b,onComplete:function(e){var f=new Element("link",{rel:"stylesheet",media:"screen",type:"text/css",href:b});this.newSheets.push(f)}.bind(this),onFailure:function(e){this.themeLoadSuccess=false;if($("spinner")){$("spinner").hide()}MUI.notification("Stylesheets did not load.")},onSuccess:function(){this.sheetsLoaded++;if(this.sheetsLoaded==this.sheetsToLoad){this.updateThemeStylesheets();this.themeLoadSuccess=true}}.bind(this)});c.send()}.bind(this))},updateThemeStylesheets:function(){this.oldSheets.each(function(a){a.destroy()});this.newSheets.each(function(a){MUI.files[a.get("href")]=1;a.inject(document.head)});if(MUI.ieLegacySupport){this.redraw.delay(1250,this)}else{this.redraw.delay(250,this)}},redraw:function(){$$(".replaced").removeClass("replaced");$$(".mocha").each(function(c){var b=c.retrieve("instance");b.setColors();b.drawWindow()});if(MUI.Dock){if(MUI.Dock.options.useControls){MUI.Dock.setDockColors();MUI.Dock.renderDockControls()}}if(MUI.Desktop.desktop){var a=(function(){if(MUI.Desktop.desktop.getStyle("overflow")!="hidden"){return}$clear(a);MUI.Desktop.setDesktopSize()}).periodical(50)}if($("spinner")){$("spinner").hide()}MUI.options.theme=this.newTheme}};window.addEvent("load",function(){if($("themeControl")){$("themeControl").getElements("option").setProperty("selected","false");if($("chooseTheme")){$("chooseTheme").setProperty("selected","true")}}});MUI.files[MUI.path.source+"Window/Window.js"]="loading";MUI.extend({Windows:{instances:new Hash(),indexLevel:100,windowIDCount:0,windowsVisible:true,focusingWindow:false}});MUI.Windows.windowOptions={id:null,title:"New Window",icon:false,type:"window",require:{css:[],images:[],js:[],onload:null},loadMethod:null,method:"get",contentURL:null,data:null,closeAfter:false,evalScripts:true,evalResponse:false,content:"Window content",toolbar:false,toolbarPosition:"top",toolbarHeight:29,toolbarURL:"pages/lipsum.html",toolbarData:null,toolbarContent:"",toolbarOnload:$empty,toolbar2:false,toolbar2Position:"bottom",toolbar2Height:29,toolbar2URL:"pages/lipsum.html",toolbar2Data:null,toolbar2Content:"",toolbar2Onload:$empty,container:null,restrict:true,shape:"box",collapsible:true,minimizable:true,maximizable:true,closable:true,storeOnClose:false,modalOverlayClose:true,draggable:null,draggableGrid:false,draggableLimit:false,draggableSnap:false,resizable:null,resizeLimit:{x:[250,2500],y:[125,2000]},addClass:"",width:300,height:125,headerHeight:25,footerHeight:25,cornerRadius:8,x:null,y:null,scrollbars:true,padding:{top:10,right:12,bottom:10,left:12},shadowBlur:5,shadowOffset:{x:0,y:1},controlsOffset:{right:6,top:6},useCanvas:true,useCanvasControls:true,useSpinner:true,headerStartColor:[250,250,250],headerStopColor:[229,229,229],bodyBgColor:[229,229,229],minimizeBgColor:[255,255,255],minimizeColor:[0,0,0],maximizeBgColor:[255,255,255],maximizeColor:[0,0,0],closeBgColor:[255,255,255],closeColor:[0,0,0],resizableColor:[254,254,254],onBeforeBuild:$empty,onContentLoaded:$empty,onFocus:$empty,onBlur:$empty,onResize:$empty,onMinimize:$empty,onMaximize:$empty,onRestore:$empty,onClose:$empty,onCloseComplete:$empty};MUI.Windows.windowOptionsOriginal=$merge(MUI.Windows.windowOptions);MUI.Window=new Class({Implements:[Events,Options],options:MUI.Windows.windowOptions,initialize:function(a){this.setOptions(a);var a=this.options;$extend(this,{mochaControlsWidth:0,minimizebuttonX:0,maximizebuttonX:0,closebuttonX:0,headerFooterShadow:a.headerHeight+a.footerHeight+(a.shadowBlur*2),oldTop:0,oldLeft:0,isMaximized:false,isMinimized:false,isCollapsed:false,timestamp:$time()});if(a.type!="window"){a.container=document.body;a.minimizable=false}if(!a.container){a.container=MUI.Desktop&&MUI.Desktop.desktop?MUI.Desktop.desktop:document.body}if(a.resizable==null){if(a.type!="window"||a.shape=="gauge"){a.resizable=false}else{a.resizable=true}}if(a.draggable==null){a.draggable=a.type!="window"?false:true}if(a.shape=="gauge"||a.type=="notification"){a.collapsible=false;a.maximizable=false;a.contentBgColor="transparent";a.scrollbars=false;a.footerHeight=0}if(a.type=="notification"){a.closable=false;a.headerHeight=0}if(MUI.Dock&&$(MUI.options.dock)){if(MUI.Dock.dock&&a.type!="modal"&&a.type!="modal2"){a.minimizable=a.minimizable}}else{a.minimizable=false}a.maximizable=MUI.Desktop&&MUI.Desktop.desktop&&a.maximizable&&a.type!="modal"&&a.type!="modal2";if(this.options.type=="modal2"){this.options.shadowBlur=0;this.options.shadowOffset={x:0,y:0};this.options.useSpinner=false;this.options.useCanvas=false;this.options.footerHeight=0;this.options.headerHeight=0}a.id=a.id||"win"+(++MUI.Windows.windowIDCount);this.windowEl=$(a.id);if(a.require.css.length||a.require.images.length){new MUI.Require({css:a.require.css,images:a.require.images,onload:function(){this.newWindow()}.bind(this)})}else{this.newWindow()}return this},saveValues:function(){var a=this.windowEl.getCoordinates();this.options.x=a.left.toInt();this.options.y=a.top.toInt()},newWindow:function(d){var b=MUI.Windows.instances;var k=MUI.Windows.instances.get(this.options.id);var l=this.options;if(k){var j=k}if(this.windowEl&&!this.isClosing){if(j.isMinimized){MUI.Dock.restoreMinimized(this.windowEl)}else{if(j.isCollapsed){MUI.collapseToggle(this.windowEl);setTimeout(MUI.focusWindow.pass(this.windowEl,this),10)}else{if(this.windowEl.hasClass("windowClosed")){if(j.check){j.check.show()}this.windowEl.removeClass("windowClosed");this.windowEl.setStyle("opacity",0);this.windowEl.addClass("mocha");if(MUI.Dock&&$(MUI.options.dock)&&j.options.type=="window"){var g=$(j.options.id+"_dockTab");if(g!=null){g.show()}MUI.Desktop.setDesktopSize()}j.displayNewWindow()}else{var h=document.getCoordinates();if(this.windowEl.getStyle("left").toInt()>h.width||this.windowEl.getStyle("top").toInt()>h.height){MUI.centerWindow(this.windowEl)}setTimeout(MUI.focusWindow.pass(this.windowEl,this),10);if(MUI.options.standardEffects==true){this.windowEl.shake()}}}}return}else{b.set(l.id,this)}this.isClosing=false;this.fireEvent("onBeforeBuild");MUI.Windows.indexLevel++;this.windowEl=new Element("div",{"class":"mocha",id:l.id,styles:{position:"absolute",width:l.width,height:l.height,display:"block",opacity:0,zIndex:MUI.Windows.indexLevel+=2}});this.windowEl.store("instance",this);this.windowEl.addClass(l.addClass);if(l.type=="modal2"){this.windowEl.addClass("modal2")}if(MUI.ieLegacySupport&&l.shape=="gauge"){this.windowEl.setStyle("backgroundImage","url(../images/spacer.gif)")}if((this.options.type=="modal"||l.type=="modal2")&&Browser.Platform.mac&&Browser.Engine.gecko){if(/Firefox[\/\s](\d+\.\d+)/.test(navigator.userAgent)){var c=new Number(RegExp.$1);if(c<3){this.windowEl.setStyle("position","fixed")}}}if(l.loadMethod=="iframe"){l.padding={top:0,right:0,bottom:0,left:0}}this.insertWindowElements();this.titleEl.set("html",l.title);this.contentWrapperEl.setStyle("overflow","hidden");this.contentEl.setStyles({"padding-top":l.padding.top,"padding-bottom":l.padding.bottom,"padding-left":l.padding.left,"padding-right":l.padding.right});if(l.shape=="gauge"){if(l.useCanvasControls){this.canvasControlsEl.setStyle("visibility","hidden")}else{this.controlsEl.setStyle("visibility","hidden")}this.windowEl.addEvent("mouseover",function(){this.mouseover=true;var m=function(){if(this.mouseover!=false){if(l.useCanvasControls){this.canvasControlsEl.setStyle("visibility","visible")}else{this.controlsEl.setStyle("visibility","visible")}this.canvasHeaderEl.setStyle("visibility","visible");this.titleEl.show()}};m.delay(0,this)}.bind(this));this.windowEl.addEvent("mouseleave",function(){this.mouseover=false;if(this.options.useCanvasControls){this.canvasControlsEl.setStyle("visibility","hidden")}else{this.controlsEl.setStyle("visibility","hidden")}this.canvasHeaderEl.setStyle("visibility","hidden");this.titleEl.hide()}.bind(this))}this.windowEl.inject(l.container);this.setColors();if(l.type!="notification"){this.setMochaControlsWidth()}MUI.updateContent({element:this.windowEl,content:l.content,method:l.method,url:l.contentURL,data:l.data,onContentLoaded:null,require:{js:l.require.js,onload:l.require.onload}});if(this.options.toolbar==true){MUI.updateContent({element:this.windowEl,childElement:this.toolbarEl,content:l.toolbarContent,loadMethod:"xhr",method:l.method,url:l.toolbarURL,data:l.toolbarData,onContentLoaded:l.toolbarOnload})}if(this.options.toolbar2==true){MUI.updateContent({element:this.windowEl,childElement:this.toolbar2El,content:l.toolbar2Content,loadMethod:"xhr",method:l.method,url:l.toolbar2URL,data:l.toolbar2Data,onContentLoaded:l.toolbar2Onload})}this.drawWindow();this.attachDraggable();this.attachResizable();this.setupEvents();if(l.resizable){this.adjustHandles()}if(l.container==document.body||l.container==MUI.Desktop.desktop){var a=window.getSize()}else{var a=$(this.options.container).getSize()}if(!l.y){if(MUI.Desktop&&MUI.Desktop.desktop){var e=(a.y*0.5)-(this.windowEl.offsetHeight*0.5);if(e<-l.shadowBlur){e=-l.shadowBlur}}else{var e=window.getScroll().y+(window.getSize().y*0.5)-(this.windowEl.offsetHeight*0.5);if(e<-l.shadowBlur){e=-l.shadowBlur}}}else{var e=l.y-l.shadowBlur}if(!this.options.x){var f=(a.x*0.5)-(this.windowEl.offsetWidth*0.5);if(f<-l.shadowBlur){f=-l.shadowBlur}}else{var f=l.x-l.shadowBlur}this.windowEl.setStyles({top:e,left:f});this.opacityMorph=new Fx.Morph(this.windowEl,{duration:350,transition:Fx.Transitions.Sine.easeInOut,onComplete:function(){if(MUI.ieLegacySupport){this.drawWindow()}}.bind(this)});this.displayNewWindow();this.morph=new Fx.Morph(this.windowEl,{duration:200});this.windowEl.store("morph",this.morph);this.resizeMorph=new Fx.Elements([this.contentWrapperEl,this.windowEl],{duration:400,transition:Fx.Transitions.Sine.easeInOut,onStart:function(){this.resizeAnimation=this.drawWindow.periodical(20,this)}.bind(this),onComplete:function(){$clear(this.resizeAnimation);this.drawWindow();if(this.iframeEl){this.iframeEl.setStyle("visibility","visible")}}.bind(this)});this.windowEl.store("resizeMorph",this.resizeMorph);if($(this.windowEl.id+"LinkCheck")){this.check=new Element("div",{"class":"check",id:this.options.id+"_check"}).inject(this.windowEl.id+"LinkCheck")}if(this.options.closeAfter!=false){MUI.closeWindow.delay(this.options.closeAfter,this,this.windowEl)}if(MUI.Dock&&$(MUI.options.dock)&&this.options.type=="window"){MUI.Dock.createDockTab(this.windowEl)}},displayNewWindow:function(){options=this.options;if(options.type=="modal"||options.type=="modal2"){MUI.currentModal=this.windowEl;if(Browser.Engine.trident4){$("modalFix").show()}$("modalOverlay").show();if(MUI.options.advancedEffects==false){$("modalOverlay").setStyle("opacity",0.6);this.windowEl.setStyles({zIndex:11000,opacity:1})}else{MUI.Modal.modalOverlayCloseMorph.cancel();MUI.Modal.modalOverlayOpenMorph.start({opacity:0.6});this.windowEl.setStyles({zIndex:11000});this.opacityMorph.start({opacity:1})}$$(".dockTab").removeClass("activeDockTab");$$(".mocha").removeClass("isFocused");this.windowEl.addClass("isFocused")}else{if(MUI.options.advancedEffects==false){this.windowEl.setStyle("opacity",1);setTimeout(MUI.focusWindow.pass(this.windowEl,this),10)}else{if(MUI.ieLegacySupport){this.drawWindow(false)}this.opacityMorph.start({opacity:1});setTimeout(MUI.focusWindow.pass(this.windowEl,this),10)}}},setupEvents:function(){var a=this.windowEl;if(this.closeButtonEl){this.closeButtonEl.addEvent("click",function(b){new Event(b).stop();MUI.closeWindow(a)}.bind(this))}if(this.options.type=="window"){a.addEvent("mousedown",function(b){if(MUI.ieLegacySupport){new Event(b).stop()}MUI.focusWindow(a);if(a.getStyle("top").toInt()<-this.options.shadowBlur){a.setStyle("top",-this.options.shadowBlur)}}.bind(this))}if(this.minimizeButtonEl){this.minimizeButtonEl.addEvent("click",function(b){new Event(b).stop();MUI.Dock.minimizeWindow(a)}.bind(this))}if(this.maximizeButtonEl){this.maximizeButtonEl.addEvent("click",function(b){new Event(b).stop();if(this.isMaximized){MUI.Desktop.restoreWindow(a)}else{MUI.Desktop.maximizeWindow(a)}}.bind(this))}if(this.options.collapsible==true){this.titleEl.addEvent("selectstart",function(b){b=new Event(b).stop()}.bind(this));if(MUI.ieLegacySupport){this.titleBarEl.addEvent("mousedown",function(b){this.titleEl.setCapture()}.bind(this));this.titleBarEl.addEvent("mouseup",function(b){this.titleEl.releaseCapture()}.bind(this))}this.titleBarEl.addEvent("dblclick",function(b){b=new Event(b).stop();MUI.collapseToggle(this.windowEl)}.bind(this))}},attachDraggable:function(){var a=this.windowEl;if(!this.options.draggable){return}this.windowDrag=new Drag.Move(a,{handle:this.titleBarEl,container:this.options.restrict==true?$(this.options.container):false,grid:this.options.draggableGrid,limit:this.options.draggableLimit,snap:this.options.draggableSnap,onStart:function(){if(this.options.type!="modal"&&this.options.type!="modal2"){MUI.focusWindow(a);$("windowUnderlay").show()}if(this.iframeEl){if(!MUI.ieLegacySupport){this.iframeEl.setStyle("visibility","hidden")}else{this.iframeEl.hide()}}}.bind(this),onComplete:function(){if(this.options.type!="modal"&&this.options.type!="modal2"){$("windowUnderlay").hide()}if(this.iframeEl){if(!MUI.ieLegacySupport){this.iframeEl.setStyle("visibility","visible")}else{this.iframeEl.show()}}this.saveValues()}.bind(this)})},attachResizable:function(){var a=this.windowEl;if(!this.options.resizable){return}this.resizable1=this.windowEl.makeResizable({handle:[this.n,this.ne,this.nw],limit:{y:[function(){return this.windowEl.getStyle("top").toInt()+this.windowEl.getStyle("height").toInt()-this.options.resizeLimit.y[1]}.bind(this),function(){return this.windowEl.getStyle("top").toInt()+this.windowEl.getStyle("height").toInt()-this.options.resizeLimit.y[0]}.bind(this)]},modifiers:{x:false,y:"top"},onStart:function(){this.resizeOnStart();this.coords=this.contentWrapperEl.getCoordinates();this.y2=this.coords.top.toInt()+this.contentWrapperEl.offsetHeight}.bind(this),onDrag:function(){this.coords=this.contentWrapperEl.getCoordinates();this.contentWrapperEl.setStyle("height",this.y2-this.coords.top.toInt());this.resizeOnDrag()}.bind(this),onComplete:function(){this.resizeOnComplete()}.bind(this)});this.resizable2=this.contentWrapperEl.makeResizable({handle:[this.e,this.ne],limit:{x:[this.options.resizeLimit.x[0]-(this.options.shadowBlur*2),this.options.resizeLimit.x[1]-(this.options.shadowBlur*2)]},modifiers:{x:"width",y:false},onStart:function(){this.resizeOnStart()}.bind(this),onDrag:function(){this.resizeOnDrag()}.bind(this),onComplete:function(){this.resizeOnComplete()}.bind(this)});this.resizable3=this.contentWrapperEl.makeResizable({container:this.options.restrict==true?$(this.options.container):false,handle:this.se,limit:{x:[this.options.resizeLimit.x[0]-(this.options.shadowBlur*2),this.options.resizeLimit.x[1]-(this.options.shadowBlur*2)],y:[this.options.resizeLimit.y[0]-this.headerFooterShadow,this.options.resizeLimit.y[1]-this.headerFooterShadow]},modifiers:{x:"width",y:"height"},onStart:function(){this.resizeOnStart()}.bind(this),onDrag:function(){this.resizeOnDrag()}.bind(this),onComplete:function(){this.resizeOnComplete()}.bind(this)});this.resizable4=this.contentWrapperEl.makeResizable({handle:[this.s,this.sw],limit:{y:[this.options.resizeLimit.y[0]-this.headerFooterShadow,this.options.resizeLimit.y[1]-this.headerFooterShadow]},modifiers:{x:false,y:"height"},onStart:function(){this.resizeOnStart()}.bind(this),onDrag:function(){this.resizeOnDrag()}.bind(this),onComplete:function(){this.resizeOnComplete()}.bind(this)});this.resizable5=this.windowEl.makeResizable({handle:[this.w,this.sw,this.nw],limit:{x:[function(){return this.windowEl.getStyle("left").toInt()+this.windowEl.getStyle("width").toInt()-this.options.resizeLimit.x[1]}.bind(this),function(){return this.windowEl.getStyle("left").toInt()+this.windowEl.getStyle("width").toInt()-this.options.resizeLimit.x[0]}.bind(this)]},modifiers:{x:"left",y:false},onStart:function(){this.resizeOnStart();this.coords=this.contentWrapperEl.getCoordinates();this.x2=this.coords.left.toInt()+this.contentWrapperEl.offsetWidth}.bind(this),onDrag:function(){this.coords=this.contentWrapperEl.getCoordinates();this.contentWrapperEl.setStyle("width",this.x2-this.coords.left.toInt());this.resizeOnDrag()}.bind(this),onComplete:function(){this.resizeOnComplete()}.bind(this)})},resizeOnStart:function(){$("windowUnderlay").show();if(this.iframeEl){if(!MUI.ieLegacySupport){this.iframeEl.setStyle("visibility","hidden")}else{this.iframeEl.hide()}}},resizeOnDrag:function(){if(Browser.Engine.gecko){this.windowEl.getElements(".panel").each(function(a){a.store("oldOverflow",a.getStyle("overflow"));a.setStyle("overflow","visible")})}this.drawWindow();this.adjustHandles();if(Browser.Engine.gecko){this.windowEl.getElements(".panel").each(function(a){a.setStyle("overflow",a.retrieve("oldOverflow"))})}},resizeOnComplete:function(){$("windowUnderlay").hide();if(this.iframeEl){if(!MUI.ieLegacySupport){this.iframeEl.setStyle("visibility","visible")}else{this.iframeEl.show();this.iframeEl.setStyle("width","99%");this.iframeEl.setStyle("height",this.contentWrapperEl.offsetHeight);this.iframeEl.setStyle("width","100%");this.iframeEl.setStyle("height",this.contentWrapperEl.offsetHeight)}}if(this.contentWrapperEl.getChildren(".column")!=null){MUI.rWidth(this.contentWrapperEl);this.contentWrapperEl.getChildren(".column").each(function(a){MUI.panelHeight(a)})}this.fireEvent("onResize",this.windowEl)},adjustHandles:function(){var d=this.options.shadowBlur;var j=d*2;var k=this.options.shadowOffset;var e=d-k.y-1;var g=d+k.x-1;var a=d+k.y-1;var c=d-k.x-1;var f=this.windowEl.getCoordinates();var b=f.width-j+2;var h=f.height-j+2;this.n.setStyles({top:e,left:c+10,width:b-20});this.e.setStyles({top:e+10,right:g,height:h-30});this.s.setStyles({bottom:a,left:c+10,width:b-30});this.w.setStyles({top:e+10,left:c,height:h-20});this.ne.setStyles({top:e,right:g});this.se.setStyles({bottom:a,right:g});this.sw.setStyles({bottom:a,left:c});this.nw.setStyles({top:e,left:c})},detachResizable:function(){this.resizable1.detach();this.resizable2.detach();this.resizable3.detach();this.resizable4.detach();this.resizable5.detach();this.windowEl.getElements(".handle").hide()},reattachResizable:function(){this.resizable1.attach();this.resizable2.attach();this.resizable3.attach();this.resizable4.attach();this.resizable5.attach();this.windowEl.getElements(".handle").show()},insertWindowElements:function(){var d=this.options;var a=d.height;var e=d.width;var f=d.id;var b={};if(Browser.Engine.trident4){b.zIndexFixEl=new Element("iframe",{id:f+"_zIndexFix","class":"zIndexFix",scrolling:"no",marginWidth:0,marginHeight:0,src:"",styles:{position:"absolute"}}).inject(this.windowEl)}b.overlayEl=new Element("div",{id:f+"_overlay","class":"mochaOverlay",styles:{position:"absolute",top:0,left:0}}).inject(this.windowEl);b.titleBarEl=new Element("div",{id:f+"_titleBar","class":"mochaTitlebar",styles:{cursor:d.draggable?"move":"default"}}).inject(b.overlayEl,"top");b.titleEl=new Element("h3",{id:f+"_title","class":"mochaTitle"}).inject(b.titleBarEl);if(d.icon!=false){b.titleEl.setStyles({"padding-left":28,background:"url("+d.icon+") 5px 4px no-repeat"})}b.contentBorderEl=new Element("div",{id:f+"_contentBorder","class":"mochaContentBorder"}).inject(b.overlayEl);if(d.toolbar){b.toolbarWrapperEl=new Element("div",{id:f+"_toolbarWrapper","class":"mochaToolbarWrapper",styles:{height:d.toolbarHeight}}).inject(b.contentBorderEl,d.toolbarPosition=="bottom"?"after":"before");if(d.toolbarPosition=="bottom"){b.toolbarWrapperEl.addClass("bottom")}b.toolbarEl=new Element("div",{id:f+"_toolbar","class":"mochaToolbar",styles:{height:d.toolbarHeight}}).inject(b.toolbarWrapperEl)}if(d.toolbar2){b.toolbar2WrapperEl=new Element("div",{id:f+"_toolbar2Wrapper","class":"mochaToolbarWrapper",styles:{height:d.toolbar2Height}}).inject(b.contentBorderEl,d.toolbar2Position=="bottom"?"after":"before");if(d.toolbar2Position=="bottom"){b.toolbar2WrapperEl.addClass("bottom")}b.toolbar2El=new Element("div",{id:f+"_toolbar2","class":"mochaToolbar",styles:{height:d.toolbar2Height}}).inject(b.toolbar2WrapperEl)}b.contentWrapperEl=new Element("div",{id:f+"_contentWrapper","class":"mochaContentWrapper",styles:{width:e+"px",height:a+"px"}}).inject(b.contentBorderEl);if(this.options.shape=="gauge"){b.contentBorderEl.setStyle("borderWidth",0)}b.contentEl=new Element("div",{id:f+"_content","class":"mochaContent"}).inject(b.contentWrapperEl);if(this.options.useCanvas==true&&!MUI.ieLegacySupport){b.canvasEl=new Element("canvas",{id:f+"_canvas","class":"mochaCanvas",width:10,height:10}).inject(this.windowEl)}if(this.options.useCanvas==true&&MUI.ieLegacySupport){b.canvasEl=new Element("canvas",{id:f+"_canvas","class":"mochaCanvas",width:50000,height:20000,styles:{position:"absolute",top:0,left:0}}).inject(this.windowEl);if(MUI.ieLegacySupport&&MUI.ieSupport=="excanvas"){G_vmlCanvasManager.initElement(b.canvasEl);b.canvasEl=this.windowEl.getElement(".mochaCanvas")}}b.controlsEl=new Element("div",{id:f+"_controls","class":"mochaControls"}).inject(b.overlayEl,"after");if(d.useCanvasControls==true){b.canvasControlsEl=new Element("canvas",{id:f+"_canvasControls","class":"mochaCanvasControls",width:14,height:14}).inject(this.windowEl);if(MUI.ieLegacySupport&&MUI.ieSupport=="excanvas"){G_vmlCanvasManager.initElement(b.canvasControlsEl);b.canvasControlsEl=this.windowEl.getElement(".mochaCanvasControls")}}if(d.closable){b.closeButtonEl=new Element("div",{id:f+"_closeButton","class":"mochaCloseButton mochaWindowButton",title:"Close"}).inject(b.controlsEl)}if(d.maximizable){b.maximizeButtonEl=new Element("div",{id:f+"_maximizeButton","class":"mochaMaximizeButton mochaWindowButton",title:"Maximize"}).inject(b.controlsEl)}if(d.minimizable){b.minimizeButtonEl=new Element("div",{id:f+"_minimizeButton","class":"mochaMinimizeButton mochaWindowButton",title:"Minimize"}).inject(b.controlsEl)}if(d.useSpinner==true&&d.shape!="gauge"&&d.type!="notification"){b.spinnerEl=new Element("div",{id:f+"_spinner","class":"mochaSpinner",width:16,height:16}).inject(this.windowEl,"bottom")}if(this.options.shape=="gauge"){b.canvasHeaderEl=new Element("canvas",{id:f+"_canvasHeader","class":"mochaCanvasHeader",width:this.options.width,height:26}).inject(this.windowEl,"bottom");if(MUI.ieLegacySupport&&MUI.ieSupport=="excanvas"){G_vmlCanvasManager.initElement(b.canvasHeaderEl);b.canvasHeaderEl=this.windowEl.getElement(".mochaCanvasHeader")}}if(MUI.ieLegacySupport){b.overlayEl.setStyle("zIndex",2)}if(Browser.Platform.mac&&Browser.Engine.gecko){if(/Firefox[\/\s](\d+\.\d+)/.test(navigator.userAgent)){var c=new Number(RegExp.$1);if(c<3){b.overlayEl.setStyle("overflow","auto")}}}if(d.resizable){b.n=new Element("div",{id:f+"_resizeHandle_n","class":"handle",styles:{top:0,left:10,cursor:"n-resize"}}).inject(b.overlayEl,"after");b.ne=new Element("div",{id:f+"_resizeHandle_ne","class":"handle corner",styles:{top:0,right:0,cursor:"ne-resize"}}).inject(b.overlayEl,"after");b.e=new Element("div",{id:f+"_resizeHandle_e","class":"handle",styles:{top:10,right:0,cursor:"e-resize"}}).inject(b.overlayEl,"after");b.se=new Element("div",{id:f+"_resizeHandle_se","class":"handle cornerSE",styles:{bottom:0,right:0,cursor:"se-resize"}}).inject(b.overlayEl,"after");b.s=new Element("div",{id:f+"_resizeHandle_s","class":"handle",styles:{bottom:0,left:10,cursor:"s-resize"}}).inject(b.overlayEl,"after");b.sw=new Element("div",{id:f+"_resizeHandle_sw","class":"handle corner",styles:{bottom:0,left:0,cursor:"sw-resize"}}).inject(b.overlayEl,"after");b.w=new Element("div",{id:f+"_resizeHandle_w","class":"handle",styles:{top:10,left:0,cursor:"w-resize"}}).inject(b.overlayEl,"after");b.nw=new Element("div",{id:f+"_resizeHandle_nw","class":"handle corner",styles:{top:0,left:0,cursor:"nw-resize"}}).inject(b.overlayEl,"after")}$extend(this,b)},setColors:function(){if(this.options.useCanvas==true){var c=/\?(.*?)\)/;if(this.titleBarEl.getStyle("backgroundImage")!="none"){var d=this.titleBarEl.getStyle("backgroundImage");d=d.match(c)[1];d=d.parseQueryString();var a=d.from;var b=d.to.replace(/\"/,"");this.options.headerStartColor=new Color(a);this.options.headerStopColor=new Color(b);this.titleBarEl.addClass("replaced")}else{if(this.titleBarEl.getStyle("background-color")!==""&&this.titleBarEl.getStyle("background-color")!=="transparent"){this.options.headerStartColor=new Color(this.titleBarEl.getStyle("background-color")).mix("#fff",20);this.options.headerStopColor=new Color(this.titleBarEl.getStyle("background-color")).mix("#000",20);this.titleBarEl.addClass("replaced")}}if(this.windowEl.getStyle("background-color")!==""&&this.windowEl.getStyle("background-color")!=="transparent"){this.options.bodyBgColor=new Color(this.windowEl.getStyle("background-color"));this.windowEl.addClass("replaced")}if(this.options.resizable&&this.se.getStyle("background-color")!==""&&this.se.getStyle("background-color")!=="transparent"){this.options.resizableColor=new Color(this.se.getStyle("background-color"));this.se.addClass("replaced")}}if(this.options.useCanvasControls==true){if(this.minimizeButtonEl){if(this.minimizeButtonEl.getStyle("color")!==""&&this.minimizeButtonEl.getStyle("color")!=="transparent"){this.options.minimizeColor=new Color(this.minimizeButtonEl.getStyle("color"))}if(this.minimizeButtonEl.getStyle("background-color")!==""&&this.minimizeButtonEl.getStyle("background-color")!=="transparent"){this.options.minimizeBgColor=new Color(this.minimizeButtonEl.getStyle("background-color"));this.minimizeButtonEl.addClass("replaced")}}if(this.maximizeButtonEl){if(this.maximizeButtonEl.getStyle("color")!==""&&this.maximizeButtonEl.getStyle("color")!=="transparent"){this.options.maximizeColor=new Color(this.maximizeButtonEl.getStyle("color"))}if(this.maximizeButtonEl.getStyle("background-color")!==""&&this.maximizeButtonEl.getStyle("background-color")!=="transparent"){this.options.maximizeBgColor=new Color(this.maximizeButtonEl.getStyle("background-color"));this.maximizeButtonEl.addClass("replaced")}}if(this.closeButtonEl){if(this.closeButtonEl.getStyle("color")!==""&&this.closeButtonEl.getStyle("color")!=="transparent"){this.options.closeColor=new Color(this.closeButtonEl.getStyle("color"))}if(this.closeButtonEl.getStyle("background-color")!==""&&this.closeButtonEl.getStyle("background-color")!=="transparent"){this.options.closeBgColor=new Color(this.closeButtonEl.getStyle("background-color"));this.closeButtonEl.addClass("replaced")}}}},drawWindow:function(b){if(this.drawingWindow==true){return}this.drawingWindow=true;if(this.isCollapsed){this.drawWindowCollapsed(b);return}var g=this.windowEl;var m=this.options;var c=m.shadowBlur;var j=c*2;var l=this.options.shadowOffset;this.overlayEl.setStyles({width:this.contentWrapperEl.offsetWidth});if(this.iframeEl){this.iframeEl.setStyle("height",this.contentWrapperEl.offsetHeight)}var d=this.contentBorderEl.getStyle("border-top").toInt()+this.contentBorderEl.getStyle("border-bottom").toInt();var f=this.toolbarWrapperEl?this.toolbarWrapperEl.getStyle("height").toInt()+this.toolbarWrapperEl.getStyle("border-top").toInt():0;var e=this.toolbar2WrapperEl?this.toolbar2WrapperEl.getStyle("height").toInt()+this.toolbar2WrapperEl.getStyle("border-top").toInt():0;this.headerFooterShadow=m.headerHeight+m.footerHeight+j;var h=this.contentWrapperEl.getStyle("height").toInt()+this.headerFooterShadow+f+e+d;var a=this.contentWrapperEl.getStyle("width").toInt()+j;this.windowEl.setStyles({height:h,width:a});this.overlayEl.setStyles({height:h,top:c-l.y,left:c-l.x});if(this.options.useCanvas==true){if(MUI.ieLegacySupport){this.canvasEl.height=20000;this.canvasEl.width=50000}this.canvasEl.height=h;this.canvasEl.width=a}if(Browser.Engine.trident4){this.zIndexFixEl.setStyles({width:a,height:h})}this.titleBarEl.setStyles({width:a-j,height:m.headerHeight});if(m.useSpinner==true&&m.shape!="gauge"&&m.type!="notification"){this.spinnerEl.setStyles({left:c-l.x+3,bottom:c+l.y+4})}if(this.options.useCanvas!=false){var k=this.canvasEl.getContext("2d");k.clearRect(0,0,a,h);switch(m.shape){case"box":this.drawBox(k,a,h,c,l,b);break;case"gauge":this.drawGauge(k,a,h,c,l,b);break}if(m.resizable){MUI.triangle(k,a-(c+l.x+17),h-(c+l.y+18),11,11,m.resizableColor,1)}if(MUI.ieLegacySupport){MUI.triangle(k,0,0,10,10,m.resizableColor,0)}}if(m.type!="notification"&&m.useCanvasControls==true){this.drawControls(a,h,b)}if(MUI.Desktop&&this.contentWrapperEl.getChildren(".column").length!=0){MUI.rWidth(this.contentWrapperEl);this.contentWrapperEl.getChildren(".column").each(function(n){MUI.panelHeight(n)})}this.drawingWindow=false;return this},drawWindowCollapsed:function(b){var e=this.windowEl;var k=this.options;var c=k.shadowBlur;var f=c*2;var j=k.shadowOffset;var d=k.headerHeight+f+2;var g=d;var a=this.contentWrapperEl.getStyle("width").toInt()+f;this.windowEl.setStyle("height",g);this.overlayEl.setStyles({height:g,top:c-j.y,left:c-j.x});if(Browser.Engine.trident4){this.zIndexFixEl.setStyles({width:a,height:g})}this.windowEl.setStyle("width",a);this.overlayEl.setStyle("width",a);this.titleBarEl.setStyles({width:a-f,height:k.headerHeight});if(this.options.useCanvas!=false){this.canvasEl.height=g;this.canvasEl.width=a;var h=this.canvasEl.getContext("2d");h.clearRect(0,0,a,g);this.drawBoxCollapsed(h,a,g,c,j,b);if(k.useCanvasControls==true){this.drawControls(a,g,b)}if(MUI.ieLegacySupport){MUI.triangle(h,0,0,10,10,k.resizableColor,0)}}this.drawingWindow=false;return this},drawControls:function(g,e,h){var f=this.options;var d=f.shadowBlur;var c=f.shadowOffset;var b=f.controlsOffset;this.controlsEl.setStyles({right:d+c.x+b.right,top:d-c.y+b.top});this.canvasControlsEl.setStyles({right:d+c.x+b.right,top:d-c.y+b.top});this.closebuttonX=f.closable?this.mochaControlsWidth-7:this.mochaControlsWidth+12;this.maximizebuttonX=this.closebuttonX-(f.maximizable?19:0);this.minimizebuttonX=this.maximizebuttonX-(f.minimizable?19:0);var a=this.canvasControlsEl.getContext("2d");a.clearRect(0,0,100,100);if(this.options.closable){this.closebutton(a,this.closebuttonX,7,f.closeBgColor,1,f.closeColor,1)}if(this.options.maximizable){this.maximizebutton(a,this.maximizebuttonX,7,f.maximizeBgColor,1,f.maximizeColor,1)}if(this.options.minimizable){this.minimizebutton(a,this.minimizebuttonX,7,f.minimizeBgColor,1,f.minimizeColor,1)}if(MUI.ieLegacySupport){MUI.circle(a,0,0,3,this.options.resizableColor,0)}},drawBox:function(h,a,g,c,j,b){var k=this.options;var f=c*2;var d=this.options.cornerRadius;if(b!=false){for(var e=0;e<=c;e++){MUI.roundedRect(h,j.x+e,j.y+e,a-(e*2)-j.x,g-(e*2)-j.y,d+(c-e),[0,0,0],e==c?0.29:0.065+(e*0.01))}}this.bodyRoundedRect(h,c-j.x,c-j.y,a-f,g-f,d,k.bodyBgColor);if(this.options.type!="notification"){this.topRoundedRect(h,c-j.x,c-j.y,a-f,k.headerHeight,d,k.headerStartColor,k.headerStopColor)}},drawBoxCollapsed:function(h,a,g,c,j,b){var k=this.options;var f=c*2;var d=k.cornerRadius;if(b!=false){for(var e=0;e<=c;e++){MUI.roundedRect(h,j.x+e,j.y+e,a-(e*2)-j.x,g-(e*2)-j.y,d+(c-e),[0,0,0],e==c?0.3:0.06+(e*0.01))}}this.topRoundedRect2(h,c-j.x,c-j.y,a-f,k.headerHeight+2,d,k.headerStartColor,k.headerStopColor)},drawGauge:function(g,a,f,c,h,b){var j=this.options;var d=(a*0.5)-(c)+16;if(b!=false){for(var e=0;e<=c;e++){MUI.circle(g,a*0.5+h.x,(f+j.headerHeight)*0.5+h.x,(a*0.5)-(e*2)-h.x,[0,0,0],e==c?0.75:0.075+(e*0.04))}}MUI.circle(g,a*0.5-h.x,(f+j.headerHeight)*0.5-h.y,(a*0.5)-c,j.bodyBgColor,1);this.canvasHeaderEl.setStyles({top:c-h.y,left:c-h.x});var g=this.canvasHeaderEl.getContext("2d");g.clearRect(0,0,a,100);g.beginPath();g.lineWidth=24;g.lineCap="round";g.moveTo(13,13);g.lineTo(a-(c*2)-13,13);g.strokeStyle="rgba(0, 0, 0, .65)";g.stroke()},bodyRoundedRect:function(d,c,g,f,b,a,e){d.fillStyle="rgba("+e.join(",")+", 1)";d.beginPath();d.moveTo(c,g+a);d.lineTo(c,g+b-a);d.quadraticCurveTo(c,g+b,c+a,g+b);d.lineTo(c+f-a,g+b);d.quadraticCurveTo(c+f,g+b,c+f,g+b-a);d.lineTo(c+f,g+a);d.quadraticCurveTo(c+f,g,c+f-a,g);d.lineTo(c+a,g);d.quadraticCurveTo(c,g,c,g+a);d.fill()},topRoundedRect:function(j,g,f,a,h,e,c,d){var b=j.createLinearGradient(0,0,0,h);b.addColorStop(0,"rgb("+c.join(",")+")");b.addColorStop(1,"rgb("+d.join(",")+")");j.fillStyle=b;j.beginPath();j.moveTo(g,f);j.lineTo(g,f+h);j.lineTo(g+a,f+h);j.lineTo(g+a,f+e);j.quadraticCurveTo(g+a,f,g+a-e,f);j.lineTo(g+e,f);j.quadraticCurveTo(g,f,g,f+e);j.fill()},topRoundedRect2:function(j,g,f,a,h,e,c,d){if(navigator.userAgent.toLowerCase().indexOf("chrome")>-1){j.fillStyle="rgba("+d.join(",")+", 1)"}else{var b=j.createLinearGradient(0,this.options.shadowBlur-1,0,h+this.options.shadowBlur+3);b.addColorStop(0,"rgb("+c.join(",")+")");b.addColorStop(1,"rgb("+d.join(",")+")");j.fillStyle=b}j.beginPath();j.moveTo(g,f+e);j.lineTo(g,f+h-e);j.quadraticCurveTo(g,f+h,g+e,f+h);j.lineTo(g+a-e,f+h);j.quadraticCurveTo(g+a,f+h,g+a,f+h-e);j.lineTo(g+a,f+e);j.quadraticCurveTo(g+a,f,g+a-e,f);j.lineTo(g+e,f);j.quadraticCurveTo(g,f,g,f+e);j.fill()},maximizebutton:function(e,c,h,b,g,f,d){e.beginPath();e.arc(c,h,7,0,Math.PI*2,true);e.fillStyle="rgba("+b.join(",")+","+g+")";e.fill();e.strokeStyle="rgba("+f.join(",")+","+d+")";e.lineWidth=2;e.beginPath();e.moveTo(c,h-3.5);e.lineTo(c,h+3.5);e.moveTo(c-3.5,h);e.lineTo(c+3.5,h);e.stroke()},closebutton:function(e,c,h,b,g,f,d){e.beginPath();e.arc(c,h,7,0,Math.PI*2,true);e.fillStyle="rgba("+b.join(",")+","+g+")";e.fill();e.strokeStyle="rgba("+f.join(",")+","+d+")";e.lineWidth=2;e.beginPath();e.moveTo(c-3,h-3);e.lineTo(c+3,h+3);e.moveTo(c+3,h-3);e.lineTo(c-3,h+3);e.stroke()},minimizebutton:function(e,c,h,b,g,f,d){e.beginPath();e.arc(c,h,7,0,Math.PI*2,true);e.fillStyle="rgba("+b.join(",")+","+g+")";e.fill();e.strokeStyle="rgba("+f.join(",")+","+d+")";e.lineWidth=2;e.beginPath();e.moveTo(c-3.5,h);e.lineTo(c+3.5,h);e.stroke()},setMochaControlsWidth:function(){this.mochaControlsWidth=0;var a=this.options;if(a.minimizable){this.mochaControlsWidth+=(this.minimizeButtonEl.getStyle("margin-left").toInt()+this.minimizeButtonEl.getStyle("width").toInt())}if(a.maximizable){this.mochaControlsWidth+=(this.maximizeButtonEl.getStyle("margin-left").toInt()+this.maximizeButtonEl.getStyle("width").toInt())}if(a.closable){this.mochaControlsWidth+=(this.closeButtonEl.getStyle("margin-left").toInt()+this.closeButtonEl.getStyle("width").toInt())}this.controlsEl.setStyle("width",this.mochaControlsWidth);if(a.useCanvasControls==true){this.canvasControlsEl.setProperty("width",this.mochaControlsWidth)}},hideSpinner:function(){if(this.spinnerEl){this.spinnerEl.hide()}return this},showSpinner:function(){if(this.spinnerEl){this.spinnerEl.show()}return this},close:function(){if(!this.isClosing){MUI.closeWindow(this.windowEl)}return this},minimize:function(){MUI.Dock.minimizeWindow(this.windowEl);return this},maximize:function(){if(this.isMinimized){MUI.Dock.restoreMinimized(this.windowEl)}MUI.Desktop.maximizeWindow(this.windowEl);return this},restore:function(){if(this.isMinimized){MUI.Dock.restoreMinimized(this.windowEl)}else{if(this.isMaximized){MUI.Desktop.restoreWindow(this.windowEl)}}return this},resize:function(a){MUI.resizeWindow(this.windowEl,a);return this},center:function(){MUI.centerWindow(this.windowEl);return this},hide:function(){this.windowEl.setStyle("display","none");return this},show:function(){this.windowEl.setStyle("display","block");return this}});MUI.extend({closeWindow:function(c){var a=c.retrieve("instance");if(c!=$(c)||a.isClosing){return}a.isClosing=true;a.fireEvent("onClose",c);if(a.options.storeOnClose){this.storeOnClose(a,c);return}if(a.check){a.check.destroy()}if((a.options.type=="modal"||a.options.type=="modal2")&&Browser.Engine.trident4){$("modalFix").hide()}if(MUI.options.advancedEffects==false){if(a.options.type=="modal"||a.options.type=="modal2"){$("modalOverlay").setStyle("opacity",0)}MUI.closingJobs(c);return true}else{if(MUI.ieLegacySupport){a.drawWindow(false)}if(a.options.type=="modal"||a.options.type=="modal2"){MUI.Modal.modalOverlayCloseMorph.start({opacity:0})}var b=new Fx.Morph(c,{duration:120,onComplete:function(){MUI.closingJobs(c);return true}.bind(this)});b.start({opacity:0.4})}},closingJobs:function(e){var d=MUI.Windows.instances;var a=d.get(e.id);e.setStyle("visibility","hidden");if(MUI.ieLegacySupport){e.dispose()}else{e.destroy()}a.fireEvent("onCloseComplete");if(a.options.type!="notification"){var c=this.getWindowWithHighestZindex();this.focusWindow(c)}d.erase(a.options.id);if(this.loadingWorkspace==true){this.windowUnload()}if(MUI.Dock&&$(MUI.options.dock)&&a.options.type=="window"){var b=$(a.options.id+"_dockTab");if(b!=null){MUI.Dock.dockSortables.removeItems(b).destroy()}MUI.Desktop.setDesktopSize()}},storeOnClose:function(a,d){if(a.check){a.check.hide()}d.setStyles({zIndex:-1});d.addClass("windowClosed");d.removeClass("mocha");if(MUI.Dock&&$(MUI.options.dock)&&a.options.type=="window"){var c=$(a.options.id+"_dockTab");if(c!=null){c.hide()}MUI.Desktop.setDesktopSize()}a.fireEvent("onCloseComplete");if(a.options.type!="notification"){var b=this.getWindowWithHighestZindex();this.focusWindow(b)}a.isClosing=false},closeAll:function(){$$(".mocha").each(function(a){this.closeWindow(a)}.bind(this))},collapseToggle:function(c){var a=c.retrieve("instance");var b=c.getElements(".handle");if(a.isMaximized==true){return}if(a.isCollapsed==false){a.isCollapsed=true;b.hide();if(a.iframeEl){a.iframeEl.setStyle("visibility","hidden")}a.contentBorderEl.setStyles({visibility:"hidden",position:"absolute",top:-10000,left:-10000});if(a.toolbarWrapperEl){a.toolbarWrapperEl.setStyles({visibility:"hidden",position:"absolute",top:-10000,left:-10000})}a.drawWindowCollapsed()}else{a.isCollapsed=false;a.drawWindow();a.contentBorderEl.setStyles({visibility:"visible",position:null,top:null,left:null});if(a.toolbarWrapperEl){a.toolbarWrapperEl.setStyles({visibility:"visible",position:null,top:null,left:null})}if(a.iframeEl){a.iframeEl.setStyle("visibility","visible")}b.show()}},toggleWindowVisibility:function(){MUI.Windows.instances.each(function(a){if(a.options.type=="modal"||a.options.type=="modal2"||a.isMinimized==true){return}var b=$(a.options.id);if(b.getStyle("visibility")=="visible"){if(a.iframe){a.iframeEl.setStyle("visibility","hidden")}if(a.toolbarEl){a.toolbarWrapperEl.setStyle("visibility","hidden")}a.contentBorderEl.setStyle("visibility","hidden");b.setStyle("visibility","hidden");MUI.Windows.windowsVisible=false}else{b.setStyle("visibility","visible");a.contentBorderEl.setStyle("visibility","visible");if(a.iframe){a.iframeEl.setStyle("visibility","visible")}if(a.toolbarEl){a.toolbarWrapperEl.setStyle("visibility","visible")}MUI.Windows.windowsVisible=true}}.bind(this))},focusWindow:function(e,c){MUI.Windows.focusingWindow=true;var b=function(){MUI.Windows.focusingWindow=false};b.delay(170,this);if($$(".mocha").length==0){return}if(e!=$(e)||e.hasClass("isFocused")){return}var d=MUI.Windows.instances;var a=d.get(e.id);if(a.options.type=="notification"){e.setStyle("zIndex",11001);return}MUI.Windows.indexLevel+=2;e.setStyle("zIndex",MUI.Windows.indexLevel);$("windowUnderlay").setStyle("zIndex",MUI.Windows.indexLevel-1).inject($(e),"after");d.each(function(f){if(f.windowEl.hasClass("isFocused")){f.fireEvent("onBlur",f.windowEl)}f.windowEl.removeClass("isFocused")});if(MUI.Dock&&$(MUI.options.dock)&&a.options.type=="window"){MUI.Dock.makeActiveTab()}e.addClass("isFocused");if(c!=false){a.fireEvent("onFocus",e)}},getWindowWithHighestZindex:function(){this.highestZindex=0;$$(".mocha").each(function(a){this.zIndex=a.getStyle("zIndex");if(this.zIndex>=this.highestZindex){this.highestZindex=this.zIndex}}.bind(this));$$(".mocha").each(function(a){if(a.getStyle("zIndex")==this.highestZindex){this.windowWithHighestZindex=a}}.bind(this));return this.windowWithHighestZindex},blurAll:function(){if(MUI.Windows.focusingWindow==false){$$(".mocha").each(function(b){var a=b.retrieve("instance");if(a.options.type!="modal"&&a.options.type!="modal2"){b.removeClass("isFocused")}});$$(".dockTab").removeClass("activeDockTab")}},centerWindow:function(f){if(!f){MUI.Windows.instances.each(function(g){if(g.windowEl.hasClass("isFocused")){f=g.windowEl}})}var a=f.retrieve("instance");var b=a.options;var d=b.container.getCoordinates();var c=window.getScroll().y+(window.getSize().y*0.5)-(f.offsetHeight*0.5);if(c<-a.options.shadowBlur){c=-a.options.shadowBlur}var e=(d.width*0.5)-(f.offsetWidth*0.5);if(e<-a.options.shadowBlur){e=-a.options.shadowBlur}if(MUI.options.advancedEffects==true){a.morph.start({top:c,left:e})}else{f.setStyles({top:c,left:e})}},resizeWindow:function(f,j){var g=f.retrieve("instance");$extend({width:null,height:null,top:null,left:null,centered:true},j);var c=f.getStyle("width").toInt();var h=f.getStyle("height").toInt();var d=f.getStyle("top").toInt();var b=f.getStyle("left").toInt();if(j.centered){var e=j.top||d-((j.height-h)*0.5);var a=j.left||b-((j.width-c)*0.5)}else{var e=j.top||d;var a=j.left||b}if(MUI.options.advancedEffects==false){f.setStyles({top:e,left:a});g.contentWrapperEl.setStyles({height:j.height,width:j.width});g.drawWindow();if(g.iframeEl){if(!MUI.ieLegacySupport){g.iframeEl.setStyle("visibility","visible")}else{g.iframeEl.show()}}}else{f.retrieve("resizeMorph").start({"0":{height:j.height,width:j.width},"1":{top:e,left:a}})}return g},dynamicResize:function(d){var a=d.retrieve("instance");var c=a.contentWrapperEl;var b=a.contentEl;c.setStyles({height:b.offsetHeight,width:b.offsetWidth});a.drawWindow()}});document.addEvent("keydown",function(a){if(a.key=="q"&&a.control&&a.alt){MUI.toggleWindowVisibility()}});MUI.files[MUI.path.source+"Window/Modal.js"]="loaded";MUI.Modal=new Class({Extends:MUI.Window,options:{type:"modal"},initialize:function(a){if(!$("modalOverlay")){this.modalInitialize();window.addEvent("resize",function(){this.setModalSize()}.bind(this))}this.parent(a)},modalInitialize:function(){var a=new Element("div",{id:"modalOverlay",styles:{height:document.getCoordinates().height,opacity:0.6}}).inject(document.body);a.setStyles({position:Browser.Engine.trident4?"absolute":"fixed"});a.addEvent("click",function(d){var c=MUI.Windows.instances.get(MUI.currentModal.id);if(c.options.modalOverlayClose==true){MUI.closeWindow(MUI.currentModal)}});if(Browser.Engine.trident4){var b=new Element("iframe",{id:"modalFix",scrolling:"no",marginWidth:0,marginHeight:0,src:"",styles:{height:document.getCoordinates().height}}).inject(document.body)}MUI.Modal.modalOverlayOpenMorph=new Fx.Morph($("modalOverlay"),{duration:150});MUI.Modal.modalOverlayCloseMorph=new Fx.Morph($("modalOverlay"),{duration:150,onComplete:function(){$("modalOverlay").hide();if(Browser.Engine.trident4){$("modalFix").hide()}}.bind(this)})},setModalSize:function(){$("modalOverlay").setStyle("height",document.getCoordinates().height);if(Browser.Engine.trident4){$("modalFix").setStyle("height",document.getCoordinates().height)}}});MUI.files[MUI.path.source+"Window/Windows-from-html.js"]="loaded";MUI.extend({NewWindowsFromHTML:function(){$$(".mocha").each(function(b){if(Browser.Engine.presto||Browser.Engine.trident5){b.hide()}var d=b.getElement("h3.mochaTitle");if(Browser.Engine.presto){b.show()}var c=b.getStyles("height","width");var a={id:b.getProperty("id"),height:c.height.toInt(),width:c.width.toInt(),x:b.getStyle("left").toInt(),y:b.getStyle("top").toInt()};if(d){a.title=d.innerHTML;d.destroy()}a.content=b.innerHTML;b.destroy();new MUI.Window(a,true)}.bind(this))}});MUI.files[MUI.path.source+"Window/Windows-from-json.js"]="loaded";MUI.extend({newWindowsFromJSON:function(newWindows){newWindows.each(function(options){var temp=new Hash(options);temp.each(function(value,key,hash){if($type(value)!="string"){return}if(value.substring(0,8)=="function"){eval("options."+key+" = "+value)}});new MUI.Window(options)})}});MUI.files[MUI.path.source+"Window/Arrange-cascade.js"]="loaded";MUI.extend({arrangeCascade:function(){var g=30;var a=20;var k=50;var c=40;var j=document.getCoordinates();var d=0;MUI.Windows.instances.each(function(l){if(!l.isMinimized&&l.options.draggable){d++}});if((k*(d+1))>=(j.height-g)){var e=(j.height-g)/(d+1)}else{var e=k}if((c*(d+1))>=(j.width-a-20)){var b=(j.width-a-20)/(d+1)}else{var b=c}var h=a;var f=g;$$(".mocha").each(function(n){var l=n.retrieve("instance");if(!l.isMinimized&&!l.isMaximized&&l.options.draggable){id=n.id;MUI.focusWindow(n);h+=b;f+=e;if(MUI.options.advancedEffects==false){n.setStyles({top:f,left:h})}else{var m=new Fx.Morph(n,{duration:550});m.start({top:f,left:h})}}}.bind(this))}});MUI.files[MUI.path.source+"Window/Arrange-tile.js"]="loaded";MUI.extend({arrangeTile:function(){var g=30;var b=20;var j=10;var f=80;var a=MUI.Windows.instances;var l=0;a.each(function(o){if(!o.isMinimized&&!o.isMaximized){l++}});var h=3;var n=Math.ceil(l/h);var k=document.getCoordinates();var e=((k.width-b)/h);var d=((k.height-g)/n);var m=0;var c=0;a.each(function(x){if(!x.isMinimized&&!x.isMaximized&&x.options.draggable){var t=x.contentWrapperEl;var o=t.getCoordinates();var w=x.windowEl.getCoordinates();var s=o.top-w.top;var v=w.height-o.height-s;var r=o.left-w.left;var y=w.width-o.width-r;var p=(j+(c*e));var u=(f+(m*d));x.drawWindow();MUI.focusWindow(x.windowEl);if(MUI.options.advancedEffects==false){x.windowEl.setStyles({top:u,left:p})}else{var q=new Fx.Morph(x.windowEl,{duration:550});q.start({top:u,left:p})}if(++c===h){m++;c=0}}}.bind(this))}});MUI.files[MUI.path.source+"Components/Tabs.js"]="loaded";MUI.extend({initializeTabs:function(a){$(a).setStyle("list-style","none");$(a).getElements("li").addEvent("click",function(b){MUI.selected(this,a)})},selected:function(b,a){$(a).getChildren().each(function(c){c.removeClass("selected")});b.addClass("selected")}});MUI.files[MUI.path.source+"Layout/Layout.js"]="loaded";MUI.extend({Columns:{instances:new Hash(),columnIDCount:0},Panels:{instances:new Hash(),panelIDCount:0}});MUI.Desktop={options:{desktop:"desktop",desktopHeader:"desktopHeader",desktopFooter:"desktopFooter",desktopNavBar:"desktopNavbar",pageWrapper:"pageWrapper",page:"page",desktopFooter:"desktopFooterWrapper"},initialize:function(){this.desktop=$(this.options.desktop);this.desktopHeader=$(this.options.desktopHeader);this.desktopNavBar=$(this.options.desktopNavBar);this.pageWrapper=$(this.options.pageWrapper);this.page=$(this.options.page);this.desktopFooter=$(this.options.desktopFooter);if(this.desktop){($$("body")).setStyles({overflow:"hidden",height:"100%",margin:0});($$("html")).setStyles({overflow:"hidden",height:"100%"})}if(!MUI.Dock){this.setDesktopSize()}this.menuInitialize();window.addEvent("resize",function(a){this.onBrowserResize()}.bind(this));if(MUI.myChain){MUI.myChain.callChain()}},menuInitialize:function(){if(Browser.Engine.trident4&&this.desktopNavBar){this.desktopNavBar.getElements("li").each(function(a){a.addEvent("mouseenter",function(){this.addClass("ieHover")});a.addEvent("mouseleave",function(){this.removeClass("ieHover")})})}},onBrowserResize:function(){this.setDesktopSize();setTimeout(function(){MUI.Windows.instances.each(function(a){if(a.isMaximized){if(a.iframeEl){a.iframeEl.setStyle("visibility","hidden")}var d=document.getCoordinates();var b=a.contentBorderEl.getStyle("border-top").toInt()+a.contentBorderEl.getStyle("border-bottom").toInt();var c=a.toolbarWrapperEl?a.toolbarWrapperEl.getStyle("height").toInt()+a.toolbarWrapperEl.getStyle("border-top").toInt():0;a.contentWrapperEl.setStyles({height:d.height-a.options.headerHeight-a.options.footerHeight-b-c,width:d.width});a.drawWindow();if(a.iframeEl){a.iframeEl.setStyles({height:a.contentWrapperEl.getStyle("height")});a.iframeEl.setStyle("visibility","visible")}}}.bind(this))}.bind(this),100)},setDesktopSize:function(){var d=window.getCoordinates();var b=$(MUI.options.dockWrapper);if(this.desktop){this.desktop.setStyle("height",d.height)}if(this.pageWrapper){var a=MUI.dockVisible?b.offsetHeight:0;var c=d.height;c-=this.pageWrapper.getStyle("border-top").toInt();c-=this.pageWrapper.getStyle("border-bottom").toInt();if(this.desktopHeader){c-=this.desktopHeader.offsetHeight}if(this.desktopFooter){c-=this.desktopFooter.offsetHeight}c-=a;if(c<0){c=0}this.pageWrapper.setStyle("height",c)}if(MUI.Columns.instances.getKeys().length>0){MUI.Desktop.resizePanels()}},resizePanels:function(){MUI.panelHeight();MUI.rWidth()},maximizeWindow:function(f){var g=MUI.Windows.instances.get(f.id);var j=g.options;var c=g.windowDrag;if(f!=$(f)||g.isMaximized){return}if(g.isCollapsed){MUI.collapseToggle(f)}g.isMaximized=true;if(g.options.restrict){c.detach();if(j.resizable){g.detachResizable()}g.titleBarEl.setStyle("cursor","default")}if(j.container!=this.desktop){this.desktop.grab(f);if(this.options.restrict){c.container=this.desktop}}g.oldTop=f.getStyle("top");g.oldLeft=f.getStyle("left");var d=g.contentWrapperEl;d.oldWidth=d.getStyle("width");d.oldHeight=d.getStyle("height");if(g.iframeEl){if(!MUI.ieLegacySupport){g.iframeEl.setStyle("visibility","hidden")}else{g.iframeEl.hide()}}var b=document.getCoordinates();var j=g.options;var e=j.shadowBlur;var h=j.shadowOffset;var a=b.height-j.headerHeight-j.footerHeight;a-=g.contentBorderEl.getStyle("border-top").toInt();a-=g.contentBorderEl.getStyle("border-bottom").toInt();a-=(g.toolbarWrapperEl?g.toolbarWrapperEl.getStyle("height").toInt()+g.toolbarWrapperEl.getStyle("border-top").toInt():0);MUI.resizeWindow(f,{width:b.width,height:a,top:h.y-e,left:h.x-e});g.fireEvent("onMaximize",f);if(g.maximizeButtonEl){g.maximizeButtonEl.setProperty("title","Restore")}MUI.focusWindow(f)},restoreWindow:function(d){var a=d.retrieve("instance");if(d!=$(d)||!a.isMaximized){return}var b=a.options;a.isMaximized=false;if(b.restrict){a.windowDrag.attach();if(b.resizable){a.reattachResizable()}a.titleBarEl.setStyle("cursor","move")}if(a.iframeEl){if(!MUI.ieLegacySupport){a.iframeEl.setStyle("visibility","hidden")}else{a.iframeEl.hide()}}var c=a.contentWrapperEl;MUI.resizeWindow(d,{width:c.oldWidth,height:c.oldHeight,top:a.oldTop,left:a.oldLeft});a.fireEvent("onRestore",d);if(a.maximizeButtonEl){a.maximizeButtonEl.setProperty("title","Maximize")}}};MUI.Column=new Class({Implements:[Events,Options],options:{id:null,container:null,placement:null,width:null,resizeLimit:[],sortable:true,onResize:$empty,onCollapse:$empty,onExpand:$empty},initialize:function(b){this.setOptions(b);$extend(this,{timestamp:$time(),isCollapsed:false,oldWidth:0});if(this.options.id==null){this.options.id="column"+(++MUI.Columns.columnIDCount)}var b=this.options;var g=MUI.Columns.instances;var d=g.get(b.id);if(b.container==null){b.container=MUI.Desktop.pageWrapper}else{$(b.container).setStyle("overflow","hidden")}if(typeof this.options.container=="string"){this.options.container=$(this.options.container)}if(d){var a=d}if(this.columnEl){return}else{g.set(b.id,this)}if($(b.container).getElement(".pad")!=null){$(b.container).getElement(".pad").hide()}if($(b.container).getElement(".mochaContent")!=null){$(b.container).getElement(".mochaContent").hide()}this.columnEl=new Element("div",{id:this.options.id,"class":"column expanded",styles:{width:b.placement=="main"?null:b.width}}).inject($(b.container));this.columnEl.store("instance",this);var c=this.columnEl.getParent();var f=c.getStyle("height").toInt();this.columnEl.setStyle("height",f);if(this.options.sortable){if(!this.options.container.retrieve("sortables")){var e=new Sortables(this.columnEl,{opacity:1,handle:".panel-header",constrain:false,revert:false,onSort:function(){$$(".column").each(function(h){h.getChildren(".panelWrapper").each(function(j){j.getElement(".panel").removeClass("bottomPanel")});if(h.getChildren(".panelWrapper").getLast()){h.getChildren(".panelWrapper").getLast().getElement(".panel").addClass("bottomPanel")}MUI.panelHeight()}.bind(this))}.bind(this)});this.options.container.store("sortables",e)}else{this.options.container.retrieve("sortables").addLists(this.columnEl)}}if(b.placement=="main"){this.columnEl.addClass("rWidth")}switch(this.options.placement){case"left":this.handleEl=new Element("div",{id:this.options.id+"_handle","class":"columnHandle"}).inject(this.columnEl,"after");this.handleIconEl=new Element("div",{id:b.id+"_handle_icon","class":"handleIcon"}).inject(this.handleEl);addResizeRight(this.columnEl,b.resizeLimit[0],b.resizeLimit[1]);break;case"right":this.handleEl=new Element("div",{id:this.options.id+"_handle","class":"columnHandle"}).inject(this.columnEl,"before");this.handleIconEl=new Element("div",{id:b.id+"_handle_icon","class":"handleIcon"}).inject(this.handleEl);addResizeLeft(this.columnEl,b.resizeLimit[0],b.resizeLimit[1]);break}if(this.handleEl!=null){this.handleEl.addEvent("dblclick",function(){this.columnToggle()}.bind(this))}MUI.rWidth()},columnToggle:function(){var a=this.columnEl;if(this.isCollapsed==false){this.oldWidth=a.getStyle("width").toInt();this.resize.detach();this.handleEl.removeEvents("dblclick");this.handleEl.addEvent("click",function(){this.columnToggle()}.bind(this));this.handleEl.setStyle("cursor","pointer").addClass("detached");a.setStyle("width",0);this.isCollapsed=true;a.addClass("collapsed");a.removeClass("expanded");MUI.rWidth();this.fireEvent("onCollapse")}else{a.setStyle("width",this.oldWidth);this.isCollapsed=false;a.addClass("expanded");a.removeClass("collapsed");this.handleEl.removeEvents("click");this.handleEl.addEvent("dblclick",function(){this.columnToggle()}.bind(this));this.resize.attach();this.handleEl.setStyle("cursor",Browser.Engine.webkit?"col-resize":"e-resize").addClass("attached");MUI.rWidth();this.fireEvent("onExpand")}}});MUI.Column.implement(new Options,new Events);MUI.Panel=new Class({Implements:[Events,Options],options:{id:null,title:"New Panel",column:null,require:{css:[],images:[],js:[],onload:null},loadMethod:null,contentURL:null,method:"get",data:null,evalScripts:true,evalResponse:false,content:"Panel content",tabsURL:null,tabsData:null,tabsOnload:$empty,header:true,headerToolbox:false,headerToolboxURL:"pages/lipsum.html",headerToolboxOnload:$empty,height:125,addClass:"",scrollbars:true,padding:{top:8,right:8,bottom:8,left:8},collapsible:true,onBeforeBuild:$empty,onContentLoaded:$empty,onResize:$empty,onCollapse:$empty,onExpand:$empty},initialize:function(b){this.setOptions(b);$extend(this,{timestamp:$time(),isCollapsed:false,oldHeight:0,partner:null});if(this.options.id==null){this.options.id="panel"+(++MUI.Panels.panelIDCount)}var f=MUI.Panels.instances;var c=f.get(this.options.id);var b=this.options;if(c){var a=c}if(this.panelEl){return}else{f.set(this.options.id,this)}this.fireEvent("onBeforeBuild");if(b.loadMethod=="iframe"){b.padding={top:0,right:0,bottom:0,left:0}}this.showHandle=true;if($(b.column).getChildren().length==0){this.showHandle=false}this.panelWrapperEl=new Element("div",{id:this.options.id+"_wrapper","class":"panelWrapper expanded"}).inject($(b.column));this.panelEl=new Element("div",{id:this.options.id,"class":"panel expanded",styles:{height:b.height}}).inject(this.panelWrapperEl);this.panelEl.store("instance",this);this.panelEl.addClass(b.addClass);this.contentEl=new Element("div",{id:b.id+"_pad","class":"pad"}).inject(this.panelEl);this.contentWrapperEl=this.panelEl;this.contentEl.setStyles({"padding-top":b.padding.top,"padding-bottom":b.padding.bottom,"padding-left":b.padding.left,"padding-right":b.padding.right});this.panelHeaderEl=new Element("div",{id:this.options.id+"_header","class":"panel-header",styles:{display:b.header?"block":"none"}}).inject(this.panelEl,"before");var d=MUI.Columns.instances;var e=d.get(this.options.column);if(e.options.sortable){this.panelHeaderEl.setStyle("cursor","move");e.options.container.retrieve("sortables").addItems(this.panelWrapperEl)}if(this.options.collapsible){this.collapseToggleInit()}if(this.options.headerToolbox){this.panelHeaderToolboxEl=new Element("div",{id:b.id+"_headerToolbox","class":"panel-header-toolbox"}).inject(this.panelHeaderEl)}this.panelHeaderContentEl=new Element("div",{id:b.id+"_headerContent","class":"panel-headerContent"}).inject(this.panelHeaderEl);this.titleEl=new Element("h2",{id:b.id+"_title"}).inject(this.panelHeaderContentEl);this.handleEl=new Element("div",{id:b.id+"_handle","class":"horizontalHandle",styles:{display:this.showHandle==true?"block":"none"}}).inject(this.panelEl,"after");this.handleIconEl=new Element("div",{id:b.id+"_handle_icon","class":"handleIcon"}).inject(this.handleEl);addResizeBottom(b.id);if(b.require.css.length||b.require.images.length){new MUI.Require({css:b.require.css,images:b.require.images,onload:function(){this.newPanel()}.bind(this)})}else{this.newPanel()}},newPanel:function(){options=this.options;if(this.options.headerToolbox){MUI.updateContent({element:this.panelEl,childElement:this.panelHeaderToolboxEl,loadMethod:"xhr",url:options.headerToolboxURL,onContentLoaded:options.headerToolboxOnload})}if(options.tabsURL==null){this.titleEl.set("html",options.title)}else{this.panelHeaderContentEl.addClass("tabs");MUI.updateContent({element:this.panelEl,childElement:this.panelHeaderContentEl,loadMethod:"xhr",url:options.tabsURL,data:options.tabsData,onContentLoaded:options.tabsOnload})}MUI.updateContent({element:this.panelEl,content:options.content,method:options.method,data:options.data,url:options.contentURL,onContentLoaded:null,require:{js:options.require.js,onload:options.require.onload}});$(options.column).getChildren(".panelWrapper").each(function(a){a.getElement(".panel").removeClass("bottomPanel")});$(options.column).getChildren(".panelWrapper").getLast().getElement(".panel").addClass("bottomPanel");MUI.panelHeight(options.column,this.panelEl,"new")},collapseToggleInit:function(a){var a=this.options;this.panelHeaderCollapseBoxEl=new Element("div",{id:a.id+"_headerCollapseBox","class":"toolbox"}).inject(this.panelHeaderEl);if(a.headerToolbox){this.panelHeaderCollapseBoxEl.addClass("divider")}this.collapseToggleEl=new Element("div",{id:a.id+"_collapseToggle","class":"panel-collapse icon16",styles:{width:16,height:16},title:"Collapse Panel"}).inject(this.panelHeaderCollapseBoxEl);this.collapseToggleEl.addEvent("click",function(f){var b=this.panelEl;var c=this.panelWrapperEl;var g=MUI.Panels.instances;var e=[];c.getAllPrevious(".panelWrapper").each(function(j){var h=g.get(j.getElement(".panel").id);if(h.isCollapsed==false){e.push(j.getElement(".panel").id)}});c.getAllNext(".panelWrapper").each(function(j){var h=g.get(j.getElement(".panel").id);if(h.isCollapsed==false){e.push(j.getElement(".panel").id)}});if(this.isCollapsed==false){var d=MUI.Columns.instances.get($(a.column).id);if(e.length==0&&d.options.placement!="main"){var d=MUI.Columns.instances.get($(a.column).id);d.columnToggle();return}else{if(e.length==0&&d.options.placement=="main"){return}}this.oldHeight=b.getStyle("height").toInt();if(this.oldHeight<10){this.oldHeight=20}this.contentEl.setStyle("position","absolute");b.setStyle("height",0);this.isCollapsed=true;c.addClass("collapsed");c.removeClass("expanded");MUI.panelHeight(a.column,b,"collapsing");MUI.panelHeight();this.collapseToggleEl.removeClass("panel-collapsed");this.collapseToggleEl.addClass("panel-expand");this.collapseToggleEl.setProperty("title","Expand Panel");this.fireEvent("onCollapse")}else{this.contentEl.setStyle("position",null);b.setStyle("height",this.oldHeight);this.isCollapsed=false;c.addClass("expanded");c.removeClass("collapsed");MUI.panelHeight(this.options.column,b,"expanding");MUI.panelHeight();this.collapseToggleEl.removeClass("panel-expand");this.collapseToggleEl.addClass("panel-collapsed");this.collapseToggleEl.setProperty("title","Collapse Panel");this.fireEvent("onExpand")}}.bind(this))}});MUI.Panel.implement(new Options,new Events);MUI.extend({panelHeight:function(a,c,b){if(a!=null){MUI.panelHeight2($(a),c,b)}else{$$(".column").each(function(d){MUI.panelHeight2(d)}.bind(this))}},panelHeight2:function(e,m,f){var b=MUI.Panels.instances;var j=e.getParent();var h=j.getStyle("height").toInt();if(Browser.Engine.trident4&&j==MUI.Desktop.pageWrapper){h-=1}e.setStyle("height",h);var g=[];e.getChildren(".panelWrapper").each(function(n){g.push(n.getElement(".panel"))}.bind(this));var k=[];e.getChildren(".expanded").each(function(n){k.push(n.getElement(".panel"))}.bind(this));var c=[];var d;var a=0;this.panelsTotalHeight=0;this.height=0;g.each(function(n){instance=b.get(n.id);if(n.getParent().hasClass("expanded")&&n.getParent().getNext(".expanded")){instance.partner=n.getParent().getNext(".expanded").getElement(".panel");instance.resize.attach();instance.handleEl.setStyles({display:"block",cursor:Browser.Engine.webkit?"row-resize":"n-resize"}).removeClass("detached")}else{instance.resize.detach();instance.handleEl.setStyles({display:"none",cursor:null}).addClass("detached")}if(n.getParent().getNext(".panelWrapper")==null){instance.handleEl.hide()}}.bind(this));e.getChildren().each(function(n){n.getChildren().each(function(p){if(p.hasClass("panel")){var o=b.get(p.id);anyNextSiblingsExpanded=function(q){var r;q.getParent().getAllNext(".panelWrapper").each(function(s){var t=b.get(s.getElement(".panel").id);if(t.isCollapsed==false){r=true}}.bind(this));return r}.bind(this);anyExpandingNextSiblingsExpanded=function(q){var r;m.getParent().getAllNext(".panelWrapper").each(function(s){var t=b.get(s.getElement(".panel").id);if(t.isCollapsed==false){r=true}}.bind(this));return r}.bind(this);anyNextContainsChanging=function(r){var q=[];r.getParent().getAllNext(".panelWrapper").each(function(t){q.push(t.getElement(".panel"))}.bind(this));var s=q.contains(m);return s}.bind(this);nextExpandedChanging=function(q){var r;if(q.getParent().getNext(".expanded")){if(q.getParent().getNext(".expanded").getElement(".panel")==m){r=true}}return r};if(f=="new"){if(!o.isCollapsed&&p!=m){c.push(p);this.panelsTotalHeight+=p.offsetHeight.toInt()}}else{if(f==null||f=="collapsing"){if(!o.isCollapsed&&(!anyNextContainsChanging(p)||!anyNextSiblingsExpanded(p))){c.push(p);this.panelsTotalHeight+=p.offsetHeight.toInt()}}else{if(f=="expanding"&&!o.isCollapsed&&p!=m){if(!anyNextContainsChanging(p)||(!anyExpandingNextSiblingsExpanded(p)&&nextExpandedChanging(p))){c.push(p);this.panelsTotalHeight+=p.offsetHeight.toInt()}}}}if(p.style.height){this.height+=p.getStyle("height").toInt()}}else{this.height+=p.offsetHeight.toInt()}}.bind(this))}.bind(this));var l=e.offsetHeight.toInt()-this.height;this.height=0;e.getChildren().each(function(n){this.height+=n.offsetHeight.toInt()}.bind(this));var l=e.offsetHeight.toInt()-this.height;c.each(function(n){var p=this.panelsTotalHeight/n.offsetHeight.toInt();var o=n.getStyle("height").toInt()+(l/p);if(o<1){o=0}n.setStyle("height",o)}.bind(this));this.height=0;e.getChildren().each(function(n){n.getChildren().each(function(o){this.height+=o.offsetHeight.toInt();if(o.hasClass("panel")&&o.getStyle("height").toInt()>a){d=o;a=o.getStyle("height").toInt()}}.bind(this))}.bind(this));var l=e.offsetHeight.toInt()-this.height;if(l!=0&&a>0){d.setStyle("height",d.getStyle("height").toInt()+l);if(d.getStyle("height")<1){d.setStyle("height",0)}}j.getChildren(".columnHandle").each(function(p){var o=p.getParent();if(o.getStyle("height").toInt()<1){return}var n=o.getStyle("height").toInt()-p.getStyle("border-top").toInt()-p.getStyle("border-bottom").toInt();if(Browser.Engine.trident4&&o==MUI.Desktop.pageWrapper){n-=1}p.setStyle("height",n)});k.each(function(n){MUI.resizeChildren(n)}.bind(this))},resizeChildren:function(b){var d=MUI.Panels.instances;var a=d.get(b.id);var c=a.contentWrapperEl;if(a.iframeEl){if(!MUI.ieLegacySupport){a.iframeEl.setStyles({height:c.getStyle("height"),width:c.offsetWidth-c.getStyle("border-left").toInt()-c.getStyle("border-right").toInt()})}else{a.iframeEl.setStyles({height:c.getStyle("height"),width:c.offsetWidth-c.getStyle("border-left").toInt()-c.getStyle("border-right").toInt()-1});a.iframeEl.setStyles({width:c.offsetWidth-c.getStyle("border-left").toInt()-c.getStyle("border-right").toInt()})}}},rWidth:function(a){if(a==null){var a=MUI.Desktop.desktop}a.getElements(".rWidth").each(function(e){var b=e.offsetWidth.toInt();b-=e.getStyle("border-left").toInt();b-=e.getStyle("border-right").toInt();var d=e.getParent();this.width=0;d.getChildren().each(function(g){if(g.hasClass("mocha")!=true){this.width+=g.offsetWidth.toInt()}}.bind(this));var c=d.offsetWidth.toInt()-this.width;var f=b+c;if(f<1){f=0}e.setStyle("width",f);e.getChildren(".panel").each(function(g){g.setStyle("width",f-g.getStyle("border-left").toInt()-g.getStyle("border-right").toInt());MUI.resizeChildren(g)}.bind(this))})}});function addResizeRight(d,c,b){if(!$(d)){return}d=$(d);var f=MUI.Columns.instances;var a=f.get(d.id);var e=d.getNext(".columnHandle");e.setStyle("cursor",Browser.Engine.webkit?"col-resize":"e-resize");if(!c){c=50}if(!b){b=250}if(MUI.ieLegacySupport){e.addEvents({mousedown:function(){e.setCapture()},mouseup:function(){e.releaseCapture()}})}a.resize=d.makeResizable({handle:e,modifiers:{x:"width",y:false},limit:{x:[c,b]},onStart:function(){d.getElements("iframe").setStyle("visibility","hidden");d.getNext(".column").getElements("iframe").setStyle("visibility","hidden")}.bind(this),onDrag:function(){if(Browser.Engine.gecko){$$(".panel").each(function(g){if(g.getElements(".mochaIframe").length==0){g.hide()}})}MUI.rWidth(d.getParent());if(Browser.Engine.gecko){$$(".panel").show()}if(Browser.Engine.trident4){d.getChildren().each(function(h){var g=$(d).getStyle("width").toInt();g-=h.getStyle("border-right").toInt();g-=h.getStyle("border-left").toInt();g-=h.getStyle("padding-right").toInt();g-=h.getStyle("padding-left").toInt();h.setStyle("width",g)}.bind(this))}}.bind(this),onComplete:function(){MUI.rWidth(d.getParent());d.getElements("iframe").setStyle("visibility","visible");d.getNext(".column").getElements("iframe").setStyle("visibility","visible");a.fireEvent("onResize")}.bind(this)})}function addResizeLeft(d,c,b){if(!$(d)){return}d=$(d);var g=MUI.Columns.instances;var a=g.get(d.id);var f=d.getPrevious(".columnHandle");f.setStyle("cursor",Browser.Engine.webkit?"col-resize":"e-resize");var e=d.getPrevious(".column");if(!c){c=50}if(!b){b=250}if(MUI.ieLegacySupport){f.addEvents({mousedown:function(){f.setCapture()},mouseup:function(){f.releaseCapture()}})}a.resize=d.makeResizable({handle:f,modifiers:{x:"width",y:false},invert:true,limit:{x:[c,b]},onStart:function(){$(d).getElements("iframe").setStyle("visibility","hidden");e.getElements("iframe").setStyle("visibility","hidden")}.bind(this),onDrag:function(){MUI.rWidth(d.getParent())}.bind(this),onComplete:function(){MUI.rWidth(d.getParent());$(d).getElements("iframe").setStyle("visibility","visible");e.getElements("iframe").setStyle("visibility","visible");a.fireEvent("onResize")}.bind(this)})}function addResizeBottom(b){if(!$(b)){return}var b=$(b);var d=MUI.Panels.instances;var a=d.get(b.id);var c=a.handleEl;c.setStyle("cursor",Browser.Engine.webkit?"row-resize":"n-resize");partner=a.partner;min=0;max=function(){return b.getStyle("height").toInt()+partner.getStyle("height").toInt()}.bind(this);if(MUI.ieLegacySupport){c.addEvents({mousedown:function(){c.setCapture()},mouseup:function(){c.releaseCapture()}})}a.resize=b.makeResizable({handle:c,modifiers:{x:false,y:"height"},limit:{y:[min,max]},invert:false,onBeforeStart:function(){partner=a.partner;this.originalHeight=b.getStyle("height").toInt();this.partnerOriginalHeight=partner.getStyle("height").toInt()}.bind(this),onStart:function(){if(a.iframeEl){if(!MUI.ieLegacySupport){a.iframeEl.setStyle("visibility","hidden");partner.getElements("iframe").setStyle("visibility","hidden")}else{a.iframeEl.hide();partner.getElements("iframe").hide()}}}.bind(this),onDrag:function(){partnerHeight=partnerOriginalHeight;partnerHeight+=(this.originalHeight-b.getStyle("height").toInt());partner.setStyle("height",partnerHeight);MUI.resizeChildren(b,b.getStyle("height").toInt());MUI.resizeChildren(partner,partnerHeight);b.getChildren(".column").each(function(e){MUI.panelHeight(e)});partner.getChildren(".column").each(function(e){MUI.panelHeight(e)})}.bind(this),onComplete:function(){partnerHeight=partnerOriginalHeight;partnerHeight+=(this.originalHeight-b.getStyle("height").toInt());partner.setStyle("height",partnerHeight);MUI.resizeChildren(b,b.getStyle("height").toInt());MUI.resizeChildren(partner,partnerHeight);b.getChildren(".column").each(function(f){MUI.panelHeight(f)});partner.getChildren(".column").each(function(f){MUI.panelHeight(f)});if(a.iframeEl){if(!MUI.ieLegacySupport){a.iframeEl.setStyle("visibility","visible");partner.getElements("iframe").setStyle("visibility","visible")}else{a.iframeEl.show();partner.getElements("iframe").show();var e=a.iframeEl.getStyle("width").toInt();a.iframeEl.setStyle("width",e-1);MUI.rWidth();a.iframeEl.setStyle("width",e)}}a.fireEvent("onResize")}.bind(this)})}MUI.extend({closeColumn:function(b){var d=MUI.Columns.instances;var a=d.get(b.id);if(b!=$(b)||a.isClosing){return}a.isClosing=true;if(a.options.sortable){a.container.retrieve("sortables").removeLists(this.columnEl)}var c=b.getChildren(".panel");c.each(function(e){MUI.closePanel($(e.id))}.bind(this));if(MUI.ieLegacySupport){b.dispose();if(a.handleEl!=null){a.handleEl.dispose()}}else{b.destroy();if(a.handleEl!=null){a.handleEl.destroy()}}if(MUI.Desktop){MUI.Desktop.resizePanels()}d.erase(a.options.id);return true},closePanel:function(f){var e=MUI.Panels.instances;var a=e.get(f.id);if(f!=$(f)||a.isClosing){return}var b=a.options.column;a.isClosing=true;var c=MUI.Columns.instances;var d=c.get(b);if(d.options.sortable){d.options.container.retrieve("sortables").removeItems(a.panelWrapperEl)}a.panelWrapperEl.destroy();if(MUI.Desktop){MUI.Desktop.resizePanels()}$(b).getChildren(".panelWrapper").each(function(g){g.getElement(".panel").removeClass("bottomPanel")});$(b).getChildren(".panelWrapper").getLast().getElement(".panel").addClass("bottomPanel");e.erase(a.options.id);return true}});MUI.files[MUI.path.source+"Layout/Dock.js"]="loaded";MUI.options.extend({dockWrapper:"dockWrapper",dock:"dock"});MUI.extend({minimizeAll:function(){$$(".mocha").each(function(b){var a=b.retrieve("instance");if(!a.isMinimized&&a.options.minimizable==true){MUI.Dock.minimizeWindow(b)}}.bind(this))}});MUI.Dock={options:{useControls:true,dockPosition:"bottom",trueButtonColor:[70,245,70],enabledButtonColor:[115,153,191],disabledButtonColor:[170,170,170]},initialize:function(a){if(!MUI.Desktop){return}MUI.dockVisible=true;this.dockWrapper=$(MUI.options.dockWrapper);this.dock=$(MUI.options.dock);this.autoHideEvent=null;this.dockAutoHide=false;if(!this.dockWrapper){return}if(!this.options.useControls){if($("dockPlacement")){$("dockPlacement").setStyle("cursor","default")}if($("dockAutoHide")){$("dockAutoHide").setStyle("cursor","default")}}this.dockWrapper.setStyles({display:"block",position:"absolute",top:null,bottom:MUI.Desktop.desktopFooter?MUI.Desktop.desktopFooter.offsetHeight:0,left:0});if(this.options.useControls){this.initializeDockControls()}if($("dockLinkCheck")){this.sidebarCheck=new Element("div",{"class":"check",id:"dock_check"}).inject($("dockLinkCheck"))}this.dockSortables=new Sortables("#dockSort",{opacity:1,constrain:true,clone:false,revert:false});MUI.Desktop.setDesktopSize();if(MUI.myChain){MUI.myChain.callChain()}},initializeDockControls:function(){this.setDockColors();if(this.options.useControls){var b=new Element("canvas",{id:"dockCanvas",width:"15",height:"18"}).inject(this.dock);if(MUI.ieLegacySupport&&MUI.ieSupport=="excanvas"){G_vmlCanvasManager.initElement(b)}}var a=$("dockPlacement");var c=$("dockAutoHide");a.setProperty("title","Position Dock Top");a.addEvent("click",function(){this.moveDock()}.bind(this));c.setProperty("title","Turn Auto Hide On");c.addEvent("click",function(e){if(this.dockWrapper.getProperty("dockPosition")=="top"){return false}var d=$("dockCanvas").getContext("2d");this.dockAutoHide=!this.dockAutoHide;if(this.dockAutoHide){$("dockAutoHide").setProperty("title","Turn Auto Hide Off");MUI.circle(d,5,14,3,this.options.trueButtonColor,1);this.autoHideEvent=function(g){if(!this.dockAutoHide){return}if(!MUI.Desktop.desktopFooter){var f=this.dockWrapper.offsetHeight;if(f<25){f=25}}else{if(MUI.Desktop.desktopFooter){var f=this.dockWrapper.offsetHeight+MUI.Desktop.desktopFooter.offsetHeight;if(f<25){f=25}}}if(!MUI.Desktop.desktopFooter&&g.client.y>(document.getCoordinates().height-f)){if(!MUI.dockVisible){this.dockWrapper.show();MUI.dockVisible=true;MUI.Desktop.setDesktopSize()}}else{if(MUI.Desktop.desktopFooter&&g.client.y>(document.getCoordinates().height-f)){if(!MUI.dockVisible){this.dockWrapper.show();MUI.dockVisible=true;MUI.Desktop.setDesktopSize()}}else{if(MUI.dockVisible){this.dockWrapper.hide();MUI.dockVisible=false;MUI.Desktop.setDesktopSize()}}}}.bind(this);document.addEvent("mousemove",this.autoHideEvent)}else{$("dockAutoHide").setProperty("title","Turn Auto Hide On");MUI.circle(d,5,14,3,this.options.enabledButtonColor,1);document.removeEvent("mousemove",this.autoHideEvent)}}.bind(this));this.renderDockControls();if(this.options.dockPosition=="top"){this.moveDock()}},setDockColors:function(){var c=MUI.getCSSRule(".dockButtonEnabled");if(c&&c.style.backgroundColor){this.options.enabledButtonColor=new Color(c.style.backgroundColor)}var a=MUI.getCSSRule(".dockButtonDisabled");if(a&&a.style.backgroundColor){this.options.disabledButtonColor=new Color(a.style.backgroundColor)}var b=MUI.getCSSRule(".dockButtonTrue");if(b&&b.style.backgroundColor){this.options.trueButtonColor=new Color(b.style.backgroundColor)}},renderDockControls:function(){var a=$("dockCanvas").getContext("2d");a.clearRect(0,0,100,100);MUI.circle(a,5,4,3,this.options.enabledButtonColor,1);if(this.dockWrapper.getProperty("dockPosition")=="top"){MUI.circle(a,5,14,3,this.options.disabledButtonColor,1)}else{if(this.dockAutoHide){MUI.circle(a,5,14,3,this.options.trueButtonColor,1)}else{MUI.circle(a,5,14,3,this.options.enabledButtonColor,1)}}},moveDock:function(){var a=$("dockCanvas").getContext("2d");if(this.dockWrapper.getStyle("position")!="relative"){this.dockWrapper.setStyles({position:"relative",bottom:null});this.dockWrapper.addClass("top");MUI.Desktop.setDesktopSize();this.dockWrapper.setProperty("dockPosition","top");a.clearRect(0,0,100,100);MUI.circle(a,5,4,3,this.options.enabledButtonColor,1);MUI.circle(a,5,14,3,this.options.disabledButtonColor,1);$("dockPlacement").setProperty("title","Position Dock Bottom");$("dockAutoHide").setProperty("title","Auto Hide Disabled in Top Dock Position");this.dockAutoHide=false}else{this.dockWrapper.setStyles({position:"absolute",bottom:MUI.Desktop.desktopFooter?MUI.Desktop.desktopFooter.offsetHeight:0});this.dockWrapper.removeClass("top");MUI.Desktop.setDesktopSize();this.dockWrapper.setProperty("dockPosition","bottom");a.clearRect(0,0,100,100);MUI.circle(a,5,4,3,this.options.enabledButtonColor,1);MUI.circle(a,5,14,3,this.options.enabledButtonColor,1);$("dockPlacement").setProperty("title","Position Dock Top");$("dockAutoHide").setProperty("title","Turn Auto Hide On")}},createDockTab:function(e){var a=e.retrieve("instance");var d=new Element("div",{id:a.options.id+"_dockTab","class":"dockTab",title:b}).inject($("dockClear"),"before");d.addEvent("mousedown",function(f){new Event(f).stop();this.timeDown=$time()});d.addEvent("mouseup",function(f){this.timeUp=$time();if((this.timeUp-this.timeDown)<275){if(MUI.Windows.windowsVisible==false){MUI.toggleWindowVisibility();if(a.isMinimized==true){MUI.Dock.restoreMinimized.delay(25,MUI.Dock,e)}else{MUI.focusWindow(e)}return}if(a.isMinimized==true){MUI.Dock.restoreMinimized.delay(25,MUI.Dock,e)}else{if(a.windowEl.hasClass("isFocused")&&a.options.minimizable==true){MUI.Dock.minimizeWindow(e)}else{MUI.focusWindow(e)}var g=document.getCoordinates();if(e.getStyle("left").toInt()>g.width||e.getStyle("top").toInt()>g.height){MUI.centerWindow(e)}}}});this.dockSortables.addItems(d);var b=a.titleEl.innerHTML;var c=new Element("div",{id:a.options.id+"_dockTabText","class":"dockText"}).set("html",b.substring(0,19)+(b.length>19?"...":"")).inject($(d));if(a.options.icon!=false){}MUI.Desktop.setDesktopSize()},makeActiveTab:function(){var c=MUI.getWindowWithHighestZindex();var a=c.retrieve("instance");$$(".dockTab").removeClass("activeDockTab");if(a.isMinimized!=true){a.windowEl.addClass("isFocused");var b=$(a.options.id+"_dockTab");if(b!=null){b.addClass("activeDockTab")}}else{a.windowEl.removeClass("isFocused")}},minimizeWindow:function(c){if(c!=$(c)){return}var a=c.retrieve("instance");a.isMinimized=true;if(a.iframeEl){if(!MUI.ieLegacySupport){a.iframeEl.setStyle("visibility","hidden")}else{a.iframeEl.hide()}}a.contentBorderEl.setStyle("visibility","hidden");if(a.toolbarWrapperEl){a.toolbarWrapperEl.hide()}c.setStyle("visibility","hidden");if(Browser.Platform.mac&&Browser.Engine.gecko){if(/Firefox[\/\s](\d+\.\d+)/.test(navigator.userAgent)){var b=new Number(RegExp.$1);if(b<3){a.contentWrapperEl.setStyle("overflow","hidden")}}}MUI.Desktop.setDesktopSize();setTimeout(function(){c.setStyle("zIndex",1);c.removeClass("isFocused");this.makeActiveTab()}.bind(this),100);a.fireEvent("onMinimize",c)},restoreMinimized:function(b){var a=b.retrieve("instance");if(a.isMinimized==false){return}if(MUI.Windows.windowsVisible==false){MUI.toggleWindowVisibility()}MUI.Desktop.setDesktopSize();if(a.options.scrollbars==true&&!a.iframeEl){a.contentWrapperEl.setStyle("overflow","auto")}if(a.isCollapsed){MUI.collapseToggle(b)}b.setStyle("visibility","visible");a.contentBorderEl.setStyle("visibility","visible");if(a.toolbarWrapperEl){a.toolbarWrapperEl.show()}if(a.iframeEl){if(!MUI.ieLegacySupport){a.iframeEl.setStyle("visibility","visible")}else{a.iframeEl.show()}}a.isMinimized=false;MUI.focusWindow(b);a.fireEvent("onRestore",b)}};MUI.files[MUI.path.source+"Layout/Workspaces.js"]="loaded";MUI.extend({saveWorkspace:function(){this.cookie=new Hash.Cookie("mochaUIworkspaceCookie",{duration:3600});this.cookie.empty();MUI.Windows.instances.each(function(a){a.saveValues();this.cookie.set(a.options.id,{id:a.options.id,top:a.options.y,left:a.options.x,width:a.contentWrapperEl.getStyle("width").toInt(),height:a.contentWrapperEl.getStyle("height").toInt()})}.bind(this));this.cookie.save();new MUI.Window({loadMethod:"html",type:"notification",addClass:"notification",content:"Workspace saved.",closeAfter:"1400",width:200,height:40,y:53,padding:{top:10,right:12,bottom:10,left:12},shadowBlur:5,bodyBgColor:[255,255,255]})},windowUnload:function(){if($$(".mocha").length==0&&this.myChain){this.myChain.callChain()}},loadWorkspace2:function(workspaceWindows){workspaceWindows.each(function(workspaceWindow){windowFunction=eval("MUI."+workspaceWindow.id+"Window");if(windowFunction){eval("MUI."+workspaceWindow.id+"Window({width:"+workspaceWindow.width+",height:"+workspaceWindow.height+"});");var windowEl=$(workspaceWindow.id);windowEl.setStyles({top:workspaceWindow.top,left:workspaceWindow.left});var instance=windowEl.retrieve("instance");instance.contentWrapperEl.setStyles({width:workspaceWindow.width,height:workspaceWindow.height});instance.drawWindow()}}.bind(this));this.loadingWorkspace=false},loadWorkspace:function(){cookie=new Hash.Cookie("mochaUIworkspaceCookie",{duration:3600});workspaceWindows=cookie.load();if(!cookie.getKeys().length){new MUI.Window({loadMethod:"html",type:"notification",addClass:"notification",content:"You have no saved workspace.",closeAfter:"1400",width:220,height:40,y:25,padding:{top:10,right:12,bottom:10,left:12},shadowBlur:5,bodyBgColor:[255,255,255]});return}if($$(".mocha").length!=0){this.loadingWorkspace=true;this.myChain=new Chain();this.myChain.chain(function(){$$(".mocha").each(function(a){this.closeWindow(a)}.bind(this))}.bind(this),function(){this.loadWorkspace2(workspaceWindows)}.bind(this));this.myChain.callChain()}else{this.loadWorkspace2(workspaceWindows)}}}); \ No newline at end of file diff --git a/src/webui/www/public/scripts/mocha.js b/src/webui/www/public/scripts/mocha.js index 1fbe3a0f1..87ecda00c 100644 --- a/src/webui/www/public/scripts/mocha.js +++ b/src/webui/www/public/scripts/mocha.js @@ -52,7 +52,9 @@ MUI.extend({ }, ieSupport: 'excanvas', // Makes it easier to switch between Excanvas and Moocanvas for testing - + + ieLegacySupport: Browser.Engine.trident && Browser.version < 9, + /* Function: updateContent @@ -533,7 +535,7 @@ Element.implement({ this.setStyle('position','relative'); position = 'relative'; } - if(Browser.Engine.trident){ + if(MUI.ieLegacySupport){ parent.setStyle('height',parent.getStyle('height')); } var coords = this.getPosition(parent); @@ -794,7 +796,7 @@ $extend(Asset, { script.addEvents({ load: load, readystatechange: function(){ - if (Browser.Engine.trident && ['loaded', 'complete'].contains(this.readyState)) + if (MUI.ieLegacySupport && ['loaded', 'complete'].contains(this.readyState)) load(); } }).setProperties(properties); @@ -1058,7 +1060,7 @@ MUI.Themes = { }); // Delay gives the stylesheets time to take effect. IE6 needs more delay. - if (Browser.Engine.trident){ + if (MUI.ieLegacySupport){ this.redraw.delay(1250, this); } else { @@ -1620,7 +1622,7 @@ MUI.Window = new Class({ } // Fix a mouseover issue with gauges in IE7 - if ( Browser.Engine.trident && options.shape == 'gauge') { + if ( MUI.ieLegacySupport && options.shape == 'gauge') { this.windowEl.setStyle('backgroundImage', 'url(../images/spacer.gif)'); } @@ -1793,7 +1795,7 @@ MUI.Window = new Class({ 'duration': 350, transition: Fx.Transitions.Sine.easeInOut, onComplete: function(){ - if (Browser.Engine.trident){ + if (MUI.ieLegacySupport){ this.drawWindow(); } }.bind(this) @@ -1883,7 +1885,7 @@ MUI.Window = new Class({ } else { // IE cannot handle both element opacity and VML alpha at the same time. - if (Browser.Engine.trident){ + if (MUI.ieLegacySupport){ this.drawWindow(false); } this.opacityMorph.start({ @@ -1906,7 +1908,7 @@ MUI.Window = new Class({ if (this.options.type == 'window'){ windowEl.addEvent('mousedown', function(e) { - if (Browser.Engine.trident) { + if (MUI.ieLegacySupport) { new Event(e).stop(); } MUI.focusWindow(windowEl); @@ -1940,7 +1942,7 @@ MUI.Window = new Class({ e = new Event(e).stop(); }.bind(this)); - if (Browser.Engine.trident) { + if (MUI.ieLegacySupport) { this.titleBarEl.addEvent('mousedown', function(e) { this.titleEl.setCapture(); }.bind(this)); @@ -1977,7 +1979,7 @@ MUI.Window = new Class({ $('windowUnderlay').show(); } if (this.iframeEl) { - if (!Browser.Engine.trident) { + if (!MUI.ieLegacySupport) { this.iframeEl.setStyle('visibility', 'hidden'); } else { @@ -1990,7 +1992,7 @@ MUI.Window = new Class({ $('windowUnderlay').hide(); } if ( this.iframeEl ){ - if (!Browser.Engine.trident) { + if (!MUI.ieLegacySupport) { this.iframeEl.setStyle('visibility', 'visible'); } else { @@ -2124,7 +2126,7 @@ MUI.Window = new Class({ resizeOnStart: function(){ $('windowUnderlay').show(); if (this.iframeEl){ - if (!Browser.Engine.trident) { + if (!MUI.ieLegacySupport) { this.iframeEl.setStyle('visibility', 'hidden'); } else { @@ -2151,7 +2153,7 @@ MUI.Window = new Class({ resizeOnComplete: function(){ $('windowUnderlay').hide(); if (this.iframeEl){ - if (!Browser.Engine.trident) { + if (!MUI.ieLegacySupport) { this.iframeEl.setStyle('visibility', 'visible'); } else { @@ -2360,7 +2362,7 @@ MUI.Window = new Class({ 'class': 'mochaContent' }).inject(cache.contentWrapperEl); - if (this.options.useCanvas == true && Browser.Engine.trident != true) { + if (this.options.useCanvas == true && !MUI.ieLegacySupport) { cache.canvasEl = new Element('canvas', { 'id': id + '_canvas', 'class': 'mochaCanvas', @@ -2369,7 +2371,7 @@ MUI.Window = new Class({ }).inject(this.windowEl); } - if (this.options.useCanvas == true && Browser.Engine.trident) { + if (this.options.useCanvas == true && MUI.ieLegacySupport) { cache.canvasEl = new Element('canvas', { 'id': id + '_canvas', 'class': 'mochaCanvas', @@ -2382,7 +2384,7 @@ MUI.Window = new Class({ } }).inject(this.windowEl); - if (MUI.ieSupport == 'excanvas'){ + if (MUI.ieLegacySupport && MUI.ieSupport == 'excanvas'){ G_vmlCanvasManager.initElement(cache.canvasEl); cache.canvasEl = this.windowEl.getElement('.mochaCanvas'); } @@ -2401,7 +2403,7 @@ MUI.Window = new Class({ 'height': 14 }).inject(this.windowEl); - if (Browser.Engine.trident && MUI.ieSupport == 'excanvas'){ + if (MUI.ieLegacySupport && MUI.ieSupport == 'excanvas'){ G_vmlCanvasManager.initElement(cache.canvasControlsEl); cache.canvasControlsEl = this.windowEl.getElement('.mochaCanvasControls'); } @@ -2448,13 +2450,13 @@ MUI.Window = new Class({ 'height': 26 }).inject(this.windowEl, 'bottom'); - if (Browser.Engine.trident && MUI.ieSupport == 'excanvas'){ + if (MUI.ieLegacySupport && MUI.ieSupport == 'excanvas'){ G_vmlCanvasManager.initElement(cache.canvasHeaderEl); cache.canvasHeaderEl = this.windowEl.getElement('.mochaCanvasHeader'); } } - if ( Browser.Engine.trident ){ + if ( MUI.ieLegacySupport ){ cache.overlayEl.setStyle('zIndex', 2); } @@ -2697,7 +2699,7 @@ MUI.Window = new Class({ }); if (this.options.useCanvas == true) { - if (Browser.Engine.trident) { + if (MUI.ieLegacySupport) { this.canvasEl.height = 20000; this.canvasEl.width = 50000; } @@ -2754,7 +2756,7 @@ MUI.Window = new Class({ } // Invisible dummy object. The last element drawn is not rendered consistently while resizing in IE6 and IE7 - if (Browser.Engine.trident){ + if (MUI.ieLegacySupport){ MUI.triangle(ctx, 0, 0, 10, 10, options.resizableColor, 0); } } @@ -2825,7 +2827,7 @@ MUI.Window = new Class({ } // Invisible dummy object. The last element drawn is not rendered consistently while resizing in IE6 and IE7 - if (Browser.Engine.trident){ + if (MUI.ieLegacySupport){ MUI.triangle(ctx, 0, 0, 10, 10, options.resizableColor, 0); } } @@ -2894,7 +2896,7 @@ MUI.Window = new Class({ ); } // Invisible dummy object. The last element drawn is not rendered consistently while resizing in IE6 and IE7 - if (Browser.Engine.trident){ + if (MUI.ieLegacySupport){ MUI.circle(ctx2, 0, 0, 3, this.options.resizableColor, 0); } @@ -3326,7 +3328,7 @@ MUI.extend({ } else { // Redraws IE windows without shadows since IE messes up canvas alpha when you change element opacity - if (Browser.Engine.trident) instance.drawWindow(false); + if (MUI.ieLegacySupport) instance.drawWindow(false); if (instance.options.type == 'modal' || instance.options.type == 'modal2'){ MUI.Modal.modalOverlayCloseMorph.start({ 'opacity': 0 @@ -3351,7 +3353,7 @@ MUI.extend({ var instance = instances.get(windowEl.id); windowEl.setStyle('visibility', 'hidden'); // Destroy throws an error in IE8 - if (Browser.Engine.trident) { + if (MUI.ieLegacySupport) { windowEl.dispose(); } else { @@ -3650,7 +3652,7 @@ MUI.extend({ instance.drawWindow(); // Show iframe if (instance.iframeEl){ - if (!Browser.Engine.trident) { + if (!MUI.ieLegacySupport) { instance.iframeEl.setStyle('visibility', 'visible'); } else { @@ -4377,7 +4379,7 @@ MUI.Desktop = { // Hide iframe // Iframe should be hidden when minimizing, maximizing, and moving for performance and Flash issues if ( instance.iframeEl ) { - if (!Browser.Engine.trident) { + if (!MUI.ieLegacySupport) { instance.iframeEl.setStyle('visibility', 'hidden'); } else { @@ -4440,7 +4442,7 @@ MUI.Desktop = { // Hide iframe // Iframe should be hidden when minimizing, maximizing, and moving for performance and Flash issues if ( instance.iframeEl ) { - if (!Browser.Engine.trident) { + if (!MUI.ieLegacySupport) { instance.iframeEl.setStyle('visibility', 'hidden'); } else { @@ -5307,7 +5309,7 @@ MUI.extend({ var contentWrapperEl = instance.contentWrapperEl; if (instance.iframeEl) { - if (!Browser.Engine.trident) { + if (!MUI.ieLegacySupport) { instance.iframeEl.setStyles({ 'height': contentWrapperEl.getStyle('height'), 'width': contentWrapperEl.offsetWidth - contentWrapperEl.getStyle('border-left').toInt() - contentWrapperEl.getStyle('border-right').toInt() @@ -5373,7 +5375,7 @@ function addResizeRight(element, min, max){ handle.setStyle('cursor', Browser.Engine.webkit ? 'col-resize' : 'e-resize'); if (!min) min = 50; if (!max) max = 250; - if (Browser.Engine.trident) { + if (MUI.ieLegacySupport) { handle.addEvents({ 'mousedown': function(){ handle.setCapture(); @@ -5440,7 +5442,7 @@ function addResizeLeft(element, min, max){ var partner = element.getPrevious('.column'); if (!min) min = 50; if (!max) max = 250; - if (Browser.Engine.trident){ + if (MUI.ieLegacySupport){ handle.addEvents({ 'mousedown': function(){ handle.setCapture(); @@ -5485,7 +5487,7 @@ function addResizeBottom(element){ return element.getStyle('height').toInt() + partner.getStyle('height').toInt(); }.bind(this); - if (Browser.Engine.trident) { + if (MUI.ieLegacySupport) { handle.addEvents({ 'mousedown': function(){ handle.setCapture(); @@ -5507,7 +5509,7 @@ function addResizeBottom(element){ }.bind(this), onStart: function(){ if (instance.iframeEl) { - if (!Browser.Engine.trident) { + if (!MUI.ieLegacySupport) { instance.iframeEl.setStyle('visibility', 'hidden'); partner.getElements('iframe').setStyle('visibility','hidden'); } @@ -5544,7 +5546,7 @@ function addResizeBottom(element){ MUI.panelHeight(column); }); if (instance.iframeEl) { - if (!Browser.Engine.trident) { + if (!MUI.ieLegacySupport) { instance.iframeEl.setStyle('visibility', 'visible'); partner.getElements('iframe').setStyle('visibility','visible'); } @@ -5600,7 +5602,7 @@ MUI.extend({ MUI.closePanel($(panel.id)); }.bind(this)); - if (Browser.Engine.trident) { + if (MUI.ieLegacySupport) { columnEl.dispose(); if (instance.handleEl != null) { instance.handleEl.dispose(); @@ -5795,7 +5797,7 @@ MUI.Dock = { }).inject(this.dock); // Dynamically initialize canvas using excanvas. This is only required by IE - if (Browser.Engine.trident && MUI.ieSupport == 'excanvas'){ + if (MUI.ieLegacySupport && MUI.ieSupport == 'excanvas'){ G_vmlCanvasManager.initElement(canvas); } } @@ -6053,7 +6055,7 @@ MUI.Dock = { // Iframe should be hidden when minimizing, maximizing, and moving for performance and Flash issues if ( instance.iframeEl ) { // Some elements are still visible in IE8 in the iframe when the iframe's visibility is set to hidden. - if (!Browser.Engine.trident) { + if (!MUI.ieLegacySupport) { instance.iframeEl.setStyle('visibility', 'hidden'); } else { @@ -6119,7 +6121,7 @@ MUI.Dock = { // Show iframe if (instance.iframeEl){ - if (!Browser.Engine.trident){ + if (!MUI.ieLegacySupport){ instance.iframeEl.setStyle('visibility', 'visible'); } else {