aedilis=function(){function h(c){var a=typeof c;if(a==="object")if(c){if(typeof c.length==="number"&&!c.propertyIsEnumerable("length")&&typeof c.splice==="function")a="array"}else a="null";return a}function l(c){var a,b;if(typeOf(c)==="object")for(a in c){b=c[a];if(b!==undefined&&typeOf(b)!=="function")return false}return true}if(!String.prototype.entityify)String.prototype.entityify=function(){return this.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;")};if(!String.prototype.quote)String.prototype.quote=
function(){var c,a,b=this.length,d='"';for(a=0;a<b;a+=1){c=this.charAt(a);if(c>=" "){if(c==="\\"||c==='"')d+="\\";d+=c}else switch(c){case "\u0008":d+="\\b";break;case "\u000c":d+="\\f";break;case "\n":d+="\\n";break;case "\r":d+="\\r";break;case "\t":d+="\\t";break;default:c=c.charCodeAt();d+="\\u00"+Math.floor(c/16).toString(16)+(c%16).toString(16)}}return d+'"'};if(!String.prototype.format)String.prototype.format=function(c){return this.replace(/{([^{}]*)}/g,function(a,b){b=c[b];return typeof b===
"string"||typeof b==="number"?b:a})};if(!String.prototype.trim)String.prototype.trim=function(){return this.replace(/^\s*(\S*(?:\s+\S+)*)\s*$/,"$1")};var j=function(){},g=function(){},m=function(){},e=function(){};try{if(log.debug){j=function(c){log.debug(c)};g=function(c){log.info(c)};m=function(c){log.warn(c)};e=function(c){log.error(c)}}}catch(i){}var n=function(c){function a(){}a.prototype=c;return new a};return{debug:j,info:g,warn:m,error:e,chain:function(c,a,b){var d=a.callee.overrides;a=b||
a;if(d)return d.apply(c,a);else throw"ChainError";},getType:function(c){if(c===null)return"null";var a=typeof c;if(a!="object")return a;a=Object.prototype.toString.apply(c);a=a.substring(8,a.length-1);if(a!="Object")return a;if(c.constructor&&c.constructor.classname&&typeof c.constructor.classname=="string")return c.constructor.classname;return"<unknown type>"},isUndefined:function(c){return typeof c==="undefined"||c===null},isEmptyOrNull:function(c){if(c===undefined)return true;if(c===null)return true;
var a=typeof c;if(a=="function")return false;if(c instanceof Date||a=="date")return false;if(c instanceof Number||a=="number")return false;if(c instanceof String||a=="string")return c.length===0;if(c instanceof Array)return c.length<=0;a=0;for(var b in c)if(!(b=="constructor"||b=="prototype"))if(typeof c[b]!="function")a+=1;return a===0},typeOf:h,isEmpty:l,defineClass:function(c){var a=c.extend,b=a||Object,d=c.init,k=c.name||"Unnamed class",q=c.methods||{},f=c.statics||{};c=function(){a&&a.apply(this,
arguments);d&&d.apply(this,arguments)};if(f)for(var o in f)c[o]=f[o];c.superclass=b;c.classname=k;b=b==Object?{}:n(b.prototype);for(var p in q)if(p!="toString"){k=q[p];if(typeof k=="function"){k.overrides=b[p];k.name=p;k.owner=c}b[p]=k}if(q.hasOwnProperty("toString")){q.toString.overrides=b.toString;q.toString.name="toString";q.toString.owner=c;b.toString=q.toString}b.constructor=c;c.prototype=b;return c}}}();
(function(h){h.html=function(){var l=h.defineClass,j=function(f,o){f=f||{};for(var p in o)f[p]=o[p];return f},g=l({name:"Tag",init:function(f,o){this.tag=f;this.attributes=o;this._postText=this._text="";this.children=[];this.can_close=false},methods:{id:function(f){if(!this.attributes)this.attributes={};this.attributes.id=f;return this},cls:function(f){if(!this.attributes)this.attributes={};this.attributes.class_=f;return this},renderAttributes:function(){if(this.attributes===undefined||this.attributes.length===
0)return"";var f=[];for(var o in this.attributes)f.push(o.replace("_","")+'="'+this.attributes[o]+'"');return" "+f.join(" ")},add:function(f,o){var p=null;p=f instanceof g?f:new g(f,o);this.children.push(p);return p},text:function(f){this._text=f;return this},postText:function(f){this._postText=f;return this},renderChildren:function(){for(var f=[],o=0;o<this.children.length;o++)f.push(this.children[o].toString());return f.join("")},hasContent:function(){return this._text!=""||this._postText!=""||
this.children.length>0},toString:function(){return this.html()},html:function(){var f="";f+="<"+this.tag+this.renderAttributes();if(this.hasContent()||!this.can_close)f=f+">"+this._text+this.renderChildren()+this._postText+"</"+this.tag+">";else f+=" />";return f}}}),m=l({name:"A",extend:g,init:function(){this.tag="a";if(!this.attributes)this.attributes={};if(!this.attributes.href)this.attributes.href="#"},methods:{href:function(f){if(!this.attributes)this.attributes={};this.attributes.href=f}}}),
e=l({name:"UL",extend:g,init:function(){this.tag="ul"},methods:{li:function(f){return this.add("li",f)}}}),i=l({name:"LI",extend:g,init:function(){this.tag="li"}}),n=l({name:"DIV",extend:g,init:function(){this.tag="div"}}),c=l({name:"SPAN",extend:g,init:function(){this.tag="span"}}),a=l({name:"LABEL",extend:g,init:function(){this.tag="label"},methods:{isfor:function(f){if(!this.attributes)this.attributes={};this.attributes.for_=f;return this}}}),b=l({name:"HR",extend:g,init:function(){this.tag="hr";
this.can_close=true}}),d=l({name:"INPUT",extend:g,init:function(f,o,p){this.tag="input";this.attributes=j(p,{type:f});this.can_close=o||false},methods:{name:function(f){if(!this.attributes)this.attributes={};this.attributes.name=f;return this},value:function(f){if(!this.attributes)this.attributes={};this.attributes.value=f;return this}}}),k=l({name:"TEXT",extend:d,init:function(f){this.attributes=j(f,{type:"text"});this.can_close=true}}),q=l({name:"HIDDEN",extend:d,init:function(){this.attributes.type=
"hidden";this.can_close=true}});l=l({name:"BUTTON",extend:d,init:function(){this.tag="button";this.attributes.type="button"}});return{Tag:g,A:m,DIV:n,SPAN:c,HR:b,UL:e,LI:i,LABEL:a,INPUT:d,TEXT:k,HIDDEN:q,BUTTON:l}}()})(aedilis);
(function(h){h.objframe=function(){function l(){this.name="ObjFrame";this.init=function(a,b){this.obj=a;this.objIdentifier=b;this.editorId=this.setIdFrom([this.objTypeIdentifier,"editor"]);this.editorSaveId=this.setIdFrom([this.objTypeIdentifier,"editor","save","button"]);this.editorCancelId=this.setIdFrom([this.objTypeIdentifier,"editor","cancel","button"]);this.editorExitId=this.setIdFrom([this.objTypeIdentifier,"editor","exit","button"]);this.formId=this.setIdFrom([this.objTypeIdentifier,"form",
this.objIdentifier]);this.viewId=this.setIdFrom([this.objTypeIdentifier,"view",this.objIdentifier]);this.viewClass=this.setIdFrom([this.objTypeIdentifier,"view","class"]);this.viewRemoveId=this.setIdFrom([this.objTypeIdentifier,"view","remove",this.objIdentifier]);this.viewEditId=this.setIdFrom([this.objTypeIdentifier,"view","edit",this.objIdentifier]);this.removeViewId=this.removeViewId.format(this);this.removeEditorId=this.removeEditorId.format(this);if(this.editorDialogId==="")this.editorDialogId=
this.editorId};this.setIdFrom=function(a){var b=[this.objIdPrefix];for(var d in a)b.push(a[d]);return b.join("_")};this.getIdFrom=function(a){return g+this.setIdFrom(a)};this.setEditorPropertyId=function(a){return this.setIdFrom([this.objTypeIdentifier,"editor",a])};this.getEditorPropertyId=function(a){return g+this.setEditorPropertyId(a)};this.setViewPropertyId=function(a){return this.setIdFrom([this.objTypeIdentifier,"view",a,this.objIdentifier])};this.getViewPropertyId=function(a){return g+this.setViewPropertyId(a)};
this.setFormPropertyId=function(a){return this.setIdFrom([this.objTypeIdentifier,"form",a,this.objIdentifier])};this.getFormPropertyId=function(a){return g+this.setFormPropertyId(a)};this.idExists=function(a){return $(g+a).length>0};this.createEditor=function(){this.idExists(this.editorId)||$("body").append(this.editorHtml());if(!this.editorDialog){h.debug("creating new dialog: "+this.editorDialogId);this.editorDialog=new h.dialog(g+this.editorDialogId,this.dialogOptions)}};this.editor=function(a){a==
"open"?this.editorDialog.open():this.editorDialog.close();return false};this.createForm=function(){h.debug("createForm()");if(!this.idExists(this.formId)){h.debug("adding "+this.formId+" to DOM");$(g+this.objFormLocation).append(this.formHtml())}h.debug("calling updateForm");this.updateForm()};this.createView=function(){if(!this.idExists(this.viewId)){$(g+this.objViewLocation).before(this.viewHtml());this.bindRemoveTag();this.bindEditTag()}h.debug("calling updateView");this.updateView()};this.bindRemoveTag=
function(){h.debug("Binding Remove Tag");var a=this;$(g+this.viewRemoveId).click(function(){a.remove()})};this.bindEditTag=function(){h.debug("Binding Edit Tag");var a=this;$(g+this.viewEditId).click(function(){a.edit();return false})};this.bindSaveTag=function(){h.debug("Binding Save Tag");var a=this;h.debug(this.editorSaveId);$(g+this.editorSaveId).unbind("click");$(g+this.editorSaveId).bind("click",function(){h.debug("Saving editor info");a.editorValidation()&&a.save();return false})};this.bindCancelTag=
function(){h.debug("Binding Cancel Tag");var a=this;$(g+this.editorCancelId).unbind("click");$(g+this.editorCancelId).bind("click",function(){a.cancel()});return false};this.bindExitTag=function(){h.debug("Binding Exit Tag");var a=this;$(g+this.editorExitId).unbind("click");$(g+this.editorExitId).bind("click",function(){a.cancel()})};this.getObjMap=function(){return this.objMap};this.iterObjMap=function(a){var b=this.getObjMap();for(var d in b)a(d,b[d])};this.updateObject=function(){h.debug("ObjFrame.updateObject");
var a=this;this.iterObjMap(function(b,d){h.debug(b);h.debug(d);var k=a.getEditorPropertyId(b);k=d.inputGetter(k);d.setter(a.obj,b,k)})};this.updateEditor=function(){var a=this;this.iterObjMap(function(b,d){var k=a.getEditorPropertyId(b);b=d.getter("editor",a.obj,b);h.debug(k+" -> "+b);d.inputSetter(k,b)})};this.resetEditor=function(){this.editorReset()};this.updateForm=function(){var a=this;this.iterObjMap(function(b,d){var k=a.getFormPropertyId(b);h.debug("update form: "+k);b=d.getter("form",a.obj,
b);$(k).attr("value",b)})};this.updateView=function(){var a=this;this.iterObjMap(function(b,d){var k=a.getViewPropertyId(b);h.debug("update view: "+k);b=d.getter("view",a.obj,b);$(k).html(b)})};this.setFocus=function(){};this.focusOnView=function(){this.setFocus(g+this.viewId)};this.setSibling=function(){this.sibling=$(g+this.viewId).next();if(this.sibling===null)this.sibling=$(g+this.objViewLocation)};this.focusOnSibling=function(){this.setFocus(this.sibling)};this.removeEditor=function(){$(g+this.removeEditorId).remove();
return false};this.removeForm=function(){$(g+this.formId).remove();return false};this.removeView=function(){$(g+this.removeViewId).remove();return false};this.edit=function(){this.createEditor();this.resetEditor();this.bindSaveTag();this.bindCancelTag();this.bindExitTag();this.updateEditor();this.editor("open")};this.save=function(){this.updateObject();this.createForm();this.createView();this.editor("close");this.afterObjSave();this.focusOnView()};this.cancel=function(){this.editor("close")};this.remove=
function(){this.setSibling();this.removeForm();this.removeView();this.obj=null;this.afterObjRemove();this.focusOnSibling();return false}}var j=h.html,g="#",m=function(a,b,d){d=d.split("_");for(a=0;a<d.length;a++)b=b[d[a]];return b},e=function(a,b,d){b=b.split("_");last=b.slice(-1);first=b.slice(0,-1);a=a;for(b=0;b<first.length;b++)a=a[first[b]];a[last]=d},i=function(a,b){$(a).attr("value",b)},n=function(a){return $(a).attr("value")},c={dialogOptions:{},objMap:{},objFormLocation:"change",objViewLocation:"change",
objIdPrefix:"aedilis_objframe",objTypeIdentifier:"object",objEditorDialogId:"",objRemoveViewId:"{viewId}",objRemoveEditorId:"{editorId}",objEditorValidation:function(){return function(){h.debug("Default Editor Validation");return true}},objEditorReset:function(){return function(){h.debug("Default Editor Reset");$(g+this.editorId).each(function(){this.reset()})}},objEditorHtml:function(){return function(){var a=(new j.UL).id(this.editorId);for(var b in this.getObjMap()){var d=a.add((new j.LI).cls("entry"));
d.add("label").text(this.objMap[b].label);d=d.add(new j.TEXT);d.id(this.setIdFrom([this.objTypeIdentifier,"editor",b]));d.name(d.attributes.id)}b=(new j.BUTTON).id(this.editorId+"_save_button");b.text("Save");a.add(b);h.debug(a.html());return a.html()}},objViewHtml:function(){return function(){var a=(new j.UL).id(this.viewId).cls(this.viewClass);a.add((new j.A).text("remove").id(this.viewRemoveId));a.add((new j.A).text("edit").id(this.viewEditId));for(var b in this.getObjMap()){var d=this.setViewPropertyId(b),
k=a.add(new j.LI),q=k.add(new j.LABEL);q.isfor(d);q.text(this.objMap[b].label);k.add((new j.SPAN).id(d))}h.debug(a.html());return a.html()}},objFormHtml:function(){return function(){var a=(new j.DIV).id(this.formId);for(var b in this.getObjMap()){var d=this.setFormPropertyId(b),k=a.add(new j.HIDDEN);k.id(d);k.cls("form-object");k.name(d)}h.debug(a.html());return a.html()}},objAfterObjSave:function(){return function(){}},objAfterObjRemove:function(){return function(){}}};return{FrameManager:h.defineClass({init:function(){var a=
arguments.length===0?{}:arguments[0];this.options={};$.extend(true,this.options,c,a);this.objCounter=0;this.objframe=new l;this.objframe.dialogOptions=this.options.dialogOptions;this.objframe.editorDialogId=this.options.objEditorDialogId;this.objframe.objIdPrefix=this.options.objIdPrefix;this.objframe.objTypeIdentifier=this.options.objTypeIdentifier;this.objframe.editorHtml=this.options.objEditorHtml();this.objframe.viewHtml=this.options.objViewHtml();this.objframe.formHtml=this.options.objFormHtml();
this.objframe.editorValidation=this.options.objEditorValidation();this.objframe.editorReset=this.options.objEditorReset();this.objframe.afterObjSave=this.options.objAfterObjSave();this.objframe.afterObjRemove=this.options.objAfterObjRemove();this.objframe.removeViewId=this.options.objRemoveViewId;this.objframe.removeEditorId=this.options.objRemoveEditorId;this.objframe.objFormLocation=this.options.objFormLocation=="change"?this.options.objIdPrefix+"_"+this.options.objTypeIdentifier+"_forms_here":
this.options.objFormLocation;this.objframe.objViewLocation=this.options.objViewLocation=="change"?this.options.objIdPrefix+"_"+this.options.objTypeIdentifier+"_views_here":this.options.objViewLocation;this.objMapInitialized=false;this.objframe.objMap={};this.ObjFrame=function(){};this.ObjFrame.prototype=this.objframe},methods:{newObj:function(a,b){h.debug("calling newObj");if(!b){this.objCounter+=1;b=this.objCounter}h.debug("creating new ObjFrame");var d=new this.ObjFrame;h.debug("initializing new ObjFrame");
d.init(a,b);return d},initObjMap:function(a){if(!this.objMapInitialized){var b=this.objframe.objMap;if($.isEmptyObject(this.options.objMap))for(var d in a){if(typeof a[d]!="function")b[d]={view:true,label:d.toUpperCase()+":",getter:m,setter:e,inputGetter:n,inputSetter:i}}else{$.extend(true,b,this.options.objMap);for(d in b){if(!b[d].view)b[d].view=true;if(!b[d].label)b[d].label="";if(!b[d].getter)b[d].getter=m;if(!b[d].setter)b[d].setter=e;if(!b[d].inputGetter)b[d].inputGetter=n;if(!b[d].inputSetter)b[d].inputSetter=
i}}this.objframe.objMap=b;this.objMapInitialized=true}},load:function(a){this.initObjMap(a);var b=new this.ObjFrame;b.init(a,"nan");b.createEditor()}}}),mergeOptions:function(a){newOptions={};$.extend(true,newOptions,c,a);return newOptions}}}()})(aedilis);
(function(h){h.dialog=function(){function l(e){if(e.slice(0,1)==="#")return e.slice(1,e.length);return e}function j(e){return"#"+e}var g=h.defineClass({name:"Point",init:function(e,i,n,c){this.left=e;this.top=i;this.windowWidth=n;this.windowHeight=c}}),m={name:"",imagePath:"/static/images/overlay.png"};return h.defineClass({name:"Dialog",init:function(e,i){h.debug("INITIALIZING DIALOG");this.options={};$.extend(this.options,m,i);if(this.options.name===""){i=$(e).attr("id");if(i==="")throw"A dialog element must have a unique id.";
this.options.name=i}this.name=this.options.name;this.elementId=l(e);this.dialogId=this.name+"-dialog-box";this.dialogBgId=this.name+"-dialog-background";this.visible=false;this.imagePath=this.options.imagePath;(new Image).src=this.imagePath;$(j(this.elementId)).wrap('<div id="'+this.dialogBgId+'"><div id="'+this.dialogId+'"></div></div>');this.setBackground();this.setForeground();var n=this;$(window).resize(function(){n.visible&&n.setPosition()});$(window).scroll(function(){n.visible&&n.setPosition()});
this.close()},methods:{setBackground:function(){$(j(this.dialogBgId)).css({display:"block",position:"fixed",top:"0",left:"0",height:"2000px",width:"1000px",background:"url("+this.imagePath+") repeat","z-index":"88888"})},setForeground:function(){$(j(this.dialogId)).css({display:"block",position:"fixed","z-index":"99999"})},calcPosition:function(e,i){var n=$(j(this.dialogId)).outerHeight(),c=$(j(this.dialogId)).outerWidth();n=e/2-n/2;c=i/2-c/2;n=n<0?0:n;c=c<0?0:c;return new g(c,n,i,e)},setPosition:function(){var e=
$(window).height(),i=$(window).width();$(window).scrollTop();$(j(this.dialogBgId)).css({display:"block",height:e+"px",width:i+"px"});e=this.calcPosition(e,i);$(j(this.dialogId)).css({display:"block",left:e.left,top:e.top})},open:function(){this.setPosition();this.visible=true},close:function(){$(j(this.dialogId)).css({display:"none"});$(j(this.dialogBgId)).css({display:"none"});this.visible=false}}})}()})(aedilis);
(function(h){h.corners=function(){var l={tableId:"",tableClass:"",tableClassInner:"",altClass:"",altClassInner:"",tableBackground:"transparent",tableColor:"white",tableBorder:"1px solid black",tableOuterBorder:"none",imageRadius:"5",imageUrl:""},j=function(m,e){var i={};m=$(m).attr("id");$.extend(i,l,e);if(m!==""){i.tableId='id="'+m+'-container" ';i.tableClass=" "+m+"-container";i.tableClassInner=i.tableClass+"-inner"}if(i.altClass!=="")i.altClassInner=i.altClass+"-inner";if(i.imageUrl!==""&&i.imageUrl.indexOf("url")===
-1)i.imageUrl="url("+i.imageUrl+")";return i},g=function(){return $.browser.msie&&$.browser.version<8};return{apply:function(m,e){if(g()){e.imageUrl="";e.tableOuterBorder=e.tableBorder;e.tableBorder="none"}$(m).each(function(){e=j(this,e);e.TOPROW="";e.LEFTCOLUMN="";e.RIGHTCOLUMN="";e.INNERHTML="";$(this).wrap('<table {tableId} class="{altClass} {tableClass}" style="background:{tableBackground};padding:0;border-collapse:separate;border:{tableOuterBorder};" cellpadding="0" cellspacing="0">{TOPROW}<tr style="background:{tableColor};">{LEFTCOLUMN}<td class="{altClassInner} {tableClassInner}">{INNERHTML}</td>{RIGHTCOLUMN}</tr><tr><td style="background:transparent {imageUrl} no-repeat bottom left;width:{imageRadius}px;height:{imageRadius}px;"></td><td style="background:{tableColor};border-bottom:{tableBorder};"><div></div></td><td style="background:transparent {imageUrl} no-repeat bottom right;width:{imageRadius}px;height:{imageRadius}px;"></td></tr></table>'.format(e));
var i=$(this).parent();i.parent().parent().prepend('<tr><td style="background:transparent {imageUrl} no-repeat top left;width:{imageRadius}px;height:{imageRadius}px;"></td><td style="background:{tableColor};border-top:{tableBorder};"></td><td style="background:transparent {imageUrl} no-repeat top right;width:{imageRadius}px;height:{imageRadius}px;"></td></tr>'.format(e));i.before('<td style="background:{tableColor};border-left:{tableBorder};width:{imageRadius}px;"></td>'.format(e));i.after('<td style="background:{tableColor};border-right:{tableBorder};width:{imageRadius}px;"></td>'.format(e))})},
wrap:function(m,e){if(g()){e.imageUrl="";e.tableOuterBorder=e.tableBorder;e.tableBorder="none"}e=j(m,e);return'<table {tableId} class="{altClass} {tableClass}" style="background:{tableBackground};padding:0;border-collapse:separate;border:{tableOuterBorder};" cellpadding="0" cellspacing="0">{TOPROW}<tr style="background:{tableColor};">{LEFTCOLUMN}<td class="{altClassInner} {tableClassInner}">{INNERHTML}</td>{RIGHTCOLUMN}</tr><tr><td style="background:transparent {imageUrl} no-repeat bottom left;width:{imageRadius}px;height:{imageRadius}px;"></td><td style="background:{tableColor};border-bottom:{tableBorder};"><div></div></td><td style="background:transparent {imageUrl} no-repeat bottom right;width:{imageRadius}px;height:{imageRadius}px;"></td></tr></table>'.format({TOPROW:'<tr><td style="background:transparent {imageUrl} no-repeat top left;width:{imageRadius}px;height:{imageRadius}px;"></td><td style="background:{tableColor};border-top:{tableBorder};"></td><td style="background:transparent {imageUrl} no-repeat top right;width:{imageRadius}px;height:{imageRadius}px;"></td></tr>',
LEFTCOLUMN:'<td style="background:{tableColor};border-left:{tableBorder};width:{imageRadius}px;"></td>',RIGHTCOLUMN:'<td style="background:{tableColor};border-right:{tableBorder};width:{imageRadius}px;"></td>',INNERHTML:m}).format(e)}}}()})(aedilis);

