ClassFactory.createPackage("core.ui.quirks");ClassFactory.createClass(core.ui.quirks,"TextSelection");with(core.ui.quirks){core.ui.quirks.TextSelection.constructor=function(){};core.ui.quirks.TextSelection.preventSelection=function(A){if(defined(A.onselectstart)){A.onselectstart=new Function("return false")}else{if(defined(A.style.MozUserSelect)){A.style.MozUserSelect="none"}else{A.onmousedown=new Function("return false")}}};core.ui.quirks.TextSelection.allowSelection=function(A,B){if(false===B){this.preventSelection(A)}else{if(defined(A.onselectstart)){A.onselectstart=new Function("return true")}else{if(defined(A.style.MozUserSelect)){A.style.MozUserSelect="text"}else{A.onmousedown=new Function("return true")}}}}}ClassFactory.createPackage("core.ui");ClassFactory.createClass(core.ui,"Event");with(core.ui){core.ui.Event.constructor=function(){this.stopped=false;this.cancelled=false;this.Event=function(){if(!this.target){this.target=this.srcElement}};this.stop=function(){if(undefined!==this.stopPropagation){this.stopPropagation()}else{if(undefined!==this.cancelBubble){this.cancelBubble=true}}this.stopped=true};this.isStopped=function(){return this.stopped};this.cancel=function(){if(undefined!==this.preventDefault){this.preventDefault()}this.returnValue=false;this.cancelled=true};this.isCancelled=function(){return this.cancelled};this.getType=function(){return this.type};this.getX=function(){return this.clientX+document.body.scrollLeft};this.getScreenX=function(){return this.screenX+document.body.scrollLeft};this.getScreenY=function(){return this.screenY+document.body.scrollTop};this.getY=function(){return this.clientY+document.body.scrollTop};this.getChar=function(){return String.fromCharCode(this.keyCode||this.charCode).toUpperCase()};this.toString=function(){return'[Event type="'+this.type+'"]'}};core.ui.Event.improve=function(A){if(!A){A=window.event}this.apply(A);return A};core.ui.Event.addListener=function(B,A,C){if(undefined!==B.attachEvent){B.attachEvent("on"+A,C)}else{if(undefined!==B.addEventListener){B.addEventListener(A,C,false)}else{B["on"+A]=C}}};core.ui.Event.removeListener=function(B,A,C){if(undefined!==B.detachEvent){B.detachEvent("on"+A,C)}else{if(undefined!==B.removeEventListener){B.removeEventListener(A,C,false)}else{}}};core.ui.Event.addLoadListener=function(A){Event.addListener(window,"load",A)};core.ui.Event.removeLoadListener=function(A){Event.removeListener(window,"load",A)};core.ui.Event.addUnloadListener=function(A){Event.addListener(window,"unload",A)};core.ui.Event.removeUnloadListener=function(A){Event.removeListener(window,"unload",A)};core.ui.Event.types=["blur","change","click","contextmenu","dblclick","focus","keydown","keypress","keyup","load","mousedown","mousemove","mouseout","mouseover","mouseup","select","scroll","unload"];core.ui.Event.KEY_BACKSPACE=8;core.ui.Event.KEY_TAB=9;core.ui.Event.KEY_ENTER=13;core.ui.Event.KEY_SHIFT=16;core.ui.Event.KEY_CTRL=17;core.ui.Event.KEY_ALT=18;core.ui.Event.KEY_PAUSE=19;core.ui.Event.KEY_CAPS_LOCK=20;core.ui.Event.KEY_ESCAPE=27;core.ui.Event.KEY_SPACE=32;core.ui.Event.KEY_PAGE_UP=33;core.ui.Event.KEY_PAGE_DOWN=34;core.ui.Event.KEY_END=35;core.ui.Event.KEY_HOME=36;core.ui.Event.KEY_LEFT_ARROW=37;core.ui.Event.KEY_UP_ARROW=38;core.ui.Event.KEY_RIGHT_ARROW=39;core.ui.Event.KEY_DOWN_ARROW=40;core.ui.Event.KEY_INSERT=45;core.ui.Event.KEY_DELETE=46;core.ui.Event.KEY_LEFT_WINDOW=91;core.ui.Event.KEY_RIGHT_WINDOW=92;core.ui.Event.KEY_SELECT=93;core.ui.Event.KEY_F1=112;core.ui.Event.KEY_F2=113;core.ui.Event.KEY_F3=114;core.ui.Event.KEY_F4=115;core.ui.Event.KEY_F5=116;core.ui.Event.KEY_F6=117;core.ui.Event.KEY_F7=118;core.ui.Event.KEY_F8=119;core.ui.Event.KEY_F9=120;core.ui.Event.KEY_F10=121;core.ui.Event.KEY_F11=122;core.ui.Event.KEY_F12=123;core.ui.Event.KEY_NUM_LOCK=144;core.ui.Event.KEY_SCROLL_LOCK=145}ClassFactory.createPackage("core.ui");ClassFactory.createClass(core.ui,"Notification");with(core.ui){core.ui.Notification.constructor=function(){this.listeners=[];this.addListener=function(C,B){var A=this.findListener(C);if(-1==A){this.listeners.push([C,B])}};this.removeListener=function(B){var A=this.findListener(B);if(-1!=A){delete this.listeners[A];this.listeners.splice(A,1)}};this.send=function(){for(var B=0;B<this.listeners.length;B++){var C=this.listeners[B][0];var A=this.listeners[B][1];C.apply(null,arguments);if(A){this.removeListener(C);B--}}};this.clear=function(){while(this.listeners.length>0){this.listeners.pop()}};this.findListener=function(B){for(var A=0;A<this.listeners.length;A++){if(this.listeners[A]&&(B==this.listeners[A][0])){return A}}return -1};this.toString=function(){return"[Notification]"}}}ClassFactory.createPackage("core.ui");ClassFactory.createClass(core.ui,"Window");with(core.ui){core.ui.Window.constructor=function(){this.id;this.element;this.parent;this.visible=false;this.enabled=true;this.children={};this.Window=function(B,A,F,D,E,C){this.id=this.constructor.className+Window.NEXTID++;this.parent=(defined(B))?B:null;if(!C){C=this.createElement();C.className=this.constructor.className;C.style.overflow="hidden";if((B&&(B.constructor===Window||defined(B.constructor.isSubclassOf)&&B.constructor.isSubclassOf(Window)))){C.style.position="relative";B.addElement(C)}else{C.style.position="absolute";C.style.visibility="hidden";C.style.zIndex=Window.NEXTZINDEX++;document.body.appendChild(C)}}this.attach(C);if(B){B.children[this.getId()]=this}if(defined(A)){C.style.left=("string"==typeof A)?A:(A+"px")}if(defined(F)){C.style.top=("string"==typeof F)?F:(F+"px")}if(defined(D)){C.style.width=("string"==typeof D)?D:(D+"px")}if(defined(E)){C.style.height=("string"==typeof E)?E:(E+"px")}Window.all[this.getId()]=Window.active=this};this.attach=function(B){B.winid=this.getId();for(var A=0;A<Event.types.length;A++){Event.addListener(B,Event.types[A],this.handleEvent)}if(!defined(this.element)){this.element=B}};this.detach=function(B){if(!defined(B)){B=this.element}for(var A=0;A<Event.types.length;A++){Event.removeListener(B,Event.types[A],this.handleEvent)}B.winid=undefined;if(this.element==B){delete this.element;this.element=undefined}};this.isAttached=function(){return defined(this.element)};this.attachGlobalEvent=function(A){if(!Window.global[A]){Window.global[A]={}}Window.global[A][this.getId()]=true};this.detachGlobalEvent=function(A){if(Window.global[A]){delete Window.global[A][this.getId()]}};this.getElement=function(){return this.element};this.getParent=function(){return this.parent};this.setVisible=function(A){this.visible=A;if(A){this.setStyle("visibility",(this.isChild())?"inherit":"visible")}else{this.setStyle("visibility","hidden")}};this.show=function(){this.setVisible(true)};this.hide=function(){this.setVisible(false)};this.isHidden=function(){return("hidden"==this.getStyle("visibility"))};this.isVisible=function(){return !this.isHidden()};this.move=function(A,B){this.element.style.left=A+"px";this.element.style.top=B+"px"};this.resize=function(A,B){this.element.style.width=A+"px";this.element.style.height=B+"px"};this.center=function(){var A,B;if(this.isChild()){A=this.parent.getClientWidth()/2-this.getWidth()/2+this.parent.getElement().scrollLeft/2;B=this.parent.getClientHeight()/2-this.getHeight()/2+this.parent.getElement().scrollTop/2}else{A=Window.getWidth()/2-this.getWidth()/2+document.body.scrollLeft/2;B=Window.getHeight()/2-this.getHeight()/2+document.body.scrollTop/2}this.move(Math.round(A),Math.round(B))};this.getId=function(){return this.id};this.setText=function(A){this.element.innerHTML=A};this.getText=function(){return this.element.innerHTML};this.getX=function(){return this.element.offsetLeft};this.getY=function(){return this.element.offsetTop};this.getAbsX=function(){var B=this.getElement();var A=B.offsetLeft;while(B=B.offsetParent){A+=B.offsetLeft;A-=B.scrollLeft}return document.body.scrollLeft+A};this.getAbsY=function(){var A=this.getElement();var B=A.offsetTop;while(A=A.offsetParent){B+=A.offsetTop;B-=A.scrollTop}return document.body.scrollTop+B};this.getWidth=function(){return this.element.offsetWidth};this.getHeight=function(){return this.element.offsetHeight};this.getClientWidth=function(){return this.element.clientWidth};this.getClientHeight=function(){return this.element.clientHeight};this.getClientX=function(){return(this.getWidth()-this.getClientWidth())/2};this.getClientY=function(){return(this.getHeight()-this.getClientHeight())/2};this.setToolTip=function(A){this.element.title=A};this.getToolTip=function(){return this.element.title};this.close=function(){for(var A in this.children){this.children[A].close();delete this.children[A]}if(this.parent){delete this.parent.children[this.getId()];delete this.parent}if(this.element){if(this.element.parentNode){this.element.parentNode.removeChild(this.element)}delete this.element}delete Window.all[this.getId()]};this.isClosed=function(){return(!defined(Window.all[this.getId()]))};this.activate=function(){if(!this.isActive()){if(this.isChild()){this.parent.activate()}else{this.setStyle("z-index",Window.NEXTZINDEX++);Window.active=this}}};this.isActive=function(){return(Window.active&&Window.active==this)};this.setEnabled=function(A){this.enabled=A;this.getElement().disabled=!A;for(var B in this.children){this.children[B].setEnabled(A)}};this.enable=function(){this.setEnabled(true)};this.disable=function(){this.setEnabled(false)};this.isEnabled=function(){return this.enabled};this.isDisabled=function(){return this.getElement().disabled};this.isChild=function(){return(null!=this.parent)};this.isChildOf=function(A){for(var B in A.children){if(A.children[B]==this){return true}if(this.isChildOf(A.children[B])){return true}}return false};this.setStyle=function(B,C){switch(B.toLowerCase()){case"float":this.element.style["styleFloat"]=this.element.style["cssFloat"]=C;break;case"opacity":this.element.style.opacity=C/100;this.element.style.MozOpacity=C/100;this.element.style.KhtmlOpacity=C/100;this.element.style.filter="progid:DXImageTransform.Microsoft.Alpha(opacity="+C+")";break;default:var A=B.replace(/\-([a-z])/g,function(D){return D.charAt(1).toUpperCase()});this.element.style[A]=C}};this.getStyle=function(B){switch(B.toLowerCase()){case"float":return defined(this.element.style["styleFloat"])?this.element.style["styleFloat"]:this.element.style["cssFloat"];case"opacity":return(this.element.style.opacity||(0===this.element.style.opacity))?(this.element.style.opacity*100):100;default:var A=B.replace(/\-([a-z])/g,function(C){return C.charAt(1).toUpperCase()});return this.element.style[A]}};this.setStyleId=function(A){this.element.id=A};this.getStyleId=function(){return this.element.id};this.setStyleName=function(A){this.element.className=A};this.getStyleName=function(){return this.element.className.split(" ")[0]};this.addStyleName=function(A){var C=this.element.className.split(" ");for(var B=0;B<C.length;B++){if(A==C[B]){return }}C.push(A);this.element.className=C.join(" ")};this.removeStyleName=function(A){var C=this.element.className.split(" ");for(var B=0;B<C.length;B++){if(A==C[B]){C.splice(B,1);break}}this.element.className=C.join(" ")};this.hasStyleName=function(A){var C=this.element.className.split(" ");for(var B=0;B<C.length;B++){if(C[B]===A){return true}}return false};this.clearStyleName=function(){var A=this.element.className.split(" ");this.element.className=defined(A[0])?A[0]:this.constructor.className};this.createElement=function(){return document.createElement("div")};this.addElement=function(A){this.getElement().appendChild(A)};this.handleEvent=callback(this,function(B){B=Event.improve(B);var C=(B.target)?Window.all[B.target.winid]:undefined;var A=Window.processEvent(B,C);if(!B.isStopped()){if(("function"==typeof this["on"+B.getType()])&&this.isEnabled()){if(false===this["on"+B.getType()](B,C,this)){A=false}}}if(false===A){B.cancel()}return A});this.toString=function(){return"["+this.constructor.className+"]"}};core.ui.Window.eventHandler=function(A){A=Event.improve(A);var B=(A.target)?Window.all[A.target.winid]:undefined;if(false===Window.processEvent(A,B)){A.cancel()}return !A.isCancelled()};core.ui.Window.processEvent=function(B,E){var A=true;for(var D in Window.global[B.getType()]){var C=Window.all[D];if(("function"==typeof C["on"+B.getType()])&&C.isEnabled()){if(false===C["on"+B.getType()](B,E,C)){A=false}}}return A};core.ui.Window.NEXTID=1;core.ui.Window.NEXTZINDEX=1;core.ui.Window.all={};core.ui.Window.active=null;core.ui.Window.global={};core.ui.Window.getWidth=function(){return document.body.clientWidth+document.body.scrollLeft};core.ui.Window.getHeight=function(){return document.body.clientHeight+document.body.scrollTop};core.ui.Window.forId=function(A){return Window.all[A]};core.ui.Window.registerDocument=function(B){for(var A=0;A<Event.types.length;A++){Event.addListener(B,Event.types[A],Window.eventHandler)}};core.ui.Window.unregisterDocument=function(B){for(var A=0;A<Event.types.length;A++){Event.removeListener(B,Event.types[A],Window.eventHandler)}};core.ui.Window.notifyScroll=new Notification();core.ui.Window.notifyResize=new Notification();core.ui.Window.cleanup=function(){for(var A in Window.all){if(!Window.all[A].isChild()){Window.all[A].close()}}};core.ui.Window.onresize=function(){Window.notifyResize.send(Window.getWidth(),Window.getHeight())};core.ui.Window.onscroll=function(){Window.notifyScroll.send(document.body.scrollLeft,document.body.scrollTop)};core.ui.Window.registerDocument(window.document);Event.addListener(window,"resize",Window.onresize);Event.addListener(window,"scroll",Window.onscroll);Event.addUnloadListener(Window.cleanup)}ClassFactory.createPackage("core.app");ClassFactory.createClass(core.app,"Config");with(core.app){core.app.Config.constructor=function(){this.properties={};this.load=function(url){try{var json=HTTPFileLoader.loadFile(url);this.properties=eval("("+json+")");return true}catch(e){this.properties={};return false}};this.get=function(name,def){return(defined(this.properties[name]))?this.properties[name]:def};this.set=function(name,value){this.properties[name]=value};this.exists=function(name){return defined(this.properties[name])}}}ClassFactory.createPackage("core.ajax");ClassFactory.createClass(core.ajax,"Response");with(core.ajax){core.ajax.Response.constructor=function(){this.Response=function(A){core.ajax.Response.convert(A,this)};this.toString=function(){return"[Response]"}};core.ajax.Response.getBool=function(A){return("1"==A.firstChild.nodeValue)};core.ajax.Response.getInt=function(A){return parseInt(A.firstChild.nodeValue)};core.ajax.Response.getFloat=function(A){return parseFloat(A.firstChild.nodeValue)};core.ajax.Response.getArray=function(C){var A=new Array();for(var B=0;B<C.childNodes.length;B++){if(C.childNodes.item(B).nodeType==1){A.push(this.getValue(C.childNodes.item(B)))}}return A};core.ajax.Response.getObject=function(A){var B=new Object();this.convert(A,B);return B};core.ajax.Response.getString=function(A){try{return A.firstChild.nodeValue}catch(B){return""}};core.ajax.Response.getValue=function(C){var A=C.attributes.getNamedItem("type");var B=(A)?A.nodeValue:"string";switch(B){case"null":return null;case"bool":return this.getBool(C);case"int":return this.getInt(C);case"float":return this.getFloat(C);case"array":return this.getArray(C);case"object":return this.getObject(C);default:return this.getString(C)}};core.ajax.convert=core.ajax.Response.convert=function(C,D){for(var B=0;B<C.childNodes.length;B++){if(C.childNodes.item(B).nodeType==1){var E=C.childNodes.item(B);var A=E.nodeName;D[A]=this.getValue(E)}}}}ClassFactory.createPackage("core.ajax");ClassFactory.createClass(core.ajax,"Request");with(core.ajax){core.ajax.Request.constructor=function(){this.url;this.http;this.handler;this.Request=function(url,handler){this.url=url;this.handler=handler||{};this.http=XMLHttpRequestFactory.createRequest();this.http.onreadystatechange=this.onRequestStateChange};this.send=function(content){if(defined(content)&&content.length>0){this.http.open("POST",this.url,true);this.http.setRequestHeader("Content-Type","application/x-www-form-urlencoded");this.http.send(content)}else{this.http.open("GET",this.url,true);this.http.send(null)}};this.onSuccess=function(response){if("function"==typeof this.handler.onSuccess){this.handler.onSuccess(response)}};this.onError=function(error){if("function"==typeof this.handler.onError){this.handler.onError(error)}};this.onComplete=function(){if("function"==typeof this.handler.onComplete){this.handler.onComplete()}};this.onRequestStateChange=callback(this,function(){if(4==this.http.readyState){if((200==this.http.status)||(304==this.http.status)){switch(this.http.getResponseHeader("Content-Type")){case"text/xml":case"application/xml":var rootNode;if(this.http.responseXML&&(rootNode=this.http.responseXML.documentElement)){rootNode.normalize();if("response"==rootNode.nodeName){this.onSuccess(new Response(rootNode))}else{if("error"==rootNode.nodeName){this.onError(new Response(rootNode))}else{}}}break;case"text/json":case"application/json":this.onSuccess(eval("("+this.http.responseText+")"));break;default:this.onSuccess(this.http.responseText);break}}else{this.onError("There was a problem retrieving the XML data:\n"+this.http.statusText)}this.onComplete()}});this.toString=function(){return"[Request]"}};core.ajax.sendRequest=core.ajax.Request.send=function(B,E,F){var C=new core.ajax.Request(B,{onSuccess:E});var D=new Array();if(defined(F)){for(var A in F){D.push(encodeURIComponent(A)+"="+encodeURIComponent(F[A]))}}C.send(D.join("&"))};core.ajax.sendFormData=core.ajax.Request.sendFormData=function(C,E){var F={};for(var D=2;D<arguments.length;D++){if(defined(arguments[D].elements)&&arguments[D].elements.length){for(var B=0;B<arguments[D].elements.length;B++){if(arguments[D].elements[B].name!=""){F[arguments[D].elements[B].name]=arguments[D].elements[B].value}}}else{for(var A in arguments[D]){F[A]=arguments[D][A]}}}return core.ajax.sendRequest(C,E,F)}}ClassFactory.createPackage("core.util");ClassFactory.createClass(core.util,"Iterator");with(core.util){core.util.Iterator.constructor=function(){this.collection=[];this.index=0;this.Iterator=function(B){if((B&&(B.constructor===Array||defined(B.constructor.isSubclassOf)&&B.constructor.isSubclassOf(Array)))){this.collection=B}else{for(var A in B){this.collection.push(B[A])}}};this.hasNext=function(){return(this.index<this.collection.length)};this.next=function(){if(!this.hasNext()){throw new Error("The iteration has no more elements")}else{return this.collection[this.index++]}};this.current=function(){return this.collection[this.index]}}}ClassFactory.createPackage("core.util");ClassFactory.createClass(core.util,"OrderedSet");with(core.util){core.util.OrderedSet.constructor=function(){this.elements=[];this.add=function(A){if(!this.contains(A)){this.elements.push(A)}};this.remove=function(A){var B=this.indexOf(A);if(B>=0){delete this.elements[B];this.elements.splice(B,1)}};this.clear=function(){while(this.elements.length>0){this.elements.pop()}};this.contains=function(A){return(-1!=this.indexOf(A))};this.indexOf=function(A){for(var B=0;B<this.elements.length;B++){if(this.elements[B]&&(A===this.elements[B])){return B}}return -1};this.size=function(){return this.elements.length};this.iterator=function(){return new Iterator(this.elements)};this.toArray=function(){return this.elements}}}ClassFactory.createPackage("core.util");ClassFactory.createClass(core.util,"Listeners");with(core.util){core.util.Listeners.superClass=core.util.OrderedSet;core.util.Listeners.constructor=function(){this.call=function(D,A){var B=this.iterator();while(B.hasNext()){var C=B.next();if("function"==typeof C[D]){C[D].apply(C,A)}}}}}ClassFactory.createPackage("core.ui");ClassFactory.createClass(core.ui,"ModalGlassPane");with(core.ui){core.ui.ModalGlassPane.superClass=core.ui.Window;core.ui.ModalGlassPane.constructor=function(){this.zIndexes=[];this.dialogs=[];this.ModalGlassPane=function(){arguments.callee.prototype.apply(this,[]);this.setStyle("z-index",0);Window.notifyResize.addListener(this.onUpdateLayout);Window.notifyScroll.addListener(this.onUpdateLayout);this.updateLayout()};this.modalize=function(A){this.dialogs.push(A);this.move(0,0);this.resize(Window.getWidth(),Window.getHeight());this.zIndexes.push(this.getStyle("z-index"));this.activate();this.show();A.activate();A.show()};this.unmodalize=function(A){this.setStyle("z-index",this.zIndexes.pop());var A=this.dialogs.pop();if(0==this.dialogs.length){this.hide()}A.hide()};this.getActiveDialog=function(){return this.dialogs[this.dialogs.length-1]};this.updateLayout=function(){this.resize(Window.getWidth(),Window.getHeight())};this.onUpdateLayout=callback(this,function(){this.updateLayout()});this.onmousedown=function(){this.getActiveDialog().fireLooseActivity()}};core.ui.ModalGlassPane.getInstance=function(){if(!defined(this.instance)){this.instance=new ModalGlassPane()}return this.instance}}ClassFactory.createPackage("core.ui");ClassFactory.createClass(core.ui,"Dialog");with(core.ui){core.ui.Dialog.superClass=core.ui.Window;core.ui.Dialog.constructor=function(){this.modal=false;this.listeners=new core.util.Listeners();this.addDialogListener=function(A){this.listeners.add(A)};this.removeDialogListener=function(A){this.listeners.remove(A)};this.doModal=function(A){ModalGlassPane.getInstance().modalize(this);this.modal=true;this.fireBeginModal()};this.endModal=function(){if(!this.isModal()){return }ModalGlassPane.getInstance().unmodalize(this);this.modal=false;this.fireEndModal()};this.isModal=function(){return this.modal};this.fireBeginModal=function(){this.listeners.call("onDialogBeginModal",[this])};this.fireEndModal=function(){this.listeners.call("onDialogEndModal",[this])};this.fireLooseActivity=function(){this.listeners.call("onDialogLooseActivity",[this])}}}ClassFactory.createPackage("core.ui");ClassFactory.createClass(core.ui,"Handle");with(core.ui){core.ui.Handle.superClass=core.ui.Window;core.ui.Handle.constructor=function(){this.target;this.direction=Handle.DIRECTION_ALL;this.draginfo={};this.notifyBeginDrag=new Notification();this.notifyEndDrag=new Notification();this.notifyDrag=new Notification();this.setDragWindow=function(A){this.target=A};this.getDragWindow=function(){return this.target};this.setDirection=function(A){this.direction=A};this.getDirection=function(){return this.direction};this.beginDrag=function(A){if((this.target&&(this.target.constructor===Window||defined(this.target.constructor.isSubclassOf)&&this.target.constructor.isSubclassOf(Window)))){this.draginfo={"startX":A.getScreenX(),"startY":A.getScreenY(),"targetX":this.target.getX(),"targetY":this.target.getY(),"dragState":true}}this.attachGlobalEvent("mouseup");this.attachGlobalEvent("mousemove");this.notifyBeginDrag.send(this)};this.doDrag=function(A,F){var C=this.target.getX();var B=this.target.getY();var E=this.draginfo.targetX+A-this.draginfo.startX;var D=this.draginfo.targetY+F-this.draginfo.startY;this.target.move(E,D);this.notifyDrag.send(this,E-C,D-B)};this.endDrag=function(){if(this.isDragging()){this.detachGlobalEvent("mouseup");this.detachGlobalEvent("mousemove");this.draginfo.dragState=false}};this.isDragging=function(){return this.draginfo.dragState};this.close=override(this.close,function(){if(this.isDragging()){this.endDrag()}arguments.callee.prototype.apply(this,[])});this.onmousedown=function(A){this.beginDrag(A)};this.onmousemove=function(D){if(this.isDragging()){var A=this.draginfo.startX;var E=this.draginfo.startY;var C=D.getScreenX()-A;var B=D.getScreenY()-E;if(C>=0){C*=(this.direction&Handle.DIRECTION_EAST)?1:0}else{C*=(this.direction&Handle.DIRECTION_WEST)?1:0}if(B>=0){B*=(this.direction&Handle.DIRECTION_NORTH)?1:0}else{B*=(this.direction&Handle.DIRECTION_SOUTH)?1:0}this.doDrag(A+C,E+B);D.stop()}};this.onmouseup=function(A){if(this.isDragging()){this.endDrag();this.notifyEndDrag.send(this)}}};core.ui.Handle.DIRECTION_NORTH=1;core.ui.Handle.DIRECTION_SOUTH=4;core.ui.Handle.DIRECTION_EAST=8;core.ui.Handle.DIRECTION_WEST=16;core.ui.Handle.DIRECTION_ALL=(core.ui.Handle.DIRECTION_NORTH|core.ui.Handle.DIRECTION_SOUTH|core.ui.Handle.DIRECTION_EAST|core.ui.Handle.DIRECTION_WEST)}ClassFactory.createPackage("core.ui");ClassFactory.createClass(core.ui,"FocusWindow");with(core.ui){core.ui.FocusWindow.superClass=core.ui.Window;core.ui.FocusWindow.constructor=function(){this.FocusWindow=function(B,A,E,C,D){arguments.callee.prototype.apply(this,[B,A,E,C,D]);this.setTabIndex(-1)};this.setFocus=function(A){if(A){if(defined(this.getElement().focus)){window.setTimeout(this.setFocusTimeout,0)}}else{if(defined(this.getElement().blur)){this.getElement().blur()}}};this.hasFocus=function(){};this.setTabIndex=function(A){this.getElement().tabIndex=A};this.getTabIndex=function(){return this.getElement().tabIndex};this.setAccessKey=function(A){this.getElement().accessKey=A};this.getAccessKey=function(){return this.getElement().accessKey};this.setFocusTimeout=callback(this,function(){try{this.getElement().focus()}catch(A){}})}}ClassFactory.createPackage("core.ui");ClassFactory.createClass(core.ui,"ImageButton");with(core.ui){core.ui.ImageButton.superClass=core.ui.FocusWindow;core.ui.ImageButton.constructor=function(){this.images={};this.imageList;this.state;this.ImageButton=function(B,A,G,E,F){arguments.callee.prototype.apply(this,[B,A,G,E,F]);this.getElement().setAttribute("unselectable","on");core.ui.quirks.TextSelection.preventSelection(this.getElement());var D=[ImageButton.STATE_NORMAL,ImageButton.STATE_HOVER,ImageButton.STATE_PRESSED,ImageButton.STATE_DISABLED];for(var C=0;C<D.length;C++){this.images[D[C]]=new window.Image()}this.setState(ImageButton.STATE_NORMAL)};this.setState=function(A){this.getElement().setAttribute("state",A);this.removeStyleName(this.getStyleName()+"-"+ImageButton.states[this.state]);this.addStyleName(this.getStyleName()+"-"+ImageButton.states[A]);this.state=A;if(defined(this.imageList)){this.setStyle("background-position",-(this.getWidth()*A)+"px top")}else{if(this.images[A].src.length>0){this.setImage(this.images[A].src)}}};this.getState=function(){return this.state};this.setImages=function(D,C,A,B){if(defined(D)){this.images[ImageButton.STATE_NORMAL].src=D}if(defined(C)){this.images[ImageButton.STATE_HOVER].src=C}if(defined(A)){this.images[ImageButton.STATE_PRESSED].src=A}if(defined(B)){this.images[ImageButton.STATE_DISABLED].src=B}if(this.images[this.state].src.length>0){this.setImage(this.images[this.state].src)}};this.setImageList=function(A){if(!defined(this.imageList)){this.imageList=new window.Image()}this.imageList.src=A;this.setImage(A);this.setStyle("background-position",-(this.getWidth()*this.state)+"px top")};this.setImage=function(A){this.setStyle("background-image",'url("'+A+'")')};this.setEnabled=override(this.setEnabled,function(A){if(A){arguments.callee.prototype.apply(this,[A]);this.setState(ImageButton.STATE_NORMAL)}else{this.setState(ImageButton.STATE_DISABLED);arguments.callee.prototype.apply(this,[A])}});this.onmousedown=function(A){this.setState(ImageButton.STATE_PRESSED);this.setFocus(true);this.activate();A.stop();A.cancel()};this.onmouseover=this.onmouseup=function(A){this.setState(ImageButton.STATE_HOVER);A.stop()};this.onmouseout=function(A){this.setState(ImageButton.STATE_NORMAL);A.stop()};this.ondblclick=function(A){A.stop()};this.onclick=function(C,B,A){if("function"==typeof this.oncommand){this.oncommand(C,B,A)}};this.onkeydown=function(C,B,A){if(Event.KEY_SPACE==C.keyCode){C.stop();this.setState(ImageButton.STATE_PRESSED)}else{if(Event.KEY_ENTER==C.keyCode){C.stop();if("function"==typeof this.oncommand){this.oncommand(C,B,A)}}}};this.onkeyup=function(C,B,A){if(Event.KEY_SPACE==C.keyCode){C.stop();this.setState(ImageButton.STATE_NORMAL);if("function"==typeof this.oncommand){this.oncommand(C,B,A)}}}};core.ui.ImageButton.STATE_NORMAL=0;core.ui.ImageButton.STATE_HOVER=1;core.ui.ImageButton.STATE_PRESSED=2;core.ui.ImageButton.STATE_DISABLED=3;core.ui.ImageButton.states=["normal","hover","pressed","disabled"]}ClassFactory.createPackage("core.ui");ClassFactory.createClass(core.ui,"InputWindow");with(core.ui){core.ui.InputWindow.superClass=core.ui.FocusWindow;core.ui.InputWindow.constructor=function(){this.setSelected=function(A){if(A){this.getInput().select()}else{this.getInput().blur()}};this.setName=function(A){this.getInput().name=A};this.getName=function(){return this.getInput().name};this.setValue=function(A){this.getInput().value=A};this.getValue=function(){return this.getInput().value};this.setText=function(A){this.setValue(A)};this.getText=function(){return this.getValue()};this.setFocus=function(A){if(A){try{this.getInput().focus()}catch(B){}}else{this.getInput().blur()}};this.setTabIndex=function(A){this.getInput().tabIndex=A};this.getTabIndex=function(){return getInput().tabIndex};this.setAccessKey=function(A){this.getInput().accessKey=A};this.getAccessKey=function(){return this.getInput().accessKey};this.getInput=function(){return this.getElement()};this.createElement=function(){var A=document.createElement("input");A.type=this.getType();return A};this.getType=function(){return"text"}}}ClassFactory.createPackage("core.ui");ClassFactory.createClass(core.ui,"Edit");with(core.ui){core.ui.Edit.superClass=core.ui.InputWindow;core.ui.Edit.constructor=function(){this.Edit=function(B,A,E,C,D){arguments.callee.prototype.apply(this,[B,A,E,C,D]);this.getInput().setAttribute("autocomplete","off");if(defined(this.getInput().onselectstart)){this.getInput().onselectstart=new Function("window.event.cancelBubble = true")}};this.setReadOnly=function(A){this.getElement().readOnly=A};this.isReadOnly=function(){return this.getElement().readOnly};this.getType=function(){return"text"}}}ClassFactory.createPackage("core.ui");ClassFactory.createClass(core.ui,"TextArea");with(core.ui){core.ui.TextArea.superClass=core.ui.FocusWindow;core.ui.TextArea.constructor=function(){this.TextArea=function(B,A,E,C,D){arguments.callee.prototype.apply(this,[B,A,E,C,D]);if(defined(this.getElement().onselectstart)){this.getElement().onselectstart=new Function("window.event.cancelBubble = true")}};this.setName=function(A){this.getElement().name=A};this.getName=function(){return this.getElement().name};this.setValue=function(A){this.getElement().value=A};this.getValue=function(){return this.getElement().value};this.setText=function(A){this.setValue(A)};this.getText=function(){return this.getValue()};this.createElement=function(){return document.createElement("textarea")}}}ClassFactory.createPackage("core.ui");ClassFactory.createClass(core.ui,"Static");with(core.ui){core.ui.Static.superClass=core.ui.Window;core.ui.Static.constructor=function(){this.Static=function(B,A,E,C,D){arguments.callee.prototype.apply(this,[B,A,E,C,D]);core.ui.quirks.TextSelection.preventSelection(this.getElement())}}}ClassFactory.createPackage("core.ui");ClassFactory.createClass(core.ui,"Balloon");with(core.ui){core.ui.Balloon.superClass=core.ui.Window;core.ui.Balloon.constructor=function(){this.owner;this.position;this.timeout;this.tail;this.timerId;this.Balloon=function(C,D,B,A){arguments.callee.prototype.apply(this,[]);this.setStyle("overflow","visible");this.setStyle("z-index",Balloon.ZINDEX);this.tail=this.createTail();this.setPosition(defined(B)?B:Balloon.TOP);this.setTimeout(defined(A)?A:10);this.setOwner(C);this.setText(D)};this.setOwner=function(A){this.owner=A};this.getOwner=function(){return this.owner};this.setPosition=function(B){var A={};A[Balloon.LEFT]="left";A[Balloon.TOP]="top";A[Balloon.RIGHT]="right";A[Balloon.BOTTOM]="bottom";this.removeStyleName(this.getStyleName()+"-"+A[this.position&Balloon.MASK_POSTITON]);this.tail.removeStyleName(this.tail.getStyleName()+"-"+A[this.position&Balloon.MASK_POSTITON]);this.position=B;this.addStyleName(this.getStyleName()+"-"+A[this.position&Balloon.MASK_POSTITON]);this.tail.addStyleName(this.tail.getStyleName()+"-"+A[this.position&Balloon.MASK_POSTITON])};this.getPosition=function(){return this.position};this.setTimeout=function(A){this.timeout=A};this.getTimeout=function(){return this.timeout};this.setVisible=override(this.setVisible,function(A){if(A){this.attachGlobalEvent("mousemove");this.adjustPosition();if(0!==this.timeout){window.clearTimeout(this.timerId);this.timerId=window.setTimeout(this.onTimeout,this.timeout*1000)}}else{window.clearTimeout(this.timerId);this.detachGlobalEvent("mousemove")}this.tail.setVisible(A);arguments.callee.prototype.apply(this,[A])});this.getTail=function(){return this.tail};this.setEnabled=override(this.setEnabled,function(A){this.tail.setEnabled(A);arguments.callee.prototype.apply(this,[A])});this.close=override(this.close,function(){window.clearTimeout(this.timerId);this.tail.close();delete this.tail;arguments.callee.prototype.apply(this,[])});this.createTail=function(){var A=new Window();A.setStyleName(this.getStyleName()+"Tail");A.setStyle("z-index",Balloon.ZINDEX);return A};this.correctPosition=function(){var E=0;var F=0;if(this.position&Balloon.LEFT){var C=this.owner.getAbsX()-this.tail.getWidth();var B=this.owner.getAbsY()+(this.owner.getHeight()-this.tail.getHeight())/2;E=C-this.getWidth();F=B-(this.getHeight()-this.tail.getHeight())/2}else{if(this.position&Balloon.RIGHT){var C=this.owner.getAbsX()+this.owner.getWidth();var B=this.owner.getAbsY()+(this.owner.getHeight()-this.tail.getHeight())/2;E=C+this.tail.getWidth();F=B-(this.getHeight()-this.tail.getHeight())/2}else{if(this.position&Balloon.TOP){var C=this.owner.getAbsX()+(this.owner.getWidth()-this.tail.getWidth())/2;var B=this.owner.getAbsY()-this.tail.getHeight();E=C-(this.getWidth()-this.tail.getWidth())/2;F=B-this.getHeight()}else{if(this.position&Balloon.BOTTOM){var C=this.owner.getAbsX()+(this.owner.getWidth()-this.tail.getWidth())/2;var B=this.owner.getAbsY()+this.owner.getHeight();E=C-(this.getWidth()-this.tail.getWidth())/2;F=B+this.tail.getHeight()}}}}var G=document.body.scrollLeft;var A=document.body.clientWidth+document.body.scrollLeft;var D=document.body.scrollTop;var H=document.body.clientHeight+document.body.scrollTop;if(E<G){this.setPosition(Balloon.RIGHT|(this.position&Balloon.FLOATING))}else{if(E+this.getWidth()>A){this.setPosition(Balloon.LEFT|(this.position&Balloon.FLOATING))}}if(F<D){this.setPosition(Balloon.BOTTOM|(this.position&Balloon.FLOATING))}else{if(F+this.getHeight()>H){this.setPosition(Balloon.TOP|(this.position&Balloon.FLOATING))}}};this.adjustPosition=function(){if(this.position&Balloon.FLOATING){this.correctPosition()}if(this.position&Balloon.LEFT){this.tail.move(this.owner.getAbsX()-this.tail.getWidth(),this.owner.getAbsY()+(this.owner.getHeight()-this.tail.getHeight())/2);this.move(this.tail.getX()-this.getWidth(),this.tail.getY()-(this.getHeight()-this.tail.getHeight())/2)}else{if(this.position&Balloon.RIGHT){this.tail.move(this.owner.getAbsX()+this.owner.getWidth(),this.owner.getAbsY()+(this.owner.getHeight()-this.tail.getHeight())/2);this.move(this.tail.getX()+this.tail.getWidth(),this.tail.getY()-(this.getHeight()-this.tail.getHeight())/2)}else{if(this.position&Balloon.TOP){this.tail.move(this.owner.getAbsX()+(this.owner.getWidth()-this.tail.getWidth())/2,this.owner.getAbsY()-this.tail.getHeight());this.move(this.tail.getX()-(this.getWidth()-this.tail.getWidth())/2,this.tail.getY()-this.getHeight())}else{if(this.position&Balloon.BOTTOM){this.tail.move(this.owner.getAbsX()+(this.owner.getWidth()-this.tail.getWidth())/2,this.owner.getAbsY()+this.owner.getHeight());this.move(this.tail.getX()-(this.getWidth()-this.tail.getWidth())/2,this.tail.getY()+this.tail.getHeight())}}}}};this.onmousedown=function(A,B){if(((B&&(B.constructor===Window||defined(B.constructor.isSubclassOf)&&B.constructor.isSubclassOf(Window))))&&((B==this)||B.isChildOf(this))){if(this.isVisible()){this.hide()}}};this.onmousemove=function(A){var B=arguments.callee;if((this.owner.getAbsX()!==B.x)||(this.owner.getAbsY()!==B.y)){B.x=this.owner.getX();B.y=this.owner.getY();this.adjustPosition()}};this.onTimeout=callback(this,function(){if(this.isVisible()){this.hide()}})};core.ui.Balloon.LEFT=1;core.ui.Balloon.TOP=2;core.ui.Balloon.RIGHT=4;core.ui.Balloon.BOTTOM=8;core.ui.Balloon.FLOATING=16;core.ui.Balloon.MASK_POSTITON=15;core.ui.Balloon.ZINDEX=10000}ClassFactory.createPackage("editor.ui");ClassFactory.createClass(editor.ui,"Balloon");with(editor.ui){editor.ui.Balloon.superClass=core.ui.Balloon;editor.ui.Balloon.constructor=function(){this.Balloon=function(C,D,B,A){arguments.callee.prototype.apply(this,[C,D,B,A]);this.top=new core.ui.Window(this);this.top.setStyleName(this.getStyleName()+"Top");this.top.setStyle("z-index",core.ui.Balloon.ZINDEX+1);this.center=new core.ui.Window(this);this.center.setStyleName(this.getStyleName()+"Center");this.center.setStyle("z-index",core.ui.Balloon.ZINDEX+1);this.bottom=new core.ui.Window(this);this.bottom.setStyleName(this.getStyleName()+"Bottom");this.bottom.setStyle("z-index",core.ui.Balloon.ZINDEX+1);this.text=new core.ui.Window(this,0,0,"100%","auto");this.text.setStyleName(this.getStyleName()+"Text");this.text.setStyle("position","absolute");this.text.setStyle("z-index",core.ui.Balloon.ZINDEX+2);this.updateLayout()};this.setText=function(A){if((this.text&&(this.text.constructor===core.ui.Window||defined(this.text.constructor.isSubclassOf)&&this.text.constructor.isSubclassOf(core.ui.Window)))){this.text.setText(A)}};this.getText=function(){return this.text.getText()};this.updateLayout=function(){this.text.move(0,0);this.top.setStyle("width","100%");this.center.setStyle("width","100%");this.center.setStyle("height",(this.text.getHeight()-this.top.getHeight()-this.bottom.getHeight())+"px");this.bottom.setStyle("width","100%");this.setStyle("height",this.text.getHeight()+"px")};this.setVisible=override(this.setVisible,function(A){this.updateLayout();arguments.callee.prototype.apply(this,[A])})}}ClassFactory.createPackage("common.util");ClassFactory.createClass(common.util,"MemorialUtils");with(common.util){common.util.MemorialUtils.constructor=function(){};common.util.MemorialUtils.getPageId=function(){if(defined(window.theApp)){return theApp.config.get("page.id")}else{return common.Page.getInstance().config.get("page.id")}};common.util.MemorialUtils.getBaseUri=function(){if(defined(window.theApp)){return theApp.config.get("app.baseUri")}else{return common.Page.getInstance().config.get("page.baseUri")}};common.util.MemorialUtils.htmlEncode=function(A){return A.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")};common.util.MemorialUtils.htmlDecode=function(A){return A.replace(/&amp;/g,"&").replace(/&lt;/g,"<").replace(/&gt;/g,">").replace(/&quot;/g,'"')}}ClassFactory.createPackage("editor.ui");ClassFactory.createClass(editor.ui,"MessageDialog");with(editor.ui){editor.ui.MessageDialog.superClass=core.ui.Dialog;editor.ui.MessageDialog.constructor=function(){this.name;this.mail;this.text;this.notifySubmitClicked=new core.ui.Notification();this.notifyCancelClicked=new core.ui.Notification();this.MessageDialog=function(B,A,E,C,D){this.Dialog();this.initHeader();this.initBody();this.balloon=new editor.ui.Balloon()};this.initBody=function(){var B=new core.ui.Window(this);B.addStyleName("MessageDialogBody");var A=new core.ui.Static(B);A.setStyle("text-align","left");A.setText("Enter your name");this.name=new core.ui.Edit(B);this.name.setTabIndex(1);var D=new core.ui.Static(B);D.setText("Enter your e-mail");this.mail=new core.ui.Edit(B);this.mail.setTabIndex(2);var C=new core.ui.Static(B);C.setText("Enter your message");this.text=new core.ui.TextArea(B);this.text.setTabIndex(3);this.text.setStyle("overflow-y","auto");this.cancel=new core.ui.ImageButton(B);this.cancel.setImageList("images/MessageDialog/close_button.gif");this.cancel.addStyleName("CloseButton");this.cancel.setToolTip("Close window");this.cancel.oncommand=this.onCancelClick;this.submit=new core.ui.ImageButton(B);this.submit.setImageList("images/MessageDialog/ok_button.gif");this.submit.addStyleName("OkButton");this.submit.setToolTip("Add message");this.submit.oncommand=this.onSubmitClick};this.initHeader=function(){var C=new core.ui.Handle(this);C.setDragWindow(this);C.addStyleName("MessageDialogHeader");var B=new core.ui.Window(C);B.addStyleName("HeaderLeftCorner");var A=new core.ui.Window(C);A.addStyleName("HeaderRightCorner")};this.show=override(this.show,function(){arguments.callee.prototype.apply(this,[]);if(this.name.getText()){this.text.setFocus(true)}else{this.name.setFocus(true)}});this.setData=function(B,A,C){this.name.setText(B);this.mail.setText(A);this.text.setText(C)};this.reset=function(){this.text.setText("")};this.showBalloon=function(B,C,A){this.balloon.setOwner(B);this.balloon.setText(C);this.balloon.setPosition(A);this.balloon.show()};this.hideBalloon=function(){this.balloon.hide()};this.validate=function(){var A=/^[_A-Za-z0-9-]+(\.[_A-Za-z0-9-]+)*@[A-Za-z0-9-]+(\.[A-Za-z0-9-]+)+$/;if(!this.name.getText()){this.showBalloon(this.name,"Please enter your name.",core.ui.Balloon.RIGHT);this.name.setFocus(true);return false}else{if(!this.mail.getText().match(A)){this.showBalloon(this.mail,"Please enter a valid email address.",core.ui.Balloon.RIGHT);this.mail.setFocus(true);return false}else{if(!this.text.getText()){this.text.setFocus(true);this.showBalloon(this.text,"Please type your message.",core.ui.Balloon.RIGHT);return false}}}return true};this.doModal=override(this.doModal,function(){arguments.callee.prototype.apply(this,[]);editor.ui.SelectionManager.get().clearSelection(true)});this.endModal=override(this.endModal,function(){this.hideBalloon();arguments.callee.prototype.apply(this,[]);editor.ui.SelectionManager.get().restoreSelection()});this.submitClicked=function(){this.endModal()};this.cancelClicked=function(){this.endModal()};this.onSubmitClick=callback(this,function(){if(this.validate()){this.submitClicked();this.notifySubmitClicked.send(this)}});this.onCancelClick=callback(this,function(){this.cancelClicked();this.notifyCancelClicked.send(this)})}}ClassFactory.createPackage("common");ClassFactory.createClass(common,"ReportAbuseDialog");with(common){common.ReportAbuseDialog.superClass=editor.ui.MessageDialog;common.ReportAbuseDialog.constructor=function(){this.notifyAbuseSent=new core.ui.Notification();this.ReportAbuseDialog=function(parent,x,y,width,height){this.MessageDialog(parent,x,y,width,height);with(core.ui){Window.notifyResize.addListener(this.onUpdatePosition);Window.notifyScroll.addListener(this.onUpdatePosition)}};this.submitClicked=override(this.submitClicked,function(){core.ajax.sendRequest("ajax.PostAbuseMessage",this.onServerResponse,{"id":Page.getInstance().config.get("page.id"),"name":this.name.getText(),"email":this.mail.getText(),"message":this.text.getText()})});this.onServerResponse=callback(this,function(response){if(response.status=="OK"){alert("Your message has been sent.");this.endModal();this.notifyAbuseSent.send(this,this.name.getText(),this.mail.getText())}else{alert(response.message)}});this.cancelClicked=override(this.cancelClicked,function(){arguments.callee.prototype.apply(this,[]);this.endModal()});this.onUpdatePosition=callback(this,function(){this.center()})}}ClassFactory.createPackage("core.ui");ClassFactory.createClass(core.ui,"Link");with(core.ui){core.ui.Link.superClass=core.ui.Window;core.ui.Link.constructor=function(){this.Link=function(B,A,E,C,D){arguments.callee.prototype.apply(this,[B,A,E,C,D]);this.setStyle("display","block");this.setTarget(Link.TARGET_SELF);this.setHref("#")};this.setHref=function(A){this.getElement().href=A};this.getHref=function(){return this.getElement().href};this.setTarget=function(A){this.getElement().target=A};this.getTarget=function(){return this.getElement().target};this.createElement=function(){return document.createElement("a")}};core.ui.Link.TARGET_BLANK="_blank";core.ui.Link.TARGET_PARENT="_parent";core.ui.Link.TARGET_SELF="_self";core.ui.Link.TARGET_TOP="_top"}ClassFactory.createPackage("editor.plugins.comments");ClassFactory.createClass(editor.plugins.comments,"CommentsControls");with(editor.plugins.comments){editor.plugins.comments.CommentsControls.superClass=core.ui.Window;editor.plugins.comments.CommentsControls.constructor=function(){this.owner=null;this.showComments;this.addComment;this.CommentsControls=function(element){arguments.callee.prototype.apply(this,[]);this.owner=element;this.owner.addElementListener(this);this.createButtons();this.updateLayout();this.updateInfo()};this.getMinWidth=function(){return 170};this.onElementChanged=function(){this.updateLayout()};this.close=override(this.close,function(){this.owner.removeElementListener(this);arguments.callee.prototype.apply(this,[])});this.createButtons=function(){with(core.ui){this.showComments=new Link(this);this.showComments.addStyleName("ShowCommentsLink");this.showComments.onclick=this.onShowComments;this.showComments.setText("Loading...");this.addComment=new Link(this);this.addComment.addStyleName("AddCommentLink");this.addComment.onclick=this.onAddComment;this.addComment.setText("Add&nbsp;comment")}};this.updateInfo=function(){core.ajax.sendRequest("ajax.CountComments",this.onServerResponse,{"pageId":common.util.MemorialUtils.getPageId(),"elementId":ObjectComments.getInstance().getElementId(this.owner)});this.countingComments=true;this.showComments.setText("Loading...")};this.updatePosition=function(){var root=this.getElement();root.parentNode.removeChild(root);if(this.owner.getElement().nextSibling){this.owner.getElement().parentNode.insertBefore(root,this.owner.getElement().nextSibling)}else{this.owner.getElement().parentNode.appendChild(root)}};this.updateLayout=function(){if(this.owner.isInEditMode()){if(this.prevPosition!=this.owner.getPosition()){this.updatePosition();this.prevPosition=this.owner.getPosition()}}else{this.updatePosition()}this.setVisible(this.owner.isVisible());this.setStyle("z-index",this.owner.getStyle("z-index"));if(this.owner.getWidth()>this.getMinWidth()){this.move(this.owner.getX(),this.owner.getY()+this.owner.getHeight());this.resize(this.owner.getWidth(),this.getHeight())}else{var offset=(this.getMinWidth()-this.owner.getWidth())/2;this.move(this.owner.getX()-offset,this.owner.getY()+this.owner.getHeight());this.resize(this.getMinWidth(),this.getHeight())}};this.onAddComment=callback(this,function(event){var dialog=ObjectComments.getInstance().getAddCommentDialog();dialog.setOwner(this.owner);dialog.reset();dialog.center();dialog.doModal();event.stop();event.cancel()});this.onShowComments=callback(this,function(event){if(!this.countingComments){var dialog=ObjectComments.getInstance().getViewCommentsDialog();dialog.setCommentId(null);dialog.setOwner(this.owner);dialog.center();dialog.doModal()}event.stop();event.cancel()});this.onServerResponse=callback(this,function(response){if((response.status=="OK")&&(response.count>0)){this.countingComments=false}this.showComments.setText("Comments&nbsp;("+(response.count?response.count:"0")+")")})}}ClassFactory.createPackage("editor.plugins.comments");ClassFactory.createClass(editor.plugins.comments,"AddCommentDialog");with(editor.plugins.comments){editor.plugins.comments.AddCommentDialog.superClass=editor.ui.MessageDialog;editor.plugins.comments.AddCommentDialog.constructor=function(){this.notifyAdded=new core.ui.Notification();this.setOwner=function(A){this.owner=A};this.submitClicked=override(this.submitClicked,function(){core.ajax.sendRequest("ajax.AddComment",this.onCommentAdded,{"pageId":common.util.MemorialUtils.getPageId(),"elementId":ObjectComments.getInstance().getElementId(this.owner),"name":this.name.getText(),"email":this.mail.getText(),"text":this.text.getText()})});this.onCommentAdded=callback(this,function(A){if(A.status=="OK"){alert("Your message was added.");ObjectComments.getInstance().update(this.owner);this.notifyAdded.send(this);this.endModal()}})}}ClassFactory.createPackage("common.util");ClassFactory.createClass(common.util,"DateUtils");with(common.util){common.util.DateUtils.constructor=function(){};common.util.DateUtils.formatInt=function(A){return(A>=0&&A<10?"0":"")+A};common.util.DateUtils.dateToInt=function(A){return(A.indexOf("0")==0)?parseInt(A.substr(A.indexOf("0")+1)):parseInt(A)};common.util.DateUtils.getMonth=function(A){if(!A){return false}var B=A.indexOf("/",0);var C=this.dateToInt(A.substring(0,B));if(B<0){B=A.indexOf("-",0);j=A.indexOf("-",B+1);C=this.dateToInt(A.substring(B+1,j))}return C};common.util.DateUtils.getYear=function(B){if(!B){return false}var C=B.indexOf("/",0);var A=B.indexOf("/",C+1);var D=this.dateToInt(B.substring(A+1));if(C<0){C=B.indexOf("-",0);A=B.indexOf("-",C+1);D=this.dateToInt(B.substring(0,C))}return D};common.util.DateUtils.getDay=function(C){if(!C){return false}var D=C.indexOf("/",0);var B=C.indexOf("/",D+1);var A=this.dateToInt(C.substring(D+1,B));if(D<0){D=C.indexOf("-",0);B=C.indexOf("-",D+1);A=this.dateToInt(C.substring(B+1))}return A};common.util.DateUtils.toServerDate=function(C,E){if(!C){return false}date=new Date(C);var B=this.formatInt(date.getDate());var G=this.formatInt(date.getMonth()+1);var D=date.getFullYear();var A=this.formatInt(date.getHours());var H=this.formatInt(date.getMinutes());var F="";E=defined(E)?E:false;if(E){F=D+"-"+G+"-"+B+" "+A+":"+min}else{F=D+"-"+G+"-"+B}return F};common.util.DateUtils.toClientDate=function(C,F){if(!C){return false}date=new Date(C);var B=this.formatInt(date.getDate());var G=this.formatInt(date.getMonth()+1);var E=date.getFullYear();var A=this.formatInt(date.getHours());var H=this.formatInt(date.getMinutes());var D="";F=defined(F)?F:false;if(F){D=G+"/"+B+"/"+E+" "+A+":"+H}else{D=G+"/"+B+"/"+E}return D};common.util.DateUtils.toMilliseconds=function(B){if(!B){return false}var C=new Date(this.getYear(B),this.getMonth(B)-1,this.getDay(B));var A=Date.parse(C.toString());return A};common.util.DateUtils.server2client=function(B){var A=this.toMilliseconds(B);return this.toClientDate(A)};common.util.DateUtils.client2server=function(B){var A=this.toMilliseconds(B);return this.toServerDate(A)};common.util.DateUtils.timestamp2millisec=function(A){if(!A){return null}return A*1000};common.util.DateUtils.getSeconds=function(A){return this.formatInt((A%60).toFixed())};common.util.DateUtils.getMinutes=function(A){return this.formatInt(parseInt(A/60))};common.util.DateUtils.exist=function(A){if(this.getMonth(A)>12){return false}else{if(this.getDay(A)>31){return false}else{if(this.toClientDate(this.toMilliseconds(A))!=A){return false}}}return true}}ClassFactory.createPackage("editor.ui");ClassFactory.createClass(editor.ui,"Grid");with(editor.ui){editor.ui.Grid.superClass=core.ui.Window;editor.ui.Grid.constructor=function(){this.Grid=function(){arguments.callee.prototype.apply(this,[null,0,0,"100%","100%"]);this.setStyle("z-index",0);core.ui.Window.notifyResize.addListener(this.onUpdateLayout);core.ui.Window.notifyScroll.addListener(this.onUpdateLayout)};this.close=override(this.close,function(){core.ui.Window.notifyResize.removeListener(this.onUpdateLayout);core.ui.Window.notifyScroll.removeListener(this.onUpdateLayout);arguments.callee.prototype.apply(this,[])});this.onUpdateLayout=callback(this,function(){this.resize(core.ui.Window.getWidth(),core.ui.Window.getHeight())})};editor.ui.Grid.SIZE=10}ClassFactory.createPackage("core.util");ClassFactory.createClass(core.util,"ArrayList");with(core.util){core.util.ArrayList.constructor=function(){this.ArrayList=function(A){this.elements=A||[]};this.add=function(A){this.elements.push(A)};this.indexOf=function(A){for(var B=0;B<this.elements.length;B++){if(A===this.elements[B]){return B}}return -1};this.get=function(A){return this.elements[A]};this.size=function(){return this.elements.length};this.clear=function(){delete this.elements;this.elements=[]};this.iterator=function(){return new Iterator(this.elements)};this.toArray=function(){return this.elements}}}ClassFactory.createPackage("core.util");ClassFactory.createClass(core.util,"HashMap");with(core.util){core.util.HashMap.constructor=function(){this.HashMap=function(A){this.elements=A||{};this.elementCount=0};this.set=function(A,B){if(!this.hasKey(A)){this.elementCount++}this.elements[A]=B};this.get=function(A){return this.elements[A]};this.remove=function(A){if(this.hasKey(A)){delete this.elements[A];this.elementCount--}};this.hasKey=function(A){return defined(this.elements[A])};this.clear=function(){delete this.elements;this.elements={}};this.size=function(){return this.elementCount};this.getKeys=function(){var B=new OrderedSet();for(var A in this.elements){B.add(A)}return B};this.getValues=function(){var B=new ArrayList();for(var A in this.elements){B.add(this.elements[A])}return B};this.toObject=function(){return this.elements}}}ClassFactory.createPackage("editor.ui");ClassFactory.createClass(editor.ui,"AbstractSelection");with(editor.ui){editor.ui.AbstractSelection.superClass=core.ui.FocusWindow;editor.ui.AbstractSelection.constructor=function(){this.target;this.listeners=new core.util.Listeners();this.AbstractSelection=function(A){arguments.callee.prototype.apply(this,[]);this.target=A};this.setTarget=function(A){this.target=A};this.getTarget=function(){return this.target};this.addSelectionListener=function(A){this.listeners.add(A)};this.removeSelectionListener=function(A){this.listeners.remove(A)};this.select=function(){this.show();this.fireSelected()};this.unselect=function(){this.hide();this.fireUnselected()};this.isSelected=function(){return this.isVisible()};this.updateLayout=function(){};this.fireSelected=function(){this.listeners.call("onElementSelected",[this])};this.fireUnselected=function(){this.listeners.call("onElementUnselected",[this])}}}ClassFactory.createPackage("editor.ui");ClassFactory.createClass(editor.ui,"SelectionManager");with(editor.ui){editor.ui.SelectionManager.constructor=function(){this.selections=new core.util.HashMap();this.listeners=new core.util.Listeners();this.SelectionManager=function(){editor.Application.getInstance().addAppListener(this)};this.addSelectionListener=function(A){this.listeners.add(A)};this.removeSelectionListener=function(A){this.listeners.remove(A)};this.isSelected=function(A){return this.selections.hasKey(A.getId())};this.hasSelection=function(){return(this.selections.size()>0)};this.setSelection=function(A){this.clearSelection();return this.addSelection(A)};this.addSelection=function(B){if(!this.isSelected(B)){this.selections.set(B.getId(),B.createSelection());this.fireSelectionChange(B)}var A=this.selections.get(B.getId());A.select();return A};this.removeSelection=function(B){if(this.isSelected(B)){var A=this.getSelection(B);this.selections.remove(B.getId());if(A.isSelected()){A.unselect();this.fireSelectionChange(B)}}};this.getSelection=function(A){return this.selections.get(A.getId())};this.updateSelection=function(){for(var A=this.selections.getValues().iterator();A.hasNext();A.next()){A.current().select()}};this.clearSelection=function(D){if(D){this.elements=this.getSelectedElements()}for(var C=this.selections.getValues().iterator();C.hasNext();C.next()){var A=C.current();if(A.isSelected()){var B=A.getTarget();A.unselect();this.selections.remove(B.getId());this.fireSelectionChange(B)}}};this.restoreSelection=function(){if((this.elements&&(this.elements.constructor===core.util.ArrayList||defined(this.elements.constructor.isSubclassOf)&&this.elements.constructor.isSubclassOf(core.util.ArrayList)))){for(var A=this.elements.iterator();A.hasNext();A.next()){this.addSelection(A.current())}delete this.elements}};this.getSelectedElements=function(){var A=[];for(var B=this.selections.getValues().iterator();B.hasNext();B.next()){A.push(B.current().getTarget())}return new core.util.ArrayList(A)};this.handleMove=function(C,A,D){for(var E=this.selections.getValues().iterator();E.hasNext();E.next()){var B=E.current();if(B!==D){B.move(B.getX()+C,B.getY()+A)}}};this.fireSelectionChange=function(A){this.listeners.call("onElementSelectionChange",[this,A])};this.onAppClear=function(){this.clearSelection()};this.onAppModeChanged=function(B){for(var A=this.selections.getValues().iterator();A.hasNext();A.next()){A.current().setVisible(B.getMode()===editor.Application.MODE_EDIT)}}};editor.ui.SelectionManager.get=function(){if(!defined(this.instance)){this.instance=new SelectionManager()}return this.instance}}ClassFactory.createPackage("editor.commands");ClassFactory.createClass(editor.commands,"CommandHistory");with(editor.commands){editor.commands.CommandHistory.constructor=function(){this.commands=new core.util.ArrayList();this.listeners=new core.util.Listeners();this.CommandHistory=function(){this.commandIndex=-1;editor.Application.getInstance().addAppListener(this)};this.addHistoryListener=function(A){this.listeners.add(A)};this.removeHistoryListener=function(A){this.listeners.remove(A)};this.execute=function(A){this.commands.toArray().splice(this.commandIndex+1);A.execute();this.commands.add(A);if(++this.commandIndex>CommandHistory.MAX_SIZE-1){this.commands.toArray().shift()}this.fireChanged()};this.getUndoCommands=function(){return new core.util.ArrayList(this.commands.toArray().slice(0,this.commandIndex+1))};this.getRedoCommands=function(){return new core.util.ArrayList(this.commands.toArray().slice(this.commandIndex+1))};this.canUndo=function(){return(this.commandIndex>=0)};this.canRedo=function(){return(this.commandIndex<(this.commands.size()-1))};this.undo=function(){if(this.canUndo()){this.commands.get(this.commandIndex--).unexecute();this.fireChanged()}};this.redo=function(){if(this.canRedo()){this.commands.get(++this.commandIndex).execute();this.fireChanged()}};this.fireChanged=function(){this.listeners.call("onHistoryChanged",[this])};this.onAppClear=function(){this.commandIndex=-1;this.commands.clear();this.fireChanged()}};editor.commands.CommandHistory.get=function(){if(!defined(this.instance)){this.instance=new CommandHistory()}return this.instance};editor.commands.CommandHistory.MAX_SIZE=10}ClassFactory.createPackage("editor.commands");ClassFactory.createClass(editor.commands,"AbstractCommand");with(editor.commands){editor.commands.AbstractCommand.constructor=function(){this.AbstractCommand=function(B,A){this.target=B;this.name=A};this.setTarget=function(A){this.target=A};this.getTarget=function(){return this.target};this.getName=function(){return this.name};this.setName=function(A){this.name=A};this.execute=function(){};this.unexecute=function(){}}}ClassFactory.createPackage("editor.commands");ClassFactory.createClass(editor.commands,"RemoveObjectsGroupCommand");with(editor.commands){editor.commands.RemoveObjectsGroupCommand.superClass=editor.commands.AbstractCommand;editor.commands.RemoveObjectsGroupCommand.constructor=function(){}}ClassFactory.createPackage("editor.ui");ClassFactory.createClass(editor.ui,"MultipleSelection");with(editor.ui){editor.ui.MultipleSelection.superClass=core.ui.Window;editor.ui.MultipleSelection.constructor=function(){this.startX;this.startY;this.ctrlPressed=false;this.selectionInProgress=false;this.keyEventsAttached=false;this.MultipleSelection=function(){arguments.callee.prototype.apply(this,[]);this.setStyle("position","absolute");this.setStyle("z-index",1024);this.resize(0,0);this.hide()};this.elementsIntersected=function(r1,r2){var left1=r1.getX();var left2=r2.getX();var min=left1>left2?left1:left2;var right1=r1.getX()+r1.getWidth();var right2=r2.getX()+r2.getWidth();var max=right1<right2?right1:right2;if(min>max){return false}var top1=r1.getY();var top2=r2.getY();min=top1>top2?top1:top2;var bottom1=r1.getY()+r1.getHeight();var bottom2=r2.getY()+r2.getHeight();max=bottom1<bottom2?bottom1:bottom2;return min<=max};this.deleteSelection=function(){with(editor.commands){CommandHistory.get().execute(new RemoveObjectsGroupCommand())}};this.collectSelectedObjects=function(){if((this.getWidth()>0)&&(this.getHeight()>0)){var i=editor.Application.getInstance().getCollection().iterator();while(i.hasNext()){var element=i.next();if(this.elementsIntersected(this,element)&&(element.getStyle("z-index")>0)){editor.ui.SelectionManager.get().addSelection(element).setFocus(true)}}}};this.onWorkspaceMouseMove=function(subject,event){if(!this.selectionInProgress){return }if(!this.isVisible()){this.show()}var x=event.getX();var y=event.getY();var width=this.startX-x;var height=this.startY-y;if(width>0){this.move(x,this.getY())}if(height>0){this.move(this.getX(),y)}this.resize(Math.abs(width),Math.abs(height))};this.onWorkspaceMouseUp=function(){this.hide();this.selectionInProgress=false;this.attachGlobalEvent("keydown");if(this.getWidth()>2||this.getHeight()>2){this.collectSelectedObjects()}this.resize(0,0)};this.onWorkspaceMouseDown=function(subject,event){this.selectionInProgress=true;this.detachGlobalEvent("keydown");this.startX=event.getX();this.startY=event.getY();this.move(this.startX,this.startY);this.show()};this.onkeydown=function(event){if(core.ui.Event.KEY_DELETE==event.keyCode){this.deleteSelection()}};this.close=override(this.close,function(){this.detachGlobalEvent("keydown");editor.Application.getInstance().getWorkspace().removeMouseListener(this);arguments.callee.prototype.apply(this,[])})}}ClassFactory.createPackage("editor");ClassFactory.createClass(editor,"Workspace");with(editor){editor.Workspace.constructor=function(){this.mouseListeners=new core.util.Listeners();this.addMouseListener=function(A){this.mouseListeners.add(A)};this.removeMouseListener=function(A){this.mouseListeners.remove(A)};this.init=function(){editor.Application.getInstance().addAppListener(this);this.grid=new editor.ui.Grid();this.selection=new editor.ui.MultipleSelection();this.map={"mouseup":"onWorkspaceMouseUp","mousedown":"onWorkspaceMouseDown","mousemove":"onWorkspaceMouseMove"};for(var A in this.map){core.ui.Event.addListener(document.documentElement,A,this.onDocumentMouseEvent)}};this.isGridVisible=function(){return this.grid.isVisible()};this.setGridVisible=function(A){this.grid.setVisible(A)};this.setTitle=function(A){window.document.title=A};this.getTitle=function(){return window.document.title};this.onAppModeChanged=function(A){if(editor.Application.MODE_PREVIEW===A.getMode()){editor.ui.VisibilityManager.hide(this.selection,this.grid)}else{editor.ui.VisibilityManager.restore(this.selection,this.grid)}};this.onDocumentMouseEvent=callback(this,function(A){A=core.ui.Event.improve(A);if("mousedown"==A.getType()){if((document.body!=A.target)&&(document.documentElement!=A.target)&&(this.grid.getElement()!=A.target)){return }}this.mouseListeners.call(this.map[A.getType()],[this,A])})}}ClassFactory.createPackage("editor");ClassFactory.createClass(editor,"SaveContext");with(editor){editor.SaveContext.superClass=core.util.HashMap;editor.SaveContext.constructor=function(){this.SaveContext=function(A){arguments.callee.prototype.apply(this,[]);this.url=A};this.setUrl=function(A){this.url=A};this.getUrl=function(){return this.url}}}ClassFactory.createPackage("core.ui");ClassFactory.createClass(core.ui,"Menu");with(core.ui){core.ui.Menu.superClass=core.ui.Window;core.ui.Menu.constructor=function(){this.origin;this.items=[];this.popupinfo={};this.notifyEndPopup=new Notification();this.Menu=function(B,A,E,C,D){arguments.callee.prototype.apply(this,[B,A,E,C,D]);this.setStyle("overflow","visible")};this.doPopup=function(B,A,C){this.origin=B;if(defined(A)&&defined(C)){this.move(A,C)}this.attachGlobalEvent("mousedown");this.attachGlobalEvent("keydown");this.popupinfo.popupState=true;this.activate();this.show()};this.endPopup=function(){if(this.popupinfo.popupState){delete this.origin;this.popupinfo.popupState=false;this.detachGlobalEvent("mousedown");this.detachGlobalEvent("keydown");this.notifyEndPopup.send(this);this.hide()}};this.isPopup=function(A){if(this.popupinfo.popupState){if(defined(A)){return(this.origin==A)}return true}return false};this.getOrigin=function(){return this.origin};this.addItem=function(A){this.items.push(A);return A};this.getItem=function(A){return this.items[A]};this.getItemCount=function(){return this.items.length};this.removeItem=function(A){this.items[A].close();delete this.items[A];this.items.splice(A,1)};this.removeItems=function(){while(this.items.length>0){var A=this.items.pop();A.close();delete A}};this.ensureVisible=function(A){this.getElement().scrollTop=this.items[A].getY()};this.onmousedown=function(A,B){if((B&&(B.constructor===Window||defined(B.constructor.isSubclassOf)&&B.constructor.isSubclassOf(Window)))){if((B==this)||B.isChildOf(this)||this.isChildOf(B)){return }if(((this.origin&&(this.origin.constructor===Window||defined(this.origin.constructor.isSubclassOf)&&this.origin.constructor.isSubclassOf(Window))))&&((B==this.origin)||B.isChildOf(this.origin))){return }while(B.isChild()){B=B.getParent()}if(((B&&(B.constructor===Menu||defined(B.constructor.isSubclassOf)&&B.constructor.isSubclassOf(Menu))))&&B.isPopup()){return }}this.endPopup()};this.onkeydown=function(A){if(Event.KEY_ESCAPE==A.keyCode){this.endPopup()}}}}ClassFactory.createPackage("core.ui");ClassFactory.createClass(core.ui,"MenuItem");with(core.ui){core.ui.MenuItem.superClass=core.ui.FocusWindow;core.ui.MenuItem.constructor=function(){}}ClassFactory.createPackage("core.ui");ClassFactory.createClass(core.ui,"CompositeWindow");with(core.ui){core.ui.CompositeWindow.superClass=core.ui.Window;core.ui.CompositeWindow.constructor=function(){this.updateLayout=function(){};this.resize=override(this.resize,function(A,B){arguments.callee.prototype.apply(this,[A,B]);this.updateLayout()});this.setStyle=override(this.setStyle,function(A,B){arguments.callee.prototype.apply(this,[A,B]);this.updateLayout()});this.setStyleId=override(this.setStyleId,function(A){arguments.callee.prototype.apply(this,[A]);this.updateLayout()});this.setStyleName=override(this.setStyleName,function(A){arguments.callee.prototype.apply(this,[A]);this.updateLayout()});this.addStyleName=override(this.addStyleName,function(A){arguments.callee.prototype.apply(this,[A]);this.updateLayout()});this.removeStyleName=override(this.removeStyleName,function(A){arguments.callee.prototype.apply(this,[A]);this.updateLayout()});this.clearStyleName=override(this.clearStyleName,function(){arguments.callee.prototype.apply(this,[]);this.updateLayout()})}}ClassFactory.createPackage("core.ui");ClassFactory.createClass(core.ui,"DragWindow");with(core.ui){core.ui.DragWindow.superClass=core.ui.Handle;core.ui.DragWindow.constructor=function(){this.DragWindow=function(B,A,E,C,D){arguments.callee.prototype.apply(this,[B,A,E,C,D]);this.setDragWindow(this)}}}ClassFactory.createPackage("core.ui");ClassFactory.createClass(core.ui,"Slider");with(core.ui){core.ui.Slider.superClass=core.ui.FocusWindow;core.ui.Slider.constructor=function(){this.indicator;this.vertical=false;this.pos=0;this.min=0;this.max=100;this.notifyPositionChanged=new Notification();this.Slider=function(B,A,E,C,D){arguments.callee.prototype.apply(this,[B,A,E,C,D]);this.indicator=new DragWindow(this);this.indicator.setStyleName("Indicator");this.indicator.setDirection(Handle.DIRECTION_EAST|Handle.DIRECTION_WEST);this.indicator.notifyDrag.addListener(this.onIndicatorDrag);this.setVertical(false);core.ui.quirks.TextSelection.preventSelection(this.getElement())};this.setRange=function(B,A){this.min=B;this.max=A};this.getRangeMin=function(){return this.min};this.getRangeMax=function(){return this.max};this.setPos=function(C){if(C<this.min){this.setPos(this.min)}else{if(C>this.max){this.setPos(this.max)}else{this.pos=C}}if(this.isVertical()){var B=this.getClientHeight()-this.indicator.getHeight()-(this.pos-this.min)/(this.max-this.min)*(this.getClientHeight()-this.indicator.getHeight());this.indicator.setStyle("left","auto");this.indicator.setStyle("top",B+"px")}else{var A=(this.pos-this.min)/(this.max-this.min)*(this.getClientWidth()-this.indicator.getWidth());this.indicator.setStyle("left",A+"px");this.indicator.setStyle("top","auto")}};this.getPos=function(){return this.pos};this.setVertical=function(A){this.removeStyleName(this.getStyleName()+(this.vertical?"-vertical":"-horisontal"));this.vertical=A;this.addStyleName(this.getStyleName()+(this.vertical?"-vertical":"-horisontal"));this.indicator.setDirection(this.isVertical()?Handle.DIRECTION_NORTH|Handle.DIRECTION_SOUTH:Handle.DIRECTION_EAST|Handle.DIRECTION_WEST);this.setPos(this.pos)};this.isVertical=function(){return this.vertical};this.getProgressIndicator=function(){return this.indicator};this.getPositionByCoords=function(A,C){var B=(this.isVertical())?this.max-Math.floor(C/(this.getClientHeight()-this.indicator.getHeight())*(this.max-this.min)):this.min+Math.floor(A/(this.getClientWidth()-this.indicator.getWidth())*(this.max-this.min));if(B<this.min){return this.min}else{if(B>this.max){return this.max}else{return B}}};this.onIndicatorDrag=callback(this,function(){var A=this.getPositionByCoords(this.indicator.getX(),this.indicator.getY());if((this.min==A)||(this.max==A)){this.setPos(A)}else{this.pos=A}this.notifyPositionChanged.send(this,this.pos)});this.onmousedown=function(A,C){if(this==C){var B=this.getPositionByCoords(A.getX()-this.getAbsX()-this.indicator.getWidth()/2,A.getY()-this.getAbsY()-this.indicator.getHeight()/2);this.setPos(B);this.notifyPositionChanged.send(this,B)}};this.onkeypress=function(A){var C=(this.max-this.min)/100;var B=false;if(this.isVertical()){if(Event.KEY_UP_ARROW==A.keyCode){this.setPos(this.getPos()+C);B=true}else{if(Event.KEY_DOWN_ARROW==A.keyCode){this.setPos(this.getPos()-C);B=true}}}else{if(Event.KEY_LEFT_ARROW==A.keyCode){this.setPos(this.getPos()-C);B=true}else{if(Event.KEY_RIGHT_ARROW==A.keyCode){this.setPos(this.getPos()+C);B=true}}}this.notifyPositionChanged.send(this,this.pos);if(B){A.cancel()}}}}ClassFactory.createPackage("core.ui");ClassFactory.createClass(core.ui,"ScrollBar");with(core.ui){core.ui.ScrollBar.superClass=core.ui.Window;core.ui.ScrollBar.constructor=function(){this.orienation=ScrollBar.VERTICAL;this.step=0;this.target;this.backwardButton;this.forwardButton;this.slider;this.ScrollBar=function(B,A,E,C,D){arguments.callee.prototype.apply(this,[B,A,E,C,D]);this.backwardButton=new ImageButton(this);this.backwardButton.setStyleName("BackwardButton");this.backwardButton.setStyle("position","absolute");this.backwardButton.onmousedown=this.onBackwardMouseDown;this.slider=new Slider(this);this.slider.setStyle("position","absolute");this.slider.notifyPositionChanged.addListener(this.onSliderPositionChanged);this.forwardButton=new ImageButton(this);this.forwardButton.setStyleName("ForwardButton");this.forwardButton.setStyle("position","absolute");this.forwardButton.onmousedown=this.onForwardMouseDown;this.setOrientation(ScrollBar.VERTICAL);Event.addListener(this.getElement(),"resize",this.onResize)};this.setOrientation=function(A){this.removeStyleName(this.getStyleName()+"-"+(this.isVertical()?"vertical":"horisontal"));this.orientation=A;this.addStyleName(this.getStyleName()+"-"+(this.isVertical()?"vertical":"horisontal"));this.slider.setVertical(this.isVertical());this.backwardButton.setStyle("left","0px");this.backwardButton.setStyle("top","0px");this.forwardButton.setStyle("left",this.isVertical()?"0px":"");this.forwardButton.setStyle("right",this.isVertical()?"":"0px");this.forwardButton.setStyle("top",this.isVertical()?"":"0px");this.forwardButton.setStyle("bottom",this.isVertical()?"0px":"");this.slider.setStyle("left",this.isVertical()?"0px":"");this.slider.setStyle("top",this.isVertical()?"":"0px");this.updateLayout()};this.getOrientation=function(){return this.orientation};this.isVertical=function(){return(ScrollBar.VERTICAL==this.orientation)};this.setPosition=function(A){A=Math.max(A,0);A=Math.min(A,100);this.slider.setPos(this.isVertical()?100-A:A);this.updateTarget(A)};this.getPosition=function(){var A=this.slider.getPos();return this.isVertical()?100-A:A};this.setScrollTarget=function(A){this.target=A;this.target.setStyle("overflow-"+(this.isVertical()?"y":"x"),"hidden");this.updateLayout()};this.getScrollTarget=function(){return this.target};this.getBackwardButton=function(){return this.backwardButton};this.getForwardButton=function(){return this.forwardButton};this.getSliderControl=function(){return this.slider};this.updateLayout=function(){if((this.target&&(this.target.constructor===Window||defined(this.target.constructor.isSubclassOf)&&this.target.constructor.isSubclassOf(Window)))){if(this.isVertical()){this.slider.setStyle("top",this.backwardButton.getHeight()+"px");this.slider.setStyle("height",Math.max(this.getClientHeight()-this.backwardButton.getHeight()-this.forwardButton.getHeight(),0)+"px");var B=(this.target.getElement().scrollHeight>0)?this.slider.getClientHeight()*this.target.getClientHeight()/this.target.getElement().scrollHeight:0;this.slider.indicator.setStyle("height",Math.max(B,8)+"px");var C=this.target.getElement().scrollTop/(this.target.getElement().scrollHeight-this.target.getHeight())*100}else{this.slider.setStyle("left",this.backwardButton.getWidth()+"px");this.slider.setStyle("width",Math.max(this.getClientWidth()-this.backwardButton.getWidth()-this.forwardButton.getWidth(),0)+"px");var A=(this.target.getElement().scrollWidth>0)?this.slider.getClientWidth()*this.target.getClientWidth()/this.target.getElement().scrollWidth:0;this.slider.indicator.setStyle("width",Math.max(A,8)+"px");var C=this.target.getElement().scrollLeft/(this.target.getElement().scrollWidth-this.target.getWidth())*100}this.setPosition(isNaN(C)?0:C)}};this.updateTarget=function(A){if((this.target&&(this.target.constructor===Window||defined(this.target.constructor.isSubclassOf)&&this.target.constructor.isSubclassOf(Window)))){if(this.isVertical()){this.target.getElement().scrollTop=(this.target.getElement().scrollHeight-this.target.getHeight())*A/100}else{this.target.getElement().scrollLeft=(this.target.getElement().scrollWidth-this.target.getWidth())*A/100}}};this.doScroll=callback(this,function(){if(0!=this.step){this.setPosition(this.getPosition()+this.step);window.setTimeout(this.doScroll,50)}});this.onSliderPositionChanged=callback(this,function(A,B){this.updateTarget(this.isVertical()?100-B:B)});this.onBackwardMouseDown=callback(this,function(){this.attachGlobalEvent("mouseup");this.backwardButton.setState(ImageButton.STATE_PRESSED);this.setPosition(this.getPosition()+(this.step=-3));window.setTimeout(this.doScroll,600)});this.onForwardMouseDown=callback(this,function(){this.attachGlobalEvent("mouseup");this.forwardButton.setState(ImageButton.STATE_PRESSED);this.setPosition(this.getPosition()+(this.step=3));window.setTimeout(this.doScroll,600)});this.onResize=callback(this,function(){this.updateLayout()});this.onmouseup=callback(this,function(){this.detachGlobalEvent("mouseup");this.step=0})};core.ui.ScrollBar.HORISONTAL=1;core.ui.ScrollBar.VERTICAL=2}ClassFactory.createPackage("core.ui");ClassFactory.createClass(core.ui,"SplitWindow");with(core.ui){core.ui.SplitWindow.superClass=core.ui.CompositeWindow;core.ui.SplitWindow.constructor=function(){this.panes={};this.splitLeft;this.splitRight;this.splitTop;this.splitBottom;this.SplitWindow=function(B,A,E,C,D){arguments.callee.prototype.apply(this,[B,A,E,C,D]);this.updateLayout()};this.addPane=function(A,B){A.setStyle("position","absolute");A.setStyle("float","none");this.adjustPane(A,B);this.panes[A.getId()]=B};this.adjustPane=function(B,D){var A=this.splitLeft;var C=this.splitTop;if(defined(D)){if(D&SplitWindow.SPLIT_LEFT){this.splitLeft+=B.getWidth()}if(D&SplitWindow.SPLIT_TOP){this.splitTop+=B.getHeight()}if(D&SplitWindow.SPLIT_RIGHT){this.splitRight-=B.getWidth();A=this.splitRight}if(D&SplitWindow.SPLIT_BOTTOM){this.splitBottom-=B.getHeight();C=this.splitBottom}if(D&SplitWindow.SPLIT_FILL){B.resize(Math.abs(this.splitRight-this.splitLeft),Math.abs(this.splitBottom-this.splitTop))}}B.move(A,C)};this.updateLayout=function(){this.splitLeft=0;this.splitTop=0;this.splitRight=this.getClientWidth();this.splitBottom=this.getClientHeight();for(var C in this.panes){var B=Window.forId(C);var A=this.panes[C];this.adjustPane(B,A)}}};core.ui.SplitWindow.SPLIT_LEFT=1;core.ui.SplitWindow.SPLIT_RIGHT=4;core.ui.SplitWindow.SPLIT_TOP=8;core.ui.SplitWindow.SPLIT_BOTTOM=16;core.ui.SplitWindow.SPLIT_FILL=64}ClassFactory.createPackage("core.ui");ClassFactory.createClass(core.ui,"ScrollWindow");with(core.ui){core.ui.ScrollWindow.superClass=core.ui.SplitWindow;core.ui.ScrollWindow.constructor=function(){this.vscroll;this.hscroll;this.content;this.ScrollWindow=function(parent,x,y,width,height){arguments.callee.prototype.apply(this,[parent,x,y,width,height]);this.vscroll=this.createScrollBar(0,0,undefined,"100%");this.hscroll=this.createScrollBar(0,0,"100%",undefined);this.hscroll.setOrientation(ScrollBar.HORISONTAL);this.addPane(this.hscroll,SplitWindow.SPLIT_BOTTOM);this.addPane(this.vscroll,SplitWindow.SPLIT_RIGHT);this.updateLayout()};this.createScrollBar=function(x,y,width,height){return new ScrollBar(this,x,y,width,height)};this.setText=function(text){if((this.content&&(this.content.constructor===Window||defined(this.content.constructor.isSubclassOf)&&this.content.constructor.isSubclassOf(Window)))){this.content.setText(text);this.updateLayout()}};this.getText=function(){return((this.content&&(this.content.constructor===Window||defined(this.content.constructor.isSubclassOf)&&this.content.constructor.isSubclassOf(Window))))?this.content.getText():""};this.ensureVisible=function(child){if(((this.content&&(this.content.constructor===Window||defined(this.content.constructor.isSubclassOf)&&this.content.constructor.isSubclassOf(Window))))&&((child&&(child.constructor===Window||defined(child.constructor.isSubclassOf)&&child.constructor.isSubclassOf(Window))))&&child.isChildOf(this.content)){with(this.content.getElement()){scrollLeft=child.getX();scrollTop=child.getY()}this.vscroll.updateLayout();this.hscroll.updateLayout()}};this.setContentWindow=function(wnd){wnd.setStyle("overflow","hidden");this.addPane(wnd,SplitWindow.SPLIT_FILL);this.vscroll.setScrollTarget(wnd);this.hscroll.setScrollTarget(wnd);this.content=wnd};this.getContentWindow=function(){return this.content};this.getVerticalScroll=function(){return this.vscroll};this.getHorisontalScroll=function(){return this.hscroll};this.updateLayout=override(this.updateLayout,function(){if((this.content&&(this.content.constructor===Window||defined(this.content.constructor.isSubclassOf)&&this.content.constructor.isSubclassOf(Window)))){var w,h;with(this.content.getElement()){this.vscroll.setStyle("display",(scrollHeight>offsetHeight)?"block":"none");this.hscroll.setStyle("display",(scrollWidth>offsetWidth)?"block":"none");h=(scrollWidth>offsetWidth)?(this.getClientHeight()-this.hscroll.getHeight()):this.getClientHeight();w=(scrollHeight>offsetHeight)?(this.getClientWidth()-this.vscroll.getWidth()):this.getClientWidth()}this.hscroll.setStyle("width",Math.max(w,0)+"px");this.vscroll.setStyle("height",Math.max(h,0)+"px");this.hscroll.updateLayout();this.vscroll.updateLayout()}arguments.callee.prototype.apply(this,[])});this.reset=function(){this.vscroll.setPosition(0);this.hscroll.setPosition(0);this.updateLayout()}}}ClassFactory.createPackage("core.ui");ClassFactory.createClass(core.ui,"ComboBoxMenu");with(core.ui){core.ui.ComboBoxMenu.superClass=core.ui.Menu;core.ui.ComboBoxMenu.constructor=function(){this.selectedItem;this.notifyItemSelected=new Notification();this.ComboBoxMenu=function(){arguments.callee.prototype.apply(this,[]);this.setStyle("overflow-y","auto");this.setStyle("display","none")};this.addItem=override(this.addItem,function(D,C,A){var B=new MenuItem(this);B.setStyleName("ComboBoxMenuItem");B.setStyle("overflow","hidden");B.setText(D);B.value=C;B.onmouseover=this.onItemMouseOver;B.onmouseout=this.onItemMouseOut;B.onclick=this.onItemClick;if(A){this.selectedItem=B}return arguments.callee.prototype.apply(this,[B])});this.removeItems=override(this.removeItems,function(){this.selectedItem=undefined;arguments.callee.prototype.apply(this,[])});this.setSelectedItem=function(A){if((this.selectedItem&&(this.selectedItem.constructor===Window||defined(this.selectedItem.constructor.isSubclassOf)&&this.selectedItem.constructor.isSubclassOf(Window)))){this.selectedItem.removeStyleName("ComboBoxMenuItem-selected")}A.addStyleName("ComboBoxMenuItem-selected");this.selectedItem=A};this.getSelectedItem=function(){return this.selectedItem};this.doPopup=override(this.doPopup,function(B,A,C){if((this.selectedItem&&(this.selectedItem.constructor===Window||defined(this.selectedItem.constructor.isSubclassOf)&&this.selectedItem.constructor.isSubclassOf(Window)))){this.selectedItem.addStyleName("ComboBoxMenuItem-selected")}this.setStyle("display","");arguments.callee.prototype.apply(this,[B,A,C])});this.endPopup=override(this.endPopup,function(){arguments.callee.prototype.apply(this,[]);this.setStyle("display","none")});this.onItemMouseOver=callback(this,function(B,A){if((this.selectedItem&&(this.selectedItem.constructor===Window||defined(this.selectedItem.constructor.isSubclassOf)&&this.selectedItem.constructor.isSubclassOf(Window)))){this.selectedItem.removeStyleName("ComboBoxMenuItem-selected")}A.addStyleName("ComboBoxMenuItem-highlight")});this.onItemMouseOut=callback(this,function(B,A){A.removeStyleName("ComboBoxMenuItem-highlight")});this.onItemClick=callback(this,function(B,A){this.setSelectedItem(A);this.notifyItemSelected.send(this,A)})}}ClassFactory.createPackage("core.ui");ClassFactory.createClass(core.ui,"ComboBox");with(core.ui){core.ui.ComboBox.superClass=core.ui.CompositeWindow;core.ui.ComboBox.constructor=function(){this.menu;this.text;this.dropDownButton;this.value;this.notifyValueChanged=new Notification();this.ComboBox=function(B,A,E,C,D){arguments.callee.prototype.apply(this,[B,A,E,C,D]);this.text=new Edit(this,0,0);this.text.setStyle("float","left");this.text.onkeypress=this.onTextKeyPress;this.dropDownButton=new ImageButton(this);this.dropDownButton.setStyleName("DropDownButton");this.dropDownButton.setState(ImageButton.STATE_NORMAL);this.dropDownButton.setStyle("float","right");this.dropDownButton.oncommand=this.onDropDownButtonClick;this.menu=this.createMenu();this.menu.notifyItemSelected.addListener(this.onMenuItemSelected);this.menu.notifyEndPopup.addListener(this.onMenuEndPopup);this.setEditable(false);this.updateLayout()};this.addItem=function(D,C,A){var B=this.menu.addItem(D,C);if(A){this.setText(D)}return B};this.insertItem=function(A,C,B){};this.removeItem=function(A){this.menu.removeItem(A)};this.removeItems=function(){this.menu.removeItems()};this.setText=function(A){this.text.setText(A)};this.getText=function(){return this.text.getText()};this.setValue=function(C){if(this.value==C){return }this.value=C;for(var A=0;A<this.menu.getItemCount();A++){var B=this.menu.getItem(A);if(C==B.value){this.menu.setSelectedItem(B);this.setText(B.getText());this.scrollTo(A)}}};this.getValue=function(){return this.value};this.getMenu=function(){return this.menu};this.getDropDownButton=function(){return this.dropDownButton};this.getEditControl=function(){return this.text};this.setEditable=function(A){this.text.setReadOnly(!A);this.text.setStyle("cursor",(A)?"text":"default");this.text.onclick=(A)?null:this.onDropDownButtonClick;this.text.onkeypress=(A)?this.onTextKeyPress:null;if(A){core.ui.quirks.TextSelection.allowSelection(this.text.getElement())}else{core.ui.quirks.TextSelection.preventSelection(this.text.getElement())}};this.isEditable=function(){return !this.text.isReadOnly()};this.scrollTo=function(A){this.menu.ensureVisible(A)};this.close=override(this.close,function(){this.menu.close();arguments.callee.prototype.apply(this,[])});this.expand=function(){this.addStyleName(this.getStyleName()+"-expanded");this.text.setSelected(true);this.menu.doPopup(this.isEditable()?this.dropDownButton:this,this.getAbsX(),this.getAbsY()+this.getHeight())};this.collapse=function(){this.menu.endPopup()};this.createMenu=function(){return new ComboBoxMenu()};this.updateLayout=function(){this.text.setStyle("width",(this.getClientWidth()-this.dropDownButton.getWidth())+"px");this.menu.setStyle("width",this.getWidth()+"px")};this.onDropDownButtonClick=callback(this,function(A){if(this.menu.isPopup()){this.collapse()}else{this.expand()}});this.onMenuEndPopup=callback(this,function(){this.removeStyleName(this.getStyleName()+"-expanded")});this.onMenuItemSelected=callback(this,function(A,B){this.menu.endPopup();this.setText(B.getText());this.setValue(B.value);this.text.setSelected(false);this.notifyValueChanged.send(this,B.value)});this.onTextKeyPress=callback(this,function(A){if(Event.KEY_ENTER==A.keyCode){this.value=this.text.getText();this.notifyValueChanged.send(this,this.value)}})}}ClassFactory.createPackage("core.ui");ClassFactory.createClass(core.ui,"Calendar");with(core.ui){core.ui.Calendar.superClass=core.ui.Menu;core.ui.Calendar.constructor=function(){this.format=Calendar.FORMAT_DEFAULT;this.startYear;this.endYear;this.day;this.month;this.year;this.monthList;this.yearList;this.notifyDateSelected=new Notification();this.Calendar=function(B,A,E,C,D){arguments.callee.prototype.apply(this,[B,A,E,C,D]);this.year=Calendar.currentYear;this.month=Calendar.currentMonth;this.day=Calendar.currentDay;this.startYear=Calendar.currentYear-5;this.endYear=Calendar.currentYear+5;this.createMonthList();this.createYearList();this.createGrid();this.updateData()};this.setDate=function(B,C,A){if(B){this.year=B}if(C){this.month=C}if(A){this.day=A}this.updateData()};this.setYear=function(A){this.year=A;this.updateData()};this.getYear=function(){return this.year};this.setMonth=function(A){this.month=A;this.updateData()};this.getMonth=function(){return this.month};this.setDay=function(A){this.day=A;this.updateData()};this.getDay=function(){return this.day};this.setYears=function(B,A){if(B){this.startYear=B}if(A){this.endYear=A}this.initYearList()};this.getStartYear=function(){return this.startYear};this.getEndYear=function(){return this.endYear};this.setFormat=function(A){this.format=A};this.getFormat=function(){return this.format};this.setFormattedDate=function(A,H){if(!defined(H)){H=this.format}if(Calendar.FORMAT_TIMESTAMP==H){var E=parseInt(A);if(isNaN(E)){throw new Error("Invalid `date` parameter ("+A+") (should be a timestamp)")}var D=new Date();D.setTime(E*1000);this.year=D.getFullYear();this.month=D.getMonth();this.day=D.getDay()}else{var G={"MM":"month","DD":"day","YYYY":"year"};for(var C in G){var B=H.indexOf(C);if(-1!=B){value=parseInt(A.substr(B,C.length).replace(/^0/,""));if(isNaN(value)){throw new Error("Invalid `date` parameter ("+A+")")}var F=G[C];if("year"==F){this.year=(value>100)?value:(2000+value)}else{this[F]=value}}}}this.updateData()};this.getFormattedDate=function(H){if(!defined(H)){H=this.format}if(Calendar.FORMAT_TIMESTAMP==H){return this.getTimestamp()}var E=this.year.toString();var G=(this.month<10)?"0"+this.month:this.month.toString();var B=(this.day<10)?"0"+this.day:this.day.toString();var C={"MM":G,"DD":B,"YYYY":E};for(var A in C){var D=new RegExp(A);var F=C[A];H=H.replace(D,F)}return H};this.getTimestamp=function(A){return(defined(A))?new Date(Date.UTC(this.year,this.month-1,this.day,-A)).getTime()/1000:new Date(Date.UTC(this.year,this.month-1,this.day)).getTime()/1000};this.getYearList=function(){return this.yearList};this.getMonthList=function(){return this.monthList};this.updateData=function(){var F=((this.year%4==0)&&(this.year%100!=0))||(this.year%400==0);var A=[31,F?29:28,31,30,31,30,31,31,30,31,30,31];var D=new Date(this.year,this.month-1).getDay();if(this.year<this.startYear){this.year=this.startYear}else{if(this.year>this.endYear){this.year=this.endYear}}var E,C;if(this.month>1){E=this.month-1;C=this.year}else{E=12;C=this.year-1}var H,I;if(this.month<12){H=this.month+1;I=this.year}else{H=1;I=this.year+1}for(var G=0,B=A[E-1]-D+1;G<D;G++){this.items[G].month=E;this.items[G].year=C;this.items[G].day=B+G}for(var G=D;G<A[this.month-1]+D;G++){this.items[G].year=this.year;this.items[G].month=this.month;this.items[G].day=G-D+1}for(var G=A[this.month-1]+D;G<42;G++){this.items[G].year=I;this.items[G].month=H;this.items[G].day=G-(A[this.month-1]+D)+1}this.updateControls()};this.updateControls=function(){this.yearList.setValue(this.year);this.monthList.setValue(this.month);for(var A=0;A<this.items.length;A++){var B=this.items[A];B.clearStyleName();if((B.year==this.year)&&(B.month==this.month)&&(B.day==this.day)){B.addStyleName("CalendarMenuItem-selected")}if((B.year==Calendar.currentYear)&&(B.month==Calendar.currentMonth)&&(B.day==Calendar.currentDay)){B.addStyleName("CalendarMenuItem-today")}if((B.year!=this.year)||(B.month!=this.month)){B.addStyleName("CalendarMenuItem-grayed")}if(A%7==0||A%7==6){B.addStyleName("CalendarMenuItem-holiday")}B.setText(B.day)}};this.createMonthList=function(){this.monthList=new ComboBox(this);this.monthList.addStyleName("CalendarMonthList");this.monthList.setStyle("float","left");this.monthList.notifyValueChanged.addListener(this.onMonthValueChanged);var A=["January","February","March","April","May","June","July","August","September","October","November","December"];for(var B=0;B<A.length;B++){this.monthList.addItem(A[B],B+1,(B==this.month-1))}};this.createYearList=function(){this.yearList=new ComboBox(this);this.yearList.addStyleName("CalendarYearList");this.yearList.setStyle("float","right");this.yearList.notifyValueChanged.addListener(this.onYearValueChanged);this.initYearList()};this.initYearList=function(){this.yearList.removeItems();for(var A=this.startYear;A<=this.endYear;A++){this.yearList.addItem(A.toString(),A,(A==this.year))}};this.createGrid=function(){var C=["Su","Mo","Tu","W","Th","Fr","Sa"];for(var A=0;A<C.length;A++){var B=new MenuItem(this);B.setStyleName("CalendarHeaderItem");B.setStyle("float","left");B.setText(C[A])}for(var A=0;A<42;A++){var B=new MenuItem(this);B.setStyleName("CalendarMenuItem");B.setStyle("float","left");B.onclick=this.onItemClick;B.onmouseover=this.onItemMouseOver;B.onmouseout=this.onItemMouseOut;this.addItem(B)}};this.onMonthValueChanged=callback(this,function(A,B){this.day=-1;this.month=B;this.updateData()});this.onYearValueChanged=callback(this,function(A,B){this.day=-1;this.year=B;this.updateData()});this.onItemClick=callback(this,function(B,A){this.day=A.day;if((this.month!=A.month)||(this.year!=A.year)){this.month=A.month;this.year=A.year;this.updateData()}else{this.updateControls()}this.notifyDateSelected.send(this,this.getFormattedDate())});this.onItemMouseOver=callback(this,function(B,A){A.addStyleName("CalendarMenuItem-highlight")});this.onItemMouseOut=callback(this,function(B,A){A.removeStyleName("CalendarMenuItem-highlight")})};core.ui.Calendar.currentYear=new Date().getFullYear();core.ui.Calendar.currentMonth=new Date().getMonth()+1;core.ui.Calendar.currentDay=new Date().getDate();core.ui.Calendar.FORMAT_TIMESTAMP="TIMESTAMP";core.ui.Calendar.FORMAT_DEFAULT="MM/DD/YYYY"}ClassFactory.createPackage("core.ui");ClassFactory.createClass(core.ui,"Frame");with(core.ui){core.ui.Frame.superClass=core.ui.Window;core.ui.Frame.constructor=function(){this.content;this.Frame=function(B,A,E,C,D){arguments.callee.prototype.apply(this,[B,A,E,C,D]);this.setStyle("overflow","visible")};this.setContentWindow=function(B){this.content=B;var A=this.getWidth()-this.getClientWidth()+B.getWidth();this.setStyle("width",A+"px")};this.getContentWindow=function(){return this.content};this.onmousedown=function(){this.activate()}}}ClassFactory.createPackage("editor.ui");ClassFactory.createClass(editor.ui,"PanelFrame");with(editor.ui){editor.ui.PanelFrame.superClass=core.ui.Frame;editor.ui.PanelFrame.constructor=function(){this.resizeinfo={};this.PanelFrame=function(parent){arguments.callee.prototype.apply(this,[parent]);with(core.ui){this.titleBar=new Handle(this);this.titleBar.setStyleName("TitleBar");this.titleBar.setDragWindow(this);this.title=new Static(this.titleBar);this.title.addStyleName("Title");this.resizeButton=new core.ui.ImageButton(this.titleBar);this.resizeButton.addStyleName("ResizeButton");this.resizeButton.setImageList("images/PanelFrame/minimize.gif");this.resizeButton.setToolTip("Minimize");this.resizeButton.oncommand=this.titleBar.ondblclick=this.onResizeButtonClick}};this.getTitleBar=function(){return this.titleBar};this.setTitle=function(text){this.title.setText(text)};this.getTitle=function(){return this.title.getText()};this.minimize=function(){this.resizeinfo.maxHeight=this.getHeight();this.setStyle("overflow","hidden");this.resize(this.getWidth(),this.titleBar.getHeight()+(this.getHeight()-this.getClientHeight()));this.resizeinfo.minimizedState=true};this.maximize=function(){this.setStyle("overflow","visible");this.resize(this.getWidth(),this.resizeinfo.maxHeight);this.resizeinfo.minimizedState=false};this.isMinimized=function(){return this.resizeinfo.minimizedState};this.onResizeButtonClick=callback(this,function(){if(this.isMinimized()){this.maximize();this.resizeButton.setImageList("images/PanelFrame/minimize.gif");this.resizeButton.setToolTip("Minimize")}else{this.minimize();this.resizeButton.setImageList("images/PanelFrame/maximize.gif");this.resizeButton.setToolTip("Maximize")}})}}ClassFactory.createPackage("core.ui.effect");ClassFactory.createClass(core.ui.effect,"BaseEffect");with(core.ui.effect){core.ui.effect.BaseEffect.constructor=function(){this.source;this.time=0;this.duration=100;this.interval=1;this.state=BaseEffect.STATE_READY;this.timerId;this.notifyStarted=new core.ui.Notification();this.notifyPaused=new core.ui.Notification();this.notifyResumed=new core.ui.Notification();this.notifyStopped=new core.ui.Notification();this.notifyFinished=new core.ui.Notification();this.BaseEffect=function(A,C,B){this.source=A;if(C){this.duration=C}if(B){this.interval=B}};this.play=function(C,A,B){if(C){this.duration=C}if(A){this.interval=A}if(BaseEffect.STATE_STARTED==this.state){return }if(BaseEffect.STATE_PAUSED==this.state){this.notifyResumed.send(this)}else{this.time=defined(B)?B:0;this.timerId=window.setTimeout(this.onTimer,this.interval);this.notifyStarted.send(this)}this.state=BaseEffect.STATE_STARTED};this.stop=function(){window.clearTimeout(this.timerId);this.state=BaseEffect.STATE_STOPPED;this.notifyStopped.send(this)};this.pause=function(){this.state=BaseEffect.STATE_PAUSED;this.notifyPaused.send(this)};this.finish=function(){window.clearTimeout(this.timerId);this.state=BaseEffect.STATE_FINISHED;this.notifyFinished.send(this)};this.playback=function(){};this.onTimer=callback(this,function(){if(BaseEffect.STATE_PAUSED==this.state){return }this.time+=this.interval;if(this.time>this.duration){this.finish()}else{this.playback();this.timerId=window.setTimeout(this.onTimer,this.interval)}})};core.ui.effect.BaseEffect.STATE_READY=1;core.ui.effect.BaseEffect.STATE_STARTED=2;core.ui.effect.BaseEffect.STATE_PAUSED=3;core.ui.effect.BaseEffect.STATE_STOPPED=4;core.ui.effect.BaseEffect.STATE_FINISHED=5}ClassFactory.createPackage("core.ui.effect");ClassFactory.createClass(core.ui.effect,"Blink");with(core.ui.effect){core.ui.effect.Blink.superClass=core.ui.effect.BaseEffect;core.ui.effect.Blink.constructor=function(){this.finish=override(this.finish,function(){this.source.setVisible(true);arguments.callee.prototype.apply(this,[])});this.playback=function(){this.source.setVisible(!this.source.isVisible())}}}ClassFactory.createPackage("editor.ui");ClassFactory.createClass(editor.ui,"DialogFrame");with(editor.ui){editor.ui.DialogFrame.superClass=core.ui.Frame;editor.ui.DialogFrame.constructor=function(){this.listeners=new core.util.Listeners();this.DialogFrame=function(parent){arguments.callee.prototype.apply(this,[parent]);with(core.ui){var titleBar=new Handle(this);titleBar.setStyleName("TitleBar");titleBar.setDragWindow(this);this.title=new Static(titleBar);this.title.addStyleName("Title");this.closeButton=new ImageButton(titleBar);this.closeButton.addStyleName("CloseButton");this.closeButton.setToolTip("Close");this.closeButton.setImageList("images/DialogFrame/close.gif");this.closeButton.oncommand=this.onCloseButtonClick;this.blinkEffect=new core.ui.effect.Blink(titleBar)}};this.addCloseListener=function(listener){this.listeners.add(listener)};this.removeCloseListener=function(listener){this.listeners.remove(listener)};this.fireClose=function(){this.listeners.call("onFrameClose",[this])};this.doModal=function(top){this.getContentWindow().doModal(top);this.center();this.show()};this.endModal=function(){this.getContentWindow().endModal();this.hide()};this.setTitle=function(text){this.title.setText(text)};this.getTitle=function(){return this.title.getText()};this.onDialogLooseActivity=function(){this.blinkEffect.play(420,70)};this.onDialogEndModal=function(){this.hide()};this.setContentWindow=override(this.setContentWindow,function(dialog){dialog.addDialogListener(this);arguments.callee.prototype.apply(this,[dialog])});this.onCloseButtonClick=callback(this,function(){this.fireClose()})}}ClassFactory.createPackage("editor.ui");ClassFactory.createClass(editor.ui,"PopupMenuFrame");with(editor.ui){editor.ui.PopupMenuFrame.superClass=core.ui.Frame;editor.ui.PopupMenuFrame.constructor=function(){this.PopupMenuFrame=function(B,A,E,C,D){this.Frame(B,A,E,C,D)};this.doPopupNear=function(C,B){if(!B){B=PopupMenuFrame.POSITION_UNDER}var A;var D;if(B&PopupMenuFrame.POSITION_LEFT){A=C.getAbsX()-this.getWidth()}else{if(B&PopupMenuFrame.POSITION_RIGHT){A=C.getAbsX()+C.getWidth()}else{A=C.getAbsX()}}if(B&PopupMenuFrame.POSITION_ABOVE){D=C.getAbsY()-this.getHeight()}else{if(B&PopupMenuFrame.POSITION_UNDER){D=C.getAbsY()+C.getHeight()}else{D=C.getAbsY()}}this.move(A,D);this.getContentWindow().doPopup(C,0,0);this.show()};this.setContentWindow=override(this.setContentWindow,function(A){var B=this.getContentWindow();if(B){B.notifyEndPopup.removeListener(this.onMenuEndPopup)}A.notifyEndPopup.addListener(this.onMenuEndPopup);arguments.callee.prototype.apply(this,[A])});this.endPopup=function(){this.getContentWindow().endPopup()};this.isPopup=function(){return this.getContentWindow().isPopup()};this.onMenuEndPopup=callback(this,function(A){this.hide()})};editor.ui.PopupMenuFrame.POSITION_ABOVE=1;editor.ui.PopupMenuFrame.POSITION_UNDER=4;editor.ui.PopupMenuFrame.POSITION_LEFT=8;editor.ui.PopupMenuFrame.POSITION_RIGHT=16}ClassFactory.createPackage("core.ui");ClassFactory.createClass(core.ui,"ProgressBar");with(core.ui){core.ui.ProgressBar.superClass=core.ui.Window;core.ui.ProgressBar.constructor=function(){this.pos=0;this.rangeMax=100;this.rangeMin=0;this.current=0;this.items=[];this.setRange=function(B,A){this.rangeMin=B;this.rangeMax=A;this.setPos(B)};this.getRangeMin=function(){return this.rangeMin};this.getRangeMax=function(){return this.rangeMax};this.setItemCount=function(C){if(this.items.length==C){return }while(this.items.length>0){this.items.pop().close()}for(var B=0;B<C;B++){var A=new Window(this);A.getElement().style.styleFloat=A.getElement().style.cssFloat="left";A.setStyleName("ProgressBarItem");A.hide();this.items.push(A)}};this.getItemCount=function(){return this.items.length};this.next=function(){var A=(this.items.length>0)?((this.rangeMax-this.rangeMin)/this.items.length):1;this.setPos(this.pos+A)};this.setPos=function(C){var B=Math.ceil((this.items.length-1)*C/(this.rangeMax-this.rangeMin));if(B>=0&&B<this.items.length){for(var A=this.current;A>=B;A--){this.items[A].hide()}for(var A=this.current;A<=B;A++){this.items[A].show()}this.current=B}else{if(0==this.items.length){}}this.pos=C};this.getPos=function(){return this.pos}}}ClassFactory.createPackage("editor.ui");ClassFactory.createClass(editor.ui,"LoadingDialog");with(editor.ui){editor.ui.LoadingDialog.superClass=core.ui.Dialog;editor.ui.LoadingDialog.constructor=function(){this.progressBar;this.LoadingDialog=function(A){arguments.callee.prototype.apply(this,[A]);this.progressBar=new core.ui.ProgressBar(this);this.progressBar.setItemCount(20)}}}ClassFactory.createPackage("core.ui");ClassFactory.createClass(core.ui,"Image");with(core.ui){core.ui.Image.superClass=core.ui.Window;core.ui.Image.constructor=function(){this.source;this.Image=function(B,A,E,C,D){arguments.callee.prototype.apply(this,[B,A,E,C,D]);this.setStyle("display","block")};this.setSource=function(A){this.getElement().src=this.source=A};this.getSource=function(){return this.source};this.isLoaded=function(){return this.getElement().complete};this.createElement=function(){var A=document.createElement("img");A.ondragstart=new Function("return false");return A}}}ClassFactory.createPackage("editor.ui");ClassFactory.createClass(editor.ui,"MenuButton");with(editor.ui){editor.ui.MenuButton.superClass=core.ui.ImageButton;editor.ui.MenuButton.constructor=function(){this.icon;this.text;this.MenuButton=function(B,A,E,C,D){this.ImageButton(B,A,E,C,D);this.icon=new core.ui.Image(this);this.text=new core.ui.Static(this);this.icon.hide()};this.setText=function(A){this.text.setText(A)};this.getText=function(){return this.text.getText()};this.setIcon=function(A){this.icon.setSource(A);this.icon.show()}}}ClassFactory.createPackage("editor.ui");ClassFactory.createClass(editor.ui,"SplitButton");with(editor.ui){editor.ui.SplitButton.superClass=core.ui.SplitWindow;editor.ui.SplitButton.constructor=function(){this.leftButton;this.rightButton;this.popupMenu;this.defaultValue;this.imageList;this.state;this.notifyDefaultAction=new core.ui.Notification();this.notifyPopup=new core.ui.Notification();this.SplitButton=function(B,A,E,C,D){this.SplitWindow(B,A,E,C,D);this.leftButton=new editor.ui.MenuButton(this);this.leftButton.addStyleName("SplitButtonLeft");this.leftButton.oncommand=this.onLeftButtonClick;this.rightButton=new core.ui.ImageButton(this);this.rightButton.addStyleName("SplitButtonRight");this.rightButton.oncommand=this.onRightButtonClick;this.setState(core.ui.ImageButton.STATE_NORMAL);this.setImageList("images/SplitButton/splitbutton.gif");this.rightButton.onmousedown=this.leftButton.onmousedown=this.onButtonMouseDown;this.rightButton.onmouseout=this.leftButton.onmouseout=this.onButtonMouseOut;this.rightButton.onmouseover=this.leftButton.onmouseover=this.rightButton.onmouseup=this.leftButton.onmouseup=this.onButtonMouseOver;this.addPane(this.leftButton,core.ui.SplitWindow.SPLIT_LEFT);this.addPane(this.rightButton,core.ui.SplitWindow.SPLIT_RIGHT)};this.setImages=function(E,A,F,H,C,B,G,D){this.leftButton.setImages(E,F,C,G);this.rightButton.setImages(A,H,B,D)};this.setImageList=override(this.setImageList,function(A){if(!defined(this.imageList)){this.imageList=new window.Image()}this.imageList.src=A;this.leftButton.imageList=this.rightButton.imageList=this.imageList;this.leftButton.setImage(A);this.leftButton.setStyle("background-position",-(this.getWidth()*this.state)+"px top");this.rightButton.setImage(A);this.rightButton.setStyle("background-position",-(this.getWidth()*this.state+this.leftButton.getWidth())+"px top")});this.setEnabled=override(this.setEnabled,function(A){arguments.callee.prototype.apply(this,[A]);this.setState(A?core.ui.ImageButton.STATE_NORMAL:core.ui.ImageButton.STATE_DISABLED)});this.setState=function(A){this.getElement().setAttribute("state",A);if(defined(this.imageList)){this.leftButton.setStyle("background-position",-(this.getWidth()*A)+"px top");this.rightButton.setStyle("background-position",-(this.getWidth()*A+this.leftButton.getWidth())+"px top")}else{if(this.rightButton.images[A].src.length>0&&this.leftButton.images[A].src.length>0){this.leftButton.setImage(this.leftButton.images[A].src);this.rightButton.setImage(this.rightButton.images[A].src)}}this.state=A};this.setDefaultValue=function(A){this.defaultValue=A};this.getDefaultValue=function(){return this.defaultValue};this.setIcon=function(A){this.leftButton.setIcon(A)};this.setText=function(A){this.leftButton.setText(A)};this.setPopupMenu=function(A){this.popupMenu=A};this.onRightButtonClick=callback(this,function(){if(defined(this.popupMenu)){if(this.popupMenu.isPopup()){this.popupMenu.endPopup()}else{this.popupMenu.doPopupNear(this);this.notifyPopup.send(this)}}});this.onLeftButtonClick=callback(this,function(){if(this.popupMenu.isPopup()){this.popupMenu.endPopup()}this.notifyDefaultAction.send(this,this.defaultValue)});this.onButtonMouseDown=callback(this,function(A){this.setState(core.ui.ImageButton.STATE_PRESSED);this.activate();A.stop();return false});this.onButtonMouseOver=callback(this,function(A){this.setState(core.ui.ImageButton.STATE_HOVER);A.stop()});this.onButtonMouseOut=callback(this,function(A){this.setState(core.ui.ImageButton.STATE_NORMAL);A.stop()})}}ClassFactory.createPackage("editor.ui");ClassFactory.createClass(editor.ui,"Shortcut");with(editor.ui){editor.ui.Shortcut.constructor=function(){this.listeners=new core.util.Listeners();this.modifiers=0;this.key;this.Shortcut=function(A){this.combination=A;var D=A.split("+");for(var C=0;C<D.length;C++){var B=D[C].toUpperCase();if(defined(Shortcut.ctrlFlags[B])){this.modifiers|=Shortcut.ctrlFlags[B]}else{this.key=B}}};this.addShortcutListener=function(A){this.listeners.add(A)};this.removeShortcutListener=function(A){this.listeners.remove(A)};this.getKeyCombination=function(){return this.combination};this.getKeyChar=function(){return this.key};this.getKeyCode=function(){if(!defined(this.key)){return undefined}return defined(Shortcut.keymap[this.key])?Shortcut.keymap[this.key]:this.key.charCodeAt(0)};this.getModifiers=function(){return this.modifiers};this.activate=function(){this.fireActivated()};this.fireActivated=function(){this.listeners.call("onShortcutActivated",[this])}};editor.ui.Shortcut.get=function(A){if(!this.initialized){this.init();this.initialized=true}if(!this.instances.hasKey(A)){this.instances.set(A,new Shortcut(A))}return this.instances.get(A)};editor.ui.Shortcut.init=function(){if(document.all){core.ui.Event.addListener(document,"keydown",this.handleEvent)}else{core.ui.Event.addListener(document,"keypress",this.handleEvent)}};editor.ui.Shortcut.handleEvent=function(C){C=core.ui.Event.improve(C);var E=String.fromCharCode(document.all?C.keyCode:C.charCode).toUpperCase();for(var B=Shortcut.instances.getValues().iterator();B.hasNext();B.next()){var D=B.current();var A=D.getModifiers();if(((E===D.getKeyChar().toUpperCase())||(C.keyCode==D.getKeyCode()))&&(C.ctrlKey===((A&Shortcut.CTRL_MASK)!=0))&&(C.shiftKey===((A&Shortcut.SHIFT_MASK)!=0))&&(C.altKey===((A&Shortcut.ALT_MASK)!=0))){D.activate();C.cancel();C.stop()}}};editor.ui.Shortcut.instances=new core.util.HashMap();editor.ui.Shortcut.CTRL_MASK=1;editor.ui.Shortcut.ALT_MASK=2;editor.ui.Shortcut.SHIFT_MASK=4;editor.ui.Shortcut.ctrlFlags={"CTRL":Shortcut.CTRL_MASK,"ALT":Shortcut.ALT_MASK,"SHIFT":Shortcut.SHIFT_MASK};editor.ui.Shortcut.keymap={"BACKSPACE":8,"BSP":8,"BACK":8,"TAB":9,"ENTER":13,"ENT":13,"PAUSE":19,"ESCAPE":27,"ESC":27,"PAGE UP":33,"PGUP":33,"PAGE DOWN":34,"PGDN":34,"END":35,"HOME":36,"LEFT":37,"UP":38,"RIGHT":39,"DOWN":40,"INSERT":45,"INS":45,"DELETE":46,"DEL":46,"F1":112,"F2":113,"F3":114,"F4":115,"F5":116,"F6":117,"F7":118,"F8":119,"F9":120,"F10":121,"F11":122,"F12":123,"/":191,"\\":220}}ClassFactory.createPackage("editor.ui");ClassFactory.createClass(editor.ui,"PopupMenu");with(editor.ui){editor.ui.PopupMenu.superClass=core.ui.Menu;editor.ui.PopupMenu.constructor=function(){this.createItem=function(D,C,B){var A=new core.ui.ImageButton(this);A.setText(D);if(this.isSubMenu()){A.setImageList("images/PopupMenu/subitem.gif");A.setStyleId("popup-submenu-item")}else{A.setImageList("images/PopupMenu/item.gif");A.setStyleId("popup-menu-item")}A.data=B;A.callback=C;A.oncommand=this.onItemClick;return this.addItem(A)};this.createSubMenu=function(D,C){if(!C){C=PopupMenu}if(D){var B=new core.ui.ImageButton(this);B.setText(D);B.setToolTip("Expand submenu");B.setImageList("images/PopupMenu/expand.gif");B.oncommand=this.onSubMenuClick}var A=new C(this);A.endPopup=this.onSubmenuEndPopup;A.submenuFlag=true;if(D){A.setStyle("display","none");B.menu=A}return A};this.isSubMenu=function(){return this.submenuFlag};this.onItemClick=callback(this,function(B,C,A){if(A.callback){A.callback(A.data)}});this.onSubMenuClick=callback(this,function(B,C,A){if("none"==A.menu.getStyle("display")){A.menu.setStyle("display","block");A.setImageList("images/PopupMenu/collapse.gif");A.setToolTip("Collapse submenu")}else{A.menu.setStyle("display","none");A.setImageList("images/PopupMenu/expand.gif");A.setToolTip("Expand submenu")}});this.onSubmenuEndPopup=callback(this,function(){this.endPopup()})}}ClassFactory.createPackage("editor.ui");ClassFactory.createClass(editor.ui,"RangeMenu");with(editor.ui){editor.ui.RangeMenu.superClass=editor.ui.PopupMenu;editor.ui.RangeMenu.constructor=function(){this.createItem=override(this.createItem,function(text,callback,data){var item=arguments.callee.prototype.apply(this,[text,callback,data]);item.onmouseover=this.onItemMouseOver;item.onmouseout=this.onItemMouseOut;return item});this.isSubMenu=function(){return true};this.onItemMouseOver=callback(this,function(event,target){var hover=true;var items=new core.util.ArrayList(this.items);for(var i=items.iterator();i.hasNext();i.next()){var item=i.current();with(core.ui){item.setState(hover?ImageButton.STATE_HOVER:ImageButton.STATE_NORMAL)}if(item==target){hover=false}}event.stop()});this.onItemMouseOut=callback(this,function(event){event.stop()})}}ClassFactory.createPackage("editor.commands");ClassFactory.createClass(editor.commands,"UndoMenu");with(editor.commands){editor.commands.UndoMenu.superClass=editor.ui.RangeMenu;editor.commands.UndoMenu.constructor=function(){this.UndoMenu=function(A){arguments.callee.prototype.apply(this,[A]);this.createItems();var B=CommandHistory.get();B.addHistoryListener(this);this.updateControls(B)};this.createItem=override(this.createItem,function(A){var B=arguments.callee.prototype.apply(this,["",this.onItemCommand,A]);B.setToolTip((A==0)?"Undo last change":("Undo last "+(A+1)+" changes"));B.setStyle("display","none");return B});this.updateControls=function(E){var D=E.getUndoCommands();var B=D.size();for(var A=0;A<this.getItemCount();A++){var C=this.getItem(A);if(A<B){C.setText(D.get(B-A-1).getName());C.setStyle("display","")}else{C.setStyle("display","none")}}};this.createItems=function(){for(var A=0;A<CommandHistory.MAX_SIZE;A++){this.createItem(A)}};this.onHistoryChanged=function(A){this.updateControls(A)};this.onItemCommand=callback(this,function(C){var B=CommandHistory.get();for(var A=0;A<=C;A++){B.undo()}this.endPopup()})}}ClassFactory.createPackage("editor.commands");ClassFactory.createClass(editor.commands,"RedoMenu");with(editor.commands){editor.commands.RedoMenu.superClass=editor.commands.UndoMenu;editor.commands.RedoMenu.constructor=function(){this.createItem=override(this.createItem,function(A){var B=arguments.callee.prototype.apply(this,[A]);B.setToolTip((A==0)?"Redo last change":("Redo last "+(A+1)+" changes"));return B});this.updateControls=function(E){var D=E.getRedoCommands();var B=D.size();for(var A=0;A<this.getItemCount();A++){var C=this.getItem(A);if(A<B){C.setText(D.get(A).getName());C.setStyle("display","")}else{C.setStyle("display","none")}}};this.onItemCommand=callback(this,function(C){var B=CommandHistory.get();for(var A=0;A<=C;A++){B.redo()}this.endPopup()})}}ClassFactory.createPackage("editor.ui");ClassFactory.createClass(editor.ui,"WorkspacePanel");with(editor.ui){editor.ui.WorkspacePanel.superClass=core.ui.Window;editor.ui.WorkspacePanel.constructor=function(){this.WorkspacePanel=function(parent){arguments.callee.prototype.apply(this,[parent]);var app=editor.Application.getInstance();with(core.ui){this.samplesButton=new ImageButton(this);this.samplesButton.setStyle("position","absolute");this.samplesButton.addStyleName("SamplesButton");this.samplesButton.setImageList("images/WorkspacePanel/samples.gif");this.samplesButton.setText("Load sample");this.samplesButton.setToolTip("Show samples menu");this.samplesButton.oncommand=this.onSamplesButtonClick;this.saveButton=new ImageButton(this);this.saveButton.setStyle("position","absolute");this.saveButton.addStyleName("SaveButton");this.saveButton.setImageList("images/WorkspacePanel/save.gif");this.saveButton.setText("Save page");this.saveButton.setToolTip("Save changes");this.saveButton.oncommand=this.onSaveButtonClick;this.previewButton=new ImageButton(this);this.previewButton.setStyle("position","absolute");this.previewButton.addStyleName("PreviewButton");this.previewButton.setImageList("images/WorkspacePanel/preview.gif");this.previewButton.setText("Preview");this.previewButton.setToolTip("Switch to preview mode");this.previewButton.oncommand=this.onPreviewButtonClick;this.clearButton=new ImageButton(this);this.clearButton.setStyle("position","absolute");this.clearButton.addStyleName("ClearButton");this.clearButton.setImageList("images/WorkspacePanel/clear.gif");this.clearButton.setToolTip("Clear page");this.clearButton.oncommand=this.onClearButtonClick;this.exitButton=new core.ui.ImageButton(this);this.exitButton.setStyle("position","absolute");this.exitButton.setStyleName("ExitButton");this.exitButton.setImageList("images/WorkspacePanel/exit.gif");this.exitButton.setToolTip("Exit editor");this.exitButton.oncommand=this.onExitButtonClick;this.undoButton=new SplitButton(this);this.undoButton.setStyle("position","absolute");this.undoButton.addStyleName("UndoButton");this.undoButton.setImageList("images/WorkspacePanel/undo.gif");this.undoButton.setToolTip("Undo");this.undoButton.notifyDefaultAction.addListener(this.onUndoButtonClick);this.undoButton.setPopupMenu(app.factory.createMenuWithFrame(editor.commands.UndoMenu));this.redoButton=new SplitButton(this);this.redoButton.setStyle("position","absolute");this.redoButton.addStyleName("RedoButton");this.redoButton.setImageList("images/WorkspacePanel/redo.gif");this.redoButton.setToolTip("Redo");this.redoButton.notifyDefaultAction.addListener(this.onRedoButtonClick);this.redoButton.setPopupMenu(app.factory.createMenuWithFrame(editor.commands.RedoMenu));this.editButton=new ImageButton();this.editButton.addStyleName("EditModeButton");this.editButton.setImages("images/WorkspacePanel/back-normal.png","images/WorkspacePanel/back-hover.png","images/WorkspacePanel/back-pressed.png");this.editButton.setText("Back to edit mode");this.editButton.setToolTip("Go back to edit mode");this.editButton.oncommand=this.onEditModeButtonClick;this.editButton.hide()}app.addAppListener(this);Shortcut.get("Ctrl+S").addShortcutListener(this);Shortcut.get("Ctrl+Z").addShortcutListener(this);Shortcut.get("Ctrl+Y").addShortcutListener(this);editor.commands.CommandHistory.get().addHistoryListener(this);this.updateControls()};this.getPreviewButton=function(){return this.previewButton};this.getEditButton=function(){return this.editButton};this.getSaveButton=function(){return this.saveButton};this.onHistoryChanged=function(){this.updateControls()};this.updateControls=function(){this.undoButton.setEnabled(editor.commands.CommandHistory.get().canUndo());this.redoButton.setEnabled(editor.commands.CommandHistory.get().canRedo());this.saveButton.setEnabled(!this.saving);this.saveButton.setText(this.saving?"Saving...":"Save page")};this.save=function(){var app=editor.Application.getInstance();if(!app.config.get("registration.complete")){app.factory.getRegistrationDialog().doModal()}else{app.save()}};this.onAppInitComplete=function(app){this.save()};this.onAppSaving=function(){this.saving=true;this.updateControls()};this.onAppSaved=function(){this.saving=false;this.updateControls()};this.onShortcutActivated=function(s){switch(s.getKeyCombination()){case"Ctrl+S":this.save();break;case"Ctrl+Z":editor.commands.CommandHistory.get().undo();break;case"Ctrl+Y":editor.commands.CommandHistory.get().redo();break}};this.onSaveButtonClick=callback(this,function(){this.save()});this.onClearButtonClick=callback(this,function(){if(confirm("This will delete all page content. Do you want to continue?")){editor.Application.getInstance().clear()}});this.onSamplesButtonClick=callback(this,function(){var dialog=editor.Application.getInstance().factory.getTemplatesDialog();dialog.getContentWindow().getMenu().notifyTemplateSelected.addListener(this.onTemplateSelected);dialog.center();dialog.doModal()});this.onExitButtonClick=callback(this,function(){try{window.location.href="SelectWebsite"}catch(e){console.error(e)}});this.onTemplateSelected=callback(this,function(sender,template){var app=editor.Application.getInstance();if((app.getCollection().getElementCount()>1)&&!confirm("The existing data won't be saved. Would you like to continue?")){return }app.loadTemplate(template);var dialog=app.factory.getTemplatesDialog();dialog.getContentWindow().getMenu().notifyTemplateSelected.removeListener(this.onTemplateSelected);dialog.endModal()});this.onPreviewButtonClick=callback(this,function(){editor.Application.getInstance().switchMode(editor.Application.MODE_PREVIEW);this.editButton.move(core.ui.Window.getWidth()-this.editButton.getWidth()-100,core.ui.Window.getHeight()-this.editButton.getHeight()-100);this.editButton.activate();this.editButton.show()});this.onEditModeButtonClick=callback(this,function(){editor.Application.getInstance().switchMode(editor.Application.MODE_EDIT);this.editButton.hide()});this.onUndoButtonClick=callback(this,function(){editor.commands.CommandHistory.get().undo()});this.onRedoButtonClick=callback(this,function(){editor.commands.CommandHistory.get().redo()})}}ClassFactory.createPackage("core.url");ClassFactory.createClass(core.url,"Encoder");with(core.url){core.url.Encoder.constructor=function(){};core.url.encode=core.url.Encoder.encode=function(A){if(!defined(A)){return""}A=encodeURI(A);A=A.replace(/\+/g,"%2B");A=A.replace(/\#/g,"%23");A=A.replace(/\?/g,"%3F");A=A.replace(/&amp;/g,"%26");return A}}ClassFactory.createPackage("core.url");ClassFactory.createClass(core.url,"Parser");with(core.url){core.url.Parser.constructor=function(){};core.url.parse=core.url.Parser.parse=function(C){var E={scheme:"http",host:"",port:"",user:"",password:"",path:"/",query:"",fragment:""};var D=C.indexOf("://");if(D!=-1){E.scheme=C.slice(0,D);C=C.slice(D+3)}D=C.indexOf("/");if(D!=-1){var B=C.slice(0,D);C=C.slice(D);D=B.indexOf("@");if(D!=-1){var A=B.slice(0,D).split(":");E.user=A[0];E.password=(A[1])?A[1]:"";B=B.slice(D+1)}D=B.indexOf(":");if(D!=-1){E.port=parseInt(B.slice(D+1));B=B.slice(0,D)}E.host=B}D=C.indexOf("#");if(D!=-1){E.fragment=C.slice(D+1);C=C.slice(0,D)}D=C.indexOf("?");if(D!=-1){E.query=C.slice(D+1);C=C.slice(0,D)}E.path=C;return E}}ClassFactory.createPackage("editor.ui");ClassFactory.createClass(editor.ui,"LoadingMessage");with(editor.ui){editor.ui.LoadingMessage.constructor=function(){};editor.ui.LoadingMessage.icons={};editor.ui.LoadingMessage.texts={};editor.ui.LoadingMessage.showIcon=function(B,C){if(!defined(C)){C="images/loading.gif"}if(!defined(this.icons[B.getId()])){this.icons[B.getId()]=new core.ui.Image(B);this.icons[B.getId()].setStyle("position","absolute")}var A=this.icons[B.getId()];A.setSource(C);A.center();A.show()};editor.ui.LoadingMessage.showText=function(B,C){if(!defined(C)){C="Loading..."}if(!defined(this.texts[B.getId()])){this.texts[B.getId()]=new core.ui.Static(B);this.texts[B.getId()].setStyle("position","absolute")}var A=this.texts[B.getId()];A.setText(C);A.center();A.show()};editor.ui.LoadingMessage.hideMessage=function(A){if(defined(this.icons[A.getId()])){this.icons[A.getId()].hide()}if(defined(this.texts[A.getId()])){this.texts[A.getId()].hide()}}}ClassFactory.createPackage("editor.ui");ClassFactory.createClass(editor.ui,"ImageLibrary");with(editor.ui){editor.ui.ImageLibrary.superClass=core.ui.Dialog;editor.ui.ImageLibrary.constructor=function(){this.categories;this.images;this.closeButton;this.selectedItem;this.preloadImages={};this.thumbnailSources={};this.imagesCounter=0;this.notifyImageSelected=new core.ui.Notification();this.ImageLibrary=function(parent){this.Dialog(parent);with(core.ui){var splitter=new SplitWindow(this,0,0,"100%","100%");this.categories=new ScrollWindow(splitter);this.categories.setContentWindow(new Menu(this.categories));this.categories.addStyleName("Categories");this.images=new ScrollWindow(splitter);this.images.setContentWindow(new Menu(this.images));this.images.addStyleName("Images");var buttons=new Window(splitter);buttons.addStyleName("ButtonsPane");this.closeButton=new ImageButton(buttons);this.closeButton.addStyleName("CloseButton");this.closeButton.setImageList("images/ImageLibrary/apply.gif");this.closeButton.setToolTip("Close library dialog");this.closeButton.setText("Close");this.closeButton.oncommand=parent.onCloseButtonClick;splitter.addPane(buttons,SplitWindow.SPLIT_BOTTOM);splitter.addPane(this.categories,SplitWindow.SPLIT_LEFT);splitter.addPane(this.images)}this.loadCategories()};this.loadCategories=function(){this.loadedCategories=false;LoadingMessage.showText(this);core.ajax.sendRequest(theApp.getUserCommand("ajax.EnumerateImages"),this.onLoadCategories)};this.addCategoryItem=function(category,icon){var item=new MenuButton(this.categories.getContentWindow());item.category=category;item.setText(category);item.setIcon(icon);item.setToolTip('Select images in category "'+category+'"');item.setImageList("images/ImageLibrary/category.gif");item.oncommand=this.onCategoryClick;this.categories.getContentWindow().addItem(item)};this.onLoadCategories=callback(this,function(response){try{if("OK"==response.status){this.addCategoryItem("My images","images/ImageLibrary/my-images.png");var path=response.path;for(var i=0;i<response.categories.length;i++){var c=response.categories[i];this.addCategoryItem(c,path+"/"+c+"/"+c+".png")}this.categories.reset();this.selectCategoryItem(this.categories.getContentWindow().getItem(0));this.loadedCategories=true}else{if(defined(response.message)){throw new Error("Error while loading image categories. Server response is: "+response.message)}else{throw new Error("Unspecified error while loading image categories. See server logs for details.")}}}catch(e){alert("Sorry, the error occurs while loading image categories from server.\n\nError details:"+e.message)}LoadingMessage.hideMessage(this)});this.loadImages=function(c){this.images.getContentWindow().removeItems();LoadingMessage.showText(this);core.ajax.sendRequest(theApp.getUserCommand("ajax.EnumerateImages"),this.onLoadImages,{"category":c})};this.onLoadImages=callback(this,function(response){try{if("OK"==response.status){var path=response.path;for(var i=0;i<response.images.length;i++){var item=new MenuButton(this.images.getContentWindow());item.path=path;item.image=response.images[i];var img=new core.ui.Image();img.removeStyleName("Image");this.preloadImages[i]=img;img.place=item;img.onload=this.onThumbnailLoaded;this.thumbnailSources[i]=core.url.encode(path+"/"+item.image)+"?size="+item.icon.getWidth()+"x"+item.icon.getHeight();item.onmousedown=callback(this,function(event){event.stop()});item.setToolTip("Select this image");item.setImageList("images/ImageLibrary/frame.gif");item.oncommand=this.onImageClick;this.images.getContentWindow().addItem(item)}this.images.reset()}else{if(response.message){throw new Error("Failed to load images. Response message is: "+response.message)}else{throw new Error("Unspecified error while loading images from server. See server logs for details.")}}}catch(e){alert("Sorry, the error occurs while loading images from server.\n\nError details:"+e.message)}setTimeout(this.initNextPicture,0);LoadingMessage.hideMessage(this)});this.selectCategoryItem=function(item){this.imagesCounter=0;for(var v in this.preloadImages){delete this.preloadImages[v]}for(var v in this.thumbnailSources){delete this.thumbnailSources[v]}if(defined(this.selectedItem)){if(item==this.selectedItem){if(item.getText()=="My images"){this.loadImages(item.getText())}return }this.selectedItem.setImageList("images/ImageLibrary/category.gif")}this.loadImages(item.getText());item.setImageList("images/ImageLibrary/category-active-2.gif");this.selectedItem=item};this.initNextPicture=callback(this,function(){var img=this.preloadImages[this.imagesCounter];if(defined(img)){if(img.getSource()){return }img.setSource(this.thumbnailSources[this.imagesCounter])}if(defined(this.preloadImages[this.imagesCounter+1])){this.imagesCounter++}});this.onThumbnailLoaded=callback(this,function(event,targetWindow,currentWindow){var owner=currentWindow.place;var width=currentWindow.getWidth();var height=currentWindow.getHeight();try{owner.hide();owner.setIcon(currentWindow.getSource());owner.icon.resize(width,height);owner.icon.center();owner.show()}catch(e){}setTimeout(this.initNextPicture,0)});this.onCategoryClick=callback(this,function(event,target,item){this.selectCategoryItem(item)});this.onImageClick=callback(this,function(event,target,item){this.notifyImageSelected.send(this,item.path+"/"+item.image)});this.refreshMyImages=callback(this,function(){var myImagesItem=this.categories.getContentWindow().getItem(0);if(this.selectedItem==myImagesItem&&this.loadedCategories){this.selectCategoryItem(myImagesItem)}})}}ClassFactory.createPackage("editor.ui");ClassFactory.createClass(editor.ui,"UrlDialog");with(editor.ui){editor.ui.UrlDialog.superClass=core.ui.Dialog;editor.ui.UrlDialog.constructor=function(){this.controlGroupWindow;this.schemesList;this.editUrl;this.buttonsGroup;this.cancelButton;this.okButton;this.notifySetUrl=new core.ui.Notification();this.notifyCancel=new core.ui.Notification();this.UrlDialog=function(C,B,H,F,G){this.Dialog(C,B,H,F,G);this.controlGroupWindow=new core.ui.Window(this);this.controlGroupWindow.setStyleId("url-dialog-ctrl-group");var E=new core.ui.Static(this.controlGroupWindow);E.setStyle("position","absolute");E.setStyleId("url-dialog-static-type");E.setText("Type:");this.schemesList=new core.ui.ComboBox(this.controlGroupWindow);this.schemesList.setStyle("position","absolute");this.schemesList.setStyleId("url-dialog-list-schemes");this.schemesList.addItem("other","");this.schemesList.setToolTip("Select the url scheme");this.schemesList.notifyValueChanged.addListener(this.onSchemeValueChanged);var A=["file","ftp","gopher","http","https","mailto","news","telnet","wais"];for(var D=0;D<A.length;D++){this.schemesList.addItem(A[D]+"://",A[D],("http"==A[D])?true:false)}var E=new core.ui.Static(this.controlGroupWindow);E.setStyle("position","absolute");E.setStyleId("url-dialog-static-url");E.setText("URL:");this.editUrl=new core.ui.Edit(this.controlGroupWindow);this.editUrl.setStyle("position","absolute");this.editUrl.setStyleId("url-dialog-edit-url");this.editUrl.setText("http://");this.editUrl.setToolTip("Enter the URL");this.buttonsGroup=new core.ui.Window(this);this.buttonsGroup.setStyleId("url-dialog-btn-group");this.okButton=new core.ui.ImageButton(this.buttonsGroup);this.okButton.setStyleId("url-dialog-button-ok");this.okButton.setText("OK");this.okButton.setToolTip("Use this URL");this.okButton.setImageList("images/UrlDialog/button.gif");this.okButton.oncommand=this.onOkButtonClick;this.cancelButton=new core.ui.ImageButton(this.buttonsGroup);this.cancelButton.setStyleId("url-dialog-button-cancel");this.cancelButton.setText("Cancel");this.cancelButton.setToolTip("Close this dialog");this.cancelButton.setImageList("images/UrlDialog/button.gif");this.cancelButton.oncommand=this.onCancelButtonClick};this.setUrl=function(A){var B="http";if(!A.match(/^([a-zA-Z]+):\/\//)){A=B+"://"+A}else{B=RegExp.$1}this.editUrl.setText(A);this.schemesList.setValue(B)};this.reset=function(){this.schemesList.setValue("http");this.editUrl.setText("http://")};this.onOkButtonClick=callback(this,function(){this.notifySetUrl.send(this,this.editUrl.getText())});this.onCancelButtonClick=callback(this,function(){this.notifyCancel.send(this)});this.onSchemeValueChanged=callback(this,function(B,C){if(C){var A=this.editUrl.getText();if(A.match(/^[a-zA-Z]+:\/\/(.*)$/)){this.editUrl.setText(C+"://"+RegExp.$1)}else{this.editUrl.setText(C+"://"+A)}}})}}ClassFactory.createPackage("editor.ui");ClassFactory.createClass(editor.ui,"Toolbox");with(editor.ui){editor.ui.Toolbox.superClass=core.ui.Window;editor.ui.Toolbox.constructor=function(){this.showGrid;this.Toolbox=function(A){arguments.callee.prototype.apply(this,[A]);this.showGrid=new core.ui.CheckBox(this);this.showGrid.setStyle("position","absolute");this.showGrid.setText("Show grid");this.showGrid.onclick=this.showGrid.label.onclick=this.onCheckboxClick;editor.Application.getInstance().addAppListener(this)};this.updateControls=function(){var A=editor.Application.getInstance().getWorkspace();this.showGrid.setChecked(A.isGridVisible())};this.getShowGridControl=function(){return this.showGrid};this.onAppPageLoaded=function(){this.updateControls()};this.onCheckboxClick=callback(this,function(){var A=editor.Application.getInstance().getWorkspace();A.setGridVisible(!A.isGridVisible())})}}ClassFactory.createPackage("core.ui");ClassFactory.createClass(core.ui,"FileUpload");with(core.ui){core.ui.FileUpload.superClass=core.ui.ImageButton;core.ui.FileUpload.constructor=function(){this.path="";this.url="";this.form;this.text;this.input;this.iframe;this.notifyFileSelected=new Notification();this.notifyFileUploaded=new Notification();this.notifyUploadError=new Notification();this.upload=function(params){var arr=[];for(var name in params){arr.push(core.url.encode(name)+"="+core.url.encode(params[name]))}this.form.action=this.url;if(arr.length>0){this.form.action+=("?"+arr.join("&"))}this.form.submit()};this.clear=function(){this.form.reset()};this.isFileSelected=function(){return(this.path.length>0)};this.getFilePath=function(){return this.path};this.setUploadUrl=function(url){this.url=url};this.getUploadUrl=function(){return this.url};this.setText=function(text){this.text.innerHTML=text};this.getText=function(){return this.text.innerHTML};this.close=override(this.close,function(){this.getElement().removeChild(this.iframe);this.form.removeChild(this.input);this.getElement().removeChild(this.form);delete this.iframe;delete this.input;delete this.form;arguments.callee.prototype.apply(this,[])});this.setFocus=function(){};this.createElement=override(this.createElement,function(){var root=arguments.callee.prototype.apply(this,[]);this.text=document.createElement("div");this.text.style.position="absolute";this.text.style.left=this.text.style.top="0px";this.text.style.width=this.text.style.height="100%";this.text.style.zIndex=0;root.appendChild(this.text);var id=this.getId()+"_iframe";this.iframe=document.createElement("iframe");this.iframe.setAttribute("id",id);this.iframe.setAttribute("name",id);this.iframe.style.display="none";this.iframe.style.width=this.iframe.style.height="0px";this.iframe.style.margin=this.iframe.style.padding="0px";root.appendChild(this.iframe);Event.addListener(this.iframe,"load",this.onIframeLoad);this.form=document.createElement("form");this.form.target=this.iframe.name;this.form.method="POST";this.form.enctype=this.form.encoding="multipart/form-data";this.form.style.margin=this.form.style.padding="0px";root.appendChild(this.form);this.input=document.createElement("input");this.input.name=this.input.type="file";this.input.style.position="absolute";this.input.style.zIndex=1;this.input.style.opacity=0;this.input.style.MozOpacity=0;this.input.style.KhtmlOpacity=0;this.input.style.filter="progid:DXImageTransform.Microsoft.Alpha(opacity=0)";this.input.style.styleFloat=this.input.style.cssFloat="right";this.input.style.height="100%";this.input.style.right="0px";this.input.onchange=this.onFileInputChange;this.form.appendChild(this.input);return root});this.onIframeLoad=callback(this,function(){if(!this.iframe.contentWindow.name){this.iframe.contentWindow.name=this.iframe.name}var respText=this.iframe.contentWindow.document.body.innerHTML;if(respText.length>0){var status="FAILED";var message="";try{var response=eval("("+respText+")");status=response.status;message=response.message}catch(ex){message=respText}if("OK"==status){this.notifyFileUploaded.send(this,response)}else{this.notifyUploadError.send(this,response)}}});this.onFileInputChange=callback(this,function(){this.path=this.input.value;this.notifyFileSelected.send(this,this.input.value);this.form.reset()});this.onmousemove=function(event){this.input.style.right=this.getAbsX()+this.getWidth()-event.getX()-15+"px";this.input.style.top=event.getY()-this.getAbsY()-this.input.offsetHeight/2+"px"}}}ClassFactory.createPackage("editor.ui");ClassFactory.createClass(editor.ui,"ImagePreview");with(editor.ui){editor.ui.ImagePreview.superClass=core.ui.Window;editor.ui.ImagePreview.constructor=function(){this.image;this.loadingWindow;this.loaded=false;this.zoom;this.notifyImageLoaded=new core.ui.Notification();this.ImagePreview=function(B,A,E,C,D){this.Window(B,A,E,C,D);this.loadingWindow=new core.ui.Static(this);this.loadingWindow.setStyle("position","absolute");this.loadingWindow.center();this.loadingWindow.hide();this.image=new window.Image();this.image.onload=this.onImageLoaded;this.reset()};this.setImage=function(A){this.loaded=false;if(A&&("none"!==A)){this.showAnimation();if(1!=this.zoom){A+=((-1!==A.indexOf("?"))?"&":"?");A+="zoom="+Math.ceil(this.zoom*100)}this.image.src=A}};this.setPosition=function(A,B){this.setStyle("background-position",A+" "+B);this.setStyle("background-position-x",A);this.setStyle("background-position-y",B)};this.getPositionX=function(){return this.getStyle("background-position-x")};this.getPositionY=function(){return this.getStyle("background-position-y")};this.setRepeat=function(A){this.setStyle("background-repeat",A)};this.getRepeat=function(){return this.getStyle("background-repeat")};this.setZoom=function(A){this.zoom=A};this.reset=function(){this.loaded=false;this.loadingWindow.hide();this.setStyle("background-image","none");this.setPosition("center","center");this.setRepeat("no-repeat");this.resetZoom()};this.isImageLoaded=function(){return this.loaded};this.showAnimation=function(){this.loaded=false;this.setStyle("background-image","none");this.loadingWindow.setStyle("background","url(images/loading.gif) no-repeat center center");this.loadingWindow.center();this.loadingWindow.show()};this.resetZoom=function(){this.zoom=(this.getWidth()/core.ui.Window.getWidth())};this.onImageLoaded=callback(this,function(){this.loaded=true;this.loadingWindow.hide();this.setStyle("background-image",'url("'+this.image.src+'")');this.notifyImageLoaded.send(this)})}}ClassFactory.createPackage("editor.ui");ClassFactory.createClass(editor.ui,"ImageDialog");with(editor.ui){editor.ui.ImageDialog.superClass=core.ui.Dialog;editor.ui.ImageDialog.constructor=function(){this.previewWindow;this.fileUpload;this.libButton;this.urlButton;this.cancelButton;this.applyButton;this.selectedImage;this.notifyImageApplied=new core.ui.Notification();this.notifyCancelled=new core.ui.Notification();this.ImageDialog=function(B,A,E,C,D){this.Dialog(B,A,E,C,D);this.previewWindow=new ImagePreview(this);this.previewWindow.notifyImageLoaded.addListener(this.onPreviewLoaded);this.cancelButton=new core.ui.ImageButton(this);this.cancelButton.setStyleId("image-dialog-button-cancel");this.cancelButton.setImageList("images/ImageDialog/apply.gif");this.cancelButton.setText("Cancel");this.cancelButton.setToolTip("Close without changes");this.cancelButton.oncommand=this.onCancelButtonClick;this.applyButton=new core.ui.ImageButton(this);this.applyButton.setStyleId("image-dialog-button-apply");this.applyButton.setImageList("images/ImageDialog/apply.gif");this.applyButton.setText("OK");this.applyButton.setToolTip("Close and change the image");this.applyButton.oncommand=this.onApplyButtonClick;this.fileUpload=new core.ui.FileUpload(this);this.fileUpload.setUploadUrl(theApp.getUserCommand("ajax.UploadImage"));this.fileUpload.setText("Upload");this.fileUpload.setToolTip("Upload image");this.fileUpload.setImageList("images/ImageDialog/browse.gif");this.fileUpload.notifyFileSelected.addListener(this.onFileSelected);this.fileUpload.notifyFileUploaded.addListener(this.onFileUploaded);this.fileUpload.notifyUploadError.addListener(this.onFileError);this.urlButton=new core.ui.ImageButton(this);this.urlButton.setStyleId("image-dialog-button-url");this.urlButton.setText("Load URL");this.urlButton.setToolTip("Load image from url");this.urlButton.setImageList("images/ImageDialog/url.gif");this.urlButton.oncommand=this.onUrlButtonClick;this.libButton=new core.ui.ImageButton(this);this.libButton.setStyleId("image-dialog-button-lib");this.libButton.setImageList("images/ImageDialog/lib.gif");this.libButton.setText("My images & library");this.libButton.setToolTip("Load image from library");this.libButton.oncommand=this.onLibButtonClick;this.updateControls()};this.setImage=function(A){this.selectedImage=A;this.previewWindow.setImage(A)};this.reset=function(){this.previewWindow.reset();this.fileUpload.clear();theApp.factory.getUrlDialog().getContentWindow().reset();this.updateControls()};this.updateControls=function(){this.applyButton.setEnabled(this.previewWindow.isImageLoaded());this.applyButton.setState(core.ui.ImageButton.STATE_NORMAL);this.applyButton.setStyle("opacity",this.previewWindow.isImageLoaded()?100:75)};this.centerObject=function(A){A.move(core.ui.Window.getWidth()-(document.body.clientWidth+A.getWidth())/2,core.ui.Window.getHeight()-(document.body.clientHeight+A.getHeight())/2)};this.onLibButtonClick=callback(this,function(){var A=theApp.factory.getImageLibrary();A.getContentWindow().notifyImageSelected.addListener(this.onLibImageSelected,true);this.centerObject(A);A.doModal();A.getContentWindow().refreshMyImages()});this.onUrlButtonClick=callback(this,function(){var A=theApp.factory.getUrlDialog();A.setTitle("Image URL");A.getContentWindow().notifySetUrl.addListener(this.onSetImageUrl,true);A.getContentWindow().notifyCancel.addListener(this.onUrlButtonCancelClick,true);this.centerObject(A);A.doModal()});this.onApplyButtonClick=callback(this,function(){this.notifyImageApplied.send(this,this.selectedImage)});this.onCancelButtonClick=callback(this,function(){this.notifyCancelled.send(this)});this.onSetImageUrl=callback(this,function(B,A){core.ajax.sendRequest(theApp.getUserCommand("ajax.CopyImage"),this.onImageCopy,{"url":A});theApp.factory.getUrlDialog().endModal()});this.onImageCopy=callback(this,function(A){try{if("OK"==A.status){this.selectedImage=A.src;this.previewWindow.setImage(A.src)}else{if(A.message){window.alert(A.message)}else{throw new Error("Image is not copied. The response is: "+A)}}}catch(B){alert("Sorry, the error occurs while copying the image.\n\nError details: "+B.message)}});this.onUrlButtonCancelClick=callback(this,function(){theApp.factory.getUrlDialog().endModal()});this.onFileSelected=callback(this,function(){this.previewWindow.showAnimation();this.fileUpload.upload();this.updateControls()});this.onFileUploaded=callback(this,function(A,B){this.selectedImage=B.src;this.previewWindow.setImage(B.src)});this.onFileError=callback(this,function(){this.previewWindow.reset();this.updateControls();alert("Sorry, the file you uploaded is not a valid image.")});this.onLibImageSelected=callback(this,function(B,A){this.selectedImage=A;this.previewWindow.setImage(A);theApp.factory.getImageLibrary().endModal()});this.onPreviewLoaded=callback(this,function(){this.updateControls()})}}ClassFactory.createPackage("core.util");ClassFactory.createClass(core.util,"Color");with(core.util){core.util.Color.constructor=function(){this.hex;this.Color=function(A){switch(typeof A){case"string":if(A.match(/^rgb\((\d+)[^\d]+(\d+)[^\d]+(\d+)\)$/i)){this.fromRgb(parseInt(RegExp.$1),parseInt(RegExp.$2),parseInt(RegExp.$3))}else{if(A.match(/^\#{0,1}([a-f0-9]+)$/i)){this.fromHex(RegExp.$1)}else{this.fromString(A)}}break;case"number":break}};this.fromRgb=function(C,B,A){this.hex=Color.rgb2Hex(C,B,A)};this.fromHex=function(A){this.hex=A.toLowerCase()};this.fromString=function(A){A=A.toLowerCase();if(defined(Color.map[A])){this.hex=Color.map[A];return true}return false};this.toString=function(){return this.hex.toString()}};core.util.Color.dec2Hex=function(C){var B="0123456789abcdef";var A=B.substr(C&15,1);while(C>15){C>>=4;A=B.substr(C&15,1)+A}return(2==A.length)?A:("0"+A)};core.util.Color.rgb2Hex=function(C,B,A){return Color.dec2Hex(C)+Color.dec2Hex(B)+Color.dec2Hex(A)};core.util.Color.hex2Rgb=function(B){var D="";var C="0123456789abcdef";B=B.toLowerCase();for(var A=0;A<6;A+=2){D+=16*C.indexOf(B.charAt(A))+C.indexOf(B.charAt(A+1))+","}return D.substr(0,D.length-1)};core.util.Color.map={"aliceblue":"f0f8ff","antiquewhite":"faebd7","aqua":"00ffff","aquamarine":"7fffd4","azure":"f0ffff","beige":"f5f5dc","bisque":"ffe4c4","black":"000000","blanchedalmond":"ffebcd","blue":"0000ff","blueviolet":"8a2be2","brown":"a52a2a","burlywood":"deb887","cadetblue":"5f9ea0","chartreuse":"7fff00","chocolate":"d2691e","coral":"ff7f50","cornflowerblue":"6495ed","cornsilk":"fff8dc","crimson":"dc143c","cyan":"00ffff","darkblue":"00008b","darkcyan":"008b8b","darkgoldenrod":"b8860b","darkgray":"a9a9a9","darkgreen":"006400","darkkhaki":"bdb76b","darkmagenta":"8b008b","darkolivegreen":"556b2f","darkorange":"ff8c00","darkorchid":"9932cc","darkred":"8b0000","darksalmon":"e9967a","darkseagreen":"8fbc8f","darkslateblue":"483d8b","darkslategray":"2f4f4f","darkturquoise":"00ced1","darkviolet":"9400d3","deeppink":"ff1493","deepskyblue":"00bfff","dimgray":"696969","dodgerblue":"1e90ff","firebrick":"b22222","floralwhite":"fffaf0","forestgreen":"228b22","fuchsia":"ff00ff","gainsboro":"dcdcdc","ghostwhite":"f8f8ff","gold":"ffd700","goldenrod":"daa520","gray":"808080","green":"008000","greenyellow":"adff2f","honeydew":"f0fff0","hotpink":"ff69b4","indianred":"cd5c5c","indigo":"4b0082","ivory":"fffff0","khaki":"f0e68c","lavender":"e6e6fa","lavenderblush":"fff0f5","lawngreen":"7cfc00","lemonchiffon":"fffacd","lightblue":"add8e6","lightcoral":"f08080","lightcyan":"e0ffff","lightgoldenrodyellow":"fafad2","lightgreen":"90ee90","lightgrey":"d3d3d3","lightpink":"ffb6c1","lightsalmon":"ffa07a","lightseagreen":"20b2aa","lightskyblue":"87cefa","lightslategray":"778899","lightsteelblue":"b0c4de","lightyellow":"ffffe0","lime":"00ff00","limegreen":"32cd32","linen":"faf0e6","magenta":"ff00ff","maroon":"800000","mediumaquamarine":"66cdaa","mediumblue":"0000cd","mediumorchid":"ba55d3","mediumpurple":"9370db","mediumseagreen":"3cb371","mediumslateblue":"7b68ee","mediumspringgreen":"00fa9a","mediumturquoise":"48d1cc","mediumvioletred":"c71585","midnightblue":"191970","mintcream":"f5fffa","mistyrose":"ffe4e1","moccasin":"ffe4b5","navajowhite":"ffdead","navy":"000080","oldlace":"fdf5e6","olive":"808000","olivedrab":"6b8e23","orange":"ffa500","orangered":"ff4500","orchid":"da70d6","palegoldenrod":"eee8aa","palegreen":"98fb98","paleturquoise":"afeeee","palevioletred":"db7093","papayawhip":"ffefd5","peachpuff":"ffdab9","peru":"cd853f","pink":"ffc0cb","plum":"dda0dd","powderblue":"b0e0e6","purple":"800080","red":"ff0000","rosybrown":"bc8f8f","royalblue":"4169e1","saddlebrown":"8b4513","salmon":"fa8072","sandybrown":"f4a460","seagreen":"2e8b57","seashell":"fff5ee","sienna":"a0522d","silver":"c0c0c0","skyblue":"87ceeb","slateblue":"6a5acd","slategray":"708090","snow":"fffafa","springgreen":"00ff7f","steelblue":"4682b4","tan":"d2b48c","teal":"008080","thistle":"d8bfd8","tomato":"ff6347","turquoise":"40e0d0","violet":"ee82ee","wheat":"f5deb3","white":"ffffff","whitesmoke":"f5f5f5","yellow":"ffff00","yellowgreen":"9acd32"}}ClassFactory.createPackage("editor.ui");ClassFactory.createClass(editor.ui,"ColorMenu");with(editor.ui){editor.ui.ColorMenu.superClass=editor.ui.PopupMenu;editor.ui.ColorMenu.constructor=function(){this.color;this.menuTitle;this.selectedColor;this.transpColor;this.colorEditor;this.okButton;this.notifyColorSelected=new core.ui.Notification();this.notifyColorApplied=new core.ui.Notification();this.ColorMenu=function(B,A,F,D,E){this.Menu(B,A,F,D,E);this.transpColor=new core.ui.MenuItem(this);this.transpColor.color="transparent";this.transpColor.setStyleId("color-menu-transparent-color");this.transpColor.setStyle("background-image","url(images/ColorMenu/transparent.gif)");this.transpColor.setToolTip("Transparent");this.transpColor.onclick=this.onItemClick;this.menuTitle=new core.ui.Static(this);this.menuTitle.setStyleId("color-menu-title");for(var C=0;C<ColorMenu.colors.length;C++){this.createItem(ColorMenu.colors[C])}this.colorEditor=new core.ui.Edit(this);this.colorEditor.getElement().maxLength=6;this.colorEditor.setStyle("text-transform","uppercase");this.colorEditor.onkeyup=this.onEditColor;this.selectedColor=new core.ui.Static(this);this.selectedColor.setStyleId("color-menu-selected-color");this.selectedColor.setToolTip(this.getColor());this.okButton=new core.ui.ImageButton(this);this.okButton.setImageList("images/ColorMenu/set.gif");this.okButton.setText("Set");this.okButton.oncommand=this.onSetButtonClick};this.createItem=function(A){var B=new core.ui.MenuItem(this);B.setStyle("background-color",A);B.onclick=this.onItemClick;B.setToolTip(A);B.color=A;return this.addItem(B)};this.setText=function(A){this.menuTitle.setText(A)};this.getText=function(){return this.menuTitle.getText()};this.getTranspColor=function(){return this.transpColor.color};this.setColor=function(A){if(A.match(/rgb\((\d+)[^\d]+(\d+)[^\d]+(\d+)/i)){A=core.util.Color.rgb2Hex(parseInt(RegExp.$1),parseInt(RegExp.$2),parseInt(RegExp.$3))}else{if(A.match(/\#[a-f0-9]+/i)){A=A.substr(1)}}this.color=A;this.colorEditor.setText((A.match(/^[a-f0-9]+$/i))?A:"");if("transparent"==A){this.selectedColor.setToolTip("Transparent");this.selectedColor.setStyle("background-image","url(images/ColorMenu/transparent.gif)")}else{this.selectedColor.setToolTip(A);this.selectedColor.setStyle("background-image","none")}try{this.selectedColor.setStyle("background-color",A)}catch(B){}};this.getColor=function(){return this.color};this.onItemClick=callback(this,function(C,A){var B=A;this.setColor(B.color);this.notifyColorSelected.send(this,this.color)});this.onSetButtonClick=callback(this,function(){this.setColor(this.colorEditor.getText());this.notifyColorApplied.send(this,this.color);this.endPopup()});this.onEditColor=callback(this,function(D,A){var B=A.getText();if(B.match(/rgb\((\d+)[^\d]+(\d+)[^\d]+(\d+)/i)){B=core.util.Color.rgb2Hex(parseInt(RegExp.$1),parseInt(RegExp.$2),parseInt(RegExp.$3))}else{if(B.match(/\#[A-Fa-f0-9]+/i)){B=B.substr(1)}}try{this.selectedColor.setStyle("background-color",B)}catch(C){}})};editor.ui.ColorMenu.colors=["FFFFFF","FFCCCC","FFCC99","FFFF99","FFFFCC","99FF99","99FFFF","CCFFFF","CCCCFF","FFCCFF","CCCCCC","FF6666","FF9966","FFFF66","FFFF33","66FF99","33FFFF","66FFFF","9999FF","FF99FF","C0C0C0","FF0000","FF9900","FFCC66","FFFF00","33FF33","66CCCC","33CCFF","6666CC","CC66CC","999999","CC0000","FF6600","FFCC33","FFCC00","33CC00","00CCCC","3366FF","6633FF","CC33CC","666666","990000","CC6600","CC9933","999900","009900","339999","3333FF","6600CC","993399","333333","660000","993300","996633","666600","006600","336666","000099","333399","663366","000000","330000","663300","663333","333300","003300","003333","000066","330099","330033"]}ClassFactory.createPackage("editor.ui");ClassFactory.createClass(editor.ui,"BorderDialog");with(editor.ui){editor.ui.BorderDialog.superClass=core.ui.Dialog;editor.ui.BorderDialog.constructor=function(){this.mainSplitWindow;this.toolsSplitWindow;this.previewWindow;this.toolsWindow;this.commandButtonsWindow;this.okButton;this.cancelButton;this.preview;this.colorMenu;this.selectionColor;this.selectionWidth;this.selectionStyle;this.notifyApplied=new core.ui.Notification();this.notifyCancelled=new core.ui.Notification();this.styles=["None","Dotted","Dashed","Solid","Double","Groove","Ridge","Inset","Outset"];this.widths={"0pt":"0 pt","0.25pt":"0,25 pt","0.5pt":"0,5 pt","0.75pt":"0,75 pt","1pt":"1 pt","1.5pt":"1,5 pt","2.25pt":"2,25 pt","3pt":"3 pt","4.5pt":"4,5 pt","6pt":"6 pt","9pt":"9 pt"};this.BorderDialog=function(C,A,G,E,F){this.Dialog(C,A,G,E,F);this.mainSplitWindow=new core.ui.SplitWindow(this);this.commandButtonsWindow=new core.ui.Window(this.mainSplitWindow);this.commandButtonsWindow.setStyleId("border-dialog-command-buttons-window");this.previewWindow=new core.ui.Window(this.mainSplitWindow);this.previewWindow.setStyleId("border-dialog-preview-window");this.preview=new core.ui.Window(this.previewWindow);this.preview.setStyleId("border-dialog-preview-target");this.preview.center();this.toolsSplitWindow=new core.ui.SplitWindow(this.mainSplitWindow);this.toolsSplitWindow.setStyleId("border-dialog-tools-splitwindow");this.toolsWindow=new PopupMenu(this.toolsSplitWindow);this.toolsWindow.setStyleId("border-dialog-menu-tools");this.colorMenu=this.toolsWindow.createSubMenu(null,ColorMenu);this.colorMenu.setText("Border color");this.colorMenu.transpColor.setStyle("display","none");this.colorMenu.notifyColorApplied.addListener(this.onColorSelected);this.colorMenu.notifyColorSelected.addListener(this.onColorSelected);var B=this.toolsWindow.createSubMenu();var D=new core.ui.Static(B);D.setStyleId("border-dialog-menu-title");D.setText("Border width");for(var E in this.widths){B.createItem(this.widths[E],this.onSelectWidth,E)}this.cancelButton=new core.ui.ImageButton(this.commandButtonsWindow);this.cancelButton.setStyleId("border-dialog-button-cancel");this.cancelButton.setImageList("images/BorderDialog/apply.gif");this.cancelButton.setText("Cancel");this.cancelButton.setToolTip("Close without changes");this.cancelButton.oncommand=this.onCancelButtonClick;this.okButton=new core.ui.ImageButton(this.commandButtonsWindow);this.okButton.setStyleId("border-dialog-button-ok");this.okButton.setImageList("images/BorderDialog/apply.gif");this.okButton.setText("Ok");this.okButton.setToolTip("Close and change the border");this.okButton.oncommand=this.onOkButtonClick;this.mainSplitWindow.addPane(this.commandButtonsWindow,core.ui.SplitWindow.SPLIT_BOTTOM);this.mainSplitWindow.addPane(this.previewWindow,core.ui.SplitWindow.SPLIT_LEFT);this.mainSplitWindow.addPane(this.toolsSplitWindow,core.ui.SplitWindow.SPLIT_RIGHT);this.toolsSplitWindow.addPane(this.createStylesPanel(),core.ui.SplitWindow.SPLIT_LEFT);this.toolsSplitWindow.addPane(this.toolsWindow,core.ui.SplitWindow.SPLIT_TOP);this.setBorderParameters("1px","solid","000000")};this.createStylesPanel=function(){var A=new core.ui.Window(this.toolsSplitWindow);A.setStyleId("border-dialog-styles-panel");for(var C=0;C<this.styles.length;C++){var B=new MenuButton(A);B.setImageList("images/BorderDialog/style-button.gif");B.setToolTip(this.styles[C]+" border style");B.oncommand=this.onStyleButtonClick;var D=new core.ui.Window(B);D.setStyleId("border-dialog-styles-button-hole");D.setStyle("border-width","4px");D.setStyle("border-style",this.styles[C]);D.setStyle("border-color","#217aaa");B.setText(this.styles[C])}return A};this.reset=function(){this.setBorderParameters("1px","solid","000000")};this.setBorderParameters=function(C,B,A){this.preview.setStyle("border-width",this.selectionWidth=C);this.preview.setStyle("border-style",this.selectionStyle=B);this.preview.setStyle("border-color",this.selectionColor=A);this.colorMenu.setColor(A)};this.onOkButtonClick=callback(this,function(){this.notifyApplied.send(this,this.selectionWidth,this.selectionStyle,this.selectionColor)});this.onCancelButtonClick=callback(this,function(){this.notifyCancelled.send(this)});this.onStyleButtonClick=callback(this,function(C,A,B){this.preview.setStyle("border-style",this.selectionStyle=B.getText())});this.onSelectWidth=callback(this,function(A){this.preview.setStyle("border-width",this.selectionWidth=A)});this.onColorSelected=callback(this,function(B,A){this.preview.setStyle("border-color",this.selectionColor=A)})}}ClassFactory.createPackage("core.ui");ClassFactory.createClass(core.ui,"Marquee");with(core.ui){core.ui.Marquee.superClass=core.ui.CompositeWindow;core.ui.Marquee.constructor=function(){this.text;this.loop=0;this.scrollAmount=6;this.scrollDelay=85;this.currentLoop=0;this.timerId=null;this.Marquee=function(B,A,E,C,D){arguments.callee.prototype.apply(this,[B,A,E,C,D]);this.updateLayout();this.start()};this.setText=function(A){this.text.innerHTML=A};this.getText=function(){return this.text.innerHTML};this.setLoop=function(A){this.loop=A};this.getLoop=function(){return this.loop};this.setScrollAmount=function(A){this.scrollAmount=A};this.getScrollAmount=function(){return this.scrollAmount};this.setScrollDelay=function(A){this.scrollDelay=A};this.getScrollDelay=function(){return this.scrollDelay};this.start=function(){this.stop();this.currentLoop=0;this.text.style.left=this.getWidth()+"px";this.timerId=window.setTimeout(this.onTimer,this.scrollDelay)};this.stop=function(){window.clearTimeout(this.timerId);this.timerId=null};this.isStarted=function(){return(null!==this.timerId)};this.close=override(this.close,function(){if(this.isStarted()){this.stop()}arguments.callee.prototype.apply(this,[])});this.updateLayout=function(){this.text.style.height=this.text.style.lineHeight=this.getHeight()+"px"};this.createElement=override(this.createElement,function(){var A=arguments.callee.prototype.apply(this,[]);this.text=document.createElement("div");this.text.style.position="absolute";this.text.style.whiteSpace="nowrap";A.appendChild(this.text);return A});this.onTimer=callback(this,function(){this.text.style.left=(this.text.offsetLeft-this.scrollAmount)+"px";if(this.text.offsetLeft+this.text.offsetWidth<=0){this.currentLoop++;if((this.loop>0)&&(this.currentLoop>=this.loop)){this.stop();return }this.text.style.left=this.getWidth()+"px"}this.timerId=window.setTimeout(this.onTimer,this.scrollDelay)})}}ClassFactory.createPackage("editor");ClassFactory.createClass(editor,"MusicPlayer");with(editor){editor.MusicPlayer.constructor=function(){};editor.MusicPlayer.STATE_READY=1;editor.MusicPlayer.STATE_STARTED=2;editor.MusicPlayer.STATE_PAUSED=3;editor.MusicPlayer.STATE_STOPPED=4;editor.MusicPlayer.loadCallback;editor.MusicPlayer.completeCallback;editor.MusicPlayer.currentFile=null;editor.MusicPlayer.currentState=editor.MusicPlayer.STATE_READY;editor.MusicPlayer.currentPosition=0;editor.MusicPlayer.currentVolume=100;editor.MusicPlayer.currentPan=0;editor.MusicPlayer.onSoundLoaded=function(){if(this.loadCallback){this.loadCallback()}};editor.MusicPlayer.onSoundComplete=function(){if(this.completeCallback){this.completeCallback()}};editor.MusicPlayer.onFlashLoaded=function(){this.loaded=true;this.sound=new AFLAX.FlashObject(aflax,"Sound");this.sound.exposeFunction("loadSound",this.sound);this.sound.exposeFunction("start",this.sound);this.sound.exposeFunction("stop",this.sound);this.sound.exposeFunction("setVolume",this.sound);this.sound.exposeFunction("setPan",this.sound);this.sound.exposeProperty("position",this.sound);this.sound.exposeProperty("duration",this.sound);this.sound.mapFunction("addEventHandler");this.sound.addEventHandler("onLoad","editor.MusicPlayer.onSoundLoaded");this.sound.addEventHandler("onSoundComplete","editor.MusicPlayer.onSoundComplete");if(defined(this.currentFile)){this.sound.loadSound(this.currentFile,true);this.sound.stop()}};editor.MusicPlayer.load=function(C,B,A){if(!defined(this.sound)){this.currentFile=C;this.loadCallback=B;this.completeCallback=A;return }this.sound.stop();if((MusicPlayer.STATE_STARTED==this.state)||(MusicPlayer.STATE_PAUSED==this.state)){if(this.completeCallback){this.completeCallback()}}this.currentPosition=0;this.loadCallback=B;this.completeCallback=A;if(this.currentFile!==C){this.currentFile=C;this.sound.loadSound(C,true);this.sound.stop()}else{if(defined(this.loadCallback)){this.loadCallback()}}};editor.MusicPlayer.start=function(){if(defined(this.sound)){this.sound.start(this.currentPosition/1000);this.state=MusicPlayer.STATE_STARTED}};editor.MusicPlayer.pause=function(){if(defined(this.sound)){this.sound.stop();this.currentPosition=this.sound.getPosition();this.state=this.STATE_PAUSED}};editor.MusicPlayer.stop=function(){if(defined(this.sound)){this.sound.stop();this.currentPosition=0;this.state=this.STATE_STOPPED}};editor.MusicPlayer.getPosition=function(){if(defined(this.sound)){return this.sound.getPosition()}};editor.MusicPlayer.getDuration=function(){if(defined(this.sound)){return this.sound.getDuration()}};editor.MusicPlayer.setVolume=function(A){if(defined(this.sound)){if(A<0){A=0}if(A>100){A=100}this.sound.setVolume(this.currentVolume=A)}};editor.MusicPlayer.getVolume=function(){return this.currentVolume};editor.MusicPlayer.setPan=function(A){if(defined(this.sound)){if(A<-100){A=-100}if(A>100){A=100}this.sound.setPan(this.currentPan=A)}};editor.MusicPlayer.getPan=function(){return this.currentPan};editor.MusicPlayer.getState=function(){return this.currentState};editor.MusicPlayer.getFileName=function(){return this.currentFile}}ClassFactory.createPackage("editor.ui.wizard");ClassFactory.createClass(editor.ui.wizard,"WizardPane");with(editor.ui.wizard){editor.ui.wizard.WizardPane.superClass=core.ui.Window;editor.ui.wizard.WizardPane.constructor=function(){this.WizardPane=function(A,B){this.Window(A.getContentPane());this.wizard=A;this.paneId=B;this.nextPaneId=null;this.prevPaneId=null};this.getWizard=function(){return this.wizard};this.getPaneId=function(){return this.paneId};this.setNextPaneId=function(A){this.nextPaneId=A};this.getNextPaneId=function(){return this.nextPaneId};this.setPrevPaneId=function(A){this.prevPaneId=A};this.getPrevPaneId=function(){return this.prevPaneId};this.setTitle=function(A){this.title=A};this.getTitle=function(){return this.title};this.setText=function(A){this.text=A};this.getText=function(){return this.text};this.setSkip=function(A){this.skip=A};this.canSkip=function(){return this.skip};this.reset=function(){};this.validate=function(){return true};this.setVisible=override(this.setVisible,function(A){arguments.callee.prototype.apply(this,[A]);if(this.isVisible()){if(!this.initialized){this.init();this.initialized=true}}});this.setActive=function(A){};this.init=function(){}}}ClassFactory.createPackage("editor.plugins.tribute");ClassFactory.createClass(editor.plugins.tribute,"Sound");with(editor.plugins.tribute){editor.plugins.tribute.Sound.constructor=function(){this.file;this.title;this.duration;this.cyclic=false;this.Sound=function(A,B,C){this.file=defined(A)?A:"";this.title=defined(B)?B:"";this.duration=defined(C)?C:0};this.setFile=function(A){this.file=A};this.getFile=function(){return this.file};this.hasFile=function(){return(this.file.length)>0?true:false};this.setDuration=function(A){this.duration=A};this.getDuration=function(){return this.duration};this.setTitle=function(A){this.title=A};this.getTitle=function(){return this.title};this.setCyclic=function(A){this.cyclic=A?true:false};this.isCyclic=function(){return this.cyclic?true:false};this.clone=function(){var A=new Sound(this.file,this.title,this.duration);A.setCyclic(this.isCyclic());return A}}}ClassFactory.createPackage("core.util");ClassFactory.createClass(core.util,"ImagePreloader");with(core.util){core.util.ImagePreloader.constructor=function(){this.url;this.loading=false;this.image=new Image();this.listeners=new Listeners();this.ImagePreloader=function(){this.image.onload=this.onImageLoaded;this.image.onerror=this.onLoadError};this.preload=function(A){this.url=A;this.loading=true;this.image.src=A};this.addListener=function(A){this.listeners.add(A)};this.removeListener=function(A){this.listeners.remove(A)};this.isLoading=function(){return this.loading};this.getUrl=function(){return this.url};this.getWidth=function(){return this.image.width};this.getHeight=function(){return this.image.height};this.toString=function(){return"[ImagePreloader]"};this.fireImagePreloaded=function(A){this.listeners.call("onImagePreloaded",[this,A])};this.firePreloadFailed=function(A){this.listeners.call("onPreloadFailed",[this,A])};this.onImageLoaded=callback(this,function(){this.loading=false;this.fireImagePreloaded(this.url)});this.onLoadError=callback(this,function(){this.loading=false;this.firePreloadFailed(this.url)})}}ClassFactory.createPackage("editor.ui");ClassFactory.createClass(editor.ui,"ImageFrame");with(editor.ui){editor.ui.ImageFrame.superClass=core.ui.Static;editor.ui.ImageFrame.constructor=function(){this.preloader=new core.util.ImagePreloader();this.ImageFrame=function(B,A,E,C,D){arguments.callee.prototype.apply(this,[B,A,E,C,D]);this.background=new core.ui.Static(this);this.background.setStyleName("Background");this.background.setStyle("background-repeat","no-repeat");this.background.setStyle("background-position","center center");this.preloader.addListener(this)};this.setImage=function(A){this.src=A;if(!A||"none"==A){this.background.setStyle("background-image",("none"==A)?"none":"")}else{this.background.setStyle("background-image","url(images/loading.gif)");this.preloader.preload(core.url.encode(A)+"?size="+this.background.getWidth()+"x"+this.background.getHeight())}};this.getImage=function(){return this.src};this.close=override(this.close,function(){this.preloader.removeListener(this);arguments.callee.prototype.apply(this,[])});this.onImagePreloaded=function(A){this.background.setStyle("background-image",'url("'+A.getUrl()+'")')}}}ClassFactory.createPackage("editor.plugins.tribute");ClassFactory.createClass(editor.plugins.tribute,"CameraView");with(editor.plugins.tribute){editor.plugins.tribute.CameraView.constructor=function(){this.x;this.y;this.zoom;this.CameraView=function(A,C,B){this.x=defined(A)?A:50;this.y=defined(C)?C:50;this.zoom=defined(B)?B:100};this.setZoom=function(A){this.zoom=Math.max(A,100);if(100==this.zoom){this.x=50;this.y=50}};this.getZoom=function(){return this.zoom};this.center=function(A,B){this.x=A;this.y=B};this.getCenterX=function(){return this.x};this.getCenterY=function(){return this.y};this.reset=function(){this.zoom=100;this.x=50;this.y=50}}}ClassFactory.createPackage("editor.plugins.tribute");ClassFactory.createClass(editor.plugins.tribute,"Subtitles");with(editor.plugins.tribute){editor.plugins.tribute.Subtitles.constructor=function(){this.text;this.size;this.bold=false;this.italic=false;this.underline=false;this.Subtitles=function(B,A){this.text=defined(B)?B:"";this.size=defined(A)?A:12};this.setText=function(A){this.text=A};this.getText=function(){return this.text};this.setSize=function(A){this.size=A};this.getSize=function(){return this.size};this.setBold=function(A){this.bold=(A)?true:false};this.isBold=function(){return(this.bold)?true:false};this.setItalic=function(A){this.italic=(A)?true:false};this.isItalic=function(){return(this.italic)?true:false};this.setUnderline=function(A){this.underline=(A)?true:false};this.isUnderline=function(){return(this.underline)?true:false};this.reset=function(){this.text="";this.size=12;this.bold=false;this.italic=false;this.underline=false}}}ClassFactory.createPackage("editor.plugins.tribute");ClassFactory.createClass(editor.plugins.tribute,"Scene");with(editor.plugins.tribute){editor.plugins.tribute.Scene.constructor=function(){this.period="";this.image="";this.duration;this.fading=Scene.FADING_NORMAL;this.subtitles;this.startView;this.endView;this.notifySceneChanged=new core.ui.Notification();this.Scene=function(A,C,B){this.image=defined(A)?A:"";this.duration=defined(C)?C:10;this.subtitles=new Subtitles(B);this.startView=new CameraView();this.endView=new CameraView()};this.setImage=function(A){this.notifySceneChanged.send(this);this.image=A;this.startView.reset();this.endView.reset()};this.getImage=function(){return this.image};this.setDuration=function(A){this.duration=A};this.getDuration=function(){return this.duration};this.setSubtitles=function(A){this.subtitles=A};this.getSubtitles=function(){return this.subtitles};this.setFadingType=function(A){this.fading=A};this.getFadingType=function(){return this.fading};this.setStartView=function(A){this.startView=A};this.getStartView=function(){return this.startView};this.setEndView=function(A){this.endView=A};this.getEndView=function(){return this.endView};this.setPeriod=function(A){this.period=A};this.getPeriod=function(){return this.period};this.hasImage=function(){return(this.image.length>0)?true:false};this.reset=function(){this.notifySceneChanged.send(this);this.image="";this.fading=Scene.FADING_NORMAL;this.duration=10;this.subtitles.reset();this.startView.reset();this.endView.reset()};this.clone=function(){var B=new Scene(this.image,this.duration);B.setFadingType(this.fading);B.setPeriod(this.period);var D=B.getSubtitles();D.setText(this.subtitles.getText());D.setSize(this.subtitles.getSize());D.setBold(this.subtitles.isBold());D.setItalic(this.subtitles.isItalic());D.setUnderline(this.subtitles.isUnderline());var C=B.getStartView();C.center(this.startView.getCenterX(),this.startView.getCenterY());C.setZoom(this.startView.getZoom());var A=B.getEndView();A.center(this.endView.getCenterX(),this.endView.getCenterY());A.setZoom(this.endView.getZoom());return B}};editor.plugins.tribute.Scene.FADING_NORMAL=0;editor.plugins.tribute.Scene.FADING_CIRCLES=1;editor.plugins.tribute.Scene.FADING_JALOUSIE=2;editor.plugins.tribute.Scene.FADING_SQUARES=3}ClassFactory.createPackage("editor.plugins.tribute.wizard");ClassFactory.createClass(editor.plugins.tribute.wizard,"TributeVideoSubtitlesPane");with(editor.plugins.tribute.wizard){editor.plugins.tribute.wizard.TributeVideoSubtitlesPane.superClass=editor.ui.wizard.WizardPane;editor.plugins.tribute.wizard.TributeVideoSubtitlesPane.constructor=function(){this.TributeVideoSubtitlesPane=function(A){arguments.callee.prototype.apply(this,[A,TributeVideoSubtitlesPane]);this.setPrevPaneId(TributeVideoMusicPane);this.setTitle("Video subtitles");this.setText("Here you can add subtitles to any video scene.");this.items=new core.ui.ScrollWindow(this,0,0,"100%","100%");this.items.setContentWindow(new core.ui.Menu(this.items))};this.createSubtitles=function(){var F=3;var A=[ChildhoodPhotosPane,TeenagePhotosPane,AdultPhotosPane,MaturePhotosPane];for(var C=0;C<A.length;C++){var G=this.getWizard().getPane(A[C]);for(var B=0;B<G.scenes.length;B++){if(G.scenes[B] instanceof editor.plugins.tribute.Scene){var E=new core.ui.Window(this.items.getContentWindow());E.setStyleName("SubtitlesItem");E.scene=G.scenes[B];E.preview=new editor.ui.ImageFrame(E);E.preview.setImage(E.scene.getImage(),true);var D=new core.ui.Static(E);D.addStyleName("FieldTitle");D.setText("Subtitle text:");E.textArea=new core.ui.TextArea(E);E.textArea.setTabIndex(++F);E.textArea.setText(E.scene.getSubtitles().getText());core.ui.quirks.TextSelection.allowSelection(E.getElement());this.items.getContentWindow().addItem(E)}}this.items.reset()}};this.reset=function(){this.items.getContentWindow().removeItems()};this.setActive=function(B){if(B){this.getWizard().addWizardListener(this);this.reset();this.createSubtitles();var A=this.items.getContentWindow().getItem(0);A.textArea.setFocus(true)}else{this.getWizard().removeWizardListener(this)}};this.onWizardBack=function(A){for(var B=0;B<this.items.getContentWindow().getItemCount();B++){var C=this.items.getContentWindow().getItem(B);C.scene.getSubtitles().setText(C.textArea.getText())}}}}ClassFactory.createPackage("editor.plugins.tribute.wizard");ClassFactory.createClass(editor.plugins.tribute.wizard,"TributeVideoMusicPane");with(editor.plugins.tribute.wizard){editor.plugins.tribute.wizard.TributeVideoMusicPane.superClass=editor.ui.wizard.WizardPane;editor.plugins.tribute.wizard.TributeVideoMusicPane.constructor=function(){this.sounds=[];this.TributeVideoMusicPane=function(wizard){arguments.callee.prototype.apply(this,[wizard,TributeVideoMusicPane]);this.setPrevPaneId(MaturePhotosPane);this.setNextPaneId(TributeVideoSubtitlesPane);this.setTitle("Background music");this.setText("Upload background music.<p><b>Note:</b> only <b>mp3</b> files are supported at the moment.");this.setSkip(true)};this.setActive=function(active){if(active){this.getWizard().addWizardListener(this)}else{this.getWizard().removeWizardListener(this)}};this.init=function(){this.items=new core.ui.ScrollWindow(this,0,0,"100%","100%");this.items.setContentWindow(new core.ui.Menu(this.items));this.addMenuItems(3)};this.addMenuItems=function(count){if(this.addButton){this.addButton.close()}for(var i=0;i<count;i++){var upload=new editor.ui.MusicUpload(this.items.getContentWindow());upload.soundIndex=this.items.getContentWindow().getItemCount();upload.notifyUploaded.addListener(this.onMusicUploaded);upload.notifyUploadFailed.addListener(this.onMusicUploadFailed);upload.notifyMusicStopped.addListener(this.onMusicStopped);this.items.getContentWindow().addItem(upload)}this.createAddButton();this.items.reset();this.items.getVerticalScroll().setPosition(100);this.items.updateLayout()};this.getNextPaneId=override(this.getNextPaneId,function(){var paneIds=[ChildhoodPhotosPane,TeenagePhotosPane,AdultPhotosPane,MaturePhotosPane];for(var i=0;i<paneIds.length;i++){var pane=this.getWizard().getPane(paneIds[i]);if(pane.scenes.length>0){return arguments.callee.prototype.apply(this,[])}}return undefined});this.createAddButton=function(){this.addButton=new core.ui.ImageButton(this.items.getContentWindow());this.addButton.addStyleName("AddButton");this.addButton.setText("Add more");this.addButton.setToolTip("Add more sounds");this.addButton.setImageList("images/VideoWizard/add.png");this.addButton.oncommand=this.onAddButtonCommand};this.onAddButtonCommand=callback(this,function(){this.addMenuItems(3)});this.stopSound=function(){for(var i=0;i<this.items.getContentWindow().getItemCount();i++){var musicUpload=this.items.getContentWindow().getItem(i);if(musicUpload.started||musicUpload.paused){musicUpload.stop()}}};this.onWizardNext=function(wizard){this.stopSound();if(!defined(wizard.getNextPane())){wizard.addPane(new TributeVideoSubtitlesPane(wizard))}};this.onWizardBack=function(){this.stopSound()};this.onMusicUploaded=callback(this,function(sender,path,title,artist,duration){with(editor.plugins.tribute){if(!defined(this.sounds[sender.soundIndex])){this.sounds[sender.soundIndex]=new Sound()}}var sound=this.sounds[sender.soundIndex];sound.setFile(path);sound.setTitle(title);sound.setDuration(duration)});this.onMusicUploadFailed=callback(this,function(sender){delete this.sounds[sender.soundIndex]});this.onMusicStopped=callback(this,function(){})}}ClassFactory.createPackage("editor.ui");ClassFactory.createClass(editor.ui,"MusicUpload");with(editor.ui){editor.ui.MusicUpload.superClass=core.ui.Window;editor.ui.MusicUpload.constructor=function(){this.icon;this.playButton;this.stopButton;this.fileUpload;this.trackWindow;this.marquee;this.info={path:"",name:"",title:"",artist:"",duration:0};this.paused=false;this.started=false;this.uploaded=false;this.notifyUploaded=new core.ui.Notification();this.notifyUploadFailed=new core.ui.Notification();this.notifyMusicComplete=new core.ui.Notification();this.notifyMusicStarted=new core.ui.Notification();this.notifyMusicStopped=new core.ui.Notification();this.notifyMusicPaused=new core.ui.Notification();this.MusicUpload=function(B,A,E,C,D){this.Window(B,A,E,C,D);this.icon=new core.ui.Image(this);this.icon.addStyleName("Icon");this.icon.setStyle("position","absolute");this.trackWindow=new core.ui.Static(this);this.trackWindow.addStyleName("TrackWindow");this.trackWindow.setStyle("background-image","url(images/MusicUpload/placeholder-disabled.png)");this.trackWindow.setStyle("position","absolute");this.track=new core.ui.Marquee(this.trackWindow);this.track.setStyle("position","absolute");this.track.setScrollDelay(200);this.track.stop();this.playButton=new core.ui.ImageButton(this);this.playButton.addStyleName("PlayButton");this.playButton.setStyle("position","absolute");this.playButton.setToolTip("Start");this.playButton.oncommand=this.onPlayButtonCommand;this.stopButton=new core.ui.ImageButton(this);this.stopButton.addStyleName("StopButton");this.stopButton.setStyle("position","absolute");this.stopButton.setToolTip("Stop");this.stopButton.oncommand=this.onStopButtonCommand;this.fileUpload=new core.ui.FileUpload(this);this.fileUpload.setText("Upload");this.fileUpload.setToolTip("Upload audio");this.fileUpload.setUploadUrl(theApp.getUserCommand("ajax.UploadAudio"));this.fileUpload.setImages("images/MusicUpload/browse-normal.png","images/MusicUpload/browse-hover.png","images/MusicUpload/browse-pressed.png");this.fileUpload.notifyFileSelected.addListener(this.onFileSelected);this.fileUpload.notifyFileUploaded.addListener(this.onFileUploaded);this.fileUpload.notifyUploadError.addListener(this.onUploadError);this.updateControls()};this.updateControls=function(){if(this.uploaded){this.icon.setSource("images/MusicUpload/icon-normal.png");this.playButton.enable();if(this.started){this.playButton.setImages("images/MusicUpload/pause-normal.png","images/MusicUpload/pause-hover.png","images/MusicUpload/pause-pressed.png");this.playButton.setToolTip("Pause");this.stopButton.enable()}else{this.playButton.setImages("images/MusicUpload/play-normal.png","images/MusicUpload/play-hover.png","images/MusicUpload/play-pressed.png","images/MusicUpload/play-disabled.png");this.playButton.setToolTip("Start");this.stopButton.setEnabled(this.paused?true:false)}}else{this.icon.setSource("images/MusicUpload/icon-disabled.png");this.playButton.setImages("images/MusicUpload/play-normal.png","images/MusicUpload/play-hover.png","images/MusicUpload/play-pressed.png","images/MusicUpload/play-disabled.png");this.stopButton.setImages("images/MusicUpload/stop-normal.png","images/MusicUpload/stop-hover.png","images/MusicUpload/stop-pressed.png","images/MusicUpload/stop-disabled.png");this.playButton.disable();this.stopButton.disable()}};this.isUploaded=function(){return this.uploaded};this.start=function(){if(this.paused){editor.MusicPlayer.start();this.paused=false}else{editor.MusicPlayer.load(this.info.path,this.onSoundLoaded,this.onSoundComplete)}this.started=true;this.updateControls()};this.stop=function(){editor.MusicPlayer.stop();this.started=false;this.paused=false;this.updateControls()};this.pause=function(){editor.MusicPlayer.pause();this.started=false;this.paused=true;this.updateControls()};this.close=override(this.close,function(){if(this.started){this.stop()}this.fileUpload.notifyFileSelected.removeListener(this.onFileSelected);this.fileUpload.notifyFileUploaded.removeListener(this.onFileUploaded);this.fileUpload.notifyUploadError.removeListener(this.onUploadError);arguments.callee.prototype.apply(this,[])});this.getFileUpload=function(){return this.fileUpload};this.getPlayButton=function(){return this.playButton};this.getStopButton=function(){return this.stopButton};this.onFileSelected=callback(this,function(A,B){if(this.started){this.stop()}this.trackWindow.setStyle("background-image","url(images/MusicUpload/placeholder-normal.png)");this.track.setStyle("background","url(images/loading.gif) no-repeat center center");this.track.setText("");this.fileUpload.upload()});this.onFileUploaded=callback(this,function(B,E){this.uploaded=true;this.info.path=E.path;this.info.name=E.name;if(E.title.length>0){this.info.title=E.title}else{this.info.title=E.name}this.info.artist=E.artist;this.info.duration=E.duration;var A=this.info.name;if((this.info.artist.length>0)&&(this.info.title.length>0)){A=this.info.artist+" - "+this.info.title}var C=common.util.DateUtils.getMinutes(this.info.duration);var D=common.util.DateUtils.getSeconds(this.info.duration);A+=" ("+C+":"+D+")";this.track.setStyle("background-image","none");this.track.setText(A);this.track.setToolTip(A);this.track.start();this.updateControls();this.notifyUploaded.send(this,this.info.path,this.info.title,this.info.artist,this.info.duration,this.info.name)});this.onUploadError=callback(this,function(A,B){this.uploaded=false;this.track.setStyle("background-image","none");this.updateControls();this.notifyUploadFailed.send(this);if(defined(B.message)){alert(B.message)}});this.onPlayButtonCommand=callback(this,function(){if(this.started){this.pause();this.notifyMusicPaused.send(this)}else{this.start();this.notifyMusicStarted.send(this)}});this.onStopButtonCommand=callback(this,function(){this.stop();this.notifyMusicStopped.send(this)});this.onSoundLoaded=callback(this,function(){editor.MusicPlayer.start()});this.onSoundComplete=callback(this,function(){this.stop();this.notifyMusicComplete.send(this)})}}ClassFactory.createPackage("core.ui");ClassFactory.createClass(core.ui,"CheckBox");with(core.ui){core.ui.CheckBox.superClass=core.ui.InputWindow;core.ui.CheckBox.constructor=function(){this.input;this.label;this.CheckBox=function(B,A,E,C,D){arguments.callee.prototype.apply(this,[B,A,E,C,D]);this.updateLayout()};this.setChecked=function(A){this.getInput().checked=A};this.isChecked=function(){return this.getInput().checked};this.setText=function(A){this.label.innerHTML=A};this.getText=function(){return this.label.innerHTML};this.getInput=function(){return this.input};this.resize=override(this.resize,function(A,B){arguments.callee.prototype.apply(this,[A,B]);this.updateLayout()});this.close=override(this.close,function(){this.getElement().removeChild(this.input);this.getElement().removeChild(this.label);delete this.input;delete this.label;arguments.callee.prototype.apply(this,[])});this.getType=function(){return"checkbox"};this.updateLayout=function(){this.label.style.height=this.getClientHeight()+"px";this.label.style.lineHeight=this.getClientHeight()+"px"};this.createElement=override(this.createElement,function(){var A=document.createElement("div");this.input=arguments.callee.prototype.apply(this,[]);this.input.id=this.getId()+"_input";this.input.style.left="0px";this.input.style.top="0px";this.input.style.height="100%";this.input.style.lineHeight="100%";this.input.style.marginTop=this.input.style.marginBottom="0px";this.input.style.marginRight="3px";this.input.style.styleFloat=this.input.style.cssFloat="left";A.appendChild(this.input);this.label=document.createElement("label");this.label.htmlFor=this.input.id;this.label.style.display="block";core.ui.quirks.TextSelection.preventSelection(this.label);A.appendChild(this.label);return A})}}ClassFactory.createPackage("core.ui");ClassFactory.createClass(core.ui,"RadioButton");with(core.ui){core.ui.RadioButton.superClass=core.ui.CheckBox;core.ui.RadioButton.constructor=function(){this.createElement=function(){var C=document.createElement("div");var A="radio"+this.getParent().getId();try{this.input=document.createElement('<input type="radio" name="'+A+'">')}catch(B){this.input=document.createElement("input");this.input.type="radio";this.input.name=A}this.input.id=this.getId()+"_input";this.input.style.left="0px";this.input.style.top="0px";this.input.style.height="100%";this.input.style.lineHeight="100%";this.input.style.marginTop=this.input.style.marginBottom=0;this.input.style.marginRight="3px";this.input.style.styleFloat=this.input.style.cssFloat="left";C.appendChild(this.input);this.label=document.createElement("label");this.label.htmlFor=this.input.id;core.ui.quirks.TextSelection.preventSelection(this.label);C.appendChild(this.label);return C};this.getType=function(){return"radio"}}}ClassFactory.createPackage("editor.ui");ClassFactory.createClass(editor.ui,"MusicList");with(editor.ui){editor.ui.MusicList.superClass=core.ui.Menu;editor.ui.MusicList.constructor=function(){this.notifyItemSelected=new core.ui.Notification();this.notifyLoaded=new core.ui.Notification();this.MusicList=function(A){this.Menu(A);this.setStyle("overflow","hidden");this.refresh()};this.addItem=override(this.addItem,function(I,E,B,C,G){var H=new core.ui.RadioButton(this);var A=(C&&G)?(C+" - "+G):B;H.path=I;H.duration=E;H.name=A;H.artist=C;H.title=G;var D=common.util.DateUtils.getMinutes(E);var F=common.util.DateUtils.getSeconds(E);var G=A+" ("+D+":"+F+")";H.setText(G);H.setToolTip(G);H.onclick=this.onItemSelected;return arguments.callee.prototype.apply(this,[H])});this.refresh=function(){this.removeItems();LoadingMessage.showIcon(this);core.ajax.sendRequest(theApp.getUserCommand("ajax.EnumerateSounds"),this.onServerResponse)};this.onServerResponse=callback(this,function(B){try{if("OK"==B.status){for(var A=0;A<B.sounds.length;A++){var D=B.sounds[A];this.addItem(D.path,D.duration,D.name,D.artist,D.title)}this.notifyLoaded.send(this)}else{if(defined(B.message)){throw new Error("Failed to get list of sounds. Response message is: "+B.message)}else{throw new Error("Unspecified error occurs while getting list of sounds.")}}}catch(C){alert("Sorry, the error occurs while getting list of sounds from server. Error details:"+C.message)}LoadingMessage.hideMessage(this)});this.onItemSelected=callback(this,function(C,A,B){if(A!==B){this.notifyItemSelected.send(this,B.path,B.duration,B.name,B.artist,B.title)}})}}ClassFactory.createPackage("editor.ui");ClassFactory.createClass(editor.ui,"MusicDialog");with(editor.ui){editor.ui.MusicDialog.superClass=core.ui.Dialog;editor.ui.MusicDialog.constructor=function(){this.list;this.upload;this.okButton;this.cancelButton;this.notifySelected=new core.ui.Notification();this.notifyCancel=new core.ui.Notification();this.MusicDialog=function(parent){this.Dialog(parent);with(core.ui){var splitter=new SplitWindow(this,0,0,"100%","100%");this.upload=new MusicUpload(splitter);this.upload.notifyUploaded.addListener(this.onSoundUploaded);this.list=new ScrollWindow(splitter);this.list.addStyleName("MusicListArea");this.list.setContentWindow(new MusicList(this.list));this.list.getContentWindow().notifyItemSelected.addListener(this.onSoundSelected);this.list.getContentWindow().notifyLoaded.addListener(this.onSoundLoaded);var buttons=new Window(splitter);buttons.setStyleName("ButtonsPane");this.cancelButton=new ImageButton(buttons);this.cancelButton.addStyleName("CancelButton");this.cancelButton.setImageList("images/MusicDialog/cancel.gif");this.cancelButton.setToolTip("Close without changes");this.cancelButton.setText("Cancel");this.cancelButton.oncommand=this.onCancelButtonClick;this.okButton=new ImageButton(buttons);this.okButton.addStyleName("OkButton");this.okButton.setImageList("images/MusicDialog/ok.gif");this.okButton.setToolTip("Select music");this.okButton.setText("OK");this.okButton.oncommand=this.onOkButtonClick;splitter.addPane(this.upload,SplitWindow.SPLIT_TOP);splitter.addPane(this.list,SplitWindow.SPLIT_TOP);splitter.addPane(buttons);this.updateControls()}};this.updateControls=function(){this.okButton.setEnabled(this.upload.isUploaded());this.okButton.setStyle("opacity",this.upload.isUploaded()?100:45)};this.onSoundLoaded=callback(this,function(){this.list.reset()});this.onSoundUploaded=callback(this,function(){this.list.getContentWindow().refresh();this.list.reset();this.updateControls()});this.onSoundSelected=callback(this,function(sender,path,duration,file,artist,title){this.upload.info={"path":path,"name":file,"title":title,"artist":artist,"duration":duration};var name=(artist&&title)?artist+" - "+title:file;var min=common.util.DateUtils.getMinutes(duration);var sec=common.util.DateUtils.getSeconds(duration);name+=" ("+min+":"+sec+")";this.upload.stop();this.upload.uploaded=true;this.upload.track.setStyle("background-image","none");this.upload.track.setText(name);this.upload.track.setToolTip(name);this.upload.track.start();this.upload.trackWindow.setStyle("background-image","url(images/MusicUpload/placeholder-normal.png)");this.upload.updateControls();this.updateControls()});this.onOkButtonClick=callback(this,function(){this.upload.stop();var info=this.upload.info;this.notifySelected.send(this,info.path,info.duration,info.file,info.artist,info.title)});this.onCancelButtonClick=callback(this,function(){this.upload.stop();this.notifyCancel.send(this)})}}ClassFactory.createPackage("editor.ui");ClassFactory.createClass(editor.ui,"TooltipController");with(editor.ui){editor.ui.TooltipController.constructor=function(){};editor.ui.TooltipController.showBalloonTip=function(D,F,C,B,E){var A=this.getBalloon();A.setOwner(D);A.setStyle("width","");A.setText(F);A.setStyle("width",(E)?"300px":"200px");A.setPosition(defined(C)?C:core.ui.Balloon.TOP);A.setTimeout(defined(B)?B:10);if(E){A.addStyleName(A.getStyleName()+"-wide")}else{A.removeStyleName(A.getStyleName()+"-wide")}A.show();return A};editor.ui.TooltipController.hideBalloonTip=function(A){if(!defined(this.balloon)||!this.balloon.isVisible()||this.balloon.isClosed()){return }if(defined(A)&&(this.balloon.getOwner()!=A)){return }this.balloon.hide()};editor.ui.TooltipController.getBalloon=function(){if(!defined(this.balloon)){this.balloon=new editor.ui.Balloon();editor.Application.getInstance().addAppListener(this)}return this.balloon};editor.ui.TooltipController.onAppClear=function(){this.hideBalloonTip()};editor.ui.TooltipController.onAppModeChanged=function(A){if(A.getMode()===editor.Application.MODE_PREVIEW){this.hideBalloonTip()}}}ClassFactory.createPackage("core.util.validation");ClassFactory.createClass(core.util.validation,"AbstractValidator");with(core.util.validation){core.util.validation.AbstractValidator.constructor=function(){this.target;this.AbstractValidator=function(A){this.target=A};this.setTarget=function(A){this.target=A};this.getTarget=function(){return this.target};this.validate=function(){}}}ClassFactory.createPackage("core.util.validation");ClassFactory.createClass(core.util.validation,"ValidationError");with(core.util.validation){core.util.validation.ValidationError.constructor=function(){this.validator;this.message;this.ValidationError=function(A,B){this.validator=A;this.message=B};this.getMessage=function(){return this.message};this.getValidator=function(){return this.validator}}}ClassFactory.createPackage("core.util.validation");ClassFactory.createClass(core.util.validation,"NonEmptyValidator");with(core.util.validation){core.util.validation.NonEmptyValidator.superClass=core.util.validation.AbstractValidator;core.util.validation.NonEmptyValidator.constructor=function(){this.validate=function(){if(0==this.getTarget().getText().length){throw new ValidationError(this,"The field should not be empty.")}}}}ClassFactory.createPackage("core.util.validation");ClassFactory.createClass(core.util.validation,"PhoneValidator");with(core.util.validation){core.util.validation.PhoneValidator.superClass=core.util.validation.NonEmptyValidator;core.util.validation.PhoneValidator.constructor=function(){this.validate=override(this.validate,function(){arguments.callee.prototype.apply(this,[]);var A=this.getTarget().getText();if(!A.match(/^\+?[\d\(][\d\s-]*(\(\d+\))?[\d\s-]*/)||A.match(/[a-zA-Z]/)){throw new ValidationError(this,"The phone number is invalid.")}})}}ClassFactory.createPackage("core.util.validation");ClassFactory.createClass(core.util.validation,"EmailValidator");with(core.util.validation){core.util.validation.EmailValidator.superClass=core.util.validation.NonEmptyValidator;core.util.validation.EmailValidator.constructor=function(){this.validate=override(this.validate,function(){arguments.callee.prototype.apply(this,[]);var A=this.getTarget().getText();if(!A.match(/^[\w!#\$%\/\?\|\^\{\}`~&'\+-=]+(\.[\w!#\$%\/\?\|\^\{\}`~&'\+-=]+)*@[\w-]+(\.[\w-]+)+$/)){throw new ValidationError(this,"The email address is invalid.")}})}}ClassFactory.createPackage("core.util.validation");ClassFactory.createClass(core.util.validation,"ZipCodeValidator");with(core.util.validation){core.util.validation.ZipCodeValidator.superClass=core.util.validation.NonEmptyValidator;core.util.validation.ZipCodeValidator.constructor=function(){this.validate=override(this.validate,function(){arguments.callee.prototype.apply(this,[])})}}ClassFactory.createPackage("core.util.validation");ClassFactory.createClass(core.util.validation,"ValidationTarget");with(core.util.validation){core.util.validation.ValidationTarget.constructor=function(){this.field;this.ValidationTarget=function(A){this.field=A};this.getField=function(){return this.field};this.getText=function(){return this.field.toString()}}}ClassFactory.createPackage("core.util.validation");ClassFactory.createClass(core.util.validation,"TextField");with(core.util.validation){core.util.validation.TextField.superClass=core.util.validation.ValidationTarget;core.util.validation.TextField.constructor=function(){this.getText=function(){return this.field.getText()}}}ClassFactory.createPackage("core.util.validation");ClassFactory.createClass(core.util.validation,"ListField");with(core.util.validation){core.util.validation.ListField.superClass=core.util.validation.ValidationTarget;core.util.validation.ListField.constructor=function(){this.getText=function(){var A=this.field.getValue();return(A)?A.toString():""}}}ClassFactory.createPackage("editor.ui");ClassFactory.createClass(editor.ui,"RegistrationFormValidator");with(editor.ui){editor.ui.RegistrationFormValidator.superClass=core.util.validation.AbstractValidator;editor.ui.RegistrationFormValidator.constructor=function(){this.RegistrationFormValidator=function(form){arguments.callee.prototype.apply(this,[form]);with(core.util.validation){this.firstName=new NonEmptyValidator(new TextField(form.firstName));this.lastName=new NonEmptyValidator(new TextField(form.lastName));this.address=new NonEmptyValidator(new TextField(form.address));this.cityName=new NonEmptyValidator(new TextField(form.city));this.stateName=new NonEmptyValidator(new ListField(form.state));this.zipCode=new ZipCodeValidator(new TextField(form.zip));this.phoneNumber=new PhoneValidator(new TextField(form.phone));this.info=new NonEmptyValidator(new ListField(form.info));this.other=new NonEmptyValidator(new TextField(form.other))}};this.validate=function(){var form=this.getTarget();this.firstName.validate();this.lastName.validate();this.address.validate();this.cityName.validate();this.stateName.validate();this.zipCode.validate();this.phoneNumber.validate();this.info.validate();if("other"==form.info.getValue()){this.other.validate()}}}}ClassFactory.createPackage("editor.ui");ClassFactory.createClass(editor.ui,"RegistrationDialog");with(editor.ui){editor.ui.RegistrationDialog.superClass=core.ui.Dialog;editor.ui.RegistrationDialog.constructor=function(){this.saving=false;this.RegistrationDialog=function(parent){arguments.callee.prototype.apply(this,[parent]);with(core.ui){this.splitter=new SplitWindow(this);this.splitter.addPane(this.createButtons(this.splitter),SplitWindow.SPLIT_BOTTOM);this.splitter.addPane(this.createMainPane(this.splitter),SplitWindow.SPLIT_TOP);this.validator=new RegistrationFormValidator(this);this.updateControls()}};this.doModal=override(this.doModal,function(){arguments.callee.prototype.apply(this,[]);this.firstName.setFocus(true)});this.validate=function(){try{this.validator.validate();return true}catch(e){TooltipController.showBalloonTip(e.getValidator().getTarget().getField(),e.getMessage(),core.ui.Balloon.RIGHT);return false}};this.updateControls=function(){if("other"==this.info.getValue()){this.other.setVisible(true);this.other.setFocus(true)}else{this.other.setVisible(false)}this.saveButton.setText(this.saving?"Saving...":"OK");this.saveButton.setEnabled(!this.saving);this.splitter.updateLayout()};this.createButtons=function(splitter){with(core.ui){var pane=new Window(splitter);pane.setStyleName("Buttons");this.closeButton=this.createCloseButton(pane);this.saveButton=this.createSaveButton(pane);return pane}};this.createMainPane=function(splitter){var pane=new core.ui.Window(splitter);pane.setStyleName("MainPane");var title=new core.ui.Static(pane);title.addStyleName("Title");title.setText("Fill this form to complete registration");this.createRegistrationGroup(pane);return pane};this.createRegistrationGroup=function(pane){var group=new core.ui.Window(pane);group.setStyleName("RegistrationFieldsGroup");group.setStyle("position","absolute");this.firstName=this.createFirstNameField(group);this.lastName=this.createLastNameField(group);this.address=this.createAddressField(group);this.city=this.createCityField(group);this.state=this.createStateField(group);this.zip=this.createZipField(group);this.phone=this.createPhoneField(group);this.info=this.createInfoField(group);this.other=this.createOtherField(group);return group};this.createFirstNameField=function(pane){var title=new core.ui.Static(pane);title.addStyleName("FirstNameTitle");title.setStyle("position","absolute");title.setText("First name:");var field=new core.ui.Edit(pane);field.addStyleName("FirstNameField");field.setStyle("position","absolute");field.setTabIndex(1);return field};this.createLastNameField=function(pane){var title=new core.ui.Static(pane);title.addStyleName("LastNameTitle");title.setStyle("position","absolute");title.setText("Last name:");var field=new core.ui.Edit(pane);field.addStyleName("LastNameField");field.setStyle("position","absolute");field.setTabIndex(2);return field};this.createAddressField=function(pane){var title=new core.ui.Static(pane);title.addStyleName("AddressTitle");title.setStyle("position","absolute");title.setText("Street address:");var field=new core.ui.Edit(pane);field.addStyleName("AddressField");field.setStyle("position","absolute");field.setTabIndex(3);return field};this.createCityField=function(pane){var title=new core.ui.Static(pane);title.addStyleName("CityTitle");title.setStyle("position","absolute");title.setText("City:");var field=new core.ui.Edit(pane);field.addStyleName("CityField");field.setStyle("position","absolute");field.setTabIndex(4);return field};this.createStateField=function(pane){var app=editor.Application.getInstance();var title=new core.ui.Static(pane);title.addStyleName("StateTitle");title.setStyle("position","absolute");title.setText("State:");var list=new core.ui.ComboBox(pane);list.addStyleName("StateField");list.setStyle("position","absolute");list.setEditable(false);var states=app.config.get("registration.states",{});list.addItem("(Select please)","",true);for(var st in states){list.addItem(states[st],st)}return list};this.createZipField=function(pane){var title=new core.ui.Static(pane);title.addStyleName("ZipTitle");title.setStyle("position","absolute");title.setText("Zip/Postal Code:");var field=new core.ui.Edit(pane);field.addStyleName("ZipField");field.setStyle("position","absolute");field.setTabIndex(6);return field};this.createPhoneField=function(pane){var title=new core.ui.Static(pane);title.addStyleName("PhoneTitle");title.setStyle("position","absolute");title.setText("Phone:");var field=new core.ui.Edit(pane);field.addStyleName("PhoneField");field.setStyle("position","absolute");field.setTabIndex(7);return field};this.createInfoField=function(pane){var app=editor.Application.getInstance();var title=new core.ui.Static(pane);title.addStyleName("InfoTitle");title.setStyle("position","absolute");title.setText("How did you hear about "+app.config.get("app.name","us")+"?");var list=new core.ui.ComboBox(pane);list.addStyleName("InfoField");list.setStyle("position","absolute");list.setEditable(false);list.addItem("(Select please)","",true);list.addItem("From friends","friends");list.addItem("From advertising","advertising");list.addItem("Other","other");list.notifyValueChanged.addListener(this.onUpdateControls);return list};this.createOtherField=function(pane){var field=new core.ui.Edit(pane);field.addStyleName("OtherField");field.setStyle("position","absolute");field.setTabIndex(9);return field};this.createSaveButton=function(pane){var button=new core.ui.ImageButton(pane);button.addStyleName("SaveButton");button.setImageList("images/SaveDialog/button.gif");button.setText("OK");button.setTabIndex(13);button.oncommand=this.onSaveButtonClick;return button};this.createCloseButton=function(pane){var button=new core.ui.ImageButton(pane);button.addStyleName("CloseButton");button.setImageList("images/SaveDialog/button.gif");button.setText("Later");button.setTabIndex(14);button.oncommand=this.onCloseButtonClick;return button};this.endModal=override(this.endModal,function(){TooltipController.hideBalloonTip();arguments.callee.prototype.apply(this,[])});this.onUpdateControls=callback(this,function(){this.updateControls()});this.onCloseButtonClick=callback(this,function(){this.endModal()});this.onSaveButtonClick=callback(this,function(){if(this.validate()){var app=editor.Application.getInstance();app.addAppListener(this);app.save()}});this.onAppSaving=function(app,context){this.saving=true;this.updateControls();context.setUrl(app.getUserCommand("ajax.Registration"));context.set("account.firstName",this.firstName.getText());context.set("account.firstName",this.firstName.getText());context.set("account.lastName",this.lastName.getText());context.set("account.address",this.address.getText());context.set("account.city",this.city.getText());context.set("account.state",this.state.getValue());context.set("account.zip",this.zip.getText());context.set("account.phone",this.phone.getText());context.set("account.info",("other"!==this.info.getValue())?this.info.getValue():this.other.getText())};this.onAppSaved=function(app){app.removeAppListener(this);this.saving=false;this.updateControls();this.endModal()};this.onAppSavingError=function(app,message){app.removeAppListener(this);this.saving=false;this.updateControls();alert("Sorry, the error occurs while saving the page ("+message+")")}}}ClassFactory.createPackage("editor.ui");ClassFactory.createClass(editor.ui,"SingletonFactory");with(editor.ui){editor.ui.SingletonFactory.constructor=function(){this.instances={};this.getInstance=function(A){if(!defined(this.instances[A])){this.instances[A]=new A()}return this.instances[A]};this.instanceCreated=function(A){return(defined(this.instances[A]))}}}ClassFactory.createPackage("editor.ui");ClassFactory.createClass(editor.ui,"StateButton");with(editor.ui){editor.ui.StateButton.superClass=editor.ui.MenuButton;editor.ui.StateButton.constructor=function(){this.turned=false;this.StateButton=function(B,A,E,C,D){this.MenuButton(B,A,E,C,D)};this.turn=function(A){if(!this.isEnabled()||(A===this.turned)){return }if(defined(A)){this.turned=A?true:false}else{this.turned=!this.turned}this.setState(this.turned?core.ui.ImageButton.STATE_PRESSED:core.ui.ImageButton.STATE_NORMAL)};this.isTurned=function(){return(this.turned)?true:false}}}ClassFactory.createPackage("editor.ui");ClassFactory.createClass(editor.ui,"SealButton");with(editor.ui){editor.ui.SealButton.superClass=editor.ui.StateButton;editor.ui.SealButton.constructor=function(){this.pressed=false;this.notifier;this.SealButton=function(B,A,E,C,D){this.MenuButton(B,A,E,C,D);SealButton.notifyPress.addListener(this.onNeedUnseal)};this.onNeedUnseal=callback(this,function(A){if(this.pressed&&A!=this){this.pressed=false;if(this.getElement()){this.setState(core.ui.ImageButton.STATE_NORMAL)}}});this.onmousedown=function(A){this.setState(core.ui.ImageButton.STATE_PRESSED);this.setFocus(true);this.pressed=true;SealButton.notifyPress.send(this);this.activate();A.stop();return false};this.onmouseout=function(A){this.setState(this.pressed?core.ui.ImageButton.STATE_PRESSED:core.ui.ImageButton.STATE_NORMAL);A.stop()};this.onblur=function(){this.setState(this.pressed?core.ui.ImageButton.STATE_PRESSED:core.ui.ImageButton.STATE_NORMAL)};this.onmouseover=this.onmouseup=function(A){if(!this.pressed){this.setState(core.ui.ImageButton.STATE_HOVER)}A.stop()};this.onkeydown=function(C,B,A){if(Event.KEY_SPACE==C.keyCode){C.stop();this.setState(core.ui.ImageButton.STATE_PRESSED);this.pressed=true;SealButton.notifyPress.send(this)}else{if(Event.KEY_ENTER==C.keyCode){C.stop();if(defined(this.oncommand)){this.oncommand(C,B,A)}}}};this.onkeyup=function(C,B,A){if(Event.KEY_SPACE==C.keyCode){C.stop();if(defined(this.oncommand)){this.oncommand(C,B,A)}}}};editor.ui.SealButton.notifyPress=new core.ui.Notification()}ClassFactory.createPackage("editor.ui");ClassFactory.createClass(editor.ui,"TemplatesMenu");with(editor.ui){editor.ui.TemplatesMenu.superClass=core.ui.Menu;editor.ui.TemplatesMenu.constructor=function(){this.categories;this.templates;this.selectedItem;this.selectedTemplate;this.notifyCategorySelected=new core.ui.Notification();this.notifyTemplateSelected=new core.ui.Notification();this.TemplatesMenu=function(parent,x,y,width,height){this.Menu(parent,x,y,width,height);with(core.ui){var splitter=new SplitWindow(this,0,0,"100%","100%");this.categories=new ScrollWindow(splitter);this.categories.setContentWindow(new Menu(this.categories));this.categories.addStyleName("Categories");this.templates=new ScrollWindow(splitter);this.templates.setContentWindow(new Menu(this.templates));this.templates.addStyleName("Templates");splitter.addPane(this.categories,SplitWindow.SPLIT_LEFT);splitter.addPane(this.templates,SplitWindow.SPLIT_FILL)}this.loadCategories()};this.loadCategories=function(){LoadingMessage.showText(this);window.setTimeout(callback(this,function(){core.ajax.sendRequest("ajax.EnumerateTemplates",this.onLoadCategories)}),100)};this.onLoadCategories=callback(this,function(response){try{if("OK"==response.status){var path=response.path;for(var i=0;i<response.categories.length;i++){var item=new MenuButton(this.categories.getContentWindow());item.category=response.categories[i];item.setText(item.category);item.setIcon(path+"/"+item.category+"/"+item.category+".png");item.setImageList("images/TemplatesMenu/category.gif");item.oncommand=this.onCategoryItemClick;this.categories.getContentWindow().addItem(item);if(0==i){this.selectCategoryItem(item)}}this.categories.reset()}else{if(defined(response.message)){throw new Error("Error occurs while loading template categories from server. Response message is:"+response.message)}else{throw new Error("Unspecified error occurs while loading template categories from server. See server logs for details.")}}}catch(e){alert("Sorry, the error occurs while loading template categories from server.\n\nError details: "+e.message)}LoadingMessage.hideMessage(this)});this.loadTemplates=function(c){LoadingMessage.showText(this);this.templates.getContentWindow().removeItems();window.setTimeout(callback(this,function(){core.ajax.sendRequest("ajax.EnumerateTemplates",this.onLoadTemplates,{"category":c})}),100)};this.onLoadTemplates=callback(this,function(response){try{if("OK"==response.status){if((!defined(this.selectedItem.element))||(!this.selectedItem.element)){return }if(this.selectedItem.getText()!=response.category){return }var path=response.path;this.items=[];for(var i=0;i<response.templates.length;i++){var name=response.templates[i];var item=new SealButton(this.templates.getContentWindow());item.template={"name":name,"path":path+"/"+name+"/"+name+".html","thumbnail":path+"/"+name+"/"+name+".png","category":response.category};item.setStyle("position","absolute");var margin=editor.ui.TemplatesMenu.SEAL_BUTTON_MARGIN;if(i%2==0){item.move(margin,(item.getHeight()+margin)*i/2+margin)}else{item.move(item.getWidth()+2*margin,(item.getHeight()+margin)*((i-1)/2).toFixed()+margin)}item.oncommand=this.onItemClick;item.setText(item.template.name);item.setIcon(item.template.thumbnail);item.setImageList("images/TemplatesMenu/item.gif");this.templates.getContentWindow().addItem(item);this.items.push(item)}this.templates.reset()}else{if(response.message){throw new Error("Failed to load templates. Response message is: "+response.message)}else{throw new Error("Unspecified error occurs while loading templates.")}}}catch(e){alert("Sorry, the error occurs while loading templates from server.\n\nError details: "+e.message)}LoadingMessage.hideMessage(this)});this.selectCategoryItem=function(item){if((this.selectedItem&&(this.selectedItem.constructor===MenuButton||defined(this.selectedItem.constructor.isSubclassOf)&&this.selectedItem.constructor.isSubclassOf(MenuButton)))){if(item==this.selectedItem){return }this.selectedItem.setImageList("images/TemplatesMenu/category.gif")}item.setImageList("images/TemplatesMenu/category-active-2.gif");this.loadTemplates(item.getText());this.selectedItem=item};this.getCategoriesMenu=function(){return this.categories.getContentWindow()};this.getTemplatesMenu=function(){return this.templates.getContentWindow()};this.onItemClick=callback(this,function(event,target,item){window.setTimeout(callback(this,function(){this.selectedTemplate=item;this.notifyTemplateSelected.send(this,item.template.path);this.endPopup()}),1)});this.onCategoryItemClick=callback(this,function(event,target,item){this.notifyCategorySelected.send(this,item.getText());this.selectCategoryItem(item)})};editor.ui.TemplatesMenu.SEAL_BUTTON_MARGIN=5}ClassFactory.createPackage("editor.ui");ClassFactory.createClass(editor.ui,"TemplatesDialog");with(editor.ui){editor.ui.TemplatesDialog.superClass=core.ui.Dialog;editor.ui.TemplatesDialog.constructor=function(){this.TemplatesDialog=function(parent){arguments.callee.prototype.apply(this,[parent]);with(core.ui){var splitter=new SplitWindow(this,0,0,"100%","100%");this.menu=new TemplatesMenu(splitter);var buttons=new Window(splitter);buttons.addStyleName("ButtonsPane");this.closeButton=new ImageButton(buttons);this.closeButton.addStyleName("CloseButton");this.closeButton.setImageList("images/TemplatesDialog/close.gif");this.closeButton.setToolTip("Close dialog");this.closeButton.setText("Close");this.closeButton.oncommand=parent.onCloseButtonClick;splitter.addPane(buttons,SplitWindow.SPLIT_BOTTOM);splitter.addPane(this.menu)}};this.getMenu=function(){return this.menu}}}ClassFactory.createPackage("editor.ui");ClassFactory.createClass(editor.ui,"GuiFactory");with(editor.ui){editor.ui.GuiFactory.superClass=editor.ui.SingletonFactory;editor.ui.GuiFactory.constructor=function(){this.createDialogWithFrame=function(C,B){if(!defined(this.instances[C])){var A=new DialogFrame();A.setTitle(defined(B)?B:"");A.setContentWindow(new C(A));A.addCloseListener({onFrameClose:function(D){D.endModal()}});this.instances[C]=A}return this.instances[C]};this.createPanelWithFrame=function(A,C){if(!defined(this.instances[A])){var B=new PanelFrame();B.setTitle(defined(C)?C:"");B.setContentWindow(new A(B));this.instances[A]=B}return this.instances[A]};this.createMenuWithFrame=function(B){if(!defined(this.instances[B])){var A=new PopupMenuFrame();A.setContentWindow(new B(A));this.instances[B]=A}return this.instances[B]};this.getBorderDialog=function(){return this.createDialogWithFrame(BorderDialog,"Border style")};this.getMusicDialog=function(){return this.createDialogWithFrame(MusicDialog,"Select music")};this.getLoadingDialog=function(){var A=this.createDialogWithFrame(LoadingDialog,"Loading...");A.closeButton.hide();return A};this.getWorkspacePanel=function(){return this.createPanelWithFrame(WorkspacePanel,"Workspace")};this.getToolboxPanel=function(){return this.createPanelWithFrame(Toolbox,"Toolbox")};this.getImageLibrary=function(){return this.createDialogWithFrame(ImageLibrary,"Image library")};this.getUrlDialog=function(){return this.createDialogWithFrame(UrlDialog)};this.getImageDialog=function(){return this.createDialogWithFrame(ImageDialog,"Load image")};this.getRegistrationDialog=function(){return this.createDialogWithFrame(RegistrationDialog,"Complete registration")};this.getTemplatesDialog=function(){return this.createDialogWithFrame(TemplatesDialog,"Load sample page")};this.getColorMenu=function(){return this.createMenuWithFrame(ColorMenu)};this.getCalendar=function(){return this.createMenuWithFrame(core.ui.Calendar)}}}ClassFactory.createPackage("editor.ui");ClassFactory.createClass(editor.ui,"VisibilityManager");with(editor.ui){editor.ui.VisibilityManager.constructor=function(){};editor.ui.VisibilityManager.visibility={};editor.ui.VisibilityManager.hide=function(){for(var A=0;A<arguments.length;A++){var B=arguments[A];if((B&&(B.constructor===core.ui.Window||defined(B.constructor.isSubclassOf)&&B.constructor.isSubclassOf(core.ui.Window)))){this.visibility[B.getId()]=B.isVisible();B.hide()}}};editor.ui.VisibilityManager.restore=function(){for(var A=0;A<arguments.length;A++){var B=arguments[A];if((B&&(B.constructor===core.ui.Window||defined(B.constructor.isSubclassOf)&&B.constructor.isSubclassOf(core.ui.Window)))){if(defined(this.visibility[B.getId()])){B.setVisible(this.visibility[B.getId()])}}}}}ClassFactory.createPackage("editor.elements");ClassFactory.createClass(editor.elements,"Session");with(editor.elements){editor.elements.Session.constructor=function(){this.flags={};this.counter=0;this.setModified=function(A,B){if(B){if(!this.isModified(A)){this.flags[A.getId()]|=Session.FLAG_MODIFIED;this.counter++}}else{if(this.isModified(A)){this.flags[A.getId()]&=~Session.FLAG_MODIFIED;this.flags[A.getId()]|=Session.FLAG_UNMODIFIED;this.counter--}}};this.isModified=function(A){return(this.flags[A.getId()]&Session.FLAG_MODIFIED)};this.hasModifications=function(){return(this.counter>0)};this.setNew=function(B,A){if(A){this.flags[B.getId()]|=Session.FLAG_NEW}else{this.flags[B.getId()]&=~Session.FLAG_NEW}};this.isNew=function(A){return(this.flags[A.getId()]&Session.FLAG_NEW)};this.setDeleted=function(B,A){if(A){this.flags[B.getId()]|=Session.FLAG_DELETED}else{this.flags[B.getId()]&=~Session.FLAG_DELETED}};this.isDeleted=function(A){return(this.flags[A.getId()]&Session.FLAG_DELETED)};this.clear=function(){this.flags={};this.counter=0}};editor.elements.Session.FLAG_NEW=1;editor.elements.Session.FLAG_MODIFIED=2;editor.elements.Session.FLAG_UNMODIFIED=4;editor.elements.Session.FLAG_DELETED=8}ClassFactory.createPackage("editor.elements");ClassFactory.createClass(editor.elements,"Settings");with(editor.elements){editor.elements.Settings.superClass=core.util.HashMap;editor.elements.Settings.constructor=function(){this.toString=function(){var B=[];for(var A=this.getKeys().iterator();A.hasNext();A.next()){B.push(A.current())}return B.join(" ")}}}ClassFactory.createPackage("editor.elements");ClassFactory.createClass(editor.elements,"Collection");with(editor.elements){editor.elements.Collection.constructor=function(){this.elements=[];this.listeners=new core.util.Listeners();this.settings=new Settings();this.session=new Session();this.Collection=function(){editor.Application.getInstance().addAppListener(this)};this.addListener=function(A){this.listeners.add(A)};this.removeListener=function(A){this.listeners.remove(A)};this.getSession=function(){return this.session};this.loadHtml=function(I){this.removeAll();this.settings.clear();this.session.clear();var B=document.createElement("div");B.innerHTML=I;var L=B.getElementsByTagName("div").item(0);var E=editor.Application.getInstance();for(var H=0;H<L.childNodes.length;H++){var D=L.childNodes.item(H);if((1==D.nodeType)&&defined(D.className)){try{var A=D.getAttribute("package");var M=A+"."+D.className;var J=ClassFactory.getClassByName(M);var G=D.cloneNode(true);document.body.appendChild(G);this.add(new J(G))}catch(K){console.warn("Failed creating new element: "+D.className);console.warn(K.message)}}}if(L.className){var C=L.className.split(" ");for(var F=new core.util.Iterator(C);F.hasNext();F.next()){this.settings.set(F.current(),true)}}E.plugins.background.loadBackgroundStyle(L.style.backgroundColor+" "+L.style.backgroundImage+" "+L.style.backgroundPosition+" "+L.style.backgroundRepeat);this.update(E.getMode()===editor.Application.MODE_EDIT)};this.setOption=function(B,C){var A=this.settings.get(B);this.settings.set(B,C);this.fireSettingsChanged(B,C,A)};this.getOption=function(A){return this.settings.get(A)};this.removeOption=function(A){var B=this.settings.get(A);this.settings.remove(A);this.fireSettingsRemoved(A,B)};this.isModified=function(){return this.session.hasModifications()};this.add=function(B,A,D,C){this.elements.push(B);B.setIndex(this.elements.length-1);if(C){if(defined(A)&&defined(D)){B.move(A-B.getWidth()/2,D-B.getHeight()/2)}else{B.center()}}this.fireElementAdded(B);return B};this.insert=function(B,A,D,C){this.add(B,A,D);if(defined(C)&&(C>0)){this.moveToBack(B,C)}B.setDeleted(false);return B};this.get=function(A){return this.elements[A]};this.remove=function(A){this.elements.splice(A.getIndex(),1);this.updateIndexes();A.destroy();this.fireElementRemoved(A)};this.removeAll=function(){for(var A=this.iterator();A.hasNext();A.next()){A.current().destroy()}this.elements=[]};this.getElementCount=function(){return this.elements.length};this.iterator=function(){return new core.util.Iterator(this.elements)};this.moveToFront=function(C,E){var D=C.getIndex();if(E==0||D==this.elements.length-1){return false}for(var A=D+1;A<this.elements.length;A++){var B=this.elements[A];if(B.isOverlappable()){this.elements[C.getIndex()]=B;B.setIndex(C.getIndex());this.elements[A]=C;C.setIndex(A);document.body.replaceChild(C.getElement(),B.getElement());document.body.insertBefore(B.getElement(),C.getElement());B.fireChanged();if(this.isOverlap(B,C)){if(defined(E)&&(E!=null)){if(!(--E>0)){C.fireChanged();return true}}}}}C.fireChanged();return false};this.moveToBack=function(B,E){var D=B.getIndex();if(E==0||D==0){return false}for(var A=D-1;A>=0;A--){var C=this.elements[A];if(C.isOverlappable()){this.elements[B.getIndex()]=C;C.setIndex(B.getIndex());this.elements[A]=B;B.setIndex(A);document.body.replaceChild(C.getElement(),B.getElement());document.body.insertBefore(B.getElement(),C.getElement());C.fireChanged();if(this.isOverlap(C,B)){if(defined(E)&&(E!=null)){if(!(--E>0)){B.fireChanged();return true}}}}}B.fireChanged();return false};this.getPosition=function(A){var C=0;for(var B=A.getIndex()+1;B<this.elements.length;B++){if(this.elements[B].isOverlappable()&&this.isOverlap(A,this.elements[B])){C++}}return C};this.renderHtml=function(){var D="";for(var C=this.iterator();C.hasNext();C.next()){var B=C.current();var A=B.getHtmlTag();if(null!==A){this.fireRenderElement(B,A);D+=A.toString()}}return D};this.excludeElement=function(A){if(!A.isDeleted()){this.fireElementRemoved(A);if(A.getElement()){document.body.removeChild(A.getElement())}this.elements.splice(A.getIndex(),1);this.updateIndexes();A.setDeleted(true)}};this.isOverlap=function(B,A){return((B.getX()+B.getWidth()>=A.getX())&&(B.getX()<=A.getX()+A.getWidth())&&(B.getY()+B.getHeight()>=A.getY())&&(B.getY()<=A.getY()+A.getHeight()))};this.updateIndexes=function(){for(var A=0;A<this.elements.length;A++){this.elements[A].setIndex(A)}};this.update=function(B){for(var A=this.iterator();A.hasNext();A.next()){A.current().setEnabled(B)}};this.fireElementAdded=function(A){this.listeners.call("onCollectionElementAdded",[this,A])};this.fireElementRemoved=function(A){this.listeners.call("onCollectionElementRemoved",[this,A])};this.fireRenderElement=function(B,A){this.listeners.call("onCollectionRenderElement",[this,B,A])};this.fireSettingsChanged=function(B,C,A){this.listeners.call("onCollectionSettingsChanged",[this,B,C,A])};this.fireSettingsRemoved=function(A,B){this.listeners.call("onCollectionSettingsRemoved",[this,A,B])};this.onAppSaving=function(B,A){A.set("page.content",this.renderHtml());A.set("page.settings",this.settings.toString())};this.onAppClose=function(){if(this.isModified()){throw new Error("The website is not saved!")}};this.onAppModeChanged=function(A){this.update(A.getMode()===editor.Application.MODE_EDIT)};this.onAppSaved=function(){this.session.clear()}}}ClassFactory.createPackage("editor");ClassFactory.createClass(editor,"Application");with(editor){editor.Application.constructor=function(){this.plugins={};this.mode=Application.MODE_EDIT;this.Application=function(){this.listeners=new core.util.Listeners();this.config=new core.app.Config()};this.init=function(id){this.factory=new editor.ui.GuiFactory();this.collection=new editor.elements.Collection();this.workspace=new Workspace();this.loadConfig(id);this.loadPlugins();this.deferredInit()};this.save=function(){this.workspace.setTitle(this.config.get("page.personName")+"'s page (Saving...)");var context=new SaveContext(this.getUserCommand("ajax.SavePage"));this.fireSaving(context);core.ajax.sendRequest(context.getUrl(),this.onSaveResponse,context.toObject())};this.close=function(){try{this.fireClose()}catch(e){return e.message}};this.clear=function(){this.fireClear();this.factory.getToolboxPanel().getContentWindow().updateControls();this.collection.removeAll()};this.loadTemplate=function(template){this.config.set("page.template",template);this.loadFromUrl("ajax.Template?pageId="+this.config.get("id")+"&name="+template)};this.loadPage=function(pageId){this.loadFromUrl("ajax.PageContent?pageId="+pageId)};this.switchPanel=function(panel){if(this.currentPanel!=panel){if(panel){if(this.currentPanel){panel.move(this.currentPanel.getX(),this.currentPanel.getY());this.currentPanel.hide()}else{var workspace=this.factory.getWorkspacePanel();panel.move(workspace.getX()+workspace.getWidth(),workspace.getY())}}else{if(this.currentPanel){this.currentPanel.hide()}}this.currentPanel=panel;if(this.currentPanel){this.currentPanel.show()}}};this.switchMode=function(mode){this.mode=mode;if(editor.Application.MODE_PREVIEW==mode){core.ui.quirks.TextSelection.allowSelection(window.document.body);editor.ui.VisibilityManager.hide(this.factory.getWorkspacePanel(),this.factory.getToolboxPanel(),this.currentPanel)}else{core.ui.quirks.TextSelection.preventSelection(window.document.body);editor.ui.VisibilityManager.restore(this.factory.getWorkspacePanel(),this.factory.getToolboxPanel(),this.currentPanel)}this.fireModeChanged()};this.getConfig=function(){return this.config};this.getMode=function(){return this.mode};this.getCollection=function(){return this.collection};this.getGuiFactory=function(){return this.factory};this.getWorkspace=function(){return this.workspace};this.getSession=function(){return this.session};this.getCurrentPanel=function(){return this.currentPanel};this.addAppListener=function(listener){this.listeners.add(listener)};this.removeAppListener=function(listener){this.listeners.remove(listener)};this.loadConfig=function(id){if(this.config.load("ajax.Config?pageId="+id)){this.config.set("id",id);with(common.util.DateUtils){this.config.set("page.birthDate",toMilliseconds(this.config.get("page.birthDate")));this.config.set("page.deathDate",toMilliseconds(this.config.get("page.deathDate")));this.config.set("page.savedTime",timestamp2millisec(this.config.get("page.savedTime")));this.fireConfigured()}}else{console.error("Cannot load configuration.")}};this.loadPlugins=function(){var plugins=this.config.get("editor.plugins",{});for(var name in plugins){try{var clazz=ClassFactory.getClassByName(plugins[name]);this.plugins[name]=new clazz()}catch(e){console.error("Failed to load plugins: %s (%s)",name,e.message)}}};this.loadFromUrl=function(url){this.fireClear();this.switchPanel(null);this.collection.removeAll();try{var html=HTTPFileLoader.loadFile(url);this.collection.loadHtml(html);this.firePageLoaded(url)}catch(e){this.fireLoadingError(url,e.message)}};this.fireInitComplete=function(){this.listeners.call("onAppInitComplete",[this])};this.fireClear=function(){this.listeners.call("onAppClear",[this])};this.fireClose=function(){this.listeners.call("onAppClose",[this])};this.fireConfigured=function(){this.listeners.call("onAppConfigured",[this])};this.fireModeChanged=function(){this.listeners.call("onAppModeChanged",[this])};this.firePageLoaded=function(url){this.listeners.call("onAppPageLoaded",[this,url])};this.fireLoadingError=function(url,message){this.listeners.call("onAppLoadingError",[this,url,message])};this.fireSaving=function(context){this.listeners.call("onAppSaving",[this,context])};this.fireSaved=function(){this.listeners.call("onAppSaved",[this])};this.fireSaveError=function(message){this.listeners.call("onAppSaveError",[this,message])};this.onSaveResponse=callback(this,function(response){if("OK"==response.status){if(defined(response.registered)){this.config.set("registration.complete",true)}var time=common.util.DateUtils.timestamp2millisec(response.savedTime);this.config.set("page.savedTime",time);this.fireSaved();this.workspace.setTitle(this.config.get("page.personName")+"'s website (last saved on "+common.util.DateUtils.toClientDate(time,true)+")")}else{this.fireSaveError(response.message)}});this.getUserCommand=function(cmd){return cmd+"?pageId="+this.config.get("page.id")};this.deferredInit=callback(this,function(){switch(this.initStep){case undefined:var time=this.config.get("page.savedTime")?"last saved on "+common.util.DateUtils.toClientDate(this.config.get("page.savedTime"),true):"Unsaved";this.workspace.setTitle(this.config.get("page.personName")+"'s website ("+time+")");core.ui.quirks.TextSelection.preventSelection(window.document.body);this.initStep=0;case 0:var loading=this.factory.getLoadingDialog();loading.center();loading.doModal();break;case 1:this.factory.getWorkspacePanel().move(0,0);break;case 2:var toolbox=this.factory.getToolboxPanel();toolbox.move(document.body.clientWidth-toolbox.getWidth(),0);break;case 3:this.workspace.init();break;case 4:this.factory.getWorkspacePanel().show();this.factory.getToolboxPanel().show();break;default:if(this.config.get("editor.firstRun")){this.loadTemplate(this.config.get("page.template"))}else{this.loadPage(this.config.get("page.id"))}this.factory.getLoadingDialog().endModal();this.fireInitComplete();if(this.config.get("editor.firstRun")){this.save()}return }var totalSteps=6;var progressBar=this.factory.getLoadingDialog().getContentWindow().progressBar;progressBar.setPos(++this.initStep/totalSteps*100);window.setTimeout(this.deferredInit,1)})};editor.Application.getInstance=function(){if(!defined(this.instance)){this.instance=new Application()}return this.instance};editor.Application.MODE_EDIT=1;editor.Application.MODE_PREVIEW=2}ClassFactory.createPackage("editor.plugins.comments");ClassFactory.createClass(editor.plugins.comments,"EditCommentDialog");with(editor.plugins.comments){editor.plugins.comments.EditCommentDialog.superClass=editor.ui.MessageDialog;editor.plugins.comments.EditCommentDialog.constructor=function(){this.notifyUpdated=new core.ui.Notification();this.setCommentId=function(A){this.commentId=A};this.submitClicked=override(this.submitClicked,function(){var A=editor.Application.getInstance();core.ajax.sendRequest(A.getUserCommand("ajax.EditComment"),this.onCommentUpdated,{"commentId":this.commentId,"name":this.name.getText(),"email":this.mail.getText(),"text":this.text.getText()});arguments.callee.prototype.apply(this,[])});this.onCommentUpdated=callback(this,function(A){if(A.status=="OK"){this.notifyUpdated.send(this,A.commentId,A.name,A.email,A.text)}})}}ClassFactory.createPackage("core.html");ClassFactory.createClass(core.html,"Tag");with(core.html){core.html.Tag.constructor=function(){this.name;this.attrs;this.content;this.Tag=function(B,A,C){this.name=B;this.attrs=defined(A)?A:{};this.content=defined(C)?C:""};this.setName=function(A){this.name=A};this.getName=function(){return this.name};this.setContent=function(A){this.content=A};this.getContent=function(){return this.content};this.addContent=function(A){this.content=this.content.toString()+A};this.setAttribute=function(A,B){this.attrs[A]=B};this.getAttribute=function(A){return this.attrs[A]};this.hasAttribute=function(A){return(this.attrs[A])};this.removeAttribute=function(A){delete this.attrs[A]};this.toString=function(){var B="<"+this.name;for(var A in this.attrs){if(this.attrs[A]){B+=(" "+A+'="'+this.attrs[A]+'"')}}return(this.content||("div"==this.name.toLowerCase()))?(B+">"+this.content+"</"+this.name+">"):(B+" />")}}}ClassFactory.createPackage("core.html");ClassFactory.createClass(core.html,"Style");with(core.html){core.html.Style.constructor=function(){this.props;this.filters;this.Style=function(A){this.props=defined(A)?A:{};this.filters={}};this.setProperty=function(A,B){this.props[A]=B};this.getProperty=function(A){return this.props[A]};this.hasProperty=function(A){return defined(this.props[A])};this.removeProperty=function(A){delete this.props[A]};this.setFilter=function(A,B){this.filters[A]=defined(B)?B:{}};this.hasFilter=function(A){return defined(this.filters[A])};this.removeFilter=function(A){delete this.filters[A]};this.setOpacity=function(A){if(100==A){this.removeProperty("opacity");this.removeProperty("-moz-opacity");this.removeProperty("-khtml-opacity");this.removeFilter("Alpha")}else{this.setProperty("opacity",A/100);this.setProperty("-moz-opacity",A/100);this.setProperty("-khtml-opacity",A/100);this.setFilter("Alpha",{"opacity":A})}};this.getOpacity=function(){return this.hasProperty("opacity")?this.getProperty("opacity"):100};this.toString=function(){var F=[];for(var B in this.props){if(this.props[B]){F.push(B+": "+this.props[B])}}var E=[];for(var B in this.filters){var C=this.filters[B];var D=[];if("object"==typeof C){for(var A in C){D.push(A+"="+C[A])}}E.push("filter:progid:DXImageTransform.Microsoft."+B+"("+D.join(", ")+")")}if(E.length>0){F.push(E.join(" "))}return F.join("; ")}}}ClassFactory.createPackage("core.ui");ClassFactory.createClass(core.ui,"Gripper");with(core.ui){core.ui.Gripper.superClass=core.ui.Window;core.ui.Gripper.constructor=function(){this.target;this.resizeinfo={};this.direction=(Gripper.SOUTH|Gripper.EAST);this.notifyBeginResize=new Notification();this.notifyResize=new Notification();this.notifyEndResize=new Notification();this.setResizeWindow=function(E,C,A,D,B){this.target=E;this.resizeinfo.minWidth=C;this.resizeinfo.minHeight=A;this.resizeinfo.maxWidth=D;this.resizeinfo.maxHeight=B};this.getResizeWindow=function(){return this.target};this.setDirection=function(A){this.direction=A;var B="";if(this.direction&Gripper.SOUTH){B+="s"}else{if(this.direction&Gripper.NORTH){B+="n"}}if(this.direction&Gripper.WEST){B+="w"}else{if(this.direction&Gripper.EAST){B+="e"}}this.setStyle("cursor",B+"-resize")};this.beginResize=function(A){this.resizeinfo.resizeState=true;this.resizeinfo.x=A.getScreenX();this.resizeinfo.y=A.getScreenY();this.attachGlobalEvent("mouseup");this.attachGlobalEvent("mousemove")};this.endResize=function(){this.detachGlobalEvent("mouseup");this.detachGlobalEvent("mousemove");this.resizeinfo.resizeState=false};this.isResizing=function(){return this.resizeinfo.resizeState};this.close=override(this.close,function(){if(this.isResizing()){this.endResize()}arguments.callee.prototype.apply(this,[])});this.onmousedown=function(A){this.beginResize(A);this.notifyBeginResize.send(this);A.stop()};this.onmousemove=function(D){if(this.isResizing()){var B=(D.getScreenX()-this.resizeinfo.x);var A=(D.getScreenY()-this.resizeinfo.y);B*=((this.direction&Gripper.EAST)||(this.direction&Gripper.WEST)?1:0);A*=((this.direction&Gripper.NORTH)||(this.direction&Gripper.SOUTH)?1:0);var G=this.target.getX();var F=this.target.getY();var C=this.target.getWidth();var E=this.target.getHeight();if(this.direction&Gripper.WEST){G+=B;C+=-B}else{C+=B}if(this.direction&Gripper.NORTH){F+=A;E+=-A}else{E+=A}if(defined(this.resizeinfo.minWidth)&&(C<this.resizeinfo.minWidth)){C=this.resizeinfo.minWidth;G=this.target.getX()}if(defined(this.resizeinfo.minHeight)&&(E<this.resizeinfo.minHeight)){E=this.resizeinfo.minHeight;F=this.target.getY()}if(defined(this.resizeinfo.maxWidth)&&(C>this.resizeinfo.maxWidth)){C=this.resizeinfo.maxWidth;G=this.target.getX()}if(defined(this.resizeinfo.maxHeight)&&(E>this.resizeinfo.maxHeight)){E=this.resizeinfo.maxHeight;F=this.target.getY()}this.target.move(G,F);this.target.resize(C,E);this.resizeinfo.x=D.getScreenX();this.resizeinfo.y=D.getScreenY();D.stop();this.notifyResize.send(this,B,A)}};this.onmouseup=function(A){if(this.isResizing()){this.endResize();this.notifyEndResize.send(this);A.stop()}}};core.ui.Gripper.NORTH=1;core.ui.Gripper.SOUTH=4;core.ui.Gripper.EAST=8;core.ui.Gripper.WEST=16}ClassFactory.createPackage("editor.ui");ClassFactory.createClass(editor.ui,"SelectionMenu");with(editor.ui){editor.ui.SelectionMenu.superClass=core.ui.Window;editor.ui.SelectionMenu.constructor=function(){this.SelectionMenu=function(A){arguments.callee.prototype.apply(this,[]);this.builder=A};this.getBuilder=function(){return this.builder};this.updateLayout=function(B){var A=0;var C=0;if((document.body.clientWidth+document.body.scrollLeft)>(B.getAbsX()+B.getWidth())){A=B.getAbsX()+B.getWidth()-this.getWidth()}else{A=B.getAbsX()}if(document.body.scrollTop<(B.getAbsY()-this.getHeight())){C=B.getAbsY()-this.getHeight()}else{C=B.getAbsY()+B.getHeight()}this.move(A,C)}}}ClassFactory.createPackage("editor.commands");ClassFactory.createClass(editor.commands,"MoveCommand");with(editor.commands){editor.commands.MoveCommand.superClass=editor.commands.AbstractCommand;editor.commands.MoveCommand.constructor=function(){this.MoveCommand=function(){arguments.callee.prototype.apply(this,[]);this.changed=false;this.saveInitialState()};this.hasChanges=function(){this.saveFinalState();return this.changed};this.execute=function(){this.saveFinalState();for(var B in this.initialState){var A=this.initialState[B].target;A.move(this.finalState[B].x,this.finalState[B].y);A.setModified(true)}editor.ui.SelectionManager.get().updateSelection()};this.unexecute=function(){for(var B in this.initialState){var A=this.initialState[B].target;A.move(this.initialState[B].x,this.initialState[B].y);A.setModified(this.initialState[B].wasModified)}editor.ui.SelectionManager.get().updateSelection()};this.saveInitialState=function(){if(!defined(this.initialState)){this.initialState={};var B=0;var C=null;var A=editor.ui.SelectionManager.get().getSelectedElements();for(var D=A.iterator();D.hasNext();D.next()){C=D.current();this.initialState[C.getId()]={target:C,x:C.getAbsX(),y:C.getAbsY(),wasModified:C.isModified()};B++}if(B>1){this.setName("Move group of objects")}else{if(C!=null){this.setName("Move "+C.getName().toLowerCase())}}}};this.saveFinalState=function(){if(!defined(this.finalState)){this.finalState={};for(var B in this.initialState){var A=this.initialState[B].target;this.finalState[B]={x:A.getAbsX(),y:A.getAbsY()};if((this.initialState[B].x!==this.finalState[B].x)||(this.initialState[B].y!==this.finalState[B].y)){this.changed=true}}}}}}ClassFactory.createPackage("editor.commands");ClassFactory.createClass(editor.commands,"ResizeCommand");with(editor.commands){editor.commands.ResizeCommand.superClass=editor.commands.AbstractCommand;editor.commands.ResizeCommand.constructor=function(){this.ResizeCommand=function(B,A){arguments.callee.prototype.apply(this,[B,A]);this.saveInitialState()};this.hasChanges=function(){return((this.initialState.x!==this.target.getAbsX())||(this.initialState.y!==this.target.getAbsY())||(this.initialState.width!==this.target.getWidth())||(this.initialState.height!==this.target.getHeight()))};this.execute=function(){this.saveFinalState();this.target.move(this.finalState.x,this.finalState.y);this.target.resize(this.finalState.width,this.finalState.height);this.target.setModified(true);editor.ui.SelectionManager.get().updateSelection()};this.unexecute=function(){this.target.move(this.initialState.x,this.initialState.y);this.target.resize(this.initialState.width,this.initialState.height);this.target.setModified(this.initialState.wasModified);editor.ui.SelectionManager.get().updateSelection()};this.saveInitialState=function(){if(!defined(this.initialState)){this.initialState={x:this.target.getAbsX(),y:this.target.getAbsY(),width:this.target.getWidth(),height:this.target.getHeight(),wasModified:this.target.isModified()}}};this.saveFinalState=function(){if(!defined(this.finalState)){this.finalState={x:this.target.getAbsX(),y:this.target.getAbsY(),width:this.target.getWidth(),height:this.target.getHeight()}}}}}ClassFactory.createPackage("editor.ui");ClassFactory.createClass(editor.ui,"DefaultSelection");with(editor.ui){editor.ui.DefaultSelection.superClass=editor.ui.AbstractSelection;editor.ui.DefaultSelection.constructor=function(){this.grippers={};this.gripperSize;this.handle;this.menu;this.DefaultSelection=function(target){arguments.callee.prototype.apply(this,[target]);this.setStyle("background-image","url(images/blank.gif)");this.setStyle("z-index",3);with(core.ui.Gripper){var dirs={"nw":NORTH|WEST,"n":NORTH,"ne":NORTH|EAST,"e":EAST,"se":SOUTH|EAST,"s":SOUTH,"sw":SOUTH|WEST,"w":WEST};for(var n in dirs){this.grippers[n]=new core.ui.Gripper(this);this.grippers[n].setDirection(dirs[n]);this.grippers[n].setStyle("position","absolute");this.grippers[n].notifyBeginResize.addListener(this.onBeginResize);this.grippers[n].notifyEndResize.addListener(this.onEndResize);if(!defined(this.gripperSize)){this.gripperSize={width:this.grippers[n].getWidth(),height:this.grippers[n].getHeight()}}this.grippers[n].setResizeWindow(this,this.getMinimumWidth(),this.getMinimumHeight(),this.getMaximumWidth(),this.getMaximumHeight())}}this.handle=new core.ui.Handle(this,this.gripperSize.width,this.gripperSize.height,target.getWidth(),target.getHeight());this.handle.setDragWindow(this);this.handle.setStyle("position","absolute");this.handle.notifyDrag.addListener(this.onDrag);this.handle.notifyBeginDrag.addListener(this.onBeginDrag);this.handle.notifyEndDrag.addListener(this.onEndDrag)};this.setMenu=function(menu){this.menu=menu};this.getMenu=function(){return this.menu};this.move=function(x,y){this.target.move(x+this.gripperSize.width,y+this.gripperSize.height);this.updateLayout()};this.resize=function(width,height){width=Math.max(this.getMinimumWidth(),width);height=Math.max(this.getMinimumHeight(),height);this.target.resize(width-this.gripperSize.width*2,height-this.gripperSize.height*2);this.updateLayout()};this.setVisible=override(this.setVisible,function(visible){if((this.menu&&(this.menu.constructor===SelectionMenu||defined(this.menu.constructor.isSubclassOf)&&this.menu.constructor.isSubclassOf(SelectionMenu)))){this.menu.setVisible(visible)}arguments.callee.prototype.apply(this,[visible])});this.close=override(this.close,function(){if((this.menu&&(this.menu.constructor===SelectionMenu||defined(this.menu.constructor.isSubclassOf)&&this.menu.constructor.isSubclassOf(SelectionMenu)))){this.menu.close()}arguments.callee.prototype.apply(this,[])});this.select=override(this.select,function(){this.updateLayout();arguments.callee.prototype.apply(this,[]);this.setFocus(true)});this.unselect=override(this.unselect,function(){arguments.callee.prototype.apply(this,[]);this.setFocus(false);this.close()});this.updateLayout=function(){var style={};if((this.target.getWidth()>this.gripperSize.width)&&(this.target.getHeight()>this.gripperSize.height)){style.left=this.target.getX()-this.gripperSize.width;style.top=this.target.getY()-this.gripperSize.height;style.width=this.target.getWidth()+this.gripperSize.width*2;style.height=this.target.getHeight()+this.gripperSize.height*2}else{style.width=this.gripperSize.width*3+3;style.height=this.gripperSize.height*3+3;style.left=this.target.getX()+(this.target.getWidth()-style.width)/2;style.top=this.target.getY()+(this.target.getHeight()-style.height)/2}for(var property in style){this.setStyle(property,style[property]+"px")}this.handle.resize(this.target.getWidth(),this.target.getHeight());this.arrangeGrippers();if((this.menu&&(this.menu.constructor===SelectionMenu||defined(this.menu.constructor.isSubclassOf)&&this.menu.constructor.isSubclassOf(SelectionMenu)))){this.menu.updateLayout(this)}};this.getMinimumWidth=function(){var bw=parseInt(this.target.getStyle("border-left-width"));bw=bw?bw:0;return 2*bw+this.gripperSize.width*3+3};this.getMinimumHeight=function(){var bw=parseInt(this.target.getStyle("border-left-width"));bw=bw?bw:0;return 2*bw+this.gripperSize.height*3+3};this.getMaximumWidth=function(){return 100000};this.getMaximumHeight=function(){return 100000};this.arrangeGrippers=function(){var width=this.getWidth();var height=this.getHeight();this.grippers["nw"].move(0,0);this.grippers["n"].move((width-this.gripperSize.width)/2,0);this.grippers["ne"].move(width-this.gripperSize.width,0);this.grippers["e"].move(width-this.gripperSize.width,(height-this.gripperSize.height)/2);this.grippers["se"].move(width-this.gripperSize.width,height-this.gripperSize.height);this.grippers["s"].move((width-this.gripperSize.width)/2,height-this.gripperSize.height);this.grippers["sw"].move(0,height-this.gripperSize.height);this.grippers["w"].move(0,(height-this.gripperSize.height)/2)};this.alignToGrid=function(){var x=Math.floor(this.getX()/Grid.SIZE)*Grid.SIZE;var y=Math.floor(this.getY()/Grid.SIZE)*Grid.SIZE;this.move(x,y)};this.onDrag=callback(this,function(sender,dx,dy){editor.ui.SelectionManager.get().handleMove(dx,dy,this)});this.onBeginDrag=callback(this,function(){this.moveCommand=new editor.commands.MoveCommand()});this.onEndDrag=callback(this,function(){with(editor.commands){if(((this.moveCommand&&(this.moveCommand.constructor===MoveCommand||defined(this.moveCommand.constructor.isSubclassOf)&&this.moveCommand.constructor.isSubclassOf(MoveCommand))))&&this.moveCommand.hasChanges()){CommandHistory.get().execute(this.moveCommand);delete this.moveCommand}}});this.onBeginResize=callback(this,function(){this.resizeCommand=new editor.commands.ResizeCommand(this.target,"Resize "+this.target.getName().toLowerCase())});this.onEndResize=callback(this,function(){with(editor.commands){if(((this.resizeCommand&&(this.resizeCommand.constructor===ResizeCommand||defined(this.resizeCommand.constructor.isSubclassOf)&&this.resizeCommand.constructor.isSubclassOf(ResizeCommand))))&&this.resizeCommand.hasChanges()){CommandHistory.get().execute(this.resizeCommand);delete this.resizeCommand}}});this.onmousedown=function(event,target){event.stop();if(event.ctrlKey){editor.ui.SelectionManager.get().removeSelection(this.target)}else{if((target===this.target)||(target===this.handle)){if(!this.handle.isDragging()){this.handle.beginDrag(event)}}}};this.onmouseup=function(){var app=editor.Application.getInstance();if(app.getWorkspace().isGridVisible()){var x0=this.getX();var y0=this.getY();this.alignToGrid();var dx=this.getX()-x0;var dy=this.getY()-y0;editor.ui.SelectionManager.get().handleMove(dx,dy,this)}};this.ondblclick=function(event){this.target.activate();this.target.edit();event.stop()};this.onkeydown=function(event){var handled=false;var selections=editor.ui.SelectionManager.get();var d=(theApp.getWorkspace().isGridVisible())?Grid.SIZE:3;if(core.ui.Event.KEY_F2==event.keyCode){this.target.edit();handled=true}else{if(core.ui.Event.KEY_LEFT_ARROW==event.keyCode){selections.handleMove(-d,0);handled=true}else{if(core.ui.Event.KEY_RIGHT_ARROW==event.keyCode){selections.handleMove(d,0);handled=true}else{if(core.ui.Event.KEY_UP_ARROW==event.keyCode){selections.handleMove(0,-d);handled=true}else{if(core.ui.Event.KEY_DOWN_ARROW==event.keyCode){selections.handleMove(0,d);handled=true}else{if(event.ctrlKey){if(event.keyCode==core.ui.Event.KEY_F4){return true}}}}}}}if(handled){event.cancel();event.stop()}}}}ClassFactory.createPackage("editor.elements");ClassFactory.createClass(editor.elements,"AbstractElement");with(editor.elements){editor.elements.AbstractElement.superClass=core.ui.Window;editor.elements.AbstractElement.constructor=function(){this.listeners=new core.util.Listeners();this.AbstractElement=function(root,name){arguments.callee.prototype.apply(this,[null,undefined,undefined,undefined,undefined,root]);this.name=name;this.setStyle("position","absolute");this.setStyle("z-index",2);if(defined(window.theApp)){this.setStyle("display","");this.setSession(editor.Application.getInstance().getCollection().getSession())}if(this.isInEditMode()){this.setNew(!defined(root))}if(defined(root)){this.load(root)}else{this.create()}};this.addElementListener=function(listener){this.listeners.add(listener)};this.removeElementListener=function(listener){this.listeners.remove(listener)};this.getName=function(){return this.name};this.setSession=function(session){this.session=session};this.getSession=function(){return this.session};this.setNew=function(isNew){this.session.setNew(this,isNew)};this.isNew=function(){return this.session.isNew(this)};this.setModified=function(modified){this.session.setModified(this,modified)};this.isModified=function(){return this.session.isModified(this)};this.setDeleted=function(deleted){this.session.setDeleted(this,deleted)};this.isDeleted=function(){return this.session.isDeleted(this)};this.getIndex=function(){return this.positionIndex};this.setIndex=function(positionIndex){this.positionIndex=positionIndex};this.getPosition=function(){return editor.Application.getInstance().getCollection().getPosition(this)};this.select=function(){editor.ui.SelectionManager.get().setSelection(this)};this.destroy=function(){this.close()};this.center=function(){this.move(core.ui.Window.getWidth()/2-this.getWidth()/2+document.body.scrollLeft/2,core.ui.Window.getHeight()/2-this.getHeight()/2+document.body.scrollTop/2)};this.isOverlappable=function(){return true};this.isInEditMode=function(){return((this.session&&(this.session.constructor===Session||defined(this.session.constructor.isSubclassOf)&&this.session.constructor.isSubclassOf(Session))))};this.isInPreviewMode=function(){return !this.isInEditMode()};this.getHtmlTag=function(){with(core.html){var tag=new Tag("div",{"class":this.constructor.className,"package":this.constructor.pkg.name});tag.setAttribute("style",new Style({"position":"absolute","overflow":"hidden","left":this.getX()+"px","top":this.getY()+"px","width":this.getWidth()+"px","height":this.getHeight()+"px","z-index":this.getStyle("z-index")}));tag.setContent(this.getText());return tag}};this.move=override(this.move,function(x,y){arguments.callee.prototype.apply(this,[x,y]);this.fireChanged()});this.resize=override(this.resize,function(w,h){arguments.callee.prototype.apply(this,[w,h]);this.fireChanged()});this.setVisible=override(this.setVisible,function(show){arguments.callee.prototype.apply(this,[show]);this.fireChanged()});this.edit=function(){};this.activate=function(){};this.load=function(root){};this.create=function(){};this.createSelection=function(){return new editor.ui.DefaultSelection(this)};this.fireChanged=function(){this.listeners.call("onElementChanged",[this])};this.fireActivated=function(){this.listeners.call("onElementActivated",[this])};this.onmousedown=function(event){if(this.isInEditMode()){var selections=editor.ui.SelectionManager.get();if(event.ctrlKey){selections.addSelection(this).setFocus(true)}else{var selected=selections.isSelected(this);var selection=(selected)?selections.getSelection(this):selections.setSelection(this);selection.setFocus(!selected);if((selection&&(selection.constructor===editor.ui.DefaultSelection||defined(selection.constructor.isSubclassOf)&&selection.constructor.isSubclassOf(editor.ui.DefaultSelection)))){selection.onmousedown(event,this)}}this.activate();this.fireActivated()}event.stop();event.cancel()}}}ClassFactory.createPackage("editor.plugins.comments");ClassFactory.createClass(editor.plugins.comments,"Comment");with(editor.plugins.comments){editor.plugins.comments.Comment.superClass=core.ui.Window;editor.plugins.comments.Comment.constructor=function(){this.notifyDeleted=new core.ui.Notification();this.notifyChanged=new core.ui.Notification();this.Comment=function(parent,x,y,width,height){arguments.callee.prototype.apply(this,[parent,x,y,width,height]);this.initHeader();this.initBody()};this.initHeader=function(){var header=new core.ui.Window(this);header.addStyleName("CommentHeader");var left=new core.ui.Window(header);left.addStyleName("HeaderLeftCorner");var right=new core.ui.Window(header);right.addStyleName("HeaderRightCorner");this.nameStatic=new core.ui.Static(header);this.nameStatic.addStyleName("CommentHeaderNameStatic");this.mailStatic=new core.ui.Static(header);this.mailStatic.addStyleName("CommentHeaderMailStatic");this.timeStatic=new core.ui.Static(header);this.timeStatic.addStyleName("CommentHeaderDateStatic");this.deleteButton=new core.ui.ImageButton(header);this.deleteButton.addStyleName("CommentHeaderDeleteButton");this.deleteButton.setImageList("images/Comments/delete_button.gif");this.deleteButton.setToolTip("Delete this comment");this.deleteButton.oncommand=this.onDeleteClick;this.editButton=new core.ui.ImageButton(header);this.editButton.addStyleName("CommentHeaderEditButton");this.editButton.setImageList("images/Comments/edit_button.gif");this.editButton.setToolTip("Edit this comment");this.editButton.oncommand=this.onEditClick;if(!defined(window.theApp)){this.editButton.hide();this.deleteButton.hide();this.mailStatic.setStyle("display","none")}};this.initBody=function(){var body=new core.ui.Window(this);body.addStyleName("CommentBody");body.setStyle("opacity",70);this.textStatic=new core.ui.Static(body);this.textStatic.addStyleName("CommentText")};this.setEditable=function(editable){if(editable){this.deleteButton.show();this.editButton.show();this.mailStatic.setStyle("display","block")}else{this.deleteButton.hide();this.editButton.hide();this.mailStatic.setStyle("display","none")}};this.setData=function(id,name,text,time,mail,page){this.commentId=id;this.name=name;this.text=text;this.time=time;this.mail=mail;this.page=page;this.updateLayout()};this.setText=function(text){this.text=text;this.updateLayout()};this.setMail=function(mail){this.mail=mail;this.updateLayout()};this.setName=function(name){this.name=name;this.updateLayout()};this.setCommentId=function(id){this.commentId=id;this.updateLayout()};this.setTime=function(time){this.time=time;this.updateLayout()};this.updateLayout=function(){with(common.util){this.nameStatic.setText(MemorialUtils.htmlEncode(this.name));this.mailStatic.setText(MemorialUtils.htmlEncode("<"+this.mail+">"));this.timeStatic.setText(MemorialUtils.htmlEncode(DateUtils.toClientDate(this.time*1000,true)));this.textStatic.setText(this.text?MemorialUtils.htmlEncode(this.text).replace(/\n/g,"<br/>"):"")}};this.onDeleteClick=callback(this,function(){if(confirm("Do you want to delete this comment?")){core.ajax.sendRequest("ajax.DeleteComment",this.onServerResponse,{"pageId":common.util.MemorialUtils.getPageId(),"commentId":this.commentId})}});this.onEditClick=callback(this,function(){var dialog=ObjectComments.getInstance().getEditCommentDialog();dialog.setCommentId(this.commentId);dialog.setData(this.name,this.mail,this.text);dialog.notifyUpdated.addListener(this.onCommentUpdated,true);dialog.center();dialog.doModal()});this.onCommentUpdated=callback(this,function(sender,commentId,name,mail,text){if(this.commentId==commentId){this.setName(name);this.setMail(mail);this.setText(text);this.notifyChanged.send(this)}});this.onServerResponse=callback(this,function(response){if("OK"==response.status){this.notifyDeleted.send(this)}else{}})}}ClassFactory.createPackage("editor.plugins.comments");ClassFactory.createClass(editor.plugins.comments,"ViewCommentsDialog");with(editor.plugins.comments){editor.plugins.comments.ViewCommentsDialog.superClass=core.ui.Dialog;editor.plugins.comments.ViewCommentsDialog.constructor=function(){this.notifyClose=new core.ui.Notification();this.ViewCommentsDialog=function(parent){arguments.callee.prototype.apply(this,[parent,0,0]);this.initContent()};this.setOwner=function(owner){this.owner=owner};this.getElementId=function(){return((this.owner&&(this.owner.constructor===editor.elements.AbstractElement||defined(this.owner.constructor.isSubclassOf)&&this.owner.constructor.isSubclassOf(editor.elements.AbstractElement))))?ObjectComments.getInstance().getElementId(this.owner):this.elementId};this.setCommentId=function(commentId){this.commentId=commentId;this.setOwner(null)};this.initCommentList=function(){this.scrollWindow=new core.ui.ScrollWindow(this.bodyPanel);this.commentList=new core.ui.Window(this.scrollWindow);this.scrollWindow.setContentWindow(this.commentList);this.scrollWindow.addStyleName("CommentsDialogCommentList")};this.onCommentsReceaved=callback(this,function(response){if(response.status=="OK"){this.clearCommentList();for(var v in response.comments){var info=response.comments[v];if(defined(info.text)){var comment=new Comment(this.commentList);comment.setEditable(defined(window.theApp)&&(theApp.getMode()===editor.Application.MODE_EDIT));comment.notifyChanged.addListener(this.onCommentChanged);comment.notifyDeleted.addListener(this.onCommentDeleted);comment.setData(info.id,info.name,info.text,info.time,info.email,"")}}if(!(this.owner&&(this.owner.constructor===editor.elements.AbstractElement||defined(this.owner.constructor.isSubclassOf)&&this.owner.constructor.isSubclassOf(editor.elements.AbstractElement)))){this.elementId=response.elementId}}this.scrollWindow.reset()});this.initContent=function(){with(core.ui){var header=new Handle(this);header.addStyleName("CommentsDialogHeader");header.setDragWindow(this);var left=new Window(header);left.addStyleName("HeaderLeftCorner");var right=new Window(header);right.addStyleName("HeaderRightCorner");var rssButton=new ImageButton(header);rssButton.addStyleName("RssButton");rssButton.setImageList("images/Comments/rss.gif");rssButton.setToolTip("Subscribe to RSS");rssButton.oncommand=this.onRssClick;var refreshButton=new ImageButton(header);refreshButton.addStyleName("RefreshButton");refreshButton.setImageList("images/Comments/refresh.gif");refreshButton.setToolTip("Refresh list");refreshButton.oncommand=this.onRefreshClick;this.bodyPanel=new Window(this);this.bodyPanel.addStyleName("CommentsDialogBodyPanel");this.initSortCombo(this.bodyPanel);this.initCommentList(this.bodyPanel);this.closeButton=new ImageButton(this.bodyPanel);this.closeButton.addStyleName("CommentsDialogButtonClose");this.closeButton.setImageList("images/Comments/close_button.gif");this.closeButton.setToolTip("Close window");this.closeButton.oncommand=this.onCloseClick}};this.initSortCombo=function(parent){this.sortCombo=new core.ui.ComboBox(parent);this.sortCombo.addStyleName("SortCombo");this.sortCombo.getMenu().setStyleName("SortComboMenu");this.sortCombo.addItem("Sort by ASC","asc",true);this.sortCombo.addItem("Sort by DESC","desc",false);this.sortCombo.notifyValueChanged.addListener(this.onSortTypeChanged);this.order="asc"};this.onCloseClick=callback(this,function(){this.endModal()});this.onRefreshClick=callback(this,function(){this.updateCommentList()});this.onRssClick=callback(this,function(){with(common.util){window.open(MemorialUtils.getBaseUri()+"/rss.Comments?pageId="+MemorialUtils.getPageId()+"&elementId="+this.getElementId())}});this.clearCommentList=function(){for(var id in this.commentList.children){this.commentList.children[id].close();delete this.commentList.children[id]}};this.updateCommentList=function(){core.ajax.sendRequest("ajax.ShowComments",this.onCommentsReceaved,{"pageId":common.util.MemorialUtils.getPageId(),"elementId":this.getElementId(),"commentId":this.commentId||"","order":this.order})};this.doModal=override(this.doModal,function(){this.clearCommentList();this.updateCommentList();arguments.callee.prototype.apply(this,[])});this.endModal=override(this.endModal,function(){ObjectComments.getInstance().update(this.owner);arguments.callee.prototype.apply(this,[])});this.onCommentChanged=callback(this,function(){this.scrollWindow.reset()});this.onCommentDeleted=callback(this,function(){this.updateCommentList()});this.onSortTypeChanged=callback(this,function(sender,order){this.order=order;this.updateCommentList()})}}ClassFactory.createPackage("editor.plugins.comments");ClassFactory.createClass(editor.plugins.comments,"ObjectComments");with(editor.plugins.comments){editor.plugins.comments.ObjectComments.constructor=function(){this.data={};this.addCommentDialog=null;this.editCommentDialog=null;this.viewCommentsDialog=null;this.ObjectComments=function(){this.addCommentDialog=new AddCommentDialog();this.editCommentDialog=new EditCommentDialog();this.viewCommentsDialog=new ViewCommentsDialog();editor.Application.getInstance().addAppListener(this)};this.attach=function(A){if(!this.isAttached(A)){this.data[this.getElementId(A)]={"element":A,"controls":this.createControls(A)}}};this.detach=function(A){if(this.isAttached(A)){var B=this.getElementId(A);this.data[B].controls.close();delete this.data[B]}};this.update=function(A){if(A&&this.isAttached(A)){this.data[this.getElementId(A)].controls.updateInfo()}};this.reset=function(){for(var A in this.data){this.detach(this.data[A].element)}this.data={}};this.getElementId=function(B){var A=B.getElement();if(A.getAttribute("objId")){return A.getAttribute("objId")}else{if(A.getAttribute("comments")&&(A.getAttribute("comments")!=="true")){return A.getAttribute("comments")}else{return B.getId()}}};this.isAttached=function(A){return defined(this.data[this.getElementId(A)])};this.createControls=function(A){return new CommentsControls(A)};this.getAddCommentDialog=function(){return this.addCommentDialog};this.getEditCommentDialog=function(){return this.editCommentDialog};this.getViewCommentsDialog=function(){return this.viewCommentsDialog};this.onAppClear=function(){this.reset()}};editor.plugins.comments.ObjectComments.getInstance=function(){if(!defined(this.instance)){this.instance=new ObjectComments()}return this.instance}}ClassFactory.createPackage("common");ClassFactory.createClass(common,"Page");with(common){common.Page.constructor=function(){this.config=new core.app.Config();this.commentId=null;this.elements=[];this.name="";this.mail="";this.init=function(B,A){this.config.set("page.id",B);this.config.set("page.baseUri",A);this.initContent(document.getElementById("content"));core.ui.Window.notifyResize.addListener(this.onUpdateLayout);this.updatePageLayout()};this.showReportDialog=function(){var A=new ReportAbuseDialog();A.notifyAbuseSent.addListener(this.onAbuseSent);A.setData(this.name,this.mail,"");A.center();A.mail.setText(this.mail);A.doModal()};this.getReportDialog=function(){if(!defined(this.reportDialog)){this.reportDialog=new ReportAbuseDialog()}return this.reportDialog};this.initContent=function(H){core.ui.Event.addListener(H,"mousedown",this.onClicked);var B=editor.plugins.comments.ObjectComments.getInstance();for(var E=0;E<H.childNodes.length;E++){var C=H.childNodes.item(E);if((1==C.nodeType)&&defined(C.className)&&C.getAttribute("package")){try{var A=C.getAttribute("package");var I=A+"."+C.className;var F=ClassFactory.getClassByName(I);var D=new F(C);D.addElementListener(this);if(D.getElement().getAttribute("comments")){B.attach(D)}this.elements.push(D)}catch(G){console.warn(G.message)}}}};this.onClicked=callback(this,function(A){A=core.ui.Event.improve(A);if(A.target==document.getElementById("content")){A.cancel();return false}else{return true}});this.updatePageLayout=function(){var C=0,F=0;for(var B=0;B<this.elements.length;B++){var A=this.elements[B];C=Math.max(C,A.getX()+A.getWidth());F=Math.max(F,A.getY()+A.getHeight())}var G=document.getElementById("footer");G.style.visibility="hidden";G.style.display="block";var E=document.getElementById("page");if(C>document.body.offsetWidth){E.style.width=C+20+"px"}else{E.style.width="100%"}var D=document.getElementById("content");if(F+G.offsetHeight>document.body.offsetHeight){D.style.height=F+20+"px"}else{D.style.height="100%"}G.style.visibility="visible"};this.onElementChanged=function(){this.updatePageLayout()};this.onUpdateLayout=callback(this,function(){this.updatePageLayout()});this.onAbuseSent=callback(this,function(C,B,A){this.name=B;this.mail=A})};common.Page.getInstance=function(){if(!defined(this.instance)){this.instance=new Page()}return this.instance}}ClassFactory.createPackage("editor.ui");ClassFactory.createClass(editor.ui,"ToolButton");with(editor.ui){editor.ui.ToolButton.superClass=editor.ui.MenuButton;editor.ui.ToolButton.constructor=function(){this.dragSource;this.listener=null;this.ToolButton=function(A){arguments.callee.prototype.apply(this,[theApp.factory.getToolboxPanel().getContentWindow()]);this.setImageList("images/Toolbox/item.gif");this.icon.onload=this.onIconLoaded;this.dragSource=new core.ui.DragWindow();this.dragSource.notifyDrag.addListener(this.onDrag);this.dragSource.notifyEndDrag.addListener(this.onEndDrag);this.listener=A};this.onIconLoaded=callback(this,function(){this.dragSource.resize(this.icon.getWidth(),this.icon.getHeight());this.dragSource.setStyle("background",'url("'+this.icon.getSource()+'") no-repeat center center')});this.onDrag=callback(this,function(A){if(A.isDragging()){if(!A.isVisible()){A.move(this.getAbsX()+this.getWidth()/2-this.dragSource.getWidth()/2,this.getAbsY()+this.getHeight()/2-this.dragSource.getHeight()/2);A.activate();A.show()}}});this.onEndDrag=callback(this,function(B){var A=B.getX();var D=B.getY();var C=theApp.factory.getToolboxPanel();if((A>C.getX())&&(A<C.getX()+C.getWidth())&&(D>C.getY())&&(D<C.getY()+C.getHeight())){this.firePressed()}else{this.fireDropped(A+B.getWidth()/2,D+B.getHeight()/2)}B.hide()});this.firePressed=function(){if("function"==typeof this.listener.onToolButtonPressed){this.listener.onToolButtonPressed(this)}};this.fireDropped=function(A,B){if("function"==typeof this.listener.onToolButtonDropped){this.listener.onToolButtonDropped(this,A,B)}};this.onmousedown=override(this.onmousedown,function(A){this.dragSource.move(this.getAbsX()+this.getWidth()/2-this.dragSource.getWidth()/2,this.getAbsY()+this.getHeight()/2-this.dragSource.getHeight()/2);this.dragSource.beginDrag(A);return arguments.callee.prototype.apply(this,[A])})}}ClassFactory.createPackage("editor.commands");ClassFactory.createClass(editor.commands,"AddCommand");with(editor.commands){editor.commands.AddCommand.superClass=editor.commands.AbstractCommand;editor.commands.AddCommand.constructor=function(){this.firstRun=true;this.AddCommand=function(D,A,C,B){arguments.callee.prototype.apply(this,[D,B]);this.x=A;this.y=C;this.position=D.getPosition()};this.execute=function(){var A=editor.Application.getInstance().getCollection();if(this.firstRun){this.firstRun=false}else{document.body.appendChild(this.target.getElement())}A.add(this.target,this.x,this.y,true);if(!defined(this.x)){this.x=this.target.getAbsX()}if(!defined(this.y)){this.y=this.target.getAbsY()}if(!defined(this.position)){this.position=this.target.getPosition()}this.target.move(this.x,this.y);this.target.show()};this.unexecute=function(){var A=editor.Application.getInstance().getCollection();editor.ui.SelectionManager.get().removeSelection(this.target);A.excludeElement(this.target);this.target.hide()}}}ClassFactory.createPackage("editor.elements");ClassFactory.createClass(editor.elements,"PageElement");with(editor.elements){editor.elements.PageElement.superClass=editor.elements.AbstractElement;editor.elements.PageElement.constructor=function(){this.setBackgroundImage=function(A){this.setStyle("background-image",(A&&"none"!==A)?'url("'+A+'")':"none")};this.getBackgroundImage=function(){var A=this.getStyle("background-image");if(A&&A.match(/url\((.*)?\)/)){return RegExp.$1}else{return A}};this.setBackgroundColor=function(A){try{this.setStyle("background-color",A);return true}catch(B){return false}};this.getBackgroundColor=function(){return this.getStyle("background-color")};this.setBackgroundPosition=function(B,A){this.setStyle("background-position-x",B);this.setStyle("background-position-y",A);this.setStyle("background-position",B+" "+A)};this.getBackgroundPositionX=function(){var B;var A=this.getStyle("background-position");if(A&&A.match(/^(\S*)\s(\S*)$/)){B=RegExp.$1}else{B=this.getStyle("background-position-x")}if("0%"==B){B="left"}if("50%"==B){B="center"}if("100%"==B){B="right"}return B};this.getBackgroundPositionY=function(){var B;var A=this.getStyle("background-position");if(A&&A.match(/^(\S*)\s(\S*)$/)){B=RegExp.$2}else{B=this.getStyle("background-position-y")}if("0%"==B){B="top"}if("50%"==B){B="center"}if("100%"==B){B="bottom"}return B};this.setBackgroundRepeat=function(A){this.setStyle("background-repeat",(A)?A:"no-repeat")};this.getBackgroundRepeat=function(){return this.getStyle("background-repeat")};this.setBorderWidth=function(A){this.setStyle("border-width",A)};this.getBorderWidth=function(){return this.getStyle("border-width")};this.setBorderStyle=function(B){this.setStyle("border-style",B);var A=editor.ui.SelectionManager.get();if(A.isSelected(this)){A.getSelection(this).updateLayout()}};this.getBorderStyle=function(){return this.getStyle("border-style")};this.setBorderColor=function(A){this.setStyle("border-color",A)};this.getBorderColor=function(){return this.getStyle("border-color")};this.create=override(this.create,function(){arguments.callee.prototype.apply(this,[]);this.setBackgroundPosition("center","center");this.setBackgroundRepeat("no-repeat")});this.getHtmlTag=override(this.getHtmlTag,function(){var A=arguments.callee.prototype.apply(this,[]);var B=A.getAttribute("style");if(this.getBorderWidth()){B.setProperty("border-width",this.getBorderWidth())}if(this.getBorderStyle()){B.setProperty("border-style",this.getBorderStyle())}if(this.getBorderColor()){B.setProperty("border-color",this.getBorderColor())}if(this.getBackgroundColor()){B.setProperty("background-color",this.getBackgroundColor())}if(this.getBackgroundRepeat()){B.setProperty("background-repeat",this.getBackgroundRepeat())}if(this.getBackgroundPositionX()){B.setProperty("background-position-x",this.getBackgroundPositionX())}if(this.getBackgroundPositionY()){B.setProperty("background-position-y",this.getBackgroundPositionY())}if(this.getBackgroundImage()&&("none"!==this.getBackgroundImage())){B.setProperty("background-image","url("+this.getBackgroundImage()+")")}return A})}}ClassFactory.createPackage("editor.plugins.condolence");ClassFactory.createClass(editor.plugins.condolence,"Message");with(editor.plugins.condolence){editor.plugins.condolence.Message.superClass=core.ui.Window;editor.plugins.condolence.Message.constructor=function(){this.id;this.name;this.mail;this.text;this.time;this.index;this.nameStatic;this.mailStatic;this.timeStatic;this.textStatic;this.deleteButton;this.notifyDeleted=new core.ui.Notification();this.Message=function(parent,x,y,width,height){this.Window(parent,x,y,width,height);this.initHeader(this);this.initBody(this)};this.initHeader=function(parent){var header=new core.ui.Window(parent);header.addStyleName("MessageHeader");this.nameStatic=new core.ui.Static(header);this.nameStatic.addStyleName("NameStatic");this.mailStatic=new core.ui.Static(header);this.mailStatic.addStyleName("MailStatic");this.timeStatic=new core.ui.Static(header);this.timeStatic.addStyleName("TimeStatic");this.deleteButton=new core.ui.ImageButton(header);this.deleteButton.setStyle("position","absolute");this.deleteButton.addStyleName("DeleteMessage");this.deleteButton.setImageList("images/CondolenceBook/delete_button.gif");this.deleteButton.setToolTip("Delete this message");this.deleteButton.oncommand=this.onDeleteClick};this.initBody=function(parent){var body=new core.ui.Window(parent);body.addStyleName("MessageBody");this.textStatic=new core.ui.Static(body);this.textStatic.addStyleName("MessageStatic")};this.setEditable=function(editable){if(editable){this.deleteButton.show();this.mailStatic.setStyle("display","block")}else{this.deleteButton.hide();this.mailStatic.setStyle("display","none")}};this.setData=function(id,name,mail,text,time,page){this.id=id;this.name=name;this.mail=mail;this.text=text;this.time=time;this.page=page;this.updateLayout()};this.setText=function(text){this.text=text;this.updateLayout()};this.setName=function(name){this.name=name;this.updateLayout()};this.setId=function(id){this.id=id;this.updateLayout()};this.setTime=function(time){this.time=time;this.updateLayout()};this.setIndex=function(i){this.index=i};this.getIndex=function(){return this.index};this.getDeleteButton=function(){return this.deleteButton};this.updateLayout=function(){with(common.util){this.nameStatic.setText(MemorialUtils.htmlEncode(this.name));this.mailStatic.setText(MemorialUtils.htmlEncode(this.mail?("<"+this.mail+">"):""));this.timeStatic.setText(MemorialUtils.htmlEncode(DateUtils.toClientDate(this.time*1000,true)));this.textStatic.setText(this.text?MemorialUtils.htmlEncode(this.text).replace(/\n/g,"<br/>"):"")}};this.onDeleteClick=callback(this,function(){if(confirm("Do you want to delete this message?")){core.ajax.sendRequest("ajax.DeleteMessage",this.onServerResponse,{"id":this.id})}});this.onServerResponse=callback(this,function(response){if("OK"==response.status){this.notifyDeleted.send(this)}})}}ClassFactory.createPackage("editor.plugins.condolence");ClassFactory.createClass(editor.plugins.condolence,"MessageList");with(editor.plugins.condolence){editor.plugins.condolence.MessageList.superClass=core.ui.Window;editor.plugins.condolence.MessageList.constructor=function(){this.messagesPerPage=10;this.count=0;this.editable=true;this.notifyMessageAdded=new core.ui.Notification();this.notifyMessageDeleted=new core.ui.Notification();this.messages=[];this.queryMessages=function(A){core.ajax.sendRequest("ajax.ListMessages",this.onServerResponse,{"pageId":common.util.MemorialUtils.getPageId(),"number":A,"count":this.messagesPerPage})};this.setMessagesPerPage=function(A){this.messagesPerPage=A};this.getMinPage=function(){return 1};this.getMaxPage=function(){return Math.ceil(this.count/this.messagesPerPage)};this.addMessage=function(H,D,C,G,F,E,B){var A=new Message(this);A.setEditable(this.editable);A.setData(H,D,C,G,F,E,B);A.setIndex(this.messages.length);A.notifyDeleted.addListener(this.onMessageDeleted);this.messages.push(A);this.notifyMessageAdded.send(this)};this.getMessage=function(A){return this.messages[A]};this.getMessageCount=function(){return this.messages.length};this.hasMessages=function(){return(this.messages.length>0)};this.setEditable=function(A){if(this.editable==A){return }this.editable=A;for(var B in this.children){if(this.children[B].getElement()){this.children[B].setEditable(A)}}};this.onServerResponse=callback(this,function(C){if(C.status=="OK"){this.count=C.count;for(var D in this.children){this.children[D].close();delete this.children[D]}for(var B=0;B<C.messages.length;B++){var A=C.messages[B];this.addMessage(A.id,A.name,A.mail,A.text,A.time,A.page,A.pageId)}}this.notifyMessageAdded.send(this)});this.onMessageDeleted=callback(this,function(A){this.count--;A.notifyDeleted.removeListener(this.onMessageDeleted);A.close();this.messages.splice(A.getIndex(),1);this.notifyMessageDeleted.send(this)})}}ClassFactory.createPackage("editor.plugins.condolence");ClassFactory.createClass(editor.plugins.condolence,"AddMessageDialog");with(editor.plugins.condolence){editor.plugins.condolence.AddMessageDialog.superClass=editor.ui.MessageDialog;editor.plugins.condolence.AddMessageDialog.constructor=function(){this.notifyMessageAdded=new core.ui.Notification();this.submitClicked=override(this.submitClicked,function(){core.ajax.sendRequest("ajax.PostMessage",this.onServerResponse,{"name":this.name.getText(),"mail":this.mail.getText(),"text":this.text.getText(),"id":common.util.MemorialUtils.getPageId()})});this.onServerResponse=callback(this,function(A){if(A.status=="OK"){alert("Your message was added.");this.notifyMessageAdded.send();this.endModal()}})}}ClassFactory.createPackage("editor.commands");ClassFactory.createClass(editor.commands,"RemoveCommand");with(editor.commands){editor.commands.RemoveCommand.superClass=editor.commands.AbstractCommand;editor.commands.RemoveCommand.constructor=function(){this.execute=function(){this.x=this.target.getAbsX();this.y=this.target.getAbsY();this.position=this.target.getPosition();editor.ui.SelectionManager.get().removeSelection(this.target);editor.Application.getInstance().getCollection().excludeElement(this.target);this.target.hide()};this.unexecute=function(){var A=editor.Application.getInstance().getCollection();document.body.appendChild(this.target.getElement());A.insert(this.target,this.x,this.y,this.position);this.target.show();this.target.move(this.x,this.y);if(defined(editor.plugins.tribute)&&((this.target&&(this.target.constructor===editor.plugins.tribute.TributeVideoBox||defined(this.target.constructor.isSubclassOf)&&this.target.constructor.isSubclassOf(editor.plugins.tribute.TributeVideoBox))))){this.target.load(this.target.getElement())}}}}ClassFactory.createPackage("editor.ui");ClassFactory.createClass(editor.ui,"SelectionMenuBuilder");with(editor.ui){editor.ui.SelectionMenuBuilder.constructor=function(){this.SelectionMenuBuilder=function(target){this.target=target;this.menu=new SelectionMenu(this)};this.getMenu=function(){return this.menu};this.buildEditIcon=function(){return this.buildIcon(this.onEditCommand,"EditButton","Edit this "+this.target.getName().toLowerCase(),["images/SelectionMenu/edit-normal.png","images/SelectionMenu/edit-hover.png","images/SelectionMenu/edit-pressed.png"])};this.buildDeleteIcon=function(){return this.buildIcon(this.onDeleteCommand,"DeleteButton","Delete this "+this.target.getName().toLowerCase(),["images/SelectionMenu/delete-normal.png","images/SelectionMenu/delete-hover.png","images/SelectionMenu/delete-pressed.png"])};this.buildIcon=function(commandHandler,styleName,toolTip,images){var button=new core.ui.ImageButton(this.menu);button.addStyleName(styleName);button.setToolTip(toolTip);button.setImages.apply(button,images);button.oncommand=commandHandler;return button};this.onEditCommand=callback(this,function(){this.target.edit()});this.onDeleteCommand=callback(this,function(){with(editor.commands){CommandHistory.get().execute(new RemoveCommand(this.target,"Remove "+this.target.getName().toLowerCase()))}})}}ClassFactory.createPackage("editor.plugins.condolence");ClassFactory.createClass(editor.plugins.condolence,"CondolenceBookSelection");with(editor.plugins.condolence){editor.plugins.condolence.CondolenceBookSelection.superClass=editor.ui.DefaultSelection;editor.plugins.condolence.CondolenceBookSelection.constructor=function(){this.CondolenceBookSelection=function(B){arguments.callee.prototype.apply(this,[B]);this.setStyle("z-index",2);var A=new editor.ui.SelectionMenuBuilder(B);A.buildDeleteIcon();this.setMenu(A.getMenu())};this.getMinimumWidth=function(){return 280};this.onEndResize=callback(this,override(this.onEndResize,function(A){var B=this.getTarget();B.updateLayout();B.getElement().style.height=null;this.updateLayout();arguments.callee.prototype.apply(this,[])}))}}ClassFactory.createPackage("editor.plugins.condolence");ClassFactory.createClass(editor.plugins.condolence,"CondolenceBook");with(editor.plugins.condolence){editor.plugins.condolence.CondolenceBook.superClass=editor.elements.PageElement;editor.plugins.condolence.CondolenceBook.constructor=function(){this.page=1;this.messageList=null;this.addButton;this.addDialog;this.pageStatic;this.prevButton;this.nextButton;this.enabled=true;this.CondolenceBook=function(root){arguments.callee.prototype.apply(this,[root,"Condolence book"]);this.setStyle("z-index",3)};this.getHtmlTag=override(this.getHtmlTag,function(){var tag=arguments.callee.prototype.apply(this,[]);tag.setContent("");return tag});this.create=override(this.create,function(){arguments.callee.prototype.apply(this,[]);if(this.isInEditMode()&&this.isNew()){this.setStyle("width","500px")}this.initHeader();this.initBody();this.updateControls();this.updateLayout()});this.load=override(this.load,function(node){arguments.callee.prototype.apply(this,[]);this.create();this.messageList.setEditable(this.isInEditMode());if(!defined(window.theApp)){this.activate=function(){}}});this.initBody=function(){var bodyPanel=new core.ui.Window(this);bodyPanel.addStyleName("BookBody");this.initCommandPanel(bodyPanel);this.initMessageList(bodyPanel);this.initMessageDialog()};this.initHeader=function(){var header=new core.ui.Window(this);header.addStyleName("BookHeader");var left=new core.ui.Window(header);left.addStyleName("HeaderLeftCorner");var right=new core.ui.Window(header);right.addStyleName("HeaderRightCorner");this.rssButton=new core.ui.ImageButton(header);this.rssButton.addStyleName("RssButton");this.rssButton.setImageList("images/CondolenceBook/rss.gif");this.rssButton.setToolTip("Subscribe to RSS");this.rssButton.oncommand=this.onRssClick;this.refreshButton=new core.ui.ImageButton(header);this.refreshButton.addStyleName("RefreshButton");this.refreshButton.setImageList("images/CondolenceBook/refresh_button.gif");this.refreshButton.setToolTip("Refresh list");this.refreshButton.oncommand=this.onRefreshClick};this.initPager=function(parent){this.pager=new core.ui.Window(parent);this.pager.addStyleName("BookPager");this.prevButton=new core.ui.ImageButton(this.pager);this.prevButton.addStyleName("PrevPage");this.prevButton.setText("&lt;");this.prevButton.setToolTip("Previous page");this.prevButton.oncommand=this.onPreviousPageClick;this.pageStatic=new core.ui.Static(this.pager);this.pageStatic.addStyleName("CurrentPage");this.nextButton=new core.ui.ImageButton(this.pager);this.nextButton.addStyleName("NextPage");this.nextButton.setText("&gt;");this.nextButton.setToolTip("Next page");this.nextButton.oncommand=this.onNextPageClick};this.initCommandPanel=function(parent){var commandPanel=new core.ui.Window(parent);commandPanel.addStyleName("CommandPanel");this.addButton=new core.ui.ImageButton(commandPanel);this.addButton.addStyleName("AddMessage");this.addButton.setImageList("images/CondolenceBook/add_button.gif");this.addButton.setToolTip("Add condolence");this.addButton.oncommand=this.onAddMessageClick;this.initPager(commandPanel)};this.initMessageList=function(parent){this.messageList=new MessageList(parent);this.messageList.setStyle("width","100%");this.messageList.notifyMessageAdded.addListener(this.onMessageListFilled);this.messageList.notifyMessageDeleted.addListener(this.onMessageListCroped);this.messageList.setMessagesPerPage(5)};this.initMessageDialog=function(){this.addDialog=new AddMessageDialog();this.addDialog.notifyMessageAdded.addListener(this.onMessageAdded);this.addDialog.center()};this.close=override(this.close,function(){this.addDialog.notifyMessageAdded.removeListener(this.onMessageAdded);arguments.callee.prototype.apply(this,[])});this.activate=override(this.activate,function(){arguments.callee.prototype.apply(this,[]);theApp.switchPanel(null)});this.onModeSwitched=callback(this,function(mode){this.mode=mode});this.resize=override(this.resize,function(width,height){arguments.callee.prototype.apply(this,[width,height]);this.updateLayout()});this.setEnabled=override(this.setEnabled,function(e){this.enabled=e;this.addButton.enable();this.rssButton.enable();this.refreshButton.enable();this.pager.enable();this.messageList.setEditable(e)});this.updateLayout=function(){if(this.messageList.getMaxPage()<=1){this.pager.hide()}else{this.pager.show();this.pageStatic.setText(this.page)}if(this.messageList.getMaxPage()>this.page){this.nextButton.enable()}else{this.nextButton.disable()}if(this.page>1){this.prevButton.enable()}else{this.prevButton.disable()}if(this.isInEditMode()){var selections=editor.ui.SelectionManager.get();if(selections.isSelected(this)){selections.getSelection(this).updateLayout()}}};this.updateControls=function(){this.messageList.queryMessages(this.page)};this.isOverlappable=function(){return false};this.createSelection=function(){return new CondolenceBookSelection(this)};this.onMessageListFilled=callback(this,function(sender){this.setStyle("height","");this.updateLayout();this.fireChanged()});this.onMessageListCroped=callback(this,function(sender){if(this.page>1&&this.page>this.messageList.getMaxPage()){--this.page}this.updateControls();this.fireChanged()});this.onAddMessageClick=callback(this,function(){this.addDialog.reset();var selections=editor.ui.SelectionManager.get();this.hasSelected=selections.isSelected(this);selections.removeSelection(this);this.addDialog.center();this.addDialog.doModal()});this.onMessageAdded=callback(this,function(){this.updateControls()});this.onPreviousPageClick=callback(this,function(){if(this.page<=this.messageList.getMinPage()){return }this.page--;this.updateControls()});this.onNextPageClick=callback(this,function(){if(this.page>=this.messageList.getMaxPage()){return }this.page++;this.updateControls()});this.onRssClick=callback(this,function(){with(common.util){window.open(MemorialUtils.getBaseUri()+"/rss.Condolences?id="+MemorialUtils.getPageId())}});this.onRefreshClick=callback(this,function(){this.updateControls()});this.onmousedown=callback(this,override(this.onmousedown,function(e){if(this.enabled){return arguments.callee.prototype.apply(this,[e])}}))}}ClassFactory.createPackage("editor.plugins.condolence");ClassFactory.createClass(editor.plugins.condolence,"CondolencePlugin");with(editor.plugins.condolence){editor.plugins.condolence.CondolencePlugin.constructor=function(){this.CondolencePlugin=function(){editor.Application.getInstance().addAppListener(this)};this.onAppInitComplete=function(){var button=new editor.ui.ToolButton(this);button.addStyleName("CondolenceBookIcon");button.setText("Condolences");button.setIcon("images/CondolenceBook/icon.png");button.setToolTip("Create new condolence book")};this.onToolButtonPressed=this.onToolButtonDropped=function(button,x,y){var cb=new CondolenceBook();with(editor.commands){CommandHistory.get().execute(new AddCommand(cb,x,y,"Add condolence book"))}cb.select();cb.activate();cb.edit()}}}ClassFactory.createPackage("editor.ui");ClassFactory.createClass(editor.ui,"ProportionalSelection");with(editor.ui){editor.ui.ProportionalSelection.superClass=editor.ui.DefaultSelection;editor.ui.ProportionalSelection.constructor=function(){this.ProportionalSelection=function(B){arguments.callee.prototype.apply(this,[B]);for(var A=new core.util.Iterator(["e","n","s","w"]);A.hasNext();A.next()){this.grippers[A.current()].hide()}};this.move=override(this.move,function(A,D){if(!defined(this.ratio)){this.ratio=this.getWidth()/this.getHeight()}var B=this.getY()-D;var C=Math.round(B*this.ratio);if(this.grippers["nw"].isResizing()){this.newWidth=this.getWidth()+C;this.newHeight=this.getHeight()+B;arguments.callee.prototype.apply(this,[this.getX()-C,this.getY()-B])}else{if(this.grippers["sw"].isResizing()){C=this.getX()-A;this.newWidth=this.getWidth()+C;arguments.callee.prototype.apply(this,[this.getX()-C,this.getY()])}else{if(this.grippers["ne"].isResizing()){B=this.getY()-D;this.newHeight=this.getHeight()+B;arguments.callee.prototype.apply(this,[this.getX(),this.getY()-B])}else{arguments.callee.prototype.apply(this,[A,D])}}}});this.resize=function(A,B){if(!defined(this.ratio)){this.ratio=this.width/this.height}if(this.grippers["nw"].isResizing()){if(defined(this.newWidth)){A=this.newWidth}if(defined(this.newHeight)){B=this.newHeight}}else{if(this.grippers["sw"].isResizing()){if(defined(this.newWidth)){A=this.newWidth}B=A/this.ratio}else{if(this.grippers["ne"].isResizing()){if(defined(this.newHeight)){B=this.newHeight}A=B*this.ratio}else{if(this.grippers["se"].isResizing()){A=B*this.ratio}else{this.ratio=A/B}}}}this.newWidth=undefined;this.newHeight=undefined;A=Math.max(this.getMinimumWidth(),A);B=Math.max(this.getMinimumHeight(),B);this.setStyle("width",A+"px");this.setStyle("height",B+"px");this.getTarget().resize(A-this.gripperSize.width*2,B-this.gripperSize.height*2);this.updateLayout()};this.updateLayout=override(this.updateLayout,function(){arguments.callee.prototype.apply(this,[]);this.ratio=this.getWidth()/this.getHeight()})}}ClassFactory.createPackage("editor.plugins.images");ClassFactory.createClass(editor.plugins.images,"ResizeImageBoxCommand");with(editor.plugins.images){editor.plugins.images.ResizeImageBoxCommand.superClass=editor.commands.ResizeCommand;editor.plugins.images.ResizeImageBoxCommand.constructor=function(){this.ResizeImageBoxCommand=function(A){arguments.callee.prototype.apply(this,[A,"Resize picture"])};this.execute=override(this.execute,function(){arguments.callee.prototype.apply(this,[]);this.target.updateImage()});this.unexecute=override(this.unexecute,function(){arguments.callee.prototype.apply(this,[]);this.target.updateImage()})}}ClassFactory.createPackage("editor.plugins.images");ClassFactory.createClass(editor.plugins.images,"ImageBoxSelection");with(editor.plugins.images){editor.plugins.images.ImageBoxSelection.superClass=editor.ui.ProportionalSelection;editor.plugins.images.ImageBoxSelection.constructor=function(){this.ImageBoxSelection=function(B){arguments.callee.prototype.apply(this,[B]);var A=new editor.ui.SelectionMenuBuilder(B);A.buildDeleteIcon();A.buildEditIcon();this.setMenu(A.getMenu())};this.onBeginResize=callback(this,override(this.onBeginResize,function(A){this.resizeCommand=new ResizeImageBoxCommand(this.target)}));this.onEndResize=callback(this,override(this.onEndResize,function(A){arguments.callee.prototype.apply(this,[]);this.target.updateImage()}))}}ClassFactory.createPackage("editor.plugins.images");ClassFactory.createClass(editor.plugins.images,"ImageBox");with(editor.plugins.images){editor.plugins.images.ImageBox.superClass=editor.elements.PageElement;editor.plugins.images.ImageBox.constructor=function(){this.source;this.origin="";this.zoom=100;this.rotation=0;this.url="";this.anchor;this.image;this.ImageBox=function(A){this.preloader=new core.util.ImagePreloader();this.preloader.addListener(this);this.rotator=new core.util.ImagePreloader();this.rotator.addListener(this);this.updater=new core.util.ImagePreloader();this.updater.addListener(this);arguments.callee.prototype.apply(this,[A,"Picture"])};this.setImage=function(A){this.origin=A;this.reset();this.updateControls()};this.getImage=function(){return this.origin};this.isPhoto=function(){var A=this.getElement().getAttribute("id");return(A&&A.match("person.photo"))};this.setZoom=function(B){var A=B/this.zoom;this.resize(this.getWidth()*A,this.getHeight()*A);this.zoom=B};this.getZoom=function(){return this.zoom};this.setTransparency=function(A){this.setStyle("opacity",100-A)};this.getTransparency=function(){return 100-this.getStyle("opacity")};this.setLink=function(A){this.url=A;this.updateControls()};this.getLink=function(){return this.url};this.reset=function(){this.setTransparency(0);this.setZoom(100);this.rotate(0)};this.rotate=function(C){if(C==this.rotation){return }var A=(this.rotation==0||this.rotation==180)?this.getWidth():this.getHeight();var B=(this.rotation==0||this.rotation==180)?this.getHeight():this.getWidth();this.rotation=C;this.rotateImage(this.origin,this.rotation);if(this.rotation==0||this.rotation==180){this.resize(A,B)}else{if(this.rotation==90||this.rotation==270){this.resize(B,A)}}};this.getRotationDegree=function(){return this.rotation};this.setText=function(A){this.image.alt=A};this.getText=function(){return this.image.alt};this.createSelection=function(){return new ImageBoxSelection(this)};this.edit=function(){theApp.plugins.images.getPanel().getContentWindow().loadImage()};this.updateControls=function(){if(0==this.rotation){this.preloadImage(this.origin)}else{this.rotateImage(this.origin,this.rotation)}if(this.url){this.anchor.setAttribute("href",this.url);this.anchor.style.cursor=""}else{this.anchor.removeAttribute("href");this.anchor.style.cursor="default"}};this.createAnchor=function(){var A=document.createElement("a");A.target="_blank";A.style.cursor="default";return A};this.createImage=function(){var A=document.createElement("img");A.style.borderWidth="0px";A.style.display="block";A.style.width="100%";A.style.height="100%";A.ondragstart=new Function("return false");return A};this.activate=override(this.activate,function(){arguments.callee.prototype.apply(this,[]);theApp.plugins.images.getPanel().getContentWindow().setImageBox(this);theApp.switchPanel(theApp.plugins.images.getPanel())});this.createElement=override(this.createElement,function(){var A=arguments.callee.prototype.apply(this,[]);this.anchor=this.createAnchor();A.appendChild(this.anchor);this.image=this.createImage();this.anchor.appendChild(this.image);return A});this.create=override(this.create,function(){arguments.callee.prototype.apply(this,[]);this.origin="images/ImageBox/placeholder.png";this.reset();this.updateControls()});this.load=function(A){if(this.isInEditMode()){var B=A.nodeName.toLowerCase();if("img"==B){this.loadFromImg(A)}else{if("a"==B){this.loadFromAnchor(A)}else{if("div"==B){this.loadFromDiv(A)}}}}};this.loadFromImg=function(A){var C=core.url.parse(A.src);this.origin=C.path.substr(1);this.rotation=0;A.style.boxSizing=A.style.MozBoxSizing="content-box";this.element=this.createElement();this.element.style.overflow="hidden";this.element.style.position="absolute";this.element.style.left=A.offsetLeft+"px";this.element.style.top=A.offsetTop+"px";this.element.style.width=A.offsetWidth+"px";this.element.style.height=A.offsetHeight+"px";this.element.style.borderWidth=A.style.borderWidth;this.element.style.borderStyle=A.style.borderStyle;this.element.style.borderColor=A.style.borderColor;this.element.style.zIndex=2;this.element.className="ImageBox";this.element.id=A.id;this.detach(A);this.attach(this.element);var B=A.parentNode;B.insertBefore(this.element,A);B.removeChild(A);this.updateControls()};this.loadFromAnchor=function(A){this.url=A.href;var D=A.getElementsByTagName("img");if(D.length>0){var C=D.item(0);A.removeChild(C);var B=A.parentNode;B.insertBefore(C,A);B.removeChild(A);this.loadFromImg(C)}};this.loadFromDiv=function(C){this.origin=C.getAttribute("origin")||"";this.rotation=C.getAttribute("rotation")||0;var A=C.getElementsByTagName("a");if(A.length>0){this.url=A.item(0).href;this.anchor=A.item(0)}else{this.anchor=this.createAnchor();C.appendChild(this.anchor)}var B=C.getElementsByTagName("img");if(B.length>0){this.image=B.item(0);this.image.ondragstart=new Function("return false")}else{this.image=this.createImage();this.anchor.appendChild(this.image)}this.updateControls()};this.getHtmlTag=override(this.getHtmlTag,function(){var A=arguments.callee.prototype.apply(this,[]);A.setAttribute("origin",this.origin);A.getAttribute("style").setOpacity(this.getStyle("opacity"));var C=this.getElement().getAttribute("id");if(C){A.setAttribute("id",C)}if(100!==this.zoom){A.setAttribute("zoom",this.zoom)}if(0!==this.rotation){A.setAttribute("rotation",this.rotation)}var B=new core.html.Tag("a",{"target":"_blank"});if(this.url){B.setAttribute("href",this.url)}else{B.setAttribute("style",new core.html.Style({"cursor":"default"}))}B.setContent(new core.html.Tag("img",{"src":this.source,"style":"display: block; width: 100%; height: 100%; border: 0px;","alt":this.image.alt}));A.setContent(B);return A});this.adjustBounds=function(A,C,B,D){var E=A/C;var F=(0!=this.rotation)||(100!=this.zoom);if(E>1){if((B<A)||F){A=B;C=A/E}if((D<C)||F){C=D;A=C*E}}else{if((D<C)||F){C=D;A=C*E}if((B<A)||F){A=B;C=A/E}}this.resize(A+(this.getWidth()-this.getClientWidth()),C+(this.getHeight()-this.getClientHeight()));this.updateImage()};this.preloadImage=function(A){this.image.src="images/blank.gif";this.image.style.background="#ffffff url(images/loading.gif) no-repeat center center";this.preloader.preload(this.source=A)};this.rotateImage=function(A,B){this.image.src="images/blank.gif";this.image.style.background="#ffffff url(images/loading.gif) no-repeat center center";this.rotator.preload(this.source=A+"?angle="+Math.ceil(B))};this.updateImage=function(){var A="?"+(this.rotation?"angle="+this.rotation+"&":"")+("size="+this.getWidth()+"x"+this.getHeight())+"&increase=true";this.updater.preload(this.source=this.origin+A)};this.onImagePreloaded=function(B){this.image.style.background="transparent none";this.image.src=B.getUrl();if(this.preloader==B){this.adjustBounds(B.getWidth(),B.getHeight(),this.getClientWidth(),this.getClientHeight())}var A=editor.ui.SelectionManager.get();if(A.isSelected(this)){A.getSelection(this).updateLayout()}}}}ClassFactory.createPackage("editor.ui");ClassFactory.createClass(editor.ui,"BorderMenu");with(editor.ui){editor.ui.BorderMenu.superClass=editor.ui.PopupMenu;editor.ui.BorderMenu.constructor=function(){this.notifyColorSelected=new core.ui.Notification();this.notifyWidthSelected=new core.ui.Notification();this.notifyStyleSelected=new core.ui.Notification();this.BorderMenu=function(M,I,G,A,K){this.Menu(M,I,G,A,K);var F=this.createSubMenu("Border color",ColorMenu);F.transpColor.setStyle("display","none");F.setText("Pick color from list");F.notifyColorApplied.addListener(this.onColorApplied);var B=this.createSubMenu("Border width");var E={"0pt":"0 pt","0.25pt":"0,25 pt","0.5pt":"0,5 pt","0.75pt":"0,75 pt","1pt":"1 pt","1.5pt":"1,5 pt","2.25pt":"2,25 pt","3pt":"3 pt","4.5pt":"4,5 pt","6pt":"6 pt","9pt":"9 pt"};for(var J in E){B.createItem(E[J],this.onSelectWidth,J)}var N=this.createSubMenu("Border style");var H=["None","Dotted","Dashed","Solid","Double","Groove","Ridge","Inset","Outset"];for(var D=0;D<H.length;D++){var L=N.createItem("",this.onSelectStyle,H[D]);L.setToolTip(H[D]);var C=new core.ui.Static(L);C.setStyle("border-bottom-style",H[D]);C.setStyle("width","100%");C.setStyle("height","55%")}};this.onSelectWidth=callback(this,function(A){this.notifyWidthSelected.send(this,A);this.endPopup()});this.onSelectStyle=callback(this,function(A){this.notifyStyleSelected.send(this,A);this.endPopup()});this.onColorApplied=callback(this,function(A,B){this.notifyColorSelected.send(this,B);this.endPopup()})}}ClassFactory.createPackage("editor.ui");ClassFactory.createClass(editor.ui,"Separator");with(editor.ui){editor.ui.Separator.superClass=core.ui.Static;editor.ui.Separator.constructor=function(){this.Separator=function(A){this.Static(A);this.setStyle("position","absolute")};this.apply=function(D,B){var A=D.getX()+D.getWidth();A+=(B.getX()-A)/2;var E=Math.max(D.getY(),B.getY());var C=Math.min(D.getHeight(),B.getHeight());this.move(A-this.getWidth()/2,E+1);this.resize(this.getWidth(),C-2)}}}ClassFactory.createPackage("editor.commands");ClassFactory.createClass(editor.commands,"EditBorderCommand");with(editor.commands){editor.commands.EditBorderCommand.superClass=editor.commands.AbstractCommand;editor.commands.EditBorderCommand.constructor=function(){this.initialState={};this.finalState={};this.EditBorderCommand=function(B,A){arguments.callee.prototype.apply(this,[B,A]);this.saveInitialState()};this.execute=function(){if(defined(this.finalState.width)){this.target.setBorderWidth(this.finalState.width)}if(defined(this.finalState.style)){this.target.setBorderStyle(this.finalState.style)}if(defined(this.finalState.color)){this.target.setBorderColor(this.finalState.color)}this.target.setModified(true)};this.unexecute=function(){this.target.setBorderWidth(this.initialState.width);this.target.setBorderStyle(this.initialState.style);this.target.setBorderColor(this.initialState.color);this.target.setModified(this.initialState.modified)};this.setBorder=function(C,B,A){this.finalState={width:C,style:B,color:A}};this.setBorderStyle=function(A){this.finalState.style=A};this.setBorderColor=function(A){this.finalState.color=A};this.setBorderWidth=function(A){this.finalState.width=A};this.saveInitialState=function(){this.initialState={width:this.target.getBorderWidth(),style:this.target.getBorderStyle(),color:this.target.getBorderColor(),modified:this.target.isModified()}}}}ClassFactory.createPackage("editor.plugins.images");ClassFactory.createClass(editor.plugins.images,"EditImageBoxCommand");with(editor.plugins.images){editor.plugins.images.EditImageBoxCommand.superClass=editor.commands.AbstractCommand;editor.plugins.images.EditImageBoxCommand.constructor=function(){this.initialState={};this.finalState={};this.EditImageBoxCommand=function(B,A){arguments.callee.prototype.apply(this,[B,A]);this.saveInitialState()};this.saveInitialState=function(){this.initialState={width:this.target.getWidth(),height:this.target.getHeight(),source:this.target.getImage(),zoom:this.target.getZoom(),transparency:this.target.getTransparency(),angle:this.target.getRotationDegree(),modified:this.target.isModified()}};this.execute=function(){if(defined(this.finalState.source)){this.target.setImage(this.finalState.source)}if(defined(this.finalState.zoom)){this.target.setZoom(this.finalState.zoom)}if(defined(this.finalState.transparency)){this.target.setTransparency(this.finalState.transparency)}if(defined(this.finalState.angle)){this.target.rotate(this.finalState.angle)}this.target.setModified(true);var A=editor.Application.getInstance();A.plugins.images.getPanel().getContentWindow().updateControls();this.target.updateImage()};this.unexecute=function(){if(defined(this.finalState.source)){this.target.setImage(this.initialState.source)}if(defined(this.finalState.zoom)){this.target.setZoom(this.initialState.zoom)}if(defined(this.finalState.transparency)){this.target.setTransparency(this.initialState.transparency)}if(defined(this.finalState.angle)){this.target.rotate(this.initialState.angle)}this.target.resize(this.initialState.width,this.initialState.height);this.target.setModified(this.initialState.modified);var A=editor.Application.getInstance();A.plugins.images.getPanel().getContentWindow().updateControls();this.target.updateImage()};this.setImage=function(A){this.finalState.source=A};this.setZoom=function(A){this.finalState.zoom=A};this.setTransparency=function(A){this.finalState.transparency=A};this.rotate=function(A){this.finalState.angle=A};this.reset=function(){this.setTransparency(0);this.setZoom(100);this.rotate(0)}}}ClassFactory.createPackage("editor.plugins.images");ClassFactory.createClass(editor.plugins.images,"ImageBoxPanel");with(editor.plugins.images){editor.plugins.images.ImageBoxPanel.superClass=core.ui.Window;editor.plugins.images.ImageBoxPanel.constructor=function(){this.imagebox;this.loadButton;this.resetButton;this.hyperlinkButton;this.aboveButton;this.underButton;this.frontButton;this.backButton;this.borderButton;this.zoomSlider;this.transpSlider;this.rotationList;this.controlGroupWindow;this.borderMenu;with(editor.ui){this.ImageBoxPanel=function(parent){this.Window(parent);this.deferredInit()};this.deferredInit=callback(this,function(){switch(this.initStep){case undefined:this.initStep=0;case 0:this.createProgress();break;case 1:this.loadButton=new MenuButton(this);this.loadButton.setStyleId("imagebox-panel-button-image");this.loadButton.setImageList("images/ImageBox/menu.gif");this.loadButton.setIcon("images/icon/image.gif");this.loadButton.setText("Change picture");this.loadButton.setToolTip("Change picture");this.loadButton.oncommand=this.onImageButtonClick;this.loadButton.hide();break;case 2:this.controlGroupWindow=new core.ui.Window(this);this.controlGroupWindow.setStyleId("imagebox-panel-control-group");this.controlGroupWindow.hide();break;case 3:this.borderButton=new SplitButton(this);this.borderButton.setStyleId("imagebox-panel-button-border");this.borderButton.setImageList("images/ImageBox/border.gif");this.borderButton.setIcon("images/icon/border.gif");this.borderButton.setText("Border");this.borderButton.setToolTip("Select border style");this.borderButton.notifyDefaultAction.addListener(this.onBorderButtonClick);this.borderButton.hide();break;case 4:var stat=new core.ui.Static(this.controlGroupWindow);stat.setStyle("position","absolute");stat.setStyleId("imagebox-panel-static-zoom");stat.setText("Zoom:");this.zoomSlider=new core.ui.Slider(this.controlGroupWindow);this.zoomSlider.setToolTip("Change picture size");this.zoomSlider.setStyle("position","absolute");this.zoomSlider.setStyleId("imagebox-panel-slider-zoom");this.zoomSlider.setRange(10,500);this.zoomSlider.setPos(100);this.zoomSlider.notifyPositionChanged.addListener(this.onZoomChange);this.zoomSlider.indicator.notifyBeginDrag.addListener(this.onZoomBeginDrag);this.zoomSlider.indicator.notifyEndDrag.addListener(this.onZoomEndDrag);this.zoomValue=new core.ui.Static(this.controlGroupWindow);this.zoomValue.setStyle("position","absolute");this.zoomValue.setStyleId("imagebox-panel-static-zoom-value");this.zoomValue.setText("100%");break;case 5:var stat=new core.ui.Static(this.controlGroupWindow);stat.setStyle("position","absolute");stat.setStyleId("imagebox-panel-static-transparency");stat.setText("Transparency:");this.transpSlider=new core.ui.Slider(this.controlGroupWindow);this.transpSlider.setToolTip("Change image transparency");this.transpSlider.setStyle("position","absolute");this.transpSlider.setStyleId("imagebox-panel-slider-transparency");this.transpSlider.notifyPositionChanged.addListener(this.onTransparencyChange);this.transpSlider.indicator.notifyBeginDrag.addListener(this.onTransparencyBeginDrag);this.transpSlider.indicator.notifyEndDrag.addListener(this.onTransparencyEndDrag);this.transpValue=new core.ui.Static(this.controlGroupWindow);this.transpValue.setStyle("position","absolute");this.transpValue.setStyleId("imagebox-panel-static-transp-value");this.transpValue.setText("0%");break;case 6:var stat=new core.ui.Static(this.controlGroupWindow);stat.setStyle("position","absolute");stat.setStyleId("imagebox-panel-static-rotation");stat.setText("Rotation:");this.rotationList=new core.ui.ComboBox(this.controlGroupWindow);this.rotationList.setStyle("position","absolute");this.rotationList.setStyleId("imagebox-panel-list-rotation");this.rotationList.setToolTip("Select rotation degree");this.rotationList.notifyValueChanged.addListener(this.onRotationChange);var angles={0:"0 \u00B0",90:"90 \u00B0",180:"180 \u00B0",270:"270 \u00B0"};for(var angle in angles){this.rotationList.addItem(angles[angle],angle,(0==angle)?true:false)}break;case 7:this.resetButton=new core.ui.ImageButton(this.controlGroupWindow);this.resetButton.setStyle("position","absolute");this.resetButton.setStyleId("imagebox-panel-button-reset");this.resetButton.setImageList("images/ImageBox/reset.gif");this.resetButton.setToolTip("Reset image");this.resetButton.oncommand=this.onResetButtonClick;break;case 8:this.hyperlinkButton=new core.ui.ImageButton(this.controlGroupWindow);this.hyperlinkButton.setStyle("position","absolute");this.hyperlinkButton.setStyleId("imagebox-panel-button-link");this.hyperlinkButton.setImageList("images/ImageBox/link.gif");this.hyperlinkButton.setToolTip("Set hyperlink");this.hyperlinkButton.oncommand=this.onLinkButtonClick;break;case 9:this.frontButton=new core.ui.ImageButton(this.controlGroupWindow);this.frontButton.setStyle("position","absolute");this.frontButton.setStyleId("imagebox-panel-button-front");this.frontButton.setImageList("images/ImageBox/front.gif");this.frontButton.setToolTip("Bring to front");this.frontButton.oncommand=this.onFrontButtonClick;break;case 10:this.backButton=new core.ui.ImageButton(this.controlGroupWindow);this.backButton.setStyle("position","absolute");this.backButton.setStyleId("imagebox-panel-button-back");this.backButton.setImageList("images/ImageBox/back.gif");this.backButton.setToolTip("Send to back");this.backButton.oncommand=this.onBackButtonClick;break;case 11:this.aboveButton=new core.ui.ImageButton(this.controlGroupWindow);this.aboveButton.setStyle("position","absolute");this.aboveButton.setStyleId("imagebox-panel-button-above");this.aboveButton.setImageList("images/ImageBox/above.gif");this.aboveButton.setToolTip("Bring above object");this.aboveButton.oncommand=this.onAboveButtonClick;break;case 12:this.underButton=new core.ui.ImageButton(this.controlGroupWindow);this.underButton.setStyle("position","absolute");this.underButton.setStyleId("imagebox-panel-button-under");this.underButton.setImageList("images/ImageBox/under.gif");this.underButton.setToolTip("Send under object");this.underButton.oncommand=this.onUnderButtonClick;break;case 13:new Separator(this.controlGroupWindow).apply(this.rotationList,this.frontButton);new Separator(this.controlGroupWindow).apply(this.underButton,this.resetButton);break;case 14:this.initBorderMenu();break;default:this.closeProgress();this.loadButton.show();this.controlGroupWindow.show();this.borderButton.show();return }this.setProgress(++this.initStep/14*100);window.setTimeout(this.deferredInit,1)});this.createProgress=function(){this.loadingWindow=new core.ui.Window(this,0,0,"100%","100%");this.loadingWindow.setStyle("position","absolute");this.loadingWindow.setStyle("z-index",this.getStyle("z-index")+100);this.progressBar=new core.ui.ProgressBar(this.loadingWindow);this.progressBar.setItemCount(20);this.progressBar.center()};this.closeProgress=function(){this.loadingWindow.close()};this.setProgress=function(pos){this.progressBar.setPos(pos)};this.isLoaded=function(){return defined(this.initStep)&&(this.initStep>=14)};this.setImageBox=function(imagebox){this.imagebox=imagebox;this.updateControls()};this.loadImage=function(){editor.ui.SelectionManager.get().getSelection(this.imagebox).setFocus(false);var frame=theApp.factory.getImageDialog();var dialog=frame.getContentWindow();dialog.notifyImageApplied.addListener(this.onImageChange);dialog.notifyCancelled.addListener(this.onImageCancelled);dialog.reset();if(!this.imagebox.isNew()||this.imagebox.isModified()){dialog.setImage(this.imagebox.getImage())}frame.move(core.ui.Window.getWidth()-(document.body.clientWidth+frame.getWidth())/2,core.ui.Window.getHeight()-(document.body.clientHeight+frame.getHeight())/2);frame.doModal()};this.updateControls=function(){if(!this.isLoaded()){return }var t=this.imagebox.getTransparency();this.transpSlider.setPos(t);this.transpValue.setText(t.toFixed(0)+"%");var z=this.imagebox.getZoom();this.zoomSlider.setPos(z);this.zoomValue.setText(z.toFixed(0)+"%");var d=this.imagebox.getRotationDegree();this.rotationList.setValue(d)};this.initBorderMenu=function(){this.borderMenu=new PopupMenuFrame();var menu=new BorderMenu(this.borderMenu);menu.notifyColorSelected.addListener(this.onBorderColorChange);menu.notifyWidthSelected.addListener(this.onBorderWidthChange);menu.notifyStyleSelected.addListener(this.onBorderStyleChange);this.borderMenu.setContentWindow(menu);this.borderButton.setPopupMenu(this.borderMenu)};this.onBorderButtonClick=callback(this,function(){var borderDialog=theApp.factory.getBorderDialog();borderDialog.getContentWindow().notifyApplied.addListener(this.onBorderChanged,true);borderDialog.getContentWindow().notifyCancelled.addListener(this.onBorderCancelled,true);borderDialog.getContentWindow().setBorderParameters(this.imagebox.getBorderWidth(),this.imagebox.getBorderStyle(),this.imagebox.getBorderColor());borderDialog.center();borderDialog.doModal()});this.onImageButtonClick=callback(this,function(){this.loadImage()});this.onAboveButtonClick=callback(this,function(){theApp.collection.moveToFront(this.imagebox,1)});this.onUnderButtonClick=callback(this,function(){theApp.collection.moveToBack(this.imagebox,1)});this.onFrontButtonClick=callback(this,function(){theApp.collection.moveToFront(this.imagebox)});this.onBackButtonClick=callback(this,function(){theApp.collection.moveToBack(this.imagebox)});this.onLinkButtonClick=callback(this,function(){editor.ui.SelectionManager.get().removeSelection(this.imagebox);var frame=theApp.factory.getUrlDialog();frame.setTitle("Hyperlink information");frame.getContentWindow().notifySetUrl.addListener(this.onCreateLink,true);frame.getContentWindow().notifyCancel.addListener(this.onCancelLinkDialog,true);frame.getContentWindow().setUrl(this.imagebox.getLink()?this.imagebox.getLink():"");frame.center();frame.doModal()});this.onResetButtonClick=callback(this,function(){var command=new EditImageBoxCommand(this.imagebox,"Reset picture");command.reset();editor.commands.CommandHistory.get().execute(command);editor.ui.SelectionManager.get().getSelection(this.imagebox).updateLayout();this.updateControls()});this.onBorderCancelled=callback(this,function(){theApp.factory.getBorderDialog().endModal()});this.onBorderChanged=callback(this,function(sender,width,style,color){var command=new editor.commands.EditBorderCommand(this.imagebox,"Change border of picture");command.setBorder(width,style,color);editor.commands.CommandHistory.get().execute(command);theApp.factory.getBorderDialog().endModal();editor.ui.SelectionManager.get().getSelection(this.imagebox).updateLayout()});this.onImageChange=callback(this,function(sender,source){source=source.replace(/\?\S*/,"");var command=new EditImageBoxCommand(this.imagebox,"Change picture");command.setImage(source);editor.commands.CommandHistory.get().execute(command);this.updateControls();var selection=editor.ui.SelectionManager.get().getSelection(this.imagebox);selection.updateLayout();selection.setFocus(true);theApp.factory.getImageDialog().endModal()});this.onImageCancelled=callback(this,function(sender){theApp.factory.getImageDialog().endModal();if(!this.imagebox.isModified()&&this.imagebox.isNew()){editor.ui.SelectionManager.get().removeSelection(this.imagebox);this.imagebox.hide();theApp.collection.excludeElement(this.imagebox)}else{editor.ui.SelectionManager.get().getSelection(this.imagebox).setFocus(true)}});this.onZoomBeginDrag=callback(this,function(){this.zoomCommand=new EditImageBoxCommand(this.imagebox,"Zoom picture")});this.onZoomEndDrag=callback(this,function(){if((this.zoomCommand&&(this.zoomCommand.constructor===EditImageBoxCommand||defined(this.zoomCommand.constructor.isSubclassOf)&&this.zoomCommand.constructor.isSubclassOf(EditImageBoxCommand)))){this.zoomCommand.setZoom(this.zoomSlider.getPos());editor.commands.CommandHistory.get().execute(this.zoomCommand);delete this.zoomCommand}});this.onZoomChange=callback(this,function(sender,zoom){if(this.zoomSlider.indicator.isDragging()){this.imagebox.setZoom(zoom)}else{var command=new EditImageBoxCommand(this.imagebox,"Zoom picture");command.setZoom(zoom);editor.commands.CommandHistory.get().execute(command)}editor.ui.SelectionManager.get().getSelection(this.imagebox).updateLayout();this.zoomValue.setText(zoom.toFixed(0)+"%")});this.onTransparencyBeginDrag=callback(this,function(){this.transparencyCommand=new EditImageBoxCommand(this.imagebox,"Change transparency")});this.onTransparencyEndDrag=callback(this,function(){if((this.transparencyCommand&&(this.transparencyCommand.constructor===EditImageBoxCommand||defined(this.transparencyCommand.constructor.isSubclassOf)&&this.transparencyCommand.constructor.isSubclassOf(EditImageBoxCommand)))){this.transparencyCommand.setTransparency(this.transpSlider.getPos());editor.commands.CommandHistory.get().execute(this.transparencyCommand);delete this.transparencyCommand}});this.onTransparencyChange=callback(this,function(sender,t){if(this.transpSlider.indicator.isDragging()){this.imagebox.setTransparency(t)}else{var command=new EditImageBoxCommand(this.imagebox,"Change transparency");command.setTransparency(t);editor.commands.CommandHistory.get().execute(command)}this.transpValue.setText(t.toFixed(0)+"%")});this.onRotationChange=callback(this,function(sender,rotation){var command=new EditImageBoxCommand(this.imagebox,"Rotate picture");command.rotate(rotation);editor.commands.CommandHistory.get().execute(command);editor.ui.SelectionManager.get().getSelection(this.imagebox).updateLayout()});this.onColorChange=callback(this,function(sender,color){this.imagebox.setBackgroundColor(color)});this.onBorderColorChange=callback(this,function(sender,c){var command=new editor.commands.EditBorderCommand(this.imagebox,"Change border color");command.setBorderColor(c);editor.commands.CommandHistory.get().execute(command)});this.onBorderWidthChange=callback(this,function(sender,w){var command=new editor.commands.EditBorderCommand(this.imagebox,"Change border width");command.setBorderWidth(w);editor.commands.CommandHistory.get().execute(command)});this.onBorderStyleChange=callback(this,function(sender,s){var command=new editor.commands.EditBorderCommand(this.imagebox,"Change border style");command.setBorderStyle(s);editor.commands.CommandHistory.get().execute(command)});this.onCancelLinkDialog=callback(this,function(sender){editor.ui.SelectionManager.get().addSelection(this.imagebox);theApp.factory.getUrlDialog().endModal()});this.onCreateLink=callback(this,function(sender,url){this.imagebox.setLink(url);editor.ui.SelectionManager.get().addSelection(this.imagebox);theApp.factory.getUrlDialog().endModal()})}}}ClassFactory.createPackage("editor.plugins.images");ClassFactory.createClass(editor.plugins.images,"ImagesPlugin");with(editor.plugins.images){editor.plugins.images.ImagesPlugin.constructor=function(){this.ImagesPlugin=function(){editor.Application.getInstance().addAppListener(this)};this.onAppInitComplete=function(app){var button=new editor.ui.ToolButton(this);button.addStyleName("ImageBoxIcon");button.setText("Add picture");button.setIcon("images/ImageBox/icon.png");button.setToolTip("Add new picture");var images=app.config.get("page.photos");if(images){for(var i=0;i<images.length;i++){var img=document.getElementById("person.photo"+(i+1));if(img&&defined(img.winid)){var imageBox=core.ui.Window.forId(img.winid);imageBox.setImage(images[i]);imageBox.setModified(true)}}}};this.onAppSaving=function(app,context){var photo=document.getElementById("person.photo1");if(photo&&photo.winid){var imagebox=core.ui.Window.forId(photo.winid);if(!imagebox.isNew()&&imagebox.isModified()){context.set("person.photo",imagebox.getImage())}}};this.getPanel=function(){return theApp.factory.createPanelWithFrame(ImageBoxPanel,"Picture properties")};this.onToolButtonPressed=this.onToolButtonDropped=function(button,x,y){var picture=new ImageBox();with(editor.commands){CommandHistory.get().execute(new AddCommand(picture,x,y,"Add picture"))}picture.select();picture.activate();picture.edit()}}}ClassFactory.createPackage("core.ui");ClassFactory.createClass(core.ui,"Container");with(core.ui){core.ui.Container.superClass=core.ui.Window;core.ui.Container.constructor=function(){this.Container=function(A){arguments.callee.prototype.apply(this,[null,undefined,undefined,undefined,undefined,A])}}}ClassFactory.createPackage("editor.plugins.pages");ClassFactory.createClass(editor.plugins.pages,"SiteMenuItem");with(editor.plugins.pages){editor.plugins.pages.SiteMenuItem.superClass=core.ui.Window;editor.plugins.pages.SiteMenuItem.constructor=function(){this.listeners=new core.util.Listeners();this.SiteMenuItem=function(B,A){arguments.callee.prototype.apply(this,[B,undefined,undefined,undefined,undefined,A]);this.pageId=A.getAttribute("pageId");this.link=A.getElementsByTagName("a").item(0);this.link.onclick=this.onLinkClick;this.setStyle("white-space","nowrap");this.setStyle("display","")};this.addItemListener=function(A){this.listeners.add(A)};this.removeItemListener=function(A){this.listeners.remove(A)};this.setPageName=function(A){this.link.innerHTML=common.util.MemorialUtils.htmlEncode(A)};this.getPageName=function(){return common.util.MemorialUtils.htmlDecode(this.link.innerHTML)};this.setPageId=function(A){this.pageId=A};this.getPageId=function(){return this.pageId};this.setPageUrl=function(A){this.link.setAttribute("href",A)};this.getPageUrl=function(){return this.link.getAttribute("href")};this.getHtmlTag=function(){return new core.html.Tag("div",{"class":this.getElement().className,"style":this.getInlineStyle(),"pageId":this.pageId||""},this.getElement().innerHTML)};this.getInlineStyle=function(){return new core.html.Style({"float":this.getStyle("float"),"left":this.getStyle("left"),"top":this.getStyle("top"),"width":this.getStyle("width"),"height":this.getStyle("height"),"line-height":this.getStyle("line-height"),"background-color":this.getStyle("background-color"),"background-image":this.getStyle("background-image"),"background-repeat":this.getStyle("background-repeat"),"background-position":this.getStyle("background-position"),"margin":this.getStyle("margin"),"margin-left":this.getStyle("margin-left"),"margin-top":this.getStyle("margin-top"),"margin-right":this.getStyle("margin-right"),"margin-bottom":this.getStyle("margin-bottom"),"padding":this.getStyle("padding"),"padding-left":this.getStyle("padding-left"),"padding-top":this.getStyle("padding-top"),"padding-right":this.getStyle("padding-right"),"padding-bottom":this.getStyle("padding-bottom")})};this.clone=function(){var A=new SiteMenuItem(this.getParent(),this.getElement().cloneNode(true));A.setPageId(null);return A};this.fireClick=function(){this.listeners.call("onItemClick",[this])};this.onLinkClick=callback(this,function(A){A=core.ui.Event.improve(A);this.fireClick();A.cancel();A.stop()})}}ClassFactory.createPackage("editor.plugins.pages");ClassFactory.createClass(editor.plugins.pages,"PageNameValidator");with(editor.plugins.pages){editor.plugins.pages.PageNameValidator.superClass=core.util.validation.NonEmptyValidator;editor.plugins.pages.PageNameValidator.constructor=function(){this.validate=override(this.validate,function(){with(core.util.validation){try{arguments.callee.prototype.apply(this,[])}catch(e){throw new ValidationError(this,"The page name cannot be empty.")}for(var i=SiteMenu.get().getItems().iterator();i.hasNext();i.next()){var item=i.current();var field=this.getTarget().getField();if((item!==field.getItem())&&(item.getPageName().toUpperCase()===field.getText().toUpperCase())){throw new ValidationError(this,'Page "'+item.getPageName()+'" already exists. Please choose another name.')}}}})}}ClassFactory.createPackage("editor.plugins.pages");ClassFactory.createClass(editor.plugins.pages,"SiteMenuItemEditor");with(editor.plugins.pages){editor.plugins.pages.SiteMenuItemEditor.superClass=core.ui.Edit;editor.plugins.pages.SiteMenuItemEditor.constructor=function(){this.listeners=new core.util.Listeners();this.SiteMenuItemEditor=function(){arguments.callee.prototype.apply(this,[]);with(core.util.validation){this.validator=new PageNameValidator(new TextField(this))}};this.addEditorListener=function(listener){this.listeners.add(listener)};this.removeEditorListener=function(listener){this.listeners.remove(listener)};this.edit=function(item){this.item=item;this.attachGlobalEvent("mousedown");this.attachGlobalEvent("keydown");this.move(item.getAbsX(),item.getAbsY());this.resize(item.getWidth(),item.getHeight());this.setText(item.getPageName());this.show();this.setFocus(true);this.setSelected(true)};this.finalize=function(){editor.ui.TooltipController.hideBalloonTip(this);this.detachGlobalEvent("mousedown");this.detachGlobalEvent("keydown");this.setFocus(false);this.hide()};this.finish=function(){try{if(this.item.getPageName()!==this.getText()){this.validator.validate();this.fireCompleted()}this.finalize()}catch(e){this.tooltip=editor.ui.TooltipController.showBalloonTip(this,e.getMessage(),core.ui.Balloon.RIGHT|core.ui.Balloon.FLOATING)}};this.cancel=function(){this.fireCancelled();this.finalize()};this.getItem=function(){return this.item};this.fireCancelled=function(){this.listeners.call("onEditorCancelled",[this])};this.fireCompleted=function(){this.listeners.call("onEditorCompleted",[this])};this.onmousedown=function(event,target){if((target&&(target.constructor===core.ui.Window||defined(target.constructor.isSubclassOf)&&target.constructor.isSubclassOf(core.ui.Window)))){if(((this.tooltip&&(this.tooltip.constructor===core.ui.Balloon||defined(this.tooltip.constructor.isSubclassOf)&&this.tooltip.constructor.isSubclassOf(core.ui.Balloon))))&&((target==this.tooltip)||target.isChildOf(this.tooltip))){return }if(this===target){return }}this.finish();event.stop();event.cancel()};this.onkeydown=function(event){var handled=false;if(core.ui.Event.KEY_ENTER==event.keyCode){this.finish();handled=true}else{if(core.ui.Event.KEY_ESCAPE==event.keyCode){this.cancel();handled=true}}if(handled){event.stop();event.cancel()}}}}ClassFactory.createPackage("editor.plugins.pages");ClassFactory.createClass(editor.plugins.pages,"EditPageNameCommand");with(editor.plugins.pages){editor.plugins.pages.EditPageNameCommand.superClass=editor.commands.AbstractCommand;editor.plugins.pages.EditPageNameCommand.constructor=function(){this.EditPageNameCommand=function(B,A,C){arguments.callee.prototype.apply(this,[null,'Change page name to "'+A+'"']);this.oldName=B;this.newName=A;this.item=SiteMenu.get().getItem(B);this.oldUrl=this.item.getPageUrl();this.newUrl=C};this.execute=function(){this.item.setPageName(this.newName);this.item.setPageUrl(this.newUrl)};this.unexecute=function(){this.item.setPageName(this.oldName);this.item.setPageUrl(this.oldUrl)}}}ClassFactory.createPackage("editor.plugins.pages");ClassFactory.createClass(editor.plugins.pages,"CreatePageCommand");with(editor.plugins.pages){editor.plugins.pages.CreatePageCommand.superClass=editor.commands.AbstractCommand;editor.plugins.pages.CreatePageCommand.constructor=function(){this.CreatePageCommand=function(A,B){arguments.callee.prototype.apply(this,[null,'Create page "'+A+'"']);this.pageName=A;this.pageUrl=B};this.getItem=function(){return this.item};this.execute=function(){var B=SiteMenu.get();var A=B.getDefaultItem();if(!defined(this.item)){this.item=A.clone();this.item.setPageName(this.pageName);this.item.setPageUrl(this.pageUrl)}B.getElement().insertBefore(this.item.getElement(),A.getElement());B.addItem(this.item)};this.unexecute=function(){var A=SiteMenu.get();A.deleteItem(this.item);A.getElement().removeChild(this.item.getElement())}}}ClassFactory.createPackage("editor.plugins.pages");ClassFactory.createClass(editor.plugins.pages,"DeletePageCommand");with(editor.plugins.pages){editor.plugins.pages.DeletePageCommand.superClass=editor.commands.AbstractCommand;editor.plugins.pages.DeletePageCommand.constructor=function(){this.DeletePageCommand=function(A){arguments.callee.prototype.apply(this,[null,'Delete page "'+A+'"']);this.menu=SiteMenu.get();this.item=this.menu.getItem(A)};this.execute=function(){this.nextSibling=this.item.getElement().nextSibling;this.menu.deleteItem(this.item);this.menu.getElement().removeChild(this.item.getElement())};this.unexecute=function(){this.menu.getElement().insertBefore(this.item.getElement(),this.nextSibling);this.menu.addItem(this.item)}}}ClassFactory.createPackage("editor.plugins.pages");ClassFactory.createClass(editor.plugins.pages,"PageUrlGenerator");with(editor.plugins.pages){editor.plugins.pages.PageUrlGenerator.constructor=function(){this.PageUrlGenerator=function(A){this.baseUrl=A};this.getBaseUrl=function(){return this.baseUrl};this.generate=function(A){return this.baseUrl+encodeURI(A)}}}ClassFactory.createPackage("editor.plugins.pages");ClassFactory.createClass(editor.plugins.pages,"SiteMenuSelection");with(editor.plugins.pages){editor.plugins.pages.SiteMenuSelection.superClass=editor.ui.AbstractSelection;editor.plugins.pages.SiteMenuSelection.constructor=function(){this.SiteMenuSelection=function(C){arguments.callee.prototype.apply(this,[C]);var B=editor.Application.getInstance().getConfig();var A=new editor.ui.SelectionMenuBuilder(this);A.buildIcon(this.onDeleteItem,"DeleteButton","Delete this webpage",["images/SelectionMenu/delete-normal.png","images/SelectionMenu/delete-hover.png","images/SelectionMenu/delete-pressed.png"]);A.buildIcon(this.onEditItem,"EditButton","Edit webpage name",["images/SelectionMenu/edit-normal.png","images/SelectionMenu/edit-hover.png","images/SelectionMenu/edit-pressed.png"]);this.menu=A.getMenu();this.url=new PageUrlGenerator(B.get("page.url"))};this.select=override(this.select,function(){var A=SiteMenu.get().getActiveItem();if((A&&(A.constructor===SiteMenuItem||defined(A.constructor.isSubclassOf)&&A.constructor.isSubclassOf(SiteMenuItem)))){arguments.callee.prototype.apply(this,[]);this.menu.updateLayout(A);this.menu.show()}});this.unselect=override(this.unselect,function(){arguments.callee.prototype.apply(this,[]);this.menu.hide()});this.getEditor=function(){if(!defined(this.editor)){this.editor=new SiteMenuItemEditor();this.editor.addEditorListener(this)}return this.editor};this.onEditorCompleted=function(){var B=this.editor.getItem();var A=this.editor.getText();var C=editor.commands.CommandHistory.get();var E=SiteMenu.get();if(E.getDefaultItem()===B){var D=new CreatePageCommand(A,this.url.generate(A));C.execute(D);E.getDefaultItem().hide();if(confirm("Edit this page right now?\n\nClick OK to load the new page in editor or Cancel to stay on the current page.")){E.onItemClick(D.getItem())}else{E.getDefaultItem().show()}}else{if(B.getPageUrl()===this.url.getBaseUrl()){C.execute(new EditPageNameCommand(B.getPageName(),A,B.getPageUrl()))}else{C.execute(new EditPageNameCommand(B.getPageName(),A,this.url.generate(A)))}}};this.onEditItem=callback(this,function(){this.getEditor().edit(SiteMenu.get().getActiveItem())});this.onDeleteItem=callback(this,function(){var B=SiteMenu.get().getActiveItem();var A=editor.Application.getInstance().getConfig();if(B.getPageUrl()===A.get("page.url")){alert("Sorry, you cannot delete the homepage.")}else{if(confirm("Delete this webpage?")){editor.commands.CommandHistory.get().execute(new DeletePageCommand(B.getPageName()));this.unselect()}}})};editor.plugins.pages.SiteMenuSelection.getInstance=function(A){if(!defined(this.instance)){this.instance=new SiteMenuSelection()}this.instance.setTarget(A);return this.instance}}ClassFactory.createPackage("editor.plugins.pages");ClassFactory.createClass(editor.plugins.pages,"SiteMenu");with(editor.plugins.pages){editor.plugins.pages.SiteMenu.superClass=editor.elements.PageElement;editor.plugins.pages.SiteMenu.constructor=function(){this.items=new core.util.ArrayList();this.SiteMenu=function(A){arguments.callee.prototype.apply(this,[A,"Site menu"]);this.setStyle("z-index",4);this.setStyle("overflow","visible");this.setStyle("height","auto");this.createSelection();core.ui.Event.addListener(document.body,"mouseover",this.onDocumentMouseOver)};this.getItems=function(){return this.items};this.getItem=function(A){for(var B=this.items.iterator();B.hasNext();B.next()){var C=B.current();if(C.getPageName()==A){return C}}return undefined};this.addItem=function(A){A.addItemListener(this);this.items.add(A)};this.deleteItem=function(B){var A=this.items.indexOf(B);if(-1!==A){this.items.toArray().splice(A,1)}};this.clear=function(){for(var A=this.items.iterator();A.hasNext();A.next()){A.current().close()}this.items.clear()};this.getDefaultItem=function(){return this.defaultItem};this.getCurrentItem=function(){return this.currentItem};this.getActiveItem=function(){return this.activeItem};this.setCurrentItem=function(B){if(!B.getPageId()){var A=editor.Application.getInstance().getConfig();B.setPageUrl(A.get("page.url"));B.setPageId(A.get("page.id"))}this.currentItem=B};this.createSelection=function(){return SiteMenuSelection.getInstance(this)};this.load=override(this.load,function(A){arguments.callee.prototype.apply(this,[A]);if(this.isInEditMode()){this.items.clear();for(var C=0;C<A.childNodes.length;C++){var E=A.childNodes.item(C);if(1===E.nodeType){this.addItem(new SiteMenuItem(this,E))}}if(this.items.size()>0){this.defaultItem=this.items.get(0).clone();this.defaultItem.setPageName("(create new page...)");this.defaultItem.setPageUrl("");this.defaultItem.addItemListener(this);this.defaultItem.setToolTip("Create new page");this.getElement().appendChild(this.defaultItem.getElement());this.setCurrentItem(this.items.get(0))}var F=SiteMenu.get();if((F&&(F.constructor===SiteMenu||defined(F.constructor.isSubclassOf)&&F.constructor.isSubclassOf(SiteMenu)))){this.clear();for(var B=F.items.iterator();B.hasNext();B.next()){var G=B.current();var D=this.defaultItem.clone();D.setPageId(G.getPageId());D.setPageName(G.getPageName());D.setPageUrl(G.getPageUrl());this.getElement().insertBefore(D.getElement(),this.defaultItem.getElement());this.addItem(D);if(G===F.getCurrentItem()){this.setCurrentItem(D)}}}SiteMenu.set(this)}});this.getHtmlTag=override(this.getHtmlTag,function(){var A=arguments.callee.prototype.apply(this,[]);var C=A.getAttribute("style");C.setProperty("margin",this.getStyle("margin"));C.setProperty("margin-left",this.getStyle("margin-left"));C.setProperty("margin-top",this.getStyle("margin-top"));C.setProperty("margin-right",this.getStyle("margin-right"));C.setProperty("margin-bottom",this.getStyle("margin-bottom"));C.setProperty("padding",this.getStyle("padding"));C.setProperty("padding-left",this.getStyle("padding-left"));C.setProperty("padding-top",this.getStyle("padding-top"));C.setProperty("padding-right",this.getStyle("padding-right"));C.setProperty("padding-bottom",this.getStyle("padding-bottom"));A.setContent("");for(var B=this.items.iterator();B.hasNext();B.next()){A.addContent(B.current().getHtmlTag())}return A});this.setEnabled=override(this.setEnabled,function(A){});this.onItemClick=function(A){if(this.defaultItem===A){SiteMenuSelection.getInstance(this).getEditor().edit(A)}else{if(this.currentItem!==A){var B=editor.Application.getInstance();B.save();if(A.getPageId()){this.setCurrentItem(A);B.loadPage(A.getPageId())}else{core.ajax.sendRequest(B.getUserCommand("ajax.CreatePage"),this.onPageCreated,{"url":A.getPageUrl(),"name":A.getPageName()})}}}};this.onPageCreated=callback(this,function(A){if("OK"===A.status){var B=this.getItem(A.pageName);B.setPageId(A.pageId);this.setCurrentItem(B);var C=editor.Application.getInstance();C.loadTemplate(C.config.get("page.template"))}});this.onmousedown=function(){editor.ui.SelectionManager.get().clearSelection();editor.Application.getInstance().switchPanel(null)};this.onmouseover=function(A,B){while(((B&&(B.constructor===core.ui.Window||defined(B.constructor.isSubclassOf)&&B.constructor.isSubclassOf(core.ui.Window))))&&!((B&&(B.constructor===SiteMenuItem||defined(B.constructor.isSubclassOf)&&B.constructor.isSubclassOf(SiteMenuItem))))){B=B.getParent()}if((B&&(B.constructor===core.ui.Window||defined(B.constructor.isSubclassOf)&&B.constructor.isSubclassOf(core.ui.Window)))){if(B===this.defaultItem){SiteMenuSelection.getInstance(this).unselect()}else{this.activeItem=B;SiteMenuSelection.getInstance(this).select()}A.stop();A.cancel()}};this.onDocumentMouseOver=callback(this,function(A){A=core.ui.Event.improve(A);if(A.target===document.body){SiteMenuSelection.getInstance(this).unselect()}})};editor.plugins.pages.SiteMenu.set=function(A){this.instance=A};editor.plugins.pages.SiteMenu.get=function(){return this.instance}}ClassFactory.createPackage("editor.plugins.pages");ClassFactory.createClass(editor.plugins.pages,"PagesPlugin");with(editor.plugins.pages){editor.plugins.pages.PagesPlugin.constructor=function(){this.PagesPlugin=function(){editor.Application.getInstance().addAppListener(this)};this.onAppSaving=function(E,B){var D=SiteMenu.get();if((D&&(D.constructor===SiteMenu||defined(D.constructor.isSubclassOf)&&D.constructor.isSubclassOf(SiteMenu)))){var C=D.getCurrentItem();if((C&&(C.constructor===SiteMenuItem||defined(C.constructor.isSubclassOf)&&C.constructor.isSubclassOf(SiteMenuItem)))){B.setUrl("ajax.SavePage?pageId="+C.getPageId())}for(var A=D.getItems().iterator();A.hasNext();A.next()){B.set("page.name"+A.current().getPageId(),A.current().getPageName())}}}}}ClassFactory.createPackage("editor.plugins.text");ClassFactory.createClass(editor.plugins.text,"TextBoxSelection");with(editor.plugins.text){editor.plugins.text.TextBoxSelection.superClass=editor.ui.DefaultSelection;editor.plugins.text.TextBoxSelection.constructor=function(){this.TextBoxSelection=function(B){arguments.callee.prototype.apply(this,[B]);this.setStyle("z-index",2);var A=new editor.ui.SelectionMenuBuilder(B);A.buildDeleteIcon();A.buildEditIcon();this.setMenu(A.getMenu())};this.onEndResize=callback(this,override(this.onEndResize,function(){this.getTarget().updateLayout();this.updateLayout();arguments.callee.prototype.apply(this,[])}))}}ClassFactory.createPackage("editor.plugins.text");ClassFactory.createClass(editor.plugins.text,"TextBox");with(editor.plugins.text){editor.plugins.text.TextBox.superClass=editor.elements.PageElement;editor.plugins.text.TextBox.constructor=function(){this.TextBox=function(A){arguments.callee.prototype.apply(this,[A,"Text"])};this.edit=function(){var A=theApp.plugins.text.getPanel().getContentWindow();if(A.isLoaded()){A.setEditMode(true)}else{A.notifyLoaded.addListener(this.onPanelLoaded,true)}};this.isEmpty=function(){var B=this.getText();var A=B.replace(/(&nbsp;)|(\s+)|(<.+?>)/g,"").length;return(A==0)};this.setText=override(this.setText,function(C){arguments.callee.prototype.apply(this,[C]);var A=this.getElement().getElementsByTagName("a");for(var B in A){if(defined(A[B])){A[B].target="_blank"}else{delete A[B]}}this.updateLayout()});this.setEnabled=override(this.setEnabled,function(A){arguments.callee.prototype.apply(this,[A]);this.getElement().disabled=false});this.activate=override(this.activate,function(){arguments.callee.prototype.apply(this,[]);var B=theApp.plugins.text.getPanel();var A=B.getContentWindow();A.setEditMode(false);A.setTextBox(this);theApp.switchPanel(B)});this.move=override(this.move,function(A,C){arguments.callee.prototype.apply(this,[A,C]);var B=theApp.plugins.text.getPanel().getContentWindow();if(B.editMode&&(this==B.textbox)){B.editor.move(A,C)}});this.resize=override(this.resize,function(B,C){arguments.callee.prototype.apply(this,[B,C]);var A=theApp.plugins.text.getPanel().getContentWindow();if(A.editMode&&(this==A.textbox)){A.editor.resize(B,C)}this.updateLayout()});this.load=override(this.load,function(A){arguments.callee.prototype.apply(this,[A]);if(this.isInEditMode()){this.updateLayout()}});this.onPanelLoaded=callback(this,function(){this.edit()});this.updateLayout=function(){var A=editor.Application.getInstance();if(!A.plugins.text.getPanel().getContentWindow().getEditMode()){this.setStyle("height","auto")}};this.createSelection=function(){return new TextBoxSelection(this)}};editor.plugins.text.TextBox.forElement=function(A){while(A&&(A.className!="TextBox")){A=A.parentNode}return A?core.ui.Window.forId(A.winid):null}}ClassFactory.createPackage("core.ui.quirks");ClassFactory.createClass(core.ui.quirks,"ColorFormat");with(core.ui.quirks){core.ui.quirks.ColorFormat.constructor=function(){};core.ui.quirks.ColorFormat.decToHex=function(B){var A=core.util.Color.dec2Hex(B);A=A.substring(1);return A.substring(4)+A.substring(2,4)+A.substring(0,2)}}ClassFactory.createPackage("editor.ui");ClassFactory.createClass(editor.ui,"ToggleButton");with(editor.ui){editor.ui.ToggleButton.superClass=editor.ui.StateButton;editor.ui.ToggleButton.constructor=function(){this.setEnabled=override(this.setEnabled,function(A){arguments.callee.prototype.apply(this,[A]);if(A){this.setState(this.isTurned()?core.ui.ImageButton.STATE_PRESSED:core.ui.ImageButton.STATE_NORMAL)}});this.onmousedown=function(A){this.turn();this.setState(this.isTurned()?core.ui.ImageButton.STATE_PRESSED:core.ui.ImageButton.STATE_HOVER);this.setFocus(true);this.activate();A.stop();A.cancel()};this.onmouseout=function(A){this.setState((this.isTurned())?core.ui.ImageButton.STATE_PRESSED:core.ui.ImageButton.STATE_NORMAL);A.stop()};this.onblur=function(){this.setState(this.isTurned()?core.ui.ImageButton.STATE_PRESSED:core.ui.ImageButton.STATE_NORMAL)};this.onmouseover=this.onmouseup=function(A){this.setState(this.isTurned()?core.ui.ImageButton.STATE_PRESSED:core.ui.ImageButton.STATE_HOVER);A.stop()}};editor.ui.SealButton.notifyPress=new core.ui.Notification()}ClassFactory.createPackage("editor.ui");ClassFactory.createClass(editor.ui,"ColorPicker");with(editor.ui){editor.ui.ColorPicker.superClass=core.ui.SplitWindow;editor.ui.ColorPicker.constructor=function(){this.pickButton;this.applyButton;this.popupMenu;this.colorSubmenu;this.color="000000";this.notifyColorSelected=new core.ui.Notification();this.ColorPicker=function(B,A,E,C,D){this.SplitWindow(B,A,E,C,D);this.applyButton=new MenuButton(this);this.applyButton.setIcon("images/blank.gif");this.applyButton.setStyleId("color-picker-button-apply");this.applyButton.oncommand=this.onApplyButtonClick;this.pickButton=new core.ui.ImageButton(this);this.pickButton.setStyleId("color-picker-button-pick");this.pickButton.oncommand=this.onPickButtonClick;this.applyButton.onmousedown=this.pickButton.onmousedown=this.onButtonMouseDown;this.applyButton.onmouseover=this.pickButton.onmouseover=this.onButtonMouseOver;this.applyButton.onmouseup=this.pickButton.onmouseup=this.onButtonMouseOver;this.applyButton.onmouseout=this.pickButton.onmouseout=this.onButtonMouseOut;this.initColorMenu()};this.setColor=function(A){if((defined(this.color))&&this.color==A){return }this.color=A;if(A===this.colorSubmenu.getTranspColor()){this.applyButton.icon.setStyle("background-image","url(images/ColorMenu/transparent-color-icon.gif)");this.colorSubmenu.setColor(A)}else{try{this.applyButton.icon.setStyle("background-image","none");this.applyButton.icon.setStyle("background-color",A);this.colorSubmenu.setColor(A)}catch(B){}}};this.initColorMenu=function(){this.popupMenu=new PopupMenuFrame();var A=new PopupMenu(this.popupMenu);this.colorSubmenu=A.createSubMenu(null,ColorMenu);this.colorSubmenu.setText("Pick color from list");this.colorSubmenu.notifyColorSelected.addListener(this.onMenuColorSelected);this.colorSubmenu.notifyColorApplied.addListener(this.onMenuColorSelected);this.popupMenu.setContentWindow(A)};this.onPickButtonClick=callback(this,function(){if(this.popupMenu.isPopup()){this.popupMenu.endPopup()}else{this.popupMenu.doPopupNear(this.applyButton);this.popupMenu.getContentWindow().origin=this.pickButton}});this.onApplyButtonClick=callback(this,function(){this.notifyColorSelected.send(this,this.colorSubmenu.getColor())});this.onButtonMouseDown=callback(this,function(A){this.applyButton.setState(core.ui.ImageButton.STATE_PRESSED);this.pickButton.setState(core.ui.ImageButton.STATE_PRESSED);this.activate();A.stop();return false});this.onButtonMouseOver=callback(this,function(A){this.applyButton.setState(core.ui.ImageButton.STATE_HOVER);this.pickButton.setState(core.ui.ImageButton.STATE_HOVER);A.stop()});this.onButtonMouseOut=callback(this,function(A){this.applyButton.setState(core.ui.ImageButton.STATE_NORMAL);this.pickButton.setState(core.ui.ImageButton.STATE_NORMAL);A.stop()});this.onMenuColorSelected=callback(this,function(B,A){this.setColor(A);this.notifyColorSelected.send(this,A);this.popupMenu.getContentWindow().endPopup()})}}ClassFactory.createPackage("core.ui");ClassFactory.createClass(core.ui,"HtmlEditor");with(core.ui){core.ui.HtmlEditor.superClass=core.ui.Window;core.ui.HtmlEditor.constructor=function(){this.iframe;this.document;this.range="";this.notifySelectionChange=new Notification();this.setText=function(B){var A=this.document.getElementsByTagName("body")[0];if(A){A.innerHTML=B;try{this.execCommand("InsertHtml","<!--Powered by HtmlEditor v.0.1.1-->")}catch(C){}}};this.getDocument=function(){return this.document};this.getText=function(){var A=this.document.getElementsByTagName("body")[0];return(A)?A.innerHTML:""};this.getSelectedText=function(){return(defined(this.range.toString))?this.range.toString():this.range.text};this.indent=function(){this.execCommand("Indent")};this.isIndent=function(){return this.queryCommandState("Indent")};this.outdent=function(){this.execCommand("Outdent")};this.isOutdent=function(){return this.queryCommandState("Outdent")};this.setFontFace=function(A){this.execCommand("FontName",A)};this.getFontFace=function(){return this.queryCommandValue("FontName")};this.setFontSize=function(A){this.execCommand("FontSize",A)};this.getFontSize=function(){return this.queryCommandValue("FontSize")};this.setForeColor=function(A){this.execCommand("ForeColor",A)};this.getForeColor=function(A){return this.queryCommandValue("ForeColor")};this.setBackColor=function(A){this.execCommand("BackColor",A)};this.getBackColor=function(A){return this.queryCommandValue("BackColor")};this.setBold=function(){this.execCommand("Bold")};this.isBold=function(){return this.queryCommandState("Bold")};this.setItalic=function(){this.execCommand("Italic")};this.isItalic=function(){return this.queryCommandState("Italic")};this.setUnderline=function(){this.execCommand("Underline")};this.isUnderline=function(){return this.queryCommandState("Underline")};this.justifyLeft=function(){this.execCommand("JustifyLeft")};this.isJustifiedLeft=function(){return this.queryCommandState("JustifyLeft")};this.justifyRight=function(){this.execCommand("JustifyRight")};this.isJustifiedRight=function(){return this.queryCommandState("JustifyRight")};this.justifyCenter=function(){this.execCommand("JustifyCenter")};this.isJustifiedCenter=function(){return this.queryCommandState("JustifyCenter")};this.justifyFull=function(){this.execCommand("JustifyFull")};this.isJustifiedFull=function(){return this.queryCommandState("JustifyFull")};this.insertHtml=function(A){this.execCommand("InsertHtml",A)};this.createLink=function(A){this.execCommand("CreateLink",A)};this.getLink=function(){return this.queryCommandValue("CreateLink")};this.unlink=function(){this.execCommand("Unlink")};this.undo=function(){this.execCommand("Undo")};this.canUndo=function(){return this.queryCommandState("Undo")};this.redo=function(){this.execCommand("Redo")};this.canRedo=function(){return this.queryCommandState("Redo")};this.insertOrderedList=function(){this.execCommand("InsertOrderedList")};this.isOrderedList=function(){return this.queryCommandState("InsertOrderedList")};this.insertUnorderedList=function(){this.execCommand("InsertUnorderedList")};this.isUnorderedList=function(){return this.queryCommandState("InsertUnorderedList")};this.close=override(this.close,function(){this.getElement().removeChild(this.iframe);delete this.iframe;delete this.document;arguments.callee.prototype.apply(this,[])});this.initDesignMode=function(){try{this.document=this.iframe.contentWindow.document;this.document.designMode="on";if(defined(this.document.queryCommandSupported)){try{if(this.document.queryCommandSupported("useCSS")){this.document.execCommand("useCSS",false,false)}else{if(this.document.queryCommandSupported("styleWithCSS")){this.document.execCommand("styleWithCSS",false,false)}}}catch(C){this.document.execCommand("styleWithCSS",false,false)}}var B=["mousedown","mouseup","focus"];for(var A=0;A<B.length;A++){Event.addListener(this.document,B[A],this.onMouseEvent)}var B=["keydown","keyup"];for(var A=0;A<B.length;A++){Event.addListener(this.document,B[A],this.onKeyboardEvent)}}catch(C){}};this.execCommand=function(A,C){var B=false;try{if(!defined(C)){C=null}if(defined(this.range)&&defined(this.range.select)){this.range.select()}B=this.document.execCommand(A,false,C)}catch(D){throw new Error("Failed to execute command "+A+": "+D)}this.iframe.contentWindow.focus();if(defined(this.iframe.focus)){this.iframe.focus()}return B};this.queryCommandState=function(A){if(defined(this.document.queryCommandState)){return this.document.queryCommandState(A)}return false};this.queryCommandValue=function(A){if(defined(this.document.queryCommandValue)){return this.document.queryCommandValue(A)}return null};this.getSelectionRange=function(){var A="";if(defined(this.document.selection)){A=this.document.selection.createRange()}else{A=this.iframe.contentWindow.getSelection();A=A.getRangeAt(A.rangeCount-1)}return A};this.createElement=override(this.createElement,function(){var A=arguments.callee.prototype.apply(this,[]);this.iframe=document.createElement("iframe");this.iframe.style.width=this.iframe.style.height="100%";this.iframe.marginHeight=this.iframe.marginWidth=0;this.iframe.style.border=this.iframe.frameBorder=0;this.iframe.allowTransparency=true;this.iframe.src="about:blank";this.iframe.scrolling="no";this.iframe.setAttribute("id",this.getId()+"_iframe");Event.addListener(this.iframe,"load",this.onIframeLoad);A.appendChild(this.iframe);return A});this.onIframeLoad=callback(this,function(){Event.removeListener(this.iframe,"load",this.onIframeLoad);this.initDesignMode();this.setTransparentBackground()});this.onMouseEvent=callback(this,function(){this.range=this.getSelectionRange();this.notifySelectionChange.send(this)});this.onKeyboardEvent=callback(this,function(A){if(A.type=="keyup"){switch(A.keyCode){case core.ui.Event.KEY_LEFT_ARROW:case core.ui.Event.KEY_RIGHT_ARROW:case core.ui.Event.KEY_UP_ARROW:case core.ui.Event.KEY_DOWN_ARROW:case core.ui.Event.KEY_HOME:case core.ui.Event.KEY_END:case core.ui.Event.KEY_PAGE_UP:case core.ui.Event.KEY_PAGE_DOWN:this.onMouseEvent();break}}});this.setTransparentBackground=callback(this,function(){var A;if(!(A=this.document.getElementsByTagName("body")[0])){window.setTimeout(this.setTransparentBackground,250);return }else{A.style.backgroundColor="transparent"}})}}ClassFactory.createPackage("editor.plugins.text");ClassFactory.createClass(editor.plugins.text,"EditTextBoxCommand");with(editor.plugins.text){editor.plugins.text.EditTextBoxCommand.superClass=editor.commands.AbstractCommand;editor.plugins.text.EditTextBoxCommand.constructor=function(){this.EditTextBoxCommand=function(B,A){arguments.callee.prototype.apply(this,[B,A]);this.previousText=B.getText();this.wasModified=B.isModified()};this.setText=function(A){this.textToSet=A};this.execute=function(){this.target.setText(this.textToSet);this.target.setModified(true)};this.unexecute=function(){this.target.setText(this.previousText);this.target.setModified(this.wasModified)}}}ClassFactory.createPackage("editor.commands");ClassFactory.createClass(editor.commands,"EditBackgroundColorCommand");with(editor.commands){editor.commands.EditBackgroundColorCommand.superClass=editor.commands.AbstractCommand;editor.commands.EditBackgroundColorCommand.constructor=function(){this.initialState={};this.finalState={};this.EditBackgroundColorCommand=function(B,A){arguments.callee.prototype.apply(this,[B,A]);this.saveInitialState()};this.saveInitialState=function(){this.initialState={color:this.target.getBackgroundColor(),modified:this.target.isModified()}};this.execute=function(){if(defined(this.finalState.color)){this.target.setBackgroundColor(this.finalState.color)}this.target.setModified(true)};this.unexecute=function(){this.target.setBackgroundColor(this.initialState.color);this.target.setModified(this.initialState.modified)};this.setBackgroundColor=function(A){this.finalState.color=A}}}ClassFactory.createPackage("editor.plugins.text");ClassFactory.createClass(editor.plugins.text,"TextBoxEditor");with(editor.plugins.text){editor.plugins.text.TextBoxEditor.superClass=core.ui.HtmlEditor;editor.plugins.text.TextBoxEditor.constructor=function(){this.initDesignMode=override(this.initDesignMode,function(){arguments.callee.prototype.apply(this,[]);var B=["keyup","keypress","input","change","selectionchange"];for(var A=0;A<B.length;A++){core.ui.Event.addListener(this.getDocument(),B[A],this.onDocumentChange)}});this.execCommand=override(this.execCommand,function(A,B){arguments.callee.prototype.apply(this,[A,B]);this.updateFocus()});this.setTextBox=function(A){this.textbox=A};this.undo=override(this.undo,function(){this.range="";var E=this.getFontFace();var D=this.getFontSize();var F=this.getForeColor();var A=this.isBold();var C=this.isItalic();var B=this.isUnderline();arguments.callee.prototype.apply(this,[]);this.setTextStyles(E,D,F,A,C,B);this.notifySelectionChange.send(this);if(!this.isEmpty()){this.select()}});this.edit=function(A){if(this.textbox!=A){this.setTextBox(A)}this.move(A.getX(),A.getY());this.resize(A.getWidth(),A.getHeight());this.updateStyle();this.setText(A.getText());this.activate();this.show();this.select()};this.select=function(){this.range="";this.selectedText=this.getText();this.execCommand("selectall");this.notifySelectionChange.send(this)};this.clear=function(){this.execCommand("selectall");var E=this.getFontFace();var D=this.getFontSize();var F=this.getForeColor();var A=this.isBold();var C=this.isItalic();var B=this.isUnderline();this.execCommand("delete");this.setTextStyles(E,D,F,A,C,B);this.notifySelectionChange.send(this);this.selectedText="";this.range=""};this.setTextStyles=function(E,C,A,B,D,F){this.setFontFace(E);this.setFontSize(C);this.setForeColor(A);if(B){this.setBold(B)}if(D){this.setItalic()}if(F){this.setUnderline()}};this.updateFocus=function(){window.setTimeout(callback(this,function(){this.iframe.contentWindow.focus()}),0)};this.updateStyle=function(){this.setStyle("background-color",this.textbox.getBackgroundColor());this.setStyle("border-width",this.textbox.getBorderWidth());this.setStyle("border-style",this.textbox.getBorderStyle());this.setStyle("border-color",this.textbox.getBorderColor())};this.updateLayout=function(){var A=this.getDocument().body.scrollHeight;this.setStyle("height",A+"px");this.textbox.setStyle("height",A+"px");editor.ui.SelectionManager.get().getSelection(this.textbox).updateLayout()};this.editText=function(){if(this.getText().replace(/<!--.*-->/g,"")==this.textbox.getText()){return }var A=new EditTextBoxCommand(this.textbox,"Change text");A.setText(this.getText());editor.commands.CommandHistory.get().execute(A)};this.setBackgroundColor=function(A){var B=new editor.commands.EditBackgroundColorCommand(this.textbox,"Change text box color");B.setBackgroundColor(A);editor.commands.CommandHistory.get().execute(B);this.setStyle("background-color",A)};this.setBorderColor=function(B){var A=new editor.commands.EditBorderCommand(this.textbox,"Change border color");A.setBorderColor(B);editor.commands.CommandHistory.get().execute(A);this.setStyle("border-color",B)};this.setBorderWidth=function(A){var B=new editor.commands.EditBorderCommand(this.textbox,"Change border width");B.setBorderWidth(A);editor.commands.CommandHistory.get().execute(B);this.setStyle("border-width",A)};this.setBorderStyle=function(A){var B=new editor.commands.EditBorderCommand(this.textbox,"Change border style");B.setBorderStyle(A);editor.commands.CommandHistory.get().execute(B);this.setStyle("border-style",A)};this.setBorder=function(C,B,A){var D=new editor.commands.EditBorderCommand(this.textbox,"Change border of text box");D.setBorder(C,B,A);editor.commands.CommandHistory.get().execute(D);this.setStyle("border-width",C);this.setStyle("border-style",B);this.setStyle("border-color",A)};this.isAllSelected=function(){var B=(this.getText()==this.selectedText&&this.getText()!="");var A=this.getText().replace(/(\s+)|(<.+?>)/g,"")==this.getSelectedText().replace(/(\s+)|(<.+?>)/g,"");return(B||A)};this.isEmpty=function(){return this.getText().replace(/(&nbsp;)|(\s+)|(<.+?>)/g,"")==""};this.onKeyboardEvent=callback(this,override(this.onKeyboardEvent,function(B){arguments.callee.prototype.apply(this,[B]);if(B.type=="keydown"){B=core.ui.Event.improve(B);if(B.ctrlKey){var A=B.getChar();switch(A){case"A":B.cancel();this.select();return false;case"Y":B.cancel();this.redo();return false;case"Z":B.cancel();this.undo();return false}}else{if(core.ui.Event.KEY_DELETE==B.keyCode){if(this.isEmpty()){B.cancel();this.range="";return false}if(this.isAllSelected()){B.cancel();this.range="";this.clear()}this.updateFocus()}else{if(48<=B.keyCode){if(this.isAllSelected()&&!this.isEmpty()){this.clear();this.updateFocus()}this.range=""}else{if(this.isEmpty()){B.cancel();return false}}}}this.selectedText=""}}));this.onMouseEvent=callback(this,override(this.onMouseEvent,function(A){arguments.callee.prototype.apply(this,[]);if(defined(A)&&defined(A.type)&&(A.type=="mousedown")){this.selectedText=""}}));this.onDocumentChange=callback(this,function(A){core.ui.Event.improve(A);this.updateLayout()})}}ClassFactory.createPackage("editor.plugins.text");ClassFactory.createClass(editor.plugins.text,"TextBoxPanel");with(editor.plugins.text){editor.plugins.text.TextBoxPanel.superClass=core.ui.Window;editor.plugins.text.TextBoxPanel.constructor=function(){this.textbox;this.editMode=false;this.editor;this.controlGroupWindow;this.fontFaceList;this.fontSizeList;this.colorPicker;this.boldButton;this.italicButton;this.underlineButton;this.leftAlignButton;this.centerAlignButton;this.rightAlignButton;this.indentButton;this.outdentButton;this.aboveButton;this.underButton;this.backButton;this.frontButton;this.undoButton;this.redoButton;this.hyperlinkButton;this.fillButton;this.borderButton;this.samplesButton;this.fillMenu;this.borderMenu;this.colorSubmenu;this.notifyLoaded=new core.ui.Notification();this.notifySavePage=new core.ui.Notification();with(editor.ui){this.TextBoxPanel=function(parent){arguments.callee.prototype.apply(this,[parent]);this.deferredInit()};this.deferredInit=callback(this,function(){switch(this.initStep){case undefined:this.initStep=0;case 0:this.createProgress();break;case 1:this.editor=new TextBoxEditor();this.editor.move(0,0);this.editor.resize(0,0);this.editor.notifySelectionChange.addListener(this.onEditorSelectionChange);break;case 2:this.controlGroupWindow=new core.ui.Window(this);this.controlGroupWindow.setStyleId("textbox-panel-control-group");this.controlGroupWindow.hide();break;case 3:this.fontFaceList=new core.ui.ComboBox(this.controlGroupWindow);this.fontFaceList.setStyleId("textbox-panel-list-font-family");this.fontFaceList.setStyle("position","absolute");this.fontFaceList.setToolTip("Select font face");this.fontFaceList.notifyValueChanged.addListener(this.onFontFamilyChange);var fontFaces=["Times New Roman","Arial","Verdana","Courier","Georgia","Tahoma"];for(var i=0;i<fontFaces.length;i++){this.fontFaceList.addItem(fontFaces[i],fontFaces[i],(fontFaces[i]=="Times New Roman")?true:false)}break;case 4:this.fontSizeList=new core.ui.ComboBox(this.controlGroupWindow);this.fontSizeList.setStyleId("textbox-panel-list-font-size");this.fontSizeList.setStyle("position","absolute");this.fontSizeList.setToolTip("Select font size");this.fontSizeList.notifyValueChanged.addListener(this.onFontSizeChange);var fontSizes={"1":"8","2":"10","3":"12","4":"14","5":"18","6":"24","7":"26"};for(var size in fontSizes){this.fontSizeList.addItem(fontSizes[size],size,(size==3)?true:false)}break;case 5:this.colorPicker=new ColorPicker(this.controlGroupWindow);this.colorPicker.setStyleId("textbox-panel-color-picker");this.colorPicker.setStyle("position","absolute");this.colorPicker.applyButton.setImageList("images/TextBox/color-left.gif");this.colorPicker.applyButton.setToolTip("Font color");this.colorPicker.pickButton.setImageList("images/TextBox/color-right.gif");this.colorPicker.pickButton.setToolTip("Pick font color");this.colorPicker.setColor("000000");this.colorPicker.colorSubmenu.transpColor.setStyle("display","none");this.colorPicker.notifyColorSelected.addListener(this.onTextColorChange);break;case 6:this.boldButton=new editor.ui.ToggleButton(this.controlGroupWindow);this.boldButton.setStyleId("textbox-panel-button-style-bold");this.boldButton.setStyle("position","absolute");this.boldButton.setImageList("images/TextBox/bold.gif");this.boldButton.setToolTip("Bold");this.boldButton.oncommand=this.onStyleBoldButtonClick;this.boldButton.setEnabled(false);break;case 7:this.italicButton=new editor.ui.ToggleButton(this.controlGroupWindow);this.italicButton.setStyleId("textbox-panel-button-style-italic");this.italicButton.setStyle("position","absolute");this.italicButton.setImageList("images/TextBox/italic.gif");this.italicButton.setToolTip("Italic");this.italicButton.oncommand=this.onStyleItalicButtonClick;break;case 8:this.underlineButton=new editor.ui.ToggleButton(this.controlGroupWindow);this.underlineButton.setStyleId("textbox-panel-button-style-underline");this.underlineButton.setStyle("position","absolute");this.underlineButton.setImageList("images/TextBox/underline.gif");this.underlineButton.setToolTip("Underline");this.underlineButton.oncommand=this.onStyleUnderlineButtonClick;break;case 9:this.leftAlignButton=new editor.ui.SealButton(this.controlGroupWindow);this.leftAlignButton.setStyleId("textbox-panel-button-align-left");this.leftAlignButton.setStyle("position","absolute");this.leftAlignButton.setImageList("images/TextBox/left.gif");this.leftAlignButton.setToolTip("Left align");this.leftAlignButton.oncommand=this.onAlignLeftButtonClick;break;case 10:this.centerAlignButton=new editor.ui.SealButton(this.controlGroupWindow);this.centerAlignButton.setStyleId("textbox-panel-button-align-center");this.centerAlignButton.setStyle("position","absolute");this.centerAlignButton.setImageList("images/TextBox/center.gif");this.centerAlignButton.setToolTip("Center align");this.centerAlignButton.oncommand=this.onAlignCenterButtonClick;break;case 11:this.rightAlignButton=new editor.ui.SealButton(this.controlGroupWindow);this.rightAlignButton.setStyleId("textbox-panel-button-align-right");this.rightAlignButton.setStyle("position","absolute");this.rightAlignButton.setImageList("images/TextBox/right.gif");this.rightAlignButton.setToolTip("Right align");this.rightAlignButton.oncommand=this.onAlignRightButtonClick;break;case 12:this.hyperlinkButton=new core.ui.ImageButton(this.controlGroupWindow);this.hyperlinkButton.setStyleId("textbox-panel-button-link");this.hyperlinkButton.setStyle("position","absolute");this.hyperlinkButton.setToolTip("Set hyperlink");this.hyperlinkButton.setImageList("images/TextBox/link.gif");this.hyperlinkButton.oncommand=this.onLinkButtonClick;break;case 13:this.indentButton=new core.ui.ImageButton(this.controlGroupWindow);this.indentButton.setStyleId("textbox-panel-button-indent");this.indentButton.setStyle("position","absolute");this.indentButton.setImageList("images/TextBox/indent.gif");this.indentButton.setToolTip("Indent text");this.indentButton.oncommand=this.onIndentButtonClick;break;case 14:this.outdentButton=new core.ui.ImageButton(this.controlGroupWindow);this.outdentButton.setStyleId("textbox-panel-button-outdent");this.outdentButton.setStyle("position","absolute");this.outdentButton.setImageList("images/TextBox/outdent.gif");this.outdentButton.setToolTip("Outdent text");this.outdentButton.oncommand=this.onOutdentButtonClick;break;case 15:this.undoButton=new core.ui.ImageButton(this.controlGroupWindow);this.undoButton.setStyleId("textbox-panel-button-undo");this.undoButton.setStyle("position","absolute");this.undoButton.setImageList("images/TextBox/undo.gif");this.undoButton.setToolTip("Undo changes");this.undoButton.oncommand=this.onUndoButtonClick;break;case 16:this.redoButton=new core.ui.ImageButton(this.controlGroupWindow);this.redoButton.setStyleId("textbox-panel-button-redo");this.redoButton.setStyle("position","absolute");this.redoButton.setImageList("images/TextBox/redo.gif");this.redoButton.setToolTip("Redo changes");this.redoButton.oncommand=this.onRedoButtonClick;break;case 17:this.frontButton=new core.ui.ImageButton(this.controlGroupWindow);this.frontButton.setStyleId("textbox-panel-button-front");this.frontButton.setStyle("position","absolute");this.frontButton.setImageList("images/TextBox/front.gif");this.frontButton.setToolTip("Bring to front");this.frontButton.oncommand=this.onFrontButtonClick;break;case 18:this.backButton=new core.ui.ImageButton(this.controlGroupWindow);this.backButton.setStyleId("textbox-panel-button-back");this.backButton.setStyle("position","absolute");this.backButton.setImageList("images/TextBox/back.gif");this.backButton.setToolTip("Send to back");this.backButton.oncommand=this.onBackButtonClick;break;case 19:this.aboveButton=new core.ui.ImageButton(this.controlGroupWindow);this.aboveButton.setStyleId("textbox-panel-button-above");this.aboveButton.setStyle("position","absolute");this.aboveButton.setImageList("images/TextBox/above.gif");this.aboveButton.setToolTip("Bring above object");this.aboveButton.oncommand=this.onAboveButtonClick;break;case 20:this.underButton=new core.ui.ImageButton(this.controlGroupWindow);this.underButton.setStyleId("textbox-panel-button-under");this.underButton.setStyle("position","absolute");this.underButton.setImageList("images/TextBox/under.gif");this.underButton.setToolTip("Send under object");this.underButton.oncommand=this.onUnderButtonClick;break;case 21:this.fillButton=new MenuButton(this);this.fillButton.addStyleName("ColorButton");this.fillButton.setImageList("images/TextBox/menu.gif");this.fillButton.setText("Text box color");this.fillButton.setToolTip("Load fill color");this.fillButton.setIcon("images/icon/fill.png");this.fillButton.oncommand=this.onFillButtonClick;this.fillButton.hide();break;case 22:this.borderButton=new SplitButton(this);this.borderButton.setStyleId("textbox-panel-button-border");this.borderButton.setImageList("images/TextBox/border.gif");this.borderButton.setText("Border");this.borderButton.setToolTip("Select border style");this.borderButton.setIcon("images/icon/border.gif");this.borderButton.notifyDefaultAction.addListener(this.onBorderButtonClick);this.borderButton.hide();break;case 23:new Separator(this.controlGroupWindow).apply(this.colorPicker,this.boldButton);new Separator(this.controlGroupWindow).apply(this.underlineButton,this.leftAlignButton);new Separator(this.controlGroupWindow).apply(this.rightAlignButton,this.hyperlinkButton);new Separator(this.controlGroupWindow).apply(this.outdentButton,this.undoButton);new Separator(this.controlGroupWindow).apply(this.redoButton,this.frontButton);break;case 24:this.initFillMenu();break;case 25:this.initBorderMenu();break;default:this.closeProgress();this.controlGroupWindow.show();this.fillButton.show();this.borderButton.show();this.notifyLoaded.send(this);this.updateControls();return }this.setProgress(++this.initStep/25*100);window.setTimeout(this.deferredInit,0)});this.createProgress=function(){this.loadingWindow=new core.ui.Window(this,0,0,"100%","100%");this.loadingWindow.setStyle("position","absolute");this.loadingWindow.setStyle("z-index",this.getStyle("z-index")+100);this.progressBar=new core.ui.ProgressBar(this.loadingWindow);this.progressBar.setItemCount(20);this.progressBar.center()};this.closeProgress=function(){this.loadingWindow.close()};this.setProgress=function(pos){this.progressBar.setPos(pos)};this.isLoaded=function(){return(defined(this.initStep)&&this.initStep>=25)};this.setTextBox=function(textbox){this.textbox=textbox;if(defined(this.editor)){this.editor.setTextBox(textbox)}};this.initFillMenu=function(){this.fillMenu=new PopupMenuFrame();var menu=new PopupMenu(this.fillMenu);this.colorSubmenu=menu.createSubMenu(null,ColorMenu);this.colorSubmenu.setText("Textbox color");this.colorSubmenu.notifyColorApplied.addListener(this.onBackgroundColorChange);this.fillMenu.setContentWindow(menu)};this.initBorderMenu=function(){this.borderMenu=new PopupMenuFrame();var menu=new BorderMenu(this.borderMenu);menu.notifyColorSelected.addListener(this.onBorderColorChange);menu.notifyWidthSelected.addListener(this.onBorderWidthChange);menu.notifyStyleSelected.addListener(this.onBorderStyleChange);this.borderMenu.setContentWindow(menu);this.borderButton.setPopupMenu(this.borderMenu)};this.setEditMode=function(mode,isEscPressed){if(!((this.textbox&&(this.textbox.constructor===TextBox||defined(this.textbox.constructor.isSubclassOf)&&this.textbox.constructor.isSubclassOf(TextBox))))||!((this.editor&&(this.editor.constructor===TextBoxEditor||defined(this.editor.constructor.isSubclassOf)&&this.editor.constructor.isSubclassOf(TextBoxEditor))))){return }var selections=editor.ui.SelectionManager.get();if((mode==this.editMode)||!selections.hasSelection(this.textbox)){return }this.onEditorSelectionChange();this.editMode=mode;this.updateControls();isEscPressed=defined(isEscPressed)?isEscPressed:false;if(this.editMode){if(selections.isSelected(this.textbox)){this.textbox.hide();this.editor.edit(this.textbox);core.ui.Window.registerDocument(this.editor.document);theApp.getWorkspace().selection.detachGlobalEvent("keydown");this.attachGlobalEvent("keydown");selections.getSelection(this.textbox).addSelectionListener(this)}}else{this.editor.editText();core.ui.Window.unregisterDocument(this.editor.document);this.editor.hide();this.editor.move(0,0);this.editor.resize(0,0);if(this.textbox.isEmpty()){if(isEscPressed){selections.removeSelection(this.textbox)}theApp.collection.excludeElement(this.textbox)}else{this.detachGlobalEvent("keydown");theApp.getWorkspace().selection.detachGlobalEvent("keydown");this.textbox.show();var panel=theApp.factory.getWorkspacePanel().getContentWindow()}}};this.getEditMode=function(){return this.editMode};this.updateTextBox=function(){this.textbox.setText(this.editor.getText())};this.updateControls=function(){if(this.isLoaded()){this.controlGroupWindow.setEnabled(this.editMode);this.underButton.setEnabled(true);this.aboveButton.setEnabled(true);this.backButton.setEnabled(true);this.frontButton.setEnabled(true);if(this.editMode){this.hyperlinkButton.setEnabled(this.editor.getSelectedText().length>0)}}};this.onElementUnselected=function(){this.setEditMode(false)};this.onLinkButtonClick=callback(this,function(){if(this.editMode){var text=this.editor.getSelectedText();var frame=theApp.factory.getUrlDialog();frame.setTitle("Hyperlink information");frame.getContentWindow().notifySetUrl.addListener(this.onCreateLink,true);frame.getContentWindow().notifyCancel.addListener(this.onCancelLinkDialog,true);frame.getContentWindow().reset();frame.center();frame.doModal()}});this.onFillButtonClick=callback(this,function(){if(this.fillMenu.isPopup()){this.fillMenu.endPopup()}else{this.colorSubmenu.setColor(this.textbox.getBackgroundColor());this.fillMenu.doPopupNear(this.fillButton)}});this.onStyleBoldButtonClick=callback(this,function(){this.editor.setBold()});this.onStyleItalicButtonClick=callback(this,function(){this.editor.setItalic()});this.onStyleUnderlineButtonClick=callback(this,function(){this.editor.setUnderline()});this.onAlignLeftButtonClick=callback(this,function(){this.editor.justifyLeft()});this.onAlignCenterButtonClick=callback(this,function(){this.editor.justifyCenter()});this.onAlignRightButtonClick=callback(this,function(){this.editor.justifyRight()});this.onIndentButtonClick=callback(this,function(){this.editor.indent()});this.onOutdentButtonClick=callback(this,function(){this.editor.outdent()});this.onUndoButtonClick=callback(this,function(){this.editor.undo();this.updateControls()});this.onRedoButtonClick=callback(this,function(){this.editor.redo();this.updateControls()});this.onUnderButtonClick=callback(this,function(){var collection=editor.Application.getInstance().getCollection();collection.moveToBack(this.textbox,collection.getElementCount());this.editor.updateFocus()});this.onAboveButtonClick=callback(this,function(){var collection=editor.Application.getInstance().getCollection();collection.moveToFront(this.textbox,collection.getElementCount());this.editor.updateFocus()});this.onBackButtonClick=callback(this,function(){theApp.collection.moveToBack(this.textbox,null);this.editor.updateFocus()});this.onFrontButtonClick=callback(this,function(){theApp.collection.moveToFront(this.textbox,null);this.editor.updateFocus()});this.onBorderButtonClick=callback(this,function(){var borderDialog=theApp.factory.getBorderDialog();borderDialog.getContentWindow().notifyApplied.addListener(this.onBorderChanged,true);borderDialog.getContentWindow().notifyCancelled.addListener(this.onBorderCancelled,true);borderDialog.getContentWindow().setBorderParameters(this.textbox.getBorderWidth(),this.textbox.getBorderStyle(),this.textbox.getBorderColor());borderDialog.center();borderDialog.doModal()});this.onEditorSelectionChange=callback(this,function(){var isIE=(navigator.appName=="Microsoft Internet Explorer");var color=this.editor.getForeColor();if(color==""){color="000000"}else{if(isIE){color=core.ui.quirks.ColorFormat.decToHex(color)}}this.colorPicker.setColor(color);var face=this.editor.getFontFace();this.fontFaceList.setValue((face=="")?"Times New Roman":face);var size=this.editor.getFontSize();this.fontSizeList.setValue((size=="")?"3":size);this.boldButton.turn(this.editor.isBold());this.italicButton.turn(this.editor.isItalic());this.underlineButton.turn(this.editor.isUnderline());this.leftAlignButton.turn(this.editor.isJustifiedLeft());this.centerAlignButton.turn(this.editor.isJustifiedCenter());this.rightAlignButton.turn(this.editor.isJustifiedRight());if(this.editor.getSelectedText().length>0!=this.hyperlinkButton.isEnabled()){this.hyperlinkButton.setEnabled(!this.hyperlinkButton.isEnabled())}});this.onFontFamilyChange=callback(this,function(sender,face){this.editor.setFontFace(face)});this.onFontSizeChange=callback(this,function(sender,size){this.editor.setFontSize(size)});this.onBackgroundColorChange=callback(this,function(sender,color){this.editor.setBackgroundColor(color)});this.onTextColorChange=callback(this,function(sender,color){this.editor.setForeColor(color)});this.onTextChange=callback(this,function(sender,html){this.textbox.setText(html)});this.onBorderColorChange=callback(this,function(sender,c){this.editor.setBorderColor(c)});this.onBorderWidthChange=callback(this,function(sender,w){this.editor.setBorderWidth(w)});this.onBorderStyleChange=callback(this,function(sender,s){this.editor.setBorderStyle(s)});this.onBorderChanged=callback(this,function(sender,width,style,color){this.editor.setBorder(width,style,color);theApp.factory.getBorderDialog().endModal()});this.onBorderCancelled=callback(this,function(){theApp.factory.getBorderDialog().endModal()});this.onCancelLinkDialog=callback(this,function(){theApp.factory.getUrlDialog().endModal()});this.onCreateLink=callback(this,function(sender,url){this.editor.createLink(url);theApp.factory.getUrlDialog().endModal()});this.onkeydown=function(event){if(core.ui.Event.KEY_F2==event.keyCode){if(this.editMode){event.cancel();return false}}else{if(core.ui.Event.KEY_ESCAPE==event.keyCode){if(this.editMode){this.setEditMode(false,true);event.cancel()}}}}}}}ClassFactory.createPackage("editor.plugins.text");ClassFactory.createClass(editor.plugins.text,"TextPlugin");with(editor.plugins.text){editor.plugins.text.TextPlugin.constructor=function(){this.TextPlugin=function(){editor.Application.getInstance().addAppListener(this)};this.onAppInitComplete=function(app){var button=new editor.ui.ToolButton(this);button.addStyleName("TextBoxIcon");button.setText("Place text");button.setIcon("images/TextBox/icon.png");button.setToolTip("Create new text box");if(app.config.get("editor.firstRun")){var blocks=app.config.get("page.text");if(blocks){for(var id in blocks){var element=document.getElementById(id);var textBox=TextBox.forElement(element);if((blocks[id].length>0)&&(element)&&((textBox&&(textBox.constructor===TextBox||defined(textBox.constructor.isSubclassOf)&&textBox.constructor.isSubclassOf(TextBox))))){element.innerHTML=blocks[id];textBox.setModified(true)}}}}};this.onAppSaving=function(app,context){this.getPanel().getContentWindow().setEditMode(false);var name=document.getElementById("person.name");if(name){context.set("person.name",name.innerHTML)}};this.onAppPageLoaded=function(app){var element=document.getElementById("person.dates");var dates=TextBox.forElement(element);if((dates&&(dates.constructor===TextBox||defined(dates.constructor.isSubclassOf)&&dates.constructor.isSubclassOf(TextBox)))){var birthDate=common.util.DateUtils.toClientDate(app.config.get("page.birthDate",""));var deathDate=common.util.DateUtils.toClientDate(app.config.get("page.deathDate",""));var text=((birthDate.length>0)&&(deathDate.length>0))?(birthDate+" - "+deathDate):"";if((text.length>0)&&(element.innerHTML!==text)){element.innerHTML=text;dates.setModified(true)}}element=document.getElementById("person.name");var name=TextBox.forElement(element);if((name&&(name.constructor===TextBox||defined(name.constructor.isSubclassOf)&&name.constructor.isSubclassOf(TextBox)))){var personName=app.config.get("page.personName");if(personName!==element.innerHTML){element.innerHTML=app.config.get("page.personName");name.setModified(true)}}};this.onAppModeChanged=function(app){if(app.getMode()===editor.Application.MODE_EDIT){var panel=this.getPanel().getContentWindow();if(panel.isLoaded()){panel.setEditMode(true)}}};this.getPanel=function(){var factory=editor.Application.getInstance().getGuiFactory();return factory.createPanelWithFrame(TextBoxPanel,"Text properties")};this.onToolButtonPressed=this.onToolButtonDropped=function(button,x,y){var text=new TextBox();with(editor.commands){CommandHistory.get().execute(new AddCommand(text,x,y,"Add text"))}text.select();text.activate();text.edit()}}}ClassFactory.createPackage("editor.ui.wizard");ClassFactory.createClass(editor.ui.wizard,"WizardDialog");with(editor.ui.wizard){editor.ui.wizard.WizardDialog.superClass=core.ui.Dialog;editor.ui.wizard.WizardDialog.constructor=function(){this.panes={};this.paneCount=0;this.listeners=new core.util.Listeners();this.WizardDialog=function(parent){arguments.callee.prototype.apply(this,[parent]);with(core.ui){var splitter=new SplitWindow(this,0,0,"100%","100%");this.description=new Static(splitter);this.description.addStyleName("Description");var titlePane=new Window(splitter);titlePane.addStyleName("TitlePane");this.title=new Static(titlePane);this.title.addStyleName("Title");this.contentPane=new Window(splitter);this.contentPane.addStyleName("ContentPane");var buttonsPane=new Window(splitter);buttonsPane.addStyleName("ButtonsPane");this.cancelButton=new ImageButton(buttonsPane);this.cancelButton.addStyleName("CancelButton");this.cancelButton.setImageList("images/Wizard/button.gif");this.cancelButton.setText("Cancel");this.cancelButton.setToolTip("Cancel dialog");this.cancelButton.oncommand=this.onCancelClick;this.cancelButton.setTabIndex(2);this.nextButton=new ImageButton(buttonsPane);this.nextButton.addStyleName("NextButton");this.nextButton.setImageList("images/Wizard/next.gif");this.nextButton.setText("Next");this.nextButton.setTabIndex(1);this.nextButton.oncommand=this.onNextClick;this.backButton=new ImageButton(buttonsPane);this.backButton.addStyleName("BackButton");this.backButton.setImageList("images/Wizard/next.gif");this.backButton.setText("Back");this.backButton.setToolTip("Back to the previous step");this.backButton.setTabIndex(3);this.backButton.oncommand=this.onBackClick;this.skipBox=new CheckBox(buttonsPane);this.skipBox.setText("Skip this wizard");this.skipBox.onclick=this.onSkipClick;splitter.addPane(this.description,SplitWindow.SPLIT_RIGHT);splitter.addPane(titlePane,SplitWindow.SPLIT_TOP);splitter.addPane(this.contentPane,SplitWindow.SPLIT_TOP);splitter.addPane(buttonsPane,SplitWindow.SPLIT_FILL)}};this.addWizardListener=function(listener){this.listeners.add(listener)};this.removeWizardListener=function(listener){this.listeners.remove(listener)};this.reset=function(){for(var id in this.panes){this.panes[id].reset()}this.updateControls()};this.getContentPane=function(){return this.contentPane};this.getDescriptionPane=function(){return this.description};this.updateControls=function(){if(this.currentPane.getNextPaneId()&&!(this.currentPane.canSkip()&&this.skipBox.isChecked())){this.nextButton.setText("Next");this.nextButton.setToolTip("Go to the next step")}else{this.nextButton.setText("Finish");this.nextButton.setToolTip("Finish dialog")}this.backButton.setVisible(null!==this.currentPane.getPrevPaneId());this.skipBox.setVisible(this.currentPane.canSkip())};this.setCurrentPane=function(id){if((this.currentPane&&(this.currentPane.constructor===WizardPane||defined(this.currentPane.constructor.isSubclassOf)&&this.currentPane.constructor.isSubclassOf(WizardPane)))){this.currentPane.setActive(false);this.currentPane.hide()}this.currentPane=this.panes[id];this.title.setText(this.currentPane.getTitle());this.description.setText(this.currentPane.getText());this.currentPane.show();this.currentPane.setActive(true);this.updateControls()};this.getCurrentPane=function(){return this.currentPane};this.setPane=function(id,pane){return this.panes[id]=pane};this.getPane=function(id){return(defined(this.panes[id]))?this.panes[id]:undefined};this.getNextPane=function(){return(this.hasPanes())?this.getPane(this.getCurrentPane().getNextPaneId()):undefined};this.getPrevPane=function(){return(this.hasPanes())?this.getPane(this.getCurrentPane().getPrevPaneId()):undefined};this.addPane=function(pane){this.setPane(pane.getPaneId(),pane);pane.setStyle("position","absolute");pane.setStyle("width","100%");pane.setStyle("height","100%");pane.hide();this.paneCount++};this.removePane=function(pane){delete this.panes[pane.getPaneId()];pane.close();this.paneCount--};this.hasPanes=function(){return(this.paneCount>0)};this.getPaneCount=function(){return this.paneCount};this.iterator=function(){return new core.util.Iterator(this.panes)};this.getNextButton=function(){return this.nextButton};this.getBackButton=function(){return this.backButton};this.getCancelButton=function(){return this.cancelButton};this.next=function(){if(this.currentPane.canSkip()&&this.skipBox.isChecked()){this.fireSkip()}else{if(this.currentPane.getNextPaneId()){this.fireNext();this.getCurrentPane().hide();this.setCurrentPane(this.getNextPane().getPaneId())}else{this.fireFinish()}}};this.back=function(){if(this.currentPane.getPrevPaneId()){this.fireBack();this.currentPane.hide();this.setCurrentPane(this.getPrevPane().getPaneId())}};this.cancel=function(){this.fireCancel()};this.fireNext=function(){this.listeners.call("onWizardNext",[this])};this.fireBack=function(){this.listeners.call("onWizardBack",[this])};this.fireCancel=function(){this.listeners.call("onWizardCancel",[this])};this.fireFinish=function(){this.listeners.call("onWizardFinish",[this])};this.fireSkip=function(){this.listeners.call("onWizardSkip",[this])};this.onNextClick=callback(this,function(){if(this.currentPane.validate()){this.next()}});this.onBackClick=callback(this,function(){this.back()});this.onCancelClick=callback(this,function(){this.cancel()});this.onSkipClick=callback(this,function(){this.updateControls()})}}ClassFactory.createPackage("core.flash");ClassFactory.createClass(core.flash,"FlashPlayer");with(core.flash){core.flash.FlashPlayer.constructor=function(){};core.flash.FlashPlayer.getVersion=function(){var B={major:0,minor:0,revision:0};if(defined(navigator.plugins)&&(navigator.mimeTypes.length>0)){var A=navigator.plugins["Shockwave Flash"];if(defined(A)&&defined(A.description)&&A.description.match(/([0-9]+)\.([0-9]+)\s+r([0-9]+)/)){B.major=parseInt(RegExp.$1);B.minor=parseInt(RegExp.$2);B.revision=parseInt(RegExp.$3)}}else{if(defined(window.ActiveXObject)){try{var D=new ActiveXObject("ShockwaveFlash.ShockwaveFlash");var E=D.GetVariable("$version").toString();if(E.match(/([0-9]+),([0-9]+),([0-9]+)/)){B.major=parseInt(RegExp.$1);B.minor=parseInt(RegExp.$2);B.revision=parseInt(RegExp.$3)}}catch(C){}}}return B};core.flash.FlashPlayer.isInstalled=function(B){var A=this.getVersion();if(defined(B)){return((A.major>=B.major)&&(A.minor>=B.minor)&&(A.revision>=B.revision))}else{return(0!=A.major)}}}ClassFactory.createPackage("editor.ui.wizard.panes");ClassFactory.createClass(editor.ui.wizard.panes,"VideoTypePane");with(editor.ui.wizard.panes){editor.ui.wizard.panes.VideoTypePane.superClass=editor.ui.wizard.WizardPane;editor.ui.wizard.panes.VideoTypePane.constructor=function(){this.VideoTypePane=function(wizard){arguments.callee.prototype.apply(this,[wizard,VideoTypePane]);wizard.addWizardListener(this);this.setTitle("Choose video type");if(core.flash.FlashPlayer.isInstalled({major:8,minor:0,revision:0})){this.setText("Choose the type of the new video. If you want to add an existing video to your page, click <b>Embed existing video</b>. If you want to create a slide show using photos from your computer, click <b>Create photo montage</b>.")}else{this.setText('<b class="alert">Warning</b>: To play videos on your page you need to install <a target="_blank" href="http://www.macromedia.com/go/getflashplayer">Flash Player</a> first.')}};this.getSelectedType=function(){return this.selectedType};this.getNextPaneId=function(){if(VideoTypePane.TYPE_EMBED==this.selectedType){return editor.plugins.video.EmbedVideoPane}else{if(VideoTypePane.TYPE_CREATE==this.selectedType){return editor.plugins.tribute.wizard.ChildhoodPhotosPane}}return undefined};this.init=function(){this.uploadButton=new core.ui.ImageButton(this);this.uploadButton.addStyleName("UploadButton");this.uploadButton.setImages("images/VideoWizard/upload-video-normal.png","images/VideoWizard/upload-video-hover.png","images/VideoWizard/upload-video-pressed.png");this.uploadButton.setText("Embed existing video");this.uploadButton.setToolTip("Add existing video to the webpage");this.uploadButton.oncommand=this.onTypeButtonCommand;this.createButton=new core.ui.ImageButton(this);this.createButton.addStyleName("CreateButton");this.createButton.setImages("images/VideoWizard/create-video-normal.png","images/VideoWizard/create-video-hover.png","images/VideoWizard/create-video-pressed.png");this.createButton.setText("Create photo montage");this.createButton.setToolTip("Create new video from photos of deceased");this.createButton.oncommand=this.onTypeButtonCommand};this.setActive=function(active){this.getWizard().getNextButton().setVisible(!active)};this.onTypeButtonCommand=callback(this,function(event,target,button){this.selectedType=(this.uploadButton==button)?VideoTypePane.TYPE_EMBED:VideoTypePane.TYPE_CREATE;this.getWizard().next()});this.onWizardNext=function(wizard){if((this==wizard.getCurrentPane())&&!defined(wizard.getNextPane())){with(editor.plugins){if(VideoTypePane.TYPE_EMBED==this.selectedType){wizard.addPane(new video.EmbedVideoPane(wizard))}else{if(VideoTypePane.TYPE_CREATE==this.selectedType){wizard.addPane(new tribute.wizard.ChildhoodPhotosPane(wizard))}}}}}};editor.ui.wizard.panes.VideoTypePane.TYPE_EMBED=1;editor.ui.wizard.panes.VideoTypePane.TYPE_CREATE=2}ClassFactory.createPackage("editor.ui.wizard");ClassFactory.createClass(editor.ui.wizard,"VideoWizardDialog");with(editor.ui.wizard){editor.ui.wizard.VideoWizardDialog.superClass=editor.ui.wizard.WizardDialog;editor.ui.wizard.VideoWizardDialog.constructor=function(){this.VideoWizardDialog=function(parent){arguments.callee.prototype.apply(this,[parent]);with(editor.ui.wizard.panes){this.addPane(new VideoTypePane(this));this.setCurrentPane(VideoTypePane)}}}}ClassFactory.createPackage("editor.plugins.video");ClassFactory.createClass(editor.plugins.video,"EmbedVideoSelection");with(editor.plugins.video){editor.plugins.video.EmbedVideoSelection.superClass=editor.ui.ProportionalSelection;editor.plugins.video.EmbedVideoSelection.constructor=function(){this.EmbedVideoSelection=function(B){arguments.callee.prototype.apply(this,[B]);var A=new editor.ui.SelectionMenuBuilder(B);A.buildDeleteIcon();this.setMenu(A.getMenu())}}}ClassFactory.createPackage("editor.plugins.video");ClassFactory.createClass(editor.plugins.video,"EmbedVideoBox");with(editor.plugins.video){editor.plugins.video.EmbedVideoBox.superClass=editor.elements.PageElement;editor.plugins.video.EmbedVideoBox.constructor=function(){this.embedURL="";this.flashVars="";this.suppressPane;this.EmbedVideoBox=function(root){arguments.callee.prototype.apply(this,[root,"Video"])};this.setMovieUrl=function(url,flashVars){this.movieUrl=url;this.flashVars=flashVars;if((this.suppressPane&&(this.suppressPane.constructor===core.ui.Window||defined(this.suppressPane.constructor.isSubclassOf)&&this.suppressPane.constructor.isSubclassOf(core.ui.Window)))){this.suppressPane.close()}this.setText(this.getEmbedTag());this.suppressPane=this.createSuppressPane();this.updateControls()};this.setEnabled=override(this.setEnabled,function(e){arguments.callee.prototype.apply(this,[e]);this.updateControls()});this.updateControls=function(){if((this.suppressPane&&(this.suppressPane.constructor===core.ui.Window||defined(this.suppressPane.constructor.isSubclassOf)&&this.suppressPane.constructor.isSubclassOf(core.ui.Window)))){if(this.isEnabled()){this.suppressPane.show();this.suppressPane.activate()}else{this.suppressPane.hide()}}};this.getEmbedTag=function(){with(core.html){var tag=new Tag("object",{"type":"application/x-shockwave-flash","classid":"clsid:d27cdb6e-ae6d-11cf-96b8-444553540000","width":"100%","height":"100%"});tag.addContent(new Tag("param",{"name":"movie","value":this.movieUrl}));tag.addContent(new Tag("param",{"name":"wmode","value":"transparent"}));tag.addContent(new Tag("param",{"name":"flashvars","value":this.flashVars}));tag.addContent(new Tag("embed",{"src":this.movieUrl,"type":"application/x-shockwave-flash","wmode":"transparent","width":"100%","height":"100%","flashvars":this.flashVars}));return tag}};this.createSuppressPane=function(){var pane=new core.ui.Window(this,0,0,"100%","100%");pane.setStyle("position","absolute");pane.setStyleName("SuppressPane");return pane};this.load=override(this.load,function(root){arguments.callee.prototype.apply(this,[root]);if(this.isInEditMode()){this.setMovieUrl(root.getAttribute("movieUrl"),root.getAttribute("flashVars"))}});this.getHtmlTag=override(this.getHtmlTag,function(){var tag=arguments.callee.prototype.apply(this,[]);tag.setAttribute("movieUrl",this.movieUrl);tag.setAttribute("flashVars",this.flashVars);tag.setContent(this.getEmbedTag());return tag});this.onModeChanged=callback(this,function(){this.updateControls()});this.createSelection=function(){return new EmbedVideoSelection(this)}}}ClassFactory.createPackage("editor.plugins.video");ClassFactory.createClass(editor.plugins.video,"EmbedVideoPane");with(editor.plugins.video){editor.plugins.video.EmbedVideoPane.superClass=editor.ui.wizard.WizardPane;editor.plugins.video.EmbedVideoPane.constructor=function(){this.EmbedVideoPane=function(A){arguments.callee.prototype.apply(this,[A,EmbedVideoPane]);this.setTitle("Use existing video");this.setText("You can embed a video into your webpage by copying this video's <b>embed string</b> provided by video service. We are currently supporting the following video services: <b>YouTube</b>, <b>PhotoBucket</b>, <b>Yahoo</b>, and <b>Google Video</b>. You can try to use other such services as well since they also should work.");this.setPrevPaneId(editor.ui.wizard.panes.VideoTypePane)};this.getMovieParams=function(){var A,B,C,E,D=this.embedField.getText();if(D.match(/src=[\'\"](.*?)[\'\"]/img)){A=RegExp.$1}if(D.match(/width=[\'\"](.*?)[\'\"]/img)||D.match(/width\s*:\s*(\d+)/img)){B=parseInt(RegExp.$1)}if(D.match(/height=[\'\"](.*?)[\'\"]/img)||D.match(/height\s*:\s*(\d+)/img)){C=parseInt(RegExp.$1)}if(D.match(/flashvars=[\'\"](.*?)[\'\"]/img)){E=RegExp.$1}if(A&&B&&C){return{"url":A,"width":B,"height":C,"flashVars":E}}return null};this.setStatusMessage=function(A){this.status.setText(A)};this.reset=function(){this.getWizard().getNextButton().enable()};this.init=function(){var A=new core.ui.Static(this);A.addStyleName("EmbedTitle");A.setText("Please paste an embed string provided by video service:");this.embedField=new core.ui.TextArea(this);this.embedField.addStyleName("EmbedField");this.status=new core.ui.Static(this);this.status.addStyleName("Notice")};this.setActive=function(A){if(A){this.status.setText("")}else{this.reset()}}}}ClassFactory.createPackage("editor.plugins.tribute");ClassFactory.createClass(editor.plugins.tribute,"Video");with(editor.plugins.tribute){editor.plugins.tribute.Video.constructor=function(){this.autoStart=false;this.scenes=[];this.sounds=[];this.periodPhotosCounter=[0,0,0,0];this.addScene=function(A){this.scenes.push(A)};this.removeScene=function(A){this.scenes.splice(A,1)};this.getScene=function(A){return this.scenes[A]};this.hasScenes=function(){for(var A=0;A<this.scenes.length;A++){if(this.scenes[A].hasImage()){return true}}return false};this.addSound=function(A){this.sounds.push(A)};this.removeSound=function(A){this.sounds.splice(A,1)};this.getSound=function(A){return this.sounds[A]};this.setAutoStart=function(A){this.autoStart=(A)?true:false};this.isAutoStart=function(){return(this.autoStart)?true:false};this.clear=function(){this.autoStart=false;while(this.scenes.length>0){this.scenes.pop()}while(this.sounds.length>0){this.sounds.pop()}};this.serialize=function(){var B=[];if(this.autoStart){B.push("autoStart=1")}for(var C=0;C<this.scenes.length;C++){var E=this.scenes[C];var H=C+1;if(E.hasImage()){B.push("sc"+H+"="+encodeURIComponent(E.getImage()));B.push("d"+H+"="+Math.ceil(E.getDuration()));B.push("f"+H+"="+E.getFadingType());var F=E.getStartView();var A=E.getEndView();B.push("sx"+H+"="+Math.ceil(F.getCenterX()));B.push("sy"+H+"="+Math.ceil(F.getCenterY()));B.push("sz"+H+"="+F.getZoom());B.push("ex"+H+"="+Math.ceil(A.getCenterX()));B.push("ey"+H+"="+Math.ceil(A.getCenterY()));B.push("ez"+H+"="+A.getZoom());var G=E.getSubtitles();B.push("txt"+H+"="+encodeURIComponent(G.getText()));B.push("ts"+H+"="+G.getSize());if(G.isBold()){B.push("b"+H+"=1")}if(G.isItalic()){B.push("i"+H+"=1")}if(G.isUnderline()){B.push("u"+H+"=1")}}}for(var C=0;C<this.sounds.length;C++){var D=this.sounds[C];var H=C+1;if(D.hasFile()){B.push("sn"+H+"="+encodeURIComponent(D.getFile()));B.push("sd"+H+"="+Math.ceil(D.getDuration()));if(D.isCyclic()){B.push("cy"+H+"=1")}}}return B.join("&")};this.unserialize=function(C){this.clear();var G={};var B=C.split("&");for(var A=0;A<B.length;A++){var F=B[A].split("=");if(F.length>0){G[F[0]]=F[1]}}if(1==G["autoStart"]){this.autoStart=true}var H=1;while(defined(G["sc"+H])){var E=new Scene(decodeURIComponent(G["sc"+H]));if(defined(G["d"+H])){E.setDuration(parseInt(G["d"+H]))}if(defined(G["f"+H])){E.setFadingType(parseInt(G["f"+H]))}if(defined(G["sx"+H])&&defined(G["sy"+H])){E.getStartView().center(parseInt(G["sx"+H]),parseInt(G["sy"+H]))}if(defined(G["sz"+H])){E.getStartView().setZoom(parseInt(G["sz"+H]))}if(defined(G["ex"+H])&&defined(G["ey"+H])){E.getEndView().center(parseInt(G["ex"+H]),parseInt(G["ey"+H]))}if(defined(G["ez"+H])){E.getEndView().setZoom(parseInt(G["ez"+H]))}if(defined(G["txt"+H])){E.getSubtitles().setText(decodeURIComponent(G["txt"+H]))}if(defined(G["b"+H])){E.getSubtitles().setBold(G["b"+H]?true:false)}if(defined(G["i"+H])){E.getSubtitles().setItalic(G["i"+H]?true:false)}if(defined(G["u"+H])){E.getSubtitles().setUnderline(G["u"+H]?true:false)}if(defined(G["ts"+H])){E.getSubtitles().setSize(parseInt(G["ts"+H]))}if(defined(G["tc"+H])){E.getSubtitles().setColor(G["tc"+H])}if(defined(G["fn"+H])){E.getSubtitles().setFont(G["fn"+H])}this.addScene(E);H++}H=1;while(defined(G["sn"+H])){var D=new Sound(decodeURIComponent(G["sn"+H]));if(defined(G["sd"+H])){D.setDuration(parseInt(G["sd"+H]))}if(defined(G["cy"+H])){D.setCyclic(G["cy"+H]?true:false)}this.addSound(D);H++}};this.clone=function(){var C=new Video();for(var B=0;B<this.scenes.length;B++){C.addScene(this.scenes[B].clone())}for(var A=0;A<this.sounds.length;A++){C.addSound(this.sounds[A].clone())}C.setAutoStart(this.autoStart);return C}}}ClassFactory.createPackage("editor.plugins.tribute");ClassFactory.createClass(editor.plugins.tribute,"TributeVideoPlayer");with(editor.plugins.tribute){editor.plugins.tribute.TributeVideoPlayer.superClass=core.ui.Window;editor.plugins.tribute.TributeVideoPlayer.constructor=function(){this.notifyStateChange=new core.ui.Notification();this.state=TributeVideoPlayer.STATE_EMPTY;this.video;this.autoStart=false;this.TributeVideoPlayer=function(B,A,F,D,E,C){this.Window(B,A,F,D,E,C);this.attachHandlers();this.setText(this.getHTML());this.setStyle("visibility","visible")};this.load=function(B,A){this.video=B;var C=this.video.serialize();if(this.autoStart=(A)?true:false){C+="&autoStart=1"}this.setState(TributeVideoPlayer.STATE_LOADING);this.externalCall("setVideoData",C)};this.play=function(){if(this.isReady()||this.isComplete()){this.externalCall("startVideo");this.setState(TributeVideoPlayer.STATE_STARTED)}else{console.error("Cannot start video playback: the video is not loaded.")}};this.isLoading=function(){return(TributeVideoPlayer.STATE_LOADING===this.state)?true:false};this.isReady=function(){return(TributeVideoPlayer.STATE_READY===this.state)?true:false};this.isPlaying=function(){return(TributeVideoPlayer.STATE_STARTED===this.state)?true:false};this.isPaused=function(){return(TributeVideoPlayer.STATE_PAUSED===this.state)?true:false};this.isStopped=function(){return(TributeVideoPlayer.STATE_STOPPED===this.state)?true:false};this.isComplete=function(){return(TributeVideoPlayer.STATE_COMPLETE===this.state)?true:false};this.stop=function(){this.externalCall("stopVideo");this.setState(TributeVideoPlayer.STATE_STOPPED)};this.pause=function(A){this.externalCall("pauseVideo",A);this.setState(TributeVideoPlayer.STATE_PAUSED)};this.setState=function(A){this.state=A;this.notifyStateChange.send(this,A)};this.getState=function(){return this.state};this.externalCall=callback(this,function(G,A,D,C){if("object"!==typeof arguments.callee[G]){arguments.callee[G]={"arg":arguments[1],"attempt":1,"total":defined(D)?D:100,"delay":defined(C)?C:100}}var E=arguments.callee[G];try{var B=this.getMovie();if(!defined(B)){throw"Cannot access to flash object via DOM."}if("function"!==typeof B[G]){throw"Cannot use external method: "+G+"."}B[G](E.arg);if(defined(E.timeoutId)){window.clearTimeout(E.timeoutId);E.timeoutId=undefined}delete arguments.callee[G];arguments.callee[G]=undefined}catch(F){if(E.attempt++<E.total){E.timeoutId=window.setTimeout('core.ui.Window.forId("'+this.getId()+'").externalCall("'+G+'")',E.delay)}else{console.warn(F+" Stopping attempts!");delete arguments.callee[G];arguments.callee[G]=undefined}}});this.attachHandlers=function(){if(!defined(window["onTributeVideoLoaded"])){window["onTributeVideoLoaded"]=function(B){var A=core.ui.Window.forId(B);if((A&&(A.constructor===TributeVideoPlayer||defined(A.constructor.isSubclassOf)&&A.constructor.isSubclassOf(TributeVideoPlayer)))){A.onLoad()}}}if(!defined(window["onTributeVideoStarted"])){window["onTributeVideoStarted"]=function(B){var A=core.ui.Window.forId(B);if((A&&(A.constructor===TributeVideoPlayer||defined(A.constructor.isSubclassOf)&&A.constructor.isSubclassOf(TributeVideoPlayer)))){A.onStarted()}}}if(!defined(window["onTributeVideoStopped"])){window["onTributeVideoStopped"]=function(B){var A=core.ui.Window.forId(B);if((A&&(A.constructor===TributeVideoPlayer||defined(A.constructor.isSubclassOf)&&A.constructor.isSubclassOf(TributeVideoPlayer)))){A.onStopped()}}}if(!defined(window["onTributeVideoComplete"])){window["onTributeVideoComplete"]=function(B){var A=core.ui.Window.forId(B);if((A&&(A.constructor===TributeVideoPlayer||defined(A.constructor.isSubclassOf)&&A.constructor.isSubclassOf(TributeVideoPlayer)))){A.onComplete()}}}};this.getHTML=function(){return'<object id="'+this.getId()+'_movie" width="100%" height="100%" type="application/x-shockwave-flash" classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab"><embed name="'+this.getId()+'_movie" width="100%" height="100%" type="application/x-shockwave-flash" src="tribute/video.swf?videoId='+this.getId()+'&onLoad=onTributeVideoLoaded&onStart=onTributeVideoStarted&onStop=onTributeVideoStopped&onComplete=onTributeVideoComplete" allowscriptaccess="sameDomain" wmode="transparent" pluginspage="http://www.macromedia.com/go/getflashplayer"/><param name="movie" value="tribute/video.swf?videoId='+this.getId()+'&onLoad=onTributeVideoLoaded&onStart=onTributeVideoStarted&onStop=onTributeVideoStopped&onComplete=onTributeVideoComplete"/><param name="allowScriptAccess" value="sameDomain"/><param name="wmode" value="transparent"/></object>'};this.getMovie=function(){return defined(window[this.getId()+"_movie"])?window[this.getId()+"_movie"]:document[this.getId()+"_movie"]};this.onLoad=function(){this.setState(TributeVideoPlayer.STATE_READY)};this.onStarted=function(){this.setState(TributeVideoPlayer.STATE_STARTED)};this.onStopped=function(){this.setState(TributeVideoPlayer.STATE_STOPPED)};this.onComplete=function(){this.setState(TributeVideoPlayer.STATE_COMPLETE)}};TributeVideoPlayer.STATE_EMPTY=1;TributeVideoPlayer.STATE_LOADING=2;TributeVideoPlayer.STATE_READY=3;TributeVideoPlayer.STATE_STARTED=4;TributeVideoPlayer.STATE_PAUSED=5;TributeVideoPlayer.STATE_STOPPED=6;TributeVideoPlayer.STATE_COMPLETE=7}ClassFactory.createPackage("editor.plugins.tribute");ClassFactory.createClass(editor.plugins.tribute,"TributeVideoSelection");with(editor.plugins.tribute){editor.plugins.tribute.TributeVideoSelection.superClass=editor.ui.ProportionalSelection;editor.plugins.tribute.TributeVideoSelection.constructor=function(){this.TributeVideoSelection=function(B){arguments.callee.prototype.apply(this,[B]);this.setStyle("z-index",2);var A=new editor.ui.SelectionMenuBuilder(B);A.buildDeleteIcon();A.buildEditIcon();this.setMenu(A.getMenu())};this.updateLayout=override(this.updateLayout,function(){arguments.callee.prototype.apply(this,[]);this.getTarget().updateControls()});this.onEndResize=callback(this,override(this.onEndResize,function(A){this.getTarget().updateControls();arguments.callee.prototype.apply(this,[A])}))}}ClassFactory.createPackage("editor.plugins.tribute.ui");ClassFactory.createClass(editor.plugins.tribute.ui,"TributeVideoCameraViewEditor");with(editor.plugins.tribute.ui){editor.plugins.tribute.ui.TributeVideoCameraViewEditor.superClass=editor.ui.ImageFrame;editor.plugins.tribute.ui.TributeVideoCameraViewEditor.constructor=function(){this.startWindow;this.endWindow;this.startView;this.endView;this.notifyStartZoomChanged=new core.ui.Notification();this.notifyEndZoomChanged=new core.ui.Notification();this.TributeVideoCameraViewEditor=function(A){this.ImageFrame(A);this.background.setStyle("position","absolute");this.background.move(0,0);this.background.setStyle("width","100%");this.background.setStyle("height","100%");this.startWindow=new core.ui.DragWindow(this);this.startWindow.setStyle("position","absolute");this.startWindow.setStyle("background","url(images/TributeVideoCameraViewEditor/start-point.png) no-repeat center center");this.startWindow.notifyDrag.addListener(this.onWindowDrag);this.startWindow.notifyEndDrag.addListener(this.onStartWindowEndDrag);this.endWindow=new core.ui.DragWindow(this);this.endWindow.setStyle("position","absolute");this.endWindow.setStyle("background","url(images/TributeVideoCameraViewEditor/end-point.png) no-repeat center center");this.endWindow.notifyDrag.addListener(this.onWindowDrag);this.endWindow.notifyEndDrag.addListener(this.onEndWindowMoved)};this.setStartView=function(A){this.startView=A;this.updateViews()};this.setEndView=function(A){this.endView=A;this.updateViews()};this.setStartZoom=function(A){this.startView.setZoom(A);this.updateViews()};this.setEndZoom=function(A){this.endView.setZoom(A);this.updateViews()};this.setImage=override(this.setImage,function(A){arguments.callee.prototype.apply(this,[A]);this.updateViews()});this.updateViews=function(){if(defined(this.startView)){this.startWindow.resize(this.getClientWidth()*(100/this.startView.getZoom()),this.getClientHeight()*(100/this.startView.getZoom()));this.startWindow.move(this.getClientWidth()*(this.startView.getCenterX()/100)-this.startWindow.getWidth()/2,this.getClientHeight()*(this.startView.getCenterY()/100)-this.startWindow.getHeight()/2);this.checkInBounds(this.startWindow);this.startWindow.setVisible(this.startView.getZoom()>100?true:false)}if(defined(this.endView)){this.endWindow.resize(this.getClientWidth()*(100/this.endView.getZoom()),this.getClientHeight()*(100/this.endView.getZoom()));this.endWindow.move(this.getClientWidth()*(this.endView.getCenterX()/100)-this.endWindow.getWidth()/2,this.getClientHeight()*(this.endView.getCenterY()/100)-this.endWindow.getHeight()/2);this.checkInBounds(this.endWindow);this.endWindow.setVisible(this.endView.getZoom()>100?true:false)}};this.checkInBounds=function(B){var A=Math.max(0,B.getX());var C=Math.max(0,B.getY());B.move(Math.min(A,this.getClientWidth()-B.getWidth()),Math.min(C,this.getClientHeight()-B.getHeight()))};this.onWindowDrag=callback(this,function(A){this.checkInBounds(A)});this.onStartWindowEndDrag=callback(this,function(A){this.startView.center((A.getX()+A.getWidth()/2)/this.getClientWidth()*100,(A.getY()+A.getHeight()/2)/this.getClientHeight()*100);this.checkInBounds(A)});this.onEndWindowMoved=callback(this,function(A){this.endView.center((A.getX()+A.getWidth()/2)/this.getClientWidth()*100,(A.getY()+A.getHeight()/2)/this.getClientHeight()*100);this.checkInBounds(A)})}}ClassFactory.createPackage("editor.plugins.tribute.ui");ClassFactory.createClass(editor.plugins.tribute.ui,"TributeVideoSceneEditor");with(editor.plugins.tribute.ui){editor.plugins.tribute.ui.TributeVideoSceneEditor.superClass=core.ui.Window;editor.plugins.tribute.ui.TributeVideoSceneEditor.constructor=function(){this.scene;this.index;this.titlePane;this.titleText;this.infoPane;this.imagePane;this.cameraPane;this.notifyUp=new core.ui.Notification();this.notifyDown=new core.ui.Notification();this.notifyDelete=new core.ui.Notification();this.notifySelect=new core.ui.Notification();this.notifySceneEditorChanged=new core.ui.Notification();this.notifyDurationChanged=new core.ui.Notification();this.TributeVideoSceneEditor=function(parent){this.Window(parent);this.init()};this.setScene=function(scene,index){this.scene=scene;this.index=index;this.cameraEditor.setImage(scene.getImage());this.cameraEditor.setStartView(scene.getStartView());this.cameraEditor.setEndView(scene.getEndView());this.updateControls()};this.getScene=function(){return this.scene};this.setIndex=function(i){this.index=i};this.getIndex=function(){return this.index};this.init=function(){editor.ui.LoadingMessage.showIcon(this);this.initTitlePane();this.initImagePane();this.initInfoPane();this.initCameraPane();editor.ui.LoadingMessage.hideMessage(this)};this.initTitlePane=function(){with(core.ui){this.titlePane=new Window(this);this.titlePane.setStyleName("TitlePane");this.titlePane.setStyle("position","absolute");this.titleText=new Static(this.titlePane);this.titleText.addStyleName("Title");this.upButton=new ImageButton(this.titlePane);this.upButton.addStyleName("UpButton");this.upButton.setText("Move up");this.upButton.setToolTip("Move scene up");this.upButton.setImageList("images/TributeVideoSceneEditor/up.gif");this.upButton.onclick=this.onUpButtonClick;this.downButton=new ImageButton(this.titlePane);this.downButton.addStyleName("DownButton");this.downButton.setText("Move down");this.downButton.setToolTip("Move scene down");this.downButton.setImageList("images/TributeVideoSceneEditor/down.gif");this.downButton.onclick=this.onDownButtonClick;this.resetButton=new ImageButton(this.titlePane);this.resetButton.addStyleName("ResetButton");this.resetButton.setText("Reset");this.resetButton.setToolTip("Reset scene");this.resetButton.setImageList("images/TributeVideoSceneEditor/reset.gif");this.resetButton.onclick=this.onResetButtonClick;this.deleteButton=new ImageButton(this.titlePane);this.deleteButton.addStyleName("DeleteButton");this.deleteButton.setText("Delete");this.deleteButton.setToolTip("Delete this scene");this.deleteButton.setImageList("images/TributeVideoSceneEditor/delete.gif");this.deleteButton.onclick=this.onDeleteButtonClick}};this.initImagePane=function(){with(core.ui){this.imagePane=new Window(this);this.imagePane.setStyleName("ImagePane");this.imagePane.setStyle("position","absolute");this.cameraEditor=new TributeVideoCameraViewEditor(this.imagePane);this.cameraEditor.setStyle("position","absolute");this.fileUpload=new FileUpload(this.imagePane);this.fileUpload.setStyle("position","absolute");this.fileUpload.setText("Upload");this.fileUpload.setToolTip("Upload image");this.fileUpload.setImageList("images/TributeVideoSceneEditor/upload.gif");this.fileUpload.setUploadUrl(theApp.getUserCommand("ajax.UploadImage"));this.fileUpload.notifyFileSelected.addListener(this.onFileSelected);this.fileUpload.notifyFileUploaded.addListener(this.onFileUploaded);this.fileUpload.notifyUploadError.addListener(this.onUploadError);this.libButton=new ImageButton(this.imagePane);this.libButton.setStyle("position","absolute");this.libButton.setImageList("images/TributeVideoSceneEditor/lib.gif");this.libButton.setText("Library");this.libButton.setToolTip("Load image from library");this.libButton.oncommand=this.onLibButtonClick}};this.initInfoPane=function(){with(core.ui){this.infoPane=new Window(this);this.infoPane.setStyleName("InfoPane");this.infoPane.setStyle("position","absolute");this.durationSlider=new Slider(this.infoPane);this.durationSlider.addStyleName("Duration");this.durationSlider.setToolTip("Change scene duration");this.durationSlider.setStyle("position","absolute");this.durationSlider.setRange(2,20);this.durationSlider.setPos(5);this.durationSlider.notifyPositionChanged.addListener(this.onDurationChanged);this.durationText=new Static(this.infoPane);this.durationText.addStyleName("DurationValue");this.durationText.setStyle("position","absolute");this.fadingList=new ComboBox(this.infoPane);this.fadingList.addStyleName("Fading");this.fadingList.setStyle("position","absolute");this.fadingList.setToolTip("Fading effect (in process of development)");this.fadingList.notifyValueChanged.addListener(this.onFadingChanged);with(editor.plugins.tribute){var fadings={};fadings[Scene.FADING_NORMAL]="Fading";fadings[Scene.FADING_CIRCLES]="Circles";fadings[Scene.FADING_JALOUSIE]="Jalousie";fadings[Scene.FADING_SQUARES]="Squares";for(var f in fadings){this.fadingList.addItem(fadings[f],f,(Scene.FADING_NORMAL==f)?true:false)}}this.subtitlesText=new TextArea(this.infoPane);this.subtitlesText.addStyleName("Subtitles");this.subtitlesText.setStyle("position","absolute");this.subtitlesText.setToolTip("Enter scene subtitles");this.subtitlesText.onchange=this.subtitlesText.onmouseout=this.onSubtitlesChange;this.fontSizeList=new ComboBox(this.infoPane);this.fontSizeList.addStyleName("FontSize");this.fontSizeList.setStyle("position","absolute");this.fontSizeList.setToolTip("Select font size");this.fontSizeList.notifyValueChanged.addListener(this.onFontSizeChanged);var sizes={12:"12",20:"20",28:"28",36:"36"};for(var s in sizes){this.fontSizeList.addItem(sizes[s],s,(s==12)?true:false)}with(editor.ui){this.boldButton=new ToggleButton(this.infoPane);this.boldButton.addStyleName("BoldButton");this.boldButton.setStyle("position","absolute");this.boldButton.setImageList("images/TributeVideoSceneEditor/bold.gif");this.boldButton.setToolTip("Bold");this.boldButton.oncommand=this.onBoldButtonClick;this.italicButton=new ToggleButton(this.infoPane);this.italicButton.addStyleName("ItalicButton");this.italicButton.setStyle("position","absolute");this.italicButton.setImageList("images/TributeVideoSceneEditor/italic.gif");this.italicButton.setToolTip("Italic");this.italicButton.oncommand=this.onItalicButtonClick;this.underlineButton=new ToggleButton(this.infoPane);this.underlineButton.addStyleName("UnderlineButton");this.underlineButton.setStyle("position","absolute");this.underlineButton.setImageList("images/TributeVideoSceneEditor/underline.gif");this.underlineButton.setToolTip("Underline");this.underlineButton.oncommand=this.onUnderlineButtonClick}var staticInfo={"Duration":"Duration:","Fading":"Fading:","Subtitles":"Subtitles:"};for(var k in staticInfo){var s=new Static(this.infoPane);s.addStyleName(k+"Title");s.setStyle("position","absolute");s.setText(staticInfo[k])}}};this.initCameraPane=function(){with(core.ui){this.cameraPane=new Window(this);this.cameraPane.setStyleName("CameraPane");this.cameraPane.setStyle("position","absolute");var cameraTitle=new Static(this.cameraPane);cameraTitle.addStyleName("CameraTitle");cameraTitle.setStyle("position","absolute");cameraTitle.setText("Camera view");var startPointIcon=new Image(this.cameraPane);startPointIcon.addStyleName("StartPointIcon");startPointIcon.setStyle("position","absolute");startPointIcon.setSource("images/TributeVideoSceneEditor/start-point.gif");var endPointIcon=new Image(this.cameraPane);endPointIcon.addStyleName("EndPointIcon");endPointIcon.setStyle("position","absolute");endPointIcon.setSource("images/TributeVideoSceneEditor/end-point.gif");var startPointText=new Static(this.cameraPane);startPointText.addStyleName("StartPointTitle");startPointText.setStyle("position","absolute");startPointText.setText("Start point:");var endPointText=new Static(this.cameraPane);endPointText.addStyleName("EndPointTitle");endPointText.setStyle("position","absolute");endPointText.setText("End point:");this.startPointSlider=new Slider(this.cameraPane);this.startPointSlider.addStyleName("StartPoint");this.startPointSlider.setToolTip("Start point zoom");this.startPointSlider.setStyle("position","absolute");this.startPointSlider.setRange(100,400);this.startPointSlider.setPos(100);this.startPointSlider.notifyPositionChanged.addListener(this.onStartPointChanged);this.endPointSlider=new Slider(this.cameraPane);this.endPointSlider.addStyleName("EndPoint");this.endPointSlider.setToolTip("End point zoom");this.endPointSlider.setStyle("position","absolute");this.endPointSlider.setRange(100,400);this.endPointSlider.setPos(100);this.endPointSlider.notifyPositionChanged.addListener(this.onEndPointChanged);this.startPointText=new Static(this.cameraPane);this.startPointText.addStyleName("StartPointValue");this.startPointText.setStyle("position","absolute");this.endPointText=new Static(this.cameraPane);this.endPointText.addStyleName("EndPointValue");this.endPointText.setStyle("position","absolute")}};this.reset=function(){this.scene.reset();this.updateControls();this.notifySceneEditorChanged.send(this)};this.activate=override(this.activate,function(){this.notifySelect.send(this,this.index);arguments.callee.prototype.apply(this,[])});this.updateControls=function(){this.titleText.setText("Scene "+((this.index>=9)?"":"0")+(this.index+1)+" / "+this.scene.getDuration().toFixed(0)+" sec");if(this.durationSlider.getPos()!==this.scene.getDuration()){this.durationSlider.setPos(this.scene.getDuration())}this.durationText.setText(this.scene.getDuration().toFixed(0)+" sec");this.fadingList.setValue(this.scene.getFadingType());this.cameraPane.setEnabled(this.scene.hasImage()?true:false);this.cameraPane.setStyle("opacity",this.scene.hasImage()?100:50);var startZoom,endZoom;if(this.scene.hasImage()){startZoom=this.scene.getStartView().getZoom();endZoom=this.scene.getEndView().getZoom()}else{startZoom=100;endZoom=100;this.cameraEditor.setImage(null)}if(this.startPointSlider.getPos()!==startZoom){this.startPointSlider.setPos(startZoom)}if(this.endPointSlider.getPos()!==endZoom){this.endPointSlider.setPos(endZoom)}this.startPointText.setText(startZoom.toFixed(0)+"%");this.endPointText.setText(endZoom.toFixed(0)+"%");var subtitles=this.scene.getSubtitles();this.boldButton.turn(subtitles.isBold());this.italicButton.turn(subtitles.isItalic());this.underlineButton.turn(subtitles.isUnderline());this.subtitlesText.setText(subtitles.getText());this.fontSizeList.setValue(subtitles.getSize())};this.onUpButtonClick=callback(this,function(){this.notifyUp.send(this,this.index)});this.onDownButtonClick=callback(this,function(){this.notifyDown.send(this,this.index)});this.onResetButtonClick=callback(this,function(){this.reset();this.notifyDurationChanged.send(this,this.index)});this.onDeleteButtonClick=callback(this,function(){this.notifyDelete.send(this,this.index)});this.onSubtitlesChange=callback(this,function(){this.scene.getSubtitles().setText(this.subtitlesText.getText())});this.onBoldButtonClick=callback(this,function(){this.scene.getSubtitles().setBold(!this.scene.getSubtitles().isBold());this.updateControls()});this.onItalicButtonClick=callback(this,function(){this.scene.getSubtitles().setItalic(!this.scene.getSubtitles().isItalic());this.updateControls()});this.onUnderlineButtonClick=callback(this,function(){this.scene.getSubtitles().setUnderline(!this.scene.getSubtitles().isUnderline());this.updateControls()});this.onLibButtonClick=callback(this,function(){var lib=theApp.factory.getImageLibrary();lib.getContentWindow().notifyImageSelected.addListener(this.onLibImageSelected,true);lib.center();lib.doModal()});this.onDurationChanged=callback(this,function(sender,duration){this.scene.setDuration(duration);this.notifyDurationChanged.send(this,this.index);this.updateControls()});this.onFadingChanged=callback(this,function(sender,fading){this.scene.setFadingType(fading);this.updateControls()});this.onFontSizeChanged=callback(this,function(sender,size){this.scene.getSubtitles().setSize(size);this.updateControls()});this.onStartPointChanged=callback(this,function(sender,zoom){this.cameraEditor.setStartZoom(zoom);this.updateControls()});this.onEndPointChanged=callback(this,function(sender,zoom){this.cameraEditor.setEndZoom(zoom);this.updateControls()});this.onFileSelected=callback(this,function(sender,path){editor.ui.LoadingMessage.showIcon(this.cameraEditor);sender.upload()});this.onFileUploaded=callback(this,function(sender,info){this.scene.setImage(info.src);this.cameraEditor.setImage(info.src);this.updateControls();editor.ui.LoadingMessage.hideMessage(this.cameraEditor);this.notifySceneEditorChanged.send(this)});this.onUploadError=callback(this,function(sender,info){console.error("File is not uploaded!");console.dir(info);this.scene.setImage("");this.cameraEditor.setImage(null);this.updateControls();editor.ui.LoadingMessage.hideMessage(this.cameraEditor)});this.onLibImageSelected=callback(this,function(sender,source){this.scene.setImage(source);this.cameraEditor.setImage(source);this.updateControls();theApp.factory.getImageLibrary().endModal();this.notifySceneEditorChanged.send(this)});this.onSceneChanged=callback(this,function(sender){});this.onmousedown=function(){this.notifySelect.send(this,this.index)}}}ClassFactory.createPackage("editor.plugins.tribute.ui");ClassFactory.createClass(editor.plugins.tribute.ui,"TributeVideoSoundEditor");with(editor.plugins.tribute.ui){editor.plugins.tribute.ui.TributeVideoSoundEditor.superClass=core.ui.CompositeWindow;editor.plugins.tribute.ui.TributeVideoSoundEditor.constructor=function(){this.sound;this.index;this.closeButton;this.selectButton;this.title;this.duration;this.cicleBox;this.gripper;this.scale;this.notifyDelete=new core.ui.Notification();this.notifyChange=new core.ui.Notification();this.notifySelect=new core.ui.Notification();this.TributeVideoSoundEditor=function(parent){this.CompositeWindow(parent);with(core.ui){this.closeButton=new ImageButton(this);this.closeButton.addStyleName("CloseButton");this.closeButton.setStyle("position","absolute");this.closeButton.setImageList("images/TributeVideoSoundEditor/close.gif");this.closeButton.setToolTip("Close and delete this sound");this.closeButton.oncommand=this.onCloseButtonClick;this.selectButton=new ImageButton(this);this.selectButton.addStyleName("SelectButton");this.selectButton.setStyle("position","absolute");this.selectButton.setImageList("images/TributeVideoSoundEditor/select.gif");this.selectButton.setText("Select music");this.selectButton.setToolTip("Select music");this.selectButton.oncommand=this.onSelectButtonClick;this.gripper=new Gripper(this);this.gripper.setStyle("position","absolute");this.gripper.setResizeWindow(this,undefined,this.closeButton.getY()+this.closeButton.getHeight()+this.gripper.getHeight());this.gripper.setDirection(Gripper.SOUTH);this.gripper.notifyEndResize.addListener(this.onEndResize);this.title=new Marquee(this);this.title.setStyle("position","absolute");this.title.setScrollDelay(200);this.title.stop();this.duration=new Static(this);this.duration.setStyle("position","absolute");this.duration.setToolTip("Sound duration");this.cycle=new CheckBox(this);this.cycle.setStyle("position","absolute");this.cycle.setText("Cycle");this.cycle.setToolTip("Whether the sound should continue loop after finish");this.cycle.onclick=this.onCycleClick;this.scale=new Static(parent);this.scale.setStyleName("DurationScale");this.scale.setStyle("position","absolute");this.updateLayout()}};this.setSound=function(sound,index){this.sound=sound;this.index=index;this.updateControls();this.title.start()};this.getSound=function(){return this.sound};this.setIndex=function(i){this.index=i};this.getIndex=function(){return this.index};this.close=override(this.close,function(){this.scale.close();this.gripper.notifyEndResize.removeListener(this.onEndResize);arguments.callee.prototype.apply(this,[])});this.getY=function(){return 0};this.updateLayout=function(){this.gripper.move(0,this.getClientHeight()-this.gripper.getHeight());this.scale.move(this.scale.getX(),this.getElement().offsetTop);this.scale.resize(this.scale.getWidth(),this.getHeight())};this.updateControls=function(){if(defined(this.sound)){this.title.setText(this.sound.getTitle());this.title.setToolTip(this.sound.getTitle());var min=common.util.DateUtils.getMinutes(this.sound.getDuration());var sec=common.util.DateUtils.getSeconds(this.sound.getDuration());this.duration.setText(min+":"+sec);this.duration.setToolTip("Sound duration: "+this.duration.getText());this.cycle.setChecked(this.sound.isCyclic());this.selectButton.setText(this.sound.hasFile()?"Change music":"Select music")}};this.onCloseButtonClick=callback(this,function(){this.notifyDelete.send(this,this.index)});this.onSelectButtonClick=callback(this,function(){this.notifySelect.send(this,this.index)});this.onEndResize=callback(this,function(){this.notifyChange.send(this,this.index)});this.onCycleClick=callback(this,function(event,target){if(this.cycle!=target){this.sound.setCyclic(this.cycle.isChecked())}})}}ClassFactory.createPackage("editor.plugins.tribute.ui");ClassFactory.createClass(editor.plugins.tribute.ui,"TributeVideoEditor");with(editor.plugins.tribute.ui){editor.plugins.tribute.ui.TributeVideoEditor.superClass=core.ui.ScrollWindow;editor.plugins.tribute.ui.TributeVideoEditor.constructor=function(){this.video;this.scenesPane;this.soundsPane;this.sceneEditors=[];this.soundEditors=[];this.currentSceneEditor;this.currensSoundEditor;this.addSceneButton;this.addSoundButton;this.notifyLoaded=new core.ui.Notification();this.notifyVideoChanged=new core.ui.Notification();this.TributeVideoEditor=function(parent){this.ScrollWindow(parent);with(core.ui){this.setContentWindow(new Window(this));this.scenesPane=new Window(this.getContentWindow());this.scenesPane.setStyleName("ScenesPane");this.scenesPane.setStyle("position","absolute");this.scenesPane.setStyle("overflow","visible");this.soundsPane=new Window(this.getContentWindow());this.soundsPane.setStyleName("SoundsPane");this.soundsPane.setStyle("position","absolute");this.soundsPane.setStyle("overflow","visible");this.createSceneButton();this.createSoundButton();this.updateControls()}};this.setVideo=function(video){if(video!==this.video){this.video=video;if(undefined!==video){this.loadVideo()}}};this.getVideo=function(){return this.video};this.addScene=function(scene){this.video.addScene(scene);this.addSceneButton.close();var e=new TributeVideoSceneEditor(this.scenesPane);e.setScene(scene,this.video.scenes.length-1);e.notifyUp.addListener(this.onMoveSceneUp);e.notifyDown.addListener(this.onMoveSceneDown);e.notifyDelete.addListener(this.onDeleteScene);e.notifySelect.addListener(this.onSelectScene);e.notifyDurationChanged.addListener(this.onSceneDurationChanged);this.sceneEditors.push(e);e.notifySceneEditorChanged.addListener(this.onSceneEditorChanged);this.createSceneButton();this.updateControls();this.updateLayout();return e};this.removeScene=function(i){this.video.removeScene(i);this.sceneEditors[i].close();this.sceneEditors.splice(i,1);if(((this.currentSceneEditor&&(this.currentSceneEditor.constructor===TributeVideoSceneEditor||defined(this.currentSceneEditor.constructor.isSubclassOf)&&this.currentSceneEditor.constructor.isSubclassOf(TributeVideoSceneEditor))))&&(this.currentSceneEditor.getIndex()==i)){delete this.currentSceneEditor}this.updateControls();this.updateLayout()};this.addSound=function(sound){this.video.addSound(sound);this.addSoundButton.close();var e=new TributeVideoSoundEditor(this.soundsPane);e.setSound(sound,this.video.sounds.length-1);e.notifyDelete.addListener(this.onSoundDelete);e.notifySelect.addListener(this.onSoundSelect);e.notifyChange.addListener(this.onSoundChange);this.soundEditors.push(e);this.updateControls();this.updateLayout();this.createSoundButton()};this.removeSound=function(i){this.video.removeSound(i);this.soundEditors[i].close();this.soundEditors.splice(i,1);this.updateControls();this.updateLayout()};this.moveSceneUp=function(i){this.switchScenes(i,i-1);this.updateControls()};this.moveSceneDown=function(i){this.switchScenes(i,i+1);this.updateControls()};this.resetScroll=override(this.reset,function(){arguments.callee.prototype.apply(this,[])});this.reset=function(){while(this.sceneEditors.length>0){this.sceneEditors.pop().close()}while(this.soundEditors.length>0){this.soundEditors.pop().close()}};this.switchScenes=function(i,j){var e1=this.sceneEditors[i];var e2=this.sceneEditors[j];if(!defined(e1)||!defined(e2)){return }var s1=e1.getScene();var s2=e2.getScene();with(editor.plugins.tribute){if(!(s1&&(s1.constructor===Scene||defined(s1.constructor.isSubclassOf)&&s1.constructor.isSubclassOf(Scene)))||!(s2&&(s2.constructor===Scene||defined(s2.constructor.isSubclassOf)&&s2.constructor.isSubclassOf(Scene)))){return }}this.video.scenes[i]=s2;this.video.scenes[j]=s1;e2.setScene(s1,j);e1.setScene(s2,i);if((this.currentSceneEditor&&(this.currentSceneEditor.constructor===TributeVideoSceneEditor||defined(this.currentSceneEditor.constructor.isSubclassOf)&&this.currentSceneEditor.constructor.isSubclassOf(TributeVideoSceneEditor)))){if(this.currentSceneEditor.getIndex()==i){this.highlightScene(j)}else{if(this.currentSceneEditor.getIndex()==j){this.highlightScene(i)}}}};this.highlightScene=function(i){var editor=this.sceneEditors[i];if(editor!=this.currentSceneEditor){if((this.currentSceneEditor&&(this.currentSceneEditor.constructor===TributeVideoSceneEditor||defined(this.currentSceneEditor.constructor.isSubclassOf)&&this.currentSceneEditor.constructor.isSubclassOf(TributeVideoSceneEditor)))){this.currentSceneEditor.removeStyleName(this.currentSceneEditor.getStyleName()+"-highlight")}editor.addStyleName(editor.getStyleName()+"-highlight");this.currentSceneEditor=editor}};this.updateControls=function(isLoadingVideo){var isLoadingVideo=defined(isLoadingVideo)?isLoadingVideo:false;this.updateSoundEditors(isLoadingVideo);if(defined(this.video)){this.updateScenes();this.updateSounds()}this.updateLayout()};this.updateScenes=function(){for(var i=0;i<this.sceneEditors.length;i++){this.sceneEditors[i].upButton.setEnabled((i>0)?true:false);this.sceneEditors[i].downButton.setEnabled((i<this.sceneEditors.length-1)?true:false);this.sceneEditors[i].setIndex(i);this.sceneEditors[i].updateControls();this.sceneEditors[i].notifySceneEditorChanged.addListener(this.onSceneEditorChanged)}};this.updateCoefficient=function(isLoadingVideo){isLoadingVideo=defined(isLoadingVideo)?isLoadingVideo:false;this.periodDurations=[0,0,0,0];for(var j=0;j<this.sceneEditors.length;j++){var p=this.sceneEditors[j].getScene().getPeriod();var returnValue=0;if(p==""){if(j>=1){p=this.sceneEditors[j-1].getScene().getPeriod()}else{p=0}this.sceneEditors[j].getScene().setPeriod(p)}else{if(isLoadingVideo){isLoadingVideo=false}}this.periodDurations[p]+=this.sceneEditors[j].getScene().getDuration()}for(var j=0;j<this.sceneEditors.length;j++){this.sceneEditors[j].getScene().setPeriod("")}var N=this.soundEditors.length;if(N==0){return null}var M=0;for(var i=0;i<4;i++){if(this.periodDurations[i]>0){M++}}this.coeff=M/N;return isLoadingVideo};this.updateSoundData=function(isLoadingVideo){isLoadingVideo=this.updateCoefficient(isLoadingVideo);var coeff=this.coeff;if(coeff==null){return }var delta=0;var k=0;for(var i=0;i<this.soundEditors.length;i++){var soundEditor=this.soundEditors[i];var duration=soundEditor.getSound().getDuration();if(coeff>0&&!isLoadingVideo){duration=0;if(coeff>=1){while(coeff>=1){duration+=delta;if(delta==0){duration+=this.periodDurations[k];if(this.periodDurations[k]>0){coeff=coeff-1}k++}delta=0;if(coeff<1){duration+=this.periodDurations[k]*coeff;if(coeff>0){delta=this.periodDurations[k]*Math.abs(1-coeff)}}}}else{for(var k=0;k<this.sceneEditors.length;k++){duration+=this.video.getScene(k).getDuration()/this.soundEditors.length}}soundEditor.getSound().setDuration(duration)}}};this.updateSoundLayout=function(){var counter=0;var j=0;var scenesD=0;var doBreak=false;var d0=0;for(var i=0;i<this.soundEditors.length;i++){var d=d0;var h=0;var soundEditor=this.soundEditors[i];var duration=soundEditor.getSound().getDuration();while(defined(this.sceneEditors[j])){var sceneEditor=this.sceneEditors[j];if(!doBreak){scenesD+=sceneEditor.getScene().getDuration()}doBreak=false;var d1=scenesD;if(duration+d0<d1){d1=d0+duration;doBreak=true}h+=Math.abs(d1-d)/sceneEditor.getScene().getDuration()*sceneEditor.getHeight();if(doBreak){break}d=scenesD;j++}counter++;d0+=duration;soundEditor.setStyle("height",h)}};this.updateSoundEditors=function(isLoadingVideo){if(this.soundEditors.length==0){return }this.updateSoundData(isLoadingVideo);this.updateSoundLayout();this.updateSounds()};this.updateSounds=function(){var j=0;var h0=0;for(var i=0;i<this.soundEditors.length;i++){var d=0;var h=h0;var soundEditor=this.soundEditors[i];while(defined(this.sceneEditors[j])){var sceneEditor=this.sceneEditors[j];var y=sceneEditor.getY()+sceneEditor.getHeight();var doBreak=false;if(h0+soundEditor.getHeight()<y){y=h0+soundEditor.getHeight();doBreak=true}d+=Math.abs(y-h)/sceneEditor.getHeight()*sceneEditor.getScene().getDuration();if(doBreak){break}h=y;j++}h0+=soundEditor.getHeight();soundEditor.setIndex(i);soundEditor.getSound().setDuration(d);soundEditor.updateLayout();soundEditor.updateControls()}};this.createSoundButton=function(){this.addSoundButton=new core.ui.ImageButton(this.soundsPane);this.addSoundButton.addStyleName("AddSoundButton");this.addSoundButton.setImageList("images/TributeVideoEditor/add-sound.gif");this.addSoundButton.setText("Select music");this.addSoundButton.setToolTip("Select background music for the video");this.addSoundButton.oncommand=this.onAddSoundButtonClick};this.createSceneButton=function(){this.addSceneButton=new core.ui.ImageButton(this.scenesPane);this.addSceneButton.addStyleName("AddSceneButton");this.addSceneButton.setImageList("images/TributeVideoEditor/add-scene.gif");this.addSceneButton.setText("Add new scene");this.addSceneButton.setToolTip("Add new scene to the video");this.addSceneButton.oncommand=this.onAddSceneButtonClick};this.selectMusic=function(){var dialog=theApp.factory.getMusicDialog();dialog.addCloseListener(this);dialog.getContentWindow().notifySelected.addListener(this.onSoundSelected,true);dialog.getContentWindow().notifyCancel.addListener(this.onSoundCancel,true);dialog.center();dialog.doModal()};this.loadVideo=callback(this,function(){switch(arguments.callee.step){case undefined:this.vscroll.hide();this.scenesPane.hide();this.soundsPane.hide();delete this.currentSceneEditor;delete this.currensSoundEditor;arguments.callee.step=0;case 0:if(!defined(this.progressBar)){this.progress=new core.ui.ProgressBar(this);this.progress.setStyle("position","absolute");this.progress.setItemCount(20);this.progress.center();this.progress.show()}this.reset();break;case 1:this.addSceneButton.close();var step=(100/3)/this.video.scenes.length;for(var i=0;i<this.video.scenes.length;i++){var e=new TributeVideoSceneEditor(this.scenesPane);e.setScene(this.video.scenes[i],i);e.notifyUp.addListener(this.onMoveSceneUp);e.notifyDown.addListener(this.onMoveSceneDown);e.notifyDelete.addListener(this.onDeleteScene);e.notifySelect.addListener(this.onSelectScene);e.notifyDurationChanged.addListener(this.onSceneDurationChanged);this.sceneEditors.push(e);this.progress.setPos(this.progress.getPos()+step)}this.createSceneButton();break;case 2:this.addSoundButton.close();var step=(100/3)/this.video.sounds.length;for(var j=0;j<this.video.sounds.length;j++){var e=new TributeVideoSoundEditor(this.soundsPane);e.setSound(this.video.sounds[j],j);e.notifyDelete.addListener(this.onSoundDelete);e.notifySelect.addListener(this.onSoundSelect);e.notifyChange.addListener(this.onSoundChange);this.soundEditors.push(e);this.progress.setPos(this.progress.getPos()+step)}this.createSoundButton();break;case 3:this.updateControls(true);this.scenesPane.show();this.soundsPane.show();this.resetScroll();this.vscroll.show();this.progress.hide();this.notifyLoaded.send(this);arguments.callee.step=undefined;return }this.progress.setPos(++arguments.callee.step/3*100);window.setTimeout(this.loadVideo,0)});this.onAddSceneButtonClick=callback(this,function(){var e=this.addScene(new editor.plugins.tribute.Scene());this.ensureVisible(e)});this.onAddSoundButtonClick=callback(this,function(){delete this.currensSoundEditor;this.selectMusic()});this.onMoveSceneUp=callback(this,function(sender,i){this.moveSceneUp(i)});this.onMoveSceneDown=callback(this,function(sender,i){this.moveSceneDown(i)});this.onDeleteScene=callback(this,function(sender,i){this.removeScene(i)});this.onSceneDurationChanged=callback(this,function(sender,i){this.updateSounds()});this.onSelectScene=callback(this,function(sender,i){this.highlightScene(i)});this.onSoundSelected=callback(this,function(sender,path,duration,file,artist,title){var title=(artist&&title)?artist+" - "+title:file;if(defined(this.currensSoundEditor)){var sound=this.currensSoundEditor.getSound();sound.setFile(path);sound.setTitle(title);sound.setDuration(duration);this.updateSounds();this.currensSoundEditor.updateControls()}else{var sound=new editor.plugins.tribute.Sound(path,title,duration);this.addSound(sound)}var dialog=theApp.factory.getMusicDialog();dialog.removeCloseListener(this);dialog.getContentWindow().notifySelected.removeListener(this.onSoundCancel);dialog.endModal()});this.onFrameClose=function(frame){frame.removeCloseListener(this);frame.getContentWindow().notifySelected.removeListener(this.onSoundSelected);frame.endModal()};this.onSoundCancel=callback(this,function(sender){this.onFrameClose(sender.getParent())});this.onSoundDelete=callback(this,function(sender,i){this.removeSound(i)});this.onSoundChange=callback(this,function(sender,i){this.updateSounds();this.updateLayout()});this.onSoundSelect=callback(this,function(sender,i){this.currensSoundEditor=sender;this.selectMusic()});this.onSceneEditorChanged=callback(this,function(sender){this.notifyVideoChanged.send(this)})}}ClassFactory.createPackage("editor.plugins.tribute.ui");ClassFactory.createClass(editor.plugins.tribute.ui,"TributeVideoDialog");with(editor.plugins.tribute.ui){editor.plugins.tribute.ui.TributeVideoDialog.superClass=core.ui.Dialog;editor.plugins.tribute.ui.TributeVideoDialog.constructor=function(){this.splitWindow;this.editor;this.preview;this.glassPane;this.menuPane;this.buttonsPane;this.addSceneButton;this.previewButton;this.okButton;this.cancelButton;this.autoStart;this.notifyOk=new core.ui.Notification();this.notifyCancel=new core.ui.Notification();this.TributeVideoDialog=function(parent){this.Dialog(parent);with(core.ui){this.splitWindow=new SplitWindow(this,0,0,"100%","100%");this.editor=new TributeVideoEditor(this.splitWindow);this.editor.notifyVideoChanged.addListener(this.onVideoChanged);this.glassPane=new core.ui.Window(this.splitWindow,this.editor.getX(),this.editor.getY(),this.editor.getWidth(),this.editor.getHeight());this.glassPane.setStyleName("GlassPane");this.glassPane.setStyle("opacity",45);this.glassPane.hide();this.preview=new editor.plugins.tribute.TributeVideoPlayer(this.splitWindow);this.preview.setStyle("position","absolute");this.preview.setStyle("width","0px");this.preview.notifyStateChange.addListener(this.onPreviewStateChange);this.menuPane=new Window(this.splitWindow);this.menuPane.setStyleName("MenuPane");this.addSceneButton=new ImageButton(this.menuPane);this.addSceneButton.setImages("images/TributeVideoDialog/scene-normal.png","images/TributeVideoDialog/scene-hover.png","images/TributeVideoDialog/scene-pressed.png","images/TributeVideoDialog/scene-disabled.png");this.addSceneButton.setText("Add new scene");this.addSceneButton.setToolTip("Add new scene to the video");this.addSceneButton.oncommand=this.onAddButtonClick;this.previewButton=new ImageButton(this.menuPane);this.previewButton.oncommand=this.onPreviewButtonClick;this.buttonsPane=new Window(this.splitWindow);this.buttonsPane.setStyleName("ButtonsPane");this.cancelButton=new ImageButton(this.buttonsPane);this.cancelButton.addStyleName("CancelButton");this.cancelButton.setStyle("position","absolute");this.cancelButton.setText("Cancel");this.cancelButton.setToolTip("Close without changes");this.cancelButton.setImageList("images/TributeVideoDialog/cancel.gif");this.cancelButton.oncommand=this.onCancelButtonClick;this.okButton=new ImageButton(this.buttonsPane);this.okButton.addStyleName("OkButton");this.okButton.setStyle("position","absolute");this.okButton.setText("OK");this.okButton.setToolTip("Close and save the video");this.okButton.setImageList("images/TributeVideoDialog/ok.gif");this.okButton.oncommand=this.onOkButtonClick;this.autoStart=new core.ui.CheckBox(this.buttonsPane);this.autoStart.addStyleName("CheckAutoStart");this.autoStart.setStyle("position","absolute");this.autoStart.setText("Auto start this video when the page loads");this.autoStart.onclick=this.onAutoStartClick;this.splitWindow.addPane(this.menuPane,SplitWindow.SPLIT_RIGHT);this.splitWindow.addPane(this.buttonsPane,SplitWindow.SPLIT_BOTTOM);this.splitWindow.addPane(this.editor);this.updateControls()}};this.setVideo=function(video){this.editor.setVideo(video);this.autoStart.setChecked(video.isAutoStart())};this.getPreviewButton=function(){return this.previewButton};this.updateControls=function(){var showPreview=(this.preview.isPlaying()||this.preview.isLoading()||this.preview.isReady());this.preview.setStyle("width",showPreview?"":"0px");this.glassPane.setVisible(showPreview);this.previewButton.setText(showPreview?"Stop preview":"Play preview");this.previewButton.setToolTip(showPreview?"Stop video preview":"Play video preview");if(showPreview){this.previewButton.setImages("images/TributeVideoDialog/stop-normal.png","images/TributeVideoDialog/stop-hover.png","images/TributeVideoDialog/stop-pressed.png","images/TributeVideoDialog/stop-disabled.png")}else{this.previewButton.setImages("images/TributeVideoDialog/preview-normal.png","images/TributeVideoDialog/preview-hover.png","images/TributeVideoDialog/preview-pressed.png","images/TributeVideoDialog/preview-disabled.png")}if(this.editor.getVideo()){this.previewButton.setEnabled(this.editor.getVideo().hasScenes())}this.addSceneButton.setEnabled(!showPreview)};this.onOkButtonClick=callback(this,function(){this.preview.stop();this.updateControls();this.notifyOk.send(this,this.editor.getVideo())});this.onCancelButtonClick=callback(this,function(){this.preview.stop();this.updateControls();this.editor.setVideo(undefined);this.notifyCancel.send(this)});this.onAddButtonClick=callback(this,function(){var i=this.editor.addScene(new editor.plugins.tribute.Scene());this.editor.ensureVisible(i)});this.onPreviewButtonClick=callback(this,function(){if(this.preview.isPlaying()){this.preview.stop()}else{this.preview.load(this.editor.getVideo(),true)}});this.onAutoStartClick=callback(this,function(event){this.editor.getVideo().setAutoStart(this.autoStart.isChecked())});this.onPreviewStateChange=callback(this,function(sender,state){this.updateControls()});this.onVideoChanged=callback(this,function(){this.updateControls()})}}ClassFactory.createPackage("editor.plugins.tribute");ClassFactory.createClass(editor.plugins.tribute,"TributeVideoBox");with(editor.plugins.tribute){editor.plugins.tribute.TributeVideoBox.superClass=editor.elements.PageElement;editor.plugins.tribute.TributeVideoBox.constructor=function(){this.video;this.player;this.TributeVideoBox=function(root,video){arguments.callee.prototype.apply(this,[root,"Tribute video"]);this.setStyle("z-index",3);if(defined(video)){this.video=video}};this.setVideo=function(video){this.video=video;this.player.load(video);this.updateControls()};this.getVideo=function(){return this.video};this.edit=function(){editor.ui.SelectionManager.get().removeSelection(this);var dialog=this.getVideoDialog();dialog.getContentWindow().setVideo(this.video.clone());dialog.addCloseListener(this);dialog.getContentWindow().notifyOk.addListener(this.onEditorOk,true);dialog.getContentWindow().notifyCancel.addListener(this.onEditorCancel,true);dialog.center();dialog.doModal()};this.play=function(){this.player.play()};this.stop=function(){this.player.stop()};this.isPlaying=function(){return this.player.isPlaying()};this.setEnabled=override(this.setEnabled,function(enabled){arguments.callee.prototype.apply(this,[enabled]);this.updateControls()});this.activate=override(this.activate,function(){arguments.callee.prototype.apply(this,[]);if(this.isInEditMode()){theApp.switchPanel(null);this.updateControls()}});this.isOverlappable=function(){return false};this.getVideoDialog=function(){with(editor.plugins.tribute.ui){return theApp.factory.createDialogWithFrame(TributeVideoDialog,"Edit video")}};this.updateControls=function(){if(!(this.video&&(this.video.constructor===Video||defined(this.video.constructor.isSubclassOf)&&this.video.constructor.isSubclassOf(Video)))){return }if(this.video.hasScenes()){this.removeStyleName("TributeVideoBox-empty")}else{this.addStyleName("TributeVideoBox-empty")}};this.createSelection=function(){return new TributeVideoSelection(this)};this.load=override(this.load,function(root){arguments.callee.prototype.apply(this,[root]);if(this.isInEditMode()){if(!defined(this.video)){var data=root.getAttribute("data");if(data){this.video=new Video();this.video.unserialize(data.toString().replace("&amp;","&"))}else{var params=root.getElementsByTagName("param");for(var i=0;i<params.length;i++){if("flashvars"==params[i].getAttribute("name").toString().toLowerCase()){data=params[i].getAttribute("value").toString().replace("&amp;","&");this.video=new Video();this.video.unserialize(data)}}}}this.player=new TributeVideoPlayer(this,0,0,"100%","100%",root.lastChild);this.player.notifyStateChange.addListener(this.onStateChange);this.player.load(this.video);this.updateControls()}});this.create=override(this.create,function(){arguments.callee.prototype.apply(this,[]);this.player=new TributeVideoPlayer(this,0,0,"100%","100%");this.player.setStyle("position","absolute");this.player.notifyStateChange.addListener(this.onStateChange);this.updateControls()});this.getHtmlTag=override(this.getHtmlTag,function(){var tag=arguments.callee.prototype.apply(this,[]);var data=this.video.serialize();tag.setAttribute("data",data);var inner=new core.html.Tag("div",{"class":"TributeVideoPlayer","style":new core.html.Style({"position":"absolute","overflow":"hidden","left":"0px","top":"0px","width":"100%","height":"100%","visibility":"inherit"})});var object=new core.html.Tag("object",{"type":"application/x-shockwave-flash","classid":"clsid:d27cdb6e-ae6d-11cf-96b8-444553540000","width":"100%","height":"100%"});object.addContent(new core.html.Tag("param",{"name":"movie","value":"tribute/video.swf"}));object.addContent(new core.html.Tag("param",{"name":"allowScriptAccess","value":"sameDomain"}));object.addContent(new core.html.Tag("param",{"name":"wmode","value":"transparent"}));object.addContent(new core.html.Tag("param",{"name":"flashVars","value":data}));object.addContent(new core.html.Tag("embed",{"type":"application/x-shockwave-flash","src":"tribute/video.swf","allowscriptaccess":"sameDomain","wmode":"transparent","width":"100%","height":"100%","flashvars":data}));inner.setContent(object);tag.setContent(inner);return tag});this.onFrameClose=function(frame){frame.getContentWindow().notifyOk.removeListener(this.onEditorOk);frame.endModal();this.updateControls();this.select()};this.onEditorOk=callback(this,function(sender,video){this.setModified(true);this.setVideo(video.clone());var frame=this.getVideoDialog();frame.removeCloseListener(this);frame.getContentWindow().notifyCancel.removeListener(this.onEditorCancel);frame.endModal();this.updateControls();this.select()});this.onEditorCancel=callback(this,function(sender){this.onFrameClose(sender.getParent())});this.onStateChange=callback(this,function(){this.updateControls()});this.ondblclick=callback(this,function(event){if(this.isInEditMode()){this.edit();event.stop()}})}}ClassFactory.createPackage("editor.ui");ClassFactory.createClass(editor.ui,"ImageUpload");with(editor.ui){editor.ui.ImageUpload.superClass=core.ui.Window;editor.ui.ImageUpload.constructor=function(){this.imageSrc;this.fileName;this.uploaded=false;this.fileUpload;this.deleteButton;this.preview;this.notifyUploaded=new core.ui.Notification();this.notifyDeleted=new core.ui.Notification();this.notifyUploadError=new core.ui.Notification();this.ImageUpload=function(B,A,E,C,D){this.Window(B,A,E,C,D);this.preview=new ImageFrame(this);this.fileUpload=new core.ui.FileUpload(this);this.fileUpload.setUploadUrl("ajax.UploadImage");this.fileUpload.setText("Add picture");this.fileUpload.setToolTip("Add picture from your computer");this.fileUpload.setImages("images/ImageUpload/button-normal.png","images/ImageUpload/button-hover.png","images/ImageUpload/button-pressed.png");this.fileUpload.notifyFileSelected.addListener(this.onImageSelected);this.fileUpload.notifyFileUploaded.addListener(this.onImageUploaded);this.fileUpload.notifyUploadError.addListener(this.onUploadError);this.deleteButton=new core.ui.ImageButton(this);this.deleteButton.setStyle("position","absolute");this.deleteButton.addStyleName("DeleteButton");this.deleteButton.setImageList("images/Wizard/x_button.gif");this.deleteButton.setToolTip("Delete this image");this.deleteButton.oncommand=this.onDeleteButtonCommand;this.updateControls()};this.isUploaded=function(){return(this.uploaded)?true:false};this.getImageSrc=function(){return this.imageSrc};this.getFileName=function(){return this.fileName};this.reset=function(){delete this.imageSrc;this.uploaded=false;this.updateControls()};this.getFileUpload=function(){return this.fileUpload};this.updateControls=function(){this.deleteButton.setVisible(this.isUploaded());this.preview.setImage(this.isUploaded()?this.imageSrc:"")};this.onDeleteButtonCommand=callback(this,function(){this.reset();this.notifyDeleted.send(this)});this.onImageSelected=callback(this,function(A,B){this.preview.setImage("images/loading.gif");this.fileUpload.upload()});this.onImageUploaded=callback(this,function(A,B){this.uploaded=true;this.imageSrc=B.src;this.fileName=B.fileName;this.updateControls();this.notifyUploaded.send(this,B.src,B.width,B.height)});this.onUploadError=callback(this,function(A,B){this.reset();this.notifyUploadError.send(this);alert("Sorry, the system does not recognize your file as an image.")})}}ClassFactory.createPackage("editor.plugins.tribute.wizard");ClassFactory.createClass(editor.plugins.tribute.wizard,"TributeVideoScenesPane");with(editor.plugins.tribute.wizard){editor.plugins.tribute.wizard.TributeVideoScenesPane.superClass=editor.ui.wizard.WizardPane;editor.plugins.tribute.wizard.TributeVideoScenesPane.constructor=function(){this.scenes=[];this.TributeVideoScenesPane=function(A,B){arguments.callee.prototype.apply(this,[A,B]);this.setTitle("Upload pictures with the person");this.setText("Upload pictures with the person for the photo montage.");this.setSkip(true)};this.setActive=function(A){if(A){this.getWizard().addWizardListener(this)}else{this.getWizard().removeWizardListener(this)}};this.init=function(){if(this.addButton){this.addButton.close()}if(this.items){this.items.close()}this.items=new core.ui.ScrollWindow(this,0,0,"100%","100%");this.items.setContentWindow(new core.ui.Menu(this.items));this.addMenuItems(3)};this.addMenuItems=function(B){if(this.addButton){this.addButton.close()}for(var A=0;A<B;A++){this.createImageUpload()}this.createAddButton();this.items.reset();this.items.getVerticalScroll().setPosition(100)};this.createImageUpload=function(){var A=new editor.ui.ImageUpload(this.items.getContentWindow());A.sceneIndex=this.items.getContentWindow().getItemCount();A.notifyUploaded.addListener(this.onImageUploaded);A.notifyDeleted.addListener(this.onImageDeleted);A.notifyUploadError.addListener(this.onUploadError);return this.items.getContentWindow().addItem(A)};this.createAddButton=function(){this.addButton=new core.ui.ImageButton(this.items.getContentWindow());this.addButton.addStyleName("AddButton");this.addButton.setText("Add more");this.addButton.setToolTip("Add more photos");this.addButton.setImages("images/VideoWizard/add-normal.png","images/VideoWizard/add-hover.png","images/VideoWizard/add-pressed.png");this.addButton.oncommand=this.onAddButtonCommand};this.setImageForScene=function(A,B){if(!defined(this.scenes[A])){this.scenes[A]=new editor.plugins.tribute.Scene(B)}else{this.scenes[A].setImage(B)}};this.onAddButtonCommand=callback(this,function(){this.addMenuItems(3)});this.onImageDeleted=this.onUploadError=callback(this,function(A){delete this.scenes[A.sceneIndex]});this.onImageUploaded=function(A,B){}}}ClassFactory.createPackage("editor.plugins.tribute.wizard");ClassFactory.createClass(editor.plugins.tribute.wizard,"MaturePhotosPane");with(editor.plugins.tribute.wizard){editor.plugins.tribute.wizard.MaturePhotosPane.superClass=editor.plugins.tribute.wizard.TributeVideoScenesPane;editor.plugins.tribute.wizard.MaturePhotosPane.constructor=function(){this.MaturePhotosPane=function(A){arguments.callee.prototype.apply(this,[A,MaturePhotosPane]);this.setStyleName("TributeVideoScenesPane");this.addStyleName("MaturePhotosPane");this.setPrevPaneId(AdultPhotosPane);this.setNextPaneId(TributeVideoMusicPane);this.setText("Upload mature photos.")};this.onImageUploaded=callback(this,function(A,B){this.setImageForScene(A.sceneIndex,B)});this.onWizardNext=function(A){if(!defined(A.getNextPane())){A.addPane(new TributeVideoMusicPane(A))}}}}ClassFactory.createPackage("editor.plugins.tribute.wizard");ClassFactory.createClass(editor.plugins.tribute.wizard,"AdultPhotosPane");with(editor.plugins.tribute.wizard){editor.plugins.tribute.wizard.AdultPhotosPane.superClass=editor.plugins.tribute.wizard.TributeVideoScenesPane;editor.plugins.tribute.wizard.AdultPhotosPane.constructor=function(){this.AdultPhotosPane=function(A){arguments.callee.prototype.apply(this,[A,AdultPhotosPane]);this.setStyleName("TributeVideoScenesPane");this.addStyleName("AdultPhotosPane");this.setPrevPaneId(TeenagePhotosPane);this.setNextPaneId(MaturePhotosPane);this.setText("Upload adult photos.")};this.onImageUploaded=callback(this,function(A,B){this.setImageForScene(A.sceneIndex,B)});this.onWizardNext=function(A){if(!defined(A.getNextPane())){A.addPane(new MaturePhotosPane(A))}}}}ClassFactory.createPackage("editor.plugins.tribute.wizard");ClassFactory.createClass(editor.plugins.tribute.wizard,"TeenagePhotosPane");with(editor.plugins.tribute.wizard){editor.plugins.tribute.wizard.TeenagePhotosPane.superClass=editor.plugins.tribute.wizard.TributeVideoScenesPane;editor.plugins.tribute.wizard.TeenagePhotosPane.constructor=function(){this.TeenagePhotosPane=function(A){arguments.callee.prototype.apply(this,[A,TeenagePhotosPane]);this.setStyleName("TributeVideoScenesPane");this.addStyleName("TeenagePhotosPane");this.setPrevPaneId(ChildhoodPhotosPane);this.setNextPaneId(AdultPhotosPane);this.setText("Upload teenage/student photos.")};this.onImageUploaded=callback(this,function(A,B){this.setImageForScene(A.sceneIndex,B)});this.onWizardNext=function(A){if(!defined(A.getNextPane())){A.addPane(new AdultPhotosPane(A))}}}}ClassFactory.createPackage("editor.plugins.tribute.wizard");ClassFactory.createClass(editor.plugins.tribute.wizard,"ChildhoodPhotosPane");with(editor.plugins.tribute.wizard){editor.plugins.tribute.wizard.ChildhoodPhotosPane.superClass=editor.plugins.tribute.wizard.TributeVideoScenesPane;editor.plugins.tribute.wizard.ChildhoodPhotosPane.constructor=function(){this.ChildhoodPhotosPane=function(A){arguments.callee.prototype.apply(this,[A,ChildhoodPhotosPane]);this.setStyleName("TributeVideoScenesPane");this.addStyleName("ChildhoodPhotosPane");this.setPrevPaneId(editor.ui.wizard.panes.VideoTypePane);this.setNextPaneId(TeenagePhotosPane);this.setText("Upload childhood photos.")};this.onImageUploaded=callback(this,function(A,B){this.setImageForScene(A.sceneIndex,B)});this.onWizardNext=function(A){if(!defined(A.getNextPane())){A.addPane(new TeenagePhotosPane(A))}}}}ClassFactory.createPackage("editor");ClassFactory.createClass(editor,"VideoWizard");with(editor){editor.VideoWizard.constructor=function(){this.coordinates={};this.start=function(x,y){this.coordinates={"x":x,"y":y};var frame=new editor.ui.DialogFrame();frame.setTitle("Add video to the webpage");frame.addCloseListener(this);var wizard=new editor.ui.wizard.VideoWizardDialog(frame);wizard.addWizardListener(this);frame.setContentWindow(wizard);frame.activate();frame.center();frame.doModal()};this.finish=function(wizard){var frame=wizard.getParent();frame.endModal();frame.close()};this.onFrameClose=function(frame){this.finish(frame.getContentWindow())};this.onWizardFinish=function(wizard){with(editor.ui.wizard.panes){var type=wizard.getPane(VideoTypePane).getSelectedType();if(VideoTypePane.TYPE_EMBED==type){if(!this.createEmbedVideo(wizard)){return }}else{this.createTributeVideo(wizard)}}this.finish(wizard)};this.onWizardSkip=function(wizard){with(editor.ui.wizard.panes){var type=wizard.getPane(VideoTypePane).getSelectedType();if(VideoTypePane.TYPE_CREATE==type){this.createTributeVideo(wizard)}}this.finish(wizard)};this.onWizardCancel=function(wizard){this.finish(wizard)};this.createEmbedVideo=function(wizard){with(editor.plugins.video){var pane=wizard.getPane(EmbedVideoPane);var params=pane.getMovieParams();if(!params){pane.setStatusMessage("String you entered is not a valid embed string.");return false}var video=new EmbedVideoBox();video.resize(params.width,params.height);video.setMovieUrl(params.url,params.flashVars);with(editor.commands){CommandHistory.get().execute(new AddCommand(video,this.coordinates.x,this.coordinates.y,"Add embed video"))}video.select();video.activate()}return true};this.createTributeVideo=function(wizard){wizard.endModal();var video=new editor.plugins.tribute.Video();with(editor.plugins.tribute.wizard){var subtitlesPane=wizard.getPane(TributeVideoSubtitlesPane);var paneIds=[ChildhoodPhotosPane,TeenagePhotosPane,AdultPhotosPane,MaturePhotosPane];for(var i=0;i<paneIds.length;i++){var pane=wizard.getPane(paneIds[i]);if(pane){video.periodPhotosCounter[i]=pane.scenes.length;for(var j=0;j<pane.scenes.length;j++){if(pane.scenes[j]){var scene=pane.scenes[j];video.addScene(scene);scene.setPeriod(i);if(subtitlesPane){for(var k=0;k<subtitlesPane.items.getContentWindow().getItemCount();k++){var item=subtitlesPane.items.getContentWindow().getItem(k);var s=item.scene;var text=item.textArea.getText();if(scene==s){scene.getSubtitles().setText(text)}}}}}}}var soundsPane=wizard.getPane(TributeVideoMusicPane);if(soundsPane){for(var i=0;i<soundsPane.sounds.length;i++){if(soundsPane.sounds[i]){var sound=soundsPane.sounds[i];video.addSound(sound)}}}if(!video.hasScenes()){video.addScene(new editor.plugins.tribute.Scene())}var box=new editor.plugins.tribute.TributeVideoBox();with(editor.commands){CommandHistory.get().execute(new AddCommand(box,this.coordinates.x,this.coordinates.y,"Add tribute video"))}box.show();box.select();box.activate();box.setVideo(video);box.edit()}}}}ClassFactory.createPackage("editor.plugins.tribute");ClassFactory.createClass(editor.plugins.tribute,"TributePlugin");with(editor.plugins.tribute){editor.plugins.tribute.TributePlugin.constructor=function(){this.TributePlugin=function(){editor.Application.getInstance().addAppListener(this)};this.onAppInitComplete=function(){var A=new editor.ui.ToolButton(this);A.addStyleName("TributeVideoIcon");A.setText("Video");A.setIcon("images/TributeVideoBox/icon.png");A.setToolTip("Add new video")};this.onToolButtonPressed=this.onToolButtonDropped=function(B,A,C){if(!defined(this.videoWizard)){this.videoWizard=new editor.VideoWizard()}this.videoWizard.start(A,C)}}}ClassFactory.createPackage("editor.plugins.video");ClassFactory.createClass(editor.plugins.video,"VideoPlugin");with(editor.plugins.video){editor.plugins.video.VideoPlugin.constructor=function(){this.VideoPlugin=function(){editor.Application.getInstance().addAppListener(this)}}}