/*
 Rangy, a cross-browser JavaScript range and selection library
 http://code.google.com/p/rangy/

 Copyright 2011, Tim Down
 Licensed under the MIT license.
 Version: 1.2.1
 Build date: 8 October 2011
 MIT License {@link http://creativecommons.org/licenses/MIT/}
 @return {String} outerHtml
 jquery.layout 1.3.0 - Release Candidate 30.51
 $Date: 2012-05-12 08:00:00 (Sat, 12 May 2012) $
 $Rev: 303005 $

 Copyright (c) 2012 
   Fabrizio Balliano (http://www.fabrizioballiano.net)
   Kevin Dalman (http://allpro.net)

 Dual licensed under the GPL (http://www.gnu.org/licenses/gpl.html)
 and MIT (http://www.opensource.org/licenses/mit-license.php) licenses.

 Changelog: http://layout.jquery-dev.net/changelog.cfm#1.3.0.rc30.5

 Docs: http://layout.jquery-dev.net/documentation.html
 Tips: http://layout.jquery-dev.net/tips.html
 Help: http://groups.google.com/group/jquery-ui-layout
 RequireJS i18n 2.0.1 Copyright (c) 2010-2012, The Dojo Foundation All Rights Reserved.
 Available via the MIT or new BSD license.
 see: http://github.com/requirejs/i18n for details
*/
(function(){function za(m,e){var a,g;g=m||{};this.jQuery=e||{};this.config={};this.config.elements=g.elements?g.elements:[];this.config.attributes=g.attributes?g.attributes:{};this.config.attributes[za.ALL]=this.config.attributes[za.ALL]?this.config.attributes[za.ALL]:[];this.config.allow_comments=g.allow_comments?g.allow_comments:!1;this.allowed_elements={};this.config.protocols=g.protocols?g.protocols:{};this.config.add_attributes=g.add_attributes?g.add_attributes:{};this.dom=g.dom?g.dom:document;
for(a=0;a<this.config.elements.length;a++)this.allowed_elements[this.config.elements[a]]=!0;this.config.remove_element_contents={};this.config.remove_all_contents=!1;if(g.remove_contents)if(g.remove_contents instanceof Array)for(a=0;a<g.remove_contents.length;a++)this.config.remove_element_contents[g.remove_contents[a]]=!0;else this.config.remove_all_contents=!0;this.transformers=g.transformers?g.transformers:[];this.filters=g.filters?g.filters:[]}var la;la||(la={});(function(){function m(a){return 10>
a?"0"+a:a}function e(a){c.lastIndex=0;return c.test(a)?'"'+a.replace(c,function(a){var b=l[a];return"string"===typeof b?b:"\\u"+("0000"+a.charCodeAt(0).toString(16)).slice(-4)})+'"':'"'+a+'"'}function a(k,d){var c,l,g,p,u=b,t,y=d[k];y&&("object"===typeof y&&"function"===typeof y.toJSON)&&(y=y.toJSON(k));"function"===typeof f&&(y=f.call(d,k,y));switch(typeof y){case "string":return e(y);case "number":return isFinite(y)?""+y:"null";case "boolean":case "null":return""+y;case "object":if(!y)return"null";
b+=j;t=[];if("[object Array]"===Object.prototype.toString.apply(y)){p=y.length;for(c=0;c<p;c+=1)t[c]=a(c,y)||"null";g=0===t.length?"[]":b?"[\n"+b+t.join(",\n"+b)+"\n"+u+"]":"["+t.join(",")+"]";b=u;return g}if(f&&"object"===typeof f){p=f.length;for(c=0;c<p;c+=1)"string"===typeof f[c]&&(l=f[c],(g=a(l,y))&&t.push(e(l)+(b?": ":":")+g))}else for(l in y)Object.prototype.hasOwnProperty.call(y,l)&&(g=a(l,y))&&t.push(e(l)+(b?": ":":")+g);g=0===t.length?"{}":b?"{\n"+b+t.join(",\n"+b)+"\n"+u+"}":"{"+t.join(",")+
"}";b=u;return g}}"function"!==typeof Date.prototype.toJSON&&(Date.prototype.toJSON=function(){return isFinite(this.valueOf())?this.getUTCFullYear()+"-"+m(this.getUTCMonth()+1)+"-"+m(this.getUTCDate())+"T"+m(this.getUTCHours())+":"+m(this.getUTCMinutes())+":"+m(this.getUTCSeconds())+"Z":null},String.prototype.toJSON=Number.prototype.toJSON=Boolean.prototype.toJSON=function(){return this.valueOf()});var g=/[\u0000\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,
c=/[\\\"\x00-\x1f\x7f-\x9f\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,b,j,l={"":"\\b","\t":"\\t","\n":"\\n","":"\\f","\r":"\\r",'"':'\\"',"\\":"\\\\"},f;"function"!==typeof la.stringify&&(la.stringify=function(k,d,c){var l;j=b="";if(typeof c==="number")for(l=0;l<c;l=l+1)j=j+" ";else typeof c==="string"&&(j=c);if((f=d)&&typeof d!=="function"&&(typeof d!=="object"||typeof d.length!=="number"))throw Error("JSON.stringify");return a("",{"":k})});
"function"!==typeof la.parse&&(la.parse=function(a,b){function f(a,k){var c,j,l=a[k];if(l&&typeof l==="object")for(c in l)if(Object.prototype.hasOwnProperty.call(l,c)){j=f(l,c);j!==void 0?l[c]=j:delete l[c]}return b.call(a,k,l)}var c,a=""+a;g.lastIndex=0;g.test(a)&&(a=a.replace(g,function(a){return"\\u"+("0000"+a.charCodeAt(0).toString(16)).slice(-4)}));if(/^[\],:{}\s]*$/.test(a.replace(/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g,"@").replace(/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g,
"]").replace(/(?:^|:|,)(?:\s*\[)+/g,""))){c=eval("("+a+")");return typeof b==="function"?f({"":c},""):c}throw new SyntaxError("JSON.parse");})})();define("util/json2",[],function(){return la});(function(){var m=function(){function e(a,b){var f=typeof a[b];return f==d||!!(f==k&&a[b])||"unknown"==f}function a(a,b){return!!(typeof a[b]==k&&a[b])}function g(a,b){return typeof a[b]!=q}function c(a){return function(b,d){for(var f=d.length;f--;)if(!a(b,d[f]))return!1;return!0}}function b(a){return a&&t(a,
u)&&z(a,p)}function j(a){window.alert("Rangy not supported in your browser. Reason: "+a);m.initialized=!0;m.supported=!1}function l(){if(!m.initialized){var d,f=!1,k=!1;e(document,"createRange")&&(d=document.createRange(),t(d,r)&&z(d,o)&&(f=!0),d.detach());if((d=a(document,"body")?document.body:document.getElementsByTagName("body")[0])&&e(d,"createTextRange"))d=d.createTextRange(),b(d)&&(k=!0);!f&&!k&&j("Neither Range nor TextRange are implemented");m.initialized=!0;m.features={implementsDomRange:f,
implementsTextRange:k};f=A.concat(v);k=0;for(d=f.length;k<d;++k)try{f[k](m)}catch(c){a(window,"console")&&e(window.console,"log")&&window.console.log("Init listener threw an exception. Continuing.",c)}}}function f(a){this.name=a;this.supported=this.initialized=!1}var k="object",d="function",q="undefined",o="startContainer startOffset endContainer endOffset collapsed commonAncestorContainer START_TO_START START_TO_END END_TO_START END_TO_END".split(" "),r="setStart setStartBefore setStartAfter setEnd setEndBefore setEndAfter collapse selectNode selectNodeContents compareBoundaryPoints deleteContents extractContents cloneContents insertNode surroundContents cloneRange toString detach".split(" "),
p="boundingHeight boundingLeft boundingTop boundingWidth htmlText text".split(" "),u="collapse compareEndPoints duplicate getBookmark moveToBookmark moveToElementText parentElement pasteHTML select setEndPoint getBoundingClientRect".split(" "),t=c(e),y=c(a),z=c(g),m={version:"1.2.1",initialized:!1,supported:!0,util:{isHostMethod:e,isHostObject:a,isHostProperty:g,areHostMethods:t,areHostObjects:y,areHostProperties:z,isTextRange:b},features:{},modules:{},config:{alertOnWarn:!1,preferTextRange:!0}};
m.fail=j;m.warn=function(a){a="Rangy warning: "+a;m.config.alertOnWarn?window.alert(a):typeof window.console!=q&&typeof window.console.log!=q&&window.console.log(a)};({}).hasOwnProperty?m.util.extend=function(a,b){for(var d in b)b.hasOwnProperty(d)&&(a[d]=b[d])}:j("hasOwnProperty not supported");var v=[],A=[];m.init=l;m.addInitListener=function(a){m.initialized?a(m):v.push(a)};var B=[];m.addCreateMissingNativeApiListener=function(a){B.push(a)};m.createMissingNativeApi=function(a){a=a||window;l();
for(var b=0,d=B.length;b<d;++b)B[b](a)};f.prototype.fail=function(a){this.initialized=!0;this.supported=!1;throw Error("Module '"+this.name+"' failed to load: "+a);};f.prototype.warn=function(a){m.warn("Module "+this.name+": "+a)};f.prototype.createError=function(a){return Error("Error in Rangy "+this.name+" module: "+a)};m.createModule=function(a,b){var d=new f(a);m.modules[a]=d;A.push(function(a){b(a,d);d.initialized=!0;d.supported=!0})};m.requireModules=function(a){for(var b=0,d=a.length,k,c;b<
d;++b){c=a[b];k=m.modules[c];if(!k||!(k instanceof f))throw Error("Module '"+c+"' not found");if(!k.supported)throw Error("Module '"+c+"' not supported");}};var E=!1,y=function(){E||(E=!0,m.initialized||l())};if(typeof window==q)j("No window found");else if(typeof document==q)j("No document found");else return e(document,"addEventListener")&&document.addEventListener("DOMContentLoaded",y,!1),e(window,"addEventListener")?window.addEventListener("load",y,!1):e(window,"attachEvent")?window.attachEvent("onload",
y):j("Window does not have required addEventListener or attachEvent method"),m}();m.createModule("DomUtil",function(e,a){function g(a){for(var b=0;a=a.previousSibling;)b++;return b}function c(a,b){var d=[],f;for(f=a;f;f=f.parentNode)d.push(f);for(f=b;f;f=f.parentNode)if(m(d,f))return f;return null}function b(a,b,d){for(d=d?a:a.parentNode;d;){a=d.parentNode;if(a===b)return d;d=a}return null}function j(a){a=a.nodeType;return 3==a||4==a||8==a}function l(a,b){var d=b.nextSibling,f=b.parentNode;d?f.insertBefore(a,
d):f.appendChild(a);return a}function f(a){if(9==a.nodeType)return a;if(typeof a.ownerDocument!=p)return a.ownerDocument;if(typeof a.document!=p)return a.document;if(a.parentNode)return f(a.parentNode);throw Error("getDocument: no document found for node");}function k(a){if(a)return a.previousSibling?a.previousSibling.nextSibling:a.nextSibling?a.nextSibling.previousSibling:a.parentNode?a.parentNode.firstChild:a}function d(a){return!a?"[No node]":j(a)?'"'+a.data+'"':1==a.nodeType?"<"+a.nodeName+(a.id?
' id="'+a.id+'"':"")+">["+a.childNodes.length+"]":a.nodeName}function q(a){this._next=this.root=a}function o(a,b){this.node=a;this.offset=b}function r(a){this.code=this[a];this.codeName=a;this.message="DOMException: "+this.codeName}var p="undefined",u=e.util;u.areHostMethods(document,["createDocumentFragment","createElement","createTextNode"])||a.fail("document missing a Node creation method");u.isHostMethod(document,"getElementsByTagName")||a.fail("document missing getElementsByTagName method");
var t=document.createElement("div");u.areHostMethods(t,["insertBefore","appendChild","cloneNode"])||a.fail("Incomplete Element implementation");u.isHostProperty(t,"innerHTML")||a.fail("Element is missing innerHTML property");t=document.createTextNode("test");u.areHostMethods(t,["splitText","deleteData","insertData","appendData","cloneNode"])||a.fail("Incomplete Text Node implementation");var m=function(a,b){for(var d=a.length;d--;)if(a[d]===b)return!0;return!1};q.prototype={_current:null,hasNext:function(){return!!this._next},
next:function(){var a=this._current=this._next,b;if(this._current){b=a.firstChild;if(!b)for(b=null;a!==this.root&&!(b=a.nextSibling);)a=a.parentNode;this._next=b}return this._current},detach:function(){this._current=this._next=this.root=null}};o.prototype={equals:function(a){return this.node===a.node&this.offset==a.offset},inspect:function(){return"[DomPosition("+d(this.node)+":"+this.offset+")]"}};r.prototype={INDEX_SIZE_ERR:1,HIERARCHY_REQUEST_ERR:3,WRONG_DOCUMENT_ERR:4,NO_MODIFICATION_ALLOWED_ERR:7,
NOT_FOUND_ERR:8,NOT_SUPPORTED_ERR:9,INVALID_STATE_ERR:11};r.prototype.toString=function(){return this.message};e.dom={arrayContains:m,isHtmlNamespace:function(a){var b;return typeof a.namespaceURI==p||null===(b=a.namespaceURI)||"http://www.w3.org/1999/xhtml"==b},parentElement:function(a){a=a.parentNode;return 1==a.nodeType?a:null},getNodeIndex:g,getNodeLength:function(a){var b;return j(a)?a.length:(b=a.childNodes)?b.length:0},getCommonAncestor:c,isAncestorOf:function(a,b,d){for(b=d?b:b.parentNode;b;){if(b===
a)return!0;b=b.parentNode}return!1},getClosestAncestorIn:b,isCharacterDataNode:j,insertAfter:l,splitDataNode:function(a,b){var d=a.cloneNode(!1);d.deleteData(0,b);a.deleteData(b,a.length-b);l(d,a);return d},getDocument:f,getWindow:function(a){a=f(a);if(typeof a.defaultView!=p)return a.defaultView;if(typeof a.parentWindow!=p)return a.parentWindow;throw Error("Cannot get a window object for node");},getIframeWindow:function(a){if(typeof a.contentWindow!=p)return a.contentWindow;if(typeof a.contentDocument!=
p)return a.contentDocument.defaultView;throw Error("getIframeWindow: No Window object found for iframe element");},getIframeDocument:function(a){if(typeof a.contentDocument!=p)return a.contentDocument;if(typeof a.contentWindow!=p)return a.contentWindow.document;throw Error("getIframeWindow: No Document object found for iframe element");},getBody:function(a){return u.isHostObject(a,"body")?a.body:a.getElementsByTagName("body")[0]},getRootContainer:function(a){for(var b;b=a.parentNode;)a=b;return a},
comparePoints:function(a,d,f,j){var a=k(a),f=k(f),l;if(a==f)return d===j?0:d<j?-1:1;if(l=b(f,a,!0))return d<=g(l)?-1:1;if(l=b(a,f,!0))return g(l)<j?-1:1;d=c(a,f);a=a===d?d:b(a,d,!0);f=f===d?d:b(f,d,!0);if(a===f)throw Error("comparePoints got to case 4 and childA and childB are the same!");for(d=d.firstChild;d;){if(d===a)return-1;if(d===f)return 1;d=d.nextSibling}throw Error("Should not be here!");},inspectNode:d,fragmentFromNodeChildren:function(a){for(var b=f(a).createDocumentFragment(),d;d=a.firstChild;)b.appendChild(d);
return b},createIterator:function(a){return new q(a)},DomPosition:o};e.DOMException=r});m.createModule("DomRange",function(e){function a(a,b){return 3!=a.nodeType&&(G.isAncestorOf(a,b.startContainer,!0)||G.isAncestorOf(a,b.endContainer,!0))}function g(a){return G.getDocument(a.startContainer)}function c(a,b,d){if(b=a._listeners[b])for(var f=0,k=b.length;f<k;++f)b[f].call(a,{target:a,args:d})}function b(a){return new O(a.parentNode,G.getNodeIndex(a))}function j(a){return new O(a.parentNode,G.getNodeIndex(a)+
1)}function l(a,b,d){var f=11==a.nodeType?a.firstChild:a;G.isCharacterDataNode(b)?d==b.length?G.insertAfter(a,b):b.parentNode.insertBefore(a,0==d?b:G.splitDataNode(b,d)):d>=b.childNodes.length?b.appendChild(a):b.insertBefore(a,b.childNodes[d]);return f}function f(a){for(var b,d,k=g(a.range).createDocumentFragment();d=a.next();){b=a.isPartiallySelectedSubtree();d=d.cloneNode(!b);b&&(b=a.getSubtreeIterator(),d.appendChild(f(b)),b.detach(!0));if(10==d.nodeType)throw new R("HIERARCHY_REQUEST_ERR");k.appendChild(d)}return k}
function k(a,b,d){for(var f,c,d=d||{stop:!1};f=a.next();)if(a.isPartiallySelectedSubtree())if(!1===b(f)){d.stop=!0;break}else{if(f=a.getSubtreeIterator(),k(f,b,d),f.detach(!0),d.stop)break}else for(f=G.createIterator(f);c=f.next();)if(!1===b(c)){d.stop=!0;return}}function d(a){for(var b;a.next();)a.isPartiallySelectedSubtree()?(b=a.getSubtreeIterator(),d(b),b.detach(!0)):a.remove()}function q(a){for(var b,d=g(a.range).createDocumentFragment(),f;b=a.next();){a.isPartiallySelectedSubtree()?(b=b.cloneNode(!1),
f=a.getSubtreeIterator(),b.appendChild(q(f)),f.detach(!0)):a.remove();if(10==b.nodeType)throw new R("HIERARCHY_REQUEST_ERR");d.appendChild(b)}return d}function o(a,b,d){var f=!(!b||!b.length),c,j=!!d;f&&(c=RegExp("^("+b.join("|")+")$"));var l=[];k(new p(a,!1),function(a){(!f||c.test(a.nodeType))&&(!j||d(a))&&l.push(a)});return l}function r(a){return"["+("undefined"==typeof a.getName?"Range":a.getName())+"("+G.inspectNode(a.startContainer)+":"+a.startOffset+", "+G.inspectNode(a.endContainer)+":"+a.endOffset+
")]"}function p(a,b){this.range=a;this.clonePartiallySelectedTextNodes=b;if(!a.collapsed){this.sc=a.startContainer;this.so=a.startOffset;this.ec=a.endContainer;this.eo=a.endOffset;var d=a.commonAncestorContainer;this.sc===this.ec&&G.isCharacterDataNode(this.sc)?(this.isSingleCharacterDataNode=!0,this._first=this._last=this._next=this.sc):(this._first=this._next=this.sc===d&&!G.isCharacterDataNode(this.sc)?this.sc.childNodes[this.so]:G.getClosestAncestorIn(this.sc,d,!0),this._last=this.ec===d&&!G.isCharacterDataNode(this.ec)?
this.ec.childNodes[this.eo-1]:G.getClosestAncestorIn(this.ec,d,!0))}}function u(a){this.code=this[a];this.codeName=a;this.message="RangeException: "+this.codeName}function t(a,b,d){this.nodes=o(a,b,d);this._next=this.nodes[0];this._position=0}function m(a){return function(b,d){for(var f,k=d?b:b.parentNode;k;){f=k.nodeType;if(G.arrayContains(a,f))return k;k=k.parentNode}return null}}function z(a,b){if(V(a,b))throw new u("INVALID_NODE_TYPE_ERR");}function x(a){if(!a.startContainer)throw new R("INVALID_STATE_ERR");
}function v(a,b){if(!G.arrayContains(b,a.nodeType))throw new u("INVALID_NODE_TYPE_ERR");}function A(a,b){if(0>b||b>(G.isCharacterDataNode(a)?a.length:a.childNodes.length))throw new R("INDEX_SIZE_ERR");}function B(a,b){if(C(a,!0)!==C(b,!0))throw new R("WRONG_DOCUMENT_ERR");}function E(a){if(S(a,!0))throw new R("NO_MODIFICATION_ALLOWED_ERR");}function F(a,b){if(!a)throw new R(b);}function J(a){x(a);if(!G.arrayContains(Q,a.startContainer.nodeType)&&!C(a.startContainer,!0)||!G.arrayContains(Q,a.endContainer.nodeType)&&
!C(a.endContainer,!0)||!(a.startOffset<=(G.isCharacterDataNode(a.startContainer)?a.startContainer.length:a.startContainer.childNodes.length))||!(a.endOffset<=(G.isCharacterDataNode(a.endContainer)?a.endContainer.length:a.endContainer.childNodes.length)))throw Error("Range error: Range is no longer valid after DOM mutation ("+a.inspect()+")");}function I(){}function N(a){a.START_TO_START=Da;a.START_TO_END=ia;a.END_TO_END=ja;a.END_TO_START=ua;a.NODE_BEFORE=H;a.NODE_AFTER=ka;a.NODE_BEFORE_AND_AFTER=
Sa;a.NODE_INSIDE=qa}function D(a){N(a);N(a.prototype)}function Z(a,b){return function(){J(this);var d=this.startContainer,f=this.startOffset,c=this.commonAncestorContainer,l=new p(this,!0);d!==c&&(d=G.getClosestAncestorIn(d,c,!0),f=j(d),d=f.node,f=f.offset);k(l,E);l.reset();c=a(l);l.detach();b(this,d,f,d,f);return c}}function ca(f,k,c){function l(a,d){return function(f){x(this);v(f,W);v(ea(f),Q);f=(a?b:j)(f);(d?g:o)(this,f.node,f.offset)}}function g(a,b,d){var f=a.endContainer,c=a.endOffset;if(b!==
a.startContainer||d!==this.startOffset){if(ea(b)!=ea(f)||1==G.comparePoints(b,d,f,c))f=b,c=d;k(a,b,d,f,c)}}function o(a,b,d){var f=a.startContainer,c=a.startOffset;if(b!==a.endContainer||d!==this.endOffset){if(ea(b)!=ea(f)||-1==G.comparePoints(b,d,f,c))f=b,c=d;k(a,f,c,b,d)}}function t(a,b,d){(b!==a.startContainer||d!==this.startOffset||b!==a.endContainer||d!==this.endOffset)&&k(a,b,d,b,d)}f.prototype=new I;e.util.extend(f.prototype,{setStart:function(a,b){x(this);z(a,!0);A(a,b);g(this,a,b)},setEnd:function(a,
b){x(this);z(a,!0);A(a,b);o(this,a,b)},setStartBefore:l(!0,!0),setStartAfter:l(!1,!0),setEndBefore:l(!0,!1),setEndAfter:l(!1,!1),collapse:function(a){J(this);a?k(this,this.startContainer,this.startOffset,this.startContainer,this.startOffset):k(this,this.endContainer,this.endOffset,this.endContainer,this.endOffset)},selectNodeContents:function(a){x(this);z(a,!0);k(this,a,0,a,G.getNodeLength(a))},selectNode:function(a){x(this);z(a,!1);v(a,W);var d=b(a),a=j(a);k(this,d.node,d.offset,a.node,a.offset)},
extractContents:Z(q,k),deleteContents:Z(d,k),canSurroundContents:function(){J(this);E(this.startContainer);E(this.endContainer);var b=new p(this,!0),d=b._first&&a(b._first,this)||b._last&&a(b._last,this);b.detach();return!d},detach:function(){c(this)},splitBoundaries:function(){J(this);var a=this.startContainer,b=this.startOffset,d=this.endContainer,f=this.endOffset,c=a===d;G.isCharacterDataNode(d)&&(0<f&&f<d.length)&&G.splitDataNode(d,f);G.isCharacterDataNode(a)&&(0<b&&b<a.length)&&(a=G.splitDataNode(a,
b),c?(f-=b,d=a):d==a.parentNode&&f>=G.getNodeIndex(a)&&f++,b=0);k(this,a,b,d,f)},normalizeBoundaries:function(){J(this);var a=this.startContainer,b=this.startOffset,d=this.endContainer,f=this.endOffset,c=function(a){var b=a.nextSibling;b&&b.nodeType==a.nodeType&&(d=a,f=a.length,a.appendData(b.data),b.parentNode.removeChild(b))},j=function(k){var c=k.previousSibling;if(c&&c.nodeType==k.nodeType){a=k;var j=k.length;b=c.length;k.insertData(0,c.data);c.parentNode.removeChild(c);a==d?(f+=b,d=a):d==k.parentNode&&
(c=G.getNodeIndex(k),f==c?(d=k,f=j):f>c&&f--)}},l=!0;G.isCharacterDataNode(d)?d.length==f&&c(d):(0<f&&(l=d.childNodes[f-1])&&G.isCharacterDataNode(l)&&c(l),l=!this.collapsed);l?G.isCharacterDataNode(a)?0==b&&j(a):b<a.childNodes.length&&(c=a.childNodes[b])&&G.isCharacterDataNode(c)&&j(c):(a=d,b=f);k(this,a,b,d,f)},collapseToPoint:function(a,b){x(this);z(a,!0);A(a,b);t(this,a,b)}});D(f)}function ba(a){a.collapsed=a.startContainer===a.endContainer&&a.startOffset===a.endOffset;a.commonAncestorContainer=
a.collapsed?a.startContainer:G.getCommonAncestor(a.startContainer,a.endContainer)}function T(a,b,d,f,k){var j=a.startContainer!==b||a.startOffset!==d,l=a.endContainer!==f||a.endOffset!==k;a.startContainer=b;a.startOffset=d;a.endContainer=f;a.endOffset=k;ba(a);c(a,"boundarychange",{startMoved:j,endMoved:l})}function $(a){this.startContainer=a;this.startOffset=0;this.endContainer=a;this.endOffset=0;this._listeners={boundarychange:[],detach:[]};ba(this)}e.requireModules(["DomUtil"]);var G=e.dom,O=G.DomPosition,
R=e.DOMException;p.prototype={_current:null,_next:null,_first:null,_last:null,isSingleCharacterDataNode:!1,reset:function(){this._current=null;this._next=this._first},hasNext:function(){return!!this._next},next:function(){var a=this._current=this._next;a&&(this._next=a!==this._last?a.nextSibling:null,G.isCharacterDataNode(a)&&this.clonePartiallySelectedTextNodes&&(a===this.ec&&(a=a.cloneNode(!0)).deleteData(this.eo,a.length-this.eo),this._current===this.sc&&(a=a.cloneNode(!0)).deleteData(0,this.so)));
return a},remove:function(){var a=this._current,b,d;G.isCharacterDataNode(a)&&(a===this.sc||a===this.ec)?(b=a===this.sc?this.so:0,d=a===this.ec?this.eo:a.length,b!=d&&a.deleteData(b,d-b)):a.parentNode&&a.parentNode.removeChild(a)},isPartiallySelectedSubtree:function(){return a(this._current,this.range)},getSubtreeIterator:function(){var a;if(this.isSingleCharacterDataNode)a=this.range.cloneRange(),a.collapse();else{a=new $(g(this.range));var b=this._current,d=b,f=0,k=b,c=G.getNodeLength(b);G.isAncestorOf(b,
this.sc,!0)&&(d=this.sc,f=this.so);G.isAncestorOf(b,this.ec,!0)&&(k=this.ec,c=this.eo);T(a,d,f,k,c)}return new p(a,this.clonePartiallySelectedTextNodes)},detach:function(a){a&&this.range.detach();this.range=this._current=this._next=this._first=this._last=this.sc=this.so=this.ec=this.eo=null}};u.prototype={BAD_BOUNDARYPOINTS_ERR:1,INVALID_NODE_TYPE_ERR:2};u.prototype.toString=function(){return this.message};t.prototype={_current:null,hasNext:function(){return!!this._next},next:function(){this._current=
this._next;this._next=this.nodes[++this._position];return this._current},detach:function(){this._current=this._next=this.nodes=null}};var W=[1,3,4,5,7,8,10],Q=[2,9,11],K=[1,3,4,5,7,8,10,11],P=[1,3,4,5,7,8],ea=G.getRootContainer,C=m([9,11]),S=m([5,6,10,12]),V=m([6,10,12]),fa=document.createElement("style"),Na=!1;try{fa.innerHTML="<b>x</b>",Na=3==fa.firstChild.nodeType}catch(Ia){}e.features.htmlParsingConforms=Na;var sa="startContainer startOffset endContainer endOffset collapsed commonAncestorContainer".split(" "),
Da=0,ia=1,ja=2,ua=3,H=0,ka=1,Sa=2,qa=3;I.prototype={attachListener:function(a,b){this._listeners[a].push(b)},compareBoundaryPoints:function(a,b){J(this);B(this.startContainer,b.startContainer);var d=a==ua||a==Da?"start":"end",f=a==ia||a==Da?"start":"end";return G.comparePoints(this[d+"Container"],this[d+"Offset"],b[f+"Container"],b[f+"Offset"])},insertNode:function(a){J(this);v(a,K);E(this.startContainer);if(G.isAncestorOf(a,this.startContainer,!0))throw new R("HIERARCHY_REQUEST_ERR");this.setStartBefore(l(a,
this.startContainer,this.startOffset))},cloneContents:function(){J(this);var a,b;if(this.collapsed)return g(this).createDocumentFragment();if(this.startContainer===this.endContainer&&G.isCharacterDataNode(this.startContainer))return a=this.startContainer.cloneNode(!0),a.data=a.data.slice(this.startOffset,this.endOffset),b=g(this).createDocumentFragment(),b.appendChild(a),b;b=new p(this,!0);a=f(b);b.detach();return a},canSurroundContents:function(){J(this);E(this.startContainer);E(this.endContainer);
var b=new p(this,!0),d=b._first&&a(b._first,this)||b._last&&a(b._last,this);b.detach();return!d},surroundContents:function(a){v(a,P);if(!this.canSurroundContents())throw new u("BAD_BOUNDARYPOINTS_ERR");var b=this.extractContents();if(a.hasChildNodes())for(;a.lastChild;)a.removeChild(a.lastChild);l(a,this.startContainer,this.startOffset);a.appendChild(b);this.selectNode(a)},cloneRange:function(){J(this);for(var a=new $(g(this)),b=sa.length,d;b--;)d=sa[b],a[d]=this[d];return a},toString:function(){J(this);
var a=this.startContainer;if(a===this.endContainer&&G.isCharacterDataNode(a))return 3==a.nodeType||4==a.nodeType?a.data.slice(this.startOffset,this.endOffset):"";var b=[],a=new p(this,!0);k(a,function(a){(3==a.nodeType||4==a.nodeType)&&b.push(a.data)});a.detach();return b.join("")},compareNode:function(a){J(this);var b=a.parentNode,d=G.getNodeIndex(a);if(!b)throw new R("NOT_FOUND_ERR");a=this.comparePoint(b,d);b=this.comparePoint(b,d+1);return 0>a?0<b?Sa:H:0<b?ka:qa},comparePoint:function(a,b){J(this);
F(a,"HIERARCHY_REQUEST_ERR");B(a,this.startContainer);return 0>G.comparePoints(a,b,this.startContainer,this.startOffset)?-1:0<G.comparePoints(a,b,this.endContainer,this.endOffset)?1:0},createContextualFragment:Na?function(a){var b=this.startContainer,d=G.getDocument(b);if(!b)throw new R("INVALID_STATE_ERR");var f=null;1==b.nodeType?f=b:G.isCharacterDataNode(b)&&(f=G.parentElement(b));f=null===f||"HTML"==f.nodeName&&G.isHtmlNamespace(G.getDocument(f).documentElement)&&G.isHtmlNamespace(f)?d.createElement("body"):
f.cloneNode(!1);f.innerHTML=a;return G.fragmentFromNodeChildren(f)}:function(a){x(this);var b=g(this).createElement("body");b.innerHTML=a;return G.fragmentFromNodeChildren(b)},toHtml:function(){J(this);var a=g(this).createElement("div");a.appendChild(this.cloneContents());return a.innerHTML},intersectsNode:function(a,b){J(this);F(a,"NOT_FOUND_ERR");if(G.getDocument(a)!==g(this))return!1;var d=a.parentNode,f=G.getNodeIndex(a);F(d,"NOT_FOUND_ERR");var k=G.comparePoints(d,f,this.endContainer,this.endOffset),
d=G.comparePoints(d,f+1,this.startContainer,this.startOffset);return b?0>=k&&0<=d:0>k&&0<d},isPointInRange:function(a,b){J(this);F(a,"HIERARCHY_REQUEST_ERR");B(a,this.startContainer);return 0<=G.comparePoints(a,b,this.startContainer,this.startOffset)&&0>=G.comparePoints(a,b,this.endContainer,this.endOffset)},intersectsRange:function(a,b){J(this);if(g(a)!=g(this))throw new R("WRONG_DOCUMENT_ERR");var d=G.comparePoints(this.startContainer,this.startOffset,a.endContainer,a.endOffset),f=G.comparePoints(this.endContainer,
this.endOffset,a.startContainer,a.startOffset);return b?0>=d&&0<=f:0>d&&0<f},intersection:function(a){if(this.intersectsRange(a)){var b=G.comparePoints(this.startContainer,this.startOffset,a.startContainer,a.startOffset),d=G.comparePoints(this.endContainer,this.endOffset,a.endContainer,a.endOffset),f=this.cloneRange();-1==b&&f.setStart(a.startContainer,a.startOffset);1==d&&f.setEnd(a.endContainer,a.endOffset);return f}return null},union:function(a){if(this.intersectsRange(a,!0)){var b=this.cloneRange();
-1==G.comparePoints(a.startContainer,a.startOffset,this.startContainer,this.startOffset)&&b.setStart(a.startContainer,a.startOffset);1==G.comparePoints(a.endContainer,a.endOffset,this.endContainer,this.endOffset)&&b.setEnd(a.endContainer,a.endOffset);return b}throw new u("Ranges do not intersect");},containsNode:function(a,b){return b?this.intersectsNode(a,!1):this.compareNode(a)==qa},containsNodeContents:function(a){return 0<=this.comparePoint(a,0)&&0>=this.comparePoint(a,G.getNodeLength(a))},containsRange:function(a){return this.intersection(a).equals(a)},
containsNodeText:function(a){var b=this.cloneRange();b.selectNode(a);var d=b.getNodes([3]);return 0<d.length?(b.setStart(d[0],0),a=d.pop(),b.setEnd(a,a.length),a=this.containsRange(b),b.detach(),a):this.containsNodeContents(a)},createNodeIterator:function(a,b){J(this);return new t(this,a,b)},getNodes:function(a,b){J(this);return o(this,a,b)},getDocument:function(){return g(this)},collapseBefore:function(a){x(this);this.setEndBefore(a);this.collapse(!1)},collapseAfter:function(a){x(this);this.setStartAfter(a);
this.collapse(!0)},getName:function(){return"DomRange"},equals:function(a){return $.rangesEqual(this,a)},inspect:function(){return r(this)}};ca($,T,function(a){x(a);a.startContainer=a.startOffset=a.endContainer=a.endOffset=null;a.collapsed=a.commonAncestorContainer=null;c(a,"detach",null);a._listeners=null});e.rangePrototype=I.prototype;$.rangeProperties=sa;$.RangeIterator=p;$.copyComparisonConstants=D;$.createPrototypeRange=ca;$.inspect=r;$.getRangeDocument=g;$.rangesEqual=function(a,b){return a.startContainer===
b.startContainer&&a.startOffset===b.startOffset&&a.endContainer===b.endContainer&&a.endOffset===b.endOffset};e.DomRange=$;e.RangeException=u});m.createModule("WrappedRange",function(e){function a(a,d,f,c){var l=a.duplicate();l.collapse(f);var g=l.parentElement();b.isAncestorOf(d,g,!0)||(g=d);if(!g.canHaveHTML)return new j(g.parentNode,b.getNodeIndex(g));d=b.getDocument(g).createElement("span");d.parentNode&&d.parentNode.removeChild(d);var e,t=f?"StartToStart":"StartToEnd";do g.insertBefore(d,d.previousSibling),
l.moveToElementText(d);while(0<(e=l.compareEndPoints(t,a))&&d.previousSibling);t=d.nextSibling;if(-1==e&&t&&b.isCharacterDataNode(t)){l.setEndPoint(f?"EndToStart":"EndToEnd",a);if(/[\r\n]/.test(t.data)){l=l.duplicate();g=l.text.replace(/\r\n/g,"\r").length;for(g=l.moveStart("character",g);-1==l.compareEndPoints("StartToEnd",l);)g++,l.moveStart("character",1)}else if(g=l.text.replace(/\u00a0/g," "),f=t.data.replace(/\u00a0/g," "),0!==f.indexOf(g)){for(;0<g.length&&0!==f.indexOf(g);)g=g.substr(1);g=
g.length}else g=l.text.length;t=new j(t,g)}else t=(c||!f)&&d.previousSibling,t=(l=(c||f)&&d.nextSibling)&&b.isCharacterDataNode(l)?new j(l,0):t&&b.isCharacterDataNode(t)?new j(t,t.length):new j(g,b.getNodeIndex(d));d.parentNode.removeChild(d);return t}function g(a,d){var f,c,j=a.offset,l=b.getDocument(a.node),g=l.body.createTextRange(),e=b.isCharacterDataNode(a.node);e?(f=a.node,c=f.parentNode):(f=a.node.childNodes,f=j<f.length?f[j]:null,c=a.node);l=l.createElement("span");l.innerHTML="&#feff;";f?
c.insertBefore(l,f):c.appendChild(l);try{g.moveToElementText(l),g.collapse(!d)}catch(m){}c.removeChild(l);if(e)g[d?"moveStart":"moveEnd"]("character",j);return g}e.requireModules(["DomUtil","DomRange"]);var c,b=e.dom,j=b.DomPosition,l=e.DomRange;if(e.features.implementsDomRange&&(!e.features.implementsTextRange||!e.config.preferTextRange))(function(){function a(b){for(var d=f.length,k;d--;)k=f[d],b[k]=b.nativeRange[k]}var d,f=l.rangeProperties,j;c=function(b){if(!b)throw Error("Range must be specified");
this.nativeRange=b;a(this)};l.createPrototypeRange(c,function(a,b,d,f,k){var c=a.endContainer!==f||a.endOffset!=k;if(a.startContainer!==b||a.startOffset!=d||c)a.setEnd(f,k),a.setStart(b,d)},function(a){a.nativeRange.detach();a.detached=!0;for(var b=f.length,d;b--;)d=f[b],a[d]=null});d=c.prototype;d.selectNode=function(b){this.nativeRange.selectNode(b);a(this)};d.deleteContents=function(){this.nativeRange.deleteContents();a(this)};d.extractContents=function(){var b=this.nativeRange.extractContents();
a(this);return b};d.cloneContents=function(){return this.nativeRange.cloneContents()};d.surroundContents=function(b){this.nativeRange.surroundContents(b);a(this)};d.collapse=function(b){this.nativeRange.collapse(b);a(this)};d.cloneRange=function(){return new c(this.nativeRange.cloneRange())};d.refresh=function(){a(this)};d.toString=function(){return this.nativeRange.toString()};var g=document.createTextNode("test");b.getBody(document).appendChild(g);var p=document.createRange();p.setStart(g,0);p.setEnd(g,
0);try{p.setStart(g,1),d.setStart=function(b,d){this.nativeRange.setStart(b,d);a(this)},d.setEnd=function(b,d){this.nativeRange.setEnd(b,d);a(this)},j=function(b){return function(d){this.nativeRange[b](d);a(this)}}}catch(u){d.setStart=function(b,d){try{this.nativeRange.setStart(b,d)}catch(f){this.nativeRange.setEnd(b,d),this.nativeRange.setStart(b,d)}a(this)},d.setEnd=function(b,d){try{this.nativeRange.setEnd(b,d)}catch(f){this.nativeRange.setStart(b,d),this.nativeRange.setEnd(b,d)}a(this)},j=function(b,
d){return function(f){try{this.nativeRange[b](f)}catch(c){this.nativeRange[d](f),this.nativeRange[b](f)}a(this)}}}d.setStartBefore=j("setStartBefore","setEndBefore");d.setStartAfter=j("setStartAfter","setEndAfter");d.setEndBefore=j("setEndBefore","setStartBefore");d.setEndAfter=j("setEndAfter","setStartAfter");p.selectNodeContents(g);d.selectNodeContents=p.startContainer==g&&p.endContainer==g&&0==p.startOffset&&p.endOffset==g.length?function(b){this.nativeRange.selectNodeContents(b);a(this)}:function(a){this.setStart(a,
0);this.setEnd(a,l.getEndOffset(a))};p.selectNodeContents(g);p.setEnd(g,3);j=document.createRange();j.selectNodeContents(g);j.setEnd(g,4);j.setStart(g,2);d.compareBoundaryPoints=-1==p.compareBoundaryPoints(p.START_TO_END,j)&1==p.compareBoundaryPoints(p.END_TO_START,j)?function(a,b){b=b.nativeRange||b;a==b.START_TO_END?a=b.END_TO_START:a==b.END_TO_START&&(a=b.START_TO_END);return this.nativeRange.compareBoundaryPoints(a,b)}:function(a,b){return this.nativeRange.compareBoundaryPoints(a,b.nativeRange||
b)};e.util.isHostMethod(p,"createContextualFragment")&&(d.createContextualFragment=function(a){return this.nativeRange.createContextualFragment(a)});b.getBody(document).removeChild(g);p.detach();j.detach()})(),e.createNativeRange=function(a){a=a||document;return a.createRange()};else if(e.features.implementsTextRange){c=function(a){this.textRange=a;this.refresh()};c.prototype=new l(document);c.prototype.refresh=function(){var f,d,c=this.textRange;f=c.parentElement();var j=c.duplicate();j.collapse(!0);
d=j.parentElement();j=c.duplicate();j.collapse(!1);c=j.parentElement();d=d==c?d:b.getCommonAncestor(d,c);d=d==f?d:b.getCommonAncestor(f,d);0==this.textRange.compareEndPoints("StartToEnd",this.textRange)?d=f=a(this.textRange,d,!0,!0):(f=a(this.textRange,d,!0,!1),d=a(this.textRange,d,!1,!1));this.setStart(f.node,f.offset);this.setEnd(d.node,d.offset)};l.copyComparisonConstants(c);var f=function(){return this}();"undefined"==typeof f.Range&&(f.Range=c);e.createNativeRange=function(a){a=a||document;return a.body.createTextRange()}}e.features.implementsTextRange&&
(c.rangeToTextRange=function(a){if(a.collapsed)return g(new j(a.startContainer,a.startOffset),!0);var d=g(new j(a.startContainer,a.startOffset),!0),f=g(new j(a.endContainer,a.endOffset),!1),a=b.getDocument(a.startContainer).body.createTextRange();a.setEndPoint("StartToStart",d);a.setEndPoint("EndToEnd",f);return a});c.prototype.getName=function(){return"WrappedRange"};e.WrappedRange=c;e.createRange=function(a){a=a||document;return new c(e.createNativeRange(a))};e.createRangyRange=function(a){a=a||
document;return new l(a)};e.createIframeRange=function(a){return e.createRange(b.getIframeDocument(a))};e.createIframeRangyRange=function(a){return e.createRangyRange(b.getIframeDocument(a))};e.addCreateMissingNativeApiListener(function(a){a=a.document;if(typeof a.createRange=="undefined")a.createRange=function(){return e.createRange(this)};a=a=null})});m.createModule("WrappedSelection",function(e,a){function g(a){return(a||window).getSelection()}function c(a){return(a||window).document.selection}
function b(a,b,d){var f=d?"end":"start",d=d?"start":"end";a.anchorNode=b[f+"Container"];a.anchorOffset=b[f+"Offset"];a.focusNode=b[d+"Container"];a.focusOffset=b[d+"Offset"]}function j(a){a.anchorNode=a.focusNode=null;a.anchorOffset=a.focusOffset=0;a.rangeCount=0;a.isCollapsed=!0;a._ranges.length=0}function l(a){var b;a instanceof z?(b=a._selectionNativeRange,b||(b=e.createNativeRange(t.getDocument(a.startContainer)),b.setEnd(a.endContainer,a.endOffset),b.setStart(a.startContainer,a.startOffset),
a._selectionNativeRange=b,a.attachListener("detach",function(){this._selectionNativeRange=null}))):a instanceof x?b=a.nativeRange:e.features.implementsDomRange&&a instanceof t.getWindow(a.startContainer).Range&&(b=a);return b}function f(a){var b=a.getNodes(),d;a:if(!b.length||1!=b[0].nodeType)d=!1;else{d=1;for(var f=b.length;d<f;++d)if(!t.isAncestorOf(b[0],b[d])){d=!1;break a}d=!0}if(!d)throw Error("getSingleElementFromRange: range "+a.inspect()+" did not consist of a single element");return b[0]}
function k(a,d){var f=new x(d);a._ranges=[f];b(a,f,!1);a.rangeCount=1;a.isCollapsed=f.collapsed}function d(a){a._ranges.length=0;if("None"==a.docSelection.type)j(a);else{var d=a.docSelection.createRange();if(d&&"undefined"!=typeof d.text)k(a,d);else{a.rangeCount=d.length;for(var f,c=t.getDocument(d.item(0)),l=0;l<a.rangeCount;++l)f=e.createRange(c),f.selectNode(d.item(l)),a._ranges.push(f);a.isCollapsed=1==a.rangeCount&&a._ranges[0].collapsed;b(a,a._ranges[a.rangeCount-1],!1)}}}function q(a,b){for(var c=
a.docSelection.createRange(),k=f(b),j=t.getDocument(c.item(0)),j=t.getBody(j).createControlRange(),l=0,g=c.length;l<g;++l)j.add(c.item(l));try{j.add(k)}catch(e){throw Error("addRange(): Element within the specified Range could not be added to control selection (does it have layout?)");}j.select();d(a)}function o(a,b,d){this.nativeSelection=a;this.docSelection=b;this._ranges=[];this.win=d;this.refresh()}function r(a,b){for(var c=t.getDocument(b[0].startContainer),c=t.getBody(c).createControlRange(),
k=0,j;k<rangeCount;++k){j=f(b[k]);try{c.add(j)}catch(l){throw Error("setRanges(): Element within the one of the specified Ranges could not be added to control selection (does it have layout?)");}}c.select();d(a)}function p(a,b){if(a.anchorNode&&t.getDocument(a.anchorNode)!==t.getDocument(b))throw new v("WRONG_DOCUMENT_ERR");}function u(a){var b=[],d=new A(a.anchorNode,a.anchorOffset),f=new A(a.focusNode,a.focusOffset),c="function"==typeof a.getName?a.getName():"Selection";if("undefined"!=typeof a.rangeCount)for(var k=
0,j=a.rangeCount;k<j;++k)b[k]=z.inspect(a.getRangeAt(k));return"["+c+"(Ranges: "+b.join(", ")+")(anchor: "+d.inspect()+", focus: "+f.inspect()+"]"}e.requireModules(["DomUtil","DomRange","WrappedRange"]);e.config.checkSelectionRanges=!0;var t=e.dom,m=e.util,z=e.DomRange,x=e.WrappedRange,v=e.DOMException,A=t.DomPosition,B,E,F=e.util.isHostMethod(window,"getSelection"),J=e.util.isHostObject(document,"selection"),I=J&&(!F||e.config.preferTextRange);I?(B=c,e.isSelectionValid=function(a){var a=(a||window).document,
b=a.selection;return"None"!=b.type||t.getDocument(b.createRange().parentElement())==a}):F?(B=g,e.isSelectionValid=function(){return!0}):a.fail("Neither document.selection or window.getSelection() detected.");e.getNativeSelection=B;var F=B(),N=e.createNativeRange(document),D=t.getBody(document),Z=m.areHostObjects(F,m.areHostProperties(F,["anchorOffset","focusOffset"]));e.features.selectionHasAnchorAndFocus=Z;var ca=m.isHostMethod(F,"extend");e.features.selectionHasExtend=ca;var ba="number"==typeof F.rangeCount;
e.features.selectionHasRangeCount=ba;var T=!1,$=!0;m.areHostMethods(F,["addRange","getRangeAt","removeAllRanges"])&&("number"==typeof F.rangeCount&&e.features.implementsDomRange)&&function(){var a=document.createElement("iframe");D.appendChild(a);var b=t.getIframeDocument(a);b.open();b.write("<html><head></head><body>12</body></html>");b.close();var d=t.getIframeWindow(a).getSelection(),f=b.documentElement.lastChild.firstChild,b=b.createRange();b.setStart(f,1);b.collapse(true);d.addRange(b);$=d.rangeCount==
1;d.removeAllRanges();var c=b.cloneRange();b.setStart(f,0);c.setEnd(f,2);d.addRange(b);d.addRange(c);T=d.rangeCount==2;b.detach();c.detach();D.removeChild(a)}();e.features.selectionSupportsMultipleRanges=T;e.features.collapsedNonEditableSelectionsSupported=$;var G=!1,O;D&&m.isHostMethod(D,"createControlRange")&&(O=D.createControlRange(),m.areHostProperties(O,["item","add"])&&(G=!0));e.features.implementsControlRange=G;E=Z?function(a){return a.anchorNode===a.focusNode&&a.anchorOffset===a.focusOffset}:
function(a){return a.rangeCount?a.getRangeAt(a.rangeCount-1).collapsed:false};var R;m.isHostMethod(F,"getRangeAt")?R=function(a,b){try{return a.getRangeAt(b)}catch(d){return null}}:Z&&(R=function(a){var b=t.getDocument(a.anchorNode),b=e.createRange(b);b.setStart(a.anchorNode,a.anchorOffset);b.setEnd(a.focusNode,a.focusOffset);if(b.collapsed!==this.isCollapsed){b.setStart(a.focusNode,a.focusOffset);b.setEnd(a.anchorNode,a.anchorOffset)}return b});e.getSelection=function(a){var a=a||window,b=a._rangySelection,
d=B(a),f=J?c(a):null;if(b){b.nativeSelection=d;b.docSelection=f;b.refresh(a)}else{b=new o(d,f,a);a._rangySelection=b}return b};e.getIframeSelection=function(a){return e.getSelection(t.getIframeWindow(a))};O=o.prototype;if(!I&&Z&&m.areHostMethods(F,["removeAllRanges","addRange"])){O.removeAllRanges=function(){this.nativeSelection.removeAllRanges();j(this)};var W=function(a,b){var d=z.getRangeDocument(b),d=e.createRange(d);d.collapseToPoint(b.endContainer,b.endOffset);a.nativeSelection.addRange(l(d));
a.nativeSelection.extend(b.startContainer,b.startOffset);a.refresh()};O.addRange=ba?function(a,d){if(G&&J&&this.docSelection.type=="Control")q(this,a);else if(d&&ca)W(this,a);else{var f;if(T)f=this.rangeCount;else{this.removeAllRanges();f=0}this.nativeSelection.addRange(l(a));this.rangeCount=this.nativeSelection.rangeCount;if(this.rangeCount==f+1){if(e.config.checkSelectionRanges)(f=R(this.nativeSelection,this.rangeCount-1))&&!z.rangesEqual(f,a)&&(a=new x(f));this._ranges[this.rangeCount-1]=a;b(this,
a,P(this.nativeSelection));this.isCollapsed=E(this)}else this.refresh()}}:function(a,b){if(b&&ca)W(this,a);else{this.nativeSelection.addRange(l(a));this.refresh()}};O.setRanges=function(a){if(G&&a.length>1)r(this,a);else{this.removeAllRanges();for(var b=0,d=a.length;b<d;++b)this.addRange(a[b])}}}else if(m.isHostMethod(F,"empty")&&m.isHostMethod(N,"select")&&G&&I)O.removeAllRanges=function(){try{var a=jQuery.browser.msie&&jQuery.browser.version<8&&typeof document.documentMode==="undefined";a||this.docSelection.empty();
this.docSelection.type!="None"&&a&&this.docSelection.empty()}catch(b){}j(this)},O.addRange=function(a){if(this.docSelection.type=="Control")q(this,a);else try{x.rangeToTextRange(a).select();this._ranges[0]=a;this.rangeCount=1;this.isCollapsed=this._ranges[0].collapsed;b(this,a,false)}catch(d){}},O.setRanges=function(a){this.removeAllRanges();var b=a.length;b>1?r(this,a):b&&this.addRange(a[0])};else return a.fail("No means of selecting a Range or TextRange was found"),!1;O.getRangeAt=function(a){if(a<
0||a>=this.rangeCount)throw new v("INDEX_SIZE_ERR");return this._ranges[a]};var Q;if(I)Q=function(a){var b;if(e.isSelectionValid(a.win))b=a.docSelection.createRange();else{b=t.getBody(a.win.document).createTextRange();b.collapse(true)}a.docSelection.type=="Control"?d(a):b&&typeof b.text!="undefined"?k(a,b):j(a)};else if(m.isHostMethod(F,"getRangeAt")&&"number"==typeof F.rangeCount)Q=function(a){if(G&&J&&a.docSelection.type=="Control")d(a);else{a._ranges.length=a.rangeCount=a.nativeSelection.rangeCount;
if(a.rangeCount){for(var f=0,c=a.rangeCount;f<c;++f)a._ranges[f]=new e.WrappedRange(a.nativeSelection.getRangeAt(f));b(a,a._ranges[a.rangeCount-1],P(a.nativeSelection));a.isCollapsed=E(a)}else j(a)}};else if(Z&&"boolean"==typeof F.isCollapsed&&"boolean"==typeof N.collapsed&&e.features.implementsDomRange)Q=function(a){var b;b=a.nativeSelection;if(b.anchorNode){b=R(b,0);a._ranges=[b];a.rangeCount=1;b=a.nativeSelection;a.anchorNode=b.anchorNode;a.anchorOffset=b.anchorOffset;a.focusNode=b.focusNode;a.focusOffset=
b.focusOffset;a.isCollapsed=E(a)}else j(a)};else return a.fail("No means of obtaining a Range or TextRange from the user's selection was found"),!1;O.refresh=function(a){var b=a?this._ranges.slice(0):null;Q(this);if(a){a=b.length;if(a!=this._ranges.length)return false;for(;a--;)if(!z.rangesEqual(b[a],this._ranges[a]))return false;return true}};var K=function(a,b){var d=a.getAllRanges(),f=false;a.removeAllRanges();for(var c=0,k=d.length;c<k;++c)f||b!==d[c]?a.addRange(d[c]):f=true;a.rangeCount||j(a)};
O.removeRange=G?function(a){if(this.docSelection.type=="Control"){for(var b=this.docSelection.createRange(),a=f(a),c=t.getDocument(b.item(0)),c=t.getBody(c).createControlRange(),k,j=false,l=0,g=b.length;l<g;++l){k=b.item(l);k!==a||j?c.add(b.item(l)):j=true}c.select();d(this)}else K(this,a)}:function(a){K(this,a)};var P;!I&&Z&&e.features.implementsDomRange?(P=function(a){var b=false;a.anchorNode&&(b=t.comparePoints(a.anchorNode,a.anchorOffset,a.focusNode,a.focusOffset)==1);return b},O.isBackwards=
function(){return P(this)}):P=O.isBackwards=function(){return false};O.toString=function(){for(var a=[],b=0,d=this.rangeCount;b<d;++b)a[b]=""+this._ranges[b];return a.join("")};O.collapse=function(a,b){p(this,a);var d=e.createRange(t.getDocument(a));d.collapseToPoint(a,b);this.removeAllRanges();this.addRange(d);this.isCollapsed=true};O.collapseToStart=function(){if(this.rangeCount){var a=this._ranges[0];this.collapse(a.startContainer,a.startOffset)}else throw new v("INVALID_STATE_ERR");};O.collapseToEnd=
function(){if(this.rangeCount){var a=this._ranges[this.rangeCount-1];this.collapse(a.endContainer,a.endOffset)}else throw new v("INVALID_STATE_ERR");};O.selectAllChildren=function(a){p(this,a);var b=e.createRange(t.getDocument(a));b.selectNodeContents(a);this.removeAllRanges();this.addRange(b)};O.deleteFromDocument=function(){if(G&&J&&this.docSelection.type=="Control"){for(var a=this.docSelection.createRange(),b;a.length;){b=a.item(0);a.remove(b);b.parentNode.removeChild(b)}this.refresh()}else if(this.rangeCount){a=
this.getAllRanges();this.removeAllRanges();b=0;for(var d=a.length;b<d;++b)a[b].deleteContents();this.addRange(a[d-1])}};O.getAllRanges=function(){return this._ranges.slice(0)};O.setSingleRange=function(a){this.setRanges([a])};O.containsNode=function(a,b){for(var d=0,f=this._ranges.length;d<f;++d)if(this._ranges[d].containsNode(a,b))return true;return false};O.toHtml=function(){var a="";if(this.rangeCount){for(var a=z.getRangeDocument(this._ranges[0]).createElement("div"),b=0,d=this._ranges.length;b<
d;++b)a.appendChild(this._ranges[b].cloneContents());a=a.innerHTML}return a};O.getName=function(){return"WrappedSelection"};O.inspect=function(){return u(this)};O.detach=function(){this.win=this.anchorNode=this.focusNode=this.win._rangySelection=null};o.inspect=u;e.Selection=o;e.selectionPrototype=O;e.addCreateMissingNativeApiListener(function(a){if(typeof a.getSelection=="undefined")a.getSelection=function(){return e.getSelection(this)};a=null})});window.rangy=m})();define("vendor/rangy-core",function(){});
define("aloha/rangy-core",["jquery","vendor/rangy-core"],function(){return window.rangy});define("util/class",[],function(){var m=!1,e=/xyz/.test(function(){xyz})?/\b_super\b/:/.*/;this.Class=function(){};Class.extend=function(){function a(){!m&&this._constructor&&this._constructor.apply(this,arguments)}var g=this.prototype;m=!0;var c=new this;m=!1;for(var b=0;b<arguments.length;b++){var j=arguments[b],l;for(l in j)c[l]="function"==typeof j[l]&&"function"==typeof g[l]&&e.test(j[l])?function(a,b){return function(){var d=
this._super;this._super=g[a];var c=b.apply(this,arguments);this._super=d;return c}}(l,j[l]):j[l]}a.prototype=c;a.constructor=a;a.extend=arguments.callee;return a};return this.Class});window.GENTICS=window.GENTICS||{};window.GENTICS.Utils=window.GENTICS.Utils||{};define("util/lang",[],function(){});(function(m){var e=m.GENTICS;e.Utils.applyProperties=function(a,g){for(var c in g)g.hasOwnProperty(c)&&(a[c]=g[c])};e.Utils.uniqeString4=function(){return(65536*(1+Math.random())|0).toString(16).substring(1)};
e.Utils.guid=function(){var a=e.Utils.uniqeString4;return a()+a()+"-"+a()+"-"+a()+"-"+a()+"-"+a()+a()+a()}})(window);define("aloha/ecma5shims",[],function(){function m(a){var b=null;if(a){do b=a;while(null!=(a=a.parentNode))}return b}function e(a,b){return(a.contains(b)&&16)+(b.contains(a)&&8)+(0<=a.sourceIndex&&0<=b.sourceIndex?(a.sourceIndex<b.sourceIndex&&4)+(a.sourceIndex>b.sourceIndex&&2):1)}function a(a){return null!=a.sourceIndex?a:a.parentNode.insertBefore(document.createComment(""),a)}var g,
c={bind:function(a){var b=this.obj||this,f=Function.prototype.bind,c=Array.prototype.slice.call(arguments,1);return f?f.apply(b,arguments):function(){return b.apply(a,0===arguments.length?c:c.concat(Array.prototype.slice.call(arguments)))}},trim:function(){var a=this.obj||this,b=String.prototype.trim;return b?b.call(a):a.replace(/^\s+/,"").replace(/\s+$/,"")},indexOf:function(a,b){var f=this.obj||this,c=Array.prototype.indexOf;if(c)return c.call(f,a,b);void 0===b&&(b=0);0>b&&(b+=f.length);0>b&&(b=
0);for(c=f.length;b<c;b++)if(void 0!==f[b]&&f[b]===a)return b;return-1},forEach:function(a,b){var f=this.obj||this,c=Array.prototype.forEach;if(c)return c.call(f,a,b);var d,c=0;for(d=f.length;c<d;c++)void 0!==f[c]&&a.call(b,f[c],c,f)},map:function(a,b,f){var c=this.obj||this,d=Array.prototype.map,e="boolean"==typeof arguments[arguments.length-1]?Array.prototype.pop.call(arguments):!1,o=[];if(d)o=d.call(c,a,b);else{var d=[],r,o=0;for(r=c.length;o<r;o++)void 0!==c[o]&&(d[o]=a.call(b,c[o],o,c));o=d}return e?
g(o):o},filter:function(a,b,f){var c=this.obj||this,d=Array.prototype.filter,e="boolean"==typeof arguments[arguments.length-1]?Array.prototype.pop.call(arguments):!1,o=[];if(d)o=d.call(c,a,b);else{var d=[],r,p,o=0;for(p=c.length;o<p;o++)void 0!==c[o]&&a.call(b,r=c[o],o,c)&&d.push(r);o=d}return e?g(o):o},every:function(a,b){var f=this.obj||this,c=Array.prototype.every;if(c)return c.call(f,a,b);var d,c=0;for(d=f.length;c<d;c++)if(void 0!==f[c]&&!a.call(b,f[c],c,f))return!1;return!0},some:function(a,
b){var f=this.obj||this,c=Array.prototype.some;if(c)return c.call(f,a,b);var d,c=0;for(d=f.length;c<d;c++)if(void 0!==f[c]&&a.call(b,f[c],c,f))return!0;return!1},hasAttribute:function(a){var b=this.obj||this;return b.hasAttribute?b.hasAttribute(a):!!b.getAttribute(a)}};g=function(a){var b=function(){};b.prototype=c;b=new b;b.obj=a;return b};for(var b in c)c.hasOwnProperty(b)&&(g[b]=c[b]);g.Node="undefined"!=typeof window.Node?window.Node:{ELEMENT_NODE:1,ATTRIBUTE_NODE:2,TEXT_NODE:3,CDATA_SECTION_NODE:4,
ENTITY_REFERENCE_NODE:5,ENTITY_NODE:6,PROCESSING_INSTRUCTION_NODE:7,COMMENT_NODE:8,DOCUMENT_NODE:9,DOCUMENT_TYPE_NODE:10,DOCUMENT_FRAGMENT_NODE:11,NOTATION_NODE:12,DOCUMENT_POSITION_DISCONNECTED:1,DOCUMENT_POSITION_PRECEDING:2,DOCUMENT_POSITION_FOLLOWING:4,DOCUMENT_POSITION_CONTAINS:8,DOCUMENT_POSITION_CONTAINED_BY:16,DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC:32};g.compareDocumentPosition=function(b,c){if(document.documentElement.compareDocumentPosition)return b.compareDocumentPosition(c);if(!document.documentElement.contains)throw"neither compareDocumentPosition nor contains is supported by this browser.";
if(b==c)return 0;if(m(b)!=m(c))return 1;if(null!=b.sourceIndex&&null!=c.sourceIndex)return e(b,c);if(b==document)return 20;if(c==document)return 10;var f=a(b),k=a(c),d=e(f,k);b!=f&&f.parentNode.removeChild(f);c!=k&&k.parentNode.removeChild(k);return d};g.getComputedStyle=function(a,b){return window.getComputedStyle?window.getComputedStyle(a,b):a.currentStyle?a.currentStyle:null};return g});window.GENTICS=window.GENTICS||{};window.GENTICS.Utils=window.GENTICS.Utils||{};define("util/dom",["jquery",
"util/class","aloha/ecma5shims"],function(m,e,a){var g=window.GENTICS,c={P:!0,H1:!0,H2:!0,H3:!0,H4:!0,H5:!0,H6:!0,LI:!0},e=e.extend({wordRegex:/[\u0041-\u005A\u0061-\u007A\u00AA\u00B5\u00BA\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0370-\u0374\u0376\u0377\u037A-\u037D\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u048A-\u0525\u0531-\u0556\u0559\u0561-\u0587\u05D0-\u05EA\u05F0-\u05F2\u0621-\u064A\u066E\u066F\u0671-\u06D3\u06D5\u06E5\u06E6\u06EE\u06EF\u06FA-\u06FC\u06FF\u0710\u0712-\u072F\u074D-\u07A5\u07B1\u07CA-\u07EA\u07F4\u07F5\u07FA\u0800-\u0815\u081A\u0824\u0828\u0904-\u0939\u093D\u0950\u0958-\u0961\u0971\u0972\u0979-\u097F\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BD\u09CE\u09DC\u09DD\u09DF-\u09E1\u09F0\u09F1\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A59-\u0A5C\u0A5E\u0A72-\u0A74\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABD\u0AD0\u0AE0\u0AE1\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3D\u0B5C\u0B5D\u0B5F-\u0B61\u0B71\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BD0\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C33\u0C35-\u0C39\u0C3D\u0C58\u0C59\u0C60\u0C61\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBD\u0CDE\u0CE0\u0CE1\u0D05-\u0D0C\u0D0E-\u0D10\u0D12-\u0D28\u0D2A-\u0D39\u0D3D\u0D60\u0D61\u0D7A-\u0D7F\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0E01-\u0E30\u0E32\u0E33\u0E40-\u0E46\u0E81\u0E82\u0E84\u0E87\u0E88\u0E8A\u0E8D\u0E94-\u0E97\u0E99-\u0E9F\u0EA1-\u0EA3\u0EA5\u0EA7\u0EAA\u0EAB\u0EAD-\u0EB0\u0EB2\u0EB3\u0EBD\u0EC0-\u0EC4\u0EC6\u0EDC\u0EDD\u0F00\u0F40-\u0F47\u0F49-\u0F6C\u0F88-\u0F8B\u1000-\u102A\u103F\u1050-\u1055\u105A-\u105D\u1061\u1065\u1066\u106E-\u1070\u1075-\u1081\u108E\u10A0-\u10C5\u10D0-\u10FA\u10FC\u1100-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u1380-\u138F\u13A0-\u13F4\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u1700-\u170C\u170E-\u1711\u1720-\u1731\u1740-\u1751\u1760-\u176C\u176E-\u1770\u1780-\u17B3\u17D7\u17DC\u1820-\u1877\u1880-\u18A8\u18AA\u18B0-\u18F5\u1900-\u191C\u1950-\u196D\u1970-\u1974\u1980-\u19AB\u19C1-\u19C7\u1A00-\u1A16\u1A20-\u1A54\u1AA7\u1B05-\u1B33\u1B45-\u1B4B\u1B83-\u1BA0\u1BAE\u1BAF\u1C00-\u1C23\u1C4D-\u1C4F\u1C5A-\u1C7D\u1CE9-\u1CEC\u1CEE-\u1CF1\u1D00-\u1DBF\u1E00-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u2071\u207F\u2090-\u2094\u2102\u2107\u210A-\u2113\u2115\u2119-\u211D\u2124\u2126\u2128\u212A-\u212D\u212F-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2183\u2184\u2C00-\u2C2E\u2C30-\u2C5E\u2C60-\u2CE4\u2CEB-\u2CEE\u2D00-\u2D25\u2D30-\u2D65\u2D6F\u2D80-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u2E2F\u3005\u3006\u3031-\u3035\u303B\u303C\u3041-\u3096\u309D-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312D\u3131-\u318E\u31A0-\u31B7\u31F0-\u31FF\u3400-\u4DB5\u4E00-\u9FCB\uA000-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA61F\uA62A\uA62B\uA640-\uA65F\uA662-\uA66E\uA67F-\uA697\uA6A0-\uA6E5\uA717-\uA71F\uA722-\uA788\uA78B\uA78C\uA7FB-\uA801\uA803-\uA805\uA807-\uA80A\uA80C-\uA822\uA840-\uA873\uA882-\uA8B3\uA8F2-\uA8F7\uA8FB\uA90A-\uA925\uA930-\uA946\uA960-\uA97C\uA984-\uA9B2\uA9CF\uAA00-\uAA28\uAA40-\uAA42\uAA44-\uAA4B\uAA60-\uAA76\uAA7A\uAA80-\uAAAF\uAAB1\uAAB5\uAAB6\uAAB9-\uAABD\uAAC0\uAAC2\uAADB-\uAADD\uABC0-\uABE2\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA2D\uFA30-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D\uFB1F-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE70-\uFE74\uFE76-\uFEFC\uFF21-\uFF3A\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC]/,
nonWordRegex:/[^\u0041-\u005A\u0061-\u007A\u00AA\u00B5\u00BA\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0370-\u0374\u0376\u0377\u037A-\u037D\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u048A-\u0525\u0531-\u0556\u0559\u0561-\u0587\u05D0-\u05EA\u05F0-\u05F2\u0621-\u064A\u066E\u066F\u0671-\u06D3\u06D5\u06E5\u06E6\u06EE\u06EF\u06FA-\u06FC\u06FF\u0710\u0712-\u072F\u074D-\u07A5\u07B1\u07CA-\u07EA\u07F4\u07F5\u07FA\u0800-\u0815\u081A\u0824\u0828\u0904-\u0939\u093D\u0950\u0958-\u0961\u0971\u0972\u0979-\u097F\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BD\u09CE\u09DC\u09DD\u09DF-\u09E1\u09F0\u09F1\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A59-\u0A5C\u0A5E\u0A72-\u0A74\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABD\u0AD0\u0AE0\u0AE1\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3D\u0B5C\u0B5D\u0B5F-\u0B61\u0B71\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BD0\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C33\u0C35-\u0C39\u0C3D\u0C58\u0C59\u0C60\u0C61\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBD\u0CDE\u0CE0\u0CE1\u0D05-\u0D0C\u0D0E-\u0D10\u0D12-\u0D28\u0D2A-\u0D39\u0D3D\u0D60\u0D61\u0D7A-\u0D7F\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0E01-\u0E30\u0E32\u0E33\u0E40-\u0E46\u0E81\u0E82\u0E84\u0E87\u0E88\u0E8A\u0E8D\u0E94-\u0E97\u0E99-\u0E9F\u0EA1-\u0EA3\u0EA5\u0EA7\u0EAA\u0EAB\u0EAD-\u0EB0\u0EB2\u0EB3\u0EBD\u0EC0-\u0EC4\u0EC6\u0EDC\u0EDD\u0F00\u0F40-\u0F47\u0F49-\u0F6C\u0F88-\u0F8B\u1000-\u102A\u103F\u1050-\u1055\u105A-\u105D\u1061\u1065\u1066\u106E-\u1070\u1075-\u1081\u108E\u10A0-\u10C5\u10D0-\u10FA\u10FC\u1100-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u1380-\u138F\u13A0-\u13F4\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u1700-\u170C\u170E-\u1711\u1720-\u1731\u1740-\u1751\u1760-\u176C\u176E-\u1770\u1780-\u17B3\u17D7\u17DC\u1820-\u1877\u1880-\u18A8\u18AA\u18B0-\u18F5\u1900-\u191C\u1950-\u196D\u1970-\u1974\u1980-\u19AB\u19C1-\u19C7\u1A00-\u1A16\u1A20-\u1A54\u1AA7\u1B05-\u1B33\u1B45-\u1B4B\u1B83-\u1BA0\u1BAE\u1BAF\u1C00-\u1C23\u1C4D-\u1C4F\u1C5A-\u1C7D\u1CE9-\u1CEC\u1CEE-\u1CF1\u1D00-\u1DBF\u1E00-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u2071\u207F\u2090-\u2094\u2102\u2107\u210A-\u2113\u2115\u2119-\u211D\u2124\u2126\u2128\u212A-\u212D\u212F-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2183\u2184\u2C00-\u2C2E\u2C30-\u2C5E\u2C60-\u2CE4\u2CEB-\u2CEE\u2D00-\u2D25\u2D30-\u2D65\u2D6F\u2D80-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u2E2F\u3005\u3006\u3031-\u3035\u303B\u303C\u3041-\u3096\u309D-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312D\u3131-\u318E\u31A0-\u31B7\u31F0-\u31FF\u3400-\u4DB5\u4E00-\u9FCB\uA000-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA61F\uA62A\uA62B\uA640-\uA65F\uA662-\uA66E\uA67F-\uA697\uA6A0-\uA6E5\uA717-\uA71F\uA722-\uA788\uA78B\uA78C\uA7FB-\uA801\uA803-\uA805\uA807-\uA80A\uA80C-\uA822\uA840-\uA873\uA882-\uA8B3\uA8F2-\uA8F7\uA8FB\uA90A-\uA925\uA930-\uA946\uA960-\uA97C\uA984-\uA9B2\uA9CF\uAA00-\uAA28\uAA40-\uAA42\uAA44-\uAA4B\uAA60-\uAA76\uAA7A\uAA80-\uAAAF\uAAB1\uAAB5\uAAB6\uAAB9-\uAABD\uAAC0\uAAC2\uAADB-\uAADD\uABC0-\uABE2\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA2D\uFA30-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D\uFB1F-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE70-\uFE74\uFE76-\uFEFC\uFF21-\uFF3A\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC]/,
mergeableTags:"b code del em i ins strong sub sup #text".split(" "),nonWordBoundaryTags:"a b code del em i ins span strong sub sup #text".split(" "),nonEmptyTags:["br"],tags:{flow:"a abbr address area article aside audio b bdi bdo blockquote br button canvas cite code command datalist del details dfn div dl em embed fieldset figure footer form h1 h2 h3 h4 h5 h6 header hgroup hr i iframe img input ins kbd keygen label map mark math menu meter nav noscript object ol output p pre progress q ruby s samp script section select small span strong style sub sup svg table textarea time u ul var video wbr #text".split(" "),
phrasing:"a abbr area audio b bdi bdo br button canvas cite code command datalist del dfn em embed i iframe img input ins kbd keygen label map mark math meter noscript object output progress q ruby samp script select small span strong sub sup svg textarea time u var video wbr #text".split(" ")},children:{a:"phrasing",abbr:"phrasing",address:"flow",area:"empty",article:"flow",aside:"flow",audio:"source",b:"phrasing",base:"empty",bdo:"phrasing",blockquote:"phrasing",body:"flow",br:"empty",button:"phrasing",
canvas:"phrasing",caption:"flow",cite:"phrasing",code:"phrasing",col:"empty",colgroup:"col",command:"empty",datalist:["phrasing","option"],dd:"flow",del:"phrasing",div:"flow",details:["summary","flow"],dfn:"flow",dl:["dt","dd"],dt:"phrasing",em:"phrasing",embed:"empty",fieldset:["legend","flow"],figcaption:"flow",figure:["figcaption","flow"],footer:"flow",form:"flow",h1:"phrasing",h2:"phrasing",h3:"phrasing",h4:"phrasing",h5:"phrasing",h6:"phrasing",header:"flow",hgroup:"h1 h2 h3 h4 h5 h6".split(" "),
hr:"empty",i:"phrasing",iframe:"#text",img:"empty",input:"empty",ins:"phrasing",kbd:"phrasing",keygen:"empty",label:"phrasing",legend:"phrasing",li:"flow",link:"empty",map:"area",mark:"phrasing",menu:["li","flow"],meta:"empty",meter:"phrasing",nav:"flow",noscript:"phrasing",object:"param",ol:"li",optgroup:"option",option:"#text",output:"phrasing",p:"phrasing",param:"empty",pre:"phrasing",progress:"phrasing",q:"phrasing",rp:"phrasing",rt:"phrasing",ruby:["phrasing","rt","rp"],s:"phrasing",samp:"pharsing",
script:"#script",section:"flow",select:["option","optgroup"],small:"phrasing",source:"empty",span:"phrasing",strong:"phrasing",style:"phrasing",sub:"phrasing",summary:"phrasing",sup:"phrasing",table:"caption colgroup thead tbody tfoot tr".split(" "),tbody:"tr",td:"flow",textarea:"#text",tfoot:"tr",th:"phrasing",thead:"tr",time:"phrasing",title:"#text",tr:["th","td"],track:"empty",u:"phrasing",ul:"li","var":"phrasing",video:"source",wbr:"empty"},blockLevelElements:"p h1 h2 h3 h4 h5 h6 blockquote div pre".split(" "),
listElements:["li","ol","ul"],split:function(a,c,l){var f=m(a.startContainer),k=a.startOffset,d,g,e,r,p,u,t,y,z;l&&(f=m(a.endContainer),k=a.endOffset);1>c.length&&(c=m(document.body));l=!a.isCollapsed()&&!l;g=f.parents().get();g.unshift(f.get(0));m.each(g,function(a,b){if(c.filter(function(){return this==b}).length){a>0&&(d=g.slice(0,a));return false}});if(!d)return!0;d=d.reverse();f=0;for(u=d.length;f<u;++f)if(t=d[f],f===u-1)3===t.nodeType?(p=document.createTextNode(t.data.substring(k,t.data.length)),
t.data=t.data.substring(0,k)):(y=m(t),p=y.contents(),y=y.clone(!1).empty(),p=y.append(p.slice(k,p.length)).get(0)),l&&a.endContainer===t&&(a.endContainer=p,a.endOffset-=k,a.clearCaches()),r?r.prepend(p):m(t).after(p);else{y=m(t).clone(!1).empty();e?r.prepend(y):e=y;for(r=y;;){z=d[f+1].nextSibling;if(!z)break;r.append(z)}if(l&&a.endContainer===t){a.endContainer=y.get(0);t=d[f+1];for(y=0;;){t=t.previousSibling;if(!t)break;y++}a.endOffset-=y;a.clearCaches()}}m(d[0]).after(e);return m([d[0],e?e.get(0):
p])},allowsNesting:function(a,c){if(!a||!a.nodeName||!c||!c.nodeName)return!1;var l=a.nodeName.toLowerCase(),f=c.nodeName.toLowerCase();return!this.children[l]?!1:this.children[l]==f||m.isArray(this.children[l])&&0<=m.inArray(f,this.children[l])||m.isArray(this.tags[this.children[l]])&&0<=m.inArray(f,this.tags[this.children[l]])?!0:!1},addMarkup:function(a,c,l){3===a.startContainer.nodeType&&(0<a.startOffset&&a.startOffset<a.startContainer.data.length)&&this.split(a,m(a.startContainer).parent(),!1);
3===a.endContainer.nodeType&&(0<a.endOffset&&a.endOffset<a.endContainer.data.length)&&this.split(a,m(a.endContainer).parent(),!0);this.recursiveAddMarkup(a.getRangeTree(),c,a,l);this.doCleanup({merge:!0,removeempty:!0},a)},recursiveAddMarkup:function(a,c,l,f){var k,d,l=0;for(d=a.length;l<d;++l)if("full"==a[l].type&&this.allowsNesting(c.get(0),a[l].domobj)){if((f||a[l].domobj.nodeName!=c.get(0).nodeName)&&(3!==a[l].domobj.nodeType||0!==m.trim(a[l].domobj.data).length))m(a[l].domobj).wrap(c),!f&&3!==
a[l].domobj.nodeType&&(k=new g.Utils.RangeObject,k.startContainer=k.endContainer=a[l].domobj.parentNode,k.startOffset=0,k.endOffset=k.endContainer.childNodes.length,this.removeMarkup(k,c,m(a[l].domobj.parentNode)))}else(f||a[l].domobj&&a[l].domobj.nodeName!==c.get(0).nodeName)&&(a[l].children&&0<a[l].children.length)&&this.recursiveAddMarkup(a[l].children,c)},findHighestElement:function(a,c,l){for(var c=c.toLowerCase(),f,k=a,a=l?function(){return l.filter(function(){return k==this}).length}:function(){return!1};!a()&&
k;)k.nodeName.toLowerCase()===c&&(f=k),k=k.parentNode;return f},removeMarkup:function(a,c,l){var f=c.get(0).nodeName,k=this.findHighestElement(a.startContainer,f,l),d=this.findHighestElement(a.endContainer,f,l),g=!1;k&&0<a.startOffset&&(this.split(a,m(k).parent(),!1),g=!0);if(d&&(3===a.endContainer.nodeType&&a.endOffset<a.endContainer.data.length&&(this.split(a,m(d).parent(),!0),g=!0),1===a.endContainer.nodeType&&a.endOffset<a.endContainer.childNodes.length))this.split(a,m(d).parent(),!0),g=!0;g&&
a.correctRange();if(l=(l=this.findHighestElement(a.getCommonAncestorContainer(),f,l))?l.parentNode:a.getCommonAncestorContainer())f=a.getRangeTree(l),this.recursiveRemoveMarkup(f,c),this.doCleanup({merge:!0,removeempty:!0},a,l)},recursiveRemoveMarkup:function(a,c){var l,f,k;l=0;for(f=a.length;l<f;++l)"full"==a[l].type&&a[l].domobj.nodeName==c.get(0).nodeName&&(k=m(a[l].domobj).contents(),0<k.length?k.first().unwrap():m(a[l].domobj).remove()),a[l].children&&this.recursiveRemoveMarkup(a[l].children,
c)},doCleanup:function(a,c,l){var f=this,k,d,e,o,r;"undefined"===typeof a&&(a={});"undefined"===typeof a.merge&&(a.merge=!1);"undefined"===typeof a.removeempty&&(a.removeempty=!1);"undefined"===typeof l&&c&&(l=c.getCommonAncestorContainer());d=k=!1;e=m(l);o=c.startOffset;r=c.endOffset;e.contents().each(function(){var l,u;try{u=this.nodeType;l=f.getIndexInParent(this)}catch(t){return}switch(u){case 1:if(k&&k.nodeName==this.nodeName){if(c.startContainer===e&&o>l){c.startOffset=c.startOffset-1;d=true}if(c.endContainer===
e&&r>l){c.endOffset=c.endOffset-1;d=true}m(k).append(m(this).contents());d=d|f.doCleanup(a,c,k);m(this).remove()}else{d=d|f.doCleanup(a,c,this);u=false;if(a.removeempty){g.Utils.Dom.isBlockLevelElement(this)&&this.childNodes.length===0&&(u=true);m.inArray(this.nodeName.toLowerCase(),f.mergeableTags)>=0&&(m(this).text().length===0&&this.childNodes.length===0)&&(u=true)}if(u){if(c.startContainer===this.parentNode&&o>l){c.startOffset=c.startOffset-1;d=true}if(c.endContainer===this.parentNode&&r>l){c.endOffset=
c.endOffset-1;d=true}m(this).remove()}else k=m.inArray(this.nodeName.toLowerCase(),f.mergeableTags)>=0?this:false}break;case 3:if(k&&k.nodeType===3&&a.merge){if(c.startContainer===this){c.startContainer=k;c.startOffset=c.startOffset+k.nodeValue.length;d=true}else if(c.startContainer===k.parentNode&&c.startOffset===f.getIndexInParent(k)+1){c.startContainer=k;c.startOffset=k.nodeValue.length;d=true}if(c.endContainer===this){c.endContainer=k;c.endOffset=c.endOffset+k.nodeValue.length;d=true}else if(c.endContainer===
k.parentNode&&c.endOffset===f.getIndexInParent(k)+1){c.endContainer=k;c.endOffset=k.nodeValue.length;d=true}k.data=k.data+this.data}else if(!(this.nodeValue===""&&a.removeempty)){k=this;break}if(c.startContainer===this.parentNode&&c.startOffset>l){c.startOffset=c.startOffset-1;d=true}if(c.endContainer===this.parentNode&&c.endOffset>l){c.endOffset=c.endOffset-1;d=true}m(this).remove();if(k&&(!k.nextSibling||k.nextSibling.nodeType!==3))for(l=k.data.length-1;l>=0&&k.data.length>1;l--)if(k.data.charAt(l)===
"​"){k.deleteData(l,1);if(c.startContainer===k&&c.startOffset>l){c.startOffset--;d=true}if(c.endContainer===k&&c.endOffset>l){c.endOffset--;d=true}}}});d&&c.clearCaches();return d},getIndexInParent:function(a){if(!a)return!1;for(var c=0,a=a.previousSibling;a;)c++,a=a.previousSibling;return c},isBlockLevelElement:function(a){return!a?!1:1===a.nodeType&&0<=m.inArray(a.nodeName.toLowerCase(),this.blockLevelElements)?!0:!1},isLineBreakElement:function(a){return!a?!1:1===a.nodeType&&"br"==a.nodeName.toLowerCase()},
isListElement:function(a){return!a?!1:1===a.nodeType&&0<=m.inArray(a.nodeName.toLowerCase(),this.listElements)},isSplitObject:function(a){return 1===a.nodeType&&c.hasOwnProperty(a.nodeName)},searchAdjacentTextNode:function(a,c,l,f){if(!a||1!==a.nodeType||0>c||c>a.childNodes.length)return!1;"undefined"===typeof f&&(f={blocklevel:!0,list:!0,linebreak:!0});"undefined"===typeof f.blocklevel&&(f.blocklevel=!0);"undefined"===typeof f.list&&(f.list=!0);"undefined"===typeof f.linebreak&&(f.linebreak=!0);
"undefined"===typeof l&&(l=!0);var k,d=a;l&&0<c&&(k=a.childNodes[c-1]);for(!l&&c<a.childNodes.length&&(k=a.childNodes[c]);d;)if(k){if(3===k.nodeType&&0<m.trim(k.data).length)return k;if(f.blocklevel&&this.isBlockLevelElement(k)||f.linebreak&&this.isLineBreakElement(k)||f.list&&this.isListElement(k))return!1;3===k.nodeType?k=l?k.previousSibling:k.nextSibling:(d=k,k=l?k.lastChild:k.firstChild)}else{if(f.blocklevel&&this.isBlockLevelElement(d)||f.list&&this.isListElement(d))return!1;k=l?d.previousSibling:
d.nextSibling;d=d.parentNode}},insertIntoDOM:function(a,c,l,f,k){var d=c.getContainerParents(l,f),g=this,e;l||(l=m(document.body));0===d.length?e=l.get(0):m.each(d,function(d,f){if(g.allowsNesting(f,a.get(0)))return e=f,!1});"undefined"===typeof e&&0<l.length&&(e=l.get(0));if(!this.allowsNesting(e,a.get(0))&&!k)return!1;if("undefined"!==typeof e){l=this.split(c,m(e),f);if(!0===l){l=c.startContainer;k=c.startOffset;f&&(l=c.endContainer,k=c.endOffset);if(0===k)return c=m(l).contents(),0<c.length?c.eq(0).before(a):
m(l).append(a),!0;m(l).contents().eq(k-1).after(a);return!0}if(l)return l.eq(0).after(a),!0}return!1},removeFromDOM:function(a,c,l){if(l){var l=this.getIndexInParent(a),f=m(a).contents().length,k=a.parentNode;c.startContainer==k&&c.startOffset>l?c.startOffset+=f-1:c.startContainer==a&&(c.startContainer=k,c.startOffset=l+c.startOffset);c.endContainer==k&&c.endOffset>l?c.endOffset+=f-1:c.endContainer==a&&(c.endContainer=k,c.endOffset=l+c.endOffset);m(a).contents().unwrap();this.doCleanup({merge:!0},
c,k)}},removeRange:function(a){if(!a||a.isCollapsed())return!1;3==a.startContainer.nodeType&&(0<a.startOffset&&a.startOffset<a.startContainer.data.length)&&this.split(a,m(a.startContainer).parent(),!1);3==a.endContainer.nodeType&&(0<a.endOffset&&a.endOffset<a.endContainer.data.length)&&this.split(a,m(a.endContainer).parent(),!0);var c=a.getRangeTree();a.endContainer=a.startContainer;a.endOffset=a.startOffset;this.recursiveRemoveRange(c,a);this.doCleanup({merge:!0},a);a.clearCaches()},recursiveRemoveRange:function(a,
c){var l;for(l=0;l<a.length;++l)"full"==a[l].type?(0<m(c.startContainer).parents().andSelf().filter(a[l].domobj).length&&(c.startContainer=c.endContainer=a[l].domobj.parentNode,c.startOffset=c.endOffset=this.getIndexInParent(a[l].domobj)),m(a[l].domobj).remove()):"partial"==a[l].type&&a[l].children&&this.recursiveRemoveRange(a[l].children,c)},extendToWord:function(a,c){var l=this.searchWordBoundary(a.startContainer,a.startOffset,!0),f=this.searchWordBoundary(a.endContainer,a.endOffset,!1);if(c||!(a.startContainer==
l.container&&a.startOffset==l.offset||a.endContainer==f.container&&a.endOffset==f.offset))a.startContainer=l.container,a.startOffset=l.offset,a.endContainer=f.container,a.endOffset=f.offset,a.correctRange(),a.clearCaches()},isWordBoundaryElement:function(a){return!a||!a.nodeName?!1:-1==m.inArray(a.nodeName.toLowerCase(),this.nonWordBoundaryTags)},searchWordBoundary:function(a,c,l){"undefined"===typeof l&&(l=!0);for(var f=!1,k,d;!f;)if(3===a.nodeType)if(l){for(d=k=a.data.substring(0,c).search(this.nonWordRegex);-1!=
d;)k=d,d=a.data.substring(k+1,c).search(this.nonWordRegex),-1!=d&&(d=d+k+1);-1!=k?(c=k+1,f=!0):(c=this.getIndexInParent(a),a=a.parentNode)}else k=a.data.substring(c).search(this.nonWordRegex),-1!=k?(c+=k,f=!0):(c=this.getIndexInParent(a)+1,a=a.parentNode);else 1===a.nodeType&&(l?0<c?this.isWordBoundaryElement(a.childNodes[c-1])?f=!0:(a=a.childNodes[c-1],c=3===a.nodeType?a.data.length:a.childNodes.length):this.isWordBoundaryElement(a)?f=!0:(c=this.getIndexInParent(a),a=a.parentNode):c<a.childNodes.length?
this.isWordBoundaryElement(a.childNodes[c])?f=!0:(a=a.childNodes[c],c=0):this.isWordBoundaryElement(a)?f=!0:(c=this.getIndexInParent(a)+1,a=a.parentNode));if(3!==a.nodeType&&(f=this.searchAdjacentTextNode(a,c,!l)))a=f,c=l?0:a.data.length;return{container:a,offset:c}},isEmpty:function(a){if(!a)return!0;if(-1!=m.inArray(a.nodeName.toLowerCase(),this.nonEmptyTags))return!1;if(3===a.nodeType)return-1==a.data.search(/\S/);var c,l;c=0;for(l=a.childNodes.length;c<l;++c)if(!this.isEmpty(a.childNodes[c]))return!1;
return!0},setCursorAfter:function(a){var c=new g.Utils.RangeObject;this.getIndexInParent(a);var l;3==a.nodeType?(l=a,a=l.nodeValue.length):a.nextSibling&&3==a.nextSibling.nodeType?(l=a.nextSibling,a=0):(l=a.parentNode,a=this.getIndexInParent(a)+1);c.startContainer=c.endContainer=l;c.startOffset=c.endOffset=a;c.select();return c},selectDomNode:function(a){var c=new g.Utils.RangeObject;c.startContainer=c.endContainer=a.parentNode;c.startOffset=this.getIndexInParent(a);c.endOffset=c.startOffset+1;c.select()},
setCursorInto:function(a){var c=new g.Utils.RangeObject;c.startContainer=c.endContainer=a;c.startOffset=c.endOffset=0;c.select()},isEditingHost:function(a){return a&&1==a.nodeType&&("true"==a.contentEditable||a.parentNode&&9==a.parentNode.nodeType&&"on"==a.parentNode.designMode)},isEditable:function(a){return a&&!this.isEditingHost(a)&&(1!=a.nodeType||"false"!=a.contentEditable)&&(this.isEditingHost(a.parentNode)||this.isEditable(a.parentNode))},getEditingHostOf:function(a){if(this.isEditingHost(a))return a;
if(this.isEditable(a)){for(a=a.parentNode;!this.isEditingHost(a);)a=a.parentNode;return a}return null},inSameEditingHost:function(a,c){return this.getEditingHostOf(a)&&this.getEditingHostOf(a)==this.getEditingHostOf(c)},isBlockNode:function(b){return b&&(b.nodeType==a.Node.ELEMENT_NODE&&-1==a(["inline","inline-block","inline-table","none"]).indexOf(a.getComputedStyle(b).display)||b.nodeType==a.Node.DOCUMENT_NODE||b.nodeType==a.Node.DOCUMENT_FRAGMENT_NODE)},getFirstVisibleChild:function(b,c){if(!b||
b.nodeType==a.Node.TEXT_NODE&&this.isEmpty(b)||b.nodeType==a.Node.ELEMENT_NODE&&0==b.offsetHeight&&-1===m.inArray(b.nodeName.toLowerCase(),this.nonEmptyTags))return null;if(b.nodeType==a.Node.TEXT_NODE||b.nodeType==a.Node.ELEMENT_NODE&&0==b.childNodes.length||!m(b).contentEditable())return c?b:null;var l;for(l=0;l<b.childNodes.length;++l){var f=this.getFirstVisibleChild(b.childNodes[l],!0);if(null!=f)return f}return null},getLastVisibleChild:function(b,c){if(!b||b.nodeType==a.Node.TEXT_NODE&&this.isEmpty(b)||
b.nodeType==a.Node.ELEMENT_NODE&&0==b.offsetHeight&&-1===m.inArray(b.nodeName.toLowerCase(),this.nonEmptyTags))return null;if(b.nodeType==a.Node.TEXT_NODE||b.nodeType==a.Node.ELEMENT_NODE&&0==b.childNodes.length||!m(b).contentEditable())return c?b:null;var l;for(l=b.childNodes.length-1;0<=l;--l){var f=this.getLastVisibleChild(b.childNodes[l],!0);if(null!=f)return f}return null}});g.Utils.Dom=new e;return g.Utils.Dom});define("aloha/pluginmanager",["jquery","util/class"],function(m,e){function a(a,
b){var j=a.length,l=function(){0===--j&&b&&b()},f,k;for(f=0;f<a.length;f++)if(k=a[f],k.settings=k.settings||{},"undefined"===typeof k.settings.enabled&&(k.settings.enabled=!0),k.settings.enabled&&k.checkDependencies())(k=k.init())&&"function"===typeof k.done?k.done(l):l()}var g=window.Aloha;return new (e.extend({plugins:{},init:function(c,b){var j=this.plugins,l=g&&g.settings&&g.settings.plugins,f;for(f in l)l.hasOwnProperty(f)&&j[f]&&(j[f].settings=l[f]||{});var k;if(!j||0===b.length)for(k in b=
[],j)j.hasOwnProperty(k)&&b.push(k);l=b;f=[];var d;for(d=0;d<l.length;d++)(k=j[l[d]])&&f.push(k);a(f,c)},register:function(a){if(!a.name)throw Error("Plugin does not have an name.");if(this.plugins[a.name])throw Error('Already registered the plugin "'+a.name+'"!');this.plugins[a.name]=a},makeClean:function(a){for(var b in this.plugins)this.plugins.hasOwnProperty(b)&&(g.Log.isDebugEnabled()&&g.Log.debug(this,"Passing contents of HTML Element with id { "+a.attr("id")+" } for cleaning to plugin { "+
b+" }"),this.plugins[b].makeClean(a))},toString:function(){return"pluginmanager"}}))});define("aloha/core",["jquery","aloha/pluginmanager"],function(m,e){function a(){var a=m.browser,b=a.version;return!(a.webkit&&532.5>parseFloat(b)||a.mozilla&&1.9>parseFloat(b)||a.msie&&7>b||a.opera&&11>b)}function g(){m("html").mousedown(function(a){var b;if(b=c.activeEditable)if(b=!c.eventHandled)a=m(a.target),b=!(a.is(".aloha-dialog")||0<a.closest(".aloha-dialog").length);b&&c.deactivateEditable()}).mouseup(function(){c.eventHandled=
!1})}var c=window.Aloha,b=[{fn:null,event:null,deferred:null},{fn:function(b,l){if(a())m.browser.webkit?m("html").addClass("aloha-webkit"):m.browser.opera?m("html").addClass("aloha-opera"):m.browser.msie?m("html").addClass("aloha-ie"+parseInt(m.browser.version,10)):m.browser.mozilla&&m("html").addClass("aloha-mozilla"),-1!==navigator.appVersion.indexOf("Win")?c.OSName="Win":-1!==navigator.appVersion.indexOf("Mac")?c.OSName="Mac":-1!==navigator.appVersion.indexOf("X11")?c.OSName="Unix":-1!==navigator.appVersion.indexOf("Linux")&&
(c.OSName="Linux"),g(),c.settings.base=c.getAlohaUrl(),c.Log.init(),c.settings.errorhandling&&(window.onerror=function(a,b,f){c.Log.error(c,"Error message: "+a+"\nURL: "+b+"\nLine Number: "+f);return true}),b(),l();else{var f=window.console;if(f){var k=f.error?"error":f.log?"log":null;if(k)f[k]("This browser is not supported")}}},event:null,deferred:null},{fn:function(a,b){c.RepositoryManager.init();a();b()},event:null,deferred:null},{fn:function(a,b){if(0===c.loadedPlugins.length){var f=e.plugins,
k;for(k in f)f.hasOwnProperty(k)&&c.loadedPlugins.push(k)}var d=!1;e.init(function(){d||(a(),d=!0);b()},c.loadedPlugins);d||(a(),d=!0)},event:"aloha-plugins-loaded",deferred:null},{fn:function(a,b){var f;for(f=0;f<c.editables.length;f++)c.editables[f].ready||c.editables[f].init();a();b()},event:null,deferred:null},{fn:null,event:"aloha-ready",deferred:null}];m.extend(!0,c,{version:"0.22.6",editables:[],activeEditable:null,settings:{},defaults:{},ui:{},OSName:"Unknown",loadedPlugins:[],_pluginBaseUrlByName:{},
init:function(){c.initialize(b)},getLoadedPlugins:function(){return this.loadedPlugins},isPluginLoaded:function(a){var b=false;m.each(this.loadedPlugins,function(f,c){if(a===c.toString()){b=true;return false}});return b},activateEditable:function(a){var b=c.editables,f;for(f=0;f<b.length;f++)b[f]!==a&&b[f].isActive&&b[f].blur();c.activeEditable=a},getActiveEditable:function(){return c.activeEditable},deactivateEditable:function(){if(c.activeEditable){c.activeEditable.blur();c.activeEditable=null}},
getEditableById:function(a){var b=m("#"+a);b.length&&"textarea"===b[0].nodeName.toLowerCase()&&(a=a+"-aloha");for(b=0;b<c.editables.length;b++)if(c.editables[b].getId()===a)return c.editables[b];return null},isEditable:function(a){var b,f;b=0;for(f=c.editables.length;b<f;b++)if(c.editables[b].originalObj.get(0)===a)return true;return false},getEditableHost:function(a){if(!a)return null;var b;a.parents().andSelf().each(function(){var a;for(a=0;a<c.editables.length;a++)if(c.editables[a].originalObj.get(0)===
this){b=c.editables[a];return false}});return b},log:function(a,b,f){typeof c.Log!=="undefined"&&c.Log.log(a,b,f)},registerEditable:function(a){c.editables.push(a)},unregisterEditable:function(a){a=m.inArray(a,c.editables);a!==-1&&c.editables.splice(a,1)},isModified:function(){var a;for(a=0;a<c.editables.length;a++)if(c.editables[a].isModified&&c.editables[a].isModified())return true;return false},getAlohaUrl:function(){return c.settings.baseUrl||""},getPluginUrl:function(a){if(a)return null;(a=c.settings._pluginBaseUrlByName[a])&&
(a.match("^(/|http[s]?:).*")||(a=c.getAlohaUrl()+"/"+a));return a},disableObjectResizing:function(){try{var a;try{a=document.queryCommandSupported("enableObjectResizing")}catch(b){a=false;c.Log.log("enableObjectResizing is not supported.")}if(a){document.execCommand("enableObjectResizing",false,false);c.Log.log("enableObjectResizing disabled.")}}catch(f){c.Log.error(f,"Could not disable enableObjectResizing")}},toString:function(){return"Aloha"}});return c});define("aloha/console",["aloha/core","util/class",
"jquery"],function(m,e){var a=e.extend({init:function(){if("undefined"===typeof m.settings.logLevels||!m.settings.logLevels)m.settings.logLevels={error:!0,warn:!0};if("undefined"===typeof m.settings.logHistory||!m.settings.logHistory)m.settings.logHistory={};m.settings.logHistory.maxEntries||(m.settings.logHistory.maxEntries=100);m.settings.logHistory.highWaterMark||(m.settings.logHistory.highWaterMark=90);m.settings.logHistory.levels||(m.settings.logHistory.levels={error:!0,warn:!0});this.flushLogHistory();
m.trigger("aloha-logger-ready")},logHistory:[],highWaterMarkReached:!1,log:function(a,c,b){"undefined"===typeof c&&(b=a);"string"!==typeof c&&(c&&c.toString)&&(c=c.toString());"undefined"===typeof b&&(b=c,c=void 0);if("undefined"===typeof a||!a)a="log";a=a.toLowerCase();if("undefined"!==typeof m.settings.logLevels&&m.settings.logLevels[a]){c=c||"Unkown Aloha Component";this.addToLogHistory({level:a,component:c,message:b,date:new Date});var j=window.console;switch(a){case "error":window.console&&j.error&&
(!c&&!b?j.error("Error occured without message and component"):j.error(c+": "+b));break;case "warn":window.console&&j.warn&&j.warn(c+": "+b);break;case "info":window.console&&j.info&&j.info(c+": "+b);break;case "debug":window.console&&j.log&&j.log(c+" ["+a+"]: "+b);break;default:window.console&&j.log&&j.log(c+" ["+a+"]: "+b)}}},error:function(a,c){this.log("error",a,c)},warn:function(a,c){this.log("warn",a,c)},info:function(a,c){this.log("info",a,c)},debug:function(a,c){this.log("debug",a,c)},deprecated:function(a,
c){this.log("warn",a,c);if(m.settings.logLevels.deprecated)throw Error(c);},isLogLevelEnabled:function(a){return m.settings&&m.settings.logLevels&&m.settings.logLevels[a]},isErrorEnabled:function(){return this.isLogLevelEnabled("error")},isWarnEnabled:function(){return this.isLogLevelEnabled("warn")},isInfoEnabled:function(){return this.isLogLevelEnabled("info")},isDebugEnabled:function(){return this.isLogLevelEnabled("debug")},addToLogHistory:function(a){m.settings.logHistory||this.init();if(!(0>=
m.settings.logHistory.maxEntries)&&m.settings.logHistory.levels[a.level]){this.logHistory.push(a);!this.highWaterMarkReached&&this.logHistory.length>=m.settings.logHistory.maxEntries*m.settings.logHistory.highWaterMark/100&&(m.trigger("aloha-log-full"),this.highWaterMarkReached=!0);for(;this.logHistory.length>m.settings.logHistory.maxEntries;)this.logHistory.shift()}},getLogHistory:function(){return this.logHistory},flushLogHistory:function(){this.logHistory=[];this.highWaterMarkReached=!1}}),a=new a;
return m.Log=m.Console=a});window.GENTICS=window.GENTICS||{};window.GENTICS.Utils=window.GENTICS.Utils||{};define("util/range",["jquery","util/dom","util/class","aloha/console","aloha/rangy-core"],function(m,e,a,g,c){function b(a,b){var d=[],c;for(c=1===a.nodeType?a:a.parentNode;c&&!(c===b||9===c.nodeType);)1===c.nodeType&&d.push(c),c=c.parentNode;return d}var j=window.GENTICS,l=window.Aloha;j.Utils.RangeObject=a.extend({_constructor:function(a){if("object"===typeof a){if("undefined"!==typeof a.startContainer&&
(this.startContainer=a.startContainer),"undefined"!==typeof a.startOffset&&(this.startOffset=a.startOffset),"undefined"!==typeof a.endContainer&&(this.endContainer=a.endContainer),"undefined"!==typeof a.endOffset)this.endOffset=a.endOffset}else!0===a&&this.initializeFromUserSelection()},startContainer:void 0,startOffset:void 0,endContainer:void 0,endOffset:void 0,deleteContents:function(){e.removeRange(this)},log:function(a){g.deprecated("Utils.RangeObject",'log() is deprecated. use console.log() from module "aloha/console" instead: '+
a)},isCollapsed:function(){return!this.endContainer||this.startContainer===this.endContainer&&this.startOffset===this.endOffset},getCommonAncestorContainer:function(){if(this.commonAncestorContainer)return this.commonAncestorContainer;this.updateCommonAncestorContainer();return this.commonAncestorContainer},getContainerParents:function(a,c){var d=c?this.endContainer:this.startContainer;return!d?!1:m(b(d,a?a[0]:null))},getStartContainerParents:function(a){return this.getContainerParents(a,!1)},getEndContainerParents:function(a){return this.getContainerParents(a,
!0)},updateCommonAncestorContainer:function(a){if(a)this.commonAncestorContainer=a;else{var b=this.getStartContainerParents(),d=this.getEndContainerParents(),c;if(!(0<b.length&&0<d.length))return g.warn("aloha/range","could not find commonAncestorContainer"),!1;for(c=0;c<b.length;c++)if(-1!=d.index(b[c])){this.commonAncestorContainer=b[c];break}}g.debug(a?"commonAncestorContainer was set successfully":"commonAncestorContainer was calculated successfully");return!0},getCollapsedIERange:function(a,
b){var d=document.body.createTextRange(),c,j,l;l=this.searchElementToLeft(a,b);l.element?(c=document.body.createTextRange(),c.moveToElementText(l.element),d.setEndPoint("StartToEnd",c),0!==l.characters?d.moveStart("character",l.characters):(d.moveStart("character",1),d.moveStart("character",-1))):(this.searchElementToRight(a,b),j=3==a.nodeType?a.parentNode:a,c=document.body.createTextRange(),c.moveToElementText(j),d.setEndPoint("StartToStart",c),0!==l.characters&&d.moveStart("character",l.characters));
d.collapse();return d},select:function(){var a;if("undefined"===typeof this.startContainer||"undefined"===typeof this.endContainer)return g.warn("can not select an empty range"),!1;a=c.createRange();a.setStart(this.startContainer,this.startOffset);a.setEnd(this.endContainer,this.endOffset);c.getSelection().setSingleRange(a)},searchElementToLeft:function(a,b){var d,c=0;3===a.nodeType?(c=b,d=a.previousSibling):0<b&&(d=a.childNodes[b-1]);for(;d&&3===d.nodeType;)c+=d.data.length,d=d.previousSibling;return{element:d,
characters:c}},searchElementToRight:function(a,b){var d,c=0;3===a.nodeType?(c=a.data.length-b,d=a.nextSibling):b<a.childNodes.length&&(d=a.childNodes[b]);for(;d&&3===d.nodeType;)c+=d.data.length,d=d.nextSibling;return{element:d,characters:c}},update:function(a){g.debug("now updating rangeObject");this.initializeFromUserSelection(a);this.updateCommonAncestorContainer()},initializeFromUserSelection:function(){var a=c.getSelection();if(!a||!a.rangeCount)return!1;a=a.getRangeAt(0);if(!a)return!1;this.startContainer=
a.startContainer;this.endContainer=a.endContainer;this.startOffset=a.startOffset;this.endOffset=a.endOffset;this.correctRange()},correctRange:function(){var a,b;this.clearCaches();if(this.isCollapsed()){if(1===this.startContainer.nodeType){if(0<this.startOffset&&3===this.startContainer.childNodes[this.startOffset-1].nodeType){this.startContainer=this.startContainer.childNodes[this.startOffset-1];this.startOffset=this.startContainer.data.length;this.endContainer=this.startContainer;this.endOffset=
this.startOffset;return}if(0<this.startOffset&&1===this.startContainer.childNodes[this.startOffset-1].nodeType){if(a=j.Utils.Dom.searchAdjacentTextNode(this.startContainer,this.startOffset,!0)){this.startContainer=this.endContainer=a;this.startOffset=this.endOffset=a.data.length;return}if(a=j.Utils.Dom.searchAdjacentTextNode(this.startContainer,this.startOffset,!1)){this.startContainer=this.endContainer=a;this.startOffset=this.endOffset=0;return}}if(this.startOffset<this.startContainer.childNodes.length&&
3===this.startContainer.childNodes[this.startOffset].nodeType){this.startContainer=this.startContainer.childNodes[this.startOffset];this.startOffset=0;this.endContainer=this.startContainer;this.endOffset=0;return}}if(3===this.startContainer.nodeType&&0===this.startOffset&&(a=j.Utils.Dom.searchAdjacentTextNode(this.startContainer.parentNode,j.Utils.Dom.getIndexInParent(this.startContainer),!0))&&0<m(a).closest(l.activeEditable.obj).length)this.startContainer=this.endContainer=a,this.startOffset=this.endOffset=
a.data.length}else{if(1===this.startContainer.nodeType)if(this.startOffset<this.startContainer.childNodes.length&&3===this.startContainer.childNodes[this.startOffset].nodeType)this.startContainer=this.startContainer.childNodes[this.startOffset],this.startOffset=0;else if(this.startOffset<this.startContainer.childNodes.length&&1===this.startContainer.childNodes[this.startOffset].nodeType){a=!1;for(b=this.startContainer.childNodes[this.startOffset];!1===a&&b.childNodes&&0<b.childNodes.length;)b=b.childNodes[0],
3===b.nodeType&&(a=b);!1!==a&&(this.startContainer=a,this.startOffset=0)}if(3===this.startContainer.nodeType&&this.startOffset===this.startContainer.data.length&&(a=j.Utils.Dom.searchAdjacentTextNode(this.startContainer.parentNode,j.Utils.Dom.getIndexInParent(this.startContainer)+1,!1)))this.startContainer=a,this.startOffset=0;if(3===this.endContainer.nodeType&&0===this.endOffset)if(this.endContainer.previousSibling&&3===this.endContainer.previousSibling.nodeType)this.endContainer=this.endContainer.previousSibling,
this.endOffset=this.endContainer.data.length;else if(this.endContainer.previousSibling&&1===this.endContainer.previousSibling.nodeType&&this.endContainer.parentNode){a=this.endContainer.parentNode;for(b=0;b<a.childNodes.length;++b)if(a.childNodes[b]==this.endContainer){this.endOffset=b;break}this.endContainer=a}1==this.endContainer.nodeType&&0===this.endOffset&&this.endContainer.previousSibling&&(3===this.endContainer.previousSibling.nodeType?(this.endContainer=this.endContainer.previousSibling,this.endOffset=
this.endContainer.data.length):1===this.endContainer.previousSibling.nodeType&&(this.endContainer.previousSibling.childNodes&&0<this.endContainer.previousSibling.childNodes.length)&&(this.endContainer=this.endContainer.previousSibling,this.endOffset=this.endContainer.childNodes.length));if(1==this.endContainer.nodeType)if(0<this.endOffset&&3===this.endContainer.childNodes[this.endOffset-1].nodeType)this.endContainer=this.endContainer.childNodes[this.endOffset-1],this.endOffset=this.endContainer.data.length;
else if(0<this.endOffset&&1===this.endContainer.childNodes[this.endOffset-1].nodeType){a=!1;for(b=this.endContainer.childNodes[this.endOffset-1];!1===a&&b.childNodes&&0<b.childNodes.length;)b=b.childNodes[b.childNodes.length-1],3===b.nodeType&&(a=b);!1!==a&&(this.endContainer=a,this.endOffset=this.endContainer.data.length)}}},clearCaches:function(){this.commonAncestorContainer=void 0},getRangeTree:function(a){"undefined"===typeof a&&(a=this.getCommonAncestorContainer());this.inselection=!1;return this.recursiveGetRangeTree(a)},
recursiveGetRangeTree:function(a){var b=0,d=this,c=[];m(a).contents().each(function(l){var g="none",e=!1,u=!1,t=!1,m=!1,z=!1,x=!1;d.isCollapsed()&&(a===d.startContainer&&d.startOffset===l)&&(c[b]=new j.Utils.RangeTree,c[b].type="collapsed",c[b].domobj=void 0,d.inselection=!1,t=!0,b++);if(!d.inselection&&!t)switch(this.nodeType){case 3:this===d.startContainer&&(d.inselection=!0,g=0<d.startOffset?"partial":"full",e=d.startOffset,u=this.length);break;case 1:if(this===d.startContainer&&0===d.startOffset&&
(d.inselection=!0,g="full"),a===d.startContainer&&d.startOffset===l)d.inselection=!0,g="full"}if(d.inselection&&!t){"none"==g&&(g="full");switch(this.nodeType){case 3:this===d.endContainer&&(d.inselection=!1,d.endOffset<this.length&&(g="partial"),!1===e&&(e=0),u=d.endOffset);break;case 1:this===d.endContainer&&0===d.endOffset&&(d.inselection=!1)}a===d.endContainer&&d.endOffset<=l&&(d.inselection=!1,g="none")}c[b]=new j.Utils.RangeTree;c[b].domobj=this;c[b].type=g;"partial"==g&&(c[b].startOffset=e,
c[b].endOffset=u);c[b].children=d.recursiveGetRangeTree(this);if(0<c[b].children.length){for(l=0;l<c[b].children.length;++l)switch(c[b].children[l].type){case "none":m=!0;break;case "full":x=!0;break;case "partial":z=!0}z||x&&m?c[b].type="partial":x&&(!z&&!m)&&(c[b].type="full")}b++});this.isCollapsed()&&(a===this.startContainer&&this.startOffset==a.childNodes.length)&&(c[b]=new j.Utils.RangeTree,c[b].type="collapsed",c[b].domobj=void 0);return c},findMarkup:function(a,c,d){var d=d?this.endContainer:
this.startContainer,j,c=c?c[0]:null;if(d){c=b(d,c);d=0;for(j=c.length;d<j;d++)if(a.apply(c[d]))return c[d];return!1}},getText:function(){return this.isCollapsed()?"":this.recursiveGetText(this.getRangeTree())},recursiveGetText:function(a){if(!a)return"";var b=this,d="";m.each(a,function(){"full"==this.type?d+=m(this.domobj).text():"partial"==this.type&&3===this.domobj.nodeType?d+=m(this.domobj).text().substring(this.startOffset,this.endOffset):"partial"==this.type&&(1===this.domobj.nodeType&&this.children)&&
(d+=b.recursiveGetText(this.children))});return d}});j.Utils.RangeTree=a.extend({domobj:{},type:null,children:[]});return j.Utils.RangeObject});define("util/arrays",[],function(){function m(a,g){var c,b,j=[];c=0;for(b=a.length;c<b;c++)j.push(g(a[c]));return j}function e(a,g){return a.map(g)}return{filter:function(a,g){var c,b,j,l=[];c=0;for(b=a.length;c<b;c++)j=a[c],g(j)&&l.push(j);return l},indexOf:function(a,g){var c,b;c=0;for(b=a.length;c<b;c++)if(g===a[c])return c;return-1},reduce:function(a,
g,c){var b,j;b=0;for(j=a.length;b<j;b++)g=c(g,a[b]);return g},applyNotNull:function(a,g){return null==a?null:g(a)},sortUnique:function(a,g){var c;if(g){a.sort(g);for(c=1;c<a.length;c++)0===g(a[c],a[c-1])&&a.splice(c--,1)}else{a.sort();for(c=1;c<a.length;c++)a[c]==a[c-1]&&a.splice(c--,1)}return a},equal:function(a,g,c){var b,j=a.length;if(j!==g.length)return!1;if(c)for(b=0;b<j;b++){if(!c(a[b],g[b]))return!1}else for(b=0;b<j;b++)if(a[b]!==g[b])return!1;return!0},map:Array.prototype.map?e:m}});define("util/strings",
["jquery"],function(){var m=/\s+/;return{words:function(e){e=e.split(m);e.length&&""===e[0]&&e.shift();e.length&&""===e[e.length-1]&&e.pop();return e},dashesToCamelCase:function(e){return e.replace(/[\-]([a-z])/gi,function(a,g){return g.toUpperCase()})},camelCaseToDashes:function(e){return e.replace(/[A-Z]/g,function(a){return"-"+a.toLowerCase()})}}});define("PubSub",[],function(){var m={},e={},a=0;return{sub:function(g,c){if("function"!==typeof c)return-1;var b=m[g];b||(b=m[g]=[]);b.push(++a);e[a]=
{channel:g,callback:c};return a},unsub:function(a){if(-1===a||!e[a])return!1;var c=e[a]&&m[e[a].channel];delete e[a];for(var b=c.length;b;)if(c[--b]===a)return c.splice(b,1),!0;return!1},pub:function(a,c){var b=a.split("."),j,l=b.length,f="",k=0;for(j=0;j<l;++j){var f=f+((0===j?"":".")+b[j]),d;var q=f;d=c;if(m[q]){d?"object"!==typeof d&&(d={data:d}):d={};d.channel=q;for(var q=m[q].slice(),o=void 0,o=0;o<q.length;++o)e[q[o]].callback(d);d=o}else d=0;k+=d}return k}}});define("aloha/engine",["aloha/core",
"aloha/ecma5shims","jquery"],function(m,e,a){function g(a,b){return a.hasAttribute?a.hasAttribute(b):"undefined"!=typeof a.attributes[b]}function c(a){return null===a||!a||a===wb}function b(a,b){"string"==typeof b&&(b=[b]);"object"==typeof b&&(b=e(b).map(function(a){return a.toUpperCase()}));return a&&1==a.nodeType&&c(a.namespaceURI)&&("undefined"==typeof b||-1!=e(b).indexOf(a.tagName))}function j(a){return a&&1==a.nodeType&&c(a.namespaceURI)}function l(a,b){return a&&1==a.nodeType&&c(a.namespaceURI)&&
b.toUpperCase()===a.nodeName}function f(a,b){var d;if(d=a)if(d=1==a.nodeType)if(d=c(a.namespaceURI))a:{d=a.nodeName;var f,k;d=d.toUpperCase();f=0;for(k=b.length;f<k;f++)if(b[f].toUpperCase()===d){d=!0;break a}d=!1}return d}function k(a){var b,d=0;if(!a||!a.style)return 0;if("undefined"!==typeof a.style.length)return a.style.length;for(b in a.style)a.style[b]&&(0!==a.style[b]&&"false"!==a.style[b])&&d++;return d}function d(a){if(!a)return null;var b=[],d;for(d=a.length>>>0;d--;)b[d]=a[d];return b}
function q(a){for(;a&&!a.nextSibling;)a=a.parentNode;return!a?null:a.nextSibling}function o(a){return a.hasChildNodes()?a.firstChild:q(a)}function r(a){if(a.previousSibling){for(a=a.previousSibling;a.hasChildNodes();)a=a.lastChild;return a}return a.parentNode&&a.parentNode.nodeType==e.Node.ELEMENT_NODE?a.parentNode:null}function p(a,b){return a&&b&&Boolean(e.compareDocumentPosition(a,b)&e.Node.DOCUMENT_POSITION_CONTAINED_BY)}function u(a,b){return b&&a&&Boolean(e.compareDocumentPosition(b,a)&e.Node.DOCUMENT_POSITION_CONTAINED_BY)}
function t(a,b){return Boolean(e.compareDocumentPosition(a,b)&e.Node.DOCUMENT_POSITION_FOLLOWING)}function y(a){for(var b=[];a.parentNode;)b.unshift(a.parentNode),a=a.parentNode;return b}function z(a){for(var b=[],d=q(a);null!=(a=o(a))&&a!=d;)b.push(a);return b}function x(a){return{"xx-small":1,small:2,medium:3,large:4,"x-large":5,"xx-large":6,"xxx-large":7}[a]}function v(a){return"ltr"==a.dir?"ltr":"rtl"==a.dir?"rtl":!j(a.parentNode)?"ltr":v(a.parentNode)}function A(a){for(var b=0;a.previousSibling;)b++,
a=a.previousSibling;return b}function B(a){switch(a.nodeType){case e.Node.PROCESSING_INSTRUCTION_NODE:case e.Node.DOCUMENT_TYPE_NODE:return 0;case e.Node.TEXT_NODE:case e.Node.COMMENT_NODE:return a.length;default:return a.childNodes.length}}function E(a,b,d,c){if(a==d){if(b==c)return"equal";if(b<c)return"before";if(b>c)return"after"}var f=e.compareDocumentPosition(d,a);if(f&e.Node.DOCUMENT_POSITION_FOLLOWING){c=E(d,c,a,b);if("before"==c)return"after";if("after"==c)return"before"}if(f&e.Node.DOCUMENT_POSITION_CONTAINS){for(;d.parentNode!=
a;)d=d.parentNode;if(A(d)<b)return"after"}return"before"}function F(a){for(;null!=a.parentNode;)a=a.parentNode;return a}function J(a,b){return"after"!==E(a,0,b.startContainer,b.startOffset)||"before"!==E(a,B(a),b.endContainer,b.endOffset)?!1:F(a)==F(b.startContainer)}function I(a,b){"undefined"==typeof b&&(b=function(){return!0});for(var d=a.startContainer,d=d.hasChildNodes()&&a.startOffset<d.childNodes.length?d.childNodes[a.startOffset]:a.startOffset==B(d)?q(d):o(d),c=a.endContainer,c=c.hasChildNodes()&&
a.endOffset<c.childNodes.length?c.childNodes[a.endOffset]:q(c),f=[];t(d,c);)J(d,a)&&b(d)?(f.push(d),d=q(d)):d=o(d);return f}function N(a,b){"undefined"==typeof b&&(b=function(){return!0});for(var d=a.startContainer,d=d.hasChildNodes()&&a.startOffset<d.childNodes.length?d.childNodes[a.startOffset]:a.startOffset==B(d)?q(d):o(d),c=a.endContainer,c=c.hasChildNodes()&&a.endOffset<c.childNodes.length?c.childNodes[a.endOffset]:q(c),f=[];t(d,c);)J(d,a)&&b(d)&&f.push(d),d=o(d);return f}function D(a){if("currentcolor"==
a.toLowerCase())return null;var b=document.createElement("span");document.body.appendChild(b);b.style.color="black";var d=document.createElement("span");b.appendChild(d);d.style.color=a;a=e.getComputedStyle(d).color;if("rgb(0, 0, 0)"==a&&(b.color="white",a=e.getComputedStyle(d).color,"rgb(0, 0, 0)"!=a))return null;document.body.removeChild(b);return/^rgba\([0-9]+, [0-9]+, [0-9]+, 1\)$/.test(a)?a.replace("rgba","rgb").replace(", 1)",")"):"transparent"==a?"rgba(0, 0, 0, 0)":a}function Z(a){a=a.toLowerCase();
if(-1!=e("aliceblue antiquewhite aqua aquamarine azure beige bisque black blanchedalmond blue blueviolet brown burlywood cadetblue chartreuse chocolate coral cornflowerblue cornsilk crimson cyan darkblue darkcyan darkgoldenrod darkgray darkgreen darkgrey darkkhaki darkmagenta darkolivegreen darkorange darkorchid darkred darksalmon darkseagreen darkslateblue darkslategray darkslategrey darkturquoise darkviolet deeppink deepskyblue dimgray dimgrey dodgerblue firebrick floralwhite forestgreen fuchsia gainsboro ghostwhite gold goldenrod gray green greenyellow grey honeydew hotpink indianred indigo ivory khaki lavender lavenderblush lawngreen lemonchiffon lightblue lightcoral lightcyan lightgoldenrodyellow lightgray lightgreen lightgrey lightpink lightsalmon lightseagreen lightskyblue lightslategray lightslategrey lightsteelblue lightyellow lime limegreen linen magenta maroon mediumaquamarine mediumblue mediumorchid mediumpurple mediumseagreen mediumslateblue mediumspringgreen mediumturquoise mediumvioletred midnightblue mintcream mistyrose moccasin navajowhite navy oldlace olive olivedrab orange orangered orchid palegoldenrod palegreen paleturquoise palevioletred papayawhip peachpuff peru pink plum powderblue purple red rosybrown royalblue saddlebrown salmon sandybrown seagreen seashell sienna silver skyblue slateblue slategray slategrey snow springgreen steelblue tan teal thistle tomato turquoise violet wheat white whitesmoke yellow yellowgreen".split(" ")).indexOf(a))return a;
a=D(a);return(a=/^rgb\(([0-9]+), ([0-9]+), ([0-9]+)\)$/.exec(a))?"#"+parseInt(a[1],10).toString(16).replace(/^.$/,"0$&")+parseInt(a[2],10).toString(16).replace(/^.$/,"0$&")+parseInt(a[3],10).toString(16).replace(/^.$/,"0$&"):null}function ca(a){a=e(a).trim();if(/^[\-+]?[0-9]+(\.[0-9]+)?([eE][\-+]?[0-9]+)?$/.test(a)){var b;"+"==a[0]?(a=a.slice(1),b="relative-plus"):"-"==a[0]?(a=a.slice(1),b="relative-minus"):b="absolute";a=parseInt(a,10);"relative-plus"==b&&(a+=3);"relative-minus"==b&&(a=3-a);1>a&&
(a=1);7<a&&(a=7);a={1:"xx-small",2:"small",3:"medium",4:"large",5:"x-large",6:"xx-large",7:"xxx-large"}[a]}return a}function ba(b){b=ca(b);if(-1==a.inArray(b,"xx-small x-small small medium large x-large xx-large xxx-large".split(" "))&&!/^[0-9]+(\.[0-9]+)?(cm|mm|in|pt|pc|px)$/.test(b))return null;var d=document.createElement("font");document.body.appendChild(d);"xxx-large"==b?d.size=7:d.style.fontSize=b;b=parseInt(e.getComputedStyle(d).fontSize,10);document.body.removeChild(d);for(var c=1;7>c;){d=
document.createElement("font");d.size=c;document.body.appendChild(d);var f=parseInt(e.getComputedStyle(d).fontSize,10);d.size=1+c;var k=parseInt(e.getComputedStyle(d).fontSize,10);document.body.removeChild(d);if(b<(k+f)/2)return""+c;c++}return"7"}function T(a,b,d,c){var f;0==db&&"undefined"!=typeof d?Fa=d:0==db&&(Fa=null,Fa=d);if(!M.hasOwnProperty(a))throw"NOT_SUPPORTED_ERR";if("enabled"!=b&&!M[a].hasOwnProperty(b))throw"INVALID_ACCESS_ERR";db++;try{f=c()}catch(k){throw db--,k;}db--;return f}function $(b,
d){b=b.toLowerCase();return T(b,"action",d,function(b){return function(){return-1!=a.inArray(b,"copy cut paste selectall stylewithcss usecss".split(" "))||null!==d}}(b))}function G(a){var b=new window.GENTICS.Utils.RangeObject;b.startContainer=a.startContainer;b.startOffset=a.startOffset;b.endContainer=a.endContainer;b.endOffset=a.endOffset;b.select()}function O(a,b,d,c){var f=a.toLowerCase(),k=b,j=d;if(1==arguments.length||4<=arguments.length&&"undefined"==typeof k)k=!1;if(2>=arguments.length||4<=
arguments.length&&"undefined"==typeof j)j="";return T(f,"action",c,function(a,b,d){return function(){if(!$(a))return!1;M[a].action(d,c);G(c);return!0}}(f,k,j))}function R(a,b){a=a.toLowerCase();return T(a,"state",b,function(a){return function(){return!$(a,b)?!1:"undefined"!=typeof za(a,b)?za(a,b):M[a].state(b)}}(a))}function W(a,b){a=a.toLowerCase();return T(a,"value",b,function(){return!$(a,b)?"":"fontsize"==a&&void 0!==Ja("fontsize",b)?ba(Ja("fontsize",b)):"undefined"!=typeof Ja(a,b)?Ja(a,b):M[a].value(b)})}
function Q(a){return a&&1==a.nodeType&&c(a.namespaceURI)&&da[a.nodeName]}function K(a){return a&&(a.nodeType==e.Node.ELEMENT_NODE&&!xb[e.getComputedStyle(a).display]||a.nodeType==e.Node.DOCUMENT_NODE||a.nodeType==e.Node.DOCUMENT_FRAGMENT_NODE)}function P(a){return a&&!K(a)}function ea(a){return a&&a.nodeType==e.Node.ELEMENT_NODE&&("true"==a.contentEditable||a.parentNode&&a.parentNode.nodeType==e.Node.DOCUMENT_NODE&&"on"==a.parentNode.designMode)}function C(b){return b&&!ea(b)&&(b.nodeType!=e.Node.ELEMENT_NODE||
"false"!=b.contentEditable||a(b).hasClass("aloha-table-wrapper"))&&(ea(b.parentNode)||C(b.parentNode))}function S(a){var b;for(b=0;b<a.childNodes.length;b++)if(C(a.childNodes[b])||S(a.childNodes[b]))return!0;return!1}function V(a){if(ea(a))return a;if(C(a)){for(a=a.parentNode;!ea(a);)a=a.parentNode;return a}return null}function fa(a,b){return V(a)&&V(a)==V(b)}function Na(b){if(!l(b,"br"))return!1;for(var d=b.parentNode;"inline"==e.getComputedStyle(d).display;)d=d.parentNode;var c=d.style.height,f=
d.style.maxHeight,k=d.style.minHeight;d.style.height="auto";d.style.maxHeight="none";a.browser.msie&&8>a.browser.version||(d.style.minHeight="0");var j=document.createTextNode("​"),g=d.offsetHeight;if(0==g)throw"isCollapsedLineBreak: original height is zero, bug?";b.parentNode.insertBefore(j,b.nextSibling);b=d.offsetHeight;j.parentNode.removeChild(j);d.style.height=c;d.style.maxHeight=f;a.browser.msie&&8>a.browser.version||(d.style.minHeight=k);return g<b-5}function Ia(b){if(!l(b,"br")||l(b.parentNode,
"li")&&1==b.parentNode.childNodes.length)return!1;for(var d=b.parentNode;"inline"==e.getComputedStyle(d).display;)d=d.parentNode;var c=d.style.height,f=d.style.maxHeight,k=d.style.minHeight,j=d.contentEditable;d.style.height="auto";d.style.maxHeight="none";d.style.minHeight="0";a.browser.msie&&7>=a.browser.version&&(d.contentEditable="false");var g=d.offsetHeight;if(0==g)throw"isExtraneousLineBreak: original height is zero, bug?";var q=b.style.display;b.style.display="none";var o=d.offsetHeight;d.style.height=
c;d.style.maxHeight=f;d.style.minHeight=k;a.browser.msie&&7>=a.browser.version&&(d.contentEditable=j);b.style.display=q;return g==o}function sa(b){return b&&b.nodeType==e.Node.TEXT_NODE&&(""==b.data||/^[\t\n\r ]+$/.test(b.data)&&b.parentNode&&b.parentNode.nodeType==e.Node.ELEMENT_NODE&&-1!=a.inArray(e.getComputedStyle(b.parentNode).whiteSpace,["normal","nowrap"])||/^[\t\r ]+$/.test(b.data)&&b.parentNode&&b.parentNode.nodeType==e.Node.ELEMENT_NODE&&"pre-line"==e.getComputedStyle(b.parentNode).whiteSpace||
/^[\t\n\r ]+$/.test(b.data)&&b.parentNode&&b.parentNode.nodeType==e.Node.DOCUMENT_FRAGMENT_NODE)}function Da(a){if(!sa(a))return!1;if(""==a.data)return!0;var b=a.parentNode;if(!b||e(y(a)).some(function(a){return a.nodeType==e.Node.ELEMENT_NODE&&"none"==e.getComputedStyle(a).display}))return!0;for(;!K(b)&&b.parentNode;)b=b.parentNode;for(var d=a;d!=b;){d=r(d);if(K(d)||l(d,"br"))return!0;if(d.nodeType==e.Node.TEXT_NODE&&!sa(d)||l(d,"img"))break}d=a;for(a=q(b);d!=a;){d=o(d);if(K(d)||l(d,"br"))return!0;
if(d&&d.nodeType==e.Node.TEXT_NODE&&!sa(d)||l(d,"img"))break}return!1}function ia(a){var b;if(!a||e(y(a).concat(a)).filter(function(a){return a.nodeType==e.Node.ELEMENT_NODE},!0).some(function(a){return"none"==e.getComputedStyle(a).display}))return!1;if(K(a)||a.nodeType==e.Node.TEXT_NODE&&!Da(a)||l(a,"img")||l(a,"br")&&!Ia(a))return!0;for(b=0;b<a.childNodes.length;b++)if(ia(a.childNodes[b]))return!0;return!1}function ja(a){return a&&!ia(a)}function ua(a){var b;if(Na(a)&&!Ia(a))return!0;if(!P(a)||
a.nodeType!=e.Node.ELEMENT_NODE)return!1;var d=!1;for(b=0;b<a.childNodes.length;b++){if(!ja(a.childNodes[b])&&!ua(a.childNodes[b]))return!1;ua(a.childNodes[b])&&(d=!0)}return d}function H(){var b;if(Fa)b=Fa;else if(m.getSelection().rangeCount)b=m.getSelection().getRangeAt(0);else return null;if(-1==a.inArray(b.startContainer.nodeType,[e.Node.TEXT_NODE,e.Node.ELEMENT_NODE])||-1==a.inArray(b.endContainer.nodeType,[e.Node.TEXT_NODE,e.Node.ELEMENT_NODE])||!b.startContainer.ownerDocument||!b.endContainer.ownerDocument||
!u(b.startContainer,b.startContainer.ownerDocument)||!u(b.endContainer,b.endContainer.ownerDocument))throw"Invalid active range; test bug?";return b}function ka(a,b,d,c){-1==d&&(d=b.childNodes.length);var f=a.parentNode,k=A(a),j,l=[c];for(j=0;j<m.getSelection().rangeCount;j++)l.push(m.getSelection().getRangeAt(j));var g=[];e(l).forEach(function(a){g.push([a.startContainer,a.startOffset]);g.push([a.endContainer,a.endOffset])});e(g).forEach(function(a){a[0]==b&&a[1]>d&&a[1]++;if(a[0]==f&&(a[1]==k||
a[1]==k+1)){a[0]=b;a[1]=a[1]+(d-k)}a[0]==f&&a[1]>k+1&&a[1]--});b.childNodes.length==d?b.appendChild(a):b.insertBefore(a,b.childNodes[d]);var q=null;if(g[0][1]>g[0][0].childNodes.length&&g[1][1]>g[1][0].childNodes.length)c.setStart(a,0),c.setEnd(a,0);else{c.setStart(g[0][0],g[0][1]);c.setEnd(g[1][0],g[1][1]);m.getSelection().removeAllRanges();for(j=1;j<l.length;j++)q=m.createRange(),q.setStart(g[2*j][0],g[2*j][1]),q.setEnd(g[2*j+1][0],g[2*j+1][1]),m.getSelection().addRange(q);q&&(c=q)}}function Sa(b,
d){a.browser.msie&&(7<=a.browser.version&&"undefined"!==typeof b.attributes[a.expando])&&a(b).removeAttr(a.expando);var c=b.attributes,f;for(f=0;f<c.length;f++){var k=c[f];if("undefined"===typeof k.specified||k.specified)"function"===typeof d.setAttributeNS?d.setAttributeNS(k.namespaceURI,k.name,k.value):d.setAttribute(k.name,k.value)}}function qa(a,b,d){if(l(a,b)||!a.parentNode)return a;b=a.ownerDocument.createElement(b);a.parentNode.insertBefore(b,a);for(Sa(a,b);a.childNodes.length;)ka(a.firstChild,
b,b.childNodes.length,d);a.parentNode.removeChild(a);d.startContainer===a&&(d.startContainer=b);d.endContainer===a&&(d.endContainer=b);return b}function Ra(a){var b=a.previousSibling;if(b){for(;b.hasChildNodes();)b=b.lastChild;for(;ja(b)&&!Ia(b)&&b!=a.parentNode;)b=r(b);C(b)&&Ia(b)&&b.parentNode.removeChild(b)}}function Wa(a){for(var b=a;b.hasChildNodes();)b=b.lastChild;for(;ja(b)&&!Ia(b)&&b!=a;)b=r(b);C(b)&&Ia(b)&&b.parentNode.removeChild(b)}function bb(a){Ra(a);Wa(a)}function Ca(a,b,d,c){var f;
"undefined"==typeof b&&(b=function(){return!1});"undefined"==typeof d&&(d=function(){return null});if(!a.length||!C(a[0]))return null;P(a[a.length-1])&&(!l(a[a.length-1],"br")&&l(a[a.length-1].nextSibling,"br"))&&a.push(a[a.length-1].nextSibling);d=C(a[0].previousSibling)&&b(a[0].previousSibling)?a[0].previousSibling:C(a[a.length-1].nextSibling)&&b(a[a.length-1].nextSibling)?a[a.length-1].nextSibling:d();if(!d)return null;if(!d.parentNode){a[0].parentNode.insertBefore(d,a[0]);f=c.startContainer;var k=
c.startOffset,j=c.endContainer,g=c.endOffset;f==d.parentNode&&k>=A(d)&&c.setStart(f,k+1);j==d.parentNode&&g>=A(d)&&c.setEnd(j,g+1);Fa&&Fa!==c&&(f=Fa.startContainer,k=Fa.startOffset,j=Fa.endContainer,g=Fa.endOffset,f==d.parentNode&&k>=A(d)&&Fa.setStart(f,k+1),j==d.parentNode&&g>=A(d)&&Fa.setEnd(j,g+1))}k=a[0].parentNode;if(t(d,a[0])){!P(d)&&(P(d.lastChild)&&P(a[0])&&!l(d.lastChild,"BR"))&&d.appendChild(d.ownerDocument.createElement("br"));for(f=0;f<a.length;f++)ka(a[f],d,-1,c)}else{!P(d)&&(P(d.firstChild)&&
P(a[a.length-1])&&!l(a[a.length-1],"BR"))&&d.insertBefore(d.ownerDocument.createElement("br"),d.firstChild);for(f=a.length-1;0<=f;f--)ka(a[f],d,0,c)}C(k)&&!k.hasChildNodes()&&k.parentNode.removeChild(k);if(C(d.nextSibling)&&b(d.nextSibling)){for(!P(d)&&(P(d.lastChild)&&P(d.nextSibling.firstChild)&&!l(d.lastChild,"BR"))&&d.appendChild(d.ownerDocument.createElement("br"));d.nextSibling.hasChildNodes();)ka(d.nextSibling.firstChild,d,-1,c);d.parentNode.removeChild(d.nextSibling)}bb(d);return d}function pa(b,
d){if((yb[d]||f(d,"colgroup table tbody tfoot thead tr".split(" ")))&&"object"==typeof b&&b.nodeType==e.Node.TEXT_NODE&&!/^[ \t\n\f\r]*$/.test(b.data)||(zb[d]||f(d,["script","style","plaintext","xmp"]))&&("object"!=typeof b||b.nodeType!=e.Node.TEXT_NODE)||"object"==typeof b&&(b.nodeType==e.Node.DOCUMENT_NODE||b.nodeType==e.Node.DOCUMENT_FRAGMENT_NODE||b.nodeType==e.Node.DOCUMENT_TYPE_NODE))return!1;j(b)&&(b=b.tagName.toLowerCase());if("string"!=typeof b)return!0;if(j(d)){for(var k=d;k;){if("a"==b&&
l(k,"a")||da[b.toUpperCase()]&&k&&1==k.nodeType&&c(k.namespaceURI)&&Ab[k.nodeName]||/^h[1-6]$/.test(b)&&j(k)&&/^H[1-6]$/.test(k.tagName))return!1;k=k.parentNode}d=d.tagName.toLowerCase()}if("object"==typeof d&&(d.nodeType==e.Node.ELEMENT_NODE||d.nodeType==e.Node.DOCUMENT_FRAGMENT_NODE))return!0;if("string"!=typeof d)return!1;switch(d){case "colgroup":return"col"==b;case "table":return-1!=a.inArray(b,"caption col colgroup tbody td tfoot th thead tr".split(" "));case "tbody":case "thead":case "tfoot":return-1!=
a.inArray(b,["td","th","tr"]);case "tr":return-1!=a.inArray(b,["td","th"]);case "dl":return-1!=a.inArray(b,["dt","dd"]);case "dir":case "ol":case "ul":return-1!=a.inArray(b,["dir","li","ol","ul"]);case "hgroup":return/^h[1-6]$/.test(b)}return-1!=a.inArray(b,"body caption col colgroup frame frameset head html tbody td tfoot th thead tr".split(" "))||-1!=a.inArray(b,["dd","dt"])&&"dl"!=d||"li"==b&&"ol"!=d&&"ul"!=d?!1:(k=Bb[d.toUpperCase()])&&k[b.toUpperCase()]?!1:!0}function cb(a,b){return b.collapsed?
!1:J(a,b)||a==b.startContainer&&a.nodeType==e.Node.TEXT_NODE&&B(a)!=b.startOffset||a==b.endContainer&&a.nodeType==e.Node.TEXT_NODE&&0!=b.endOffset||a.hasChildNodes()&&e(a.childNodes).every(function(a){return cb(a,b)})&&(!u(b.startContainer,a)||b.startContainer.nodeType!=e.Node.TEXT_NODE||0==b.startOffset)&&(!u(b.endContainer,a)||b.endContainer.nodeType!=e.Node.TEXT_NODE||b.endOffset==B(b.endContainer))?!0:!1}function na(a,b){"undefined"==typeof b&&(b=function(){return!0});for(var d=a.startContainer;cb(d.parentNode,
a);)d=d.parentNode;for(var c=q(a.endContainer),f=[];t(d,c);)cb(d,a)&&b(d)&&f.push(d),d=o(d);return f}function Xa(b){if(!j(b))return!1;if(-1!=a.inArray(b.tagName,"B EM I S SPAN STRIKE STRONG SUB SUP U".split(" "))&&(0==b.attributes.length||1==b.attributes.length&&g(b,"style")))return!0;if("FONT"==b.tagName||"A"==b.tagName){var d=b.attributes.length;g(b,"style")&&d--;"FONT"==b.tagName&&(g(b,"color")&&d--,g(b,"face")&&d--,g(b,"size")&&d--);"A"==b.tagName&&g(b,"href")&&d--;if(0==d)return!0}return!1}function Ma(b){return!j(b)||
-1==a.inArray(b.tagName,"A B EM FONT I S SPAN STRIKE STRONG SUB SUP U".split(" "))?!1:0==b.attributes.length?!0:1<b.attributes.length?!1:g(b,"style")&&0==k(b)||"A"==b.tagName&&g(b,"href")||"FONT"==b.tagName&&(g(b,"color")||g(b,"face")||g(b,"size"))||("B"==b.tagName||"STRONG"==b.tagName)&&g(b,"style")&&1==k(b)&&""!=b.style.fontWeight||("I"==b.tagName||"EM"==b.tagName)&&g(b,"style")&&1==k(b)&&""!=b.style.fontStyle||("A"==b.tagName||"FONT"==b.tagName||"SPAN"==b.tagName)&&g(b,"style")&&1==k(b)&&""==b.style.textDecoration||
-1!=a.inArray(b.tagName,"A FONT S SPAN STRIKE U".split(" "))&&g(b,"style")&&1==k(b)&&("line-through"==b.style.textDecoration||"underline"==b.style.textDecoration||"overline"==b.style.textDecoration||"none"==b.style.textDecoration)?!0:!1}function Ea(a,b,d){return null===b&&null===d||"string"==typeof b&&"string"==typeof d&&b==d&&!M[a].hasOwnProperty("equivalentValues")||"string"==typeof b&&"string"==typeof d&&M[a].hasOwnProperty("equivalentValues")&&M[a].equivalentValues(b,d)?!0:!1}function Ga(a,b,
d){if(Ea(a,b,d))return!0;if("fontsize"!=a||"string"!=typeof b||"string"!=typeof d)return!1;var c=Ga;if(void 0===c.sizeMap){c.sizeMap={};var f=document.createElement("font");document.body.appendChild(f);e("xx-small small medium large x-large xx-large xxx-large".split(" ")).forEach(function(a){f.size=x(a);c.sizeMap[a]=e.getComputedStyle(f).fontSize});document.body.removeChild(f)}return b===c.sizeMap[d]||d===c.sizeMap[b]}function ga(a,b){if(a.nodeType!=e.Node.ELEMENT_NODE&&(!a.parentNode||a.parentNode.nodeType!=
e.Node.ELEMENT_NODE))return null;if(a.nodeType!=e.Node.ELEMENT_NODE)return ga(a.parentNode,b);if("createlink"==b||"unlink"==b){for(;a&&(!j(a)||"A"!=a.tagName||!g(a,"href"));)a=a.parentNode;return!a?null:a.getAttribute("href")}if("backcolor"==b||"hilitecolor"==b){for(;("rgba(0, 0, 0, 0)"==e.getComputedStyle(a).backgroundColor||""===e.getComputedStyle(a).backgroundColor||"transparent"==e.getComputedStyle(a).backgroundColor)&&a.parentNode&&a.parentNode.nodeType==e.Node.ELEMENT_NODE;)a=a.parentNode;return"rgba(0, 0, 0, 0)"==
e.getComputedStyle(a).backgroundColor||""===e.getComputedStyle(a).backgroundColor||"transparent"==e.getComputedStyle(a).backgroundColor?"rgb(255, 255, 255)":e.getComputedStyle(a).backgroundColor}if("subscript"==b||"superscript"==b){for(var d=!1,c=!1;P(a);)e.getComputedStyle(a),l(a,"sub")?d=!0:l(a,"sup")&&(c=!0),a=a.parentNode;return d&&c?"mixed":d?"subscript":c?"superscript":null}if("strikethrough"==b){do{if(-1!=e.getComputedStyle(a).textDecoration.indexOf("line-through"))return"line-through";a=a.parentNode}while(a&&
a.nodeType==e.Node.ELEMENT_NODE);return null}if("underline"==b){do{if(-1!=e.getComputedStyle(a).textDecoration.indexOf("underline"))return"underline";a=a.parentNode}while(a&&a.nodeType==e.Node.ELEMENT_NODE);return null}if(!M[b].hasOwnProperty("relevantCssProperty"))throw"Bug: no relevantCssProperty for "+b+" in getEffectiveCommandValue";return e.getComputedStyle(a)[M[b].relevantCssProperty].toString()}function va(a,b){if(("backcolor"==b||"hilitecolor"==b)&&"inline"!=e.getComputedStyle(a).display)return null;
if("createlink"==b||"unlink"==b)return j(a)&&"A"==a.tagName&&g(a,"href")?a.getAttribute("href"):null;if("subscript"==b||"superscript"==b)return l(a,"sup")?"superscript":l(a,"sub")?"subscript":null;if("strikethrough"==b&&""!=a.style.textDecoration)return-1!=a.style.textDecoration.indexOf("line-through")?"line-through":null;if("strikethrough"==b&&f(a,["S","STRIKE"]))return"line-through";if("underline"==b&&""!=a.style.textDecoration)return-1!=a.style.textDecoration.indexOf("underline")?"underline":null;
if("underline"==b&&l(a,"U"))return"underline";var d=M[b].relevantCssProperty;if(null===d)return null;if(""!=a.style[d])return a.style[d];if(c(a.namespaceURI)&&"FONT"==a.tagName){if("color"==d&&g(a,"color"))return a.color;if("fontFamily"==d&&g(a,"face"))return a.face;if("fontSize"==d&&g(a,"size"))return d=parseInt(a.size,10),1>d&&(d=1),7<d&&(d=7),{1:"xx-small",2:"small",3:"medium",4:"large",5:"x-large",6:"xx-large",7:"xxx-large"}[d]}return"fontWeight"==d&&("B"==a.tagName||"STRONG"==a.tagName)?"bold":
"fontStyle"==d&&("I"==a.tagName||"EM"==a.tagName)?"italic":null}function Qa(a,b,d,c){for(var f=a;Xa(f)&&1==f.childNodes.length&&Xa(f.firstChild)&&(!Ma(f)||!Ea(b,va(f,b),d));)f=f.firstChild;if(!(f==a||!Ma(f)||!Ea(b,va(f,b),d)||!Ga(b,ga(f,b),d))){for(;f.hasChildNodes();)ka(f.firstChild,f.parentNode,A(f),c);a.parentNode.insertBefore(f,a.nextSibling);ka(a,f,-1,c)}}function ya(b){var d=[],b=a.makeArray(b),c,f,k,j,l,g;for(c=0;c<b.length;c++){k=b[c];for(f=0;f<qb.length;f++){j=qb[f];l=k;1!=l.nodeType&&(l=
l.parentNode);for(g=null;l&&1==l.nodeType&&null===(g=va(l,j));)l=l.parentNode;d.push([k,j,g])}}return d}function Ha(a,b,f){if(!C(a)||null===va(a,b))return[];if(Ma(a)){var b=Array.prototype.slice.call(d(a.childNodes)),k;for(k=0;k<b.length;k++)ka(b[k],a.parentNode,A(a),f);a.parentNode.removeChild(a);return b}"strikethrough"==b&&-1!=a.style.textDecoration.indexOf("line-through")&&(a.style.textDecoration="line-through"==a.style.textDecoration?"":a.style.textDecoration.replace("line-through",""),""==a.getAttribute("style")&&
a.removeAttribute("style"));"underline"==b&&-1!=a.style.textDecoration.indexOf("underline")&&(a.style.textDecoration="underline"==a.style.textDecoration?"":a.style.textDecoration.replace("underline",""),""==a.getAttribute("style")&&a.removeAttribute("style"));null!==M[b].relevantCssProperty&&(a.style[M[b].relevantCssProperty]="",""==a.getAttribute("style")&&a.removeAttribute("style"));c(a.namespaceURI)&&"FONT"==a.tagName&&("forecolor"==b&&a.removeAttribute("color"),"fontname"==b&&a.removeAttribute("face"),
"fontsize"==b&&a.removeAttribute("size"));l(a,"A")&&("createlink"==b||"unlink"==b)&&a.removeAttribute("href");return null===va(a,b)?[]:[qa(a,"span",f)]}function Pa(b,d,c,f){var k=[],j,g;if(b.parentNode&&null!==c&&(pa(b,"span")&&(Qa(b.previousSibling,d,c,f),Qa(b.nextSibling,d,c,f),Ca([b],function(a){return Ma(a)&&Ea(d,va(a,d),c)&&Ga(d,ga(a,d),c)},function(){return null},f)),!Ga(d,ga(b,d),c)))if(pa(b,"span")){if(!Ga(d,ga(b,d),c)){k=null;if(!eb){if("bold"==d&&("bold"==c||"700"==c))k=b.ownerDocument.createElement("b");
"italic"==d&&"italic"==c&&(k=b.ownerDocument.createElement("i"));"strikethrough"==d&&"line-through"==c&&(k=b.ownerDocument.createElement("s"));"underline"==d&&"underline"==c&&(k=b.ownerDocument.createElement("u"));"forecolor"==d&&Z(c)&&(k=b.ownerDocument.createElement("span"),a(k).css("color",Z(c)));"fontname"==d&&(k=b.ownerDocument.createElement("font"),k.face=c)}if("createlink"==d||"unlink"==d){k=b.ownerDocument.createElement("a");k.setAttribute("href",c);for(j=b.parentNode;j;)l(j,"A")&&(j=qa(j,
"span",f)),j=j.parentNode}if("fontsize"==d&&-1!=a.inArray(c,"xx-small small medium large x-large xx-large xxx-large".split(" "))&&(!eb||"xxx-large"==c))k=b.ownerDocument.createElement("font"),k.size=x(c);if(("subscript"==d||"superscript"==d)&&"subscript"==c)k=b.ownerDocument.createElement("sub");if(("subscript"==d||"superscript"==d)&&"superscript"==c)k=b.ownerDocument.createElement("sup");k||(k=b.ownerDocument.createElement("span"));b.parentNode.insertBefore(k,b);j=M[d].relevantCssProperty;null!==
j&&!Ga(d,ga(k,d),c)&&(k.style[j]=c);"strikethrough"==d&&("line-through"==c&&"line-through"!=ga(k,"strikethrough"))&&(k.style.textDecoration="line-through");"underline"==d&&("underline"==c&&"underline"!=ga(k,"underline"))&&(k.style.textDecoration="underline");ka(b,k,k.childNodes.length,f);if(b.nodeType==e.Node.ELEMENT_NODE&&!Ea(d,ga(b,d),c)){ka(b,k.parentNode,A(k),f);k.parentNode.removeChild(k);k=[];for(j=0;j<b.childNodes.length;j++){if(b.childNodes[j].nodeType==e.Node.ELEMENT_NODE&&(g=va(b.childNodes[j],
d),null!==g&&!Ea(d,c,g)))continue;k.push(b.childNodes[j])}for(j=0;j<k.length;j++)Pa(k[j],d,c,f)}}}else{for(j=0;j<b.childNodes.length;j++){if(b.childNodes[j].nodeType==e.Node.ELEMENT_NODE&&(g=va(b.childNodes[j],d),null!==g&&!Ea(d,c,g)))continue;k.push(b.childNodes[j])}for(j=0;j<k.length;j++)Pa(k[j],d,c,f)}}function Oa(a,b,c,f){if(a.parentNode&&a.parentNode.nodeType==e.Node.ELEMENT_NODE&&!Ga(b,ga(a,b),c)){for(var k=a.parentNode,j=[];C(k)&&k.nodeType==e.Node.ELEMENT_NODE&&!Ga(b,ga(k,b),c);)j.push(k),
k=k.parentNode;if(j.length){var l=va(j[j.length-1],b);if(!(null===l&&l!=c)&&(null===c||Ga(b,ga(j[j.length-1].parentNode,b),c)))for(;j.length;){k=j.pop();null!==va(k,b)&&(l=va(k,b));c=Array.prototype.slice.call(d(k.childNodes));null!==va(k,b)&&Ha(k,b,f);for(k=0;k<c.length;k++){var g=c[k];g!=a&&!(g.nodeType==e.Node.ELEMENT_NODE&&null!==va(g,b)&&!Ea(b,l,va(g,b)))&&g!=j[j.length-1]&&Pa(g,b,l,f)}}}}}function wa(a,b){e(a).forEach(function(a){var d=a[0],c=a[1],a=a[2],f=d;if(!f||f.nodeType!=e.Node.ELEMENT_NODE)f=
f.parentNode;for(;f&&f.nodeType==e.Node.ELEMENT_NODE&&null===va(f,c);)f=f.parentNode;null===a&&f&&f.nodeType==e.Node.ELEMENT_NODE?Oa(d,c,null,b):(f&&f.nodeType==e.Node.ELEMENT_NODE&&!Ea(c,va(f,c),a)||(!f||f.nodeType!=e.Node.ELEMENT_NODE)&&null!==a)&&Pa(d,c,a,b)})}function oa(a,b,d){d=d||H();if(e(na(d)).filter(function(a){return a.nodeType==e.Node.TEXT_NODE},!0).some(C)){if(C(d.startContainer)&&d.startContainer.nodeType==e.Node.TEXT_NODE&&0!=d.startOffset&&d.startOffset!=B(d.startContainer)){var c=
d.startContainer.splitText(d.startOffset),f=m.createRange();if(d.startContainer==d.endContainer){var k=d.endOffset-d.startOffset;f.setEnd(c,k);d.setEnd(c,k)}f.setStart(c,0);m.getSelection().removeAllRanges();m.getSelection().addRange(f);d.setStart(c,0)}C(d.endContainer)&&(d.endContainer.nodeType==e.Node.TEXT_NODE&&0!=d.endOffset&&d.endOffset!=B(d.endContainer))&&(c=d,f=[c.startContainer,c.startOffset],k=[c.endContainer,c.endOffset],c.endContainer.splitText(c.endOffset),c.setStart(f[0],f[1]),c.setEnd(k[0],
k[1]),m.getSelection().removeAllRanges(),m.getSelection().addRange(c));e(na(H(),function(a){return C(a)&&a.nodeType==e.Node.ELEMENT_NODE})).forEach(function(b){Ha(b,a,d)});e(na(d,C)).forEach(function(c){Oa(c,a,b,d);Pa(c,a,b,d)})}else M[a].hasOwnProperty("inlineCommandActivatedValues")&&mb(a,-1!=e(M[a].inlineCommandActivatedValues).indexOf(b),d),"subscript"==a&&nb("superscript",d),"superscript"==a&&nb("subscript",d),null===b?rb(a,d):M[a].hasOwnProperty("value")&&ob(a,b,d)}function fb(a,b){var d;if(a.nodeType===
e.Node.TEXT_NODE&&b<a.length)for(d=b;d<a.length;d++)if("\t"!==a.data.charAt(d)&&"\r"!==a.data.charAt(d)&&"\n"!==a.data.charAt(d)||160===a.data.charCodeAt(d))return!1;if(a.nextSibling&&a.nextSibling.className&&0<=a.nextSibling.className.indexOf("aloha-table-wrapper"))return a.nextSibling;if(a.parentNode&&a.parentNode.nextSibling&&a.parentNode.nextSibling.className&&0<=a.parentNode.nextSibling.className.indexOf("aloha-table-wrapper"))return a.parentNode.nextSibling;if(a.parentNode&&a.parentNode.nextSibling&&
sa(a.parentNode.nextSibling)&&a.parentNode.nextSibling.nextSibling&&a.parentNode.nextSibling.nextSibling.className&&0<=a.parentNode.nextSibling.nextSibling.className.indexOf("aloha-table-wrapper"))return a.parentNode.nextSibling.nextSibling}function la(a,b){var d;if(a.nodeType===e.Node.TEXT_NODE&&0<b)for(d=b-1;0<=d;d--)if("\t"!==a.data.charAt(d)&&"\r"!==a.data.charAt(d)&&"\n"!==a.data.charAt(d)||160===a.data.charCodeAt(d))return!1;return a.previousSibling&&a.previousSibling.className&&0<=a.previousSibling.className.indexOf("aloha-table-wrapper")?
a.previousSibling:a.parentNode&&a.parentNode.previousSibling&&a.parentNode.previousSibling.className&&0<=a.parentNode.previousSibling.className.indexOf("aloha-table-wrapper")?a.parentNode.previousSibling:a.parentNode&&a.parentNode.previousSibling&&sa(a.parentNode.previousSibling)&&a.parentNode.previousSibling.previousSibling&&a.parentNode.previousSibling.previousSibling.className&&0<=a.parentNode.previousSibling.previousSibling.className.indexOf("aloha-table-wrapper")?a.parentNode.previousSibling.previousSibling:
!1}function Ka(a,b){return!a.parentNode&&0==b||0<=b-1&&b-1<a.childNodes.length&&ia(a.childNodes[b-1])&&(K(a.childNodes[b-1])||l(a.childNodes[b-1],"br"))}function Ta(a,b){return!a.parentNode&&b==B(a)||b<a.childNodes.length&&ia(a.childNodes[b])&&K(a.childNodes[b])}function Ua(a){for(var b=0;!Ka(a,b)&&!Ta(a,b);){if(0<=b-1&&b-1<a.childNodes.length&&ia(a.childNodes[b-1]))return!1;0==b||!a.hasChildNodes()?(b=A(a),a=a.parentNode):(a=a.childNodes[b-1],b=B(a))}return!0}function X(a){for(var b=B(a);!Ka(a,b)&&
!Ta(a,b);){if(b<a.childNodes.length&&ia(a.childNodes[b]))return!1;b==B(a)||!a.hasChildNodes()?(b=1+A(a),a=a.parentNode):(a=a.childNodes[b],b=0)}return!0}function L(b,d){var c,f=b[0].parentNode;if(C(f)&&f.parentNode){-1!=a.inArray(f.firstChild,b)&&Ra(f);c=-1!=a.inArray(f.firstChild,b);var k=-1!=a.inArray(f.lastChild,b),j=c&&Ua(f),g=k&&X(f);if(!c&&k){for(c=b.length-1;0<=c;c--)ka(b[c],f.parentNode,1+A(f),d);g&&!X(b[b.length-1])&&b[b.length-1].parentNode.insertBefore(document.createElement("br"),b[b.length-
1].nextSibling);Wa(f)}else{if(!c){c=f.cloneNode(!1);f.removeAttribute("id");for(f.parentNode.insertBefore(c,f);b[0].previousSibling;)ka(f.firstChild,c,c.childNodes.length,d)}for(c=0;c<b.length;c++)ka(b[c],f.parentNode,A(f),d);j&&!Ua(b[0])&&b[0].parentNode.insertBefore(document.createElement("br"),b[0]);P(b[b.length-1])&&(!l(b[b.length-1],"br")&&l(f.firstChild,"br")&&!P(f))&&f.removeChild(f.firstChild);f.hasChildNodes()?Ra(f):(f.parentNode===d.startContainer&&(f.parentNode===d.endContainer&&d.startContainer===
d.endContainer&&d.startOffset===d.endOffset&&f.parentNode.childNodes.length===d.startOffset)&&(d.startOffset=f.parentNode.childNodes.length-1,d.endOffset=d.startOffset),f.parentNode.removeChild(f),g&&!X(b[b.length-1])&&b[b.length-1].parentNode.insertBefore(document.createElement("br"),b[b.length-1].nextSibling));!b[b.length-1].nextSibling&&b[b.length-1].parentNode&&Wa(b[b.length-1].parentNode)}}}function ta(a){if(!j(a))return!1;if("BLOCKQUOTE"==a.tagName)return!0;if("DIV"!=a.tagName)return!1;if("undefined"!==
typeof a.style.length){var b;for(b=0;b<a.style.length;b++)if(/^(-[a-z]+-)?margin/.test(a.style[b]))return!0}else for(b in a.style)if(/^(-[a-z]+-)?margin/.test(b)&&a.style[b]&&0!==a.style[b])return!0;return!1}function ha(b){if(!ta(b)||"BLOCKQUOTE"!=b.tagName&&"DIV"!=b.tagName)return!1;var d;for(d=0;d<b.attributes.length;d++)if(!c(b.attributes[d].namespaceURI)||-1==a.inArray(b.attributes[d].name,["style","class","dir"]))return!1;if("undefined"!==typeof b.style.length)for(d=0;d<b.style.length;d++){if(!/^(-[a-z]+-)?(margin|border|padding)/.test(b.style[d]))return!1}else for(var f in b.style)if(!/^(-[a-z]+-)?(margin|border|padding)/.test(f)&&
b.style[f]&&0!==b.style[f]&&"false"!==b.style[f])return!1;return!0}function xa(a){return f(a,"address div h1 h2 h3 h4 h5 h6 listing p pre xmp".split(" "))}function La(a){return xa(a)||f(a,["li","dt","dd"])}function U(){return document.createElement("br")}function ma(b){b&&(l(b.lastChild,"br")||e(b.childNodes).some(ia)||(a.browser.msie?a.browser.msie&&(7>=a.browser.version&&f(b,"p h1 h2 h3 h4 h5 h6 pre blockquote".split(" ")))&&(b.firstChild||b.appendChild(document.createTextNode("​"))):b.appendChild(U())))}
function aa(d,c){var k;if(C(d))if(e(y(d)).every(function(a){return!fa(d,a)||!pa(d,a)})&&!b(d,Za))if(f(d,["dd","dt"]))Ca([d],function(a){return l(a,"dl")&&!a.attributes.length},function(){return document.createElement("dl")},c);else{if(Q(d)){d=qa(d,Za,c);ma(d);aa(d,c);var j=z(d);for(k=0;k<j.length;k++)aa(j[k],c)}}else{for(var j=ya([d]),g;!pa(d,d.parentNode);){for(k=d.parentNode.childNodes.length-1;0<=k;--k)3==d.parentNode.childNodes[k].nodeType&&0==d.parentNode.childNodes[k].data.length&&(d.parentNode.removeChild(d.parentNode.childNodes[k]),
c.startContainer==d.parentNode&&c.startOffset>k&&c.startOffset--,c.endContainer==d.parentNode&&c.endOffset>k&&c.endOffset--);if(1==d.parentNode.childNodes.length){k=c.startOffset;g=c.endOffset;c.startContainer===d.parentNode&&c.startOffset>A(d)&&(k=c.startOffset+(a(d).contents().length-1));c.endContainer===d.parentNode&&c.endOffset>A(d)&&(g=c.endOffset+(a(d).contents().length-1));a(d).contents().unwrap();c.startOffset=k;c.endOffset=g;break}else if(k=d.parentNode,L([d],c),k===d.parentNode){k=c.startOffset;
g=c.endOffset;c.startContainer===d.parentNode&&c.startOffset>A(d)&&(k=c.startOffset+(a(d).contents().length-1));c.endContainer===d.parentNode&&c.endOffset>A(d)&&(g=c.endOffset+(a(d).contents().length-1));a(d).contents().unwrap();c.startOffset=k;c.endOffset=g;break}}wa(j,c)}}function Y(a,b){function d(a){return f(a,["OL","UL"])}if(l(a,"LI")&&C(a)&&C(a.parentNode))for(var c=null;e(a.childNodes).some(d);){var k=a.lastChild;f(k,["OL","UL"])||!c&&k.nodeType==e.Node.TEXT_NODE&&/^[ \t\n\f\r]*$/.test(k.data)?
(c=null,ka(k,a.parentNode,1+A(a),b)):(c||(c=a.ownerDocument.createElement("li"),a.parentNode.insertBefore(c,a.nextSibling)),ka(k,c,0,b))}}function jb(b,d){f(b,["OL","UL"])&&C(b)&&a(b).children("ol,ul").each(function(a,b){l(b.previousSibling,"LI")&&ka(b,b.previousSibling,b.previousSibling.childNodes.length,d)})}function ra(a){var b=a.startContainer,d=a.startOffset,c=a.endContainer,a=a.endOffset,f=e(y(b).concat(b)).filter(function(a){return l(a,"li")}).slice(-1);f.length&&(d=A(f[0]),b=f[0].parentNode);
if(!Ka(b,d)){do 0==d?(d=A(b),b=b.parentNode):d--;while(!Ka(b,d)&&!Ta(b,d))}for(;0==d&&b.parentNode;)d=A(b),b=b.parentNode;f=e(y(c).concat(c)).filter(function(a){return l(a,"li")}).slice(-1);f.length&&(a=1+A(f[0]),c=f[0].parentNode);if(!Ta(c,a)){do a==B(c)?(a=1+A(c),c=c.parentNode):a++;while(!Ka(c,a)&&!Ta(c,a))}for(;a==B(c)&&c.parentNode;)a=1+A(c),c=c.parentNode;f=m.createRange();f.setStart(b,d);f.setEnd(c,a);return f}function gb(){var a=ra(H()),b=I(a,function(a){return C(a)&&!ta(a)&&(f(a,["ol","ul"])||
f(a.parentNode,["ol","ul"])||pa(a,"li"))});if(!b.length)return"none";if(e(b).every(function(a){return l(a,"ol")||l(a.parentNode,"ol")||l(a.parentNode,"li")&&l(a.parentNode.parentNode,"ol")})&&!e(b).some(function(a){return l(a,"ul")||a.querySelector&&a.querySelector("ul")}))return"ol";if(e(b).every(function(a){return l(a,"ul")||l(a.parentNode,"ul")||l(a.parentNode,"li")&&l(a.parentNode.parentNode,"ul")})&&!e(b).some(function(a){return l(a,"ol")||a.querySelector&&a.querySelector("ol")}))return"ul";
a=e(b).some(function(a){return l(a,"ol")||l(a.parentNode,"ol")||a.querySelector&&a.querySelector("ol")||l(a.parentNode,"li")&&l(a.parentNode.parentNode,"ol")});b=e(b).some(function(a){return l(a,"ul")||l(a.parentNode,"ul")||a.querySelector&&a.querySelector("ul")||l(a.parentNode,"li")&&l(a.parentNode.parentNode,"ul")});return a&&b?"mixed":a?"mixed ol":b?"mixed ul":"none"}function Aa(b){for(;b&&b.nodeType!=e.Node.ELEMENT_NODE||b.nodeType==e.Node.ELEMENT_NODE&&-1!=a.inArray(e.getComputedStyle(b).display,
["inline","none"]);)b=b.parentNode;if(!b||b.nodeType!=e.Node.ELEMENT_NODE)return"left";var d=e.getComputedStyle(b).textAlign.replace(/^-(moz|webkit)-/,"").replace(/^auto$/,"start");return"start"==d?"ltr"==v(b)?"left":"right":"end"==d?"ltr"==v(b)?"right":"left":-1!=a.inArray(d,["center","justify","left","right"])?d:"left"}function Cb(a){var b=[];void 0!==Ja("createlink",a)&&b.push(["createlink",Ja("createlink",a)]);e("bold italic strikethrough subscript superscript underline".split(" ")).forEach(function(d){void 0!==
za(d,a)&&b.push([d,za(d,a)])});e(["fontname","fontsize","forecolor","hilitecolor"]).forEach(function(d){void 0!==Ja(d,a)&&b.push([d,Ja(d,a)])});return b}function Db(a){var b=[],d=e(na(a)).filter(function(a){return C(a)&&a.nodeType==e.Node.TEXT_NODE})[0];if(!d)return b;b.push(["createlink",M.createlink.value(a)]);e("bold italic strikethrough subscript superscript underline".split(" ")).forEach(function(a){-1!=e(M[a].inlineCommandActivatedValues).indexOf(ga(d,a))?b.push([a,!0]):b.push([a,!1])});e(["fontname",
"fontsize","forecolor","hilitecolor"]).forEach(function(d){b.push([d,M[d].value(a)])});b.push(["fontsize",ga(d,"fontsize")]);return b}function hb(a,b){function d(a){return C(a)&&a.nodeType==e.Node.TEXT_NODE}var c,f,k,j=e(na(b)).filter(function(a){return C(a)&&a.nodeType==e.Node.TEXT_NODE})[0];if(j)for(c=0;c<a.length;c++){f=a[c][0];k=a[c][1];if("boolean"==typeof k&&R(f,b)!=k)O(f);else if("string"==typeof k&&"fontsize"!=f&&!Ea(f,W(f,b),k))O(f,!1,k,b);else if("string"==typeof k&&"fontsize"==f&&(void 0!==
Ja("fontsize",b)&&Ja("fontsize",b)!==k||void 0===Ja("fontsize",b)&&!Ga(f,ga(j,"fontsize"),k)))O("fontsize",!1,k,b);else continue;j=e(na(b)).filter(d)[0]||j}else for(c=0;c<a.length;c++)f=a[c][0],k=a[c][1],"boolean"==typeof k&&mb(f,k,b),"string"==typeof k&&ob(f,k,b)}function Eb(a,b,d){if(0==a)return"";if(1==a&&!b&&!d)return" ";if(1==a)return" ";var c="",f;for(f=b?"  ":"  ";3<a;)c+=f,a-=2;return 3==a?c+(!b&&!d?"   ":b&&!d?"   ":!b&&d?"   ":b&&d?"   ":"impossible"):c+(!b&&!d?"  ":b&&!d?"  ":!b&&d?"  ":
b&&d?"  ":"impossible")}function Va(b,d){if(C(b)||ea(b)){for(var c=b,f=d;;)if(0<=f-1&&fa(c,c.childNodes[f-1]))c=c.childNodes[f-1],f=B(c);else if(0==f&&!Ua(c)&&fa(c,c.parentNode))f=A(c),c=c.parentNode;else if(c.nodeType==e.Node.TEXT_NODE&&-1==a.inArray(e.getComputedStyle(c.parentNode).whiteSpace,["pre","pre-wrap"])&&0!=f&&/[ \xa0]/.test(c.data[f-1]))f--;else break;for(var k=c,j=f,l=0,g=!1;;)if(j<k.childNodes.length&&fa(k,k.childNodes[j]))k=k.childNodes[j],j=0;else if(j==B(k)&&!X(k)&&fa(k,k.parentNode))j=
1+A(k),k=k.parentNode;else if(k.nodeType==e.Node.TEXT_NODE&&-1==a.inArray(e.getComputedStyle(k.parentNode).whiteSpace,["pre","pre-wrap"])&&j!=B(k)&&/[ \xa0]/.test(k.data[j]))g&&" "==k.data[j]?k.deleteData(j,1):(g=" "==k.data[j],j++,l++);else break;for(l=Eb(l,0==f&&Ua(c),j==B(k)&&X(k));"before"==E(c,f,k,j);)f<c.childNodes.length?(c=c.childNodes[f],f=0):c.nodeType!=e.Node.TEXT_NODE||f==B(c)?(f=1+A(c),c=c.parentNode):(g=l[0],l=l.slice(1),g!=c.data[f]&&(c.insertData(f,g),c.deleteData(f+1,1)),f++)}}function Ba(a,
b,c,k,j){var g,q={},o;3>arguments.length?g=a:(g=m.createRange(),g.setStart(a,b),g.setEnd(c,k));2==arguments.length&&(q=b);5==arguments.length&&(q=j);var t=null!=q.blockMerging?!!q.blockMerging:!0,r=null!=q.stripWrappers?!!q.stripWrappers:!0;if(g){var y=g.startContainer;o=g.startOffset;for(var z=g.endContainer,x=g.endOffset,v;y.hasChildNodes();)if(o==B(y)&&fa(y,y.parentNode)&&P(y))o=1+A(y),y=y.parentNode;else{if(o==B(y))break;v=y.childNodes[o];if(K(v)||v.nodeType==e.Node.ELEMENT_NODE&&!v.hasChildNodes()||
v.nodeType!=e.Node.ELEMENT_NODE&&v.nodeType!=e.Node.TEXT_NODE)break;y=v;o=0}for(;z.hasChildNodes();)if(0==x&&fa(z,z.parentNode)&&P(z))x=A(z),z=z.parentNode;else{if(0==x)break;v=z.childNodes[x-1];if(K(v)||v.nodeType==e.Node.ELEMENT_NODE&&!v.hasChildNodes()||v.nodeType!=e.Node.ELEMENT_NODE&&v.nodeType!=e.Node.TEXT_NODE)break;z=v;x=B(v)}if("after"!==E(z,x,y,o))g.setEnd(g.startContainer,g.startOffset);else{z.nodeType==e.Node.TEXT_NODE&&(x==B(z)&&y!=z)&&(x=1+A(z),z=z.parentNode);g.setStart(y,o);g.setEnd(z,
x);for(var Y=g.startContainer;fa(Y,Y.parentNode)&&P(Y);)Y=Y.parentNode;if(!K(Y)&&!ea(Y)||!pa("span",Y)||f(Y,["td","th"]))Y=null;for(var F=g.endContainer;fa(F,F.parentNode)&&P(F);)F=F.parentNode;if(!K(F)&&!ea(F)||!pa("span",F)||f(F,["td","th"]))F=null;q=Db(g);if(y==z&&C(y)&&y.nodeType==e.Node.TEXT_NODE)v=y.parentNode,y.deleteData(o,x-o),0<o&&(" "===y.data.substr(o-1,1)&&o<y.data.length&&" "===y.data.substr(o,1))&&y.replaceData(o-1,1," "),Va(y,o),g.setStart(g.startContainer,g.startOffset),g.setEnd(g.startContainer,
g.startOffset),hb(q,g),(C(v)||ea(v))&&!P(v)&&ma(v);else{C(y)&&y.nodeType==e.Node.TEXT_NODE&&y.deleteData(o,B(y)-o);var jb=I(g,function(a){return C(a)&&!f(a,["thead","tbody","tfoot","tr","th","td"])});for(o=0;o<jb.length;o++){var qa=jb[o];v=qa.parentNode;v.removeChild(qa);if(r||!p(v,y)&&v!=y)for(;C(v)&&P(v)&&0==B(v);)qa=v.parentNode,qa.removeChild(v),v=qa;(C(v)||ea(v))&&!P(v)&&ma(v)}C(z)&&z.nodeType==e.Node.TEXT_NODE&&z.deleteData(0,x);Va(g.startContainer,g.startOffset);Va(g.endContainer,g.endOffset);
if(!t||!Y||!F||!fa(Y,F)||Y==F)g.setEnd(g.startContainer,g.startOffset);else{1==Y.children.length&&ua(Y.firstChild)&&Y.removeChild(Y.firstChild);1==F.children.length&&ua(F.firstChild)&&F.removeChild(F.firstChild);if(p(Y,F)){for(v=F;v.parentNode!=Y;)v=v.parentNode;g.setStart(Y,A(v));g.setEnd(Y,A(v));if(!F.hasChildNodes()){for(;C(F)&&1==F.parentNode.childNodes.length&&F.parentNode!=Y;)v=F,v.removeChild(F),F=v;C(F)&&(!P(F)&&P(F.previousSibling)&&P(F.nextSibling))&&F.parentNode.insertBefore(document.createElement("br"),
F.nextSibling);C(F)&&F.parentNode.removeChild(F);hb(q,g);return}if(!P(F.firstChild)){hb(q,g);return}r=[];for(r.push(F.firstChild);!l(r[r.length-1],"br")&&P(r[r.length-1].nextSibling);)r.push(r[r.length-1].nextSibling);for(t=ya(r);r[0].parentNode!=Y;)L(r,g);C(r[0].previousSibling)&&l(r[0].previousSibling,"br")&&r[0].parentNode.removeChild(r[0].previousSibling)}else if(u(Y,F)){g.setStart(Y,B(Y));g.setEnd(Y,B(Y));for(v=Y;v.parentNode!=F;)v=v.parentNode;P(v.nextSibling)&&l(Y.lastChild,"br")&&Y.removeChild(Y.lastChild);
F=[];v.nextSibling&&(!l(v.nextSibling,"br")&&!K(v.nextSibling))&&F.push(v.nextSibling);F.length&&(F[F.length-1].nextSibling&&!l(F[F.length-1].nextSibling,"br")&&!K(F[F.length-1].nextSibling))&&F.push(F[F.length-1].nextSibling);t=ya(F);e(F).forEach(function(a){ka(a,Y,-1,g)});l(v.nextSibling,"br")&&v.parentNode.removeChild(v.nextSibling)}else{g.setStart(Y,B(Y));g.setEnd(Y,B(Y));P(F.firstChild)&&l(Y.lastChild,"br")&&Y.removeChild(Y.lastChild);for(t=ya([].slice.call(d(F.childNodes)));F.hasChildNodes();)ka(F.firstChild,
Y,-1,g);for(;!F.hasChildNodes();)v=F.parentNode,v.removeChild(F),F=v}wa(t,g);ma(Y)}hb(q,g)}}}}function ib(a,b){a.hasChildNodes()?L([].slice.call(d(a.childNodes)),b):a.parentNode.removeChild(a)}function Fb(b,d){b&&a(b).find("ul,ol,li").each(function(){a(this).contents().each(function(){if(sa(this)){var b=A(this);d.startContainer===this.parentNode&&d.startOffset>b?d.startOffset--:d.startContainer===this&&(d.startContainer=this.parentNode,d.startOffset=b);d.endContainer===this.parentNode&&d.endOffset>
b?d.endOffset--:d.endContainer===this&&(d.endContainer=this.parentNode,d.endOffset=b);a(this).remove()}})})}function pb(a,d){if(a.length){var c=a[0];if(f(c.parentNode,["OL","UL"])){var k=c.parentNode.tagName;Ca(a,function(a){return b(a,k)},function(){return c.ownerDocument.createElement(k)},d)}else{var j=Ca(a,function(a){return ha(a)},function(){return c.ownerDocument.createElement("blockquote")},d);aa(j,d)}}}function kb(a,b){if(C(a))if(ha(a))ib(a,b);else if(ta(a))a.removeAttribute("class"),a.removeAttribute("dir"),
a.style.margin="",a.style.padding="",a.style.border="",""==a.getAttribute("style")&&a.removeAttribute("style"),qa(a,"div",b);else{for(var c=a.parentNode,k=[];C(c)&&c.nodeType==e.Node.ELEMENT_NODE&&!ha(c)&&!f(c,["ol","ul"]);)k.push(c),c=c.parentNode;if(!C(c)||!ha(c)){c=a.parentNode;for(k=[];C(c)&&c.nodeType==e.Node.ELEMENT_NODE&&!ta(c)&&!f(c,["ol","ul"]);)k.push(c),c=c.parentNode}if(f(a,["OL","UL"])&&(!C(c)||!ta(c))){a.removeAttribute("reversed");a.removeAttribute("start");a.removeAttribute("type");
k=[].slice.call(d(a.childNodes));if(a.attributes.length&&!f(a.parentNode,["OL","UL"]))qa(a,"div",b);else{var j=ya([].slice.call(d(a.childNodes)));ib(a,b);wa(j,b)}for(j=0;j<k.length;j++)aa(k[j],b)}else if(C(c)&&ta(c)){k.push(c);for(j=c;k.length;){var c=k.pop(),g=a.parentNode==c?a:k[k.length-1];P(g)&&(!l(g,"BR")&&l(g.nextSibling,"BR"))&&g.parentNode.removeChild(g.nextSibling);var q=[].slice.call(d(c.childNodes),0,A(g)),c=[].slice.call(d(c.childNodes),1+A(g));pb(q,b);pb(c,b)}kb(j,b)}}}function sb(a,
c){function k(){return document.createElement("li")}function j(a){return f(a,["ol","ul"])}function g(a){return function(d){return b(d,a)}}function q(a){return function(){return document.createElement(a)}}function o(a,d,c){return function(){if(!C(d[0].parentNode)||!ha(d[0].parentNode)||!C(d[0].parentNode.previousSibling)||!b(d[0].parentNode.previousSibling,a))return document.createElement(a);var f=d[0].parentNode.previousSibling;Y(f.lastChild,c);(!C(f.lastChild)||!b(f.lastChild,a))&&f.appendChild(document.createElement(a));
return f.lastChild}}var p=gb()==a?"disable":"enable",a=a.toUpperCase(),t="OL"==a?"UL":"OL",u=[];(function(){var a;for(a=c.endContainer;a!=c.commonAncestorContainer;a=a.parentNode)l(a,"li")&&u.unshift(a);for(a=c.startContainer;a;a=a.parentNode)l(a,"li")&&u.unshift(a)})();e(u).forEach(function(a){Y(a,c)});var r=ra(c);"enable"==p&&e(N(r,function(a){return C(a)&&b(a,t)})).forEach(function(f){if(C(f.previousSibling)&&b(f.previousSibling,a)||C(f.nextSibling)&&b(f.nextSibling,a)){var f=[].slice.call(d(f.childNodes)),
k=ya(f);L(f,c);Ca(f,function(d){return b(d,a)},function(){return null},c);wa(k,c)}else qa(f,a,c)});r=I(r,function(a){return C(a)&&!ta(a)&&(f(a,["OL","UL"])||f(a.parentNode,["OL","UL"])||pa(a,"li"))});"enable"==p&&(r=e(r).filter(function(a){return!f(a,["ol","ul"])||f(a.parentNode,["ol","ul"])}));var m;if("disable"==p)for(;r.length;)if(p=[],p.push(r.shift()),b(p[0],a))kb(p[0],c);else{for(;r.length&&r[0]==p[p.length-1].nextSibling&&!b(r[0],a);)p.push(r.shift());m=ya(p);L(p,c);var y;for(y=0;y<p.length;y++)aa(p[y],
c);wa(m,c)}else for(;r.length;){for(p=[];!p.length||r.length&&r[0]==p[p.length-1].nextSibling;)if(f(r[0],["p","div"]))p.push(qa(r[0],"li",c)),r.shift();else if(f(r[0],["li","ol","ul"]))p.push(r.shift());else{for(m=[];!m.length||r.length&&r[0]==m[m.length-1].nextSibling&&P(r[0])&&P(m[m.length-1])&&!l(m[m.length-1],"br");)m.push(r.shift());p.push(Ca(m,void 0,k,c))}!b(p[0].parentNode,a)&&!e(p).every(j)&&(b(p[0].parentNode,t)?(m=ya(p),L(p,c),Ca(p,g(a),q(a),c),wa(m,c)):aa(Ca(p,g(a),o(a,p,c),c),c))}}function lb(a,
b){function d(a){return function(b){return l(b,"div")&&e(b.attributes).every(function(d){return"align"==d.name&&d.value.toLowerCase()==a||"style"==d.name&&1==k(b)&&b.style.textAlign==a})}}function c(a){return function(){var b=document.createElement("div");b.setAttribute("style","text-align: "+a);return b}}for(var j=ra(b),q=N(j,function(a){return a.nodeType==e.Node.ELEMENT_NODE&&C(a)&&(g(a,"align")||""!=a.style.textAlign||l(a,"center"))}),j=0;j<q.length;j++){var o=q[j];o.removeAttribute("align");o.style.textAlign=
"";""==o.getAttribute("style")&&o.removeAttribute("style");f(o,["div","span","center"])&&!o.attributes.length&&ib(o,b);l(o,"center")&&o.attributes.length&&qa(o,"div",b)}j=ra(Fa);q=[];for(q=I(j,function(b){return C(b)&&pa(b,"div")&&Aa(b)!=a});q.length;){j=[];for(j.push(q.shift());q.length&&q[0]==j[j.length-1].nextSibling;)j.push(q.shift());Ca(j,d(a),c(a),b)}}function tb(a,b){var d;if(a.collapsed){d=a.startOffset;if(b){if(a.startContainer&&a.startContainer.nodeType===e.Node.TEXT_NODE)for(;d<a.startContainer.data.length&&
"​"===a.startContainer.data.charAt(d);)d++}else if(a.startContainer&&a.startContainer.nodeType===e.Node.TEXT_NODE)for(;0<d&&"​"===a.startContainer.data.charAt(d-1);)d--;d!==a.startOffset&&(a.setStart(a.startContainer,d),a.setEnd(a.startContainer,d))}}var wb="http://www.w3.org/1999/xhtml",eb=!1,Fa=null,M={},za,mb,nb,Ja,ob,rb,db=0,da={ADDRESS:!0,ARTICLE:!0,ASIDE:!0,BLOCKQUOTE:!0,CAPTION:!0,CENTER:!0,COL:!0,COLGROUP:!0,DD:!0,DETAILS:!0,DIR:!0,DIV:!0,DL:!0,DT:!0,FIELDSET:!0,FIGCAPTION:!0,FIGURE:!0,FOOTER:!0,
FORM:!0,H1:!0,H2:!0,H3:!0,H4:!0,H5:!0,H6:!0,HEADER:!0,HGROUP:!0,HR:!0,LI:!0,LISTING:!0,MENU:!0,NAV:!0,OL:!0,P:!0,PLAINTEXT:!0,PRE:!0,SECTION:!0,SUMMARY:!0,TABLE:!0,TBODY:!0,TD:!0,TFOOT:!0,TH:!0,THEAD:!0,TR:!0,UL:!0,XMP:!0},xb={inline:!0,"inline-block":!0,"inline-table":!0,none:!0};(function(){function a(f){if(!c||c.startContainer!=f.startContainer||c.endContainer!=f.endContainer||c.startOffset!=f.startOffset||c.endOffset!=f.endOffset)b={},d={},c=f.cloneRange()}var b={},d={},c=null;za=function(d,c){a(c);
return b[d]};mb=function(d,c,f){a(f);b[d]=c};nb=function(d,c){a(c);delete b[d]};Ja=function(b,c){a(c);return d[b]};ob=function(b,c,f){a(f);d[b]=c;"backcolor"==b?d.hilitecolor=c:"hilitecolor"==b&&(d.backcolor=c)};rb=function(b,c){a(c);delete d[b];"backcolor"==b?delete d.hilitecolor:"hilitecolor"==b&&delete d.backcolor}})();var Ab={A:!0,ABBR:!0,B:!0,BDI:!0,BDO:!0,CITE:!0,CODE:!0,DFN:!0,EM:!0,H1:!0,H2:!0,H3:!0,H4:!0,H5:!0,H6:!0,I:!0,KBD:!0,MARK:!0,P:!0,PRE:!0,Q:!0,RP:!0,RT:!0,RUBY:!0,S:!0,SAMP:!0,SMALL:!0,
SPAN:!0,STRONG:!0,SUB:!0,SUP:!0,U:!0,VAR:!0,ACRONYM:!0,LISTING:!0,STRIKE:!0,XMP:!0,BIG:!0,BLINK:!0,FONT:!0,MARQUEE:!0,NOBR:!0,TT:!0},yb={colgroup:!0,table:!0,tbody:!0,tfoot:!0,thead:!0,tr:!0},zb={script:!0,style:!0,plaintext:!0,xmp:!0},$a=a.extend({H1:!0,H2:!0,H3:!0,H4:!0,H5:!0,H6:!0},da),ub={CAPTION:!0,COL:!0,COLGROUP:!0,TBODY:!0,TD:!0,TFOOT:!0,TH:!0,THEAD:!0,TR:!0},vb={DD:!0,DT:!0},Bb={A:a.extend({A:!0},da),DD:vb,DT:vb,LI:{LI:!0},NOBR:a.extend({NOBR:!0},da),H1:$a,H2:$a,H3:$a,H4:$a,H5:$a,H6:$a,TD:ub,
TH:ub,ABBR:da,B:da,BDI:da,BDO:da,CITE:da,CODE:da,DFN:da,EM:da,I:da,KBD:da,MARK:da,P:da,PRE:da,Q:da,RP:da,RT:da,RUBY:da,S:da,SAMP:da,SMALL:da,SPAN:da,STRONG:da,SUB:da,SUP:da,U:da,VAR:da,ACRONYM:da,LISTING:da,STRIKE:da,XMP:da,BIG:da,BLINK:da,FONT:da,MARQUEE:da,TT:da},qb="subscript bold fontname fontsize forecolor hilitecolor italic strikethrough underline".split(" ");M.backcolor={action:function(a,b){/^([0-9a-fA-F]{3}){1,2}$/.test(a)&&(a="#"+a);(/^(rgba?|hsla?)\(.*\)$/.test(a)||Z(a)||"transparent"==
a.toLowerCase())&&oa("backcolor",a,b)},standardInlineValueCommand:!0,relevantCssProperty:"backgroundColor",equivalentValues:function(a,b){return D(a)===D(b)}};M.bold={action:function(a,b){R("bold",b)?oa("bold","normal",b):oa("bold","bold",b)},inlineCommandActivatedValues:["bold","600","700","800","900"],relevantCssProperty:"fontWeight",equivalentValues:function(a,b){return a==b||"bold"==a&&"700"==b||"700"==a&&"bold"==b||"normal"==a&&"400"==b||"400"==a&&"normal"==b}};M.createlink={action:function(a,
b){""!==a&&(e(na(H())).forEach(function(b){e(y(b)).forEach(function(b){C(b)&&(l(b,"a")&&g(b,"href"))&&b.setAttribute("href",a)})}),oa("createlink",a,b))},standardInlineValueCommand:!0};M.fontname={action:function(a,b){oa("fontname",a,b)},standardInlineValueCommand:!0,relevantCssProperty:"fontFamily"};M.fontsize={action:function(b,d){""!==b&&(b=ca(b),(-1!=a.inArray(b,"xx-small x-small small medium large x-large xx-large xxx-large".split(" "))||/^[0-9]+(\.[0-9]+)?(cm|mm|in|pt|pc)$/.test(b))&&oa("fontsize",
b,d))},indeterm:function(){return 2<=e(na(H(),function(a){return C(a)&&a.nodeType==e.Node.TEXT_NODE})).map(function(a){return ga(a,"fontsize")},!0).filter(function(a,b,d){return-1==e(d.slice(0,b)).indexOf(a)}).length},value:function(a){var b=na(a,function(a){return C(a)&&a.nodeType==e.Node.TEXT_NODE})[0];void 0===b&&(b=a.startContainer);a=ga(b,"fontsize");return ba(a)},relevantCssProperty:"fontSize"};M.forecolor={action:function(a,b){/^([0-9a-fA-F]{3}){1,2}$/.test(a)&&(a="#"+a);(/^(rgba?|hsla?)\(.*\)$/.test(a)||
Z(a)||"transparent"==a.toLowerCase())&&oa("forecolor",a,b)},standardInlineValueCommand:!0,relevantCssProperty:"color",equivalentValues:function(a,b){return D(a)===D(b)}};M.hilitecolor={action:function(a,b){/^([0-9a-fA-F]{3}){1,2}$/.test(a)&&(a="#"+a);(/^(rgba?|hsla?)\(.*\)$/.test(a)||Z(a)||"transparent"==a.toLowerCase())&&oa("hilitecolor",a,b)},indeterm:function(){return 2<=e(na(H(),function(a){return C(a)&&a.nodeType==e.Node.TEXT_NODE})).map(function(a){return ga(a,"hilitecolor")},!0).filter(function(a,
b,d){return-1==e(d.slice(0,b)).indexOf(a)}).length},standardInlineValueCommand:!0,relevantCssProperty:"backgroundColor",equivalentValues:function(a,b){return D(a)===D(b)}};M.italic={action:function(a,b){R("italic",b)?oa("italic","normal",b):oa("italic","italic",b)},inlineCommandActivatedValues:["italic","oblique"],relevantCssProperty:"fontStyle"};M.removeformat={action:function(a,b){function d(a){return C(a)&&f(a,"abbr acronym b bdi bdo big blink cite code dfn em font i ins kbd mark nobr q s samp small span strike strong sub sup tt u var".split(" "))}
var c,k;c=na(H(),d);e(c).forEach(function(a){for(;a.hasChildNodes();)ka(a.firstChild,a.parentNode,A(a),H());a.parentNode.removeChild(a)});C(H().startContainer)&&(H().startContainer.nodeType==e.Node.TEXT_NODE&&0!=H().startOffset&&H().startOffset!=B(H().startContainer))&&(H().startContainer==H().endContainer?(c=H().endOffset-H().startOffset,k=H().startContainer.splitText(H().startOffset),H().setStart(k,0),H().setEnd(k,c)):H().setStart(H().startContainer.splitText(H().startOffset),0));C(H().endContainer)&&
(H().endContainer.nodeType==e.Node.TEXT_NODE&&0!=H().endOffset&&H().endOffset!=B(H().endContainer))&&(k=[H().startContainer,H().startOffset],c=[H().endContainer,H().endOffset],H().setEnd(document.documentElement,0),c[0].splitText(c[1]),H().setStart(k[0],k[1]),H().setEnd(c[0],c[1]));e(na(H(),C)).forEach(function(a){for(;d(a.parentNode)&&fa(a.parentNode,a);)L([a],H())});e("subscript bold fontname fontsize forecolor hilitecolor italic strikethrough underline".split(" ")).forEach(function(a){oa(a,null,
b)})}};M.strikethrough={action:function(a,b){R("strikethrough",b)?oa("strikethrough",null,b):oa("strikethrough","line-through",b)},inlineCommandActivatedValues:["line-through"]};M.subscript={action:function(a,b){var d=R("subscript",b);oa("subscript",null,b);d||oa("subscript","subscript",b)},indeterm:function(){var a=na(H(),function(a){return C(a)&&a.nodeType==e.Node.TEXT_NODE});return e(a).some(function(a){return"subscript"==ga(a,"subscript")})&&e(a).some(function(a){return"subscript"!=ga(a,"subscript")})||
e(a).some(function(a){return"mixed"==ga(a,"subscript")})},inlineCommandActivatedValues:["subscript"]};M.superscript={action:function(a,b){var d=R("superscript",b);oa("superscript",null,b);d||oa("superscript","superscript",b)},indeterm:function(){var a=na(H(),function(a){return C(a)&&a.nodeType==e.Node.TEXT_NODE});return e(a).some(function(a){return"superscript"==ga(a,"superscript")})&&e(a).some(function(a){return"superscript"!=ga(a,"superscript")})||e(a).some(function(a){return"mixed"==ga(a,"superscript")})},
inlineCommandActivatedValues:["superscript"]};M.underline={action:function(a,b){R("underline",b)?oa("underline",null,b):oa("underline","underline",b)},inlineCommandActivatedValues:["underline"]};M.unlink={action:function(){var a=H(),b=[],d;for(d=a.startContainer;d;d=d.parentNode)l(d,"A")&&g(d,"href")&&b.unshift(d);for(d=a.startContainer;d!=q(a.endContainer);d=o(d))l(d,"A")&&(g(d,"href")&&(J(d,a)||p(d,a.endContainer)||d==a.endContainer))&&b.push(d);for(d=0;d<b.length;d++)Ha(b[d],"unlink",a)},standardInlineValueCommand:!0};
var Za="p";M["delete"]={action:function(b,d){var c;a.browser.msie&&7>=a.browser.version&&tb(d,!1);if(d.collapsed){Va(d.startContainer,d.startOffset);for(var k=d.startContainer,j=d.startOffset,g=c=!1;;)if(0<j&&(c=l(k.childNodes[j-1],"br")||!1,g=l(k.childNodes[j-1],"hr")||!1),0==j&&C(k.previousSibling)&&ja(k.previousSibling))k.parentNode.removeChild(k.previousSibling);else if(0<=j-1&&j-1<k.childNodes.length&&C(k.childNodes[j-1])&&(ja(k.childNodes[j-1])||c||g)){if(k.removeChild(k.childNodes[j-1]),j--,
c||g){d.setStart(k,j);d.setEnd(k,j);return}}else if(0==j&&P(k)||ja(k))j=A(k),k=k.parentNode;else{if(0<=j-1&&j-1<k.childNodes.length&&C(k.childNodes[j-1])&&l(k.childNodes[j-1],"a")){ib(k.childNodes[j-1],d);return}if(0<=j-1&&j-1<k.childNodes.length&&!K(k.childNodes[j-1])&&!f(k.childNodes[j-1],["br","img"]))k=k.childNodes[j-1],j=B(k);else break}if(c=la(k,j))c.parentNode.removeChild(c);else if(k.nodeType==e.Node.TEXT_NODE&&0!=j)d.setStart(k,j-1),d.setEnd(k,j-1),Ba(k,j-1,k,j);else if(k.nodeType==e.Node.TEXT_NODE&&
0==j&&a.browser.msie)j=1,d.setStart(k,j),d.setEnd(k,j),d.startOffset=0,Ba(d);else if(!P(k))if(0<=j-1&&j-1<k.childNodes.length&&f(k.childNodes[j-1],["br","hr","img"]))d.setStart(k,j),d.setEnd(k,j),Ba(d);else if(f(k,["li","dt","dd"])&&k==k.parentNode.firstChild&&0==j){j=[];for(c=k.parentNode;c;c=c.parentNode)l(c,"li")&&j.unshift(c);for(c=0;c<j.length;c++)Y(j[c],d);c=ya([k]);L([k],d);wa(c,d);f(k,["dd","dt"])&&e(y(k)).every(function(a){return!fa(k,a)||!pa(k,a)})&&(k=qa(k,Za,d));aa(k,d);for(c=0;c<j.length;c++)jb(j[c].parentNode,
d)}else{c=k;for(g=j;;)if(0==g)g=A(c),c=c.parentNode;else if(0<=g-1&&g-1<c.childNodes.length&&C(c.childNodes[g-1])&&ja(c.childNodes[g-1]))c.removeChild(c.childNodes[g-1]),g--;else break;if(0==j&&e(y(k).concat(k)).filter(function(a){return C(a)&&fa(a,k)&&ta(a)}).length){j=m.createRange();j.setStart(k,0);j.setEnd(k,0);j=ra(j);j=I(j,function(a){return C(a)&&!S(a)});for(c=0;c<j.length;c++)kb(j[c],d)}else if(!l(c.childNodes[g],"table"))if(0<=g-1&&g-1<c.childNodes.length&&l(c.childNodes[g-1],"table"))d.setStart(c,
g-1),d.setEnd(c,g);else if(0==j&&(l(c.childNodes[g-1],"hr")||l(c.childNodes[g-1],"br")&&(l(c.childNodes[g-1].previousSibling,"br")||!P(c.childNodes[g-1].previousSibling))))d.setStart(k,j),d.setEnd(k,j),Ba(c,g-1,c,g);else{if(f(c.childNodes[g],["li","dt","dd"])&&P(c.childNodes[g].firstChild)&&0!=g){var q=c.childNodes[g-1];P(q.lastChild)&&!l(q.lastChild,"br")&&q.appendChild(document.createElement("br"));P(q.lastChild)&&q.appendChild(document.createElement("br"))}if(f(c.childNodes[g],["li","dt","dd"])&&
f(c.childNodes[g-1],["li","dt","dd"]))c=c.childNodes[g-1],g=B(c),k=c.nextSibling,j=0;else for(;0<=g-1&&g-1<c.childNodes.length;)C(c.childNodes[g-1])&&ja(c.childNodes[g-1])?(c.removeChild(c.childNodes[g-1]),g--):(c=c.childNodes[g-1],g=B(c));q=m.createRange();q.setStart(c,g);q.setEnd(k,j);Ba(q);if(!document.body&&!d.startContainer||!(document.body==d.startContainer||p(document.body,d.startContainer)))q.startContainer.hasChildNodes()||q.startContainer.nodeType==e.Node.TEXT_NODE?(d.setStart(q.startContainer,
q.startOffset),d.setEnd(q.startContainer,q.startOffset)):(d.setStart(q.startContainer.parentNode,A(q.startContainer)),d.setEnd(q.startContainer.parentNode,A(q.startContainer)))}}}else Ba(d)}};var ab="address dd div dt h1 h2 h3 h4 h5 h6 p pre".split(" ");M.formatblock={action:function(c){function k(a){return function(d){return C(d)&&fa(d,a)&&b(d,ab)&&!e(z(d)).some(Q)}}function j(a){return function(d){return b(d,a)&&!d.attributes.length}}function g(){return!1}function q(a){return function(){return document.createElement(a)}}
var o;/^<.*>$/.test(c)&&(c=c.slice(1,-1));c=c.toLowerCase();if(-1!=e(ab).indexOf(c)){var p=ra(H()),t=I(p,function(a){return C(a)&&(xa(a)||pa(a,"p")||f(a,["dd","dt"]))&&!e(z(a)).some(Q)}),u=ya(t);for(o=0;o<t.length;o++)for(var r=t[o];e(y(r)).some(k(r));)L([r],p);for(wa(u,p);t.length;){if(La(t[0]))o=[].slice.call(d(t[0].childNodes)),u=ya(o),ib(t[0],p),wa(u,p),t.shift();else{o=[];for(o.push(t.shift());t.length&&t[0]==o[o.length-1].nextSibling&&!La(t[0])&&!l(o[o.length-1],"BR");)o.push(t.shift())}aa(Ca(o,
-1==a.inArray(c,["div","p"])?j(c):g,q(c),p),p)}}},indeterm:function(){var a=ra(H()),a=N(a,function(a){return ia(a)&&C(a)&&!a.hasChildNodes()});if(!a.length)return!1;var d=null,c;for(c=0;c<a.length;c++){for(var f=a[c];C(f.parentNode)&&fa(f,f.parentNode)&&!b(f,ab);)f=f.parentNode;var k="";C(f)&&(b(f,ab)&&!e(z(f)).some(Q))&&(k=f.tagName);if(null===d)d=k;else if(d!=k)return!0}return!1},value:function(){var a=ra(H()),a=N(a,function(a){return ia(a)&&C(a)&&!a.hasChildNodes()});if(!a.length)return"";for(a=
a[0];C(a.parentNode)&&fa(a,a.parentNode)&&!b(a,ab);)a=a.parentNode;return C(a)&&b(a,ab)&&!e(z(a)).some(Q)?a.tagName.toLowerCase():""}};M.forwarddelete={action:function(b,d){a.browser.msie&&7>=a.browser.version&&tb(d,!0);if(d.collapsed){Va(d.startContainer,d.startOffset);for(var c=d.startContainer,k=d.startOffset;;)if(k==B(c)&&C(c.nextSibling)&&ja(c.nextSibling))c.parentNode.removeChild(c.nextSibling);else if(k<c.childNodes.length&&C(c.childNodes[k])&&ja(c.childNodes[k]))c.removeChild(c.childNodes[k]);
else if(k<c.childNodes.length&&ua(c.childNodes[k]))k++;else if(k==B(c)&&P(c)||ja(c))k=1+A(c),c=c.parentNode;else if(k<c.childNodes.length&&!K(c.childNodes[k])&&!f(c.childNodes[k],["br","img"]))c=c.childNodes[k],k=0;else break;Va(d.startContainer,d.startOffset);var j=fb(c,k);if(j)j.parentNode.removeChild(j);else if(c.nodeType==e.Node.TEXT_NODE&&k!=B(c)){d.setStart(c,k);d.setEnd(c,k);for(j=k+1;j!=c.length&&/^[\u0300-\u036f\u0591-\u05bd\u05c1\u05c2]$/.test(c.data[j]);)j++;Ba(c,k,c,j)}else if(!P(c))if(k<
c.childNodes.length&&f(c.childNodes[k],["br","hr","img"]))d.setStart(c,k),d.setEnd(c,k),Ba(c,k,c,k+1);else{for(var g=c,j=k;;)if(j==B(g))j=1+A(g),g=g.parentNode;else if(j<g.childNodes.length&&C(g.childNodes[j])&&ja(g.childNodes[j]))g.removeChild(g.childNodes[j]);else break;if(!l(g.childNodes[j-1],"table"))if(l(g.childNodes[j],"table"))d.setStart(g,j),d.setEnd(g,j+1);else if(k==B(c)&&f(g.childNodes[j],["br","hr"]))d.setStart(c,k),d.setEnd(c,k),Ba(g,j,g,j+1);else{for(;j<g.childNodes.length;)C(g.childNodes[j])&&
ja(g.childNodes[j])?g.removeChild(g.childNodes[j]):(g=g.childNodes[j],j=0);Ba(c,k,g,j)}}}else Ba(d)}};M.indent={action:function(){var a=[],b;for(b=H().endContainer;b!=H().commonAncestorContainer;b=b.parentNode)l(b,"LI")&&a.unshift(b);for(b=H().startContainer;b!=H().commonAncestorContainer;b=b.parentNode)l(b,"LI")&&a.unshift(b);for(b=H().commonAncestorContainer;b;b=b.parentNode)l(b,"LI")&&a.unshift(b);for(b=0;b<a.length;b++)Y(a[b],H());a=ra(H());b=[];b=I(a,function(a){return C(a)&&(pa(a,"div")||pa(a,
"ol"))});for(b.length&&(l(b[0],"LI")&&f(b[0].parentNode,["OL","UL"])&&l(b[0].previousSibling,"LI"))&&Y(b[0].previousSibling,a);b.length;){var d=[];for(d.push(b.shift());b.length&&b[0]==d[d.length-1].nextSibling;)d.push(b.shift());pb(d,a)}}};M.inserthorizontalrule={action:function(a,b){for(;0==b.startOffset&&b.startContainer.parentNode;)b.setStart(b.startContainer.parentNode,A(b.startContainer));for(;b.endOffset==B(b.endContainer)&&b.endContainer.parentNode;)b.setEnd(b.endContainer.parentNode,1+A(b.endContainer));
Ba(b,{blockMerging:!1});if(C(H().startContainer)||ea(H().startContainer)){H().startContainer.nodeType==e.Node.TEXT_NODE&&0==H().startOffset&&(H().setStart(H().startContainer.parentNode,A(H().startContainer)),H().collapse(!0));H().startContainer.nodeType==e.Node.TEXT_NODE&&H().startOffset==B(H().startContainer)&&(H().setStart(H().startContainer.parentNode,1+A(H().startContainer)),H().collapse(!0));var d=document.createElement("hr");b.insertNode(d);aa(d,b);b.setStart(d.parentNode,1+A(d));b.setEnd(d.parentNode,
1+A(d));m.getSelection().removeAllRanges();m.getSelection().addRange(b)}}};M.inserthtml={action:function(a,b){Ba(b);if(C(b.startContainer)||ea(b.startContainer)){var d=b.createContextualFragment(a),c=d.lastChild;if(c){var f=z(d);K(b.startContainer)&&e(b.startContainer.childNodes).filter(function(a,b){return C(a)&&ua(a)&&A(a)>=b.startOffset},!0).forEach(function(a){a.parentNode.removeChild(a)});b.insertNode(d);K(b.startContainer)&&ma(b.startContainer);b.setStart(c.parentNode,1+A(c));b.setEnd(c.parentNode,
1+A(c));for(d=0;d<f.length;d++)aa(f[d],b);G(b)}}}};M.insertimage={action:function(a){if(""!==a){var b=H();Ba(b,{stripWrappers:!1});if(C(H().startContainer)||ea(H().startContainer)){K(b.startContainer)&&(1==b.startContainer.childNodes.length&&l(b.startContainer.firstChild,"br")&&0==b.startOffset)&&b.startContainer.removeChild(b.startContainer.firstChild);var d=document.createElement("img");d.setAttribute("src",a);b.insertNode(d);b.setStart(d.parentNode,1+A(d));b.setEnd(d.parentNode,1+A(d));m.getSelection().removeAllRanges();
m.getSelection().addRange(b);d.removeAttribute("width");d.removeAttribute("height")}}}};M.insertlinebreak={action:function(b,d){Ba(d,{stripWrappers:!1});if(C(d.startContainer)||ea(d.startContainer))if(d.startContainer.nodeType!=e.Node.ELEMENT_NODE||pa("br",d.startContainer))if(d.startContainer.nodeType==e.Node.ELEMENT_NODE||pa("br",d.startContainer.parentNode)){var c,f;d.startContainer.nodeType==e.Node.TEXT_NODE&&0==d.startOffset&&(c=d.startContainer.parentNode,f=A(d.startContainer),m.getSelection().collapse(c,
f),d.setStart(c,f),d.setEnd(c,f));d.startContainer.nodeType==e.Node.TEXT_NODE&&d.startOffset==B(d.startContainer)&&(c=d.startContainer.parentNode,f=1+A(d.startContainer),m.getSelection().collapse(c,f),d.setStart(c,f),d.setEnd(c,f));c=document.createElement("br");d.insertNode(c);m.getSelection().collapse(c.parentNode,1+A(c));d.setStart(c.parentNode,1+A(c));d.setEnd(c.parentNode,1+A(c));Na(c)&&(d.insertNode(U()),m.getSelection().collapse(c.parentNode,1+A(c)),d.setStart(c.parentNode,1+A(c)),d.setEnd(c.parentNode,
1+A(c)));a.browser.msie&&8>a.browser.version&&c.parentNode.removeAttribute("style")}}};M.insertorderedlist={action:function(a,b){sb("ol",b)},indeterm:function(){return/^mixed( ol)?$/.test(gb())},state:function(){return"ol"==gb()}};var Gb={LI:!0,DT:!0,DD:!0};M.insertparagraph={action:function(a,b){var d;Ba(b);Fb(V(b.startContainer),b);if(C(b.startContainer)||ea(b.startContainer)){var c=b.startContainer,k=b.startOffset;c.nodeType==e.Node.TEXT_NODE&&(0!=k&&k!=B(c))&&c.splitText(k);c.nodeType==e.Node.TEXT_NODE&&
k==B(c)&&(k=1+A(c),c=c.parentNode);if(c.nodeType==e.Node.TEXT_NODE||c.nodeType==e.Node.COMMENT_NODE)k=A(c),c=c.parentNode;m.getSelection().collapse(c,k);b.setStart(c,k);b.setEnd(c,k);for(var j=c;!La(j)&&C(j.parentNode)&&fa(c,j.parentNode);)j=j.parentNode;if(!C(j)||!fa(j,c)||!La(j)){var g=Za;d=ra(b);d=I(d,function(a){return pa(a,"p")}).slice(0,1);if(!d.length){if(!pa(g,b.startContainer))return;j=document.createElement(g);b.insertNode(j);j.appendChild(U());m.getSelection().collapse(j,0);b.setStart(j,
0);b.setEnd(j,0);return}for(;d[d.length-1].nextSibling&&pa(d[d.length-1].nextSibling,"p");)d.push(d[d.length-1].nextSibling);j=Ca(d,function(){return false},function(){return document.createElement(g)},b)}var q;if("ADDRESS"==j.tagName||"LISTING"==j.tagName||"PRE"==j.tagName){var p=document.createElement("br");d=j.offsetHeight;b.insertNode(p);q=j.offsetHeight;m.getSelection().collapse(c,k+1);b.setStart(c,k+1);b.setEnd(c,k+1);d==q&&!u(o(p),j)&&(b.insertNode(U()),m.getSelection().collapse(c,k+1),b.setEnd(c,
k+1))}else if(Gb[j.tagName]&&(!j.hasChildNodes()||1==j.childNodes.length&&l(j.firstChild,"br"))){if(L([j],b),f(j,["dd","dt"])&&e(y(j)).every(function(a){return!fa(j,a)||!pa(j,a)})&&(j=qa(j,Za,b)),aa(j,b),l(j,"li")&&l(j.nextSibling,"li")&&f(j.nextSibling.firstChild,["ol","ul"])){c=j.nextSibling;k=j.nextSibling.childNodes.length;for(d=0;d<k;d++)j.appendChild(c.childNodes[0]);c.parentNode.removeChild(c)}}else{k=m.createRange();k.setStart(b.startContainer,b.startOffset);for(k.setEnd(j,B(j));0==k.startOffset&&
k.startContainer!=j;)k.setStart(k.startContainer.parentNode,A(k.startContainer));for(;k.startOffset==B(k.startContainer)&&k.startContainer!=j;)k.setStart(k.startContainer.parentNode,1+A(k.startContainer));c=I(k);c=!c.length||1==c.length&&l(c[0],"br");c=/^H[1-6]$/.test(j.tagName)&&c?Za:"DT"==j.tagName&&c?"dd":"DD"==j.tagName&&c?"dt":j.tagName.toLowerCase();c=document.createElement(c);Sa(j,c);c.removeAttribute("id");j.parentNode.insertBefore(c,j.nextSibling);q=N(k);k=k.extractContents();p=z(k);for(d=
0;d<p.length;d++)p[d].nodeType==e.Node.ELEMENT_NODE&&-1==e(q).indexOf(p[d])&&p[d].removeAttribute("id");d=[];if(q=k.firstChild){do sa(q)||d.push(q);while(null!=(q=q.nextSibling))}l(c,"li")&&(d.length&&f(d[0],["ul","ol"]))&&(d=c.offsetHeight,p=U(),c.appendChild(p),q=c.offsetHeight,d!==q&&c.removeChild(p));c.appendChild(k);ma(j);ma(c);m.getSelection().collapse(c,0);b.setStart(c,0);b.setEnd(c,0)}}}};M.inserttext={action:function(b,d){var c;Ba(d,{stripWrappers:!1});if(C(d.startContainer)||ea(d.startContainer))if(1<
b.length)for(c=0;c<b.length;c++)M.inserttext.action(b[c],d);else if(""!=b)if("\n"==b)M.insertparagraph.action("",d);else{c=d.startContainer;var f=d.startOffset;0<=f-1&&(f-1<c.childNodes.length&&c.childNodes[f-1].nodeType==e.Node.TEXT_NODE)&&(c=c.childNodes[f-1],f=B(c));0<=f&&(f<c.childNodes.length&&c.childNodes[f].nodeType==e.Node.TEXT_NODE)&&(c=c.childNodes[f],f=0);var k=c.nodeType==e.Node.ELEMENT_NODE?c:c.parentNode;" "==b&&(k.nodeType==e.Node.ELEMENT_NODE&&-1==a.inArray(e.getComputedStyle(k).whiteSpace,
["pre","pre-wrap"]))&&(b=" ");k=Cb(d);c.nodeType==e.Node.TEXT_NODE?(c.insertData(f,b),m.getSelection().collapse(c,f),d.setStart(c,f),m.getSelection().extend(c,f+1),d.setEnd(c,f+1)):(1==c.childNodes.length&&Na(c.firstChild)&&c.removeChild(c.firstChild),c=document.createTextNode(b),d.insertNode(c),m.getSelection().collapse(c,0),d.setStart(c,0),m.getSelection().extend(c,1),d.setEnd(c,1));hb(k);Va(d.startContainer,d.startOffset);Va(d.endContainer,d.endOffset);m.getSelection().collapseToEnd();d.collapse(!1)}}};
M.insertunorderedlist={action:function(a,b){sb("ul",b)},indeterm:function(){return/^mixed( ul)?$/.test(gb())},state:function(){return"ul"==gb()}};M.justifycenter={action:function(a,b){lb("center",b)},indeterm:function(){var a=N(ra(H()),function(a){return C(a)&&ia(a)&&!a.hasChildNodes()});return e(a).some(function(a){return"center"==Aa(a)})&&e(a).some(function(a){return"center"!=Aa(a)})},state:function(){var a=N(ra(H()),function(a){return C(a)&&ia(a)&&!a.hasChildNodes()});return a.length&&e(a).every(function(a){return"center"==
Aa(a)})},value:function(){var a=N(ra(H()),function(a){return C(a)&&ia(a)&&!a.hasChildNodes()});return a.length?Aa(a[0]):"left"}};M.justifyfull={action:function(a,b){lb("justify",b)},indeterm:function(){var a=N(ra(H()),function(a){return C(a)&&ia(a)&&!a.hasChildNodes()});return e(a).some(function(a){return"justify"==Aa(a)})&&e(a).some(function(a){return"justify"!=Aa(a)})},state:function(){var a=N(ra(H()),function(a){return C(a)&&ia(a)&&!a.hasChildNodes()});return a.length&&e(a).every(function(a){return"justify"==
Aa(a)})},value:function(){var a=N(ra(H()),function(a){return C(a)&&ia(a)&&!a.hasChildNodes()});return a.length?Aa(a[0]):"left"}};M.justifyleft={action:function(a,b){lb("left",b)},indeterm:function(){var a=N(ra(H()),function(a){return C(a)&&ia(a)&&!a.hasChildNodes()});return e(a).some(function(a){return"left"==Aa(a)})&&e(a).some(function(a){return"left"!=Aa(a)})},state:function(){var a=N(ra(H()),function(a){return C(a)&&ia(a)&&!a.hasChildNodes()});return a.length&&e(a).every(function(a){return"left"==
Aa(a)})},value:function(){var a=N(ra(H()),function(a){return C(a)&&ia(a)&&!a.hasChildNodes()});return a.length?Aa(a[0]):"left"}};M.justifyright={action:function(a,b){lb("right",b)},indeterm:function(){var a=N(ra(H()),function(a){return C(a)&&ia(a)&&!a.hasChildNodes()});return e(a).some(function(a){return"right"==Aa(a)})&&e(a).some(function(a){return"right"!=Aa(a)})},state:function(){var a=N(ra(H()),function(a){return C(a)&&ia(a)&&!a.hasChildNodes()});return a.length&&e(a).every(function(a){return"right"==
Aa(a)})},value:function(){var a=N(ra(H()),function(a){return C(a)&&ia(a)&&!a.hasChildNodes()});return a.length?Aa(a[0]):"left"}};M.outdent={action:function(){var a=[];(function(){var b;for(b=H().endContainer;b!=H().commonAncestorContainer;b=b.parentNode)l(b,"li")&&a.unshift(b);for(b=H().startContainer;b;b=b.parentNode)l(b,"li")&&a.unshift(b)})();e(a).forEach(function(a){Y(a,H())});for(var b=ra(H()),d=I(b,function(a){return C(a)&&(!e(z(a)).some(C)||f(a,["ol","ul"])||l(a,"li")&&f(a.parentNode,["ol",
"ul"]))});d.length;){for(;d.length&&(f(d[0],["OL","UL"])||!f(d[0].parentNode,["OL","UL"]));)kb(d.shift(),b);if(!d.length)break;var c=[];for(c.push(d.shift());d.length&&d[0]==c[c.length-1].nextSibling&&!f(d[0],["OL","UL"]);)c.push(d.shift());var k=ya(c);L(c,b);e(c).forEach(aa);wa(k,b)}}};M.selectall={action:function(){var a=document.body;a||(a=document.documentElement);a?m.getSelection().selectAllChildren(a):m.getSelection().removeAllRanges()}};M.stylewithcss={action:function(a){eb="false"!=(""+a).toLowerCase()},
state:function(){return eb}};M.usecss={action:function(a){eb="false"==(""+a).toLowerCase()}};(function(){var a=[],b;for(b in M)M.hasOwnProperty(b)&&a.push(b);e(a).forEach(function(a){null==M[a].relevantCssProperty&&(M[a].relevantCssProperty=null);null!=M[a].inlineCommandActivatedValues&&null==M[a].indeterm&&(M[a].indeterm=function(b){var b=e(na(b,function(a){return C(a)&&a.nodeType==e.Node.TEXT_NODE})).map(function(b){return ga(b,a)}),d=e(b).filter(function(b){return e(M[a].inlineCommandActivatedValues).indexOf(b)!=
-1});return d.length>=1&&b.length-d.length>=1});null!=M[a].inlineCommandActivatedValues&&(M[a].state=function(b){var d=na(b,function(a){return C(a)&&a.nodeType==e.Node.TEXT_NODE});return d.length==0?e(M[a].inlineCommandActivatedValues).indexOf(ga(b.startContainer,a))!=-1:e(d).every(function(b){return e(M[a].inlineCommandActivatedValues).indexOf(ga(b,a))!=-1})});null!=M[a].standardInlineValueCommand&&(M[a].indeterm=function(){var b=e(na(H())).filter(function(a){return C(a)&&a.nodeType==e.Node.TEXT_NODE},
true).map(function(b){return ga(b,a)}),d;for(d=1;d<b.length;d++)if(b[d]!=b[d-1])return true;return false},M[a].value=function(b){var d=na(b,function(a){return C(a)&&a.nodeType==e.Node.TEXT_NODE})[0];if(typeof d=="undefined")d=b.startContainer;return ga(d,a)})})})();return{commands:M,execCommand:O,queryCommandIndeterm:function(a,b){a=a.toLowerCase();return T(a,"indeterm",b,function(a){return function(){return!$(a,b)?!1:M[a].indeterm(b)}}(a))},queryCommandState:R,queryCommandValue:W,queryCommandEnabled:$,
queryCommandSupported:function(a){a=a.toLowerCase();return M.hasOwnProperty(a)},copyAttributes:Sa,createEndBreak:U,isEndBreak:function(a){return l(a,"br")&&a.parentNode.lastChild===a},ensureContainerEditable:ma,isEditingHost:ea,isEditable:C}});define("aloha/selection","aloha/core jquery util/class util/range util/arrays util/strings aloha/console PubSub aloha/engine aloha/ecma5shims aloha/rangy-core".split(" "),function(m,e,a,g,c,b,j,l,f,k){function d(a,b){var d=m.activeEditable?m.activeEditable.obj.parent()[0]:
null,d=e(a).parentsUntil(d).get(),f;f=[];var k,j,g;1===a.nodeType&&a.nodeName!=="BODY"&&a.nodeName!=="HTML"?f.push(a.cloneNode(false).outerHTML):f.push("#"+a.nodeType);g=0;for(j=d.length;g<j;g++){k=d[g];if(k.nodeName==="BODY"||k.nodeName==="HTML")break;f.push(k.cloneNode(false).outerHTML)}f=f.join("");return b&&a===b.node&&c.equal(b.parents,d)&&f===b.html?null:{node:a,parents:d,html:f}}function q(a){var b;if(e.browser.msie&&a.startContainer===a.endContainer&&a.startOffset===a.endOffset&&a.startContainer.nodeType==
3&&a.startOffset==a.startContainer.data.length&&a.startContainer.nextSibling){b=a.startContainer.nextSibling;if("OL"===b.nodeName||"UL"===b.nodeName)a.startContainer.data[a.startContainer.data.length-1]==" "?a.startOffset=a.endOffset=a.startOffset-1:a.startContainer.data=a.startContainer.data+" "}}var o=window.GENTICS,r=null,p=null,g=a.extend({_constructor:function(){this.rangeObject={};this.preventSelectionChangedFlag=false;this.tagHierarchy={textNode:{},abbr:{textNode:true},b:{textNode:true,b:true,
i:true,em:true,sup:true,sub:true,br:true,span:true,img:true,a:true,del:true,ins:true,u:true,cite:true,q:true,code:true,abbr:true,strong:true},pre:{textNode:true,b:true,i:true,em:true,sup:true,sub:true,br:true,span:true,img:true,a:true,del:true,ins:true,u:true,cite:true,q:true,code:true,abbr:true},blockquote:{textNode:true,b:true,i:true,em:true,sup:true,sub:true,br:true,span:true,img:true,a:true,del:true,ins:true,u:true,cite:true,q:true,code:true,abbr:true,p:true,h1:true,h2:true,h3:true,h4:true,h5:true,
h6:true},ins:{textNode:true,b:true,i:true,em:true,sup:true,sub:true,br:true,span:true,img:true,a:true,u:true,p:true,h1:true,h2:true,h3:true,h4:true,h5:true,h6:true},ul:{li:true},ol:{li:true},li:{textNode:true,b:true,i:true,em:true,sup:true,sub:true,br:true,span:true,img:true,ul:true,ol:true,h1:true,h2:true,h3:true,h4:true,h5:true,h6:true,del:true,ins:true,u:true,a:true},tr:{td:true,th:true},table:{tr:true},div:{textNode:true,b:true,i:true,em:true,sup:true,sub:true,br:true,span:true,img:true,ul:true,
ol:true,table:true,h1:true,h2:true,h3:true,h4:true,h5:true,h6:true,del:true,ins:true,u:true,p:true,div:true,pre:true,blockquote:true,a:true},h1:{textNode:true,b:true,i:true,em:true,sup:true,sub:true,br:true,span:true,img:true,a:true,del:true,ins:true,u:true}};this.tagHierarchy={textNode:this.tagHierarchy.textNode,abbr:this.tagHierarchy.abbr,br:this.tagHierarchy.textNode,img:this.tagHierarchy.textNode,b:this.tagHierarchy.b,strong:this.tagHierarchy.b,code:this.tagHierarchy.b,q:this.tagHierarchy.b,blockquote:this.tagHierarchy.blockquote,
cite:this.tagHierarchy.b,i:this.tagHierarchy.b,em:this.tagHierarchy.b,sup:this.tagHierarchy.b,sub:this.tagHierarchy.b,span:this.tagHierarchy.b,del:this.tagHierarchy.del,ins:this.tagHierarchy.ins,u:this.tagHierarchy.b,p:this.tagHierarchy.b,pre:this.tagHierarchy.pre,a:this.tagHierarchy.b,ul:this.tagHierarchy.ul,ol:this.tagHierarchy.ol,li:this.tagHierarchy.li,td:this.tagHierarchy.li,div:this.tagHierarchy.div,h1:this.tagHierarchy.h1,h2:this.tagHierarchy.h1,h3:this.tagHierarchy.h1,h4:this.tagHierarchy.h1,
h5:this.tagHierarchy.h1,h6:this.tagHierarchy.h1,table:this.tagHierarchy.table};this.replacingElements={h1:{p:true,h1:true,h2:true,h3:true,h4:true,h5:true,h6:true,pre:true,blockquote:true}};this.replacingElements={h1:this.replacingElements.h1,h2:this.replacingElements.h1,h3:this.replacingElements.h1,h4:this.replacingElements.h1,h5:this.replacingElements.h1,h6:this.replacingElements.h1,pre:this.replacingElements.h1,p:this.replacingElements.h1,blockquote:this.replacingElements.h1};this.allowedToStealElements=
{h1:{textNode:true}};this.allowedToStealElements={h1:this.allowedToStealElements.h1,h2:this.allowedToStealElements.h1,h3:this.allowedToStealElements.h1,h4:this.allowedToStealElements.h1,h5:this.allowedToStealElements.h1,h6:this.allowedToStealElements.h1,p:this.tagHierarchy.b}},SelectionTree:function(){this.domobj={};this.selection=void 0;this.children=[]},onChange:function(a,b,d){this.updateSelectionTimeout&&window.clearTimeout(this.updateSelectionTimeout);var c=this;this.updateSelectionTimeout=window.setTimeout(function(){var f=
new m.Selection.SelectionRange(true);if(!f.startContainer||"HTML"===f.startContainer.nodeName||"BODY"===f.startContainer.nodeName){if(!this.updateSelectionTimeout)c.onChange(a,b,10+(d||5)*2)}else m.Selection._updateSelection(b,f)},d||5)},preventSelectionChanged:function(){this.preventSelectionChangedFlag=true},isSelectionChangedPrevented:function(){var a=this.preventSelectionChangedFlag;this.preventSelectionChangedFlag=false;return a},isSelectionEditable:function(){return this.rangeObject.commonAncestorContainer&&
e(this.rangeObject.commonAncestorContainer).contentEditable()},isFloatingMenuVisible:function(){var a=e(m.Selection.rangeObject.commonAncestorContainer).attr("data-aloha-floatingmenu-visible");return a!=="undefined"&&a==="true"?true:false},updateSelection:function(a){return this._updateSelection(a,null)},_updateSelection:function(a,b){if(a&&a.originalEvent&&true===a.originalEvent.stopSelectionUpdate||typeof b==="undefined")return false;this.rangeObject=b=b||new m.Selection.SelectionRange(true);b.update();
if(b&&(b.startContainer&&b.endContainer)&&e(b.commonAncestorContainer).closest(".aloha-editable").length>0){var c=!(3===b.startContainer.nodeType&&!e(b.startContainer.parentNode).contentEditable()),f=!(3===b.endContainer.nodeType&&!e(b.endContainer.parentNode).contentEditable());if(!c||!f){m.getSelection().removeAllRanges();return true}}if(this.isSelectionChangedPrevented())return true;m.trigger("aloha-selection-changed-before",[this.rangeObject,a]);m.trigger("aloha-selection-changed",[this.rangeObject,
a]);var c=this.rangeObject,k=c.startContainer,f=c.endContainer;if(!k||!f)j.warn("aloha/selection","encountered range object without start or end container");else{k=d(k,r);f=d(f,p);if(k||f){r=k;p=f;l.pub("aloha.selection.context-change",{range:c,event:a})}}m.trigger("aloha-selection-changed-after",[this.rangeObject,a]);return true},getSelectionTree:function(a){if(!a)return this.rangeObject.getSelectionTree();if(!a.commonAncestorContainer){m.Log.error(this,"the rangeObject is missing the commonAncestorContainer");
return false}this.inselection=false;if(o.Utils.Dom.doCleanup({merge:true},a)){a.update();a.select()}return this.recursiveGetSelectionTree(a,a.commonAncestorContainer)},recursiveGetSelectionTree:function(a,b){var d=0,c=this,f=[];e(b).contents().each(function(k){var j="none",g=false,l=false,e=false,q=false,o=false,p=false;if(a.isCollapsed()&&b===a.startContainer&&a.startOffset==k){f[d]=new m.Selection.SelectionTree;f[d].selection="collapsed";f[d].domobj=void 0;c.inselection=false;e=true;d++}if(!c.inselection&&
!e){var u;try{u=this.nodeType}catch(r){return}switch(u){case 3:if(this===a.startContainer){c.inselection=true;j=a.startOffset>0?"partial":"full";g=a.startOffset;l=this.length}break;case 1:if(this===a.startContainer&&a.startOffset===0){c.inselection=true;j="full"}if(b===a.startContainer&&a.startOffset===k){c.inselection=true;j="full"}}}if(c.inselection&&!e){j=="none"&&(j="full");switch(this.nodeType){case 3:if(this===a.endContainer){c.inselection=false;a.endOffset<this.length&&(j="partial");g===false&&
(g=0);l=a.endOffset}break;case 1:if(this===a.endContainer&&a.endOffset===0)c.inselection=false}if(b===a.endContainer&&a.endOffset<=k){c.inselection=false;j="none"}}f[d]=new m.Selection.SelectionTree;f[d].domobj=this;f[d].selection=j;if(j=="partial"){f[d].startOffset=g;f[d].endOffset=l}f[d].children=c.recursiveGetSelectionTree(a,this);j=f[d].children.length;if(j>0){for(k=0;k<j;++k)switch(f[d].children[k].selection){case "none":q=true;break;case "full":p=true;break;case "partial":o=true}if(o||p&&q)f[d].selection=
"partial";else if(p&&!o&&!q)f[d].selection="full"}d++});if(a.isCollapsed()&&b===a.startContainer&&a.startOffset==b.childNodes.length){f[d]=new m.Selection.SelectionTree;f[d].selection="collapsed";f[d].domobj=void 0}return f},getRangeObject:function(){return this.rangeObject},isRangeObjectWithinMarkup:function(a,b,d,c,f){var k=this,a=e(!b?a.startContainer:a.endContainer).parents(),j=false,g=-1;typeof c!=="undefined"&&typeof c!=="function"&&m.Log.error(this,"parameter tagComparator is not a function");
typeof c==="undefined"&&(c=function(a,b){return k.standardTextLevelSemanticsComparator(a,b)});a.length>0&&a.each(function(){if(this===f){m.Log.debug(k,"reached limit dom obj");return false}if(c(this,d)){j===false&&(j=[]);m.Log.debug(k,"reached object equal to markup");g++;j[g]=this;return true}});return j},standardSectionsAndGroupingContentComparator:function(a,b){if(a.nodeType!==1){m.Log.debug(this,"only element nodes (nodeType == 1) can be compared");return false}if(!b[0].nodeName)return false;
var d=m.Selection.replacingElements[a.nodeName.toLowerCase()];return d&&d[b[0].nodeName.toLowerCase()]},standardTagNameComparator:function(a,b){if(a.nodeType===1)return a.nodeName!=b[0].nodeName?false:true;m.Log.debug(this,"only element nodes (nodeType == 1) can be compared");return false},standardTextLevelSemanticsComparator:function(a,b){if(a.nodeType===1)return a.nodeName!=b[0].nodeName||!this.standardAttributesComparator(a,b)?false:true;m.Log.debug(this,"only element nodes (nodeType == 1) can be compared");
return false},standardAttributesComparator:function(a,d){var f=b.words(a&&a.className||""),k=b.words(d.length&&d[0].className||"");c.sortUnique(f);c.sortUnique(k);return c.equal(f,k)},changeMarkup:function(a,b,d){var c=b[0].tagName.toLowerCase(),j,g,l=this.isRangeObjectWithinMarkup(a,false,b,d,j),q=this.isRangeObjectWithinMarkup(a,true,b,d,j),o,p,u,r;if(this.replacingElements[c]){g=a;a=new this.SelectionRange(a);c=m.activeEditable?m.activeEditable.obj.get(0):e("body");a.update(c);b.isReplacingElement=
true}else if(a.isCollapsed()){m.Log.debug(this,"early returning from applying markup because nothing is currently selected");return false}j=m.activeEditable?m.activeEditable.obj[0]:e("body");if(!b.isReplacingElement&&a.startOffset===0&&null!=(u=this.getTextNodeSibling(false,a.commonAncestorContainer.parentNode,a.startContainer)))r=this.isRangeObjectWithinMarkup({startContainer:u,startOffset:0},false,b,d,j);if(!b.isReplacingElement&&a.endOffset===a.endContainer.length&&null!=(o=this.getTextNodeSibling(true,
a.commonAncestorContainer.parentNode,a.endContainer)))p=this.isRangeObjectWithinMarkup({startContainer:o,startOffset:0},false,b,d,j);if(!b.isReplacingElement&&l&&!q){m.Log.info(this,"markup 2 non-markup");this.prepareForRemoval(a.getSelectionTree(),b,d);e(l).addClass("preparedForRemoval");this.insertCroppedMarkups(l,a,false,d)}else if(!b.isReplacingElement&&l&&q){m.Log.info(this,"markup 2 markup");this.prepareForRemoval(a.getSelectionTree(),b,d);this.splitRelevantMarkupObject(l,q,a,d)}else if(!b.isReplacingElement&&
(!l&&q||p||r)){m.Log.info(this,"non-markup 2 markup OR with next2markup");if(r&&p){l=new m.Selection.SelectionRange(a);l.startContainer=e(r[r.length-1]).textNodes()[0];l.startOffset=0;l.endContainer=e(p[p.length-1]).textNodes().last()[0];l.endOffset=l.endContainer.length;l.update();this.applyMarkup(l.getSelectionTree(),a,b,d);m.Log.info(this,"double extending previous markup(previous and after selection), actually wrapping it ...")}else if(r&&!p&&!q){this.extendExistingMarkupWithSelection(r,a,false,
d);m.Log.info(this,"extending previous markup")}else if(r&&!p&&q){l=new m.Selection.SelectionRange(a);l.startContainer=e(r[r.length-1]).textNodes()[0];l.startOffset=0;l.endContainer=e(q[q.length-1]).textNodes().last()[0];l.endOffset=l.endContainer.length;l.update();this.applyMarkup(l.getSelectionTree(),a,b,d);m.Log.info(this,"double extending previous markup(previous and relevant at the end), actually wrapping it ...")}else if(!r&&p){this.extendExistingMarkupWithSelection(p,a,true,d);m.Log.info(this,
"extending following markup backwards")}else this.extendExistingMarkupWithSelection(q,a,true,d)}else if(b.isReplacingElement||!l&&!q&&!r&&!p){m.Log.info(this,"non-markup 2 non-markup");if(a.startContainer!==a.endContainer)q=false;else if(a.startContainer.nodeType!=1)q=false;else{q=a.startContainer.firstChild;q=!q||!q.nextSibling&&q.nodeName=="BR"}if(q){b=b.clone();d=a.startContainer!==a.endContainer?false:a.startContainer.nodeType!=1?false:f.isEndBreak(a.startContainer);d&&b[0].appendChild(f.createEndBreak());
m.activeEditable&&e.browser.mozilla&&m.activeEditable.obj.focus();if(f.isEditable(a.startContainer)){f.copyAttributes(a.startContainer,b[0]);e(a.startContainer).after(b[0]).remove()}else if(f.isEditingHost(a.startContainer)){e(a.startContainer).append(b[0]);f.ensureContainerEditable(b[0])}g.startContainer=b[0];g.endContainer=b[0];g.startOffset=0;g.endOffset=0;return}this.applyMarkup(a.getSelectionTree(),a,b,d,{setRangeObject2NewMarkup:true});g.startContainer=a.startContainer;g.endContainer=a.endContainer;
g.startOffset=a.startOffset;g.endOffset=a.endOffset}if(b.isReplacingElement){if(g&&g.startContainer.className&&g.startContainer.className.indexOf("preparedForRemoval")>-1){d=e(g.startContainer).parents(b[0].tagName).get(0);g.startContainer=d;a.startContainer=d}if(g&&g.endContainer.className&&g.endContainer.className.indexOf("preparedForRemoval")>-1){d=e(g.endContainer).parents(b[0].tagName).get(0);g.endContainer=d;a.endContainer=d}}e(".preparedForRemoval").zap();if(b.isReplacingElement){if(k.Node.ELEMENT_NODE===
g.startContainer.nodeType&&g.startContainer.childNodes&&g.startContainer.childNodes.length<g.startOffset){g.startOffset=g.startContainer.childNodes.length;a.startOffset=g.startContainer.childNodes.length}if(k.Node.ELEMENT_NODE===g.endContainer.nodeType&&g.endContainer.childNodes&&g.endContainer.childNodes.length<g.endOffset){g.endOffset=g.endContainer.childNodes.length;a.endOffset=g.endContainer.childNodes.length}a.endContainer=g.endContainer;a.endOffset=g.endOffset;a.startContainer=g.startContainer;
a.startOffset=g.startOffset;g.update();g.select()}else{a.update();a.select()}},areMarkupObjectsAsLongAsRangeObject:function(a,b,d){var c,f,k;if(d.startOffset!==0)return false;c=0;for(k=a.length;c<k;c++){f=e(a[c]);if(f.textNodes().first()[0]!==d.startContainer)return false}c=0;for(a=b.length;c<a;c++){f=e(b[c]);f=f.textNodes().last()[0];if(f!==d.endContainer||f.length!=d.endOffset)return false}return true},splitRelevantMarkupObject:function(a,b,d,c){e(a).addClass("preparedForRemoval");e(b).addClass("preparedForRemoval");
if(this.areMarkupObjectsAsLongAsRangeObject(a,b,d))return true;var f=this.intersectRelevantMarkupObjects(a,b);if(f){this.insertCroppedMarkups([f],d,false,c);this.insertCroppedMarkups([f],d,true,c)}else{this.insertCroppedMarkups(a,d,false,c);this.insertCroppedMarkups(b,d,true,c)}return true},intersectRelevantMarkupObjects:function(a,b){var d=false,c,f,k,j,g,l;if(!a||!b)return d;g=a.length;l=b.length;for(c=0;c<g;c++){f=a[c];for(k=0;k<l;k++){j=b[k];f===j&&(d=f)}}return d},extendExistingMarkupWithSelection:function(a,
b,d,c){var f,k,j,g,l,q,o;d||(f=true);d&&(k=true);d=[];j=0;for(g=a.length;j<g;j++){d[j]=new this.SelectionRange;l=a[j];if(k&&!f){d[j].startContainer=b.startContainer;d[j].startOffset=b.startOffset;q=e(l).textNodes(true);o=q.length-1;d[j].endContainer=q[o];d[j].endOffset=q[o].length;d[j].update();this.applyMarkup(d[j].getSelectionTree(),b,this.getClonedMarkup4Wrapping(l),c,{setRangeObject2NewMarkup:true})}if(!k&&f){q=e(l).textNodes(true);d[j].startContainer=q[0];d[j].startOffset=0;d[j].endContainer=
b.endContainer;d[j].endOffset=b.endOffset;d[j].update();this.applyMarkup(d[j].getSelectionTree(),b,this.getClonedMarkup4Wrapping(l),c,{setRangeObject2NewMarkup:true})}}return true},getClonedMarkup4Wrapping:function(a){a=e(a.outerHTML).removeClass("preparedForRemoval").empty();a.attr("class").length===0&&a.removeAttr("class");return a},insertCroppedMarkups:function(a,b,d,c){var f,k,j,g,l;d?k=true:f=true;d=[];for(g=0;g<a.length;g++){d[g]=new this.SelectionRange;l=a[g];if(f&&!k){j=e(l).textNodes(true);
d[g].startContainer=j[0];d[g].startOffset=0;if(d[g].startContainer===b.startContainer&&d[g].startOffset===b.startOffset)continue;if(b.startOffset===0){d[g].endContainer=this.getTextNodeSibling(false,l,b.startContainer);d[g].endOffset=d[g].endContainer.length}else{d[g].endContainer=b.startContainer;d[g].endOffset=b.startOffset}d[g].update();this.applyMarkup(d[g].getSelectionTree(),b,this.getClonedMarkup4Wrapping(l),c,{setRangeObject2NextSibling:true})}if(!f&&k){d[g].startContainer=b.endContainer;d[g].startOffset=
b.endOffset;j=e(l).textNodes(true);d[g].endContainer=j[j.length-1];d[g].endOffset=j[j.length-1].length;d[g].update();this.applyMarkup(d[g].getSelectionTree(),b,this.getClonedMarkup4Wrapping(l),c,{setRangeObject2PreviousSibling:true})}}return true},changeMarkupOnSelection:function(a){var b=this.getRangeObject();this.changeMarkup(b,a,this.getStandardTagComparator(a));o.Utils.Dom.doCleanup({merge:true},b);b.update();b.select();this.rangeObject=b},applyMarkup:function(a,b,d,c,f){var k,j,f=f||{};this.prepareForRemoval(a,
d,c);a=this.optimizeSelectionTree4Markup(a,d,c);for(k=0;k<a.length;k++){j=a[k];if(j.wrappable)this.wrapMarkupAroundSelectionTree(j.elements,b,d,c,f);else{m.Log.debug(this,"dive further into non-wrappable object");this.applyMarkup(j.element.children,b,d,c,f)}}},getMarkupType:function(a){var b=e(a)[0].nodeName.toLowerCase();a.outerHtml&&m.Log.debug(this,"Node name detected: "+b+" for: "+a.outerHtml());if(b=="#text")return"textNode";if(this.replacingElements[b])return"sectionOrGroupingContent";if(this.tagHierarchy[b])return"textLevelSemantics";
m.Log.warn(this,"unknown markup passed to this.getMarkupType(...): "+a.outerHtml())},getStandardTagComparator:function(a){var b=this;switch(this.getMarkupType(a)){case "textNode":a=function(){return false};break;case "sectionOrGroupingContent":a=function(a,d){return b.standardSectionsAndGroupingContentComparator(a,d)};break;default:a=function(a,d){return b.standardTextLevelSemanticsComparator(a,d)}}return a},prepareForRemoval:function(a,b,d){var c,f;typeof d!=="undefined"&&typeof d!=="function"&&
m.Log.error(this,"parameter tagComparator is not a function");typeof d==="undefined"&&(d=this.getStandardTagComparator(b));for(c=0;c<a.length;c++){f=a[c];if(f.domobj&&(f.selection=="full"||f.selection=="partial"&&b.isReplacingElement)&&f.domobj.nodeType===1&&d(f.domobj,b)){m.Log.debug(this,"Marking for removal: "+f.domobj.nodeName);e(f.domobj).addClass("preparedForRemoval")}f.selection!="none"&&f.children.length>0&&this.prepareForRemoval(f.children,b,d)}},wrapMarkupAroundSelectionTree:function(a,
b,d,c,f){var k=[],j=-1,g="",l="",q,o,p;m.Log.debug(this,"The formatting <"+d[0].tagName+"> will be wrapped around the selection");for(q=0;q<a.length;q++){o=a[q];if(o.domobj&&!this.canTag1WrapTag2(o.domobj.parentNode.tagName.toLowerCase(),d[0].tagName.toLowerCase()))m.Log.info(this,"Skipping the wrapping of <"+d[0].tagName.toLowerCase()+"> because this tag is not allowed inside <"+o.domobj.parentNode.tagName.toLowerCase()+">");else if(!o.domobj||!(o.domobj.nodeType===3&&e.trim(o.domobj.nodeValue).length===
0)){if(o.domobj&&o.selection=="partial"&&!d.isReplacingElement)if(o.startOffset!==void 0&&o.endOffset===void 0){j++;g=g+o.domobj.data.substr(0,o.startOffset);o.domobj.data=o.domobj.data.substr(o.startOffset,o.domobj.data.length-o.startOffset);k[j]=o.domobj}else if(o.endOffset!==void 0&&o.startOffset===void 0){j++;l=l+o.domobj.data.substr(o.endOffset,o.domobj.data.length-o.endOffset);o.domobj.data=o.domobj.data.substr(0,o.endOffset);k[j]=o.domobj}else if(o.endOffset!==void 0&&o.startOffset!==void 0){if(o.startOffset==
o.endOffset){m.Log.debug(this,"skipping empty selection");continue}j++;g=g+o.domobj.data.substr(0,o.startOffset);p=o.domobj.data.substr(o.startOffset,o.endOffset-o.startOffset);l=l+o.domobj.data.substr(o.endOffset,o.domobj.data.length-o.endOffset);o.domobj.data=p;k[j]=o.domobj}else{m.Log.debug(this,"diving into object");this.applyMarkup(o.children,b,d,c,f)}if(o.domobj&&(o.selection=="full"||o.selection=="partial"&&d.isReplacingElement)){j++;k[j]=o.domobj}}}if(k.length>0){k=e(k);e.each(k,function(a,
b){if(e.browser.msie&&b.nodeType==3&&!b.nextSibling&&!b.previousSibling&&b.parentNode&&b.parentNode.nodeName.toLowerCase()=="li")b.data=e.trim(b.data)});a=k.wrapAll(d).parent();a.before(g).after(l);if(f.setRangeObject2NewMarkup){g=k.textNodes();if(g.index(b.startContainer)!=-1)b.startOffset=0;if(g.index(b.endContainer)!=-1)b.endOffset=b.endContainer.length}if(f.setRangeObject2NextSibling){g=true;l=a.textNodes(true).last()[0];if(k.index(b.startContainer)!=-1){b.startContainer=this.getTextNodeSibling(g,
a.parent(),l);b.startOffset=0}if(k.index(b.endContainer)!=-1){b.endContainer=this.getTextNodeSibling(g,a.parent(),l);b.endOffset=b.endOffset-l.length}}if(f.setRangeObject2PreviousSibling){g=false;l=a.textNodes(true).first()[0];if(k.index(b.startContainer)!=-1){b.startContainer=this.getTextNodeSibling(g,a.parent(),l);b.startOffset=0}if(k.index(b.endContainer)!=-1){b.endContainer=this.getTextNodeSibling(g,a.parent(),l);b.endOffset=b.endContainer.length}}}},getTextNodeSibling:function(a,b,d){b=e(b).textNodes(true);
d=b.index(d);return d==-1?false:b[d+(!a?-1:1)]||false},optimizeSelectionTree4Markup:function(a,b,d){var c=[],f=0,k=0,j=this,g,l,q,o;typeof d==="undefined"&&(d=function(a,b){return j.standardTextLevelSemanticsComparator(b)});for(g=0;g<a.length;g++)if(a[g].domobj&&a[g].selection!="none")if(b.isReplacingElement&&d(b[0],e(a[g].domobj))){c[f]!==void 0&&f++;c[f]={};c[f].wrappable=true;c[f].elements=[];c[f].elements[k]=a[g];f++}else if(this.canMarkupBeApplied2ElementAsWhole([a[g]],b)){if(c[f]===void 0){c[f]=
{};c[f].wrappable=true;c[f].elements=[]}if(b.isReplacingElement){o=g;for(l=g-1;l>=0;l--)if(this.canMarkupBeApplied2ElementAsWhole([a[l]],b)&&this.isMarkupAllowedToStealSelectionTreeElement(a[l],b))o=l;else break;q=g;for(l=g+1;l<a.length;l++)if(this.canMarkupBeApplied2ElementAsWhole([a[l]],b)&&this.isMarkupAllowedToStealSelectionTreeElement(a[l],b))q=l;else break;k=0;for(l=o;l<=q;l++){c[f].elements[k]=a[l];c[f].elements[k].selection="full";k++}k=0}else{c[f].elements[k]=a[g];k++}}else{c[f]!==void 0&&
f++;c[f]={};c[f].wrappable=false;c[f].element=a[g];k=0;f++}return c},isMarkupAllowedToStealSelectionTreeElement:function(a,b){if(!a.domobj)return false;var d=a.domobj.nodeName.toLowerCase(),d=d=="#text"?"textNode":d,c=this.allowedToStealElements[b[0].nodeName.toLowerCase()];return c&&c[d]},canMarkupBeApplied2ElementAsWhole:function(a,b){var d,c,f;if(b.jquery)d=b[0].tagName;if(b.tagName)d=b.tagName;for(c=0;c<a.length;c++){f=a[c];if(f.domobj&&(f.selection!="none"||b.isReplacingElement))if(!this.canTag1WrapTag2(d,
f.domobj.nodeName)||f.children.length>0&&!this.canMarkupBeApplied2ElementAsWhole(f.children,b))return false}return true},canTag1WrapTag2:function(a,b){var a=a=="#text"?"textNode":a.toLowerCase(),b=b=="#text"?"textNode":b.toLowerCase(),d=this.tagHierarchy[a];return!d||!this.tagHierarchy[b]?true:d[b]},mayInsertTag:function(a){var b;if(typeof this.rangeObject.unmodifiableMarkupAtStart=="object"){for(b=0;b<this.rangeObject.unmodifiableMarkupAtStart.length;++b)if(!this.canTag1WrapTag2(this.rangeObject.unmodifiableMarkupAtStart[b].nodeName,
a))return false;return true}m.Log.warn(this,"Unable to determine whether tag "+a+" may be inserted");return true},toString:function(){return"Aloha.Selection"},SelectionRange:o.Utils.RangeObject.extend({_constructor:function(a){this._super(a);if(a){if(a.commonAncestorContainer)this.commonAncestorContainer=a.commonAncestorContainer;if(a.selectionTree)this.selectionTree=a.selectionTree;if(a.limitObject)this.limitObject=a.limitObject;if(a.markupEffectiveAtStart)this.markupEffectiveAtStart=a.markupEffectiveAtStart;
if(a.unmodifiableMarkupAtStart)this.unmodifiableMarkupAtStart=a.unmodifiableMarkupAtStart;if(a.splitObject)this.splitObject=a.splitObject}},commonAncestorContainer:void 0,selectionTree:void 0,markupEffectiveAtStart:[],unmodifiableMarkupAtStart:[],limitObject:void 0,splitObject:void 0,select:function(){this._super();m.Selection.updateSelection()},update:function(a){this.updatelimitObject();this.updateMarkupEffectiveAtStart();this.updateCommonAncestorContainer(a);this.selectionTree=void 0},getSelectionTree:function(){if(!this.selectionTree)this.selectionTree=
m.Selection.getSelectionTree(this);return this.selectionTree},getSelectedSiblings:function(a){var b=this.getSelectionTree();return this.recursionGetSelectedSiblings(a,b)},recursionGetSelectedSiblings:function(a,b){var d=false,c=false,f;for(f=0;f<b.length;++f)if(b[f].domobj===a){c=true;d=[]}else if(!c&&b[f].children){d=this.recursionGetSelectedSiblings(a,b[f].children);if(d!==false)break}else if(c&&b[f].domobj&&b[f].selection!="collapsed"&&b[f].selection!="none")d.push(b[f].domobj);else if(c&&b[f].selection==
"none")break;return d},updateMarkupEffectiveAtStart:function(){this.markupEffectiveAtStart=[];this.unmodifiableMarkupAtStart=[];var a=this.getStartContainerParents(),b=false,d,c,f;for(c=0;c<a.length;c++){f=a[c];if(!b&&f!==this.limitObject){this.markupEffectiveAtStart[c]=f;if(!d&&o.Utils.Dom.isSplitObject(f)){d=true;this.splitObject=f}}else{b=true;this.unmodifiableMarkupAtStart.push(f)}}if(!d)this.splitObject=false},updatelimitObject:function(){if(m.editables&&m.editables.length>0){var a=this.getStartContainerParents(),
b=m.editables,d,c,f,k;for(d=0;d<a.length;d++){c=a[d];for(f=0;f<b.length;f++){k=b[f].obj[0];if(c===k){this.limitObject=c;return true}}}}this.limitObject=e("body");return true},toString:function(a){return!a?"Aloha.Selection.SelectionRange":"Aloha.Selection.SelectionRange {start ["+this.startContainer.nodeValue+"] offset "+this.startOffset+", end ["+this.endContainer.nodeValue+"] offset "+this.endOffset+"}"}})}),u=a.extend({_constructor:function(a){this._nativeSelection=a;this.ranges=[];this.preventChange=
false},anchorNode:null,anchorOffset:0,focusNode:null,focusOffset:0,isCollapsed:false,rangeCount:0,collapse:function(a,b){this._nativeSelection.collapse(a,b)},collapseToStart:function(){throw"NOT_IMPLEMENTED";},extend:function(){},modify:function(){},collapseToEnd:function(){throw"NOT_IMPLEMENTED";},selectAllChildren:function(){throw"NOT_IMPLEMENTED";},deleteFromDocument:function(){throw"NOT_IMPLEMENTED";},getRangeAt:function(a){a=this._nativeSelection.getRangeAt(a);q(a);return a},addRange:function(a){this._nativeSelection.addRange(a);
var b=this._nativeSelection._ranges;q(a);b[0]=a;m.Selection.updateSelection()},removeRange:function(){this._nativeSelection.removeRange()},removeAllRanges:function(){this._nativeSelection.removeAllRanges()},refresh:function(){},toString:function(){return"Aloha.Selection"},getRangeCount:function(){return this._nativeSelection.rangeCount}});m.getSelection=function(a){a=a!==document||a!==window?window:a;return new u(window.rangy.getSelection(a))};m.createRange=function(a){return window.rangy.createRange(a)};
a=new g;return m.Selection=a});define("aloha/block-jump",["aloha/core","jquery"],function(m,e){function a(a,c){a.deleteData(0,a.length);""!==c&&(a.nextSibling&&3===a.nextSibling.nodeType?a.nextSibling.insertData(0,c):a.previousSibling&&3===a.previousSibling.nodeType?a.previousSibling.insertData(a.previousSibling.length,c):a.insertData(0,c));setTimeout(function(){0===a.length&&e(a).remove()},0)}function g(){if(c){var b=c.nodeValue.replace(/\u200b/,"");b===c.nodeValue&&console.warn("Expected to remove the zero width text node fix, but couldn't find it");
a(c,b);c=null}}var c=null;return{removeZeroWidthTextNodeFix:g,insertZeroWidthTextNodeFix:function(a,j){g();c=document.createTextNode("​");j?e(a).after(c):e(a).before(c);m.bind("aloha-selection-changed",function(a){g();m.unbind(a)});return c}}});define("aloha/markup","aloha/core util/class jquery aloha/ecma5shims aloha/console aloha/block-jump".split(" "),function(m,e,a,g,c,b){function j(b){return"false"===a(b).attr("contenteditable")}function l(a){return a&&3===a.nodeType}function f(a){return!a?0:
l(a)?a.length:a.childNodes.length}function k(a){return!a?null:a.nextSibling?l(a.nextSibling)&&!(0<a.nextSibling.data.replace(/\s+/g,"").length)||"BR"===a.nextSibling.nodeName&&a.nextSibling===a.parentNode.lastChild||""===a.nextSibling.innerHTML&&!j(a.nextSibling)?k(a.nextSibling):a.nextSibling:a.parentNode?k(a.parentNode):null}function d(a){return!a?null:a.previousSibling?l(a.previousSibling)&&!(0<a.previousSibling.data.replace(/\s+/g,"").length)?d(a.previousSibling):""===a.previousSibling.innerHTML&&
!j(a.previousSibling)?d(a.previouSibling):a.previousSibling:a.parentNode?d(a.parentNode):null}function q(b){var d;if(d=window.$_alohaPlaceholder){d=b.startContainer;var b=b.endContainer,c=window.$_alohaPlaceholder;d=!(c.is(d)||c.is(b)||(r?g.compareDocumentPosition(c[0],d)&16:0<a(c[0]).find(d).length)||(r?g.compareDocumentPosition(c[0],b)&16:0<a(c[0]).find(b).length))}if(d){0===window.$_alohaPlaceholder.html().replace(/^(&nbsp;)*$/,"").length&&window.$_alohaPlaceholder.remove();window.$_alohaPlaceholder=
null}}var o=window.GENTICS,r=!!(a.browser.msie&&9>parseInt(a.browser.version,10));m.Markup=e.extend({keyHandlers:{},addKeyHandler:function(a,b){this.keyHandlers[a]||(this.keyHandlers[a]=[]);this.keyHandlers[a].push(b)},removeKeyHandler:function(a){this.keyHandlers[a]&&(this.keyHandlers[a]=null)},insertBreak:function(){var b=m.Selection.rangeObject,d,c,f;b.isCollapsed()||this.removeSelectedMarkup();f=a("<br/>");o.Utils.Dom.insertIntoDOM(f,b,m.activeEditable.obj);if(c=o.Utils.Dom.searchAdjacentTextNode(f.parent().get(0),
o.Utils.Dom.getIndexInParent(f.get(0))+1,false)){d=c.data.search(/\S/);if(d>0)c.data=c.data.substring(d)}b.startContainer=b.endContainer=f.get(0).parentNode;b.startOffset=b.endOffset=o.Utils.Dom.getIndexInParent(f.get(0))+1;b.correctRange();b.clearCaches();b.select()},preProcessKeyStrokes:function(a){if(a.type!=="keydown")return false;var b,d;if(this.keyHandlers[a.keyCode]){b=this.keyHandlers[a.keyCode];for(d=0;d<b.length;++d)if(!b[d](a))return false}if(a.keyCode===37||a.keyCode===39){if(m.getSelection().getRangeCount()){b=
m.getSelection().getRangeAt(0);if(this.processCursor(b,a.keyCode)){q(m.Selection.rangeObject);return true}}return false}if(a.keyCode===8){a.preventDefault();m.execCommand("delete",false);return false}if(a.keyCode===46){m.execCommand("forwarddelete",false);return false}if(a.keyCode===13){if(a.shiftKey){m.execCommand("insertlinebreak",false);return false}m.execCommand("insertparagraph",false);return false}return true},processCursor:function(c,g){if(!c.collapsed)return true;b.removeZeroWidthTextNodeFix();
var e=c.startContainer,y=m.getSelection();if(!e)return true;var z,x;if(a.browser.msie&&parseInt(a.browser.version,10)<=7&&l(e))if(g==37){for(x=c.startOffset;x>0&&e.data.charAt(x-1)==="​";)x--;if(x!=c.startOffset){c.setStart(c.startContainer,x);c.setEnd(c.startContainer,x);y=m.getSelection();y.removeAllRanges();y.addRange(c)}}else if(g==39){for(x=c.startOffset;x<e.data.length&&e.data.charAt(x)==="​";)x++;if(x!=c.startOffset){c.setStart(c.startContainer,x);c.setEnd(c.startContainer,x);y.removeAllRanges();
y.addRange(c)}}if(r&&!a(e).contentEditable()){x=a(e).parents("[contenteditable=false]");if(x.length>0)if(x.parent().hasClass("aloha-editable"))z=x[0];else return true}var v;if(!z){v=37===g||38===g;x=c.startOffset;if(l(e))if(v){if(1!==x&&!(0===x||x<=e.data.length-e.data.replace(/^\s+/,"").length))return true}else{z=e;y=f(z);if(y===x)z=true;else{var A=l(z);z=A&&z.data.replace(/\s+$/,"").length===x?true:1===y&&!A?"BR"===z.childNodes[0].nodeName:false}if(!z)return true}else e=e.childNodes[x===f(e)?x-
1:x];z=v?d(e):k(e)}if(j(z)){e=z;z=new o.Utils.RangeObject;x=v?d(e):k(e);if(!x||j(x)){x=a("<div>&nbsp;</div>");v?a(e).before(x):a(e).after(x);z.startContainer=z.endContainer=x[0];z.startOffset=z.endOffset=0;q(z);window.$_alohaPlaceholder=x}else{if(c.startContainer.nodeType===3&&c.startContainer===c.endContainer&&c.startContainer.nodeValue!==""&&(v?c.startOffset===1:c.endOffset+1===c.endContainer.length)||c.startContainer.nodeType===1&&(!c.startOffset||c.startContainer.childNodes[c.startOffset]&&c.startContainer.childNodes[c.startOffset].nodeType===
1)){x=b.insertZeroWidthTextNodeFix(e,v);z.startContainer=z.endContainer=x;z.startOffset=z.endOffset=v?1:0}else{z.startContainer=z.endContainer=x;z.startOffset=z.endOffset=v?f(x):0;v||b.insertZeroWidthTextNodeFix(e,true)}q(z)}z.select();m.trigger("aloha-block-selected",e);m.Selection.preventSelectionChanged();return false}return true},processShiftEnter:function(a){this.insertHTMLBreak(a.getSelectionTree(),a)},processEnter:function(a){a.splitObject?this.splitRangeObject(a):this.insertHTMLBreak(a.getSelectionTree(),
a)},insertHTMLCode:function(b){var d=m.Selection.rangeObject;this.insertHTMLBreak(d.getSelectionTree(),d,a(b))},insertHTMLBreak:function(b,d,c){var f,k,j,g,l,c=c||a("<br/>");f=0;for(k=b.length;f<k;++f){j=b[f];g=j.domobj?a(j.domobj):void 0;if(j.selection!=="none")if(j.selection=="collapsed"){if(f>0){j=a(b[f-1].domobj);j.after(c)}else{j=a(b[1].domobj);j.before(c)}d.startContainer=d.endContainer=c[0].parentNode;d.startOffset=d.endOffset=o.Utils.Dom.getIndexInParent(c[0])+1;d.correctRange()}else if(j.domobj&&
j.domobj.nodeType===3){j.domobj.nextSibling&&(j.domobj.nextSibling.nodeType==1&&m.Selection.replacingElements[j.domobj.nextSibling.nodeName.toLowerCase()])&&g.after("<br/>");if(this.needEndingBreak()){for(l=j.domobj;l;)if(l.nextSibling)l=false;else{l=l.parentNode;if(o.Utils.Dom.isBlockLevelElement(l)||o.Utils.Dom.isListElement(l))break;l===d.limitObject&&(l=false)}l&&a(l).append('<br class="aloha-cleanme" />')}g.between(c,j.startOffset);g=0;for(j=c[0];j;){j=j.previousSibling;++g}d.startContainer=
c[0].parentNode;d.endContainer=c[0].parentNode;d.startOffset=g;d.endOffset=g;d.correctRange()}else if(j.domobj&&j.domobj.nodeType===1){if(g.parent().find("br.aloha-ephemera").length===0){a(d.limitObject).find("br.aloha-ephemera").remove();a(d.commonAncestorContainer).append(this.getFillUpElement(d.splitObject))}g.after(c);d.startContainer=d.commonAncestorContainer;d.endContainer=d.startContainer;d.startOffset=f+2;d.endOffset=f+2;d.update()}}d.select()},needEndingBreak:function(){return!a.browser.msie},
getSelectedText:function(){var a=m.Selection.rangeObject;return a.isCollapsed()?false:this.getFromSelectionTree(a.getSelectionTree(),true)},getFromSelectionTree:function(b,d){var c="",f,k,j,g;f=0;for(k=b.length;f<k;f++){j=b[f];if(j.selection=="partial")if(j.domobj.nodeType===3)c=c+j.domobj.data.substring(j.startOffset,j.endOffset);else{if(j.domobj.nodeType===1&&j.children)if(d)c=c+this.getFromSelectionTree(j.children,d);else{g=a(j.domobj.outerHTML).empty();g.html(this.getFromSelectionTree(j.children,
d));c=c+g.outerHTML()}}else j.selection=="full"&&(j.domobj.nodeType===3?c=c+a(j.domobj).text():j.domobj.nodeType===1&&j.children&&(c=c+(d?a(j.domobj).text():a(j.domobj).outerHTML())))}return c},getSelectedMarkup:function(){var a=m.Selection.rangeObject;return a.isCollapsed()?null:this.getFromSelectionTree(a.getSelectionTree(),false)},removeSelectedMarkup:function(){var a=m.Selection.rangeObject,b;if(!a.isCollapsed()){b=new m.Selection.SelectionRange;this.removeFromSelectionTree(a.getSelectionTree(),
b);b.update();o.Utils.Dom.doCleanup({merge:true,removeempty:true},m.Selection.rangeObject);m.Selection.rangeObject=b;b.correctRange();b.update();b.select();m.Selection.updateSelection()}},removeFromSelectionTree:function(b,d){var c,f,k,j,g;k=0;for(g=b.length;k<g;k++){j=b[k];if(j.selection=="partial")if(j.domobj.nodeType===3){f="";j.startOffset>0&&(f=f+j.domobj.data.substring(0,j.startOffset));j.endOffset<j.domobj.data.length&&(f=f+j.domobj.data.substring(j.endOffset,j.domobj.data.length));j.domobj.data=
f;if(!d.startContainer){d.startContainer=d.endContainer=j.domobj;d.startOffset=d.endOffset=j.startOffset}}else{if(j.domobj.nodeType===1&&j.children){this.removeFromSelectionTree(j.children,d);if(c){if(c.nodeName==j.domobj.nodeName){a(c).append(a(j.domobj).contents());a(j.domobj).remove()}}else c=j.domobj}}else if(j.selection=="full"){if(!d.startContainer)if(f=o.Utils.Dom.searchAdjacentTextNode(j.domobj.parentNode,o.Utils.Dom.getIndexInParent(j.domobj)+1,false,{blocklevel:false})){d.startContainer=
d.endContainer=f;d.startOffset=d.endOffset=0}else{d.startContainer=d.endContainer=j.domobj.parentNode;d.startOffset=d.endOffset=o.Utils.Dom.getIndexInParent(j.domobj)+1}a(j.domobj).remove()}}},splitRangeObject:function(b){a(b.splitObject);var d,c;b.update(b.splitObject);d=b.getSelectionTree();c=this.getSplitFollowUpContainer(b);this.splitRangeObjectHelper(d,b,c);c.hasClass("preparedForRemoval")&&c.removeClass("preparedForRemoval");d=this.getInsertAfterObject(b,c);a(c).insertAfter(d);b.splitObject.nodeName.toLowerCase()===
"li"&&!m.Selection.standardTextLevelSemanticsComparator(b.splitObject,c)&&a(b.splitObject).remove();b.startContainer=null;d=c.contents();if(d.length>0&&d.get(0).nodeType==1&&d.get(0).nodeName.toLowerCase()==="br")b.startContainer=c.get(0);if(!b.startContainer)b.startContainer=c.textNodes(true,true).first().get(0);if(!b.startContainer)b.startContainer=c.textNodes(false).first().parent().get(0);if(b.startContainer){b.endContainer=b.startContainer;b.startOffset=0;b.endOffset=0}else{b.startContainer=
b.endContainer=c.parent().get(0);b.startOffset=b.endOffset=o.Utils.Dom.getIndexInParent(c.get(0))}b.update();b.select()},getInsertAfterObject:function(b,d){var c,f,k;for(f=0;f<b.markupEffectiveAtStart.length;f++){k=b.markupEffectiveAtStart[f];k===b.splitObject&&(c=true);if(c&&m.Selection.canTag1WrapTag2(a(k).parent()[0].nodeName,d[0].nodeName))return k}return false},getFillUpElement:function(){return a.browser.msie?false:a('<br class="aloha-cleanme"/>')},removeElementContentWhitespaceObj:function(a){var b=
0,d=[],c,f;for(c=0;c<a.length;++c){f=a[c];f.isElementContentWhitespace&&(d[d.length]=c)}for(c=0;c<d.length;++c){f=d[c];a.splice(f-b,1);++b}},splitRangeObjectHelper:function(b,d,c,f){c||m.Log.warn(this,"no followUpContainer, no inBetweenMarkup, nothing to do...");var k=this.getFillUpElement(d.splitObject),j=a(d.splitObject),g=false,l,e,q,r,J;if(b.length>0){q=c.contents();q.length!==b.length&&this.removeElementContentWhitespaceObj(q);e=0;for(J=b.length;e<J;++e){l=b[e];if(l.selection==="none"&&g===false||
l.domobj&&l.domobj.nodeType===3&&l===b[b.length-1]&&l.startOffset===l.domobj.data.length)if(c.textNodes().length>1||l.domobj.nodeType===1&&l.children.length===0)q.eq(e).remove();else if(o.Utils.Dom.isSplitObject(c[0]))k?c.html(k):c.empty();else{c.empty();c.addClass("preparedForRemoval")}else if(l.selection!=="none"){if(l.domobj&&l.domobj.nodeType===3&&l.startOffset!==void 0){g=l.domobj.data;if(l.startOffset>0)l.domobj.data=g.substr(0,l.startOffset);else if(b.length>1)a(l.domobj).remove();else{r=a(l.domobj).parent();
o.Utils.Dom.isSplitObject(r[0])?k?r.html(k):r.empty():r.remove()}if(g.length-l.startOffset>0)q[e].data=g.substr(l.startOffset,g.length);else if(q.length>1)q.eq(e).remove();else if(o.Utils.Dom.isBlockLevelElement(c[0]))k?c.html(k):c.empty();else{c.empty();c.addClass("preparedForRemoval")}}g=true;l.children.length>0&&this.splitRangeObjectHelper(l.children,d,q.eq(e),f)}else l.selection==="none"&&g===true&&a(l.domobj).remove()}}else m.Log.error(this,"can not split splitObject due to an empty selection tree");
j.find("br.aloha-ephemera:gt(0)").remove();c.find("br.aloha-ephemera:gt(0)").remove();j.find(".preparedForRemoval").remove();c.find(".preparedForRemoval").remove();j.contents().length===0&&(o.Utils.Dom.isSplitObject(j[0])&&k)&&j.html(k);c.contents().length===0&&(o.Utils.Dom.isSplitObject(c[0])&&k)&&c.html(k)},getSplitFollowUpContainer:function(b){var d;switch(b.splitObject.nodeName.toLowerCase()){case "h1":case "h2":case "h3":case "h4":case "h5":case "h6":if((d=a(b.splitObject).textNodes(":not(.aloha-cleanme)").last()[0])&&
b.startContainer===d&&b.startOffset===d.length){d=a("<p></p>");b=a(b.splitObject.outerHTML).contents();d.append(b);return d}break;case "li":if(b.startContainer.nodeName.toLowerCase()==="br"&&a(b.startContainer).hasClass("aloha-ephemera")){d=a("<p></p>");b=a(b.splitObject.outerHTML).contents();d.append(b);return d}if(!b.splitObject.nextSibling&&a.trim(a(b.splitObject).text()).length===0)return d=a("<p></p>")}return a(b.splitObject.outerHTML)},transformDomObject:function(b,d,c){var f=a(b),d=a("<"+d+
">"),k,j=f[0].cloneNode(false).attributes;if(j)for(k=0;k<j.length;++k)(typeof j[k].specified==="undefined"||j[k].specified)&&d.attr(j[k].nodeName,j[k].nodeValue);if(f[0].style&&f[0].style.cssText)d[0].style.cssText=f[0].style.cssText;f.contents().appendTo(d);f.replaceWith(d);if(c){if(c.startContainer==b)c.startContainer=d.get(0);if(c.endContainer==b)c.endContainer=d.get(0)}return d},toString:function(){return"Aloha.Markup"}});m.Markup=new m.Markup;return m.Markup});define("aloha/observable",["jquery"],
function(m){return{_eventHandlers:null,bind:function(e,a,g){this._eventHandlers=this._eventHandlers||{};this._eventHandlers[e]||(this._eventHandlers[e]=[]);this._eventHandlers[e].push({handler:a,scope:g||window})},unbind:function(e,a){this._eventHandlers=this._eventHandlers||{};this._eventHandlers[e]&&(this._eventHandlers[e]=a?m.grep(this._eventHandlers[e],function(g){return g.handler===a?!1:!0}):[])},trigger:function(e){this._eventHandlers=this._eventHandlers||{};if(this._eventHandlers[e]){var a=
[];m.each(arguments,function(g,c){0<g&&a.push(c)});m.each(this._eventHandlers[e],function(g,c){c.handler.apply(c.scope,a)})}},unbindAll:function(){this._eventHandlers=null}}});define("aloha/registry",["jquery","aloha/observable","util/class"],function(m,e,a){return a.extend(e,{_entries:null,_ids:null,_constructor:function(){this._entries={};this._ids=[]},register:function(a,c){this._entries[a]=c;this._ids.push(a);this.trigger("register",c,a)},unregister:function(a){var c,b=this._entries[a];delete this._entries[a];
for(c in this._ids)if(this._ids.hasOwnProperty(c)&&this._ids[c]===a){this._ids.splice(c,1);break}this.trigger("unregister",b,a)},get:function(a){return this._entries[a]},has:function(a){return this._entries[a]?!0:!1},getEntries:function(){return m.extend({},this._entries)},getIds:function(){return m.extend([],this._ids)}})});define("aloha/contenthandlermanager",["aloha/registry","util/class","aloha/console"],function(m,e){return new (m.extend({createHandler:function(a){if("function"!==typeof a.handleContent)throw"ContentHandler has no function handleContent().";
return new (e.extend({handleContent:function(){}},a))},handleContent:function(a,g,c){var b=g?g.contenthandler:this.getIds();if(!b)return a;var j,l;for(j=0;j<b.length&&!((l=this.get(b[j]))&&(a=l.handleContent(a,g,c||Aloha.activeEditable)),null===a);j++);return a}}))});define("util/trees",["jquery"],function(m){function e(a,b,d){var c=m.type(a),f,k,j;if("array"===c){c=d?a:[];j=f=0;for(k=a.length;j<k;j++)d=b(a[j]),d.length&&(c[f++]=d[0]);f!==c.length&&(c=c.slice(0,f))}else if("object"===c)for(f in c=
d?a:{},a)a.hasOwnProperty(f)&&(d=b(a[f]),d.length?c[f]=d[0]:delete c[f]);else c=a;return c}function a(a,b){return e(a,b,!0)}function g(a,b){var d,c,f;if(1===a.nodeType)for(c=a.firstChild;c;)d=b(c),f=c.nextSibling,d.length?d[0]!==c&&a.replaceChild(d[0],c):a.removeChild(c),c=f;return a}function c(a,b,d,c){return[d(b(c),a)]}function b(a,b,d,c){return[b(d(c,a))]}function j(a,b,d,c){return b(c)?[]:[d(c,a)]}function l(a,b,d,c){a=d(c,a);return b(a)?[]:[a]}function f(a,b,d,c){function f(c){return a(f,b,d,
c)}return f(c)[0]}function k(a){a=m.type(a);return"object"!==a&&"array"!==a}function d(b,d,c){function f(a){return k(a)?[d(a)]:[j(a,f)]}var j=c?a:e;return f(b)[0]}return{prewalk:function(b,d,k){return f(c,d,k?a:e,b)},postwalk:function(d,c,k){return f(b,c,k?a:e,d)},preprune:function(b,d,c){return f(j,d,c?a:e,b)},postprune:function(b,d,c){return f(l,d,c?a:e,b)},prewalkDom:function(a,b,d){return f(c,b,g,d?a:a.cloneNode(!0))},postwalkDom:function(a,d,c){return f(b,d,g,c?a:a.cloneNode(!0))},prepruneDom:function(a,
b,d){return f(j,b,g,d?a:a.cloneNode(!0))},postpruneDom:function(a,b,d){return f(l,b,g,d?a:a.cloneNode(!0))},isLeaf:k,leaves:d,clone:function(a){function b(a){return[e(a,b)]}return b(a)[0]},flatten:function(a){var b=[];d(a,function(a){b.push(a);return a},!0);return b},walk:e,walkInplace:a,walkDomInplace:g}});define("util/maps",[],function(){return{isEmpty:function(m){for(var e in m)if(m.hasOwnProperty(e))return!1;return!0},fillTuples:function(m,e){for(var a=e.length,g;a--;)g=e[a],m[g[0]]=g[1];return m},
fillKeys:function(m,e,a){for(var g=e.length;g--;)m[e[g]]=a;return m},keys:function(m){var e=[],a;for(a in m)m.hasOwnProperty(a)&&e.push(a);return e}}});define("util/browser",["jquery"],function(m){return{ie7:m.browser.msie&&8>parseInt(m.browser.version,10)}});define("util/dom2",["jquery","util/maps","util/strings","util/browser"],function(m,e,a,g){function c(a){for(var b=[],a=a.cloneNode(!1).outerHTML,c;null!=(c=j.exec(a));)b.push(c[1]);return b}function b(b,c){var k={},d,j,g,e,p,u,t;u=0;for(p=b.length;u<
p;u++)if(g=b[u],g.className){j=a.words(g.className);for(t=0;t<j.length;t++)e=j[t],c[e]&&((d=k[e])?d.push(g):k[e]=[g])}return k}var j=/\s([^\/<>\s=]+)(?:=(?:"[^"]*"|'[^']*'|[^>\/\s]+))?/g;return{moveNextAll:function(a,b,c){for(;b;){var d=b.nextSibling;a.insertBefore(b,c);b=d}},attrNames:c,attrs:function(a){var b=[],k=c(a),d,j;d=0;for(j=k.length;d<j;d++){var g=k[d],e=m.attr(a,g),e=null==e?"":e.toString();b.push([g,e])}return b},indexByClass:function(a,c){var k;k=g.ie7?a.getElementsByTagName("*"):m(a).find("."+
e.keys(c).join(",."));return b(k,c)},indexByName:function(a,b){var c,d={},j;c=0;for(j=b.length;c<j;c++){var g=b[c];d[g]=m.makeArray(a.getElementsByTagName(g))}return d},indexByClassHaveList:b}});define("util/functions",[],function(){return{identity:function(m){return m}}});define("util/misc",[],function(){return{anyRx:function(m,e){var a,g;a=0;for(g=m.length;a<g;a++)if(m[a].test(e))return!0;return!1}}});define("aloha/ephemera","jquery aloha/core aloha/console util/strings util/trees util/arrays util/maps util/dom2 util/functions util/misc PubSub".split(" "),
function(m,e,a,g,c,b,j,l,f,k,d){function q(a){if(a){a.classMap&&m.extend(t.classMap,a.classMap);a.attrMap&&m.extend(t.attrMap,a.attrMap);if(a.attrRxs)t.attrRxs=t.attrRxs.concat(a.attrRxs);if(a.pruneFns)t.pruneFns=t.pruneFns.concat(a.pruneFns);d.pub("aloha.ephemera",{ephemera:t,newEphemera:a})}return t}function o(a){var a=m(a),b=a.attr("data-aloha-ui-attr"),d;a.removeAttr("data-aloha-ui-attr");if(typeof b==="string"){d=g.words(b);for(b=0;b<d.length;b++)a.removeAttr(d[b])}}function r(a,b,d,c){return d[b]||
k.anyRx(c,b)||d[a.nodeName+"."+b]}function p(a,b){var d=null,c=l.attrNames(a),f,k,j;k=0;for(j=c.length;k<j;k++){f=c[k];if(r(a,f,b.attrMap,b.attrRxs)){d=d||m(a);d.removeAttr(f)}}}function u(a,d){var c=a.className;if(c&&-1!==c.indexOf(y)){c=g.words(c);if(-1!==b.indexOf(c,"aloha-cleanme")){m.removeData(a);return false}if(-1!==b.indexOf(c,"aloha-ui-wrapper")||-1!==b.indexOf(c,"aloha-ui-filler")){l.moveNextAll(a.parentNode,a.firstChild,a.nextSibling);m.removeData(a);return false}-1!==b.indexOf(c,"aloha-ui-attr")&&
o(a);var f=b.filter(c,function(a){return!d.classMap[a]});if(f.length!==c.length)0===f.length?m(a).removeAttr("class"):a.className=f.join(" ")}p(a,d);return true}var t={classMap:{"aloha-cleanme":true,"aloha-ui-wrapper":true,"aloha-ui-filler":true,"aloha-ui-attr":true},attrMap:{hidefocus:true,hideFocus:true,tabindex:true,tabIndex:true,"TABLE.contenteditable":true,"TABLE.contentEditable":true},attrRxs:[/^(?:nodeIndex|sizcache|sizset|jquery)[\w\d]*$/i],pruneFns:[]},y="aloha-";e.settings.ephemera&&q(e.settings.ephemera);
return{ephemera:q,classes:function(){var b=Array.prototype.slice.call(arguments);j.fillKeys(t.classMap,b,true);var c=b,f,k;f=0;for(k=c.length;f<k;f++)if(-1===c[f].indexOf(y)){a.warn('Class "'+c[f]+'" was set to be ephemeral,which hurts peformance. Add the common substring "'+y+'" to the class to fix this problem.');y=""}d.pub("aloha.ephemera.classes",{ephemera:t,newClasses:b})},attributes:function(){var a=Array.prototype.slice.call(arguments);j.fillKeys(t.attrMap,a,true);d.pub("aloha.ephemera.attributes",
{ephemera:t,newAttributes:a})},markElement:function(a){m(a).addClass("aloha-cleanme")},markAttribute:function(a,b){var a=m(a),d=a.attr("data-aloha-ui-attr");a.attr("data-aloha-ui-attr",null==d||""===d?b:d+" "+b);a.addClass("aloha-ui-attr")},markWrapper:function(a){m(a).addClass("aloha-ui-wrapper")},markFiller:function(a){m(a).addClass("aloha-ui-filler")},prune:function(a,d){function f(a){var k;a:{k=d;var j=f;if(1===a.nodeType){if(!u(a,k)){k=[];break a}a=c.walkDomInplace(a,j)}k=(a=b.reduce(k.pruneFns,
a,b.applyNotNull))?[a]:[]}return k}d=d||t;return f(a)[0]},isAttrEphemeral:r}});define("aloha/editable","aloha/core util/class jquery aloha/pluginmanager aloha/selection aloha/markup aloha/contenthandlermanager aloha/console aloha/block-jump aloha/ephemera util/dom2 PubSub".split(" "),function(m,e,a,g,c,b,j,l,f,k,d,q){function o(a){return j.handleContent(a.getContents(),{contenthandler:m.settings.contentHandler.smartContentChange},a)}var r=window.unescape,p=window.GENTICS,u=false,t={};m.defaults.contentHandler=
{};m.defaults.contentHandler.initEditable=["blockelement","sanitize"];m.defaults.contentHandler.getContents=["blockelement","sanitize","basic"];if(typeof m.settings.contentHandler==="undefined")m.settings.contentHandler={};var y=function(b){return a(b).html()};m.Editable=e.extend({_constructor:function(a){a.attr("id")||a.attr("id",p.Utils.guid());this.originalObj=this.obj=a;this.ready=false;this.sccDelimiters=[":",";",".","!","?",",",r("%u0009"),r("%u0020"),r("%u0008"),r("%u007F"),"Enter"];this.sccIdle=
5E3;this.sccDelay=500;this.sccTimerDelay=this.sccTimerIdle=false;this.keyCodeMap={93:"Apps",18:"Alt",20:"CapsLock",17:"Control",40:"Down",35:"End",13:"Enter",112:"F1",113:"F2",114:"F3",115:"F4",116:"F5",117:"F6",118:"F7",119:"F8",120:"F9",121:"F10",122:"F11",123:"F12",36:"Home",45:"Insert",37:"Left",224:"Meta",34:"PageDown",33:"PageUp",19:"Pause",44:"PrintScreen",39:"Right",145:"Scroll",16:"Shift",38:"Up",91:"Win",92:"Win"};this.placeholderClass="aloha-placeholder";m.registerEditable(this)},init:function(){var d=
this;if((this.settings=m.settings)&&m.settings.smartContentChange){if(m.settings.smartContentChange.delimiters)this.sccDelimiters=m.settings.smartContentChange.delimiters;if(m.settings.smartContentChange.idle)this.sccIdle=m.settings.smartContentChange.idle;if(m.settings.smartContentChange.delay)this.sccDelay=m.settings.smartContentChange.delay}if(this.check(this.obj)){if(typeof m.settings.contentHandler.getContents==="undefined")m.settings.contentHandler.getContents=m.defaults.contentHandler.getContents;
if(typeof m.settings.contentHandler.initEditable==="undefined")m.settings.contentHandler.initEditable=m.defaults.contentHandler.initEditable;var f=d.obj.html(),f=j.handleContent(f,{contenthandler:m.settings.contentHandler.initEditable,command:"initEditable"},d);d.obj.html(f);m.bind("aloha-plugins-loaded",function(){d.obj.addClass("aloha-editable").contentEditable(true);d.obj.mousedown(function(a){if(!m.eventHandled){m.eventHandled=true;return d.activate(a)}});d.obj.mouseup(function(){m.eventHandled=
false});d.obj.focus(function(a){return d.activate(a)});d.obj.add(".aloha-block",d.obj).keydown(function(a){var c=b.preProcessKeyStrokes(a);d.keyCode=a.which;c||d.smartContentChange(a);return c});d.obj.keypress(function(a){m.activeEditable.smartContentChange(a)});d.obj.keyup(function(a){if(a.keyCode===27){m.deactivateEditable();return false}});d.obj.contentEditableSelectionChange(function(a){c.onChange(d.obj,a);return d.obj});d.setUnmodified();d.snapshotContent=d.getContents();a.browser.mozilla&&d.initEmptyEditable();
d.initPlaceholder();d.ready=true;window.setTimeout(function(){m.disableObjectResizing()},20);m.trigger("aloha-editable-created",[d]);q.pub("aloha.editable.created",{data:d})})}else this.destroy()},isActive:false,originalContent:null,range:void 0,check:function(){var b=this,d=this.obj,c=d.get(0).nodeName.toLowerCase(),f=["a","abbr","address","article","aside","b","bdo","blockquote","cite","code","command","del","details","dfn","div","dl","em","footer","h1","h2","h3","h4","h5","h6","header","i","ins",
"menu","nav","p","pre","q","ruby","section","small","span","strong","sub","sup","var"],k;for(k=0;k<f.length;++k)if(c===f[k])return true;switch(c){case "textarea":case "input":c=a('<div id="'+this.getId()+'-aloha" class="aloha-'+c+'" />').insertAfter(d);c.height(d.height()).width(d.width()).html(d.val());d.hide();d.parents("form:first").submit(function(){d.val(b.getContents())});this.obj=c;return true}return false},initPlaceholder:function(){m.settings.placeholder&&this.isEmpty()&&this.addPlaceholder()},
isEmpty:function(){var b=a.trim(this.getContents());return b.length===0||(b==="<br>"?true:false)},initEmptyEditable:function(){var b=this.obj;this.empty(this.getContents())&&a(b).prepend('<br class="aloha-cleanme" />')},addPlaceholder:function(){var b=a("<div>"),d=a("<span>"),c,f=this.obj;c=p.Utils.Dom.allowsNesting(f[0],b[0])?b:d;if(a("."+this.placeholderClass,f).length===0){a(f).append(c.addClass(this.placeholderClass));a.each(m.settings.placeholder,function(a,b){f.is(a)&&c.html(b)});a("br",f).remove()}},
removePlaceholder:function(b,d){var f=this.placeholderClass,k;a("."+this.placeholderClass,b).length!==0&&(d===true?window.setTimeout(function(){k=new c.SelectionRange;k.startContainer=k.endContainer=b.get(0);k.startOffset=k.endOffset=0;a("."+f,b).remove();k.select()},100):a("."+f,b).remove())},destroy:function(){this===m.getActiveEditable()&&this.blur();switch(this.originalObj.get(0).nodeName.toLowerCase()){case "textarea":case "input":this.originalObj.val(this.getContents());this.obj.remove();this.originalObj.show()}this.ready=
false;this.removePlaceholder(this.obj);this.obj.removeClass("aloha-editable").contentEditable(false).unbind("mousedown click dblclick focus keydown keypress keyup");m.trigger("aloha-editable-destroyed",[this]);q.pub("aloha.editable.destroyed",{data:this});m.unregisterEditable(this)},setUnmodified:function(){this.originalContent=this.getContents()},isModified:function(){return this.originalContent!==this.getContents()},toString:function(){return"Aloha.Editable"},isDisabled:function(){return!this.obj.contentEditable()||
this.obj.contentEditable()==="false"},disable:function(){return this.isDisabled()||this.obj.contentEditable(false)},enable:function(){return this.isDisabled()&&this.obj.contentEditable(true)},activate:function(a){var b=m.getActiveEditable();if(u)u=false;else if((!a||!(a.type==="focus"&&b!==null&&b.obj.parent().get(0)===a.currentTarget))&&!this.isActive&&!this.isDisabled()){this.obj.addClass("aloha-editable-active");m.activateEditable(this);u=true;this.removePlaceholder(this.obj,true);u=false;this.isActive=
true;m.trigger("aloha-editable-activated",{oldActive:b,editable:this})}},blur:function(){this.obj.blur();this.isActive=false;this.initPlaceholder();this.obj.removeClass("aloha-editable-active");m.trigger("aloha-editable-deactivated",{editable:this});m.activeEditable.smartContentChange({type:"blur"},null)},empty:function(b){return null===b||a.trim(b)===""||b==="<br/>"},getContents:function(b){var d=this.obj.html(),c=t[this.getId()];if(!c||d!==c.raw){f.removeZeroWidthTextNodeFix();var l=this.obj.clone(false);
this.removePlaceholder(l);l=a(k.prune(l[0]));g.makeClean(l);l=a("<div>"+j.handleContent(l.html(),{contenthandler:m.settings.contentHandler.getContents,command:"getContents"},this)+"</div>");c=t[this.getId()]={};c.raw=d;c.element=l}if(b)return c.element.clone().contents();if(null==c.serialized)c.serialized=y(c.element[0]);return c.serialized},setContents:function(a,b){var d=null;if(m.getActiveEditable()===this){m.deactivateEditable();d=this}this.obj.html(a);null!==d&&d.activate();this.smartContentChange({type:"set-contents"});
return b?this.obj.contents():y(this.obj[0])},getId:function(){return this.obj.attr("id")},smartContentChange:function(b){function d(){null==j&&(j=c.getSnapshotContent());return j}var c=this,f=null,k;if(b&&(b.metaKey||b.crtlKey||b.altKey))return false;if(b&&b.originalEvent){k=/U\+(\w{4})/;k.exec(b.originalEvent.keyIdentifier);f=this.keyCodeMap[this.keyCode]||String.fromCharCode(b.which)||"unknown"}var j=null;if(a.inArray(f,this.sccDelimiters)>=0){clearTimeout(this.sccTimerIdle);clearTimeout(this.sccTimerDelay);
this.sccTimerDelay=window.setTimeout(function(){m.trigger("aloha-smart-content-changed",{editable:c,keyIdentifier:b.originalEvent.keyIdentifier,keyCode:b.keyCode,"char":f,triggerType:"keypress",getSnapshotContent:d});o(c);l.debug("Aloha.Editable","smartContentChanged: event type keypress triggered")},this.sccDelay)}else if(b&&b.type==="paste"){m.trigger("aloha-smart-content-changed",{editable:c,keyIdentifier:null,keyCode:null,"char":null,triggerType:"paste",getSnapshotContent:d});o(c)}else if(b&&
b.type==="blur"){m.trigger("aloha-smart-content-changed",{editable:c,keyIdentifier:null,keyCode:null,"char":null,triggerType:"blur",getSnapshotContent:d});o(c)}else if(b&&b.type==="block-change"){m.trigger("aloha-smart-content-changed",{editable:c,keyIdentifier:null,keyCode:null,"char":null,triggerType:"block-change",getSnapshotContent:d});o(c)}else if(f!==null){clearTimeout(this.sccTimerDelay);clearTimeout(this.sccTimerIdle);this.sccTimerIdle=window.setTimeout(function(){m.trigger("aloha-smart-content-changed",
{editable:c,keyIdentifier:null,keyCode:null,"char":null,triggerType:"idle",getSnapshotContent:d});o(c)},this.sccIdle)}},getSnapshotContent:function(){var a=this.snapshotContent;this.snapshotContent=this.getContents();return a}});m.Editable.setContentSerializer=function(a){y=a};m.Editable.getContentSerializer=function(){return y}});define("aloha/plugin",["aloha/core","jquery","util/class","aloha/pluginmanager","aloha/console"],function(m,e,a,g,c){var b=a.extend({name:null,defaults:{},settings:{},dependencies:[],
_constructor:function(a){"string"!==typeof a?c.error("Cannot initialise unnamed plugin, skipping"):this.name=a},checkDependencies:function(){var a=this,b=!0;e.each(a.dependencies,function(f,k){if(!m.isPluginLoaded(k.toString()))return b=!1,c.error("plugin."+a.name,'Required plugin "'+k+'" not found.'),!1});return b},init:function(){},getEditableConfig:function(a){var b=null,c=!1,k=this;this.settings.editables&&e.each(this.settings.editables,function(d,g){var o;if(a.is(d))if(c=!0,g instanceof Array)b=
[],b=e.merge(b,g);else if("object"===typeof g)for(o in b={},b["aloha-editable-selector"]=d,g)g.hasOwnProperty(o)&&(g[o]instanceof Array?b[o]=g[o]:"object"===typeof g[o]?(b[o]={},b[o]=e.extend(!0,b[o],k.config[o],g[o])):b[o]=g[o]);else b=g});c||(b="undefined"===typeof this.settings.config||!this.settings.config?this.config:this.settings.config);return b},makeClean:function(){},getUID:function(){c.deprecated("plugin","getUID() is deprecated. Use plugin.name instead.");return this.name},toString:function(){return this.name},
log:function(a,b){c.deprecated("plugin","log() is deprecated. Use Aloha.console instead.");c.log(a,this,b)}});b.create=function(a,c){var f=new (b.extend(c))(a);f.settings=e.extendObjects(!0,f.defaults,m.settings[a]);g.register(f);return f};return b});define("aloha/command",["aloha/core","aloha/registry","aloha/engine","util/dom","aloha/contenthandlermanager"],function(m,e,a,g,c){var b={execCommand:function(b,l,f,k){var d={commandId:b,preventDefault:!1};m.trigger("aloha-command-will-execute",d);if(!0!==
d.preventDefault){if(!k){if(!m.getSelection().getRangeCount())return;k=m.getSelection().getRangeAt(0)}"inserthtml"===b.toLowerCase()&&(f=c.handleContent(f,{contenthandler:m.settings.contentHandler.insertHtml,command:"insertHtml"}));a.execCommand(b,l,f,k);m.getSelection().getRangeCount()&&(k=m.getSelection().getRangeAt(0),l=k.commonAncestorContainer,l.parentNode&&(l=l.parentNode),f=new window.GENTICS.Utils.RangeObject,f.startContainer=k.startContainer,f.startOffset=k.startOffset,f.endContainer=k.endContainer,
f.endOffset=k.endOffset,g.doCleanup({merge:!0,removeempty:!1},f,l),f.select());m.trigger("aloha-command-executed",b)}},queryCommandEnabled:function(b,c){if(!c){if(!m.getSelection().getRangeCount())return;c=m.getSelection().getRangeAt(0)}return a.queryCommandEnabled(b,c)},queryCommandIndeterm:function(b,c){if(!c){if(!m.getSelection().getRangeCount())return;c=m.getSelection().getRangeAt(0)}return a.queryCommandIndeterm(b,c)},queryCommandState:function(b,c){if(!c){if(!m.getSelection().getRangeCount())return;
c=m.getSelection().getRangeAt(0)}return a.queryCommandState(b,c)},queryCommandSupported:function(b){return a.queryCommandSupported(b)},queryCommandValue:function(b,c){if(!c){if(!m.getSelection().getRangeCount())return;c=m.getSelection().getRangeAt(0)}return a.queryCommandValue(b,c)},querySupportedCommands:function(){var b=[],c;for(c in a.commands)a.commands.hasOwnProperty(c)&&b.push(c);return b}},b=new (e.extend(b));m.execCommand=b.execCommand;m.queryCommandEnabled=b.queryCommandEnabled;m.queryCommandIndeterm=
b.queryCommandIndeterm;m.queryCommandState=b.queryCommandState;m.queryCommandSupported=b.queryCommandSupported;m.queryCommandValue=b.queryCommandValue;m.querySupportedCommands=b.querySupportedCommands;return b});define("aloha/jquery.aloha",["aloha/core","aloha/selection","jquery","aloha/console"],function(m,e,a,g){function c(a,b,c,d){if(!(b!==d.target&&(/textarea|input|select/i.test(d.target.nodeName)||"text"===d.target.type)))return a.apply(b,c)}function b(b){var f,k,d,j;if("string"===typeof b.data){f=
b.handler;k=b.data.toLowerCase().split(" ");d={};for(j=0;j<k.length;j++)d[k[j]]=!0;b.handler=function(b){if(this===b.target){var k="keypress"!==b.type&&a.hotkeys.specialKeys[b.which],j="";b.altKey&&"alt"!==k&&(j+="alt+");b.ctrlKey&&"ctrl"!==k&&(j+="ctrl+");b.metaKey&&(!b.ctrlKey&&"meta"!==k)&&(j+="meta+");b.shiftKey&&"shift"!==k&&(j+="shift+");if(k){if(d[j+k])return c(f,this,arguments,b)}else if(k=String.fromCharCode(b.which).toLowerCase(),d[j+k]||d[j+a.hotkeys.shiftNums[k]]||"shift+"===j&&d[a.hotkeys.shiftNums[k]])return c(f,
this,arguments,b)}}}}var j=window.XMLSerializer;a.fn.between=function(a,b){var c;3!==this[0].nodeType?(c=this.children().size(),b>c&&(b=c),0>=b?this.prepend(a):this.children().eq(b-1).after(a)):0>=b?this.before(a):(b>=this[0].length||(c=this[0].data,this[0].data=c.substring(0,b),this.after(c.substring(b,c.length))),this.after(a))};a.fn.contentEditable=function(b){var c=a(this),k="contenteditable";a.browser.msie&&7==parseInt(a.browser.version,10)&&(k="contentEditable");if("undefined"===typeof b){if("undefined"===
typeof c[0]){g.warn("The jquery object did not contain any valid elements.");return}return"undefined"===typeof c[0].isContentEditable?(g.warn("Could not determine whether the is editable or not. I assume it is."),!0):c[0].isContentEditable}""===b?c.removeAttr(k):c.attr(k,b&&"false"!==b?"true":"false");return c};a.fn.aloha=function(){var b=this;m.bind("aloha-plugins-loaded",function(){b.each(function(b,c){m.isEditable(c)||(new m.Editable(a(c))).init()})});return b};a.fn.mahalo=function(){return this.each(function(){m.isEditable(this)&&
m.getEditableById(a(this).attr("id")).destroy()})};a.fn.contentEditableSelectionChange=function(b){var c=this;this.keyup(function(a){e.getRangeObject();b(a)});this.dblclick(function(a){b(a)});this.mousedown(function(){c.selectionStarted=!0});a(document).mouseup(function(a){e.eventOriginalTarget=c;c.selectionStarted&&b(a);e.eventOriginalTarget=!1;c.selectionStarted=!1});return this};a.fn.outerHtml=a.fn.outerHtml||function(){var b=a(this).get(0);if("undefined"!=typeof b.outerHTML)return b.outerHTML;
try{return(new j).serializeToString(b)}catch(c){try{return b.xml}catch(k){}}};a.fn.zap=function(){return this.each(function(){a(this.childNodes).insertBefore(this)}).remove()};a.fn.textNodes=function(b,c){var k=[],d=function(j){var g,e;if(3===j.nodeType&&a.trim(j.data)&&!c||3===j.nodeType&&c||"BR"==j.nodeName&&!b)k.push(j);else{g=0;for(e=j.childNodes.length;g<e;++g)d(j.childNodes[g])}};d(this[0]);return a(k)};a.extendObjects=a.fn.extendObjects=function(b,c){var k,d,j,g,e;k=1;var p=b||{},u=arguments.length,
t=!1,m;"boolean"===typeof p&&(t=p,p=c||{},k=2);"object"!==typeof p&&!a.isFunction(p)&&(p={});u===k&&(p=this,--k);for(m=k;m<u;m++)if(null!=(k=arguments[m]))for(d in k)k.hasOwnProperty(d)&&(j=p[d],g=k[d],p!==g&&(t&&g&&(a.isPlainObject(g)||!0===(e=a.isArray(g)))?(e?(e=!1,j=j&&a.isArray(j)?j:[]):j=j&&a.isPlainObject(j)?j:{},p[d]=a.isArray(g)?g:a.extendObjects(t,j,g)):void 0!==g&&(p[d]=g)));return p};a.hotkeys={version:"0.8",specialKeys:{8:"backspace",9:"tab",13:"return",16:"shift",17:"ctrl",18:"alt",
19:"pause",20:"capslock",27:"esc",32:"space",33:"pageup",34:"pagedown",35:"end",36:"home",37:"left",38:"up",39:"right",40:"down",45:"insert",46:"del",96:"0",97:"1",98:"2",99:"3",100:"4",101:"5",102:"6",103:"7",104:"8",105:"9",106:"*",107:"+",109:"-",110:".",111:"/",112:"f1",113:"f2",114:"f3",115:"f4",116:"f5",117:"f6",118:"f7",119:"f8",120:"f9",121:"f10",122:"f11",123:"f12",144:"numlock",145:"scroll",191:"/",224:"meta"},shiftNums:{"`":"~",1:"!",2:"@",3:"#",4:"$",5:"%",6:"^",7:"&",8:"*",9:"(","0":")",
"-":"_","=":"+",";":": ","'":'"',",":"<",".":">","/":"?","\\":"|"}};a.each(["keydown","keyup","keypress"],function(){a.event.special[this]={add:b}})});define("aloha/sidebar",["aloha/core","jquery","aloha/selection","PubSub"],function(m,e,a,g){var c=+new Date;e.easing.easeOutExpo||e.extend(e.easing,{easeOutExpo:function(a,b,c,f,k){return b==k?c+f:f*(-Math.pow(2,-10*b/k)+1)+c},easeOutElastic:function(a,b,c,f,k){var a=Math,j=1.70158,g=0,l=f;if(!b)return c;if(1==(b/=k))return c+f;g||(g=0.3*k);l<a.abs(f)?
(l=f,j=g/4):j=g/(2*a.PI)*a.asin(f/l);return l*a.pow(2,-10*b)*a.sin((b*k-j)*2*a.PI/g)+f+c}});var b=function(a){this.id=null;this.folds={};this.button=null;this.title=e('<div class="aloha-sidebar-panel-title"><span class="aloha-sidebar-panel-title-arrow"></span><span class="aloha-sidebar-panel-title-text">Untitled</span></div>');this.content=e('<div class="aloha-sidebar-panel-content"><div class="aloha-sidebar-panel-content-inner"><div class="aloha-sidebar-panel-content-inner-text"></div></div></div>');
this.effectiveElement=this.element=null;this.expanded=!1;this.isActive=!0;this.init(a)},j=function(a){var b=this;this.id="aloha-sidebar-"+ ++c;this.panels={};this.container=e('<div class="aloha-ui aloha-sidebar-bar"><div class="aloha-sidebar-handle"><span class="aloha-sidebar-handle-icon"></span></div><div class="aloha-sidebar-inner"><ul class="aloha-sidebar-panels"></ul></div></div>');this.width=300;this.isCompletelyOpen=this.isOpen=this.opened=!1;this.settings={rotateIcons:!e.browser.msie,overlayPage:!0};
e(function(){"undefined"!==typeof m.settings.sidebar&&m.settings.sidebar.disabled||b.init(a)})},l=null,f=null;e.extend(j.prototype,{init:function(a){var b=this,c;"object"===typeof a&&(c=a.panels,delete a.panels);e.extend(this,a);"object"===typeof c&&e.each(c,function(){b.addPanel(this,true)});a=this.container;"right"===this.position&&a.addClass("aloha-sidebar-right");a.hide().appendTo(e("body")).click(function(){b.barClicked.apply(b,arguments)}).find(".aloha-sidebar-panels").width(this.width);a.width(this.width);
this.width=a.width();this.updateHeight();this.initToggler();this.container.css("right"===this.position?"marginRight":"marginLeft",-this.width);this.opened&&this.open(0);this.toggleHandleIcon(this.isOpen);this.subscribeToEvents();e(window).resize(function(){b.updateHeight();b.correctHeight()});this.correctHeight()},show:function(){this.container.css("display","block");return this},hide:function(){this.container.css("display","none");return this},checkActivePanels:function(a){var b=[];if("undefined"!==
typeof a&&"undefined"!==typeof a.markupEffectiveAtStart){var c=a.markupEffectiveAtStart.length,f;for(f=0;f<c;++f)b.push(e(a.markupEffectiveAtStart[f]))}var k=this;e.each(this.panels,function(){k.showActivePanel(this,b)});this.correctHeight()},subscribeToEvents:function(){var a=this;g.sub("aloha.selection.context-change",function(b){a.isOpen&&a.checkActivePanels(b.range);a.lastRange=b.range});m.bind("aloha-editable-deactivated",function(){a.isOpen&&a.checkActivePanels();a.lastRange=null});this.container.mousedown(function(a){a.originalEvent.stopSelectionUpdate=
!0;m.eventHandled=!0});this.container.mouseup(function(a){a.originalEvent.stopSelectionUpdate=!0;m.eventHandled=!1})},correctHeight:function(){if(this.isOpen)if(this.isCompletelyOpen){var a=e(window).height(),b=[],c=[],k;for(k in this.panels)this.panels.hasOwnProperty(k)&&this.panels[k].isActive&&(c.push(this.panels[k]),b.push(k));if(0!==c.length&&(b=b.sort().join(","),!(f===b&&l===a))){l=a;f=b;for(var a=this.container.find(".aloha-sidebar-inner").height()-(c[0].title.outerHeight()+10)*c.length,j,
g,t,m=0,z=Math,x;0<c.length&&0<a;){a+=m;m=0;t=[];for(x=c.length-1;0<=x;--x)b=c[x],j=b.content.find(".aloha-sidebar-panel-content-inner"),k=z.min(j.height("auto").height(),z.floor(a/(x+1))),j.height(k),a-=k,g=j.find(".aloha-sidebar-panel-content-inner-text"),g.height()>k?(t.push(b),m+=k,j.css({"overflow-x":"hidden","overflow-y":"scroll"})):j.css("overflow-y","hidden"),b.expanded&&b.expand();c=t}}}else this.correctHeightWhenCompletelyOpen=!0},showActivePanel:function(a,b){b.push(null);a.content.parent("li");
var c=a.activeOn,f=e(),k=0,j=b.length,g;for(g=0;g<j;++g)c(b[g])&&(++k,b[g]&&e.merge(f,b[g]));k?a.activate(f):a.deactivate()},initToggler:function(){var a=this,b=this.container,c=b.find(".aloha-sidebar-handle-icon"),f,k="right"===this.position;this.opened&&this.rotateHandleArrow(k?0:180,0);e(function(){"undefined"!==typeof m.settings.sidebar&&(m.settings.sidebar.handle&&m.settings.sidebar.handle.top)&&(e(b.find(".aloha-sidebar-handle"))[0].style.top=m.settings.sidebar.handle.top)});b.find(".aloha-sidebar-handle").click(function(){f&&
clearInterval(f);c.stop().css("marginLeft",4);a.isOpen?(e(this).removeClass("aloha-sidebar-toggled"),a.close(),a.isOpen=!1):(e(this).addClass("aloha-sidebar-toggled"),a.open(),a.isOpen=!0)}).hover(function(){var b=a.isOpen?-1:1;f&&clearInterval(f);c.stop();e(this).stop().animate(k?{marginLeft:"-="+5*b}:{marginRight:"-="+5*b},200);f=setInterval(function(){b*=-1;c.animate(k?{left:"-="+4*b}:{right:"-="+4*b},300)},300)},function(){f&&clearInterval(f);c.stop().css(k?"left":"right",5);e(this).stop().animate(k?
{marginLeft:0}:{marginRight:0},600,"easeOutElastic")})},roundCorners:function(){var a=this.container,b=a.find(".aloha-sidebar-panels>li:not(.aloha-sidebar-deactivated)");a.find(".aloha-sidebar-panel-top, .aloha-sidebar-panel-bottom").removeClass("aloha-sidebar-panel-top").removeClass("aloha-sidebar-panel-bottom");b.first().find(".aloha-sidebar-panel-title").addClass("aloha-sidebar-panel-top");b.last().find(".aloha-sidebar-panel-content").addClass("aloha-sidebar-panel-bottom")},updateHeight:function(){var a=
e(window).height();this.container.height(a).find(".aloha-sidebar-inner").height(a)},barClicked:function(a){this.handleBarclick(e(a.target))},handleBarclick:function(a){a.hasClass("aloha-sidebar-panel-title")?this.togglePanel(a):!a.hasClass("aloha-sidebar-panel-content")&&(!a.hasClass("aloha-sidebar-handle")&&!a.hasClass("aloha-sidebar-bar"))&&this.handleBarclick(a.parent())},getPanelById:function(a){return this.panels[a]},getPanelByElement:function(a){return this.getPanelById(("LI"===a[0].tagName?
a:a.parent("li"))[0].id)},togglePanel:function(a){this.getPanelByElement(a).toggle()},rotateHandleIcon:function(a,b){var c=this.container.find(".aloha-sidebar-handle-icon");c.animate({angle:a},{duration:"number"===typeof b||"string"===typeof b?b:500,easing:"easeOutExpo",step:function(a){c.css({"-o-transform":"rotate("+a+"deg)","-webkit-transform":"rotate("+a+"deg)","-moz-transform":"rotate("+a+"deg)","-ms-transform":"rotate("+a+"deg)"})}})},toggleHandleIcon:function(a){a^="right"===this.position;
if(this.settings.rotateIcons)this.rotateHandleIcon(a?180:0,0);else{var b=this.container.find(".aloha-sidebar-handle-icon");a?b.addClass("aloha-sidebar-handle-icon-left"):b.removeClass("aloha-sidebar-handle-icon-left")}},open:function(a){if(this.isOpen)return this;var b="right"===this.position,c=b?{marginRight:0}:{marginLeft:0},f=this;this.toggleHandleIcon(!0);this.container.animate(c,"number"===typeof a||"string"===typeof a?a:500,"easeOutExpo");this.settings.overlayPage||e("body").animate(b?{marginRight:"+="+
this.width}:{marginLeft:"+="+this.width},500,"easeOutExpo",function(){f.isCompletelyOpen=!0;f.correctHeightWhenCompletelyOpen&&f.correctHeight()});this.isOpen=!0;this.correctHeight();this.lastRange&&this.checkActivePanels(this.lastRange);e("body").trigger("aloha-sidebar-opened",this);return this},close:function(a){if(!this.isOpen)return this;var b="right"===this.position,c=b?{marginRight:-this.width}:{marginLeft:-this.width};this.toggleHandleIcon(!1);this.container.animate(c,"number"===typeof a||
"string"===typeof a?a:500,"easeOutExpo");this.settings.overlayPage||e("body").animate(b?{marginRight:"-="+this.width}:{marginLeft:"-="+this.width},500,"easeOutExpo");this.isCompletelyOpen=this.isOpen=!1;return this},activatePanel:function(a,b){"string"===typeof a&&(a=this.getPanelById(a));a&&a.activate(b);this.roundCorners();return this},expandPanel:function(a,b){"string"===typeof a&&(a=this.getPanelById(a));a&&a.expand(b);return this},collapsePanel:function(a,b){"string"===typeof a&&(a=this.getPanelById(a));
a&&a.collapse(b);return this},addPanel:function(d){d instanceof b||(d.width||(d.width=this.width),d.sidebar=this,d=new b(d));this.panels[d.id]=d;this.container.find(".aloha-sidebar-panels").append(d.element);this.checkActivePanels(a.getRangeObject());return d}});e.extend(b.prototype,{init:function(a){this.setTitle(a.title).setContent(a.content);delete a.title;delete a.content;e.extend(this,a);this.id||(this.id="aloha-sidebar-"+ ++c);this.element=e('<li id="'+this.id+'">').append(this.title,this.content);
this.expanded&&this.content.height("auto");this.toggleTitleIcon(this.expanded);this.coerceActiveOn();this.title.attr("unselectable","on").css("-moz-user-select","none").each(function(){this.onselectstart=function(){return false}});"function"===typeof this.onInit&&this.onInit.apply(this)},toggleTitleIcon:function(a){if(this.sidebar.settings.rotateIcons)this.rotateTitleIcon(a?90:0);else{var b=this.title.find(".aloha-sidebar-panel-title-arrow");a?b.addClass("aloha-sidebar-panel-title-arrow-down"):b.removeClass("aloha-sidebar-panel-title-arrow-down")}},
coerceActiveOn:function(){if("function"!==typeof this.activeOn){var a=this.activeOn;this.activeOn=function(){var b=typeof a;return"boolean"===b?function(){return a}:"undefined"===b?function(){return!0}:"string"===b?function(b){return b?b.is(a):!1}:function(){return!1}}()}},activate:function(a){this.isActive=!0;this.content.parent("li").show().removeClass("aloha-sidebar-deactivated");this.effectiveElement=a;"function"===typeof this.onActivate&&this.onActivate.call(this,a)},deactivate:function(){this.isActive&&
(this.isActive=!1,this.content.parent("li").hide().addClass("aloha-sidebar-deactivated"),this.effectiveElement=null)},toggle:function(){this.expanded?this.collapse():this.expand()},expand:function(a){var b=this,c=this.content,f=c.height(),k=c.height("auto").height();c.height(f).stop().animate({height:k},500,"easeOutExpo",function(){"function"===typeof a&&a.call(b)});this.element.removeClass("collapsed");this.toggleTitleIcon(!0);this.expanded=!0;return this},collapse:function(a,b){var c=this;this.element.addClass("collapsed");
this.content.stop().animate({height:5},250,"easeOutExpo",function(){"function"===typeof b&&b.call(c)});this.toggleTitleIcon(!1);this.expanded=!1;return this},setTitle:function(a){this.title.find(".aloha-sidebar-panel-title-text").html(a);return this},setContent:function(a){if(!a||""===a)a="&nbsp;";this.content.find(".aloha-sidebar-panel-content-inner-text").html(a);return this},rotateTitleIcon:function(a,b){var c=this.title.find(".aloha-sidebar-panel-title-arrow");c.animate({angle:a},{duration:"number"===
typeof b?b:500,easing:"easeOutExpo",step:function(a){c.css({"-o-transform":"rotate("+a+"deg)","-webkit-transform":"rotate("+a+"deg)","-moz-transform":"rotate("+a+"deg)","-ms-transform":"rotate("+a+"deg)"})}})},renderEffectiveParents:function(a,b){for(var c=a.first(),f=[],k=[],j=this.activeOn,g,l;0<c.length&&!c.is(".aloha-editable");){if(j(c)){k.push("<span>"+c[0].tagName.toLowerCase()+"</span>");g=k.length;for(l=[];g--;)l.push(k[g]);f.push('<div class="aloha-sidebar-panel-parent"><div class="aloha-sidebar-panel-parent-path">'+
l.join("")+'</div><div class="aloha-sidebar-panel-parent-contentaloha-sidebar-opened">'+("function"===typeof b?b(c):"----")+"</div></div>")}c=c.parent()}this.setContent(f.join(""));e(".aloha-sidebar-panel-parent-path").click(function(){var a=e(this).parent().find(".aloha-sidebar-panel-parent-content");a.hasClass("aloha-sidebar-opened")?a.hide().removeClass("aloha-sidebar-opened"):a.show().addClass("aloha-sidebar-opened")});this.content.height("auto").find(".aloha-sidebar-panel-content-inner").height("auto")}});
var k=new j({position:"left",width:250}),j=new j({position:"right",width:250});m.Sidebar={left:k,right:j};return m.Sidebar});window.GENTICS=window.GENTICS||{};window.GENTICS.Utils=window.GENTICS.Utils||{};define("util/position",["jquery"],function(m){var e=window.GENTICS;e.Utils.Position={};e.Utils.Position.w=m(window);e.Utils.Position.Scroll={top:0,left:0,isScrolling:!1};e.Utils.Position.ScrollCorrection={top:100,left:50};e.Utils.Position.Mouse={x:0,y:0,oldX:0,oldY:0,isMoving:!1,triggeredMouseStop:!0};
e.Utils.Position.mouseStopCallbacks=[];e.Utils.Position.mouseMoveCallbacks=[];e.Utils.Position.update=function(){var a=this.w.scrollTop(),g=this.w.scrollLeft();if(this.Scroll.isScrolling)this.Scroll.top==a&&this.Scroll.left==g&&(this.Scroll.isScrolling=!1);else if(this.Scroll.top!=a||this.Scroll.left!=g)this.Scroll.isScrolling=!0;this.Scroll.top=a;this.Scroll.left=g;if(this.Mouse.x==this.Mouse.oldX&&this.Mouse.y==this.Mouse.oldY){if(this.Mouse.isMoving=!1,!this.Mouse.triggeredMouseStop){this.Mouse.triggeredMouseStop=
!0;for(a=0;a<this.mouseStopCallbacks.length;a++)this.mouseStopCallbacks[a].call()}}else{this.Mouse.isMoving=!0;this.Mouse.triggeredMouseStop=!1;for(a=0;a<this.mouseMoveCallbacks.length;a++)this.mouseMoveCallbacks[a].call()}this.Mouse.oldX=this.Mouse.x;this.Mouse.oldY=this.Mouse.y};e.Utils.Position.addMouseStopCallback=function(a){this.mouseStopCallbacks.push(a);return this.mouseStopCallbacks.length-1};e.Utils.Position.addMouseMoveCallback=function(a){this.mouseMoveCallbacks.push(a);return this.mouseMoveCallbacks.length-
1};m(function(){window.setInterval(function(){e.Utils.Position.update()},500)});m("html").mousemove(function(a){e.Utils.Position.Mouse.x=a.pageX;e.Utils.Position.Mouse.y=a.pageY})});define("aloha/repositorymanager",["aloha/core","util/class","jquery","aloha/console"],function(m,e,a,g){m.RepositoryManager=e.extend({repositories:[],settings:{},initialized:!1,init:function(){var a=this.repositories;m.settings&&m.settings.repositories&&(this.settings=m.settings.repositories);this.settings.timeout=this.settings.timeout||
5E3;var b=a.length,j;for(j=0;j<b;++j)this.initRepository(a[j]);this.initialized=!0},register:function(a){this.getRepository(a.repositoryId)?g.warn(this,"A repository with name { "+a.repositoryId+" } already registerd. Ignoring this."):(this.repositories.push(a),this.initialized&&this.initRepository(a))},initRepository:function(c){c.settings||(c.settings={});this.settings[c.repositoryId]&&a.extend(c.settings,this.settings[c.repositoryId]);c.init()},getRepository:function(a){var b=this.repositories,
j,g=b.length;for(j=0;j<g;++j)if(b[j].repositoryId===a)return b[j];return null},query:function(c,b){function j(a){return function(){t.apply(a,arguments)}}var l=this,f,k=[],d={numItems:0,hasMoreItems:!1},e=[],o=0,r,p,u,t=function(c,f){if(0!==o){var j=c?c.length:0;if(j){if(!c[0].repositoryId){var e=this.repositoryId,q;for(q=0;q<j;++q)c[q].repositoryId=e}a.merge(k,c)}f&&d?(d.numItems=a.isNumeric(f.numItems)&&a.isNumeric(d.numItems)?d.numItems+f.numItems:void 0,d.hasMoreItems="boolean"===typeof f.hasMoreItems&&
"boolean"===typeof d.hasMoreItems?d.hasMoreItems||f.hasMoreItems:void 0,f.timeout&&(d.timeout=!0)):d=void 0;g.debug(this,"The repository "+this.repositoryId+" returned with "+j+" results.");0===--o&&l.queryCallback(b,k,d,r)}},m=parseInt(c.timeout,10)||this.settings.timeout;r=window.setTimeout(function(){0<o&&g.warn(this,o+" repositories did not return before the configured timeout of "+m+"ms.");o=0;d=d||{};d.timeout=!0;l.queryCallback(b,k,d,r)},m);c.repositoryId?e.push(this.getRepository(c.repositoryId)):
e=this.repositories;u=e.length;var z=[];for(p=0;p<u;++p)if(f=e[p],(!c.repositoryId||f.repositoryId===c.repositoryId)&&"function"===typeof f.query)++o,z.push(f);u=z.length;for(p=0;p<u;++p)f=z[p],f.query(c,j(f));0===o&&this.queryCallback(b,k,d,r)},queryCallback:function(a,b,j,g){g&&clearTimeout(g);b={items:b,results:b.length};j&&(b.numItems=j.numItems,b.hasMoreItems=j.hasMoreItems,b.timeout=j.timeout);a.call(this,b)},getChildren:function(c,b){function j(a){return function(){u.apply(a,arguments)}}var g=
this,f,k=[],d=[],e=0,o,r,p,u=function(d){0!==e&&(k&&d&&a.merge(k,d),0===--e&&g.getChildrenCallback(b,k,o))};if("aloha"===c.inFolderId){var t=c.repositoryFilter,y=t&&t.length;p=this.repositories.length;for(r=0;r<p;++r)f=this.repositories[r],(!y||-1<a.inArray(f.repositoryId,t))&&d.push(new m.RepositoryFolder({id:f.repositoryId,name:f.repositoryName,repositoryId:f.repositoryId,type:"repository",hasMoreItems:!0}));g.getChildrenCallback(b,d,null)}else{d=this.repositories;f=parseInt(c.timeout,10)||this.settings.timeout;
o=window.setTimeout(function(){e=0;g.getChildrenCallback(b,k,o)},f);p=d.length;for(r=0;r<p;++r)if(f=d[r],(!c.repositoryId||f.repositoryId===c.repositoryId)&&"function"===typeof f.getChildren)++e,f.getChildren(c,j(f));0===e&&this.getChildrenCallback(b,k,o)}},getChildrenCallback:function(a,b,j){j&&clearTimeout(j);a.call(this,b)},makeClean:function(a){var b=this,j={},l=0,f=b.repositories.length;a.find("[data-gentics-aloha-repository="+this.prefix+"]").each(function(){for(;l<f;)j.makeClean(a),l+=1;g.debug(b,
"Passing contents of HTML Element with id { "+this.attr("id")+" } for cleaning to repository { "+j.repositoryId+" }");j.makeClean(this)})},markObject:function(c,b){if(c)if(b){var j=this.getRepository(b.repositoryId);j?(a(c).attr({"data-gentics-aloha-repository":b.repositoryId,"data-gentics-aloha-object-id":b.id}),j.markObject(c,b)):g.error(this,"Trying to apply a repository { "+b.name+" } to an object, but item has no repositoryId.")}else a(c).removeAttr("data-gentics-aloha-repository").removeAttr("data-gentics-aloha-object-id")},
getObject:function(c,b){var j=this,g=a(c),f=this.getRepository(g.attr("data-gentics-aloha-repository")),k=g.attr("data-gentics-aloha-object-id");f&&k&&(this.itemCache=this.itemCache||[],this.itemCache[f.repositoryId]=this.itemCache[f.repositoryId]||[],this.itemCache[f.repositoryId][k]?b.call(this,[this.itemCache[f.repositoryId][k]]):f.getObjectById(k,function(a){j.itemCache[f.repositoryId][k]=a[0];b.call(this,a)}))},folderOpened:function(a){var b=this.getRepository(a.repositoryId);"function"===typeof b.folderOpened&&
b.folderOpened(a)},folderClosed:function(a){var b=this.getRepository(a.repositoryId);"function"===typeof b.folderClosed&&b.folderClosed(a)},folderSelected:function(a){var b=this.getRepository(a.repositoryId);"function"===typeof b.folderSelected&&b.folderSelected(a)},getSelectedFolder:function(){var a,b=this.repositories.length,j;for(a=0;a<b;++a)if("function"===typeof this.repositories[a].getSelectedFolder&&(j=this.repositories[a].getSelectedFolder()))return j},toString:function(){return"repositorymanager"}});
m.RepositoryManager=new m.RepositoryManager;return m.RepositoryManager});define("aloha/repository",["aloha/core","util/class","aloha/repositorymanager"],function(m,e,a){e=e.extend({_constructor:function(g,c){this.repositoryId=g;this.settings={};this.repositoryName=c||g;a.register(this)},init:function(){},query:null,getChildren:null,makeClean:function(){},markObject:function(){},setTemplate:function(a){this.template=a?a:null},hasTemplate:function(){return this.template?!0:!1},getTemplate:function(){return this.template},
getObjectById:function(){return!0}});return m.AbstractRepository=e});define("aloha/repositoryobjects",["aloha/core","util/class"],function(m,e){var a=window.GENTICS;m.RepositoryObject=function(){};m.RepositoryDocument=e.extend({_constructor:function(g){this.type="document";g.id&&(g.name&&g.repositoryId)&&(a.Utils.applyProperties(this,g),this.baseType="document")}});m.RepositoryFolder=e.extend({_constructor:function(g){this.type="folder";g.id&&(g.name&&g.repositoryId)&&(a.Utils.applyProperties(this,
g),this.baseType="folder")}})});(function(m){function e(){var a,b,d=Aloha.settings.plugins&&Aloha.settings.plugins.load,c=Aloha.settings.baseUrl,j,g=/\/aloha.js(\?\S*)?$/,l=/\/[^\/]*\.js$/,e;if(!d||!c){a=document.getElementsByTagName("script");for(e=0;e<a.length;e++){b=a[e];j=b.getAttribute("data-aloha-plugins");if(null!=j){d||(d=j);c||(c=b.src.replace(l,""));break}!c&&g.test(b.src)&&(c=b.src.replace(g,""))}}"string"===typeof d&&""!==d&&(d=d.replace(/\s+/g,"").split(","));return{baseUrl:c,plugins:d||
[]}}function a(){for(var a=document.getElementsByTagName("script"),b=0;b<a.length;b++)if("true"===a[b].getAttribute("data-aloha-defer-init"))return!0;return!1}function g(a){var b={},d=[],c={},j={},g,l,e=Aloha.settings.basePath||"",t=Aloha.settings.bundles||{},m;for(m=0;m<a.length;m++){g=a[m].split("/");l=g[0];g=g[1];l=t[l]?e+t[l]:e+"../plugins/"+l;var z=b,x=l,v=g,A=["nls","css","vendor","res"],B=void 0,E=void 0;z[v]=x+"/"+v+"/lib";for(E=0;E<A.length;E++)B=A[E],z[v+"/"+B]=x+"/"+v+"/"+B;c[g]=l+"/"+
g;d.push(g+"/"+g+"-plugin");j[g]={jquery:"aloha/jquery"}}return{paths:b,entryPoints:d,baseUrlByName:c,names:[],map:j}}function c(){var a={},b=Array.prototype.slice.call(arguments),d,c,j;for(c=0;c<b.length;c++)for(d in j=b[c],j)j.hasOwnProperty(d)&&(a[d]=b[c][d]);return a}function b(a,b){define(a,function(){return b})}function j(){Aloha.features={};Aloha.defaults={};Aloha.settings=Aloha.settings||{};Aloha.initialize=l.start;var a=e(),k=g(a.plugins);Aloha.settings.baseUrl=a.baseUrl;Aloha.settings.loadedPlugins=
k.names;Aloha.settings._pluginBaseUrlByName=k.baseUrlByName;a=c({aloha:{jquery:"aloha/jquery"},"aloha/jquery":{jquery:"jquery"},jqueryui:{jquery:"aloha/jquery"},vendor:{jquery:"aloha/jquery"},util:{jquery:"aloha/jquery"},RepositoryBrowser:{jquery:"aloha/jquery"},jstree:{jquery:"aloha/jquery"},jqgrid:{jquery:"aloha/jquery"},"jqgrid-locale-en":{jquery:"aloha/jquery"},"jqgrid-locale-de":{jquery:"aloha/jquery"},"jquery-layout":{jquery:"aloha/jquery"}},k.map);a={context:"aloha",locale:Aloha.settings.locale||
"en",baseUrl:Aloha.settings.baseUrl,map:a};(m.__DEPS__||(m.__DEPS__={})).lang=a.locale;var d=c(a,Aloha.settings.requireConfig);d.paths=c({jquery:"vendor/jquery-1.7.2",jqueryui:"vendor/jquery-ui-1.9m6"},{PubSub:"vendor/pubsub/js/pubsub-unminified",Class:"vendor/class",RepositoryBrowser:"vendor/repository-browser/js/repository-browser-unminified",jstree:"vendor/jquery.jstree",jqgrid:"vendor/jquery.jqgrid","jquery-layout":"vendor/jquery.layout","jqgrid-locale-en":"vendor/grid.locale.en","jqgrid-locale-de":"vendor/grid.locale.de",
"repository-browser-i18n-de":"vendor/repository-browser/js/repository-browser-unminified","repository-browser-i18n-en":"vendor/repository-browser/js/repository-browser-unminified"},k.paths,d.paths);a=Aloha.settings.predefinedModules||{};Aloha.settings.jQuery&&(a.jquery=Aloha.settings.jQuery);for(var j in a)a.hasOwnProperty(j)&&(b(j,a[j]),delete d.paths[j]);var o=require.config(d);Aloha.require=function(a){return 1===arguments.length&&typeof a==="function"?o(["aloha"],a):o.apply(this,arguments)};Aloha.bind=
function(a,b){Aloha.require(["aloha/jquery"],function(d){Aloha.bind=function(a,b){switch(l.getReadiness(a)){case "deferred":var c=l.getPhaseByEvent(a);if(!c.deferred)c.deferred=d.Deferred();c.deferred.done(b);break;case "immediate":b();break;case "normal":d(Aloha,"body").bind(a,b);break;default:throw"Unknown readiness";}return this};Aloha.bind(a,b)});return this};Aloha.trigger=function(a,b){Aloha.require(["aloha/jquery"],function(d){Aloha.trigger=function(a,b){var c=l.getPhaseByEvent(a);if(c&&c.deferred){d(c.deferred.resolve);
c.deferred=null}d(Aloha,"body").trigger(a,b);return this};Aloha.trigger(a,b)});return this};Aloha.unbind=function(a){Aloha.require(["aloha/jquery"],function(b){Aloha.unbind=function(a){b(Aloha,"body").unbind(a)};Aloha.unbind(a)})};Aloha.ready=function(a){this.bind("aloha-ready",a);return this};var r=Aloha.settings.jQuery;define("aloha/jquery",["jquery"],function(a){return r||a});Aloha.jQuery=r;define("aloha","aloha/jquery util/json2 aloha/rangy-core util/class util/lang util/range util/dom aloha/core aloha/editable aloha/console aloha/markup aloha/plugin aloha/selection aloha/command aloha/jquery.aloha aloha/sidebar util/position aloha/repositorymanager aloha/repository aloha/repositoryobjects aloha/contenthandlermanager".split(" "),
function(a){Aloha.features.jquery=true;Aloha.jQuery=a;Aloha.settings=a.extendObjects(true,{},Aloha.defaults,Aloha.settings);return Aloha});require(d,["aloha","aloha/jquery"],function(a,b){require(d,k.entryPoints,function(){b(function(){window.rangy.init();a.init()})})})}var l={phases:[],completed:[],start:function(a,b){l.phases=l.phases.concat(a);l.proceed(0,a,b)},proceed:function(a,b,d){if(a<b.length){var c=b[a],j=function(){l.proceed(++a,b,d)},g=function(){l.completed.push(c);c.event&&Aloha.trigger(c.event)};
c.fn?c.fn(g,j):(g(),j())}else d&&d()},getPhaseByEvent:function(a){var b;for(b=0;b<l.phases.length;b++)if(a===l.phases[b].event)return l.phases[b];return null},getReadiness:function(a){var b;for(b=0;b<l.completed.length;b++)if(a===l.completed[b].event)return"immediate";return l.getPhaseByEvent(a)?"deferred":"normal"}};m.Aloha=m.Aloha||{};m.Aloha.deferInit||a()?m.Aloha.deferInit=j:Aloha._load=j})(window);define("ui/context",["aloha","jquery","util/class"],function(m,e,a){var g;g=e("#aloha-ui-context");
g.length||(g=e("<div>",{"class":"aloha",id:"aloha-ui-context"}),e(function(){g.appendTo("body")}));m=a.extend({surfaces:[],containers:[]});e.extend(m,{selector:"#aloha-ui-context",element:g});return m});define("ui/scopes",["jquery","PubSub","util/maps"],function(m,e,a){function g(a,b){if(c.hasOwnProperty(b))for(var f=c[b],j=0;j<f.length;j++){var l=f[j];a.push(l);g(a,l)}}var c={"Aloha.empty":[],"Aloha.global":["Aloha.empty"],"Aloha.continuoustext":["Aloha.global"]},b=[],j={},l=!1;Aloha.bind("aloha-selection-changed-before",
function(){l=!1});Aloha.bind("aloha-selection-changed-after",function(a,b,c){"undefined"!==typeof c&&!l&&f.setScope("Aloha.continuoustext")});var f={enterScope:function(a,b){var b=b||"_globalCounter",c=j[a];c||(c=j[a]={});var f=c[b]||0,f=f+1;(c[b]=f)||e.pub("aloha.ui.scope.change")},leaveScope:function(b,d,c){var d=d||"_globalCounter",f=j[b];if(f){var g=f[d];g&&((g-=1)&&!c?f[d]=g:(delete f[d],a.isEmpty(f)&&delete j[b],e.pub("aloha.ui.scope.change")))}},isActiveScope:function(a){return j[a]||-1!==
m.inArray(a,b)?!0:!1},getPrimaryScope:function(){return b[0]},setScope:function(a){l=!0;b[0]!=a&&(b=[a],g(b,a),e.pub("aloha.ui.scope.change"))},createScope:function(a,b){b?"string"===typeof b&&(b=[b]):b=["Aloha.empty"];c[a]=b}};return f});define("ui/container",["jquery","util/class","ui/scopes"],function(m,e,a){function g(c,f){switch(m.type(f)){case "function":return f;case "object":if(f.scope)return b[f.scope]?b[f.scope]:b[f.scope]=function(){return a.isActiveScope(f.scope)};throw"Invalid showOn configuration";
default:return j}}var c=0,b={},j=function(){return!0},e=e.extend({element:null,_constructor:function(a,b){var k=g(this,b.showOn),d;k.showOnId||(k.showOnId=++c);d=k.showOnId;var j=a.containers[d];this.context=a;j||(j=a.containers[d]={shouldShow:k,containers:[]});j.containers.push(this)},show:function(){},hide:function(){},focus:function(){},foreground:function(){},childVisible:function(){},childFocus:function(){},childForeground:function(){}});m.extend(e,{showContainersForContext:function(a,b){var c,
d,j;if(a.containers)for(d in j=a.containers,j)if(j.hasOwnProperty(d)){c=j[d];var g=c.containers;c=c.shouldShow(b)?"show":"hide";for(var e=void 0,e=0;e<g.length;e++)g[e][c]()}}});return e});define("ui/surface",["aloha/core","jquery","util/class","ui/container"],function(m,e,a){var g=a.extend({_constructor:function(a){a.surfaces.push(this)},isActive:function(){return!0}});e.extend(g,{range:null,show:function(a){e.each(a.surfaces,function(a,c){c.show()})},hide:function(a){e.each(a.surfaces,function(a,
c){c.hide()})},trackRange:function(a){a.bind("mousedown",function(a){a.originalEvent.stopSelectionUpdate=!0;m.eventHandled=!0;g.suppressHide=!0;m.activeEditable&&(a=m.getSelection(),g.range=0<a.getRangeCount()?a.getRangeAt(0):null)});a.bind("mouseup",function(a){a.originalEvent.stopSelectionUpdate=!0;m.eventHandled=!1;g.suppressHide=!1})}});return g});define("ui/component",["aloha/core","jquery","util/class"],function(m,e,a){var g=0;return a.extend({id:0,isInstance:!0,container:null,type:null,visible:!0,
_constructor:function(){this.id=g++;this.init()},adoptParent:function(a){this.container=a},init:function(){},isVisible:function(){return this.visible},show:function(a){!1===a?this.hide():this.visible||(this.visible=!0,this.element.show(),this.container&&this.container.childVisible(this,!0))},hide:function(){this.visible&&(this.visible=!1,this.element.hide(),this.container&&this.container.childVisible(this,!1))},focus:function(){this.element.focus();this.container&&this.container.childFocus(this)},
foreground:function(){this.container&&this.container.childForeground(this)},enable:function(){},disable:function(){}})});define("jqueryui",["jquery"],function(m){(function(e,a){function g(a,j){var g=a.nodeName.toLowerCase();if("area"===g){var g=a.parentNode,f=g.name;if(!a.href||!f||"map"!==g.nodeName.toLowerCase())return!1;g=e("img[usemap=#"+f+"]")[0];return!!g&&c(g)}return(/input|select|textarea|button|object/.test(g)?!a.disabled:"a"==g?a.href||j:j)&&c(a)}function c(a){return!e(a).parents().andSelf().filter(function(){return"hidden"===
e.curCSS(this,"visibility")||e.expr.filters.hidden(this)}).length}e.ui=e.ui||{};e.ui.version||(e.extend(e.ui,{version:"1.9m6",keyCode:{ALT:18,BACKSPACE:8,CAPS_LOCK:20,COMMA:188,COMMAND:91,COMMAND_LEFT:91,COMMAND_RIGHT:93,CONTROL:17,DELETE:46,DOWN:40,END:35,ENTER:13,ESCAPE:27,HOME:36,INSERT:45,LEFT:37,MENU:93,NUMPAD_ADD:107,NUMPAD_DECIMAL:110,NUMPAD_DIVIDE:111,NUMPAD_ENTER:108,NUMPAD_MULTIPLY:106,NUMPAD_SUBTRACT:109,PAGE_DOWN:34,PAGE_UP:33,PERIOD:190,RIGHT:39,SHIFT:16,SPACE:32,TAB:9,UP:38,WINDOWS:91}}),
e.fn.extend({_focus:e.fn.focus,focus:function(a,c){return"number"===typeof a?this.each(function(){var g=this;setTimeout(function(){e(g).focus();c&&c.call(g)},a)}):this._focus.apply(this,arguments)},scrollParent:function(){var a;a=e.browser.msie&&/(static|relative)/.test(this.css("position"))||/absolute/.test(this.css("position"))?this.parents().filter(function(){return/(relative|absolute|fixed)/.test(e.curCSS(this,"position",1))&&/(auto|scroll)/.test(e.curCSS(this,"overflow",1)+e.curCSS(this,"overflow-y",
1)+e.curCSS(this,"overflow-x",1))}).eq(0):this.parents().filter(function(){return/(auto|scroll)/.test(e.curCSS(this,"overflow",1)+e.curCSS(this,"overflow-y",1)+e.curCSS(this,"overflow-x",1))}).eq(0);return/fixed/.test(this.css("position"))||!a.length?e(document):a},zIndex:function(b){if(b!==a)return this.css("zIndex",b);if(this.length)for(var b=e(this[0]),c;b.length&&b[0]!==document;){c=b.css("position");if("absolute"===c||"relative"===c||"fixed"===c)if(c=parseInt(b.css("zIndex"),10),!isNaN(c)&&0!==
c)return c;b=b.parent()}return 0},disableSelection:function(){return this.bind((e.support.selectstart?"selectstart":"mousedown")+".ui-disableSelection",function(a){a.preventDefault()})},enableSelection:function(){return this.unbind(".ui-disableSelection")}}),e.each(["Width","Height"],function(b,c){function g(a,b,d,c){e.each(f,function(){b-=parseFloat(e.curCSS(a,"padding"+this,!0))||0;d&&(b-=parseFloat(e.curCSS(a,"border"+this+"Width",!0))||0);c&&(b-=parseFloat(e.curCSS(a,"margin"+this,!0))||0)});
return b}var f="Width"===c?["Left","Right"]:["Top","Bottom"],k=c.toLowerCase(),d={innerWidth:e.fn.innerWidth,innerHeight:e.fn.innerHeight,outerWidth:e.fn.outerWidth,outerHeight:e.fn.outerHeight};e.fn["inner"+c]=function(b){return b===a?d["inner"+c].call(this):this.each(function(){e(this).css(k,g(this,b)+"px")})};e.fn["outer"+c]=function(a,b){return"number"!==typeof a?d["outer"+c].call(this,a):this.each(function(){e(this).css(k,g(this,a,!0,b)+"px")})}}),e.extend(e.expr[":"],{data:function(a,c,g){return!!e.data(a,
g[3])},focusable:function(a){return g(a,!isNaN(e.attr(a,"tabindex")))},tabbable:function(a){var c=e.attr(a,"tabindex"),l=isNaN(c);return(l||0<=c)&&g(a,!l)}}),e(function(){var a=document.body,c=a.appendChild(c=document.createElement("div"));e.extend(c.style,{minHeight:"100px",height:"auto",padding:0,borderWidth:0});e.support.minHeight=100===c.offsetHeight;e.support.selectstart="onselectstart"in c;a.removeChild(c).style.display="none"}),e.extend(e.ui,{plugin:{add:function(a,c,g){var a=e.ui[a].prototype,
f;for(f in g)a.plugins[f]=a.plugins[f]||[],a.plugins[f].push([c,g[f]])},call:function(a,c,g){if((c=a.plugins[c])&&a.element[0].parentNode)for(var f=0;f<c.length;f++)a.options[c[f][0]]&&c[f][1].apply(a.element,g)}},contains:e.contains,hasScroll:function(a,c){if("hidden"===e(a).css("overflow"))return!1;var g=c&&"left"===c?"scrollLeft":"scrollTop",f=!1;if(0<a[g])return!0;a[g]=1;f=0<a[g];a[g]=0;return f},isOverAxis:function(a,c,g){return a>c&&a<c+g},isOver:function(a,c,g,f,k,d){return e.ui.isOverAxis(a,
g,k)&&e.ui.isOverAxis(c,f,d)}}))})(m);(function(e,a){var g=Array.prototype.slice,c=e.cleanData;e.cleanData=function(a){for(var j=0,g;null!=(g=a[j]);j++)try{e(g).triggerHandler("remove")}catch(f){}c(a)};e.widget=function(a,c,l){var f=a.split(".")[0],k,a=a.split(".")[1];k=f+"-"+a;l||(l=c,c=e.Widget);e.expr[":"][k]=function(d){return!!e.data(d,a)};e[f]=e[f]||{};e[f][a]=e.extend(function(d,c){if(!this._createWidget)return new e[f][a](d,c);arguments.length&&this._createWidget(d,c)},e[f][a],{version:l.version});
var d=new c;d.options=e.widget.extend({},d.options);e.each(l,function(a,b){e.isFunction(b)&&(l[a]=function(){var a=function(a){return c.prototype[a].apply(this,g.call(arguments,1))},d=function(a,b){return c.prototype[a].apply(this,b)};return function(){var c=this._super,f=this._superApply,k;this._super=a;this._superApply=d;k=b.apply(this,arguments);this._super=c;this._superApply=f;return k}}())});e[f][a].prototype=e.widget.extend(d,{namespace:f,widgetName:a,widgetEventPrefix:a,widgetBaseClass:k},
l);e.widget.bridge(a,e[f][a])};e.widget.extend=function(b){for(var c=g.call(arguments,1),l=0,f=c.length,k,d;l<f;l++)for(k in c[l])d=c[l][k],c[l].hasOwnProperty(k)&&d!==a&&(b[k]=e.isPlainObject(d)?e.widget.extend({},b[k],d):d);return b};e.widget.bridge=function(b,c){e.fn[b]=function(l){var f="string"===typeof l,k=g.call(arguments,1),d=this,l=!f&&k.length?e.widget.extend.apply(null,[l].concat(k)):l;f?this.each(function(){var c=e.data(this,b);if(!c)return e.error("cannot call methods on "+b+" prior to initialization; attempted to call method '"+
l+"'");if(!e.isFunction(c[l])||"_"===l.charAt(0))return e.error("no such method '"+l+"' for "+b+" widget instance");var f=c[l].apply(c,k);if(f!==c&&f!==a)return d=f&&f.jquery?d.pushStack(f.get()):f,!1}):this.each(function(){var a=e.data(this,b);a?a.option(l||{})._init():c(l,this)});return d}};e.Widget=function(a,c){if(!this._createWidget)return new e[namespace][name](a,c);arguments.length&&this._createWidget(a,c)};e.Widget.prototype={widgetName:"widget",widgetEventPrefix:"",defaultElement:"<div>",
options:{disabled:!1,create:null},_createWidget:function(a,c){c=e(c||this.defaultElement||this)[0];this.element=e(c);this.options=e.widget.extend({},this.options,this._getCreateOptions(),a);this.bindings=e();this.hoverable=e();this.focusable=e();c!==this&&(e.data(c,this.widgetName,this),this._bind({remove:"destroy"}));this._create();this._trigger("create");this._init()},_getCreateOptions:e.noop,_create:e.noop,_init:e.noop,destroy:function(){this._destroy();this.element.unbind("."+this.widgetName).removeData(this.widgetName);
this.widget().unbind("."+this.widgetName).removeAttr("aria-disabled").removeClass(this.widgetBaseClass+"-disabled ui-state-disabled");this.bindings.unbind("."+this.widgetName);this.hoverable.removeClass("ui-state-hover");this.focusable.removeClass("ui-state-focus")},_destroy:e.noop,widget:function(){return this.element},option:function(b,c){var g=b,f,k,d;if(0===arguments.length)return e.widget.extend({},this.options);if("string"===typeof b)if(g={},f=b.split("."),b=f.shift(),f.length){k=g[b]=e.widget.extend({},
this.options[b]);for(d=0;d<f.length-1;d++)k[f[d]]=k[f[d]]||{},k=k[f[d]];b=f.pop();if(c===a)return k[b]===a?null:k[b];k[b]=c}else{if(c===a)return this.options[b]===a?null:this.options[b];g[b]=c}this._setOptions(g);return this},_setOptions:function(a){var c=this;e.each(a,function(a,b){c._setOption(a,b)});return this},_setOption:function(a,c){this.options[a]=c;"disabled"===a&&(this.widget().toggleClass(this.widgetBaseClass+"-disabled ui-state-disabled",!!c).attr("aria-disabled",c),this.hoverable.removeClass("ui-state-hover"),
this.focusable.removeClass("ui-state-focus"));return this},enable:function(){return this._setOption("disabled",!1)},disable:function(){return this._setOption("disabled",!0)},_bind:function(a,c){c?(a=e(a),this.bindings=this.bindings.add(a)):(c=a,a=this.element);var g=this;e.each(c,function(c,k){function d(){if(!(g.options.disabled===true||e(this).hasClass("ui-state-disabled")))return(typeof k==="string"?g[k]:k).apply(g,arguments)}var j=c.match(/^(\w+)\s*(.*)$/),o=j[1]+"."+g.widgetName;(j=j[2])?g.widget().delegate(j,
o,d):a.bind(o,d)})},_delay:function(a,c){var g=this;return setTimeout(function(){return("string"===typeof a?g[a]:a).apply(g,arguments)},c||0)},_hoverable:function(a){this.hoverable=this.hoverable.add(a);this._bind(a,{mouseenter:function(a){e(a.currentTarget).addClass("ui-state-hover")},mouseleave:function(a){e(a.currentTarget).removeClass("ui-state-hover")}})},_focusable:function(a){this.focusable=this.focusable.add(a);this._bind(a,{focusin:function(a){e(a.currentTarget).addClass("ui-state-focus")},
focusout:function(a){e(a.currentTarget).removeClass("ui-state-focus")}})},_trigger:function(a,c,g){var f=this.options[a],c=e.Event(c);c.type=(a===this.widgetEventPrefix?a:this.widgetEventPrefix+a).toLowerCase();g=g||{};if(c.originalEvent)for(var a=e.event.props.length,k;a;)k=e.event.props[--a],c[k]=c.originalEvent[k];this.element.trigger(c,g);g=e.isArray(g)?[c].concat(g):[c,g];return!(e.isFunction(f)&&!1===f.apply(this.element[0],g)||c.isDefaultPrevented())}};e.each({show:"fadeIn",hide:"fadeOut"},
function(a,c){e.Widget.prototype["_"+a]=function(g,f,k){"string"===typeof f&&(f={effect:f});var d,q=!f?a:!0===f||"number"===typeof f?c:f.effect||c,f=f||{};"number"===typeof f&&(f={duration:f});d=!e.isEmptyObject(f);f.complete=k;f.delay&&g.delay(f.delay);if(d&&e.effects&&(e.effects.effect[q]||!1!==e.uiBackCompat&&e.effects[q]))g[a](f);else if(q!==a&&g[q])g[q](f.duration,f.easing,k);else g.queue(function(d){e(this)[a]();k&&k.call(g[0]);d()})}});!1!==e.uiBackCompat&&(e.Widget.prototype._getCreateOptions=
function(){return e.metadata&&e.metadata.get(this.element[0])[this.widgetName]})})(m);(function(e){var a=!1;e(document).mouseup(function(){a=!1});e.widget("ui.mouse",{version:"1.9m6",options:{cancel:":input,option",distance:1,delay:0},_mouseInit:function(){var a=this;this.element.bind("mousedown."+this.widgetName,function(c){return a._mouseDown(c)}).bind("click."+this.widgetName,function(c){if(!0===e.data(c.target,a.widgetName+".preventClickEvent"))return e.removeData(c.target,a.widgetName+".preventClickEvent"),
c.stopImmediatePropagation(),!1});this.started=!1},_mouseDestroy:function(){this.element.unbind("."+this.widgetName)},_mouseDown:function(g){if(!a){this._mouseStarted&&this._mouseUp(g);this._mouseDownEvent=g;var c=this,b=1==g.which,j="string"==typeof this.options.cancel&&g.target.nodeName?e(g.target).closest(this.options.cancel).length:!1;if(!b||j||!this._mouseCapture(g))return!0;this.mouseDelayMet=!this.options.delay;this.mouseDelayMet||(this._mouseDelayTimer=setTimeout(function(){c.mouseDelayMet=
!0},this.options.delay));if(this._mouseDistanceMet(g)&&this._mouseDelayMet(g)&&(this._mouseStarted=!1!==this._mouseStart(g),!this._mouseStarted))return g.preventDefault(),!0;!0===e.data(g.target,this.widgetName+".preventClickEvent")&&e.removeData(g.target,this.widgetName+".preventClickEvent");this._mouseMoveDelegate=function(a){return c._mouseMove(a)};this._mouseUpDelegate=function(a){return c._mouseUp(a)};e(document).bind("mousemove."+this.widgetName,this._mouseMoveDelegate).bind("mouseup."+this.widgetName,
this._mouseUpDelegate);g.preventDefault();return a=!0}},_mouseMove:function(a){if(e.browser.msie&&!(9<=document.documentMode)&&!a.button)return this._mouseUp(a);if(this._mouseStarted)return this._mouseDrag(a),a.preventDefault();this._mouseDistanceMet(a)&&this._mouseDelayMet(a)&&((this._mouseStarted=!1!==this._mouseStart(this._mouseDownEvent,a))?this._mouseDrag(a):this._mouseUp(a));return!this._mouseStarted},_mouseUp:function(a){e(document).unbind("mousemove."+this.widgetName,this._mouseMoveDelegate).unbind("mouseup."+
this.widgetName,this._mouseUpDelegate);this._mouseStarted&&(this._mouseStarted=!1,a.target==this._mouseDownEvent.target&&e.data(a.target,this.widgetName+".preventClickEvent",!0),this._mouseStop(a));return!1},_mouseDistanceMet:function(a){return Math.max(Math.abs(this._mouseDownEvent.pageX-a.pageX),Math.abs(this._mouseDownEvent.pageY-a.pageY))>=this.options.distance},_mouseDelayMet:function(){return this.mouseDelayMet},_mouseStart:function(){},_mouseDrag:function(){},_mouseStop:function(){},_mouseCapture:function(){return!0}})})(m);
(function(e){e.widget("ui.draggable",e.ui.mouse,{version:"1.9m6",widgetEventPrefix:"drag",options:{addClasses:!0,appendTo:"parent",axis:!1,connectToSortable:!1,containment:!1,cursor:"auto",cursorAt:!1,grid:!1,handle:!1,helper:"original",iframeFix:!1,opacity:!1,refreshPositions:!1,revert:!1,revertDuration:500,scope:"default",scroll:!0,scrollSensitivity:20,scrollSpeed:20,snap:!1,snapMode:"both",snapTolerance:20,stack:!1,zIndex:!1},_create:function(){"original"==this.options.helper&&!/^(?:r|a|f)/.test(this.element.css("position"))&&
(this.element[0].style.position="relative");this.options.addClasses&&this.element.addClass("ui-draggable");this.options.disabled&&this.element.addClass("ui-draggable-disabled");this._mouseInit()},destroy:function(){if(this.element.data("draggable"))return this.element.removeData("draggable").unbind(".draggable").removeClass("ui-draggable ui-draggable-dragging ui-draggable-disabled"),this._mouseDestroy(),this},_mouseCapture:function(a){var g=this.options;if(this.helper||g.disabled||e(a.target).is(".ui-resizable-handle"))return!1;
this.handle=this._getHandle(a);if(!this.handle)return!1;e(!0===g.iframeFix?"iframe":g.iframeFix).each(function(){e('<div class="ui-draggable-iframeFix" style="background: #fff;"></div>').css({width:this.offsetWidth+"px",height:this.offsetHeight+"px",position:"absolute",opacity:"0.001",zIndex:1E3}).css(e(this).offset()).appendTo("body")});return!0},_mouseStart:function(a){var g=this.options;this.helper=this._createHelper(a);this._cacheHelperProportions();e.ui.ddmanager&&(e.ui.ddmanager.current=this);
this._cacheMargins();this.cssPosition=this.helper.css("position");this.scrollParent=this.helper.scrollParent();this.offset=this.positionAbs=this.element.offset();this.offset={top:this.offset.top-this.margins.top,left:this.offset.left-this.margins.left};e.extend(this.offset,{click:{left:a.pageX-this.offset.left,top:a.pageY-this.offset.top},parent:this._getParentOffset(),relative:this._getRelativeOffset()});this.originalPosition=this.position=this._generatePosition(a);this.originalPageX=a.pageX;this.originalPageY=
a.pageY;g.cursorAt&&this._adjustOffsetFromHelper(g.cursorAt);g.containment&&this._setContainment();if(!1===this._trigger("start",a))return this._clear(),!1;this._cacheHelperProportions();e.ui.ddmanager&&!g.dropBehaviour&&e.ui.ddmanager.prepareOffsets(this,a);this.helper.addClass("ui-draggable-dragging");this._mouseDrag(a,!0);e.ui.ddmanager&&e.ui.ddmanager.dragStart(this,a);return!0},_mouseDrag:function(a,g){this.position=this._generatePosition(a);this.positionAbs=this._convertPositionTo("absolute");
if(!g){var c=this._uiHash();if(!1===this._trigger("drag",a,c))return this._mouseUp({}),!1;this.position=c.position}if(!this.options.axis||"y"!=this.options.axis)this.helper[0].style.left=this.position.left+"px";if(!this.options.axis||"x"!=this.options.axis)this.helper[0].style.top=this.position.top+"px";e.ui.ddmanager&&e.ui.ddmanager.drag(this,a);return!1},_mouseStop:function(a){var g=!1;e.ui.ddmanager&&!this.options.dropBehaviour&&(g=e.ui.ddmanager.drop(this,a));this.dropped&&(g=this.dropped,this.dropped=
!1);if(!this.element[0]||!this.element[0].parentNode)return!1;if("invalid"==this.options.revert&&!g||"valid"==this.options.revert&&g||!0===this.options.revert||e.isFunction(this.options.revert)&&this.options.revert.call(this.element,g)){var c=this;e(this.helper).animate(this.originalPosition,parseInt(this.options.revertDuration,10),function(){c._trigger("stop",a)!==false&&c._clear()})}else!1!==this._trigger("stop",a)&&this._clear();return!1},_mouseUp:function(a){!0===this.options.iframeFix&&e("div.ui-draggable-iframeFix").each(function(){this.parentNode.removeChild(this)});
e.ui.ddmanager&&e.ui.ddmanager.dragStop(this,a);return e.ui.mouse.prototype._mouseUp.call(this,a)},cancel:function(){this.helper.is(".ui-draggable-dragging")?this._mouseUp({}):this._clear();return this},_getHandle:function(a){var g=!this.options.handle||!e(this.options.handle,this.element).length?!0:!1;e(this.options.handle,this.element).find("*").andSelf().each(function(){this==a.target&&(g=!0)});return g},_createHelper:function(a){var g=this.options,a=e.isFunction(g.helper)?e(g.helper.apply(this.element[0],
[a])):"clone"==g.helper?this.element.clone().removeAttr("id"):this.element;a.parents("body").length||a.appendTo("parent"==g.appendTo?this.element[0].parentNode:g.appendTo);a[0]!=this.element[0]&&!/(fixed|absolute)/.test(a.css("position"))&&a.css("position","absolute");return a},_adjustOffsetFromHelper:function(a){"string"==typeof a&&(a=a.split(" "));e.isArray(a)&&(a={left:+a[0],top:+a[1]||0});"left"in a&&(this.offset.click.left=a.left+this.margins.left);"right"in a&&(this.offset.click.left=this.helperProportions.width-
a.right+this.margins.left);"top"in a&&(this.offset.click.top=a.top+this.margins.top);"bottom"in a&&(this.offset.click.top=this.helperProportions.height-a.bottom+this.margins.top)},_getParentOffset:function(){this.offsetParent=this.helper.offsetParent();var a=this.offsetParent.offset();"absolute"==this.cssPosition&&(this.scrollParent[0]!=document&&e.contains(this.scrollParent[0],this.offsetParent[0]))&&(a.left+=this.scrollParent.scrollLeft(),a.top+=this.scrollParent.scrollTop());if(this.offsetParent[0]==
document.body||this.offsetParent[0].tagName&&"html"==this.offsetParent[0].tagName.toLowerCase()&&e.browser.msie)a={top:0,left:0};return{top:a.top+(parseInt(this.offsetParent.css("borderTopWidth"),10)||0),left:a.left+(parseInt(this.offsetParent.css("borderLeftWidth"),10)||0)}},_getRelativeOffset:function(){if("relative"==this.cssPosition){var a=this.element.position();return{top:a.top-(parseInt(this.helper.css("top"),10)||0)+this.scrollParent.scrollTop(),left:a.left-(parseInt(this.helper.css("left"),
10)||0)+this.scrollParent.scrollLeft()}}return{top:0,left:0}},_cacheMargins:function(){this.margins={left:parseInt(this.element.css("marginLeft"),10)||0,top:parseInt(this.element.css("marginTop"),10)||0,right:parseInt(this.element.css("marginRight"),10)||0,bottom:parseInt(this.element.css("marginBottom"),10)||0}},_cacheHelperProportions:function(){this.helperProportions={width:this.helper.outerWidth(),height:this.helper.outerHeight()}},_setContainment:function(){var a=this.options;"parent"==a.containment&&
(a.containment=this.helper[0].parentNode);if("document"==a.containment||"window"==a.containment)this.containment=["document"==a.containment?0:e(window).scrollLeft()-this.offset.relative.left-this.offset.parent.left,"document"==a.containment?0:e(window).scrollTop()-this.offset.relative.top-this.offset.parent.top,("document"==a.containment?0:e(window).scrollLeft())+e("document"==a.containment?document:window).width()-this.helperProportions.width-this.margins.left,("document"==a.containment?0:e(window).scrollTop())+
(e("document"==a.containment?document:window).height()||document.body.parentNode.scrollHeight)-this.helperProportions.height-this.margins.top];if(!/^(document|window|parent)$/.test(a.containment)&&a.containment.constructor!=Array){var a=e(a.containment),g=a[0];if(g){a.offset();var c="hidden"!=e(g).css("overflow");this.containment=[(parseInt(e(g).css("borderLeftWidth"),10)||0)+(parseInt(e(g).css("paddingLeft"),10)||0),(parseInt(e(g).css("borderTopWidth"),10)||0)+(parseInt(e(g).css("paddingTop"),10)||
0),(c?Math.max(g.scrollWidth,g.offsetWidth):g.offsetWidth)-(parseInt(e(g).css("borderLeftWidth"),10)||0)-(parseInt(e(g).css("paddingRight"),10)||0)-this.helperProportions.width-this.margins.left-this.margins.right,(c?Math.max(g.scrollHeight,g.offsetHeight):g.offsetHeight)-(parseInt(e(g).css("borderTopWidth"),10)||0)-(parseInt(e(g).css("paddingBottom"),10)||0)-this.helperProportions.height-this.margins.top-this.margins.bottom];this.relative_container=a}}else a.containment.constructor==Array&&(this.containment=
a.containment)},_convertPositionTo:function(a,g){g||(g=this.position);var c="absolute"==a?1:-1,b="absolute"==this.cssPosition&&!(this.scrollParent[0]!=document&&e.contains(this.scrollParent[0],this.offsetParent[0]))?this.offsetParent:this.scrollParent,j=/(html|body)/i.test(b[0].tagName);return{top:g.top+this.offset.relative.top*c+this.offset.parent.top*c-(e.browser.safari&&526>e.browser.version&&"fixed"==this.cssPosition?0:("fixed"==this.cssPosition?-this.scrollParent.scrollTop():j?0:b.scrollTop())*
c),left:g.left+this.offset.relative.left*c+this.offset.parent.left*c-(e.browser.safari&&526>e.browser.version&&"fixed"==this.cssPosition?0:("fixed"==this.cssPosition?-this.scrollParent.scrollLeft():j?0:b.scrollLeft())*c)}},_generatePosition:function(a){var g=this.options,c="absolute"==this.cssPosition&&!(this.scrollParent[0]!=document&&e.contains(this.scrollParent[0],this.offsetParent[0]))?this.offsetParent:this.scrollParent,b=/(html|body)/i.test(c[0].tagName),j=a.pageX,l=a.pageY;if(this.originalPosition){var f;
this.containment&&(this.relative_container?(f=this.relative_container.offset(),f=[this.containment[0]+f.left,this.containment[1]+f.top,this.containment[2]+f.left,this.containment[3]+f.top]):f=this.containment,a.pageX-this.offset.click.left<f[0]&&(j=f[0]+this.offset.click.left),a.pageY-this.offset.click.top<f[1]&&(l=f[1]+this.offset.click.top),a.pageX-this.offset.click.left>f[2]&&(j=f[2]+this.offset.click.left),a.pageY-this.offset.click.top>f[3]&&(l=f[3]+this.offset.click.top));g.grid&&(l=g.grid[1]?
this.originalPageY+Math.round((l-this.originalPageY)/g.grid[1])*g.grid[1]:this.originalPageY,l=f?!(l-this.offset.click.top<f[1]||l-this.offset.click.top>f[3])?l:!(l-this.offset.click.top<f[1])?l-g.grid[1]:l+g.grid[1]:l,j=g.grid[0]?this.originalPageX+Math.round((j-this.originalPageX)/g.grid[0])*g.grid[0]:this.originalPageX,j=f?!(j-this.offset.click.left<f[0]||j-this.offset.click.left>f[2])?j:!(j-this.offset.click.left<f[0])?j-g.grid[0]:j+g.grid[0]:j)}return{top:l-this.offset.click.top-this.offset.relative.top-
this.offset.parent.top+(e.browser.safari&&526>e.browser.version&&"fixed"==this.cssPosition?0:"fixed"==this.cssPosition?-this.scrollParent.scrollTop():b?0:c.scrollTop()),left:j-this.offset.click.left-this.offset.relative.left-this.offset.parent.left+(e.browser.safari&&526>e.browser.version&&"fixed"==this.cssPosition?0:"fixed"==this.cssPosition?-this.scrollParent.scrollLeft():b?0:c.scrollLeft())}},_clear:function(){this.helper.removeClass("ui-draggable-dragging");this.helper[0]!=this.element[0]&&!this.cancelHelperRemoval&&
this.helper.remove();this.helper=null;this.cancelHelperRemoval=!1},_trigger:function(a,g,c){c=c||this._uiHash();e.ui.plugin.call(this,a,[g,c]);"drag"==a&&(this.positionAbs=this._convertPositionTo("absolute"));return e.Widget.prototype._trigger.call(this,a,g,c)},plugins:{},_uiHash:function(){return{helper:this.helper,position:this.position,originalPosition:this.originalPosition,offset:this.positionAbs}}});e.ui.plugin.add("draggable","connectToSortable",{start:function(a,g){var c=e(this).data("draggable"),
b=c.options,j=e.extend({},g,{item:c.element});c.sortables=[];e(b.connectToSortable).each(function(){var b=e.data(this,"sortable");b&&!b.options.disabled&&(c.sortables.push({instance:b,shouldRevert:b.options.revert}),b.refreshPositions(),b._trigger("activate",a,j))})},stop:function(a,g){var c=e(this).data("draggable"),b=e.extend({},g,{item:c.element});e.each(c.sortables,function(){this.instance.isOver?(this.instance.isOver=0,c.cancelHelperRemoval=!0,this.instance.cancelHelperRemoval=!1,this.shouldRevert&&
(this.instance.options.revert=!0),this.instance._mouseStop(a),this.instance.options.helper=this.instance.options._helper,"original"==c.options.helper&&this.instance.currentItem.css({top:"auto",left:"auto"})):(this.instance.cancelHelperRemoval=!1,this.instance._trigger("deactivate",a,b))})},drag:function(a,g){var c=e(this).data("draggable"),b=this;e.each(c.sortables,function(){this.instance.positionAbs=c.positionAbs;this.instance.helperProportions=c.helperProportions;this.instance.offset.click=c.offset.click;
this.instance._intersectsWith(this.instance.containerCache)?(this.instance.isOver||(this.instance.isOver=1,this.instance.currentItem=e(b).clone().removeAttr("id").appendTo(this.instance.element).data("sortable-item",!0),this.instance.options._helper=this.instance.options.helper,this.instance.options.helper=function(){return g.helper[0]},a.target=this.instance.currentItem[0],this.instance._mouseCapture(a,!0),this.instance._mouseStart(a,!0,!0),this.instance.offset.click.top=c.offset.click.top,this.instance.offset.click.left=
c.offset.click.left,this.instance.offset.parent.left-=c.offset.parent.left-this.instance.offset.parent.left,this.instance.offset.parent.top-=c.offset.parent.top-this.instance.offset.parent.top,c._trigger("toSortable",a),c.dropped=this.instance.element,c.currentItem=c.element,this.instance.fromOutside=c),this.instance.currentItem&&this.instance._mouseDrag(a)):this.instance.isOver&&(this.instance.isOver=0,this.instance.cancelHelperRemoval=!0,this.instance.options.revert=!1,this.instance._trigger("out",
a,this.instance._uiHash(this.instance)),this.instance._mouseStop(a,!0),this.instance.options.helper=this.instance.options._helper,this.instance.currentItem.remove(),this.instance.placeholder&&this.instance.placeholder.remove(),c._trigger("fromSortable",a),c.dropped=!1)})}});e.ui.plugin.add("draggable","cursor",{start:function(){var a=e("body"),g=e(this).data("draggable").options;a.css("cursor")&&(g._cursor=a.css("cursor"));a.css("cursor",g.cursor)},stop:function(){var a=e(this).data("draggable").options;
a._cursor&&e("body").css("cursor",a._cursor)}});e.ui.plugin.add("draggable","opacity",{start:function(a,g){var c=e(g.helper),b=e(this).data("draggable").options;c.css("opacity")&&(b._opacity=c.css("opacity"));c.css("opacity",b.opacity)},stop:function(a,g){var c=e(this).data("draggable").options;c._opacity&&e(g.helper).css("opacity",c._opacity)}});e.ui.plugin.add("draggable","scroll",{start:function(){var a=e(this).data("draggable");a.scrollParent[0]!=document&&"HTML"!=a.scrollParent[0].tagName&&(a.overflowOffset=
a.scrollParent.offset())},drag:function(a){var g=e(this).data("draggable"),c=g.options,b=!1;if(g.scrollParent[0]!=document&&"HTML"!=g.scrollParent[0].tagName){if(!c.axis||"x"!=c.axis)g.overflowOffset.top+g.scrollParent[0].offsetHeight-a.pageY<c.scrollSensitivity?g.scrollParent[0].scrollTop=b=g.scrollParent[0].scrollTop+c.scrollSpeed:a.pageY-g.overflowOffset.top<c.scrollSensitivity&&(g.scrollParent[0].scrollTop=b=g.scrollParent[0].scrollTop-c.scrollSpeed);if(!c.axis||"y"!=c.axis)g.overflowOffset.left+
g.scrollParent[0].offsetWidth-a.pageX<c.scrollSensitivity?g.scrollParent[0].scrollLeft=b=g.scrollParent[0].scrollLeft+c.scrollSpeed:a.pageX-g.overflowOffset.left<c.scrollSensitivity&&(g.scrollParent[0].scrollLeft=b=g.scrollParent[0].scrollLeft-c.scrollSpeed)}else{if(!c.axis||"x"!=c.axis)a.pageY-e(document).scrollTop()<c.scrollSensitivity?b=e(document).scrollTop(e(document).scrollTop()-c.scrollSpeed):e(window).height()-(a.pageY-e(document).scrollTop())<c.scrollSensitivity&&(b=e(document).scrollTop(e(document).scrollTop()+
c.scrollSpeed));if(!c.axis||"y"!=c.axis)a.pageX-e(document).scrollLeft()<c.scrollSensitivity?b=e(document).scrollLeft(e(document).scrollLeft()-c.scrollSpeed):e(window).width()-(a.pageX-e(document).scrollLeft())<c.scrollSensitivity&&(b=e(document).scrollLeft(e(document).scrollLeft()+c.scrollSpeed))}!1!==b&&(e.ui.ddmanager&&!c.dropBehaviour)&&e.ui.ddmanager.prepareOffsets(g,a)}});e.ui.plugin.add("draggable","snap",{start:function(){var a=e(this).data("draggable"),g=a.options;a.snapElements=[];e(g.snap.constructor!=
String?g.snap.items||":data(draggable)":g.snap).each(function(){var c=e(this),b=c.offset();this!=a.element[0]&&a.snapElements.push({item:this,width:c.outerWidth(),height:c.outerHeight(),top:b.top,left:b.left})})},drag:function(a,g){for(var c=e(this).data("draggable"),b=c.options,j=b.snapTolerance,l=g.offset.left,f=l+c.helperProportions.width,k=g.offset.top,d=k+c.helperProportions.height,q=c.snapElements.length-1;0<=q;q--){var o=c.snapElements[q].left,r=o+c.snapElements[q].width,p=c.snapElements[q].top,
u=p+c.snapElements[q].height;if(o-j<l&&l<r+j&&p-j<k&&k<u+j||o-j<l&&l<r+j&&p-j<d&&d<u+j||o-j<f&&f<r+j&&p-j<k&&k<u+j||o-j<f&&f<r+j&&p-j<d&&d<u+j){if("inner"!=b.snapMode){var t=Math.abs(p-d)<=j,m=Math.abs(u-k)<=j,z=Math.abs(o-f)<=j,x=Math.abs(r-l)<=j;t&&(g.position.top=c._convertPositionTo("relative",{top:p-c.helperProportions.height,left:0}).top-c.margins.top);m&&(g.position.top=c._convertPositionTo("relative",{top:u,left:0}).top-c.margins.top);z&&(g.position.left=c._convertPositionTo("relative",{top:0,
left:o-c.helperProportions.width}).left-c.margins.left);x&&(g.position.left=c._convertPositionTo("relative",{top:0,left:r}).left-c.margins.left)}var v=t||m||z||x;if("outer"!=b.snapMode&&(t=Math.abs(p-k)<=j,m=Math.abs(u-d)<=j,z=Math.abs(o-l)<=j,x=Math.abs(r-f)<=j,t&&(g.position.top=c._convertPositionTo("relative",{top:p,left:0}).top-c.margins.top),m&&(g.position.top=c._convertPositionTo("relative",{top:u-c.helperProportions.height,left:0}).top-c.margins.top),z&&(g.position.left=c._convertPositionTo("relative",
{top:0,left:o}).left-c.margins.left),x))g.position.left=c._convertPositionTo("relative",{top:0,left:r-c.helperProportions.width}).left-c.margins.left;!c.snapElements[q].snapping&&(t||m||z||x||v)&&c.options.snap.snap&&c.options.snap.snap.call(c.element,a,e.extend(c._uiHash(),{snapItem:c.snapElements[q].item}));c.snapElements[q].snapping=t||m||z||x||v}else c.snapElements[q].snapping&&c.options.snap.release&&c.options.snap.release.call(c.element,a,e.extend(c._uiHash(),{snapItem:c.snapElements[q].item})),
c.snapElements[q].snapping=!1}}});e.ui.plugin.add("draggable","stack",{start:function(){var a=e(this).data("draggable").options,a=e.makeArray(e(a.stack)).sort(function(a,b){return(parseInt(e(a).css("zIndex"),10)||0)-(parseInt(e(b).css("zIndex"),10)||0)});if(a.length){var g=parseInt(a[0].style.zIndex)||0;e(a).each(function(a){this.style.zIndex=g+a});this[0].style.zIndex=g+a.length}}});e.ui.plugin.add("draggable","zIndex",{start:function(a,g){var c=e(g.helper),b=e(this).data("draggable").options;c.css("zIndex")&&
(b._zIndex=c.css("zIndex"));c.css("zIndex",b.zIndex)},stop:function(a,g){var c=e(this).data("draggable").options;c._zIndex&&e(g.helper).css("zIndex",c._zIndex)}})})(m);(function(e){e.widget("ui.droppable",{version:"1.9m6",widgetEventPrefix:"drop",options:{accept:"*",activeClass:!1,addClasses:!0,greedy:!1,hoverClass:!1,scope:"default",tolerance:"intersect"},_create:function(){var a=this.options,g=a.accept;this.isover=0;this.isout=1;this.accept=e.isFunction(g)?g:function(a){return a.is(g)};this.proportions=
{width:this.element[0].offsetWidth,height:this.element[0].offsetHeight};e.ui.ddmanager.droppables[a.scope]=e.ui.ddmanager.droppables[a.scope]||[];e.ui.ddmanager.droppables[a.scope].push(this);a.addClasses&&this.element.addClass("ui-droppable")},destroy:function(){for(var a=e.ui.ddmanager.droppables[this.options.scope],g=0;g<a.length;g++)a[g]==this&&a.splice(g,1);this.element.removeClass("ui-droppable ui-droppable-disabled").removeData("droppable").unbind(".droppable");return this},_setOption:function(a,
g){"accept"==a&&(this.accept=e.isFunction(g)?g:function(a){return a.is(g)});e.Widget.prototype._setOption.apply(this,arguments)},_activate:function(a){var g=e.ui.ddmanager.current;this.options.activeClass&&this.element.addClass(this.options.activeClass);g&&this._trigger("activate",a,this.ui(g))},_deactivate:function(a){var g=e.ui.ddmanager.current;this.options.activeClass&&this.element.removeClass(this.options.activeClass);g&&this._trigger("deactivate",a,this.ui(g))},_over:function(a){var g=e.ui.ddmanager.current;
if(g&&(g.currentItem||g.element)[0]!=this.element[0])if(this.accept.call(this.element[0],g.currentItem||g.element))this.options.hoverClass&&this.element.addClass(this.options.hoverClass),this._trigger("over",a,this.ui(g))},_out:function(a){var g=e.ui.ddmanager.current;if(g&&(g.currentItem||g.element)[0]!=this.element[0])if(this.accept.call(this.element[0],g.currentItem||g.element))this.options.hoverClass&&this.element.removeClass(this.options.hoverClass),this._trigger("out",a,this.ui(g))},_drop:function(a,
g){var c=g||e.ui.ddmanager.current;if(!c||(c.currentItem||c.element)[0]==this.element[0])return!1;var b=!1;this.element.find(":data(droppable)").not(".ui-draggable-dragging").each(function(){var a=e.data(this,"droppable");if(a.options.greedy&&!a.options.disabled&&a.options.scope==c.options.scope&&a.accept.call(a.element[0],c.currentItem||c.element)&&e.ui.intersect(c,e.extend(a,{offset:a.element.offset()}),a.options.tolerance))return b=!0,!1});return b?!1:this.accept.call(this.element[0],c.currentItem||
c.element)?(this.options.activeClass&&this.element.removeClass(this.options.activeClass),this.options.hoverClass&&this.element.removeClass(this.options.hoverClass),this._trigger("drop",a,this.ui(c)),this.element):!1},ui:function(a){return{draggable:a.currentItem||a.element,helper:a.helper,position:a.position,offset:a.positionAbs}}});e.ui.intersect=function(a,g,c){if(!g.offset)return!1;var b=(a.positionAbs||a.position.absolute).left,j=b+a.helperProportions.width,l=(a.positionAbs||a.position.absolute).top,
f=l+a.helperProportions.height,k=g.offset.left,d=k+g.proportions.width,q=g.offset.top,o=q+g.proportions.height;switch(c){case "fit":return k<=b&&j<=d&&q<=l&&f<=o;case "intersect":return k<b+a.helperProportions.width/2&&j-a.helperProportions.width/2<d&&q<l+a.helperProportions.height/2&&f-a.helperProportions.height/2<o;case "pointer":return e.ui.isOver((a.positionAbs||a.position.absolute).top+(a.clickOffset||a.offset.click).top,(a.positionAbs||a.position.absolute).left+(a.clickOffset||a.offset.click).left,
q,k,g.proportions.height,g.proportions.width);case "touch":return(l>=q&&l<=o||f>=q&&f<=o||l<q&&f>o)&&(b>=k&&b<=d||j>=k&&j<=d||b<k&&j>d);default:return!1}};e.ui.ddmanager={current:null,droppables:{"default":[]},prepareOffsets:function(a,g){var c=e.ui.ddmanager.droppables[a.options.scope]||[],b=g?g.type:null,j=(a.currentItem||a.element).find(":data(droppable)").andSelf(),l=0;a:for(;l<c.length;l++)if(!(c[l].options.disabled||a&&!c[l].accept.call(c[l].element[0],a.currentItem||a.element))){for(var f=
0;f<j.length;f++)if(j[f]==c[l].element[0]){c[l].proportions.height=0;continue a}c[l].visible="none"!=c[l].element.css("display");c[l].visible&&("mousedown"==b&&c[l]._activate.call(c[l],g),c[l].offset=c[l].element.offset(),c[l].proportions={width:c[l].element[0].offsetWidth,height:c[l].element[0].offsetHeight})}},drop:function(a,g){var c=!1;e.each(e.ui.ddmanager.droppables[a.options.scope]||[],function(){if(this.options&&(!this.options.disabled&&(this.visible&&e.ui.intersect(a,this,this.options.tolerance))&&
(c=c||this._drop.call(this,g)),!this.options.disabled&&this.visible&&this.accept.call(this.element[0],a.currentItem||a.element)))this.isout=1,this.isover=0,this._deactivate.call(this,g)});return c},dragStart:function(a,g){a.element.parentsUntil("body").bind("scroll.droppable",function(){a.options.refreshPositions||e.ui.ddmanager.prepareOffsets(a,g)})},drag:function(a,g){a.options.refreshPositions&&e.ui.ddmanager.prepareOffsets(a,g);e.each(e.ui.ddmanager.droppables[a.options.scope]||[],function(){if(!this.options.disabled&&
!this.greedyChild&&this.visible){var c=e.ui.intersect(a,this,this.options.tolerance);if(c=!c&&1==this.isover?"isout":c&&0==this.isover?"isover":null){var b;if(this.options.greedy){var j=this.element.parents(":data(droppable):eq(0)");j.length&&(b=e.data(j[0],"droppable"),b.greedyChild="isover"==c?1:0)}b&&"isover"==c&&(b.isover=0,b.isout=1,b._out.call(b,g));this[c]=1;this["isout"==c?"isover":"isout"]=0;this["isover"==c?"_over":"_out"].call(this,g);b&&"isout"==c&&(b.isout=0,b.isover=1,b._over.call(b,
g))}}})},dragStop:function(a,g){a.element.parentsUntil("body").unbind("scroll.droppable");a.options.refreshPositions||e.ui.ddmanager.prepareOffsets(a,g)}}})(m);(function(e){e.widget("ui.resizable",e.ui.mouse,{version:"1.9m6",widgetEventPrefix:"resize",options:{alsoResize:!1,animate:!1,animateDuration:"slow",animateEasing:"swing",aspectRatio:!1,autoHide:!1,containment:!1,ghost:!1,grid:!1,handles:"e,s,se",helper:!1,maxHeight:null,maxWidth:null,minHeight:10,minWidth:10,zIndex:1E3},_create:function(){var a=
this,b=this.options;this.element.addClass("ui-resizable");e.extend(this,{_aspectRatio:!!b.aspectRatio,aspectRatio:b.aspectRatio,originalElement:this.element,_proportionallyResizeElements:[],_helper:b.helper||b.ghost||b.animate?b.helper||"ui-resizable-helper":null});this.element[0].nodeName.match(/canvas|textarea|input|select|button|img/i)&&(/relative/.test(this.element.css("position"))&&e.browser.opera&&this.element.css({position:"relative",top:"auto",left:"auto"}),this.element.wrap(e('<div class="ui-wrapper" style="overflow: hidden;"></div>').css({position:this.element.css("position"),
width:this.element.outerWidth(),height:this.element.outerHeight(),top:this.element.css("top"),left:this.element.css("left")})),this.element=this.element.parent().data("resizable",this.element.data("resizable")),this.elementIsWrapper=!0,this.element.css({marginLeft:this.originalElement.css("marginLeft"),marginTop:this.originalElement.css("marginTop"),marginRight:this.originalElement.css("marginRight"),marginBottom:this.originalElement.css("marginBottom")}),this.originalElement.css({marginLeft:0,marginTop:0,
marginRight:0,marginBottom:0}),this.originalResizeStyle=this.originalElement.css("resize"),this.originalElement.css("resize","none"),this._proportionallyResizeElements.push(this.originalElement.css({position:"static",zoom:1,display:"block"})),this.originalElement.css({margin:this.originalElement.css("margin")}),this._proportionallyResize());this.handles=b.handles||(!e(".ui-resizable-handle",this.element).length?"e,s,se":{n:".ui-resizable-n",e:".ui-resizable-e",s:".ui-resizable-s",w:".ui-resizable-w",
se:".ui-resizable-se",sw:".ui-resizable-sw",ne:".ui-resizable-ne",nw:".ui-resizable-nw"});if(this.handles.constructor==String){"all"==this.handles&&(this.handles="n,e,s,w,se,sw,ne,nw");var j=this.handles.split(",");this.handles={};for(var g=0;g<j.length;g++){var f=e.trim(j[g]),k=e('<div class="ui-resizable-handle ui-resizable-'+f+'"></div>');/sw|se|ne|nw/.test(f)&&k.css({zIndex:++b.zIndex});"se"==f&&k.addClass("ui-icon ui-icon-gripsmall-diagonal-se");this.handles[f]=".ui-resizable-"+f;this.element.append(k)}}this._renderAxis=
function(a){var a=a||this.element,b;for(b in this.handles){this.handles[b].constructor==String&&(this.handles[b]=e(this.handles[b],this.element).show());if(this.elementIsWrapper&&this.originalElement[0].nodeName.match(/textarea|input|select|button/i)){var c=e(this.handles[b],this.element),f=0,f=/sw|ne|nw|se|n|s/.test(b)?c.outerHeight():c.outerWidth(),c=["padding",/ne|nw|n/.test(b)?"Top":/se|sw|s/.test(b)?"Bottom":/^e$/.test(b)?"Right":"Left"].join("");a.css(c,f);this._proportionallyResize()}e(this.handles[b])}};
this._renderAxis(this.element);this._handles=e(".ui-resizable-handle",this.element).disableSelection();this._handles.mouseover(function(){if(!a.resizing){if(this.className)var b=this.className.match(/ui-resizable-(se|sw|ne|nw|n|e|s|w)/i);a.axis=b&&b[1]?b[1]:"se"}});b.autoHide&&(this._handles.hide(),e(this.element).addClass("ui-resizable-autohide").hover(function(){if(!b.disabled){e(this).removeClass("ui-resizable-autohide");a._handles.show()}},function(){if(!b.disabled&&!a.resizing){e(this).addClass("ui-resizable-autohide");
a._handles.hide()}}));this._mouseInit()},destroy:function(){this._mouseDestroy();var a=function(a){e(a).removeClass("ui-resizable ui-resizable-disabled ui-resizable-resizing").removeData("resizable").unbind(".resizable").find(".ui-resizable-handle").remove()};if(this.elementIsWrapper){a(this.element);var b=this.element;b.after(this.originalElement.css({position:b.css("position"),width:b.outerWidth(),height:b.outerHeight(),top:b.css("top"),left:b.css("left")})).remove()}this.originalElement.css("resize",
this.originalResizeStyle);a(this.originalElement);return this},_mouseCapture:function(a){var b=!1,j;for(j in this.handles)e(this.handles[j])[0]==a.target&&(b=!0);return!this.options.disabled&&b},_mouseStart:function(c){var b=this.options,j=this.element.position(),g=this.element;this.resizing=!0;this.documentScroll={top:e(document).scrollTop(),left:e(document).scrollLeft()};(g.is(".ui-draggable")||/absolute/.test(g.css("position")))&&g.css({position:"absolute",top:j.top,left:j.left});e.browser.opera&&
/relative/.test(g.css("position"))&&g.css({position:"relative",top:"auto",left:"auto"});this._renderProxy();var j=a(this.helper.css("left")),f=a(this.helper.css("top"));b.containment&&(j+=e(b.containment).scrollLeft()||0,f+=e(b.containment).scrollTop()||0);this.offset=this.helper.offset();this.position={left:j,top:f};this.size=this._helper?{width:g.outerWidth(),height:g.outerHeight()}:{width:g.width(),height:g.height()};this.originalSize=this._helper?{width:g.outerWidth(),height:g.outerHeight()}:
{width:g.width(),height:g.height()};this.originalPosition={left:j,top:f};this.sizeDiff={width:g.outerWidth()-g.width(),height:g.outerHeight()-g.height()};this.originalMousePosition={left:c.pageX,top:c.pageY};this.aspectRatio="number"==typeof b.aspectRatio?b.aspectRatio:this.originalSize.width/this.originalSize.height||1;b=e(".ui-resizable-"+this.axis).css("cursor");e("body").css("cursor","auto"==b?this.axis+"-resize":b);g.addClass("ui-resizable-resizing");this._propagate("start",c);return!0},_mouseDrag:function(a){var b=
this.helper,j=this.originalMousePosition,g=this._change[this.axis];if(!g)return!1;j=g.apply(this,[a,a.pageX-j.left||0,a.pageY-j.top||0]);this._updateVirtualBoundaries(a.shiftKey);if(this._aspectRatio||a.shiftKey)j=this._updateRatio(j,a);j=this._respectSize(j,a);this._propagate("resize",a);b.css({top:this.position.top+"px",left:this.position.left+"px",width:this.size.width+"px",height:this.size.height+"px"});!this._helper&&this._proportionallyResizeElements.length&&this._proportionallyResize();this._updateCache(j);
this._trigger("resize",a,this.ui());return!1},_mouseStop:function(a){this.resizing=!1;var b=this.options;if(this._helper){var j=this._proportionallyResizeElements,g=j.length&&/textarea/i.test(j[0].nodeName),j=g&&e.ui.hasScroll(j[0],"left")?0:this.sizeDiff.height,g=g?0:this.sizeDiff.width,g={width:this.helper.width()-g,height:this.helper.height()-j},j=parseInt(this.element.css("left"),10)+(this.position.left-this.originalPosition.left)||null,f=parseInt(this.element.css("top"),10)+(this.position.top-
this.originalPosition.top)||null;b.animate||this.element.css(e.extend(g,{top:f,left:j}));this.helper.height(this.size.height);this.helper.width(this.size.width);this._helper&&!b.animate&&this._proportionallyResize()}e("body").css("cursor","auto");this.element.removeClass("ui-resizable-resizing");this._propagate("stop",a);this._helper&&this.helper.remove();return!1},_updateVirtualBoundaries:function(a){var b=this.options,j,e,f,b={minWidth:g(b.minWidth)?b.minWidth:0,maxWidth:g(b.maxWidth)?b.maxWidth:
Infinity,minHeight:g(b.minHeight)?b.minHeight:0,maxHeight:g(b.maxHeight)?b.maxHeight:Infinity};if(this._aspectRatio||a)if(a=b.minHeight*this.aspectRatio,e=b.minWidth/this.aspectRatio,j=b.maxHeight*this.aspectRatio,f=b.maxWidth/this.aspectRatio,a>b.minWidth&&(b.minWidth=a),e>b.minHeight&&(b.minHeight=e),j<b.maxWidth&&(b.maxWidth=j),f<b.maxHeight)b.maxHeight=f;this._vBoundaries=b},_updateCache:function(a){this.offset=this.helper.offset();g(a.left)&&(this.position.left=a.left);g(a.top)&&(this.position.top=
a.top);g(a.height)&&(this.size.height=a.height);g(a.width)&&(this.size.width=a.width)},_updateRatio:function(a){var b=this.position,j=this.size,e=this.axis;g(a.height)?a.width=a.height*this.aspectRatio:g(a.width)&&(a.height=a.width/this.aspectRatio);"sw"==e&&(a.left=b.left+(j.width-a.width),a.top=null);"nw"==e&&(a.top=b.top+(j.height-a.height),a.left=b.left+(j.width-a.width));return a},_respectSize:function(a){var b=this._vBoundaries,j=this.axis,e=g(a.width)&&b.maxWidth&&b.maxWidth<a.width,f=g(a.height)&&
b.maxHeight&&b.maxHeight<a.height,k=g(a.width)&&b.minWidth&&b.minWidth>a.width,d=g(a.height)&&b.minHeight&&b.minHeight>a.height;k&&(a.width=b.minWidth);d&&(a.height=b.minHeight);e&&(a.width=b.maxWidth);f&&(a.height=b.maxHeight);var q=this.originalPosition.left+this.originalSize.width,o=this.position.top+this.size.height,r=/sw|nw|w/.test(j),j=/nw|ne|n/.test(j);k&&r&&(a.left=q-b.minWidth);e&&r&&(a.left=q-b.maxWidth);d&&j&&(a.top=o-b.minHeight);f&&j&&(a.top=o-b.maxHeight);(b=!a.width&&!a.height)&&!a.left&&
a.top?a.top=null:b&&(!a.top&&a.left)&&(a.left=null);return a},_proportionallyResize:function(){if(this._proportionallyResizeElements.length)for(var a=this.helper||this.element,b=0;b<this._proportionallyResizeElements.length;b++){var j=this._proportionallyResizeElements[b];if(!this.borderDif){var g=[j.css("borderTopWidth"),j.css("borderRightWidth"),j.css("borderBottomWidth"),j.css("borderLeftWidth")],f=[j.css("paddingTop"),j.css("paddingRight"),j.css("paddingBottom"),j.css("paddingLeft")];this.borderDif=
e.map(g,function(a,b){var c=parseInt(a,10)||0,j=parseInt(f[b],10)||0;return c+j})}if(!e.browser.msie||!e(a).is(":hidden")&&!e(a).parents(":hidden").length)j.css({height:a.height()-this.borderDif[0]-this.borderDif[2]||0,width:a.width()-this.borderDif[1]-this.borderDif[3]||0})}},_renderProxy:function(){var a=this.options;this.elementOffset=this.element.offset();if(this._helper){this.helper=this.helper||e('<div style="overflow:hidden;"></div>');var b=e.browser.msie&&7>e.browser.version,j=b?1:0,b=b?2:
-1;this.helper.addClass(this._helper).css({width:this.element.outerWidth()+b,height:this.element.outerHeight()+b,position:"absolute",left:this.elementOffset.left-j+"px",top:this.elementOffset.top-j+"px",zIndex:++a.zIndex});this.helper.appendTo("body").disableSelection()}else this.helper=this.element},_change:{e:function(a,b){return{width:this.originalSize.width+b}},w:function(a,b){return{left:this.originalPosition.left+b,width:this.originalSize.width-b}},n:function(a,b,j){return{top:this.originalPosition.top+
j,height:this.originalSize.height-j}},s:function(a,b,j){return{height:this.originalSize.height+j}},se:function(a,b,j){return e.extend(this._change.s.apply(this,arguments),this._change.e.apply(this,[a,b,j]))},sw:function(a,b,j){return e.extend(this._change.s.apply(this,arguments),this._change.w.apply(this,[a,b,j]))},ne:function(a,b,j){return e.extend(this._change.n.apply(this,arguments),this._change.e.apply(this,[a,b,j]))},nw:function(a,b,j){return e.extend(this._change.n.apply(this,arguments),this._change.w.apply(this,
[a,b,j]))}},_propagate:function(a,b){e.ui.plugin.call(this,a,[b,this.ui()]);"resize"!=a&&this._trigger(a,b,this.ui())},plugins:{},ui:function(){return{originalElement:this.originalElement,element:this.element,helper:this.helper,position:this.position,size:this.size,originalSize:this.originalSize,originalPosition:this.originalPosition}}});e.ui.plugin.add("resizable","alsoResize",{start:function(){var a=e(this).data("resizable").options,b=function(a){e(a).each(function(){var a=e(this);a.data("resizable-alsoresize",
{width:parseInt(a.width(),10),height:parseInt(a.height(),10),left:parseInt(a.css("left"),10),top:parseInt(a.css("top"),10),position:a.css("position")})})};"object"==typeof a.alsoResize&&!a.alsoResize.parentNode?a.alsoResize.length?(a.alsoResize=a.alsoResize[0],b(a.alsoResize)):e.each(a.alsoResize,function(a){b(a)}):b(a.alsoResize)},resize:function(a,b){var j=e(this).data("resizable"),g=j.options,f=j.originalSize,k=j.originalPosition,d={height:j.size.height-f.height||0,width:j.size.width-f.width||
0,top:j.position.top-k.top||0,left:j.position.left-k.left||0},q=function(a,c){e(a).each(function(){var a=e(this),f=e(this).data("resizable-alsoresize"),k={},g=c&&c.length?c:a.parents(b.originalElement[0]).length?["width","height"]:["width","height","top","left"];e.each(g,function(a,b){var c=(f[b]||0)+(d[b]||0);c&&0<=c&&(k[b]=c||null)});e.browser.opera&&/relative/.test(a.css("position"))&&(j._revertToRelativePosition=!0,a.css({position:"absolute",top:"auto",left:"auto"}));a.css(k)})};"object"==typeof g.alsoResize&&
!g.alsoResize.nodeType?e.each(g.alsoResize,function(a,b){q(a,b)}):q(g.alsoResize)},stop:function(){var a=e(this).data("resizable"),b=a.options,j=function(a){e(a).each(function(){var a=e(this);a.css({position:a.data("resizable-alsoresize").position})})};a._revertToRelativePosition&&(a._revertToRelativePosition=!1,"object"==typeof b.alsoResize&&!b.alsoResize.nodeType?e.each(b.alsoResize,function(a){j(a)}):j(b.alsoResize));e(this).removeData("resizable-alsoresize")}});e.ui.plugin.add("resizable","animate",
{stop:function(a){var b=e(this).data("resizable"),j=b.options,g=b._proportionallyResizeElements,f=g.length&&/textarea/i.test(g[0].nodeName),k=f&&e.ui.hasScroll(g[0],"left")?0:b.sizeDiff.height,f={width:b.size.width-(f?0:b.sizeDiff.width),height:b.size.height-k},k=parseInt(b.element.css("left"),10)+(b.position.left-b.originalPosition.left)||null,d=parseInt(b.element.css("top"),10)+(b.position.top-b.originalPosition.top)||null;b.element.animate(e.extend(f,d&&k?{top:d,left:k}:{}),{duration:j.animateDuration,
easing:j.animateEasing,step:function(){var d={width:parseInt(b.element.css("width"),10),height:parseInt(b.element.css("height"),10),top:parseInt(b.element.css("top"),10),left:parseInt(b.element.css("left"),10)};g&&g.length&&e(g[0]).css({width:d.width,height:d.height});b._updateCache(d);b._propagate("resize",a)}})}});e.ui.plugin.add("resizable","containment",{start:function(){var c=e(this).data("resizable"),b=c.element,j=c.options.containment;if(b=j instanceof e?j.get(0):/parent/.test(j)?b.parent().get(0):
j)if(c.containerElement=e(b),/document/.test(j)||j==document)c.containerOffset={left:0,top:0},c.containerPosition={left:0,top:0},c.parentData={element:e(document),left:0,top:0,width:e(document).width(),height:e(document).height()||document.body.parentNode.scrollHeight};else{var g=e(b),f=[];e(["Top","Right","Left","Bottom"]).each(function(b,d){f[b]=a(g.css("padding"+d))});c.containerOffset=g.offset();c.containerPosition=g.position();c.containerSize={height:g.innerHeight()-f[3],width:g.innerWidth()-
f[1]};var j=c.containerOffset,k=c.containerSize.height,d=c.containerSize.width,d=e.ui.hasScroll(b,"left")?b.scrollWidth:d,k=e.ui.hasScroll(b)?b.scrollHeight:k;c.parentData={element:b,left:j.left,top:j.top,width:d,height:k}}},resize:function(a){var b=e(this).data("resizable"),j=b.options,g=b.containerOffset,f=b.position,a=b._aspectRatio||a.shiftKey,k={top:0,left:0},d=b.containerElement;d[0]!=document&&/static/.test(d.css("position"))&&(k=g);if(f.left<(b._helper?g.left:0))b.size.width+=b._helper?b.position.left-
g.left:b.position.left-k.left,a&&(b.size.height=b.size.width/j.aspectRatio),b.position.left=j.helper?g.left:0;if(f.top<(b._helper?g.top:0))b.size.height+=b._helper?b.position.top-g.top:b.position.top,a&&(b.size.width=b.size.height*j.aspectRatio),b.position.top=b._helper?g.top:0;b.offset.left=b.parentData.left+b.position.left;b.offset.top=b.parentData.top+b.position.top;j=Math.abs(b.offset.left-k.left+b.sizeDiff.width);g=Math.abs((b._helper?b.offset.top-k.top:b.offset.top-g.top)+b.sizeDiff.height);
f=b.containerElement.get(0)==b.element.parent().get(0);k=/relative|absolute/.test(b.containerElement.css("position"));f&&k&&(j-=b.parentData.left);j+b.size.width>=b.parentData.width&&(b.size.width=b.parentData.width-j,a&&(b.size.height=b.size.width/b.aspectRatio));g+b.size.height>=b.parentData.height&&(b.size.height=b.parentData.height-g,a&&(b.size.width=b.size.height*b.aspectRatio))},stop:function(){var a=e(this).data("resizable"),b=a.options,j=a.containerOffset,g=a.containerPosition,f=a.containerElement,
k=e(a.helper),d=k.offset(),q=k.outerWidth()-a.sizeDiff.width,k=k.outerHeight()-a.sizeDiff.height;a._helper&&(!b.animate&&/relative/.test(f.css("position")))&&e(this).css({left:d.left-g.left-j.left,width:q,height:k});a._helper&&(!b.animate&&/static/.test(f.css("position")))&&e(this).css({left:d.left-g.left-j.left,width:q,height:k})}});e.ui.plugin.add("resizable","ghost",{start:function(){var a=e(this).data("resizable"),b=a.options,j=a.size;a.ghost=a.originalElement.clone();a.ghost.css({opacity:0.25,
display:"block",position:"relative",height:j.height,width:j.width,margin:0,left:0,top:0}).addClass("ui-resizable-ghost").addClass("string"==typeof b.ghost?b.ghost:"");a.ghost.appendTo(a.helper)},resize:function(){var a=e(this).data("resizable");a.ghost&&a.ghost.css({position:"relative",height:a.size.height,width:a.size.width})},stop:function(){var a=e(this).data("resizable");a.ghost&&a.helper&&a.helper.get(0).removeChild(a.ghost.get(0))}});e.ui.plugin.add("resizable","grid",{resize:function(){var a=
e(this).data("resizable"),b=a.options,j=a.size,g=a.originalSize,f=a.originalPosition,k=a.axis;b.grid="number"==typeof b.grid?[b.grid,b.grid]:b.grid;var d=Math.round((j.width-g.width)/(b.grid[0]||1))*(b.grid[0]||1),b=Math.round((j.height-g.height)/(b.grid[1]||1))*(b.grid[1]||1);/^(se|s|e)$/.test(k)?(a.size.width=g.width+d,a.size.height=g.height+b):/^(ne)$/.test(k)?(a.size.width=g.width+d,a.size.height=g.height+b,a.position.top=f.top-b):(/^(sw)$/.test(k)?(a.size.width=g.width+d,a.size.height=g.height+
b):(a.size.width=g.width+d,a.size.height=g.height+b,a.position.top=f.top-b),a.position.left=f.left-d)}});var a=function(a){return parseInt(a,10)||0},g=function(a){return!isNaN(parseInt(a,10))}})(m);(function(e){e.widget("ui.selectable",e.ui.mouse,{version:"1.9m6",options:{appendTo:"body",autoRefresh:!0,distance:0,filter:"*",tolerance:"touch"},_create:function(){var a=this;this.element.addClass("ui-selectable");this.dragged=!1;var g;this.refresh=function(){g=e(a.options.filter,a.element[0]);g.each(function(){var a=
e(this),b=a.offset();e.data(this,"selectable-item",{element:this,$element:a,left:b.left,top:b.top,right:b.left+a.outerWidth(),bottom:b.top+a.outerHeight(),startselected:!1,selected:a.hasClass("ui-selected"),selecting:a.hasClass("ui-selecting"),unselecting:a.hasClass("ui-unselecting")})})};this.refresh();this.selectees=g.addClass("ui-selectee");this._mouseInit();this.helper=e("<div class='ui-selectable-helper'></div>")},destroy:function(){this.selectees.removeClass("ui-selectee").removeData("selectable-item");
this.element.removeClass("ui-selectable ui-selectable-disabled").removeData("selectable").unbind(".selectable");this._mouseDestroy();return this},_mouseStart:function(a){var g=this;this.opos=[a.pageX,a.pageY];if(!this.options.disabled){var c=this.options;this.selectees=e(c.filter,this.element[0]);this._trigger("start",a);e(c.appendTo).append(this.helper);this.helper.css({left:a.clientX,top:a.clientY,width:0,height:0});c.autoRefresh&&this.refresh();this.selectees.filter(".ui-selected").each(function(){var b=
e.data(this,"selectable-item");b.startselected=!0;a.metaKey||(b.$element.removeClass("ui-selected"),b.selected=!1,b.$element.addClass("ui-unselecting"),b.unselecting=!0,g._trigger("unselecting",a,{unselecting:b.element}))});e(a.target).parents().andSelf().each(function(){var b=e.data(this,"selectable-item");if(b){var c=!a.metaKey||!b.$element.hasClass("ui-selected");b.$element.removeClass(c?"ui-unselecting":"ui-selected").addClass(c?"ui-selecting":"ui-unselecting");b.unselecting=!c;b.selecting=c;
(b.selected=c)?g._trigger("selecting",a,{selecting:b.element}):g._trigger("unselecting",a,{unselecting:b.element});return!1}})}},_mouseDrag:function(a){var g=this;this.dragged=!0;if(!this.options.disabled){var c=this.options,b=this.opos[0],j=this.opos[1],l=a.pageX,f=a.pageY;if(b>l)var k=l,l=b,b=k;j>f&&(k=f,f=j,j=k);this.helper.css({left:b,top:j,width:l-b,height:f-j});this.selectees.each(function(){var d=e.data(this,"selectable-item");if(d&&d.element!=g.element[0]){var k=false;c.tolerance=="touch"?
k=!(d.left>l||d.right<b||d.top>f||d.bottom<j):c.tolerance=="fit"&&(k=d.left>b&&d.right<l&&d.top>j&&d.bottom<f);if(k){if(d.selected){d.$element.removeClass("ui-selected");d.selected=false}if(d.unselecting){d.$element.removeClass("ui-unselecting");d.unselecting=false}if(!d.selecting){d.$element.addClass("ui-selecting");d.selecting=true;g._trigger("selecting",a,{selecting:d.element})}}else{if(d.selecting)if(a.metaKey&&d.startselected){d.$element.removeClass("ui-selecting");d.selecting=false;d.$element.addClass("ui-selected");
d.selected=true}else{d.$element.removeClass("ui-selecting");d.selecting=false;if(d.startselected){d.$element.addClass("ui-unselecting");d.unselecting=true}g._trigger("unselecting",a,{unselecting:d.element})}if(d.selected&&!a.metaKey&&!d.startselected){d.$element.removeClass("ui-selected");d.selected=false;d.$element.addClass("ui-unselecting");d.unselecting=true;g._trigger("unselecting",a,{unselecting:d.element})}}}});return!1}},_mouseStop:function(a){var g=this;this.dragged=!1;e(".ui-unselecting",
this.element[0]).each(function(){var c=e.data(this,"selectable-item");c.$element.removeClass("ui-unselecting");c.unselecting=!1;c.startselected=!1;g._trigger("unselected",a,{unselected:c.element})});e(".ui-selecting",this.element[0]).each(function(){var c=e.data(this,"selectable-item");c.$element.removeClass("ui-selecting").addClass("ui-selected");c.selecting=!1;c.selected=!0;c.startselected=!0;g._trigger("selected",a,{selected:c.element})});this._trigger("stop",a);this.helper.remove();return!1}})})(m);
(function(e){e.widget("ui.sortable",e.ui.mouse,{version:"1.9m6",widgetEventPrefix:"sort",options:{appendTo:"parent",axis:!1,connectWith:!1,containment:!1,cursor:"auto",cursorAt:!1,dropOnEmpty:!0,forcePlaceholderSize:!1,forceHelperSize:!1,grid:!1,handle:!1,helper:"original",items:"> *",opacity:!1,placeholder:!1,revert:!1,scroll:!0,scrollSensitivity:20,scrollSpeed:20,scope:"default",tolerance:"intersect",zIndex:1E3},_create:function(){var a=this.options;this.containerCache={};this.element.addClass("ui-sortable");
this.refresh();this.floating=this.items.length?"x"===a.axis||/left|right/.test(this.items[0].item.css("float"))||/inline|table-cell/.test(this.items[0].item.css("display")):!1;this.offset=this.element.offset();this._mouseInit()},destroy:function(){this.element.removeClass("ui-sortable ui-sortable-disabled").removeData("sortable").unbind(".sortable");this._mouseDestroy();for(var a=this.items.length-1;0<=a;a--)this.items[a].item.removeData("sortable-item");return this},_setOption:function(a,g){"disabled"===
a?(this.options[a]=g,this.widget().toggleClass("ui-sortable-disabled",!!g)):e.Widget.prototype._setOption.apply(this,arguments)},_mouseCapture:function(a,g){if(this.reverting||this.options.disabled||"static"==this.options.type)return!1;this._refreshItems(a);var c=null,b=this;e(a.target).parents().each(function(){if(e.data(this,"sortable-item")==b)return c=e(this),!1});e.data(a.target,"sortable-item")==b&&(c=e(a.target));if(!c)return!1;if(this.options.handle&&!g){var j=!1;e(this.options.handle,c).find("*").andSelf().each(function(){this==
a.target&&(j=!0)});if(!j)return!1}this.currentItem=c;this._removeCurrentsFromItems();return!0},_mouseStart:function(a,g,c){g=this.options;this.currentContainer=this;this.refreshPositions();this.helper=this._createHelper(a);this._cacheHelperProportions();this._cacheMargins();this.scrollParent=this.helper.scrollParent();this.offset=this.currentItem.offset();this.offset={top:this.offset.top-this.margins.top,left:this.offset.left-this.margins.left};this.helper.css("position","absolute");this.cssPosition=
this.helper.css("position");e.extend(this.offset,{click:{left:a.pageX-this.offset.left,top:a.pageY-this.offset.top},parent:this._getParentOffset(),relative:this._getRelativeOffset()});this.originalPosition=this._generatePosition(a);this.originalPageX=a.pageX;this.originalPageY=a.pageY;g.cursorAt&&this._adjustOffsetFromHelper(g.cursorAt);this.domPosition={prev:this.currentItem.prev()[0],parent:this.currentItem.parent()[0]};this.helper[0]!=this.currentItem[0]&&this.currentItem.hide();this._createPlaceholder();
g.containment&&this._setContainment();g.cursor&&(e("body").css("cursor")&&(this._storedCursor=e("body").css("cursor")),e("body").css("cursor",g.cursor));g.opacity&&(this.helper.css("opacity")&&(this._storedOpacity=this.helper.css("opacity")),this.helper.css("opacity",g.opacity));g.zIndex&&(this.helper.css("zIndex")&&(this._storedZIndex=this.helper.css("zIndex")),this.helper.css("zIndex",g.zIndex));this.scrollParent[0]!=document&&"HTML"!=this.scrollParent[0].tagName&&(this.overflowOffset=this.scrollParent.offset());
this._trigger("start",a,this._uiHash());this._preserveHelperProportions||this._cacheHelperProportions();if(!c)for(c=this.containers.length-1;0<=c;c--)this.containers[c]._trigger("activate",a,this._uiHash(this));e.ui.ddmanager&&(e.ui.ddmanager.current=this);e.ui.ddmanager&&!g.dropBehaviour&&e.ui.ddmanager.prepareOffsets(this,a);this.dragging=!0;this.helper.addClass("ui-sortable-helper");this._mouseDrag(a);return!0},_mouseDrag:function(a){this.position=this._generatePosition(a);this.positionAbs=this._convertPositionTo("absolute");
this.lastPositionAbs||(this.lastPositionAbs=this.positionAbs);if(this.options.scroll){var g=this.options,c=!1;this.scrollParent[0]!=document&&"HTML"!=this.scrollParent[0].tagName?(this.overflowOffset.top+this.scrollParent[0].offsetHeight-a.pageY<g.scrollSensitivity?this.scrollParent[0].scrollTop=c=this.scrollParent[0].scrollTop+g.scrollSpeed:a.pageY-this.overflowOffset.top<g.scrollSensitivity&&(this.scrollParent[0].scrollTop=c=this.scrollParent[0].scrollTop-g.scrollSpeed),this.overflowOffset.left+
this.scrollParent[0].offsetWidth-a.pageX<g.scrollSensitivity)?this.scrollParent[0].scrollLeft=c=this.scrollParent[0].scrollLeft+g.scrollSpeed:a.pageX-this.overflowOffset.left<g.scrollSensitivity&&(this.scrollParent[0].scrollLeft=c=this.scrollParent[0].scrollLeft-g.scrollSpeed):(a.pageY-e(document).scrollTop()<g.scrollSensitivity?c=e(document).scrollTop(e(document).scrollTop()-g.scrollSpeed):e(window).height()-(a.pageY-e(document).scrollTop())<g.scrollSensitivity&&(c=e(document).scrollTop(e(document).scrollTop()+
g.scrollSpeed)),a.pageX-e(document).scrollLeft()<g.scrollSensitivity?c=e(document).scrollLeft(e(document).scrollLeft()-g.scrollSpeed):e(window).width()-(a.pageX-e(document).scrollLeft())<g.scrollSensitivity&&(c=e(document).scrollLeft(e(document).scrollLeft()+g.scrollSpeed)));!1!==c&&(e.ui.ddmanager&&!g.dropBehaviour)&&e.ui.ddmanager.prepareOffsets(this,a)}this.positionAbs=this._convertPositionTo("absolute");if(!this.options.axis||"y"!=this.options.axis)this.helper[0].style.left=this.position.left+
"px";if(!this.options.axis||"x"!=this.options.axis)this.helper[0].style.top=this.position.top+"px";for(g=this.items.length-1;0<=g;g--){var c=this.items[g],b=c.item[0],j=this._intersectsWithPointer(c);if(j&&b!=this.currentItem[0]&&this.placeholder[1==j?"next":"prev"]()[0]!=b&&!e.contains(this.placeholder[0],b)&&("semi-dynamic"==this.options.type?!e.contains(this.element[0],b):1)){this.direction=1==j?"down":"up";if("pointer"==this.options.tolerance||this._intersectsWithSides(c))this._rearrange(a,c);
else break;this._trigger("change",a,this._uiHash());break}}this._contactContainers(a);e.ui.ddmanager&&e.ui.ddmanager.drag(this,a);this._trigger("sort",a,this._uiHash());this.lastPositionAbs=this.positionAbs;return!1},_mouseStop:function(a,g){if(a){e.ui.ddmanager&&!this.options.dropBehaviour&&e.ui.ddmanager.drop(this,a);if(this.options.revert){var c=this,b=c.placeholder.offset();c.reverting=!0;e(this.helper).animate({left:b.left-this.offset.parent.left-c.margins.left+(this.offsetParent[0]==document.body?
0:this.offsetParent[0].scrollLeft),top:b.top-this.offset.parent.top-c.margins.top+(this.offsetParent[0]==document.body?0:this.offsetParent[0].scrollTop)},parseInt(this.options.revert,10)||500,function(){c._clear(a)})}else this._clear(a,g);return!1}},cancel:function(){if(this.dragging){this._mouseUp({target:null});"original"==this.options.helper?this.currentItem.css(this._storedCSS).removeClass("ui-sortable-helper"):this.currentItem.show();for(var a=this.containers.length-1;0<=a;a--)this.containers[a]._trigger("deactivate",
null,this._uiHash(this)),this.containers[a].containerCache.over&&(this.containers[a]._trigger("out",null,this._uiHash(this)),this.containers[a].containerCache.over=0)}this.placeholder&&(this.placeholder[0].parentNode&&this.placeholder[0].parentNode.removeChild(this.placeholder[0]),"original"!=this.options.helper&&(this.helper&&this.helper[0].parentNode)&&this.helper.remove(),e.extend(this,{helper:null,dragging:!1,reverting:!1,_noFinalSort:null}),this.domPosition.prev?e(this.domPosition.prev).after(this.currentItem):
e(this.domPosition.parent).prepend(this.currentItem));return this},serialize:function(a){var g=this._getItemsAsjQuery(a&&a.connected),c=[],a=a||{};e(g).each(function(){var b=(e(a.item||this).attr(a.attribute||"id")||"").match(a.expression||/(.+)[-=_](.+)/);b&&c.push((a.key||b[1]+"[]")+"="+(a.key&&a.expression?b[1]:b[2]))});!c.length&&a.key&&c.push(a.key+"=");return c.join("&")},toArray:function(a){var g=this._getItemsAsjQuery(a&&a.connected),c=[],a=a||{};g.each(function(){c.push(e(a.item||this).attr(a.attribute||
"id")||"")});return c},_intersectsWith:function(a){var g=this.positionAbs.left,c=g+this.helperProportions.width,b=this.positionAbs.top,j=b+this.helperProportions.height,e=a.left,f=e+a.width,k=a.top,d=k+a.height,q=this.offset.click.top,o=this.offset.click.left;return"pointer"==this.options.tolerance||this.options.forcePointerForContainers||"pointer"!=this.options.tolerance&&this.helperProportions[this.floating?"width":"height"]>a[this.floating?"width":"height"]?b+q>k&&b+q<d&&g+o>e&&g+o<f:e<g+this.helperProportions.width/
2&&c-this.helperProportions.width/2<f&&k<b+this.helperProportions.height/2&&j-this.helperProportions.height/2<d},_intersectsWithPointer:function(a){var g=e.ui.isOverAxis(this.positionAbs.top+this.offset.click.top,a.top,a.height),a=e.ui.isOverAxis(this.positionAbs.left+this.offset.click.left,a.left,a.width),g=g&&a,a=this._getDragVerticalDirection(),c=this._getDragHorizontalDirection();return!g?!1:this.floating?c&&"right"==c||"down"==a?2:1:a&&("down"==a?2:1)},_intersectsWithSides:function(a){var g=
e.ui.isOverAxis(this.positionAbs.top+this.offset.click.top,a.top+a.height/2,a.height),a=e.ui.isOverAxis(this.positionAbs.left+this.offset.click.left,a.left+a.width/2,a.width),c=this._getDragVerticalDirection(),b=this._getDragHorizontalDirection();return this.floating&&b?"right"==b&&a||"left"==b&&!a:c&&("down"==c&&g||"up"==c&&!g)},_getDragVerticalDirection:function(){var a=this.positionAbs.top-this.lastPositionAbs.top;return 0!=a&&(0<a?"down":"up")},_getDragHorizontalDirection:function(){var a=this.positionAbs.left-
this.lastPositionAbs.left;return 0!=a&&(0<a?"right":"left")},refresh:function(a){this._refreshItems(a);this.refreshPositions();return this},_connectWith:function(){var a=this.options;return a.connectWith.constructor==String?[a.connectWith]:a.connectWith},_getItemsAsjQuery:function(a){var g=[],c=[],b=this._connectWith();if(b&&a)for(a=b.length-1;0<=a;a--)for(var j=e(b[a]),l=j.length-1;0<=l;l--){var f=e.data(j[l],"sortable");f&&(f!=this&&!f.options.disabled)&&c.push([e.isFunction(f.options.items)?f.options.items.call(f.element):
e(f.options.items,f.element).not(".ui-sortable-helper").not(".ui-sortable-placeholder"),f])}c.push([e.isFunction(this.options.items)?this.options.items.call(this.element,null,{options:this.options,item:this.currentItem}):e(this.options.items,this.element).not(".ui-sortable-helper").not(".ui-sortable-placeholder"),this]);for(a=c.length-1;0<=a;a--)c[a][0].each(function(){g.push(this)});return e(g)},_removeCurrentsFromItems:function(){for(var a=this.currentItem.find(":data(sortable-item)"),g=0;g<this.items.length;g++)for(var c=
0;c<a.length;c++)a[c]==this.items[g].item[0]&&this.items.splice(g,1)},_refreshItems:function(a){this.items=[];this.containers=[this];var g=this.items,c=[[e.isFunction(this.options.items)?this.options.items.call(this.element[0],a,{item:this.currentItem}):e(this.options.items,this.element),this]],b=this._connectWith();if(b)for(var j=b.length-1;0<=j;j--)for(var l=e(b[j]),f=l.length-1;0<=f;f--){var k=e.data(l[f],"sortable");k&&(k!=this&&!k.options.disabled)&&(c.push([e.isFunction(k.options.items)?k.options.items.call(k.element[0],
a,{item:this.currentItem}):e(k.options.items,k.element),k]),this.containers.push(k))}for(j=c.length-1;0<=j;j--){a=c[j][1];b=c[j][0];f=0;for(l=b.length;f<l;f++)k=e(b[f]),k.data("sortable-item",a),g.push({item:k,instance:a,width:0,height:0,left:0,top:0})}},refreshPositions:function(a){this.offsetParent&&this.helper&&(this.offset.parent=this._getParentOffset());for(var g=this.items.length-1;0<=g;g--){var c=this.items[g];if(!(c.instance!=this.currentContainer&&this.currentContainer&&c.item[0]!=this.currentItem[0])){var b=
this.options.toleranceElement?e(this.options.toleranceElement,c.item):c.item;a||(c.width=b.outerWidth(),c.height=b.outerHeight());b=b.offset();c.left=b.left;c.top=b.top}}if(this.options.custom&&this.options.custom.refreshContainers)this.options.custom.refreshContainers.call(this);else for(g=this.containers.length-1;0<=g;g--)b=this.containers[g].element.offset(),this.containers[g].containerCache.left=b.left,this.containers[g].containerCache.top=b.top,this.containers[g].containerCache.width=this.containers[g].element.outerWidth(),
this.containers[g].containerCache.height=this.containers[g].element.outerHeight();return this},_createPlaceholder:function(a){var g=a||this,c=g.options;if(!c.placeholder||c.placeholder.constructor==String){var b=c.placeholder;c.placeholder={element:function(){var a=e(document.createElement(g.currentItem[0].nodeName)).addClass(b||g.currentItem[0].className+" ui-sortable-placeholder").removeClass("ui-sortable-helper")[0];b||(a.style.visibility="hidden");return a},update:function(a,e){if(!b||c.forcePlaceholderSize)e.height()||
e.height(g.currentItem.innerHeight()-parseInt(g.currentItem.css("paddingTop")||0,10)-parseInt(g.currentItem.css("paddingBottom")||0,10)),e.width()||e.width(g.currentItem.innerWidth()-parseInt(g.currentItem.css("paddingLeft")||0,10)-parseInt(g.currentItem.css("paddingRight")||0,10))}}}g.placeholder=e(c.placeholder.element.call(g.element,g.currentItem));g.currentItem.after(g.placeholder);c.placeholder.update(g,g.placeholder)},_contactContainers:function(a){for(var g=null,c=null,b=this.containers.length-
1;0<=b;b--)if(!e.contains(this.currentItem[0],this.containers[b].element[0]))if(this._intersectsWith(this.containers[b].containerCache)){if(!g||!e.contains(this.containers[b].element[0],g.element[0]))g=this.containers[b],c=b}else this.containers[b].containerCache.over&&(this.containers[b]._trigger("out",a,this._uiHash(this)),this.containers[b].containerCache.over=0);if(g)if(1===this.containers.length)this.containers[c]._trigger("over",a,this._uiHash(this)),this.containers[c].containerCache.over=1;
else if(this.currentContainer!=this.containers[c]){for(var g=1E4,b=null,j=this.positionAbs[this.containers[c].floating?"left":"top"],l=this.items.length-1;0<=l;l--)if(e.contains(this.containers[c].element[0],this.items[l].item[0])){var f=this.items[l][this.containers[c].floating?"left":"top"];Math.abs(f-j)<g&&(g=Math.abs(f-j),b=this.items[l])}if(b||this.options.dropOnEmpty)this.currentContainer=this.containers[c],b?this._rearrange(a,b,null,!0):this._rearrange(a,null,this.containers[c].element,!0),
this._trigger("change",a,this._uiHash()),this.containers[c]._trigger("change",a,this._uiHash(this)),this.options.placeholder.update(this.currentContainer,this.placeholder),this.containers[c]._trigger("over",a,this._uiHash(this)),this.containers[c].containerCache.over=1}},_createHelper:function(a){var g=this.options,a=e.isFunction(g.helper)?e(g.helper.apply(this.element[0],[a,this.currentItem])):"clone"==g.helper?this.currentItem.clone():this.currentItem;a.parents("body").length||e("parent"!=g.appendTo?
g.appendTo:this.currentItem[0].parentNode)[0].appendChild(a[0]);a[0]==this.currentItem[0]&&(this._storedCSS={width:this.currentItem[0].style.width,height:this.currentItem[0].style.height,position:this.currentItem.css("position"),top:this.currentItem.css("top"),left:this.currentItem.css("left")});(""==a[0].style.width||g.forceHelperSize)&&a.width(this.currentItem.width());(""==a[0].style.height||g.forceHelperSize)&&a.height(this.currentItem.height());return a},_adjustOffsetFromHelper:function(a){"string"==
typeof a&&(a=a.split(" "));e.isArray(a)&&(a={left:+a[0],top:+a[1]||0});"left"in a&&(this.offset.click.left=a.left+this.margins.left);"right"in a&&(this.offset.click.left=this.helperProportions.width-a.right+this.margins.left);"top"in a&&(this.offset.click.top=a.top+this.margins.top);"bottom"in a&&(this.offset.click.top=this.helperProportions.height-a.bottom+this.margins.top)},_getParentOffset:function(){this.offsetParent=this.helper.offsetParent();var a=this.offsetParent.offset();"absolute"==this.cssPosition&&
(this.scrollParent[0]!=document&&e.contains(this.scrollParent[0],this.offsetParent[0]))&&(a.left+=this.scrollParent.scrollLeft(),a.top+=this.scrollParent.scrollTop());if(this.offsetParent[0]==document.body||this.offsetParent[0].tagName&&"html"==this.offsetParent[0].tagName.toLowerCase()&&e.browser.msie)a={top:0,left:0};return{top:a.top+(parseInt(this.offsetParent.css("borderTopWidth"),10)||0),left:a.left+(parseInt(this.offsetParent.css("borderLeftWidth"),10)||0)}},_getRelativeOffset:function(){if("relative"==
this.cssPosition){var a=this.currentItem.position();return{top:a.top-(parseInt(this.helper.css("top"),10)||0)+this.scrollParent.scrollTop(),left:a.left-(parseInt(this.helper.css("left"),10)||0)+this.scrollParent.scrollLeft()}}return{top:0,left:0}},_cacheMargins:function(){this.margins={left:parseInt(this.currentItem.css("marginLeft"),10)||0,top:parseInt(this.currentItem.css("marginTop"),10)||0}},_cacheHelperProportions:function(){this.helperProportions={width:this.helper.outerWidth(),height:this.helper.outerHeight()}},
_setContainment:function(){var a=this.options;"parent"==a.containment&&(a.containment=this.helper[0].parentNode);if("document"==a.containment||"window"==a.containment)this.containment=[0-this.offset.relative.left-this.offset.parent.left,0-this.offset.relative.top-this.offset.parent.top,e("document"==a.containment?document:window).width()-this.helperProportions.width-this.margins.left,(e("document"==a.containment?document:window).height()||document.body.parentNode.scrollHeight)-this.helperProportions.height-
this.margins.top];if(!/^(document|window|parent)$/.test(a.containment)){var g=e(a.containment)[0],a=e(a.containment).offset(),c="hidden"!=e(g).css("overflow");this.containment=[a.left+(parseInt(e(g).css("borderLeftWidth"),10)||0)+(parseInt(e(g).css("paddingLeft"),10)||0)-this.margins.left,a.top+(parseInt(e(g).css("borderTopWidth"),10)||0)+(parseInt(e(g).css("paddingTop"),10)||0)-this.margins.top,a.left+(c?Math.max(g.scrollWidth,g.offsetWidth):g.offsetWidth)-(parseInt(e(g).css("borderLeftWidth"),10)||
0)-(parseInt(e(g).css("paddingRight"),10)||0)-this.helperProportions.width-this.margins.left,a.top+(c?Math.max(g.scrollHeight,g.offsetHeight):g.offsetHeight)-(parseInt(e(g).css("borderTopWidth"),10)||0)-(parseInt(e(g).css("paddingBottom"),10)||0)-this.helperProportions.height-this.margins.top]}},_convertPositionTo:function(a,g){g||(g=this.position);var c="absolute"==a?1:-1,b="absolute"==this.cssPosition&&!(this.scrollParent[0]!=document&&e.contains(this.scrollParent[0],this.offsetParent[0]))?this.offsetParent:
this.scrollParent,j=/(html|body)/i.test(b[0].tagName);return{top:g.top+this.offset.relative.top*c+this.offset.parent.top*c-(e.browser.safari&&"fixed"==this.cssPosition?0:("fixed"==this.cssPosition?-this.scrollParent.scrollTop():j?0:b.scrollTop())*c),left:g.left+this.offset.relative.left*c+this.offset.parent.left*c-(e.browser.safari&&"fixed"==this.cssPosition?0:("fixed"==this.cssPosition?-this.scrollParent.scrollLeft():j?0:b.scrollLeft())*c)}},_generatePosition:function(a){var g=this.options,c="absolute"==
this.cssPosition&&!(this.scrollParent[0]!=document&&e.contains(this.scrollParent[0],this.offsetParent[0]))?this.offsetParent:this.scrollParent,b=/(html|body)/i.test(c[0].tagName);"relative"==this.cssPosition&&!(this.scrollParent[0]!=document&&this.scrollParent[0]!=this.offsetParent[0])&&(this.offset.relative=this._getRelativeOffset());var j=a.pageX,l=a.pageY;if(this.originalPosition&&(this.containment&&(a.pageX-this.offset.click.left<this.containment[0]&&(j=this.containment[0]+this.offset.click.left),
a.pageY-this.offset.click.top<this.containment[1]&&(l=this.containment[1]+this.offset.click.top),a.pageX-this.offset.click.left>this.containment[2]&&(j=this.containment[2]+this.offset.click.left),a.pageY-this.offset.click.top>this.containment[3]&&(l=this.containment[3]+this.offset.click.top)),g.grid))l=this.originalPageY+Math.round((l-this.originalPageY)/g.grid[1])*g.grid[1],l=this.containment?!(l-this.offset.click.top<this.containment[1]||l-this.offset.click.top>this.containment[3])?l:!(l-this.offset.click.top<
this.containment[1])?l-g.grid[1]:l+g.grid[1]:l,j=this.originalPageX+Math.round((j-this.originalPageX)/g.grid[0])*g.grid[0],j=this.containment?!(j-this.offset.click.left<this.containment[0]||j-this.offset.click.left>this.containment[2])?j:!(j-this.offset.click.left<this.containment[0])?j-g.grid[0]:j+g.grid[0]:j;return{top:l-this.offset.click.top-this.offset.relative.top-this.offset.parent.top+(e.browser.safari&&"fixed"==this.cssPosition?0:"fixed"==this.cssPosition?-this.scrollParent.scrollTop():b?
0:c.scrollTop()),left:j-this.offset.click.left-this.offset.relative.left-this.offset.parent.left+(e.browser.safari&&"fixed"==this.cssPosition?0:"fixed"==this.cssPosition?-this.scrollParent.scrollLeft():b?0:c.scrollLeft())}},_rearrange:function(a,g,c,b){c?c[0].appendChild(this.placeholder[0]):g.item[0].parentNode.insertBefore(this.placeholder[0],"down"==this.direction?g.item[0]:g.item[0].nextSibling);this.counter=this.counter?++this.counter:1;var j=this,e=this.counter;window.setTimeout(function(){e==
j.counter&&j.refreshPositions(!b)},0)},_clear:function(a,g){this.reverting=!1;var c=[];!this._noFinalSort&&this.currentItem.parent().length&&this.placeholder.before(this.currentItem);this._noFinalSort=null;if(this.helper[0]==this.currentItem[0]){for(var b in this._storedCSS)if("auto"==this._storedCSS[b]||"static"==this._storedCSS[b])this._storedCSS[b]="";this.currentItem.css(this._storedCSS).removeClass("ui-sortable-helper")}else this.currentItem.show();this.fromOutside&&!g&&c.push(function(a){this._trigger("receive",
a,this._uiHash(this.fromOutside))});(this.fromOutside||this.domPosition.prev!=this.currentItem.prev().not(".ui-sortable-helper")[0]||this.domPosition.parent!=this.currentItem.parent()[0])&&!g&&c.push(function(a){this._trigger("update",a,this._uiHash())});if(!e.contains(this.element[0],this.currentItem[0])){g||c.push(function(a){this._trigger("remove",a,this._uiHash())});for(b=this.containers.length-1;0<=b;b--)e.contains(this.containers[b].element[0],this.currentItem[0])&&!g&&(c.push(function(a){return function(b){a._trigger("receive",
b,this._uiHash(this))}}.call(this,this.containers[b])),c.push(function(a){return function(b){a._trigger("update",b,this._uiHash(this))}}.call(this,this.containers[b])))}for(b=this.containers.length-1;0<=b;b--)g||c.push(function(a){return function(b){a._trigger("deactivate",b,this._uiHash(this))}}.call(this,this.containers[b])),this.containers[b].containerCache.over&&(c.push(function(a){return function(b){a._trigger("out",b,this._uiHash(this))}}.call(this,this.containers[b])),this.containers[b].containerCache.over=
0);this._storedCursor&&e("body").css("cursor",this._storedCursor);this._storedOpacity&&this.helper.css("opacity",this._storedOpacity);this._storedZIndex&&this.helper.css("zIndex","auto"==this._storedZIndex?"":this._storedZIndex);this.dragging=!1;if(this.cancelHelperRemoval){if(!g){this._trigger("beforeStop",a,this._uiHash());for(b=0;b<c.length;b++)c[b].call(this,a);this._trigger("stop",a,this._uiHash())}return!1}g||this._trigger("beforeStop",a,this._uiHash());this.placeholder[0].parentNode.removeChild(this.placeholder[0]);
this.helper[0]!=this.currentItem[0]&&this.helper.remove();this.helper=null;if(!g){for(b=0;b<c.length;b++)c[b].call(this,a);this._trigger("stop",a,this._uiHash())}this.fromOutside=!1;return!0},_trigger:function(){!1===e.Widget.prototype._trigger.apply(this,arguments)&&this.cancel()},_uiHash:function(a){var g=a||this;return{helper:g.helper,placeholder:g.placeholder||e([]),position:g.position,originalPosition:g.originalPosition,offset:g.positionAbs,item:g.currentItem,sender:a?a.element:null}}})})(m);
m.effects||function(e,a){function g(a){var b;return a&&a.constructor===Array&&3===a.length?a:(b=/rgb\(\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*\)/.exec(a))?[parseInt(b[1],10),parseInt(b[2],10),parseInt(b[3],10)]:(b=/rgb\(\s*([0-9]+(?:\.[0-9]+)?)\%\s*,\s*([0-9]+(?:\.[0-9]+)?)\%\s*,\s*([0-9]+(?:\.[0-9]+)?)\%\s*\)/.exec(a))?[2.55*parseFloat(b[1]),2.55*parseFloat(b[2]),2.55*parseFloat(b[3])]:(b=/#([a-fA-F0-9]{2})([a-fA-F0-9]{2})([a-fA-F0-9]{2})/.exec(a))?[parseInt(b[1],16),parseInt(b[2],
16),parseInt(b[3],16)]:(b=/#([a-fA-F0-9])([a-fA-F0-9])([a-fA-F0-9])/.exec(a))?[parseInt(b[1]+b[1],16),parseInt(b[2]+b[2],16),parseInt(b[3]+b[3],16)]:/rgba\(0, 0, 0, 0\)/.exec(a)?f.transparent:f[e.trim(a).toLowerCase()]}function c(){var a=document.defaultView?document.defaultView.getComputedStyle(this,null):this.currentStyle,b={},d,c;if(a&&a.length&&a[0]&&a[a[0]])for(c=a.length;c--;)d=a[c],"string"===typeof a[d]&&(b[e.camelCase(d)]=a[d]);else for(d in a)"string"===typeof a[d]&&(b[d]=a[d]);return b}
function b(b,d,c,f){if(e.isPlainObject(b))return b;b={effect:b};d===a&&(d={});e.isFunction(d)&&(f=d,c=null,d={});if("number"===e.type(d)||e.fx.speeds[d])f=c,c=d,d={};e.isFunction(c)&&(f=c,c=null);d&&e.extend(b,d);c=c||d.duration;b.duration=e.fx.off?0:"number"===typeof c?c:c in e.fx.speeds?e.fx.speeds[c]:e.fx.speeds._default;b.complete=f||d.complete;return b}function j(a){return!a||"number"===typeof a||e.fx.speeds[a]?!0:"string"===typeof a&&!e.effects.effect[a]?l&&e.effects[a]?!1:!0:!1}var l=!1!==
e.uiBackCompat;e.effects={effect:{}};e.each("backgroundColor borderBottomColor borderLeftColor borderRightColor borderTopColor borderColor color outlineColor".split(" "),function(a,b){e.fx.step[b]=function(a){if(!a.colorInit){var d;d=a.elem;var c=b,f;do{f=e.curCSS(d,c);if(f!=""&&f!=="transparent"||e.nodeName(d,"body"))break;c="backgroundColor"}while(d=d.parentNode);d=g(f);a.start=d;a.end=g(a.end);a.colorInit=true}a.elem.style[b]="rgb("+Math.max(Math.min(parseInt(a.pos*(a.end[0]-a.start[0])+a.start[0],
10),255),0)+","+Math.max(Math.min(parseInt(a.pos*(a.end[1]-a.start[1])+a.start[1],10),255),0)+","+Math.max(Math.min(parseInt(a.pos*(a.end[2]-a.start[2])+a.start[2],10),255),0)+")"}});var f={aqua:[0,255,255],azure:[240,255,255],beige:[245,245,220],black:[0,0,0],blue:[0,0,255],brown:[165,42,42],cyan:[0,255,255],darkblue:[0,0,139],darkcyan:[0,139,139],darkgrey:[169,169,169],darkgreen:[0,100,0],darkkhaki:[189,183,107],darkmagenta:[139,0,139],darkolivegreen:[85,107,47],darkorange:[255,140,0],darkorchid:[153,
50,204],darkred:[139,0,0],darksalmon:[233,150,122],darkviolet:[148,0,211],fuchsia:[255,0,255],gold:[255,215,0],green:[0,128,0],indigo:[75,0,130],khaki:[240,230,140],lightblue:[173,216,230],lightcyan:[224,255,255],lightgreen:[144,238,144],lightgrey:[211,211,211],lightpink:[255,182,193],lightyellow:[255,255,224],lime:[0,255,0],magenta:[255,0,255],maroon:[128,0,0],navy:[0,0,128],olive:[128,128,0],orange:[255,165,0],pink:[255,192,203],purple:[128,0,128],violet:[128,0,128],red:[255,0,0],silver:[192,192,
192],white:[255,255,255],yellow:[255,255,0],transparent:[255,255,255]},k=["add","remove","toggle"],d={border:1,borderBottom:1,borderColor:1,borderLeft:1,borderRight:1,borderTop:1,borderWidth:1,margin:1,padding:1};e.each(["borderLeftStyle","borderRightStyle","borderBottomStyle","borderTopStyle"],function(a,b){e.fx.step[b]=function(a){if("none"!==a.end&&!a.setAttr||1===a.pos&&!a.setAttr)m.style(a.elem,b,a.end),a.setAttr=!0}});e.effects.animateClass=function(a,b,f,j){var g=e.speed(b,f,j);return this.queue(function(){var b=
e(this),f=b.attr("class"),j,l=g.children?b.find("*").andSelf():b,l=l.map(function(){var a=e(this);return{el:a,originalStyleAttr:a.attr("style")||" ",start:c.call(this)}});e.each(k,function(d,c){if(a[c])b[c+"Class"](a[c])});j=b.attr("class");l=l.map(function(){this.end=c.call(this.el[0]);var a=this.start,b=this.end,f={},k,j;for(k in b)if(j=b[k],a[k]!=j&&!d[k]&&(e.fx.step[k]||!isNaN(parseFloat(j))))f[k]=j;this.diff=f;return this});b.attr("class",f);l=l.map(function(){var a=this,b=e.Deferred();this.el.animate(this.diff,
{duration:g.duration,easing:g.easing,queue:!1,complete:function(){b.resolve(a)}});return b.promise()});e.when.apply(e,l.get()).done(function(){b.attr("class",j);e.each(arguments,function(){"object"===typeof this.el.attr("style")?(this.el.attr("style").cssText="",this.el.attr("style").cssText=this.originalStyleAttr):this.el.attr("style",this.originalStyleAttr)});g.complete.call(b[0])})})};e.fn.extend({_addClass:e.fn.addClass,addClass:function(a,b,d,c){return b?e.effects.animateClass.apply(this,[{add:a},
b,d,c]):this._addClass(a)},_removeClass:e.fn.removeClass,removeClass:function(a,b,d,c){return b?e.effects.animateClass.apply(this,[{remove:a},b,d,c]):this._removeClass(a)},_toggleClass:e.fn.toggleClass,toggleClass:function(b,d,c,f,k){return"boolean"===typeof d||d===a?c?e.effects.animateClass.apply(this,[d?{add:b}:{remove:b},c,f,k]):this._toggleClass(b,d):e.effects.animateClass.apply(this,[{toggle:b},d,c,f])},switchClass:function(a,b,d,c,f){return e.effects.animateClass.apply(this,[{add:b,remove:a},
d,c,f])}});e.extend(e.effects,{version:"1.9m6",save:function(a,b){for(var d=0;d<b.length;d++)null!==b[d]&&a.data("ec.storage."+b[d],a[0].style[b[d]])},restore:function(a,b){for(var d=0;d<b.length;d++)null!==b[d]&&a.css(b[d],a.data("ec.storage."+b[d]))},setMode:function(a,b){"toggle"===b&&(b=a.is(":hidden")?"show":"hide");return b},getBaseline:function(a,b){var d,c;switch(a[0]){case "top":d=0;break;case "middle":d=0.5;break;case "bottom":d=1;break;default:d=a[0]/b.height}switch(a[1]){case "left":c=
0;break;case "center":c=0.5;break;case "right":c=1;break;default:c=a[1]/b.width}return{x:c,y:d}},createWrapper:function(a){if(a.parent().is(".ui-effects-wrapper"))return a.parent();var b={width:a.outerWidth(!0),height:a.outerHeight(!0),"float":a.css("float")},d=e("<div></div>").addClass("ui-effects-wrapper").css({fontSize:"100%",background:"transparent",border:"none",margin:0,padding:0}),c={width:a.width(),height:a.height()},f=document.activeElement;a.wrap(d);(a[0]===f||e.contains(a[0],f))&&e(f).focus();
d=a.parent();"static"===a.css("position")?(d.css({position:"relative"}),a.css({position:"relative"})):(e.extend(b,{position:a.css("position"),zIndex:a.css("z-index")}),e.each(["top","left","bottom","right"],function(d,c){b[c]=a.css(c);isNaN(parseInt(b[c],10))&&(b[c]="auto")}),a.css({position:"relative",top:0,left:0,right:"auto",bottom:"auto"}));a.css(c);return d.css(b).show()},removeWrapper:function(a){var b=document.activeElement;a.parent().is(".ui-effects-wrapper")&&(a.parent().replaceWith(a),(a[0]===
b||e.contains(a[0],b))&&e(b).focus());return a},setTransition:function(a,b,d,c){c=c||{};e.each(b,function(b,f){var k=a.cssUnit(f);0<k[0]&&(c[f]=k[0]*d+k[1])});return c}});e.fn.extend({effect:function(a,d,c,f){function k(a){function b(){e.isFunction(c)&&c.call(d[0]);e.isFunction(a)&&a()}var d=e(this),c=j.complete,f=j.mode;(d.is(":hidden")?"hide"===f:"show"===f)?b():x.call(d[0],j,b)}var j=b.apply(this,arguments),g=j.mode,m=j.queue,x=e.effects.effect[j.effect],v=!x&&l&&e.effects[j.effect];return e.fx.off||
!x&&!v?g?this[g](j.duration,j.complete):this.each(function(){j.complete&&j.complete.call(this)}):x?!1===m?this.each(k):this.queue(m||"fx",k):v.call(this,{options:j,duration:j.duration,callback:j.complete,mode:j.mode})},_show:e.fn.show,show:function(a){if(j(a))return this._show.apply(this,arguments);var d=b.apply(this,arguments);d.mode="show";return this.effect.call(this,d)},_hide:e.fn.hide,hide:function(a){if(j(a))return this._hide.apply(this,arguments);var d=b.apply(this,arguments);d.mode="hide";
return this.effect.call(this,d)},__toggle:e.fn.toggle,toggle:function(a){if(j(a)||"boolean"===typeof a||e.isFunction(a))return this.__toggle.apply(this,arguments);var d=b.apply(this,arguments);d.mode="toggle";return this.effect.call(this,d)},cssUnit:function(a){var b=this.css(a),d=[];e.each(["em","px","%","pt"],function(a,c){0<b.indexOf(c)&&(d=[parseFloat(b),c])});return d}});e.easing.jswing=e.easing.swing;e.extend(e.easing,{def:"easeOutQuad",swing:function(a,b,d,c,f){return e.easing[e.easing.def](a,
b,d,c,f)},easeInQuad:function(a,b,d,c,f){return c*(b/=f)*b+d},easeOutQuad:function(a,b,d,c,f){return-c*(b/=f)*(b-2)+d},easeInOutQuad:function(a,b,d,c,f){return 1>(b/=f/2)?c/2*b*b+d:-c/2*(--b*(b-2)-1)+d},easeInCubic:function(a,b,d,c,f){return c*(b/=f)*b*b+d},easeOutCubic:function(a,b,d,c,f){return c*((b=b/f-1)*b*b+1)+d},easeInOutCubic:function(a,b,d,c,f){return 1>(b/=f/2)?c/2*b*b*b+d:c/2*((b-=2)*b*b+2)+d},easeInQuart:function(a,b,d,c,f){return c*(b/=f)*b*b*b+d},easeOutQuart:function(a,b,d,c,f){return-c*
((b=b/f-1)*b*b*b-1)+d},easeInOutQuart:function(a,b,d,c,f){return 1>(b/=f/2)?c/2*b*b*b*b+d:-c/2*((b-=2)*b*b*b-2)+d},easeInQuint:function(a,b,d,c,f){return c*(b/=f)*b*b*b*b+d},easeOutQuint:function(a,b,d,c,f){return c*((b=b/f-1)*b*b*b*b+1)+d},easeInOutQuint:function(a,b,d,c,f){return 1>(b/=f/2)?c/2*b*b*b*b*b+d:c/2*((b-=2)*b*b*b*b+2)+d},easeInSine:function(a,b,d,c,f){return-c*Math.cos(b/f*(Math.PI/2))+c+d},easeOutSine:function(a,b,d,c,f){return c*Math.sin(b/f*(Math.PI/2))+d},easeInOutSine:function(a,
b,d,c,f){return-c/2*(Math.cos(Math.PI*b/f)-1)+d},easeInExpo:function(a,b,d,c,f){return 0==b?d:c*Math.pow(2,10*(b/f-1))+d},easeOutExpo:function(a,b,d,c,f){return b==f?d+c:c*(-Math.pow(2,-10*b/f)+1)+d},easeInOutExpo:function(a,b,d,c,f){return 0==b?d:b==f?d+c:1>(b/=f/2)?c/2*Math.pow(2,10*(b-1))+d:c/2*(-Math.pow(2,-10*--b)+2)+d},easeInCirc:function(a,b,d,c,f){return-c*(Math.sqrt(1-(b/=f)*b)-1)+d},easeOutCirc:function(a,b,d,c,f){return c*Math.sqrt(1-(b=b/f-1)*b)+d},easeInOutCirc:function(a,b,d,c,f){return 1>
(b/=f/2)?-c/2*(Math.sqrt(1-b*b)-1)+d:c/2*(Math.sqrt(1-(b-=2)*b)+1)+d},easeInElastic:function(a,b,d,c,f){var a=1.70158,k=0.3*f,j=c;if(0==b)return d;if(1==(b/=f))return d+c;j<Math.abs(c)?(j=c,a=k/4):a=k/(2*Math.PI)*Math.asin(c/j);return-(j*Math.pow(2,10*(b-=1))*Math.sin((b*f-a)*2*Math.PI/k))+d},easeOutElastic:function(a,b,d,c,f){var a=1.70158,k=0.3*f,j=c;if(0==b)return d;if(1==(b/=f))return d+c;j<Math.abs(c)?(j=c,a=k/4):a=k/(2*Math.PI)*Math.asin(c/j);return j*Math.pow(2,-10*b)*Math.sin((b*f-a)*2*Math.PI/
k)+c+d},easeInOutElastic:function(a,b,d,c,f){var a=1.70158,k=f*0.3*1.5,j=c;if(0==b)return d;if(2==(b/=f/2))return d+c;j<Math.abs(c)?(j=c,a=k/4):a=k/(2*Math.PI)*Math.asin(c/j);return 1>b?-0.5*j*Math.pow(2,10*(b-=1))*Math.sin((b*f-a)*2*Math.PI/k)+d:0.5*j*Math.pow(2,-10*(b-=1))*Math.sin((b*f-a)*2*Math.PI/k)+c+d},easeInBack:function(b,d,c,f,k,j){j==a&&(j=1.70158);return f*(d/=k)*d*((j+1)*d-j)+c},easeOutBack:function(b,d,c,f,k,j){j==a&&(j=1.70158);return f*((d=d/k-1)*d*((j+1)*d+j)+1)+c},easeInOutBack:function(b,
d,c,f,k,j){j==a&&(j=1.70158);return 1>(d/=k/2)?f/2*d*d*(((j*=1.525)+1)*d-j)+c:f/2*((d-=2)*d*(((j*=1.525)+1)*d+j)+2)+c},easeInBounce:function(a,b,d,c,f){return c-e.easing.easeOutBounce(a,f-b,0,c,f)+d},easeOutBounce:function(a,b,d,c,f){return(b/=f)<1/2.75?c*7.5625*b*b+d:b<2/2.75?c*(7.5625*(b-=1.5/2.75)*b+0.75)+d:b<2.5/2.75?c*(7.5625*(b-=2.25/2.75)*b+0.9375)+d:c*(7.5625*(b-=2.625/2.75)*b+0.984375)+d},easeInOutBounce:function(a,b,d,c,f){return b<f/2?0.5*e.easing.easeInBounce(a,2*b,0,c,f)+d:0.5*e.easing.easeOutBounce(a,
2*b-f,0,c,f)+0.5*c+d}})}(m);(function(e){var a=/up|down|vertical/,g=/up|left|vertical|horizontal/;e.effects.effect.blind=function(c,b){var j=e(this),l="position top bottom left right height width".split(" "),f=e.effects.setMode(j,c.mode||"hide"),k=c.direction||"up",d=a.test(k),q=d?"height":"width",o=d?"top":"left",k=g.test(k),r={},p="show"===f,u,t;j.parent().is(".ui-effects-wrapper")?e.effects.save(j.parent(),l):e.effects.save(j,l);j.show();u=e.effects.createWrapper(j).css({overflow:"hidden"});t=
u[q]();r[q]=p?t:0;k||(j.css(d?"bottom":"right",0).css(d?"top":"left","").css({position:"absolute"}),r[o]=p?0:t);p&&(u.css(q,0),k||u.css(o,t));u.animate(r,{duration:c.duration,easing:c.easing,queue:!1,complete:function(){f==="hide"&&j.hide();e.effects.restore(j,l);e.effects.removeWrapper(j);b()}})}})(m);(function(e){e.effects.effect.bounce=function(a,g){var c=e(this),b="position top bottom left right height width".split(" "),j=e.effects.setMode(c,a.mode||"effect"),l="hide"===j,f="show"===j,k=a.direction||
"up",j=a.distance,d=a.times||5,q=2*d+(f||l?1:0),o=a.duration/q,r=a.easing,p="up"===k||"down"===k?"top":"left",k="up"===k||"left"===k,u,t,m=c.queue(),z=m.length;(f||l)&&b.push("opacity");e.effects.save(c,b);c.show();e.effects.createWrapper(c);j||(j=c["top"===p?"outerHeight":"outerWidth"]()/3);f&&(t={opacity:1},t[p]=0,c.css("opacity",0).css(p,k?2*-j:2*j).animate(t,o,r));l&&(j/=Math.pow(2,d-1));t={};for(f=t[p]=0;f<d;f++)u={},u[p]=(k?"-=":"+=")+j,c.animate(u,o,r).animate(t,o,r),j=l?2*j:j/2;l&&(u={opacity:0},
u[p]=(k?"-=":"+=")+j,c.animate(u,o,r));c.queue(function(){l&&c.hide();e.effects.restore(c,b);e.effects.removeWrapper(c);g()});1<z&&m.splice.apply(m,[1,0].concat(m.splice(z,q+1)));c.dequeue()}})(m);(function(e){e.effects.effect.clip=function(a,g){var c=e(this),b="position top bottom left right height width".split(" "),j="show"===e.effects.setMode(c,a.mode||"hide"),l="vertical"===(a.direction||"vertical"),f=l?"height":"width",l=l?"top":"left",k={},d,q;e.effects.save(c,b);c.show();d=e.effects.createWrapper(c).css({overflow:"hidden"});
d="IMG"===c[0].tagName?d:c;q=d[f]();j&&(d.css(f,0),d.css(l,q/2));k[f]=j?q:0;k[l]=j?0:q/2;d.animate(k,{queue:!1,duration:a.duration,easing:a.easing,complete:function(){j||c.hide();e.effects.restore(c,b);e.effects.removeWrapper(c);g()}})}})(m);(function(e){e.effects.effect.drop=function(a,g){var c=e(this),b="position top bottom left right opacity height width".split(" "),j=e.effects.setMode(c,a.mode||"hide"),l="show"===j,f=a.direction||"left",k="up"===f||"down"===f?"top":"left",f="up"===f||"left"===
f?"pos":"neg",d={opacity:l?1:0},q;e.effects.save(c,b);c.show();e.effects.createWrapper(c);q=a.distance||c["top"==k?"outerHeight":"outerWidth"]({margin:!0})/2;l&&c.css("opacity",0).css(k,"pos"==f?-q:q);d[k]=(l?"pos"===f?"+=":"-=":"pos"===f?"-=":"+=")+q;c.animate(d,{queue:!1,duration:a.duration,easing:a.easing,complete:function(){"hide"==j&&c.hide();e.effects.restore(c,b);e.effects.removeWrapper(c);g()}})}})(m);(function(e){e.effects.effect.explode=function(a,g){function c(){o.push(this);o.length==
b*j&&(l.css({visibility:"visible"}),e(o).remove(),f||l.hide(),g())}var b=a.pieces?Math.round(Math.sqrt(a.pieces)):3,j=b,l=e(this),f="show"===e.effects.setMode(l,a.mode||"hide"),k=l.show().css("visibility","hidden").offset(),d=Math.ceil(l.outerWidth()/j),q=Math.ceil(l.outerHeight()/b),o=[],r,p,u,t,m,z;for(r=0;r<b;r++){t=k.top+r*q;z=r-(b-1)/2;for(p=0;p<j;p++)u=k.left+p*d,m=p-(j-1)/2,l.clone().appendTo("body").wrap("<div></div>").css({position:"absolute",visibility:"visible",left:-p*d,top:-r*q}).parent().addClass("ui-effects-explode").css({position:"absolute",
overflow:"hidden",width:d,height:q,left:u+(f?m*d:0),top:t+(f?z*q:0),opacity:f?0:1}).animate({left:u+(f?0:m*d),top:t+(f?0:z*q),opacity:f?1:0},a.duration||500,a.easing,c)}}})(m);(function(e){e.effects.effect.fade=function(a,g){var c=e(this),b="hide"===e.effects.setMode(c,a.mode||"toggle");c.show();c.animate({opacity:b?0:1},{queue:!1,duration:a.duration,easing:a.easing,complete:function(){b&&c.hide();g()}})}})(m);(function(e){e.effects.effect.fold=function(a,g){var c=e(this),b="position top bottom left right height width".split(" "),
j=e.effects.setMode(c,a.mode||"hide"),l="show"===j,f="hide"===j,j=a.size||15,k=/([0-9]+)%/.exec(j),d=!!a.horizFirst,q=l!=d,o=q?["width","height"]:["height","width"],r=a.duration/2,p,u={},t={};e.effects.save(c,b);c.show();p=e.effects.createWrapper(c).css({overflow:"hidden"});q=q?[p.width(),p.height()]:[p.height(),p.width()];k&&(j=parseInt(k[1],10)/100*q[f?0:1]);l&&p.css(d?{height:0,width:j}:{height:j,width:0});u[o[0]]=l?q[0]:j;t[o[1]]=l?q[1]:0;p.animate(u,r,a.easing).animate(t,r,a.easing,function(){f&&
c.hide();e.effects.restore(c,b);e.effects.removeWrapper(c);g()})}})(m);(function(e){e.effects.effect.highlight=function(a,g){var c=e(this),b=["backgroundImage","backgroundColor","opacity"],j=e.effects.setMode(c,a.mode||"show"),l={backgroundColor:c.css("backgroundColor")};"hide"===j&&(l.opacity=0);e.effects.save(c,b);c.show().css({backgroundImage:"none",backgroundColor:a.color||"#ffff99"}).animate(l,{queue:!1,duration:a.duration,easing:a.easing,complete:function(){j==="hide"&&c.hide();e.effects.restore(c,
b);g()}})}})(m);(function(e){e.effects.effect.pulsate=function(a,g){var c=e(this),b=e.effects.setMode(c,a.mode||"show"),j="show"===b,l="hide"===b,b=2*(a.times||5)+(j||"hide"===b?1:0),f=a.duration/b,k=0,d=c.queue(),q=d.length;if(j||!c.is(":visible"))c.css("opacity",0).show(),k=1;for(j=1;j<b;j++)c.animate({opacity:k},f,a.easing),k=1-k;c.animate({opacity:k},f,a.easing);c.queue(function(){l&&c.hide();g()});1<q&&d.splice.apply(d,[1,0].concat(d.splice(q,b+1)));c.dequeue()}})(m);(function(e){e.effects.effect.puff=
function(a,g){var c=e(this),b=e.effects.setMode(c,a.mode||"hide"),j="hide"===b,l=parseInt(a.percent,10)||150,f=l/100,k={height:c.height(),width:c.width()};e.extend(a,{effect:"scale",queue:!1,fade:!0,mode:b,complete:g,percent:j?l:100,from:j?k:{height:k.height*f,width:k.width*f}});c.effect(a)};e.effects.effect.scale=function(a,g){var c=e(this),b=e.extend(!0,{},a),j=e.effects.setMode(c,a.mode||"effect"),l=parseInt(a.percent,10)||(0==parseInt(a.percent,10)?0:"hide"==j?0:100),f=a.direction||"both",k=a.origin,
d={height:c.height(),width:c.width(),outerHeight:c.outerHeight(),outerWidth:c.outerWidth()},q="horizontal"!=f?l/100:1,l="vertical"!=f?l/100:1;b.effect="size";b.queue=!1;b.complete=g;"effect"!=j&&(b.origin=k||["middle","center"],b.restore=!0);b.from=a.from||("show"==j?{height:0,width:0}:d);b.to={height:d.height*q,width:d.width*l,outerHeight:d.outerHeight*q,outerWidth:d.outerWidth*l};if(b.fade&&("show"==j&&(b.from.opacity=0,b.to.opacity=1),"hide"==j))b.from.opacity=1,b.to.opacity=0;c.effect(b)};e.effects.effect.size=
function(a,g){var c,b,j,l,f=e(this),k="position top bottom left right width height overflow opacity".split(" "),d="position top bottom left right overflow opacity".split(" "),q=["width","height","overflow"],o=["fontSize"],r=["borderTopWidth","borderBottomWidth","paddingTop","paddingBottom"],p=["borderLeftWidth","borderRightWidth","paddingLeft","paddingRight"],u=e.effects.setMode(f,a.mode||"effect"),t=a.restore||"effect"!==u,m=a.scale||"both",z=a.origin||["middle","center"],x,v,A=f.css("position"),
B="auto"!==f.css("bottom")?"bottom":"top";originalHorizontalPositioning="auto"!==f.css("right")?"right":"left";"show"===u&&f.show();x={height:f.height(),width:f.width(),outerHeight:f.outerHeight(),outerWidth:f.outerWidth()};f.from=a.from||x;f.to=a.to||x;j=f.from.height/x.height;l=f.from.width/x.width;c=f.to.height/x.height;b=f.to.width/x.width;if("box"==m||"both"==m)if(j!==c&&(k=k.concat(r),f.from=e.effects.setTransition(f,r,j,f.from),f.to=e.effects.setTransition(f,r,c,f.to)),l!==b)k=k.concat(p),
f.from=e.effects.setTransition(f,p,l,f.from),f.to=e.effects.setTransition(f,p,b,f.to);if(("content"==m||"both"==m)&&j!==c)k=k.concat(o),f.from=e.effects.setTransition(f,o,j,f.from),f.to=e.effects.setTransition(f,o,c,f.to);e.effects.save(f,t?k:d);f.show();e.effects.createWrapper(f);f.css("overflow","hidden").css(f.from);z&&(v=e.effects.getBaseline(z,x),f.from.top=(x.outerHeight-f.outerHeight())*v.y,f.from.left=(x.outerWidth-f.outerWidth())*v.x,f.to.top=(x.outerHeight-f.to.outerHeight)*v.y,f.to.left=
(x.outerWidth-f.to.outerWidth)*v.x);f.css(f.from);if("content"==m||"both"==m)r=r.concat(["marginTop","marginBottom"]).concat(o),p=p.concat(["marginLeft","marginRight"]),q=k.concat(r).concat(p),f.find("*[width]").each(function(){var d=e(this),f=d.height(),k=d.width();t&&e.effects.save(d,q);d.from={height:f*j,width:k*l};d.to={height:f*c,width:k*b};if(j!=c){d.from=e.effects.setTransition(d,r,j,d.from);d.to=e.effects.setTransition(d,r,c,d.to)}if(l!=b){d.from=e.effects.setTransition(d,p,l,d.from);d.to=
e.effects.setTransition(d,p,b,d.to)}d.css(d.from);d.animate(d.to,a.duration,a.easing,function(){t&&e.effects.restore(d,q)})});f.animate(f.to,{queue:!1,duration:a.duration,easing:a.easing,complete:function(){f.to.opacity===0&&f.css("opacity",f.from.opacity);u=="hide"&&f.hide();e.effects.restore(f,t?k:d);t||(A==="static"?f.css({position:"relative",top:f.to.top,left:f.to.left}):e.each([B,originalHorizontalPositioning],function(a,b){f.css(b,function(d,c){var k=parseInt(c,10),j=a?f.to.left:f.to.top,g=
a?f.to.outerWidth-f.from.outerWidth:f.to.outerHeight-f.from.outerHeight,e=z[a]===b,l=z[a]==="middle"||z[a]==="center";if(c==="auto")return j+"px";b=="left"||b=="top"||(A==="relative"?j=j*-1:l||(j=j-g*(e?-1:1)));return k+j+"px"})}));e.effects.removeWrapper(f);g()}})}})(m);(function(e){e.effects.effect.shake=function(a,g){var c=e(this),b="position top bottom left right height width".split(" "),j=e.effects.setMode(c,a.mode||"effect"),l=a.direction||"left",f=a.distance||20,k=a.times||3,d=2*k+1,q=a.duration,
o="up"==l||"down"==l?"top":"left",r="up"==l||"left"==l,l={},p={},u={},t=c.queue(),m=t.length;e.effects.save(c,b);c.show();e.effects.createWrapper(c);l[o]=(r?"-=":"+=")+f;p[o]=(r?"+=":"-=")+2*f;u[o]=(r?"-=":"+=")+2*f;c.animate(l,q,a.easing);for(f=1;f<k;f++)c.animate(p,q,a.easing).animate(u,q,a.easing);c.animate(p,q,a.easing).animate(l,q/2,a.easing).queue(function(){"hide"===j&&c.hide();e.effects.restore(c,b);e.effects.removeWrapper(c);g()});1<m&&t.splice.apply(t,[1,0].concat(t.splice(m,d+1)));c.dequeue()}})(m);
(function(e){e.effects.effect.slide=function(a,g){var c=e(this),b="position top bottom left right width height".split(" "),j=e.effects.setMode(c,a.mode||"show"),l="show"===j,f=a.direction||"left",k="up"==f||"down"==f?"top":"left",f="up"==f||"left"==f,d,q={};e.effects.save(c,b);c.show();d=a.distance||c["top"===k?"outerHeight":"outerWidth"]({margin:!0});e.effects.createWrapper(c).css({overflow:"hidden"});l&&c.css(k,f?isNaN(d)?"-"+d:-d:d);q[k]=(l?f?"+=":"-=":f?"-=":"+=")+d;c.animate(q,{queue:!1,duration:a.duration,
easing:a.easing,complete:function(){"hide"===j&&c.hide();e.effects.restore(c,b);e.effects.removeWrapper(c);g()}})}})(m);(function(e){e.effects.effect.transfer=function(a,g){var c=e(this),b=e(a.to),j="fixed"===b.css("position"),l=e("body"),f=j?l.scrollTop():0,l=j?l.scrollLeft():0,k=b.offset(),b={top:k.top-f,left:k.left-l,height:b.innerHeight(),width:b.innerWidth()},k=c.offset(),d=e('<div class="ui-effects-transfer"></div>').appendTo(document.body).addClass(a.className).css({top:k.top-f,left:k.left-
l,height:c.innerHeight(),width:c.innerWidth(),position:j?"fixed":"absolute"}).animate(b,a.duration,a.easing,function(){d.remove();g()})}})(m);(function(e){var a={};e.widget("ui.accordion",{version:"1.9m6",options:{active:0,animated:"slide",collapsible:!1,event:"click",header:"> li > :first-child,> :not(li):even",heightStyle:"auto",icons:{activeHeader:"ui-icon-triangle-1-s",header:"ui-icon-triangle-1-e"},activate:null,beforeActivate:null},_create:function(){var a=this.options;this.element.addClass("ui-accordion ui-widget ui-helper-reset");
this.headers=this.element.find(a.header).addClass("ui-accordion-header ui-helper-reset ui-state-default ui-corner-all");this._hoverable(this.headers);this._focusable(this.headers);this.headers.find(":first-child").addClass("ui-accordion-heading");this.headers.next().addClass("ui-accordion-content ui-helper-reset ui-widget-content ui-corner-bottom");!a.collapsible&&!1===a.active&&(a.active=0);0>a.active&&(a.active+=this.headers.length);this.active=this._findActive(a.active).addClass("ui-state-default ui-state-active").toggleClass("ui-corner-all").toggleClass("ui-corner-top");
this.active.next().addClass("ui-accordion-content-active");this._createIcons();this.refresh();this.element.attr("role","tablist");this.headers.attr("role","tab").bind("keydown.accordion",e.proxy(this,"_keydown")).next().attr("role","tabpanel");this.headers.not(this.active).attr({"aria-expanded":"false","aria-selected":"false",tabIndex:-1}).next().hide();this.active.length?this.active.attr({"aria-expanded":"true","aria-selected":"true",tabIndex:0}):this.headers.eq(0).attr("tabIndex",0);e.browser.safari||
this.headers.find("a").attr("tabIndex",-1);this._setupEvents(a.event)},_createIcons:function(){var a=this.options.icons;a&&(e("<span>").addClass("ui-accordion-header-icon ui-icon "+a.header).prependTo(this.headers),this.active.children(".ui-accordion-header-icon").removeClass(a.header).addClass(a.activeHeader),this.element.addClass("ui-accordion-icons"))},_destroyIcons:function(){this.headers.children(".ui-accordion-header-icon").remove();this.element.removeClass("ui-accordion-icons")},_destroy:function(){this.element.removeClass("ui-accordion ui-widget ui-helper-reset").removeAttr("role");
this.headers.unbind(".accordion").removeClass("ui-accordion-header ui-accordion-disabled ui-helper-reset ui-state-default ui-corner-all ui-state-active ui-state-disabled ui-corner-top").removeAttr("role").removeAttr("aria-expanded").removeAttr("aria-selected").removeAttr("tabIndex").find("a").removeAttr("tabIndex").end().find(".ui-accordion-heading").removeClass("ui-accordion-heading");this._destroyIcons();var a=this.headers.next().css("display","").removeAttr("role").removeClass("ui-helper-reset ui-widget-content ui-corner-bottom ui-accordion-content ui-accordion-content-active ui-accordion-disabled ui-state-disabled");
"content"!==this.options.heightStyle&&a.css("height","")},_setOption:function(a,c){"active"===a?this._activate(c):("event"===a&&(this.options.event&&this.headers.unbind(this.options.event+".accordion",this._eventHandler),this._setupEvents(c)),this._super("_setOption",a,c),"collapsible"===a&&(!c&&!1===this.options.active)&&this._activate(0),"icons"===a&&(this._destroyIcons(),c&&this._createIcons()),"disabled"===a&&this.headers.add(this.headers.next()).toggleClass("ui-accordion-disabled ui-state-disabled",
!!c))},_keydown:function(a){if(!this.options.disabled&&!a.altKey&&!a.ctrlKey){var c=e.ui.keyCode,b=this.headers.length,j=this.headers.index(a.target),l=!1;switch(a.keyCode){case c.RIGHT:case c.DOWN:l=this.headers[(j+1)%b];break;case c.LEFT:case c.UP:l=this.headers[(j-1+b)%b];break;case c.SPACE:case c.ENTER:this._eventHandler(a)}l&&(e(a.target).attr("tabIndex",-1),e(l).attr("tabIndex",0),l.focus(),a.preventDefault())}},refresh:function(){var a=this.options,c=this.element.parent(),b,j;"fill"===a.heightStyle?
(e.support.minHeight||(j=c.css("overflow"),c.css("overflow","hidden")),b=c.height(),this.element.siblings(":visible").each(function(){var a=e(this),c=a.css("position");c==="absolute"||c==="fixed"||(b=b-a.outerHeight(true))}),j&&c.css("overflow",j),this.headers.each(function(){b=b-e(this).outerHeight(true)}),this.headers.next().each(function(){e(this).height(Math.max(0,b-e(this).innerHeight()+e(this).height()))}).css("overflow","auto")):"auto"===a.heightStyle&&(b=0,this.headers.next().each(function(){b=
Math.max(b,e(this).height("").height())}).height(b));return this},_activate:function(a){a=this._findActive(a)[0];a!==this.active[0]&&(a=a||this.active[0],this._eventHandler({target:a,currentTarget:a,preventDefault:e.noop}))},_findActive:function(a){return"number"===typeof a?this.headers.eq(a):e()},_setupEvents:function(a){a&&this.headers.bind(a.split(" ").join(".accordion ")+".accordion",e.proxy(this,"_eventHandler"))},_eventHandler:function(a){var c=this.options,b=this.active,j=e(a.currentTarget),
l=j[0]===b[0],f=l&&c.collapsible,k=f?e():j.next(),d=b.next(),k={oldHeader:b,oldContent:d,newHeader:f?e():j,newContent:k};a.preventDefault();if(!c.disabled&&!(l&&!c.collapsible||!1===this._trigger("beforeActivate",a,k)))c.active=f?!1:this.headers.index(j),this.active=l?e():j,this._toggle(k),b.removeClass("ui-state-active ui-corner-top").addClass("ui-state-default ui-corner-all").children(".ui-accordion-header-icon").removeClass(c.icons.activeHeader).addClass(c.icons.header),l||(j.removeClass("ui-state-default ui-corner-all").addClass("ui-state-active ui-corner-top").children(".ui-accordion-header-icon").removeClass(c.icons.header).addClass(c.icons.activeHeader),
j.next().addClass("ui-accordion-content-active"))},_toggle:function(g){function c(){b._completed(g)}var b=this,j=b.options,l=g.newContent,f=g.oldContent;if(j.animated){var k=e.ui.accordion.animations,j=j.animated,d;k[j]||(d={easing:e.easing[j]?j:"slide",duration:700},j="slide");k[j]({toShow:l,toHide:f,prevShow:a.toShow,prevHide:a.toHide,complete:c,down:l.length&&(!f.length||l.index()<f.index())},d)}else f.hide(),l.show(),c();f.prev().attr({"aria-expanded":"false","aria-selected":"false",tabIndex:-1}).blur();
l.prev().attr({"aria-expanded":"true","aria-selected":"true",tabIndex:0}).focus()},_completed:function(a){var c=a.newContent,b=a.oldContent;"content"===this.options.heightStyle&&c.add(b).css({height:"",overflow:""});b.removeClass("ui-accordion-content-active");b.length&&(b.parent()[0].className=b.parent()[0].className);this._trigger("activate",null,a)}});e.extend(e.ui.accordion,{animations:{slide:function(g,c){if(g.prevShow||g.prevHide)g.prevHide.stop(!0,!0),g.toHide=g.prevShow;var b=g.toShow.css("overflow"),
j=g.toHide.css("overflow"),l=0,f={},k={},d=["height","paddingTop","paddingBottom"],q;a=g=e.extend({easing:"swing",duration:300},g,c);if(g.toHide.size())if(g.toShow.size()){var o=g.toShow;q=o[0].style.width;o.width(parseInt(o.parent().width(),10)-parseInt(o.css("paddingLeft"),10)-parseInt(o.css("paddingRight"),10)-(parseInt(o.css("borderLeftWidth"),10)||0)-(parseInt(o.css("borderRightWidth"),10)||0));e.each(d,function(a,b){k[b]="hide";var d=(""+e.css(g.toShow[0],b)).match(/^([\d+-.]+)(.*)$/);f[b]=
{value:"height"===b&&"0"===d[1]?1:d[1],unit:d[2]||"px"}});g.toShow.css({height:0,overflow:"hidden"}).show();g.toHide.filter(":hidden").each(g.complete).end().filter(":visible").animate(k,{step:function(a,b){if("height"==b.prop||"paddingTop"==b.prop||"paddingBottom"==b.prop)l=0===b.end-b.start?0:(b.now-b.start)/(b.end-b.start);g.toShow[0].style[b.prop]=l*f[b.prop].value+f[b.prop].unit},duration:g.duration,easing:g.easing,complete:function(){g.toShow.css({width:q,overflow:b});g.toHide.css("overflow",
j);g.complete()}})}else g.toHide.animate({height:"hide",paddingTop:"hide",paddingBottom:"hide"},g);else q=g.toShow[0].style.width,g.toShow.show().width(g.toShow.width()).hide().animate({height:"show",paddingTop:"show",paddingBottom:"show"},{duration:g.duration,easing:g.easing,complete:function(){g.toShow.width(q);g.complete()}})},bounceslide:function(a){this.slide(a,{easing:a.down?"easeOutBounce":"swing",duration:a.down?1E3:200})}}});!1!==e.uiBackCompat&&(function(a,c){a.extend(c.options,{navigation:!1,
navigationFilter:function(){return this.href.toLowerCase()===location.href.toLowerCase()}});var b=c._create;c._create=function(){if(this.options.navigation){var c=this,e=this.element.find(this.options.header),f=e.next(),k=e.add(f).find("a").filter(this.options.navigationFilter)[0];k&&e.add(f).each(function(b){if(a.contains(this,k))return c.options.active=Math.floor(b/2),!1})}b.call(this)}}(m,m.ui.accordion.prototype),function(a,c){a.extend(c.options,{heightStyle:null,autoHeight:!0,clearStyle:!1,fillSpace:!1});
var b=c._create,j=c._setOption;a.extend(c,{_create:function(){this.options.heightStyle=this.options.heightStyle||this._mergeHeightStyle();b.call(this)},_setOption:function(a,b){if("autoHeight"===a||"clearStyle"===a||"fillSpace"===a)this.options.heightStyle=this._mergeHeightStyle();j.apply(this,arguments)},_mergeHeightStyle:function(){var a=this.options;if(a.fillSpace)return"fill";if(a.clearStyle)return"content";if(a.autoHeight)return"auto"}})}(m,m.ui.accordion.prototype),function(a,c){a.extend(c.options.icons,
{activeHeader:null,headerSelected:"ui-icon-triangle-1-s"});var b=c._createIcons;c._createIcons=function(){this.options.icons.activeHeader=this.options.icons.activeHeader||this.options.icons.headerSelected;b.call(this)}}(m,m.ui.accordion.prototype),function(a,c){c.activate=c._activate;var b=c._findActive;c._findActive=function(a){-1===a&&(a=!1);a&&"number"!==typeof a&&(a=this.headers.index(this.headers.filter(a)),-1===a&&(a=!1));return b.call(this,a)}}(m,m.ui.accordion.prototype),m.ui.accordion.prototype.resize=
m.ui.accordion.prototype.refresh,function(a,c){a.extend(c.options,{change:null,changestart:null});var b=c._trigger;c._trigger=function(a,c,f){var k=b.apply(this,arguments);if(!k)return!1;"beforeActivate"===a?k=b.call(this,"changestart",c,f):"activate"===a&&(k=b.call(this,"change",c,f));return k}}(m,m.ui.accordion.prototype))})(m);(function(e){var a=0;e.widget("ui.autocomplete",{version:"1.9m6",defaultElement:"<input>",options:{appendTo:"body",autoFocus:!1,delay:300,minLength:1,position:{my:"left top",
at:"left bottom",collision:"none"},source:null,change:null,close:null,focus:null,open:null,response:null,search:null,select:null},pending:0,_create:function(){var a=this,c=this.element[0].ownerDocument,b,j;this.valueMethod=this.element[this.element.is("input,textarea")?"val":"text"];this.element.addClass("ui-autocomplete-input").attr("autocomplete","off").attr({role:"textbox","aria-autocomplete":"list","aria-haspopup":"true"}).bind("keydown.autocomplete",function(c){if(a.options.disabled||a.element.prop("readOnly"))j=
b=!0;else{j=b=!1;var f=e.ui.keyCode;switch(c.keyCode){case f.PAGE_UP:b=!0;a._move("previousPage",c);break;case f.PAGE_DOWN:b=!0;a._move("nextPage",c);break;case f.UP:b=!0;a._move("previous",c);c.preventDefault();break;case f.DOWN:b=!0;a._move("next",c);c.preventDefault();break;case f.ENTER:case f.NUMPAD_ENTER:a.menu.active&&(b=!0,c.preventDefault());case f.TAB:if(!a.menu.active)break;a.menu.select(c);break;case f.ESCAPE:a._value(a.term);a.close(c);break;default:a._searchTimeout(c)}}}).bind("keypress.autocomplete",
function(c){if(b)b=!1,c.preventDefault();else{var f=e.ui.keyCode;switch(c.keyCode){case f.PAGE_UP:a._move("previousPage",c);break;case f.PAGE_DOWN:a._move("nextPage",c);break;case f.UP:a._move("previous",c);c.preventDefault();break;case f.DOWN:a._move("next",c),c.preventDefault()}}}).bind("input.autocomplete",function(b){j?(j=!1,b.preventDefault()):a._searchTimeout(b)}).bind("focus.autocomplete",function(){a.options.disabled||(a.selectedItem=null,a.previous=a._value())}).bind("blur.autocomplete",
function(b){a.options.disabled||(clearTimeout(a.searching),a.closing=setTimeout(function(){a.close(b);a._change(b)},150))});this._initSource();this.response=function(){return a._response.apply(a,arguments)};this.menu=e("<ul></ul>").addClass("ui-autocomplete").appendTo(e(this.options.appendTo||"body",c)[0]).mousedown(function(b){var c=a.menu.element[0];e(b.target).closest(".ui-menu-item").length||setTimeout(function(){e(document).one("mousedown",function(b){b.target!==a.element[0]&&(b.target!==c&&
!e.contains(c,b.target))&&a.close()})},1);setTimeout(function(){clearTimeout(a.closing)},13)}).menu({input:e(),focus:function(b,c){var k=c.item.data("item.autocomplete");!1!==a._trigger("focus",b,{item:k})&&/^key/.test(b.originalEvent.type)&&a._value(k.value)},select:function(b,f){var k=f.item.data("item.autocomplete"),d=a.previous;a.element[0]!==c.activeElement&&(a.element.focus(),a.previous=d,setTimeout(function(){a.previous=d;a.selectedItem=k},1));!1!==a._trigger("select",b,{item:k})&&a._value(k.value);
a.term=a._value();a.close(b);a.selectedItem=k},blur:function(){a.menu.element.is(":visible")&&a._value()!==a.term&&a._value(a.term)}}).zIndex(this.element.zIndex()+1).hide().data("menu");e.fn.bgiframe&&this.menu.element.bgiframe()},_destroy:function(){clearTimeout(this.searching);this.element.removeClass("ui-autocomplete-input").removeAttr("autocomplete").removeAttr("role").removeAttr("aria-autocomplete").removeAttr("aria-haspopup");this.menu.element.remove()},_setOption:function(a,c){this._super("_setOption",
a,c);"source"===a&&this._initSource();"appendTo"===a&&this.menu.element.appendTo(e(c||"body",this.element[0].ownerDocument)[0]);"disabled"===a&&(c&&this.xhr)&&this.xhr.abort()},_initSource:function(){var g=this,c,b;e.isArray(this.options.source)?(c=this.options.source,this.source=function(a,b){b(e.ui.autocomplete.filter(c,a.term))}):"string"===typeof this.options.source?(b=this.options.source,this.source=function(c,l){g.xhr&&g.xhr.abort();g.xhr=e.ajax({url:b,data:c,dataType:"json",autocompleteRequest:++a,
success:function(b){this.autocompleteRequest===a&&l(b)},error:function(){this.autocompleteRequest===a&&l([])}})}):this.source=this.options.source},_searchTimeout:function(a){var c=this;c.searching=setTimeout(function(){c.term!=c.element.val()&&(c.selectedItem=null,c.search(null,a))},c.options.delay)},search:function(a,c){a=null!=a?a:this._value();this.term=this._value();if(a.length<this.options.minLength)return this.close(c);clearTimeout(this.closing);if(!1!==this._trigger("search",c))return this._search(a)},
_search:function(a){this.pending++;this.element.addClass("ui-autocomplete-loading");this.source({term:a},this.response)},_response:function(a){a&&(a=this._normalize(a));this._trigger("response",null,{content:a});!this.options.disabled&&a&&a.length?(this._suggest(a),this._trigger("open")):this.close();this.pending--;this.pending||this.element.removeClass("ui-autocomplete-loading")},close:function(a){clearTimeout(this.closing);this.menu.element.is(":visible")&&(this.menu.element.hide(),this.menu.blur(),
this._trigger("close",a))},_change:function(a){this.previous!==this._value()&&this._trigger("change",a,{item:this.selectedItem})},_normalize:function(a){return a.length&&a[0].label&&a[0].value?a:e.map(a,function(a){return"string"===typeof a?{label:a,value:a}:e.extend({label:a.label||a.value,value:a.value||a.label},a)})},_suggest:function(a){var c=this.menu.element.empty().zIndex(this.element.zIndex()+1);this._renderMenu(c,a);this.menu.blur();this.menu.refresh();c.show();this._resizeMenu();c.position(e.extend({of:this.element},
this.options.position));this.options.autoFocus&&this.menu.next(new e.Event("mouseover"))},_resizeMenu:function(){var a=this.menu.element;a.outerWidth(Math.max(a.width("").outerWidth(),this.element.outerWidth()))},_renderMenu:function(a,c){var b=this;e.each(c,function(c,e){b._renderItem(a,e)})},_renderItem:function(a,c){return e("<li></li>").data("item.autocomplete",c).append(e("<a></a>").text(c.label)).appendTo(a)},_move:function(a,c){if(this.menu.element.is(":visible"))if(this.menu.first()&&/^previous/.test(a)||
this.menu.last()&&/^next/.test(a))this._value(this.term),this.menu.blur();else this.menu[a](c);else this.search(null,c)},widget:function(){return this.menu.element},_value:function(a){return this.valueMethod.apply(this.element,arguments)}});e.extend(e.ui.autocomplete,{escapeRegex:function(a){return a.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&")},filter:function(a,c){var b=RegExp(e.ui.autocomplete.escapeRegex(c),"i");return e.grep(a,function(a){return b.test(a.label||a.value||a)})}})})(m);(function(e){var a,
g,c,b,j=function(){var a=e(this).find(":ui-button");setTimeout(function(){a.button("refresh")},1)},l=function(a){var b=a.name,d=a.form,c=e([]);b&&(c=d?e(d).find("[name='"+b+"']"):e("[name='"+b+"']",a.ownerDocument).filter(function(){return!this.form}));return c};e.widget("ui.button",{version:"1.9m6",defaultElement:"<button>",options:{disabled:null,text:!0,label:null,icons:{primary:null,secondary:null}},_create:function(){this.element.closest("form").unbind("reset.button").bind("reset.button",j);"boolean"!==
typeof this.options.disabled&&(this.options.disabled=this.element.prop("disabled"));this._determineButtonType();this.hasTitle=!!this.buttonElement.attr("title");var f=this,k=this.options,d="checkbox"===this.type||"radio"===this.type,q="ui-state-hover"+(!d?" ui-state-active":"");null===k.label&&(k.label=this.buttonElement.html());this.element.is(":disabled")&&(k.disabled=!0);this.buttonElement.addClass("ui-button ui-widget ui-state-default ui-corner-all").attr("role","button").bind("mouseenter.button",
function(){if(!k.disabled){e(this).addClass("ui-state-hover");this===a&&e(this).addClass("ui-state-active")}}).bind("mouseleave.button",function(){k.disabled||e(this).removeClass(q)}).bind("click.button",function(a){if(k.disabled){a.preventDefault();a.stopImmediatePropagation()}});this.element.bind("focus.button",function(){f.buttonElement.addClass("ui-state-focus")}).bind("blur.button",function(){f.buttonElement.removeClass("ui-state-focus")});d&&(this.element.bind("change.button",function(){b||
f.refresh()}),this.buttonElement.bind("mousedown.button",function(a){if(!k.disabled){b=false;g=a.pageX;c=a.pageY}}).bind("mouseup.button",function(a){if(!k.disabled&&(g!==a.pageX||c!==a.pageY))b=true}));"checkbox"===this.type?this.buttonElement.bind("click.button",function(){if(k.disabled||b)return false;e(this).toggleClass("ui-state-active");f.buttonElement.attr("aria-pressed",f.element[0].checked)}):"radio"===this.type?this.buttonElement.bind("click.button",function(){if(k.disabled||b)return false;
e(this).addClass("ui-state-active");f.buttonElement.attr("aria-pressed","true");var a=f.element[0];l(a).not(a).map(function(){return e(this).button("widget")[0]}).removeClass("ui-state-active").attr("aria-pressed","false")}):(this.buttonElement.bind("mousedown.button",function(){if(k.disabled)return false;e(this).addClass("ui-state-active");a=this;e(document).one("mouseup",function(){a=null})}).bind("mouseup.button",function(){if(k.disabled)return false;e(this).removeClass("ui-state-active")}).bind("keydown.button",
function(a){if(k.disabled)return false;(a.keyCode==e.ui.keyCode.SPACE||a.keyCode==e.ui.keyCode.ENTER)&&e(this).addClass("ui-state-active")}).bind("keyup.button",function(){e(this).removeClass("ui-state-active")}),this.buttonElement.is("a")&&this.buttonElement.keyup(function(a){a.keyCode===e.ui.keyCode.SPACE&&e(this).click()}));this._setOption("disabled",k.disabled);this._resetButton()},_determineButtonType:function(){this.type=this.element.is(":checkbox")?"checkbox":this.element.is(":radio")?"radio":
this.element.is("input")?"input":"button";if("checkbox"===this.type||"radio"===this.type){var a=this.element.parents().last(),b="label[for='"+this.element.attr("id")+"']";this.buttonElement=a.find(b);this.buttonElement.length||(a=a.length?a.siblings():this.element.siblings(),this.buttonElement=a.filter(b),this.buttonElement.length||(this.buttonElement=a.find(b)));this.element.addClass("ui-helper-hidden-accessible");(a=this.element.is(":checked"))&&this.buttonElement.addClass("ui-state-active");this.buttonElement.prop("aria-pressed",
a)}else this.buttonElement=this.element},widget:function(){return this.buttonElement},_destroy:function(){this.element.removeClass("ui-helper-hidden-accessible");this.buttonElement.removeClass("ui-button ui-widget ui-state-default ui-corner-all ui-state-hover ui-state-active  ui-button-icons-only ui-button-icon-only ui-button-text-icons ui-button-text-icon-primary ui-button-text-icon-secondary ui-button-text-only").removeAttr("role").removeAttr("aria-pressed").html(this.buttonElement.find(".ui-button-text").html());
this.hasTitle||this.buttonElement.removeAttr("title")},_setOption:function(a,b){this._super("_setOption",a,b);"disabled"===a?b?this.element.prop("disabled",!0):this.element.prop("disabled",!1):this._resetButton()},refresh:function(){var a=this.element.is(":disabled");a!==this.options.disabled&&this._setOption("disabled",a);"radio"===this.type?l(this.element[0]).each(function(){e(this).is(":checked")?e(this).button("widget").addClass("ui-state-active").attr("aria-pressed","true"):e(this).button("widget").removeClass("ui-state-active").attr("aria-pressed",
"false")}):"checkbox"===this.type&&(this.element.is(":checked")?this.buttonElement.addClass("ui-state-active").attr("aria-pressed","true"):this.buttonElement.removeClass("ui-state-active").attr("aria-pressed","false"))},_resetButton:function(){if("input"===this.type)this.options.label&&this.element.val(this.options.label);else{var a=this.buttonElement.removeClass("ui-button-icons-only ui-button-icon-only ui-button-text-icons ui-button-text-icon-primary ui-button-text-icon-secondary ui-button-text-only"),
b=e("<span></span>").addClass("ui-button-text").html(this.options.label).appendTo(a.empty()).text(),d=this.options.icons,c=d.primary&&d.secondary,j=[];d.primary||d.secondary?(this.options.text&&j.push("ui-button-text-icon"+(c?"s":d.primary?"-primary":"-secondary")),d.primary&&a.prepend("<span class='ui-button-icon-primary ui-icon "+d.primary+"'></span>"),d.secondary&&a.append("<span class='ui-button-icon-secondary ui-icon "+d.secondary+"'></span>"),this.options.text||(j.push(c?"ui-button-icons-only":
"ui-button-icon-only"),this.hasTitle||a.attr("title",b))):j.push("ui-button-text-only");a.addClass(j.join(" "))}}});e.ui.button.version="1.9m6";e.widget("ui.buttonset",{options:{items:":button, :submit, :reset, :checkbox, :radio, a, :data(button)"},_create:function(){this.element.addClass("ui-buttonset")},_init:function(){this.refresh()},_setOption:function(a,b){"disabled"===a&&this.buttons.button("option",a,b);this._super("_setOption",a,b)},refresh:function(){var a="rtl"===this.element.css("direction");
this.buttons=this.element.find(this.options.items).filter(":ui-button").button("refresh").end().not(":ui-button").button().end().map(function(){return e(this).button("widget")[0]}).removeClass("ui-corner-all ui-corner-left ui-corner-right").filter(":first").addClass(a?"ui-corner-right":"ui-corner-left").end().filter(":last").addClass(a?"ui-corner-left":"ui-corner-right").end().end()},_destroy:function(){this.element.removeClass("ui-buttonset");this.buttons.map(function(){return e(this).button("widget")[0]}).removeClass("ui-corner-left ui-corner-right").end().button("destroy")}})})(m);
(function(e,a){function g(){this.debug=!1;this._curInst=null;this._keyEvent=!1;this._disabledInputs=[];this._inDialog=this._datepickerShowing=!1;this._mainDivId="ui-datepicker-div";this._inlineClass="ui-datepicker-inline";this._appendClass="ui-datepicker-append";this._triggerClass="ui-datepicker-trigger";this._dialogClass="ui-datepicker-dialog";this._disableClass="ui-datepicker-disabled";this._unselectableClass="ui-datepicker-unselectable";this._currentClass="ui-datepicker-current-day";this._dayOverClass=
"ui-datepicker-days-cell-over";this.regional=[];this.regional[""]={closeText:"Done",prevText:"Prev",nextText:"Next",currentText:"Today",monthNames:"January February March April May June July August September October November December".split(" "),monthNamesShort:"Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec".split(" "),dayNames:"Sunday Monday Tuesday Wednesday Thursday Friday Saturday".split(" "),dayNamesShort:"Sun Mon Tue Wed Thu Fri Sat".split(" "),dayNamesMin:"Su Mo Tu We Th Fr Sa".split(" "),
weekHeader:"Wk",dateFormat:"mm/dd/yy",firstDay:0,isRTL:!1,showMonthAfterYear:!1,yearSuffix:""};this._defaults={showOn:"focus",showAnim:"fadeIn",showOptions:{},defaultDate:null,appendText:"",buttonText:"...",buttonImage:"",buttonImageOnly:!1,hideIfNoPrevNext:!1,navigationAsDateFormat:!1,gotoCurrent:!1,changeMonth:!1,changeYear:!1,yearRange:"c-10:c+10",showOtherMonths:!1,selectOtherMonths:!1,showWeek:!1,calculateWeek:this.iso8601Week,shortYearCutoff:"+10",minDate:null,maxDate:null,duration:"fast",beforeShowDay:null,
beforeShow:null,onSelect:null,onChangeMonthYear:null,onClose:null,numberOfMonths:1,showCurrentAtPos:0,stepMonths:1,stepBigMonths:12,altField:"",altFormat:"",constrainInput:!0,showButtonPanel:!1,autoSize:!1,disabled:!1};e.extend(this._defaults,this.regional[""]);this.dpDiv=c(e('<div id="'+this._mainDivId+'" class="ui-datepicker ui-widget ui-widget-content ui-helper-clearfix ui-corner-all"></div>'))}function c(a){return a.delegate("button, .ui-datepicker-prev, .ui-datepicker-next, .ui-datepicker-calendar td a",
"mouseout",function(){e(this).removeClass("ui-state-hover");-1!=this.className.indexOf("ui-datepicker-prev")&&e(this).removeClass("ui-datepicker-prev-hover");-1!=this.className.indexOf("ui-datepicker-next")&&e(this).removeClass("ui-datepicker-next-hover")}).delegate("button, .ui-datepicker-prev, .ui-datepicker-next, .ui-datepicker-calendar td a","mouseover",function(){if(!e.datepicker._isDisabledDatepicker(l.inline?a.parent()[0]:l.input[0]))e(this).parents(".ui-datepicker-calendar").find("a").removeClass("ui-state-hover"),
e(this).addClass("ui-state-hover"),-1!=this.className.indexOf("ui-datepicker-prev")&&e(this).addClass("ui-datepicker-prev-hover"),-1!=this.className.indexOf("ui-datepicker-next")&&e(this).addClass("ui-datepicker-next-hover")})}function b(b,c){e.extend(b,c);for(var d in c)if(null==c[d]||c[d]==a)b[d]=c[d];return b}e.extend(e.ui,{datepicker:{version:"1.9m6"}});var j=(new Date).getTime(),l;e.extend(g.prototype,{markerClassName:"hasDatepicker",maxRows:4,log:function(){this.debug&&console.log.apply("",
arguments)},_widgetDatepicker:function(){return this.dpDiv},setDefaults:function(a){b(this._defaults,a||{});return this},_attachDatepicker:function(a,b){var d=null,c;for(c in this._defaults){var j=a.getAttribute("date:"+c);if(j){d=d||{};try{d[c]=eval(j)}catch(g){d[c]=j}}}c=a.nodeName.toLowerCase();j="div"==c||"span"==c;a.id||(this.uuid+=1,a.id="dp"+this.uuid);var l=this._newInst(e(a),j);l.settings=e.extend({},b||{},d||{});"input"==c?this._connectDatepicker(a,l):j&&this._inlineDatepicker(a,l)},_newInst:function(a,
b){return{id:a[0].id.replace(/([^A-Za-z0-9_-])/g,"\\\\$1"),input:a,selectedDay:0,selectedMonth:0,selectedYear:0,drawMonth:0,drawYear:0,inline:b,dpDiv:!b?this.dpDiv:c(e('<div class="'+this._inlineClass+' ui-datepicker ui-widget ui-widget-content ui-helper-clearfix ui-corner-all"></div>'))}},_connectDatepicker:function(a,b){var d=e(a);b.append=e([]);b.trigger=e([]);d.hasClass(this.markerClassName)||(this._attachments(d,b),d.addClass(this.markerClassName).keydown(this._doKeyDown).keypress(this._doKeyPress).keyup(this._doKeyUp).bind("setData.datepicker",
function(a,d,c){b.settings[d]=c}).bind("getData.datepicker",function(a,d){return this._get(b,d)}),this._autoSize(b),e.data(a,"datepicker",b),b.settings.disabled&&this._disableDatepicker(a))},_attachments:function(a,b){var d=this._get(b,"appendText"),c=this._get(b,"isRTL");b.append&&b.append.remove();d&&(b.append=e('<span class="'+this._appendClass+'">'+d+"</span>"),a[c?"before":"after"](b.append));a.unbind("focus",this._showDatepicker);b.trigger&&b.trigger.remove();d=this._get(b,"showOn");("focus"==
d||"both"==d)&&a.focus(this._showDatepicker);if("button"==d||"both"==d){var d=this._get(b,"buttonText"),j=this._get(b,"buttonImage");b.trigger=e(this._get(b,"buttonImageOnly")?e("<img/>").addClass(this._triggerClass).attr({src:j,alt:d,title:d}):e('<button type="button"></button>').addClass(this._triggerClass).html(""==j?d:e("<img/>").attr({src:j,alt:d,title:d})));a[c?"before":"after"](b.trigger);b.trigger.click(function(){e.datepicker._datepickerShowing&&e.datepicker._lastInput==a[0]?e.datepicker._hideDatepicker():
e.datepicker._showDatepicker(a[0]);return false})}},_autoSize:function(a){if(this._get(a,"autoSize")&&!a.inline){var b=new Date(2009,11,20),d=this._get(a,"dateFormat");if(d.match(/[DM]/)){var c=function(a){for(var b=0,d=0,c=0;c<a.length;c++)a[c].length>b&&(b=a[c].length,d=c);return d};b.setMonth(c(this._get(a,d.match(/MM/)?"monthNames":"monthNamesShort")));b.setDate(c(this._get(a,d.match(/DD/)?"dayNames":"dayNamesShort"))+20-b.getDay())}a.input.attr("size",this._formatDate(a,b).length)}},_inlineDatepicker:function(a,
b){var d=e(a);d.hasClass(this.markerClassName)||(d.addClass(this.markerClassName).append(b.dpDiv).bind("setData.datepicker",function(a,d,c){b.settings[d]=c}).bind("getData.datepicker",function(a,d){return this._get(b,d)}),e.data(a,"datepicker",b),this._setDate(b,this._getDefaultDate(b),!0),this._updateDatepicker(b),this._updateAlternate(b),b.settings.disabled&&this._disableDatepicker(a),b.dpDiv.css("display","block"))},_dialogDatepicker:function(a,c,d,j,g){a=this._dialogInst;a||(this.uuid+=1,this._dialogInput=
e('<input type="text" id="dp'+this.uuid+'" style="position: absolute; top: -100px; width: 0px; z-index: -10;"/>'),this._dialogInput.keydown(this._doKeyDown),e("body").append(this._dialogInput),a=this._dialogInst=this._newInst(this._dialogInput,!1),a.settings={},e.data(this._dialogInput[0],"datepicker",a));b(a.settings,j||{});c=c&&c.constructor==Date?this._formatDate(a,c):c;this._dialogInput.val(c);this._pos=g?g.length?g:[g.pageX,g.pageY]:null;this._pos||(this._pos=[document.documentElement.clientWidth/
2-100+(document.documentElement.scrollLeft||document.body.scrollLeft),document.documentElement.clientHeight/2-150+(document.documentElement.scrollTop||document.body.scrollTop)]);this._dialogInput.css("left",this._pos[0]+20+"px").css("top",this._pos[1]+"px");a.settings.onSelect=d;this._inDialog=!0;this.dpDiv.addClass(this._dialogClass);this._showDatepicker(this._dialogInput[0]);e.blockUI&&e.blockUI(this.dpDiv);e.data(this._dialogInput[0],"datepicker",a);return this},_destroyDatepicker:function(a){var b=
e(a),d=e.data(a,"datepicker");if(b.hasClass(this.markerClassName)){var c=a.nodeName.toLowerCase();e.removeData(a,"datepicker");"input"==c?(d.append.remove(),d.trigger.remove(),b.removeClass(this.markerClassName).unbind("focus",this._showDatepicker).unbind("keydown",this._doKeyDown).unbind("keypress",this._doKeyPress).unbind("keyup",this._doKeyUp)):("div"==c||"span"==c)&&b.removeClass(this.markerClassName).empty()}},_enableDatepicker:function(a){var b=e(a),d=e.data(a,"datepicker");if(b.hasClass(this.markerClassName)){var c=
a.nodeName.toLowerCase();if("input"==c)a.disabled=!1,d.trigger.filter("button").each(function(){this.disabled=!1}).end().filter("img").css({opacity:"1.0",cursor:""});else if("div"==c||"span"==c)b=b.children("."+this._inlineClass),b.children().removeClass("ui-state-disabled"),b.find("select.ui-datepicker-month, select.ui-datepicker-year").prop("disabled",!1);this._disabledInputs=e.map(this._disabledInputs,function(b){return b==a?null:b})}},_disableDatepicker:function(a){var b=e(a),d=e.data(a,"datepicker");
if(b.hasClass(this.markerClassName)){var c=a.nodeName.toLowerCase();if("input"==c)a.disabled=!0,d.trigger.filter("button").each(function(){this.disabled=!0}).end().filter("img").css({opacity:"0.5",cursor:"default"});else if("div"==c||"span"==c)b=b.children("."+this._inlineClass),b.children().addClass("ui-state-disabled"),b.find("select.ui-datepicker-month, select.ui-datepicker-year").prop("disabled",!0);this._disabledInputs=e.map(this._disabledInputs,function(b){return b==a?null:b});this._disabledInputs[this._disabledInputs.length]=
a}},_isDisabledDatepicker:function(a){if(!a)return!1;for(var b=0;b<this._disabledInputs.length;b++)if(this._disabledInputs[b]==a)return!0;return!1},_getInst:function(a){try{return e.data(a,"datepicker")}catch(b){throw"Missing instance data for this datepicker";}},_optionDatepicker:function(c,k,d){var j=this._getInst(c);if(2==arguments.length&&"string"==typeof k)return"defaults"==k?e.extend({},e.datepicker._defaults):j?"all"==k?e.extend({},j.settings):this._get(j,k):null;var g=k||{};"string"==typeof k&&
(g={},g[k]=d);if(j){this._curInst==j&&this._hideDatepicker();var l=this._getDateDatepicker(c,!0),p=this._getMinMaxDate(j,"min"),u=this._getMinMaxDate(j,"max");b(j.settings,g);null!==p&&(g.dateFormat!==a&&g.minDate===a)&&(j.settings.minDate=this._formatDate(j,p));null!==u&&(g.dateFormat!==a&&g.maxDate===a)&&(j.settings.maxDate=this._formatDate(j,u));this._attachments(e(c),j);this._autoSize(j);this._setDate(j,l);this._updateAlternate(j);this._updateDatepicker(j)}},_changeDatepicker:function(a,b,d){this._optionDatepicker(a,
b,d)},_refreshDatepicker:function(a){(a=this._getInst(a))&&this._updateDatepicker(a)},_setDateDatepicker:function(a,b){var d=this._getInst(a);d&&(this._setDate(d,b),this._updateDatepicker(d),this._updateAlternate(d))},_getDateDatepicker:function(a,b){var d=this._getInst(a);d&&!d.inline&&this._setDateFromField(d,b);return d?this._getDate(d):null},_doKeyDown:function(a){var b=e.datepicker._getInst(a.target),d=!0,c=b.dpDiv.is(".ui-datepicker-rtl");b._keyEvent=!0;if(e.datepicker._datepickerShowing)switch(a.keyCode){case 9:e.datepicker._hideDatepicker();
d=!1;break;case 13:return d=e("td."+e.datepicker._dayOverClass+":not(."+e.datepicker._currentClass+")",b.dpDiv),d[0]&&e.datepicker._selectDay(a.target,b.selectedMonth,b.selectedYear,d[0]),(a=e.datepicker._get(b,"onSelect"))?(d=e.datepicker._formatDate(b),a.apply(b.input?b.input[0]:null,[d,b])):e.datepicker._hideDatepicker(),!1;case 27:e.datepicker._hideDatepicker();break;case 33:e.datepicker._adjustDate(a.target,a.ctrlKey?-e.datepicker._get(b,"stepBigMonths"):-e.datepicker._get(b,"stepMonths"),"M");
break;case 34:e.datepicker._adjustDate(a.target,a.ctrlKey?+e.datepicker._get(b,"stepBigMonths"):+e.datepicker._get(b,"stepMonths"),"M");break;case 35:(a.ctrlKey||a.metaKey)&&e.datepicker._clearDate(a.target);d=a.ctrlKey||a.metaKey;break;case 36:(a.ctrlKey||a.metaKey)&&e.datepicker._gotoToday(a.target);d=a.ctrlKey||a.metaKey;break;case 37:if(a.ctrlKey||a.metaKey)e.datepicker._adjustDate(a.target,c?1:-1,"D");d=a.ctrlKey||a.metaKey;a.originalEvent.altKey&&e.datepicker._adjustDate(a.target,a.ctrlKey?
-e.datepicker._get(b,"stepBigMonths"):-e.datepicker._get(b,"stepMonths"),"M");break;case 38:(a.ctrlKey||a.metaKey)&&e.datepicker._adjustDate(a.target,-7,"D");d=a.ctrlKey||a.metaKey;break;case 39:if(a.ctrlKey||a.metaKey)e.datepicker._adjustDate(a.target,c?-1:1,"D");d=a.ctrlKey||a.metaKey;a.originalEvent.altKey&&e.datepicker._adjustDate(a.target,a.ctrlKey?+e.datepicker._get(b,"stepBigMonths"):+e.datepicker._get(b,"stepMonths"),"M");break;case 40:(a.ctrlKey||a.metaKey)&&e.datepicker._adjustDate(a.target,
7,"D");d=a.ctrlKey||a.metaKey;break;default:d=!1}else 36==a.keyCode&&a.ctrlKey?e.datepicker._showDatepicker(this):d=!1;d&&(a.preventDefault(),a.stopPropagation())},_doKeyPress:function(b){var c=e.datepicker._getInst(b.target);if(e.datepicker._get(c,"constrainInput")){var c=e.datepicker._possibleChars(e.datepicker._get(c,"dateFormat")),d=String.fromCharCode(b.charCode==a?b.keyCode:b.charCode);return b.ctrlKey||b.metaKey||" ">d||!c||-1<c.indexOf(d)}},_doKeyUp:function(a){a=e.datepicker._getInst(a.target);
if(a.input.val()!=a.lastVal)try{if(e.datepicker.parseDate(e.datepicker._get(a,"dateFormat"),a.input?a.input.val():null,e.datepicker._getFormatConfig(a)))e.datepicker._setDateFromField(a),e.datepicker._updateAlternate(a),e.datepicker._updateDatepicker(a)}catch(b){e.datepicker.log(b)}return!0},_showDatepicker:function(a){a=a.target||a;"input"!=a.nodeName.toLowerCase()&&(a=e("input",a.parentNode)[0]);if(!(e.datepicker._isDisabledDatepicker(a)||e.datepicker._lastInput==a)){var c=e.datepicker._getInst(a);
e.datepicker._curInst&&e.datepicker._curInst!=c&&(e.datepicker._datepickerShowing&&e.datepicker._triggerOnClose(e.datepicker._curInst),e.datepicker._curInst.dpDiv.stop(!0,!0));var d=e.datepicker._get(c,"beforeShow"),d=d?d.apply(a,[a,c]):{};if(!1!==d){b(c.settings,d);c.lastVal=null;e.datepicker._lastInput=a;e.datepicker._setDateFromField(c);e.datepicker._inDialog&&(a.value="");e.datepicker._pos||(e.datepicker._pos=e.datepicker._findPos(a),e.datepicker._pos[1]+=a.offsetHeight);var j=!1;e(a).parents().each(function(){j=
j|e(this).css("position")=="fixed";return!j});j&&e.browser.opera&&(e.datepicker._pos[0]-=document.documentElement.scrollLeft,e.datepicker._pos[1]-=document.documentElement.scrollTop);d={left:e.datepicker._pos[0],top:e.datepicker._pos[1]};e.datepicker._pos=null;c.dpDiv.empty();c.dpDiv.css({position:"absolute",display:"block",top:"-1000px"});e.datepicker._updateDatepicker(c);d=e.datepicker._checkOffset(c,d,j);c.dpDiv.css({position:e.datepicker._inDialog&&e.blockUI?"static":j?"fixed":"absolute",display:"none",
left:d.left+"px",top:d.top+"px"});if(!c.inline){var d=e.datepicker._get(c,"showAnim"),g=e.datepicker._get(c,"duration"),l=function(){var a=c.dpDiv.find("iframe.ui-datepicker-cover");if(a.length){var b=e.datepicker._getBorders(c.dpDiv);a.css({left:-b[0],top:-b[1],width:c.dpDiv.outerWidth(),height:c.dpDiv.outerHeight()})}};c.dpDiv.zIndex(e(a).zIndex()+1);e.datepicker._datepickerShowing=!0;if(e.effects&&(e.effects.effect[d]||e.effects[d]))c.dpDiv.show(d,e.datepicker._get(c,"showOptions"),g,l);else c.dpDiv[d||
"show"](d?g:null,l);(!d||!g)&&l();c.input.is(":visible")&&!c.input.is(":disabled")&&c.input.focus();e.datepicker._curInst=c}}}},_updateDatepicker:function(a){this.maxRows=4;var b=e.datepicker._getBorders(a.dpDiv);l=a;a.dpDiv.empty().append(this._generateHTML(a));var d=a.dpDiv.find("iframe.ui-datepicker-cover");d.length&&d.css({left:-b[0],top:-b[1],width:a.dpDiv.outerWidth(),height:a.dpDiv.outerHeight()});a.dpDiv.find("."+this._dayOverClass+" a").mouseover();b=this._getNumberOfMonths(a);d=b[1];a.dpDiv.removeClass("ui-datepicker-multi-2 ui-datepicker-multi-3 ui-datepicker-multi-4").width("");
1<d&&a.dpDiv.addClass("ui-datepicker-multi-"+d).css("width",17*d+"em");a.dpDiv[(1!=b[0]||1!=b[1]?"add":"remove")+"Class"]("ui-datepicker-multi");a.dpDiv[(this._get(a,"isRTL")?"add":"remove")+"Class"]("ui-datepicker-rtl");a==e.datepicker._curInst&&(e.datepicker._datepickerShowing&&a.input&&a.input.is(":visible")&&!a.input.is(":disabled")&&a.input[0]!=document.activeElement)&&a.input.focus();if(a.yearshtml){var c=a.yearshtml;setTimeout(function(){c===a.yearshtml&&a.yearshtml&&a.dpDiv.find("select.ui-datepicker-year:first").replaceWith(a.yearshtml);
c=a.yearshtml=null},0)}},_getBorders:function(a){var b=function(a){return{thin:1,medium:2,thick:3}[a]||a};return[parseFloat(b(a.css("border-left-width"))),parseFloat(b(a.css("border-top-width")))]},_checkOffset:function(a,b,d){var c=a.dpDiv.outerWidth(),j=a.dpDiv.outerHeight(),g=a.input?a.input.outerWidth():0,l=a.input?a.input.outerHeight():0,u=document.documentElement.clientWidth+e(document).scrollLeft(),t=document.documentElement.clientHeight+e(document).scrollTop();b.left-=this._get(a,"isRTL")?
c-g:0;b.left-=d&&b.left==a.input.offset().left?e(document).scrollLeft():0;b.top-=d&&b.top==a.input.offset().top+l?e(document).scrollTop():0;b.left-=Math.min(b.left,b.left+c>u&&u>c?Math.abs(b.left+c-u):0);b.top-=Math.min(b.top,b.top+j>t&&t>j?Math.abs(j+l):0);return b},_findPos:function(a){for(var b=this._get(this._getInst(a),"isRTL");a&&("hidden"==a.type||1!=a.nodeType||e.expr.filters.hidden(a));)a=a[b?"previousSibling":"nextSibling"];a=e(a).offset();return[a.left,a.top]},_triggerOnClose:function(a){var b=
this._get(a,"onClose");b&&b.apply(a.input?a.input[0]:null,[a.input?a.input.val():"",a])},_hideDatepicker:function(a){var b=this._curInst;if(b&&!(a&&b!=e.data(a,"datepicker"))&&this._datepickerShowing){var a=this._get(b,"showAnim"),d=this._get(b,"duration"),c=function(){e.datepicker._tidyDialog(b);this._curInst=null};if(e.effects&&(e.effects.effect[a]||e.effects[a]))b.dpDiv.hide(a,e.datepicker._get(b,"showOptions"),d,c);else b.dpDiv["slideDown"==a?"slideUp":"fadeIn"==a?"fadeOut":"hide"](a?d:null,c);
a||c();e.datepicker._triggerOnClose(b);this._datepickerShowing=!1;this._lastInput=null;this._inDialog&&(this._dialogInput.css({position:"absolute",left:"0",top:"-100px"}),e.blockUI&&(e.unblockUI(),e("body").append(this.dpDiv)));this._inDialog=!1}},_tidyDialog:function(a){a.dpDiv.removeClass(this._dialogClass).unbind(".ui-datepicker-calendar")},_checkExternalClick:function(a){e.datepicker._curInst&&(a=e(a.target),a[0].id!=e.datepicker._mainDivId&&(0==a.parents("#"+e.datepicker._mainDivId).length&&
!a.hasClass(e.datepicker.markerClassName)&&!a.hasClass(e.datepicker._triggerClass)&&e.datepicker._datepickerShowing&&(!e.datepicker._inDialog||!e.blockUI))&&e.datepicker._hideDatepicker())},_adjustDate:function(a,b,d){var a=e(a),c=this._getInst(a[0]);this._isDisabledDatepicker(a[0])||(this._adjustInstDate(c,b+("M"==d?this._get(c,"showCurrentAtPos"):0),d),this._updateDatepicker(c))},_gotoToday:function(a){var a=e(a),b=this._getInst(a[0]);if(this._get(b,"gotoCurrent")&&b.currentDay)b.selectedDay=b.currentDay,
b.drawMonth=b.selectedMonth=b.currentMonth,b.drawYear=b.selectedYear=b.currentYear;else{var d=new Date;b.selectedDay=d.getDate();b.drawMonth=b.selectedMonth=d.getMonth();b.drawYear=b.selectedYear=d.getFullYear()}this._notifyChange(b);this._adjustDate(a)},_selectMonthYear:function(a,b,d){var a=e(a),c=this._getInst(a[0]);c["selected"+("M"==d?"Month":"Year")]=c["draw"+("M"==d?"Month":"Year")]=parseInt(b.options[b.selectedIndex].value,10);this._notifyChange(c);this._adjustDate(a)},_selectDay:function(a,
b,d,c){var j=e(a);!e(c).hasClass(this._unselectableClass)&&!this._isDisabledDatepicker(j[0])&&(j=this._getInst(j[0]),j.selectedDay=j.currentDay=e("a",c).html(),j.selectedMonth=j.currentMonth=b,j.selectedYear=j.currentYear=d,this._selectDate(a,this._formatDate(j,j.currentDay,j.currentMonth,j.currentYear)))},_clearDate:function(a){a=e(a);this._getInst(a[0]);this._selectDate(a,"")},_selectDate:function(a,b){var d=this._getInst(e(a)[0]),b=null!=b?b:this._formatDate(d);d.input&&d.input.val(b);this._updateAlternate(d);
var c=this._get(d,"onSelect");c?c.apply(d.input?d.input[0]:null,[b,d]):d.input&&d.input.trigger("change");d.inline?this._updateDatepicker(d):(this._hideDatepicker(),this._lastInput=d.input[0],"object"!=typeof d.input[0]&&d.input.focus(),this._lastInput=null)},_updateAlternate:function(a){var b=this._get(a,"altField");if(b){var d=this._get(a,"altFormat")||this._get(a,"dateFormat"),c=this._getDate(a),j=this.formatDate(d,c,this._getFormatConfig(a));e(b).each(function(){e(this).val(j)})}},noWeekends:function(a){a=
a.getDay();return[0<a&&6>a,""]},iso8601Week:function(a){a=new Date(a.getTime());a.setDate(a.getDate()+4-(a.getDay()||7));var b=a.getTime();a.setMonth(0);a.setDate(1);return Math.floor(Math.round((b-a)/864E5)/7)+1},parseDate:function(a,b,d){if(null==a||null==b)throw"Invalid arguments";b="object"==typeof b?b.toString():b+"";if(""==b)return null;for(var c=(d?d.shortYearCutoff:null)||this._defaults.shortYearCutoff,c="string"!=typeof c?c:(new Date).getFullYear()%100+parseInt(c,10),j=(d?d.dayNamesShort:
null)||this._defaults.dayNamesShort,g=(d?d.dayNames:null)||this._defaults.dayNames,l=(d?d.monthNamesShort:null)||this._defaults.monthNamesShort,u=(d?d.monthNames:null)||this._defaults.monthNames,t=d=-1,m=-1,z=-1,x=!1,v=function(b){(b=J+1<a.length&&a.charAt(J+1)==b)&&J++;return b},A=function(a){var d=v(a),a=RegExp("^\\d{1,"+("@"==a?14:"!"==a?20:"y"==a&&d?4:"o"==a?3:2)+"}"),a=b.substring(F).match(a);if(!a)throw"Missing number at position "+F;F+=a[0].length;return parseInt(a[0],10)},B=function(a,d,c){var a=
e.map(v(a)?c:d,function(a,b){return[[b,a]]}).sort(function(a,b){return-(a[1].length-b[1].length)}),f=-1;e.each(a,function(a,d){var c=d[1];if(b.substr(F,c.length).toLowerCase()==c.toLowerCase())return f=d[0],F+=c.length,!1});if(-1!=f)return f+1;throw"Unknown name at position "+F;},E=function(){if(b.charAt(F)!=a.charAt(J))throw"Unexpected literal at position "+F;F++},F=0,J=0;J<a.length;J++)if(x)"'"==a.charAt(J)&&!v("'")?x=!1:E();else switch(a.charAt(J)){case "d":m=A("d");break;case "D":B("D",j,g);break;
case "o":z=A("o");break;case "m":t=A("m");break;case "M":t=B("M",l,u);break;case "y":d=A("y");break;case "@":var I=new Date(A("@")),d=I.getFullYear(),t=I.getMonth()+1,m=I.getDate();break;case "!":I=new Date((A("!")-this._ticksTo1970)/1E4);d=I.getFullYear();t=I.getMonth()+1;m=I.getDate();break;case "'":v("'")?E():x=!0;break;default:E()}if(F<b.length&&(j=b.substr(F),!/^\s+/.test(j)))throw"Extra/unparsed characters found in date: "+j;-1==d?d=(new Date).getFullYear():100>d&&(d+=(new Date).getFullYear()-
(new Date).getFullYear()%100+(d<=c?0:-100));if(-1<z){t=1;m=z;do{c=this._getDaysInMonth(d,t-1);if(m<=c)break;t++;m-=c}while(1)}I=this._daylightSavingAdjust(new Date(d,t-1,m));if(I.getFullYear()!=d||I.getMonth()+1!=t||I.getDate()!=m)throw"Invalid date";return I},ATOM:"yy-mm-dd",COOKIE:"D, dd M yy",ISO_8601:"yy-mm-dd",RFC_822:"D, d M y",RFC_850:"DD, dd-M-y",RFC_1036:"D, d M y",RFC_1123:"D, d M yy",RFC_2822:"D, d M yy",RSS:"D, d M y",TICKS:"!",TIMESTAMP:"@",W3C:"yy-mm-dd",_ticksTo1970:864E9*(718685+Math.floor(492.5)-
Math.floor(19.7)+Math.floor(4.925)),formatDate:function(a,b,d){if(!b)return"";var c=(d?d.dayNamesShort:null)||this._defaults.dayNamesShort,j=(d?d.dayNames:null)||this._defaults.dayNames,g=(d?d.monthNamesShort:null)||this._defaults.monthNamesShort,d=(d?d.monthNames:null)||this._defaults.monthNames,e=function(b){(b=x+1<a.length&&a.charAt(x+1)==b)&&x++;return b},l=function(a,b,d){b=""+b;if(e(a))for(;b.length<d;)b="0"+b;return b},m=function(a,b,d,c){return e(a)?c[b]:d[b]},y="",z=!1;if(b)for(var x=0;x<
a.length;x++)if(z)"'"==a.charAt(x)&&!e("'")?z=!1:y+=a.charAt(x);else switch(a.charAt(x)){case "d":y+=l("d",b.getDate(),2);break;case "D":y+=m("D",b.getDay(),c,j);break;case "o":y+=l("o",Math.round(((new Date(b.getFullYear(),b.getMonth(),b.getDate())).getTime()-(new Date(b.getFullYear(),0,0)).getTime())/864E5),3);break;case "m":y+=l("m",b.getMonth()+1,2);break;case "M":y+=m("M",b.getMonth(),g,d);break;case "y":y+=e("y")?b.getFullYear():(10>b.getYear()%100?"0":"")+b.getYear()%100;break;case "@":y+=
b.getTime();break;case "!":y+=1E4*b.getTime()+this._ticksTo1970;break;case "'":e("'")?y+="'":z=!0;break;default:y+=a.charAt(x)}return y},_possibleChars:function(a){for(var b="",d=!1,c=function(b){(b=j+1<a.length&&a.charAt(j+1)==b)&&j++;return b},j=0;j<a.length;j++)if(d)"'"==a.charAt(j)&&!c("'")?d=!1:b+=a.charAt(j);else switch(a.charAt(j)){case "d":case "m":case "y":case "@":b+="0123456789";break;case "D":case "M":return null;case "'":c("'")?b+="'":d=!0;break;default:b+=a.charAt(j)}return b},_get:function(b,
c){return b.settings[c]!==a?b.settings[c]:this._defaults[c]},_setDateFromField:function(a,b){if(a.input.val()!=a.lastVal){var d=this._get(a,"dateFormat"),c=a.lastVal=a.input?a.input.val():null,j,g;j=g=this._getDefaultDate(a);var e=this._getFormatConfig(a);try{j=this.parseDate(d,c,e)||g}catch(l){this.log(l),c=b?"":c}a.selectedDay=j.getDate();a.drawMonth=a.selectedMonth=j.getMonth();a.drawYear=a.selectedYear=j.getFullYear();a.currentDay=c?j.getDate():0;a.currentMonth=c?j.getMonth():0;a.currentYear=
c?j.getFullYear():0;this._adjustInstDate(a)}},_getDefaultDate:function(a){return this._restrictMinMax(a,this._determineDate(a,this._get(a,"defaultDate"),new Date))},_determineDate:function(a,b,d){var c=function(a){var b=new Date;b.setDate(b.getDate()+a);return b},j=function(b){try{return e.datepicker.parseDate(e.datepicker._get(a,"dateFormat"),b,e.datepicker._getFormatConfig(a))}catch(d){}for(var c=(b.toLowerCase().match(/^c/)?e.datepicker._getDate(a):null)||new Date,j=c.getFullYear(),k=c.getMonth(),
c=c.getDate(),g=/([+-]?[0-9]+)\s*(d|D|w|W|m|M|y|Y)?/g,l=g.exec(b);l;){switch(l[2]||"d"){case "d":case "D":c+=parseInt(l[1],10);break;case "w":case "W":c+=7*parseInt(l[1],10);break;case "m":case "M":k+=parseInt(l[1],10);c=Math.min(c,e.datepicker._getDaysInMonth(j,k));break;case "y":case "Y":j+=parseInt(l[1],10),c=Math.min(c,e.datepicker._getDaysInMonth(j,k))}l=g.exec(b)}return new Date(j,k,c)};if(b=(b=null==b||""===b?d:"string"==typeof b?j(b):"number"==typeof b?isNaN(b)?d:c(b):new Date(b.getTime()))&&
"Invalid Date"==b.toString()?d:b)b.setHours(0),b.setMinutes(0),b.setSeconds(0),b.setMilliseconds(0);return this._daylightSavingAdjust(b)},_daylightSavingAdjust:function(a){if(!a)return null;a.setHours(12<a.getHours()?a.getHours()+2:0);return a},_setDate:function(a,b,d){var c=!b,j=a.selectedMonth,g=a.selectedYear,b=this._restrictMinMax(a,this._determineDate(a,b,new Date));a.selectedDay=a.currentDay=b.getDate();a.drawMonth=a.selectedMonth=a.currentMonth=b.getMonth();a.drawYear=a.selectedYear=a.currentYear=
b.getFullYear();(j!=a.selectedMonth||g!=a.selectedYear)&&!d&&this._notifyChange(a);this._adjustInstDate(a);a.input&&a.input.val(c?"":this._formatDate(a))},_getDate:function(a){return!a.currentYear||a.input&&""==a.input.val()?null:this._daylightSavingAdjust(new Date(a.currentYear,a.currentMonth,a.currentDay))},_generateHTML:function(a){var b=new Date,b=this._daylightSavingAdjust(new Date(b.getFullYear(),b.getMonth(),b.getDate())),d=this._get(a,"isRTL"),c=this._get(a,"showButtonPanel"),g=this._get(a,
"hideIfNoPrevNext"),l=this._get(a,"navigationAsDateFormat"),p=this._getNumberOfMonths(a),u=this._get(a,"showCurrentAtPos"),m=this._get(a,"stepMonths"),y=1!=p[0]||1!=p[1],z=this._daylightSavingAdjust(!a.currentDay?new Date(9999,9,9):new Date(a.currentYear,a.currentMonth,a.currentDay)),x=this._getMinMaxDate(a,"min"),v=this._getMinMaxDate(a,"max"),u=a.drawMonth-u,A=a.drawYear;0>u&&(u+=12,A--);if(v)for(var B=this._daylightSavingAdjust(new Date(v.getFullYear(),v.getMonth()-p[0]*p[1]+1,v.getDate())),B=
x&&B<x?x:B;this._daylightSavingAdjust(new Date(A,u,1))>B;)u--,0>u&&(u=11,A--);a.drawMonth=u;a.drawYear=A;var B=this._get(a,"prevText"),B=!l?B:this.formatDate(B,this._daylightSavingAdjust(new Date(A,u-m,1)),this._getFormatConfig(a)),B=this._canAdjustMonth(a,-1,A,u)?'<a class="ui-datepicker-prev ui-corner-all" onclick="DP_jQuery_'+j+".datepicker._adjustDate('#"+a.id+"', -"+m+", 'M');\" title=\""+B+'"><span class="ui-icon ui-icon-circle-triangle-'+(d?"e":"w")+'">'+B+"</span></a>":g?"":'<a class="ui-datepicker-prev ui-corner-all ui-state-disabled" title="'+
B+'"><span class="ui-icon ui-icon-circle-triangle-'+(d?"e":"w")+'">'+B+"</span></a>",E=this._get(a,"nextText"),E=!l?E:this.formatDate(E,this._daylightSavingAdjust(new Date(A,u+m,1)),this._getFormatConfig(a)),g=this._canAdjustMonth(a,1,A,u)?'<a class="ui-datepicker-next ui-corner-all" onclick="DP_jQuery_'+j+".datepicker._adjustDate('#"+a.id+"', +"+m+", 'M');\" title=\""+E+'"><span class="ui-icon ui-icon-circle-triangle-'+(d?"w":"e")+'">'+E+"</span></a>":g?"":'<a class="ui-datepicker-next ui-corner-all ui-state-disabled" title="'+
E+'"><span class="ui-icon ui-icon-circle-triangle-'+(d?"w":"e")+'">'+E+"</span></a>",m=this._get(a,"currentText"),E=this._get(a,"gotoCurrent")&&a.currentDay?z:b,m=!l?m:this.formatDate(m,E,this._getFormatConfig(a)),l=!a.inline?'<button type="button" class="ui-datepicker-close ui-state-default ui-priority-primary ui-corner-all" onclick="DP_jQuery_'+j+'.datepicker._hideDatepicker();">'+this._get(a,"closeText")+"</button>":"",c=c?'<div class="ui-datepicker-buttonpane ui-widget-content">'+(d?l:"")+(this._isInRange(a,
E)?'<button type="button" class="ui-datepicker-current ui-state-default ui-priority-secondary ui-corner-all" onclick="DP_jQuery_'+j+".datepicker._gotoToday('#"+a.id+"');\">"+m+"</button>":"")+(d?"":l)+"</div>":"",l=parseInt(this._get(a,"firstDay"),10),l=isNaN(l)?0:l,m=this._get(a,"showWeek"),E=this._get(a,"dayNames");this._get(a,"dayNamesShort");var F=this._get(a,"dayNamesMin"),J=this._get(a,"monthNames"),I=this._get(a,"monthNamesShort"),N=this._get(a,"beforeShowDay"),D=this._get(a,"showOtherMonths"),
Z=this._get(a,"selectOtherMonths");this._get(a,"calculateWeek");for(var ca=this._getDefaultDate(a),ba="",T=0;T<p[0];T++){var $="";this.maxRows=4;for(var G=0;G<p[1];G++){var O=this._daylightSavingAdjust(new Date(A,u,a.selectedDay)),R=" ui-corner-all",W="";if(y){W+='<div class="ui-datepicker-group';if(1<p[1])switch(G){case 0:W+=" ui-datepicker-group-first";R=" ui-corner-"+(d?"right":"left");break;case p[1]-1:W+=" ui-datepicker-group-last";R=" ui-corner-"+(d?"left":"right");break;default:W+=" ui-datepicker-group-middle",
R=""}W+='">'}for(var W=W+('<div class="ui-datepicker-header ui-widget-header ui-helper-clearfix'+R+'">'+(/all|left/.test(R)&&0==T?d?g:B:"")+(/all|right/.test(R)&&0==T?d?B:g:"")+this._generateMonthYearHeader(a,u,A,x,v,0<T||0<G,J,I)+'</div><table class="ui-datepicker-calendar"><thead><tr>'),Q=m?'<th class="ui-datepicker-week-col">'+this._get(a,"weekHeader")+"</th>":"",R=0;7>R;R++)var K=(R+l)%7,Q=Q+("<th"+(5<=(R+l+6)%7?' class="ui-datepicker-week-end"':"")+'><span title="'+E[K]+'">'+F[K]+"</span></th>");
W+=Q+"</tr></thead><tbody>";Q=this._getDaysInMonth(A,u);A==a.selectedYear&&u==a.selectedMonth&&(a.selectedDay=Math.min(a.selectedDay,Q));R=(this._getFirstDayOfMonth(A,u)-l+7)%7;Q=Math.ceil((R+Q)/7);this.maxRows=Q=y?this.maxRows>Q?this.maxRows:Q:Q;for(var K=this._daylightSavingAdjust(new Date(A,u,1-R)),P=0;P<Q;P++){for(var W=W+"<tr>",ea=!m?"":'<td class="ui-datepicker-week-col">'+this._get(a,"calculateWeek")(K)+"</td>",R=0;7>R;R++){var C=N?N.apply(a.input?a.input[0]:null,[K]):[!0,""],S=K.getMonth()!=
u,V=S&&!Z||!C[0]||x&&K<x||v&&K>v,ea=ea+('<td class="'+(5<=(R+l+6)%7?" ui-datepicker-week-end":"")+(S?" ui-datepicker-other-month":"")+(K.getTime()==O.getTime()&&u==a.selectedMonth&&a._keyEvent||ca.getTime()==K.getTime()&&ca.getTime()==O.getTime()?" "+this._dayOverClass:"")+(V?" "+this._unselectableClass+" ui-state-disabled":"")+(S&&!D?"":" "+C[1]+(K.getTime()==z.getTime()?" "+this._currentClass:"")+(K.getTime()==b.getTime()?" ui-datepicker-today":""))+'"'+((!S||D)&&C[2]?' title="'+C[2]+'"':"")+(V?
"":' onclick="DP_jQuery_'+j+".datepicker._selectDay('#"+a.id+"',"+K.getMonth()+","+K.getFullYear()+', this);return false;"')+">"+(S&&!D?"&#xa0;":V?'<span class="ui-state-default">'+K.getDate()+"</span>":'<a class="ui-state-default'+(K.getTime()==b.getTime()?" ui-state-highlight":"")+(K.getTime()==z.getTime()?" ui-state-active":"")+(S?" ui-priority-secondary":"")+'" href="#">'+K.getDate()+"</a>")+"</td>");K.setDate(K.getDate()+1);K=this._daylightSavingAdjust(K)}W+=ea+"</tr>"}u++;11<u&&(u=0,A++);W+=
"</tbody></table>"+(y?"</div>"+(0<p[0]&&G==p[1]-1?'<div class="ui-datepicker-row-break"></div>':""):"");$+=W}ba+=$}ba+=c+(e.browser.msie&&7>parseInt(e.browser.version,10)&&!a.inline?'<iframe src="javascript:false;" class="ui-datepicker-cover" frameborder="0"></iframe>':"");a._keyEvent=!1;return ba},_generateMonthYearHeader:function(a,b,d,c,g,e,l,u){var m=this._get(a,"changeMonth"),y=this._get(a,"changeYear"),z=this._get(a,"showMonthAfterYear"),x='<div class="ui-datepicker-title">',v="";if(e||!m)v+=
'<span class="ui-datepicker-month">'+l[b]+"</span>";else{for(var l=c&&c.getFullYear()==d,A=g&&g.getFullYear()==d,v=v+('<select class="ui-datepicker-month" onchange="DP_jQuery_'+j+".datepicker._selectMonthYear('#"+a.id+"', this, 'M');\" >"),B=0;12>B;B++)if((!l||B>=c.getMonth())&&(!A||B<=g.getMonth()))v+='<option value="'+B+'"'+(B==b?' selected="selected"':"")+">"+u[B]+"</option>";v+="</select>"}z||(x+=v+(e||!m||!y?"&#xa0;":""));if(!a.yearshtml)if(a.yearshtml="",e||!y)x+='<span class="ui-datepicker-year">'+
d+"</span>";else{var u=this._get(a,"yearRange").split(":"),E=(new Date).getFullYear(),l=function(a){a=a.match(/c[+-].*/)?d+parseInt(a.substring(1),10):a.match(/[+-].*/)?E+parseInt(a,10):parseInt(a,10);return isNaN(a)?E:a},b=l(u[0]),u=Math.max(b,l(u[1]||"")),b=c?Math.max(b,c.getFullYear()):b,u=g?Math.min(u,g.getFullYear()):u;for(a.yearshtml+='<select class="ui-datepicker-year" onchange="DP_jQuery_'+j+".datepicker._selectMonthYear('#"+a.id+"', this, 'Y');\" >";b<=u;b++)a.yearshtml+='<option value="'+
b+'"'+(b==d?' selected="selected"':"")+">"+b+"</option>";a.yearshtml+="</select>";x+=a.yearshtml;a.yearshtml=null}x+=this._get(a,"yearSuffix");z&&(x+=(e||!m||!y?"&#xa0;":"")+v);return x+"</div>"},_adjustInstDate:function(a,b,d){var c=a.drawYear+("Y"==d?b:0),j=a.drawMonth+("M"==d?b:0),b=Math.min(a.selectedDay,this._getDaysInMonth(c,j))+("D"==d?b:0),c=this._restrictMinMax(a,this._daylightSavingAdjust(new Date(c,j,b)));a.selectedDay=c.getDate();a.drawMonth=a.selectedMonth=c.getMonth();a.drawYear=a.selectedYear=
c.getFullYear();("M"==d||"Y"==d)&&this._notifyChange(a)},_restrictMinMax:function(a,b){var d=this._getMinMaxDate(a,"min"),c=this._getMinMaxDate(a,"max"),d=d&&b<d?d:b;return c&&d>c?c:d},_notifyChange:function(a){var b=this._get(a,"onChangeMonthYear");b&&b.apply(a.input?a.input[0]:null,[a.selectedYear,a.selectedMonth+1,a])},_getNumberOfMonths:function(a){a=this._get(a,"numberOfMonths");return null==a?[1,1]:"number"==typeof a?[1,a]:a},_getMinMaxDate:function(a,b){return this._determineDate(a,this._get(a,
b+"Date"),null)},_getDaysInMonth:function(a,b){return 32-this._daylightSavingAdjust(new Date(a,b,32)).getDate()},_getFirstDayOfMonth:function(a,b){return(new Date(a,b,1)).getDay()},_canAdjustMonth:function(a,b,d,c){var j=this._getNumberOfMonths(a),d=this._daylightSavingAdjust(new Date(d,c+(0>b?b:j[0]*j[1]),1));0>b&&d.setDate(this._getDaysInMonth(d.getFullYear(),d.getMonth()));return this._isInRange(a,d)},_isInRange:function(a,b){var d=this._getMinMaxDate(a,"min"),c=this._getMinMaxDate(a,"max");return(!d||
b.getTime()>=d.getTime())&&(!c||b.getTime()<=c.getTime())},_getFormatConfig:function(a){var b=this._get(a,"shortYearCutoff"),b="string"!=typeof b?b:(new Date).getFullYear()%100+parseInt(b,10);return{shortYearCutoff:b,dayNamesShort:this._get(a,"dayNamesShort"),dayNames:this._get(a,"dayNames"),monthNamesShort:this._get(a,"monthNamesShort"),monthNames:this._get(a,"monthNames")}},_formatDate:function(a,b,d,c){b||(a.currentDay=a.selectedDay,a.currentMonth=a.selectedMonth,a.currentYear=a.selectedYear);
b=b?"object"==typeof b?b:this._daylightSavingAdjust(new Date(c,d,b)):this._daylightSavingAdjust(new Date(a.currentYear,a.currentMonth,a.currentDay));return this.formatDate(this._get(a,"dateFormat"),b,this._getFormatConfig(a))}});e.fn.datepicker=function(a){if(!this.length)return this;e.datepicker.initialized||(e(document).mousedown(e.datepicker._checkExternalClick).find("body").append(e.datepicker.dpDiv),e.datepicker.initialized=!0);var b=Array.prototype.slice.call(arguments,1);return"string"==typeof a&&
("isDisabled"==a||"getDate"==a||"widget"==a)||"option"==a&&2==arguments.length&&"string"==typeof arguments[1]?e.datepicker["_"+a+"Datepicker"].apply(e.datepicker,[this[0]].concat(b)):this.each(function(){typeof a=="string"?e.datepicker["_"+a+"Datepicker"].apply(e.datepicker,[this].concat(b)):e.datepicker._attachDatepicker(this,a)})};e.datepicker=new g;e.datepicker.initialized=!1;e.datepicker.uuid=(new Date).getTime();e.datepicker.version="1.9m6";window["DP_jQuery_"+j]=e})(m);(function(e,a){var g=
{buttons:!0,height:!0,maxHeight:!0,maxWidth:!0,minHeight:!0,minWidth:!0,width:!0},c={maxHeight:!0,maxWidth:!0,minHeight:!0,minWidth:!0};e.widget("ui.dialog",{version:"1.9m6",options:{autoOpen:!0,buttons:{},closeOnEscape:!0,closeText:"close",dialogClass:"",draggable:!0,hide:null,height:"auto",maxHeight:!1,maxWidth:!1,minHeight:150,minWidth:150,modal:!1,position:{my:"center",at:"center",of:window,collision:"fit",using:function(a){var c=e(this).css(a).offset().top;0>c&&e(this).css("top",a.top-c)}},resizable:!0,
show:null,stack:!0,title:"",width:300,zIndex:1E3},_create:function(){this.originalTitle=this.element.attr("title");"string"!==typeof this.originalTitle&&(this.originalTitle="");this.options.title=this.options.title||this.originalTitle;var a=this,c=a.options,g=c.title||"&#160;",f=e.ui.dialog.getTitleId(a.element),k=(a.uiDialog=e("<div>")).addClass("ui-dialog ui-widget ui-widget-content ui-corner-all "+c.dialogClass).css({display:"none",outline:0,zIndex:c.zIndex}).attr("tabIndex",-1).keydown(function(d){if(c.closeOnEscape&&
!d.isDefaultPrevented()&&d.keyCode&&d.keyCode===e.ui.keyCode.ESCAPE){a.close(d);d.preventDefault()}}).attr({role:"dialog","aria-labelledby":f}).mousedown(function(d){a.moveToTop(false,d)}).appendTo("body");a.element.show().removeAttr("title").addClass("ui-dialog-content ui-widget-content").appendTo(k);var d=(a.uiDialogTitlebar=e("<div>")).addClass("ui-dialog-titlebar  ui-widget-header  ui-corner-all  ui-helper-clearfix").prependTo(k),q=e("<a href='#'></a>").addClass("ui-dialog-titlebar-close  ui-corner-all").attr("role",
"button").click(function(d){d.preventDefault();a.close(d)}).appendTo(d);(a.uiDialogTitlebarCloseText=e("<span>")).addClass("ui-icon ui-icon-closethick").text(c.closeText).appendTo(q);e("<span>").addClass("ui-dialog-title").attr("id",f).html(g).prependTo(d);d.find("*").add(d).disableSelection();this._hoverable(q);this._focusable(q);c.draggable&&e.fn.draggable&&a._makeDraggable();c.resizable&&e.fn.resizable&&a._makeResizable();a._createButtons(c.buttons);a._isOpen=!1;e.fn.bgiframe&&k.bgiframe()},_init:function(){this.options.autoOpen&&
this.open()},_destroy:function(){this.overlay&&this.overlay.destroy();this.uiDialog.hide();this.element.removeClass("ui-dialog-content ui-widget-content").hide().appendTo("body");this.uiDialog.remove();this.originalTitle&&this.element.attr("title",this.originalTitle)},widget:function(){return this.uiDialog},close:function(a){if(!this._isOpen)return c;var c=this,g,f;if(!1!==c._trigger("beforeClose",a))return c._isOpen=!1,c.overlay&&c.overlay.destroy(),c.uiDialog.unbind("keypress.ui-dialog"),c.options.hide?
c.uiDialog.hide(c.options.hide,function(){c._trigger("close",a)}):(c.uiDialog.hide(),c._trigger("close",a)),e.ui.dialog.overlay.resize(),c.options.modal&&(g=0,e(".ui-dialog").each(function(){if(this!==c.uiDialog[0]){f=e(this).css("z-index");isNaN(f)||(g=Math.max(g,f))}}),e.ui.dialog.maxZ=g),c},isOpen:function(){return this._isOpen},moveToTop:function(a,c){var g=this.options;if(g.modal&&!a||!g.stack&&!g.modal)return this._trigger("focus",c);g.zIndex>e.ui.dialog.maxZ&&(e.ui.dialog.maxZ=g.zIndex);this.overlay&&
(e.ui.dialog.maxZ+=1,e.ui.dialog.overlay.maxZ=e.ui.dialog.maxZ,this.overlay.$el.css("z-index",e.ui.dialog.overlay.maxZ));g={scrollTop:this.element.scrollTop(),scrollLeft:this.element.scrollLeft()};e.ui.dialog.maxZ+=1;this.uiDialog.css("z-index",e.ui.dialog.maxZ);this.element.attr(g);this._trigger("focus",c);return this},open:function(){if(!this._isOpen){var a=this.options,c=this.uiDialog;this._size();this._position(a.position);c.show(a.show);this.overlay=a.modal?new e.ui.dialog.overlay(this):null;
this.moveToTop(!0);a.modal&&c.bind("keydown.ui-dialog",function(a){if(a.keyCode===e.ui.keyCode.TAB){var b=e(":tabbable",this),c=b.filter(":first"),b=b.filter(":last");if(a.target===b[0]&&!a.shiftKey)return c.focus(1),!1;if(a.target===c[0]&&a.shiftKey)return b.focus(1),!1}});a=this.element.find(":tabbable");a.length||(a=c.find(".ui-dialog-buttonpane :tabbable"),a.length||(a=c));a.eq(0).focus();this._isOpen=!0;this._trigger("open");return this}},_createButtons:function(a){var c=this,g=!1;c.uiDialog.find(".ui-dialog-buttonpane").remove();
"object"===typeof a&&null!==a&&e.each(a,function(){return!(g=!0)});if(g){var f=e("<div>").addClass("ui-dialog-buttonpane  ui-widget-content ui-helper-clearfix"),k=e("<div>").addClass("ui-dialog-buttonset").appendTo(f);e.each(a,function(a,b){var b=e.isFunction(b)?{click:b,text:a}:b,f=e("<button type='button'>").attr(b,!0).unbind("click").click(function(){b.click.apply(c.element[0],arguments)}).appendTo(k);e.fn.button&&f.button()});c.uiDialog.addClass("ui-dialog-buttons");f.appendTo(c.uiDialog)}else c.uiDialog.removeClass("ui-dialog-buttons")},
_makeDraggable:function(){function a(b){return{position:b.position,offset:b.offset}}var c=this,g=c.options,f=e(document);c.uiDialog.draggable({cancel:".ui-dialog-content, .ui-dialog-titlebar-close",handle:".ui-dialog-titlebar",containment:"document",start:function(f,d){e(this).addClass("ui-dialog-dragging");c._trigger("dragStart",f,a(d))},drag:function(f,d){c._trigger("drag",f,a(d))},stop:function(k,d){g.position=[d.position.left-f.scrollLeft(),d.position.top-f.scrollTop()];e(this).removeClass("ui-dialog-dragging");
c._trigger("dragStop",k,a(d));e.ui.dialog.overlay.resize()}})},_makeResizable:function(b){function c(a){return{originalPosition:a.originalPosition,originalSize:a.originalSize,position:a.position,size:a.size}}var b=b===a?this.options.resizable:b,g=this,f=g.options,k=g.uiDialog.css("position"),b="string"===typeof b?b:"n,e,s,w,se,sw,ne,nw";g.uiDialog.resizable({cancel:".ui-dialog-content",containment:"document",alsoResize:g.element,maxWidth:f.maxWidth,maxHeight:f.maxHeight,minWidth:f.minWidth,minHeight:g._minHeight(),
handles:b,start:function(a,b){e(this).addClass("ui-dialog-resizing");g._trigger("resizeStart",a,c(b))},resize:function(a,b){g._trigger("resize",a,c(b))},stop:function(a,b){e(this).removeClass("ui-dialog-resizing");f.height=e(this).height();f.width=e(this).width();g._trigger("resizeStop",a,c(b));e.ui.dialog.overlay.resize()}}).css("position",k).find(".ui-resizable-se").addClass("ui-icon ui-icon-grip-diagonal-se")},_minHeight:function(){var a=this.options;return"auto"===a.height?a.minHeight:Math.min(a.minHeight,
a.height)},_position:function(a){var c=[],g=[0,0],f;if(a){if("string"===typeof a||"object"===typeof a&&"0"in a)c=a.split?a.split(" "):[a[0],a[1]],1===c.length&&(c[1]=c[0]),e.each(["left","top"],function(a,b){+c[a]===c[a]&&(g[a]=c[a],c[a]=b)}),a={my:c.join(" "),at:c.join(" "),offset:g.join(" ")};a=e.extend({},e.ui.dialog.prototype.options.position,a)}else a=e.ui.dialog.prototype.options.position;(f=this.uiDialog.is(":visible"))||this.uiDialog.show();this.uiDialog.position(a);f||this.uiDialog.hide()},
_setOptions:function(a){var j=this,l={},f=!1;e.each(a,function(a,b){j._setOption(a,b);a in g&&(f=!0);a in c&&(l[a]=b)});f&&this._size();this.uiDialog.is(":data(resizable)")&&this.uiDialog.resizable("option",l)},_setOption:function(a,c){var g=this.uiDialog;switch(a){case "buttons":this._createButtons(c);break;case "closeText":this.uiDialogTitlebarCloseText.text(""+c);break;case "dialogClass":g.removeClass(this.options.dialogClass).addClass("ui-dialog ui-widget ui-widget-content ui-corner-all "+c);
break;case "disabled":c?g.addClass("ui-dialog-disabled"):g.removeClass("ui-dialog-disabled");break;case "draggable":var f=g.is(":data(draggable)");f&&!c&&g.draggable("destroy");!f&&c&&this._makeDraggable();break;case "position":this._position(c);break;case "resizable":(f=g.is(":data(resizable)"))&&!c&&g.resizable("destroy");f&&"string"===typeof c&&g.resizable("option","handles",c);!f&&!1!==c&&this._makeResizable(c);break;case "title":e(".ui-dialog-title",this.uiDialogTitlebar).html(""+(c||"&#160;"))}this._super("_setOption",
a,c)},_size:function(){var a=this.options,c,g,f=this.uiDialog.is(":visible");this.element.show().css({width:"auto",minHeight:0,height:0});a.minWidth>a.width&&(a.width=a.minWidth);c=this.uiDialog.css({height:"auto",width:a.width}).height();g=Math.max(0,a.minHeight-c);"auto"===a.height?e.support.minHeight?this.element.css({minHeight:g,height:"auto"}):(this.uiDialog.show(),a=this.element.css("height","auto").height(),f||this.uiDialog.hide(),this.element.height(Math.max(a,g))):this.element.height(Math.max(a.height-
c,0));this.uiDialog.is(":data(resizable)")&&this.uiDialog.resizable("option","minHeight",this._minHeight())}});e.extend(e.ui.dialog,{uuid:0,maxZ:0,getTitleId:function(a){a=a.attr("id");a||(a=this.uuid+=1);return"ui-dialog-title-"+a},overlay:function(a){this.$el=e.ui.dialog.overlay.create(a)}});e.extend(e.ui.dialog.overlay,{instances:[],oldInstances:[],maxZ:0,events:e.map("focus mousedown mouseup keydown keypress click".split(" "),function(a){return a+".dialog-overlay"}).join(" "),create:function(a){0===
this.instances.length&&(setTimeout(function(){e.ui.dialog.overlay.instances.length&&e(document).bind(e.ui.dialog.overlay.events,function(a){if(e(a.target).zIndex()<e.ui.dialog.overlay.maxZ)return!1})},1),e(document).bind("keydown.dialog-overlay",function(c){a.options.closeOnEscape&&(!c.isDefaultPrevented()&&c.keyCode&&c.keyCode===e.ui.keyCode.ESCAPE)&&(a.close(c),c.preventDefault())}),e(window).bind("resize.dialog-overlay",e.ui.dialog.overlay.resize));var c=(this.oldInstances.pop()||e("<div>").addClass("ui-widget-overlay")).appendTo(document.body).css({width:this.width(),
height:this.height()});e.fn.bgiframe&&c.bgiframe();this.instances.push(c);return c},destroy:function(a){var c=e.inArray(a,this.instances);-1!==c&&this.oldInstances.push(this.instances.splice(c,1)[0]);0===this.instances.length&&e([document,window]).unbind(".dialog-overlay");a.height(0).width(0).remove();var g=0;e.each(this.instances,function(){g=Math.max(g,this.css("z-index"))});this.maxZ=g},height:function(){var a,c;return e.browser.msie?(a=Math.max(document.documentElement.scrollHeight,document.body.scrollHeight),
c=Math.max(document.documentElement.offsetHeight,document.body.offsetHeight),a<c?e(window).height()+"px":a+"px"):e(document).height()+"px"},width:function(){var a,c;return e.browser.msie?(a=Math.max(document.documentElement.scrollWidth,document.body.scrollWidth),c=Math.max(document.documentElement.offsetWidth,document.body.offsetWidth),a<c?e(window).width()+"px":a+"px"):e(document).width()+"px"},resize:function(){var a=e([]);e.each(e.ui.dialog.overlay.instances,function(){a=a.add(this)});a.css({width:0,
height:0}).css({width:e.ui.dialog.overlay.width(),height:e.ui.dialog.overlay.height()})}});e.extend(e.ui.dialog.overlay.prototype,{destroy:function(){e.ui.dialog.overlay.destroy(this.$el)}})})(m);(function(e){function a(a){if(!e(a.target).closest(".ui-menu").length)for(var c in b)b.hasOwnProperty(c)&&b[c].collapseAll(a)}var g=0,c=0,b={};e.widget("ui.menu",{version:"1.9m6",defaultElement:"<ul>",delay:150,options:{position:{my:"left top",at:"right top"}},_create:function(){this.activeMenu=this.element;
this.menuId=this.element.attr("id")||"ui-menu-"+g++;this.element.find(".ui-icon").length&&this.element.addClass("ui-menu-icons");this.element.addClass("ui-menu ui-widget ui-widget-content ui-corner-all").attr({id:this.menuId,role:"menu"}).bind("click.menu",e.proxy(function(a){this.options.disabled&&a.preventDefault()},this));this._bind({"click .ui-menu-item:has(a)":function(a){a.stopImmediatePropagation();var b=e(a.currentTarget);(!this.active||this.active[0]!==b[0])&&this.focus(a,b);this.select(a)},
"mouseover .ui-menu-item":function(a){a.stopImmediatePropagation();var b=e(a.currentTarget);b.siblings().children(".ui-state-active").removeClass("ui-state-active");this.focus(a,b)},mouseleave:"_mouseleave","mouseleave .ui-menu":"_mouseleave","mouseout .ui-menu-item":"blur",focus:function(a){this.focus(a,e(a.target).children(".ui-menu-item:first"))},blur:"collapseAll"});this.refresh();this.element.attr("tabIndex",0);this._bind({keydown:function(a){switch(a.keyCode){case e.ui.keyCode.PAGE_UP:this.previousPage(a);
a.preventDefault();a.stopImmediatePropagation();break;case e.ui.keyCode.PAGE_DOWN:this.nextPage(a);a.preventDefault();a.stopImmediatePropagation();break;case e.ui.keyCode.HOME:this._move("first","first",a);a.preventDefault();a.stopImmediatePropagation();break;case e.ui.keyCode.END:this._move("last","last",a);a.preventDefault();a.stopImmediatePropagation();break;case e.ui.keyCode.UP:this.previous(a);a.preventDefault();a.stopImmediatePropagation();break;case e.ui.keyCode.DOWN:this.next(a);a.preventDefault();
a.stopImmediatePropagation();break;case e.ui.keyCode.LEFT:this.collapse(a)&&a.stopImmediatePropagation();a.preventDefault();break;case e.ui.keyCode.RIGHT:this.expand(a)&&a.stopImmediatePropagation();a.preventDefault();break;case e.ui.keyCode.ENTER:this.active.children("a[aria-haspopup='true']").length?this.expand(a)&&a.stopImmediatePropagation():(this.select(a),a.stopImmediatePropagation());a.preventDefault();break;case e.ui.keyCode.ESCAPE:this.collapse(a)&&a.stopImmediatePropagation();a.preventDefault();
break;default:a.stopPropagation();clearTimeout(this.filterTimer);var b;b=this.previousFilter||"";var c=String.fromCharCode(a.keyCode),k=!1;c==b?k=!0:c=b+c;var d=function(a){return a.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&")};b=this.activeMenu.children(".ui-menu-item").filter(function(){return RegExp("^"+d(c),"i").test(e(this).children("a").text())});b=k&&-1!=b.index(this.active.next())?this.active.nextAll(".ui-menu-item"):b;b.length||(c=String.fromCharCode(a.keyCode),b=this.activeMenu.children(".ui-menu-item").filter(function(){return RegExp("^"+
d(c),"i").test(e(this).children("a").text())}));b.length?(this.focus(a,b),1<b.length?(this.previousFilter=c,this.filterTimer=this._delay(function(){delete this.previousFilter},1E3)):delete this.previousFilter):delete this.previousFilter}}})},_destroy:function(){this.element.removeAttr("aria-activedescendant").find("ul").andSelf().removeClass("ui-menu ui-widget ui-widget-content ui-corner-all").removeAttr("role").removeAttr("tabIndex").removeAttr("aria-labelledby").removeAttr("aria-expanded").removeAttr("aria-hidden").show();
this.element.find(".ui-menu-item").unbind(".menu").removeClass("ui-menu-item").removeAttr("role").children("a").removeClass("ui-corner-all ui-state-hover").removeAttr("tabIndex").removeAttr("role").removeAttr("aria-haspopup").removeAttr("id").children(".ui-icon").remove()},refresh:function(){var a=this.element.find("ul:not(.ui-menu)").addClass("ui-menu ui-widget ui-widget-content ui-corner-all").attr("role","menu").hide().attr("aria-hidden","true").attr("aria-expanded","false"),b=this.menuId;a.add(this.element).children("li:not(.ui-menu-item):has(a)").addClass("ui-menu-item").attr("role",
"presentation").children("a").addClass("ui-corner-all").attr("tabIndex",-1).attr("role","menuitem").attr("id",function(a){return b+"-"+a});a.each(function(){var a=e(this),b=a.prev("a");b.attr("aria-haspopup","true").prepend('<span class="ui-menu-icon ui-icon ui-icon-carat-1-e"></span>');a.attr("aria-labelledby",b.attr("id"))})},focus:function(a,b){this.blur(a);if(this._hasScroll()){var c=parseFloat(e.curCSS(this.activeMenu[0],"borderTopWidth",!0))||0,k=parseFloat(e.curCSS(this.activeMenu[0],"paddingTop",
!0))||0,c=b.offset().top-this.activeMenu.offset().top-c-k,k=this.activeMenu.scrollTop(),d=this.activeMenu.height(),g=b.height();0>c?this.activeMenu.scrollTop(k+c):c+g>d&&this.activeMenu.scrollTop(k+c-d+g)}this.active=b.first().children("a").addClass("ui-state-focus").end();this.element.attr("aria-activedescendant",this.active.children("a").attr("id"));this.active.parent().closest(".ui-menu-item").children("a:first").addClass("ui-state-active");this.timer=this._delay(function(){this._close()},this.delay);
c=e(">ul",b);c.length&&/^mouse/.test(a.type)&&this._startOpening(c);this.activeMenu=b.parent();this._trigger("focus",a,{item:b})},blur:function(a){this.active&&(clearTimeout(this.timer),this.active.children("a").removeClass("ui-state-focus"),this.active=null,this._trigger("blur",a,{item:this.active}))},_startOpening:function(a){clearTimeout(this.timer);"true"===a.attr("aria-hidden")&&(this.timer=this._delay(function(){this._close();this._open(a)},this.delay))},_open:function(j){clearTimeout(this.timer);
this.element.find(".ui-menu").not(j.parents()).hide().attr("aria-hidden","true");var g=e.extend({},{of:this.active},"function"==e.type(this.options.position)?this.options.position(this.active):this.options.position);j.show().removeAttr("aria-hidden").attr("aria-expanded","true").position(g);b[this.menuId]||(b[this.menuId]=this,c++||e("body").click(a))},collapseAll:function(a){var b=!1;if(a){var c=e(a.target);c.is("ui.menu")?b=c:c.closest(".ui-menu").length&&(b=c.closest(".ui-menu"))}this._close(b);
b||(this.blur(a),this.activeMenu=this.element)},_close:function(j){j||(j=this.active?this.active.parent():this.element);j.find("ul").hide().attr("aria-hidden","true").attr("aria-expanded","false").end().find("a.ui-state-active").removeClass("ui-state-active");j[0]===this.element[0]&&b[this.menuId]&&(delete b[this.menuId],c&&!--c&&e("body").unbind("click",a))},collapse:function(a){var b=this.active&&this.active.parents("li:not(.ui-menubar-item)").first();if(b&&b.length)return this._close(),this.focus(a,
b),!0},expand:function(a){var b=this.active&&this.active.children("ul").children("li").first();if(b&&b.length)return this._open(b.parent()),this._delay(function(){this.focus(a,b)},20),!0},next:function(a){this._move("next","first",a)},previous:function(a){this._move("prev","last",a)},first:function(){return this.active&&!this.active.prevAll(".ui-menu-item").length},last:function(){return this.active&&!this.active.nextAll(".ui-menu-item").length},_move:function(a,b,c){this.active?(a="first"===a||"last"===
a?this.active["first"===a?"prevAll":"nextAll"](".ui-menu-item").eq(-1):this.active[a+"All"](".ui-menu-item").eq(0),a.length?this.focus(c,a):this.focus(c,this.activeMenu.children(".ui-menu-item")[b]())):this.focus(c,this.activeMenu.children(".ui-menu-item")[b]())},nextPage:function(a){if(this._hasScroll())if(this.active){if(!this.last()){var b=this.active.offset().top,c=this.element.height(),k;this.active.nextAll(".ui-menu-item").each(function(){k=e(this);return 0>e(this).offset().top-b-c});this.focus(a,
k)}}else this.focus(a,this.activeMenu.children(".ui-menu-item").first());else this.focus(a,this.activeMenu.children(".ui-menu-item")[!this.active?"first":"last"]())},previousPage:function(a){if(this._hasScroll())if(this.active){if(!this.first()){var b=this.active.offset().top,c=this.element.height(),k;this.active.prevAll(".ui-menu-item").each(function(){k=e(this);return 0<e(this).offset().top-b+c});this.focus(a,k)}}else this.focus(a,this.activeMenu.children(".ui-menu-item").first());else this.focus(a,
this.activeMenu.children(".ui-menu-item").first())},_hasScroll:function(){return this.element.height()<this.element.prop("scrollHeight")},_mouseleave:function(a){this.collapseAll(a);this.blur()},select:function(a){var b={item:this.active};this.collapseAll(a);this._trigger("select",a,b)}})})(m);(function(e){e.widget("ui.menubar",{version:"1.9m6",options:{autoExpand:!1,buttons:!1,menuIcon:!1,position:{my:"left top",at:"left bottom"}},_create:function(){var a=this,g=this.items=this.element.children("li").addClass("ui-menubar-item").attr("role",
"presentation").children("button, a");g.slice(1).attr("tabIndex",-1);this.element.addClass("ui-menubar ui-widget-header ui-helper-clearfix").attr("role","menubar");this._focusable(g);this._hoverable(g);g.next("ul").menu({position:{within:this.options.position.within},select:function(c,b){b.item.parents("ul.ui-menu:last").hide();a._close();e(c.target).prev().focus();a._trigger("select",c,b)}}).hide().attr({"aria-hidden":"true","aria-expanded":"false"}).bind("keydown.menubar",function(c){if(!e(this).is(":hidden"))switch(c.keyCode){case e.ui.keyCode.LEFT:a._left(c);
c.preventDefault();break;case e.ui.keyCode.RIGHT:a._right(c),c.preventDefault()}});g.each(function(){var c=e(this),b=c.next("ul");c.bind("click.menubar focus.menubar mouseenter.menubar",function(c){if("focus"!=c.type||c.originalEvent)if(c.preventDefault(),"click"==c.type&&b.is(":visible")&&a.active&&a.active[0]==b[0])a._close();else if(a.open&&"mouseenter"==c.type||"click"==c.type||a.options.autoExpand)a.options.autoExpand&&clearTimeout(a.timer),a._open(c,b)}).bind("keydown",function(b){switch(b.keyCode){case e.ui.keyCode.SPACE:case e.ui.keyCode.UP:case e.ui.keyCode.DOWN:a._open(b,
e(this).next());b.preventDefault();break;case e.ui.keyCode.LEFT:a._prev(b,e(this));b.preventDefault();break;case e.ui.keyCode.RIGHT:a._next(b,e(this)),b.preventDefault()}}).addClass("ui-button ui-widget ui-button-text-only ui-menubar-link").attr("role","menuitem").attr("aria-haspopup","true").wrapInner("<span class='ui-button-text'></span>");a.options.autoExpand&&(c.bind("mouseleave.menubar",function(){a.timer=setTimeout(function(){a._close()},150)}),b.bind("mouseleave.menubar",function(){a.timer=
setTimeout(function(){a._close()},150)}).bind("mouseenter.menubar",function(){clearTimeout(a.timer)}));a.options.menuIcon&&(c.addClass("ui-state-default").append("<span class='ui-button-icon-secondary ui-icon ui-icon-triangle-1-s'></span>"),c.removeClass("ui-button-text-only").addClass("ui-button-text-icon-secondary"));a.options.buttons||c.addClass("ui-menubar-link").removeClass("ui-state-default")});a._bind({keydown:function(c){if(c.keyCode==e.ui.keyCode.ESCAPE&&a.active&&!0!==a.active.menu("collapse",
c)){var b=a.active;a.active.blur();a._close(c);b.prev().focus()}},focusin:function(){clearTimeout(a.closeTimer)},focusout:function(c){a.closeTimer=setTimeout(function(){a._close(c)},100)}})},_destroy:function(){var a=this.element.children("li").removeClass("ui-menubar-item").removeAttr("role").children("button, a");this.element.removeClass("ui-menubar ui-widget-header ui-helper-clearfix").removeAttr("role").unbind(".menubar");a.unbind(".menubar").removeClass("ui-button ui-widget ui-button-text-only ui-menubar-link ui-state-default").removeAttr("role").removeAttr("aria-haspopup").children("span.ui-button-text").each(function(){var a=
e(this);a.parent().html(a.html())}).end().children(".ui-icon").remove();this.element.find(":ui-menu").menu("destroy").show().removeAttr("aria-hidden").removeAttr("aria-expanded").removeAttr("tabindex").unbind(".menubar")},_close:function(){this.active&&this.active.length&&(this.active.menu("collapseAll").hide().attr({"aria-hidden":"true","aria-expanded":"false"}),this.active.prev().removeClass("ui-state-active").removeAttr("tabIndex"),this.active=null,this.open=!1)},_open:function(a,g){if(!(this.active&&
this.active[0]==g[0])){this.active&&(this.active.menu("collapseAll").hide().attr({"aria-hidden":"true","aria-expanded":"false"}),this.active.prev().removeClass("ui-state-active"));var c=g.prev().addClass("ui-state-active").attr("tabIndex",-1);this.active=g.show().position(e.extend({of:c},this.options.position)).removeAttr("aria-hidden").attr("aria-expanded","true").menu("focus",a,g.children("li").first()).focus().focusin();this.open=!0}},_prev:function(a,g){g.attr("tabIndex",-1);var c=g.parent().prevAll("li").children(".ui-button").eq(0);
c.length?c.removeAttr("tabIndex")[0].focus():this.element.children("li:last").children(".ui-button:last").removeAttr("tabIndex")[0].focus()},_next:function(a,g){g.attr("tabIndex",-1);var c=g.parent().nextAll("li").children(".ui-button").eq(0);c.length?c.removeAttr("tabIndex")[0].focus():this.element.children("li:first").children(".ui-button:first").removeAttr("tabIndex")[0].focus()},_left:function(a){var g=this.active.parent().prevAll("li:eq(0)").children(".ui-menu").eq(0);g.length||(g=this.element.children("li:last").children(".ui-menu:first"));
this._open(a,g)},_right:function(a){var g=this.active.parent().nextAll("li:eq(0)").children(".ui-menu").eq(0);g.length||(g=this.element.children("li:first").children(".ui-menu:first"));this._open(a,g)}})})(m);(function(e){var a=0;e.widget("ui.popup",{version:"1.9m6",options:{position:{my:"left top",at:"left bottom"}},_create:function(){this.options.trigger||(this.options.trigger=this.element.prev());this.element.attr("id")||(this.element.attr("id","ui-popup-"+a++),this.generatedId=!0);this.element.attr("role")||
(this.element.attr("role","dialog"),this.generatedRole=!0);this.options.trigger.attr("aria-haspopup","true").attr("aria-owns",this.element.attr("id"));this.element.addClass("ui-popup");this.close();this._bind(this.options.trigger,{keydown:function(a){e.ui.button&&(this.options.trigger.is("a:ui-button")&&a.keyCode==e.ui.keyCode.SPACE)&&a.preventDefault();a.keyCode==e.ui.keyCode.SPACE&&this.options.trigger.is("a:not(:ui-button)")&&this.options.trigger.trigger("click",a);if(a.keyCode==e.ui.keyCode.DOWN){a.preventDefault();
this.options.trigger.trigger("click",a)}},click:function(a){a.preventDefault();if(!this.isOpen){clearTimeout(this.closeTimer);this._delay(function(){this.open(a)},1)}}});this.element.is(":ui-menu")||this._bind({keydown:function(a){if(a.keyCode===e.ui.keyCode.TAB){var c=e(":tabbable",this.element),b=c.first(),c=c.last();if(a.target===c[0]&&!a.shiftKey){b.focus(1);a.preventDefault()}else if(a.target===b[0]&&a.shiftKey){c.focus(1);a.preventDefault()}}}});this._bind({focusout:function(a){this.closeTimer=
this._delay(function(){this.close(a)},100)},focusin:function(){clearTimeout(this.closeTimer)}});this._bind({keyup:function(a){if(a.keyCode==e.ui.keyCode.ESCAPE&&this.element.is(":visible")){this.close(a);this.options.trigger.focus()}}});this._bind(document,{click:function(a){this.isOpen&&!e(a.target).closest(".ui-popup").length&&this.close(a)}})},_destroy:function(){this.element.show().removeClass("ui-popup").removeAttr("aria-hidden").removeAttr("aria-expanded").unbind("keypress.ui-popup");this.options.trigger.removeAttr("aria-haspopup").removeAttr("aria-owns");
this.generatedId&&this.element.removeAttr("id");this.generatedRole&&this.element.removeAttr("role")},open:function(a){var c=e.extend({},{of:this.options.trigger},this.options.position);this.element.show().attr("aria-hidden","false").attr("aria-expanded","true").position(c);this.element.is(":ui-menu")?(this.element.menu("focus",a,this.element.children("li").first()),this.element.focus()):(c=this.element.find(":tabbable"),this.removeTabIndex=!1,c.length||(this.element.is(":tabbable")||(this.element.attr("tabindex",
"0"),this.removeTabIndex=!0),c=c.add(this.element[0])),c.first().focus(1));this.options.trigger.attr("tabindex",-1);this.isOpen=!0;this._trigger("open",a)},close:function(a){this.element.hide().attr("aria-hidden","true").attr("aria-expanded","false");this.options.trigger.attr("tabindex",0);this.removeTabIndex&&this.element.removeAttr("tabindex");this.isOpen=!1;this._trigger("close",a)}})})(m);(function(e,a){e.ui=e.ui||{};var g=/left|center|right/,c=/top|center|bottom/,b=/[+-]\d+%?/,j=/^\w+/,l=/%$/,
f=e.fn.position;e.position={scrollbarWidth:function(){var a,b,c=e("<div style='display:block;width:50px;height:50px;overflow:hidden;'><div style='height:100px;width:auto;'></div></div>");b=c.children()[0];e("body").append(c);a=b.offsetWidth;c.css("overflow","scroll");b=b.offsetWidth;a===b&&(b=c[0].clientWidth);c.remove();return a-b},getScrollInfo:function(a){var b=a[0]!==window,c=b?a.css("overflow-x"):"",b=b?a.css("overflow-y"):"",c="auto"===c||"scroll"===c?e.position.scrollbarWidth():0,b="auto"===
b||"scroll"===b?e.position.scrollbarWidth():0;return{height:a.height()<a[0].scrollHeight?b:0,width:a.width()<a[0].scrollWidth?c:0}}};e.fn.position=function(a){if(!a||!a.of)return f.apply(this,arguments);var a=e.extend({},a),d=e(a.of),q=e(a.within||window),o=d[0],m=(a.collision||"flip").split(" "),p={},u,t,y,z;9===o.nodeType?(t=d.width(),y=d.height(),z={top:0,left:0}):e.isWindow(o)?(t=d.width(),y=d.height(),z={top:d.scrollTop(),left:d.scrollLeft()}):o.preventDefault?(a.at="left top",t=y=0,z={top:a.of.pageY,
left:a.of.pageX}):(t=d.outerWidth(),y=d.outerHeight(),z=d.offset());e.each(["my","at"],function(){var d=(a[this]||"").split(" "),f,e;d.length===1&&(d=g.test(d[0])?d.concat(["center"]):c.test(d[0])?["center"].concat(d):["center","center"]);d[0]=g.test(d[0])?d[0]:"center";d[1]=c.test(d[1])?d[1]:"center";f=b.exec(d[0]);e=b.exec(d[1]);p[this]=[f?f[0]:0,e?e[0]:0];a[this]=[j.exec(d[0])[0],j.exec(d[1])[0]]});1===m.length&&(m[1]=m[0]);"right"===a.at[0]?z.left+=t:"center"===a.at[0]&&(z.left+=t/2);"bottom"===
a.at[1]?z.top+=y:"center"===a.at[1]&&(z.top+=y/2);u=[parseInt(p.at[0],10)*(l.test(p.at[0])?t/100:1),parseInt(p.at[1],10)*(l.test(p.at[1])?y/100:1)];z.left+=u[0];z.top+=u[1];return this.each(function(){var b=e(this),c=b.outerWidth(),d=b.outerHeight(),f=parseInt(e.curCSS(this,"marginLeft",true))||0,j=parseInt(e.curCSS(this,"marginTop",true))||0,g=e.position.getScrollInfo(q),o=c+f+(parseInt(e.curCSS(this,"marginRight",true))||0)+g.width,I=d+j+(parseInt(e.curCSS(this,"marginBottom",true))||0)+g.height,
N=e.extend({},z),D=[parseInt(p.my[0],10)*(l.test(p.my[0])?b.outerWidth()/100:1),parseInt(p.my[1],10)*(l.test(p.my[1])?b.outerHeight()/100:1)],Z;if(a.my[0]==="right")N.left=N.left-c;else if(a.my[0]==="center")N.left=N.left-c/2;if(a.my[1]==="bottom")N.top=N.top-d;else if(a.my[1]==="center")N.top=N.top-d/2;N.left=N.left+D[0];N.top=N.top+D[1];Z={marginLeft:f,marginTop:j};e.each(["left","top"],function(f,j){if(e.ui.position[m[f]])e.ui.position[m[f]][j](N,{targetWidth:t,targetHeight:y,elemWidth:c,elemHeight:d,
collisionPosition:Z,collisionWidth:o,collisionHeight:I,offset:[u[0]+D[0],u[1]+D[1]],my:a.my,at:a.at,within:q,elem:b})});e.fn.bgiframe&&b.bgiframe();b.offset(e.extend(N,{using:a.using}))})};e.ui.position={fit:{left:function(a,b){var c=b.within,f=e(window),j=e.isWindow(b.within[0]),g=j?f.scrollLeft():c.offset().left,f=j?f.width():c.outerWidth(),j=a.left-b.collisionPosition.marginLeft,c=g-j,l=j+b.collisionWidth-f-g;b.collisionWidth>f?0<c&&0>=l?(g=a.left+c+b.collisionWidth-f-g,a.left+=c-g):a.left=0<l&&
0>=c?g:c>l?g+f-b.collisionWidth:g:a.left=0<c?a.left+c:0<l?a.left-l:Math.max(a.left-j,a.left)},top:function(a,b){var c=b.within,f=e(window),j=e.isWindow(b.within[0]),g=j?f.scrollTop():c.offset().top,f=j?f.height():c.outerHeight(),j=a.top-b.collisionPosition.marginTop,c=g-j,l=j+b.collisionHeight-f-g;b.collisionHeight>f?0<c&&0>=l?(g=a.top+c+b.collisionHeight-f-g,a.top+=c-g):a.top=0<l&&0>=c?g:c>l?g+f-b.collisionHeight:g:a.top=0<c?a.top+c:0<l?a.top-l:Math.max(a.top-j,a.top)}},flip:{left:function(a,b){if("center"!==
b.at[0]){b.elem.removeClass("ui-flipped-left ui-flipped-right");var c=b.within;e(window);var f=e.isWindow(b.within[0]),j=(f?0:c.offset().left)+c.scrollLeft(),g=f?c.width():c.outerWidth(),f=a.left-b.collisionPosition.marginLeft,c=f-j,l=f+b.collisionWidth-g-j,f="left"===b.my[0]?-b.elemWidth:"right"===b.my[0]?b.elemWidth:0,m="left"===b.at[0]?b.targetWidth:-b.targetWidth,y=-2*b.offset[0];if(0>c){if(j=a.left+f+m+y+b.collisionWidth-g-j,0>j||j<Math.abs(c))b.elem.addClass("ui-flipped-right"),a.left+=f+m+
y}else if(0<l&&(j=a.left-b.collisionPosition.marginLeft+f+m+y-j,0<j||Math.abs(j)<l))b.elem.addClass("ui-flipped-left"),a.left+=f+m+y}},top:function(a,b){if("center"!==b.at[1]){b.elem.removeClass("ui-flipped-top ui-flipped-bottom");var c=b.within;e(window);var f=e.isWindow(b.within[0]),j=(f?0:c.offset().top)+c.scrollTop(),g=f?c.height():c.outerHeight(),f=a.top-b.collisionPosition.marginTop,c=f-j,l=f+b.collisionHeight-g-j,f="top"===b.my[1]?-b.elemHeight:"bottom"===b.my[1]?b.elemHeight:0,m="top"===b.at[1]?
b.targetHeight:-b.targetHeight,y=-2*b.offset[1];if(0>c){if(j=a.top+f+m+y+b.collisionHeight-g-j,0>j||j<Math.abs(c))b.elem.addClass("ui-flipped-bottom"),a.top+=f+m+y}else if(0<l&&(j=a.top-b.collisionPosition.marginTop+f+m+y-j,0<j||Math.abs(j)<l))b.elem.addClass("ui-flipped-top"),a.top+=f+m+y}}},flipfit:{left:function(){e.ui.position.flip.left.apply(this,arguments);e.ui.position.fit.left.apply(this,arguments)},top:function(){e.ui.position.flip.top.apply(this,arguments);e.ui.position.fit.top.apply(this,
arguments)}}};!1!==e.uiBackCompat&&function(b){var c=b.fn.position;b.fn.position=function(f){if(!f||!f.offset)return c.call(this,f);var j=f.offset.split(" "),g=f.at.split(" ");1===j.length&&(j[1]=j[0]);/^\d/.test(j[0])&&(j[0]="+"+j[0]);/^\d/.test(j[1])&&(j[1]="+"+j[1]);1===g.length&&(/left|center|right/.test(g[0])?g[1]="center":(g[1]=g[0],g[0]="center"));return c.call(this,b.extend(f,{at:g[0]+j[0]+" "+g[1]+j[1],offset:a}))}}(m)})(m);(function(e,a){e.widget("ui.progressbar",{version:"1.9m6",options:{value:0,
max:100},min:0,_create:function(){this.element.addClass("ui-progressbar ui-widget ui-widget-content ui-corner-all").attr({role:"progressbar","aria-valuemin":this.min,"aria-valuemax":this.options.max,"aria-valuenow":this._value()});this.valueDiv=e("<div class='ui-progressbar-value ui-widget-header ui-corner-left'></div>").appendTo(this.element);this.oldValue=this._value();this._refreshValue()},_destroy:function(){this.element.removeClass("ui-progressbar ui-widget ui-widget-content ui-corner-all").removeAttr("role").removeAttr("aria-valuemin").removeAttr("aria-valuemax").removeAttr("aria-valuenow");
this.valueDiv.remove()},value:function(g){if(g===a)return this._value();this._setOption("value",g);return this},_setOption:function(a,c){"value"===a&&(this.options.value=c,this._refreshValue(),this._value()===this.options.max&&this._trigger("complete"));this._super("_setOption",a,c)},_value:function(){var a=this.options.value;"number"!==typeof a&&(a=0);return Math.min(this.options.max,Math.max(this.min,a))},_percentage:function(){return 100*this._value()/this.options.max},_refreshValue:function(){var a=
this.value(),c=this._percentage();this.oldValue!==a&&(this.oldValue=a,this._trigger("change"));this.valueDiv.toggle(a>this.min).toggleClass("ui-corner-right",a===this.options.max).width(c.toFixed(0)+"%");this.element.attr("aria-valuenow",a)}})})(m);(function(e){e.widget("ui.slider",e.ui.mouse,{version:"1.9m6",widgetEventPrefix:"slide",options:{animate:!1,distance:0,max:100,min:0,orientation:"horizontal",range:!1,step:1,value:0,values:null},_create:function(){var a=this,g=this.options,c=this.element.find(".ui-slider-handle").addClass("ui-state-default ui-corner-all"),
b=g.values&&g.values.length||1,j=[];this._mouseSliding=this._keySliding=!1;this._animateOff=!0;this._handleIndex=null;this._detectOrientation();this._mouseInit();this.element.addClass("ui-slider ui-slider-"+this.orientation+" ui-widget ui-widget-content ui-corner-all"+(g.disabled?" ui-slider-disabled ui-disabled":""));this.range=e([]);if(g.range){if(!0===g.range&&(g.values||(g.values=[this._valueMin(),this._valueMin()]),g.values.length&&2!==g.values.length))g.values=[g.values[0],g.values[0]];this.range=
e("<div></div>").appendTo(this.element).addClass("ui-slider-range ui-widget-header"+("min"===g.range||"max"===g.range?" ui-slider-range-"+g.range:""))}for(var l=c.length;l<b;l+=1)j.push("<a class='ui-slider-handle ui-state-default ui-corner-all' href='#'></a>");this.handles=c.add(e(j.join("")).appendTo(a.element));this.handle=this.handles.eq(0);this.handles.add(this.range).filter("a").click(function(a){a.preventDefault()}).hover(function(){g.disabled||e(this).addClass("ui-state-hover")},function(){e(this).removeClass("ui-state-hover")}).focus(function(){g.disabled?
e(this).blur():(e(".ui-slider .ui-state-focus").removeClass("ui-state-focus"),e(this).addClass("ui-state-focus"))}).blur(function(){e(this).removeClass("ui-state-focus")});this.handles.each(function(a){e(this).data("index.ui-slider-handle",a)});this.handles.keydown(function(b){var c=!0,d=e(this).data("index.ui-slider-handle"),j,g,l;if(!a.options.disabled){switch(b.keyCode){case e.ui.keyCode.HOME:case e.ui.keyCode.END:case e.ui.keyCode.PAGE_UP:case e.ui.keyCode.PAGE_DOWN:case e.ui.keyCode.UP:case e.ui.keyCode.RIGHT:case e.ui.keyCode.DOWN:case e.ui.keyCode.LEFT:if(c=
!1,!a._keySliding&&(a._keySliding=!0,e(this).addClass("ui-state-active"),j=a._start(b,d),!1===j))return}l=a.options.step;j=a.options.values&&a.options.values.length?g=a.values(d):g=a.value();switch(b.keyCode){case e.ui.keyCode.HOME:g=a._valueMin();break;case e.ui.keyCode.END:g=a._valueMax();break;case e.ui.keyCode.PAGE_UP:g=a._trimAlignValue(j+(a._valueMax()-a._valueMin())/5);break;case e.ui.keyCode.PAGE_DOWN:g=a._trimAlignValue(j-(a._valueMax()-a._valueMin())/5);break;case e.ui.keyCode.UP:case e.ui.keyCode.RIGHT:if(j===
a._valueMax())return;g=a._trimAlignValue(j+l);break;case e.ui.keyCode.DOWN:case e.ui.keyCode.LEFT:if(j===a._valueMin())return;g=a._trimAlignValue(j-l)}a._slide(b,d,g);return c}}).keyup(function(b){var c=e(this).data("index.ui-slider-handle");a._keySliding&&(a._keySliding=!1,a._stop(b,c),a._change(b,c),e(this).removeClass("ui-state-active"))});this._refreshValue();this._animateOff=!1},destroy:function(){this.handles.remove();this.range.remove();this.element.removeClass("ui-slider ui-slider-horizontal ui-slider-vertical ui-slider-disabled ui-widget ui-widget-content ui-corner-all").removeData("slider").unbind(".slider");
this._mouseDestroy();return this},_mouseCapture:function(a){var g=this.options,c,b,j,l,f;if(g.disabled)return!1;this.elementSize={width:this.element.outerWidth(),height:this.element.outerHeight()};this.elementOffset=this.element.offset();c=this._normValueFromMouse({x:a.pageX,y:a.pageY});b=this._valueMax()-this._valueMin()+1;l=this;this.handles.each(function(a){var d=Math.abs(c-l.values(a));b>d&&(b=d,j=e(this),f=a)});!0===g.range&&this.values(1)===g.min&&(f+=1,j=e(this.handles[f]));if(!1===this._start(a,
f))return!1;this._mouseSliding=!0;l._handleIndex=f;j.addClass("ui-state-active").focus();g=j.offset();this._clickOffset=!e(a.target).parents().andSelf().is(".ui-slider-handle")?{left:0,top:0}:{left:a.pageX-g.left-j.width()/2,top:a.pageY-g.top-j.height()/2-(parseInt(j.css("borderTopWidth"),10)||0)-(parseInt(j.css("borderBottomWidth"),10)||0)+(parseInt(j.css("marginTop"),10)||0)};this.handles.hasClass("ui-state-hover")||this._slide(a,f,c);return this._animateOff=!0},_mouseStart:function(){return!0},
_mouseDrag:function(a){var g=this._normValueFromMouse({x:a.pageX,y:a.pageY});this._slide(a,this._handleIndex,g);return!1},_mouseStop:function(a){this.handles.removeClass("ui-state-active");this._mouseSliding=!1;this._stop(a,this._handleIndex);this._change(a,this._handleIndex);this._clickOffset=this._handleIndex=null;return this._animateOff=!1},_detectOrientation:function(){this.orientation="vertical"===this.options.orientation?"vertical":"horizontal"},_normValueFromMouse:function(a){var g;"horizontal"===
this.orientation?(g=this.elementSize.width,a=a.x-this.elementOffset.left-(this._clickOffset?this._clickOffset.left:0)):(g=this.elementSize.height,a=a.y-this.elementOffset.top-(this._clickOffset?this._clickOffset.top:0));g=a/g;1<g&&(g=1);0>g&&(g=0);"vertical"===this.orientation&&(g=1-g);a=this._valueMax()-this._valueMin();return this._trimAlignValue(this._valueMin()+g*a)},_start:function(a,g){var c={handle:this.handles[g],value:this.value()};this.options.values&&this.options.values.length&&(c.value=
this.values(g),c.values=this.values());return this._trigger("start",a,c)},_slide:function(a,g,c){var b;if(this.options.values&&this.options.values.length){b=this.values(g?0:1);if(2===this.options.values.length&&!0===this.options.range&&(0===g&&c>b||1===g&&c<b))c=b;c!==this.values(g)&&(b=this.values(),b[g]=c,a=this._trigger("slide",a,{handle:this.handles[g],value:c,values:b}),this.values(g?0:1),!1!==a&&this.values(g,c,!0))}else c!==this.value()&&(a=this._trigger("slide",a,{handle:this.handles[g],value:c}),
!1!==a&&this.value(c))},_stop:function(a,g){var c={handle:this.handles[g],value:this.value()};this.options.values&&this.options.values.length&&(c.value=this.values(g),c.values=this.values());this._trigger("stop",a,c)},_change:function(a,g){if(!this._keySliding&&!this._mouseSliding){var c={handle:this.handles[g],value:this.value()};this.options.values&&this.options.values.length&&(c.value=this.values(g),c.values=this.values());this._trigger("change",a,c)}},value:function(a){if(arguments.length)this.options.value=
this._trimAlignValue(a),this._refreshValue(),this._change(null,0);else return this._value()},values:function(a,g){var c,b,j;if(1<arguments.length)this.options.values[a]=this._trimAlignValue(g),this._refreshValue(),this._change(null,a);else if(arguments.length)if(e.isArray(arguments[0])){c=this.options.values;b=arguments[0];for(j=0;j<c.length;j+=1)c[j]=this._trimAlignValue(b[j]),this._change(null,j);this._refreshValue()}else return this.options.values&&this.options.values.length?this._values(a):this.value();
else return this._values()},_setOption:function(a,g){var c,b=0;e.isArray(this.options.values)&&(b=this.options.values.length);e.Widget.prototype._setOption.apply(this,arguments);switch(a){case "disabled":g?(this.handles.filter(".ui-state-focus").blur(),this.handles.removeClass("ui-state-hover"),this.handles.prop("disabled",!0),this.element.addClass("ui-disabled")):(this.handles.prop("disabled",!1),this.element.removeClass("ui-disabled"));break;case "orientation":this._detectOrientation();this.element.removeClass("ui-slider-horizontal ui-slider-vertical").addClass("ui-slider-"+
this.orientation);this._refreshValue();break;case "value":this._animateOff=!0;this._refreshValue();this._change(null,0);this._animateOff=!1;break;case "values":this._animateOff=!0;this._refreshValue();for(c=0;c<b;c+=1)this._change(null,c);this._animateOff=!1}},_value:function(){var a=this.options.value;return a=this._trimAlignValue(a)},_values:function(a){var g,c;if(arguments.length)return g=this.options.values[a],g=this._trimAlignValue(g);g=this.options.values.slice();for(c=0;c<g.length;c+=1)g[c]=
this._trimAlignValue(g[c]);return g},_trimAlignValue:function(a){if(a<=this._valueMin())return this._valueMin();if(a>=this._valueMax())return this._valueMax();var g=0<this.options.step?this.options.step:1,c=(a-this._valueMin())%g,a=a-c;2*Math.abs(c)>=g&&(a+=0<c?g:-g);return parseFloat(a.toFixed(5))},_valueMin:function(){return this.options.min},_valueMax:function(){return this.options.max},_refreshValue:function(){var a=this.options.range,g=this.options,c=this,b=!this._animateOff?g.animate:!1,j,l=
{},f,k,d,q;if(this.options.values&&this.options.values.length)this.handles.each(function(a){j=100*((c.values(a)-c._valueMin())/(c._valueMax()-c._valueMin()));l["horizontal"===c.orientation?"left":"bottom"]=j+"%";e(this).stop(1,1)[b?"animate":"css"](l,g.animate);if(!0===c.options.range)if("horizontal"===c.orientation){if(0===a)c.range.stop(1,1)[b?"animate":"css"]({left:j+"%"},g.animate);if(1===a)c.range[b?"animate":"css"]({width:j-f+"%"},{queue:!1,duration:g.animate})}else{if(0===a)c.range.stop(1,
1)[b?"animate":"css"]({bottom:j+"%"},g.animate);if(1===a)c.range[b?"animate":"css"]({height:j-f+"%"},{queue:!1,duration:g.animate})}f=j});else{k=this.value();d=this._valueMin();q=this._valueMax();j=q!==d?100*((k-d)/(q-d)):0;l["horizontal"===c.orientation?"left":"bottom"]=j+"%";this.handle.stop(1,1)[b?"animate":"css"](l,g.animate);if("min"===a&&"horizontal"===this.orientation)this.range.stop(1,1)[b?"animate":"css"]({width:j+"%"},g.animate);if("max"===a&&"horizontal"===this.orientation)this.range[b?
"animate":"css"]({width:100-j+"%"},{queue:!1,duration:g.animate});if("min"===a&&"vertical"===this.orientation)this.range.stop(1,1)[b?"animate":"css"]({height:j+"%"},g.animate);if("max"===a&&"vertical"===this.orientation)this.range[b?"animate":"css"]({height:100-j+"%"},{queue:!1,duration:g.animate})}}})})(m);(function(e){function a(a){return function(){var c=this.element.val();a.apply(this,arguments);this._refresh();c!==this.element.val()&&this._trigger("change")}}e.widget("ui.spinner",{version:"1.9m6",
defaultElement:"<input>",widgetEventPrefix:"spin",options:{incremental:!0,max:null,min:null,numberFormat:null,page:10,step:1,change:null,spin:null,start:null,stop:null},_create:function(){this._value(this.element.val(),!0);this._draw();this._bind(this._events);this._refresh()},_getCreateOptions:function(){var a={},c=this.element;e.each(["min","max","step"],function(b,j){var e=c.attr(j);void 0!==e&&e.length&&(a[j]=e)});return a},_events:{keydown:function(a){this._start(a)&&this._keydown(a)&&a.preventDefault()},
keyup:"_stop",focus:function(){this.uiSpinner.addClass("ui-state-active");this.previous=this.element.val()},blur:function(a){this._refresh();this.uiSpinner.removeClass("ui-state-active");this.previous!==this.element.val()&&this._trigger("change",a)},mousewheel:function(a,c){if(c){if(!this.spinning&&!this._start(a))return!1;this._spin((0<c?1:-1)*this.options.step,a);clearTimeout(this.mousewheelTimer);this.mousewheelTimer=setTimeout(function(){this.spinning&&this._stop(a)},100);a.preventDefault()}},
"mousedown .ui-spinner-button":function(a){a.preventDefault();document.activeElement!==this.element[0]&&this.element.focus();!1!==this._start(a)&&this._repeat(null,e(a.currentTarget).hasClass("ui-spinner-up")?1:-1,a)},"mouseup .ui-spinner-button":"_stop","mouseenter .ui-spinner-button":function(a){if(e(a.currentTarget).hasClass("ui-state-active")){if(!1===this._start(a))return!1;this._repeat(null,e(a.currentTarget).hasClass("ui-spinner-up")?1:-1,a)}},"mouseleave .ui-spinner-button":"_stop"},_draw:function(){var a=
this.uiSpinner=this.element.addClass("ui-spinner-input").attr("autocomplete","off").wrap(this._uiSpinnerHtml()).parent().append(this._buttonHtml());this._hoverable(a);this.element.attr("role","spinbutton");this.buttons=a.find(".ui-spinner-button").attr("tabIndex",-1).button().removeClass("ui-corner-all");this.buttons.height()===a.height()&&a.height(a.height());this.options.disabled&&this.disable()},_keydown:function(a){var c=this.options,b=e.ui.keyCode;switch(a.keyCode){case b.UP:return this._repeat(null,
1,a),!0;case b.DOWN:return this._repeat(null,-1,a),!0;case b.PAGE_UP:return this._repeat(null,c.page,a),!0;case b.PAGE_DOWN:return this._repeat(null,-c.page,a),!0}return!1},_uiSpinnerHtml:function(){return"<span class='ui-spinner ui-state-default ui-widget ui-widget-content ui-corner-all'></span>"},_buttonHtml:function(){return"<a class='ui-spinner-button ui-spinner-up ui-corner-tr'><span class='ui-icon ui-icon-triangle-1-n'>&#9650;</span></a><a class='ui-spinner-button ui-spinner-down ui-corner-br'><span class='ui-icon ui-icon-triangle-1-s'>&#9660;</span></a>"},
_start:function(a){if(!this.spinning&&!1===this._trigger("start",a))return!1;this.counter||(this.counter=1);return this.spinning=!0},_repeat:function(a,c,b){a=a||500;clearTimeout(this.timer);this.timer=this._delay(function(){this._repeat(40,c,b)},a);this._spin(c*this.options.step,b)},_spin:function(a,c){var b=this.value()||0;this.counter||(this.counter=1);b=this._adjustValue(b+a*this._increment(this.counter));if(!this.spinning||!1!==this._trigger("spin",c,{value:b}))this._value(b),this.counter++},
_increment:function(a){var c=this.options.incremental;return c?e.isFunction(c)?c(a):Math.floor(a*a*a/5E4-a*a/500+17*a/200+1):1},_precision:function(){var a=this._precisionOf(this.options.step);null!==this.options.min&&(a=Math.max(a,this._precisionOf(this.options.min)));return a},_precisionOf:function(a){var a=a.toString(),c=a.indexOf(".");return-1===c?0:a.length-c-1},_adjustValue:function(a){var c,b=this.options;c=null!==b.min?b.min:0;a=Math.round((a-c)/b.step)*b.step;a=parseFloat((c+a).toFixed(this._precision()));
return null!==b.max&&a>b.max?b.max:null!==b.min&&a<b.min?b.min:a},_stop:function(a){this.spinning&&(clearTimeout(this.timer),clearTimeout(this.mousewheelTimer),this.counter=0,this.spinning=!1,this._trigger("stop",a))},_setOption:function(a,c){this._super("_setOption",a,c);"disabled"===a&&(c?(this.element.prop("disabled",!0),this.buttons.button("disable")):(this.element.prop("disabled",!1),this.buttons.button("enable")))},_setOptions:a(function(a){this._super("_setOptions",a);this._value(this.element.val())}),
_parse:function(a){"string"===typeof a&&""!==a&&(a=window.Globalize&&this.options.numberFormat?Globalize.parseFloat(a):+a);return""===a||isNaN(a)?null:a},_format:function(a){return""===a?"":window.Globalize&&this.options.numberFormat?Globalize.format(a,this.options.numberFormat):a},_refresh:function(){this.element.attr({"aria-valuemin":this.options.min,"aria-valuemax":this.options.max,"aria-valuenow":this._parse(this.element.val())})},_value:function(a,c){var b;""!==a&&(b=this._parse(a),null!==b&&
(c||(b=this._adjustValue(b)),a=this._format(b)));this.element.val(a);this._refresh()},destroy:function(){this.element.removeClass("ui-spinner-input").prop("disabled",!1).removeAttr("autocomplete").removeAttr("role").removeAttr("aria-valuemin").removeAttr("aria-valuemax").removeAttr("aria-valuenow");this._super("destroy");this.uiSpinner.replaceWith(this.element)},stepUp:a(function(a){this._stepUp(a)}),_stepUp:function(a){this._spin((a||1)*this.options.step)},stepDown:a(function(a){this._stepDown(a)}),
_stepDown:function(a){this._spin((a||1)*-this.options.step)},pageUp:a(function(a){this._stepUp((a||1)*this.options.page)}),pageDown:a(function(a){this._stepDown((a||1)*this.options.page)}),value:function(g){if(!arguments.length)return this._parse(this.element.val());a(this._value).call(this,g)},widget:function(){return this.uiSpinner}})})(m);(function(e,a){var g=0,c=function(){var a=/#.*$/,b=location.href.replace(a,"");return function(c){c=c.cloneNode(!1);return 1<c.hash.length&&c.href.replace(a,
"")===b}}();e.widget("ui.tabs",{version:"1.9m6",options:{active:null,collapsible:!1,event:"click",fx:null,activate:null,beforeActivate:null,beforeLoad:null,load:null},_create:function(){var a=this,b=a.options,c=b.active;a.running=!1;a.element.addClass("ui-tabs ui-widget ui-widget-content ui-corner-all");a._processTabs();if(null===c&&(location.hash&&a.anchors.each(function(a,b){if(b.hash===location.hash)return c=a,!1}),null===c&&(c=a.lis.filter(".ui-tabs-active").index()),null===c||-1===c))c=a.lis.length?
0:!1;!1!==c&&(c=this.lis.eq(c).index(),-1===c&&(c=b.collapsible?!1:0));b.active=c;!b.collapsible&&(!1===b.active&&this.anchors.length)&&(b.active=0);e.isArray(b.disabled)&&(b.disabled=e.unique(b.disabled.concat(e.map(this.lis.filter(".ui-state-disabled"),function(b){return a.lis.index(b)}))).sort());this._setupFx(b.fx);this._refresh();this.panels.hide();this.lis.removeClass("ui-tabs-active ui-state-active");!1!==b.active&&this.anchors.length?(this.active=this._findActive(b.active),a._getPanelForTab(this.active).show(),
this.lis.eq(b.active).addClass("ui-tabs-active ui-state-active"),this.load(b.active)):this.active=e()},_setOption:function(a,b){"active"==a?this._activate(b):"disabled"===a?this._setupDisabled(b):(this._super("_setOption",a,b),"collapsible"===a&&(!b&&!1===this.options.active)&&this._activate(0),"event"===a&&this._setupEvents(b),"fx"===a&&this._setupFx(b))},_tabId:function(a){return e(a).attr("aria-controls")||"ui-tabs-"+ ++g},_sanitizeSelector:function(a){return a?a.replace(/[!"$%&'()*+,.\/:;<=>?@[\]^`{|}~]/g,
"\\$&"):""},refresh:function(){var a=this.options,b=this.list.children(":has(a[href])");a.disabled=e.map(b.filter(".ui-state-disabled"),function(a){return b.index(a)});this._processTabs();this._refresh();this.panels.not(this._getPanelForTab(this.active)).hide();!1===a.active||!this.anchors.length?(a.active=!1,this.active=e()):this.active.length&&!e.contains(this.list[0],this.active[0])?(a=a.active-1,this._activate(0<=a?a:0)):a.active=this.anchors.index(this.active)},_refresh:function(){var a=this.options;
this.element.toggleClass("ui-tabs-collapsible",a.collapsible);this.list.addClass("ui-tabs-nav ui-helper-reset ui-helper-clearfix ui-widget-header ui-corner-all");this.lis.addClass("ui-state-default ui-corner-top");this.panels.addClass("ui-tabs-panel ui-widget-content ui-corner-bottom");this._setupDisabled(a.disabled);this._setupEvents(a.event);this.lis.unbind(".tabs");this._focusable(this.lis);this._hoverable(this.lis)},_processTabs:function(){var a=this;this.list=this.element.find("ol,ul").eq(0);
this.lis=e(" > li:has(a[href])",this.list);this.anchors=this.lis.map(function(){return e("a",this)[0]});this.panels=e([]);this.anchors.each(function(b,f){var k,d;if(c(f))k=f.hash,d=a.element.find(a._sanitizeSelector(k));else{var g=a._tabId(f);k="#"+g;d=a.element.find(k);d.length||(d=a._createPanel(g),d.insertAfter(a.panels[b-1]||a.list))}d.length&&(a.panels=a.panels.add(d));e(f).attr("aria-controls",k.substring(1))})},_createPanel:function(a){return e("<div></div>").attr("id",a).addClass("ui-tabs-panel ui-widget-content ui-corner-bottom").data("destroy.tabs",
!0)},_setupDisabled:function(a){e.isArray(a)&&(a.length?a.length===this.anchors.length&&(a=!0):a=!1);for(var b=0,c;c=this.lis[b];b++)e(c).toggleClass("ui-state-disabled",!0===a||-1!==e.inArray(b,a));this.options.disabled=a},_setupFx:function(a){a&&(e.isArray(a)?(this.hideFx=a[0],this.showFx=a[1]):this.hideFx=this.showFx=a)},_resetStyle:function(a,b){!e.support.opacity&&b.opacity&&a[0].style.removeAttribute("filter")},_setupEvents:function(a){this.anchors.unbind(".tabs");a&&this.anchors.bind(a.split(" ").join(".tabs ")+
".tabs",e.proxy(this,"_eventHandler"));this.anchors.bind("click.tabs",function(a){a.preventDefault()})},_eventHandler:function(a){var b=this.options,c=this.active,k=e(a.currentTarget),d=k[0]===c[0],g=d&&b.collapsible,o=g?e():this._getPanelForTab(k),m=!c.length?e():this._getPanelForTab(c),p=k.closest("li"),c={oldTab:c,oldPanel:m,newTab:g?e():k,newPanel:o};a.preventDefault();if(p.hasClass("ui-state-disabled")||p.hasClass("ui-tabs-loading")||this.running||d&&!b.collapsible||!1===this._trigger("beforeActivate",
a,c))k[0].blur();else{b.active=g?!1:this.anchors.index(k);this.active=d?e():k;this.xhr&&this.xhr.abort();if(!m.length&&!o.length)throw"jQuery UI Tabs: Mismatching fragment identifier.";o.length&&(this.load(this.anchors.index(k),a),k[0].blur());this._toggle(a,c)}},_toggle:function(a,b){function c(){d.running=!1;d._trigger("activate",a,b)}function k(){b.newTab.closest("li").addClass("ui-tabs-active ui-state-active");g.length&&d.showFx?g.animate(d.showFx,d.showFx.duration||"normal",function(){d._resetStyle(e(this),
d.showFx);c()}):(g.show(),c())}var d=this,g=b.newPanel,o=b.oldPanel;d.running=!0;o.length&&d.hideFx?o.animate(d.hideFx,d.hideFx.duration||"normal",function(){b.oldTab.closest("li").removeClass("ui-tabs-active ui-state-active");d._resetStyle(e(this),d.hideFx);k()}):(b.oldTab.closest("li").removeClass("ui-tabs-active ui-state-active"),o.hide(),k())},_activate:function(a){a=this._findActive(a)[0];a!==this.active[0]&&(a=a||this.active[0],this._eventHandler({target:a,currentTarget:a,preventDefault:e.noop}))},
_findActive:function(a){return"number"===typeof a?this.anchors.eq(a):"string"===typeof a?this.anchors.filter("[href$='"+a+"']"):e()},_getIndex:function(a){"string"==typeof a&&(a=this.anchors.index(this.anchors.filter("[href$="+a+"]")));return a},_destroy:function(){this.xhr&&this.xhr.abort();this.element.removeClass("ui-tabs ui-widget ui-widget-content ui-corner-all ui-tabs-collapsible");this.list.removeClass("ui-tabs-nav ui-helper-reset ui-helper-clearfix ui-widget-header ui-corner-all");this.anchors.unbind(".tabs").removeData("href.tabs").removeData("load.tabs");
this.lis.unbind(".tabs").add(this.panels).each(function(){e.data(this,"destroy.tabs")?e(this).remove():e(this).removeClass("ui-state-default ui-corner-top ui-tabs-active ui-state-active ui-state-disabled ui-tabs-panel ui-widget-content ui-corner-bottom")});return this},enable:function(b){var c=this.options.disabled;!1!==c&&(b===a?c=!1:(b=this._getIndex(b),c=e.isArray(c)?e.map(c,function(a){return a!==b?a:null}):e.map(this.lis,function(a,c){return c!==b?c:null})),this._setupDisabled(c))},disable:function(b){var c=
this.options.disabled;if(!0!==c){if(b===a)c=!0;else{b=this._getIndex(b);if(-1!==e.inArray(b,c))return;c=e.isArray(c)?e.merge([b],c).sort():[b]}this._setupDisabled(c)}},load:function(a,b){var a=this._getIndex(a),f=this,k=this.anchors.eq(a),d=f._getPanelForTab(k),g={tab:k,panel:d};if(!c(k[0])){if(this.xhr=e.ajax({url:k.attr("href"),beforeSend:function(a,c){return f._trigger("beforeLoad",b,e.extend({jqXHR:a,ajaxSettings:c},g))}}))this.lis.eq(a).addClass("ui-tabs-loading"),this.xhr.success(function(a){d.html(a);
f._trigger("load",b,g)}).complete(function(b,c){"abort"===c&&f.panels.stop(!1,!0);f.lis.eq(a).removeClass("ui-tabs-loading");b===f.xhr&&delete f.xhr});return this}},_getPanelForTab:function(a){return this.element.find(this._sanitizeSelector("#"+e(a).attr("aria-controls")))}});if(!1!==e.uiBackCompat){e.ui.tabs.prototype._ui=function(a,b){return{tab:a,panel:b,index:this.anchors.index(a)}};(function(a,b){b.url=function(a,b){this.anchors.eq(a).attr("href",b)}})(m,m.ui.tabs.prototype);(function(a,b){a.extend(b.options,
{ajaxOptions:null,cache:!1});var c=b._create,k=b._setOption,d=b._destroy,g=b.url||a.noop;a.extend(b,{_create:function(){c.call(this);var b=this;this.element.bind("tabsbeforeload.tabs",function(c,d){a.data(d.tab[0],"cache.tabs")?c.preventDefault():(a.extend(d.ajaxSettings,b.options.ajaxOptions,{error:function(a,c){try{b.options.ajaxOptions.error(a,c,d.tab.closest("li").index(),d.tab[0])}catch(f){}}}),d.jqXHR.success(function(){b.options.cache&&a.data(d.tab[0],"cache.tabs",!0)}))})},_setOption:function(a,
b){"cache"===a&&!1===b&&this.anchors.removeData("cache.tabs");k.apply(this,arguments)},_destroy:function(){this.anchors.removeData("cache.tabs");d.call(this)},url:function(a,b){this.anchors.eq(a).removeData("cache.tabs");g.apply(this,arguments)}})})(m,m.ui.tabs.prototype);(function(a,b){b.abort=function(){this.xhr&&this.xhr.abort()}})(m,m.ui.tabs.prototype);e.widget("ui.tabs",e.ui.tabs,{options:{spinner:"<em>Loading&#8230;</em>"},_create:function(){this._super("_create");this._bind({tabsbeforeload:function(a,
b){if(this.options.spinner){var c=b.tab.find("span"),k=c.html();c.html(this.options.spinner);b.jqXHR.complete(function(){c.html(k)})}}})}});(function(a,b){a.extend(b.options,{enable:null,disable:null});var c=b.enable,k=b.disable;b.enable=function(b){var k=this.options,g;if(b&&!0===k.disabled||a.isArray(k.disabled)&&-1!==a.inArray(b,k.disabled))g=!0;c.apply(this,arguments);g&&this._trigger("enable",null,this._ui(this.anchors[b],this.panels[b]))};b.disable=function(b){var c=this.options,f;if(b&&!1===
c.disabled||a.isArray(c.disabled)&&-1===a.inArray(b,c.disabled))f=!0;k.apply(this,arguments);f&&this._trigger("disable",null,this._ui(this.anchors[b],this.panels[b]))}})(m,m.ui.tabs.prototype);(function(b,c){b.extend(c.options,{add:null,remove:null,tabTemplate:"<li><a href='#{href}'><span>#{label}</span></a></li>"});c.add=function(c,k,d){d===a&&(d=this.anchors.length);var g=this.options,k=b(g.tabTemplate.replace(/#\{href\}/g,c).replace(/#\{label\}/g,k)),c=!c.indexOf("#")?c.replace("#",""):this._tabId(k.find("a")[0]);
k.addClass("ui-state-default ui-corner-top").data("destroy.tabs",!0);k.find("a").attr("aria-controls",c);var e=d>=this.lis.length,l=this.element.find("#"+c);l.length||(l=this._createPanel(c),e?0<d?l.insertAfter(this.panels.eq(-1)):l.appendTo(this.element):l.insertBefore(this.panels[d]));l.addClass("ui-tabs-panel ui-widget-content ui-corner-bottom").hide();e?k.appendTo(this.list):k.insertBefore(this.lis[d]);g.disabled=b.map(g.disabled,function(a){return a>=d?++a:a});this.refresh();1===this.lis.length&&
!1===g.active&&this.option("active",0);this._trigger("add",null,this._ui(this.anchors[d],this.panels[d]));return this};c.remove=function(a){var a=this._getIndex(a),c=this.options,d=this.lis.eq(a).remove(),g=this._getPanelForTab(d.find("a[aria-controls]")).remove();d.hasClass("ui-tabs-active")&&2<this.anchors.length&&this._activate(a+(a+1<this.anchors.length?1:-1));c.disabled=b.map(b.grep(c.disabled,function(b){return b!==a}),function(b){return b>=a?--b:b});this.refresh();this._trigger("remove",null,
this._ui(d.find("a")[0],g[0]));return this}})(m,m.ui.tabs.prototype);(function(a,b){b.length=function(){return this.anchors.length}})(m,m.ui.tabs.prototype);(function(a,b){a.extend(b.options,{idPrefix:"ui-tabs-"});b._tabId=function(b){return a(b).attr("aria-controls")||b.title&&b.title.replace(/\s/g,"_").replace(/[^\w\u00c0-\uFFFF-]/g,"")||this.options.idPrefix+ ++g}})(m,m.ui.tabs.prototype);(function(a,b){a.extend(b.options,{panelTemplate:"<div></div>"});b._createPanel=function(b){return a(this.options.panelTemplate).attr("id",
b).addClass("ui-tabs-panel ui-widget-content ui-corner-bottom").data("destroy.tabs",!0)}})(m,m.ui.tabs.prototype);(function(b,c){var f=c._create,k=c._setOption,d=c._eventHandler;c._create=function(){var b=this.options;null===b.active&&b.selected!==a&&(b.active=-1===b.selected?!1:b.selected);f.call(this);b.selected=b.active;!1===b.selected&&(b.selected=-1)};c._setOption=function(a,b){if("selected"!==a)return k.apply(this,arguments);var c=this.options;k.call(this,"active",-1===b?!1:b);c.selected=c.active;
!1===c.selected&&(c.selected=-1)};c._eventHandler=function(a){d.apply(this,arguments);this.options.selected=this.options.active;!1===this.options.selected&&(this.options.selected=-1)}})(m,m.ui.tabs.prototype);(function(a,b){a.extend(b.options,{show:null,select:null});var c=b._create,k=b._trigger;b._create=function(){c.call(this);!1!==this.options.active&&this._trigger("show",null,this._ui(this.active[0],this._getPanelForTab(this.active)[0]))};b._trigger=function(a,b,c){if(!k.apply(this,arguments))return!1;
"beforeActivate"===a&&c.newTab.length?k.call(this,"select",b,{tab:c.newTab[0],panel:c.newPanel[0],index:c.newTab.closest("li").index()}):"activate"===a&&c.newTab.length&&k.call(this,"show",b,{tab:c.newTab[0],panel:c.newPanel[0],index:c.newTab.closest("li").index()})}})(m,m.ui.tabs.prototype);(function(a,b){b.select=function(a){a=this._getIndex(a);if(-1===a)if(this.options.collapsible&&-1!==this.options.selected)a=this.options.selected;else return;this.anchors.eq(a).trigger(this.options.event+".tabs")}})(m,
m.ui.tabs.prototype);var b=0;e.widget("ui.tabs",e.ui.tabs,{options:{cookie:null},_create:function(){var a=this.options,b;null==a.active&&a.cookie&&(b=parseInt(this._cookie(),10),-1===b&&(b=!1),a.active=b);this._super("_create")},_cookie:function(a){var c=[this.cookie||(this.cookie=this.options.cookie.name||"ui-tabs-"+ ++b)];arguments.length&&(c.push(!1===a?-1:a),c.push(this.options.cookie));return e.cookie.apply(null,c)},_refresh:function(){this._super("_refresh");this.options.cookie&&this._cookie(this.options.active,
this.options.cookie)},_eventHandler:function(a){this._superApply("_eventHandler",arguments);this.options.cookie&&this._cookie(this.options.active,this.options.cookie)},_destroy:function(){this._super("_destroy");this.options.cookie&&this._cookie(null,this.options.cookie)}});e.widget("ui.tabs",e.ui.tabs,{_trigger:function(a,b,c){c=e.extend({},c);"load"===a&&(c.panel=c.panel[0],c.tab=c.tab[0]);return this._super("_trigger",a,b,c)}})}})(m);(function(e){var a=0;e.widget("ui.tooltip",{version:"1.9m6",
options:{content:function(){return e(this).attr("title")},hide:!0,items:"[title]",position:{my:"left+15 center",at:"right center",collision:"flipfit flipfit"},show:!0,tooltipClass:null,close:null,open:null},_create:function(){this._bind({mouseover:"open",focusin:"open"});this.tooltips={}},_setOption:function(a,c){"disabled"===a?(this[c?"_disable":"_enable"](),this.options[a]=c):this._super("_setOption",a,c)},_disable:function(){var a=this;e.each(this.tooltips,function(c,b){var j=e.Event("blur");j.target=
j.currentTarget=b[0];a.close(j,!0)});this.element.find(this.options.items).andSelf().each(function(){var a=e(this);a.is("[title]")&&a.data("tooltip-title",a.attr("title")).attr("title","")})},_enable:function(){this.element.find(this.options.items).andSelf().each(function(){var a=e(this);a.data("tooltip-title")&&a.attr("title",a.data("tooltip-title"))})},open:function(a){var c,b=this,j=e(a?a.target:this.element).closest(this.options.items);j.length&&!j.attr("aria-describedby")&&(j.data("tooltip-title")||
j.data("tooltip-title",j.attr("title")),(c=this.options.content.call(j[0],function(c){setTimeout(function(){b._open(a,j,c)},1)}))&&b._open(a,j,c))},_open:function(a,c,b){if(b){c.is("[title]")&&c.attr("title","");var j=this._find(c);j.length||(j=this._tooltip(c),c.attr("aria-describedby",j.attr("id")));j.find(".ui-tooltip-content").html(b);j.stop(!0).position(e.extend({of:c},this.options.position)).hide();this._show(j,this.options.show);this._trigger("open",a,{tooltip:j});this._bind(c,{mouseleave:"close",
blur:"close",keyup:function(a){if(a.keyCode==e.ui.keyCode.ESCAPE){a=e.Event(a);a.currentTarget=c[0];this.close(a,true)}}})}},close:function(a,c){var b=this,j=e(a?a.currentTarget:this.element),l=this._find(j);if(c||document.activeElement!==j[0])j.data("tooltip-title")&&j.attr("title",j.data("tooltip-title")),j.removeAttr("aria-describedby"),l.stop(!0),this._hide(l,this.options.hide,function(){e(this).remove();delete b.tooltips[this.id]}),j.unbind("mouseleave.tooltip blur.tooltip keyup.tooltip"),this._trigger("close",
a,{tooltip:l})},_tooltip:function(g){var c="ui-tooltip-"+a++,b=e("<div>").attr({id:c,role:"tooltip"}).addClass("ui-tooltip ui-widget ui-corner-all ui-widget-content "+(this.options.tooltipClass||""));e("<div>").addClass("ui-tooltip-content").appendTo(b);b.appendTo(document.body);e.fn.bgiframe&&b.bgiframe();this.tooltips[c]=g;return b},_find:function(a){return(a=a.attr("aria-describedby"))?e("#"+a):e()},_destroy:function(){e.each(this.tooltips,function(a){e("#"+a).remove()})}})})(m);return m.ui});
define("ui/tab","aloha/core jquery ui/container ui/component PubSub jqueryui".split(" "),function(m,e,a,g,c){var b=0,j={},m=a.extend({_elemBySlot:null,_groupBySlot:null,_groupByComponent:null,_constructor:function(a,c,k){var d,j,g,m,p;this._elemBySlot={};this._groupBySlot={};this._groupByComponent={};this._super(a,c);this.container=c.container;this.list=this.container.data("list");this.panels=this.container.data("panels");this.id="tab-ui-container-"+ ++b;this.panel=e("<div>",{id:this.id,unselectable:"on"});
this.handle=e('<li><a href="'+location.href.replace(/#.*$/,"")+"#"+this.id+'">'+c.label+"</a></li>");for(a=0;a<k.length;a++)if(typeof k[a]==="string")if(1===k[a].length&&k[a].charCodeAt(0)===10)this.panel.append("<div>",{unselectable:"on"});else{j=e("<span>",{unselectable:"on"});this._elemBySlot[k[a]]=j;this.panel.append(j)}else{m=e("<div>",{"class":"aloha-ui-component-group aloha-ui-hidden",unselectable:"on"}).appendTo(this.panel);p={element:m,visibleCounter:0};g=k[a];for(d=0;d<g.length;d++){this._groupBySlot[g[d]]=
p;if(g[d]&&1===g[d].length&&g[d].charCodeAt(0)===10)m.append(e("<div>",{unselectable:"on"}));else{j=e("<span>",{unselectable:"on"});this._elemBySlot[g[d]]=j;m.append(j)}}}this.panel.append(e("<div>",{"class":"aloha-ui-clear",unselectable:"on"}));this.handle.appendTo(this.list);this.panel.appendTo(this.panels);this.container.tabs("refresh");c=c.container.data("aloha-tabs");this.index=c.length;c.push(this)},adoptInto:function(a,b){var c=this._elemBySlot[a];if(!c)return false;j[a]=b;b.adoptParent(this);
c.append(b.element);if(c=this._groupBySlot[a]){this._groupByComponent[b.id]=c;if(b.isVisible()){c.visibleCounter||c.element.removeClass("aloha-ui-hidden");c.visibleCounter=c.visibleCounter+1}}return true},foreground:function(){this.container.tabs("select",this.index)},childForeground:function(){this.foreground()},hasVisibleComponents:function(){var a=this._elemBySlot,b;for(b in a)if(a.hasOwnProperty(b)&&j[b]&&j[b].visible)return true;return false},childVisible:function(a,b){b?a.container.show():a.container.hasVisibleComponents()||
a.container.hide();var c=this._groupByComponent[a.id];if(c)if(b){0===c.visibleCounter&&c.element.removeClass("aloha-ui-hidden");c.visibleCounter=c.visibleCounter+1}else{c.visibleCounter=c.visibleCounter-1;0===c.visibleCounter&&c.element.addClass("aloha-ui-hidden")}},show:function(){if(this.list.children().length){this.handle.show();this.visible=true;this.container.show();(!this.container.find(".ui-tabs-active").length||this.container.tabs("option","selected")===this.index)&&this.foreground()}},hide:function(){var a=
this.list.children();if(0!==a.length){this.handle.hide();this.visible=false;if(this.index===this.container.tabs("option","selected")){var a=this.container.data("aloha-tabs"),b;for(b=0;b<a.length;++b)if(a[b].visible){this.container.tabs("select",b);return}this.handle.removeClass("ui-tabs-active");this.container.hide()}}}});e.extend(m,{createContainer:function(){var a=e("<div>",{unselectable:"on"}),b=e("<ul>",{unselectable:"on"}).appendTo(a),k=e("<div>",{unselectable:"on"}).appendTo(a);a.data("list",
b).data("panels",k).data("aloha-tabs",[]).tabs({select:function(b,f){var k=a.data("aloha-tabs");a.data("aloha-active-container",k[f.index]);c.pub("aloha.ui.container.selected",{data:k[f.index]})}});return a}});return m});define("ui/subguarded",["aloha/core","jquery","PubSub"],function(m,e,a){function g(a){a.alohaUid||(a.alohaUid=++l);return a.alohaUid}function c(a,b){f[a.alohaUid]||(f[a.alohaUid]=[]);f[a.alohaUid].push(b);return f[a.alohaUid]}function b(a,b){k[a]||(k[a]=[]);k[a].push(b);return k[a]}
function j(a){var b=k[a]||[],c;for(c=0;c<b.length;c++)b[c].apply(null,[f[b[c].alohaUid]||[]].concat(arguments))}var l=0,f={},k={};return function(){var d=Array.prototype.slice.call(arguments),f=d.shift();"string"===typeof f&&(f=[f]);var k=d.shift();g(k);c(k,d);for(var e,l=function(a,b,c){j(e,a,b,c)},u=function(){j(e)},d=0;d<f.length;d++)e=f[d],b(e,k),m.bind(e,l),a.sub(e,u)}});define("vendor/amplify.store",["util/json2"],function(){var m={};(function(e,a){function g(f,d){c.addType(f,function(j,g,e){var l,
u=g,m=(new Date).getTime();if(!j){u={};e=[];g=0;try{for(j=d.length;j=d.key(g++);)b.test(j)&&(l=la.parse(d.getItem(j)),l.expires&&l.expires<=m?e.push(j):u[j.replace(b,"")]=l.data);for(;j=e.pop();)d.removeItem(j)}catch(y){}return u}j="__amplify__"+j;if(g===a)if(l=(l=d.getItem(j))?la.parse(l):{expires:-1},l.expires&&l.expires<=m)d.removeItem(j);else return l.data;else if(null===g)d.removeItem(j);else{l=la.stringify({data:g,expires:e.expires?m+e.expires:null});try{d.setItem(j,l)}catch(z){c[f]();try{d.setItem(j,
l)}catch(x){throw c.error();}}}return u})}var c=e.store=function(a,b,f,j){j=c.type;f&&(f.type&&f.type in c.types)&&(j=f.type);return c.types[j](a,b,f||{})};c.types={};c.type=null;c.addType=function(a,b){c.type||(c.type=a);c.types[a]=b;c[a]=function(b,d,f){f=f||{};f.type=a;return c(b,d,f)}};c.error=function(){return"amplify.store quota exceeded"};var b=/^__amplify__/,j;for(j in{localStorage:1,sessionStorage:1})try{window[j].getItem&&g(j,window[j])}catch(l){}if(window.globalStorage)try{g("globalStorage",
window.globalStorage[window.location.hostname]),"sessionStorage"===c.type&&(c.type="globalStorage")}catch(f){}(function(){if(!c.types.localStorage){var b=document.createElement("div");b.style.display="none";document.getElementsByTagName("head")[0].appendChild(b);try{b.addBehavior("#default#userdata"),b.load("amplify")}catch(d){b.parentNode.removeChild(b);return}c.addType("userData",function(d,f,j){b.load("amplify");var g,e,l=f,m=(new Date).getTime();if(!d){l={};e=[];for(d=0;f=b.XMLDocument.documentElement.attributes[d++];)g=
la.parse(f.value),g.expires&&g.expires<=m?e.push(f.name):l[f.name]=g.data;for(;d=e.pop();)b.removeAttribute(d);b.save("amplify");return l}d=d.replace(/[^-._0-9A-Za-z\xb7\xc0-\xd6\xd8-\xf6\xf8-\u037d\u37f-\u1fff\u200c-\u200d\u203f\u2040\u2070-\u218f]/g,"-");if(f===a)if(g=(f=b.getAttribute(d))?la.parse(f):{expires:-1},g.expires&&g.expires<=m)b.removeAttribute(d);else return g.data;else null===f?b.removeAttribute(d):(e=b.getAttribute(d),g=la.stringify({data:f,expires:j.expires?m+j.expires:null}),b.setAttribute(d,
g));try{b.save("amplify")}catch(z){null===e?b.removeAttribute(d):b.setAttribute(d,e);c.userData();try{b.setAttribute(d,g),b.save("amplify")}catch(x){throw null===e?b.removeAttribute(d):b.setAttribute(d,e),c.error();}}return l})}})();(function(){var b={},d={};c.addType("memory",function(c,f,j){if(!c)return b===a?a:la.parse(la.stringify(b));if(f===a)return b[c]===a?a:la.parse(la.stringify(b[c]));d[c]&&(clearTimeout(d[c]),delete d[c]);if(null===f)return delete b[c],null;b[c]=f;j.expires&&(d[c]=setTimeout(function(){delete b[c];
delete d[c]},j.expires));return f})})()})(m);return m});define("ui/floating","jquery aloha/core ui/surface ui/subguarded PubSub vendor/amplify.store".split(" "),function(m,e,a,g,c,b){function j(a,b,f,k){if("absolute"===q){b.top=b.top+d.scrollTop();b.left=b.left+d.scrollLeft()}o.offset=b;a.stop().animate(b,f,function(){k(b);c.pub("aloha.floating.changed",{position:o})})}function l(a){b.store("Aloha.FloatingMenu.pinned","true");b.store("Aloha.FloatingMenu.top",a.top);b.store("Aloha.FloatingMenu.left",
a.left)}function f(a,b,c,d,f){for(b=0;b<a.length;b++)if(a[b][0].isActive())a[b][1](c,d,f)}function k(a){if(m.browser.msie){var b=a.$element.parent();a.$element.appendTo("body");a.$element.css("position",q);b.length?a.$element.appendTo(b):a.$element.detach()}else a.$element.css("position",q)}var d=m(window),q=m.browser.msie&&/^7\.\d+/.test(m.browser.version)?"absolute":"fixed",o={style:q,offset:{top:0,left:0}};return{getPinState:function(){return b.store("Aloha.FloatingMenu.pinned")==="true"?{top:parseInt(b.store("Aloha.FloatingMenu.top"),
10),left:parseInt(b.store("Aloha.FloatingMenu.left"),10),isPinned:true}:{top:null,left:null,isPinned:false}},makeFloating:function(a,b){g(["aloha-selection-changed","aloha.ui.container.selected"],f,a,function(){a._move()});var c=function(){var c;c=b.pinLeft;var f=b.pinTop;f<0?f=0:f>d.height()&&(f=d.height()/2);c<0?c=0:c>d.width()&&(c=d.width()/2);c={top:f,left:c};b.setFloatingPosition(c);a.$element.css({top:c.top,left:c.left})};d.scroll(function(){a._move(0)});d.resize(function(){b.isFloatingMode||
c()});a.addPin();k(a);b.isFloatingMode||c();a.$element.css("z-index",10100).draggable({distance:20,stop:function(a,c){b.setFloatingPosition(c.position);b.isFloatingMode||l(c.position)}})},floatSurface:function(a,b,c,f){typeof c!=="number"&&(c=500);var k=(parseInt(m("body").css("marginTop"),10)||0)+(parseInt(m("body").css("paddingTop"),10)||0),a=a.$element;a.offset();var g=b.obj.offset(),e=d.scrollTop(),l=g.top-e-k,q=g.left,o=q+a.width()-d.width()-10;o>0&&(q=q-o);if(l>=a.height()){g.top=g.top-e;g.top=
g.top-(a.height()+10);j(a,g,c,f)}else{b=l+a.height()>g.top+b.obj.height()?{top:g.top+b.obj.height(),left:q}:{top:k,left:q};b.top=b.top+10;j(a,b,c,f)}},togglePinSurface:function(a,c,d){a=a.$element;if(d){b.store("Aloha.FloatingMenu.pinned",null);b.store("Aloha.FloatingMenu.top",null);b.store("Aloha.FloatingMenu.left",null);a.find(".aloha-ui-pin").removeClass("aloha-ui-pin-down")}else{l(c);a.find(".aloha-ui-pin").addClass("aloha-ui-pin-down")}a.css({position:"fixed",top:c.top})},POSITION_STYLE:q}});
(function(){function m(a,b,j,g,f,k){b[a]&&(j.push(a),(!0===b[a]||1===b[a])&&g.push(f+a+"/"+k))}function e(a,b,j,g,f){b=g+b+"/"+f;require._fileExists(a.toUrl(b))&&j.push(b)}function a(c,b,j){for(var g in b)b.hasOwnProperty(g)&&(!c.hasOwnProperty(g)||j)?c[g]=b[g]:"object"===typeof b[g]&&a(c[g],b[g],j)}var g=/(^.*(^|\/)nls(\/|$))([^\/]*)\/?([^\/]*)/;define("i18n",["module"],function(c){var b=c.config();return{version:"2.0.1",load:function(c,l,f,k){k=k||{};k.locale&&(b.locale=k.locale);var d=g.exec(c),
q=d[1],o=d[4],r=d[5],p=o.split("-"),u=[],t={},y,z="";d[5]?(q=d[1],c=q+r):(r=d[4],o=b.locale,o||(o=b.locale="undefined"===typeof navigator?"root":(navigator.language||navigator.userLanguage||"root").toLowerCase()),p=o.split("-"));if(k.isBuild){u.push(c);e(l,"root",u,q,r);for(y=0;y<p.length;y++)k=p[y],z+=(z?"-":"")+k,e(l,z,u,q,r);l(u,function(){f()})}else l([c],function(b){var c=[],d;m("root",b,c,u,q,r);for(y=0;y<p.length;y++){d=p[y];z=z+((z?"-":"")+d);m(z,b,c,u,q,r)}l(u,function(){var d,k,j;for(d=
c.length-1;d>-1&&c[d];d--){j=c[d];k=b[j];if(k===true||k===1)k=l(q+j+"/"+r);a(t,k)}t.t=function(a,b){return this[a]?this[a]:b?b:a};f(t)})})}}})})();define("ui/nls/i18n",{root:{"button.dismiss.label":"Dismiss","button.bold.label":"Bold","button.italic.label":"Italic","button.strikethrough.label":"Strikethrough","button.subscript.label":"Subscript","button.superscript.label":"Superscript","button.underline.label":"Underline","button.p.label":"Paragraph","button.h1.label":"Heading 1","button.h2.label":"Heading 2",
"button.h3.label":"Heading 3","button.h4.label":"Heading 4","button.h5.label":"Heading 5","button.h6.label":"Heading 6","button.pre.label":"Preformatted text","button.removeFormatting.label":"Remove formatting","button.ol.label":"Insert ordered list","button.ul.label":"Insert unordered list","button.indent.label":"Indent list","button.outdent.label":"Outdent list","button.createLink.label":"Insert link","button.removeLink.label":"Remove link","button.createAbbr.label":"Insert abbreviation","button.characterPicker.label":"Pick special characters",
"button.createLink.label":"Insert link","button.removeLink.label":"Remove link","button.createAbbr.label":"Insert abbreviation","button.characterPicker.label":"Pick special characters","button.justifyLeft.label":"Align to the left","button.justifyRight.label":"Align to the right","button.justifyCenter.label":"Center","button.justifyFull.label":"Justify","button.horizontalRule.label":"Insert horizontal rule","button.createLanguageAnnotation.label":"Insert language annotation","button.metaview.label":"Switch between meta and normal view",
"button.quote.label":"Format selection as quote","button.blockquote.label":"Format selection as blockquote","tab.format.label":"Format","tab.insert.label":"Insert","tab.abbr.label":"Abbreviation","tab.img.label":"Image","tab.link.label":"Link","tab.list.label":"List","tab.table.label":"Table","tab.col.label":"Table Column","tab.row.label":"Table Row","tab.cell.label":"Table Cell","tab.wai-lang.label":"Language annotation"},ca:!0,de:!0,mk:!0,"pt-br":!0,ru:!0,uk:!0,"zh-hans":!0});define("ui/toolbar",
"jquery aloha/core ui/surface ui/tab ui/floating ui/context i18n!ui/nls/i18n jqueryui".split(" "),function(m,e,a,g,c,b,j){var l=a.extend({_moveTimeout:null,$_container:null,_tabBySlot:null,_tabs:[],_constructor:function(a,b){var d,e,o,r;this._super(a);this.$element=m("<div>",{"class":"aloha-ui aloha-ui-toolbar",unselectable:"on"});this.$_container=g.createContainer().appendTo(this.$element);this._tabBySlot={};for(o=0;o<b.length;o++){d=b[o];e=new g(a,{label:j.t(d.label,d.label),showOn:d.showOn,container:this.$_container},
d.components);for(r in e._elemBySlot)e._elemBySlot.hasOwnProperty(r)&&(this._tabBySlot[r]=e);this._tabs.push({tab:e,settings:d})}c.makeFloating(this,l)},adoptInto:function(a,b){var c=this._tabBySlot[a];return c&&c.adoptInto(a,b)},getActiveContainer:function(){return this.$_container.data("aloha-active-container")},getContainers:function(){return this.$_container.data("aloha-tabs")},_move:function(a){var b=this;b._moveTimeout&&clearTimeout(b._moveTimeout);b._moveTimeout=setTimeout(function(){b._moveTimeout=
null;e.activeEditable&&l.isFloatingMode&&c.floatSurface(b,e.activeEditable,a,l.setFloatingPosition)},20)},addPin:function(){var a=m('<div class="aloha-ui-pin">'),b=this.$element;b.find(".ui-tabs").append(a);b.find(".ui-tabs").hover(function(){b.addClass("aloha-ui-hover")},function(){b.removeClass("aloha-ui-hover")});l.isFloatingMode||a.addClass("aloha-ui-pin-down");var d=this;a.click(function(){l.isFloatingMode=!l.isFloatingMode;var a;if(l.isFloatingMode)a={top:l.pinTop,left:l.pinLeft};else{a=d.$element.offset();
a.top=a.top-m(window).scrollTop()}l.setFloatingPosition(a);c.togglePinSurface(d,a,l.isFloatingMode)})},show:function(){l.$surfaceContainer.children().detach();l.$surfaceContainer.append(this.$element);l.$surfaceContainer.stop().fadeTo(200,1);var a=l.getFloatingPosition();this.$element.stop().css({top:a.top,left:a.left});this._move()},hide:function(){l.$surfaceContainer.stop().fadeOut(200,function(){l.$surfaceContainer.children().detach()})}});m.extend(l,{$surfaceContainer:null,isFloatingMode:true,
pinLeft:0,pinTop:0,init:function(){l.$surfaceContainer=m("<div>",{"class":"aloha aloha-surface aloha-toolbar",unselectable:"on"}).hide();m(function(){l.$surfaceContainer.appendTo("body")});a.trackRange(l.$surfaceContainer);var b=c.getPinState();l.pinTop=b.top;l.pinLeft=b.left;l.isFloatingMode=!b.isPinned},setFloatingPosition:function(a){l.pinTop=a.top;l.pinLeft=a.left},getFloatingPosition:function(){return{top:l.pinTop,left:l.pinLeft}}});l.init();return l});define("ui/settings",["jquery","util/arrays",
"util/maps","util/trees"],function(m,e,a,g){function c(a,b,c){var d,j,e=[],r;for(d=0;d<a.length;d++)if(j=a[d],!b[j.label]&&(r=g.postprune(j.components,c)))j=m.extend({},j),j.components=r,e.push(j);return e}function b(a,b,c){var d,j,e=[],r,p,u;for(d=0;d<a.length;d++)j=a[d],r=j.components||[],p=b[j.label],!j.exclusive&&p&&(u=g.postprune(p.components,c))&&(r=r.concat(u)),j=m.extend({},p||{},j),j.components=r,e.push(j);return e}function j(b,c){var j,d=a.fillKeys({},c,!0);for(j=0;j<b.length;j++)d[b[j].label]=
!0,a.fillKeys(d,g.flatten(b[j].components),!0);return d}return{defaultToolbarSettings:{tabs:[{label:"tab.format.label",showOn:{scope:"Aloha.continuoustext"},components:["bold strong italic emphasis underline \n subscript superscript strikethrough quote".split(" "),"formatLink formatAbbr formatNumeratedHeaders toggleDragDrop \n toggleMetaView wailang toggleFormatlessPaste".split(" "),"alignLeft alignCenter alignRight alignJustify \n orderedList unorderedList indentList outdentList".split(" "),["formatBlock"]]},
{label:"tab.insert.label",showOn:{scope:"Aloha.continuoustext"},components:["createTable characterPicker insertLink insertImage insertAbbr insertToc insertHorizontalRule insertTag".split(" ")]},{label:"tab.link.label",showOn:{scope:"link"},components:["editLink","removeLink","linkBrowser"]},{label:"tab.img.label",showOn:{scope:"image"},components:[["imageSource","\n","imageTitle"],["imageResizeWidth","\n","imageResizeHeight"],"imageAlignLeft imageAlignRight imageAlignNone imageIncPadding \n imageCropButton imageCnrReset imageCnrRatio imageDecPadding".split(" "),
["imageBrowser"]]},{label:"tab.abbr.label",showOn:{scope:"abbr"},components:[["abbrText","removeAbbr"]]},{label:"tab.wai-lang.label",showOn:{scope:"wai-lang"},components:[["wailangfield","removewailang"]]},{label:"tab.table.label",showOn:{scope:"table.cell"},components:[["mergecells","splitcells","tableCaption","tableSummary","formatTable"]]},{label:"tab.col.label",showOn:{scope:"table.column"},components:["addcolumnleft addcolumnright deletecolumns columnheader mergecellsColumn splitcellsColumn formatColumn".split(" ")]},
{label:"tab.row.label",showOn:{scope:"table.row"},components:["addrowbefore addrowafter deleterows rowheader mergecellsRow splitcellsRow formatRow".split(" ")]},{label:"tab.cell.label",showOn:{scope:"table.cell"},components:[["alignTop","alignMiddle","alignBottom","formatCell"]]}]},combineToolbarSettings:function(g,f,k){function d(a){return"array"===m.type(a)?!a.length:o[a]}var q=a.fillTuples({},e.map(f,function(a){return[a.label,a]})),o=j(g,k),g=b(g,q,d),f=c(f,o,d);return g.concat(f)}}});define("ui/ui-plugin",
"jquery aloha ui/context ui/container ui/surface ui/toolbar ui/scopes ui/settings PubSub jqueryui".split(" "),function(m,e,a,g,c,b,j,l,f){var k=new a,d=new b(k,function(){var a=e.settings.toolbar,b=l.defaultToolbarSettings;return!a?b.tabs:l.combineToolbarSettings(a.tabs||[],b.tabs,a.exclude||[])}());e.bind("aloha-editable-activated",function(a){c.show(k);g.showContainersForContext(k,a)});e.bind("aloha-editable-deactivated",function(){c.suppressHide||c.hide(k)});f.sub("aloha.ui.scope.change",function(){g.showContainersForContext(k);
j.getPrimaryScope();var a=d._tabs,b=j.getPrimaryScope(),c,f;for(f=0;f<a.length;f++){c=a[f].settings;if("object"===m.type(c.showOn)&&c.showOn.scope===b){a[f].tab.foreground();break}}});return{adoptInto:function(a,b){return d.adoptInto(a,b)},showToolbar:function(a){c.show(k);g.showContainersForContext(k,a)}}});define("ui/ui",["jquery","ui/ui-plugin"],function(m,e){var a={};return{adopt:function(g,c,b){"string"!==m.type(g)?(b=c,c=g,g=b.name):b=m.extend({name:g},b);c.isInstance||(c=b?c.extend(b):c,c=
new c);a[g]=c;e.adoptInto(g,c);return c},getAdoptedComponent:function(g){return a[g]||null}}});define("ui/utils",["jquery","jqueryui"],function(m){function e(a){return a.html||a.text||a.tooltip}function a(a){return'<img class="aloha-ui-inline-icon" src="'+a+'">'}return{wrapWithLabel:function(a,c){return m("<label>",{"class":"aloha-ui-label"}).append(m("<span>",{"class":"aloha-ui-label-text",text:a})).append(c)},makeButton:function(g,c,b){g.button({label:e(c),text:!(!c.text&&!c.html),icons:{primary:c.icon||
c.iconUrl&&"aloha-ui-inline-icon-container"||null,secondary:b&&"aloha-jqueryui-icon ui-icon-triangle-1-s"||null}});c.iconUrl&&g.button("widget").children(".ui-button-icon-primary").append(a(c.iconUrl));return g},makeButtonElement:function(a){return m("<button>",a).attr("type","button")},makeButtonLabel:e,makeButtonLabelWithIcon:function(g){var c=e(g);g.iconUrl&&(c=a(g.iconUrl)+c);return c},makeButtonIconFromUrl:a}});define("ui/vendor/jquery-ui-autocomplete-html",["jquery","jqueryui"],function(m){(function(e){function a(a,
c){var g=RegExp(e.ui.autocomplete.escapeRegex(c),"i");return e.grep(a,function(a){return g.test(e("<div>").html(a.label||a.value||a).text())})}var g=e.ui.autocomplete.prototype,c=g._initSource;e.extend(g,{_initSource:function(){this.options.html&&e.isArray(this.options.source)?this.source=function(b,c){c(a(this.options.source,b.term))}:c.call(this)},_renderItem:function(a,c){return e("<li></li>").data("item.autocomplete",c).append(e("<a></a>")[this.options.html?"html":"text"](c.label)).appendTo(a)}})})(m)});
define("ui/port-helper-attribute-field","jquery ui/ui ui/component ui/scopes ui/context ui/utils aloha/repositorymanager aloha/selection aloha/console ui/vendor/jquery-ui-autocomplete-html".split(" "),function(m,e,a,g,c,b,j,l){return function(f){function k(a,b){b.item&&t(b.item.obj);d()}function d(){g();if(D&&ca!==m(D).attr(Z)){I||j.markObject(D);p()===""&&r()}}function g(){if(!B){var a=m(D),b=a.attr("data-original-background-color");b?a.css("background-color",b):a.css("background-color","");a.removeAttr("data-original-background-color")}}
function o(a,b){return a.replace(/\{([^}]+)\}/g,function(a,c){return c in b?b[c]:""})}function r(){if(null!=A){E.css("color","#AAA");E.val(A)}}function p(){return E.val()}function u(a){E.val(a);E.css("color","black")}function t(a){if(I=a){var b=a[x];u(b);N=b;y(Z,a[z]);j.markObject(D,a)}else N=null}function y(a,b,c,d){if(D){var f=true;typeof d!="undefined"&&(d.match(RegExp(c))||(f=false));f?m(D).attr(a,b):m(D).removeAttr(a)}}var z=f.valueField||"id",x=f.displayField||"name",v=f.objectTypeFilter||["all"],
A=f.placeholder,B=!!f.noTargetHighlight,E=f.element?m(f.element):m('<input id="aloha-attribute-field-'+f.name+'">'),F,J,I,N,D,Z,ca;f.cls&&E.addClass(f.cls);f.width&&E.width(f.width);F=e.adopt(f.name,a,{scope:f.scope,init:function(){if(f.element)this.element=E;else if(f.label){this.element=b.wrapWithLabel(f.label,E);f.labelClass&&this.element.addClass(f.labelClass)}else this.element=m("<span>").append(E);E.autocomplete({html:true,appendTo:c.selector,source:function(a,b){j.query({queryString:a.term,
objectTypeFilter:v},function(a){b(m.map(a.items,function(a){return{label:o(J,a),value:a.name,obj:a}}))})},select:k})}});E.bind("focus",function(a){if(m(a.target).is(":visible")){if(!B){g();(a=m(D))&&(a.context&&a.context.style&&a.context.style["background-color"])&&a.attr("data-original-background-color",a.context.style["background-color"]);a.css("background-color","#80B5F2")}p()===A&&u("")}}).bind("blur",function(){d()}).bind("keydown",function(a){(a.keyCode==13||a.keyCode==27)&&a.preventDefault()}).bind("keyup",
function(a){if(I&&N!==p())N=I=null;I||y(Z,p());if(a.keyCode==13||a.keyCode==27){l.getRangeObject().select();d()}});r();var ba={getInputElem:function(){return E[0]},hasInputElem:function(){return true},getInputId:function(){return E.attr("id")},hide:function(){E.hide()},show:function(){E.show()},foreground:function(){F.foreground()},focus:function(){F.focus();E.focus()},getTargetObject:function(){return D},setTargetObject:function(a,b){D=a;Z=b;t(null);if(a&&b){ca=m(a).attr(b);u(m(D).attr(Z));j.getObject(a,
function(a){a&&a.length>0&&t(a[0])})}else u("")},setAttribute:y,getItem:function(){return I},setItem:t,setValue:u,getValue:p,addListener:function(a,b){E.bind(a,m.proxy(b,ba))},setObjectTypeFilter:function(a){v=a},setTemplate:function(a){J=a},setPlaceholder:r};return ba}});define("ui/button",["jquery","ui/component","ui/utils","jqueryui"],function(m,e,a){return e.extend({init:function(){this._super();this.createButtonElement();a.makeButton(this.buttonElement,this).button("widget").tooltip({tooltipClass:"aloha aloha-ui-tooltip",
position:{my:"left top",at:"right bottom"}}).click(m.proxy(function(){this.buttonElement.tooltip("close",null,!0);this._onClick()},this))},_onClick:function(){this.click()},click:function(){},createButtonElement:function(){var g=a.makeButtonElement();this["class"]&&g.addClass(this["class"]);return this.element=this.buttonElement=g},disable:function(){this.element.button("option","disabled",!1)},enable:function(a){this.element.button("option","disabled",!1===a)}})});define("ui/toggleButton",["jquery",
"ui/button","jqueryui"],function(m,e){return e.extend({_checked:!1,setState:function(a){this._checked!==a&&((this._checked=a)?this.element.addClass("aloha-button-active"):this.element.removeClass("aloha-button-active"))},getState:function(){return this._checked},_onClick:function(){this.setState(!this._checked);this.click()}})});define("link/nls/i18n",{root:{"button.addlink.tooltip":"Insert Link","button.removelink.tooltip":"Remove Link","newlink.defaulttext":"New Link","floatingmenu.tab.link":"Link",
"link.target.self":"Self","link.target.blank":"Blank","link.target.parent":"Parent","link.target.top":"Top","link.target.framename":"Framename","link.target.legend":"Target","link.title.legend":"Title",insertLink:"ctrl+k"},ca:!0,de:!0,mk:!0,"pt-br":!0,ru:!0,uk:!0,"zh-hans":!0});define("aloha/nls/i18n",{root:{"plugin.abbr.floatingmenu.tab.abbr":"Abbreviation","floatingmenu.tab.format":"Format","floatingmenu.tab.insert":"Insert",yes:"Yes",no:"No",cancel:"Cancel","repository.no_item_found":"No item found.",
"repository.loading":"Loading","repository.no_items_found_yet":"No items found yet..."},ca:!0,de:!0,mk:!0,"pt-br":!0,ru:!0,uk:!0,"zh-hans":!0});define("link/link-plugin","aloha aloha/plugin aloha/ephemera jquery ui/port-helper-attribute-field ui/ui ui/scopes ui/surface ui/button ui/toggleButton i18n!link/nls/i18n i18n!aloha/nls/i18n aloha/console".split(" "),function(m,e,a,g,c,b,j,l,f,k,d){function q(a,b){var c,d=false;if(!a.ignoreNextSelectionChangedEvent&&m.Selection.isSelectionEditable()&&m.activeEditable!=
null)if(c=a.findLinkMarkup(b)){a.toggleLinkScope(true);a.hrefField.setTargetObject(c,"href");if(g("#"+a.hrefField.getInputId()).length==0){a.hrefUpdateInt!==null&&clearInterval(a.hrefUpdateInt);a.hrefUpdateInt=setInterval(function(){if(g("#"+a.hrefField.getInputId()).length>0){a.hrefField.setTargetObject(c,"href");clearInterval(a.hrefUpdateInt)}},200)}m.trigger("aloha-link-selected");d=true}else{a.toggleLinkScope(false);a.hrefField.setTargetObject(null);m.trigger("aloha-link-unselected")}else a.toggleLinkScope(false);
a.ignoreNextSelectionChangedEvent=false;return d}var o=window.GENTICS,r="",p;a.classes("aloha-link-pointer","aloha-link-text");return e.create("link",{config:["a"],targetregex:"",target:"",cssclassregex:"",cssclass:"",objectTypeFilter:[],onHrefChange:null,ignoreNextSelectionChangedEvent:false,hrefUpdateInt:null,hotKey:{insertLink:d.t("insertLink","ctrl+k")},hrefValue:"http://",init:function(){var a=this;if(typeof this.settings.targetregex!="undefined")this.targetregex=this.settings.targetregex;if(typeof this.settings.target!=
"undefined")this.target=this.settings.target;if(typeof this.settings.cssclassregex!="undefined")this.cssclassregex=this.settings.cssclassregex;if(typeof this.settings.cssclass!="undefined")this.cssclass=this.settings.cssclass;if(typeof this.settings.objectTypeFilter!="undefined")this.objectTypeFilter=this.settings.objectTypeFilter;if(typeof this.settings.onHrefChange!="undefined")this.onHrefChange=this.settings.onHrefChange;typeof this.settings.hotKey!="undefined"&&g.extend(true,this.hotKey,this.settings.hotKey);
if(typeof this.settings.hrefValue!="undefined")this.hrefValue=this.settings.hrefValue;this.createButtons();this.subscribeEvents();this.bindInteractions();m.bind("aloha-plugins-loaded",function(){a.initSidebar(m.Sidebar.right)})},nsSel:function(){var a=[];g.each(arguments,function(){a.push("."+(this==""?"aloha-link":"aloha-link-"+this))});return g.trim(a.join(" "))},nsClass:function(){var a=[];g.each(arguments,function(){a.push(this==""?"aloha-link":"aloha-link-"+this)});return g.trim(a.join(" "))},
initSidebar:function(a){var b=this;b.sidebar=a;a.addPanel({id:b.nsClass("sidebar-panel-target"),title:d.t("floatingmenu.tab.link"),content:"",expanded:true,activeOn:"a, link",onInit:function(){var a=this;this.setContent('<div class="'+b.nsClass("target-container")+'"><fieldset><legend>'+d.t("link.target.legend")+'</legend><ul><li><input type="radio" name="targetGroup" class="'+b.nsClass("radioTarget")+'" value="_self" /><span>'+d.t("link.target.self")+'</span></li><li><input type="radio" name="targetGroup" class="'+
b.nsClass("radioTarget")+'" value="_blank" /><span>'+d.t("link.target.blank")+'</span></li><li><input type="radio" name="targetGroup" class="'+b.nsClass("radioTarget")+'" value="_parent" /><span>'+d.t("link.target.parent")+'</span></li><li><input type="radio" name="targetGroup" class="'+b.nsClass("radioTarget")+'" value="_top" /><span>'+d.t("link.target.top")+'</span></li><li><input type="radio" name="targetGroup" class="'+b.nsClass("radioTarget")+'" value="framename" /><span>'+d.t("link.target.framename")+
'</span></li><li><input type="text" class="'+b.nsClass("framename")+'" /></li></ul></fieldset></div><div class="'+b.nsClass("title-container")+'" ><fieldset><legend>'+d.t("link.title.legend")+'</legend><input type="text" class="'+b.nsClass("linkTitle")+'" /></fieldset></div>');g(b.nsSel("framename")).live("keyup",function(){g(a.effective).attr("target",g(this).val().replace('"',"&quot;").replace("'","&#39;"))});g(b.nsSel("radioTarget")).live("change",function(){if(g(this).val()=="framename")g(b.nsSel("framename")).slideDown();
else{g(b.nsSel("framename")).slideUp().val("");g(a.effective).attr("target",g(this).val())}});g(b.nsSel("linkTitle")).live("keyup",function(){g(a.effective).attr("title",g(this).val().replace('"',"&quot;").replace("'","&#39;"))})},onActivate:function(a){var c=this;c.effective=a;if(g(c.effective).attr("target")!=null){var d=true;g(b.nsSel("framename")).hide().val("");g(b.nsSel("radioTarget")).each(function(){g(this).removeAttr("checked");if(g(this).val()===g(c.effective).attr("target")){d=false;g(this).attr("checked",
"checked")}});if(d){g(b.nsSel('radioTarget[value="framename"]')).attr("checked","checked");g(b.nsSel("framename")).val(g(c.effective).attr("target")).show()}}else{g(b.nsSel("radioTarget")).first().attr("checked","checked");g(c.effective).attr("target",g(b.nsSel("radioTarget")).first().val())}c=this;c.effective=a;g(b.nsSel("linkTitle")).val(g(c.effective).attr("title"))}});a.show()},subscribeEvents:function(){var a=this,b={};m.bind("aloha-editable-created",function(c,d){var f=a.getEditableConfig(d.obj),
f=g.inArray("a",f)!==-1;if(b[d.getId()]=f){d.obj.bind("keydown",a.hotKey.insertLink,function(){if(a.findLinkMarkup()){a.hrefField.foreground();a.hrefField.focus()}else a.insertLink(true);return false});d.obj.find("a").each(function(){a.addLinkEventHandlers(this)})}});m.bind("aloha-editable-activated",function(){if(b[m.activeEditable.getId()]){a._formatLinkButton.show();a._insertLinkButton.show()}else{a._formatLinkButton.hide();a._insertLinkButton.hide()}});var c=false;m.bind("aloha-selection-changed",
function(d,f){var j=false;if(m.activeEditable&&b[m.activeEditable.getId()])(j=q(a,f))&&c!==j&&a.hrefField.foreground();c=j});var d=this;m.bind("aloha-editable-deactivated",function(){if(c){setTimeout(function(){c||d.toggleLinkScope(false)},100);c=false}})},toggleLinkScope:function(a){if(!(this._isScopeActive===a&&m.activeEditable&&this._isScopeActive_editableId===m.activeEditable.getId())){this._isScopeActive=a;this._isScopeActive_editableId=m.activeEditable&&m.activeEditable.getId();if(a){this.hrefField.show();
this._insertLinkButton.hide();m.activeEditable&&m.activeEditable.obj[0].nodeName==="A"?this._removeLinkButton.hide():this._removeLinkButton.show();this._formatLinkButton.setState(true);j.enterScope(this.name,"link")}else{this.hrefField.hide();this._insertLinkButton.show();this._removeLinkButton.hide();this._formatLinkButton.setState(false);j.leaveScope(this.name,"link",true)}}},addLinkEventHandlers:function(a){var b=this;g(a).mouseenter(function(){m.Log.debug(b,"mouse over link.");b.mouseOverLink=
a;b.updateMousePointer()});g(a).mouseleave(function(){m.Log.debug(b,"mouse left link.");b.mouseOverLink=null;b.updateMousePointer()});g(a).click(function(a){if(a.metaKey){m.activeEditable.blur();window.setTimeout(function(){location.href=a.target},0);a.stopPropagation();return false}})},createButtons:function(){var a=this;this._formatLinkButton=b.adopt("formatLink",k,{tooltip:d.t("button.addlink.tooltip"),icon:"aloha-icon aloha-icon-link",scope:"Aloha.continuoustext",click:function(){a.formatLink()}});
this._insertLinkButton=b.adopt("insertLink",f,{tooltip:d.t("button.addlink.tooltip"),icon:"aloha-icon aloha-icon-link",scope:"Aloha.continuoustext",click:function(){a.insertLink(false)}});this.hrefField=c({name:"editLink",width:320,valueField:"url",cls:"aloha-link-href-field",scope:"Aloha.continuoustext"});this.hrefField.setTemplate("<span><b>{name}</b><br/>{url}</span>");this.hrefField.setObjectTypeFilter(this.objectTypeFilter);this._removeLinkButton=b.adopt("removeLink",f,{tooltip:d.t("button.removelink.tooltip"),
icon:"aloha-icon aloha-icon-unlink",scope:"Aloha.continuoustext",click:function(){a.removeLink()}})},bindInteractions:function(){var a=this;this.hrefField.addListener("keyup",function(b){if(b.keyCode==27){var c=a.hrefField.getValue();if(!(c[0]=="/"||c[0]=="#"||c.match(/^.*\.([a-z]){2,4}$/i)||c.match(/^([a-z]){3,10}:\/\/.+/i)||c.match(/^(mailto|tel):.+/i))){c=a.hrefField.getValue();a.hrefField.setValue(c);(c==a.hrefValue||c=="")&&a.removeLink(false)}}a.hrefChange();if(b.keyCode==13){b=m.Selection.getRangeObject();
a.ignoreNextSelectionChangedEvent=true;b.startContainer=b.endContainer;b.startOffset=b.endOffset;b.select();a.ignoreNextSelectionChangedEvent=true;c=g(a.hrefField.getInputElem()).attr("value");(c==a.hrefValue||c=="")&&a.removeLink(false);window.setTimeout(function(){j.setScope("Aloha.continuoustext")},100)}else{p=g(a.hrefField.getInputElem()).attr("value");r!=p&&(r=p)}});g(document).keydown(function(b){m.Log.debug(a,"Meta key down.");a.metaKey=b.metaKey;a.updateMousePointer()}).keyup(function(b){m.Log.debug(a,
"Meta key up.");a.metaKey=b.metaKey;a.updateMousePointer()})},updateMousePointer:function(){if(this.metaKey&&this.mouseOverLink){m.Log.debug(this,"set pointer");g(this.mouseOverLink).removeClass("aloha-link-text");g(this.mouseOverLink).addClass("aloha-link-pointer")}else{g(this.mouseOverLink).removeClass("aloha-link-pointer");g(this.mouseOverLink).addClass("aloha-link-text")}},findLinkMarkup:function(a){typeof a=="undefined"&&(a=m.Selection.getRangeObject());if(m.activeEditable){var b=m.activeEditable.obj;
b[0]&&b[0].nodeName==="A"&&(b=b.parent());return a.findMarkup(function(){return this.nodeName=="A"},b)}return null},formatLink:function(){m.activeEditable&&(this.findLinkMarkup(m.Selection.getRangeObject())?this.removeLink():this.insertLink())},insertLink:function(a){var b=this,c=m.Selection.getRangeObject(),f;if(c.startContainer&&c.endContainer&&!this.findLinkMarkup(c)){this.hrefField.foreground();c.isCollapsed()&&a!==false&&o.Utils.Dom.extendToWord(c);if(c.isCollapsed()){a=d.t("newlink.defaulttext");
f=g('<a href="'+b.hrefValue+'" class="aloha-new-link">'+a+"</a>");o.Utils.Dom.insertIntoDOM(f,c,g(m.activeEditable.obj));c.startContainer=c.endContainer=f.contents().get(0);c.startOffset=0;c.endOffset=a.length}else{f=g('<a href="'+b.hrefValue+'" class="aloha-new-link"></a>');o.Utils.Dom.addMarkup(c,f,false)}m.activeEditable.obj.find("a.aloha-new-link").each(function(){b.addLinkEventHandlers(this);g(this).removeClass("aloha-new-link")});c.select();this.hrefField.focus();this.hrefField.hasInputElem()&&
g(this.hrefField.getInputElem()).attr("value",b.hrefValue).select();this.hrefChange()}},removeLink:function(a){var b=m.Selection.getRangeObject(),c=this.findLinkMarkup();this.hrefField.setItem(null);if(c){o.Utils.Dom.removeFromDOM(c,b,true);b.startContainer=b.endContainer;b.startOffset=b.endOffset;b.select();(typeof a=="undefined"||a===true)&&j.setScope("Aloha.continuoustext")}},hrefChange:function(){this.target!=""&&this.hrefField.setAttribute("target",this.target,this.targetregex,this.hrefField.getValue());
this.hrefField.setAttribute("class",this.cssclass,this.cssclassregex,this.hrefField.getValue());m.trigger("aloha-link-href-change",{obj:this.hrefField.getTargetObject(),href:this.hrefField.getValue(),item:this.hrefField.getItem()});typeof this.onHrefChange=="function"&&this.onHrefChange.call(this,this.hrefField.getTargetObject(),this.hrefField.getValue(),this.hrefField.getItem())}})});define("ui/dialog",["jquery","ui/component","i18n!ui/nls/i18n"],function(m,e,a){function g(a){var b={};a.text&&(b.text=
a.text);a.html&&(b.html=a.html);return m("<div>",b)}function c(a){for(var b in a)a.hasOwnProperty(b)&&(a[b]=function(a){return function(){a.apply(this);m(this).dialog("destroy").remove()}}(a[b]));return a}function b(a,b){var c="aloha aloha-dialog";a.cls&&(c+=" "+a.cls);return{resizable:!1,modal:!0,title:a.title||b,dialogClass:c,zIndex:10200}}return{confirm:function(a){var e=a.buttons||{};e.Yes=e.Yes||a.yes||m.noop;e.No=e.No||a.no||m.noop;if(a.answer){var f=e.Yes,k=e.No;e.Yes=function(){f();a.answer(!0)};
e.No=function(){k();a.answer(!1)}}var d=g(a).dialog(m.extend(b(a,"Confirm"),{buttons:c(e)}));return function(){d.dialog("destroy").remove()}},alert:function(j){var e={};e[a.t("button.dismiss.label")]=m.noop;var f=g(j).dialog(m.extend(b(j,"Alert"),{buttons:c(e)}));return function(){f.dialog("destroy").remove()}},progress:function(a){var c=m("<div>").progressbar({value:null!=a.value?a.value:100}),f=g(a).dialog(m.extend(b(a,"Progress"),{open:function(){m(this).append(c)}}));return function(a){null!=
a?c.progressbar({value:a}):f.dialog("destroy").remove()}}}});define("ui/multiSplit",["jquery","ui/component","ui/button","ui/utils"],function(m,e,a,g){return e.extend({_activeButton:null,_isOpen:!1,init:function(){this._super();var a=this,b=this.element=m("<div>",{"class":"aloha-multisplit"});this.contentElement=m("<div>",{"class":"aloha-multisplit-content"}).appendTo(b);this.toggleButton=g.makeButtonElement({"class":"aloha-multisplit-toggle",click:function(){a.toggle()}}).button().appendTo(b);this.buttons=
[];var j=this.getButtons();0===j.length&&b.hide();for(b=0;b<j.length;b++)this.addButton(j[b]);m("body").click(function(b){a._isOpen&&(!a.element.is(b.target)&&0===a.element.find(b.target).length)&&a.close()})},addButton:function(c){var b=this,j=new (a.extend({tooltip:c.tooltip,icon:c.wide?c.icon:"aloha-large-icon "+c.icon,iconOnly:c.wide?!1:!0,init:function(){this._super();c.init&&c.init.call(this)},click:function(){c.click.apply(b,arguments);b.close()}}));c.wide||j.element.addClass("aloha-large-button");
b.buttons[c.name]={settings:c,component:j,element:j.element,visible:!0};var g=this.contentElement.children(".aloha-ui-multisplit-fullwidth");!c.wide&&g.length?g.before(j.element[0]):this.contentElement.append(j.element[0])},setActiveButton:function(a){a||(a=null);null!==this._activeButton&&this.buttons[this._activeButton].element.removeClass("aloha-multisplit-active");this._activeButton=a;null!==a&&this.buttons[a].element.addClass("aloha-multisplit-active")},toggle:function(){this.element.toggleClass("aloha-multisplit-open");
this._isOpen=!this._isOpen},open:function(){this.element.addClass("aloha-multisplit-open");this._isOpen=!0},close:function(){this.element.removeClass("aloha-multisplit-open");this._isOpen=!1},show:function(a){a||(a=null);null!==a&&void 0!==this.buttons[a]&&(this.buttons[a].element.show(),this.buttons[a].visible=!0,this.element.show())},hide:function(a){var b,j=!1;a||(a=null);if(null!==a&&void 0!==this.buttons[a]){this.buttons[a].element.hide();this.buttons[a].visible=!1;for(b in this.buttons)if(this.buttons.hasOwnProperty(b)&&
this.buttons[b].visible){this.element.show();j=!0;break}j||this.element.hide()}}})});define("ui/port-helper-multi-split",["aloha/core","jquery","ui/ui","ui/multiSplit"],function(m,e,a,g){return function(c){var b;b=a.adopt(c.name,g,{scope:c.scope,getButtons:function(){var a=[];e.each(c.items,function(b,c){a.push({tooltip:c.tooltip,text:c.text,name:c.name,icon:c.iconClass,click:c.click,init:function(){c.cls&&this.element.addClass(c.cls);c.init&&c.init.call(this)},wide:c.wide})});return a}});return{pushItem:function(a){b.addButton(a)},
showItem:function(a){b.show(a)},hideItem:function(a){b.hide(a)},setActiveItem:function(a){b.setActiveButton(a)}}}});define("table/nls/i18n",{root:{"floatingmenu.tab.table":"Table","floatingmenu.tab.tablelayout":"Table Layout","deleterows.confirm":"Do you really want to delete the selected rows?","deletecolumns.confirm":"Do you really want to delete the selected columns?","deletetable.confirm":"Do you really want to delete the table?",Table:"Table","button.createtable.tooltip":"Insert Table","button.addcolleft.tooltip":"Add Column left",
"button.addcolright.tooltip":"Add Column right","button.delcols.tooltip":"Delete Columns","button.addrowbefore.tooltip":"Add Row before","button.addrowafter.tooltip":"Add Row after","button.delrows.tooltip":"Delete Rows","button.caption.tooltip":"Table caption","empty.caption":"Table caption","button.removeFormat.tooltip":"Remove formatting","button.removeFormat.text":"Remove formatting","button.rowheader.tooltip":"Format row as table header","button.columnheader.tooltip":"Format column as table header",
"button.mergecells.tooltip":"Merge Cells","button.splitcells.tooltip":"Split Cells","table.label.target":"Summary","table.sidebar.title":"Table","table.mergeCells.notRectangular":"Only a rectangular selection can be merged","table.addColumns.nonConsecutive":"Please select a single column or a consecutive range of columns","table.createTable.nestedTablesNoSupported":"Sorry, nested tables are not supported"},ca:!0,de:!0,mk:!0,"pt-br":!0,ru:!0,uk:!0,"zh-hans":!0});define("table/table-create-layer",["jquery"],
function(m){CreateLayer=function(e){this.TablePlugin=e};CreateLayer.prototype.parameters={elemId:"aloha-table-createLayer",className:"aloha-table-createdialog",numX:10,numY:10,layer:void 0,target:void 0};CreateLayer.prototype.config={};CreateLayer.prototype.visible=!1;CreateLayer.prototype.show=function(){var e=this.get("layer");null==e?this.create():(this.setPosition(e),e.find("td").removeClass("hover"),e.show());this.visible=!0};CreateLayer.prototype.create=function(){var e=this,a=m("<div></div>");
a.id=this.get("elemId");a.addClass(this.get("className"));var g=m("<table></table>");g.css("width",15*(this.get("numX")+6));for(var c,b,j=0;j<this.get("numY");j++){c=m("<tr></tr>");for(var l=0;l<this.get("numX");l++)b=m("<td> </td>"),0==j&&0==l&&b.addClass("hover"),b.bind("mouseover",{rowId:j,colId:l},function(a){e.handleMouseOver(a,g)}),b.bind("click",{rowId:j,colId:l},function(a){e.TablePlugin.createTable(a.data.colId+1,a.data.rowId+1);e.hide()}),c.append(b);g.append(c)}a.append(g);this.set("layer",
a);this.setPosition();a.bind("click",function(a){a.stopPropagation()}).mousedown(function(a){a.stopPropagation()});m("body").append(a).bind("click",function(a){e.visible&&!(a.target===e.get("target")[0]||m.contains(e.get("target")[0],a.target))&&e.hide()})};CreateLayer.prototype.handleMouseOver=function(e,a){for(var g=e.data.rowId,c=e.data.colId,b=a.find("tr"),j=0;j<=b.length;j++)for(var l=m(b[j]).find("td"),f=0;f<=l.length;f++)j<=g&&f<=c?m(l[f]).addClass("hover"):m(l[f]).removeClass("hover")};CreateLayer.prototype.setPosition=
function(){var e=m(this.get("target")),a=e.offset();this.get("layer").css("left",a.left+"px");this.get("layer").css("top",a.top+e.height()+"px")};CreateLayer.prototype.hide=function(){this.get("layer").hide();this.visible=!1};CreateLayer.prototype.get=function(e){if(this.config[e])return this.config[e];if(this.parameters[e])return this.parameters[e]};CreateLayer.prototype.set=function(e,a){this.config[e]?this.config[e]=a:this.parameters[e]=a};return CreateLayer});define("table/table-plugin-utils",
["jquery"],function(m){var e={prepareContent:function(a){a.find("table").removeAttr("cellpadding").removeAttr("cellspacing").removeAttr("border").removeAttr("border-top").removeAttr("border-bottom").removeAttr("border-left").removeAttr("border-right");a.find("td").each(function(){var a;(a=m.trim(this.innerHTML))?(a=m("<div>"+a+"</div>")[0],a=a.firstChild===a.lastChild&&"p"===a.firstChild.nodeName.toLowerCase()?(a=a.firstChild.children)&&1===a.length&&"br"===a[0].nodeName.toLowerCase():!1):a=!1;a&&
(this.innerHTML="&nbsp;");a=m(">p",this);1===a.length&&a.contents().unwrap()});a.find("td,tr").removeAttr("width").removeAttr("height").removeAttr("valign");a.find("colgroup").remove()},cellIndexToGridColumn:function(a,g,c){var b=null;e.walkCells(a,function(a,e,f){if(a===g&&e===c)return b=f,!1});return b},walkCells:function(a,g){for(var c=[],b=0;b<a.length;b++){for(var j=a[b].cells,l=0,f=0;f<j.length;f++){for(var k=j[f],d=e.colspan(k),k=e.rowspan(k);c[f+l];)c[f+l]-=1,l+=1;if(!1===g(b,f,f+l,d,k))return;
for(var q=0;q<d;q++){if(c[f+l+q])throw"an impossible case has occurred";c[f+l+q]=k-1}l+=d-1}for(;f+l<c.length;l++)c[f+l]&&(c[f+l]-=1)}},makeGrid:function(a){var g=[];e.walkCells(a,function(c,b,j,e,f){for(var b=a[c].cells[b],k=0;k<f;k++){g[c+k]=g[c+k]||[];for(var d=0;d<e;d++)g[c+k][j+d]={cell:b,colspan:e,rowspan:f,spannedX:d,spannedY:k}}});return g},containsDomCell:function(a){return 0===a.spannedX&&0===a.spannedY},leftDomCell:function(a,g,c){do{var b=a[g][c];if(0===b.spannedY)return b.cell;c-=b.spannedX+
1}while(0<=c);return null},splitCell:function(a,g){var c=m(a),b=e.colspan(a),j=e.rowspan(a);if(!(1===b&&1===j)){for(var l=c.parent(),f=l.parent().children(),l=l.index(),k=c.index(),d=e.makeGrid(f),k=e.cellIndexToGridColumn(f,l,k),q=0;q<j;q++)for(var o=0===q?1:0;o<b;o++){var r=e.leftDomCell(d,l+q,k);null==r?f.eq(l+q).prepend(g()):m(r).after(g())}c.removeAttr("colSpan");c.removeAttr("rowSpan")}},rowspan:function(a){return parseInt(m(a).attr("rowspan"))||1},colspan:function(a){return parseInt(m(a).attr("colspan"))||
1},walkGrid:function(a,g){for(var c=0;c<a.length;c++)for(var b=0;b<a[c].length;b++)if(!1===g(a[c][b],b,c))return},walkGridInsideRect:function(a,g,c){e.walkGrid(a,function(a,j,e){if(e>=g.top&&e<g.bottom&&j>=g.left&&j<g.right)return c(a,j,e)})},leftTrimArray:function(a){for(var g=0;g<a.length;g++)if(null!=a[g])return a.slice(g,a.length);return[]},makeContour:function(a,g){var c=[],b=[],j=[],l=[];e.walkGrid(a,function(a,k,d){if(g(a,k,d)){if(null==c[d]||k<c[d])c[d]=k;if(null==b[d]||k>b[d])b[d]=k;if(null==
j[k]||d<j[k])j[k]=d;if(null==l[k]||d>l[k])l[k]=d}});c=e.leftTrimArray(c);b=e.leftTrimArray(b);j=e.leftTrimArray(j);l=e.leftTrimArray(l);return{left:c,right:b,top:j,bottom:l}},indexOfAnyBut:function(a,g){for(var c=0;c<a.length;c++)if(g!==a[c])return c;return-1},isConsecutive:function(a){for(var g=1;g<a.length;g++)if(1!==Math.abs(a[g]-a[g-1]))return!1;return!0}};return e});define("table/table-cell",["jquery","table/table-plugin-utils"],function(m,e){var a=function(a,c){null==a&&(a="<td>&nbsp;</td>");
a=m(a).get(0);this.obj=m(a);this.tableObj=c;c.cells.push(this)};a.prototype.tableObj=void 0;a.prototype.obj=void 0;a.prototype.wrapper=void 0;a.prototype.hasFocus=!1;a.prototype.activate=function(){var a=this,c=a.obj;c.wrapInner("<div/>");var b=c.children("div").eq(0);b.contentEditable(!0);b.addClass("aloha-table-cell-editable");b.bind("focus",function(b){b.currentTarget&&(b.currentTarget.indexOf=function(){return-1});a._editableFocus(b)});b.bind("mousedown",function(b){b.currentTarget&&(b.currentTarget.indexOf=
function(){return-1});a.tableObj.selection.baseCellPosition=[a._virtualY(),a._virtualX()];if(b.shiftKey){var b=a.tableObj.selection.lastBaseCellPosition[1],c=a.tableObj.selection.lastBaseCellPosition[0],f=a.tableObj.selection.baseCellPosition,k=f[1];k>b&&(k=b,b=f[1]);var d=f[0];d>c&&(d=c,c=f[0]);var q=d,o=b,r=c,p=k,u=a.tableObj,b=u.obj.children().children("tr"),b=e.makeGrid(b);u.selection.selectedCells=[];var t=u.get("classCellSelected");e.walkGrid(b,function(a,b,c){if(e.containsDomCell(a))if(c>=
q&&c<=r&&b>=p&&b<=o){m(a.cell).addClass(t);u.selection.selectedCells.push(a.cell)}else m(a.cell).removeClass(t)});u.selection.notifyCellsSelected()}else a.tableObj.selection.lastBaseCellPosition=a.tableObj.selection.baseCellPosition,a._editableMouseDown(b),a._startCellSelection()});b.bind("blur",function(b){a._editableBlur(b)});b.bind("keyup",function(b){a._editableKeyUp(b)});b.bind("keydown",function(b){a._editableKeyDown(b)});b.bind("mouseover",function(){a._selectCellRange()});b.contentEditableSelectionChange(function(a){Aloha.Selection.onChange(b,
a);return b});c.bind("mousedown",function(c){window.setTimeout(function(){a.wrapper.trigger("focus");a._selectAll(b)},1);c.shiftKey||(a.tableObj.selection.unselectCells(),a._startCellSelection());c.stopPropagation()});c.get(0)&&(c.get(0).onselectstart=function(){return!1});this.wrapper=c.children();this.wrapper.get(0)&&(this.wrapper.get(0).onselectstart=function(){window.event.cancelBubble=true},this.wrapper.get(0).ondragstart=function(){return false});return this};a.prototype.deactivate=function(){var a=
m(this.obj.children(".aloha-table-cell-editable"));a.length&&(a.parent().append(a.contents()),a.remove(),this.obj.unbind("click"),this.obj.unbind("mousedown"),""==m.trim(this.obj.attr("class"))&&this.obj.removeAttr("class"))};a.prototype.toString=function(){return"TableCell"};a.prototype._editableFocus=function(){this.hasFocus||(this.tableObj.focus(),this.obj.addClass("aloha-table-cell_active"),this.hasFocus=!0,this.tableObj.selection.selectionType="cell")};a.prototype._editableBlur=function(){this.hasFocus=
!1;this.obj.removeClass("aloha-table-cell_active")};a.prototype._virtualX=function(){var a=this.tableObj.obj.children().children("tr"),c=this.obj.parent().index(),b=this.obj.index();return e.cellIndexToGridColumn(a,c,b)};a.prototype._virtualY=function(){return this.obj.parent("tr").index()};a.prototype._startCellSelection=function(){if(!this.tableObj.selection.cellSelectionMode){this.tableObj.selection.unselectCells();this.tableObj.selection.cellSelectionMode=!0;var a=this;m("body").bind("mouseup.cellselection",
function(){a._endCellSelection()});this.tableObj.selection.baseCellPosition=[this._virtualY(),this._virtualX()]}};a.prototype._endCellSelection=function(){this.tableObj.selection.cellSelectionMode&&(this.tableObj.selection.cellSelectionMode=!1,this.tableObj.selection.baseCellPosition=null,this.tableObj.selection.lastSelectionRange=null,this.tableObj.selection.selectionType="cell",m("body").unbind("mouseup.cellselection"))};a.prototype._getSelectedRect=function(){var a=this._virtualX(),c=this._virtualY(),
b=this.tableObj.selection.baseCellPosition,j=b[1];j>a&&(j=a,a=b[1]);var e=b[0];e>c&&(e=c,c=b[0]);return{top:e,right:a,bottom:c,left:j}};a.prototype._selectCellRange=function(){if(this.tableObj.selection.cellSelectionMode){var a=this._getSelectedRect(),c=this.tableObj,b=c.obj.children().children("tr"),b=e.makeGrid(b);c.selection.selectedCells=[];var j=c.get("classCellSelected");e.walkGrid(b,function(b,f,k){e.containsDomCell(b)&&(k>=a.top&&k<=a.bottom&&f>=a.left&&f<=a.right?(m(b.cell).addClass(j),c.selection.selectedCells.push(b.cell)):
m(b.cell).removeClass(j))});c.selection.notifyCellsSelected()}};a.prototype._selectAll=function(a){a=a.jquery?a.get(0):a;if(m.browser.msie)document.getSelection?(c=document.getSelection(),b=document.createRange(),b.selectNodeContents(a),c.removeAllRanges(),c.addRange(b)):document.selection&&(b=document.body.createTextRange(),b.moveToElementText(a),b.select());else{var c=window.getSelection();if(c.setBaseAndExtent)c.setBaseAndExtent(a,0,a,Math.max(0,a.innerText.length-1));else{window.opera&&"<BR>"==
a.innerHTML.substring(a.innerHTML.length-4)&&(a.innerHTML+="&#160;");var b=document.createRange();b.selectNodeContents(a);c.removeAllRanges();c.addRange(b)}}};a.prototype._editableMouseDown=function(a){this.tableObj.selection.unselectCells();this.tableObj.hasFocus&&a.stopPropagation()};a.prototype._editableKeyUp=function(){};a.prototype._editableKeyDown=function(a){this._checkForEmptyEvent(a);this.obj[0]===this.tableObj.obj.find("tr:last td:last")[0]&&(9==a.keyCode&&!a.altKey&&!a.shiftKey&&!a.ctrlKey)&&
(this.tableObj.addRow(this.obj.parent().index()+1),this.tableObj.cells[this.tableObj.cells.length-1]._selectAll(this.wrapper.get(0)),a.stopPropagation())};a.prototype._checkForEmptyEvent=function(){var a=m(this.wrapper),c=a.text();!(0<a.children().length)&&""===c&&(this.wrapper.text(" "),this.wrapper.get(0).blur(),this.wrapper.get(0).focus())};a.getContainer=function(a){return m(a.firstChild).hasClass("aloha-table-cell-editable")?a.firstChild:a};return a});define("table/table-selection","aloha jquery table/table-plugin-utils table/table-cell ui/dialog i18n!table/nls/i18n".split(" "),
function(m,e,a,g,c,b){function j(a){return{top:a.top[0],right:a.right[0]+1,bottom:a.bottom[0]+1,left:a.left[0]}}function l(b,c,f){var g=true;if(-1!==a.indexOfAnyBut(c.top,c.top[0])||-1!==a.indexOfAnyBut(c.right,c.right[0])||-1!==a.indexOfAnyBut(c.bottom,c.bottom[0])||-1!==a.indexOfAnyBut(c.left,c.left[0]))g=false;else{c=j(c);a.walkGridInsideRect(b,c,function(a){if(!f(a))return g=false})}return g}var f=function(a){this.table=a};f.prototype.selectionType=void 0;f.prototype.selectedCells=[];f.prototype.selectedColumnIdxs=
[];f.prototype.selectedRowIdxs=[];f.prototype.cellSelectionMode=false;f.prototype.baseCellPosition=null;f.prototype.lastSelectionRange=null;f.prototype.selectColumns=function(b){this.unselectCells();var c=this.table.getRows();c.shift();for(var c=a.makeGrid(c),f=0;f<b.length;f++)if(-1===e.inArray(b[f],this.selectedColumnIdxs)){this.selectedColumnIdxs.push(b[f]);for(var j=0;j<c.length;j++){var g=c[j][b[f]];if(a.containsDomCell(g)){e(g.cell).addClass(this.table.get("classCellSelected"));this.selectedCells.push(g.cell)}}}this.selectionType=
"column"};f.prototype.selectRows=function(a){this.unselectCells();var b=this.table.getRows();a.sort(function(a,b){return a-b});for(var c=0;c<a.length;c++)if(b[a[c]]){for(var f=0;f<this.selectedRowIdxs.length;f++)if(a[c]==this.selectedRowIdxs[f])return;this.selectedRowIdxs.push(a[c]);for(f=1;f<b[a[c]].cells.length;f++){this.selectedCells.push(b[a[c]].cells[f]);e(b[a[c]].cells[f]).addClass(this.table.get("classCellSelected"))}}this.selectionType="row"};f.prototype.selectAll=function(){var a=e.map(this.table.getRows(),
function(a,b){return b});a.shift();this.selectRows(a)};f.prototype.notifyCellsSelected=function(){m.trigger("aloha-table-selection-changed")};f.prototype._notifyCellsUnselected=function(){m.trigger("aloha-table-selection-changed")};f.prototype.isHeader=function(){if(this.selectedCells.length==0)return false;for(var a=0;a<this.selectedCells.length;a++)if(!this.selectedCells[a]||this.selectedCells[a].nodeName.toLowerCase()!="th")return false;return true};f.prototype.unselectCells=function(){var a;if(!this.cellSelectionMode&&
this.selectedCells.length>0){a=this.table.getRows();for(var b=0;b<a.length;b++)for(var c=1;c<a[b].cells.length;c++)e(a[b].cells[c]).removeClass(this.table.get("classCellSelected"));this.selectedCells=[];this.selectedColumnIdxs=[];this.selectedRowIdxs=[];this.selectionType="cell";this._notifyCellsUnselected()}};f.prototype.selectionIndex=function(a){for(var b=0;b<this.selectedCells.length;b++)if(this.selectedCells[b]===a)return b;return-1};f.prototype.mergeCells=function(){var f=this.selectedCells;
if(0!==f.length){var d=function(a){return-1!=e.inArray(a.cell,f)},q=a.makeGrid(this.table.getRows()),o=a.makeContour(q,d);if(l(q,o,d)){var r=j(o),d=e(q[r.top][r.left].cell),p=e(g.getContainer(d.get(0)));a.walkGridInsideRect(q,r,function(a,b,c){if(!(b-a.spannedX===r.left&&c-a.spannedY===r.top)){a=a.cell;b=e(g.getContainer(a)).contents();for(c=0;c<b.length;c++)if("string"!==typeof b[c]||""!==e.trim(b[c])){p.append(" ");p.append(b);break}e(a).remove()}});d.attr({rowspan:r.bottom-r.top,colspan:r.right-
r.left});this.selectedCells=[d.get(0)];this.cellSelectionMode=false;this.lastSelectionRange=this.baseCellPosition=null;this.selectionType="cell";m.trigger("aloha-table-selection-changed")}else c.alert({title:b.t("Table"),text:b.t("table.mergeCells.notRectangular")})}};f.prototype.splitCells=function(){var b=this,c=this.selectedCells;if(c.length>0){e(c).each(function(){a.splitCell(this,function(){return b.table.newActiveCell().obj})});this.cellSelectionMode=false;this.lastSelectionRange=this.baseCellPosition=
null;this.selectionType="cell";m.trigger("aloha-table-selection-changed")}};f.prototype.cellsAreMergeable=function(){var b=this.selectedCells;if(b.length<2)return false;var c=function(a){return-1!=e.inArray(a.cell,b)},f=a.makeGrid(this.table.getRows()),j=a.makeContour(f,c);return l(f,j,c)?true:false};f.prototype.cellsAreSplitable=function(){var b=0;if(this.selectedCells.length>0){e(this.selectedCells).each(function(){var c=a.colspan(this),f=a.rowspan(this);(c>1||f>1)&&b++});return b>0?true:false}return false};
return f});define("table/table","aloha jquery ui/scopes ui/dialog i18n!table/nls/i18n table/table-cell table/table-selection table/table-plugin-utils".split(" "),function(m,e,a,g,c,b,j,l){function f(a,b){var c=-1,d=null;"before"===a?d=b.selectedCells[0]:"after"===a&&(d=b.selectedCells[b.selectedCells.length-1]);if(d&&d.nodeType==1)c=d.parentNode.rowIndex;return c}var k=window.GENTICS,d=function(a,b){this.obj=e(a);var c,d,f=this.getRows(),g=f.length,m,z=0,x=[],v;for(c=0;c<g;c++){d=e(f[c]);d=d.children("td, th");
m=d.length;m=l.cellIndexToGridColumn(f,c,m-1)+1;v=parseInt(d.last().attr("colspan"),10);if(v!=0&&!isNaN(v)){v==1&&d.last().removeAttr("colspan");m=m+(v-1)}x.push(m);m>z&&(z=m)}for(c=0;c<g;c++){d=z-x[c];d>0&&e(f[c]).append(Array(d+1).join("<td></td>"))}this.obj.attr("id")||this.obj.attr("id",k.Utils.guid());this.tablePlugin=b;this.selection=new j(this);this.refresh()};e.extend(d.prototype,{obj:void 0,tableWrapper:void 0,cells:void 0,numRows:void 0,numCols:void 0,isActive:false,hasFocus:false,parentEditable:void 0,
mousedown:false,clickedColumnId:-1,clickedRowId:-1,columnsToSelect:[],rowsToSelect:[],fmPluginId:void 0});d.prototype.refresh=function(){this.numCols=this.countVirtualCols();var a=this.getRows();this.numRows=a.length;this.cells=[];for(var b=0;b<a.length;b++)for(var c=e(a[b]).children(),d=0;d<c.length;d++)this.newCell(c[d])};d.prototype.countVirtualCols=function(){var a=this.obj.children().children("tr:first-child").children();return a.length-a.filter("."+this.get("classLeftUpperCorner")).length};
d.prototype.get=function(a){return this.tablePlugin.get(a)};d.prototype.set=function(a,b){this.tablePlugin.set(a,b)};d.prototype.activate=function(){if(!this.isActive){var a=this,b;this.obj.addClass(this.get("className"));this.obj.contentEditable(false);this.obj.attr("id")==""&&this.obj.attr("id",k.Utils.guid());this.selection.selectionType=void 0;b=this.obj.children("tbody");if(b.length===0)b=this.obj;b.bind("keydown",function(b){!b.ctrlKey&&!b.shiftKey&&a.selection.selectedCells.length>0&&a.selection.selectedCells[0].length>
0&&a.selection.selectedCells[0][0].firstChild.focus()});b.bind("mousedown",function(b){a.hasFocus||a.focus();b.stopPropagation();b.preventDefault();return false});this.obj.wrap(e('<div class="'+this.get("classTableWrapper")+'" data-block-skip-scope="true"></div>'));b=this.obj.parent();b.alohaBlock&&b.alohaBlock();b=this.obj.parents("."+this.get("classTableWrapper"));b.get(0).onresizestart=function(){return false};b.get(0).oncontrolselect=function(){return false};b.get(0).ondragstart=function(){return false};
b.get(0).onmovestart=function(){return false};this.tableWrapper=this.obj.parents("."+this.get("classTableWrapper")).get(0);e(this.cells).each(function(){this.activate()});this.attachSelectionColumn();this.attachSelectionRow();this.makeCaptionEditable();this.checkWai();this.isActive=true;m.trigger("aloha-table-activated")}};d.prototype.makeCaptionEditable=function(){var a=this.obj.find("caption").eq(0);a&&this.tablePlugin.makeCaptionEditable(a)};d.prototype.checkWai=function(){var a=this.wai;if(a){a.removeClass(this.get("waiGreen"));
a.removeClass(this.get("waiRed"));e.trim(this.obj[0].summary)!=""?a.addClass(this.get("waiGreen")):a.addClass(this.get("waiRed"))}};d.prototype.attachSelectionColumn=function(){var a=e("<td>"),b,c,d,f;a.html(" ");d=this.obj.context.rows;for(f=0;f<d.length;f++){c=e(d[f]);b=a.clone();b.addClass(this.get("classSelectionColumn"));b.css("width",this.get("selectionArea")+"px");c.prepend(b);this.attachRowSelectionEventsToCell(b)}};d.prototype.attachRowSelectionEventsToCell=function(a){var b=this;a.unbind("mousedown");
a.unbind("mouseover");a.get(0).onselectstart=function(){return false};a.bind("mousedown",function(a){return b.rowSelectionMouseDown(a)});a.bind("mouseover",function(a){if(b.mousedown)return b.rowSelectionMouseOver(a)})};d.prototype.rowSelectionMouseDown=function(a){this.focus();if(this.selection.selectedCells.length==0)this.rowsToSelect=[];this.clickedRowId=a.currentTarget.parentNode.rowIndex;if(a.metaKey){var b=e.inArray(this.clickedRowId,this.rowsToSelect);b>=0?this.rowsToSelect.splice(b,1):this.rowsToSelect.push(this.clickedRowId)}else if(a.shiftKey){this.rowsToSelect.sort(function(a,
b){return a-b});var c=this.rowsToSelect[0],b=this.clickedRowId;if(c>b){c=b;b=this.rowsToSelect[0]}for(this.rowsToSelect=[];c<=b;c++)this.rowsToSelect.push(c)}else this.rowsToSelect=[this.clickedRowId];this.selectRows();a.preventDefault();a.stopPropagation();this.tablePlugin.summary.focus();return false};d.prototype.rowSelectionMouseOver=function(a){var b=a.currentTarget.parentNode.rowIndex,c;if(this.mousedown&&this.clickedRowId>=0){e.inArray(b,this.rowsToSelect);c=b<this.clickedRowId?b:this.clickedRowId;
b=b<this.clickedRowId?this.clickedRowId:b;for(this.rowsToSelect=[];c<=b;c++)this.rowsToSelect.push(c);this.selectRows();a.preventDefault();a.stopPropagation();return false}};d.prototype.attachSelectionRow=function(){var a=this,b=e("<td>");b.html(" ");for(var c=0,d=0;d<this.obj.context.rows.length;d++){for(var f=0,k=0;k<this.obj.context.rows[d].cells.length;k++)var j=l.colspan(this.obj.context.rows[d].cells[k]),f=f+j;c<f&&(c=f)}f=e("<tr>");f.addClass(this.get("classSelectionRow"));f.css("height",this.get("selectionArea")+
"px");for(d=0;d<c;d++){k=b.clone();if(d>0)this.attachColumnSelectEventsToCell(k);else{k=e("<td>").clone();k.addClass(this.get("classLeftUpperCorner"));this.wai=e("<div/>").width(25).height(12).click(function(b){a.focus();a.selection.selectAll();a.tablePlugin.activeTable.selection.selectionType="cell";a.tablePlugin.updateFloatingMenuScope();a._removeCursorSelection();if(a.tablePlugin.settings.summaryinsidebar){a.tablePlugin.sidebar.open();a.tablePlugin.sidebarPanel.activate(a.obj);a.tablePlugin.sidebar.correctHeight()}try{a.tablePlugin.summary.focus();
b.stopPropagation();b.preventDefault()}catch(c){}return false});k.append(this.wai)}f.append(k)}e(document).bind("mouseup",function(b){a.columnSelectionMouseUp(b)});this.obj.find("tr:first").before(f)};d.prototype.attachColumnSelectEventsToCell=function(a){var b=this;a.unbind("mousedown");a.unbind("mouseover");a.get(0).onselectstart=function(){return false};a.bind("mousedown",function(a){b.columnSelectionMouseDown(a)});a.bind("mouseover",function(a){b.columnSelectionMouseOver(a)})};d.prototype.columnSelectionMouseDown=
function(a){this.focus();if(this.selection.selectedCells.length==0)this.columnsToSelect=[];this.clickedColumnId=e(a.currentTarget.parentNode).children().index(a.currentTarget);if(a.metaKey){var b=e.inArray(this.clickedColumnId,this.columnsToSelect);b>=0?this.columnsToSelect.splice(b,1):this.columnsToSelect.push(this.clickedColumnId)}else if(a.shiftKey){this.columnsToSelect.sort(function(a,b){return a-b});var c=this.columnsToSelect[0],b=this.clickedColumnId;if(c>b){c=b;b=this.columnsToSelect[0]}for(this.columnsToSelect=
[];c<=b;c++)this.columnsToSelect.push(c)}else this.columnsToSelect=[this.clickedColumnId];this.selectColumns();a.preventDefault();a.stopPropagation();return false};d.prototype.columnSelectionMouseOver=function(a){var b=a.currentTarget.cellIndex,a=[],c;if(this.mouseDownColIdx){c=b<this.mouseDownColIdx?b:this.mouseDownColIdx;for(b=b<this.mouseDownColIdx?this.mouseDownColIdx:b;c<=b;c++)a.push(c);this.selectColumns(a)}};d.prototype.columnSelectionMouseUp=function(){this.mouseDownColIdx=false};d.prototype.deleteRows=
function(){var a=[],b={},d=this;if(0!==this.selection.selectedCells.length){for(var f=0;f<this.selection.selectedCells.length;f++)b[this.selection.selectedCells[f].parentNode.rowIndex]=true;for(rowId in b)a.push(rowId);b=false;a.length==this.numRows&&(b=true);if(b){var k=this;g.confirm({title:c.t("Table"),text:c.t("deletetable.confirm"),yes:function(){k.deleteTable()}})}else{a.sort(function(a,b){return a-b});var j=a[0];j>this.numRows-a.length&&j--;var m=this.getRows();e.each(a,function(a,b){for(var c=
m[b],f=0;f<c.cells.length;f++)l.splitCell(c.cells[f],function(){return d.newActiveCell().obj})});var z=l.makeGrid(m);e.each(a,function(a,b){for(var c=z[b],d=0;d<c.length;){var f=c[d],k=l.rowspan(f.cell);1<k&&e(f.cell).attr("rowspan",k-1);d=d+f.colspan}e(m[b]).remove()});this.numRows=this.numRows-a.length;window.setTimeout(function(){e(m[1].cells[j+1]).focus()},5);this.selection.unselectCells()}}};d.prototype.deleteColumns=function(){var a=[],b=this.getRows(),d=this,f,k=l.makeGrid(b);if(this.selection.selectedColumnIdxs.length==
k[0].length-1)g.confirm({title:c.t("Table"),text:c.t("deletetable.confirm"),yes:function(){d.deleteTable()}});else{a.sort(function(a,b){return a-b});for(var j=this.selection.selectedColumnIdxs.sort(function(a,b){return b-a}),m=0;m<j.length;m++){for(var z=j[m],x=0;x<b.length;x++)if(f=k[x][z]){if(0===f.spannedX){if(1<f.colspan){var v=this.newActiveCell().obj;e(f.cell).after(v);v.attr("rowspan",f.rowspan);v.attr("colspan",f.colspan-1)}e(f.cell).remove()}else e(f.cell).attr("colspan",f.colspan-1);x=x+
(f.rowspan-1)}k=l.makeGrid(b)}this.numCols=this.numCols-a.length;window.setTimeout(function(){e(b[1].cells[1]).focus()},5);this.selection.unselectCells()}};d.prototype.deleteTable=function(){for(var a=-1,b=0;b<this.tablePlugin.TableRegistry.length;b++)if(this.tablePlugin.TableRegistry[b].obj.attr("id")==this.obj.attr("id")){a=b;break}if(a>=0){this.deactivate();this.selection.selectionType=void 0;this.tablePlugin.TableRegistry.splice(b,1);a=m.Selection.rangeObject;a.endContainer=this.obj.get(0).parentNode;
a.startContainer=a.endContainer;a.endOffset=k.Utils.Dom.getIndexInParent(this.obj.get(0));a.startOffset=a.endOffset;a.clearCaches();this.obj.remove();this.parentEditable.obj.focus();a.correctRange();a.select()}};d.prototype.addRowBeforeSelection=function(){var a=f("before",this.selection);-1!==a&&this.addRow(a)};d.prototype.addRowAfterSelection=function(){var a=f("after",this.selection);-1!==a&&this.addRow(a+1)};d.prototype.addRow=function(a){this.countVirtualCols();for(var b=this.obj.children().children("tr"),
c=0;c<1;c++){var d=e("<tr>"),f=e("<td>");f.addClass(this.get("classSelectionColumn"));this.attachRowSelectionEventsToCell(f);d.append(f);f=l.makeGrid(b);if(a>=f.length)for(var k=1;k<f[0].length;k++)d.append(this.newActiveCell().obj);else for(k=1;k<f[a].length;){var j=f[a][k];if(l.containsDomCell(j))for(var g=j.colspan;g--;)d.append(this.newActiveCell().obj);else e(j.cell).attr("rowspan",j.rowspan+1);k=k+j.colspan}a>=b.length?b.eq(b.length-1).after(d):b.eq(a).before(d)}this.numRows=this.numRows+1};
d.prototype.addColumnsRight=function(){this.addColumns("right")};d.prototype.addColumnsLeft=function(){this.addColumns("left")};d.prototype.addColumns=function(a){var b=e("<td>"),d=this.getRows(),f,k;f=this.selection.selectedColumnIdxs;if(0!==f.length){f.sort(function(a,b){return a-b});if(l.isConsecutive(f)){if("left"===a){k=f[0];for(var j=0;j<this.selection.selectedColumnIdxs.length;j++)this.selection.selectedColumnIdxs[j]=this.selection.selectedColumnIdxs[j]+1}else k=f[f.length-1];for(var m=l.makeGrid(d),
j=0;j<d.length;j++){f=b.clone();f.html(" ");if(j==0)this.attachColumnSelectEventsToCell(f);else{cellObj=this.newActiveCell(f.get(0));f=cellObj.obj}var z=l.leftDomCell(m,j,k);null==z?e(d[j]).prepend(f):"left"===a&&l.containsDomCell(m[j][k])?e(z).before(f):e(z).after(f);this.numCols++}}else g.alert({title:c.t("Table"),text:c.t("table.addColumns.nonConsecutive")})}};d.prototype.focus=function(){if(!this.hasFocus){this.parentEditable.isActive||this.parentEditable.obj.focus();this.tablePlugin.setFocusedTable(this)}};
d.prototype.focusOut=function(){if(this.hasFocus){this.tablePlugin.setFocusedTable(void 0);this.selection.selectionType=void 0}};d.prototype._removeCursorSelection=function(){var a=m.getSelection();if(a&&a._nativeSelection&&a._nativeSelection._ranges.length!=0){a=a.getRangeAt(0);if(null!=a.startContainer&&0===e(a.startContainer).closest("table").length&&0!==this.selection.selectedCells.length){a=b.getContainer(this.selection.selectedCells[0]);e(a).focus()}}};d.prototype.selectColumns=function(b){for(var b=
b?b:this.columnsToSelect,c=0;c<this.tablePlugin.columnMSItems.length;c++)this.tablePlugin.columnMSButton.showItem(this.tablePlugin.columnMSItems[c].name);a.setScope(this.tablePlugin.name+".column");this.tablePlugin._columnheaderButton.setState(this.selection.isHeader());c=this.getRows();this.tablePlugin.columnMSButton.setActiveItem();for(var d=0;d<this.tablePlugin.columnConfig.length;d++)if(e(c[0].cells[0]).hasClass(this.tablePlugin.columnConfig[d].cssClass)){this.tablePlugin.columnMSButton.setActiveItem(this.tablePlugin.columnConfig[d].name);
d=this.tablePlugin.columnConfig.length}this.obj.find("div.aloha-ui-table-cell-editable").blur();this.selection.selectColumns(b);this.selection.notifyCellsSelected();this._removeCursorSelection()};d.prototype.selectRows=function(){for(var b=0;b<this.tablePlugin.rowMSItems.length;b++)this.tablePlugin.rowMSButton.showItem(this.tablePlugin.rowMSItems[b].name);for(b=0;b<this.rowsToSelect.length;b++){var c=this.rowsToSelect[b],c=e(this.getRows()[c].cells).toArray();if(b==0)for(var d=0;d<c.length;d++){this.tablePlugin.rowMSButton.setActiveItem();
for(var f=0;f<this.tablePlugin.rowConfig.length;f++)if(e(c[d]).hasClass(this.tablePlugin.rowConfig[f].cssClass)){this.tablePlugin.rowMSButton.setActiveItem(this.tablePlugin.rowConfig[f].name);f=this.tablePlugin.rowConfig.length}}}a.setScope(this.tablePlugin.name+".row");this.selection.selectRows(this.rowsToSelect);this.tablePlugin._rowheaderButton.setState(this.selection.isHeader());this.obj.find("div.aloha-ui-table-cell-editable").blur();this.selection.notifyCellsSelected();this._removeCursorSelection()};
d.prototype.deactivate=function(){var a=this.obj.parent();a.mahaloBlock&&a.mahaloBlock();this.obj.removeClass(this.get("className"));e.trim(this.obj.attr("class"))==""&&this.obj.removeAttr("class");this.obj.removeAttr("contenteditable");this.obj.parents("."+this.get("classTableWrapper")).length&&this.obj.unwrap();this.obj.find("tr."+this.get("classSelectionRow")+":first").remove();var b=this;e.each(this.obj.context.rows,function(){e(this).children("td."+b.get("classSelectionColumn")).remove()});this.obj.find("td, th").removeClass(this.get("classCellSelected"));
this.obj.find("td, th").removeClass("aloha-table-cell_active");this.obj.unbind();this.obj.children("tbody").unbind();for(a=0;a<this.cells.length;a++)this.cells[a].deactivate();this.obj.find("caption div").each(function(){e(this).contents().unwrap()});this.isActive=false};d.prototype.toString=function(){return"Table"};d.prototype.newCell=function(a){return new b(a,this)};d.prototype.newActiveCell=function(a){a=new b(a,this);a.activate();return a};d.prototype.getRows=function(){var a=this.obj.get(0).rows;
return e.makeArray(a)};return d});define("table/table-plugin","aloha jquery aloha/plugin aloha/pluginmanager ui/ui ui/scopes ui/button ui/toggleButton ui/dialog ui/port-helper-attribute-field ui/port-helper-multi-split i18n!table/nls/i18n i18n!aloha/nls/i18n table/table-create-layer table/table table/table-plugin-utils".split(" "),function(m,e,a,g,c,b,j,l,f,k,d,q,o,r,p){function u(){var a=[],b=A;e.each(arguments,function(){a.push("."+(this==""?b:b+"-"+this))});return e.trim(a.join(" "))}function t(){var a=
[],b=A;e.each(arguments,function(){a.push(this==""?b:b+"-"+this)});return e.trim(a.join(" "))}function y(a,b){var c=a.endContainer,d=a.startContainer,f=c.nodeType==3?c.length:c.childNodes.length;if(d.nodeType==3&&d.parentNode.tagName=="P"&&d.parentNode.childNodes.length==1&&/^(\s|%A0)$/.test(escape(d.data))){d.data="";a.startOffset=0;if(c==d)a.endOffset=0}if(!x.Utils.Dom.allowsNesting(d.nodeType==3?d.parentNode:d,b)){a.startOffset==0&&e(d.nodeType==3?d.parentNode:d).addClass("aloha-table-cleanme");
a.endOffset==f&&e(c.nodeType==3?c.parentNode:c).addClass("aloha-table-cleanme")}}function z(){for(var a=e(".aloha-table-cleanme").removeClass("aloha-table-cleanme"),b=0;b<a.length;b++)e.trim(e(a[b]).html())==""&&!x.Utils.Dom.isEditingHost(a[b])&&e(a[b]).remove()}var x=window.GENTICS,v=new a("table");v.createLayer=void 0;v.config=["table"];v.TableRegistry=[];v.activeTable=void 0;v.parameters={className:"aloha-table",classSelectionRow:"aloha-table-selectcolumn",classSelectionColumn:"aloha-table-selectrow",
classLeftUpperCorner:"aloha-table-leftuppercorner",classTableWrapper:"aloha-table-wrapper",classCellSelected:"aloha-cell-selected",waiRed:"aloha-wai-red",waiGreen:"aloha-wai-green",selectionArea:10};v.checkConfig=function(a){if(typeof a=="object"&&a.length){for(var b=[],c=0;c<a.length;c++)a[c]&&b.push({name:a[c].name,text:a[c].text?a[c].text:a[c].name,tooltip:a[c].tooltip?a[c].tooltip:a[c].text,iconClass:a[c].iconClass?a[c].iconClass:"aloha-icon-"+a[c].name,cssClass:a[c].cssClass?a[c].cssClass:a[c].name});
a=b}else a=[];return a};v.init=function(){var a=this,b={};this.tableConfig=this.checkConfig(this.tableConfig||this.settings.tableConfig);this.columnConfig=this.checkConfig(this.columnConfig||this.settings.columnConfig);this.rowConfig=this.checkConfig(this.rowConfig||this.settings.rowConfig);this.cellConfig=this.checkConfig(this.cellConfig||this.settings.cellConfig);this.createLayer=new r(this);m.bind("aloha-editable-created",function(c,d){var f=a.getEditableConfig(d.obj);b[d.getId()]=-1!==e.inArray("table",
f);d.obj.bind("mousedown",function(){v.setFocusedTable(void 0)});d.obj.find("table").each(function(){if(a.isEditableTable(this)&&!v.isWithinTable(this)){var b=new p(this,v);b.parentEditable=d;v.TableRegistry.push(b)}v.checkForNestedTables(d.obj)})});this.initTableButtons();m.bind("aloha-table-selection-changed",function(){if(typeof v.activeTable!=="undefined"&&v.activeTable.selection){v.updateFloatingMenuScope();if(v.activeTable.selection.cellsAreSplitable()){a._splitcellsButton.enable(true);a._splitcellsRowButton.enable(true);
a._splitcellsColumnButton.enable(true)}else{a._splitcellsButton.enable(false);a._splitcellsRowButton.enable(false);a._splitcellsColumnButton.enable(false)}if(v.activeTable.selection.cellsAreMergeable()){a._mergecellsButton.enable(true);a._mergecellsRowButton.enable(true);a._mergecellsColumnButton.enable(true)}else{a._mergecellsButton.enable(false);a._mergecellsRowButton.enable(false);a._mergecellsColumnButton.enable(false)}}});m.bind("aloha-selection-changed",function(c,d){if(d.startContainer&&m.activeEditable){b[m.activeEditable.getId()]&&
m.Selection.mayInsertTag("table")?a._createTableButton.show():a._createTableButton.hide();if(a.activeTable)if(d.findMarkup(function(){return this.nodeName==="TABLE"},m.activeEditable.obj)){v.updateFloatingMenuScope();v.setActiveCellStyle()}else{a.activeTable.selection.cellSelectionMode=false;a.activeTable.selection.baseCellPosition=null;a.activeTable.selection.lastSelectionRange=null;a.activeTable.focusOut()}}});m.bind("aloha-editable-activated",function(b,c){a._splitcellsButton.enable(false);a._mergecellsButton.enable(false);
a._splitcellsRowButton.enable(false);a._mergecellsRowButton.enable(false);a._splitcellsColumnButton.enable(false);a._mergecellsColumnButton.enable(false);c.editable.obj.find("table").each(function(){for(var b=v.TableRegistry,d=0;d<b.length;d++)if(b[d].obj.attr("id")==e(this).attr("id")){b[d].activate();return true}if(a.isEditableTable(this)&&!v.isWithinTable(this)){b=new p(this,v);b.parentEditable=c.editable;b.activate();v.TableRegistry.push(b)}v.checkForNestedTables(c.editable.obj)})});m.bind("aloha-editable-deactivated",
function(){v.activeTable&&v.activeTable.selection.unselectCells();v.setFocusedTable(void 0);for(var a=v.TableRegistry,b=0;b<a.length;b++)a[b].deactivate()});m.bind("aloha-smart-content-changed",function(){m.activeEditable&&m.activeEditable.obj.find("table").each(function(){if(v.indexOfTableInRegistry(this)==-1&&!v.isWithinTable(this)){this.id=x.Utils.guid();var a=new p(this,v);a.parentEditable=m.activeEditable;v.TableRegistry.push(a);a.activate()}v.checkForNestedTables(m.activeEditable.obj)})});this.settings.summaryinsidebar&&
m.bind("aloha-plugins-loaded",function(){a.initSidebar(m.Sidebar.right.show())})};var A="aloha-table";v.initSidebar=function(a){var b=this;b.sidebar=a;b.sidebarPanel=a.addPanel({id:t("sidebar-panel"),title:q.t("table.sidebar.title"),content:"",expanded:true,activeOn:"table",onInit:function(){var a=this;this.setContent('<label class="'+t("label")+'" for="'+t("textarea")+'" >'+q.t("table.label.target")+'</label><textarea id="'+t("textarea")+'" class="'+t("textarea")+'" />');e(u("textarea")).live("keyup",
function(){e(a.effective).attr("summary",e(u("textarea")).val());var c=e('div[class*="wai"]',"table#"+e(a.effective).attr("id"));c.removeClass(b.get("waiGreen"));c.removeClass(b.get("waiRed"));e(u("textarea")).val().trim()!=""?c.addClass(b.get("waiGreen")):c.addClass(b.get("waiRed"))})},onActivate:function(a){this.effective=a;e(u("textarea")).val(e(this.effective).attr("summary"))}});a.show()};v.isEditableTable=function(a){return x.Utils.Dom.isEditable(a)};v.indexOfTableInRegistry=function(a){for(var b=
this.TableRegistry,c=0;c<b.length;c++)if(b[c].obj[0].id==a.id)return c;return-1};v.getTableFromRegistry=function(a){a=this.indexOfTableInRegistry(a);return a>-1?this.TableRegistry[a]:null};v.isSelectionInTable=function(){var a=m.Selection.getRangeObject(),a=e(a.commonAncestorContainer);return a.length==0?false:a.parents(".aloha-editable table").length?true:false};v.preventNestedTables=function(){if(this.isSelectionInTable()){f.alert({title:q.t("Table"),text:q.t("table.createTable.nestedTablesNoSupported")});
return true}return false};v.isWithinTable=function(a){return e(a).parents(".aloha-editable table").length>0};v.checkForNestedTables=function(a){a.find("table table")};v.initMergeSplitCellsBtns=function(){this._mergecellsButton=c.adopt("mergecells",j,{tooltip:q.t("button.mergecells.tooltip"),icon:"aloha-icon aloha-icon-mergecells",scope:this.name+".cell",click:function(){v.activeTable&&v.activeTable.selection.mergeCells()}});this._splitcellsButton=c.adopt("splitcells",j,{tooltip:q.t("button.splitcells.tooltip"),
icon:"aloha-icon aloha-icon-splitcells",scope:this.name+".cell",click:function(){v.activeTable&&v.activeTable.selection.splitCells()}});this._mergecellsRowButton=c.adopt("mergecellsRow",j,{tooltip:q.t("button.mergecells.tooltip"),icon:"aloha-icon aloha-icon-mergecells",scope:this.name+".row",click:function(){v.activeTable&&v.activeTable.selection.mergeCells()}});this._splitcellsRowButton=c.adopt("splitcellsRow",j,{tooltip:q.t("button.splitcells.tooltip"),icon:"aloha-icon aloha-icon-splitcells",scope:this.name+
".row",click:function(){v.activeTable&&v.activeTable.selection.splitCells()}});this._mergecellsColumnButton=c.adopt("mergecellsColumn",j,{tooltip:q.t("button.mergecells.tooltip"),icon:"aloha-icon aloha-icon-mergecells",scope:this.name+".column",click:function(){v.activeTable&&v.activeTable.selection.mergeCells()}});this._splitcellsColumnButton=c.adopt("splitcellsColumn",j,{tooltip:q.t("button.splitcells.tooltip"),icon:"aloha-icon aloha-icon-splitcells",scope:this.name+".column",click:function(){v.activeTable&&
v.activeTable.selection.splitCells()}})};v.initRowsBtns=function(){var a=this;this._addrowbeforeButton=c.adopt("addrowbefore",j,{tooltip:q.t("button.addrowbefore.tooltip"),icon:"aloha-icon aloha-icon-addrowbefore",scope:this.name+".row",click:function(){a.activeTable&&a.activeTable.addRowBeforeSelection()}});this._addrowafterButton=c.adopt("addrowafter",j,{tooltip:q.t("button.addrowafter.tooltip"),icon:"aloha-icon aloha-icon-addrowafter",scope:this.name+".row",click:function(){a.activeTable&&a.activeTable.addRowAfterSelection()}});
this._deleterowsButton=c.adopt("deleterows",j,{tooltip:q.t("button.delrows.tooltip"),icon:"aloha-icon aloha-icon-deleterows",scope:this.name+".row",click:function(){if(a.activeTable){var b=a.activeTable;f.confirm({title:q.t("Table"),text:q.t("deleterows.confirm"),yes:function(){b.deleteRows()}})}}});this._rowheaderButton=c.adopt("rowheader",l,{tooltip:q.t("button.rowheader.tooltip"),icon:"aloha-icon aloha-icon-rowheader",scope:this.name+".row",click:function(){if(a.activeTable){for(var b=a.activeTable.selection.selectedRowIdxs,
c,d=a.activeTable.selection.isHeader(),f=true,k=0;k<a.activeTable.selection.selectedCells.length;k++){c=a.activeTable.selection.selectedCells[k];if(!d){f=false;break}}for(k=0;k<a.activeTable.selection.selectedCells.length;k++){c=a.activeTable.selection.selectedCells[k];c=f?m.Markup.transformDomObject(c,"td").removeAttr("scope").get(0):m.Markup.transformDomObject(c,"th").attr("scope","row").get(0);e(a.activeTable.selection.selectedCells[k]).bind("mousedown",function(){var a=e(this).children("div").eq(0);
window.setTimeout(function(){a.trigger("focus")},1)})}a.activeTable.refresh();a.activeTable.selection.unselectCells();a.activeTable.selection.selectRows(b)}}});this.rowMSItems=[];e.each(this.rowConfig,function(b,c){a.rowMSItems.push({name:c.name,text:q.t(c.text),tooltip:q.t(c.tooltip),iconClass:"aloha-icon aloha-row-layout "+c.iconClass,click:function(){if(a.activeTable){for(var b=a.activeTable.selection.selectedCells,d=0;d<b.length;d++)if(e(b[d]).attr("class").indexOf(c.cssClass)>-1)e(b[d]).removeClass(c.cssClass);
else{e(b[d]).addClass(c.cssClass);for(var f=0;f<a.rowConfig.length;f++)a.rowConfig[f].cssClass!=c.cssClass&&e(b[d]).removeClass(a.rowConfig[f].cssClass)}a.activeTable.selectRows()}}})});this.rowMSItems.length>0&&this.rowMSItems.push({name:"removeFormat",text:q.t("button.removeFormat.text"),tooltip:q.t("button.removeFormat.tooltip"),cls:"aloha-ui-multisplit-fullwidth",wide:true,click:function(){if(a.activeTable){for(var b=a.activeTable.selection.selectedCells,c=0;c<b.length;c++)for(var d=0;d<a.rowConfig.length;d++)e(b[c]).removeClass(a.rowConfig[d].cssClass);
a.activeTable.selectRows()}}});this.rowMSButton=d({items:this.rowMSItems,name:"formatRow",hideIfEmpty:true,scope:this.name+".row"})};v.initColumnBtns=function(){var a=this;this._addcolumnleftButton=c.adopt("addcolumnleft",j,{tooltip:q.t("button.addcolleft.tooltip"),icon:"aloha-icon aloha-icon-addcolumnleft",scope:this.name+".column",click:function(){a.activeTable&&a.activeTable.addColumnsLeft()}});this._addcolumnrightButton=c.adopt("addcolumnright",j,{tooltip:q.t("button.addcolright.tooltip"),icon:"aloha-icon aloha-icon-addcolumnright",
scope:this.name+".column",click:function(){a.activeTable&&a.activeTable.addColumnsRight()}});this._deletecolumnsButton=c.adopt("deletecolumns",j,{tooltip:q.t("button.delcols.tooltip"),icon:"aloha-icon aloha-icon-deletecolumns",scope:this.name+".column",click:function(){if(a.activeTable){var b=a.activeTable;f.confirm({title:q.t("Table"),text:q.t("deletecolumns.confirm"),yes:function(){b.deleteColumns()}})}}});this._columnheaderButton=c.adopt("columnheader",l,{tooltip:q.t("button.columnheader.tooltip"),
icon:"aloha-icon aloha-icon-columnheader",scope:this.name+".column",click:function(){if(a.activeTable){for(var b=a.activeTable.selection.selectedColumnIdxs,c,d=a.activeTable.selection.isHeader(),f=true,k=0;k<a.activeTable.selection.selectedCells.length;k++){c=a.activeTable.selection.selectedCells[k];if(!d){f=false;break}}for(k=0;k<a.activeTable.selection.selectedCells.length;k++){c=a.activeTable.selection.selectedCells[k];c=f?m.Markup.transformDomObject(c,"td").removeAttr("scope").get(0):m.Markup.transformDomObject(c,
"th").attr("scope","row").get(0);e(a.activeTable.selection.selectedCells[k]).bind("mousedown",function(){var a=e(this).children("div").eq(0);window.setTimeout(function(){a.trigger("focus")},1)})}a.activeTable.refresh();a.activeTable.selection.unselectCells();a.activeTable.selection.selectColumns(b)}}});this.columnMSItems=[];e.each(this.columnConfig,function(b,c){var d={name:c.name,text:q.t(c.text),tooltip:q.t(c.tooltip),iconClass:"aloha-icon aloha-column-layout "+c.iconClass,click:function(){if(a.activeTable){for(var b=
a.activeTable.selection.selectedCells,d=0;d<b.length;d++)if(e(b[d]).attr("class").indexOf(c.cssClass)>-1)e(b[d]).removeClass(c.cssClass);else{e(b[d]).addClass(c.cssClass);for(var f=0;f<a.columnConfig.length;f++)a.columnConfig[f].cssClass!=c.cssClass&&e(b[d]).removeClass(a.columnConfig[f].cssClass)}a.activeTable.selectColumns()}}};a.columnMSItems.push(d)});this.columnMSItems.length>0&&this.columnMSItems.push({name:"removeFormat",text:q.t("button.removeFormat.text"),tooltip:q.t("button.removeFormat.tooltip"),
cls:"aloha-ui-multisplit-fullwidth",wide:true,click:function(){if(a.activeTable){for(var b=a.activeTable.selection.selectedCells,c=0;c<b.length;c++)for(var d=0;d<a.columnConfig.length;d++)e(b[c]).removeClass(a.columnConfig[d].cssClass);a.activeTable.selectColumns()}}});this.columnMSButton=d({items:this.columnMSItems,name:"formatColumn",hideIfEmpty:true,scope:this.name+".column"})};v.initCellBtns=function(){var a=this;this.cellMSItems=[];e.each(this.cellConfig,function(b,c){var d={name:c.name,text:q.t(c.text),
tooltip:q.t(c.tooltip),iconClass:"aloha-icon aloha-column-layout "+c.iconClass,click:function(){if(a.activeTable){for(var b=a.selectedOrActiveCells(),d=0;d<b.length;d++)if(e(b[d]).attr("class").indexOf(c.cssClass)>-1)e(b[d]).removeClass(c.cssClass);else{e(b[d]).addClass(c.cssClass);for(var f=0;f<a.cellConfig.length;f++)a.cellConfig[f].cssClass!=c.cssClass&&e(b[d]).removeClass(a.cellConfig[f].cssClass)}a.setActiveCellStyle()}}};a.cellMSItems.push(d)});this.cellMSItems.length>0&&this.cellMSItems.push({name:"removeFormat",
text:q.t("button.removeFormat.text"),tooltip:q.t("button.removeFormat.tooltip"),cls:"aloha-ui-multisplit-fullwidth",wide:true,click:function(){if(a.activeTable){for(var b=a.selectedOrActiveCells(),c=0;c<b.length;c++)for(var d=0;d<a.cellConfig.length;d++)e(b[c]).removeClass(a.cellConfig[d].cssClass);a.setActiveCellStyle()}}});this.cellMSButton=d({items:this.cellMSItems,name:"formatCell",hideIfEmpty:true,scope:this.name+".cell"})};v.initTableButtons=function(){var a=this;b.createScope(this.name+".row",
"Aloha.continuoustext");b.createScope(this.name+".column","Aloha.continuoustext");b.createScope(this.name+".cell","Aloha.continuoustext");this._createTableButton=c.adopt("createTable",j,{tooltip:q.t("button.createtable.tooltip"),icon:"aloha-icon aloha-icon-createTable",scope:"Aloha.continuoustext",click:function(){v.createDialog(this.element)}});this.initColumnBtns();this.initRowsBtns();this.initCellBtns();this.initMergeSplitCellsBtns();this.tableMSItems=[];var f=this.tableConfig;e.each(f,function(b,
c){a.tableMSItems.push({name:c.name,text:q.t(c.text),tooltip:q.t(c.tooltip),iconClass:"aloha-icon aloha-table-layout "+c.iconClass,click:function(){if(a.activeTable){for(var b=0;b<f.length;b++)a.activeTable.obj.removeClass(f[b].cssClass);a.activeTable.obj.addClass(c.cssClass)}}})});this.tableMSItems.length>0&&this.tableMSItems.push({name:"removeFormat",text:q.t("button.removeFormat.text"),tooltip:q.t("button.removeFormat.tooltip"),cls:"aloha-ui-multisplit-fullwidth",wide:true,click:function(){if(a.activeTable)for(var b=
0;b<f.length;b++)a.activeTable.obj.removeClass(a.tableConfig[b].cssClass)}});this.tableMSButton=d({items:this.tableMSItems,name:"formatTable",hideIfEmpty:true,scope:this.name+".cell"});this._tableCaptionButton=c.adopt("tableCaption",l,{tooltip:q.t("button.caption.tooltip"),icon:"aloha-icon aloha-icon-table-caption",scope:this.name+".cell",click:function(){if(a.activeTable)if(a.activeTable.obj.children("caption").is("caption"))a.activeTable.obj.children("caption").remove();else{var b=q.t("empty.caption"),
c=e("<caption></caption>");a.activeTable.obj.prepend(c);a.makeCaptionEditable(c,b);b=c.find("div").eq(0);c=b.contents().eq(0);if(c.length>0){var d=new x.Utils.RangeObject;d.startContainer=d.endContainer=c.get(0);d.startOffset=0;d.endOffset=c.text().length;a.activeTable.obj.find("div.aloha-table-cell-editable").blur();b.focus();d.select();m.Selection.updateSelection()}}}});this.summary=k({width:275,name:"tableSummary",noTargetHighlight:true,scope:this.name+".cell"});this.summary.addListener("keyup",
function(){a.activeTable&&a.activeTable.checkWai()})};v.makeCaptionEditable=function(a,b){var c=a.children("div");if(c.length===0){c=e("<div></div>");e(c).addClass("aloha-ui");e(c).addClass("aloha-editable-caption");a.contents().length>0?c.append(a.contents()):b&&c.text(b);a.append(c)}else if(c.length>1){a.children("div:not(:first-child)").each(function(){$this=e(this);c.eq(0).append($this.contents());$this.remove()});c=c.eq(0)}c.contentEditable(true)};v.createDialog=function(a){this.createLayer.set("target",
a);this.createLayer.show()};v.createTable=function(a,b){if(!this.preventNestedTables())if(m.activeEditable&&typeof m.activeEditable.obj!=="undefined"){for(var c=document.createElement("table"),d=c.id=x.Utils.guid(),f=document.createElement("tbody"),k=0;k<b;k++){for(var j=document.createElement("tr"),g=0;g<a;g++){var l=document.createTextNode(" "),q=document.createElement("td");q.appendChild(l);j.appendChild(q)}f.appendChild(j)}c.appendChild(f);y(m.Selection.getRangeObject(),c);x.Utils.Dom.insertIntoDOM(e(c),
m.Selection.getRangeObject(),m.activeEditable.obj);z();c=document.getElementById(d);if(!v.isWithinTable(c)){var o=new p(c,v);o.parentEditable=m.activeEditable;o.activate();e.browser.msie?window.setTimeout(function(){o.cells[0].wrapper.get(0).focus()},20):o.cells[0].wrapper.get(0).focus();v.TableRegistry.push(o)}v.checkForNestedTables(m.activeEditable.obj);o.focus();v.activeTable.selection.selectionType="cell";v.updateFloatingMenuScope()}else this.error("There is no active Editable where the table can be\t\t\t\tinserted!")};
v.setFocusedTable=function(a){null==a&&null!=this.activeTable&&this.activeTable.selection.unselectCells();for(var b=0;b<v.TableRegistry.length;b++)v.TableRegistry[b].hasFocus=false;if(typeof a!="undefined"){this.summary.setTargetObject(a.obj,"summary");if(a.obj.children("caption").is("caption")){this._tableCaptionButton.setState(true);this.makeCaptionEditable(a.obj.children("caption"))}a.hasFocus=true}v.activeTable=a;for(b=0;b<this.tableMSItems.length;b++)this.tableMSButton.showItem(this.tableMSItems[b].name);
this.tableMSButton.setActiveItem();if(this.activeTable)for(b=0;b<this.tableConfig.length;b++)this.activeTable.obj.hasClass(this.tableConfig[b].cssClass)&&this.tableMSButton.setActiveItem(this.tableConfig[b].name)};v.error=function(a){m.Log.error(this,a)};v.debug=function(a){m.Log.debug(this,a)};v.info=function(a){m.Log.info(this,a)};v.log=function(a){m.log("log",this,a)};v.get=function(a){if(this.config[a])return this.config[a];if(this.parameters[a])return this.parameters[a]};v.set=function(a,b){this.config[a]?
this.config[a]=b:this.parameters[a]=b};v.makeClean=function(a){var b=this;a.find("table").each(function(){if(b.getTableFromRegistry(this)){(new p(this,b)).deactivate();e(this).attr("id",null)}})};v.toString=function(){return this.prefix};v.updateFloatingMenuScope=function(){null!=v.activeTable&&null!=v.activeTable.selection.selectionType&&b.setScope(v.name+"."+v.activeTable.selection.selectionType)};v.setActiveCellStyle=function(){var a=this;this.cellMSButton.setActiveItem();var b=a.selectedOrActiveCells();
e(b).each(function(){for(var b=0;b<a.cellConfig.length;b++)if(e(this).hasClass(a.cellConfig[b].cssClass)){a.cellMSButton.setActiveItem(a.cellConfig[b].name);b=a.cellConfig.length}})};v.selectedOrActiveCells=function(){var a=this.activeTable.selection.selectedCells;if(!a||a.length<1)return(a=function(){var a=m.Selection.getRangeObject();return m.activeEditable?a.findMarkup(function(){return this.nodeName.toLowerCase()==="td"},m.activeEditable.obj):null}())?[a]:[];return a};g.register(v);return v});
define("format/nls/i18n",{root:{"button.strong.tooltip":"Strong","button.em.tooltip":"Emphasize","button.b.tooltip":"Bold","button.i.tooltip":"Italic","button.u.tooltip":"Underline","button.cite.tooltip":"Cite","button.q.tooltip":"Tooltip","button.code.tooltip":"Code","button.abbr.tooltip":"Abbreviation","button.del.tooltip":"Strikethrough","button.s.tooltip":"Strikethrough","button.sub.tooltip":"Subscript","button.sup.tooltip":"Superscript","button.p.tooltip":"Paragraph","button.h1.tooltip":"Heading 1",
"button.h2.tooltip":"Heading 2","button.h3.tooltip":"Heading 3","button.h4.tooltip":"Heading 4","button.h5.tooltip":"Heading 5","button.h6.tooltip":"Heading 6","button.pre.tooltip":"Pre formated text","button.title.tooltip":"Title","button.removeFormat.tooltip":"Remove formatting","button.removeFormat.text":"Remove formatting",GENTICS_button_p:"GENTICS_button_p",GENTICS_button_h1:"GENTICS_button_h1",GENTICS_button_h2:"GENTICS_button_h2",GENTICS_button_h3:"GENTICS_button_h3",GENTICS_button_h4:"GENTICS_button_h4",
GENTICS_button_h5:"GENTICS_button_h5",GENTICS_button_h6:"GENTICS_button_h6",GENTICS_button_pre:"GENTICS_button_pre",GENTICS_button_title:"GENTICS_button_title",formatBold:"Ctrl+b",formatItalic:"Ctrl+i",formatUnderline:"Ctrl+u",formatParagraph:"Alt+Ctrl+0",formatH1:"Alt+Ctrl+1",formatH2:"Alt+Ctrl+2",formatH3:"Alt+Ctrl+3",formatH4:"Alt+Ctrl+4",formatH5:"Alt+Ctrl+5",formatH6:"Alt+Ctrl+6",formatPre:"Alt+Ctrl+P",formatDel:"Ctrl+\\",formatSub:"Ctrl+,",formatSup:"Ctrl+.","floatingmenu.tab.format":"Format",
"format.class.legend":"CSS class","format.class.none":"none"},ca:!0,de:!0,mk:!0,"pt-br":!0,ru:!0,uk:!0,"zh-hans":!0});define("format/format-plugin","aloha aloha/plugin jquery ui/ui ui/toggleButton ui/port-helper-multi-split PubSub i18n!format/nls/i18n i18n!aloha/nls/i18n aloha/selection".split(" "),function(m,e,a,g,c,b,j,l){function f(b,c){var d=false,f,k,j,g,e;a.each(b.buttons,function(a,b){d=false;for(j=0;j<c.markupEffectiveAtStart.length;j++){f=c.markupEffectiveAtStart[j];if(m.Selection.standardTextLevelSemanticsComparator(f,
b.markup)){b.handle.setState(true);d=true}}d||b.handle.setState(false)});if(b.multiSplitItems.length>0){k=false;for(j=0;j<c.markupEffectiveAtStart.length&&!k;j++){f=c.markupEffectiveAtStart[j];for(g=0;g<b.multiSplitItems.length&&!k;g++){e=b.multiSplitItems[g];if(e.markup&&m.Selection.standardTextLevelSemanticsComparator(f,e.markup)){b.multiSplitButton.setActiveItem(e.name);k=true}}}k||b.multiSplitButton.setActiveItem(null)}}var k=window.GENTICS,d={b:"bold",strong:"bold",i:"italic",em:"italic",del:"strikethrough",
sub:"subscript",sup:"superscript",u:"underline",s:"strikethrough"},q={strong:"strong",em:"emphasis",s:"strikethrough2"},o={u:true,em:true,strong:true,b:true,i:true,cite:true,q:true,code:true,abbr:true,del:true,s:true,sub:true,sup:true},r={p:true,h1:true,h2:true,h3:true,h4:true,h5:true,h6:true,pre:true};return e.create("format",{config:["b","i","sub","sup","p","h1","h2","h3","h4","h5","h6","pre","removeFormat"],availableButtons:["u","strong","del","em","b","i","s","sub","sup","p","h1","h2","h3","h4",
"h5","h6","pre","removeFormat"],hotKey:{formatBold:"ctrl+b",formatItalic:"ctrl+i",formatParagraph:"alt+ctrl+0",formatH1:"alt+ctrl+1",formatH2:"alt+ctrl+2",formatH3:"alt+ctrl+3",formatH4:"alt+ctrl+4",formatH5:"alt+ctrl+5",formatH6:"alt+ctrl+6",formatPre:"ctrl+p",formatDel:"ctrl+d",formatSub:"alt+shift+s",formatSup:"ctrl+shift+s"},init:function(){var b=this;typeof this.settings.hotKey!=="undefined"&&a.extend(true,this.hotKey,this.settings.hotKey);this.initButtons();m.bind("aloha-plugins-loaded",function(){b.initSidebar(m.Sidebar.right)});
m.bind("aloha-editable-activated",function(a,c){b.applyButtonConfig(c.editable.obj);c.editable.obj.bind("keydown.aloha.format",b.hotKey.formatBold,function(){b.addMarkup("b");return false});c.editable.obj.bind("keydown.aloha.format",b.hotKey.formatItalic,function(){b.addMarkup("i");return false});c.editable.obj.bind("keydown.aloha.format",b.hotKey.formatParagraph,function(){b.changeMarkup("p");return false});c.editable.obj.bind("keydown.aloha.format",b.hotKey.formatH1,function(){b.changeMarkup("h1");
return false});c.editable.obj.bind("keydown.aloha.format",b.hotKey.formatH2,function(){b.changeMarkup("h2");return false});c.editable.obj.bind("keydown.aloha.format",b.hotKey.formatH3,function(){b.changeMarkup("h3");return false});c.editable.obj.bind("keydown.aloha.format",b.hotKey.formatH4,function(){b.changeMarkup("h4");return false});c.editable.obj.bind("keydown.aloha.format",b.hotKey.formatH5,function(){b.changeMarkup("h5");return false});c.editable.obj.bind("keydown.aloha.format",b.hotKey.formatH6,
function(){b.changeMarkup("h6");return false});c.editable.obj.bind("keydown.aloha.format",b.hotKey.formatPre,function(){b.changeMarkup("pre");return false});c.editable.obj.bind("keydown.aloha.format",b.hotKey.formatDel,function(){b.addMarkup("del");return false});c.editable.obj.bind("keydown.aloha.format",b.hotKey.formatSub,function(){b.addMarkup("sub");return false});c.editable.obj.bind("keydown.aloha.format",b.hotKey.formatSup,function(){b.addMarkup("sup");return false})});m.bind("aloha-editable-deactivated",
function(a,b){b.editable.obj.unbind("keydown.aloha.format")})},applyButtonConfig:function(b){var b=this.getEditableConfig(b),c,d;if(typeof b==="object"){var f=[];a.each(b,function(a,b){typeof a==="number"&&typeof b==="string"||f.push(a)});f.length>0&&(b=f)}this.formatOptions=b;for(c in this.buttons)this.buttons.hasOwnProperty(c)&&(a.inArray(c,b)!==-1?this.buttons[c].handle.show():this.buttons[c].handle.hide());d=this.multiSplitItems.length;for(c=0;c<d;c++)a.inArray(this.multiSplitItems[c].name,b)!==
-1?this.multiSplitButton.showItem(this.multiSplitItems[c].name):this.multiSplitButton.hideItem(this.multiSplitItems[c].name)},initButtons:function(){var k=this;this.buttons={};this.multiSplitItems=[];a.each(this.availableButtons,function(b,f){var j=false;if(typeof b!=="number"&&typeof f!=="string"){j=f;f=b}if(o[f]){var e=d[f];q.hasOwnProperty(f)&&(e=q[f]);e=g.adopt(e,c,{tooltip:l.t("button."+f+".tooltip"),icon:"aloha-icon aloha-icon-"+e,scope:"Aloha.continuoustext",click:function(){var b=a(".aloha-cell-selected");
if(b.length>0){var c=0;b.each(function(){var b=a(this).find("div"),d=b.find(f);if(d.length>0){d.contents().unwrap();c++}b.contents().wrap("<"+f+"></"+f+">")});c===b.length&&b.find(f).contents().unwrap();return false}k.addMarkup(f);return false}});k.buttons[f]={handle:e,markup:a("<"+f+">",{"class":j||""})}}else r[f]?k.multiSplitItems.push({name:f,tooltip:l.t("button."+f+".tooltip"),iconClass:"aloha-icon "+l.t("aloha-large-icon-"+f),markup:a("<"+f+">"),click:function(){var b=a(".aloha-cell-selected");
if(b.length>0){var c=0;b.each(function(){var b=a(this).find("div"),d=b.find(f);if(d.length>0){d.contents().unwrap();c++}b.contents().wrap("<"+f+"></"+f+">")});c===b.length&&b.find(f).contents().unwrap();return false}k.changeMarkup(f);m.activeEditable&&a.browser.mozilla&&m.activeEditable.obj.focus();m.activeEditable&&m.trigger("aloha-format-block")}}):"removeFormat"===f?k.multiSplitItems.push({name:f,text:l.t("button."+f+".text"),tooltip:l.t("button."+f+".tooltip"),wide:true,cls:"aloha-ui-multisplit-fullwidth",
click:function(){k.removeFormat()}}):m.log("warn",this,'Button "'+f+'" is not defined')});this.multiSplitButton=b({name:"formatBlock",items:this.multiSplitItems,hideIfEmpty:true,scope:"Aloha.continuoustext"});j.sub("aloha.selection.context-change",function(a){f(k,a.range)})},initSidebar:function(b){var c=this;c.sidebar=b;b.addPanel({id:c.nsClass("sidebar-panel-class"),title:l.t("floatingmenu.tab.format"),content:"",expanded:true,activeOn:this.formatOptions||false,onInit:function(){},onActivate:function(b){var d=
this;d.effective=b;if(b[0]){d.format=b[0].nodeName.toLowerCase();var f=a("<div>").attr("class",c.nsClass("target-container")),k=a("<fieldset>");k.append(a("<legend>"+d.format+" "+l.t("format.class.legend")).append(a("<select>")));f.append(k);var j='<div class="'+c.nsClass("target-container")+'"><fieldset><legend>'+l.t("format.class.legend")+'</legend><select name="targetGroup" class="'+c.nsClass("radioTarget")+'"><option value="">'+l.t("format.class.none")+"</option>";c.config[d.format]&&c.config[d.format]["class"]&&
a.each(c.config[d.format]["class"],function(a,b){j=j+('<option value="'+a+'" >'+b+"</option>")});j=j+"</select></fieldset></div>";d=this;this.setContent(j);a(c.nsSel("framename")).live("keyup",function(){a(d.effective).attr("target",a(this).val().replace('"',"&quot;").replace("'","&#39;"))});d=this;d.effective=b;a(c.nsSel("linkTitle")).val(a(d.effective).attr("title"))}}});b.show()},nsClass:function(){var b=[];a.each(arguments,function(){b.push(this==""?"aloha-format":"aloha-format-"+this)});return a.trim(b.join(" "))},
nsSel:function(){var b=[];a.each(arguments,function(){b.push("."+(this==""?"aloha-format":"aloha-format-"+this))});return a.trim(b.join(" "))},addMarkup:function(b){var c=a("<"+b+">"),d=m.Selection.rangeObject;if(typeof b==="undefined"||b=="")return false;if(b=d.findMarkup(function(){return this.nodeName===c[0].nodeName},m.activeEditable.obj))d.isCollapsed()?k.Utils.Dom.removeFromDOM(b,d,true):k.Utils.Dom.removeMarkup(d,c,m.activeEditable.obj);else{d.isCollapsed()&&k.Utils.Dom.extendToWord(d);k.Utils.Dom.addMarkup(d,
c)}d.select();f(this,m.Selection.getRangeObject());return false},changeMarkup:function(b){m.Selection.changeMarkupOnSelection(a("<"+b+">"))},removeFormat:function(){var b=["u","strong","em","b","i","q","del","s","code","sub","sup","p","h1","h2","h3","h4","h5","h6","pre","quote","blockquote"],c=m.Selection.rangeObject,d;if(this.settings.removeFormats)b=this.settings.removeFormats;if(!c.isCollapsed()){for(d=0;d<b.length;d++)k.Utils.Dom.removeMarkup(c,a("<"+b[d]+">"),m.activeEditable.obj);c.select()}},
toString:function(){return"format"}})});define("list/nls/i18n",{root:{"button.createulist.tooltip":"Insert Unordered List","button.createolist.tooltip":"Insert Ordered List","button.indentlist.tooltip":"Indent List","button.outdentlist.tooltip":"Outdent List","floatingmenu.tab.list":"Lists"},ca:!0,de:!0,mk:!0,"pt-br":!0,ru:!0,uk:!0,"zh-hans":!0});define("list/list-plugin","aloha jquery aloha/plugin ui/ui ui/scopes ui/button ui/toggleButton i18n!list/nls/i18n i18n!aloha/nls/i18n aloha/engine PubSub".split(" "),
function(m,e,a,g,c,b,j,l,f,k,d){function q(a,b){e(a).find(a.nodeName).each(function(){var a=m.Selection.getSelectionTree();o(a,this)&&m.Markup.transformDomObject(this,b,m.Selection.rangeObject)});m.Markup.transformDomObject(a,b,m.Selection.rangeObject)}function o(a,b){var c=false;e.each(a,function(a,d){if(d.domobj===b&&d.selection!=="none"||o(d.children,b))c=true});return c}var r=window.GENTICS,p=a.create("list",{config:["ul","ol"],transformableElements:{p:true,h1:true,h2:true,h3:true,h4:true,h5:true,
h6:true,ul:true,ol:true},init:function(){var a=this;this._orderedListButton=g.adopt("orderedList",j,{tooltip:l.t("button.createolist.tooltip"),icon:"aloha-icon aloha-icon-orderedlist",scope:"Aloha.continuoustext",click:function(){a.transformList(true)}});this._unorderedListButton=g.adopt("unorderedList",j,{tooltip:l.t("button.createulist.tooltip"),icon:"aloha-icon aloha-icon-unorderedlist",scope:"Aloha.continuoustext",click:function(){a.transformList(false)}});this._indentListButton=g.adopt("indentList",
b,{tooltip:l.t("button.indentlist.tooltip"),icon:"aloha-icon aloha-icon-indent",scope:"Aloha.continuoustext",click:function(){a.indentList()}});this._outdentListButton=g.adopt("outdentList",b,{tooltip:l.t("button.outdentlist.tooltip"),icon:"aloha-icon aloha-icon-outdent",scope:"Aloha.continuoustext",click:function(){a.outdentList()}});c.createScope("Aloha.List","Aloha.continuoustext");d.sub("aloha.selection.context-change",function(b){var c,d=b.range;a._outdentListButton.show(false);a._indentListButton.show(false);
a._unorderedListButton.setState(false);a._orderedListButton.setState(false);for(b=0;b<d.markupEffectiveAtStart.length;b++){c=d.markupEffectiveAtStart[b];if(m.Selection.standardTagNameComparator(c,e("<ul></ul>"))){a._unorderedListButton.setState(true);a._outdentListButton.show(true);a._indentListButton.show(true);break}if(m.Selection.standardTagNameComparator(c,e("<ol></ol>"))){a._orderedListButton.setState(true);a._outdentListButton.show(true);a._indentListButton.show(true);break}}m.activeEditable&&
a.applyButtonConfig(m.activeEditable.obj)});m.Markup.addKeyHandler(9,function(b){return a.processTab(b)})},applyButtonConfig:function(a){a=this.getEditableConfig(a);if(m.Selection.rangeObject.unmodifiableMarkupAtStart[0]){e.inArray("ul",a)!=-1&&m.Selection.canTag1WrapTag2(m.Selection.rangeObject.unmodifiableMarkupAtStart[0].nodeName,"ul")!=-1?this._unorderedListButton.show(true):this._unorderedListButton.show(false);e.inArray("ol",a)!=-1&&m.Selection.canTag1WrapTag2(m.Selection.rangeObject.unmodifiableMarkupAtStart[0].nodeName,
"ol")!=-1?this._orderedListButton.show(true):this._orderedListButton.show(false)}},processTab:function(a){return a.keyCode===9?a.shiftKey?this.outdentList():this.indentList():true},getStartingDomObjectToTransform:function(){var a=m.Selection.rangeObject,b,c;for(b=0;b<a.markupEffectiveAtStart.length;b++){c=a.markupEffectiveAtStart[b];if(this.transformableElements[c.nodeName.toLowerCase()])return c}return false},getNearestSelectedListItem:function(){var a=m.Selection.rangeObject,b,c;for(b=0;b<a.markupEffectiveAtStart.length;b++){c=
a.markupEffectiveAtStart[b];if(r.Utils.Dom.isListElement(c))return c}return false},transformList:function(a){var b=this.getStartingDomObjectToTransform(),c,d,f,j;this._outdentListButton.show(true);this._indentListButton.show(true);if(!b){m.Selection.changeMarkupOnSelection(e("<p></p>"));b=this.getStartingDomObjectToTransform();if(!b){if(m.Selection.rangeObject.startContainer.contentEditable){a=a?e("<ol></ol>"):e("<ul></ul>");d=e("<li></li>");a.append(d);f=d.get(0);b=m.getActiveEditable().obj;f.appendChild(document.createTextNode(""));
b.append(a);b.focus();a=m.createRange();b=m.getSelection();a.setStart(f.firstChild,0);a.setEnd(f.firstChild,0);b.removeAllRanges();b.addRange(a);m.Selection.updateSelection()}else m.Log.error(this,"Could not transform selection into a list");return}}f=b.nodeName.toLowerCase();if(f=="ul"&&!a){a=e(b);f=a.parent();if(f.length>0&&r.Utils.Dom.isListElement(f.get(0)))if(f.get(0).nodeName.toLowerCase()==="li"){f.after(a.children());a.remove()}else a.children().unwrap();else{a=e(b);e.each(a.children("li"),
function(a,b){j=m.Markup.transformDomObject(b,"p",m.Selection.rangeObject);j.after(j.children("ol,ul"));k.ensureContainerEditable(j.get(0))});a.children().unwrap()}}else if(f=="ul"&&a){q(b,"ol");this.mergeAdjacentLists(e(b))}else if(f=="ol"&&!a){q(b,"ul");this.mergeAdjacentLists(e(b))}else if(f=="ol"&&a){a=e(b);f=a.parent();if(f.length>0&&r.Utils.Dom.isListElement(f.get(0)))if(f.get(0).nodeName.toLowerCase()==="li"){f.after(a.children());a.remove()}else a.children().unwrap();else{a=e(b);e.each(a.children("li"),
function(a,b){j=m.Markup.transformDomObject(b,"p",m.Selection.rangeObject);j.after(j.children("ol,ul"));k.ensureContainerEditable(j.get(0))});a.children().unwrap()}}else{f=m.Selection.rangeObject.getSelectedSiblings(b);a=a?e("<ol></ol>"):e("<ul></ul>");d=e("<li></li>");a.append(d);e(b).contents().appendTo(d);e(b).replaceWith(a);if(m.Selection.rangeObject.startContainer==b)m.Selection.rangeObject.startContainer=d.get(0);if(m.Selection.rangeObject.endContainer==b)m.Selection.rangeObject.endContainer=
d.get(0);if(f){b=false;for(c=0;c<f.length;++c)if(r.Utils.Dom.isBlockLevelElement(f[c])){b&&(b=false);d=m.Markup.transformDomObject(f[c],"li",m.Selection.rangeObject);a.append(d)}else if(!(f[c].nodeType==3&&e.trim(f[c].data).length===0)){if(!b){b=e("<li></li>");a.append(b);d=b}b.append(f[c])}}this.mergeAdjacentLists(a);f=d.get(0);if(r.Utils.Dom.isEmpty(f)){a=m.createRange();b=m.getSelection();f.appendChild(document.createTextNode(""));a.selectNodeContents(f.lastChild);b.removeAllRanges();b.addRange(a);
m.Selection.updateSelection()}}this.refreshSelection()},indentList:function(){var a=this.getNearestSelectedListItem(),b,c,d;if(a){d=e(a).prev("li");if(d.length===0)return false;e(a).parent();c=m.Selection.rangeObject.getSelectedSiblings(a);b=e(a).parent().clone(false).empty();b.append(a);d.append(b);if(c)for(a=0;a<c.length;++a)b.append(e(c[a]));this.mergeAdjacentLists(b,true);this.refreshSelection();return false}return true},outdentList:function(){var a=this.getNearestSelectedListItem(),b,c,d,f,k;
if(a){c=e(a);d=c.parent();b=d.parents("ul,ol");f=d.parent("li");if(b.length>0&&r.Utils.Dom.isListElement(b.get(0))){k=(a=m.Selection.rangeObject.getSelectedSiblings(a))&&a.length>0?e(a[a.length-1]):c;if(k.nextAll("li").length>0){b=d.clone(false).empty();b.append(k.nextAll());k.append(b)}f.length>0?f.after(c):d.before(c);if(a&&a.length>0)for(b=a.length-1;b>=0;--b)c.after(e(a[b]));d.contents("li").length===0&&d.remove();f.length>0&&f.contents().length===0&&f.remove();this.refreshSelection()}return false}return true},
refreshSelection:function(){m.Selection.rangeObject.update();m.Selection.rangeObject.select();m.Selection.updateSelection()},mergeAdjacentLists:function(a,b){for(var c=a.get(0),d;c.previousSibling&&c.previousSibling.nodeType===1&&this.isMergable(c.previousSibling,c,b);)c=c.previousSibling;for(a=e(c);c.nextSibling&&(c.nextSibling.nodeType===1&&this.isMergable(c.nextSibling,c,b)||c.nextSibling.nodeType===3&&e.trim(c.nextSibling.data).length===0);){d=e(c.nextSibling);c.nextSibling.nodeType==1&&d.contents().appendTo(a);
d.remove()}},isMergable:function(a,b,c){return c?a.nodeName.toLowerCase()=="ul"||a.nodeName.toLowerCase()=="ol":a.nodeName==b.nodeName}});k.commands.insertorderedlist={action:function(a,b){p.transformList(true);if(b&&m.Selection.rangeObject){b.startContainer=m.Selection.rangeObject.startContainer;b.startOffset=m.Selection.rangeObject.startOffset;b.endContainer=m.Selection.rangeObject.endContainer;b.endOffset=m.Selection.rangeObject.endOffset}},indeterm:function(){},state:function(){for(i=0;i<rangeObject.markupEffectiveAtStart.length;i++){effectiveMarkup=
rangeObject.markupEffectiveAtStart[i];if(m.Selection.standardTagNameComparator(effectiveMarkup,e("<ul></ul>")))break;if(m.Selection.standardTagNameComparator(effectiveMarkup,e("<ol></ol>")))return true}return false}};k.commands.insertunorderedlist={action:function(a,b){p.transformList(false);if(b&&m.Selection.rangeObject){b.startContainer=m.Selection.rangeObject.startContainer;b.startOffset=m.Selection.rangeObject.startOffset;b.endContainer=m.Selection.rangeObject.endContainer;b.endOffset=m.Selection.rangeObject.endOffset}},
indeterm:function(){},state:function(){for(i=0;i<rangeObject.markupEffectiveAtStart.length;i++){effectiveMarkup=rangeObject.markupEffectiveAtStart[i];if(m.Selection.standardTagNameComparator(effectiveMarkup,e("<ul></ul>")))return true;if(m.Selection.standardTagNameComparator(effectiveMarkup,e("<ol></ol>")))break}return false}};k.commands.indent={action:function(a,b){p.indentList();if(b&&m.Selection.rangeObject){b.startContainer=m.Selection.rangeObject.startContainer;b.startOffset=m.Selection.rangeObject.startOffset;
b.endContainer=m.Selection.rangeObject.endContainer;b.endOffset=m.Selection.rangeObject.endOffset}},indeterm:function(){},state:function(){return false}};k.commands.outdent={action:function(a,b){p.outdentList();if(b&&m.Selection.rangeObject){b.startContainer=m.Selection.rangeObject.startContainer;b.startOffset=m.Selection.rangeObject.startOffset;b.endContainer=m.Selection.rangeObject.endContainer;b.endOffset=m.Selection.rangeObject.endOffset}},indeterm:function(){},state:function(){return false}};
return p});define("image/nls/i18n",{root:{"size.natural":"Original size","button.addimg.tooltip":"add image ref","floatingmenu.tab.img":"Image","floatingmenu.tab.formatting":"Formatting","floatingmenu.tab.resize":"Resize","floatingmenu.tab.crop":"Crop","button.uploadimg.tooltip":"Upload img","button.uploadimg.label":"Upload","button.img.align.left.tooltip":"Left align","button.img.align.right.tooltip":"Right Align","button.img.align.none.tooltip":"No alignment","field.img.title.label":"Title","field.img.title.tooltip":"Title",
"field.img.label":"URL","field.img.tooltip":"Source","border ":"Add Border to Image","padding.increase ":"Increase Padding","padding.decrease ":"Decrease Padding","size.increase ":"Increase Size","size.decrease ":"Decrease Size",Resize:"Resize",Crop:"Crop",Reset:"Reset",Accept:"Accept",Cancel:"Cancel",height:"Height",width:"Width","button.toggle.tooltip":"Toggle keep aspect ratio","field.img.src.label":"Source","field.img.src.tooltip":"Source"},ca:!0,de:!0,mk:!0,"pt-br":!0,ru:!0,uk:!0,"zh-hans":!0});
define("image/image-floatingMenu","jquery util/class i18n!image/nls/i18n i18n!aloha/nls/i18n ui/ui ui/scopes ui/button ui/toggleButton ui/port-helper-attribute-field".split(" "),function(m,e,a,g,c,b,j,l,f){return e.extend({_constructor:function(){},init:function(a){a.floatingMenuControl=this;this.plugin=a;b.createScope(a.name,"Aloha.empty");this._addUIInsertButton();this._addUIMetaButtons();this._addUIResetButton();this._addUIAlignButtons();this._addUIMarginButtons();this._addUICropButtons();this._addUIResizeButtons();
this._addUIAspectRatioToggleButton()},_addUIAspectRatioToggleButton:function(){var b=this.plugin;this._imageCnrRatioButton=c.adopt("imageCnrRatio",l,{tooltip:a.t("button.toggle.tooltip"),icon:"aloha-icon-cnr-ratio",scope:b.name,click:function(){b.toggleKeepAspectRatio()}});if(b.settings.fixedAspectRatio!==false){this._imageCnrRatioButton.setState(true);b.keepAspectRatio=true}},_addUIResetButton:function(){var b=this.plugin;this._imageCnrResetButton=c.adopt("imageCnrReset",j,{tooltip:a.t("Reset"),
icon:"aloha-icon-cnr-reset",scope:b.name,click:function(){b.reset()}})},_addUIInsertButton:function(){var b=this.plugin;this._insertImageButton=c.adopt("insertImage",j,{tooltip:a.t("button.addimg.tooltip"),icon:"aloha-button aloha-image-insert",scope:"Aloha.continuoustext",click:function(){b.insertImg()}})},_addUIMetaButtons:function(){var b=this.plugin;this.imgSrcField=f({label:a.t("field.img.src.label"),labelClass:"aloha-image-input-label",tooltip:a.t("field.img.src.tooltip"),name:"imageSource",
scope:b.name});this.imgSrcField.setTemplate("<span><b>{name}</b><br/>{url}</span>");this.imgSrcField.setObjectTypeFilter(b.objectTypeFilter);this.imgTitleField=f({label:a.t("field.img.title.label"),labelClass:"aloha-image-input-label",tooltip:a.t("field.img.title.tooltip"),name:"imageTitle",scope:b.name});this.imgTitleField.setObjectTypeFilter()},_addUIAlignButtons:function(){var b=this.plugin;this._imageAlignLeftButton=c.adopt("imageAlignLeft",j,{tooltip:a.t("button.img.align.left.tooltip"),icon:"aloha-img aloha-image-align-left",
scope:b.name,click:function(){var a=m(b.getPluginFocus());a.add(a.parent()).css("float","left")}});this._imageAlignRightButton=c.adopt("imageAlignRight",j,{tooltip:a.t("button.img.align.right.tooltip"),icon:"aloha-img aloha-image-align-right",scope:b.name,click:function(){var a=m(b.getPluginFocus());a.add(a.parent()).css("float","right")}});this._imageAlignNoneButton=c.adopt("imageAlignNone",j,{tooltip:a.t("button.img.align.none.tooltip"),icon:"aloha-img aloha-image-align-none",scope:b.name,click:function(){var a=
m(b.getPluginFocus());a.add(a.parent()).css({"float":"none",display:"inline-block"})}})},_addUIMarginButtons:function(){var b=this.plugin;this._imageIncPaddingButton=c.adopt("imageIncPadding",j,{tooltip:a.t("padding.increase"),icon:"aloha-img aloha-image-padding-increase",scope:b.name,click:function(){m(b.getPluginFocus()).increase("padding")}});this._imageDecPaddingButton=c.adopt("imageDecPadding",j,{tooltip:a.t("padding.decrease"),icon:"aloha-img aloha-image-padding-decrease",scope:b.name,click:function(){m(b.getPluginFocus()).decrease("padding")}})},
_addUICropButtons:function(){var f=this.plugin;b.createScope("Aloha.img",["Aloha.global"]);this._imageCropButton=c.adopt("imageCropButton",l,{tooltip:a.t("Crop"),icon:"aloha-icon-cnr-crop",scope:f.name,click:function(){this.getState()?f.crop():f.endCrop()}})},_addUIResizeButtons:function(){var b=this.plugin;this.imgResizeHeightField=f({label:a.t("height"),labelClass:"aloha-image-input-label",name:"imageResizeHeight",width:50,scope:b.name});this.imgResizeHeightField.maxValue=b.settings.maxHeight;this.imgResizeHeightField.minValue=
b.settings.minHeight;this.imgResizeWidthField=f({label:a.t("width"),labelClass:"aloha-image-input-label",name:"imageResizeWidth",width:50,scope:b.name});this.imgResizeWidthField.maxValue=b.settings.maxWidth;this.imgResizeWidthField.minValue=b.settings.minWidth},setScope:function(){b.setScope(this.plugin.name)},doLayout:function(){}})});define("image/vendor/jcrop/jquery.jcrop.min",["jquery"],function(m){(function(e){e.Jcrop=function(a,g){function c(a){return""+parseInt(a)+"px"}function b(a){a=e(a).offset();
return[a.left,a.top]}function j(a){return[a.pageX-W[0],a.pageY-W[1]]}function l(a,b){return function(c){if(x.aspectRatio)switch(a){case "e":c[1]=b.y+1;break;case "w":c[1]=b.y+1;break;case "n":c[0]=b.x+1;break;case "s":c[0]=b.x+1}else switch(a){case "e":c[1]=b.y2;break;case "w":c[1]=b.y2;break;case "n":c[0]=b.x2;break;case "s":c[0]=b.x2}C.setCurrent(c);S.update()}}function f(a){var b=a;fa.watchKeys();return function(a){C.moveOffset([a[0]-b[0],a[1]-b[1]]);b=a;S.update()}}function k(a){switch(a){case "n":return"sw";
case "s":return"nw";case "e":return"nw";case "w":return"ne";case "ne":return"sw";case "nw":return"se";case "se":return"nw";case "sw":return"ne"}}function d(a){return function(c){if(x.disabled||"move"==a&&!x.allowMove)return!1;Q=!0;var d=j(c);W=b(A);V.setCursor("move"==a?a:a+"-resize");if("move"==a)V.activateHandlers(f(d),o);else{var d=C.getFixed(),g=k(a),e=C.getCorner(k(g));C.setPressed(C.getCorner(g));C.setCurrent(e);V.activateHandlers(l(a,d),o)}c.stopPropagation();c.preventDefault();return!1}}function q(a){return{x:parseInt(a.x*
O),y:parseInt(a.y*R),x2:parseInt(a.x2*O),y2:parseInt(a.y2*R),w:parseInt(a.w*O),h:parseInt(a.h*R)}}function o(){var a=C.getFixed();a.w>x.minSelect[0]&&a.h>x.minSelect[1]?(S.enableHandles(),S.done()):S.release();V.setCursor(x.allowSelect?"crosshair":"default")}function m(a){C.setCurrent(a);S.update()}function p(){var a=e("<div></div>").addClass(x.baseClass+"-tracker");e.browser.msie&&a.css({opacity:0,backgroundColor:"white"});return a}function u(a){t([a[0]/O,a[1]/R,a[2]/O,a[3]/R])}function t(a){C.setPressed([a[0],
a[1]]);C.setCurrent([a[2],a[3]]);S.update()}function y(a){"object"!=typeof a&&(a={});x=e.extend(x,a);"function"!==typeof x.onChange&&(x.onChange=function(){});"function"!==typeof x.onSelect&&(x.onSelect=function(){})}function z(a){x.allowResize?a?S.enableOnly():S.enableHandles():S.disableHandles();V.setCursor(x.allowSelect?"crosshair":"default");S.setCursor(x.allowMove?"move":"default");F.css("backgroundColor",x.bgColor);"setSelect"in x&&(u(g.setSelect),S.done(),delete x.setSelect);"trueSize"in x&&
(O=x.trueSize[0]/B,R=x.trueSize[1]/E);ba=x.maxSize[0]||0;T=x.maxSize[1]||0;$=x.minSize[0]||0;G=x.minSize[1]||0;"outerImage"in x&&(A.attr("src",x.outerImage),delete x.outerImage);S.refresh()}"object"!==typeof a&&(a=e(a)[0]);"object"!==typeof g&&(g={});"trackDocument"in g||(g.trackDocument=e.browser.msie?!1:!0,e.browser.msie&&"8"==e.browser.version.split(".")[0]&&(g.trackDocument=!0));"keySupport"in g||(g.keySupport=e.browser.msie?!1:!0);var x={trackDocument:!1,baseClass:"jcrop",addClass:null,bgColor:"black",
bgOpacity:0.6,borderOpacity:0.4,handleOpacity:0.5,handlePad:5,handleSize:9,handleOffset:5,edgeMargin:14,aspectRatio:0,keySupport:!0,cornerHandles:!0,sideHandles:!0,drawBorders:!0,dragEdges:!0,boxWidth:0,boxHeight:0,boundary:8,animationDelay:20,swingSpeed:3,allowSelect:!0,allowMove:!0,allowResize:!0,minSelect:[0,0],maxSize:[0,0],minSize:[0,0],onChange:function(){},onSelect:function(){}};y(g);var v=e(a),A=v.clone().removeAttr("id").css({position:"absolute"});A.width(v.width());A.height(v.height());
v.after(A).hide();(function(a,b,c){var d=a.width(),f=a.height();if(d>b&&b>0){d=b;f=b/a.width()*a.height()}if(f>c&&c>0){f=c;d=c/a.height()*a.width()}O=a.width()/d;R=a.height()/f;a.width(d).height(f)})(A,x.boxWidth,x.boxHeight);var B=A.width(),E=A.height(),F=e("<div />").width(B).height(E).addClass(x.baseClass+"-holder").css({position:"relative",backgroundColor:x.bgColor}).insertAfter(v).append(A);x.addClass&&F.addClass(x.addClass);var J=e("<img />").attr("src",A.attr("src")).css("position","absolute").width(B).height(E),
I=e("<div />").width("100%").height("100%").css({zIndex:310,position:"absolute",overflow:"hidden"}).append(J),N=e("<div />").width("100%").height("100%").css("zIndex",320),D=e("<div />").css({position:"absolute",zIndex:300}).insertBefore(A).append(I,N),Z=x.boundary,ca=p().width(B+2*Z).height(E+2*Z).css({position:"absolute",top:c(-Z),left:c(-Z),zIndex:290}).mousedown(function(a){if(x.disabled||!x.allowSelect)return false;Q=true;W=b(A);S.disableHandles();if("crosshair"!=K){V.setCursor("crosshair");
K="crosshair"}var c=j(a);C.setPressed(c);V.activateHandlers(m,o);fa.watchKeys();S.update();a.stopPropagation();a.preventDefault();return false}),ba,T,$,G,O,R,W=b(A),Q,K,P,ea,C=function(){function a(){if(!x.aspectRatio){var b=k-f,e=g-j;ba&&Math.abs(b)>ba&&(k=b>0?f+ba:f-ba);T&&Math.abs(e)>T&&(g=e>0?j+T:j-T);G&&Math.abs(e)<G&&(g=e>0?j+G:j-G);$&&Math.abs(b)<$&&(k=b>0?f+$:f-$);if(f<0){k=k-f;f=f-f}if(j<0){g=g-j;j=j-j}if(k<0){f=f-k;k=k-k}if(g<0){j=j-g;g=g-g}if(k>B){b=k-B;f=f-b;k=k-b}if(g>E){b=g-E;j=j-b;
g=g-b}if(f>B){b=f-E;g=g-b;j=j-b}if(j>E){b=j-E;g=g-b;j=j-b}return d(c(f,j,k,g))}var b=x.aspectRatio,e=x.minSize[0]/O,l=x.maxSize[0]/O,q=k-f,p=g-j,o=Math.abs(q),m=Math.abs(p);l==0&&(l=B*10);if(o/m<b){o=g;w=m*b;m=q<0?f-w:w+f;if(m<0){m=0;h=Math.abs((m-f)/b);o=p<0?j-h:h+j}else if(m>B){m=B;h=Math.abs((m-f)/b);o=p<0?j-h:h+j}}else{m=k;h=o/b;o=p<0?j-h:j+h;if(o<0){o=0;w=Math.abs((o-j)*b);m=q<0?f-w:w+f}else if(o>E){o=E;w=Math.abs(o-j)*b;m=q<0?f-w:w+f}}if(m>f){m-f<e?m=f+e:m-f>l&&(m=f+l);o=o>j?j+(m-f)/b:j-(m-
f)/b}else if(m<f){f-m<e?m=f-e:f-m>l&&(m=f-l);o=o>j?j+(f-m)/b:j-(f-m)/b}if(m<0){f=f-m;m=0}else if(m>B){f=f-(m-B);m=B}if(o<0){j=j-o;o=0}else if(o>E){j=j-(o-E);o=E}return last=d(c(f,j,m,o))}function b(a){a[0]<0&&(a[0]=0);a[1]<0&&(a[1]=0);a[0]>B&&(a[0]=B);a[1]>E&&(a[1]=E);return[a[0],a[1]]}function c(a,b,d,f){var j=a,k=d,g=b,e=f;if(d<a){j=d;k=a}if(f<b){g=f;e=b}return[Math.round(j),Math.round(g),Math.round(k),Math.round(e)]}function d(a){return{x:a[0],y:a[1],x2:a[2],y2:a[3],w:a[2]-a[0],h:a[3]-a[1]}}var f=
0,j=0,k=0,g=0,e,l;return{flipCoords:c,setPressed:function(a){a=b(a);k=f=a[0];g=j=a[1]},setCurrent:function(a){a=b(a);e=a[0]-k;l=a[1]-g;k=a[0];g=a[1]},getOffset:function(){return[e,l]},moveOffset:function(a){var b=a[0],a=a[1];0>f+b&&(b=b-(b+f));0>j+a&&(a=a-(a+j));E<g+a&&(a=a+(E-(g+a)));B<k+b&&(b=b+(B-(k+b)));f=f+b;k=k+b;j=j+a;g=g+a},getCorner:function(b){var c=a();switch(b){case "ne":return[c.x2,c.y];case "nw":return[c.x,c.y];case "se":return[c.x2,c.y2];case "sw":return[c.x,c.y2]}},getFixed:a}}(),
S=function(){function a(b){b=e("<div />").css({position:"absolute",opacity:x.borderOpacity}).addClass(x.baseClass+"-"+b);I.append(b);return b}function b(a,c){var f=e("<div />").mousedown(d(a)).css({cursor:a+"-resize",position:"absolute",zIndex:c});N.append(f);return f}function f(a){var d=x.handleSize,j=E,k=d;switch(a){case "n":case "s":d="100%";break;case "e":case "w":k="100%"}return b(a,z++).width(d).height(k).css({top:c(-j+1),left:c(-j+1)})}function j(a){for(i in a)v[a[i]]=b(a[i],z++).css({top:c(-E+
1),left:c(-E+1),opacity:x.handleOpacity}).addClass(x.baseClass+"-handle")}function k(a){var b=Math.round(a.h/2-E),d=Math.round(a.w/2-E);west=-E+1;var f=a.w-E,a=a.h-E;"e"in v&&v.e.css({top:c(b),left:c(f)})&&v.w.css({top:c(b)})&&v.s.css({top:c(a),left:c(d)})&&v.n.css({left:c(d)});"ne"in v&&v.ne.css({left:c(f)})&&v.se.css({top:c(a),left:c(f)})&&v.sw.css({top:c(a)});"b"in v&&v.b.css({top:c(a)})&&v.r.css({left:c(f)})}function g(){var a=C.getFixed();C.setPressed([a.x,a.y]);C.setCurrent([a.x2,a.y2]);l()}
function l(){if(t)return m()}function m(){var a=C.getFixed(),b=a.h;D.width(a.w).height(b);var b=a.x,d=a.y;J.css({top:c(-d),left:c(-b)});D.css({top:c(d),left:c(b)});x.drawBorders&&y.right.css({left:c(a.w-1)})&&y.bottom.css({top:c(a.h-1)});B&&k(a);if(!t){D.show();A.css("opacity",x.bgOpacity);t=true}x.onChange(q(a))}function o(){B=true;if(x.allowResize){k(C.getFixed());N.show();return true}}function u(){B=false;N.hide()}function r(a){(P=a)?u():o()}var t,z=370,y={},v={},B=false,E=x.handleOffset;x.drawBorders&&
(y={top:a("hline").css("top",e.browser.msie?c(-1):c(0)),bottom:a("hline"),left:a("vline"),right:a("vline")});if(x.dragEdges){v.t=f("n");v.b=f("s");v.r=f("e");v.l=f("w")}x.sideHandles&&j(["n","s","e","w"]);x.cornerHandles&&j(["sw","nw","ne","se"]);var F=p().mousedown(d("move")).css({cursor:"move",position:"absolute",zIndex:360});I.append(F);u();return{updateVisible:l,update:m,release:function(){u();D.hide();A.css("opacity",1);t=false},refresh:g,setCursor:function(a){F.css("cursor",a)},enableHandles:o,
enableOnly:function(){B=true},showHandles:function(){if(B){k(C.getFixed());N.show()}},disableHandles:u,animMode:r,done:function(){r(false);g()}}}(),V=function(){function a(b){c(j(b))}function b(k){k.preventDefault();k.stopPropagation();if(Q){Q=false;d(j(k));x.onSelect(q(C.getFixed()));ca.css({zIndex:290});f&&e(document).unbind("mousemove",a).unbind("mouseup",b);c=function(){};d=function(){}}return false}var c=function(){},d=function(){},f=x.trackDocument;f||ca.mousemove(a).mouseup(b).mouseout(b);
A.before(ca);return{activateHandlers:function(j,k){Q=true;c=j;d=k;ca.css({zIndex:450});f&&e(document).mousemove(a).mouseup(b);return false},setCursor:function(a){ca.css("cursor",a)}}}(),fa=function(){function a(b,c,d){if(x.allowMove){C.moveOffset([c,d]);S.updateVisible()}b.preventDefault();b.stopPropagation()}var b=e('<input type="radio" />').css({position:"absolute",left:"-30px"}).keypress(function(b){if(b.ctrlKey)return true;var c=(ea=b.shiftKey?true:false)?10:1;switch(b.keyCode){case 37:a(b,-c,
0);break;case 39:a(b,c,0);break;case 38:a(b,0,-c);break;case 40:a(b,0,c);break;case 27:S.release();break;case 9:return true}return nothing(b)}).blur(function(){b.hide()}),c=e("<div />").css({position:"absolute",overflow:"hidden"}).append(b);x.keySupport&&c.insertBefore(A);return{watchKeys:function(){if(x.keySupport){b.show();b.focus()}}}}();N.hide();z(!0);Z={animateTo:function(a){var b=a[0]/O,c=a[1]/R,d=a[2]/O,f=a[3]/R;if(!P){var a=C.flipCoords(b,c,d,f),b=C.getFixed(),j=initcr=[b.x,b.y,b.x2,b.y2],
k=x.animationDelay,g=j[0],e=j[1],d=j[2],f=j[3],l=a[0]-initcr[0],q=a[1]-initcr[1],m=a[2]-initcr[2],o=a[3]-initcr[3],p=0,u=x.swingSpeed;S.animMode(true);var r=function(){return function(){p=p+(100-p)/u;j[0]=g+p/100*l;j[1]=e+p/100*q;j[2]=d+p/100*m;j[3]=f+p/100*o;p<100?window.setTimeout(r,k):S.done();p>=99.8&&(p=100);t(j)}}();window.setTimeout(r,k)}},setSelect:u,setOptions:function(a){y(a);z()},tellSelect:function(){return q(C.getFixed())},tellScaled:function(){return C.getFixed()},disable:function(){x.disabled=
true;S.disableHandles();S.setCursor("default");V.setCursor("default")},enable:function(){x.disabled=false;z()},cancel:function(){S.done();V.activateHandlers(null,null)},focus:fa.watchKeys,getBounds:function(){return[B*O,E*R]},getWidgetSize:function(){return[B,E]},release:S.release,destroy:function(){F.remove();v.show()}};v.data("Jcrop",Z);return Z};e.fn.Jcrop=function(a){function g(c){var b=a.useImg||c.src,j=new Image;j.onload=function(){e.Jcrop(c,a)};j.src=b}"object"!==typeof a&&(a={});this.each(function(){if(e(this).data("Jcrop")){if("api"==
a)return e(this).data("Jcrop");e(this).data("Jcrop").setOptions(a)}else g(this)});return this}})(m)});define("image/vendor/mousewheel/mousewheel",["jquery"],function(m){(function(e){function a(a){var c=a||window.event,g=[].slice.call(arguments,1),f=0,k=0,d=0,a=e.event.fix(c);a.type="mousewheel";c.wheelDelta&&(f=c.wheelDelta/120);c.detail&&(f=-c.detail/3);d=f;void 0!==c.axis&&c.axis===c.HORIZONTAL_AXIS&&(d=0,k=-1*f);void 0!==c.wheelDeltaY&&(d=c.wheelDeltaY/120);void 0!==c.wheelDeltaX&&(k=-1*c.wheelDeltaX/
120);g.unshift(a,f,k,d);return(e.event.dispatch||e.event.handle).apply(this,g)}var g=["DOMMouseScroll","mousewheel"];if(e.event.fixHooks)for(var c=g.length;c;)e.event.fixHooks[g[--c]]=e.event.mouseHooks;e.event.special.mousewheel={setup:function(){if(this.addEventListener)for(var b=g.length;b;)this.addEventListener(g[--b],a,!1);else this.onmousewheel=a},teardown:function(){if(this.removeEventListener)for(var b=g.length;b;)this.removeEventListener(g[--b],a,!1);else this.onmousewheel=null}};e.fn.extend({mousewheel:function(a){return a?
this.bind("mousewheel",a):this.trigger("mousewheel")},unmousewheel:function(a){return this.unbind("mousewheel",a)}})})(m)});define("image/image-plugin","jquery aloha/plugin image/image-floatingMenu i18n!aloha/nls/i18n i18n!image/nls/i18n jqueryui image/vendor/jcrop/jquery.jcrop.min image/vendor/mousewheel/mousewheel".split(" "),function(m,e,a,g,c){var b=m,j=window.GENTICS,l=window.Aloha;String.prototype.toInteger=String.prototype.toInteger||function(){return parseInt((""+this).replace(/px$/,"")||
0,10)};String.prototype.toFloat=String.prototype.toInteger||function(){return parseFloat((""+this).replace(/px$/,"")||0,10)};Number.prototype.toInteger=Number.prototype.toInteger||String.prototype.toInteger;Number.prototype.toFloat=Number.prototype.toFloat||String.prototype.toFloat;m.extend(true,m.fn,{increase:m.fn.increase||function(a){var b=m(this),c,j;if(!b.length)return b;c=b.css(a).toFloat();j=Math.round((c||1)*1.2);c===j&&j++;b.css(a,j);return b},decrease:m.fn.decrease||function(a){var b=m(this),
c,j;if(!b.length)return b;c=b.css(a).toFloat();j=Math.round((c||0)*0.8);c===j&&j>0&&j--;b.css(a,j);return b}});return e.create("image",{defaultSettings:{maxWidth:1600,minWidth:3,maxHeight:1200,minHeight:3,autoCorrectManualInput:true,fixedAspectRatio:false,autoResize:false,ui:{meta:true,crop:true,resizable:true},handles:"ne, se, sw, nw",onCropped:function(a,b){l.Log.info("Default onCropped invoked",a,b)},onReset:function(a){l.Log.info("Default onReset invoked",a);return false},onResize:function(a){l.Log.info("Default onResize invoked",
a)},onResized:function(a){l.Log.info("Default onResized invoked",a)}},_onCropped:function(a,c){b("#"+this.ui.imgResizeHeightField.getInputId()).val(a.height());b("#"+this.ui.imgResizeWidthField.getInputId()).val(a.width());b("body").trigger("aloha-image-cropped",[a,c]);this.onCropped(a,c)},_onReset:function(a){b("#"+this.ui.imgResizeHeightField.getInputId()).val(a.height());b("#"+this.ui.imgResizeWidthField.getInputId()).val(a.width());b("body").trigger("aloha-image-reset",a);return this.onReset(a)},
_onResize:function(a){b("#"+this.ui.imgResizeHeightField.getInputId()).val(a.height());b("#"+this.ui.imgResizeWidthField.getInputId()).val(a.width());b("body").trigger("aloha-image-resize",a);this.onResize(a)},_onResized:function(a){b("#"+this.ui.imgResizeHeightField.getInputId()).val(a.height());b("#"+this.ui.imgResizeWidthField.getInputId()).val(a.width());b("body").trigger("aloha-image-resized",a);this.onResized(a)},imageObj:null,jcAPI:null,keepAspectRatio:false,startAspectRatio:false,restoreProps:[],
objectTypeFilter:[],init:function(){l.getPluginUrl("image");if(typeof this.settings.objectTypeFilter!="undefined")this.objectTypeFilter=this.settings.objectTypeFilter;this.startAspectRatio=this.settings.fixedAspectRatio;this.config=this.defaultSettings;this.settings=m.extend(true,this.defaultSettings,this.settings);this.initializeUI();this.bindInteractions();this.subscribeEvents()},initializeUI:function(){this.ui=new a;this.ui.init(this)},bindInteractions:function(){var a=this;if(a.settings.ui.resizable)try{document.execCommand("enableObjectResizing",
false,false)}catch(b){l.Log.info(b,"Could not disable enableObjectResizing")}if(a.settings.ui.meta){a.ui.imgSrcField.addListener("keyup",function(){a.srcChange()});a.ui.imgSrcField.addListener("blur",function(){var b=m(a.ui.imgSrcField.getTargetObject());b.attr("src")===""&&b.remove()})}if(a.settings.onCropped&&typeof a.settings.onCropped==="function")a.onCropped=a.settings.onCropped;if(a.settings.onReset&&typeof a.settings.onReset==="function")a.onReset=a.settings.onReset;if(a.settings.onResized&&
typeof a.settings.onResized==="function")a.onResized=a.settings.onResized;if(a.settings.onResize&&typeof a.settings.onResize==="function")a.onResize=this.settings.onResize},subscribeEvents:function(){var a=this,b=this.settings;m("img").filter(b.globalselector).unbind();m("img").filter(b.globalselector).click(function(b){a.clickImage(b)});l.bind("aloha-drop-files-in-editable",function(b,c){for(var k,g=c.filesObjs.length,e;--g>=0;){e=c.filesObjs[g];if(e.file.type.match(/image\//)){a.getEditableConfig(c.editable);
k=m("<img/>");k.css({"max-width":that.maxWidth,"max-height":that.maxHeight});k.attr("id",e.id);typeof e.src==="undefined"?k.attr("src",e.data):k.attr("src",e.src);j.Utils.Dom.insertIntoDOM(k,c.range,m(l.activeEditable.obj))}}});l.bind("aloha-selection-changed",function(b,c,j){if(j&&j.target&&a.settings.ui.resizable&&!m(j.target).hasClass("ui-resizable-handle")){a.endResize();a.imageObj=null;l.trigger("aloha-image-unselected")}if(l.activeEditable!==null){c=a.findImgMarkup(c);b=a.getEditableConfig(l.activeEditable.obj);
if(typeof b!=="undefined"){a.ui._insertImageButton.show();if(c){a.ui._insertImageButton.show();a.ui.setScope();if(a.settings.ui.meta){a.ui.imgSrcField.setTargetObject(c,"src");a.ui.imgTitleField.setTargetObject(c,"title")}a.ui.imgSrcField.foreground();a.ui.imgSrcField.focus()}else a.settings.ui.meta&&a.ui.imgSrcField.setTargetObject(null);a.ui.doLayout()}else a.ui._insertImageButton.hide()}});l.bind("aloha-editable-created",function(b,c){try{document.execCommand("enableObjectResizing",false,false)}catch(j){l.Log.info(j,
"Could not disable enableObjectResizing")}c.obj.delegate("img","mouseup",function(b){a.clickImage(b);b.stopPropagation()})});a._subscribeToResizeFieldEvents()},autoResize:function(){var a=this.imageObj.width(),b=this.imageObj.height(),c=false;if(a<this.settings.minWidth||a>this.settings.maxWidth||b<this.settings.minHeight||b>this.settings.maxHeight)c=true;if(c&&a>=b){this._setNormalizedFieldValues("width");this.setSizeByFieldValue();return true}if(c&&a<b){this._setNormalizedFieldValues("height");
this.setSizeByFieldValue();return true}return false},toggleKeepAspectRatio:function(){this.keepAspectRatio=!this.keepAspectRatio;this.endResize();this.startAspectRatio=this.keepAspectRatio?typeof this.settings.fixedAspectRatio!=="number"?this.imageObj.width()/this.imageObj.height():this.settings.fixedAspectRatio:false;this.startResize()},_subscribeToResizeFieldEvents:function(){function a(b,c,d,f){typeof f==="undefined"&&(f=0);typeof d==="undefined"&&(d=8E3);var k=parseInt(b.val(),10);if(isNaN(k)){b.css("background-color",
"red");return false}var g=k+c;if(c>=0&&g>d){if(j.settings.autoCorrectManualInput){b.val(d);return true}b.css("background-color","red");return false}if(c<=0&&g<f){if(j.settings.autoCorrectManualInput){b.val(f);return true}b.css("background-color","red");return false}b.css("background-color","");b.val(k+c);return true}function c(d){var k=d.data.minValue,g=d.data.maxValue,e=d.data.fieldName;if(d.keyCode===8||d.keyCode===46){if(b(this).val()>=k)if(typeof j.jcAPI!=="undefined"&&j.jcAPI!==null)j.setCropAreaByFieldValue();
else{j._setNormalizedFieldValues(e);j.setSizeByFieldValue()}}else if(d.keyCode<=57&&d.keyCode>=48||d.keyCode<=105&&d.keyCode>=96){if(b(this).val()>=k)if(typeof j.jcAPI!=="undefined"&&j.jcAPI!==null)j.setCropAreaByFieldValue();else{j._setNormalizedFieldValues(e);j.setSizeByFieldValue()}}else{var l=0;if(d.keyCode===38||d.keyCode===107)l=1;else if(d.keyCode===40||d.keyCode===109)l=-1;if(d.shiftKey||d.metaKey||d.ctrlKey)l=l*10;if(a(b(this),l,g,k))if(typeof j.jcAPI!=="undefined"&&j.jcAPI!==null)j.setCropAreaByFieldValue();
else{j._setNormalizedFieldValues(e);j.setSizeByFieldValue()}}d.preventDefault();return false}function d(c,d){var k=c.data.minValue,g=c.data.maxValue,e=c.data.fieldName;if(c.shiftKey||c.metaKey||c.ctrlKey)d=d*10;if(a(b(this),d,g,k))if(typeof j.jcAPI!=="undefined"&&j.jcAPI!==null)j.setCropAreaByFieldValue();else{j._setNormalizedFieldValues(e);j.setSizeByFieldValue()}return false}var j=this,g=b("#"+j.ui.imgResizeHeightField.getInputId()),e={fieldName:"height",maxValue:j.ui.imgResizeHeightField.maxValue,
minValue:j.ui.imgResizeHeightField.minValue};g.live("keyup",e,c);g.live("mousewheel",e,d);g=b("#"+j.ui.imgResizeWidthField.getInputId());e={fieldName:"width",maxValue:j.ui.imgResizeWidthField.maxValue,minValue:j.ui.imgResizeWidthField.minValue};g.live("keyup",e,c);g.live("mousewheel",e,d)},_setNormalizedFieldValues:function(a){var b=m("#"+this.ui.imgResizeWidthField.getInputId()),c=m("#"+this.ui.imgResizeHeightField.getInputId()),j=b.val(),g=c.val(),a=this._normalizeSize(j,g,a);b.val(a.width);c.val(a.height)},
setSize:function(a,b){this.imageObj.width(a);this.imageObj.height(b);var c=this.imageObj.closest(".Aloha_Image_Resize");c.height(b);c.width(a);this._onResize(this.imageObj);this._onResized(this.imageObj)},clickImage:function(a){this.endResize();var c=this.imageObj=m(a.target);if(!c.hasClass("aloha-ui")){this.ui.setScope();c.closest(".aloha-editable");this.restoreProps.push({obj:a.srcElement,src:this.imageObj.attr("src"),width:this.imageObj.width(),height:this.imageObj.height()});b("#"+this.ui.imgResizeHeightField.getInputId()).val(this.imageObj.height());
b("#"+this.ui.imgResizeWidthField.getInputId()).val(this.imageObj.width());if(this.settings.ui.meta){this.ui.imgSrcField.setTargetObject(this.imageObj,"src");this.ui.imgTitleField.setTargetObject(this.imageObj,"title")}l.Selection.preventSelectionChanged();try{this.ui.imgSrcField.focus()}catch(d){}this.settings.ui.resizable&&this.startResize();this.settings.autoResize&&this.autoResize();l.Selection.preventSelectionChangedFlag=false;l.trigger("aloha-image-selected")}},findImgMarkup:function(a){var b,
c;typeof a==="undefined"&&(a=l.Selection.getRangeObject());c=m(a.startContainer);try{if(l.activeEditable&&(typeof a.startContainer!=="undefined"&&typeof a.startContainer.childNodes!=="undefined"&&typeof a.startOffset!=="undefined"&&typeof a.startContainer.childNodes[a.startOffset]!=="undefined"&&a.startContainer.childNodes[a.startOffset].nodeName.toLowerCase()==="img"&&a.startOffset+1===a.endOffset||c.hasClass("Aloha_Image_Resize"))){b=c.find("img")[0];if(!b.css)b.css="";if(!b.title)b.title="";if(!b.src)b.src=
"";return b}}catch(j){l.Log.debug(j,"Error finding img markup.")}return null},getPluginFocus:function(){return this.imageObj},_normalizeSize:function(a,c,d){function j(d){if(c>e.settings.maxHeight){var q={org:c,"new":e.settings.maxHeight};b("body").trigger("aloha-image-resize-outofbounds",["height","max",q]);c=e.settings.maxHeight}else if(c<e.settings.minHeight){q={org:c,"new":e.settings.minHeight};b("body").trigger("aloha-image-resize-outofbounds",["height","min",q]);c=e.settings.minHeight}if(e.keepAspectRatio){a=
c*l;d&&g(false)}}function g(d){if(a>e.settings.maxWidth){var m={org:a,"new":e.settings.maxWidth};b("body").trigger("aloha-image-resize-outofbounds",["width","max",m]);a=e.settings.maxWidth}else if(a<e.settings.minWidth){m={org:a,"new":e.settings.minWidth};b("body").trigger("aloha-image-resize-outofbounds",["width","min",m]);a=e.settings.minWidth}if(e.keepAspectRatio){c=a/l;d&&j(false)}}var e=this,a=parseInt(a),c=parseInt(c),l=1.33333;e.keepAspectRatio&&(l=a/c);if(typeof e.startAspectRatio==="number")l=
e.startAspectRatio;d=="width"&&g(true);d=="height"&&j(true);return{width:Math.floor(a),height:Math.floor(c)}},setSizeByFieldValue:function(){var a=b("#"+this.ui.imgResizeWidthField.getInputId()).val(),c=b("#"+this.ui.imgResizeHeightField.getInputId()).val();this.setSize(a,c)},setCropAreaByFieldValue:function(){var a=this.jcAPI.tellSelect(),c=b("#"+this.ui.imgResizeWidthField.getInputId()).val(),c=parseInt(c,10),d=b("#"+this.ui.imgResizeHeightField.getInputId()).val(),d=parseInt(d,10);this.jcAPI.setSelect([a.x,
a.y,a.x+c,a.y+d])},insertImg:function(){var a=l.Selection.getRangeObject(),b=this.getEditableConfig(l.activeEditable.obj),c=l.getPluginUrl("image");if(a.isCollapsed()){b="max-width: "+b.maxWidth+"; max-height: "+b.maxHeight;c=m('<img style="'+b+'" src="'+c+'/img/blank.jpg" title="" />');j.Utils.Dom.insertIntoDOM(c,a,m(l.activeEditable.obj))}else l.Log.error("img cannot markup a selection")},srcChange:function(){this.imageObj.attr("src",this.ui.imgSrcField.getValue())},positionCropButtons:function(){var a=
m(".jcrop-tracker:first"),b=a.offset(),c=b.top,b=b.left,j=a.height(),a=a.width(),g=m("#aloha-CropNResize-btns");c===0&&b===0&&g.hide();c=parseInt(c+j+3,10);b=parseInt(b+a/2-g.width()/2+10,10);(0!=b||0!=c)&&g.offset({top:c,left:b})},initCropButtons:function(){var a=this,b;m("body").append('<div id="aloha-CropNResize-btns" display="none"><button class="cnr-crop-apply" title="'+c.t("Accept")+'"></button><button class="cnr-crop-cancel" title="'+c.t("Cancel")+'"></button></div>');b=m("#aloha-CropNResize-btns");
b.find(".cnr-crop-apply").click(function(){a.acceptCrop()});b.find(".cnr-crop-cancel").click(function(){a.endCrop()});this.interval=setInterval(function(){a.positionCropButtons()},10)},destroyCropButtons:function(){m("#aloha-CropNResize-btns").remove();clearInterval(this.interval)},_disableSelection:function(a){a.find("*").attr("unselectable","on").css({"-moz-user-select":"none","-webkit-user-select":"none","user-select":"none"})},crop:function(){var a=this;a.initCropButtons();a.settings.ui.resizable&&
a.endResize();a.jcAPI=m.Jcrop(a.imageObj,{onSelect:function(){a._onCropSelect();window.setTimeout(function(){a.ui.setScope()},10)}});a._disableSelection(b(".jcrop-holder"));a._disableSelection(b("#imageContainer"));a._disableSelection(b("#aloha-CropNResize-btns"));b("body").trigger("aloha-image-crop-start",[a.imageObj])},_onCropSelect:function(){m("#aloha-CropNResize-btns").fadeIn("slow");m(".jcrop-handle").mousedown(function(){m("#aloha-CropNResize-btns").hide()});m(".jcrop-tracker").mousedown(function(){m("#aloha-CropNResize-btns").hide()});
if(typeof this.jcAPI!=="undefined"&&this.jcAPI!==null){this.positionCropButtons();var a=this.jcAPI.tellSelect();m("#"+this.ui.imgResizeWidthField.getInputId()).val(a.w);m("#"+this.ui.imgResizeHeightField.getInputId()).val(a.h)}},endCrop:function(){if(this.jcAPI){this.jcAPI.destroy();this.jcAPI=null}this.destroyCropButtons();this.ui._imageCropButton.setState(false);this.settings.ui.resizable&&this.startResize();if(this.keepAspectRatio)this.startAspectRatio=this.imageObj.width()/this.imageObj.height();
b("body").trigger("aloha-image-crop-stop",[this.imageObj])},acceptCrop:function(){this._onCropped(this.imageObj,this.jcAPI.tellSelect());this.endCrop()},startResize:function(){var a=this,b=this.imageObj,b=this.imageObj.css({height:this.imageObj.height(),width:this.imageObj.width(),position:"relative","max-height":"","max-width":""});b.resizable({maxHeight:a.settings.maxHeight,minHeight:a.settings.minHeight,maxWidth:a.settings.maxWidth,minWidth:a.settings.minWidth,aspectRatio:a.startAspectRatio,handles:a.settings.handles,
grid:a.settings.grid,resize:function(){a._onResize(a.imageObj)},stop:function(b){a._onResized(a.imageObj);this.enableCrop&&window.setTimeout(function(){a.ui.setScope();that.done(b)},10)}});b.css("display","inline-block");m(".ui-wrapper").attr("contentEditable",false).addClass("aloha-image-box-active Aloha_Image_Resize aloha").css({position:"relative",display:"inline-block","float":a.imageObj.css("float")}).bind("resizestart",function(a){a.preventDefault()}).bind("mouseup",function(a){a.originalEvent.stopSelectionUpdate=
true})},endResize:function(){this.imageObj&&this.imageObj.closest(".aloha-editable");this.imageObj&&this.imageObj.is(":ui-resizable")&&this.imageObj.resizable("destroy").css({top:0,left:0})},resetSize:function(){var a=this,b=new Image;b.onload=function(){var c=a.getPluginFocus();a.settings.ui.resizable&&a.endResize();m(c).add(c.parent()).css({width:b.width+"px",height:b.height+"px","max-width":"","max-height":""});a.settings.ui.resizable&&a.resize()};b.src=a.getPluginFocus().attr("src")},reset:function(){this.settings.ui.crop&&
this.endCrop();this.settings.ui.resizable&&this.endResize();if(!this._onReset(this.imageObj))for(var a=0;a<this.restoreProps.length;a++)if(this.imageObj.get(0)===this.restoreProps[a].obj){this.imageObj.attr("src",this.restoreProps[a].src);this.imageObj.width(this.restoreProps[a].width);this.imageObj.height(this.restoreProps[a].height);break}}})});define("highlighteditables/highlighteditables-plugin",["aloha","jquery","aloha/plugin"],function(m,e,a){var g=window.GENTICS;return a.create("highlighteditables",
{config:["highlight"],init:function(){var a=this,b;g.Utils.Position.addMouseMoveCallback(function(){var j,g;for(j=0;j<m.editables.length;j++)g=m.editables[j],b=a.getEditableConfig(g.obj),!m.activeEditable&&(!g.isDisabled()&&"highlight"==b)&&g.obj.addClass("aloha-editable-highlight")});g.Utils.Position.addMouseStopCallback(function(){a.fade()});m.bind("aloha-editable-activated",function(){a.fade()})},fade:function(){var a,b,j=function(){e(this).css("outline","")};for(a=0;a<m.editables.length;a++)b=
m.editables[a].obj,b.hasClass("aloha-editable-highlight")&&b.css("outline",b.css("outlineColor")+" "+b.css("outlineStyle")+" 5px").removeClass("aloha-editable-highlight").animate({outlineWidth:"0px"},300,"swing",j)}})});define("dom-to-xhtml/dom-to-xhtml","jquery util/dom2 util/misc util/browser aloha/ephemera aloha/console".split(" "),function(m,e,a,g,c,b){function j(a,b){var d=e.attrs(a),f="",j,k;if(g.ie7)for(var l in o)if(o.hasOwnProperty(l)&&a[l]){j=0;for(k=d.length;j<k;j++)if(l===d[j][0].toLowerCase()){d.splice(j,
1);break}d.push([l,l])}j=0;for(k=d.length;j<k;j++){var q=d[j];l=q[0].toLowerCase();q=q[1];if(!b||!c.isAttrEphemeral(a,l,b.attrMap||{},b.attrRxs||{})){var m=o[l];if(m||""!==q)f=f+(" "+l+'="'+(m?l:q).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/"/g,"&quot;")+'"')}}return f}function l(a){var b=a.nodeName,c=r[b];if(null!=c)return c;for(var d="/"+a.nodeName,a=a.nextSibling,c=false;null!=a;){if(d==a.nodeName){c=true;break}a=a.nextSibling}return r[b]=c}function f(a,b,c,f,j){for(;null!=b;)if(1===b.nodeType&&
c&&"/"+a.nodeName==b.nodeName){b=b.nextSibling;break}else if(1===b.nodeType&&l(b))b=k(b,b.nextSibling,true,f,j);else{d(b,f,j);b=b.nextSibling}return b}function k(a,b,c,d,g){var k=a.nodeName.toLowerCase();a.scopeName&&("HTML"!=a.scopeName&&-1===k.indexOf(":"))&&(k=a.scopeName.toLowerCase()+":"+k);if(!c&&null==b&&q[k])g.push("<"+k+j(a,d)+"/>");else{g.push("<"+k+j(a,d)+">");b=f(a,b,c,d,g);g.push("</"+k+">")}return b}function d(a,c,d){1===a.nodeType?k(a,a.firstChild,l(a),c,d):3===a.nodeType?d.push(a.nodeValue.replace(/&/g,
"&amp;").replace(/</g,"&lt;")):8===a.nodeType?d.push("<\!--"+a.nodeValue+"--\>"):b.warn("Unknown node type encountered during serialization, ignoring it: type="+a.nodeType+" name="+a.nodeName+" value="+a.nodeValue)}var q={area:true,base:true,basefont:true,br:true,col:true,frame:true,hr:true,img:true,input:true,isindex:true,link:true,meta:true,param:true,embed:true},o={checked:true,compact:true,declare:true,defer:true,disabled:true,ismap:true,multiple:true,nohref:true,noresize:true,noshade:true,nowrap:true,
readonly:true,selected:true},r={DIV:false,SPAN:false,UL:false,OL:false,LI:false,TABLE:false,TR:false,TD:false,TH:false,I:false,B:false,EM:false,STRONG:false,A:false,P:false};return{contentsToXhtml:function(a,b){var c=[];f(a,a.firstChild,false,b,c);return c.join("")},nodeToXhtml:function(a,b){var c=[];d(a,b,c);return c.join("")}}});define("dom-to-xhtml/dom-to-xhtml-plugin",["aloha","jquery","aloha/plugin","aloha/ephemera","dom-to-xhtml/dom-to-xhtml"],function(m,e,a,g,c){return a.create("dom-to-xhtml",
{init:function(){var a=this;m.Editable.setContentSerializer(function(j){return!a.settings.editables&&!a.settings.config?c.contentsToXhtml(j):a.settings.editables&&"dom-to-xhtml"==a.settings.editables["#"+e(j).attr("id")]?c.contentsToXhtml(j,g.ephemera()):a.settings.config&&"dom-to-xhtml"==a.settings.config&&!a.settings.editables["#"+e(j).attr("id")]?c.contentsToXhtml(j,g.ephemera()):e(j).html()})}})});define("contenthandler/contenthandler-utils",["jquery"],function(m){return{wrapContent:function(e){return"string"===
typeof e?m("<div>"+e+"</div>"):e instanceof m?m("<div>").append(e):null},isProppedParagraph:function(e){e=m.trim(e);if(!e)return!1;e=m("<div>"+e+"</div>")[0];return e.firstChild===e.lastChild&&"p"===e.firstChild.nodeName.toLowerCase()?(e=e.firstChild.children)&&1===e.length&&"br"===e[0].nodeName.toLowerCase():!1}}});define("contenthandler/wordcontenthandler",["jquery","aloha","aloha/contenthandlermanager","contenthandler/contenthandler-utils","util/dom"],function(m,e,a,g){function c(a){switch(a[0].nodeName.toLowerCase()){case "table":return 0===
a.find("tbody,tr").length;case "tbody":return 0===a.find("tr").length;case "tr":return 0===a.find("td,th").length;default:return""===m.trim(a.text())}}function b(a){if(0===a.length||!f.test(a[0].outerHTML))return!1;var a=a.find("*"),b,c;for(b=0;b<a.length;b++)if((c=a.eq(b).attr("style"))&&0<=c.toLowerCase().indexOf("mso")||(c=a.eq(b).attr("class"))&&0<=c.toLowerCase().indexOf("mso"))return!0;return!1}function j(a){a.find("p.MsoTitle").each(function(){e.Markup.transformDomObject(m(this),"h1")});a.find("p.MsoSubtitle").each(function(){e.Markup.transformDomObject(m(this),
"h2")})}var l=m,f=/mso/,k=/^#(.*)/;return a.createHandler({handleContent:function(a){var c=g.wrapContent(a);if(!c)return a;b(c)&&this.transformWordContent(c);return c.html()},isOrderedList:function(a){return"Wingdings"==a.css("fontFamily")||"Symbol"==a.css("fontFamily")?!1:a.text().match(/^([0-9]{1,3}\.)|([0-9]{1,3}\)|([a-zA-Z]{1,5}\.)|([a-zA-Z]{1,5}\)))$/)?!0:!1},transformListsFromWord:function(a){var b=this,c,f;f=a.find("p.MsoListParagraphCxSpFirst,p.MsoListParagraphCxSpMiddle,p.MsoListParagraphCxSpLast,p.MsoListParagraph,p span");
f.each(function(){var a=l(this),b=a.css("font-family")||"",c=a.css("mso-list")||"",d=a.attr("style")||"";a.hasClass("MsoListParagraphCxSpFirst")||a.hasClass("MsoListParagraph")?a.addClass("aloha-list-element"):0<=b.indexOf("Symbol")?a.closest("p").addClass("aloha-list-element"):0<=b.indexOf("Wingdings")?a.closest("p").addClass("aloha-list-element"):""!==c?a.closest("p").addClass("aloha-list-element"):0<=d.indexOf("mso-list")&&a.closest("p").addClass("aloha-list-element")});a.find("p span span span").each(function(){var a=
l(this),b;0===l.trim(a.text()).replace(/&nbsp;/g,"").length&&(b=l.trim(a.parent().parent().text()).replace(/&nbsp;/g,""),b.match(/^([0-9]{1,3}\.)|([0-9]{1,3}\))|([a-zA-Z]{1,5}\.)|([a-zA-Z]{1,5}\))|(.)$/)&&(a.closest("p").addClass("aloha-list-element"),a.parent().parent().addClass("aloha-list-bullet")))});f="p.aloha-list-element";c=":not("+f+", font)";f=a.find(f);0<f.length&&f.each(function(){var a=l(this),d,f,j,g,k,e,m,r;a.removeClass("aloha-list-element");a.find("font").each(function(){l(this).contents().unwrap()});
r=[];m=parseFloat(a.css("marginLeft"));isNaN(m)&&(m=0);e=[];k=a.nextUntil(c);g=l(a.find("span.aloha-list-bullet"));0===g.length&&(g=a.find("span").eq(0));j=b.isOrderedList(g);g.remove();f=l(j?"<ol></ol>":"<ul></ul>");e.push(f);d=l("<li></li>");f.append(d);a.contents().appendTo(d);a.replaceWith(f);k.each(function(){var a=l(this),c,k;if(!a.is("font")){a.find("font").each(function(){l(this).contents().unwrap()});c=parseFloat(a.css("marginLeft"));isNaN(c)&&(c=0);g=l(a.find("span.aloha-list-bullet"));
0===g.length&&(g=a.find("span").eq(0));j=b.isOrderedList(g);g.remove();if(c>m)k=l(j?"<ol></ol>":"<ul></ul>"),f.children(":last").append(k),f=k,e.push(f),r.push(c),m=c;else if(c<m&&0<r.length){for(;0<r.length&&r[r.length-1]>c;)r.pop(),e.pop();f=e[e.length-1];m=c}d=l("<li></li>");f.append(d);a.contents().appendTo(d);a.remove()}})})},removeParagraphNumbering:function(a){a=a.find("h1,h2,h3,h4,h5,h6");0<a.length&&a.each(function(){var a=l(this),b=a.find("span"),a=a.find("a");b.each(function(){l.trim(l(this).text()).match(/^([\.\(]?[\d\D][\.\(]?){1,4}$/)&&
l(this).remove()});a.each(function(){"undefined"===typeof l(this).attr("href")&&l(this).contents().unwrap()})})},transformToc:function(a){a.find("[class*=MsoToc]").each(function(){var a=l(this),b=a.find("span"),a=a.find("a");b.each(function(){l(this).attr("style")&&-1<l(this).attr("style").search("mso-hide")&&l(this).remove();l(this).contents().unwrap()});a.each(function(){l(this).contents().unwrap()})})},transformWordContent:function(a){this.transformToc(a);this.removeParagraphNumbering(a);this.transformListsFromWord(a);
j(a);var a=a.find("*"),b,f,g;for(g=0;g<a.length;g++)f=a.eq(g),b=f[0].nodeName.toLowerCase(),"a"===b?(b=f.attr("href"))&&k.test(m.trim(b))&&f.contents().unwrap():"div"===b||"span"===b?f.contents().unwrap():"td"!==b&&c(f)&&f.contents().unwrap()}})});define("contenthandler/genericcontenthandler",["jquery","aloha","aloha/contenthandlermanager","contenthandler/contenthandler-utils","table/table-plugin-utils"],function(m,e,a,g,c){return a.createHandler({handleContent:function(a){var j=g.wrapContent(a);
if(!j)return a;if(j.find(".aloha-block").length)return a.html();c.prepareContent(j);this.cleanLists(j);this.removeComments(j);this.unwrapTags(j);this.removeStyles(j);this.removeNamespacedElements(j);a=!0;e.settings.contentHandler&&(e.settings.contentHandler.handler&&e.settings.contentHandler.handler.generic&&"undefinded"!==typeof e.settings.contentHandler.handler.generic.transformFormattings&&!e.settings.contentHandler.handler.generic.transformFormattings)&&(a=!1);a&&this.transformFormattings(j);
return j.html()},cleanLists:function(a){a.find("ul,ol").find(">:not(li)").remove()},transformFormattings:function(a){a.find("strong,em,s,u,strike").each(function(){"STRONG"===this.nodeName?e.Markup.transformDomObject(m(this),"b"):"EM"===this.nodeName?e.Markup.transformDomObject(m(this),"i"):"S"===this.nodeName||"STRIKE"==this.nodeName?e.Markup.transformDomObject(m(this),"del"):"U"===this.nodeName&&m(this).contents().unwrap()})},transformLinks:function(a){a.find("a").each(function(){"undefined"===
typeof m(this).attr("href")&&m(this).contents().unwrap()})},removeComments:function(a){var c=this;a.contents().each(function(){8===this.nodeType?m(this).remove():c.removeComments(m(this))})},unwrapTags:function(a){a.find("span,font,div").not(".aloha-wai-lang").each(function(){"DIV"==this.nodeName?"<br>"===this.innerHTML?m(this).contents().unwrap():m(e.Markup.transformDomObject(m(this),"p").append("<br>")).contents().unwrap():m(this).contents().unwrap()})},removeStyles:function(a){var c=this;a.children("style").filter(function(){return"false"!==
this.contentEditable}).remove();a.children().filter(function(){return"false"!==this.contentEditable}).each(function(){m(this).removeAttr("style").removeClass();c.removeStyles(m(this))})},removeNamespacedElements:function(a){a.find("*").each(function(){var a=this.prefix?this.prefix:this.scopeName?this.scopeName:void 0;if(a&&"HTML"!==a||0<=this.nodeName.indexOf(":")){var a=m(this),b=a.contents();b.length?b.unwrap():a.remove()}})}})});za.REGEX_PROTOCOL=/^([A-Za-z0-9\+\-\.\&\;\*\s]*?)(?:\:|&*0*58|&*x0*3a)/i;
za.RELATIVE="__relative__";za.prototype.clean_node=function(m){function e(a,c){var g;for(g=0;g<c.length;g++)if(c[g]==a)return g;return-1}function a(){var a=[],c={},g,f;for(g=0;g<arguments.length;g++)if(arguments[g]&&arguments[g].length)for(f=0;f<arguments[g].length;f++)c[arguments[g][f]]||(c[arguments[g][f]]=!0,a.push(arguments[g][f]));return a}function g(b){for(var c,l=0;l<this.filters.length;l++)if(!this.filters[l](b)){c=b.cloneNode(!0);this.current_element.appendChild(c);return}switch(b.nodeType){case 1:var f,
k,d,q,m,r,p;f=[];l=b;q=!1;for(k=0;k<this.transformers.length;k++)if(d=this.transformers[k]({allowed_elements:this.allowed_elements,config:this.config,node:b,node_name:b.nodeName.toLowerCase(),whitelist_nodes:this.whitelist_nodes,dom:this.dom}),null!=d)if("object"==typeof d){if(d.whitelist_nodes&&d.whitelist_nodes instanceof Array)for(q=0;q<d.whitelist_nodes.length;q++)-1==e(d.whitelist_nodes[q],this.whitelist_nodes)&&this.whitelist_nodes.push(d.whitelist_nodes[q]);q=d.whitelist?!0:!1;d.attr_whitelist&&
(f=a(f,d.attr_whitelist));l=d.node?d.node:l}else throw Error("transformer output must be an object or null");b=this.jQuery;b=b.browser.msie&&"7.0"===b.browser.version;d=l.nodeName.toLowerCase();k=this.current_element;if(this.allowed_elements[d]||q){this.current_element=this.dom.createElement(l.nodeName);k.appendChild(this.current_element);q=a(this.config.attributes[d],this.config.attributes.__ALL__,f);for(f=0;f<q.length;f++)if(c=q[f],m=l.attributes[c])if(r=!0,this.config.protocols[d]&&this.config.protocols[d][c]&&
(r=this.config.protocols[d][c],r=(p=m.nodeValue.toLowerCase().match(za.REGEX_PROTOCOL))?-1!=e(p[1],r):-1!=e(za.RELATIVE,r)),r&&(!b||b&&"style"!==c))r=document.createAttribute(c),r.value=m.nodeValue,this.current_element.setAttributeNode(r);if(this.config.add_attributes[d])for(c in this.config.add_attributes[d])if(!b||b&&"style"!==c)r=document.createAttribute(c),r.value=this.config.add_attributes[d][c],this.current_element.setAttributeNode(r)}else if(-1!=e(l,this.whitelist_nodes)){for(this.current_element=
l.cloneNode(!0);0<this.current_element.childNodes.length;)this.current_element.removeChild(this.current_element.firstChild);k.appendChild(this.current_element)}if(!this.config.remove_all_contents&&!this.config.remove_element_contents[d])for(f=0;f<l.childNodes.length;f++)g.call(this,l.childNodes[f]);this.current_element.normalize&&this.current_element.normalize();this.current_element=k;break;case 3:c=b.cloneNode(!1);this.current_element.appendChild(c);break;case 5:c=b.cloneNode(!1);this.current_element.appendChild(c);
break;case 8:this.config.allow_comments&&(c=b.cloneNode(!1),this.current_element.appendChild(c))}}var c=this.dom.createDocumentFragment();this.current_element=c;this.whitelist_nodes=[];for(i=0;i<m.childNodes.length;i++)g.call(this,m.childNodes[i]);c.normalize&&c.normalize();return c};define("vendor/sanitize",function(){});define("contenthandler/sanitizecontenthandler","aloha/core jquery aloha/contenthandlermanager aloha/plugin aloha/console vendor/sanitize".split(" "),function(m,e,a){function g(a){var j=
["restricted","basic","relaxed"],g=m.defaults.supports,g=m.settings.contentHandler.sanitize&&e.inArray(m.settings.contentHandler.sanitize,j)>-1?m.defaults.sanitize[m.settings.contentHandler.sanitize]:m.defaults.sanitize.relaxed;if(m.settings.contentHandler.allows)g=m.settings.contentHandler.allows;a&&(g=a);g.filters=[function(a){return a.contentEditable!="false"}];c=new za(g,e)}var c;if(!m.defaults.sanitize)m.defaults.sanitize={};m.defaults.sanitize.restricted={elements:["b","em","i","strong","u",
"del","p","span","div","br"]};m.defaults.sanitize.basic={elements:["a","abbr","b","blockquote","br","cite","code","dd","del","dl","dt","em","i","li","ol","p","pre","q","small","strike","strong","sub","sup","u","ul"],attributes:{a:["href"],blockquote:["cite"],q:["cite"],abbr:["title"]},protocols:{a:{href:["ftp","http","https","mailto","__relative__"]},blockquote:{cite:["http","https","__relative__"]},q:{cite:["http","https","__relative__"]}}};m.defaults.sanitize.relaxed={elements:["a","abbr","b","blockquote",
"br","caption","cite","code","col","colgroup","dd","del","dl","dt","em","h1","h2","h3","h4","h5","h6","i","img","li","ol","p","pre","q","small","strike","strong","sub","sup","table","tbody","td","tfoot","th","thead","tr","u","ul","span","hr","object","div"],attributes:{a:["href","title","id","class","target","data-gentics-aloha-repository","data-gentics-aloha-object-id"],div:["id","class","style"],abbr:["title"],blockquote:["cite"],br:["class"],col:["span","width"],colgroup:["span","width"],img:["align",
"alt","height","src","title","width","class","data-caption","data-align","data-width","data-original-image"],ol:["start","type"],p:["class","style","id"],q:["cite"],table:["summary","width"],td:["abbr","axis","colspan","rowspan","width"],th:["abbr","axis","colspan","rowspan","scope","width"],ul:["type"],span:["class","style","lang","xml:lang","role"]},protocols:{a:{href:["ftp","http","https","mailto","__relative__"]},blockquote:{cite:["http","https","__relative__"]},img:{src:["http","https","__relative__"]},
q:{cite:["http","https","__relative__"]}}};return a.createHandler({handleContent:function(a){var j,l;if(m.activeEditable&&m.settings.contentHandler&&m.settings.contentHandler.handler&&m.settings.contentHandler.handler.sanitize){if(m.settings.contentHandler.handler.sanitize)l=m.settings.contentHandler.handler.sanitize;if(typeof l["#"+m.activeEditable.getId()]!=="undefined")j=l;else for(var f=m.activeEditable.obj.attr("class").split(" "),k=0;k<f.length;k++)typeof l["."+f[k]]!=="undefined"&&(j=l["."+
f[k]])}(typeof c==="undefined"||typeof j!=="undefined")&&g(j);typeof a==="string"?a=e("<div>"+a+"</div>").get(0):a instanceof e&&(a=e("<div>").append(a).get(0));return e("<div>").append(c.clean_node(a)).html()}})});define("contenthandler/blockelementcontenthandler",["aloha","jquery","aloha/contenthandlermanager"],function(m,e,a){var g={h1:!0,h2:!0,h3:!0,h4:!0,h5:!0,h6:!0,p:!0,pre:!0,blockquote:!0,H1:!0,H2:!0,H3:!0,H4:!0,H5:!0,H6:!0,P:!0,PRE:!0,BLOCKQUOTE:!0},c={br:!0,BR:!0},b=function(a,j){var d=
e(j);d.filter("h1:empty,h2:empty,h3:empty,h4:empty,h5:empty,h6:empty,p:empty,pre:empty,blockquote:empty").remove();e.browser.msie?d.filter("br.aloha-end-br").remove():d.filter("li").each(function(){g[this.nodeName]&&(!this.lastChild||!c[this.lastChild.nodeName])&&e(this).append("<br/>")});d.children(":not(.aloha-block)").each(b)},j=function(a,b){var c=e(b);c.filter("h1:empty,h2:empty,h3:empty,h4:empty,h5:empty,h6:empty,p:empty,pre:empty,blockquote:empty").append("​");c.children(":not(.aloha-block)").each(j)},
l=function(a,b){var d=e(b);0<d.filter("p,h1,h2,h3,h4,h5,h6,pre,blockquote").length&&g[b.nodeName]&&(!b.lastChild||!c[b.lastChild.nodeName])&&e(b).append("<br/>");d.children(":not(.aloha-block)").each(l)};return a.createHandler({handleContent:function(a,c){"string"===typeof a?a=e("<div>"+a+"</div>"):a instanceof e&&(a=e("<div>").append(a));c=c||{};"initEditable"===c.command?(a.children(":not(.aloha-block)").each(b),e.browser.msie&&7>=e.browser.version&&a.children(":not(.aloha-block)").each(j)):"getContents"===
c.command&&(a.children(":not(.aloha-block)").each(l),a.find("li>br:last").remove());return a.html()}})});define("contenthandler/contenthandler-plugin","jquery aloha/plugin aloha/contenthandlermanager contenthandler/wordcontenthandler contenthandler/genericcontenthandler contenthandler/sanitizecontenthandler contenthandler/blockelementcontenthandler".split(" "),function(m,e,a,g,c,b,j){var l={word:g,generic:c,sanitize:b,blockelement:j};return e.create("contenthandler",{init:function(){for(var b in l)l.hasOwnProperty(b)&&
a.register(b,l[b])}})});define("characterpicker/nls/i18n",{root:{"button.addcharacter.tooltip":"pick special characters"},ca:!0,de:!0,mk:!0,"pt-br":!0,ru:!0,uk:!0,"zh-hans":!0});define("characterpicker/characterpicker-plugin","aloha jquery aloha/plugin ui/ui ui/button ui/floating PubSub i18n!characterpicker/nls/i18n i18n!aloha/nls/i18n".split(" "),function(m,e,a,g,c,b,j,l){function f(a){this.$node=e('<table class="aloha-character-picker-overlay" unselectable="on" role="dialog"><tbody></tbody></table>');
this.$node.mousedown(function(){return false});this.onSelectCallback=a;this.$tbody=this.$node.find("tbody");this.$node.appendTo(e("body"));this._initHideOnDocumentClick();this._initHideOnEsc();this._initCursorFocus(a);this._initEvents()}function k(a,c){var d=c.offset(),f={top:0,left:0};if("fixed"===b.POSITION_STYLE){d.top=d.top-e(window).scrollTop();d.left=d.left-e(window).scrollLeft()}f.top=a.offset.top+(d.top-a.offset.top);f.left=a.offset.left+(d.left-a.offset.left);return f}function d(a){if(m.activeEditable){o.select();
m.execCommand("insertHTML",false,a)}}var q={},o;f.prototype={offset:{top:0,left:0},show:function(a){this.$node.css(k(this,a));this.$node.css("position",b.POSITION_STYLE);this.$node.show();this.$node.find(".focused").removeClass("focused");e(this.$node.find("td")[0]).addClass("focused");this._overlayActive=true},hide:function(){this.$node.hide();this._overlayActive=false},setCharacters:function(a){this._createCharacterButtons(a)},_initHideOnDocumentClick:function(){var a=this;a.$node.click(function(a){a.stopPropagation()});
e("body").click(function(b){a._overlayActive&&b.target!==a.$node[0]&&(!e(b.target).is(".aloha-icon-characterpicker")&&!e(b.target).find(".aloha-icon-characterpicker").length)&&a.hide()})},_initHideOnEsc:function(){var a=this;e(document).keyup(function(b){a.$node.css("display")==="table"&&b.keyCode===27&&a.hide()})},_initCursorFocus:function(a){var b=this,c,d,f,j,g,k={13:function(){c=b.$node.find(".focused");b.hide();a(c.text())},37:function(){c=b.$node.find(".focused");f=c.prev().addClass("focused");
f.length>0&&c.removeClass("focused")},38:function(){c=b.$node.find(".focused");g=c.parent().prev();if(g.length>0){f=e(g.children()[c.index()]).addClass("focused");f.length>0&&c.removeClass("focused")}},39:function(){c=b.$node.find(".focused");d=c.next().addClass("focused");d.length>0&&c.removeClass("focused")},40:function(){c=b.$node.find(".focused");j=c.parent().next();if(j.length>0){d=e(j.children()[c.index()]).addClass("focused");d.length>0&&c.removeClass("focused")}}};e(document).keydown(function(a){a.stopPropagation();
if(b.$node.css("display")==="table")if(a=k[a.keyCode]){a();return false}})},_initEvents:function(){var a=this;m.bind("aloha-editable-deactivated",function(){a.hide()})},_createCharacterButtons:function(a){var b=this,c=document.createElement("textarea");c.innerHTML=a;for(var a=c.value,a=e.grep(a.split(" "),function(a){return a!==""}),c=["<tr>"],d=0,f;f=a[d];){0!==d&&d%15===0&&c.push("</tr><tr>");c.push('<td unselectable="on">'+f+"</td>");d++}c.push("</tr>");b.$tbody.empty().append(c.join(""));b.$node.delegate("td",
"mouseover",function(){e(this).addClass("mouseover")}).delegate("td","mouseout",function(){e(this).removeClass("mouseover")}).delegate("td","click",function(){b.$node.hide();var a=e(this).text();b.onSelectCallback(a)})}};return a.create("characterpicker",{_constructor:function(){this._super("characterpicker")},config:"&#38; &#34; &#162; &#8364; &#163; &#165; &#169; &#174; &#8482; &#8240; &#181; &#183; &#8226; &#8230; &#8242; &#8243; &#167; &#182; &#223; &#8249; &#8250; &#171; &#187; &#8216; &#8217; &#8220; &#8221; &#8218; &#8222; &#60; &#62; &#8804; &#8805; &#8211; &#8212; &#175; &#8254; &#164; &#166; &#168; &#161; &#191; &#710; &#732; &#176; &#8722; &#177; &#247; &#8260; &#215; &#185; &#178; &#179; &#188; &#189; &#190; &#402; &#8747; &#8721; &#8734; &#8730; &#8764; &#8773; &#8776; &#8800; &#8801; &#8712; &#8713; &#8715; &#8719; &#8743; &#8744; &#172; &#8745; &#8746; &#8706; &#8704; &#8707; &#8709; &#8711; &#8727; &#8733; &#8736; &#180; &#184; &#170; &#186; &#8224; &#8225; &#192; &#193; &#194; &#195; &#196; &#197; &#198; &#199; &#200; &#201; &#202; &#203; &#204; &#205; &#206; &#207; &#208; &#209; &#210; &#211; &#212; &#213; &#214; &#216; &#338; &#352; &#217; &#218; &#219; &#220; &#221; &#376; &#222; &#224; &#225; &#226; &#227; &#228; &#229; &#230; &#231; &#232; &#233; &#234; &#235; &#236; &#237; &#238; &#239; &#240; &#241; &#242; &#243; &#244; &#245; &#246; &#248; &#339; &#353; &#249; &#250; &#251; &#252; &#253; &#254; &#255; &#913; &#914; &#915; &#916; &#917; &#918; &#919; &#920; &#921; &#922; &#923; &#924; &#925; &#926; &#927; &#928; &#929; &#931; &#932; &#933; &#934; &#935; &#936; &#937; &#945; &#946; &#947; &#948; &#949; &#950; &#951; &#952; &#953; &#954; &#955; &#956; &#957; &#958; &#959; &#960; &#961; &#962; &#963; &#964; &#965; &#966; &#967; &#968; &#969; &#8501; &#982; &#8476; &#977; &#978; &#8472; &#8465; &#8592; &#8593; &#8594; &#8595; &#8596; &#8629; &#8656; &#8657; &#8658; &#8659; &#8660; &#8756; &#8834; &#8835; &#8836; &#8838; &#8839; &#8853; &#8855; &#8869; &#8901; &#8968; &#8969; &#8970; &#8971; &#9001; &#9002; &#9674; &#9824; &#9827; &#9829; &#9830;",
init:function(){function a(c){if(c<m.editables.length){b.getOverlayForEditable(m.editables[c]);setTimeout(function(){a(c+1)},100)}}var b=this;if(typeof m.settings.plugins!="undefined"&&typeof m.settings.plugins.characterpicker!="undefined")b.settings=m.settings.plugins.characterpicker;this._characterPickerButton=g.adopt("characterPicker",c,{tooltip:l.t("button.addcharacter.tooltip"),icon:"aloha-icon-characterpicker",scope:"Aloha.continuoustext",click:function(){if(false!==b.characterOverlay){o=m.Selection.rangeObject;
b.characterOverlay.show(this.element)}}});setTimeout(function(){a(0)},100);m.bind("aloha-editable-activated",function(a,c){b.characterOverlay=b.getOverlayForEditable(c.editable);b.characterOverlay?b._characterPickerButton.show():b._characterPickerButton.hide()});j.sub("aloha.floating.changed",function(a){b.characterOverlay.offset=a.position.offset;b.characterOverlay.$node.css(k(b.characterOverlay,b._characterPickerButton.element))})},getOverlayForEditable:function(a){var a=this.getEditableConfig(a.obj),
b;if(!a)return false;e.isArray(a)&&(a=a.join(" "));b=q[a];if(!b){b=new f(d);b.setCharacters(a);q[a]=b}return b}})});define("commands/inserthtml","aloha/core jquery aloha/command aloha/selection util/dom aloha/contenthandlermanager aloha/console".split(" "),function(m,e,a,g,c,b,j){a.register("inserthtml",{action:function(a,f){function g(a){var b=e(a);if(!c.insertIntoDOM(b,f,d,false)){b=b.contents();(c.isBlockLevelElement(a)||c.isListElement(a))&&g(e("<br/>").get(0));for(o=b.length-1;o>=0;--o)g(b[o])}}
var d=e(c.getEditingHostOf(f.startContainer)),q=f.commonAncestorContainer,o,r=[],a=b.handleContent(a,{contenthandler:m.settings.contentHandler.insertHtml});if(typeof a==="string")a=e("<div>"+a+"</div>");else if(a instanceof e)a=e("<div>").append(a);else throw"INVALID_VALUE_ERR";r=a.contents();c.removeRange(f);for(o=r.length-1;o>=0;--o)g(r[o]);r.length>0?f=c.setCursorAfter(r.get(r.length-1)):f.select();c.doCleanup({merge:true,removeempty:true},f,q);try{f.select()}catch(p){j.warn("Error:",p)}}})});
define("commands/commands-plugin",["aloha/command","./inserthtml"],function(){});define("block/blockmanager","aloha jquery ui/scopes aloha/observable aloha/registry util/class util/strings util/maps".split(" "),function(m,e,a,g,c,b,j,l){var f=window.GENTICS,k=new (b.extend(g,{defaults:{"aloha-block-type":"DefaultBlock"},blockTypes:null,blocks:null,_highlightedBlocks:null,_activeBlock:null,_dragdropEnabled:true,_constructor:function(){a.createScope("Aloha.Block");this.blockTypes=new c;this.blocks=
new c;this._highlightedBlocks={}},registerEventHandlers:function(){var a=this;this._registerEventHandlersForDeactivatingAlohaBlock();this._registerEventHandlersForDeterminingCurrentlyActiveBlock();this._registerEventHandlersForBlockDeletion();this._registerEventHandlersForCutCopyPaste();this._registerEVentHandlersForEditableActivated();m.bind("aloha-selection-changed",function(b,c){c&&e(c.getCommonAncestorContainer()).parents(".aloha-block").length>0||a._deactivateHighlightedBlocks()})},_registerEventHandlersForDeactivatingAlohaBlock:function(){var a=
this;e(document).bind("click",function(b){l.isEmpty(a._highlightedBlocks)||e(b.target).closest(".aloha-ui,.aloha-block-do-not-deactivate,.aloha-block").length>0||a._deactivateHighlightedBlocks()})},_registerEventHandlersForDeterminingCurrentlyActiveBlock:function(){var a=this;this.bind("block-selection-change",function(b){a._activeBlock=b.length>0?b[0]:null})},_registerEventHandlersForBlockDeletion:function(){var a=this;m.bind("aloha-command-will-execute",function(b,c){var f=c.commandId,j=m.getSelection().getRangeCount()===
0||m.getSelection().getRangeCount()===1&&m.getSelection().getRangeAt(0).endContainer===m.getSelection().getRangeAt(0).startContainer&&m.getSelection().getRangeAt(0).endContainer===e("body")[0]||m.getSelection().getRangeCount()===1&&m.getSelection().getRangeAt(0).endContainer===m.getSelection().getRangeAt(0).startContainer&&m.getSelection().getRangeAt(0).startOffset+1===m.getSelection().getRangeAt(0).endOffset;if(a._activeBlock&&(f==="delete"||f==="forwarddelete")&&j){c.preventDefault=true;a._activeBlock.destroy()}else if(!a._activeBlock&&
(f==="delete"||f==="forwarddelete")&&m.getSelection().getRangeCount()===1&&m.getSelection().getRangeAt(0).collapsed===false){var g;g=function(a){for(var b,c=0,d=a.length;c<d;c++){b=a[c];if(b.domobj.nodeType===1){var f=e(b.domobj);b.selection==="full"&&f.is(".aloha-block")?f.remove():g(b.children)}}};g(m.Selection.getSelectionTree())}});e(window.document).keydown(function(b){if(typeof b.srcElement!=="undefined"&&typeof b.srcElement.form!=="undefined")return true;if(a._activeBlock&&(b.which===46||b.which===
8)&&a._activeBlock._isInsideNestedEditable===false){if(e.browser.msie&&parseInt(e.browser.version,10)<=8&&a._activeBlock.$element.parents(".aloha-editable,.aloha-block").first().hasClass("aloha-editable")){a._activeBlock.destroy();b.preventDefault();return false}if(a._activeBlock.shouldDestroy()){a._activeBlock.destroy();b.preventDefault();return false}}})},_registerEventHandlersForCutCopyPaste:function(){var a=this,b=false,c=false,j=null;e(window.document).keydown(function(j){if(!m.activeEditable||
!a._activeBlock||!e.contains(a._activeBlock.$element.get(0),m.activeEditable.obj.get(0))){if(a._activeBlock&&(j.ctrlKey||j.metaKey)&&j.which===67){b=true;a._activeBlock.$element.attr("data-aloha-block-copy-only-block","true");f.Utils.Dom.selectDomNode(a._activeBlock.$element[0])}if(a._activeBlock&&(j.ctrlKey||j.metaKey)&&j.which===88){c=true;a._activeBlock.$element.attr("data-aloha-block-copy-only-block","true");f.Utils.Dom.selectDomNode(a._activeBlock.$element[0])}}});e(window.document).keyup(function(f){if(!c&&
b&&(f.which===67||f.which===18||f.which===91)){b=false;a._activeBlock.$element.removeAttr("data-aloha-block-copy-only-block");j&&(j=null)}if(c&&(f.which===67||f.which===18||f.which===88))c=false})},_registerEVentHandlersForEditableActivated:function(){var a=this;m.bind("aloha-editable-activated",function(b,c){if(c.editable){var f=a.getBlock(c.editable.obj.closest(".aloha-block"));f&&f.activate()}})},initializeBlockLevelDragDrop:function(){var a=this;e.each(m.editables,function(b,c){c.obj.data("block-dragdrop",
a._dragdropEnabled);a.createBlockLevelSortableForEditableOrBlockCollection(c.obj)});m.bind("aloha-editable-created",function(b,c){c.obj.data("block-dragdrop",a._dragdropEnabled);a.createBlockLevelSortableForEditableOrBlockCollection(c.obj)})},createBlockLevelSortableForEditableOrBlockCollection:function(a){if(!a.hasClass("aloha-block-blocklevel-sortable")){a.addClass("aloha-block-blocklevel-sortable").sortable({revert:100,handle:".aloha-block-draghandle-blocklevel",connectWith:".aloha-block-blocklevel-sortable.aloha-block-dropzone",
disabled:!this._dragdropEnabled,start:function(a,b){b.item.data("block-sort-allowed",b.item.parents(".aloha-block-dropzone").length>0)},change:function(a,b){b.item.data("block-sort-allowed",b.placeholder.parents(".aloha-block-dropzone").length>0)},stop:function(a,b){b.item.data("block-sort-allowed")||e(this).sortable("cancel");b.item.removeData("block-sort-allowed")}});a.get(0).ondragstart=function(a,b){if(!b||!b.helper||!b.helper.is(".aloha-block"))return false}}},setDragDropState:function(a){this._dragdropEnabled=
a},getDragDropState:function(){return this._dragdropEnabled},registerBlockType:function(b,c){a.createScope("Aloha.Block."+b,"Aloha.Block");this.blockTypes.register(b,c)},_blockify:function(a,b){var c=e(a),f=m.require("block/block-plugin"),j=c[0].tagName.toLowerCase();if(e.inArray(j,f.settings.rootTags)===-1)m.Log.error("block/blockmanager","Blocks can only be created from ["+f.settings.rootTags.join(", ")+"] element. You passed "+j+".");else{f=this.getConfig(c,b);if(this.blockTypes.has(f["aloha-block-type"])){c=
new (this.blockTypes.get(f["aloha-block-type"]))(c,f);c.$element.addClass("aloha-block-"+f["aloha-block-type"]);this.blocks.register(c.getId(),c)}else m.Log.error("block/blockmanager","Block Type "+f["aloha-block-type"]+" not found!")}},_unblockify:function(a){(a=this.getBlock(a))&&a.unblock()},getConfig:function(a,b){var c=a.clone(true),f=c.data(),g={};c.removeData();for(var k in f)f.hasOwnProperty(k)&&(g[j.camelCaseToDashes(k)]=f[k]);return e.extend({},this.defaults,b,g)},getBlock:function(a){if(typeof a===
"object"){a=e(a);a.hasClass("aloha-block-inner")&&(a=a.parent());a=a.attr("id")}return this.blocks.get(a)},_unregisterBlock:function(a){this.blocks.unregister(typeof a==="object"?a.getId():a)},_deactivateHighlightedBlocks:function(){e.each(e.extend({},this._highlightedBlocks),function(a){(a=k.getBlock(a))&&a.deactivate()})},_getHighlightedBlocks:function(){var a={};e.each(this.blocks.getEntries(),function(b,c){c.isActive()&&(a[b]=c)});return a},_setHighlighted:function(a){this._highlightedBlocks[a.id]=
true},_setUnhighlighted:function(a){delete this._highlightedBlocks[a.id]}}));m.Block=m.Block||{};return m.Block.BlockManager=k});define("block/editormanager",["aloha/registry"],function(m){return new (m.extend({createEditor:function(e){if(!this.has(e.type))throw'Editor for type "'+e.type+'" not found.';return new (this.get(e.type))(e)}}))});define("block/sidebarattributeeditor",["jquery","block/blockmanager","aloha/sidebar","block/editormanager","util/class"],function(m,e,a,g,c){return new (c.extend({_sidebar:null,
init:function(){this._sidebar=a.right.show();e.bind("block-selection-change",this._onBlockSelectionChange,this)},_onBlockSelectionChange:function(a){var c=this;this._sidebar&&m.each(a,function(){var a=this.getSchema(),b=this,k=[];a&&c._sidebar.addPanel({title:b.getTitle(),expanded:!0,onInit:function(){var c=m("<form />");c.submit(function(){return!1});m.each(a,function(a,j){var e=g.createEditor(j);e.bind("change",function(c){b.attr(a,c)});b.bind("change",function(){e.setValue(b.attr(a))});c.append(e.render());
e.setValue(b.attr(a));k.push(e)});this.setContent(c)},deactivate:function(){m.each(k,function(a,b){b._deactivate()});this.isActive=!1;this.effectiveElement=null}})})}}))});define("block/block","aloha jquery block/blockmanager aloha/observable ui/scopes util/class PubSub".split(" "),function(m,e,a,g,c,b,j){function l(a){a=a.closest(".aloha-editable");return a.length?!!a.data("block-dragdrop"):true}var f=window.GENTICS,g=b.extend(g,{title:null,id:null,$element:null,_currentlyRendering:false,_initialized:false,
_isInsideNestedEditable:false,_constructor:function(a,b){var c=this;this.$element=a;if(a.attr("id"))this.id=a.attr("id");else{this.id=f.Utils.guid();a.attr("id",this.id)}a.contentEditable(false);a.addClass("aloha-block");if(this.isDraggable()){a.find("img").attr("draggable","false");a.find("a").attr("draggable","false")}e.each(b,function(a,b){c._setAttribute(a,b)});this._onElementClickHandler=function(a){if(e(a.target).closest(".aloha-block").get(0)===c.$element.get(0)){c._fixScrollPositionBugsInIE();
c.activate(a.target,a)}};this._connectThisBlockToDomElement(a,function(){j.pub("aloha.block.initialized",{block:c})});this._initialized=true},_onElementClickHandler:null,_preventSelectionChangedEventHandler:function(a){"dblclick"!==a.type&&!e(a.target).is(".aloha-editable")&&m.Selection.preventSelectionChanged()},_connectThisBlockToDomElement:function(a,b){var c=this,d=e(a);this._disconnectFromDomElement();this.$element=d;this.$element.bind("click",this._onElementClickHandler);this.$element.bind("mousedown",
this._preventSelectionChangedEventHandler);this.$element.bind("focus",this._preventSelectionChangedEventHandler);this.$element.bind("dblclick",this._preventSelectionChangedEventHandler);this.init(this.$element,function(){window.setTimeout(function(){c._postProcessElementIfNeeded();b&&b()},5)})},_disconnectFromDomElement:function(){if(this.$element){this.$element.unbind("click",this._onElementClickHandler);this.$element.unbind("mousedown",this._preventSelectionChangedEventHandler);this.$element.unbind("focus",
this._preventSelectionChangedEventHandler);this.$element.unbind("dblclick",this._preventSelectionChangedEventHandler)}},_fixScrollPositionBugsInIE:function(){var a=e(window).scrollTop();window.setTimeout(function(){e(window).scrollTop()!==a&&e(window).scrollTop(a)},10)},init:function(a,b){b()},shouldDestroy:function(){var a=this.$element.parent().closest(".aloha-block,.aloha-editable,.aloha-block-collection");return a.hasClass("aloha-block-collection")&&this.$element[0].tagName.toLowerCase()==="div"?
true:a.hasClass("aloha-editable")},destroy:function(b){if(this.shouldDestroy()||b===true){var c=this,d=new f.Utils.RangeObject;d.startContainer=d.endContainer=this.$element.parent()[0];d.startOffset=d.endOffset=f.Utils.Dom.getIndexInParent(this.$element[0]);a.trigger("block-delete",this);this.free();var j=this.$element[0].tagName.toLowerCase()==="span";this.$element.fadeOut("fast",function(){c.$element.remove();a.trigger("block-selection-change",[]);window.setTimeout(function(){j&&d.select()},5)})}},
unblock:function(){this.deactivate();this._disconnectFromDomElement();this.$element.removeClass("aloha-block");this.$element.children(".aloha-block-handle").remove();this.free()},free:function(){a._unregisterBlock(this);this.unbindAll()},getId:function(){return this.id},getSchema:function(){return null},getTitle:function(){return this.title},isDraggable:function(){return this.$element[0].tagName.toLowerCase()==="div"&&this.$element.parents(".aloha-editable,.aloha-block,.aloha-block-collection").first().hasClass("aloha-block-collection")?
true:this.$element.parents(".aloha-editable,.aloha-block").first().hasClass("aloha-editable")},activate:function(b,d){var f=[];e.each(a._getHighlightedBlocks(),function(){this.deactivate()});this.$element.attr("data-block-skip-scope")!=="true"&&c.setScope("Aloha.Block."+this.attr("aloha-block-type"));this.$element.addClass("aloha-block-active");this._highlight();f.push(this);this.$element.parents(".aloha-block").each(function(){var b=a.getBlock(this);if(b){b._highlight();f.push(b)}});if(e(b).closest(".aloha-editable,.aloha-block,.aloha-table-cell-editable,.aloha-table-cell_active").first().hasClass("aloha-block")){this._isInsideNestedEditable=
false;m.getSelection().removeAllRanges()}else{this._isInsideNestedEditable=true;d&&m.Selection.updateSelection(d)}a.trigger("block-activate",f);a.trigger("block-selection-change",f)},deactivate:function(){var b=this,c=[this];this._unhighlight();this.$element.parents(".aloha-block").each(function(){c.push(this);b._unhighlight()});this.$element.removeClass("aloha-block-active");a.trigger("block-deactivate",c);a.trigger("block-selection-change",[])},isActive:function(){return this.$element.hasClass("aloha-block-active")},
_highlight:function(){this.$element.addClass("aloha-block-highlighted");a._setHighlighted(this)},_unhighlight:function(){this.$element.removeClass("aloha-block-highlighted");a._setUnhighlighted(this)},_update:function(){var a=this;if(!this._currentlyRendering&&this._initialized){this._currentlyRendering=true;this.update(this.$element,function(){a._postProcessElementIfNeeded()});this._currentlyRendering=false}},update:function(a,b){b()},_postProcessElementIfNeeded:function(){this.createEditablesIfNeeded();
this._checkThatNestedBlocksAreStillConsistent();this._makeNestedBlockCollectionsSortable();this.renderBlockHandlesIfNeeded();if(this.isDraggable()&&this.$element[0].tagName.toLowerCase()==="span"){this._setupDragDropForInlineElements();this._disableUglyInternetExplorerDragHandles()}else if(this.isDraggable()&&this.$element[0].tagName.toLowerCase()==="div"){this._setupDragDropForBlockElements();this._disableUglyInternetExplorerDragHandles()}this._hideDragHandlesIfDragDropDisabled();this._attachDropzoneHighlightEvents()},
_checkThatNestedBlocksAreStillConsistent:function(){this.$element.find(".aloha-block").each(function(){var b=a.getBlock(this);b&&b.$element[0]!==this&&b._connectThisBlockToDomElement(this)})},_makeNestedBlockCollectionsSortable:function(){var b=this;this.$element.find(".aloha-block-collection").each(function(){var c=e(this);c.closest(".aloha-block").get(0)===b.$element.get(0)&&a.createBlockLevelSortableForEditableOrBlockCollection(c)})},_disableUglyInternetExplorerDragHandles:function(){if(e.browser.msie){this.$element.get(0).onresizestart=
function(){return false};this.$element.get(0).oncontrolselect=function(){return false};this.$element.get(0).onmovestart=function(){return false}}},_hideDragHandlesIfDragDropDisabled:function(){this._dd_isDragdropEnabled()||this.$element.find(".aloha-block-draghandle").each(function(){var a=e(this);l(a)||a.removeClass("aloha-block-draghandle")})},_attachDropzoneHighlightEvents:function(){var a=this;this.$element.delegate(".aloha-block-draghandle","mousedown",function(){var b=a.$element.parents(".aloha-editable").first().data("block-dropzones")||
[];e.each(b,function(a,b){var c=e(b);e(c).each(function(){e(this).data("block-dragdrop")&&e(this).addClass("aloha-block-dropzone")})});e(document).one("mouseup.aloha-block-dropzone",function(){var b=a.$element.parents(".aloha-editable").first().data("block-dropzones")||[];e.each(b,function(a,b){e(b).removeClass("aloha-block-dropzone")})})})},_setupDragDropForInlineElements:function(){var a=this,b=null,c=false,d=null,f=null,j=function(){if(b){var j=e(b);if(j.is(".aloha-block-dropInlineElementIntoEmptyBlock")){j.children().remove();
j.append(d)}else if(j.is(".aloha-block-droppable-right")){j.html(j.html()+" ");j.after(d)}else{j.prev("[data-i]").length>0&&j.prev("[data-i]").html(j.prev("[data-i]").html()+" ");j.html(" "+j.html());j.before(d)}d.removeClass("ui-draggable").css({left:0,top:0});a._fixScrollPositionBugsInIE()}e(".aloha-block-dropInlineElementIntoEmptyBlock").removeClass("aloha-block-dropInlineElementIntoEmptyBlock");f.droppable("destroy");f=null;c=true},g=[];this.$element.draggable({handle:".aloha-block-draghandle",
scope:"aloha-block-inlinedragdrop",disabled:!this._dd_isDragdropEnabled(),revert:function(){return b===null||!c},revertDuration:250,stop:function(){e.browser.msie&&7===parseInt(e.browser.version,10)&&j();e.each(g,function(){a._dd_traverseDomTreeAndRemoveSpans(this)});d=null;g=[]},start:function(){c=false;g=[];e(".aloha-editable").children("p:empty").html("&nbsp;");var k={tolerance:"pointer",addClasses:false,scope:"aloha-block-inlinedragdrop",over:function(c,f){e.inArray(this,g)===-1&&g.push(this);
var j=1===e(this).contents().length&&1===e(this).children("br").length;d=f.draggable;if(e(this).is(":empty")||j||e(this).html()==="&nbsp;"){e(this).addClass("aloha-block-dropInlineElementIntoEmptyBlock");b=this}else{a._dd_traverseDomTreeAndWrapCharactersWithSpans(this);e("span[data-i]",this).droppable({tolerance:"pointer",addClasses:false,scope:"aloha-block-inlinedragdrop",over:function(){b&&e(b).removeClass("aloha-block-droppable");b=this;e(this).addClass("aloha-block-droppable")},out:function(){e(this).removeClass("aloha-block-droppable");
b===this&&(b=null)}});e.ui.ddmanager.prepareOffsets(f.draggable.data("draggable"),c)}},out:function(){e(this).removeClass("aloha-block-dropInlineElementIntoEmptyBlock")},drop:function(){e.browser.msie&&7===parseInt(e.browser.version,10)||j()}};f=e(".aloha-editable.aloha-block-dropzone").children(":not(.aloha-block)");f.droppable(k);e(".aloha-table-cell-editable").droppable(k)}})},_dd_traverseDomTreeAndWrapCharactersWithSpans:function(a){for(var b,c=0,d=a.childNodes.length;c<d;c++){b=a.childNodes[c];
if(b.nodeType===1)if(!~b.className.indexOf("aloha-block")&&b.attributes["data-i"]===void 0)this._dd_traverseDomTreeAndWrapCharactersWithSpans(b);else{if(b.attributes["data-i"])break}else if(b.nodeType===3){b=this._dd_insertSpans(b);c=c+b;d=d+b}}},_dd_splitText:function(a){for(var a=a.split(/(?=\b)/),b=[],c=false,d=0,f=a.length;d<f;d++)if(/[^\t\n\r ]/.test(a[d]))if(c){b.push(" "+a[d]);c=false}else b.push(a[d]);else c=true;c&&(b[b.length-1]=b[b.length-1]+" ");return b},_dd_insertSpans:function(a){var b=
a.nodeValue;if(!/[^\t\n\r ]/.test(b))return 0;for(var c=document.createDocumentFragment(),b=this._dd_splitText(b),d=b.length,f,j,g,k=0,l=0;l<d;l++){j=b[l];if(j.length!==0){g=Math.floor(j.length/2);f=parseInt(e.browser.version,10);if(e.browser.msie&&(7===f||8===f))g=0;if(g>0){f=document.createElement("span");f.appendChild(document.createTextNode(j.substr(0,g)));f.setAttribute("data-i",l);c.appendChild(f);k++}f=document.createElement("span");j=j.substr(g);f.appendChild(document.createTextNode(j));f.setAttribute("data-i",
l);f.setAttribute("class","aloha-block-droppable-right");c.appendChild(f);k++}}a.parentNode.replaceChild(c,a);return k-1},_dd_traverseDomTreeAndRemoveSpans:function(a){var b=[],c;c=function(a){for(var d=false,f,j,g,k=0,e=a.childNodes.length;k<e;k++){g=a.childNodes[k];if(g.nodeType===1)if(g.attributes["data-i"]!==void 0){if(!d){d=true;f="";j=void 0}if(d){f=f+g.firstChild.nodeValue;j&&b.push(j);j=g}}else{if(d){d=false;j.parentNode.replaceChild(document.createTextNode(f),j)}~g.className.indexOf("aloha-block")||
c(g)}}d&&j.parentNode.replaceChild(document.createTextNode(f),j)};c(a);for(var a=0,d=b.length;a<d;a++)b[a].parentNode.removeChild(b[a])},_dd_isDragdropEnabled:function(){return l(this.$element.parent())},_setupDragDropForBlockElements:function(){this.$element.find(".aloha-block-draghandle").addClass("aloha-block-draghandle-blocklevel")},createEditablesIfNeeded:function(){this.$element.find(".aloha-editable").aloha()},renderBlockHandlesIfNeeded:function(){this.isDraggable()&&this.$element.children(".aloha-block-draghandle").length===
0&&this.$element.prepend('<span class="aloha-block-handle aloha-block-draghandle aloha-cleanme"></span>')},attr:function(a,b,c){var d=this,f=false;if(arguments.length>=2){if(a.substr(0,12)==="aloha-block-"){m.Log.error("block/block","It is not allowed to set internal block attributes (starting with aloha-block-) through Block.attr() (You tried to set "+a+")");return}this._getAttribute(a)!==b&&(f=true);this._setAttribute(a,b)}else if(typeof a==="object")e.each(a,function(a,b){if(a.substr(0,12)==="aloha-block-")m.Log.error("block/block",
"It is not allowed to set internal block attributes (starting with aloha-block-) through Block.attr() (You tried to set "+a+")");else{d._getAttribute(a)!==b&&(f=true);d._setAttribute(a,b)}});else return typeof a==="string"?this._getAttribute(a):this._getAttributes();if(f&&!c){this._update();this.trigger("change");m.activeEditable&&m.activeEditable.smartContentChange({type:"block-change"})}return null},_setAttribute:function(a,b){this.$element.attr("data-"+a.toLowerCase(),b)},_getAttribute:function(a){return this.$element.attr("data-"+
a.toLowerCase())},_getAttributes:function(){var a={};e.each(this.$element[0].attributes,function(b,c){if(c.name.substr(0,5)==="data-")a[c.name.substr(5).toLowerCase()]=c.value});return a}}),b=g.extend({update:function(a,b){b()}}),k=g.extend({title:"Debugging",init:function(a,b){this.update(a,b)},update:function(a,b){a.css({display:"block"});var c='<table class="debug-block">';e.each(this.attr(),function(a,b){c=c+("<tr><th>"+a+"</th><td>"+b+"</td></tr>")});c=c+"</table>";a.html(c);b()}}),d=g.extend({title:"EmptyBlock",
init:function(){},activate:function(){},deactivate:function(){},renderBlockHandlesIfNeeded:function(){}});return{AbstractBlock:g,DefaultBlock:b,DebugBlock:k,EmptyBlock:d}});define("block/blockcontenthandler",["jquery","aloha/contenthandlermanager","block/blockmanager"],function(m,e,a){return e.createHandler({handleContent:function(g){"string"===typeof g?g=m("<div>"+g+"</div>"):g instanceof m&&(g=m("<div>").append(g));0<g.find('.aloha-block[data-aloha-block-copy-only-block="true"]').length&&(g.find(".aloha-block:not([id])").remove(),
g.find(".aloha-block + span:empty").remove(),g.find("div:empty").remove(),g.find("br.Apple-interchange-newline").remove(),g.find(".aloha-block").prev("br").remove(),g.find("div > br:only-child").parent().remove());g.find(".aloha-block").each(function(){var c=m(this),b={},j={};m.each(c[0].attributes,function(a,c){if(c.nodeName!=="id")c.nodeName.match(/^data-/)?j[c.nodeName.substr(5)]=c.nodeValue:b[c.nodeName]=c.nodeValue});var g=GENTICS.Utils.guid(),f=m("<"+this.tagName+"/>").attr(b).attr("id",g).removeClass("aloha-block-active").removeClass("aloha-block").html(c.html());
c.replaceWith(f);window.setTimeout(function(){a._blockify(m("#"+g),j)},50)});return g.html()}})});define("block/editor",["jquery","aloha/observable","util/class"],function(m,e,a){var e=a.extend(e,{schema:null,_constructor:function(a){this.schema=a},render:function(){},getValue:function(){},setValue:function(){},destroy:function(){},_deactivate:function(){this.trigger("change",this.getValue());this.destroy()}}),a=e.extend({formInputElementDefinition:null,_$formInputElement:null,render:function(){var a=
m('<div class="aloha-block-editor" />'),b=GENTICS.Utils.guid();a.append(this.renderLabel().attr("id",b));a.append(this.renderFormElement().attr("id",b));return a},renderLabel:function(){var a=m("<label />");a.html(this.schema.label);return a},renderFormElement:function(){var a=this;this._$formInputElement=m(this.formInputElementDefinition);this.afterRenderFormElement(this._$formInputElement);this._$formInputElement.change(function(){a.trigger("change",a.getValue())});return this._$formInputElement},
afterRenderFormElement:function(){},getValue:function(){return this._$formInputElement.val()},setValue:function(a){this._$formInputElement.val(a)},destroy:function(){this._$formInputElement.remove()}}),g=a.extend({formInputElementDefinition:'<input type="text" />'}),c=a.extend({formInputElementDefinition:'<input type="range" />',afterRenderFormElement:function(a){this.schema.range&&(this.schema.range.min&&a.attr("min",this.schema.range.min),this.schema.range.max&&a.attr("max",this.schema.range.max),
this.schema.range.step&&a.attr("step",this.schema.range.step))}}),b=a.extend({formInputElementDefinition:'<input type="url" />'}),j=a.extend({formInputElementDefinition:'<input type="email" />'}),l=a.extend({formInputElementDefinition:"<select />",afterRenderFormElement:function(a){m.each(this.schema.values,function(){a.append(m("<option />").attr("value",this.key).html(this.label))})}}),f=a.extend({formInputElementDefinition:"<button />",afterRenderFormElement:function(a){var b=this;a.html(this.schema.buttonLabel);
a.click(function(){b.schema.callback()})}});return{AbstractEditor:e,AbstractFormElementEditor:a,StringEditor:g,NumberEditor:c,UrlEditor:b,EmailEditor:j,SelectEditor:l,ButtonEditor:f}});define("block/nls/i18n",{root:{"button.toggledragdrop.tooltip":"Toggle Drag & Drop"},ca:!0,de:!0,mk:!0,"pt-br":!0,ru:!0,uk:!0,"zh-hans":!0});define("block/block-plugin","aloha aloha/plugin jquery aloha/contenthandlermanager block/blockmanager block/sidebarattributeeditor block/block block/editormanager block/blockcontenthandler block/editor ui/ui ui/toggleButton i18n!block/nls/i18n i18n!aloha/nls/i18n jqueryui".split(" "),
function(m,e,a,g,c,b,j,l,f,k,d,q,o){var r=["div","span"],e=e.create("block",{config:[],settings:{},init:function(){var a=this;if(!this.settings.rootTags)this.settings.rootTags=r;c.registerBlockType("DebugBlock",j.DebugBlock);c.registerBlockType("DefaultBlock",j.DefaultBlock);c.registerBlockType("EmptyBlock",j.EmptyBlock);l.register("string",k.StringEditor);l.register("number",k.NumberEditor);l.register("url",k.UrlEditor);l.register("email",k.EmailEditor);l.register("select",k.SelectEditor);l.register("button",
k.ButtonEditor);g.register("block",f);c.setDragDropState(a.isDragDropEnabled());c.registerEventHandlers();c.initializeBlockLevelDragDrop();m.bind("aloha-plugins-loaded",function(){a._createBlocks();false!==a.settings.sidebarAttributeEditor&&b.init()});this.createButtons();m.bind("aloha-editable-created",function(b,c){a.setDropzones(c.obj)});m.bind("aloha-editable-activated",function(b,c){a.applyButtonConfig(c.editable)})},applyButtonConfig:function(a){if(this._isDragdropToggleEnabled(a)){this._toggleDragDropButton.show();
this._toggleDragDropButton.setState(this._getDragdropState(a))}else this._toggleDragDropButton.hide()},_isDragdropToggleEnabled:function(a){a=this.getEditableConfig(a.obj);return(this.settings&&this.settings.config&&this.settings.config.toggleDragdropGlobal||a[0]==="toggleDragdrop"||a.toggleDragdrop==true||a.toggleDragdrop=="true"||a.toggleDragdrop==1||a.toggleDragdrop=="1")&&this.isDragDropEnabled()},_getDragdropState:function(a){return this.settings&&this.settings.config&&this.settings.config.toggleDragdropGlobal?
c.getDragDropState():a.obj.data("block-dragdrop")},_toggleDragdropState:function(a){if(this.settings&&this.settings.config&&this.settings.config.toggleDragdropGlobal){var b=!c.getDragDropState();c.setDragDropState(b);for(var d=0;d<m.editables.length;d++){a=m.editables[d];this._setDragDropStateForEditable(a.obj,b)}}else{b=!a.obj.data("block-dragdrop");this._setDragDropStateForEditable(a.obj,b)}},createButtons:function(){var a=this;this._toggleDragDropButton=d.adopt("toggleDragDrop",q,{tooltip:o.t("button.toggledragdrop.tooltip"),
icon:"aloha-icon aloha-icon-toggledragdrop",scope:"Aloha.continuoustext",click:function(){a._toggleDragdropState(m.activeEditable)}})},setDropzones:function(a){var b=this.getEditableConfig(a);(b=b&&b.dropzones||this.settings.dropzones)?a.data("block-dropzones",b):a.data("block-dropzones",[".aloha-editable"])},isDragDropEnabled:function(){return this.settings&&typeof this.settings.dragdrop!=="undefined"?this.settings.dragdrop===true||this.settings.dragdrop==="true"||this.settings.dragdrop===1||this.settings.dragdrop===
"1":true},_createBlocks:function(){if(!this.settings.defaults)this.settings.defaults={};a.each(this.settings.defaults,function(b,c){a(b).alohaBlock(c)})},_setDragDropStateForEditable:function(b,c){b.data("block-dragdrop",c);b.hasClass("ui-sortable")&&b.sortable("option","disabled",!c);b.find(".aloha-block.ui-draggable").each(function(){a(this).draggable("option","disabled",!c)});b.find(".aloha-block-handle").each(function(){c?a(this).addClass("aloha-block-draghandle"):a(this).removeClass("aloha-block-draghandle")})}});
a.fn.alohaBlock=function(b){b=b||{};a(this).each(function(a,d){c._blockify(d,b)});return a(this)};a.fn.mahaloBlock=function(){a(this).each(function(a,b){c._unblockify(b)})};return e});define("align/nls/i18n",{root:{"button.alignright.tooltip":"Align to the right","button.alignleft.tooltip":"Align to the left","button.aligncenter.tooltip":"Center","button.alignjustify.tooltip":"Justify","button.aligntop.tooltip":"Align to the top","button.alignmiddle.tooltip":"Align to the middle","button.alignbottom.tooltip":"Align to the bottom"},
ca:!0,de:!0,mk:!0,"pt-br":!0,ru:!0,uk:!0,"zh-hans":!0});define("align/align-plugin","aloha aloha/plugin ui/ui ui/toggleButton i18n!align/nls/i18n i18n!aloha/nls/i18n jquery PubSub".split(" "),function(m,e,a,g,c,b,j,l){var f=window.GENTICS;return e.create("align",{_constructor:function(){this._super("align")},config:{alignment:["right","left","center","justify","top","middle","bottom"]},alignment:"",verticalAlignment:"",lastAlignment:"",lastVerticalAlignment:"",init:function(){this.createButtons();
var a=this;m.bind("aloha-editable-activated",function(b,c){a.applyButtonConfig(c.editable.obj)});l.sub("aloha.selection.context-change",function(b){b=b.range;m.activeEditable&&a.buttonPressed(b)})},buttonPressed:function(a){this.horizontalButtonPressed(a);this.verticalButtonPressed(a)},horizontalButtonPressed:function(a){var b=this;this.lastAlignment=this.alignment;this.alignment="";a.findMarkup(function(){if(this.style.textAlign!==""){b.alignment=this.style.textAlign;return true}b.alignment=j(this).css("text-align")},
m.activeEditable.obj);if(this.alignment!=this.lastAlignment){this._alignRightButton.setState(false);this._alignLeftButton.setState(false);this._alignCenterButton.setState(false);this._alignJustifyButton.setState(false);switch(this.alignment){case "right":this._alignRightButton.setState(true);break;case "center":this._alignCenterButton.setState(true);break;case "justify":this._alignJustifyButton.setState(true);break;default:this._alignLeftButton.setState(true);this.alignment="left"}}},verticalButtonPressed:function(a){var b=
this;this.lastVerticalAlignment=this.verticalAlignment;this.verticalAlignment="";a.findMarkup(function(){if(this.style.verticalAlign!==""){b.verticalAlignment=this.style.verticalAlign;return true}b.verticalAlignment=j(this).css("vertical-align")},m.activeEditable.obj);if(this.verticalAlignment!=this.lastVerticalAlignment){this._alignTopButton.setState(false);this._alignMiddleButton.setState(false);this._alignBottomButton.setState(false);switch(this.verticalAlignment){case "top":this._alignTopButton.setState(true);
break;case "middle":this._alignMiddleButton.setState(true);break;case "bottom":this._alignBottomButton.setState(true);break;default:this._alignTopButton.setState(true);this.verticalAlignment="top"}}},applyButtonConfig:function(a){a=this.getEditableConfig(a);if(!a||!a.alignment||this.settings.alignment)if(a[0]&&a[0].alignment)a=a[0];else if(this.settings.alignment)a.alignment=this.settings.alignment;if(typeof a.alignment==="undefined")a=this.config;j.inArray("right",a.alignment)!=-1?this._alignRightButton.show(true):
this._alignRightButton.show(false);j.inArray("left",a.alignment)!=-1?this._alignLeftButton.show(true):this._alignLeftButton.show(false);j.inArray("center",a.alignment)!=-1?this._alignCenterButton.show(true):this._alignCenterButton.show(false);j.inArray("justify",a.alignment)!=-1?this._alignJustifyButton.show(true):this._alignJustifyButton.show(false);j.inArray("top",a.alignment)!=-1?this._alignTopButton.show(true):this._alignTopButton.show(false);j.inArray("middle",a.alignment)!=-1?this._alignMiddleButton.show(true):
this._alignMiddleButton.show(false);j.inArray("bottom",a.alignment)!=-1?this._alignBottomButton.show(true):this._alignBottomButton.show(false)},createButtons:function(){var b=this;this._alignLeftButton=a.adopt("alignLeft",g,{tooltip:c.t("button.alignleft.tooltip"),icon:"aloha-icon aloha-icon-align aloha-icon-align-left",scope:"Aloha.continuoustext",click:function(){b.align("left")}});this._alignCenterButton=a.adopt("alignCenter",g,{tooltip:c.t("button.aligncenter.tooltip"),icon:"aloha-icon aloha-icon-align aloha-icon-align-center",
scope:"Aloha.continuoustext",click:function(){b.align("center")}});this._alignRightButton=a.adopt("alignRight",g,{tooltip:c.t("button.alignright.tooltip"),icon:"aloha-icon aloha-icon-align aloha-icon-align-right",scope:"Aloha.continuoustext",click:function(){b.align("right")}});this._alignJustifyButton=a.adopt("alignJustify",g,{tooltip:c.t("button.alignjustify.tooltip"),icon:"aloha-icon aloha-icon-align aloha-icon-align-justify",scope:"Aloha.continuoustext",click:function(){b.align("justify")}});
this._alignTopButton=a.adopt("alignTop",g,{tooltip:c.t("button.aligntop.tooltip"),icon:"aloha-icon aloha-icon-align aloha-icon-align-top",scope:"table.cell",click:function(){b.verticalAlign("top")}});this._alignMiddleButton=a.adopt("alignMiddle",g,{tooltip:c.t("button.alignmiddle.tooltip"),icon:"aloha-icon aloha-icon-align aloha-icon-align-middle",scope:"table.cell",click:function(){b.verticalAlign("middle")}});this._alignBottomButton=a.adopt("alignBottom",g,{tooltip:c.t("button.alignbottom.tooltip"),
icon:"aloha-icon aloha-icon-align aloha-icon-align-bottom",scope:"table.cell",click:function(){b.verticalAlign("bottom")}})},verticalAlign:function(a){var b=m.Selection.getRangeObject();this.lastVerticalAlignment=this.verticalAlignment;this.verticalAlignment=a;(a=this.getSelectedCells(b))&&this.toggleAlign(a,"vertical-align");if(this.verticalAlignment!=this.lastVerticalAlignment)switch(this.lastVerticalAlignment){case "top":this._alignTopButton.setState(false);break;case "middle":this._alignMiddleButton.setState(false);
break;case "bottom":this._alignBottomButton.setState(false)}b.select()},align:function(a){var b=m.Selection.getRangeObject();this.lastAlignment=this.alignment;this.alignment=a;var a=b.getCommonAncestorContainer(),c=this.getSelectedCells(b);if(c)this.toggleAlign(c);else if(f.Utils.Dom.isEditingHost(a)){var g=[];j.each(m.Selection.getRangeObject().getSelectionTree(),function(){this.selection!=="none"&&this.domobj.nodeType!==3&&g.push(this.domobj)});this.toggleAlign(g)}else this.toggleAlign(a);if(this.alignment!=
this.lastAlignment)switch(this.lastAlignment){case "right":this._alignRightButton.setState(false);break;case "left":this._alignLeftButton.setState(false);break;case "center":this._alignCenterButton.setState(false);break;case "justify":this._alignJustifyButton.setState(false)}b.select()},getSelectedCells:function(a){var b,a=a.findMarkup(function(){j(this).is("td,th")&&(b=this);return j(this).is("table.aloha-table")},m.activeEditable.obj),a=j(a).find(".aloha-cell-selected");return a.length?a:b},toggleAlign:function(a,
b){var b=b||"text-align",c=b==="vertical-align"?this.verticalAlignment:this.alignment,f=true;j(a).each(function(){if(j(this).css(b)!=c)return f=false});j(a).each(function(){j(this).css(b)==c&&f?j(this).css(b,""):j(this).css(b,c)})}})});define("abbr/nls/i18n",{root:{"floatingmenu.tab.abbr":"Abbreviation","button.addabbr.tooltip":"insert abbreviation","button.abbr.tooltip":"format as abbreviation","newabbr.defaulttext":"Abbr"},ca:!0,de:!0,mk:!0,"pt-br":!0,ru:!0,uk:!0,"zh-hans":!0});define("abbr/abbr-plugin",
"aloha jquery aloha/plugin ui/ui ui/toggleButton ui/button ui/scopes ui/port-helper-attribute-field i18n!abbr/nls/i18n i18n!aloha/nls/i18n".split(" "),function(m,e,a,g,c,b,j,l,f){var k=window.GENTICS;return a.create("abbr",{config:["abbr"],init:function(){this.createButtons();this.subscribeEvents();this.bindInteractions()},createButtons:function(){var a=this;this._formatAbbrButton=g.adopt("formatAbbr",c,{tooltip:f.t("button.abbr.tooltip"),icon:"aloha-icon aloha-icon-abbr",scope:"Aloha.continuoustext",
click:function(){a.formatAbbr()}});this._insertAbbrButton=g.adopt("insertAbbr",b,{tooltip:f.t("button.addabbr.tooltip"),icon:"aloha-icon aloha-icon-abbr",scope:"Aloha.continuoustext",click:function(){a.insertAbbr(false)}});j.createScope("abbr","Aloha.continuoustext");this.abbrField=l({width:320,name:"abbrText",scope:"abbr"});this.remAbbrButton=g.adopt("removeAbbr",b,{tooltip:f.t("button.remabbr.tooltip"),icon:"aloha-icon aloha-icon-abbr-rem",scope:"abbr",click:function(){a.removeAbbr()}})},bindInteractions:function(){var a=
this;this.abbrField.addListener("blur",function(){this.getValue()==""&&a.removeAbbr()});for(var b=0;b<m.editables.length;b++)m.editables[b].obj.keydown(function(b){if(b.metaKey&&b.which==71){if(a.findAbbrMarkup()){a.abbrField.foreground();a.abbrField.focus()}else a.insertAbbr();b.stopPropagation();b.preventDefault();return false}})},subscribeEvents:function(){var a=this,b={};m.bind("aloha-editable-activated",function(){if(m.activeEditable&&m.activeEditable.obj){var c=a.getEditableConfig(m.activeEditable.obj);
b[m.activeEditable.getId()]=e.inArray("abbr",c)!==-1}});m.bind("aloha-editable-destroyed",function(){m.activeEditable&&m.activeEditable.obj&&delete b[m.activeEditable.getId()]});m.bind("aloha-selection-changed",function(c,f){if(m.activeEditable)if(b[m.activeEditable.getId()]){a._formatAbbrButton.show();a._insertAbbrButton.show();var g=a.findAbbrMarkup(f);if(g){a._insertAbbrButton.hide();a._formatAbbrButton.setState(true);j.setScope("abbr");a.abbrField.setTargetObject(g,"title")}else{a._formatAbbrButton.setState(false);
a.abbrField.setTargetObject(null)}}else{a._formatAbbrButton.hide();a._insertAbbrButton.hide()}})},findAbbrMarkup:function(a){typeof a=="undefined"&&(a=m.Selection.getRangeObject());return m.activeEditable?a.findMarkup(function(){return this.nodeName.toLowerCase()=="abbr"},m.activeEditable.obj):null},formatAbbr:function(){var a=m.Selection.getRangeObject();m.activeEditable&&(this.findAbbrMarkup(a)?this.removeAbbr():this.insertAbbr())},insertAbbr:function(a){var b=m.Selection.getRangeObject();if(!this.findAbbrMarkup(b)){b.isCollapsed()&&
a!=false&&k.Utils.Dom.extendToWord(b);if(b.isCollapsed()){var a=f.t("newabbr.defaulttext"),c=e('<abbr title="">'+a+"</abbr>");k.Utils.Dom.insertIntoDOM(c,b,e(m.activeEditable.obj));b.startContainer=b.endContainer=c.contents().get(0);b.startOffset=0;b.endOffset=a.length}else{c=e('<abbr title=""></abbr>');k.Utils.Dom.addMarkup(b,c,false)}b.select();this.abbrField.foreground();this.abbrField.focus()}},removeAbbr:function(){var a=m.Selection.getRangeObject(),b=this.findAbbrMarkup();if(b){k.Utils.Dom.removeFromDOM(b,
a,true);a.select()}},makeClean:function(){},toString:function(){return"abbr"}})});define("horizontalruler/nls/i18n",{root:{"button.addhr.tooltip":"Add a horizontal ruler"},ca:!0,de:!0,mk:!0,"pt-br":!0,ru:!0,uk:!0,"zh-hans":!0});define("horizontalruler/horizontalruler-plugin","aloha jquery aloha/plugin ui/ui ui/button i18n!horizontalruler/nls/i18n i18n!aloha/nls/i18n".split(" "),function(m,e,a,g,c,b){var j=window.GENTICS;return a.create("horizontalruler",{_constructor:function(){this._super("horizontalruler")},
config:["hr"],init:function(){var a=this;this._insertHorizontalRuleButton=g.adopt("insertHorizontalRule",c,{tooltip:b.t("button.addhr.tooltip"),iconOnly:true,icon:"aloha-icon-horizontalruler",scope:"Aloha.continuoustext",click:function(){a.insertHR()}});m.bind("aloha-editable-activated",function(){if(m.activeEditable){a.cfg=a.getEditableConfig(m.activeEditable.obj);e.inArray("hr",a.cfg)!=-1?a._insertHorizontalRuleButton.show(true):a._insertHorizontalRuleButton.show(false)}})},insertHR:function(){var a=
m.Selection.getRangeObject();if(m.activeEditable){var b=e("<hr>");j.Utils.Dom.insertIntoDOM(b,a,e(m.activeEditable.obj),true);a.select()}}})});define("paste/paste-plugin","jquery aloha/core aloha/plugin aloha/command contenthandler/contenthandler-utils aloha/console".split(" "),function(m,e,a,g,c,b){function j(a){e.getSelection().removeAllRanges();var b=e.createRange();b.setStart(a.startContainer,a.startOffset);b.setEnd(a.endContainer,a.endOffset);e.getSelection().addRange(b)}function l(){var a=e.getSelection();
return a._nativeSelection._ranges.length?a.getRangeAt(0):null}function f(a,b){b.css({top:q.scrollTop(),left:q.scrollLeft()-200}).contents().remove();var c=e.getEditableHost(m(a.commonAncestorContainer));c&&c.obj.blur();j({startContainer:b[0],endContainer:b[0],startOffset:0,endOffset:0});b.focus()}function k(a,d,f){a.metaKey=null;a.stopPropagation();window.setTimeout(function(){if(d){var g=p.html();o&&/^&nbsp;/.test(g)&&(g=g.substring(6));var k=e.getEditableHost(m(d.commonAncestorContainer));k&&k.obj.focus();
j(d);k=d.startContainer;if(1===k.nodeType?"p"===k.nodeName.toLowerCase()&&c.isProppedParagraph(k.outerHTML):3===k.nodeType&&"p"===k.parentNode.nodeName.toLowerCase()&&1===k.parentNode.childNodes.length&&r.test(window.escape(k.data))){3===d.startContainer.nodeType?d.startContainer.data="":d.startContainer.innerHTML=" ";d.startOffset=0;if(d.endContainer===d.startContainer)d.endOffset=0}e.queryCommandSupported("insertHTML")?e.execCommand("insertHTML",false,g):b.error("Common.Paste",'Command "insertHTML" not available. Enable the plugin "common/commands".')}p.contents().remove();
typeof f==="function"&&f();e.activeEditable.smartContentChange(a)},10)}function d(a){o?a.bind("beforepaste",function(a){u=l();f(u,p);a.stopPropagation()}):a.bind("paste",function(a){var b=l();f(b,p);o&&document.selection.createRange().execCommand("paste");k(a,b)})}var q=m(window),o=!!m.browser.msie,r=/^(\s|%A0)$/,p=m('<div style="position:absolute; clip:rect(0px,0px,0px,0px); width:1px; height:1px;"></div>').contentEditable(true),u=null;return a.create("paste",{settings:{},init:function(){m("body").append(p);
var a=!this.settings.noclipboardaccess;e.bind("aloha-editable-created",function(b,c){d(c.obj,a)});o&&p.bind("paste",function(a){k(a,u,function(){u=null})})},register:function(){b.deprecated("Plugins.Paste","register() for pasteHandler is deprecated.  Use the ContentHandler Plugin instead.")}})});define("toc/nls/i18n",{root:{"button.addtoc.tooltip":"Table of contents"},ca:!0,de:!0,mk:!0,"pt-br":!0,ru:!0,uk:!0,"zh-hans":!0});define("toc/toc-plugin","aloha aloha/plugin jquery ui/ui ui/button i18n!toc/nls/i18n i18n!aloha/nls/i18n aloha/console".split(" "),
function(m,e,a,g,c,b){function j(a,b){return l(a,function(a){return a===b})}function l(a,b){for(var c=0;c<a.length;c++)if(b(a[c]))return a[c];return null}function f(a,b){for(var c=[],d=0;d<a.length;d++)c.push(b(a[d]));return c}function k(a,b){f(a,b)}function d(){return a(f(m.editables,function(a){return document.getElementById(a.getId())}))}function q(b){var c;typeof b=="object"?c=a(b).text().replace(/[^a-zA-Z-]+/g,"-").replace(/^[^a-zA-Z]+/,""):b&&(c=b);for(var d=0;;d++){var f=c;d&&(f=f+("-"+d));
var j=document.getElementById(f);if(!j||typeof b=="object"&&j===b)return f}}var o=window.GENTICS,r=null,p=[];return e.create("toc",{minEntries:0,updateInterval:5E3,config:["toc"],init:function(){var b=this;if(typeof this.settings.minEntries==="undefined")this.settings.minEntries=this.minEntries;if(typeof this.settings.updateInterval==="undefined")this.settings.updateInterval=this.updateInterval;m.bind("aloha-editable-activated",function(){if(m.activeEditable){b.cfg=b.getEditableConfig(m.activeEditable.obj);
a.inArray("toc",b.cfg)!=-1?b._insertTocButton.show(true):b._insertTocButton.show(false)}});this.initButtons();a(document).ready(function(){b.spawn()})},initButtons:function(){var a=this;this._insertTocButton=g.adopt("insertToc",c,{tooltip:b.t("button.addtoc.tooltip"),icon:"aloha-icon aloha-icon-orderedlist",scope:"Aloha.continuoustext",click:function(){a.insertAtSelection(r)}})},register:function(a){r=a},insertAtSelection:function(b){var b=b||d(),c=q("toc"),f=a("<ol class='toc_root'></ol>").attr("id",
c).attr("contentEditable","false"),j=m.Selection.getRangeObject(),g=a(document.getElementById(m.activeEditable.getId()));o.Utils.Dom.insertIntoDOM(f,j,g);this.create(c).register(b).update().tickTock()},spawn:function(b,c){b=b||a("body");c=c||d();b.find("ol.toc_root").each(function(){var b=a(this).attr("id");if(!b){b=q("toc");a(this).attr("id",b)}that.create(b).register(c).tickTock()})},create:function(b){p.push(this);return{id:b,$containers:a(),settings:this.settings,root:function(){return a(document.getElementById(this.id))},
register:function(b){var c=this;c.$containers=c.$containers.add(b);c.$containers.filter(function(){return!a(this).data("toc."+c.id+".listening")}).each(function(){var b=a(this);b.data("toc."+c.id+".listening",true);b.bind("blur",function(){c.cleanupIds(b.get(0));c.update(b)})});return c},tickTock:function(a){var b=this;if(a=a||this.settings.updateInterval){window.setInterval(function(){b.register(d());b.update()},a);return b}},cleanupIds:function(b){var c=[];this.headings(this.$containers).each(function(){var d=
a(this).attr("id");(d&&-1!=a.inArray(d,c)||b&&(a.contains(b,this)||b===this))&&a(this).attr("id",q(this));c.push(d)});return this},update:function(){var a=this,b=this.outline(a.$containers),c=[a.root()];c[c.length-1].empty();(function v(b){var d=[];k(b,function(b){var f=a.linkSection(b[0],c,d);c.push(f);v(b.slice(1));c.pop();d.push(f)})})(b.slice(1));b=a.root().attr("data-TOC-minEntries")||this.settings.minEntries;a.root().find("li").length>=b?a.root().show():a.root().hide();return this},linkSection:function(b,
c,d){var f=b.eq(0).attr("id");if(!f){f=q(b.get(0));b.eq(0).attr("id",f)}var j=this.root(),g=f?j.find('a[href $= "#'+f+'"]'):a();g.length||(g=a("<li><a/></li>"));g.find("a").attr("href","#"+f).text(b.eq(0).text());if(d[d.length-1])d[d.length-1].after(g);else if(c[c.length-1].get(0)==j.get(0))j.append(g);else{b=a("<ol/>").append(g);c[c.length-1].append(b)}return g},outline:function(b){var c=[a()],d=[c];this.headings(b).each(function(){var b=a(this),c=this.nodeName.toLowerCase(),f=["h6","h5","h4","h3",
"h2","h1"],c=a.inArray(c,f),f=f.slice(c).join(","),f=[b.nextUntil(f).andSelf()],c=l(d,function(c){c=c[0];return!c.length||l(c,function(c){return b.get(0)===c||a.contains(c,b.get(0))})});c.push(f);d.splice(0,j(d,c),f)});return c},headings:function(a){return a.find(":header").add(a.filter(":header"))}}}})});define("cite/nls/i18n",{root:{"cite.button.add.quote":"Format selection as quote","cite.button.add.blockquote":"Format selection as blockquote"},ca:!0,de:!0,mk:!0,"pt-br":!0,ru:!0,uk:!0,"zh-hans":!0});
define("cite/cite-plugin","aloha jquery aloha/plugin ui/ui ui/toggleButton format/format-plugin util/dom PubSub i18n!cite/nls/i18n i18n!aloha/nls/i18n".split(" "),function(m,e,a,g,c,b,j,l,f){function k(a,b){return a.replace(/\{([a-z0-9\-\_]+)\}/ig,function(a,c){var d=b[c]||a;return typeof d==="function"?d():d})}function d(){var a=[],b=o;e.each(arguments,function(){a.push("."+(""===this?b:b+"-"+this))});return e.trim(a.join(" "))}function q(){var a=[],b=o;e.each(arguments,function(){a.push(""===this?
b:b+"-"+this)});return e.trim(a.join(" "))}var o="aloha-cite",r=(new Date).getTime(),p={quote:q("quote"),blockquote:q("blockquote"),"panel-label":q("panel-label"),"panel-field":q("panel-field"),"panel-btns":q("panel-btns"),"link-field":q("link-field"),"note-field":q("note-field"),references:q("references")};return a.create("cite",{citations:[],referenceContainer:null,settings:null,sidebar:null,config:["quote","blockquote"],init:function(){var a=this;if(m.settings&&m.settings.plugins&&m.settings.plugins.cite){var j=
e(m.settings.plugins.cite.referenceContainer);if(j.length)a.referenceContainer=j;if(typeof m.settings.plugins.cite!=="undefined")a.settings=m.settings.plugins.cite;if(typeof a.settings.sidebar==="undefined")a.settings.sidebar={};if(typeof a.settings.sidebar.open==="undefined")a.settings.sidebar.open=true;if(typeof a.settings.sidebar.open==="string"){a.settings.sidebar.open=a.settings.sidebar.open.toLowerCase();a.settings.sidebar.open=a.settings.sidebar.open==="false"||a.settings.sidebar.open==="0"?
false:true}}this._quoteButton=g.adopt("quote",c,{tooltip:f.t("cite.button.add.quote"),icon:q("button","inline-button"),scope:"Aloha.continuoustext",click:function(){a.addInlineQuote()}});b.multiSplitButton.pushItem({name:"blockquote",tooltip:f.t("cite.button.add.blockquote"),icon:q("button","block-button"),click:function(){a.addBlockQuote()}});var o=this;m.ready(function(){o.sidebar=m.Sidebar.right.show();o.sidebar.addPanel({id:q("sidebar-panel"),title:"Citation",content:"",expanded:true,activeOn:"q, blockquote",
onInit:function(){var a=this,b="";o.referenceContainer&&(b='<div class="{panel-label}">Note:</div> <div class="{panel-field} {note-field}" style="margin: 5px;"><textarea></textarea></div>');this.setContent(typeof('<div class="{panel-label}">Link:</div><div class="{panel-field} {link-field}" style="margin: 5px;"><input type="text" /></div>'+b)==="string"?k('<div class="{panel-label}">Link:</div><div class="{panel-field} {link-field}" style="margin: 5px;"><input type="text" /></div>'+b,p):'<div class="{panel-label}">Link:</div><div class="{panel-field} {link-field}" style="margin: 5px;"><input type="text" /></div>'+
b).content.find("input, textarea").bind("keypress change",function(){o.addCiteDetails(a.content.attr("data-cite-id"),a.content.find(d("link-field input")).val(),a.content.find(d("note-field textarea")).val())})},onActivate:function(b){var c=b.attr("data-cite-id");if(!c){var c=++r,f=""+q("wrapper");b.addClass(f);b.attr("data-cite-id",c)}f=a.getIndexOfCitation(c);-1===f&&(f=a.citations.push({uid:c,link:null,notes:null})-1);this.content.attr("data-cite-id",c);this.content.find(d("link-field input")).val(b.attr("cite"));
this.content.find(d("note-field textarea")).val(a.citations[f].note)}})});m.bind("aloha-editable-activated",function(c,d){var f=a.getEditableConfig(d.editable.obj);if(f){e.inArray("quote",f)!==-1?a._quoteButton.show(true):a._quoteButton.show(false);e.inArray("blockquote",f)!==-1?b.multiSplitButton.showItem("blockquote"):b.multiSplitButton.hideItem("blockquote")}});l.sub("aloha.selection.context-change",function(c){for(var d=c.range,c=e("button.aloha-cite-button"),f=false,j,d=d.markupEffectiveAtStart,
g=d.length;g;){j=d[--g].nodeName;if(j==="Q"||j==="BLOCKQUOTE"){f=true;break}}c.filter(".aloha-cite-block-button").removeClass("aloha-cite-pressed");a._quoteButton.setState(false);if(f){"Q"===j?a._quoteButton.setState(true):c.filter(".aloha-cite-block-button").addClass("aloha-cite-pressed");return false}j=[];m.activeEditable&&(j=a.getEditableConfig(m.activeEditable.obj));e.inArray("quote",j)!=-1?a._quoteButton.show(true):a._quoteButton.show(false);e.inArray("blockquote",j)!=-1?b.multiSplitButton.showItem("blockquote"):
b.multiSplitButton.hideItem("blockquote")})},getIndexOfCitation:function(a){for(var b=this.citations,c=b.length,d=0,f,j;d<c;){f=d+c>>1;j=b[f].uid;if(j==a)return f;j>a?c=f:j<a&&(d=f+1)}return-1},addBlockQuote:function(){var a=[q("wrapper"),q(++r)].join(" "),a=e(k('<blockquote class="{classes}" data-cite-id="{uid}"></blockquote>',{uid:r,classes:a}));m.activeEditable&&e(m.activeEditable.obj[0]).click();m.Selection.changeMarkupOnSelection(a);this.referenceContainer&&this.addCiteToReferences(r);this.sidebar&&
(this.settings&&this.settings.sidebar&&this.settings.sidebar.open)&&this.sidebar.open()},addInlineQuote:function(){var a=[q("wrapper"),q(++r)].join(" "),b=e(k('<q class="{classes}" data-cite-id="{uid}"></q>',{uid:r,classes:a})),a=m.Selection.rangeObject,c;m.activeEditable&&e(m.activeEditable.obj[0]).click();if(c=a.findMarkup(function(){return this.nodeName&&b.length&&typeof this.nodeName==="string"&&typeof b[0].nodeName==="string"?this.nodeName.toLowerCase()===b[0].nodeName.toLowerCase():false},m.activeEditable.obj))a.isCollapsed()?
j.removeFromDOM(c,a,true):j.removeMarkup(a,b,m.activeEditable.obj);else{a.isCollapsed()&&j.extendToWord(a);j.addMarkup(a,b)}a.select();this.referenceContainer&&this.addCiteToReferences(r);this.sidebar&&(this.settings&&this.settings.sidebar&&this.settings.sidebar.open)&&this.sidebar.open();return false},addCiteToReferences:function(a){var b=this.getIndexOfCitation(a);if(-1!==b){var c=e(".aloha-editable-active "+d(a)),f="cite-note-"+a,a="cite-ref-"+a;c.append(k('<sup id="{ref}" contenteditable="false"><a href="#{note}">[{count}]</a></sup>',
{ref:a,note:f,count:b+1}));0===this.referenceContainer.find("ol.references").length&&this.referenceContainer.append("<h2>References</h2>").append('<ol class="references"></ol>');this.referenceContainer.find("ol.references").append(k('<li id="{note}"><a href="#{ref}">^</a> &nbsp; <span></span></li>',{ref:a,note:f}))}},addCiteDetails:function(a,b,c){this.citations[this.getIndexOfCitation(a)]={uid:a,link:b,note:c};b&&e(d(a)).attr("cite",b);this.referenceContainer&&e("li#cite-note-"+a+" span").html(k(b?
'<a class="external" target="_blank" href="{url}">{url}</a>':"",{url:b})+(c?". "+c:""))},toString:function(){return"aloha-citiation-plugin"},makeClean:function(a){a.find("q, blockquote").each(function(){e.trim(e(this).attr("class"))===""&&e(this).removeAttr("class");if(!this.referenceContainer){e(this).removeClass("aloha-cite-"+e(this).attr("data-cite-id"));e(this).attr("data-cite-id")!=null&&e(this).removeAttr("data-cite-id")}e(this).removeClass("aloha-cite-wrapper")})}})});define("flag-icons/flag-icons-plugin",
[],function(){return{path:Aloha.getPluginUrl("flag-icons")}});define("numerated-headers/nls/i18n",{root:{"headerids.label.target":"Target","headerids.button.reset":"Reset","headerids.button.set":"Set"},ca:!0,de:!0,mk:!0,"pt-br":!0,ru:!0,uk:!0,"zh-hans":!0});define("numerated-headers/numerated-headers-plugin","aloha/core jquery aloha/plugin ui/ui ui/toggleButton i18n!numerated-headers/nls/i18n i18n!aloha/nls/i18n".split(" "),function(m,e,a,g,c,b){var j={};m.bind("aloha-editable-destroyed",function(a,
b){delete j[b.getId()]});return a.create("numerated-headers",{config:{numeratedactive:true,headingselector:"h1, h2, h3, h4, h5, h6",trailingdot:false},init:function(){var a=this;this._formatNumeratedHeadersButton=g.adopt("formatNumeratedHeaders",c,{tooltip:b.t("button.numeratedHeaders.tooltip"),icon:"aloha-icon aloha-icon-numerated-headers",scope:"Aloha.continuoustext",click:function(){a._formatNumeratedHeadersButton.getState()?a.createNumeratedHeaders():a.removeNumerations()}});m.bind("aloha-smart-content-changed",
function(){a.cleanNumerations();a.showNumbers()&&a.createNumeratedHeaders()});m.bind("aloha-format-block",function(){a.cleanNumerations();a.showNumbers()&&a.createNumeratedHeaders()});m.bind("aloha-editable-activated",function(){if(a.isNumeratingOn()){a._formatNumeratedHeadersButton.show();a.initForEditable(m.activeEditable.obj)}else a._formatNumeratedHeadersButton.hide()})},initForEditable:function(a){var b=a.attr("aloha-numerated-headers");if(b!=="true"&&b!=="false"){b=true===this.getCurrentConfig().numeratedactive?
"true":"false";a.attr("aloha-numerated-headers",b)}if(b==="true"){this.createNumeratedHeaders();this._formatNumeratedHeadersButton.setState(true)}else this._formatNumeratedHeadersButton.setState(false)},getCurrentConfig:function(){var a=this.getEditableConfig(m.activeEditable.obj);a.numeratedactive=a.numeratedactive===true||a.numeratedactive==="true"||a.numeratedactive==="1"?true:false;if(typeof a.headingselector!=="string")a.headingselector="h1, h2, h3, h4, h5, h6";a.headingselector=e.trim(a.headingselector);
a.trailingdot=a.trailingdot===true||a.trailingdot==="true"||a.trailingdot==="1"?true:false;return a},isNumeratingOn:function(){return this.getCurrentConfig().headingselector!==""},showNumbers:function(){return m.activeEditable&&this.isNumeratingOn()&&m.activeEditable.obj.attr("aloha-numerated-headers")==="true"},cleanNumerations:function(){var a=this.getBaseElement();a&&this._saveRemoveAnnotations(e(a).find("span[role=annotation]"))},_saveRemoveAnnotations:function(a){var b=this,c=m.Selection.getRangeObject(),
d=false;a.each(function(){if(c.startContainer===this||e.inArray(this,e(c.startContainer).parents())>-1){c.startContainer=b._prevNode(this);c.startOffset=0;d=true}if(c.startContainer===this.parentNode&&c.startOffset>=e(this).index()&&c.startOffset>0){c.startOffset--;d=true}if(c.endContainer===this||e.inArray(this,e(c.endContainer).parents())>-1){c.endContainer=b._prevNode(this);c.endOffset=0;d=true}if(c.endContainer===this.parentNode&&c.endOffset>=e(this).index()&&c.endOffset>0){c.endOffset--;d=true}e(this).remove()});
if(d===true){c.update();c.select()}},_prependAnnotation:function(a,b){var c=m.Selection.getRangeObject(),d=false;if(c.startContainer===b){c.startOffset++;d=true}if(c.endContainer===b){c.endOffset++;d=true}e(b).prepend('<span role="annotation">'+a+"</span>");if(d===true){c.update();c.select()}},_prevNode:function(a){var b=a.previousSibling;if(!b)return a.parentNode;for(;b.lastChild;)b=b.lastChild;return b},removeNumerations:function(){e(m.activeEditable.obj).attr("aloha-numerated-headers","false");
this.cleanNumerations()},getBaseElement:function(){return typeof this.baseobjectSelector!=="undefined"?e(this.baseobjectSelector).length>0?e(this.baseobjectSelector):null:m.activeEditable?m.activeEditable.obj:null},hasNote:function(a){return!a||e(a).length<=0?false:e(a).find("span[role=annotation]").length>0},hasContent:function(a){if(!a||0===e(a).length)return false;a=e(a).clone().find("span[role=annotation]").remove().end();return e.trim(a.text()).length>0},createNumeratedHeaders:function(){var a=
this.getBaseElement();if(a){var b=this.getCurrentConfig(),a=a.find(b.headingselector);m.activeEditable.obj.attr("aloha-numerated-headers","true");if(!(typeof a==="undefined"||a.length===0)){var c=7,d=this;a.each(function(){if(d.hasContent(this)){var a=parseInt(this.nodeName.substr(1),10);a<c&&(c=a)}});if(!(c>6)){var j=null,g=[],r=0,p;for(p=0;p<6-c+1;p++)g[p]=0;a.each(function(){if(d.hasContent(this)){var a=parseInt(this.nodeName.substr(1),10);if(j===null&&a!==c)d._saveRemoveAnnotations(e(this).find("span[role=annotation]"));
else{if(j===null)g[r]++;else if(a>j)g[++r]++;else if(a===j)g[r]++;else if(a<j){var l=a-c,m;for(m=r;m>l;m--)g[m]=0;r=l;g[r]++}j=a;a="";if(b.trailingdot===true){a="";for(l=0;l<g.length;l++)g[l]!==0&&(a=a+(g[l]+"."))}else{a=g[0];for(l=1;l<g.length;l++)g[l]!==0&&(a=a+("."+g[l]))}a=a+"&nbsp;";d.hasNote(this)?e(this).find("span[role=annotation]").html(a):d._prependAnnotation(a,this)}}else d.hasNote(this)&&d._saveRemoveAnnotations(e(this).find("span[role=annotation]"))})}}}}})});define("formatlesspaste/formatlesshandler",
["aloha","jquery","aloha/contenthandlermanager"],function(m,e,a){function g(a,b){a.find(b.join(",")).each(function(){e(this).contents().unwrap()})}return a.createHandler({enabled:!1,handleContent:function(a){var b;"string"===typeof a?b=e("<div>"+a+"</div>"):a instanceof e&&(b=e("<div>").append(a));if(!b.find(".aloha-block").length)return this.enabled&&g(b,this.strippedElements),b.html()}})});define("formatlesspaste/nls/i18n",{root:{"button.formatlessPaste.tooltip":"Toggle Formatless Pasting"},ca:!0,
de:!0,mk:!0,"pt-br":!0,ru:!0,uk:!0,"zh-hans":!0});define("formatlesspaste/formatlesspaste-plugin","aloha/core aloha/plugin jquery ui/ui ui/toggleButton formatlesspaste/formatlesshandler aloha/contenthandlermanager i18n!formatlesspaste/nls/i18n".split(" "),function(m,e,a,g,c,b,j,l){function f(a){return!a?false:typeof a==="string"?"0"!==a&&"false"!==a.toLowerCase():true}function k(a){var b={};if(typeof a.formatlessPasteOption!=="undefined")b.formatlessPasteOption=f(a.formatlessPasteOption);if(typeof a.strippedElements!==
"undefined")b.strippedElements=a.strippedElements;if(typeof a.button!=="undefined")b.button=f(a.button);return b}function d(b,c){a.extend(b,c)}function q(a){j.register("formatless",b);b.strippedElements=a.strippedElements;a._toggleFormatlessPasteButton=g.adopt("toggleFormatlessPaste",c,{tooltip:l.t("button.formatlessPaste.tooltip"),icon:"aloha-icon aloha-icon-formatless-paste",scope:"Aloha.continuoustext",click:function(){b.enabled=!b.enabled}});a._toggleFormatlessPasteButton.show(a.button);if(true===
a.formatlessPasteOption){a._toggleFormatlessPasteButton.setState(true);b.enabled=true}else if(false===a.formatlessPasteOption){a._toggleFormatlessPasteButton.setState(false);b.enabled=false}}function o(a,b){var c=b.getId();if(!c)return null;if(r[c])return r[c];var d=a.getEditableConfig(b.obj);if(!d)return null;r[c]=k(d);return r[c]}var r={};m.bind("aloha-editable-destroyed",function(a,b){var c=b.getId();c&&r[c]&&delete r[c]});return e.create("formatlesspaste",{formatlessPasteOption:false,button:true,
strippedElements:["a","abbr","b","bdi","bdo","cite","code","del","dfn","em","i","ins","kbd","mark","q","rp","rt","ruby","s","samp","small","strong","sub","sup","time","u","var"],init:function(){var a=this;d(a,k(a.settings.config||a.settings));q(a);m.bind("aloha-editable-activated",function(c,d){var f=o(a,d.editable);if(f){var j=a._toggleFormatlessPasteButton;if(true===f.formatlessPasteOption){j.setState(true);b.enabled=true}else if(false===f.formatlessPasteOption){j.setState(false);b.enabled=false}j.show(false!==
f.button)}})}})});(function(){var m=!1,e=/xyz/.test(function(){xyz})?/\b_super\b/:/.*/;this.Class=function(){};Class.extend=function(){function a(){!m&&this.init&&this.init.apply(this,arguments)}var g=this.prototype;m=!0;var c=new this;m=!1;for(var b=0;b<arguments.length;b++){var j=arguments[b],l;for(l in j)c[l]="function"==typeof j[l]&&"function"==typeof g[l]&&e.test(j[l])?function(a,b){return function(){var c=this._super;this._super=g[a];var j=b.apply(this,arguments);this._super=c;return j}}(l,
j[l]):j[l]}a.prototype=c;a.constructor=a;a.extend=arguments.callee;return a}})();"function"===typeof define&&define("Class",[],function(){return Class});define("jstree",["jquery"],function(m){(function(){if(!m||!m.jstree){var e=!1,a=!1,g=!1;(function(c){c.vakata={};c.vakata.css={get_css:function(a,b,c){var a=a.toLowerCase(),f=c.cssRules||c.rules,j=0;do{if(f.length&&j>f.length+5)break;if(f[j].selectorText&&f[j].selectorText.toLowerCase()==a)return!0===b?(c.removeRule&&c.removeRule(j),c.deleteRule&&
c.deleteRule(j),!0):f[j]}while(f[++j]);return!1},add_css:function(a,b){if(c.jstree.css.get_css(a,!1,b))return!1;b.insertRule?b.insertRule(a+" { }",0):b.addRule(a,null,0);return c.vakata.css.get_css(a)},remove_css:function(a,b){return c.vakata.css.get_css(a,!0,b)},add_sheet:function(a){var b=!1,f=!0;if(a.str)return a.title&&(b=c("style[id='"+a.title+"-stylesheet']")[0]),b?f=!1:(b=document.createElement("style"),b.setAttribute("type","text/css"),a.title&&b.setAttribute("id",a.title+"-stylesheet")),
b.styleSheet?f?(document.getElementsByTagName("head")[0].appendChild(b),b.styleSheet.cssText=a.str):b.styleSheet.cssText=b.styleSheet.cssText+" "+a.str:(b.appendChild(document.createTextNode(a.str)),document.getElementsByTagName("head")[0].appendChild(b)),b.sheet||b.styleSheet;if(a.url)if(document.createStyleSheet)try{document.createStyleSheet(a.url)}catch(j){}else return b=document.createElement("link"),b.rel="stylesheet",b.type="text/css",b.media="all",b.href=a.url,document.getElementsByTagName("head")[0].appendChild(b),
b.styleSheet}};var b=[],j=-1,l={},f={};c.fn.jstree=function(a){var d="string"==typeof a,f=Array.prototype.slice.call(arguments,1),j=this;if(d){if("_"==a.substring(0,1))return j;this.each(function(){var d=b[c.data(this,"jstree-instance-id")],d=d&&c.isFunction(d[a])?d[a].apply(d,f):d;if("undefined"!==typeof d&&(0===a.indexOf("is_")||!0!==d&&!1!==d))return j=d,!1})}else this.each(function(){var d=c.data(this,"jstree-instance-id"),j=[],g=a?c.extend({},!0,a):{},e=c(this),m=!1,o=[],j=j.concat(f);e.data("jstree")&&
j.push(e.data("jstree"));g=j.length?c.extend.apply(null,[!0,g].concat(j)):g;"undefined"!==typeof d&&b[d]&&b[d].destroy();d=parseInt(b.push({}),10)-1;c.data(this,"jstree-instance-id",d);g.plugins=c.isArray(g.plugins)?g.plugins:c.jstree.defaults.plugins.slice();g.plugins.unshift("core");g.plugins=g.plugins.sort().join(",,").replace(/(,|^)([^,]+)(,,\2)+(,|$)/g,"$1$2$4").replace(/,,+/g,",").replace(/,$/,"").split(",");m=c.extend(!0,{},c.jstree.defaults,g);m.plugins=g.plugins;c.each(l,function(a){-1===
c.inArray(a,m.plugins)?(m[a]=null,delete m[a]):o.push(a)});m.plugins=o;b[d]=new c.jstree._instance(d,c(this).addClass("jstree jstree-"+d),m);c.each(b[d]._get_settings().plugins,function(a,c){b[d].data[c]={}});c.each(b[d]._get_settings().plugins,function(a,c){l[c]&&l[c].__init.apply(b[d])});setTimeout(function(){b[d].init()},0)});return j};c.jstree={defaults:{plugins:[]},_focused:function(){return b[j]||null},_reference:function(a){if(b[a])return b[a];var d=c(a);!d.length&&"string"===typeof a&&(d=
c("#"+a));return!d.length?null:b[d.closest(".jstree").data("jstree-instance-id")]||null},_instance:function(a,b,f){this.data={core:{}};this.get_settings=function(){return c.extend(!0,{},f)};this._get_settings=function(){return f};this.get_index=function(){return a};this.get_container=function(){return b};this.get_container_ul=function(){return b.children("ul:eq(0)")};this._set_settings=function(a){f=c.extend(!0,{},f,a)}},_fn:{},plugin:function(a,b){b=c.extend({},{__init:c.noop,__destroy:c.noop,_fn:{},
defaults:!1},b);l[a]=b;c.jstree.defaults[a]=b.defaults;c.each(b._fn,function(b,d){d.plugin=a;d.old=c.jstree._fn[b];c.jstree._fn[b]=function(){var a,f=d,j=Array.prototype.slice.call(arguments);a=new c.Event("before.jstree");var g=!1;if(!(!0===this.data.core.locked&&"unlock"!==b&&"is_locked"!==b)){do{if(f&&f.plugin&&-1!==c.inArray(f.plugin,this._get_settings().plugins))break;f=f.old}while(f);if(f){if(0===b.indexOf("_"))a=f.apply(this,j);else{a=this.get_container().triggerHandler(a,{func:b,inst:this,
args:j,plugin:f.plugin});if(!1===a)return;"undefined"!==typeof a&&(j=a);a=f.apply(c.extend({},this,{__callback:function(a){this.get_container().triggerHandler(b+".jstree",{inst:this,args:j,rslt:a,rlbk:g})},__rollback:function(){return g=this.get_rollback()},__call_old:function(a){return f.old.apply(this,a?Array.prototype.slice.call(arguments,1):j)}}),j)}return a}}};c.jstree._fn[b].old=d.old;c.jstree._fn[b].plugin=a})},rollback:function(a){a&&(c.isArray(a)||(a=[a]),c.each(a,function(a,c){b[c.i].set_rollback(c.h,
c.d)}))}};c.jstree._fn=c.jstree._instance.prototype={};c(function(){var b=navigator.userAgent.toLowerCase(),d=(b.match(/.+?(?:rv|it|ra|ie)[\/: ]([\d.]+)/)||[0,"0"])[1],f=".jstree ul, .jstree li { display:block; margin:0 0 0 0; padding:0 0 0 0; list-style-type:none; } .jstree li { display:block; min-height:18px; line-height:18px; white-space:nowrap; margin-left:18px; min-width:18px; } .jstree-rtl li { margin-left:0; margin-right:18px; } .jstree > ul > li { margin-left:0px; } .jstree-rtl > ul > li { margin-right:0px; } .jstree ins { display:inline-block; text-decoration:none; width:18px; height:18px; margin:0 0 0 0; padding:0; } .jstree a { display:inline-block; line-height:16px; height:16px; color:black; white-space:nowrap; text-decoration:none; padding:1px 2px; margin:0; } .jstree a:focus { outline: none; } .jstree a > ins { height:16px; width:16px; } .jstree a > .jstree-icon { margin-right:3px; } .jstree-rtl a > .jstree-icon { margin-left:3px; margin-right:0; } li.jstree-open > ul { display:block; } li.jstree-closed > ul { display:none; } ";
if(/msie/.test(b)&&6==parseInt(d,10)){e=!0;try{document.execCommand("BackgroundImageCache",!1,!0)}catch(j){}f+=".jstree li { height:18px; margin-left:0; margin-right:0; } .jstree li li { margin-left:18px; } .jstree-rtl li li { margin-left:0px; margin-right:18px; } li.jstree-open ul { display:block; } li.jstree-closed ul { display:none !important; } .jstree li a { display:inline; border-width:0 !important; padding:0px 2px !important; } .jstree li a ins { height:16px; width:16px; margin-right:3px; } .jstree-rtl li a ins { margin-right:0px; margin-left:3px; } "}/msie/.test(b)&&
7==parseInt(d,10)&&(a=!0,f+=".jstree li a { border-width:0 !important; padding:0px 2px !important; } ");!/compatible/.test(b)&&(/mozilla/.test(b)&&1.9>parseFloat(d,10))&&(g=!0,f+=".jstree ins { display:-moz-inline-box; } .jstree li { line-height:12px; } .jstree a { display:-moz-inline-box; } .jstree .jstree-no-icons .jstree-checkbox { display:-moz-inline-stack !important; } ");c.vakata.css.add_sheet({str:f,title:"jstree"})});c.jstree.plugin("core",{__init:function(){this.data.core.locked=!1;this.data.core.to_open=
this.get_settings().core.initially_open;this.data.core.to_load=this.get_settings().core.initially_load},defaults:{html_titles:!1,animation:500,initially_open:[],initially_load:[],open_parents:!0,notify_plugins:!0,rtl:!1,load_open:!1,strings:{loading:"Loading ...",new_node:"New node",multiple_selection:"Multiple selection"}},_fn:{init:function(){this.set_focus();this._get_settings().core.rtl&&this.get_container().addClass("jstree-rtl").css("direction","rtl");this.get_container().html("<ul><li class='jstree-last jstree-leaf'><ins>&#160;</ins><a class='jstree-loading' href='#'><ins class='jstree-icon'>&#160;</ins>"+
this._get_string("loading")+"</a></li></ul>");this.data.core.li_height=this.get_container_ul().find("li.jstree-closed, li.jstree-leaf").eq(0).height()||18;this.get_container().delegate("li > ins","click.jstree",c.proxy(function(a){var b=c(a.target);b.is("ins")&&a.pageY-b.offset().top<this.data.core.li_height&&this.toggle_node(b)},this)).bind("mousedown.jstree",c.proxy(function(){this.set_focus()},this)).bind("dblclick.jstree",function(){var a;if(document.selection&&document.selection.empty)document.selection.empty();
else if(window.getSelection){a=window.getSelection();try{a.removeAllRanges(),a.collapse()}catch(b){}}});this._get_settings().core.notify_plugins&&this.get_container().bind("load_node.jstree",c.proxy(function(a,b){var f=this._get_node(b.rslt.obj),j=this;-1===f&&(f=this.get_container_ul());f.length&&f.find("li").each(function(){var a=c(this);a.data("jstree")&&c.each(a.data("jstree"),function(b,d){j.data[b]&&c.isFunction(j["_"+b+"_notify"])&&j["_"+b+"_notify"].call(j,a,d)})})},this));this._get_settings().core.load_open&&
this.get_container().bind("load_node.jstree",c.proxy(function(a,b){var f=this._get_node(b.rslt.obj),j=this;-1===f&&(f=this.get_container_ul());f.length&&f.find("li.jstree-open:not(:has(ul))").each(function(){j.load_node(this,c.noop,c.noop)})},this));this.__callback();this.load_node(-1,function(){this.loaded();this.reload_nodes()})},destroy:function(){var a,d=this.get_index(),f=this._get_settings(),g=this;c.each(f.plugins,function(a,b){try{l[b].__destroy.apply(g)}catch(c){}});this.__callback();if(this.is_focused())for(a in b)if(b.hasOwnProperty(a)&&
a!=d){b[a].set_focus();break}d===j&&(j=-1);this.get_container().unbind(".jstree").undelegate(".jstree").removeData("jstree-instance-id").find("[class^='jstree']").andSelf().attr("class",function(){return this.className.replace(/jstree[^ ]*|$/ig,"")});c(document).unbind(".jstree-"+d).undelegate(".jstree-"+d);b[d]=null;delete b[d]},_core_notify:function(a,b){b.opened&&this.open_node(a,!1,!0)},lock:function(){this.data.core.locked=!0;this.get_container().children("ul").addClass("jstree-locked").css("opacity",
"0.7");this.__callback({})},unlock:function(){this.data.core.locked=!1;this.get_container().children("ul").removeClass("jstree-locked").css("opacity","1");this.__callback({})},is_locked:function(){return this.data.core.locked},save_opened:function(){var a=this;this.data.core.to_open=[];this.get_container_ul().find("li.jstree-open").each(function(){this.id&&a.data.core.to_open.push("#"+this.id.toString().replace(/^#/,"").replace(/\\\//g,"/").replace(/\//g,"\\/").replace(/\\\./g,".").replace(/\./g,
"\\.").replace(/\:/g,"\\:"))});this.__callback(a.data.core.to_open)},save_loaded:function(){},reload_nodes:function(a){var b=this,f=!0,j=[],g=[];a||(this.data.core.reopen=!1,this.data.core.refreshing=!0,this.data.core.to_open=c.map(c.makeArray(this.data.core.to_open),function(a){return"#"+a.toString().replace(/^#/,"").replace(/\\\//g,"/").replace(/\//g,"\\/").replace(/\\\./g,".").replace(/\./g,"\\.").replace(/\:/g,"\\:")}),this.data.core.to_load=c.map(c.makeArray(this.data.core.to_load),function(a){return"#"+
a.toString().replace(/^#/,"").replace(/\\\//g,"/").replace(/\//g,"\\/").replace(/\\\./g,".").replace(/\./g,"\\.").replace(/\:/g,"\\:")}),this.data.core.to_open.length&&(this.data.core.to_load=this.data.core.to_load.concat(this.data.core.to_open)));this.data.core.to_load.length&&(c.each(this.data.core.to_load,function(a,b){if(b=="#")return true;c(b).length?j.push(b):g.push(b)}),j.length&&(this.data.core.to_load=g,c.each(j,function(a,c){if(!b._is_loaded(c)){b.load_node(c,function(){b.reload_nodes(true)},
function(){b.reload_nodes(true)});f=false}})));this.data.core.to_open.length&&c.each(this.data.core.to_open,function(a,c){b.open_node(c,false,true)});f&&(this.data.core.reopen&&clearTimeout(this.data.core.reopen),this.data.core.reopen=setTimeout(function(){b.__callback({},b)},50),this.data.core.refreshing=!1,this.reopen())},reopen:function(){var a=this;this.data.core.to_open.length&&c.each(this.data.core.to_open,function(b,c){a.open_node(c,!1,!0)});this.__callback({})},refresh:function(a){var b=this;
this.save_opened();a||(a=-1);(a=this._get_node(a))||(a=-1);-1!==a?a.children("UL").remove():this.get_container_ul().empty();this.load_node(a,function(){b.__callback({obj:a});b.reload_nodes()})},loaded:function(){this.__callback()},set_focus:function(){if(!this.is_focused()){var a=c.jstree._focused();a&&a.unset_focus();this.get_container().addClass("jstree-focused");j=this.get_index();this.__callback()}},is_focused:function(){return j==this.get_index()},unset_focus:function(){this.is_focused()&&(this.get_container().removeClass("jstree-focused"),
j=-1);this.__callback()},_get_node:function(a){var b=c(a,this.get_container());if(b.is(".jstree")||-1==a)return-1;b=b.closest("li",this.get_container());return b.length?b:!1},_get_next:function(a,b){a=this._get_node(a);return-1===a?this.get_container().find("> ul > li:first-child"):!a.length?!1:b?0<a.nextAll("li").size()?a.nextAll("li:eq(0)"):!1:a.hasClass("jstree-open")?a.find("li:eq(0)"):0<a.nextAll("li").size()?a.nextAll("li:eq(0)"):a.parentsUntil(".jstree","li").next("li").eq(0)},_get_prev:function(a,
b){a=this._get_node(a);if(-1===a)return this.get_container().find("> ul > li:last-child");if(!a.length)return!1;if(b)return 0<a.prevAll("li").length?a.prevAll("li:eq(0)"):!1;if(a.prev("li").length){for(a=a.prev("li").eq(0);a.hasClass("jstree-open");)a=a.children("ul:eq(0)").children("li:last");return a}var c=a.parentsUntil(".jstree","li:eq(0)");return c.length?c:!1},_get_parent:function(a){a=this._get_node(a);if(-1==a||!a.length)return!1;a=a.parentsUntil(".jstree","li:eq(0)");return a.length?a:-1},
_get_children:function(a){a=this._get_node(a);return-1===a?this.get_container().children("ul:eq(0)").children("li"):!a.length?!1:a.children("ul:eq(0)").children("li")},get_path:function(a,b){var c=[],f=this,a=this._get_node(a);if(-1===a||!a||!a.length)return!1;a.parentsUntil(".jstree","li").each(function(){c.push(b?this.id:f.get_text(this))});c.reverse();c.push(b?a.attr("id"):this.get_text(a));return c},_get_string:function(a){return this._get_settings().core.strings[a]||a},is_open:function(a){return(a=
this._get_node(a))&&-1!==a&&a.hasClass("jstree-open")},is_closed:function(a){return(a=this._get_node(a))&&-1!==a&&a.hasClass("jstree-closed")},is_leaf:function(a){return(a=this._get_node(a))&&-1!==a&&a.hasClass("jstree-leaf")},correct_state:function(a){a=this._get_node(a);if(!a||-1===a)return!1;a.removeClass("jstree-closed jstree-open").addClass("jstree-leaf").children("ul").remove();this.__callback({obj:a})},open_node:function(a,b,c){a=this._get_node(a);if(!a.length)return!1;if(!a.hasClass("jstree-closed"))return b&&
b.call(),!1;var f=c||e?0:this._get_settings().core.animation,j=this;this._is_loaded(a)?(this._get_settings().core.open_parents&&a.parentsUntil(".jstree",".jstree-closed").each(function(){j.open_node(this,!1,!0)}),f&&a.children("ul").css("display","none"),a.removeClass("jstree-closed").addClass("jstree-open").children("a").removeClass("jstree-loading"),f?a.children("ul").stop(!0,!0).slideDown(f,function(){this.style.display="";j.after_open(a)}):j.after_open(a),this.__callback({obj:a}),b&&b.call()):
(a.children("a").addClass("jstree-loading"),this.load_node(a,function(){j.open_node(a,b,c)},b))},after_open:function(a){this.__callback({obj:a})},close_node:function(a,b){var a=this._get_node(a),c=b||e?0:this._get_settings().core.animation,f=this;if(!a.length||!a.hasClass("jstree-open"))return!1;c&&a.children("ul").attr("style","display:block !important");a.removeClass("jstree-open").addClass("jstree-closed");c?a.children("ul").stop(!0,!0).slideUp(c,function(){this.style.display="";f.after_close(a)}):
f.after_close(a);this.__callback({obj:a})},after_close:function(a){this.__callback({obj:a})},toggle_node:function(a){a=this._get_node(a);if(a.hasClass("jstree-closed"))return this.open_node(a);if(a.hasClass("jstree-open"))return this.close_node(a)},open_all:function(a,b,c){a=a?this._get_node(a):-1;if(!a||-1===a)a=this.get_container_ul();c?a=a.find("li.jstree-closed"):(c=a,a=a.is(".jstree-closed")?a.find("li.jstree-closed").andSelf():a.find("li.jstree-closed"));var f=this;a.each(function(){var a=this;
f._is_loaded(this)?f.open_node(this,false,!b):f.open_node(this,function(){f.open_all(a,b,c)},!b)});0===c.find("li.jstree-closed").length&&this.__callback({obj:c})},close_all:function(a,b){var c=this,a=a?this._get_node(a):this.get_container();if(!a||-1===a)a=this.get_container_ul();a.find("li.jstree-open").andSelf().each(function(){c.close_node(this,!b)});this.__callback({obj:a})},clean_node:function(a){a=a&&-1!=a?c(a):this.get_container_ul();a=a.is("li")?a.find("li").andSelf():a.find("li");a.removeClass("jstree-last").filter("li:last-child").addClass("jstree-last").end().filter(":has(li)").not(".jstree-open").removeClass("jstree-leaf").addClass("jstree-closed");
a.not(".jstree-open, .jstree-closed").addClass("jstree-leaf").children("ul").remove();this.__callback({obj:a})},get_rollback:function(){this.__callback();return{i:this.get_index(),h:this.get_container().children("ul").clone(!0),d:this.data}},set_rollback:function(a,b){this.get_container().empty().append(a);this.data=b;this.__callback()},load_node:function(a){this.__callback({obj:a})},_is_loaded:function(){return!0},create_node:function(a,b,f,j,g){var a=this._get_node(a),b="undefined"===typeof b?"last":
b,e=c("<li />"),l=this._get_settings().core,m;if(-1!==a&&!a.length)return!1;if(!g&&!this._is_loaded(a))return this.load_node(a,function(){this.create_node(a,b,f,j,!0)}),!1;this.__rollback();"string"===typeof f&&(f={data:f});f||(f={});f.attr&&e.attr(f.attr);f.metadata&&e.data(f.metadata);f.state&&e.addClass("jstree-"+f.state);f.data||(f.data=this._get_string("new_node"));c.isArray(f.data)||(m=f.data,f.data=[],f.data.push(m));c.each(f.data,function(a,b){m=c("<a />");c.isFunction(b)&&(b=b.call(this,
f));if(typeof b=="string")m.attr("href","#")[l.html_titles?"html":"text"](b);else{if(!b.attr)b.attr={};if(!b.attr.href)b.attr.href="#";m.attr(b.attr)[l.html_titles?"html":"text"](b.title);b.language&&m.addClass(b.language)}m.prepend("<ins class='jstree-icon'>&#160;</ins>");b.icon&&(b.icon.indexOf("/")===-1?m.children("ins").addClass(b.icon):m.children("ins").css("background","url('"+b.icon+"') center center no-repeat"));e.append(m)});e.prepend("<ins class='jstree-icon'>&#160;</ins>");-1===a&&(a=this.get_container(),
"before"===b&&(b="first"),"after"===b&&(b="last"));switch(b){case "before":a.before(e);m=this._get_parent(a);break;case "after":a.after(e);m=this._get_parent(a);break;case "inside":case "first":a.children("ul").length||a.append("<ul />");a.children("ul").prepend(e);m=a;break;case "last":a.children("ul").length||a.append("<ul />");a.children("ul").append(e);m=a;break;default:a.children("ul").length||a.append("<ul />"),b||(b=0),m=a.children("ul").children("li").eq(b),m.length?m.before(e):a.children("ul").append(e),
m=a}if(-1===m||m.get(0)===this.get_container().get(0))m=-1;this.clean_node(m);this.__callback({obj:e,parent:m});j&&j.call(this,e);return e},get_text:function(a){a=this._get_node(a);if(!a.length)return!1;var b=this._get_settings().core.html_titles,a=a.children("a:eq(0)");if(b)return a=a.clone(),a.children("INS").remove(),a.html();a=a.contents().filter(function(){return 3==this.nodeType})[0];return a.nodeValue},set_text:function(a,b){a=this._get_node(a);if(!a.length)return!1;a=a.children("a:eq(0)");
if(this._get_settings().core.html_titles){var c=a.children("INS").clone();a.html(b).prepend(c);this.__callback({obj:a,name:b});return!0}a=a.contents().filter(function(){return 3==this.nodeType})[0];this.__callback({obj:a,name:b});return a.nodeValue=b},rename_node:function(a,b){a=this._get_node(a);this.__rollback();a&&(a.length&&this.set_text.apply(this,Array.prototype.slice.call(arguments)))&&this.__callback({obj:a,name:b})},delete_node:function(a){a=this._get_node(a);if(!a.length)return!1;this.__rollback();
var b=this._get_parent(a),f=c([]),j=this;a.each(function(){f=f.add(j._get_prev(this))});a=a.detach();-1!==b&&0===b.find("> ul > li").length&&b.removeClass("jstree-open jstree-closed").addClass("jstree-leaf");this.clean_node(b);this.__callback({obj:a,prev:f,parent:b});return a},prepare_move:function(a,b,j,g,e){var l={};l.ot=c.jstree._reference(a)||this;l.o=l.ot._get_node(a);l.r=-1===b?-1:this._get_node(b);l.p="undefined"===typeof j||!1===j?"last":j;if(e||!f.o||!(f.o[0]===l.o[0]&&f.r[0]===l.r[0]&&f.p===
l.p)){l.ot=c.jstree._reference(l.o)||this;l.rt=c.jstree._reference(l.r)||this;if(-1===l.r||!l.r)switch(l.cr=-1,l.p){case "first":case "before":case "inside":l.cp=0;break;case "after":case "last":l.cp=l.rt.get_container().find(" > ul > li").length;break;default:l.cp=l.p}else{if(!/^(before|after)$/.test(l.p)&&!this._is_loaded(l.r))return this.load_node(l.r,function(){this.prepare_move(a,b,j,g,!0)});switch(l.p){case "before":l.cp=l.r.index();l.cr=l.rt._get_parent(l.r);break;case "after":l.cp=l.r.index()+
1;l.cr=l.rt._get_parent(l.r);break;case "inside":case "first":l.cp=0;l.cr=l.r;break;case "last":l.cp=l.r.find(" > ul > li").length;l.cr=l.r;break;default:l.cp=l.p,l.cr=l.r}}l.np=-1==l.cr?l.rt.get_container():l.cr;l.op=l.ot._get_parent(l.o);l.cop=l.o.index();-1===l.op&&(l.op=l.ot?l.ot.get_container():this.get_container());!/^(before|after)$/.test(l.p)&&(l.op&&l.np&&l.op[0]===l.np[0]&&l.o.index()<l.cp)&&l.cp++;l.or=l.np.find(" > ul > li:nth-child("+(l.cp+1)+")");f=l}this.__callback(f);g&&g.call(this,
f)},check_move:function(){var a=f,b=!0,c=-1===a.r?this.get_container():a.r;if(!a||(!a.o||a.or[0]===a.o[0])||a.op&&a.np&&a.op[0]===a.np[0]&&a.cp-1===a.o.index())return!1;a.o.each(function(){if(-1!==c.parentsUntil(".jstree","li").andSelf().index(this))return b=!1});return b},move_node:function(a,b,j,g,e,l){if(!e)return this.prepare_move(a,b,j,function(a){this.move_node(a,!1,!1,g,!0,l)});g&&(f.cy=!0);if(!l&&!this.check_move())return!1;this.__rollback();b=!1;g?(b=a.o.clone(!0),b.find("*[id]").andSelf().each(function(){if(this.id)this.id=
"copy_"+this.id})):b=a.o;a.or.length?a.or.before(b):(a.np.children("ul").length||c("<ul />").appendTo(a.np),a.np.children("ul:eq(0)").append(b));try{a.ot.clean_node(a.op),a.rt.clean_node(a.np),a.op.find("> ul > li").length||a.op.removeClass("jstree-open jstree-closed").addClass("jstree-leaf").children("ul").remove()}catch(m){}g&&(f.cy=!0,f.oc=b);this.__callback(f);return f},_get_move:function(){return f}}})})(m);(function(a){var b,j,g;a(function(){/msie/.test(navigator.userAgent.toLowerCase())?(j=
a('<textarea cols="10" rows="2"></textarea>').css({position:"absolute",top:-1E3,left:0}).appendTo("body"),g=a('<textarea cols="10" rows="2" style="overflow: hidden;"></textarea>').css({position:"absolute",top:-1E3,left:0}).appendTo("body"),b=j.width()-g.width(),j.add(g).remove()):(j=a("<div />").css({width:100,height:100,overflow:"auto",position:"absolute",top:-1E3,left:0}).prependTo("body").append("<div />").find("div").css({width:"100%",height:200}),b=100-j.width(),j.parent().remove())});a.jstree.plugin("ui",
{__init:function(){this.data.ui.selected=a();this.data.ui.last_selected=!1;this.data.ui.hovered=null;this.data.ui.to_select=this.get_settings().ui.initially_select;this.get_container().delegate("a","click.jstree",a.proxy(function(b){b.preventDefault();b.currentTarget.blur();a(b.currentTarget).hasClass("jstree-loading")||this.select_node(b.currentTarget,!0,b)},this)).delegate("a","mouseenter.jstree",a.proxy(function(b){a(b.currentTarget).hasClass("jstree-loading")||this.hover_node(b.target)},this)).delegate("a",
"mouseleave.jstree",a.proxy(function(b){a(b.currentTarget).hasClass("jstree-loading")||this.dehover_node(b.target)},this)).bind("reopen.jstree",a.proxy(function(){this.reselect()},this)).bind("get_rollback.jstree",a.proxy(function(){this.dehover_node();this.save_selected()},this)).bind("set_rollback.jstree",a.proxy(function(){this.reselect()},this)).bind("close_node.jstree",a.proxy(function(b,j){var d=this._get_settings().ui,g=this._get_node(j.rslt.obj),e=g&&g.length?g.children("ul").find("a.jstree-clicked"):
a(),l=this;!1!==d.selected_parent_close&&e.length&&e.each(function(){l.deselect_node(this);"select_parent"===d.selected_parent_close&&l.select_node(g)})},this)).bind("delete_node.jstree",a.proxy(function(a,b){var c=this._get_settings().ui.select_prev_on_delete,j=this._get_node(b.rslt.obj),j=j&&j.length?j.find("a.jstree-clicked"):[],g=this;j.each(function(){g.deselect_node(this)});c&&j.length&&b.rslt.prev.each(function(){if(this.parentNode)return g.select_node(this),!1})},this)).bind("move_node.jstree",
a.proxy(function(a,b){b.rslt.cy&&b.rslt.oc.find("a.jstree-clicked").removeClass("jstree-clicked")},this))},defaults:{select_limit:-1,select_multiple_modifier:"ctrl",select_range_modifier:"shift",selected_parent_close:"select_parent",selected_parent_open:!0,select_prev_on_delete:!0,disable_selecting_children:!1,initially_select:[]},_fn:{_get_node:function(b,j){if("undefined"===typeof b||null===b)return j?this.data.ui.selected:this.data.ui.last_selected;var d=a(b,this.get_container());if(d.is(".jstree")||
-1==b)return-1;d=d.closest("li",this.get_container());return d.length?d:!1},_ui_notify:function(a,b){b.selected&&this.select_node(a,!1)},save_selected:function(){var a=this;this.data.ui.to_select=[];this.data.ui.selected.each(function(){this.id&&a.data.ui.to_select.push("#"+this.id.toString().replace(/^#/,"").replace(/\\\//g,"/").replace(/\//g,"\\/").replace(/\\\./g,".").replace(/\./g,"\\.").replace(/\:/g,"\\:"))});this.__callback(this.data.ui.to_select)},reselect:function(){var b=this,j=this.data.ui.to_select,
j=a.map(a.makeArray(j),function(a){return"#"+a.toString().replace(/^#/,"").replace(/\\\//g,"/").replace(/\//g,"\\/").replace(/\\\./g,".").replace(/\./g,"\\.").replace(/\:/g,"\\:")});a.each(j,function(a,c){c&&"#"!==c&&b.select_node(c)});this.data.ui.selected=this.data.ui.selected.filter(function(){return this.parentNode});this.__callback()},refresh:function(){this.save_selected();return this.__call_old()},hover_node:function(a){a=this._get_node(a);if(!a.length)return!1;a.hasClass("jstree-hovered")||
this.dehover_node();this.data.ui.hovered=a.children("a").addClass("jstree-hovered").parent();this._fix_scroll(a);this.__callback({obj:a})},dehover_node:function(){var a=this.data.ui.hovered;if(!a||!a.length)return!1;this.data.ui.hovered[0]===a.children("a").removeClass("jstree-hovered").parent()[0]&&(this.data.ui.hovered=null);this.__callback({obj:a})},select_node:function(a,b,c){a=this._get_node(a);if(-1==a||!a||!a.length)return!1;var j=this._get_settings().ui,g="on"==j.select_multiple_modifier||
!1!==j.select_multiple_modifier&&c&&c[j.select_multiple_modifier+"Key"],e=!1!==j.select_range_modifier&&c&&c[j.select_range_modifier+"Key"]&&this.data.ui.last_selected&&this.data.ui.last_selected[0]!==a[0]&&this.data.ui.last_selected.parent()[0]===a.parent()[0],l=this.is_selected(a),m=!0,t=this;if(b){if(j.disable_selecting_children&&g&&(a.parentsUntil(".jstree","li").children("a.jstree-clicked").length||a.children("ul").find("a.jstree-clicked:eq(0)").length))return!1;m=!1;switch(!0){case e:this.data.ui.last_selected.addClass("jstree-last-selected");
a=a[a.index()<this.data.ui.last_selected.index()?"nextUntil":"prevUntil"](".jstree-last-selected").andSelf();-1==j.select_limit||a.length<j.select_limit?(this.data.ui.last_selected.removeClass("jstree-last-selected"),this.data.ui.selected.each(function(){this!==t.data.ui.last_selected[0]&&t.deselect_node(this)}),l=!1,m=!0):m=!1;break;case l&&!g:this.deselect_all();l=!1;m=!0;break;case !l&&!g:if(-1==j.select_limit||0<j.select_limit)this.deselect_all(),m=!0;break;case l&&g:this.deselect_node(a);break;
case !l&&g:if(-1==j.select_limit||this.data.ui.selected.length+1<=j.select_limit)m=!0}}m&&!l&&(e||(this.data.ui.last_selected=a),a.children("a").addClass("jstree-clicked"),j.selected_parent_open&&a.parents(".jstree-closed").each(function(){t.open_node(this,false,true)}),this.data.ui.selected=this.data.ui.selected.add(a),this._fix_scroll(a.eq(0)),this.__callback({obj:a,e:c}))},_fix_scroll:function(a){var c=this.get_container()[0];if(c.scrollHeight>c.offsetHeight&&(a=this._get_node(a))&&!(-1===a||!a.length||
!a.is(":visible")))if(a=a.offset().top-this.get_container().offset().top,0>a&&(c.scrollTop=c.scrollTop+a-1),a+this.data.core.li_height+(c.scrollWidth>c.offsetWidth?b:0)>c.offsetHeight)c.scrollTop+=a-c.offsetHeight+this.data.core.li_height+1+(c.scrollWidth>c.offsetWidth?b:0)},deselect_node:function(a){a=this._get_node(a);if(!a.length)return!1;this.is_selected(a)&&(a.children("a").removeClass("jstree-clicked"),this.data.ui.selected=this.data.ui.selected.not(a),this.data.ui.last_selected.get(0)===a.get(0)&&
(this.data.ui.last_selected=this.data.ui.selected.eq(0)),this.__callback({obj:a}))},toggle_select:function(a){a=this._get_node(a);if(!a.length)return!1;this.is_selected(a)?this.deselect_node(a):this.select_node(a)},is_selected:function(a){return 0<=this.data.ui.selected.index(this._get_node(a))},get_selected:function(b){return b?a(b).find("a.jstree-clicked").parent():this.data.ui.selected},deselect_all:function(b){b=b?a(b).find("a.jstree-clicked").parent():this.get_container().find("a.jstree-clicked").parent();
b.children("a.jstree-clicked").removeClass("jstree-clicked");this.data.ui.selected=a([]);this.data.ui.last_selected=!1;this.__callback({obj:b})}}});a.jstree.defaults.plugins.push("ui")})(m);(function(a){a.jstree.plugin("crrm",{__init:function(){this.get_container().bind("move_node.jstree",a.proxy(function(a,c){if(this._get_settings().crrm.move.open_onmove){var g=this;c.rslt.np.parentsUntil(".jstree").andSelf().filter(".jstree-closed").each(function(){g.open_node(this,!1,!0)})}},this))},defaults:{input_width_limit:200,
move:{always_copy:!1,open_onmove:!0,default_position:"last",check_move:function(){return!0}}},_fn:{_show_input:function(b,j){var b=this._get_node(b),g=this._get_settings().core.rtl,f=this._get_settings().crrm.input_width_limit,e=b.children("ins").width(),d=b.find("> a:visible > ins").width()*b.find("> a:visible > ins").length,m=this.get_text(b),o=a("<div />",{css:{position:"absolute",top:"-200px",left:g?"0px":"-1000px",visibility:"hidden"}}).appendTo("body"),r=b.css("position","relative").append(a("<input />",
{value:m,"class":"jstree-rename-input",css:{padding:"0",border:"1px solid silver",position:"absolute",left:g?"auto":e+d+4+"px",right:g?e+d+4+"px":"auto",top:"0px",height:this.data.core.li_height-2+"px",lineHeight:this.data.core.li_height-2+"px",width:"150px"},blur:a.proxy(function(){var a=b.children(".jstree-rename-input"),c=a.val();""===c&&(c=m);o.remove();a.remove();this.set_text(b,m);this.rename_node(b,c);j.call(this,b,c,m);b.css("position","")},this),keyup:function(a){a=a.keyCode||a.which;27==
a?(this.value=m,this.blur()):13==a?this.blur():r.width(Math.min(o.text("pW"+this.value).width(),f))},keypress:function(a){if(13==(a.keyCode||a.which))return!1}})).children(".jstree-rename-input");this.set_text(b,"");o.css({fontFamily:r.css("fontFamily")||"",fontSize:r.css("fontSize")||"",fontWeight:r.css("fontWeight")||"",fontStyle:r.css("fontStyle")||"",fontStretch:r.css("fontStretch")||"",fontVariant:r.css("fontVariant")||"",letterSpacing:r.css("letterSpacing")||"",wordSpacing:r.css("wordSpacing")||
""});r.width(Math.min(o.text("pW"+r[0].value).width(),f))[0].select()},rename:function(a){a=this._get_node(a);this.__rollback();var c=this.__callback;this._show_input(a,function(a,b,g){c.call(this,{obj:a,new_name:b,old_name:g})})},create:function(b,j,g,f,e){var d=this;(b=this._get_node(b))||(b=-1);this.__rollback();return this.create_node(b,j,g,function(b){var j=this._get_parent(b),g=a(b).index();f&&f.call(this,b);j.length&&j.hasClass("jstree-closed")&&this.open_node(j,!1,!0);e?d.__callback({obj:b,
name:this.get_text(b),parent:j,position:g}):this._show_input(b,function(a,b){d.__callback({obj:a,name:b,parent:j,position:g})})})},remove:function(a){var a=this._get_node(a,!0),c=this._get_parent(a),g=this._get_prev(a);this.__rollback();a=this.delete_node(a);!1!==a&&this.__callback({obj:a,prev:g,parent:c})},check_move:function(){return!this.__call_old()||!this._get_settings().crrm.move.check_move.call(this,this._get_move())?!1:!0},move_node:function(a,c,g,f,e,d){var m=this._get_settings().crrm.move;
if(!e)return"undefined"===typeof g&&(g=m.default_position),"inside"===g&&!m.default_position.match(/^(before|after)$/)&&(g=m.default_position),this.__call_old(!0,a,c,g,f,!1,d);if(!0===m.always_copy||"multitree"===m.always_copy&&a.rt.get_index()!==a.ot.get_index())f=!0;this.__call_old(!0,a,c,g,f,!0,d)},cut:function(a){a=this._get_node(a,!0);if(!a||!a.length)return!1;this.data.crrm.cp_nodes=!1;this.data.crrm.ct_nodes=a;this.__callback({obj:a})},copy:function(a){a=this._get_node(a,!0);if(!a||!a.length)return!1;
this.data.crrm.ct_nodes=!1;this.data.crrm.cp_nodes=a;this.__callback({obj:a})},paste:function(a){a=this._get_node(a);if(!a||!a.length)return!1;var c=this.data.crrm.ct_nodes?this.data.crrm.ct_nodes:this.data.crrm.cp_nodes;if(!this.data.crrm.ct_nodes&&!this.data.crrm.cp_nodes)return!1;this.data.crrm.ct_nodes&&(this.move_node(this.data.crrm.ct_nodes,a),this.data.crrm.ct_nodes=!1);this.data.crrm.cp_nodes&&this.move_node(this.data.crrm.cp_nodes,a,!1,!0);this.__callback({obj:a,nodes:c})}}})})(m);(function(a){var b=
[];a.jstree._themes=!1;a.jstree.plugin("themes",{__init:function(){this.get_container().bind("init.jstree",a.proxy(function(){var a=this._get_settings().themes;this.data.themes.dots=a.dots;this.data.themes.icons=a.icons;this.set_theme(a.theme,a.url)},this)).bind("loaded.jstree",a.proxy(function(){this.data.themes.dots?this.show_dots():this.hide_dots();this.data.themes.icons?this.show_icons():this.hide_icons()},this))},defaults:{theme:"default",url:!1,dots:!0,icons:!0},_fn:{set_theme:function(j,g){if(!j)return!1;
g||(g=a.jstree._themes+j+"/style.css");-1==a.inArray(g,b)&&(a.vakata.css.add_sheet({url:g}),b.push(g));this.data.themes.theme!=j&&(this.get_container().removeClass("jstree-"+this.data.themes.theme),this.data.themes.theme=j);this.get_container().addClass("jstree-"+j);this.data.themes.dots?this.show_dots():this.hide_dots();this.data.themes.icons?this.show_icons():this.hide_icons();this.__callback()},get_theme:function(){return this.data.themes.theme},show_dots:function(){this.data.themes.dots=!0;this.get_container().children("ul").removeClass("jstree-no-dots")},
hide_dots:function(){this.data.themes.dots=!1;this.get_container().children("ul").addClass("jstree-no-dots")},toggle_dots:function(){this.data.themes.dots?this.hide_dots():this.show_dots()},show_icons:function(){this.data.themes.icons=!0;this.get_container().children("ul").removeClass("jstree-no-icons")},hide_icons:function(){this.data.themes.icons=!1;this.get_container().children("ul").addClass("jstree-no-icons")},toggle_icons:function(){this.data.themes.icons?this.hide_icons():this.show_icons()}}});
a(function(){!1===a.jstree._themes&&a("script").each(function(){if(this.src.toString().match(/jquery\.jstree[^\/]*?\.js(\?.*)?$/))return a.jstree._themes=this.src.toString().replace(/jquery\.jstree[^\/]*?\.js(\?.*)?$/,"")+"themes/",!1});!1===a.jstree._themes&&(a.jstree._themes="themes/")});a.jstree.defaults.plugins.push("themes")})(m);(function(a){var b=[];a.jstree.plugin("hotkeys",{__init:function(){if("undefined"===typeof a.hotkeys)throw"jsTree hotkeys: jQuery hotkeys plugin not included.";if(!this.data.ui)throw"jsTree hotkeys: jsTree UI plugin not included.";
a.each(this._get_settings().hotkeys,function(j,g){!1!==g&&-1==a.inArray(j,b)&&(a(document).bind("keydown",j,function(b){var g;var d=a.jstree._focused(),e;d&&d.data&&d.data.hotkeys&&d.data.hotkeys.enabled&&(e=d._get_settings().hotkeys[j])&&(g=e.call(d,b));return g}),b.push(j))});this.get_container().bind("lock.jstree",a.proxy(function(){this.data.hotkeys.enabled&&(this.data.hotkeys.enabled=!1,this.data.hotkeys.revert=!0)},this)).bind("unlock.jstree",a.proxy(function(){this.data.hotkeys.revert&&(this.data.hotkeys.enabled=
!0)},this));this.enable_hotkeys()},defaults:{up:function(){this.hover_node(this._get_prev(this.data.ui.hovered||this.data.ui.last_selected||-1));return!1},"ctrl+up":function(){this.hover_node(this._get_prev(this.data.ui.hovered||this.data.ui.last_selected||-1));return!1},"shift+up":function(){this.hover_node(this._get_prev(this.data.ui.hovered||this.data.ui.last_selected||-1));return!1},down:function(){this.hover_node(this._get_next(this.data.ui.hovered||this.data.ui.last_selected||-1));return!1},
"ctrl+down":function(){this.hover_node(this._get_next(this.data.ui.hovered||this.data.ui.last_selected||-1));return!1},"shift+down":function(){this.hover_node(this._get_next(this.data.ui.hovered||this.data.ui.last_selected||-1));return!1},left:function(){var a=this.data.ui.hovered||this.data.ui.last_selected;a&&(a.hasClass("jstree-open")?this.close_node(a):this.hover_node(this._get_prev(a)));return!1},"ctrl+left":function(){var a=this.data.ui.hovered||this.data.ui.last_selected;a&&(a.hasClass("jstree-open")?
this.close_node(a):this.hover_node(this._get_prev(a)));return!1},"shift+left":function(){var a=this.data.ui.hovered||this.data.ui.last_selected;a&&(a.hasClass("jstree-open")?this.close_node(a):this.hover_node(this._get_prev(a)));return!1},right:function(){var a=this.data.ui.hovered||this.data.ui.last_selected;a&&a.length&&(a.hasClass("jstree-closed")?this.open_node(a):this.hover_node(this._get_next(a)));return!1},"ctrl+right":function(){var a=this.data.ui.hovered||this.data.ui.last_selected;a&&a.length&&
(a.hasClass("jstree-closed")?this.open_node(a):this.hover_node(this._get_next(a)));return!1},"shift+right":function(){var a=this.data.ui.hovered||this.data.ui.last_selected;a&&a.length&&(a.hasClass("jstree-closed")?this.open_node(a):this.hover_node(this._get_next(a)));return!1},space:function(){this.data.ui.hovered&&this.data.ui.hovered.children("a:eq(0)").click();return!1},"ctrl+space":function(a){a.type="click";this.data.ui.hovered&&this.data.ui.hovered.children("a:eq(0)").trigger(a);return!1},
"shift+space":function(a){a.type="click";this.data.ui.hovered&&this.data.ui.hovered.children("a:eq(0)").trigger(a);return!1},f2:function(){this.rename(this.data.ui.hovered||this.data.ui.last_selected)},del:function(){this.remove(this.data.ui.hovered||this._get_node(null))}},_fn:{enable_hotkeys:function(){this.data.hotkeys.enabled=!0},disable_hotkeys:function(){this.data.hotkeys.enabled=!1}}})})(m);(function(a){a.jstree.plugin("json_data",{__init:function(){this._get_settings().json_data.progressive_unload&&
this.get_container().bind("after_close.jstree",function(a,c){c.rslt.obj.children("ul").remove()})},defaults:{data:!1,ajax:!1,correct_state:!0,progressive_render:!1,progressive_unload:!1},_fn:{load_node:function(a,c,g){var f=this;this.load_node_json(a,function(){f.__callback({obj:f._get_node(a)});c.call(this)},g)},_is_loaded:function(b){var j=this._get_settings().json_data,b=this._get_node(b);return-1==b||!b||!j.ajax&&!j.progressive_render&&!a.isFunction(j.data)||b.is(".jstree-open, .jstree-leaf")||
0<b.children("ul").children("li").length},refresh:function(b){var b=this._get_node(b),j=this._get_settings().json_data;b&&(-1!==b&&j.progressive_unload&&(a.isFunction(j.data)||j.ajax))&&b.removeData("jstree-children");return this.__call_old()},load_node_json:function(b,j,g){var f=this.get_settings().json_data,e,d=function(){};e=function(){};if((b=this._get_node(b))&&-1!==b&&(f.progressive_render||f.progressive_unload)&&!b.is(".jstree-open, .jstree-leaf")&&0===b.children("ul").children("li").length&&
b.data("jstree-children")){if(e=this._parse_json(b.data("jstree-children"),b))b.append(e),f.progressive_unload||b.removeData("jstree-children");this.clean_node(b);j&&j.call(this)}else{if(b&&-1!==b){if(b.data("jstree-is-loading"))return;b.data("jstree-is-loading",!0)}switch(!0){case !f.data&&!f.ajax:throw"Neither data nor ajax settings supplied.";case a.isFunction(f.data):f.data.call(this,b,a.proxy(function(a){if(a=this._parse_json(a,b)){if(b===-1||!b)this.get_container().children("ul").empty().append(a.children());
else{b.append(a).children("a.jstree-loading").removeClass("jstree-loading");b.removeData("jstree-is-loading")}this.clean_node(b);j&&j.call(this)}else{if(b===-1||!b)f.correct_state&&this.get_container().children("ul").empty();else{b.children("a.jstree-loading").removeClass("jstree-loading");b.removeData("jstree-is-loading");f.correct_state&&this.correct_state(b)}g&&g.call(this)}},this));break;case !!f.data&&!f.ajax||!!f.data&&!!f.ajax&&(!b||-1===b):if(!b||-1==b)(e=this._parse_json(f.data,b))?(this.get_container().children("ul").empty().append(e.children()),
this.clean_node()):f.correct_state&&this.get_container().children("ul").empty();j&&j.call(this);break;case !f.data&&!!f.ajax||!!f.data&&!!f.ajax&&b&&-1!==b:d=function(a,c,d){var j=this.get_settings().json_data.ajax.error;j&&j.call(this,a,c,d);if(b!=-1&&b.length){b.children("a.jstree-loading").removeClass("jstree-loading");b.removeData("jstree-is-loading");c==="success"&&f.correct_state&&this.correct_state(b)}else c==="success"&&f.correct_state&&this.get_container().children("ul").empty();g&&g.call(this)},
e=function(g,e,k){var l=this.get_settings().json_data.ajax.success;l&&(g=l.call(this,g,e,k)||g);if(g===""||g&&g.toString&&g.toString().replace(/^[\s\n]+$/,"")===""||!a.isArray(g)&&!a.isPlainObject(g))return d.call(this,k,e,"");if(g=this._parse_json(g,b)){if(b===-1||!b)this.get_container().children("ul").empty().append(g.children());else{b.append(g).children("a.jstree-loading").removeClass("jstree-loading");b.removeData("jstree-is-loading")}this.clean_node(b);j&&j.call(this)}else if(b===-1||!b){if(f.correct_state){this.get_container().children("ul").empty();
j&&j.call(this)}}else{b.children("a.jstree-loading").removeClass("jstree-loading");b.removeData("jstree-is-loading");if(f.correct_state){this.correct_state(b);j&&j.call(this)}}},f.ajax.context=this,f.ajax.error=d,f.ajax.success=e,f.ajax.dataType||(f.ajax.dataType="json"),a.isFunction(f.ajax.url)&&(f.ajax.url=f.ajax.url.call(this,b)),a.isFunction(f.ajax.data)&&(f.ajax.data=f.ajax.data.call(this,b)),a.ajax(f.ajax)}}},_parse_json:function(b,j,g){var f=!1,e=this._get_settings(),d=e.json_data,m=e.core.html_titles,
o;if(!b)return f;d.progressive_unload&&(j&&-1!==j)&&j.data("jstree-children",f);if(a.isArray(b)){f=a();if(!b.length)return!1;e=0;for(d=b.length;e<d;e++)o=this._parse_json(b[e],j,!0),o.length&&(f=f.add(o))}else{"string"==typeof b&&(b={data:b});if(!b.data&&""!==b.data)return f;f=a("<li />");b.attr&&f.attr(b.attr);b.metadata&&f.data(b.metadata);b.state&&f.addClass("jstree-"+b.state);a.isArray(b.data)||(o=b.data,b.data=[],b.data.push(o));a.each(b.data,function(d,j){o=a("<a />");a.isFunction(j)&&(j=j.call(this,
b));if(typeof j=="string")o.attr("href","#")[m?"html":"text"](j);else{if(!j.attr)j.attr={};if(!j.attr.href)j.attr.href="#";o.attr(j.attr)[m?"html":"text"](j.title);j.language&&o.addClass(j.language)}o.prepend("<ins class='jstree-icon'>&#160;</ins>");if(!j.icon&&b.icon)j.icon=b.icon;j.icon&&(j.icon.indexOf("/")===-1?o.children("ins").addClass(j.icon):o.children("ins").css("background","url('"+j.icon+"') center center no-repeat"));f.append(o)});f.prepend("<ins class='jstree-icon'>&#160;</ins>");b.children&&
(d.progressive_render&&"open"!==b.state?f.addClass("jstree-closed").data("jstree-children",b.children):(d.progressive_unload&&f.data("jstree-children",b.children),a.isArray(b.children)&&b.children.length&&(o=this._parse_json(b.children,j,!0),o.length&&(j=a("<ul />"),j.append(o),f.append(j)))))}g||(g=a("<ul />"),g.append(f),f=g);return f},get_json:function(b,j,g,f){var e=[],d=this._get_settings(),m=this,o,r,p,u,t,y,b=this._get_node(b);if(!b||-1===b)b=this.get_container().find("> ul > li");j=a.isArray(j)?
j:["id","class"];!f&&this.data.types&&j.push(d.types.type_attr);g=a.isArray(g)?g:[];b.each(function(){p=a(this);o={data:[]};j.length&&(o.attr={});a.each(j,function(a,b){(r=p.attr(b))&&(r.length&&r.replace(/jstree[^ ]*/ig,"").length)&&(o.attr[b]=(" "+r).replace(/ jstree[^ ]*/ig,"").replace(/\s+$/ig," ").replace(/^ /,"").replace(/ $/,""))});p.hasClass("jstree-open")&&(o.state="open");p.hasClass("jstree-closed")&&(o.state="closed");p.data()&&(o.metadata=p.data());u=p.children("a");u.each(function(){t=
a(this);if(g.length||a.inArray("languages",d.plugins)!==-1||t.children("ins").get(0).style.backgroundImage.length||t.children("ins").get(0).className&&t.children("ins").get(0).className.replace(/jstree[^ ]*|$/ig,"").length){y=false;a.inArray("languages",d.plugins)!==-1&&(a.isArray(d.languages)&&d.languages.length)&&a.each(d.languages,function(a,b){if(t.hasClass(b)){y=b;return false}});r={attr:{},title:m.get_text(t,y)};a.each(g,function(a,b){r.attr[b]=(" "+(t.attr(b)||"")).replace(/ jstree[^ ]*/ig,
"").replace(/\s+$/ig," ").replace(/^ /,"").replace(/ $/,"")});a.inArray("languages",d.plugins)!==-1&&(a.isArray(d.languages)&&d.languages.length)&&a.each(d.languages,function(a,b){if(t.hasClass(b)){r.language=b;return true}});if(t.children("ins").get(0).className.replace(/jstree[^ ]*|$/ig,"").replace(/^\s+$/ig,"").length)r.icon=t.children("ins").get(0).className.replace(/jstree[^ ]*|$/ig,"").replace(/\s+$/ig," ").replace(/^ /,"").replace(/ $/,"");if(t.children("ins").get(0).style.backgroundImage.length)r.icon=
t.children("ins").get(0).style.backgroundImage.replace("url(","").replace(")","")}else r=m.get_text(t);u.length>1?o.data.push(r):o.data=r});p=p.find("> ul > li");p.length&&(o.children=m.get_json(p,j,g,!0));e.push(o)});return e}}})})(m);(function(a){a.jstree.plugin("languages",{__init:function(){this._load_css()},defaults:[],_fn:{set_lang:function(b){var j=this._get_settings().languages,g=!1,f=".jstree-"+this.get_index()+" a";if(!a.isArray(j)||0===j.length)return!1;if(-1==a.inArray(b,j))if(j[b])b=
j[b];else return!1;if(b==this.data.languages.current_language)return!0;g=a.vakata.css.get_css(f+"."+this.data.languages.current_language,!1,this.data.languages.language_css);!1!==g&&(g.style.display="none");g=a.vakata.css.get_css(f+"."+b,!1,this.data.languages.language_css);!1!==g&&(g.style.display="");this.data.languages.current_language=b;this.__callback(b);return!0},get_lang:function(){return this.data.languages.current_language},_get_string:function(b,j){var g=this._get_settings().languages,f=
this._get_settings().core.strings;a.isArray(g)&&g.length&&(j=j&&-1!=a.inArray(j,g)?j:this.data.languages.current_language);return f[j]&&f[j][b]?f[j][b]:f[b]?f[b]:b},get_text:function(b,j){b=this._get_node(b)||this.data.ui.last_selected;if(!b.size())return!1;var g=this._get_settings().languages,f=this._get_settings().core.html_titles;a.isArray(g)&&g.length?(j=j&&-1!=a.inArray(j,g)?j:this.data.languages.current_language,b=b.children("a."+j)):b=b.children("a:eq(0)");if(f)return b=b.clone(),b.children("INS").remove(),
b.html();b=b.contents().filter(function(){return this.nodeType==3})[0];return b.nodeValue},set_text:function(b,j,g){b=this._get_node(b)||this.data.ui.last_selected;if(!b.size())return!1;var f=this._get_settings().languages,e=this._get_settings().core.html_titles;a.isArray(f)&&f.length?(g=g&&-1!=a.inArray(g,f)?g:this.data.languages.current_language,b=b.children("a."+g)):b=b.children("a:eq(0)");if(e)return f=b.children("INS").clone(),b.html(j).prepend(f),this.__callback({obj:b,name:j,lang:g}),!0;b=
b.contents().filter(function(){return this.nodeType==3})[0];this.__callback({obj:b,name:j,lang:g});return b.nodeValue=j},_load_css:function(){var b=this._get_settings().languages,j="/* languages css */",g=".jstree-"+this.get_index()+" a",f;if(a.isArray(b)&&b.length){this.data.languages.current_language=b[0];for(f=0;f<b.length;f++)j+=g+"."+b[f]+" {",b[f]!=this.data.languages.current_language&&(j+=" display:none; "),j+=" } ";this.data.languages.language_css=a.vakata.css.add_sheet({str:j,title:"jstree-languages"})}},
create_node:function(b,j,g,f){return this.__call_old(!0,b,j,g,function(b){var d=this._get_settings().languages,j=b.children("a"),g;if(a.isArray(d)&&d.length){for(g=0;g<d.length;g++)j.is("."+d[g])||b.append(j.eq(0).clone().removeClass(d.join(" ")).addClass(d[g]));j.not("."+d.join(", .")).remove()}f&&f.call(this,b)})}}})})(m);(function(a){a.jstree.plugin("cookies",{__init:function(){if("undefined"===typeof a.cookie)throw"jsTree cookie: jQuery cookie plugin not included.";var b=this._get_settings().cookies,
j;if(b.save_loaded&&(j=a.cookie(b.save_loaded))&&j.length)this.data.core.to_load=j.split(",");if(b.save_opened&&(j=a.cookie(b.save_opened))&&j.length)this.data.core.to_open=j.split(",");if(b.save_selected&&(j=a.cookie(b.save_selected))&&j.length&&this.data.ui)this.data.ui.to_select=j.split(",");this.get_container().one((this.data.ui?"reselect":"reopen")+".jstree",a.proxy(function(){this.get_container().bind("open_node.jstree close_node.jstree select_node.jstree deselect_node.jstree",a.proxy(function(a){this._get_settings().cookies.auto_save&&
this.save_cookie((a.handleObj.namespace+a.handleObj.type).replace("jstree",""))},this))},this))},defaults:{save_loaded:"jstree_load",save_opened:"jstree_open",save_selected:"jstree_select",auto_save:!0,cookie_options:{}},_fn:{save_cookie:function(b){if(!this.data.core.refreshing){var j=this._get_settings().cookies;if(b)switch(b){case "open_node":case "close_node":j.save_opened&&(this.save_opened(),a.cookie(j.save_opened,this.data.core.to_open.join(","),j.cookie_options));j.save_loaded&&(this.save_loaded(),
a.cookie(j.save_loaded,this.data.core.to_load.join(","),j.cookie_options));break;case "select_node":case "deselect_node":j.save_selected&&this.data.ui&&(this.save_selected(),a.cookie(j.save_selected,this.data.ui.to_select.join(","),j.cookie_options))}else if(j.save_loaded&&(this.save_loaded(),a.cookie(j.save_loaded,this.data.core.to_load.join(","),j.cookie_options)),j.save_opened&&(this.save_opened(),a.cookie(j.save_opened,this.data.core.to_open.join(","),j.cookie_options)),j.save_selected&&this.data.ui)this.save_selected(),
a.cookie(j.save_selected,this.data.ui.to_select.join(","),j.cookie_options)}}}})})(m);(function(a){a.jstree.plugin("sort",{__init:function(){this.get_container().bind("load_node.jstree",a.proxy(function(a,c){var g=this._get_node(c.rslt.obj),g=-1===g?this.get_container().children("ul"):g.children("ul");this.sort(g)},this)).bind("rename_node.jstree create_node.jstree create.jstree",a.proxy(function(a,c){this.sort(c.rslt.obj.parent())},this)).bind("move_node.jstree",a.proxy(function(a,c){this.sort((-1==
c.rslt.np?this.get_container():c.rslt.np).children("ul"))},this))},defaults:function(a,c){return this.get_text(a)>this.get_text(c)?1:-1},_fn:{sort:function(b){var j=this._get_settings().sort,g=this;b.append(a.makeArray(b.children("li")).sort(a.proxy(j,g)));b.find("> li > ul").each(function(){g.sort(a(this))});this.clean_node(b)}}})})(m);(function(a){var b=!1,j=!1,g=!1,f=!1,e=!1,d=!1,m=!1,o=!1,r=!1;a.vakata.dnd={is_down:!1,is_drag:!1,helper:!1,scroll_spd:10,init_x:0,init_y:0,threshold:5,helper_left:5,
helper_top:10,user_data:{},drag_start:function(b,d,f){a.vakata.dnd.is_drag&&a.vakata.drag_stop({});try{b.currentTarget.unselectable="on",b.currentTarget.onselectstart=function(){return!1},b.currentTarget.style&&(b.currentTarget.style.MozUserSelect="none")}catch(g){}a.vakata.dnd.init_x=b.pageX;a.vakata.dnd.init_y=b.pageY;a.vakata.dnd.user_data=d;a.vakata.dnd.is_down=!0;a.vakata.dnd.helper=a("<div id='vakata-dragged' />").html(f);a(document).bind("mousemove",a.vakata.dnd.drag);a(document).bind("mouseup",
a.vakata.dnd.drag_stop);return!1},drag:function(b){if(a.vakata.dnd.is_down){if(!a.vakata.dnd.is_drag)if(5<Math.abs(b.pageX-a.vakata.dnd.init_x)||5<Math.abs(b.pageY-a.vakata.dnd.init_y))a.vakata.dnd.helper.appendTo("body"),a.vakata.dnd.is_drag=!0,a(document).triggerHandler("drag_start.vakata",{event:b,data:a.vakata.dnd.user_data});else return;if("mousemove"===b.type){var f=a(document),g=f.scrollTop(),f=f.scrollLeft();if(20>b.pageY-g){if(d&&"down"===m&&(clearInterval(d),d=!1),!d)m="up",d=setInterval(function(){a(document).scrollTop(a(document).scrollTop()-
a.vakata.dnd.scroll_spd)},150)}else d&&"up"===m&&(clearInterval(d),d=!1);if(20>a(window).height()-(b.pageY-g)){if(d&&"up"===m&&(clearInterval(d),d=!1),!d)m="down",d=setInterval(function(){a(document).scrollTop(a(document).scrollTop()+a.vakata.dnd.scroll_spd)},150)}else d&&"down"===m&&(clearInterval(d),d=!1);if(20>b.pageX-f){if(e&&"right"===o&&(clearInterval(e),e=!1),!e)o="left",e=setInterval(function(){a(document).scrollLeft(a(document).scrollLeft()-a.vakata.dnd.scroll_spd)},150)}else e&&"left"===
o&&(clearInterval(e),e=!1);if(20>a(window).width()-(b.pageX-f)){if(e&&"left"===o&&(clearInterval(e),e=!1),!e)o="right",e=setInterval(function(){a(document).scrollLeft(a(document).scrollLeft()+a.vakata.dnd.scroll_spd)},150)}else e&&"right"===o&&(clearInterval(e),e=!1)}a.vakata.dnd.helper.css({left:b.pageX+a.vakata.dnd.helper_left+"px",top:b.pageY+a.vakata.dnd.helper_top+"px"});a(document).triggerHandler("drag.vakata",{event:b,data:a.vakata.dnd.user_data})}},drag_stop:function(b){e&&clearInterval(e);
d&&clearInterval(d);a(document).unbind("mousemove",a.vakata.dnd.drag);a(document).unbind("mouseup",a.vakata.dnd.drag_stop);a(document).triggerHandler("drag_stop.vakata",{event:b,data:a.vakata.dnd.user_data});a.vakata.dnd.helper.remove();a.vakata.dnd.init_x=0;a.vakata.dnd.init_y=0;a.vakata.dnd.user_data={};a.vakata.dnd.is_down=!1;a.vakata.dnd.is_drag=!1}};a(function(){a.vakata.css.add_sheet({str:"#vakata-dragged { display:block; margin:0 0 0 0; padding:4px 4px 4px 24px; position:absolute; top:-2000px; line-height:16px; z-index:10000; } ",
title:"vakata"})});a.jstree.plugin("dnd",{__init:function(){this.data.dnd={active:!1,after:!1,inside:!1,before:!1,off:!1,prepared:!1,w:0,to1:!1,to2:!1,cof:!1,cw:!1,ch:!1,i1:!1,i2:!1,mto:!1};this.get_container().bind("mouseenter.jstree",a.proxy(function(d){if(a.vakata.dnd.is_drag&&a.vakata.dnd.user_data.jstree&&(this.data.themes&&(g.attr("class","jstree-"+this.data.themes.theme),f&&f.attr("class","jstree-"+this.data.themes.theme),a.vakata.dnd.helper.attr("class","jstree-dnd-helper jstree-"+this.data.themes.theme)),
d.currentTarget===d.target&&a.vakata.dnd.user_data.obj&&a(a.vakata.dnd.user_data.obj).length&&a(a.vakata.dnd.user_data.obj).parents(".jstree:eq(0)")[0]!==d.target))d=a.jstree._reference(d.target),d.data.dnd.foreign?(d=d._get_settings().dnd.drag_check.call(this,{o:b,r:d.get_container(),is_root:!0}),(!0===d||!0===d.inside||!0===d.before||!0===d.after)&&a.vakata.dnd.helper.children("ins").attr("class","jstree-ok")):(d.prepare_move(b,d.get_container(),"last"),d.check_move()&&a.vakata.dnd.helper.children("ins").attr("class",
"jstree-ok"))},this)).bind("mouseup.jstree",a.proxy(function(d){if(a.vakata.dnd.is_drag&&a.vakata.dnd.user_data.jstree&&d.currentTarget===d.target&&a.vakata.dnd.user_data.obj&&a(a.vakata.dnd.user_data.obj).length&&a(a.vakata.dnd.user_data.obj).parents(".jstree:eq(0)")[0]!==d.target){var f=a.jstree._reference(d.currentTarget);f.data.dnd.foreign?(d=f._get_settings().dnd.drag_check.call(this,{o:b,r:f.get_container(),is_root:!0}),(!0===d||!0===d.inside||!0===d.before||!0===d.after)&&f._get_settings().dnd.drag_finish.call(this,
{o:b,r:f.get_container(),is_root:!0})):f.move_node(b,f.get_container(),"last",d[f._get_settings().dnd.copy_modifier+"Key"])}},this)).bind("mouseleave.jstree",a.proxy(function(b){if(b.relatedTarget&&b.relatedTarget.id&&"jstree-marker-line"===b.relatedTarget.id)return!1;a.vakata.dnd.is_drag&&a.vakata.dnd.user_data.jstree&&(this.data.dnd.i1&&clearInterval(this.data.dnd.i1),this.data.dnd.i2&&clearInterval(this.data.dnd.i2),this.data.dnd.to1&&clearTimeout(this.data.dnd.to1),this.data.dnd.to2&&clearTimeout(this.data.dnd.to2),
a.vakata.dnd.helper.children("ins").hasClass("jstree-ok")&&a.vakata.dnd.helper.children("ins").attr("class","jstree-invalid"))},this)).bind("mousemove.jstree",a.proxy(function(b){if(a.vakata.dnd.is_drag&&a.vakata.dnd.user_data.jstree){var d=this.get_container()[0];b.pageX+24>this.data.dnd.cof.left+this.data.dnd.cw?(this.data.dnd.i1&&clearInterval(this.data.dnd.i1),this.data.dnd.i1=setInterval(a.proxy(function(){this.scrollLeft+=a.vakata.dnd.scroll_spd},d),100)):b.pageX-24<this.data.dnd.cof.left?(this.data.dnd.i1&&
clearInterval(this.data.dnd.i1),this.data.dnd.i1=setInterval(a.proxy(function(){this.scrollLeft-=a.vakata.dnd.scroll_spd},d),100)):this.data.dnd.i1&&clearInterval(this.data.dnd.i1);b.pageY+24>this.data.dnd.cof.top+this.data.dnd.ch?(this.data.dnd.i2&&clearInterval(this.data.dnd.i2),this.data.dnd.i2=setInterval(a.proxy(function(){this.scrollTop=this.scrollTop+a.vakata.dnd.scroll_spd},d),100)):b.pageY-24<this.data.dnd.cof.top?(this.data.dnd.i2&&clearInterval(this.data.dnd.i2),this.data.dnd.i2=setInterval(a.proxy(function(){this.scrollTop=
this.scrollTop-a.vakata.dnd.scroll_spd},d),100)):this.data.dnd.i2&&clearInterval(this.data.dnd.i2)}},this)).bind("scroll.jstree",a.proxy(function(){a.vakata.dnd.is_drag&&(a.vakata.dnd.user_data.jstree&&g&&f)&&(g.hide(),f.hide())},this)).delegate("a","mousedown.jstree",a.proxy(function(a){if(1===a.which)return this.start_drag(a.currentTarget,a),!1},this)).delegate("a","mouseenter.jstree",a.proxy(function(b){a.vakata.dnd.is_drag&&a.vakata.dnd.user_data.jstree&&this.dnd_enter(b.currentTarget)},this)).delegate("a",
"mousemove.jstree",a.proxy(function(b){a.vakata.dnd.is_drag&&a.vakata.dnd.user_data.jstree&&((!j||!j.length||j.children("a")[0]!==b.currentTarget)&&this.dnd_enter(b.currentTarget),"undefined"===typeof this.data.dnd.off.top&&(this.data.dnd.off=a(b.target).offset()),this.data.dnd.w=(b.pageY-(this.data.dnd.off.top||0))%this.data.core.li_height,0>this.data.dnd.w&&(this.data.dnd.w+=this.data.core.li_height),this.dnd_show())},this)).delegate("a","mouseleave.jstree",a.proxy(function(b){if(a.vakata.dnd.is_drag&&
a.vakata.dnd.user_data.jstree){if(b.relatedTarget&&b.relatedTarget.id&&"jstree-marker-line"===b.relatedTarget.id)return!1;g&&g.hide();f&&f.hide();this.data.dnd.mto=setTimeout(function(a){return function(){a.dnd_leave(b)}}(this),0)}},this)).delegate("a","mouseup.jstree",a.proxy(function(b){a.vakata.dnd.is_drag&&a.vakata.dnd.user_data.jstree&&this.dnd_finish(b)},this));a(document).bind("drag_stop.vakata",a.proxy(function(){this.data.dnd.to1&&clearTimeout(this.data.dnd.to1);this.data.dnd.to2&&clearTimeout(this.data.dnd.to2);
this.data.dnd.i1&&clearInterval(this.data.dnd.i1);this.data.dnd.i2&&clearInterval(this.data.dnd.i2);this.data.dnd.after=!1;this.data.dnd.before=!1;this.data.dnd.inside=!1;this.data.dnd.off=!1;this.data.dnd.prepared=!1;this.data.dnd.w=!1;this.data.dnd.to1=!1;this.data.dnd.to2=!1;this.data.dnd.i1=!1;this.data.dnd.i2=!1;this.data.dnd.active=!1;this.data.dnd.foreign=!1;g&&g.css({top:"-2000px"});f&&f.css({top:"-2000px"})},this)).bind("drag_start.vakata",a.proxy(function(b,d){if(d.data.jstree){var f=a(d.event.target);
f.closest(".jstree").hasClass("jstree-"+this.get_index())&&this.dnd_enter(f)}},this));var d=this._get_settings().dnd;d.drag_target&&a(document).delegate(d.drag_target,"mousedown.jstree-"+this.get_index(),a.proxy(function(d){b=d.target;a.vakata.dnd.drag_start(d,{jstree:!0,obj:d.target},"<ins class='jstree-icon'></ins>"+a(d.target).text());this.data.themes&&(g&&g.attr("class","jstree-"+this.data.themes.theme),f&&f.attr("class","jstree-"+this.data.themes.theme),a.vakata.dnd.helper.attr("class","jstree-dnd-helper jstree-"+
this.data.themes.theme));a.vakata.dnd.helper.children("ins").attr("class","jstree-invalid");var j=this.get_container();this.data.dnd.cof=j.offset();this.data.dnd.cw=parseInt(j.width(),10);this.data.dnd.ch=parseInt(j.height(),10);this.data.dnd.foreign=!0;d.preventDefault()},this));d.drop_target&&a(document).delegate(d.drop_target,"mouseenter.jstree-"+this.get_index(),a.proxy(function(d){this.data.dnd.active&&this._get_settings().dnd.drop_check.call(this,{o:b,r:a(d.target),e:d})&&a.vakata.dnd.helper.children("ins").attr("class",
"jstree-ok")},this)).delegate(d.drop_target,"mouseleave.jstree-"+this.get_index(),a.proxy(function(){this.data.dnd.active&&a.vakata.dnd.helper.children("ins").attr("class","jstree-invalid")},this)).delegate(d.drop_target,"mouseup.jstree-"+this.get_index(),a.proxy(function(d){this.data.dnd.active&&a.vakata.dnd.helper.children("ins").hasClass("jstree-ok")&&this._get_settings().dnd.drop_finish.call(this,{o:b,r:a(d.target),e:d})},this))},defaults:{copy_modifier:"ctrl",check_timeout:100,open_timeout:500,
drop_target:".jstree-drop",drop_check:function(){return!0},drop_finish:a.noop,drag_target:".jstree-draggable",drag_finish:a.noop,drag_check:function(){return{after:!1,before:!1,inside:!0}}},_fn:{dnd_prepare:function(){if(j&&j.length){this.data.dnd.off=j.offset();this._get_settings().core.rtl&&(this.data.dnd.off.right=this.data.dnd.off.left+j.width());if(this.data.dnd.foreign){var a=this._get_settings().dnd.drag_check.call(this,{o:b,r:j});this.data.dnd.after=a.after;this.data.dnd.before=a.before;this.data.dnd.inside=
a.inside;this.data.dnd.prepared=!0;return this.dnd_show()}this.prepare_move(b,j,"before");this.data.dnd.before=this.check_move();this.prepare_move(b,j,"after");this.data.dnd.after=this.check_move();this._is_loaded(j)?(this.prepare_move(b,j,"inside"),this.data.dnd.inside=this.check_move()):this.data.dnd.inside=!1;this.data.dnd.prepared=!0;return this.dnd_show()}},dnd_show:function(){if(this.data.dnd.prepared){var b=["before","inside","after"],d=!1,j=this._get_settings().core.rtl,b=this.data.dnd.w<
this.data.core.li_height/3?["before","inside","after"]:this.data.dnd.w<=2*this.data.core.li_height/3?this.data.dnd.w<this.data.core.li_height/2?["inside","before","after"]:["inside","after","before"]:["after","inside","before"];a.each(b,a.proxy(function(b,f){if(this.data.dnd[f])return a.vakata.dnd.helper.children("ins").attr("class","jstree-ok"),d=f,!1},this));!1===d&&a.vakata.dnd.helper.children("ins").attr("class","jstree-invalid");b=j?this.data.dnd.off.right-18:this.data.dnd.off.left+10;switch(d){case "before":g.css({left:b+
"px",top:this.data.dnd.off.top-6+"px"}).show();f&&f.css({left:b+8+"px",top:this.data.dnd.off.top-1+"px"}).show();break;case "after":g.css({left:b+"px",top:this.data.dnd.off.top+this.data.core.li_height-6+"px"}).show();f&&f.css({left:b+8+"px",top:this.data.dnd.off.top+this.data.core.li_height-1+"px"}).show();break;case "inside":g.css({left:b+(j?-4:4)+"px",top:this.data.dnd.off.top+this.data.core.li_height/2-5+"px"}).show();f&&f.hide();break;default:g.hide(),f&&f.hide()}return r=d}},dnd_open:function(){this.data.dnd.to2=
!1;this.open_node(j,a.proxy(this.dnd_prepare,this),!0)},dnd_finish:function(a){this.data.dnd.foreign?(this.data.dnd.after||this.data.dnd.before||this.data.dnd.inside)&&this._get_settings().dnd.drag_finish.call(this,{o:b,r:j,p:r}):(this.dnd_prepare(),this.move_node(b,j,r,a[this._get_settings().dnd.copy_modifier+"Key"]));j=b=!1;g.hide();f&&f.hide()},dnd_enter:function(b){this.data.dnd.mto&&(clearTimeout(this.data.dnd.mto),this.data.dnd.mto=!1);var d=this._get_settings().dnd;this.data.dnd.prepared=!1;
j=this._get_node(b);d.check_timeout?(this.data.dnd.to1&&clearTimeout(this.data.dnd.to1),this.data.dnd.to1=setTimeout(a.proxy(this.dnd_prepare,this),d.check_timeout)):this.dnd_prepare();d.open_timeout?(this.data.dnd.to2&&clearTimeout(this.data.dnd.to2),j&&(j.length&&j.hasClass("jstree-closed"))&&(this.data.dnd.to2=setTimeout(a.proxy(this.dnd_open,this),d.open_timeout))):j&&(j.length&&j.hasClass("jstree-closed"))&&this.dnd_open()},dnd_leave:function(b){this.data.dnd.after=!1;this.data.dnd.before=!1;
this.data.dnd.inside=!1;a.vakata.dnd.helper.children("ins").attr("class","jstree-invalid");g.hide();f&&f.hide();if(j&&j[0]===b.target.parentNode&&(this.data.dnd.to1&&(clearTimeout(this.data.dnd.to1),this.data.dnd.to1=!1),this.data.dnd.to2))clearTimeout(this.data.dnd.to2),this.data.dnd.to2=!1},start_drag:function(d,j){b=this._get_node(d);this.data.ui&&this.is_selected(b)&&(b=this._get_node(null,!0));var e=1<b.length?this._get_string("multiple_selection"):this.get_text(b),k=this.get_container();this._get_settings().core.html_titles||
(e=e.replace(/</ig,"&lt;").replace(/>/ig,"&gt;"));a.vakata.dnd.drag_start(j,{jstree:!0,obj:b},"<ins class='jstree-icon'></ins>"+e);this.data.themes&&(g&&g.attr("class","jstree-"+this.data.themes.theme),f&&f.attr("class","jstree-"+this.data.themes.theme),a.vakata.dnd.helper.attr("class","jstree-dnd-helper jstree-"+this.data.themes.theme));this.data.dnd.cof=k.offset();this.data.dnd.cw=parseInt(k.width(),10);this.data.dnd.ch=parseInt(k.height(),10);this.data.dnd.active=!0}}});a(function(){a.vakata.css.add_sheet({str:"#vakata-dragged ins { display:block; text-decoration:none; width:16px; height:16px; margin:0 0 0 0; padding:0; position:absolute; top:4px; left:4px;  -moz-border-radius:4px; border-radius:4px; -webkit-border-radius:4px; } #vakata-dragged .jstree-ok { background:green; } #vakata-dragged .jstree-invalid { background:red; } #jstree-marker { padding:0; margin:0; font-size:12px; overflow:hidden; height:12px; width:8px; position:absolute; top:-30px; z-index:10001; background-repeat:no-repeat; display:none; background-color:transparent; text-shadow:1px 1px 1px white; color:black; line-height:10px; } #jstree-marker-line { padding:0; margin:0; line-height:0%; font-size:1px; overflow:hidden; height:1px; width:100px; position:absolute; top:-30px; z-index:10000; background-repeat:no-repeat; display:none; background-color:#456c43;  cursor:pointer; border:1px solid #eeeeee; border-left:0; -moz-box-shadow: 0px 0px 2px #666; -webkit-box-shadow: 0px 0px 2px #666; box-shadow: 0px 0px 2px #666;  -moz-border-radius:1px; border-radius:1px; -webkit-border-radius:1px; }",
title:"jstree"});g=a("<div />").attr({id:"jstree-marker"}).hide().html("&raquo;").bind("mouseleave mouseenter",function(a){g.hide();f.hide();a.preventDefault();a.stopImmediatePropagation();return!1}).appendTo("body");f=a("<div />").attr({id:"jstree-marker-line"}).hide().bind("mouseup",function(a){if(j&&j.length)return j.children("a").trigger(a),a.preventDefault(),a.stopImmediatePropagation(),!1}).bind("mouseleave",function(b){var d=a(b.relatedTarget);if((d.is(".jstree")||0===d.closest(".jstree").length)&&
j&&j.length)return j.children("a").trigger(b),g.hide(),f.hide(),b.preventDefault(),b.stopImmediatePropagation(),!1}).appendTo("body");a(document).bind("drag_start.vakata",function(a,b){b.data.jstree&&(g.show(),f&&f.show())});a(document).bind("drag_stop.vakata",function(a,b){b.data.jstree&&(g.hide(),f&&f.hide())})})})(m);(function(a){a.jstree.plugin("checkbox",{__init:function(){this.data.checkbox.noui=this._get_settings().checkbox.override_ui;this.data.ui&&this.data.checkbox.noui&&(this.select_node=
this.deselect_node=this.deselect_all=a.noop,this.get_selected=this.get_checked);this.get_container().bind("open_node.jstree create_node.jstree clean_node.jstree refresh.jstree",a.proxy(function(a,c){this._prepare_checkboxes(c.rslt.obj)},this)).bind("loaded.jstree",a.proxy(function(){this._prepare_checkboxes()},this)).delegate(this.data.ui&&this.data.checkbox.noui?"a":"ins.jstree-checkbox","click.jstree",a.proxy(function(a){a.preventDefault();this._get_node(a.target).hasClass("jstree-checked")?this.uncheck_node(a.target):
this.check_node(a.target);if(this.data.ui&&this.data.checkbox.noui){this.save_selected();this.data.cookies&&this.save_cookie("select_node")}else{a.stopImmediatePropagation();return false}},this))},defaults:{override_ui:!1,two_state:!1,real_checkboxes:!1,checked_parent_open:!0,real_checkboxes_names:function(a){return["check_"+(a[0].id||Math.ceil(1E4*Math.random())),1]}},__destroy:function(){this.get_container().find("input.jstree-real-checkbox").removeClass("jstree-real-checkbox").end().find("ins.jstree-checkbox").remove()},
_fn:{_checkbox_notify:function(a,c){c.checked&&this.check_node(a,!1)},_prepare_checkboxes:function(b){b=!b||-1==b?this.get_container().find("> ul > li"):this._get_node(b);if(!1!==b){var g,e=this,f,k=this._get_settings().checkbox.two_state,d=this._get_settings().checkbox.real_checkboxes,m=this._get_settings().checkbox.real_checkboxes_names;b.each(function(){f=a(this);g=f.is("li")&&(f.hasClass("jstree-checked")||d&&f.children(":checked").length)?"jstree-checked":"jstree-unchecked";f.find("li").andSelf().each(function(){var b=
a(this),f;b.children("a"+(e.data.languages?"":":eq(0)")).not(":has(.jstree-checkbox)").prepend("<ins class='jstree-checkbox'>&#160;</ins>").parent().not(".jstree-checked, .jstree-unchecked").addClass(k?"jstree-unchecked":g);d&&(b.children(":checkbox").length?b.children(":checkbox").addClass("jstree-real-checkbox"):(f=m.call(e,b),b.prepend("<input type='checkbox' class='jstree-real-checkbox' id='"+f[0]+"' name='"+f[0]+"' value='"+f[1]+"' />")),"jstree-checked"===g&&b.children(":checkbox").attr("checked",
"checked"));"jstree-checked"===g&&!k&&b.find("li").addClass("jstree-checked")})});k||(1===b.length&&b.is("li")&&this._repair_state(b),b.is("li")?b.each(function(){e._repair_state(this)}):b.find("> ul > li").each(function(){e._repair_state(this)}),b.find(".jstree-checked").parent().parent().each(function(){e._repair_state(this)}))}},change_state:function(b,g){var b=this._get_node(b),e=!1,f=this._get_settings().checkbox.real_checkboxes;if(!b||-1===b)return!1;g=!1===g||!0===g?g:b.hasClass("jstree-checked");
if(this._get_settings().checkbox.two_state)g?(b.removeClass("jstree-checked").addClass("jstree-unchecked"),f&&b.children(":checkbox").removeAttr("checked")):(b.removeClass("jstree-unchecked").addClass("jstree-checked"),f&&b.children(":checkbox").attr("checked","checked"));else{if(g){e=b.find("li").andSelf();if(!e.filter(".jstree-checked, .jstree-undetermined").length)return!1;e.removeClass("jstree-checked jstree-undetermined").addClass("jstree-unchecked");f&&e.children(":checkbox").removeAttr("checked")}else{e=
b.find("li").andSelf();if(!e.filter(".jstree-unchecked, .jstree-undetermined").length)return!1;e.removeClass("jstree-unchecked jstree-undetermined").addClass("jstree-checked");f&&e.children(":checkbox").attr("checked","checked");this.data.ui&&(this.data.ui.last_selected=b);this.data.checkbox.last_selected=b}b.parentsUntil(".jstree","li").each(function(){var b=a(this);if(g){if(b.children("ul").children("li.jstree-checked, li.jstree-undetermined").length)return b.parentsUntil(".jstree","li").andSelf().removeClass("jstree-checked jstree-unchecked").addClass("jstree-undetermined"),
f&&b.parentsUntil(".jstree","li").andSelf().children(":checkbox").removeAttr("checked"),!1;b.removeClass("jstree-checked jstree-undetermined").addClass("jstree-unchecked");f&&b.children(":checkbox").removeAttr("checked")}else{if(b.children("ul").children("li.jstree-unchecked, li.jstree-undetermined").length)return b.parentsUntil(".jstree","li").andSelf().removeClass("jstree-checked jstree-unchecked").addClass("jstree-undetermined"),f&&b.parentsUntil(".jstree","li").andSelf().children(":checkbox").removeAttr("checked"),
!1;b.removeClass("jstree-unchecked jstree-undetermined").addClass("jstree-checked");f&&b.children(":checkbox").attr("checked","checked")}})}this.data.ui&&this.data.checkbox.noui&&(this.data.ui.selected=this.get_checked());this.__callback(b);return!0},check_node:function(a){if(this.change_state(a,!1)){a=this._get_node(a);if(this._get_settings().checkbox.checked_parent_open){var c=this;a.parents(".jstree-closed").each(function(){c.open_node(this,!1,!0)})}this.__callback({obj:a})}},uncheck_node:function(a){this.change_state(a,
!0)&&this.__callback({obj:this._get_node(a)})},check_all:function(){var a=this;(this._get_settings().checkbox.two_state?this.get_container_ul().find("li"):this.get_container_ul().children("li")).each(function(){a.change_state(this,!1)});this.__callback()},uncheck_all:function(){var a=this;(this._get_settings().checkbox.two_state?this.get_container_ul().find("li"):this.get_container_ul().children("li")).each(function(){a.change_state(this,!0)});this.__callback()},is_checked:function(a){a=this._get_node(a);
return a.length?a.is(".jstree-checked"):!1},get_checked:function(a,c){a=!a||-1===a?this.get_container():this._get_node(a);return c||this._get_settings().checkbox.two_state?a.find(".jstree-checked"):a.find("> ul > .jstree-checked, .jstree-undetermined > ul > .jstree-checked")},get_unchecked:function(a,c){a=!a||-1===a?this.get_container():this._get_node(a);return c||this._get_settings().checkbox.two_state?a.find(".jstree-unchecked"):a.find("> ul > .jstree-unchecked, .jstree-undetermined > ul > .jstree-unchecked")},
show_checkboxes:function(){this.get_container().children("ul").removeClass("jstree-no-checkboxes")},hide_checkboxes:function(){this.get_container().children("ul").addClass("jstree-no-checkboxes")},_repair_state:function(a){a=this._get_node(a);if(a.length){var c=this._get_settings().checkbox.real_checkboxes,g=a.find("> ul > .jstree-checked").length,f=a.find("> ul > .jstree-undetermined").length,e=a.find("> ul > li").length;0===e?a.hasClass("jstree-undetermined")&&this.change_state(a,!1):0===g&&0===
f?this.change_state(a,!0):g===e?this.change_state(a,!1):(a.parentsUntil(".jstree","li").andSelf().removeClass("jstree-checked jstree-unchecked").addClass("jstree-undetermined"),c&&a.parentsUntil(".jstree","li").andSelf().children(":checkbox").removeAttr("checked"))}},reselect:function(){if(this.data.ui&&this.data.checkbox.noui){var b=this,g=this.data.ui.to_select,g=a.map(a.makeArray(g),function(a){return"#"+a.toString().replace(/^#/,"").replace(/\\\//g,"/").replace(/\//g,"\\/").replace(/\\\./g,".").replace(/\./g,
"\\.").replace(/\:/g,"\\:")});this.deselect_all();a.each(g,function(a,c){b.check_node(c)});this.__callback()}else this.__call_old()},save_loaded:function(){var a=this;this.data.core.to_load=[];this.get_container_ul().find("li.jstree-closed.jstree-undetermined").each(function(){this.id&&a.data.core.to_load.push("#"+this.id)})}}});a(function(){a.vakata.css.add_sheet({str:".jstree .jstree-real-checkbox { display:none; } ",title:"jstree"})})})(m);(function(a){a.vakata.xslt=function(b,f,g){var d="",j;
if(document.recalc)return j=document.createElement("xml"),d=document.createElement("xml"),j.innerHTML=b,d.innerHTML=f,a("body").append(j).append(d),setTimeout(function(b,d,f){return function(){f.call(null,b.transformNode(d.XMLDocument));setTimeout(function(b,d){return function(){a(b).remove();a(d).remove()}}(b,d),200)}}(j,d,g),100),!0;"undefined"!==typeof window.DOMParser&&("undefined"!==typeof window.XMLHttpRequest&&"undefined"===typeof window.XSLTProcessor)&&(b=(new DOMParser).parseFromString(b,
"text/xml"),f=(new DOMParser).parseFromString(f,"text/xml"));if("undefined"!==typeof window.DOMParser&&"undefined"!==typeof window.XMLHttpRequest&&"undefined"!==typeof window.XSLTProcessor){j=new XSLTProcessor;d=a.isFunction(j.transformDocument)?"undefined"!==typeof window.XMLSerializer:!0;if(!d)return!1;b=(new DOMParser).parseFromString(b,"text/xml");f=(new DOMParser).parseFromString(f,"text/xml");a.isFunction(j.transformDocument)?(d=document.implementation.createDocument("","",null),j.transformDocument(b,
f,d,null),g.call(null,(new XMLSerializer).serializeToString(d))):(j.importStylesheet(f),d=j.transformToFragment(b,document),g.call(null,a("<div />").append(d).html()));return!0}return!1};var b={nest:'<?xml version="1.0" encoding="utf-8" ?><xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" ><xsl:output method="html" encoding="utf-8" omit-xml-declaration="yes" standalone="no" indent="no" media-type="text/html" /><xsl:template match="/">\t<xsl:call-template name="nodes">\t\t<xsl:with-param name="node" select="/root" />\t</xsl:call-template></xsl:template><xsl:template name="nodes">\t<xsl:param name="node" />\t<ul>\t<xsl:for-each select="$node/item">\t\t<xsl:variable name="children" select="count(./item) &gt; 0" />\t\t<li>\t\t\t<xsl:attribute name="class">\t\t\t\t<xsl:if test="position() = last()">jstree-last </xsl:if>\t\t\t\t<xsl:choose>\t\t\t\t\t<xsl:when test="@state = \'open\'">jstree-open </xsl:when>\t\t\t\t\t<xsl:when test="$children or @hasChildren or @state = \'closed\'">jstree-closed </xsl:when>\t\t\t\t\t<xsl:otherwise>jstree-leaf </xsl:otherwise>\t\t\t\t</xsl:choose>\t\t\t\t<xsl:value-of select="@class" />\t\t\t</xsl:attribute>\t\t\t<xsl:for-each select="@*">\t\t\t\t<xsl:if test="name() != \'class\' and name() != \'state\' and name() != \'hasChildren\'">\t\t\t\t\t<xsl:attribute name="{name()}"><xsl:value-of select="." /></xsl:attribute>\t\t\t\t</xsl:if>\t\t\t</xsl:for-each>\t<ins class="jstree-icon"><xsl:text>&#xa0;</xsl:text></ins>\t\t\t<xsl:for-each select="content/name">\t\t\t\t<a>\t\t\t\t<xsl:attribute name="href">\t\t\t\t\t<xsl:choose>\t\t\t\t\t<xsl:when test="@href"><xsl:value-of select="@href" /></xsl:when>\t\t\t\t\t<xsl:otherwise>#</xsl:otherwise>\t\t\t\t\t</xsl:choose>\t\t\t\t</xsl:attribute>\t\t\t\t<xsl:attribute name="class"><xsl:value-of select="@lang" /> <xsl:value-of select="@class" /></xsl:attribute>\t\t\t\t<xsl:attribute name="style"><xsl:value-of select="@style" /></xsl:attribute>\t\t\t\t<xsl:for-each select="@*">\t\t\t\t\t<xsl:if test="name() != \'style\' and name() != \'class\' and name() != \'href\'">\t\t\t\t\t\t<xsl:attribute name="{name()}"><xsl:value-of select="." /></xsl:attribute>\t\t\t\t\t</xsl:if>\t\t\t\t</xsl:for-each>\t\t\t\t\t<ins>\t\t\t\t\t\t<xsl:attribute name="class">jstree-icon \t\t\t\t\t\t\t<xsl:if test="string-length(attribute::icon) > 0 and not(contains(@icon,\'/\'))"><xsl:value-of select="@icon" /></xsl:if>\t\t\t\t\t\t</xsl:attribute>\t\t\t\t\t\t<xsl:if test="string-length(attribute::icon) > 0 and contains(@icon,\'/\')"><xsl:attribute name="style">background:url(<xsl:value-of select="@icon" />) center center no-repeat;</xsl:attribute></xsl:if>\t\t\t\t\t\t<xsl:text>&#xa0;</xsl:text>\t\t\t\t\t</ins>\t\t\t\t\t<xsl:copy-of select="./child::node()" />\t\t\t\t</a>\t\t\t</xsl:for-each>\t\t\t<xsl:if test="$children or @hasChildren"><xsl:call-template name="nodes"><xsl:with-param name="node" select="current()" /></xsl:call-template></xsl:if>\t\t</li>\t</xsl:for-each>\t</ul></xsl:template></xsl:stylesheet>',
flat:'<?xml version="1.0" encoding="utf-8" ?><xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" ><xsl:output method="html" encoding="utf-8" omit-xml-declaration="yes" standalone="no" indent="no" media-type="text/xml" /><xsl:template match="/">\t<ul>\t<xsl:for-each select="//item[not(@parent_id) or @parent_id=0 or not(@parent_id = //item/@id)]">\t\t<xsl:call-template name="nodes">\t\t\t<xsl:with-param name="node" select="." />\t\t\t<xsl:with-param name="is_last" select="number(position() = last())" />\t\t</xsl:call-template>\t</xsl:for-each>\t</ul></xsl:template><xsl:template name="nodes">\t<xsl:param name="node" />\t<xsl:param name="is_last" />\t<xsl:variable name="children" select="count(//item[@parent_id=$node/attribute::id]) &gt; 0" />\t<li>\t<xsl:attribute name="class">\t\t<xsl:if test="$is_last = true()">jstree-last </xsl:if>\t\t<xsl:choose>\t\t\t<xsl:when test="@state = \'open\'">jstree-open </xsl:when>\t\t\t<xsl:when test="$children or @hasChildren or @state = \'closed\'">jstree-closed </xsl:when>\t\t\t<xsl:otherwise>jstree-leaf </xsl:otherwise>\t\t</xsl:choose>\t\t<xsl:value-of select="@class" />\t</xsl:attribute>\t<xsl:for-each select="@*">\t\t<xsl:if test="name() != \'parent_id\' and name() != \'hasChildren\' and name() != \'class\' and name() != \'state\'">\t\t<xsl:attribute name="{name()}"><xsl:value-of select="." /></xsl:attribute>\t\t</xsl:if>\t</xsl:for-each>\t<ins class="jstree-icon"><xsl:text>&#xa0;</xsl:text></ins>\t<xsl:for-each select="content/name">\t\t<a>\t\t<xsl:attribute name="href">\t\t\t<xsl:choose>\t\t\t<xsl:when test="@href"><xsl:value-of select="@href" /></xsl:when>\t\t\t<xsl:otherwise>#</xsl:otherwise>\t\t\t</xsl:choose>\t\t</xsl:attribute>\t\t<xsl:attribute name="class"><xsl:value-of select="@lang" /> <xsl:value-of select="@class" /></xsl:attribute>\t\t<xsl:attribute name="style"><xsl:value-of select="@style" /></xsl:attribute>\t\t<xsl:for-each select="@*">\t\t\t<xsl:if test="name() != \'style\' and name() != \'class\' and name() != \'href\'">\t\t\t\t<xsl:attribute name="{name()}"><xsl:value-of select="." /></xsl:attribute>\t\t\t</xsl:if>\t\t</xsl:for-each>\t\t\t<ins>\t\t\t\t<xsl:attribute name="class">jstree-icon \t\t\t\t\t<xsl:if test="string-length(attribute::icon) > 0 and not(contains(@icon,\'/\'))"><xsl:value-of select="@icon" /></xsl:if>\t\t\t\t</xsl:attribute>\t\t\t\t<xsl:if test="string-length(attribute::icon) > 0 and contains(@icon,\'/\')"><xsl:attribute name="style">background:url(<xsl:value-of select="@icon" />) center center no-repeat;</xsl:attribute></xsl:if>\t\t\t\t<xsl:text>&#xa0;</xsl:text>\t\t\t</ins>\t\t\t<xsl:copy-of select="./child::node()" />\t\t</a>\t</xsl:for-each>\t<xsl:if test="$children">\t\t<ul>\t\t<xsl:for-each select="//item[@parent_id=$node/attribute::id]">\t\t\t<xsl:call-template name="nodes">\t\t\t\t<xsl:with-param name="node" select="." />\t\t\t\t<xsl:with-param name="is_last" select="number(position() = last())" />\t\t\t</xsl:call-template>\t\t</xsl:for-each>\t\t</ul>\t</xsl:if>\t</li></xsl:template></xsl:stylesheet>'},
g=function(a){return a.toString().replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&apos;")};a.jstree.plugin("xml_data",{defaults:{data:!1,ajax:!1,xsl:"flat",clean_node:!1,correct_state:!0,get_skip_empty:!1,get_include_preamble:!0},_fn:{load_node:function(a,b,c){var d=this;this.load_node_xml(a,function(){d.__callback({obj:d._get_node(a)});b.call(this)},c)},_is_loaded:function(b){var f=this._get_settings().xml_data,b=this._get_node(b);return-1==b||
!b||!f.ajax&&!a.isFunction(f.data)||b.is(".jstree-open, .jstree-leaf")||0<b.children("ul").children("li").size()},load_node_xml:function(b,f,g){var d=this.get_settings().xml_data,j=function(){},e=function(){};if((b=this._get_node(b))&&-1!==b){if(b.data("jstree-is-loading"))return;b.data("jstree-is-loading",!0)}switch(!0){case !d.data&&!d.ajax:throw"Neither data nor ajax settings supplied.";case a.isFunction(d.data):d.data.call(this,b,a.proxy(function(g){this.parse_xml(g,a.proxy(function(g){if(g){g=
g.replace(/ ?xmlns="[^"]*"/ig,"");if(g.length>10){g=a(g);if(b===-1||!b)this.get_container().children("ul").empty().append(g.children());else{b.children("a.jstree-loading").removeClass("jstree-loading");b.append(g);b.removeData("jstree-is-loading")}d.clean_node&&this.clean_node(b);f&&f.call(this)}else if(b&&b!==-1){b.children("a.jstree-loading").removeClass("jstree-loading");b.removeData("jstree-is-loading");if(d.correct_state){this.correct_state(b);f&&f.call(this)}}else if(d.correct_state){this.get_container().children("ul").empty();
f&&f.call(this)}}},this))},this));break;case !!d.data&&!d.ajax||!!d.data&&!!d.ajax&&(!b||-1===b):(!b||-1==b)&&this.parse_xml(d.data,a.proxy(function(g){if(g){g=g.replace(/ ?xmlns="[^"]*"/ig,"");if(g.length>10){g=a(g);this.get_container().children("ul").empty().append(g.children());d.clean_node&&this.clean_node(b);f&&f.call(this)}}else if(d.correct_state){this.get_container().children("ul").empty();f&&f.call(this)}},this));break;case !d.data&&!!d.ajax||!!d.data&&!!d.ajax&&b&&-1!==b:j=function(a,c,
f){var j=this.get_settings().xml_data.ajax.error;j&&j.call(this,a,c,f);if(b!==-1&&b.length){b.children("a.jstree-loading").removeClass("jstree-loading");b.removeData("jstree-is-loading");c==="success"&&d.correct_state&&this.correct_state(b)}else c==="success"&&d.correct_state&&this.get_container().children("ul").empty();g&&g.call(this)},e=function(g,e,k){var g=k.responseText,m=this.get_settings().xml_data.ajax.success;m&&(g=m.call(this,g,e,k)||g);if(g===""||g&&g.toString&&g.toString().replace(/^[\s\n]+$/,
"")==="")return j.call(this,k,e,"");this.parse_xml(g,a.proxy(function(g){if(g){g=g.replace(/ ?xmlns="[^"]*"/ig,"");if(g.length>10){g=a(g);if(b===-1||!b)this.get_container().children("ul").empty().append(g.children());else{b.children("a.jstree-loading").removeClass("jstree-loading");b.append(g);b.removeData("jstree-is-loading")}d.clean_node&&this.clean_node(b);f&&f.call(this)}else if(b&&b!==-1){b.children("a.jstree-loading").removeClass("jstree-loading");b.removeData("jstree-is-loading");if(d.correct_state){this.correct_state(b);
f&&f.call(this)}}else if(d.correct_state){this.get_container().children("ul").empty();f&&f.call(this)}}},this))},d.ajax.context=this,d.ajax.error=j,d.ajax.success=e,d.ajax.dataType||(d.ajax.dataType="xml"),a.isFunction(d.ajax.url)&&(d.ajax.url=d.ajax.url.call(this,b)),a.isFunction(d.ajax.data)&&(d.ajax.data=d.ajax.data.call(this,b)),a.ajax(d.ajax)}},parse_xml:function(g,f){var j=this._get_settings().xml_data;a.vakata.xslt(g,b[j.xsl],f)},get_xml:function(b,f,e,d,m){var o="",r=this._get_settings(),
p=this,u,t,y,z,x;b||(b="flat");m||(m=0);f=this._get_node(f);if(!f||-1===f)f=this.get_container().find("> ul > li");e=a.isArray(e)?e:["id","class"];!m&&(this.data.types&&-1===a.inArray(r.types.type_attr,e))&&e.push(r.types.type_attr);d=a.isArray(d)?d:[];m||(r.xml_data.get_include_preamble&&(o+='<?xml version="1.0" encoding="UTF-8"?>'),o+="<root>");f.each(function(){o=o+"<item";y=a(this);a.each(e,function(a,b){var c=y.attr(b);if(!r.xml_data.get_skip_empty||typeof c!=="undefined")o=o+(" "+b+'="'+g((" "+
(c||"")).replace(/ jstree[^ ]*/ig,"").replace(/\s+$/ig," ").replace(/^ /,"").replace(/ $/,""))+'"')});y.hasClass("jstree-open")&&(o=o+' state="open"');y.hasClass("jstree-closed")&&(o=o+' state="closed"');b==="flat"&&(o=o+(' parent_id="'+g(m)+'"'));o=o+">";o=o+"<content>";z=y.children("a");z.each(function(){u=a(this);x=false;o=o+"<name";a.inArray("languages",r.plugins)!==-1&&a.each(r.languages,function(a,b){if(u.hasClass(b)){o=o+(' lang="'+g(b)+'"');x=b;return false}});d.length&&a.each(d,function(a,
b){var c=u.attr(b);if(!r.xml_data.get_skip_empty||typeof c!=="undefined")o=o+(" "+b+'="'+g((" "+c||"").replace(/ jstree[^ ]*/ig,"").replace(/\s+$/ig," ").replace(/^ /,"").replace(/ $/,""))+'"')});u.children("ins").get(0).className.replace(/jstree[^ ]*|$/ig,"").replace(/^\s+$/ig,"").length&&(o=o+(' icon="'+g(u.children("ins").get(0).className.replace(/jstree[^ ]*|$/ig,"").replace(/\s+$/ig," ").replace(/^ /,"").replace(/ $/,""))+'"'));u.children("ins").get(0).style.backgroundImage.length&&(o=o+(' icon="'+
g(u.children("ins").get(0).style.backgroundImage.replace("url(","").replace(")","").replace(/'/ig,"").replace(/"/ig,""))+'"'));o=o+">";o=o+("<![CDATA["+p.get_text(u,x)+"]]\>");o=o+"</name>"});o=o+"</content>";t=y[0].id||true;y=y.find("> ul > li");t=y.length?p.get_xml(b,y,e,d,t):"";b=="nest"&&(o=o+t);o=o+"</item>";b=="flat"&&(o=o+t)});m||(o+="</root>");return o}}})})(m);(function(a){a.expr[":"].jstree_contains=function(a,c,g){return 0<=(a.textContent||a.innerText||"").toLowerCase().indexOf(g[3].toLowerCase())};
a.expr[":"].jstree_title_contains=function(a,c,g){return 0<=(a.getAttribute("title")||"").toLowerCase().indexOf(g[3].toLowerCase())};a.jstree.plugin("search",{__init:function(){this.data.search.str="";this.data.search.result=a();this._get_settings().search.show_only_matches&&this.get_container().bind("search.jstree",function(b,g){a(this).children("ul").find("li").hide().removeClass("jstree-last");g.rslt.nodes.parentsUntil(".jstree").andSelf().show().filter("ul").each(function(){a(this).children("li:visible").eq(-1).addClass("jstree-last")})}).bind("clear_search.jstree",
function(){a(this).children("ul").find("li").css("display","").end().end().jstree("clean_node",-1)})},defaults:{ajax:!1,search_method:"jstree_contains",show_only_matches:!1},_fn:{search:function(b,g){if(""===a.trim(b))this.clear_search();else{var e=this.get_settings().search,f=this,k=function(){};this.data.search.str=b;if(!g&&!1!==e.ajax&&0<this.get_container_ul().find("li.jstree-closed:not(:has(ul)):eq(0)").length){this.search.supress_callback=!0;k=function(a,b,c){var f=this.get_settings().search.ajax.success;
f&&(a=f.call(this,a,b,c)||a);this.data.search.to_open=a;this._search_open()};e.ajax.context=this;e.ajax.error=function(){};e.ajax.success=k;a.isFunction(e.ajax.url)&&(e.ajax.url=e.ajax.url.call(this,b));a.isFunction(e.ajax.data)&&(e.ajax.data=e.ajax.data.call(this,b));e.ajax.data||(e.ajax.data={search_string:b});if(!e.ajax.dataType||/^json/.exec(e.ajax.dataType))e.ajax.dataType="json";a.ajax(e.ajax)}else this.data.search.result.length&&this.clear_search(),this.data.search.result=this.get_container().find("a"+
(this.data.languages?"."+this.get_lang():"")+":"+e.search_method+"("+this.data.search.str+")"),this.data.search.result.addClass("jstree-search").parent().parents(".jstree-closed").each(function(){f.open_node(this,!1,!0)}),this.__callback({nodes:this.data.search.result,str:b})}},clear_search:function(){this.data.search.result.removeClass("jstree-search");this.__callback(this.data.search.result);this.data.search.result=a()},_search_open:function(){var b=this,g=!0,e=[],f=[];this.data.search.to_open.length&&
(a.each(this.data.search.to_open,function(b,d){if("#"==d)return!0;a(d).length&&a(d).is(".jstree-closed")?e.push(d):f.push(d)}),e.length&&(this.data.search.to_open=f,a.each(e,function(a,c){b.open_node(c,function(){b._search_open(!0)})}),g=!1));g&&this.search(this.data.search.str,!0)}}})})(m);(function(a){a.vakata.context={hide_on_mouseleave:!1,cnt:a("<div id='vakata-contextmenu' />"),vis:!1,tgt:!1,par:!1,func:!1,data:!1,rtl:!1,show:function(b,g,e,f,k,d,m){a.vakata.context.rtl=!!m;if(b=a.vakata.context.parse(b)){a.vakata.context.vis=
!0;a.vakata.context.tgt=g;a.vakata.context.par=d||g||null;a.vakata.context.data=k||null;a.vakata.context.cnt.html(b).css({visibility:"hidden",display:"block",left:0,top:0});if(a.vakata.context.hide_on_mouseleave)a.vakata.context.cnt.one("mouseleave",function(){a.vakata.context.hide()});k=a.vakata.context.cnt.height();d=a.vakata.context.cnt.width();e+d>a(document).width()&&(e=a(document).width()-(d+5),a.vakata.context.cnt.find("li > ul").addClass("right"));f+k>a(document).height()&&(f-=k+g[0].offsetHeight,
a.vakata.context.cnt.find("li > ul").addClass("bottom"));a.vakata.context.cnt.css({left:e,top:f}).find("li:has(ul)").bind("mouseenter",function(){var b=a(document).width(),d=a(document).height(),f=a(this).children("ul").show();b!==a(document).width()&&f.toggleClass("right");d!==a(document).height()&&f.toggleClass("bottom")}).bind("mouseleave",function(){a(this).children("ul").hide()}).end().css({visibility:"visible"}).show();a(document).triggerHandler("context_show.vakata")}},hide:function(){a.vakata.context.vis=
!1;a.vakata.context.cnt.attr("class","").css({visibility:"hidden"});a(document).triggerHandler("context_hide.vakata")},parse:function(b,g){if(!b)return!1;var e="",f=!1,k=!0;g||(a.vakata.context.func={});e+="<ul>";a.each(b,function(b,g){if(!g)return true;a.vakata.context.func[b]=g.action;!k&&g.separator_before&&(e=e+"<li class='vakata-separator vakata-separator-before'></li>");k=false;e=e+("<li class='"+(g._class||"")+(g._disabled?" jstree-contextmenu-disabled ":"")+"'><ins ");g.icon&&g.icon.indexOf("/")===
-1&&(e=e+(" class='"+g.icon+"' "));g.icon&&g.icon.indexOf("/")!==-1&&(e=e+(" style='background:url("+g.icon+") center center no-repeat;' "));e=e+(">&#160;</ins><a href='#' rel='"+b+"'>");g.submenu&&(e=e+("<span style='float:"+(a.vakata.context.rtl?"left":"right")+";'>&raquo;</span>"));e=e+(g.label+"</a>");if(g.submenu)(f=a.vakata.context.parse(g.submenu,true))&&(e=e+f);e=e+"</li>";if(g.separator_after){e=e+"<li class='vakata-separator vakata-separator-after'></li>";k=true}});e=e.replace(/<li class\='vakata-separator vakata-separator-after'\><\/li\>$/,
"");e+="</ul>";a(document).triggerHandler("context_parse.vakata");return 10<e.length?e:!1},exec:function(b){return a.isFunction(a.vakata.context.func[b])?(a.vakata.context.func[b].call(a.vakata.context.data,a.vakata.context.par),!0):!1}};a(function(){a.vakata.css.add_sheet({str:"#vakata-contextmenu { display:block; visibility:hidden; left:0; top:-200px; position:absolute; margin:0; padding:0; min-width:180px; background:#ebebeb; border:1px solid silver; z-index:10000; *width:180px; } #vakata-contextmenu ul { min-width:180px; *width:180px; } #vakata-contextmenu ul, #vakata-contextmenu li { margin:0; padding:0; list-style-type:none; display:block; } #vakata-contextmenu li { line-height:20px; min-height:20px; position:relative; padding:0px; } #vakata-contextmenu li a { padding:1px 6px; line-height:17px; display:block; text-decoration:none; margin:1px 1px 0 1px; } #vakata-contextmenu li ins { float:left; width:16px; height:16px; text-decoration:none; margin-right:2px; } #vakata-contextmenu li a:hover, #vakata-contextmenu li.vakata-hover > a { background:gray; color:white; } #vakata-contextmenu li ul { display:none; position:absolute; top:-2px; left:100%; background:#ebebeb; border:1px solid gray; } #vakata-contextmenu .right { right:100%; left:auto; } #vakata-contextmenu .bottom { bottom:-1px; top:auto; } #vakata-contextmenu li.vakata-separator { min-height:0; height:1px; line-height:1px; font-size:1px; overflow:hidden; margin:0 2px; background:silver; /* border-top:1px solid #fefefe; */ padding:0; } ",
title:"vakata"});a.vakata.context.cnt.delegate("a","click",function(a){a.preventDefault()}).delegate("a","mouseup",function(){!a(this).parent().hasClass("jstree-contextmenu-disabled")&&a.vakata.context.exec(a(this).attr("rel"))?a.vakata.context.hide():a(this).blur()}).delegate("a","mouseover",function(){a.vakata.context.cnt.find(".vakata-hover").removeClass("vakata-hover")}).appendTo("body");a(document).bind("mousedown",function(b){a.vakata.context.vis&&!a.contains(a.vakata.context.cnt[0],b.target)&&
a.vakata.context.hide()});"undefined"!==typeof a.hotkeys&&a(document).bind("keydown","up",function(b){if(a.vakata.context.vis){var g=a.vakata.context.cnt.find("ul:visible").last().children(".vakata-hover").removeClass("vakata-hover").prevAll("li:not(.vakata-separator)").first();g.length||(g=a.vakata.context.cnt.find("ul:visible").last().children("li:not(.vakata-separator)").last());g.addClass("vakata-hover");b.stopImmediatePropagation();b.preventDefault()}}).bind("keydown","down",function(b){if(a.vakata.context.vis){var g=
a.vakata.context.cnt.find("ul:visible").last().children(".vakata-hover").removeClass("vakata-hover").nextAll("li:not(.vakata-separator)").first();g.length||(g=a.vakata.context.cnt.find("ul:visible").last().children("li:not(.vakata-separator)").first());g.addClass("vakata-hover");b.stopImmediatePropagation();b.preventDefault()}}).bind("keydown","right",function(b){a.vakata.context.vis&&(a.vakata.context.cnt.find(".vakata-hover").children("ul").show().children("li:not(.vakata-separator)").removeClass("vakata-hover").first().addClass("vakata-hover"),
b.stopImmediatePropagation(),b.preventDefault())}).bind("keydown","left",function(b){a.vakata.context.vis&&(a.vakata.context.cnt.find(".vakata-hover").children("ul").hide().children(".vakata-separator").removeClass("vakata-hover"),b.stopImmediatePropagation(),b.preventDefault())}).bind("keydown","esc",function(b){a.vakata.context.hide();b.preventDefault()}).bind("keydown","space",function(b){a.vakata.context.cnt.find(".vakata-hover").last().children("a").click();b.preventDefault()})});a.jstree.plugin("contextmenu",
{__init:function(){this.get_container().delegate("a","contextmenu.jstree",a.proxy(function(b){b.preventDefault();a(b.currentTarget).hasClass("jstree-loading")||this.show_contextmenu(b.currentTarget,b.pageX,b.pageY)},this)).delegate("a","click.jstree",a.proxy(function(){this.data.contextmenu&&a.vakata.context.hide()},this)).bind("destroy.jstree",a.proxy(function(){this.data.contextmenu&&a.vakata.context.hide()},this));a(document).bind("context_hide.vakata",a.proxy(function(){this.data.contextmenu=
!1},this))},defaults:{select_node:!1,show_at_node:!0,items:{create:{separator_before:!1,separator_after:!0,label:"Create",action:function(a){this.create(a)}},rename:{separator_before:!1,separator_after:!1,label:"Rename",action:function(a){this.rename(a)}},remove:{separator_before:!1,icon:!1,separator_after:!1,label:"Delete",action:function(a){this.is_selected(a)?this.remove():this.remove(a)}},ccp:{separator_before:!0,icon:!1,separator_after:!1,label:"Edit",action:!1,submenu:{cut:{separator_before:!1,
separator_after:!1,label:"Cut",action:function(a){this.cut(a)}},copy:{separator_before:!1,icon:!1,separator_after:!1,label:"Copy",action:function(a){this.copy(a)}},paste:{separator_before:!1,icon:!1,separator_after:!1,label:"Paste",action:function(a){this.paste(a)}}}}}},_fn:{show_contextmenu:function(b,g,e){var b=this._get_node(b),f=this.get_settings().contextmenu,k=b.children("a:visible:eq(0)"),d=!1,d=!1;f.select_node&&(this.data.ui&&!this.is_selected(b))&&(this.deselect_all(),this.select_node(b,
!0));if(f.show_at_node||"undefined"===typeof g||"undefined"===typeof e)d=k.offset(),g=d.left,e=d.top+this.data.core.li_height;d=b.data("jstree")&&b.data("jstree").contextmenu?b.data("jstree").contextmenu:f.items;a.isFunction(d)&&(d=d.call(this,b));this.data.contextmenu=!0;a.vakata.context.show(d,k,g,e,this,b,this._get_settings().core.rtl);this.data.themes&&a.vakata.context.cnt.attr("class","jstree-"+this.data.themes.theme+"-context")}}})})(m);(function(a){a.jstree.plugin("types",{__init:function(){var b=
this._get_settings().types;this.data.types.attach_to=[];this.get_container().bind("init.jstree",a.proxy(function(){var g=b.type_attr,e="",f=this;a.each(b.types,function(b,d){a.each(d,function(a){/^(max_depth|max_children|icon|valid_children)$/.test(a)||f.data.types.attach_to.push(a)});if(!d.icon)return!0;if(d.icon.image||d.icon.position)e="default"==b?e+(".jstree-"+f.get_index()+" a > .jstree-icon { "):e+(".jstree-"+f.get_index()+" li["+g+'="'+b+'"] > a > .jstree-icon { '),d.icon.image&&(e+=" background-image:url("+
d.icon.image+"); "),e=d.icon.position?e+(" background-position:"+d.icon.position+"; "):e+" background-position:0 0; ",e+="} "});""!==e&&a.vakata.css.add_sheet({str:e,title:"jstree-types"})},this)).bind("before.jstree",a.proxy(function(b,g){var f,e;if((f=(f=this._get_settings().types.use_data?this._get_node(g.args[0]):!1)&&-1!==f&&f.length?f.data("jstree"):!1)&&f.types&&!1===f.types[g.func])return b.stopImmediatePropagation(),!1;if(-1!==a.inArray(g.func,this.data.types.attach_to)&&g.args[0]&&(g.args[0].tagName||
g.args[0].jquery))if(f=this._get_settings().types.types,e=this._get_type(g.args[0]),(f[e]&&"undefined"!==typeof f[e][g.func]||f["default"]&&"undefined"!==typeof f["default"][g.func])&&!1===this._check(g.func,g.args[0]))return b.stopImmediatePropagation(),!1},this));e&&this.get_container().bind("load_node.jstree set_type.jstree",a.proxy(function(b,g){var f=g&&g.rslt&&g.rslt.obj&&-1!==g.rslt.obj?this._get_node(g.rslt.obj).parent():this.get_container_ul(),e=!1,d=this._get_settings().types;a.each(d.types,
function(a,b){if(b.icon&&(b.icon.image||b.icon.position))e="default"===a?f.find("li > a > .jstree-icon"):f.find("li["+d.type_attr+"='"+a+"'] > a > .jstree-icon"),b.icon.image&&e.css("backgroundImage","url("+b.icon.image+")"),e.css("backgroundPosition",b.icon.position||"0 0")})},this))},defaults:{max_children:-1,max_depth:-1,valid_children:"all",use_data:!1,type_attr:"rel",types:{"default":{max_children:-1,max_depth:-1,valid_children:"all"}}},_fn:{_types_notify:function(a,c){c.type&&this._get_settings().types.use_data&&
this.set_type(c.type,a)},_get_type:function(a){a=this._get_node(a);return!a||!a.length?!1:a.attr(this._get_settings().types.type_attr)||"default"},set_type:function(a,c){var c=this._get_node(c),g=!c.length||!a?!1:c.attr(this._get_settings().types.type_attr,a);g&&this.__callback({obj:c,type:a});return g},_check:function(b,g,e){var g=this._get_node(g),f=!1,k=this._get_type(g),d=0,m=this,o=this._get_settings().types,r=!1;if(-1===g)if(o[b])f=o[b];else return;else{if(!1===k)return;(r=o.use_data?g.data("jstree"):
!1)&&r.types&&"undefined"!==typeof r.types[b]?f=r.types[b]:o.types[k]&&"undefined"!==typeof o.types[k][b]?f=o.types[k][b]:o.types["default"]&&"undefined"!==typeof o.types["default"][b]&&(f=o.types["default"][b])}a.isFunction(f)&&(f=f.call(this,g));"max_depth"===b&&(-1!==g&&!1!==e&&-2!==o.max_depth&&0!==f)&&g.children("a:eq(0)").parentsUntil(".jstree","li").each(function(a){if(-1!==o.max_depth&&0>=o.max_depth-(a+1))return f=0,!1;d=0===a?f:m._check(b,this,!1);if(-1!==d&&0>=d-(a+1))return f=0,!1;if(0<=
d&&(d-(a+1)<f||0>f))f=d-(a+1);if(0<=o.max_depth&&(o.max_depth-(a+1)<f||0>f))f=o.max_depth-(a+1)});return f},check_move:function(){if(!this.__call_old())return!1;var b=this._get_move(),g=b.rt._get_settings().types,e=b.rt._check("max_children",b.cr),f=b.rt._check("max_depth",b.cr),k=b.rt._check("valid_children",b.cr),d=0,m=1;if("none"===k||a.isArray(k)&&(b.ot&&b.ot._get_type)&&(b.o.each(function(){if(-1===a.inArray(b.ot._get_type(this),k))return m=!1}),!1===m)||-2!==g.max_children&&-1!==e&&(d=-1===
b.cr?this.get_container().find("> ul > li").not(b.o).length:b.cr.find("> ul > li").not(b.o).length,d+b.o.length>e))return!1;if(-2!==g.max_depth&&-1!==f){m=0;if(0===f)return!1;if("undefined"===typeof b.o.d){for(g=b.o;0<g.length;)g=g.find("> ul > li"),m++;b.o.d=m}if(0>f-b.o.d)return!1}return!0},create_node:function(b,g,e,f,k,d){if(!d&&(k||this._is_loaded(b))){var m="string"==typeof g&&g.match(/^before|after$/i)&&-1!==b?this._get_parent(b):this._get_node(b),o=this._get_settings().types,r=this._check("max_children",
m),p=this._check("max_depth",m),u=this._check("valid_children",m);"string"===typeof e&&(e={data:e});e||(e={});if("none"===u)return!1;if(a.isArray(u))if(!e.attr||!e.attr[o.type_attr])e.attr||(e.attr={}),e.attr[o.type_attr]=u[0];else if(-1===a.inArray(e.attr[o.type_attr],u))return!1;if(-2!==o.max_children&&-1!==r&&(m=-1===m?this.get_container().find("> ul > li").length:m.find("> ul > li").length,m+1>r)||-2!==o.max_depth&&-1!==p&&0>p-1)return!1}return this.__call_old(!0,b,g,e,f,k,d)}}})})(m);(function(a){a.jstree.plugin("html_data",
{__init:function(){this.data.html_data.original_container_html=this.get_container().find(" > ul > li").clone(!0);this.data.html_data.original_container_html.find("li").andSelf().contents().filter(function(){return 3==this.nodeType}).remove()},defaults:{data:!1,ajax:!1,correct_state:!0},_fn:{load_node:function(a,c,g){var f=this;this.load_node_html(a,function(){f.__callback({obj:f._get_node(a)});c.call(this)},g)},_is_loaded:function(b){b=this._get_node(b);return-1==b||!b||!this._get_settings().html_data.ajax&&
!a.isFunction(this._get_settings().html_data.data)||b.is(".jstree-open, .jstree-leaf")||0<b.children("ul").children("li").size()},load_node_html:function(b,g,e){var f,k=this.get_settings().html_data,d=function(){};f=function(){};if((b=this._get_node(b))&&-1!==b){if(b.data("jstree-is-loading"))return;b.data("jstree-is-loading",!0)}switch(!0){case a.isFunction(k.data):k.data.call(this,b,a.proxy(function(d){if(d&&d!==""&&d.toString&&d.toString().replace(/^[\s\n]+$/,"")!==""){d=a(d);d.is("ul")||(d=a("<ul />").append(d));
if(b==-1||!b)this.get_container().children("ul").empty().append(d.children()).find("li, a").filter(function(){return!this.firstChild||!this.firstChild.tagName||this.firstChild.tagName!=="INS"}).prepend("<ins class='jstree-icon'>&#160;</ins>").end().filter("a").children("ins:first-child").not(".jstree-icon").addClass("jstree-icon");else{b.children("a.jstree-loading").removeClass("jstree-loading");b.append(d).children("ul").find("li, a").filter(function(){return!this.firstChild||!this.firstChild.tagName||
this.firstChild.tagName!=="INS"}).prepend("<ins class='jstree-icon'>&#160;</ins>").end().filter("a").children("ins:first-child").not(".jstree-icon").addClass("jstree-icon");b.removeData("jstree-is-loading")}this.clean_node(b);g&&g.call(this)}else if(b&&b!==-1){b.children("a.jstree-loading").removeClass("jstree-loading");b.removeData("jstree-is-loading");if(k.correct_state){this.correct_state(b);g&&g.call(this)}}else if(k.correct_state){this.get_container().children("ul").empty();g&&g.call(this)}},
this));break;case !k.data&&!k.ajax:if(!b||-1==b)this.get_container().children("ul").empty().append(this.data.html_data.original_container_html).find("li, a").filter(function(){return!this.firstChild||!this.firstChild.tagName||this.firstChild.tagName!=="INS"}).prepend("<ins class='jstree-icon'>&#160;</ins>").end().filter("a").children("ins:first-child").not(".jstree-icon").addClass("jstree-icon"),this.clean_node();g&&g.call(this);break;case !!k.data&&!k.ajax||!!k.data&&!!k.ajax&&(!b||-1===b):if(!b||
-1==b)f=a(k.data),f.is("ul")||(f=a("<ul />").append(f)),this.get_container().children("ul").empty().append(f.children()).find("li, a").filter(function(){return!this.firstChild||!this.firstChild.tagName||this.firstChild.tagName!=="INS"}).prepend("<ins class='jstree-icon'>&#160;</ins>").end().filter("a").children("ins:first-child").not(".jstree-icon").addClass("jstree-icon"),this.clean_node();g&&g.call(this);break;case !k.data&&!!k.ajax||!!k.data&&!!k.ajax&&b&&-1!==b:b=this._get_node(b),d=function(a,
c,d){var f=this.get_settings().html_data.ajax.error;f&&f.call(this,a,c,d);if(b!=-1&&b.length){b.children("a.jstree-loading").removeClass("jstree-loading");b.removeData("jstree-is-loading");c==="success"&&k.correct_state&&this.correct_state(b)}else c==="success"&&k.correct_state&&this.get_container().children("ul").empty();e&&e.call(this)},f=function(f,e,l){var m=this.get_settings().html_data.ajax.success;m&&(f=m.call(this,f,e,l)||f);if(f===""||f&&f.toString&&f.toString().replace(/^[\s\n]+$/,"")===
"")return d.call(this,l,e,"");if(f){f=a(f);f.is("ul")||(f=a("<ul />").append(f));if(b==-1||!b)this.get_container().children("ul").empty().append(f.children()).find("li, a").filter(function(){return!this.firstChild||!this.firstChild.tagName||this.firstChild.tagName!=="INS"}).prepend("<ins class='jstree-icon'>&#160;</ins>").end().filter("a").children("ins:first-child").not(".jstree-icon").addClass("jstree-icon");else{b.children("a.jstree-loading").removeClass("jstree-loading");b.append(f).children("ul").find("li, a").filter(function(){return!this.firstChild||
!this.firstChild.tagName||this.firstChild.tagName!=="INS"}).prepend("<ins class='jstree-icon'>&#160;</ins>").end().filter("a").children("ins:first-child").not(".jstree-icon").addClass("jstree-icon");b.removeData("jstree-is-loading")}this.clean_node(b);g&&g.call(this)}else if(b&&b!==-1){b.children("a.jstree-loading").removeClass("jstree-loading");b.removeData("jstree-is-loading");if(k.correct_state){this.correct_state(b);g&&g.call(this)}}else if(k.correct_state){this.get_container().children("ul").empty();
g&&g.call(this)}},k.ajax.context=this,k.ajax.error=d,k.ajax.success=f,k.ajax.dataType||(k.ajax.dataType="html"),a.isFunction(k.ajax.url)&&(k.ajax.url=k.ajax.url.call(this,b)),a.isFunction(k.ajax.data)&&(k.ajax.data=k.ajax.data.call(this,b)),a.ajax(k.ajax)}}}});a.jstree.defaults.plugins.push("html_data")})(m);(function(a){a.jstree.plugin("themeroller",{__init:function(){var b=this._get_settings().themeroller;this.get_container().addClass("ui-widget-content").addClass("jstree-themeroller").delegate("a",
"mouseenter.jstree",function(g){a(g.currentTarget).hasClass("jstree-loading")||a(this).addClass(b.item_h)}).delegate("a","mouseleave.jstree",function(){a(this).removeClass(b.item_h)}).bind("init.jstree",a.proxy(function(a,b){b.inst.get_container().find("> ul > li > .jstree-loading > ins").addClass("ui-icon-refresh");this._themeroller(b.inst.get_container().find("> ul > li"))},this)).bind("open_node.jstree create_node.jstree",a.proxy(function(a,b){this._themeroller(b.rslt.obj)},this)).bind("loaded.jstree refresh.jstree",
a.proxy(function(){this._themeroller()},this)).bind("close_node.jstree",a.proxy(function(a,b){this._themeroller(b.rslt.obj)},this)).bind("delete_node.jstree",a.proxy(function(a,b){this._themeroller(b.rslt.parent)},this)).bind("correct_state.jstree",a.proxy(function(a,c){c.rslt.obj.children("ins.jstree-icon").removeClass(b.opened+" "+b.closed+" ui-icon").end().find("> a > ins.ui-icon").filter(function(){return-1===this.className.toString().replace(b.item_clsd,"").replace(b.item_open,"").replace(b.item_leaf,
"").indexOf("ui-icon-")}).removeClass(b.item_open+" "+b.item_clsd).addClass(b.item_leaf||"jstree-no-icon")},this)).bind("select_node.jstree",a.proxy(function(a,c){c.rslt.obj.children("a").addClass(b.item_a)},this)).bind("deselect_node.jstree deselect_all.jstree",a.proxy(function(){this.get_container().find("a."+b.item_a).removeClass(b.item_a).end().find("a.jstree-clicked").addClass(b.item_a)},this)).bind("dehover_node.jstree",a.proxy(function(a,c){c.rslt.obj.children("a").removeClass(b.item_h)},this)).bind("hover_node.jstree",
a.proxy(function(a,c){this.get_container().find("a."+b.item_h).not(c.rslt.obj).removeClass(b.item_h);c.rslt.obj.children("a").addClass(b.item_h)},this)).bind("move_node.jstree",a.proxy(function(a,b){this._themeroller(b.rslt.o);this._themeroller(b.rslt.op)},this))},__destroy:function(){var b=this._get_settings().themeroller,g=["ui-icon"];a.each(b,function(a,b){b=b.split(" ");b.length&&(g=g.concat(b))});this.get_container().removeClass("ui-widget-content").find("."+g.join(", .")).removeClass(g.join(" "))},
_fn:{_themeroller:function(a){var c=this._get_settings().themeroller,a=!a||-1==a?this.get_container_ul():this._get_node(a).parent();a.find("li.jstree-closed").children("ins.jstree-icon").removeClass(c.opened).addClass("ui-icon "+c.closed).end().children("a").addClass(c.item).children("ins.jstree-icon").addClass("ui-icon").filter(function(){return-1===this.className.toString().replace(c.item_clsd,"").replace(c.item_open,"").replace(c.item_leaf,"").indexOf("ui-icon-")}).removeClass(c.item_leaf+" "+
c.item_open).addClass(c.item_clsd||"jstree-no-icon").end().end().end().end().find("li.jstree-open").children("ins.jstree-icon").removeClass(c.closed).addClass("ui-icon "+c.opened).end().children("a").addClass(c.item).children("ins.jstree-icon").addClass("ui-icon").filter(function(){return-1===this.className.toString().replace(c.item_clsd,"").replace(c.item_open,"").replace(c.item_leaf,"").indexOf("ui-icon-")}).removeClass(c.item_leaf+" "+c.item_clsd).addClass(c.item_open||"jstree-no-icon").end().end().end().end().find("li.jstree-leaf").children("ins.jstree-icon").removeClass(c.closed+
" ui-icon "+c.opened).end().children("a").addClass(c.item).children("ins.jstree-icon").addClass("ui-icon").filter(function(){return-1===this.className.toString().replace(c.item_clsd,"").replace(c.item_open,"").replace(c.item_leaf,"").indexOf("ui-icon-")}).removeClass(c.item_clsd+" "+c.item_open).addClass(c.item_leaf||"jstree-no-icon")}},defaults:{opened:"ui-icon-triangle-1-se",closed:"ui-icon-triangle-1-e",item:"ui-state-default",item_h:"ui-state-hover",item_a:"ui-state-active",item_open:"ui-icon-folder-open",
item_clsd:"ui-icon-folder-collapsed",item_leaf:"ui-icon-document"}});a(function(){a.vakata.css.add_sheet({str:".jstree-themeroller .ui-icon { overflow:visible; } .jstree-themeroller a { padding:0 2px; } .jstree-themeroller .jstree-no-icon { display:none; }",title:"jstree"})})})(m);(function(a){a.jstree.plugin("unique",{__init:function(){this.get_container().bind("before.jstree",a.proxy(function(b,g){var e=[],f=!0,k;"move_node"==g.func&&(!0===g.args[4]&&g.args[0].o&&g.args[0].o.length)&&(g.args[0].o.children("a").each(function(){e.push(a(this).text().replace(/^\s+/g,
""))}),f=this._check_unique(e,g.args[0].np.find("> ul > li").not(g.args[0].o),"move_node"));if("create_node"==g.func&&(g.args[4]||this._is_loaded(g.args[0]))){f=this._get_node(g.args[0]);if(g.args[1]&&("before"===g.args[1]||"after"===g.args[1]))if(f=this._get_parent(g.args[0]),!f||-1===f)f=this.get_container();"string"===typeof g.args[2]?e.push(g.args[2]):!g.args[2]||!g.args[2].data?e.push(this._get_string("new_node")):e.push(g.args[2].data);f=this._check_unique(e,f.find("> ul > li"),"create_node")}if("rename_node"==
g.func){e.push(g.args[1]);k=this._get_node(g.args[0]);f=this._get_parent(k);if(!f||-1===f)f=this.get_container();f=this._check_unique(e,f.find("> ul > li").not(k),"rename_node")}if(!f)return b.stopPropagation(),!1},this))},defaults:{error_callback:a.noop},_fn:{_check_unique:function(b,g,e){var f=[];g.children("a").each(function(){f.push(a(this).text().replace(/^\s+/g,""))});if(!f.length||!b.length)return!0;f=f.sort().join(",,").replace(/(,|^)([^,]+)(,,\2)+(,|$)/g,"$1$2$4").replace(/,,+/g,",").replace(/,$/,
"").split(",");return f.length+b.length!=f.concat(b).sort().join(",,").replace(/(,|^)([^,]+)(,,\2)+(,|$)/g,"$1$2$4").replace(/,,+/g,",").replace(/,$/,"").split(",").length?(this._get_settings().unique.error_callback.call(null,b,g,e),!1):!0},check_move:function(){if(!this.__call_old())return!1;var b=this._get_move(),g=[];return b.o&&b.o.length?(b.o.children("a").each(function(){g.push(a(this).text().replace(/^\s+/g,""))}),this._check_unique(g,b.np.find("> ul > li").not(b.o),"check_move")):!0}}})})(m);
(function(c){c.jstree.plugin("wholerow",{__init:function(){if(!this.data.ui)throw"jsTree wholerow: jsTree UI plugin not included.";this.data.wholerow.html=!1;this.data.wholerow.to=!1;this.get_container().bind("init.jstree",c.proxy(function(){this._get_settings().core.animation=0},this)).bind("open_node.jstree create_node.jstree clean_node.jstree loaded.jstree",c.proxy(function(a,c){this._prepare_wholerow_span(c&&c.rslt&&c.rslt.obj?c.rslt.obj:-1)},this)).bind("search.jstree clear_search.jstree reopen.jstree after_open.jstree after_close.jstree create_node.jstree delete_node.jstree clean_node.jstree",
c.proxy(function(a,c){this.data.to&&clearTimeout(this.data.to);this.data.to=setTimeout(function(a,b){return function(){a._prepare_wholerow_ul(b)}}(this,c&&c.rslt&&c.rslt.obj?c.rslt.obj:-1),0)},this)).bind("deselect_all.jstree",c.proxy(function(){this.get_container().find(" > .jstree-wholerow .jstree-clicked").removeClass("jstree-clicked "+(this.data.themeroller?this._get_settings().themeroller.item_a:""))},this)).bind("select_node.jstree deselect_node.jstree ",c.proxy(function(a,g){g.rslt.obj.each(function(){g.inst.get_container().find(" > .jstree-wholerow li:visible:eq("+
parseInt((c(this).offset().top-g.inst.get_container().offset().top+g.inst.get_container()[0].scrollTop)/g.inst.data.core.li_height,10)+")").children("a").attr("class",g.rslt.obj.children("a").attr("class"))})},this)).bind("hover_node.jstree dehover_node.jstree",c.proxy(function(a,c){this.get_container().find(" > .jstree-wholerow .jstree-hovered").removeClass("jstree-hovered "+(this.data.themeroller?this._get_settings().themeroller.item_h:""));"hover_node"===a.type&&this.get_container().find(" > .jstree-wholerow li:visible:eq("+
parseInt((c.rslt.obj.offset().top-this.get_container().offset().top+this.get_container()[0].scrollTop)/this.data.core.li_height,10)+")").children("a").attr("class",c.rslt.obj.children(".jstree-hovered").attr("class"))},this)).delegate(".jstree-wholerow-span, ins.jstree-icon, li","click.jstree",function(a){var g=c(a.currentTarget);"A"===a.target.tagName||"INS"===a.target.tagName&&g.closest("li").is(".jstree-open, .jstree-closed")||(g.closest("li").children("a:visible:eq(0)").click(),a.stopImmediatePropagation())}).delegate("li",
"mouseover.jstree",c.proxy(function(a){a.stopImmediatePropagation();if(c(a.currentTarget).children(".jstree-hovered, .jstree-clicked").length)return!1;this.hover_node(a.currentTarget);return!1},this)).delegate("li","mouseleave.jstree",c.proxy(function(a){c(a.currentTarget).children("a").hasClass("jstree-hovered").length||this.dehover_node(a.currentTarget)},this));(a||e)&&c.vakata.css.add_sheet({str:".jstree-"+this.get_index()+" { position:relative; } ",title:"jstree"})},defaults:{},__destroy:function(){this.get_container().children(".jstree-wholerow").remove();
this.get_container().find(".jstree-wholerow-span").remove()},_fn:{_prepare_wholerow_span:function(a){a=!a||-1==a?this.get_container().find("> ul > li"):this._get_node(a);!1!==a&&a.each(function(){c(this).find("li").andSelf().each(function(){var a=c(this);if(a.children(".jstree-wholerow-span").length)return!0;a.prepend("<span class='jstree-wholerow-span' style='width:"+18*a.parentsUntil(".jstree","li").length+"px;'>&#160;</span>")})})},_prepare_wholerow_ul:function(){var b=this.get_container().children("ul").eq(0),
c=b.html();b.addClass("jstree-wholerow-real");this.data.wholerow.last_html!==c&&(this.data.wholerow.last_html=c,this.get_container().children(".jstree-wholerow").remove(),this.get_container().append(b.clone().removeClass("jstree-wholerow-real").wrapAll("<div class='jstree-wholerow' />").parent().width(b.parent()[0].scrollWidth).css("top",-1*(b.height()+(a?5:0))).find("li[id]").each(function(){this.removeAttribute("id")}).end()))}}});c(function(){var b=".jstree .jstree-wholerow-real { position:relative; z-index:1; } .jstree .jstree-wholerow-real li { cursor:pointer; } .jstree .jstree-wholerow-real a { border-left-color:transparent !important; border-right-color:transparent !important; } .jstree .jstree-wholerow { position:relative; z-index:0; height:0; } .jstree .jstree-wholerow ul, .jstree .jstree-wholerow li { width:100%; } .jstree .jstree-wholerow, .jstree .jstree-wholerow ul, .jstree .jstree-wholerow li, .jstree .jstree-wholerow a { margin:0 !important; padding:0 !important; } .jstree .jstree-wholerow, .jstree .jstree-wholerow ul, .jstree .jstree-wholerow li { background:transparent !important; }.jstree .jstree-wholerow ins, .jstree .jstree-wholerow span, .jstree .jstree-wholerow input { display:none !important; }.jstree .jstree-wholerow a, .jstree .jstree-wholerow a:hover { text-indent:-9999px; !important; width:100%; padding:0 !important; border-right-width:0px !important; border-left-width:0px !important; } .jstree .jstree-wholerow-span { position:absolute; left:0; margin:0px; padding:0; height:18px; border-width:0; padding:0; z-index:0; }";
g&&(b+=".jstree .jstree-wholerow a { display:block; height:18px; margin:0; padding:0; border:0; } .jstree .jstree-wholerow-real a { border-color:transparent !important; } ");if(a||e)b+=".jstree .jstree-wholerow, .jstree .jstree-wholerow li, .jstree .jstree-wholerow ul, .jstree .jstree-wholerow a { margin:0; padding:0; line-height:18px; } .jstree .jstree-wholerow a { display:block; height:18px; line-height:18px; overflow:hidden; } ";c.vakata.css.add_sheet({str:b,title:"jstree"})})})(m);(function(a){var b=
["getChildren","getChildrenCount","getAttr","getName","getProps"],g=function(b,f){var g=!0,b=b||{},f=[].concat(f);a.each(f,function(d,f){if(!a.isFunction(b[f]))return g=!1});return g};a.jstree.plugin("model",{__init:function(){if(!this.data.json_data)throw"jsTree model: jsTree json_data plugin not included.";this._get_settings().json_data.data=function(e,f){var k=-1==e?this._get_settings().model.object:e.data("jstree_model");if(!g(k,b))return f.call(null,!1);this._get_settings().model.async?k.getChildren(a.proxy(function(a){this.model_done(a,
f)},this)):this.model_done(k.getChildren(),f)}},defaults:{object:!1,id_prefix:!1,async:!1},_fn:{model_done:function(b,f){var g=[],d=this._get_settings(),j=this;a.isArray(b)||(b=[b]);a.each(b,function(b,f){var e=f.getProps()||{};e.attr=f.getAttr()||{};f.getChildrenCount()&&(e.state="closed");e.data=f.getName();a.isArray(e.data)||(e.data=[e.data]);j.data.types&&a.isFunction(f.getType)&&(e.attr[d.types.type_attr]=f.getType());e.attr.id&&d.model.id_prefix&&(e.attr.id=d.model.id_prefix+e.attr.id);e.metadata||
(e.metadata={});e.metadata.jstree_model=f;g.push(e)});f.call(null,g)}}})})(m)}})()});define("jqgrid",["jquery","jqgrid-locale-"+(window&&window.__DEPS__&&window.__DEPS__.lang||"en"),"jqueryui"],function(m){(function(a){a.jgrid=a.jgrid||{};a.extend(a.jgrid,{htmlDecode:function(a){return a&&("&nbsp;"==a||"&#160;"==a||1==a.length&&160==a.charCodeAt(0))?"":!a?a:(""+a).replace(/&amp;/g,"&").replace(/&gt;/g,">").replace(/&lt;/g,"<").replace(/&quot;/g,'"')},htmlEncode:function(a){return!a?a:(""+a).replace(/&/g,
"&amp;").replace(/>/g,"&gt;").replace(/</g,"&lt;").replace(/\"/g,"&quot;")},format:function(g){var c=a.makeArray(arguments).slice(1);void 0===g&&(g="");return g.replace(/\{(\d+)\}/g,function(a,g){return c[g]})},getCellIndex:function(g){g=a(g);if(g.is("tr"))return-1;g=(!g.is("td")&&!g.is("th")?g.closest("td,th"):g)[0];return a.browser.msie?a.inArray(g,g.parentNode.cells):g.cellIndex},stripHtml:function(a){var a=a+"",c=/<("[^"]*"|'[^']*'|[^'">])*>/gi;return a?(a=a.replace(c,""))&&"&nbsp;"!==a&&"&#160;"!==
a?a.replace(/\"/g,"'"):"":a},stringToDoc:function(a){var c;if("string"!==typeof a)return a;try{c=(new DOMParser).parseFromString(a,"text/xml")}catch(b){c=new ActiveXObject("Microsoft.XMLDOM"),c.async=!1,c.loadXML(a)}return c&&c.documentElement&&"parsererror"!=c.documentElement.tagName?c:null},parse:function(g){"while(1);"==g.substr(0,9)&&(g=g.substr(9));"/*"==g.substr(0,2)&&(g=g.substr(2,g.length-4));g||(g="{}");return!0===a.jgrid.useJSON&&"object"===typeof la&&"function"===typeof la.parse?la.parse(g):
eval("("+g+")")},parseDate:function(g,c){var b={m:1,d:1,y:1970,h:0,i:0,s:0},e,l,f;e=/[\\\/:_;.,\t\T\s-]/;if(c&&null!==c&&void 0!==c){var c=a.trim(c),c=c.split(e),g=g.split(e),k=a.jgrid.formatter.date.monthNames,d=a.jgrid.formatter.date.AmPm,m=function(a,b){0===a?12==b&&(b=0):12!=b&&(b+=12);return b};e=0;for(l=g.length;e<l;e++)"M"==g[e]&&(f=a.inArray(c[e],k),-1!==f&&12>f&&(c[e]=f+1)),"F"==g[e]&&(f=a.inArray(c[e],k),-1!==f&&11<f&&(c[e]=f+1-12)),"a"==g[e]&&(f=a.inArray(c[e],d),-1!==f&&(2>f&&c[e]==d[f])&&
(c[e]=f,b.h=m(c[e],b.h))),"A"==g[e]&&(f=a.inArray(c[e],d),-1!==f&&(1<f&&c[e]==d[f])&&(c[e]=f-2,b.h=m(c[e],b.h))),void 0!==c[e]&&(b[g[e].toLowerCase()]=parseInt(c[e],10));b.m=parseInt(b.m,10)-1;e=b.y;70<=e&&99>=e?b.y=1900+b.y:0<=e&&69>=e&&(b.y=2E3+b.y)}return new Date(b.y,b.m,b.d,b.h,b.i,b.s,0)},jqID:function(a){return(a+"").replace(/([\.\:\[\]])/g,"\\$1")},guid:1,uidPref:"jqg",randId:function(g){return(g?g:a.jgrid.uidPref)+a.jgrid.guid++},getAccessor:function(a,c){var b,e,l=[],f;if("function"===typeof c)return c(a);
b=a[c];if(void 0===b)try{if("string"===typeof c&&(l=c.split(".")),f=l.length)for(b=a;b&&f--;)e=l.shift(),b=b[e]}catch(k){}return b},ajaxOptions:{},from:function(g){return new function(c,b){"string"==typeof c&&(c=a.data(c));var g=this,e=c,f=!0,k=!1,d=b,m=/[\$,%]/g,o=null,r=null,p=!1,u="",t=[],y=!0;if("object"==typeof c&&c.push)0<c.length&&(y="object"!=typeof c[0]?!1:!0);else throw"data provides is not an array";this._hasData=function(){return null===e?!1:0===e.length?!1:!0};this._getStr=function(a){var b=
[];k&&b.push("jQuery.trim(");b.push("String("+a+")");k&&b.push(")");f||b.push(".toLowerCase()");return b.join("")};this._strComp=function(a){return"string"==typeof a?".toString()":""};this._group=function(a,b){return{field:a.toString(),unique:b,items:[]}};this._toStr=function(b){k&&(b=a.trim(b));f||(b=b.toLowerCase());return b.toString().replace(/\\/g,"\\\\").replace(/\"/g,'\\"')};this._funcLoop=function(b){var c=[];a.each(e,function(a,d){c.push(b(d))});return c};this._append=function(a){d=null===
d?"":d+(""===u?" && ":u);p&&(d+="!");d+="("+a+")";p=!1;u=""};this._setCommand=function(a,b){o=a;r=b};this._resetNegate=function(){p=!1};this._repeatCommand=function(a,b){return null===o?g:null!==a&&null!==b?o(a,b):null===r||!y?o(a):o(r,a)};this._equals=function(a,b){return 0===g._compare(a,b,1)};this._compare=function(a,b,c){void 0===c&&(c=1);void 0===a&&(a=null);void 0===b&&(b=null);if(null===a&&null===b)return 0;if(null===a&&null!==b)return 1;if(null!==a&&null===b)return-1;!f&&("number"!==typeof a&&
"number"!==typeof b)&&(a=(""+a).toLowerCase(),b=(""+b).toLowerCase());return a<b?-c:a>b?c:0};this._performSort=function(){0!==t.length&&(e=g._doSort(e,0))};this._doSort=function(a,b){var c=t[b].by,d=t[b].dir,f=t[b].type,e=t[b].datefmt;if(b==t.length-1)return g._getOrder(a,c,d,f,e);b++;c=g._getGroup(a,c,d,f,e);d=[];for(f=0;f<c.length;f++)for(var e=g._doSort(c[f].items,b),k=0;k<e.length;k++)d.push(e[k]);return d};this._getOrder=function(b,c,d,f,e){var k=[],l=[],o="a"==d?1:-1,p,r;void 0===f&&(f="text");
r="float"==f||"number"==f||"currency"==f||"numeric"==f?function(a){a=parseFloat((""+a).replace(m,""));return isNaN(a)?0:a}:"int"==f||"integer"==f?function(a){return a?parseFloat((""+a).replace(m,"")):0}:"date"==f||"datetime"==f?function(b){return a.jgrid.parseDate(e,b).getTime()}:a.isFunction(f)?f:function(b){b||(b="");return a.trim((""+b).toUpperCase())};a.each(b,function(b,d){p=""!==c?a.jgrid.getAccessor(d,c):d;void 0===p&&(p="");p=r(p,d);l.push({vSort:p,index:b})});l.sort(function(a,b){a=a.vSort;
b=b.vSort;return g._compare(a,b,o)});for(var f=0,t=b.length;f<t;)d=l[f].index,k.push(b[d]),f++;return k};this._getGroup=function(b,c,d,f,e){var k=[],l=null,m=null,o;a.each(g._getOrder(b,c,d,f,e),function(b,d){o=a.jgrid.getAccessor(d,c);void 0===o&&(o="");g._equals(m,o)||(m=o,null!==l&&k.push(l),l=g._group(c,o));l.items.push(d)});null!==l&&k.push(l);return k};this.ignoreCase=function(){f=!1;return g};this.useCase=function(){f=!0;return g};this.trim=function(){k=!0;return g};this.noTrim=function(){k=
!1;return g};this.execute=function(){var b=d,c=[];if(null===b)return g;a.each(e,function(){eval(b)&&c.push(this)});e=c;return g};this.data=function(){return e};this.select=function(b){g._performSort();if(!g._hasData())return[];g.execute();if(a.isFunction(b)){var c=[];a.each(e,function(a,d){c.push(b(d))});return c}return e};this.hasMatch=function(){if(!g._hasData())return!1;g.execute();return 0<e.length};this.andNot=function(a,b,c){p=!p;return g.and(a,b,c)};this.orNot=function(a,b,c){p=!p;return g.or(a,
b,c)};this.not=function(a,b,c){return g.andNot(a,b,c)};this.and=function(a,b,c){u=" && ";return void 0===a?g:g._repeatCommand(a,b,c)};this.or=function(a,b,c){u=" || ";return void 0===a?g:g._repeatCommand(a,b,c)};this.isNot=function(a){p=!p;return g.is(a)};this.is=function(a){g._append("this."+a);g._resetNegate();return g};this._compareValues=function(b,c,d,f,e){var k;k=y?"jQuery.jgrid.getAccessor(this,'"+c+"')":"this";void 0===d&&(d=null);var l=d,o=void 0===e.stype?"text":e.stype;if(null!==d)switch(o){case "int":case "integer":l=
isNaN(Number(l))||""===l?"0":l;k="parseInt("+k+",10)";l="parseInt("+l+",10)";break;case "float":case "number":case "numeric":l=(""+l).replace(m,"");l=isNaN(Number(l))||""===l?"0":l;k="parseFloat("+k+")";l="parseFloat("+l+")";break;case "date":case "datetime":l=""+a.jgrid.parseDate(e.newfmt||"Y-m-d",l).getTime();k='jQuery.jgrid.parseDate("'+e.srcfmt+'",'+k+").getTime()";break;default:k=g._getStr(k),l=g._getStr('"'+g._toStr(l)+'"')}g._append(k+" "+f+" "+l);g._setCommand(b,c);g._resetNegate();return g};
this.equals=function(a,b,c){return g._compareValues(g.equals,a,b,"==",c)};this.notEquals=function(a,b,c){return g._compareValues(g.equals,a,b,"!==",c)};this.isNull=function(a,b,c){return g._compareValues(g.equals,a,null,"===",c)};this.greater=function(a,b,c){return g._compareValues(g.greater,a,b,">",c)};this.less=function(a,b,c){return g._compareValues(g.less,a,b,"<",c)};this.greaterOrEquals=function(a,b,c){return g._compareValues(g.greaterOrEquals,a,b,">=",c)};this.lessOrEquals=function(a,b,c){return g._compareValues(g.lessOrEquals,
a,b,"<=",c)};this.startsWith=function(b,c){var d=void 0===c||null===c?b:c,d=k?a.trim(d.toString()).length:d.toString().length;y?g._append(g._getStr("jQuery.jgrid.getAccessor(this,'"+b+"')")+".substr(0,"+d+") == "+g._getStr('"'+g._toStr(c)+'"')):(d=k?a.trim(c.toString()).length:c.toString().length,g._append(g._getStr("this")+".substr(0,"+d+") == "+g._getStr('"'+g._toStr(b)+'"')));g._setCommand(g.startsWith,b);g._resetNegate();return g};this.endsWith=function(b,c){var d=void 0===c||null===c?b:c,d=k?
a.trim(d.toString()).length:d.toString().length;y?g._append(g._getStr("jQuery.jgrid.getAccessor(this,'"+b+"')")+".substr("+g._getStr("jQuery.jgrid.getAccessor(this,'"+b+"')")+".length-"+d+","+d+') == "'+g._toStr(c)+'"'):g._append(g._getStr("this")+".substr("+g._getStr("this")+'.length-"'+g._toStr(b)+'".length,"'+g._toStr(b)+'".length) == "'+g._toStr(b)+'"');g._setCommand(g.endsWith,b);g._resetNegate();return g};this.contains=function(a,b){y?g._append(g._getStr("jQuery.jgrid.getAccessor(this,'"+a+
"')")+'.indexOf("'+g._toStr(b)+'",0) > -1'):g._append(g._getStr("this")+'.indexOf("'+g._toStr(a)+'",0) > -1');g._setCommand(g.contains,a);g._resetNegate();return g};this.groupBy=function(a,b,c,d){return!g._hasData()?null:g._getGroup(e,a,b,c,d)};this.orderBy=function(b,c,d,f){c=void 0===c||null===c?"a":a.trim(c.toString().toLowerCase());if(null===d||void 0===d)d="text";if(null===f||void 0===f)f="Y-m-d";if("desc"==c||"descending"==c)c="d";if("asc"==c||"ascending"==c)c="a";t.push({by:b,dir:c,type:d,
datefmt:f});return g};return g}(g,null)},extend:function(g){a.extend(a.fn.jqGrid,g);this.no_legacy_api||a.fn.extend(g)}});a.fn.jqGrid=function(g){if("string"==typeof g){var c=a.jgrid.getAccessor(a.fn.jqGrid,g);if(!c)throw"jqGrid - No such method: "+g;var b=a.makeArray(arguments).slice(1);return c.apply(this,b)}return this.each(function(){if(!this.grid){var b=a.extend(!0,{url:"",height:150,page:1,rowNum:20,rowTotal:null,records:0,pager:"",pgbuttons:!0,pginput:!0,colModel:[],rowList:[],colNames:[],
sortorder:"asc",sortname:"",datatype:"xml",mtype:"GET",altRows:!1,selarrrow:[],savedRow:[],shrinkToFit:!0,xmlReader:{},jsonReader:{},subGrid:!1,subGridModel:[],reccount:0,lastpage:0,lastsort:0,selrow:null,beforeSelectRow:null,onSelectRow:null,onSortCol:null,ondblClickRow:null,onRightClickRow:null,onPaging:null,onSelectAll:null,loadComplete:null,gridComplete:null,loadError:null,loadBeforeSend:null,afterInsertRow:null,beforeRequest:null,onHeaderClick:null,viewrecords:!1,loadonce:!1,multiselect:!1,multikey:!1,
editurl:null,search:!1,caption:"",hidegrid:!0,hiddengrid:!1,postData:{},userData:{},treeGrid:!1,treeGridModel:"nested",treeReader:{},treeANode:-1,ExpandColumn:null,tree_root_level:0,prmNames:{page:"page",rows:"rows",sort:"sidx",order:"sord",search:"_search",nd:"nd",id:"id",oper:"oper",editoper:"edit",addoper:"add",deloper:"del",subgridid:"id",npage:null,totalrows:"totalrows"},forceFit:!1,gridstate:"visible",cellEdit:!1,cellsubmit:"remote",nv:0,loadui:"enable",toolbar:[!1,""],scroll:!1,multiboxonly:!1,
deselectAfterSort:!0,scrollrows:!1,autowidth:!1,scrollOffset:18,cellLayout:5,subGridWidth:20,multiselectWidth:20,gridview:!1,rownumWidth:25,rownumbers:!1,pagerpos:"center",recordpos:"right",footerrow:!1,userDataOnFooter:!1,hoverrows:!0,altclass:"ui-priority-secondary",viewsortcols:[!1,"vertical",!0],resizeclass:"",autoencode:!1,remapColumns:[],ajaxGridOptions:{},direction:"ltr",toppager:!1,headertitles:!1,scrollTimeout:40,data:[],_index:{},grouping:!1,groupingView:{groupField:[],groupOrder:[],groupText:[],
groupColumnShow:[],groupSummary:[],showSummaryOnHide:!1,sortitems:[],sortnames:[],groupDataSorted:!1,summary:[],summaryval:[],plusicon:"ui-icon-circlesmall-plus",minusicon:"ui-icon-circlesmall-minus"},ignoreCase:!1,cmTemplate:{}},a.jgrid.defaults,g||{}),c={headers:[],cols:[],footers:[],dragStart:function(c,d,f){this.resizing={idx:c,startX:d.clientX,sOL:f[0]};this.hDiv.style.cursor="col-resize";this.curGbox=a("#rs_m"+a.jgrid.jqID(b.id),"#gbox_"+a.jgrid.jqID(b.id));this.curGbox.css({display:"block",
left:f[0],top:f[1],height:f[2]});a.isFunction(b.resizeStart)&&b.resizeStart.call(this,d,c);document.onselectstart=function(){return!1}},dragMove:function(a){if(this.resizing){var c=a.clientX-this.resizing.startX,a=this.headers[this.resizing.idx],d="ltr"===b.direction?a.width+c:a.width-c,f;33<d&&(this.curGbox.css({left:this.resizing.sOL+c}),!0===b.forceFit?(f=this.headers[this.resizing.idx+b.nv],c="ltr"===b.direction?f.width-c:f.width+c,33<c&&(a.newWidth=d,f.newWidth=c)):(this.newWidth="ltr"===b.direction?
b.tblwidth+c:b.tblwidth-c,a.newWidth=d))}},dragEnd:function(){this.hDiv.style.cursor="default";if(this.resizing){var c=this.resizing.idx,d=this.headers[c].newWidth||this.headers[c].width,d=parseInt(d,10);this.resizing=!1;a("#rs_m"+a.jgrid.jqID(b.id)).css("display","none");b.colModel[c].width=d;this.headers[c].width=d;this.headers[c].el.style.width=d+"px";this.cols[c].style.width=d+"px";0<this.footers.length&&(this.footers[c].style.width=d+"px");!0===b.forceFit?(d=this.headers[c+b.nv].newWidth||this.headers[c+
b.nv].width,this.headers[c+b.nv].width=d,this.headers[c+b.nv].el.style.width=d+"px",this.cols[c+b.nv].style.width=d+"px",0<this.footers.length&&(this.footers[c+b.nv].style.width=d+"px"),b.colModel[c+b.nv].width=d):(b.tblwidth=this.newWidth||b.tblwidth,a("table:first",this.bDiv).css("width",b.tblwidth+"px"),a("table:first",this.hDiv).css("width",b.tblwidth+"px"),this.hDiv.scrollLeft=this.bDiv.scrollLeft,b.footerrow&&(a("table:first",this.sDiv).css("width",b.tblwidth+"px"),this.sDiv.scrollLeft=this.bDiv.scrollLeft));
a.isFunction(b.resizeStop)&&b.resizeStop.call(this,d,c)}this.curGbox=null;document.onselectstart=function(){return!0}},populateVisible:function(){c.timer&&clearTimeout(c.timer);c.timer=null;var d=a(c.bDiv).height();if(d){var f=a("table:first",c.bDiv),g,e;if(f[0].rows.length)try{e=(g=f[0].rows[1])?a(g).outerHeight()||c.prevRowHeight:c.prevRowHeight}catch(k){e=c.prevRowHeight}if(e){c.prevRowHeight=e;var m=b.rowNum;g=c.scrollTop=c.bDiv.scrollTop;var o=Math.round(f.position().top)-g,q=o+f.height();e*=
m;var p,r,t;if(q<d&&0>=o&&(void 0===b.lastpage||parseInt((q+g+e-1)/e,10)<=b.lastpage))r=parseInt((d-q+e-1)/e,10),0<=q||2>r||!0===b.scroll?(p=Math.round((q+g)/e)+1,o=-1):o=1;0<o&&(p=parseInt(g/e,10)+1,r=parseInt((g+d)/e,10)+2-p,t=!0);if(r&&!(b.lastpage&&p>b.lastpage||1==b.lastpage||p===b.page&&p===b.lastpage))c.hDiv.loading?c.timer=setTimeout(c.populateVisible,b.scrollTimeout):(b.page=p,t&&(c.selectionPreserver(f[0]),c.emptyRows(c.bDiv,!1,!1)),c.populate(r))}}},scrollGrid:function(a){if(b.scroll){var d=
c.bDiv.scrollTop;void 0===c.scrollTop&&(c.scrollTop=0);d!=c.scrollTop&&(c.scrollTop=d,c.timer&&clearTimeout(c.timer),c.timer=setTimeout(c.populateVisible,b.scrollTimeout))}c.hDiv.scrollLeft=c.bDiv.scrollLeft;b.footerrow&&(c.sDiv.scrollLeft=c.bDiv.scrollLeft);a.stopPropagation()},selectionPreserver:function(b){var c=b.p,d=c.selrow,f=c.selarrrow?a.makeArray(c.selarrrow):null,g=b.grid.bDiv.scrollLeft,e=c.gridComplete;c.gridComplete=function(){c.selrow=null;c.selarrrow=[];if(c.multiselect&&f&&0<f.length)for(var j=
0;j<f.length;j++)f[j]!=d&&a(b).jqGrid("setSelection",f[j],!1);d&&a(b).jqGrid("setSelection",d,!1);b.grid.bDiv.scrollLeft=g;c.gridComplete=e;c.gridComplete&&e()}}};if("TABLE"!=this.tagName)alert("Element is not a table");else{a(this).empty().attr("tabindex","1");this.p=b;var f,e,d;if(0===this.p.colNames.length)for(f=0;f<this.p.colModel.length;f++)this.p.colNames[f]=this.p.colModel[f].label||this.p.colModel[f].name;if(this.p.colNames.length!==this.p.colModel.length)alert(a.jgrid.errors.model);else{var m=
a("<div class='ui-jqgrid-view'></div>"),o,r=a.browser.msie?!0:!1,p=a.browser.webkit||a.browser.safari?!0:!1;d=this;d.p.direction=a.trim(d.p.direction.toLowerCase());-1==a.inArray(d.p.direction,["ltr","rtl"])&&(d.p.direction="ltr");e=d.p.direction;a(m).insertBefore(this);a(this).appendTo(m).removeClass("scroll");var u=a("<div class='ui-jqgrid ui-widget ui-widget-content ui-corner-all'></div>");a(u).insertBefore(m).attr({id:"gbox_"+this.id,dir:e});a(m).appendTo(u).attr("id","gview_"+this.id);o=r&&6>=
a.browser.version?'<iframe style="display:block;position:absolute;z-index:-1;filter:Alpha(Opacity=\'0\');" src="javascript:false;"></iframe>':"";a("<div class='ui-widget-overlay jqgrid-overlay' id='lui_"+this.id+"'></div>").append(o).insertBefore(m);a("<div class='loading ui-state-default ui-state-active' id='load_"+this.id+"'>"+this.p.loadtext+"</div>").insertBefore(m);a(this).attr({cellspacing:"0",cellpadding:"0",border:"0",role:"grid","aria-multiselectable":!!this.p.multiselect,"aria-labelledby":"gbox_"+
this.id});var t=function(a,b){a=parseInt(a,10);return isNaN(a)?b?b:0:a},y=function(b,f,g,e,j,k){var m=d.p.colModel[b],o=m.align,q='style="',p=m.classes,r=m.name,t=[];o&&(q=q+("text-align:"+o+";"));m.hidden===true&&(q=q+"display:none;");if(f===0)q=q+("width: "+c.headers[b].width+"px;");else if(m.cellattr&&a.isFunction(m.cellattr)&&(b=m.cellattr.call(d,j,g,e,m,k))&&typeof b==="string"){b=b.replace(/style/i,"style").replace(/title/i,"title");if(b.indexOf("title")>-1)m.title=false;b.indexOf("class")>
-1&&(p=void 0);t=b.split("style");if(t.length===2){t[1]=a.trim(t[1].replace("=",""));if(t[1].indexOf("'")===0||t[1].indexOf('"')===0)t[1]=t[1].substring(1);q=q+t[1].replace(/'/gi,'"')}else q=q+'"'}if(!t.length){t[0]="";q=q+'"'}q=q+((p!==void 0?' class="'+p+'"':"")+(m.title&&g?' title="'+a.jgrid.stripHtml(g)+'"':""));q=q+(' aria-describedby="'+d.p.id+"_"+r+'"');return q+t[0]},z=function(b){return b===void 0||b===null||b===""?"&#160;":d.p.autoencode?a.jgrid.htmlEncode(b):b+""},x=function(b,c,f,g,e){var j=
d.p.colModel[f];if(typeof j.formatter!=="undefined"){b={rowId:b,colModel:j,gid:d.p.id,pos:f};c=a.isFunction(j.formatter)?j.formatter.call(d,c,b,g,e):a.fmatter?a.fn.fmatter(j.formatter,c,b,g,e):z(c)}else c=z(c);return c},v=function(a,b,c,d,f){b=x(a,b,c,f,"add");return'<td role="gridcell" '+y(c,d,b,f,a,true)+">"+b+"</td>"},A=function(a,b,c){var f='<input role="checkbox" type="checkbox" id="jqg_'+d.p.id+"_"+a+'" class="cbox" name="jqg_'+d.p.id+"_"+a+'"/>';return'<td role="gridcell" '+y(b,c,"",null,a,
true)+">"+f+"</td>"},B=function(a,b,c,d){c=(parseInt(c,10)-1)*parseInt(d,10)+1+b;return'<td role="gridcell" class="ui-state-default jqgrid-rownum" '+y(a,b,c,null,b,true)+">"+c+"</td>"},E=function(a){var b,c=[],f=0,g;for(g=0;g<d.p.colModel.length;g++){b=d.p.colModel[g];if(b.name!=="cb"&&b.name!=="subgrid"&&b.name!=="rn"){c[f]=a=="local"?b.name:a=="xml"?b.xmlmap||b.name:b.jsonmap||b.name;f++}}return c},F=function(b){var c=d.p.remapColumns;if(!c||!c.length)c=a.map(d.p.colModel,function(a,b){return b});
b&&(c=a.map(c,function(a){return a<b?null:a-b}));return c},J=function(b,c,f){if(d.p.deepempty)a("#"+a.jgrid.jqID(d.p.id)+" tbody:first tr:gt(0)").remove();else{var g=a("#"+a.jgrid.jqID(d.p.id)+" tbody:first tr:first")[0];a("#"+a.jgrid.jqID(d.p.id)+" tbody:first").empty().append(g)}if(c&&d.p.scroll){a(">div:first",b).css({height:"auto"}).children("div:first").css({height:0,display:"none"});b.scrollTop=0}if(f===true&&d.p.treeGrid===true){d.p.data=[];d.p._index={}}},I=function(){var b=d.p.data.length,
c,f,g;c=d.p.rownumbers===true?1:0;f=d.p.multiselect===true?1:0;g=d.p.subGrid===true?1:0;c=d.p.keyIndex===false||d.p.loadonce===true?d.p.localReader.id:d.p.colModel[d.p.keyIndex+f+g+c].name;for(f=0;f<b;f++){g=a.jgrid.getAccessor(d.p.data[f],c);d.p._index[g]=f}},N=function(b,c,f,g,e){var j=new Date,k=d.p.datatype!="local"&&d.p.loadonce||d.p.datatype=="xmlstring",l=d.p.datatype=="local"?"local":"xml";if(k){d.p.data=[];d.p._index={};d.p.localReader.id="_id_"}d.p.reccount=0;if(a.isXMLDoc(b)){if(d.p.treeANode===
-1&&!d.p.scroll){J(c,false,true);f=1}else f=f>1?f:1;var m,o,q=0,p,r=0,t=0,u=0,x,y=[],z,C={},I,K,D=[],P=d.p.altRows===true?" "+d.p.altclass:"";d.p.xmlReader.repeatitems||(y=E(l));x=d.p.keyIndex===false?d.p.xmlReader.id:d.p.keyIndex;if(y.length>0&&!isNaN(x)){d.p.remapColumns&&d.p.remapColumns.length&&(x=a.inArray(x,d.p.remapColumns));x=y[x]}l=(x+"").indexOf("[")===-1?y.length?function(b,c){return a(x,b).text()||c}:function(b,c){return a(d.p.xmlReader.cell,b).eq(x).text()||c}:function(a,b){return a.getAttribute(x.replace(/[\[\]]/g,
""))||b};d.p.userData={};a(d.p.xmlReader.page,b).each(function(){d.p.page=this.textContent||this.text||0});a(d.p.xmlReader.total,b).each(function(){d.p.lastpage=this.textContent||this.text;if(d.p.lastpage===void 0)d.p.lastpage=1});a(d.p.xmlReader.records,b).each(function(){d.p.records=this.textContent||this.text||0});a(d.p.xmlReader.userdata,b).each(function(){d.p.userData[this.getAttribute("name")]=this.textContent||this.text});(b=a(d.p.xmlReader.root+" "+d.p.xmlReader.row,b))||(b=[]);var H=b.length,
G=0,N={},V;if(b&&H){V=parseInt(d.p.rowNum,10);var L=d.p.scroll?a.jgrid.randId():1;e&&(V=V*(e+1));var e=a.isFunction(d.p.afterInsertRow),S="";for(d.p.grouping&&d.p.groupingView.groupCollapse===true&&(S=' style="display:none;"');G<H;){I=b[G];K=l(I,L+G);m=f===0?0:f+1;m=(m+G)%2==1?P:"";D.push("<tr"+S+' id="'+K+'" tabindex="-1" role="row" class ="ui-widget-content jqgrow ui-row-'+d.p.direction+""+m+'">');if(d.p.rownumbers===true){D.push(B(0,G,d.p.page,d.p.rowNum));u=1}if(d.p.multiselect===true){D.push(A(K,
u,G));r=1}if(d.p.subGrid===true){D.push(a(d).jqGrid("addSubGridCell",r+u,G+f));t=1}if(d.p.xmlReader.repeatitems){z||(z=F(r+t+u));var ea=a(d.p.xmlReader.cell,I);a.each(z,function(a){var b=ea[this];if(!b)return false;p=b.textContent||b.text;C[d.p.colModel[a+r+t+u].name]=p;D.push(v(K,p,a+r+t+u,G+f,I))})}else for(m=0;m<y.length;m++){p=a(y[m],I).text();C[d.p.colModel[m+r+t+u].name]=p;D.push(v(K,p,m+r+t+u,G+f,I))}D.push("</tr>");if(d.p.grouping){m=d.p.groupingView.groupField.length;for(var O=[],T=0;T<m;T++)O.push(C[d.p.groupingView.groupField[T]]);
N=a(d).jqGrid("groupingPrepare",D,O,N,C);D=[]}if(k||d.p.treeGrid===true){C._id_=K;d.p.data.push(C);d.p._index[K]=d.p.data.length-1}if(d.p.gridview===false){a("tbody:first",c).append(D.join(""));e&&d.p.afterInsertRow.call(d,K,C,I);D=[]}C={};q++;G++;if(q==V)break}}if(d.p.gridview===true){o=d.p.treeANode>-1?d.p.treeANode:0;if(d.p.grouping){a(d).jqGrid("groupingRender",N,d.p.colModel.length);N=null}else d.p.treeGrid===true&&o>0?a(d.rows[o]).after(D.join("")):a("tbody:first",c).append(D.join(""))}if(d.p.subGrid===
true)try{a(d).jqGrid("addSubGrid",r+u)}catch(R){}d.p.totaltime=new Date-j;if(q>0&&d.p.records===0)d.p.records=H;D=null;if(d.p.treeGrid===true)try{a(d).jqGrid("setTreeNode",o+1,q+o+1)}catch(Q){}if(!d.p.treeGrid&&!d.p.scroll)d.grid.bDiv.scrollTop=0;d.p.reccount=q;d.p.treeANode=-1;d.p.userDataOnFooter&&a(d).jqGrid("footerData","set",d.p.userData,true);if(k){d.p.records=H;d.p.lastpage=Math.ceil(H/V)}g||d.updatepager(false,true);if(k)for(;q<H;){I=b[q];K=l(I,q);if(d.p.xmlReader.repeatitems){z||(z=F(r+t+
u));var fa=a(d.p.xmlReader.cell,I);a.each(z,function(a){var b=fa[this];if(!b)return false;p=b.textContent||b.text;C[d.p.colModel[a+r+t+u].name]=p})}else for(m=0;m<y.length;m++){p=a(y[m],I).text();C[d.p.colModel[m+r+t+u].name]=p}C._id_=K;d.p.data.push(C);d.p._index[K]=d.p.data.length-1;C={};q++}}},D=function(b,c,f,g,e){var j=new Date;if(b){if(d.p.treeANode===-1&&!d.p.scroll){J(c,false,true);f=1}else f=f>1?f:1;var k,l=d.p.datatype!="local"&&d.p.loadonce||d.p.datatype=="jsonstring";if(l){d.p.data=[];
d.p._index={};d.p.localReader.id="_id_"}d.p.reccount=0;if(d.p.datatype=="local"){c=d.p.localReader;k="local"}else{c=d.p.jsonReader;k="json"}var m=0,o,q,p=[],r,t=0,u=0,x=0,y,z,C={},I,K,D=[],P=d.p.altRows===true?" "+d.p.altclass:"";d.p.page=a.jgrid.getAccessor(b,c.page)||0;y=a.jgrid.getAccessor(b,c.total);d.p.lastpage=y===void 0?1:y;d.p.records=a.jgrid.getAccessor(b,c.records)||0;d.p.userData=a.jgrid.getAccessor(b,c.userdata)||{};c.repeatitems||(r=p=E(k));k=d.p.keyIndex===false?c.id:d.p.keyIndex;if(p.length>
0&&!isNaN(k)){d.p.remapColumns&&d.p.remapColumns.length&&(k=a.inArray(k,d.p.remapColumns));k=p[k]}(z=a.jgrid.getAccessor(b,c.root))||(z=[]);y=z.length;var b=0,H=parseInt(d.p.rowNum,10),G=d.p.scroll?a.jgrid.randId():1;e&&(H=H*(e+1));var N=a.isFunction(d.p.afterInsertRow),V={},L="";for(d.p.grouping&&d.p.groupingView.groupCollapse===true&&(L=' style="display:none;"');b<y;){e=z[b];K=a.jgrid.getAccessor(e,k);if(K===void 0){K=G+b;p.length===0&&c.cell&&(K=a.jgrid.getAccessor(e,c.cell)[k]||K)}o=f===1?0:f;
o=(o+b)%2==1?P:"";D.push("<tr"+L+' id="'+K+'" tabindex="-1" role="row" class= "ui-widget-content jqgrow ui-row-'+d.p.direction+""+o+'">');if(d.p.rownumbers===true){D.push(B(0,b,d.p.page,d.p.rowNum));x=1}if(d.p.multiselect){D.push(A(K,x,b));t=1}if(d.p.subGrid){D.push(a(d).jqGrid("addSubGridCell",t+x,b+f));u=1}if(c.repeatitems){c.cell&&(e=a.jgrid.getAccessor(e,c.cell));r||(r=F(t+u+x))}for(q=0;q<r.length;q++){o=a.jgrid.getAccessor(e,r[q]);D.push(v(K,o,q+t+u+x,b+f,e));C[d.p.colModel[q+t+u+x].name]=o}D.push("</tr>");
if(d.p.grouping){o=d.p.groupingView.groupField.length;q=[];for(var S=0;S<o;S++)q.push(C[d.p.groupingView.groupField[S]]);V=a(d).jqGrid("groupingPrepare",D,q,V,C);D=[]}if(l||d.p.treeGrid===true){C._id_=K;d.p.data.push(C);d.p._index[K]=d.p.data.length-1}if(d.p.gridview===false){a("#"+a.jgrid.jqID(d.p.id)+" tbody:first").append(D.join(""));N&&d.p.afterInsertRow.call(d,K,C,e);D=[]}C={};m++;b++;if(m==H)break}if(d.p.gridview===true){I=d.p.treeANode>-1?d.p.treeANode:0;d.p.grouping?a(d).jqGrid("groupingRender",
V,d.p.colModel.length):d.p.treeGrid===true&&I>0?a(d.rows[I]).after(D.join("")):a("#"+a.jgrid.jqID(d.p.id)+" tbody:first").append(D.join(""))}if(d.p.subGrid===true)try{a(d).jqGrid("addSubGrid",t+x)}catch(ea){}d.p.totaltime=new Date-j;if(m>0&&d.p.records===0)d.p.records=y;if(d.p.treeGrid===true)try{a(d).jqGrid("setTreeNode",I+1,m+I+1)}catch(O){}if(!d.p.treeGrid&&!d.p.scroll)d.grid.bDiv.scrollTop=0;d.p.reccount=m;d.p.treeANode=-1;d.p.userDataOnFooter&&a(d).jqGrid("footerData","set",d.p.userData,true);
if(l){d.p.records=y;d.p.lastpage=Math.ceil(y/H)}g||d.updatepager(false,true);if(l)for(;m<y&&z[m];){e=z[m];K=a.jgrid.getAccessor(e,k);if(K===void 0){K=G+m;p.length===0&&c.cell&&(K=a.jgrid.getAccessor(e,c.cell)[k]||K)}if(e){if(c.repeatitems){c.cell&&(e=a.jgrid.getAccessor(e,c.cell));r||(r=F(t+u+x))}for(q=0;q<r.length;q++){o=a.jgrid.getAccessor(e,r[q]);C[d.p.colModel[q+t+u+x].name]=o}C._id_=K;d.p.data.push(C);d.p._index[K]=d.p.data.length-1;C={}}m++}}},Z=function(){function b(c){var d=0,f,e,j;if(c.groups!==
void 0)for(f=0;f<c.groups.length;f++){try{b(c.groups[f])}catch(k){alert(k)}d++}if(c.rules!==void 0){if(d>0){var l=p.select();p=a.jgrid.from(l)}try{for(f=0;f<c.rules.length;f++){j=c.rules[f];e=c.groupOp.toString().toUpperCase();if(q[j.op]&&j.field){d>0&&(e&&e==="OR")&&(p=p.or());p=q[j.op](p,e)(j.field,j.data,g[j.field])}d++}}catch(m){alert(m)}}}var c,f=false,g={},e=[],j=[],k,l,m;if(a.isArray(d.p.data)){var o=d.p.grouping?d.p.groupingView:false;a.each(d.p.colModel,function(){l=this.sorttype||"text";
if(l=="date"||l=="datetime"){if(this.formatter&&typeof this.formatter==="string"&&this.formatter=="date"){k=this.formatoptions&&this.formatoptions.srcformat?this.formatoptions.srcformat:a.jgrid.formatter.date.srcformat;m=this.formatoptions&&this.formatoptions.newformat?this.formatoptions.newformat:a.jgrid.formatter.date.newformat}else k=m=this.datefmt||"Y-m-d";g[this.name]={stype:l,srcfmt:k,newfmt:m}}else g[this.name]={stype:l,srcfmt:"",newfmt:""};if(d.p.grouping&&this.name==o.groupField[0]){var b=
this.name;if(typeof this.index!="undefined")b=this.index;e[0]=g[b];j.push(b)}if(!f&&(this.index==d.p.sortname||this.name==d.p.sortname)){c=this.name;f=true}});if(d.p.treeGrid)a(d).jqGrid("SortTree",c,d.p.sortorder,g[c].stype,g[c].srcfmt);else{var q={eq:function(a){return a.equals},ne:function(a){return a.notEquals},lt:function(a){return a.less},le:function(a){return a.lessOrEquals},gt:function(a){return a.greater},ge:function(a){return a.greaterOrEquals},cn:function(a){return a.contains},nc:function(a,
b){return b==="OR"?a.orNot().contains:a.andNot().contains},bw:function(a){return a.startsWith},bn:function(a,b){return b==="OR"?a.orNot().startsWith:a.andNot().startsWith},en:function(a,b){return b==="OR"?a.orNot().endsWith:a.andNot().endsWith},ew:function(a){return a.endsWith},ni:function(a,b){return b==="OR"?a.orNot().equals:a.andNot().equals},"in":function(a){return a.equals},nu:function(a){return a.isNull},nn:function(a,b){return b==="OR"?a.orNot().isNull:a.andNot().isNull}},p=a.jgrid.from(d.p.data);
d.p.ignoreCase&&(p=p.ignoreCase());if(d.p.search===true){var r=d.p.postData.filters;if(r){typeof r=="string"&&(r=a.jgrid.parse(r));b(r)}else try{p=q[d.p.postData.searchOper](p)(d.p.postData.searchField,d.p.postData.searchString,g[d.p.postData.searchField])}catch(t){}}if(d.p.grouping){p.orderBy(j,o.groupOrder[0],e[0].stype,e[0].srcfmt);o.groupDataSorted=true}c&&(d.p.sortorder&&f)&&(d.p.sortorder.toUpperCase()=="DESC"?p.orderBy(d.p.sortname,"d",g[c].stype,g[c].srcfmt):p.orderBy(d.p.sortname,"a",g[c].stype,
g[c].srcfmt));var r=p.select(),u=parseInt(d.p.rowNum,10),x=r.length,v=parseInt(d.p.page,10),y=Math.ceil(x/u),z={},r=r.slice((v-1)*u,v*u),g=p=null;z[d.p.localReader.total]=y;z[d.p.localReader.page]=v;z[d.p.localReader.records]=x;z[d.p.localReader.root]=r;r=null;return z}}},ca=function(){d.grid.hDiv.loading=true;if(!d.p.hiddengrid)switch(d.p.loadui){case "enable":a("#load_"+a.jgrid.jqID(d.p.id)).show();break;case "block":a("#lui_"+a.jgrid.jqID(d.p.id)).show();a("#load_"+a.jgrid.jqID(d.p.id)).show()}},
ba=function(){d.grid.hDiv.loading=false;switch(d.p.loadui){case "enable":a("#load_"+a.jgrid.jqID(d.p.id)).hide();break;case "block":a("#lui_"+a.jgrid.jqID(d.p.id)).hide();a("#load_"+a.jgrid.jqID(d.p.id)).hide()}},T=function(b){if(!d.grid.hDiv.loading){var c=d.p.scroll&&b===false,f={},g,e=d.p.prmNames;if(d.p.page<=0)d.p.page=1;if(e.search!==null)f[e.search]=d.p.search;e.nd!==null&&(f[e.nd]=(new Date).getTime());if(e.rows!==null)f[e.rows]=d.p.rowNum;if(e.page!==null)f[e.page]=d.p.page;if(e.sort!==null)f[e.sort]=
d.p.sortname;if(e.order!==null)f[e.order]=d.p.sortorder;if(d.p.rowTotal!==null&&e.totalrows!==null)f[e.totalrows]=d.p.rowTotal;var j=d.p.loadComplete,k=a.isFunction(j);k||(j=null);var l=0,b=b||1;if(b>1)if(e.npage!==null){f[e.npage]=b;l=b-1;b=1}else j=function(a){d.p.page++;d.grid.hDiv.loading=false;k&&d.p.loadComplete.call(d,a);T(b-1)};else e.npage!==null&&delete d.p.postData[e.npage];if(d.p.grouping){a(d).jqGrid("groupingSetup");d.p.groupingView.groupDataSorted===true&&(f[e.sort]=d.p.groupingView.groupField[0]+
" "+d.p.groupingView.groupOrder[0]+", "+f[e.sort])}a.extend(d.p.postData,f);var m=!d.p.scroll?1:d.rows.length-1;if(a.isFunction(d.p.datatype))d.p.datatype.call(d,d.p.postData,"load_"+d.p.id);else{a.isFunction(d.p.beforeRequest)&&d.p.beforeRequest.call(d);g=d.p.datatype.toLowerCase();switch(g){case "json":case "jsonp":case "xml":case "script":a.ajax(a.extend({url:d.p.url,type:d.p.mtype,dataType:g,data:a.isFunction(d.p.serializeGridData)?d.p.serializeGridData.call(d,d.p.postData):d.p.postData,success:function(a){g===
"xml"?N(a,d.grid.bDiv,m,b>1,l):D(a,d.grid.bDiv,m,b>1,l);j&&j.call(d,a);c&&d.grid.populateVisible();if(d.p.loadonce||d.p.treeGrid)d.p.datatype="local";ba()},error:function(b,c,f){a.isFunction(d.p.loadError)&&d.p.loadError.call(d,b,c,f);ba()},beforeSend:function(b){ca();a.isFunction(d.p.loadBeforeSend)&&d.p.loadBeforeSend.call(d,b)}},a.jgrid.ajaxOptions,d.p.ajaxGridOptions));break;case "xmlstring":ca();f=a.jgrid.stringToDoc(d.p.datastr);N(f,d.grid.bDiv);k&&d.p.loadComplete.call(d,f);d.p.datatype="local";
d.p.datastr=null;ba();break;case "jsonstring":ca();f=typeof d.p.datastr=="string"?a.jgrid.parse(d.p.datastr):d.p.datastr;D(f,d.grid.bDiv);k&&d.p.loadComplete.call(d,f);d.p.datatype="local";d.p.datastr=null;ba();break;case "local":case "clientside":ca();d.p.datatype="local";f=Z();D(f,d.grid.bDiv,m,b>1,l);j&&j.call(d,f);c&&d.grid.populateVisible();ba()}}}};o=function(b,c){var f="",g="<table cellspacing='0' cellpadding='0' border='0' style='table-layout:auto;' class='ui-pg-table'><tbody><tr>",j="",l,
m,o,q,p=function(b){var c;a.isFunction(d.p.onPaging)&&(c=d.p.onPaging.call(d,b));d.p.selrow=null;if(d.p.multiselect){d.p.selarrrow=[];a("#cb_"+a.jgrid.jqID(d.p.id),d.grid.hDiv).attr("checked",false)}d.p.savedRow=[];return c=="stop"?false:true},b=b.substr(1);l="pg_"+b;m=b+"_left";o=b+"_center";q=b+"_right";a("#"+a.jgrid.jqID(b)).append("<div id='"+l+"' class='ui-pager-control' role='group'><table cellspacing='0' cellpadding='0' border='0' class='ui-pg-table' style='width:100%;table-layout:fixed;height:100%;' role='row'><tbody><tr><td id='"+
m+"' align='left'></td><td id='"+o+"' align='center' style='white-space:pre;'></td><td id='"+q+"' align='right'></td></tr></tbody></table></div>").attr("dir","ltr");if(d.p.rowList.length>0){j="<td dir='"+e+"'>";j=j+"<select class='ui-pg-selbox' role='listbox'>";for(m=0;m<d.p.rowList.length;m++)j=j+('<option role="option" value="'+d.p.rowList[m]+'"'+(d.p.rowNum==d.p.rowList[m]?' selected="selected"':"")+">"+d.p.rowList[m]+"</option>");j=j+"</select></td>"}e=="rtl"&&(g=g+j);d.p.pginput===true&&(f="<td dir='"+
e+"'>"+a.jgrid.format(d.p.pgtext||"","<input class='ui-pg-input' type='text' size='2' maxlength='7' value='0' role='textbox'/>","<span id='sp_1'></span>")+"</td>");if(d.p.pgbuttons===true){m=["first"+c,"prev"+c,"next"+c,"last"+c];e=="rtl"&&m.reverse();g=g+("<td id='"+m[0]+"' class='ui-pg-button ui-corner-all'><span class='ui-icon ui-icon-seek-first'></span></td>");g=g+("<td id='"+m[1]+"' class='ui-pg-button ui-corner-all'><span class='ui-icon ui-icon-seek-prev'></span></td>");g=g+(f!==""?"<td class='ui-pg-button ui-state-disabled' style='width:4px;'><span class='ui-separator'></span></td>"+
f+"<td class='ui-pg-button ui-state-disabled' style='width:4px;'><span class='ui-separator'></span></td>":"")+("<td id='"+m[2]+"' class='ui-pg-button ui-corner-all'><span class='ui-icon ui-icon-seek-next'></span></td>");g=g+("<td id='"+m[3]+"' class='ui-pg-button ui-corner-all'><span class='ui-icon ui-icon-seek-end'></span></td>")}else f!==""&&(g=g+f);e=="ltr"&&(g=g+j);g=g+"</tr></tbody></table>";d.p.viewrecords===true&&a("td#"+b+"_"+d.p.recordpos,"#"+l).append("<div dir='"+e+"' style='text-align:"+
d.p.recordpos+"' class='ui-paging-info'></div>");a("td#"+b+"_"+d.p.pagerpos,"#"+l).append(g);j=a(".ui-jqgrid").css("font-size")||"11px";a(document.body).append("<div id='testpg' class='ui-jqgrid ui-widget ui-widget-content' style='font-size:"+j+";visibility:hidden;' ></div>");g=a(g).clone().appendTo("#testpg").width();a("#testpg").remove();if(g>0){f!==""&&(g=g+50);a("td#"+b+"_"+d.p.pagerpos,"#"+l).width(g)}d.p._nvtd=[];d.p._nvtd[0]=g?Math.floor((d.p.width-g)/2):Math.floor(d.p.width/3);d.p._nvtd[1]=
0;g=null;a(".ui-pg-selbox","#"+l).bind("change",function(){d.p.page=Math.round(d.p.rowNum*(d.p.page-1)/this.value-0.5)+1;d.p.rowNum=this.value;c?a(".ui-pg-selbox",d.p.pager).val(this.value):d.p.toppager&&a(".ui-pg-selbox",d.p.toppager).val(this.value);if(!p("records"))return false;T();return false});if(d.p.pgbuttons===true){a(".ui-pg-button","#"+l).hover(function(){if(a(this).hasClass("ui-state-disabled"))this.style.cursor="default";else{a(this).addClass("ui-state-hover");this.style.cursor="pointer"}},
function(){if(!a(this).hasClass("ui-state-disabled")){a(this).removeClass("ui-state-hover");this.style.cursor="default"}});a("#first"+c+", #prev"+c+", #next"+c+", #last"+c,"#"+b).click(function(){var a=t(d.p.page,1),b=t(d.p.lastpage,1),f=false,g=true,e=true,j=true,k=true;if(b===0||b===1)k=j=e=g=false;else if(b>1&&a>=1)a===1?e=g=false:a>1&&a<b||a===b&&(k=j=false);else if(b>1&&a===0){k=j=false;a=b-1}if(this.id==="first"+c&&g){d.p.page=1;f=true}if(this.id==="prev"+c&&e){d.p.page=a-1;f=true}if(this.id===
"next"+c&&j){d.p.page=a+1;f=true}if(this.id==="last"+c&&k){d.p.page=b;f=true}if(f){if(!p(this.id))return false;T()}return false})}d.p.pginput===true&&a("input.ui-pg-input","#"+l).keypress(function(b){if((b.charCode?b.charCode:b.keyCode?b.keyCode:0)==13){d.p.page=a(this).val()>0?a(this).val():d.p.page;if(!p("user"))return false;T();return false}return this})};var $=function(b,c,f,g){if(d.p.colModel[c].sortable&&!(d.p.savedRow.length>0)){if(!f){if(d.p.lastsort==c)if(d.p.sortorder=="asc")d.p.sortorder=
"desc";else{if(d.p.sortorder=="desc")d.p.sortorder="asc"}else d.p.sortorder=d.p.colModel[c].firstsortorder||"asc";d.p.page=1}if(g){if(d.p.lastsort==c&&d.p.sortorder==g&&!f)return;d.p.sortorder=g}f=a("thead:first",d.grid.hDiv).get(0);a("tr th:eq("+d.p.lastsort+") span.ui-grid-ico-sort",f).addClass("ui-state-disabled");a("tr th:eq("+d.p.lastsort+")",f).attr("aria-selected","false");a("tr th:eq("+c+") span.ui-icon-"+d.p.sortorder,f).removeClass("ui-state-disabled");a("tr th:eq("+c+")",f).attr("aria-selected",
"true");if(!d.p.viewsortcols[0]&&d.p.lastsort!=c){a("tr th:eq("+d.p.lastsort+") span.s-ico",f).hide();a("tr th:eq("+c+") span.s-ico",f).show()}b=b.substring(5);d.p.sortname=d.p.colModel[c].index||b;f=d.p.sortorder;if(a.isFunction(d.p.onSortCol)&&d.p.onSortCol.call(d,b,c,f)=="stop")d.p.lastsort=c;else{if(d.p.datatype=="local")d.p.deselectAfterSort&&a(d).jqGrid("resetSelection");else{d.p.selrow=null;d.p.multiselect&&a("#cb_"+a.jgrid.jqID(d.p.id),d.grid.hDiv).attr("checked",false);d.p.selarrrow=[];d.p.savedRow=
[]}if(d.p.scroll){f=d.grid.bDiv.scrollLeft;J(d.grid.bDiv,true,false);d.grid.hDiv.scrollLeft=f}d.p.subGrid&&d.p.datatype=="local"&&a("td.sgexpanded","#"+a.jgrid.jqID(d.p.id)).each(function(){a(this).trigger("click")});T();d.p.lastsort=c;if(d.p.sortname!=b&&c)d.p.lastsort=c}}},G=function(b){var c,f={},g=p?0:d.p.cellLayout;for(c=f[0]=f[1]=f[2]=0;c<=b;c++)d.p.colModel[c].hidden===false&&(f[0]=f[0]+(d.p.colModel[c].width+g));d.p.direction=="rtl"&&(f[0]=d.p.width-f[0]);f[0]=f[0]-d.grid.bDiv.scrollLeft;
a(d.grid.cDiv).is(":visible")&&(f[1]=f[1]+(a(d.grid.cDiv).height()+parseInt(a(d.grid.cDiv).css("padding-top"),10)+parseInt(a(d.grid.cDiv).css("padding-bottom"),10)));if(d.p.toolbar[0]===true&&(d.p.toolbar[1]=="top"||d.p.toolbar[1]=="both"))f[1]=f[1]+(a(d.grid.uDiv).height()+parseInt(a(d.grid.uDiv).css("border-top-width"),10)+parseInt(a(d.grid.uDiv).css("border-bottom-width"),10));d.p.toppager&&(f[1]=f[1]+(a(d.grid.topDiv).height()+parseInt(a(d.grid.topDiv).css("border-bottom-width"),10)));f[2]=f[2]+
(a(d.grid.bDiv).height()+a(d.grid.hDiv).height());return f};this.p.id=this.id;-1==a.inArray(d.p.multikey,["shiftKey","altKey","ctrlKey"])&&(d.p.multikey=!1);d.p.keyIndex=!1;for(f=0;f<d.p.colModel.length;f++)d.p.colModel[f]=a.extend(!0,{},d.p.cmTemplate,d.p.colModel[f].template||{},d.p.colModel[f]),!1===d.p.keyIndex&&!0===d.p.colModel[f].key&&(d.p.keyIndex=f);d.p.sortorder=d.p.sortorder.toLowerCase();!0===d.p.grouping&&(d.p.scroll=!1,d.p.rownumbers=!1,d.p.subGrid=!1,d.p.treeGrid=!1,d.p.gridview=!0);
if(!0===this.p.treeGrid){try{a(this).jqGrid("setTreeGrid")}catch(O){}"local"!=d.p.datatype&&(d.p.localReader={id:"_id_"})}if(this.p.subGrid)try{a(d).jqGrid("setSubGrid")}catch(R){}this.p.multiselect&&(this.p.colNames.unshift("<input role='checkbox' id='cb_"+this.p.id+"' class='cbox' type='checkbox'/>"),this.p.colModel.unshift({name:"cb",width:p?d.p.multiselectWidth+d.p.cellLayout:d.p.multiselectWidth,sortable:!1,resizable:!1,hidedlg:!0,search:!1,align:"center",fixed:!0}));this.p.rownumbers&&(this.p.colNames.unshift(""),
this.p.colModel.unshift({name:"rn",width:d.p.rownumWidth,sortable:!1,resizable:!1,hidedlg:!0,search:!1,align:"center",fixed:!0}));d.p.xmlReader=a.extend(!0,{root:"rows",row:"row",page:"rows>page",total:"rows>total",records:"rows>records",repeatitems:!0,cell:"cell",id:"[id]",userdata:"userdata",subgrid:{root:"rows",row:"row",repeatitems:!0,cell:"cell"}},d.p.xmlReader);d.p.jsonReader=a.extend(!0,{root:"rows",page:"page",total:"total",records:"records",repeatitems:!0,cell:"cell",id:"id",userdata:"userdata",
subgrid:{root:"rows",repeatitems:!0,cell:"cell"}},d.p.jsonReader);d.p.localReader=a.extend(!0,{root:"rows",page:"page",total:"total",records:"records",repeatitems:!1,cell:"cell",id:"id",userdata:"userdata",subgrid:{root:"rows",repeatitems:!0,cell:"cell"}},d.p.localReader);d.p.scroll&&(d.p.pgbuttons=!1,d.p.pginput=!1,d.p.rowList=[]);d.p.data.length&&I();var W="<thead><tr class='ui-jqgrid-labels' role='rowheader'>",Q,K,P,ea,C,S,V,fa;K=fa="";if(!0===d.p.shrinkToFit&&!0===d.p.forceFit)for(f=d.p.colModel.length-
1;0<=f;f--)if(!d.p.colModel[f].hidden){d.p.colModel[f].resizable=!1;break}"horizontal"==d.p.viewsortcols[1]&&(fa=" ui-i-asc",K=" ui-i-desc");Q=r?"class='ui-th-div-ie'":"";fa="<span class='s-ico' style='display:none'><span sort='asc' class='ui-grid-ico-sort ui-icon-asc"+fa+" ui-state-disabled ui-icon ui-icon-triangle-1-n ui-sort-"+e+"'></span>"+("<span sort='desc' class='ui-grid-ico-sort ui-icon-desc"+K+" ui-state-disabled ui-icon ui-icon-triangle-1-s ui-sort-"+e+"'></span></span>");for(f=0;f<this.p.colNames.length;f++)K=
d.p.headertitles?' title="'+a.jgrid.stripHtml(d.p.colNames[f])+'"':"",W+="<th id='"+d.p.id+"_"+d.p.colModel[f].name+"' role='columnheader' class='ui-state-default ui-th-column ui-th-"+e+"'"+K+">",K=d.p.colModel[f].index||d.p.colModel[f].name,W+="<div id='jqgh_"+d.p.colModel[f].name+"' "+Q+">"+d.p.colNames[f],d.p.colModel[f].width=d.p.colModel[f].width?parseInt(d.p.colModel[f].width,10):150,"boolean"!==typeof d.p.colModel[f].title&&(d.p.colModel[f].title=!0),K==d.p.sortname&&(d.p.lastsort=f),W+=fa+
"</div></th>";fa=null;a(this).append(W+"</tr></thead>");a("thead tr:first th",this).hover(function(){a(this).addClass("ui-state-hover")},function(){a(this).removeClass("ui-state-hover")});if(this.p.multiselect){var Na=[],Ia;a("#cb_"+a.jgrid.jqID(d.p.id),this).bind("click",function(){d.p.selarrrow=[];if(this.checked){a(d.rows).each(function(b){if(b>0&&!a(this).hasClass("subgrid")&&!a(this).hasClass("jqgroup")&&!a(this).hasClass("ui-state-disabled")){a("#jqg_"+a.jgrid.jqID(d.p.id)+"_"+a.jgrid.jqID(this.id)).attr("checked",
"checked");a(this).addClass("ui-state-highlight").attr("aria-selected","true");d.p.selarrrow.push(this.id);d.p.selrow=this.id}});Ia=true;Na=[]}else{a(d.rows).each(function(b){if(b>0&&!a(this).hasClass("subgrid")&&!a(this).hasClass("ui-state-disabled")){a("#jqg_"+a.jgrid.jqID(d.p.id)+"_"+a.jgrid.jqID(this.id)).removeAttr("checked");a(this).removeClass("ui-state-highlight").attr("aria-selected","false");Na.push(this.id)}});d.p.selrow=null;Ia=false}a.isFunction(d.p.onSelectAll)&&d.p.onSelectAll.call(d,
Ia?d.p.selarrrow:Na,Ia)})}!0===d.p.autowidth&&(W=a(u).innerWidth(),d.p.width=0<W?W:"nw");(function(){var b=0,f=p?0:d.p.cellLayout,g=0,e,j=d.p.scrollOffset,k,m=false,o,q=0,r=0,u;a.each(d.p.colModel,function(){if(typeof this.hidden==="undefined")this.hidden=false;this.widthOrg=k=t(this.width,0);if(this.hidden===false){b=b+(k+f);this.fixed?q=q+(k+f):g++;r++}});isNaN(d.p.width)?d.p.width=c.width=b:c.width=d.p.width;d.p.tblwidth=b;if(d.p.shrinkToFit===false&&d.p.forceFit===true)d.p.forceFit=false;if(d.p.shrinkToFit===
true&&g>0){o=c.width-f*g-q;if(!isNaN(d.p.height)){o=o-j;m=true}b=0;a.each(d.p.colModel,function(a){if(this.hidden===false&&!this.fixed){this.width=k=Math.round(o*this.width/(d.p.tblwidth-f*g-q));b=b+k;e=a}});u=0;m?c.width-q-(b+f*g)!==j&&(u=c.width-q-(b+f*g)-j):!m&&Math.abs(c.width-q-(b+f*g))!==1&&(u=c.width-q-(b+f*g));d.p.colModel[e].width=d.p.colModel[e].width+u;d.p.tblwidth=b+u+f*g+q;if(d.p.tblwidth>d.p.width){d.p.colModel[e].width=d.p.colModel[e].width-(d.p.tblwidth-parseInt(d.p.width,10));d.p.tblwidth=
d.p.width}}})();a(u).css("width",c.width+"px").append("<div class='ui-jqgrid-resize-mark' id='rs_m"+d.p.id+"'>&#160;</div>");a(m).css("width",c.width+"px");var W=a("thead:first",d).get(0),sa="";d.p.footerrow&&(sa+="<table role='grid' style='width:"+d.p.tblwidth+"px' class='ui-jqgrid-ftable' cellspacing='0' cellpadding='0' border='0'><tbody><tr role='row' class='ui-widget-content footrow footrow-"+e+"'>");var m=a("tr:first",W),Da="<tr class='jqgfirstrow' role='row' style='height:auto'>";d.p.disableClick=
!1;a("th",m).each(function(b){P=d.p.colModel[b].width;if(typeof d.p.colModel[b].resizable==="undefined")d.p.colModel[b].resizable=true;if(d.p.colModel[b].resizable){ea=document.createElement("span");a(ea).html("&#160;").addClass("ui-jqgrid-resize ui-jqgrid-resize-"+e);a.browser.opera||a(ea).css("cursor","col-resize");a(this).addClass(d.p.resizeclass)}else ea="";a(this).css("width",P+"px").prepend(ea);var f="";if(d.p.colModel[b].hidden){a(this).css("display","none");f="display:none;"}Da=Da+("<td role='gridcell' style='height:0px;width:"+
P+"px;"+f+"'></td>");c.headers[b]={width:P,el:this};C=d.p.colModel[b].sortable;if(typeof C!=="boolean")C=d.p.colModel[b].sortable=true;f=d.p.colModel[b].name;f=="cb"||f=="subgrid"||f=="rn"||d.p.viewsortcols[2]&&a("div",this).addClass("ui-jqgrid-sortable");if(C)if(d.p.viewsortcols[0]){a("div span.s-ico",this).show();b==d.p.lastsort&&a("div span.ui-icon-"+d.p.sortorder,this).removeClass("ui-state-disabled")}else if(b==d.p.lastsort){a("div span.s-ico",this).show();a("div span.ui-icon-"+d.p.sortorder,
this).removeClass("ui-state-disabled")}d.p.footerrow&&(sa=sa+("<td role='gridcell' "+y(b,0,"",null,"",false)+">&#160;</td>"))}).mousedown(function(b){if(a(b.target).closest("th>span.ui-jqgrid-resize").length==1){var f=a.jgrid.getCellIndex(this);if(d.p.forceFit===true){var g=d.p,e=f,j;for(j=f+1;j<d.p.colModel.length;j++)if(d.p.colModel[j].hidden!==true){e=j;break}g.nv=e-f}c.dragStart(f,b,G(f));return false}}).click(function(b){if(d.p.disableClick)return d.p.disableClick=false;var c="th>div.ui-jqgrid-sortable",
f,g;d.p.viewsortcols[2]||(c="th>div>span>span.ui-grid-ico-sort");b=a(b.target).closest(c);if(b.length==1){c=a.jgrid.getCellIndex(this);if(!d.p.viewsortcols[2]){f=true;g=b.attr("sort")}$(a("div",this)[0].id,c,f,g);return false}});if(d.p.sortable&&a.fn.sortable)try{a(d).jqGrid("sortableColumns",m)}catch(ia){}d.p.footerrow&&(sa+="</tr></tbody></table>");Da+="</tr>";this.appendChild(document.createElement("tbody"));a(this).addClass("ui-jqgrid-btable").append(Da);var Da=null,m=a("<table class='ui-jqgrid-htable' style='width:"+
d.p.tblwidth+"px' role='grid' aria-labelledby='gbox_"+this.id+"' cellspacing='0' cellpadding='0' border='0'></table>").append(W),ja=d.p.caption&&!0===d.p.hiddengrid?!0:!1;f=a("<div class='ui-jqgrid-hbox"+("rtl"==e?"-rtl":"")+"'></div>");W=null;c.hDiv=document.createElement("div");a(c.hDiv).css({width:c.width+"px"}).addClass("ui-state-default ui-jqgrid-hdiv").append(f);a(f).append(m);m=null;ja&&a(c.hDiv).hide();d.p.pager&&("string"==typeof d.p.pager?"#"!=d.p.pager.substr(0,1)&&(d.p.pager="#"+d.p.pager):
d.p.pager="#"+a(d.p.pager).attr("id"),a(d.p.pager).css({width:c.width+"px"}).appendTo(u).addClass("ui-state-default ui-jqgrid-pager ui-corner-bottom"),ja&&a(d.p.pager).hide(),o(d.p.pager,""));!1===d.p.cellEdit&&!0===d.p.hoverrows&&a(d).bind("mouseover",function(b){V=a(b.target).closest("tr.jqgrow");a(V).attr("class")!=="subgrid"&&a(V).addClass("ui-state-hover");return false}).bind("mouseout",function(b){V=a(b.target).closest("tr.jqgrow");a(V).removeClass("ui-state-hover");return false});var ua,H;
a(d).before(c.hDiv).click(function(b){S=b.target;V=a(S,d.rows).closest("tr.jqgrow");if(a(V).length===0||V[0].className.indexOf("ui-state-disabled")>-1)return this;var c=a(S).hasClass("cbox"),f=true;a.isFunction(d.p.beforeSelectRow)&&(f=d.p.beforeSelectRow.call(d,V[0].id,b));if(!(S.tagName=="A"||(S.tagName=="INPUT"||S.tagName=="TEXTAREA"||S.tagName=="OPTION"||S.tagName=="SELECT")&&!c)&&f===true){if(d.p.cellEdit===true)if(d.p.multiselect&&c)a(d).jqGrid("setSelection",V[0].id,true);else{ua=V[0].rowIndex;
H=a.jgrid.getCellIndex(S);try{a(d).jqGrid("editCell",ua,H,true)}catch(g){}}else if(d.p.multikey)if(b[d.p.multikey])a(d).jqGrid("setSelection",V[0].id,true);else{if(d.p.multiselect&&c){c=a("[id^=jqg_"+a.jgrid.jqID(d.p.id)+"_]").attr("checked");a("[id^=jqg_"+a.jgrid.jqID(d.p.id)+"_]").attr("checked",!c)}}else{if(d.p.multiselect&&d.p.multiboxonly&&!c){a(d.p.selarrrow).each(function(b,c){var f=d.rows.namedItem(c);a(f).removeClass("ui-state-highlight");a("#jqg_"+a.jgrid.jqID(d.p.id)+"_"+a.jgrid.jqID(c)).attr("checked",
false)});d.p.selarrrow=[];a("#cb_"+a.jgrid.jqID(d.p.id),d.grid.hDiv).attr("checked",false)}a(d).jqGrid("setSelection",V[0].id,true)}if(a.isFunction(d.p.onCellSelect)){ua=V[0].id;H=a.jgrid.getCellIndex(S);d.p.onCellSelect.call(d,ua,H,a(S).html(),b)}b.stopPropagation()}else return this}).bind("reloadGrid",function(b,c){if(d.p.treeGrid===true)d.p.datatype=d.p.treedatatype;c&&c.current&&d.grid.selectionPreserver(d);if(d.p.datatype=="local"){a(d).jqGrid("resetSelection");d.p.data.length&&I()}else if(!d.p.treeGrid){d.p.selrow=
null;if(d.p.multiselect){d.p.selarrrow=[];a("#cb_"+a.jgrid.jqID(d.p.id),d.grid.hDiv).attr("checked",false)}d.p.savedRow=[]}d.p.scroll&&J(d.grid.bDiv,true,false);if(c&&c.page){var f=c.page;if(f>d.p.lastpage)f=d.p.lastpage;f<1&&(f=1);d.p.page=f;d.grid.bDiv.scrollTop=d.grid.prevRowHeight?(f-1)*d.grid.prevRowHeight*d.p.rowNum:0}if(d.grid.prevRowHeight&&d.p.scroll){delete d.p.lastpage;d.grid.populateVisible()}else d.grid.populate();return false});a.isFunction(this.p.ondblClickRow)&&a(this).dblclick(function(b){S=
b.target;V=a(S,d.rows).closest("tr.jqgrow");if(a(V).length===0)return false;ua=V[0].rowIndex;H=a.jgrid.getCellIndex(S);d.p.ondblClickRow.call(d,a(V).attr("id"),ua,H,b);return false});a.isFunction(this.p.onRightClickRow)&&a(this).bind("contextmenu",function(b){S=b.target;V=a(S,d.rows).closest("tr.jqgrow");if(a(V).length===0)return false;d.p.multiselect||a(d).jqGrid("setSelection",V[0].id,true);ua=V[0].rowIndex;H=a.jgrid.getCellIndex(S);d.p.onRightClickRow.call(d,a(V).attr("id"),ua,H,b);return false});
c.bDiv=document.createElement("div");r&&"auto"===(""+d.p.height).toLowerCase()&&(d.p.height="100%");a(c.bDiv).append(a('<div style="position:relative;'+(r&&8>a.browser.version?"height:0.01%;":"")+'"></div>').append("<div></div>").append(this)).addClass("ui-jqgrid-bdiv").css({height:d.p.height+(isNaN(d.p.height)?"":"px"),width:c.width+"px"}).scroll(c.scrollGrid);a("table:first",c.bDiv).css({width:d.p.tblwidth+"px"});r?(2==a("tbody",this).size()&&a("tbody:gt(0)",this).remove(),d.p.multikey&&a(c.bDiv).bind("selectstart",
function(){return false})):d.p.multikey&&a(c.bDiv).bind("mousedown",function(){return false});ja&&a(c.bDiv).hide();c.cDiv=document.createElement("div");var ka=!0===d.p.hidegrid?a("<a role='link' href='javascript:void(0)'/>").addClass("ui-jqgrid-titlebar-close HeaderButton").hover(function(){ka.addClass("ui-state-hover")},function(){ka.removeClass("ui-state-hover")}).append("<span class='ui-icon ui-icon-circle-triangle-n'></span>").css("rtl"==e?"left":"right","0px"):"";a(c.cDiv).append(ka).append("<span class='ui-jqgrid-title"+
("rtl"==e?"-rtl":"")+"'>"+d.p.caption+"</span>").addClass("ui-jqgrid-titlebar ui-widget-header ui-corner-top ui-helper-clearfix");a(c.cDiv).insertBefore(c.hDiv);d.p.toolbar[0]&&(c.uDiv=document.createElement("div"),"top"==d.p.toolbar[1]?a(c.uDiv).insertBefore(c.hDiv):"bottom"==d.p.toolbar[1]&&a(c.uDiv).insertAfter(c.hDiv),"both"==d.p.toolbar[1]?(c.ubDiv=document.createElement("div"),a(c.uDiv).insertBefore(c.hDiv).addClass("ui-userdata ui-state-default").attr("id","t_"+this.id),a(c.ubDiv).insertAfter(c.hDiv).addClass("ui-userdata ui-state-default").attr("id",
"tb_"+this.id),ja&&a(c.ubDiv).hide()):a(c.uDiv).width(c.width).addClass("ui-userdata ui-state-default").attr("id","t_"+this.id),ja&&a(c.uDiv).hide());d.p.toppager&&(d.p.toppager=a.jgrid.jqID(d.p.id)+"_toppager",c.topDiv=a("<div id='"+d.p.toppager+"'></div>")[0],d.p.toppager="#"+d.p.toppager,a(c.topDiv).insertBefore(c.hDiv).addClass("ui-state-default ui-jqgrid-toppager").width(c.width),o(d.p.toppager,"_t"));d.p.footerrow&&(c.sDiv=a("<div class='ui-jqgrid-sdiv'></div>")[0],f=a("<div class='ui-jqgrid-hbox"+
("rtl"==e?"-rtl":"")+"'></div>"),a(c.sDiv).append(f).insertAfter(c.hDiv).width(c.width),a(f).append(sa),c.footers=a(".ui-jqgrid-ftable",c.sDiv)[0].rows[0].cells,d.p.rownumbers&&(c.footers[0].className="ui-state-default jqgrid-rownum"),ja&&a(c.sDiv).hide());f=null;if(d.p.caption){var la=d.p.datatype;!0===d.p.hidegrid&&(a(".ui-jqgrid-titlebar-close",c.cDiv).click(function(b){var f=a.isFunction(d.p.onHeaderClick),g=".ui-jqgrid-bdiv, .ui-jqgrid-hdiv, .ui-jqgrid-pager, .ui-jqgrid-sdiv",e,j=this;if(d.p.toolbar[0]===
true){d.p.toolbar[1]=="both"&&(g=g+(", #"+a(c.ubDiv).attr("id")));g=g+(", #"+a(c.uDiv).attr("id"))}e=a(g,"#gview_"+a.jgrid.jqID(d.p.id)).length;d.p.gridstate=="visible"?a(g,"#gbox_"+a.jgrid.jqID(d.p.id)).slideUp("fast",function(){e--;if(e===0){a("span",j).removeClass("ui-icon-circle-triangle-n").addClass("ui-icon-circle-triangle-s");d.p.gridstate="hidden";a("#gbox_"+a.jgrid.jqID(d.p.id)).hasClass("ui-resizable")&&a(".ui-resizable-handle","#gbox_"+a.jgrid.jqID(d.p.id)).hide();f&&(ja||d.p.onHeaderClick.call(d,
d.p.gridstate,b))}}):d.p.gridstate=="hidden"&&a(g,"#gbox_"+a.jgrid.jqID(d.p.id)).slideDown("fast",function(){e--;if(e===0){a("span",j).removeClass("ui-icon-circle-triangle-s").addClass("ui-icon-circle-triangle-n");if(ja){d.p.datatype=la;T();ja=false}d.p.gridstate="visible";a("#gbox_"+a.jgrid.jqID(d.p.id)).hasClass("ui-resizable")&&a(".ui-resizable-handle","#gbox_"+a.jgrid.jqID(d.p.id)).show();f&&(ja||d.p.onHeaderClick.call(d,d.p.gridstate,b))}});return false}),ja&&(d.p.datatype="local",a(".ui-jqgrid-titlebar-close",
c.cDiv).trigger("click")))}else a(c.cDiv).hide();a(c.hDiv).after(c.bDiv).mousemove(function(a){if(c.resizing){c.dragMove(a);return false}});a(".ui-jqgrid-labels",c.hDiv).bind("selectstart",function(){return false});a(document).mouseup(function(){if(c.resizing){c.dragEnd();return false}return true});d.formatCol=y;d.sortData=$;d.updatepager=function(b,c){var f,g,e,j,k,l,m,o="";e=parseInt(d.p.page,10)-1;e<0&&(e=0);e=e*parseInt(d.p.rowNum,10);k=e+d.p.reccount;if(d.p.scroll){f=a("tbody:first > tr:gt(0)",
d.grid.bDiv);e=k-f.length;d.p.reccount=f.length;if(g=f.outerHeight()||d.grid.prevRowHeight){f=e*g;g=g*parseInt(d.p.records,10);a(">div:first",d.grid.bDiv).css({height:g}).children("div:first").css({height:f,display:f?"":"none"})}d.grid.bDiv.scrollLeft=d.grid.hDiv.scrollLeft}o=d.p.pager?d.p.pager:"";if(o=o+(d.p.toppager?o?","+d.p.toppager:d.p.toppager:"")){m=a.jgrid.formatter.integer||{};f=t(d.p.page);g=t(d.p.lastpage);a(".selbox",o).attr("disabled",false);if(d.p.pginput===true){a(".ui-pg-input",o).val(d.p.page);
a("#sp_1",o).html(a.fmatter?a.fmatter.util.NumberFormat(d.p.lastpage,m):d.p.lastpage)}if(d.p.viewrecords)if(d.p.reccount===0)a(".ui-paging-info",o).html(d.p.emptyrecords);else{j=e+1;l=d.p.records;if(a.fmatter){j=a.fmatter.util.NumberFormat(j,m);k=a.fmatter.util.NumberFormat(k,m);l=a.fmatter.util.NumberFormat(l,m)}a(".ui-paging-info",o).html(a.jgrid.format(d.p.recordtext,j,k,l))}if(d.p.pgbuttons===true){f<=0&&(f=g=0);if(f==1||f===0){a("#first, #prev",d.p.pager).addClass("ui-state-disabled").removeClass("ui-state-hover");
d.p.toppager&&a("#first_t, #prev_t",d.p.toppager).addClass("ui-state-disabled").removeClass("ui-state-hover")}else{a("#first, #prev",d.p.pager).removeClass("ui-state-disabled");d.p.toppager&&a("#first_t, #prev_t",d.p.toppager).removeClass("ui-state-disabled")}if(f==g||f===0){a("#next, #last",d.p.pager).addClass("ui-state-disabled").removeClass("ui-state-hover");d.p.toppager&&a("#next_t, #last_t",d.p.toppager).addClass("ui-state-disabled").removeClass("ui-state-hover")}else{a("#next, #last",d.p.pager).removeClass("ui-state-disabled");
d.p.toppager&&a("#next_t, #last_t",d.p.toppager).removeClass("ui-state-disabled")}}}b===true&&d.p.rownumbers===true&&a("td.jqgrid-rownum",d.rows).each(function(b){a(this).html(e+1+b)});c&&d.p.jqgdnd&&a(d).jqGrid("gridDnD","updateDnD");a.isFunction(d.p.gridComplete)&&d.p.gridComplete.call(d)};d.refreshIndex=I;d.formatter=function(a,b,c,d,f){return x(a,b,c,d,f)};a.extend(c,{populate:T,emptyRows:J});this.grid=c;d.addXmlData=function(a){N(a,d.grid.bDiv)};d.addJSONData=function(a){D(a,d.grid.bDiv)};this.grid.cols=
this.rows[0].cells;T();d.p.hiddengrid=!1;a(window).unload(function(){d=null})}}}})};a.jgrid.extend({getGridParam:function(a){var c=this[0];if(c&&c.grid)return a?"undefined"!=typeof c.p[a]?c.p[a]:null:c.p},setGridParam:function(g){return this.each(function(){this.grid&&"object"===typeof g&&a.extend(!0,this.p,g)})},getDataIDs:function(){var g=[],c=0,b,e=0;this.each(function(){if((b=this.rows.length)&&0<b)for(;c<b;)a(this.rows[c]).hasClass("jqgrow")&&(g[e]=this.rows[c].id,e++),c++});return g},setSelection:function(g,
c){return this.each(function(){var b,e,l;if(void 0!==g&&(c=!1===c?!1:!0,(e=this.rows.namedItem(g+""))&&!(-1<e.className.indexOf("ui-state-disabled")))){if(!0===this.p.scrollrows&&(b=this.rows.namedItem(g).rowIndex,0<=b)){l=a(this.grid.bDiv)[0].clientHeight;var f=a(this.grid.bDiv)[0].scrollTop,k=this.rows[b].offsetTop;b=this.rows[b].clientHeight;k+b>=l+f?a(this.grid.bDiv)[0].scrollTop=k-(l+f)+b+f:k<l+f&&k<f&&(a(this.grid.bDiv)[0].scrollTop=k)}this.p.multiselect?(this.p.selrow=e.id,l=a.inArray(this.p.selrow,
this.p.selarrrow),-1===l?("ui-subgrid"!==e.className&&a(e).addClass("ui-state-highlight").attr("aria-selected","true"),b=!0,a("#jqg_"+a.jgrid.jqID(this.p.id)+"_"+a.jgrid.jqID(this.p.selrow)).attr("checked",b),this.p.selarrrow.push(this.p.selrow)):("ui-subgrid"!==e.className&&a(e).removeClass("ui-state-highlight").attr("aria-selected","false"),b=!1,a("#jqg_"+a.jgrid.jqID(this.p.id)+"_"+a.jgrid.jqID(this.p.selrow)).attr("checked",b),this.p.selarrrow.splice(l,1),l=this.p.selarrrow[0],this.p.selrow=void 0===
l?null:l),this.p.onSelectRow&&c&&this.p.onSelectRow.call(this,e.id,b)):"ui-subgrid"!==e.className&&(this.p.selrow!=e.id?(a(this.rows.namedItem(this.p.selrow)).removeClass("ui-state-highlight").attr({"aria-selected":"false",tabindex:"-1"}),a(e).addClass("ui-state-highlight").attr({"aria-selected":!0,tabindex:"0"}),b=!0):b=!1,this.p.selrow=e.id,this.p.onSelectRow&&c&&this.p.onSelectRow.call(this,e.id,b))}})},resetSelection:function(g){return this.each(function(){var c=this,b,e;"undefined"!==typeof g?
(e=g===c.p.selrow?c.p.selrow:g,a("#"+a.jgrid.jqID(c.p.id)+" tbody:first tr#"+a.jgrid.jqID(e)).removeClass("ui-state-highlight").attr("aria-selected","false"),c.p.multiselect&&(a("#jqg_"+a.jgrid.jqID(c.p.id)+"_"+a.jgrid.jqID(e)).attr("checked",!1),a("#cb_"+a.jgrid.jqID(c.p.id)).attr("checked",!1)),e=null):c.p.multiselect?(a(c.p.selarrrow).each(function(g,f){b=c.rows.namedItem(f);a(b).removeClass("ui-state-highlight").attr("aria-selected","false");a("#jqg_"+a.jgrid.jqID(c.p.id)+"_"+a.jgrid.jqID(f)).attr("checked",
!1)}),a("#cb_"+a.jgrid.jqID(c.p.id)).attr("checked",!1),c.p.selarrrow=[]):c.p.selrow&&(a("#"+a.jgrid.jqID(c.p.id)+" tbody:first tr#"+a.jgrid.jqID(c.p.selrow)).removeClass("ui-state-highlight").attr("aria-selected","false"),c.p.selrow=null);c.p.savedRow=[]})},getRowData:function(g){var c={},b,e=!1,l,f=0;this.each(function(){var k=this,d,m;if("undefined"==typeof g)e=!0,b=[],l=k.rows.length;else{m=k.rows.namedItem(g);if(!m)return c;l=2}for(;f<l;)e&&(m=k.rows[f]),a(m).hasClass("jqgrow")&&(a("td",m).each(function(b){d=
k.p.colModel[b].name;if("cb"!==d&&"subgrid"!==d&&"rn"!==d)if(!0===k.p.treeGrid&&d==k.p.ExpandColumn)c[d]=a.jgrid.htmlDecode(a("span:first",this).html());else try{c[d]=a.unformat(this,{rowId:m.id,colModel:k.p.colModel[b]},b)}catch(f){c[d]=a.jgrid.htmlDecode(a(this).html())}}),e&&(b.push(c),c={})),f++});return b?b:c},delRowData:function(g){var c=!1,b,e;this.each(function(){if(b=this.rows.namedItem(g)){if(a(b).remove(),this.p.records--,this.p.reccount--,this.updatepager(!0,!1),c=!0,this.p.multiselect&&
(e=a.inArray(g,this.p.selarrrow),-1!=e&&this.p.selarrrow.splice(e,1)),g==this.p.selrow)this.p.selrow=null}else return!1;if("local"==this.p.datatype){var l=this.p._index[g];"undefined"!=typeof l&&(this.p.data.splice(l,1),this.refreshIndex())}if(!0===this.p.altRows&&c){var f=this.p.altclass;a(this.rows).each(function(b){1==b%2?a(this).addClass(f):a(this).removeClass(f)})}});return c},setRowData:function(g,c,b){var e,l=!0,f;this.each(function(){if(!this.grid)return!1;var k=this,d,m,o=typeof b,r={};m=
k.rows.namedItem(g);if(!m)return!1;if(c)try{if(a(this.p.colModel).each(function(b){e=this.name;void 0!==c[e]&&(r[e]=this.formatter&&"string"===typeof this.formatter&&"date"==this.formatter?a.unformat.date(c[e],this):c[e],d=k.formatter(g,c[e],b,c,"edit"),f=this.title?{title:a.jgrid.stripHtml(d)}:{},!0===k.p.treeGrid&&e==k.p.ExpandColumn?a("td:eq("+b+") > span:first",m).html(d).attr(f):a("td:eq("+b+")",m).html(d).attr(f))}),"local"==k.p.datatype){var p=k.p._index[g];if(k.p.treeGrid)for(var u in k.p.treeReader)r.hasOwnProperty(k.p.treeReader[u])&&
delete r[k.p.treeReader[u]];"undefined"!=typeof p&&(k.p.data[p]=a.extend(!0,k.p.data[p],r));r=null}}catch(t){l=!1}l&&("string"===o?a(m).addClass(b):"object"===o&&a(m).css(b))});return l},addRowData:function(g,c,b,e){b||(b="last");var l=!1,f,k,d,m,o,r,p,u,t="",y,z,x,v,A;c&&(a.isArray(c)?(y=!0,b="last",z=g):(c=[c],y=!1),this.each(function(){var B=c.length;o=this.p.rownumbers===true?1:0;d=this.p.multiselect===true?1:0;m=this.p.subGrid===true?1:0;if(!y)if(typeof g!="undefined")g=g+"";else{g=a.jgrid.randId();
if(this.p.keyIndex!==false){z=this.p.colModel[this.p.keyIndex+d+m+o].name;typeof c[0][z]!="undefined"&&(g=c[0][z])}}x=this.p.altclass;for(var E=0,F="",J={},I=a.isFunction(this.p.afterInsertRow)?true:false;E<B;){v=c[E];k="";if(y){try{g=v[z]}catch(N){g=a.jgrid.randId()}F=this.p.altRows===true?(this.rows.length-1)%2===0?x:"":""}if(o){t=this.formatCol(0,1,"",null,g,true);k=k+('<td role="gridcell" aria-describedby="'+this.p.id+'_rn" class="ui-state-default jqgrid-rownum" '+t+">0</td>")}if(d){u='<input role="checkbox" type="checkbox" id="jqg_'+
this.p.id+"_"+g+'" class="cbox"/>';t=this.formatCol(o,1,"",null,g,true);k=k+('<td role="gridcell" aria-describedby="'+this.p.id+'_cb" '+t+">"+u+"</td>")}m&&(k=k+a(this).jqGrid("addSubGridCell",d+o,1));for(p=d+m+o;p<this.p.colModel.length;p++){A=this.p.colModel[p];f=A.name;J[f]=A.formatter&&typeof A.formatter==="string"&&A.formatter=="date"?a.unformat.date(v[f],A):v[f];u=this.formatter(g,a.jgrid.getAccessor(v,f),p,v,"edit");t=this.formatCol(p,1,u,g,v,true);k=k+('<td role="gridcell" aria-describedby="'+
this.p.id+"_"+f+'" '+t+">"+u+"</td>")}k='<tr id="'+g+'" role="row" tabindex="-1" class="ui-widget-content jqgrow ui-row-'+this.p.direction+" "+F+'">'+k+"</tr>";if(this.p.subGrid===true){k=a(k)[0];a(this).jqGrid("addSubGrid",k,d+o)}if(this.rows.length===0)a("table:first",this.grid.bDiv).append(k);else switch(b){case "last":a(this.rows[this.rows.length-1]).after(k);break;case "first":a(this.rows[0]).after(k);break;case "after":if(r=this.rows.namedItem(e))a(this.rows[r.rowIndex+1]).hasClass("ui-subgrid")?
a(this.rows[r.rowIndex+1]).after(k):a(r).after(k);break;case "before":if(r=this.rows.namedItem(e)){a(r).before(k);r=r.rowIndex}}this.p.records++;this.p.reccount++;I&&this.p.afterInsertRow.call(this,g,v,v);E++;if(this.p.datatype=="local"){J[this.p.localReader.id]=g;this.p._index[g]=this.p.data.length;this.p.data.push(J);J={}}}this.p.altRows===true&&!y&&(b=="last"?(this.rows.length-1)%2==1&&a(this.rows[this.rows.length-1]).addClass(x):a(this.rows).each(function(b){b%2==1?a(this).addClass(x):a(this).removeClass(x)}));
this.updatepager(true,true);l=true}));return l},footerData:function(g,c,b){function e(a){for(var b in a)if(a.hasOwnProperty(b))return!1;return!0}var l,f=!1,k={},d;"undefined"==typeof g&&(g="get");"boolean"!=typeof b&&(b=!0);g=g.toLowerCase();this.each(function(){var m=this,o;if(!m.grid||!m.p.footerrow||"set"==g&&e(c))return!1;f=!0;a(this.p.colModel).each(function(e){l=this.name;"set"==g?void 0!==c[l]&&(o=b?m.formatter("",c[l],e,c,"edit"):c[l],d=this.title?{title:a.jgrid.stripHtml(o)}:{},a("tr.footrow td:eq("+
e+")",m.grid.sDiv).html(o).attr(d),f=!0):"get"==g&&(k[l]=a("tr.footrow td:eq("+e+")",m.grid.sDiv).html())})});return"get"==g?k:f},showHideCol:function(g,c){return this.each(function(){var b=this,e=!1,l=a.browser.webkit||a.browser.safari?0:b.p.cellLayout,f;if(b.grid){"string"===typeof g&&(g=[g]);c="none"!=c?"":"none";var k=""===c?!0:!1;a(this.p.colModel).each(function(d){-1!==a.inArray(this.name,g)&&this.hidden===k&&(a("tr",b.grid.hDiv).each(function(){a(this).children("th:eq("+d+")").css("display",
c)}),a(b.rows).each(function(){a(this).children("td:eq("+d+")").css("display",c)}),b.p.footerrow&&a(b.grid.sDiv).children("td:eq("+d+")").css("display",c),f=this.widthOrg?this.widthOrg:parseInt(this.width,10),b.p.tblwidth="none"===c?b.p.tblwidth-(f+l):b.p.tblwidth+(f+l),this.hidden=!k,e=!0)});!0===e&&b.grid.width!==b.p.tblwidth&&a(b).jqGrid("setGridWidth",!0===b.p.shrinkToFit?b.grid.width:b.p.tblwidth,!0)}})},hideCol:function(g){return this.each(function(){a(this).jqGrid("showHideCol",g,"none")})},
showCol:function(g){return this.each(function(){a(this).jqGrid("showHideCol",g,"")})},remapColumns:function(g,c,b){function e(b){var c;c=b.length?a.makeArray(b):a.extend({},b);a.each(g,function(a){b[a]=c[this]})}function l(b,c){a(">tr"+(c||""),b).each(function(){var b=this,c=a.makeArray(b.cells);a.each(g,function(){var a=c[this];a&&b.appendChild(a)})})}var f=this.get(0);e(f.p.colModel);e(f.p.colNames);e(f.grid.headers);l(a("thead:first",f.grid.hDiv),b&&":not(.ui-jqgrid-labels)");c&&l(a("#"+a.jgrid.jqID(f.p.id)+
" tbody:first"),".jqgfirstrow, tr.jqgrow, tr.jqfoot");f.p.footerrow&&l(a("tbody:first",f.grid.sDiv));f.p.remapColumns&&(f.p.remapColumns.length?e(f.p.remapColumns):f.p.remapColumns=a.makeArray(g));f.p.lastsort=a.inArray(f.p.lastsort,g);f.p.treeGrid&&(f.p.expColInd=a.inArray(f.p.expColInd,g))},setGridWidth:function(g,c){return this.each(function(){if(this.grid){var b=this,e,l=0,f=a.browser.webkit||a.browser.safari?0:b.p.cellLayout,k,d=0,m=!1,o=b.p.scrollOffset,r,p=0,u=0,t;"boolean"!=typeof c&&(c=b.p.shrinkToFit);
if(!isNaN(g)&&(g=parseInt(g,10),b.grid.width=b.p.width=g,a("#gbox_"+a.jgrid.jqID(b.p.id)).css("width",g+"px"),a("#gview_"+a.jgrid.jqID(b.p.id)).css("width",g+"px"),a(b.grid.bDiv).css("width",g+"px"),a(b.grid.hDiv).css("width",g+"px"),b.p.pager&&a(b.p.pager).css("width",g+"px"),b.p.toppager&&a(b.p.toppager).css("width",g+"px"),!0===b.p.toolbar[0]&&(a(b.grid.uDiv).css("width",g+"px"),"both"==b.p.toolbar[1]&&a(b.grid.ubDiv).css("width",g+"px")),b.p.footerrow&&a(b.grid.sDiv).css("width",g+"px"),!1===
c&&!0===b.p.forceFit&&(b.p.forceFit=!1),!0===c))if(a.each(b.p.colModel,function(){if(this.hidden===false){e=this.widthOrg?this.widthOrg:parseInt(this.width,10);l=l+(e+f);this.fixed?p=p+(e+f):d++;u++}}),0!==d){b.p.tblwidth=l;r=g-f*d-p;if(!isNaN(b.p.height)&&(a(b.grid.bDiv)[0].clientHeight<a(b.grid.bDiv)[0].scrollHeight||1===b.rows.length))m=!0,r-=o;var l=0,y=0<b.grid.cols.length;a.each(b.p.colModel,function(a){if(this.hidden===false&&!this.fixed){e=this.widthOrg?this.widthOrg:parseInt(this.width,10);
e=Math.round(r*e/(b.p.tblwidth-f*d-p));if(!(e<0)){this.width=e;l=l+e;b.grid.headers[a].width=e;b.grid.headers[a].el.style.width=e+"px";if(b.p.footerrow)b.grid.footers[a].style.width=e+"px";if(y)b.grid.cols[a].style.width=e+"px";k=a}}});t=0;m?g-p-(l+f*d)!==o&&(t=g-p-(l+f*d)-o):1!==Math.abs(g-p-(l+f*d))&&(t=g-p-(l+f*d));b.p.colModel[k].width+=t;b.p.tblwidth=l+t+f*d+p;b.p.tblwidth>g?(m=b.p.tblwidth-parseInt(g,10),b.p.tblwidth=g,e=b.p.colModel[k].width-=m):e=b.p.colModel[k].width;b.grid.headers[k].width=
e;b.grid.headers[k].el.style.width=e+"px";y&&(b.grid.cols[k].style.width=e+"px");a("table:first",b.grid.bDiv).css("width",b.p.tblwidth+"px");a("table:first",b.grid.hDiv).css("width",b.p.tblwidth+"px");b.grid.hDiv.scrollLeft=b.grid.bDiv.scrollLeft;b.p.footerrow&&(b.grid.footers[k].style.width=e+"px",a("table:first",b.grid.sDiv).css("width",b.p.tblwidth+"px"))}}})},setGridHeight:function(g){return this.each(function(){this.grid&&(a(this.grid.bDiv).css({height:g+(isNaN(g)?"":"px")}),this.p.height=g,
this.p.scroll&&this.grid.populateVisible())})},setCaption:function(g){return this.each(function(){this.p.caption=g;a("span.ui-jqgrid-title",this.grid.cDiv).html(g);a(this.grid.cDiv).show()})},setLabel:function(g,c,b,e){return this.each(function(){var l=-1;if(this.grid&&(isNaN(g)?a(this.p.colModel).each(function(a){if(this.name==g)return l=a,!1}):l=parseInt(g,10),0<=l)){var f=a("tr.ui-jqgrid-labels th:eq("+l+")",this.grid.hDiv);if(c){var k=a(".s-ico",f);a("[id^=jqgh_]",f).empty().html(c).append(k);
this.p.colNames[l]=c}b&&("string"===typeof b?a(f).addClass(b):a(f).css(b));"object"===typeof e&&a(f).attr(e)}})},setCell:function(g,c,b,e,l,f){return this.each(function(){var k=-1,d,m;if(this.grid&&(isNaN(c)?a(this.p.colModel).each(function(a){if(this.name==c)return k=a,!1}):k=parseInt(c,10),0<=k&&(d=this.rows.namedItem(g)))){var o=a("td:eq("+k+")",d);if(""!==b||!0===f)d=this.formatter(g,b,k,d,"edit"),m=this.p.colModel[k].title?{title:a.jgrid.stripHtml(d)}:{},this.p.treeGrid&&0<a(".tree-wrap",a(o)).length?
a("span",a(o)).html(d).attr(m):a(o).html(d).attr(m),"local"==this.p.datatype&&(d=this.p.colModel[k],b=d.formatter&&"string"===typeof d.formatter&&"date"==d.formatter?a.unformat.date(b,d):b,m=this.p._index[g],"undefined"!=typeof m&&(this.p.data[m][d.name]=b));"string"===typeof e?a(o).addClass(e):e&&a(o).css(e);"object"===typeof l&&a(o).attr(l)}})},getCell:function(g,c){var b=!1;this.each(function(){var e=-1;if(this.grid&&(isNaN(c)?a(this.p.colModel).each(function(a){if(this.name===c)return e=a,!1}):
e=parseInt(c,10),0<=e)){var l=this.rows.namedItem(g);if(l)try{b=a.unformat(a("td:eq("+e+")",l),{rowId:l.id,colModel:this.p.colModel[e]},e)}catch(f){b=a.jgrid.htmlDecode(a("td:eq("+e+")",l).html())}}});return b},getCol:function(g,c,b){var e=[],l,f=0,k=0,d=0,m,c="boolean"!=typeof c?!1:c;"undefined"==typeof b&&(b=!1);this.each(function(){var o=-1;if(this.grid&&(isNaN(g)?a(this.p.colModel).each(function(a){if(this.name===g)return o=a,!1}):o=parseInt(g,10),0<=o)){var r=this.rows.length,p=0;if(r&&0<r){for(;p<
r;){if(a(this.rows[p]).hasClass("jqgrow")){try{l=a.unformat(a(this.rows[p].cells[o]),{rowId:this.rows[p].id,colModel:this.p.colModel[o]},o)}catch(u){l=a.jgrid.htmlDecode(this.rows[p].cells[o].innerHTML)}b?(m=parseFloat(l),f+=m,k=Math.min(k,m),d=Math.max(k,m)):c?e.push({id:this.rows[p].id,value:l}):e.push(l)}p++}if(b)switch(b.toLowerCase()){case "sum":e=f;break;case "avg":e=f/r;break;case "count":e=r;break;case "min":e=k;break;case "max":e=d}}}});return e},clearGridData:function(g){return this.each(function(){if(this.grid){"boolean"!=
typeof g&&(g=!1);if(this.p.deepempty)a("#"+a.jgrid.jqID(this.p.id)+" tbody:first tr:gt(0)").remove();else{var c=a("#"+a.jgrid.jqID(this.p.id)+" tbody:first tr:first")[0];a("#"+a.jgrid.jqID(this.p.id)+" tbody:first").empty().append(c)}this.p.footerrow&&g&&a(".ui-jqgrid-ftable td",this.grid.sDiv).html("&#160;");this.p.selrow=null;this.p.selarrrow=[];this.p.savedRow=[];this.p.records=0;this.p.page=1;this.p.lastpage=0;this.p.reccount=0;this.p.data=[];this.p_index={};this.updatepager(!0,!1)}})},getInd:function(a,
c){var b=!1,e;this.each(function(){if(e=this.rows.namedItem(a))b=!0===c?e:e.rowIndex});return b},bindKeys:function(g){var c=a.extend({onEnter:null,onSpace:null,onLeftKey:null,onRightKey:null,scrollingRows:!0},g||{});return this.each(function(){var b=this;a("body").is("[role]")||a("body").attr("role","application");b.p.scrollrows=c.scrollingRows;a(b).keydown(function(g){var e=a(b).find("tr[tabindex=0]")[0],f,k,d,m=b.p.treeReader.expanded_field;if(e){d=b.p._index[e.id];if(37===g.keyCode||38===g.keyCode||
39===g.keyCode||40===g.keyCode){if(38===g.keyCode){k=e.previousSibling;f="";if(k)if(a(k).is(":hidden"))for(;k;){if(k=k.previousSibling,!a(k).is(":hidden")&&a(k).hasClass("jqgrow")){f=k.id;break}}else f=k.id;a(b).jqGrid("setSelection",f)}if(40===g.keyCode){k=e.nextSibling;f="";if(k)if(a(k).is(":hidden"))for(;k;){if(k=k.nextSibling,!a(k).is(":hidden")&&a(k).hasClass("jqgrow")){f=k.id;break}}else f=k.id;a(b).jqGrid("setSelection",f)}37===g.keyCode&&(b.p.treeGrid&&b.p.data[d][m]&&a(e).find("div.treeclick").trigger("click"),
a.isFunction(c.onLeftKey)&&c.onLeftKey.call(b,b.p.selrow));39===g.keyCode&&(b.p.treeGrid&&!b.p.data[d][m]&&a(e).find("div.treeclick").trigger("click"),a.isFunction(c.onRightKey)&&c.onRightKey.call(b,b.p.selrow));return!1}if(13===g.keyCode)return a.isFunction(c.onEnter)&&c.onEnter.call(b,b.p.selrow),!1;if(32===g.keyCode)return a.isFunction(c.onSpace)&&c.onSpace.call(b,b.p.selrow),!1}})})},unbindKeys:function(){return this.each(function(){a(this).unbind("keydown")})},getLocalRow:function(a){var c=!1,
b;this.each(function(){"undefined"!==typeof a&&(b=this.p._index[a],0<=b&&(c=this.p.data[b]))});return c}})})(m);(function(a){a.fmatter={};a.extend(a.fmatter,{isBoolean:function(a){return"boolean"===typeof a},isObject:function(g){return g&&("object"===typeof g||a.isFunction(g))||!1},isString:function(a){return"string"===typeof a},isNumber:function(a){return"number"===typeof a&&isFinite(a)},isNull:function(a){return null===a},isUndefined:function(a){return"undefined"===typeof a},isValue:function(a){return this.isObject(a)||
this.isString(a)||this.isNumber(a)||this.isBoolean(a)},isEmpty:function(g){if(!this.isString(g)&&this.isValue(g))return!1;if(!this.isValue(g))return!0;g=a.trim(g).replace(/\&nbsp\;/ig,"").replace(/\&#160\;/ig,"");return""===g}});a.fn.fmatter=function(g,c,b,e,l){var f=c,b=a.extend({},a.jgrid.formatter,b);a.fn.fmatter[g]&&(f=a.fn.fmatter[g](c,b,e,l));return f};a.fmatter.util={NumberFormat:function(g,c){a.fmatter.isNumber(g)||(g*=1);if(a.fmatter.isNumber(g)){var b=0>g,e=g+"",l=c.decimalSeparator?c.decimalSeparator:
".",f;if(a.fmatter.isNumber(c.decimalPlaces)){var k=c.decimalPlaces,e=Math.pow(10,k),e=Math.round(g*e)/e+"";f=e.lastIndexOf(".");if(0<k){0>f?(e+=l,f=e.length-1):"."!==l&&(e=e.replace(".",l));for(;e.length-1-f<k;)e+="0"}}if(c.thousandsSeparator){k=c.thousandsSeparator;f=e.lastIndexOf(l);f=-1<f?f:e.length;for(var l=e.substring(f),d=-1,m=f;0<m;m--){d++;if(0===d%3&&m!==f&&(!b||1<m))l=k+l;l=e.charAt(m-1)+l}e=l}e=c.prefix?c.prefix+e:e;return c.suffix?e+c.suffix:e}return g},DateFormat:function(g,c,b,e){var l=
/^\/Date\((([-+])?[0-9]+)(([-+])([0-9]{2})([0-9]{2}))?\)\/$/,f="string"===typeof c?c.match(l):null,l=function(a,b){a=""+a;for(b=parseInt(b,10)||2;a.length<b;)a="0"+a;return a},k={m:1,d:1,y:1970,h:0,i:0,s:0,u:0},d=0,m,o=["i18n"];o.i18n={dayNames:e.dayNames,monthNames:e.monthNames};g in e.masks&&(g=e.masks[g]);if(c.constructor===Number)"u"==(""+g).toLowerCase()&&(c*=1E3),d=new Date(c);else if(c.constructor===Date)d=c;else if(null!==f)d=new Date(parseInt(f[1],10)),f[3]&&(g=60*Number(f[5])+Number(f[6]),
g*="-"==f[4]?1:-1,g-=d.getTimezoneOffset(),d.setTime(Number(Number(d)+6E4*g)));else{c=(""+c).split(/[\\\/:_;.,\t\T\s-]/);g=g.split(/[\\\/:_;.,\t\T\s-]/);f=0;for(m=g.length;f<m;f++)"M"==g[f]&&(d=a.inArray(c[f],o.i18n.monthNames),-1!==d&&12>d&&(c[f]=d+1)),"F"==g[f]&&(d=a.inArray(c[f],o.i18n.monthNames),-1!==d&&11<d&&(c[f]=d+1-12)),c[f]&&(k[g[f].toLowerCase()]=parseInt(c[f],10));k.f&&(k.m=k.f);if(0===k.m&&0===k.y&&0===k.d)return"&#160;";k.m=parseInt(k.m,10)-1;d=k.y;70<=d&&99>=d?k.y=1900+k.y:0<=d&&69>=
d&&(k.y=2E3+k.y);d=new Date(k.y,k.m,k.d,k.h,k.i,k.s,k.u)}b in e.masks?b=e.masks[b]:b||(b="Y-m-d");g=d.getHours();c=d.getMinutes();k=d.getDate();f=d.getMonth()+1;m=d.getTimezoneOffset();var r=d.getSeconds(),p=d.getMilliseconds(),u=d.getDay(),t=d.getFullYear(),y=(u+6)%7+1,z=(new Date(t,f-1,k)-new Date(t,0,1))/864E5,x={d:l(k),D:o.i18n.dayNames[u],j:k,l:o.i18n.dayNames[u+7],N:y,S:e.S(k),w:u,z:z,W:5>y?Math.floor((z+y-1)/7)+1:Math.floor((z+y-1)/7)||(4>((new Date(t-1,0,1)).getDay()+6)%7?53:52),F:o.i18n.monthNames[f-
1+12],m:l(f),M:o.i18n.monthNames[f-1],n:f,t:"?",L:"?",o:"?",Y:t,y:(""+t).substring(2),a:12>g?e.AmPm[0]:e.AmPm[1],A:12>g?e.AmPm[2]:e.AmPm[3],B:"?",g:g%12||12,G:g,h:l(g%12||12),H:l(g),i:l(c),s:l(r),u:p,e:"?",I:"?",O:(0<m?"-":"+")+l(100*Math.floor(Math.abs(m)/60)+Math.abs(m)%60,4),P:"?",T:((""+d).match(/\b(?:[PMCEA][SDP]T|(?:Pacific|Mountain|Central|Eastern|Atlantic) (?:Standard|Daylight|Prevailing) Time|(?:GMT|UTC)(?:[-+]\d{4})?)\b/g)||[""]).pop().replace(/[^-+\dA-Z]/g,""),Z:"?",c:"?",r:"?",U:Math.floor(d/
1E3)};return b.replace(/\\.|[dDjlNSwzWFmMntLoYyaABgGhHisueIOPTZcrU]/g,function(a){return a in x?x[a]:a.substring(1)})}};a.fn.fmatter.defaultFormat=function(g,c){return a.fmatter.isValue(g)&&""!==g?g:c.defaultValue?c.defaultValue:"&#160;"};a.fn.fmatter.email=function(g,c){return a.fmatter.isEmpty(g)?a.fn.fmatter.defaultFormat(g,c):'<a href="mailto:'+g+'">'+g+"</a>"};a.fn.fmatter.checkbox=function(g,c){var b=a.extend({},c.checkbox),e;a.fmatter.isUndefined(c.colModel.formatoptions)||(b=a.extend({},b,
c.colModel.formatoptions));e=!0===b.disabled?'disabled="disabled"':"";if(a.fmatter.isEmpty(g)||a.fmatter.isUndefined(g))g=a.fn.fmatter.defaultFormat(g,b);g=(g+"").toLowerCase();return'<input type="checkbox" '+(0>g.search(/(false|0|no|off)/i)?" checked='checked' ":"")+' value="'+g+'" offval="no" '+e+"/>"};a.fn.fmatter.link=function(g,c){var b={target:c.target},e="";a.fmatter.isUndefined(c.colModel.formatoptions)||(b=a.extend({},b,c.colModel.formatoptions));b.target&&(e="target="+b.target);return a.fmatter.isEmpty(g)?
a.fn.fmatter.defaultFormat(g,c):"<a "+e+' href="'+g+'">'+g+"</a>"};a.fn.fmatter.showlink=function(g,c){var b={baseLinkUrl:c.baseLinkUrl,showAction:c.showAction,addParam:c.addParam||"",target:c.target,idName:c.idName},e="";a.fmatter.isUndefined(c.colModel.formatoptions)||(b=a.extend({},b,c.colModel.formatoptions));b.target&&(e="target="+b.target);b=b.baseLinkUrl+b.showAction+"?"+b.idName+"="+c.rowId+b.addParam;return a.fmatter.isString(g)||a.fmatter.isNumber(g)?"<a "+e+' href="'+b+'">'+g+"</a>":a.fn.fmatter.defaultFormat(g,
c)};a.fn.fmatter.integer=function(g,c){var b=a.extend({},c.integer);a.fmatter.isUndefined(c.colModel.formatoptions)||(b=a.extend({},b,c.colModel.formatoptions));return a.fmatter.isEmpty(g)?b.defaultValue:a.fmatter.util.NumberFormat(g,b)};a.fn.fmatter.number=function(g,c){var b=a.extend({},c.number);a.fmatter.isUndefined(c.colModel.formatoptions)||(b=a.extend({},b,c.colModel.formatoptions));return a.fmatter.isEmpty(g)?b.defaultValue:a.fmatter.util.NumberFormat(g,b)};a.fn.fmatter.currency=function(g,
c){var b=a.extend({},c.currency);a.fmatter.isUndefined(c.colModel.formatoptions)||(b=a.extend({},b,c.colModel.formatoptions));return a.fmatter.isEmpty(g)?b.defaultValue:a.fmatter.util.NumberFormat(g,b)};a.fn.fmatter.date=function(g,c,b,e){b=a.extend({},c.date);a.fmatter.isUndefined(c.colModel.formatoptions)||(b=a.extend({},b,c.colModel.formatoptions));return!b.reformatAfterEdit&&"edit"==e?a.fn.fmatter.defaultFormat(g,c):a.fmatter.isEmpty(g)?a.fn.fmatter.defaultFormat(g,c):a.fmatter.util.DateFormat(b.srcformat,
g,b.newformat,b)};a.fn.fmatter.select=function(g,c){var g=g+"",b=!1,e=[];a.fmatter.isUndefined(c.colModel.formatoptions)?a.fmatter.isUndefined(c.colModel.editoptions)||(b=c.colModel.editoptions.value):b=c.colModel.formatoptions.value;if(b){var l=!0===c.colModel.editoptions.multiple?!0:!1,f=[],k;l&&(f=g.split(","),f=a.map(f,function(b){return a.trim(b)}));if(a.fmatter.isString(b))for(var d=b.split(";"),q=0,o=0;o<d.length;o++)if(k=d[o].split(":"),2<k.length&&(k[1]=m.map(k,function(a,b){if(b>0)return a}).join(":")),
l)-1<m.inArray(k[0],f)&&(e[q]=k[1],q++);else{if(a.trim(k[0])==a.trim(g)){e[0]=k[1];break}}else a.fmatter.isObject(b)&&(l?e=m.map(f,function(a){return b[a]}):e[0]=b[g]||"")}g=e.join(", ");return""===g?a.fn.fmatter.defaultFormat(g,c):g};a.fn.fmatter.rowactions=function(g,c,b,e){var l={keys:!1,editbutton:!0,delbutton:!0,onEdit:null,onSuccess:null,afterSave:null,onError:null,afterRestore:null,extraparam:{oper:"edit"},url:null,delOptions:{}},e=a("#"+c)[0].p.colModel[e];a.fmatter.isUndefined(e.formatoptions)||
(l=a.extend(l,e.formatoptions));var e=function(b){l.afterSave&&l.afterSave(b);a("tr#"+g+" div.ui-inline-edit, tr#"+g+" div.ui-inline-del","#"+c).show();a("tr#"+g+" div.ui-inline-save, tr#"+g+" div.ui-inline-cancel","#"+c).hide()},f=function(b){l.afterRestore&&l.afterRestore(b);a("tr#"+g+" div.ui-inline-edit, tr#"+g+" div.ui-inline-del","#"+c).show();a("tr#"+g+" div.ui-inline-save, tr#"+g+" div.ui-inline-cancel","#"+c).hide()};switch(b){case "edit":a("#"+c).jqGrid("editRow",g,l.keys,l.onEdit,l.onSuccess,
l.url,l.extraparam,e,l.onError,f);a("tr#"+g+" div.ui-inline-edit, tr#"+g+" div.ui-inline-del","#"+c).hide();a("tr#"+g+" div.ui-inline-save, tr#"+g+" div.ui-inline-cancel","#"+c).show();break;case "save":a("#"+c).jqGrid("saveRow",g,l.onSuccess,l.url,l.extraparam,e,l.onError,f)&&(a("tr#"+g+" div.ui-inline-edit, tr#"+g+" div.ui-inline-del","#"+c).show(),a("tr#"+g+" div.ui-inline-save, tr#"+g+" div.ui-inline-cancel","#"+c).hide());break;case "cancel":a("#"+c).jqGrid("restoreRow",g,f);a("tr#"+g+" div.ui-inline-edit, tr#"+
g+" div.ui-inline-del","#"+c).show();a("tr#"+g+" div.ui-inline-save, tr#"+g+" div.ui-inline-cancel","#"+c).hide();break;case "del":a("#"+c).jqGrid("delGridRow",g,l.delOptions)}};a.fn.fmatter.actions=function(g,c){var b={keys:!1,editbutton:!0,delbutton:!0};a.fmatter.isUndefined(c.colModel.formatoptions)||(b=a.extend(b,c.colModel.formatoptions));var e=c.rowId,l="",f;if("undefined"==typeof e||a.fmatter.isEmpty(e))return"";b.editbutton&&(f="onclick=$.fn.fmatter.rowactions('"+e+"','"+c.gid+"','edit',"+
c.pos+");",l=l+"<div style='margin-left:8px;'><div title='"+a.jgrid.nav.edittitle+"' style='float:left;cursor:pointer;' class='ui-pg-div ui-inline-edit' "+f+"><span class='ui-icon ui-icon-pencil'></span></div>");b.delbutton&&(f="onclick=$.fn.fmatter.rowactions('"+e+"','"+c.gid+"','del',"+c.pos+");",l=l+"<div title='"+a.jgrid.nav.deltitle+"' style='float:left;margin-left:5px;' class='ui-pg-div ui-inline-del' "+f+"><span class='ui-icon ui-icon-trash'></span></div>");f="onclick=$.fn.fmatter.rowactions('"+
e+"','"+c.gid+"','save',"+c.pos+");";l=l+"<div title='"+a.jgrid.edit.bSubmit+"' style='float:left;display:none' class='ui-pg-div ui-inline-save'><span class='ui-icon ui-icon-disk' "+f+"></span></div>";f="onclick=$.fn.fmatter.rowactions('"+e+"','"+c.gid+"','cancel',"+c.pos+");";return l+"<div title='"+a.jgrid.edit.bCancel+"' style='float:left;display:none;margin-left:5px;' class='ui-pg-div ui-inline-cancel'><span class='ui-icon ui-icon-cancel' "+f+"></span></div></div>"};a.unformat=function(g,c,b,
e){var l,f=c.colModel.formatter,k=c.colModel.formatoptions||{},d=/([\.\*\_\'\(\)\{\}\+\?\\])/g,m=c.colModel.unformat||a.fn.fmatter[f]&&a.fn.fmatter[f].unformat;if("undefined"!==typeof m&&a.isFunction(m))l=m(a(g).text(),c,g);else if(!a.fmatter.isUndefined(f)&&a.fmatter.isString(f))switch(l=a.jgrid.formatter||{},f){case "integer":k=a.extend({},l.integer,k);c=k.thousandsSeparator.replace(d,"\\$1");l=a(g).text().replace(RegExp(c,"g"),"");break;case "number":k=a.extend({},l.number,k);c=k.thousandsSeparator.replace(d,
"\\$1");l=a(g).text().replace(RegExp(c,"g"),"").replace(k.decimalSeparator,".");break;case "currency":k=a.extend({},l.currency,k);c=k.thousandsSeparator.replace(d,"\\$1");l=a(g).text().replace(RegExp(c,"g"),"").replace(k.decimalSeparator,".").replace(k.prefix,"").replace(k.suffix,"");break;case "checkbox":k=c.colModel.editoptions?c.colModel.editoptions.value.split(":"):["Yes","No"];l=a("input",g).attr("checked")?k[0]:k[1];break;case "select":l=a.unformat.select(g,c,b,e);break;case "actions":return"";
default:l=a(g).text()}return l?l:!0===e?a(g).text():a.jgrid.htmlDecode(a(g).html())};a.unformat.select=function(g,c,b,e){b=[];g=a(g).text();if(!0===e)return g;c=a.extend({},c.colModel.editoptions);if(c.value){var l=c.value,c=!0===c.multiple?!0:!1,e=[],f;c&&(e=g.split(","),e=a.map(e,function(b){return a.trim(b)}));if(a.fmatter.isString(l))for(var k=l.split(";"),d=0,q=0;q<k.length;q++)if(f=k[q].split(":"),2<f.length&&(f[1]=m.map(f,function(a,b){if(b>0)return a}).join(":")),c)-1<m.inArray(f[1],e)&&(b[d]=
f[0],d++);else{if(a.trim(f[1])==a.trim(g)){b[0]=f[0];break}}else if(a.fmatter.isObject(l)||a.isArray(l))c||(e[0]=g),b=m.map(e,function(b){var c;a.each(l,function(a,d){if(d==b){c=a;return false}});if(typeof c!="undefined")return c});return b.join(", ")}return g||""};a.unformat.date=function(g,c){var b=a.jgrid.formatter.date||{};a.fmatter.isUndefined(c.formatoptions)||(b=a.extend({},b,c.formatoptions));return a.fmatter.isEmpty(g)?a.fn.fmatter.defaultFormat(g,c):a.fmatter.util.DateFormat(b.newformat,
g,b.srcformat,b)}})(m);(function(a){a.jgrid.extend({getColProp:function(a){var c={},b=this[0];if(!b.grid)return!1;for(var b=b.p.colModel,e=0;e<b.length;e++)if(b[e].name==a){c=b[e];break}return c},setColProp:function(g,c){return this.each(function(){if(this.grid&&c)for(var b=this.p.colModel,e=0;e<b.length;e++)if(b[e].name==g){a.extend(this.p.colModel[e],c);break}})},sortGrid:function(a,c,b){return this.each(function(){var e=-1;if(this.grid){a||(a=this.p.sortname);for(var l=0;l<this.p.colModel.length;l++)if(this.p.colModel[l].index==
a||this.p.colModel[l].name==a){e=l;break}-1!=e&&(l=this.p.colModel[e].sortable,"boolean"!==typeof l&&(l=!0),"boolean"!==typeof c&&(c=!1),l&&this.sortData("jqgh_"+a,e,c,b))}})},GridDestroy:function(){return this.each(function(){if(this.grid){this.p.pager&&a(this.p.pager).remove();var g=this.id;try{a("#gbox_"+g).remove()}catch(c){}}})},GridUnload:function(){return this.each(function(){if(this.grid){var g={id:a(this).attr("id"),cl:a(this).attr("class")};this.p.pager&&a(this.p.pager).empty().removeClass("ui-state-default ui-jqgrid-pager corner-bottom");
var c=document.createElement("table");a(c).attr({id:g.id});c.className=g.cl;g=this.id;a(c).removeClass("ui-jqgrid-btable");1===a(this.p.pager).parents("#gbox_"+g).length?(a(c).insertBefore("#gbox_"+g).show(),a(this.p.pager).insertBefore("#gbox_"+g)):a(c).insertBefore("#gbox_"+g).show();a("#gbox_"+g).remove()}})},setGridState:function(g){return this.each(function(){this.grid&&("hidden"==g?(a(".ui-jqgrid-bdiv, .ui-jqgrid-hdiv","#gview_"+this.p.id).slideUp("fast"),this.p.pager&&a(this.p.pager).slideUp("fast"),
this.p.toppager&&a(this.p.toppager).slideUp("fast"),!0===this.p.toolbar[0]&&("both"==this.p.toolbar[1]&&a(this.grid.ubDiv).slideUp("fast"),a(this.grid.uDiv).slideUp("fast")),this.p.footerrow&&a(".ui-jqgrid-sdiv","#gbox_"+this.p.id).slideUp("fast"),a(".ui-jqgrid-titlebar-close span",this.grid.cDiv).removeClass("ui-icon-circle-triangle-n").addClass("ui-icon-circle-triangle-s"),this.p.gridstate="hidden"):"visible"==g&&(a(".ui-jqgrid-hdiv, .ui-jqgrid-bdiv","#gview_"+this.p.id).slideDown("fast"),this.p.pager&&
a(this.p.pager).slideDown("fast"),this.p.toppager&&a(this.p.toppager).slideDown("fast"),!0===this.p.toolbar[0]&&("both"==this.p.toolbar[1]&&a(this.grid.ubDiv).slideDown("fast"),a(this.grid.uDiv).slideDown("fast")),this.p.footerrow&&a(".ui-jqgrid-sdiv","#gbox_"+this.p.id).slideDown("fast"),a(".ui-jqgrid-titlebar-close span",this.grid.cDiv).removeClass("ui-icon-circle-triangle-s").addClass("ui-icon-circle-triangle-n"),this.p.gridstate="visible"))})},filterToolbar:function(g){g=a.extend({autosearch:!0,
searchOnEnter:!0,beforeSearch:null,afterSearch:null,beforeClear:null,afterClear:null,searchurl:"",stringResult:!1,groupOp:"AND",defaultSearch:"bw"},g||{});return this.each(function(){function c(b,c){var f=a(b);f[0]&&m.each(c,function(){void 0!==this.data?f.bind(this.type,this.data,this.fn):f.bind(this.type,this.fn)})}var b=this;if(!this.ftoolbar){var e=function(){var c={},d=0,f,e,j={},l;a.each(b.p.colModel,function(){e=this.index||this.name;switch(this.stype){case "select":l=this.searchoptions&&this.searchoptions.sopt?
this.searchoptions.sopt[0]:"eq";if(f=a("#gs_"+a.jgrid.jqID(e),b.grid.hDiv).val())c[e]=f,j[e]=l,d++;else try{delete b.p.postData[e]}catch(m){}break;case "text":if(l=this.searchoptions&&this.searchoptions.sopt?this.searchoptions.sopt[0]:g.defaultSearch,f=a("#gs_"+a.jgrid.jqID(e),b.grid.hDiv).val())c[e]=f,j[e]=l,d++;else try{delete b.p.postData[e]}catch(t){}}});var m=0<d?!0:!1;if(!0===g.stringResult||"local"==b.p.datatype){var t='{"groupOp":"'+g.groupOp+'","rules":[',y=0;a.each(c,function(a,b){0<y&&
(t+=",");t+='{"field":"'+a+'",';t+='"op":"'+j[a]+'",';t+='"data":"'+(b+"").replace(/\\/g,"\\\\").replace(/\"/g,'\\"')+'"}';y++});t+="]}";a.extend(b.p.postData,{filters:t});a.each(["searchField","searchString","searchOper"],function(a,c){b.p.postData.hasOwnProperty(c)&&delete b.p.postData[c]})}else a.extend(b.p.postData,c);var z;b.p.searchurl&&(z=b.p.url,a(b).jqGrid("setGridParam",{url:b.p.searchurl}));var x=!1;a.isFunction(g.beforeSearch)&&(x=g.beforeSearch.call(b));x||a(b).jqGrid("setGridParam",
{search:m}).trigger("reloadGrid",[{page:1}]);z&&a(b).jqGrid("setGridParam",{url:z});a.isFunction(g.afterSearch)&&g.afterSearch()},l=a("<tr class='ui-search-toolbar' role='rowheader'></tr>"),f;a.each(b.p.colModel,function(){var k=this,d,m,o,r;m=a("<th role='columnheader' class='ui-state-default ui-th-column ui-th-"+b.p.direction+"'></th>");d=a("<div style='width:100%;position:relative;height:100%;padding-right:0.3em;'></div>");!0===this.hidden&&a(m).css("display","none");this.search=!1===this.search?
!1:!0;"undefined"==typeof this.stype&&(this.stype="text");o=a.extend({},this.searchoptions||{});if(this.search)switch(this.stype){case "select":if(r=this.surl||o.dataUrl)a.ajax(a.extend({url:r,dataType:"html",complete:function(b){o.buildSelect!==void 0?(b=o.buildSelect(b))&&a(d).append(b):a(d).append(b.responseText);o.defaultValue&&a("select",d).val(o.defaultValue);a("select",d).attr({name:k.index||k.name,id:"gs_"+k.name});o.attr&&a("select",d).attr(o.attr);a("select",d).css({width:"100%"});o.dataInit!==
void 0&&o.dataInit(a("select",d)[0]);o.dataEvents!==void 0&&c(a("select",d)[0],o.dataEvents);g.autosearch===true&&a("select",d).change(function(){e();return false});b=null}},a.jgrid.ajaxOptions,b.p.ajaxSelectOptions||{}));else{var p;k.searchoptions&&k.searchoptions.value?p=k.searchoptions.value:k.editoptions&&k.editoptions.value&&(p=k.editoptions.value);if(p){r=document.createElement("select");r.style.width="100%";a(r).attr({name:k.index||k.name,id:"gs_"+k.name});var u,t;if("string"===typeof p){p=
p.split(";");for(var y=0;y<p.length;y++)u=p[y].split(":"),t=document.createElement("option"),t.value=u[0],t.innerHTML=u[1],r.appendChild(t)}else if("object"===typeof p)for(u in p)p.hasOwnProperty(u)&&(t=document.createElement("option"),t.value=u,t.innerHTML=p[u],r.appendChild(t));o.defaultValue&&a(r).val(o.defaultValue);o.attr&&a(r).attr(o.attr);void 0!==o.dataInit&&o.dataInit(r);void 0!==o.dataEvents&&c(r,o.dataEvents);a(d).append(r);!0===g.autosearch&&a(r).change(function(){e();return false})}}break;
case "text":r=o.defaultValue?o.defaultValue:"",a(d).append("<input type='text' style='width:95%;padding:0px;' name='"+(k.index||k.name)+"' id='gs_"+k.name+"' value='"+r+"'/>"),o.attr&&a("input",d).attr(o.attr),void 0!==o.dataInit&&o.dataInit(a("input",d)[0]),void 0!==o.dataEvents&&c(a("input",d)[0],o.dataEvents),!0===g.autosearch&&(g.searchOnEnter?a("input",d).keypress(function(a){if((a.charCode?a.charCode:a.keyCode?a.keyCode:0)==13){e();return false}return this}):a("input",d).keydown(function(a){switch(a.which){case 13:return false;
case 9:case 16:case 37:case 38:case 39:case 40:case 27:break;default:f&&clearTimeout(f);f=setTimeout(function(){e()},500)}}))}a(m).append(d);a(l).append(m)});a("table thead",b.grid.hDiv).append(l);this.ftoolbar=!0;this.triggerToolbar=e;this.clearToolbar=function(c){var d={},f,e=0,j,c="boolean"!=typeof c?!0:c;a.each(b.p.colModel,function(){f=this.searchoptions&&this.searchoptions.defaultValue?this.searchoptions.defaultValue:"";j=this.index||this.name;switch(this.stype){case "select":var c;a("#gs_"+
a.jgrid.jqID(j)+" option",b.grid.hDiv).each(function(b){0===b&&(this.selected=!0);if(a(this).text()==f)return this.selected=!0,c=a(this).val(),!1});if(c)d[j]=c,e++;else try{delete b.p.postData[j]}catch(g){}break;case "text":if(a("#gs_"+a.jgrid.jqID(j),b.grid.hDiv).val(f),f)d[j]=f,e++;else try{delete b.p.postData[j]}catch(k){}}});var l=0<e?!0:!1;if(!0===g.stringResult||"local"==b.p.datatype){var m='{"groupOp":"'+g.groupOp+'","rules":[',t=0;a.each(d,function(a,b){0<t&&(m+=",");m+='{"field":"'+a+'",';
m+='"op":"eq",';m+='"data":"'+(b+"").replace(/\\/g,"\\\\").replace(/\"/g,'\\"')+'"}';t++});m+="]}";a.extend(b.p.postData,{filters:m});a.each(["searchField","searchString","searchOper"],function(a,c){b.p.postData.hasOwnProperty(c)&&delete b.p.postData[c]})}else a.extend(b.p.postData,d);var y;b.p.searchurl&&(y=b.p.url,a(b).jqGrid("setGridParam",{url:b.p.searchurl}));var z=!1;a.isFunction(g.beforeClear)&&(z=g.beforeClear.call(b));z||c&&a(b).jqGrid("setGridParam",{search:l}).trigger("reloadGrid",[{page:1}]);
y&&a(b).jqGrid("setGridParam",{url:y});a.isFunction(g.afterClear)&&g.afterClear()};this.toggleToolbar=function(){var c=a("tr.ui-search-toolbar",b.grid.hDiv);"none"==c.css("display")?c.show():c.hide()}}})}})})(m);(function(a){a.extend(a.jgrid,{showModal:function(a){a.w.show()},closeModal:function(a){a.w.hide().attr("aria-hidden","true");a.o&&a.o.remove()},hideModal:function(g,c){c=a.extend({jqm:!0,gb:""},c||{});if(c.onClose){var b=c.onClose(g);if("boolean"==typeof b&&!b)return}if(a.fn.jqm&&!0===c.jqm)a(g).attr("aria-hidden",
"true").jqmHide();else{if(""!==c.gb)try{a(".jqgrid-overlay:first",c.gb).hide()}catch(e){}a(g).hide().attr("aria-hidden","true")}},findPos:function(a){var c=0,b=0;if(a.offsetParent){do c+=a.offsetLeft,b+=a.offsetTop;while(a=a.offsetParent)}return[c,b]},createModal:function(g,c,b,e,l,f,k){var d=document.createElement("div"),m,o=this,k=a.extend({},k||{});m="rtl"==a(b.gbox).attr("dir")?!0:!1;d.className="ui-widget ui-widget-content ui-corner-all ui-jqdialog";d.id=g.themodal;var r=document.createElement("div");
r.className="ui-jqdialog-titlebar ui-widget-header ui-corner-all ui-helper-clearfix";r.id=g.modalhead;a(r).append("<span class='ui-jqdialog-title'>"+b.caption+"</span>");var p=a("<a href='javascript:void(0)' class='ui-jqdialog-titlebar-close ui-corner-all'></a>").hover(function(){p.addClass("ui-state-hover")},function(){p.removeClass("ui-state-hover")}).append("<span class='ui-icon ui-icon-closethick'></span>");a(r).append(p);m?(d.dir="rtl",a(".ui-jqdialog-title",r).css("float","right"),a(".ui-jqdialog-titlebar-close",
r).css("left","0.3em")):(d.dir="ltr",a(".ui-jqdialog-title",r).css("float","left"),a(".ui-jqdialog-titlebar-close",r).css("right","0.3em"));var u=document.createElement("div");a(u).addClass("ui-jqdialog-content ui-widget-content").attr("id",g.modalcontent);a(u).append(c);d.appendChild(u);a(d).prepend(r);!0===f?a("body").append(d):"string"==typeof f?a(f).append(d):a(d).insertBefore(e);a(d).css(k);"undefined"===typeof b.jqModal&&(b.jqModal=!0);c={};if(a.fn.jqm&&!0===b.jqModal)0===b.left&&(0===b.top&&
b.overlay)&&(k=[],k=this.findPos(l),b.left=k[0]+4,b.top=k[1]+4),c.top=b.top+"px",c.left=b.left;else if(0!==b.left||0!==b.top)c.left=b.left,c.top=b.top+"px";a("a.ui-jqdialog-titlebar-close",r).click(function(){var c=a("#"+g.themodal).data("onClose")||b.onClose,d=a("#"+g.themodal).data("gbox")||b.gbox;o.hideModal("#"+g.themodal,{gb:d,jqm:b.jqModal,onClose:c});return false});if(0===b.width||!b.width)b.width=300;if(0===b.height||!b.height)b.height=200;b.zIndex||(e=a(e).parents("*[role=dialog]").filter(":first").css("z-index"),
b.zIndex=e?parseInt(e,10)+1:950);e=0;m&&(c.left&&!f)&&(e=a(b.gbox).width()-(!isNaN(b.width)?parseInt(b.width,10):0)-8,c.left=parseInt(c.left,10)+parseInt(e,10));c.left&&(c.left+="px");a(d).css(a.extend({width:isNaN(b.width)?"auto":b.width+"px",height:isNaN(b.height)?"auto":b.height+"px",zIndex:b.zIndex,overflow:"hidden"},c)).attr({tabIndex:"-1",role:"dialog","aria-labelledby":g.modalhead,"aria-hidden":"true"});"undefined"==typeof b.drag&&(b.drag=!0);"undefined"==typeof b.resize&&(b.resize=!0);if(b.drag)if(a(r).css("cursor",
"move"),a.fn.jqDrag)a(d).jqDrag(r);else try{a(d).draggable({handle:a("#"+r.id)})}catch(t){}if(b.resize)if(a.fn.jqResize)a(d).append("<div class='jqResize ui-resizable-handle ui-resizable-se ui-icon ui-icon-gripsmall-diagonal-se ui-icon-grip-diagonal-se'></div>"),a("#"+g.themodal).jqResize(".jqResize",g.scrollelm?"#"+g.scrollelm:!1);else try{a(d).resizable({handles:"se, sw",alsoResize:g.scrollelm?"#"+g.scrollelm:!1})}catch(y){}!0===b.closeOnEscape&&a(d).keydown(function(c){if(c.which==27){c=a("#"+
g.themodal).data("onClose")||b.onClose;o.hideModal(this,{gb:b.gbox,jqm:b.jqModal,onClose:c})}})},viewModal:function(g,c){c=a.extend({toTop:!0,overlay:10,modal:!1,onShow:this.showModal,onHide:this.closeModal,gbox:"",jqm:!0,jqM:!0},c||{});if(a.fn.jqm&&!0===c.jqm)c.jqM?a(g).attr("aria-hidden","false").jqm(c).jqmShow():a(g).attr("aria-hidden","false").jqmShow();else{""!==c.gbox&&(a(".jqgrid-overlay:first",c.gbox).show(),a(g).data("gbox",c.gbox));a(g).show().attr("aria-hidden","false");try{a(":input:visible",
g)[0].focus()}catch(b){}}},info_dialog:function(g,c,b,e){var l={width:290,height:"auto",dataheight:"auto",drag:!0,resize:!1,caption:"<b>"+g+"</b>",left:250,top:170,zIndex:1E3,jqModal:!0,modal:!1,closeOnEscape:!0,align:"center",buttonalign:"center",buttons:[]};a.extend(l,e||{});var f=l.jqModal,k=this;a.fn.jqm&&!f&&(f=!1);g="";if(0<l.buttons.length)for(e=0;e<l.buttons.length;e++)"undefined"==typeof l.buttons[e].id&&(l.buttons[e].id="info_button_"+e),g+="<a href='javascript:void(0)' id='"+l.buttons[e].id+
"' class='fm-button ui-state-default ui-corner-all'>"+l.buttons[e].text+"</a>";e=isNaN(l.dataheight)?l.dataheight:l.dataheight+"px";c="<div id='info_id'>"+("<div id='infocnt' style='margin:0px;padding-bottom:1em;width:100%;overflow:auto;position:relative;height:"+e+";"+("text-align:"+l.align+";")+"'>"+c+"</div>");c+=b?"<div class='ui-widget-content ui-helper-clearfix' style='text-align:"+l.buttonalign+";padding-bottom:0.8em;padding-top:0.5em;background-image: none;border-width: 1px 0 0 0;'><a href='javascript:void(0)' id='closedialog' class='fm-button ui-state-default ui-corner-all'>"+
b+"</a>"+g+"</div>":""!==g?"<div class='ui-widget-content ui-helper-clearfix' style='text-align:"+l.buttonalign+";padding-bottom:0.8em;padding-top:0.5em;background-image: none;border-width: 1px 0 0 0;'>"+g+"</div>":"";c+="</div>";try{"false"==a("#info_dialog").attr("aria-hidden")&&this.hideModal("#info_dialog",{jqm:f}),a("#info_dialog").remove()}catch(d){}this.createModal({themodal:"info_dialog",modalhead:"info_head",modalcontent:"info_content",scrollelm:"infocnt"},c,l,"","",!0);g&&a.each(l.buttons,
function(b){a("#"+this.id,"#info_id").bind("click",function(){l.buttons[b].onClick.call(a("#info_dialog"));return!1})});a("#closedialog","#info_id").click(function(){k.hideModal("#info_dialog",{jqm:f});return!1});a(".fm-button","#info_dialog").hover(function(){a(this).addClass("ui-state-hover")},function(){a(this).removeClass("ui-state-hover")});a.isFunction(l.beforeOpen)&&l.beforeOpen();this.viewModal("#info_dialog",{onHide:function(a){a.w.hide().remove();a.o&&a.o.remove()},modal:l.modal,jqm:f});
a.isFunction(l.afterOpen)&&l.afterOpen();try{a("#info_dialog").focus()}catch(m){}},createEl:function(g,c,b,e,l){function f(b,c){a.isFunction(c.dataInit)&&c.dataInit(b);c.dataEvents&&a.each(c.dataEvents,function(){void 0!==this.data?a(b).bind(this.type,this.data,this.fn):a(b).bind(this.type,this.fn)});return c}function k(b,c){var d="dataInit dataEvents dataUrl buildSelect sopt searchhidden defaultValue attr".split(" ");a.each(c,function(c,f){-1===a.inArray(c,d)&&a(b).attr(c,f)});c.hasOwnProperty("id")||
a(b).attr("id",a.jgrid.randId())}var d="";switch(g){case "textarea":d=document.createElement("textarea");e?c.cols||a(d).css({width:"98%"}):c.cols||(c.cols=20);c.rows||(c.rows=2);if("&nbsp;"==b||"&#160;"==b||1==b.length&&160==b.charCodeAt(0))b="";d.value=b;k(d,c);c=f(d,c);a(d).attr({role:"textbox",multiline:"true"});break;case "checkbox":d=document.createElement("input");d.type="checkbox";c.value?(g=c.value.split(":"),b===g[0]&&(d.checked=!0,d.defaultChecked=!0),d.value=g[0],a(d).attr("offval",g[1])):
(g=b.toLowerCase(),0>g.search(/(false|0|no|off|undefined)/i)&&""!==g?(d.checked=!0,d.defaultChecked=!0,d.value=b):d.value="on",a(d).attr("offval","off"));k(d,c);c=f(d,c);a(d).attr("role","checkbox");break;case "select":d=document.createElement("select");d.setAttribute("role","select");e=[];!0===c.multiple?(g=!0,d.multiple="multiple",a(d).attr("aria-multiselectable","true")):g=!1;if("undefined"!=typeof c.dataUrl)a.ajax(a.extend({url:c.dataUrl,type:"GET",dataType:"html",context:{elem:d,options:c,vl:b},
success:function(b){var c=[],d=this.elem,g=this.vl,e=a.extend({},this.options),j=e.multiple===true;typeof e.buildSelect!="undefined"&&(b=e.buildSelect(b));if(b=a(b).html()){a(d).append(b);k(d,e);e=f(d,e);if(typeof e.size==="undefined")e.size=j?3:1;if(j){c=g.split(",");c=a.map(c,function(b){return a.trim(b)})}else c[0]=a.trim(g);setTimeout(function(){a("option",d).each(function(){a(this).attr("role","option");if(a.inArray(a.trim(a(this).text()),c)>-1||a.inArray(a.trim(a(this).val()),c)>-1)this.selected=
"selected"})},0)}}},l||{}));else if(c.value){var m;g?(e=b.split(","),e=a.map(e,function(b){return a.trim(b)}),"undefined"===typeof c.size&&(c.size=3)):c.size=1;"function"===typeof c.value&&(c.value=c.value());var o,r;if("string"===typeof c.value){o=c.value.split(";");for(m=0;m<o.length;m++){r=o[m].split(":");2<r.length&&(r[1]=a.map(r,function(a,b){if(b>0)return a}).join(":"));l=document.createElement("option");l.setAttribute("role","option");l.value=r[0];l.innerHTML=r[1];if(!g&&(a.trim(r[0])==a.trim(b)||
a.trim(r[1])==a.trim(b)))l.selected="selected";if(g&&(-1<a.inArray(a.trim(r[1]),e)||-1<a.inArray(a.trim(r[0]),e)))l.selected="selected";d.appendChild(l)}}else if("object"===typeof c.value)for(m in o=c.value,o)if(o.hasOwnProperty(m)){l=document.createElement("option");l.setAttribute("role","option");l.value=m;l.innerHTML=o[m];if(!g&&(a.trim(m)==a.trim(b)||a.trim(o[m])==a.trim(b)))l.selected="selected";if(g&&(-1<a.inArray(a.trim(o[m]),e)||-1<a.inArray(a.trim(m),e)))l.selected="selected";d.appendChild(l)}k(d,
c);c=f(d,c)}break;case "text":case "password":case "button":m="button"==g?"button":"textbox";d=document.createElement("input");d.type=g;d.value=b;k(d,c);c=f(d,c);"button"!=g&&(e?c.size||a(d).css({width:"98%"}):c.size||(c.size=20));a(d).attr("role",m);break;case "image":case "file":d=document.createElement("input");d.type=g;k(d,c);c=f(d,c);break;case "custom":d=document.createElement("span");try{if(a.isFunction(c.custom_element))if(o=c.custom_element.call(this,b,c))o=a(o).addClass("customelement").attr({id:c.id,
name:c.name}),a(d).empty().append(o);else throw"e2";else throw"e1";}catch(p){"e1"==p&&this.info_dialog(a.jgrid.errors.errcap,"function 'custom_element' "+a.jgrid.edit.msg.nodefined,a.jgrid.edit.bClose),"e2"==p?this.info_dialog(a.jgrid.errors.errcap,"function 'custom_element' "+a.jgrid.edit.msg.novalue,a.jgrid.edit.bClose):this.info_dialog(a.jgrid.errors.errcap,"string"===typeof p?p:p.message,a.jgrid.edit.bClose)}}return d},checkDate:function(a,c){var b={},e,a=a.toLowerCase();e=-1!=a.indexOf("/")?
"/":-1!=a.indexOf("-")?"-":-1!=a.indexOf(".")?".":"/";a=a.split(e);c=c.split(e);if(3!=c.length)return!1;e=-1;for(var l,f=-1,k=-1,d=0;d<a.length;d++)l=isNaN(c[d])?0:parseInt(c[d],10),b[a[d]]=l,l=a[d],-1!=l.indexOf("y")&&(e=d),-1!=l.indexOf("m")&&(k=d),-1!=l.indexOf("d")&&(f=d);l="y"==a[e]||"yyyy"==a[e]?4:"yy"==a[e]?2:-1;var d=function(a){for(var b=1;b<=a;b++){this[b]=31;if(4==b||6==b||9==b||11==b)this[b]=30;2==b&&(this[b]=29)}return this}(12),m;if(-1===e)return!1;m=b[a[e]].toString();2==l&&1==m.length&&
(l=1);if(m.length!=l||0===b[a[e]]&&"00"!=c[e]||-1===k)return!1;m=b[a[k]].toString();if(1>m.length||(1>b[a[k]]||12<b[a[k]])||-1===f)return!1;m=b[a[f]].toString();return 1>m.length||1>b[a[f]]||31<b[a[f]]||2==b[a[k]]&&b[a[f]]>(0===b[a[e]]%4&&(0!==b[a[e]]%100||0===b[a[e]]%400)?29:28)||b[a[f]]>d[b[a[k]]]?!1:!0},isEmpty:function(a){return a.match(/^\s+$/)||""===a?!0:!1},checkTime:function(a){var c=/^(\d{1,2}):(\d{2})([ap]m)?$/;if(!this.isEmpty(a))if(a=a.match(c)){if(a[3]){if(1>a[1]||12<a[1])return!1}else if(23<
a[1])return!1;if(59<a[2])return!1}else return!1;return!0},checkValues:function(g,c,b,e,l){var f,k;if("undefined"===typeof e)if("string"==typeof c){e=0;for(l=b.p.colModel.length;e<l;e++)if(b.p.colModel[e].name==c){f=b.p.colModel[e].editrules;c=e;try{k=b.p.colModel[e].formoptions.label}catch(d){}break}}else 0<=c&&(f=b.p.colModel[c].editrules);else f=e,k=void 0===l?"_":l;if(f){k||(k=b.p.colNames[c]);if(!0===f.required&&this.isEmpty(g))return[!1,k+": "+a.jgrid.edit.msg.required,""];e=!1===f.required?
!1:!0;if(!0===f.number&&!(!1===e&&this.isEmpty(g))&&isNaN(g))return[!1,k+": "+a.jgrid.edit.msg.number,""];if("undefined"!=typeof f.minValue&&!isNaN(f.minValue)&&parseFloat(g)<parseFloat(f.minValue))return[!1,k+": "+a.jgrid.edit.msg.minValue+" "+f.minValue,""];if("undefined"!=typeof f.maxValue&&!isNaN(f.maxValue)&&parseFloat(g)>parseFloat(f.maxValue))return[!1,k+": "+a.jgrid.edit.msg.maxValue+" "+f.maxValue,""];if(!0===f.email&&!(!1===e&&this.isEmpty(g))&&(l=/^((([a-z]|\d|[!#\$%&'\*\+\-\/=\?\^_`{\|}~]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+(\.([a-z]|\d|[!#\$%&'\*\+\-\/=\?\^_`{\|}~]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+)*)|((\x22)((((\x20|\x09)*(\x0d\x0a))?(\x20|\x09)+)?(([\x01-\x08\x0b\x0c\x0e-\x1f\x7f]|\x21|[\x23-\x5b]|[\x5d-\x7e]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(\\([\x01-\x09\x0b\x0c\x0d-\x7f]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]))))*(((\x20|\x09)*(\x0d\x0a))?(\x20|\x09)+)?(\x22)))@((([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.)+(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.?$/i,
!l.test(g)))return[!1,k+": "+a.jgrid.edit.msg.email,""];if(!0===f.integer&&!(!1===e&&this.isEmpty(g))&&(isNaN(g)||0!==g%1||-1!=g.indexOf(".")))return[!1,k+": "+a.jgrid.edit.msg.integer,""];if(!0===f.date&&!(!1===e&&this.isEmpty(g))&&(c=b.p.colModel[c].formatoptions&&b.p.colModel[c].formatoptions.newformat?b.p.colModel[c].formatoptions.newformat:b.p.colModel[c].datefmt||"Y-m-d",!this.checkDate(c,g)))return[!1,k+": "+a.jgrid.edit.msg.date+" - "+c,""];if(!0===f.time&&!(!1===e&&this.isEmpty(g))&&!this.checkTime(g))return[!1,
k+": "+a.jgrid.edit.msg.date+" - hh:mm (am/pm)",""];if(!0===f.url&&!(!1===e&&this.isEmpty(g))&&(l=/^(((https?)|(ftp)):\/\/([\-\w]+\.)+\w{2,3}(\/[%\-\w]+(\.\w{2,})?)*(([\w\-\.\?\\\/+@&#;`~=%!]*)(\.\w{2,})?)*\/?)/i,!l.test(g)))return[!1,k+": "+a.jgrid.edit.msg.url,""];if(!0===f.custom&&!(!1===e&&this.isEmpty(g)))return a.isFunction(f.custom_func)?(g=f.custom_func.call(b,g,k),a.isArray(g)?g:[!1,a.jgrid.edit.msg.customarray,""]):[!1,a.jgrid.edit.msg.customfcheck,""]}return[!0,"",""]}})})(m);(function(a){var g=
null;a.jgrid.extend({searchGrid:function(c){c=a.extend({recreateFilter:!1,drag:!0,sField:"searchField",sValue:"searchString",sOper:"searchOper",sFilter:"filters",loadDefaults:!0,beforeShowSearch:null,afterShowSearch:null,onInitializeSearch:null,closeAfterSearch:!1,closeAfterReset:!1,closeOnEscape:!1,multipleSearch:!1,multipleGroup:!1,top:0,left:0,jqModal:!0,modal:!1,resize:!1,width:450,height:"auto",dataheight:"auto",showQuery:!1,errorcheck:!0,sopt:null,stringResult:void 0,onClose:null,onSearch:null,
onReset:null,toTop:!0,overlay:10,columns:[],tmplNames:null,tmplFilters:null,tmplLabel:" Template: ",showOnLoad:!1,layer:null},a.jgrid.search,c||{});return this.each(function(){function b(){a.isFunction(c.beforeShowSearch)&&(f=c.beforeShowSearch(a("#"+l)),"undefined"===typeof f&&(f=!0));f&&(a.jgrid.viewModal("#"+k.themodal,{gbox:"#gbox_"+l,jqm:c.jqModal,modal:c.modal,overlay:c.overlay,toTop:c.toTop}),a.isFunction(c.afterShowSearch)&&c.afterShowSearch(a("#"+l)))}var g=this;if(g.grid){var l="fbox_"+
g.p.id,f=!0,k={themodal:"searchmod"+l,modalhead:"searchhd"+l,modalcontent:"searchcnt"+l,scrollelm:l},d=g.p.postData[c.sFilter];"string"===typeof d&&(d=a.jgrid.parse(d));!0===c.recreateFilter&&a("#"+k.themodal).remove();if(null!==a("#"+k.themodal).html())b();else{var m=a("<span><div id='"+l+"' class='searchFilter' style='overflow:auto'></div></span>").insertBefore("#gview_"+g.p.id);if(a.isFunction(c.onInitializeSearch))c.onInitializeSearch(a("#"+l));var o=a.extend([],g.p.colModel),r="<a href='javascript:void(0)' id='"+
l+"_search' class='fm-button ui-state-default ui-corner-all fm-button-icon-right ui-reset'><span class='ui-icon ui-icon-search'></span>"+c.Find+"</a>",p="<a href='javascript:void(0)' id='"+l+"_reset' class='fm-button ui-state-default ui-corner-all fm-button-icon-left ui-search'><span class='ui-icon ui-icon-arrowreturnthick-1-w'></span>"+c.Reset+"</a>",u="",t="",y,z=!1;c.showQuery&&(u="<a href='javascript:void(0)' id='"+l+"_query' class='fm-button ui-state-default ui-corner-all fm-button-icon-left'><span class='ui-icon ui-icon-comment'></span>Query</a>");
c.columns.length?o=c.columns:a.each(o,function(a,b){b.label||(b.label=g.p.colNames[a]);if(!z){var c="undefined"===typeof b.search?!0:b.search,d=!0===b.hidden;if(b.searchoptions&&!0===b.searchoptions.searchhidden&&c||c&&!d)z=!0,y=b.index||b.name}});if(!d&&y||!1===c.multipleSearch)d={groupOp:"AND",rules:[{field:y,op:"eq",data:""}]};z=!1;c.tmplNames&&c.tmplNames.length&&(z=!0,t=c.tmplLabel,t+="<select class='ui-template'>",t+="<option value='default'>Default</option>",a.each(c.tmplNames,function(a,b){t+=
"<option value='"+a+"'>"+b+"</option>"}),t+="</select>");r="<table class='EditTable' style='border:0px none;margin-top:5px' id='"+l+"_2'><tbody><tr><td colspan='2'><hr class='ui-widget-content' style='margin:1px'/></td></tr><tr><td class='EditButton' style='text-align:left'>"+p+t+"</td><td class='EditButton'>"+u+r+"</td></tr></tbody></table>";a("#"+l).jqFilter({columns:o,filter:c.loadDefaults?d:null,showQuery:c.showQuery,errorcheck:c.errorcheck,sopt:c.sopt,groupButton:c.multipleGroup,_gridsopt:a.jgrid.search.odata,
onChange:function(){this.p.showQuery&&a(".query",this).html(this.toUserFriendlyString())}});m.append(r);z&&c.tmplFilters&&c.tmplFilters.length&&a(".ui-template",m).bind("change",function(){var b=a(this).val();b=="default"?a("#"+l).jqFilter("addFilter",d):a("#"+l).jqFilter("addFilter",c.tmplFilters[parseInt(b,10)]);return false});!1===c.multipleSearch&&(a(".add-rule","#"+l).hide(),a(".delete-rule","#"+l).hide());if(a.isFunction(c.onInitializeSearch))c.onInitializeSearch(a("#"+l));c.layer?a.jgrid.createModal(k,
m,c,"#gview_"+g.p.id,a("#gbox_"+g.p.id)[0],"#"+c.layer,{position:"relative"}):a.jgrid.createModal(k,m,c,"#gview_"+g.p.id,a("#gbox_"+g.p.id)[0]);u&&a("#"+l+"_query").bind("click",function(){a(".queryresult",m).toggle();return false});void 0===c.stringResult&&(c.stringResult=c.multipleSearch);a("#"+l+"_search").bind("click",function(){var b=a("#"+l),d={},f,m=b.jqFilter("filterData");if(c.errorcheck){b[0].hideError();c.showQuery||b.jqFilter("toSQLString");if(b[0].p.error){b[0].showError();return false}}if(c.stringResult){try{f=
e.toJson(m,"","",false)}catch(o){try{f=la.stringify(m)}catch(q){}}if(typeof f==="string"){d[c.sFilter]=f;a.each([c.sField,c.sValue,c.sOper],function(){d[this]=""})}}else if(c.multipleSearch){d[c.sFilter]=m;a.each([c.sField,c.sValue,c.sOper],function(){d[this]=""})}else{d[c.sField]=m.rules[0].field;d[c.sValue]=m.rules[0].data;d[c.sOper]=m.rules[0].op;d[c.sFilter]=""}g.p.search=true;a.extend(g.p.postData,d);if(a.isFunction(c.onSearch))c.onSearch();a(g).trigger("reloadGrid",[{page:1}]);c.closeAfterSearch&&
a.jgrid.hideModal("#"+k.themodal,{gb:"#gbox_"+g.p.id,jqm:c.jqModal,onClose:c.onClose});return false});a("#"+l+"_reset").bind("click",function(){var b={},d=a("#"+l);g.p.search=false;c.multipleSearch===false?b[c.sField]=b[c.sValue]=b[c.sOper]="":b[c.sFilter]="";d[0].resetFilter();z&&a(".ui-template",m).val("default");a.extend(g.p.postData,b);if(a.isFunction(c.onReset))c.onReset();a(g).trigger("reloadGrid",[{page:1}]);return false});b();a(".fm-button:not(.ui-state-disabled)",m).hover(function(){a(this).addClass("ui-state-hover")},
function(){a(this).removeClass("ui-state-hover")})}}})},editGridRow:function(c,b){g=b=a.extend({top:0,left:0,width:300,height:"auto",dataheight:"auto",modal:!1,overlay:10,drag:!0,resize:!0,url:null,mtype:"POST",clearAfterAdd:!0,closeAfterEdit:!1,reloadAfterSubmit:!0,onInitializeForm:null,beforeInitData:null,beforeShowForm:null,afterShowForm:null,beforeSubmit:null,afterSubmit:null,onclickSubmit:null,afterComplete:null,onclickPgButtons:null,afterclickPgButtons:null,editData:{},recreateForm:!1,jqModal:!0,
closeOnEscape:!1,addedrow:"first",topinfo:"",bottominfo:"",saveicon:[],closeicon:[],savekey:[!1,13],navkeys:[!1,38,40],checkOnSubmit:!1,checkOnUpdate:!1,_savedData:{},processing:!1,onClose:null,ajaxEditOptions:{},serializeEditData:null,viewPagerButtons:!0},a.jgrid.edit,b||{});return this.each(function(){function e(){a(".FormElement","#"+x).each(function(){var b=a(".customelement",this);if(b.length){var c=a(b[0]).attr("name");a.each(t.p.colModel,function(){if(this.name===c&&this.editoptions&&a.isFunction(this.editoptions.custom_value)){try{if(D[c]=
this.editoptions.custom_value(a("#"+a.jgrid.jqID(c),"#"+x),"get"),void 0===D[c])throw"e1";}catch(b){"e1"===b?a.jgrid.info_dialog(m.jgrid.errors.errcap,"function 'custom_value' "+a.jgrid.edit.msg.novalue,m.jgrid.edit.bClose):a.jgrid.info_dialog(m.jgrid.errors.errcap,b.message,m.jgrid.edit.bClose)}return!0}})}else{switch(a(this).get(0).type){case "checkbox":a(this).attr("checked")?D[this.name]=a(this).val():(b=a(this).attr("offval"),D[this.name]=b);break;case "select-one":D[this.name]=a("option:selected",
this).val();Z[this.name]=a("option:selected",this).text();break;case "select-multiple":D[this.name]=a(this).val();D[this.name]=D[this.name]?D[this.name].join(","):"";var d=[];a("option:selected",this).each(function(b,c){d[b]=a(c).text()});Z[this.name]=d.join(",");break;case "password":case "text":case "textarea":case "button":D[this.name]=a(this).val()}t.p.autoencode&&(D[this.name]=a.jgrid.htmlEncode(D[this.name]))}});return!0}function l(b,c,d,f){var e,j,k=0,l,m,o,q=[],p=!1,r="",u;for(u=1;u<=f;u++)r+=
"<td class='CaptionTD'>&#160;</td><td class='DataTD'>&#160;</td>";"_empty"!=b&&(p=a(c).jqGrid("getInd",b));a(c.p.colModel).each(function(u){e=this.name;m=(this.editrules&&!0===this.editrules.edithidden?0:!0===this.hidden)?"style='display:none'":"";if("cb"!==e&&"subgrid"!==e&&!0===this.editable&&"rn"!==e){if(!1===p)l="";else if(e==c.p.ExpandColumn&&!0===c.p.treeGrid)l=a("td:eq("+u+")",c.rows[p]).text();else try{l=a.unformat(a("td:eq("+u+")",c.rows[p]),{rowId:b,colModel:this},u)}catch(y){l=a("td:eq("+
u+")",c.rows[p]).text()}var x=a.extend({},this.editoptions||{},{id:e,name:e}),v=a.extend({},{elmprefix:"",elmsuffix:"",rowabove:!1,rowcontent:""},this.formoptions||{}),z=parseInt(v.rowpos,10)||k+1,A=parseInt(2*(parseInt(v.colpos,10)||1),10);"_empty"==b&&x.defaultValue&&(l=a.isFunction(x.defaultValue)?x.defaultValue():x.defaultValue);this.edittype||(this.edittype="text");t.p.autoencode&&(l=a.jgrid.htmlDecode(l));o=a.jgrid.createEl(this.edittype,x,l,!1,a.extend({},a.jgrid.ajaxOptions,c.p.ajaxSelectOptions||
{}));""===l&&"checkbox"==this.edittype&&(l=a(o).attr("offval"));""===l&&"select"==this.edittype&&(l=a("option:eq(0)",o).text());if(g.checkOnSubmit||g.checkOnUpdate)g._savedData[e]=l;a(o).addClass("FormElement");("text"==this.edittype||"textarea"==this.edittype)&&a(o).addClass("ui-widget-content ui-corner-all");j=a(d).find("tr[rowpos="+z+"]");v.rowabove&&(x=a("<tr><td class='contentinfo' colspan='"+2*f+"'>"+v.rowcontent+"</td></tr>"),a(d).append(x),x[0].rp=z);0===j.length&&(j=a("<tr "+m+" rowpos='"+
z+"'></tr>").addClass("FormData").attr("id","tr_"+e),a(j).append(r),a(d).append(j),j[0].rp=z);a("td:eq("+(A-2)+")",j[0]).html("undefined"===typeof v.label?c.p.colNames[u]:v.label);a("td:eq("+(A-1)+")",j[0]).append(v.elmprefix).append(o).append(v.elmsuffix);q[k]=u;k++}});if(0<k&&(u=a("<tr class='FormData' style='display:none'><td class='CaptionTD'></td><td colspan='"+(2*f-1)+"' class='DataTD'><input class='FormElement' id='id_g' type='text' name='"+c.p.id+"_id' value='"+b+"'/></td></tr>"),u[0].rp=
k+999,a(d).append(u),g.checkOnSubmit||g.checkOnUpdate))g._savedData[c.p.id+"_id"]=b;return q}function f(b,c,d){var f,e=0,j,k,l,o,q;if(g.checkOnSubmit||g.checkOnUpdate)g._savedData={},g._savedData[c.p.id+"_id"]=b;var p=c.p.colModel;if("_empty"==b)a(p).each(function(){f=this.name;l=a.extend({},this.editoptions||{});if((k=a("#"+a.jgrid.jqID(f),"#"+d))&&null!==k[0])if(o="",l.defaultValue?(o=a.isFunction(l.defaultValue)?l.defaultValue():l.defaultValue,"checkbox"==k[0].type?(q=o.toLowerCase(),0>q.search(/(false|0|no|off|undefined)/i)&&
""!==q?(k[0].checked=!0,k[0].defaultChecked=!0,k[0].value=o):k.attr({checked:"",defaultChecked:""})):k.val(o)):"checkbox"==k[0].type?(k[0].checked=!1,k[0].defaultChecked=!1,o=a(k).attr("offval")):k[0].type&&"select"==k[0].type.substr(0,6)?k[0].selectedIndex=0:k.val(o),!0===g.checkOnSubmit||g.checkOnUpdate)g._savedData[f]=o}),a("#id_g","#"+d).val(b);else{var r=a(c).jqGrid("getInd",b,!0);r&&(a("td",r).each(function(k){f=p[k].name;if("cb"!==f&&"subgrid"!==f&&"rn"!==f&&!0===p[k].editable){if(f==c.p.ExpandColumn&&
!0===c.p.treeGrid)j=a(this).text();else try{j=a.unformat(a(this),{rowId:b,colModel:p[k]},k)}catch(l){j=a(this).text()}t.p.autoencode&&(j=a.jgrid.htmlDecode(j));if(!0===g.checkOnSubmit||g.checkOnUpdate)g._savedData[f]=j;f=a.jgrid.jqID(f);switch(p[k].edittype){case "password":case "text":case "button":case "image":a("#"+f,"#"+d).val(j);break;case "textarea":if("&nbsp;"==j||"&#160;"==j||1==j.length&&160==j.charCodeAt(0))j="";a("#"+f,"#"+d).val(j);break;case "select":var o=j.split(","),o=a.map(o,function(b){return a.trim(b)});
a("#"+f+" option","#"+d).each(function(){this.selected=!p[k].editoptions.multiple&&(o[0]==a.trim(a(this).text())||o[0]==a.trim(a(this).val()))?!0:p[k].editoptions.multiple?-1<a.inArray(a.trim(a(this).text()),o)||-1<a.inArray(a.trim(a(this).val()),o)?!0:!1:!1});break;case "checkbox":j+="";p[k].editoptions&&p[k].editoptions.value?p[k].editoptions.value.split(":")[0]==j?(a("#"+f,"#"+d).attr("checked",!0),a("#"+f,"#"+d).attr("defaultChecked",!0)):(a("#"+f,"#"+d).attr("checked",!1),a("#"+f,"#"+d).attr("defaultChecked",
"")):(j=j.toLowerCase(),0>j.search(/(false|0|no|off|undefined)/i)&&""!==j?(a("#"+f,"#"+d).attr("checked",!0),a("#"+f,"#"+d).attr("defaultChecked",!0)):(a("#"+f,"#"+d).attr("checked",!1),a("#"+f,"#"+d).attr("defaultChecked","")));break;case "custom":try{if(p[k].editoptions&&a.isFunction(p[k].editoptions.custom_value))p[k].editoptions.custom_value(a("#"+f,"#"+d),"set",j);else throw"e1";}catch(q){"e1"==q?a.jgrid.info_dialog(m.jgrid.errors.errcap,"function 'custom_value' "+a.jgrid.edit.msg.nodefined,
m.jgrid.edit.bClose):a.jgrid.info_dialog(m.jgrid.errors.errcap,q.message,m.jgrid.edit.bClose)}}e++}}),0<e&&a("#id_g","#"+x).val(b))}}function k(){var c,d=[!0,"",""],e={},j=t.p.prmNames,k,l,m,o;if(a.isFunction(g.beforeCheckValues)){var q=g.beforeCheckValues(D,a("#"+z),"_empty"==D[t.p.id+"_id"]?j.addoper:j.editoper);q&&"object"===typeof q&&(D=q)}for(m in D)if(D.hasOwnProperty(m)&&(d=a.jgrid.checkValues(D[m],m,t),!1===d[0]))break;d[0]&&(a.isFunction(g.onclickSubmit)&&(e=g.onclickSubmit(g,D)||{}),a.isFunction(g.beforeSubmit)&&
(d=g.beforeSubmit(D,a("#"+z))));if(d[0]&&!g.processing){g.processing=!0;a("#sData","#"+x+"_2").addClass("ui-state-active");l=j.oper;k=j.id;D[l]="_empty"==a.trim(D[t.p.id+"_id"])?j.addoper:j.editoper;D[l]!=j.addoper?D[k]=D[t.p.id+"_id"]:void 0===D[k]&&(D[k]=D[t.p.id+"_id"]);delete D[t.p.id+"_id"];D=a.extend(D,g.editData,e);if(!0===t.p.treeGrid)for(i in D[l]==j.addoper&&(o=a(t).jqGrid("getGridParam","selrow"),D["adjacency"==t.p.treeGridModel?t.p.treeReader.parent_id_field:"parent_id"]=o),t.p.treeReader)e=
t.p.treeReader[i],D.hasOwnProperty(e)&&(D[l]==j.addoper&&"parent_id_field"===i||delete D[e]);e=a.extend({url:g.url?g.url:a(t).jqGrid("getGridParam","editurl"),type:g.mtype,data:a.isFunction(g.serializeEditData)?g.serializeEditData(D):D,complete:function(e,m){if(m!="success"){d[0]=false;d[1]=a.isFunction(g.errorTextFormat)?g.errorTextFormat(e):m+" Status: '"+e.statusText+"'. Error code: "+e.status}else a.isFunction(g.afterSubmit)&&(d=g.afterSubmit(e,D));if(d[0]===false){a("#FormError>td","#"+x).html(d[1]);
a("#FormError","#"+x).show()}else{a.each(t.p.colModel,function(){if(Z[this.name]&&this.formatter&&this.formatter=="select")try{delete Z[this.name]}catch(a){}});D=a.extend(D,Z);t.p.autoencode&&a.each(D,function(b,c){D[b]=a.jgrid.htmlDecode(c)});g.reloadAfterSubmit=g.reloadAfterSubmit&&t.p.datatype!="local";if(D[l]==j.addoper){d[2]||(d[2]=a.jgrid.randId());D[k]=d[2];if(g.closeAfterAdd){if(g.reloadAfterSubmit)a(t).trigger("reloadGrid");else if(t.p.treeGrid===true)a(t).jqGrid("addChildNode",d[2],o,D);
else{a(t).jqGrid("addRowData",d[2],D,b.addedrow);a(t).jqGrid("setSelection",d[2])}a.jgrid.hideModal("#"+v.themodal,{gb:"#gbox_"+y,jqm:b.jqModal,onClose:g.onClose})}else if(g.clearAfterAdd){g.reloadAfterSubmit?a(t).trigger("reloadGrid"):t.p.treeGrid===true?a(t).jqGrid("addChildNode",d[2],o,D):a(t).jqGrid("addRowData",d[2],D,b.addedrow);f("_empty",t,z)}else g.reloadAfterSubmit?a(t).trigger("reloadGrid"):t.p.treeGrid===true?a(t).jqGrid("addChildNode",d[2],o,D):a(t).jqGrid("addRowData",d[2],D,b.addedrow)}else{if(g.reloadAfterSubmit){a(t).trigger("reloadGrid");
g.closeAfterEdit||setTimeout(function(){a(t).jqGrid("setSelection",D[k])},1E3)}else t.p.treeGrid===true?a(t).jqGrid("setTreeRow",D[k],D):a(t).jqGrid("setRowData",D[k],D);g.closeAfterEdit&&a.jgrid.hideModal("#"+v.themodal,{gb:"#gbox_"+y,jqm:b.jqModal,onClose:g.onClose})}if(a.isFunction(g.afterComplete)){c=e;setTimeout(function(){g.afterComplete(c,D,a("#"+z));c=null},500)}if(g.checkOnSubmit||g.checkOnUpdate){a("#"+z).data("disabled",false);if(g._savedData[t.p.id+"_id"]!="_empty")for(var q in g._savedData)D[q]&&
(g._savedData[q]=D[q])}}g.processing=false;a("#sData","#"+x+"_2").removeClass("ui-state-active");try{a(":input:visible","#"+z)[0].focus()}catch(p){}}},a.jgrid.ajaxOptions,g.ajaxEditOptions);!e.url&&!g.useDataProxy&&(a.isFunction(t.p.dataProxy)?g.useDataProxy=!0:(d[0]=!1,d[1]+=" "+a.jgrid.errors.nourl));d[0]&&(g.useDataProxy?t.p.dataProxy.call(t,e,"set_"+t.p.id):a.ajax(e))}!1===d[0]&&(a("#FormError>td","#"+x).html(d[1]),a("#FormError","#"+x).show())}function d(a,b){var c=!1,d;for(d in a)if(a[d]!=b[d]){c=
!0;break}return c}function q(){a.each(t.p.colModel,function(a,b){b.editoptions&&!0===b.editoptions.NullIfEmpty&&D.hasOwnProperty(b.name)&&""==D[b.name]&&(D[b.name]="null")})}function o(){var b=!0;a("#FormError","#"+x).hide();g.checkOnUpdate&&(D={},Z={},e(),ca=a.extend({},D,Z),d(ca,g._savedData)?(a("#"+z).data("disabled",!0),a(".confirm","#"+v.themodal).show(),b=!1):q());return b}function r(){if("_empty"!==c&&"undefined"!==typeof t.p.savedRow&&0<t.p.savedRow.length&&a.isFunction(a.fn.jqGrid.restoreRow))for(var b=
0;b<t.p.savedRow.length;b++)if(t.p.savedRow[b].id==c){a(t).jqGrid("restoreRow",c);break}}function p(b,c){0===b?a("#pData","#"+x+"_2").addClass("ui-state-disabled"):a("#pData","#"+x+"_2").removeClass("ui-state-disabled");b==c?a("#nData","#"+x+"_2").addClass("ui-state-disabled"):a("#nData","#"+x+"_2").removeClass("ui-state-disabled")}function u(){var b=a(t).jqGrid("getDataIDs"),c=a("#id_g","#"+x).val();return[a.inArray(c,b),b]}var t=this;if(t.grid&&c){var y=t.p.id,z="FrmGrid_"+y,x="TblGrid_"+y,v={themodal:"editmod"+
y,modalhead:"edithd"+y,modalcontent:"editcnt"+y,scrollelm:z},A=a.isFunction(g.beforeShowForm)?g.beforeShowForm:!1,B=a.isFunction(g.afterShowForm)?g.afterShowForm:!1,E=a.isFunction(g.beforeInitData)?g.beforeInitData:!1,F=a.isFunction(g.onInitializeForm)?g.onInitializeForm:!1,J=!0,I=1,N=0,D,Z,ca;"new"===c?(c="_empty",b.caption=g.addCaption):b.caption=g.editCaption;!0===b.recreateForm&&null!==a("#"+v.themodal).html()&&a("#"+v.themodal).remove();var ba=!0;b.checkOnUpdate&&(b.jqModal&&!b.modal)&&(ba=!1);
if(null!==a("#"+v.themodal).html()){E&&(J=E(a("#"+z)),"undefined"==typeof J&&(J=!0));if(!1===J)return;r();a(".ui-jqdialog-title","#"+v.modalhead).html(b.caption);a("#FormError","#"+x).hide();g.topinfo?(a(".topinfo","#"+x+"_2").html(g.topinfo),a(".tinfo","#"+x+"_2").show()):a(".tinfo","#"+x+"_2").hide();g.bottominfo?(a(".bottominfo","#"+x+"_2").html(g.bottominfo),a(".binfo","#"+x+"_2").show()):a(".binfo","#"+x+"_2").hide();f(c,t,z);"_empty"==c||!g.viewPagerButtons?a("#pData, #nData","#"+x+"_2").hide():
a("#pData, #nData","#"+x+"_2").show();!0===g.processing&&(g.processing=!1,a("#sData","#"+x+"_2").removeClass("ui-state-active"));!0===a("#"+z).data("disabled")&&(a(".confirm","#"+v.themodal).hide(),a("#"+z).data("disabled",!1));A&&A(a("#"+z));a("#"+v.themodal).data("onClose",g.onClose);a.jgrid.viewModal("#"+v.themodal,{gbox:"#gbox_"+y,jqm:b.jqModal,jqM:!1,overlay:b.overlay,modal:b.modal});ba||a(".jqmOverlay").click(function(){if(!o())return false;a.jgrid.hideModal("#"+v.themodal,{gb:"#gbox_"+y,jqm:b.jqModal,
onClose:g.onClose});return false});B&&B(a("#"+z))}else{var T=isNaN(b.dataheight)?b.dataheight:b.dataheight+"px",T=a("<form name='FormPost' id='"+z+"' class='FormGrid' onSubmit='return false;' style='width:100%;overflow:auto;position:relative;height:"+T+";'></form>").data("disabled",!1),$=a("<table id='"+x+"' class='EditTable' cellspacing='0' cellpadding='0' border='0'><tbody></tbody></table>");E&&(J=E(a("#"+z)),"undefined"==typeof J&&(J=!0));if(!1===J)return;r();a(t.p.colModel).each(function(){var a=
this.formoptions;I=Math.max(I,a?a.colpos||0:0);N=Math.max(N,a?a.rowpos||0:0)});a(T).append($);E=a("<tr id='FormError' style='display:none'><td class='ui-state-error' colspan='"+2*I+"'></td></tr>");E[0].rp=0;a($).append(E);E=a("<tr style='display:none' class='tinfo'><td class='topinfo' colspan='"+2*I+"'>"+g.topinfo+"</td></tr>");E[0].rp=0;a($).append(E);var J=(E="rtl"==t.p.direction?!0:!1)?"nData":"pData",G=E?"pData":"nData";l(c,t,$,I);var J="<a href='javascript:void(0)' id='"+J+"' class='fm-button ui-state-default ui-corner-left'><span class='ui-icon ui-icon-triangle-1-w'></span></div>",
G="<a href='javascript:void(0)' id='"+G+"' class='fm-button ui-state-default ui-corner-right'><span class='ui-icon ui-icon-triangle-1-e'></span></div>",O="<a href='javascript:void(0)' id='sData' class='fm-button ui-state-default ui-corner-all'>"+b.bSubmit+"</a>",R="<a href='javascript:void(0)' id='cData' class='fm-button ui-state-default ui-corner-all'>"+b.bCancel+"</a>",J="<table border='0' cellspacing='0' cellpadding='0' class='EditTable' id='"+x+"_2'><tbody><tr><td colspan='2'><hr class='ui-widget-content' style='margin:1px'/></td></tr><tr id='Act_Buttons'><td class='navButton'>"+
(E?G+J:J+G)+"</td><td class='EditButton'>"+O+R+"</td></tr>"+("<tr style='display:none' class='binfo'><td class='bottominfo' colspan='2'>"+g.bottominfo+"</td></tr>"),J=J+"</tbody></table>";if(0<N){var W=[];a.each(a($)[0].rows,function(a,b){W[a]=b});W.sort(function(a,b){return a.rp>b.rp?1:a.rp<b.rp?-1:0});a.each(W,function(b,c){a("tbody",$).append(c)})}b.gbox="#gbox_"+y;var Q=!1;!0===b.closeOnEscape&&(b.closeOnEscape=!1,Q=!0);T=a("<span></span>").append(T).append(J);a.jgrid.createModal(v,T,b,"#gview_"+
t.p.id,a("#gbox_"+t.p.id)[0]);E&&(a("#pData, #nData","#"+x+"_2").css("float","right"),a(".EditButton","#"+x+"_2").css("text-align","left"));g.topinfo&&a(".tinfo","#"+x+"_2").show();g.bottominfo&&a(".binfo","#"+x+"_2").show();J=T=null;a("#"+v.themodal).keydown(function(c){var d=c.target;if(a("#"+z).data("disabled")===true)return false;if(g.savekey[0]===true&&c.which==g.savekey[1]&&d.tagName!="TEXTAREA"){a("#sData","#"+x+"_2").trigger("click");return false}if(c.which===27){if(!o())return false;Q&&a.jgrid.hideModal(this,
{gb:b.gbox,jqm:b.jqModal,onClose:g.onClose});return false}if(g.navkeys[0]===true){if(a("#id_g","#"+x).val()=="_empty")return true;if(c.which==g.navkeys[1]){a("#pData","#"+x+"_2").trigger("click");return false}if(c.which==g.navkeys[2]){a("#nData","#"+x+"_2").trigger("click");return false}}});b.checkOnUpdate&&(a("a.ui-jqdialog-titlebar-close span","#"+v.themodal).removeClass("jqmClose"),a("a.ui-jqdialog-titlebar-close","#"+v.themodal).unbind("click").click(function(){if(!o())return false;a.jgrid.hideModal("#"+
v.themodal,{gb:"#gbox_"+y,jqm:b.jqModal,onClose:g.onClose});return false}));b.saveicon=a.extend([!0,"left","ui-icon-disk"],b.saveicon);b.closeicon=a.extend([!0,"left","ui-icon-close"],b.closeicon);!0===b.saveicon[0]&&a("#sData","#"+x+"_2").addClass("right"==b.saveicon[1]?"fm-button-icon-right":"fm-button-icon-left").append("<span class='ui-icon "+b.saveicon[2]+"'></span>");!0===b.closeicon[0]&&a("#cData","#"+x+"_2").addClass("right"==b.closeicon[1]?"fm-button-icon-right":"fm-button-icon-left").append("<span class='ui-icon "+
b.closeicon[2]+"'></span>");if(g.checkOnSubmit||g.checkOnUpdate)O="<a href='javascript:void(0)' id='sNew' class='fm-button ui-state-default ui-corner-all' style='z-index:1002'>"+b.bYes+"</a>",G="<a href='javascript:void(0)' id='nNew' class='fm-button ui-state-default ui-corner-all' style='z-index:1002'>"+b.bNo+"</a>",R="<a href='javascript:void(0)' id='cNew' class='fm-button ui-state-default ui-corner-all' style='z-index:1002'>"+b.bExit+"</a>",T=b.zIndex||999,T++,a("<div class='ui-widget-overlay jqgrid-overlay confirm' style='z-index:"+
T+";display:none;'>&#160;"+(a.browser.msie&&6==a.browser.version?'<iframe style="display:block;position:absolute;z-index:-1;filter:Alpha(Opacity=\'0\');" src="javascript:false;"></iframe>':"")+"</div><div class='confirm ui-widget-content ui-jqconfirm' style='z-index:"+(T+1)+"'>"+b.saveData+"<br/><br/>"+O+G+R+"</div>").insertAfter("#"+z),a("#sNew","#"+v.themodal).click(function(){k();a("#"+z).data("disabled",false);a(".confirm","#"+v.themodal).hide();return false}),a("#nNew","#"+v.themodal).click(function(){a(".confirm",
"#"+v.themodal).hide();a("#"+z).data("disabled",false);setTimeout(function(){a(":input","#"+z)[0].focus()},0);return false}),a("#cNew","#"+v.themodal).click(function(){a(".confirm","#"+v.themodal).hide();a("#"+z).data("disabled",false);a.jgrid.hideModal("#"+v.themodal,{gb:"#gbox_"+y,jqm:b.jqModal,onClose:g.onClose});return false});F&&F(a("#"+z));"_empty"==c||!g.viewPagerButtons?a("#pData,#nData","#"+x+"_2").hide():a("#pData,#nData","#"+x+"_2").show();A&&A(a("#"+z));a("#"+v.themodal).data("onClose",
g.onClose);a.jgrid.viewModal("#"+v.themodal,{gbox:"#gbox_"+y,jqm:b.jqModal,overlay:b.overlay,modal:b.modal});ba||a(".jqmOverlay").click(function(){if(!o())return false;a.jgrid.hideModal("#"+v.themodal,{gb:"#gbox_"+y,jqm:b.jqModal,onClose:g.onClose});return false});B&&B(a("#"+z));a(".fm-button","#"+v.themodal).hover(function(){a(this).addClass("ui-state-hover")},function(){a(this).removeClass("ui-state-hover")});a("#sData","#"+x+"_2").click(function(){D={};Z={};a("#FormError","#"+x).hide();e();q();
if(D[t.p.id+"_id"]=="_empty")k();else if(b.checkOnSubmit===true){ca=a.extend({},D,Z);if(d(ca,g._savedData)){a("#"+z).data("disabled",true);a(".confirm","#"+v.themodal).show()}else k()}else k();return false});a("#cData","#"+x+"_2").click(function(){if(!o())return false;a.jgrid.hideModal("#"+v.themodal,{gb:"#gbox_"+y,jqm:b.jqModal,onClose:g.onClose});return false});a("#nData","#"+x+"_2").click(function(){if(!o())return false;a("#FormError","#"+x).hide();var c=u();c[0]=parseInt(c[0],10);if(c[0]!=-1&&
c[1][c[0]+1]){if(a.isFunction(b.onclickPgButtons))b.onclickPgButtons("next",a("#"+z),c[1][c[0]]);f(c[1][c[0]+1],t,z);a(t).jqGrid("setSelection",c[1][c[0]+1]);a.isFunction(b.afterclickPgButtons)&&b.afterclickPgButtons("next",a("#"+z),c[1][c[0]+1]);p(c[0]+1,c[1].length-1)}return false});a("#pData","#"+x+"_2").click(function(){if(!o())return false;a("#FormError","#"+x).hide();var c=u();if(c[0]!=-1&&c[1][c[0]-1]){if(a.isFunction(b.onclickPgButtons))b.onclickPgButtons("prev",a("#"+z),c[1][c[0]]);f(c[1][c[0]-
1],t,z);a(t).jqGrid("setSelection",c[1][c[0]-1]);a.isFunction(b.afterclickPgButtons)&&b.afterclickPgButtons("prev",a("#"+z),c[1][c[0]-1]);p(c[0]-1,c[1].length-1)}return false})}A=u();p(A[0],A[1].length-1)}})},viewGridRow:function(c,b){b=a.extend({top:0,left:0,width:0,height:"auto",dataheight:"auto",modal:!1,overlay:10,drag:!0,resize:!0,jqModal:!0,closeOnEscape:!1,labelswidth:"30%",closeicon:[],navkeys:[!1,38,40],onClose:null,beforeShowForm:null,beforeInitData:null,viewPagerButtons:!0},a.jgrid.view,
b||{});return this.each(function(){function g(){(!0===b.closeOnEscape||!0===b.navkeys[0])&&setTimeout(function(){a(".ui-jqdialog-titlebar-close","#"+u.modalhead).focus()},0)}function e(c,d,f,g){for(var j,k,l,m=0,o,q,p=[],r=!1,t="<td class='CaptionTD form-view-label ui-widget-content' width='"+b.labelswidth+"'>&#160;</td><td class='DataTD form-view-data ui-helper-reset ui-widget-content'>&#160;</td>",u="",y=["integer","number","currency"],x=0,v=0,z,A,B,E=1;E<=g;E++)u+=1==E?t:"<td class='CaptionTD form-view-label ui-widget-content'>&#160;</td><td class='DataTD form-view-data ui-widget-content'>&#160;</td>";
a(d.p.colModel).each(function(){k=this.editrules&&!0===this.editrules.edithidden?!1:!0===this.hidden?!0:!1;!k&&"right"===this.align&&(this.formatter&&-1!==a.inArray(this.formatter,y)?x=Math.max(x,parseInt(this.width,10)):v=Math.max(v,parseInt(this.width,10)))});z=0!==x?x:0!==v?v:0;r=a(d).jqGrid("getInd",c);a(d.p.colModel).each(function(b){j=this.name;A=!1;q=(k=this.editrules&&!0===this.editrules.edithidden?!1:!0===this.hidden?!0:!1)?"style='display:none'":"";B="boolean"!=typeof this.viewable?!0:this.viewable;
if("cb"!==j&&"subgrid"!==j&&"rn"!==j&&B){o=!1===r?"":j==d.p.ExpandColumn&&!0===d.p.treeGrid?a("td:eq("+b+")",d.rows[r]).text():a("td:eq("+b+")",d.rows[r]).html();A="right"===this.align&&0!==z?!0:!1;a.extend({},this.editoptions||{},{id:j,name:j});var c=a.extend({},{rowabove:!1,rowcontent:""},this.formoptions||{}),e=parseInt(c.rowpos,10)||m+1,t=parseInt(2*(parseInt(c.colpos,10)||1),10);if(c.rowabove){var y=a("<tr><td class='contentinfo' colspan='"+2*g+"'>"+c.rowcontent+"</td></tr>");a(f).append(y);
y[0].rp=e}l=a(f).find("tr[rowpos="+e+"]");0===l.length&&(l=a("<tr "+q+" rowpos='"+e+"'></tr>").addClass("FormData").attr("id","trv_"+j),a(l).append(u),a(f).append(l),l[0].rp=e);a("td:eq("+(t-2)+")",l[0]).html("<b>"+("undefined"===typeof c.label?d.p.colNames[b]:c.label)+"</b>");a("td:eq("+(t-1)+")",l[0]).append("<span>"+o+"</span>").attr("id","v_"+j);A&&a("td:eq("+(t-1)+") span",l[0]).css({"text-align":"right",width:z+"px"});p[m]=b;m++}});0<m&&(c=a("<tr class='FormData' style='display:none'><td class='CaptionTD'></td><td colspan='"+
(2*g-1)+"' class='DataTD'><input class='FormElement' id='id_g' type='text' name='id' value='"+c+"'/></td></tr>"),c[0].rp=m+99,a(f).append(c));return p}function f(b,c){var d,f,g=0,e,j;if(j=a(c).jqGrid("getInd",b,!0))a("td",j).each(function(b){d=c.p.colModel[b].name;f=c.p.colModel[b].editrules&&!0===c.p.colModel[b].editrules.edithidden?!1:!0===c.p.colModel[b].hidden?!0:!1;"cb"!==d&&("subgrid"!==d&&"rn"!==d)&&(e=d==c.p.ExpandColumn&&!0===c.p.treeGrid?a(this).text():a(this).html(),a.extend({},c.p.colModel[b].editoptions||
{}),d=a.jgrid.jqID("v_"+d),a("#"+d+" span","#"+p).html(e),f&&a("#"+d,"#"+p).parents("tr:first").hide(),g++)}),0<g&&a("#id_g","#"+p).val(b)}function k(b,c){0===b?a("#pData","#"+p+"_2").addClass("ui-state-disabled"):a("#pData","#"+p+"_2").removeClass("ui-state-disabled");b==c?a("#nData","#"+p+"_2").addClass("ui-state-disabled"):a("#nData","#"+p+"_2").removeClass("ui-state-disabled")}function d(){var b=a(m).jqGrid("getDataIDs"),c=a("#id_g","#"+p).val();return[a.inArray(c,b),b]}var m=this;if(m.grid&&
c){b.imgpath||(b.imgpath=m.p.imgpath);var o=m.p.id,r="ViewGrid_"+o,p="ViewTbl_"+o,u={themodal:"viewmod"+o,modalhead:"viewhd"+o,modalcontent:"viewcnt"+o,scrollelm:r},t=a.isFunction(b.beforeInitData)?b.beforeInitData:!1,y=!0,z=1,x=0;if(null!==a("#"+u.themodal).html()){t&&(y=t(a("#"+r)),"undefined"==typeof y&&(y=!0));if(!1===y)return;a(".ui-jqdialog-title","#"+u.modalhead).html(b.caption);a("#FormError","#"+p).hide();f(c,m);a.isFunction(b.beforeShowForm)&&b.beforeShowForm(a("#"+r));a.jgrid.viewModal("#"+
u.themodal,{gbox:"#gbox_"+o,jqm:b.jqModal,jqM:!1,overlay:b.overlay,modal:b.modal});g()}else{var v=isNaN(b.dataheight)?b.dataheight:b.dataheight+"px",v=a("<form name='FormPost' id='"+r+"' class='FormGrid' style='width:100%;overflow:auto;position:relative;height:"+v+";'></form>"),A=a("<table id='"+p+"' class='EditTable' cellspacing='1' cellpadding='2' border='0' style='table-layout:fixed'><tbody></tbody></table>");t&&(y=t(a("#"+r)),"undefined"==typeof y&&(y=!0));if(!1===y)return;a(m.p.colModel).each(function(){var a=
this.formoptions;z=Math.max(z,a?a.colpos||0:0);x=Math.max(x,a?a.rowpos||0:0)});a(v).append(A);e(c,m,A,z);var t="rtl"==m.p.direction?!0:!1,y="<a href='javascript:void(0)' id='"+(t?"nData":"pData")+"' class='fm-button ui-state-default ui-corner-left'><span class='ui-icon ui-icon-triangle-1-w'></span></a>",B="<a href='javascript:void(0)' id='"+(t?"pData":"nData")+"' class='fm-button ui-state-default ui-corner-right'><span class='ui-icon ui-icon-triangle-1-e'></span></a>",E="<a href='javascript:void(0)' id='cData' class='fm-button ui-state-default ui-corner-all'>"+
b.bClose+"</a>";if(0<x){var F=[];a.each(a(A)[0].rows,function(a,b){F[a]=b});F.sort(function(a,b){return a.rp>b.rp?1:a.rp<b.rp?-1:0});a.each(F,function(b,c){a("tbody",A).append(c)})}b.gbox="#gbox_"+o;var J=!1;!0===b.closeOnEscape&&(b.closeOnEscape=!1,J=!0);v=a("<span></span>").append(v).append("<table border='0' class='EditTable' id='"+p+"_2'><tbody><tr id='Act_Buttons'><td class='navButton' width='"+b.labelswidth+"'>"+(t?B+y:y+B)+"</td><td class='EditButton'>"+E+"</td></tr></tbody></table>");a.jgrid.createModal(u,
v,b,"#gview_"+m.p.id,a("#gview_"+m.p.id)[0]);t&&(a("#pData, #nData","#"+p+"_2").css("float","right"),a(".EditButton","#"+p+"_2").css("text-align","left"));b.viewPagerButtons||a("#pData, #nData","#"+p+"_2").hide();v=null;a("#"+u.themodal).keydown(function(c){if(c.which===27){J&&a.jgrid.hideModal(this,{gb:b.gbox,jqm:b.jqModal,onClose:b.onClose});return false}if(b.navkeys[0]===true){if(c.which===b.navkeys[1]){a("#pData","#"+p+"_2").trigger("click");return false}if(c.which===b.navkeys[2]){a("#nData",
"#"+p+"_2").trigger("click");return false}}});b.closeicon=a.extend([!0,"left","ui-icon-close"],b.closeicon);!0===b.closeicon[0]&&a("#cData","#"+p+"_2").addClass("right"==b.closeicon[1]?"fm-button-icon-right":"fm-button-icon-left").append("<span class='ui-icon "+b.closeicon[2]+"'></span>");a.isFunction(b.beforeShowForm)&&b.beforeShowForm(a("#"+r));a.jgrid.viewModal("#"+u.themodal,{gbox:"#gbox_"+o,jqm:b.jqModal,modal:b.modal});a(".fm-button:not(.ui-state-disabled)","#"+p+"_2").hover(function(){a(this).addClass("ui-state-hover")},
function(){a(this).removeClass("ui-state-hover")});g();a("#cData","#"+p+"_2").click(function(){a.jgrid.hideModal("#"+u.themodal,{gb:"#gbox_"+o,jqm:b.jqModal,onClose:b.onClose});return false});a("#nData","#"+p+"_2").click(function(){a("#FormError","#"+p).hide();var c=d();c[0]=parseInt(c[0],10);if(c[0]!=-1&&c[1][c[0]+1]){if(a.isFunction(b.onclickPgButtons))b.onclickPgButtons("next",a("#"+r),c[1][c[0]]);f(c[1][c[0]+1],m);a(m).jqGrid("setSelection",c[1][c[0]+1]);a.isFunction(b.afterclickPgButtons)&&b.afterclickPgButtons("next",
a("#"+r),c[1][c[0]+1]);k(c[0]+1,c[1].length-1)}g();return false});a("#pData","#"+p+"_2").click(function(){a("#FormError","#"+p).hide();var c=d();if(c[0]!=-1&&c[1][c[0]-1]){if(a.isFunction(b.onclickPgButtons))b.onclickPgButtons("prev",a("#"+r),c[1][c[0]]);f(c[1][c[0]-1],m);a(m).jqGrid("setSelection",c[1][c[0]-1]);a.isFunction(b.afterclickPgButtons)&&b.afterclickPgButtons("prev",a("#"+r),c[1][c[0]-1]);k(c[0]-1,c[1].length-1)}g();return false})}v=d();k(v[0],v[1].length-1)}})},delGridRow:function(c,b){g=
b=a.extend({top:0,left:0,width:240,height:"auto",dataheight:"auto",modal:!1,overlay:10,drag:!0,resize:!0,url:"",mtype:"POST",reloadAfterSubmit:!0,beforeShowForm:null,beforeInitData:null,afterShowForm:null,beforeSubmit:null,onclickSubmit:null,afterSubmit:null,jqModal:!0,closeOnEscape:!1,delData:{},delicon:[],cancelicon:[],onClose:null,ajaxDelOptions:{},processing:!1,serializeDelData:null,useDataProxy:!1},a.jgrid.del,b||{});return this.each(function(){var e=this;if(e.grid&&c){var l="function"===typeof b.beforeShowForm?
!0:!1,f="function"===typeof b.afterShowForm?!0:!1,k=a.isFunction(b.beforeInitData)?b.beforeInitData:!1,d=e.p.id,q={},o=!0,r="DelTbl_"+d,p,u,t,y,z={themodal:"delmod"+d,modalhead:"delhd"+d,modalcontent:"delcnt"+d,scrollelm:r};m.isArray(c)&&(c=c.join());if(null!==a("#"+z.themodal).html()){k&&(o=k(a("#"+r)),"undefined"==typeof o&&(o=!0));if(!1===o)return;a("#DelData>td","#"+r).text(c);a("#DelError","#"+r).hide();!0===g.processing&&(g.processing=!1,a("#dData","#"+r).removeClass("ui-state-active"));l&&
b.beforeShowForm(a("#"+r));a.jgrid.viewModal("#"+z.themodal,{gbox:"#gbox_"+d,jqm:b.jqModal,jqM:!1,overlay:b.overlay,modal:b.modal})}else{var x=isNaN(b.dataheight)?b.dataheight:b.dataheight+"px",x="<div id='"+r+"' class='formdata' style='width:100%;overflow:auto;position:relative;height:"+x+";'><table class='DelTable'><tbody><tr id='DelError' style='display:none'><td class='ui-state-error'></td></tr>"+("<tr id='DelData' style='display:none'><td >"+c+"</td></tr>"),x=x+('<tr><td class="delmsg" style="white-space:pre;">'+
b.msg+"</td></tr><tr><td >&#160;</td></tr>"),x=x+"</tbody></table></div>"+("<table cellspacing='0' cellpadding='0' border='0' class='EditTable' id='"+r+"_2'><tbody><tr><td><hr class='ui-widget-content' style='margin:1px'/></td></tr></tr><tr><td class='DelButton EditButton'>"+("<a href='javascript:void(0)' id='dData' class='fm-button ui-state-default ui-corner-all'>"+b.bSubmit+"</a>")+"&#160;"+("<a href='javascript:void(0)' id='eData' class='fm-button ui-state-default ui-corner-all'>"+b.bCancel+"</a>")+
"</td></tr></tbody></table>");b.gbox="#gbox_"+d;a.jgrid.createModal(z,x,b,"#gview_"+e.p.id,a("#gview_"+e.p.id)[0]);k&&(o=k(a("#"+r)),"undefined"==typeof o&&(o=!0));if(!1===o)return;a(".fm-button","#"+r+"_2").hover(function(){a(this).addClass("ui-state-hover")},function(){a(this).removeClass("ui-state-hover")});b.delicon=a.extend([!0,"left","ui-icon-scissors"],b.delicon);b.cancelicon=a.extend([!0,"left","ui-icon-cancel"],b.cancelicon);!0===b.delicon[0]&&a("#dData","#"+r+"_2").addClass("right"==b.delicon[1]?
"fm-button-icon-right":"fm-button-icon-left").append("<span class='ui-icon "+b.delicon[2]+"'></span>");!0===b.cancelicon[0]&&a("#eData","#"+r+"_2").addClass("right"==b.cancelicon[1]?"fm-button-icon-right":"fm-button-icon-left").append("<span class='ui-icon "+b.cancelicon[2]+"'></span>");a("#dData","#"+r+"_2").click(function(){var c=[true,""];q={};var f=a("#DelData>td","#"+r).text();typeof b.onclickSubmit==="function"&&(q=b.onclickSubmit(g,f)||{});typeof b.beforeSubmit==="function"&&(c=b.beforeSubmit(f));
if(c[0]&&!g.processing){g.processing=true;a(this).addClass("ui-state-active");t=e.p.prmNames;p=a.extend({},g.delData,q);y=t.oper;p[y]=t.deloper;u=t.id;p[u]=f;var k=a.extend({url:g.url?g.url:a(e).jqGrid("getGridParam","editurl"),type:b.mtype,data:a.isFunction(b.serializeDelData)?b.serializeDelData(p):p,complete:function(k,l){if(l!="success"){c[0]=false;c[1]=a.isFunction(g.errorTextFormat)?g.errorTextFormat(k):l+" Status: '"+k.statusText+"'. Error code: "+k.status}else typeof g.afterSubmit==="function"&&
(c=g.afterSubmit(k,p));if(c[0]===false){a("#DelError>td","#"+r).html(c[1]);a("#DelError","#"+r).show()}else{if(g.reloadAfterSubmit&&e.p.datatype!="local")a(e).trigger("reloadGrid");else{var m=[],m=f.split(",");if(e.p.treeGrid===true)try{a(e).jqGrid("delTreeNode",m[0])}catch(o){}else for(var q=0;q<m.length;q++)a(e).jqGrid("delRowData",m[q]);e.p.selrow=null;e.p.selarrrow=[]}a.isFunction(g.afterComplete)&&setTimeout(function(){g.afterComplete(k,f)},500)}g.processing=false;a("#dData","#"+r+"_2").removeClass("ui-state-active");
c[0]&&a.jgrid.hideModal("#"+z.themodal,{gb:"#gbox_"+d,jqm:b.jqModal,onClose:g.onClose})}},a.jgrid.ajaxOptions,b.ajaxDelOptions);if(!k.url&&!g.useDataProxy)if(a.isFunction(e.p.dataProxy))g.useDataProxy=true;else{c[0]=false;c[1]=c[1]+(" "+a.jgrid.errors.nourl)}c[0]&&(g.useDataProxy?e.p.dataProxy.call(e,k,"del_"+e.p.id):a.ajax(k))}if(c[0]===false){a("#DelError>td","#"+r).html(c[1]);a("#DelError","#"+r).show()}return false});a("#eData","#"+r+"_2").click(function(){a.jgrid.hideModal("#"+z.themodal,{gb:"#gbox_"+
d,jqm:b.jqModal,onClose:g.onClose});return false});l&&b.beforeShowForm(a("#"+r));a.jgrid.viewModal("#"+z.themodal,{gbox:"#gbox_"+d,jqm:b.jqModal,overlay:b.overlay,modal:b.modal})}f&&b.afterShowForm(a("#"+r));!0===b.closeOnEscape&&setTimeout(function(){a(".ui-jqdialog-titlebar-close","#"+z.modalhead).focus()},0)}})},navGrid:function(c,b,g,e,f,k,d){b=a.extend({edit:!0,editicon:"ui-icon-pencil",add:!0,addicon:"ui-icon-plus",del:!0,delicon:"ui-icon-trash",search:!0,searchicon:"ui-icon-search",refresh:!0,
refreshicon:"ui-icon-refresh",refreshstate:"firstpage",view:!1,viewicon:"ui-icon-document",position:"left",closeOnEscape:!0,beforeRefresh:null,afterRefresh:null,cloneToTop:!1},a.jgrid.nav,b||{});return this.each(function(){if(!this.nav){var m={themodal:"alertmod",modalhead:"alerthd",modalcontent:"alertcnt"},o=this,r,p,u;if(o.grid&&"string"==typeof c){null===a("#"+m.themodal).html()&&("undefined"!=typeof window.innerWidth?(r=window.innerWidth,p=window.innerHeight):"undefined"!=typeof document.documentElement&&
"undefined"!=typeof document.documentElement.clientWidth&&0!==document.documentElement.clientWidth?(r=document.documentElement.clientWidth,p=document.documentElement.clientHeight):(r=1024,p=768),a.jgrid.createModal(m,"<div>"+b.alerttext+"</div><span tabindex='0'><span tabindex='-1' id='jqg_alrt'></span></span>",{gbox:"#gbox_"+o.p.id,jqModal:!0,drag:!0,resize:!0,caption:b.alertcap,top:p/2-25,left:r/2-100,width:200,height:"auto",closeOnEscape:b.closeOnEscape},"","",!0));r=1;b.cloneToTop&&o.p.toppager&&
(r=2);for(p=0;p<r;p++){var t=a("<table cellspacing='0' cellpadding='0' border='0' class='ui-pg-table navtable' style='float:left;table-layout:auto;'><tbody><tr></tr></tbody></table>"),y,z;0===p?(y=c,z=o.p.id,y==o.p.toppager&&(z+="_top",r=1)):(y=o.p.toppager,z=o.p.id+"_top");"rtl"==o.p.direction&&a(t).attr("dir","rtl").css("float","right");b.add&&(e=e||{},u=a("<td class='ui-pg-button ui-corner-all'></td>"),a(u).append("<div class='ui-pg-div'><span class='ui-icon "+b.addicon+"'></span>"+b.addtext+"</div>"),
a("tr",t).append(u),a(u,t).attr({title:b.addtitle||"",id:e.id||"add_"+z}).click(function(){a(this).hasClass("ui-state-disabled")||(typeof b.addfunc=="function"?b.addfunc():a(o).jqGrid("editGridRow","new",e));return false}).hover(function(){a(this).hasClass("ui-state-disabled")||a(this).addClass("ui-state-hover")},function(){a(this).removeClass("ui-state-hover")}),u=null);b.edit&&(u=a("<td class='ui-pg-button ui-corner-all'></td>"),g=g||{},a(u).append("<div class='ui-pg-div'><span class='ui-icon "+
b.editicon+"'></span>"+b.edittext+"</div>"),a("tr",t).append(u),a(u,t).attr({title:b.edittitle||"",id:g.id||"edit_"+z}).click(function(){if(!a(this).hasClass("ui-state-disabled")){var c=o.p.selrow;if(c)typeof b.editfunc=="function"?b.editfunc(c):a(o).jqGrid("editGridRow",c,g);else{a.jgrid.viewModal("#"+m.themodal,{gbox:"#gbox_"+o.p.id,jqm:true});a("#jqg_alrt").focus()}}return false}).hover(function(){a(this).hasClass("ui-state-disabled")||a(this).addClass("ui-state-hover")},function(){a(this).removeClass("ui-state-hover")}),
u=null);b.view&&(u=a("<td class='ui-pg-button ui-corner-all'></td>"),d=d||{},a(u).append("<div class='ui-pg-div'><span class='ui-icon "+b.viewicon+"'></span>"+b.viewtext+"</div>"),a("tr",t).append(u),a(u,t).attr({title:b.viewtitle||"",id:d.id||"view_"+z}).click(function(){if(!a(this).hasClass("ui-state-disabled")){var b=o.p.selrow;if(b)a(o).jqGrid("viewGridRow",b,d);else{a.jgrid.viewModal("#"+m.themodal,{gbox:"#gbox_"+o.p.id,jqm:true});a("#jqg_alrt").focus()}}return false}).hover(function(){a(this).hasClass("ui-state-disabled")||
a(this).addClass("ui-state-hover")},function(){a(this).removeClass("ui-state-hover")}),u=null);b.del&&(u=a("<td class='ui-pg-button ui-corner-all'></td>"),f=f||{},a(u).append("<div class='ui-pg-div'><span class='ui-icon "+b.delicon+"'></span>"+b.deltext+"</div>"),a("tr",t).append(u),a(u,t).attr({title:b.deltitle||"",id:f.id||"del_"+z}).click(function(){if(!a(this).hasClass("ui-state-disabled")){var c;if(o.p.multiselect){c=o.p.selarrrow;c.length===0&&(c=null)}else c=o.p.selrow;if(c)"function"==typeof b.delfunc?
b.delfunc(c):a(o).jqGrid("delGridRow",c,f);else{a.jgrid.viewModal("#"+m.themodal,{gbox:"#gbox_"+o.p.id,jqm:true});a("#jqg_alrt").focus()}}return false}).hover(function(){a(this).hasClass("ui-state-disabled")||a(this).addClass("ui-state-hover")},function(){a(this).removeClass("ui-state-hover")}),u=null);(b.add||b.edit||b.del||b.view)&&a("tr",t).append("<td class='ui-pg-button ui-state-disabled' style='width:4px;'><span class='ui-separator'></span></td>");b.search&&(u=a("<td class='ui-pg-button ui-corner-all'></td>"),
k=k||{},a(u).append("<div class='ui-pg-div'><span class='ui-icon "+b.searchicon+"'></span>"+b.searchtext+"</div>"),a("tr",t).append(u),a(u,t).attr({title:b.searchtitle||"",id:k.id||"search_"+z}).click(function(){a(this).hasClass("ui-state-disabled")||a(o).jqGrid("searchGrid",k);return false}).hover(function(){a(this).hasClass("ui-state-disabled")||a(this).addClass("ui-state-hover")},function(){a(this).removeClass("ui-state-hover")}),k.showOnLoad&&!0===k.showOnLoad&&a(u,t).click(),u=null);b.refresh&&
(u=a("<td class='ui-pg-button ui-corner-all'></td>"),a(u).append("<div class='ui-pg-div'><span class='ui-icon "+b.refreshicon+"'></span>"+b.refreshtext+"</div>"),a("tr",t).append(u),a(u,t).attr({title:b.refreshtitle||"",id:"refresh_"+z}).click(function(){if(!a(this).hasClass("ui-state-disabled")){a.isFunction(b.beforeRefresh)&&b.beforeRefresh();o.p.search=false;try{var c=o.p.id;o.p.postData.filters="";a("#fbox_"+c).jqFilter("resetFilter");a.isFunction(o.clearToolbar)&&o.clearToolbar(false)}catch(d){}switch(b.refreshstate){case "firstpage":a(o).trigger("reloadGrid",
[{page:1}]);break;case "current":a(o).trigger("reloadGrid",[{current:true}])}a.isFunction(b.afterRefresh)&&b.afterRefresh()}return false}).hover(function(){a(this).hasClass("ui-state-disabled")||a(this).addClass("ui-state-hover")},function(){a(this).removeClass("ui-state-hover")}),u=null);u=a(".ui-jqgrid").css("font-size")||"11px";a("body").append("<div id='testpg2' class='ui-jqgrid ui-widget ui-widget-content' style='font-size:"+u+";visibility:hidden;' ></div>");u=a(t).clone().appendTo("#testpg2").width();
a("#testpg2").remove();a(y+"_"+b.position,y).append(t);o.p._nvtd&&(u>o.p._nvtd[0]&&(a(y+"_"+b.position,y).width(u),o.p._nvtd[0]=u),o.p._nvtd[1]=u);t=u=u=null;this.nav=!0}}}})},navButtonAdd:function(c,b){b=a.extend({caption:"newButton",title:"",buttonicon:"ui-icon-newwin",onClickButton:null,position:"last",cursor:"pointer"},b||{});return this.each(function(){if(this.grid){0!==c.indexOf("#")&&(c="#"+c);var g=a(".navtable",c)[0],e=this;if(g&&!(b.id&&null!==a("#"+b.id,g).html())){var f=a("<td></td>");
"NONE"==b.buttonicon.toString().toUpperCase()?a(f).addClass("ui-pg-button ui-corner-all").append("<div class='ui-pg-div'>"+b.caption+"</div>"):a(f).addClass("ui-pg-button ui-corner-all").append("<div class='ui-pg-div'><span class='ui-icon "+b.buttonicon+"'></span>"+b.caption+"</div>");b.id&&a(f).attr("id",b.id);"first"==b.position?0===g.rows[0].cells.length?a("tr",g).append(f):a("tr td:eq(0)",g).before(f):a("tr",g).append(f);a(f,g).attr("title",b.title||"").click(function(c){a(this).hasClass("ui-state-disabled")||
a.isFunction(b.onClickButton)&&b.onClickButton.call(e,c);return!1}).hover(function(){a(this).hasClass("ui-state-disabled")||a(this).addClass("ui-state-hover")},function(){a(this).removeClass("ui-state-hover")})}}})},navSeparatorAdd:function(c,b){b=a.extend({sepclass:"ui-separator",sepcontent:""},b||{});return this.each(function(){if(this.grid){0!==c.indexOf("#")&&(c="#"+c);var g=a(".navtable",c)[0];if(g){var e="<td class='ui-pg-button ui-state-disabled' style='width:4px;'><span class='"+b.sepclass+
"'></span>"+b.sepcontent+"</td>";a("tr",g).append(e)}}})},GridToForm:function(c,b){return this.each(function(){if(this.grid){var g=a(this).jqGrid("getRowData",c);if(g)for(var e in g)a("[name="+a.jgrid.jqID(e)+"]",b).is("input:radio")||a("[name="+a.jgrid.jqID(e)+"]",b).is("input:checkbox")?a("[name="+a.jgrid.jqID(e)+"]",b).each(function(){a(this).val()==g[e]?a(this).attr("checked","checked"):a(this).attr("checked","")}):a("[name="+a.jgrid.jqID(e)+"]",b).val(g[e])}})},FormToGrid:function(c,b,g,e){return this.each(function(){if(this.grid){g||
(g="set");e||(e="first");var f=a(b).serializeArray(),k={};a.each(f,function(a,b){k[b.name]=b.value});"add"==g?a(this).jqGrid("addRowData",c,k,e):"set"==g&&a(this).jqGrid("setRowData",c,k)}})}})})(m);(function(a){a.fn.jqFilter=function(g){if("string"===typeof g){var c=a.fn.jqFilter[g];if(!c)throw"jqFilter - No such method: "+g;var b=a.makeArray(arguments).slice(1);return c.apply(this,b)}var e=a.extend(!0,{filter:null,columns:[],onChange:null,checkValues:null,error:!1,errmsg:"",errorcheck:!0,showQuery:!0,
sopt:null,ops:[{name:"eq",description:"equal",operator:"="},{name:"ne",description:"not equal",operator:"<>"},{name:"lt",description:"less",operator:"<"},{name:"le",description:"less or equal",operator:"<="},{name:"gt",description:"greater",operator:">"},{name:"ge",description:"greater or equal",operator:">="},{name:"bw",description:"begins with",operator:"LIKE"},{name:"bn",description:"does not begin with",operator:"NOT LIKE"},{name:"in",description:"in",operator:"IN"},{name:"ni",description:"not in",
operator:"NOT IN"},{name:"ew",description:"ends with",operator:"LIKE"},{name:"en",description:"does not end with",operator:"NOT LIKE"},{name:"cn",description:"contains",operator:"LIKE"},{name:"nc",description:"does not contain",operator:"NOT LIKE"},{name:"nu",description:"is null",operator:"IS NULL"},{name:"nn",description:"is not null",operator:"IS NOT NULL"}],numopts:"eq ne lt le gt ge nu nn in ni".split(" "),stropts:"eq ne bw bn ew en cn nc nu nn in ni".split(" "),_gridsopt:[],groupOps:["AND",
"OR"],groupButton:!0},g||{});return this.each(function(){if(!this.filter){this.p=e;if(null===this.p.filter||void 0===this.p.filter)this.p.filter={groupOp:this.p.groupOps[0],rules:[],groups:[]};var b,c=this.p.columns.length,g,d=/msie/i.test(navigator.userAgent)&&!window.opera;if(this.p._gridsopt.length)for(b=0;b<this.p._gridsopt.length;b++)this.p.ops[b].description=this.p._gridsopt[b];this.p.initFilter=a.extend(!0,{},this.p.filter);if(c){for(b=0;b<c;b++)if(g=this.p.columns[b],g.stype?g.inputtype=g.stype:
g.inputtype||(g.inputtype="text"),g.sorttype?g.searchtype=g.sorttype:g.searchtype||(g.searchtype="string"),void 0===g.hidden&&(g.hidden=!1),g.label||(g.label=g.name),g.index&&(g.name=g.index),g.hasOwnProperty("searchoptions")||(g.searchoptions={}),!g.hasOwnProperty("searchrules"))g.searchrules={};this.p.showQuery&&a(this).append("<table class='queryresult ui-widget ui-widget-content' style='display:block;max-width:440px;border:0px none;'><tbody><tr><td class='query'></td></tr></tbody></table>");var m=
function(b,c){var d=[!0,""];if(a.isFunction(c.searchrules))d=c.searchrules(b,c);else if(a.jgrid&&a.jgrid.checkValues)try{d=a.jgrid.checkValues(b,-1,null,c.searchrules,c.label)}catch(f){}d&&(d.length&&!1===d[0])&&(e.error=!d[0],e.errmsg=d[1])};this.onchange=function(){this.p.error=!1;this.p.errmsg="";return a.isFunction(this.p.onChange)?this.p.onChange.call(this,this.p):!1};this.reDraw=function(){a("table.group:first",this).remove();var b=this.createTableForGroup(e.filter,null);a(this).append(b)};
this.createTableForGroup=function(b,c){var d=this,f,g=a("<table class='group ui-widget ui-widget-content' style='border:0px none;'><tbody></tbody></table>");null===c&&a(g).append("<tr class='error' style='display:none;'><th colspan='5' class='ui-state-error' align='left'></th></tr>");var k=a("<tr></tr>");a(g).append(k);var l=a("<th colspan='5' align='left'></th>");k.append(l);var m=a("<select class='opsel'></select>");l.append(m);var k="",q;for(f=0;f<e.groupOps.length;f++)q=b.groupOp===d.p.groupOps[f]?
" selected='selected'":"",k+="<option value='"+d.p.groupOps[f]+"'"+q+">"+d.p.groupOps[f]+"</option>";m.append(k).bind("change",function(){b.groupOp=a(m).val();d.onchange()});k="<span></span>";this.p.groupButton&&(k=a("<input type='button' value='+ {}' title='Add subgroup' class='add-group'/>"),k.bind("click",function(){void 0===b.groups&&(b.groups=[]);b.groups.push({groupOp:e.groupOps[0],rules:[],groups:[]});d.reDraw();d.onchange();return!1}));l.append(k);var k=a("<input type='button' value='+' title='Add rule' class='add-rule ui-add'/>"),
A;k.bind("click",function(){if(b.rules===void 0)b.rules=[];for(f=0;f<d.p.columns.length;f++){var a=typeof d.p.columns[f].search==="undefined"?true:d.p.columns[f].search,c=d.p.columns[f].hidden===true;if(d.p.columns[f].searchoptions.searchhidden===true&&a||a&&!c){A=d.p.columns[f];break}}b.rules.push({field:A.name,op:(A.searchoptions.sopt?A.searchoptions.sopt:d.p.sopt?d.p.sopt:A.searchtype==="string"?d.p.stropts:d.p.numopts)[0],data:""});d.reDraw();return false});l.append(k);null!==c&&(k=a("<input type='button' value='-' title='Delete group' class='delete-group'/>"),
l.append(k),k.bind("click",function(){for(f=0;f<c.groups.length;f++)if(c.groups[f]===b){c.groups.splice(f,1);break}d.reDraw();d.onchange();return false}));if(void 0!==b.groups)for(f=0;f<b.groups.length;f++)l=a("<tr></tr>"),g.append(l),k=a("<td class='first'></td>"),l.append(k),k=a("<td colspan='4'></td>"),k.append(this.createTableForGroup(b.groups[f],b)),l.append(k);void 0===b.groupOp&&(b.groupOp=d.p.groupOps[0]);if(void 0!==b.rules)for(f=0;f<b.rules.length;f++)g.append(this.createTableRowForRule(b.rules[f],
b));return g};this.createTableRowForRule=function(b,c){var f=this,g=a("<tr></tr>"),k,l,m,q,v="",A;g.append("<td class='first'></td>");var B=a("<td class='columns'></td>");g.append(B);var E=a("<select></select>");B.append(E);E.bind("change",function(){b.field=a(E).val();m=a(this).parents("tr:first");for(k=0;k<f.p.columns.length;k++)if(f.p.columns[k].name===b.field){q=f.p.columns[k];break}if(q){q.searchoptions.id=a.jgrid.randId();d&&"text"===q.inputtype&&!q.searchoptions.size&&(q.searchoptions.size=
10);var c=a.jgrid.createEl(q.inputtype,q.searchoptions,"",!0,f.p.ajaxSelectOptions,!0);a(c).addClass("input-elm");l=q.searchoptions.sopt?q.searchoptions.sopt:f.p.sopt?f.p.sopt:"string"===q.searchtype?f.p.stropts:f.p.numopts;var g="",e="";for(k=0;k<f.p.ops.length;k++)-1!==a.inArray(f.p.ops[k].name,l)&&(e=b.op===f.p.ops[k].name?" selected=selected":"",g+="<option value='"+f.p.ops[k].name+"'"+e+">"+f.p.ops[k].description+"</option>");a(".selectopts",m).empty().append(g);a(".data",m).empty().append(c);
a(".input-elm",m).bind("change",function(){b.data=a(this).val();if(a.isArray(b.data))b.data=b.data.join(",");f.onchange()});setTimeout(function(){b.data=a(c).val();f.onchange()},0)}});for(k=B=0;k<f.p.columns.length;k++){A="undefined"===typeof f.p.columns[k].search?!0:f.p.columns[k].search;var F=!0===f.p.columns[k].hidden;if(!0===f.p.columns[k].searchoptions.searchhidden&&A||A&&!F)A="",b.field===f.p.columns[k].name&&(A=" selected='selected'",B=k),v+="<option value='"+f.p.columns[k].name+"'"+A+">"+
f.p.columns[k].label+"</option>"}E.append(v);v=a("<td class='operators'></td>");g.append(v);q=e.columns[B];q.searchoptions.id=a.jgrid.randId();d&&"text"===q.inputtype&&!q.searchoptions.size&&(q.searchoptions.size=10);var B=a.jgrid.createEl(q.inputtype,q.searchoptions,b.data,!0,f.p.ajaxSelectOptions,!0),J=a("<select class='selectopts'></select>");v.append(J);J.bind("change",function(){b.op=a(J).val();m=a(this).parents("tr:first");var c=a(".input-elm",m)[0];if(b.op==="nu"||b.op==="nn"){b.data="";c.value=
"";c.setAttribute("readonly","true");c.setAttribute("disabled","true")}else{c.removeAttribute("readonly");c.removeAttribute("disabled")}f.onchange()});l=q.searchoptions.sopt?q.searchoptions.sopt:f.p.sopt?f.p.sopt:"string"===q.searchtype?e.stropts:f.p.numopts;v="";for(k=0;k<f.p.ops.length;k++)-1!==a.inArray(f.p.ops[k].name,l)&&(A=b.op===f.p.ops[k].name?" selected='selected'":"",v+="<option value='"+f.p.ops[k].name+"'"+A+">"+f.p.ops[k].description+"</option>");J.append(v);v=a("<td class='data'></td>");
g.append(v);v.append(B);a(B).addClass("input-elm").bind("change",function(){b.data=a(this).val();if(a.isArray(b.data))b.data=b.data.join(",");f.onchange()});v=a("<td></td>");g.append(v);B=a("<input type='button' value='-' title='Delete rule' class='delete-rule ui-del'/>");v.append(B);B.bind("click",function(){for(k=0;k<c.rules.length;k++)if(c.rules[k]===b){c.rules.splice(k,1);break}f.reDraw();f.onchange();return false});return g};this.getStringForGroup=function(a){var b="(",c;if(void 0!==a.groups)for(c=
0;c<a.groups.length;c++){1<b.length&&(b+=" "+a.groupOp+" ");try{b+=this.getStringForGroup(a.groups[c])}catch(d){alert(d)}}if(void 0!==a.rules)try{for(c=0;c<a.rules.length;c++)1<b.length&&(b+=" "+a.groupOp+" "),b+=this.getStringForRule(a.rules[c])}catch(f){alert(f)}b+=")";return"()"===b?"":b};this.getStringForRule=function(b){var c="",d="",f,g;for(f=0;f<this.p.ops.length;f++)if(this.p.ops[f].name===b.op){c=this.p.ops[f].operator;d=this.p.ops[f].name;break}for(f=0;f<this.p.columns.length;f++)if(this.p.columns[f].name===
b.field){g=this.p.columns[f];break}f=b.data;if("bw"===d||"bn"===d)f+="%";if("ew"===d||"en"===d)f="%"+f;if("cn"===d||"nc"===d)f="%"+f+"%";if("in"===d||"ni"===d)f=" ("+f+")";e.errorcheck&&m(b.data,g);return-1!==a.inArray(g.searchtype,["int","integer","float","number","currency"])||"nn"===d||"nu"===d?b.field+" "+c+" "+f:b.field+" "+c+' "'+f+'"'};this.resetFilter=function(){this.p.filter=a.extend(!0,{},this.p.initFilter);this.reDraw();this.onchange()};this.hideError=function(){a("th.ui-state-error",this).html("");
a("tr.error",this).hide()};this.showError=function(){a("th.ui-state-error",this).html(this.p.errmsg);a("tr.error",this).show()};this.toUserFriendlyString=function(){return this.getStringForGroup(e.filter)};this.toString=function(){function a(c){var d="(",f;if(void 0!==c.groups)for(f=0;f<c.groups.length;f++)1<d.length&&(d+="OR"===c.groupOp?" || ":" && "),d+=a(c.groups[f]);if(void 0!==c.rules)for(f=0;f<c.rules.length;f++){1<d.length&&(d+="OR"===c.groupOp?" || ":" && ");var g=c.rules[f];if(b.p.errorcheck){for(var e=
void 0,j=void 0,e=0;e<b.p.columns.length;e++)if(b.p.columns[e].name===g.field){j=b.p.columns[e];break}j&&m(g.data,j)}d+=g.op+"(item."+g.field+",'"+g.data+"')"}d+=")";return"()"===d?"":d}var b=this;return a(this.p.filter)};this.reDraw();if(this.p.showQuery)this.onchange();this.filter=!0}}})};a.extend(a.fn.jqFilter,{toSQLString:function(){var a="";this.each(function(){a=this.toUserFriendlyString()});return a},filterData:function(){var a;this.each(function(){a=this.p.filter});return a},getParameter:function(a){return void 0!==
a&&this.p.hasOwnProperty(a)?this.p[a]:this.p},resetFilter:function(){return this.each(function(){this.resetFilter()})},addFilter:function(a){"string"===typeof a&&(a=m.jgrid.parse(a));this.each(function(){this.p.filter=a;this.reDraw();this.onchange()})}})})(m);(function(a){a.jgrid.extend({editRow:function(g,c,b,e,l,f,k,d,m){var o={keys:c||!1,oneditfunc:b||null,successfunc:e||null,url:l||null,extraparam:f||{},aftersavefunc:k||null,errorfunc:d||null,afterrestorefunc:m||null,restoreAfterErorr:!0},r=a.makeArray(arguments).slice(1),
p;p=r[0]&&"object"==typeof r[0]&&!a.isFunction(r[0])?a.extend(o,r[0]):o;return this.each(function(){var b=this,c,d,f=0,e=null,j={},k,l;if(b.grid&&(k=a(b).jqGrid("getInd",g,!0),!1!==k&&"0"==(a(k).attr("editable")||"0")&&!a(k).hasClass("not-editable-row")))l=b.p.colModel,a("td",k).each(function(k){c=l[k].name;var m=!0===b.p.treeGrid&&c==b.p.ExpandColumn;if(m)d=a("span:first",this).html();else try{d=a.unformat(this,{rowId:g,colModel:l[k]},k)}catch(o){d=a(this).html()}if("cb"!=c&&("subgrid"!=c&&"rn"!=
c)&&(b.p.autoencode&&(d=a.jgrid.htmlDecode(d)),j[c]=d,!0===l[k].editable)){null===e&&(e=k);m?a("span:first",this).html(""):a(this).html("");var q=a.extend({},l[k].editoptions||{},{id:g+"_"+c,name:c});l[k].edittype||(l[k].edittype="text");q=a.jgrid.createEl(l[k].edittype,q,d,!0,a.extend({},a.jgrid.ajaxOptions,b.p.ajaxSelectOptions||{}));a(q).addClass("editable");m?a("span:first",this).append(q):a(this).append(q);"select"==l[k].edittype&&!0===l[k].editoptions.multiple&&a.browser.msie&&a(q).width(a(q).width());
f++}}),0<f&&(j.id=g,b.p.savedRow.push(j),a(k).attr("editable","1"),a("td:eq("+e+") input",k).focus(),!0===p.keys&&a(k).bind("keydown",function(c){27===c.keyCode&&a(b).jqGrid("restoreRow",g,m);if(13===c.keyCode){if("TEXTAREA"==c.target.tagName)return!0;a(b).jqGrid("saveRow",g,p);return!1}c.stopPropagation()}),a.isFunction(p.oneditfunc)&&p.oneditfunc.call(b,g))})},saveRow:function(g,c,b,e,l,f,k){var d={successfunc:c||null,url:b||null,extraparam:e||{},aftersavefunc:l||null,errorfunc:f||null,afterrestorefunc:k||
null,restoreAfterErorr:!0},q=a.makeArray(arguments).slice(1),o;o=q[0]&&"object"==typeof q[0]&&!a.isFunction(q[0])?a.extend(d,q[0]):d;var r=!1,p=this[0],u,t={},y={},z={},x,v,A;if(!p.grid)return r;A=a(p).jqGrid("getInd",g,!0);if(!1===A)return r;d=a(A).attr("editable");o.url=o.url?o.url:p.p.editurl;if("1"===d){var B;a("td",A).each(function(b){B=p.p.colModel[b];u=B.name;if("cb"!=u&&"subgrid"!=u&&!0===B.editable&&"rn"!=u&&!a(this).hasClass("not-editable-cell")){switch(B.edittype){case "checkbox":var c=
["Yes","No"];B.editoptions&&(c=B.editoptions.value.split(":"));t[u]=a("input",this).attr("checked")?c[0]:c[1];break;case "text":case "password":case "textarea":case "button":t[u]=a("input, textarea",this).val();break;case "select":if(B.editoptions.multiple){var c=a("select",this),d=[];t[u]=a(c).val();t[u]=t[u]?t[u].join(","):"";a("select > option:selected",this).each(function(b,c){d[b]=a(c).text()});y[u]=d.join(",")}else t[u]=a("select>option:selected",this).val(),y[u]=a("select>option:selected",
this).text();B.formatter&&"select"==B.formatter&&(y={});break;case "custom":try{if(B.editoptions&&a.isFunction(B.editoptions.custom_value)){if(t[u]=B.editoptions.custom_value.call(p,a(".customelement",this),"get"),void 0===t[u])throw"e2";}else throw"e1";}catch(f){"e1"==f&&a.jgrid.info_dialog(m.jgrid.errors.errcap,"function 'custom_value' "+a.jgrid.edit.msg.nodefined,m.jgrid.edit.bClose),"e2"==f?a.jgrid.info_dialog(m.jgrid.errors.errcap,"function 'custom_value' "+a.jgrid.edit.msg.novalue,m.jgrid.edit.bClose):
a.jgrid.info_dialog(m.jgrid.errors.errcap,f.message,m.jgrid.edit.bClose)}}v=a.jgrid.checkValues(t[u],b,p);if(!1===v[0])return v[1]=t[u]+" "+v[1],!1;p.p.autoencode&&(t[u]=a.jgrid.htmlEncode(t[u]));"clientArray"!==o.url&&B.editoptions&&!0===B.editoptions.NullIfEmpty&&""==t[u]&&(z[u]="null")}});if(!1===v[0]){try{var E=a.jgrid.findPos(a("#"+a.jgrid.jqID(g),p.grid.bDiv)[0]);a.jgrid.info_dialog(a.jgrid.errors.errcap,v[1],a.jgrid.edit.bClose,{left:E[0],top:E[1]})}catch(F){alert(v[1])}return r}t&&(d=p.p.prmNames,
q=d.oper,E=d.id,t[q]=d.editoper,t[E]=g,"undefined"==typeof p.p.inlineData&&(p.p.inlineData={}),t=a.extend({},t,p.p.inlineData,o.extraparam));if("clientArray"==o.url){t=a.extend({},t,y);p.p.autoencode&&a.each(t,function(b,c){t[b]=a.jgrid.htmlDecode(c)});E=a(p).jqGrid("setRowData",g,t);a(A).attr("editable","0");for(d=0;d<p.p.savedRow.length;d++)if(p.p.savedRow[d].id==g){x=d;break}0<=x&&p.p.savedRow.splice(x,1);a.isFunction(o.aftersavefunc)&&o.aftersavefunc.call(p,g,E);r=!0}else a("#lui_"+p.p.id).show(),
z=a.extend({},t,z),a.ajax(a.extend({url:o.url,data:a.isFunction(p.p.serializeRowData)?p.p.serializeRowData.call(p,z):z,type:"POST",async:!1,complete:function(b,c){a("#lui_"+p.p.id).hide();if(c==="success")if((a.isFunction(o.succesfunc)?o.succesfunc.call(p,b):true)===true){p.p.autoencode&&a.each(t,function(b,c){t[b]=a.jgrid.htmlDecode(c)});t=a.extend({},t,y);a(p).jqGrid("setRowData",g,t);a(A).attr("editable","0");for(var d=0;d<p.p.savedRow.length;d++)if(p.p.savedRow[d].id==g){x=d;break}x>=0&&p.p.savedRow.splice(x,
1);a.isFunction(o.aftersavefunc)&&o.aftersavefunc.call(p,g,b);r=true}else{a.isFunction(o.errorfunc)&&o.errorfunc.call(p,g,b,c);o.restoreAfterError===true&&a(p).jqGrid("restoreRow",g,o.afterrestorefunc)}},error:function(b,c){a("#lui_"+p.p.id).hide();if(a.isFunction(o.errorfunc))o.errorfunc.call(p,g,b,c);else try{m.jgrid.info_dialog(m.jgrid.errors.errcap,'<div class="ui-state-error">'+b.responseText+"</div>",m.jgrid.edit.bClose,{buttonalign:"right"})}catch(d){alert(b.responseText)}o.restoreAfterError===
true&&a(p).jqGrid("restoreRow",g,o.afterrestorefunc)}},a.jgrid.ajaxOptions,p.p.ajaxRowOptions||{}));a(A).unbind("keydown")}return r},restoreRow:function(g,c){return this.each(function(){var b=this,e,l,f={};if(b.grid&&(l=a(b).jqGrid("getInd",g,!0),!1!==l)){for(var k=0;k<b.p.savedRow.length;k++)if(b.p.savedRow[k].id==g){e=k;break}if(0<=e){if(a.isFunction(a.fn.datepicker))try{a("input.hasDatepicker","#"+a.jgrid.jqID(l.id)).datepicker("hide")}catch(d){}a.each(b.p.colModel,function(){!0===this.editable&&
(this.name in b.p.savedRow[e]&&!a(this).hasClass("not-editable-cell"))&&(f[this.name]=b.p.savedRow[e][this.name])});a(b).jqGrid("setRowData",g,f);a(l).attr("editable","0").unbind("keydown");b.p.savedRow.splice(e,1)}a.isFunction(c)&&c.call(b,g)}})}})})(m);(function(a){a.jgrid.extend({editCell:function(g,c,b){return this.each(function(){var e=this,l,f,k;if(e.grid&&!0===e.p.cellEdit){c=parseInt(c,10);e.p.selrow=e.rows[g].id;e.p.knv||a(e).jqGrid("GridNav");if(0<e.p.savedRow.length){if(!0===b&&g==e.p.iRow&&
c==e.p.iCol)return;a(e).jqGrid("saveCell",e.p.savedRow[0].id,e.p.savedRow[0].ic)}else window.setTimeout(function(){a("#"+e.p.knv).attr("tabindex","-1").focus()},0);l=e.p.colModel[c].name;if(!("subgrid"==l||"cb"==l||"rn"==l)){k=a("td:eq("+c+")",e.rows[g]);if(!0===e.p.colModel[c].editable&&!0===b&&!k.hasClass("not-editable-cell")){0<=parseInt(e.p.iCol,10)&&0<=parseInt(e.p.iRow,10)&&(a("td:eq("+e.p.iCol+")",e.rows[e.p.iRow]).removeClass("edit-cell ui-state-highlight"),a(e.rows[e.p.iRow]).removeClass("selected-row ui-state-hover"));
a(k).addClass("edit-cell ui-state-highlight");a(e.rows[g]).addClass("selected-row ui-state-hover");try{f=a.unformat(k,{rowId:e.rows[g].id,colModel:e.p.colModel[c]},c)}catch(d){f=a(k).html()}e.p.autoencode&&(f=a.jgrid.htmlDecode(f));e.p.colModel[c].edittype||(e.p.colModel[c].edittype="text");e.p.savedRow.push({id:g,ic:c,name:l,v:f});if(a.isFunction(e.p.formatCell)){var m=e.p.formatCell.call(e,e.rows[g].id,l,f,g,c);void 0!==m&&(f=m)}var m=a.extend({},e.p.colModel[c].editoptions||{},{id:g+"_"+l,name:l}),
o=a.jgrid.createEl(e.p.colModel[c].edittype,m,f,!0,a.extend({},a.jgrid.ajaxOptions,e.p.ajaxSelectOptions||{}));a.isFunction(e.p.beforeEditCell)&&e.p.beforeEditCell.call(e,e.rows[g].id,l,f,g,c);a(k).html("").append(o).attr("tabindex","0");window.setTimeout(function(){a(o).focus()},0);a("input, select, textarea",k).bind("keydown",function(b){b.keyCode===27&&(a("input.hasDatepicker",k).length>0?a(".ui-datepicker").is(":hidden")?a(e).jqGrid("restoreCell",g,c):a("input.hasDatepicker",k).datepicker("hide"):
a(e).jqGrid("restoreCell",g,c));b.keyCode===13&&a(e).jqGrid("saveCell",g,c);if(b.keyCode==9){if(e.grid.hDiv.loading)return false;b.shiftKey?a(e).jqGrid("prevCell",g,c):a(e).jqGrid("nextCell",g,c)}b.stopPropagation()});a.isFunction(e.p.afterEditCell)&&e.p.afterEditCell.call(e,e.rows[g].id,l,f,g,c)}else if(0<=parseInt(e.p.iCol,10)&&0<=parseInt(e.p.iRow,10)&&(a("td:eq("+e.p.iCol+")",e.rows[e.p.iRow]).removeClass("edit-cell ui-state-highlight"),a(e.rows[e.p.iRow]).removeClass("selected-row ui-state-hover")),
k.addClass("edit-cell ui-state-highlight"),a(e.rows[g]).addClass("selected-row ui-state-hover"),a.isFunction(e.p.onSelectCell))f=k.html().replace(/\&#160\;/ig,""),e.p.onSelectCell.call(e,e.rows[g].id,l,f,g,c);e.p.iCol=c;e.p.iRow=g}}})},saveCell:function(e,c){return this.each(function(){var b=this,j;if(b.grid&&!0===b.p.cellEdit){j=1<=b.p.savedRow.length?0:null;if(null!==j){var l=a("td:eq("+c+")",b.rows[e]),f,k,d=b.p.colModel[c],q=d.name,o=a.jgrid.jqID(q);switch(d.edittype){case "select":if(d.editoptions.multiple){var o=
a("#"+e+"_"+o,b.rows[e]),r=[];(f=a(o).val())?f.join(","):f="";a("option:selected",o).each(function(b,c){r[b]=a(c).text()});k=r.join(",")}else f=a("#"+e+"_"+o+">option:selected",b.rows[e]).val(),k=a("#"+e+"_"+o+">option:selected",b.rows[e]).text();d.formatter&&(k=f);break;case "checkbox":var p=["Yes","No"];d.editoptions&&(p=d.editoptions.value.split(":"));k=f=a("#"+e+"_"+o,b.rows[e]).attr("checked")?p[0]:p[1];break;case "password":case "text":case "textarea":case "button":k=f=a("#"+e+"_"+o,b.rows[e]).val();
break;case "custom":try{if(d.editoptions&&a.isFunction(d.editoptions.custom_value)){f=d.editoptions.custom_value.call(b,a(".customelement",l),"get");if(void 0===f)throw"e2";k=f}else throw"e1";}catch(u){"e1"==u&&a.jgrid.info_dialog(m.jgrid.errors.errcap,"function 'custom_value' "+a.jgrid.edit.msg.nodefined,m.jgrid.edit.bClose),"e2"==u?a.jgrid.info_dialog(m.jgrid.errors.errcap,"function 'custom_value' "+a.jgrid.edit.msg.novalue,m.jgrid.edit.bClose):a.jgrid.info_dialog(m.jgrid.errors.errcap,u.message,
m.jgrid.edit.bClose)}}if(k!=b.p.savedRow[j].v){if(a.isFunction(b.p.beforeSaveCell)&&(j=b.p.beforeSaveCell.call(b,b.rows[e].id,q,f,e,c)))k=f=j;var t=a.jgrid.checkValues(f,c,b);if(!0===t[0]){j={};a.isFunction(b.p.beforeSubmitCell)&&((j=b.p.beforeSubmitCell.call(b,b.rows[e].id,q,f,e,c))||(j={}));0<a("input.hasDatepicker",l).length&&a("input.hasDatepicker",l).datepicker("hide");if("remote"==b.p.cellsubmit)if(b.p.cellurl){var y={};b.p.autoencode&&(f=a.jgrid.htmlEncode(f));y[q]=f;p=b.p.prmNames;d=p.id;
o=p.oper;y[d]=b.rows[e].id;y[o]=p.editoper;y=a.extend(j,y);a("#lui_"+b.p.id).show();b.grid.hDiv.loading=!0;a.ajax(a.extend({url:b.p.cellurl,data:a.isFunction(b.p.serializeCellData)?b.p.serializeCellData.call(b,y):y,type:"POST",complete:function(d,j){a("#lui_"+b.p.id).hide();b.grid.hDiv.loading=!1;if("success"==j)if(a.isFunction(b.p.afterSubmitCell)){var m=b.p.afterSubmitCell.call(b,d,y.id,q,f,e,c);!0===m[0]?(a(l).empty(),a(b).jqGrid("setCell",b.rows[e].id,c,k,!1,!1,!0),a(l).addClass("dirty-cell"),
a(b.rows[e]).addClass("edited"),a.isFunction(b.p.afterSaveCell)&&b.p.afterSaveCell.call(b,b.rows[e].id,q,f,e,c),b.p.savedRow.splice(0,1)):(a.jgrid.info_dialog(a.jgrid.errors.errcap,m[1],a.jgrid.edit.bClose),a(b).jqGrid("restoreCell",e,c))}else a(l).empty(),a(b).jqGrid("setCell",b.rows[e].id,c,k,!1,!1,!0),a(l).addClass("dirty-cell"),a(b.rows[e]).addClass("edited"),a.isFunction(b.p.afterSaveCell)&&b.p.afterSaveCell.call(b,b.rows[e].id,q,f,e,c),b.p.savedRow.splice(0,1)},error:function(d,f){a("#lui_"+
b.p.id).hide();b.grid.hDiv.loading=!1;a.isFunction(b.p.errorCell)?b.p.errorCell.call(b,d,f):a.jgrid.info_dialog(a.jgrid.errors.errcap,d.status+" : "+d.statusText+"<br/>"+f,a.jgrid.edit.bClose);a(b).jqGrid("restoreCell",e,c)}},a.jgrid.ajaxOptions,b.p.ajaxCellOptions||{}))}else try{a.jgrid.info_dialog(a.jgrid.errors.errcap,a.jgrid.errors.nourl,a.jgrid.edit.bClose),a(b).jqGrid("restoreCell",e,c)}catch(z){}"clientArray"==b.p.cellsubmit&&(a(l).empty(),a(b).jqGrid("setCell",b.rows[e].id,c,k,!1,!1,!0),a(l).addClass("dirty-cell"),
a(b.rows[e]).addClass("edited"),a.isFunction(b.p.afterSaveCell)&&b.p.afterSaveCell.call(b,b.rows[e].id,q,f,e,c),b.p.savedRow.splice(0,1))}else try{window.setTimeout(function(){a.jgrid.info_dialog(a.jgrid.errors.errcap,f+" "+t[1],a.jgrid.edit.bClose)},100),a(b).jqGrid("restoreCell",e,c)}catch(x){}}else a(b).jqGrid("restoreCell",e,c)}a.browser.opera?a("#"+b.p.knv).attr("tabindex","-1").focus():window.setTimeout(function(){a("#"+b.p.knv).attr("tabindex","-1").focus()},0)}})},restoreCell:function(e,c){return this.each(function(){var b=
this,j;if(b.grid&&!0===b.p.cellEdit){j=1<=b.p.savedRow.length?0:null;if(null!==j){var l=a("td:eq("+c+")",b.rows[e]);if(a.isFunction(a.fn.datepicker))try{a("input.hasDatepicker",l).datepicker("hide")}catch(f){}a(l).empty().attr("tabindex","-1");a(b).jqGrid("setCell",b.rows[e].id,c,b.p.savedRow[j].v,!1,!1,!0);a.isFunction(b.p.afterRestoreCell)&&b.p.afterRestoreCell.call(b,b.rows[e].id,b.p.savedRow[j].v,e,c);b.p.savedRow.splice(0,1)}window.setTimeout(function(){a("#"+b.p.knv).attr("tabindex","-1").focus()},
0)}})},nextCell:function(e,c){return this.each(function(){var b=!1;if(this.grid&&!0===this.p.cellEdit){for(var j=c+1;j<this.p.colModel.length;j++)if(!0===this.p.colModel[j].editable){b=j;break}!1!==b?a(this).jqGrid("editCell",e,b,!0):0<this.p.savedRow.length&&a(this).jqGrid("saveCell",e,c)}})},prevCell:function(e,c){return this.each(function(){var b=!1;if(this.grid&&!0===this.p.cellEdit){for(var j=c-1;0<=j;j--)if(!0===this.p.colModel[j].editable){b=j;break}!1!==b?a(this).jqGrid("editCell",e,b,!0):
0<this.p.savedRow.length&&a(this).jqGrid("saveCell",e,c)}})},GridNav:function(){return this.each(function(){function e(c,d,f){if("v"==f.substr(0,1)){var g=a(b.grid.bDiv)[0].clientHeight,j=a(b.grid.bDiv)[0].scrollTop,l=b.rows[c].offsetTop+b.rows[c].clientHeight,m=b.rows[c].offsetTop;"vd"==f&&l>=g&&(a(b.grid.bDiv)[0].scrollTop=a(b.grid.bDiv)[0].scrollTop+b.rows[c].clientHeight);"vu"==f&&m<j&&(a(b.grid.bDiv)[0].scrollTop=a(b.grid.bDiv)[0].scrollTop-b.rows[c].clientHeight)}"h"==f&&(f=a(b.grid.bDiv)[0].clientWidth,
g=a(b.grid.bDiv)[0].scrollLeft,j=b.rows[c].cells[d].offsetLeft,b.rows[c].cells[d].offsetLeft+b.rows[c].cells[d].clientWidth>=f+parseInt(g,10)?a(b.grid.bDiv)[0].scrollLeft=a(b.grid.bDiv)[0].scrollLeft+b.rows[c].cells[d].clientWidth:j<g&&(a(b.grid.bDiv)[0].scrollLeft=a(b.grid.bDiv)[0].scrollLeft-b.rows[c].cells[d].clientWidth))}function c(a,c){var f,e;if("lft"==c){f=a+1;for(e=a;0<=e;e--)if(!0!==b.p.colModel[e].hidden){f=e;break}}if("rgt"==c){f=a-1;for(e=a;e<b.p.colModel.length;e++)if(!0!==b.p.colModel[e].hidden){f=
e;break}}return f}var b=this;if(b.grid&&!0===b.p.cellEdit){b.p.knv=b.p.id+"_kn";var j=a("<span style='width:0px;height:0px;background-color:black;' tabindex='0'><span tabindex='-1' style='width:0px;height:0px;background-color:grey' id='"+b.p.knv+"'></span></span>"),l,f;a(j).insertBefore(b.grid.cDiv);a("#"+b.p.knv).focus().keydown(function(j){f=j.keyCode;"rtl"==b.p.direction&&(37==f?f=39:39==f&&(f=37));switch(f){case 38:0<b.p.iRow-1&&(e(b.p.iRow-1,b.p.iCol,"vu"),a(b).jqGrid("editCell",b.p.iRow-1,b.p.iCol,
!1));break;case 40:b.p.iRow+1<=b.rows.length-1&&(e(b.p.iRow+1,b.p.iCol,"vd"),a(b).jqGrid("editCell",b.p.iRow+1,b.p.iCol,!1));break;case 37:0<=b.p.iCol-1&&(l=c(b.p.iCol-1,"lft"),e(b.p.iRow,l,"h"),a(b).jqGrid("editCell",b.p.iRow,l,!1));break;case 39:b.p.iCol+1<=b.p.colModel.length-1&&(l=c(b.p.iCol+1,"rgt"),e(b.p.iRow,l,"h"),a(b).jqGrid("editCell",b.p.iRow,l,!1));break;case 13:0<=parseInt(b.p.iCol,10)&&0<=parseInt(b.p.iRow,10)&&a(b).jqGrid("editCell",b.p.iRow,b.p.iCol,!0)}return!1})}})},getChangedCells:function(e){var c=
[];e||(e="all");this.each(function(){var b=this,j;!b.grid||!0!==b.p.cellEdit||a(b.rows).each(function(l){var f={};a(this).hasClass("edited")&&(a("td",this).each(function(c){j=b.p.colModel[c].name;if("cb"!==j&&"subgrid"!==j)if("dirty"==e){if(a(this).hasClass("dirty-cell"))try{f[j]=a.unformat(this,{rowId:b.rows[l].id,colModel:b.p.colModel[c]},c)}catch(d){f[j]=a.jgrid.htmlDecode(a(this).html())}}else try{f[j]=a.unformat(this,{rowId:b.rows[l].id,colModel:b.p.colModel[c]},c)}catch(m){f[j]=a.jgrid.htmlDecode(a(this).html())}}),
f.id=this.id,c.push(f))})});return c}})})(m);(function(a){a.fn.jqm=function(b){var d={overlay:50,closeoverlay:!0,overlayClass:"jqmOverlay",closeClass:"jqmClose",trigger:".jqModal",ajax:l,ajaxText:"",target:l,modal:l,toTop:l,onShow:l,onHide:l,onLoad:l};return this.each(function(){if(this._jqm)return c[this._jqm].c=a.extend({},c[this._jqm].c,b);e++;this._jqm=e;c[e]={c:a.extend(d,a.jqm.params,b),a:l,w:a(this).addClass("jqmID"+e),s:e};d.trigger&&a(this).jqmAddTrigger(d.trigger)})};a.fn.jqmAddClose=function(a){return o(this,
a,"jqmHide")};a.fn.jqmAddTrigger=function(a){return o(this,a,"jqmShow")};a.fn.jqmShow=function(b){return this.each(function(){a.jqm.open(this._jqm,b)})};a.fn.jqmHide=function(b){return this.each(function(){a.jqm.close(this._jqm,b)})};a.jqm={hash:{},open:function(e,g){var k=c[e],m=k.c,o="."+m.closeClass,q=parseInt(k.w.css("z-index")),q=0<q?q:3E3,x=a("<div></div>").css({height:"100%",width:"100%",position:"fixed",left:0,top:0,"z-index":q-1,opacity:m.overlay/100});if(k.a)return l;k.t=g;k.a=!0;k.w.css("z-index",
q);m.modal?(b[0]||setTimeout(function(){d("bind")},1),b.push(e)):0<m.overlay?m.closeoverlay&&k.w.jqmAddClose(x):x=l;k.o=x?x.addClass(m.overlayClass).prependTo("body"):l;if(j&&(a("html,body").css({height:"100%",width:"100%"}),x)){var x=x.css({position:"absolute"})[0],v;for(v in{Top:1,Left:1})x.style.setExpression(v.toLowerCase(),"(_=(document.documentElement.scroll"+v+" || document.body.scroll"+v+"))+'px'")}m.ajax?(q=m.target||k.w,x=m.ajax,q="string"==typeof q?a(q,k.w):a(q),x="@"==x.substr(0,1)?a(g).attr(x.substring(1)):
x,q.html(m.ajaxText).load(x,function(){m.onLoad&&m.onLoad.call(this,k);o&&k.w.jqmAddClose(a(o,k.w));f(k)})):o&&k.w.jqmAddClose(a(o,k.w));m.toTop&&k.o&&k.w.before('<span id="jqmP'+k.w[0]._jqm+'"></span>').insertAfter(k.o);m.onShow?m.onShow(k):k.w.show();f(k);return l},close:function(f){f=c[f];if(!f.a)return l;f.a=l;b[0]&&(b.pop(),b[0]||d("unbind"));f.c.toTop&&f.o&&a("#jqmP"+f.w[0]._jqm).after(f.w).remove();if(f.c.onHide)f.c.onHide(f);else f.w.hide(),f.o&&f.o.remove();return l},params:{}};var e=0,c=
a.jqm.hash,b=[],j=a.browser.msie&&"6.0"==a.browser.version,l=!1,f=function(b){var c=a('<iframe src="javascript:false;document.write(\'\');" class="jqm"></iframe>').css({opacity:0});j&&(b.o?b.o.html('<p style="width:100%;height:100%"/>').prepend(c):a("iframe.jqm",b.w)[0]||b.w.prepend(c));k(b)},k=function(b){try{a(":input:visible",b.w)[0].focus()}catch(c){}},d=function(b){a(document)[b]("keypress",m)[b]("keydown",m)[b]("mousedown",m)},m=function(d){var f=c[b[b.length-1]];(d=!a(d.target).parents(".jqmID"+
f.s)[0])&&k(f);return!d},o=function(b,d,f){return b.each(function(){var b=this._jqm;a(d).each(function(){this[f]||(this[f]=[],a(this).click(function(){for(var a in{jqmShow:1,jqmHide:1})for(var b in this[a])if(c[this[a][b]])c[this[a][b]].w[a](this);return l}));this[f].push(b)})})}})(m);(function(a){a.fn.jqDrag=function(a){return l(this,a,"d")};a.fn.jqResize=function(a,b){return l(this,a,"r",b)};a.jqDnR={dnr:{},e:0,drag:function(a){"d"==c.k?b.css({left:c.X+a.pageX-c.pX,top:c.Y+a.pageY-c.pY}):(b.css({width:Math.max(a.pageX-
c.pX+c.W,0),height:Math.max(a.pageY-c.pY+c.H,0)}),M1&&j.css({width:Math.max(a.pageX-M1.pX+M1.W,0),height:Math.max(a.pageY-M1.pY+M1.H,0)}));return!1},stop:function(){a(document).unbind("mousemove",e.drag).unbind("mouseup",e.stop)}};var e=a.jqDnR,c=e.dnr,b=e.e,j,l=function(e,d,g,l){return e.each(function(){d=d?a(d,e):e;d.bind("mousedown",{e:e,k:g},function(d){var e=d.data,g={};b=e.e;j=l?a(l):!1;if("relative"!=b.css("position"))try{b.position(g)}catch(k){}c={X:g.left||f("left")||0,Y:g.top||f("top")||
0,W:f("width")||b[0].scrollWidth||0,H:f("height")||b[0].scrollHeight||0,pX:d.pageX,pY:d.pageY,k:e.k};M1=j&&"d"!=e.k?{X:g.left||f1("left")||0,Y:g.top||f1("top")||0,W:j[0].offsetWidth||f1("width")||0,H:j[0].offsetHeight||f1("height")||0,pX:d.pageX,pY:d.pageY,k:e.k}:!1;if(a("input.hasDatepicker",b[0])[0])try{a("input.hasDatepicker",b[0]).datepicker("hide")}catch(m){}a(document).mousemove(a.jqDnR.drag).mouseup(a.jqDnR.stop);return!1})})},f=function(a){return parseInt(b.css(a))||!1};f1=function(a){return parseInt(j.css(a))||
!1}})(m);(function(a){a.jgrid.extend({setSubGrid:function(){return this.each(function(){var e;this.p.subGridOptions=a.extend({plusicon:"ui-icon-plus",minusicon:"ui-icon-minus",openicon:"ui-icon-carat-1-sw",expandOnLoad:!1,delayOnLoad:50,selectOnExpand:!1,reloadOnExpand:!0},this.p.subGridOptions||{});this.p.colNames.unshift("");this.p.colModel.unshift({name:"subgrid",width:a.browser.safari?this.p.subGridWidth+this.p.cellLayout:this.p.subGridWidth,sortable:!1,resizable:!1,hidedlg:!0,search:!1,fixed:!0});
e=this.p.subGridModel;if(e[0]){e[0].align=a.extend([],e[0].align||[]);for(var c=0;c<e[0].name.length;c++)e[0].align[c]=e[0].align[c]||"left"}})},addSubGridCell:function(a,c){var b="",e,l;this.each(function(){b=this.formatCol(a,c);l=this.p.id;e=this.p.subGridOptions.plusicon});return'<td role="grid" aria-describedby="'+l+'_subgrid" class="ui-sgcollapsed sgcollapsed" '+b+"><a href='javascript:void(0);'><span class='ui-icon "+e+"'></span></a></td>"},addSubGrid:function(e){return this.each(function(){var c=
this;if(c.grid){var b=function(b,d,f){d=a("<td align='"+c.p.subGridModel[0].align[f]+"'></td>").html(d);a(b).append(d)},j=function(d,f){var e,g,j,k=a("<table cellspacing='0' cellpadding='0' border='0'><tbody></tbody></table>"),l=a("<tr></tr>");for(g=0;g<c.p.subGridModel[0].name.length;g++)e=a("<th class='ui-state-default ui-th-subgrid ui-th-column ui-th-"+c.p.direction+"'></th>"),a(e).html(c.p.subGridModel[0].name[g]),a(e).width(c.p.subGridModel[0].width[g]),a(l).append(e);a(k).append(l);d&&(j=c.p.xmlReader.subgrid,
a(j.root+" "+j.row,d).each(function(){l=a("<tr class='ui-widget-content ui-subtblcell'></tr>");if(!0===j.repeatitems)a(j.cell,this).each(function(c){b(l,a(this).text()||"&#160;",c)});else{var d=c.p.subGridModel[0].mapping||c.p.subGridModel[0].name;if(d)for(g=0;g<d.length;g++)b(l,a(d[g],this).text()||"&#160;",g)}a(k).append(l)}));e=a("table:first",c.grid.bDiv).attr("id")+"_";a("#"+e+f).append(k);c.grid.hDiv.loading=!1;a("#load_"+c.p.id).hide();return!1},l=function(d,f){var e,g,j,k,l,m=a("<table cellspacing='0' cellpadding='0' border='0'><tbody></tbody></table>"),
o=a("<tr></tr>");for(g=0;g<c.p.subGridModel[0].name.length;g++)e=a("<th class='ui-state-default ui-th-subgrid ui-th-column ui-th-"+c.p.direction+"'></th>"),a(e).html(c.p.subGridModel[0].name[g]),a(e).width(c.p.subGridModel[0].width[g]),a(o).append(e);a(m).append(o);if(d&&(k=c.p.jsonReader.subgrid,e=d[k.root],"undefined"!==typeof e))for(g=0;g<e.length;g++){j=e[g];o=a("<tr class='ui-widget-content ui-subtblcell'></tr>");if(!0===k.repeatitems){k.cell&&(j=j[k.cell]);for(l=0;l<j.length;l++)b(o,j[l]||"&#160;",
l)}else{var q=c.p.subGridModel[0].mapping||c.p.subGridModel[0].name;if(q.length)for(l=0;l<q.length;l++)b(o,j[q[l]]||"&#160;",l)}a(m).append(o)}g=a("table:first",c.grid.bDiv).attr("id")+"_";a("#"+g+f).append(m);c.grid.hDiv.loading=!1;a("#load_"+c.p.id).hide();return!1},f=function(b){var d,f,e,g;d=a(b).attr("id");f={nd_:(new Date).getTime()};f[c.p.prmNames.subgridid]=d;if(!c.p.subGridModel[0])return!1;if(c.p.subGridModel[0].params)for(g=0;g<c.p.subGridModel[0].params.length;g++)for(e=0;e<c.p.colModel.length;e++)c.p.colModel[e].name==
c.p.subGridModel[0].params[g]&&(f[c.p.colModel[e].name]=a("td:eq("+e+")",b).text().replace(/\&#160\;/ig,""));if(!c.grid.hDiv.loading)switch(c.grid.hDiv.loading=!0,a("#load_"+c.p.id).show(),c.p.subgridtype||(c.p.subgridtype=c.p.datatype),a.isFunction(c.p.subgridtype)?c.p.subgridtype.call(c,f):c.p.subgridtype=c.p.subgridtype.toLowerCase(),c.p.subgridtype){case "xml":case "json":a.ajax(a.extend({type:c.p.mtype,url:c.p.subGridUrl,dataType:c.p.subgridtype,data:a.isFunction(c.p.serializeSubGridData)?c.p.serializeSubGridData.call(c,
f):f,complete:function(b){c.p.subgridtype=="xml"?j(b.responseXML,d):l(a.jgrid.parse(b.responseText),d)}},a.jgrid.ajaxOptions,c.p.ajaxSubgridOptions||{}))}return!1},k,d,m,o=0,r,p;a.each(c.p.colModel,function(){(!0===this.hidden||"rn"==this.name||"cb"==this.name)&&o++});a(c.rows).each(function(b){var j=this;a(j).hasClass("jqgrow")&&(a(this.cells[e]).bind("click",function(){p=j.nextSibling;if(a(this).hasClass("sgcollapsed")){d=c.p.id;k=j.id;if(!0===c.p.subGridOptions.reloadOnExpand||!1===c.p.subGridOptions.reloadOnExpand&&
!a(p).hasClass("ui-subgrid")){m=1<=e?"<td colspan='"+e+"'>&#160;</td>":"";r=!0;a.isFunction(c.p.subGridBeforeExpand)&&(r=c.p.subGridBeforeExpand.call(c,d+"_"+k,k));if(!1===r)return!1;a(j).after("<tr role='row' class='ui-subgrid'>"+m+"<td class='ui-widget-content subgrid-cell'><span class='ui-icon "+c.p.subGridOptions.openicon+"'></span></td><td colspan='"+parseInt(c.p.colNames.length-1-o,10)+"' class='ui-widget-content subgrid-data'><div id="+d+"_"+k+" class='tablediv'></div></td></tr>");a.isFunction(c.p.subGridRowExpanded)?
c.p.subGridRowExpanded.call(c,d+"_"+k,k):f(j)}else a(p).show();a(this).html("<a href='javascript:void(0);'><span class='ui-icon "+c.p.subGridOptions.minusicon+"'></span></a>").removeClass("sgcollapsed").addClass("sgexpanded");c.p.subGridOptions.selectOnExpand&&a(c).jqGrid("setSelection",k)}else if(a(this).hasClass("sgexpanded")){r=!0;a.isFunction(c.p.subGridRowColapsed)&&(k=j.id,r=c.p.subGridRowColapsed.call(c,d+"_"+k,k));if(!1===r)return!1;!0===c.p.subGridOptions.reloadOnExpand?a(p).remove(".ui-subgrid"):
a(p).hasClass("ui-subgrid")&&a(p).hide();a(this).html("<a href='javascript:void(0);'><span class='ui-icon "+c.p.subGridOptions.plusicon+"'></span></a>").removeClass("sgexpanded").addClass("sgcollapsed")}return!1}),!0===c.p.subGridOptions.expandOnLoad&&setTimeout(function(){a(j.cells[e]).trigger("click")},b*c.p.subGridOptions.delayOnLoad))});c.subGridXml=function(a,b){j(a,b)};c.subGridJson=function(a,b){l(a,b)}}})},expandSubGridRow:function(e){return this.each(function(){if((this.grid||e)&&!0===this.p.subGrid){var c=
a(this).jqGrid("getInd",e,!0);c&&(c=a("td.sgcollapsed",c)[0])&&a(c).trigger("click")}})},collapseSubGridRow:function(e){return this.each(function(){if((this.grid||e)&&!0===this.p.subGrid){var c=a(this).jqGrid("getInd",e,!0);c&&(c=a("td.sgexpanded",c)[0])&&a(c).trigger("click")}})},toggleSubGridRow:function(e){return this.each(function(){if((this.grid||e)&&!0===this.p.subGrid){var c=a(this).jqGrid("getInd",e,!0);if(c){var b=a("td.sgcollapsed",c)[0];b?a(b).trigger("click"):(b=a("td.sgexpanded",c)[0])&&
a(b).trigger("click")}}})}})})(m);(function(a){a.jgrid.extend({groupingSetup:function(){return this.each(function(){var e=this.p.groupingView;if(null!==e&&("object"===typeof e||a.isFunction(e)))if(e.groupField.length){"undefined"==typeof e.visibiltyOnNextGrouping&&(e.visibiltyOnNextGrouping=[]);for(var c=0;c<e.groupField.length;c++)if(e.groupOrder[c]||(e.groupOrder[c]="asc"),e.groupText[c]||(e.groupText[c]="{0}"),"boolean"!=typeof e.groupColumnShow[c]&&(e.groupColumnShow[c]=!0),"boolean"!=typeof e.groupSummary[c]&&
(e.groupSummary[c]=!1),!0===e.groupColumnShow[c]?(e.visibiltyOnNextGrouping[c]=!0,a(this).jqGrid("showCol",e.groupField[c])):(e.visibiltyOnNextGrouping[c]=a("#"+this.p.id+"_"+e.groupField[c]).is(":visible"),a(this).jqGrid("hideCol",e.groupField[c])),e.sortitems[c]=[],e.sortnames[c]=[],e.summaryval[c]=[],e.groupSummary[c]){e.summary[c]=[];for(var b=this.p.colModel,j=0,l=b.length;j<l;j++)b[j].summaryType&&e.summary[c].push({nm:b[j].name,st:b[j].summaryType,v:""})}this.p.scroll=!1;this.p.rownumbers=
!1;this.p.subGrid=!1;this.p.treeGrid=!1;this.p.gridview=!0}else this.p.grouping=!1;else this.p.grouping=!1})},groupingPrepare:function(e,c,b,j){this.each(function(){c[0]+="";var l=c[0].toString().split(" ").join(""),f=this.p.groupingView,k=this;b.hasOwnProperty(l)?b[l].push(e):(b[l]=[],b[l].push(e),f.sortitems[0].push(l),f.sortnames[0].push(a.trim(c[0].toString())),f.summaryval[0][l]=a.extend(!0,[],f.summary[0]));f.groupSummary[0]&&a.each(f.summaryval[0][l],function(){this.v=a.isFunction(this.st)?
this.st.call(k,this.v,this.nm,j):a(k).jqGrid("groupingCalculations."+this.st,this.v,this.nm,j)})});return b},groupingToggle:function(e){this.each(function(){var c=this.p.groupingView,b=e.lastIndexOf("_"),j=e.substring(0,b+1),b=parseInt(e.substring(b+1),10)+1,l=c.minusicon,f=c.plusicon,k=a("#"+e)[0].nextSibling,d=a("#"+e+" span.tree-wrap-"+this.p.direction),m=!1;if(d.hasClass(l)){if(c.showSummaryOnHide&&c.groupSummary[0]){if(k)for(;k&&!a(k).hasClass("jqfoot");)a(k).hide(),k=k.nextSibling}else if(k)for(;k&&
a(k).attr("id")!=j+(""+b);)a(k).hide(),k=k.nextSibling;d.removeClass(l).addClass(f);m=!0}else{if(k)for(;k&&a(k).attr("id")!=j+(""+b);)a(k).show(),k=k.nextSibling;d.removeClass(f).addClass(l);m=!1}a.isFunction(this.p.onClickGroup)&&this.p.onClickGroup.call(this,e,m)});return!1},groupingRender:function(e,c){return this.each(function(){var b=this,j=b.p.groupingView,l="",f="",k,d="",m,o,r;j.groupDataSorted||(j.sortitems[0].sort(),j.sortnames[0].sort(),"desc"==j.groupOrder[0].toLowerCase()&&(j.sortitems[0].reverse(),
j.sortnames[0].reverse()));d=j.groupCollapse?j.plusicon:j.minusicon;d+=" tree-wrap-"+b.p.direction;for(r=0;r<c;){if(b.p.colModel[r].name==j.groupField[0]){o=r;break}r++}a.each(j.sortitems[0],function(p,r){k=b.p.id+"ghead_"+p;f="<span style='cursor:pointer;' class='ui-icon "+d+"' onclick=\"jQuery('#"+b.p.id+"').jqGrid('groupingToggle','"+k+"');return false;\"></span>";try{m=b.formatter(k,j.sortnames[0][p],o,j.sortitems[0])}catch(t){m=j.sortnames[0][p]}l=l+('<tr id="'+k+'" role="row" class= "ui-widget-content jqgroup ui-row-'+
b.p.direction+'"><td colspan="'+c+'">'+f+a.jgrid.format(j.groupText[0],m,e[r].length)+"</td></tr>");for(var y=0;y<e[r].length;y++)l=l+e[r][y].join("");if(j.groupSummary[0]){y="";j.groupCollapse&&!j.showSummaryOnHide&&(y=' style="display:none;"');l=l+("<tr"+y+' role="row" class="ui-widget-content jqfoot ui-row-'+b.p.direction+'">');for(var y=j.summaryval[0][r],z=b.p.colModel,x,v=e[r].length,A=0;A<c;A++){var B="<td "+b.formatCol(A,1,"")+">&#160;</td>",E="{0}";a.each(y,function(){if(this.nm==z[A].name){if(z[A].summaryTpl)E=
z[A].summaryTpl;if(this.st=="avg"&&this.v&&v>0)this.v=this.v/v;try{x=b.formatter("",this.v,A,this)}catch(c){x=this.v}B="<td "+b.formatCol(A,1,"")+">"+a.jgrid.format(E,x)+"</td>";return false}});l=l+B}l=l+"</tr>"}});a("#"+b.p.id+" tbody:first").append(l);l=null})},groupingGroupBy:function(e,c){return this.each(function(){"string"==typeof e&&(e=[e]);var b=this.p.groupingView;this.p.grouping=!0;for(var j=0;j<b.groupField.length;j++)!b.groupColumnShow[j]&&b.visibiltyOnNextGrouping[j]&&a(this).jqGrid("showCol",
b.groupField[j]);for(j=0;j<e.length;j++)b.visibiltyOnNextGrouping[j]=a("#"+this.p.id+"_"+e[j]).is(":visible");this.p.groupingView=a.extend(this.p.groupingView,c||{});b.groupField=e;a(this).trigger("reloadGrid")})},groupingRemove:function(e){return this.each(function(){"undefined"==typeof e&&(e=!0);this.p.grouping=!1;if(!0===e){for(var c=this.p.groupingView,b=0;b<c.groupField.length;b++)!c.groupColumnShow[b]&&c.visibiltyOnNextGrouping[b]&&a(this).jqGrid("showCol",c.groupField);a("tr.jqgroup, tr.jqfoot",
"#"+this.p.id+" tbody:first").remove();a("tr.jqgrow:hidden","#"+this.p.id+" tbody:first").show()}else a(this).trigger("reloadGrid")})},groupingCalculations:{sum:function(a,c,b){return parseFloat(a||0)+parseFloat(b[c]||0)},min:function(a,c,b){return""===a?parseFloat(b[c]||0):Math.min(parseFloat(a),parseFloat(b[c]||0))},max:function(a,c,b){return""===a?parseFloat(b[c]||0):Math.max(parseFloat(a),parseFloat(b[c]||0))},count:function(a,c,b){""===a&&(a=0);return b.hasOwnProperty(c)?a+1:0},avg:function(a,
c,b){return parseFloat(a||0)+parseFloat(b[c]||0)}}})})(m);(function(a){a.jgrid.extend({setTreeNode:function(e,c){return this.each(function(){var b=this;if(b.grid&&b.p.treeGrid)for(var j=b.p.expColInd,l=b.p.treeReader.expanded_field,f=b.p.treeReader.leaf_field,k=b.p.treeReader.level_field,d=b.p.treeReader.icon_field,m=b.p.treeReader.loaded,o,r,p,u;e<c;)u=b.p.data[b.p._index[b.rows[e].id]],"nested"==b.p.treeGridModel&&!u[f]&&(o=parseInt(u[b.p.treeReader.left_field],10),r=parseInt(u[b.p.treeReader.right_field],
10),u[f]=r===o+1?"true":"false",b.rows[e].cells[b.p._treeleafpos].innerHTML=u[f]),o=parseInt(u[k],10),0===b.p.tree_root_level?(p=o+1,r=o):(p=o,r=o-1),p="<div class='tree-wrap tree-wrap-"+b.p.direction+"' style='width:"+18*p+"px;'>",p+="<div style='"+("rtl"==b.p.direction?"right:":"left:")+18*r+"px;' class='ui-icon ",void 0!==u[m]&&(u[m]="true"==u[m]||!0===u[m]?!0:!1),"true"==u[f]||!0===u[f]?(p+=(void 0!==u[d]&&""!==u[d]?u[d]:b.p.treeIcons.leaf)+" tree-leaf treeclick'",u[f]=!0,r="leaf"):(u[f]=!1,r=
""),u[l]=("true"==u[l]||!0===u[l]?!0:!1)&&u[m],p+=!0===u[l]?b.p.treeIcons.minus+" tree-minus treeclick'":b.p.treeIcons.plus+" tree-plus treeclick'",p+="</div></div>",a(b.rows[e].cells[j]).wrapInner("<span class='cell-wrapper"+r+"'></span>").prepend(p),o!==parseInt(b.p.tree_root_level,10)&&((u=(u=a(b).jqGrid("getNodeParent",u))&&u.hasOwnProperty(l)?u[l]:!0)||a(b.rows[e]).css("display","none")),a(b.rows[e].cells[j]).find("div.treeclick").bind("click",function(c){c=a(c.target||c.srcElement,b.rows).closest("tr.jqgrow")[0].id;
c=b.p._index[c];if(!b.p.data[c][f])if(b.p.data[c][l]){a(b).jqGrid("collapseRow",b.p.data[c]);a(b).jqGrid("collapseNode",b.p.data[c])}else{a(b).jqGrid("expandRow",b.p.data[c]);a(b).jqGrid("expandNode",b.p.data[c])}return false}),!0===b.p.ExpandColClick&&a(b.rows[e].cells[j]).find("span.cell-wrapper").css("cursor","pointer").bind("click",function(c){var c=a(c.target||c.srcElement,b.rows).closest("tr.jqgrow")[0].id,d=b.p._index[c];if(!b.p.data[d][f])if(b.p.data[d][l]){a(b).jqGrid("collapseRow",b.p.data[d]);
a(b).jqGrid("collapseNode",b.p.data[d])}else{a(b).jqGrid("expandRow",b.p.data[d]);a(b).jqGrid("expandNode",b.p.data[d])}a(b).jqGrid("setSelection",c);return false}),e++})},setTreeGrid:function(){return this.each(function(){var e=this,c=0,b=!1,j,l,f=[];if(e.p.treeGrid){e.p.treedatatype||a.extend(e.p,{treedatatype:e.p.datatype});e.p.subGrid=!1;e.p.altRows=!1;e.p.pgbuttons=!1;e.p.pginput=!1;e.p.gridview=!0;e.p.multiselect=!1;e.p.rowList=[];e.p.expColInd=0;e.p.treeIcons=a.extend({plus:"ui-icon-triangle-1-"+
("rtl"==e.p.direction?"w":"e"),minus:"ui-icon-triangle-1-s",leaf:"ui-icon-radio-off"},e.p.treeIcons||{});"nested"==e.p.treeGridModel?e.p.treeReader=a.extend({level_field:"level",left_field:"lft",right_field:"rgt",leaf_field:"isLeaf",expanded_field:"expanded",loaded:"loaded",icon_field:"icon"},e.p.treeReader):"adjacency"==e.p.treeGridModel&&(e.p.treeReader=a.extend({level_field:"level",parent_id_field:"parent",leaf_field:"isLeaf",expanded_field:"expanded",loaded:"loaded",icon_field:"icon"},e.p.treeReader));
for(l in e.p.colModel)if(e.p.colModel.hasOwnProperty(l)){j=e.p.colModel[l].name;j==e.p.ExpandColumn&&!b&&(b=!0,e.p.expColInd=c);c++;for(var k in e.p.treeReader)e.p.treeReader[k]==j&&f.push(j)}a.each(e.p.treeReader,function(b,j){if(j&&a.inArray(j,f)===-1){if(b==="leaf_field")e.p._treeleafpos=c;c++;e.p.colNames.push(j);e.p.colModel.push({name:j,width:1,hidden:true,sortable:false,resizable:false,hidedlg:true,editable:true,search:false})}})}})},expandRow:function(e){this.each(function(){var c=this;if(c.grid&&
c.p.treeGrid){var b=a(c).jqGrid("getNodeChildren",e),j=c.p.treeReader.expanded_field;a(b).each(function(){var b=a.jgrid.getAccessor(this,c.p.localReader.id);a("#"+b,c.grid.bDiv).css("display","");this[j]&&a(c).jqGrid("expandRow",this)})}})},collapseRow:function(e){this.each(function(){var c=this;if(c.grid&&c.p.treeGrid){var b=a(c).jqGrid("getNodeChildren",e),j=c.p.treeReader.expanded_field;a(b).each(function(){var b=a.jgrid.getAccessor(this,c.p.localReader.id);a("#"+b,c.grid.bDiv).css("display","none");
this[j]&&a(c).jqGrid("collapseRow",this)})}})},getRootNodes:function(){var e=[];this.each(function(){var c=this;if(c.grid&&c.p.treeGrid)switch(c.p.treeGridModel){case "nested":var b=c.p.treeReader.level_field;a(c.p.data).each(function(){parseInt(this[b],10)===parseInt(c.p.tree_root_level,10)&&e.push(this)});break;case "adjacency":var j=c.p.treeReader.parent_id_field;a(c.p.data).each(function(){(null===this[j]||"null"==(""+this[j]).toLowerCase())&&e.push(this)})}});return e},getNodeDepth:function(e){var c=
null;this.each(function(){if(this.grid&&this.p.treeGrid)switch(this.p.treeGridModel){case "nested":c=parseInt(e[this.p.treeReader.level_field],10)-parseInt(this.p.tree_root_level,10);break;case "adjacency":c=a(this).jqGrid("getNodeAncestors",e).length}});return c},getNodeParent:function(e){var c=null;this.each(function(){if(this.grid&&this.p.treeGrid)switch(this.p.treeGridModel){case "nested":var b=this.p.treeReader.left_field,j=this.p.treeReader.right_field,l=this.p.treeReader.level_field,f=parseInt(e[b],
10),k=parseInt(e[j],10),d=parseInt(e[l],10);a(this.p.data).each(function(){if(parseInt(this[l],10)===d-1&&parseInt(this[b],10)<f&&parseInt(this[j],10)>k)return c=this,!1});break;case "adjacency":var m=this.p.treeReader.parent_id_field,o=this.p.localReader.id;a(this.p.data).each(function(){if(this[o]==e[m])return c=this,!1})}});return c},getNodeChildren:function(e){var c=[];this.each(function(){if(this.grid&&this.p.treeGrid)switch(this.p.treeGridModel){case "nested":var b=this.p.treeReader.left_field,
j=this.p.treeReader.right_field,l=this.p.treeReader.level_field,f=parseInt(e[b],10),k=parseInt(e[j],10),d=parseInt(e[l],10);a(this.p.data).each(function(){parseInt(this[l],10)===d+1&&parseInt(this[b],10)>f&&parseInt(this[j],10)<k&&c.push(this)});break;case "adjacency":var m=this.p.treeReader.parent_id_field,o=this.p.localReader.id;a(this.p.data).each(function(){this[m]==e[o]&&c.push(this)})}});return c},getFullTreeNode:function(e){var c=[];this.each(function(){var b;if(this.grid&&this.p.treeGrid)switch(this.p.treeGridModel){case "nested":var j=
this.p.treeReader.left_field,l=this.p.treeReader.right_field,f=this.p.treeReader.level_field,k=parseInt(e[j],10),d=parseInt(e[l],10),m=parseInt(e[f],10);a(this.p.data).each(function(){parseInt(this[f],10)>=m&&parseInt(this[j],10)>=k&&parseInt(this[j],10)<=d&&c.push(this)});break;case "adjacency":if(e){c.push(e);var o=this.p.treeReader.parent_id_field,r=this.p.localReader.id;a(this.p.data).each(function(a){b=c.length;for(a=0;a<b;a++)if(c[a][r]==this[o]){c.push(this);break}})}}});return c},getNodeAncestors:function(e){var c=
[];this.each(function(){if(this.grid&&this.p.treeGrid)for(var b=a(this).jqGrid("getNodeParent",e);b;)c.push(b),b=a(this).jqGrid("getNodeParent",b)});return c},isVisibleNode:function(e){var c=!0;this.each(function(){if(this.grid&&this.p.treeGrid){var b=a(this).jqGrid("getNodeAncestors",e),j=this.p.treeReader.expanded_field;a(b).each(function(){c=c&&this[j];if(!c)return!1})}});return c},isNodeLoaded:function(e){var c;this.each(function(){if(this.grid&&this.p.treeGrid){var b=this.p.treeReader.leaf_field;
c=void 0!==e?void 0!==e.loaded?e.loaded:e[b]||0<a(this).jqGrid("getNodeChildren",e).length?!0:!1:!1}});return c},expandNode:function(e){return this.each(function(){if(this.grid&&this.p.treeGrid){var c=this.p.treeReader.expanded_field,b=this.p.treeReader.parent_id_field,j=this.p.treeReader.loaded,l=this.p.treeReader.level_field,f=this.p.treeReader.left_field,k=this.p.treeReader.right_field;if(!e[c]){var d=a.jgrid.getAccessor(e,this.p.localReader.id),m=a("#"+d,this.grid.bDiv)[0],o=this.p._index[d];
a(this).jqGrid("isNodeLoaded",this.p.data[o])?(e[c]=!0,a("div.treeclick",m).removeClass(this.p.treeIcons.plus+" tree-plus").addClass(this.p.treeIcons.minus+" tree-minus")):(e[c]=!0,a("div.treeclick",m).removeClass(this.p.treeIcons.plus+" tree-plus").addClass(this.p.treeIcons.minus+" tree-minus"),this.p.treeANode=m.rowIndex,this.p.datatype=this.p.treedatatype,"nested"==this.p.treeGridModel?a(this).jqGrid("setGridParam",{postData:{nodeid:d,n_left:e[f],n_right:e[k],n_level:e[l]}}):a(this).jqGrid("setGridParam",
{postData:{nodeid:d,parentid:e[b],n_level:e[l]}}),a(this).trigger("reloadGrid"),e[j]=!0,"nested"==this.p.treeGridModel?a(this).jqGrid("setGridParam",{postData:{nodeid:"",n_left:"",n_right:"",n_level:""}}):a(this).jqGrid("setGridParam",{postData:{nodeid:"",parentid:"",n_level:""}}))}}})},collapseNode:function(e){return this.each(function(){if(this.grid&&this.p.treeGrid&&e.expanded){e.expanded=!1;var c=a.jgrid.getAccessor(e,this.p.localReader.id),c=a("#"+c,this.grid.bDiv)[0];a("div.treeclick",c).removeClass(this.p.treeIcons.minus+
" tree-minus").addClass(this.p.treeIcons.plus+" tree-plus")}})},SortTree:function(e,c,b,j){return this.each(function(){if(this.grid&&this.p.treeGrid){var l,f,k,d=[],m=this,o;l=a(this).jqGrid("getRootNodes");l=a.jgrid.from(l);l.orderBy(e,c,b,j);o=l.select();l=0;for(f=o.length;l<f;l++)k=o[l],d.push(k),a(this).jqGrid("collectChildrenSortTree",d,k,e,c,b,j);a.each(d,function(b){var c=a.jgrid.getAccessor(this,m.p.localReader.id);a("#"+m.p.id+" tbody tr:eq("+b+")").after(a("tr#"+c,m.grid.bDiv))});d=o=l=
null}})},collectChildrenSortTree:function(e,c,b,j,l,f){return this.each(function(){if(this.grid&&this.p.treeGrid){var k,d,m,o;k=a(this).jqGrid("getNodeChildren",c);k=a.jgrid.from(k);k.orderBy(b,j,l,f);o=k.select();k=0;for(d=o.length;k<d;k++)m=o[k],e.push(m),a(this).jqGrid("collectChildrenSortTree",e,m,b,j,l,f)}})},setTreeRow:function(e,c){var b=!1;this.each(function(){this.grid&&this.p.treeGrid&&(b=a(this).jqGrid("setRowData",e,c))});return b},delTreeNode:function(e){return this.each(function(){var c=
this.p.localReader.id,b=this.p.treeReader.left_field,j=this.p.treeReader.right_field,l,f,k;if(this.grid&&this.p.treeGrid){var d=this.p._index[e];if(void 0!==d){l=parseInt(this.p.data[d][j],10);f=l-parseInt(this.p.data[d][b],10)+1;d=a(this).jqGrid("getFullTreeNode",this.p.data[d]);if(0<d.length)for(var m=0;m<d.length;m++)a(this).jqGrid("delRowData",d[m][c]);if("nested"===this.p.treeGridModel){c=a.jgrid.from(this.p.data).greater(b,l,{stype:"integer"}).select();if(c.length)for(k in c)c[k][b]=parseInt(c[k][b],
10)-f;c=a.jgrid.from(this.p.data).greater(j,l,{stype:"integer"}).select();if(c.length)for(k in c)c[k][j]=parseInt(c[k][j],10)-f}}}})},addChildNode:function(e,c,b){var j=this[0];if(b){var l=j.p.treeReader.expanded_field,f=j.p.treeReader.leaf_field,k=j.p.treeReader.level_field,d=j.p.treeReader.parent_id_field,m=j.p.treeReader.left_field,o=j.p.treeReader.right_field,r=j.p.treeReader.loaded,p,u,t,y,z;p=0;var x=c,v;if(!e){z=j.p.data.length-1;if(0<=z)for(;0<=z;)p=Math.max(p,parseInt(j.p.data[z][j.p.localReader.id],
10)),z--;e=p+1}var A=a(j).jqGrid("getInd",c);v=!1;if(void 0===c||null===c||""===c)x=c=null,p="last",y=j.p.tree_root_level,z=j.p.data.length+1;else if(p="after",u=j.p._index[c],t=j.p.data[u],c=t[j.p.localReader.id],y=parseInt(t[k],10)+1,z=a(j).jqGrid("getFullTreeNode",t),z.length?(x=z[z.length-1][j.p.localReader.id],z=a(j).jqGrid("getInd",x)+1):z=a(j).jqGrid("getInd",c)+1,t[f])v=!0,t[l]=!0,a(j.rows[A]).find("span.cell-wrapperleaf").removeClass("cell-wrapperleaf").addClass("cell-wrapper").end().find("div.tree-leaf").removeClass(j.p.treeIcons.leaf+
" tree-leaf").addClass(j.p.treeIcons.minus+" tree-minus"),j.p.data[u][f]=!1,t[r]=!0;u=z+1;b[l]=!1;b[r]=!0;b[k]=y;b[f]=!0;"adjacency"===j.p.treeGridModel&&(b[d]=c);if("nested"===j.p.treeGridModel){var B;if(null!==c){f=parseInt(t[o],10);k=a.jgrid.from(j.p.data);k=k.greaterOrEquals(o,f,{stype:"integer"});k=k.select();if(k.length)for(B in k)k[B][m]=k[B][m]>f?parseInt(k[B][m],10)+2:k[B][m],k[B][o]=k[B][o]>=f?parseInt(k[B][o],10)+2:k[B][o];b[m]=f;b[o]=f+1}else{f=parseInt(a(j).jqGrid("getCol",o,!1,"max"),
10);k=a.jgrid.from(j.p.data).greater(m,f,{stype:"integer"}).select();if(k.length)for(B in k)k[B][m]=parseInt(k[B][m],10)+2;k=a.jgrid.from(j.p.data).greater(o,f,{stype:"integer"}).select();if(k.length)for(B in k)k[B][o]=parseInt(k[B][o],10)+2;b[m]=f+1;b[o]=f+2}}if(null===c||a(j).jqGrid("isNodeLoaded",t)||v)a(j).jqGrid("addRowData",e,b,p,x),a(j).jqGrid("setTreeNode",z,u);t&&!t[l]&&a(j.rows[A]).find("div.treeclick").click()}}})})(m);(function(a){a.jgrid.extend({jqGridImport:function(g){g=a.extend({imptype:"xml",
impstring:"",impurl:"",mtype:"GET",impData:{},xmlGrid:{config:"roots>grid",data:"roots>rows"},jsonGrid:{config:"grid",data:"data"},ajaxOptions:{}},g||{});return this.each(function(){var c=this,b=function(b,g){var d=a(g.xmlGrid.config,b)[0],j=a(g.xmlGrid.data,b)[0],l;if(e.xml2json&&a.jgrid.parse){var d=e.xml2json(d," "),d=a.jgrid.parse(d),m;for(m in d)d.hasOwnProperty(m)&&(l=d[m]);j?(j=d.grid.datatype,d.grid.datatype="xmlstring",d.grid.datastr=b,a(c).jqGrid(l).jqGrid("setGridParam",{datatype:j})):
a(c).jqGrid(l)}else alert("xml2json or parse are not present")},j=function(b,e){if(b&&"string"==typeof b){var d=a.jgrid.parse(b),g=d[e.jsonGrid.config];if(d=d[e.jsonGrid.data]){var j=g.datatype;g.datatype="jsonstring";g.datastr=d;a(c).jqGrid(g).jqGrid("setGridParam",{datatype:j})}else a(c).jqGrid(g)}};switch(g.imptype){case "xml":a.ajax(a.extend({url:g.impurl,type:g.mtype,data:g.impData,dataType:"xml",complete:function(c,e){"success"==e&&(b(c.responseXML,g),a.isFunction(g.importComplete)&&g.importComplete(c))}},
g.ajaxOptions));break;case "xmlstring":if(g.impstring&&"string"==typeof g.impstring){var l=a.jgrid.stringToDoc(g.impstring);l&&(b(l,g),a.isFunction(g.importComplete)&&g.importComplete(l),g.impstring=null);l=null}break;case "json":a.ajax(a.extend({url:g.impurl,type:g.mtype,data:g.impData,dataType:"json",complete:function(b,c){"success"==c&&(j(b.responseText,g),a.isFunction(g.importComplete)&&g.importComplete(b))}},g.ajaxOptions));break;case "jsonstring":g.impstring&&"string"==typeof g.impstring&&(j(g.impstring,
g),a.isFunction(g.importComplete)&&g.importComplete(g.impstring),g.impstring=null)}})},jqGridExport:function(g){var g=a.extend({exptype:"xmlstring",root:"grid",ident:"\t"},g||{}),c=null;this.each(function(){if(this.grid){var b=a.extend({},a(this).jqGrid("getGridParam"));b.rownumbers&&(b.colNames.splice(0,1),b.colModel.splice(0,1));b.multiselect&&(b.colNames.splice(0,1),b.colModel.splice(0,1));b.subGrid&&(b.colNames.splice(0,1),b.colModel.splice(0,1));b.knv=null;if(b.treeGrid)for(var j in b.treeReader)b.treeReader.hasOwnProperty(j)&&
(b.colNames.splice(b.colNames.length-1),b.colModel.splice(b.colModel.length-1));switch(g.exptype){case "xmlstring":c="<"+g.root+">"+e.json2xml(b,g.ident)+"</"+g.root+">";break;case "jsonstring":c="{"+e.toJson(b,g.root,g.ident)+"}",void 0!==b.postData.filters&&(c=c.replace(/filters":"/,'filters":'),c=c.replace(/}]}"/,"}]}"))}}});return c},excelExport:function(e){e=a.extend({exptype:"remote",url:null,oper:"oper",tag:"excel",exportOptions:{}},e||{});return this.each(function(){if(this.grid){var c;"remote"==
e.exptype&&(c=a.extend({},this.p.postData),c[e.oper]=e.tag,c=m.param(c),c=-1!=e.url.indexOf("?")?e.url+"&"+c:e.url+"?"+c,window.location=c)}})}})})(m);var e={xml2json:function(a,e){9===a.nodeType&&(a=a.documentElement);var c=this.toJson(this.toObj(this.removeWhite(a)),a.nodeName,"\t");return"{\n"+e+(e?c.replace(/\t/g,e):c.replace(/\t|\n/g,""))+"\n}"},json2xml:function(a,e){var c=function(a,b,e){var d="",g,j;if(a instanceof Array)if(0===a.length)d+=e+"<"+b+">__EMPTY_ARRAY_</"+b+">\n";else{g=0;for(j=
a.length;g<j;g+=1)var m=e+c(a[g],b,e+"\t")+"\n",d=d+m}else if("object"===typeof a){g=!1;d+=e+"<"+b;for(j in a)a.hasOwnProperty(j)&&("@"===j.charAt(0)?d+=" "+j.substr(1)+'="'+a[j].toString()+'"':g=!0);d+=g?">":"/>";if(g){for(j in a)a.hasOwnProperty(j)&&("#text"===j?d+=a[j]:"#cdata"===j?d+="<![CDATA["+a[j]+"]]\>":"@"!==j.charAt(0)&&(d+=c(a[j],j,e+"\t")));d+=("\n"===d.charAt(d.length-1)?e:"")+"</"+b+">"}}else d+="function"===typeof a?e+"<"+b+"><![CDATA["+a+"]]\></"+b+">":'""'===a.toString()||0===a.toString().length?
e+"<"+b+">__EMPTY_STRING_</"+b+">":e+"<"+b+">"+a.toString()+"</"+b+">";return d},b="",j;for(j in a)a.hasOwnProperty(j)&&(b+=c(a[j],j,""));return e?b.replace(/\t/g,e):b.replace(/\t|\n/g,"")},toObj:function(a){var e={},c=/function/i;if(1===a.nodeType){if(a.attributes.length){var b;for(b=0;b<a.attributes.length;b+=1)e["@"+a.attributes[b].nodeName]=(a.attributes[b].nodeValue||"").toString()}if(a.firstChild){var j=b=0,l=!1,f;for(f=a.firstChild;f;f=f.nextSibling)1===f.nodeType?l=!0:3===f.nodeType&&f.nodeValue.match(/[^ \f\n\r\t\v]/)?
b+=1:4===f.nodeType&&(j+=1);if(l)if(2>b&&2>j){this.removeWhite(a);for(f=a.firstChild;f;f=f.nextSibling)3===f.nodeType?e["#text"]=this.escape(f.nodeValue):4===f.nodeType?c.test(f.nodeValue)?e[f.nodeName]=[e[f.nodeName],f.nodeValue]:e["#cdata"]=this.escape(f.nodeValue):e[f.nodeName]?e[f.nodeName]instanceof Array?e[f.nodeName][e[f.nodeName].length]=this.toObj(f):e[f.nodeName]=[e[f.nodeName],this.toObj(f)]:e[f.nodeName]=this.toObj(f)}else a.attributes.length?e["#text"]=this.escape(this.innerXml(a)):e=
this.escape(this.innerXml(a));else if(b)a.attributes.length?e["#text"]=this.escape(this.innerXml(a)):(e=this.escape(this.innerXml(a)),"__EMPTY_ARRAY_"===e?e="[]":"__EMPTY_STRING_"===e&&(e=""));else if(j)if(1<j)e=this.escape(this.innerXml(a));else for(f=a.firstChild;f;f=f.nextSibling)if(c.test(a.firstChild.nodeValue)){e=a.firstChild.nodeValue;break}else e["#cdata"]=this.escape(f.nodeValue)}!a.attributes.length&&!a.firstChild&&(e=null)}else 9===a.nodeType?e=this.toObj(a.documentElement):alert("unhandled node type: "+
a.nodeType);return e},toJson:function(a,e,c,b){void 0===b&&(b=!0);var j=e?'"'+e+'"':"",l="\t",f="\n";b||(f=l="");if("[]"===a)j+=e?":[]":"[]";else if(a instanceof Array){var k,d,m=[];d=0;for(k=a.length;d<k;d+=1)m[d]=this.toJson(a[d],"",c+l,b);j+=(e?":[":"[")+(1<m.length?f+c+l+m.join(","+f+c+l)+f+c:m.join(""))+"]"}else if(null===a)j+=(e&&":")+"null";else if("object"===typeof a){k=[];for(d in a)a.hasOwnProperty(d)&&(k[k.length]=this.toJson(a[d],d,c+l,b));j+=(e?":{":"{")+(1<k.length?f+c+l+k.join(","+
f+c+l)+f+c:k.join(""))+"}"}else j+="string"===typeof a?(e&&":")+'"'+a.replace(/\\/g,"\\\\").replace(/\"/g,'\\"')+'"':(e&&":")+'"'+a.toString()+'"';return j},innerXml:function(a){var e="";if("innerHTML"in a)e=a.innerHTML;else for(var c=function(a){var e="",g;if(1===a.nodeType){e+="<"+a.nodeName;for(g=0;g<a.attributes.length;g+=1)e+=" "+a.attributes[g].nodeName+'="'+(a.attributes[g].nodeValue||"").toString()+'"';if(a.firstChild){e+=">";for(g=a.firstChild;g;g=g.nextSibling)e+=c(g);e+="</"+a.nodeName+
">"}else e+="/>"}else 3===a.nodeType?e+=a.nodeValue:4===a.nodeType&&(e+="<![CDATA["+a.nodeValue+"]]\>");return e},a=a.firstChild;a;a=a.nextSibling)e+=c(a);return e},escape:function(a){return a.replace(/[\\]/g,"\\\\").replace(/[\"]/g,'\\"').replace(/[\n]/g,"\\n").replace(/[\r]/g,"\\r")},removeWhite:function(a){a.normalize();var e;for(e=a.firstChild;e;)if(3===e.nodeType)if(e.nodeValue.match(/[^ \f\n\r\t\v]/))e=e.nextSibling;else{var c=e.nextSibling;a.removeChild(e);e=c}else 1===e.nodeType&&this.removeWhite(e),
e=e.nextSibling;return a}};(function(a){a.browser.msie&&8==a.browser.version&&(a.expr[":"].hidden=function(a){return 0===a.offsetWidth||0===a.offsetHeight||"none"==a.style.display});a.jgrid._multiselect=!1;if(a.ui&&a.ui.multiselect){if(a.ui.multiselect.prototype._setSelected){var e=a.ui.multiselect.prototype._setSelected;a.ui.multiselect.prototype._setSelected=function(c,b){var j=e.call(this,c,b);if(b&&this.selectedList){var l=this.element;this.selectedList.find("li").each(function(){a(this).data("optionLink")&&
a(this).data("optionLink").remove().appendTo(l)})}return j}}a.ui.multiselect.prototype.destroy&&(a.ui.multiselect.prototype.destroy=function(){this.element.show();this.container.remove();a.Widget===void 0?a.widget.prototype.destroy.apply(this,arguments):a.Widget.prototype.destroy.apply(this,arguments)});a.jgrid._multiselect=!0}a.jgrid.extend({sortableColumns:function(c){return this.each(function(){function b(){e.p.disableClick=true}var e=this,g={tolerance:"pointer",axis:"x",scrollSensitivity:"1",
items:">th:not(:has(#jqgh_cb,#jqgh_rn,#jqgh_subgrid),:hidden)",placeholder:{element:function(b){return a(document.createElement(b[0].nodeName)).addClass(b[0].className+" ui-sortable-placeholder ui-state-highlight").removeClass("ui-sortable-helper")[0]},update:function(a,b){b.height(a.currentItem.innerHeight()-parseInt(a.currentItem.css("paddingTop")||0,10)-parseInt(a.currentItem.css("paddingBottom")||0,10));b.width(a.currentItem.innerWidth()-parseInt(a.currentItem.css("paddingLeft")||0,10)-parseInt(a.currentItem.css("paddingRight")||
0,10))}},update:function(b,c){var f=a(c.item).parent(),f=a(">th",f),g={};a.each(e.p.colModel,function(a){g[this.name]=a});var l=[];f.each(function(){var b=a(">div",this).get(0).id.replace(/^jqgh_/,"");b in g&&l.push(g[b])});a(e).jqGrid("remapColumns",l,true,true);a.isFunction(e.p.sortable.update)&&e.p.sortable.update(l);setTimeout(function(){e.p.disableClick=false},50)}};if(e.p.sortable.options)a.extend(g,e.p.sortable.options);else if(a.isFunction(e.p.sortable))e.p.sortable={update:e.p.sortable};
if(g.start){var f=g.start;g.start=function(a,c){b();f.call(this,a,c)}}else g.start=b;if(e.p.sortable.exclude)g.items=g.items+(":not("+e.p.sortable.exclude+")");c.sortable(g).data("sortable").floating=true})},columnChooser:function(c){function b(b,c){b&&(typeof b=="string"?a.fn[b]&&a.fn[b].apply(c,a.makeArray(arguments).slice(2)):a.isFunction(b)&&b.apply(c,a.makeArray(arguments).slice(2)))}var e=this;if(!a("#colchooser_"+e[0].p.id).length){var g=a('<div id="colchooser_'+e[0].p.id+'" style="position:relative;overflow:hidden"><div><select multiple="multiple"></select></div></div>'),
f=a("select",g),c=a.extend({width:420,height:240,classname:null,done:function(a){a&&e.jqGrid("remapColumns",a,true)},msel:"multiselect",dlog:"dialog",dlog_opts:function(a){var b={};b[a.bSubmit]=function(){a.apply_perm();a.cleanup(false)};b[a.bCancel]=function(){a.cleanup(true)};return{buttons:b,close:function(){a.cleanup(true)},modal:a.modal?a.modal:false,resizable:a.resizable?a.resizable:true,width:a.width+20}},apply_perm:function(){a("option",f).each(function(){this.selected?e.jqGrid("showCol",
k[this.value].name):e.jqGrid("hideCol",k[this.value].name)});var b=[];a("option[selected]",f).each(function(){b.push(parseInt(this.value,10))});a.each(b,function(){delete m[k[parseInt(this,10)].name]});a.each(m,function(){var a=parseInt(this,10),c=b,d=a;if(d>=0){var e=c.slice(),f=e.splice(d,Math.max(c.length-d,d));if(d>c.length)d=c.length;e[d]=a;b=e.concat(f)}else b=void 0});c.done&&c.done.call(e,b)},cleanup:function(a){b(c.dlog,g,"destroy");b(c.msel,f,"destroy");g.remove();a&&c.done&&c.done.call(e)},
msel_opts:{}},a.jgrid.col,c||{});if(a.ui&&a.ui.multiselect&&c.msel=="multiselect"){if(!a.jgrid._multiselect){alert("Multiselect plugin loaded after jqGrid. Please load the plugin before the jqGrid!");return}c.msel_opts=a.extend(a.ui.multiselect.defaults,c.msel_opts)}c.caption&&g.attr("title",c.caption);if(c.classname){g.addClass(c.classname);f.addClass(c.classname)}if(c.width){a(">div",g).css({width:c.width,margin:"0 auto"});f.css("width",c.width)}if(c.height){a(">div",g).css("height",c.height);f.css("height",
c.height-10)}var k=e.jqGrid("getGridParam","colModel"),d=e.jqGrid("getGridParam","colNames"),m={},o=[];f.empty();a.each(k,function(a){m[this.name]=a;this.hidedlg?this.hidden||o.push(a):f.append("<option value='"+a+"' "+(this.hidden?"":"selected='selected'")+">"+d[a]+"</option>")});var r=a.isFunction(c.dlog_opts)?c.dlog_opts.call(e,c):c.dlog_opts;b(c.dlog,g,r);r=a.isFunction(c.msel_opts)?c.msel_opts.call(e,c):c.msel_opts;b(c.msel,f,r)}},sortableRows:function(c){return this.each(function(){var b=this;
if(b.grid&&!b.p.treeGrid&&a.fn.sortable){c=a.extend({cursor:"move",axis:"y",items:".jqgrow"},c||{});if(c.start&&a.isFunction(c.start)){c._start_=c.start;delete c.start}else c._start_=false;if(c.update&&a.isFunction(c.update)){c._update_=c.update;delete c.update}else c._update_=false;c.start=function(e,g){a(g.item).css("border-width","0px");a("td",g.item).each(function(a){this.style.width=b.grid.cols[a].style.width});if(b.p.subGrid){var f=a(g.item).attr("id");try{a(b).jqGrid("collapseSubGridRow",f)}catch(k){}}c._start_&&
c._start_.apply(this,[e,g])};c.update=function(e,g){a(g.item).css("border-width","");b.p.rownumbers===true&&a("td.jqgrid-rownum",b.rows).each(function(b){a(this).html(b+1)});c._update_&&c._update_.apply(this,[e,g])};a("tbody:first",b).sortable(c);a("tbody:first",b).disableSelection()}})},gridDnD:function(c){return this.each(function(){function b(){var b=a.data(e,"dnd");a("tr.jqgrow:not(.ui-draggable)",e).draggable(a.isFunction(b.drag)?b.drag.call(a(e),b):b.drag)}var e=this;if(e.grid&&!e.p.treeGrid&&
a.fn.draggable&&a.fn.droppable){a("#jqgrid_dnd").html()===null&&a("body").append("<table id='jqgrid_dnd' class='ui-jqgrid-dnd'></table>");if(typeof c=="string"&&c=="updateDnD"&&e.p.jqgdnd===true)b();else{c=a.extend({drag:function(b){return a.extend({start:function(c,d){if(e.p.subGrid){var g=a(d.helper).attr("id");try{a(e).jqGrid("collapseSubGridRow",g)}catch(l){}}for(g=0;g<a.data(e,"dnd").connectWith.length;g++)a(a.data(e,"dnd").connectWith[g]).jqGrid("getGridParam","reccount")=="0"&&a(a.data(e,"dnd").connectWith[g]).jqGrid("addRowData",
"jqg_empty_row",{});d.helper.addClass("ui-state-highlight");a("td",d.helper).each(function(a){this.style.width=e.grid.headers[a].width+"px"});b.onstart&&a.isFunction(b.onstart)&&b.onstart.call(a(e),c,d)},stop:function(c,d){if(d.helper.dropped){var g=a(d.helper).attr("id");a(e).jqGrid("delRowData",g)}for(g=0;g<a.data(e,"dnd").connectWith.length;g++)a(a.data(e,"dnd").connectWith[g]).jqGrid("delRowData","jqg_empty_row");b.onstop&&a.isFunction(b.onstop)&&b.onstop.call(a(e),c,d)}},b.drag_opts||{})},drop:function(b){return a.extend({accept:function(b){if(!a(b).hasClass("jqgrow"))return b;
var c=a(b).closest("table.ui-jqgrid-btable");if(c.length>0&&a.data(c[0],"dnd")!==void 0){b=a.data(c[0],"dnd").connectWith;return a.inArray("#"+this.id,b)!=-1?true:false}return b},drop:function(c,d){if(a(d.draggable).hasClass("jqgrow")){var g=a(d.draggable).attr("id"),g=d.draggable.parent().parent().jqGrid("getRowData",g);if(!b.dropbyname){var l=0,m={},p,u=a("#"+this.id).jqGrid("getGridParam","colModel");try{for(var t in g){if(g.hasOwnProperty(t)&&u[l]){p=u[l].name;m[p]=g[t]}l++}g=m}catch(y){}}d.helper.dropped=
true;if(b.beforedrop&&a.isFunction(b.beforedrop)){p=b.beforedrop.call(this,c,d,g,a("#"+e.id),a(this));typeof p!="undefined"&&(p!==null&&typeof p=="object")&&(g=p)}if(d.helper.dropped){var z;if(b.autoid)if(a.isFunction(b.autoid))z=b.autoid.call(this,g);else{z=Math.ceil(Math.random()*1E3);z=b.autoidprefix+z}a("#"+this.id).jqGrid("addRowData",z,g,b.droppos)}b.ondrop&&a.isFunction(b.ondrop)&&b.ondrop.call(this,c,d,g)}}},b.drop_opts||{})},onstart:null,onstop:null,beforedrop:null,ondrop:null,drop_opts:{activeClass:"ui-state-active",
hoverClass:"ui-state-hover"},drag_opts:{revert:"invalid",helper:"clone",cursor:"move",appendTo:"#jqgrid_dnd",zIndex:5E3},dropbyname:false,droppos:"first",autoid:true,autoidprefix:"dnd_"},c||{});if(c.connectWith){c.connectWith=c.connectWith.split(",");c.connectWith=a.map(c.connectWith,function(b){return a.trim(b)});a.data(e,"dnd",c);e.p.reccount!="0"&&!e.p.jqgdnd&&b();e.p.jqgdnd=true;for(var g=0;g<c.connectWith.length;g++)a(c.connectWith[g]).droppable(a.isFunction(c.drop)?c.drop.call(a(e),c):c.drop)}}}})},
gridResize:function(c){return this.each(function(){var b=this;if(b.grid&&a.fn.resizable){c=a.extend({},c||{});if(c.alsoResize){c._alsoResize_=c.alsoResize;delete c.alsoResize}else c._alsoResize_=false;if(c.stop&&a.isFunction(c.stop)){c._stop_=c.stop;delete c.stop}else c._stop_=false;c.stop=function(e,g){a(b).jqGrid("setGridParam",{height:a("#gview_"+b.p.id+" .ui-jqgrid-bdiv").height()});a(b).jqGrid("setGridWidth",g.size.width,c.shrinkToFit);c._stop_&&c._stop_.call(b,e,g)};c.alsoResize=c._alsoResize_?
eval("("+("{'#gview_"+b.p.id+" .ui-jqgrid-bdiv':true,'"+c._alsoResize_+"':true}")+")"):a(".ui-jqgrid-bdiv","#gview_"+b.p.id);delete c._alsoResize_;a("#gbox_"+b.p.id).resizable(c)}})}})})(m)});define("jquery-layout",["jquery"],function(m){(function(e){function a(a){return"string"===e.type(a)}function g(b,c){if(e.isArray(c))for(var d=0,g=c.length;d<g;d++){var j=c[d];try{a(j)&&(j=eval(j)),e.isFunction(j)&&j(b)}catch(l){}}}var c=Math.min,b=Math.max,j=Math.floor;e.layout={version:"1.3.rc30.51",revision:0.033005,
language:{Open:"Open",Close:"Close",Resize:"Resize",Slide:"Slide Open",Pin:"Pin",Unpin:"Un-Pin",noRoomToOpenTip:"Not enough room to show this pane.",minSizeWarning:"Panel has reached its minimum size",maxSizeWarning:"Panel has reached its maximum size",pane:"pane",selector:"selector",errButton:"Error Adding Button \n\nInvalid ",errContainerMissing:"UI Layout Initialization Error\n\nThe specified layout-container does not exist.",errCenterPaneMissing:"UI Layout Initialization Error\n\nThe center-pane element does not exist.\n\nThe center-pane is a required element.",
errContainerHeight:"UI Layout Initialization Warning\n\nThe layout-container \"CONTAINER\" has no height.\n\nTherefore the layout is 0-height and hence 'invisible'!"},browser:{mozilla:!!e.browser.mozilla,webkit:!!e.browser.webkit||!!e.browser.safari,msie:!!e.browser.msie,isIE6:!!e.browser.msie&&6==e.browser.version,version:e.browser.version},effects:{slide:{all:{duration:"fast"},north:{direction:"up"},south:{direction:"down"},east:{direction:"right"},west:{direction:"left"}},drop:{all:{duration:"slow"},
north:{direction:"up"},south:{direction:"down"},east:{direction:"right"},west:{direction:"left"}},scale:{all:{duration:"fast"}},blind:{},clip:{},explode:{},fade:{},fold:{},puff:{},size:{all:{easing:"swing"}}},config:{optionRootKeys:"effects panes north south west east center".split(" "),allPanes:["north","south","west","east","center"],borderPanes:["north","south","west","east"],oppositeEdge:{north:"south",south:"north",east:"west",west:"east"},offscreenCSS:{left:"-99999px",right:"auto"},offscreenReset:"offscreenReset",
hidden:{visibility:"hidden"},visible:{visibility:"visible"},resizers:{cssReq:{position:"absolute",padding:0,margin:0,fontSize:"1px",textAlign:"left",overflow:"hidden"},cssDemo:{background:"#DDD",border:"none"}},togglers:{cssReq:{position:"absolute",display:"block",padding:0,margin:0,overflow:"hidden",textAlign:"center",fontSize:"1px",cursor:"pointer",zIndex:1},cssDemo:{background:"#AAA"}},content:{cssReq:{position:"relative"},cssDemo:{overflow:"auto",padding:"10px"},cssDemoPane:{overflow:"hidden",
padding:0}},panes:{cssReq:{position:"absolute",margin:0},cssDemo:{padding:"10px",background:"#FFF",border:"1px solid #BBB",overflow:"auto"}},north:{side:"Top",sizeType:"Height",dir:"horz",cssReq:{top:0,bottom:"auto",left:0,right:0,width:"auto"}},south:{side:"Bottom",sizeType:"Height",dir:"horz",cssReq:{top:"auto",bottom:0,left:0,right:0,width:"auto"}},east:{side:"Right",sizeType:"Width",dir:"vert",cssReq:{left:"auto",right:0,top:"auto",bottom:"auto",height:"auto"}},west:{side:"Left",sizeType:"Width",
dir:"vert",cssReq:{left:0,right:"auto",top:"auto",bottom:"auto",height:"auto"}},center:{dir:"center",cssReq:{left:"auto",right:"auto",top:"auto",bottom:"auto",height:"auto",width:"auto"}}},callbacks:{},getParentPaneElem:function(a){a=e(a);if(a=a.data("layout")||a.data("parentLayout")){a=a.container;if(a.data("layoutPane"))return a;a=a.closest("."+e.layout.defaults.panes.paneClass);if(a.data("layoutPane"))return a}return null},getParentPaneInstance:function(a){return(a=e.layout.getParentPaneElem(a))?
a.data("layoutPane"):null},getParentLayoutInstance:function(a){return(a=e.layout.getParentPaneElem(a))?a.data("parentLayout"):null},getEventObject:function(a){return"object"===typeof a&&a.stopPropagation?a:null},parsePaneName:function(a){var b=e.layout.getEventObject(a);return b?(b.stopPropagation(),e(this).data("layoutEdge")):a},plugins:{draggable:!!e.fn.draggable,effects:{core:!!e.effects,slide:e.effects&&e.effects.slide}},onCreate:[],onLoad:[],onReady:[],onDestroy:[],onUnload:[],afterOpen:[],afterClose:[],
scrollbarWidth:function(){return window.scrollbarWidth||e.layout.getScrollbarSize("width")},scrollbarHeight:function(){return window.scrollbarHeight||e.layout.getScrollbarSize("height")},getScrollbarSize:function(a){var b=e('<div style="position: absolute; top: -10000px; left: -10000px; width: 100px; height: 100px; overflow: scroll;"></div>').appendTo("body"),c={width:b.width()-b[0].clientWidth,height:b.height()-b[0].clientHeight};b.remove();window.scrollbarWidth=c.width;window.scrollbarHeight=c.height;
return a.match(/^(width|height)$/)?c[a]:c},showInvisibly:function(a,b){if(!a)return{};a.jquery||(a=e(a));var c={display:a.css("display"),visibility:a.css("visibility")};return b||"none"===c.display?(a.css({display:"block",visibility:"hidden"}),c):{}},getElementDimensions:function(a){var c={},d=c.css={},g={},j,l,m=e.layout.cssNum,u=a.offset();c.offsetLeft=u.left;c.offsetTop=u.top;e.each(["Left","Right","Top","Bottom"],function(b,m){j=d["border"+m]=e.layout.borderWidth(a,m);l=d["padding"+m]=e.layout.cssNum(a,
"padding"+m);g[m]=j+l;c["inset"+m]=l});c.offsetWidth=a.innerWidth();c.offsetHeight=a.innerHeight();c.outerWidth=a.outerWidth();c.outerHeight=a.outerHeight();c.innerWidth=b(0,c.outerWidth-g.Left-g.Right);c.innerHeight=b(0,c.outerHeight-g.Top-g.Bottom);d.width=a.width();d.height=a.height();d.top=m(a,"top",!0);d.bottom=m(a,"bottom",!0);d.left=m(a,"left",!0);d.right=m(a,"right",!0);return c},getElementCSS:function(a,b){var c={},e=a[0].style,g=b.split(","),j=["Top","Bottom","Left","Right"],l=["Color",
"Style","Width"],m,t,y,z,x,v;for(z=0;z<g.length;z++)if(m=g[z],m.match(/(border|padding|margin)$/))for(x=0;4>x;x++)if(t=j[x],"border"===m)for(v=0;3>v;v++)y=l[v],c[m+t+y]=e[m+t+y];else c[m+t]=e[m+t];else c[m]=e[m];return c},cssWidth:function(a,c){var d=e.layout.borderWidth,g=e.layout.cssNum;if(0>=c)return 0;if(!e.support.boxModel)return c;d=c-d(a,"Left")-d(a,"Right")-g(a,"paddingLeft")-g(a,"paddingRight");return b(0,d)},cssHeight:function(a,c){var d=e.layout.borderWidth,g=e.layout.cssNum;if(0>=c)return 0;
if(!e.support.boxModel)return c;d=c-d(a,"Top")-d(a,"Bottom")-g(a,"paddingTop")-g(a,"paddingBottom");return b(0,d)},cssNum:function(a,b,c){a.jquery||(a=e(a));var g=e.layout.showInvisibly(a),b=e.curCSS(a[0],b,!0),c=c&&"auto"==b?b:parseInt(b,10)||0;a.css(g);return c},borderWidth:function(a,b){a.jquery&&(a=a[0]);var c="border"+b.substr(0,1).toUpperCase()+b.substr(1);return"none"===e.curCSS(a,c+"Style",!0)?0:parseInt(e.curCSS(a,c+"Width",!0),10)||0},isMouseOverElem:function(a,b){var c=e(b||this),g=c.offset(),
j=g.top,g=g.left,l=g+c.outerWidth(),c=j+c.outerHeight(),m=a.pageX,u=a.pageY;return e.layout.browser.msie&&0>m&&0>u||m>=g&&m<=l&&u>=j&&u<=c},msg:function(a,b,c,g){e.isPlainObject(a)&&window.debugData?("string"===typeof b?(g=c,c=b):"object"===typeof c&&(g=c,c=null),c=c||"log( <object> )",g=e.extend({sort:!1,returnHTML:!1,display:!1},g),!0===b||g.display?debugData(a,c,g):window.console&&console.log(debugData(a,c,g))):b?alert(a):window.console?console.log(a):(b=e("#layoutLogger"),b.length||(b=e('<div id="layoutLogger" style="position: '+
(e.support.fixedPosition?"fixed":"absolute")+'; top: 5px; z-index: 999999; max-width: 25%; overflow: hidden; border: 1px solid #000; border-radius: 5px; background: #FBFBFB; box-shadow: 0 2px 10px rgba(0,0,0,0.3);"><div style="font-size: 13px; font-weight: bold; padding: 5px 10px; background: #F6F6F6; border-radius: 5px 5px 0 0; cursor: move;"><span style="float: right; padding-left: 7px; cursor: pointer;" title="Remove Console" onclick="$(this).closest(\'#layoutLogger\').remove()">X</span>Layout console.log</div><ul style="font-size: 13px; font-weight: none; list-style: none; margin: 0; padding: 0 0 2px;"></ul></div>').appendTo("body"),
b.css("left",e(window).width()-b.outerWidth()-5),e.ui.draggable&&b.draggable({handle:":first-child"})),b.children("ul").append('<li style="padding: 4px 10px; margin: 0; border-top: 1px solid #CCC;">'+a.replace(/\</g,"&lt;").replace(/\>/g,"&gt;")+"</li>"))}};var l=e.layout.language;e.layout.defaults={name:"",containerSelector:"",containerClass:"ui-layout-container",scrollToBookmarkOnLoad:!0,resizeWithWindow:!0,resizeWithWindowDelay:200,resizeWithWindowMaxDelay:0,onresizeall_start:null,onresizeall_end:null,
onload_start:null,onload_end:null,onunload_start:null,onunload_end:null,autoBindCustomButtons:!1,initPanes:!0,showErrorMessages:!0,showDebugMessages:!1,zIndex:null,zIndexes:{pane_normal:0,content_mask:1,resizer_normal:2,pane_sliding:100,pane_animate:1E3,resizer_drag:1E4},panes:{applyDemoStyles:!1,closable:!0,resizable:!0,slidable:!0,initClosed:!1,initHidden:!1,contentSelector:".ui-layout-content",contentIgnoreSelector:".ui-layout-ignore",findNestedContent:!1,paneClass:"ui-layout-pane",resizerClass:"ui-layout-resizer",
togglerClass:"ui-layout-toggler",buttonClass:"ui-layout-button",minSize:0,maxSize:0,spacing_open:6,spacing_closed:6,togglerLength_open:50,togglerLength_closed:50,togglerAlign_open:"center",togglerAlign_closed:"center",togglerTip_open:l.Close,togglerTip_closed:l.Open,togglerContent_open:"",togglerContent_closed:"",resizerDblClickToggle:!0,autoResize:!0,autoReopen:!0,resizerDragOpacity:1,maskContents:!1,maskObjects:!1,maskZindex:null,resizingGrid:!1,livePaneResizing:!1,liveContentResizing:!1,liveResizingTolerance:1,
noRoomToOpenTip:l.noRoomToOpenTip,resizerTip:l.Resize,sliderTip:l.Slide,sliderCursor:"pointer",slideTrigger_open:"click",slideTrigger_close:"mouseleave",slideDelay_open:300,slideDelay_close:300,hideTogglerOnSlide:!1,preventQuickSlideClose:e.layout.browser.webkit,preventPrematureSlideClose:!1,showOverflowOnHover:!1,enableCursorHotkey:!0,customHotkeyModifier:"SHIFT",fxName:"slide",fxSpeed:null,fxSettings:{},fxOpacityFix:!0,animatePaneSizing:!1,childOptions:null,initChildLayout:!0,destroyChildLayout:!0,
resizeChildLayout:!0,triggerEventsOnLoad:!1,triggerEventsDuringLiveResize:!0,onshow_start:null,onshow_end:null,onhide_start:null,onhide_end:null,onopen_start:null,onopen_end:null,onclose_start:null,onclose_end:null,onresize_start:null,onresize_end:null,onsizecontent_start:null,onsizecontent_end:null,onswap_start:null,onswap_end:null,ondrag_start:null,ondrag_end:null},north:{paneSelector:".ui-layout-north",size:"auto",resizerCursor:"n-resize",customHotkey:""},south:{paneSelector:".ui-layout-south",
size:"auto",resizerCursor:"s-resize",customHotkey:""},east:{paneSelector:".ui-layout-east",size:200,resizerCursor:"e-resize",customHotkey:""},west:{paneSelector:".ui-layout-west",size:200,resizerCursor:"w-resize",customHotkey:""},center:{paneSelector:".ui-layout-center",minWidth:0,minHeight:0}};e.layout.optionsMap={layout:"stateManagement effects zIndexes name zIndex scrollToBookmarkOnLoad showErrorMessages resizeWithWindow resizeWithWindowDelay resizeWithWindowMaxDelay onresizeall onresizeall_start onresizeall_end onload onunload autoBindCustomButtons".split(" "),
center:"paneClass contentSelector contentIgnoreSelector findNestedContent applyDemoStyles triggerEventsOnLoad showOverflowOnHover maskContents maskObjects liveContentResizing childOptions initChildLayout resizeChildLayout destroyChildLayout onresize onresize_start onresize_end onsizecontent onsizecontent_start onsizecontent_end".split(" "),noDefault:["paneSelector","resizerCursor","customHotkey"]};e.layout.transformData=function(a){var b={panes:{},center:{}},c,e,g,j,l,m,t;if("object"!==typeof a)return b;
for(e in a){c=b;l=a[e];g=e.split("__");t=g.length-1;for(m=0;m<=t;m++)j=g[m],m===t?c[j]=l:c[j]||(c[j]={}),c=c[j]}return b};e.layout.backwardCompatibility={map:{applyDefaultStyles:"applyDemoStyles",resizeNestedLayout:"resizeChildLayout",resizeWhileDragging:"livePaneResizing",resizeContentWhileDragging:"liveContentResizing",triggerEventsWhileDragging:"triggerEventsDuringLiveResize",maskIframesOnResize:"maskContents",useStateCookie:"stateManagement.enabled","cookie.autoLoad":"stateManagement.autoLoad",
"cookie.autoSave":"stateManagement.autoSave","cookie.keys":"stateManagement.stateKeys","cookie.name":"stateManagement.cookie.name","cookie.domain":"stateManagement.cookie.domain","cookie.path":"stateManagement.cookie.path","cookie.expires":"stateManagement.cookie.expires","cookie.secure":"stateManagement.cookie.secure"},renameOptions:function(a){function b(c,d){for(var e=c.split("."),g=e.length-1,j={branch:a,key:e[g]},k=0,l;k<g;k++)l=e[k],j.branch=void 0==j.branch[l]?d?j.branch[l]={}:{}:j.branch[l];
return j}var c=e.layout.backwardCompatibility.map,g,j,l,m;for(m in c)g=b(m),l=g.branch[g.key],void 0!==l&&(j=b(c[m],!0),j.branch[j.key]=l,delete g.branch[g.key])},renameAllOptions:function(a){var b=e.layout.backwardCompatibility.renameOptions;b(a);a.defaults&&("object"!==typeof a.panes&&(a.panes={}),e.extend(!0,a.panes,a.defaults),delete a.defaults);a.panes&&b(a.panes);e.each(e.layout.config.allPanes,function(c,e){a[e]&&b(a[e])});return a}};e.fn.layout=function(f){function k(a){if(!a)return!0;var b=
a.keyCode;if(33>b)return!0;var c={38:"north",40:"south",37:"west",39:"east"},d=a.shiftKey,f=a.ctrlKey,g,j,k,l;f&&(37<=b&&40>=b)&&A[c[b]].enableCursorHotkey?l=c[b]:(f||d)&&e.each(p.borderPanes,function(a,c){g=A[c];j=g.customHotkey;k=g.customHotkeyModifier;if(d&&"SHIFT"==k||f&&"CTRL"==k||f&&d)if(j&&b===(isNaN(j)||9>=j?j.toUpperCase().charCodeAt(0):j))return l=c,!1});if(!l||!L[l]||!A[l].closable||B[l].isHidden)return!0;pa(l);a.stopPropagation();return a.returnValue=!1}function d(b){if(Q()){this&&this.tagName&&
(b=this);var c;a(b)?c=L[b]:e(b).data("layoutRole")?c=e(b):e(b).parents().each(function(){if(e(this).data("layoutRole"))return c=e(this),!1});if(c&&c.length){var d=c.data("layoutEdge"),b=B[d];b.cssSaved&&l(d);if(b.isSliding||b.isResizing||b.isClosed)b.cssSaved=!1;else{var f={zIndex:A.zIndexes.resizer_normal+1},g={},j=c.css("overflow"),k=c.css("overflowX"),m=c.css("overflowY");"visible"!=j&&(g.overflow=j,f.overflow="visible");k&&!k.match(/visible|auto/)&&(g.overflowX=k,f.overflowX="visible");m&&!m.match(/visible|auto/)&&
(g.overflowY=k,f.overflowY="visible");b.cssSaved=g;c.css(f);e.each(p.allPanes,function(a,b){b!=d&&l(b)})}}}}function l(b){if(Q()){this&&this.tagName&&(b=this);var c;a(b)?c=L[b]:e(b).data("layoutRole")?c=e(b):e(b).parents().each(function(){if(e(this).data("layoutRole"))return c=e(this),!1});if(c&&c.length){var b=c.data("layoutEdge"),b=B[b],d=b.cssSaved||{};!b.isSliding&&!b.isResizing&&c.css("zIndex",A.zIndexes.pane_normal);c.css(d);b.cssSaved=!1}}}var m=e.layout.browser,r=e.layout.language,p=e.layout.config,
u=e.layout.cssWidth,t=e.layout.cssHeight,y=e.layout.getElementDimensions,z=e.layout.getElementCSS,x=e.layout.getEventObject,v=e.layout.parsePaneName,A=e.extend(!0,{},e.layout.defaults);A.effects=e.extend(!0,{},e.layout.effects);var B={id:"layout"+e.now(),initialized:!1,container:{},north:{},south:{},east:{},west:{},center:{}},E={north:null,south:null,east:null,west:null,center:null},F={data:{},set:function(a,b,c){F.clear(a);F.data[a]=setTimeout(b,c)},clear:function(a){var b=F.data;b[a]&&(clearTimeout(b[a]),
delete b[a])}},J=function(a,b){e.layout.msg(A.name+" / "+a,b&&A.showErrorMessages)},I=function(b,c,d){var f=c?A[c]:A,g=b+(b.match(/_/)?"":"_end"),j=g.match(/_end$/)?g.substr(0,g.length-4):"",k=f[g],l="NC",m=[];!k&&j&&(k=f[j]);k&&(a(k)&&(k.match(/,/)?(m=k.split(","),k=eval(m[0])):k=eval(k)),e.isFunction(k)&&(l=m.length?k(m[1]):c&&L[c]?k(c,L[c],B[c],A[c],A.name):k(aa,B,A,A.name)));!d&&!1!==l&&(c?(L[c].triggerHandler("layoutpane"+g,[c,L[c],B[c],A[c],A.name]),j&&L[c].triggerHandler("layoutpane"+j,[c,
L[c],B[c],A[c],A.name])):X.triggerHandler("layout"+g,[c,L[c],B[c],A[c],A.name]));("onresize_end"===b||"onsizecontent_end"===b)&&fb(c);return l},N=function(a){if(!m.mozilla){var b=L[a];"IFRAME"===B[a].tagName?b.css(p.hidden).css(p.visible):b.find("IFRAME").css(p.hidden).css(p.visible)}},D=function(a){var b=L[a],a=p[a].dir,b={minWidth:1001-u(b,1E3),minHeight:1001-t(b,1E3)};"horz"===a&&(b.minSize=b.minHeight);"vert"===a&&(b.minSize=b.minWidth);return b},Z=function(b,c,d){var f=b;a(b)?f=L[b]:b.jquery||
(f=e(b));b=t(f,c);f.css({height:b,visibility:"visible"});0<b&&0<f.innerWidth()?d&&f.data("autoHidden")&&(f.show().data("autoHidden",!1),m.mozilla||f.css(p.hidden).css(p.visible)):d&&!f.data("autoHidden")&&f.hide().data("autoHidden",!0)},ca=function(b,c,d){d||(d=p[b].dir);a(c)&&c.match(/%/)&&(c="100%"===c?-1:parseInt(c,10)/100);if(0===c)return 0;if(1<=c)return parseInt(c,10);var f=A,g=0;"horz"==d?g=U.innerHeight-(L.north?f.north.spacing_open:0)-(L.south?f.south.spacing_open:0):"vert"==d&&(g=U.innerWidth-
(L.west?f.west.spacing_open:0)-(L.east?f.east.spacing_open:0));if(-1===c)return g;if(0<c)return j(g*c);if("center"==b)return 0;var d="horz"===d?"height":"width",f=L[b],b="height"===d?ta[b]:!1,g=e.layout.showInvisibly(f),k=f.css(d),l=b?b.css(d):0;f.css(d,"auto");b&&b.css(d,"auto");c="height"===d?f.outerHeight():f.outerWidth();f.css(d,k).css(g);b&&b.css(d,l);return c},ba=function(a,b){var c=L[a],d=A[a],e=B[a],f=b?d.spacing_open:0,d=b?d.spacing_closed:0;return!c||e.isHidden?0:e.isClosed||e.isSliding&&
b?d:"horz"===p[a].dir?c.outerHeight()+f:c.outerWidth()+f},T=function(a,d){if(Q()){var e=A[a],f=B[a],g=p[a],j=g.dir;g.side.toLowerCase();g.sizeType.toLowerCase();var g=void 0!=d?d:f.isSliding,k=e.spacing_open,l=p.oppositeEdge[a],m=B[l],o=L[l],q=!o||!1===m.isVisible||m.isSliding?0:"horz"==j?o.outerHeight():o.outerWidth(),l=(!o||m.isHidden?0:A[l][!1!==m.isClosed?"spacing_closed":"spacing_open"])||0,m="horz"==j?U.innerHeight:U.innerWidth,o=D("center"),o="horz"==j?b(A.center.minHeight,o.minHeight):b(A.center.minWidth,
o.minWidth),g=m-k-(g?0:ca("center",o,j)+q+l),j=f.minSize=b(ca(a,e.minSize),D(a).minSize),g=f.maxSize=c(e.maxSize?ca(a,e.maxSize):1E5,g),f=f.resizerPosition={},k=U.insetTop,q=U.insetLeft,l=U.innerWidth,m=U.innerHeight,e=e.spacing_open;switch(a){case "north":f.min=k+j;f.max=k+g;break;case "west":f.min=q+j;f.max=q+g;break;case "south":f.min=k+m-g-e;f.max=k+m-j-e;break;case "east":f.min=q+l-g-e,f.max=q+l-j-e}}},$=function(a,b){var c=e(a),d=c.data("layoutRole"),f=c.data("layoutEdge"),g=A[f][d+"Class"],
f="-"+f,j=c.hasClass(g+"-closed")?"-closed":"-open",k="-closed"===j?"-open":"-closed",j=g+"-hover "+(g+f+"-hover ")+(g+j+"-hover ")+(g+f+j+"-hover ");b&&(j+=g+k+"-hover "+(g+f+k+"-hover "));"resizer"==d&&c.hasClass(g+"-sliding")&&(j+=g+"-sliding-hover "+(g+f+"-sliding-hover "));return e.trim(j)},G=function(a,b){var c=e(b||this);a&&"toggler"===c.data("layoutRole")&&a.stopPropagation();c.addClass($(c))},O=function(a,b){var c=e(b||this);c.removeClass($(c,!0))},R=function(){e.fn.disableSelection&&e("body").disableSelection()},
W=function(a,b){var c=b||this,d=e(c).data("layoutEdge"),f=d+"ResizerLeave";F.clear(d+"_openSlider");F.clear(f);b?!B[d].isResizing&&e.fn.enableSelection&&e("body").enableSelection():F.set(f,function(){W(a,c)},200)},Q=function(){return B.initialized||B.creatingLayout?!0:K()},K=function(a){var b=A;if(!X.is(":visible"))return!a&&(m.webkit&&"BODY"===X[0].tagName)&&setTimeout(function(){K(!0)},50),!1;if(!la("center").length)return A.showErrorMessages&&J(r.errCenterPaneMissing,!0),!1;B.creatingLayout=!0;
e.extend(U,y(X));za();b.scrollToBookmarkOnLoad&&(a=self.location,a.hash&&a.replace(a.hash));aa.hasParentLayout?b.resizeWithWindow=!1:b.resizeWithWindow&&e(window).bind("resize."+ma,ea);delete B.creatingLayout;B.initialized=!0;g(aa,e.layout.onReady);I("onload_end");return!0},P=function(a,b){var c=v.call(this,a),d=L[c];if(d){var e=ta[c],f=b||A[c].childOptions,d=f.containerSelector?d.find(f.containerSelector):e||d,g=(e=d.length)?E[c]=d.data("layout")||null:null;!g&&(e&&f)&&(g=E[c]=d.eq(0).layout(f)||
null);g&&(g.hasParentLayout=!0)}aa[c].child=E[c]},ea=function(){var a=Number(A.resizeWithWindowDelay);10>a&&(a=100);F.clear("winResize");F.set("winResize",function(){F.clear("winResize");F.clear("winResizeRepeater");var a=y(X);(a.innerWidth!==U.innerWidth||a.innerHeight!==U.innerHeight)&&oa()},a);F.data.winResizeRepeater||C()},C=function(){var a=Number(A.resizeWithWindowMaxDelay);0<a&&F.set("winResizeRepeater",function(){C();oa()},a)},S=function(){I("onunload_start");g(aa,e.layout.onUnload);I("onunload_end")},
V=function(a){a=a?a.split(","):p.borderPanes;e.each(a,function(a,b){var c=A[b];if(c.enableCursorHotkey||c.customHotkey)return e(document).bind("keydown."+ma,k),!1})},fa=function(){function a(b){var c=A[b],d=A.panes;c.fxSettings||(c.fxSettings={});d.fxSettings||(d.fxSettings={});e.each(["_open","_close","_size"],function(a,f){var g="fxName"+f,j="fxSpeed"+f,k="fxSettings"+f,l=c[g]=c[g]||d[g]||c.fxName||d.fxName||"none";if(l==="none"||!e.effects||!e.effects[l]||!A.effects[l])l=c[g]="none";l=A.effects[l]||
{};g=l.all||null;l=l[b]||null;c[j]=c[j]||d[j]||c.fxSpeed||d.fxSpeed||null;c[k]=e.extend({},g,l,d.fxSettings,c.fxSettings,d[k],c[k])});delete c.fxName;delete c.fxSpeed;delete c.fxSettings}var c,d,g,j,k,l;f=e.layout.transformData(f);f=e.layout.backwardCompatibility.renameAllOptions(f);if(!e.isEmptyObject(f.panes)){c=e.layout.optionsMap.noDefault;j=0;for(k=c.length;j<k;j++)g=c[j],delete f.panes[g];c=e.layout.optionsMap.layout;j=0;for(k=c.length;j<k;j++)g=c[j],delete f.panes[g]}c=e.layout.optionsMap.layout;
var m=e.layout.config.optionRootKeys;for(g in f)j=f[g],0>e.inArray(g,m)&&0>e.inArray(g,c)&&(f.panes[g]||(f.panes[g]=e.isPlainObject(j)?e.extend(!0,{},j):j),delete f[g]);e.extend(!0,A,f);e.each(p.allPanes,function(b,j){p[j]=e.extend(!0,{},p.panes,p[j]);d=A.panes;l=A[j];if("center"===j){c=e.layout.optionsMap.center;b=0;for(k=c.length;b<k;b++)if(g=c[b],!f.center[g]&&(f.panes[g]||!l[g]))l[g]=d[g]}else if(l=A[j]=e.extend({},d,l),a(j),l.resizerClass||(l.resizerClass="ui-layout-resizer"),!l.togglerClass)l.togglerClass=
"ui-layout-toggler";l.paneClass||(l.paneClass="ui-layout-pane")});j=f.zIndex;m=A.zIndexes;0<j&&(m.pane_normal=j,m.content_mask=b(j+1,m.content_mask),m.resizer_normal=b(j+2,m.resizer_normal));delete A.panes},la=function(a){a=A[a].paneSelector;if("#"===a.substr(0,1))return X.find(a).eq(0);var b=X.children(a).eq(0);return b.length?b:X.children("form:first").children(a).eq(0)},za=function(){e.each(p.allPanes,function(a,b){sa(b,!0)});Da();e.each(p.borderPanes,function(a,b){L[b]&&B[b].isVisible&&(T(b),
Ha(b))});wa("center");e.each(p.allPanes,function(a,b){var c=A[b];L[b]&&(B[b].isVisible&&(Ya(b),c.triggerEventsOnLoad?I("onresize_end",b):fb(b)),c.initChildLayout&&c.childOptions&&P(b))})},sa=function(a,e){if(e||Q()){var f=A[a],g=B[a],j=p[a],k=j.dir,m="center"===a,o={},r=L[a],v,x;r?qa(a,!1,!0,!1):ta[a]=!1;r=L[a]=la(a);if(r.length){r.data("layoutCSS")||r.data("layoutCSS",z(r,"position,top,left,bottom,right,width,height,overflow,zIndex,display,backgroundColor,padding,margin,border"));aa[a]={name:a,pane:L[a],
content:ta[a],options:A[a],state:B[a],child:E[a]};r.data({parentLayout:aa,layoutPane:aa[a],layoutEdge:a,layoutRole:"pane"}).css(j.cssReq).css("zIndex",A.zIndexes.pane_normal).css(f.applyDemoStyles?j.cssDemo:{}).addClass(f.paneClass+" "+f.paneClass+"-"+a).bind("mouseenter."+ma,G).bind("mouseleave."+ma,O);j={hide:"",show:"",toggle:"",close:"",open:"",slideOpen:"",slideClose:"",slideToggle:"",size:"manualSizePane",sizePane:"manualSizePane",sizeContent:"",sizeHandles:"",enableClosable:"",disableClosable:"",
enableSlideable:"",disableSlideable:"",enableResizable:"",disableResizable:"",swapPanes:"swapPanes",swap:"swapPanes",move:"swapPanes",removePane:"removePane",remove:"removePane",createChildLayout:"",resizeChildLayout:"",resizeAll:"resizeAll",resizeLayout:"resizeAll"};for(x in j)r.bind("layoutpane"+x.toLowerCase()+"."+ma,aa[j[x]||x]);ia(a,!1);m||(v=g.size=ca(a,f.size),m=ca(a,f.minSize)||1,x=ca(a,f.maxSize)||1E5,0<v&&(v=b(c(v,x),m)),g.isClosed=!1,g.isSliding=!1,g.isResizing=!1,g.isHidden=!1,g.pins||
(g.pins=[]));g.tagName=r[0].tagName;g.edge=a;g.noRoom=!1;g.isVisible=!0;switch(a){case "north":o.top=U.insetTop;o.left=U.insetLeft;o.right=U.insetRight;break;case "south":o.bottom=U.insetBottom;o.left=U.insetLeft;o.right=U.insetRight;break;case "west":o.left=U.insetLeft;break;case "east":o.right=U.insetRight}"horz"===k?o.height=t(r,v):"vert"===k&&(o.width=u(r,v));r.css(o);"horz"!=k&&wa(a,!0);f.initClosed&&f.closable&&!f.initHidden?na(a,!0,!0):f.initHidden||f.initClosed?bb(a):g.noRoom||r.css("display",
"block");r.css("visibility","visible");f.showOverflowOnHover&&r.hover(d,l);B.initialized&&(Da(a),V(a),oa(),g.isVisible&&(f.triggerEventsOnLoad?I("onresize_end",a):fb(a)),f.initChildLayout&&f.childOptions&&P(a))}else L[a]=!1}},Da=function(a){a=a?a.split(","):p.borderPanes;e.each(a,function(a,b){var c=L[b];ha[b]=!1;xa[b]=!1;if(c){var c=A[b],d=B[b],f=c.resizerClass,g=c.togglerClass;p[b].side.toLowerCase();var j="-"+b,k=aa[b],l=k.resizer=ha[b]=e("<div></div>"),k=k.toggler=c.closable?xa[b]=e("<div></div>"):
!1;!d.isVisible&&c.slidable&&l.attr("title",c.sliderTip).css("cursor",c.sliderCursor);l.attr("id","#"==c.paneSelector.substr(0,1)?c.paneSelector.substr(1)+"-resizer":"").data({parentLayout:aa,layoutPane:aa[b],layoutEdge:b,layoutRole:"resizer"}).css(p.resizers.cssReq).css("zIndex",A.zIndexes.resizer_normal).css(c.applyDemoStyles?p.resizers.cssDemo:{}).addClass(f+" "+f+j).hover(G,O).hover(R,W).appendTo(X);k&&(k.attr("id","#"==c.paneSelector.substr(0,1)?c.paneSelector.substr(1)+"-toggler":"").data({parentLayout:aa,
layoutPane:aa[b],layoutEdge:b,layoutRole:"toggler"}).css(p.togglers.cssReq).css(c.applyDemoStyles?p.togglers.cssDemo:{}).addClass(g+" "+g+j).hover(G,O).bind("mouseenter",R).appendTo(l),c.togglerContent_open&&e("<span>"+c.togglerContent_open+"</span>").data({layoutEdge:b,layoutRole:"togglerContent"}).data("layoutRole","togglerContent").data("layoutEdge",b).addClass("content content-open").css("display","none").appendTo(k),c.togglerContent_closed&&e("<span>"+c.togglerContent_closed+"</span>").data({layoutEdge:b,
layoutRole:"togglerContent"}).addClass("content content-closed").css("display","none").appendTo(k),Ta(b));ja(b);d.isVisible?Ea(b):(Xa(b),Qa(b,!0))}});Ka()},ia=function(a,b){if(Q()){var c=A[a],d=c.contentSelector,e=aa[a],f=L[a],g;d&&(g=e.content=ta[a]=c.findNestedContent?f.find(d).eq(0):f.children(d).eq(0));g&&g.length?(g.data("layoutRole","content"),g.data("layoutCSS")||g.data("layoutCSS",z(g,"height")),g.css(p.content.cssReq),c.applyDemoStyles&&(g.css(p.content.cssDemo),f.css(p.content.cssDemoPane)),
B[a].content={},!1!==b&&Ya(a)):e.content=ta[a]=!1}},ja=function(a){var b=e.layout.plugins.draggable,a=a?a.split(","):p.borderPanes;e.each(a,function(a,d){var f=A[d];if(!b||!L[d]||!f.resizable)return f.resizable=!1,!0;var g=B[d],j=A.zIndexes,k=p[d],l="horz"==k.dir?"top":"left",m=d+",center,"+p.oppositeEdge[d]+("horz"==k.dir?",west,east":""),o=ha[d],q=f.resizerClass,t=0,u,v,x=q+"-drag",y=q+"-"+d+"-drag",z=q+"-dragging",Y=q+"-"+d+"-dragging",C=q+"-dragging-limit",E=q+"-"+d+"-dragging-limit",D=!1;g.isClosed||
o.attr("title",f.resizerTip).css("cursor",f.resizerCursor);o.draggable({containment:X[0],axis:"horz"==k.dir?"y":"x",delay:0,distance:1,grid:f.resizingGrid,helper:"clone",opacity:f.resizerDragOpacity,addClasses:!1,zIndex:j.resizer_drag,start:function(a,b){f=A[d];g=B[d];v=f.livePaneResizing;if(!1===I("ondrag_start",d))return!1;g.isResizing=!0;F.clear(d+"_closeSlider");T(d);u=g.resizerPosition;t=b.position[l];o.addClass(x+" "+y);D=!1;e("body").disableSelection();H(m)},drag:function(a,b){D||(b.helper.addClass(z+
" "+Y).css({right:"auto",bottom:"auto"}).children().css("visibility","hidden"),D=!0,g.isSliding&&L[d].css("zIndex",j.pane_sliding));var e=0;b.position[l]<u.min?(b.position[l]=u.min,e=-1):b.position[l]>u.max&&(b.position[l]=u.max,e=1);e?(b.helper.addClass(C+" "+E),window.defaultStatus=0<e&&d.match(/north|west/)||0>e&&d.match(/south|east/)?r.maxSizeWarning:r.minSizeWarning):(b.helper.removeClass(C+" "+E),window.defaultStatus="");v&&Math.abs(b.position[l]-t)>=f.liveResizingTolerance&&(t=b.position[l],
c(a,b,d))},stop:function(a,b){e("body").enableSelection();window.defaultStatus="";o.removeClass(x+" "+y);g.isResizing=!1;c(a,b,d,!0,m)}})});var c=function(a,b,c,d,e){var f=b.position,g=p[c],a=A[c],b=B[c],j;switch(c){case "north":j=f.top;break;case "west":j=f.left;break;case "south":j=U.offsetHeight-f.top-a.spacing_open;break;case "east":j=U.offsetWidth-f.left-a.spacing_open}j-=U["inset"+g.side];d?(!1!==I("ondrag_end",c)&&Pa(c,j,!1,!0),ka(),b.isSliding&&e&&H(e,!0)):Math.abs(j-b.size)<a.liveResizingTolerance||
(Pa(c,j,!1,!0),La.each(ua))}},ua=function(){var a=e(this),b=a.data("layoutMask"),b=B[b];"IFRAME"==b.tagName&&b.isVisible&&a.css({top:b.offsetTop,left:b.offsetLeft,width:b.outerWidth,height:b.outerHeight})},H=function(a,b){var c=a?a.split(","):e.layout.config.allPanes,d=A.zIndexes,f,g;e.each(c,function(a,c){g=B[c];f=A[c];g.isVisible&&(!b&&f.maskContents||f.maskObjects)&&Sa(c).each(function(){ua.call(this);this.style.zIndex=g.isSliding?d.pane_sliding+1:d.pane_normal+1;this.style.display="block"})})},
ka=function(){var a;e.each(e.layout.config.borderPanes,function(b,c){if(B[c].isResizing)return a=!0,!1});a||La.hide()},Sa=function(a){for(var b=e([]),c,d=0,f=La.length;d<f;d++)c=La.eq(d),c.data("layoutMask")===a&&(b=b.add(c));if(b.length)return b;b=L[a];c=B[a];var d=A[a],f=A.zIndexes,g=e([]),j,k,l,m,o;if(d.maskContents||d.maskObjects)for(o=0;o<(d.maskObjects?2:1);o++)j=d.maskObjects&&0==o,k=document.createElement(j?"iframe":"div"),l=e(k).data("layoutMask",a),k.className="ui-layout-mask ui-layout-mask-"+
a,m=k.style,m.display="block",m.position="absolute",j&&(k.frameborder=0,k.src="about:blank",m.opacity=0,m.filter="Alpha(Opacity='0')",m.border=0),"IFRAME"==c.tagName?(m.zIndex=f.pane_normal+1,X.append(k)):(l.addClass("ui-layout-mask-inside-pane"),m.zIndex=d.maskZindex||f.content_mask,m.top=0,m.left=0,m.width="100%",m.height="100%",b.append(k)),g=g.add(k),La=La.add(k);return g},qa=function(a,b,c,d){if(Q()){var a=v.call(this,a),f=L[a],g=ta[a],j=ha[a],k=xa[a];f&&e.isEmptyObject(f.data())&&(f=!1);g&&
e.isEmptyObject(g.data())&&(g=!1);j&&e.isEmptyObject(j.data())&&(j=!1);k&&e.isEmptyObject(k.data())&&(k=!1);f&&f.stop(!0,!0);var l=A[a],m=E[a]||(f?f.data("layout"):0)||(g?g.data("layout"):0)||null;if((void 0!==d?d:l.destroyChildLayout)&&m&&!m.destroyed)m.destroy(!0),m.destroyed&&(m=null);f&&b&&!m?f.remove():f&&f[0]&&(b=l.paneClass,d=b+"-"+a,b=[b,b+"-open",b+"-closed",b+"-sliding",d,d+"-open",d+"-closed",d+"-sliding"],e.merge(b,$(f,!0)),f.removeClass(b.join(" ")).removeData("parentLayout").removeData("layoutPane").removeData("layoutRole").removeData("layoutEdge").removeData("autoHidden").unbind("."+
ma),g&&g.data("layout")?(g.width(g.width()),m.resizeAll()):g&&g.css(g.data("layoutCSS")).removeData("layoutCSS").removeData("layoutRole"),f.data("layout")||f.css(f.data("layoutCSS")).removeData("layoutCSS"));k&&k.remove();j&&j.remove();aa[a]=L[a]=ta[a]=ha[a]=xa[a]=E[a]=!1;c||oa()}},Ra=function(a){var b=L[a],c=b[0].style;A[a].useOffscreenClose?(b.data(p.offscreenReset)||b.data(p.offscreenReset,{left:c.left,right:c.right}),b.css(p.offscreenCSS)):b.hide().removeData(p.offscreenReset)},Wa=function(a){var b=
L[a],a=A[a],c=p.offscreenCSS,d=b.data(p.offscreenReset),e=b[0].style;b.show().removeData(p.offscreenReset);if(a.useOffscreenClose&&d&&(e.left==c.left&&(e.left=d.left),e.right==c.right))e.right=d.right},bb=function(a,b){if(Q()){var c=v.call(this,a),d=A[c],e=B[c],f=ha[c];L[c]&&!e.isHidden&&!(B.initialized&&!1===I("onhide_start",c))&&(e.isSliding=!1,f&&f.hide(),!B.initialized||e.isClosed?(e.isClosed=!0,e.isHidden=!0,e.isVisible=!1,B.initialized||Ra(c),wa("horz"===p[c].dir?"":"center"),(B.initialized||
d.triggerEventsOnLoad)&&I("onhide_end",c)):(e.isHiding=!0,na(c,!1,b)))}},Ca=function(a,b,c,d){if(Q()){var a=v.call(this,a),e=B[a];L[a]&&e.isHidden&&!1!==I("onshow_start",a)&&(e.isSliding=!1,e.isShowing=!0,!1===b?na(a,!0):Ma(a,!1,c,d))}},pa=function(a,b){if(Q()){var c=x(a),d=v.call(this,a),e=B[d];c&&c.stopImmediatePropagation();e.isHidden?Ca(d):e.isClosed?Ma(d,!!b):na(d)}},cb=function(a){var b=B[a];Ra(a);b.isClosed=!0;b.isVisible=!1},na=function(a,b,c,d){function e(){k.isMoving=!1;Qa(f,!0);var a=p.oppositeEdge[f];
B[a].noRoom&&(T(a),Ha(a));ka();if(!d&&(B.initialized||j.triggerEventsOnLoad))o||I("onclose_end",f),o&&I("onshow_end",f),q&&I("onhide_end",f)}var f=v.call(this,a);if(!B.initialized&&L[f])cb(f);else if(Q()){var g=L[f],j=A[f],k=B[f],l=p[f],m,o,q;X.queue(function(a){if(!g||!j.closable&&!k.isShowing&&!k.isHiding||!b&&k.isClosed&&!k.isShowing)return a();var d=!k.isShowing&&!1===I("onclose_start",f);o=k.isShowing;q=k.isHiding;delete k.isShowing;delete k.isHiding;if(d)return a();m=!c&&!k.isClosed&&"none"!=
j.fxName_close;k.isMoving=!0;k.isClosed=!0;k.isVisible=!1;q?k.isHidden=!0:o&&(k.isHidden=!1);k.isSliding?ya(f,!1):wa("horz"===p[f].dir?"":"center",!1);Xa(f);m?(H("center"+("horz"==l.dir?",west,east":""),!0),va(f,!0),g.hide(j.fxName_close,j.fxSettings_close,j.fxSpeed_close,function(){va(f,false);k.isClosed&&e();a()})):(Ra(f),e(),a())})}},Xa=function(a){var b=ha[a],c=xa[a],d=A[a],f=p[a].side.toLowerCase(),g=d.resizerClass,j=d.togglerClass,k="-"+a;b.css(f,U["inset"+p[a].side]).removeClass(g+"-open "+
g+k+"-open").removeClass(g+"-sliding "+g+k+"-sliding").addClass(g+"-closed "+g+k+"-closed").unbind("dblclick."+ma);d.resizable&&e.layout.plugins.draggable&&b.draggable("disable").removeClass("ui-state-disabled").css("cursor","default").attr("title","");c&&(c.removeClass(j+"-open "+j+k+"-open").addClass(j+"-closed "+j+k+"-closed").attr("title",d.togglerTip_closed),c.children(".content-open").hide(),c.children(".content-closed").css("display","block"));Ua(a,!1);B.initialized&&Ka()},Ma=function(a,b,
c,d){function e(){k.isMoving=!1;N(f);k.isSliding||(ka(),wa("vert"==p[f].dir?"center":"",!1));Ea(f)}if(Q()){var f=v.call(this,a),g=L[f],j=A[f],k=B[f],l=p[f],m,o;X.queue(function(a){if(!g||!j.resizable&&!j.closable&&!k.isShowing||k.isVisible&&!k.isSliding)return a();if(k.isHidden&&!k.isShowing)a(),Ca(f,!0);else{j.autoResize&&k.size!=j.size?Oa(f,j.size,!0,!0,!0):T(f,b);var q=I("onopen_start",f);if("abort"===q)return a();"NC"!==q&&T(f,b);if(k.minSize>k.maxSize)return Ua(f,!1),!d&&j.noRoomToOpenTip&&alert(j.noRoomToOpenTip),
a();b?ya(f,!0):k.isSliding?ya(f,!1):j.slidable&&Qa(f,!1);k.noRoom=!1;Ha(f);o=k.isShowing;delete k.isShowing;m=!c&&k.isClosed&&"none"!=j.fxName_open;k.isMoving=!0;k.isVisible=!0;k.isClosed=!1;o&&(k.isHidden=!1);m?(q="center"+("horz"==l.dir?",west,east":""),k.isSliding&&(q+=","+p.oppositeEdge[f]),H(q,!0),va(f,!0),g.show(j.fxName_open,j.fxSettings_open,j.fxSpeed_open,function(){va(f,false);k.isVisible&&e();a()})):(Wa(f),e(),a())}})}},Ea=function(a,b){var c=L[a],d=ha[a],f=xa[a],g=A[a],j=B[a],k=p[a].side.toLowerCase(),
l=g.resizerClass,m=g.togglerClass,o="-"+a;d.css(k,U["inset"+p[a].side]+ba(a)).removeClass(l+"-closed "+l+o+"-closed").addClass(l+"-open "+l+o+"-open");j.isSliding?d.addClass(l+"-sliding "+l+o+"-sliding"):d.removeClass(l+"-sliding "+l+o+"-sliding");g.resizerDblClickToggle&&d.bind("dblclick",pa);O(0,d);g.resizable&&e.layout.plugins.draggable?d.draggable("enable").css("cursor",g.resizerCursor).attr("title",g.resizerTip):j.isSliding||d.css("cursor","default");f&&(f.removeClass(m+"-closed "+m+o+"-closed").addClass(m+
"-open "+m+o+"-open").attr("title",g.togglerTip_open),O(0,f),f.children(".content-closed").hide(),f.children(".content-open").css("display","block"));Ua(a,!j.isSliding);e.extend(j,y(c));B.initialized&&(Ka(),Ya(a,!0));if(!b&&(B.initialized||g.triggerEventsOnLoad)&&c.is(":visible"))I("onopen_end",a),j.isShowing&&I("onshow_end",a),B.initialized&&I("onresize_end",a)},Ga=function(a){function b(){e.isClosed?e.isMoving||Ma(d,!0):ya(d,!0)}if(Q()){var c=x(a),d=v.call(this,a),e=B[d],a=A[d].slideDelay_open;
c&&c.stopImmediatePropagation();e.isClosed&&c&&"mouseenter"===c.type&&0<a?F.set(d+"_openSlider",b,a):b()}},ga=function(a){function c(){g.isClosed?ya(f,!1):g.isMoving||na(f)}if(Q()){var d=x(a),f=v.call(this,a),a=A[f],g=B[f],j=g.isMoving?1E3:300;!g.isClosed&&!g.isResizing&&("click"===a.slideTrigger_close?c():a.preventQuickSlideClose&&g.isMoving||a.preventPrematureSlideClose&&d&&e.layout.isMouseOverElem(d,L[f])||(d?F.set(f+"_closeSlider",c,b(a.slideDelay_close,j)):c()))}},va=function(a,b){var c=L[a],
d=B[a],e=A[a],f=A.zIndexes;b?(c.css({zIndex:f.pane_animate}),"south"==a?c.css({top:U.insetTop+U.innerHeight-c.outerHeight()}):"east"==a&&c.css({left:U.insetLeft+U.innerWidth-c.outerWidth()})):(c.css({zIndex:d.isSliding?f.pane_sliding:f.pane_normal}),"south"==a?c.css({top:"auto"}):"east"==a&&!c.css("left").match(/\-99999/)&&c.css({left:"auto"}),m.msie&&(e.fxOpacityFix&&"slide"!=e.fxName_open&&c.css("filter")&&1==c.css("opacity"))&&c[0].style.removeAttribute("filter"))},Qa=function(a,b){var c=A[a],
d=ha[a],e=c.slideTrigger_open.toLowerCase();if(d&&(!b||c.slidable))e.match(/mouseover/)?e=c.slideTrigger_open="mouseenter":e.match(/click|dblclick|mouseenter/)||(e=c.slideTrigger_open="click"),d[b?"bind":"unbind"](e+"."+ma,Ga).css("cursor",b?c.sliderCursor:"default").attr("title",b?c.sliderTip:"")},ya=function(a,b){function c(b){F.clear(a+"_closeSlider");b.stopPropagation()}var d=A[a],e=B[a],f=A.zIndexes,g=d.slideTrigger_close.toLowerCase(),j=b?"bind":"unbind",k=L[a],l=ha[a];e.isSliding=b;F.clear(a+
"_closeSlider");b&&Qa(a,!1);k.css("zIndex",b?f.pane_sliding:f.pane_normal);l.css("zIndex",b?f.pane_sliding+2:f.resizer_normal);g.match(/click|mouseleave/)||(g=d.slideTrigger_close="mouseleave");l[j](g,ga);"mouseleave"===g&&(k[j]("mouseleave."+ma,ga),l[j]("mouseenter."+ma,c),k[j]("mouseenter."+ma,c));b?"click"===g&&!d.resizable&&(l.css("cursor",b?d.sliderCursor:"default"),l.attr("title",b?d.togglerTip_open:"")):F.clear(a+"_closeSlider")},Ha=function(a,b,c,d){var b=A[a],f=B[a],g=p[a],j=L[a],k=ha[a],
l="vert"===g.dir,m=!1;if("center"===a||l&&f.noVerticalRoom)(m=0<=f.maxHeight)&&f.noRoom?(Wa(a),k&&k.show(),f.isVisible=!0,f.noRoom=!1,l&&(f.noVerticalRoom=!1),N(a)):!m&&!f.noRoom&&(Ra(a),k&&k.hide(),f.isVisible=!1,f.noRoom=!0);if("center"!==a)if(f.minSize<=f.maxSize){if(f.size>f.maxSize?Oa(a,f.maxSize,c,d,!0):f.size<f.minSize?Oa(a,f.minSize,c,d,!0):k&&(f.isVisible&&j.is(":visible"))&&(c=g.side.toLowerCase(),d=f.size+U["inset"+g.side],e.layout.cssNum(k,c)!=d&&k.css(c,d)),f.noRoom)f.wasOpen&&b.closable?
b.autoReopen?Ma(a,!1,!0,!0):f.noRoom=!1:Ca(a,f.wasOpen,!0,!0)}else f.noRoom||(f.noRoom=!0,f.wasOpen=!f.isClosed&&!f.isSliding,f.isClosed||(b.closable?na(a,!0,!0):bb(a,!0)))},Pa=function(a,b,c,d){if(Q()){var a=v.call(this,a),e=A[a],f=B[a],f=e.livePaneResizing&&!f.isResizing;e.autoResize=!1;Oa(a,b,c,f,d)}},Oa=function(a,d,f,g,j){function k(){for(var a="width"===z?q.outerWidth():q.outerHeight(),a=[{pane:l,count:1,target:d,actual:a,correct:d===a,attempt:d,cssSize:G}],c=a[0],j="Inaccurate size after resizing the "+
l+"-pane.";!c.correct;){thisTry={pane:l,count:c.count+1,target:d};thisTry.attempt=c.actual>d?b(0,c.attempt-(c.actual-d)):b(0,c.attempt+(d-c.actual));thisTry.cssSize=("horz"==p[l].dir?t:u)(L[l],thisTry.attempt);q.css(z,thisTry.cssSize);thisTry.actual="width"==z?q.outerWidth():q.outerHeight();thisTry.correct=d===thisTry.actual;A.showDebugMessages&&(1===a.length&&(J(j,!1),J(c,!1)),J(thisTry,!1));if(3<a.length)break;a.push(thisTry);c=a[a.length-1]}o.size=d;e.extend(o,y(q));o.isVisible&&q.is(":visible")&&
(r&&r.css(x,d+U[C]),Ya(l));!f&&(!D&&B.initialized&&o.isVisible)&&I("onresize_end",l);f||(o.isSliding||wa("horz"==p[l].dir?"":"center",D,g),Ka());c=p.oppositeEdge[l];d<F&&B[c].noRoom&&(T(c),Ha(c,!1,f));A.showDebugMessages&&1<a.length&&J(j+"\nSee the Error Console for details.",!0)}if(Q()){var l=v.call(this,a),m=A[l],o=B[l],q=L[l],r=ha[l],x=p[l].side.toLowerCase(),z=p[l].sizeType.toLowerCase(),C="inset"+p[l].side,D=o.isResizing&&!m.triggerEventsDuringLiveResize,E=!0!==j&&m.animatePaneSizing,F,G;X.queue(function(a){T(l);
F=o.size;d=ca(l,d);d=b(d,ca(l,m.minSize));d=c(d,o.maxSize);if(d<o.minSize)a(),Ha(l,!1,f);else{if(!g&&d===F)return a();!f&&(B.initialized&&o.isVisible)&&I("onresize_start",l);G=("horz"==p[l].dir?t:u)(L[l],d);if(E&&q.is(":visible")){var j=e.layout.effects.size[l]||e.layout.effects.size.all,j=m.fxSettings_size.easing||j.easing,r=A.zIndexes,v={};v[z]=G+"px";o.isMoving=!0;q.css({zIndex:r.pane_animate}).show().animate(v,m.fxSpeed_size,j,function(){q.css({zIndex:o.isSliding?r.pane_sliding:r.pane_normal});
o.isMoving=!1;k();a()})}else q.css(z,G),q.is(":visible")?k():(o.size=d,e.extend(o,y(q))),a()}})}},wa=function(a,c,d){a=(a?a:"east,west,center").split(",");e.each(a,function(a,f){if(L[f]){var g=A[f],j=B[f],k=L[f],l=!0,m={},l={top:ba("north",!0),bottom:ba("south",!0),left:ba("west",!0),right:ba("east",!0),width:0,height:0};l.width=U.innerWidth-l.left-l.right;l.height=U.innerHeight-l.bottom-l.top;l.top+=U.insetTop;l.bottom+=U.insetBottom;l.left+=U.insetLeft;l.right+=U.insetRight;e.extend(j,y(k));if("center"===
f){if(!d&&j.isVisible&&l.width===j.outerWidth&&l.height===j.outerHeight)return!0;e.extend(j,D(f),{maxWidth:l.width,maxHeight:l.height});m=l;m.width=u(k,m.width);m.height=t(k,m.height);l=0<=m.width&&0<=m.height;if(!B.initialized&&g.minWidth>j.outerWidth){var g=g.minWidth-j.outerWidth,o=A.east.minSize||0,q=A.west.minSize||0,p=B.east.size,r=B.west.size,v=p,x=r;0<g&&(B.east.isVisible&&p>o)&&(v=b(p-o,p-g),g-=p-v);0<g&&(B.west.isVisible&&r>q)&&(x=b(r-q,r-g),g-=r-x);if(0===g){p!=o&&Oa("east",v,!0,d,!0);
r!=q&&Oa("west",x,!0,d,!0);wa("center",c,d);return}}}else{j.isVisible&&!j.noVerticalRoom&&e.extend(j,y(k),D(f));if(!d&&!j.noVerticalRoom&&l.height===j.outerHeight)return!0;m.top=l.top;m.bottom=l.bottom;m.height=t(k,l.height);j.maxHeight=m.height;l=0<=j.maxHeight;l||(j.noVerticalRoom=!0)}l?(!c&&B.initialized&&I("onresize_start",f),k.css(m),Ka(f),j.noRoom&&(!j.isClosed&&!j.isHidden)&&Ha(f),j.isVisible&&(e.extend(j,y(k)),B.initialized&&Ya(f))):!j.noRoom&&j.isVisible&&Ha(f);if(!j.isVisible)return!0;"center"===
f&&(j=e.layout.browser,j=j.isIE6||j.msie&&!e.support.boxModel,L.north&&(j||"IFRAME"==B.north.tagName)&&L.north.css("width",u(L.north,U.innerWidth)),L.south&&(j||"IFRAME"==B.south.tagName)&&L.south.css("width",u(L.south,U.innerWidth)));!c&&B.initialized&&I("onresize_end",f)}})},oa=function(){if(B.initialized){if(X.is(":visible:")&&(e.extend(B.container,y(X)),U.outerHeight)){if(!1===I("onresizeall_start"))return!1;var a,b,c;e.each(["south","north","east","west"],function(a,d){L[d]&&(c=B[d],b=A[d],b.autoResize&&
c.size!=b.size?Oa(d,b.size,!0,!0,!0):(T(d),Ha(d,!1,!0,!0)))});wa("",!0,!0);Ka();b=A;e.each(p.allPanes,function(b,c){(a=L[c])&&B[c].isVisible&&I("onresize_end",c)});I("onresizeall_end")}}else K()},fb=function(a){a=v.call(this,a);if(A[a].resizeChildLayout){var b=L[a],c=ta[a],d=aa[a],e=E[a];d.child&&!e&&(e=d.child.container,e=E[a]=(e?e.data("layout"):0)||null);e&&e.destroyed&&(e=E[a]=null);e||(e=E[a]=b.data("layout")||(c?c.data("layout"):0)||null);d.child=E[a];e&&e.resizeAll()}},Ya=function(a,c){if(Q()){var d=
v.call(this,a),d=d?d.split(","):p.allPanes;e.each(d,function(a,d){function e(a){return b(l.css.paddingBottom,parseInt(a.css("marginBottom"),10)||0)}function f(){var a=A[d].contentIgnoreSelector,a=j.nextAll().not(a||":lt(0)"),b=a.filter(":visible"),c=b.filter(":last");m={top:j[0].offsetTop,height:j.outerHeight(),numFooters:a.length,hiddenFooters:a.length-b.length,spaceBelow:0};m.spaceAbove=m.top;m.bottom=m.top+m.height;m.spaceBelow=c.length?c[0].offsetTop+c.outerHeight()-m.bottom+e(c):e(j)}var g=L[d],
j=ta[d],k=A[d],l=B[d],m=l.content;if(!g||!j||!g.is(":visible"))return!0;if(!j.length&&(ia(d,!1),!j))return;if(!1!==I("onsizecontent_start",d)){if(!l.isMoving&&!l.isResizing||k.liveContentResizing||c||void 0==m.top)f(),0<m.hiddenFooters&&"hidden"===g.css("overflow")&&(g.css("overflow","visible"),f(),g.css("overflow","hidden"));g=l.innerHeight-(m.spaceAbove-l.css.paddingTop)-(m.spaceBelow-l.css.paddingBottom);if(!j.is(":visible")||m.height!=g)Z(j,g,!0),m.height=g;B.initialized&&I("onsizecontent_end",
d)}})}},Ka=function(b){b=(b=v.call(this,b))?b.split(","):p.borderPanes;e.each(b,function(b,c){var d=A[c],f=B[c],g=L[c],k=ha[c],l=xa[c],m;if(g&&k){var o=p[c].dir,q=f.isClosed?"_closed":"_open",r=d["spacing"+q],v=d["togglerAlign"+q],q=d["togglerLength"+q],x;if(0===r)k.hide();else{!f.noRoom&&!f.isHidden&&k.show();"horz"===o?(x=U.innerWidth,f.resizerLength=x,g=e.layout.cssNum(g,"left"),k.css({width:u(k,x),height:t(k,r),left:-9999<g?g:U.insetLeft})):(x=g.outerHeight(),f.resizerLength=x,k.css({height:t(k,
x),width:u(k,r),top:U.insetTop+ba("north",!0)}));O(d,k);if(l){if(0===q||f.isSliding&&d.hideTogglerOnSlide){l.hide();return}l.show();if(!(0<q)||"100%"===q||q>x)q=x,v=0;else if(a(v))switch(v){case "top":case "left":v=0;break;case "bottom":case "right":v=x-q;break;default:v=j((x-q)/2)}else g=parseInt(v,10),v=0<=v?g:x-q+g;if("horz"===o){var y=u(l,q);l.css({width:y,height:t(l,r),left:v,top:0});l.children(".content").each(function(){m=e(this);m.css("marginLeft",j((y-m.outerWidth())/2))})}else{var z=t(l,
q);l.css({height:z,width:u(l,r),top:v,left:0});l.children(".content").each(function(){m=e(this);m.css("marginTop",j((z-m.outerHeight())/2))})}O(0,l)}if(!B.initialized&&(d.initHidden||f.noRoom))k.hide(),l&&l.hide()}}})},Ta=function(a){if(Q()){var b=v.call(this,a),a=xa[b],c=A[b];a&&(c.closable=!0,a.bind("click."+ma,function(a){a.stopPropagation();pa(b)}).css("visibility","visible").css("cursor","pointer").attr("title",B[b].isClosed?c.togglerTip_closed:c.togglerTip_open).show())}},Ua=function(a,b){e.layout.plugins.buttons&&
e.each(B[a].pins,function(c,d){e.layout.buttons.setPinState(aa,e(d),a,b)})},X=e(this).eq(0);if(!X.length)return A.showErrorMessages&&J(r.errContainerMissing,!0),null;if(X.data("layoutContainer")&&X.data("layout"))return X.data("layout");var L={},ta={},ha={},xa={},La=e([]),U=B.container,ma=B.id,aa={options:A,state:B,container:X,panes:L,contents:ta,resizers:ha,togglers:xa,hide:bb,show:Ca,toggle:pa,open:Ma,close:na,slideOpen:Ga,slideClose:ga,slideToggle:function(a){a=v.call(this,a);pa(a,!0)},setSizeLimits:T,
_sizePane:Oa,sizePane:Pa,sizeContent:Ya,swapPanes:function(a,c){function d(a){var b=L[a],c=ta[a];return!b?!1:{pane:a,P:b?b[0]:!1,C:c?c[0]:!1,state:e.extend(!0,{},B[a]),options:e.extend(!0,{},A[a])}}function f(a,c){if(a){var d=a.P,g=a.C,j=a.pane,k=p[c],m=k.side.toLowerCase(),o="inset"+k.side,q=e.extend({},B[c]),r=A[c],t={resizerCursor:r.resizerCursor};e.each(["fxName","fxSpeed","fxSettings"],function(a,b){t[b+"_open"]=r[b+"_open"];t[b+"_close"]=r[b+"_close"];t[b+"_size"]=r[b+"_size"]});L[c]=e(d).data({layoutPane:aa[c],
layoutEdge:c}).css(p.hidden).css(k.cssReq);ta[c]=g?e(g):!1;A[c]=e.extend({},a.options,t);B[c]=e.extend({},a.state);d.className=d.className.replace(RegExp(r.paneClass+"-"+j,"g"),r.paneClass+"-"+c);Da(c);k.dir!=p[j].dir?(d=l[c]||0,T(c),d=b(d,B[c].minSize),Pa(c,d,!0,!0)):ha[c].css(m,U[o]+(B[c].isVisible?ba(c):0));a.state.isVisible&&!q.isVisible?Ea(c,!0):(Xa(c),Qa(c,!0));a=null}}if(Q()){var g=v.call(this,a);B[g].edge=c;B[c].edge=g;if(!1===I("onswap_start",g)||!1===I("onswap_start",c))B[g].edge=g,B[c].edge=
c;else{var j=d(g),k=d(c),l={};l[g]=j?j.state.size:0;l[c]=k?k.state.size:0;L[g]=!1;L[c]=!1;B[g]={};B[c]={};xa[g]&&xa[g].remove();xa[c]&&xa[c].remove();ha[g]&&ha[g].remove();ha[c]&&ha[c].remove();ha[g]=ha[c]=xa[g]=xa[c]=!1;f(j,c);f(k,g);j=k=l=null;L[g]&&L[g].css(p.visible);L[c]&&L[c].css(p.visible);oa();I("onswap_end",g);I("onswap_end",c)}}},initContent:ia,addPane:sa,removePane:qa,createChildLayout:P,enableClosable:Ta,disableClosable:function(a,b){if(Q()){var c=v.call(this,a),d=xa[c];d&&(A[c].closable=
!1,B[c].isClosed&&Ma(c,!1,!0),d.unbind("."+ma).css("visibility",b?"hidden":"visible").css("cursor","default").attr("title",""))}},enableSlidable:function(a){if(Q()){var a=v.call(this,a),b=ha[a];b&&b.data("draggable")&&(A[a].slidable=!0,s.isClosed&&Qa(a,!0))}},disableSlidable:function(a){if(Q()){var a=v.call(this,a),b=ha[a];b&&(A[a].slidable=!1,B[a].isSliding?na(a,!1,!0):(Qa(a,!1),b.css("cursor","default").attr("title",""),O(null,b[0])))}},enableResizable:function(a){if(Q()){var a=v.call(this,a),b=
ha[a],c=A[a];b&&b.data("draggable")&&(c.resizable=!0,b.draggable("enable"),B[a].isClosed||b.css("cursor",c.resizerCursor).attr("title",c.resizerTip))}},disableResizable:function(a){if(Q()){var a=v.call(this,a),b=ha[a];b&&b.data("draggable")&&(A[a].resizable=!1,b.draggable("disable").css("cursor","default").attr("title",""),O(null,b[0]))}},allowOverflow:d,resetOverflow:l,destroy:function(a){e(window).unbind("."+ma);e(document).unbind("."+ma);X.clearQueue().removeData("layout").removeData("layoutContainer").removeClass(A.containerClass).unbind("."+
ma);La.remove();e.each(p.allPanes,function(b,c){qa(c,!1,!0,a)});X.data("layoutCSS")&&!X.data("layoutRole")&&X.css(X.data("layoutCSS")).removeData("layoutCSS");"BODY"===U.tagName&&(X=e("html")).data("layoutCSS")&&X.css(X.data("layoutCSS")).removeData("layoutCSS");g(aa,e.layout.onDestroy);S();for(n in aa)n.match(/^(container|options)$/)||delete aa[n];aa.destroyed=!0;return aa},initPanes:Q,resizeAll:oa,runCallbacks:I,hasParentLayout:!1,children:E,north:!1,south:!1,west:!1,east:!1,center:!1};return"cancel"===
function(){fa();var a=A;B.creatingLayout=!0;g(aa,e.layout.onCreate);if(!1===I("onload_start"))return"cancel";var b=X[0],c=U.tagName=b.tagName,d=U.id=b.id,f=U.className=b.className,b=A,j=b.name,k="BODY"===c,l={},m=X.data("parentLayout"),o=X.data("layoutEdge"),q=m&&o;U.selector=X.selector.split(".slice")[0];U.ref=(b.name?b.name+" layout / ":"")+c+(d?"#"+d:f?".["+f+"]":"");X.data({layout:aa,layoutContainer:ma}).addClass(b.containerClass);c={destroy:"",initPanes:"",resizeAll:"resizeAll",resize:"resizeAll"};
for(j in c)X.bind("layout"+j.toLowerCase()+"."+ma,aa[c[j]||j]);q&&(aa.hasParentLayout=!0,m[o].child=m.children[o]=X.data("layout"));X.data("layoutCSS")||(k?(l=e.extend(z(X,"overflow,position,margin,padding,border"),{height:X.css("height"),overflow:X.css("overflow"),overflowX:X.css("overflowX"),overflowY:X.css("overflowY")}),c=e("html"),c.data("layoutCSS",{height:"auto",overflow:c.css("overflow"),overflowX:c.css("overflowX"),overflowY:c.css("overflowY")})):l=z(X,"overflow,position,margin,padding,border,top,bottom,left,right,width,height,overflow,overflowX,overflowY"),
X.data("layoutCSS",l));try{if(k)e("html").css({height:"100%",overflow:"hidden",overflowX:"hidden",overflowY:"hidden"}),e("body").css({position:"relative",height:"100%",overflow:"hidden",overflowX:"hidden",overflowY:"hidden",margin:0,padding:0,border:"none"}),e.extend(U,y(X));else{var l={overflow:"hidden",overflowX:"hidden",overflowY:"hidden"},p=X.css("position");X.css("height");if(!q&&(!p||!p.match(/fixed|absolute|relative/)))l.position="relative";X.css(l);X.is(":visible")&&(e.extend(U,y(X)),b.showErrorMessages&&
1>U.innerHeight&&J(r.errContainerHeight.replace(/CONTAINER/,U.ref),!0))}}catch(t){}V();e(window).bind("unload."+ma,S);g(aa,e.layout.onLoad);a.initPanes&&K();delete B.creatingLayout;return B.initialized}()?null:aa};e.ui||(e.ui={});e.ui.cookie={acceptsCookies:!!navigator.cookieEnabled,read:function(a){for(var b=document.cookie,b=b?b.split(";"):[],c,g=0,j=b.length;g<j;g++){c=e.trim(b[g]).split("=");if(c[0]==a)return decodeURIComponent(c[1])}return null},write:function(a,b,c){var e="",g="",j=false,c=
c||{},l=c.expires;if(l&&l.toUTCString)g=l;else if(l===null||typeof l==="number"){g=new Date;if(l>0)g.setDate(g.getDate()+l);else{g.setFullYear(1970);j=true}}g&&(e=e+(";expires="+g.toUTCString()));c.path&&(e=e+(";path="+c.path));c.domain&&(e=e+(";domain="+c.domain));c.secure&&(e=e+";secure");document.cookie=a+"="+(j?"":encodeURIComponent(b))+e},clear:function(a){e.ui.cookie.write(a,"",{expires:-1})}};e.cookie||(e.cookie=function(a,b,c){var g=e.ui.cookie;if(b===null)g.clear(a);else{if(b===void 0)return g.read(a);
g.write(a,b,c)}});e.layout.plugins.stateManagement=!0;e.layout.config.optionRootKeys.push("stateManagement");e.layout.defaults.stateManagement={enabled:!1,autoSave:!0,autoLoad:!0,stateKeys:"north.size,south.size,east.size,west.size,north.isClosed,south.isClosed,east.isClosed,west.isClosed,north.isHidden,south.isHidden,east.isHidden,west.isHidden",cookie:{name:"",domain:"",path:"",expires:"",secure:!1}};e.layout.optionsMap.layout.push("stateManagement");e.layout.state={saveCookie:function(a,b,c){var g=
a.options,j=g.stateManagement,c=e.extend(true,{},j.cookie,c||null),a=a.state.stateData=a.readState(b||j.stateKeys);e.ui.cookie.write(c.name||g.name||"Layout",e.layout.state.encodeJSON(a),c);return e.extend(true,{},a)},deleteCookie:function(a){a=a.options;e.ui.cookie.clear(a.stateManagement.cookie.name||a.name||"Layout")},readCookie:function(a){a=a.options;return(a=e.ui.cookie.read(a.stateManagement.cookie.name||a.name||"Layout"))?e.layout.state.decodeJSON(a):{}},loadCookie:function(a){var b=e.layout.state.readCookie(a);
if(b){a.state.stateData=e.extend(true,{},b);a.loadState(b)}return b},loadState:function(a,b,c){b=e.layout.transformData(b);if(!e.isEmptyObject(b)){e.extend(true,a.options,b);if(a.state.initialized){var g,j,l,m,u,t=c===false;e.each(e.layout.config.borderPanes,function(c,d){state=a.state[d];j=b[d];if(typeof j=="object"){l=j.size;u=j.initClosed;m=j.initHidden;(g=state.isVisible)||a.sizePane(d,l,false,false);m===true?a.hide(d,t):u===false?a.open(d,false,t):u===true?a.close(d,false,t):m===false&&a.show(d,
false,t);g&&a.sizePane(d,l,false,t)}})}}},readState:function(a,b){var c={},g={isClosed:"initClosed",isHidden:"initHidden"},j=a.state,l=e.layout.config.allPanes,m,u,t;if(!b)b=a.options.stateManagement.stateKeys;e.isArray(b)&&(b=b.join(","));for(var b=b.replace(/__/g,".").split(","),y=0,z=b.length;y<z;y++){m=b[y].split(".");u=m[0];m=m[1];if(!(e.inArray(u,l)<0)){t=j[u][m];if(t!=void 0){m=="isClosed"&&j[u].isSliding&&(t=true);(c[u]||(c[u]={}))[g[m]?g[m]:m]=t}}}return c},encodeJSON:function(a){function b(a){var c=
[],e=0,f,g,j;for(f in a){g=a[f];j=typeof g;j=="string"?g='"'+g+'"':j=="object"&&(g=b(g));c[e++]='"'+f+'":'+g}return"{"+c.join(",")+"}"}return b(a)},decodeJSON:function(a){try{return e.parseJSON?e.parseJSON(a):window.eval("("+a+")")||{}}catch(b){return{}}},_create:function(a){var b=e.layout.state;e.extend(a,{readCookie:function(){return b.readCookie(a)},deleteCookie:function(){b.deleteCookie(a)},saveCookie:function(c,d){return b.saveCookie(a,c,d)},loadCookie:function(){return b.loadCookie(a)},loadState:function(c,
d){b.loadState(a,c,d)},readState:function(c){return b.readState(a,c)},encodeJSON:b.encodeJSON,decodeJSON:b.decodeJSON});a.state.stateData={};var c=a.options.stateManagement;if(c.enabled)c.autoLoad?a.loadCookie():a.state.stateData=a.readCookie()},_unload:function(a){var b=a.options.stateManagement;if(b.enabled)b.autoSave?a.saveCookie():a.state.stateData=a.readState()}};e.layout.onCreate.push(e.layout.state._create);e.layout.onUnload.push(e.layout.state._unload);e.layout.plugins.buttons=!0;e.layout.defaults.autoBindCustomButtons=
!1;e.layout.optionsMap.layout.push("autoBindCustomButtons");l=e.layout.language;e.layout.buttons={init:function(a){var b=a.options.name||"",c;e.each(["toggle","open","close","pin","toggle-slide","open-slide"],function(g,j){e.each(e.layout.config.borderPanes,function(g,l){e(".ui-layout-button-"+j+"-"+l).each(function(){c=e(this).data("layoutName")||e(this).attr("layoutName");(c==void 0||c===b)&&a.bindButton(this,j,l)})})})},get:function(a,b,c,g){var j=e(b),a=a.options,m=a.showErrorMessages;if(j.length)if(e.inArray(c,
e.layout.config.borderPanes)<0){m&&e.layout.msg(l.errButton+l.pane+": "+c,true);j=e("")}else{b=a[c].buttonClass+"-"+g;j.addClass(b+" "+b+"-"+c).data("layoutName",a.name)}else m&&e.layout.msg(l.errButton+l.selector+": "+b,true);return j},bind:function(a,b,c,g){var j=e.layout.buttons;switch(c.toLowerCase()){case "toggle":j.addToggle(a,b,g);break;case "open":j.addOpen(a,b,g);break;case "close":j.addClose(a,b,g);break;case "pin":j.addPin(a,b,g);break;case "toggle-slide":j.addToggle(a,b,g,true);break;
case "open-slide":j.addOpen(a,b,g,true)}return a},addToggle:function(a,b,c,g){e.layout.buttons.get(a,b,c,"toggle").click(function(b){a.toggle(c,!!g);b.stopPropagation()});return a},addOpen:function(a,b,c,g){e.layout.buttons.get(a,b,c,"open").attr("title",l.Open).click(function(b){a.open(c,!!g);b.stopPropagation()});return a},addClose:function(a,b,c){e.layout.buttons.get(a,b,c,"close").attr("title",l.Close).click(function(b){a.close(c);b.stopPropagation()});return a},addPin:function(a,b,c){var g=e.layout.buttons,
j=g.get(a,b,c,"pin");if(j.length){var l=a.state[c];j.click(function(b){g.setPinState(a,e(this),c,l.isSliding||l.isClosed);l.isSliding||l.isClosed?a.open(c):a.close(c);b.stopPropagation()});g.setPinState(a,j,c,!l.isClosed&&!l.isSliding);l.pins.push(b)}return a},setPinState:function(a,b,c,e){var g=b.attr("pin");if(!(g&&e===(g=="down"))){a=a.options[c].buttonClass+"-pin";g=a+"-"+c;c=a+"-up "+g+"-up";a=a+"-down "+g+"-down";b.attr("pin",e?"down":"up").attr("title",e?l.Unpin:l.Pin).removeClass(e?c:a).addClass(e?
a:c)}},syncPinBtns:function(a,b,c){e.each(state[b].pins,function(g,j){e.layout.buttons.setPinState(a,e(j),b,c)})},_load:function(a){var b=e.layout.buttons;e.extend(a,{bindButton:function(c,d,e){return b.bind(a,c,d,e)},addToggleBtn:function(c,d,e){return b.addToggle(a,c,d,e)},addOpenBtn:function(c,d,e){return b.addOpen(a,c,d,e)},addCloseBtn:function(c,d){return b.addClose(a,c,d)},addPinBtn:function(c,d){return b.addPin(a,c,d)}});for(var c=0;c<4;c++)a.state[e.layout.config.borderPanes[c]].pins=[];a.options.autoBindCustomButtons&&
b.init(a)},_unload:function(){}};e.layout.onLoad.push(e.layout.buttons._load);e.layout.plugins.browserZoom=!0;e.layout.defaults.browserZoomCheckInterval=1E3;e.layout.optionsMap.layout.push("browserZoomCheckInterval");e.layout.browserZoom={_init:function(a){e.layout.browserZoom.ratio()!==false&&e.layout.browserZoom._setTimer(a)},_setTimer:function(a){if(!a.destroyed){var b=a.options,c=a.state,g=a.hasParentLayout?5E3:Math.max(b.browserZoomCheckInterval,100);setTimeout(function(){if(!a.destroyed&&b.resizeWithWindow){var g=
e.layout.browserZoom.ratio();if(g!==c.browserZoom){c.browserZoom=g;a.resizeAll()}e.layout.browserZoom._setTimer(a)}},g)}},ratio:function(){function a(b,c){return(parseInt(b,10)/parseInt(c,10)*100).toFixed()}var b=window,c=screen,g=document,j=g.documentElement||g.body,l=e.layout.browser,m=l.version,u,t,y;return l.msie&&m>8||!l.msie?false:c.deviceXDPI?a(c.deviceXDPI,c.systemXDPI):l.webkit&&(u=g.body.getBoundingClientRect)?a(u.left-u.right,g.body.offsetWidth):l.webkit&&(t=b.outerWidth)?a(t,b.innerWidth):
(t=c.width)&&(y=j.clientWidth)?a(t,y):false}};e.layout.onReady.push(e.layout.browserZoom._init)})(m)});define("RepositoryBrowser",["Class","jquery","PubSub","repository-browser-i18n-"+(window&&window.__DEPS__&&window.__DEPS__.lang||"en"),"jstree","jqgrid","jquery-layout"],function(m,e,a,g){function c(a){a.each(function(){e(this).attr("unselectable","on").css({"-moz-user-select":"none","-webkit-user-select":"none","user-select":"none"}).each(function(){this.onselectstart=function(){return!1}})})}var b=
[],j=0,l=(new Date).getTime(),f={repositoryManager:null,repositoryFilter:[],objectTypeFilter:[],renditionFilter:["cmis:none"],filter:["url"],element:null,isFloating:!1,verticalPadding:100,horizontalPadding:50,maxHeight:1E3,minHeight:400,minWidth:400,maxWidth:1200,treeWidth:300,listWidth:"auto",pageSize:8,adaptPageSize:!1,rowHeight:32,rootPath:"",rootFolderId:"aloha",columns:{icon:{title:"",width:30,sortable:!1,resizable:!1},name:{title:"Name",width:200,sorttype:"text"},url:{title:"URL",width:220,
sorttype:"text"},preview:{title:"Preview",width:150,sorttype:"text"}},i18n:{Browsing:"Browsing",Close:"Close","in":"in","Input search text...":"Input search text...",numerous:"numerous",of:"of","Repository Browser":"Repository Browser",Search:"Search","Searching for":"Searching for",Viewing:"Viewing"}};return m.extend({_cachedRepositoryObjects:{},_searchQuery:null,_orderBy:null,_prefilledValue:null,$_grid:null,$_tree:null,$_list:null,_isOpened:!0,_constructor:function(){this.init.apply(this,arguments)},
init:function(c){c=e.extend({},f,c,{i18n:g});if(!c.element||0===c.element.length)c.isFloating=!0,c.element=this._createOverlay();c.maxWidth<c.minWidth&&(c.maxWidth=c.minWidth);e.extend(this,c);this._prefilledValue=this._i18n("Input search text...");this._cachedRepositoryObjects={};this._pagingCount=this._orderBy=this._searchQuery=null;this._pagingOffset=0;this._pagingBtns={first:null,end:null,next:null,prev:null};this._initializeUI();b.push(this);a.pub("repository-browser.initialized",{data:this})},
_i18n:function(a){return this.i18n[a]||a},_initializeUI:function(){this.element.attr("data-repository-browser",++l);this.element.width(this.maxWidth);this.$_grid=this._createGrid(this.element).resize();this._setInitialHeight();this.$_tree=this._createTree(this.$_grid.find(".ui-layout-west"));this.$_list=this._createList(this.$_grid.find(".ui-layout-center"));var a=this,d=this.treeWidth/5;this.$_grid.layout({enableCursorHotkey:!1,west__size:this.treeWidth-1,west__minSize:this.treeWidth-d,west__maxSize:this.treeWidth+
d,center__size:"auto",paneClass:"ui-layout-pane",resizerClass:"ui-layout-resizer",togglerClass:"ui-layout-toggler",onresize:function(b,c){"center"===b&&a.$_list.setGridWidth(c.width())}}).sizePane("west",this.treeWidth);c(this.$_grid);this._preloadImages();e(function(){e(window).resize(function(){a._onWindowResized()})});this.element.mousedown(function(){e.each(b,function(a){this.element.css("z-index",99999+a)});e(this).css("z-index",99999+b.length+1)});e(".repository-browser-grid").css("width",this.maxWidth);
this.close();this._adaptPageSize()},_setInitialHeight:function(){var a=this.maxHeight-e(window).height()+this.verticalPadding;this.$_grid.height(0<a?Math.max(this.minHeight,this.maxHeight-a):this.maxHeight)},_onWindowResized:function(){var a=this.maxWidth-e(window).width()+this.horizontalPadding,a=0<a?Math.max(this.minWidth,this.maxWidth-a):this.maxWidth;this.element.width(a);this.$_grid.width(a);this._setInitialHeight();a=this.$_grid.find(".repository-browser-tree-header");this.$_tree.height(this.$_grid.height()-
a.outerHeight(!0));a=this.$_grid.find(".ui-layout-center");a.find(".ui-jqgrid-bdiv").height(this.$_grid.height()-(a.find(".ui-jqgrid-titlebar").height()+a.find(".ui-jqgrid-hdiv").height()+a.find(".ui-jqgrid-pager").height()));this._adaptPageSize()&&this._currentFolder&&this._fetchItems(this._currentFolder)},_preloadImages:function(){for(var a=this.rootPath+"img/",b="arrow-000-medium.png arrow-180.png arrow-315-medium.png arrow-stop-180.png arrow-stop.png arrow.png control-stop-square-small.png folder-horizontal-open.png folder-open.png magnifier-left.png page.png picture.png sort-alphabet-descending.png sort-alphabet.png".split(" "),
c=b.length;c;)document.createElement("img").src=a+b[--c]},_processRepoResponse:function(a,b,c){var e=[],f;"function"===typeof b&&(c=b,b=void 0);for(f=0;f<a.length;f++)e.push(this._harvestRepoObject(a[f]));c(e,b)},_harvestRepoObject:function(a){++l;this._cachedRepositoryObjects[l]=e.extend(a,{uid:l,loaded:!1});return this._processRepoObject(this._cachedRepositoryObjects[l])},_processRepoObject:function(a){var b,c,f,g=this;switch(a.baseType){case "folder":b="folder";break;case "document":b="document"}c=
a.hasMoreItems||"folder"===a.baseType?"closed":null;!1===a.hasMoreItems&&(c=null);a.children&&(f=[],e.each(a.children,function(){f.push(g._harvestRepoObject(this));c="open"}));this._currentFolder&&this._currentFolder.id===a.id&&window.setTimeout(function(){g.$_tree.jstree("select_node","li[data-repo-obj='"+a.uid+"']")},0);return{data:{title:a.name,attr:{"data-repo-obj":a.uid},icon:b||""},attr:{rel:a.type,"data-repo-obj":a.uid},state:c,resource:a,children:f}},_fetchRepoRoot:function(a){this._currentFolder||
(this._currentFolder=this.getSelectedFolder());this.repositoryManager&&this.getRepoChildren({inFolderId:this.rootFolderId,repositoryFilter:this.repositoryFilter},a)},_getObjectFromCache:function(a){return a&&a.length?this._cachedRepositoryObjects[a.find("a:first").attr("data-repo-obj")]:null},_onTreeNodeSelected:function(a,b){if(!b.args[0].context){var c=this._getObjectFromCache(b.rslt.obj);c&&(this._pagingOffset=0,this._clearSearch(),this._currentFolder=c,this._fetchItems(c));this.folderSelected(c)}},
_createTree:function(a){var b=e('<div class="repository-browser-tree">'),c=e('<div class="repository-browser-tree-header repository-browser-grab-handle">'+this._i18n("Repository Browser")+"</div>");a.append(c,b);b.height(this.$_grid.height()-c.outerHeight(!0));b.bind("loaded.jstree",function(){e(this).find(">ul>li:first").css("padding-top",5);b.jstree("open_node",'li[rel="repository"]')});var f=this;b.bind("select_node.jstree",function(a,b){f._onTreeNodeSelected(a,b)});b.bind("open_node.jstree",function(a,
b){f.folderOpened(b.rslt.obj)});b.bind("close_node.jstree",function(a,b){f.folderClosed(b.rslt.obj)});b.jstree({types:this.types,rootFolderId:this.rootFolderId,plugins:["themes","json_data","ui","types"],core:{animation:250},themes:{url:this.rootPath+"css/jstree.css",dots:!0,icons:!0,theme:"browser"},json_data:{data:function(a,b){f.repositoryManager?(f.jstree_callback=b,f._fetchSubnodes(a,b)):b()},correct_state:!0},ui:{select_limit:1}});return b},_createGrid:function(a){var b=e('<div class="repository-browser-grid\t\t\t\t             repository-browser-shadow\t\t\t\t\t\t\t repository-browser-rounded-top">\t\t\t\t\t<div class="ui-layout-west"></div>\t\t\t\t\t<div class="ui-layout-center"></div>\t\t\t\t</div>');
a.append(b);return b},_createList:function(a){var b=e('<table id="repository-browser-list-'+ ++l+'" class="repository-browser-list"></table>'),c=[{name:"id",sorttype:"int",firstsortorder:"asc",hidden:!0}],f=[""];e.each(this.columns,function(a,b){f.push(b.title||"&nbsp;");c.push({name:a,width:b.width,sortable:b.sortable,sorttype:b.sorttype,resizable:b.resizable,fixed:b.fixed})});var g="repository-browser-list-page-"+ ++l;a.append(b,e('<div id="'+g+'">'));b.jqGrid({datatype:"local",width:a.width(),
shrinkToFit:!0,colNames:f,colModel:c,caption:"&nbsp;",altRows:!0,altclass:"repository-browser-list-altrow",resizeclass:"repository-browser-list-resizable",pager:"#"+g,viewrecords:!0,onPaging:function(){},loadError:function(){},ondblClickRow:function(){},gridComplete:function(){},loadComplete:function(){}});a.find(".ui-jqgrid-bdiv").height(this.$_grid.height()-(a.find(".ui-jqgrid-titlebar").height()+a.find(".ui-jqgrid-hdiv").height()+a.find(".ui-jqgrid-pager").height()));var j=this;b.click(function(){j.rowClicked.apply(j,
arguments)});a.find(".ui-pg-button").unbind().find(">span.ui-icon").each(function(){var a=this.className.match(/ui\-icon\-seek\-([a-z]+)/)[1];j._pagingBtns[a]=e(this).parent().addClass("ui-state-disabled").click(function(){e(this).hasClass("ui-state-disabled")||j._doPaging(a)})});a.find(".ui-pg-input").parent().hide();a.find(".ui-separator").parent().css("opacity",0).first().hide();this._createTitlebar(a);var m=b[0].p;a.find(".ui-jqgrid-view tr:first th div").each(function(a){!1!==m.colModel[a].sortable&&
(e(this).css("cursor","pointer"),e(this).unbind().click(function(b){b.stopPropagation();j._sortList(m.colModel[a],this)}))});return b},_clearSearch:function(){this.$_grid.find(".repository-browser-search-field").val(this._prefilledValue).addClass("repository-browser-search-field-empty");this._searchQuery=null},_createTitlebar:function(a){var a=a.find(".ui-jqgrid-titlebar"),b=e('<div class="repository-browser-btns">\t\t\t\t\t<input type="text" class="repository-browser-search-field" />\t\t\t\t\t<span class="repository-browser-btn repository-browser-search-btn">\t\t\t\t\t\t<span class="repository-browser-search-icon"></span>\t\t\t\t\t</span>\t\t\t\t\t<span class="repository-browser-btn repository-browser-close-btn">'+
this._i18n("Close")+'</span>\t\t\t\t\t<div class="repository-browser-clear"></div>\t\t\t\t</div>'),c=this;a.addClass("repository-browser-grab-handle").append(b);a.find(".repository-browser-search-btn").html(this._i18n("Search")).click(function(){c._triggerSearch()});b=a.find(".repository-browser-search-field");this._clearSearch();b.keypress(function(a){13===a.keyCode&&c._triggerSearch()});b.focus(function(){e(this).val()===c._prefilledValue&&e(this).val("").removeClass("repository-browser-search-field-empty")});
b.blur(function(){""===e(this).val()&&c._clearSearch()});a.find(".repository-browser-close-btn").click(function(){c.close()});a.find(".repository-browser-btn").mousedown(function(){e(this).addClass("repository-browser-pressed")}).mouseup(function(){e(this).removeClass("repository-browser-pressed")})},_triggerSearch:function(){var a=this.$_grid.find("input.repository-browser-search-field"),b=a.val();if(e(a).hasClass("aloha-browser-search-field-empty")||""===b)b=null;this._pagingOffset=0;this._searchQuery=
b;this._fetchItems(this._currentFolder)},_sortList:function(a,b){this.$_grid.find("span.ui-grid-ico-sort").addClass("ui-state-disabled");a.sortorder="asc"===a.sortorder?"desc":"asc";e(b).find("span.s-ico").show().find(".ui-icon-"+a.sortorder).removeClass("ui-state-disabled");this._setSortOrder(a.name,a.sortorder);this._fetchItems(this._currentFolder)},_doPaging:function(a){switch(a){case "first":this._pagingOffset=0;break;case "end":this._pagingOffset=0===this._pagingCount%this.pageSize?this._pagingCount-
this.pageSize:this._pagingCount-this._pagingCount%this.pageSize;break;case "next":this._pagingOffset+=this.pageSize;break;case "prev":this._pagingOffset-=this.pageSize,0>this._pagingOffset&&(this._pagingOffset=0)}this._fetchItems(this._currentFolder)},_setSortOrder:function(a,b){var c={},e=!1,f=this._orderBy||[],g,j,l;c[a]=b||"asc";for(l=0;l<f.length;++l){g=f[l];for(j in g)if(g.hasOwnProperty(j)&&j===a){f.splice(l,1);f.unshift(c);e=!0;break}if(e)break}e&&f.unshift(c);this._orderBy=f},_listItems:function(a){var b=
this.$_list.clearGridData(),c,f;for(c=0;c<a.length;c++)f=a[c].resource,b.addRowData(f.uid,e.extend({id:f.id},this.renderRowCols(f)))},handleTimeout:function(){},_processItems:function(a,b){this._pagingCount=b&&e.isNumeric(b.numItems)?b.numItems:null;this.$_grid.find(".loading").hide();this.$_list.show();this._listItems(a);var c=this._pagingBtns;0>=this._pagingOffset?c.first.add(c.prev).addClass("ui-state-disabled"):c.first.add(c.prev).removeClass("ui-state-disabled");e.isNumeric(this._pagingCount)?
this._pagingOffset+this.pageSize>=this._pagingCount?c.end.add(c.next).addClass("ui-state-disabled"):c.end.add(c.next).removeClass("ui-state-disabled"):(c.end.addClass("ui-state-disabled"),a.length<=this.pageSize?c.next.addClass("ui-state-disabled"):c.next.removeClass("ui-state-disabled"));var f;0===a.length&&0===this._pagingOffset?f=c=0:(c=this._pagingOffset+1,f=c+a.length-1);this.$_grid.find(".ui-paging-info").html(this._i18n("Viewing")+" "+c+" - "+f+" "+this._i18n("of")+" "+(e.isNumeric(this._pagingCount)?
this._pagingCount:this._i18n("numerous")));b&&b.timeout&&this.handleTimeout()},_createOverlay:function(){0===e(".repository-browser-modal-overlay").length&&e("body").append('<div class="repository-browser-modal-overlay" style="top: -99999px; z-index: 99999;"></div>');var a=this;e(".repository-browser-modal-overlay").click(function(){a.close()});var b=e('<div class="repository-browser-modal-window" style="top: -99999px; z-index: 99999;">');e("body").append(b);return b},_fetchSubnodes:function(a,b){if(-1===
a)this._fetchRepoRoot(b);else{var c;for(c=0;c<a.length;c++){var e=this._getObjectFromCache(a.eq(c));e&&this.fetchChildren(e,b)}}},getRepoChildren:function(a,b){if(this.repositoryManager){var c=this;this.repositoryManager.getChildren(a,function(a){c._processRepoResponse(a,b)})}},queryRepository:function(a,b){if(this.repositoryManager){var c=this;this.repositoryManager.query(a,function(a){c._processRepoResponse(0<a.results?a.items:[],{numItems:a.numItems,hasMoreItems:a.hasMoreItems,timeout:a.timeout},
b)})}},renderRowCols:function(a){var b={};e.each(this.columns,function(c){switch(c){case "icon":b.icon='<div class="repository-browser-icon repository-browser-icon-'+a.type+'"></div>';break;default:b[c]=a[c]||"--"}});return b},onSelect:function(){},fetchChildren:function(a,b){if((!0===a.hasMoreItems||"folder"===a.baseType)&&!1===a.loaded){var c=this;this.getRepoChildren({inFolderId:a.id,repositoryId:a.repositoryId},function(e){c._cachedRepositoryObjects[a.uid].loaded=!0;"function"===typeof b&&b(e)})}},
rowClicked:function(a){a=e(a.target).parent("tr");return a.length?(a=this._cachedRepositoryObjects[a.attr("id")],this.onSelect(a),a):null},getFieldOfHeader:function(a){return a.find("div.ui-jqgrid-sortable").attr("id").replace("jqgh_","")},_fetchItems:function(a){if(a){var b="string"===typeof this._searchQuery;this.$_list.setCaption("string"===typeof this._searchQuery?this._i18n("Searching for")+' "'+this._searchQuery+'" '+this._i18n("in")+" "+a.name:this._i18n("Browsing")+": "+a.name);this.$_list.hide();
this.$_grid.find(".loading").show();var c=this;this.queryRepository({repositoryId:a.repositoryId,inFolderId:a.id,queryString:this._searchQuery,orderBy:this._orderBy,skipCount:this._pagingOffset,maxItems:this.pageSize,objectTypeFilter:this.objectTypeFilter,renditionFilter:this.renditionFilter,filter:this.filter,recursive:b},function(a,b){c._processItems(a,b)})}},setObjectTypeFilter:function(a){this.objectTypeFilter="string"===typeof a?[a]:a},getObjectTypeFilter:function(){return this.objectTypeFilter},
show:function(){this.open()},open:function(){if(!this._isOpened){this._isOpened=!0;var a=this.element;this.isFloating?(e(".repository-browser-modal-overlay").stop().css({top:0,left:0}).show(),a.stop().show(),this._onWindowResized(),this.$_grid.resize(),e(window),a.css({left:this.horizontalPadding/2,top:this.verticalPadding/2}).draggable({handle:a.find(".repository-browser-grab-handle")}),this.$_grid.css({marginTop:0,opacity:0}).animate({marginTop:0,opacity:1},1500,"easeOutExpo",function(){e.browser.msie&&
e(this).add(a).css("filter","progid:DXImageTransform.Microsoft.gradient(enabled=false)")})):(a.stop().show().css({opacity:1,filter:"progid:DXImageTransform.Microsoft.gradient(enabled=false)"}),this._onWindowResized(),this.$_grid.resize());++j}},close:function(){this._isOpened&&(this._isOpened=!1,this.element.fadeOut(250,function(){e(this).css("top",0).hide();(0===j||0===--j)&&e(".repository-browser-modal-overlay").hide()}))},refresh:function(){this._currentFolder&&this._fetchItems(this._currentFolder)},
folderOpened:function(a){(a=this._getObjectFromCache(a))&&this.repositoryManager&&this.repositoryManager.folderOpened(a)},folderClosed:function(a){(a=this._getObjectFromCache(a))&&this.repositoryManager&&this.repositoryManager.folderClosed(a)},folderSelected:function(a){this.repositoryManager&&this.repositoryManager.folderSelected(a)},getSelectedFolder:function(){if(this.repositoryManager&&"function"===typeof this.repositoryManager.getSelectedFolder)return this.repositoryManager.getSelectedFolder()},
_adaptPageSize:function(){var a;if(!this.adaptPageSize||!this.$_list||!this.rowHeight)return!1;if(a=this.$_grid.find(".ui-jqgrid-bdiv").innerHeight()-20)if(a=Math.floor(a/this.rowHeight),0>=a&&(a=1),a!==this.pageSize)return this.pageSize=a,!0;return!1}})});define("repository-browser-i18n-de",[],function(){return{Browsing:"Durchsuchen",Close:"Schließen","in":"in","Input search text...":"Suchtext einfügen...",numerous:"zahlreiche",of:"von","Repository Browser":"Repository Browser",Search:"Suchen","Searching for":"Suche nach",
Viewing:"Anzeige","button.switch-metaview.tooltip":"Zwischen Metaansicht und normaler Ansicht umschalten"}});define("repository-browser-i18n-en",[],function(){return{Browsing:"Browsing",Close:"Close","in":"in","Input search text...":"Input search text...",numerous:"numerous",of:"of","Repository Browser":"Repository Browser",Search:"Search","Searching for":"Searching for",Viewing:"Viewing","button.switch-metaview.tooltip":"Switch between meta and normal view"}});define("linkbrowser/nls/i18n",{root:{"button.addlink.tooltip":"Insert Link",
"button.removelink.tooltip":"Remove Link","newlink.defaulttext":"New Link","floatingmenu.tab.link":"Link"},ca:!0,de:!0,mk:!0,"pt-br":!0,ru:!0,uk:!0,"zh-hans":!0});define("linkbrowser/linkbrowser-plugin","aloha jquery aloha/plugin aloha/pluginmanager ui/ui ui/button link/link-plugin RepositoryBrowser i18n!linkbrowser/nls/i18n i18n!aloha/nls/i18n".split(" "),function(m,e,a,g,c,b,j,l,f){var k=l.extend({init:function(a){this._super(a);var e=this;this._linkBrowserButton=c.adopt("linkBrowser",b,{tooltip:f.t("button.addlink.tooltip"),
icon:"aloha-icon-tree",scope:"Aloha.continuoustext",click:function(){e.show()}});this._linkBrowserButton.hide();this.url=m.getAlohaUrl()+"/../plugins/extra/linkbrowser/";m.bind("aloha-link-selected",function(){e._linkBrowserButton.show()});m.bind("aloha-link-unselected",function(){e._linkBrowserButton.hide()})},onSelect:function(a){j.hrefField.setItem(a);var b=m.Selection.getRangeObject(),c=b.startContainer=b.endContainer,e=b.startOffset=b.endOffset;b.select();b.startContainer=b.endContainer=c;b.startOffset=
b.endOffset=e;b.select();m.trigger("aloha-link-selected-in-linkbrowser",a);this.close()},renderRowCols:function(a){var b={},c=this.url;a.id.match(/(\d+)\./);e.each(this.columns,function(e){switch(e){case "icon":b.icon='<div class="aloha-browser-icon\t\t\t\t\t\taloha-browser-icon-__page__"></div>';break;case "translations":if(!a.renditions)break;for(var e=a.renditions,f=e.length,g=[],j;f>0;--f){j=e[f];j.kind=="translation"&&g.push('<img src="'+c+"img/flags/"+j.language+'.png"\t\t\t\t\t\t\t\t\t  alt="'+
j.language+'"\t\t\t\t\t\t\t\t\t  title="'+j.filename+'" />')}b.translations=g.join("");break;case "language":b.language=a.language;break;default:b[e]=a[e]||"--"}});return b}});return a.create("linkbrowser",{dependencies:["link"],browser:null,init:function(){this.browser=new k({repositoryManager:m.RepositoryManager,repositoryFilter:[],objectTypeFilter:["website","file","image","language"],renditionFilter:["*"],filter:["language"],columns:{icon:{title:"",width:30,sortable:false,resizable:false},name:{title:"Name",
width:320,sorttype:"text"},language:{title:"",width:30,sorttype:"text"},translations:{title:"",width:350,sorttype:"text"}},rootPath:m.settings.baseUrl+"/vendor/repository-browser/"})}})});define("imagebrowser/nls/i18n",{root:{"button.addimage.tooltip":"Insert Image","button.removeimage.tooltip":"Remove Image","newimage.defaulttext":"New Image","floatingmenu.tab.img":"Image"},ca:!0,de:!0,mk:!0,"pt-br":!0,ru:!0,uk:!0,"zh-hans":!0});define("imagebrowser/imagebrowser-plugin","aloha jquery aloha/plugin aloha/pluginmanager ui/ui ui/button image/image-plugin RepositoryBrowser i18n!imagebrowser/nls/i18n i18n!aloha/nls/i18n".split(" "),
function(m,e,a,g,c,b,j,l,f){var k=l.extend({init:function(a){this._super(a);var e=this;this._imageBrowserButton=c.adopt("imageBrowser",b,{tooltip:f.t("button.addimage.tooltip"),icon:"aloha-icon-tree",scope:"Aloha.continuoustext","class":"aloha-imagebrowser-button",click:function(){e.open()}});this._imageBrowserButton.show(false);this.url=m.getAlohaUrl()+"/../plugins/extra/imagebrowser/";m.bind("aloha-image-selected",function(){e._imageBrowserButton.show(true)});m.bind("aloha-image-unselected",function(){e._imageBrowserButton.show(false)})},
onSelect:function(a){if(a.type.match("image")!==null){j.ui.imgSrcField.setItem(a);j.resetSize();this.close()}},listItems:function(a){var b=this,c=this.list.clearGridData();e.each(a,function(){var a=this.resource;a.type.match("image")!==null&&c.addRowData(a.uid,e.extend({id:a.id},b.renderRowCols(a)))})},renderRowCols:function(a){var b={};a.id.match(/(\d+)\./);e.each(this.columns,function(c){switch(c){case "icon":if(!a.renditions)break;if(a.renditions.length===1&&a.renditions[0].kind==="thumbnail")b.icon=
'<img width="'+a.renditions[0].width+'" height="'+a.renditions[0].height+' " src="'+a.renditions[0].url+'"/>';break;default:b[c]=a[c]||"--"}});return b}});return a.create("imagebrowser",{dependencies:["image"],browser:null,init:function(){this.browser=new k({repositoryManager:m.RepositoryManager,repositoryFilter:[],objectTypeFilter:["image"],renditionFilter:["*"],filter:["language"],columns:{icon:{title:"",width:75,sortable:false,resizable:false},name:{title:"Name",width:320,sorttype:"text"}},rootPath:m.settings.baseUrl+
"/vendor/repository-browser/"})}})});define("ui/menuButton",["jquery","ui/component","ui/utils","jqueryui"],function(m,e,a){function g(b,e){var j=[];m.each(e,function(d,e){var f=m("<li>");f.append(m("<a>",{href:"javascript:void 0",html:a.makeButtonLabelWithIcon(e)}));e.click&&f.data("aloha-ui-menubutton-select",function(){b();e.click()});if(e.menu){var r=m("<ul>").appendTo(f);r.append(g(c(r,b),e.menu))}j.push(f[0])});return j}function c(a,b){b=b||m.noop;return function(){a.blur().hide();a.parent().removeClass("aloha-ui-menubutton-pressed");
b()}}function b(a,b){var c=b.item.data("aloha-ui-menubutton-select");c&&c(a,b);a.preventDefault()}var j=e.extend({init:function(){this.element=j.makeMenuButton(this)}});j.makeMenuButton=function(e){function f(a){a.hide().parent().removeClass("aloha-ui-menubutton-pressed")}var j=m("<div>",{"class":"aloha-ui-menubutton-container"}),d=a.makeButtonElement({"class":"aloha-ui-menubutton-expand"}),q=m("<ul>",{"class":"aloha-ui-menubutton-menu"}),o=null,r=null;m.browser.msie&&j.addClass("aloha-ui-menubutton-iehack");
e.click?(o=a.makeButton(a.makeButtonElement({"class":"aloha-ui-menubutton-action"}),e).click(e.click),a.makeButton(d,{},!0),r=m("<div>").buttonset().append(o).append(d)):a.makeButton(d,e,!0).addClass("aloha-ui-menubutton-single");if(!e.menu)return j.append(o);d.click(function(){j.addClass("aloha-ui-menubutton-pressed");e.siblingContainer&&e.siblingContainer.find(".aloha-ui-menubutton-menu").each(function(){this!==q[0]&&f(m(this))});if(q.is(":visible"))f(q);else{q.show().position({my:"left top",at:"left bottom",
of:o||d});m(document).bind("click",function(a){m(this).unbind(a);q.hide();j.removeClass("aloha-ui-menubutton-pressed")});return false}});j.append(r||d).append(q);q.append(g(c(q),e.menu));q.hide().menu({select:b});return j};return j});define("ribbon/ribbon-plugin",["jquery","aloha/plugin","ui/menuButton","ui/utils","jqueryui"],function(m,e,a,g){return e.create("ribbon",{init:function(){if(this.settings.enable||"undefined"===typeof this.settings.enable){var a=this;this._visible=!1;this._toolbar=m("<div>",
{"class":"aloha-ribbon-toolbar ui-menubar ui-widget-header ui-helper-clearfix"});var b=g.makeButtonElement({"class":"aloha-ribbon-in"}).button().hide().click(function(){a._toolbar.animate({left:0});m("body").animate({paddingTop:30});b.hide()}).appendTo(this._toolbar);g.makeButtonElement({"class":"aloha-ribbon-out"}).button().click(function(){a._toolbar.animate({left:-a._toolbar.outerWidth()+b.outerWidth()+10});m("body").animate({paddingTop:0});b.show()}).appendTo(this._toolbar);var e=m("<div>",{"class":"aloha aloha-ribbon"}).appendTo("body");
this._icon=m("<div>").prependTo(this._toolbar);this.setIcon("");this._toolbar.appendTo(e);m("body").css({position:"relative",paddingTop:30})}},setIcon:function(a){this._icon&&this._icon.attr("class","aloha-ribbon-icon "+a)},addButton:function(c){this._toolbar&&(c=m.extend({},c,{siblingContainer:this._toolbar}),this._toolbar.append(a.makeMenuButton(c)))},hide:function(){this._toolbar&&(this._toolbar.hide(),this._visible=!1)},show:function(){this._toolbar&&(this._toolbar.show(),this._visible=!0)},isVisible:function(){return this._visible}})});
define("wai-lang/nls/i18n",{root:{"floatingmenu.tab.wai-lang":"Language annotation","button.add-wai-lang-remove.tooltip":"Remove language annotation","button.add-wai-lang.tooltip":"Add language annotation"},ca:!0,de:!0,mk:!0,"pt-br":!0,ru:!0,uk:!0,"zh-hans":!0});define("wai-lang/languages",["aloha","jquery","flag-icons/flag-icons-plugin","aloha/console","wai-lang/wai-lang-plugin"],function(m,e,a,g){var c=e.Deferred();return new (m.AbstractRepository.extend({languageCodes:[],locale:"de",iso:"iso639-1",
flags:!1,_constructor:function(){this._super("wai-languages")},init:function(){var a=this,e=m.require("wai-lang/wai-lang-plugin"),g=e.iso639;"de"!==m.settings.locale&&(this.locale="en");"iso639-1"!==g&&(this.iso="iso639-2");this.flags=e.flags;this.repositoryName="WaiLanguages";m.require(["wai-lang/"+this.iso+"-"+this.locale],function(e){a.storeLanguageCodes(e);c.resolve()})},markObject:function(){},errorHandler:function(a){g.log("error",this,"Error while loading languages. "+a)},storeLanguageCodes:function(b){var c=
this,g=m.getPluginUrl("wai-lang");e.each(b,function(b,e){e.id=b;e.repositoryId=c.repositoryId;e.type="language";c.flags&&(e.url=e.flag?a.path+"/img/flags/"+e.flag+".png":g+"/img/button.png");c.languageCodes.push(new m.RepositoryDocument(e))})},_searchInLanguageCodes:function(a,c){var g=RegExp("^"+a.queryString,"i"),f,k=[],d,m,o;for(f=0;f<this.languageCodes.length;++f)o=this.languageCodes[f],d=!a.queryString||o.name.match(g),m=!a.objectTypeFilter||!a.objectTypeFilter.length||-1<e.inArray(o.type,a.objectTypeFilter),
d&&m&&k.push(o);c.call(this,k)},query:function(a,e){var g=this;c.done(function(){g._searchInLanguageCodes(a,e)})},getObjectById:function(a,c){var e,f;for(e=0;e<this.languageCodes.length;++e)if(f=this.languageCodes[e],f.id===a){c.call(this,[f]);break}}}))});define("wai-lang/wai-lang-plugin","aloha jquery aloha/plugin ui/ui ui/scopes ui/button ui/toggleButton ui/port-helper-attribute-field i18n!wai-lang/nls/i18n i18n!aloha/nls/i18n wai-lang/languages".split(" "),function(m,e,a,g,c,b,j,l,f){var k=window.GENTICS,
d;return a.create("wai-lang",{config:["span"],iso639:"iso639-1",flags:false,objectTypeFilter:["language"],hotKey:{insertAnnotation:f.t("insertAnnotation","ctrl+shift+l")},init:function(){if(this.settings.objectTypeFilter)this.objectTypeFilter=this.settings.objectTypeFilter;this.settings.hotKey&&e.extend(true,this.hotKey,this.settings.hotKey);this.flags=this.settings.flags==="true"||this.settings.flags===true||this.settings.flags==="1"||this.settings.flags===1?true:false;if(this.settings.iso639)this.iso639=
this.settings.iso639;this.createButtons();this.subscribeEvents();this.bindInteractions()},subscribeEvents:function(){var a=this;m.bind("aloha-editable-activated",function(){var b;b=a.getEditableConfig(m.activeEditable.obj);e.inArray("span",b)!==-1?a._wailangButton.show():a._wailangButton.hide()});m.bind("aloha-selection-changed",function(b,e){var f=a._foundLangMarkupAtSelection=a.findLangMarkup(e);if(f){a._wailangButton.setState(true);c.setScope("wai-lang");d.setTargetObject(f,"lang")}else{a._wailangButton.setState(false);
a._foundLangMarkupAtSelection=false;d.setTargetObject(null)}})},createButtons:function(){var a=this;this._wailangButton=g.adopt("wailang",j,{tooltip:f.t("button.add-wai-lang.tooltip"),icon:"aloha-icon aloha-icon-wai-lang",scope:"Aloha.continuoustext",click:function(){a.addRemoveMarkupToSelection()}});c.createScope("wai-lang","Aloha.continuoustext");d=l({name:"wailangfield",width:320,valueField:"id",minChars:1,scope:"wai-lang"});this.flags?d.setTemplate('<div class="aloha-wai-lang-img-item"><img class="aloha-wai-lang-img" src="{url}" /><div class="aloha-wai-lang-label-item">{name} ({id})</div></div>'):
d.setTemplate('<div class="aloha-wai-lang-img-item"><div class="aloha-wai-lang-label-item">{name} ({id})</div></div>');d.setObjectTypeFilter(this.objectTypeFilter);this._removewailangButton=g.adopt("removewailang",b,{tooltip:f.t("button.add-wai-lang-remove.tooltip"),icon:"aloha-icon aloha-icon-wai-lang-remove",scope:"wai-lang",click:function(){a.removeLangMarkup()}})},findLangMarkup:function(a){a=a||m.Selection.getRangeObject();return m.activeEditable?a.findMarkup(function(){return e(this).hasClass("aloha-wai-lang")||
e(this).is("[lang]")},m.activeEditable.obj):null},findLanguageMarkup:function(a){a=a||m.Selection.getRangeObject();return m.activeEditable?a.findMarkup(function(){return this.nodeName==="SPAN"},m.activeEditable.obj):null},removeLangMarkup:function(){var a=m.Selection.getRangeObject(),b=this.findLangMarkup(a);if(b){k.Utils.Dom.removeFromDOM(b,a,true);a.select();c.setScope("Aloha.continuoustext");d.setTargetObject(null)}},bindInteractions:function(){function a(c){c.obj.bind("keydown",b.hotKey.insertAnnotation,
function(){b.insertLanguageAnnotation()});c.obj.find("span[lang]").each(function(){b.makeVisible(this)})}var b=this;d.addListener("blur",function(){this.getValue()||b.removeMarkup()});m.bind("aloha-editable-created",function(b,c){a(c)})},insertLanguageAnnotation:function(){if(typeof this.findLangMarkup==="function"){if(this.findLangMarkup()){d.foreground();d.focus()}else this.addMarkupToSelection();return false}},makeVisible:function(a){a=e(a);a.addClass("aloha-wai-lang");a.attr("data-gentics-aloha-repository",
"wai-languages");a.attr("data-gentics-aloha-object-id",a.attr("lang"))},formatLanguageSpan:function(){m.activeEditable&&(this.findLanguageMarkup(m.Selection.getRangeObject())?this.removeMarkup():this.insertMarkup())},addRemoveMarkupToSelection:function(){this._foundLangMarkupAtSelection?this.removeLangMarkup():this.addMarkupToSelection(false)},addMarkupToSelection:function(){var a=m.Selection.getRangeObject();if(!this.findLangMarkup(a)){d.foreground();c.setScope("wai-lang");a.isCollapsed()&&k.Utils.Dom.extendToWord(a);
a.isCollapsed()||k.Utils.Dom.addMarkup(a,e('<span class="aloha-wai-lang"></span>'),false);a.select();d.focus()}},removeMarkup:function(){var a=this.findLangMarkup(),b;if(a){b=m.Selection.getRangeObject();k.Utils.Dom.removeFromDOM(a,b,true);b.select()}},makeClean:function(a){a.find("span[lang]").each(function(){e(this).removeClass("aloha-wai-lang");e(this).removeAttr("data-gentics-aloha-repository");e(this).removeAttr("data-gentics-aloha-object-id");e(this).attr("xml:lang",e(this).attr("lang"))})}})});
define("headerids/nls/i18n",{root:{"headerids.label.target":"Target","headerids.button.reset":"Reset","headerids.button.set":"Set",internal_hyperlink:"Internal Hyperlink"},ca:!0,de:!0,mk:!0,"pt-br":!0,ru:!0,uk:!0,"zh-hans":!0});define("headerids/headerids-plugin",["jquery","aloha/plugin","i18n!headerids/nls/i18n","i18n!aloha/nls/i18n"],function(m,e,a){function g(){var a=[],c=l;b.each(arguments,function(){a.push("."+(""==this?c:c+"-"+this))});return m.trim(a.join(" "))}function c(){var a=[],c=l;b.each(arguments,
function(){a.push(""==this?c:c+"-"+this)});return m.trim(a.join(" "))}var b=m,j=window.Aloha,l="aloha-headerids";return e.create("headerids",{_constructor:function(){this._super("headerids")},config:["true"],init:function(){var a=this;j.bind("aloha-editable-activated",function(b,c){a.check(c.editable.obj)});j.bind("aloha-editable-deactivated",function(b,c){a.check(c.editable.obj)});j.bind("aloha-plugins-loaded",function(){a.initSidebar(j.Sidebar.right)})},check:function(a){var b=this,c=b.getEditableConfig(a);
if(-1===m.inArray("true",c))return!1;m(a).find("h1, h2, h3, h4, h5, h6").not(".aloha-customized").each(function(){b.processH(this)})},processH:function(a){m(a).attr("id",this.sanitize(m(a).text()))},sanitize:function(a){return a.replace(/[^a-z0-9]+/gi,"_")},initSidebar:function(b){var e=this;e.sidebar=b;b.addPanel({id:c("sidebar-panel"),title:a.t("internal_hyperlink"),content:"",expanded:!0,activeOn:"h1, h2, h3, h4, h5, h6",onInit:function(){var b=this,f=this.setContent('<label class="'+c("label")+
'" for="'+c("input")+'">'+a.t("headerids.label.target")+'</label><input id="'+c("input")+'" class="'+c("input")+'" type="text" name="value"/> <button class="'+c("reset-button")+'">'+a.t("headerids.button.reset")+'</button><button class="'+c("set-button")+'">'+a.t("headerids.button.set")+"</button>").content;f.find(g("set-button")).click(function(){m(b.effective).attr("id",m(g("input")).val());m(b.effective).addClass("aloha-customized")});f.find(g("reset-button")).click(function(){e.processH(b.effective);
m(b.effective).removeClass("aloha-customized");b.content.find(g("input")).val(b.effective.attr("id"))})},onActivate:function(a){this.effective=a;this.content.find(g("input")).val(a.attr("id"))}});b.show()},makeClean:function(a){this.check(a)}})});define("metaview/nls/i18n",{root:{"button.switch-metaview.tooltip":"Switch between meta and normal view"},ca:!0,de:!0,mk:!0,"pt-br":!0,ru:!0,uk:!0,"zh-hans":!0});define("metaview/metaview-plugin","aloha/plugin ui/ui ui/toggleButton i18n!metaview/nls/i18n i18n!aloha/nls/i18n jquery".split(" "),
function(m,e,a,g,c,b){var j=window.Aloha;return m.create("metaview",{_constructor:function(){this._super("metaview")},config:["metaview"],init:function(){var a=this;this.createButtons();j.bind("aloha-editable-activated",function(){var c;c=a.getEditableConfig(j.activeEditable.obj);b.type(c)==="array"&&b.inArray("enabled",c)!==-1&&b(j.activeEditable.obj).addClass("aloha-metaview");if(b.type(c)==="array"&&b.inArray("metaview",c)!==-1){a._toggleMetaViewButton.show(true);b(j.activeEditable.obj).hasClass("aloha-metaview")?
a._toggleMetaViewButton.setState(true):a._toggleMetaViewButton.setState(false)}else a._toggleMetaViewButton.show(false)});j.bind("aloha-editable-deactivated",function(){a.getEditableConfig(j.activeEditable.obj);b(j.activeEditable.obj).removeClass("aloha-metaview");b(j.activeEditable.obj).hasClass("aloha-metaview")?a._toggleMetaViewButton.setState(true):a._toggleMetaViewButton.setState(false)})},buttonClick:function(){if(b(j.activeEditable.obj).hasClass("aloha-metaview")){b(j.activeEditable.obj).removeClass("aloha-metaview");
this._toggleMetaViewButton.setState(false)}else{b(j.activeEditable.obj).addClass("aloha-metaview");this._toggleMetaViewButton.setState(true)}},createButtons:function(){var b=this;this._toggleMetaViewButton=e.adopt("toggleMetaView",a,{tooltip:g.t("button.switch-metaview.tooltip"),icon:"aloha-icon aloha-icon-metaview",scope:"Aloha.continuoustext",click:function(){b.buttonClick()}})}})});define("listenforcer/listenforcer-plugin",["aloha","jquery","aloha/plugin","aloha/console"],function(m,e,a,g){function c(a,
c){if(-1!==e.inArray(a[0],b)){a.find(".aloha-end-br").remove();var f=!1;a.find("li").each(function(){if(""!==e.trim(e(this).text()))return f=!0,!1});f||a.html(c);var g=a.find(">ul,>ol"),d=g.length,m;if(1<d){var o=e(g[0]);for(m=1;m<d;++m)o.append(e(g[m]).find(">li")),e(g[m]).remove()}a.find(">*:not(ul,ol)").remove()}}var b=[];return a.create("listenforcer",{_constructor:function(){this._super("listenforcer")},init:function(){var a=this,b=this.settings.editables||[],f,k,d=b.length;for(k=0;k<d;k++)f=
b[k],"string"===typeof f||f.nodeName||f instanceof e?e(f).each(function(){a.addEditableToEnforcementList(this)}):g.warn("Aloha List Enforcer Plugin",'Object "'+f.toString()+'" can not be used as a jQuery selector with which to register an editable to be list enforced.');m.bind("aloha-editable-activated",function(a,b){c(b.editable.obj,"<ul><li><br /></li></ul>")});m.bind("aloha-editable-deactivated",function(a,b){c(b.editable.obj,"")});m.bind("aloha-smart-content-changed",function(a,b){m.activeEditable&&
!0===m.activeEditable.isActive&&c(b.editable.obj,"<ul><li><br /></li></ul>")})},addEditableToEnforcementList:function(a){a&&b.push(a)}})});Aloha._load&&Aloha._load()})();