/*
 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.7
 $Date: 2012-10-13 08:00:00 (Sat, 13 Oct 2012) $
 $Rev: 303007 $

 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.7

 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 ua(l,d){var a;a=l||{};this.jQuery=d||{};this.config={};this.config.elements=a.elements?a.elements:[];this.config.attributes=a.attributes?a.attributes:{};this.config.attributes[ua.ALL]=this.config.attributes[ua.ALL]?this.config.attributes[ua.ALL]:[];this.config.allow_comments=a.allow_comments?a.allow_comments:!1;this.allowed_elements={};this.config.protocols=a.protocols?a.protocols:{};this.config.add_attributes=a.add_attributes?a.add_attributes:{};this.dom=a.dom?a.dom:document;
for(var k=0,c=this.config.elements.length;k<c;k++)this.allowed_elements[this.config.elements[k]]=!0;this.config.remove_element_contents={};this.config.remove_all_contents=!1;if(a.remove_contents)if(a.remove_contents instanceof Array)for(var b=this.config.remove_element_contents,k=0,c=a.remove_contents.length;k<c;k++)b[a.remove_contents[k]]=!0;else this.config.remove_all_contents=!0;this.transformers=a.transformers?a.transformers:[];this.filters=a.filters?a.filters:[]}var ga;ga||(ga={});(function(){function l(a){return 10>
a?"0"+a:a}function d(a){c.lastIndex=0;return c.test(a)?'"'+a.replace(c,function(a){var b=g[a];return"string"===typeof b?b:"\\u"+("0000"+a.charCodeAt(0).toString(16)).slice(-4)})+'"':'"'+a+'"'}function a(c,e){var g,k,r,p,q=b,s,u=e[c];u&&("object"===typeof u&&"function"===typeof u.toJSON)&&(u=u.toJSON(c));"function"===typeof j&&(u=j.call(e,c,u));switch(typeof u){case "string":return d(u);case "number":return isFinite(u)?""+u:"null";case "boolean":case "null":return""+u;case "object":if(!u)return"null";
b+=f;s=[];if("[object Array]"===Object.prototype.toString.apply(u)){p=u.length;for(g=0;g<p;g+=1)s[g]=a(g,u)||"null";r=0===s.length?"[]":b?"[\n"+b+s.join(",\n"+b)+"\n"+q+"]":"["+s.join(",")+"]";b=q;return r}if(j&&"object"===typeof j){p=j.length;for(g=0;g<p;g+=1)"string"===typeof j[g]&&(k=j[g],(r=a(k,u))&&s.push(d(k)+(b?": ":":")+r))}else for(k in u)Object.prototype.hasOwnProperty.call(u,k)&&(r=a(k,u))&&s.push(d(k)+(b?": ":":")+r);r=0===s.length?"{}":b?"{\n"+b+s.join(",\n"+b)+"\n"+q+"}":"{"+s.join(",")+
"}";b=q;return r}}"function"!==typeof Date.prototype.toJSON&&(Date.prototype.toJSON=function(){return isFinite(this.valueOf())?this.getUTCFullYear()+"-"+l(this.getUTCMonth()+1)+"-"+l(this.getUTCDate())+"T"+l(this.getUTCHours())+":"+l(this.getUTCMinutes())+":"+l(this.getUTCSeconds())+"Z":null},String.prototype.toJSON=Number.prototype.toJSON=Boolean.prototype.toJSON=function(){return this.valueOf()});var k=/[\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,f,g={"":"\\b","\t":"\\t","\n":"\\n","":"\\f","\r":"\\r",'"':'\\"',"\\":"\\\\"},j;"function"!==typeof ga.stringify&&(ga.stringify=function(c,e,g){var d;f=b="";if(typeof g==="number")for(d=0;d<g;d=d+1)f=f+" ";else typeof g==="string"&&(f=g);if((j=e)&&typeof e!=="function"&&(typeof e!=="object"||typeof e.length!=="number"))throw Error("JSON.stringify");return a("",{"":c})});
"function"!==typeof ga.parse&&(ga.parse=function(a,b){function c(a,f){var m,j,g=a[f];if(g&&typeof g==="object")for(m in g)if(Object.prototype.hasOwnProperty.call(g,m)){j=c(g,m);j!==void 0?g[m]=j:delete g[m]}return b.call(a,f,g)}var f,a=""+a;k.lastIndex=0;k.test(a)&&(a=a.replace(k,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,""))){f=eval("("+a+")");return typeof b==="function"?c({"":f},""):f}throw new SyntaxError("JSON.parse");})})();define("util/json2",[],function(){return ga});(function(){var l=function(){function d(a,b){var c=typeof a[b];return c==e||!!(c==m&&a[b])||"unknown"==c}function a(a,b){return!!(typeof a[b]==m&&a[b])}function k(a,b){return typeof a[b]!=o}function c(a){return function(b,e){for(var c=e.length;c--;)if(!a(b,e[c]))return!1;return!0}}function b(a){return a&&s(a,
q)&&v(a,p)}function f(a){window.alert("Rangy not supported in your browser. Reason: "+a);t.initialized=!0;t.supported=!1}function g(){if(!t.initialized){var e,c=!1,m=!1;d(document,"createRange")&&(e=document.createRange(),s(e,r)&&v(e,n)&&(c=!0),e.detach());if((e=a(document,"body")?document.body:document.getElementsByTagName("body")[0])&&d(e,"createTextRange"))e=e.createTextRange(),b(e)&&(m=!0);!c&&!m&&f("Neither Range nor TextRange are implemented");t.initialized=!0;t.features={implementsDomRange:c,
implementsTextRange:m};c=l.concat(x);m=0;for(e=c.length;m<e;++m)try{c[m](t)}catch(j){a(window,"console")&&d(window.console,"log")&&window.console.log("Init listener threw an exception. Continuing.",j)}}}function j(a){this.name=a;this.supported=this.initialized=!1}var m="object",e="function",o="undefined",n="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(" "),q="collapse compareEndPoints duplicate getBookmark moveToBookmark moveToElementText parentElement pasteHTML select setEndPoint getBoundingClientRect".split(" "),s=c(d),u=c(a),v=c(k),t={version:"1.2.1",initialized:!1,supported:!0,util:{isHostMethod:d,isHostObject:a,isHostProperty:k,areHostMethods:s,areHostObjects:u,areHostProperties:v,isTextRange:b},features:{},modules:{},config:{alertOnWarn:!1,preferTextRange:!1}};
t.fail=f;t.warn=function(a){a="Rangy warning: "+a;t.config.alertOnWarn?window.alert(a):typeof window.console!=o&&typeof window.console.log!=o&&window.console.log(a)};({}).hasOwnProperty?t.util.extend=function(a,b){for(var e in b)b.hasOwnProperty(e)&&(a[e]=b[e])}:f("hasOwnProperty not supported");var x=[],l=[];t.init=g;t.addInitListener=function(a){t.initialized?a(t):x.push(a)};var z=[];t.addCreateMissingNativeApiListener=function(a){z.push(a)};t.createMissingNativeApi=function(a){a=a||window;g();
for(var b=0,e=z.length;b<e;++b)z[b](a)};j.prototype.fail=function(a){this.initialized=!0;this.supported=!1;throw Error("Module '"+this.name+"' failed to load: "+a);};j.prototype.warn=function(a){t.warn("Module "+this.name+": "+a)};j.prototype.createError=function(a){return Error("Error in Rangy "+this.name+" module: "+a)};t.createModule=function(a,b){var e=new j(a);t.modules[a]=e;l.push(function(a){b(a,e);e.initialized=!0;e.supported=!0})};t.requireModules=function(a){for(var b=0,e=a.length,c,f;b<
e;++b){f=a[b];c=t.modules[f];if(!c||!(c instanceof j))throw Error("Module '"+f+"' not found");if(!c.supported)throw Error("Module '"+f+"' not supported");}};var E=!1,u=function(){E||(E=!0,t.initialized||g())};if(typeof window==o)f("No window found");else if(typeof document==o)f("No document found");else return d(document,"addEventListener")&&document.addEventListener("DOMContentLoaded",u,!1),d(window,"addEventListener")?window.addEventListener("load",u,!1):d(window,"attachEvent")?window.attachEvent("onload",
u):f("Window does not have required addEventListener or attachEvent method"),t}();l.createModule("DomUtil",function(d,a){function k(a){for(var b=0;a=a.previousSibling;)b++;return b}function c(a,b){var e=[],c;for(c=a;c;c=c.parentNode)e.push(c);for(c=b;c;c=c.parentNode)if(u(e,c))return c;return null}function b(a,b,e){for(e=e?a:a.parentNode;e;){a=e.parentNode;if(a===b)return e;e=a}return null}function f(a){a=a.nodeType;return 3==a||4==a||8==a}function g(a,b){var e=b.nextSibling,c=b.parentNode;e?c.insertBefore(a,
e):c.appendChild(a);return a}function j(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 j(a.parentNode);throw Error("getDocument: no document found for node");}function m(a){if(a)return a.previousSibling?a.previousSibling.nextSibling:a.nextSibling?a.nextSibling.previousSibling:a.parentNode?a.parentNode.firstChild:a}function e(a){return!a?"[No node]":f(a)?'"'+a.data+'"':1==a.nodeType?"<"+a.nodeName+(a.id?
' id="'+a.id+'"':"")+">["+a.childNodes.length+"]":a.nodeName}function o(a){this._next=this.root=a}function n(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",q=d.util;q.areHostMethods(document,["createDocumentFragment","createElement","createTextNode"])||a.fail("document missing a Node creation method");q.isHostMethod(document,"getElementsByTagName")||a.fail("document missing getElementsByTagName method");
var s=document.createElement("div");q.areHostMethods(s,["insertBefore","appendChild","cloneNode"])||a.fail("Incomplete Element implementation");q.isHostProperty(s,"innerHTML")||a.fail("Element is missing innerHTML property");s=document.createTextNode("test");q.areHostMethods(s,["splitText","deleteData","insertData","appendData","cloneNode"])||a.fail("Incomplete Text Node implementation");var u=function(a,b){for(var e=a.length;e--;)if(a[e]===b)return!0;return!1};o.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}};n.prototype={equals:function(a){return this.node===a.node&this.offset==a.offset},inspect:function(){return"[DomPosition("+e(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};d.dom={arrayContains:u,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:k,getNodeLength:function(a){var b;return f(a)?a.length:(b=a.childNodes)?b.length:0},getCommonAncestor:c,isAncestorOf:function(a,b,e){for(b=e?b:b.parentNode;b;){if(b===
a)return!0;b=b.parentNode}return!1},getClosestAncestorIn:b,isCharacterDataNode:f,insertAfter:g,splitDataNode:function(a,b){var e=a.cloneNode(!1);e.deleteData(0,b);a.deleteData(b,a.length-b);g(e,a);return e},getDocument:j,getWindow:function(a){a=j(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 q.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,e,f,j){var a=m(a),f=m(f),g;if(a==f)return e===j?0:e<j?-1:1;if(g=b(f,a,!0))return e<=k(g)?-1:1;if(g=b(a,f,!0))return k(g)<j?-1:1;e=c(a,f);a=a===e?e:b(a,e,!0);f=f===e?e:b(f,e,!0);if(a===f)throw Error("comparePoints got to case 4 and childA and childB are the same!");for(e=e.firstChild;e;){if(e===a)return-1;if(e===f)return 1;e=e.nextSibling}throw Error("Should not be here!");},inspectNode:e,fragmentFromNodeChildren:function(a){for(var b=j(a).createDocumentFragment(),e;e=a.firstChild;)b.appendChild(e);
return b},createIterator:function(a){return new o(a)},DomPosition:n};d.DOMException=r});l.createModule("DomRange",function(d){function a(a,b){return 3!=a.nodeType&&(G.isAncestorOf(a,b.startContainer,!0)||G.isAncestorOf(a,b.endContainer,!0))}function k(a){return G.getDocument(a.startContainer)}function c(a,b,e){if(b=a._listeners[b])for(var c=0,f=b.length;c<f;++c)b[c].call(a,{target:a,args:e})}function b(a){return new N(a.parentNode,G.getNodeIndex(a))}function f(a){return new N(a.parentNode,G.getNodeIndex(a)+
1)}function g(a,b,e){var c=11==a.nodeType?a.firstChild:a;G.isCharacterDataNode(b)?e==b.length?G.insertAfter(a,b):b.parentNode.insertBefore(a,0==e?b:G.splitDataNode(b,e)):e>=b.childNodes.length?b.appendChild(a):b.insertBefore(a,b.childNodes[e]);return c}function j(a){for(var b,e,c=k(a.range).createDocumentFragment();e=a.next();){b=a.isPartiallySelectedSubtree();e=e.cloneNode(!b);b&&(b=a.getSubtreeIterator(),e.appendChild(j(b)),b.detach(!0));if(10==e.nodeType)throw new H("HIERARCHY_REQUEST_ERR");c.appendChild(e)}return c}
function m(a,b,e){for(var c,f,e=e||{stop:!1};c=a.next();)if(a.isPartiallySelectedSubtree())if(!1===b(c)){e.stop=!0;break}else{if(c=a.getSubtreeIterator(),m(c,b,e),c.detach(!0),e.stop)break}else for(c=G.createIterator(c);f=c.next();)if(!1===b(f)){e.stop=!0;return}}function e(a){for(var b;a.next();)a.isPartiallySelectedSubtree()?(b=a.getSubtreeIterator(),e(b),b.detach(!0)):a.remove()}function o(a){for(var b,e=k(a.range).createDocumentFragment(),c;b=a.next();){a.isPartiallySelectedSubtree()?(b=b.cloneNode(!1),
c=a.getSubtreeIterator(),b.appendChild(o(c)),c.detach(!0)):a.remove();if(10==b.nodeType)throw new H("HIERARCHY_REQUEST_ERR");e.appendChild(b)}return e}function n(a,b,e){var c=!(!b||!b.length),f,j=!!e;c&&(f=RegExp("^("+b.join("|")+")$"));var g=[];m(new p(a,!1),function(a){(!c||f.test(a.nodeType))&&(!j||e(a))&&g.push(a)});return g}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 e=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===e&&!G.isCharacterDataNode(this.sc)?this.sc.childNodes[this.so]:G.getClosestAncestorIn(this.sc,e,!0),this._last=this.ec===e&&!G.isCharacterDataNode(this.ec)?
this.ec.childNodes[this.eo-1]:G.getClosestAncestorIn(this.ec,e,!0))}}function q(a){this.code=this[a];this.codeName=a;this.message="RangeException: "+this.codeName}function s(a,b,e){this.nodes=n(a,b,e);this._next=this.nodes[0];this._position=0}function u(a){return function(b,e){for(var c,f=e?b:b.parentNode;f;){c=f.nodeType;if(G.arrayContains(a,c))return f;f=f.parentNode}return null}}function v(a,b){if(P(a,b))throw new q("INVALID_NODE_TYPE_ERR");}function t(a){if(!a.startContainer)throw new H("INVALID_STATE_ERR");
}function l(a,b){if(!G.arrayContains(b,a.nodeType))throw new q("INVALID_NODE_TYPE_ERR");}function y(a,b){if(0>b||b>(G.isCharacterDataNode(a)?a.length:a.childNodes.length))throw new H("INDEX_SIZE_ERR");}function z(a,b){if(Q(a,!0)!==Q(b,!0))throw new H("WRONG_DOCUMENT_ERR");}function E(a){if(I(a,!0))throw new H("NO_MODIFICATION_ALLOWED_ERR");}function A(a,b){if(!a)throw new H(b);}function C(a){t(a);if(!G.arrayContains(Z,a.startContainer.nodeType)&&!Q(a.startContainer,!0)||!G.arrayContains(Z,a.endContainer.nodeType)&&
!Q(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 J(){}function S(a){a.START_TO_START=xa;a.START_TO_END=Ga;a.END_TO_END=ia;a.END_TO_START=ya;a.NODE_BEFORE=ca;a.NODE_AFTER=ka;a.NODE_BEFORE_AND_AFTER=
za;a.NODE_INSIDE=Oa}function F(a){S(a);S(a.prototype)}function B(a,b){return function(){C(this);var e=this.startContainer,c=this.startOffset,j=this.commonAncestorContainer,g=new p(this,!0);e!==j&&(e=G.getClosestAncestorIn(e,j,!0),c=f(e),e=c.node,c=c.offset);m(g,E);g.reset();j=a(g);g.detach();b(this,e,c,e,c);return j}}function O(c,m,j){function g(a,e){return function(c){t(this);l(c,T);l(la(c),Z);c=(a?b:f)(c);(e?k:n)(this,c.node,c.offset)}}function k(a,b,e){var c=a.endContainer,f=a.endOffset;if(b!==
a.startContainer||e!==this.startOffset){if(la(b)!=la(c)||1==G.comparePoints(b,e,c,f))c=b,f=e;m(a,b,e,c,f)}}function n(a,b,e){var c=a.startContainer,f=a.startOffset;if(b!==a.endContainer||e!==this.endOffset){if(la(b)!=la(c)||-1==G.comparePoints(b,e,c,f))c=b,f=e;m(a,c,f,b,e)}}function r(a,b,e){(b!==a.startContainer||e!==this.startOffset||b!==a.endContainer||e!==this.endOffset)&&m(a,b,e,b,e)}c.prototype=new J;d.util.extend(c.prototype,{setStart:function(a,b){t(this);v(a,!0);y(a,b);k(this,a,b)},setEnd:function(a,
b){t(this);v(a,!0);y(a,b);n(this,a,b)},setStartBefore:g(!0,!0),setStartAfter:g(!1,!0),setEndBefore:g(!0,!1),setEndAfter:g(!1,!1),collapse:function(a){C(this);a?m(this,this.startContainer,this.startOffset,this.startContainer,this.startOffset):m(this,this.endContainer,this.endOffset,this.endContainer,this.endOffset)},selectNodeContents:function(a){t(this);v(a,!0);m(this,a,0,a,G.getNodeLength(a))},selectNode:function(a){t(this);v(a,!1);l(a,T);var e=b(a),a=f(a);m(this,e.node,e.offset,a.node,a.offset)},
extractContents:B(o,m),deleteContents:B(e,m),canSurroundContents:function(){C(this);E(this.startContainer);E(this.endContainer);var b=new p(this,!0),e=b._first&&a(b._first,this)||b._last&&a(b._last,this);b.detach();return!e},detach:function(){j(this)},splitBoundaries:function(){C(this);var a=this.startContainer,b=this.startOffset,e=this.endContainer,c=this.endOffset,f=a===e;G.isCharacterDataNode(e)&&(0<c&&c<e.length)&&G.splitDataNode(e,c);G.isCharacterDataNode(a)&&(0<b&&b<a.length)&&(a=G.splitDataNode(a,
b),f?(c-=b,e=a):e==a.parentNode&&c>=G.getNodeIndex(a)&&c++,b=0);m(this,a,b,e,c)},normalizeBoundaries:function(){C(this);var a=this.startContainer,b=this.startOffset,e=this.endContainer,c=this.endOffset,f=function(a){var b=a.nextSibling;b&&b.nodeType==a.nodeType&&(e=a,c=a.length,a.appendData(b.data),b.parentNode.removeChild(b))},j=function(f){var m=f.previousSibling;if(m&&m.nodeType==f.nodeType){a=f;var j=f.length;b=m.length;f.insertData(0,m.data);m.parentNode.removeChild(m);a==e?(c+=b,e=a):e==f.parentNode&&
(m=G.getNodeIndex(f),c==m?(e=f,c=j):c>m&&c--)}},g=!0;G.isCharacterDataNode(e)?e.length==c&&f(e):(0<c&&(g=e.childNodes[c-1])&&G.isCharacterDataNode(g)&&f(g),g=!this.collapsed);g?G.isCharacterDataNode(a)?0==b&&j(a):b<a.childNodes.length&&(f=a.childNodes[b])&&G.isCharacterDataNode(f)&&j(f):(a=e,b=c);m(this,a,b,e,c)},collapseToPoint:function(a,b){t(this);v(a,!0);y(a,b);r(this,a,b)}});F(c)}function Y(a){a.collapsed=a.startContainer===a.endContainer&&a.startOffset===a.endOffset;a.commonAncestorContainer=
a.collapsed?a.startContainer:G.getCommonAncestor(a.startContainer,a.endContainer)}function R(a,b,e,f,m){var j=a.startContainer!==b||a.startOffset!==e,g=a.endContainer!==f||a.endOffset!==m;a.startContainer=b;a.startOffset=e;a.endContainer=f;a.endOffset=m;Y(a);c(a,"boundarychange",{startMoved:j,endMoved:g})}function V(a){this.startContainer=a;this.startOffset=0;this.endContainer=a;this.endOffset=0;this._listeners={boundarychange:[],detach:[]};Y(this)}d.requireModules(["DomUtil"]);var G=d.dom,N=G.DomPosition,
H=d.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,e;G.isCharacterDataNode(a)&&(a===this.sc||a===this.ec)?(b=a===this.sc?this.so:0,e=a===this.ec?this.eo:a.length,b!=e&&a.deleteData(b,e-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 V(k(this.range));var b=this._current,e=b,c=0,f=b,m=G.getNodeLength(b);G.isAncestorOf(b,
this.sc,!0)&&(e=this.sc,c=this.so);G.isAncestorOf(b,this.ec,!0)&&(f=this.ec,m=this.eo);R(a,e,c,f,m)}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}};q.prototype={BAD_BOUNDARYPOINTS_ERR:1,INVALID_NODE_TYPE_ERR:2};q.prototype.toString=function(){return this.message};s.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 T=[1,3,4,5,7,8,10],Z=[2,9,11],X=[1,3,4,5,7,8,10,11],da=[1,3,4,5,7,8],la=G.getRootContainer,Q=u([9,11]),I=u([5,6,10,12]),P=u([6,10,12]),D=document.createElement("style"),Qa=!1;try{D.innerHTML="<b>x</b>",Qa=3==D.firstChild.nodeType}catch(Ha){}d.features.htmlParsingConforms=Qa;var ea="startContainer startOffset endContainer endOffset collapsed commonAncestorContainer".split(" "),
xa=0,Ga=1,ia=2,ya=3,ca=0,ka=1,za=2,Oa=3;J.prototype={attachListener:function(a,b){this._listeners[a].push(b)},compareBoundaryPoints:function(a,b){C(this);z(this.startContainer,b.startContainer);var e=a==ya||a==xa?"start":"end",c=a==Ga||a==xa?"start":"end";return G.comparePoints(this[e+"Container"],this[e+"Offset"],b[c+"Container"],b[c+"Offset"])},insertNode:function(a){C(this);l(a,X);E(this.startContainer);if(G.isAncestorOf(a,this.startContainer,!0))throw new H("HIERARCHY_REQUEST_ERR");this.setStartBefore(g(a,
this.startContainer,this.startOffset))},cloneContents:function(){C(this);var a,b;if(this.collapsed)return k(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=k(this).createDocumentFragment(),b.appendChild(a),b;b=new p(this,!0);a=j(b);b.detach();return a},canSurroundContents:function(){C(this);E(this.startContainer);E(this.endContainer);
var b=new p(this,!0),e=b._first&&a(b._first,this)||b._last&&a(b._last,this);b.detach();return!e},surroundContents:function(a){l(a,da);if(!this.canSurroundContents())throw new q("BAD_BOUNDARYPOINTS_ERR");var b=this.extractContents();if(a.hasChildNodes())for(;a.lastChild;)a.removeChild(a.lastChild);g(a,this.startContainer,this.startOffset);a.appendChild(b);this.selectNode(a)},cloneRange:function(){C(this);for(var a=new V(k(this)),b=ea.length,e;b--;)e=ea[b],a[e]=this[e];return a},toString:function(){C(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);m(a,function(a){(3==a.nodeType||4==a.nodeType)&&b.push(a.data)});a.detach();return b.join("")},compareNode:function(a){C(this);var b=a.parentNode,e=G.getNodeIndex(a);if(!b)throw new H("NOT_FOUND_ERR");a=this.comparePoint(b,e);b=this.comparePoint(b,e+1);return 0>a?0<b?za:ca:0<b?ka:Oa},comparePoint:function(a,b){C(this);
A(a,"HIERARCHY_REQUEST_ERR");z(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:Qa?function(a){var b=this.startContainer,e=G.getDocument(b);if(!b)throw new H("INVALID_STATE_ERR");var c=null;1==b.nodeType?c=b:G.isCharacterDataNode(b)&&(c=G.parentElement(b));c=null===c||"HTML"==c.nodeName&&G.isHtmlNamespace(G.getDocument(c).documentElement)&&G.isHtmlNamespace(c)?e.createElement("body"):
c.cloneNode(!1);c.innerHTML=a;return G.fragmentFromNodeChildren(c)}:function(a){t(this);var b=k(this).createElement("body");b.innerHTML=a;return G.fragmentFromNodeChildren(b)},toHtml:function(){C(this);var a=k(this).createElement("div");a.appendChild(this.cloneContents());return a.innerHTML},intersectsNode:function(a,b){C(this);A(a,"NOT_FOUND_ERR");if(G.getDocument(a)!==k(this))return!1;var e=a.parentNode,c=G.getNodeIndex(a);A(e,"NOT_FOUND_ERR");var f=G.comparePoints(e,c,this.endContainer,this.endOffset),
e=G.comparePoints(e,c+1,this.startContainer,this.startOffset);return b?0>=f&&0<=e:0>f&&0<e},isPointInRange:function(a,b){C(this);A(a,"HIERARCHY_REQUEST_ERR");z(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){C(this);if(k(a)!=k(this))throw new H("WRONG_DOCUMENT_ERR");var e=G.comparePoints(this.startContainer,this.startOffset,a.endContainer,a.endOffset),c=G.comparePoints(this.endContainer,
this.endOffset,a.startContainer,a.startOffset);return b?0>=e&&0<=c:0>e&&0<c},intersection:function(a){if(this.intersectsRange(a)){var b=G.comparePoints(this.startContainer,this.startOffset,a.startContainer,a.startOffset),e=G.comparePoints(this.endContainer,this.endOffset,a.endContainer,a.endOffset),c=this.cloneRange();-1==b&&c.setStart(a.startContainer,a.startOffset);1==e&&c.setEnd(a.endContainer,a.endOffset);return c}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 q("Ranges do not intersect");},containsNode:function(a,b){return b?this.intersectsNode(a,!1):this.compareNode(a)==Oa},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 e=b.getNodes([3]);return 0<e.length?(b.setStart(e[0],0),a=e.pop(),b.setEnd(a,a.length),a=this.containsRange(b),b.detach(),a):this.containsNodeContents(a)},createNodeIterator:function(a,b){C(this);return new s(this,a,b)},getNodes:function(a,b){C(this);return n(this,a,b)},getDocument:function(){return k(this)},collapseBefore:function(a){t(this);this.setEndBefore(a);this.collapse(!1)},collapseAfter:function(a){t(this);this.setStartAfter(a);
this.collapse(!0)},getName:function(){return"DomRange"},equals:function(a){return V.rangesEqual(this,a)},inspect:function(){return r(this)}};O(V,R,function(a){t(a);a.startContainer=a.startOffset=a.endContainer=a.endOffset=null;a.collapsed=a.commonAncestorContainer=null;c(a,"detach",null);a._listeners=null});d.rangePrototype=J.prototype;V.rangeProperties=ea;V.RangeIterator=p;V.copyComparisonConstants=F;V.createPrototypeRange=O;V.inspect=r;V.getRangeDocument=k;V.rangesEqual=function(a,b){return a.startContainer===
b.startContainer&&a.startOffset===b.startOffset&&a.endContainer===b.endContainer&&a.endOffset===b.endOffset};d.DomRange=V;d.RangeException=q});l.createModule("WrappedRange",function(d){function a(a,e,c,j){var g=a.duplicate();g.collapse(c);var d=g.parentElement();b.isAncestorOf(e,d,!0)||(d=e);if(!d.canHaveHTML)return new f(d.parentNode,b.getNodeIndex(d));e=b.getDocument(d).createElement("span");e.parentNode&&e.parentNode.removeChild(e);var k,s=c?"StartToStart":"StartToEnd";do d.insertBefore(e,e.previousSibling),
g.moveToElementText(e);while(0<(k=g.compareEndPoints(s,a))&&e.previousSibling);s=e.nextSibling;if(-1==k&&s&&b.isCharacterDataNode(s)){g.setEndPoint(c?"EndToStart":"EndToEnd",a);if(/[\r\n]/.test(s.data)){g=g.duplicate();d=g.text.replace(/\r\n/g,"\r").length;for(d=g.moveStart("character",d);-1==g.compareEndPoints("StartToEnd",g);)d++,g.moveStart("character",1)}else if(d=g.text.replace(/\u00a0/g," "),c=s.data.replace(/\u00a0/g," "),0!==c.indexOf(d)){for(;0<d.length&&0!==c.indexOf(d);)d=d.substr(1);d=
d.length}else d=g.text.length;s=new f(s,d)}else s=(j||!c)&&e.previousSibling,s=(g=(j||c)&&e.nextSibling)&&b.isCharacterDataNode(g)?new f(g,0):s&&b.isCharacterDataNode(s)?new f(s,s.length):new f(d,b.getNodeIndex(e));e.parentNode.removeChild(e);return s}function k(a,e){var c,f,g=a.offset,j=b.getDocument(a.node),d=j.body.createTextRange(),k=b.isCharacterDataNode(a.node);k?(c=a.node,f=c.parentNode):(c=a.node.childNodes,c=g<c.length?c[g]:null,f=a.node);j=j.createElement("span");j.innerHTML="&#feff;";c?
f.insertBefore(j,c):f.appendChild(j);try{d.moveToElementText(j),d.collapse(!e)}catch(u){}f.removeChild(j);if(k)d[e?"moveStart":"moveEnd"]("character",g);return d}d.requireModules(["DomUtil","DomRange"]);var c,b=d.dom,f=b.DomPosition,g=d.DomRange;if(d.features.implementsDomRange&&(!d.features.implementsTextRange||!d.config.preferTextRange))(function(){function a(b){for(var e=f.length,c;e--;)c=f[e],b[c]=b.nativeRange[c]}var e,f=g.rangeProperties,j;c=function(b){if(!b)throw Error("Range must be specified");
this.nativeRange=b;a(this)};g.createPrototypeRange(c,function(a,b,e,c,f){var j=a.endContainer!==c||a.endOffset!=f;if(a.startContainer!==b||a.startOffset!=e||j)a.setEnd(c,f),a.setStart(b,e)},function(a){a.nativeRange.detach();a.detached=!0;for(var b=f.length,e;b--;)e=f[b],a[e]=null});e=c.prototype;e.selectNode=function(b){this.nativeRange.selectNode(b);a(this)};e.deleteContents=function(){this.nativeRange.deleteContents();a(this)};e.extractContents=function(){var b=this.nativeRange.extractContents();
a(this);return b};e.cloneContents=function(){return this.nativeRange.cloneContents()};e.surroundContents=function(b){this.nativeRange.surroundContents(b);a(this)};e.collapse=function(b){this.nativeRange.collapse(b);a(this)};e.cloneRange=function(){return new c(this.nativeRange.cloneRange())};e.refresh=function(){a(this)};e.toString=function(){return this.nativeRange.toString()};var k=document.createTextNode("test");b.getBody(document).appendChild(k);var p=document.createRange();p.setStart(k,0);p.setEnd(k,
0);try{p.setStart(k,1),e.setStart=function(b,e){this.nativeRange.setStart(b,e);a(this)},e.setEnd=function(b,e){this.nativeRange.setEnd(b,e);a(this)},j=function(b){return function(e){this.nativeRange[b](e);a(this)}}}catch(q){e.setStart=function(b,e){try{this.nativeRange.setStart(b,e)}catch(c){this.nativeRange.setEnd(b,e),this.nativeRange.setStart(b,e)}a(this)},e.setEnd=function(b,e){try{this.nativeRange.setEnd(b,e)}catch(c){this.nativeRange.setStart(b,e),this.nativeRange.setEnd(b,e)}a(this)},j=function(b,
e){return function(c){try{this.nativeRange[b](c)}catch(f){this.nativeRange[e](c),this.nativeRange[b](c)}a(this)}}}e.setStartBefore=j("setStartBefore","setEndBefore");e.setStartAfter=j("setStartAfter","setEndAfter");e.setEndBefore=j("setEndBefore","setStartBefore");e.setEndAfter=j("setEndAfter","setStartAfter");p.selectNodeContents(k);e.selectNodeContents=p.startContainer==k&&p.endContainer==k&&0==p.startOffset&&p.endOffset==k.length?function(b){this.nativeRange.selectNodeContents(b);a(this)}:function(a){this.setStart(a,
0);this.setEnd(a,g.getEndOffset(a))};p.selectNodeContents(k);p.setEnd(k,3);j=document.createRange();j.selectNodeContents(k);j.setEnd(k,4);j.setStart(k,2);e.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)};d.util.isHostMethod(p,"createContextualFragment")&&(e.createContextualFragment=function(a){return this.nativeRange.createContextualFragment(a)});b.getBody(document).removeChild(k);p.detach();j.detach()})(),d.createNativeRange=function(a){a=a||document;return a.createRange()};else if(d.features.implementsTextRange){c=function(a){this.textRange=a;this.refresh()};c.prototype=new g(document);c.prototype.refresh=function(){var c,e,f=this.textRange;c=f.parentElement();var j=f.duplicate();j.collapse(!0);
e=j.parentElement();j=f.duplicate();j.collapse(!1);f=j.parentElement();e=e==f?e:b.getCommonAncestor(e,f);e=e==c?e:b.getCommonAncestor(c,e);0==this.textRange.compareEndPoints("StartToEnd",this.textRange)?e=c=a(this.textRange,e,!0,!0):(c=a(this.textRange,e,!0,!1),e=a(this.textRange,e,!1,!1));this.setStart(c.node,c.offset);this.setEnd(e.node,e.offset)};g.copyComparisonConstants(c);var j=function(){return this}();"undefined"==typeof j.Range&&(j.Range=c);d.createNativeRange=function(a){a=a||document;return a.body.createTextRange()}}d.features.implementsTextRange&&
(c.rangeToTextRange=function(a){if(a.collapsed)return k(new f(a.startContainer,a.startOffset),!0);var e=k(new f(a.startContainer,a.startOffset),!0),c=k(new f(a.endContainer,a.endOffset),!1),a=b.getDocument(a.startContainer).body.createTextRange();a.setEndPoint("StartToStart",e);a.setEndPoint("EndToEnd",c);return a});c.prototype.getName=function(){return"WrappedRange"};d.WrappedRange=c;d.createRange=function(a){a=a||document;return new c(d.createNativeRange(a))};d.createRangyRange=function(a){a=a||
document;return new g(a)};d.createIframeRange=function(a){return d.createRange(b.getIframeDocument(a))};d.createIframeRangyRange=function(a){return d.createRangyRange(b.getIframeDocument(a))};d.addCreateMissingNativeApiListener(function(a){a=a.document;if(typeof a.createRange=="undefined")a.createRange=function(){return d.createRange(this)};a=a=null})});l.createModule("WrappedSelection",function(d,a){function k(a){return(a||window).getSelection()}function c(a){return(a||window).document.selection}
function b(a,b,e){var c=e?"end":"start",e=e?"start":"end";a.anchorNode=b[c+"Container"];a.anchorOffset=b[c+"Offset"];a.focusNode=b[e+"Container"];a.focusOffset=b[e+"Offset"]}function f(a){a.anchorNode=a.focusNode=null;a.anchorOffset=a.focusOffset=0;a.rangeCount=0;a.isCollapsed=!0;a._ranges.length=0}function g(a){var b;a instanceof v?(b=a._selectionNativeRange,b||(b=d.createNativeRange(s.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 t?b=a.nativeRange:d.features.implementsDomRange&&a instanceof s.getWindow(a.startContainer).Range&&(b=a);return b}function j(a){var b=a.getNodes(),e;a:if(!b.length||1!=b[0].nodeType)e=!1;else{e=1;for(var c=b.length;e<c;++e)if(!s.isAncestorOf(b[0],b[e])){e=!1;break a}e=!0}if(!e)throw Error("getSingleElementFromRange: range "+a.inspect()+" did not consist of a single element");return b[0]}
function m(a,e){var c=new t(e);a._ranges=[c];b(a,c,!1);a.rangeCount=1;a.isCollapsed=c.collapsed}function e(a){a._ranges.length=0;if("None"==a.docSelection.type)f(a);else{var e=a.docSelection.createRange();if(e&&"undefined"!=typeof e.text)m(a,e);else{a.rangeCount=e.length;for(var c,j=s.getDocument(e.item(0)),g=0;g<a.rangeCount;++g)c=d.createRange(j),c.selectNode(e.item(g)),a._ranges.push(c);a.isCollapsed=1==a.rangeCount&&a._ranges[0].collapsed;b(a,a._ranges[a.rangeCount-1],!1)}}}function o(a,b){for(var c=
a.docSelection.createRange(),f=j(b),g=s.getDocument(c.item(0)),g=s.getBody(g).createControlRange(),m=0,d=c.length;m<d;++m)g.add(c.item(m));try{g.add(f)}catch(k){throw Error("addRange(): Element within the specified Range could not be added to control selection (does it have layout?)");}g.select();e(a)}function n(a,b,e){this.nativeSelection=a;this.docSelection=b;this._ranges=[];this.win=e;this.refresh()}function r(a,b){for(var c=s.getDocument(b[0].startContainer),c=s.getBody(c).createControlRange(),
f=0,g;f<rangeCount;++f){g=j(b[f]);try{c.add(g)}catch(m){throw Error("setRanges(): Element within the one of the specified Ranges could not be added to control selection (does it have layout?)");}}c.select();e(a)}function p(a,b){if(a.anchorNode&&s.getDocument(a.anchorNode)!==s.getDocument(b))throw new l("WRONG_DOCUMENT_ERR");}function q(a){var b=[],e=new y(a.anchorNode,a.anchorOffset),c=new y(a.focusNode,a.focusOffset),f="function"==typeof a.getName?a.getName():"Selection";if("undefined"!=typeof a.rangeCount)for(var j=
0,g=a.rangeCount;j<g;++j)b[j]=v.inspect(a.getRangeAt(j));return"["+f+"(Ranges: "+b.join(", ")+")(anchor: "+e.inspect()+", focus: "+c.inspect()+"]"}d.requireModules(["DomUtil","DomRange","WrappedRange"]);d.config.checkSelectionRanges=!0;var s=d.dom,u=d.util,v=d.DomRange,t=d.WrappedRange,l=d.DOMException,y=s.DomPosition,z,E,A=d.util.isHostMethod(window,"getSelection"),C=d.util.isHostObject(document,"selection"),J=C&&(!A||d.config.preferTextRange);J?(z=c,d.isSelectionValid=function(a){var a=(a||window).document,
b=a.selection;return"None"!=b.type||s.getDocument(b.createRange().parentElement())==a}):A?(z=k,d.isSelectionValid=function(){return!0}):a.fail("Neither document.selection or window.getSelection() detected.");d.getNativeSelection=z;var A=z(),S=d.createNativeRange(document),F=s.getBody(document),B=u.areHostObjects(A,u.areHostProperties(A,["anchorOffset","focusOffset"]));d.features.selectionHasAnchorAndFocus=B;var O=u.isHostMethod(A,"extend");d.features.selectionHasExtend=O;var Y="number"==typeof A.rangeCount;
d.features.selectionHasRangeCount=Y;var R=!1,V=!0;u.areHostMethods(A,["addRange","getRangeAt","removeAllRanges"])&&("number"==typeof A.rangeCount&&d.features.implementsDomRange)&&function(){var a=document.createElement("iframe");F.appendChild(a);var b=s.getIframeDocument(a);b.open();b.write("<html><head></head><body>12</body></html>");b.close();var e=s.getIframeWindow(a).getSelection(),c=b.documentElement.lastChild.firstChild,b=b.createRange();b.setStart(c,1);b.collapse(true);e.addRange(b);V=e.rangeCount==
1;e.removeAllRanges();var f=b.cloneRange();b.setStart(c,0);f.setEnd(c,2);e.addRange(b);e.addRange(f);R=e.rangeCount==2;b.detach();f.detach();F.removeChild(a)}();d.features.selectionSupportsMultipleRanges=R;d.features.collapsedNonEditableSelectionsSupported=V;var G=!1,N;F&&u.isHostMethod(F,"createControlRange")&&(N=F.createControlRange(),u.areHostProperties(N,["item","add"])&&(G=!0));d.features.implementsControlRange=G;E=B?function(a){return a.anchorNode===a.focusNode&&a.anchorOffset===a.focusOffset}:
function(a){return a.rangeCount?a.getRangeAt(a.rangeCount-1).collapsed:false};var H;u.isHostMethod(A,"getRangeAt")?H=function(a,b){try{return a.getRangeAt(b)}catch(e){return null}}:B&&(H=function(a){var b=s.getDocument(a.anchorNode),b=d.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});d.getSelection=function(a){var a=a||window,b=a._rangySelection,
e=z(a),f=C?c(a):null;if(b){b.nativeSelection=e;b.docSelection=f;b.refresh(a)}else{b=new n(e,f,a);a._rangySelection=b}return b};d.getIframeSelection=function(a){return d.getSelection(s.getIframeWindow(a))};N=n.prototype;if(!J&&B&&u.areHostMethods(A,["removeAllRanges","addRange"])){N.removeAllRanges=function(){this.nativeSelection.removeAllRanges();f(this)};var T=function(a,b){var e=v.getRangeDocument(b),e=d.createRange(e);e.collapseToPoint(b.endContainer,b.endOffset);a.nativeSelection.addRange(g(e));
a.nativeSelection.extend(b.startContainer,b.startOffset);a.refresh()};N.addRange=Y?function(a,e){if(G&&C&&this.docSelection.type=="Control")o(this,a);else if(e&&O)T(this,a);else{var c;if(R)c=this.rangeCount;else{this.removeAllRanges();c=0}this.nativeSelection.addRange(g(a));this.rangeCount=this.nativeSelection.rangeCount;if(this.rangeCount==c+1){if(d.config.checkSelectionRanges)(c=H(this.nativeSelection,this.rangeCount-1))&&!v.rangesEqual(c,a)&&(a=new t(c));this._ranges[this.rangeCount-1]=a;b(this,
a,da(this.nativeSelection));this.isCollapsed=E(this)}else this.refresh()}}:function(a,b){if(b&&O)T(this,a);else{this.nativeSelection.addRange(g(a));this.refresh()}};N.setRanges=function(a){if(G&&a.length>1)r(this,a);else{this.removeAllRanges();for(var b=0,e=a.length;b<e;++b)this.addRange(a[b])}}}else if(u.isHostMethod(A,"empty")&&u.isHostMethod(S,"select")&&G&&J)N.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){}f(this)},N.addRange=function(a){if(this.docSelection.type=="Control")o(this,a);else try{t.rangeToTextRange(a).select();this._ranges[0]=a;this.rangeCount=1;this.isCollapsed=this._ranges[0].collapsed;b(this,a,false)}catch(e){}},N.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;N.getRangeAt=function(a){if(a<
0||a>=this.rangeCount)throw new l("INDEX_SIZE_ERR");return this._ranges[a]};var Z;if(J)Z=function(a){var b;if(d.isSelectionValid(a.win))b=a.docSelection.createRange();else{b=s.getBody(a.win.document).createTextRange();b.collapse(true)}a.docSelection.type=="Control"?e(a):b&&typeof b.text!="undefined"?m(a,b):f(a)};else if(u.isHostMethod(A,"getRangeAt")&&"number"==typeof A.rangeCount)Z=function(a){if(G&&C&&a.docSelection.type=="Control")e(a);else{a._ranges.length=a.rangeCount=a.nativeSelection.rangeCount;
if(a.rangeCount){for(var c=0,j=a.rangeCount;c<j;++c)a._ranges[c]=new d.WrappedRange(a.nativeSelection.getRangeAt(c));b(a,a._ranges[a.rangeCount-1],da(a.nativeSelection));a.isCollapsed=E(a)}else f(a)}};else if(B&&"boolean"==typeof A.isCollapsed&&"boolean"==typeof S.collapsed&&d.features.implementsDomRange)Z=function(a){var b;b=a.nativeSelection;if(b.anchorNode){b=H(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 f(a)};else return a.fail("No means of obtaining a Range or TextRange from the user's selection was found"),!1;N.refresh=function(a){var b=a?this._ranges.slice(0):null;Z(this);if(a){a=b.length;if(a!=this._ranges.length)return false;for(;a--;)if(!v.rangesEqual(b[a],this._ranges[a]))return false;return true}};var X=function(a,b){var e=a.getAllRanges(),c=false;a.removeAllRanges();for(var j=0,g=e.length;j<g;++j)c||b!==e[j]?a.addRange(e[j]):c=true;a.rangeCount||
f(a)};N.removeRange=G?function(a){if(this.docSelection.type=="Control"){for(var b=this.docSelection.createRange(),a=j(a),c=s.getDocument(b.item(0)),c=s.getBody(c).createControlRange(),f,g=false,m=0,d=b.length;m<d;++m){f=b.item(m);f!==a||g?c.add(b.item(m)):g=true}c.select();e(this)}else X(this,a)}:function(a){X(this,a)};var da;!J&&B&&d.features.implementsDomRange?(da=function(a){var b=false;a.anchorNode&&(b=s.comparePoints(a.anchorNode,a.anchorOffset,a.focusNode,a.focusOffset)==1);return b},N.isBackwards=
function(){return da(this)}):da=N.isBackwards=function(){return false};N.toString=function(){for(var a=[],b=0,e=this.rangeCount;b<e;++b)a[b]=""+this._ranges[b];return a.join("")};N.collapse=function(a,b){p(this,a);var e=d.createRange(s.getDocument(a));e.collapseToPoint(a,b);this.removeAllRanges();this.addRange(e);this.isCollapsed=true};N.collapseToStart=function(){if(this.rangeCount){var a=this._ranges[0];this.collapse(a.startContainer,a.startOffset)}else throw new l("INVALID_STATE_ERR");};N.collapseToEnd=
function(){if(this.rangeCount){var a=this._ranges[this.rangeCount-1];this.collapse(a.endContainer,a.endOffset)}else throw new l("INVALID_STATE_ERR");};N.selectAllChildren=function(a){p(this,a);var b=d.createRange(s.getDocument(a));b.selectNodeContents(a);this.removeAllRanges();this.addRange(b)};N.deleteFromDocument=function(){if(G&&C&&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 e=a.length;b<e;++b)a[b].deleteContents();this.addRange(a[e-1])}};N.getAllRanges=function(){return this._ranges.slice(0)};N.setSingleRange=function(a){this.setRanges([a])};N.containsNode=function(a,b){for(var e=0,c=this._ranges.length;e<c;++e)if(this._ranges[e].containsNode(a,b))return true;return false};N.toHtml=function(){var a="";if(this.rangeCount){for(var a=v.getRangeDocument(this._ranges[0]).createElement("div"),b=0,e=this._ranges.length;b<
e;++b)a.appendChild(this._ranges[b].cloneContents());a=a.innerHTML}return a};N.getName=function(){return"WrappedSelection"};N.inspect=function(){return q(this)};N.detach=function(){this.win=this.anchorNode=this.focusNode=this.win._rangySelection=null};n.inspect=q;d.Selection=n;d.selectionPrototype=N;d.addCreateMissingNativeApiListener(function(a){if(typeof a.getSelection=="undefined")a.getSelection=function(){return d.getSelection(this)};a=null})});window.rangy=l})();define("vendor/rangy-core",function(){});
define("aloha/rangy-core",["jquery","vendor/rangy-core"],function(){return window.rangy});define("util/class",[],function(){var l=!1,d=/xyz/.test(function(){xyz})?/\b_super\b/:/.*/;this.Class=function(){};Class.extend=function(){function a(){!l&&this._constructor&&this._constructor.apply(this,arguments)}var k=this.prototype;l=!0;var c=new this;l=!1;for(var b=0;b<arguments.length;b++){var f=arguments[b],g;for(g in f)c[g]="function"==typeof f[g]&&"function"==typeof k[g]&&d.test(f[g])?function(a,b){return function(){var e=
this._super;this._super=k[a];var c=b.apply(this,arguments);this._super=e;return c}}(g,f[g]):f[g]}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(l){var d=l.GENTICS;d.Utils.applyProperties=function(a,d){for(var c in d)d.hasOwnProperty(c)&&(a[c]=d[c])};d.Utils.uniqeString4=function(){return(65536*(1+Math.random())|0).toString(16).substring(1)};
d.Utils.guid=function(){var a=d.Utils.uniqeString4;return a()+a()+"-"+a()+"-"+a()+"-"+a()+"-"+a()+a()+a()}})(window);define("aloha/ecma5shims",[],function(){function l(a){var b=null;if(a){do b=a;while(null!=(a=a.parentNode))}return b}function d(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 k,
c={bind:function(a){var b=this.obj||this,c=Function.prototype.bind,m=Array.prototype.slice.call(arguments,1);return c?c.apply(b,arguments):function(){return b.apply(a,0===arguments.length?m:m.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 c=this.obj||this,m=Array.prototype.indexOf;if(m)return m.call(c,a,b);void 0===b&&(b=0);0>b&&(b+=c.length);0>b&&(b=
0);for(m=c.length;b<m;b++)if(void 0!==c[b]&&c[b]===a)return b;return-1},forEach:function(a,b){var c=this.obj||this,m=Array.prototype.forEach;if(m)return m.call(c,a,b);var e,m=0;for(e=c.length;m<e;m++)void 0!==c[m]&&a.call(b,c[m],m,c)},map:function(a,b,c){var m=this.obj||this,e=Array.prototype.map,d="boolean"==typeof arguments[arguments.length-1]?Array.prototype.pop.call(arguments):!1,n=[];if(e)n=e.call(m,a,b);else{var e=[],r,n=0;for(r=m.length;n<r;n++)void 0!==m[n]&&(e[n]=a.call(b,m[n],n,m));n=e}return d?
k(n):n},filter:function(a,b,c){var m=this.obj||this,e=Array.prototype.filter,d="boolean"==typeof arguments[arguments.length-1]?Array.prototype.pop.call(arguments):!1,n=[];if(e)n=e.call(m,a,b);else{var e=[],r,p,n=0;for(p=m.length;n<p;n++)void 0!==m[n]&&a.call(b,r=m[n],n,m)&&e.push(r);n=e}return d?k(n):n},every:function(a,b){var c=this.obj||this,m=Array.prototype.every;if(m)return m.call(c,a,b);var e,m=0;for(e=c.length;m<e;m++)if(void 0!==c[m]&&!a.call(b,c[m],m,c))return!1;return!0},some:function(a,
b){var c=this.obj||this,m=Array.prototype.some;if(m)return m.call(c,a,b);var e,m=0;for(e=c.length;m<e;m++)if(void 0!==c[m]&&a.call(b,c[m],m,c))return!0;return!1},hasAttribute:function(a){var b=this.obj||this;return b.hasAttribute?b.hasAttribute(a):!!b.getAttribute(a)}};k=function(a){var b=function(){};b.prototype=c;b=new b;b.obj=a;return b};for(var b in c)c.hasOwnProperty(b)&&(k[b]=c[b]);k.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};k.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(l(b)!=l(c))return 1;if(null!=b.sourceIndex&&null!=c.sourceIndex)return d(b,c);if(b==document)return 20;if(c==document)return 10;var j=a(b),m=a(c),e=d(j,m);b!=j&&j.parentNode.removeChild(j);c!=m&&m.parentNode.removeChild(m);return e};k.getComputedStyle=function(a,b){return window.getComputedStyle?window.getComputedStyle(a,b):a.currentStyle?a.currentStyle:null};return k});window.GENTICS=window.GENTICS||{};window.GENTICS.Utils=window.GENTICS.Utils||{};define("util/dom",["jquery",
"util/class","aloha/ecma5shims"],function(l,d,a){var k;function c(a){if(!a)return-1;var b,e=a.parentNode.childNodes,c=e.length;for(b=0;b<c;b++)if(e[b]===a)return b;return-1}function b(a){if(1===a.nodeType){for(var b=0,a=a.firstChild;a;)b+=1,a=a.nextSibling;return b}return 3===a.nodeType?a.length:0}function f(a){return"aloha-editing-p"===a.className&&1===b(a)&&"BR"===a.children[0].nodeName&&"aloha-end-br"===a.children[0].className}function g(a,b){if(!a)return null;if(b(a))return a;var e=a.firstChild||
a.nextSibling||a.parentNode&&!o.Utils.Dom.isEditingHost(a.parentNode)&&a.parentNode.nextSibling;return e?g(e,b):null}function j(a){if(!a)return!0;if("BR"===a.nodeName)return!1;if(a.nodeType===k)return-1===a.data.search(/\S/)||1===a.data.length&&8192<=a.data.charCodeAt(0)?!0:!1;var e=b(a);if(0===e)return!0;var a=a.childNodes,c;for(c=0;c<e;c++)if(!j(a[c]))return!1;return!0}function m(a){return!j(a)}function e(a,b){a.nodeType!==k&&(j(a)||f(a))?l(a).replaceWith(b):l(a).after(b)}var o=window.GENTICS;k=
3;var n={P:!0,H1:!0,H2:!0,H3:!0,H4:!0,H5:!0,H6:!0,LI:!0},d=d.extend({getIndexInParent:c,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,b,e){var c=l(a.startContainer),f=a.startOffset,j,g,m,d,k,o,n,C,J;e&&(c=l(a.endContainer),f=a.endOffset);1>b.length&&(b=l(document.body));e=!a.isCollapsed()&&!e;g=c.parents().get();g.unshift(c.get(0));l.each(g,function(a,e){if(b.filter(function(){return this==e}).length){a>0&&(j=g.slice(0,a));return false}});if(!j)return!0;j=j.reverse();c=0;for(o=j.length;c<o;++c)if(n=j[c],c===o-1)3===n.nodeType?(k=document.createTextNode(n.data.substring(f,n.data.length)),
n.data=n.data.substring(0,f),this.isEmpty(k)&&0===l("br",m).length&&(k=l("<br/>").addClass("aloha-end-br"))):(C=l(n),k=C.contents(),C=C.clone(!1).empty(),k=C.append(k.slice(f,k.length)).get(0),l(k).addClass("aloha-editing-p"),1===k.childNodes.length&&"br"===k.childNodes.item(0).nodeName.toLowerCase()&&l(k.childNodes.item(0)).addClass("aloha-end-br")),e&&a.endContainer===n&&(a.endContainer=k,a.endOffset-=f,a.clearCaches()),d?d.prepend(k):l(n).after(k);else{C=l(n).clone(!1).empty();m?d.prepend(C):m=
C;for(d=C;;){J=j[c+1].nextSibling;if(!J)break;d.append(J)}if(e&&a.endContainer===n){a.endContainer=C.get(0);n=j[c+1];for(C=0;;){n=n.previousSibling;if(!n)break;C++}a.endOffset-=C;a.clearCaches()}}l(j[0]).after(m);return l([j[0],m?m.get(0):k])},allowsNesting:function(a,b){if(!a||!a.nodeName||!b||!b.nodeName)return!1;var e=a.nodeName.toLowerCase(),c=b.nodeName.toLowerCase();return!this.children[e]?!1:this.children[e]==c||l.isArray(this.children[e])&&0<=l.inArray(c,this.children[e])||l.isArray(this.tags[this.children[e]])&&
0<=l.inArray(c,this.tags[this.children[e]])?!0:!1},addMarkup:function(a,b,e){3===a.startContainer.nodeType&&(0<a.startOffset&&a.startOffset<a.startContainer.data.length)&&this.split(a,l(a.startContainer).parent(),!1);3===a.endContainer.nodeType&&(0<a.endOffset&&a.endOffset<a.endContainer.data.length)&&this.split(a,l(a.endContainer).parent(),!0);this.recursiveAddMarkup(a.getRangeTree(),b,a,e);this.doCleanup({merge:!0,removeempty:!0},a)},recursiveAddMarkup:function(a,b,e,c){var f,j,e=0;for(j=a.length;e<
j;++e)if("full"==a[e].type&&this.allowsNesting(b.get(0),a[e].domobj)){if((c||a[e].domobj.nodeName!=b.get(0).nodeName)&&(3!==a[e].domobj.nodeType||0!==l.trim(a[e].domobj.data).length))l(a[e].domobj).wrap(b),!c&&3!==a[e].domobj.nodeType&&(f=new o.Utils.RangeObject,f.startContainer=f.endContainer=a[e].domobj.parentNode,f.startOffset=0,f.endOffset=f.endContainer.childNodes.length,this.removeMarkup(f,b,l(a[e].domobj.parentNode)))}else(c||a[e].domobj&&a[e].domobj.nodeName!==b.get(0).nodeName)&&(a[e].children&&
0<a[e].children.length)&&this.recursiveAddMarkup(a[e].children,b)},findHighestElement:function(a,b,e){for(var b=b.toLowerCase(),c,f=a,a=e?function(){return e.filter(function(){return f==this}).length}:function(){return!1};!a()&&f;)f.nodeName.toLowerCase()===b&&(c=f),f=f.parentNode;return c},removeMarkup:function(a,b,e){var c=b.get(0).nodeName,f=this.findHighestElement(a.startContainer,c,e),j=this.findHighestElement(a.endContainer,c,e),g=!1;f&&0<a.startOffset&&(this.split(a,l(f).parent(),!1),g=!0);
if(j&&(3===a.endContainer.nodeType&&a.endOffset<a.endContainer.data.length&&(this.split(a,l(j).parent(),!0),g=!0),1===a.endContainer.nodeType&&a.endOffset<a.endContainer.childNodes.length))this.split(a,l(j).parent(),!0),g=!0;g&&a.correctRange();if(e=(e=this.findHighestElement(a.getCommonAncestorContainer(),c,e))?e.parentNode:a.getCommonAncestorContainer())c=a.getRangeTree(e),this.recursiveRemoveMarkup(c,b),this.doCleanup({merge:!0,removeempty:!0},a,e)},recursiveRemoveMarkup:function(a,b){var e,c,
f;e=0;for(c=a.length;e<c;++e)"full"==a[e].type&&a[e].domobj.nodeName==b.get(0).nodeName&&(f=l(a[e].domobj).contents(),0<f.length?f.first().unwrap():l(a[e].domobj).remove()),a[e].children&&this.recursiveRemoveMarkup(a[e].children,b)},doCleanup:function(a,b,e){var f=this,j,g,m,d,k;"undefined"===typeof a&&(a={});"undefined"===typeof a.merge&&(a.merge=!1);"undefined"===typeof a.removeempty&&(a.removeempty=!1);"undefined"===typeof e&&b&&(e=b.getCommonAncestorContainer());g=j=!1;m=l(e);d=b.startOffset;
k=b.endOffset;m.contents().each(function(){var e;try{e=this.nodeType}catch(n){return}switch(e){case 1:e=this.nodeName;if(j&&j.nodeName===e){if(b.startContainer===m&&d>c(this)){b.startOffset=b.startOffset-1;g=true}if(b.endContainer===m&&k>c(this)){b.endOffset=b.endOffset-1;g=true}l(j).append(l(this).contents());g=g|f.doCleanup(a,b,j);l(this).remove()}else{g=g|f.doCleanup(a,b,this);var q=false;if(a.removeempty){o.Utils.Dom.isBlockLevelElement(this)&&this.childNodes.length===0&&(q=true);l.inArray(e.toLowerCase(),
f.mergeableTags)>=0&&(l(this).text().length===0&&this.childNodes.length===0)&&(q=true)}if(q){if(b.startContainer===this.parentNode&&d>c(this)){b.startOffset=b.startOffset-1;g=true}if(b.endContainer===this.parentNode&&k>c(this)){b.endOffset=b.endOffset-1;g=true}l(this).remove()}else j=(a.mergeable?a.mergeable(this):l.inArray(e.toLowerCase(),f.mergeableTags)>=0)?this:false}break;case 3:if(j&&j.nodeType===3&&a.merge){e=j.nodeValue.length;if(b.startContainer===this){b.startContainer=j;b.startOffset=b.startOffset+
e;g=true}else if(b.startContainer===j.parentNode&&b.startOffset===c(j)+1){b.startContainer=j;b.startOffset=e;g=true}if(b.endContainer===this){b.endContainer=j;b.endOffset=b.endOffset+e;g=true}else if(b.endContainer===j.parentNode&&b.endOffset===c(j)+1){b.endContainer=j;b.endOffset=e;g=true}j.data=j.data+this.data}else if(!(this.nodeValue===""&&a.removeempty)){j=this;break}if(b.startContainer===this.parentNode&&b.startOffset>c(this)){b.startOffset=b.startOffset-1;g=true}if(b.endContainer===this.parentNode&&
b.endOffset>c(this)){b.endOffset=b.endOffset-1;g=true}l(this).remove();e=j.nextSibling;if(j&&(!e||e.nodeType!==3)){var q=j.data,C=q.length;for(e=C-1;e>=0&&C>1;e--)if(q.charAt(e)==="​"){j.deleteData(e,1);if(b.startContainer===j&&b.startOffset>e){b.startOffset--;g=true}if(b.endContainer===j&&b.endOffset>e){b.endOffset--;g=true}}}}});g&&b.clearCaches();return g},isBlockLevelElement:function(a){return!a?!1:1===a.nodeType&&0<=l.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<=l.inArray(a.nodeName.toLowerCase(),this.listElements)},isSplitObject:function(a){return 1===a.nodeType&&n.hasOwnProperty(a.nodeName)},searchAdjacentTextNode:function(a,b,e,c){if(!a||1!==a.nodeType||0>b||b>a.childNodes.length)return!1;"undefined"===typeof c&&(c={blocklevel:!0,list:!0,linebreak:!0});"undefined"===typeof c.blocklevel&&(c.blocklevel=!0);"undefined"===typeof c.list&&(c.list=!0);
"undefined"===typeof c.linebreak&&(c.linebreak=!0);"undefined"===typeof e&&(e=!0);var f,j=a;e&&0<b&&(f=a.childNodes[b-1]);for(!e&&b<a.childNodes.length&&(f=a.childNodes[b]);j;)if(f){if(3===f.nodeType&&0<l.trim(f.data).length)return f;if(c.blocklevel&&this.isBlockLevelElement(f)||c.linebreak&&this.isLineBreakElement(f)||c.list&&this.isListElement(f))return!1;3===f.nodeType?f=e?f.previousSibling:f.nextSibling:(j=f,f=e?f.lastChild:f.firstChild)}else{if(c.blocklevel&&this.isBlockLevelElement(j)||c.list&&
this.isListElement(j))return!1;f=e?j.previousSibling:j.nextSibling;j=j.parentNode}},insertIntoDOM:function(a,b,c,d,k){var o=b.getContainerParents(c,d),n=this,x;c||(c=l(document.body));0===o.length?x=c.get(0):l.each(o,function(b,e){if(n.allowsNesting(e,a.get(0)))return x=e,!1});"undefined"===typeof x&&0<c.length&&(x=c.get(0));if(!this.allowsNesting(x,a.get(0))&&!k)return!1;if("undefined"!==typeof x){c=this.split(b,l(x),d);if(!0===c){c=b.startContainer;k=b.startOffset;d&&(c=b.endContainer,k=b.endOffset);
if(0===k)return b=l(c).contents(),0<b.length?b.eq(0).before(a):l(c).append(a),!0;l(c).contents().eq(k-1).after(a);return!0}if(c){b=c[1];e(c[0],a);if(j(b)||f(b))g(b.nextSibling||b.parentNode&&b.parentNode.nextSibling,m)&&l(b).remove();return!0}}return!1},removeFromDOM:function(a,b,e){if(e){var e=c(a),f=l(a).contents().length,j=a.parentNode;b.startContainer==j&&b.startOffset>e?b.startOffset+=f-1:b.startContainer==a&&(b.startContainer=j,b.startOffset=e+b.startOffset);b.endContainer==j&&b.endOffset>e?
b.endOffset+=f-1:b.endContainer==a&&(b.endContainer=j,b.endOffset=e+b.endOffset);l(a).contents().unwrap();this.doCleanup({merge:!0},b,j)}},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,l(a.startContainer).parent(),!1);3==a.endContainer.nodeType&&(0<a.endOffset&&a.endOffset<a.endContainer.data.length)&&this.split(a,l(a.endContainer).parent(),!0);var b=a.getRangeTree();a.endContainer=
a.startContainer;a.endOffset=a.startOffset;this.recursiveRemoveRange(b,a);this.doCleanup({merge:!0},a);a.clearCaches()},recursiveRemoveRange:function(a,b){var e;for(e=0;e<a.length;++e)"full"==a[e].type?(0<l(b.startContainer).parents().andSelf().filter(a[e].domobj).length&&(b.startContainer=b.endContainer=a[e].domobj.parentNode,b.startOffset=b.endOffset=c(a[e].domobj)),l(a[e].domobj).remove()):"partial"==a[e].type&&a[e].children&&this.recursiveRemoveRange(a[e].children,b)},extendToWord:function(a,
b){var e=this.searchWordBoundary(a.startContainer,a.startOffset,!0),c=this.searchWordBoundary(a.endContainer,a.endOffset,!1);if(b||!(a.startContainer==e.container&&a.startOffset==e.offset||a.endContainer==c.container&&a.endOffset==c.offset))a.startContainer=e.container,a.startOffset=e.offset,a.endContainer=c.container,a.endOffset=c.offset,a.correctRange(),a.clearCaches()},isWordBoundaryElement:function(a){return!a||!a.nodeName?!1:-1==l.inArray(a.nodeName.toLowerCase(),this.nonWordBoundaryTags)},searchWordBoundary:function(a,
b,e){"undefined"===typeof e&&(e=!0);for(var f=!1,j,g;!f;){var m=c(a);if(3===a.nodeType)if(e){for(g=j=a.data.substring(0,b).search(this.nonWordRegex);-1!=g;)j=g,g=a.data.substring(j+1,b).search(this.nonWordRegex),-1!=g&&(g=g+j+1);-1!=j?(b=j+1,f=!0):(b=m,a=a.parentNode)}else j=a.data.substring(b).search(this.nonWordRegex),-1!=j?(b+=j,f=!0):(b=m+1,a=a.parentNode);else 1===a.nodeType&&(e?0<b?this.isWordBoundaryElement(a.childNodes[b-1])?f=!0:(a=a.childNodes[b-1],b=3===a.nodeType?a.data.length:a.childNodes.length):
this.isWordBoundaryElement(a)?f=!0:(b=m,a=a.parentNode):b<a.childNodes.length?this.isWordBoundaryElement(a.childNodes[b])?f=!0:(a=a.childNodes[b],b=0):this.isWordBoundaryElement(a)?f=!0:(b=m+1,a=a.parentNode))}if(3!==a.nodeType&&(f=this.searchAdjacentTextNode(a,b,!e)))a=f,b=e?0:a.data.length;return{container:a,offset:b}},isEmpty:function(a){if(!a)return!0;if(-1!=l.inArray(a.nodeName.toLowerCase(),this.nonEmptyTags))return!1;if(3===a.nodeType)return-1==a.data.search(/\S/)||1===a.data.length&&8192<=
a.data.charCodeAt(0)?!0:!1;var b,e;b=0;for(e=a.childNodes.length;b<e;++b)if(!this.isEmpty(a.childNodes[b]))return!1;return!0},setCursorAfter:function(a){var b=new o.Utils.RangeObject;c(a);var e;3==a.nodeType?(e=a,a=e.nodeValue.length):a.nextSibling&&3==a.nextSibling.nodeType?(e=a.nextSibling,a=0):(e=a.parentNode,a=c(a)+1);b.startContainer=b.endContainer=e;b.startOffset=b.endOffset=a;b.select();return b},selectDomNode:function(a){var b=new o.Utils.RangeObject;b.startContainer=b.endContainer=a.parentNode;
b.startOffset=c(a);b.endOffset=b.startOffset+1;b.select()},setCursorInto:function(a){var b=new o.Utils.RangeObject;b.startContainer=b.endContainer=a;b.startOffset=b.endOffset=0;b.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,b){return this.getEditingHostOf(a)&&this.getEditingHostOf(a)==this.getEditingHostOf(b)},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,e){if(!b||b.nodeType==a.Node.TEXT_NODE&&this.isEmpty(b)||b.nodeType==a.Node.ELEMENT_NODE&&0==b.offsetHeight&&-1===l.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||!l(b).contentEditable())return e?b:null;var c;for(c=0;c<b.childNodes.length;++c){var f=this.getFirstVisibleChild(b.childNodes[c],!0);if(null!=f)return f}return null},getLastVisibleChild:function(b,e){if(!b||
b.nodeType==a.Node.TEXT_NODE&&this.isEmpty(b)||b.nodeType==a.Node.ELEMENT_NODE&&0==b.offsetHeight&&-1===l.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||!l(b).contentEditable())return e?b:null;var c;for(c=b.childNodes.length-1;0<=c;--c){var f=this.getLastVisibleChild(b.childNodes[c],!0);if(null!=f)return f}return null}});o.Utils.Dom=new d;return o.Utils.Dom});define("aloha/pluginmanager",["jquery",
"util/class"],function(l,d){function a(a,b){if(0===a.length)b&&b();else{var f=a.length,g=function(){0===--f&&b&&b()},j,m;for(j=0;j<a.length;j++)(m=a[j],m.settings=m.settings||{},"undefined"===typeof m.settings.enabled&&(m.settings.enabled=!0),m.settings.enabled&&m.checkDependencies())?(m=m.init())&&"function"===typeof m.done?m.done(g):g():g()}}var k=window.Aloha;return new (d.extend({plugins:{},init:function(c,b){var f=this.plugins,g=k&&k.settings&&k.settings.plugins,j;for(j in g)g.hasOwnProperty(j)&&
f[j]&&(f[j].settings=g[j]||{});var m;if(f&&0===b.length)for(m in b=[],f)f.hasOwnProperty(m)&&b.push(m);g=b;j=[];var e;for(e=0;e<g.length;e++)(m=f[g[e]])&&j.push(m);a(j,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)&&(k.Log.isDebugEnabled()&&k.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(l,d){function a(){var a=l.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 k(){l("html").mousedown(function(a){var b;if(b=c.activeEditable)if(b=!c.eventHandled)a=l(a.target),b=!(a.is(".aloha-dialog")||a.closest(".aloha").length);b&&
c.deactivateEditable()}).mouseup(function(){c.eventHandled=!1})}var c=window.Aloha,b=[{fn:null,event:null,deferred:null},{fn:function(b,g){if(a())l.browser.webkit?l("html").addClass("aloha-webkit"):l.browser.opera?l("html").addClass("aloha-opera"):l.browser.msie?l("html").addClass("aloha-ie"+parseInt(l.browser.version,10)):l.browser.mozilla&&l("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"),k(),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(),g();else{var j=window.console;if(j){var m=j.error?"error":j.log?"log":null;if(m)j[m]("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 j=d.plugins,m;for(m in j)j.hasOwnProperty(m)&&c.loadedPlugins.push(m)}var e=!1;d.init(function(){e||(a(),e=!0);b()},c.loadedPlugins);e||(a(),e=!0)},event:"aloha-plugins-loaded",deferred:null},{fn:function(a,b){var j;for(j=0;j<c.editables.length;j++)c.editables[j].ready||c.editables[j].init();a();b()},event:null,deferred:null},{fn:null,event:"aloha-ready",deferred:null}];l.extend(!0,c,{version:"0.23.26",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;l.each(this.loadedPlugins,function(c,m){if(a===m.toString()){b=true;return false}});return b},activateEditable:function(a){var b=c.editables,j;for(j=0;j<b.length;j++)b[j]!==a&&b[j].isActive&&b[j].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=l("#"+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,j;b=0;for(j=c.editables.length;b<j;b++)if(c.editables[b].originalObj.get(0)===a)return true;return false},getEditableHost:function(){var a=function(a){var b;for(b=0;b<c.editables.length;b++)if(c.editables[b].originalObj[0]===a)return c.editables[b];
return null};return function(b){if(!b||0===b.length)return null;var c=a(b[0]);c||b.parents().each(function(b,e){if(c=a(e))return false});return c}}(),log:function(a,b,j){typeof c.Log!=="undefined"&&c.Log.log(a,b,j)},registerEditable:function(a){c.editables.push(a)},unregisterEditable:function(a){a=l.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(j){c.Log.error(j,
"Could not disable enableObjectResizing")}},toString:function(){return"Aloha"}});return c});define("aloha/console",["aloha/core","util/class","jquery"],function(l,d){var a=d.extend({init:function(){if("undefined"===typeof l.settings.logLevels||!l.settings.logLevels)l.settings.logLevels={error:!0,warn:!0};if("undefined"===typeof l.settings.logHistory||!l.settings.logHistory)l.settings.logHistory={};l.settings.logHistory.maxEntries||(l.settings.logHistory.maxEntries=100);l.settings.logHistory.highWaterMark||
(l.settings.logHistory.highWaterMark=90);l.settings.logHistory.levels||(l.settings.logHistory.levels={error:!0,warn:!0});this.flushLogHistory();l.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 l.settings.logLevels&&l.settings.logLevels[a]){c=c||"Unkown Aloha Component";
this.addToLogHistory({level:a,component:c,message:b,date:new Date});var f=window.console;switch(a){case "error":window.console&&f.error&&(!c&&!b?f.error("Error occured without message and component"):f.error(c+": "+b));break;case "warn":window.console&&f.warn&&f.warn(c+": "+b);break;case "info":window.console&&f.info&&f.info(c+": "+b);break;case "debug":window.console&&f.log&&f.log(c+" ["+a+"]: "+b);break;default:window.console&&f.log&&f.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(l.settings.logLevels.deprecated)throw Error(c);},isLogLevelEnabled:function(a){return l.settings&&l.settings.logLevels&&l.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){l.settings.logHistory||this.init();if(!(0>=l.settings.logHistory.maxEntries)&&l.settings.logHistory.levels[a.level]){this.logHistory.push(a);!this.highWaterMarkReached&&this.logHistory.length>=l.settings.logHistory.maxEntries*l.settings.logHistory.highWaterMark/100&&(l.trigger("aloha-log-full"),this.highWaterMarkReached=!0);for(;this.logHistory.length>l.settings.logHistory.maxEntries;)this.logHistory.shift()}},
getLogHistory:function(){return this.logHistory},flushLogHistory:function(){this.logHistory=[];this.highWaterMarkReached=!1}}),a=new a;return l.Log=l.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(l,d,a,k,c){function b(a,b){var c=[],f;for(f=1===a.nodeType?a:a.parentNode;f&&!(f===b||9===f.nodeType);)1===f.nodeType&&c.push(f),f=f.parentNode;return c}function f(a,
b,c){var j,g,d=a.length;for(g=0;g<d;g++)j=a[g],"none"!==j.type&&"collapsed"!==j.type&&(j.domobj.nodeName===b&&c.push(j.domobj),0<j.children.length&&f(j.children,b,c))}var g=window.GENTICS,j=window.Aloha;g.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(){d.removeRange(this)},log:function(a){k.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,e){var c=e?this.endContainer:this.startContainer;return!c?!1:l(b(c,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(),c=this.getEndContainerParents(),f;if(!(0<b.length&&
0<c.length))return k.warn("aloha/range","could not find commonAncestorContainer"),!1;for(f=0;f<b.length;f++)if(-1!=c.index(b[f])){this.commonAncestorContainer=b[f];break}}k.debug(a?"commonAncestorContainer was set successfully":"commonAncestorContainer was calculated successfully");return!0},getCollapsedIERange:function(a,b){var c=document.body.createTextRange(),f,j,g;g=this.searchElementToLeft(a,b);g.element?(f=document.body.createTextRange(),f.moveToElementText(g.element),c.setEndPoint("StartToEnd",
f),0!==g.characters?c.moveStart("character",g.characters):(c.moveStart("character",1),c.moveStart("character",-1))):(this.searchElementToRight(a,b),j=3==a.nodeType?a.parentNode:a,f=document.body.createTextRange(),f.moveToElementText(j),c.setEndPoint("StartToStart",f),0!==g.characters&&c.moveStart("character",g.characters));c.collapse();return c},select:function(){var a;if("undefined"===typeof this.startContainer||"undefined"===typeof this.endContainer)return k.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 c,f=0;3===a.nodeType?(f=b,c=a.previousSibling):0<b&&(c=a.childNodes[b-1]);for(;c&&3===c.nodeType;)f+=c.data.length,c=c.previousSibling;return{element:c,characters:f}},searchElementToRight:function(a,b){var c,f=0;3===a.nodeType?(f=a.data.length-b,c=a.nextSibling):b<a.childNodes.length&&(c=a.childNodes[b]);for(;c&&
3===c.nodeType;)f+=c.data.length,c=c.nextSibling;return{element:c,characters:f}},update:function(a){k.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=g.Utils.Dom.searchAdjacentTextNode(this.startContainer,
this.startOffset,!0)){this.startContainer=this.endContainer=a;this.startOffset=this.endOffset=a.data.length;return}if(a=g.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=g.Utils.Dom.searchAdjacentTextNode(this.startContainer.parentNode,g.Utils.Dom.getIndexInParent(this.startContainer),!0))&&0<l(a).closest(j.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=g.Utils.Dom.searchAdjacentTextNode(this.startContainer.parentNode,
g.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,c=this,f=[];l(a).contents().each(function(j){var d="none",k=!1,s=!1,l=!1,v=!1,t=!1,x=!1;c.isCollapsed()&&(a===c.startContainer&&c.startOffset===j)&&(f[b]=new g.Utils.RangeTree,
f[b].type="collapsed",f[b].domobj=void 0,c.inselection=!1,l=!0,b++);if(!c.inselection&&!l)switch(this.nodeType){case 3:this===c.startContainer&&(c.inselection=!0,d=0<c.startOffset?"partial":"full",k=c.startOffset,s=this.length);break;case 1:if(this===c.startContainer&&0===c.startOffset&&(c.inselection=!0,d="full"),a===c.startContainer&&c.startOffset===j)c.inselection=!0,d="full"}if(c.inselection&&!l){"none"==d&&(d="full");switch(this.nodeType){case 3:this===c.endContainer&&(c.inselection=!1,c.endOffset<
this.length&&(d="partial"),!1===k&&(k=0),s=c.endOffset);break;case 1:this===c.endContainer&&0===c.endOffset&&(c.inselection=!1)}a===c.endContainer&&c.endOffset<=j&&(c.inselection=!1,d="none")}f[b]=new g.Utils.RangeTree;f[b].domobj=this;f[b].type=d;"partial"==d&&(f[b].startOffset=k,f[b].endOffset=s);f[b].children=c.recursiveGetRangeTree(this);if(0<f[b].children.length){for(j=0;j<f[b].children.length;++j)switch(f[b].children[j].type){case "none":v=!0;break;case "full":x=!0;break;case "partial":t=!0}t||
x&&v?f[b].type="partial":x&&(!t&&!v)&&(f[b].type="full")}b++});this.isCollapsed()&&(a===this.startContainer&&this.startOffset==a.childNodes.length)&&(f[b]=new g.Utils.RangeTree,f[b].type="collapsed",f[b].domobj=void 0);return f},findMarkup:function(a,e,c){var c=c?this.endContainer:this.startContainer,f,e=e?e[0]:null;if(c){e=b(c,e);c=0;for(f=e.length;c<f;c++)if(a.apply(e[c]))return e[c];return!1}},findAllMarkupByTagName:function(a,b){var c=b.getRangeTree(),j=[],a=a.toUpperCase();f(c,a,j);return j},
getText:function(){return this.isCollapsed()?"":this.recursiveGetText(this.getRangeTree())},recursiveGetText:function(a){if(!a)return"";var b=this,c="";l.each(a,function(){"full"==this.type?c+=l(this.domobj).text():"partial"==this.type&&3===this.domobj.nodeType?c+=l(this.domobj).text().substring(this.startOffset,this.endOffset):"partial"==this.type&&(1===this.domobj.nodeType&&this.children)&&(c+=b.recursiveGetText(this.children))});return c}});g.Utils.RangeTree=a.extend({domobj:{},type:null,children:[]});
return g.Utils.RangeObject});define("util/functions",[],function(){return{identity:function(l){return l},noop:function(){},returnTrue:function(){return!0},returnFalse:function(){return!1},complement:function(l){return function(){return!l.apply(this,arguments)}}}});define("util/arrays",["util/functions"],function(l){function d(a,b){var c,e,f=[];c=0;for(e=a.length;c<e;c++)f.push(b(a[c]));return f}function a(a,b){return a.map(b)}function k(a,b){var c,e,f,d=[];c=0;for(e=a.length;c<e;c++)f=a[c],b(f)&&
d.push(f);return d}function c(a,b){var c,e;c=0;for(e=a.length;c<e;c++)if(b===a[c])return c;return-1}function b(a,b){return-1!==c(a,b)}function f(a,b){var c,e;c=0;for(e=a.length;c<e;c++)if(b(a[c]))return!0;return!1}return{filter:k,indexOf:c,reduce:function(a,b,c){var e,f;e=0;for(f=a.length;e<f;e++)b=c(b,a[e]);return b},forEach:function(a,b){var c,e;c=0;for(e=a.length;c<e;c++)b(a[c],c,a)},some:f,every:function(a,b){return!f(a,l.complement(b))},map:Array.prototype.map?a:d,contains:b,equal:function(a,
b,c){var e,f=a.length;if(f!==b.length)return!1;if(c)for(e=0;e<f;e++){if(!c(a[e],b[e]))return!1}else for(e=0;e<f;e++)if(a[e]!==b[e])return!1;return!0},applyNotNull:function(a,b){return null==a?null:b(a)},sortUnique:function(a,b){var c;if(b){a.sort(b);for(c=1;c<a.length;c++)0===b(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},intersect:function(a,c){return k(a,function(a){return b(c,a)})},subtract:function(a,c){return k(a,function(a){return!b(c,
a)})},second:function(a){return a[1]},last:function(a){return a.length?a[a.length-1]:null}}});define("util/strings",["jquery"],function(){var l=/\s+/;return{words:function(d){d=d.split(l);d.length&&""===d[0]&&d.shift();d.length&&""===d[d.length-1]&&d.pop();return d},dashesToCamelCase:function(d){return d.replace(/[\-]([a-z])/gi,function(a,d){return d.toUpperCase()})},camelCaseToDashes:function(d){return d.replace(/[A-Z]/g,function(a){return"-"+a.toLowerCase()})},splitIncl:function(d,a){for(var k=
[],c=0,b;null!=(b=a.exec(d));)c<b.index&&(k.push(d.substring(c,b.index)),c=b.index),c+=b[0].length,k.push(b[0]);c<d.length&&k.push(d.substring(c,d.length));return k},empty:function(d){return""===d||null==d}}});define("PubSub",[],function(){var l={},d={},a=0;return{sub:function(k,c){if("function"!==typeof c)return-1;var b=l[k];b||(b=l[k]=[]);b.push(++a);d[a]={channel:k,callback:c};return a},unsub:function(a){if(-1===a||!d[a])return!1;var c=d[a]&&l[d[a].channel];delete d[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("."),f,g=b.length,j="",m=0;for(f=0;f<g;++f){var j=j+((0===f?"":".")+b[f]),e;var o=j;e=c;if(l[o]){e?"object"!==typeof e&&(e={data:e}):e={};e.channel=o;for(var o=l[o].slice(),n=void 0,n=0;n<o.length;++n)d[o[n]].callback(e);e=n}else e=0;m+=e}return m}}});define("util/maps",[],function(){return{isEmpty:function(l){for(var d in l)if(l.hasOwnProperty(d))return!1;return!0},fillTuples:function(l,d){for(var a=d.length,k;a--;)k=d[a],l[k[0]]=
k[1];return l},fillKeys:function(l,d,a){for(var k=d.length;k--;)l[d[k]]=a;return l},keys:function(l){var d=[],a;for(a in l)l.hasOwnProperty(a)&&d.push(a);return d},forEach:function(l,d){for(var a in l)l.hasOwnProperty(a)&&d(l[a],a,l)}}});define("util/html",["jquery","util/dom","util/maps","util/arrays"],function(l,d,a,k){function c(a){return o.test(a)||p.test(a)}function b(a){return 3===a.nodeType&&c(a.data)}function f(a){return u[a.nodeName]}function g(a){return 3===a.nodeType&&!a.length}var j={A:!0,
B:!0,EM:!0,FONT:!0,I:!0,S:!0,SPAN:!0,STRIKE:!0,STRONG:!0,SUB:!0,SUP:!0,U:!0},m="address article aside audio blockquote canvas dd div dl fieldset figcaption figure footer form h1 h2 h3 h4 h5 h6 header hgroup hr noscript ol output p pre section table tfoot ul video".split(" "),e=["\\u200B","\\u200C","\\u200D","\\uFEFF"],o=RegExp("^[\\u0009\\u000A\\u000B\\u000C\\u000D\\u0020\\u0085\\u00A0\\u1680\\u180E\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200A\\u2028\\u2029\\u202F\\u205F\\u3000]+$"),
n=RegExp("^[\\u0009\\u000A\\u000B\\u000C\\u000D\\u0020\\u0085\\u00A0\\u1680\\u180E\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200A\\u2028\\u2029\\u202F\\u205F\\u3000]+"),r=RegExp("[\\u0009\\u000A\\u000B\\u000C\\u000D\\u0020\\u0085\\u00A0\\u1680\\u180E\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200A\\u2028\\u2029\\u202F\\u205F\\u3000]+$"),p=RegExp("["+e.join("")+"]+"),q=RegExp("^["+e.join("")+"]+"),s=RegExp("["+e.join("")+"]+$"),u={};a.fillKeys(u,
m,!0);a.fillKeys(u,k.map(m,function(a){return a.toUpperCase()}),!0);return{BLOCKLEVEL_ELEMENTS:m,VOID_ELEMENTS:"area base br col command embed hr img input keygen link meta param source track wbr".split(" "),TEXT_LEVEL_SEMANTIC_ELEMENTS:"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".split(" "),isBlock:f,isIgnorableWhitespace:g,isInlineFormattable:function(a){return j[a.nodeName]},isProppedBlock:function(a){if(!u[a.nodeName])return!1;var b=
!1,a=a.children,c=a.length,e;for(e=0;e<c;e++)if(!b&&"br"===a[e].nodeName.toLowerCase())b=!0;else if(!g(a[e]))return!1;return b},isEditingHost:function(a){return 1===a.nodeType&&"true"===a.contentEditable},findNodeLeft:function(a,b){for(;a&&!b(a);)a=a.nextSibling;return a},findNodeRight:function(a,b){for(;a&&!b(a);)a=a.previousSibling;return a},allowNestedParagraph:function(a){return a.obj[0]&&d.allowsNesting(a.obj[0],l("<p>")[0])?!0:!1},trimWhitespaceCharacters:function(a){return a.replace(n,"").replace(r,
"").replace(q,"").replace(s,"")},isWSPorZWSPNode:b,isWSPorZWSPText:c,isUnrenderedNode:function(a){return 3===a.nodeType&&0===a.data.length||a===a.parentNode.lastChild&&f(a.parentNode)&&"BR"===a.nodeName?!0:b(a)}}});define("aloha/engine","aloha/core aloha/ecma5shims util/maps util/html util/dom jquery".split(" "),function(l,d,a,k,c,b){function f(a,b){return a.hasAttribute?a.hasAttribute(b):typeof a.attributes[b]!=="undefined"}function g(a,b){var c=a.cloneNode(false);c.deleteData(0,b);a.deleteData(b,
a.length-b);var e=a.nextSibling,f=a.parentNode;e?f.insertBefore(c,e):f.appendChild(c);return c}function j(a){return a===null||!a||a===xb}function m(a,b){typeof b=="string"&&(b=[b]);typeof b=="object"&&(b=d(b).map(function(a){return a.toUpperCase()}));return a&&a.nodeType==1&&j(a.namespaceURI)&&(typeof b=="undefined"||d(b).indexOf(a.tagName)!=-1)}function e(a){return a&&a.nodeType==1&&j(a.namespaceURI)}function o(a,b){return a&&a.nodeType==1&&j(a.namespaceURI)&&b.toUpperCase()===a.nodeName}function n(a,
b){var c;if(c=a)if(c=a.nodeType==1)if(c=j(a.namespaceURI))a:{c=a.nodeName;var e,f;c=c.toUpperCase();e=0;for(f=b.length;e<f;e++)if(b[e].toUpperCase()===c){c=true;break a}c=false}return c}function r(a){var b,c=0;if(!a||!a.style)return 0;if(typeof a.style.length!=="undefined")return a.style.length;for(b in a.style)a.style[b]&&(a.style[b]!==0&&a.style[b]!=="false")&&c++;return c}function p(a){if(!a)return null;var b=[],c;for(c=a.length>>>0;c--;)b[c]=a[c];return b}function q(a){for(;a&&!a.nextSibling;)a=
a.parentNode;return!a?null:a.nextSibling}function s(a){return a.hasChildNodes()?a.firstChild:q(a)}function u(a){if(a.previousSibling){for(a=a.previousSibling;a.hasChildNodes();)a=a.lastChild;return a}return a.parentNode&&a.parentNode.nodeType==d.Node.ELEMENT_NODE?a.parentNode:null}function v(a,b){return a&&b&&Boolean(d.compareDocumentPosition(a,b)&d.Node.DOCUMENT_POSITION_CONTAINED_BY)}function t(a,b){return b&&a&&Boolean(d.compareDocumentPosition(b,a)&d.Node.DOCUMENT_POSITION_CONTAINED_BY)}function x(a,
b){return Boolean(d.compareDocumentPosition(a,b)&d.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=[],c=q(a);null!=(a=s(a))&&a!=c;)b.push(a);return b}function E(a){return{"xx-small":1,small:2,medium:3,large:4,"x-large":5,"xx-large":6,"xxx-large":7}[a]}function A(a){return a.dir=="ltr"?"ltr":a.dir=="rtl"?"rtl":!e(a.parentNode)?"ltr":A(a.parentNode)}function C(a){switch(a.nodeType){case d.Node.PROCESSING_INSTRUCTION_NODE:case d.Node.DOCUMENT_TYPE_NODE:return 0;
case d.Node.TEXT_NODE:case d.Node.COMMENT_NODE:return a.length;default:return a.childNodes.length}}function J(a,b,e,f){if(a==e){if(b==f)return"equal";if(b<f)return"before";if(b>f)return"after"}var j=d.compareDocumentPosition(e,a);if(j&d.Node.DOCUMENT_POSITION_FOLLOWING){f=J(e,f,a,b);if(f=="before")return"after";if(f=="after")return"before"}if(j&d.Node.DOCUMENT_POSITION_CONTAINS){for(;e.parentNode!=a;)e=e.parentNode;if(c.getIndexInParent(e)<b)return"after"}return"before"}function S(a){for(;a.parentNode!=
null;)a=a.parentNode;return a}function F(a,b){return J(a,0,b.startContainer,b.startOffset)!=="after"||J(a,C(a),b.endContainer,b.endOffset)!=="before"?false:S(a)==S(b.startContainer)}function B(a,b){typeof b=="undefined"&&(b=function(){return true});for(var c=a.startContainer,c=c.hasChildNodes()&&a.startOffset<c.childNodes.length?c.childNodes[a.startOffset]:a.startOffset==C(c)?q(c):s(c),e=a.endContainer,e=e.hasChildNodes()&&a.endOffset<e.childNodes.length?e.childNodes[a.endOffset]:q(e),f=[];x(c,e);)if(F(c,
a)&&b(c)){f.push(c);c=q(c)}else c=s(c);return f}function O(a,b){typeof b=="undefined"&&(b=function(){return true});for(var c=a.startContainer,c=c.hasChildNodes()&&a.startOffset<c.childNodes.length?c.childNodes[a.startOffset]:a.startOffset==C(c)?q(c):s(c),e=a.endContainer,e=e.hasChildNodes()&&a.endOffset<e.childNodes.length?e.childNodes[a.endOffset]:q(e),f=[];x(c,e);){F(c,a)&&b(c)&&f.push(c);c=s(c)}return f}function Y(a){if(a.toLowerCase()=="currentcolor")return null;var b=document.createElement("span");
document.body.appendChild(b);b.style.color="black";var c=document.createElement("span");b.appendChild(c);c.style.color=a;a=d.getComputedStyle(c).color;if(a=="rgb(0, 0, 0)"){b.color="white";a=d.getComputedStyle(c).color;if(a!="rgb(0, 0, 0)")return null}document.body.removeChild(b);return/^rgba\([0-9]+, [0-9]+, [0-9]+, 1\)$/.test(a)?a.replace("rgba","rgb").replace(", 1)",")"):a=="transparent"?"rgba(0, 0, 0, 0)":a}function R(a){a=a.toLowerCase();if(d(["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"]).indexOf(a)!=-1)return a;var a=Y(a),b=/^rgb\(([0-9]+), ([0-9]+), ([0-9]+)\)$/.exec(a);return b?"#"+parseInt(b[1],10).toString(16).replace(/^.$/,"0$&")+parseInt(b[2],10).toString(16).replace(/^.$/,"0$&")+parseInt(b[3],10).toString(16).replace(/^.$/,"0$&"):/^#[abcdef0123456789]+$/i.exec(a)?a:null}function V(a){a=d(a).trim();if(/^[\-+]?[0-9]+(\.[0-9]+)?([eE][\-+]?[0-9]+)?$/.test(a)){var b;
if(a[0]=="+"){a=a.slice(1);b="relative-plus"}else if(a[0]=="-"){a=a.slice(1);b="relative-minus"}else b="absolute";a=parseInt(a,10);b=="relative-plus"&&(a=a+3);b=="relative-minus"&&(a=3-a);a<1&&(a=1);a>7&&(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 G(a){a=V(a);if(b.inArray(a,["xx-small","x-small","small","medium","large","x-large","xx-large","xxx-large"])==-1&&!/^[0-9]+(\.[0-9]+)?(cm|mm|in|pt|pc|px)$/.test(a))return null;var c=document.createElement("font");
document.body.appendChild(c);a=="xxx-large"?c.size=7:c.style.fontSize=a;a=parseInt(d.getComputedStyle(c).fontSize,10);document.body.removeChild(c);for(var e=1;e<7;){c=document.createElement("font");c.size=e;document.body.appendChild(c);var f=parseInt(d.getComputedStyle(c).fontSize,10);c.size=1+e;var j=parseInt(d.getComputedStyle(c).fontSize,10);document.body.removeChild(c);if(a<(j+f)/2)return""+e;e++}return"7"}function N(a,b,c,e){var f;kb===0&&(Ia=c);kb++;try{f=e()}catch(j){kb--;throw j;}kb--;return f}
function H(a,c){a=a.toLowerCase();return N(a,"action",c,function(a){return function(){return b.inArray(a,["copy","cut","paste","selectall","stylewithcss","usecss"])!=-1||c!==null}}(a))}function T(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 Z(a,b,c,e){var f=a.toLowerCase(),j=b,g=c;if(arguments.length==1||arguments.length>=4&&typeof j=="undefined")j=false;if(arguments.length<=
2||arguments.length>=4&&typeof g=="undefined")g="";return N(f,"action",e,function(a,b,c){return function(){if(!H(a))return false;L[a].action(c,e);T(e);return true}}(f,j,g))}function X(a,b){a=a.toLowerCase();return N(a,"state",b,function(a){return function(){return!H(a,b)?false:typeof $a(a,b)!="undefined"?$a(a,b):L[a].state(b)}}(a))}function da(a,b){a=a.toLowerCase();return N(a,"value",b,function(){return!L.hasOwnProperty(a)||!L[a].hasOwnProperty("value")?"":a=="fontsize"&&Ja("fontsize",b)!==void 0?
G(Ja("fontsize",b)):typeof Ja(a,b)!="undefined"?Ja(a,b):L[a].value(b)})}function la(a){return a&&a.nodeType==1&&j(a.namespaceURI)&&$[a.nodeName]}function Q(a){return a&&(a.nodeType==d.Node.ELEMENT_NODE&&!yb[d.getComputedStyle(a).display]||a.nodeType==d.Node.DOCUMENT_NODE||a.nodeType==d.Node.DOCUMENT_FRAGMENT_NODE)}function I(a){return a&&!Q(a)}function P(a){return a&&a.nodeType==d.Node.ELEMENT_NODE&&(a.contentEditable=="true"||a.parentNode&&a.parentNode.nodeType==d.Node.DOCUMENT_NODE&&a.parentNode.designMode==
"on")}function D(a){return a&&!P(a)&&(a.nodeType!=d.Node.ELEMENT_NODE||a.contentEditable!="false"||b(a).hasClass("aloha-table-wrapper"))&&(P(a.parentNode)||D(a.parentNode))}function Qa(a){var b;for(b=0;b<a.childNodes.length;b++)if(D(a.childNodes[b])||Qa(a.childNodes[b]))return true;return false}function Ha(a){if(P(a))return a;if(D(a)){for(a=a.parentNode;!P(a);)a=a.parentNode;return a}return null}function ea(a,b){return Ha(a)&&Ha(a)==Ha(b)}function xa(a){if(!o(a,"br"))return false;for(var c=a.parentNode;d.getComputedStyle(c).display==
"inline";)c=c.parentNode;var e=c.style.height,f=c.style.maxHeight,j=c.style.minHeight;c.style.height="auto";c.style.maxHeight="none";if(!(b.browser.msie&&b.browser.version<8))c.style.minHeight="0";var g=document.createTextNode("​"),m=c.offsetHeight;if(m==0)throw"isCollapsedLineBreak: original height is zero, bug?";a.parentNode.insertBefore(g,a.nextSibling);a=c.offsetHeight;g.parentNode.removeChild(g);c.style.height=e;c.style.maxHeight=f;if(!(b.browser.msie&&b.browser.version<8))c.style.minHeight=
j;return m<a-5}function Ga(a){if(!o(a,"br")||o(a.parentNode,"li")&&a.parentNode.childNodes.length==1)return false;for(var c=a.parentNode;d.getComputedStyle(c).display=="inline";)c=c.parentNode;var e=c.style.height,f=c.style.maxHeight,j=c.style.minHeight,g=c.contentEditable;c.style.height="auto";c.style.maxHeight="none";c.style.minHeight="0";if(b.browser.msie&&b.browser.version<=7)c.contentEditable="false";var m=c.offsetHeight;if(m==0)throw"isExtraneousLineBreak: original height is zero, bug?";var k=
a.style.display;a.style.display="none";var n=c.offsetHeight;c.style.height=e;c.style.maxHeight=f;c.style.minHeight=j;if(b.browser.msie&&b.browser.version<=7)c.contentEditable=g;a.style.display=k;return m==n}function ia(a){var c=d.Node;if(a&&a.nodeType===c.TEXT_NODE){var e=a.parentNode,a=a.data;if(b.trim(a).length===0)return true;if(e&&/^[\t\n\r ]+$/.test(a))if(e.nodeType===c.ELEMENT_NODE){if(b.inArray(d.getComputedStyle(e).whiteSpace,["normal","nowrap"])!==-1||d.getComputedStyle(e).whiteSpace==="pre-line")return true}else if(e.nodeType===
c.DOCUMENT_FRAGMENT_NODE)return true}return false}function ya(a){if(!ia(a))return false;if(a.data=="")return true;var b=a.parentNode;if(!b||d(y(a)).some(function(a){return a.nodeType==d.Node.ELEMENT_NODE&&d.getComputedStyle(a).display=="none"}))return true;for(;!Q(b)&&b.parentNode;)b=b.parentNode;for(var c=a;c!=b;){c=u(c);if(Q(c)||o(c,"br"))return true;if(c.nodeType==d.Node.TEXT_NODE&&!ia(c)||o(c,"img"))break}c=a;for(a=q(b);c!=a;){c=s(c);if(Q(c)||o(c,"br"))return true;if(c&&c.nodeType==d.Node.TEXT_NODE&&
!ia(c)||o(c,"img"))break}return false}function ca(a){var b;if(!a||d(y(a).concat(a)).filter(function(a){return a.nodeType==d.Node.ELEMENT_NODE},true).some(function(a){return d.getComputedStyle(a).display=="none"}))return false;if(Q(a)||a.nodeType==d.Node.TEXT_NODE&&!ya(a)||o(a,"img")||o(a,"br")&&!Ga(a))return true;for(b=0;b<a.childNodes.length;b++)if(ca(a.childNodes[b]))return true;return false}function ka(a){return a&&!ca(a)}function za(a){var b;if(xa(a)&&!Ga(a))return true;if(!I(a)||a.nodeType!=
d.Node.ELEMENT_NODE)return false;var c=false;for(b=0;b<a.childNodes.length;b++){if(!ka(a.childNodes[b])&&!za(a.childNodes[b]))return false;za(a.childNodes[b])&&(c=true)}return c}function Oa(a){var b;if(a&&a.nodeType!==d.Node.TEXT_NODE)b=false;else{b=0;for(var a=a.data,c=a.length;b<c&&a.charAt(b)==="​";)b++;b=b===c}return!b}function jb(a){var b;if(b=a){if(!(b=!a.hasChildNodes())){if(k.isBlock(a))b=(b=k.findNodeRight(a.lastChild,ca))&&"br"===b.nodeName.toLowerCase()&&!k.findNodeRight(b.previousSibling,
ca);else b=false;b=b||!k.findNodeRight(a.lastChild,Oa)}b=b&&P(a.parentNode)&&!a.previousSibling&&!a.nextSibling}return b}function Ya(a){var b=a.parentNode,e=c.getIndexInParent(a);b.removeChild(a);return{node:b,offset:e}}function K(){var a;if(Ia)a=Ia;else if(l.getSelection().rangeCount)a=l.getSelection().getRangeAt(0);else return null;if(b.inArray(a.startContainer.nodeType,[d.Node.TEXT_NODE,d.Node.ELEMENT_NODE])==-1||b.inArray(a.endContainer.nodeType,[d.Node.TEXT_NODE,d.Node.ELEMENT_NODE])==-1||!a.startContainer.ownerDocument||
!a.endContainer.ownerDocument||!t(a.startContainer,a.startContainer.ownerDocument)||!t(a.endContainer,a.endContainer.ownerDocument))throw"Invalid active range; test bug?";return a}function pa(a,b,e,f){if(e==-1)e=b.childNodes.length;var j=a.parentNode,g=c.getIndexInParent(a),m,k=[f];for(m=0;m<l.getSelection().rangeCount;m++)k.push(l.getSelection().getRangeAt(m));var o=[];d(k).forEach(function(a){o.push([a.startContainer,a.startOffset]);o.push([a.endContainer,a.endOffset])});d(o).forEach(function(a){a[0]==
b&&a[1]>e&&a[1]++;if(a[0]==j&&(a[1]==g||a[1]==g+1)){a[0]=b;a[1]=a[1]+(e-g)}a[0]==j&&a[1]>g+1&&a[1]--});b.childNodes.length==e?b.appendChild(a):b.insertBefore(a,b.childNodes[e]);var n=null;if(o[0][1]>o[0][0].childNodes.length&&o[1][1]>o[1][0].childNodes.length){f.setStart(a,0);f.setEnd(a,0)}else{f.setStart(o[0][0],o[0][1]);f.setEnd(o[1][0],o[1][1]);l.getSelection().removeAllRanges();for(m=1;m<k.length;m++){n=l.createRange();n.setStart(o[2*m][0],o[2*m][1]);n.setEnd(o[2*m+1][0],o[2*m+1][1]);l.getSelection().addRange(n)}n&&
(f=n)}}function Wa(a,c){b.browser.msie&&(b.browser.version>=7&&typeof a.attributes[b.expando]!=="undefined")&&b(a).removeAttr(b.expando);var e=a.attributes,f;for(f=0;f<e.length;f++){var j=e[f];if(typeof j.specified==="undefined"||j.specified)typeof c.setAttributeNS==="function"?c.setAttributeNS(j.namespaceURI,j.name,j.value):c.setAttribute(j.name,j.value)}}function Fa(a,b,c){if(o(a,b)||!a.parentNode)return a;b=a.ownerDocument.createElement(b);a.parentNode.insertBefore(b,a);for(Wa(a,b);a.childNodes.length;)pa(a.firstChild,
b,b.childNodes.length,c);a.parentNode.removeChild(a);if(c.startContainer===a)c.startContainer=b;if(c.endContainer===a)c.endContainer=b;return b}function Na(a){var b=a.previousSibling;if(b){for(;b.hasChildNodes();)b=b.lastChild;for(;ka(b)&&!Ga(b)&&b!=a.parentNode;)b=u(b);D(b)&&Ga(b)&&b.parentNode.removeChild(b)}}function fb(a){for(var b=a;b.hasChildNodes();)b=b.lastChild;for(;ka(b)&&!Ga(b)&&b!=a;)b=u(b);D(b)&&Ga(b)&&b.parentNode.removeChild(b)}function Pa(a){Na(a);fb(a)}function Ea(a,b,e,f){var j;
typeof b=="undefined"&&(b=function(){return false});typeof e=="undefined"&&(e=function(){return null});if(!a.length||!D(a[0]))return null;I(a[a.length-1])&&(!o(a[a.length-1],"br")&&o(a[a.length-1].nextSibling,"br"))&&a.push(a[a.length-1].nextSibling);e=D(a[0].previousSibling)&&b(a[0].previousSibling)?a[0].previousSibling:D(a[a.length-1].nextSibling)&&b(a[a.length-1].nextSibling)?a[a.length-1].nextSibling:e();if(!e)return null;var g=e.parentNode;if(!g){a[0].parentNode.insertBefore(e,a[0]);j=f.startContainer;
var m=f.startOffset,d=f.endContainer,k=f.endOffset,n=c.getIndexInParent(e);m>=n&&j==g&&f.setStart(j,m+1);k>=n&&d==g&&f.setEnd(d,k+1);if(Ia&&Ia!==f){j=Ia.startContainer;m=Ia.startOffset;d=Ia.endContainer;k=Ia.endOffset;j==g&&m>=n&&Ia.setStart(j,m+1);d==g&&k>=n&&Ia.setEnd(d,k+1)}}m=a[0].parentNode;if(x(e,a[0])){!I(e)&&(I(e.lastChild)&&I(a[0])&&!o(e.lastChild,"BR"))&&e.appendChild(e.ownerDocument.createElement("br"));for(j=0;j<a.length;j++)pa(a[j],e,-1,f)}else{!I(e)&&(I(e.firstChild)&&I(a[a.length-1])&&
!o(a[a.length-1],"BR"))&&e.insertBefore(e.ownerDocument.createElement("br"),e.firstChild);for(j=a.length-1;j>=0;j--)pa(a[j],e,0,f)}D(m)&&!m.hasChildNodes()&&m.parentNode.removeChild(m);if(D(e.nextSibling)&&b(e.nextSibling)){for(!I(e)&&(I(e.lastChild)&&I(e.nextSibling.firstChild)&&!o(e.lastChild,"BR"))&&e.appendChild(e.ownerDocument.createElement("br"));e.nextSibling.hasChildNodes();)pa(e.nextSibling.firstChild,e,-1,f);g.removeChild(e.nextSibling)}Pa(e);return e}function ha(a,c){if((zb[c]||n(c,["colgroup",
"table","tbody","tfoot","thead","tr"]))&&typeof a=="object"&&a.nodeType==d.Node.TEXT_NODE&&!/^[ \t\n\f\r]*$/.test(a.data)||(Ab[c]||n(c,["script","style","plaintext","xmp"]))&&(typeof a!="object"||a.nodeType!=d.Node.TEXT_NODE)||typeof a=="object"&&(a.nodeType==d.Node.DOCUMENT_NODE||a.nodeType==d.Node.DOCUMENT_FRAGMENT_NODE||a.nodeType==d.Node.DOCUMENT_TYPE_NODE))return false;e(a)&&(a=a.tagName.toLowerCase());if(typeof a!="string")return true;if(e(c)){for(var f=c;f;){if(a=="a"&&o(f,"a")||$[a.toUpperCase()]&&
f&&f.nodeType==1&&j(f.namespaceURI)&&Bb[f.nodeName]||/^h[1-6]$/.test(a)&&e(f)&&/^H[1-6]$/.test(f.tagName))return false;f=f.parentNode}c=c.tagName.toLowerCase()}if(typeof c=="object"&&(c.nodeType==d.Node.ELEMENT_NODE||c.nodeType==d.Node.DOCUMENT_FRAGMENT_NODE))return true;if(typeof c!="string")return false;switch(c){case "colgroup":return a=="col";case "table":return b.inArray(a,["caption","col","colgroup","tbody","td","tfoot","th","thead","tr"])!=-1;case "tbody":case "thead":case "tfoot":return b.inArray(a,
["td","th","tr"])!=-1;case "tr":return b.inArray(a,["td","th"])!=-1;case "dl":return b.inArray(a,["dt","dd"])!=-1;case "dir":case "ol":case "ul":return b.inArray(a,["dir","li","ol","ul"])!=-1;case "hgroup":return/^h[1-6]$/.test(a)}if(b.inArray(a,["body","caption","col","colgroup","frame","frameset","head","html","tbody","td","tfoot","th","thead","tr"])!=-1||b.inArray(a,["dd","dt"])!=-1&&c!="dl"||a=="li"&&c!="ol"&&c!="ul")return false;return(f=Cb[c.toUpperCase()])&&f[a.toUpperCase()]?false:true}function Xa(a,
b){return b.collapsed?false:F(a,b)||a==b.startContainer&&a.nodeType==d.Node.TEXT_NODE&&C(a)!=b.startOffset||a==b.endContainer&&a.nodeType==d.Node.TEXT_NODE&&b.endOffset!=0||a.hasChildNodes()&&d(a.childNodes).every(function(a){return Xa(a,b)})&&(!t(b.startContainer,a)||b.startContainer.nodeType!=d.Node.TEXT_NODE||b.startOffset==0)&&(!t(b.endContainer,a)||b.endContainer.nodeType!=d.Node.TEXT_NODE||b.endOffset==C(b.endContainer))?true:false}function qa(a,b){typeof b=="undefined"&&(b=function(){return true});
for(var c=a.startContainer;Xa(c.parentNode,a);)c=c.parentNode;for(var e=q(a.endContainer),f=[];x(c,e);){Xa(c,a)&&b(c)&&f.push(c);c=s(c)}return f}function Za(a){if(!e(a))return false;if(b.inArray(a.tagName,["B","EM","I","S","SPAN","STRIKE","STRONG","SUB","SUP","U"])!=-1&&(a.attributes.length==0||a.attributes.length==1&&f(a,"style")))return true;if(a.tagName=="FONT"||a.tagName=="A"){var c=a.attributes.length;f(a,"style")&&c--;if(a.tagName=="FONT"){f(a,"color")&&c--;f(a,"face")&&c--;f(a,"size")&&c--}a.tagName==
"A"&&f(a,"href")&&c--;if(c==0)return true}return false}function Ra(a){return!e(a)||b.inArray(a.tagName,["A","B","EM","FONT","I","S","SPAN","STRIKE","STRONG","SUB","SUP","U"])==-1?false:a.attributes.length==0?true:a.attributes.length>1?false:f(a,"style")&&r(a)==0||a.tagName=="A"&&f(a,"href")||a.tagName=="FONT"&&(f(a,"color")||f(a,"face")||f(a,"size"))||(a.tagName=="B"||a.tagName=="STRONG")&&f(a,"style")&&r(a)==1&&a.style.fontWeight!=""||(a.tagName=="I"||a.tagName=="EM")&&f(a,"style")&&r(a)==1&&a.style.fontStyle!=
""||(a.tagName=="A"||a.tagName=="FONT"||a.tagName=="SPAN")&&f(a,"style")&&r(a)==1&&a.style.textDecoration==""||b.inArray(a.tagName,["A","FONT","S","SPAN","STRIKE","U"])!=-1&&f(a,"style")&&r(a)==1&&(a.style.textDecoration=="line-through"||a.style.textDecoration=="underline"||a.style.textDecoration=="overline"||a.style.textDecoration=="none")?true:false}function va(a,b,c){return b===null&&c===null||typeof b=="string"&&typeof c=="string"&&b==c&&!L[a].hasOwnProperty("equivalentValues")||typeof b=="string"&&
typeof c=="string"&&L[a].hasOwnProperty("equivalentValues")&&L[a].equivalentValues(b,c)?true:false}function Da(a,b,c){if(va(a,b,c))return true;if(a!="fontsize"||typeof b!="string"||typeof c!="string")return false;var e=Da;if(e.sizeMap===void 0){e.sizeMap={};var f=document.createElement("font");document.body.appendChild(f);d(["xx-small","small","medium","large","x-large","xx-large","xxx-large"]).forEach(function(a){f.size=E(a);e.sizeMap[a]=d.getComputedStyle(f).fontSize});document.body.removeChild(f)}return b===
e.sizeMap[c]||c===e.sizeMap[b]}function ba(a,b){if(a.nodeType!=d.Node.ELEMENT_NODE&&(!a.parentNode||a.parentNode.nodeType!=d.Node.ELEMENT_NODE))return null;if(a.nodeType!=d.Node.ELEMENT_NODE)return ba(a.parentNode,b);if(b=="createlink"||b=="unlink"){for(;a&&(!e(a)||a.tagName!="A"||!f(a,"href"));)a=a.parentNode;return!a?null:a.getAttribute("href")}if(b=="backcolor"||b=="hilitecolor"){for(;(d.getComputedStyle(a).backgroundColor=="rgba(0, 0, 0, 0)"||d.getComputedStyle(a).backgroundColor===""||d.getComputedStyle(a).backgroundColor==
"transparent")&&a.parentNode&&a.parentNode.nodeType==d.Node.ELEMENT_NODE;)a=a.parentNode;return d.getComputedStyle(a).backgroundColor=="rgba(0, 0, 0, 0)"||d.getComputedStyle(a).backgroundColor===""||d.getComputedStyle(a).backgroundColor=="transparent"?"rgb(255, 255, 255)":d.getComputedStyle(a).backgroundColor}if(b=="subscript"||b=="superscript"){for(var c=false,j=false;I(a);){d.getComputedStyle(a);o(a,"sub")?c=true:o(a,"sup")&&(j=true);a=a.parentNode}return c&&j?"mixed":c?"subscript":j?"superscript":
null}if(b=="strikethrough"){do{if(d.getComputedStyle(a).textDecoration.indexOf("line-through")!=-1)return"line-through";a=a.parentNode}while(a&&a.nodeType==d.Node.ELEMENT_NODE);return null}if(b=="underline"){do{if(d.getComputedStyle(a).textDecoration.indexOf("underline")!=-1)return"underline";a=a.parentNode}while(a&&a.nodeType==d.Node.ELEMENT_NODE);return null}if(!L[b].hasOwnProperty("relevantCssProperty"))throw"Bug: no relevantCssProperty for "+b+" in getEffectiveCommandValue";return d.getComputedStyle(a)[L[b].relevantCssProperty].toString()}
function ra(a,b){if((b=="backcolor"||b=="hilitecolor")&&d.getComputedStyle(a).display!="inline")return null;if(b=="createlink"||b=="unlink")return e(a)&&a.tagName=="A"&&f(a,"href")?a.getAttribute("href"):null;if(b=="subscript"||b=="superscript")return o(a,"sup")?"superscript":o(a,"sub")?"subscript":null;if(b=="strikethrough"&&a.style.textDecoration!="")return a.style.textDecoration.indexOf("line-through")!=-1?"line-through":null;if(b=="strikethrough"&&n(a,["S","STRIKE"]))return"line-through";if(b==
"underline"&&a.style.textDecoration!="")return a.style.textDecoration.indexOf("underline")!=-1?"underline":null;if(b=="underline"&&o(a,"U"))return"underline";var c=L[b].relevantCssProperty;if(c===null)return null;if(a.style[c]!="")return a.style[c];if(j(a.namespaceURI)&&a.tagName=="FONT"){if(c=="color"&&f(a,"color"))return a.color;if(c=="fontFamily"&&f(a,"face"))return a.face;if(c=="fontSize"&&f(a,"size")){c=parseInt(a.size,10);c<1&&(c=1);c>7&&(c=7);return{1:"xx-small",2:"small",3:"medium",4:"large",
5:"x-large",6:"xx-large",7:"xxx-large"}[c]}}return c=="fontWeight"&&(a.tagName=="B"||a.tagName=="STRONG")?"bold":c=="fontStyle"&&(a.tagName=="I"||a.tagName=="EM")?"italic":null}function La(a,b,e,f){for(var j=a;Za(j)&&j.childNodes.length==1&&Za(j.firstChild)&&(!Ra(j)||!va(b,ra(j,b),e));)j=j.firstChild;if(!(j==a||!Ra(j)||!va(b,ra(j,b),e)||!Da(b,ba(j,b),e))){for(;j.hasChildNodes();)pa(j.firstChild,j.parentNode,c.getIndexInParent(j),f);a.parentNode.insertBefore(j,a.nextSibling);pa(a,j,-1,f)}}function sa(a){var c=
[],a=b.makeArray(a),e,f,j,g,m,d;for(e=0;e<a.length;e++){j=a[e];for(f=0;f<rb.length;f++){g=rb[f];m=j;if(m.nodeType!=1)m=m.parentNode;for(d=null;m&&m.nodeType==1&&(d=ra(m,g))===null;)m=m.parentNode;c.push([j,g,d])}}return c}function ga(a,b,e){if(!D(a)||ra(a,b)===null)return[];if(Ra(a)){var b=Array.prototype.slice.call(p(a.childNodes)),f;for(f=0;f<b.length;f++)pa(b[f],a.parentNode,c.getIndexInParent(a),e);a.parentNode.removeChild(a);return b}if(b=="strikethrough"&&a.style.textDecoration.indexOf("line-through")!=
-1){a.style.textDecoration=a.style.textDecoration=="line-through"?"":a.style.textDecoration.replace("line-through","");a.getAttribute("style")==""&&a.removeAttribute("style")}if(b=="underline"&&a.style.textDecoration.indexOf("underline")!=-1){a.style.textDecoration=a.style.textDecoration=="underline"?"":a.style.textDecoration.replace("underline","");a.getAttribute("style")==""&&a.removeAttribute("style")}if(L[b].relevantCssProperty!==null){a.style[L[b].relevantCssProperty]="";a.getAttribute("style")==
""&&a.removeAttribute("style")}if(j(a.namespaceURI)&&a.tagName=="FONT"){b=="forecolor"&&a.removeAttribute("color");b=="fontname"&&a.removeAttribute("face");b=="fontsize"&&a.removeAttribute("size")}o(a,"A")&&(b=="createlink"||b=="unlink")&&a.removeAttribute("href");return ra(a,b)===null?[]:[Fa(a,"span",e)]}function Ta(a,e,f,j){var g=[],m,k;if(a.parentNode&&f!==null){if(ha(a,"span")){La(a.previousSibling,e,f,j);La(a.nextSibling,e,f,j);Ea([a],function(a){return Ra(a)&&va(e,ra(a,e),f)&&Da(e,ba(a,e),f)},
function(){return null},j)}if(!Da(e,ba(a,e),f))if(ha(a,"span")){if(!Da(e,ba(a,e),f)){g=null;if(!ua){if(e=="bold"&&(f=="bold"||f=="700"))g=a.ownerDocument.createElement("b");e=="italic"&&f=="italic"&&(g=a.ownerDocument.createElement("i"));e=="strikethrough"&&f=="line-through"&&(g=a.ownerDocument.createElement("s"));e=="underline"&&f=="underline"&&(g=a.ownerDocument.createElement("u"));if(e=="forecolor"&&R(f)){g=a.ownerDocument.createElement("span");b(g).css("color",R(f))}if(e=="fontname"){g=a.ownerDocument.createElement("font");
g.face=f}}if(e=="createlink"||e=="unlink"){g=a.ownerDocument.createElement("a");g.setAttribute("href",f);for(m=a.parentNode;m;){o(m,"A")&&(m=Fa(m,"span",j));m=m.parentNode}}if(e=="fontsize"&&b.inArray(f,["xx-small","small","medium","large","x-large","xx-large","xxx-large"])!=-1&&(!ua||f=="xxx-large")){g=a.ownerDocument.createElement("font");g.size=E(f)}if((e=="subscript"||e=="superscript")&&f=="subscript")g=a.ownerDocument.createElement("sub");if((e=="subscript"||e=="superscript")&&f=="superscript")g=
a.ownerDocument.createElement("sup");g||(g=a.ownerDocument.createElement("span"));a.parentNode.insertBefore(g,a);m=L[e].relevantCssProperty;m!==null&&!Da(e,ba(g,e),f)&&(g.style[m]=f);if(e=="strikethrough"&&f=="line-through"&&ba(g,"strikethrough")!="line-through")g.style.textDecoration="line-through";if(e=="underline"&&f=="underline"&&ba(g,"underline")!="underline")g.style.textDecoration="underline";pa(a,g,g.childNodes.length,j);if(a.nodeType==d.Node.ELEMENT_NODE&&!va(e,ba(a,e),f)){pa(a,g.parentNode,
c.getIndexInParent(g),j);g.parentNode.removeChild(g);g=[];for(m=0;m<a.childNodes.length;m++){if(a.childNodes[m].nodeType==d.Node.ELEMENT_NODE){k=ra(a.childNodes[m],e);if(k!==null&&!va(e,f,k))continue}g.push(a.childNodes[m])}for(m=0;m<g.length;m++)Ta(g[m],e,f,j)}}}else{for(m=0;m<a.childNodes.length;m++){if(a.childNodes[m].nodeType==d.Node.ELEMENT_NODE){k=ra(a.childNodes[m],e);if(k!==null&&!va(e,f,k))continue}g.push(a.childNodes[m])}for(m=0;m<g.length;m++)Ta(g[m],e,f,j)}}}function Sa(a,b,c,e){if(a.parentNode&&
a.parentNode.nodeType==d.Node.ELEMENT_NODE&&!Da(b,ba(a,b),c)){for(var f=a.parentNode,j=[];D(f)&&f.nodeType==d.Node.ELEMENT_NODE&&!Da(b,ba(f,b),c);){j.push(f);f=f.parentNode}if(j.length){var g=ra(j[j.length-1],b);if(!(g===null&&g!=c)&&(c===null||Da(b,ba(j[j.length-1].parentNode,b),c)))for(;j.length;){f=j.pop();ra(f,b)!==null&&(g=ra(f,b));c=Array.prototype.slice.call(p(f.childNodes));ra(f,b)!==null&&ga(f,b,e);for(f=0;f<c.length;f++){var m=c[f];m!=a&&!(m.nodeType==d.Node.ELEMENT_NODE&&ra(m,b)!==null&&
!va(b,g,ra(m,b)))&&m!=j[j.length-1]&&Ta(m,b,g,e)}}}}}function Aa(a,b){d(a).forEach(function(a){var c=a[0],e=a[1],a=a[2],f=c;if(!f||f.nodeType!=d.Node.ELEMENT_NODE)f=f.parentNode;for(;f&&f.nodeType==d.Node.ELEMENT_NODE&&ra(f,e)===null;)f=f.parentNode;a===null&&f&&f.nodeType==d.Node.ELEMENT_NODE?Sa(c,e,null,b):(f&&f.nodeType==d.Node.ELEMENT_NODE&&!va(e,ra(f,e),a)||(!f||f.nodeType!=d.Node.ELEMENT_NODE)&&a!==null)&&Ta(c,e,a,b)})}function na(a,b,c){c=c||K();if(d(qa(c)).filter(function(a){return a.nodeType==
d.Node.TEXT_NODE},true).some(D)){if(D(c.startContainer)&&c.startContainer.nodeType==d.Node.TEXT_NODE&&c.startOffset!=0&&c.startOffset!=C(c.startContainer)){var e=g(c.startContainer,c.startOffset),f=l.createRange();if(c.startContainer==c.endContainer){var j=c.endOffset-c.startOffset;f.setEnd(e,j);c.setEnd(e,j)}f.setStart(e,0);l.getSelection().removeAllRanges();l.getSelection().addRange(f);c.setStart(e,0)}if(D(c.endContainer)&&c.endContainer.nodeType==d.Node.TEXT_NODE&&c.endOffset!=0&&c.endOffset!=
C(c.endContainer)){e=c;f=[e.startContainer,e.startOffset];j=[e.endContainer,e.endOffset];g(e.endContainer,e.endOffset);e.setStart(f[0],f[1]);e.setEnd(j[0],j[1]);l.getSelection().removeAllRanges();l.getSelection().addRange(e)}d(qa(K(),function(a){return D(a)&&a.nodeType==d.Node.ELEMENT_NODE})).forEach(function(b){ga(b,a,c)});d(qa(c,D)).forEach(function(e){Sa(e,a,b,c);Ta(e,a,b,c)})}else{L[a].hasOwnProperty("inlineCommandActivatedValues")&&lb(a,d(L[a].inlineCommandActivatedValues).indexOf(b)!=-1,c);
a=="subscript"&&mb("superscript",c);a=="superscript"&&mb("subscript",c);b===null?sb(a,c):L[a].hasOwnProperty("value")&&pb(a,b,c)}}function gb(a,b){var c;if(a.nodeType===d.Node.TEXT_NODE&&b<a.length)for(c=b;c<a.length;c++)if(a.data.charAt(c)!=="\t"&&a.data.charAt(c)!=="\r"&&a.data.charAt(c)!=="\n"||a.data.charCodeAt(c)===160)return false;if(a.nextSibling&&a.nextSibling.className&&a.nextSibling.className.indexOf("aloha-table-wrapper")>=0)return a.nextSibling;if(a.parentNode&&a.parentNode.nextSibling&&
a.parentNode.nextSibling.className&&a.parentNode.nextSibling.className.indexOf("aloha-table-wrapper")>=0)return a.parentNode.nextSibling;if(a.parentNode&&a.parentNode.nextSibling&&ia(a.parentNode.nextSibling)&&a.parentNode.nextSibling.nextSibling&&a.parentNode.nextSibling.nextSibling.className&&a.parentNode.nextSibling.nextSibling.className.indexOf("aloha-table-wrapper")>=0)return a.parentNode.nextSibling.nextSibling}function W(a,b){var c;if(a.nodeType===d.Node.TEXT_NODE&&b>0)for(c=b-1;c>=0;c--)if(a.data.charAt(c)!==
"\t"&&a.data.charAt(c)!=="\r"&&a.data.charAt(c)!=="\n"||a.data.charCodeAt(c)===160)return false;return a.previousSibling&&a.previousSibling.className&&a.previousSibling.className.indexOf("aloha-table-wrapper")>=0?a.previousSibling:a.parentNode&&a.parentNode.previousSibling&&a.parentNode.previousSibling.className&&a.parentNode.previousSibling.className.indexOf("aloha-table-wrapper")>=0?a.parentNode.previousSibling:a.parentNode&&a.parentNode.previousSibling&&ia(a.parentNode.previousSibling)&&a.parentNode.previousSibling.previousSibling&&
a.parentNode.previousSibling.previousSibling.className&&a.parentNode.previousSibling.previousSibling.className.indexOf("aloha-table-wrapper")>=0?a.parentNode.previousSibling.previousSibling:false}function M(a,b){return!a.parentNode&&b==0||0<=b-1&&b-1<a.childNodes.length&&ca(a.childNodes[b-1])&&(Q(a.childNodes[b-1])||o(a.childNodes[b-1],"br"))}function wa(a,b){return!a.parentNode&&b==C(a)||b<a.childNodes.length&&ca(a.childNodes[b])&&Q(a.childNodes[b])}function fa(a){for(var b=0;!M(a,b)&&!wa(a,b);){if(0<=
b-1&&b-1<a.childNodes.length&&ca(a.childNodes[b-1]))return false;if(b==0||!a.hasChildNodes()){b=c.getIndexInParent(a);a=a.parentNode}else{a=a.childNodes[b-1];b=C(a)}}return true}function oa(a){for(var b=C(a);!M(a,b)&&!wa(a,b);){if(b<a.childNodes.length&&ca(a.childNodes[b]))return false;if(b==C(a)||!a.hasChildNodes()){b=1+c.getIndexInParent(a);a=a.parentNode}else{a=a.childNodes[b];b=0}}return true}function ta(a,e){var f,j=a[0].parentNode;if(D(j)&&j.parentNode){b.inArray(j.firstChild,a)!=-1&&Na(j);
f=b.inArray(j.firstChild,a)!=-1;var g=b.inArray(j.lastChild,a)!=-1,m=f&&fa(j),d=g&&oa(j);if(!f&&g){for(f=a.length-1;f>=0;f--)pa(a[f],j.parentNode,1+c.getIndexInParent(j),e);d&&!oa(a[a.length-1])&&a[a.length-1].parentNode.insertBefore(document.createElement("br"),a[a.length-1].nextSibling);fb(j)}else{if(!f){f=j.cloneNode(false);j.removeAttribute("id");for(j.parentNode.insertBefore(f,j);a[0].previousSibling;)pa(j.firstChild,f,f.childNodes.length,e)}for(f=0;f<a.length;f++)pa(a[f],j.parentNode,c.getIndexInParent(j),
e);m&&!fa(a[0])&&a[0].parentNode.insertBefore(document.createElement("br"),a[0]);I(a[a.length-1])&&(!o(a[a.length-1],"br")&&o(j.firstChild,"br")&&!I(j))&&j.removeChild(j.firstChild);if(j.hasChildNodes())Na(j);else{if(j.parentNode===e.startContainer&&j.parentNode===e.endContainer&&e.startContainer===e.endContainer&&e.startOffset===e.endOffset&&j.parentNode.childNodes.length===e.startOffset){e.startOffset=j.parentNode.childNodes.length-1;e.endOffset=e.startOffset}j.parentNode.removeChild(j);d&&!oa(a[a.length-
1])&&a[a.length-1].parentNode.insertBefore(document.createElement("br"),a[a.length-1].nextSibling)}!a[a.length-1].nextSibling&&a[a.length-1].parentNode&&fb(a[a.length-1].parentNode)}}}function U(a){return n(a,["address","div","h1","h2","h3","h4","h5","h6","listing","p","pre","xmp"])}function ja(a){return U(a)||n(a,["li","dt","dd"])}function aa(){return document.createElement("br")}function Ma(a){a&&(P(a)||o(a.lastChild,"br")||d(a.childNodes).some(ca)||(b.browser.msie?b.browser.msie&&(b.browser.version<=
7&&n(a,["p","h1","h2","h3","h4","h5","h6","pre","blockquote"]))&&(a.firstChild||a.appendChild(document.createTextNode("​"))):a.appendChild(aa())))}function Ka(a,e){var f;if(D(a))if(d(y(a)).every(function(b){return!ea(a,b)||!ha(a,b)})&&!m(a,bb))if(n(a,["dd","dt"]))Ea([a],function(a){return o(a,"dl")&&!a.attributes.length},function(){return document.createElement("dl")},e);else{if(la(a)){a=Fa(a,bb,e);Ma(a);Ka(a,e);var j=z(a);for(f=0;f<j.length;f++)Ka(j[f],e)}}else{for(var j=sa([a]),g;!ha(a,a.parentNode);){for(f=
a.parentNode.childNodes.length-1;f>=0;--f)if(a.parentNode.childNodes[f].nodeType==3&&a.parentNode.childNodes[f].data.length==0){a.parentNode.removeChild(a.parentNode.childNodes[f]);e.startContainer==a.parentNode&&e.startOffset>f&&e.startOffset--;e.endContainer==a.parentNode&&e.endOffset>f&&e.endOffset--}if(a.parentNode.childNodes.length==1){f=e.startOffset;g=e.endOffset;e.startContainer===a.parentNode&&e.startOffset>c.getIndexInParent(a)&&(f=e.startOffset+(b(a).contents().length-1));e.endContainer===
a.parentNode&&e.endOffset>c.getIndexInParent(a)&&(g=e.endOffset+(b(a).contents().length-1));b(a).contents().unwrap();e.startOffset=f;e.endOffset=g;break}else{f=a.parentNode;ta([a],e);if(f===a.parentNode){f=e.startOffset;g=e.endOffset;e.startContainer===a.parentNode&&e.startOffset>c.getIndexInParent(a)&&(f=e.startOffset+(b(a).contents().length-1));e.endContainer===a.parentNode&&e.endOffset>c.getIndexInParent(a)&&(g=e.endOffset+(b(a).contents().length-1));b(a).contents().unwrap();e.startOffset=f;e.endOffset=
g;break}}}Aa(j,e)}}function hb(a,b){function e(a){return n(a,["OL","UL"])}if(o(a,"LI")&&D(a)&&D(a.parentNode))for(var f=null;d(a.childNodes).some(e);){var j=a.lastChild;if(n(j,["OL","UL"])||!f&&j.nodeType==d.Node.TEXT_NODE&&/^[ \t\n\f\r]*$/.test(j.data)){f=null;pa(j,a.parentNode,1+c.getIndexInParent(a),b)}else{if(!f){f=a.ownerDocument.createElement("li");a.parentNode.insertBefore(f,a.nextSibling)}pa(j,f,0,b)}}}function Db(a,c){n(a,["OL","UL"])&&D(a)&&b(a).children("ol,ul").each(function(a,b){o(b.previousSibling,
"LI")&&pa(b,b.previousSibling,b.previousSibling.childNodes.length,c)})}function ma(a){var b=a.startContainer,e=a.startOffset,f=a.endContainer,a=a.endOffset,j=d(y(b).concat(b)).filter(function(a){return o(a,"li")}).slice(-1);if(j.length){e=c.getIndexInParent(j[0]);b=j[0].parentNode}if(!M(b,e)){do if(e==0){e=c.getIndexInParent(b);b=b.parentNode}else e--;while(!M(b,e)&&!wa(b,e))}for(;e==0&&b.parentNode;){e=c.getIndexInParent(b);b=b.parentNode}j=d(y(f).concat(f)).filter(function(a){return o(a,"li")}).slice(-1);
if(j.length){a=1+c.getIndexInParent(j[0]);f=j[0].parentNode}if(!wa(f,a)){do if(a==C(f)){a=1+c.getIndexInParent(f);f=f.parentNode}else a++;while(!M(f,a)&&!wa(f,a))}for(;a==C(f)&&f.parentNode;){a=1+c.getIndexInParent(f);f=f.parentNode}j=l.createRange();j.setStart(b,e);j.setEnd(f,a);return j}function ib(){var a=ma(K()),b=B(a,function(a){return D(a)&&(n(a,["ol","ul"])||n(a.parentNode,["ol","ul"])||ha(a,"li"))});if(!b.length)return"none";if(d(b).every(function(a){return o(a,"ol")||o(a.parentNode,"ol")||
o(a.parentNode,"li")&&o(a.parentNode.parentNode,"ol")})&&!d(b).some(function(a){return o(a,"ul")||a.querySelector&&a.querySelector("ul")}))return"ol";if(d(b).every(function(a){return o(a,"ul")||o(a.parentNode,"ul")||o(a.parentNode,"li")&&o(a.parentNode.parentNode,"ul")})&&!d(b).some(function(a){return o(a,"ol")||a.querySelector&&a.querySelector("ol")}))return"ul";a=d(b).some(function(a){return o(a,"ol")||o(a.parentNode,"ol")||a.querySelector&&a.querySelector("ol")||o(a.parentNode,"li")&&o(a.parentNode.parentNode,
"ol")});b=d(b).some(function(a){return o(a,"ul")||o(a.parentNode,"ul")||a.querySelector&&a.querySelector("ul")||o(a.parentNode,"li")&&o(a.parentNode.parentNode,"ul")});return a&&b?"mixed":a?"mixed ol":b?"mixed ul":"none"}function Ba(a){for(;a&&a.nodeType!=d.Node.ELEMENT_NODE||a.nodeType==d.Node.ELEMENT_NODE&&b.inArray(d.getComputedStyle(a).display,["inline","none"])!=-1;)a=a.parentNode;if(!a||a.nodeType!=d.Node.ELEMENT_NODE)return"left";var c=d.getComputedStyle(a).textAlign.replace(/^-(moz|webkit)-/,
"").replace(/^auto$/,"start");return c=="start"?A(a)=="ltr"?"left":"right":c=="end"?A(a)=="ltr"?"right":"left":b.inArray(c,["center","justify","left","right"])!=-1?c:"left"}function Eb(a){var b=[];Ja("createlink",a)!==void 0&&b.push(["createlink",Ja("createlink",a)]);d(["bold","italic","strikethrough","subscript","superscript","underline"]).forEach(function(c){$a(c,a)!==void 0&&b.push([c,$a(c,a)])});d(["fontname","fontsize","forecolor","hilitecolor"]).forEach(function(c){Ja(c,a)!==void 0&&b.push([c,
Ja(c,a)])});return b}function Fb(a){var b=[],c=d(qa(a)).filter(function(a){return D(a)&&a.nodeType==d.Node.TEXT_NODE})[0];if(!c)return b;b.push(["createlink",L.createlink.value(a)]);d(["bold","italic","strikethrough","subscript","superscript","underline"]).forEach(function(a){d(L[a].inlineCommandActivatedValues).indexOf(ba(c,a))!=-1?b.push([a,true]):b.push([a,false])});d(["fontname","fontsize","forecolor","hilitecolor"]).forEach(function(c){b.push([c,L[c].value(a)])});b.push(["fontsize",ba(c,"fontsize")]);
return b}function cb(a,b){function c(a){return D(a)&&a.nodeType==d.Node.TEXT_NODE}var e,f,j,g=d(qa(b)).filter(function(a){return D(a)&&a.nodeType==d.Node.TEXT_NODE})[0];if(g)for(e=0;e<a.length;e++){f=a[e][0];j=a[e][1];if(typeof j=="boolean"&&X(f,b)!=j)Z(f,false,j,b);else if(typeof j=="string"&&f!="fontsize"&&!va(f,da(f,b),j))Z(f,false,j,b);else if(typeof j=="string"&&f=="fontsize"&&(Ja("fontsize",b)!==void 0&&Ja("fontsize",b)!==j||Ja("fontsize",b)===void 0&&!Da(f,ba(g,"fontsize"),j)))Z("fontsize",
false,j,b);else continue;g=d(qa(b)).filter(c)[0]||g}else for(e=0;e<a.length;e++){f=a[e][0];j=a[e][1];typeof j=="boolean"&&lb(f,j,b);typeof j=="string"&&pb(f,j,b)}}function Gb(a,b,c){if(a==0)return"";if(a==1&&!b&&!c)return" ";if(a==1)return" ";var e="",f;for(f=b?"  ":"  ";a>3;){e=e+f;a=a-2}return a==3?e+(!b&&!c?"   ":b&&!c?"   ":!b&&c?"   ":b&&c?"   ":"impossible"):e+(!b&&!c?"  ":b&&!c?"  ":!b&&c?"  ":b&&c?"  ":"impossible")}function Ua(a,e){if(D(a)||P(a)){for(var f=a,j=e;;)if(0<=j-1&&ea(f,f.childNodes[j-
1])){f=f.childNodes[j-1];j=C(f)}else if(j==0&&!fa(f)&&ea(f,f.parentNode)){j=c.getIndexInParent(f);f=f.parentNode}else if(f.nodeType==d.Node.TEXT_NODE&&b.inArray(d.getComputedStyle(f.parentNode).whiteSpace,["pre","pre-wrap"])==-1&&j!=0&&/[ \xa0]/.test(f.data[j-1]))j--;else break;for(var g=f,m=j,k=0,o=false;;)if(m<g.childNodes.length&&ea(g,g.childNodes[m])){g=g.childNodes[m];m=0}else if(m==C(g)&&!oa(g)&&ea(g,g.parentNode)){m=1+c.getIndexInParent(g);g=g.parentNode}else if(g.nodeType==d.Node.TEXT_NODE&&
b.inArray(d.getComputedStyle(g.parentNode).whiteSpace,["pre","pre-wrap"])==-1&&m!=C(g)&&/[ \xa0]/.test(g.data[m]))if(o&&" "==g.data[m])g.deleteData(m,1);else{o=" "==g.data[m];m++;k++}else break;for(k=Gb(k,j==0&&fa(f),m==C(g)&&oa(g));J(f,j,g,m)=="before";)if(j<f.childNodes.length){f=f.childNodes[j];j=0}else if(f.nodeType!=d.Node.TEXT_NODE||j==C(f)){j=1+c.getIndexInParent(f);f=f.parentNode}else{o=k[0];k=k.slice(1);if(o!=f.data[j]){f.insertData(j,o);f.deleteData(j+1,1)}j++}}}function Ca(a,b,e,f,j){var g,
m={},k;if(arguments.length<3)g=a;else{g=l.createRange();g.setStart(a,b);g.setEnd(e,f)}arguments.length==2&&(m=b);arguments.length==5&&(m=j);var s=null!=m.blockMerging?!!m.blockMerging:true,q=null!=m.stripWrappers?!!m.stripWrappers:true;if(g){var r=g.startContainer;k=g.startOffset;for(var x=g.endContainer,u=g.endOffset,y;r.hasChildNodes();)if(k==C(r)&&ea(r,r.parentNode)&&I(r)){k=1+c.getIndexInParent(r);r=r.parentNode}else{if(k==C(r))break;y=r.childNodes[k];if(Q(y)||y.nodeType==d.Node.ELEMENT_NODE&&
!y.hasChildNodes()||y.nodeType!=d.Node.ELEMENT_NODE&&y.nodeType!=d.Node.TEXT_NODE)break;r=y;k=0}for(;x.hasChildNodes();)if(u==0&&ea(x,x.parentNode)&&I(x)){u=c.getIndexInParent(x);x=x.parentNode}else{if(u==0)break;y=x.childNodes[u-1];if(Q(y)||y.nodeType==d.Node.ELEMENT_NODE&&!y.hasChildNodes()||y.nodeType!=d.Node.ELEMENT_NODE&&y.nodeType!=d.Node.TEXT_NODE)break;x=y;u=C(y)}if(J(x,u,r,k)!=="after"){g.setEnd(g.startContainer,g.startOffset);return g}if(x.nodeType==d.Node.TEXT_NODE&&u==C(x)&&r!=x){u=1+
c.getIndexInParent(x);x=x.parentNode}g.setStart(r,k);g.setEnd(x,u);for(var z=g.startContainer;ea(z,z.parentNode)&&I(z);)z=z.parentNode;if(!Q(z)&&!P(z)||!ha("span",z)||n(z,["td","th"]))z=null;for(var A=g.endContainer;ea(A,A.parentNode)&&I(A);)A=A.parentNode;if(!Q(A)&&!P(A)||!ha("span",A)||n(A,["td","th"]))A=null;m=Fb(g);if(r==x&&D(r)&&r.nodeType==d.Node.TEXT_NODE){y=r.parentNode;r.deleteData(k,u-k);k>0&&(r.data.substr(k-1,1)===" "&&k<r.data.length&&r.data.substr(k,1)===" ")&&r.replaceData(k-1,1," ");
Ua(r,k);g.setStart(g.startContainer,g.startOffset);g.setEnd(g.startContainer,g.startOffset);cb(m,g);(D(y)||P(y))&&!I(y)&&Ma(y);return g}D(r)&&r.nodeType==d.Node.TEXT_NODE&&r.deleteData(k,C(r)-k);var E=B(g,function(a){return D(a)&&!n(a,["thead","tbody","tfoot","tr","th","td"])});for(k=0;k<E.length;k++){var da=E[k];y=da.parentNode;y.removeChild(da);if(q||!v(y,r)&&y!=r)for(;D(y)&&I(y)&&C(y)==0;){da=y.parentNode;da.removeChild(y);y=da}(D(y)||P(y))&&!I(y)&&Ma(y)}D(x)&&x.nodeType==d.Node.TEXT_NODE&&x.deleteData(0,
u);Ua(g.startContainer,g.startOffset);Ua(g.endContainer,g.endOffset);if(!s||!z||!A||!ea(z,A)||z==A){g.setEnd(g.startContainer,g.startOffset);A=z||A;if(jb(A)){A=Ya(A);g.setStart(A.node,A.offset);g.setEnd(A.node,A.offset)}cb(m,g);return g}z.children.length==1&&za(z.firstChild)&&z.removeChild(z.firstChild);A.children.length==1&&za(A.firstChild)&&A.removeChild(A.firstChild);if(v(z,A)){for(y=A;y.parentNode!=z;)y=y.parentNode;g.setStart(z,c.getIndexInParent(y));g.setEnd(z,c.getIndexInParent(y));if(!A.hasChildNodes()){for(;D(A)&&
A.parentNode.childNodes.length==1&&A.parentNode!=z;){y=A;y.removeChild(A);A=y}D(A)&&(!I(A)&&I(A.previousSibling)&&I(A.nextSibling))&&A.parentNode.insertBefore(document.createElement("br"),A.nextSibling);D(A)&&A.parentNode.removeChild(A);cb(m,g);return g}if(!I(A.firstChild)){cb(m,g);return g}q=[];for(q.push(A.firstChild);!o(q[q.length-1],"br")&&I(q[q.length-1].nextSibling);)q.push(q[q.length-1].nextSibling);for(s=sa(q);q[0].parentNode!=z;)ta(q,g);D(q[0].previousSibling)&&o(q[0].previousSibling,"br")&&
q[0].parentNode.removeChild(q[0].previousSibling)}else if(t(z,A)){g.setStart(z,C(z));g.setEnd(z,C(z));for(y=z;y.parentNode!=A;)y=y.parentNode;I(y.nextSibling)&&o(z.lastChild,"br")&&z.removeChild(z.lastChild);A=[];y.nextSibling&&(!o(y.nextSibling,"br")&&!Q(y.nextSibling))&&A.push(y.nextSibling);A.length&&(A[A.length-1].nextSibling&&!o(A[A.length-1].nextSibling,"br")&&!Q(A[A.length-1].nextSibling))&&A.push(A[A.length-1].nextSibling);s=sa(A);d(A).forEach(function(a){pa(a,z,-1,g)});o(y.nextSibling,"br")&&
y.parentNode.removeChild(y.nextSibling)}else{g.setStart(z,C(z));g.setEnd(z,C(z));I(A.firstChild)&&o(z.lastChild,"br")&&z.removeChild(z.lastChild);for(s=sa([].slice.call(p(A.childNodes)));A.hasChildNodes();)pa(A.firstChild,z,-1,g);for(;!A.hasChildNodes();){y=A.parentNode;y.removeChild(A);A=y}}Aa(s,g);if(jb(z)){A=Ya(z);g.setStart(A.node,A.offset);g.setEnd(A.node,A.offset);z=A.node}Ma(z);cb(m,g);return g}}function nb(a,b){a.hasChildNodes()?ta([].slice.call(p(a.childNodes)),b):a.parentNode.removeChild(a)}
function Hb(a,e){a&&b(a).find("ul,ol,li").each(function(){b(this).contents().each(function(){if(ia(this)){var a=c.getIndexInParent(this);if(e.startContainer===this.parentNode&&e.startOffset>a)e.startOffset--;else if(e.startContainer===this){e.startContainer=this.parentNode;e.startOffset=a}if(e.endContainer===this.parentNode&&e.endOffset>a)e.endOffset--;else if(e.endContainer===this){e.endContainer=this.parentNode;e.endOffset=a}b(this).remove()}})})}function Ib(a,b){if(a.length){var c=a[0];if(n(c.parentNode,
["OL","UL"])){var e=c.parentNode.tagName;Ea(a,function(a){return m(a,e)},function(){return c.ownerDocument.createElement(e)},b)}else{var f=Ea(a,function(){return false},function(){return c.ownerDocument.createElement("blockquote")},b);Ka(f,b)}}}function qb(a,b){if(D(a)){for(var c=a.parentNode,e=[];D(c)&&c.nodeType==d.Node.ELEMENT_NODE&&!n(c,["ol","ul"]);){e.push(c);c=c.parentNode}D(c);c=a.parentNode;for(e=[];D(c)&&c.nodeType==d.Node.ELEMENT_NODE&&!n(c,["ol","ul"]);){e.push(c);c=c.parentNode}if(n(a,
["OL","UL"])&&(!D(c)||1)){a.removeAttribute("reversed");a.removeAttribute("start");a.removeAttribute("type");c=[].slice.call(p(a.childNodes));if(a.attributes.length&&!n(a.parentNode,["OL","UL"]))Fa(a,"div",b);else{e=sa([].slice.call(p(a.childNodes)));nb(a,b);Aa(e,b)}for(e=0;e<c.length;e++)Ka(c[e],b)}else D(c)}}function tb(a,b){function c(){return document.createElement("li")}function e(a){return n(a,["ol","ul"])}function f(a){return function(b){return m(b,a)}}function j(a){return function(){return document.createElement(a)}}
function g(a,b){return function(){D(b[0].parentNode);return document.createElement(a)}}var k=ib()==a?"disable":"enable",a=a.toUpperCase(),s=a=="OL"?"UL":"OL",t=[];(function(){var a;for(a=b.endContainer;a!=b.commonAncestorContainer;a=a.parentNode)o(a,"li")&&t.unshift(a);for(a=b.startContainer;a;a=a.parentNode)o(a,"li")&&t.unshift(a)})();d(t).forEach(function(a){hb(a,b)});var q=ma(b);k=="enable"&&d(O(q,function(a){return D(a)&&m(a,s)})).forEach(function(c){if(D(c.previousSibling)&&m(c.previousSibling,
a)||D(c.nextSibling)&&m(c.nextSibling,a)){var c=[].slice.call(p(c.childNodes)),e=sa(c);ta(c,b);Ea(c,function(b){return m(b,a)},function(){return null},b);Aa(e,b)}else Fa(c,a,b)});q=B(q,function(a){return D(a)&&(n(a,["OL","UL"])||n(a.parentNode,["OL","UL"])||ha(a,"li"))});k=="enable"&&(q=d(q).filter(function(a){return!n(a,["ol","ul"])||n(a.parentNode,["ol","ul"])}));var r;if(k=="disable")for(;q.length;){k=[];k.push(q.shift());if(m(k[0],a))qb(k[0],b);else{for(;q.length&&q[0]==k[k.length-1].nextSibling&&
!m(q[0],a);)k.push(q.shift());r=sa(k);ta(k,b);var l;for(l=0;l<k.length;l++)Ka(k[l],b);Aa(r,b)}}else for(;q.length;){for(k=[];!k.length||q.length&&q[0]==k[k.length-1].nextSibling;)if(n(q[0],["p","div"])){k.push(Fa(q[0],"li",b));q.shift()}else if(n(q[0],["li","ol","ul"]))k.push(q.shift());else{for(r=[];!r.length||q.length&&q[0]==r[r.length-1].nextSibling&&I(q[0])&&I(r[r.length-1])&&!o(r[r.length-1],"br");)r.push(q.shift());k.push(Ea(r,void 0,c,b))}if(!m(k[0].parentNode,a)&&!d(k).every(e))if(m(k[0].parentNode,
s)){r=sa(k);ta(k,b);Ea(k,f(a),j(a),b);Aa(r,b)}else Ka(Ea(k,f(a),g(a,k,b),b),b)}}function ob(a,b){function c(a){return function(b){return o(b,"div")&&d(b.attributes).every(function(c){return c.name=="align"&&c.value.toLowerCase()==a||c.name=="style"&&r(b)==1&&b.style.textAlign==a})}}function e(a){return function(){var b=document.createElement("div");b.setAttribute("style","text-align: "+a);return b}}for(var j=ma(b),g=O(j,function(a){return a.nodeType==d.Node.ELEMENT_NODE&&D(a)&&(f(a,"align")||a.style.textAlign!=
""||o(a,"center"))}),j=0;j<g.length;j++){var m=g[j];m.removeAttribute("align");m.style.textAlign="";m.getAttribute("style")==""&&m.removeAttribute("style");n(m,["div","span","center"])&&!m.attributes.length&&nb(m,b);o(m,"center")&&m.attributes.length&&Fa(m,"div",b)}j=ma(Ia);g=[];for(g=B(j,function(b){return D(b)&&ha(b,"div")&&Ba(b)!=a});g.length;){j=[];for(j.push(g.shift());g.length&&g[0]==j[j.length-1].nextSibling;)j.push(g.shift());Ea(j,c(a),e(a),b)}}function ub(a,b){var c;if(a.collapsed){c=a.startOffset;
if(b){if(a.startContainer&&a.startContainer.nodeType===d.Node.TEXT_NODE)for(;c<a.startContainer.data.length&&a.startContainer.data.charAt(c)==="​";)c++}else if(a.startContainer&&a.startContainer.nodeType===d.Node.TEXT_NODE)for(;c>0&&a.startContainer.data.charAt(c-1)==="​";)c--;if(c!==a.startOffset){a.setStart(a.startContainer,c);a.setEnd(a.startContainer,c)}}}var xb="http://www.w3.org/1999/xhtml",ua=false,Ia=null,L={},$a,lb,Va,mb,Ja,pb,sb,kb=0,$={ADDRESS:true,ARTICLE:true,ASIDE:true,BLOCKQUOTE:true,
CAPTION:true,CENTER:true,COL:true,COLGROUP:true,DD:true,DETAILS:true,DIR:true,DIV:true,DL:true,DT:true,FIELDSET:true,FIGCAPTION:true,FIGURE:true,FOOTER:true,FORM:true,H1:true,H2:true,H3:true,H4:true,H5:true,H6:true,HEADER:true,HGROUP:true,HR:true,LI:true,LISTING:true,MENU:true,NAV:true,OL:true,P:true,PLAINTEXT:true,PRE:true,SECTION:true,SUMMARY:true,TABLE:true,TBODY:true,TD:true,TFOOT:true,TH:true,THEAD:true,TR:true,UL:true,XMP:true},yb={inline:true,"inline-block":true,"inline-table":true,none:true};
(function(){var b={},c={},e=null;Va=function(f){if(!e||e.startContainer!=f.startContainer||e.endContainer!=f.endContainer||e.startOffset!=f.startOffset||e.endOffset!=f.endOffset){e={startContainer:f.startContainer,endContainer:f.endContainer,startOffset:f.startOffset,endOffset:f.endOffset};if(!a.isEmpty(b)||!a.isEmpty(c)){b={};c={};return true}}return false};$a=function(a,c){Va(c);return b[a]};lb=function(a,c,e){Va(e);b[a]=c};mb=function(a,c){Va(c);delete b[a]};Ja=function(a,b){Va(b);return c[a]};
pb=function(a,b,e){Va(e);c[a]=b;if(a=="backcolor")c.hilitecolor=b;else if(a=="hilitecolor")c.backcolor=b};sb=function(a,b){Va(b);delete c[a];a=="backcolor"?delete c.hilitecolor:a=="hilitecolor"&&delete c.backcolor}})();var Bb={A:true,ABBR:true,B:true,BDI:true,BDO:true,CITE:true,CODE:true,DFN:true,EM:true,H1:true,H2:true,H3:true,H4:true,H5:true,H6:true,I:true,KBD:true,MARK:true,P:true,PRE:true,Q:true,RP:true,RT:true,RUBY:true,S:true,SAMP:true,SMALL:true,SPAN:true,STRONG:true,SUB:true,SUP:true,U:true,
VAR:true,ACRONYM:true,LISTING:true,STRIKE:true,XMP:true,BIG:true,BLINK:true,FONT:true,MARQUEE:true,NOBR:true,TT:true},zb={colgroup:true,table:true,tbody:true,tfoot:true,thead:true,tr:true},Ab={script:true,style:true,plaintext:true,xmp:true},db=b.extend({H1:true,H2:true,H3:true,H4:true,H5:true,H6:true},$),vb={CAPTION:true,COL:true,COLGROUP:true,TBODY:true,TD:true,TFOOT:true,TH:true,THEAD:true,TR:true},wb={DD:true,DT:true},Cb={A:b.extend({A:true},$),DD:wb,DT:wb,LI:{LI:true},NOBR:b.extend({NOBR:true},
$),H1:db,H2:db,H3:db,H4:db,H5:db,H6:db,TD:vb,TH:vb,ABBR:$,B:$,BDI:$,BDO:$,CITE:$,CODE:$,DFN:$,EM:$,I:$,KBD:$,MARK:$,P:$,PRE:$,Q:$,RP:$,RT:$,RUBY:$,S:$,SAMP:$,SMALL:$,SPAN:$,STRONG:$,SUB:$,SUP:$,U:$,VAR:$,ACRONYM:$,LISTING:$,STRIKE:$,XMP:$,BIG:$,BLINK:$,FONT:$,MARQUEE:$,TT:$},rb=["subscript","bold","fontname","fontsize","forecolor","hilitecolor","italic","strikethrough","underline"];L.backcolor={action:function(a,b){/^([0-9a-fA-F]{3}){1,2}$/.test(a)&&(a="#"+a);(/^(rgba?|hsla?)\(.*\)$/.test(a)||R(a)||
a.toLowerCase()=="transparent")&&na("backcolor",a,b)},standardInlineValueCommand:true,relevantCssProperty:"backgroundColor",equivalentValues:function(a,b){return Y(a)===Y(b)}};L.bold={action:function(a,b){X("bold",b)?na("bold","normal",b):na("bold","bold",b)},inlineCommandActivatedValues:["bold","600","700","800","900"],relevantCssProperty:"fontWeight",equivalentValues:function(a,b){return a==b||a=="bold"&&b=="700"||a=="700"&&b=="bold"||a=="normal"&&b=="400"||a=="400"&&b=="normal"}};L.createlink=
{action:function(a,b){if(a!==""){d(qa(K())).forEach(function(b){d(y(b)).forEach(function(b){D(b)&&(o(b,"a")&&f(b,"href"))&&b.setAttribute("href",a)})});na("createlink",a,b)}},standardInlineValueCommand:true};L.fontname={action:function(a,b){na("fontname",a,b)},standardInlineValueCommand:true,relevantCssProperty:"fontFamily"};L.fontsize={action:function(a,c){if(a!==""){a=V(a);(b.inArray(a,["xx-small","x-small","small","medium","large","x-large","xx-large","xxx-large"])!=-1||/^[0-9]+(\.[0-9]+)?(cm|mm|in|pt|pc)$/.test(a))&&
na("fontsize",a,c)}},indeterm:function(){return d(qa(K(),function(a){return D(a)&&a.nodeType==d.Node.TEXT_NODE})).map(function(a){return ba(a,"fontsize")},true).filter(function(a,b,c){return d(c.slice(0,b)).indexOf(a)==-1}).length>=2},value:function(a){var b=qa(a,function(a){return D(a)&&a.nodeType==d.Node.TEXT_NODE})[0];if(b===void 0)b=a.startContainer;a=ba(b,"fontsize");return G(a)},relevantCssProperty:"fontSize"};L.forecolor={action:function(a,b){/^([0-9a-fA-F]{3}){1,2}$/.test(a)&&(a="#"+a);(/^(rgba?|hsla?)\(.*\)$/.test(a)||
R(a)||a.toLowerCase()=="transparent")&&na("forecolor",a,b)},standardInlineValueCommand:true,relevantCssProperty:"color",equivalentValues:function(a,b){return Y(a)===Y(b)}};L.hilitecolor={action:function(a,b){/^([0-9a-fA-F]{3}){1,2}$/.test(a)&&(a="#"+a);(/^(rgba?|hsla?)\(.*\)$/.test(a)||R(a)||a.toLowerCase()=="transparent")&&na("hilitecolor",a,b)},indeterm:function(){return d(qa(K(),function(a){return D(a)&&a.nodeType==d.Node.TEXT_NODE})).map(function(a){return ba(a,"hilitecolor")},true).filter(function(a,
b,c){return d(c.slice(0,b)).indexOf(a)==-1}).length>=2},standardInlineValueCommand:true,relevantCssProperty:"backgroundColor",equivalentValues:function(a,b){return Y(a)===Y(b)}};L.italic={action:function(a,b){X("italic",b)?na("italic","normal",b):na("italic","italic",b)},inlineCommandActivatedValues:["italic","oblique"],relevantCssProperty:"fontStyle"};L.removeformat={action:function(a,b){function e(a){return D(a)&&n(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"])}var f,j;f=qa(K(),e);d(f).forEach(function(a){for(;a.hasChildNodes();)pa(a.firstChild,a.parentNode,c.getIndexInParent(a),K());a.parentNode.removeChild(a)});if(D(K().startContainer)&&K().startContainer.nodeType==d.Node.TEXT_NODE&&K().startOffset!=0&&K().startOffset!=C(K().startContainer))if(K().startContainer==K().endContainer){f=K().endOffset-K().startOffset;j=g(K().startContainer,K().startOffset);
K().setStart(j,0);K().setEnd(j,f)}else K().setStart(g(K().startContainer,K().startOffset),0);if(D(K().endContainer)&&K().endContainer.nodeType==d.Node.TEXT_NODE&&K().endOffset!=0&&K().endOffset!=C(K().endContainer)){j=[K().startContainer,K().startOffset];f=[K().endContainer,K().endOffset];K().setEnd(document.documentElement,0);g(f[0],f[1]);K().setStart(j[0],j[1]);K().setEnd(f[0],f[1])}d(qa(K(),D)).forEach(function(a){for(;e(a.parentNode)&&ea(a.parentNode,a);)ta([a],K())});d(["subscript","bold","fontname",
"fontsize","forecolor","hilitecolor","italic","strikethrough","underline"]).forEach(function(a){na(a,null,b)})}};L.strikethrough={action:function(a,b){X("strikethrough",b)?na("strikethrough",null,b):na("strikethrough","line-through",b)},inlineCommandActivatedValues:["line-through"]};L.subscript={action:function(a,b){var c=X("subscript",b);na("subscript",null,b);c||na("subscript","subscript",b)},indeterm:function(){var a=qa(K(),function(a){return D(a)&&a.nodeType==d.Node.TEXT_NODE});return d(a).some(function(a){return ba(a,
"subscript")=="subscript"})&&d(a).some(function(a){return ba(a,"subscript")!="subscript"})||d(a).some(function(a){return ba(a,"subscript")=="mixed"})},inlineCommandActivatedValues:["subscript"]};L.superscript={action:function(a,b){var c=X("superscript",b);na("superscript",null,b);c||na("superscript","superscript",b)},indeterm:function(){var a=qa(K(),function(a){return D(a)&&a.nodeType==d.Node.TEXT_NODE});return d(a).some(function(a){return ba(a,"superscript")=="superscript"})&&d(a).some(function(a){return ba(a,
"superscript")!="superscript"})||d(a).some(function(a){return ba(a,"superscript")=="mixed"})},inlineCommandActivatedValues:["superscript"]};L.underline={action:function(a,b){X("underline",b)?na("underline",null,b):na("underline","underline",b)},inlineCommandActivatedValues:["underline"]};L.unlink={action:function(){var a=K(),b=[],c;for(c=a.startContainer;c;c=c.parentNode)o(c,"A")&&f(c,"href")&&b.unshift(c);for(c=a.startContainer;c!=q(a.endContainer);c=s(c))o(c,"A")&&(f(c,"href")&&(F(c,a)||v(c,a.endContainer)||
c==a.endContainer))&&b.push(c);for(c=0;c<b.length;c++)ga(b[c],"unlink",a)},standardInlineValueCommand:true};var bb="p";L["delete"]={action:function(a,e){var f;b.browser.msie&&b.browser.version<=7&&ub(e,false);if(e.collapsed){Ua(e.startContainer,e.startOffset);for(var j=e.startContainer,g=e.startOffset,m=f=false;;){if(g>0){f=o(j.childNodes[g-1],"br")||false;m=o(j.childNodes[g-1],"hr")||false}if(g==0&&D(j.previousSibling)&&ka(j.previousSibling))j.parentNode.removeChild(j.previousSibling);else if(0<=
g-1&&g-1<j.childNodes.length&&D(j.childNodes[g-1])&&(ka(j.childNodes[g-1])||f||m)){j.removeChild(j.childNodes[g-1]);g--;if(f||m){e.setStart(j,g);e.setEnd(j,g);return}}else if(g==0&&I(j)||ka(j)){g=c.getIndexInParent(j);j=j.parentNode}else{if(0<=g-1&&g-1<j.childNodes.length&&D(j.childNodes[g-1])&&o(j.childNodes[g-1],"a")){nb(j.childNodes[g-1],e);return}if(0<=g-1&&g-1<j.childNodes.length&&!Q(j.childNodes[g-1])&&!n(j.childNodes[g-1],["br","img"])){j=j.childNodes[g-1];g=C(j)}else break}}if(f=W(j,g))f.parentNode.removeChild(f);
else if(j.nodeType==d.Node.TEXT_NODE&&g!=0){e.setStart(j,g-1);e.setEnd(j,g-1);Ca(j,g-1,j,g)}else if(j.nodeType==d.Node.TEXT_NODE&&g==0&&b.browser.msie){g=1;e.setStart(j,g);e.setEnd(j,g);e.startOffset=0;Ca(e)}else if(!I(j))if(0<=g-1&&g-1<j.childNodes.length&&n(j.childNodes[g-1],["br","hr","img"])){e.setStart(j,g);e.setEnd(j,g);Ca(e)}else if(n(j,["li","dt","dd"])&&j==j.parentNode.firstChild&&g==0){g=[];for(f=j.parentNode;f;f=f.parentNode)o(f,"li")&&g.unshift(f);for(f=0;f<g.length;f++)hb(g[f],e);f=sa([j]);
ta([j],e);Aa(f,e);n(j,["dd","dt"])&&d(y(j)).every(function(a){return!ea(j,a)||!ha(j,a)})&&(j=Fa(j,bb,e));Ka(j,e);for(f=0;f<g.length;f++)Db(g[f].parentNode,e)}else{f=j;for(m=g;;)if(m==0){m=c.getIndexInParent(f);f=f.parentNode}else if(0<=m-1&&m-1<f.childNodes.length&&D(f.childNodes[m-1])&&ka(f.childNodes[m-1])){f.removeChild(f.childNodes[m-1]);m--}else break;if(g==0&&d(y(j).concat(j)).filter(function(a){return D(a)&&ea(a,j)&&false}).length){g=l.createRange();g.setStart(j,0);g.setEnd(j,0);g=ma(g);g=
B(g,function(a){return D(a)&&!Qa(a)});for(f=0;f<g.length;f++)qb(g[f],e)}else if(!o(f.childNodes[m],"table"))if(0<=m-1&&m-1<f.childNodes.length&&o(f.childNodes[m-1],"table")){e.setStart(f,m-1);e.setEnd(f,m)}else if(g==0&&(o(f.childNodes[m-1],"hr")||o(f.childNodes[m-1],"br")&&(o(f.childNodes[m-1].previousSibling,"br")||!I(f.childNodes[m-1].previousSibling)))){e.setStart(j,g);e.setEnd(j,g);Ca(f,m-1,f,m)}else{if(n(f.childNodes[m],["li","dt","dd"])&&I(f.childNodes[m].firstChild)&&m!=0){var k=f.childNodes[m-
1];I(k.lastChild)&&!o(k.lastChild,"br")&&k.appendChild(document.createElement("br"));I(k.lastChild)&&k.appendChild(document.createElement("br"))}if(n(f.childNodes[m],["li","dt","dd"])&&n(f.childNodes[m-1],["li","dt","dd"])){f=f.childNodes[m-1];m=C(f);j=f.nextSibling;g=0}else for(;0<=m-1&&m-1<f.childNodes.length;)if(D(f.childNodes[m-1])&&ka(f.childNodes[m-1])){f.removeChild(f.childNodes[m-1]);m--}else{f=f.childNodes[m-1];m=C(f)}k=l.createRange();k.setStart(f,m);k.setEnd(j,g);Ca(k);if(!document.body&&
!e.startContainer||!(document.body==e.startContainer||v(document.body,e.startContainer)))if(k.startContainer.hasChildNodes()||k.startContainer.nodeType==d.Node.TEXT_NODE||P(k.startContainer)){e.setStart(k.startContainer,k.startOffset);e.setEnd(k.startContainer,k.startOffset)}else{e.setStart(k.startContainer.parentNode,c.getIndexInParent(k.startContainer));e.setEnd(k.startContainer.parentNode,c.getIndexInParent(k.startContainer))}}}}else Ca(e)}};var eb=["address","dd","div","dt","h1","h2","h3","h4",
"h5","h6","p","pre"];L.formatblock={action:function(a){function c(a){return function(b){return D(b)&&ea(b,a)&&m(b,eb)&&!d(z(b)).some(la)}}function e(a){return function(b){return m(b,a)&&!b.attributes.length}}function f(){return false}function j(a){return function(){return document.createElement(a)}}var g;/^<.*>$/.test(a)&&(a=a.slice(1,-1));a=a.toLowerCase();if(d(eb).indexOf(a)!=-1){var k=ma(K()),s=B(k,function(a){return D(a)&&(U(a)||ha(a,"p")||n(a,["dd","dt"]))&&!d(z(a)).some(la)}),q=sa(s);for(g=
0;g<s.length;g++)for(var t=s[g];d(y(t)).some(c(t));)ta([t],k);for(Aa(q,k);s.length;){if(ja(s[0])){g=[].slice.call(p(s[0].childNodes));q=sa(g);nb(s[0],k);Aa(q,k);s.shift()}else{g=[];for(g.push(s.shift());s.length&&s[0]==g[g.length-1].nextSibling&&!ja(s[0])&&!o(g[g.length-1],"BR");)g.push(s.shift())}Ka(Ea(g,b.inArray(a,["div","p"])==-1?e(a):f,j(a),k),k)}}},indeterm:function(){var a=ma(K()),a=O(a,function(a){return ca(a)&&D(a)&&!a.hasChildNodes()});if(!a.length)return false;var b=null,c;for(c=0;c<a.length;c++){for(var e=
a[c];D(e.parentNode)&&ea(e,e.parentNode)&&!m(e,eb);)e=e.parentNode;var f="";if(D(e)&&m(e,eb)&&!d(z(e)).some(la))f=e.tagName;if(b===null)b=f;else if(b!=f)return true}return false},value:function(){var a=ma(K()),a=O(a,function(a){return ca(a)&&D(a)&&!a.hasChildNodes()});if(!a.length)return"";for(a=a[0];D(a.parentNode)&&ea(a,a.parentNode)&&!m(a,eb);)a=a.parentNode;return D(a)&&m(a,eb)&&!d(z(a)).some(la)?a.tagName.toLowerCase():""}};L.forwarddelete={action:function(a,e){b.browser.msie&&b.browser.version<=
7&&ub(e,true);if(e.collapsed){Ua(e.startContainer,e.startOffset);for(var f=e.startContainer,j=e.startOffset;;)if(j==C(f)&&D(f.nextSibling)&&ka(f.nextSibling))f.parentNode.removeChild(f.nextSibling);else if(j<f.childNodes.length&&D(f.childNodes[j])&&ka(f.childNodes[j]))f.removeChild(f.childNodes[j]);else if(j<f.childNodes.length&&za(f.childNodes[j]))j++;else if(j==C(f)&&I(f)||ka(f)){j=1+c.getIndexInParent(f);f=f.parentNode}else if(j<f.childNodes.length&&!Q(f.childNodes[j])&&!n(f.childNodes[j],["br",
"img"])){f=f.childNodes[j];j=0}else break;Ua(e.startContainer,e.startOffset);var g=gb(f,j);if(g)g.parentNode.removeChild(g);else if(f.nodeType==d.Node.TEXT_NODE&&j!=C(f)){e.setStart(f,j);e.setEnd(f,j);for(g=j+1;g!=f.length&&/^[\u0300-\u036f\u0591-\u05bd\u05c1\u05c2]$/.test(f.data[g]);)g++;Ca(f,j,f,g)}else if(!I(f))if(j<f.childNodes.length&&n(f.childNodes[j],["br","hr","img"])){e.setStart(f,j);e.setEnd(f,j);Ca(f,j,f,j+1)}else{for(var m=f,g=j;;)if(g==C(m)){g=1+c.getIndexInParent(m);m=m.parentNode}else if(g<
m.childNodes.length&&D(m.childNodes[g])&&ka(m.childNodes[g]))m.removeChild(m.childNodes[g]);else break;if(!o(m.childNodes[g-1],"table"))if(o(m.childNodes[g],"table")){e.setStart(m,g);e.setEnd(m,g+1)}else if(j==C(f)&&n(m.childNodes[g],["br","hr"])){e.setStart(f,j);e.setEnd(f,j);Ca(m,g,m,g+1)}else{for(;g<m.childNodes.length;)if(D(m.childNodes[g])&&ka(m.childNodes[g]))m.removeChild(m.childNodes[g]);else{m=m.childNodes[g];g=0}f=Ca(f,j,m,g);e.setStart(f.startContainer,f.startOffset);e.setEnd(f.endContainer,
f.endOffset)}}}else Ca(e)}};L.indent={action:function(){var a=[],b;for(b=K().endContainer;b!=K().commonAncestorContainer;b=b.parentNode)o(b,"LI")&&a.unshift(b);for(b=K().startContainer;b!=K().commonAncestorContainer;b=b.parentNode)o(b,"LI")&&a.unshift(b);for(b=K().commonAncestorContainer;b;b=b.parentNode)o(b,"LI")&&a.unshift(b);for(b=0;b<a.length;b++)hb(a[b],K());a=ma(K());b=[];b=B(a,function(a){return D(a)&&(ha(a,"div")||ha(a,"ol"))});for(b.length&&(o(b[0],"LI")&&n(b[0].parentNode,["OL","UL"])&&
o(b[0].previousSibling,"LI"))&&hb(b[0].previousSibling,a);b.length;){var c=[];for(c.push(b.shift());b.length&&b[0]==c[c.length-1].nextSibling;)c.push(b.shift());Ib(c,a)}}};L.inserthorizontalrule={action:function(a,b){for(;b.startOffset==0&&b.startContainer.parentNode;)b.setStart(b.startContainer.parentNode,c.getIndexInParent(b.startContainer));for(;b.endOffset==C(b.endContainer)&&b.endContainer.parentNode;)b.setEnd(b.endContainer.parentNode,1+c.getIndexInParent(b.endContainer));Ca(b,{blockMerging:false});
if(D(K().startContainer)||P(K().startContainer)){if(K().startContainer.nodeType==d.Node.TEXT_NODE&&K().startOffset==0){K().setStart(K().startContainer.parentNode,c.getIndexInParent(K().startContainer));K().collapse(true)}if(K().startContainer.nodeType==d.Node.TEXT_NODE&&K().startOffset==C(K().startContainer)){K().setStart(K().startContainer.parentNode,1+c.getIndexInParent(K().startContainer));K().collapse(true)}var e=document.createElement("hr");b.insertNode(e);Ka(e,b);b.setStart(e.parentNode,1+c.getIndexInParent(e));
b.setEnd(e.parentNode,1+c.getIndexInParent(e));l.getSelection().removeAllRanges();l.getSelection().addRange(b)}}};L.inserthtml={action:function(a,b){Ca(b);if(D(b.startContainer)||P(b.startContainer)){var e=b.createContextualFragment(a),f=e.lastChild;if(f){var j=z(e);Q(b.startContainer)&&d(b.startContainer.childNodes).filter(function(a,b){return D(a)&&za(a)&&c.getIndexInParent(a)>=b.startOffset},true).forEach(function(a){a.parentNode.removeChild(a)});b.insertNode(e);Q(b.startContainer)&&Ma(b.startContainer);
b.setStart(f.parentNode,1+c.getIndexInParent(f));b.setEnd(f.parentNode,1+c.getIndexInParent(f));for(e=0;e<j.length;e++)Ka(j[e],b);T(b)}}}};L.insertimage={action:function(a){if(a!==""){var b=K();Ca(b,{stripWrappers:false});if(D(K().startContainer)||P(K().startContainer)){Q(b.startContainer)&&(b.startContainer.childNodes.length==1&&o(b.startContainer.firstChild,"br")&&b.startOffset==0)&&b.startContainer.removeChild(b.startContainer.firstChild);var e=document.createElement("img");e.setAttribute("src",
a);b.insertNode(e);b.setStart(e.parentNode,1+c.getIndexInParent(e));b.setEnd(e.parentNode,1+c.getIndexInParent(e));l.getSelection().removeAllRanges();l.getSelection().addRange(b);e.removeAttribute("width");e.removeAttribute("height")}}}};L.insertlinebreak={action:function(a,e){Ca(e,{stripWrappers:false});if(D(e.startContainer)||P(e.startContainer))if(e.startContainer.nodeType!=d.Node.ELEMENT_NODE||ha("br",e.startContainer))if(e.startContainer.nodeType==d.Node.ELEMENT_NODE||ha("br",e.startContainer.parentNode)){var f,
j;if(e.startContainer.nodeType==d.Node.TEXT_NODE&&e.startOffset==0){f=e.startContainer.parentNode;j=c.getIndexInParent(e.startContainer);l.getSelection().collapse(f,j);e.setStart(f,j);e.setEnd(f,j)}if(e.startContainer.nodeType==d.Node.TEXT_NODE&&e.startOffset==C(e.startContainer)){f=e.startContainer.parentNode;j=1+c.getIndexInParent(e.startContainer);l.getSelection().collapse(f,j);e.setStart(f,j);e.setEnd(f,j)}f=document.createElement("br");e.insertNode(f);l.getSelection().collapse(f.parentNode,1+
c.getIndexInParent(f));e.setStart(f.parentNode,1+c.getIndexInParent(f));e.setEnd(f.parentNode,1+c.getIndexInParent(f));if(xa(f)){e.insertNode(aa());l.getSelection().collapse(f.parentNode,1+c.getIndexInParent(f));e.setStart(f.parentNode,1+c.getIndexInParent(f));e.setEnd(f.parentNode,1+c.getIndexInParent(f))}b.browser.msie&&b.browser.version<8&&f.parentNode.removeAttribute("style")}}};L.insertorderedlist={action:function(a,b){tb("ol",b)},indeterm:function(){return/^mixed( ol)?$/.test(ib())},state:function(){return ib()==
"ol"}};var Jb={LI:true,DT:true,DD:true};L.insertparagraph={action:function(a,e){var f;Ca(e);Hb(Ha(e.startContainer),e);if(D(e.startContainer)||P(e.startContainer)){var j=e.startContainer,m=e.startOffset;j.nodeType==d.Node.TEXT_NODE&&(m!=0&&m!=C(j))&&g(j,m);if(j.nodeType==d.Node.TEXT_NODE&&m==C(j)){m=1+c.getIndexInParent(j);j=j.parentNode}if(j.nodeType==d.Node.TEXT_NODE||j.nodeType==d.Node.COMMENT_NODE){m=c.getIndexInParent(j);j=j.parentNode}l.getSelection().collapse(j,m);e.setStart(j,m);e.setEnd(j,
m);for(var k=j;!ja(k)&&D(k.parentNode)&&ea(j,k.parentNode);)k=k.parentNode;if(!D(k)||!ea(k,j)||!ja(k)){var q=bb;f=ma(e);f=B(f,function(a){return ha(a,"p")}).slice(0,1);if(!f.length){if(!ha(q,e.startContainer))return;k=document.createElement(q);e.insertNode(k);k.appendChild(aa());l.getSelection().collapse(k,0);e.setStart(k,0);e.setEnd(k,0);return}for(;f[f.length-1].nextSibling&&ha(f[f.length-1].nextSibling,"p");)f.push(f[f.length-1].nextSibling);k=Ea(f,function(){return false},function(){return document.createElement(q)},
e)}if(k){var p;if(k.tagName=="ADDRESS"||k.tagName=="LISTING"||k.tagName=="PRE"){var r=document.createElement("br");f=k.offsetHeight;e.insertNode(r);p=k.offsetHeight;l.getSelection().collapse(j,m+1);e.setStart(j,m+1);e.setEnd(j,m+1);if(f==p&&!t(s(r),k)){e.insertNode(aa());l.getSelection().collapse(j,m+1);e.setEnd(j,m+1)}}else if(Jb[k.tagName]&&(!k.hasChildNodes()||k.childNodes.length==1&&o(k.firstChild,"br"))){ta([k],e);n(k,["dd","dt"])&&d(y(k)).every(function(a){return!ea(k,a)||!ha(k,a)})&&(k=Fa(k,
bb,e));Ka(k,e);if(o(k,"li")&&o(k.nextSibling,"li")&&n(k.nextSibling.firstChild,["ol","ul"])){j=k.nextSibling;m=k.nextSibling.childNodes.length;for(f=0;f<m;f++)k.appendChild(j.childNodes[0]);j.parentNode.removeChild(j)}}else if(o(k,"p")&&o(k.parentNode,"blockquote")&&!k.nextSibling&&(!k.hasChildNodes()||k.childNodes.length===1&&o(k.firstChild,"br")))b(k.parentNode).after(k);else{m=l.createRange();m.setStart(e.startContainer,e.startOffset);for(m.setEnd(k,C(k));m.startOffset==0&&m.startContainer!=k;)m.setStart(m.startContainer.parentNode,
c.getIndexInParent(m.startContainer));for(;m.startOffset==C(m.startContainer)&&m.startContainer!=k;)m.setStart(m.startContainer.parentNode,1+c.getIndexInParent(m.startContainer));j=B(m);j=!j.length||j.length==1&&o(j[0],"br");j=/^H[1-6]$/.test(k.tagName)&&j?bb:k.tagName=="DT"&&j?"dd":k.tagName=="DD"&&j?"dt":k.tagName.toLowerCase();j=document.createElement(j);Wa(k,j);j.removeAttribute("id");k.parentNode.insertBefore(j,k.nextSibling);p=O(m);m=m.extractContents();r=z(m);for(f=0;f<r.length;f++)r[f].nodeType==
d.Node.ELEMENT_NODE&&d(p).indexOf(r[f])==-1&&r[f].removeAttribute("id");f=[];if(p=m.firstChild){do ia(p)||f.push(p);while(null!=(p=p.nextSibling))}if(o(j,"li")&&f.length&&n(f[0],["ul","ol"])){f=j.offsetHeight;r=aa();j.appendChild(r);p=j.offsetHeight;f!==p&&j.removeChild(r)}j.appendChild(m);Ma(k);Ma(j);l.getSelection().collapse(j,0);e.setStart(j,0);e.setEnd(j,0)}}}}};L.inserttext={action:function(a,c){var e;Ca(c,{stripWrappers:false});if(D(c.startContainer)||P(c.startContainer))if(a.length>1)for(e=
0;e<a.length;e++)L.inserttext.action(a[e],c);else if(a!="")if(a=="\n")L.insertparagraph.action("",c);else{e=c.startContainer;var f=c.startOffset;if(0<=f-1&&f-1<e.childNodes.length&&e.childNodes[f-1].nodeType==d.Node.TEXT_NODE){e=e.childNodes[f-1];f=C(e)}if(0<=f&&f<e.childNodes.length&&e.childNodes[f].nodeType==d.Node.TEXT_NODE){e=e.childNodes[f];f=0}var j=e.nodeType==d.Node.ELEMENT_NODE?e:e.parentNode;a==" "&&(j.nodeType==d.Node.ELEMENT_NODE&&b.inArray(d.getComputedStyle(j).whiteSpace,["pre","pre-wrap"])==
-1)&&(a=" ");j=Eb(c);if(e.nodeType==d.Node.TEXT_NODE){e.insertData(f,a);l.getSelection().collapse(e,f);c.setStart(e,f);l.getSelection().extend(e,f+1);c.setEnd(e,f+1)}else{e.childNodes.length==1&&xa(e.firstChild)&&e.removeChild(e.firstChild);e=document.createTextNode(a);c.insertNode(e);l.getSelection().collapse(e,0);c.setStart(e,0);l.getSelection().extend(e,1);c.setEnd(e,1)}cb(j,c);Ua(c.startContainer,c.startOffset);Ua(c.endContainer,c.endOffset);l.getSelection().collapseToEnd();c.collapse(false)}}};
L.insertunorderedlist={action:function(a,b){tb("ul",b)},indeterm:function(){return/^mixed( ul)?$/.test(ib())},state:function(){return ib()=="ul"}};L.justifycenter={action:function(a,b){ob("center",b)},indeterm:function(){var a=O(ma(K()),function(a){return D(a)&&ca(a)&&!a.hasChildNodes()});return d(a).some(function(a){return Ba(a)=="center"})&&d(a).some(function(a){return Ba(a)!="center"})},state:function(){var a=O(ma(K()),function(a){return D(a)&&ca(a)&&!a.hasChildNodes()});return a.length&&d(a).every(function(a){return Ba(a)==
"center"})},value:function(){var a=O(ma(K()),function(a){return D(a)&&ca(a)&&!a.hasChildNodes()});return a.length?Ba(a[0]):"left"}};L.justifyfull={action:function(a,b){ob("justify",b)},indeterm:function(){var a=O(ma(K()),function(a){return D(a)&&ca(a)&&!a.hasChildNodes()});return d(a).some(function(a){return Ba(a)=="justify"})&&d(a).some(function(a){return Ba(a)!="justify"})},state:function(){var a=O(ma(K()),function(a){return D(a)&&ca(a)&&!a.hasChildNodes()});return a.length&&d(a).every(function(a){return Ba(a)==
"justify"})},value:function(){var a=O(ma(K()),function(a){return D(a)&&ca(a)&&!a.hasChildNodes()});return a.length?Ba(a[0]):"left"}};L.justifyleft={action:function(a,b){ob("left",b)},indeterm:function(){var a=O(ma(K()),function(a){return D(a)&&ca(a)&&!a.hasChildNodes()});return d(a).some(function(a){return Ba(a)=="left"})&&d(a).some(function(a){return Ba(a)!="left"})},state:function(){var a=O(ma(K()),function(a){return D(a)&&ca(a)&&!a.hasChildNodes()});return a.length&&d(a).every(function(a){return Ba(a)==
"left"})},value:function(){var a=O(ma(K()),function(a){return D(a)&&ca(a)&&!a.hasChildNodes()});return a.length?Ba(a[0]):"left"}};L.justifyright={action:function(a,b){ob("right",b)},indeterm:function(){var a=O(ma(K()),function(a){return D(a)&&ca(a)&&!a.hasChildNodes()});return d(a).some(function(a){return Ba(a)=="right"})&&d(a).some(function(a){return Ba(a)!="right"})},state:function(){var a=O(ma(K()),function(a){return D(a)&&ca(a)&&!a.hasChildNodes()});return a.length&&d(a).every(function(a){return Ba(a)==
"right"})},value:function(){var a=O(ma(K()),function(a){return D(a)&&ca(a)&&!a.hasChildNodes()});return a.length?Ba(a[0]):"left"}};L.outdent={action:function(){var a=[];(function(){var b;for(b=K().endContainer;b!=K().commonAncestorContainer;b=b.parentNode)o(b,"li")&&a.unshift(b);for(b=K().startContainer;b;b=b.parentNode)o(b,"li")&&a.unshift(b)})();d(a).forEach(function(a){hb(a,K())});for(var b=ma(K()),c=B(b,function(a){return D(a)&&(!d(z(a)).some(D)||n(a,["ol","ul"])||o(a,"li")&&n(a.parentNode,["ol",
"ul"]))});c.length;){for(;c.length&&(n(c[0],["OL","UL"])||!n(c[0].parentNode,["OL","UL"]));)qb(c.shift(),b);if(!c.length)break;var e=[];for(e.push(c.shift());c.length&&c[0]==e[e.length-1].nextSibling&&!n(c[0],["OL","UL"]);)e.push(c.shift());var f=sa(e);ta(e,b);d(e).forEach(Ka);Aa(f,b)}}};L.selectall={action:function(){var a=document.body;if(!a)a=document.documentElement;a?l.getSelection().selectAllChildren(a):l.getSelection().removeAllRanges()}};L.stylewithcss={action:function(a){ua=(""+a).toLowerCase()!=
"false"},state:function(){return ua}};L.usecss={action:function(a){ua=(""+a).toLowerCase()=="false"}};(function(){var a=[],b;for(b in L)L.hasOwnProperty(b)&&a.push(b);d(a).forEach(function(a){if(null==L[a].relevantCssProperty)L[a].relevantCssProperty=null;if(null!=L[a].inlineCommandActivatedValues&&null==L[a].indeterm)L[a].indeterm=function(b){var b=d(qa(b,function(a){return D(a)&&a.nodeType==d.Node.TEXT_NODE})).map(function(b){return ba(b,a)}),c=d(b).filter(function(b){return d(L[a].inlineCommandActivatedValues).indexOf(b)!=
-1});return c.length>=1&&b.length-c.length>=1};if(null!=L[a].inlineCommandActivatedValues)L[a].state=function(b){var c=qa(b,function(a){return D(a)&&a.nodeType==d.Node.TEXT_NODE});return c.length==0?d(L[a].inlineCommandActivatedValues).indexOf(ba(b.startContainer,a))!=-1:d(c).every(function(b){return d(L[a].inlineCommandActivatedValues).indexOf(ba(b,a))!=-1})};if(null!=L[a].standardInlineValueCommand){L[a].indeterm=function(){var b=d(qa(K())).filter(function(a){return D(a)&&a.nodeType==d.Node.TEXT_NODE},
true).map(function(b){return ba(b,a)}),c;for(c=1;c<b.length;c++)if(b[c]!=b[c-1])return true;return false};L[a].value=function(b){var c=qa(b,function(a){return D(a)&&a.nodeType==d.Node.TEXT_NODE})[0];if(typeof c=="undefined")c=b.startContainer;return ba(c,a)}}})})();return{commands:L,execCommand:Z,queryCommandIndeterm:function(a,b){a=a.toLowerCase();return N(a,"indeterm",b,function(a){return function(){return!H(a,b)?false:L[a].indeterm(b)}}(a))},queryCommandState:X,queryCommandValue:da,queryCommandEnabled:H,
queryCommandSupported:function(a){a=a.toLowerCase();return L.hasOwnProperty(a)},copyAttributes:Wa,createEndBreak:aa,isEndBreak:function(a){return o(a,"br")&&a.parentNode.lastChild===a},ensureContainerEditable:Ma,isEditingHost:P,isEditable:D,getStateOverride:$a,setStateOverride:lb,resetOverrides:Va,unsetStateOverride:mb}});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(l,
d,a,k,c,b,f,g,j,m){function e(a,b){var e=l.activeEditable?l.activeEditable.obj.parent()[0]:null,e=d(a).parentsUntil(e).get(),f;f=[];var j,g,m;1===a.nodeType&&a.nodeName!=="BODY"&&a.nodeName!=="HTML"?f.push(a.cloneNode(false).outerHTML):f.push("#"+a.nodeType);m=0;for(g=e.length;m<g;m++){j=e[m];if(j.nodeName==="BODY"||j.nodeName==="HTML")break;f.push(j.cloneNode(false).outerHTML)}f=f.join("");return b&&a===b.node&&c.equal(b.parents,e)&&f===b.html?null:{node:a,parents:e,html:f}}function o(a){var b;if(d.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 n=window.GENTICS,r=null,p=null,k=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,c){this.updateSelectionTimeout&&
window.clearTimeout(this.updateSelectionTimeout);var e=this;this.updateSelectionTimeout=window.setTimeout(function(){var f=new l.Selection.SelectionRange(true);if(!f.startContainer||"HTML"===f.startContainer.nodeName||"BODY"===f.startContainer.nodeName){if(!this.updateSelectionTimeout)e.onChange(a,b,10+(c||5)*2)}else l.Selection._updateSelection(b,f)},c||5)},preventSelectionChanged:function(){this.preventSelectionChangedFlag=true},isSelectionChangedPrevented:function(){var a=this.preventSelectionChangedFlag;
this.preventSelectionChangedFlag=false;return a},isSelectionEditable:function(){return this.rangeObject.commonAncestorContainer&&d(this.rangeObject.commonAncestorContainer).contentEditable()},isFloatingMenuVisible:function(){var a=d(l.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;if((this.rangeObject=b=b||new l.Selection.SelectionRange(true))&&b.startContainer&&"HR"===b.startContainer.nodeName&&b.endContainer&&"HR"===b.endContainer.nodeName){l.getSelection().removeAllRanges();return true}b.update();if(b&&(b.startContainer&&b.endContainer)&&d(b.commonAncestorContainer).closest(".aloha-editable").length>0){var c=!(3===b.startContainer.nodeType&&!d(b.startContainer.parentNode).contentEditable()),j=!(3===b.endContainer.nodeType&&!d(b.endContainer.parentNode).contentEditable());
if(!c||!j){l.getSelection().removeAllRanges();return true}}if(this.isSelectionChangedPrevented())return true;l.trigger("aloha-selection-changed-before",[this.rangeObject,a]);l.trigger("aloha-selection-changed",[this.rangeObject,a]);var c=this.rangeObject,m=c.startContainer,j=c.endContainer;if(!m||!j)f.warn("aloha/selection","encountered range object without start or end container");else{m=e(m,r);j=e(j,p);if(m||j){r=m;p=j;g.pub("aloha.selection.context-change",{range:c,event:a})}}l.trigger("aloha-selection-changed-after",
[this.rangeObject,a]);return true},getSelectionTree:function(a){if(!a)return this.rangeObject.getSelectionTree();if(!a.commonAncestorContainer){l.Log.error(this,"the rangeObject is missing the commonAncestorContainer");return false}this.inselection=false;if(n.Utils.Dom.doCleanup({merge:true},a)){a.update();a.select()}return this.recursiveGetSelectionTree(a,a.commonAncestorContainer)},recursiveGetSelectionTree:function(a,b){var c=0,e=this,f=[];d(b).contents().each(function(j){var g="none",m=false,
d=false,k=false,o=false,n=false,q=false;if(a.isCollapsed()&&b===a.startContainer&&a.startOffset==j){f[c]=new l.Selection.SelectionTree;f[c].selection="collapsed";f[c].domobj=void 0;e.inselection=false;k=true;c++}if(!e.inselection&&!k){var p;try{p=this.nodeType}catch(r){return}switch(p){case 3:if(this===a.startContainer){e.inselection=true;g=a.startOffset>0?"partial":"full";m=a.startOffset;d=this.length}break;case 1:if(this===a.startContainer&&a.startOffset===0){e.inselection=true;g="full"}if(b===
a.startContainer&&a.startOffset===j){e.inselection=true;g="full"}}}if(e.inselection&&!k){g=="none"&&(g="full");switch(this.nodeType){case 3:if(this===a.endContainer){e.inselection=false;a.endOffset<this.length&&(g="partial");m===false&&(m=0);d=a.endOffset}break;case 1:if(this===a.endContainer&&a.endOffset===0)e.inselection=false}if(b===a.endContainer&&a.endOffset<=j){e.inselection=false;g="none"}}f[c]=new l.Selection.SelectionTree;f[c].domobj=this;f[c].selection=g;if(g=="partial"){f[c].startOffset=
m;f[c].endOffset=d}f[c].children=e.recursiveGetSelectionTree(a,this);g=f[c].children.length;if(g>0){for(j=0;j<g;++j)switch(f[c].children[j].selection){case "none":o=true;break;case "full":q=true;break;case "partial":n=true}if(n||q&&o)f[c].selection="partial";else if(q&&!n&&!o)f[c].selection="full"}c++});if(a.isCollapsed()&&b===a.startContainer&&a.startOffset==b.childNodes.length){f[c]=new l.Selection.SelectionTree;f[c].selection="collapsed";f[c].domobj=void 0}return f},getRangeObject:function(){return this.rangeObject},
isRangeObjectWithinMarkup:function(a,b,c,e,f){var j=this,a=d(!b?a.startContainer:a.endContainer).parents(),g=false,m=-1;typeof e!=="undefined"&&typeof e!=="function"&&l.Log.error(this,"parameter tagComparator is not a function");typeof e==="undefined"&&(e=function(a,b){return j.standardTextLevelSemanticsComparator(a,b)});a.length>0&&a.each(function(){if(this===f){l.Log.debug(j,"reached limit dom obj");return false}if(e(this,c)){g===false&&(g=[]);l.Log.debug(j,"reached object equal to markup");m++;
g[m]=this;return true}});return g},standardSectionsAndGroupingContentComparator:function(a,b){if(a.nodeType!==1){l.Log.debug(this,"only element nodes (nodeType == 1) can be compared");return false}if(!b[0].nodeName)return false;var c=l.Selection.replacingElements[a.nodeName.toLowerCase()];return c&&c[b[0].nodeName.toLowerCase()]},standardTagNameComparator:function(a,b){if(a.nodeType===1)return a.nodeName!=b[0].nodeName?false:true;l.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;l.Log.debug(this,"only element nodes (nodeType == 1) can be compared");return false},standardAttributesComparator:function(a,e){var f=b.words(a&&a.className||""),j=b.words(e.length&&e[0].className||"");c.sortUnique(f);c.sortUnique(j);return c.equal(f,j)},changeMarkup:function(a,b,c){var e=b[0].tagName.toLowerCase(),f,g,k=this.isRangeObjectWithinMarkup(a,
false,b,c,f),o=this.isRangeObjectWithinMarkup(a,true,b,c,f),n,q,p,r;if(this.replacingElements[e]){g=a;a=new this.SelectionRange(a);e=l.activeEditable?l.activeEditable.obj.get(0):d("body");a.update(e);b.isReplacingElement=true}else if(a.isCollapsed()){l.Log.debug(this,"early returning from applying markup because nothing is currently selected");return false}f=l.activeEditable?l.activeEditable.obj[0]:d("body");if(!b.isReplacingElement&&a.startOffset===0&&null!=(p=this.getTextNodeSibling(false,a.commonAncestorContainer.parentNode,
a.startContainer)))r=this.isRangeObjectWithinMarkup({startContainer:p,startOffset:0},false,b,c,f);if(!b.isReplacingElement&&a.endOffset===a.endContainer.length&&null!=(n=this.getTextNodeSibling(true,a.commonAncestorContainer.parentNode,a.endContainer)))q=this.isRangeObjectWithinMarkup({startContainer:n,startOffset:0},false,b,c,f);if(!b.isReplacingElement&&k&&!o){l.Log.info(this,"markup 2 non-markup");this.prepareForRemoval(a.getSelectionTree(),b,c);d(k).addClass("preparedForRemoval");this.insertCroppedMarkups(k,
a,false,c)}else if(!b.isReplacingElement&&k&&o){l.Log.info(this,"markup 2 markup");this.prepareForRemoval(a.getSelectionTree(),b,c);this.splitRelevantMarkupObject(k,o,a,c)}else if(!b.isReplacingElement&&(!k&&o||q||r)){l.Log.info(this,"non-markup 2 markup OR with next2markup");if(r&&q){k=new l.Selection.SelectionRange(a);k.startContainer=d(r[r.length-1]).textNodes()[0];k.startOffset=0;k.endContainer=d(q[q.length-1]).textNodes().last()[0];k.endOffset=k.endContainer.length;k.update();this.applyMarkup(k.getSelectionTree(),
a,b,c);l.Log.info(this,"double extending previous markup(previous and after selection), actually wrapping it ...")}else if(r&&!q&&!o){this.extendExistingMarkupWithSelection(r,a,false,c);l.Log.info(this,"extending previous markup")}else if(r&&!q&&o){k=new l.Selection.SelectionRange(a);k.startContainer=d(r[r.length-1]).textNodes()[0];k.startOffset=0;k.endContainer=d(o[o.length-1]).textNodes().last()[0];k.endOffset=k.endContainer.length;k.update();this.applyMarkup(k.getSelectionTree(),a,b,c);l.Log.info(this,
"double extending previous markup(previous and relevant at the end), actually wrapping it ...")}else if(!r&&q){this.extendExistingMarkupWithSelection(q,a,true,c);l.Log.info(this,"extending following markup backwards")}else this.extendExistingMarkupWithSelection(o,a,true,c)}else if(b.isReplacingElement||!k&&!o&&!r&&!q){l.Log.info(this,"non-markup 2 non-markup");if(a.startContainer!==a.endContainer)o=false;else if(a.startContainer.nodeType!=1)o=false;else{o=a.startContainer.firstChild;o=!o||!o.nextSibling&&
o.nodeName=="BR"}if(o){b=b.clone();c=a.startContainer!==a.endContainer?false:a.startContainer.nodeType!=1?false:j.isEndBreak(a.startContainer);c&&b[0].appendChild(j.createEndBreak());l.activeEditable&&d.browser.mozilla&&l.activeEditable.obj.focus();if(j.isEditable(a.startContainer)){j.copyAttributes(a.startContainer,b[0]);d(a.startContainer).after(b[0]).remove()}else if(j.isEditingHost(a.startContainer)){d(a.startContainer).append(b[0]);j.ensureContainerEditable(b[0])}g.startContainer=b[0];g.endContainer=
b[0];g.startOffset=0;g.endOffset=0;return}this.applyMarkup(a.getSelectionTree(),a,b,c,{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){c=d(g.startContainer).parents(b[0].tagName).get(0);g.startContainer=c;a.startContainer=c}if(g&&g.endContainer.className&&g.endContainer.className.indexOf("preparedForRemoval")>
-1){c=d(g.endContainer).parents(b[0].tagName).get(0);g.endContainer=c;a.endContainer=c}}d(".preparedForRemoval").zap();if(b.isReplacingElement){if(m.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(m.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,c){var e,f,j;if(c.startOffset!==0)return false;e=0;for(j=a.length;e<j;e++){f=d(a[e]);if(f.textNodes().first()[0]!==c.startContainer)return false}e=0;for(a=b.length;e<a;e++){f=d(b[e]);f=f.textNodes().last()[0];
if(f!==c.endContainer||f.length!=c.endOffset)return false}return true},splitRelevantMarkupObject:function(a,b,c,e){d(a).addClass("preparedForRemoval");d(b).addClass("preparedForRemoval");if(this.areMarkupObjectsAsLongAsRangeObject(a,b,c))return true;var f=this.intersectRelevantMarkupObjects(a,b);if(f){this.insertCroppedMarkups([f],c,false,e);this.insertCroppedMarkups([f],c,true,e)}else{this.insertCroppedMarkups(a,c,false,e);this.insertCroppedMarkups(b,c,true,e)}return true},intersectRelevantMarkupObjects:function(a,
b){var c=false,e,f,j,g,m,k;if(!a||!b)return c;m=a.length;k=b.length;for(e=0;e<m;e++){f=a[e];for(j=0;j<k;j++){g=b[j];f===g&&(c=f)}}return c},extendExistingMarkupWithSelection:function(a,b,c,e){var f,j,g,m,k,o,n;c||(f=true);c&&(j=true);c=[];g=0;for(m=a.length;g<m;g++){c[g]=new this.SelectionRange;k=a[g];if(j&&!f){c[g].startContainer=b.startContainer;c[g].startOffset=b.startOffset;o=d(k).textNodes(true);n=o.length-1;c[g].endContainer=o[n];c[g].endOffset=o[n].length;c[g].update();this.applyMarkup(c[g].getSelectionTree(),
b,this.getClonedMarkup4Wrapping(k),e,{setRangeObject2NewMarkup:true})}if(!j&&f){o=d(k).textNodes(true);c[g].startContainer=o[0];c[g].startOffset=0;c[g].endContainer=b.endContainer;c[g].endOffset=b.endOffset;c[g].update();this.applyMarkup(c[g].getSelectionTree(),b,this.getClonedMarkup4Wrapping(k),e,{setRangeObject2NewMarkup:true})}}return true},getClonedMarkup4Wrapping:function(a){a=d(a.outerHTML).removeClass("preparedForRemoval").empty();a.attr("class").length===0&&a.removeAttr("class");return a},
insertCroppedMarkups:function(a,b,c,e){var f,j,g,m,k;c?j=true:f=true;c=[];for(m=0;m<a.length;m++){c[m]=new this.SelectionRange;k=a[m];if(f&&!j){g=d(k).textNodes(true);c[m].startContainer=g[0];c[m].startOffset=0;if(c[m].startContainer===b.startContainer&&c[m].startOffset===b.startOffset)continue;if(b.startOffset===0){c[m].endContainer=this.getTextNodeSibling(false,k,b.startContainer);c[m].endOffset=c[m].endContainer.length}else{c[m].endContainer=b.startContainer;c[m].endOffset=b.startOffset}c[m].update();
this.applyMarkup(c[m].getSelectionTree(),b,this.getClonedMarkup4Wrapping(k),e,{setRangeObject2NextSibling:true})}if(!f&&j){c[m].startContainer=b.endContainer;c[m].startOffset=b.endOffset;g=d(k).textNodes(true);c[m].endContainer=g[g.length-1];c[m].endOffset=g[g.length-1].length;c[m].update();this.applyMarkup(c[m].getSelectionTree(),b,this.getClonedMarkup4Wrapping(k),e,{setRangeObject2PreviousSibling:true})}}return true},changeMarkupOnSelection:function(a){var b=this.getRangeObject();this.changeMarkup(b,
a,this.getStandardTagComparator(a));n.Utils.Dom.doCleanup({merge:true},b);b.update();b.select();this.rangeObject=b},applyMarkup:function(a,b,c,e,f){var j,g,f=f||{};this.prepareForRemoval(a,c,e);a=this.optimizeSelectionTree4Markup(a,c,e);for(j=0;j<a.length;j++){g=a[j];if(g.wrappable)this.wrapMarkupAroundSelectionTree(g.elements,b,c,e,f);else{l.Log.debug(this,"dive further into non-wrappable object");this.applyMarkup(g.element.children,b,c,e,f)}}},getMarkupType:function(a){var b=d(a)[0].nodeName.toLowerCase();
a.outerHtml&&l.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";l.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,c){return b.standardSectionsAndGroupingContentComparator(a,
c)};break;default:a=function(a,c){return b.standardTextLevelSemanticsComparator(a,c)}}return a},prepareForRemoval:function(a,b,c){var e,f;typeof c!=="undefined"&&typeof c!=="function"&&l.Log.error(this,"parameter tagComparator is not a function");typeof c==="undefined"&&(c=this.getStandardTagComparator(b));for(e=0;e<a.length;e++){f=a[e];if(f.domobj&&(f.selection=="full"||f.selection=="partial"&&b.isReplacingElement)&&f.domobj.nodeType===1&&c(f.domobj,b)){l.Log.debug(this,"Marking for removal: "+f.domobj.nodeName);
d(f.domobj).addClass("preparedForRemoval")}f.selection!="none"&&f.children.length>0&&this.prepareForRemoval(f.children,b,c)}},wrapMarkupAroundSelectionTree:function(a,b,c,e,f){var j=[],g=-1,m="",k="",o,n,q;l.Log.debug(this,"The formatting <"+c[0].tagName+"> will be wrapped around the selection");for(o=0;o<a.length;o++){n=a[o];if(n.domobj&&!this.canTag1WrapTag2(n.domobj.parentNode.tagName.toLowerCase(),c[0].tagName.toLowerCase()))l.Log.info(this,"Skipping the wrapping of <"+c[0].tagName.toLowerCase()+
"> because this tag is not allowed inside <"+n.domobj.parentNode.tagName.toLowerCase()+">");else if(!n.domobj||!(n.domobj.nodeType===3&&d.trim(n.domobj.nodeValue).length===0)){if(n.domobj&&n.selection=="partial"&&!c.isReplacingElement)if(n.startOffset!==void 0&&n.endOffset===void 0){g++;m=m+n.domobj.data.substr(0,n.startOffset);n.domobj.data=n.domobj.data.substr(n.startOffset,n.domobj.data.length-n.startOffset);j[g]=n.domobj}else if(n.endOffset!==void 0&&n.startOffset===void 0){g++;k=k+n.domobj.data.substr(n.endOffset,
n.domobj.data.length-n.endOffset);n.domobj.data=n.domobj.data.substr(0,n.endOffset);j[g]=n.domobj}else if(n.endOffset!==void 0&&n.startOffset!==void 0){if(n.startOffset==n.endOffset){l.Log.debug(this,"skipping empty selection");continue}g++;m=m+n.domobj.data.substr(0,n.startOffset);q=n.domobj.data.substr(n.startOffset,n.endOffset-n.startOffset);k=k+n.domobj.data.substr(n.endOffset,n.domobj.data.length-n.endOffset);n.domobj.data=q;j[g]=n.domobj}else{l.Log.debug(this,"diving into object");this.applyMarkup(n.children,
b,c,e,f)}if(n.domobj&&(n.selection=="full"||n.selection=="partial"&&c.isReplacingElement)){g++;j[g]=n.domobj}}}if(j.length>0){j=d(j);d.each(j,function(a,b){if(d.browser.msie&&b.nodeType==3&&!b.nextSibling&&!b.previousSibling&&b.parentNode&&b.parentNode.nodeName.toLowerCase()=="li")b.data=d.trim(b.data)});a=j.wrapAll(c).parent();a.before(m).after(k);if(f.setRangeObject2NewMarkup){m=j.textNodes();if(m.index(b.startContainer)!=-1)b.startOffset=0;if(m.index(b.endContainer)!=-1)b.endOffset=b.endContainer.length}if(f.setRangeObject2NextSibling){m=
true;k=a.textNodes(true).last()[0];if(j.index(b.startContainer)!=-1){b.startContainer=this.getTextNodeSibling(m,a.parent(),k);b.startOffset=0}if(j.index(b.endContainer)!=-1){b.endContainer=this.getTextNodeSibling(m,a.parent(),k);b.endOffset=b.endOffset-k.length}}if(f.setRangeObject2PreviousSibling){m=false;k=a.textNodes(true).first()[0];if(j.index(b.startContainer)!=-1){b.startContainer=this.getTextNodeSibling(m,a.parent(),k);b.startOffset=0}if(j.index(b.endContainer)!=-1){b.endContainer=this.getTextNodeSibling(m,
a.parent(),k);b.endOffset=b.endContainer.length}}}},getTextNodeSibling:function(a,b,c){b=d(b).textNodes(true);c=b.index(c);return c==-1?false:b[c+(!a?-1:1)]||false},optimizeSelectionTree4Markup:function(a,b,c){var e=[],f=0,j=0,g=this,m,k,o,n;typeof c==="undefined"&&(c=function(a,b){return g.standardTextLevelSemanticsComparator(b)});for(m=0;m<a.length;m++)if(a[m].domobj&&a[m].selection!="none")if(b.isReplacingElement&&c(b[0],d(a[m].domobj))){e[f]!==void 0&&f++;e[f]={};e[f].wrappable=true;e[f].elements=
[];e[f].elements[j]=a[m];f++}else if(this.canMarkupBeApplied2ElementAsWhole([a[m]],b)){if(e[f]===void 0){e[f]={};e[f].wrappable=true;e[f].elements=[]}if(b.isReplacingElement){n=m;for(k=m-1;k>=0;k--)if(this.canMarkupBeApplied2ElementAsWhole([a[k]],b)&&this.isMarkupAllowedToStealSelectionTreeElement(a[k],b))n=k;else break;o=m;for(k=m+1;k<a.length;k++)if(this.canMarkupBeApplied2ElementAsWhole([a[k]],b)&&this.isMarkupAllowedToStealSelectionTreeElement(a[k],b))o=k;else break;j=0;for(k=n;k<=o;k++){e[f].elements[j]=
a[k];e[f].elements[j].selection="full";j++}j=0}else{e[f].elements[j]=a[m];j++}}else{e[f]!==void 0&&f++;e[f]={};e[f].wrappable=false;e[f].element=a[m];j=0;f++}return e},isMarkupAllowedToStealSelectionTreeElement:function(a,b){if(!a.domobj)return false;var c=a.domobj.nodeName.toLowerCase(),c=c=="#text"?"textNode":c,e=this.allowedToStealElements[b[0].nodeName.toLowerCase()];return e&&e[c]},canMarkupBeApplied2ElementAsWhole:function(a,b){var c,e,f;if(b.jquery)c=b[0].tagName;if(b.tagName)c=b.tagName;for(e=
0;e<a.length;e++){f=a[e];if(f.domobj&&(f.selection!="none"||b.isReplacingElement))if(!this.canTag1WrapTag2(c,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(),c=this.tagHierarchy[a];return!c||!this.tagHierarchy[b]?true:c[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}l.Log.warn(this,"Unable to determine whether tag "+a+" may be inserted");return true},toString:function(){return"Aloha.Selection"},SelectionRange:n.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();l.Selection.updateSelection()},update:function(a){this.updatelimitObject();
this.updateMarkupEffectiveAtStart();this.updateCommonAncestorContainer(a);this.selectionTree=void 0},getSelectionTree:function(){if(!this.selectionTree)this.selectionTree=l.Selection.getSelectionTree(this);return this.selectionTree},getSelectedSiblings:function(a){var b=this.getSelectionTree();return this.recursionGetSelectedSiblings(a,b)},recursionGetSelectedSiblings:function(a,b){var c=false,e=false,f;for(f=0;f<b.length;++f)if(b[f].domobj===a){e=true;c=[]}else if(!e&&b[f].children){c=this.recursionGetSelectedSiblings(a,
b[f].children);if(c!==false)break}else if(e&&b[f].domobj&&b[f].selection!="collapsed"&&b[f].selection!="none")c.push(b[f].domobj);else if(e&&b[f].selection=="none")break;return c},updateMarkupEffectiveAtStart:function(){this.markupEffectiveAtStart=[];this.unmodifiableMarkupAtStart=[];var a=this.getStartContainerParents(),b=false,c,e,f;for(e=0;e<a.length;e++){f=a[e];if(!b&&f!==this.limitObject){this.markupEffectiveAtStart[e]=f;if(!c&&n.Utils.Dom.isSplitObject(f)){c=true;this.splitObject=f}}else{b=
true;this.unmodifiableMarkupAtStart.push(f)}}if(!c)this.splitObject=false},updatelimitObject:function(){if(l.editables&&l.editables.length>0){var a=this.getStartContainerParents(),b=l.editables,c,e,f,j;for(c=0;c<a.length;c++){e=a[c];for(f=0;f<b.length;f++){j=b[f].obj[0];if(e===j){this.limitObject=e;return true}}}}this.limitObject=d("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+"}"}})}),q=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(){this._nativeSelection.collapseToEnd()},selectAllChildren:function(){throw"NOT_IMPLEMENTED";
},deleteFromDocument:function(){throw"NOT_IMPLEMENTED";},getRangeAt:function(a){a=this._nativeSelection.getRangeAt(a);o(a);return a},addRange:function(a){this._nativeSelection.addRange(a);var b=this._nativeSelection._ranges;o(a);b[0]=a;l.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}});
l.getSelection=function(a){a=a!==document||a!==window?window:a;return new q(window.rangy.getSelection(a))};l.createRange=function(a){return window.rangy.createRange(a)};a=new k;return l.Selection=a});define("aloha/block-jump",["aloha/core","jquery","aloha/console"],function(l,d,a){function k(a,b){a.deleteData(0,a.length);""!==b&&(a.nextSibling&&3===a.nextSibling.nodeType?a.nextSibling.insertData(0,b):a.previousSibling&&3===a.previousSibling.nodeType?a.previousSibling.insertData(a.previousSibling.length,
b):a.insertData(0,b));setTimeout(function(){0===a.length&&d(a).remove()},0)}function c(){if(b){var c=b.nodeValue.replace(/\u200b/,"");c===b.nodeValue&&a.warn("Expected to remove the zero width text node fix, but couldn't find it");k(b,c);b=null}}var b=null;return{removeZeroWidthTextNodeFix:c,insertZeroWidthTextNodeFix:function(a,g){c();b=document.createTextNode("​");g?d(a).after(b):d(a).before(b);l.bind("aloha-selection-changed",function(a){c();l.unbind(a)});return b}}});define("aloha/markup","aloha/core util/class util/html jquery aloha/ecma5shims aloha/console aloha/block-jump".split(" "),
function(l,d,a,k,c,b,f){function g(a){return"false"===k(a).attr("contenteditable")}function j(a){return a&&3===a.nodeType}function m(a){return!a?0:j(a)?a.length:a.childNodes.length}function e(a){return!a?null:a.nextSibling?j(a.nextSibling)&&!(0<a.nextSibling.data.replace(/\s+/g,"").length)||"BR"===a.nextSibling.nodeName&&a.nextSibling===a.parentNode.lastChild||""===a.nextSibling.innerHTML&&!g(a.nextSibling)?e(a.nextSibling):a.nextSibling:a.parentNode?e(a.parentNode):null}function o(a){return!a?null:
a.previousSibling?j(a.previousSibling)&&!(0<a.previousSibling.data.replace(/\s+/g,"").length)?o(a.previousSibling):""===a.previousSibling.innerHTML&&!g(a.previousSibling)?o(a.previouSibling):a.previousSibling:a.parentNode?o(a.parentNode):null}function n(a,b){var c=m(a);if(c===b)return true;var e=j(a);return e&&a.data.replace(/\s+$/,"").length===b?true:1===c&&!e?"BR"===a.childNodes[0].nodeName:false}function r(a){var b;if(b=window.$_alohaPlaceholder){b=a.startContainer;var a=a.endContainer,e=window.$_alohaPlaceholder;
b=!(e.is(b)||e.is(a)||(u?c.compareDocumentPosition(e[0],b)&16:0<k(e[0]).find(b).length)||(u?c.compareDocumentPosition(e[0],a)&16:0<k(e[0]).find(a).length))}if(b){0===window.$_alohaPlaceholder.html().replace(/^(&nbsp;)*$/,"").length&&window.$_alohaPlaceholder.remove();window.$_alohaPlaceholder=null}}function p(a,b){var c;if(a.parentNode){for(c=0;c<b.length;c++)if(b[c]===a.parentNode.nodeName)return true;return p(a.parentNode,b)}return false}function q(a,b){if(!a.parentNode)return true;var c=a.nodeType===
3&&a.parentNode.firstChild===a||a.parentNode.children[0]===a,e=a.nodeName==="TR"&&a.parentNode.children[0].className.indexOf("aloha-table-selectcolumn")!==-1,e=(a.nodeName==="TD"&&a.parentNode.children[0].className.indexOf("aloha-table-selectrow")!==-1||e)&&a.parentNode.children[1]===a;return c||e?a.parentNode.nodeName===b?true:q(a.parentNode,b):false}var s=window.GENTICS,u=!!(k.browser.msie&&9>parseInt(k.browser.version,10)),v=function(){return function(a,b){if(!a.parentNode)return true;var c;a:{c=
a.parentNode;var e,f;for(f=c.childNodes.length-1;f>-1;f--){e=c.childNodes[f];if(e.nodeName!=="CAPTION"&&!(e.nodeType===3&&/^[\t\n\r ]+$/.test(e.data))){c=e;break a}}c=c.lastChild}return c===a?a.parentNode.nodeName===b?true:v(a.parentNode,b):false}}();l.Markup=d.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 a=l.Selection.rangeObject,
b,c,e;a.isCollapsed()||this.removeSelectedMarkup();e=k("<br/>");s.Utils.Dom.insertIntoDOM(e,a,l.activeEditable.obj);if(c=s.Utils.Dom.searchAdjacentTextNode(e.parent().get(0),s.Utils.Dom.getIndexInParent(e.get(0))+1,false)){b=c.data.search(/\S/);if(b>0)c.data=c.data.substring(b)}a.startContainer=a.endContainer=e.get(0).parentNode;a.startOffset=a.endOffset=s.Utils.Dom.getIndexInParent(e.get(0))+1;a.correctRange();a.clearCaches();a.select()},preProcessKeyStrokes:function(b){if(b.type!=="keydown")return false;
var c,e;if(this.keyHandlers[b.keyCode]){c=this.keyHandlers[b.keyCode];for(e=0;e<c.length;++e)if(!c[e](b))return false}if(b.keyCode===37||b.keyCode===39){if(l.getSelection().getRangeCount()){c=l.getSelection().getRangeAt(0);if(this.processCursor(c,b.keyCode)){r(l.Selection.rangeObject);return true}}return false}if(b.keyCode===38||b.keyCode===40){if(l.getSelection().getRangeCount()){c=l.getSelection().getRangeAt(0);if(this.processCursorUpDown(c,b.keyCode))return false}return true}if(b.keyCode===8){b.preventDefault();
l.execCommand("delete",false);return false}if(b.keyCode===46){l.execCommand("forwarddelete",false);return false}if(b.keyCode===13){!b.shiftKey&&a.allowNestedParagraph(l.activeEditable)?l.execCommand("insertparagraph",false):l.execCommand("insertlinebreak",false);return false}return true},processCursorUpDown:function(a,b){if(!a.collapsed)return false;var c=a.startContainer;if(b===38&&(0===a.startOffset||a.startOffset<=c.data.length-c.data.replace(/^\s+/,"").length)&&p(c,["TD","TH"])&&q(c,"TABLE")){c=
k(c).parents("div.aloha-table-wrapper").get(0);if(!c)return false;for(c=c.previousElementSibling?c.previousElementSibling:c.previousSibling;c.nodeType!==3;){c=c.lastChild;if(c===null)return false}l.Selection.rangeObject.startContainer=c;l.Selection.rangeObject.endContainer=c;l.Selection.rangeObject.startOffset=c.length;l.Selection.rangeObject.endOffset=c.length;l.Selection.rangeObject.select();l.activeEditable&&k.browser.mozilla&&l.activeEditable.obj.focus();return true}if(b===40&&n(c,a.startOffset)&&
p(c,["TD","TH"])&&v(c,"TABLE")){c=k(c).parents("div.aloha-table-wrapper").get(0);if(!c)return false;for(c=c.nextElementSibling?c.nextElementSibling:c.nextSibling;c.nodeType!==3;){c=c.firstChild;if(c===null)return false}l.Selection.rangeObject.startContainer=c;l.Selection.rangeObject.endContainer=c;l.Selection.rangeObject.startOffset=0;l.Selection.rangeObject.endOffset=0;l.Selection.rangeObject.select();l.activeEditable&&k.browser.mozilla&&l.activeEditable.obj.focus();return true}return false},processCursor:function(a,
b){if(!a.collapsed)return true;f.removeZeroWidthTextNodeFix();var c=a.startContainer,d=l.getSelection();if(!c)return true;var q,p;if(k.browser.msie&&parseInt(k.browser.version,10)<=7&&j(c))if(b==37){for(p=a.startOffset;p>0&&c.data.charAt(p-1)==="​";)p--;if(p!=a.startOffset){a.setStart(a.startContainer,p);a.setEnd(a.startContainer,p);d=l.getSelection();d.removeAllRanges();d.addRange(a)}}else if(b==39){for(p=a.startOffset;p<c.data.length&&c.data.charAt(p)==="​";)p++;if(p!=a.startOffset){a.setStart(a.startContainer,
p);a.setEnd(a.startContainer,p);d.removeAllRanges();d.addRange(a)}}if(u&&!k(c).contentEditable()){d=k(c).parents("[contenteditable=false]");if(d.length>0)if(d.parent().hasClass("aloha-editable"))q=d[0];else return true}var v;if(!q){v=37===b||38===b;p=a.startOffset;if(j(c))if(v){if(1!==p&&!(0===p||p<=c.data.length-c.data.replace(/^\s+/,"").length))return true}else{if(!n(c,p))return true}else c=c.childNodes[p===m(c)?p-1:p];q=v?o(c):e(c)}if(g(q)){c=q;q=new s.Utils.RangeObject;d=v?o(c):e(c);if(!d||g(d)){d=
k("<div>&nbsp;</div>");v?k(c).before(d):k(c).after(d);q.startContainer=q.endContainer=d[0];q.startOffset=q.endOffset=0;r(q);window.$_alohaPlaceholder=d}else{if(a.startContainer.nodeType===3&&a.startContainer===a.endContainer&&a.startContainer.nodeValue!==""&&(v?a.startOffset===1:a.endOffset+1===a.endContainer.length)||a.startContainer.nodeType===1&&(!a.startOffset||a.startContainer.childNodes[a.startOffset]&&a.startContainer.childNodes[a.startOffset].nodeType===1)){d=f.insertZeroWidthTextNodeFix(c,
v);q.startContainer=q.endContainer=d;q.startOffset=q.endOffset=v?1:0}else{q.startContainer=q.endContainer=d;q.startOffset=q.endOffset=v?m(d):0;v||f.insertZeroWidthTextNodeFix(c,true)}r(q)}q.select();l.trigger("aloha-block-selected",c);l.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(a){var b=
l.Selection.rangeObject;this.insertHTMLBreak(b.getSelectionTree(),b,k(a))},insertHTMLBreak:function(a,b,c){var e,f,j,g,m,c=c||k("<br/>");e=0;for(f=a.length;e<f;++e){j=a[e];g=j.domobj?k(j.domobj):void 0;if(j.selection!=="none")if(j.selection=="collapsed"){if(e>0){j=k(a[e-1].domobj);j.after(c)}else{j=k(a[1].domobj);j.before(c)}b.startContainer=b.endContainer=c[0].parentNode;b.startOffset=b.endOffset=s.Utils.Dom.getIndexInParent(c[0])+1;b.correctRange()}else if(j.domobj&&j.domobj.nodeType===3){j.domobj.nextSibling&&
(j.domobj.nextSibling.nodeType==1&&l.Selection.replacingElements[j.domobj.nextSibling.nodeName.toLowerCase()])&&g.after("<br/>");if(this.needEndingBreak()){for(m=j.domobj;m;)if(m.nextSibling)m=false;else{m=m.parentNode;if(s.Utils.Dom.isBlockLevelElement(m)||s.Utils.Dom.isListElement(m))break;m===b.limitObject&&(m=false)}m&&k(m).append('<br class="aloha-cleanme" />')}g.between(c,j.startOffset);g=0;for(j=c[0];j;){j=j.previousSibling;++g}b.startContainer=c[0].parentNode;b.endContainer=c[0].parentNode;
b.startOffset=g;b.endOffset=g;b.correctRange()}else if(j.domobj&&j.domobj.nodeType===1){if(g.parent().find("br.aloha-ephemera").length===0){k(b.limitObject).find("br.aloha-ephemera").remove();k(b.commonAncestorContainer).append(this.getFillUpElement(b.splitObject))}g.after(c);b.startContainer=b.commonAncestorContainer;b.endContainer=b.startContainer;b.startOffset=e+2;b.endOffset=e+2;b.update()}}b.select()},needEndingBreak:function(){return!k.browser.msie},getSelectedText:function(){var a=l.Selection.rangeObject;
return a.isCollapsed()?false:this.getFromSelectionTree(a.getSelectionTree(),true)},getFromSelectionTree:function(a,b){var c="",e,f,j,g;e=0;for(f=a.length;e<f;e++){j=a[e];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(b)c=c+this.getFromSelectionTree(j.children,b);else{g=k(j.domobj.outerHTML).empty();g.html(this.getFromSelectionTree(j.children,b));c=c+g.outerHTML()}}else j.selection=="full"&&(j.domobj.nodeType===
3?c=c+k(j.domobj).text():j.domobj.nodeType===1&&j.children&&(c=c+(b?k(j.domobj).text():k(j.domobj).outerHTML())))}return c},getSelectedMarkup:function(){var a=l.Selection.rangeObject;return a.isCollapsed()?null:this.getFromSelectionTree(a.getSelectionTree(),false)},removeSelectedMarkup:function(){var a=l.Selection.rangeObject,b;if(!a.isCollapsed()){b=new l.Selection.SelectionRange;this.removeFromSelectionTree(a.getSelectionTree(),b);b.update();s.Utils.Dom.doCleanup({merge:true,removeempty:true},l.Selection.rangeObject);
l.Selection.rangeObject=b;b.correctRange();b.update();b.select();l.Selection.updateSelection()}},removeFromSelectionTree:function(a,b){var c,e,f,j,g;f=0;for(g=a.length;f<g;f++){j=a[f];if(j.selection=="partial")if(j.domobj.nodeType===3){e="";j.startOffset>0&&(e=e+j.domobj.data.substring(0,j.startOffset));j.endOffset<j.domobj.data.length&&(e=e+j.domobj.data.substring(j.endOffset,j.domobj.data.length));j.domobj.data=e;if(!b.startContainer){b.startContainer=b.endContainer=j.domobj;b.startOffset=b.endOffset=
j.startOffset}}else{if(j.domobj.nodeType===1&&j.children){this.removeFromSelectionTree(j.children,b);if(c){if(c.nodeName==j.domobj.nodeName){k(c).append(k(j.domobj).contents());k(j.domobj).remove()}}else c=j.domobj}}else if(j.selection=="full"){if(!b.startContainer)if(e=s.Utils.Dom.searchAdjacentTextNode(j.domobj.parentNode,s.Utils.Dom.getIndexInParent(j.domobj)+1,false,{blocklevel:false})){b.startContainer=b.endContainer=e;b.startOffset=b.endOffset=0}else{b.startContainer=b.endContainer=j.domobj.parentNode;
b.startOffset=b.endOffset=s.Utils.Dom.getIndexInParent(j.domobj)+1}k(j.domobj).remove()}}},splitRangeObject:function(a){k(a.splitObject);var b,c;a.update(a.splitObject);b=a.getSelectionTree();c=this.getSplitFollowUpContainer(a);this.splitRangeObjectHelper(b,a,c);c.hasClass("preparedForRemoval")&&c.removeClass("preparedForRemoval");b=this.getInsertAfterObject(a,c);k(c).insertAfter(b);a.splitObject.nodeName.toLowerCase()==="li"&&!l.Selection.standardTextLevelSemanticsComparator(a.splitObject,c)&&k(a.splitObject).remove();
a.startContainer=null;b=c.contents();if(b.length>0&&b.get(0).nodeType==1&&b.get(0).nodeName.toLowerCase()==="br")a.startContainer=c.get(0);if(!a.startContainer)a.startContainer=c.textNodes(true,true).first().get(0);if(!a.startContainer)a.startContainer=c.textNodes(false).first().parent().get(0);if(a.startContainer){a.endContainer=a.startContainer;a.startOffset=0;a.endOffset=0}else{a.startContainer=a.endContainer=c.parent().get(0);a.startOffset=a.endOffset=s.Utils.Dom.getIndexInParent(c.get(0))}a.update();
a.select()},getInsertAfterObject:function(a,b){var c,e,f;for(e=0;e<a.markupEffectiveAtStart.length;e++){f=a.markupEffectiveAtStart[e];f===a.splitObject&&(c=true);if(c&&l.Selection.canTag1WrapTag2(k(f).parent()[0].nodeName,b[0].nodeName))return f}return false},getFillUpElement:function(){return k.browser.msie?false:k('<br class="aloha-cleanme"/>')},removeElementContentWhitespaceObj:function(a){var b=0,c=[],e,f;for(e=0;e<a.length;++e){f=a[e];f.isElementContentWhitespace&&(c[c.length]=e)}for(e=0;e<c.length;++e){f=
c[e];a.splice(f-b,1);++b}},splitRangeObjectHelper:function(a,b,c,e){c||l.Log.warn(this,"no followUpContainer, no inBetweenMarkup, nothing to do...");var f=this.getFillUpElement(b.splitObject),j=k(b.splitObject),g=false,m,d,o,n,q;if(a.length>0){o=c.contents();o.length!==a.length&&this.removeElementContentWhitespaceObj(o);d=0;for(q=a.length;d<q;++d){m=a[d];if(m.selection==="none"&&g===false||m.domobj&&m.domobj.nodeType===3&&m===a[a.length-1]&&m.startOffset===m.domobj.data.length)if(c.textNodes().length>
1||m.domobj.nodeType===1&&m.children.length===0)o.eq(d).remove();else if(s.Utils.Dom.isSplitObject(c[0]))f?c.html(f):c.empty();else{c.empty();c.addClass("preparedForRemoval")}else if(m.selection!=="none"){if(m.domobj&&m.domobj.nodeType===3&&m.startOffset!==void 0){g=m.domobj.data;if(m.startOffset>0)m.domobj.data=g.substr(0,m.startOffset);else if(a.length>1)k(m.domobj).remove();else{n=k(m.domobj).parent();s.Utils.Dom.isSplitObject(n[0])?f?n.html(f):n.empty():n.remove()}if(g.length-m.startOffset>0)o[d].data=
g.substr(m.startOffset,g.length);else if(o.length>1)o.eq(d).remove();else if(s.Utils.Dom.isBlockLevelElement(c[0]))f?c.html(f):c.empty();else{c.empty();c.addClass("preparedForRemoval")}}g=true;m.children.length>0&&this.splitRangeObjectHelper(m.children,b,o.eq(d),e)}else m.selection==="none"&&g===true&&k(m.domobj).remove()}}else l.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&&(s.Utils.Dom.isSplitObject(j[0])&&f)&&j.html(f);c.contents().length===0&&(s.Utils.Dom.isSplitObject(c[0])&&f)&&c.html(f)},getSplitFollowUpContainer:function(a){var b;switch(a.splitObject.nodeName.toLowerCase()){case "h1":case "h2":case "h3":case "h4":case "h5":case "h6":if((b=k(a.splitObject).textNodes(":not(.aloha-cleanme)").last()[0])&&a.startContainer===b&&a.startOffset===b.length){b=k("<p></p>");a=k(a.splitObject.outerHTML).contents();
b.append(a);return b}break;case "li":if(a.startContainer.nodeName.toLowerCase()==="br"&&k(a.startContainer).hasClass("aloha-ephemera")){b=k("<p></p>");a=k(a.splitObject.outerHTML).contents();b.append(a);return b}if(!a.splitObject.nextSibling&&k.trim(k(a.splitObject).text()).length===0)return b=k("<p></p>")}return k(a.splitObject.outerHTML)},transformDomObject:function(a,b,c){var e=k(a),b=k("<"+b+">"),f,j=e[0].cloneNode(false).attributes;if(j)for(f=0;f<j.length;++f)(typeof j[f].specified==="undefined"||
j[f].specified)&&b.attr(j[f].nodeName,j[f].nodeValue);if(e[0].style&&e[0].style.cssText)b[0].style.cssText=e[0].style.cssText;e.contents().appendTo(b);e.replaceWith(b);if(c){if(c.startContainer==a)c.startContainer=b.get(0);if(c.endContainer==a)c.endContainer=b.get(0)}return b},toString:function(){return"Aloha.Markup"}});l.Markup=new l.Markup;return l.Markup});define("aloha/observable",["jquery"],function(l){return{_eventHandlers:null,bind:function(d,a,k){this._eventHandlers=this._eventHandlers||{};
this._eventHandlers[d]||(this._eventHandlers[d]=[]);this._eventHandlers[d].push({handler:a,scope:k||window})},unbind:function(d,a){this._eventHandlers=this._eventHandlers||{};this._eventHandlers[d]&&(this._eventHandlers[d]=a?l.grep(this._eventHandlers[d],function(k){return k.handler===a?!1:!0}):[])},trigger:function(d){this._eventHandlers=this._eventHandlers||{};if(this._eventHandlers[d]){var a=[];l.each(arguments,function(k,c){0<k&&a.push(c)});l.each(this._eventHandlers[d],function(k,c){c.handler.apply(c.scope,
a)})}},unbindAll:function(){this._eventHandlers=null}}});define("aloha/registry",["jquery","aloha/observable","util/class"],function(l,d,a){return a.extend(d,{_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 l.extend({},this._entries)},getIds:function(){return l.extend([],this._ids)}})});define("aloha/contenthandlermanager",["aloha/core","aloha/registry","util/class"],function(l,d,a){return new (d.extend({createHandler:function(k){if("function"!==typeof k.handleContent)throw"ContentHandler has no function handleContent().";return new (a.extend({handleContent:function(){}},k))},handleContent:function(a,
c,b){var f=c?c.contenthandler:this.getIds();if(!f)return a;var g,j;for(g=0;g<f.length&&!((j=this.get(f[g]))&&(a=j.handleContent(a,c,b||l.activeEditable)),null===a);g++);return a}}))});define("util/trees",["jquery"],function(l){function d(a,b,c){var e=l.type(a),f,j,g;if("array"===e){e=c?a:[];g=f=0;for(j=a.length;g<j;g++)c=b(a[g]),c.length&&(e[f++]=c[0]);f!==e.length&&(e=e.slice(0,f))}else if("object"===e)for(f in e=c?a:{},a)a.hasOwnProperty(f)&&(c=b(a[f]),c.length?e[f]=c[0]:delete e[f]);else e=a;return e}
function a(a,b){return d(a,b,!0)}function k(a,b){var c,e,f;if(1===a.nodeType)for(e=a.firstChild;e;)c=b(e),f=e.nextSibling,c.length?c[0]!==e&&a.replaceChild(c[0],e):a.removeChild(e),e=f;return a}function c(a,b,c,e){return[c(b(e),a)]}function b(a,b,c,e){return[b(c(e,a))]}function f(a,b,c,e){return b(e)?[]:[c(e,a)]}function g(a,b,c,e){a=c(e,a);return b(a)?[]:[a]}function j(a,b,c,e){function f(e){return a(f,b,c,e)}return f(e)[0]}function m(a){a=l.type(a);return"object"!==a&&"array"!==a}function e(b,c,
e){function f(a){return m(a)?[c(a)]:[j(a,f)]}var j=e?a:d;return f(b)[0]}return{prewalk:function(b,e,f){return j(c,e,f?a:d,b)},postwalk:function(c,e,f){return j(b,e,f?a:d,c)},preprune:function(b,c,e){return j(f,c,e?a:d,b)},postprune:function(b,c,e){return j(g,c,e?a:d,b)},prewalkDom:function(a,b,e){return j(c,b,k,e?a:a.cloneNode(!0))},postwalkDom:function(a,c,e){return j(b,c,k,e?a:a.cloneNode(!0))},prepruneDom:function(a,b,c){return j(f,b,k,c?a:a.cloneNode(!0))},postpruneDom:function(a,b,c){return j(g,
b,k,c?a:a.cloneNode(!0))},isLeaf:m,leaves:e,clone:function(a){function b(a){return[d(a,b)]}return b(a)[0]},flatten:function(a){var b=[];e(a,function(a){b.push(a);return a},!0);return b},walk:d,walkInplace:a,walkDomInplace:k}});define("util/browser",["jquery"],function(l){return{ie7:l.browser.msie&&8>parseInt(l.browser.version,10),ie:l.browser.msie}});define("util/dom2","aloha/core jquery util/functions util/maps util/arrays util/strings util/browser util/dom util/range".split(" "),function(l,d,a,
k,c,b,f,g,j){function m(a,b,c){for(;b;){var e=b.nextSibling;a.insertBefore(b,c);b=e}}function e(a){var b=a.outerHTML;if(typeof b!=="undefined")return b;try{return X?X.serializeToString(a):a.xml}catch(c){return a.xml}}function o(a){for(var b=[],a=e(a.cloneNode(false)),c;null!=(c=Z.exec(a));)b.push(c[1]);return b}function n(a,c){var e={},f,j,g,m,k,d,o;d=0;for(k=a.length;d<k;d++){g=a[d];if(g.className){j=b.words(g.className);for(o=0;o<j.length;o++){m=j[o];if(c[m])(f=e[m])?f.push(g):e[m]=[g]}}}return e}
function r(a){for(var b=0;a.previousSibling;){b++;a=a.previousSibling}return b}function p(a){for(var b=0,a=a.firstChild;a;){b=b+1;a=a.nextSibling}return b}function q(a,b){return 1===a.nodeType&&b>=p(a)||3===a.nodeType&&b===a.length&&!a.nextSibling}function s(a,b){1===a.nodeType&&b<p(a)?a=a.childNodes[b]:3===a.nodeType&&b===a.length&&(a=a.nextSibling||a.parentNode);return a}function u(a,b,c){c?b.appendChild(a):b.parentNode.insertBefore(a,b)}function v(a,b){this.node=a;this.atEnd=b}function t(a,b){return new v(a,
b)}function x(a,b){return t(s(a,b),q(a,b))}function y(a,b){for(var c=[],e=a.parentNode;e&&!b(e);){c.push(e);e=e.parentNode}return c}function z(a,b){var c=y(a,b),e=c.length?c[c.length-1]:a;e.parentNode&&c.push(e.parentNode);return c}function E(a,b){if(b(a))return[];var c=y(a,b);c.unshift(a);return c}function A(a,b){if(b(a))return[a];var c=z(a,b);c.unshift(a);return c}function C(a,b){var c=a.parentNode,e=a.nodeValue;if(0===b||b>=e.length)return a;var f=document.createTextNode(e.substring(0,b)),e=document.createTextNode(e.substring(b,
e.length));c.insertBefore(f,a);c.insertBefore(e,a);c.removeChild(a);return f}function J(a,b,c,e,f,j){if(b===f){f=j.length;if(c===0){b=j.parentNode;c=r(j)}else if(c<f)b=j;else if(c===f){b=j.parentNode;c=r(j)+1}else{b=j.nextSibling;c=c-f}a[e].call(a,b,c)}}function S(a,b,c){if(3===a.nodeType){var e=c.startContainer,f=c.startOffset,j=c.endContainer,g=c.endOffset,b=C(a,b);J(c,e,f,"setStart",a,b);J(c,j,g,"setEnd",a,b)}}function F(a,b,c,e){for(;a&&!c(a,e);){var f=a.nextSibling;b(a,e);a=f}}function B(b,c,
e){F(b,c,a.returnFalse,e)}function O(a,b,c){1===a.nodeType&&B(a.firstChild,function(a){O(a,b,c)});b(a,c)}function Y(a){if(a){this.startContainer=a.startContainer;this.startOffset=a.startOffset;this.endContainer=a.endContainer;this.endOffset=a.endOffset;this.commonAncestorContainer=a.commonAncestorContainer;this.collapsed=a.collapsed}}function R(a,b){b.atEnd?a.setStart(b.node,p(b.node)):a.setStart(b.node.parentNode,r(b.node))}function V(a,b){b.atEnd?a.setEnd(b.node,p(b.node)):a.setEnd(b.node.parentNode,
r(b.node))}function G(a,b){a.setStart(b.startContainer,b.startOffset);a.setEnd(b.endContainer,b.endOffset)}function N(a,b,c){if(!a.collapsed){for(var e=x(a.startContainer,a.startOffset),f=x(a.endContainer,a.endOffset),j=false;!e.equals(f)&&b(e)&&e.next();)j=true;c=c||b;b=false;for(3===a.endContainer.nodeType&&a.endOffset>0&&a.endOffset<a.endContainer.length&&f.next()&&c(f)&&f.prev();!f.equals(e)&&c(f)&&f.prev();)b=true;j&&R(a,e);b&&V(a,f)}}function H(a){if(a.firstChild)return a.firstChild;for(;a&&
!a.nextSibling;)a=a.parentNode;return a&&a.nextSibling}function T(a){for(var b=a.previousSibling;b&&b.lastChild;)b=b.lastChild;return b||a.parentNode}var Z=/\s([^\/<>\s=]+)(?:=(?:"[^"]*"|'[^']*'|[^>\/\s]+))?/g,X=window.XMLSerializer&&new window.XMLSerializer;v.prototype.next=function(){var a=this.node,b;if(this.atEnd||1!==a.nodeType){if(b=a.nextSibling)this.atEnd=false;else{b=a.parentNode;if(!b)return false;this.atEnd=true}this.node=b}else(b=a.firstChild)?this.node=b:this.atEnd=true;return true};
v.prototype.prev=function(){var a=this.node,b;if(this.atEnd)(b=a.lastChild)?this.node=b:this.atEnd=false;else{if(b=a.previousSibling){if(1===a.nodeType)this.atEnd=true}else{b=a.parentNode;if(!b)return false}this.node=b}return true};v.prototype.equals=function(a){return a.node===this.node&&a.atEnd===this.atEnd};v.prototype.clone=function(a){return a(a.node,a.atEnd)};v.prototype.insert=function(a){return u(a,this.node,this.atEnd)};Y.prototype.update=function(){if(this.startContainer&&this.endContainer){this.collapsed=
this.startContainer===this.endContainer&&this.startOffset===this.endOffset;var b=E(this.startContainer,a.returnFalse),e=E(this.endContainer,a.returnFalse);this.commonAncestorContainer=c.intersect(b,e)[0]}};Y.prototype.setStart=function(a,b){this.startContainer=a;this.startOffset=b;this.update()};Y.prototype.setEnd=function(a,b){this.endContainer=a;this.endOffset=b;this.update()};return{backward:T,forward:H,findForward:function(a,b,c){for(;a&&!c(a);){if(b(a))return a;a=H(a)}return null},findBackward:function(a,
b,c){for(;a&&!c(a);){if(b(a))return a;a=T(a)}return null},moveNextAll:m,attrNames:o,attrs:function(a){var b=[],c=o(a),e,f;e=0;for(f=c.length;e<f;e++){var j=c[e],g=d.attr(a,j),g=null==g?"":g.toString();b.push([j,g])}return b},indexByClass:function(a,b){var c;c=f.ie7?a.getElementsByTagName("*"):d(a).find("."+k.keys(b).join(",."));return n(c,b)},indexByName:function(a,b){var c,e={},f;c=0;for(f=b.length;c<f;c++){var j=b[c];e[j]=d.makeArray(a.getElementsByTagName(j))}return e},indexByClassHaveList:n,outerHtml:e,
removeShallow:function(a){var b=a.parentNode;m(b,a.firstChild,a);b.removeChild(a)},wrap:function(a,b){a.parentNode.replaceChild(b,a);b.appendChild(a)},insert:u,cursor:t,cursorFromBoundaryPoint:x,nodeAtOffset:s,isAtEnd:q,parentsUntil:y,parentsUntilIncl:z,childAndParentsUntil:E,childAndParentsUntilIncl:A,childAndParentsUntilNode:function(a,b){return E(a,function(a){return a===b})},childAndParentsUntilInclNode:function(a,b){return A(a,function(a){return a===b})},next:function(a,b,c){for(;a&&!b(a,c);)a=
a.nextSibling;return a},parent:function(a,b,c){for(;a&&!b(a,c);)a=a.parentNode;return a},isTextNode:function(a){return 3===a.nodeType},nodeIndex:r,splitTextNode:C,splitTextContainers:function(a){S(a.startContainer,a.startOffset,a);S(a.endContainer,a.endOffset,a)},walk:B,walkRec:O,walkUntil:F,walkUntilNode:function(a,b,c,e){F(a,b,function(a){return a===c},e)},stableRange:function(a){return new Y(a)},trimRange:N,trimRangeClosingOpening:function(a,b,c){c=c||b;N(a,function(a){return a.atEnd||b(a.node)},
function(a){a=a.atEnd?a.node.lastChild:a.node.previousSibling;return!a||c(a)})},setRangeFromRef:G,setRangeStartFromCursor:R,setRangeEndFromCursor:V,splitTextNodeAdjustRange:S,insertSelectText:function(a,b){if(a.length){S(b.startContainer,b.startOffset,b);var c=s(b.startContainer,b.startOffset),e=q(b.startContainer,b.startOffset);if(!e&&3===c.nodeType){c.insertData(0,a);b.setStart(c,0);b.setEnd(c,a.length)}else{var f;if((f=e?c.lastChild:c.previousSibling)&&3===f.nodeType){f.insertData(f.length,a);
b.setStart(f,f.length-a.length)}else{f=document.createTextNode(a);u(f,c,e);b.setStart(f,0)}b.setEnd(f,f.length)}}},areRangesEq:function(a,b){return a.startContainer===b.startContainer&&a.startOffset===b.startOffset&&a.endContainer===b.endContainer&&a.endOffset===b.endOffset},collapseToEnd:function(a){a.setStart(a.endContainer,a.endOffset)},extendToWord:function(a){var b=new j(a);g.extendToWord(b);G(a,b)},rangeFromRangeObject:function(a){var b=l.createRange();b.setStart(a.startContainer,a.startOffset);
b.setEnd(a.endContainer,a.endOffset);return b},cloneShallow:function(a){return a.cloneNode(false)},setStyle:function(a,b,c){d(a).css(b,null==c?"":c)},getStyle:function(a,c){c=b.dashesToCamelCase(c);return a.nodeType===1?a.style[c]:null},getComputedStyle:function(a,b){if(a.currentStyle)return a.currentStyle[b];var c=a.ownerDocument;if(c.defaultView&&c.defaultView.getComputedStyle)if(c=c.defaultView.getComputedStyle(a,null))return c[b]||c.getPropertyValue(b);return null},nodeLength:function(a){return 1===
a.nodeType?p(a):3===a.nodeType?a.length:0}}});define("util/misc",[],function(){return{anyRx:function(l,d){var a,k;a=0;for(k=l.length;a<k;a++)if(l[a].test(d))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 util/browser PubSub".split(" "),function(l,d,a,k,c,b,f,g,j,m,e,o){function n(a){var a=l(a),b=a.attr("data-aloha-ephemera-attr"),c;e.ie7||a.removeAttr("data-aloha-ephemera-attr");if(typeof b===
"string"){c=k.words(b);for(b=0;b<c.length;b++)a.removeAttr(c[b])}}function r(a,c,e,f){return(e=e[c])&&(true===e||-1!==b.indexOf(e,a.nodeName))?true:m.anyRx(f,c)}function p(a,b){var c=null,e=g.attrNames(a),f,j,m;j=0;for(m=e.length;j<m;j++){f=e[j];if(r(a,f,b.attrMap,b.attrRxs)){c=c||l(a);c.removeAttr(f)}}}function q(a,c){var e=a.className;if(e&&-1!==e.indexOf(u)){e=k.words(e);if(-1!==b.indexOf(e,"aloha-cleanme")||-1!==b.indexOf(e,"aloha-ephemera")){l.removeData(a);return false}if(-1!==b.indexOf(e,"aloha-ephemera-wrapper")||
-1!==b.indexOf(e,"aloha-ephemera-filler")){g.moveNextAll(a.parentNode,a.firstChild,a.nextSibling);l.removeData(a);return false}-1!==b.indexOf(e,"aloha-ephemera-attr")&&n(a);var f=b.filter(e,function(a){return!c.classMap[a]});if(f.length!==e.length)0===f.length?l(a).removeAttr("class"):a.className=f.join(" ")}p(a,c);return true}var s={classMap:{"aloha-ephemera-wrapper":true,"aloha-ephemera-filler":true,"aloha-ephemera-attr":true,"aloha-ephemera":true,"aloha-cleanme":true},attrMap:{hidefocus:true,hideFocus:true,
tabindex:true,tabIndex:true,contenteditable:["TABLE"],contentEditable:["TABLE"]},attrRxs:[/^(?:nodeIndex|sizcache|sizset|jquery)[\w\d]*$/i],pruneFns:[]},u="aloha-";return{ephemera:function(a){a&&(s=a);o.pub("aloha.ephemera",{ephemera:s});return s},classes:function(){var b=Array.prototype.slice.call(arguments);f.fillKeys(s.classMap,b,true);var c=b,e,j;e=0;for(j=c.length;e<j;e++)if(-1===c[e].indexOf(u)){a.warn('Class "'+c[e]+'" was set to be ephemeral,which hurts peformance. Add the common substring "'+
u+'" to the class to fix this problem.');u=""}o.pub("aloha.ephemera.classes",{ephemera:s,newClasses:b})},attributes:function(){var a=Array.prototype.slice.call(arguments);f.fillKeys(s.attrMap,a,true);o.pub("aloha.ephemera.attributes",{ephemera:s,newAttributes:a})},markElement:function(a){l(a).addClass("aloha-ephemera")},markAttr:function(a,c){var a=l(a),e=a.attr("data-aloha-ephemera-attr");null==e||""===e?e=c:-1===b.indexOf(k.words(e),c)&&(e=e+(" "+c));a.attr("data-aloha-ephemera-attr",e);a.addClass("aloha-ephemera-attr")},
markWrapper:function(a){l(a).addClass("aloha-ephemera-wrapper")},markFiller:function(a){l(a).addClass("aloha-ephemera-filler")},prune:function(a,e){function f(a){var j;a:{j=e;var g=f;if(1===a.nodeType){if(!q(a,j)){j=[];break a}a=c.walkDomInplace(a,g)}j=(a=b.reduce(j.pruneFns,a,b.applyNotNull))?[a]:[]}return j}e=e||s;return f(a)[0]},isAttrEphemeral:r}});define("aloha/copypaste",["jquery","aloha/core"],function(l,d){function a(a){var c=d.createRange(),b=d.getSelection();c.setStart(a.startContainer,
a.startOffset);c.setEnd(a.endContainer,a.endOffset);b.removeAllRanges();b.addRange(c)}return{getEditableAt:function(a){if(!a||!a.commonAncestorContainer)return null;a=l(a.commonAncestorContainer);return a.length?d.getEditableHost(a):null},getRange:function(){var a=d.getSelection();return a.getRangeCount()?a.getRangeAt(0):null},selectAllOf:function(k){a({startContainer:k,endContainer:k,startOffset:0,endOffset:k.childNodes?k.childNodes.length:k.length});l(k).focus()},setSelectionAt:a}});define("aloha/command",
["aloha/core","aloha/registry","aloha/engine","util/dom","aloha/contenthandlermanager"],function(l,d,a,k,c){var b={execCommand:function(b,g,j,m){var e={commandId:b,preventDefault:!1};l.trigger("aloha-command-will-execute",e);if(!0!==e.preventDefault){e=l.getSelection();if(!m){if(!e.getRangeCount())return;m=e.getRangeAt(0)}"inserthtml"===b.toLowerCase()&&(j=c.handleContent(j,{contenthandler:l.settings.contentHandler.insertHtml,command:"insertHtml"}));a.execCommand(b,g,j,m);"insertparagraph"!==b.toLowerCase()&&
e.getRangeCount()&&(m=e.getRangeAt(0),g=m.commonAncestorContainer,g.parentNode&&(g=g.parentNode),j=new window.GENTICS.Utils.RangeObject,j.startContainer=m.startContainer,j.startOffset=m.startOffset,j.endContainer=m.endContainer,j.endOffset=m.endOffset,k.doCleanup({merge:!0,removeempty:!1},j,g),j.select());l.trigger("aloha-command-executed",b)}},queryCommandEnabled:function(b,c){if(!c){if(!l.getSelection().getRangeCount())return;c=l.getSelection().getRangeAt(0)}return a.queryCommandEnabled(b,c)},queryCommandIndeterm:function(b,
c){if(!c){if(!l.getSelection().getRangeCount())return;c=l.getSelection().getRangeAt(0)}return a.queryCommandIndeterm(b,c)},queryCommandState:function(b,c){if(!c){if(!l.getSelection().getRangeCount())return;c=l.getSelection().getRangeAt(0)}return a.queryCommandState(b,c)},queryCommandSupported:function(b){return a.queryCommandSupported(b)},queryCommandValue:function(b,c){if(!c){if(!l.getSelection().getRangeCount())return;c=l.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},getStateOverride:a.getStateOverride,setStateOverride:a.setStateOverride,resetOverrides:a.resetOverrides,unsetStateOverride:a.unsetStateOverride},b=new (d.extend(b));l.execCommand=b.execCommand;l.queryCommandEnabled=b.queryCommandEnabled;l.queryCommandIndeterm=b.queryCommandIndeterm;l.queryCommandState=b.queryCommandState;l.queryCommandSupported=b.queryCommandSupported;l.queryCommandValue=b.queryCommandValue;l.querySupportedCommands=
b.querySupportedCommands;return b});define("aloha/state-override","aloha/core jquery aloha/command util/dom2 util/maps util/range PubSub".split(" "),function(l,d,a,k,c,b,f){function g(){e=o=null}function j(a,b,c){if(m){o=b;e=e||{};e[a]=c}}var m=l.settings.stateOverride!==false,e=null,o=null;l.bind("aloha-selection-changed",function(a,b){if(o&&!k.areRangesEq(o,b)){g();f.pub("aloha.selection.context-change",{range:b,event:a})}});return{enabled:function(a){null!=a&&(m=a);return m},keyPressHandler:function(a){if(e&&
!a.altKey&&!a.ctrlKey&&a.which){var b=l.getSelection();if(b.getRangeCount()){var f=String.fromCharCode(a.which),j=b.getRangeAt(0);k.insertSelectText(f,j);c.forEach(e,function(a,b){a(b,j)});k.collapseToEnd(j);b.removeAllRanges();b.addRange(j);a.preventDefault()}}},setWithRangeObject:function(a,c,e){if(m){j(a,k.rangeFromRangeObject(c),function(a,c){var f=new b(c);e(a,f);k.setRangeFromRef(c,f)});c.select()}},set:j,clear:g}});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 aloha/copypaste aloha/command aloha/state-override".split(" "),
function(l,d,a,k,c,b,f,g,j,m,e,o,n,r,p){function q(a){return f.handleContent(a.getContents(),{contenthandler:l.settings.contentHandler.smartContentChange},a)}function s(a){var e=a.obj;e.mousedown(function(b){if(!l.eventHandled){l.eventHandled=true;return a.activate(b)}});e.mouseup(function(){l.eventHandled=false});e.focus(function(b){return a.activate(b)});e.keydown(function(c){var e=b.preProcessKeyStrokes(c);a.keyCode=c.which;e||a.smartContentChange(c);return e});e.keypress(p.keyPressHandler);e.keypress(function(a){l.activeEditable.smartContentChange(a)});
e.keyup(function(a){if(a.keyCode===27){l.deactivateEditable();return false}});e.contentEditableSelectionChange(function(a){c.onChange(e,a);return e})}var u=window.unescape,v=window.GENTICS,t=false,x={};l.defaults.contentHandler={};l.defaults.contentHandler.initEditable=["blockelement","sanitize"];l.defaults.contentHandler.getContents=["blockelement","sanitize","basic"];if(typeof l.settings.contentHandler==="undefined")l.settings.contentHandler={};var y=function(b){return a(b).html()},z={65:"a"},E=
{"ctrl+a":function(){var a=n.getEditableAt(n.getRange());if(a){n.selectAllOf(a.obj[0]);return false}}};a(document).keydown(function(a){if(l.activeEditable){var b=z[a.which];if(b){var c=a.altKey?"alt":a.ctrlKey?"ctrl":a.shiftKey?"shift":null,b=(c?c+"+":"")+b;if(E[b])return E[b](a)}}});l.Editable=d.extend({_constructor:function(a){a.attr("id")||a.attr("id",v.Utils.guid());this.originalObj=this.obj=a;this.ready=false;this.sccDelimiters=[":",";",".","!","?",",",u("%u0009"),u("%u0020"),u("%u0008"),u("%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";l.registerEditable(this)},
init:function(){var a=this;if((this.settings=l.settings)&&l.settings.smartContentChange){if(l.settings.smartContentChange.delimiters)this.sccDelimiters=l.settings.smartContentChange.delimiters;if(l.settings.smartContentChange.idle)this.sccIdle=l.settings.smartContentChange.idle;if(l.settings.smartContentChange.delay)this.sccDelay=l.settings.smartContentChange.delay}if(this.check(this.obj)){if(typeof l.settings.contentHandler.getContents==="undefined")l.settings.contentHandler.getContents=l.defaults.contentHandler.getContents;
if(typeof l.settings.contentHandler.initEditable==="undefined")l.settings.contentHandler.initEditable=l.defaults.contentHandler.initEditable;var b=a.obj.html(),b=f.handleContent(b,{contenthandler:l.settings.contentHandler.initEditable,command:"initEditable"},a);a.obj.html(b);l.bind("aloha-plugins-loaded",function(){a.obj.addClass("aloha-editable").contentEditable(true);s(a);a.setUnmodified();a.snapshotContent=a.getContents();a.initPlaceholder();a.ready=true;window.setTimeout(function(){l.disableObjectResizing()},
20);l.trigger("aloha-editable-created",[a]);o.pub("aloha.editable.created",{data:a})})}else this.destroy()},isActive:false,originalContent:null,range:void 0,check:function(){var b=this,c=this.obj,e=c.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"],
j;for(j=0;j<f.length;++j)if(e===f[j])return true;switch(e){case "textarea":case "input":e=a('<div id="'+this.getId()+'-aloha" class="aloha-'+e+'" />').insertAfter(c);e.height(c.height()).width(c.width()).html(c.val());c.hide();c.parents("form:first").submit(function(){c.val(b.getContents())});this.obj=e;return true}return false},initPlaceholder:function(){l.settings.placeholder&&this.isEmpty()&&this.addPlaceholder()},isEmpty:function(){var b=a.trim(this.getContents());return b.length===0||(b==="<br>"?
true:false)},addPlaceholder:function(){var b=a("<div>"),c=a("<span>"),e,f=this.obj;e=v.Utils.Dom.allowsNesting(f[0],b[0])?b:c;if(a("."+this.placeholderClass,f).length===0){a.each(l.settings.placeholder,function(a,b){f.is(a)&&e.html(b)});if(!e.is(":empty")){e.addClass(this.placeholderClass).addClass("aloha-ephemera");a(f).append(e)}a("br",f).remove()}},removePlaceholder:function(b,e){var f=this.placeholderClass,j;a("."+this.placeholderClass,b).length!==0&&(e===true?window.setTimeout(function(){j=new c.SelectionRange;
j.startContainer=j.endContainer=b.get(0);j.startOffset=j.endOffset=0;a("."+f,b).remove();j.select()},100):a("."+f,b).remove())},destroy:function(){this===l.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");
l.trigger("aloha-editable-destroyed",[this]);o.pub("aloha.editable.destroyed",{data:this});l.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=l.getActiveEditable();if(t)t=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");l.activateEditable(this);t=true;this.removePlaceholder(this.obj,true);t=false;this.isActive=true;l.trigger("aloha-editable-activated",{oldActive:b,editable:this});o.pub("aloha.editable.activated",{data:{old:b,editable:this}})}},blur:function(){this.obj.blur();
this.isActive=false;this.initPlaceholder();this.obj.removeClass("aloha-editable-active");l.trigger("aloha-editable-deactivated",{editable:this});o.pub("aloha.editable.deactivated",{data:{editable:this}});l.activeEditable.smartContentChange({type:"blur"},null)},empty:function(b){return null===b||a.trim(b)===""||b==="<br/>"},getContents:function(b){var c=this.obj.html(),e=x[this.getId()];if(!e||c!==e.raw){j.removeZeroWidthTextNodeFix();var g=this.obj.clone(false);this.removePlaceholder(g);g=a(m.prune(g[0]));
k.makeClean(g);g=a("<div>"+f.handleContent(g.html(),{contenthandler:l.settings.contentHandler.getContents,command:"getContents"},this)+"</div>");e=x[this.getId()]={};e.raw=c;e.element=g}if(b)return e.element.clone().contents();if(null==e.serialized)e.serialized=y(e.element[0]);return e.serialized},setContents:function(a,b){var c=null;if(l.getActiveEditable()===this){l.deactivateEditable();c=this}this.obj.html(a);null!==c&&c.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 c(){null==m&&(m=e.getSnapshotContent());return m}var e=this,f=null,j;if(b&&(b.metaKey||b.crtlKey||b.altKey))return false;if(b&&b.originalEvent){j=/U\+(\w{4})/;j.exec(b.originalEvent.keyIdentifier);f=this.keyCodeMap[this.keyCode]||String.fromCharCode(b.which)||"unknown"}var m=null;if(a.inArray(f,this.sccDelimiters)>=0){clearTimeout(this.sccTimerIdle);clearTimeout(this.sccTimerDelay);this.sccTimerDelay=
window.setTimeout(function(){l.trigger("aloha-smart-content-changed",{editable:e,keyIdentifier:b.originalEvent.keyIdentifier,keyCode:b.keyCode,"char":f,triggerType:"keypress",getSnapshotContent:c});q(e);g.debug("Aloha.Editable","smartContentChanged: event type keypress triggered")},this.sccDelay)}else if(b&&b.type==="paste"){l.trigger("aloha-smart-content-changed",{editable:e,keyIdentifier:null,keyCode:null,"char":null,triggerType:"paste",getSnapshotContent:c});q(e)}else if(b&&b.type==="blur"){l.trigger("aloha-smart-content-changed",
{editable:e,keyIdentifier:null,keyCode:null,"char":null,triggerType:"blur",getSnapshotContent:c});q(e)}else if(b&&b.type==="block-change"){l.trigger("aloha-smart-content-changed",{editable:e,keyIdentifier:null,keyCode:null,"char":null,triggerType:"block-change",getSnapshotContent:c});q(e)}else if(f!==null){clearTimeout(this.sccTimerDelay);clearTimeout(this.sccTimerIdle);this.sccTimerIdle=window.setTimeout(function(){l.trigger("aloha-smart-content-changed",{editable:e,keyIdentifier:null,keyCode:null,
"char":null,triggerType:"idle",getSnapshotContent:c});q(e)},this.sccIdle)}},getSnapshotContent:function(){var a=this.snapshotContent;this.snapshotContent=this.getContents();return a}});l.Editable.setContentSerializer=function(a){y=a};l.Editable.getContentSerializer=function(){return y};l.Editable.registerEvents=s});define("aloha/plugin",["aloha/core","jquery","util/class","aloha/pluginmanager","aloha/console"],function(l,d,a,k,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;d.each(a.dependencies,function(j,m){if(!l.isPluginLoaded(m.toString()))return b=!1,c.error("plugin."+a.name,'Required plugin "'+m+'" not found.'),!1});return b},init:function(){},getEditableConfig:function(a){var b=null,c=!1,m=this;this.settings.editables&&d.each(this.settings.editables,function(e,k){var n;if(a.is(e))if(c=!0,k instanceof Array)b=[],b=d.merge(b,k);else if("object"===
typeof k)for(n in b={},b["aloha-editable-selector"]=e,k)k.hasOwnProperty(n)&&(k[n]instanceof Array?b[n]=k[n]:"object"===typeof k[n]?(b[n]={},b[n]=d.extend(!0,b[n],m.config[n],k[n])):b[n]=k[n]);else b=k});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 j=new (b.extend(c))(a);j.settings=d.extendObjects(!0,j.defaults,l.settings[a]);k.register(j);return j};return b});define("aloha/jquery.aloha",["aloha/core","aloha/selection","jquery","aloha/console"],function(l,d,a,k){function c(a,b,c,e){if(!(b!==e.target&&(/textarea|input|select/i.test(e.target.nodeName)||"text"===e.target.type)))return a.apply(b,c)}function b(b){var f,m,e,k;
if("string"===typeof b.data){f=b.handler;m=b.data.toLowerCase().split(" ");e={};for(k=0;k<m.length;k++)e[m[k]]=!0;b.handler=function(b){if(this===b.target){var g="keypress"!==b.type&&a.hotkeys.specialKeys[b.which],m="";b.altKey&&"alt"!==g&&(m+="alt+");b.ctrlKey&&"ctrl"!==g&&(m+="ctrl+");b.metaKey&&(!b.ctrlKey&&"meta"!==g)&&(m+="meta+");b.shiftKey&&"shift"!==g&&(m+="shift+");if(g){if(e[m+g])return c(f,this,arguments,b)}else if(g=String.fromCharCode(b.which).toLowerCase(),e[m+g]||e[m+a.hotkeys.shiftNums[g]]||
"shift+"===m&&e[a.hotkeys.shiftNums[g]])return c(f,this,arguments,b)}}}}var f=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),f="contenteditable";a.browser.msie&&7==parseInt(a.browser.version,10)&&
(f="contentEditable");if("undefined"===typeof b){if("undefined"===typeof c[0]){k.warn("The jquery object did not contain any valid elements.");return}return"undefined"===typeof c[0].isContentEditable?(k.warn("Could not determine whether the is editable or not. I assume it is."),!0):c[0].isContentEditable}""===b?c.removeAttr(f):c.attr(f,b&&"false"!==b?"true":"false");return c};a.fn.aloha=function(){var b=this;l.bind("aloha-plugins-loaded",function(){b.each(function(b,c){l.isEditable(c)||(new l.Editable(a(c))).init()})});
return b};a.fn.mahalo=function(){return this.each(function(){l.isEditable(this)&&l.getEditableById(a(this).attr("id")).destroy()})};a.fn.alohaText=function(){return this.each(function(){l.isEditable(this)&&l.getEditableById(a(this).attr("id")).getContents()})};a.fn.contentEditableSelectionChange=function(b){var c=this;this.keyup(function(a){d.getRangeObject();b(a)});this.dblclick(function(a){b(a)});this.mousedown(function(){c.selectionStarted=!0});a(document).mouseup(function(a){d.eventOriginalTarget=
c;c.selectionStarted&&b(a);d.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 f).serializeToString(b)}catch(c){try{return b.xml}catch(m){}}};a.fn.zap=function(){return this.each(function(){a(this.childNodes).insertBefore(this)}).remove()};a.fn.textNodes=function(b,c){var f=[],e=function(k){var d,r;if(3===k.nodeType&&a.trim(k.data)&&!c||3===k.nodeType&&c||"BR"==
k.nodeName&&!b)f.push(k);else{d=0;for(r=k.childNodes.length;d<r;++d)e(k.childNodes[d])}};e(this[0]);return a(f)};a.extendObjects=a.fn.extendObjects=function(b,c){var f,e,k,d,r;f=1;var p=b||{},q=arguments.length,s=!1,l;"boolean"===typeof p&&(s=p,p=c||{},f=2);"object"!==typeof p&&!a.isFunction(p)&&(p={});q===f&&(p=this,--f);for(l=f;l<q;l++)if(null!=(f=arguments[l]))for(e in f)f.hasOwnProperty(e)&&(k=p[e],d=f[e],p!==d&&(s&&d&&(a.isPlainObject(d)||!0===(r=a.isArray(d)))?(r?(r=!1,k=k&&a.isArray(k)?k:[]):
k=k&&a.isPlainObject(k)?k:{},p[e]=a.isArray(d)?d:a.extendObjects(s,k,d)):void 0!==d&&(p[e]=d)));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",188:",",190:".",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(l,d,a,k){var c=+new Date;d.easing.easeOutExpo||
d.extend(d.easing,{easeOutExpo:function(a,b,c,f,j){return b==j?c+f:f*(-Math.pow(2,-10*b/j)+1)+c},easeOutElastic:function(a,b,c,f,j){var a=Math,g=1.70158,m=0,k=f;if(!b)return c;if(1==(b/=j))return c+f;m||(m=0.3*j);k<a.abs(f)?(k=f,g=m/4):g=m/(2*a.PI)*a.asin(f/k);return k*a.pow(2,-10*b)*a.sin((b*j-g)*2*a.PI/m)+f+c}});var b=function(a){this.id=null;this.folds={};this.button=null;this.title=d('<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=d('<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)},f=function(a){var b=this;this.id="aloha-sidebar-"+ ++c;this.panels={};this.container=d('<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:!d.browser.msie,overlayPage:!0};d(function(){"undefined"!==typeof l.settings.sidebar&&l.settings.sidebar.disabled||b.init(a)})},g=null,j=null;d.extend(f.prototype,{init:function(a){var b=this,c;"object"===typeof a&&(c=a.panels,delete a.panels);d.extend(this,a);"object"===typeof c&&d.each(c,function(){b.addPanel(this,true)});a=this.container;"right"===this.position&&a.addClass("aloha-sidebar-right");a.hide().appendTo(d("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();d(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(d(a.markupEffectiveAtStart[f]))}var j=this;d.each(this.panels,function(){j.showActivePanel(this,b)});this.correctHeight()},subscribeToEvents:function(){var a=this;k.sub("aloha.selection.context-change",function(b){a.isOpen&&a.checkActivePanels(b.range);a.lastRange=b.range});l.bind("aloha-editable-deactivated",
function(){a.isOpen&&a.checkActivePanels();a.lastRange=null});this.container.mousedown(function(a){a.originalEvent.stopSelectionUpdate=!0;l.eventHandled=!0});this.container.mouseup(function(a){a.originalEvent.stopSelectionUpdate=!0;l.eventHandled=!1})},correctHeight:function(){if(this.isOpen)if(this.isCompletelyOpen){var a=d(window).height(),b=[],c=[],f;for(f in this.panels)this.panels.hasOwnProperty(f)&&this.panels[f].isActive&&(c.push(this.panels[f]),b.push(f));if(0!==c.length&&(b=b.sort().join(","),
!(j===b&&g===a))){g=a;j=b;for(var a=this.container.find(".aloha-sidebar-inner").height()-(c[0].title.outerHeight()+10)*c.length,m,k,s,l=0,v=Math,t;0<c.length&&0<a;){a+=l;l=0;s=[];for(t=c.length-1;0<=t;--t)b=c[t],m=b.content.find(".aloha-sidebar-panel-content-inner"),f=v.min(m.height("auto").height(),v.floor(a/(t+1))),m.height(f),a-=f,k=m.find(".aloha-sidebar-panel-content-inner-text"),k.height()>f?(s.push(b),l+=f,m.css({"overflow-x":"hidden","overflow-y":"scroll"})):m.css("overflow-y","hidden"),b.expanded&&
b.expand();c=s}}}else this.correctHeightWhenCompletelyOpen=!0},showActivePanel:function(a,b){b.push(null);a.content.parent("li");var c=a.activeOn,f=d(),j=0,g=b.length,m;for(m=0;m<g;++m)c(b[m])&&(++j,b[m]&&d.merge(f,b[m]));j?a.activate(f):a.deactivate()},initToggler:function(){var a=this,b=this.container,c=b.find(".aloha-sidebar-handle-icon"),f,j="right"===this.position;this.opened&&this.rotateHandleArrow(j?0:180,0);d(function(){"undefined"!==typeof l.settings.sidebar&&(l.settings.sidebar.handle&&
l.settings.sidebar.handle.top)&&(d(b.find(".aloha-sidebar-handle"))[0].style.top=l.settings.sidebar.handle.top)});b.find(".aloha-sidebar-handle").click(function(){f&&clearInterval(f);c.stop().css("marginLeft",4);a.isOpen?(d(this).removeClass("aloha-sidebar-toggled"),a.close(),a.isOpen=!1):(d(this).addClass("aloha-sidebar-toggled"),a.open(),a.isOpen=!0)}).hover(function(){var b=a.isOpen?-1:1;f&&clearInterval(f);c.stop();d(this).stop().animate(j?{marginLeft:"-="+5*b}:{marginRight:"-="+5*b},200);f=setInterval(function(){b*=
-1;c.animate(j?{left:"-="+4*b}:{right:"-="+4*b},300)},300)},function(){f&&clearInterval(f);c.stop().css(j?"left":"right",5);d(this).stop().animate(j?{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=d(window).height();this.container.height(a).find(".aloha-sidebar-inner").height(a)},barClicked:function(a){this.handleBarclick(d(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||d("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);d("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||d("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(c){c instanceof b||(c.width||(c.width=this.width),c.sidebar=this,c=new b(c));this.panels[c.id]=c;this.container.find(".aloha-sidebar-panels").append(c.element);this.checkActivePanels(a.getRangeObject());return c}});d.extend(b.prototype,{init:function(a){this.setTitle(a.title).setContent(a.content);delete a.title;delete a.content;d.extend(this,a);this.id||(this.id="aloha-sidebar-"+
++c);this.element=d('<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(),j=c.height("auto").height();c.height(f).stop().animate({height:j},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:3},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=[],j=[],g=this.activeOn,m,k;0<c.length&&!c.is(".aloha-editable");){if(g(c)){j.push("<span>"+c[0].tagName.toLowerCase()+
"</span>");m=j.length;for(k=[];m--;)k.push(j[m]);f.push('<div class="aloha-sidebar-panel-parent"><div class="aloha-sidebar-panel-parent-path">'+k.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(""));d(".aloha-sidebar-panel-parent-path").click(function(){var a=d(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 m=new f({position:"left",width:250}),f=new f({position:"right",width:250});l.Sidebar={left:m,right:f};return l.Sidebar});window.GENTICS=window.GENTICS||{};window.GENTICS.Utils=window.GENTICS.Utils||{};define("util/position",["jquery"],function(l){var d=window.GENTICS;d.Utils.Position={};d.Utils.Position.w=l(window);d.Utils.Position.Scroll={top:0,left:0,isScrolling:!1};
d.Utils.Position.ScrollCorrection={top:100,left:50};d.Utils.Position.Mouse={x:0,y:0,oldX:0,oldY:0,isMoving:!1,triggeredMouseStop:!0};d.Utils.Position.mouseStopCallbacks=[];d.Utils.Position.mouseMoveCallbacks=[];d.Utils.Position.update=function(){var a=this.w.scrollTop(),k=this.w.scrollLeft();if(this.Scroll.isScrolling)this.Scroll.top==a&&this.Scroll.left==k&&(this.Scroll.isScrolling=!1);else if(this.Scroll.top!=a||this.Scroll.left!=k)this.Scroll.isScrolling=!0;this.Scroll.top=a;this.Scroll.left=k;
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};d.Utils.Position.addMouseStopCallback=function(a){this.mouseStopCallbacks.push(a);
return this.mouseStopCallbacks.length-1};d.Utils.Position.addMouseMoveCallback=function(a){this.mouseMoveCallbacks.push(a);return this.mouseMoveCallbacks.length-1};l(function(){window.setInterval(function(){d.Utils.Position.update()},500)});l("html").mousemove(function(a){d.Utils.Position.Mouse.x=a.pageX;d.Utils.Position.Mouse.y=a.pageY})});define("aloha/repositoryobjects",["aloha/core","util/class"],function(l,d){var a=window.GENTICS;l.RepositoryObject=function(){};l.RepositoryDocument=d.extend({_constructor:function(k){this.type=
"document";k.id&&(k.name&&k.repositoryId)&&(a.Utils.applyProperties(this,k),this.baseType="document")}});l.RepositoryFolder=d.extend({_constructor:function(k){this.type="folder";k.id&&(k.name&&k.repositoryId)&&(a.Utils.applyProperties(this,k),this.baseType="folder")}})});define("aloha/repositorymanager",["jquery","util/class","aloha/core","aloha/console","aloha/repositoryobjects"],function(l,d,a,k){function c(a,b){var c={items:a,results:a.length};b&&(c.numItems=b.numItems,c.hasMoreItems=b.hasMoreItems,
c.timeout=b.timeout);return c}function b(a,b){a(b)}var f=function(a){return a?function(a,b){return a.filter(b)}:function(a,b){var c=[],e,f=a.length;for(e=0;e<f;e++)b(a[e])&&c.push(a[e]);return c}}(Array.prototype.hasOwnProperty("filter")),g=function(a){return"function"===typeof a.query},j=function(a){return"function"===typeof a.getChildren},m=function(a){return"function"===typeof a.getSelectedFolder},d=d.extend({repositories:[],settings:a.settings&&a.settings.repositories||{},initialized:!1,init:function(){"undefined"===
typeof this.settings.timeout&&(this.settings.timeout=5E3);var a;for(a=0;a<this.repositories.length;a++)this.initRepository(this.repositories[a]);this.initialized=!0},register:function(a){this.getRepository(a.repositoryId)?k.warn(this,'A repository with name "'+a.repositoryId+'" already registerd. Ignoring this.'):(this.repositories.push(a),this.initialized&&this.initRepository(a))},initRepository:function(a){a.settings||(a.settings={});this.settings[a.repositoryId]&&l.extend(a.settings,this.settings[a.repositoryId]);
a.init()},getRepository:function(a){var b;for(b=0;b<this.repositories.length;b++)if(this.repositories[b].repositoryId===a)return this.repositories[b];return null},query:function(a,j){var m=this,d,p=[],q={numItems:0,hasMoreItems:!1},s,u=a.timeout&&parseInt(a.timeout,10)||m.settings.timeout,v=window.setTimeout(function(){q=q||{};q.timeout=!0;0<s&&(k.warn(m,s+" repositories did not return before the configured timeout of "+u+"ms."),s=0);clearTimeout(v);var a=c(p,q);j(a)},u),t=function(a,b){if(0!==s){if(a&&
a.length){if(!a[0].repositoryId){var e=this.repositoryId,f;for(f=0;f<a.length;f++)a[f].repositoryId=e}l.merge(p,a)}b&&q?(q.numItems=l.isNumeric(b.numItems)&&l.isNumeric(q.numItems)?q.numItems+b.numItems:void 0,q.hasMoreItems="boolean"===typeof b.hasMoreItems&&"boolean"===typeof q.hasMoreItems?q.hasMoreItems||b.hasMoreItems:void 0,b.timeout&&(q.timeout=!0)):q=void 0;k.debug(m,"The repository "+this.repositoryId+"returned with "+a.length+" results.");0===--s&&(clearTimeout(v),e=c(p,q),j(e))}};d=a.repositoryId?
[m.getRepository(a.repositoryId)]:m.repositories;var x=f(d,g);if(0===x.length)clearTimeout(v),b(j,c(p,q));else{var y=function(a){return function(){t.apply(a,arguments)}};s=x.length;for(d=0;d<x.length;d++)x[d].query(a,y(x[d]))}},getChildren:function(b,c){var g=this,m,d=[],q=0,s=b.timeout&&parseInt(b.timeout,10)||g.settings.timeout,u=window.setTimeout(function(){0<q&&(k.warn(g,q+" repositories did not respond before the configured timeout of "+s+"ms."),q=0);clearTimeout(u);c(d)},s),v=function(a){0!==
q&&(a&&l.merge(d,a),0===--q&&(clearTimeout(u),c(d)))},t=b.repositoryId?[g.getRepository(b.repositoryId)]:g.repositories;b.repositoryFilter&&b.repositoryFilter.length&&(t=f(t,function(a){return-1<l.inArray(a.repositoryId,b.repositoryFilter)}));if("aloha"===b.inFolderId){for(m=0;m<t.length;m++)d.push(new a.RepositoryFolder({id:t[m].repositoryId,name:t[m].repositoryName,repositoryId:t[m].repositoryId,type:"repository",hasMoreItems:!0}));clearTimeout(u);c(d)}else if(t=f(t,j),0===t.length)clearTimeout(u),
c(d);else{q=t.length;for(m=0;m<t.length;m++)t[m].getChildren(b,v)}},makeClean:function(a){var b=this,c={},f=0,j=b.repositories.length;a.find("[data-gentics-aloha-repository="+this.prefix+"]").each(function(){for(;f<j;)c.makeClean(a),f+=1;k.debug(b,"Passing contents of HTML Element with id { "+this.attr("id")+" } for cleaning to repository { "+c.repositoryId+" }");c.makeClean(this)})},markObject:function(a,b){if(a)if(b){var c=this.getRepository(b.repositoryId);c?(l(a).attr({"data-gentics-aloha-repository":b.repositoryId,
"data-gentics-aloha-object-id":b.id}),c.markObject(a,b)):k.error(this,'Trying to apply a repository "'+b.name+'" to an object, but item has no repositoryId.')}else l(a).removeAttr("data-gentics-aloha-repository").removeAttr("data-gentics-aloha-object-id")},getObject:function(a,b){var c=l(a),f=c.attr("data-gentics-aloha-object-id"),c=c.attr("data-gentics-aloha-repository"),j=this.getRepository(c);if(j&&f){this.itemCache||(this.itemCache=[]);var g=this.itemCache[c];g||(g=this.itemCache[c]=[]);g[f]?
b([g[f]]):j.getObjectById(f,function(a){g[f]=a[0];b(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=f(this.repositories,m),b,c;for(b=0;b<a.length;b++)if(c=
a[b].getSelectedFolder())return c;return null},toString:function(){return"repositorymanager"}});a.RepositoryManager=new d;return a.RepositoryManager});define("aloha/repository",["aloha/core","util/class","aloha/repositorymanager"],function(l,d,a){d=d.extend({_constructor:function(k,c){this.repositoryId=k;this.settings={};this.repositoryName=c||k;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 l.AbstractRepository=d});(function(l){function d(){var a,b,c=Aloha.settings.plugins&&Aloha.settings.plugins.load,f=Aloha.settings.baseUrl,g,k=/\/aloha.js(\?\S*)?$/,d=/\/[^\/]*\.js$/,q;if(!c||!f){a=document.getElementsByTagName("script");for(q=0;q<a.length;q++){b=a[q];g=b.getAttribute("data-aloha-plugins");if(null!=g){c||(c=g);f||(f=b.src.replace(d,""));
break}!f&&k.test(b.src)&&(f=b.src.replace(k,""))}}"string"===typeof c&&""!==c&&(c=c.replace(/\s+/g,"").split(","));return{baseUrl:f,plugins:c||[]}}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 k(a){var b={},c=[],f={},g={},k,d,q=Aloha.settings.basePath||"",s=Aloha.settings.bundles||{},l;for(l=0;l<a.length;l++){k=a[l].split("/");d=k[0];k=k[1];d=s[d]?q+s[d]:q+"../plugins/"+d;var v=b,
t=d,x=k,y=["nls","css","vendor","res"],z=void 0,E=void 0;v[x]=t+"/"+x+"/lib";for(E=0;E<y.length;E++)z=y[E],v[x+"/"+z]=t+"/"+x+"/"+z;f[k]=d+"/"+k;c.push(k+"/"+k+"-plugin");g[k]={jquery:"aloha/jquery"}}return{paths:b,entryPoints:c,baseUrlByName:f,names:[],map:g}}function c(){var a={},b=Array.prototype.slice.call(arguments),c,f,g;for(f=0;f<b.length;f++)for(c in g=b[f],g)g.hasOwnProperty(c)&&(a[c]=b[f][c]);return a}function b(a,b){define(a,function(){return b})}function f(){Aloha.features={};Aloha.defaults=
{};Aloha.settings=Aloha.settings||{};Aloha.initialize=g.start;var a=d(),f=k(a.plugins);Aloha.settings.baseUrl=a.baseUrl;Aloha.settings.loadedPlugins=f.names;Aloha.settings._pluginBaseUrlByName=f.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"}},f.map);a={context:"aloha",config:{i18n:{locale:Aloha.settings.locale||"en"}},baseUrl:Aloha.settings.baseUrl,map:a};(l.__DEPS__||(l.__DEPS__={})).lang=a.config.i18n.locale;var e=c(a,Aloha.settings.requireConfig);e.paths=c({jquery:"vendor/jquery-1.7.2",jqueryui:"vendor/jquery-ui-1.9.0.custom-aloha"},{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-1.3.0-rc30.7","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"},f.paths,e.paths);a=Aloha.settings.predefinedModules||{};Aloha.settings.jQuery&&(a.jquery=Aloha.settings.jQuery);for(var o in a)a.hasOwnProperty(o)&&
(b(o,a[o]),delete e.paths[o]);var n=require.config(e);Aloha.require=function(a){return 1===arguments.length&&typeof a==="function"?n(["aloha"],a):n.apply(this,arguments)};Aloha.bind=function(a,b){Aloha.require(["aloha/jquery"],function(c){Aloha.bind=function(a,b){switch(g.getReadiness(a)){case "deferred":var e=g.getPhaseByEvent(a);if(!e.deferred)e.deferred=c.Deferred();e.deferred.done(b);break;case "immediate":b();break;case "normal":c(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(c){Aloha.trigger=function(a,b){var e=g.getPhaseByEvent(a);if(e&&e.deferred){c(e.deferred.resolve);e.deferred=null}c(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(e,["aloha","aloha/jquery"],function(a,b){require(e,f.entryPoints,function(){b(function(){window.rangy.init();a.init()})})})}var g={phases:[],completed:[],start:function(a,b){g.phases=g.phases.concat(a);g.proceed(0,a,b)},proceed:function(a,b,c){if(a<b.length){var f=b[a],k=function(){g.proceed(++a,b,c)},d=function(){g.completed.push(f);f.event&&Aloha.trigger(f.event)};f.fn?f.fn(d,k):(d(),k())}else c&&c()},getPhaseByEvent:function(a){var b;
for(b=0;b<g.phases.length;b++)if(a===g.phases[b].event)return g.phases[b];return null},getReadiness:function(a){var b;for(b=0;b<g.completed.length;b++)if(a===g.completed[b].event)return"immediate";return g.getPhaseByEvent(a)?"deferred":"normal"}};l.Aloha=l.Aloha||{};l.Aloha.deferInit||a()?l.Aloha.deferInit=f:Aloha._load=f})(window);define("ui/context",["aloha","jquery","util/class"],function(l,d,a){var k;k=d("#aloha-ui-context");k.length||(k=d("<div>",{"class":"aloha",id:"aloha-ui-context"}),d(function(){k.appendTo("body")}));
l=a.extend({surfaces:[],containers:[]});d.extend(l,{selector:"#aloha-ui-context",element:k});return l});define("ui/scopes",["jquery","PubSub","util/maps"],function(l,d,a){function k(a,b){if(c.hasOwnProperty(b))for(var f=c[b],j=0;j<f.length;j++){var g=f[j];a.push(g);k(a,g)}}var c={"Aloha.empty":[],"Aloha.global":["Aloha.empty"],"Aloha.continuoustext":["Aloha.global"]},b=[],f={},g=!1;Aloha.bind("aloha-selection-changed-before",function(){g=!1});Aloha.bind("aloha-selection-changed-after",function(a,
b,c){"undefined"!==typeof c&&!g&&j.setScope("Aloha.continuoustext")});var j={enterScope:function(a,b){var b=b||"_globalCounter",c=f[a];c||(c=f[a]={});var j=c[b]||0;c[b]=j+1;j||d.pub("aloha.ui.scope.change")},leaveScope:function(b,c,j){var c=c||"_globalCounter",g=f[b];if(g){var k=g[c];k&&((k-=1)&&!j?g[c]=k:(delete g[c],a.isEmpty(g)&&delete f[b],d.pub("aloha.ui.scope.change")))}},isActiveScope:function(a){return f[a]||-1!==l.inArray(a,b)?!0:!1},getPrimaryScope:function(){return b[0]},setScope:function(a){g=
!0;b[0]!=a&&(b=[a],k(b,a),d.pub("aloha.ui.scope.change"))},createScope:function(a,b){b?"string"===typeof b&&(b=[b]):b=["Aloha.empty"];c[a]=b}};return j});define("ui/container",["jquery","util/class","ui/scopes"],function(l,d,a){function k(c,j){switch(l.type(j)){case "function":return j;case "object":if(j.scope)return b[j.scope]?b[j.scope]:b[j.scope]=function(){return a.isActiveScope(j.scope)};throw"Invalid showOn configuration";default:return f}}var c=0,b={},f=function(){return!0},d=d.extend({element:null,
_constructor:function(a,b){var f=k(this,b.showOn),e;f.showOnId||(f.showOnId=++c);e=f.showOnId;var d=a.containers[e];this.context=a;d||(d=a.containers[e]={shouldShow:f,containers:[]});d.containers.push(this)},show:function(){},hide:function(){},focus:function(){},foreground:function(){},childVisible:function(){},childFocus:function(){},childForeground:function(){}});l.extend(d,{showContainersForContext:function(a,b){var c,e,f;if(a.containers)for(e in f=a.containers,f)if(f.hasOwnProperty(e)){c=f[e];
var k=c.containers;c=c.shouldShow(b)?"show":"hide";for(var d=void 0,d=0;d<k.length;d++)k[d][c]()}}});return d});define("ui/surface",["aloha/core","jquery","util/class","ui/container"],function(l,d,a){var k=a.extend({_constructor:function(a){a.surfaces.push(this)},isActive:function(){return!0}});d.extend(k,{range:null,show:function(a){d.each(a.surfaces,function(a,c){c.show()})},hide:function(a){d.each(a.surfaces,function(a,c){c.hide()})},trackRange:function(a){a.bind("mousedown",function(a){a.originalEvent.stopSelectionUpdate=
!0;l.eventHandled=!0;k.suppressHide=!0;l.activeEditable&&(a=l.getSelection(),k.range=0<a.getRangeCount()?a.getRangeAt(0):null)});a.bind("mouseup",function(a){a.originalEvent.stopSelectionUpdate=!0;l.eventHandled=!1;k.suppressHide=!1})}});return k});define("ui/component",["aloha/core","jquery","util/class"],function(l,d,a){var k=0;return a.extend({id:0,isInstance:!0,container:null,type:null,visible:!0,_constructor:function(){this.id=k++;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(l){(function(d,a){function k(a,b){var f,e;f=a.nodeName.toLowerCase();if("area"===f){f=a.parentNode;e=f.name;if(!a.href||!e||"map"!==f.nodeName.toLowerCase())return!1;f=d("img[usemap=#"+e+"]")[0];return!!f&&c(f)}return(/input|select|textarea|button|object/.test(f)?!a.disabled:"a"===f?a.href||b:b)&&c(a)}function c(a){return!d(a).parents().andSelf().filter(function(){return"hidden"===d.css(this,"visibility")||d.expr.filters.hidden(this)}).length}var b=0,f=/^ui-id-\d+$/;
d.ui=d.ui||{};d.ui.version||(d.extend(d.ui,{version:"1.9.0",keyCode:{BACKSPACE:8,COMMA:188,DELETE:46,DOWN:40,END:35,ENTER:13,ESCAPE:27,HOME:36,LEFT:37,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,SPACE:32,TAB:9,UP:38}}),d.fn.extend({_focus:d.fn.focus,focus:function(a,b){return"number"===typeof a?this.each(function(){var c=this;setTimeout(function(){d(c).focus();b&&b.call(c)},a)}):this._focus.apply(this,
arguments)},scrollParent:function(){var a;a=d.browser.msie&&/(static|relative)/.test(this.css("position"))||/absolute/.test(this.css("position"))?this.parents().filter(function(){return/(relative|absolute|fixed)/.test(d.css(this,"position"))&&/(auto|scroll)/.test(d.css(this,"overflow")+d.css(this,"overflow-y")+d.css(this,"overflow-x"))}).eq(0):this.parents().filter(function(){return/(auto|scroll)/.test(d.css(this,"overflow")+d.css(this,"overflow-y")+d.css(this,"overflow-x"))}).eq(0);return/fixed/.test(this.css("position"))||
!a.length?d(document):a},zIndex:function(b){if(b!==a)return this.css("zIndex",b);if(this.length)for(var b=d(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},uniqueId:function(){return this.each(function(){this.id||(this.id="ui-id-"+ ++b)})},removeUniqueId:function(){return this.each(function(){f.test(this.id)&&d(this).removeAttr("id")})}}),d("<a>").outerWidth(1).jquery||
d.each(["Width","Height"],function(b,c){function f(a,b,c,j){d.each(e,function(){b-=parseFloat(d.css(a,"padding"+this))||0;c&&(b-=parseFloat(d.css(a,"border"+this+"Width"))||0);j&&(b-=parseFloat(d.css(a,"margin"+this))||0)});return b}var e="Width"===c?["Left","Right"]:["Top","Bottom"],k=c.toLowerCase(),n={innerWidth:d.fn.innerWidth,innerHeight:d.fn.innerHeight,outerWidth:d.fn.outerWidth,outerHeight:d.fn.outerHeight};d.fn["inner"+c]=function(b){return b===a?n["inner"+c].call(this):this.each(function(){d(this).css(k,
f(this,b)+"px")})};d.fn["outer"+c]=function(a,b){return"number"!==typeof a?n["outer"+c].call(this,a):this.each(function(){d(this).css(k,f(this,a,!0,b)+"px")})}}),d.extend(d.expr[":"],{data:d.expr.createPseudo?d.expr.createPseudo(function(a){return function(b){return!!d.data(b,a)}}):function(a,b,c){return!!d.data(a,c[3])},focusable:function(a){return k(a,!isNaN(d.attr(a,"tabindex")))},tabbable:function(a){var b=d.attr(a,"tabindex"),c=isNaN(b);return(c||0<=b)&&k(a,!c)}}),d(function(){var a=document.body,
b=a.appendChild(b=document.createElement("div"));b.offsetHeight;d.extend(b.style,{minHeight:"100px",height:"auto",padding:0,borderWidth:0});d.support.minHeight=100===b.offsetHeight;d.support.selectstart="onselectstart"in b;a.removeChild(b).style.display="none"}),d.fn.extend({disableSelection:function(){return this.bind((d.support.selectstart?"selectstart":"mousedown")+".ui-disableSelection",function(a){a.preventDefault()})},enableSelection:function(){return this.unbind(".ui-disableSelection")}}),
d.extend(d.ui,{plugin:{add:function(a,b,c){var e,a=d.ui[a].prototype;for(e in c)a.plugins[e]=a.plugins[e]||[],a.plugins[e].push([b,c[e]])},call:function(a,b,c){var e=a.plugins[b];if(e&&a.element[0].parentNode&&11!==a.element[0].parentNode.nodeType)for(b=0;b<e.length;b++)a.options[e[b][0]]&&e[b][1].apply(a.element,c)}},contains:d.contains,hasScroll:function(a,b){if("hidden"===d(a).css("overflow"))return!1;var c=b&&"left"===b?"scrollLeft":"scrollTop",e=!1;if(0<a[c])return!0;a[c]=1;e=0<a[c];a[c]=0;return e},
isOverAxis:function(a,b,c){return a>b&&a<b+c},isOver:function(a,b,c,e,f,k){return d.ui.isOverAxis(a,c,f)&&d.ui.isOverAxis(b,e,k)}}))})(l);(function(d,a){var k=0,c=Array.prototype.slice,b=d.cleanData;d.cleanData=function(a){for(var c=0,j;null!=(j=a[c]);c++)try{d(j).triggerHandler("remove")}catch(m){}b(a)};d.widget=function(a,b,c){var m,e,k,n,r=a.split(".")[0],a=a.split(".")[1];m=r+"-"+a;c||(c=b,b=d.Widget);d.expr[":"][m.toLowerCase()]=function(a){return!!d.data(a,m)};d[r]=d[r]||{};e=d[r][a];k=d[r][a]=
function(a,b){if(!this._createWidget)return new k(a,b);arguments.length&&this._createWidget(a,b)};d.extend(k,e,{version:c.version,_proto:d.extend({},c),_childConstructors:[]});n=new b;n.options=d.widget.extend({},n.options);d.each(c,function(a,e){d.isFunction(e)&&(c[a]=function(){var c=function(){return b.prototype[a].apply(this,arguments)},f=function(c){return b.prototype[a].apply(this,c)};return function(){var a=this._super,b=this._superApply,j;this._super=c;this._superApply=f;j=e.apply(this,arguments);
this._super=a;this._superApply=b;return j}}())});k.prototype=d.widget.extend(n,{widgetEventPrefix:a},c,{constructor:k,namespace:r,widgetName:a,widgetBaseClass:m,widgetFullName:m});e?(d.each(e._childConstructors,function(a,b){var c=b.prototype;d.widget(c.namespace+"."+c.widgetName,k,b._proto)}),delete e._childConstructors):b._childConstructors.push(k);d.widget.bridge(a,k)};d.widget.extend=function(b){for(var g=c.call(arguments,1),j=0,m=g.length,e,k;j<m;j++)for(e in g[j])k=g[j][e],g[j].hasOwnProperty(e)&&
k!==a&&(b[e]=d.isPlainObject(k)?d.widget.extend({},b[e],k):k);return b};d.widget.bridge=function(b,g){var j=g.prototype.widgetFullName;d.fn[b]=function(m){var e="string"===typeof m,k=c.call(arguments,1),n=this,m=!e&&k.length?d.widget.extend.apply(null,[m].concat(k)):m;e?this.each(function(){var c,e=d.data(this,j);if(!e)return d.error("cannot call methods on "+b+" prior to initialization; attempted to call method '"+m+"'");if(!d.isFunction(e[m])||"_"===m.charAt(0))return d.error("no such method '"+
m+"' for "+b+" widget instance");c=e[m].apply(e,k);if(c!==e&&c!==a)return n=c&&c.jquery?n.pushStack(c.get()):c,!1}):this.each(function(){var a=d.data(this,j);a?a.option(m||{})._init():new g(m,this)});return n}};d.Widget=function(){};d.Widget._childConstructors=[];d.Widget.prototype={widgetName:"widget",widgetEventPrefix:"",defaultElement:"<div>",options:{disabled:!1,create:null},_createWidget:function(a,b){b=d(b||this.defaultElement||this)[0];this.element=d(b);this.uuid=k++;this.eventNamespace="."+
this.widgetName+this.uuid;this.options=d.widget.extend({},this.options,this._getCreateOptions(),a);this.bindings=d();this.hoverable=d();this.focusable=d();b!==this&&(d.data(b,this.widgetName,this),d.data(b,this.widgetFullName,this),this._on({remove:"destroy"}),this.document=d(b.style?b.ownerDocument:b.document||b),this.window=d(this.document[0].defaultView||this.document[0].parentWindow));this._create();this._trigger("create",null,this._getCreateEventData());this._init()},_getCreateOptions:d.noop,
_getCreateEventData:d.noop,_create:d.noop,_init:d.noop,destroy:function(){this._destroy();this.element.unbind(this.eventNamespace).removeData(this.widgetName).removeData(this.widgetFullName).removeData(d.camelCase(this.widgetFullName));this.widget().unbind(this.eventNamespace).removeAttr("aria-disabled").removeClass(this.widgetFullName+"-disabled ui-state-disabled");this.bindings.unbind(this.eventNamespace);this.hoverable.removeClass("ui-state-hover");this.focusable.removeClass("ui-state-focus")},
_destroy:d.noop,widget:function(){return this.element},option:function(b,c){var j=b,m,e,k;if(0===arguments.length)return d.widget.extend({},this.options);if("string"===typeof b)if(j={},m=b.split("."),b=m.shift(),m.length){e=j[b]=d.widget.extend({},this.options[b]);for(k=0;k<m.length-1;k++)e[m[k]]=e[m[k]]||{},e=e[m[k]];b=m.pop();if(c===a)return e[b]===a?null:e[b];e[b]=c}else{if(c===a)return this.options[b]===a?null:this.options[b];j[b]=c}this._setOptions(j);return this},_setOptions:function(a){for(var b in a)this._setOption(b,
a[b]);return this},_setOption:function(a,b){this.options[a]=b;"disabled"===a&&(this.widget().toggleClass(this.widgetFullName+"-disabled ui-state-disabled",!!b).attr("aria-disabled",b),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)},_on:function(a,b){b?(a=d(a),this.bindings=this.bindings.add(a)):(b=a,a=this.element);var c=this;d.each(b,
function(b,e){function g(){if(!(c.options.disabled===true||d(this).hasClass("ui-state-disabled")))return(typeof e==="string"?c[e]:e).apply(c,arguments)}if(typeof e!=="string")g.guid=e.guid=e.guid||g.guid||d.guid++;var k=b.match(/^(\w+)\s*(.*)$/),r=k[1]+c.eventNamespace;(k=k[2])?c.widget().delegate(k,r,g):a.bind(r,g)})},_off:function(a,b){b=(b||"").split(" ").join(this.eventNamespace+" ")+this.eventNamespace;a.unbind(b).undelegate(b)},_delay:function(a,b){var c=this;return setTimeout(function(){return("string"===
typeof a?c[a]:a).apply(c,arguments)},b||0)},_hoverable:function(a){this.hoverable=this.hoverable.add(a);this._on(a,{mouseenter:function(a){d(a.currentTarget).addClass("ui-state-hover")},mouseleave:function(a){d(a.currentTarget).removeClass("ui-state-hover")}})},_focusable:function(a){this.focusable=this.focusable.add(a);this._on(a,{focusin:function(a){d(a.currentTarget).addClass("ui-state-focus")},focusout:function(a){d(a.currentTarget).removeClass("ui-state-focus")}})},_trigger:function(a,b,c){var m,
e=this.options[a],c=c||{},b=d.Event(b);b.type=(a===this.widgetEventPrefix?a:this.widgetEventPrefix+a).toLowerCase();b.target=this.element[0];if(a=b.originalEvent)for(m in a)m in b||(b[m]=a[m]);this.element.trigger(b,c);return!(d.isFunction(e)&&!1===e.apply(this.element[0],[b].concat(c))||b.isDefaultPrevented())}};d.each({show:"fadeIn",hide:"fadeOut"},function(a,b){d.Widget.prototype["_"+a]=function(c,m,e){"string"===typeof m&&(m={effect:m});var k,n=!m?a:!0===m||"number"===typeof m?b:m.effect||b,m=
m||{};"number"===typeof m&&(m={duration:m});k=!d.isEmptyObject(m);m.complete=e;m.delay&&c.delay(m.delay);if(k&&d.effects&&(d.effects.effect[n]||!1!==d.uiBackCompat&&d.effects[n]))c[a](m);else if(n!==a&&c[n])c[n](m.duration,m.easing,e);else c.queue(function(b){d(this)[a]();e&&e.call(c[0]);b()})}});!1!==d.uiBackCompat&&(d.Widget.prototype._getCreateOptions=function(){return d.metadata&&d.metadata.get(this.element[0])[this.widgetName]})})(l);(function(d){var a=!1;d(document).mouseup(function(){a=!1});
d.widget("ui.mouse",{version:"1.9.0",options:{cancel:"input,textarea,button,select,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===d.data(c.target,a.widgetName+".preventClickEvent"))return d.removeData(c.target,a.widgetName+".preventClickEvent"),c.stopImmediatePropagation(),!1});this.started=!1},_mouseDestroy:function(){this.element.unbind("."+this.widgetName);
this._mouseMoveDelegate&&d(document).unbind("mousemove."+this.widgetName,this._mouseMoveDelegate).unbind("mouseup."+this.widgetName,this._mouseUpDelegate)},_mouseDown:function(k){if(!a){this._mouseStarted&&this._mouseUp(k);this._mouseDownEvent=k;var c=this,b=1===k.which,f="string"===typeof this.options.cancel&&k.target.nodeName?d(k.target).closest(this.options.cancel).length:!1;if(!b||f||!this._mouseCapture(k))return!0;this.mouseDelayMet=!this.options.delay;this.mouseDelayMet||(this._mouseDelayTimer=
setTimeout(function(){c.mouseDelayMet=!0},this.options.delay));if(this._mouseDistanceMet(k)&&this._mouseDelayMet(k)&&(this._mouseStarted=!1!==this._mouseStart(k),!this._mouseStarted))return k.preventDefault(),!0;!0===d.data(k.target,this.widgetName+".preventClickEvent")&&d.removeData(k.target,this.widgetName+".preventClickEvent");this._mouseMoveDelegate=function(a){return c._mouseMove(a)};this._mouseUpDelegate=function(a){return c._mouseUp(a)};d(document).bind("mousemove."+this.widgetName,this._mouseMoveDelegate).bind("mouseup."+
this.widgetName,this._mouseUpDelegate);k.preventDefault();return a=!0}},_mouseMove:function(a){if(d.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){d(document).unbind("mousemove."+this.widgetName,this._mouseMoveDelegate).unbind("mouseup."+
this.widgetName,this._mouseUpDelegate);this._mouseStarted&&(this._mouseStarted=!1,a.target===this._mouseDownEvent.target&&d.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}})})(l);
(function(d,a){function k(a,b,c){return[parseInt(a[0],10)*(r.test(a[0])?b/100:1),parseInt(a[1],10)*(r.test(a[1])?c/100:1)]}function c(a,b){return parseInt(d.css(a,b),10)||0}d.ui=d.ui||{};var b,f=Math.max,g=Math.abs,j=Math.round,m=/left|center|right/,e=/top|center|bottom/,o=/[\+\-]\d+%?/,n=/^\w+/,r=/%$/,p=d.fn.position;d.position={scrollbarWidth:function(){if(b!==a)return b;var c,e,f=d("<div style='display:block;width:50px;height:50px;overflow:hidden;'><div style='height:100px;width:auto;'></div></div>");
e=f.children()[0];d("body").append(f);c=e.offsetWidth;f.css("overflow","scroll");e=e.offsetWidth;c===e&&(e=f[0].clientWidth);f.remove();return b=c-e},getScrollInfo:function(a){var b=a.isWindow?"":a.element.css("overflow-x"),c=a.isWindow?"":a.element.css("overflow-y"),c="scroll"===c||"auto"===c&&a.height<a.element[0].scrollHeight;return{width:"scroll"===b||"auto"===b&&a.width<a.element[0].scrollWidth?d.position.scrollbarWidth():0,height:c?d.position.scrollbarWidth():0}},getWithinInfo:function(a){var a=
d(a||window),b=d.isWindow(a[0]);return{element:a,isWindow:b,offset:a.offset()||{left:0,top:0},scrollLeft:a.scrollLeft(),scrollTop:a.scrollTop(),width:b?a.width():a.outerWidth(),height:b?a.height():a.outerHeight()}}};d.fn.position=function(a){if(!a||!a.of)return p.apply(this,arguments);var a=d.extend({},a),b,r,l,t,x,y=d(a.of),z=d.position.getWithinInfo(a.within),E=d.position.getScrollInfo(z),A=y[0],C=(a.collision||"flip").split(" "),J={};9===A.nodeType?(r=y.width(),l=y.height(),t={top:0,left:0}):d.isWindow(A)?
(r=y.width(),l=y.height(),t={top:y.scrollTop(),left:y.scrollLeft()}):A.preventDefault?(a.at="left top",r=l=0,t={top:A.pageY,left:A.pageX}):(r=y.outerWidth(),l=y.outerHeight(),t=y.offset());x=d.extend({},t);d.each(["my","at"],function(){var b=(a[this]||"").split(" "),c,f;b.length===1&&(b=m.test(b[0])?b.concat(["center"]):e.test(b[0])?["center"].concat(b):["center","center"]);b[0]=m.test(b[0])?b[0]:"center";b[1]=e.test(b[1])?b[1]:"center";c=o.exec(b[0]);f=o.exec(b[1]);J[this]=[c?c[0]:0,f?f[0]:0];a[this]=
[n.exec(b[0])[0],n.exec(b[1])[0]]});1===C.length&&(C[1]=C[0]);"right"===a.at[0]?x.left+=r:"center"===a.at[0]&&(x.left+=r/2);"bottom"===a.at[1]?x.top+=l:"center"===a.at[1]&&(x.top+=l/2);b=k(J.at,r,l);x.left+=b[0];x.top+=b[1];return this.each(function(){var e,m,n=d(this),o=n.outerWidth(),p=n.outerHeight(),A=c(this,"marginLeft"),V=c(this,"marginTop"),G=o+A+c(this,"marginRight")+E.width,N=p+V+c(this,"marginBottom")+E.height,H=d.extend({},x),T=k(J.my,n.outerWidth(),n.outerHeight());if(a.my[0]==="right")H.left=
H.left-o;else if(a.my[0]==="center")H.left=H.left-o/2;if(a.my[1]==="bottom")H.top=H.top-p;else if(a.my[1]==="center")H.top=H.top-p/2;H.left=H.left+T[0];H.top=H.top+T[1];if(!d.support.offsetFractions){H.left=j(H.left);H.top=j(H.top)}e={marginLeft:A,marginTop:V};d.each(["left","top"],function(c,f){if(d.ui.position[C[c]])d.ui.position[C[c]][f](H,{targetWidth:r,targetHeight:l,elemWidth:o,elemHeight:p,collisionPosition:e,collisionWidth:G,collisionHeight:N,offset:[b[0]+T[0],b[1]+T[1]],my:a.my,at:a.at,within:z,
elem:n})});d.fn.bgiframe&&n.bgiframe();a.using&&(m=function(b){var c=t.left-H.left,e=c+r-o,j=t.top-H.top,m=j+l-p,k={target:{element:y,left:t.left,top:t.top,width:r,height:l},element:{element:n,left:H.left,top:H.top,width:o,height:p},horizontal:e<0?"left":c>0?"right":"center",vertical:m<0?"top":j>0?"bottom":"middle"};if(r<o&&g(c+e)<r)k.horizontal="center";if(l<p&&g(j+m)<l)k.vertical="middle";k.important=f(g(c),g(e))>f(g(j),g(m))?"horizontal":"vertical";a.using.call(this,b,k)});n.offset(d.extend(H,
{using:m}))})};d.ui.position={fit:{left:function(a,b){var c=b.within,e=c.isWindow?c.scrollLeft:c.offset.left,j=c.width,g=a.left-b.collisionPosition.marginLeft,c=e-g,m=g+b.collisionWidth-j-e;b.collisionWidth>j?0<c&&0>=m?(e=a.left+c+b.collisionWidth-j-e,a.left+=c-e):a.left=0<m&&0>=c?e:c>m?e+j-b.collisionWidth:e:a.left=0<c?a.left+c:0<m?a.left-m:f(a.left-g,a.left)},top:function(a,b){var c=b.within,e=c.isWindow?c.scrollTop:c.offset.top,j=b.within.height,g=a.top-b.collisionPosition.marginTop,c=e-g,m=g+
b.collisionHeight-j-e;b.collisionHeight>j?0<c&&0>=m?(e=a.top+c+b.collisionHeight-j-e,a.top+=c-e):a.top=0<m&&0>=c?e:c>m?e+j-b.collisionHeight:e:a.top=0<c?a.top+c:0<m?a.top-m:f(a.top-g,a.top)}},flip:{left:function(a,b){var c=b.within,e=c.offset.left+c.scrollLeft,f=c.width,j=c.isWindow?c.scrollLeft:c.offset.left,m=a.left-b.collisionPosition.marginLeft,c=m-j,k=m+b.collisionWidth-f-j,m="left"===b.my[0]?-b.elemWidth:"right"===b.my[0]?b.elemWidth:0,d="left"===b.at[0]?b.targetWidth:"right"===b.at[0]?-b.targetWidth:
0,n=-2*b.offset[0];if(0>c){if(e=a.left+m+d+n+b.collisionWidth-f-e,0>e||e<g(c))a.left+=m+d+n}else if(0<k&&(e=a.left-b.collisionPosition.marginLeft+m+d+n-j,0<e||g(e)<k))a.left+=m+d+n},top:function(a,b){var c=b.within,e=c.offset.top+c.scrollTop,f=c.height,j=c.isWindow?c.scrollTop:c.offset.top,m=a.top-b.collisionPosition.marginTop,c=m-j,k=m+b.collisionHeight-f-j,m="top"===b.my[1]?-b.elemHeight:"bottom"===b.my[1]?b.elemHeight:0,d="top"===b.at[1]?b.targetHeight:"bottom"===b.at[1]?-b.targetHeight:0,n=-2*
b.offset[1];if(0>c){if(e=a.top+m+d+n+b.collisionHeight-f-e,a.top+m+d+n>c&&(0>e||e<g(c)))a.top+=m+d+n}else if(0<k&&(e=a.top-b.collisionPosition.marginTop+m+d+n-j,a.top+m+d+n>k&&(0<e||g(e)<k)))a.top+=m+d+n}},flipfit:{left:function(){d.ui.position.flip.left.apply(this,arguments);d.ui.position.fit.left.apply(this,arguments)},top:function(){d.ui.position.flip.top.apply(this,arguments);d.ui.position.fit.top.apply(this,arguments)}}};(function(){var a,b,c,e,f=document.getElementsByTagName("body")[0];c=document.createElement("div");
a=document.createElement(f?"div":"body");b={visibility:"hidden",width:0,height:0,border:0,margin:0,background:"none"};f&&d.extend(b,{position:"absolute",left:"-1000px",top:"-1000px"});for(e in b)a.style[e]=b[e];a.appendChild(c);b=f||document.documentElement;b.insertBefore(a,b.firstChild);c.style.cssText="position: absolute; left: 10.7432222px;";c=d(c).offset().left;d.support.offsetFractions=10<c&&11>c;a.innerHTML="";b.removeChild(a)})();!1!==d.uiBackCompat&&function(b){var c=b.fn.position;b.fn.position=
function(e){if(!e||!e.offset)return c.call(this,e);var f=e.offset.split(" "),j=e.at.split(" ");1===f.length&&(f[1]=f[0]);/^\d/.test(f[0])&&(f[0]="+"+f[0]);/^\d/.test(f[1])&&(f[1]="+"+f[1]);1===j.length&&(/left|center|right/.test(j[0])?j[1]="center":(j[1]=j[0],j[0]="center"));return c.call(this,b.extend(e,{at:j[0]+f[0]+" "+j[1]+f[1],offset:a}))}}(l)})(l);(function(d){d.widget("ui.draggable",d.ui.mouse,{version:"1.9.0",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(){this.element.removeClass("ui-draggable ui-draggable-dragging ui-draggable-disabled");this._mouseDestroy()},_mouseCapture:function(a){var k=this.options;if(this.helper||k.disabled||d(a.target).is(".ui-resizable-handle"))return!1;this.handle=this._getHandle(a);if(!this.handle)return!1;d(!0===k.iframeFix?"iframe":k.iframeFix).each(function(){d('<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(d(this).offset()).appendTo("body")});return!0},_mouseStart:function(a){var k=this.options;this.helper=this._createHelper(a);this.helper.addClass("ui-draggable-dragging");this._cacheHelperProportions();d.ui.ddmanager&&(d.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};d.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;k.cursorAt&&this._adjustOffsetFromHelper(k.cursorAt);k.containment&&this._setContainment();if(!1===this._trigger("start",a))return this._clear(),!1;this._cacheHelperProportions();
d.ui.ddmanager&&!k.dropBehaviour&&d.ui.ddmanager.prepareOffsets(this,a);this._mouseDrag(a,!0);d.ui.ddmanager&&d.ui.ddmanager.dragStart(this,a);return!0},_mouseDrag:function(a,k){this.position=this._generatePosition(a);this.positionAbs=this._convertPositionTo("absolute");if(!k){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";d.ui.ddmanager&&d.ui.ddmanager.drag(this,a);return!1},_mouseStop:function(a){var k=!1;d.ui.ddmanager&&!this.options.dropBehaviour&&(k=d.ui.ddmanager.drop(this,a));this.dropped&&(k=this.dropped,this.dropped=!1);for(var c=this.element[0],b=!1;c&&(c=c.parentNode);)c==document&&(b=!0);if(!b&&"original"===this.options.helper)return!1;if("invalid"==this.options.revert&&!k||"valid"==this.options.revert&&k||!0===this.options.revert||d.isFunction(this.options.revert)&&
this.options.revert.call(this.element,k)){var f=this;d(this.helper).animate(this.originalPosition,parseInt(this.options.revertDuration,10),function(){f._trigger("stop",a)!==false&&f._clear()})}else!1!==this._trigger("stop",a)&&this._clear();return!1},_mouseUp:function(a){d("div.ui-draggable-iframeFix").each(function(){this.parentNode.removeChild(this)});d.ui.ddmanager&&d.ui.ddmanager.dragStop(this,a);return d.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 k=!this.options.handle||!d(this.options.handle,this.element).length?!0:!1;d(this.options.handle,this.element).find("*").andSelf().each(function(){this==a.target&&(k=!0)});return k},_createHelper:function(a){var k=this.options,a=d.isFunction(k.helper)?d(k.helper.apply(this.element[0],[a])):"clone"==k.helper?this.element.clone().removeAttr("id"):this.element;a.parents("body").length||a.appendTo("parent"==k.appendTo?this.element[0].parentNode:
k.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(" "));d.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&&d.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()&&d.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:d(window).scrollLeft()-this.offset.relative.left-this.offset.parent.left,"document"==a.containment?0:d(window).scrollTop()-this.offset.relative.top-this.offset.parent.top,("document"==a.containment?0:d(window).scrollLeft())+d("document"==a.containment?document:window).width()-this.helperProportions.width-this.margins.left,("document"==a.containment?0:d(window).scrollTop())+(d("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=d(a.containment),k=a[0];if(k){a.offset();var c="hidden"!=d(k).css("overflow");this.containment=[(parseInt(d(k).css("borderLeftWidth"),10)||0)+(parseInt(d(k).css("paddingLeft"),10)||0),(parseInt(d(k).css("borderTopWidth"),10)||0)+(parseInt(d(k).css("paddingTop"),10)||0),(c?Math.max(k.scrollWidth,k.offsetWidth):k.offsetWidth)-(parseInt(d(k).css("borderLeftWidth"),10)||0)-(parseInt(d(k).css("paddingRight"),
10)||0)-this.helperProportions.width-this.margins.left-this.margins.right,(c?Math.max(k.scrollHeight,k.offsetHeight):k.offsetHeight)-(parseInt(d(k).css("borderTopWidth"),10)||0)-(parseInt(d(k).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,k){k||(k=this.position);var c="absolute"==a?1:-1,b="absolute"==this.cssPosition&&
!(this.scrollParent[0]!=document&&d.contains(this.scrollParent[0],this.offsetParent[0]))?this.offsetParent:this.scrollParent,f=/(html|body)/i.test(b[0].tagName);return{top:k.top+this.offset.relative.top*c+this.offset.parent.top*c-("fixed"==this.cssPosition?-this.scrollParent.scrollTop():f?0:b.scrollTop())*c,left:k.left+this.offset.relative.left*c+this.offset.parent.left*c-("fixed"==this.cssPosition?-this.scrollParent.scrollLeft():f?0:b.scrollLeft())*c}},_generatePosition:function(a){var k=this.options,
c="absolute"==this.cssPosition&&!(this.scrollParent[0]!=document&&d.contains(this.scrollParent[0],this.offsetParent[0]))?this.offsetParent:this.scrollParent,b=/(html|body)/i.test(c[0].tagName),f=a.pageX,g=a.pageY;if(this.originalPosition){var j;this.containment&&(this.relative_container?(j=this.relative_container.offset(),j=[this.containment[0]+j.left,this.containment[1]+j.top,this.containment[2]+j.left,this.containment[3]+j.top]):j=this.containment,a.pageX-this.offset.click.left<j[0]&&(f=j[0]+this.offset.click.left),
a.pageY-this.offset.click.top<j[1]&&(g=j[1]+this.offset.click.top),a.pageX-this.offset.click.left>j[2]&&(f=j[2]+this.offset.click.left),a.pageY-this.offset.click.top>j[3]&&(g=j[3]+this.offset.click.top));k.grid&&(g=k.grid[1]?this.originalPageY+Math.round((g-this.originalPageY)/k.grid[1])*k.grid[1]:this.originalPageY,g=j?!(g-this.offset.click.top<j[1]||g-this.offset.click.top>j[3])?g:!(g-this.offset.click.top<j[1])?g-k.grid[1]:g+k.grid[1]:g,f=k.grid[0]?this.originalPageX+Math.round((f-this.originalPageX)/
k.grid[0])*k.grid[0]:this.originalPageX,f=j?!(f-this.offset.click.left<j[0]||f-this.offset.click.left>j[2])?f:!(f-this.offset.click.left<j[0])?f-k.grid[0]:f+k.grid[0]:f)}return{top:g-this.offset.click.top-this.offset.relative.top-this.offset.parent.top+("fixed"==this.cssPosition?-this.scrollParent.scrollTop():b?0:c.scrollTop()),left:f-this.offset.click.left-this.offset.relative.left-this.offset.parent.left+("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,k,c){c=c||this._uiHash();d.ui.plugin.call(this,a,[k,c]);"drag"==a&&(this.positionAbs=this._convertPositionTo("absolute"));return d.Widget.prototype._trigger.call(this,a,k,c)},plugins:{},_uiHash:function(){return{helper:this.helper,position:this.position,originalPosition:this.originalPosition,offset:this.positionAbs}}});d.ui.plugin.add("draggable","connectToSortable",
{start:function(a,k){var c=d(this).data("draggable"),b=c.options,f=d.extend({},k,{item:c.element});c.sortables=[];d(b.connectToSortable).each(function(){var b=d.data(this,"sortable");b&&!b.options.disabled&&(c.sortables.push({instance:b,shouldRevert:b.options.revert}),b.refreshPositions(),b._trigger("activate",a,f))})},stop:function(a,k){var c=d(this).data("draggable"),b=d.extend({},k,{item:c.element});d.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,k){var c=d(this).data("draggable"),b=this;d.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=d(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 k.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)})}});d.ui.plugin.add("draggable","cursor",{start:function(){var a=d("body"),k=d(this).data("draggable").options;a.css("cursor")&&(k._cursor=a.css("cursor"));a.css("cursor",
k.cursor)},stop:function(){var a=d(this).data("draggable").options;a._cursor&&d("body").css("cursor",a._cursor)}});d.ui.plugin.add("draggable","opacity",{start:function(a,k){var c=d(k.helper),b=d(this).data("draggable").options;c.css("opacity")&&(b._opacity=c.css("opacity"));c.css("opacity",b.opacity)},stop:function(a,k){var c=d(this).data("draggable").options;c._opacity&&d(k.helper).css("opacity",c._opacity)}});d.ui.plugin.add("draggable","scroll",{start:function(){var a=d(this).data("draggable");
a.scrollParent[0]!=document&&"HTML"!=a.scrollParent[0].tagName&&(a.overflowOffset=a.scrollParent.offset())},drag:function(a){var k=d(this).data("draggable"),c=k.options,b=!1;if(k.scrollParent[0]!=document&&"HTML"!=k.scrollParent[0].tagName){if(!c.axis||"x"!=c.axis)k.overflowOffset.top+k.scrollParent[0].offsetHeight-a.pageY<c.scrollSensitivity?k.scrollParent[0].scrollTop=b=k.scrollParent[0].scrollTop+c.scrollSpeed:a.pageY-k.overflowOffset.top<c.scrollSensitivity&&(k.scrollParent[0].scrollTop=b=k.scrollParent[0].scrollTop-
c.scrollSpeed);if(!c.axis||"y"!=c.axis)k.overflowOffset.left+k.scrollParent[0].offsetWidth-a.pageX<c.scrollSensitivity?k.scrollParent[0].scrollLeft=b=k.scrollParent[0].scrollLeft+c.scrollSpeed:a.pageX-k.overflowOffset.left<c.scrollSensitivity&&(k.scrollParent[0].scrollLeft=b=k.scrollParent[0].scrollLeft-c.scrollSpeed)}else{if(!c.axis||"x"!=c.axis)a.pageY-d(document).scrollTop()<c.scrollSensitivity?b=d(document).scrollTop(d(document).scrollTop()-c.scrollSpeed):d(window).height()-(a.pageY-d(document).scrollTop())<
c.scrollSensitivity&&(b=d(document).scrollTop(d(document).scrollTop()+c.scrollSpeed));if(!c.axis||"y"!=c.axis)a.pageX-d(document).scrollLeft()<c.scrollSensitivity?b=d(document).scrollLeft(d(document).scrollLeft()-c.scrollSpeed):d(window).width()-(a.pageX-d(document).scrollLeft())<c.scrollSensitivity&&(b=d(document).scrollLeft(d(document).scrollLeft()+c.scrollSpeed))}!1!==b&&(d.ui.ddmanager&&!c.dropBehaviour)&&d.ui.ddmanager.prepareOffsets(k,a)}});d.ui.plugin.add("draggable","snap",{start:function(){var a=
d(this).data("draggable"),k=a.options;a.snapElements=[];d(k.snap.constructor!=String?k.snap.items||":data(draggable)":k.snap).each(function(){var c=d(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,k){for(var c=d(this).data("draggable"),b=c.options,f=b.snapTolerance,g=k.offset.left,j=g+c.helperProportions.width,m=k.offset.top,e=m+c.helperProportions.height,o=c.snapElements.length-1;0<=o;o--){var n=
c.snapElements[o].left,r=n+c.snapElements[o].width,p=c.snapElements[o].top,q=p+c.snapElements[o].height;if(n-f<g&&g<r+f&&p-f<m&&m<q+f||n-f<g&&g<r+f&&p-f<e&&e<q+f||n-f<j&&j<r+f&&p-f<m&&m<q+f||n-f<j&&j<r+f&&p-f<e&&e<q+f){if("inner"!=b.snapMode){var l=Math.abs(p-e)<=f,u=Math.abs(q-m)<=f,v=Math.abs(n-j)<=f,t=Math.abs(r-g)<=f;l&&(k.position.top=c._convertPositionTo("relative",{top:p-c.helperProportions.height,left:0}).top-c.margins.top);u&&(k.position.top=c._convertPositionTo("relative",{top:q,left:0}).top-
c.margins.top);v&&(k.position.left=c._convertPositionTo("relative",{top:0,left:n-c.helperProportions.width}).left-c.margins.left);t&&(k.position.left=c._convertPositionTo("relative",{top:0,left:r}).left-c.margins.left)}var x=l||u||v||t;if("outer"!=b.snapMode&&(l=Math.abs(p-m)<=f,u=Math.abs(q-e)<=f,v=Math.abs(n-g)<=f,t=Math.abs(r-j)<=f,l&&(k.position.top=c._convertPositionTo("relative",{top:p,left:0}).top-c.margins.top),u&&(k.position.top=c._convertPositionTo("relative",{top:q-c.helperProportions.height,
left:0}).top-c.margins.top),v&&(k.position.left=c._convertPositionTo("relative",{top:0,left:n}).left-c.margins.left),t))k.position.left=c._convertPositionTo("relative",{top:0,left:r-c.helperProportions.width}).left-c.margins.left;!c.snapElements[o].snapping&&(l||u||v||t||x)&&c.options.snap.snap&&c.options.snap.snap.call(c.element,a,d.extend(c._uiHash(),{snapItem:c.snapElements[o].item}));c.snapElements[o].snapping=l||u||v||t||x}else c.snapElements[o].snapping&&c.options.snap.release&&c.options.snap.release.call(c.element,
a,d.extend(c._uiHash(),{snapItem:c.snapElements[o].item})),c.snapElements[o].snapping=!1}}});d.ui.plugin.add("draggable","stack",{start:function(){var a=d(this).data("draggable").options,a=d.makeArray(d(a.stack)).sort(function(a,b){return(parseInt(d(a).css("zIndex"),10)||0)-(parseInt(d(b).css("zIndex"),10)||0)});if(a.length){var k=parseInt(a[0].style.zIndex)||0;d(a).each(function(a){this.style.zIndex=k+a});this[0].style.zIndex=k+a.length}}});d.ui.plugin.add("draggable","zIndex",{start:function(a,
k){var c=d(k.helper),b=d(this).data("draggable").options;c.css("zIndex")&&(b._zIndex=c.css("zIndex"));c.css("zIndex",b.zIndex)},stop:function(a,k){var c=d(this).data("draggable").options;c._zIndex&&d(k.helper).css("zIndex",c._zIndex)}})})(l);(function(d){d.widget("ui.droppable",{version:"1.9.0",widgetEventPrefix:"drop",options:{accept:"*",activeClass:!1,addClasses:!0,greedy:!1,hoverClass:!1,scope:"default",tolerance:"intersect"},_create:function(){var a=this.options,k=a.accept;this.isover=0;this.isout=
1;this.accept=d.isFunction(k)?k:function(a){return a.is(k)};this.proportions={width:this.element[0].offsetWidth,height:this.element[0].offsetHeight};d.ui.ddmanager.droppables[a.scope]=d.ui.ddmanager.droppables[a.scope]||[];d.ui.ddmanager.droppables[a.scope].push(this);a.addClasses&&this.element.addClass("ui-droppable")},_destroy:function(){for(var a=d.ui.ddmanager.droppables[this.options.scope],k=0;k<a.length;k++)a[k]==this&&a.splice(k,1);this.element.removeClass("ui-droppable ui-droppable-disabled")},
_setOption:function(a,k){"accept"==a&&(this.accept=d.isFunction(k)?k:function(a){return a.is(k)});d.Widget.prototype._setOption.apply(this,arguments)},_activate:function(a){var k=d.ui.ddmanager.current;this.options.activeClass&&this.element.addClass(this.options.activeClass);k&&this._trigger("activate",a,this.ui(k))},_deactivate:function(a){var k=d.ui.ddmanager.current;this.options.activeClass&&this.element.removeClass(this.options.activeClass);k&&this._trigger("deactivate",a,this.ui(k))},_over:function(a){var k=
d.ui.ddmanager.current;if(k&&(k.currentItem||k.element)[0]!=this.element[0])if(this.accept.call(this.element[0],k.currentItem||k.element))this.options.hoverClass&&this.element.addClass(this.options.hoverClass),this._trigger("over",a,this.ui(k))},_out:function(a){var k=d.ui.ddmanager.current;if(k&&(k.currentItem||k.element)[0]!=this.element[0])if(this.accept.call(this.element[0],k.currentItem||k.element))this.options.hoverClass&&this.element.removeClass(this.options.hoverClass),this._trigger("out",
a,this.ui(k))},_drop:function(a,k){var c=k||d.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=d.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)&&d.ui.intersect(c,d.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}}});d.ui.intersect=function(a,k,c){if(!k.offset)return!1;var b=(a.positionAbs||a.position.absolute).left,f=b+a.helperProportions.width,g=(a.positionAbs||a.position.absolute).top,
j=g+a.helperProportions.height,m=k.offset.left,e=m+k.proportions.width,o=k.offset.top,n=o+k.proportions.height;switch(c){case "fit":return m<=b&&f<=e&&o<=g&&j<=n;case "intersect":return m<b+a.helperProportions.width/2&&f-a.helperProportions.width/2<e&&o<g+a.helperProportions.height/2&&j-a.helperProportions.height/2<n;case "pointer":return d.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,
o,m,k.proportions.height,k.proportions.width);case "touch":return(g>=o&&g<=n||j>=o&&j<=n||g<o&&j>n)&&(b>=m&&b<=e||f>=m&&f<=e||b<m&&f>e);default:return!1}};d.ui.ddmanager={current:null,droppables:{"default":[]},prepareOffsets:function(a,k){var c=d.ui.ddmanager.droppables[a.options.scope]||[],b=k?k.type:null,f=(a.currentItem||a.element).find(":data(droppable)").andSelf(),g=0;a:for(;g<c.length;g++)if(!(c[g].options.disabled||a&&!c[g].accept.call(c[g].element[0],a.currentItem||a.element))){for(var j=
0;j<f.length;j++)if(f[j]==c[g].element[0]){c[g].proportions.height=0;continue a}c[g].visible="none"!=c[g].element.css("display");c[g].visible&&("mousedown"==b&&c[g]._activate.call(c[g],k),c[g].offset=c[g].element.offset(),c[g].proportions={width:c[g].element[0].offsetWidth,height:c[g].element[0].offsetHeight})}},drop:function(a,k){var c=!1;d.each(d.ui.ddmanager.droppables[a.options.scope]||[],function(){if(this.options&&(!this.options.disabled&&(this.visible&&d.ui.intersect(a,this,this.options.tolerance))&&
(c=this._drop.call(this,k)||c),!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,k)});return c},dragStart:function(a,k){a.element.parentsUntil("body").bind("scroll.droppable",function(){a.options.refreshPositions||d.ui.ddmanager.prepareOffsets(a,k)})},drag:function(a,k){a.options.refreshPositions&&d.ui.ddmanager.prepareOffsets(a,k);d.each(d.ui.ddmanager.droppables[a.options.scope]||[],function(){if(!this.options.disabled&&
!this.greedyChild&&this.visible){var c=d.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 f=this.options.scope,g=this.element.parents(":data(droppable)").filter(function(){return d.data(this,"droppable").options.scope===f});g.length&&(b=d.data(g[0],"droppable"),b.greedyChild="isover"==c?1:0)}b&&"isover"==c&&(b.isover=0,b.isout=1,b._out.call(b,k));this[c]=1;this["isout"==c?"isover":"isout"]=0;this["isover"==
c?"_over":"_out"].call(this,k);b&&"isout"==c&&(b.isout=0,b.isover=1,b._over.call(b,k))}}})},dragStop:function(a,k){a.element.parentsUntil("body").unbind("scroll.droppable");a.options.refreshPositions||d.ui.ddmanager.prepareOffsets(a,k)}}})(l);(function(d){d.widget("ui.resizable",d.ui.mouse,{version:"1.9.0",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");d.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)&&(this.element.wrap(d('<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||(!d(".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 f=this.handles.split(",");this.handles={};for(var g=0;g<f.length;g++){var j=d.trim(f[g]),m=d('<div class="ui-resizable-handle ui-resizable-'+j+'"></div>');m.css({zIndex:b.zIndex});"se"==j&&m.addClass("ui-icon ui-icon-gripsmall-diagonal-se");this.handles[j]=".ui-resizable-"+j;this.element.append(m)}}this._renderAxis=
function(a){var a=a||this.element,b;for(b in this.handles){this.handles[b].constructor==String&&(this.handles[b]=d(this.handles[b],this.element).show());if(this.elementIsWrapper&&this.originalElement[0].nodeName.match(/textarea|input|select|button/i)){var c=d(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()}d(this.handles[b])}};
this._renderAxis(this.element);this._handles=d(".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(),d(this.element).addClass("ui-resizable-autohide").mouseenter(function(){if(!b.disabled){d(this).removeClass("ui-resizable-autohide");a._handles.show()}}).mouseleave(function(){if(!b.disabled&&!a.resizing){d(this).addClass("ui-resizable-autohide");
a._handles.hide()}}));this._mouseInit()},_destroy:function(){this._mouseDestroy();var a=function(a){d(a).removeClass("ui-resizable ui-resizable-disabled ui-resizable-resizing").removeData("resizable").removeData("ui-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,f;for(f in this.handles)d(this.handles[f])[0]==a.target&&(b=!0);return!this.options.disabled&&b},_mouseStart:function(c){var b=this.options,f=this.element.position(),g=this.element;this.resizing=!0;this.documentScroll={top:d(document).scrollTop(),left:d(document).scrollLeft()};(g.is(".ui-draggable")||/absolute/.test(g.css("position")))&&g.css({position:"absolute",top:f.top,left:f.left});this._renderProxy();
var f=a(this.helper.css("left")),j=a(this.helper.css("top"));b.containment&&(f+=d(b.containment).scrollLeft()||0,j+=d(b.containment).scrollTop()||0);this.offset=this.helper.offset();this.position={left:f,top:j};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:f,top:j};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=d(".ui-resizable-"+this.axis).css("cursor");d("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,f=this.originalMousePosition,g=this._change[this.axis];if(!g)return!1;f=
g.apply(this,[a,a.pageX-f.left||0,a.pageY-f.top||0]);this._updateVirtualBoundaries(a.shiftKey);if(this._aspectRatio||a.shiftKey)f=this._updateRatio(f,a);f=this._respectSize(f,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(f);this._trigger("resize",a,this.ui());return!1},_mouseStop:function(a){this.resizing=
!1;var b=this.options;if(this._helper){var f=this._proportionallyResizeElements,g=f.length&&/textarea/i.test(f[0].nodeName),f=g&&d.ui.hasScroll(f[0],"left")?0:this.sizeDiff.height,g=g?0:this.sizeDiff.width,g={width:this.helper.width()-g,height:this.helper.height()-f},f=parseInt(this.element.css("left"),10)+(this.position.left-this.originalPosition.left)||null,j=parseInt(this.element.css("top"),10)+(this.position.top-this.originalPosition.top)||null;b.animate||this.element.css(d.extend(g,{top:j,left:f}));
this.helper.height(this.size.height);this.helper.width(this.size.width);this._helper&&!b.animate&&this._proportionallyResize()}d("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,f,g,j,b={minWidth:k(b.minWidth)?b.minWidth:0,maxWidth:k(b.maxWidth)?b.maxWidth:Infinity,minHeight:k(b.minHeight)?b.minHeight:0,maxHeight:k(b.maxHeight)?b.maxHeight:Infinity};
if(this._aspectRatio||a)if(a=b.minHeight*this.aspectRatio,g=b.minWidth/this.aspectRatio,f=b.maxHeight*this.aspectRatio,j=b.maxWidth/this.aspectRatio,a>b.minWidth&&(b.minWidth=a),g>b.minHeight&&(b.minHeight=g),f<b.maxWidth&&(b.maxWidth=f),j<b.maxHeight)b.maxHeight=j;this._vBoundaries=b},_updateCache:function(a){this.offset=this.helper.offset();k(a.left)&&(this.position.left=a.left);k(a.top)&&(this.position.top=a.top);k(a.height)&&(this.size.height=a.height);k(a.width)&&(this.size.width=a.width)},_updateRatio:function(a){var b=
this.position,f=this.size,g=this.axis;k(a.height)?a.width=a.height*this.aspectRatio:k(a.width)&&(a.height=a.width/this.aspectRatio);"sw"==g&&(a.left=b.left+(f.width-a.width),a.top=null);"nw"==g&&(a.top=b.top+(f.height-a.height),a.left=b.left+(f.width-a.width));return a},_respectSize:function(a){var b=this._vBoundaries,f=this.axis,g=k(a.width)&&b.maxWidth&&b.maxWidth<a.width,j=k(a.height)&&b.maxHeight&&b.maxHeight<a.height,m=k(a.width)&&b.minWidth&&b.minWidth>a.width,e=k(a.height)&&b.minHeight&&b.minHeight>
a.height;m&&(a.width=b.minWidth);e&&(a.height=b.minHeight);g&&(a.width=b.maxWidth);j&&(a.height=b.maxHeight);var d=this.originalPosition.left+this.originalSize.width,n=this.position.top+this.size.height,r=/sw|nw|w/.test(f),f=/nw|ne|n/.test(f);m&&r&&(a.left=d-b.minWidth);g&&r&&(a.left=d-b.maxWidth);e&&f&&(a.top=n-b.minHeight);j&&f&&(a.top=n-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 f=this._proportionallyResizeElements[b];if(!this.borderDif){var g=[f.css("borderTopWidth"),f.css("borderRightWidth"),f.css("borderBottomWidth"),f.css("borderLeftWidth")],j=[f.css("paddingTop"),f.css("paddingRight"),f.css("paddingBottom"),f.css("paddingLeft")];this.borderDif=d.map(g,function(a,b){var c=parseInt(a,10)||0,f=parseInt(j[b],10)||0;return c+f})}f.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||d('<div style="overflow:hidden;"></div>');var b=d.browser.msie&&7>d.browser.version,f=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-f+"px",top:this.elementOffset.top-f+"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,f){return{top:this.originalPosition.top+f,height:this.originalSize.height-f}},s:function(a,b,f){return{height:this.originalSize.height+f}},se:function(a,b,f){return d.extend(this._change.s.apply(this,arguments),this._change.e.apply(this,[a,b,f]))},sw:function(a,
b,f){return d.extend(this._change.s.apply(this,arguments),this._change.w.apply(this,[a,b,f]))},ne:function(a,b,f){return d.extend(this._change.n.apply(this,arguments),this._change.e.apply(this,[a,b,f]))},nw:function(a,b,f){return d.extend(this._change.n.apply(this,arguments),this._change.w.apply(this,[a,b,f]))}},_propagate:function(a,b){d.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}}});d.ui.plugin.add("resizable","alsoResize",{start:function(){var a=d(this).data("resizable").options,b=function(a){d(a).each(function(){var a=d(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)})})};"object"==typeof a.alsoResize&&!a.alsoResize.parentNode?a.alsoResize.length?
(a.alsoResize=a.alsoResize[0],b(a.alsoResize)):d.each(a.alsoResize,function(a){b(a)}):b(a.alsoResize)},resize:function(a,b){var f=d(this).data("resizable"),g=f.options,j=f.originalSize,m=f.originalPosition,e={height:f.size.height-j.height||0,width:f.size.width-j.width||0,top:f.position.top-m.top||0,left:f.position.left-m.left||0},k=function(a,c){d(a).each(function(){var a=d(this),f=d(this).data("resizable-alsoresize"),j={},g=c&&c.length?c:a.parents(b.originalElement[0]).length?["width","height"]:
["width","height","top","left"];d.each(g,function(a,b){var c=(f[b]||0)+(e[b]||0);c&&0<=c&&(j[b]=c||null)});a.css(j)})};"object"==typeof g.alsoResize&&!g.alsoResize.nodeType?d.each(g.alsoResize,function(a,b){k(a,b)}):k(g.alsoResize)},stop:function(){d(this).removeData("resizable-alsoresize")}});d.ui.plugin.add("resizable","animate",{stop:function(a){var b=d(this).data("resizable"),f=b.options,g=b._proportionallyResizeElements,j=g.length&&/textarea/i.test(g[0].nodeName),m=j&&d.ui.hasScroll(g[0],"left")?
0:b.sizeDiff.height,j={width:b.size.width-(j?0:b.sizeDiff.width),height:b.size.height-m},m=parseInt(b.element.css("left"),10)+(b.position.left-b.originalPosition.left)||null,e=parseInt(b.element.css("top"),10)+(b.position.top-b.originalPosition.top)||null;b.element.animate(d.extend(j,e&&m?{top:e,left:m}:{}),{duration:f.animateDuration,easing:f.animateEasing,step:function(){var e={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&&d(g[0]).css({width:e.width,height:e.height});b._updateCache(e);b._propagate("resize",a)}})}});d.ui.plugin.add("resizable","containment",{start:function(){var c=d(this).data("resizable"),b=c.element,f=c.options.containment;if(b=f instanceof d?f.get(0):/parent/.test(f)?b.parent().get(0):f)if(c.containerElement=d(b),/document/.test(f)||f==document)c.containerOffset={left:0,top:0},c.containerPosition={left:0,top:0},c.parentData={element:d(document),
left:0,top:0,width:d(document).width(),height:d(document).height()||document.body.parentNode.scrollHeight};else{var g=d(b),j=[];d(["Top","Right","Left","Bottom"]).each(function(b,c){j[b]=a(g.css("padding"+c))});c.containerOffset=g.offset();c.containerPosition=g.position();c.containerSize={height:g.innerHeight()-j[3],width:g.innerWidth()-j[1]};var f=c.containerOffset,m=c.containerSize.height,e=c.containerSize.width,e=d.ui.hasScroll(b,"left")?b.scrollWidth:e,m=d.ui.hasScroll(b)?b.scrollHeight:m;c.parentData=
{element:b,left:f.left,top:f.top,width:e,height:m}}},resize:function(a){var b=d(this).data("resizable"),f=b.options,g=b.containerOffset,j=b.position,a=b._aspectRatio||a.shiftKey,m={top:0,left:0},e=b.containerElement;e[0]!=document&&/static/.test(e.css("position"))&&(m=g);if(j.left<(b._helper?g.left:0))b.size.width+=b._helper?b.position.left-g.left:b.position.left-m.left,a&&(b.size.height=b.size.width/b.aspectRatio),b.position.left=f.helper?g.left:0;if(j.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*b.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;f=Math.abs(b.offset.left-m.left+b.sizeDiff.width);g=Math.abs((b._helper?b.offset.top-m.top:b.offset.top-g.top)+b.sizeDiff.height);j=b.containerElement.get(0)==b.element.parent().get(0);m=/relative|absolute/.test(b.containerElement.css("position"));j&&m&&(f-=b.parentData.left);f+b.size.width>=
b.parentData.width&&(b.size.width=b.parentData.width-f,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=d(this).data("resizable"),b=a.options,f=a.containerOffset,g=a.containerPosition,j=a.containerElement,m=d(a.helper),e=m.offset(),k=m.outerWidth()-a.sizeDiff.width,m=m.outerHeight()-a.sizeDiff.height;a._helper&&(!b.animate&&/relative/.test(j.css("position")))&&
d(this).css({left:e.left-g.left-f.left,width:k,height:m});a._helper&&(!b.animate&&/static/.test(j.css("position")))&&d(this).css({left:e.left-g.left-f.left,width:k,height:m})}});d.ui.plugin.add("resizable","ghost",{start:function(){var a=d(this).data("resizable"),b=a.options,f=a.size;a.ghost=a.originalElement.clone();a.ghost.css({opacity:0.25,display:"block",position:"relative",height:f.height,width:f.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=d(this).data("resizable");a.ghost&&a.ghost.css({position:"relative",height:a.size.height,width:a.size.width})},stop:function(){var a=d(this).data("resizable");a.ghost&&a.helper&&a.helper.get(0).removeChild(a.ghost.get(0))}});d.ui.plugin.add("resizable","grid",{resize:function(){var a=d(this).data("resizable"),b=a.options,f=a.size,g=a.originalSize,j=a.originalPosition,m=a.axis;b.grid="number"==typeof b.grid?[b.grid,b.grid]:b.grid;var e=Math.round((f.width-
g.width)/(b.grid[0]||1))*(b.grid[0]||1),b=Math.round((f.height-g.height)/(b.grid[1]||1))*(b.grid[1]||1);/^(se|s|e)$/.test(m)?(a.size.width=g.width+e,a.size.height=g.height+b):/^(ne)$/.test(m)?(a.size.width=g.width+e,a.size.height=g.height+b,a.position.top=j.top-b):(/^(sw)$/.test(m)?(a.size.width=g.width+e,a.size.height=g.height+b):(a.size.width=g.width+e,a.size.height=g.height+b,a.position.top=j.top-b),a.position.left=j.left-e)}});var a=function(a){return parseInt(a,10)||0},k=function(a){return!isNaN(parseInt(a,
10))}})(l);(function(d){d.widget("ui.selectable",d.ui.mouse,{version:"1.9.0",options:{appendTo:"body",autoRefresh:!0,distance:0,filter:"*",tolerance:"touch"},_create:function(){var a=this;this.element.addClass("ui-selectable");this.dragged=!1;var k;this.refresh=function(){k=d(a.options.filter,a.element[0]);k.addClass("ui-selectee");k.each(function(){var a=d(this),b=a.offset();d.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=k.addClass("ui-selectee");this._mouseInit();this.helper=d("<div class='ui-selectable-helper'></div>")},_destroy:function(){this.selectees.removeClass("ui-selectee").removeData("selectable-item");this.element.removeClass("ui-selectable ui-selectable-disabled");this._mouseDestroy()},_mouseStart:function(a){var k=this;this.opos=[a.pageX,
a.pageY];if(!this.options.disabled){var c=this.options;this.selectees=d(c.filter,this.element[0]);this._trigger("start",a);d(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=d.data(this,"selectable-item");b.startselected=!0;!a.metaKey&&!a.ctrlKey&&(b.$element.removeClass("ui-selected"),b.selected=!1,b.$element.addClass("ui-unselecting"),b.unselecting=!0,k._trigger("unselecting",
a,{unselecting:b.element}))});d(a.target).parents().andSelf().each(function(){var b=d.data(this,"selectable-item");if(b){var c=!a.metaKey&&!a.ctrlKey||!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)?k._trigger("selecting",a,{selecting:b.element}):k._trigger("unselecting",a,{unselecting:b.element});return!1}})}},_mouseDrag:function(a){var k=this;this.dragged=!0;if(!this.options.disabled){var c=
this.options,b=this.opos[0],f=this.opos[1],g=a.pageX,j=a.pageY;if(b>g)var m=g,g=b,b=m;f>j&&(m=j,j=f,f=m);this.helper.css({left:b,top:f,width:g-b,height:j-f});this.selectees.each(function(){var e=d.data(this,"selectable-item");if(e&&e.element!=k.element[0]){var m=false;c.tolerance=="touch"?m=!(e.left>g||e.right<b||e.top>j||e.bottom<f):c.tolerance=="fit"&&(m=e.left>b&&e.right<g&&e.top>f&&e.bottom<j);if(m){if(e.selected){e.$element.removeClass("ui-selected");e.selected=false}if(e.unselecting){e.$element.removeClass("ui-unselecting");
e.unselecting=false}if(!e.selecting){e.$element.addClass("ui-selecting");e.selecting=true;k._trigger("selecting",a,{selecting:e.element})}}else{if(e.selecting)if((a.metaKey||a.ctrlKey)&&e.startselected){e.$element.removeClass("ui-selecting");e.selecting=false;e.$element.addClass("ui-selected");e.selected=true}else{e.$element.removeClass("ui-selecting");e.selecting=false;if(e.startselected){e.$element.addClass("ui-unselecting");e.unselecting=true}k._trigger("unselecting",a,{unselecting:e.element})}if(e.selected&&
!a.metaKey&&!a.ctrlKey&&!e.startselected){e.$element.removeClass("ui-selected");e.selected=false;e.$element.addClass("ui-unselecting");e.unselecting=true;k._trigger("unselecting",a,{unselecting:e.element})}}}});return!1}},_mouseStop:function(a){var k=this;this.dragged=!1;d(".ui-unselecting",this.element[0]).each(function(){var c=d.data(this,"selectable-item");c.$element.removeClass("ui-unselecting");c.unselecting=!1;c.startselected=!1;k._trigger("unselected",a,{unselected:c.element})});d(".ui-selecting",
this.element[0]).each(function(){var c=d.data(this,"selectable-item");c.$element.removeClass("ui-selecting").addClass("ui-selected");c.selecting=!1;c.selected=!0;c.startselected=!0;k._trigger("selected",a,{selected:c.element})});this._trigger("stop",a);this.helper.remove();return!1}})})(l);(function(d){d.widget("ui.sortable",d.ui.mouse,{version:"1.9.0",widgetEventPrefix:"sort",ready:!1,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();this.ready=!0},_destroy:function(){this.element.removeClass("ui-sortable ui-sortable-disabled");this._mouseDestroy();for(var a=this.items.length-1;0<=a;a--)this.items[a].item.removeData(this.widgetName+"-item");return this},_setOption:function(a,k){"disabled"===a?(this.options[a]=k,this.widget().toggleClass("ui-sortable-disabled",!!k)):d.Widget.prototype._setOption.apply(this,arguments)},_mouseCapture:function(a,k){var c=this;if(this.reverting||this.options.disabled||"static"==this.options.type)return!1;
this._refreshItems(a);var b=null;d(a.target).parents().each(function(){if(d.data(this,c.widgetName+"-item")==c)return b=d(this),!1});d.data(a.target,c.widgetName+"-item")==c&&(b=d(a.target));if(!b)return!1;if(this.options.handle&&!k){var f=!1;d(this.options.handle,b).find("*").andSelf().each(function(){this==a.target&&(f=!0)});if(!f)return!1}this.currentItem=b;this._removeCurrentsFromItems();return!0},_mouseStart:function(a,k,c){k=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};d.extend(this.offset,{click:{left:a.pageX-this.offset.left,top:a.pageY-this.offset.top},parent:this._getParentOffset(),relative:this._getRelativeOffset()});this.helper.css("position","absolute");this.cssPosition=this.helper.css("position");this.originalPosition=
this._generatePosition(a);this.originalPageX=a.pageX;this.originalPageY=a.pageY;k.cursorAt&&this._adjustOffsetFromHelper(k.cursorAt);this.domPosition={prev:this.currentItem.prev()[0],parent:this.currentItem.parent()[0]};this.helper[0]!=this.currentItem[0]&&this.currentItem.hide();this._createPlaceholder();k.containment&&this._setContainment();k.cursor&&(d("body").css("cursor")&&(this._storedCursor=d("body").css("cursor")),d("body").css("cursor",k.cursor));k.opacity&&(this.helper.css("opacity")&&(this._storedOpacity=
this.helper.css("opacity")),this.helper.css("opacity",k.opacity));k.zIndex&&(this.helper.css("zIndex")&&(this._storedZIndex=this.helper.css("zIndex")),this.helper.css("zIndex",k.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));
d.ui.ddmanager&&(d.ui.ddmanager.current=this);d.ui.ddmanager&&!k.dropBehaviour&&d.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 k=this.options,c=!1;this.scrollParent[0]!=document&&"HTML"!=this.scrollParent[0].tagName?
(this.overflowOffset.top+this.scrollParent[0].offsetHeight-a.pageY<k.scrollSensitivity?this.scrollParent[0].scrollTop=c=this.scrollParent[0].scrollTop+k.scrollSpeed:a.pageY-this.overflowOffset.top<k.scrollSensitivity&&(this.scrollParent[0].scrollTop=c=this.scrollParent[0].scrollTop-k.scrollSpeed),this.overflowOffset.left+this.scrollParent[0].offsetWidth-a.pageX<k.scrollSensitivity)?this.scrollParent[0].scrollLeft=c=this.scrollParent[0].scrollLeft+k.scrollSpeed:a.pageX-this.overflowOffset.left<k.scrollSensitivity&&
(this.scrollParent[0].scrollLeft=c=this.scrollParent[0].scrollLeft-k.scrollSpeed):(a.pageY-d(document).scrollTop()<k.scrollSensitivity?c=d(document).scrollTop(d(document).scrollTop()-k.scrollSpeed):d(window).height()-(a.pageY-d(document).scrollTop())<k.scrollSensitivity&&(c=d(document).scrollTop(d(document).scrollTop()+k.scrollSpeed)),a.pageX-d(document).scrollLeft()<k.scrollSensitivity?c=d(document).scrollLeft(d(document).scrollLeft()-k.scrollSpeed):d(window).width()-(a.pageX-d(document).scrollLeft())<
k.scrollSensitivity&&(c=d(document).scrollLeft(d(document).scrollLeft()+k.scrollSpeed)));!1!==c&&(d.ui.ddmanager&&!k.dropBehaviour)&&d.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(k=this.items.length-1;0<=k;k--){var c=this.items[k],b=c.item[0],f=this._intersectsWithPointer(c);
if(f&&c.instance===this.currentContainer&&b!=this.currentItem[0]&&this.placeholder[1==f?"next":"prev"]()[0]!=b&&!d.contains(this.placeholder[0],b)&&("semi-dynamic"==this.options.type?!d.contains(this.element[0],b):1)){this.direction=1==f?"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);d.ui.ddmanager&&d.ui.ddmanager.drag(this,a);this._trigger("sort",a,this._uiHash());
this.lastPositionAbs=this.positionAbs;return!1},_mouseStop:function(a,k){if(a){d.ui.ddmanager&&!this.options.dropBehaviour&&d.ui.ddmanager.drop(this,a);if(this.options.revert){var c=this,b=this.placeholder.offset();this.reverting=!0;d(this.helper).animate({left:b.left-this.offset.parent.left-this.margins.left+(this.offsetParent[0]==document.body?0:this.offsetParent[0].scrollLeft),top:b.top-this.offset.parent.top-this.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,k);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(),d.extend(this,{helper:null,dragging:!1,reverting:!1,_noFinalSort:null}),this.domPosition.prev?d(this.domPosition.prev).after(this.currentItem):d(this.domPosition.parent).prepend(this.currentItem));return this},serialize:function(a){var k=this._getItemsAsjQuery(a&&a.connected),c=[],a=a||
{};d(k).each(function(){var b=(d(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 k=this._getItemsAsjQuery(a&&a.connected),c=[],a=a||{};k.each(function(){c.push(d(a.item||this).attr(a.attribute||"id")||"")});return c},_intersectsWith:function(a){var k=this.positionAbs.left,c=k+this.helperProportions.width,b=this.positionAbs.top,
f=b+this.helperProportions.height,g=a.left,j=g+a.width,m=a.top,e=m+a.height,d=this.offset.click.top,n=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+d>m&&b+d<e&&k+n>g&&k+n<j:g<k+this.helperProportions.width/2&&c-this.helperProportions.width/2<j&&m<b+this.helperProportions.height/2&&f-this.helperProportions.height/2<e},
_intersectsWithPointer:function(a){var k="x"===this.options.axis||d.ui.isOverAxis(this.positionAbs.top+this.offset.click.top,a.top,a.height),a="y"===this.options.axis||d.ui.isOverAxis(this.positionAbs.left+this.offset.click.left,a.left,a.width),k=k&&a,a=this._getDragVerticalDirection(),c=this._getDragHorizontalDirection();return!k?!1:this.floating?c&&"right"==c||"down"==a?2:1:a&&("down"==a?2:1)},_intersectsWithSides:function(a){var k=d.ui.isOverAxis(this.positionAbs.top+this.offset.click.top,a.top+
a.height/2,a.height),a=d.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&&k||"up"==c&&!k)},_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 k=[],c=[],b=this._connectWith();if(b&&a)for(a=b.length-1;0<=a;a--)for(var f=d(b[a]),g=f.length-1;0<=g;g--){var j=d.data(f[g],this.widgetName);j&&(j!=this&&!j.options.disabled)&&c.push([d.isFunction(j.options.items)?j.options.items.call(j.element):d(j.options.items,
j.element).not(".ui-sortable-helper").not(".ui-sortable-placeholder"),j])}c.push([d.isFunction(this.options.items)?this.options.items.call(this.element,null,{options:this.options,item:this.currentItem}):d(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(){k.push(this)});return d(k)},_removeCurrentsFromItems:function(){for(var a=this.currentItem.find(":data("+this.widgetName+"-item)"),k=0;k<this.items.length;k++)for(var c=
0;c<a.length;c++)a[c]==this.items[k].item[0]&&this.items.splice(k,1)},_refreshItems:function(a){this.items=[];this.containers=[this];var k=this.items,c=[[d.isFunction(this.options.items)?this.options.items.call(this.element[0],a,{item:this.currentItem}):d(this.options.items,this.element),this]],b=this._connectWith();if(b&&this.ready)for(var f=b.length-1;0<=f;f--)for(var g=d(b[f]),j=g.length-1;0<=j;j--){var m=d.data(g[j],this.widgetName);m&&(m!=this&&!m.options.disabled)&&(c.push([d.isFunction(m.options.items)?
m.options.items.call(m.element[0],a,{item:this.currentItem}):d(m.options.items,m.element),m]),this.containers.push(m))}for(f=c.length-1;0<=f;f--){a=c[f][1];b=c[f][0];j=0;for(g=b.length;j<g;j++)m=d(b[j]),m.data(this.widgetName+"-item",a),k.push({item:m,instance:a,width:0,height:0,left:0,top:0})}},refreshPositions:function(a){this.offsetParent&&this.helper&&(this.offset.parent=this._getParentOffset());for(var k=this.items.length-1;0<=k;k--){var c=this.items[k];if(!(c.instance!=this.currentContainer&&
this.currentContainer&&c.item[0]!=this.currentItem[0])){var b=this.options.toleranceElement?d(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(k=this.containers.length-1;0<=k;k--)b=this.containers[k].element.offset(),this.containers[k].containerCache.left=b.left,this.containers[k].containerCache.top=
b.top,this.containers[k].containerCache.width=this.containers[k].element.outerWidth(),this.containers[k].containerCache.height=this.containers[k].element.outerHeight();return this},_createPlaceholder:function(a){var a=a||this,k=a.options;if(!k.placeholder||k.placeholder.constructor==String){var c=k.placeholder;k.placeholder={element:function(){var b=d(document.createElement(a.currentItem[0].nodeName)).addClass(c||a.currentItem[0].className+" ui-sortable-placeholder").removeClass("ui-sortable-helper")[0];
c||(b.style.visibility="hidden");return b},update:function(b,f){if(!c||k.forcePlaceholderSize)f.height()||f.height(a.currentItem.innerHeight()-parseInt(a.currentItem.css("paddingTop")||0,10)-parseInt(a.currentItem.css("paddingBottom")||0,10)),f.width()||f.width(a.currentItem.innerWidth()-parseInt(a.currentItem.css("paddingLeft")||0,10)-parseInt(a.currentItem.css("paddingRight")||0,10))}}}a.placeholder=d(k.placeholder.element.call(a.element,a.currentItem));a.currentItem.after(a.placeholder);k.placeholder.update(a,
a.placeholder)},_contactContainers:function(a){for(var k=null,c=null,b=this.containers.length-1;0<=b;b--)if(!d.contains(this.currentItem[0],this.containers[b].element[0]))if(this._intersectsWith(this.containers[b].containerCache)){if(!k||!d.contains(this.containers[b].element[0],k.element[0]))k=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(k)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 k=1E4,b=null,f=this.positionAbs[this.containers[c].floating?"left":"top"],g=this.items.length-1;0<=g;g--)if(d.contains(this.containers[c].element[0],this.items[g].item[0])){var j=this.containers[c].floating?this.items[g].item.offset().left:this.items[g].item.offset().top;Math.abs(j-f)<k&&(k=Math.abs(j-f),b=this.items[g],this.direction=0<j-f?"down":"up")}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 k=this.options,a=d.isFunction(k.helper)?d(k.helper.apply(this.element[0],[a,this.currentItem])):
"clone"==k.helper?this.currentItem.clone():this.currentItem;a.parents("body").length||d("parent"!=k.appendTo?k.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||k.forceHelperSize)&&a.width(this.currentItem.width());(""==a[0].style.height||
k.forceHelperSize)&&a.height(this.currentItem.height());return a},_adjustOffsetFromHelper:function(a){"string"==typeof a&&(a=a.split(" "));d.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&&d.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()&&d.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,d("document"==a.containment?document:window).width()-this.helperProportions.width-this.margins.left,(d("document"==a.containment?document:window).height()||
document.body.parentNode.scrollHeight)-this.helperProportions.height-this.margins.top];if(!/^(document|window|parent)$/.test(a.containment)){var k=d(a.containment)[0],a=d(a.containment).offset(),c="hidden"!=d(k).css("overflow");this.containment=[a.left+(parseInt(d(k).css("borderLeftWidth"),10)||0)+(parseInt(d(k).css("paddingLeft"),10)||0)-this.margins.left,a.top+(parseInt(d(k).css("borderTopWidth"),10)||0)+(parseInt(d(k).css("paddingTop"),10)||0)-this.margins.top,a.left+(c?Math.max(k.scrollWidth,
k.offsetWidth):k.offsetWidth)-(parseInt(d(k).css("borderLeftWidth"),10)||0)-(parseInt(d(k).css("paddingRight"),10)||0)-this.helperProportions.width-this.margins.left,a.top+(c?Math.max(k.scrollHeight,k.offsetHeight):k.offsetHeight)-(parseInt(d(k).css("borderTopWidth"),10)||0)-(parseInt(d(k).css("paddingBottom"),10)||0)-this.helperProportions.height-this.margins.top]}},_convertPositionTo:function(a,k){k||(k=this.position);var c="absolute"==a?1:-1,b="absolute"==this.cssPosition&&!(this.scrollParent[0]!=
document&&d.contains(this.scrollParent[0],this.offsetParent[0]))?this.offsetParent:this.scrollParent,f=/(html|body)/i.test(b[0].tagName);return{top:k.top+this.offset.relative.top*c+this.offset.parent.top*c-("fixed"==this.cssPosition?-this.scrollParent.scrollTop():f?0:b.scrollTop())*c,left:k.left+this.offset.relative.left*c+this.offset.parent.left*c-("fixed"==this.cssPosition?-this.scrollParent.scrollLeft():f?0:b.scrollLeft())*c}},_generatePosition:function(a){var k=this.options,c="absolute"==this.cssPosition&&
!(this.scrollParent[0]!=document&&d.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 f=a.pageX,g=a.pageY;if(this.originalPosition&&(this.containment&&(a.pageX-this.offset.click.left<this.containment[0]&&(f=this.containment[0]+this.offset.click.left),a.pageY-this.offset.click.top<
this.containment[1]&&(g=this.containment[1]+this.offset.click.top),a.pageX-this.offset.click.left>this.containment[2]&&(f=this.containment[2]+this.offset.click.left),a.pageY-this.offset.click.top>this.containment[3]&&(g=this.containment[3]+this.offset.click.top)),k.grid))g=this.originalPageY+Math.round((g-this.originalPageY)/k.grid[1])*k.grid[1],g=this.containment?!(g-this.offset.click.top<this.containment[1]||g-this.offset.click.top>this.containment[3])?g:!(g-this.offset.click.top<this.containment[1])?
g-k.grid[1]:g+k.grid[1]:g,f=this.originalPageX+Math.round((f-this.originalPageX)/k.grid[0])*k.grid[0],f=this.containment?!(f-this.offset.click.left<this.containment[0]||f-this.offset.click.left>this.containment[2])?f:!(f-this.offset.click.left<this.containment[0])?f-k.grid[0]:f+k.grid[0]:f;return{top:g-this.offset.click.top-this.offset.relative.top-this.offset.parent.top+("fixed"==this.cssPosition?-this.scrollParent.scrollTop():b?0:c.scrollTop()),left:f-this.offset.click.left-this.offset.relative.left-
this.offset.parent.left+("fixed"==this.cssPosition?-this.scrollParent.scrollLeft():b?0:c.scrollLeft())}},_rearrange:function(a,k,c,b){c?c[0].appendChild(this.placeholder[0]):k.item[0].parentNode.insertBefore(this.placeholder[0],"down"==this.direction?k.item[0]:k.item[0].nextSibling);var f=this.counter=this.counter?++this.counter:1;this._delay(function(){f==this.counter&&this.refreshPositions(!b)})},_clear:function(a,k){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&&!k&&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])&&!k&&c.push(function(a){this._trigger("update",a,this._uiHash())});this!==this.currentContainer&&!k&&(c.push(function(a){this._trigger("remove",a,this._uiHash())}),c.push(function(a){return function(b){a._trigger("receive",b,this._uiHash(this))}}.call(this,this.currentContainer)),c.push(function(a){return function(b){a._trigger("update",b,this._uiHash(this))}}.call(this,this.currentContainer)));for(b=this.containers.length-1;0<=b;b--)k||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&&d("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(!k){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 this.fromOutside=!1}k||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(!k){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===d.Widget.prototype._trigger.apply(this,arguments)&&
this.cancel()},_uiHash:function(a){var k=a||this;return{helper:k.helper,placeholder:k.placeholder||d([]),position:k.position,originalPosition:k.originalPosition,offset:k.positionAbs,item:k.currentItem,sender:a?a.element:null}}})})(l);(function(d){var a=0,k={},c={};k.height=k.paddingTop=k.paddingBottom=k.borderTopWidth=k.borderBottomWidth="hide";c.height=c.paddingTop=c.paddingBottom=c.borderTopWidth=c.borderBottomWidth="show";d.widget("ui.accordion",{version:"1.9.0",options:{active:0,animate:{},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 b=this.accordionId="ui-accordion-"+(this.element.attr("id")||++a),c=this.options;this.prevShow=this.prevHide=d();this.element.addClass("ui-accordion ui-widget ui-helper-reset");this.headers=this.element.find(c.header).addClass("ui-accordion-header ui-helper-reset ui-state-default ui-corner-all");
this._hoverable(this.headers);this._focusable(this.headers);this.headers.next().addClass("ui-accordion-content ui-helper-reset ui-widget-content ui-corner-bottom").hide();!c.collapsible&&!1===c.active&&(c.active=0);0>c.active&&(c.active+=this.headers.length);this.active=this._findActive(c.active).addClass("ui-accordion-header-active ui-state-active").toggleClass("ui-corner-all ui-corner-top");this.active.next().addClass("ui-accordion-content-active").show();this._createIcons();this.originalHeight=
this.element[0].style.height;this.refresh();this.element.attr("role","tablist");this.headers.attr("role","tab").each(function(a){var c=d(this),f=c.attr("id"),e=c.next(),k=e.attr("id");if(!f){f=b+"-header-"+a;c.attr("id",f)}if(!k){k=b+"-panel-"+a;e.attr("id",k)}c.attr("aria-controls",k);e.attr("aria-labelledby",f)}).next().attr("role","tabpanel");this.headers.not(this.active).attr({"aria-selected":"false",tabIndex:-1}).next().attr({"aria-expanded":"false","aria-hidden":"true"}).hide();this.active.length?
this.active.attr({"aria-selected":"true",tabIndex:0}).next().attr({"aria-expanded":"true","aria-hidden":"false"}):this.headers.eq(0).attr("tabIndex",0);this._on(this.headers,{keydown:"_keydown"});this._on(this.headers.next(),{keydown:"_panelKeyDown"});this._setupEvents(c.event)},_getCreateEventData:function(){return{header:this.active,content:!this.active.length?d():this.active.next()}},_createIcons:function(){var a=this.options.icons;a&&(d("<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.headers.addClass("ui-accordion-icons"))},_destroyIcons:function(){this.headers.removeClass("ui-accordion-icons").children(".ui-accordion-header-icon").remove()},_destroy:function(){var a;this.element.removeClass("ui-accordion ui-widget ui-helper-reset").removeAttr("role");this.headers.removeClass("ui-accordion-header ui-accordion-header-active ui-helper-reset ui-state-default ui-corner-all ui-state-active ui-state-disabled ui-corner-top").removeAttr("role").removeAttr("aria-selected").removeAttr("aria-controls").removeAttr("tabIndex").each(function(){/^ui-accordion/.test(this.id)&&
this.removeAttribute("id")});this._destroyIcons();a=this.headers.next().css("display","").removeAttr("role").removeAttr("aria-expanded").removeAttr("aria-hidden").removeAttr("aria-labelledby").removeClass("ui-helper-reset ui-widget-content ui-corner-bottom ui-accordion-content ui-accordion-content-active ui-state-disabled").each(function(){/^ui-accordion/.test(this.id)&&this.removeAttribute("id")});"content"!==this.options.heightStyle&&(this.element.css("height",this.originalHeight),a.css("height",
""))},_setOption:function(a,c){"active"===a?this._activate(c):("event"===a&&(this.options.event&&this._off(this.headers,this.options.event),this._setupEvents(c)),this._super(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-state-disabled",!!c))},_keydown:function(a){if(!a.altKey&&!a.ctrlKey){var c=d.ui.keyCode,g=this.headers.length,j=this.headers.index(a.target),
m=!1;switch(a.keyCode){case c.RIGHT:case c.DOWN:m=this.headers[(j+1)%g];break;case c.LEFT:case c.UP:m=this.headers[(j-1+g)%g];break;case c.SPACE:case c.ENTER:this._eventHandler(a);break;case c.HOME:m=this.headers[0];break;case c.END:m=this.headers[g-1]}m&&(d(a.target).attr("tabIndex",-1),d(m).attr("tabIndex",0),m.focus(),a.preventDefault())}},_panelKeyDown:function(a){a.keyCode===d.ui.keyCode.UP&&a.ctrlKey&&d(a.currentTarget).prev().focus()},refresh:function(){var a,c,g=this.options.heightStyle,j=
this.element.parent();this.element.css("height",this.originalHeight);"fill"===g?(d.support.minHeight||(c=j.css("overflow"),j.css("overflow","hidden")),a=j.height(),this.element.siblings(":visible").each(function(){var c=d(this),e=c.css("position");e==="absolute"||e==="fixed"||(a=a-c.outerHeight(true))}),c&&j.css("overflow",c),this.headers.each(function(){a=a-d(this).outerHeight(true)}),this.headers.next().each(function(){d(this).height(Math.max(0,a-d(this).innerHeight()+d(this).height()))}).css("overflow",
"auto")):"auto"===g&&(a=0,this.headers.next().each(function(){a=Math.max(a,d(this).height("").height())}).height(a));"content"!==g&&this.element.height(this.element.height())},_activate:function(a){a=this._findActive(a)[0];a!==this.active[0]&&(a=a||this.active[0],this._eventHandler({target:a,currentTarget:a,preventDefault:d.noop}))},_findActive:function(a){return"number"===typeof a?this.headers.eq(a):d()},_setupEvents:function(a){var c={};a&&(d.each(a.split(" "),function(a,b){c[b]="_eventHandler"}),
this._on(this.headers,c))},_eventHandler:function(a){var c=this.options,g=this.active,j=d(a.currentTarget),m=j[0]===g[0],e=m&&c.collapsible,k=e?d():j.next(),n=g.next(),k={oldHeader:g,oldPanel:n,newHeader:e?d():j,newPanel:k};a.preventDefault();m&&!c.collapsible||!1===this._trigger("beforeActivate",a,k)||(c.active=e?!1:this.headers.index(j),this.active=m?d():j,this._toggle(k),g.removeClass("ui-accordion-header-active ui-state-active"),c.icons&&g.children(".ui-accordion-header-icon").removeClass(c.icons.activeHeader).addClass(c.icons.header),
m||(j.removeClass("ui-corner-all").addClass("ui-accordion-header-active ui-state-active ui-corner-top"),c.icons&&j.children(".ui-accordion-header-icon").removeClass(c.icons.header).addClass(c.icons.activeHeader),j.next().addClass("ui-accordion-content-active")))},_toggle:function(a){var c=a.newPanel,g=this.prevShow.length?this.prevShow:a.oldPanel;this.prevShow.add(this.prevHide).stop(!0,!0);this.prevShow=c;this.prevHide=g;this.options.animate?this._animate(c,g,a):(g.hide(),c.show(),this._toggleComplete(a));
g.attr({"aria-expanded":"false","aria-hidden":"true"});g.prev().attr("aria-selected","false");c.length&&g.length?g.prev().attr("tabIndex",-1):c.length&&this.headers.filter(function(){return d(this).attr("tabIndex")===0}).attr("tabIndex",-1);c.attr({"aria-expanded":"true","aria-hidden":"false"}).prev().attr({"aria-selected":"true",tabIndex:0})},_animate:function(a,f,g){var j,m,e,d=this,n=0,r=this.options.animate||{},p=a.length&&(!f.length||a.index()<f.index())&&r.down||r,q=function(){d._toggleComplete(g)};
"number"===typeof p&&(e=p);"string"===typeof p&&(m=p);m=m||p.easing||r.easing;e=e||p.duration||r.duration;if(!f.length)return a.animate(c,e,m,q);if(!a.length)return f.animate(k,e,m,q);j=a.show().outerHeight();f.animate(k,{duration:e,easing:m,step:function(a,b){b.now=Math.round(a)}});a.hide().animate(c,{duration:e,easing:m,complete:q,step:function(a,b){b.now=Math.round(a);"height"!==b.prop?n+=b.now:"content"!==d.options.heightStyle&&(b.now=Math.round(j-f.outerHeight()-n),n=0)}})},_toggleComplete:function(a){var c=
a.oldPanel;c.removeClass("ui-accordion-content-active").prev().removeClass("ui-corner-top").addClass("ui-corner-all");c.length&&(c.parent()[0].className=c.parent()[0].className);this._trigger("activate",null,a)}});!1!==d.uiBackCompat&&(function(a,c){a.extend(c.options,{navigation:!1,navigationFilter:function(){return this.href.toLowerCase()===location.href.toLowerCase()}});var g=c._create;c._create=function(){if(this.options.navigation){var c=this,f=this.element.find(this.options.header),e=f.next(),
k=f.add(e).find("a").filter(this.options.navigationFilter)[0];k&&f.add(e).each(function(e){if(a.contains(this,k))return c.options.active=Math.floor(e/2),!1})}g.call(this)}}(l,l.ui.accordion.prototype),function(a,c){a.extend(c.options,{heightStyle:null,autoHeight:!0,clearStyle:!1,fillSpace:!1});var g=c._create,j=c._setOption;a.extend(c,{_create:function(){this.options.heightStyle=this.options.heightStyle||this._mergeHeightStyle();g.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"}})}(l,l.ui.accordion.prototype),function(a,c){a.extend(c.options.icons,{activeHeader:null,headerSelected:"ui-icon-triangle-1-s"});var g=c._createIcons;c._createIcons=function(){this.options.icons&&(this.options.icons.activeHeader=this.options.icons.activeHeader||this.options.icons.headerSelected);
g.call(this)}}(l,l.ui.accordion.prototype),function(a,c){c.activate=c._activate;var g=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 g.call(this,a)}}(l,l.ui.accordion.prototype),l.ui.accordion.prototype.resize=l.ui.accordion.prototype.refresh,function(a,c){a.extend(c.options,{change:null,changestart:null});var g=c._trigger;c._trigger=function(a,b,c){var f=g.apply(this,arguments);if(!f)return!1;"beforeActivate"===
a?f=g.call(this,"changestart",b,{oldHeader:c.oldHeader,oldContent:c.oldPanel,newHeader:c.newHeader,newContent:c.newPanel}):"activate"===a&&(f=g.call(this,"change",b,{oldHeader:c.oldHeader,oldContent:c.oldPanel,newHeader:c.newHeader,newContent:c.newPanel}));return f}}(l,l.ui.accordion.prototype),function(a,c){a.extend(c.options,{animate:null,animated:"slide"});var g=c._create;c._create=function(){var a=this.options;null===a.animate&&(a.animate=a.animated?"slide"===a.animated?300:"bounceslide"===a.animated?
{duration:200,down:{easing:"easeOutBounce",duration:1E3}}:a.animated:!1);g.call(this)}}(l,l.ui.accordion.prototype))})(l);(function(d){var a=0;d.widget("ui.autocomplete",{version:"1.9.0",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,c,b;this.isMultiLine=this._isMultiLine();
this.valueMethod=this.element[this.element.is("input,textarea")?"val":"text"];this.isNewMenu=!0;this.element.addClass("ui-autocomplete-input").attr("autocomplete","off");this._on({keydown:function(f){if(this.element.prop("readOnly"))c=b=a=!0;else{c=b=a=!1;var g=d.ui.keyCode;switch(f.keyCode){case g.PAGE_UP:a=!0;this._move("previousPage",f);break;case g.PAGE_DOWN:a=!0;this._move("nextPage",f);break;case g.UP:a=!0;this._keyEvent("previous",f);break;case g.DOWN:a=!0;this._keyEvent("next",f);break;case g.ENTER:case g.NUMPAD_ENTER:this.menu.active&&
(a=!0,f.preventDefault(),this.menu.select(f));break;case g.TAB:this.menu.active&&this.menu.select(f);break;case g.ESCAPE:this.menu.element.is(":visible")&&(this._value(this.term),this.close(f),f.preventDefault());break;default:c=!0,this._searchTimeout(f)}}},keypress:function(b){if(a)a=!1,b.preventDefault();else if(!c){var g=d.ui.keyCode;switch(b.keyCode){case g.PAGE_UP:this._move("previousPage",b);break;case g.PAGE_DOWN:this._move("nextPage",b);break;case g.UP:this._keyEvent("previous",b);break;case g.DOWN:this._keyEvent("next",
b)}}},input:function(a){b?(b=!1,a.preventDefault()):this._searchTimeout(a)},focus:function(){this.selectedItem=null;this.previous=this._value()},blur:function(a){this.cancelBlur?delete this.cancelBlur:(clearTimeout(this.searching),this.close(a),this._change(a))}});this._initSource();this.menu=d("<ul>").addClass("ui-autocomplete").appendTo(this.document.find(this.options.appendTo||"body")[0]).menu({input:d(),role:null}).zIndex(this.element.zIndex()+1).hide().data("menu");this._on(this.menu.element,
{mousedown:function(a){a.preventDefault();this.cancelBlur=!0;this._delay(function(){delete this.cancelBlur});var b=this.menu.element[0];d(a.target).closest(".ui-menu-item").length||this._delay(function(){var a=this;this.document.one("mousedown",function(c){c.target!==a.element[0]&&(c.target!==b&&!d.contains(b,c.target))&&a.close()})})},menufocus:function(a,b){if(this.isNewMenu&&(this.isNewMenu=!1,a.originalEvent&&/^mouse/.test(a.originalEvent.type))){this.menu.blur();this.document.one("mousemove",
function(){d(a.target).trigger(a.originalEvent)});return}var c=b.item.data("ui-autocomplete-item")||b.item.data("item.autocomplete");!1!==this._trigger("focus",a,{item:c})?a.originalEvent&&/^key/.test(a.originalEvent.type)&&this._value(c.value):this.liveRegion.text(c.value)},menuselect:function(a,b){var c=b.item.data("ui-autocomplete-item")||b.item.data("item.autocomplete"),m=this.previous;this.element[0]!==this.document[0].activeElement&&(this.element.focus(),this.previous=m,this._delay(function(){this.previous=
m;this.selectedItem=c}));!1!==this._trigger("select",a,{item:c})&&this._value(c.value);this.term=this._value();this.close(a);this.selectedItem=c}});this.liveRegion=d("<span>",{role:"status","aria-live":"polite"}).addClass("ui-helper-hidden-accessible").insertAfter(this.element);d.fn.bgiframe&&this.menu.element.bgiframe();this._on(this.window,{beforeunload:function(){this.element.removeAttr("autocomplete")}})},_destroy:function(){clearTimeout(this.searching);this.element.removeClass("ui-autocomplete-input").removeAttr("autocomplete");
this.menu.element.remove();this.liveRegion.remove()},_setOption:function(a,c){this._super(a,c);"source"===a&&this._initSource();"appendTo"===a&&this.menu.element.appendTo(this.document.find(c||"body")[0]);"disabled"===a&&(c&&this.xhr)&&this.xhr.abort()},_isMultiLine:function(){return this.element.is("textarea")?!0:this.element.is("input")?!1:this.element.prop("isContentEditable")},_initSource:function(){var a,c,b=this;d.isArray(this.options.source)?(a=this.options.source,this.source=function(b,c){c(d.ui.autocomplete.filter(a,
b.term))}):"string"===typeof this.options.source?(c=this.options.source,this.source=function(a,g){b.xhr&&b.xhr.abort();b.xhr=d.ajax({url:c,data:a,dataType:"json",success:function(a){g(a)},error:function(){g([])}})}):this.source=this.options.source},_searchTimeout:function(a){clearTimeout(this.searching);this.searching=this._delay(function(){this.term!==this._value()&&(this.selectedItem=null,this.search(null,a))},this.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);if(!1!==this._trigger("search",c))return this._search(a)},_search:function(a){this.pending++;this.element.addClass("ui-autocomplete-loading");this.cancelSearch=!1;this.source({term:a},this._response())},_response:function(){var k=this,c=++a;return function(b){c===a&&k.__response(b);k.pending--;k.pending||k.element.removeClass("ui-autocomplete-loading")}},__response:function(a){a&&(a=this._normalize(a));this._trigger("response",null,{content:a});
!this.options.disabled&&a&&a.length&&!this.cancelSearch?(this._suggest(a),this._trigger("open")):this._close()},close:function(a){this.cancelSearch=!0;this._close(a)},_close:function(a){this.menu.element.is(":visible")&&(this.menu.element.hide(),this.menu.blur(),this.isNewMenu=!0,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:d.map(a,function(a){return"string"===
typeof a?{label:a,value:a}:d.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.refresh();c.show();this._resizeMenu();c.position(d.extend({of:this.element},this.options.position));this.options.autoFocus&&this.menu.next()},_resizeMenu:function(){var a=this.menu.element;a.outerWidth(Math.max(a.width("").outerWidth()+1,this.element.outerWidth()))},_renderMenu:function(a,c){var b=
this;d.each(c,function(c,g){b._renderItemData(a,g)})},_renderItemData:function(a,c){return this._renderItem(a,c).data("ui-autocomplete-item",c)},_renderItem:function(a,c){return d("<li>").append(d("<a>").text(c.label)).appendTo(a)},_move:function(a,c){if(this.menu.element.is(":visible"))if(this.menu.isFirstItem()&&/^previous/.test(a)||this.menu.isLastItem()&&/^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)},_keyEvent:function(a,c){if(!this.isMultiLine||this.menu.element.is(":visible"))this._move(a,c),c.preventDefault()}});d.extend(d.ui.autocomplete,{escapeRegex:function(a){return a.replace(/[\-\[\]{}()*+?.,\\\^$|#\s]/g,"\\$&")},filter:function(a,c){var b=RegExp(d.ui.autocomplete.escapeRegex(c),"i");return d.grep(a,function(a){return b.test(a.label||a.value||a)})}});d.widget("ui.autocomplete",d.ui.autocomplete,{options:{messages:{noResults:"No search results.",
results:function(a){return a+(1<a?" results are":" result is")+" available, use up and down arrow keys to navigate."}}},__response:function(a){var c;this._superApply(arguments);!this.options.disabled&&!this.cancelSearch&&(c=a&&a.length?this.options.messages.results(a.length):this.options.messages.noResults,this.liveRegion.text(c))}})})(l);(function(d){var a,k,c,b,f=function(){var a=d(this).find(":ui-button");setTimeout(function(){a.button("refresh")},1)},g=function(a){var b=a.name,c=a.form,f=d([]);
b&&(f=c?d(c).find("[name='"+b+"']"):d("[name='"+b+"']",a.ownerDocument).filter(function(){return!this.form}));return f};d.widget("ui.button",{version:"1.9.0",defaultElement:"<button>",options:{disabled:null,text:!0,label:null,icons:{primary:null,secondary:null}},_create:function(){this.element.closest("form").unbind("reset"+this.eventNamespace).bind("reset"+this.eventNamespace,f);"boolean"!==typeof this.options.disabled?this.options.disabled=!!this.element.prop("disabled"):this.element.prop("disabled",
this.options.disabled);this._determineButtonType();this.hasTitle=!!this.buttonElement.attr("title");var j=this,m=this.options,e="checkbox"===this.type||"radio"===this.type,o="ui-state-hover"+(!e?" ui-state-active":"");null===m.label&&(m.label="input"===this.type?this.buttonElement.val():this.buttonElement.html());this.buttonElement.addClass("ui-button ui-widget ui-state-default ui-corner-all").attr("role","button").bind("mouseenter"+this.eventNamespace,function(){if(!m.disabled){d(this).addClass("ui-state-hover");
this===a&&d(this).addClass("ui-state-active")}}).bind("mouseleave"+this.eventNamespace,function(){m.disabled||d(this).removeClass(o)}).bind("click"+this.eventNamespace,function(a){if(m.disabled){a.preventDefault();a.stopImmediatePropagation()}});this.element.bind("focus"+this.eventNamespace,function(){j.buttonElement.addClass("ui-state-focus")}).bind("blur"+this.eventNamespace,function(){j.buttonElement.removeClass("ui-state-focus")});e&&(this.element.bind("change"+this.eventNamespace,function(){b||
j.refresh()}),this.buttonElement.bind("mousedown"+this.eventNamespace,function(a){if(!m.disabled){b=false;k=a.pageX;c=a.pageY}}).bind("mouseup"+this.eventNamespace,function(a){if(!m.disabled&&(k!==a.pageX||c!==a.pageY))b=true}));"checkbox"===this.type?this.buttonElement.bind("click"+this.eventNamespace,function(){if(m.disabled||b)return false;d(this).toggleClass("ui-state-active");j.buttonElement.attr("aria-pressed",j.element[0].checked)}):"radio"===this.type?this.buttonElement.bind("click"+this.eventNamespace,
function(){if(m.disabled||b)return false;d(this).addClass("ui-state-active");j.buttonElement.attr("aria-pressed","true");var a=j.element[0];g(a).not(a).map(function(){return d(this).button("widget")[0]}).removeClass("ui-state-active").attr("aria-pressed","false")}):(this.buttonElement.bind("mousedown"+this.eventNamespace,function(){if(m.disabled)return false;d(this).addClass("ui-state-active");a=this;j.document.one("mouseup",function(){a=null})}).bind("mouseup"+this.eventNamespace,function(){if(m.disabled)return false;
d(this).removeClass("ui-state-active")}).bind("keydown"+this.eventNamespace,function(a){if(m.disabled)return false;(a.keyCode===d.ui.keyCode.SPACE||a.keyCode===d.ui.keyCode.ENTER)&&d(this).addClass("ui-state-active")}).bind("keyup"+this.eventNamespace,function(){d(this).removeClass("ui-state-active")}),this.buttonElement.is("a")&&this.buttonElement.keyup(function(a){a.keyCode===d.ui.keyCode.SPACE&&d(this).click()}));this._setOption("disabled",m.disabled);this._resetButton()},_determineButtonType:function(){var a,
b;this.type=this.element.is("[type=checkbox]")?"checkbox":this.element.is("[type=radio]")?"radio":this.element.is("input")?"input":"button";"checkbox"===this.type||"radio"===this.type?(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)):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(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?g(this.element[0]).each(function(){d(this).is(":checked")?d(this).button("widget").addClass("ui-state-active").attr("aria-pressed","true"):d(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=d("<span></span>",this.document[0]).addClass("ui-button-text").html(this.options.label).appendTo(a.empty()).text(),c=this.options.icons,f=c.primary&&c.secondary,g=[];c.primary||c.secondary?(this.options.text&&g.push("ui-button-text-icon"+(f?"s":c.primary?"-primary":"-secondary")),c.primary&&a.prepend("<span class='ui-button-icon-primary ui-icon "+c.primary+"'></span>"),c.secondary&&a.append("<span class='ui-button-icon-secondary ui-icon "+c.secondary+"'></span>"),this.options.text||(g.push(f?"ui-button-icons-only":
"ui-button-icon-only"),this.hasTitle||a.attr("title",d.trim(b)))):g.push("ui-button-text-only");a.addClass(g.join(" "))}}});d.widget("ui.buttonset",{version:"1.9.0",options:{items:"button, input[type=button], input[type=submit], input[type=reset], input[type=checkbox], input[type=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(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 d(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 d(this).button("widget")[0]}).removeClass("ui-corner-left ui-corner-right").end().button("destroy")}})})(l);
(function(d,a){function k(){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};d.extend(this._defaults,this.regional[""]);this.dpDiv=c(d('<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(){d(this).removeClass("ui-state-hover");-1!=this.className.indexOf("ui-datepicker-prev")&&d(this).removeClass("ui-datepicker-prev-hover");-1!=this.className.indexOf("ui-datepicker-next")&&d(this).removeClass("ui-datepicker-next-hover")}).delegate("button, .ui-datepicker-prev, .ui-datepicker-next, .ui-datepicker-calendar td a","mouseover",function(){if(!d.datepicker._isDisabledDatepicker(g.inline?a.parent()[0]:g.input[0]))d(this).parents(".ui-datepicker-calendar").find("a").removeClass("ui-state-hover"),
d(this).addClass("ui-state-hover"),-1!=this.className.indexOf("ui-datepicker-prev")&&d(this).addClass("ui-datepicker-prev-hover"),-1!=this.className.indexOf("ui-datepicker-next")&&d(this).addClass("ui-datepicker-next-hover")})}function b(b,c){d.extend(b,c);for(var e in c)if(null==c[e]||c[e]==a)b[e]=c[e];return b}d.extend(d.ui,{datepicker:{version:"1.9.0"}});var f=(new Date).getTime(),g;d.extend(k.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 c=null,f;for(f in this._defaults){var g=a.getAttribute("date:"+f);if(g){c=c||{};try{c[f]=eval(g)}catch(k){c[f]=g}}}f=a.nodeName.toLowerCase();g="div"==f||"span"==f;a.id||(this.uuid+=1,a.id="dp"+this.uuid);var p=this._newInst(d(a),g);p.settings=d.extend({},b||{},c||{});"input"==f?this._connectDatepicker(a,p):g&&this._inlineDatepicker(a,p)},_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(d('<div class="'+this._inlineClass+' ui-datepicker ui-widget ui-widget-content ui-helper-clearfix ui-corner-all"></div>'))}},_connectDatepicker:function(a,b){var c=d(a);b.append=d([]);b.trigger=d([]);c.hasClass(this.markerClassName)||(this._attachments(c,b),c.addClass(this.markerClassName).keydown(this._doKeyDown).keypress(this._doKeyPress).keyup(this._doKeyUp).bind("setData.datepicker",
function(a,c,e){b.settings[c]=e}).bind("getData.datepicker",function(a,c){return this._get(b,c)}),this._autoSize(b),d.data(a,"datepicker",b),b.settings.disabled&&this._disableDatepicker(a))},_attachments:function(a,b){var c=this._get(b,"appendText"),f=this._get(b,"isRTL");b.append&&b.append.remove();c&&(b.append=d('<span class="'+this._appendClass+'">'+c+"</span>"),a[f?"before":"after"](b.append));a.unbind("focus",this._showDatepicker);b.trigger&&b.trigger.remove();c=this._get(b,"showOn");("focus"==
c||"both"==c)&&a.focus(this._showDatepicker);if("button"==c||"both"==c){var c=this._get(b,"buttonText"),g=this._get(b,"buttonImage");b.trigger=d(this._get(b,"buttonImageOnly")?d("<img/>").addClass(this._triggerClass).attr({src:g,alt:c,title:c}):d('<button type="button"></button>').addClass(this._triggerClass).html(""==g?c:d("<img/>").attr({src:g,alt:c,title:c})));a[f?"before":"after"](b.trigger);b.trigger.click(function(){if(d.datepicker._datepickerShowing&&d.datepicker._lastInput==a[0])d.datepicker._hideDatepicker();
else{d.datepicker._datepickerShowing&&d.datepicker._lastInput!=a[0]&&d.datepicker._hideDatepicker();d.datepicker._showDatepicker(a[0])}return false})}},_autoSize:function(a){if(this._get(a,"autoSize")&&!a.inline){var b=new Date(2009,11,20),c=this._get(a,"dateFormat");if(c.match(/[DM]/)){var f=function(a){for(var b=0,c=0,e=0;e<a.length;e++)a[e].length>b&&(b=a[e].length,c=e);return c};b.setMonth(f(this._get(a,c.match(/MM/)?"monthNames":"monthNamesShort")));b.setDate(f(this._get(a,c.match(/DD/)?"dayNames":
"dayNamesShort"))+20-b.getDay())}a.input.attr("size",this._formatDate(a,b).length)}},_inlineDatepicker:function(a,b){var c=d(a);c.hasClass(this.markerClassName)||(c.addClass(this.markerClassName).append(b.dpDiv).bind("setData.datepicker",function(a,c,e){b.settings[c]=e}).bind("getData.datepicker",function(a,c){return this._get(b,c)}),d.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,e,f,g){a=this._dialogInst;a||(this.uuid+=1,this._dialogInput=d('<input type="text" id="dp'+this.uuid+'" style="position: absolute; top: -100px; width: 0px;"/>'),this._dialogInput.keydown(this._doKeyDown),d("body").append(this._dialogInput),a=this._dialogInst=this._newInst(this._dialogInput,!1),a.settings={},d.data(this._dialogInput[0],"datepicker",a));b(a.settings,f||{});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=e;this._inDialog=!0;this.dpDiv.addClass(this._dialogClass);this._showDatepicker(this._dialogInput[0]);d.blockUI&&d.blockUI(this.dpDiv);
d.data(this._dialogInput[0],"datepicker",a);return this},_destroyDatepicker:function(a){var b=d(a),c=d.data(a,"datepicker");if(b.hasClass(this.markerClassName)){var f=a.nodeName.toLowerCase();d.removeData(a,"datepicker");"input"==f?(c.append.remove(),c.trigger.remove(),b.removeClass(this.markerClassName).unbind("focus",this._showDatepicker).unbind("keydown",this._doKeyDown).unbind("keypress",this._doKeyPress).unbind("keyup",this._doKeyUp)):("div"==f||"span"==f)&&b.removeClass(this.markerClassName).empty()}},
_enableDatepicker:function(a){var b=d(a),c=d.data(a,"datepicker");if(b.hasClass(this.markerClassName)){var f=a.nodeName.toLowerCase();if("input"==f)a.disabled=!1,c.trigger.filter("button").each(function(){this.disabled=!1}).end().filter("img").css({opacity:"1.0",cursor:""});else if("div"==f||"span"==f)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=d.map(this._disabledInputs,
function(b){return b==a?null:b})}},_disableDatepicker:function(a){var b=d(a),c=d.data(a,"datepicker");if(b.hasClass(this.markerClassName)){var f=a.nodeName.toLowerCase();if("input"==f)a.disabled=!0,c.trigger.filter("button").each(function(){this.disabled=!0}).end().filter("img").css({opacity:"0.5",cursor:"default"});else if("div"==f||"span"==f)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=d.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 d.data(a,"datepicker")}catch(b){throw"Missing instance data for this datepicker";}},_optionDatepicker:function(c,f,e){var g=this._getInst(c);if(2==arguments.length&&"string"==typeof f)return"defaults"==
f?d.extend({},d.datepicker._defaults):g?"all"==f?d.extend({},g.settings):this._get(g,f):null;var k=f||{};"string"==typeof f&&(k={},k[f]=e);if(g){this._curInst==g&&this._hideDatepicker();var r=this._getDateDatepicker(c,!0),p=this._getMinMaxDate(g,"min"),q=this._getMinMaxDate(g,"max");b(g.settings,k);null!==p&&(k.dateFormat!==a&&k.minDate===a)&&(g.settings.minDate=this._formatDate(g,p));null!==q&&(k.dateFormat!==a&&k.maxDate===a)&&(g.settings.maxDate=this._formatDate(g,q));this._attachments(d(c),g);
this._autoSize(g);this._setDate(g,r);this._updateAlternate(g);this._updateDatepicker(g)}},_changeDatepicker:function(a,b,c){this._optionDatepicker(a,b,c)},_refreshDatepicker:function(a){(a=this._getInst(a))&&this._updateDatepicker(a)},_setDateDatepicker:function(a,b){var c=this._getInst(a);c&&(this._setDate(c,b),this._updateDatepicker(c),this._updateAlternate(c))},_getDateDatepicker:function(a,b){var c=this._getInst(a);c&&!c.inline&&this._setDateFromField(c,b);return c?this._getDate(c):null},_doKeyDown:function(a){var b=
d.datepicker._getInst(a.target),c=!0,f=b.dpDiv.is(".ui-datepicker-rtl");b._keyEvent=!0;if(d.datepicker._datepickerShowing)switch(a.keyCode){case 9:d.datepicker._hideDatepicker();c=!1;break;case 13:return c=d("td."+d.datepicker._dayOverClass+":not(."+d.datepicker._currentClass+")",b.dpDiv),c[0]&&d.datepicker._selectDay(a.target,b.selectedMonth,b.selectedYear,c[0]),(a=d.datepicker._get(b,"onSelect"))?(c=d.datepicker._formatDate(b),a.apply(b.input?b.input[0]:null,[c,b])):d.datepicker._hideDatepicker(),
!1;case 27:d.datepicker._hideDatepicker();break;case 33:d.datepicker._adjustDate(a.target,a.ctrlKey?-d.datepicker._get(b,"stepBigMonths"):-d.datepicker._get(b,"stepMonths"),"M");break;case 34:d.datepicker._adjustDate(a.target,a.ctrlKey?+d.datepicker._get(b,"stepBigMonths"):+d.datepicker._get(b,"stepMonths"),"M");break;case 35:(a.ctrlKey||a.metaKey)&&d.datepicker._clearDate(a.target);c=a.ctrlKey||a.metaKey;break;case 36:(a.ctrlKey||a.metaKey)&&d.datepicker._gotoToday(a.target);c=a.ctrlKey||a.metaKey;
break;case 37:if(a.ctrlKey||a.metaKey)d.datepicker._adjustDate(a.target,f?1:-1,"D");c=a.ctrlKey||a.metaKey;a.originalEvent.altKey&&d.datepicker._adjustDate(a.target,a.ctrlKey?-d.datepicker._get(b,"stepBigMonths"):-d.datepicker._get(b,"stepMonths"),"M");break;case 38:(a.ctrlKey||a.metaKey)&&d.datepicker._adjustDate(a.target,-7,"D");c=a.ctrlKey||a.metaKey;break;case 39:if(a.ctrlKey||a.metaKey)d.datepicker._adjustDate(a.target,f?-1:1,"D");c=a.ctrlKey||a.metaKey;a.originalEvent.altKey&&d.datepicker._adjustDate(a.target,
a.ctrlKey?+d.datepicker._get(b,"stepBigMonths"):+d.datepicker._get(b,"stepMonths"),"M");break;case 40:(a.ctrlKey||a.metaKey)&&d.datepicker._adjustDate(a.target,7,"D");c=a.ctrlKey||a.metaKey;break;default:c=!1}else 36==a.keyCode&&a.ctrlKey?d.datepicker._showDatepicker(this):c=!1;c&&(a.preventDefault(),a.stopPropagation())},_doKeyPress:function(b){var c=d.datepicker._getInst(b.target);if(d.datepicker._get(c,"constrainInput")){var c=d.datepicker._possibleChars(d.datepicker._get(c,"dateFormat")),e=String.fromCharCode(b.charCode==
a?b.keyCode:b.charCode);return b.ctrlKey||b.metaKey||" ">e||!c||-1<c.indexOf(e)}},_doKeyUp:function(a){a=d.datepicker._getInst(a.target);if(a.input.val()!=a.lastVal)try{if(d.datepicker.parseDate(d.datepicker._get(a,"dateFormat"),a.input?a.input.val():null,d.datepicker._getFormatConfig(a)))d.datepicker._setDateFromField(a),d.datepicker._updateAlternate(a),d.datepicker._updateDatepicker(a)}catch(b){d.datepicker.log(b)}return!0},_showDatepicker:function(a){a=a.target||a;"input"!=a.nodeName.toLowerCase()&&
(a=d("input",a.parentNode)[0]);if(!(d.datepicker._isDisabledDatepicker(a)||d.datepicker._lastInput==a)){var c=d.datepicker._getInst(a);d.datepicker._curInst&&d.datepicker._curInst!=c&&(d.datepicker._curInst.dpDiv.stop(!0,!0),c&&d.datepicker._datepickerShowing&&d.datepicker._hideDatepicker(d.datepicker._curInst.input[0]));var e=d.datepicker._get(c,"beforeShow"),e=e?e.apply(a,[a,c]):{};if(!1!==e){b(c.settings,e);c.lastVal=null;d.datepicker._lastInput=a;d.datepicker._setDateFromField(c);d.datepicker._inDialog&&
(a.value="");d.datepicker._pos||(d.datepicker._pos=d.datepicker._findPos(a),d.datepicker._pos[1]+=a.offsetHeight);var f=!1;d(a).parents().each(function(){f=f|d(this).css("position")=="fixed";return!f});e={left:d.datepicker._pos[0],top:d.datepicker._pos[1]};d.datepicker._pos=null;c.dpDiv.empty();c.dpDiv.css({position:"absolute",display:"block",top:"-1000px"});d.datepicker._updateDatepicker(c);e=d.datepicker._checkOffset(c,e,f);c.dpDiv.css({position:d.datepicker._inDialog&&d.blockUI?"static":f?"fixed":
"absolute",display:"none",left:e.left+"px",top:e.top+"px"});if(!c.inline){var e=d.datepicker._get(c,"showAnim"),g=d.datepicker._get(c,"duration"),k=function(){var a=c.dpDiv.find("iframe.ui-datepicker-cover");if(a.length){var b=d.datepicker._getBorders(c.dpDiv);a.css({left:-b[0],top:-b[1],width:c.dpDiv.outerWidth(),height:c.dpDiv.outerHeight()})}};c.dpDiv.zIndex(d(a).zIndex()+1);d.datepicker._datepickerShowing=!0;if(d.effects&&(d.effects.effect[e]||d.effects[e]))c.dpDiv.show(e,d.datepicker._get(c,
"showOptions"),g,k);else c.dpDiv[e||"show"](e?g:null,k);(!e||!g)&&k();c.input.is(":visible")&&!c.input.is(":disabled")&&c.input.focus();d.datepicker._curInst=c}}}},_updateDatepicker:function(a){this.maxRows=4;var b=d.datepicker._getBorders(a.dpDiv);g=a;a.dpDiv.empty().append(this._generateHTML(a));this._attachHandlers(a);var c=a.dpDiv.find("iframe.ui-datepicker-cover");c.length&&c.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);c=b[1];a.dpDiv.removeClass("ui-datepicker-multi-2 ui-datepicker-multi-3 ui-datepicker-multi-4").width("");1<c&&a.dpDiv.addClass("ui-datepicker-multi-"+c).css("width",17*c+"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==d.datepicker._curInst&&(d.datepicker._datepickerShowing&&a.input&&a.input.is(":visible")&&!a.input.is(":disabled")&&a.input[0]!=
document.activeElement)&&a.input.focus();if(a.yearshtml){var f=a.yearshtml;setTimeout(function(){f===a.yearshtml&&a.yearshtml&&a.dpDiv.find("select.ui-datepicker-year:first").replaceWith(a.yearshtml);f=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,c){var f=a.dpDiv.outerWidth(),g=a.dpDiv.outerHeight(),k=a.input?a.input.outerWidth():
0,p=a.input?a.input.outerHeight():0,q=document.documentElement.clientWidth+(c?0:d(document).scrollLeft()),l=document.documentElement.clientHeight+(c?0:d(document).scrollTop());b.left-=this._get(a,"isRTL")?f-k:0;b.left-=c&&b.left==a.input.offset().left?d(document).scrollLeft():0;b.top-=c&&b.top==a.input.offset().top+p?d(document).scrollTop():0;b.left-=Math.min(b.left,b.left+f>q&&q>f?Math.abs(b.left+f-q):0);b.top-=Math.min(b.top,b.top+g>l&&l>g?Math.abs(g+p):0);return b},_findPos:function(a){for(var b=
this._get(this._getInst(a),"isRTL");a&&("hidden"==a.type||1!=a.nodeType||d.expr.filters.hidden(a));)a=a[b?"previousSibling":"nextSibling"];a=d(a).offset();return[a.left,a.top]},_hideDatepicker:function(a){var b=this._curInst;if(b&&!(a&&b!=d.data(a,"datepicker"))&&this._datepickerShowing){var a=this._get(b,"showAnim"),c=this._get(b,"duration"),f=function(){d.datepicker._tidyDialog(b)};if(d.effects&&(d.effects.effect[a]||d.effects[a]))b.dpDiv.hide(a,d.datepicker._get(b,"showOptions"),c,f);else b.dpDiv["slideDown"==
a?"slideUp":"fadeIn"==a?"fadeOut":"hide"](a?c:null,f);a||f();this._datepickerShowing=!1;(a=this._get(b,"onClose"))&&a.apply(b.input?b.input[0]:null,[b.input?b.input.val():"",b]);this._lastInput=null;this._inDialog&&(this._dialogInput.css({position:"absolute",left:"0",top:"-100px"}),d.blockUI&&(d.unblockUI(),d("body").append(this.dpDiv)));this._inDialog=!1}},_tidyDialog:function(a){a.dpDiv.removeClass(this._dialogClass).unbind(".ui-datepicker-calendar")},_checkExternalClick:function(a){if(d.datepicker._curInst){var a=
d(a.target),b=d.datepicker._getInst(a[0]);(a[0].id!=d.datepicker._mainDivId&&0==a.parents("#"+d.datepicker._mainDivId).length&&!a.hasClass(d.datepicker.markerClassName)&&!a.closest("."+d.datepicker._triggerClass).length&&d.datepicker._datepickerShowing&&(!d.datepicker._inDialog||!d.blockUI)||a.hasClass(d.datepicker.markerClassName)&&d.datepicker._curInst!=b)&&d.datepicker._hideDatepicker()}},_adjustDate:function(a,b,c){var a=d(a),f=this._getInst(a[0]);this._isDisabledDatepicker(a[0])||(this._adjustInstDate(f,
b+("M"==c?this._get(f,"showCurrentAtPos"):0),c),this._updateDatepicker(f))},_gotoToday:function(a){var a=d(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 c=new Date;b.selectedDay=c.getDate();b.drawMonth=b.selectedMonth=c.getMonth();b.drawYear=b.selectedYear=c.getFullYear()}this._notifyChange(b);this._adjustDate(a)},_selectMonthYear:function(a,b,c){var a=d(a),
f=this._getInst(a[0]);f["selected"+("M"==c?"Month":"Year")]=f["draw"+("M"==c?"Month":"Year")]=parseInt(b.options[b.selectedIndex].value,10);this._notifyChange(f);this._adjustDate(a)},_selectDay:function(a,b,c,f){var g=d(a);!d(f).hasClass(this._unselectableClass)&&!this._isDisabledDatepicker(g[0])&&(g=this._getInst(g[0]),g.selectedDay=g.currentDay=d("a",f).html(),g.selectedMonth=g.currentMonth=b,g.selectedYear=g.currentYear=c,this._selectDate(a,this._formatDate(g,g.currentDay,g.currentMonth,g.currentYear)))},
_clearDate:function(a){a=d(a);this._getInst(a[0]);this._selectDate(a,"")},_selectDate:function(a,b){var c=this._getInst(d(a)[0]),b=null!=b?b:this._formatDate(c);c.input&&c.input.val(b);this._updateAlternate(c);var f=this._get(c,"onSelect");f?f.apply(c.input?c.input[0]:null,[b,c]):c.input&&c.input.trigger("change");c.inline?this._updateDatepicker(c):(this._hideDatepicker(),this._lastInput=c.input[0],"object"!=typeof c.input[0]&&c.input.focus(),this._lastInput=null)},_updateAlternate:function(a){var b=
this._get(a,"altField");if(b){var c=this._get(a,"altFormat")||this._get(a,"dateFormat"),f=this._getDate(a),g=this.formatDate(c,f,this._getFormatConfig(a));d(b).each(function(){d(this).val(g)})}},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,c){if(null==a||null==b)throw"Invalid arguments";
b="object"==typeof b?b.toString():b+"";if(""==b)return null;for(var f=(c?c.shortYearCutoff:null)||this._defaults.shortYearCutoff,f="string"!=typeof f?f:(new Date).getFullYear()%100+parseInt(f,10),g=(c?c.dayNamesShort:null)||this._defaults.dayNamesShort,k=(c?c.dayNames:null)||this._defaults.dayNames,p=(c?c.monthNamesShort:null)||this._defaults.monthNamesShort,q=(c?c.monthNames:null)||this._defaults.monthNames,l=c=-1,u=-1,v=-1,t=!1,x=function(b){(b=C+1<a.length&&a.charAt(C+1)==b)&&C++;return b},y=function(a){var c=
x(a),a=RegExp("^\\d{1,"+("@"==a?14:"!"==a?20:"y"==a&&c?4:"o"==a?3:2)+"}"),a=b.substring(A).match(a);if(!a)throw"Missing number at position "+A;A+=a[0].length;return parseInt(a[0],10)},z=function(a,c,e){var a=d.map(x(a)?e:c,function(a,b){return[[b,a]]}).sort(function(a,b){return-(a[1].length-b[1].length)}),f=-1;d.each(a,function(a,c){var e=c[1];if(b.substr(A,e.length).toLowerCase()==e.toLowerCase())return f=c[0],A+=e.length,!1});if(-1!=f)return f+1;throw"Unknown name at position "+A;},E=function(){if(b.charAt(A)!=
a.charAt(C))throw"Unexpected literal at position "+A;A++},A=0,C=0;C<a.length;C++)if(t)"'"==a.charAt(C)&&!x("'")?t=!1:E();else switch(a.charAt(C)){case "d":u=y("d");break;case "D":z("D",g,k);break;case "o":v=y("o");break;case "m":l=y("m");break;case "M":l=z("M",p,q);break;case "y":c=y("y");break;case "@":var J=new Date(y("@")),c=J.getFullYear(),l=J.getMonth()+1,u=J.getDate();break;case "!":J=new Date((y("!")-this._ticksTo1970)/1E4);c=J.getFullYear();l=J.getMonth()+1;u=J.getDate();break;case "'":x("'")?
E():t=!0;break;default:E()}if(A<b.length&&(g=b.substr(A),!/^\s+/.test(g)))throw"Extra/unparsed characters found in date: "+g;-1==c?c=(new Date).getFullYear():100>c&&(c+=(new Date).getFullYear()-(new Date).getFullYear()%100+(c<=f?0:-100));if(-1<v){l=1;u=v;do{f=this._getDaysInMonth(c,l-1);if(u<=f)break;l++;u-=f}while(1)}J=this._daylightSavingAdjust(new Date(c,l-1,u));if(J.getFullYear()!=c||J.getMonth()+1!=l||J.getDate()!=u)throw"Invalid date";return J},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,c){if(!b)return"";var f=(c?c.dayNamesShort:null)||this._defaults.dayNamesShort,g=(c?c.dayNames:null)||this._defaults.dayNames,d=(c?c.monthNamesShort:null)||this._defaults.monthNamesShort,c=(c?c.monthNames:null)||this._defaults.monthNames,k=
function(b){(b=t+1<a.length&&a.charAt(t+1)==b)&&t++;return b},q=function(a,b,c){b=""+b;if(k(a))for(;b.length<c;)b="0"+b;return b},l=function(a,b,c,e){return k(a)?e[b]:c[b]},u="",v=!1;if(b)for(var t=0;t<a.length;t++)if(v)"'"==a.charAt(t)&&!k("'")?v=!1:u+=a.charAt(t);else switch(a.charAt(t)){case "d":u+=q("d",b.getDate(),2);break;case "D":u+=l("D",b.getDay(),f,g);break;case "o":u+=q("o",Math.round(((new Date(b.getFullYear(),b.getMonth(),b.getDate())).getTime()-(new Date(b.getFullYear(),0,0)).getTime())/
864E5),3);break;case "m":u+=q("m",b.getMonth()+1,2);break;case "M":u+=l("M",b.getMonth(),d,c);break;case "y":u+=k("y")?b.getFullYear():(10>b.getYear()%100?"0":"")+b.getYear()%100;break;case "@":u+=b.getTime();break;case "!":u+=1E4*b.getTime()+this._ticksTo1970;break;case "'":k("'")?u+="'":v=!0;break;default:u+=a.charAt(t)}return u},_possibleChars:function(a){for(var b="",c=!1,f=function(b){(b=g+1<a.length&&a.charAt(g+1)==b)&&g++;return b},g=0;g<a.length;g++)if(c)"'"==a.charAt(g)&&!f("'")?c=!1:b+=
a.charAt(g);else switch(a.charAt(g)){case "d":case "m":case "y":case "@":b+="0123456789";break;case "D":case "M":return null;case "'":f("'")?b+="'":c=!0;break;default:b+=a.charAt(g)}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 c=this._get(a,"dateFormat"),f=a.lastVal=a.input?a.input.val():null,g,d;g=d=this._getDefaultDate(a);var k=this._getFormatConfig(a);try{g=this.parseDate(c,f,k)||d}catch(q){this.log(q),
f=b?"":f}a.selectedDay=g.getDate();a.drawMonth=a.selectedMonth=g.getMonth();a.drawYear=a.selectedYear=g.getFullYear();a.currentDay=f?g.getDate():0;a.currentMonth=f?g.getMonth():0;a.currentYear=f?g.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,c){var f=function(a){var b=new Date;b.setDate(b.getDate()+a);return b},g=function(b){try{return d.datepicker.parseDate(d.datepicker._get(a,
"dateFormat"),b,d.datepicker._getFormatConfig(a))}catch(c){}for(var e=(b.toLowerCase().match(/^c/)?d.datepicker._getDate(a):null)||new Date,f=e.getFullYear(),g=e.getMonth(),e=e.getDate(),k=/([+-]?[0-9]+)\s*(d|D|w|W|m|M|y|Y)?/g,m=k.exec(b);m;){switch(m[2]||"d"){case "d":case "D":e+=parseInt(m[1],10);break;case "w":case "W":e+=7*parseInt(m[1],10);break;case "m":case "M":g+=parseInt(m[1],10);e=Math.min(e,d.datepicker._getDaysInMonth(f,g));break;case "y":case "Y":f+=parseInt(m[1],10),e=Math.min(e,d.datepicker._getDaysInMonth(f,
g))}m=k.exec(b)}return new Date(f,g,e)};if(b=(b=null==b||""===b?c:"string"==typeof b?g(b):"number"==typeof b?isNaN(b)?c:f(b):new Date(b.getTime()))&&"Invalid Date"==b.toString()?c: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,c){var f=!b,g=a.selectedMonth,d=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();(g!=a.selectedMonth||d!=a.selectedYear)&&!c&&this._notifyChange(a);this._adjustInstDate(a);a.input&&a.input.val(f?"":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))},_attachHandlers:function(a){var b=this._get(a,
"stepMonths"),c="#"+a.id.replace(/\\\\/g,"\\");a.dpDiv.find("[data-handler]").map(function(){d(this).bind(this.getAttribute("data-event"),{prev:function(){window["DP_jQuery_"+f].datepicker._adjustDate(c,-b,"M")},next:function(){window["DP_jQuery_"+f].datepicker._adjustDate(c,+b,"M")},hide:function(){window["DP_jQuery_"+f].datepicker._hideDatepicker()},today:function(){window["DP_jQuery_"+f].datepicker._gotoToday(c)},selectDay:function(){window["DP_jQuery_"+f].datepicker._selectDay(c,+this.getAttribute("data-month"),
+this.getAttribute("data-year"),this);return!1},selectMonth:function(){window["DP_jQuery_"+f].datepicker._selectMonthYear(c,this,"M");return!1},selectYear:function(){window["DP_jQuery_"+f].datepicker._selectMonthYear(c,this,"Y");return!1}}[this.getAttribute("data-handler")])})},_generateHTML:function(a){var b=new Date,b=this._daylightSavingAdjust(new Date(b.getFullYear(),b.getMonth(),b.getDate())),c=this._get(a,"isRTL"),f=this._get(a,"showButtonPanel"),g=this._get(a,"hideIfNoPrevNext"),k=this._get(a,
"navigationAsDateFormat"),p=this._getNumberOfMonths(a),q=this._get(a,"showCurrentAtPos"),l=this._get(a,"stepMonths"),u=1!=p[0]||1!=p[1],v=this._daylightSavingAdjust(!a.currentDay?new Date(9999,9,9):new Date(a.currentYear,a.currentMonth,a.currentDay)),t=this._getMinMaxDate(a,"min"),x=this._getMinMaxDate(a,"max"),q=a.drawMonth-q,y=a.drawYear;0>q&&(q+=12,y--);if(x)for(var z=this._daylightSavingAdjust(new Date(x.getFullYear(),x.getMonth()-p[0]*p[1]+1,x.getDate())),z=t&&z<t?t:z;this._daylightSavingAdjust(new Date(y,
q,1))>z;)q--,0>q&&(q=11,y--);a.drawMonth=q;a.drawYear=y;var z=this._get(a,"prevText"),z=!k?z:this.formatDate(z,this._daylightSavingAdjust(new Date(y,q-l,1)),this._getFormatConfig(a)),z=this._canAdjustMonth(a,-1,y,q)?'<a class="ui-datepicker-prev ui-corner-all" data-handler="prev" data-event="click" title="'+z+'"><span class="ui-icon ui-icon-circle-triangle-'+(c?"e":"w")+'">'+z+"</span></a>":g?"":'<a class="ui-datepicker-prev ui-corner-all ui-state-disabled" title="'+z+'"><span class="ui-icon ui-icon-circle-triangle-'+
(c?"e":"w")+'">'+z+"</span></a>",E=this._get(a,"nextText"),E=!k?E:this.formatDate(E,this._daylightSavingAdjust(new Date(y,q+l,1)),this._getFormatConfig(a)),g=this._canAdjustMonth(a,1,y,q)?'<a class="ui-datepicker-next ui-corner-all" data-handler="next" data-event="click" title="'+E+'"><span class="ui-icon ui-icon-circle-triangle-'+(c?"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-'+(c?"w":
"e")+'">'+E+"</span></a>",l=this._get(a,"currentText"),E=this._get(a,"gotoCurrent")&&a.currentDay?v:b,l=!k?l:this.formatDate(l,E,this._getFormatConfig(a)),k=!a.inline?'<button type="button" class="ui-datepicker-close ui-state-default ui-priority-primary ui-corner-all" data-handler="hide" data-event="click">'+this._get(a,"closeText")+"</button>":"",f=f?'<div class="ui-datepicker-buttonpane ui-widget-content">'+(c?k:"")+(this._isInRange(a,E)?'<button type="button" class="ui-datepicker-current ui-state-default ui-priority-secondary ui-corner-all" data-handler="today" data-event="click">'+
l+"</button>":"")+(c?"":k)+"</div>":"",k=parseInt(this._get(a,"firstDay"),10),k=isNaN(k)?0:k,l=this._get(a,"showWeek"),E=this._get(a,"dayNames");this._get(a,"dayNamesShort");var A=this._get(a,"dayNamesMin"),C=this._get(a,"monthNames"),J=this._get(a,"monthNamesShort"),S=this._get(a,"beforeShowDay"),F=this._get(a,"showOtherMonths"),B=this._get(a,"selectOtherMonths");this._get(a,"calculateWeek");for(var O=this._getDefaultDate(a),Y="",R=0;R<p[0];R++){var V="";this.maxRows=4;for(var G=0;G<p[1];G++){var N=
this._daylightSavingAdjust(new Date(y,q,a.selectedDay)),H=" ui-corner-all",T="";if(u){T+='<div class="ui-datepicker-group';if(1<p[1])switch(G){case 0:T+=" ui-datepicker-group-first";H=" ui-corner-"+(c?"right":"left");break;case p[1]-1:T+=" ui-datepicker-group-last";H=" ui-corner-"+(c?"left":"right");break;default:T+=" ui-datepicker-group-middle",H=""}T+='">'}for(var T=T+('<div class="ui-datepicker-header ui-widget-header ui-helper-clearfix'+H+'">'+(/all|left/.test(H)&&0==R?c?g:z:"")+(/all|right/.test(H)&&
0==R?c?z:g:"")+this._generateMonthYearHeader(a,q,y,t,x,0<R||0<G,C,J)+'</div><table class="ui-datepicker-calendar"><thead><tr>'),Z=l?'<th class="ui-datepicker-week-col">'+this._get(a,"weekHeader")+"</th>":"",H=0;7>H;H++)var X=(H+k)%7,Z=Z+("<th"+(5<=(H+k+6)%7?' class="ui-datepicker-week-end"':"")+'><span title="'+E[X]+'">'+A[X]+"</span></th>");T+=Z+"</tr></thead><tbody>";Z=this._getDaysInMonth(y,q);y==a.selectedYear&&q==a.selectedMonth&&(a.selectedDay=Math.min(a.selectedDay,Z));H=(this._getFirstDayOfMonth(y,
q)-k+7)%7;Z=Math.ceil((H+Z)/7);this.maxRows=Z=u?this.maxRows>Z?this.maxRows:Z:Z;for(var X=this._daylightSavingAdjust(new Date(y,q,1-H)),da=0;da<Z;da++){for(var T=T+"<tr>",la=!l?"":'<td class="ui-datepicker-week-col">'+this._get(a,"calculateWeek")(X)+"</td>",H=0;7>H;H++){var Q=S?S.apply(a.input?a.input[0]:null,[X]):[!0,""],I=X.getMonth()!=q,P=I&&!B||!Q[0]||t&&X<t||x&&X>x,la=la+('<td class="'+(5<=(H+k+6)%7?" ui-datepicker-week-end":"")+(I?" ui-datepicker-other-month":"")+(X.getTime()==N.getTime()&&
q==a.selectedMonth&&a._keyEvent||O.getTime()==X.getTime()&&O.getTime()==N.getTime()?" "+this._dayOverClass:"")+(P?" "+this._unselectableClass+" ui-state-disabled":"")+(I&&!F?"":" "+Q[1]+(X.getTime()==v.getTime()?" "+this._currentClass:"")+(X.getTime()==b.getTime()?" ui-datepicker-today":""))+'"'+((!I||F)&&Q[2]?' title="'+Q[2]+'"':"")+(P?"":' data-handler="selectDay" data-event="click" data-month="'+X.getMonth()+'" data-year="'+X.getFullYear()+'"')+">"+(I&&!F?"&#xa0;":P?'<span class="ui-state-default">'+
X.getDate()+"</span>":'<a class="ui-state-default'+(X.getTime()==b.getTime()?" ui-state-highlight":"")+(X.getTime()==v.getTime()?" ui-state-active":"")+(I?" ui-priority-secondary":"")+'" href="#">'+X.getDate()+"</a>")+"</td>");X.setDate(X.getDate()+1);X=this._daylightSavingAdjust(X)}T+=la+"</tr>"}q++;11<q&&(q=0,y++);T+="</tbody></table>"+(u?"</div>"+(0<p[0]&&G==p[1]-1?'<div class="ui-datepicker-row-break"></div>':""):"");V+=T}Y+=V}Y+=f+(d.browser.msie&&7>parseInt(d.browser.version,10)&&!a.inline?
'<iframe src="javascript:false;" class="ui-datepicker-cover" frameborder="0"></iframe>':"");a._keyEvent=!1;return Y},_generateMonthYearHeader:function(a,b,c,f,g,k,d,q){var l=this._get(a,"changeMonth"),u=this._get(a,"changeYear"),v=this._get(a,"showMonthAfterYear"),t='<div class="ui-datepicker-title">',x="";if(k||!l)x+='<span class="ui-datepicker-month">'+d[b]+"</span>";else{for(var d=f&&f.getFullYear()==c,y=g&&g.getFullYear()==c,x=x+'<select class="ui-datepicker-month" data-handler="selectMonth" data-event="change">',
z=0;12>z;z++)if((!d||z>=f.getMonth())&&(!y||z<=g.getMonth()))x+='<option value="'+z+'"'+(z==b?' selected="selected"':"")+">"+q[z]+"</option>";x+="</select>"}v||(t+=x+(k||!l||!u?"&#xa0;":""));if(!a.yearshtml)if(a.yearshtml="",k||!u)t+='<span class="ui-datepicker-year">'+c+"</span>";else{var q=this._get(a,"yearRange").split(":"),E=(new Date).getFullYear(),d=function(a){a=a.match(/c[+-].*/)?c+parseInt(a.substring(1),10):a.match(/[+-].*/)?E+parseInt(a,10):parseInt(a,10);return isNaN(a)?E:a},b=d(q[0]),
q=Math.max(b,d(q[1]||"")),b=f?Math.max(b,f.getFullYear()):b,q=g?Math.min(q,g.getFullYear()):q;for(a.yearshtml+='<select class="ui-datepicker-year" data-handler="selectYear" data-event="change">';b<=q;b++)a.yearshtml+='<option value="'+b+'"'+(b==c?' selected="selected"':"")+">"+b+"</option>";a.yearshtml+="</select>";t+=a.yearshtml;a.yearshtml=null}t+=this._get(a,"yearSuffix");v&&(t+=(k||!l||!u?"&#xa0;":"")+x);return t+"</div>"},_adjustInstDate:function(a,b,c){var f=a.drawYear+("Y"==c?b:0),g=a.drawMonth+
("M"==c?b:0),b=Math.min(a.selectedDay,this._getDaysInMonth(f,g))+("D"==c?b:0),f=this._restrictMinMax(a,this._daylightSavingAdjust(new Date(f,g,b)));a.selectedDay=f.getDate();a.drawMonth=a.selectedMonth=f.getMonth();a.drawYear=a.selectedYear=f.getFullYear();("M"==c||"Y"==c)&&this._notifyChange(a)},_restrictMinMax:function(a,b){var c=this._getMinMaxDate(a,"min"),f=this._getMinMaxDate(a,"max"),c=c&&b<c?c:b;return f&&c>f?f:c},_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,c,f){var g=this._getNumberOfMonths(a),c=this._daylightSavingAdjust(new Date(c,
f+(0>b?b:g[0]*g[1]),1));0>b&&c.setDate(this._getDaysInMonth(c.getFullYear(),c.getMonth()));return this._isInRange(a,c)},_isInRange:function(a,b){var c=this._getMinMaxDate(a,"min"),f=this._getMinMaxDate(a,"max");return(!c||b.getTime()>=c.getTime())&&(!f||b.getTime()<=f.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,c,f){b||(a.currentDay=a.selectedDay,a.currentMonth=a.selectedMonth,a.currentYear=a.selectedYear);b=b?"object"==typeof b?b:this._daylightSavingAdjust(new Date(f,c,b)):this._daylightSavingAdjust(new Date(a.currentYear,a.currentMonth,a.currentDay));return this.formatDate(this._get(a,"dateFormat"),b,this._getFormatConfig(a))}});d.fn.datepicker=function(a){if(!this.length)return this;
d.datepicker.initialized||(d(document).mousedown(d.datepicker._checkExternalClick).find(document.body).append(d.datepicker.dpDiv),d.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]?d.datepicker["_"+a+"Datepicker"].apply(d.datepicker,[this[0]].concat(b)):this.each(function(){typeof a=="string"?d.datepicker["_"+a+"Datepicker"].apply(d.datepicker,
[this].concat(b)):d.datepicker._attachDatepicker(this,a)})};d.datepicker=new k;d.datepicker.initialized=!1;d.datepicker.uuid=(new Date).getTime();d.datepicker.version="1.9.0";window["DP_jQuery_"+f]=d})(l);(function(d,a){var k={buttons:!0,height:!0,maxHeight:!0,maxWidth:!0,minHeight:!0,minWidth:!0,width:!0},c={maxHeight:!0,maxWidth:!0,minHeight:!0,minWidth:!0};d.widget("ui.dialog",{version:"1.9.0",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=d(this).css(a).offset().top;0>c&&d(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.oldPosition={parent:this.element.parent(),index:this.element.parent().children().index(this.element)};
this.options.title=this.options.title||this.originalTitle;var a=this,c=this.options,g=c.title||"&#160;",j=(this.uiDialog=d("<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(e){if(c.closeOnEscape&&!e.isDefaultPrevented()&&e.keyCode&&e.keyCode===d.ui.keyCode.ESCAPE){a.close(e);e.preventDefault()}}).mousedown(function(c){a.moveToTop(false,c)}).appendTo("body");this.element.show().removeAttr("title").addClass("ui-dialog-content ui-widget-content").appendTo(j);
var k=(this.uiDialogTitlebar=d("<div>")).addClass("ui-dialog-titlebar  ui-widget-header  ui-corner-all  ui-helper-clearfix").prependTo(j),e=d("<a href='#'></a>").addClass("ui-dialog-titlebar-close  ui-corner-all").attr("role","button").click(function(c){c.preventDefault();a.close(c)}).appendTo(k);(this.uiDialogTitlebarCloseText=d("<span>")).addClass("ui-icon ui-icon-closethick").text(c.closeText).appendTo(e);var g=d("<span>").uniqueId().addClass("ui-dialog-title").html(g).prependTo(k),o=(this.uiDialogButtonPane=
d("<div>")).addClass("ui-dialog-buttonpane ui-widget-content ui-helper-clearfix");(this.uiButtonSet=d("<div>")).addClass("ui-dialog-buttonset").appendTo(o);j.attr({role:"dialog","aria-labelledby":g.attr("id")});k.find("*").add(k).disableSelection();this._hoverable(e);this._focusable(e);c.draggable&&d.fn.draggable&&this._makeDraggable();c.resizable&&d.fn.resizable&&this._makeResizable();this._createButtons(c.buttons);this._isOpen=!1;d.fn.bgiframe&&j.bgiframe();this._on(j,{keydown:function(a){if(c.modal&&
a.keyCode===d.ui.keyCode.TAB){var b=d(":tabbable",j),e=b.filter(":first"),b=b.filter(":last");if(a.target===b[0]&&!a.shiftKey){e.focus(1);return false}if(a.target===e[0]&&a.shiftKey){b.focus(1);return false}}}})},_init:function(){this.options.autoOpen&&this.open()},_destroy:function(){var a,c=this.oldPosition;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);a=c.parent.children().eq(c.index);a.length&&a[0]!==this.element[0]?a.before(this.element):c.parent.append(this.element)},widget:function(){return this.uiDialog},close:function(a){var c=this,g,j;if(this._isOpen&&!1!==this._trigger("beforeClose",a))return this._isOpen=!1,this.overlay&&this.overlay.destroy(),this.options.hide?this.uiDialog.hide(this.options.hide,function(){c._trigger("close",a)}):(this.uiDialog.hide(),this._trigger("close",a)),d.ui.dialog.overlay.resize(),this.options.modal&&
(g=0,d(".ui-dialog").each(function(){if(this!==c.uiDialog[0]){j=d(this).css("z-index");isNaN(j)||(g=Math.max(g,j))}}),d.ui.dialog.maxZ=g),this},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>d.ui.dialog.maxZ&&(d.ui.dialog.maxZ=g.zIndex);this.overlay&&(d.ui.dialog.maxZ+=1,d.ui.dialog.overlay.maxZ=d.ui.dialog.maxZ,this.overlay.$el.css("z-index",d.ui.dialog.overlay.maxZ));g={scrollTop:this.element.scrollTop(),
scrollLeft:this.element.scrollLeft()};d.ui.dialog.maxZ+=1;this.uiDialog.css("z-index",d.ui.dialog.maxZ);this.element.attr(g);this._trigger("focus",c);return this},open:function(){if(!this._isOpen){var a;a=this.options;var c=this.uiDialog;this._size();this._position(a.position);c.show(a.show);this.overlay=a.modal?new d.ui.dialog.overlay(this):null;this.moveToTop(!0);a=this.element.find(":tabbable");a.length||(a=this.uiDialogButtonPane.find(":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;this.uiDialogButtonPane.remove();this.uiButtonSet.empty();"object"===typeof a&&null!==a&&d.each(a,function(){return!(g=!0)});g?(d.each(a,function(a,b){var b=d.isFunction(b)?{click:b,text:a}:b,e=d("<button type='button'>").attr(b,!0).unbind("click").click(function(){b.click.apply(c.element[0],arguments)}).appendTo(c.uiButtonSet);d.fn.button&&e.button()}),this.uiDialog.addClass("ui-dialog-buttons"),this.uiDialogButtonPane.appendTo(this.uiDialog)):
this.uiDialog.removeClass("ui-dialog-buttons")},_makeDraggable:function(){function a(b){return{position:b.position,offset:b.offset}}var c=this,g=this.options;this.uiDialog.draggable({cancel:".ui-dialog-content, .ui-dialog-titlebar-close",handle:".ui-dialog-titlebar",containment:"document",start:function(g,k){d(this).addClass("ui-dialog-dragging");c._trigger("dragStart",g,a(k))},drag:function(g,k){c._trigger("drag",g,a(k))},stop:function(j,k){g.position=[k.position.left-c.document.scrollLeft(),k.position.top-
c.document.scrollTop()];d(this).removeClass("ui-dialog-dragging");c._trigger("dragStop",j,a(k));d.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,j=this.options,k=this.uiDialog.css("position"),b="string"===typeof b?b:"n,e,s,w,se,sw,ne,nw";this.uiDialog.resizable({cancel:".ui-dialog-content",containment:"document",alsoResize:this.element,
maxWidth:j.maxWidth,maxHeight:j.maxHeight,minWidth:j.minWidth,minHeight:this._minHeight(),handles:b,start:function(a,b){d(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){d(this).removeClass("ui-dialog-resizing");j.height=d(this).height();j.width=d(this).width();g._trigger("resizeStop",a,c(b));d.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],j;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]),d.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=d.extend({},d.ui.dialog.prototype.options.position,a)}else a=d.ui.dialog.prototype.options.position;(j=this.uiDialog.is(":visible"))||
this.uiDialog.show();this.uiDialog.position(a);j||this.uiDialog.hide()},_setOptions:function(a){var f=this,g={},j=!1;d.each(a,function(a,b){f._setOption(a,b);a in k&&(j=!0);a in c&&(g[a]=b)});j&&this._size();this.uiDialog.is(":data(resizable)")&&this.uiDialog.resizable("option",g)},_setOption:function(a,c){var g,j=this.uiDialog;switch(a){case "buttons":this._createButtons(c);break;case "closeText":this.uiDialogTitlebarCloseText.text(""+c);break;case "dialogClass":j.removeClass(this.options.dialogClass).addClass("ui-dialog ui-widget ui-widget-content ui-corner-all "+
c);break;case "disabled":c?j.addClass("ui-dialog-disabled"):j.removeClass("ui-dialog-disabled");break;case "draggable":(g=j.is(":data(draggable)"))&&!c&&j.draggable("destroy");!g&&c&&this._makeDraggable();break;case "position":this._position(c);break;case "resizable":(g=j.is(":data(resizable)"))&&!c&&j.resizable("destroy");g&&"string"===typeof c&&j.resizable("option","handles",c);!g&&!1!==c&&this._makeResizable(c);break;case "title":d(".ui-dialog-title",this.uiDialogTitlebar).html(""+(c||"&#160;"))}this._super(a,
c)},_size:function(){var a,c,g=this.options,j=this.uiDialog.is(":visible");this.element.show().css({width:"auto",minHeight:0,height:0});g.minWidth>g.width&&(g.width=g.minWidth);a=this.uiDialog.css({height:"auto",width:g.width}).outerHeight();c=Math.max(0,g.minHeight-a);"auto"===g.height?d.support.minHeight?this.element.css({minHeight:c,height:"auto"}):(this.uiDialog.show(),a=this.element.css("height","auto").height(),j||this.uiDialog.hide(),this.element.height(Math.max(a,c))):this.element.height(Math.max(g.height-
a,0));this.uiDialog.is(":data(resizable)")&&this.uiDialog.resizable("option","minHeight",this._minHeight())}});d.extend(d.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=d.ui.dialog.overlay.create(a)}});d.extend(d.ui.dialog.overlay,{instances:[],oldInstances:[],maxZ:0,events:d.map("focus mousedown mouseup keydown keypress click".split(" "),function(a){return a+".dialog-overlay"}).join(" "),create:function(a){0===
this.instances.length&&(setTimeout(function(){d.ui.dialog.overlay.instances.length&&d(document).bind(d.ui.dialog.overlay.events,function(a){if(d(a.target).zIndex()<d.ui.dialog.overlay.maxZ)return!1})},1),d(window).bind("resize.dialog-overlay",d.ui.dialog.overlay.resize));var c=this.oldInstances.pop()||d("<div>").addClass("ui-widget-overlay");d(document).bind("keydown.dialog-overlay",function(g){var j=d.ui.dialog.overlay.instances;if(j.length!==0&&j[j.length-1]===c&&a.options.closeOnEscape&&!g.isDefaultPrevented()&&
g.keyCode&&g.keyCode===d.ui.keyCode.ESCAPE){a.close(g);g.preventDefault()}});c.appendTo(document.body).css({width:this.width(),height:this.height()});d.fn.bgiframe&&c.bgiframe();this.instances.push(c);return c},destroy:function(a){var c=d.inArray(a,this.instances),g=0;-1!==c&&this.oldInstances.push(this.instances.splice(c,1)[0]);0===this.instances.length&&d([document,window]).unbind(".dialog-overlay");a.height(0).width(0).remove();d.each(this.instances,function(){g=Math.max(g,this.css("z-index"))});
this.maxZ=g},height:function(){var a,c;return d.browser.msie?(a=Math.max(document.documentElement.scrollHeight,document.body.scrollHeight),c=Math.max(document.documentElement.offsetHeight,document.body.offsetHeight),a<c?d(window).height()+"px":a+"px"):d(document).height()+"px"},width:function(){var a,c;return d.browser.msie?(a=Math.max(document.documentElement.scrollWidth,document.body.scrollWidth),c=Math.max(document.documentElement.offsetWidth,document.body.offsetWidth),a<c?d(window).width()+"px":
a+"px"):d(document).width()+"px"},resize:function(){var a=d([]);d.each(d.ui.dialog.overlay.instances,function(){a=a.add(this)});a.css({width:0,height:0}).css({width:d.ui.dialog.overlay.width(),height:d.ui.dialog.overlay.height()})}});d.extend(d.ui.dialog.overlay.prototype,{destroy:function(){d.ui.dialog.overlay.destroy(this.$el)}})})(l);(function(d){var a=!1;d.widget("ui.menu",{version:"1.9.0",defaultElement:"<ul>",delay:300,options:{icons:{submenu:"ui-icon-carat-1-e"},menus:"ul",position:{my:"left top",
at:"right top"},role:"menu",blur:null,focus:null,select:null},_create:function(){this.activeMenu=this.element;this.element.uniqueId().addClass("ui-menu ui-widget ui-widget-content ui-corner-all").toggleClass("ui-menu-icons",!!this.element.find(".ui-icon").length).attr({role:this.options.role,tabIndex:0}).bind("click"+this.eventNamespace,d.proxy(function(a){this.options.disabled&&a.preventDefault()},this));this.options.disabled&&this.element.addClass("ui-state-disabled").attr("aria-disabled","true");
this._on({"mousedown .ui-menu-item > a":function(a){a.preventDefault()},"click .ui-state-disabled > a":function(a){a.preventDefault()},"click .ui-menu-item:has(a)":function(k){var c=d(k.target).closest(".ui-menu-item");!a&&c.not(".ui-state-disabled").length&&(a=!0,this.select(k),c.has(".ui-menu").length?this.expand(k):this.element.is(":focus")||(this.element.trigger("focus",[!0]),this.active&&1===this.active.parents(".ui-menu").length&&clearTimeout(this.timer)))},"mouseenter .ui-menu-item":function(a){var c=
d(a.currentTarget);c.siblings().children(".ui-state-active").removeClass("ui-state-active");this.focus(a,c)},mouseleave:"collapseAll","mouseleave .ui-menu":"collapseAll",focus:function(a,c){var b=this.active||this.element.children(".ui-menu-item").eq(0);c||this.focus(a,b)},blur:function(a){this._delay(function(){d.contains(this.element[0],this.document[0].activeElement)||this.collapseAll(a)})},keydown:"_keydown"});this.refresh();this._on(this.document,{click:function(k){d(k.target).closest(".ui-menu").length||
this.collapseAll(k);a=!1}})},_destroy:function(){this.element.removeAttr("aria-activedescendant").find(".ui-menu").andSelf().removeClass("ui-menu ui-widget ui-widget-content ui-corner-all ui-menu-icons").removeAttr("role").removeAttr("tabIndex").removeAttr("aria-labelledby").removeAttr("aria-expanded").removeAttr("aria-hidden").removeAttr("aria-disabled").removeUniqueId().show();this.element.find(".ui-menu-item").removeClass("ui-menu-item").removeAttr("role").removeAttr("aria-disabled").children("a").removeUniqueId().removeClass("ui-corner-all ui-state-hover").removeAttr("tabIndex").removeAttr("role").removeAttr("aria-haspopup").children().each(function(){var a=
d(this);a.data("ui-menu-submenu-carat")&&a.remove()});this.element.find(".ui-menu-divider").removeClass("ui-menu-divider ui-widget-content")},_keydown:function(a){function c(a){return a.replace(/[\-\[\]{}()*+?.,\\\^$|#\s]/g,"\\$&")}var b,f,g,j,m=!0;switch(a.keyCode){case d.ui.keyCode.PAGE_UP:this.previousPage(a);break;case d.ui.keyCode.PAGE_DOWN:this.nextPage(a);break;case d.ui.keyCode.HOME:this._move("first","first",a);break;case d.ui.keyCode.END:this._move("last","last",a);break;case d.ui.keyCode.UP:this.previous(a);
break;case d.ui.keyCode.DOWN:this.next(a);break;case d.ui.keyCode.LEFT:this.collapse(a);break;case d.ui.keyCode.RIGHT:this.active&&!this.active.is(".ui-state-disabled")&&this.expand(a);break;case d.ui.keyCode.ENTER:case d.ui.keyCode.SPACE:this._activate(a);break;case d.ui.keyCode.ESCAPE:this.collapse(a);break;default:(m=!1,b=this.previousFilter||"",f=String.fromCharCode(a.keyCode),g=!1,clearTimeout(this.filterTimer),f===b?g=!0:f=b+f,j=RegExp("^"+c(f),"i"),b=this.activeMenu.children(".ui-menu-item").filter(function(){return j.test(d(this).children("a").text())}),
b=g&&-1!==b.index(this.active.next())?this.active.nextAll(".ui-menu-item"):b,b.length||(f=String.fromCharCode(a.keyCode),j=RegExp("^"+c(f),"i"),b=this.activeMenu.children(".ui-menu-item").filter(function(){return j.test(d(this).children("a").text())})),b.length)?(this.focus(a,b),1<b.length?(this.previousFilter=f,this.filterTimer=this._delay(function(){delete this.previousFilter},1E3)):delete this.previousFilter):delete this.previousFilter}m&&a.preventDefault()},_activate:function(a){this.active.is(".ui-state-disabled")||
(this.active.children("a[aria-haspopup='true']").length?this.expand(a):this.select(a))},refresh:function(){var a,c=this.options.icons.submenu,b=this.element.find(this.options.menus+":not(.ui-menu)").addClass("ui-menu ui-widget ui-widget-content ui-corner-all").hide().attr({role:this.options.role,"aria-hidden":"true","aria-expanded":"false"});a=b.add(this.element);a.children(":not(.ui-menu-item):has(a)").addClass("ui-menu-item").attr("role","presentation").children("a").uniqueId().addClass("ui-corner-all").attr({tabIndex:-1,
role:this._itemRole()});a.children(":not(.ui-menu-item)").each(function(){var a=d(this);/[^\-—–\s]/.test(a.text())||a.addClass("ui-widget-content ui-menu-divider")});a.children(".ui-state-disabled").attr("aria-disabled","true");b.each(function(){var a=d(this),b=a.prev("a"),j=d("<span>").addClass("ui-menu-icon ui-icon "+c).data("ui-menu-submenu-carat",!0);b.attr("aria-haspopup","true").prepend(j);a.attr("aria-labelledby",b.attr("id"))});this.active&&!d.contains(this.element[0],this.active[0])&&this.blur()},
_itemRole:function(){return{menu:"menuitem",listbox:"option"}[this.options.role]},focus:function(a,c){var b;this.blur(a,a&&"focus"===a.type);this._scrollIntoView(c);this.active=c.first();b=this.active.children("a").addClass("ui-state-focus");this.options.role&&this.element.attr("aria-activedescendant",b.attr("id"));this.active.parent().closest(".ui-menu-item").children("a:first").addClass("ui-state-active");a&&"keydown"===a.type?this._close():this.timer=this._delay(function(){this._close()},this.delay);
b=c.children(".ui-menu");b.length&&/^mouse/.test(a.type)&&this._startOpening(b);this.activeMenu=c.parent();this._trigger("focus",a,{item:c})},_scrollIntoView:function(a){var c,b,f;this._hasScroll()&&(c=parseFloat(d.css(this.activeMenu[0],"borderTopWidth"))||0,b=parseFloat(d.css(this.activeMenu[0],"paddingTop"))||0,c=a.offset().top-this.activeMenu.offset().top-c-b,b=this.activeMenu.scrollTop(),f=this.activeMenu.height(),a=a.height(),0>c?this.activeMenu.scrollTop(b+c):c+a>f&&this.activeMenu.scrollTop(b+
c-f+a))},blur:function(a,c){c||clearTimeout(this.timer);this.active&&(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(a){var c=d.extend({of:this.active},this.options.position);clearTimeout(this.timer);this.element.find(".ui-menu").not(a.parents(".ui-menu")).hide().attr("aria-hidden",
"true");a.show().removeAttr("aria-hidden").attr("aria-expanded","true").position(c)},collapseAll:function(a,c){clearTimeout(this.timer);this.timer=this._delay(function(){var b=c?this.element:d(a&&a.target).closest(this.element.find(".ui-menu"));b.length||(b=this.element);this._close(b);this.blur(a);this.activeMenu=b},this.delay)},_close:function(a){a||(a=this.active?this.active.parent():this.element);a.find(".ui-menu").hide().attr("aria-hidden","true").attr("aria-expanded","false").end().find("a.ui-state-active").removeClass("ui-state-active")},
collapse:function(a){var c=this.active&&this.active.parent().closest(".ui-menu-item",this.element);c&&c.length&&(this._close(),this.focus(a,c))},expand:function(a){var c=this.active&&this.active.children(".ui-menu ").children(".ui-menu-item").first();c&&c.length&&(this._open(c.parent()),this._delay(function(){this.focus(a,c)}))},next:function(a){this._move("next","first",a)},previous:function(a){this._move("prev","last",a)},isFirstItem:function(){return this.active&&!this.active.prevAll(".ui-menu-item").length},
isLastItem:function(){return this.active&&!this.active.nextAll(".ui-menu-item").length},_move:function(a,c,b){var f;this.active&&(f="first"===a||"last"===a?this.active["first"===a?"prevAll":"nextAll"](".ui-menu-item").eq(-1):this.active[a+"All"](".ui-menu-item").eq(0));if(!f||!f.length||!this.active)f=this.activeMenu.children(".ui-menu-item")[c]();this.focus(b,f)},nextPage:function(a){var c,b,f;this.active?this.isLastItem()||(this._hasScroll()?(b=this.active.offset().top,f=this.element.height(),this.active.nextAll(".ui-menu-item").each(function(){c=
d(this);return 0>c.offset().top-b-f}),this.focus(a,c)):this.focus(a,this.activeMenu.children(".ui-menu-item")[!this.active?"first":"last"]())):this.next(a)},previousPage:function(a){var c,b,f;this.active?this.isFirstItem()||(this._hasScroll()?(b=this.active.offset().top,f=this.element.height(),this.active.prevAll(".ui-menu-item").each(function(){c=d(this);return 0<c.offset().top-b+f}),this.focus(a,c)):this.focus(a,this.activeMenu.children(".ui-menu-item").first())):this.next(a)},_hasScroll:function(){return this.element.outerHeight()<
this.element.prop("scrollHeight")},select:function(a){this.active=this.active||d(a.target).closest(".ui-menu-item");var c={item:this.active};this.active.has(".ui-menu").length||this.collapseAll(a,!0);this._trigger("select",a,c)}})})(l);(function(d,a){d.widget("ui.progressbar",{version:"1.9.0",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=d("<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(d){if(d===a)return this._value();this._setOption("value",
d);return this},_setOption:function(a,c){"value"===a&&(this.options.value=c,this._refreshValue(),this._value()===this.options.max&&this._trigger("complete"));this._super(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)}})})(l);(function(d){d.widget("ui.slider",d.ui.mouse,{version:"1.9.0",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,k=this.options,c=this.element.find(".ui-slider-handle").addClass("ui-state-default ui-corner-all"),b=k.values&&k.values.length||1,f=[];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"+(k.disabled?" ui-slider-disabled ui-disabled":""));this.range=d([]);if(k.range){if(!0===k.range&&(k.values||(k.values=[this._valueMin(),this._valueMin()]),k.values.length&&2!==k.values.length))k.values=[k.values[0],k.values[0]];this.range=d("<div></div>").appendTo(this.element).addClass("ui-slider-range ui-widget-header"+
("min"===k.range||"max"===k.range?" ui-slider-range-"+k.range:""))}for(a=c.length;a<b;a++)f.push("<a class='ui-slider-handle ui-state-default ui-corner-all' href='#'></a>");this.handles=c.add(d(f.join("")).appendTo(this.element));this.handle=this.handles.eq(0);this.handles.add(this.range).filter("a").click(function(a){a.preventDefault()}).mouseenter(function(){k.disabled||d(this).addClass("ui-state-hover")}).mouseleave(function(){d(this).removeClass("ui-state-hover")}).focus(function(){k.disabled?
d(this).blur():(d(".ui-slider .ui-state-focus").removeClass("ui-state-focus"),d(this).addClass("ui-state-focus"))}).blur(function(){d(this).removeClass("ui-state-focus")});this.handles.each(function(a){d(this).data("ui-slider-handle-index",a)});this._on(this.handles,{keydown:function(a){var b,c,e,f=d(a.target).data("ui-slider-handle-index");switch(a.keyCode){case d.ui.keyCode.HOME:case d.ui.keyCode.END:case d.ui.keyCode.PAGE_UP:case d.ui.keyCode.PAGE_DOWN:case d.ui.keyCode.UP:case d.ui.keyCode.RIGHT:case d.ui.keyCode.DOWN:case d.ui.keyCode.LEFT:if(a.preventDefault(),
!this._keySliding&&(this._keySliding=!0,d(a.target).addClass("ui-state-active"),b=this._start(a,f),!1===b))return}e=this.options.step;b=this.options.values&&this.options.values.length?c=this.values(f):c=this.value();switch(a.keyCode){case d.ui.keyCode.HOME:c=this._valueMin();break;case d.ui.keyCode.END:c=this._valueMax();break;case d.ui.keyCode.PAGE_UP:c=this._trimAlignValue(b+(this._valueMax()-this._valueMin())/5);break;case d.ui.keyCode.PAGE_DOWN:c=this._trimAlignValue(b-(this._valueMax()-this._valueMin())/
5);break;case d.ui.keyCode.UP:case d.ui.keyCode.RIGHT:if(b===this._valueMax())return;c=this._trimAlignValue(b+e);break;case d.ui.keyCode.DOWN:case d.ui.keyCode.LEFT:if(b===this._valueMin())return;c=this._trimAlignValue(b-e)}this._slide(a,f,c)},keyup:function(a){var b=d(a.target).data("ui-slider-handle-index");this._keySliding&&(this._keySliding=!1,this._stop(a,b),this._change(a,b),d(a.target).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");this._mouseDestroy()},_mouseCapture:function(a){var k,c,b,f,g,j=this;g=this.options;if(g.disabled)return!1;this.elementSize={width:this.element.outerWidth(),height:this.element.outerHeight()};this.elementOffset=this.element.offset();k=this._normValueFromMouse({x:a.pageX,y:a.pageY});c=this._valueMax()-this._valueMin()+1;this.handles.each(function(a){var e=
Math.abs(k-j.values(a));c>e&&(c=e,b=d(this),f=a)});!0===g.range&&this.values(1)===g.min&&(f+=1,b=d(this.handles[f]));if(!1===this._start(a,f))return!1;this._mouseSliding=!0;this._handleIndex=f;b.addClass("ui-state-active").focus();g=b.offset();this._clickOffset=!d(a.target).parents().andSelf().is(".ui-slider-handle")?{left:0,top:0}:{left:a.pageX-g.left-b.width()/2,top:a.pageY-g.top-b.height()/2-(parseInt(b.css("borderTopWidth"),10)||0)-(parseInt(b.css("borderBottomWidth"),10)||0)+(parseInt(b.css("marginTop"),
10)||0)};this.handles.hasClass("ui-state-hover")||this._slide(a,f,k);return this._animateOff=!0},_mouseStart:function(){return!0},_mouseDrag:function(a){var d=this._normValueFromMouse({x:a.pageX,y:a.pageY});this._slide(a,this._handleIndex,d);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 d;"horizontal"===this.orientation?(d=this.elementSize.width,a=a.x-this.elementOffset.left-(this._clickOffset?this._clickOffset.left:0)):(d=this.elementSize.height,a=a.y-this.elementOffset.top-(this._clickOffset?this._clickOffset.top:0));d=a/d;1<d&&(d=1);0>d&&(d=0);"vertical"===this.orientation&&(d=1-d);a=this._valueMax()-this._valueMin();return this._trimAlignValue(this._valueMin()+d*a)},_start:function(a,
d){var c={handle:this.handles[d],value:this.value()};this.options.values&&this.options.values.length&&(c.value=this.values(d),c.values=this.values());return this._trigger("start",a,c)},_slide:function(a,d,c){var b;if(this.options.values&&this.options.values.length){b=this.values(d?0:1);if(2===this.options.values.length&&!0===this.options.range&&(0===d&&c>b||1===d&&c<b))c=b;c!==this.values(d)&&(b=this.values(),b[d]=c,a=this._trigger("slide",a,{handle:this.handles[d],value:c,values:b}),this.values(d?
0:1),!1!==a&&this.values(d,c,!0))}else c!==this.value()&&(a=this._trigger("slide",a,{handle:this.handles[d],value:c}),!1!==a&&this.value(c))},_stop:function(a,d){var c={handle:this.handles[d],value:this.value()};this.options.values&&this.options.values.length&&(c.value=this.values(d),c.values=this.values());this._trigger("stop",a,c)},_change:function(a,d){if(!this._keySliding&&!this._mouseSliding){var c={handle:this.handles[d],value:this.value()};this.options.values&&this.options.values.length&&(c.value=
this.values(d),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,k){var c,b,f;if(1<arguments.length)this.options.values[a]=this._trimAlignValue(k),this._refreshValue(),this._change(null,a);else if(arguments.length)if(d.isArray(arguments[0])){c=this.options.values;b=arguments[0];for(f=0;f<c.length;f+=1)c[f]=this._trimAlignValue(b[f]),
this._change(null,f);this._refreshValue()}else return this.options.values&&this.options.values.length?this._values(a):this.value();else return this._values()},_setOption:function(a,k){var c,b=0;d.isArray(this.options.values)&&(b=this.options.values.length);d.Widget.prototype._setOption.apply(this,arguments);switch(a){case "disabled":k?(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 d,c;if(arguments.length)return d=this.options.values[a],d=this._trimAlignValue(d);d=this.options.values.slice();for(c=0;c<d.length;c+=1)d[c]=this._trimAlignValue(d[c]);return d},_trimAlignValue:function(a){if(a<=this._valueMin())return this._valueMin();if(a>=this._valueMax())return this._valueMax();var d=0<this.options.step?this.options.step:1,c=(a-this._valueMin())%d,a=a-c;2*Math.abs(c)>=d&&(a+=0<c?d:-d);return parseFloat(a.toFixed(5))},_valueMin:function(){return this.options.min},
_valueMax:function(){return this.options.max},_refreshValue:function(){var a,k,c,b,f,g=this.options.range,j=this.options,m=this,e=!this._animateOff?j.animate:!1,o={};if(this.options.values&&this.options.values.length)this.handles.each(function(b){k=100*((m.values(b)-m._valueMin())/(m._valueMax()-m._valueMin()));o["horizontal"===m.orientation?"left":"bottom"]=k+"%";d(this).stop(1,1)[e?"animate":"css"](o,j.animate);if(!0===m.options.range)if("horizontal"===m.orientation){if(0===b)m.range.stop(1,1)[e?
"animate":"css"]({left:k+"%"},j.animate);if(1===b)m.range[e?"animate":"css"]({width:k-a+"%"},{queue:!1,duration:j.animate})}else{if(0===b)m.range.stop(1,1)[e?"animate":"css"]({bottom:k+"%"},j.animate);if(1===b)m.range[e?"animate":"css"]({height:k-a+"%"},{queue:!1,duration:j.animate})}a=k});else{c=this.value();b=this._valueMin();f=this._valueMax();k=f!==b?100*((c-b)/(f-b)):0;o["horizontal"===this.orientation?"left":"bottom"]=k+"%";this.handle.stop(1,1)[e?"animate":"css"](o,j.animate);if("min"===g&&
"horizontal"===this.orientation)this.range.stop(1,1)[e?"animate":"css"]({width:k+"%"},j.animate);if("max"===g&&"horizontal"===this.orientation)this.range[e?"animate":"css"]({width:100-k+"%"},{queue:!1,duration:j.animate});if("min"===g&&"vertical"===this.orientation)this.range.stop(1,1)[e?"animate":"css"]({height:k+"%"},j.animate);if("max"===g&&"vertical"===this.orientation)this.range[e?"animate":"css"]({height:100-k+"%"},{queue:!1,duration:j.animate})}}})})(l);(function(d){function a(a){return function(){var c=
this.element.val();a.apply(this,arguments);this._refresh();c!==this.element.val()&&this._trigger("change")}}d.widget("ui.spinner",{version:"1.9.0",defaultElement:"<input>",widgetEventPrefix:"spin",options:{culture:null,icons:{down:"ui-icon-triangle-1-s",up:"ui-icon-triangle-1-n"},incremental:!0,max:null,min:null,numberFormat:null,page:10,step:1,change:null,spin:null,start:null,stop:null},_create:function(){this._setOption("max",this.options.max);this._setOption("min",this.options.min);this._setOption("step",
this.options.step);this._value(this.element.val(),!0);this._draw();this._on(this._events);this._refresh();this._on(this.window,{beforeunload:function(){this.element.removeAttr("autocomplete")}})},_getCreateOptions:function(){var a={},c=this.element;d.each(["min","max","step"],function(b,f){var g=c.attr(f);void 0!==g&&g.length&&(a[f]=g)});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.cancelBlur?delete this.cancelBlur:(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=this._delay(function(){this.spinning&&this._stop(a)},100);a.preventDefault()}},"mousedown .ui-spinner-button":function(a){function c(){this.element[0]!==
this.document[0].activeElement&&(this.element.focus(),this.previous=b,this._delay(function(){this.previous=b}))}var b;b=this.element[0]===this.document[0].activeElement?this.previous:this.element.val();a.preventDefault();c.call(this);this.cancelBlur=!0;this._delay(function(){delete this.cancelBlur;c.call(this)});!1!==this._start(a)&&this._repeat(null,d(a.currentTarget).hasClass("ui-spinner-up")?1:-1,a)},"mouseup .ui-spinner-button":"_stop","mouseenter .ui-spinner-button":function(a){if(d(a.currentTarget).hasClass("ui-state-active")){if(!1===
this._start(a))return!1;this._repeat(null,d(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()>Math.ceil(0.5*
a.height())&&0<a.height()&&a.height(a.height());this.options.disabled&&this.disable()},_keydown:function(a){var c=this.options,b=d.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 "+
this.options.icons.up+"'>&#9650;</span></a><a class='ui-spinner-button ui-spinner-down ui-corner-br'><span class='ui-icon "+this.options.icons.down+"'>&#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?d.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){if("culture"===a||"numberFormat"===a){var b=this._parse(this.element.val());this.options[a]=
c;this.element.val(this._format(b))}else{if("max"===a||"min"===a||"step"===a)"string"===typeof c&&(c=this._parse(c));this._super(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(a);this._value(this.element.val())}),_parse:function(a){"string"===typeof a&&""!==a&&(a=window.Globalize&&this.options.numberFormat?Globalize.parseFloat(a,10,this.options.culture):
+a);return""===a||isNaN(a)?null:a},_format:function(a){return""===a?"":window.Globalize&&this.options.numberFormat?Globalize.format(a,this.options.numberFormat,this.options.culture):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.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(d){if(!arguments.length)return this._parse(this.element.val());a(this._value).call(this,d)},widget:function(){return this.uiSpinner}})})(l);(function(d,a){function k(a){a=a.cloneNode(!1);return 1<a.hash.length&&a.href.replace(b,"")===location.href.replace(b,"")}var c=0,b=/#.*$/;d.widget("ui.tabs",{version:"1.9.0",delay:300,options:{active:null,collapsible:!1,event:"click",heightStyle:"content",hide:null,show:null,activate:null,beforeActivate:null,beforeLoad:null,load:null},_create:function(){var a=
this,b=this.options,c=b.active;this.running=!1;this.element.addClass("ui-tabs ui-widget ui-widget-content ui-corner-all").toggleClass("ui-tabs-collapsible",b.collapsible).delegate(".ui-tabs-nav > li","mousedown"+this.eventNamespace,function(a){d(this).is(".ui-state-disabled")&&a.preventDefault()}).delegate(".ui-tabs-anchor","focus"+this.eventNamespace,function(){d(this).closest("li").is(".ui-state-disabled")&&this.blur()});this._processTabs();if(null===c&&(location.hash&&this.anchors.each(function(a,
b){if(b.hash===location.hash)return c=a,!1}),null===c&&(c=this.tabs.filter(".ui-tabs-active").index()),null===c||-1===c))c=this.tabs.length?0:!1;!1!==c&&(c=this.tabs.index(this.tabs.eq(c)),-1===c&&(c=b.collapsible?!1:0));b.active=c;!b.collapsible&&(!1===b.active&&this.anchors.length)&&(b.active=0);d.isArray(b.disabled)&&(b.disabled=d.unique(b.disabled.concat(d.map(this.tabs.filter(".ui-state-disabled"),function(b){return a.tabs.index(b)}))).sort());this.active=!1!==this.options.active&&this.anchors.length?
this._findActive(this.options.active):d();this._refresh();this.active.length&&this.load(b.active)},_getCreateEventData:function(){return{tab:this.active,panel:!this.active.length?d():this._getPanelForTab(this.active)}},_tabKeydown:function(a){var b=d(this.document[0].activeElement).closest("li"),c=this.tabs.index(b),m=!0;if(!this._handlePageNav(a)){switch(a.keyCode){case d.ui.keyCode.RIGHT:case d.ui.keyCode.DOWN:c++;break;case d.ui.keyCode.UP:case d.ui.keyCode.LEFT:m=!1;c--;break;case d.ui.keyCode.END:c=
this.anchors.length-1;break;case d.ui.keyCode.HOME:c=0;break;case d.ui.keyCode.SPACE:a.preventDefault();clearTimeout(this.activating);this._activate(c);return;case d.ui.keyCode.ENTER:a.preventDefault();clearTimeout(this.activating);this._activate(c===this.options.active?!1:c);return;default:return}a.preventDefault();clearTimeout(this.activating);c=this._focusNextTab(c,m);a.ctrlKey||(b.attr("aria-selected","false"),this.tabs.eq(c).attr("aria-selected","true"),this.activating=this._delay(function(){this.option("active",
c)},this.delay))}},_panelKeydown:function(a){!this._handlePageNav(a)&&(a.ctrlKey&&a.keyCode===d.ui.keyCode.UP)&&(a.preventDefault(),this.active.focus())},_handlePageNav:function(a){if(a.altKey&&a.keyCode===d.ui.keyCode.PAGE_UP)return this._activate(this._focusNextTab(this.options.active-1,!1)),!0;if(a.altKey&&a.keyCode===d.ui.keyCode.PAGE_DOWN)return this._activate(this._focusNextTab(this.options.active+1,!0)),!0},_findNextTab:function(a,b){function c(){a>m&&(a=0);0>a&&(a=m);return a}for(var m=this.tabs.length-
1;-1!==d.inArray(c(),this.options.disabled);)a=b?a+1:a-1;return a},_focusNextTab:function(a,b){a=this._findNextTab(a,b);this.tabs.eq(a).focus();return a},_setOption:function(a,b){"active"===a?this._activate(b):"disabled"===a?this._setupDisabled(b):(this._super(a,b),"collapsible"===a&&(this.element.toggleClass("ui-tabs-collapsible",b),!b&&!1===this.options.active&&this._activate(0)),"event"===a&&this._setupEvents(b),"heightStyle"===a&&this._setupHeightStyle(b))},_tabId:function(a){return a.attr("aria-controls")||
"ui-tabs-"+ ++c},_sanitizeSelector:function(a){return a?a.replace(/[!"$%&'()*+,.\/:;<=>?@\[\]\^`{|}~]/g,"\\$&"):""},refresh:function(){var a=this.options,b=this.tablist.children(":has(a[href])");a.disabled=d.map(b.filter(".ui-state-disabled"),function(a){return b.index(a)});this._processTabs();!1===a.active||!this.anchors.length?(a.active=!1,this.active=d()):this.active.length&&!d.contains(this.tablist[0],this.active[0])?this.tabs.length===a.disabled.length?(a.active=!1,this.active=d()):this._activate(this._findNextTab(Math.max(0,
a.active-1),!1)):a.active=this.tabs.index(this.active);this._refresh()},_refresh:function(){this._setupDisabled(this.options.disabled);this._setupEvents(this.options.event);this._setupHeightStyle(this.options.heightStyle);this.tabs.not(this.active).attr({"aria-selected":"false",tabIndex:-1});this.panels.not(this._getPanelForTab(this.active)).hide().attr({"aria-expanded":"false","aria-hidden":"true"});this.active.length?(this.active.addClass("ui-tabs-active ui-state-active").attr({"aria-selected":"true",
tabIndex:0}),this._getPanelForTab(this.active).show().attr({"aria-expanded":"true","aria-hidden":"false"})):this.tabs.eq(0).attr("tabIndex",0)},_processTabs:function(){var a=this;this.tablist=this._getList().addClass("ui-tabs-nav ui-helper-reset ui-helper-clearfix ui-widget-header ui-corner-all").attr("role","tablist");this.tabs=this.tablist.find("> li:has(a[href])").addClass("ui-state-default ui-corner-top").attr({role:"tab",tabIndex:-1});this.anchors=this.tabs.map(function(){return d("a",this)[0]}).addClass("ui-tabs-anchor").attr({role:"presentation",
tabIndex:-1});this.panels=d();this.anchors.each(function(b,c){var m,e,o,n=d(c).uniqueId().attr("id"),l=d(c).closest("li"),p=l.attr("aria-controls");k(c)?(m=c.hash,e=a.element.find(a._sanitizeSelector(m))):(o=a._tabId(l),m="#"+o,e=a.element.find(m),e.length||(e=a._createPanel(o),e.insertAfter(a.panels[b-1]||a.tablist)),e.attr("aria-live","polite"));e.length&&(a.panels=a.panels.add(e));p&&l.data("ui-tabs-aria-controls",p);l.attr({"aria-controls":m.substring(1),"aria-labelledby":n});e.attr("aria-labelledby",
n)});this.panels.addClass("ui-tabs-panel ui-widget-content ui-corner-bottom").attr("role","tabpanel")},_getList:function(){return this.element.find("ol,ul").eq(0)},_createPanel:function(a){return d("<div>").attr("id",a).addClass("ui-tabs-panel ui-widget-content ui-corner-bottom").data("ui-tabs-destroy",!0)},_setupDisabled:function(a){d.isArray(a)&&(a.length?a.length===this.anchors.length&&(a=!0):a=!1);for(var b=0,c;c=this.tabs[b];b++)!0===a||-1!==d.inArray(b,a)?d(c).addClass("ui-state-disabled").attr("aria-disabled",
"true"):d(c).removeClass("ui-state-disabled").removeAttr("aria-disabled");this.options.disabled=a},_setupEvents:function(a){var b={click:function(a){a.preventDefault()}};a&&d.each(a.split(" "),function(a,c){b[c]="_eventHandler"});this._off(this.anchors.add(this.tabs).add(this.panels));this._on(this.anchors,b);this._on(this.tabs,{keydown:"_tabKeydown"});this._on(this.panels,{keydown:"_panelKeydown"});this._focusable(this.tabs);this._hoverable(this.tabs)},_setupHeightStyle:function(a){var b,c,m=this.element.parent();
"fill"===a?(d.support.minHeight||(c=m.css("overflow"),m.css("overflow","hidden")),b=m.height(),this.element.siblings(":visible").each(function(){var a=d(this),c=a.css("position");c==="absolute"||c==="fixed"||(b=b-a.outerHeight(true))}),c&&m.css("overflow",c),this.element.children().not(this.panels).each(function(){b=b-d(this).outerHeight(true)}),this.panels.each(function(){d(this).height(Math.max(0,b-d(this).innerHeight()+d(this).height()))}).css("overflow","auto")):"auto"===a&&(b=0,this.panels.each(function(){b=
Math.max(b,d(this).height("").height())}).height(b))},_eventHandler:function(a){var b=this.options,c=this.active,m=d(a.currentTarget).closest("li"),e=m[0]===c[0],k=e&&b.collapsible,n=k?d():this._getPanelForTab(m),l=!c.length?d():this._getPanelForTab(c),c={oldTab:c,oldPanel:l,newTab:k?d():m,newPanel:n};a.preventDefault();if(!m.hasClass("ui-state-disabled")&&!m.hasClass("ui-tabs-loading")&&!this.running&&!(e&&!b.collapsible||!1===this._trigger("beforeActivate",a,c)))b.active=k?!1:this.tabs.index(m),
this.active=e?d():m,this.xhr&&this.xhr.abort(),!l.length&&!n.length&&d.error("jQuery UI Tabs: Mismatching fragment identifier."),n.length&&this.load(this.tabs.index(m),a),this._toggle(a,c)},_toggle:function(a,b){function c(){e.running=!1;e._trigger("activate",a,b)}function m(){b.newTab.closest("li").addClass("ui-tabs-active ui-state-active");k.length&&e.options.show?e._show(k,e.options.show,c):(k.show(),c())}var e=this,k=b.newPanel,n=b.oldPanel;this.running=!0;n.length&&this.options.hide?this._hide(n,
this.options.hide,function(){b.oldTab.closest("li").removeClass("ui-tabs-active ui-state-active");m()}):(b.oldTab.closest("li").removeClass("ui-tabs-active ui-state-active"),n.hide(),m());n.attr({"aria-expanded":"false","aria-hidden":"true"});b.oldTab.attr("aria-selected","false");k.length&&n.length?b.oldTab.attr("tabIndex",-1):k.length&&this.tabs.filter(function(){return d(this).attr("tabIndex")===0}).attr("tabIndex",-1);k.attr({"aria-expanded":"true","aria-hidden":"false"});b.newTab.attr({"aria-selected":"true",
tabIndex:0})},_activate:function(a){a=this._findActive(a);a[0]!==this.active[0]&&(a.length||(a=this.active),a=a.find(".ui-tabs-anchor")[0],this._eventHandler({target:a,currentTarget:a,preventDefault:d.noop}))},_findActive:function(a){return!1===a?d():this.tabs.eq(a)},_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.tablist.removeClass("ui-tabs-nav ui-helper-reset ui-helper-clearfix ui-widget-header ui-corner-all").removeAttr("role");this.anchors.removeClass("ui-tabs-anchor").removeAttr("role").removeAttr("tabIndex").removeData("href.tabs").removeData("load.tabs").removeUniqueId();this.tabs.add(this.panels).each(function(){d.data(this,"ui-tabs-destroy")?d(this).remove():d(this).removeClass("ui-state-default ui-state-active ui-state-disabled ui-corner-top ui-corner-bottom ui-widget-content ui-tabs-active ui-tabs-panel").removeAttr("tabIndex").removeAttr("aria-live").removeAttr("aria-busy").removeAttr("aria-selected").removeAttr("aria-labelledby").removeAttr("aria-hidden").removeAttr("aria-expanded").removeAttr("role")});
this.tabs.each(function(){var a=d(this),b=a.data("ui-tabs-aria-controls");b?a.attr("aria-controls",b):a.removeAttr("aria-controls")});"content"!==this.options.heightStyle&&this.panels.css("height","")},enable:function(b){var c=this.options.disabled;!1!==c&&(b===a?c=!1:(b=this._getIndex(b),c=d.isArray(c)?d.map(c,function(a){return a!==b?a:null}):d.map(this.tabs,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!==d.inArray(b,c))return;c=d.isArray(c)?d.merge([b],c).sort():[b]}this._setupDisabled(c)}},load:function(a,b){var a=this._getIndex(a),c=this,m=this.tabs.eq(a),e=m.find(".ui-tabs-anchor"),o=this._getPanelForTab(m),n={tab:m,panel:o};if(!k(e[0])&&(this.xhr=d.ajax(this._ajaxSettings(e,b,n)))&&"canceled"!==this.xhr.statusText)m.addClass("ui-tabs-loading"),o.attr("aria-busy","true"),this.xhr.success(function(a){setTimeout(function(){o.html(a);c._trigger("load",b,n)},1)}).complete(function(a,
b){setTimeout(function(){"abort"===b&&c.panels.stop(!1,!0);m.removeClass("ui-tabs-loading");o.removeAttr("aria-busy");a===c.xhr&&delete c.xhr},1)})},_ajaxSettings:function(a,b,c){var m=this;return{url:a.attr("href"),beforeSend:function(a,f){return m._trigger("beforeLoad",b,d.extend({jqXHR:a,ajaxSettings:f},c))}}},_getPanelForTab:function(a){return this.element.find(this._sanitizeSelector("#"+d(a).attr("aria-controls")))}});!1!==d.uiBackCompat&&(d.ui.tabs.prototype._ui=function(a,b){return{tab:a,panel:b,
index:this.anchors.index(a)}},d.widget("ui.tabs",d.ui.tabs,{url:function(a,b){this.anchors.eq(a).attr("href",b)}}),d.widget("ui.tabs",d.ui.tabs,{options:{ajaxOptions:null,cache:!1},_create:function(){this._super();var a=this;this._on({tabsbeforeload:function(b,c){d.data(c.tab[0],"cache.tabs")?b.preventDefault():c.jqXHR.success(function(){a.options.cache&&d.data(c.tab[0],"cache.tabs",!0)})}})},_ajaxSettings:function(a,b,c){var m=this.options.ajaxOptions;return d.extend({},m,{error:function(a,b){try{m.error(a,
b,c.tab.closest("li").index(),c.tab[0])}catch(f){}}},this._superApply(arguments))},_setOption:function(a,b){"cache"===a&&!1===b&&this.anchors.removeData("cache.tabs");this._super(a,b)},_destroy:function(){this.anchors.removeData("cache.tabs");this._super()},url:function(a,b){this.anchors.eq(a).removeData("cache.tabs");this._superApply(arguments)}}),d.widget("ui.tabs",d.ui.tabs,{abort:function(){this.xhr&&this.xhr.abort()}}),d.widget("ui.tabs",d.ui.tabs,{options:{spinner:"<em>Loading&#8230;</em>"},
_create:function(){this._super();this._on({tabsbeforeload:function(a,b){if(a.target===this.element[0]&&this.options.spinner){var c=b.tab.find("span"),d=c.html();c.html(this.options.spinner);b.jqXHR.complete(function(){c.html(d)})}}})}}),d.widget("ui.tabs",d.ui.tabs,{options:{enable:null,disable:null},enable:function(a){var b=this.options,c;if(a&&!0===b.disabled||d.isArray(b.disabled)&&-1!==d.inArray(a,b.disabled))c=!0;this._superApply(arguments);c&&this._trigger("enable",null,this._ui(this.anchors[a],
this.panels[a]))},disable:function(a){var b=this.options,c;if(a&&!1===b.disabled||d.isArray(b.disabled)&&-1===d.inArray(a,b.disabled))c=!0;this._superApply(arguments);c&&this._trigger("disable",null,this._ui(this.anchors[a],this.panels[a]))}}),d.widget("ui.tabs",d.ui.tabs,{options:{add:null,remove:null,tabTemplate:"<li><a href='#{href}'><span>#{label}</span></a></li>"},add:function(b,c,j){j===a&&(j=this.anchors.length);var m,e=this.options,c=d(e.tabTemplate.replace(/#\{href\}/g,b).replace(/#\{label\}/g,
c)),k=!b.indexOf("#")?b.replace("#",""):this._tabId(c);c.addClass("ui-state-default ui-corner-top").data("ui-tabs-destroy",!0);c.attr("aria-controls",k);b=j>=this.tabs.length;m=this.element.find("#"+k);m.length||(m=this._createPanel(k),b?0<j?m.insertAfter(this.panels.eq(-1)):m.appendTo(this.element):m.insertBefore(this.panels[j]));m.addClass("ui-tabs-panel ui-widget-content ui-corner-bottom").hide();b?c.appendTo(this.tablist):c.insertBefore(this.tabs[j]);e.disabled=d.map(e.disabled,function(a){return a>=
j?++a:a});this.refresh();1===this.tabs.length&&!1===e.active&&this.option("active",0);this._trigger("add",null,this._ui(this.anchors[j],this.panels[j]));return this},remove:function(a){var a=this._getIndex(a),b=this.options,c=this.tabs.eq(a).remove(),m=this._getPanelForTab(c).remove();c.hasClass("ui-tabs-active")&&2<this.anchors.length&&this._activate(a+(a+1<this.anchors.length?1:-1));b.disabled=d.map(d.grep(b.disabled,function(b){return b!==a}),function(b){return b>=a?--b:b});this.refresh();this._trigger("remove",
null,this._ui(c.find("a")[0],m[0]));return this}}),d.widget("ui.tabs",d.ui.tabs,{length:function(){return this.anchors.length}}),d.widget("ui.tabs",d.ui.tabs,{options:{idPrefix:"ui-tabs-"},_tabId:function(a){a=a.is("li")?a.find("a[href]"):a;a=a[0];return d(a).closest("li").attr("aria-controls")||a.title&&a.title.replace(/\s/g,"_").replace(/[^\w\u00c0-\uFFFF\-]/g,"")||this.options.idPrefix+ ++c}}),d.widget("ui.tabs",d.ui.tabs,{options:{panelTemplate:"<div></div>"},_createPanel:function(a){return d(this.options.panelTemplate).attr("id",
a).addClass("ui-tabs-panel ui-widget-content ui-corner-bottom").data("ui-tabs-destroy",!0)}}),d.widget("ui.tabs",d.ui.tabs,{_create:function(){var b=this.options;null===b.active&&b.selected!==a&&(b.active=-1===b.selected?!1:b.selected);this._super();b.selected=b.active;!1===b.selected&&(b.selected=-1)},_setOption:function(a,b){if("selected"!==a)return this._super(a,b);var c=this.options;this._super("active",-1===b?!1:b);c.selected=c.active;!1===c.selected&&(c.selected=-1)},_eventHandler:function(a){this._superApply(arguments);
this.options.selected=this.options.active;!1===this.options.selected&&(this.options.selected=-1)}}),d.widget("ui.tabs",d.ui.tabs,{options:{show:null,select:null},_create:function(){this._super();!1!==this.options.active&&this._trigger("show",null,this._ui(this.active.find(".ui-tabs-anchor")[0],this._getPanelForTab(this.active)[0]))},_trigger:function(a,b,c){var d=this._superApply(arguments);if(!d)return!1;"beforeActivate"===a&&c.newTab.length?d=this._super("select",b,{tab:c.newTab.find(".ui-tabs-anchor")[0],
panel:c.newPanel[0],index:c.newTab.closest("li").index()}):"activate"===a&&c.newTab.length&&(d=this._super("show",b,{tab:c.newTab.find(".ui-tabs-anchor")[0],panel:c.newPanel[0],index:c.newTab.closest("li").index()}));return d}}),d.widget("ui.tabs",d.ui.tabs,{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+this.eventNamespace)}}),function(){var a=0;d.widget("ui.tabs",
d.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()},_cookie:function(b){var c=[this.cookie||(this.cookie=this.options.cookie.name||"ui-tabs-"+ ++a)];arguments.length&&(c.push(!1===b?-1:b),c.push(this.options.cookie));return d.cookie.apply(null,c)},_refresh:function(){this._super();this.options.cookie&&this._cookie(this.options.active,this.options.cookie)},_eventHandler:function(a){this._superApply(arguments);
this.options.cookie&&this._cookie(this.options.active,this.options.cookie)},_destroy:function(){this._super();this.options.cookie&&this._cookie(null,this.options.cookie)}})}(),d.widget("ui.tabs",d.ui.tabs,{_trigger:function(a,b,c){c=d.extend({},c);"load"===a&&(c.panel=c.panel[0],c.tab=c.tab.find(".ui-tabs-anchor")[0]);return this._super(a,b,c)}}),d.widget("ui.tabs",d.ui.tabs,{options:{fx:null},_getFx:function(){var a,b,c=this.options.fx;c&&(d.isArray(c)?(a=c[0],b=c[1]):a=b=c);return c?{show:b,hide:a}:
null},_toggle:function(a,b){function c(){e.running=!1;e._trigger("activate",a,b)}function d(){b.newTab.closest("li").addClass("ui-tabs-active ui-state-active");k.length&&l.show?k.animate(l.show,l.show.duration,function(){c()}):(k.show(),c())}var e=this,k=b.newPanel,n=b.oldPanel,l=this._getFx();if(!l)return this._super(a,b);e.running=!0;n.length&&l.hide?n.animate(l.hide,l.hide.duration,function(){b.oldTab.closest("li").removeClass("ui-tabs-active ui-state-active");d()}):(b.oldTab.closest("li").removeClass("ui-tabs-active ui-state-active"),
n.hide(),d())}}))})(l);(function(d){function a(a,c){var g=(a.attr("aria-describedby")||"").split(/\s+/);g.push(c);a.data("ui-tooltip-id",c).attr("aria-describedby",d.trim(g.join(" ")))}function k(a){var c=a.data("ui-tooltip-id"),g=(a.attr("aria-describedby")||"").split(/\s+/),c=d.inArray(c,g);-1!==c&&g.splice(c,1);a.removeData("ui-tooltip-id");(g=d.trim(g.join(" ")))?a.attr("aria-describedby",g):a.removeAttr("aria-describedby")}var c=0;d.widget("ui.tooltip",{version:"1.9.0",options:{content:function(){return d(this).attr("title")},
hide:!0,items:"[title]",position:{my:"left+15 center",at:"right center",collision:"flipfit flipfit"},show:!0,tooltipClass:null,track:!1,close:null,open:null},_create:function(){this._on({mouseover:"open",focusin:"open"});this.tooltips={}},_setOption:function(a,c){var g=this;"disabled"===a?(this[c?"_disable":"_enable"](),this.options[a]=c):(this._super(a,c),"content"===a&&d.each(this.tooltips,function(a,b){g._updateContent(b)}))},_disable:function(){var a=this;d.each(this.tooltips,function(c,g){var j=
d.Event("blur");j.target=j.currentTarget=g[0];a.close(j,!0)});this.element.find(this.options.items).andSelf().each(function(){var a=d(this);a.is("[title]")&&a.data("ui-tooltip-title",a.attr("title")).attr("title","")})},_enable:function(){this.element.find(this.options.items).andSelf().each(function(){var a=d(this);a.data("ui-tooltip-title")&&a.attr("title",a.data("ui-tooltip-title"))})},open:function(a){var c=d(a?a.target:this.element).closest(this.options.items);c.length&&(this.options.track&&c.data("ui-tooltip-id")?
(this._find(c).position(d.extend({of:c},this.options.position)),this._off(this.document,"mousemove")):(c.attr("title")&&c.data("ui-tooltip-title",c.attr("title")),c.data("tooltip-open",!0),this._updateContent(c,a)))},_updateContent:function(a,c){var g;g=this.options.content;var d=this;if("string"===typeof g)return this._open(c,a,g);(g=g.call(a[0],function(g){a.data("tooltip-open")&&d._delay(function(){this._open(c,a,g)})}))&&this._open(c,a,g)},_open:function(b,c,g){function j(a){e.of=a;m.position(e)}
var m,e;g&&(m=this._find(c),m.length?m.find(".ui-tooltip-content").html(g):(c.is("[title]")&&(b&&"mouseover"===b.type?c.attr("title",""):c.removeAttr("title")),m=this._tooltip(c),a(c,m.attr("id")),m.find(".ui-tooltip-content").html(g),this.options.track&&b&&/^mouse/.test(b.originalEvent.type)?(e=d.extend({},this.options.position),this._on(this.document,{mousemove:j}),j(b)):m.position(d.extend({of:c},this.options.position)),m.hide(),this._show(m,this.options.show),this._trigger("open",b,{tooltip:m}),
this._on(c,{mouseleave:"close",focusout:"close",keyup:function(a){if(a.keyCode===d.ui.keyCode.ESCAPE){a=d.Event(a);a.currentTarget=c[0];this.close(a,true)}}})))},close:function(a,c){var g=this,j=d(a?a.currentTarget:this.element),m=this._find(j);if(!this.closing&&(c||!a||!("focusout"!==a.type&&this.document[0].activeElement===j[0])))j.data("ui-tooltip-title")&&j.attr("title",j.data("ui-tooltip-title")),k(j),m.stop(!0),this._hide(m,this.options.hide,function(){d(this).remove();delete g.tooltips[this.id]}),
j.removeData("tooltip-open"),this._off(j,"mouseleave focusout keyup"),this._off(this.document,"mousemove"),this.closing=!0,this._trigger("close",a,{tooltip:m}),this.closing=!1},_tooltip:function(a){var f="ui-tooltip-"+c++,g=d("<div>").attr({id:f,role:"tooltip"}).addClass("ui-tooltip ui-widget ui-corner-all ui-widget-content "+(this.options.tooltipClass||""));d("<div>").addClass("ui-tooltip-content").appendTo(g);g.appendTo(this.document[0].body);d.fn.bgiframe&&g.bgiframe();this.tooltips[f]=a;return g},
_find:function(a){return(a=a.data("ui-tooltip-id"))?d("#"+a):d()},_destroy:function(){var a=this;d.each(this.tooltips,function(c,g){var j=d.Event("blur");j.target=j.currentTarget=g[0];a.close(j,!0);d("#"+c).remove();g.data("ui-tooltip-title")&&(g.attr("title",g.data("ui-tooltip-title")),g.removeData("ui-tooltip-title"))})}})})(l);l.effects||function(d,a){var k=!1!==d.uiBackCompat;d.effects={effect:{}};(function(a,b){function f(a,b,c){var e=l[b.type]||{};if(null==a)return c||!b.def?null:b.def;a=e.floor?
~~a:parseFloat(a);return isNaN(a)?b.def:e.mod?(a+e.mod)%e.mod:0>a?0:e.max<a?e.max:a}function g(b){var f=k(),g=f._rgba=[],b=b.toLowerCase();u(e,function(a,c){var e,d=c.re.exec(b);e=d&&c.parse(d);d=c.space||"rgba";if(e)return e=f[d](e),f[n[d].cache]=e[n[d].cache],g=f._rgba=e._rgba,!1});return g.length?("0,0,0,0"===g.join()&&a.extend(g,s.transparent),f):s[b]}function j(a,b,c){c=(c+1)%1;return 1>6*c?a+6*(b-a)*c:1>2*c?b:2>3*c?a+6*(b-a)*(2/3-c):a}var m=/^([\-+])=\s*(\d+\.?\d*)/,e=[{re:/rgba?\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*(?:,\s*(\d+(?:\.\d+)?)\s*)?\)/,
parse:function(a){return[a[1],a[2],a[3],a[4]]}},{re:/rgba?\(\s*(\d+(?:\.\d+)?)\%\s*,\s*(\d+(?:\.\d+)?)\%\s*,\s*(\d+(?:\.\d+)?)\%\s*(?:,\s*(\d+(?:\.\d+)?)\s*)?\)/,parse:function(a){return[2.55*a[1],2.55*a[2],2.55*a[3],a[4]]}},{re:/#([a-f0-9]{2})([a-f0-9]{2})([a-f0-9]{2})/,parse:function(a){return[parseInt(a[1],16),parseInt(a[2],16),parseInt(a[3],16)]}},{re:/#([a-f0-9])([a-f0-9])([a-f0-9])/,parse:function(a){return[parseInt(a[1]+a[1],16),parseInt(a[2]+a[2],16),parseInt(a[3]+a[3],16)]}},{re:/hsla?\(\s*(\d+(?:\.\d+)?)\s*,\s*(\d+(?:\.\d+)?)\%\s*,\s*(\d+(?:\.\d+)?)\%\s*(?:,\s*(\d+(?:\.\d+)?)\s*)?\)/,
space:"hsla",parse:function(a){return[a[1],a[2]/100,a[3]/100,a[4]]}}],k=a.Color=function(b,e,f,g){return new a.Color.fn.parse(b,e,f,g)},n={rgba:{props:{red:{idx:0,type:"byte"},green:{idx:1,type:"byte"},blue:{idx:2,type:"byte"}}},hsla:{props:{hue:{idx:0,type:"degrees"},saturation:{idx:1,type:"percent"},lightness:{idx:2,type:"percent"}}}},l={"byte":{floor:!0,max:255},percent:{max:1},degrees:{mod:360,floor:!0}},p=k.support={},q=a("<p>")[0],s,u=a.each;q.style.cssText="background-color:rgba(1,1,1,.5)";
p.rgba=-1<q.style.backgroundColor.indexOf("rgba");u(n,function(a,b){b.cache="_"+a;b.props.alpha={idx:3,type:"percent",def:1}});k.fn=a.extend(k.prototype,{parse:function(e,j,m,q){if(e===b)return this._rgba=[null,null,null,null],this;if(e.jquery||e.nodeType)e=a(e).css(j),j=b;var p=this,l=a.type(e),r=this._rgba=[];j!==b&&(e=[e,j,m,q],l="array");if("string"===l)return this.parse(g(e)||s._default);if("array"===l)return u(n.rgba.props,function(a,b){r[b.idx]=f(e[b.idx],b)}),this;if("object"===l)return e instanceof
k?u(n,function(a,b){e[b.cache]&&(p[b.cache]=e[b.cache].slice())}):u(n,function(a,b){var c=b.cache;u(b.props,function(a,g){if(!p[c]&&b.to){if(a==="alpha"||e[a]==null)return;p[c]=b.to(p._rgba)}p[c][g.idx]=f(e[a],g,true)});if(p[c]&&d.inArray(null,p[c].slice(0,3))<0){p[c][3]=1;if(b.from)p._rgba=b.from(p[c])}}),this},is:function(a){var b=k(a),c=!0,e=this;u(n,function(a,f){var g,d=b[f.cache];d&&(g=e[f.cache]||f.to&&f.to(e._rgba)||[],u(f.props,function(a,b){if(null!=d[b.idx])return c=d[b.idx]===g[b.idx]}));
return c});return c},_space:function(){var a=[],b=this;u(n,function(c,e){b[e.cache]&&a.push(c)});return a.pop()},transition:function(a,b){var c=k(a),e=c._space(),g=n[e],d=0===this.alpha()?k("transparent"):this,j=d[g.cache]||g.to(d._rgba),m=j.slice(),c=c[g.cache];u(g.props,function(a,e){var g=e.idx,d=j[g],k=c[g],n=l[e.type]||{};null!==k&&(null===d?m[g]=k:(n.mod&&(k-d>n.mod/2?d+=n.mod:d-k>n.mod/2&&(d-=n.mod)),m[g]=f((k-d)*b+d,e)))});return this[e](m)},blend:function(b){if(1===this._rgba[3])return this;
var e=this._rgba.slice(),f=e.pop(),g=k(b)._rgba;return k(a.map(e,function(a,b){return(1-f)*g[b]+f*a}))},toRgbaString:function(){var b="rgba(",e=a.map(this._rgba,function(a,b){return null==a?2<b?1:0:a});1===e[3]&&(e.pop(),b="rgb(");return b+e.join()+")"},toHslaString:function(){var b="hsla(",e=a.map(this.hsla(),function(a,b){null==a&&(a=2<b?1:0);b&&3>b&&(a=Math.round(100*a)+"%");return a});1===e[3]&&(e.pop(),b="hsl(");return b+e.join()+")"},toHexString:function(b){var e=this._rgba.slice(),f=e.pop();
b&&e.push(~~(255*f));return"#"+a.map(e,function(a){a=(a||0).toString(16);return 1===a.length?"0"+a:a}).join("")},toString:function(){return 0===this._rgba[3]?"transparent":this.toRgbaString()}});k.fn.parse.prototype=k.fn;n.hsla.to=function(a){if(null==a[0]||null==a[1]||null==a[2])return[null,null,null,a[3]];var b=a[0]/255,c=a[1]/255,e=a[2]/255,a=a[3],f=Math.max(b,c,e),g=Math.min(b,c,e),d=f-g,j=f+g,m=0.5*j;return[Math.round(g===f?0:b===f?60*(c-e)/d+360:c===f?60*(e-b)/d+120:60*(b-c)/d+240)%360,0===
m||1===m?m:0.5>=m?d/j:d/(2-j),m,null==a?1:a]};n.hsla.from=function(a){if(null==a[0]||null==a[1]||null==a[2])return[null,null,null,a[3]];var b=a[0]/360,c=a[1],e=a[2],a=a[3],c=0.5>=e?e*(1+c):e+c-e*c,e=2*e-c;return[Math.round(255*j(e,c,b+1/3)),Math.round(255*j(e,c,b)),Math.round(255*j(e,c,b-1/3)),a]};u(n,function(e,g){var d=g.props,j=g.cache,n=g.to,q=g.from;k.fn[e]=function(e){n&&!this[j]&&(this[j]=n(this._rgba));if(e===b)return this[j].slice();var g,m=a.type(e),p="array"===m||"object"===m?e:arguments,
l=this[j].slice();u(d,function(a,b){var c=p["object"===m?a:b.idx];null==c&&(c=l[b.idx]);l[b.idx]=f(c,b)});return q?(g=k(q(l)),g[j]=l,g):k(l)};u(d,function(b,f){k.fn[b]||(k.fn[b]=function(g){var d=a.type(g),j="alpha"===b?this._hsla?"hsla":"rgba":e,k=this[j](),n=k[f.idx];if("undefined"===d)return n;"function"===d&&(g=g.call(this,n),d=a.type(g));if(null==g&&f.empty)return this;"string"===d&&(d=m.exec(g))&&(g=n+parseFloat(d[2])*("+"===d[1]?1:-1));k[f.idx]=g;return this[j](k)})})});u("backgroundColor borderBottomColor borderLeftColor borderRightColor borderTopColor color columnRuleColor outlineColor textDecorationColor textEmphasisColor".split(" "),
function(b,e){a.cssHooks[e]={set:function(b,f){var d,j="";if(a.type(f)!=="string"||(d=g(f))){f=k(d||f);if(!p.rgba&&f._rgba[3]!==1){for(d=e==="backgroundColor"?b.parentNode:b;(j===""||j==="transparent")&&d&&d.style;)try{j=a.css(d,"backgroundColor");d=d.parentNode}catch(m){}f=f.blend(j&&j!=="transparent"?j:"_default")}f=f.toRgbaString()}try{b.style[e]=f}catch(n){}}};a.fx.step[e]=function(b){if(!b.colorInit){b.start=k(b.elem,e);b.end=k(b.end);b.colorInit=true}a.cssHooks[e].set(b.elem,b.start.transition(b.end,
b.pos))}});a.cssHooks.borderColor={expand:function(a){var b={};u(["Top","Right","Bottom","Left"],function(c,e){b["border"+e+"Color"]=a});return b}};s=a.Color.names={aqua:"#00ffff",black:"#000000",blue:"#0000ff",fuchsia:"#ff00ff",gray:"#808080",green:"#008000",lime:"#00ff00",maroon:"#800000",navy:"#000080",olive:"#808000",purple:"#800080",red:"#ff0000",silver:"#c0c0c0",teal:"#008080",white:"#ffffff",yellow:"#ffff00",transparent:[null,null,null,0],_default:"#ffffff"}})(l);(function(){function c(){var a=
this.ownerDocument.defaultView?this.ownerDocument.defaultView.getComputedStyle(this,null):this.currentStyle,b={},c,e;if(a&&a.length&&a[0]&&a[a[0]])for(e=a.length;e--;)c=a[e],"string"===typeof a[c]&&(b[d.camelCase(c)]=a[c]);else for(c in a)"string"===typeof a[c]&&(b[c]=a[c]);return b}var b=["add","remove","toggle"],f={border:1,borderBottom:1,borderColor:1,borderLeft:1,borderRight:1,borderTop:1,borderWidth:1,margin:1,padding:1};d.each(["borderLeftStyle","borderRightStyle","borderBottomStyle","borderTopStyle"],
function(a,b){d.fx.step[b]=function(a){if("none"!==a.end&&!a.setAttr||1===a.pos&&!a.setAttr)l.style(a.elem,b,a.end),a.setAttr=!0}});d.effects.animateClass=function(a,j,m,e){var k=d.speed(j,m,e);return this.queue(function(){var e=d(this),j=e.attr("class")||"",m,q=k.children?e.find("*").andSelf():e,q=q.map(function(){return{el:d(this),start:c.call(this)}});m=function(){d.each(b,function(b,c){if(a[c])e[c+"Class"](a[c])})};m();q=q.map(function(){this.end=c.call(this.el[0]);var a=this.start,b=this.end,
e={},g,j;for(g in b)if(j=b[g],a[g]!==j&&!f[g]&&(d.fx.step[g]||!isNaN(parseFloat(j))))e[g]=j;this.diff=e;return this});e.attr("class",j);q=q.map(function(){var a=this,b=d.Deferred();this.el.animate(this.diff,l.extend({},k,{queue:!1,complete:function(){b.resolve(a)}}));return b.promise()});d.when.apply(d,q.get()).done(function(){m();d.each(arguments,function(){var a=this.el;d.each(this.diff,function(b){a.css(b,"")})});k.complete.call(e[0])})})};d.fn.extend({_addClass:d.fn.addClass,addClass:function(a,
b,c,e){return b?d.effects.animateClass.call(this,{add:a},b,c,e):this._addClass(a)},_removeClass:d.fn.removeClass,removeClass:function(a,b,c,e){return b?d.effects.animateClass.call(this,{remove:a},b,c,e):this._removeClass(a)},_toggleClass:d.fn.toggleClass,toggleClass:function(b,c,f,e,k){return"boolean"===typeof c||c===a?f?d.effects.animateClass.call(this,c?{add:b}:{remove:b},f,e,k):this._toggleClass(b,c):d.effects.animateClass.call(this,{toggle:b},c,f,e)},switchClass:function(a,b,c,e,f){return d.effects.animateClass.call(this,
{add:b,remove:a},c,e,f)}})})();(function(){function c(b,c,j,m){d.isPlainObject(b)&&(c=b,b=b.effect);b={effect:b};c===a&&(c={});d.isFunction(c)&&(m=c,j=null,c={});if("number"===typeof c||d.fx.speeds[c])m=j,j=c,c={};d.isFunction(j)&&(m=j,j=null);c&&d.extend(b,c);j=j||c.duration;b.duration=d.fx.off?0:"number"===typeof j?j:j in d.fx.speeds?d.fx.speeds[j]:d.fx.speeds._default;b.complete=m||c.complete;return b}function b(a){return!a||"number"===typeof a||d.fx.speeds[a]?!0:"string"===typeof a&&!d.effects.effect[a]?
k&&d.effects[a]?!1:!0:!1}d.extend(d.effects,{version:"1.9.0",save:function(a,b){for(var c=0;c<b.length;c++)null!==b[c]&&a.data("ui-effects-"+b[c],a[0].style[b[c]])},restore:function(b,c){var d,m;for(m=0;m<c.length;m++)null!==c[m]&&(d=b.data("ui-effects-"+c[m]),d===a&&(d=""),b.css(c[m],d))},setMode:function(a,b){"toggle"===b&&(b=a.is(":hidden")?"show":"hide");return b},getBaseline:function(a,b){var c,d;switch(a[0]){case "top":c=0;break;case "middle":c=0.5;break;case "bottom":c=1;break;default:c=a[0]/
b.height}switch(a[1]){case "left":d=0;break;case "center":d=0.5;break;case "right":d=1;break;default:d=a[1]/b.width}return{x:d,y:c}},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")},c=d("<div></div>").addClass("ui-effects-wrapper").css({fontSize:"100%",background:"transparent",border:"none",margin:0,padding:0}),k={width:a.width(),height:a.height()},e=document.activeElement;try{e.id}catch(o){e=
document.body}a.wrap(c);(a[0]===e||d.contains(a[0],e))&&d(e).focus();c=a.parent();"static"===a.css("position")?(c.css({position:"relative"}),a.css({position:"relative"})):(d.extend(b,{position:a.css("position"),zIndex:a.css("z-index")}),d.each(["top","left","bottom","right"],function(c,e){b[e]=a.css(e);isNaN(parseInt(b[e],10))&&(b[e]="auto")}),a.css({position:"relative",top:0,left:0,right:"auto",bottom:"auto"}));a.css(k);return c.css(b).show()},removeWrapper:function(a){var b=document.activeElement;
a.parent().is(".ui-effects-wrapper")&&(a.parent().replaceWith(a),(a[0]===b||d.contains(a[0],b))&&d(b).focus());return a},setTransition:function(a,b,c,k){k=k||{};d.each(b,function(b,g){var d=a.cssUnit(g);0<d[0]&&(k[g]=d[0]*c+d[1])});return k}});d.fn.extend({effect:function(a,b,j,m){function e(a){function b(){d.isFunction(e)&&e.call(c[0]);d.isFunction(a)&&a()}var c=d(this),e=o.complete,f=o.mode;(c.is(":hidden")?"hide"===f:"show"===f)?b():p.call(c[0],o,b)}var o=c.apply(this,arguments),n=o.mode,l=o.queue,
p=d.effects.effect[o.effect],q=!p&&k&&d.effects[o.effect];return d.fx.off||!p&&!q?n?this[n](o.duration,o.complete):this.each(function(){o.complete&&o.complete.call(this)}):p?!1===l?this.each(e):this.queue(l||"fx",e):q.call(this,{options:o,duration:o.duration,callback:o.complete,mode:o.mode})},_show:d.fn.show,show:function(a){if(b(a))return this._show.apply(this,arguments);var g=c.apply(this,arguments);g.mode="show";return this.effect.call(this,g)},_hide:d.fn.hide,hide:function(a){if(b(a))return this._hide.apply(this,
arguments);var g=c.apply(this,arguments);g.mode="hide";return this.effect.call(this,g)},__toggle:d.fn.toggle,toggle:function(a){if(b(a)||"boolean"===typeof a||d.isFunction(a))return this.__toggle.apply(this,arguments);var g=c.apply(this,arguments);g.mode="toggle";return this.effect.call(this,g)},cssUnit:function(a){var b=this.css(a),c=[];d.each(["em","px","%","pt"],function(a,e){0<b.indexOf(e)&&(c=[parseFloat(b),e])});return c}})})();(function(){var a={};d.each(["Quad","Cubic","Quart","Quint","Expo"],
function(b,f){a[f]=function(a){return Math.pow(a,b+2)}});d.extend(a,{Sine:function(a){return 1-Math.cos(a*Math.PI/2)},Circ:function(a){return 1-Math.sqrt(1-a*a)},Elastic:function(a){return 0===a||1===a?a:-Math.pow(2,8*(a-1))*Math.sin((80*(a-1)-7.5)*Math.PI/15)},Back:function(a){return a*a*(3*a-2)},Bounce:function(a){for(var c,g=4;a<((c=Math.pow(2,--g))-1)/11;);return 1/Math.pow(4,3-g)-7.5625*Math.pow((3*c-2)/22-a,2)}});d.each(a,function(a,c){d.easing["easeIn"+a]=c;d.easing["easeOut"+a]=function(a){return 1-
c(1-a)};d.easing["easeInOut"+a]=function(a){return 0.5>a?c(2*a)/2:1-c(-2*a+2)/2}})})()}(l);(function(d){var a=/up|down|vertical/,k=/up|left|vertical|horizontal/;d.effects.effect.blind=function(c,b){var f=d(this),g="position top bottom left right height width".split(" "),j=d.effects.setMode(f,c.mode||"hide"),m=c.direction||"up",e=a.test(m),o=e?"height":"width",n=e?"top":"left",m=k.test(m),l={},p="show"===j,q,s,u;f.parent().is(".ui-effects-wrapper")?d.effects.save(f.parent(),g):d.effects.save(f,g);
f.show();q=d.effects.createWrapper(f).css({overflow:"hidden"});s=q[o]();u=parseFloat(q.css(n))||0;l[o]=p?s:0;m||(f.css(e?"bottom":"right",0).css(e?"top":"left","auto").css({position:"absolute"}),l[n]=p?u:s+u);p&&(q.css(o,0),m||q.css(n,u+s));q.animate(l,{duration:c.duration,easing:c.easing,queue:!1,complete:function(){j==="hide"&&f.hide();d.effects.restore(f,g);d.effects.removeWrapper(f);b()}})}})(l);(function(d){d.effects.effect.bounce=function(a,k){var c=d(this),b="position top bottom left right height width".split(" "),
f=d.effects.setMode(c,a.mode||"effect"),g="hide"===f,j="show"===f,m=a.direction||"up",f=a.distance,e=a.times||5,o=2*e+(j||g?1:0),n=a.duration/o,l=a.easing,p="up"===m||"down"===m?"top":"left",m="up"===m||"left"===m,q,s,u=c.queue(),v=u.length;(j||g)&&b.push("opacity");d.effects.save(c,b);c.show();d.effects.createWrapper(c);f||(f=c["top"===p?"outerHeight":"outerWidth"]()/3);j&&(s={opacity:1},s[p]=0,c.css("opacity",0).css(p,m?2*-f:2*f).animate(s,n,l));g&&(f/=Math.pow(2,e-1));s={};for(j=s[p]=0;j<e;j++)q=
{},q[p]=(m?"-=":"+=")+f,c.animate(q,n,l).animate(s,n,l),f=g?2*f:f/2;g&&(q={opacity:0},q[p]=(m?"-=":"+=")+f,c.animate(q,n,l));c.queue(function(){g&&c.hide();d.effects.restore(c,b);d.effects.removeWrapper(c);k()});1<v&&u.splice.apply(u,[1,0].concat(u.splice(v,o+1)));c.dequeue()}})(l);(function(d){d.effects.effect.clip=function(a,k){var c=d(this),b="position top bottom left right height width".split(" "),f="show"===d.effects.setMode(c,a.mode||"hide"),g="vertical"===(a.direction||"vertical"),j=g?"height":
"width",g=g?"top":"left",m={},e,o;d.effects.save(c,b);c.show();e=d.effects.createWrapper(c).css({overflow:"hidden"});e="IMG"===c[0].tagName?e:c;o=e[j]();f&&(e.css(j,0),e.css(g,o/2));m[j]=f?o:0;m[g]=f?0:o/2;e.animate(m,{queue:!1,duration:a.duration,easing:a.easing,complete:function(){f||c.hide();d.effects.restore(c,b);d.effects.removeWrapper(c);k()}})}})(l);(function(d){d.effects.effect.drop=function(a,k){var c=d(this),b="position top bottom left right opacity height width".split(" "),f=d.effects.setMode(c,
a.mode||"hide"),g="show"===f,j=a.direction||"left",m="up"===j||"down"===j?"top":"left",j="up"===j||"left"===j?"pos":"neg",e={opacity:g?1:0},o;d.effects.save(c,b);c.show();d.effects.createWrapper(c);o=a.distance||c["top"===m?"outerHeight":"outerWidth"](!0)/2;g&&c.css("opacity",0).css(m,"pos"===j?-o:o);e[m]=(g?"pos"===j?"+=":"-=":"pos"===j?"-=":"+=")+o;c.animate(e,{queue:!1,duration:a.duration,easing:a.easing,complete:function(){"hide"===f&&c.hide();d.effects.restore(c,b);d.effects.removeWrapper(c);
k()}})}})(l);(function(d){d.effects.effect.explode=function(a,k){function c(){n.push(this);n.length===b*f&&(g.css({visibility:"visible"}),d(n).remove(),j||g.hide(),k())}var b=a.pieces?Math.round(Math.sqrt(a.pieces)):3,f=b,g=d(this),j="show"===d.effects.setMode(g,a.mode||"hide"),m=g.show().css("visibility","hidden").offset(),e=Math.ceil(g.outerWidth()/f),o=Math.ceil(g.outerHeight()/b),n=[],l,p,q,s,u,v;for(l=0;l<b;l++){s=m.top+l*o;v=l-(b-1)/2;for(p=0;p<f;p++)q=m.left+p*e,u=p-(f-1)/2,g.clone().appendTo("body").wrap("<div></div>").css({position:"absolute",
visibility:"visible",left:-p*e,top:-l*o}).parent().addClass("ui-effects-explode").css({position:"absolute",overflow:"hidden",width:e,height:o,left:q+(j?u*e:0),top:s+(j?v*o:0),opacity:j?0:1}).animate({left:q+(j?0:u*e),top:s+(j?0:v*o),opacity:j?1:0},a.duration||500,a.easing,c)}}})(l);(function(d){d.effects.effect.fade=function(a,k){var c=d(this),b=d.effects.setMode(c,a.mode||"toggle");c.animate({opacity:b},{queue:!1,duration:a.duration,easing:a.easing,complete:k})}})(l);(function(d){d.effects.effect.fold=
function(a,k){var c=d(this),b="position top bottom left right height width".split(" "),f=d.effects.setMode(c,a.mode||"hide"),g="show"===f,j="hide"===f,f=a.size||15,m=/([0-9]+)%/.exec(f),e=!!a.horizFirst,o=g!==e,n=o?["width","height"]:["height","width"],l=a.duration/2,p,q={},s={};d.effects.save(c,b);c.show();p=d.effects.createWrapper(c).css({overflow:"hidden"});o=o?[p.width(),p.height()]:[p.height(),p.width()];m&&(f=parseInt(m[1],10)/100*o[j?0:1]);g&&p.css(e?{height:0,width:f}:{height:f,width:0});
q[n[0]]=g?o[0]:f;s[n[1]]=g?o[1]:0;p.animate(q,l,a.easing).animate(s,l,a.easing,function(){j&&c.hide();d.effects.restore(c,b);d.effects.removeWrapper(c);k()})}})(l);(function(d){d.effects.effect.highlight=function(a,k){var c=d(this),b=["backgroundImage","backgroundColor","opacity"],f=d.effects.setMode(c,a.mode||"show"),g={backgroundColor:c.css("backgroundColor")};"hide"===f&&(g.opacity=0);d.effects.save(c,b);c.show().css({backgroundImage:"none",backgroundColor:a.color||"#ffff99"}).animate(g,{queue:!1,
duration:a.duration,easing:a.easing,complete:function(){f==="hide"&&c.hide();d.effects.restore(c,b);k()}})}})(l);(function(d){d.effects.effect.pulsate=function(a,k){var c=d(this),b=d.effects.setMode(c,a.mode||"show"),f="show"===b,g="hide"===b,b=2*(a.times||5)+(f||"hide"===b?1:0),j=a.duration/b,m=0,e=c.queue(),o=e.length;if(f||!c.is(":visible"))c.css("opacity",0).show(),m=1;for(f=1;f<b;f++)c.animate({opacity:m},j,a.easing),m=1-m;c.animate({opacity:m},j,a.easing);c.queue(function(){g&&c.hide();k()});
1<o&&e.splice.apply(e,[1,0].concat(e.splice(o,b+1)));c.dequeue()}})(l);(function(d){d.effects.effect.puff=function(a,k){var c=d(this),b=d.effects.setMode(c,a.mode||"hide"),f="hide"===b,g=parseInt(a.percent,10)||150,j=g/100,m={height:c.height(),width:c.width()};d.extend(a,{effect:"scale",queue:!1,fade:!0,mode:b,complete:k,percent:f?g:100,from:f?m:{height:m.height*j,width:m.width*j}});c.effect(a)};d.effects.effect.scale=function(a,k){var c=d(this),b=d.extend(!0,{},a),f=d.effects.setMode(c,a.mode||"effect"),
g=parseInt(a.percent,10)||(0===parseInt(a.percent,10)?0:"hide"===f?0:100),j=a.direction||"both",m=a.origin,e={height:c.height(),width:c.width(),outerHeight:c.outerHeight(),outerWidth:c.outerWidth()},o="horizontal"!==j?g/100:1,g="vertical"!==j?g/100:1;b.effect="size";b.queue=!1;b.complete=k;"effect"!==f&&(b.origin=m||["middle","center"],b.restore=!0);b.from=a.from||("show"===f?{height:0,width:0}:e);b.to={height:e.height*o,width:e.width*g,outerHeight:e.outerHeight*o,outerWidth:e.outerWidth*g};if(b.fade&&
("show"===f&&(b.from.opacity=0,b.to.opacity=1),"hide"===f))b.from.opacity=1,b.to.opacity=0;c.effect(b)};d.effects.effect.size=function(a,k){var c,b,f,g,j=d(this),m="position top bottom left right width height overflow opacity".split(" "),e="position top bottom left right overflow opacity".split(" "),o=["width","height","overflow"],n=["fontSize"],l=["borderTopWidth","borderBottomWidth","paddingTop","paddingBottom"],p=["borderLeftWidth","borderRightWidth","paddingLeft","paddingRight"],q=d.effects.setMode(j,
a.mode||"effect"),s=a.restore||"effect"!==q,u=a.scale||"both",v=a.origin||["middle","center"],t,x=j.css("position");"show"===q&&j.show();t={height:j.height(),width:j.width(),outerHeight:j.outerHeight(),outerWidth:j.outerWidth()};j.from=a.from||t;j.to=a.to||t;f=j.from.height/t.height;g=j.from.width/t.width;c=j.to.height/t.height;b=j.to.width/t.width;if("box"===u||"both"===u)if(f!==c&&(m=m.concat(l),j.from=d.effects.setTransition(j,l,f,j.from),j.to=d.effects.setTransition(j,l,c,j.to)),g!==b)m=m.concat(p),
j.from=d.effects.setTransition(j,p,g,j.from),j.to=d.effects.setTransition(j,p,b,j.to);if(("content"===u||"both"===u)&&f!==c)m=m.concat(n),j.from=d.effects.setTransition(j,n,f,j.from),j.to=d.effects.setTransition(j,n,c,j.to);d.effects.save(j,s?m:e);j.show();d.effects.createWrapper(j);j.css("overflow","hidden").css(j.from);v&&(v=d.effects.getBaseline(v,t),j.from.top=(t.outerHeight-j.outerHeight())*v.y,j.from.left=(t.outerWidth-j.outerWidth())*v.x,j.to.top=(t.outerHeight-j.to.outerHeight)*v.y,j.to.left=
(t.outerWidth-j.to.outerWidth)*v.x);j.css(j.from);if("content"===u||"both"===u)l=l.concat(["marginTop","marginBottom"]).concat(n),p=p.concat(["marginLeft","marginRight"]),o=m.concat(l).concat(p),j.find("*[width]").each(function(){var e=d(this),j=e.height(),k=e.width();s&&d.effects.save(e,o);e.from={height:j*f,width:k*g};e.to={height:j*c,width:k*b};if(f!==c){e.from=d.effects.setTransition(e,l,f,e.from);e.to=d.effects.setTransition(e,l,c,e.to)}if(g!==b){e.from=d.effects.setTransition(e,p,g,e.from);
e.to=d.effects.setTransition(e,p,b,e.to)}e.css(e.from);e.animate(e.to,a.duration,a.easing,function(){s&&d.effects.restore(e,o)})});j.animate(j.to,{queue:!1,duration:a.duration,easing:a.easing,complete:function(){j.to.opacity===0&&j.css("opacity",j.from.opacity);q==="hide"&&j.hide();d.effects.restore(j,s?m:e);s||(x==="static"?j.css({position:"relative",top:j.to.top,left:j.to.left}):d.each(["top","left"],function(a,b){j.css(b,function(b,c){var e=parseInt(c,10),f=a?j.to.left:j.to.top;return c==="auto"?
f+"px":e+f+"px"})}));d.effects.removeWrapper(j);k()}})}})(l);(function(d){d.effects.effect.shake=function(a,k){var c=d(this),b="position top bottom left right height width".split(" "),f=d.effects.setMode(c,a.mode||"effect"),g=a.direction||"left",j=a.distance||20,m=a.times||3,e=2*m+1,o=Math.round(a.duration/e),n="up"===g||"down"===g?"top":"left",l="up"===g||"left"===g,g={},p={},q={},s=c.queue(),u=s.length;d.effects.save(c,b);c.show();d.effects.createWrapper(c);g[n]=(l?"-=":"+=")+j;p[n]=(l?"+=":"-=")+
2*j;q[n]=(l?"-=":"+=")+2*j;c.animate(g,o,a.easing);for(j=1;j<m;j++)c.animate(p,o,a.easing).animate(q,o,a.easing);c.animate(p,o,a.easing).animate(g,o/2,a.easing).queue(function(){"hide"===f&&c.hide();d.effects.restore(c,b);d.effects.removeWrapper(c);k()});1<u&&s.splice.apply(s,[1,0].concat(s.splice(u,e+1)));c.dequeue()}})(l);(function(d){d.effects.effect.slide=function(a,k){var c=d(this),b="position top bottom left right width height".split(" "),f=d.effects.setMode(c,a.mode||"show"),g="show"===f,j=
a.direction||"left",m="up"===j||"down"===j?"top":"left",j="up"===j||"left"===j,e,o={};d.effects.save(c,b);c.show();e=a.distance||c["top"===m?"outerHeight":"outerWidth"](!0);d.effects.createWrapper(c).css({overflow:"hidden"});g&&c.css(m,j?isNaN(e)?"-"+e:-e:e);o[m]=(g?j?"+=":"-=":j?"-=":"+=")+e;c.animate(o,{queue:!1,duration:a.duration,easing:a.easing,complete:function(){"hide"===f&&c.hide();d.effects.restore(c,b);d.effects.removeWrapper(c);k()}})}})(l);(function(d){d.effects.effect.transfer=function(a,
k){var c=d(this),b=d(a.to),f="fixed"===b.css("position"),g=d("body"),j=f?g.scrollTop():0,g=f?g.scrollLeft():0,m=b.offset(),b={top:m.top-j,left:m.left-g,height:b.innerHeight(),width:b.innerWidth()},m=c.offset(),e=d('<div class="ui-effects-transfer"></div>').appendTo(document.body).addClass(a.className).css({top:m.top-j,left:m.left-g,height:c.innerHeight(),width:c.innerWidth(),position:f?"fixed":"absolute"}).animate(b,a.duration,a.easing,function(){e.remove();k()})}})(l)});define("ui/tab","aloha/core jquery ui/container ui/component PubSub jqueryui".split(" "),
function(l,d,a,k,c){var b=0,f={},l=a.extend({_elemBySlot:null,_groupBySlot:null,_groupByComponent:null,_constructor:function(a,c,f){var e,k,n,l,p;this._elemBySlot={};this._groupBySlot={};this._groupByComponent={};this._slotsList=[];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=d("<div>",{id:this.id,unselectable:"on"});this.handle=d('<li><a href="'+location.href.replace(/#.*$/,
"")+"#"+this.id+'">'+c.label+"</a></li>");for(a=0;a<f.length;a++)if(typeof f[a]==="string")if(1===f[a].length&&f[a].charCodeAt(0)===10)this.panel.append("<div>",{unselectable:"on"});else{k=d("<span>",{unselectable:"on"});this._elemBySlot[f[a]]=k;this.panel.append(k)}else{l=d("<div>",{"class":"aloha-ui-component-group aloha-ui-hidden",unselectable:"on"}).appendTo(this.panel);p={element:l,visibleCounter:0};n=f[a];for(e=0;e<n.length;e++){this._groupBySlot[n[e]]=p;if(n[e]&&1===n[e].length&&n[e].charCodeAt(0)===
10)l.append(d("<div>",{unselectable:"on"}));else{k=d("<span>",{unselectable:"on"});this._elemBySlot[n[e]]=k;l.append(k)}}}this.panel.append(d("<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;f[a]=b;b.adoptParent(this);c.append(b.element);c=this._groupBySlot[a];this._slotsList.push(a);
if(c){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)&&f[b]&&f[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(){var a;if(!(a=!this.list.children().length)){a=false;d("button:not(.aloha-multisplit-toggle)",this.panel).length!==0&&(a=true);a=!a}if(!a){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()}}}});d.extend(l,{createContainer:function(){var a=d("<div>",{unselectable:"on"}),b=d("<ul>",
{unselectable:"on"}).appendTo(a),f=d("<div>",{unselectable:"on"}).appendTo(a);a.data("list",b).data("panels",f).data("aloha-tabs",[]).tabs({select:function(b,f){var d=a.data("aloha-tabs");a.data("aloha-active-container",d[f.index]);c.pub("aloha.ui.container.selected",{data:d[f.index]})}});return a}});return l});define("ui/subguarded",["aloha/core","jquery","PubSub"],function(l,d,a){function k(a){a.alohaUid||(a.alohaUid=++g);return a.alohaUid}function c(a,b){j[a.alohaUid]||(j[a.alohaUid]=[]);j[a.alohaUid].push(b);
return j[a.alohaUid]}function b(a,b){m[a]||(m[a]=[]);m[a].push(b);return m[a]}function f(a){var b=m[a]||[],c;for(c=0;c<b.length;c++)b[c].apply(null,[j[b[c].alohaUid]||[]].concat(arguments))}var g=0,j={},m={};return function(){var e=Array.prototype.slice.call(arguments),g=e.shift();"string"===typeof g&&(g=[g]);var d=e.shift();k(d);c(d,e);for(var j,m=function(a,b,c){f(j,a,b,c)},q=function(){f(j)},e=0;e<g.length;e++)j=g[e],b(j,d),l.bind(j,m),a.sub(j,q)}});define("vendor/amplify.store",["util/json2"],
function(){var l={};(function(d,a){function k(f,e){c.addType(f,function(g,d,j){var k,q=d,l=(new Date).getTime();if(!g){q={};j=[];d=0;try{for(g=e.length;g=e.key(d++);)b.test(g)&&(k=ga.parse(e.getItem(g)),k.expires&&k.expires<=l?j.push(g):q[g.replace(b,"")]=k.data);for(;g=j.pop();)e.removeItem(g)}catch(u){}return q}g="__amplify__"+g;if(d===a)if(k=(k=e.getItem(g))?ga.parse(k):{expires:-1},k.expires&&k.expires<=l)e.removeItem(g);else return k.data;else if(null===d)e.removeItem(g);else{k=ga.stringify({data:d,
expires:j.expires?l+j.expires:null});try{e.setItem(g,k)}catch(v){c[f]();try{e.setItem(g,k)}catch(t){throw c.error();}}}return q})}var c=d.store=function(a,b,f,g){g=c.type;f&&(f.type&&f.type in c.types)&&(g=f.type);return c.types[g](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,e,f){f=f||{};f.type=a;return c(b,e,f)}};c.error=function(){return"amplify.store quota exceeded"};var b=/^__amplify__/,f;for(f in{localStorage:1,sessionStorage:1})try{window[f].getItem&&
k(f,window[f])}catch(g){}if(window.globalStorage)try{k("globalStorage",window.globalStorage[window.location.hostname]),"sessionStorage"===c.type&&(c.type="globalStorage")}catch(j){}(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(e){b.parentNode.removeChild(b);return}c.addType("userData",function(e,f,g){b.load("amplify");var d,j,k=f,
l=(new Date).getTime();if(!e){k={};j=[];for(e=0;f=b.XMLDocument.documentElement.attributes[e++];)d=ga.parse(f.value),d.expires&&d.expires<=l?j.push(f.name):k[f.name]=d.data;for(;e=j.pop();)b.removeAttribute(e);b.save("amplify");return k}e=e.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(d=(f=b.getAttribute(e))?ga.parse(f):{expires:-1},d.expires&&d.expires<=l)b.removeAttribute(e);else return d.data;else null===f?b.removeAttribute(e):
(j=b.getAttribute(e),d=ga.stringify({data:f,expires:g.expires?l+g.expires:null}),b.setAttribute(e,d));try{b.save("amplify")}catch(v){null===j?b.removeAttribute(e):b.setAttribute(e,j);c.userData();try{b.setAttribute(e,d),b.save("amplify")}catch(t){throw null===j?b.removeAttribute(e):b.setAttribute(e,j),c.error();}}return k})}})();(function(){var b={},e={};c.addType("memory",function(c,f,g){if(!c)return b===a?a:ga.parse(ga.stringify(b));if(f===a)return b[c]===a?a:ga.parse(ga.stringify(b[c]));e[c]&&
(clearTimeout(e[c]),delete e[c]);if(null===f)return delete b[c],null;b[c]=f;g.expires&&(e[c]=setTimeout(function(){delete b[c];delete e[c]},g.expires));return f})})()})(l);return l});define("ui/floating","jquery aloha/core ui/surface ui/subguarded PubSub vendor/amplify.store util/browser".split(" "),function(l,d,a,k,c,b,f){function g(a,b,e,f){if("absolute"===n){b.top=b.top+o.scrollTop();b.left=b.left+o.scrollLeft()}r.offset=b;a.stop().animate(b,e,function(){f(b);c.pub("aloha.floating.changed",{position:l.extend({},
r)})})}function j(a){b.store("Aloha.FloatingMenu.pinned","true");b.store("Aloha.FloatingMenu.top",a.top);b.store("Aloha.FloatingMenu.left",a.left)}function m(a,b,c,e,f){for(b=0;b<a.length;b++)if(a[b][0].isActive())a[b][1](c,e,f)}function e(a){if(l.browser.msie){var b=a.$element.parent();a.$element.appendTo("body");a.$element.css("position",n);b.length?a.$element.appendTo(b):a.$element.detach()}else a.$element.css("position",n)}var o=l(window),n=f.ie7?"absolute":"fixed",r={style:n,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){k(["aloha-selection-changed","aloha.ui.container.selected"],m,a,function(){a._move()});var c=function(){var c;c=b.pinLeft;var e=b.pinTop;e<0?e=0:e>o.height()&&(e=o.height()/2);c<0?c=0:c>o.width()&&(c=o.width()/2);c={top:e,left:c};b.setFloatingPosition(c);
a.$element.css({top:c.top,left:c.left})};o.scroll(function(){a._move(0)});o.resize(function(){b.isFloatingMode||c()});a.addPin();e(a);b.isFloatingMode||c();a.$element.css("z-index",10100).draggable({distance:20,stop:function(a,c){b.setFloatingPosition(c.position);b.isFloatingMode||j(c.position)}})},floatSurface:function(a,b,c,e){typeof c!=="number"&&(c=500);var f=(parseInt(l("body").css("marginTop"),10)||0)+(parseInt(l("body").css("paddingTop"),10)||0),a=a.$element,d=b.obj.offset(),j=d.top,d=d.left,
k=o.scrollTop(),m=j-k-f,n=d+a.width()-o.width();n>0&&(d=Math.max(0,d-n));if(m>=a.height()){b={top:j-k,left:d};b.top=b.top-(a.height()+10)}else{b=m+a.height()>m+b.obj.height()?{top:j+b.obj.height(),left:d}:{top:f,left:d};b.top=b.top+10}g(a,b,c,e)},togglePinSurface:function(a,c,e){a=a.$element;if(e){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{j(c);a.find(".aloha-ui-pin").addClass("aloha-ui-pin-down")}a.css({position:"fixed",
top:c.top})},POSITION_STYLE:n}});(function(){function l(a,b,f,g,d,k){b[a]&&(f.push(a),(!0===b[a]||1===b[a])&&g.push(d+a+"/"+k))}function d(a,b,f,g,d){b=g+b+"/"+d;require._fileExists(a.toUrl(b))&&f.push(b)}function a(c,b,f){for(var g in b)b.hasOwnProperty(g)&&(!c.hasOwnProperty(g)||f)?c[g]=b[g]:"object"===typeof b[g]&&a(c[g],b[g],f)}var k=/(^.*(^|\/)nls(\/|$))([^\/]*)\/?([^\/]*)/;define("i18n",["module"],function(c){var b=c.config();return{version:"2.0.1",load:function(c,g,j,m){m=m||{};m.locale&&(b.locale=
m.locale);var e=k.exec(c),o=e[1],n=e[4],r=e[5],p=n.split("-"),q=[],s={},u,v="";e[5]?(o=e[1],c=o+r):(r=e[4],n=b.locale,n||(n=b.locale="undefined"===typeof navigator?"root":(navigator.language||navigator.userLanguage||"root").toLowerCase()),p=n.split("-"));if(m.isBuild){q.push(c);d(g,"root",q,o,r);for(u=0;u<p.length;u++)m=p[u],v+=(v?"-":"")+m,d(g,v,q,o,r);g(q,function(){j()})}else g([c],function(b){var c=[],e;l("root",b,c,q,o,r);for(u=0;u<p.length;u++){e=p[u];v=v+((v?"-":"")+e);l(v,b,c,q,o,r)}g(q,function(){var e,
f,d;for(e=c.length-1;e>-1&&c[e];e--){d=c[e];f=b[d];if(f===true||f===1)f=g(o+d+"/"+r);a(s,f)}s.t=function(a,b){return this[a]?this[a]:b?b:a};j(s)})})}}})})();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.yes.label":"Yes","button.no.label":"No","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(l,d,a,k,c,b,f){function g(){return!d.settings||!d.settings.toolbar||d.settings.toolbar.floating!==false}var j=a.extend({_moveTimeout:null,$_container:null,_tabBySlot:null,_tabs:[],_constructor:function(a,b){var d,n,r,p;this._super(a);this.$element=l("<div>",{"class":"aloha-ui aloha-ui-toolbar",
unselectable:"on"});this.$_container=k.createContainer().appendTo(this.$element);this._tabBySlot={};for(r=0;r<b.length;r++){d=b[r];n=new k(a,{label:f.t(d.label,d.label),showOn:d.showOn,container:this.$_container},d.components);for(p in n._elemBySlot)n._elemBySlot.hasOwnProperty(p)&&(this._tabBySlot[p]=n);this._tabs.push({tab:n,settings:d})}g()&&c.makeFloating(this,j)},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;d.activeEditable&&j.isFloatingMode&&c.floatSurface(b,d.activeEditable,a,j.setFloatingPosition)},20)},addPin:function(){var a=l('<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")});
j.isFloatingMode||a.addClass("aloha-ui-pin-down");var f=this;a.click(function(){j.isFloatingMode=!j.isFloatingMode;var a;if(j.isFloatingMode)a={top:j.pinTop,left:j.pinLeft};else{a=f.$element.offset();a.top=a.top-l(window).scrollTop()}j.setFloatingPosition(a);c.togglePinSurface(f,a,j.isFloatingMode)})},show:function(){j.$surfaceContainer.children().detach();j.$surfaceContainer.append(this.$element);j.$surfaceContainer.stop().fadeTo(200,1);if(g()){var a=j.getFloatingPosition();this.$element.stop().css({top:a.top,
left:a.left});this._move()}},hide:function(){j.$surfaceContainer.stop().fadeOut(200,function(){j.$surfaceContainer.children().detach()})}});l.extend(j,{$surfaceContainer:null,isFloatingMode:true,pinLeft:0,pinTop:0,init:function(){j.$surfaceContainer=l("<div>",{"class":"aloha aloha-surface aloha-toolbar",unselectable:"on"}).hide();l(function(){j.$surfaceContainer.appendTo("body")});a.trackRange(j.$surfaceContainer);var b=c.getPinState();j.pinTop=b.top;j.pinLeft=b.left;j.isFloatingMode=!b.isPinned},
setFloatingPosition:function(a){j.pinTop=a.top;j.pinLeft=a.left},getFloatingPosition:function(){return{top:j.pinTop,left:j.pinLeft}}});j.init();return j});define("ui/settings",["jquery","util/arrays","util/maps","util/trees"],function(l,d,a,k){function c(a,b,c){var e,f,d=[],r;for(e=0;e<a.length;e++)if(f=a[e],!b[f.label]&&(r=k.postprune(f.components,c)))f=l.extend({},f),f.components=r,d.push(f);return d}function b(a,b,c){var e,f,d=[],r,p,q;for(e=0;e<a.length;e++)f=a[e],r=f.components||[],p=b[f.label],
!f.exclusive&&p&&(q=k.postprune(p.components,c))&&(r=r.concat(q)),f=l.extend({},p||{},f),f.components=r,d.push(f);return d}function f(b,c){var f,e=a.fillKeys({},c,!0);for(f=0;f<b.length;f++)e[b[f].label]=!0,a.fillKeys(e,k.flatten(b[f].components),!0);return e}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 colorPicker".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","naturalFit","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,j,k){function e(a){return"array"===l.type(a)?!a.length:n[a]}var o=a.fillTuples({},d.map(j,function(a){return[a.label,a]})),n=f(g,k),g=b(g,o,e),j=c(j,n,e);return g.concat(j)}}});define("ui/ui-plugin","jquery aloha ui/context ui/container ui/surface ui/toolbar ui/scopes ui/settings PubSub jqueryui".split(" "),function(l,d,a,k,c,b,f,g,j){var m=new a,e=new b(m,function(){var a=d.settings.toolbar,b=g.defaultToolbarSettings;return!a?b.tabs:g.combineToolbarSettings(a.tabs||
[],b.tabs,a.exclude||[])}());d.bind("aloha-editable-activated",function(a){c.show(m);k.showContainersForContext(m,a)});d.bind("aloha-editable-deactivated",function(){c.suppressHide||c.hide(m)});j.sub("aloha.ui.scope.change",function(){k.showContainersForContext(m);f.getPrimaryScope();var a=e._tabs,b=f.getPrimaryScope(),c,g;for(g=0;g<a.length;g++){c=a[g].settings;if("object"===l.type(c.showOn)&&c.showOn.scope===b){a[g].tab.foreground();break}}});return{adoptInto:function(a,b){return e.adoptInto(a,
b)},showToolbar:function(a){c.show(m);k.showContainersForContext(m,a)}}});define("ui/ui",["jquery","ui/ui-plugin"],function(l,d){var a={};return{adopt:function(k,c,b){"string"!==l.type(k)?(b=c,c=k,k=b.name):b=l.extend({name:k},b);c.isInstance||(c=b?c.extend(b):c,c=new c);a[k]=c;d.adoptInto(k,c);return c},getAdoptedComponent:function(d){return a[d]||null}}});define("ui/utils",["jquery","jqueryui"],function(l){function d(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 l("<label>",{"class":"aloha-ui-label"}).append(l("<span>",{"class":"aloha-ui-label-text",text:a})).append(c)},makeButton:function(k,c,b){k.button({label:d(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&&k.button("widget").children(".ui-button-icon-primary").append(a(c.iconUrl));return k},makeButtonElement:function(a){return l("<button>",
a).attr("type","button")},makeButtonLabel:d,makeButtonLabelWithIcon:function(k){var c=d(k);k.iconUrl&&(c=a(k.iconUrl)+c);return c},makeButtonIconFromUrl:a}});define("ui/vendor/jquery-ui-autocomplete-html",["jquery","jqueryui"],function(l){(function(d){function a(a,c){var g=RegExp(d.ui.autocomplete.escapeRegex(c),"i");return d.grep(a,function(a){return g.test(d("<div>").html(a.label||a.value||a).text())})}var k=d.ui.autocomplete.prototype,c=k._initSource;d.extend(k,{_initSource:function(){this.options.html&&
d.isArray(this.options.source)?this.source=function(b,c){c(a(this.options.source,b.term))}:c.call(this)},_renderItem:function(a,c){return d("<li></li>").data("item.autocomplete",c).append(d("<a></a>")[this.options.html?"html":"text"](c.label)).appendTo(a)}})})(l)});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(l,d,a,k,c,b,f,g){return function(j){function k(a,
b){b.item&&t(b.item.obj);o()}function e(){o()}function o(){p();if(R&&G!==l(R).attr(V)){O||f.markObject(R);u()===""&&s()}}function n(a){var b=l(R);a(b);for(var b=0,c=N.length;b<c;b++)a(l(N[b]))}function r(){var a=l(R);J&&n(function(a){a.addClass(J)});if(!C){p();a.context&&(a.context.style&&a.context.style["background-color"])&&n(function(a){a.attr("data-original-background-color",a.context.style["background-color"])});n(function(a){a.css("background-color","#80B5F2")})}}function p(){var a=l(R);J&&
n(function(a){a.removeClass(J)});if(!C){var b=a.attr("data-original-background-color");n(function(a){a.css("background-color",b||"")});a.attr("style")||n(function(a){a.removeAttr("style")});n(function(a){a.removeAttr("data-original-background-color")})}}function q(a,b){return a.replace(/\{([^}]+)\}/g,function(a,c){return c in b?b[c]:""})}function s(){if(null!==A){S.css("color","#AAA");S.val(A)}}function u(){return S.val()}function v(a){S.val(a);S.css("color","black")}function t(a){if(O=a){var b=a[z];
v(b);Y=b;x(V,a[y]);f.markObject(R,a)}else Y=null}function x(a,b,c,e){R&&(typeof e!=="undefined"&&!e.match(RegExp(c))?l(R).removeAttr(a):n(function(c){c.attr(a,b)}))}var y=j.valueField||"id",z=j.displayField||"name",E=j.objectTypeFilter||["all"],A=j.placeholder,C=!!j.noTargetHighlight,J=j.targetHighlightClass,S=j.element?l(j.element):l('<input id="aloha-attribute-field-'+j.name+'">'),F,B,O,Y,R,V,G,N=[];j.cls&&S.addClass(j.cls);j.width&&S.width(j.width);F=d.adopt(j.name,a,{scope:j.scope,init:function(){if(j.element)this.element=
S;else if(j.label){this.element=b.wrapWithLabel(j.label,S);j.labelClass&&this.element.addClass(j.labelClass)}else this.element=l("<span>").append(S);S.autocomplete({html:true,appendTo:c.selector,source:function(a,b){f.query({queryString:a.term,objectTypeFilter:E},function(a){b(l.map(a.items,function(a){return{label:q(B,a),value:a.name,obj:a}}))})},select:k})}});S.bind("focus",function(a){if(l(a.target).is(":visible")){r();u()===A&&v("")}}).bind("blur",e).bind("keydown",function(a){(a.keyCode==13||
a.keyCode==27)&&a.preventDefault()}).bind("keyup",function(a){if(O&&Y!==u())Y=O=null;O||x(V,u());if(a.keyCode==13||a.keyCode==27){g.getRangeObject().select();o()}});s();Aloha.bind("aloha-editable-deactivated",e);var H={getInputElem:function(){return S[0]},hasInputElem:function(){return true},getInputId:function(){return S.attr("id")},hide:function(){S.hide()},show:function(){S.show()},foreground:function(){F.foreground()},focus:function(){F.focus();S.focus()},getTargetObject:function(){return R},
setTargetObject:function(a,b){R=a;V=b;N=[];t(null);if(a&&b){G=l(a).attr(b);v(l(R).attr(V));f.getObject(a,function(a){a&&a.length>0&&t(a[0])})}else v("")},addAdditionalTargetObject:function(a){N.push(a)},setAttribute:x,getItem:function(){return O},setItem:t,setValue:v,getValue:u,addListener:function(a,b){S.bind(a,l.proxy(b,H))},setObjectTypeFilter:function(a){E=a},setTemplate:function(a){B=a},setPlaceholder:s,getInputJQuery:function(){return S}};return H}});define("ui/button",["jquery","ui/component",
"ui/utils","jqueryui"],function(l,d,a){return d.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"}}).zIndex(0).click(l.proxy(function(){this.buttonElement.tooltip("close",null,!0);this._onClick()},this))},_onClick:function(){this.click()},click:function(){},createButtonElement:function(){var d=a.makeButtonElement();this["class"]&&d.addClass(this["class"]);
return this.element=this.buttonElement=d},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(l,d){return d.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("util/keys",["jquery"],function(l){var d=function(){var a={};l.each({8:"backspace",9:"tab",13:"enter",16:"shift control alt",20:"capslock",27:"escape",32:"space",33:"pageup",34:"pagedown",37:"left up right down",
45:"insert",46:"delete",48:"0 1 2 3 4 5 6 7 8 9",65:"a b c d e f g h i j k l m n o p q r s t u v w x y z",112:"f1 f2 f3 f4 f5 f6 f7 f8 f9 f10 f11 f12 f13 f14 f15"},function(d,c){var b=parseInt(d,10);l.each(c.split(" "),function(c,g){a[b+c]=g})});return a}();return{getToken:function(a){return d[a]},keyCodeTokenMap:l.extend({},d)}});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 PubSub util/keys".split(" "),
function(l,d,a,k,c,b,f,g,j,m,e,o,n,r,p){function q(){k(document).bind("keydown.aloha-link.pointer-fix",function(a){(a.metaKey||p.getToken(a.keyCode)==="control")&&k("body").addClass("aloha-link-pointer")}).bind("keyup.aloha-link.pointer-fix",function(a){(a.metaKey||p.getToken(a.keyCode)==="control")&&k("body").removeClass("aloha-link-pointer")})}function s(a){a.obj.delegate("a","click.aloha-link.meta-click-link",function(a){if(a.metaKey||a.ctrlKey){l.activeEditable.blur();window.setTimeout(function(){location.href=
a.target},0);a.stopPropagation();return false}})}function u(a,b){for(var c=a.findAllMarkupByTagName("A",a),e=0,f=c.length;e<f;e++)b.addAdditionalTargetObject(c[e])}function v(a,b){var c,e=false;if(!a.ignoreNextSelectionChangedEvent&&l.Selection.isSelectionEditable()&&l.activeEditable!=null)if(c=a.findLinkMarkup(b)){a.toggleLinkScope(true);a.hrefField.setTargetObject(c,"href");u(b,a.hrefField);if(k("#"+a.hrefField.getInputId()).length==0){a.hrefUpdateInt!==null&&clearInterval(a.hrefUpdateInt);a.hrefUpdateInt=
setInterval(function(){if(k("#"+a.hrefField.getInputId()).length>0){a.hrefField.setTargetObject(c,"href");clearInterval(a.hrefUpdateInt)}},200)}l.trigger("aloha-link-selected");e=true;r.pub("aloha.link.selected",{input:a.hrefField.getInputElem(),href:a.hrefField.getValue(),element:a.hrefField.getTargetObject()})}else{a.toggleLinkScope(false);a.hrefField.setTargetObject(null);l.trigger("aloha-link-unselected")}else a.toggleLinkScope(false);a.ignoreNextSelectionChangedEvent=false;return e}var t=window.GENTICS,
x="",y,z={merge:true,mergeable:function(a){return"aloha-new-link"===a.className&&a.nextSibling&&"aloha-new-link"===a.nextSibling.className}};a.classes("aloha-link-pointer","aloha-link-text");return d.create("link",{config:["a"],title:null,titleregex:null,targetregex:"",target:"",cssclassregex:null,cssclass:"",objectTypeFilter:[],onHrefChange:null,ignoreNextSelectionChangedEvent:false,hrefUpdateInt:null,hotKey:{insertLink:e.t("insertLink","ctrl+k")},hrefValue:"http://",init:function(){var a=this;if("undefined"!==
typeof this.settings.title)this.title=this.settings.title;if("undefined"!==typeof this.settings.titleregex)this.titleregex=this.settings.titleregex;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"&&k.extend(true,this.hotKey,this.settings.hotKey);if(typeof this.settings.hrefValue!="undefined")this.hrefValue=this.settings.hrefValue;this.createButtons();this.subscribeEvents();this.bindInteractions();l.bind("aloha-plugins-loaded",function(){a.initSidebar(l.Sidebar.right);r.pub("aloha.link.ready",
{plugin:a})})},nsSel:function(){var a=[];k.each(arguments,function(){a.push("."+(this==""?"aloha-link":"aloha-link-"+this))});return k.trim(a.join(" "))},nsClass:function(){var a=[];k.each(arguments,function(){a.push(this==""?"aloha-link":"aloha-link-"+this)});return k.trim(a.join(" "))},initSidebar:function(a){var b=this;b.sidebar=a;a.addPanel({id:b.nsClass("sidebar-panel-target"),title:e.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>'+e.t("link.target.legend")+'</legend><ul><li><input type="radio" name="targetGroup" class="'+b.nsClass("radioTarget")+'" value="_self" /><span>'+e.t("link.target.self")+'</span></li><li><input type="radio" name="targetGroup" class="'+b.nsClass("radioTarget")+'" value="_blank" /><span>'+e.t("link.target.blank")+'</span></li><li><input type="radio" name="targetGroup" class="'+b.nsClass("radioTarget")+'" value="_parent" /><span>'+e.t("link.target.parent")+
'</span></li><li><input type="radio" name="targetGroup" class="'+b.nsClass("radioTarget")+'" value="_top" /><span>'+e.t("link.target.top")+'</span></li><li><input type="radio" name="targetGroup" class="'+b.nsClass("radioTarget")+'" value="framename" /><span>'+e.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>'+e.t("link.title.legend")+'</legend><input type="text" class="'+
b.nsClass("linkTitle")+'" /></fieldset></div>');k(b.nsSel("framename")).live("keyup",function(){k(a.effective).attr("target",k(this).val().replace('"',"&quot;").replace("'","&#39;"))});k(b.nsSel("radioTarget")).live("change",function(){if(k(this).val()=="framename")k(b.nsSel("framename")).slideDown();else{k(b.nsSel("framename")).slideUp().val("");k(a.effective).attr("target",k(this).val())}});k(b.nsSel("linkTitle")).live("keyup",function(){k(a.effective).attr("title",k(this).val().replace('"',"&quot;").replace("'",
"&#39;"))})},onActivate:function(a){var c=this;c.effective=a;if(k(c.effective).attr("target")!=null){var e=true;k(b.nsSel("framename")).hide().val("");k(b.nsSel("radioTarget")).each(function(){k(this).removeAttr("checked");if(k(this).val()===k(c.effective).attr("target")){e=false;k(this).attr("checked","checked")}});if(e){k(b.nsSel('radioTarget[value="framename"]')).attr("checked","checked");k(b.nsSel("framename")).val(k(c.effective).attr("target")).show()}}else{k(b.nsSel("radioTarget")).first().attr("checked",
"checked");k(c.effective).attr("target",k(b.nsSel("radioTarget")).first().val())}c=this;c.effective=a;k(b.nsSel("linkTitle")).val(k(c.effective).attr("title"))}});a.show()},subscribeEvents:function(){var a=this,b={},c=0;l.bind("aloha-editable-created",function(e,f){var g=a.getEditableConfig(f.obj),g=k.inArray("a",g)!==-1;if(b[f.getId()]=g){f.obj.bind("keydown.aloha-link",a.hotKey.insertLink,function(){if(a.findLinkMarkup()){a.hrefField.foreground();a.hrefField.focus()}else a.insertLink(true);return false});
f.obj.find("a").each(function(){a.addLinkEventHandlers(this)});0===c++&&q()}});l.bind("aloha-editable-destroyed",function(a,b){b.obj.unbind(".aloha-link");0===--c&&k(document).unbind(".aloha-link.pointer-fix")});l.bind("aloha-editable-activated",function(c,e){if(b[l.activeEditable.getId()]){a._formatLinkButton.show();a._insertLinkButton.show()}else{a._formatLinkButton.hide();a._insertLinkButton.hide()}s(e.editable)});var e=false;l.bind("aloha-selection-changed",function(c,f){var g=false;if(l.activeEditable&&
b[l.activeEditable.getId()])(g=v(a,f))&&e!==g&&a.hrefField.foreground();e=g});var f=this;l.bind("aloha-editable-deactivated",function(a,b){if(e){setTimeout(function(){e||f.toggleLinkScope(false)},100);e=false}b.editable.obj.unbind(".aloha-link.meta-click-link")})},toggleLinkScope:function(a){if(!(this._isScopeActive===a&&l.activeEditable&&this._isScopeActive_editableId===l.activeEditable.getId())){this._isScopeActive=a;this._isScopeActive_editableId=l.activeEditable&&l.activeEditable.getId();if(a){this.hrefField.show();
this._insertLinkButton.hide();l.activeEditable&&l.activeEditable.obj[0].nodeName==="A"?this._removeLinkButton.hide():this._removeLinkButton.show();this._formatLinkButton.setState(true);f.enterScope(this.name,"link")}else{this.hrefField.hide();this._insertLinkButton.show();this._removeLinkButton.hide();this._formatLinkButton.setState(false);f.leaveScope(this.name,"link",true)}}},addLinkEventHandlers:function(a){var b=this;k(a).mouseenter(function(){l.Log.debug(b,"mouse over link.");b.mouseOverLink=
a;b.updateMousePointer()});k(a).mouseleave(function(){l.Log.debug(b,"mouse left link.");b.mouseOverLink=null;b.updateMousePointer()});k(a).click(function(a){if(a.metaKey){l.activeEditable.blur();window.setTimeout(function(){location.href=a.target},0);a.stopPropagation();return false}})},createButtons:function(){var a=this;this._formatLinkButton=b.adopt("formatLink",m,{tooltip:e.t("button.addlink.tooltip"),icon:"aloha-icon aloha-icon-link",scope:"Aloha.continuoustext",click:function(){a.formatLink()}});
this._insertLinkButton=b.adopt("insertLink",j,{tooltip:e.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",noTargetHighlight:false,targetHighlightClass:"aloha-focus"});this.hrefField.setTemplate("<span><b>{name}</b><br/>{url}</span>");this.hrefField.setObjectTypeFilter(this.objectTypeFilter);this._removeLinkButton=
b.adopt("removeLink",j,{tooltip:e.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(p.getToken(b.keyCode)==="escape"){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(p.getToken(b.keyCode)==="enter"){b=l.Selection.getRangeObject();a.ignoreNextSelectionChangedEvent=true;b.startContainer=b.endContainer;b.startOffset=b.endOffset;b.select();a.ignoreNextSelectionChangedEvent=true;c=k(a.hrefField.getInputElem()).attr("value");(c==a.hrefValue||c=="")&&a.removeLink(false);window.setTimeout(function(){f.setScope("Aloha.continuoustext")},100)}else{y=k(a.hrefField.getInputElem()).attr("value");x!=y&&(x=y)}});k(document).keydown(function(b){l.Log.debug(a,
"Meta key down.");a.metaKey=b.metaKey;a.updateMousePointer()}).keyup(function(b){l.Log.debug(a,"Meta key up.");a.metaKey=b.metaKey;a.updateMousePointer()})},updateMousePointer:function(){if(this.metaKey&&this.mouseOverLink){l.Log.debug(this,"set pointer");k(this.mouseOverLink).removeClass("aloha-link-text");k(this.mouseOverLink).addClass("aloha-link-pointer")}else{k(this.mouseOverLink).removeClass("aloha-link-pointer");k(this.mouseOverLink).addClass("aloha-link-text")}},findLinkMarkup:function(a){typeof a==
"undefined"&&(a=l.Selection.getRangeObject());if(l.activeEditable){var b=l.activeEditable.obj;b[0]&&b[0].nodeName==="A"&&(b=b.parent());return a.findMarkup(function(){return this.nodeName=="A"},b)}return null},formatLink:function(){l.activeEditable&&(this.findLinkMarkup(l.Selection.getRangeObject())?this.removeLink():this.insertLink())},insertLink:function(a){var b=this,c=l.Selection.getRangeObject(),f;if(c.startContainer&&c.endContainer&&!this.findLinkMarkup(c)){this.hrefField.foreground();c.isCollapsed()&&
a!==false&&t.Utils.Dom.extendToWord(c);if(c.isCollapsed()){a=e.t("newlink.defaulttext");f=k('<a href="'+b.hrefValue+'" class="aloha-new-link">'+a+"</a>");t.Utils.Dom.insertIntoDOM(f,c,k(l.activeEditable.obj));c.startContainer=c.endContainer=f.contents().get(0);c.startOffset=0;c.endOffset=a.length}else{f=k('<a href="'+b.hrefValue+'" class="aloha-new-link"></a>');t.Utils.Dom.addMarkup(c,f,false);t.Utils.Dom.doCleanup(z,c)}l.activeEditable.obj.find("a.aloha-new-link").each(function(){b.addLinkEventHandlers(this);
k(this).removeClass("aloha-new-link")});c.select();this.hrefField.focus();this.hrefField.hasInputElem()&&k(this.hrefField.getInputElem()).attr("value",b.hrefValue).select();a=l.createRange();a.setStart(c.startContainer,c.startOffset);a.setEnd(c.endContainer,c.endOffset);r.pub("aloha.link.insert",{range:a});this.hrefChange()}},removeLink:function(a){var b=l.Selection.getRangeObject(),c=this.findLinkMarkup();this.hrefField.setItem(null);if(c){t.Utils.Dom.removeFromDOM(c,b,true);b.startContainer=b.endContainer;
b.startOffset=b.endOffset;b.select();(typeof a=="undefined"||a===true)&&f.setScope("Aloha.continuoustext")}},automaticallySetTitle:function(a,b,c){var e=k(a.getTargetObject()).attr("title");b&&(!e||b===e)&&a.setAttribute("title",b,c,a.getValue())},hrefChange:function(){this.automaticallySetTitle(this.hrefField,this.title,this.titleregex);this.target!=""&&this.hrefField.setAttribute("target",this.target,this.targetregex,this.hrefField.getValue());null!=this.cssclassregex&&this.hrefField.setAttribute("class",
this.cssclass,this.cssclassregex,this.hrefField.getValue());var a=this.hrefField.getValue(),b=this.hrefField.getTargetObject();l.trigger("aloha-link-href-change",{href:a,obj:b,item:this.hrefField.getItem()});r.pub("aloha.link.changed",{href:a,element:b,input:this.hrefField.getInputElem()});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(l,d,a){function k(a){var b={};a.text&&(b.text=a.text);a.html&&(b.html=a.html);return l("<div>",b)}function c(a){return function(){a.apply(this);l(this).dialog("destroy").remove()}}function b(a){for(var b in a)a.hasOwnProperty(b)&&(a[b]=c(a[b]));return a}function f(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(c){var d=c.buttons||{},m=a.t("button.yes.label"),e=a.t("button.no.label");null!==
d.Yes&&"Yes"!==m&&(d[m]=d.Yes,delete d.Yes);null!==d.No&&"No"!==e&&(d[e]=d.No,delete d.No);d[m]=d[m]||c.yes||l.noop;d[e]=d[e]||c.no||l.noop;if(c.answer){var o=d[m],n=d[e];d[m]=function(){o();c.answer(true)};d[e]=function(){n();c.answer(false)}}var r=k(c).dialog(l.extend(f(c,"Confirm"),{buttons:b(d)}));return function(){r.dialog("destroy").remove()}},alert:function(c){var d={};d[a.t("button.dismiss.label")]=l.noop;var m=k(c).dialog(l.extend(f(c,"Alert"),{buttons:b(d)}));return function(){m.dialog("destroy").remove()}},
modal:function(a){a=k(a).dialog(l.extend(f(a,""),a));a.parent().find(".ui-dialog-titlebar").remove();return a},progress:function(a){var b=l("<div>").progressbar({value:null!=a.value?a.value:100}),c=k(a).dialog(l.extend(f(a,"Progress"),{open:function(){l(this).append(b)}}));return function(a){null!=a?b.progressbar({value:a}):c.dialog("destroy").remove()}}}});define("ui/multiSplit",["jquery","ui/component","ui/button","ui/utils"],function(l,d,a,k){return d.extend({_activeButton:null,_isOpen:!1,init:function(){this._super();
var a=this,b=this.element=l("<div>",{"class":"aloha-multisplit"});this.contentElement=l("<div>",{"class":"aloha-multisplit-content"}).appendTo(b);this.toggleButton=k.makeButtonElement({"class":"aloha-multisplit-toggle",click:function(){a.toggle()}}).button().appendTo(b);this.buttons=[];var f=this.getButtons();0===f.length&&b.hide();for(b=0;b<f.length;b++)this.addButton(f[b]);l("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,f=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||f.element.addClass("aloha-large-button");b.buttons[c.name]={settings:c,component:f,element:f.element,visible:!0};var g=this.contentElement.children(".aloha-ui-multisplit-fullwidth");!c.wide&&g.length?g.before(f.element[0]):this.contentElement.append(f.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,f=!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();f=!0;break}f||this.element.hide()}}})});define("ui/port-helper-multi-split",["aloha/core","jquery","ui/ui","ui/multiSplit"],function(l,d,a,k){return function(c){var b;
b=a.adopt(c.name,k,{scope:c.scope,getButtons:function(){var a=[];d.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","button.naturalfit.tooltip":"Reset table sizing","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(l){CreateLayer=function(d){this.TablePlugin=d};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 d=this.get("layer");null==d?this.create():(this.setPosition(d),d.find("td").removeClass("hover"),d.show());this.visible=!0};CreateLayer.prototype.create=function(){var d=this,a=l("<div></div>");a.id=this.get("elemId");a.addClass(this.get("className"));var k=l("<table></table>");k.css("width",15*(this.get("numX")+6));for(var c,b,f=0;f<this.get("numY");f++){c=
l("<tr></tr>");for(var g=0;g<this.get("numX");g++)b=l("<td> </td>"),0==f&&0==g&&b.addClass("hover"),b.bind("mouseover",{rowId:f,colId:g},function(a){d.handleMouseOver(a,k)}),b.bind("click",{rowId:f,colId:g},function(a){d.TablePlugin.createTable(a.data.colId+1,a.data.rowId+1);d.hide()}),c.append(b);k.append(c)}a.append(k);this.set("layer",a);this.setPosition();a.bind("click",function(a){a.stopPropagation()}).mousedown(function(a){a.stopPropagation()});l("body").append(a).bind("click",function(a){d.visible&&
!(a.target===d.get("target")[0]||l.contains(d.get("target")[0],a.target))&&d.hide()})};CreateLayer.prototype.handleMouseOver=function(d,a){for(var k=d.data.rowId,c=d.data.colId,b=a.find("tr"),f=0;f<=b.length;f++)for(var g=l(b[f]).find("td"),j=0;j<=g.length;j++)f<=k&&j<=c?l(g[j]).addClass("hover"):l(g[j]).removeClass("hover")};CreateLayer.prototype.setPosition=function(){var d=l(this.get("target")),a=d.offset();this.get("layer").css("left",a.left+"px");this.get("layer").css("top",a.top+d.height()+
"px")};CreateLayer.prototype.hide=function(){this.get("layer").hide();this.visible=!1};CreateLayer.prototype.get=function(d){if(this.config[d])return this.config[d];if(this.parameters[d])return this.parameters[d]};CreateLayer.prototype.set=function(d,a){this.config[d]?this.config[d]=a:this.parameters[d]=a};return CreateLayer});define("table/table-plugin-utils",["jquery","aloha/copypaste","util/browser","aloha/console"],function(l,d,a,k){var c={cellIndexToGridColumn:function(a,f,g){var d=null;c.walkCells(a,
function(a,b,c){if(a===f&&b===g)return d=c,!1});return d},walkCells:function(a,f){for(var g=[],d=0;d<a.length;d++){for(var k=a[d].cells,e=0,o=0;o<k.length;o++){for(var n=k[o],l=c.colspan(n),n=c.rowspan(n);g[o+e];)g[o+e]-=1,e+=1;if(!1===f(d,o,o+e,l,n))return;for(var p=0;p<l;p++){if(g[o+e+p])throw"an impossible case has occurred";g[o+e+p]=n-1}e+=l-1}for(;o+e<g.length;e++)g[o+e]&&(g[o+e]-=1)}},makeGrid:function(a){var f=[];c.walkCells(a,function(c,d,k,e,o){for(var d=a[c].cells[d],n=0;n<o;n++){f[c+n]=
f[c+n]||[];for(var l=0;l<e;l++)f[c+n][k+l]={cell:d,colspan:e,rowspan:o,spannedX:l,spannedY:n}}});return f},containsDomCell:function(a){return 0===a.spannedX&&0===a.spannedY},leftDomCell:function(a,c,d){do{var j=a[c][d];if(0===j.spannedY)return j.cell;d-=j.spannedX+1}while(0<=d);return null},splitCell:function(a,f){var d=l(a),j=c.colspan(a),k=c.rowspan(a);if(!(1===j&&1===k)){for(var e=d.parent(),o=e.parent().children(),e=e.index(),n=d.index(),r=c.makeGrid(o),n=c.cellIndexToGridColumn(o,e,n),p=0;p<
k;p++)for(var q=0===p?1:0;q<j;q++){var s=c.leftDomCell(r,e+p,n);null==s?o.eq(e+p).prepend(f()):l(s).after(f())}d.removeAttr("colSpan");d.removeAttr("rowSpan")}},rowspan:function(a){return parseInt(l(a).attr("rowspan"))||1},colspan:function(a){return parseInt(l(a).attr("colspan"))||1},walkGrid:function(a,c){for(var d,j=0,k=a.length;j<k;j++){d=a[j];for(var e=0,o=d.length;e<o;e++)if(!1===c(d[e],e,j))return}},walkGridInsideRect:function(a,f,d){c.walkGrid(a,function(a,b,c){if(c>=f.top&&c<f.bottom&&b>=
f.left&&b<f.right)return d(a,b,c)})},leftTrimArray:function(a){for(var c=0;c<a.length;c++)if(null!=a[c])return a.slice(c,a.length);return[]},makeContour:function(a,f){var d=[],j=[],k=[],e=[];c.walkGrid(a,function(a,b,c){if(f(a,b,c)){if(null==d[c]||b<d[c])d[c]=b;if(null==j[c]||b>j[c])j[c]=b;if(null==k[b]||c<k[b])k[b]=c;if(null==e[b]||c>e[b])e[b]=c}});d=c.leftTrimArray(d);j=c.leftTrimArray(j);k=c.leftTrimArray(k);e=c.leftTrimArray(e);return{left:d,right:j,top:k,bottom:e}},indexOfAnyBut:function(a,c){for(var d=
0;d<a.length;d++)if(c!==a[d])return d;return-1},isConsecutive:function(a){for(var c=1;c<a.length;c++)if(1!==Math.abs(a[c]-a[c-1]))return!1;return!0},resizeCellWidth:function(a,c){l(a).css("width",c);l(a).find(".aloha-table-cell-editable").eq(0).css({width:c,"word-wrap":"break-word"})},getMinColWidth:function(a){var f=a.closest("tbody").children("tr"),d=a.closest("tr"),j=c.cellIndexToGridColumn(f,f.index(d),d.children().index(a)),k="";c.walkCells(f,function(a,b,c,d){if(c===j&&(a=l(l(f[a]).children()[b]),
!(1<d))){d=a.text().split(" ");for(a=0;a<d.length;a++)d[a].length>k.length&&(k=d[a])}});d=l("<span></span>");d.css("text-indent",-9999);d.css("display","inline");d.text(k);l(a).append(d);a=d.width();l(d).remove();return a},getCellResizeBoundaries:function(a,f,d){var j,k;c.walkCells(f,function(e,o,n,r){e=l(l(f[e]).children()[o]);if(e.hasClass("aloha-table-selectrow")||e.closest("tr").hasClass("aloha-table-selectcolumn"))return!0;n===a&&1===r&&(j=e.offset().left+c.getCellBorder(e)+e.width()-c.getMinColWidth(e));
n===a-1&&1===r&&(k=e.offset().left+c.getCellBorder(e)+c.getCellPadding(e)+c.getMinColWidth(e));if(j&&k)return d(j,k),!1})},getCellBorder:function(a){return(a.outerWidth()-a.innerWidth())/2},getCellPadding:function(a){return a.innerWidth()-a.width()},selectAnchorContents:function(b){a:if(0===b.length)b=null;else{var c,g;(c=d.getRange())&&(g=l(c.commonAncestorContainer).closest(".aloha-table-cell-editable")[0]);if(g)for(c=0;c<b.length;c++)if(l(b[c]).find(g).length){b=b[c];break a}b=b[0]}if(b)if(b=l(">.aloha-table-cell-editable",
b)[0],a.ie7)try{d.selectAllOf(b)}catch(j){k.error("Table",j.message)}else d.selectAllOf(b)}};return c});define("table/table-cell",["aloha","aloha/jquery","aloha/ephemera","table/table-plugin-utils"],function(l,d,a,k){var c=function(a,c){null==a&&(a="<td>&nbsp;</td>");a=d(a).get(0);this.obj=d(a);this.tableObj=c;c.cells.push(this)};c.prototype.tableObj=void 0;c.prototype.obj=void 0;c.prototype.wrapper=void 0;c.prototype.hasFocus=!1;c.prototype.activate=function(){var b=this,c=b.obj;c.wrapInner("<div/>");
var g=c.children("div").eq(0);g.contentEditable(!0);g.addClass("aloha-table-cell-editable");a.markWrapper(g);g.bind("focus",function(a){1<k.colspan(b.obj)||1<k.rowspan(b.obj)?b.tableObj.tablePlugin._splitcellsButton.enable(!0):b.tableObj.tablePlugin._splitcellsButton.enable(!1);a.currentTarget&&(a.currentTarget.indexOf=function(){return-1});b._editableFocus(a)});g.bind("mousedown",function(a){a.currentTarget&&(a.currentTarget.indexOf=function(){return-1});b._editableMouseDown(a);b.tableObj.selection.baseCellPosition=
[b._virtualY(),b._virtualX()];if(a.shiftKey){var a=b.tableObj.selection.lastBaseCellPosition[1],c=b.tableObj.selection.lastBaseCellPosition[0],e=b.tableObj.selection.baseCellPosition,f=e[1];f>a&&(f=a,a=e[1]);var g=e[0];g>c&&(g=c,c=e[0]);var l=g,p=a,q=c,s=f,u=b.tableObj,a=u.obj.children().children("tr"),a=k.makeGrid(a);u.selection.selectedCells=[];var v=u.get("classCellSelected");k.walkGrid(a,function(a,b,c){if(k.containsDomCell(a))if(c>=l&&c<=q&&b>=s&&b<=p){d(a.cell).addClass(v);u.selection.selectedCells.push(a.cell)}else d(a.cell).removeClass(v)});
u.selection.notifyCellsSelected()}else b.tableObj.selection.lastBaseCellPosition=b.tableObj.selection.baseCellPosition,b._editableMouseDown(a),b._startCellSelection()});g.bind("blur",function(a){b._editableBlur(a)});g.bind("keyup",function(a){b._editableKeyUp(a)});g.bind("keydown",function(a){b._editableKeyDown(a)});g.bind("mouseover",function(){b._selectCellRange()});g.contentEditableSelectionChange(function(a){l.Selection.onChange(g,a);return g});c.bind("mousedown",function(a){window.setTimeout(function(){b.wrapper.trigger("focus");
b._selectAll(g)},1);a.shiftKey||(b.tableObj.selection.unselectCells(),b._startCellSelection());a.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};c.prototype.deactivate=function(){var a=d(this.obj.children(".aloha-table-cell-editable"));a.length&&(a.parent().append(a.contents()),
a.remove(),this.obj.unbind("click"),this.obj.unbind("mousedown"),""==d.trim(this.obj.attr("class"))&&this.obj.removeAttr("class"))};c.prototype.toString=function(){return"TableCell"};c.prototype._editableFocus=function(){this.hasFocus||(this.tableObj.focus(),this.obj.addClass("aloha-table-cell_active"),this.hasFocus=!0,this.tableObj.selection.selectionType="cell")};c.prototype._editableBlur=function(){this.hasFocus=!1;this.obj.removeClass("aloha-table-cell_active")};c.prototype._virtualX=function(){var a=
this.tableObj.obj.children().children("tr"),c=this.obj.parent().index(),d=this.obj.index();return k.cellIndexToGridColumn(a,c,d)};c.prototype._virtualY=function(){return this.obj.parent("tr").index()};c.prototype._startCellSelection=function(){if(!this.tableObj.selection.cellSelectionMode){this.tableObj.selection.unselectCells();this.tableObj.selection.cellSelectionMode=!0;var a=this;d("body").bind("mouseup.cellselection",function(c){a._endCellSelection();c.stopPropagation()});this.tableObj.selection.baseCellPosition=
[this._virtualY(),this._virtualX()]}};c.prototype._endCellSelection=function(){this.tableObj.selection.cellSelectionMode&&(k.selectAnchorContents(this.tableObj.selection.selectedCells),this.tableObj.selection.cellSelectionMode=!1,this.tableObj.selection.baseCellPosition=null,this.tableObj.selection.lastSelectionRange=null,this.tableObj.selection.selectionType="cell",d("body").unbind("mouseup.cellselection"))};c.prototype._getSelectedRect=function(){var a=this._virtualX(),c=this._virtualY(),d=this.tableObj.selection.baseCellPosition,
j=d[1];j>a&&(j=a,a=d[1]);var k=d[0];k>c&&(k=c,c=d[0]);return{top:k,right:a,bottom:c,left:j}};c.prototype._selectCellRange=function(){if(!this.tableObj.selection.resizeMode&&this.tableObj.selection.cellSelectionMode){var a=this._getSelectedRect(),c=this.tableObj,g=c.obj.children().children("tr"),g=k.makeGrid(g);c.selection.selectedCells=[];var j=c.get("classCellSelected");k.walkGrid(g,function(g,e,o){k.containsDomCell(g)&&(o>=a.top&&o<=a.bottom&&e>=a.left&&e<=a.right?(d(g.cell).addClass(j),c.selection.selectedCells.push(g.cell)):
d(g.cell).removeClass(j))});c.selection.notifyCellsSelected()}};c.prototype._selectAll=function(a){a=a.jquery?a.get(0):a;if(d.browser.msie)document.getSelection?(c=document.getSelection(),g=document.createRange(),g.selectNodeContents(a),c.removeAllRanges(),c.addRange(g)):document.selection&&(g=document.body.createTextRange(),g.moveToElementText(a),g.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 g=document.createRange();g.selectNodeContents(a);c.removeAllRanges();c.addRange(g)}}};c.prototype._editableMouseDown=function(a){this.tableObj.selection.unselectCells();this.tableObj.hasFocus&&("function"===typeof a.stopPropagation?a.stopPropagation():"undefined"!==typeof a.cancelBubble&&(a.cancelBubble=!0))};c.prototype._editableKeyUp=function(){};c.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)};c.prototype._checkForEmptyEvent=function(){var a=d(this.wrapper),c=a.text();!(0<a.children().length)&&""===c&&(this.wrapper.text(" "),this.wrapper.get(0).blur(),this.wrapper.get(0).focus())};c.getContainer=function(a){return d(a.firstChild).hasClass("aloha-table-cell-editable")?a.firstChild:a};return c});define("table/table-selection","aloha aloha/jquery table/table-plugin-utils table/table-cell ui/dialog i18n!table/nls/i18n".split(" "),
function(l,d,a,k,c,b){function f(a){return{top:a.top[0],right:a.right[0]+1,bottom:a.bottom[0]+1,left:a.left[0]}}function g(b,c,d){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=f(c);a.walkGridInsideRect(b,c,function(a){if(!d(a))return g=false})}return g}var j=function(a){this.table=a};j.prototype.selectionType=void 0;j.prototype.selectedCells=[];j.prototype.selectedColumnIdxs=
[];j.prototype.selectedRowIdxs=[];j.prototype.cellSelectionMode=false;j.prototype.baseCellPosition=null;j.prototype.lastSelectionRange=null;j.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===d.inArray(b[f],this.selectedColumnIdxs)){this.selectedColumnIdxs.push(b[f]);for(var g=0;g<c.length;g++){var j=c[g][b[f]];if(a.containsDomCell(j)){d(j.cell).addClass(this.table.get("classCellSelected"));this.selectedCells.push(j.cell)}}}this.selectionType=
"column"};j.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]);d(b[a[c]].cells[f]).addClass(this.table.get("classCellSelected"))}}this.selectionType="row"};j.prototype.selectAll=function(){var a=d.map(this.table.getRows(),
function(a,b){return b});a.shift();this.selectRows(a);this.selectionType="all"};j.prototype.notifyCellsSelected=function(){l.trigger("aloha-table-selection-changed")};j.prototype._notifyCellsUnselected=function(){l.trigger("aloha-table-selection-changed")};j.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};j.prototype.unselectCells=
function(){if(!this.cellSelectionMode&&this.selectedCells.length>0){for(var a=this.selectedCells,b=this.table.get("classCellSelected"),c=0,f=a.length;c<f;c++)d(a[c]).removeClass(b);this.selectedCells=[];this.selectedColumnIdxs=[];this.selectedRowIdxs=[];this.selectionType="cell";this._notifyCellsUnselected()}};j.prototype.selectionIndex=function(a){for(var b=0;b<this.selectedCells.length;b++)if(this.selectedCells[b]===a)return b;return-1};j.prototype.mergeCells=function(){var j=this.selectedCells;
if(0!==j.length){var e=function(a){return-1!=d.inArray(a.cell,j)},o=a.makeGrid(this.table.getRows()),n=a.makeContour(o,e);if(g(o,n,e)){var r=f(n),e=d(o[r.top][r.left].cell),p=d(k.getContainer(e.get(0)));a.walkGridInsideRect(o,r,function(a,b,c){if(!(b-a.spannedX===r.left&&c-a.spannedY===r.top)){a=a.cell;b=d(k.getContainer(a)).contents();for(c=0;c<b.length;c++)if("string"===typeof b[c]&&""!==d.trim(b[c])||b[c].nodeType&&3===b[c].nodeType&&""!==d.trim(b[c].data)||1===b[c].nodeType){p.append(" ");p.append(b);
break}d(a).remove()}});e.attr({rowspan:r.bottom-r.top,colspan:r.right-r.left});this.selectedCells=[e.get(0)];this.cellSelectionMode=false;this.lastSelectionRange=this.baseCellPosition=null;this.selectionType="cell";l.trigger("aloha-table-selection-changed")}else c.alert({title:b.t("Table"),text:b.t("table.mergeCells.notRectangular")})}};j.prototype.splitCells=function(){var b=this,c=this.selectedCells;if(c.length>0){d(c).each(function(){a.splitCell(this,function(){return b.table.newActiveCell().obj})});
this.cellSelectionMode=false;this.lastSelectionRange=this.baseCellPosition=null;this.selectionType="cell";l.trigger("aloha-table-selection-changed")}};j.prototype.cellsAreMergeable=function(){var b=this.selectedCells;if(b.length<2)return false;var c=function(a){return-1!=d.inArray(a.cell,b)},f=a.makeGrid(this.table.getRows()),j=a.makeContour(f,c);return g(f,j,c)?true:false};j.prototype.cellsAreSplitable=function(){var b=0;if(this.selectedCells.length>0){d(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 j});define("table/table","aloha jquery ui/scopes ui/dialog i18n!table/nls/i18n table/table-cell table/table-selection table/table-plugin-utils aloha/ephemera util/html util/dom2 aloha/console".split(" "),function(l,d,a,k,c,b,f,g,j,m,e,o){function n(a){a.jquery&&(a=a[0]);var b,c=[],e;for(b=0;b<a.childNodes.length;b++){e=a.childNodes[b];c.push(e);e.nodeType===1&&(c=c.concat(n(e)))}return c}function r(a,b){var c;
if("first"===a){c=d("[contenteditable]",b).first()[0].firstChild;if(s===c)c=d("*",b).first()[0].firstChild}else"last"===a&&(c=n(d("td:last",b)).reverse()[0]);return c}function p(a,b,c,e){for(var f,g=false,j=0;j<c.length;j++)e.showItem(c[j].name);e.setActiveItem();for(j=0;j<b.length;j++)if(d(a[0]).hasClass(b[j].cssClass)){g=true;f=b[j].name;break}d(a).each(function(){d(this).hasClass(f)||(g=false)});g&&e.setActiveItem(f)}function q(a,b){var c=-1,e=null;"before"===a?e=b.selectedCells[0]:"after"===a&&
(e=b.selectedCells[b.selectedCells.length-1]);if(e&&e.nodeType==1)c=e.parentNode.rowIndex;return c}var s=void 0,u=window.GENTICS,v=function(a,b){this.obj=d(a);var c,e,k=this.getRows(),m=k.length,n,o=0,q=[m],l;for(c=0;c<m;c++){e=d(k[c]);e=e.children("td, th");n=e.length;n=g.cellIndexToGridColumn(k,c,n-1)+1;l=parseInt(e.last().attr("colspan"),10);if(l!=0&&!isNaN(l)){l==1&&e.last().removeAttr("colspan");n=n+(l-1)}rowSpan=parseInt(e.last().attr("rowspan"),10);if(rowSpan>1)for(e=1;e<rowSpan-1;e++)q[c+
e]=l>1?q[c+e]+l:q[c+e]+1;q[c]=q[c]+n;q[c]>o&&(o=q[c])}for(c=0;c<m;c++){e=o-q[c];e>0&&d(k[c]).append(Array(e+1).join("<td></td>"))}this.obj.attr("id")||this.obj.attr("id",u.Utils.guid());j.markAttr(this.obj,"id");this.tablePlugin=b;this.selection=new f(this);this.refresh()};d.extend(v.prototype,{obj:s,tableWrapper:s,cells:s,numRows:s,numCols:s,isActive:false,hasFocus:false,parentEditable:s,mousedown:false,clickedColumnId:-1,clickedRowId:-1,columnsToSelect:[],rowsToSelect:[],fmPluginId:s});v.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=d(a[b]).children(),e=0;e<c.length;e++)this.newCell(c[e])};v.prototype.countVirtualCols=function(){var a=this.obj.children().children("tr:first-child").children();return a.length-a.filter("."+this.get("classLeftUpperCorner")).length};v.prototype.get=function(a){return this.tablePlugin.get(a)};v.prototype.set=function(a,b){this.tablePlugin.set(a,b)};v.prototype.activate=
function(){function a(b){return!m.isUnrenderedNode(b)}if(!this.isActive){var b=this,c;this.obj.addClass(this.get("className"));this.obj.contentEditable(false);this.obj.attr("id")==""&&this.obj.attr("id",u.Utils.guid());this.selection.selectionType=s;c=this.obj.children("tbody");if(c.length===0)c=this.obj;c.bind("keydown",function(a){!a.ctrlKey&&!a.shiftKey&&b.selection.selectedCells.length>0&&b.selection.selectedCells[0].length>0&&b.selection.selectedCells[0][0].firstChild.focus()});l.bind("aloha-command-will-execute",
function(c,f){var d=l.getSelection().getRangeAt(0),g;if("forwarddelete"===f.commandId){var j;if(!(j=!d.collapsed)){j=d.startOffset;var k=d.startContainer;j=!(e.nodeLength(k)===j||(1===k.nodeType?!m.findNodeLeft(k.childNodes[j-1],a):3===k.nodeType&&m.isWSPorZWSPText(k.data.substr(j))))}if(!j){d=d.commonAncestorContainer;3===d.nodeType?g=d.parentNode&&m.findNodeLeft(d.parentNode.nextSibling,a):1===d.nodeType&&(g=m.findNodeLeft(d.nextSibling,a));if(g===b.tableWrapper){f.preventDefault=true;l.getSelection().collapse(r("first",
b.obj),0)}}}else if("delete"===f.commandId){if(!(j=!d.collapsed)){j=d.startOffset;k=d.startContainer;j=!(0===j||(1===k.nodeType?!m.findNodeRight(k.childNodes[j-1],a):3===k.nodeType&&m.isWSPorZWSPText(k.data.substr(0,j))))}if(!j){d=d.commonAncestorContainer;3===d.nodeType?g=d.parentNode&&m.findNodeRight(d.parentNode.previousSibling,a):1===d.nodeType&&(g=m.findNodeRight(d.previousSibling,a));if(g===b.tableWrapper){g=r("last",b.obj);f.preventDefault=true;l.getSelection().collapse(g,e.nodeLength(g))}}}});
this.obj.on("keydown",function(a){if(a.keyCode===46){b.selection.selectionType==="row"?b.deleteRows():b.selection.selectionType==="column"&&b.deleteColumns();typeof a.stopPropagation==="function"?a.stopPropagation():a.cancelBubble=true}});c.delegate("th, td","mousemove",function(a){var c=d(this);if(!d(this).hasClass("aloha-table-selectrow")&&!d(this).closest("tr").hasClass("aloha-table-selectcolumn")){var e=b.tablePlugin.rowResize;if(b.tablePlugin.colResize&&a.pageX-c.offset().left<3){c.css("cursor",
"col-resize");return b.attachColumnResize(c)}if(e&&a.pageY-c.offset().top<3){c.css("cursor","row-resize");return b.attachRowResize(c)}if(e){e=c.closest("tr");if(e.next("tr").length>0)e=false;else{a=a.pageY-(e.offset().top+e.outerHeight());e=a>-3&&a<3}}if(e){c.css("cursor","row-resize");return b.attachRowResize(c,true)}c.css("cursor","default");return b.detachRowColResize(c)}});c.bind("mousemove",function(a){var c=d(this).closest("table"),e;if(e=b.tablePlugin.tableResize){a=a.pageX-(c.offset().left+
c.outerWidth());e=a>-5&&a<5}if(e)return b.attachTableResizeWidth(c)});c.bind("mousedown",function(a){b.hasFocus||b.focus();a.stopPropagation();a.preventDefault();return false});c=d('<div class="'+this.get("classTableWrapper")+'" data-block-skip-scope="true"></div>');c.contentEditable(false);j.markWrapper(c);this.obj.wrap(c);c=this.obj.parent();c.alohaBlock&&c.alohaBlock();c=this.obj.parents("."+this.get("classTableWrapper"));c.get(0).onresizestart=function(){return false};c.get(0).oncontrolselect=
function(){return false};c.get(0).ondragstart=function(){return false};c.get(0).onmovestart=function(){return false};this.tableWrapper=this.obj.parents("."+this.get("classTableWrapper")).get(0);d(this.cells).each(function(){this.activate()});this.attachSelectionColumn();this.attachSelectionRow();this.makeCaptionEditable();this.checkWai();this.isActive=true;l.trigger("aloha-table-activated")}};v.prototype.makeCaptionEditable=function(){var a=this.obj.find("caption").eq(0);a&&this.tablePlugin.makeCaptionEditable(a)};
v.prototype.checkWai=function(){var a=this.wai;if(!a)return false;var b=this.get("waiGreen"),c=this.get("waiRed");a.removeClass(b+" "+c);if(d.trim(this.obj[0].summary)!==""){a.addClass(b);return true}a.addClass(c);return false};v.prototype.attachSelectionColumn=function(){var a=d("<td>"),b,c,e,f;a.html(" ");e=this.obj.context.rows;for(f=0;f<e.length;f++){c=d(e[f]);b=a.clone();b.addClass(this.get("classSelectionColumn"));b.css("width",this.get("selectionArea")+"px");c.prepend(b);this.attachRowSelectionEventsToCell(b)}};
v.prototype.attachRowSelectionEventsToCell=function(a){var b=this;j.markElement(a);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)})};v.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=d.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();return false};v.prototype.rowSelectionMouseOver=
function(a){var b=a.currentTarget.parentNode.rowIndex,c;if(this.mousedown&&this.clickedRowId>=0){d.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}};v.prototype.attachSelectionRow=function(){var a=this,b=d("<td>");b.html(" ");for(var c=0,e=0;e<this.obj.context.rows.length;e++){for(var f=0,k=0;k<this.obj.context.rows[e].cells.length;k++)var m=
g.colspan(this.obj.context.rows[e].cells[k]),f=f+m;c<f&&(c=f)}f=d("<tr>");f.addClass(this.get("classSelectionRow"));f.css("height",this.get("selectionArea")+"px");j.markElement(f);for(e=0;e<c;e++){k=b.clone();if(e>0)this.attachColumnSelectEventsToCell(k);else{k=d("<td>").clone();k.addClass(this.get("classLeftUpperCorner"));this.wai=d("<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){o.error("Table",c.message)}return false});k.append(this.wai)}f.append(k)}d(document).bind("mouseup",function(b){a.columnSelectionMouseUp(b)});this.obj.find("tr:first").before(f)};v.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)})};v.prototype.columnSelectionMouseDown=function(a){this.focus();if(this.selection.selectedCells.length==0)this.columnsToSelect=[];this.clickedColumnId=d(a.currentTarget.parentNode).children().index(a.currentTarget);if(a.metaKey){var b=d.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};v.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)}};v.prototype.columnSelectionMouseUp=function(){this.mouseDownColIdx=false};v.prototype.deleteRows=function(){var a=[],b={},e=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 j=this;k.confirm({title:c.t("Table"),text:c.t("deletetable.confirm"),yes:function(){j.deleteTable()}})}else{a.sort(function(a,b){return a-b});var m=a[0];m>this.numRows-a.length&&m--;var n=this.getRows();d.each(a,function(a,b){for(var c=n[b],f=0;f<c.cells.length;f++)g.splitCell(c.cells[f],function(){return e.newActiveCell().obj})});var o=g.makeGrid(n);d.each(a,function(a,b){for(var c=o[b],e=0;e<c.length;){var f=c[e],j=g.rowspan(f.cell);1<j&&d(f.cell).attr("rowspan",
j-1);e=e+f.colspan}d(n[b]).remove()});this.numRows=this.numRows-a.length;window.setTimeout(function(){d(n[1].cells[m+1]).focus()},5);this.selection.unselectCells()}}};v.prototype.deleteColumns=function(){var a=[],b=this.getRows(),e=this,f,j=g.makeGrid(b);if(this.selection.selectedColumnIdxs.length==j[0].length-1)k.confirm({title:c.t("Table"),text:c.t("deletetable.confirm"),yes:function(){e.deleteTable()}});else{a.sort(function(a,b){return a-b});for(var m=this.selection.selectedColumnIdxs.sort(function(a,
b){return b-a}),n=0;n<m.length;n++){for(var o=m[n],q=0;q<b.length;q++)if(f=j[q][o]){if(0===f.spannedX){if(1<f.colspan){var l=this.newActiveCell().obj;d(f.cell).after(l);l.attr("rowspan",f.rowspan);l.attr("colspan",f.colspan-1)}d(f.cell).remove()}else d(f.cell).attr("colspan",f.colspan-1);q=q+(f.rowspan-1)}j=g.makeGrid(b)}this.numCols=this.numCols-a.length;window.setTimeout(function(){d(b[1].cells[1]).focus()},5);this.selection.unselectCells()}};v.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=s;this.tablePlugin.TableRegistry.splice(b,1);a=l.Selection.rangeObject;a.endContainer=this.obj.get(0).parentNode;a.startContainer=a.endContainer;a.endOffset=u.Utils.Dom.getIndexInParent(this.obj.get(0));a.startOffset=a.endOffset;a.clearCaches();this.obj.remove();this.parentEditable.obj.focus();a.correctRange();a.select()}};
v.prototype.addRowBeforeSelection=function(){var a=q("before",this.selection);-1!==a&&this.addRow(a)};v.prototype.addRowAfterSelection=function(){var a=q("after",this.selection);-1!==a&&this.addRow(a+1)};v.prototype.addRow=function(a){this.countVirtualCols();for(var b=this.obj.children().children("tr"),c=0;c<1;c++){var e=d("<tr>"),f=d("<td>");f.addClass(this.get("classSelectionColumn"));this.attachRowSelectionEventsToCell(f);e.append(f);f=g.makeGrid(b);if(a>=f.length)for(var j=1;j<f[0].length;j++)e.append(this.newActiveCell().obj);
else for(j=1;j<f[a].length;){var k=f[a][j];if(g.containsDomCell(k))for(var m=k.colspan;m--;)e.append(this.newActiveCell().obj);else d(k.cell).attr("rowspan",k.rowspan+1);j=j+k.colspan}a>=b.length?b.eq(b.length-1).after(e):b.eq(a).before(e)}this.numRows=this.numRows+1};v.prototype.addColumnsRight=function(){this.addColumns("right")};v.prototype.addColumnsLeft=function(){this.addColumns("left")};v.prototype.addColumns=function(a){var b=d("<td>"),e=this.getRows(),f,j;f=this.selection.selectedColumnIdxs;
if(0!==f.length){f.sort(function(a,b){return a-b});if(g.isConsecutive(f)){if("left"===a){j=f[0];for(var m=0;m<this.selection.selectedColumnIdxs.length;m++)this.selection.selectedColumnIdxs[m]=this.selection.selectedColumnIdxs[m]+1}else j=f[f.length-1];for(var n=g.makeGrid(e),m=0;m<e.length;m++){f=b.clone();f.html(" ");if(m==0)this.attachColumnSelectEventsToCell(f);else{cellObj=this.newActiveCell(f.get(0));f=cellObj.obj}var o=g.leftDomCell(n,m,j);null==o?d(e[m]).prepend(f):"left"===a&&g.containsDomCell(n[m][j])?
d(o).before(f):d(o).after(f);this.numCols++}}else k.alert({title:c.t("Table"),text:c.t("table.addColumns.nonConsecutive")})}};v.prototype.focus=function(){if(!this.hasFocus){this.parentEditable.isActive||this.parentEditable.obj.focus();this.tablePlugin.setFocusedTable(this)}};v.prototype.focusOut=function(){if(this.hasFocus){this.tablePlugin.setFocusedTable(s);this.selection.selectionType=s}};v.prototype._removeCursorSelection=function(){var a=l.getSelection();if(a&&a._nativeSelection&&a._nativeSelection._ranges.length!=
0){a=a.getRangeAt(0);if(null!=a.startContainer&&0===d(a.startContainer).closest("table").length&&0!==this.selection.selectedCells.length){a=b.getContainer(this.selection.selectedCells[0]);d(a).focus()}}};v.prototype.selectColumns=function(b){this.selection.selectColumns(b?b:this.columnsToSelect);this.tablePlugin._columnheaderButton.setState(this.selection.isHeader());p(this.selection.selectedCells,this.tablePlugin.columnConfig,this.tablePlugin.columnMSItems,this.tablePlugin.columnMSButton);this.obj.find("div.aloha-ui-table-cell-editable").blur();
g.selectAnchorContents(this.selection.selectedCells);this.selection.notifyCellsSelected();this._removeCursorSelection();a.setScope(this.tablePlugin.name+".column")};v.prototype.selectRows=function(){this.selection.selectRows(this.rowsToSelect);this.tablePlugin._rowheaderButton.setState(this.selection.isHeader());p(this.selection.selectedCells,this.tablePlugin.rowConfig,this.tablePlugin.rowMSItems,this.tablePlugin.rowMSButton);this.obj.find("div.aloha-ui-table-cell-editable").blur();g.selectAnchorContents(this.selection.selectedCells);
this.selection.notifyCellsSelected();this._removeCursorSelection();a.setScope(this.tablePlugin.name+".row")};v.prototype.deactivate=function(){var a=this.obj.parent();a.mahaloBlock&&a.mahaloBlock();this.obj.removeClass(this.get("className"));d.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;
d.each(this.obj.context.rows,function(){d(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.find("td, th").css("cursor","");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(){d(this).contents().unwrap()});this.isActive=false};v.prototype.attachColumnResize=
function(a){var b=this;b.detachRowColResize(a);var c=a.closest("tbody").children("tr"),e=a.closest("tr"),f=g.cellIndexToGridColumn(c,c.index(e),e.children().index(a)),j=function(a){var b,e;g.walkCells(c,function(j,k,m,n){j=d(d(c[j]).children()[k]);if(j.hasClass("aloha-table-selectrow")||j.closest("tr").hasClass("aloha-table-selectcolumn")||n>1)return true;if(m===f){e||(e=j.width()-a);g.resizeCellWidth(j,e)}else if(m===f-1){b||(b=j.width()+a);g.resizeCellWidth(j,b)}return true})};a.bind("mousedown.resize",
function(){var e=d("<div></div>"),k=d(a),m=k.outerWidth()-k.innerWidth(),n=k.closest("tbody").innerHeight();e.css({height:n<1?1:n,width:m<1?1:m,top:k.closest("tbody").offset().top,left:k.offset().left,position:"absolute","background-color":"#80B5F2"});d("body").append(e);g.getCellResizeBoundaries(f,c,function(c,f){b.selection.resizeMode=true;d("body").bind("mousemove.dnd_col_resize",function(a){a.pageX>f&&a.pageX<c&&e.css("left",a.pageX)});d("body").bind("mouseup.dnd_col_resize",function(g){var k=
0;g.pageX<f?k=f-a.offset().left:g.pageX>f&&g.pageX<c?k=g.pageX-a.offset().left:g.pageX>c&&(k=c-a.offset().left);k!==0&&j(k);d("body").unbind("mousemove.dnd_col_resize");d("body").unbind("mouseup.dnd_col_resize");b.selection.resizeMode=false;e.remove()})})})};v.prototype.attachRowResize=function(a,b){var c=this;c.detachRowColResize(a);a.bind("mousedown.resize",function(){var e=d("<div></div>"),f=a.closest("tbody").innerWidth(),g=a.outerHeight()-a.innerHeight();e.css({width:f<1?1:f,height:g<1?1:g,top:b?
a.offset().top+a.outerHeight():a.offset().top,left:a.closest("tbody").offset().left,position:"absolute","background-color":"#80B5F2"});d("body").append(e);c.selection.resizeMode=true;d("body").bind("mousemove.dnd_row_resize",function(c){var f=c.pageY,d;d=b?a.closest("tr").offset().top:a.closest("tr").prev("tr").offset().top;f>d&&e.css("top",c.pageY)});d("body").bind("mouseup.dnd_row_resize",function(f){var g=0,g=b?f.pageY-(a.offset().top+a.outerHeight()):f.pageY-a.offset().top,f=b?a.closest("tr"):
a.closest("tr").prev("tr"),g=f.height()+g;g<0&&(g=1);f.css("height",g);d("body").unbind("mousemove.dnd_row_resize");d("body").unbind("mouseup.dnd_row_resize");c.selection.resizeMode=false;e.remove()})})};v.prototype.attachTableResizeWidth=function(a){var b=this,c=a.closest(".aloha-table-wrapper"),e=a.find("tr:not(.aloha-table-selectcolumn) th:last-child, tr:not(.aloha-table-selectcolumn) td:last-child"),f;d.each(e,function(){if(!d(this).attr("colspan")||d(this).attr("colspan")<2){f=d(this);return false}});
e.css("cursor","col-resize");var j=function(b){var c=a.find("tr"),e=f.closest("tr"),j=g.cellIndexToGridColumn(c,c.index(e),e.children().index(f)),k=b-g.getCellBorder(f)-g.getCellPadding(f);g.walkCells(c,function(a,b,e,f){a=d(d(c[a]).children()[b]);if(a.hasClass("aloha-table-selectrow")||a.closest("tr").hasClass("aloha-table-selectcolumn")||f>1)return true;e===j?g.resizeCellWidth(a,k):g.resizeCellWidth(a,a.width());return true})};e.bind("mousedown.resize",function(){var k=d("<div></div>"),m=a.children("tbody").innerHeight(),
n=f.outerWidth()-f.innerWidth();k.css({height:m<1?1:m,width:n<1?1:n,top:a.find("tbody").offset().top,left:a.offset().left+a.outerWidth(),position:"absolute","background-color":"#80B5F2"});d("body").append(k);var o=c.offset().left+c.width(),q=f.offset().left+(f.innerWidth()-f.width())+g.getMinColWidth(f);b.selection.resizeMode=true;d("body").bind("mousemove.dnd_col_resize",function(a){a.pageX>q&&a.pageX<o&&k.css("left",a.pageX)});d("body").bind("mouseup.dnd_col_resize",function(a){var c=0;a.pageX<=
q?c=q-f.offset().left:a.pageX>q&&a.pageX<o?c=a.pageX-f.offset().left:a.pageX>o&&(c=o-f.offset().left);j(c);d("body").unbind("mousemove.dnd_col_resize");d("body").unbind("mouseup.dnd_col_resize");e.unbind("mousedown.resize");e.css("cursor","default");b.selection.resizeMode=false;k.remove()})})};v.prototype.detachRowColResize=function(a){return a.unbind("mousedown.resize")};v.prototype.toString=function(){return"Table"};v.prototype.newCell=function(a){return new b(a,this)};v.prototype.newActiveCell=
function(a){a=new b(a,this);a.activate();return a};v.prototype.getRows=function(){var a=this.obj.get(0).rows;return d.makeArray(a)};return v});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 util/dom aloha/ephemera aloha/console".split(" "),function(l,d,a,k,c,b,
f,g,j,m,e,o,n,r,p,q,s,u,v){function t(a){var b=S(a.summary.getInputElem()),c=a.activeTable.get("waiRed"),e=a.activeTable.get("waiGreen");b.removeClass(c+" "+e);a.activeTable.checkWai()?b.addClass(e):b.addClass(c)}function x(a){var b=S(a),c;if(c=F.Utils.Dom.isEditable(a))if(c=!(0<b.parents(".aloha-editable table").length)){a:{var e,f=b.parents();for(c=0;c<f.length;c++){e=f.eq(c);if(e.is(".aloha-editable")){c=false;break a}if(e.is(".aloha-block")){c=true;break a}}c=false}c=!c}if(c){c=new p(a,B);a=S(s.getEditingHostOf(a));
c.parentEditable=l.getEditableById(a.attr("id"));B.TableRegistry.push(c);a=b.is("table")?"table":"table table";b.find(a).length&&v.warn("Table Plugin","Nested tables found. They will not be initialized.");l.activeEditable===c.parentEditable&&c.activate();return c}return null}function y(a,b){var c,e,f=a.selection.isHeader(),g;for(c=0;c<a.selection.selectedCells.length;c++){g=a.selection.selectedCells[c];for(e=0;e<a.cells.length;e++)if(g===a.cells[e].obj[0]){cell=a.cells[e];break}e=f?l.Markup.transformDomObject(g,
"td").removeAttr("scope").get(0):l.Markup.transformDomObject(g,"th").attr("scope",b).get(0);if(cell!=null){cell.obj[0]=e;cell.deactivate();cell.activate()}d(a.selection.selectedCells[c]).bind("mousedown",function(){var a=d(this).children("div").eq(0);window.setTimeout(function(){a.trigger("focus")},1)})}}function z(a,b,c){for(var e=true,f=0;f<c.length;f++)if(d(c[f]).attr("class").indexOf(b)<0){e=false;break}if(e)for(f=0;f<c.length;f++)d(c[f]).removeClass(b);else for(f=0;f<c.length;f++){d(c[f]).addClass(b);
for(e=0;e<a.length;e++)a[e].cssClass!=b&&d(c[f]).removeClass(a[e].cssClass)}}function E(){var a=[],b=O;d.each(arguments,function(){a.push("."+(this==""?b:b+"-"+this))});return d.trim(a.join(" "))}function A(){var a=[],b=O;d.each(arguments,function(){a.push(this==""?b:b+"-"+this)});return d.trim(a.join(" "))}function C(a,b){var c=a.endContainer,e=a.startContainer,f=c.nodeType==3?c.length:c.childNodes.length;if(e.nodeType==3&&e.parentNode.tagName=="P"&&e.parentNode.childNodes.length==1&&/^(\s|%A0)$/.test(escape(e.data))){e.data=
"";a.startOffset=0;if(c==e)a.endOffset=0}if(!F.Utils.Dom.allowsNesting(e.nodeType==3?e.parentNode:e,b)){a.startOffset==0&&d(e.nodeType==3?e.parentNode:e).addClass("aloha-table-cleanme");a.endOffset==f&&d(c.nodeType==3?c.parentNode:c).addClass("aloha-table-cleanme")}}function J(){for(var a=d(".aloha-table-cleanme").removeClass("aloha-table-cleanme"),b=0;b<a.length;b++)d.trim(d(a[b]).html())==""&&!F.Utils.Dom.isEditingHost(a[b])&&d(a[b]).remove()}var S=d,F=window.GENTICS,B=new a("table");B.createLayer=
void 0;B.config=["table"];B.TableRegistry=[];B.activeTable=void 0;B.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};B.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};B.init=function(){var a=this,b={};u.classes(this.get("className"),this.get("classCellSelected"));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.tableResize=this.settings.tableResize===void 0?false:this.settings.tableResize;this.colResize=this.settings.colResize===void 0?false:this.settings.colResize;this.rowResize=this.settings.rowResize===void 0?false:this.settings.rowResize;if(d.browser.msie&&parseInt(d.browser.version,10)<8)this.rowResize=this.colResize=this.tableResize=false;this.createLayer=new r(this);l.bind("aloha-editable-created",
function(c,e){var f=a.getEditableConfig(e.obj);b[e.getId()]=-1!==d.inArray("table",f);e.obj.bind("mousedown",function(){B.setFocusedTable(void 0)});e.obj.find("table").each(function(a,b){x(b)})});this.initTableButtons();l.bind("aloha-table-selection-changed",function(){if(typeof B.activeTable!=="undefined"&&B.activeTable.selection){B.updateFloatingMenuScope();if(B.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(B.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)}}});l.bind("aloha-selection-changed",function(c,e){if(e.startContainer&&l.activeEditable){b[l.activeEditable.getId()]&&l.Selection.mayInsertTag("table")?
a._createTableButton.show():a._createTableButton.hide();if(a.activeTable)if(e.findMarkup(function(){return this.nodeName==="TABLE"},l.activeEditable.obj)){B.updateFloatingMenuScope();B.setActiveCellStyle()}else{a.activeTable.selection.cellSelectionMode=false;a.activeTable.selection.baseCellPosition=null;a.activeTable.selection.lastSelectionRange=null;a.activeTable.focusOut()}}});l.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 a=B.TableRegistry,b=0;b<a.length;b++)if(a[b].obj.attr("id")===d(this).attr("id")){a[b].activate();return true}x(this)})});l.bind("aloha-editable-deactivated",function(){B.activeTable&&B.activeTable.selection.unselectCells();B.setFocusedTable(void 0);for(var a=B.TableRegistry,b=0;b<a.length;b++)a[b].deactivate()});l.bind("aloha-smart-content-changed",
function(){l.activeEditable&&l.activeEditable.obj.find("table").each(function(){if(B.indexOfTableInRegistry(this)==-1&&x(this))this.id=F.Utils.guid()})});this.settings.summaryinsidebar&&l.bind("aloha-plugins-loaded",function(){a.initSidebar(l.Sidebar.right.show())})};var O="aloha-table";B.initSidebar=function(a){var b=this;b.sidebar=a;b.sidebarPanel=a.addPanel({id:A("sidebar-panel"),title:o.t("table.sidebar.title"),content:"",expanded:true,activeOn:"table",onInit:function(){var a=this;this.setContent('<label class="'+
A("label")+'" for="'+A("textarea")+'" >'+o.t("table.label.target")+'</label><textarea id="'+A("textarea")+'" class="'+A("textarea")+'" />');d(E("textarea")).live("keyup",function(){d(a.effective).attr("summary",d(E("textarea")).val());var c=d('div[class*="wai"]',"table#"+d(a.effective).attr("id"));c.removeClass(b.get("waiGreen"));c.removeClass(b.get("waiRed"));d(E("textarea")).val().trim()!=""?c.addClass(b.get("waiGreen")):c.addClass(b.get("waiRed"))})},onActivate:function(a){this.effective=a;d(E("textarea")).val(d(this.effective).attr("summary"))}});
a.show()};B.isEditableTable=function(a){return F.Utils.Dom.isEditable(a)};B.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};B.getTableFromRegistry=function(a){a=this.indexOfTableInRegistry(a);return a>-1?this.TableRegistry[a]:null};B.isSelectionInTable=function(){var a=l.Selection.getRangeObject(),a=d(a.commonAncestorContainer);return a.length==0?false:a.parents(".aloha-editable table").length?true:false};B.preventNestedTables=
function(){if(this.isSelectionInTable()){j.alert({title:o.t("Table"),text:o.t("table.createTable.nestedTablesNoSupported")});return true}return false};B.initMergeSplitCellsBtns=function(){this._mergecellsButton=c.adopt("mergecells",f,{tooltip:o.t("button.mergecells.tooltip"),icon:"aloha-icon aloha-icon-mergecells",scope:this.name+".cell",click:function(){B.activeTable&&B.activeTable.selection.mergeCells()}});this._splitcellsButton=c.adopt("splitcells",f,{tooltip:o.t("button.splitcells.tooltip"),icon:"aloha-icon aloha-icon-splitcells",
scope:this.name+".cell",click:function(){var a;if(B.activeTable)if(B.activeTable.selection.selectedCells.length>0)B.activeTable.selection.splitCells();else{a=B.selectedOrActiveCells();if(a.length>0){q.splitCell(a,function(){return B.activeTable.newActiveCell().obj});l.trigger("aloha-table-selection-changed")}}}});this._mergecellsRowButton=c.adopt("mergecellsRow",f,{tooltip:o.t("button.mergecells.tooltip"),icon:"aloha-icon aloha-icon-mergecells",scope:this.name+".row",click:function(){B.activeTable&&
B.activeTable.selection.mergeCells()}});this._splitcellsRowButton=c.adopt("splitcellsRow",f,{tooltip:o.t("button.splitcells.tooltip"),icon:"aloha-icon aloha-icon-splitcells",scope:this.name+".row",click:function(){B.activeTable&&B.activeTable.selection.splitCells()}});this._mergecellsColumnButton=c.adopt("mergecellsColumn",f,{tooltip:o.t("button.mergecells.tooltip"),icon:"aloha-icon aloha-icon-mergecells",scope:this.name+".column",click:function(){B.activeTable&&B.activeTable.selection.mergeCells()}});
this._splitcellsColumnButton=c.adopt("splitcellsColumn",f,{tooltip:o.t("button.splitcells.tooltip"),icon:"aloha-icon aloha-icon-splitcells",scope:this.name+".column",click:function(){B.activeTable&&B.activeTable.selection.splitCells()}})};B.initNaturalFitBtn=function(){var a=this;if(this.colResize||this.rowResize)this._tableNaturalFitButton=c.adopt("naturalFit",f,{tooltip:o.t("button.naturalfit.tooltip"),icon:"aloha-icon aloha-icon-table-naturalfit",scope:this.name+".cell",click:function(){if(a.activeTable){var b=
a.activeTable.obj;b.find("td, th").each(function(){d(this).find("div").css("width","");d(this).css("width","")});b.find("tr").each(function(){d(this).css("height","")})}}})};B.initRowsBtns=function(){var a=this;this._addrowbeforeButton=c.adopt("addrowbefore",f,{tooltip:o.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",f,{tooltip:o.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",f,{tooltip:o.t("button.delrows.tooltip"),icon:"aloha-icon aloha-icon-deleterows",scope:this.name+".row",click:function(){if(a.activeTable){var b=a.activeTable;j.confirm({title:o.t("Table"),text:o.t("deleterows.confirm"),yes:function(){b.deleteRows()}})}}});this._rowheaderButton=c.adopt("rowheader",g,{tooltip:o.t("button.rowheader.tooltip"),
icon:"aloha-icon aloha-icon-rowheader",scope:this.name+".row",click:function(){if(a.activeTable){a.activeTable.refresh();y(a.activeTable,"col");a.activeTable.selection.unselectCells();a.activeTable.selection.selectRows(a.activeTable.selection.selectedRowIdxs)}}});this.rowMSItems=[];d.each(this.rowConfig,function(b,c){a.rowMSItems.push({name:c.name,text:o.t(c.text),tooltip:o.t(c.tooltip),iconClass:"aloha-icon aloha-row-layout "+c.iconClass,click:function(){if(a.activeTable){z(a.rowConfig,c.cssClass,
a.activeTable.selection.selectedCells);a.activeTable.selectRows()}}})});this.rowMSItems.length>0&&this.rowMSItems.push({name:"removeFormat",text:o.t("button.removeFormat.text"),tooltip:o.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 e=0;e<a.rowConfig.length;e++)d(b[c]).removeClass(a.rowConfig[e].cssClass);a.activeTable.selectRows()}}});this.rowMSButton=e({items:this.rowMSItems,
name:"formatRow",hideIfEmpty:true,scope:this.name+".row"})};B.initColumnBtns=function(){var a=this;this._addcolumnleftButton=c.adopt("addcolumnleft",f,{tooltip:o.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",f,{tooltip:o.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",f,{tooltip:o.t("button.delcols.tooltip"),icon:"aloha-icon aloha-icon-deletecolumns",scope:this.name+".column",click:function(){if(a.activeTable){var b=a.activeTable;j.confirm({title:o.t("Table"),text:o.t("deletecolumns.confirm"),yes:function(){b.deleteColumns()}})}}});this._columnheaderButton=c.adopt("columnheader",g,{tooltip:o.t("button.columnheader.tooltip"),icon:"aloha-icon aloha-icon-columnheader",scope:this.name+
".column",click:function(){if(a.activeTable){a.activeTable.refresh();y(a.activeTable,"row");a.activeTable.selection.unselectCells();a.activeTable.selection.selectColumns(a.activeTable.selection.selectedColumnIdxs)}}});this.columnMSItems=[];d.each(this.columnConfig,function(b,c){var e={name:c.name,text:o.t(c.text),tooltip:o.t(c.tooltip),iconClass:"aloha-icon aloha-column-layout "+c.iconClass,click:function(){if(a.activeTable){z(a.columnConfig,c.cssClass,a.activeTable.selection.selectedCells);a.activeTable.selectColumns()}}};
a.columnMSItems.push(e)});this.columnMSItems.length>0&&this.columnMSItems.push({name:"removeFormat",text:o.t("button.removeFormat.text"),tooltip:o.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 e=0;e<a.columnConfig.length;e++)d(b[c]).removeClass(a.columnConfig[e].cssClass);a.activeTable.selectColumns()}}});this.columnMSButton=e({items:this.columnMSItems,name:"formatColumn",
hideIfEmpty:true,scope:this.name+".column"})};B.initCellBtns=function(){var a=this;this.cellMSItems=[];d.each(this.cellConfig,function(b,c){var e={name:c.name,text:o.t(c.text),tooltip:o.t(c.tooltip),iconClass:"aloha-icon aloha-column-layout "+c.iconClass,click:function(){if(a.activeTable){z(a.cellConfig,c.cssClass,a.selectedOrActiveCells());a.setActiveCellStyle()}}};a.cellMSItems.push(e)});this.cellMSItems.length>0&&this.cellMSItems.push({name:"removeFormat",text:o.t("button.removeFormat.text"),tooltip:o.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 e=0;e<a.cellConfig.length;e++)d(b[c]).removeClass(a.cellConfig[e].cssClass);a.setActiveCellStyle()}}});this.cellMSButton=e({items:this.cellMSItems,name:"formatCell",hideIfEmpty:true,scope:this.name+".cell"})};B.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",f,{tooltip:o.t("button.createtable.tooltip"),icon:"aloha-icon aloha-icon-createTable",scope:"Aloha.continuoustext",click:function(){B.createDialog(this.element)}});this.initColumnBtns();this.initRowsBtns();this.initCellBtns();this.initMergeSplitCellsBtns();this.initNaturalFitBtn();this.tableMSItems=[];var j=this.tableConfig;d.each(j,function(b,c){a.tableMSItems.push({name:c.name,text:o.t(c.text),
tooltip:o.t(c.tooltip),iconClass:"aloha-icon aloha-table-layout "+c.iconClass,click:function(){if(a.activeTable)if(a.activeTable.obj.hasClass(c.cssClass)){for(b=0;b<j.length;b++)a.activeTable.obj.removeClass(j[b].cssClass);a.tableMSButton.setActiveItem()}else{for(var b=0;b<j.length;b++)a.activeTable.obj.removeClass(j[b].cssClass);a.activeTable.obj.addClass(c.cssClass);a.tableMSButton.setActiveItem(c.cssClass)}}})});this.tableMSItems.length>0&&this.tableMSItems.push({name:"removeFormat",text:o.t("button.removeFormat.text"),
tooltip:o.t("button.removeFormat.tooltip"),cls:"aloha-ui-multisplit-fullwidth",wide:true,click:function(){if(a.activeTable){for(var b=0;b<j.length;b++)a.activeTable.obj.removeClass(a.tableConfig[b].cssClass);a.tableMSButton.setActiveItem()}}});this.tableMSButton=e({items:this.tableMSItems,name:"formatTable",hideIfEmpty:true,scope:this.name+".cell"});this._tableCaptionButton=c.adopt("tableCaption",g,{tooltip:o.t("button.caption.tooltip"),icon:"aloha-icon aloha-icon-table-caption",scope:this.name+".cell",
click:function(){if(a.activeTable){var b=a.activeTable.obj.children("caption");if(b.is("caption")&&b.is(":visible"))b.hide();else{if(!b.is("caption")){b=d("<caption></caption>");a.activeTable.obj.prepend(b)}b.show();d.trim(b.text()).length===0&&b.text(o.t("empty.caption"));a.makeCaptionEditable(b,b.text());var b=b.find("div").eq(0),c=b.contents().eq(0);if(c.length>0){var e=new F.Utils.RangeObject;e.startContainer=e.endContainer=c.get(0);e.startOffset=0;e.endOffset=c.text().length;a.activeTable.obj.find("div.aloha-table-cell-editable").blur();
b.focus();e.select();l.Selection.updateSelection()}}}}});this.summary=m({width:275,name:"tableSummary",noTargetHighlight:true,scope:this.name+".cell",element:d('<input id="aloha-attribute-field-tableSummary" class="aloha-wai-red" style="color: black; padding-left: 32px; background-color: white"/>')});this.summary.addListener("keyup",function(){a.activeTable&&t(a)})};B.makeCaptionEditable=function(a,b){var c=a.children("div");if(c.length===0){c=d("<div></div>");c.addClass("aloha-ui aloha-editable-caption aloha-block");
u.markWrapper(c);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=d(this);c.eq(0).append($this.contents());$this.remove()});c=c.eq(0)}c.contentEditable(true)};B.createDialog=function(a){this.createLayer.set("target",a);this.createLayer.show()};B.createTable=function(a,b){if(!this.preventNestedTables())if(l.activeEditable&&typeof l.activeEditable.obj!=="undefined"){for(var c=document.createElement("table"),
e=c.id=F.Utils.guid(),f=document.createElement("tbody"),g=0;g<b;g++){for(var j=document.createElement("tr"),k=0;k<a;k++){var m=document.createTextNode(" "),n=document.createElement("td");n.appendChild(m);j.appendChild(n)}f.appendChild(j)}c.appendChild(f);C(l.Selection.getRangeObject(),c);F.Utils.Dom.insertIntoDOM(d(c),l.Selection.getRangeObject(),l.activeEditable.obj);J();var c=document.getElementById(e),o=x(c);o&&(S.browser.msie?window.setTimeout(function(){o.cells[0].wrapper.get(0).focus()},20):
o.cells[0].wrapper.get(0).focus());o.focus();B.activeTable.selection.selectionType="cell";B.updateFloatingMenuScope()}else this.error("There is no active Editable where the table can be\t\t\t\tinserted!")};B.setFocusedTable=function(a){null!=this.activeTable&&this.activeTable.selection.unselectCells();for(var b=0;b<B.TableRegistry.length;b++)B.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}B.activeTable=a;B.activeTable&&t(B);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)};B.error=function(a){l.Log.error(this,a)};B.debug=function(a){l.Log.debug(this,a)};B.info=
function(a){l.Log.info(this,a)};B.log=function(a){l.log("log",this,a)};B.get=function(a){if(this.config[a])return this.config[a];if(this.parameters[a])return this.parameters[a]};B.set=function(a,b){this.config[a]?this.config[a]=b:this.parameters[a]=b};B.makeClean=function(a){a.find("td, th").css("cursor","")};B.toString=function(){return this.prefix};B.updateFloatingMenuScope=function(){null!=B.activeTable&&null!=B.activeTable.selection.selectionType&&b.setScope(B.name+"."+B.activeTable.selection.selectionType)};
B.setActiveCellStyle=function(){var a=false,b;this.cellMSButton.setActiveItem();for(var c=this.selectedOrActiveCells(),e=0;e<this.cellConfig.length;e++)if(d(c[0]).hasClass(this.cellConfig[e].cssClass)){b=this.cellConfig[e].name;a=true;break}d(c).each(function(){d(this).hasClass(b)||(a=false)});a&&this.cellMSButton.setActiveItem(b)};B.selectedOrActiveCells=function(){var a=this.activeTable.selection.selectedCells;if(!a||a.length<1)return(a=function(){var a=l.Selection.getRangeObject();return l.activeEditable?
a.findMarkup(function(){return this.nodeName.toLowerCase()==="td"},l.activeEditable.obj):null}())?[a]:[];return a};k.register(B);return B});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":"Preformatted 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 aloha/state-override jquery util/arrays util/maps ui/ui ui/toggleButton ui/port-helper-multi-split PubSub i18n!format/nls/i18n i18n!aloha/nls/i18n aloha/selection".split(" "),function(l,d,a,k,c,b,f,g,j,m,e){function o(a){var b=
k(".aloha-cell-selected");if(b.length>0){var c=0;b.each(function(){var b=k(this).find("div"),e=b.find(a);if(e.length>0){e.contents().unwrap();c++}b.contents().wrap("<"+a+"></"+a+">")});c===b.length&&b.find(a).contents().unwrap();return true}return false}function n(a,b){var c=x[b];y.hasOwnProperty(b)&&(c=y[b]);return f.adopt(c,g,{tooltip:e.t("button."+b+".tooltip"),icon:"aloha-icon aloha-icon-"+c,scope:"Aloha.continuoustext",click:function(){o(b)||a.addMarkup(b);return false}})}function r(a,b){return{name:b,
tooltip:e.t("button."+b+".tooltip"),iconClass:"aloha-icon "+e.t("aloha-large-icon-"+b),markup:k("<"+b+">"),click:function(){var c;if(o(b))c=false;else{a.changeMarkup(b);l.activeEditable&&k.browser.mozilla&&l.activeEditable.obj.focus();l.activeEditable&&l.trigger("aloha-format-block")}return c}}}function p(a,b){return{name:b,text:e.t("button."+b+".text"),tooltip:e.t("button."+b+".tooltip"),wide:true,cls:"aloha-ui-multisplit-fullwidth",click:function(){a.removeFormat()}}}function q(a,b){b.select();
v(a,l.Selection.getRangeObject())}function s(a,b,c){t.Utils.Dom.addMarkup(b,c);q(a,b)}function u(a,b,c){b=b.getEditableConfig(c.obj);return k.inArray(a,b)>-1}function v(a,b){var c,e,f,d,g;k.each(a.buttons,function(a,e){var g=false,j=A[e.markup[0].nodeName]||[e.markup[0].nodeName];for(f=0;f<b.markupEffectiveAtStart.length;f++){c=b.markupEffectiveAtStart[f];for(d=0;d<j.length;d++)if(l.Selection.standardTextLevelSemanticsComparator(c,k("<"+j[d]+">"))){e.handle.setState(true);g=true}}g||e.handle.setState(false)});
if(a.multiSplitItems.length>0){e=false;for(f=0;f<b.markupEffectiveAtStart.length&&!e;f++){c=b.markupEffectiveAtStart[f];for(d=0;d<a.multiSplitItems.length&&!e;d++){g=a.multiSplitItems[d];if(g.markup&&l.Selection.standardTextLevelSemanticsComparator(c,g.markup)){a.multiSplitButton.setActiveItem(g.name);e=true}}}e||a.multiSplitButton.setActiveItem(null)}}var t=window.GENTICS,x={b:"bold",strong:"bold",i:"italic",em:"italic",del:"strikethrough",sub:"subscript",sup:"superscript",u:"underline",s:"strikethrough"},
y={strong:"strong",em:"emphasis",s:"strikethrough2"},z={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},E={p:true,h1:true,h2:true,h3:true,h4:true,h5:true,h6:true,pre:true},A={B:["STRONG","B"],I:["EM","I"],STRONG:["STRONG","B"],EM:["EM","I"]};return d.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 a=this;typeof this.settings.hotKey!=="undefined"&&k.extend(true,this.hotKey,this.settings.hotKey);this.initButtons();l.bind("aloha-plugins-loaded",
function(){a.initSidebar(l.Sidebar.right)});l.bind("aloha-editable-activated",function(b,c){a.applyButtonConfig(c.editable.obj);var e=function(b){return function(){u(b,a,c.editable)&&a.addMarkup(b);return false}},f=function(b){return function(){u(b,a,c.editable)&&a.changeMarkup(b);return false}};c.editable.obj.bind("keydown.aloha.format",a.hotKey.formatBold,e("b"));c.editable.obj.bind("keydown.aloha.format",a.hotKey.formatItalic,e("i"));c.editable.obj.bind("keydown.aloha.format",a.hotKey.formatDel,
e("del"));c.editable.obj.bind("keydown.aloha.format",a.hotKey.formatSub,e("sub"));c.editable.obj.bind("keydown.aloha.format",a.hotKey.formatSup,e("sup"));c.editable.obj.bind("keydown.aloha.format",a.hotKey.formatParagraph,f("p"));c.editable.obj.bind("keydown.aloha.format",a.hotKey.formatH1,f("h1"));c.editable.obj.bind("keydown.aloha.format",a.hotKey.formatH2,f("h2"));c.editable.obj.bind("keydown.aloha.format",a.hotKey.formatH3,f("h3"));c.editable.obj.bind("keydown.aloha.format",a.hotKey.formatH4,
f("h4"));c.editable.obj.bind("keydown.aloha.format",a.hotKey.formatH5,f("h5"));c.editable.obj.bind("keydown.aloha.format",a.hotKey.formatH6,f("h6"));c.editable.obj.bind("keydown.aloha.format",a.hotKey.formatPre,f("pre"))});l.bind("aloha-editable-deactivated",function(a,b){b.editable.obj.unbind("keydown.aloha.format")})},applyButtonConfig:function(a){var a=this.getEditableConfig(a),b,c;if(typeof a==="object"){var e=[];k.each(a,function(a,b){typeof a==="number"&&typeof b==="string"||e.push(a)});e.length>
0&&(a=e)}this.formatOptions=a;for(b in this.buttons)this.buttons.hasOwnProperty(b)&&(k.inArray(b,a)!==-1?this.buttons[b].handle.show():this.buttons[b].handle.hide());c=this.multiSplitItems.length;for(b=0;b<c;b++)k.inArray(this.multiSplitItems[b].name,a)!==-1?this.multiSplitButton.showItem(this.multiSplitItems[b].name):this.multiSplitButton.hideItem(this.multiSplitItems[b].name)},initButtons:function(){var a=this;this.buttons={};this.multiSplitItems=[];k.each(this.availableButtons,function(b,c){var e=
false;if(typeof b!=="number"&&typeof c!=="string"){e=c;c=b}z[c]?a.buttons[c]={handle:n(a,c),markup:k("<"+c+">",{"class":e||""})}:E[c]?a.multiSplitItems.push(r(a,c)):"removeFormat"===c?a.multiSplitItems.push(p(a,c)):l.log("warn",a,'Button "'+c+'" is not defined')});this.multiSplitButton=j({name:"formatBlock",items:this.multiSplitItems,hideIfEmpty:true,scope:"Aloha.continuoustext"});m.sub("aloha.selection.context-change",function(b){v(a,b.range)})},initSidebar:function(a){var b=this;b.sidebar=a;a.addPanel({id:b.nsClass("sidebar-panel-class"),
title:e.t("floatingmenu.tab.format"),content:"",expanded:true,activeOn:this.formatOptions||false,onInit:function(){},onActivate:function(a){var c=this;c.effective=a;if(a[0]){c.format=a[0].nodeName.toLowerCase();var f=k("<div>").attr("class",b.nsClass("target-container")),d=k("<fieldset>");d.append(k("<legend>"+c.format+" "+e.t("format.class.legend")).append(k("<select>")));f.append(d);var g='<div class="'+b.nsClass("target-container")+'"><fieldset><legend>'+e.t("format.class.legend")+'</legend><select name="targetGroup" class="'+
b.nsClass("radioTarget")+'"><option value="">'+e.t("format.class.none")+"</option>";b.config[c.format]&&b.config[c.format]["class"]&&k.each(b.config[c.format]["class"],function(a,b){g=g+('<option value="'+a+'" >'+b+"</option>")});g=g+"</select></fieldset></div>";c=this;this.setContent(g);k(b.nsSel("framename")).live("keyup",function(){k(c.effective).attr("target",k(this).val().replace('"',"&quot;").replace("'","&#39;"))});c=this;c.effective=a;k(b.nsSel("linkTitle")).val(k(c.effective).attr("title"))}}});
a.show()},nsClass:function(){var a=[];k.each(arguments,function(){a.push(this==""?"aloha-format":"aloha-format-"+this)});return k.trim(a.join(" "))},nsSel:function(){var a=[];k.each(arguments,function(){a.push("."+(this==""?"aloha-format":"aloha-format-"+this))});return k.trim(a.join(" "))},addMarkup:function(b){var e=this,f=k("<"+b+">"),d=l.Selection.rangeObject;if(!(typeof b==="undefined"||b=="")){var g=A[f[0].nodeName]||[f[0].nodeName],j=d.findMarkup(function(){return-1!==c.indexOf(g,this.nodeName)},
l.activeEditable.obj);if(j){d.isCollapsed()?t.Utils.Dom.removeFromDOM(j,d,true):t.Utils.Dom.removeMarkup(d,k(j),l.activeEditable.obj);q(e,d)}else{if(d.isCollapsed()){t.Utils.Dom.extendToWord(d);if(d.isCollapsed()&&a.enabled()){a.setWithRangeObject(x[b],d,function(a,b){s(e,b,f)});return}}s(e,d,f)}}},changeMarkup:function(a){l.Selection.changeMarkupOnSelection(k("<"+a+">"))},removeFormat:function(){var a=["u","strong","em","b","i","q","del","s","code","sub","sup","p","h1","h2","h3","h4","h5","h6","pre",
"quote","blockquote"],b=l.Selection.rangeObject,c;if(this.settings.removeFormats)a=this.settings.removeFormats;if(!b.isCollapsed()){for(c=0;c<a.length;c++)t.Utils.Dom.removeMarkup(b,k("<"+a[c]+">"),l.activeEditable.obj);b.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(l,d,a,k,c,b,f,g,j,m,e){function o(a,b){d(a).find(a.nodeName).each(function(){var a=l.Selection.getSelectionTree();n(a,this)&&l.Markup.transformDomObject(this,b,l.Selection.rangeObject)});l.Markup.transformDomObject(a,b,l.Selection.rangeObject)}function n(a,b){var c=false;
d.each(a,function(a,e){if(e.domobj===b&&e.selection!=="none"||n(e.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=k.adopt("orderedList",f,{tooltip:g.t("button.createolist.tooltip"),icon:"aloha-icon aloha-icon-orderedlist",scope:"Aloha.continuoustext",click:function(){a.transformList(true)}});this._unorderedListButton=
k.adopt("unorderedList",f,{tooltip:g.t("button.createulist.tooltip"),icon:"aloha-icon aloha-icon-unorderedlist",scope:"Aloha.continuoustext",click:function(){a.transformList(false)}});this._indentListButton=k.adopt("indentList",b,{tooltip:g.t("button.indentlist.tooltip"),icon:"aloha-icon aloha-icon-indent",scope:"Aloha.continuoustext",click:function(){a.indentList()}});this._outdentListButton=k.adopt("outdentList",b,{tooltip:g.t("button.outdentlist.tooltip"),icon:"aloha-icon aloha-icon-outdent",scope:"Aloha.continuoustext",
click:function(){a.outdentList()}});c.createScope("Aloha.List","Aloha.continuoustext");e.sub("aloha.selection.context-change",function(b){var c,e=b.range;a._outdentListButton.show(false);a._indentListButton.show(false);a._unorderedListButton.setState(false);a._orderedListButton.setState(false);for(b=0;b<e.markupEffectiveAtStart.length;b++){c=e.markupEffectiveAtStart[b];if(l.Selection.standardTagNameComparator(c,d("<ul></ul>"))){a._unorderedListButton.setState(true);a._outdentListButton.show(true);
a._indentListButton.show(true);break}if(l.Selection.standardTagNameComparator(c,d("<ol></ol>"))){a._orderedListButton.setState(true);a._outdentListButton.show(true);a._indentListButton.show(true);break}}l.activeEditable&&a.applyButtonConfig(l.activeEditable.obj)});l.Markup.addKeyHandler(9,function(b){return a.processTab(b)})},applyButtonConfig:function(a){a=this.getEditableConfig(a);if(l.Selection.rangeObject.unmodifiableMarkupAtStart[0]){d.inArray("ul",a)!=-1&&l.Selection.canTag1WrapTag2(l.Selection.rangeObject.unmodifiableMarkupAtStart[0].nodeName,
"ul")!=-1?this._unorderedListButton.show(true):this._unorderedListButton.show(false);d.inArray("ol",a)!=-1&&l.Selection.canTag1WrapTag2(l.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=l.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=l.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,e,f,g;this._outdentListButton.show(true);this._indentListButton.show(true);if(!b){l.Selection.changeMarkupOnSelection(d("<p></p>"));
b=this.getStartingDomObjectToTransform();if(!b){if(l.Selection.rangeObject.startContainer.contentEditable){a=a?d("<ol></ol>"):d("<ul></ul>");e=d("<li></li>");a.append(e);f=e.get(0);b=l.getActiveEditable().obj;f.appendChild(document.createTextNode(""));b.append(a);b.focus();a=l.createRange();b=l.getSelection();a.setStart(f.firstChild,0);a.setEnd(f.firstChild,0);b.removeAllRanges();b.addRange(a);l.Selection.updateSelection()}else l.Log.error(this,"Could not transform selection into a list");return}}f=
b.nodeName.toLowerCase();if(f=="ul"&&!a){a=d(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=d(b);d.each(a.children("li"),function(a,b){g=l.Markup.transformDomObject(b,"p",l.Selection.rangeObject);g.after(g.children("ol,ul"));m.ensureContainerEditable(g.get(0))});a.children().unwrap()}}else if(f=="ul"&&a){o(b,"ol");this.mergeAdjacentLists(d(b))}else if(f=="ol"&&!a){o(b,
"ul");this.mergeAdjacentLists(d(b))}else if(f=="ol"&&a){a=d(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=d(b);d.each(a.children("li"),function(a,b){g=l.Markup.transformDomObject(b,"p",l.Selection.rangeObject);g.after(g.children("ol,ul"));m.ensureContainerEditable(g.get(0))});a.children().unwrap()}}else{f=l.Selection.rangeObject.getSelectedSiblings(b);a=a?d("<ol></ol>"):
d("<ul></ul>");e=d("<li></li>");a.append(e);d(b).contents().appendTo(e);d(b).replaceWith(a);if(l.Selection.rangeObject.startContainer==b)l.Selection.rangeObject.startContainer=e.get(0);if(l.Selection.rangeObject.endContainer==b)l.Selection.rangeObject.endContainer=e.get(0);if(f){b=false;for(c=0;c<f.length;++c)if(r.Utils.Dom.isBlockLevelElement(f[c])){b&&(b=false);e=l.Markup.transformDomObject(f[c],"li",l.Selection.rangeObject);a.append(e)}else if(!(f[c].nodeType==3&&d.trim(f[c].data).length===0)){if(!b){b=
d("<li></li>");a.append(b);e=b}b.append(f[c])}}this.mergeAdjacentLists(a);f=e.get(0);if(r.Utils.Dom.isEmpty(f)){a=l.createRange();b=l.getSelection();f.appendChild(document.createTextNode(""));a.selectNodeContents(f.lastChild);b.removeAllRanges();b.addRange(a);l.Selection.updateSelection()}}this.refreshSelection()},indentList:function(){var a=this.getNearestSelectedListItem(),b,c,e;if(a){e=d(a).prev("li");if(e.length===0)return false;d(a).parent();c=l.Selection.rangeObject.getSelectedSiblings(a);b=
d(a).parent().clone(false).empty();b.append(a);e.append(b);if(c)for(a=0;a<c.length;++a)b.append(d(c[a]));this.mergeAdjacentLists(b,true);this.refreshSelection();return false}return true},outdentList:function(){var a=this.getNearestSelectedListItem(),b,c,e,f,g;if(a){c=d(a);e=c.parent();b=e.parents("ul,ol");f=e.parent("li");if(b.length>0&&r.Utils.Dom.isListElement(b.get(0))){g=(a=l.Selection.rangeObject.getSelectedSiblings(a))&&a.length>0?d(a[a.length-1]):c;if(g.nextAll("li").length>0){b=e.clone(false).empty();
b.append(g.nextAll());g.append(b)}f.length>0?f.after(c):e.before(c);if(a&&a.length>0)for(b=a.length-1;b>=0;--b)c.after(d(a[b]));e.contents("li").length===0&&e.remove();f.length>0&&f.contents().length===0&&f.remove();this.refreshSelection()}return false}return true},refreshSelection:function(){l.Selection.rangeObject.update();l.Selection.rangeObject.select();l.Selection.updateSelection()},mergeAdjacentLists:function(a,b){for(var c=a.get(0),e;c.previousSibling&&c.previousSibling.nodeType===1&&this.isMergable(c.previousSibling,
c,b);)c=c.previousSibling;for(a=d(c);c.nextSibling&&(c.nextSibling.nodeType===1&&this.isMergable(c.nextSibling,c,b)||c.nextSibling.nodeType===3&&d.trim(c.nextSibling.data).length===0);){e=d(c.nextSibling);c.nextSibling.nodeType==1&&e.contents().appendTo(a);e.remove()}},isMergable:function(a,b,c){return c?a.nodeName.toLowerCase()=="ul"||a.nodeName.toLowerCase()=="ol":a.nodeName==b.nodeName}});m.commands.insertorderedlist={action:function(a,b){p.transformList(true);if(b&&l.Selection.rangeObject){b.startContainer=
l.Selection.rangeObject.startContainer;b.startOffset=l.Selection.rangeObject.startOffset;b.endContainer=l.Selection.rangeObject.endContainer;b.endOffset=l.Selection.rangeObject.endOffset}},indeterm:function(){},state:function(){for(i=0;i<rangeObject.markupEffectiveAtStart.length;i++){effectiveMarkup=rangeObject.markupEffectiveAtStart[i];if(l.Selection.standardTagNameComparator(effectiveMarkup,d("<ul></ul>")))break;if(l.Selection.standardTagNameComparator(effectiveMarkup,d("<ol></ol>")))return true}return false}};
m.commands.insertunorderedlist={action:function(a,b){p.transformList(false);if(b&&l.Selection.rangeObject){b.startContainer=l.Selection.rangeObject.startContainer;b.startOffset=l.Selection.rangeObject.startOffset;b.endContainer=l.Selection.rangeObject.endContainer;b.endOffset=l.Selection.rangeObject.endOffset}},indeterm:function(){},state:function(){for(i=0;i<rangeObject.markupEffectiveAtStart.length;i++){effectiveMarkup=rangeObject.markupEffectiveAtStart[i];if(l.Selection.standardTagNameComparator(effectiveMarkup,
d("<ul></ul>")))return true;if(l.Selection.standardTagNameComparator(effectiveMarkup,d("<ol></ol>")))break}return false}};m.commands.indent={action:function(a,b){p.indentList();if(b&&l.Selection.rangeObject){b.startContainer=l.Selection.rangeObject.startContainer;b.startOffset=l.Selection.rangeObject.startOffset;b.endContainer=l.Selection.rangeObject.endContainer;b.endOffset=l.Selection.rangeObject.endOffset}},indeterm:function(){},state:function(){return false}};m.commands.outdent={action:function(a,
b){p.outdentList();if(b&&l.Selection.rangeObject){b.startContainer=l.Selection.rangeObject.startContainer;b.startOffset=l.Selection.rangeObject.startOffset;b.endContainer=l.Selection.rangeObject.endContainer;b.endOffset=l.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(l,d,a,
k,c,b,f,g,j){return d.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",g,{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",f,{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",f,{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=j({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=j({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",f,{tooltip:a.t("button.img.align.left.tooltip"),icon:"aloha-img aloha-image-align-left",scope:b.name,click:function(){var a=l(b.getPluginFocus());a.add(a.parent()).css("float","left")}});this._imageAlignRightButton=c.adopt("imageAlignRight",f,{tooltip:a.t("button.img.align.right.tooltip"),
icon:"aloha-img aloha-image-align-right",scope:b.name,click:function(){var a=l(b.getPluginFocus());a.add(a.parent()).css("float","right")}});this._imageAlignNoneButton=c.adopt("imageAlignNone",f,{tooltip:a.t("button.img.align.none.tooltip"),icon:"aloha-img aloha-image-align-none",scope:b.name,click:function(){var a=l(b.getPluginFocus());a.add(a.parent()).css({"float":"none",display:"inline-block"})}})},_addUIMarginButtons:function(){var b=this.plugin;this._imageIncPaddingButton=c.adopt("imageIncPadding",
f,{tooltip:a.t("padding.increase"),icon:"aloha-img aloha-image-padding-increase",scope:b.name,click:function(){l(b.getPluginFocus()).increase("padding")}});this._imageDecPaddingButton=c.adopt("imageDecPadding",f,{tooltip:a.t("padding.decrease"),icon:"aloha-img aloha-image-padding-decrease",scope:b.name,click:function(){l(b.getPluginFocus()).decrease("padding")}})},_addUICropButtons:function(){var f=this.plugin;b.createScope("Aloha.img",["Aloha.global"]);this._imageCropButton=c.adopt("imageCropButton",
g,{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=j({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=j({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(l){(function(d){d.Jcrop=function(a,k){function c(a){return""+parseInt(a)+"px"}function b(a){a=d(a).offset();return[a.left,a.top]}function f(a){return[a.pageX-T[0],a.pageY-T[1]]}function g(a,b){return function(c){if(t.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}Q.setCurrent(c);I.update()}}function j(a){var b=a;D.watchKeys();return function(a){Q.moveOffset([a[0]-b[0],a[1]-b[1]]);b=a;I.update()}}function m(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 e(a){return function(c){if(t.disabled||"move"==a&&!t.allowMove)return!1;Z=!0;var e=f(c);T=b(y);P.setCursor("move"==a?a:a+"-resize");if("move"==a)P.activateHandlers(j(e),n);else{var e=Q.getFixed(),d=m(a),k=Q.getCorner(m(d));Q.setPressed(Q.getCorner(d));Q.setCurrent(k);P.activateHandlers(g(a,e),n)}c.stopPropagation();c.preventDefault();return!1}}function o(a){return{x:parseInt(a.x*N),y:parseInt(a.y*H),x2:parseInt(a.x2*N),y2:parseInt(a.y2*H),w:parseInt(a.w*N),h:parseInt(a.h*H)}}function n(){var a=
Q.getFixed();a.w>t.minSelect[0]&&a.h>t.minSelect[1]?(I.enableHandles(),I.done()):I.release();P.setCursor(t.allowSelect?"crosshair":"default")}function l(a){Q.setCurrent(a);I.update()}function p(){var a=d("<div></div>").addClass(t.baseClass+"-tracker");d.browser.msie&&a.css({opacity:0,backgroundColor:"white"});return a}function q(a){s([a[0]/N,a[1]/H,a[2]/N,a[3]/H])}function s(a){Q.setPressed([a[0],a[1]]);Q.setCurrent([a[2],a[3]]);I.update()}function u(a){"object"!=typeof a&&(a={});t=d.extend(t,a);
"function"!==typeof t.onChange&&(t.onChange=function(){});"function"!==typeof t.onSelect&&(t.onSelect=function(){})}function v(a){t.allowResize?a?I.enableOnly():I.enableHandles():I.disableHandles();P.setCursor(t.allowSelect?"crosshair":"default");I.setCursor(t.allowMove?"move":"default");A.css("backgroundColor",t.bgColor);"setSelect"in t&&(q(k.setSelect),I.done(),delete t.setSelect);"trueSize"in t&&(N=t.trueSize[0]/z,H=t.trueSize[1]/E);Y=t.maxSize[0]||0;R=t.maxSize[1]||0;V=t.minSize[0]||0;G=t.minSize[1]||
0;"outerImage"in t&&(y.attr("src",t.outerImage),delete t.outerImage);I.refresh()}"object"!==typeof a&&(a=d(a)[0]);"object"!==typeof k&&(k={});"trackDocument"in k||(k.trackDocument=d.browser.msie?!1:!0,d.browser.msie&&"8"==d.browser.version.split(".")[0]&&(k.trackDocument=!0));"keySupport"in k||(k.keySupport=d.browser.msie?!1:!0);var t={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(){}};u(k);var x=d(a),y=x.clone().removeAttr("id").css({position:"absolute"});y.width(x.width());y.height(x.height());x.after(y).hide();(function(a,b,c){var e=a.width(),f=a.height();if(e>b&&b>0){e=b;f=b/a.width()*a.height()}if(f>
c&&c>0){f=c;e=c/a.height()*a.width()}N=a.width()/e;H=a.height()/f;a.width(e).height(f)})(y,t.boxWidth,t.boxHeight);var z=y.width(),E=y.height(),A=d("<div />").width(z).height(E).addClass(t.baseClass+"-holder").css({position:"relative",backgroundColor:t.bgColor}).insertAfter(x).append(y);t.addClass&&A.addClass(t.addClass);var C=d("<img />").attr("src",y.attr("src")).css("position","absolute").width(z).height(E),J=d("<div />").width("100%").height("100%").css({zIndex:310,position:"absolute",overflow:"hidden"}).append(C),
S=d("<div />").width("100%").height("100%").css("zIndex",320),F=d("<div />").css({position:"absolute",zIndex:300}).insertBefore(y).append(J,S),B=t.boundary,O=p().width(z+2*B).height(E+2*B).css({position:"absolute",top:c(-B),left:c(-B),zIndex:290}).mousedown(function(a){if(t.disabled||!t.allowSelect)return false;Z=true;T=b(y);I.disableHandles();if("crosshair"!=X){P.setCursor("crosshair");X="crosshair"}var c=f(a);Q.setPressed(c);P.activateHandlers(l,n);D.watchKeys();I.update();a.stopPropagation();a.preventDefault();
return false}),Y,R,V,G,N,H,T=b(y),Z,X,da,la,Q=function(){function a(){if(!t.aspectRatio){var b=g-f,k=j-d;Y&&Math.abs(b)>Y&&(g=b>0?f+Y:f-Y);R&&Math.abs(k)>R&&(j=k>0?d+R:d-R);G&&Math.abs(k)<G&&(j=k>0?d+G:d-G);V&&Math.abs(b)<V&&(g=b>0?f+V:f-V);if(f<0){g=g-f;f=f-f}if(d<0){j=j-d;d=d-d}if(g<0){f=f-g;g=g-g}if(j<0){d=d-j;j=j-j}if(g>z){b=g-z;f=f-b;g=g-b}if(j>E){b=j-E;d=d-b;j=j-b}if(f>z){b=f-E;j=j-b;d=d-b}if(d>E){b=d-E;j=j-b;d=d-b}return e(c(f,d,g,j))}var b=t.aspectRatio,k=t.minSize[0]/N,m=t.maxSize[0]/N,n=
g-f,o=j-d,l=Math.abs(n),p=Math.abs(o);m==0&&(m=z*10);if(l/p<b){l=j;w=p*b;p=n<0?f-w:w+f;if(p<0){p=0;h=Math.abs((p-f)/b);l=o<0?d-h:h+d}else if(p>z){p=z;h=Math.abs((p-f)/b);l=o<0?d-h:h+d}}else{p=g;h=l/b;l=o<0?d-h:d+h;if(l<0){l=0;w=Math.abs((l-d)*b);p=n<0?f-w:w+f}else if(l>E){l=E;w=Math.abs(l-d)*b;p=n<0?f-w:w+f}}if(p>f){p-f<k?p=f+k:p-f>m&&(p=f+m);l=l>d?d+(p-f)/b:d-(p-f)/b}else if(p<f){f-p<k?p=f-k:f-p>m&&(p=f-m);l=l>d?d+(f-p)/b:d-(f-p)/b}if(p<0){f=f-p;p=0}else if(p>z){f=f-(p-z);p=z}if(l<0){d=d-l;l=0}else if(l>
E){d=d-(l-E);l=E}return last=e(c(f,d,p,l))}function b(a){a[0]<0&&(a[0]=0);a[1]<0&&(a[1]=0);a[0]>z&&(a[0]=z);a[1]>E&&(a[1]=E);return[a[0],a[1]]}function c(a,b,e,f){var d=a,g=e,j=b,k=f;if(e<a){d=e;g=a}if(f<b){j=f;k=b}return[Math.round(d),Math.round(j),Math.round(g),Math.round(k)]}function e(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,d=0,g=0,j=0,k,m;return{flipCoords:c,setPressed:function(a){a=b(a);g=f=a[0];j=d=a[1]},setCurrent:function(a){a=b(a);k=a[0]-g;m=a[1]-j;g=a[0];
j=a[1]},getOffset:function(){return[k,m]},moveOffset:function(a){var b=a[0],a=a[1];0>f+b&&(b=b-(b+f));0>d+a&&(a=a-(a+d));E<j+a&&(a=a+(E-(j+a)));z<g+b&&(b=b+(z-(g+b)));f=f+b;g=g+b;d=d+a;j=j+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}}(),I=function(){function a(b){b=d("<div />").css({position:"absolute",opacity:t.borderOpacity}).addClass(t.baseClass+"-"+b);J.append(b);return b}
function b(a,c){var f=d("<div />").mousedown(e(a)).css({cursor:a+"-resize",position:"absolute",zIndex:c});S.append(f);return f}function f(a){var e=t.handleSize,d=A,g=e;switch(a){case "n":case "s":e="100%";break;case "e":case "w":g="100%"}return b(a,u++).width(e).height(g).css({top:c(-d+1),left:c(-d+1)})}function g(a){for(i in a)x[a[i]]=b(a[i],u++).css({top:c(-A+1),left:c(-A+1),opacity:t.handleOpacity}).addClass(t.baseClass+"-handle")}function j(a){var b=Math.round(a.h/2-A),e=Math.round(a.w/2-A);west=
-A+1;var f=a.w-A,a=a.h-A;"e"in x&&x.e.css({top:c(b),left:c(f)})&&x.w.css({top:c(b)})&&x.s.css({top:c(a),left:c(e)})&&x.n.css({left:c(e)});"ne"in x&&x.ne.css({left:c(f)})&&x.se.css({top:c(a),left:c(f)})&&x.sw.css({top:c(a)});"b"in x&&x.b.css({top:c(a)})&&x.r.css({left:c(f)})}function k(){var a=Q.getFixed();Q.setPressed([a.x,a.y]);Q.setCurrent([a.x2,a.y2]);m()}function m(){if(s)return n()}function n(){var a=Q.getFixed(),b=a.h;F.width(a.w).height(b);var b=a.x,e=a.y;C.css({top:c(-e),left:c(-b)});F.css({top:c(e),
left:c(b)});t.drawBorders&&v.right.css({left:c(a.w-1)})&&v.bottom.css({top:c(a.h-1)});z&&j(a);if(!s){F.show();y.css("opacity",t.bgOpacity);s=true}t.onChange(o(a))}function l(){z=true;if(t.allowResize){j(Q.getFixed());S.show();return true}}function q(){z=false;S.hide()}function r(a){(da=a)?q():l()}var s,u=370,v={},x={},z=false,A=t.handleOffset;t.drawBorders&&(v={top:a("hline").css("top",d.browser.msie?c(-1):c(0)),bottom:a("hline"),left:a("vline"),right:a("vline")});if(t.dragEdges){x.t=f("n");x.b=f("s");
x.r=f("e");x.l=f("w")}t.sideHandles&&g(["n","s","e","w"]);t.cornerHandles&&g(["sw","nw","ne","se"]);var E=p().mousedown(e("move")).css({cursor:"move",position:"absolute",zIndex:360});J.append(E);q();return{updateVisible:m,update:n,release:function(){q();F.hide();y.css("opacity",1);s=false},refresh:k,setCursor:function(a){E.css("cursor",a)},enableHandles:l,enableOnly:function(){z=true},showHandles:function(){if(z){j(Q.getFixed());S.show()}},disableHandles:q,animMode:r,done:function(){r(false);k()}}}(),
P=function(){function a(b){c(f(b))}function b(j){j.preventDefault();j.stopPropagation();if(Z){Z=false;e(f(j));t.onSelect(o(Q.getFixed()));O.css({zIndex:290});g&&d(document).unbind("mousemove",a).unbind("mouseup",b);c=function(){};e=function(){}}return false}var c=function(){},e=function(){},g=t.trackDocument;g||O.mousemove(a).mouseup(b).mouseout(b);y.before(O);return{activateHandlers:function(f,j){Z=true;c=f;e=j;O.css({zIndex:450});g&&d(document).mousemove(a).mouseup(b);return false},setCursor:function(a){O.css("cursor",
a)}}}(),D=function(){function a(b,c,e){if(t.allowMove){Q.moveOffset([c,e]);I.updateVisible()}b.preventDefault();b.stopPropagation()}var b=d('<input type="radio" />').css({position:"absolute",left:"-30px"}).keypress(function(b){if(b.ctrlKey)return true;var c=(la=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:I.release();break;case 9:return true}return nothing(b)}).blur(function(){b.hide()}),c=d("<div />").css({position:"absolute",
overflow:"hidden"}).append(b);t.keySupport&&c.insertBefore(y);return{watchKeys:function(){if(t.keySupport){b.show();b.focus()}}}}();S.hide();v(!0);B={animateTo:function(a){var b=a[0]/N,c=a[1]/H,e=a[2]/N,f=a[3]/H;if(!da){var a=Q.flipCoords(b,c,e,f),b=Q.getFixed(),d=initcr=[b.x,b.y,b.x2,b.y2],g=t.animationDelay,j=d[0],k=d[1],e=d[2],f=d[3],m=a[0]-initcr[0],n=a[1]-initcr[1],o=a[2]-initcr[2],l=a[3]-initcr[3],p=0,q=t.swingSpeed;I.animMode(true);var r=function(){return function(){p=p+(100-p)/q;d[0]=j+p/
100*m;d[1]=k+p/100*n;d[2]=e+p/100*o;d[3]=f+p/100*l;p<100?window.setTimeout(r,g):I.done();p>=99.8&&(p=100);s(d)}}();window.setTimeout(r,g)}},setSelect:q,setOptions:function(a){u(a);v()},tellSelect:function(){return o(Q.getFixed())},tellScaled:function(){return Q.getFixed()},disable:function(){t.disabled=true;I.disableHandles();I.setCursor("default");P.setCursor("default")},enable:function(){t.disabled=false;v()},cancel:function(){I.done();P.activateHandlers(null,null)},focus:D.watchKeys,getBounds:function(){return[z*
N,E*H]},getWidgetSize:function(){return[z,E]},release:I.release,destroy:function(){A.remove();x.show()}};x.data("Jcrop",B);return B};d.fn.Jcrop=function(a){function k(c){var b=a.useImg||c.src,f=new Image;f.onload=function(){d.Jcrop(c,a)};f.src=b}"object"!==typeof a&&(a={});this.each(function(){if(d(this).data("Jcrop")){if("api"==a)return d(this).data("Jcrop");d(this).data("Jcrop").setOptions(a)}else k(this)});return this}})(l)});define("image/vendor/mousewheel/mousewheel",["jquery"],function(l){(function(d){function a(a){var c=
a||window.event,g=[].slice.call(arguments,1),j=0,k=0,e=0,a=d.event.fix(c);a.type="mousewheel";c.wheelDelta&&(j=c.wheelDelta/120);c.detail&&(j=-c.detail/3);e=j;void 0!==c.axis&&c.axis===c.HORIZONTAL_AXIS&&(e=0,k=-1*j);void 0!==c.wheelDeltaY&&(e=c.wheelDeltaY/120);void 0!==c.wheelDeltaX&&(k=-1*c.wheelDeltaX/120);g.unshift(a,j,k,e);return(d.event.dispatch||d.event.handle).apply(this,g)}var k=["DOMMouseScroll","mousewheel"];if(d.event.fixHooks)for(var c=k.length;c;)d.event.fixHooks[k[--c]]=d.event.mouseHooks;
d.event.special.mousewheel={setup:function(){if(this.addEventListener)for(var b=k.length;b;)this.addEventListener(k[--b],a,!1);else this.onmousewheel=a},teardown:function(){if(this.removeEventListener)for(var b=k.length;b;)this.removeEventListener(k[--b],a,!1);else this.onmousewheel=null}};d.fn.extend({mousewheel:function(a){return a?this.bind("mousewheel",a):this.trigger("mousewheel")},unmousewheel:function(a){return this.unbind("mousewheel",a)}})})(l)});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(l,d,a,k,c){var b=l,f=window.GENTICS,g=window.Aloha,j=false,m=false,e=false;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;l.extend(true,l.fn,{increase:l.fn.increase||
function(a){var b=l(this),c,e;if(!b.length)return b;c=b.css(a).toFloat();e=Math.round((c||1)*1.2);c===e&&e++;b.css(a,e);return b},decrease:l.fn.decrease||function(a){var b=l(this),c,e;if(!b.length)return b;c=b.css(a).toFloat();e=Math.round((c||0)*0.8);c===e&&e>0&&e--;b.css(a,e);return b}});return d.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){g.Log.info("Default onCropped invoked",a,b)},onReset:function(a){g.Log.info("Default onReset invoked",a);return false},onResize:function(a){g.Log.info("Default onResize invoked",a)},onResized:function(a){g.Log.info("Default onResized invoked",a)}},_onCropped:function(a,c){b("body").trigger("aloha-image-cropped",[a,c]);this.keepAspectRatio&&(m=this.imageObj.width()/this.imageObj.height());this.onCropped(a,c)},_onReset:function(a){b("body").trigger("aloha-image-reset",a);return this.onReset(a)},
_onResize:function(a){b("body").trigger("aloha-image-resize",a);this._applyValuesToFields(a.width(),a.height());this.onResize(a)},_onResized:function(a){b("body").trigger("aloha-image-resized",a);this._applyValuesToFields(a.width(),a.height());this.onResized(a)},imageObj:null,jcAPI:null,keepAspectRatio:false,restoreProps:[],objectTypeFilter:[],init:function(){g.getPluginUrl("image");if(typeof this.settings.objectTypeFilter!="undefined")this.objectTypeFilter=this.settings.objectTypeFilter;this.config=
this.defaultSettings;this.settings=l.extend(true,this.defaultSettings,this.settings);if(typeof this.settings.fixedAspectRatio==="number"){m=e=this.settings.fixedAspectRatio;this.keepAspectRatio=true}else this.keepAspectRatio=this.settings.fixedAspectRatio===true?true:false;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){g.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=l(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;l("img").filter(b.globalselector).unbind();l("img").filter(b.globalselector).click(function(b){a.clickImage(b)});g.bind("aloha-drop-files-in-editable",function(b,c){for(var e,d=c.filesObjs.length,j;--d>=0;){j=c.filesObjs[d];if(j.file.type.match(/image\//)){a.getEditableConfig(c.editable);
e=l("<img/>");e.css({"max-width":that.maxWidth,"max-height":that.maxHeight});e.attr("id",j.id);typeof j.src==="undefined"?e.attr("src",j.data):e.attr("src",j.src);f.Utils.Dom.insertIntoDOM(e,c.range,l(g.activeEditable.obj))}}});g.bind("aloha-selection-changed",function(b,c,e){if(e&&e.target&&a.settings.ui.resizable&&!l(e.target).hasClass("ui-resizable-handle")){a.endResize();a.imageObj=null;g.trigger("aloha-image-unselected")}if(g.activeEditable!==null){c=a.findImgMarkup(c);b=a.getEditableConfig(g.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()}});g.bind("aloha-editable-created",function(b,c){try{document.execCommand("enableObjectResizing",false,false)}catch(e){g.Log.info(e,
"Could not disable enableObjectResizing")}c.obj.delegate("img","mouseup",function(b){if(!j){a.clickImage(b);b.stopPropagation()}})});a._subscribeToResizeFieldEvents()},autoResize:function(a){l("#"+this.ui.imgResizeWidthField.getInputId());l("#"+this.ui.imgResizeHeightField.getInputId());var b=this.imageObj.width(),c=this.imageObj.height(),e=false;if(b<this.settings.minWidth||b>this.settings.maxWidth||c<this.settings.minHeight||c>this.settings.maxHeight)e=true;var f=b/c;if(e){if(b>this.settings.maxWidth){b=
this.settings.maxWidth;c=b/f}if(c>this.settings.maxHeight){c=this.settings.maxHeight;b=c*f}if(b<this.settings.minWidth&&a){b=this.settings.minWidth;c=b/f}if(c<this.settings.minHeight&&a){c=this.settings.minHeight;b=b*f}this._applyValuesToFields(b,c);this.setSizeByFieldValue();return true}return false},toggleKeepAspectRatio:function(){this.keepAspectRatio=!this.keepAspectRatio;if(typeof this.jcAPI!=="undefined"&&this.jcAPI!==null){var a=this.jcAPI.tellSelect();e=this.keepAspectRatio?typeof this.settings.fixedAspectRatio!==
"number"?a.w/a.h>0?a.w/a.h:this.imageObj.width()/this.imageObj.height():this.settings.fixedAspectRatio:false;this.jcAPI.setOptions(this.keepAspectRatio?{aspectRatio:e}:{aspectRatio:0});this.jcAPI.focus()}else{this.endResize();m=this.keepAspectRatio?typeof this.settings.fixedAspectRatio!=="number"?this.imageObj.width()/this.imageObj.height():this.settings.fixedAspectRatio:false;this.startResize()}},_subscribeToResizeFieldEvents:function(){function a(c){var f=c.data.fieldName;if(c.keyCode===8||c.keyCode===
46)e._updateFields(f,b(this).val(),false)&&(typeof e.jcAPI!=="undefined"&&e.jcAPI!==null?e.setCropAreaByFieldValue():e.setSizeByFieldValue());else if(c.keyCode<=57&&c.keyCode>=48||c.keyCode<=105&&c.keyCode>=96)e._updateFields(f,b(this).val(),false)&&(typeof e.jcAPI!=="undefined"&&e.jcAPI!==null?e.setCropAreaByFieldValue():e.setSizeByFieldValue());else{var d=0;if(c.keyCode===38||c.keyCode===107)d=1;else if(c.keyCode===40||c.keyCode===109)d=-1;if(c.shiftKey||c.metaKey||c.ctrlKey)d=d*10;var g=false;
d<0&&(g=true);d=parseInt(b(this).val(),10)+d;e._updateFields(f,d,g)&&(typeof e.jcAPI!=="undefined"&&e.jcAPI!==null?e.setCropAreaByFieldValue():e.setSizeByFieldValue())}c.preventDefault();return false}function c(a,f){var d=a.data.fieldName;if(a.shiftKey||a.metaKey||a.ctrlKey)f=f*10;var g=parseInt(b(this).val(),10)+f,j=false;f<0&&(j=true);e._updateFields(d,g,j)&&(typeof e.jcAPI!=="undefined"&&e.jcAPI!==null?e.setCropAreaByFieldValue():e.setSizeByFieldValue());return false}var e=this,f=b("#"+e.ui.imgResizeHeightField.getInputId()),
d={fieldName:"height",maxValue:e.ui.imgResizeHeightField.maxValue,minValue:e.ui.imgResizeHeightField.minValue};f.live("keyup",d,a);f.live("mousewheel",d,c);f=b("#"+e.ui.imgResizeWidthField.getInputId());d={fieldName:"width",maxValue:e.ui.imgResizeWidthField.maxValue,minValue:e.ui.imgResizeWidthField.minValue};f.live("keyup",d,a);f.live("mousewheel",d,c)},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();a=this.imageObj=l(a.target);if(!a.hasClass("aloha-ui")){this.ui.setScope();a.closest(".aloha-editable");this.ui._imageCnrRatioButton.setState(this.keepAspectRatio);this.restoreProps.push({obj:this.imageObj,src:this.imageObj.attr("src"),width:this.imageObj.width(),height:this.imageObj.height()});this._applyValuesToFields(this.imageObj.width(),this.imageObj.height());if(this.settings.ui.meta){this.ui.imgSrcField.setTargetObject(this.imageObj,
"src");this.ui.imgTitleField.setTargetObject(this.imageObj,"title")}g.Selection.preventSelectionChanged();try{this.ui.imgSrcField.focus()}catch(b){}e=m=this.imageObj.width()/this.imageObj.height();this.settings.ui.resizable&&this.startResize();this.settings.autoResize&&this.autoResize(true);g.Selection.preventSelectionChangedFlag=false;g.trigger("aloha-image-selected")}},findImgMarkup:function(a){var b,c;typeof a==="undefined"&&(a=g.Selection.getRangeObject());c=l(a.startContainer);try{if(g.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(e){g.Log.debug(e,"Error finding img markup.")}return null},getPluginFocus:function(){return this.imageObj},
_updateFields:function(a,c,f){var d=null,g=null,j=null,k=null,l=null,t=null,x=null,j=typeof this.jcAPI!=="undefined"&&this.jcAPI!==null?e?e:m:m;if(a=="width"){d=b("#"+this.ui.imgResizeWidthField.getInputId());g=b("#"+this.ui.imgResizeHeightField.getInputId());j=1/j;k=this.settings.minWidth;l=this.settings.maxWidth;t=this.settings.minHeight;x=this.settings.maxHeight}else if(a=="height"){d=b("#"+this.ui.imgResizeHeightField.getInputId());g=b("#"+this.ui.imgResizeWidthField.getInputId());k=this.settings.minHeight;
l=this.settings.maxHeight;t=this.settings.minWidth;x=this.settings.maxWidth}else return false;if(isNaN(c)){d.css("background-color","red");return false}d.val(c);a=true;if(c>l)if(this.settings.autoCorrectManualInput){d.val(l);c=d.val();d.css("background-color","");a=true}else{d.css("background-color","red");a=false}else if(c<k)if(f){d.val(k);c=d.val();a=true}else{this.settings.autoCorrectManualInput?d.css("background-color","wheat"):d.css("background-color","red");a=false}else{d.css("background-color",
"");a=true}k=true;if(this.keepAspectRatio){c=Math.round(c*j);if(c>x)if(this.settings.autoCorrectManualInput){g.val(x);d.val(g.val()/j);d.val();d.css("background-color","");g.css("background-color","");k=true}else{c.css("background-color","red");k=false}else if(c<t)if(f){g.val(t);d.val(g.val()/j);d.val();a=true}else{if(this.settings.autoCorrectManualInput){g.val(c);g.css("background-color","wheat")}else g.css("background-color","red");k=false}else{g.val(c);g.css("background-color","");k=true}}g.val()<
t&&(k=false);return a&&k?true:false},setSizeByFieldValue:function(){var a=this.ui.imgResizeWidthField.getValue(),b=this.ui.imgResizeHeightField.getValue();this.setSize(a,b)},_applyValuesToFields:function(a,b){this.ui.imgResizeWidthField.setValue(a);this.ui.imgResizeHeightField.setValue(b);this.ui.imgResizeWidthField.getInputJQuery().css("background-color","");this.ui.imgResizeHeightField.getInputJQuery().css("background-color","")},setCropAreaByFieldValue:function(){var a=this.jcAPI.tellSelect(),
b=parseInt(this.ui.imgResizeWidthField.getValue(),10),c=parseInt(this.ui.imgResizeHeightField.getValue(),10);this.jcAPI.setSelect([a.x,a.y,a.x+b,a.y+c]);this._onCropSelect();this.jcAPI.enable()},insertImg:function(){var a=g.Selection.getRangeObject(),b=this.getEditableConfig(g.activeEditable.obj),c=g.getPluginUrl("image");if(a.isCollapsed()){b="max-width: "+b.maxWidth+"; max-height: "+b.maxHeight;c=l('<img style="'+b+'" src="'+c+'/img/blank.jpg" title="" />');f.Utils.Dom.insertIntoDOM(c,a,l(g.activeEditable.obj))}else g.Log.error("img cannot markup a selection")},
srcChange:function(){this.imageObj.attr("src",this.ui.imgSrcField.getValue())},positionCropButtons:function(){var a=l(".jcrop-tracker:first"),b=a.offset(),c=b.top,b=b.left,e=a.height(),a=a.width(),f=l("#aloha-CropNResize-btns");c===0&&b===0&&f.hide();c=parseInt(c+e+3,10);b=parseInt(b+a/2-f.width()/2+10,10);(0!=b||0!=c)&&f.offset({top:c,left:b})},initCropButtons:function(){var a=this,b;l("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=l("#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(){l("#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,c=a.keepAspectRatio?m:false;this.ui._imageCropButton.setState(true);a.initCropButtons();a.settings.ui.resizable&&a.endResize();a.jcAPI=l.Jcrop(a.imageObj,{onSelect:function(){a._onCropSelect();window.setTimeout(function(){a.ui.setScope()},10)},aspectRatio:c,minSize:[a.settings.minWidth,a.settings.minHeight]});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(){l(".jcrop-handle").mousedown(function(){l("#aloha-CropNResize-btns").hide()});l(".jcrop-tracker").mousedown(function(){l("#aloha-CropNResize-btns").hide()});if(typeof this.jcAPI!=="undefined"&&this.jcAPI!==null){this.positionCropButtons();var a=this.jcAPI.tellSelect();a.h>0&&a.w>0&&l("#aloha-CropNResize-btns").fadeIn("slow");this._applyValuesToFields(a.w,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();b("body").trigger("aloha-image-crop-stop",[this.imageObj]);this._applyValuesToFields(this.imageObj.width(),this.imageObj.height())},acceptCrop:function(){this._onCropped(this.imageObj,this.jcAPI.tellSelect());this.endCrop()},startResize:function(){var a=this,b=this.imageObj,c=a.keepAspectRatio?m:false,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:c,handles:a.settings.handles,grid:a.settings.grid,resize:function(){j=true;a._onResize(a.imageObj)},stop:function(b){j=false;a._onResized(a.imageObj);this.enableCrop&&window.setTimeout(function(){a.ui.setScope();that.done(b)},10)}});b.css("display","inline-block");l(".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();l(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.get(0)){this.imageObj.attr("src",
this.restoreProps[a].src);this.imageObj.width(this.restoreProps[a].width);this.imageObj.height(this.restoreProps[a].height);break}this._applyValuesToFields(this.imageObj.width(),this.imageObj.height())}})});define("highlighteditables/highlighteditables-plugin",["aloha","jquery","aloha/plugin"],function(l,d,a){var k=window.GENTICS;return a.create("highlighteditables",{config:["highlight"],init:function(){var a=this,b;k.Utils.Position.addMouseMoveCallback(function(){var f,d;for(f=0;f<l.editables.length;f++)d=
l.editables[f],b=a.getEditableConfig(d.obj),!l.activeEditable&&(!d.isDisabled()&&"highlight"==b)&&d.obj.addClass("aloha-editable-highlight")});k.Utils.Position.addMouseStopCallback(function(){a.fade()});l.bind("aloha-editable-activated",function(){a.fade()})},fade:function(){var a,b,f=function(){d(this).css("outline","")};for(a=0;a<l.editables.length;a++)b=l.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",f)}})});define("dom-to-xhtml/dom-to-xhtml","jquery util/dom2 util/misc util/browser aloha/ephemera aloha/console".split(" "),function(l,d,a,k,c,b){function f(a){return a.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function g(a,b){var e=d.attrs(a),g="",j,m;if(k.ie7)for(var n in r)if(r.hasOwnProperty(n)&&a[n]){j=0;for(m=e.length;j<m;j++)if(n===e[j][0].toLowerCase()){e.splice(j,1);break}e.push([n,n])}j=0;for(m=e.length;j<m;j++){var l=e[j];n=l[0].toLowerCase();l=l[1];if(!b||
!c.isAttrEphemeral(a,n,b.attrMap||{},b.attrRxs||{})){var o=r[n];if(o||""!==l)g=g+(" "+n+'="'+f(o?n:l).replace(/"/g,"&quot;")+'"')}}return g}function j(a){var b=a.nodeName,c=p[b];if(null!=c)return c;for(var e="/"+a.nodeName,a=a.nextSibling,c=false;null!=a;){if(e==a.nodeName){c=true;break}a=a.nextSibling}return p[b]=c}function m(a,b,c,f,d){for(;null!=b;)if(1===b.nodeType&&c&&"/"+a.nodeName==b.nodeName){b=b.nextSibling;break}else if(1===b.nodeType&&j(b))b=e(b,b.nextSibling,true,f,d);else{o(b,f,d);b=
b.nextSibling}return b}function e(a,b,c,e,f){var d=a.nodeName.toLowerCase();a.scopeName&&("HTML"!=a.scopeName&&-1===d.indexOf(":"))&&(d=a.scopeName.toLowerCase()+":"+d);if(!c&&null==b&&n[d])f.push("<"+d+g(a,e)+"/>");else{f.push("<"+d+g(a,e)+">");b=m(a,b,c,e,f);f.push("</"+d+">")}return b}function o(a,c,d){1===a.nodeType?e(a,a.firstChild,j(a),c,d):3===a.nodeType?d.push(f(a.nodeValue)):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 n={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},r={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},p={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=[];m(a,a.firstChild,false,b,c);return c.join("")},nodeToXhtml:function(a,b){var c=[];o(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(l,d,a,k,c){return a.create("dom-to-xhtml",{init:function(){var a=this;l.Editable.setContentSerializer(function(f){return!a.settings.editables&&!a.settings.config?c.contentsToXhtml(f):a.settings.editables&&
"dom-to-xhtml"==a.settings.editables["#"+d(f).attr("id")]?c.contentsToXhtml(f,k.ephemera()):a.settings.config&&"dom-to-xhtml"==a.settings.config&&!a.settings.editables["#"+d(f).attr("id")]?c.contentsToXhtml(f,k.ephemera()):d(f).html()})}})});define("contenthandler/contenthandler-utils",["jquery"],function(l){return{wrapContent:function(d){return"string"===typeof d?l("<div>"+d+"</div>"):d instanceof l?l("<div>").append(d):null},isProppedParagraph:function(d){d=l.trim(d);if(!d)return!1;d=l("<div>"+
d+"</div>")[0];return d.firstChild===d.lastChild&&"p"===d.firstChild.nodeName.toLowerCase()?(d=d.firstChild.children)&&1===d.length&&"br"===d[0].nodeName.toLowerCase():!1}}});define("contenthandler/wordcontenthandler",["jquery","aloha","aloha/contenthandlermanager","contenthandler/contenthandler-utils","util/dom"],function(l,d,a,k){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""===l.trim(a.text())}}function b(a){if(0===a.length||!j.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 f(a){a.find("p.MsoTitle").each(function(){d.Markup.transformDomObject(l(this),"h1")});a.find("p.MsoSubtitle").each(function(){d.Markup.transformDomObject(l(this),"h2")})}var g=l,j=/mso/,m=/^#(.*)/;return a.createHandler({handleContent:function(a){var c=
k.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=g(this),b=a.css("font-family")||
"",c=a.css("mso-list")||"",e=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<=e.indexOf("mso-list")&&a.closest("p").addClass("aloha-list-element")});a.find("p span span span").each(function(){var a=g(this),b;0===g.trim(a.text()).replace(/&nbsp;/g,
"").length&&(b=g.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=g(this),e,f,d,j,k,m,l,r;a.removeClass("aloha-list-element");a.find("font").each(function(){g(this).contents().unwrap()});r=[];l=parseFloat(a.css("marginLeft"));
isNaN(l)&&(l=0);m=[];k=a.nextUntil(c);j=g(a.find("span.aloha-list-bullet"));0===j.length&&(j=a.find("span").eq(0));d=b.isOrderedList(j);j.remove();f=g(d?"<ol></ol>":"<ul></ul>");m.push(f);e=g("<li></li>");f.append(e);a.contents().appendTo(e);a.replaceWith(f);k.each(function(){var a=g(this),c,k;if(!a.is("font")){a.find("font").each(function(){g(this).contents().unwrap()});c=parseFloat(a.css("marginLeft"));isNaN(c)&&(c=0);j=g(a.find("span.aloha-list-bullet"));0===j.length&&(j=a.find("span").eq(0));
d=b.isOrderedList(j);j.remove();if(c>l)k=g(d?"<ol></ol>":"<ul></ul>"),f.children(":last").append(k),f=k,m.push(f),r.push(c),l=c;else if(c<l&&0<r.length){for(;0<r.length&&r[r.length-1]>c;)r.pop(),m.pop();f=m[m.length-1];l=c}e=g("<li></li>");f.append(e);a.contents().appendTo(e);a.remove()}})})},removeParagraphNumbering:function(a){a=a.find("h1,h2,h3,h4,h5,h6");0<a.length&&a.each(function(){var a=g(this),b=a.find("span"),a=a.find("a");b.each(function(){g.trim(g(this).text()).match(/^([\.\(]?[\d\D][\.\(]?){1,4}$/)&&
g(this).remove()});a.each(function(){"undefined"===typeof g(this).attr("href")&&g(this).contents().unwrap()})})},transformToc:function(a){a.find("[class*=MsoToc]").each(function(){var a=g(this),b=a.find("span"),a=a.find("a");b.each(function(){g(this).attr("style")&&-1<g(this).attr("style").search("mso-hide")&&g(this).remove();g(this).contents().unwrap()});a.each(function(){g(this).contents().unwrap()})})},transformWordContent:function(a){this.transformToc(a);this.removeParagraphNumbering(a);this.transformListsFromWord(a);
f(a);var a=a.find("*"),b,d,g;for(g=0;g<a.length;g++)d=a.eq(g),b=d[0].nodeName.toLowerCase(),"a"===b?(b=d.attr("href"))&&m.test(l.trim(b))&&d.contents().unwrap():"div"===b||"span"===b?d.contents().unwrap():"td"!==b&&c(d)&&d.contents().unwrap()}})});define("contenthandler/genericcontenthandler",["jquery","aloha","aloha/contenthandlermanager","contenthandler/contenthandler-utils"],function(l,d,a,k){function c(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=l.trim(this.innerHTML))?(a=l("<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=l(">p",this);1===a.length&&a.contents().unwrap()});a.find("table,th,td,tr").removeAttr("width").removeAttr("height").removeAttr("valign");a.find("colgroup").remove()}var b=["strong","em","s","u","strike"];return a.createHandler({handleContent:function(a){var b=
k.wrapContent(a);if(!b)return a;if(b.find(".aloha-block").length)return b.html();c(b);this.cleanLists(b);this.removeComments(b);this.unwrapTags(b);this.removeStyles(b);this.removeNamespacedElements(b);a=!0;d.settings.contentHandler&&(d.settings.contentHandler.handler&&d.settings.contentHandler.handler.generic&&"undefinded"!==typeof d.settings.contentHandler.handler.generic.transformFormattings&&!d.settings.contentHandler.handler.generic.transformFormattings)&&(a=!1);a&&this.transformFormattings(b);
return b.html()},cleanLists:function(a){a.find("ul,ol").find(">:not(li)").remove()},transformFormattings:function(a){var c=[],j;for(j=0;j<b.length;j++)(!d.settings.contentHandler||!d.settings.contentHandler.allows||!(d.settings.contentHandler.allows.elements&&-1!==l.inArray(b[j].toLowerCase(),d.settings.contentHandler.allows.elements)))&&c.push(b[j]);a.find(c.join(",")).each(function(){"STRONG"===this.nodeName?d.Markup.transformDomObject(l(this),"b"):"EM"===this.nodeName?d.Markup.transformDomObject(l(this),
"i"):"S"===this.nodeName||"STRIKE"==this.nodeName?d.Markup.transformDomObject(l(this),"del"):"U"===this.nodeName&&l(this).contents().unwrap()})},transformLinks:function(a){a.find("a").each(function(){"undefined"===typeof l(this).attr("href")&&l(this).contents().unwrap()})},removeComments:function(a){var b=this;a.contents().each(function(){8===this.nodeType?l(this).remove():b.removeComments(l(this))})},unwrapTags:function(a){a.find("span,font,div").not(".aloha-wai-lang").each(function(){"DIV"==this.nodeName?
"<br>"===this.innerHTML?l(this).contents().unwrap():l(d.Markup.transformDomObject(l(this),"p").append("<br>")).contents().unwrap():l(this).contents().unwrap()})},removeStyles:function(a){var b=this;a.children("style").filter(function(){return"false"!==this.contentEditable}).remove();a.children().filter(function(){return"false"!==this.contentEditable}).each(function(){l(this).removeAttr("style").removeClass();b.removeStyles(l(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=l(this),b=a.contents();b.length?b.unwrap():a.remove()}})}})});ua.REGEX_PROTOCOL=/^([A-Za-z0-9\+\-\.\&\;\*\s]*?)(?:\:|&*0*58|&*x0*3a)/i;ua.RELATIVE="__relative__";ua.prototype.clean_node=function(l){function d(a,b){var c,d=b.length;for(c=0;c<d;c++)if(b[c]===a)return c;return-1}function a(){var a=[],b={},c,d=arguments.length,e;for(c=0;c<d;c++)if((e=arguments[c])&&e.length)for(var k=0,
n=e.length;k<n;k++)b[e[k]]||(b[e[k]]=!0,a.push(e[k]));return a}function k(b){var c,j,m=this.filters.length;for(j=0;j<m;j++)if(!this.filters[j](b)){c=b.cloneNode(!0);this.current_element.appendChild(c);return}switch(b.nodeType){case 1:var e,l,n,r,p,q;j=b;e=[];b=j;l=!1;var s;n=this.transformers.length;for(s=0;s<n;s++)if(m=this.transformers[s]({allowed_elements:this.allowed_elements,config:this.config,node:j,node_name:j.nodeName.toLowerCase(),whitelist_nodes:this.whitelist_nodes,dom:this.dom}),null!=
m)if("object"==typeof m){if(m.whitelist_nodes&&m.whitelist_nodes instanceof Array){r=m.whitelist_nodes.length;for(l=0;l<r;l++)-1==d(m.whitelist_nodes[l],this.whitelist_nodes)&&this.whitelist_nodes.push(m.whitelist_nodes[l])}l=m.whitelist?!0:!1;m.attr_whitelist&&(e=a(e,m.attr_whitelist));b=m.node?m.node:b}else throw Error("transformer output must be an object or null");j=this.jQuery;s=j.browser.msie&&"7.0"===j.browser.version;j=b;m=j.nodeName.toLowerCase();b=this.current_element;if(this.allowed_elements[m]||
l){this.current_element=this.dom.createElement(j.nodeName);b.appendChild(this.current_element);n=a(this.config.attributes[m],this.config.attributes.__ALL__,e);l=n.length;for(e=0;e<l;e++)if(c=n[e],r=j.attributes[c])p=!0,this.config.protocols[m]&&this.config.protocols[m][c]&&(p=this.config.protocols[m][c],p=(q=r.nodeValue.toLowerCase().match(ua.REGEX_PROTOCOL))?-1!=d(q[1],p):-1!=d(ua.RELATIVE,p)),p&&(!s||s&&"style"!==c)&&this.current_element.setAttribute(c,r.nodeValue);if(this.config.add_attributes[m])for(c in this.config.add_attributes[m])(!s||
s&&"style"!==c)&&this.current_element.setAttribute(c,this.config.add_attributes[m][c])}else if(-1!=d(j,this.whitelist_nodes)){this.current_element=j.cloneNode(!0);for(c=this.current_element.childNodes.length;0<c;)this.current_element.removeChild(this.current_element.firstChild);b.appendChild(this.current_element)}if(!this.config.remove_all_contents&&!this.config.remove_element_contents[m]){c=j.childNodes;l=c.length;for(e=0;e<l;e++)k.call(this,c[e])}this.current_element.normalize&&this.current_element.normalize();
this.current_element=b;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=[];var l=l.childNodes,b;b=0;for(len=l.length;b<len;b++)k.call(this,l[b]);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(l,d,a){function k(a){var f=["restricted","basic","relaxed"],g=l.defaults.supports,g=l.settings.contentHandler.sanitize&&d.inArray(l.settings.contentHandler.sanitize,f)>-1?l.defaults.sanitize[l.settings.contentHandler.sanitize]:l.defaults.sanitize.relaxed;if(l.settings.contentHandler.allows)g=l.settings.contentHandler.allows;a&&(g=a);g.filters=[function(a){return a.contentEditable!="false"}];
c=new ua(g,d)}var c;if(!l.defaults.sanitize)l.defaults.sanitize={};l.defaults.sanitize.restricted={elements:["b","em","i","strong","u","del","p","span","div","br"]};l.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__"]}}};l.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","colspan","rowspan","width"],th:["abbr","axis","colSpan","rowSpan","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,f,g){if(!g)return a;var j,m;if(l.settings.contentHandler&&l.settings.contentHandler.handler&&l.settings.contentHandler.handler.sanitize){if(l.settings.contentHandler.handler.sanitize)m=l.settings.contentHandler.handler.sanitize;
if(typeof m["#"+g.getId()]!=="undefined")j=m;else{f=g.obj.attr("class").split(" ");for(g=0;g<f.length;g++)typeof m["."+f[g]]!=="undefined"&&(j=m["."+f[g]])}}(typeof c==="undefined"||typeof j!=="undefined")&&k(j);typeof a==="string"?a=d("<div>"+a+"</div>").get(0):a instanceof d&&(a=d("<div>").append(a).get(0));return d("<div>").append(c.clean_node(a)).html()}})});define("contenthandler/blockelementcontenthandler","jquery aloha/core aloha/contenthandlermanager contenthandler/contenthandler-utils util/functions util/html util/arrays".split(" "),
function(l,d,a,k,c,b,f){function g(a,c){var e=b.findNodeRight(c.lastChild,p);e&&"br"===e.nodeName.toLowerCase()&&l(e).remove()}function j(a,b){var c=l(b);c.filter(n).remove();if(l.browser.msie){c.filter("br.aloha-end-br").remove();c.filter(o).each(g)}c.children(r).each(j)}function m(a,b){var c=l(b);c.filter(n).append("​");c.children(r).each(m)}function e(a,b){var c=l(b);c.filter(n).filter(":empty").append("<br/>");c.children(r).each(e)}var o=b.BLOCKLEVEL_ELEMENTS.join(),n=f.subtract(b.BLOCKLEVEL_ELEMENTS,
b.VOID_ELEMENTS),r=":not(.aloha-block)",p=c.complement(b.isIgnorableWhitespace);return a.createHandler({handleContent:function(a,b){if(!b)return a;var c=k.wrapContent(a);if(!c)return a;switch(b.command){case "initEditable":c.children(r).each(j);l.browser.msie&&l.browser.version<=7&&c.children(r).each(m);break;case "getContents":c.children(r).each(e)}return c.html()}})});define("contenthandler/contenthandler-plugin","jquery aloha/plugin aloha/contenthandlermanager contenthandler/wordcontenthandler contenthandler/genericcontenthandler contenthandler/sanitizecontenthandler contenthandler/blockelementcontenthandler".split(" "),
function(l,d,a,k,c,b,f){var g={word:k,generic:c,sanitize:b,blockelement:f};return d.create("contenthandler",{init:function(){for(var b in g)g.hasOwnProperty(b)&&a.register(b,g[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".split(" "),function(l,
d,a,k,c,b,f,g){function j(a){a.$element.click(function(a){a.stopPropagation()});d("body").click(function(b){a._overlayActive&&!(b.target===a.$element[0]||d(b.target).is(".aloha-icon-characterpicker")||d(b.target).find(".aloha-icon-characterpicker").length)&&a.hide()})}function m(a){u.keyup(function(b){27===b.keyCode&&a.$element.css("display")==="table"&&a.hide()})}function e(a,b,c){var e=function(a){return a.replace(/\-(\w)/g,function(a,b){return b.toUpperCase()})};(a=a.currentStyle?a.currentStyle[e(c)]:
document.defaultView&&document.defaultView.getComputedStyle?document.defaultView.getComputedStyle(a,null).getPropertyValue(c):a.style[e(c)])&&b.css(c,a)}function o(a,b){var c={13:function(c){a.hide();b(c.text())},37:function(a){var b=a.prev();if(b.length){b.addClass("focused");a.removeClass("focused")}},38:function(a){var b=a.parent().prev();b.length&&d(b.children()[a.index()]).addClass("focused").length&&a.removeClass("focused")},39:function(a){a.next().addClass("focused").length&&a.removeClass("focused")},
40:function(a){var b=a.parent().next();b.length&&d(b.children()[a.index()]).addClass("focused").length&&a.removeClass("focused")}};u.keydown(function(b){b.stopPropagation();if(c[b.keyCode]&&a.$element.css("display")==="table"){c[b.keyCode](a.$element.find(".focused"));return false}})}function n(a,b){var c=document.createElement("textarea");c.innerHTML=b;for(var c=d.grep(c.value.split(" "),function(a){return""!==a}),e=["<tr>"],f=0,g;g=c[f];){0!==f&&0===f%15&&e.push("</tr><tr>");e.push('<td unselectable="on">'+
g+"</td>");f++}e.push("</tr>");a.$tbody.empty().append(e.join(""));a.$element.delegate("td","mouseover",function(){a.$element.find(".focused").removeClass("focused");d(this).addClass("focused")}).delegate("td","mouseout",function(){d(this).removeClass("focused")}).delegate("td","click",function(){a.$element.hide();a.onSelect(d(this).text())})}function r(a){a=a.offset();if("fixed"===b.POSITION_STYLE){a.top=a.top-v.scrollTop();a.left=a.left-v.scrollLeft()}return a}function p(a){if(l.activeEditable){t.select();
l.execCommand("insertHTML",false,a);t.endContainer=t.startContainer;t.endOffset=++t.startOffset;t.select()}}function q(a){var b=this;b.$element=d('<table class="aloha-character-picker-overlay" unselectable="on" role="dialog"><tbody></tbody></table>');b.$element.mousedown(function(){return false});b.onSelect=a;b.$tbody=b.$element.find("tbody");b.$element.appendTo(d("body"));j(b);m(b);o(b,a);l.bind("aloha-editable-deactivated",function(){b.hide()})}function s(a,b){var c=a.getEditableConfig(b.obj);if(!c)return null;
var c=d.isArray(c)?c.join(" "):c,e=x[c];if(!e){e=new q(p);n(e,c);x[c]=e}return e}var u=d(document),v=d(window),t,x={};q.prototype={show:function(a){this.$element.css(r(a)).css("position",b.POSITION_STYLE).show().find(".focused").removeClass("focused");this.$element.find("td").eq(0).addClass("focused");this._overlayActive=true},hide:function(){this.$element.hide();this._overlayActive=false}};return a.create("characterpicker",{settings:{},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;",
_constructor:function(){this._super("characterpicker")},init:function(){function a(c){if(c<l.editables.length){s(b,l.editables[c]);setTimeout(function(){a(c+1)},100)}}var b=this;if(l.settings.plugins&&l.settings.plugins.characterpicker)b.settings=l.settings.plugins.characterpicker;var d=k.adopt("characterPicker",c,{tooltip:g.t("button.addcharacter.tooltip"),icon:"aloha-icon-characterpicker",scope:"Aloha.continuoustext",click:function(){if(b.overlay){t=l.Selection.rangeObject;var a=t.startContainer.parentNode,
c=b.overlay.$element;e(a,c,"font-family");e(a,c,"font-weight");e(a,c,"font-style");b.overlay.show(this.element)}}});setTimeout(function(){a(0)},100);l.bind("aloha-editable-activated",function(a,c){b.overlay=s(b,c.editable);b.overlay?d.show():d.hide()});f.sub("aloha.floating.changed",function(){b.overlay&&b.overlay.$element.css(r(d.element))})}})});define("commands/inserthtml","aloha/core jquery aloha/command aloha/selection util/dom aloha/contenthandlermanager aloha/console".split(" "),function(l,
d,a,k,c,b,f){a.register("inserthtml",{action:function(a,j){function k(a){var b=d(a);if(!c.insertIntoDOM(b,j,e,false)){b=b.contents();(c.isBlockLevelElement(a)||c.isListElement(a))&&k(d("<br/>").get(0));for(n=b.length-1;n>=0;--n)k(b[n])}}var e=d(c.getEditingHostOf(j.startContainer)),o=j.commonAncestorContainer,n,r=[],a=b.handleContent(a,{contenthandler:l.settings.contentHandler.insertHtml});if(typeof a==="string")a=d("<div>"+a+"</div>");else if(a instanceof d)a=d("<div>").append(a);else throw"INVALID_VALUE_ERR";
r=a.contents();c.removeRange(j);for(n=r.length-1;n>=0;--n)k(r[n]);r.length>0?j=c.setCursorAfter(r.get(r.length-1)):j.select();c.doCleanup({merge:true,removeempty:true},j,o);try{j.select()}catch(p){f.warn("Error:",p)}}})});define("commands/commands-plugin",["aloha/command","./inserthtml"],function(){});define("block/block-utils",["util/dom","util/dom2","util/html"],function(l,d,a){function k(a){return"SPAN"===a.nodeName&&(0===a.childNodes.length||"&nbsp;"===a.innerHTML)}function c(){var a=document.createElement("span");
a.appendChild(document.createTextNode(" "));return a}function b(b){return(a.isBlock(b)||d.isTextNode(b))&&!a.isUnrenderedNode(b)}function f(a){return a.hasClass("aloha-table-wrapper")}return{pad:function(f){d.findBackward(d.backward(f[0]),b,function(b){return a.isBlock(b)||l.isEditingHost(b)})||f.before(c());d.findForward(d.forward(f[0].lastChild||f[0]),b,function(b){return a.isBlock(b)||l.isEditingHost(b)||b.previousSibling&&l.isEditingHost(b.previousSibling)})||f.after(c())},unpad:function(a){var b=
a[0].previousSibling,a=a[0].nextSibling;b&&k(b)&&b.parentNode.removeChild(b);a&&k(a)&&a.parentNode.removeChild(a)},isDragdropEnabledForElement:function(a){a=a.closest(".aloha-editable");return a.length?!!a.data("block-dragdrop"):!0},isTable:f,getEditableByBlock:function(a){return a.parents(".aloha-editable").filter(":first")},getTableByBlock:function(a){return f(a)?a.find("table").filter(":first"):null}}});define("block/blockmanager","aloha jquery ui/scopes aloha/observable aloha/registry util/class util/strings util/maps block/block-utils table/table-plugin".split(" "),
function(l,d,a,k,c,b,f,g,j,m){var e=window.GENTICS,o=new (b.extend(k,{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();l.bind("aloha-selection-changed",function(b,c){c&&d(c.getCommonAncestorContainer()).parents(".aloha-block").length>0||a._deactivateHighlightedBlocks()})},_registerEventHandlersForDeactivatingAlohaBlock:function(){var a=this;d(document).bind("click",function(b){g.isEmpty(a._highlightedBlocks)||d(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;l.bind("aloha-command-will-execute",function(b,c){var e=c.commandId,f=l.getSelection(),g=f.getRangeCount(),f=f.getRangeAt(0),j=f.endContainer,k=f.startContainer,j=g===0||g===1&&j===k&&j===d("body")[0]||g===1&&j===k&&f.startOffset+1===f.endOffset;if(a._activeBlock&&(e==="delete"||
e==="forwarddelete")&&j){c.preventDefault=true;a._activeBlock.destroy()}else if(!a._activeBlock&&(e==="delete"||e==="forwarddelete")&&g===1&&f.collapsed===false){var m;m=function(a){for(var b,c=0,e=a.length;c<e;c++){b=a[c];if(b.domobj.nodeType===1){var f=d(b.domobj);b.selection==="full"&&f.is(".aloha-block")?f.remove():m(b.children)}}};m(l.Selection.getSelectionTree())}});d(window.document).keydown(function(b){if(d(b.target).closest(".aloha-ui").length>0)return true;if(a._activeBlock&&(b.which===
46||b.which===8)&&a._activeBlock._isInsideNestedEditable===false){if(d.browser.msie&&parseInt(d.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,f=null;d(window.document).keydown(function(f){if(!l.activeEditable||
!a._activeBlock||!d.contains(a._activeBlock.$element.get(0),l.activeEditable.obj.get(0))){if(a._activeBlock&&(f.ctrlKey||f.metaKey)&&f.which===67){b=true;a._activeBlock.$element.attr("data-aloha-block-copy-only-block","true");e.Utils.Dom.selectDomNode(a._activeBlock.$element[0])}if(a._activeBlock&&(f.ctrlKey||f.metaKey)&&f.which===88){c=true;a._activeBlock.$element.attr("data-aloha-block-copy-only-block","true");e.Utils.Dom.selectDomNode(a._activeBlock.$element[0])}}});d(window.document).keyup(function(e){if(!c&&
b&&(e.which===67||e.which===18||e.which===91)){b=false;a._activeBlock.$element.removeAttr("data-aloha-block-copy-only-block");f&&(f=null)}if(c&&(e.which===67||e.which===18||e.which===88))c=false})},_registerEventHandlersForEditableActivated:function(){var a=this;l.bind("aloha-editable-activated",function(b,c){if(c.editable){var e=a.getBlock(c.editable.obj.closest(".aloha-block"));e&&e.activate()}})},initializeBlockLevelDragDrop:function(){var a=this;d.each(l.editables,function(b,c){c.obj.data("block-dragdrop",
a._dragdropEnabled);a.createBlockLevelSortableForEditableOrBlockCollection(c.obj)});l.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){var c=b.item;c.data("block-sort-allowed")||d(this).sortable("cancel");c.removeData("block-sort-allowed");var e=j.getTableByBlock(c);if(e!==null){c=l.getEditableById(j.getEditableByBlock(c).attr("id"));m.getTableFromRegistry(e.get(0)).parentEditable=
c}}});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=d(a),e=l.require("block/block-plugin"),f=c[0].tagName.toLowerCase();if(d.inArray(f,e.settings.rootTags)===-1)l.Log.error("block/blockmanager","Blocks can only be created from ["+
e.settings.rootTags.join(", ")+"] element. You passed "+f+".");else{e=this.getConfig(c,b);if(this.blockTypes.has(e["aloha-block-type"])){c=new (this.blockTypes.get(e["aloha-block-type"]))(c,e);c.$element.addClass("aloha-block-"+e["aloha-block-type"]);this.blocks.register(c.getId(),c)}else l.Log.error("block/blockmanager","Block Type "+e["aloha-block-type"]+" not found!")}},_unblockify:function(a){(a=this.getBlock(a))&&a.unblock()},getConfig:function(a,b){var c={},e=null,g=null;if(a.length>0){g=d(a[0].cloneNode(false));
e=d.extend({},d.data(a[0]),g.data());g.removeData();for(var j in e)e.hasOwnProperty(j)&&(c[f.camelCaseToDashes(j)]=e[j])}return d.extend({},this.defaults,b,c)},getBlock:function(a){if(typeof a==="object"){a=d(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(){d.each(d.extend({},this._highlightedBlocks),function(a){(a=o.getBlock(a))&&
a.deactivate()})},_getHighlightedBlocks:function(){var a={};d.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]}}));l.Block=l.Block||{};return l.Block.BlockManager=o});define("block/editormanager",["aloha/registry"],function(l){return new (l.extend({createEditor:function(d){if(!this.has(d.type))throw'Editor for type "'+d.type+'" not found.';
return new (this.get(d.type))(d)}}))});define("block/sidebarattributeeditor",["jquery","block/blockmanager","aloha/sidebar","block/editormanager","util/class"],function(l,d,a,k,c){return new (c.extend({_sidebar:null,init:function(){this._sidebar=a.right.show();d.bind("block-selection-change",this._onBlockSelectionChange,this)},_onBlockSelectionChange:function(a){var c=this;this._sidebar&&l.each(a,function(){var a=this.getSchema(),b=this,d=[];a&&c._sidebar.addPanel({title:b.getTitle(),expanded:!0,
onInit:function(){var c=l("<form />");c.submit(function(){return!1});l.each(a,function(a,f){var g=k.createEditor(f);g.bind("change",function(c){b.attr(a,c)});b.bind("change",function(){g.setValue(b.attr(a))});c.append(g.render());g.setValue(b.attr(a));d.push(g)});this.setContent(c)},deactivate:function(){l.each(d,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 block/block-utils util/html".split(" "),
function(l,d,a,k,c,b,f,g,j){var m=window.GENTICS,k=b.extend(k,{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=m.Utils.guid();a.attr("id",this.id)}a.contentEditable(false);a.addClass("aloha-block");if(this.isDraggable()){a.find("img").attr("draggable","false");try{a.find("a").attr("draggable","false")}catch(e){a.find("a").each(function(){this.setAttribute("draggable",
"false")})}}d.each(b,function(a,b){c._setAttribute(a,b)});this._onElementClickHandler=function(a){if(d(a.target).closest(".aloha-block").get(0)===c.$element.get(0)){c._fixScrollPositionBugsInIE();c.activate(a.target,a)}};this._connectThisBlockToDomElement(a,function(){f.pub("aloha.block.initialized",{block:c})});if(j.isInlineFormattable(a[0])){a.closest(".aloha-editable-active").length>0&&g.pad(c.$element);l.bind("aloha-editable-activated",function(a,b){b.editable&&b.editable.obj.find("#"+c.id).length!==
0&&g.pad(c.$element)});l.bind("aloha-editable-deactivated",function(a,b){b.editable&&b.editable.obj.find("#"+c.id).length!==0&&g.unpad(c.$element)})}this._initialized=true},_onElementClickHandler:null,_preventSelectionChangedEventHandler:function(a){"dblclick"!==a.type&&!d(a.target).is(".aloha-editable")&&l.Selection.preventSelectionChanged()},_connectThisBlockToDomElement:function(a,b){var c=this,e=d(a);this._disconnectFromDomElement();this.$element=e;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=d(window).scrollTop();window.setTimeout(function(){d(window).scrollTop()!==a&&d(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,e=new m.Utils.RangeObject;e.startContainer=e.endContainer=this.$element.parent()[0];e.startOffset=e.endOffset=m.Utils.Dom.getIndexInParent(this.$element[0]);a.trigger("block-delete",this);this.free();var f=this.$element[0].tagName.toLowerCase()==="span";this.$element.fadeOut("fast",function(){c.$element.remove();a.trigger("block-selection-change",[]);window.setTimeout(function(){f&&e.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,e){var f=[];d.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(d(b).closest(".aloha-editable,.aloha-block,.aloha-table-cell-editable,.aloha-table-cell_active").first().hasClass("aloha-block")){this._isInsideNestedEditable=
false;l.getSelection().removeAllRanges()}else{this._isInsideNestedEditable=true;e&&l.Selection.updateSelection(e)}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=d(this);c.closest(".aloha-block").get(0)===b.$element.get(0)&&a.createBlockLevelSortableForEditableOrBlockCollection(c)})},_disableUglyInternetExplorerDragHandles:function(){if(d.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=d(this);g.isDragdropEnabledForElement(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")||[];d.each(b,function(a,b){var c=d(b);d(c).each(function(){d(this).data("block-dragdrop")&&d(this).addClass("aloha-block-dropzone")})});d(document).one("mouseup.aloha-block-dropzone",function(){var b=a.$element.parents(".aloha-editable").first().data("block-dropzones")||[];d.each(b,function(a,b){d(b).removeClass("aloha-block-dropzone")})})})},_setupDragDropForInlineElements:function(){var a=this,b=null,c=false,e=null,f=null,g=function(){if(b){var g=
d(b);if(g.is(".aloha-block-dropInlineElementIntoEmptyBlock")){g.children().remove();g.append(e)}else if(g.is(".aloha-block-droppable-right")){g.html(g.html()+" ");g.after(e)}else{g.prev("[data-i]").length>0&&g.prev("[data-i]").html(g.prev("[data-i]").html()+" ");g.html(" "+g.html());g.before(e)}e.removeClass("ui-draggable").css({left:0,top:0});a._fixScrollPositionBugsInIE()}d(".aloha-block-dropInlineElementIntoEmptyBlock").removeClass("aloha-block-dropInlineElementIntoEmptyBlock");f.droppable("destroy");
f=null;c=true},j=[];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(){d.browser.msie&&7===parseInt(d.browser.version,10)&&g();d.each(j,function(){a._dd_traverseDomTreeAndRemoveSpans(this)});e=null;j=[]},start:function(){c=false;j=[];d(".aloha-editable").children("p:empty").html("&nbsp;");var k={tolerance:"pointer",addClasses:false,scope:"aloha-block-inlinedragdrop",
over:function(c,f){d.inArray(this,j)===-1&&j.push(this);var g=1===d(this).contents().length&&1===d(this).children("br").length;e=f.draggable;if(d(this).is(":empty")||g||d(this).html()==="&nbsp;"){d(this).addClass("aloha-block-dropInlineElementIntoEmptyBlock");b=this}else{a._dd_traverseDomTreeAndWrapCharactersWithSpans(this);d("span[data-i]",this).droppable({tolerance:"pointer",addClasses:false,scope:"aloha-block-inlinedragdrop",over:function(){b&&d(b).removeClass("aloha-block-droppable");b=this;d(this).addClass("aloha-block-droppable")},
out:function(){d(this).removeClass("aloha-block-droppable");b===this&&(b=null)}});d.ui.ddmanager.prepareOffsets(f.draggable.data("draggable"),c)}},out:function(){d(this).removeClass("aloha-block-dropInlineElementIntoEmptyBlock")},drop:function(){d.browser.msie&&7===parseInt(d.browser.version,10)||g()}};f=d(".aloha-editable.aloha-block-dropzone").children(":not(.aloha-block)");f.droppable(k);d(".aloha-table-cell-editable").droppable(k)}})},_dd_traverseDomTreeAndWrapCharactersWithSpans:function(a){for(var b,
c=0,e=a.childNodes.length;c<e;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;e=e+b}}},_dd_splitText:function(a){for(var a=a.split(/(?=\b)/),b=[],c=false,e=0,f=a.length;e<f;e++)if(/[^\t\n\r ]/.test(a[e]))if(c){b.push(" "+a[e]);c=false}else b.push(a[e]);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),e=b.length,f,g,j,k=0,m=0;m<e;m++){g=b[m];if(g.length!==0){j=Math.floor(g.length/2);f=parseInt(d.browser.version,10);if(d.browser.msie&&(7===f||8===f))j=0;if(j>0){f=document.createElement("span");f.appendChild(document.createTextNode(g.substr(0,j)));f.setAttribute("data-i",m);c.appendChild(f);k++}f=document.createElement("span");g=g.substr(j);
f.appendChild(document.createTextNode(g));f.setAttribute("data-i",m);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 e=false,f,d,g,j=0,k=a.childNodes.length;j<k;j++){g=a.childNodes[j];if(g.nodeType===1)if(g.attributes["data-i"]!==void 0){if(!e){e=true;f="";d=void 0}if(e){f=f+g.firstChild.nodeValue;d&&b.push(d);d=g}}else{if(e){e=false;d.parentNode.replaceChild(document.createTextNode(f),
d)}~g.className.indexOf("aloha-block")||c(g)}}e&&d.parentNode.replaceChild(document.createTextNode(f),d)};c(a);for(var a=0,e=b.length;a<e;a++)b[a].parentNode.removeChild(b[a])},_dd_isDragdropEnabled:function(){return g.isDragdropEnabledForElement(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 e=this,f=false;if(arguments.length>=2){if(a.substr(0,12)==="aloha-block-"){l.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")d.each(a,function(a,b){if(a.substr(0,12)==="aloha-block-")l.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{e._getAttribute(a)!==b&&(f=true);e._setAttribute(a,b)}});else return typeof a==="string"?this._getAttribute(a):this._getAttributes();if(f&&!c){this._update();this.trigger("change");l.activeEditable&&l.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={};d.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=k.extend({update:function(a,b){b()}}),e=k.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">';d.each(this.attr(),
function(a,b){c=c+("<tr><th>"+a+"</th><td>"+b+"</td></tr>")});c=c+"</table>";a.html(c);b()}}),o=k.extend({title:"EmptyBlock",init:function(){},activate:function(){},deactivate:function(){},renderBlockHandlesIfNeeded:function(){},_preventSelectionChangedEventHandler:function(){}});return{AbstractBlock:k,DefaultBlock:b,DebugBlock:e,EmptyBlock:o}});define("block/blockcontenthandler",["jquery","aloha/contenthandlermanager","block/blockmanager"],function(l,d,a){return d.createHandler({handleContent:function(d){"string"===
typeof d?d=l("<div>"+d+"</div>"):d instanceof l&&(d=l("<div>").append(d));0<d.find('.aloha-block[data-aloha-block-copy-only-block="true"]').length&&(d.find(".aloha-block:not([id])").remove(),d.find(".aloha-block + span:empty").remove(),d.find("div:empty").remove(),d.find("br.Apple-interchange-newline").remove(),d.find(".aloha-block").prev("br").remove(),d.find("div > br:only-child").parent().remove());d.find(".aloha-block").each(function(){var c=l(this),b={},f={};l.each(c[0].attributes,function(a,
c){if(c.nodeName!=="id")c.nodeName.match(/^data-/)?f[c.nodeName.substr(5)]=c.nodeValue:b[c.nodeName]=c.nodeValue});var d=GENTICS.Utils.guid(),j=l("<"+this.tagName+"/>").attr(b).attr("id",d).removeClass("aloha-block-active").removeClass("aloha-block").html(c.html());c.replaceWith(j);window.setTimeout(function(){a._blockify(l("#"+d),f)},50)});return d.html()}})});define("block/editor",["jquery","aloha/observable","util/class"],function(l,d,a){var d=a.extend(d,{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=d.extend({formInputElementDefinition:null,_$formInputElement:null,render:function(){var a=l('<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=l("<label />");a.html(this.schema.label);return a},
renderFormElement:function(){var a=this;this._$formInputElement=l(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()}}),k=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" />'}),f=a.extend({formInputElementDefinition:'<input type="email" />'}),g=a.extend({formInputElementDefinition:"<select />",afterRenderFormElement:function(a){l.each(this.schema.values,
function(){a.append(l("<option />").attr("value",this.key).html(this.label))})}}),j=a.extend({formInputElementDefinition:"<button />",afterRenderFormElement:function(a){var b=this;a.html(this.schema.buttonLabel);a.click(function(){b.schema.callback()})}});return{AbstractEditor:d,AbstractFormElementEditor:a,StringEditor:k,NumberEditor:c,UrlEditor:b,EmailEditor:f,SelectEditor:g,ButtonEditor:j}});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(l,d,a,k,c,b,f,g,j,m,e,o,n){var r=["div","span"],d=d.create("block",{config:[],settings:{},init:function(){var a=this;if(!this.settings.rootTags)this.settings.rootTags=r;c.registerBlockType("DebugBlock",
f.DebugBlock);c.registerBlockType("DefaultBlock",f.DefaultBlock);c.registerBlockType("EmptyBlock",f.EmptyBlock);g.register("string",m.StringEditor);g.register("number",m.NumberEditor);g.register("url",m.UrlEditor);g.register("email",m.EmailEditor);g.register("select",m.SelectEditor);g.register("button",m.ButtonEditor);k.register("block",j);c.setDragDropState(a.isDragDropEnabled());c.registerEventHandlers();c.initializeBlockLevelDragDrop();l.bind("aloha-plugins-loaded",function(){a._createBlocks();
false!==a.settings.sidebarAttributeEditor&&b.init()});this.createButtons();l.bind("aloha-editable-created",function(b,c){a.setDropzones(c.obj)});l.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 e=0;e<l.editables.length;e++){a=l.editables[e];this._setDragDropStateForEditable(a.obj,b)}}else{b=!a.obj.data("block-dragdrop");this._setDragDropStateForEditable(a.obj,b)}},createButtons:function(){var a=this;this._toggleDragDropButton=e.adopt("toggleDragDrop",o,{tooltip:n.t("button.toggledragdrop.tooltip"),icon:"aloha-icon aloha-icon-toggledragdrop",scope:"Aloha.continuoustext",click:function(){a._toggleDragdropState(l.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,e){c._blockify(e,b)});return a(this)};a.fn.mahaloBlock=function(){a(this).each(function(a,
b){c._unblockify(b)})};return d});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(l,d,a,k,c,b,f,g){var j=window.GENTICS;return d.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;l.bind("aloha-editable-activated",function(b,c){a.applyButtonConfig(c.editable.obj)});g.sub("aloha.selection.context-change",function(b){b=b.range;l.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=f(this).css("text-align")},l.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=f(this).css("vertical-align")},l.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;f.inArray("right",a.alignment)!=-1?this._alignRightButton.show(true):this._alignRightButton.show(false);f.inArray("left",a.alignment)!=-1?this._alignLeftButton.show(true):this._alignLeftButton.show(false);f.inArray("center",
a.alignment)!=-1?this._alignCenterButton.show(true):this._alignCenterButton.show(false);f.inArray("justify",a.alignment)!=-1?this._alignJustifyButton.show(true):this._alignJustifyButton.show(false);f.inArray("top",a.alignment)!=-1?this._alignTopButton.show(true):this._alignTopButton.show(false);f.inArray("middle",a.alignment)!=-1?this._alignMiddleButton.show(true):this._alignMiddleButton.show(false);f.inArray("bottom",a.alignment)!=-1?this._alignBottomButton.show(true):this._alignBottomButton.show(false)},
createButtons:function(){var b=this;this._alignLeftButton=a.adopt("alignLeft",k,{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",k,{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",
k,{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",k,{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",k,{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",k,{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",k,{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=
l.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=l.Selection.getRangeObject();this.lastAlignment=
this.alignment;this.alignment=a;var a=b.getCommonAncestorContainer(),c=this.getSelectedCells(b);if(c)this.toggleAlign(c);else if(j.Utils.Dom.isEditingHost(a)){var d=[];f.each(l.Selection.getRangeObject().getSelectionTree(),function(){this.selection!=="none"&&this.domobj.nodeType!==3&&d.push(this.domobj)});this.toggleAlign(d)}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(){f(this).is("td,th")&&(b=this);return f(this).is("table.aloha-table")},l.activeEditable.obj),a=f(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,d=true;f(a).each(function(){if(f(this).css(b)!=c)return d=
false});f(a).each(function(){f(this).css(b)==c&&d?f(this).css(b,""):f(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(l,d,a,k,c,b,f,g,j){var m=window.GENTICS;return a.create("abbr",{config:["abbr"],init:function(){this.createButtons();this.subscribeEvents();this.bindInteractions()},createButtons:function(){var a=this;this._formatAbbrButton=k.adopt("formatAbbr",c,{tooltip:j.t("button.abbr.tooltip"),icon:"aloha-icon aloha-icon-abbr",scope:"Aloha.continuoustext",click:function(){a.formatAbbr()}});this._insertAbbrButton=k.adopt("insertAbbr",b,{tooltip:j.t("button.addabbr.tooltip"),icon:"aloha-icon aloha-icon-abbr",
scope:"Aloha.continuoustext",click:function(){a.insertAbbr(false)}});this.abbrField=g({width:320,name:"abbrText",scope:"Aloha.continuoustext"});this.remAbbrButton=k.adopt("removeAbbr",b,{tooltip:j.t("button.remabbr.tooltip"),icon:"aloha-icon aloha-icon-abbr-rem",scope:"Aloha.continuoustext",click:function(){a.removeAbbr()}})},bindInteractions:function(){var a=this;this.abbrField.addListener("blur",function(){this.getValue()==""&&a.removeAbbr()});for(var b=0;b<l.editables.length;b++)l.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={};l.bind("aloha-editable-activated",function(){if(l.activeEditable&&l.activeEditable.obj){var c=a.getEditableConfig(l.activeEditable.obj);b[l.activeEditable.getId()]=d.inArray("abbr",c)!==-1}});l.bind("aloha-editable-destroyed",function(){l.activeEditable&&l.activeEditable.obj&&delete b[l.activeEditable.getId()]});
l.bind("aloha-selection-changed",function(c,d){if(l.activeEditable)if(b[l.activeEditable.getId()]){a._formatAbbrButton.show();a._insertAbbrButton.show();var g=a.findAbbrMarkup(d);if(g){a._insertAbbrButton.hide();a._formatAbbrButton.setState(true);a.abbrField.show();a.remAbbrButton.show();f.enterScope(a.name,"abbr");a.abbrField.setTargetObject(g,"title");for(var g=a.abbrField,j=d.findAllMarkupByTagName("ABBR",d),k=0,m=j.length;k<m;k++)g.addAdditionalTargetObject(j[k])}else{a.abbrField.hide();a.remAbbrButton.hide();
f.leaveScope(a.name,"abbr",true);a._formatAbbrButton.setState(false);a.abbrField.setTargetObject(null)}}else{a._formatAbbrButton.hide();a._insertAbbrButton.hide()}})},findAbbrMarkup:function(a){typeof a=="undefined"&&(a=l.Selection.getRangeObject());return l.activeEditable?a.findMarkup(function(){return this.nodeName.toLowerCase()=="abbr"},l.activeEditable.obj):null},formatAbbr:function(){var a=l.Selection.getRangeObject();l.activeEditable&&(this.findAbbrMarkup(a)?this.removeAbbr():this.insertAbbr())},
insertAbbr:function(a){var b=l.Selection.getRangeObject();if(!this.findAbbrMarkup(b)){b.isCollapsed()&&a!=false&&m.Utils.Dom.extendToWord(b);if(b.isCollapsed()){var a=j.t("newabbr.defaulttext"),c=d('<abbr title="">'+a+"</abbr>");m.Utils.Dom.insertIntoDOM(c,b,d(l.activeEditable.obj));b.startContainer=b.endContainer=c.contents().get(0);b.startOffset=0;b.endOffset=a.length}else{c=d('<abbr title=""></abbr>');m.Utils.Dom.addMarkup(b,c,false)}b.select();this.abbrField.foreground();this.abbrField.focus()}},
removeAbbr:function(){var a=l.Selection.getRangeObject(),b=this.findAbbrMarkup();if(b){m.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(l,
d,a,k,c,b){var f=window.GENTICS;return a.create("horizontalruler",{_constructor:function(){this._super("horizontalruler")},config:["hr"],init:function(){var a=this;this._insertHorizontalRuleButton=k.adopt("insertHorizontalRule",c,{tooltip:b.t("button.addhr.tooltip"),iconOnly:true,icon:"aloha-icon-horizontalruler",scope:"Aloha.continuoustext",click:function(){a.insertHR()}});l.bind("aloha-editable-activated",function(){if(l.activeEditable){a.cfg=a.getEditableConfig(l.activeEditable.obj);d.inArray("hr",
a.cfg)!=-1?a._insertHorizontalRuleButton.show(true):a._insertHorizontalRuleButton.show(false)}})},insertHR:function(){var a=l.Selection.getRangeObject();if(l.activeEditable){var b=d("<hr>");f.Utils.Dom.insertIntoDOM(b,a,d(l.activeEditable.obj),true);a.select()}}})});define("paste/paste-plugin","jquery aloha/core aloha/plugin aloha/command contenthandler/contenthandler-utils aloha/console aloha/copypaste aloha/contenthandlermanager".split(" "),function(l,d,a,k,c,b,f,g){var j,m;function e(a,b){b.css({top:r.scrollTop(),
left:r.scrollLeft()-200,width:200,overflow:"hidden"}).contents().remove();var c=f.getEditableAt(a);c&&c.obj.blur();f.setSelectionAt({startContainer:b[0],endContainer:b[0],startOffset:0,endOffset:0});b.focus()}function o(a,e,k){a.metaKey=null;a.stopPropagation();window.setTimeout(function(){if(e){var n;n=s.html();var l=/^<h\d+.*?>/i.exec(n),o;if(l!==null){l=l[0];o="</"+l.substr(1);n=n.replace(l,"").replace(o,"")}n=(l=g.get("formatless"))?l.handleContent(n):n;p&&/^&nbsp;/.test(n)&&(n=n.substring(6));
(l=f.getEditableAt(e))&&l.obj.focus();f.setSelectionAt(e);window.scrollTo(j,m);l=e.startContainer;if(1===l.nodeType?"p"===l.nodeName.toLowerCase()&&c.isProppedParagraph(l.outerHTML):3===l.nodeType&&"p"===l.parentNode.nodeName.toLowerCase()&&1===l.parentNode.childNodes.length&&q.test(window.escape(l.data))){3===e.startContainer.nodeType?e.startContainer.data="":e.startContainer.innerHTML=" ";e.startOffset=0;if(e.endContainer===e.startContainer)e.endOffset=0}d.queryCommandSupported("insertHTML")?d.execCommand("insertHTML",
false,n):b.error("Common.Paste",'Command "insertHTML" not available. Enable the plugin "common/commands".');s.contents().remove();typeof k==="function"&&k()}d.activeEditable.smartContentChange(a)},10)}function n(a){p?a.bind("beforepaste",function(a){j=window.scrollX||document.documentElement.scrollLeft;m=window.scrollY||document.documentElement.scrollTop;u=f.getRange();e(u,s);a.stopPropagation()}):a.bind("paste",function(a){j=window.scrollX||document.documentElement.scrollLeft;m=window.scrollY||document.documentElement.scrollTop;
var b=f.getRange();e(b,s);p&&document.selection.createRange().execCommand("paste");o(a,b)})}var r=l(window),p=!!l.browser.msie,q=/^(\s|%A0)$/,s=l('<div style="position:absolute; clip:rect(0px,0px,0px,0px); width:1px; height:1px;"></div>').contentEditable(true),u=null;m=j=0;return a.create("paste",{settings:{},init:function(){l("body").append(s);var a=!this.settings.noclipboardaccess;d.bind("aloha-editable-created",function(b,c){n(c.obj,a)});p&&s.bind("paste",function(a){o(a,u,function(){u=null})})},
register:function(){b.deprecated("Plugins.Paste","register() for pasteHandler is deprecated.  Use the ContentHandler Plugin instead.")}})});define("autoparagraph/autoparagraph-plugin",["jquery","aloha/plugin","aloha/core","util/html","util/dom"],function(l,d,a,k,c){function b(b){if(b){var f=b.obj;if(f){var e=f[0],d,g=a.Selection.rangeObject,r=!1;if(c.allowsNesting(e,l("<p></p>")[0])){var p=[],q;f.contents().each(function(){k.isBlock(this)?q=null:(q||(q={objs:[]},p.push(q)),q.objs.push(this))});for(f=
0;f<p.length;f++){r=p[f];d=c.getIndexInParent(r.objs[0]);var s=c.getIndexInParent(r.objs[r.objs.length-1]),u=l("<p></p>");g.startContainer===e&&(g.startOffset>d&&g.startOffset<=s?(g.startContainer=u[0],g.startOffset-=d):g.startOffset>s&&(g.startOffset-=s-d));g.endContainer===e&&(g.endOffset>d&&g.endOffset<=s?(g.endContainer=u[0],g.endOffset-=d):g.endOffset>s&&(g.endOffset-=s-d));l(r.objs[0]).before(u);for(d=0;d<r.objs.length;d++)u[0].appendChild(r.objs[d]);r=!0}r&&b.isActive&&g.select()}}}}function f(a){return"array"===
l.type(a)&&-1!==l.inArray(g,a)}var g="autoparagraph";return d.create(g,{config:[g],init:function(){var c=this;a.bind("aloha-editable-created",function(a,e){var d=c.getEditableConfig(e.obj);f(d)&&b(e)});a.bind("aloha-smart-content-changed",function(a,e){var d=c.getEditableConfig(e.editable.obj);f(d)&&b(e.editable)})}})});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(l,d,a,k,c,b){function f(a,b){return g(a,function(a){return a===b})}function g(a,b){for(var c=0;c<a.length;c++)if(b(a[c]))return a[c];return null}function j(a,b){for(var c=[],e=0;e<a.length;e++)c.push(b(a[e]));return c}function m(a,b){j(a,b)}function e(){return a(j(l.editables,function(a){return document.getElementById(a.getId())}))}function o(b){var c;typeof b=="object"?c=a(b).text().replace(/[^a-zA-Z-]+/g,"-").replace(/^[^a-zA-Z]+/,""):b&&(c=b);for(var e=0;;e++){var f=c;e&&(f=f+("-"+e));
var d=document.getElementById(f);if(!d||typeof b=="object"&&d===b)return f}}var n=window.GENTICS,r=null,p=[];return d.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;l.bind("aloha-editable-activated",function(){if(l.activeEditable){b.cfg=b.getEditableConfig(l.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=k.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||e(),c=o("toc"),f=a("<ol class='toc_root'></ol>").attr("id",
c).attr("contentEditable","false"),d=l.Selection.getRangeObject(),g=a(document.getElementById(l.activeEditable.getId()));n.Utils.Dom.insertIntoDOM(f,d,g);this.create(c).register(b).update().tickTock()},spawn:function(b,c){b=b||a("body");c=c||e();b.find("ol.toc_root").each(function(){var b=a(this).attr("id");if(!b){b=o("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(e());b.update()},a);return b}},cleanupIds:function(b){var c=[];this.headings(this.$containers).each(function(){var e=
a(this).attr("id");(e&&-1!=a.inArray(e,c)||b&&(a.contains(b,this)||b===this))&&a(this).attr("id",o(this));c.push(e)});return this},update:function(){var a=this,b=this.outline(a.$containers),c=[a.root()];c[c.length-1].empty();(function x(b){var e=[];m(b,function(b){var f=a.linkSection(b[0],c,e);c.push(f);x(b.slice(1));c.pop();e.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,e){var f=b.eq(0).attr("id");if(!f){f=o(b.get(0));b.eq(0).attr("id",f)}var d=this.root(),g=f?d.find('a[href $= "#'+f+'"]'):a();g.length||(g=a("<li><a/></li>"));g.find("a").attr("href","#"+f).text(b.eq(0).text());if(e[e.length-1])e[e.length-1].after(g);else if(c[c.length-1].get(0)==d.get(0))d.append(g);else{b=a("<ol/>").append(g);c[c.length-1].append(b)}return g},outline:function(b){var c=[a()],e=[c];this.headings(b).each(function(){var b=a(this),c=this.nodeName.toLowerCase(),d=["h6","h5","h4","h3",
"h2","h1"],c=a.inArray(c,d),d=d.slice(c).join(","),d=[b.nextUntil(d).andSelf()],c=g(e,function(c){c=c[0];return!c.length||g(c,function(c){return b.get(0)===c||a.contains(c,b.get(0))})});c.push(d);e.splice(0,f(e,c),d)});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(l,d,a,k,c,b,f,g,j){function m(a,b){return a.replace(/\{([a-z0-9\-\_]+)\}/ig,function(a,c){var e=b[c]||a;return typeof e==="function"?e():e})}function e(){var a=[],b=n;d.each(arguments,function(){a.push("."+(""===this?b:b+"-"+this))});return d.trim(a.join(" "))}function o(){var a=[],b=n;d.each(arguments,function(){a.push(""===this?
b:b+"-"+this)});return d.trim(a.join(" "))}var n="aloha-cite",r=(new Date).getTime(),p={quote:o("quote"),blockquote:o("blockquote"),"panel-label":o("panel-label"),"panel-field":o("panel-field"),"panel-btns":o("panel-btns"),"link-field":o("link-field"),"note-field":o("note-field"),references:o("references")};return a.create("cite",{citations:[],referenceContainer:null,settings:null,sidebar:null,config:["quote","blockquote"],init:function(){var a=this;if(l.settings&&l.settings.plugins&&l.settings.plugins.cite){var f=
d(l.settings.plugins.cite.referenceContainer);if(f.length)a.referenceContainer=f;if(typeof l.settings.plugins.cite!=="undefined")a.settings=l.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=k.adopt("quote",c,{tooltip:j.t("cite.button.add.quote"),icon:o("button","inline-button"),scope:"Aloha.continuoustext",click:function(){a.addInlineQuote()}});b.multiSplitButton.pushItem({name:"blockquote",tooltip:j.t("cite.button.add.blockquote"),icon:o("button","block-button"),click:function(){a.addBlockQuote()}});var n=this;l.ready(function(){n.sidebar=l.Sidebar.right.show();n.sidebar.addPanel({id:o("sidebar-panel"),title:"Citation",content:"",expanded:true,activeOn:"q, blockquote",
onInit:function(){var a=this,b="";n.referenceContainer&&(b='<label class="{panel-label}" for="{note-field}-textarea">Note</label> <div class="{panel-field} {note-field}" style="margin: 5px;"><textarea id="{note-field}-textarea"></textarea></div>');this.setContent(typeof('<label class="{panel-label}" for="{link-field}-input">Link</label><div class="{panel-field} {link-field}" style="margin: 5px;"><input type="text" id="{link-field}-input" /></div>'+b)==="string"?m('<label class="{panel-label}" for="{link-field}-input">Link</label><div class="{panel-field} {link-field}" style="margin: 5px;"><input type="text" id="{link-field}-input" /></div>'+
b,p):'<label class="{panel-label}" for="{link-field}-input">Link</label><div class="{panel-field} {link-field}" style="margin: 5px;"><input type="text" id="{link-field}-input" /></div>'+b).content.find("input, textarea").bind("keypress change",function(){n.addCiteDetails(a.content.attr("data-cite-id"),a.content.find(e("link-field input")).val(),a.content.find(e("note-field textarea")).val())})},onActivate:function(b){var c=b.attr("data-cite-id");if(!c){var c=++r,f=""+o("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(e("link-field input")).val(b.attr("cite"));this.content.find(e("note-field textarea")).val(a.citations[f].note)}})});l.bind("aloha-editable-activated",function(c,e){var f=a.getEditableConfig(e.editable.obj);if(f){d.inArray("quote",f)!==-1?a._quoteButton.show(true):a._quoteButton.show(false);d.inArray("blockquote",f)!==-1?b.multiSplitButton.showItem("blockquote"):
b.multiSplitButton.hideItem("blockquote")}});g.sub("aloha.selection.context-change",function(c){for(var e=false,f=false,g=c.range.markupEffectiveAtStart,j=g.length;j;){c=g[--j].nodeName;c==="Q"?e=true:c==="BLOCKQUOTE"&&(f=true)}a._quoteButton.setState(e);f&&b.multiSplitButton.setActiveItem("blockquote");e=[];l.activeEditable&&(e=a.getEditableConfig(l.activeEditable.obj));d.inArray("quote",e)!==-1?a._quoteButton.show(true):a._quoteButton.show(false);d.inArray("blockquote",e)!==-1?b.multiSplitButton.showItem("blockquote"):
b.multiSplitButton.hideItem("blockquote")})},getIndexOfCitation:function(a){for(var b=this.citations,c=b.length,e=0,f,d;e<c;){f=e+c>>1;d=b[f].uid;if(d==a)return f;d>a?c=f:d<a&&(e=f+1)}return-1},addBlockQuote:function(){var a=[o("wrapper"),o(++r)].join(" "),a=d(m('<blockquote class="{classes}" data-cite-id="{uid}"></blockquote>',{uid:r,classes:a}));l.activeEditable&&d(l.activeEditable.obj[0]).click();l.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=[o("wrapper"),o(++r)].join(" "),b=d(m('<q class="{classes}" data-cite-id="{uid}"></q>',{uid:r,classes:a})),a=l.Selection.rangeObject,c;l.activeEditable&&d(l.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},l.activeEditable.obj))a.isCollapsed()?
f.removeFromDOM(c,a,true):f.removeMarkup(a,b,l.activeEditable.obj);else{a.isCollapsed()&&f.extendToWord(a);f.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=d(".aloha-editable-active "+e(a)),f="cite-note-"+a,a="cite-ref-"+a;c.append(m('<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(m('<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&&d(e(a)).attr("cite",b);this.referenceContainer&&d("li#cite-note-"+a+" span").html(m(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(){d.trim(d(this).attr("class"))===""&&d(this).removeAttr("class");if(!this.referenceContainer){d(this).removeClass("aloha-cite-"+d(this).attr("data-cite-id"));d(this).attr("data-cite-id")!=null&&d(this).removeAttr("data-cite-id")}d(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","button.numeratedHeaders.tooltip":"Toggle header numeration"},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(l,d,
a,k,c,b){var f={};l.bind("aloha-editable-destroyed",function(a,b){delete f[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=k.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()}});l.bind("aloha-smart-content-changed",function(){a.cleanNumerations();a.showNumbers()&&a.createNumeratedHeaders()});l.bind("aloha-format-block",function(){a.cleanNumerations();a.showNumbers()&&a.createNumeratedHeaders()});l.bind("aloha-editable-activated",function(){if(a.isNumeratingOn()){a._formatNumeratedHeadersButton.show();a.initForEditable(l.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(l.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=d.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 l.activeEditable&&this.isNumeratingOn()&&l.activeEditable.obj.attr("aloha-numerated-headers")==="true"},cleanNumerations:function(){var a=this.getBaseElement();a&&this._saveRemoveAnnotations(d(a).find("span[role=annotation]"))},
_saveRemoveAnnotations:function(a){var b=this,c=l.Selection.getRangeObject(),e=false;a.each(function(){if(c.startContainer===this||d.inArray(this,d(c.startContainer).parents())>-1){c.startContainer=b._prevNode(this);c.startOffset=0;e=true}if(c.startContainer===this.parentNode&&c.startOffset>=d(this).index()&&c.startOffset>0){c.startOffset--;e=true}if(c.endContainer===this||d.inArray(this,d(c.endContainer).parents())>-1){c.endContainer=b._prevNode(this);c.endOffset=0;e=true}if(c.endContainer===this.parentNode&&
c.endOffset>=d(this).index()&&c.endOffset>0){c.endOffset--;e=true}d(this).remove()});if(e===true){c.update();c.select()}},_prependAnnotation:function(a,b){var c=l.Selection.getRangeObject(),e=false;if(c.startContainer===b){c.startOffset++;e=true}if(c.endContainer===b){c.endOffset++;e=true}d(b).prepend('<span role="annotation">'+a+"</span>");if(e===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(){d(l.activeEditable.obj).attr("aloha-numerated-headers",
"false");this.cleanNumerations()},getBaseElement:function(){return typeof this.baseobjectSelector!=="undefined"?d(this.baseobjectSelector).length>0?d(this.baseobjectSelector):null:l.activeEditable?l.activeEditable.obj:null},hasNote:function(a){return!a||d(a).length<=0?false:d(a).find("span[role=annotation]").length>0},hasContent:function(a){if(!a||0===d(a).length)return false;a=d(a).clone().find("span[role=annotation]").remove().end();return d.trim(a.text()).length>0},createNumeratedHeaders:function(){var a=
this.getBaseElement();if(a){var b=this.getCurrentConfig(),a=a.find(b.headingselector);l.activeEditable.obj.attr("aloha-numerated-headers","true");if(!(typeof a==="undefined"||a.length===0)){var c=7,e=this;a.each(function(){if(e.hasContent(this)){var a=parseInt(this.nodeName.substr(1),10);a<c&&(c=a)}});if(!(c>6)){var f=null,k=[],r=0,p;for(p=0;p<6-c+1;p++)k[p]=0;a.each(function(){if(e.hasContent(this)){var a=parseInt(this.nodeName.substr(1),10);if(f===null&&a!==c)e._saveRemoveAnnotations(d(this).find("span[role=annotation]"));
else{if(f===null)k[r]++;else if(a>f)k[++r]++;else if(a===f)k[r]++;else if(a<f){var g=a-c,l;for(l=r;l>g;l--)k[l]=0;r=g;k[r]++}f=a;a="";if(b.trailingdot===true){a="";for(g=0;g<k.length;g++)k[g]!==0&&(a=a+(k[g]+"."))}else{a=k[0];for(g=1;g<k.length;g++)k[g]!==0&&(a=a+("."+k[g]))}a=a+"&nbsp;";e.hasNote(this)?d(this).find("span[role=annotation]").html(a):e._prependAnnotation(a,this)}}else e.hasNote(this)&&e._saveRemoveAnnotations(d(this).find("span[role=annotation]"))})}}}}})});define("formatlesspaste/formatlesshandler",
["aloha","jquery","aloha/contenthandlermanager"],function(l,d,a){function k(a,b){a.find(b.join(",")).each(function(){d(this).contents().unwrap()})}return a.createHandler({enabled:!1,handleContent:function(a){var b;"string"===typeof a?b=d("<div>"+a+"</div>"):a instanceof d&&(b=d("<div>").append(a));if(!b.find(".aloha-block").length)return this.enabled&&k(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 util/html".split(" "),function(l,d,a,k,c,b,f,g,j){function m(a){return!a?false:typeof a==="string"?"0"!==a&&"false"!==a.toLowerCase():true}function e(a){var b={};if(typeof a.formatlessPasteOption!=="undefined")b.formatlessPasteOption=m(a.formatlessPasteOption);
if(typeof a.strippedElements!=="undefined")b.strippedElements=a.strippedElements;if(typeof a.button!=="undefined")b.button=m(a.button);return b}function o(b,c){a.extend(b,c)}function n(a){f.register("formatless",b);b.strippedElements=j.TEXT_LEVEL_SEMANTIC_ELEMENTS;a._toggleFormatlessPasteButton=k.adopt("toggleFormatlessPaste",c,{tooltip:g.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 r(a,b){var c=b.getId();if(!c)return null;if(p[c])return p[c];var f=a.getEditableConfig(b.obj);if(!f)return null;p[c]=e(f);return p[c]}var p={};l.bind("aloha-editable-destroyed",function(a,b){var c=b.getId();c&&p[c]&&delete p[c]});return d.create("formatlesspaste",{formatlessPasteOption:false,
button:true,init:function(){var a=this;o(a,e(a.settings.config||a.settings));n(a);l.bind("aloha-editable-activated",function(c,e){var f=r(a,e.editable);if(f){var d=a._toggleFormatlessPasteButton;if(true===f.formatlessPasteOption){d.setState(true);b.enabled=true}else if(false===f.formatlessPasteOption){d.setState(false);b.enabled=false}d.show(false!==f.button)}})}})});(function(){var l=!1,d=/xyz/.test(function(){xyz})?/\b_super\b/:/.*/;this.Class=function(){};Class.extend=function(){function a(){!l&&
this.init&&this.init.apply(this,arguments)}var k=this.prototype;l=!0;var c=new this;l=!1;for(var b=0;b<arguments.length;b++){var f=arguments[b],g;for(g in f)c[g]="function"==typeof f[g]&&"function"==typeof k[g]&&d.test(f[g])?function(a,b){return function(){var c=this._super;this._super=k[a];var f=b.apply(this,arguments);this._super=c;return f}}(g,f[g]):f[g]}a.prototype=c;a.constructor=a;a.extend=arguments.callee;return a}})();"function"===typeof define&&define("Class",[],function(){return Class});
define("jstree",["jquery"],function(l){(function(){if(!l||!l.jstree){var d=!1,a=!1,k=!1;(function(c){c.vakata={};c.vakata.css={get_css:function(a,b,c){var a=a.toLowerCase(),f=c.cssRules||c.rules,d=0;do{if(f.length&&d>f.length+5)break;if(f[d].selectorText&&f[d].selectorText.toLowerCase()==a)return!0===b?(c.removeRule&&c.removeRule(d),c.deleteRule&&c.deleteRule(d),!0):f[d]}while(f[++d]);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(d){}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=[],f=-1,g={},j={};c.fn.jstree=function(a){var e="string"==typeof a,f=Array.prototype.slice.call(arguments,1),d=this;if(e){if("_"==a.substring(0,1))return d;
this.each(function(){var e=b[c.data(this,"jstree-instance-id")],e=e&&c.isFunction(e[a])?e[a].apply(e,f):e;if("undefined"!==typeof e&&(0===a.indexOf("is_")||!0!==e&&!1!==e))return d=e,!1})}else this.each(function(){var e=c.data(this,"jstree-instance-id"),d=[],j=a?c.extend({},!0,a):{},k=c(this),l=!1,n=[],d=d.concat(f);k.data("jstree")&&d.push(k.data("jstree"));j=d.length?c.extend.apply(null,[!0,j].concat(d)):j;"undefined"!==typeof e&&b[e]&&b[e].destroy();e=parseInt(b.push({}),10)-1;c.data(this,"jstree-instance-id",
e);j.plugins=c.isArray(j.plugins)?j.plugins:c.jstree.defaults.plugins.slice();j.plugins.unshift("core");j.plugins=j.plugins.sort().join(",,").replace(/(,|^)([^,]+)(,,\2)+(,|$)/g,"$1$2$4").replace(/,,+/g,",").replace(/,$/,"").split(",");l=c.extend(!0,{},c.jstree.defaults,j);l.plugins=j.plugins;c.each(g,function(a){-1===c.inArray(a,l.plugins)?(l[a]=null,delete l[a]):n.push(a)});l.plugins=n;b[e]=new c.jstree._instance(e,c(this).addClass("jstree jstree-"+e),l);c.each(b[e]._get_settings().plugins,function(a,
c){b[e].data[c]={}});c.each(b[e]._get_settings().plugins,function(a,c){g[c]&&g[c].__init.apply(b[e])});setTimeout(function(){b[e].init()},0)});return d};c.jstree={defaults:{plugins:[]},_focused:function(){return b[f]||null},_reference:function(a){if(b[a])return b[a];var e=c(a);!e.length&&"string"===typeof a&&(e=c("#"+a));return!e.length?null:b[e.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);g[a]=b;c.jstree.defaults[a]=b.defaults;c.each(b._fn,function(b,e){e.plugin=a;e.old=c.jstree._fn[b];c.jstree._fn[b]=function(){var a,f=e,d=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,d);else{a=this.get_container().triggerHandler(a,{func:b,inst:this,args:d,plugin:f.plugin});if(!1===a)return;"undefined"!==typeof a&&(d=a);a=f.apply(c.extend({},this,{__callback:function(a){this.get_container().triggerHandler(b+".jstree",{inst:this,args:d,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):d)}}),d)}return a}}};c.jstree._fn[b].old=e.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(),e=(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(e,10)){d=!0;try{document.execCommand("BackgroundImageCache",!1,!0)}catch(g){}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(e,10)&&(a=!0,f+=".jstree li a { border-width:0 !important; padding:0px 2px !important; } ");!/compatible/.test(b)&&(/mozilla/.test(b)&&1.9>parseFloat(e,10))&&(k=!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),d=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,e){d.data[b]&&c.isFunction(d["_"+b+"_notify"])&&d["_"+b+"_notify"].call(d,a,e)})})},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),d=this;-1===f&&(f=this.get_container_ul());f.length&&f.find("li.jstree-open:not(:has(ul))").each(function(){d.load_node(this,c.noop,c.noop)})},this));this.__callback();this.load_node(-1,function(){this.loaded();this.reload_nodes()})},destroy:function(){var a,e=this.get_index(),d=this._get_settings(),j=this;c.each(d.plugins,function(a,b){try{g[b].__destroy.apply(j)}catch(c){}});this.__callback();if(this.is_focused())for(a in b)if(b.hasOwnProperty(a)&&
a!=e){b[a].set_focus();break}e===f&&(f=-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-"+e).undelegate(".jstree-"+e);b[e]=null;delete b[e]},_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,d=[],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?d.push(b):g.push(b)}),d.length&&(this.data.core.to_load=g,c.each(d,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");f=this.get_index();this.__callback()}},is_focused:function(){return f==this.get_index()},unset_focus:function(){this.is_focused()&&(this.get_container().removeClass("jstree-focused"),
f=-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||d?0:this._get_settings().core.animation,g=this;this._is_loaded(a)?(this._get_settings().core.open_parents&&a.parentsUntil(".jstree",".jstree-closed").each(function(){g.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="";g.after_open(a)}):g.after_open(a),this.__callback({obj:a}),b&&b.call()):
(a.children("a").addClass("jstree-loading"),this.load_node(a,function(){g.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||d?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,d,g){var a=this._get_node(a),b="undefined"===typeof b?"last":
b,j=c("<li />"),k=this._get_settings().core,l;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,d,!0)}),!1;this.__rollback();"string"===typeof f&&(f={data:f});f||(f={});f.attr&&j.attr(f.attr);f.metadata&&j.data(f.metadata);f.state&&j.addClass("jstree-"+f.state);f.data||(f.data=this._get_string("new_node"));c.isArray(f.data)||(l=f.data,f.data=[],f.data.push(l));c.each(f.data,function(a,b){l=c("<a />");c.isFunction(b)&&(b=b.call(this,
f));if(typeof b=="string")l.attr("href","#")[k.html_titles?"html":"text"](b);else{if(!b.attr)b.attr={};if(!b.attr.href)b.attr.href="#";l.attr(b.attr)[k.html_titles?"html":"text"](b.title);b.language&&l.addClass(b.language)}l.prepend("<ins class='jstree-icon'>&#160;</ins>");b.icon&&(b.icon.indexOf("/")===-1?l.children("ins").addClass(b.icon):l.children("ins").css("background","url('"+b.icon+"') center center no-repeat"));j.append(l)});j.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(j);l=this._get_parent(a);break;case "after":a.after(j);l=this._get_parent(a);break;case "inside":case "first":a.children("ul").length||a.append("<ul />");a.children("ul").prepend(j);l=a;break;case "last":a.children("ul").length||a.append("<ul />");a.children("ul").append(j);l=a;break;default:a.children("ul").length||a.append("<ul />"),b||(b=0),l=a.children("ul").children("li").eq(b),l.length?l.before(j):a.children("ul").append(j),
l=a}if(-1===l||l.get(0)===this.get_container().get(0))l=-1;this.clean_node(l);this.__callback({obj:j,parent:l});d&&d.call(this,j);return j},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([]),d=this;a.each(function(){f=f.add(d._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,f,d,g){var k={};k.ot=c.jstree._reference(a)||this;k.o=k.ot._get_node(a);k.r=-1===b?-1:this._get_node(b);k.p="undefined"===typeof f||!1===f?"last":f;if(g||!j.o||!(j.o[0]===k.o[0]&&j.r[0]===k.r[0]&&j.p===
k.p)){k.ot=c.jstree._reference(k.o)||this;k.rt=c.jstree._reference(k.r)||this;if(-1===k.r||!k.r)switch(k.cr=-1,k.p){case "first":case "before":case "inside":k.cp=0;break;case "after":case "last":k.cp=k.rt.get_container().find(" > ul > li").length;break;default:k.cp=k.p}else{if(!/^(before|after)$/.test(k.p)&&!this._is_loaded(k.r))return this.load_node(k.r,function(){this.prepare_move(a,b,f,d,!0)});switch(k.p){case "before":k.cp=k.r.index();k.cr=k.rt._get_parent(k.r);break;case "after":k.cp=k.r.index()+
1;k.cr=k.rt._get_parent(k.r);break;case "inside":case "first":k.cp=0;k.cr=k.r;break;case "last":k.cp=k.r.find(" > ul > li").length;k.cr=k.r;break;default:k.cp=k.p,k.cr=k.r}}k.np=-1==k.cr?k.rt.get_container():k.cr;k.op=k.ot._get_parent(k.o);k.cop=k.o.index();-1===k.op&&(k.op=k.ot?k.ot.get_container():this.get_container());!/^(before|after)$/.test(k.p)&&(k.op&&k.np&&k.op[0]===k.np[0]&&k.o.index()<k.cp)&&k.cp++;k.or=k.np.find(" > ul > li:nth-child("+(k.cp+1)+")");j=k}this.__callback(j);d&&d.call(this,
j)},check_move:function(){var a=j,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,f,d,g,k){if(!g)return this.prepare_move(a,b,f,function(a){this.move_node(a,!1,!1,d,!0,k)});d&&(j.cy=!0);if(!k&&!this.check_move())return!1;this.__rollback();b=!1;d?(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(l){}d&&(j.cy=!0,j.oc=b);this.__callback(j);return j},_get_move:function(){return j}}})})(l);(function(a){var b,f,d;a(function(){/msie/.test(navigator.userAgent.toLowerCase())?(f=
a('<textarea cols="10" rows="2"></textarea>').css({position:"absolute",top:-1E3,left:0}).appendTo("body"),d=a('<textarea cols="10" rows="2" style="overflow: hidden;"></textarea>').css({position:"absolute",top:-1E3,left:0}).appendTo("body"),b=f.width()-d.width(),f.add(d).remove()):(f=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-f.width(),f.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,f){var e=this._get_settings().ui,d=this._get_node(f.rslt.obj),g=d&&d.length?d.children("ul").find("a.jstree-clicked"):
a(),k=this;!1!==e.selected_parent_close&&g.length&&g.each(function(){k.deselect_node(this);"select_parent"===e.selected_parent_close&&k.select_node(d)})},this)).bind("delete_node.jstree",a.proxy(function(a,b){var c=this._get_settings().ui.select_prev_on_delete,f=this._get_node(b.rslt.obj),f=f&&f.length?f.find("a.jstree-clicked"):[],d=this;f.each(function(){d.deselect_node(this)});c&&f.length&&b.rslt.prev.each(function(){if(this.parentNode)return d.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,f){if("undefined"===typeof b||null===b)return f?this.data.ui.selected:this.data.ui.last_selected;var e=a(b,this.get_container());if(e.is(".jstree")||
-1==b)return-1;e=e.closest("li",this.get_container());return e.length?e:!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,f=this.data.ui.to_select,
f=a.map(a.makeArray(f),function(a){return"#"+a.toString().replace(/^#/,"").replace(/\\\//g,"/").replace(/\//g,"\\/").replace(/\\\./g,".").replace(/\./g,"\\.").replace(/\:/g,"\\:")});a.each(f,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 f=this._get_settings().ui,d="on"==f.select_multiple_modifier||
!1!==f.select_multiple_modifier&&c&&c[f.select_multiple_modifier+"Key"],g=!1!==f.select_range_modifier&&c&&c[f.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],k=this.is_selected(a),l=!0,s=this;if(b){if(f.disable_selecting_children&&d&&(a.parentsUntil(".jstree","li").children("a.jstree-clicked").length||a.children("ul").find("a.jstree-clicked:eq(0)").length))return!1;l=!1;switch(!0){case g: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==f.select_limit||a.length<f.select_limit?(this.data.ui.last_selected.removeClass("jstree-last-selected"),this.data.ui.selected.each(function(){this!==s.data.ui.last_selected[0]&&s.deselect_node(this)}),k=!1,l=!0):l=!1;break;case k&&!d:this.deselect_all();k=!1;l=!0;break;case !k&&!d:if(-1==f.select_limit||0<f.select_limit)this.deselect_all(),l=!0;break;case k&&d:this.deselect_node(a);break;
case !k&&d:if(-1==f.select_limit||this.data.ui.selected.length+1<=f.select_limit)l=!0}}l&&!k&&(g||(this.data.ui.last_selected=a),a.children("a").addClass("jstree-clicked"),f.selected_parent_open&&a.parents(".jstree-closed").each(function(){s.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")})(l);(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 d=this;c.rslt.np.parentsUntil(".jstree").andSelf().filter(".jstree-closed").each(function(){d.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,f){var b=this._get_node(b),d=this._get_settings().core.rtl,k=this._get_settings().crrm.input_width_limit,m=b.children("ins").width(),e=b.find("> a:visible > ins").width()*b.find("> a:visible > ins").length,l=this.get_text(b),n=a("<div />",{css:{position:"absolute",top:"-200px",left:d?"0px":"-1000px",visibility:"hidden"}}).appendTo("body"),r=b.css("position","relative").append(a("<input />",
{value:l,"class":"jstree-rename-input",css:{padding:"0",border:"1px solid silver",position:"absolute",left:d?"auto":m+e+4+"px",right:d?m+e+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=l);n.remove();a.remove();this.set_text(b,l);this.rename_node(b,c);f.call(this,b,c,l);b.css("position","")},this),keyup:function(a){a=a.keyCode||a.which;27==
a?(this.value=l,this.blur()):13==a?this.blur():r.width(Math.min(n.text("pW"+this.value).width(),k))},keypress:function(a){if(13==(a.keyCode||a.which))return!1}})).children(".jstree-rename-input");this.set_text(b,"");n.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(n.text("pW"+r[0].value).width(),k))[0].select()},rename:function(a){a=this._get_node(a);this.__rollback();var c=this.__callback;this._show_input(a,function(a,b,d){c.call(this,{obj:a,new_name:b,old_name:d})})},create:function(b,f,d,k,m){var e=this;(b=this._get_node(b))||(b=-1);this.__rollback();return this.create_node(b,f,d,function(b){var f=this._get_parent(b),d=a(b).index();k&&k.call(this,b);f.length&&f.hasClass("jstree-closed")&&this.open_node(f,!1,!0);m?e.__callback({obj:b,
name:this.get_text(b),parent:f,position:d}):this._show_input(b,function(a,b){e.__callback({obj:a,name:b,parent:f,position:d})})})},remove:function(a){var a=this._get_node(a,!0),c=this._get_parent(a),d=this._get_prev(a);this.__rollback();a=this.delete_node(a);!1!==a&&this.__callback({obj:a,prev:d,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,d,k,m,e){var l=this._get_settings().crrm.move;
if(!m)return"undefined"===typeof d&&(d=l.default_position),"inside"===d&&!l.default_position.match(/^(before|after)$/)&&(d=l.default_position),this.__call_old(!0,a,c,d,k,!1,e);if(!0===l.always_copy||"multitree"===l.always_copy&&a.rt.get_index()!==a.ot.get_index())k=!0;this.__call_old(!0,a,c,d,k,!0,e)},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})}}})})(l);(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(f,d){if(!f)return!1;
d||(d=a.jstree._themes+f+"/style.css");-1==a.inArray(d,b)&&(a.vakata.css.add_sheet({url:d}),b.push(d));this.data.themes.theme!=f&&(this.get_container().removeClass("jstree-"+this.data.themes.theme),this.data.themes.theme=f);this.get_container().addClass("jstree-"+f);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")})(l);(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(f,d){!1!==d&&-1==a.inArray(f,b)&&(a(document).bind("keydown",f,function(b){var d;var e=a.jstree._focused(),g;e&&e.data&&e.data.hotkeys&&e.data.hotkeys.enabled&&(g=e._get_settings().hotkeys[f])&&(d=g.call(e,b));return d}),b.push(f))});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}}})})(l);(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,d){var k=this;this.load_node_json(a,function(){k.__callback({obj:k._get_node(a)});c.call(this)},d)},_is_loaded:function(b){var f=this._get_settings().json_data,b=this._get_node(b);return-1==b||!b||!f.ajax&&!f.progressive_render&&!a.isFunction(f.data)||b.is(".jstree-open, .jstree-leaf")||
0<b.children("ul").children("li").length},refresh:function(b){var b=this._get_node(b),f=this._get_settings().json_data;b&&(-1!==b&&f.progressive_unload&&(a.isFunction(f.data)||f.ajax))&&b.removeData("jstree-children");return this.__call_old()},load_node_json:function(b,f,d){var k=this.get_settings().json_data,m,e=function(){};m=function(){};if((b=this._get_node(b))&&-1!==b&&(k.progressive_render||k.progressive_unload)&&!b.is(".jstree-open, .jstree-leaf")&&0===b.children("ul").children("li").length&&
b.data("jstree-children")){if(m=this._parse_json(b.data("jstree-children"),b))b.append(m),k.progressive_unload||b.removeData("jstree-children");this.clean_node(b);f&&f.call(this)}else{if(b&&-1!==b){if(b.data("jstree-is-loading"))return;b.data("jstree-is-loading",!0)}switch(!0){case !k.data&&!k.ajax:throw"Neither data nor ajax settings supplied.";case a.isFunction(k.data):k.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);f&&f.call(this)}else{if(b===-1||!b)k.correct_state&&this.get_container().children("ul").empty();else{b.children("a.jstree-loading").removeClass("jstree-loading");b.removeData("jstree-is-loading");k.correct_state&&this.correct_state(b)}d&&d.call(this)}},this));break;case !!k.data&&!k.ajax||!!k.data&&!!k.ajax&&(!b||-1===b):if(!b||-1==b)(m=this._parse_json(k.data,b))?(this.get_container().children("ul").empty().append(m.children()),
this.clean_node()):k.correct_state&&this.get_container().children("ul").empty();f&&f.call(this);break;case !k.data&&!!k.ajax||!!k.data&&!!k.ajax&&b&&-1!==b:e=function(a,c,e){var f=this.get_settings().json_data.ajax.error;f&&f.call(this,a,c,e);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();d&&d.call(this)},
m=function(d,g,m){var l=this.get_settings().json_data.ajax.success;l&&(d=l.call(this,d,g,m)||d);if(d===""||d&&d.toString&&d.toString().replace(/^[\s\n]+$/,"")===""||!a.isArray(d)&&!a.isPlainObject(d))return e.call(this,m,g,"");if(d=this._parse_json(d,b)){if(b===-1||!b)this.get_container().children("ul").empty().append(d.children());else{b.append(d).children("a.jstree-loading").removeClass("jstree-loading");b.removeData("jstree-is-loading")}this.clean_node(b);f&&f.call(this)}else if(b===-1||!b){if(k.correct_state){this.get_container().children("ul").empty();
f&&f.call(this)}}else{b.children("a.jstree-loading").removeClass("jstree-loading");b.removeData("jstree-is-loading");if(k.correct_state){this.correct_state(b);f&&f.call(this)}}},k.ajax.context=this,k.ajax.error=e,k.ajax.success=m,k.ajax.dataType||(k.ajax.dataType="json"),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)}}},_parse_json:function(b,f,d){var k=!1,m=this._get_settings(),e=m.json_data,l=m.core.html_titles,
n;if(!b)return k;e.progressive_unload&&(f&&-1!==f)&&f.data("jstree-children",k);if(a.isArray(b)){k=a();if(!b.length)return!1;m=0;for(e=b.length;m<e;m++)n=this._parse_json(b[m],f,!0),n.length&&(k=k.add(n))}else{"string"==typeof b&&(b={data:b});if(!b.data&&""!==b.data)return k;k=a("<li />");b.attr&&k.attr(b.attr);b.metadata&&k.data(b.metadata);b.state&&k.addClass("jstree-"+b.state);a.isArray(b.data)||(n=b.data,b.data=[],b.data.push(n));a.each(b.data,function(e,f){n=a("<a />");a.isFunction(f)&&(f=f.call(this,
b));if(typeof f=="string")n.attr("href","#")[l?"html":"text"](f);else{if(!f.attr)f.attr={};if(!f.attr.href)f.attr.href="#";n.attr(f.attr)[l?"html":"text"](f.title);f.language&&n.addClass(f.language)}n.prepend("<ins class='jstree-icon'>&#160;</ins>");if(!f.icon&&b.icon)f.icon=b.icon;f.icon&&(f.icon.indexOf("/")===-1?n.children("ins").addClass(f.icon):n.children("ins").css("background","url('"+f.icon+"') center center no-repeat"));k.append(n)});k.prepend("<ins class='jstree-icon'>&#160;</ins>");b.children&&
(e.progressive_render&&"open"!==b.state?k.addClass("jstree-closed").data("jstree-children",b.children):(e.progressive_unload&&k.data("jstree-children",b.children),a.isArray(b.children)&&b.children.length&&(n=this._parse_json(b.children,f,!0),n.length&&(f=a("<ul />"),f.append(n),k.append(f)))))}d||(d=a("<ul />"),d.append(k),k=d);return k},get_json:function(b,f,d,k){var m=[],e=this._get_settings(),l=this,n,r,p,q,s,u,b=this._get_node(b);if(!b||-1===b)b=this.get_container().find("> ul > li");f=a.isArray(f)?
f:["id","class"];!k&&this.data.types&&f.push(e.types.type_attr);d=a.isArray(d)?d:[];b.each(function(){p=a(this);n={data:[]};f.length&&(n.attr={});a.each(f,function(a,b){(r=p.attr(b))&&(r.length&&r.replace(/jstree[^ ]*/ig,"").length)&&(n.attr[b]=(" "+r).replace(/ jstree[^ ]*/ig,"").replace(/\s+$/ig," ").replace(/^ /,"").replace(/ $/,""))});p.hasClass("jstree-open")&&(n.state="open");p.hasClass("jstree-closed")&&(n.state="closed");p.data()&&(n.metadata=p.data());q=p.children("a");q.each(function(){s=
a(this);if(d.length||a.inArray("languages",e.plugins)!==-1||s.children("ins").get(0).style.backgroundImage.length||s.children("ins").get(0).className&&s.children("ins").get(0).className.replace(/jstree[^ ]*|$/ig,"").length){u=false;a.inArray("languages",e.plugins)!==-1&&(a.isArray(e.languages)&&e.languages.length)&&a.each(e.languages,function(a,b){if(s.hasClass(b)){u=b;return false}});r={attr:{},title:l.get_text(s,u)};a.each(d,function(a,b){r.attr[b]=(" "+(s.attr(b)||"")).replace(/ jstree[^ ]*/ig,
"").replace(/\s+$/ig," ").replace(/^ /,"").replace(/ $/,"")});a.inArray("languages",e.plugins)!==-1&&(a.isArray(e.languages)&&e.languages.length)&&a.each(e.languages,function(a,b){if(s.hasClass(b)){r.language=b;return true}});if(s.children("ins").get(0).className.replace(/jstree[^ ]*|$/ig,"").replace(/^\s+$/ig,"").length)r.icon=s.children("ins").get(0).className.replace(/jstree[^ ]*|$/ig,"").replace(/\s+$/ig," ").replace(/^ /,"").replace(/ $/,"");if(s.children("ins").get(0).style.backgroundImage.length)r.icon=
s.children("ins").get(0).style.backgroundImage.replace("url(","").replace(")","")}else r=l.get_text(s);q.length>1?n.data.push(r):n.data=r});p=p.find("> ul > li");p.length&&(n.children=l.get_json(p,f,d,!0));m.push(n)});return m}}})})(l);(function(a){a.jstree.plugin("languages",{__init:function(){this._load_css()},defaults:[],_fn:{set_lang:function(b){var f=this._get_settings().languages,d=!1,k=".jstree-"+this.get_index()+" a";if(!a.isArray(f)||0===f.length)return!1;if(-1==a.inArray(b,f))if(f[b])b=
f[b];else return!1;if(b==this.data.languages.current_language)return!0;d=a.vakata.css.get_css(k+"."+this.data.languages.current_language,!1,this.data.languages.language_css);!1!==d&&(d.style.display="none");d=a.vakata.css.get_css(k+"."+b,!1,this.data.languages.language_css);!1!==d&&(d.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,f){var d=this._get_settings().languages,k=
this._get_settings().core.strings;a.isArray(d)&&d.length&&(f=f&&-1!=a.inArray(f,d)?f:this.data.languages.current_language);return k[f]&&k[f][b]?k[f][b]:k[b]?k[b]:b},get_text:function(b,f){b=this._get_node(b)||this.data.ui.last_selected;if(!b.size())return!1;var d=this._get_settings().languages,k=this._get_settings().core.html_titles;a.isArray(d)&&d.length?(f=f&&-1!=a.inArray(f,d)?f:this.data.languages.current_language,b=b.children("a."+f)):b=b.children("a:eq(0)");if(k)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,f,d){b=this._get_node(b)||this.data.ui.last_selected;if(!b.size())return!1;var k=this._get_settings().languages,m=this._get_settings().core.html_titles;a.isArray(k)&&k.length?(d=d&&-1!=a.inArray(d,k)?d:this.data.languages.current_language,b=b.children("a."+d)):b=b.children("a:eq(0)");if(m)return k=b.children("INS").clone(),b.html(f).prepend(k),this.__callback({obj:b,name:f,lang:d}),!0;b=
b.contents().filter(function(){return this.nodeType==3})[0];this.__callback({obj:b,name:f,lang:d});return b.nodeValue=f},_load_css:function(){var b=this._get_settings().languages,f="/* languages css */",d=".jstree-"+this.get_index()+" a",k;if(a.isArray(b)&&b.length){this.data.languages.current_language=b[0];for(k=0;k<b.length;k++)f+=d+"."+b[k]+" {",b[k]!=this.data.languages.current_language&&(f+=" display:none; "),f+=" } ";this.data.languages.language_css=a.vakata.css.add_sheet({str:f,title:"jstree-languages"})}},
create_node:function(b,f,d,k){return this.__call_old(!0,b,f,d,function(b){var e=this._get_settings().languages,f=b.children("a"),d;if(a.isArray(e)&&e.length){for(d=0;d<e.length;d++)f.is("."+e[d])||b.append(f.eq(0).clone().removeClass(e.join(" ")).addClass(e[d]));f.not("."+e.join(", .")).remove()}k&&k.call(this,b)})}}})})(l);(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,
f;if(b.save_loaded&&(f=a.cookie(b.save_loaded))&&f.length)this.data.core.to_load=f.split(",");if(b.save_opened&&(f=a.cookie(b.save_opened))&&f.length)this.data.core.to_open=f.split(",");if(b.save_selected&&(f=a.cookie(b.save_selected))&&f.length&&this.data.ui)this.data.ui.to_select=f.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 f=this._get_settings().cookies;if(b)switch(b){case "open_node":case "close_node":f.save_opened&&(this.save_opened(),a.cookie(f.save_opened,this.data.core.to_open.join(","),f.cookie_options));f.save_loaded&&(this.save_loaded(),
a.cookie(f.save_loaded,this.data.core.to_load.join(","),f.cookie_options));break;case "select_node":case "deselect_node":f.save_selected&&this.data.ui&&(this.save_selected(),a.cookie(f.save_selected,this.data.ui.to_select.join(","),f.cookie_options))}else if(f.save_loaded&&(this.save_loaded(),a.cookie(f.save_loaded,this.data.core.to_load.join(","),f.cookie_options)),f.save_opened&&(this.save_opened(),a.cookie(f.save_opened,this.data.core.to_open.join(","),f.cookie_options)),f.save_selected&&this.data.ui)this.save_selected(),
a.cookie(f.save_selected,this.data.ui.to_select.join(","),f.cookie_options)}}}})})(l);(function(a){a.jstree.plugin("sort",{__init:function(){this.get_container().bind("load_node.jstree",a.proxy(function(a,c){var d=this._get_node(c.rslt.obj),d=-1===d?this.get_container().children("ul"):d.children("ul");this.sort(d)},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 f=this._get_settings().sort,d=this;b.append(a.makeArray(b.children("li")).sort(a.proxy(f,d)));b.find("> li > ul").each(function(){d.sort(a(this))});this.clean_node(b)}}})})(l);(function(a){var b=!1,f=!1,d=!1,k=!1,m=!1,e=!1,l=!1,n=!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,e,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(d){}a.vakata.dnd.init_x=b.pageX;a.vakata.dnd.init_y=b.pageY;a.vakata.dnd.user_data=e;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),d=f.scrollTop(),f=f.scrollLeft();if(20>b.pageY-d){if(e&&"down"===l&&(clearInterval(e),e=!1),!e)l="up",e=setInterval(function(){a(document).scrollTop(a(document).scrollTop()-
a.vakata.dnd.scroll_spd)},150)}else e&&"up"===l&&(clearInterval(e),e=!1);if(20>a(window).height()-(b.pageY-d)){if(e&&"up"===l&&(clearInterval(e),e=!1),!e)l="down",e=setInterval(function(){a(document).scrollTop(a(document).scrollTop()+a.vakata.dnd.scroll_spd)},150)}else e&&"down"===l&&(clearInterval(e),e=!1);if(20>b.pageX-f){if(m&&"right"===n&&(clearInterval(m),m=!1),!m)n="left",m=setInterval(function(){a(document).scrollLeft(a(document).scrollLeft()-a.vakata.dnd.scroll_spd)},150)}else m&&"left"===
n&&(clearInterval(m),m=!1);if(20>a(window).width()-(b.pageX-f)){if(m&&"left"===n&&(clearInterval(m),m=!1),!m)n="right",m=setInterval(function(){a(document).scrollLeft(a(document).scrollLeft()+a.vakata.dnd.scroll_spd)},150)}else m&&"right"===n&&(clearInterval(m),m=!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){m&&clearInterval(m);
e&&clearInterval(e);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(e){if(a.vakata.dnd.is_drag&&a.vakata.dnd.user_data.jstree&&(this.data.themes&&(d.attr("class","jstree-"+this.data.themes.theme),k&&k.attr("class","jstree-"+this.data.themes.theme),a.vakata.dnd.helper.attr("class","jstree-dnd-helper jstree-"+this.data.themes.theme)),
e.currentTarget===e.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]!==e.target))e=a.jstree._reference(e.target),e.data.dnd.foreign?(e=e._get_settings().dnd.drag_check.call(this,{o:b,r:e.get_container(),is_root:!0}),(!0===e||!0===e.inside||!0===e.before||!0===e.after)&&a.vakata.dnd.helper.children("ins").attr("class","jstree-ok")):(e.prepare_move(b,e.get_container(),"last"),e.check_move()&&a.vakata.dnd.helper.children("ins").attr("class",
"jstree-ok"))},this)).bind("mouseup.jstree",a.proxy(function(e){if(a.vakata.dnd.is_drag&&a.vakata.dnd.user_data.jstree&&e.currentTarget===e.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]!==e.target){var f=a.jstree._reference(e.currentTarget);f.data.dnd.foreign?(e=f._get_settings().dnd.drag_check.call(this,{o:b,r:f.get_container(),is_root:!0}),(!0===e||!0===e.inside||!0===e.before||!0===e.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",e[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 e=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},e),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},e),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},e),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},e),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&&d&&k)&&(d.hide(),k.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&&((!f||!f.length||f.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;d&&d.hide();k&&k.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;d&&d.css({top:"-2000px"});k&&k.css({top:"-2000px"})},this)).bind("drag_start.vakata",a.proxy(function(b,e){if(e.data.jstree){var f=a(e.event.target);
f.closest(".jstree").hasClass("jstree-"+this.get_index())&&this.dnd_enter(f)}},this));var e=this._get_settings().dnd;e.drag_target&&a(document).delegate(e.drag_target,"mousedown.jstree-"+this.get_index(),a.proxy(function(e){b=e.target;a.vakata.dnd.drag_start(e,{jstree:!0,obj:e.target},"<ins class='jstree-icon'></ins>"+a(e.target).text());this.data.themes&&(d&&d.attr("class","jstree-"+this.data.themes.theme),k&&k.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 f=this.get_container();this.data.dnd.cof=f.offset();this.data.dnd.cw=parseInt(f.width(),10);this.data.dnd.ch=parseInt(f.height(),10);this.data.dnd.foreign=!0;e.preventDefault()},this));e.drop_target&&a(document).delegate(e.drop_target,"mouseenter.jstree-"+this.get_index(),a.proxy(function(e){this.data.dnd.active&&this._get_settings().dnd.drop_check.call(this,{o:b,r:a(e.target),e:e})&&a.vakata.dnd.helper.children("ins").attr("class",
"jstree-ok")},this)).delegate(e.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(e.drop_target,"mouseup.jstree-"+this.get_index(),a.proxy(function(e){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(e.target),e:e})},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(f&&f.length){this.data.dnd.off=f.offset();this._get_settings().core.rtl&&(this.data.dnd.off.right=this.data.dnd.off.left+f.width());if(this.data.dnd.foreign){var a=this._get_settings().dnd.drag_check.call(this,{o:b,r:f});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,f,"before");this.data.dnd.before=this.check_move();this.prepare_move(b,f,"after");this.data.dnd.after=this.check_move();this._is_loaded(f)?(this.prepare_move(b,f,"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"],e=!1,f=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"),e=f,!1},this));!1===e&&a.vakata.dnd.helper.children("ins").attr("class","jstree-invalid");b=f?this.data.dnd.off.right-18:this.data.dnd.off.left+10;switch(e){case "before":d.css({left:b+
"px",top:this.data.dnd.off.top-6+"px"}).show();k&&k.css({left:b+8+"px",top:this.data.dnd.off.top-1+"px"}).show();break;case "after":d.css({left:b+"px",top:this.data.dnd.off.top+this.data.core.li_height-6+"px"}).show();k&&k.css({left:b+8+"px",top:this.data.dnd.off.top+this.data.core.li_height-1+"px"}).show();break;case "inside":d.css({left:b+(f?-4:4)+"px",top:this.data.dnd.off.top+this.data.core.li_height/2-5+"px"}).show();k&&k.hide();break;default:d.hide(),k&&k.hide()}return r=e}},dnd_open:function(){this.data.dnd.to2=
!1;this.open_node(f,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:f,p:r}):(this.dnd_prepare(),this.move_node(b,f,r,a[this._get_settings().dnd.copy_modifier+"Key"]));f=b=!1;d.hide();k&&k.hide()},dnd_enter:function(b){this.data.dnd.mto&&(clearTimeout(this.data.dnd.mto),this.data.dnd.mto=!1);var e=this._get_settings().dnd;this.data.dnd.prepared=!1;
f=this._get_node(b);e.check_timeout?(this.data.dnd.to1&&clearTimeout(this.data.dnd.to1),this.data.dnd.to1=setTimeout(a.proxy(this.dnd_prepare,this),e.check_timeout)):this.dnd_prepare();e.open_timeout?(this.data.dnd.to2&&clearTimeout(this.data.dnd.to2),f&&(f.length&&f.hasClass("jstree-closed"))&&(this.data.dnd.to2=setTimeout(a.proxy(this.dnd_open,this),e.open_timeout))):f&&(f.length&&f.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");d.hide();k&&k.hide();if(f&&f[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(e,f){b=this._get_node(e);this.data.ui&&this.is_selected(b)&&(b=this._get_node(null,!0));var m=1<b.length?this._get_string("multiple_selection"):this.get_text(b),l=this.get_container();this._get_settings().core.html_titles||
(m=m.replace(/</ig,"&lt;").replace(/>/ig,"&gt;"));a.vakata.dnd.drag_start(f,{jstree:!0,obj:b},"<ins class='jstree-icon'></ins>"+m);this.data.themes&&(d&&d.attr("class","jstree-"+this.data.themes.theme),k&&k.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=l.offset();this.data.dnd.cw=parseInt(l.width(),10);this.data.dnd.ch=parseInt(l.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"});d=a("<div />").attr({id:"jstree-marker"}).hide().html("&raquo;").bind("mouseleave mouseenter",function(a){d.hide();k.hide();a.preventDefault();a.stopImmediatePropagation();return!1}).appendTo("body");k=a("<div />").attr({id:"jstree-marker-line"}).hide().bind("mouseup",function(a){if(f&&f.length)return f.children("a").trigger(a),a.preventDefault(),a.stopImmediatePropagation(),!1}).bind("mouseleave",function(b){var e=a(b.relatedTarget);if((e.is(".jstree")||0===e.closest(".jstree").length)&&
f&&f.length)return f.children("a").trigger(b),d.hide(),k.hide(),b.preventDefault(),b.stopImmediatePropagation(),!1}).appendTo("body");a(document).bind("drag_start.vakata",function(a,b){b.data.jstree&&(d.show(),k&&k.show())});a(document).bind("drag_stop.vakata",function(a,b){b.data.jstree&&(d.hide(),k&&k.hide())})})})(l);(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 f,d=this,k,m=this._get_settings().checkbox.two_state,e=this._get_settings().checkbox.real_checkboxes,l=this._get_settings().checkbox.real_checkboxes_names;b.each(function(){k=a(this);f=k.is("li")&&(k.hasClass("jstree-checked")||e&&k.children(":checked").length)?"jstree-checked":"jstree-unchecked";k.find("li").andSelf().each(function(){var b=
a(this),k;b.children("a"+(d.data.languages?"":":eq(0)")).not(":has(.jstree-checkbox)").prepend("<ins class='jstree-checkbox'>&#160;</ins>").parent().not(".jstree-checked, .jstree-unchecked").addClass(m?"jstree-unchecked":f);e&&(b.children(":checkbox").length?b.children(":checkbox").addClass("jstree-real-checkbox"):(k=l.call(d,b),b.prepend("<input type='checkbox' class='jstree-real-checkbox' id='"+k[0]+"' name='"+k[0]+"' value='"+k[1]+"' />")),"jstree-checked"===f&&b.children(":checkbox").attr("checked",
"checked"));"jstree-checked"===f&&!m&&b.find("li").addClass("jstree-checked")})});m||(1===b.length&&b.is("li")&&this._repair_state(b),b.is("li")?b.each(function(){d._repair_state(this)}):b.find("> ul > li").each(function(){d._repair_state(this)}),b.find(".jstree-checked").parent().parent().each(function(){d._repair_state(this)}))}},change_state:function(b,f){var b=this._get_node(b),d=!1,k=this._get_settings().checkbox.real_checkboxes;if(!b||-1===b)return!1;f=!1===f||!0===f?f:b.hasClass("jstree-checked");
if(this._get_settings().checkbox.two_state)f?(b.removeClass("jstree-checked").addClass("jstree-unchecked"),k&&b.children(":checkbox").removeAttr("checked")):(b.removeClass("jstree-unchecked").addClass("jstree-checked"),k&&b.children(":checkbox").attr("checked","checked"));else{if(f){d=b.find("li").andSelf();if(!d.filter(".jstree-checked, .jstree-undetermined").length)return!1;d.removeClass("jstree-checked jstree-undetermined").addClass("jstree-unchecked");k&&d.children(":checkbox").removeAttr("checked")}else{d=
b.find("li").andSelf();if(!d.filter(".jstree-unchecked, .jstree-undetermined").length)return!1;d.removeClass("jstree-unchecked jstree-undetermined").addClass("jstree-checked");k&&d.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(f){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"),
k&&b.parentsUntil(".jstree","li").andSelf().children(":checkbox").removeAttr("checked"),!1;b.removeClass("jstree-checked jstree-undetermined").addClass("jstree-unchecked");k&&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"),k&&b.parentsUntil(".jstree","li").andSelf().children(":checkbox").removeAttr("checked"),
!1;b.removeClass("jstree-unchecked jstree-undetermined").addClass("jstree-checked");k&&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,d=a.find("> ul > .jstree-checked").length,k=a.find("> ul > .jstree-undetermined").length,m=a.find("> ul > li").length;0===m?a.hasClass("jstree-undetermined")&&this.change_state(a,!1):0===d&&0===
k?this.change_state(a,!0):d===m?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,f=this.data.ui.to_select,f=a.map(a.makeArray(f),function(a){return"#"+a.toString().replace(/^#/,"").replace(/\\\//g,"/").replace(/\//g,"\\/").replace(/\\\./g,".").replace(/\./g,
"\\.").replace(/\:/g,"\\:")});this.deselect_all();a.each(f,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"})})})(l);(function(a){a.vakata.xslt=function(b,f,d){var e="",k;
if(document.recalc)return k=document.createElement("xml"),e=document.createElement("xml"),k.innerHTML=b,e.innerHTML=f,a("body").append(k).append(e),setTimeout(function(b,e,f){return function(){f.call(null,b.transformNode(e.XMLDocument));setTimeout(function(b,e){return function(){a(b).remove();a(e).remove()}}(b,e),200)}}(k,e,d),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){k=new XSLTProcessor;e=a.isFunction(k.transformDocument)?"undefined"!==typeof window.XMLSerializer:!0;if(!e)return!1;b=(new DOMParser).parseFromString(b,"text/xml");f=(new DOMParser).parseFromString(f,"text/xml");a.isFunction(k.transformDocument)?(e=document.implementation.createDocument("","",null),k.transformDocument(b,
f,e,null),d.call(null,(new XMLSerializer).serializeToString(e))):(k.importStylesheet(f),e=k.transformToFragment(b,document),d.call(null,a("<div />").append(e).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>'},
f=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 e=this;this.load_node_xml(a,function(){e.__callback({obj:e._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,d){var e=this.get_settings().xml_data,k=function(){},l=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 !e.data&&!e.ajax:throw"Neither data nor ajax settings supplied.";case a.isFunction(e.data):e.data.call(this,b,a.proxy(function(d){this.parse_xml(d,a.proxy(function(d){if(d){d=
d.replace(/ ?xmlns="[^"]*"/ig,"");if(d.length>10){d=a(d);if(b===-1||!b)this.get_container().children("ul").empty().append(d.children());else{b.children("a.jstree-loading").removeClass("jstree-loading");b.append(d);b.removeData("jstree-is-loading")}e.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(e.correct_state){this.correct_state(b);f&&f.call(this)}}else if(e.correct_state){this.get_container().children("ul").empty();
f&&f.call(this)}}},this))},this));break;case !!e.data&&!e.ajax||!!e.data&&!!e.ajax&&(!b||-1===b):(!b||-1==b)&&this.parse_xml(e.data,a.proxy(function(d){if(d){d=d.replace(/ ?xmlns="[^"]*"/ig,"");if(d.length>10){d=a(d);this.get_container().children("ul").empty().append(d.children());e.clean_node&&this.clean_node(b);f&&f.call(this)}}else if(e.correct_state){this.get_container().children("ul").empty();f&&f.call(this)}},this));break;case !e.data&&!!e.ajax||!!e.data&&!!e.ajax&&b&&-1!==b:k=function(a,c,
f){var k=this.get_settings().xml_data.ajax.error;k&&k.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"&&e.correct_state&&this.correct_state(b)}else c==="success"&&e.correct_state&&this.get_container().children("ul").empty();d&&d.call(this)},l=function(d,m,l){var d=l.responseText,n=this.get_settings().xml_data.ajax.success;n&&(d=n.call(this,d,m,l)||d);if(d===""||d&&d.toString&&d.toString().replace(/^[\s\n]+$/,
"")==="")return k.call(this,l,m,"");this.parse_xml(d,a.proxy(function(d){if(d){d=d.replace(/ ?xmlns="[^"]*"/ig,"");if(d.length>10){d=a(d);if(b===-1||!b)this.get_container().children("ul").empty().append(d.children());else{b.children("a.jstree-loading").removeClass("jstree-loading");b.append(d);b.removeData("jstree-is-loading")}e.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(e.correct_state){this.correct_state(b);
f&&f.call(this)}}else if(e.correct_state){this.get_container().children("ul").empty();f&&f.call(this)}}},this))},e.ajax.context=this,e.ajax.error=k,e.ajax.success=l,e.ajax.dataType||(e.ajax.dataType="xml"),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)),a.ajax(e.ajax)}},parse_xml:function(f,d){var k=this._get_settings().xml_data;a.vakata.xslt(f,b[k.xsl],d)},get_xml:function(b,d,k,e,l){var n="",r=this._get_settings(),
p=this,q,s,u,v,t;b||(b="flat");l||(l=0);d=this._get_node(d);if(!d||-1===d)d=this.get_container().find("> ul > li");k=a.isArray(k)?k:["id","class"];!l&&(this.data.types&&-1===a.inArray(r.types.type_attr,k))&&k.push(r.types.type_attr);e=a.isArray(e)?e:[];l||(r.xml_data.get_include_preamble&&(n+='<?xml version="1.0" encoding="UTF-8"?>'),n+="<root>");d.each(function(){n=n+"<item";u=a(this);a.each(k,function(a,b){var c=u.attr(b);if(!r.xml_data.get_skip_empty||typeof c!=="undefined")n=n+(" "+b+'="'+f((" "+
(c||"")).replace(/ jstree[^ ]*/ig,"").replace(/\s+$/ig," ").replace(/^ /,"").replace(/ $/,""))+'"')});u.hasClass("jstree-open")&&(n=n+' state="open"');u.hasClass("jstree-closed")&&(n=n+' state="closed"');b==="flat"&&(n=n+(' parent_id="'+f(l)+'"'));n=n+">";n=n+"<content>";v=u.children("a");v.each(function(){q=a(this);t=false;n=n+"<name";a.inArray("languages",r.plugins)!==-1&&a.each(r.languages,function(a,b){if(q.hasClass(b)){n=n+(' lang="'+f(b)+'"');t=b;return false}});e.length&&a.each(e,function(a,
b){var c=q.attr(b);if(!r.xml_data.get_skip_empty||typeof c!=="undefined")n=n+(" "+b+'="'+f((" "+c||"").replace(/ jstree[^ ]*/ig,"").replace(/\s+$/ig," ").replace(/^ /,"").replace(/ $/,""))+'"')});q.children("ins").get(0).className.replace(/jstree[^ ]*|$/ig,"").replace(/^\s+$/ig,"").length&&(n=n+(' icon="'+f(q.children("ins").get(0).className.replace(/jstree[^ ]*|$/ig,"").replace(/\s+$/ig," ").replace(/^ /,"").replace(/ $/,""))+'"'));q.children("ins").get(0).style.backgroundImage.length&&(n=n+(' icon="'+
f(q.children("ins").get(0).style.backgroundImage.replace("url(","").replace(")","").replace(/'/ig,"").replace(/"/ig,""))+'"'));n=n+">";n=n+("<![CDATA["+p.get_text(q,t)+"]]\>");n=n+"</name>"});n=n+"</content>";s=u[0].id||true;u=u.find("> ul > li");s=u.length?p.get_xml(b,u,k,e,s):"";b=="nest"&&(n=n+s);n=n+"</item>";b=="flat"&&(n=n+s)});l||(n+="</root>");return n}}})})(l);(function(a){a.expr[":"].jstree_contains=function(a,c,d){return 0<=(a.textContent||a.innerText||"").toLowerCase().indexOf(d[3].toLowerCase())};
a.expr[":"].jstree_title_contains=function(a,c,d){return 0<=(a.getAttribute("title")||"").toLowerCase().indexOf(d[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,f){a(this).children("ul").find("li").hide().removeClass("jstree-last");f.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,f){if(""===a.trim(b))this.clear_search();else{var d=this.get_settings().search,k=this,m=function(){};this.data.search.str=b;if(!f&&!1!==d.ajax&&0<this.get_container_ul().find("li.jstree-closed:not(:has(ul)):eq(0)").length){this.search.supress_callback=!0;m=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()};d.ajax.context=this;d.ajax.error=function(){};d.ajax.success=m;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));d.ajax.data||(d.ajax.data={search_string:b});if(!d.ajax.dataType||/^json/.exec(d.ajax.dataType))d.ajax.dataType="json";a.ajax(d.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():"")+":"+d.search_method+"("+this.data.search.str+")"),this.data.search.result.addClass("jstree-search").parent().parents(".jstree-closed").each(function(){k.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,f=!0,d=[],k=[];this.data.search.to_open.length&&
(a.each(this.data.search.to_open,function(b,e){if("#"==e)return!0;a(e).length&&a(e).is(".jstree-closed")?d.push(e):k.push(e)}),d.length&&(this.data.search.to_open=k,a.each(d,function(a,c){b.open_node(c,function(){b._search_open(!0)})}),f=!1));f&&this.search(this.data.search.str,!0)}}})})(l);(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,f,d,k,m,e,l){a.vakata.context.rtl=!!l;if(b=a.vakata.context.parse(b)){a.vakata.context.vis=
!0;a.vakata.context.tgt=f;a.vakata.context.par=e||f||null;a.vakata.context.data=m||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()});m=a.vakata.context.cnt.height();e=a.vakata.context.cnt.width();d+e>a(document).width()&&(d=a(document).width()-(e+5),a.vakata.context.cnt.find("li > ul").addClass("right"));k+m>a(document).height()&&(k-=m+f[0].offsetHeight,
a.vakata.context.cnt.find("li > ul").addClass("bottom"));a.vakata.context.cnt.css({left:d,top:k}).find("li:has(ul)").bind("mouseenter",function(){var b=a(document).width(),e=a(document).height(),f=a(this).children("ul").show();b!==a(document).width()&&f.toggleClass("right");e!==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,f){if(!b)return!1;var d="",k=!1,m=!0;f||(a.vakata.context.func={});d+="<ul>";a.each(b,function(b,f){if(!f)return true;a.vakata.context.func[b]=f.action;!m&&f.separator_before&&(d=d+"<li class='vakata-separator vakata-separator-before'></li>");m=false;d=d+("<li class='"+(f._class||"")+(f._disabled?" jstree-contextmenu-disabled ":"")+"'><ins ");f.icon&&f.icon.indexOf("/")===
-1&&(d=d+(" class='"+f.icon+"' "));f.icon&&f.icon.indexOf("/")!==-1&&(d=d+(" style='background:url("+f.icon+") center center no-repeat;' "));d=d+(">&#160;</ins><a href='#' rel='"+b+"'>");f.submenu&&(d=d+("<span style='float:"+(a.vakata.context.rtl?"left":"right")+";'>&raquo;</span>"));d=d+(f.label+"</a>");if(f.submenu)(k=a.vakata.context.parse(f.submenu,true))&&(d=d+k);d=d+"</li>";if(f.separator_after){d=d+"<li class='vakata-separator vakata-separator-after'></li>";m=true}});d=d.replace(/<li class\='vakata-separator vakata-separator-after'\><\/li\>$/,
"");d+="</ul>";a(document).triggerHandler("context_parse.vakata");return 10<d.length?d:!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 f=a.vakata.context.cnt.find("ul:visible").last().children(".vakata-hover").removeClass("vakata-hover").prevAll("li:not(.vakata-separator)").first();f.length||(f=a.vakata.context.cnt.find("ul:visible").last().children("li:not(.vakata-separator)").last());f.addClass("vakata-hover");b.stopImmediatePropagation();b.preventDefault()}}).bind("keydown","down",function(b){if(a.vakata.context.vis){var f=
a.vakata.context.cnt.find("ul:visible").last().children(".vakata-hover").removeClass("vakata-hover").nextAll("li:not(.vakata-separator)").first();f.length||(f=a.vakata.context.cnt.find("ul:visible").last().children("li:not(.vakata-separator)").first());f.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,f,d){var b=this._get_node(b),k=this.get_settings().contextmenu,m=b.children("a:visible:eq(0)"),e=!1,e=!1;k.select_node&&(this.data.ui&&!this.is_selected(b))&&(this.deselect_all(),this.select_node(b,
!0));if(k.show_at_node||"undefined"===typeof f||"undefined"===typeof d)e=m.offset(),f=e.left,d=e.top+this.data.core.li_height;e=b.data("jstree")&&b.data("jstree").contextmenu?b.data("jstree").contextmenu:k.items;a.isFunction(e)&&(e=e.call(this,b));this.data.contextmenu=!0;a.vakata.context.show(e,m,f,d,this,b,this._get_settings().core.rtl);this.data.themes&&a.vakata.context.cnt.attr("class","jstree-"+this.data.themes.theme+"-context")}}})})(l);(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 f=b.type_attr,d="",k=this;a.each(b.types,function(b,e){a.each(e,function(a){/^(max_depth|max_children|icon|valid_children)$/.test(a)||k.data.types.attach_to.push(a)});if(!e.icon)return!0;if(e.icon.image||e.icon.position)d="default"==b?d+(".jstree-"+k.get_index()+" a > .jstree-icon { "):d+(".jstree-"+k.get_index()+" li["+f+'="'+b+'"] > a > .jstree-icon { '),e.icon.image&&(d+=" background-image:url("+
e.icon.image+"); "),d=e.icon.position?d+(" background-position:"+e.icon.position+"; "):d+" background-position:0 0; ",d+="} "});""!==d&&a.vakata.css.add_sheet({str:d,title:"jstree-types"})},this)).bind("before.jstree",a.proxy(function(b,d){var k,m;if((k=(k=this._get_settings().types.use_data?this._get_node(d.args[0]):!1)&&-1!==k&&k.length?k.data("jstree"):!1)&&k.types&&!1===k.types[d.func])return b.stopImmediatePropagation(),!1;if(-1!==a.inArray(d.func,this.data.types.attach_to)&&d.args[0]&&(d.args[0].tagName||
d.args[0].jquery))if(k=this._get_settings().types.types,m=this._get_type(d.args[0]),(k[m]&&"undefined"!==typeof k[m][d.func]||k["default"]&&"undefined"!==typeof k["default"][d.func])&&!1===this._check(d.func,d.args[0]))return b.stopImmediatePropagation(),!1},this));d&&this.get_container().bind("load_node.jstree set_type.jstree",a.proxy(function(b,d){var k=d&&d.rslt&&d.rslt.obj&&-1!==d.rslt.obj?this._get_node(d.rslt.obj).parent():this.get_container_ul(),m=!1,e=this._get_settings().types;a.each(e.types,
function(a,b){if(b.icon&&(b.icon.image||b.icon.position))m="default"===a?k.find("li > a > .jstree-icon"):k.find("li["+e.type_attr+"='"+a+"'] > a > .jstree-icon"),b.icon.image&&m.css("backgroundImage","url("+b.icon.image+")"),m.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),d=!c.length||!a?!1:c.attr(this._get_settings().types.type_attr,a);d&&this.__callback({obj:c,type:a});return d},_check:function(b,f,d){var f=this._get_node(f),k=!1,m=this._get_type(f),e=0,l=this,n=this._get_settings().types,r=!1;if(-1===f)if(n[b])k=n[b];else return;else{if(!1===m)return;(r=n.use_data?f.data("jstree"):
!1)&&r.types&&"undefined"!==typeof r.types[b]?k=r.types[b]:n.types[m]&&"undefined"!==typeof n.types[m][b]?k=n.types[m][b]:n.types["default"]&&"undefined"!==typeof n.types["default"][b]&&(k=n.types["default"][b])}a.isFunction(k)&&(k=k.call(this,f));"max_depth"===b&&(-1!==f&&!1!==d&&-2!==n.max_depth&&0!==k)&&f.children("a:eq(0)").parentsUntil(".jstree","li").each(function(a){if(-1!==n.max_depth&&0>=n.max_depth-(a+1))return k=0,!1;e=0===a?k:l._check(b,this,!1);if(-1!==e&&0>=e-(a+1))return k=0,!1;if(0<=
e&&(e-(a+1)<k||0>k))k=e-(a+1);if(0<=n.max_depth&&(n.max_depth-(a+1)<k||0>k))k=n.max_depth-(a+1)});return k},check_move:function(){if(!this.__call_old())return!1;var b=this._get_move(),f=b.rt._get_settings().types,d=b.rt._check("max_children",b.cr),k=b.rt._check("max_depth",b.cr),m=b.rt._check("valid_children",b.cr),e=0,l=1;if("none"===m||a.isArray(m)&&(b.ot&&b.ot._get_type)&&(b.o.each(function(){if(-1===a.inArray(b.ot._get_type(this),m))return l=!1}),!1===l)||-2!==f.max_children&&-1!==d&&(e=-1===
b.cr?this.get_container().find("> ul > li").not(b.o).length:b.cr.find("> ul > li").not(b.o).length,e+b.o.length>d))return!1;if(-2!==f.max_depth&&-1!==k){l=0;if(0===k)return!1;if("undefined"===typeof b.o.d){for(f=b.o;0<f.length;)f=f.find("> ul > li"),l++;b.o.d=l}if(0>k-b.o.d)return!1}return!0},create_node:function(b,f,d,k,m,e){if(!e&&(m||this._is_loaded(b))){var l="string"==typeof f&&f.match(/^before|after$/i)&&-1!==b?this._get_parent(b):this._get_node(b),n=this._get_settings().types,r=this._check("max_children",
l),p=this._check("max_depth",l),q=this._check("valid_children",l);"string"===typeof d&&(d={data:d});d||(d={});if("none"===q)return!1;if(a.isArray(q))if(!d.attr||!d.attr[n.type_attr])d.attr||(d.attr={}),d.attr[n.type_attr]=q[0];else if(-1===a.inArray(d.attr[n.type_attr],q))return!1;if(-2!==n.max_children&&-1!==r&&(l=-1===l?this.get_container().find("> ul > li").length:l.find("> ul > li").length,l+1>r)||-2!==n.max_depth&&-1!==p&&0>p-1)return!1}return this.__call_old(!0,b,f,d,k,m,e)}}})})(l);(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,d){var k=this;this.load_node_html(a,function(){k.__callback({obj:k._get_node(a)});c.call(this)},d)},_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,f,d){var k,m=this.get_settings().html_data,e=function(){};k=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(m.data):m.data.call(this,b,a.proxy(function(e){if(e&&e!==""&&e.toString&&e.toString().replace(/^[\s\n]+$/,"")!==""){e=a(e);e.is("ul")||(e=a("<ul />").append(e));
if(b==-1||!b)this.get_container().children("ul").empty().append(e.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(e).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);f&&f.call(this)}else if(b&&b!==-1){b.children("a.jstree-loading").removeClass("jstree-loading");b.removeData("jstree-is-loading");if(m.correct_state){this.correct_state(b);f&&f.call(this)}}else if(m.correct_state){this.get_container().children("ul").empty();f&&f.call(this)}},
this));break;case !m.data&&!m.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();f&&f.call(this);break;case !!m.data&&!m.ajax||!!m.data&&!!m.ajax&&(!b||-1===b):if(!b||
-1==b)k=a(m.data),k.is("ul")||(k=a("<ul />").append(k)),this.get_container().children("ul").empty().append(k.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();f&&f.call(this);break;case !m.data&&!!m.ajax||!!m.data&&!!m.ajax&&b&&-1!==b:b=this._get_node(b),e=function(a,
c,e){var f=this.get_settings().html_data.ajax.error;f&&f.call(this,a,c,e);if(b!=-1&&b.length){b.children("a.jstree-loading").removeClass("jstree-loading");b.removeData("jstree-is-loading");c==="success"&&m.correct_state&&this.correct_state(b)}else c==="success"&&m.correct_state&&this.get_container().children("ul").empty();d&&d.call(this)},k=function(d,k,g){var j=this.get_settings().html_data.ajax.success;j&&(d=j.call(this,d,k,g)||d);if(d===""||d&&d.toString&&d.toString().replace(/^[\s\n]+$/,"")===
"")return e.call(this,g,k,"");if(d){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);f&&f.call(this)}else if(b&&b!==-1){b.children("a.jstree-loading").removeClass("jstree-loading");b.removeData("jstree-is-loading");if(m.correct_state){this.correct_state(b);f&&f.call(this)}}else if(m.correct_state){this.get_container().children("ul").empty();
f&&f.call(this)}},m.ajax.context=this,m.ajax.error=e,m.ajax.success=k,m.ajax.dataType||(m.ajax.dataType="html"),a.isFunction(m.ajax.url)&&(m.ajax.url=m.ajax.url.call(this,b)),a.isFunction(m.ajax.data)&&(m.ajax.data=m.ajax.data.call(this,b)),a.ajax(m.ajax)}}}});a.jstree.defaults.plugins.push("html_data")})(l);(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(f){a(f.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,f=["ui-icon"];a.each(b,function(a,b){b=b.split(" ");b.length&&(f=f.concat(b))});this.get_container().removeClass("ui-widget-content").find("."+f.join(", .")).removeClass(f.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"})})})(l);(function(a){a.jstree.plugin("unique",{__init:function(){this.get_container().bind("before.jstree",a.proxy(function(b,f){var d=[],k=!0,m;"move_node"==f.func&&(!0===f.args[4]&&f.args[0].o&&f.args[0].o.length)&&(f.args[0].o.children("a").each(function(){d.push(a(this).text().replace(/^\s+/g,
""))}),k=this._check_unique(d,f.args[0].np.find("> ul > li").not(f.args[0].o),"move_node"));if("create_node"==f.func&&(f.args[4]||this._is_loaded(f.args[0]))){k=this._get_node(f.args[0]);if(f.args[1]&&("before"===f.args[1]||"after"===f.args[1]))if(k=this._get_parent(f.args[0]),!k||-1===k)k=this.get_container();"string"===typeof f.args[2]?d.push(f.args[2]):!f.args[2]||!f.args[2].data?d.push(this._get_string("new_node")):d.push(f.args[2].data);k=this._check_unique(d,k.find("> ul > li"),"create_node")}if("rename_node"==
f.func){d.push(f.args[1]);m=this._get_node(f.args[0]);k=this._get_parent(m);if(!k||-1===k)k=this.get_container();k=this._check_unique(d,k.find("> ul > li").not(m),"rename_node")}if(!k)return b.stopPropagation(),!1},this))},defaults:{error_callback:a.noop},_fn:{_check_unique:function(b,f,d){var k=[];f.children("a").each(function(){k.push(a(this).text().replace(/^\s+/g,""))});if(!k.length||!b.length)return!0;k=k.sort().join(",,").replace(/(,|^)([^,]+)(,,\2)+(,|$)/g,"$1$2$4").replace(/,,+/g,",").replace(/,$/,
"").split(",");return k.length+b.length!=k.concat(b).sort().join(",,").replace(/(,|^)([^,]+)(,,\2)+(,|$)/g,"$1$2$4").replace(/,,+/g,",").replace(/,$/,"").split(",").length?(this._get_settings().unique.error_callback.call(null,b,f,d),!1):!0},check_move:function(){if(!this.__call_old())return!1;var b=this._get_move(),f=[];return b.o&&b.o.length?(b.o.children("a").each(function(){f.push(a(this).text().replace(/^\s+/g,""))}),this._check_unique(f,b.np.find("> ul > li").not(b.o),"check_move")):!0}}})})(l);
(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,f){f.rslt.obj.each(function(){f.inst.get_container().find(" > .jstree-wholerow li:visible:eq("+
parseInt((c(this).offset().top-f.inst.get_container().offset().top+f.inst.get_container()[0].scrollTop)/f.inst.data.core.li_height,10)+")").children("a").attr("class",f.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 f=c(a.currentTarget);"A"===a.target.tagName||"INS"===a.target.tagName&&f.closest("li").is(".jstree-open, .jstree-closed")||(f.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||d)&&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; }";
k&&(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||d)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"})})})(l);(function(a){var b=
["getChildren","getChildrenCount","getAttr","getName","getProps"],f=function(b,f){var d=!0,b=b||{},f=[].concat(f);a.each(f,function(e,f){if(!a.isFunction(b[f]))return d=!1});return d};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(d,k){var m=-1==d?this._get_settings().model.object:d.data("jstree_model");if(!f(m,b))return k.call(null,!1);this._get_settings().model.async?m.getChildren(a.proxy(function(a){this.model_done(a,
k)},this)):this.model_done(m.getChildren(),k)}},defaults:{object:!1,id_prefix:!1,async:!1},_fn:{model_done:function(b,f){var d=[],e=this._get_settings(),k=this;a.isArray(b)||(b=[b]);a.each(b,function(b,f){var g=f.getProps()||{};g.attr=f.getAttr()||{};f.getChildrenCount()&&(g.state="closed");g.data=f.getName();a.isArray(g.data)||(g.data=[g.data]);k.data.types&&a.isFunction(f.getType)&&(g.attr[e.types.type_attr]=f.getType());g.attr.id&&e.model.id_prefix&&(g.attr.id=e.model.id_prefix+g.attr.id);g.metadata||
(g.metadata={});g.metadata.jstree_model=f;d.push(g)});f.call(null,d)}}})})(l)}})()});define("jqgrid",["jquery","jqgrid-locale-"+(window&&window.__DEPS__&&window.__DEPS__.lang||"en"),"jqueryui"],function(l){(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(d){var c=a.makeArray(arguments).slice(1);void 0===d&&(d="");return d.replace(/\{(\d+)\}/g,function(a,f){return c[f]})},getCellIndex:function(d){d=a(d);if(d.is("tr"))return-1;d=(!d.is("td")&&!d.is("th")?d.closest("td,th"):d)[0];return a.browser.msie?a.inArray(d,d.parentNode.cells):d.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(d){"while(1);"==d.substr(0,9)&&(d=d.substr(9));"/*"==d.substr(0,2)&&(d=d.substr(2,d.length-4));d||(d="{}");return!0===a.jgrid.useJSON&&"object"===typeof ga&&"function"===typeof ga.parse?ga.parse(d):
eval("("+d+")")},parseDate:function(d,c){var b={m:1,d:1,y:1970,h:0,i:0,s:0},f,g,j;f=/[\\\/:_;.,\t\T\s-]/;if(c&&null!==c&&void 0!==c){var c=a.trim(c),c=c.split(f),d=d.split(f),m=a.jgrid.formatter.date.monthNames,e=a.jgrid.formatter.date.AmPm,l=function(a,b){0===a?12==b&&(b=0):12!=b&&(b+=12);return b};f=0;for(g=d.length;f<g;f++)"M"==d[f]&&(j=a.inArray(c[f],m),-1!==j&&12>j&&(c[f]=j+1)),"F"==d[f]&&(j=a.inArray(c[f],m),-1!==j&&11<j&&(c[f]=j+1-12)),"a"==d[f]&&(j=a.inArray(c[f],e),-1!==j&&(2>j&&c[f]==e[j])&&
(c[f]=j,b.h=l(c[f],b.h))),"A"==d[f]&&(j=a.inArray(c[f],e),-1!==j&&(1<j&&c[f]==e[j])&&(c[f]=j-2,b.h=l(c[f],b.h))),void 0!==c[f]&&(b[d[f].toLowerCase()]=parseInt(c[f],10));b.m=parseInt(b.m,10)-1;f=b.y;70<=f&&99>=f?b.y=1900+b.y:0<=f&&69>=f&&(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(d){return(d?d:a.jgrid.uidPref)+a.jgrid.guid++},getAccessor:function(a,c){var b,f,d=[],j;if("function"===typeof c)return c(a);
b=a[c];if(void 0===b)try{if("string"===typeof c&&(d=c.split(".")),j=d.length)for(b=a;b&&j--;)f=d.shift(),b=b[f]}catch(m){}return b},ajaxOptions:{},from:function(d){return new function(c,b){"string"==typeof c&&(c=a.data(c));var f=this,d=c,k=!0,m=!1,e=b,l=/[\$,%]/g,n=null,r=null,p=!1,q="",s=[],u=!0;if("object"==typeof c&&c.push)0<c.length&&(u="object"!=typeof c[0]?!1:!0);else throw"data provides is not an array";this._hasData=function(){return null===d?!1:0===d.length?!1:!0};this._getStr=function(a){var b=
[];m&&b.push("jQuery.trim(");b.push("String("+a+")");m&&b.push(")");k||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){m&&(b=a.trim(b));k||(b=b.toLowerCase());return b.toString().replace(/\\/g,"\\\\").replace(/\"/g,'\\"')};this._funcLoop=function(b){var c=[];a.each(d,function(a,e){c.push(b(e))});return c};this._append=function(a){e=null===
e?"":e+(""===q?" && ":q);p&&(e+="!");e+="("+a+")";p=!1;q=""};this._setCommand=function(a,b){n=a;r=b};this._resetNegate=function(){p=!1};this._repeatCommand=function(a,b){return null===n?f:null!==a&&null!==b?n(a,b):null===r||!u?n(a):n(r,a)};this._equals=function(a,b){return 0===f._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;!k&&("number"!==typeof a&&
"number"!==typeof b)&&(a=(""+a).toLowerCase(),b=(""+b).toLowerCase());return a<b?-c:a>b?c:0};this._performSort=function(){0!==s.length&&(d=f._doSort(d,0))};this._doSort=function(a,b){var c=s[b].by,e=s[b].dir,d=s[b].type,k=s[b].datefmt;if(b==s.length-1)return f._getOrder(a,c,e,d,k);b++;c=f._getGroup(a,c,e,d,k);e=[];for(d=0;d<c.length;d++)for(var k=f._doSort(c[d].items,b),g=0;g<k.length;g++)e.push(k[g]);return e};this._getOrder=function(b,c,e,d,k){var g=[],j=[],m="a"==e?1:-1,n,p;void 0===d&&(d="text");
p="float"==d||"number"==d||"currency"==d||"numeric"==d?function(a){a=parseFloat((""+a).replace(l,""));return isNaN(a)?0:a}:"int"==d||"integer"==d?function(a){return a?parseFloat((""+a).replace(l,"")):0}:"date"==d||"datetime"==d?function(b){return a.jgrid.parseDate(k,b).getTime()}:a.isFunction(d)?d:function(b){b||(b="");return a.trim((""+b).toUpperCase())};a.each(b,function(b,e){n=""!==c?a.jgrid.getAccessor(e,c):e;void 0===n&&(n="");n=p(n,e);j.push({vSort:n,index:b})});j.sort(function(a,b){a=a.vSort;
b=b.vSort;return f._compare(a,b,m)});for(var d=0,r=b.length;d<r;)e=j[d].index,g.push(b[e]),d++;return g};this._getGroup=function(b,c,e,d,k){var g=[],j=null,m=null,l;a.each(f._getOrder(b,c,e,d,k),function(b,e){l=a.jgrid.getAccessor(e,c);void 0===l&&(l="");f._equals(m,l)||(m=l,null!==j&&g.push(j),j=f._group(c,l));j.items.push(e)});null!==j&&g.push(j);return g};this.ignoreCase=function(){k=!1;return f};this.useCase=function(){k=!0;return f};this.trim=function(){m=!0;return f};this.noTrim=function(){m=
!1;return f};this.execute=function(){var b=e,c=[];if(null===b)return f;a.each(d,function(){eval(b)&&c.push(this)});d=c;return f};this.data=function(){return d};this.select=function(b){f._performSort();if(!f._hasData())return[];f.execute();if(a.isFunction(b)){var c=[];a.each(d,function(a,e){c.push(b(e))});return c}return d};this.hasMatch=function(){if(!f._hasData())return!1;f.execute();return 0<d.length};this.andNot=function(a,b,c){p=!p;return f.and(a,b,c)};this.orNot=function(a,b,c){p=!p;return f.or(a,
b,c)};this.not=function(a,b,c){return f.andNot(a,b,c)};this.and=function(a,b,c){q=" && ";return void 0===a?f:f._repeatCommand(a,b,c)};this.or=function(a,b,c){q=" || ";return void 0===a?f:f._repeatCommand(a,b,c)};this.isNot=function(a){p=!p;return f.is(a)};this.is=function(a){f._append("this."+a);f._resetNegate();return f};this._compareValues=function(b,c,e,d,k){var g;g=u?"jQuery.jgrid.getAccessor(this,'"+c+"')":"this";void 0===e&&(e=null);var j=e,m=void 0===k.stype?"text":k.stype;if(null!==e)switch(m){case "int":case "integer":j=
isNaN(Number(j))||""===j?"0":j;g="parseInt("+g+",10)";j="parseInt("+j+",10)";break;case "float":case "number":case "numeric":j=(""+j).replace(l,"");j=isNaN(Number(j))||""===j?"0":j;g="parseFloat("+g+")";j="parseFloat("+j+")";break;case "date":case "datetime":j=""+a.jgrid.parseDate(k.newfmt||"Y-m-d",j).getTime();g='jQuery.jgrid.parseDate("'+k.srcfmt+'",'+g+").getTime()";break;default:g=f._getStr(g),j=f._getStr('"'+f._toStr(j)+'"')}f._append(g+" "+d+" "+j);f._setCommand(b,c);f._resetNegate();return f};
this.equals=function(a,b,c){return f._compareValues(f.equals,a,b,"==",c)};this.notEquals=function(a,b,c){return f._compareValues(f.equals,a,b,"!==",c)};this.isNull=function(a,b,c){return f._compareValues(f.equals,a,null,"===",c)};this.greater=function(a,b,c){return f._compareValues(f.greater,a,b,">",c)};this.less=function(a,b,c){return f._compareValues(f.less,a,b,"<",c)};this.greaterOrEquals=function(a,b,c){return f._compareValues(f.greaterOrEquals,a,b,">=",c)};this.lessOrEquals=function(a,b,c){return f._compareValues(f.lessOrEquals,
a,b,"<=",c)};this.startsWith=function(b,c){var e=void 0===c||null===c?b:c,e=m?a.trim(e.toString()).length:e.toString().length;u?f._append(f._getStr("jQuery.jgrid.getAccessor(this,'"+b+"')")+".substr(0,"+e+") == "+f._getStr('"'+f._toStr(c)+'"')):(e=m?a.trim(c.toString()).length:c.toString().length,f._append(f._getStr("this")+".substr(0,"+e+") == "+f._getStr('"'+f._toStr(b)+'"')));f._setCommand(f.startsWith,b);f._resetNegate();return f};this.endsWith=function(b,c){var e=void 0===c||null===c?b:c,e=m?
a.trim(e.toString()).length:e.toString().length;u?f._append(f._getStr("jQuery.jgrid.getAccessor(this,'"+b+"')")+".substr("+f._getStr("jQuery.jgrid.getAccessor(this,'"+b+"')")+".length-"+e+","+e+') == "'+f._toStr(c)+'"'):f._append(f._getStr("this")+".substr("+f._getStr("this")+'.length-"'+f._toStr(b)+'".length,"'+f._toStr(b)+'".length) == "'+f._toStr(b)+'"');f._setCommand(f.endsWith,b);f._resetNegate();return f};this.contains=function(a,b){u?f._append(f._getStr("jQuery.jgrid.getAccessor(this,'"+a+
"')")+'.indexOf("'+f._toStr(b)+'",0) > -1'):f._append(f._getStr("this")+'.indexOf("'+f._toStr(a)+'",0) > -1');f._setCommand(f.contains,a);f._resetNegate();return f};this.groupBy=function(a,b,c,e){return!f._hasData()?null:f._getGroup(d,a,b,c,e)};this.orderBy=function(b,c,e,d){c=void 0===c||null===c?"a":a.trim(c.toString().toLowerCase());if(null===e||void 0===e)e="text";if(null===d||void 0===d)d="Y-m-d";if("desc"==c||"descending"==c)c="d";if("asc"==c||"ascending"==c)c="a";s.push({by:b,dir:c,type:e,
datefmt:d});return f};return f}(d,null)},extend:function(d){a.extend(a.fn.jqGrid,d);this.no_legacy_api||a.fn.extend(d)}});a.fn.jqGrid=function(d){if("string"==typeof d){var c=a.jgrid.getAccessor(a.fn.jqGrid,d);if(!c)throw"jqGrid - No such method: "+d;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,d||{}),c={headers:[],cols:[],footers:[],dragStart:function(c,e,d){this.resizing={idx:c,startX:e.clientX,sOL:d[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:d[0],top:d[1],height:d[2]});a.isFunction(b.resizeStart)&&b.resizeStart.call(this,e,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],e="ltr"===b.direction?a.width+c:a.width-c,d;33<e&&(this.curGbox.css({left:this.resizing.sOL+c}),!0===b.forceFit?(d=this.headers[this.resizing.idx+b.nv],c="ltr"===b.direction?d.width-c:d.width+c,33<c&&(a.newWidth=e,d.newWidth=c)):(this.newWidth="ltr"===b.direction?
b.tblwidth+c:b.tblwidth-c,a.newWidth=e))}},dragEnd:function(){this.hDiv.style.cursor="default";if(this.resizing){var c=this.resizing.idx,e=this.headers[c].newWidth||this.headers[c].width,e=parseInt(e,10);this.resizing=!1;a("#rs_m"+a.jgrid.jqID(b.id)).css("display","none");b.colModel[c].width=e;this.headers[c].width=e;this.headers[c].el.style.width=e+"px";this.cols[c].style.width=e+"px";0<this.footers.length&&(this.footers[c].style.width=e+"px");!0===b.forceFit?(e=this.headers[c+b.nv].newWidth||this.headers[c+
b.nv].width,this.headers[c+b.nv].width=e,this.headers[c+b.nv].el.style.width=e+"px",this.cols[c+b.nv].style.width=e+"px",0<this.footers.length&&(this.footers[c+b.nv].style.width=e+"px"),b.colModel[c+b.nv].width=e):(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,e,c)}this.curGbox=null;document.onselectstart=function(){return!0}},populateVisible:function(){c.timer&&clearTimeout(c.timer);c.timer=null;var e=a(c.bDiv).height();if(e){var d=a("table:first",c.bDiv),k,j;if(d[0].rows.length)try{j=(k=d[0].rows[1])?a(k).outerHeight()||c.prevRowHeight:c.prevRowHeight}catch(m){j=c.prevRowHeight}if(j){c.prevRowHeight=j;var l=b.rowNum;k=c.scrollTop=c.bDiv.scrollTop;var n=Math.round(d.position().top)-k,o=n+d.height();j*=
l;var p,r,q;if(o<e&&0>=n&&(void 0===b.lastpage||parseInt((o+k+j-1)/j,10)<=b.lastpage))r=parseInt((e-o+j-1)/j,10),0<=o||2>r||!0===b.scroll?(p=Math.round((o+k)/j)+1,n=-1):n=1;0<n&&(p=parseInt(k/j,10)+1,r=parseInt((k+e)/j,10)+2-p,q=!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,q&&(c.selectionPreserver(d[0]),c.emptyRows(c.bDiv,!1,!1)),c.populate(r))}}},scrollGrid:function(a){if(b.scroll){var e=
c.bDiv.scrollTop;void 0===c.scrollTop&&(c.scrollTop=0);e!=c.scrollTop&&(c.scrollTop=e,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,e=c.selrow,f=c.selarrrow?a.makeArray(c.selarrrow):null,d=b.grid.bDiv.scrollLeft,k=c.gridComplete;c.gridComplete=function(){c.selrow=null;c.selarrrow=[];if(c.multiselect&&f&&0<f.length)for(var g=
0;g<f.length;g++)f[g]!=e&&a(b).jqGrid("setSelection",f[g],!1);e&&a(b).jqGrid("setSelection",e,!1);b.grid.bDiv.scrollLeft=d;c.gridComplete=k;c.gridComplete&&k()}}};if("TABLE"!=this.tagName)alert("Element is not a table");else{a(this).empty().attr("tabindex","1");this.p=b;var j,m,e;if(0===this.p.colNames.length)for(j=0;j<this.p.colModel.length;j++)this.p.colNames[j]=this.p.colModel[j].label||this.p.colModel[j].name;if(this.p.colNames.length!==this.p.colModel.length)alert(a.jgrid.errors.model);else{var l=
a("<div class='ui-jqgrid-view'></div>"),n,r=a.browser.msie?!0:!1,p=a.browser.webkit||a.browser.safari?!0:!1;e=this;e.p.direction=a.trim(e.p.direction.toLowerCase());-1==a.inArray(e.p.direction,["ltr","rtl"])&&(e.p.direction="ltr");m=e.p.direction;a(l).insertBefore(this);a(this).appendTo(l).removeClass("scroll");var q=a("<div class='ui-jqgrid ui-widget ui-widget-content ui-corner-all'></div>");a(q).insertBefore(l).attr({id:"gbox_"+this.id,dir:m});a(l).appendTo(q).attr("id","gview_"+this.id);n=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(n).insertBefore(l);a("<div class='loading ui-state-default ui-state-active' id='load_"+this.id+"'>"+this.p.loadtext+"</div>").insertBefore(l);a(this).attr({cellspacing:"0",cellpadding:"0",border:"0",role:"grid","aria-multiselectable":!!this.p.multiselect,"aria-labelledby":"gbox_"+
this.id});var s=function(a,b){a=parseInt(a,10);return isNaN(a)?b?b:0:a},u=function(b,f,d,k,j,m){var l=e.p.colModel[b],n=l.align,o='style="',p=l.classes,r=l.name,q=[];n&&(o=o+("text-align:"+n+";"));l.hidden===true&&(o=o+"display:none;");if(f===0)o=o+("width: "+c.headers[b].width+"px;");else if(l.cellattr&&a.isFunction(l.cellattr)&&(b=l.cellattr.call(e,j,d,k,l,m))&&typeof b==="string"){b=b.replace(/style/i,"style").replace(/title/i,"title");if(b.indexOf("title")>-1)l.title=false;b.indexOf("class")>
-1&&(p=void 0);q=b.split("style");if(q.length===2){q[1]=a.trim(q[1].replace("=",""));if(q[1].indexOf("'")===0||q[1].indexOf('"')===0)q[1]=q[1].substring(1);o=o+q[1].replace(/'/gi,'"')}else o=o+'"'}if(!q.length){q[0]="";o=o+'"'}o=o+((p!==void 0?' class="'+p+'"':"")+(l.title&&d?' title="'+a.jgrid.stripHtml(d)+'"':""));o=o+(' aria-describedby="'+e.p.id+"_"+r+'"');return o+q[0]},v=function(b){return b===void 0||b===null||b===""?"&#160;":e.p.autoencode?a.jgrid.htmlEncode(b):b+""},t=function(b,c,f,d,k){var g=
e.p.colModel[f];if(typeof g.formatter!=="undefined"){b={rowId:b,colModel:g,gid:e.p.id,pos:f};c=a.isFunction(g.formatter)?g.formatter.call(e,c,b,d,k):a.fmatter?a.fn.fmatter(g.formatter,c,b,d,k):v(c)}else c=v(c);return c},x=function(a,b,c,e,f){b=t(a,b,c,f,"add");return'<td role="gridcell" '+u(c,e,b,f,a,true)+">"+b+"</td>"},y=function(a,b,c){var f='<input role="checkbox" type="checkbox" id="jqg_'+e.p.id+"_"+a+'" class="cbox" name="jqg_'+e.p.id+"_"+a+'"/>';return'<td role="gridcell" '+u(b,c,"",null,a,
true)+">"+f+"</td>"},z=function(a,b,c,e){c=(parseInt(c,10)-1)*parseInt(e,10)+1+b;return'<td role="gridcell" class="ui-state-default jqgrid-rownum" '+u(a,b,c,null,b,true)+">"+c+"</td>"},E=function(a){var b,c=[],f=0,d;for(d=0;d<e.p.colModel.length;d++){b=e.p.colModel[d];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},A=function(b){var c=e.p.remapColumns;if(!c||!c.length)c=a.map(e.p.colModel,function(a,b){return b});
b&&(c=a.map(c,function(a){return a<b?null:a-b}));return c},C=function(b,c,f){if(e.p.deepempty)a("#"+a.jgrid.jqID(e.p.id)+" tbody:first tr:gt(0)").remove();else{var d=a("#"+a.jgrid.jqID(e.p.id)+" tbody:first tr:first")[0];a("#"+a.jgrid.jqID(e.p.id)+" tbody:first").empty().append(d)}if(c&&e.p.scroll){a(">div:first",b).css({height:"auto"}).children("div:first").css({height:0,display:"none"});b.scrollTop=0}if(f===true&&e.p.treeGrid===true){e.p.data=[];e.p._index={}}},J=function(){var b=e.p.data.length,
c,f,d;c=e.p.rownumbers===true?1:0;f=e.p.multiselect===true?1:0;d=e.p.subGrid===true?1:0;c=e.p.keyIndex===false||e.p.loadonce===true?e.p.localReader.id:e.p.colModel[e.p.keyIndex+f+d+c].name;for(f=0;f<b;f++){d=a.jgrid.getAccessor(e.p.data[f],c);e.p._index[d]=f}},S=function(b,c,f,d,k){var g=new Date,j=e.p.datatype!="local"&&e.p.loadonce||e.p.datatype=="xmlstring",m=e.p.datatype=="local"?"local":"xml";if(j){e.p.data=[];e.p._index={};e.p.localReader.id="_id_"}e.p.reccount=0;if(a.isXMLDoc(b)){if(e.p.treeANode===
-1&&!e.p.scroll){C(c,false,true);f=1}else f=f>1?f:1;var l,n,o=0,p,r=0,q=0,s=0,t,u=[],v,J={},F,D,B=[],X=e.p.altRows===true?" "+e.p.altclass:"";e.p.xmlReader.repeatitems||(u=E(m));t=e.p.keyIndex===false?e.p.xmlReader.id:e.p.keyIndex;if(u.length>0&&!isNaN(t)){e.p.remapColumns&&e.p.remapColumns.length&&(t=a.inArray(t,e.p.remapColumns));t=u[t]}m=(t+"").indexOf("[")===-1?u.length?function(b,c){return a(t,b).text()||c}:function(b,c){return a(e.p.xmlReader.cell,b).eq(t).text()||c}:function(a,b){return a.getAttribute(t.replace(/[\[\]]/g,
""))||b};e.p.userData={};a(e.p.xmlReader.page,b).each(function(){e.p.page=this.textContent||this.text||0});a(e.p.xmlReader.total,b).each(function(){e.p.lastpage=this.textContent||this.text;if(e.p.lastpage===void 0)e.p.lastpage=1});a(e.p.xmlReader.records,b).each(function(){e.p.records=this.textContent||this.text||0});a(e.p.xmlReader.userdata,b).each(function(){e.p.userData[this.getAttribute("name")]=this.textContent||this.text});(b=a(e.p.xmlReader.root+" "+e.p.xmlReader.row,b))||(b=[]);var G=b.length,
I=0,S={},Q;if(b&&G){Q=parseInt(e.p.rowNum,10);var H=e.p.scroll?a.jgrid.randId():1;k&&(Q=Q*(k+1));var k=a.isFunction(e.p.afterInsertRow),P="";for(e.p.grouping&&e.p.groupingView.groupCollapse===true&&(P=' style="display:none;"');I<G;){F=b[I];D=m(F,H+I);l=f===0?0:f+1;l=(l+I)%2==1?X:"";B.push("<tr"+P+' id="'+D+'" tabindex="-1" role="row" class ="ui-widget-content jqgrow ui-row-'+e.p.direction+""+l+'">');if(e.p.rownumbers===true){B.push(z(0,I,e.p.page,e.p.rowNum));s=1}if(e.p.multiselect===true){B.push(y(D,
s,I));r=1}if(e.p.subGrid===true){B.push(a(e).jqGrid("addSubGridCell",r+s,I+f));q=1}if(e.p.xmlReader.repeatitems){v||(v=A(r+q+s));var da=a(e.p.xmlReader.cell,F);a.each(v,function(a){var b=da[this];if(!b)return false;p=b.textContent||b.text;J[e.p.colModel[a+r+q+s].name]=p;B.push(x(D,p,a+r+q+s,I+f,F))})}else for(l=0;l<u.length;l++){p=a(u[l],F).text();J[e.p.colModel[l+r+q+s].name]=p;B.push(x(D,p,l+r+q+s,I+f,F))}B.push("</tr>");if(e.p.grouping){l=e.p.groupingView.groupField.length;for(var O=[],R=0;R<l;R++)O.push(J[e.p.groupingView.groupField[R]]);
S=a(e).jqGrid("groupingPrepare",B,O,S,J);B=[]}if(j||e.p.treeGrid===true){J._id_=D;e.p.data.push(J);e.p._index[D]=e.p.data.length-1}if(e.p.gridview===false){a("tbody:first",c).append(B.join(""));k&&e.p.afterInsertRow.call(e,D,J,F);B=[]}J={};o++;I++;if(o==Q)break}}if(e.p.gridview===true){n=e.p.treeANode>-1?e.p.treeANode:0;if(e.p.grouping){a(e).jqGrid("groupingRender",S,e.p.colModel.length);S=null}else e.p.treeGrid===true&&n>0?a(e.rows[n]).after(B.join("")):a("tbody:first",c).append(B.join(""))}if(e.p.subGrid===
true)try{a(e).jqGrid("addSubGrid",r+s)}catch(N){}e.p.totaltime=new Date-g;if(o>0&&e.p.records===0)e.p.records=G;B=null;if(e.p.treeGrid===true)try{a(e).jqGrid("setTreeNode",n+1,o+n+1)}catch(T){}if(!e.p.treeGrid&&!e.p.scroll)e.grid.bDiv.scrollTop=0;e.p.reccount=o;e.p.treeANode=-1;e.p.userDataOnFooter&&a(e).jqGrid("footerData","set",e.p.userData,true);if(j){e.p.records=G;e.p.lastpage=Math.ceil(G/Q)}d||e.updatepager(false,true);if(j)for(;o<G;){F=b[o];D=m(F,o);if(e.p.xmlReader.repeatitems){v||(v=A(r+q+
s));var V=a(e.p.xmlReader.cell,F);a.each(v,function(a){var b=V[this];if(!b)return false;p=b.textContent||b.text;J[e.p.colModel[a+r+q+s].name]=p})}else for(l=0;l<u.length;l++){p=a(u[l],F).text();J[e.p.colModel[l+r+q+s].name]=p}J._id_=D;e.p.data.push(J);e.p._index[D]=e.p.data.length-1;J={};o++}}},F=function(b,c,f,d,k){var g=new Date;if(b){if(e.p.treeANode===-1&&!e.p.scroll){C(c,false,true);f=1}else f=f>1?f:1;var j,m=e.p.datatype!="local"&&e.p.loadonce||e.p.datatype=="jsonstring";if(m){e.p.data=[];e.p._index=
{};e.p.localReader.id="_id_"}e.p.reccount=0;if(e.p.datatype=="local"){c=e.p.localReader;j="local"}else{c=e.p.jsonReader;j="json"}var l=0,n,o,p=[],r,q=0,s=0,t=0,u,v,J={},F,D,B=[],X=e.p.altRows===true?" "+e.p.altclass:"";e.p.page=a.jgrid.getAccessor(b,c.page)||0;u=a.jgrid.getAccessor(b,c.total);e.p.lastpage=u===void 0?1:u;e.p.records=a.jgrid.getAccessor(b,c.records)||0;e.p.userData=a.jgrid.getAccessor(b,c.userdata)||{};c.repeatitems||(r=p=E(j));j=e.p.keyIndex===false?c.id:e.p.keyIndex;if(p.length>0&&
!isNaN(j)){e.p.remapColumns&&e.p.remapColumns.length&&(j=a.inArray(j,e.p.remapColumns));j=p[j]}(v=a.jgrid.getAccessor(b,c.root))||(v=[]);u=v.length;var b=0,I=parseInt(e.p.rowNum,10),G=e.p.scroll?a.jgrid.randId():1;k&&(I=I*(k+1));var Q=a.isFunction(e.p.afterInsertRow),S={},H="";for(e.p.grouping&&e.p.groupingView.groupCollapse===true&&(H=' style="display:none;"');b<u;){k=v[b];D=a.jgrid.getAccessor(k,j);if(D===void 0){D=G+b;p.length===0&&c.cell&&(D=a.jgrid.getAccessor(k,c.cell)[j]||D)}n=f===1?0:f;n=
(n+b)%2==1?X:"";B.push("<tr"+H+' id="'+D+'" tabindex="-1" role="row" class= "ui-widget-content jqgrow ui-row-'+e.p.direction+""+n+'">');if(e.p.rownumbers===true){B.push(z(0,b,e.p.page,e.p.rowNum));t=1}if(e.p.multiselect){B.push(y(D,t,b));q=1}if(e.p.subGrid){B.push(a(e).jqGrid("addSubGridCell",q+t,b+f));s=1}if(c.repeatitems){c.cell&&(k=a.jgrid.getAccessor(k,c.cell));r||(r=A(q+s+t))}for(o=0;o<r.length;o++){n=a.jgrid.getAccessor(k,r[o]);B.push(x(D,n,o+q+s+t,b+f,k));J[e.p.colModel[o+q+s+t].name]=n}B.push("</tr>");
if(e.p.grouping){n=e.p.groupingView.groupField.length;o=[];for(var P=0;P<n;P++)o.push(J[e.p.groupingView.groupField[P]]);S=a(e).jqGrid("groupingPrepare",B,o,S,J);B=[]}if(m||e.p.treeGrid===true){J._id_=D;e.p.data.push(J);e.p._index[D]=e.p.data.length-1}if(e.p.gridview===false){a("#"+a.jgrid.jqID(e.p.id)+" tbody:first").append(B.join(""));Q&&e.p.afterInsertRow.call(e,D,J,k);B=[]}J={};l++;b++;if(l==I)break}if(e.p.gridview===true){F=e.p.treeANode>-1?e.p.treeANode:0;e.p.grouping?a(e).jqGrid("groupingRender",
S,e.p.colModel.length):e.p.treeGrid===true&&F>0?a(e.rows[F]).after(B.join("")):a("#"+a.jgrid.jqID(e.p.id)+" tbody:first").append(B.join(""))}if(e.p.subGrid===true)try{a(e).jqGrid("addSubGrid",q+t)}catch(da){}e.p.totaltime=new Date-g;if(l>0&&e.p.records===0)e.p.records=u;if(e.p.treeGrid===true)try{a(e).jqGrid("setTreeNode",F+1,l+F+1)}catch(O){}if(!e.p.treeGrid&&!e.p.scroll)e.grid.bDiv.scrollTop=0;e.p.reccount=l;e.p.treeANode=-1;e.p.userDataOnFooter&&a(e).jqGrid("footerData","set",e.p.userData,true);
if(m){e.p.records=u;e.p.lastpage=Math.ceil(u/I)}d||e.updatepager(false,true);if(m)for(;l<u&&v[l];){k=v[l];D=a.jgrid.getAccessor(k,j);if(D===void 0){D=G+l;p.length===0&&c.cell&&(D=a.jgrid.getAccessor(k,c.cell)[j]||D)}if(k){if(c.repeatitems){c.cell&&(k=a.jgrid.getAccessor(k,c.cell));r||(r=A(q+s+t))}for(o=0;o<r.length;o++){n=a.jgrid.getAccessor(k,r[o]);J[e.p.colModel[o+q+s+t].name]=n}J._id_=D;e.p.data.push(J);e.p._index[D]=e.p.data.length-1;J={}}l++}}},B=function(){function b(c){var e=0,f,k,g;if(c.groups!==
void 0)for(f=0;f<c.groups.length;f++){try{b(c.groups[f])}catch(j){alert(j)}e++}if(c.rules!==void 0){if(e>0){var m=p.select();p=a.jgrid.from(m)}try{for(f=0;f<c.rules.length;f++){g=c.rules[f];k=c.groupOp.toString().toUpperCase();if(o[g.op]&&g.field){e>0&&(k&&k==="OR")&&(p=p.or());p=o[g.op](p,k)(g.field,g.data,d[g.field])}e++}}catch(l){alert(l)}}}var c,f=false,d={},k=[],g=[],j,m,l;if(a.isArray(e.p.data)){var n=e.p.grouping?e.p.groupingView:false;a.each(e.p.colModel,function(){m=this.sorttype||"text";
if(m=="date"||m=="datetime"){if(this.formatter&&typeof this.formatter==="string"&&this.formatter=="date"){j=this.formatoptions&&this.formatoptions.srcformat?this.formatoptions.srcformat:a.jgrid.formatter.date.srcformat;l=this.formatoptions&&this.formatoptions.newformat?this.formatoptions.newformat:a.jgrid.formatter.date.newformat}else j=l=this.datefmt||"Y-m-d";d[this.name]={stype:m,srcfmt:j,newfmt:l}}else d[this.name]={stype:m,srcfmt:"",newfmt:""};if(e.p.grouping&&this.name==n.groupField[0]){var b=
this.name;if(typeof this.index!="undefined")b=this.index;k[0]=d[b];g.push(b)}if(!f&&(this.index==e.p.sortname||this.name==e.p.sortname)){c=this.name;f=true}});if(e.p.treeGrid)a(e).jqGrid("SortTree",c,e.p.sortorder,d[c].stype,d[c].srcfmt);else{var o={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(e.p.data);
e.p.ignoreCase&&(p=p.ignoreCase());if(e.p.search===true){var r=e.p.postData.filters;if(r){typeof r=="string"&&(r=a.jgrid.parse(r));b(r)}else try{p=o[e.p.postData.searchOper](p)(e.p.postData.searchField,e.p.postData.searchString,d[e.p.postData.searchField])}catch(q){}}if(e.p.grouping){p.orderBy(g,n.groupOrder[0],k[0].stype,k[0].srcfmt);n.groupDataSorted=true}c&&(e.p.sortorder&&f)&&(e.p.sortorder.toUpperCase()=="DESC"?p.orderBy(e.p.sortname,"d",d[c].stype,d[c].srcfmt):p.orderBy(e.p.sortname,"a",d[c].stype,
d[c].srcfmt));var r=p.select(),s=parseInt(e.p.rowNum,10),t=r.length,u=parseInt(e.p.page,10),x=Math.ceil(t/s),v={},r=r.slice((u-1)*s,u*s),d=p=null;v[e.p.localReader.total]=x;v[e.p.localReader.page]=u;v[e.p.localReader.records]=t;v[e.p.localReader.root]=r;r=null;return v}}},O=function(){e.grid.hDiv.loading=true;if(!e.p.hiddengrid)switch(e.p.loadui){case "enable":a("#load_"+a.jgrid.jqID(e.p.id)).show();break;case "block":a("#lui_"+a.jgrid.jqID(e.p.id)).show();a("#load_"+a.jgrid.jqID(e.p.id)).show()}},
Y=function(){e.grid.hDiv.loading=false;switch(e.p.loadui){case "enable":a("#load_"+a.jgrid.jqID(e.p.id)).hide();break;case "block":a("#lui_"+a.jgrid.jqID(e.p.id)).hide();a("#load_"+a.jgrid.jqID(e.p.id)).hide()}},R=function(b){if(!e.grid.hDiv.loading){var c=e.p.scroll&&b===false,f={},d,k=e.p.prmNames;if(e.p.page<=0)e.p.page=1;if(k.search!==null)f[k.search]=e.p.search;k.nd!==null&&(f[k.nd]=(new Date).getTime());if(k.rows!==null)f[k.rows]=e.p.rowNum;if(k.page!==null)f[k.page]=e.p.page;if(k.sort!==null)f[k.sort]=
e.p.sortname;if(k.order!==null)f[k.order]=e.p.sortorder;if(e.p.rowTotal!==null&&k.totalrows!==null)f[k.totalrows]=e.p.rowTotal;var g=e.p.loadComplete,j=a.isFunction(g);j||(g=null);var m=0,b=b||1;if(b>1)if(k.npage!==null){f[k.npage]=b;m=b-1;b=1}else g=function(a){e.p.page++;e.grid.hDiv.loading=false;j&&e.p.loadComplete.call(e,a);R(b-1)};else k.npage!==null&&delete e.p.postData[k.npage];if(e.p.grouping){a(e).jqGrid("groupingSetup");e.p.groupingView.groupDataSorted===true&&(f[k.sort]=e.p.groupingView.groupField[0]+
" "+e.p.groupingView.groupOrder[0]+", "+f[k.sort])}a.extend(e.p.postData,f);var l=!e.p.scroll?1:e.rows.length-1;if(a.isFunction(e.p.datatype))e.p.datatype.call(e,e.p.postData,"load_"+e.p.id);else{a.isFunction(e.p.beforeRequest)&&e.p.beforeRequest.call(e);d=e.p.datatype.toLowerCase();switch(d){case "json":case "jsonp":case "xml":case "script":a.ajax(a.extend({url:e.p.url,type:e.p.mtype,dataType:d,data:a.isFunction(e.p.serializeGridData)?e.p.serializeGridData.call(e,e.p.postData):e.p.postData,success:function(a){d===
"xml"?S(a,e.grid.bDiv,l,b>1,m):F(a,e.grid.bDiv,l,b>1,m);g&&g.call(e,a);c&&e.grid.populateVisible();if(e.p.loadonce||e.p.treeGrid)e.p.datatype="local";Y()},error:function(b,c,f){a.isFunction(e.p.loadError)&&e.p.loadError.call(e,b,c,f);Y()},beforeSend:function(b){O();a.isFunction(e.p.loadBeforeSend)&&e.p.loadBeforeSend.call(e,b)}},a.jgrid.ajaxOptions,e.p.ajaxGridOptions));break;case "xmlstring":O();f=a.jgrid.stringToDoc(e.p.datastr);S(f,e.grid.bDiv);j&&e.p.loadComplete.call(e,f);e.p.datatype="local";
e.p.datastr=null;Y();break;case "jsonstring":O();f=typeof e.p.datastr=="string"?a.jgrid.parse(e.p.datastr):e.p.datastr;F(f,e.grid.bDiv);j&&e.p.loadComplete.call(e,f);e.p.datatype="local";e.p.datastr=null;Y();break;case "local":case "clientside":O();e.p.datatype="local";f=B();F(f,e.grid.bDiv,l,b>1,m);g&&g.call(e,f);c&&e.grid.populateVisible();Y()}}}};n=function(b,c){var f="",d="<table cellspacing='0' cellpadding='0' border='0' style='table-layout:auto;' class='ui-pg-table'><tbody><tr>",k="",g,j,l,
n,o=function(b){var c;a.isFunction(e.p.onPaging)&&(c=e.p.onPaging.call(e,b));e.p.selrow=null;if(e.p.multiselect){e.p.selarrrow=[];a("#cb_"+a.jgrid.jqID(e.p.id),e.grid.hDiv).attr("checked",false)}e.p.savedRow=[];return c=="stop"?false:true},b=b.substr(1);g="pg_"+b;j=b+"_left";l=b+"_center";n=b+"_right";a("#"+a.jgrid.jqID(b)).append("<div id='"+g+"' 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='"+
j+"' align='left'></td><td id='"+l+"' align='center' style='white-space:pre;'></td><td id='"+n+"' align='right'></td></tr></tbody></table></div>").attr("dir","ltr");if(e.p.rowList.length>0){k="<td dir='"+m+"'>";k=k+"<select class='ui-pg-selbox' role='listbox'>";for(j=0;j<e.p.rowList.length;j++)k=k+('<option role="option" value="'+e.p.rowList[j]+'"'+(e.p.rowNum==e.p.rowList[j]?' selected="selected"':"")+">"+e.p.rowList[j]+"</option>");k=k+"</select></td>"}m=="rtl"&&(d=d+k);e.p.pginput===true&&(f="<td dir='"+
m+"'>"+a.jgrid.format(e.p.pgtext||"","<input class='ui-pg-input' type='text' size='2' maxlength='7' value='0' role='textbox'/>","<span id='sp_1'></span>")+"</td>");if(e.p.pgbuttons===true){j=["first"+c,"prev"+c,"next"+c,"last"+c];m=="rtl"&&j.reverse();d=d+("<td id='"+j[0]+"' class='ui-pg-button ui-corner-all'><span class='ui-icon ui-icon-seek-first'></span></td>");d=d+("<td id='"+j[1]+"' class='ui-pg-button ui-corner-all'><span class='ui-icon ui-icon-seek-prev'></span></td>");d=d+(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='"+j[2]+"' class='ui-pg-button ui-corner-all'><span class='ui-icon ui-icon-seek-next'></span></td>");d=d+("<td id='"+j[3]+"' class='ui-pg-button ui-corner-all'><span class='ui-icon ui-icon-seek-end'></span></td>")}else f!==""&&(d=d+f);m=="ltr"&&(d=d+k);d=d+"</tr></tbody></table>";e.p.viewrecords===true&&a("td#"+b+"_"+e.p.recordpos,"#"+g).append("<div dir='"+m+"' style='text-align:"+
e.p.recordpos+"' class='ui-paging-info'></div>");a("td#"+b+"_"+e.p.pagerpos,"#"+g).append(d);k=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:"+k+";visibility:hidden;' ></div>");d=a(d).clone().appendTo("#testpg").width();a("#testpg").remove();if(d>0){f!==""&&(d=d+50);a("td#"+b+"_"+e.p.pagerpos,"#"+g).width(d)}e.p._nvtd=[];e.p._nvtd[0]=d?Math.floor((e.p.width-d)/2):Math.floor(e.p.width/3);e.p._nvtd[1]=
0;d=null;a(".ui-pg-selbox","#"+g).bind("change",function(){e.p.page=Math.round(e.p.rowNum*(e.p.page-1)/this.value-0.5)+1;e.p.rowNum=this.value;c?a(".ui-pg-selbox",e.p.pager).val(this.value):e.p.toppager&&a(".ui-pg-selbox",e.p.toppager).val(this.value);if(!o("records"))return false;R();return false});if(e.p.pgbuttons===true){a(".ui-pg-button","#"+g).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=s(e.p.page,1),b=s(e.p.lastpage,1),f=false,d=true,k=true,g=true,j=true;if(b===0||b===1)j=g=k=d=false;else if(b>1&&a>=1)a===1?k=d=false:a>1&&a<b||a===b&&(j=g=false);else if(b>1&&a===0){j=g=false;a=b-1}if(this.id==="first"+c&&d){e.p.page=1;f=true}if(this.id==="prev"+c&&k){e.p.page=a-1;f=true}if(this.id===
"next"+c&&g){e.p.page=a+1;f=true}if(this.id==="last"+c&&j){e.p.page=b;f=true}if(f){if(!o(this.id))return false;R()}return false})}e.p.pginput===true&&a("input.ui-pg-input","#"+g).keypress(function(b){if((b.charCode?b.charCode:b.keyCode?b.keyCode:0)==13){e.p.page=a(this).val()>0?a(this).val():e.p.page;if(!o("user"))return false;R();return false}return this})};var V=function(b,c,f,d){if(e.p.colModel[c].sortable&&!(e.p.savedRow.length>0)){if(!f){if(e.p.lastsort==c)if(e.p.sortorder=="asc")e.p.sortorder=
"desc";else{if(e.p.sortorder=="desc")e.p.sortorder="asc"}else e.p.sortorder=e.p.colModel[c].firstsortorder||"asc";e.p.page=1}if(d){if(e.p.lastsort==c&&e.p.sortorder==d&&!f)return;e.p.sortorder=d}f=a("thead:first",e.grid.hDiv).get(0);a("tr th:eq("+e.p.lastsort+") span.ui-grid-ico-sort",f).addClass("ui-state-disabled");a("tr th:eq("+e.p.lastsort+")",f).attr("aria-selected","false");a("tr th:eq("+c+") span.ui-icon-"+e.p.sortorder,f).removeClass("ui-state-disabled");a("tr th:eq("+c+")",f).attr("aria-selected",
"true");if(!e.p.viewsortcols[0]&&e.p.lastsort!=c){a("tr th:eq("+e.p.lastsort+") span.s-ico",f).hide();a("tr th:eq("+c+") span.s-ico",f).show()}b=b.substring(5);e.p.sortname=e.p.colModel[c].index||b;f=e.p.sortorder;if(a.isFunction(e.p.onSortCol)&&e.p.onSortCol.call(e,b,c,f)=="stop")e.p.lastsort=c;else{if(e.p.datatype=="local")e.p.deselectAfterSort&&a(e).jqGrid("resetSelection");else{e.p.selrow=null;e.p.multiselect&&a("#cb_"+a.jgrid.jqID(e.p.id),e.grid.hDiv).attr("checked",false);e.p.selarrrow=[];e.p.savedRow=
[]}if(e.p.scroll){f=e.grid.bDiv.scrollLeft;C(e.grid.bDiv,true,false);e.grid.hDiv.scrollLeft=f}e.p.subGrid&&e.p.datatype=="local"&&a("td.sgexpanded","#"+a.jgrid.jqID(e.p.id)).each(function(){a(this).trigger("click")});R();e.p.lastsort=c;if(e.p.sortname!=b&&c)e.p.lastsort=c}}},G=function(b){var c,f={},d=p?0:e.p.cellLayout;for(c=f[0]=f[1]=f[2]=0;c<=b;c++)e.p.colModel[c].hidden===false&&(f[0]=f[0]+(e.p.colModel[c].width+d));e.p.direction=="rtl"&&(f[0]=e.p.width-f[0]);f[0]=f[0]-e.grid.bDiv.scrollLeft;
a(e.grid.cDiv).is(":visible")&&(f[1]=f[1]+(a(e.grid.cDiv).height()+parseInt(a(e.grid.cDiv).css("padding-top"),10)+parseInt(a(e.grid.cDiv).css("padding-bottom"),10)));if(e.p.toolbar[0]===true&&(e.p.toolbar[1]=="top"||e.p.toolbar[1]=="both"))f[1]=f[1]+(a(e.grid.uDiv).height()+parseInt(a(e.grid.uDiv).css("border-top-width"),10)+parseInt(a(e.grid.uDiv).css("border-bottom-width"),10));e.p.toppager&&(f[1]=f[1]+(a(e.grid.topDiv).height()+parseInt(a(e.grid.topDiv).css("border-bottom-width"),10)));f[2]=f[2]+
(a(e.grid.bDiv).height()+a(e.grid.hDiv).height());return f};this.p.id=this.id;-1==a.inArray(e.p.multikey,["shiftKey","altKey","ctrlKey"])&&(e.p.multikey=!1);e.p.keyIndex=!1;for(j=0;j<e.p.colModel.length;j++)e.p.colModel[j]=a.extend(!0,{},e.p.cmTemplate,e.p.colModel[j].template||{},e.p.colModel[j]),!1===e.p.keyIndex&&!0===e.p.colModel[j].key&&(e.p.keyIndex=j);e.p.sortorder=e.p.sortorder.toLowerCase();!0===e.p.grouping&&(e.p.scroll=!1,e.p.rownumbers=!1,e.p.subGrid=!1,e.p.treeGrid=!1,e.p.gridview=!0);
if(!0===this.p.treeGrid){try{a(this).jqGrid("setTreeGrid")}catch(N){}"local"!=e.p.datatype&&(e.p.localReader={id:"_id_"})}if(this.p.subGrid)try{a(e).jqGrid("setSubGrid")}catch(H){}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?e.p.multiselectWidth+e.p.cellLayout:e.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:e.p.rownumWidth,sortable:!1,resizable:!1,hidedlg:!0,search:!1,align:"center",fixed:!0}));e.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"}},e.p.xmlReader);e.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"}},e.p.jsonReader);e.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"}},e.p.localReader);e.p.scroll&&(e.p.pgbuttons=!1,e.p.pginput=!1,e.p.rowList=[]);e.p.data.length&&J();var T="<thead><tr class='ui-jqgrid-labels' role='rowheader'>",Z,X,da,la,Q,I,P,D;X=D="";if(!0===e.p.shrinkToFit&&!0===e.p.forceFit)for(j=e.p.colModel.length-
1;0<=j;j--)if(!e.p.colModel[j].hidden){e.p.colModel[j].resizable=!1;break}"horizontal"==e.p.viewsortcols[1]&&(D=" ui-i-asc",X=" ui-i-desc");Z=r?"class='ui-th-div-ie'":"";D="<span class='s-ico' style='display:none'><span sort='asc' class='ui-grid-ico-sort ui-icon-asc"+D+" ui-state-disabled ui-icon ui-icon-triangle-1-n ui-sort-"+m+"'></span>"+("<span sort='desc' class='ui-grid-ico-sort ui-icon-desc"+X+" ui-state-disabled ui-icon ui-icon-triangle-1-s ui-sort-"+m+"'></span></span>");for(j=0;j<this.p.colNames.length;j++)X=
e.p.headertitles?' title="'+a.jgrid.stripHtml(e.p.colNames[j])+'"':"",T+="<th id='"+e.p.id+"_"+e.p.colModel[j].name+"' role='columnheader' class='ui-state-default ui-th-column ui-th-"+m+"'"+X+">",X=e.p.colModel[j].index||e.p.colModel[j].name,T+="<div id='jqgh_"+e.p.colModel[j].name+"' "+Z+">"+e.p.colNames[j],e.p.colModel[j].width=e.p.colModel[j].width?parseInt(e.p.colModel[j].width,10):150,"boolean"!==typeof e.p.colModel[j].title&&(e.p.colModel[j].title=!0),X==e.p.sortname&&(e.p.lastsort=j),T+=D+
"</div></th>";D=null;a(this).append(T+"</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 Qa=[],Ha;a("#cb_"+a.jgrid.jqID(e.p.id),this).bind("click",function(){e.p.selarrrow=[];if(this.checked){a(e.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(e.p.id)+"_"+a.jgrid.jqID(this.id)).attr("checked",
"checked");a(this).addClass("ui-state-highlight").attr("aria-selected","true");e.p.selarrrow.push(this.id);e.p.selrow=this.id}});Ha=true;Qa=[]}else{a(e.rows).each(function(b){if(b>0&&!a(this).hasClass("subgrid")&&!a(this).hasClass("ui-state-disabled")){a("#jqg_"+a.jgrid.jqID(e.p.id)+"_"+a.jgrid.jqID(this.id)).removeAttr("checked");a(this).removeClass("ui-state-highlight").attr("aria-selected","false");Qa.push(this.id)}});e.p.selrow=null;Ha=false}a.isFunction(e.p.onSelectAll)&&e.p.onSelectAll.call(e,
Ha?e.p.selarrrow:Qa,Ha)})}!0===e.p.autowidth&&(T=a(q).innerWidth(),e.p.width=0<T?T:"nw");(function(){var b=0,f=p?0:e.p.cellLayout,d=0,k,j=e.p.scrollOffset,m,l=false,n,o=0,r=0,q;a.each(e.p.colModel,function(){if(typeof this.hidden==="undefined")this.hidden=false;this.widthOrg=m=s(this.width,0);if(this.hidden===false){b=b+(m+f);this.fixed?o=o+(m+f):d++;r++}});isNaN(e.p.width)?e.p.width=c.width=b:c.width=e.p.width;e.p.tblwidth=b;if(e.p.shrinkToFit===false&&e.p.forceFit===true)e.p.forceFit=false;if(e.p.shrinkToFit===
true&&d>0){n=c.width-f*d-o;if(!isNaN(e.p.height)){n=n-j;l=true}b=0;a.each(e.p.colModel,function(a){if(this.hidden===false&&!this.fixed){this.width=m=Math.round(n*this.width/(e.p.tblwidth-f*d-o));b=b+m;k=a}});q=0;l?c.width-o-(b+f*d)!==j&&(q=c.width-o-(b+f*d)-j):!l&&Math.abs(c.width-o-(b+f*d))!==1&&(q=c.width-o-(b+f*d));e.p.colModel[k].width=e.p.colModel[k].width+q;e.p.tblwidth=b+q+f*d+o;if(e.p.tblwidth>e.p.width){e.p.colModel[k].width=e.p.colModel[k].width-(e.p.tblwidth-parseInt(e.p.width,10));e.p.tblwidth=
e.p.width}}})();a(q).css("width",c.width+"px").append("<div class='ui-jqgrid-resize-mark' id='rs_m"+e.p.id+"'>&#160;</div>");a(l).css("width",c.width+"px");var T=a("thead:first",e).get(0),ea="";e.p.footerrow&&(ea+="<table role='grid' style='width:"+e.p.tblwidth+"px' class='ui-jqgrid-ftable' cellspacing='0' cellpadding='0' border='0'><tbody><tr role='row' class='ui-widget-content footrow footrow-"+m+"'>");var l=a("tr:first",T),xa="<tr class='jqgfirstrow' role='row' style='height:auto'>";e.p.disableClick=
!1;a("th",l).each(function(b){da=e.p.colModel[b].width;if(typeof e.p.colModel[b].resizable==="undefined")e.p.colModel[b].resizable=true;if(e.p.colModel[b].resizable){la=document.createElement("span");a(la).html("&#160;").addClass("ui-jqgrid-resize ui-jqgrid-resize-"+m);a.browser.opera||a(la).css("cursor","col-resize");a(this).addClass(e.p.resizeclass)}else la="";a(this).css("width",da+"px").prepend(la);var f="";if(e.p.colModel[b].hidden){a(this).css("display","none");f="display:none;"}xa=xa+("<td role='gridcell' style='height:0px;width:"+
da+"px;"+f+"'></td>");c.headers[b]={width:da,el:this};Q=e.p.colModel[b].sortable;if(typeof Q!=="boolean")Q=e.p.colModel[b].sortable=true;f=e.p.colModel[b].name;f=="cb"||f=="subgrid"||f=="rn"||e.p.viewsortcols[2]&&a("div",this).addClass("ui-jqgrid-sortable");if(Q)if(e.p.viewsortcols[0]){a("div span.s-ico",this).show();b==e.p.lastsort&&a("div span.ui-icon-"+e.p.sortorder,this).removeClass("ui-state-disabled")}else if(b==e.p.lastsort){a("div span.s-ico",this).show();a("div span.ui-icon-"+e.p.sortorder,
this).removeClass("ui-state-disabled")}e.p.footerrow&&(ea=ea+("<td role='gridcell' "+u(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(e.p.forceFit===true){var d=e.p,k=f,j;for(j=f+1;j<e.p.colModel.length;j++)if(e.p.colModel[j].hidden!==true){k=j;break}d.nv=k-f}c.dragStart(f,b,G(f));return false}}).click(function(b){if(e.p.disableClick)return e.p.disableClick=false;var c="th>div.ui-jqgrid-sortable",
f,d;e.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(!e.p.viewsortcols[2]){f=true;d=b.attr("sort")}V(a("div",this)[0].id,c,f,d);return false}});if(e.p.sortable&&a.fn.sortable)try{a(e).jqGrid("sortableColumns",l)}catch(Ga){}e.p.footerrow&&(ea+="</tr></tbody></table>");xa+="</tr>";this.appendChild(document.createElement("tbody"));a(this).addClass("ui-jqgrid-btable").append(xa);var xa=null,l=a("<table class='ui-jqgrid-htable' style='width:"+
e.p.tblwidth+"px' role='grid' aria-labelledby='gbox_"+this.id+"' cellspacing='0' cellpadding='0' border='0'></table>").append(T),ia=e.p.caption&&!0===e.p.hiddengrid?!0:!1;j=a("<div class='ui-jqgrid-hbox"+("rtl"==m?"-rtl":"")+"'></div>");T=null;c.hDiv=document.createElement("div");a(c.hDiv).css({width:c.width+"px"}).addClass("ui-state-default ui-jqgrid-hdiv").append(j);a(j).append(l);l=null;ia&&a(c.hDiv).hide();e.p.pager&&("string"==typeof e.p.pager?"#"!=e.p.pager.substr(0,1)&&(e.p.pager="#"+e.p.pager):
e.p.pager="#"+a(e.p.pager).attr("id"),a(e.p.pager).css({width:c.width+"px"}).appendTo(q).addClass("ui-state-default ui-jqgrid-pager ui-corner-bottom"),ia&&a(e.p.pager).hide(),n(e.p.pager,""));!1===e.p.cellEdit&&!0===e.p.hoverrows&&a(e).bind("mouseover",function(b){P=a(b.target).closest("tr.jqgrow");a(P).attr("class")!=="subgrid"&&a(P).addClass("ui-state-hover");return false}).bind("mouseout",function(b){P=a(b.target).closest("tr.jqgrow");a(P).removeClass("ui-state-hover");return false});var ya,ca;
a(e).before(c.hDiv).click(function(b){I=b.target;P=a(I,e.rows).closest("tr.jqgrow");if(a(P).length===0||P[0].className.indexOf("ui-state-disabled")>-1)return this;var c=a(I).hasClass("cbox"),f=true;a.isFunction(e.p.beforeSelectRow)&&(f=e.p.beforeSelectRow.call(e,P[0].id,b));if(!(I.tagName=="A"||(I.tagName=="INPUT"||I.tagName=="TEXTAREA"||I.tagName=="OPTION"||I.tagName=="SELECT")&&!c)&&f===true){if(e.p.cellEdit===true)if(e.p.multiselect&&c)a(e).jqGrid("setSelection",P[0].id,true);else{ya=P[0].rowIndex;
ca=a.jgrid.getCellIndex(I);try{a(e).jqGrid("editCell",ya,ca,true)}catch(d){}}else if(e.p.multikey)if(b[e.p.multikey])a(e).jqGrid("setSelection",P[0].id,true);else{if(e.p.multiselect&&c){c=a("[id^=jqg_"+a.jgrid.jqID(e.p.id)+"_]").attr("checked");a("[id^=jqg_"+a.jgrid.jqID(e.p.id)+"_]").attr("checked",!c)}}else{if(e.p.multiselect&&e.p.multiboxonly&&!c){a(e.p.selarrrow).each(function(b,c){var f=e.rows.namedItem(c);a(f).removeClass("ui-state-highlight");a("#jqg_"+a.jgrid.jqID(e.p.id)+"_"+a.jgrid.jqID(c)).attr("checked",
false)});e.p.selarrrow=[];a("#cb_"+a.jgrid.jqID(e.p.id),e.grid.hDiv).attr("checked",false)}a(e).jqGrid("setSelection",P[0].id,true)}if(a.isFunction(e.p.onCellSelect)){ya=P[0].id;ca=a.jgrid.getCellIndex(I);e.p.onCellSelect.call(e,ya,ca,a(I).html(),b)}b.stopPropagation()}else return this}).bind("reloadGrid",function(b,c){if(e.p.treeGrid===true)e.p.datatype=e.p.treedatatype;c&&c.current&&e.grid.selectionPreserver(e);if(e.p.datatype=="local"){a(e).jqGrid("resetSelection");e.p.data.length&&J()}else if(!e.p.treeGrid){e.p.selrow=
null;if(e.p.multiselect){e.p.selarrrow=[];a("#cb_"+a.jgrid.jqID(e.p.id),e.grid.hDiv).attr("checked",false)}e.p.savedRow=[]}e.p.scroll&&C(e.grid.bDiv,true,false);if(c&&c.page){var f=c.page;if(f>e.p.lastpage)f=e.p.lastpage;f<1&&(f=1);e.p.page=f;e.grid.bDiv.scrollTop=e.grid.prevRowHeight?(f-1)*e.grid.prevRowHeight*e.p.rowNum:0}if(e.grid.prevRowHeight&&e.p.scroll){delete e.p.lastpage;e.grid.populateVisible()}else e.grid.populate();return false});a.isFunction(this.p.ondblClickRow)&&a(this).dblclick(function(b){I=
b.target;P=a(I,e.rows).closest("tr.jqgrow");if(a(P).length===0)return false;ya=P[0].rowIndex;ca=a.jgrid.getCellIndex(I);e.p.ondblClickRow.call(e,a(P).attr("id"),ya,ca,b);return false});a.isFunction(this.p.onRightClickRow)&&a(this).bind("contextmenu",function(b){I=b.target;P=a(I,e.rows).closest("tr.jqgrow");if(a(P).length===0)return false;e.p.multiselect||a(e).jqGrid("setSelection",P[0].id,true);ya=P[0].rowIndex;ca=a.jgrid.getCellIndex(I);e.p.onRightClickRow.call(e,a(P).attr("id"),ya,ca,b);return false});
c.bDiv=document.createElement("div");r&&"auto"===(""+e.p.height).toLowerCase()&&(e.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:e.p.height+(isNaN(e.p.height)?"":"px"),width:c.width+"px"}).scroll(c.scrollGrid);a("table:first",c.bDiv).css({width:e.p.tblwidth+"px"});r?(2==a("tbody",this).size()&&a("tbody:gt(0)",this).remove(),e.p.multikey&&a(c.bDiv).bind("selectstart",
function(){return false})):e.p.multikey&&a(c.bDiv).bind("mousedown",function(){return false});ia&&a(c.bDiv).hide();c.cDiv=document.createElement("div");var ka=!0===e.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"==m?"left":"right","0px"):"";a(c.cDiv).append(ka).append("<span class='ui-jqgrid-title"+
("rtl"==m?"-rtl":"")+"'>"+e.p.caption+"</span>").addClass("ui-jqgrid-titlebar ui-widget-header ui-corner-top ui-helper-clearfix");a(c.cDiv).insertBefore(c.hDiv);e.p.toolbar[0]&&(c.uDiv=document.createElement("div"),"top"==e.p.toolbar[1]?a(c.uDiv).insertBefore(c.hDiv):"bottom"==e.p.toolbar[1]&&a(c.uDiv).insertAfter(c.hDiv),"both"==e.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),ia&&a(c.ubDiv).hide()):a(c.uDiv).width(c.width).addClass("ui-userdata ui-state-default").attr("id","t_"+this.id),ia&&a(c.uDiv).hide());e.p.toppager&&(e.p.toppager=a.jgrid.jqID(e.p.id)+"_toppager",c.topDiv=a("<div id='"+e.p.toppager+"'></div>")[0],e.p.toppager="#"+e.p.toppager,a(c.topDiv).insertBefore(c.hDiv).addClass("ui-state-default ui-jqgrid-toppager").width(c.width),n(e.p.toppager,"_t"));e.p.footerrow&&(c.sDiv=a("<div class='ui-jqgrid-sdiv'></div>")[0],j=a("<div class='ui-jqgrid-hbox"+
("rtl"==m?"-rtl":"")+"'></div>"),a(c.sDiv).append(j).insertAfter(c.hDiv).width(c.width),a(j).append(ea),c.footers=a(".ui-jqgrid-ftable",c.sDiv)[0].rows[0].cells,e.p.rownumbers&&(c.footers[0].className="ui-state-default jqgrid-rownum"),ia&&a(c.sDiv).hide());j=null;if(e.p.caption){var za=e.p.datatype;!0===e.p.hidegrid&&(a(".ui-jqgrid-titlebar-close",c.cDiv).click(function(b){var f=a.isFunction(e.p.onHeaderClick),d=".ui-jqgrid-bdiv, .ui-jqgrid-hdiv, .ui-jqgrid-pager, .ui-jqgrid-sdiv",k,j=this;if(e.p.toolbar[0]===
true){e.p.toolbar[1]=="both"&&(d=d+(", #"+a(c.ubDiv).attr("id")));d=d+(", #"+a(c.uDiv).attr("id"))}k=a(d,"#gview_"+a.jgrid.jqID(e.p.id)).length;e.p.gridstate=="visible"?a(d,"#gbox_"+a.jgrid.jqID(e.p.id)).slideUp("fast",function(){k--;if(k===0){a("span",j).removeClass("ui-icon-circle-triangle-n").addClass("ui-icon-circle-triangle-s");e.p.gridstate="hidden";a("#gbox_"+a.jgrid.jqID(e.p.id)).hasClass("ui-resizable")&&a(".ui-resizable-handle","#gbox_"+a.jgrid.jqID(e.p.id)).hide();f&&(ia||e.p.onHeaderClick.call(e,
e.p.gridstate,b))}}):e.p.gridstate=="hidden"&&a(d,"#gbox_"+a.jgrid.jqID(e.p.id)).slideDown("fast",function(){k--;if(k===0){a("span",j).removeClass("ui-icon-circle-triangle-s").addClass("ui-icon-circle-triangle-n");if(ia){e.p.datatype=za;R();ia=false}e.p.gridstate="visible";a("#gbox_"+a.jgrid.jqID(e.p.id)).hasClass("ui-resizable")&&a(".ui-resizable-handle","#gbox_"+a.jgrid.jqID(e.p.id)).show();f&&(ia||e.p.onHeaderClick.call(e,e.p.gridstate,b))}});return false}),ia&&(e.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});e.formatCol=u;e.sortData=V;e.updatepager=function(b,c){var f,d,k,g,j,m,l,n="";k=parseInt(e.p.page,10)-1;k<0&&(k=0);k=k*parseInt(e.p.rowNum,10);j=k+e.p.reccount;if(e.p.scroll){f=a("tbody:first > tr:gt(0)",
e.grid.bDiv);k=j-f.length;e.p.reccount=f.length;if(d=f.outerHeight()||e.grid.prevRowHeight){f=k*d;d=d*parseInt(e.p.records,10);a(">div:first",e.grid.bDiv).css({height:d}).children("div:first").css({height:f,display:f?"":"none"})}e.grid.bDiv.scrollLeft=e.grid.hDiv.scrollLeft}n=e.p.pager?e.p.pager:"";if(n=n+(e.p.toppager?n?","+e.p.toppager:e.p.toppager:"")){l=a.jgrid.formatter.integer||{};f=s(e.p.page);d=s(e.p.lastpage);a(".selbox",n).attr("disabled",false);if(e.p.pginput===true){a(".ui-pg-input",n).val(e.p.page);
a("#sp_1",n).html(a.fmatter?a.fmatter.util.NumberFormat(e.p.lastpage,l):e.p.lastpage)}if(e.p.viewrecords)if(e.p.reccount===0)a(".ui-paging-info",n).html(e.p.emptyrecords);else{g=k+1;m=e.p.records;if(a.fmatter){g=a.fmatter.util.NumberFormat(g,l);j=a.fmatter.util.NumberFormat(j,l);m=a.fmatter.util.NumberFormat(m,l)}a(".ui-paging-info",n).html(a.jgrid.format(e.p.recordtext,g,j,m))}if(e.p.pgbuttons===true){f<=0&&(f=d=0);if(f==1||f===0){a("#first, #prev",e.p.pager).addClass("ui-state-disabled").removeClass("ui-state-hover");
e.p.toppager&&a("#first_t, #prev_t",e.p.toppager).addClass("ui-state-disabled").removeClass("ui-state-hover")}else{a("#first, #prev",e.p.pager).removeClass("ui-state-disabled");e.p.toppager&&a("#first_t, #prev_t",e.p.toppager).removeClass("ui-state-disabled")}if(f==d||f===0){a("#next, #last",e.p.pager).addClass("ui-state-disabled").removeClass("ui-state-hover");e.p.toppager&&a("#next_t, #last_t",e.p.toppager).addClass("ui-state-disabled").removeClass("ui-state-hover")}else{a("#next, #last",e.p.pager).removeClass("ui-state-disabled");
e.p.toppager&&a("#next_t, #last_t",e.p.toppager).removeClass("ui-state-disabled")}}}b===true&&e.p.rownumbers===true&&a("td.jqgrid-rownum",e.rows).each(function(b){a(this).html(k+1+b)});c&&e.p.jqgdnd&&a(e).jqGrid("gridDnD","updateDnD");a.isFunction(e.p.gridComplete)&&e.p.gridComplete.call(e)};e.refreshIndex=J;e.formatter=function(a,b,c,e,f){return t(a,b,c,e,f)};a.extend(c,{populate:R,emptyRows:C});this.grid=c;e.addXmlData=function(a){S(a,e.grid.bDiv)};e.addJSONData=function(a){F(a,e.grid.bDiv)};this.grid.cols=
this.rows[0].cells;R();e.p.hiddengrid=!1;a(window).unload(function(){e=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(d){return this.each(function(){this.grid&&"object"===typeof d&&a.extend(!0,this.p,d)})},getDataIDs:function(){var d=[],c=0,b,f=0;this.each(function(){if((b=this.rows.length)&&0<b)for(;c<b;)a(this.rows[c]).hasClass("jqgrow")&&(d[f]=this.rows[c].id,f++),c++});return d},setSelection:function(d,
c){return this.each(function(){var b,f,g;if(void 0!==d&&(c=!1===c?!1:!0,(f=this.rows.namedItem(d+""))&&!(-1<f.className.indexOf("ui-state-disabled")))){if(!0===this.p.scrollrows&&(b=this.rows.namedItem(d).rowIndex,0<=b)){g=a(this.grid.bDiv)[0].clientHeight;var j=a(this.grid.bDiv)[0].scrollTop,m=this.rows[b].offsetTop;b=this.rows[b].clientHeight;m+b>=g+j?a(this.grid.bDiv)[0].scrollTop=m-(g+j)+b+j:m<g+j&&m<j&&(a(this.grid.bDiv)[0].scrollTop=m)}this.p.multiselect?(this.p.selrow=f.id,g=a.inArray(this.p.selrow,
this.p.selarrrow),-1===g?("ui-subgrid"!==f.className&&a(f).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"!==f.className&&a(f).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(g,1),g=this.p.selarrrow[0],this.p.selrow=void 0===
g?null:g),this.p.onSelectRow&&c&&this.p.onSelectRow.call(this,f.id,b)):"ui-subgrid"!==f.className&&(this.p.selrow!=f.id?(a(this.rows.namedItem(this.p.selrow)).removeClass("ui-state-highlight").attr({"aria-selected":"false",tabindex:"-1"}),a(f).addClass("ui-state-highlight").attr({"aria-selected":!0,tabindex:"0"}),b=!0):b=!1,this.p.selrow=f.id,this.p.onSelectRow&&c&&this.p.onSelectRow.call(this,f.id,b))}})},resetSelection:function(d){return this.each(function(){var c=this,b,f;"undefined"!==typeof d?
(f=d===c.p.selrow?c.p.selrow:d,a("#"+a.jgrid.jqID(c.p.id)+" tbody:first tr#"+a.jgrid.jqID(f)).removeClass("ui-state-highlight").attr("aria-selected","false"),c.p.multiselect&&(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)),f=null):c.p.multiselect?(a(c.p.selarrrow).each(function(f,d){b=c.rows.namedItem(d);a(b).removeClass("ui-state-highlight").attr("aria-selected","false");a("#jqg_"+a.jgrid.jqID(c.p.id)+"_"+a.jgrid.jqID(d)).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(d){var c={},b,f=!1,g,j=0;this.each(function(){var m=this,e,l;if("undefined"==typeof d)f=!0,b=[],g=m.rows.length;else{l=m.rows.namedItem(d);if(!l)return c;g=2}for(;j<g;)f&&(l=m.rows[j]),a(l).hasClass("jqgrow")&&(a("td",l).each(function(b){e=
m.p.colModel[b].name;if("cb"!==e&&"subgrid"!==e&&"rn"!==e)if(!0===m.p.treeGrid&&e==m.p.ExpandColumn)c[e]=a.jgrid.htmlDecode(a("span:first",this).html());else try{c[e]=a.unformat(this,{rowId:l.id,colModel:m.p.colModel[b]},b)}catch(f){c[e]=a.jgrid.htmlDecode(a(this).html())}}),f&&(b.push(c),c={})),j++});return b?b:c},delRowData:function(d){var c=!1,b,f;this.each(function(){if(b=this.rows.namedItem(d)){if(a(b).remove(),this.p.records--,this.p.reccount--,this.updatepager(!0,!1),c=!0,this.p.multiselect&&
(f=a.inArray(d,this.p.selarrrow),-1!=f&&this.p.selarrrow.splice(f,1)),d==this.p.selrow)this.p.selrow=null}else return!1;if("local"==this.p.datatype){var g=this.p._index[d];"undefined"!=typeof g&&(this.p.data.splice(g,1),this.refreshIndex())}if(!0===this.p.altRows&&c){var j=this.p.altclass;a(this.rows).each(function(b){1==b%2?a(this).addClass(j):a(this).removeClass(j)})}});return c},setRowData:function(d,c,b){var f,g=!0,j;this.each(function(){if(!this.grid)return!1;var m=this,e,l,n=typeof b,r={};l=
m.rows.namedItem(d);if(!l)return!1;if(c)try{if(a(this.p.colModel).each(function(b){f=this.name;void 0!==c[f]&&(r[f]=this.formatter&&"string"===typeof this.formatter&&"date"==this.formatter?a.unformat.date(c[f],this):c[f],e=m.formatter(d,c[f],b,c,"edit"),j=this.title?{title:a.jgrid.stripHtml(e)}:{},!0===m.p.treeGrid&&f==m.p.ExpandColumn?a("td:eq("+b+") > span:first",l).html(e).attr(j):a("td:eq("+b+")",l).html(e).attr(j))}),"local"==m.p.datatype){var p=m.p._index[d];if(m.p.treeGrid)for(var q in m.p.treeReader)r.hasOwnProperty(m.p.treeReader[q])&&
delete r[m.p.treeReader[q]];"undefined"!=typeof p&&(m.p.data[p]=a.extend(!0,m.p.data[p],r));r=null}}catch(s){g=!1}g&&("string"===n?a(l).addClass(b):"object"===n&&a(l).css(b))});return g},addRowData:function(d,c,b,f){b||(b="last");var g=!1,j,m,e,l,n,r,p,q,s="",u,v,t,x,y;c&&(a.isArray(c)?(u=!0,b="last",v=d):(c=[c],u=!1),this.each(function(){var z=c.length;n=this.p.rownumbers===true?1:0;e=this.p.multiselect===true?1:0;l=this.p.subGrid===true?1:0;if(!u)if(typeof d!="undefined")d=d+"";else{d=a.jgrid.randId();
if(this.p.keyIndex!==false){v=this.p.colModel[this.p.keyIndex+e+l+n].name;typeof c[0][v]!="undefined"&&(d=c[0][v])}}t=this.p.altclass;for(var E=0,A="",C={},J=a.isFunction(this.p.afterInsertRow)?true:false;E<z;){x=c[E];m="";if(u){try{d=x[v]}catch(S){d=a.jgrid.randId()}A=this.p.altRows===true?(this.rows.length-1)%2===0?t:"":""}if(n){s=this.formatCol(0,1,"",null,d,true);m=m+('<td role="gridcell" aria-describedby="'+this.p.id+'_rn" class="ui-state-default jqgrid-rownum" '+s+">0</td>")}if(e){q='<input role="checkbox" type="checkbox" id="jqg_'+
this.p.id+"_"+d+'" class="cbox"/>';s=this.formatCol(n,1,"",null,d,true);m=m+('<td role="gridcell" aria-describedby="'+this.p.id+'_cb" '+s+">"+q+"</td>")}l&&(m=m+a(this).jqGrid("addSubGridCell",e+n,1));for(p=e+l+n;p<this.p.colModel.length;p++){y=this.p.colModel[p];j=y.name;C[j]=y.formatter&&typeof y.formatter==="string"&&y.formatter=="date"?a.unformat.date(x[j],y):x[j];q=this.formatter(d,a.jgrid.getAccessor(x,j),p,x,"edit");s=this.formatCol(p,1,q,d,x,true);m=m+('<td role="gridcell" aria-describedby="'+
this.p.id+"_"+j+'" '+s+">"+q+"</td>")}m='<tr id="'+d+'" role="row" tabindex="-1" class="ui-widget-content jqgrow ui-row-'+this.p.direction+" "+A+'">'+m+"</tr>";if(this.p.subGrid===true){m=a(m)[0];a(this).jqGrid("addSubGrid",m,e+n)}if(this.rows.length===0)a("table:first",this.grid.bDiv).append(m);else switch(b){case "last":a(this.rows[this.rows.length-1]).after(m);break;case "first":a(this.rows[0]).after(m);break;case "after":if(r=this.rows.namedItem(f))a(this.rows[r.rowIndex+1]).hasClass("ui-subgrid")?
a(this.rows[r.rowIndex+1]).after(m):a(r).after(m);break;case "before":if(r=this.rows.namedItem(f)){a(r).before(m);r=r.rowIndex}}this.p.records++;this.p.reccount++;J&&this.p.afterInsertRow.call(this,d,x,x);E++;if(this.p.datatype=="local"){C[this.p.localReader.id]=d;this.p._index[d]=this.p.data.length;this.p.data.push(C);C={}}}this.p.altRows===true&&!u&&(b=="last"?(this.rows.length-1)%2==1&&a(this.rows[this.rows.length-1]).addClass(t):a(this.rows).each(function(b){b%2==1?a(this).addClass(t):a(this).removeClass(t)}));
this.updatepager(true,true);g=true}));return g},footerData:function(d,c,b){function f(a){for(var b in a)if(a.hasOwnProperty(b))return!1;return!0}var g,j=!1,m={},e;"undefined"==typeof d&&(d="get");"boolean"!=typeof b&&(b=!0);d=d.toLowerCase();this.each(function(){var l=this,n;if(!l.grid||!l.p.footerrow||"set"==d&&f(c))return!1;j=!0;a(this.p.colModel).each(function(f){g=this.name;"set"==d?void 0!==c[g]&&(n=b?l.formatter("",c[g],f,c,"edit"):c[g],e=this.title?{title:a.jgrid.stripHtml(n)}:{},a("tr.footrow td:eq("+
f+")",l.grid.sDiv).html(n).attr(e),j=!0):"get"==d&&(m[g]=a("tr.footrow td:eq("+f+")",l.grid.sDiv).html())})});return"get"==d?m:j},showHideCol:function(d,c){return this.each(function(){var b=this,f=!1,g=a.browser.webkit||a.browser.safari?0:b.p.cellLayout,j;if(b.grid){"string"===typeof d&&(d=[d]);c="none"!=c?"":"none";var m=""===c?!0:!1;a(this.p.colModel).each(function(e){-1!==a.inArray(this.name,d)&&this.hidden===m&&(a("tr",b.grid.hDiv).each(function(){a(this).children("th:eq("+e+")").css("display",
c)}),a(b.rows).each(function(){a(this).children("td:eq("+e+")").css("display",c)}),b.p.footerrow&&a(b.grid.sDiv).children("td:eq("+e+")").css("display",c),j=this.widthOrg?this.widthOrg:parseInt(this.width,10),b.p.tblwidth="none"===c?b.p.tblwidth-(j+g):b.p.tblwidth+(j+g),this.hidden=!m,f=!0)});!0===f&&b.grid.width!==b.p.tblwidth&&a(b).jqGrid("setGridWidth",!0===b.p.shrinkToFit?b.grid.width:b.p.tblwidth,!0)}})},hideCol:function(d){return this.each(function(){a(this).jqGrid("showHideCol",d,"none")})},
showCol:function(d){return this.each(function(){a(this).jqGrid("showHideCol",d,"")})},remapColumns:function(d,c,b){function f(b){var c;c=b.length?a.makeArray(b):a.extend({},b);a.each(d,function(a){b[a]=c[this]})}function g(b,c){a(">tr"+(c||""),b).each(function(){var b=this,c=a.makeArray(b.cells);a.each(d,function(){var a=c[this];a&&b.appendChild(a)})})}var j=this.get(0);f(j.p.colModel);f(j.p.colNames);f(j.grid.headers);g(a("thead:first",j.grid.hDiv),b&&":not(.ui-jqgrid-labels)");c&&g(a("#"+a.jgrid.jqID(j.p.id)+
" tbody:first"),".jqgfirstrow, tr.jqgrow, tr.jqfoot");j.p.footerrow&&g(a("tbody:first",j.grid.sDiv));j.p.remapColumns&&(j.p.remapColumns.length?f(j.p.remapColumns):j.p.remapColumns=a.makeArray(d));j.p.lastsort=a.inArray(j.p.lastsort,d);j.p.treeGrid&&(j.p.expColInd=a.inArray(j.p.expColInd,d))},setGridWidth:function(d,c){return this.each(function(){if(this.grid){var b=this,f,g=0,j=a.browser.webkit||a.browser.safari?0:b.p.cellLayout,m,e=0,l=!1,n=b.p.scrollOffset,r,p=0,q=0,s;"boolean"!=typeof c&&(c=b.p.shrinkToFit);
if(!isNaN(d)&&(d=parseInt(d,10),b.grid.width=b.p.width=d,a("#gbox_"+a.jgrid.jqID(b.p.id)).css("width",d+"px"),a("#gview_"+a.jgrid.jqID(b.p.id)).css("width",d+"px"),a(b.grid.bDiv).css("width",d+"px"),a(b.grid.hDiv).css("width",d+"px"),b.p.pager&&a(b.p.pager).css("width",d+"px"),b.p.toppager&&a(b.p.toppager).css("width",d+"px"),!0===b.p.toolbar[0]&&(a(b.grid.uDiv).css("width",d+"px"),"both"==b.p.toolbar[1]&&a(b.grid.ubDiv).css("width",d+"px")),b.p.footerrow&&a(b.grid.sDiv).css("width",d+"px"),!1===
c&&!0===b.p.forceFit&&(b.p.forceFit=!1),!0===c))if(a.each(b.p.colModel,function(){if(this.hidden===false){f=this.widthOrg?this.widthOrg:parseInt(this.width,10);g=g+(f+j);this.fixed?p=p+(f+j):e++;q++}}),0!==e){b.p.tblwidth=g;r=d-j*e-p;if(!isNaN(b.p.height)&&(a(b.grid.bDiv)[0].clientHeight<a(b.grid.bDiv)[0].scrollHeight||1===b.rows.length))l=!0,r-=n;var g=0,u=0<b.grid.cols.length;a.each(b.p.colModel,function(a){if(this.hidden===false&&!this.fixed){f=this.widthOrg?this.widthOrg:parseInt(this.width,10);
f=Math.round(r*f/(b.p.tblwidth-j*e-p));if(!(f<0)){this.width=f;g=g+f;b.grid.headers[a].width=f;b.grid.headers[a].el.style.width=f+"px";if(b.p.footerrow)b.grid.footers[a].style.width=f+"px";if(u)b.grid.cols[a].style.width=f+"px";m=a}}});s=0;l?d-p-(g+j*e)!==n&&(s=d-p-(g+j*e)-n):1!==Math.abs(d-p-(g+j*e))&&(s=d-p-(g+j*e));b.p.colModel[m].width+=s;b.p.tblwidth=g+s+j*e+p;b.p.tblwidth>d?(l=b.p.tblwidth-parseInt(d,10),b.p.tblwidth=d,f=b.p.colModel[m].width-=l):f=b.p.colModel[m].width;b.grid.headers[m].width=
f;b.grid.headers[m].el.style.width=f+"px";u&&(b.grid.cols[m].style.width=f+"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[m].style.width=f+"px",a("table:first",b.grid.sDiv).css("width",b.p.tblwidth+"px"))}}})},setGridHeight:function(d){return this.each(function(){this.grid&&(a(this.grid.bDiv).css({height:d+(isNaN(d)?"":"px")}),this.p.height=d,
this.p.scroll&&this.grid.populateVisible())})},setCaption:function(d){return this.each(function(){this.p.caption=d;a("span.ui-jqgrid-title",this.grid.cDiv).html(d);a(this.grid.cDiv).show()})},setLabel:function(d,c,b,f){return this.each(function(){var g=-1;if(this.grid&&(isNaN(d)?a(this.p.colModel).each(function(a){if(this.name==d)return g=a,!1}):g=parseInt(d,10),0<=g)){var j=a("tr.ui-jqgrid-labels th:eq("+g+")",this.grid.hDiv);if(c){var m=a(".s-ico",j);a("[id^=jqgh_]",j).empty().html(c).append(m);
this.p.colNames[g]=c}b&&("string"===typeof b?a(j).addClass(b):a(j).css(b));"object"===typeof f&&a(j).attr(f)}})},setCell:function(d,c,b,f,g,j){return this.each(function(){var m=-1,e,l;if(this.grid&&(isNaN(c)?a(this.p.colModel).each(function(a){if(this.name==c)return m=a,!1}):m=parseInt(c,10),0<=m&&(e=this.rows.namedItem(d)))){var n=a("td:eq("+m+")",e);if(""!==b||!0===j)e=this.formatter(d,b,m,e,"edit"),l=this.p.colModel[m].title?{title:a.jgrid.stripHtml(e)}:{},this.p.treeGrid&&0<a(".tree-wrap",a(n)).length?
a("span",a(n)).html(e).attr(l):a(n).html(e).attr(l),"local"==this.p.datatype&&(e=this.p.colModel[m],b=e.formatter&&"string"===typeof e.formatter&&"date"==e.formatter?a.unformat.date(b,e):b,l=this.p._index[d],"undefined"!=typeof l&&(this.p.data[l][e.name]=b));"string"===typeof f?a(n).addClass(f):f&&a(n).css(f);"object"===typeof g&&a(n).attr(g)}})},getCell:function(d,c){var b=!1;this.each(function(){var f=-1;if(this.grid&&(isNaN(c)?a(this.p.colModel).each(function(a){if(this.name===c)return f=a,!1}):
f=parseInt(c,10),0<=f)){var g=this.rows.namedItem(d);if(g)try{b=a.unformat(a("td:eq("+f+")",g),{rowId:g.id,colModel:this.p.colModel[f]},f)}catch(j){b=a.jgrid.htmlDecode(a("td:eq("+f+")",g).html())}}});return b},getCol:function(d,c,b){var f=[],g,j=0,m=0,e=0,l,c="boolean"!=typeof c?!1:c;"undefined"==typeof b&&(b=!1);this.each(function(){var n=-1;if(this.grid&&(isNaN(d)?a(this.p.colModel).each(function(a){if(this.name===d)return n=a,!1}):n=parseInt(d,10),0<=n)){var r=this.rows.length,p=0;if(r&&0<r){for(;p<
r;){if(a(this.rows[p]).hasClass("jqgrow")){try{g=a.unformat(a(this.rows[p].cells[n]),{rowId:this.rows[p].id,colModel:this.p.colModel[n]},n)}catch(q){g=a.jgrid.htmlDecode(this.rows[p].cells[n].innerHTML)}b?(l=parseFloat(g),j+=l,m=Math.min(m,l),e=Math.max(m,l)):c?f.push({id:this.rows[p].id,value:g}):f.push(g)}p++}if(b)switch(b.toLowerCase()){case "sum":f=j;break;case "avg":f=j/r;break;case "count":f=r;break;case "min":f=m;break;case "max":f=e}}}});return f},clearGridData:function(d){return this.each(function(){if(this.grid){"boolean"!=
typeof d&&(d=!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&&d&&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,f;this.each(function(){if(f=this.rows.namedItem(a))b=!0===c?f:f.rowIndex});return b},bindKeys:function(d){var c=a.extend({onEnter:null,onSpace:null,onLeftKey:null,onRightKey:null,scrollingRows:!0},d||{});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(f){var d=a(b).find("tr[tabindex=0]")[0],k,m,e,l=b.p.treeReader.expanded_field;if(d){e=b.p._index[d.id];if(37===f.keyCode||38===f.keyCode||
39===f.keyCode||40===f.keyCode){if(38===f.keyCode){m=d.previousSibling;k="";if(m)if(a(m).is(":hidden"))for(;m;){if(m=m.previousSibling,!a(m).is(":hidden")&&a(m).hasClass("jqgrow")){k=m.id;break}}else k=m.id;a(b).jqGrid("setSelection",k)}if(40===f.keyCode){m=d.nextSibling;k="";if(m)if(a(m).is(":hidden"))for(;m;){if(m=m.nextSibling,!a(m).is(":hidden")&&a(m).hasClass("jqgrow")){k=m.id;break}}else k=m.id;a(b).jqGrid("setSelection",k)}37===f.keyCode&&(b.p.treeGrid&&b.p.data[e][l]&&a(d).find("div.treeclick").trigger("click"),
a.isFunction(c.onLeftKey)&&c.onLeftKey.call(b,b.p.selrow));39===f.keyCode&&(b.p.treeGrid&&!b.p.data[e][l]&&a(d).find("div.treeclick").trigger("click"),a.isFunction(c.onRightKey)&&c.onRightKey.call(b,b.p.selrow));return!1}if(13===f.keyCode)return a.isFunction(c.onEnter)&&c.onEnter.call(b,b.p.selrow),!1;if(32===f.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}})})(l);(function(a){a.fmatter={};a.extend(a.fmatter,{isBoolean:function(a){return"boolean"===typeof a},isObject:function(d){return d&&("object"===typeof d||a.isFunction(d))||!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(d){if(!this.isString(d)&&this.isValue(d))return!1;if(!this.isValue(d))return!0;d=a.trim(d).replace(/\&nbsp\;/ig,"").replace(/\&#160\;/ig,"");return""===d}});a.fn.fmatter=function(d,c,b,f,g){var j=c,b=a.extend({},a.jgrid.formatter,b);a.fn.fmatter[d]&&(j=a.fn.fmatter[d](c,b,f,g));return j};a.fmatter.util={NumberFormat:function(d,c){a.fmatter.isNumber(d)||(d*=1);if(a.fmatter.isNumber(d)){var b=0>d,f=d+"",g=c.decimalSeparator?c.decimalSeparator:
".",j;if(a.fmatter.isNumber(c.decimalPlaces)){var m=c.decimalPlaces,f=Math.pow(10,m),f=Math.round(d*f)/f+"";j=f.lastIndexOf(".");if(0<m){0>j?(f+=g,j=f.length-1):"."!==g&&(f=f.replace(".",g));for(;f.length-1-j<m;)f+="0"}}if(c.thousandsSeparator){m=c.thousandsSeparator;j=f.lastIndexOf(g);j=-1<j?j:f.length;for(var g=f.substring(j),e=-1,l=j;0<l;l--){e++;if(0===e%3&&l!==j&&(!b||1<l))g=m+g;g=f.charAt(l-1)+g}f=g}f=c.prefix?c.prefix+f:f;return c.suffix?f+c.suffix:f}return d},DateFormat:function(d,c,b,f){var g=
/^\/Date\((([-+])?[0-9]+)(([-+])([0-9]{2})([0-9]{2}))?\)\/$/,j="string"===typeof c?c.match(g):null,g=function(a,b){a=""+a;for(b=parseInt(b,10)||2;a.length<b;)a="0"+a;return a},m={m:1,d:1,y:1970,h:0,i:0,s:0,u:0},e=0,l,n=["i18n"];n.i18n={dayNames:f.dayNames,monthNames:f.monthNames};d in f.masks&&(d=f.masks[d]);if(c.constructor===Number)"u"==(""+d).toLowerCase()&&(c*=1E3),e=new Date(c);else if(c.constructor===Date)e=c;else if(null!==j)e=new Date(parseInt(j[1],10)),j[3]&&(d=60*Number(j[5])+Number(j[6]),
d*="-"==j[4]?1:-1,d-=e.getTimezoneOffset(),e.setTime(Number(Number(e)+6E4*d)));else{c=(""+c).split(/[\\\/:_;.,\t\T\s-]/);d=d.split(/[\\\/:_;.,\t\T\s-]/);j=0;for(l=d.length;j<l;j++)"M"==d[j]&&(e=a.inArray(c[j],n.i18n.monthNames),-1!==e&&12>e&&(c[j]=e+1)),"F"==d[j]&&(e=a.inArray(c[j],n.i18n.monthNames),-1!==e&&11<e&&(c[j]=e+1-12)),c[j]&&(m[d[j].toLowerCase()]=parseInt(c[j],10));m.f&&(m.m=m.f);if(0===m.m&&0===m.y&&0===m.d)return"&#160;";m.m=parseInt(m.m,10)-1;e=m.y;70<=e&&99>=e?m.y=1900+m.y:0<=e&&69>=
e&&(m.y=2E3+m.y);e=new Date(m.y,m.m,m.d,m.h,m.i,m.s,m.u)}b in f.masks?b=f.masks[b]:b||(b="Y-m-d");d=e.getHours();c=e.getMinutes();m=e.getDate();j=e.getMonth()+1;l=e.getTimezoneOffset();var r=e.getSeconds(),p=e.getMilliseconds(),q=e.getDay(),s=e.getFullYear(),u=(q+6)%7+1,v=(new Date(s,j-1,m)-new Date(s,0,1))/864E5,t={d:g(m),D:n.i18n.dayNames[q],j:m,l:n.i18n.dayNames[q+7],N:u,S:f.S(m),w:q,z:v,W:5>u?Math.floor((v+u-1)/7)+1:Math.floor((v+u-1)/7)||(4>((new Date(s-1,0,1)).getDay()+6)%7?53:52),F:n.i18n.monthNames[j-
1+12],m:g(j),M:n.i18n.monthNames[j-1],n:j,t:"?",L:"?",o:"?",Y:s,y:(""+s).substring(2),a:12>d?f.AmPm[0]:f.AmPm[1],A:12>d?f.AmPm[2]:f.AmPm[3],B:"?",g:d%12||12,G:d,h:g(d%12||12),H:g(d),i:g(c),s:g(r),u:p,e:"?",I:"?",O:(0<l?"-":"+")+g(100*Math.floor(Math.abs(l)/60)+Math.abs(l)%60,4),P:"?",T:((""+e).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(e/
1E3)};return b.replace(/\\.|[dDjlNSwzWFmMntLoYyaABgGhHisueIOPTZcrU]/g,function(a){return a in t?t[a]:a.substring(1)})}};a.fn.fmatter.defaultFormat=function(d,c){return a.fmatter.isValue(d)&&""!==d?d:c.defaultValue?c.defaultValue:"&#160;"};a.fn.fmatter.email=function(d,c){return a.fmatter.isEmpty(d)?a.fn.fmatter.defaultFormat(d,c):'<a href="mailto:'+d+'">'+d+"</a>"};a.fn.fmatter.checkbox=function(d,c){var b=a.extend({},c.checkbox),f;a.fmatter.isUndefined(c.colModel.formatoptions)||(b=a.extend({},b,
c.colModel.formatoptions));f=!0===b.disabled?'disabled="disabled"':"";if(a.fmatter.isEmpty(d)||a.fmatter.isUndefined(d))d=a.fn.fmatter.defaultFormat(d,b);d=(d+"").toLowerCase();return'<input type="checkbox" '+(0>d.search(/(false|0|no|off)/i)?" checked='checked' ":"")+' value="'+d+'" offval="no" '+f+"/>"};a.fn.fmatter.link=function(d,c){var b={target:c.target},f="";a.fmatter.isUndefined(c.colModel.formatoptions)||(b=a.extend({},b,c.colModel.formatoptions));b.target&&(f="target="+b.target);return a.fmatter.isEmpty(d)?
a.fn.fmatter.defaultFormat(d,c):"<a "+f+' href="'+d+'">'+d+"</a>"};a.fn.fmatter.showlink=function(d,c){var b={baseLinkUrl:c.baseLinkUrl,showAction:c.showAction,addParam:c.addParam||"",target:c.target,idName:c.idName},f="";a.fmatter.isUndefined(c.colModel.formatoptions)||(b=a.extend({},b,c.colModel.formatoptions));b.target&&(f="target="+b.target);b=b.baseLinkUrl+b.showAction+"?"+b.idName+"="+c.rowId+b.addParam;return a.fmatter.isString(d)||a.fmatter.isNumber(d)?"<a "+f+' href="'+b+'">'+d+"</a>":a.fn.fmatter.defaultFormat(d,
c)};a.fn.fmatter.integer=function(d,c){var b=a.extend({},c.integer);a.fmatter.isUndefined(c.colModel.formatoptions)||(b=a.extend({},b,c.colModel.formatoptions));return a.fmatter.isEmpty(d)?b.defaultValue:a.fmatter.util.NumberFormat(d,b)};a.fn.fmatter.number=function(d,c){var b=a.extend({},c.number);a.fmatter.isUndefined(c.colModel.formatoptions)||(b=a.extend({},b,c.colModel.formatoptions));return a.fmatter.isEmpty(d)?b.defaultValue:a.fmatter.util.NumberFormat(d,b)};a.fn.fmatter.currency=function(d,
c){var b=a.extend({},c.currency);a.fmatter.isUndefined(c.colModel.formatoptions)||(b=a.extend({},b,c.colModel.formatoptions));return a.fmatter.isEmpty(d)?b.defaultValue:a.fmatter.util.NumberFormat(d,b)};a.fn.fmatter.date=function(d,c,b,f){b=a.extend({},c.date);a.fmatter.isUndefined(c.colModel.formatoptions)||(b=a.extend({},b,c.colModel.formatoptions));return!b.reformatAfterEdit&&"edit"==f?a.fn.fmatter.defaultFormat(d,c):a.fmatter.isEmpty(d)?a.fn.fmatter.defaultFormat(d,c):a.fmatter.util.DateFormat(b.srcformat,
d,b.newformat,b)};a.fn.fmatter.select=function(d,c){var d=d+"",b=!1,f=[];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 g=!0===c.colModel.editoptions.multiple?!0:!1,j=[],m;g&&(j=d.split(","),j=a.map(j,function(b){return a.trim(b)}));if(a.fmatter.isString(b))for(var e=b.split(";"),o=0,n=0;n<e.length;n++)if(m=e[n].split(":"),2<m.length&&(m[1]=l.map(m,function(a,b){if(b>0)return a}).join(":")),
g)-1<l.inArray(m[0],j)&&(f[o]=m[1],o++);else{if(a.trim(m[0])==a.trim(d)){f[0]=m[1];break}}else a.fmatter.isObject(b)&&(g?f=l.map(j,function(a){return b[a]}):f[0]=b[d]||"")}d=f.join(", ");return""===d?a.fn.fmatter.defaultFormat(d,c):d};a.fn.fmatter.rowactions=function(d,c,b,f){var g={keys:!1,editbutton:!0,delbutton:!0,onEdit:null,onSuccess:null,afterSave:null,onError:null,afterRestore:null,extraparam:{oper:"edit"},url:null,delOptions:{}},f=a("#"+c)[0].p.colModel[f];a.fmatter.isUndefined(f.formatoptions)||
(g=a.extend(g,f.formatoptions));var f=function(b){g.afterSave&&g.afterSave(b);a("tr#"+d+" div.ui-inline-edit, tr#"+d+" div.ui-inline-del","#"+c).show();a("tr#"+d+" div.ui-inline-save, tr#"+d+" div.ui-inline-cancel","#"+c).hide()},j=function(b){g.afterRestore&&g.afterRestore(b);a("tr#"+d+" div.ui-inline-edit, tr#"+d+" div.ui-inline-del","#"+c).show();a("tr#"+d+" div.ui-inline-save, tr#"+d+" div.ui-inline-cancel","#"+c).hide()};switch(b){case "edit":a("#"+c).jqGrid("editRow",d,g.keys,g.onEdit,g.onSuccess,
g.url,g.extraparam,f,g.onError,j);a("tr#"+d+" div.ui-inline-edit, tr#"+d+" div.ui-inline-del","#"+c).hide();a("tr#"+d+" div.ui-inline-save, tr#"+d+" div.ui-inline-cancel","#"+c).show();break;case "save":a("#"+c).jqGrid("saveRow",d,g.onSuccess,g.url,g.extraparam,f,g.onError,j)&&(a("tr#"+d+" div.ui-inline-edit, tr#"+d+" div.ui-inline-del","#"+c).show(),a("tr#"+d+" div.ui-inline-save, tr#"+d+" div.ui-inline-cancel","#"+c).hide());break;case "cancel":a("#"+c).jqGrid("restoreRow",d,j);a("tr#"+d+" div.ui-inline-edit, tr#"+
d+" div.ui-inline-del","#"+c).show();a("tr#"+d+" div.ui-inline-save, tr#"+d+" div.ui-inline-cancel","#"+c).hide();break;case "del":a("#"+c).jqGrid("delGridRow",d,g.delOptions)}};a.fn.fmatter.actions=function(d,c){var b={keys:!1,editbutton:!0,delbutton:!0};a.fmatter.isUndefined(c.colModel.formatoptions)||(b=a.extend(b,c.colModel.formatoptions));var f=c.rowId,g="",j;if("undefined"==typeof f||a.fmatter.isEmpty(f))return"";b.editbutton&&(j="onclick=$.fn.fmatter.rowactions('"+f+"','"+c.gid+"','edit',"+
c.pos+");",g=g+"<div style='margin-left:8px;'><div title='"+a.jgrid.nav.edittitle+"' style='float:left;cursor:pointer;' class='ui-pg-div ui-inline-edit' "+j+"><span class='ui-icon ui-icon-pencil'></span></div>");b.delbutton&&(j="onclick=$.fn.fmatter.rowactions('"+f+"','"+c.gid+"','del',"+c.pos+");",g=g+"<div title='"+a.jgrid.nav.deltitle+"' style='float:left;margin-left:5px;' class='ui-pg-div ui-inline-del' "+j+"><span class='ui-icon ui-icon-trash'></span></div>");j="onclick=$.fn.fmatter.rowactions('"+
f+"','"+c.gid+"','save',"+c.pos+");";g=g+"<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' "+j+"></span></div>";j="onclick=$.fn.fmatter.rowactions('"+f+"','"+c.gid+"','cancel',"+c.pos+");";return g+"<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' "+j+"></span></div></div>"};a.unformat=function(d,c,b,
f){var g,j=c.colModel.formatter,m=c.colModel.formatoptions||{},e=/([\.\*\_\'\(\)\{\}\+\?\\])/g,l=c.colModel.unformat||a.fn.fmatter[j]&&a.fn.fmatter[j].unformat;if("undefined"!==typeof l&&a.isFunction(l))g=l(a(d).text(),c,d);else if(!a.fmatter.isUndefined(j)&&a.fmatter.isString(j))switch(g=a.jgrid.formatter||{},j){case "integer":m=a.extend({},g.integer,m);c=m.thousandsSeparator.replace(e,"\\$1");g=a(d).text().replace(RegExp(c,"g"),"");break;case "number":m=a.extend({},g.number,m);c=m.thousandsSeparator.replace(e,
"\\$1");g=a(d).text().replace(RegExp(c,"g"),"").replace(m.decimalSeparator,".");break;case "currency":m=a.extend({},g.currency,m);c=m.thousandsSeparator.replace(e,"\\$1");g=a(d).text().replace(RegExp(c,"g"),"").replace(m.decimalSeparator,".").replace(m.prefix,"").replace(m.suffix,"");break;case "checkbox":m=c.colModel.editoptions?c.colModel.editoptions.value.split(":"):["Yes","No"];g=a("input",d).attr("checked")?m[0]:m[1];break;case "select":g=a.unformat.select(d,c,b,f);break;case "actions":return"";
default:g=a(d).text()}return g?g:!0===f?a(d).text():a.jgrid.htmlDecode(a(d).html())};a.unformat.select=function(d,c,b,f){b=[];d=a(d).text();if(!0===f)return d;c=a.extend({},c.colModel.editoptions);if(c.value){var g=c.value,c=!0===c.multiple?!0:!1,f=[],j;c&&(f=d.split(","),f=a.map(f,function(b){return a.trim(b)}));if(a.fmatter.isString(g))for(var m=g.split(";"),e=0,o=0;o<m.length;o++)if(j=m[o].split(":"),2<j.length&&(j[1]=l.map(j,function(a,b){if(b>0)return a}).join(":")),c)-1<l.inArray(j[1],f)&&(b[e]=
j[0],e++);else{if(a.trim(j[1])==a.trim(d)){b[0]=j[0];break}}else if(a.fmatter.isObject(g)||a.isArray(g))c||(f[0]=d),b=l.map(f,function(b){var c;a.each(g,function(a,e){if(e==b){c=a;return false}});if(typeof c!="undefined")return c});return b.join(", ")}return d||""};a.unformat.date=function(d,c){var b=a.jgrid.formatter.date||{};a.fmatter.isUndefined(c.formatoptions)||(b=a.extend({},b,c.formatoptions));return a.fmatter.isEmpty(d)?a.fn.fmatter.defaultFormat(d,c):a.fmatter.util.DateFormat(b.newformat,
d,b.srcformat,b)}})(l);(function(a){a.jgrid.extend({getColProp:function(a){var c={},b=this[0];if(!b.grid)return!1;for(var b=b.p.colModel,f=0;f<b.length;f++)if(b[f].name==a){c=b[f];break}return c},setColProp:function(d,c){return this.each(function(){if(this.grid&&c)for(var b=this.p.colModel,f=0;f<b.length;f++)if(b[f].name==d){a.extend(this.p.colModel[f],c);break}})},sortGrid:function(a,c,b){return this.each(function(){var f=-1;if(this.grid){a||(a=this.p.sortname);for(var d=0;d<this.p.colModel.length;d++)if(this.p.colModel[d].index==
a||this.p.colModel[d].name==a){f=d;break}-1!=f&&(d=this.p.colModel[f].sortable,"boolean"!==typeof d&&(d=!0),"boolean"!==typeof c&&(c=!1),d&&this.sortData("jqgh_"+a,f,c,b))}})},GridDestroy:function(){return this.each(function(){if(this.grid){this.p.pager&&a(this.p.pager).remove();var d=this.id;try{a("#gbox_"+d).remove()}catch(c){}}})},GridUnload:function(){return this.each(function(){if(this.grid){var d={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:d.id});c.className=d.cl;d=this.id;a(c).removeClass("ui-jqgrid-btable");1===a(this.p.pager).parents("#gbox_"+d).length?(a(c).insertBefore("#gbox_"+d).show(),a(this.p.pager).insertBefore("#gbox_"+d)):a(c).insertBefore("#gbox_"+d).show();a("#gbox_"+d).remove()}})},setGridState:function(d){return this.each(function(){this.grid&&("hidden"==d?(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"==d&&(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(d){d=a.extend({autosearch:!0,
searchOnEnter:!0,beforeSearch:null,afterSearch:null,beforeClear:null,afterClear:null,searchurl:"",stringResult:!1,groupOp:"AND",defaultSearch:"bw"},d||{});return this.each(function(){function c(b,c){var d=a(b);d[0]&&l.each(c,function(){void 0!==this.data?d.bind(this.type,this.data,this.fn):d.bind(this.type,this.fn)})}var b=this;if(!this.ftoolbar){var f=function(){var c={},e=0,f,g,j={},l;a.each(b.p.colModel,function(){g=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(g),b.grid.hDiv).val())c[g]=f,j[g]=l,e++;else try{delete b.p.postData[g]}catch(q){}break;case "text":if(l=this.searchoptions&&this.searchoptions.sopt?this.searchoptions.sopt[0]:d.defaultSearch,f=a("#gs_"+a.jgrid.jqID(g),b.grid.hDiv).val())c[g]=f,j[g]=l,e++;else try{delete b.p.postData[g]}catch(s){}}});var q=0<e?!0:!1;if(!0===d.stringResult||"local"==b.p.datatype){var s='{"groupOp":"'+d.groupOp+'","rules":[',u=0;a.each(c,function(a,b){0<u&&
(s+=",");s+='{"field":"'+a+'",';s+='"op":"'+j[a]+'",';s+='"data":"'+(b+"").replace(/\\/g,"\\\\").replace(/\"/g,'\\"')+'"}';u++});s+="]}";a.extend(b.p.postData,{filters:s});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 v;b.p.searchurl&&(v=b.p.url,a(b).jqGrid("setGridParam",{url:b.p.searchurl}));var t=!1;a.isFunction(d.beforeSearch)&&(t=d.beforeSearch.call(b));t||a(b).jqGrid("setGridParam",
{search:q}).trigger("reloadGrid",[{page:1}]);v&&a(b).jqGrid("setGridParam",{url:v});a.isFunction(d.afterSearch)&&d.afterSearch()},g=a("<tr class='ui-search-toolbar' role='rowheader'></tr>"),j;a.each(b.p.colModel,function(){var m=this,e,l,n,r;l=a("<th role='columnheader' class='ui-state-default ui-th-column ui-th-"+b.p.direction+"'></th>");e=a("<div style='width:100%;position:relative;height:100%;padding-right:0.3em;'></div>");!0===this.hidden&&a(l).css("display","none");this.search=!1===this.search?
!1:!0;"undefined"==typeof this.stype&&(this.stype="text");n=a.extend({},this.searchoptions||{});if(this.search)switch(this.stype){case "select":if(r=this.surl||n.dataUrl)a.ajax(a.extend({url:r,dataType:"html",complete:function(b){n.buildSelect!==void 0?(b=n.buildSelect(b))&&a(e).append(b):a(e).append(b.responseText);n.defaultValue&&a("select",e).val(n.defaultValue);a("select",e).attr({name:m.index||m.name,id:"gs_"+m.name});n.attr&&a("select",e).attr(n.attr);a("select",e).css({width:"100%"});n.dataInit!==
void 0&&n.dataInit(a("select",e)[0]);n.dataEvents!==void 0&&c(a("select",e)[0],n.dataEvents);d.autosearch===true&&a("select",e).change(function(){f();return false});b=null}},a.jgrid.ajaxOptions,b.p.ajaxSelectOptions||{}));else{var p;m.searchoptions&&m.searchoptions.value?p=m.searchoptions.value:m.editoptions&&m.editoptions.value&&(p=m.editoptions.value);if(p){r=document.createElement("select");r.style.width="100%";a(r).attr({name:m.index||m.name,id:"gs_"+m.name});var q,s;if("string"===typeof p){p=
p.split(";");for(var u=0;u<p.length;u++)q=p[u].split(":"),s=document.createElement("option"),s.value=q[0],s.innerHTML=q[1],r.appendChild(s)}else if("object"===typeof p)for(q in p)p.hasOwnProperty(q)&&(s=document.createElement("option"),s.value=q,s.innerHTML=p[q],r.appendChild(s));n.defaultValue&&a(r).val(n.defaultValue);n.attr&&a(r).attr(n.attr);void 0!==n.dataInit&&n.dataInit(r);void 0!==n.dataEvents&&c(r,n.dataEvents);a(e).append(r);!0===d.autosearch&&a(r).change(function(){f();return false})}}break;
case "text":r=n.defaultValue?n.defaultValue:"",a(e).append("<input type='text' style='width:95%;padding:0px;' name='"+(m.index||m.name)+"' id='gs_"+m.name+"' value='"+r+"'/>"),n.attr&&a("input",e).attr(n.attr),void 0!==n.dataInit&&n.dataInit(a("input",e)[0]),void 0!==n.dataEvents&&c(a("input",e)[0],n.dataEvents),!0===d.autosearch&&(d.searchOnEnter?a("input",e).keypress(function(a){if((a.charCode?a.charCode:a.keyCode?a.keyCode:0)==13){f();return false}return this}):a("input",e).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:j&&clearTimeout(j);j=setTimeout(function(){f()},500)}}))}a(l).append(e);a(g).append(l)});a("table thead",b.grid.hDiv).append(g);this.ftoolbar=!0;this.triggerToolbar=f;this.clearToolbar=function(c){var e={},f,g=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)e[j]=c,g++;else try{delete b.p.postData[j]}catch(d){}break;case "text":if(a("#gs_"+a.jgrid.jqID(j),b.grid.hDiv).val(f),f)e[j]=f,g++;else try{delete b.p.postData[j]}catch(k){}}});var l=0<g?!0:!1;if(!0===d.stringResult||"local"==b.p.datatype){var q='{"groupOp":"'+d.groupOp+'","rules":[',s=0;a.each(e,function(a,b){0<s&&(q+=",");q+='{"field":"'+a+'",';
q+='"op":"eq",';q+='"data":"'+(b+"").replace(/\\/g,"\\\\").replace(/\"/g,'\\"')+'"}';s++});q+="]}";a.extend(b.p.postData,{filters:q});a.each(["searchField","searchString","searchOper"],function(a,c){b.p.postData.hasOwnProperty(c)&&delete b.p.postData[c]})}else a.extend(b.p.postData,e);var u;b.p.searchurl&&(u=b.p.url,a(b).jqGrid("setGridParam",{url:b.p.searchurl}));var v=!1;a.isFunction(d.beforeClear)&&(v=d.beforeClear.call(b));v||c&&a(b).jqGrid("setGridParam",{search:l}).trigger("reloadGrid",[{page:1}]);
u&&a(b).jqGrid("setGridParam",{url:u});a.isFunction(d.afterClear)&&d.afterClear()};this.toggleToolbar=function(){var c=a("tr.ui-search-toolbar",b.grid.hDiv);"none"==c.css("display")?c.show():c.hide()}}})}})})(l);(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(d,c){c=a.extend({jqm:!0,gb:""},c||{});if(c.onClose){var b=c.onClose(d);if("boolean"==typeof b&&!b)return}if(a.fn.jqm&&!0===c.jqm)a(d).attr("aria-hidden",
"true").jqmHide();else{if(""!==c.gb)try{a(".jqgrid-overlay:first",c.gb).hide()}catch(f){}a(d).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(d,c,b,f,g,j,m){var e=document.createElement("div"),l,n=this,m=a.extend({},m||{});l="rtl"==a(b.gbox).attr("dir")?!0:!1;e.className="ui-widget ui-widget-content ui-corner-all ui-jqdialog";e.id=d.themodal;var r=document.createElement("div");
r.className="ui-jqdialog-titlebar ui-widget-header ui-corner-all ui-helper-clearfix";r.id=d.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);l?(e.dir="rtl",a(".ui-jqdialog-title",r).css("float","right"),a(".ui-jqdialog-titlebar-close",
r).css("left","0.3em")):(e.dir="ltr",a(".ui-jqdialog-title",r).css("float","left"),a(".ui-jqdialog-titlebar-close",r).css("right","0.3em"));var q=document.createElement("div");a(q).addClass("ui-jqdialog-content ui-widget-content").attr("id",d.modalcontent);a(q).append(c);e.appendChild(q);a(e).prepend(r);!0===j?a("body").append(e):"string"==typeof j?a(j).append(e):a(e).insertBefore(f);a(e).css(m);"undefined"===typeof b.jqModal&&(b.jqModal=!0);c={};if(a.fn.jqm&&!0===b.jqModal)0===b.left&&(0===b.top&&
b.overlay)&&(m=[],m=this.findPos(g),b.left=m[0]+4,b.top=m[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("#"+d.themodal).data("onClose")||b.onClose,e=a("#"+d.themodal).data("gbox")||b.gbox;n.hideModal("#"+d.themodal,{gb:e,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||(f=a(f).parents("*[role=dialog]").filter(":first").css("z-index"),
b.zIndex=f?parseInt(f,10)+1:950);f=0;l&&(c.left&&!j)&&(f=a(b.gbox).width()-(!isNaN(b.width)?parseInt(b.width,10):0)-8,c.left=parseInt(c.left,10)+parseInt(f,10));c.left&&(c.left+="px");a(e).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":d.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(e).jqDrag(r);else try{a(e).draggable({handle:a("#"+r.id)})}catch(s){}if(b.resize)if(a.fn.jqResize)a(e).append("<div class='jqResize ui-resizable-handle ui-resizable-se ui-icon ui-icon-gripsmall-diagonal-se ui-icon-grip-diagonal-se'></div>"),a("#"+d.themodal).jqResize(".jqResize",d.scrollelm?"#"+d.scrollelm:!1);else try{a(e).resizable({handles:"se, sw",alsoResize:d.scrollelm?"#"+d.scrollelm:!1})}catch(u){}!0===b.closeOnEscape&&a(e).keydown(function(c){if(c.which==27){c=a("#"+
d.themodal).data("onClose")||b.onClose;n.hideModal(this,{gb:b.gbox,jqm:b.jqModal,onClose:c})}})},viewModal:function(d,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(d).attr("aria-hidden","false").jqm(c).jqmShow():a(d).attr("aria-hidden","false").jqmShow();else{""!==c.gbox&&(a(".jqgrid-overlay:first",c.gbox).show(),a(d).data("gbox",c.gbox));a(d).show().attr("aria-hidden","false");try{a(":input:visible",
d)[0].focus()}catch(b){}}},info_dialog:function(d,c,b,f){var g={width:290,height:"auto",dataheight:"auto",drag:!0,resize:!1,caption:"<b>"+d+"</b>",left:250,top:170,zIndex:1E3,jqModal:!0,modal:!1,closeOnEscape:!0,align:"center",buttonalign:"center",buttons:[]};a.extend(g,f||{});var j=g.jqModal,m=this;a.fn.jqm&&!j&&(j=!1);d="";if(0<g.buttons.length)for(f=0;f<g.buttons.length;f++)"undefined"==typeof g.buttons[f].id&&(g.buttons[f].id="info_button_"+f),d+="<a href='javascript:void(0)' id='"+g.buttons[f].id+
"' class='fm-button ui-state-default ui-corner-all'>"+g.buttons[f].text+"</a>";f=isNaN(g.dataheight)?g.dataheight:g.dataheight+"px";c="<div id='info_id'>"+("<div id='infocnt' style='margin:0px;padding-bottom:1em;width:100%;overflow:auto;position:relative;height:"+f+";"+("text-align:"+g.align+";")+"'>"+c+"</div>");c+=b?"<div class='ui-widget-content ui-helper-clearfix' style='text-align:"+g.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>"+d+"</div>":""!==d?"<div class='ui-widget-content ui-helper-clearfix' style='text-align:"+g.buttonalign+";padding-bottom:0.8em;padding-top:0.5em;background-image: none;border-width: 1px 0 0 0;'>"+d+"</div>":"";c+="</div>";try{"false"==a("#info_dialog").attr("aria-hidden")&&this.hideModal("#info_dialog",{jqm:j}),a("#info_dialog").remove()}catch(e){}this.createModal({themodal:"info_dialog",modalhead:"info_head",modalcontent:"info_content",scrollelm:"infocnt"},c,g,"","",!0);d&&a.each(g.buttons,
function(b){a("#"+this.id,"#info_id").bind("click",function(){g.buttons[b].onClick.call(a("#info_dialog"));return!1})});a("#closedialog","#info_id").click(function(){m.hideModal("#info_dialog",{jqm:j});return!1});a(".fm-button","#info_dialog").hover(function(){a(this).addClass("ui-state-hover")},function(){a(this).removeClass("ui-state-hover")});a.isFunction(g.beforeOpen)&&g.beforeOpen();this.viewModal("#info_dialog",{onHide:function(a){a.w.hide().remove();a.o&&a.o.remove()},modal:g.modal,jqm:j});
a.isFunction(g.afterOpen)&&g.afterOpen();try{a("#info_dialog").focus()}catch(l){}},createEl:function(d,c,b,f,g){function j(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 m(b,c){var e="dataInit dataEvents dataUrl buildSelect sopt searchhidden defaultValue attr".split(" ");a.each(c,function(c,d){-1===a.inArray(c,e)&&a(b).attr(c,d)});c.hasOwnProperty("id")||
a(b).attr("id",a.jgrid.randId())}var e="";switch(d){case "textarea":e=document.createElement("textarea");f?c.cols||a(e).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="";e.value=b;m(e,c);c=j(e,c);a(e).attr({role:"textbox",multiline:"true"});break;case "checkbox":e=document.createElement("input");e.type="checkbox";c.value?(d=c.value.split(":"),b===d[0]&&(e.checked=!0,e.defaultChecked=!0),e.value=d[0],a(e).attr("offval",d[1])):
(d=b.toLowerCase(),0>d.search(/(false|0|no|off|undefined)/i)&&""!==d?(e.checked=!0,e.defaultChecked=!0,e.value=b):e.value="on",a(e).attr("offval","off"));m(e,c);c=j(e,c);a(e).attr("role","checkbox");break;case "select":e=document.createElement("select");e.setAttribute("role","select");f=[];!0===c.multiple?(d=!0,e.multiple="multiple",a(e).attr("aria-multiselectable","true")):d=!1;if("undefined"!=typeof c.dataUrl)a.ajax(a.extend({url:c.dataUrl,type:"GET",dataType:"html",context:{elem:e,options:c,vl:b},
success:function(b){var c=[],e=this.elem,d=this.vl,f=a.extend({},this.options),k=f.multiple===true;typeof f.buildSelect!="undefined"&&(b=f.buildSelect(b));if(b=a(b).html()){a(e).append(b);m(e,f);f=j(e,f);if(typeof f.size==="undefined")f.size=k?3:1;if(k){c=d.split(",");c=a.map(c,function(b){return a.trim(b)})}else c[0]=a.trim(d);setTimeout(function(){a("option",e).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)}}},g||{}));else if(c.value){var l;d?(f=b.split(","),f=a.map(f,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 n,r;if("string"===typeof c.value){n=c.value.split(";");for(l=0;l<n.length;l++){r=n[l].split(":");2<r.length&&(r[1]=a.map(r,function(a,b){if(b>0)return a}).join(":"));g=document.createElement("option");g.setAttribute("role","option");g.value=r[0];g.innerHTML=r[1];if(!d&&(a.trim(r[0])==a.trim(b)||
a.trim(r[1])==a.trim(b)))g.selected="selected";if(d&&(-1<a.inArray(a.trim(r[1]),f)||-1<a.inArray(a.trim(r[0]),f)))g.selected="selected";e.appendChild(g)}}else if("object"===typeof c.value)for(l in n=c.value,n)if(n.hasOwnProperty(l)){g=document.createElement("option");g.setAttribute("role","option");g.value=l;g.innerHTML=n[l];if(!d&&(a.trim(l)==a.trim(b)||a.trim(n[l])==a.trim(b)))g.selected="selected";if(d&&(-1<a.inArray(a.trim(n[l]),f)||-1<a.inArray(a.trim(l),f)))g.selected="selected";e.appendChild(g)}m(e,
c);c=j(e,c)}break;case "text":case "password":case "button":l="button"==d?"button":"textbox";e=document.createElement("input");e.type=d;e.value=b;m(e,c);c=j(e,c);"button"!=d&&(f?c.size||a(e).css({width:"98%"}):c.size||(c.size=20));a(e).attr("role",l);break;case "image":case "file":e=document.createElement("input");e.type=d;m(e,c);c=j(e,c);break;case "custom":e=document.createElement("span");try{if(a.isFunction(c.custom_element))if(n=c.custom_element.call(this,b,c))n=a(n).addClass("customelement").attr({id:c.id,
name:c.name}),a(e).empty().append(n);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 e},checkDate:function(a,c){var b={},d,a=a.toLowerCase();d=-1!=a.indexOf("/")?
"/":-1!=a.indexOf("-")?"-":-1!=a.indexOf(".")?".":"/";a=a.split(d);c=c.split(d);if(3!=c.length)return!1;d=-1;for(var g,j=-1,m=-1,e=0;e<a.length;e++)g=isNaN(c[e])?0:parseInt(c[e],10),b[a[e]]=g,g=a[e],-1!=g.indexOf("y")&&(d=e),-1!=g.indexOf("m")&&(m=e),-1!=g.indexOf("d")&&(j=e);g="y"==a[d]||"yyyy"==a[d]?4:"yy"==a[d]?2:-1;var e=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),l;if(-1===d)return!1;l=b[a[d]].toString();2==g&&1==l.length&&
(g=1);if(l.length!=g||0===b[a[d]]&&"00"!=c[d]||-1===m)return!1;l=b[a[m]].toString();if(1>l.length||(1>b[a[m]]||12<b[a[m]])||-1===j)return!1;l=b[a[j]].toString();return 1>l.length||1>b[a[j]]||31<b[a[j]]||2==b[a[m]]&&b[a[j]]>(0===b[a[d]]%4&&(0!==b[a[d]]%100||0===b[a[d]]%400)?29:28)||b[a[j]]>e[b[a[m]]]?!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(d,c,b,f,g){var j,m;if("undefined"===typeof f)if("string"==typeof c){f=0;for(g=b.p.colModel.length;f<g;f++)if(b.p.colModel[f].name==c){j=b.p.colModel[f].editrules;c=f;try{m=b.p.colModel[f].formoptions.label}catch(e){}break}}else 0<=c&&(j=b.p.colModel[c].editrules);else j=f,m=void 0===g?"_":g;if(j){m||(m=b.p.colNames[c]);if(!0===j.required&&this.isEmpty(d))return[!1,m+": "+a.jgrid.edit.msg.required,""];f=!1===j.required?
!1:!0;if(!0===j.number&&!(!1===f&&this.isEmpty(d))&&isNaN(d))return[!1,m+": "+a.jgrid.edit.msg.number,""];if("undefined"!=typeof j.minValue&&!isNaN(j.minValue)&&parseFloat(d)<parseFloat(j.minValue))return[!1,m+": "+a.jgrid.edit.msg.minValue+" "+j.minValue,""];if("undefined"!=typeof j.maxValue&&!isNaN(j.maxValue)&&parseFloat(d)>parseFloat(j.maxValue))return[!1,m+": "+a.jgrid.edit.msg.maxValue+" "+j.maxValue,""];if(!0===j.email&&!(!1===f&&this.isEmpty(d))&&(g=/^((([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,
!g.test(d)))return[!1,m+": "+a.jgrid.edit.msg.email,""];if(!0===j.integer&&!(!1===f&&this.isEmpty(d))&&(isNaN(d)||0!==d%1||-1!=d.indexOf(".")))return[!1,m+": "+a.jgrid.edit.msg.integer,""];if(!0===j.date&&!(!1===f&&this.isEmpty(d))&&(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,d)))return[!1,m+": "+a.jgrid.edit.msg.date+" - "+c,""];if(!0===j.time&&!(!1===f&&this.isEmpty(d))&&!this.checkTime(d))return[!1,
m+": "+a.jgrid.edit.msg.date+" - hh:mm (am/pm)",""];if(!0===j.url&&!(!1===f&&this.isEmpty(d))&&(g=/^(((https?)|(ftp)):\/\/([\-\w]+\.)+\w{2,3}(\/[%\-\w]+(\.\w{2,})?)*(([\w\-\.\?\\\/+@&#;`~=%!]*)(\.\w{2,})?)*\/?)/i,!g.test(d)))return[!1,m+": "+a.jgrid.edit.msg.url,""];if(!0===j.custom&&!(!1===f&&this.isEmpty(d)))return a.isFunction(j.custom_func)?(d=j.custom_func.call(b,d,m),a.isArray(d)?d:[!1,a.jgrid.edit.msg.customarray,""]):[!1,a.jgrid.edit.msg.customfcheck,""]}return[!0,"",""]}})})(l);(function(a){var k=
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)&&(j=c.beforeShowSearch(a("#"+k)),"undefined"===typeof j&&(j=!0));j&&(a.jgrid.viewModal("#"+m.themodal,{gbox:"#gbox_"+k,jqm:c.jqModal,modal:c.modal,overlay:c.overlay,toTop:c.toTop}),a.isFunction(c.afterShowSearch)&&c.afterShowSearch(a("#"+k)))}var f=this;if(f.grid){var k="fbox_"+
f.p.id,j=!0,m={themodal:"searchmod"+k,modalhead:"searchhd"+k,modalcontent:"searchcnt"+k,scrollelm:k},e=f.p.postData[c.sFilter];"string"===typeof e&&(e=a.jgrid.parse(e));!0===c.recreateFilter&&a("#"+m.themodal).remove();if(null!==a("#"+m.themodal).html())b();else{var l=a("<span><div id='"+k+"' class='searchFilter' style='overflow:auto'></div></span>").insertBefore("#gview_"+f.p.id);if(a.isFunction(c.onInitializeSearch))c.onInitializeSearch(a("#"+k));var n=a.extend([],f.p.colModel),r="<a href='javascript:void(0)' id='"+
k+"_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='"+k+"_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>",q="",s="",u,v=!1;c.showQuery&&(q="<a href='javascript:void(0)' id='"+k+"_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?n=c.columns:a.each(n,function(a,b){b.label||(b.label=f.p.colNames[a]);if(!v){var c="undefined"===typeof b.search?!0:b.search,e=!0===b.hidden;if(b.searchoptions&&!0===b.searchoptions.searchhidden&&c||c&&!e)v=!0,u=b.index||b.name}});if(!e&&u||!1===c.multipleSearch)e={groupOp:"AND",rules:[{field:u,op:"eq",data:""}]};v=!1;c.tmplNames&&c.tmplNames.length&&(v=!0,s=c.tmplLabel,s+="<select class='ui-template'>",s+="<option value='default'>Default</option>",a.each(c.tmplNames,function(a,b){s+=
"<option value='"+a+"'>"+b+"</option>"}),s+="</select>");r="<table class='EditTable' style='border:0px none;margin-top:5px' id='"+k+"_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+s+"</td><td class='EditButton'>"+q+r+"</td></tr></tbody></table>";a("#"+k).jqFilter({columns:n,filter:c.loadDefaults?e: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())}});l.append(r);v&&c.tmplFilters&&c.tmplFilters.length&&a(".ui-template",l).bind("change",function(){var b=a(this).val();b=="default"?a("#"+k).jqFilter("addFilter",e):a("#"+k).jqFilter("addFilter",c.tmplFilters[parseInt(b,10)]);return false});!1===c.multipleSearch&&(a(".add-rule","#"+k).hide(),a(".delete-rule","#"+k).hide());if(a.isFunction(c.onInitializeSearch))c.onInitializeSearch(a("#"+k));c.layer?a.jgrid.createModal(m,
l,c,"#gview_"+f.p.id,a("#gbox_"+f.p.id)[0],"#"+c.layer,{position:"relative"}):a.jgrid.createModal(m,l,c,"#gview_"+f.p.id,a("#gbox_"+f.p.id)[0]);q&&a("#"+k+"_query").bind("click",function(){a(".queryresult",l).toggle();return false});void 0===c.stringResult&&(c.stringResult=c.multipleSearch);a("#"+k+"_search").bind("click",function(){var b=a("#"+k),e={},j,l=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{j=
d.toJson(l,"","",false)}catch(n){try{j=ga.stringify(l)}catch(o){}}if(typeof j==="string"){e[c.sFilter]=j;a.each([c.sField,c.sValue,c.sOper],function(){e[this]=""})}}else if(c.multipleSearch){e[c.sFilter]=l;a.each([c.sField,c.sValue,c.sOper],function(){e[this]=""})}else{e[c.sField]=l.rules[0].field;e[c.sValue]=l.rules[0].data;e[c.sOper]=l.rules[0].op;e[c.sFilter]=""}f.p.search=true;a.extend(f.p.postData,e);if(a.isFunction(c.onSearch))c.onSearch();a(f).trigger("reloadGrid",[{page:1}]);c.closeAfterSearch&&
a.jgrid.hideModal("#"+m.themodal,{gb:"#gbox_"+f.p.id,jqm:c.jqModal,onClose:c.onClose});return false});a("#"+k+"_reset").bind("click",function(){var b={},e=a("#"+k);f.p.search=false;c.multipleSearch===false?b[c.sField]=b[c.sValue]=b[c.sOper]="":b[c.sFilter]="";e[0].resetFilter();v&&a(".ui-template",l).val("default");a.extend(f.p.postData,b);if(a.isFunction(c.onReset))c.onReset();a(f).trigger("reloadGrid",[{page:1}]);return false});b();a(".fm-button:not(.ui-state-disabled)",l).hover(function(){a(this).addClass("ui-state-hover")},
function(){a(this).removeClass("ui-state-hover")})}}})},editGridRow:function(c,b){k=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 d(){a(".FormElement","#"+t).each(function(){var b=a(".customelement",this);if(b.length){var c=a(b[0]).attr("name");a.each(s.p.colModel,function(){if(this.name===c&&this.editoptions&&a.isFunction(this.editoptions.custom_value)){try{if(F[c]=
this.editoptions.custom_value(a("#"+a.jgrid.jqID(c),"#"+t),"get"),void 0===F[c])throw"e1";}catch(b){"e1"===b?a.jgrid.info_dialog(l.jgrid.errors.errcap,"function 'custom_value' "+a.jgrid.edit.msg.novalue,l.jgrid.edit.bClose):a.jgrid.info_dialog(l.jgrid.errors.errcap,b.message,l.jgrid.edit.bClose)}return!0}})}else{switch(a(this).get(0).type){case "checkbox":a(this).attr("checked")?F[this.name]=a(this).val():(b=a(this).attr("offval"),F[this.name]=b);break;case "select-one":F[this.name]=a("option:selected",
this).val();B[this.name]=a("option:selected",this).text();break;case "select-multiple":F[this.name]=a(this).val();F[this.name]=F[this.name]?F[this.name].join(","):"";var e=[];a("option:selected",this).each(function(b,c){e[b]=a(c).text()});B[this.name]=e.join(",");break;case "password":case "text":case "textarea":case "button":F[this.name]=a(this).val()}s.p.autoencode&&(F[this.name]=a.jgrid.htmlEncode(F[this.name]))}});return!0}function g(b,c,e,d){var f,g,j=0,m,l,n,o=[],p=!1,q="",r;for(r=1;r<=d;r++)q+=
"<td class='CaptionTD'>&#160;</td><td class='DataTD'>&#160;</td>";"_empty"!=b&&(p=a(c).jqGrid("getInd",b));a(c.p.colModel).each(function(r){f=this.name;l=(this.editrules&&!0===this.editrules.edithidden?0:!0===this.hidden)?"style='display:none'":"";if("cb"!==f&&"subgrid"!==f&&!0===this.editable&&"rn"!==f){if(!1===p)m="";else if(f==c.p.ExpandColumn&&!0===c.p.treeGrid)m=a("td:eq("+r+")",c.rows[p]).text();else try{m=a.unformat(a("td:eq("+r+")",c.rows[p]),{rowId:b,colModel:this},r)}catch(t){m=a("td:eq("+
r+")",c.rows[p]).text()}var u=a.extend({},this.editoptions||{},{id:f,name:f}),v=a.extend({},{elmprefix:"",elmsuffix:"",rowabove:!1,rowcontent:""},this.formoptions||{}),x=parseInt(v.rowpos,10)||j+1,y=parseInt(2*(parseInt(v.colpos,10)||1),10);"_empty"==b&&u.defaultValue&&(m=a.isFunction(u.defaultValue)?u.defaultValue():u.defaultValue);this.edittype||(this.edittype="text");s.p.autoencode&&(m=a.jgrid.htmlDecode(m));n=a.jgrid.createEl(this.edittype,u,m,!1,a.extend({},a.jgrid.ajaxOptions,c.p.ajaxSelectOptions||
{}));""===m&&"checkbox"==this.edittype&&(m=a(n).attr("offval"));""===m&&"select"==this.edittype&&(m=a("option:eq(0)",n).text());if(k.checkOnSubmit||k.checkOnUpdate)k._savedData[f]=m;a(n).addClass("FormElement");("text"==this.edittype||"textarea"==this.edittype)&&a(n).addClass("ui-widget-content ui-corner-all");g=a(e).find("tr[rowpos="+x+"]");v.rowabove&&(u=a("<tr><td class='contentinfo' colspan='"+2*d+"'>"+v.rowcontent+"</td></tr>"),a(e).append(u),u[0].rp=x);0===g.length&&(g=a("<tr "+l+" rowpos='"+
x+"'></tr>").addClass("FormData").attr("id","tr_"+f),a(g).append(q),a(e).append(g),g[0].rp=x);a("td:eq("+(y-2)+")",g[0]).html("undefined"===typeof v.label?c.p.colNames[r]:v.label);a("td:eq("+(y-1)+")",g[0]).append(v.elmprefix).append(n).append(v.elmsuffix);o[j]=r;j++}});if(0<j&&(r=a("<tr class='FormData' style='display:none'><td class='CaptionTD'></td><td colspan='"+(2*d-1)+"' class='DataTD'><input class='FormElement' id='id_g' type='text' name='"+c.p.id+"_id' value='"+b+"'/></td></tr>"),r[0].rp=
j+999,a(e).append(r),k.checkOnSubmit||k.checkOnUpdate))k._savedData[c.p.id+"_id"]=b;return o}function j(b,c,e){var d,f=0,g,j,m,n,p;if(k.checkOnSubmit||k.checkOnUpdate)k._savedData={},k._savedData[c.p.id+"_id"]=b;var o=c.p.colModel;if("_empty"==b)a(o).each(function(){d=this.name;m=a.extend({},this.editoptions||{});if((j=a("#"+a.jgrid.jqID(d),"#"+e))&&null!==j[0])if(n="",m.defaultValue?(n=a.isFunction(m.defaultValue)?m.defaultValue():m.defaultValue,"checkbox"==j[0].type?(p=n.toLowerCase(),0>p.search(/(false|0|no|off|undefined)/i)&&
""!==p?(j[0].checked=!0,j[0].defaultChecked=!0,j[0].value=n):j.attr({checked:"",defaultChecked:""})):j.val(n)):"checkbox"==j[0].type?(j[0].checked=!1,j[0].defaultChecked=!1,n=a(j).attr("offval")):j[0].type&&"select"==j[0].type.substr(0,6)?j[0].selectedIndex=0:j.val(n),!0===k.checkOnSubmit||k.checkOnUpdate)k._savedData[d]=n}),a("#id_g","#"+e).val(b);else{var q=a(c).jqGrid("getInd",b,!0);q&&(a("td",q).each(function(j){d=o[j].name;if("cb"!==d&&"subgrid"!==d&&"rn"!==d&&!0===o[j].editable){if(d==c.p.ExpandColumn&&
!0===c.p.treeGrid)g=a(this).text();else try{g=a.unformat(a(this),{rowId:b,colModel:o[j]},j)}catch(m){g=a(this).text()}s.p.autoencode&&(g=a.jgrid.htmlDecode(g));if(!0===k.checkOnSubmit||k.checkOnUpdate)k._savedData[d]=g;d=a.jgrid.jqID(d);switch(o[j].edittype){case "password":case "text":case "button":case "image":a("#"+d,"#"+e).val(g);break;case "textarea":if("&nbsp;"==g||"&#160;"==g||1==g.length&&160==g.charCodeAt(0))g="";a("#"+d,"#"+e).val(g);break;case "select":var n=g.split(","),n=a.map(n,function(b){return a.trim(b)});
a("#"+d+" option","#"+e).each(function(){this.selected=!o[j].editoptions.multiple&&(n[0]==a.trim(a(this).text())||n[0]==a.trim(a(this).val()))?!0:o[j].editoptions.multiple?-1<a.inArray(a.trim(a(this).text()),n)||-1<a.inArray(a.trim(a(this).val()),n)?!0:!1:!1});break;case "checkbox":g+="";o[j].editoptions&&o[j].editoptions.value?o[j].editoptions.value.split(":")[0]==g?(a("#"+d,"#"+e).attr("checked",!0),a("#"+d,"#"+e).attr("defaultChecked",!0)):(a("#"+d,"#"+e).attr("checked",!1),a("#"+d,"#"+e).attr("defaultChecked",
"")):(g=g.toLowerCase(),0>g.search(/(false|0|no|off|undefined)/i)&&""!==g?(a("#"+d,"#"+e).attr("checked",!0),a("#"+d,"#"+e).attr("defaultChecked",!0)):(a("#"+d,"#"+e).attr("checked",!1),a("#"+d,"#"+e).attr("defaultChecked","")));break;case "custom":try{if(o[j].editoptions&&a.isFunction(o[j].editoptions.custom_value))o[j].editoptions.custom_value(a("#"+d,"#"+e),"set",g);else throw"e1";}catch(p){"e1"==p?a.jgrid.info_dialog(l.jgrid.errors.errcap,"function 'custom_value' "+a.jgrid.edit.msg.nodefined,
l.jgrid.edit.bClose):a.jgrid.info_dialog(l.jgrid.errors.errcap,p.message,l.jgrid.edit.bClose)}}f++}}),0<f&&a("#id_g","#"+t).val(b))}}function m(){var c,e=[!0,"",""],d={},f=s.p.prmNames,g,m,l,n;if(a.isFunction(k.beforeCheckValues)){var o=k.beforeCheckValues(F,a("#"+v),"_empty"==F[s.p.id+"_id"]?f.addoper:f.editoper);o&&"object"===typeof o&&(F=o)}for(l in F)if(F.hasOwnProperty(l)&&(e=a.jgrid.checkValues(F[l],l,s),!1===e[0]))break;e[0]&&(a.isFunction(k.onclickSubmit)&&(d=k.onclickSubmit(k,F)||{}),a.isFunction(k.beforeSubmit)&&
(e=k.beforeSubmit(F,a("#"+v))));if(e[0]&&!k.processing){k.processing=!0;a("#sData","#"+t+"_2").addClass("ui-state-active");m=f.oper;g=f.id;F[m]="_empty"==a.trim(F[s.p.id+"_id"])?f.addoper:f.editoper;F[m]!=f.addoper?F[g]=F[s.p.id+"_id"]:void 0===F[g]&&(F[g]=F[s.p.id+"_id"]);delete F[s.p.id+"_id"];F=a.extend(F,k.editData,d);if(!0===s.p.treeGrid)for(i in F[m]==f.addoper&&(n=a(s).jqGrid("getGridParam","selrow"),F["adjacency"==s.p.treeGridModel?s.p.treeReader.parent_id_field:"parent_id"]=n),s.p.treeReader)d=
s.p.treeReader[i],F.hasOwnProperty(d)&&(F[m]==f.addoper&&"parent_id_field"===i||delete F[d]);d=a.extend({url:k.url?k.url:a(s).jqGrid("getGridParam","editurl"),type:k.mtype,data:a.isFunction(k.serializeEditData)?k.serializeEditData(F):F,complete:function(d,l){if(l!="success"){e[0]=false;e[1]=a.isFunction(k.errorTextFormat)?k.errorTextFormat(d):l+" Status: '"+d.statusText+"'. Error code: "+d.status}else a.isFunction(k.afterSubmit)&&(e=k.afterSubmit(d,F));if(e[0]===false){a("#FormError>td","#"+t).html(e[1]);
a("#FormError","#"+t).show()}else{a.each(s.p.colModel,function(){if(B[this.name]&&this.formatter&&this.formatter=="select")try{delete B[this.name]}catch(a){}});F=a.extend(F,B);s.p.autoencode&&a.each(F,function(b,c){F[b]=a.jgrid.htmlDecode(c)});k.reloadAfterSubmit=k.reloadAfterSubmit&&s.p.datatype!="local";if(F[m]==f.addoper){e[2]||(e[2]=a.jgrid.randId());F[g]=e[2];if(k.closeAfterAdd){if(k.reloadAfterSubmit)a(s).trigger("reloadGrid");else if(s.p.treeGrid===true)a(s).jqGrid("addChildNode",e[2],n,F);
else{a(s).jqGrid("addRowData",e[2],F,b.addedrow);a(s).jqGrid("setSelection",e[2])}a.jgrid.hideModal("#"+x.themodal,{gb:"#gbox_"+u,jqm:b.jqModal,onClose:k.onClose})}else if(k.clearAfterAdd){k.reloadAfterSubmit?a(s).trigger("reloadGrid"):s.p.treeGrid===true?a(s).jqGrid("addChildNode",e[2],n,F):a(s).jqGrid("addRowData",e[2],F,b.addedrow);j("_empty",s,v)}else k.reloadAfterSubmit?a(s).trigger("reloadGrid"):s.p.treeGrid===true?a(s).jqGrid("addChildNode",e[2],n,F):a(s).jqGrid("addRowData",e[2],F,b.addedrow)}else{if(k.reloadAfterSubmit){a(s).trigger("reloadGrid");
k.closeAfterEdit||setTimeout(function(){a(s).jqGrid("setSelection",F[g])},1E3)}else s.p.treeGrid===true?a(s).jqGrid("setTreeRow",F[g],F):a(s).jqGrid("setRowData",F[g],F);k.closeAfterEdit&&a.jgrid.hideModal("#"+x.themodal,{gb:"#gbox_"+u,jqm:b.jqModal,onClose:k.onClose})}if(a.isFunction(k.afterComplete)){c=d;setTimeout(function(){k.afterComplete(c,F,a("#"+v));c=null},500)}if(k.checkOnSubmit||k.checkOnUpdate){a("#"+v).data("disabled",false);if(k._savedData[s.p.id+"_id"]!="_empty")for(var o in k._savedData)F[o]&&
(k._savedData[o]=F[o])}}k.processing=false;a("#sData","#"+t+"_2").removeClass("ui-state-active");try{a(":input:visible","#"+v)[0].focus()}catch(p){}}},a.jgrid.ajaxOptions,k.ajaxEditOptions);!d.url&&!k.useDataProxy&&(a.isFunction(s.p.dataProxy)?k.useDataProxy=!0:(e[0]=!1,e[1]+=" "+a.jgrid.errors.nourl));e[0]&&(k.useDataProxy?s.p.dataProxy.call(s,d,"set_"+s.p.id):a.ajax(d))}!1===e[0]&&(a("#FormError>td","#"+t).html(e[1]),a("#FormError","#"+t).show())}function e(a,b){var c=!1,e;for(e in a)if(a[e]!=b[e]){c=
!0;break}return c}function o(){a.each(s.p.colModel,function(a,b){b.editoptions&&!0===b.editoptions.NullIfEmpty&&F.hasOwnProperty(b.name)&&""==F[b.name]&&(F[b.name]="null")})}function n(){var b=!0;a("#FormError","#"+t).hide();k.checkOnUpdate&&(F={},B={},d(),O=a.extend({},F,B),e(O,k._savedData)?(a("#"+v).data("disabled",!0),a(".confirm","#"+x.themodal).show(),b=!1):o());return b}function r(){if("_empty"!==c&&"undefined"!==typeof s.p.savedRow&&0<s.p.savedRow.length&&a.isFunction(a.fn.jqGrid.restoreRow))for(var b=
0;b<s.p.savedRow.length;b++)if(s.p.savedRow[b].id==c){a(s).jqGrid("restoreRow",c);break}}function p(b,c){0===b?a("#pData","#"+t+"_2").addClass("ui-state-disabled"):a("#pData","#"+t+"_2").removeClass("ui-state-disabled");b==c?a("#nData","#"+t+"_2").addClass("ui-state-disabled"):a("#nData","#"+t+"_2").removeClass("ui-state-disabled")}function q(){var b=a(s).jqGrid("getDataIDs"),c=a("#id_g","#"+t).val();return[a.inArray(c,b),b]}var s=this;if(s.grid&&c){var u=s.p.id,v="FrmGrid_"+u,t="TblGrid_"+u,x={themodal:"editmod"+
u,modalhead:"edithd"+u,modalcontent:"editcnt"+u,scrollelm:v},y=a.isFunction(k.beforeShowForm)?k.beforeShowForm:!1,z=a.isFunction(k.afterShowForm)?k.afterShowForm:!1,E=a.isFunction(k.beforeInitData)?k.beforeInitData:!1,A=a.isFunction(k.onInitializeForm)?k.onInitializeForm:!1,C=!0,J=1,S=0,F,B,O;"new"===c?(c="_empty",b.caption=k.addCaption):b.caption=k.editCaption;!0===b.recreateForm&&null!==a("#"+x.themodal).html()&&a("#"+x.themodal).remove();var Y=!0;b.checkOnUpdate&&(b.jqModal&&!b.modal)&&(Y=!1);
if(null!==a("#"+x.themodal).html()){E&&(C=E(a("#"+v)),"undefined"==typeof C&&(C=!0));if(!1===C)return;r();a(".ui-jqdialog-title","#"+x.modalhead).html(b.caption);a("#FormError","#"+t).hide();k.topinfo?(a(".topinfo","#"+t+"_2").html(k.topinfo),a(".tinfo","#"+t+"_2").show()):a(".tinfo","#"+t+"_2").hide();k.bottominfo?(a(".bottominfo","#"+t+"_2").html(k.bottominfo),a(".binfo","#"+t+"_2").show()):a(".binfo","#"+t+"_2").hide();j(c,s,v);"_empty"==c||!k.viewPagerButtons?a("#pData, #nData","#"+t+"_2").hide():
a("#pData, #nData","#"+t+"_2").show();!0===k.processing&&(k.processing=!1,a("#sData","#"+t+"_2").removeClass("ui-state-active"));!0===a("#"+v).data("disabled")&&(a(".confirm","#"+x.themodal).hide(),a("#"+v).data("disabled",!1));y&&y(a("#"+v));a("#"+x.themodal).data("onClose",k.onClose);a.jgrid.viewModal("#"+x.themodal,{gbox:"#gbox_"+u,jqm:b.jqModal,jqM:!1,overlay:b.overlay,modal:b.modal});Y||a(".jqmOverlay").click(function(){if(!n())return false;a.jgrid.hideModal("#"+x.themodal,{gb:"#gbox_"+u,jqm:b.jqModal,
onClose:k.onClose});return false});z&&z(a("#"+v))}else{var R=isNaN(b.dataheight)?b.dataheight:b.dataheight+"px",R=a("<form name='FormPost' id='"+v+"' class='FormGrid' onSubmit='return false;' style='width:100%;overflow:auto;position:relative;height:"+R+";'></form>").data("disabled",!1),V=a("<table id='"+t+"' class='EditTable' cellspacing='0' cellpadding='0' border='0'><tbody></tbody></table>");E&&(C=E(a("#"+v)),"undefined"==typeof C&&(C=!0));if(!1===C)return;r();a(s.p.colModel).each(function(){var a=
this.formoptions;J=Math.max(J,a?a.colpos||0:0);S=Math.max(S,a?a.rowpos||0:0)});a(R).append(V);E=a("<tr id='FormError' style='display:none'><td class='ui-state-error' colspan='"+2*J+"'></td></tr>");E[0].rp=0;a(V).append(E);E=a("<tr style='display:none' class='tinfo'><td class='topinfo' colspan='"+2*J+"'>"+k.topinfo+"</td></tr>");E[0].rp=0;a(V).append(E);var C=(E="rtl"==s.p.direction?!0:!1)?"nData":"pData",G=E?"pData":"nData";g(c,s,V,J);var C="<a href='javascript:void(0)' id='"+C+"' 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>",N="<a href='javascript:void(0)' id='sData' class='fm-button ui-state-default ui-corner-all'>"+b.bSubmit+"</a>",H="<a href='javascript:void(0)' id='cData' class='fm-button ui-state-default ui-corner-all'>"+b.bCancel+"</a>",C="<table border='0' cellspacing='0' cellpadding='0' class='EditTable' id='"+t+"_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+C:C+G)+"</td><td class='EditButton'>"+N+H+"</td></tr>"+("<tr style='display:none' class='binfo'><td class='bottominfo' colspan='2'>"+k.bottominfo+"</td></tr>"),C=C+"</tbody></table>";if(0<S){var T=[];a.each(a(V)[0].rows,function(a,b){T[a]=b});T.sort(function(a,b){return a.rp>b.rp?1:a.rp<b.rp?-1:0});a.each(T,function(b,c){a("tbody",V).append(c)})}b.gbox="#gbox_"+u;var Z=!1;!0===b.closeOnEscape&&(b.closeOnEscape=!1,Z=!0);R=a("<span></span>").append(R).append(C);a.jgrid.createModal(x,R,b,"#gview_"+
s.p.id,a("#gbox_"+s.p.id)[0]);E&&(a("#pData, #nData","#"+t+"_2").css("float","right"),a(".EditButton","#"+t+"_2").css("text-align","left"));k.topinfo&&a(".tinfo","#"+t+"_2").show();k.bottominfo&&a(".binfo","#"+t+"_2").show();C=R=null;a("#"+x.themodal).keydown(function(c){var e=c.target;if(a("#"+v).data("disabled")===true)return false;if(k.savekey[0]===true&&c.which==k.savekey[1]&&e.tagName!="TEXTAREA"){a("#sData","#"+t+"_2").trigger("click");return false}if(c.which===27){if(!n())return false;Z&&a.jgrid.hideModal(this,
{gb:b.gbox,jqm:b.jqModal,onClose:k.onClose});return false}if(k.navkeys[0]===true){if(a("#id_g","#"+t).val()=="_empty")return true;if(c.which==k.navkeys[1]){a("#pData","#"+t+"_2").trigger("click");return false}if(c.which==k.navkeys[2]){a("#nData","#"+t+"_2").trigger("click");return false}}});b.checkOnUpdate&&(a("a.ui-jqdialog-titlebar-close span","#"+x.themodal).removeClass("jqmClose"),a("a.ui-jqdialog-titlebar-close","#"+x.themodal).unbind("click").click(function(){if(!n())return false;a.jgrid.hideModal("#"+
x.themodal,{gb:"#gbox_"+u,jqm:b.jqModal,onClose:k.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","#"+t+"_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","#"+t+"_2").addClass("right"==b.closeicon[1]?"fm-button-icon-right":"fm-button-icon-left").append("<span class='ui-icon "+
b.closeicon[2]+"'></span>");if(k.checkOnSubmit||k.checkOnUpdate)N="<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>",H="<a href='javascript:void(0)' id='cNew' class='fm-button ui-state-default ui-corner-all' style='z-index:1002'>"+b.bExit+"</a>",R=b.zIndex||999,R++,a("<div class='ui-widget-overlay jqgrid-overlay confirm' style='z-index:"+
R+";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:"+(R+1)+"'>"+b.saveData+"<br/><br/>"+N+G+H+"</div>").insertAfter("#"+v),a("#sNew","#"+x.themodal).click(function(){m();a("#"+v).data("disabled",false);a(".confirm","#"+x.themodal).hide();return false}),a("#nNew","#"+x.themodal).click(function(){a(".confirm",
"#"+x.themodal).hide();a("#"+v).data("disabled",false);setTimeout(function(){a(":input","#"+v)[0].focus()},0);return false}),a("#cNew","#"+x.themodal).click(function(){a(".confirm","#"+x.themodal).hide();a("#"+v).data("disabled",false);a.jgrid.hideModal("#"+x.themodal,{gb:"#gbox_"+u,jqm:b.jqModal,onClose:k.onClose});return false});A&&A(a("#"+v));"_empty"==c||!k.viewPagerButtons?a("#pData,#nData","#"+t+"_2").hide():a("#pData,#nData","#"+t+"_2").show();y&&y(a("#"+v));a("#"+x.themodal).data("onClose",
k.onClose);a.jgrid.viewModal("#"+x.themodal,{gbox:"#gbox_"+u,jqm:b.jqModal,overlay:b.overlay,modal:b.modal});Y||a(".jqmOverlay").click(function(){if(!n())return false;a.jgrid.hideModal("#"+x.themodal,{gb:"#gbox_"+u,jqm:b.jqModal,onClose:k.onClose});return false});z&&z(a("#"+v));a(".fm-button","#"+x.themodal).hover(function(){a(this).addClass("ui-state-hover")},function(){a(this).removeClass("ui-state-hover")});a("#sData","#"+t+"_2").click(function(){F={};B={};a("#FormError","#"+t).hide();d();o();
if(F[s.p.id+"_id"]=="_empty")m();else if(b.checkOnSubmit===true){O=a.extend({},F,B);if(e(O,k._savedData)){a("#"+v).data("disabled",true);a(".confirm","#"+x.themodal).show()}else m()}else m();return false});a("#cData","#"+t+"_2").click(function(){if(!n())return false;a.jgrid.hideModal("#"+x.themodal,{gb:"#gbox_"+u,jqm:b.jqModal,onClose:k.onClose});return false});a("#nData","#"+t+"_2").click(function(){if(!n())return false;a("#FormError","#"+t).hide();var c=q();c[0]=parseInt(c[0],10);if(c[0]!=-1&&c[1][c[0]+
1]){if(a.isFunction(b.onclickPgButtons))b.onclickPgButtons("next",a("#"+v),c[1][c[0]]);j(c[1][c[0]+1],s,v);a(s).jqGrid("setSelection",c[1][c[0]+1]);a.isFunction(b.afterclickPgButtons)&&b.afterclickPgButtons("next",a("#"+v),c[1][c[0]+1]);p(c[0]+1,c[1].length-1)}return false});a("#pData","#"+t+"_2").click(function(){if(!n())return false;a("#FormError","#"+t).hide();var c=q();if(c[0]!=-1&&c[1][c[0]-1]){if(a.isFunction(b.onclickPgButtons))b.onclickPgButtons("prev",a("#"+v),c[1][c[0]]);j(c[1][c[0]-1],
s,v);a(s).jqGrid("setSelection",c[1][c[0]-1]);a.isFunction(b.afterclickPgButtons)&&b.afterclickPgButtons("prev",a("#"+v),c[1][c[0]-1]);p(c[0]-1,c[1].length-1)}return false})}y=q();p(y[0],y[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 d(){(!0===b.closeOnEscape||!0===b.navkeys[0])&&setTimeout(function(){a(".ui-jqdialog-titlebar-close","#"+q.modalhead).focus()},0)}function k(c,e,d,f){for(var g,j,m,l=0,n,p,o=[],q=!1,r="<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>",s="",t=["integer","number","currency"],u=0,v=0,x,y,z,A=1;A<=f;A++)s+=1==A?r:"<td class='CaptionTD form-view-label ui-widget-content'>&#160;</td><td class='DataTD form-view-data ui-widget-content'>&#160;</td>";
a(e.p.colModel).each(function(){j=this.editrules&&!0===this.editrules.edithidden?!1:!0===this.hidden?!0:!1;!j&&"right"===this.align&&(this.formatter&&-1!==a.inArray(this.formatter,t)?u=Math.max(u,parseInt(this.width,10)):v=Math.max(v,parseInt(this.width,10)))});x=0!==u?u:0!==v?v:0;q=a(e).jqGrid("getInd",c);a(e.p.colModel).each(function(b){g=this.name;y=!1;p=(j=this.editrules&&!0===this.editrules.edithidden?!1:!0===this.hidden?!0:!1)?"style='display:none'":"";z="boolean"!=typeof this.viewable?!0:this.viewable;
if("cb"!==g&&"subgrid"!==g&&"rn"!==g&&z){n=!1===q?"":g==e.p.ExpandColumn&&!0===e.p.treeGrid?a("td:eq("+b+")",e.rows[q]).text():a("td:eq("+b+")",e.rows[q]).html();y="right"===this.align&&0!==x?!0:!1;a.extend({},this.editoptions||{},{id:g,name:g});var c=a.extend({},{rowabove:!1,rowcontent:""},this.formoptions||{}),k=parseInt(c.rowpos,10)||l+1,r=parseInt(2*(parseInt(c.colpos,10)||1),10);if(c.rowabove){var t=a("<tr><td class='contentinfo' colspan='"+2*f+"'>"+c.rowcontent+"</td></tr>");a(d).append(t);
t[0].rp=k}m=a(d).find("tr[rowpos="+k+"]");0===m.length&&(m=a("<tr "+p+" rowpos='"+k+"'></tr>").addClass("FormData").attr("id","trv_"+g),a(m).append(s),a(d).append(m),m[0].rp=k);a("td:eq("+(r-2)+")",m[0]).html("<b>"+("undefined"===typeof c.label?e.p.colNames[b]:c.label)+"</b>");a("td:eq("+(r-1)+")",m[0]).append("<span>"+n+"</span>").attr("id","v_"+g);y&&a("td:eq("+(r-1)+") span",m[0]).css({"text-align":"right",width:x+"px"});o[l]=b;l++}});0<l&&(c=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='id' value='"+c+"'/></td></tr>"),c[0].rp=l+99,a(d).append(c));return o}function j(b,c){var e,d,f=0,k,g;if(g=a(c).jqGrid("getInd",b,!0))a("td",g).each(function(b){e=c.p.colModel[b].name;d=c.p.colModel[b].editrules&&!0===c.p.colModel[b].editrules.edithidden?!1:!0===c.p.colModel[b].hidden?!0:!1;"cb"!==e&&("subgrid"!==e&&"rn"!==e)&&(k=e==c.p.ExpandColumn&&!0===c.p.treeGrid?a(this).text():a(this).html(),a.extend({},c.p.colModel[b].editoptions||
{}),e=a.jgrid.jqID("v_"+e),a("#"+e+" span","#"+p).html(k),d&&a("#"+e,"#"+p).parents("tr:first").hide(),f++)}),0<f&&a("#id_g","#"+p).val(b)}function m(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 e(){var b=a(l).jqGrid("getDataIDs"),c=a("#id_g","#"+p).val();return[a.inArray(c,b),b]}var l=this;if(l.grid&&
c){b.imgpath||(b.imgpath=l.p.imgpath);var n=l.p.id,r="ViewGrid_"+n,p="ViewTbl_"+n,q={themodal:"viewmod"+n,modalhead:"viewhd"+n,modalcontent:"viewcnt"+n,scrollelm:r},s=a.isFunction(b.beforeInitData)?b.beforeInitData:!1,u=!0,v=1,t=0;if(null!==a("#"+q.themodal).html()){s&&(u=s(a("#"+r)),"undefined"==typeof u&&(u=!0));if(!1===u)return;a(".ui-jqdialog-title","#"+q.modalhead).html(b.caption);a("#FormError","#"+p).hide();j(c,l);a.isFunction(b.beforeShowForm)&&b.beforeShowForm(a("#"+r));a.jgrid.viewModal("#"+
q.themodal,{gbox:"#gbox_"+n,jqm:b.jqModal,jqM:!1,overlay:b.overlay,modal:b.modal});d()}else{var x=isNaN(b.dataheight)?b.dataheight:b.dataheight+"px",x=a("<form name='FormPost' id='"+r+"' class='FormGrid' style='width:100%;overflow:auto;position:relative;height:"+x+";'></form>"),y=a("<table id='"+p+"' class='EditTable' cellspacing='1' cellpadding='2' border='0' style='table-layout:fixed'><tbody></tbody></table>");s&&(u=s(a("#"+r)),"undefined"==typeof u&&(u=!0));if(!1===u)return;a(l.p.colModel).each(function(){var a=
this.formoptions;v=Math.max(v,a?a.colpos||0:0);t=Math.max(t,a?a.rowpos||0:0)});a(x).append(y);k(c,l,y,v);var s="rtl"==l.p.direction?!0:!1,u="<a href='javascript:void(0)' id='"+(s?"nData":"pData")+"' class='fm-button ui-state-default ui-corner-left'><span class='ui-icon ui-icon-triangle-1-w'></span></a>",z="<a href='javascript:void(0)' id='"+(s?"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<t){var A=[];a.each(a(y)[0].rows,function(a,b){A[a]=b});A.sort(function(a,b){return a.rp>b.rp?1:a.rp<b.rp?-1:0});a.each(A,function(b,c){a("tbody",y).append(c)})}b.gbox="#gbox_"+n;var C=!1;!0===b.closeOnEscape&&(b.closeOnEscape=!1,C=!0);x=a("<span></span>").append(x).append("<table border='0' class='EditTable' id='"+p+"_2'><tbody><tr id='Act_Buttons'><td class='navButton' width='"+b.labelswidth+"'>"+(s?z+u:u+z)+"</td><td class='EditButton'>"+E+"</td></tr></tbody></table>");a.jgrid.createModal(q,
x,b,"#gview_"+l.p.id,a("#gview_"+l.p.id)[0]);s&&(a("#pData, #nData","#"+p+"_2").css("float","right"),a(".EditButton","#"+p+"_2").css("text-align","left"));b.viewPagerButtons||a("#pData, #nData","#"+p+"_2").hide();x=null;a("#"+q.themodal).keydown(function(c){if(c.which===27){C&&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("#"+q.themodal,{gbox:"#gbox_"+n,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")});d();a("#cData","#"+p+"_2").click(function(){a.jgrid.hideModal("#"+q.themodal,{gb:"#gbox_"+n,jqm:b.jqModal,onClose:b.onClose});return false});a("#nData","#"+p+"_2").click(function(){a("#FormError","#"+p).hide();var c=e();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]]);j(c[1][c[0]+1],l);a(l).jqGrid("setSelection",c[1][c[0]+1]);a.isFunction(b.afterclickPgButtons)&&b.afterclickPgButtons("next",
a("#"+r),c[1][c[0]+1]);m(c[0]+1,c[1].length-1)}d();return false});a("#pData","#"+p+"_2").click(function(){a("#FormError","#"+p).hide();var c=e();if(c[0]!=-1&&c[1][c[0]-1]){if(a.isFunction(b.onclickPgButtons))b.onclickPgButtons("prev",a("#"+r),c[1][c[0]]);j(c[1][c[0]-1],l);a(l).jqGrid("setSelection",c[1][c[0]-1]);a.isFunction(b.afterclickPgButtons)&&b.afterclickPgButtons("prev",a("#"+r),c[1][c[0]-1]);m(c[0]-1,c[1].length-1)}d();return false})}x=e();m(x[0],x[1].length-1)}})},delGridRow:function(c,b){k=
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 d=this;if(d.grid&&c){var g="function"===typeof b.beforeShowForm?
!0:!1,j="function"===typeof b.afterShowForm?!0:!1,m=a.isFunction(b.beforeInitData)?b.beforeInitData:!1,e=d.p.id,o={},n=!0,r="DelTbl_"+e,p,q,s,u,v={themodal:"delmod"+e,modalhead:"delhd"+e,modalcontent:"delcnt"+e,scrollelm:r};l.isArray(c)&&(c=c.join());if(null!==a("#"+v.themodal).html()){m&&(n=m(a("#"+r)),"undefined"==typeof n&&(n=!0));if(!1===n)return;a("#DelData>td","#"+r).text(c);a("#DelError","#"+r).hide();!0===k.processing&&(k.processing=!1,a("#dData","#"+r).removeClass("ui-state-active"));g&&
b.beforeShowForm(a("#"+r));a.jgrid.viewModal("#"+v.themodal,{gbox:"#gbox_"+e,jqm:b.jqModal,jqM:!1,overlay:b.overlay,modal:b.modal})}else{var t=isNaN(b.dataheight)?b.dataheight:b.dataheight+"px",t="<div id='"+r+"' class='formdata' style='width:100%;overflow:auto;position:relative;height:"+t+";'><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>"),t=t+('<tr><td class="delmsg" style="white-space:pre;">'+
b.msg+"</td></tr><tr><td >&#160;</td></tr>"),t=t+"</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_"+e;a.jgrid.createModal(v,t,b,"#gview_"+d.p.id,a("#gview_"+d.p.id)[0]);m&&(n=m(a("#"+r)),"undefined"==typeof n&&(n=!0));if(!1===n)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,""];o={};var g=a("#DelData>td","#"+r).text();typeof b.onclickSubmit==="function"&&(o=b.onclickSubmit(k,g)||{});typeof b.beforeSubmit==="function"&&(c=b.beforeSubmit(g));
if(c[0]&&!k.processing){k.processing=true;a(this).addClass("ui-state-active");s=d.p.prmNames;p=a.extend({},k.delData,o);u=s.oper;p[u]=s.deloper;q=s.id;p[q]=g;var j=a.extend({url:k.url?k.url:a(d).jqGrid("getGridParam","editurl"),type:b.mtype,data:a.isFunction(b.serializeDelData)?b.serializeDelData(p):p,complete:function(j,m){if(m!="success"){c[0]=false;c[1]=a.isFunction(k.errorTextFormat)?k.errorTextFormat(j):m+" Status: '"+j.statusText+"'. Error code: "+j.status}else typeof k.afterSubmit==="function"&&
(c=k.afterSubmit(j,p));if(c[0]===false){a("#DelError>td","#"+r).html(c[1]);a("#DelError","#"+r).show()}else{if(k.reloadAfterSubmit&&d.p.datatype!="local")a(d).trigger("reloadGrid");else{var l=[],l=g.split(",");if(d.p.treeGrid===true)try{a(d).jqGrid("delTreeNode",l[0])}catch(n){}else for(var o=0;o<l.length;o++)a(d).jqGrid("delRowData",l[o]);d.p.selrow=null;d.p.selarrrow=[]}a.isFunction(k.afterComplete)&&setTimeout(function(){k.afterComplete(j,g)},500)}k.processing=false;a("#dData","#"+r+"_2").removeClass("ui-state-active");
c[0]&&a.jgrid.hideModal("#"+v.themodal,{gb:"#gbox_"+e,jqm:b.jqModal,onClose:k.onClose})}},a.jgrid.ajaxOptions,b.ajaxDelOptions);if(!j.url&&!k.useDataProxy)if(a.isFunction(d.p.dataProxy))k.useDataProxy=true;else{c[0]=false;c[1]=c[1]+(" "+a.jgrid.errors.nourl)}c[0]&&(k.useDataProxy?d.p.dataProxy.call(d,j,"del_"+d.p.id):a.ajax(j))}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("#"+v.themodal,{gb:"#gbox_"+
e,jqm:b.jqModal,onClose:k.onClose});return false});g&&b.beforeShowForm(a("#"+r));a.jgrid.viewModal("#"+v.themodal,{gbox:"#gbox_"+e,jqm:b.jqModal,overlay:b.overlay,modal:b.modal})}j&&b.afterShowForm(a("#"+r));!0===b.closeOnEscape&&setTimeout(function(){a(".ui-jqdialog-titlebar-close","#"+v.modalhead).focus()},0)}})},navGrid:function(c,b,d,k,j,m,e){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 l={themodal:"alertmod",modalhead:"alerthd",modalcontent:"alertcnt"},n=this,r,p,q;if(n.grid&&"string"==typeof c){null===a("#"+l.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(l,"<div>"+b.alerttext+"</div><span tabindex='0'><span tabindex='-1' id='jqg_alrt'></span></span>",{gbox:"#gbox_"+n.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&&n.p.toppager&&
(r=2);for(p=0;p<r;p++){var s=a("<table cellspacing='0' cellpadding='0' border='0' class='ui-pg-table navtable' style='float:left;table-layout:auto;'><tbody><tr></tr></tbody></table>"),u,v;0===p?(u=c,v=n.p.id,u==n.p.toppager&&(v+="_top",r=1)):(u=n.p.toppager,v=n.p.id+"_top");"rtl"==n.p.direction&&a(s).attr("dir","rtl").css("float","right");b.add&&(k=k||{},q=a("<td class='ui-pg-button ui-corner-all'></td>"),a(q).append("<div class='ui-pg-div'><span class='ui-icon "+b.addicon+"'></span>"+b.addtext+"</div>"),
a("tr",s).append(q),a(q,s).attr({title:b.addtitle||"",id:k.id||"add_"+v}).click(function(){a(this).hasClass("ui-state-disabled")||(typeof b.addfunc=="function"?b.addfunc():a(n).jqGrid("editGridRow","new",k));return false}).hover(function(){a(this).hasClass("ui-state-disabled")||a(this).addClass("ui-state-hover")},function(){a(this).removeClass("ui-state-hover")}),q=null);b.edit&&(q=a("<td class='ui-pg-button ui-corner-all'></td>"),d=d||{},a(q).append("<div class='ui-pg-div'><span class='ui-icon "+
b.editicon+"'></span>"+b.edittext+"</div>"),a("tr",s).append(q),a(q,s).attr({title:b.edittitle||"",id:d.id||"edit_"+v}).click(function(){if(!a(this).hasClass("ui-state-disabled")){var c=n.p.selrow;if(c)typeof b.editfunc=="function"?b.editfunc(c):a(n).jqGrid("editGridRow",c,d);else{a.jgrid.viewModal("#"+l.themodal,{gbox:"#gbox_"+n.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")}),
q=null);b.view&&(q=a("<td class='ui-pg-button ui-corner-all'></td>"),e=e||{},a(q).append("<div class='ui-pg-div'><span class='ui-icon "+b.viewicon+"'></span>"+b.viewtext+"</div>"),a("tr",s).append(q),a(q,s).attr({title:b.viewtitle||"",id:e.id||"view_"+v}).click(function(){if(!a(this).hasClass("ui-state-disabled")){var b=n.p.selrow;if(b)a(n).jqGrid("viewGridRow",b,e);else{a.jgrid.viewModal("#"+l.themodal,{gbox:"#gbox_"+n.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")}),q=null);b.del&&(q=a("<td class='ui-pg-button ui-corner-all'></td>"),j=j||{},a(q).append("<div class='ui-pg-div'><span class='ui-icon "+b.delicon+"'></span>"+b.deltext+"</div>"),a("tr",s).append(q),a(q,s).attr({title:b.deltitle||"",id:j.id||"del_"+v}).click(function(){if(!a(this).hasClass("ui-state-disabled")){var c;if(n.p.multiselect){c=n.p.selarrrow;c.length===0&&(c=null)}else c=n.p.selrow;if(c)"function"==typeof b.delfunc?
b.delfunc(c):a(n).jqGrid("delGridRow",c,j);else{a.jgrid.viewModal("#"+l.themodal,{gbox:"#gbox_"+n.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")}),q=null);(b.add||b.edit||b.del||b.view)&&a("tr",s).append("<td class='ui-pg-button ui-state-disabled' style='width:4px;'><span class='ui-separator'></span></td>");b.search&&(q=a("<td class='ui-pg-button ui-corner-all'></td>"),
m=m||{},a(q).append("<div class='ui-pg-div'><span class='ui-icon "+b.searchicon+"'></span>"+b.searchtext+"</div>"),a("tr",s).append(q),a(q,s).attr({title:b.searchtitle||"",id:m.id||"search_"+v}).click(function(){a(this).hasClass("ui-state-disabled")||a(n).jqGrid("searchGrid",m);return false}).hover(function(){a(this).hasClass("ui-state-disabled")||a(this).addClass("ui-state-hover")},function(){a(this).removeClass("ui-state-hover")}),m.showOnLoad&&!0===m.showOnLoad&&a(q,s).click(),q=null);b.refresh&&
(q=a("<td class='ui-pg-button ui-corner-all'></td>"),a(q).append("<div class='ui-pg-div'><span class='ui-icon "+b.refreshicon+"'></span>"+b.refreshtext+"</div>"),a("tr",s).append(q),a(q,s).attr({title:b.refreshtitle||"",id:"refresh_"+v}).click(function(){if(!a(this).hasClass("ui-state-disabled")){a.isFunction(b.beforeRefresh)&&b.beforeRefresh();n.p.search=false;try{var c=n.p.id;n.p.postData.filters="";a("#fbox_"+c).jqFilter("resetFilter");a.isFunction(n.clearToolbar)&&n.clearToolbar(false)}catch(e){}switch(b.refreshstate){case "firstpage":a(n).trigger("reloadGrid",
[{page:1}]);break;case "current":a(n).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")}),q=null);q=a(".ui-jqgrid").css("font-size")||"11px";a("body").append("<div id='testpg2' class='ui-jqgrid ui-widget ui-widget-content' style='font-size:"+q+";visibility:hidden;' ></div>");q=a(s).clone().appendTo("#testpg2").width();
a("#testpg2").remove();a(u+"_"+b.position,u).append(s);n.p._nvtd&&(q>n.p._nvtd[0]&&(a(u+"_"+b.position,u).width(q),n.p._nvtd[0]=q),n.p._nvtd[1]=q);s=q=q=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 d=a(".navtable",c)[0],k=this;if(d&&!(b.id&&null!==a("#"+b.id,d).html())){var j=a("<td></td>");
"NONE"==b.buttonicon.toString().toUpperCase()?a(j).addClass("ui-pg-button ui-corner-all").append("<div class='ui-pg-div'>"+b.caption+"</div>"):a(j).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(j).attr("id",b.id);"first"==b.position?0===d.rows[0].cells.length?a("tr",d).append(j):a("tr td:eq(0)",d).before(j):a("tr",d).append(j);a(j,d).attr("title",b.title||"").click(function(c){a(this).hasClass("ui-state-disabled")||
a.isFunction(b.onClickButton)&&b.onClickButton.call(k,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 d=a(".navtable",c)[0];if(d){var k="<td class='ui-pg-button ui-state-disabled' style='width:4px;'><span class='"+b.sepclass+
"'></span>"+b.sepcontent+"</td>";a("tr",d).append(k)}}})},GridToForm:function(c,b){return this.each(function(){if(this.grid){var d=a(this).jqGrid("getRowData",c);if(d)for(var k in d)a("[name="+a.jgrid.jqID(k)+"]",b).is("input:radio")||a("[name="+a.jgrid.jqID(k)+"]",b).is("input:checkbox")?a("[name="+a.jgrid.jqID(k)+"]",b).each(function(){a(this).val()==d[k]?a(this).attr("checked","checked"):a(this).attr("checked","")}):a("[name="+a.jgrid.jqID(k)+"]",b).val(d[k])}})},FormToGrid:function(c,b,d,k){return this.each(function(){if(this.grid){d||
(d="set");k||(k="first");var j=a(b).serializeArray(),m={};a.each(j,function(a,b){m[b.name]=b.value});"add"==d?a(this).jqGrid("addRowData",c,m,k):"set"==d&&a(this).jqGrid("setRowData",c,m)}})}})})(l);(function(a){a.fn.jqFilter=function(d){if("string"===typeof d){var c=a.fn.jqFilter[d];if(!c)throw"jqFilter - No such method: "+d;var b=a.makeArray(arguments).slice(1);return c.apply(this,b)}var f=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},d||{});return this.each(function(){if(!this.filter){this.p=f;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,d,e=/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(d=this.p.columns[b],d.stype?d.inputtype=d.stype:
d.inputtype||(d.inputtype="text"),d.sorttype?d.searchtype=d.sorttype:d.searchtype||(d.searchtype="string"),void 0===d.hidden&&(d.hidden=!1),d.label||(d.label=d.name),d.index&&(d.name=d.index),d.hasOwnProperty("searchoptions")||(d.searchoptions={}),!d.hasOwnProperty("searchrules"))d.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 k=
function(b,c){var e=[!0,""];if(a.isFunction(c.searchrules))e=c.searchrules(b,c);else if(a.jgrid&&a.jgrid.checkValues)try{e=a.jgrid.checkValues(b,-1,null,c.searchrules,c.label)}catch(d){}e&&(e.length&&!1===e[0])&&(f.error=!e[0],f.errmsg=e[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(f.filter,null);a(this).append(b)};
this.createTableForGroup=function(b,c){var e=this,d,k=a("<table class='group ui-widget ui-widget-content' style='border:0px none;'><tbody></tbody></table>");null===c&&a(k).append("<tr class='error' style='display:none;'><th colspan='5' class='ui-state-error' align='left'></th></tr>");var g=a("<tr></tr>");a(k).append(g);var j=a("<th colspan='5' align='left'></th>");g.append(j);var m=a("<select class='opsel'></select>");j.append(m);var g="",l;for(d=0;d<f.groupOps.length;d++)l=b.groupOp===e.p.groupOps[d]?
" selected='selected'":"",g+="<option value='"+e.p.groupOps[d]+"'"+l+">"+e.p.groupOps[d]+"</option>";m.append(g).bind("change",function(){b.groupOp=a(m).val();e.onchange()});g="<span></span>";this.p.groupButton&&(g=a("<input type='button' value='+ {}' title='Add subgroup' class='add-group'/>"),g.bind("click",function(){void 0===b.groups&&(b.groups=[]);b.groups.push({groupOp:f.groupOps[0],rules:[],groups:[]});e.reDraw();e.onchange();return!1}));j.append(g);var g=a("<input type='button' value='+' title='Add rule' class='add-rule ui-add'/>"),
o;g.bind("click",function(){if(b.rules===void 0)b.rules=[];for(d=0;d<e.p.columns.length;d++){var a=typeof e.p.columns[d].search==="undefined"?true:e.p.columns[d].search,c=e.p.columns[d].hidden===true;if(e.p.columns[d].searchoptions.searchhidden===true&&a||a&&!c){o=e.p.columns[d];break}}b.rules.push({field:o.name,op:(o.searchoptions.sopt?o.searchoptions.sopt:e.p.sopt?e.p.sopt:o.searchtype==="string"?e.p.stropts:e.p.numopts)[0],data:""});e.reDraw();return false});j.append(g);null!==c&&(g=a("<input type='button' value='-' title='Delete group' class='delete-group'/>"),
j.append(g),g.bind("click",function(){for(d=0;d<c.groups.length;d++)if(c.groups[d]===b){c.groups.splice(d,1);break}e.reDraw();e.onchange();return false}));if(void 0!==b.groups)for(d=0;d<b.groups.length;d++)j=a("<tr></tr>"),k.append(j),g=a("<td class='first'></td>"),j.append(g),g=a("<td colspan='4'></td>"),g.append(this.createTableForGroup(b.groups[d],b)),j.append(g);void 0===b.groupOp&&(b.groupOp=e.p.groupOps[0]);if(void 0!==b.rules)for(d=0;d<b.rules.length;d++)k.append(this.createTableRowForRule(b.rules[d],
b));return k};this.createTableRowForRule=function(b,c){var d=this,k=a("<tr></tr>"),g,j,m,l,o="",y;k.append("<td class='first'></td>");var z=a("<td class='columns'></td>");k.append(z);var E=a("<select></select>");z.append(E);E.bind("change",function(){b.field=a(E).val();m=a(this).parents("tr:first");for(g=0;g<d.p.columns.length;g++)if(d.p.columns[g].name===b.field){l=d.p.columns[g];break}if(l){l.searchoptions.id=a.jgrid.randId();e&&"text"===l.inputtype&&!l.searchoptions.size&&(l.searchoptions.size=
10);var c=a.jgrid.createEl(l.inputtype,l.searchoptions,"",!0,d.p.ajaxSelectOptions,!0);a(c).addClass("input-elm");j=l.searchoptions.sopt?l.searchoptions.sopt:d.p.sopt?d.p.sopt:"string"===l.searchtype?d.p.stropts:d.p.numopts;var f="",k="";for(g=0;g<d.p.ops.length;g++)-1!==a.inArray(d.p.ops[g].name,j)&&(k=b.op===d.p.ops[g].name?" selected=selected":"",f+="<option value='"+d.p.ops[g].name+"'"+k+">"+d.p.ops[g].description+"</option>");a(".selectopts",m).empty().append(f);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(",");d.onchange()});setTimeout(function(){b.data=a(c).val();d.onchange()},0)}});for(g=z=0;g<d.p.columns.length;g++){y="undefined"===typeof d.p.columns[g].search?!0:d.p.columns[g].search;var A=!0===d.p.columns[g].hidden;if(!0===d.p.columns[g].searchoptions.searchhidden&&y||y&&!A)y="",b.field===d.p.columns[g].name&&(y=" selected='selected'",z=g),o+="<option value='"+d.p.columns[g].name+"'"+y+">"+
d.p.columns[g].label+"</option>"}E.append(o);o=a("<td class='operators'></td>");k.append(o);l=f.columns[z];l.searchoptions.id=a.jgrid.randId();e&&"text"===l.inputtype&&!l.searchoptions.size&&(l.searchoptions.size=10);var z=a.jgrid.createEl(l.inputtype,l.searchoptions,b.data,!0,d.p.ajaxSelectOptions,!0),C=a("<select class='selectopts'></select>");o.append(C);C.bind("change",function(){b.op=a(C).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")}d.onchange()});j=l.searchoptions.sopt?l.searchoptions.sopt:d.p.sopt?d.p.sopt:"string"===l.searchtype?f.stropts:d.p.numopts;o="";for(g=0;g<d.p.ops.length;g++)-1!==a.inArray(d.p.ops[g].name,j)&&(y=b.op===d.p.ops[g].name?" selected='selected'":"",o+="<option value='"+d.p.ops[g].name+"'"+y+">"+d.p.ops[g].description+"</option>");C.append(o);o=a("<td class='data'></td>");
k.append(o);o.append(z);a(z).addClass("input-elm").bind("change",function(){b.data=a(this).val();if(a.isArray(b.data))b.data=b.data.join(",");d.onchange()});o=a("<td></td>");k.append(o);z=a("<input type='button' value='-' title='Delete rule' class='delete-rule ui-del'/>");o.append(z);z.bind("click",function(){for(g=0;g<c.rules.length;g++)if(c.rules[g]===b){c.rules.splice(g,1);break}d.reDraw();d.onchange();return false});return k};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(e){alert(e)}}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(d){alert(d)}b+=")";return"()"===b?"":b};this.getStringForRule=function(b){var c="",e="",d,g;for(d=0;d<this.p.ops.length;d++)if(this.p.ops[d].name===b.op){c=this.p.ops[d].operator;e=this.p.ops[d].name;break}for(d=0;d<this.p.columns.length;d++)if(this.p.columns[d].name===
b.field){g=this.p.columns[d];break}d=b.data;if("bw"===e||"bn"===e)d+="%";if("ew"===e||"en"===e)d="%"+d;if("cn"===e||"nc"===e)d="%"+d+"%";if("in"===e||"ni"===e)d=" ("+d+")";f.errorcheck&&k(b.data,g);return-1!==a.inArray(g.searchtype,["int","integer","float","number","currency"])||"nn"===e||"nu"===e?b.field+" "+c+" "+d:b.field+" "+c+' "'+d+'"'};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(f.filter)};this.toString=function(){function a(c){var e="(",d;if(void 0!==c.groups)for(d=0;d<c.groups.length;d++)1<e.length&&(e+="OR"===c.groupOp?" || ":" && "),e+=a(c.groups[d]);if(void 0!==c.rules)for(d=0;d<c.rules.length;d++){1<e.length&&(e+="OR"===c.groupOp?" || ":" && ");var f=c.rules[d];if(b.p.errorcheck){for(var g=
void 0,j=void 0,g=0;g<b.p.columns.length;g++)if(b.p.columns[g].name===f.field){j=b.p.columns[g];break}j&&k(f.data,j)}e+=f.op+"(item."+f.field+",'"+f.data+"')"}e+=")";return"()"===e?"":e}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=l.jgrid.parse(a));this.each(function(){this.p.filter=a;this.reDraw();this.onchange()})}})})(l);(function(a){a.jgrid.extend({editRow:function(d,c,b,f,g,j,m,e,l){var n={keys:c||!1,oneditfunc:b||null,successfunc:f||null,url:g||null,extraparam:j||{},aftersavefunc:m||null,errorfunc:e||null,afterrestorefunc:l||null,restoreAfterErorr:!0},r=a.makeArray(arguments).slice(1),
p;p=r[0]&&"object"==typeof r[0]&&!a.isFunction(r[0])?a.extend(n,r[0]):n;return this.each(function(){var b=this,c,e,f=0,g=null,j={},m,n;if(b.grid&&(m=a(b).jqGrid("getInd",d,!0),!1!==m&&"0"==(a(m).attr("editable")||"0")&&!a(m).hasClass("not-editable-row")))n=b.p.colModel,a("td",m).each(function(m){c=n[m].name;var l=!0===b.p.treeGrid&&c==b.p.ExpandColumn;if(l)e=a("span:first",this).html();else try{e=a.unformat(this,{rowId:d,colModel:n[m]},m)}catch(o){e=a(this).html()}if("cb"!=c&&("subgrid"!=c&&"rn"!=
c)&&(b.p.autoencode&&(e=a.jgrid.htmlDecode(e)),j[c]=e,!0===n[m].editable)){null===g&&(g=m);l?a("span:first",this).html(""):a(this).html("");var p=a.extend({},n[m].editoptions||{},{id:d+"_"+c,name:c});n[m].edittype||(n[m].edittype="text");p=a.jgrid.createEl(n[m].edittype,p,e,!0,a.extend({},a.jgrid.ajaxOptions,b.p.ajaxSelectOptions||{}));a(p).addClass("editable");l?a("span:first",this).append(p):a(this).append(p);"select"==n[m].edittype&&!0===n[m].editoptions.multiple&&a.browser.msie&&a(p).width(a(p).width());
f++}}),0<f&&(j.id=d,b.p.savedRow.push(j),a(m).attr("editable","1"),a("td:eq("+g+") input",m).focus(),!0===p.keys&&a(m).bind("keydown",function(c){27===c.keyCode&&a(b).jqGrid("restoreRow",d,l);if(13===c.keyCode){if("TEXTAREA"==c.target.tagName)return!0;a(b).jqGrid("saveRow",d,p);return!1}c.stopPropagation()}),a.isFunction(p.oneditfunc)&&p.oneditfunc.call(b,d))})},saveRow:function(d,c,b,f,g,j,m){var e={successfunc:c||null,url:b||null,extraparam:f||{},aftersavefunc:g||null,errorfunc:j||null,afterrestorefunc:m||
null,restoreAfterErorr:!0},o=a.makeArray(arguments).slice(1),n;n=o[0]&&"object"==typeof o[0]&&!a.isFunction(o[0])?a.extend(e,o[0]):e;var r=!1,p=this[0],q,s={},u={},v={},t,x,y;if(!p.grid)return r;y=a(p).jqGrid("getInd",d,!0);if(!1===y)return r;e=a(y).attr("editable");n.url=n.url?n.url:p.p.editurl;if("1"===e){var z;a("td",y).each(function(b){z=p.p.colModel[b];q=z.name;if("cb"!=q&&"subgrid"!=q&&!0===z.editable&&"rn"!=q&&!a(this).hasClass("not-editable-cell")){switch(z.edittype){case "checkbox":var c=
["Yes","No"];z.editoptions&&(c=z.editoptions.value.split(":"));s[q]=a("input",this).attr("checked")?c[0]:c[1];break;case "text":case "password":case "textarea":case "button":s[q]=a("input, textarea",this).val();break;case "select":if(z.editoptions.multiple){var c=a("select",this),e=[];s[q]=a(c).val();s[q]=s[q]?s[q].join(","):"";a("select > option:selected",this).each(function(b,c){e[b]=a(c).text()});u[q]=e.join(",")}else s[q]=a("select>option:selected",this).val(),u[q]=a("select>option:selected",
this).text();z.formatter&&"select"==z.formatter&&(u={});break;case "custom":try{if(z.editoptions&&a.isFunction(z.editoptions.custom_value)){if(s[q]=z.editoptions.custom_value.call(p,a(".customelement",this),"get"),void 0===s[q])throw"e2";}else throw"e1";}catch(d){"e1"==d&&a.jgrid.info_dialog(l.jgrid.errors.errcap,"function 'custom_value' "+a.jgrid.edit.msg.nodefined,l.jgrid.edit.bClose),"e2"==d?a.jgrid.info_dialog(l.jgrid.errors.errcap,"function 'custom_value' "+a.jgrid.edit.msg.novalue,l.jgrid.edit.bClose):
a.jgrid.info_dialog(l.jgrid.errors.errcap,d.message,l.jgrid.edit.bClose)}}x=a.jgrid.checkValues(s[q],b,p);if(!1===x[0])return x[1]=s[q]+" "+x[1],!1;p.p.autoencode&&(s[q]=a.jgrid.htmlEncode(s[q]));"clientArray"!==n.url&&z.editoptions&&!0===z.editoptions.NullIfEmpty&&""==s[q]&&(v[q]="null")}});if(!1===x[0]){try{var E=a.jgrid.findPos(a("#"+a.jgrid.jqID(d),p.grid.bDiv)[0]);a.jgrid.info_dialog(a.jgrid.errors.errcap,x[1],a.jgrid.edit.bClose,{left:E[0],top:E[1]})}catch(A){alert(x[1])}return r}s&&(e=p.p.prmNames,
o=e.oper,E=e.id,s[o]=e.editoper,s[E]=d,"undefined"==typeof p.p.inlineData&&(p.p.inlineData={}),s=a.extend({},s,p.p.inlineData,n.extraparam));if("clientArray"==n.url){s=a.extend({},s,u);p.p.autoencode&&a.each(s,function(b,c){s[b]=a.jgrid.htmlDecode(c)});E=a(p).jqGrid("setRowData",d,s);a(y).attr("editable","0");for(e=0;e<p.p.savedRow.length;e++)if(p.p.savedRow[e].id==d){t=e;break}0<=t&&p.p.savedRow.splice(t,1);a.isFunction(n.aftersavefunc)&&n.aftersavefunc.call(p,d,E);r=!0}else a("#lui_"+p.p.id).show(),
v=a.extend({},s,v),a.ajax(a.extend({url:n.url,data:a.isFunction(p.p.serializeRowData)?p.p.serializeRowData.call(p,v):v,type:"POST",async:!1,complete:function(b,c){a("#lui_"+p.p.id).hide();if(c==="success")if((a.isFunction(n.succesfunc)?n.succesfunc.call(p,b):true)===true){p.p.autoencode&&a.each(s,function(b,c){s[b]=a.jgrid.htmlDecode(c)});s=a.extend({},s,u);a(p).jqGrid("setRowData",d,s);a(y).attr("editable","0");for(var e=0;e<p.p.savedRow.length;e++)if(p.p.savedRow[e].id==d){t=e;break}t>=0&&p.p.savedRow.splice(t,
1);a.isFunction(n.aftersavefunc)&&n.aftersavefunc.call(p,d,b);r=true}else{a.isFunction(n.errorfunc)&&n.errorfunc.call(p,d,b,c);n.restoreAfterError===true&&a(p).jqGrid("restoreRow",d,n.afterrestorefunc)}},error:function(b,c){a("#lui_"+p.p.id).hide();if(a.isFunction(n.errorfunc))n.errorfunc.call(p,d,b,c);else try{l.jgrid.info_dialog(l.jgrid.errors.errcap,'<div class="ui-state-error">'+b.responseText+"</div>",l.jgrid.edit.bClose,{buttonalign:"right"})}catch(e){alert(b.responseText)}n.restoreAfterError===
true&&a(p).jqGrid("restoreRow",d,n.afterrestorefunc)}},a.jgrid.ajaxOptions,p.p.ajaxRowOptions||{}));a(y).unbind("keydown")}return r},restoreRow:function(d,c){return this.each(function(){var b=this,f,g,j={};if(b.grid&&(g=a(b).jqGrid("getInd",d,!0),!1!==g)){for(var m=0;m<b.p.savedRow.length;m++)if(b.p.savedRow[m].id==d){f=m;break}if(0<=f){if(a.isFunction(a.fn.datepicker))try{a("input.hasDatepicker","#"+a.jgrid.jqID(g.id)).datepicker("hide")}catch(e){}a.each(b.p.colModel,function(){!0===this.editable&&
(this.name in b.p.savedRow[f]&&!a(this).hasClass("not-editable-cell"))&&(j[this.name]=b.p.savedRow[f][this.name])});a(b).jqGrid("setRowData",d,j);a(g).attr("editable","0").unbind("keydown");b.p.savedRow.splice(f,1)}a.isFunction(c)&&c.call(b,d)}})}})})(l);(function(a){a.jgrid.extend({editCell:function(d,c,b){return this.each(function(){var f=this,g,j,m;if(f.grid&&!0===f.p.cellEdit){c=parseInt(c,10);f.p.selrow=f.rows[d].id;f.p.knv||a(f).jqGrid("GridNav");if(0<f.p.savedRow.length){if(!0===b&&d==f.p.iRow&&
c==f.p.iCol)return;a(f).jqGrid("saveCell",f.p.savedRow[0].id,f.p.savedRow[0].ic)}else window.setTimeout(function(){a("#"+f.p.knv).attr("tabindex","-1").focus()},0);g=f.p.colModel[c].name;if(!("subgrid"==g||"cb"==g||"rn"==g)){m=a("td:eq("+c+")",f.rows[d]);if(!0===f.p.colModel[c].editable&&!0===b&&!m.hasClass("not-editable-cell")){0<=parseInt(f.p.iCol,10)&&0<=parseInt(f.p.iRow,10)&&(a("td:eq("+f.p.iCol+")",f.rows[f.p.iRow]).removeClass("edit-cell ui-state-highlight"),a(f.rows[f.p.iRow]).removeClass("selected-row ui-state-hover"));
a(m).addClass("edit-cell ui-state-highlight");a(f.rows[d]).addClass("selected-row ui-state-hover");try{j=a.unformat(m,{rowId:f.rows[d].id,colModel:f.p.colModel[c]},c)}catch(e){j=a(m).html()}f.p.autoencode&&(j=a.jgrid.htmlDecode(j));f.p.colModel[c].edittype||(f.p.colModel[c].edittype="text");f.p.savedRow.push({id:d,ic:c,name:g,v:j});if(a.isFunction(f.p.formatCell)){var l=f.p.formatCell.call(f,f.rows[d].id,g,j,d,c);void 0!==l&&(j=l)}var l=a.extend({},f.p.colModel[c].editoptions||{},{id:d+"_"+g,name:g}),
n=a.jgrid.createEl(f.p.colModel[c].edittype,l,j,!0,a.extend({},a.jgrid.ajaxOptions,f.p.ajaxSelectOptions||{}));a.isFunction(f.p.beforeEditCell)&&f.p.beforeEditCell.call(f,f.rows[d].id,g,j,d,c);a(m).html("").append(n).attr("tabindex","0");window.setTimeout(function(){a(n).focus()},0);a("input, select, textarea",m).bind("keydown",function(b){b.keyCode===27&&(a("input.hasDatepicker",m).length>0?a(".ui-datepicker").is(":hidden")?a(f).jqGrid("restoreCell",d,c):a("input.hasDatepicker",m).datepicker("hide"):
a(f).jqGrid("restoreCell",d,c));b.keyCode===13&&a(f).jqGrid("saveCell",d,c);if(b.keyCode==9){if(f.grid.hDiv.loading)return false;b.shiftKey?a(f).jqGrid("prevCell",d,c):a(f).jqGrid("nextCell",d,c)}b.stopPropagation()});a.isFunction(f.p.afterEditCell)&&f.p.afterEditCell.call(f,f.rows[d].id,g,j,d,c)}else if(0<=parseInt(f.p.iCol,10)&&0<=parseInt(f.p.iRow,10)&&(a("td:eq("+f.p.iCol+")",f.rows[f.p.iRow]).removeClass("edit-cell ui-state-highlight"),a(f.rows[f.p.iRow]).removeClass("selected-row ui-state-hover")),
m.addClass("edit-cell ui-state-highlight"),a(f.rows[d]).addClass("selected-row ui-state-hover"),a.isFunction(f.p.onSelectCell))j=m.html().replace(/\&#160\;/ig,""),f.p.onSelectCell.call(f,f.rows[d].id,g,j,d,c);f.p.iCol=c;f.p.iRow=d}}})},saveCell:function(d,c){return this.each(function(){var b=this,f;if(b.grid&&!0===b.p.cellEdit){f=1<=b.p.savedRow.length?0:null;if(null!==f){var g=a("td:eq("+c+")",b.rows[d]),j,m,e=b.p.colModel[c],o=e.name,n=a.jgrid.jqID(o);switch(e.edittype){case "select":if(e.editoptions.multiple){var n=
a("#"+d+"_"+n,b.rows[d]),r=[];(j=a(n).val())?j.join(","):j="";a("option:selected",n).each(function(b,c){r[b]=a(c).text()});m=r.join(",")}else j=a("#"+d+"_"+n+">option:selected",b.rows[d]).val(),m=a("#"+d+"_"+n+">option:selected",b.rows[d]).text();e.formatter&&(m=j);break;case "checkbox":var p=["Yes","No"];e.editoptions&&(p=e.editoptions.value.split(":"));m=j=a("#"+d+"_"+n,b.rows[d]).attr("checked")?p[0]:p[1];break;case "password":case "text":case "textarea":case "button":m=j=a("#"+d+"_"+n,b.rows[d]).val();
break;case "custom":try{if(e.editoptions&&a.isFunction(e.editoptions.custom_value)){j=e.editoptions.custom_value.call(b,a(".customelement",g),"get");if(void 0===j)throw"e2";m=j}else throw"e1";}catch(q){"e1"==q&&a.jgrid.info_dialog(l.jgrid.errors.errcap,"function 'custom_value' "+a.jgrid.edit.msg.nodefined,l.jgrid.edit.bClose),"e2"==q?a.jgrid.info_dialog(l.jgrid.errors.errcap,"function 'custom_value' "+a.jgrid.edit.msg.novalue,l.jgrid.edit.bClose):a.jgrid.info_dialog(l.jgrid.errors.errcap,q.message,
l.jgrid.edit.bClose)}}if(m!=b.p.savedRow[f].v){if(a.isFunction(b.p.beforeSaveCell)&&(f=b.p.beforeSaveCell.call(b,b.rows[d].id,o,j,d,c)))m=j=f;var s=a.jgrid.checkValues(j,c,b);if(!0===s[0]){f={};a.isFunction(b.p.beforeSubmitCell)&&((f=b.p.beforeSubmitCell.call(b,b.rows[d].id,o,j,d,c))||(f={}));0<a("input.hasDatepicker",g).length&&a("input.hasDatepicker",g).datepicker("hide");if("remote"==b.p.cellsubmit)if(b.p.cellurl){var u={};b.p.autoencode&&(j=a.jgrid.htmlEncode(j));u[o]=j;p=b.p.prmNames;e=p.id;
n=p.oper;u[e]=b.rows[d].id;u[n]=p.editoper;u=a.extend(f,u);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,u):u,type:"POST",complete:function(e,f){a("#lui_"+b.p.id).hide();b.grid.hDiv.loading=!1;if("success"==f)if(a.isFunction(b.p.afterSubmitCell)){var l=b.p.afterSubmitCell.call(b,e,u.id,o,j,d,c);!0===l[0]?(a(g).empty(),a(b).jqGrid("setCell",b.rows[d].id,c,m,!1,!1,!0),a(g).addClass("dirty-cell"),
a(b.rows[d]).addClass("edited"),a.isFunction(b.p.afterSaveCell)&&b.p.afterSaveCell.call(b,b.rows[d].id,o,j,d,c),b.p.savedRow.splice(0,1)):(a.jgrid.info_dialog(a.jgrid.errors.errcap,l[1],a.jgrid.edit.bClose),a(b).jqGrid("restoreCell",d,c))}else a(g).empty(),a(b).jqGrid("setCell",b.rows[d].id,c,m,!1,!1,!0),a(g).addClass("dirty-cell"),a(b.rows[d]).addClass("edited"),a.isFunction(b.p.afterSaveCell)&&b.p.afterSaveCell.call(b,b.rows[d].id,o,j,d,c),b.p.savedRow.splice(0,1)},error:function(e,f){a("#lui_"+
b.p.id).hide();b.grid.hDiv.loading=!1;a.isFunction(b.p.errorCell)?b.p.errorCell.call(b,e,f):a.jgrid.info_dialog(a.jgrid.errors.errcap,e.status+" : "+e.statusText+"<br/>"+f,a.jgrid.edit.bClose);a(b).jqGrid("restoreCell",d,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",d,c)}catch(v){}"clientArray"==b.p.cellsubmit&&(a(g).empty(),a(b).jqGrid("setCell",b.rows[d].id,c,m,!1,!1,!0),a(g).addClass("dirty-cell"),
a(b.rows[d]).addClass("edited"),a.isFunction(b.p.afterSaveCell)&&b.p.afterSaveCell.call(b,b.rows[d].id,o,j,d,c),b.p.savedRow.splice(0,1))}else try{window.setTimeout(function(){a.jgrid.info_dialog(a.jgrid.errors.errcap,j+" "+s[1],a.jgrid.edit.bClose)},100),a(b).jqGrid("restoreCell",d,c)}catch(t){}}else a(b).jqGrid("restoreCell",d,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(d,c){return this.each(function(){var b=
this,f;if(b.grid&&!0===b.p.cellEdit){f=1<=b.p.savedRow.length?0:null;if(null!==f){var g=a("td:eq("+c+")",b.rows[d]);if(a.isFunction(a.fn.datepicker))try{a("input.hasDatepicker",g).datepicker("hide")}catch(j){}a(g).empty().attr("tabindex","-1");a(b).jqGrid("setCell",b.rows[d].id,c,b.p.savedRow[f].v,!1,!1,!0);a.isFunction(b.p.afterRestoreCell)&&b.p.afterRestoreCell.call(b,b.rows[d].id,b.p.savedRow[f].v,d,c);b.p.savedRow.splice(0,1)}window.setTimeout(function(){a("#"+b.p.knv).attr("tabindex","-1").focus()},
0)}})},nextCell:function(d,c){return this.each(function(){var b=!1;if(this.grid&&!0===this.p.cellEdit){for(var f=c+1;f<this.p.colModel.length;f++)if(!0===this.p.colModel[f].editable){b=f;break}!1!==b?a(this).jqGrid("editCell",d,b,!0):0<this.p.savedRow.length&&a(this).jqGrid("saveCell",d,c)}})},prevCell:function(d,c){return this.each(function(){var b=!1;if(this.grid&&!0===this.p.cellEdit){for(var f=c-1;0<=f;f--)if(!0===this.p.colModel[f].editable){b=f;break}!1!==b?a(this).jqGrid("editCell",d,b,!0):
0<this.p.savedRow.length&&a(this).jqGrid("saveCell",d,c)}})},GridNav:function(){return this.each(function(){function d(c,e,f){if("v"==f.substr(0,1)){var g=a(b.grid.bDiv)[0].clientHeight,k=a(b.grid.bDiv)[0].scrollTop,j=b.rows[c].offsetTop+b.rows[c].clientHeight,l=b.rows[c].offsetTop;"vd"==f&&j>=g&&(a(b.grid.bDiv)[0].scrollTop=a(b.grid.bDiv)[0].scrollTop+b.rows[c].clientHeight);"vu"==f&&l<k&&(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,k=b.rows[c].cells[e].offsetLeft,b.rows[c].cells[e].offsetLeft+b.rows[c].cells[e].clientWidth>=f+parseInt(g,10)?a(b.grid.bDiv)[0].scrollLeft=a(b.grid.bDiv)[0].scrollLeft+b.rows[c].cells[e].clientWidth:k<g&&(a(b.grid.bDiv)[0].scrollLeft=a(b.grid.bDiv)[0].scrollLeft-b.rows[c].cells[e].clientWidth))}function c(a,c){var d,f;if("lft"==c){d=a+1;for(f=a;0<=f;f--)if(!0!==b.p.colModel[f].hidden){d=f;break}}if("rgt"==c){d=a-1;for(f=a;f<b.p.colModel.length;f++)if(!0!==b.p.colModel[f].hidden){d=
f;break}}return d}var b=this;if(b.grid&&!0===b.p.cellEdit){b.p.knv=b.p.id+"_kn";var f=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>"),g,j;a(f).insertBefore(b.grid.cDiv);a("#"+b.p.knv).focus().keydown(function(f){j=f.keyCode;"rtl"==b.p.direction&&(37==j?j=39:39==j&&(j=37));switch(j){case 38:0<b.p.iRow-1&&(d(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&&(d(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&&(g=c(b.p.iCol-1,"lft"),d(b.p.iRow,g,"h"),a(b).jqGrid("editCell",b.p.iRow,g,!1));break;case 39:b.p.iCol+1<=b.p.colModel.length-1&&(g=c(b.p.iCol+1,"rgt"),d(b.p.iRow,g,"h"),a(b).jqGrid("editCell",b.p.iRow,g,!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(d){var c=
[];d||(d="all");this.each(function(){var b=this,f;!b.grid||!0!==b.p.cellEdit||a(b.rows).each(function(g){var j={};a(this).hasClass("edited")&&(a("td",this).each(function(c){f=b.p.colModel[c].name;if("cb"!==f&&"subgrid"!==f)if("dirty"==d){if(a(this).hasClass("dirty-cell"))try{j[f]=a.unformat(this,{rowId:b.rows[g].id,colModel:b.p.colModel[c]},c)}catch(e){j[f]=a.jgrid.htmlDecode(a(this).html())}}else try{j[f]=a.unformat(this,{rowId:b.rows[g].id,colModel:b.p.colModel[c]},c)}catch(l){j[f]=a.jgrid.htmlDecode(a(this).html())}}),
j.id=this.id,c.push(j))})});return c}})})(l);(function(a){a.fn.jqm=function(b){var e={overlay:50,closeoverlay:!0,overlayClass:"jqmOverlay",closeClass:"jqmClose",trigger:".jqModal",ajax:g,ajaxText:"",target:g,modal:g,toTop:g,onShow:g,onHide:g,onLoad:g};return this.each(function(){if(this._jqm)return c[this._jqm].c=a.extend({},c[this._jqm].c,b);d++;this._jqm=d;c[d]={c:a.extend(e,a.jqm.params,b),a:g,w:a(this).addClass("jqmID"+d),s:d};e.trigger&&a(this).jqmAddTrigger(e.trigger)})};a.fn.jqmAddClose=function(a){return n(this,
a,"jqmHide")};a.fn.jqmAddTrigger=function(a){return n(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(d,k){var m=c[d],l=m.c,n="."+l.closeClass,o=parseInt(m.w.css("z-index")),o=0<o?o:3E3,t=a("<div></div>").css({height:"100%",width:"100%",position:"fixed",left:0,top:0,"z-index":o-1,opacity:l.overlay/100});if(m.a)return g;m.t=k;m.a=!0;m.w.css("z-index",
o);l.modal?(b[0]||setTimeout(function(){e("bind")},1),b.push(d)):0<l.overlay?l.closeoverlay&&m.w.jqmAddClose(t):t=g;m.o=t?t.addClass(l.overlayClass).prependTo("body"):g;if(f&&(a("html,body").css({height:"100%",width:"100%"}),t)){var t=t.css({position:"absolute"})[0],x;for(x in{Top:1,Left:1})t.style.setExpression(x.toLowerCase(),"(_=(document.documentElement.scroll"+x+" || document.body.scroll"+x+"))+'px'")}l.ajax?(o=l.target||m.w,t=l.ajax,o="string"==typeof o?a(o,m.w):a(o),t="@"==t.substr(0,1)?a(k).attr(t.substring(1)):
t,o.html(l.ajaxText).load(t,function(){l.onLoad&&l.onLoad.call(this,m);n&&m.w.jqmAddClose(a(n,m.w));j(m)})):n&&m.w.jqmAddClose(a(n,m.w));l.toTop&&m.o&&m.w.before('<span id="jqmP'+m.w[0]._jqm+'"></span>').insertAfter(m.o);l.onShow?l.onShow(m):m.w.show();j(m);return g},close:function(d){d=c[d];if(!d.a)return g;d.a=g;b[0]&&(b.pop(),b[0]||e("unbind"));d.c.toTop&&d.o&&a("#jqmP"+d.w[0]._jqm).after(d.w).remove();if(d.c.onHide)d.c.onHide(d);else d.w.hide(),d.o&&d.o.remove();return g},params:{}};var d=0,c=
a.jqm.hash,b=[],f=a.browser.msie&&"6.0"==a.browser.version,g=!1,j=function(b){var c=a('<iframe src="javascript:false;document.write(\'\');" class="jqm"></iframe>').css({opacity:0});f&&(b.o?b.o.html('<p style="width:100%;height:100%"/>').prepend(c):a("iframe.jqm",b.w)[0]||b.w.prepend(c));m(b)},m=function(b){try{a(":input:visible",b.w)[0].focus()}catch(c){}},e=function(b){a(document)[b]("keypress",l)[b]("keydown",l)[b]("mousedown",l)},l=function(d){var e=c[b[b.length-1]];(d=!a(d.target).parents(".jqmID"+
e.s)[0])&&m(e);return!d},n=function(b,d,e){return b.each(function(){var b=this._jqm;a(d).each(function(){this[e]||(this[e]=[],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 g}));this[e].push(b)})})}})(l);(function(a){a.fn.jqDrag=function(a){return g(this,a,"d")};a.fn.jqResize=function(a,b){return g(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&&f.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",d.drag).unbind("mouseup",d.stop)}};var d=a.jqDnR,c=d.dnr,b=d.e,f,g=function(d,e,g,k){return d.each(function(){e=e?a(e,d):d;e.bind("mousedown",{e:d,k:g},function(d){var e=d.data,g={};b=e.e;f=k?a(k):!1;if("relative"!=b.css("position"))try{b.position(g)}catch(m){}c={X:g.left||j("left")||0,Y:g.top||j("top")||
0,W:j("width")||b[0].scrollWidth||0,H:j("height")||b[0].scrollHeight||0,pX:d.pageX,pY:d.pageY,k:e.k};M1=f&&"d"!=e.k?{X:g.left||f1("left")||0,Y:g.top||f1("top")||0,W:f[0].offsetWidth||f1("width")||0,H:f[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(l){}a(document).mousemove(a.jqDnR.drag).mouseup(a.jqDnR.stop);return!1})})},j=function(a){return parseInt(b.css(a))||!1};f1=function(a){return parseInt(f.css(a))||
!1}})(l);(function(a){a.jgrid.extend({setSubGrid:function(){return this.each(function(){var d;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});
d=this.p.subGridModel;if(d[0]){d[0].align=a.extend([],d[0].align||[]);for(var c=0;c<d[0].name.length;c++)d[0].align[c]=d[0].align[c]||"left"}})},addSubGridCell:function(a,c){var b="",d,g;this.each(function(){b=this.formatCol(a,c);g=this.p.id;d=this.p.subGridOptions.plusicon});return'<td role="grid" aria-describedby="'+g+'_subgrid" class="ui-sgcollapsed sgcollapsed" '+b+"><a href='javascript:void(0);'><span class='ui-icon "+d+"'></span></a></td>"},addSubGrid:function(d){return this.each(function(){var c=
this;if(c.grid){var b=function(b,d,e){d=a("<td align='"+c.p.subGridModel[0].align[e]+"'></td>").html(d);a(b).append(d)},f=function(d,e){var f,g,k,j=a("<table cellspacing='0' cellpadding='0' border='0'><tbody></tbody></table>"),m=a("<tr></tr>");for(g=0;g<c.p.subGridModel[0].name.length;g++)f=a("<th class='ui-state-default ui-th-subgrid ui-th-column ui-th-"+c.p.direction+"'></th>"),a(f).html(c.p.subGridModel[0].name[g]),a(f).width(c.p.subGridModel[0].width[g]),a(m).append(f);a(j).append(m);d&&(k=c.p.xmlReader.subgrid,
a(k.root+" "+k.row,d).each(function(){m=a("<tr class='ui-widget-content ui-subtblcell'></tr>");if(!0===k.repeatitems)a(k.cell,this).each(function(c){b(m,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(m,a(d[g],this).text()||"&#160;",g)}a(j).append(m)}));f=a("table:first",c.grid.bDiv).attr("id")+"_";a("#"+f+e).append(j);c.grid.hDiv.loading=!1;a("#load_"+c.p.id).hide();return!1},g=function(d,e){var f,g,k,j,m,l=a("<table cellspacing='0' cellpadding='0' border='0'><tbody></tbody></table>"),
n=a("<tr></tr>");for(g=0;g<c.p.subGridModel[0].name.length;g++)f=a("<th class='ui-state-default ui-th-subgrid ui-th-column ui-th-"+c.p.direction+"'></th>"),a(f).html(c.p.subGridModel[0].name[g]),a(f).width(c.p.subGridModel[0].width[g]),a(n).append(f);a(l).append(n);if(d&&(j=c.p.jsonReader.subgrid,f=d[j.root],"undefined"!==typeof f))for(g=0;g<f.length;g++){k=f[g];n=a("<tr class='ui-widget-content ui-subtblcell'></tr>");if(!0===j.repeatitems){j.cell&&(k=k[j.cell]);for(m=0;m<k.length;m++)b(n,k[m]||"&#160;",
m)}else{var o=c.p.subGridModel[0].mapping||c.p.subGridModel[0].name;if(o.length)for(m=0;m<o.length;m++)b(n,k[o[m]]||"&#160;",m)}a(l).append(n)}g=a("table:first",c.grid.bDiv).attr("id")+"_";a("#"+g+e).append(l);c.grid.hDiv.loading=!1;a("#load_"+c.p.id).hide();return!1},j=function(b){var d,e,k,j;d=a(b).attr("id");e={nd_:(new Date).getTime()};e[c.p.prmNames.subgridid]=d;if(!c.p.subGridModel[0])return!1;if(c.p.subGridModel[0].params)for(j=0;j<c.p.subGridModel[0].params.length;j++)for(k=0;k<c.p.colModel.length;k++)c.p.colModel[k].name==
c.p.subGridModel[0].params[j]&&(e[c.p.colModel[k].name]=a("td:eq("+k+")",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,e):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,
e):e,complete:function(b){c.p.subgridtype=="xml"?f(b.responseXML,d):g(a.jgrid.parse(b.responseText),d)}},a.jgrid.ajaxOptions,c.p.ajaxSubgridOptions||{}))}return!1},m,e,l,n=0,r,p;a.each(c.p.colModel,function(){(!0===this.hidden||"rn"==this.name||"cb"==this.name)&&n++});a(c.rows).each(function(b){var f=this;a(f).hasClass("jqgrow")&&(a(this.cells[d]).bind("click",function(){p=f.nextSibling;if(a(this).hasClass("sgcollapsed")){e=c.p.id;m=f.id;if(!0===c.p.subGridOptions.reloadOnExpand||!1===c.p.subGridOptions.reloadOnExpand&&
!a(p).hasClass("ui-subgrid")){l=1<=d?"<td colspan='"+d+"'>&#160;</td>":"";r=!0;a.isFunction(c.p.subGridBeforeExpand)&&(r=c.p.subGridBeforeExpand.call(c,e+"_"+m,m));if(!1===r)return!1;a(f).after("<tr role='row' class='ui-subgrid'>"+l+"<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-n,10)+"' class='ui-widget-content subgrid-data'><div id="+e+"_"+m+" class='tablediv'></div></td></tr>");a.isFunction(c.p.subGridRowExpanded)?
c.p.subGridRowExpanded.call(c,e+"_"+m,m):j(f)}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",m)}else if(a(this).hasClass("sgexpanded")){r=!0;a.isFunction(c.p.subGridRowColapsed)&&(m=f.id,r=c.p.subGridRowColapsed.call(c,e+"_"+m,m));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(f.cells[d]).trigger("click")},b*c.p.subGridOptions.delayOnLoad))});c.subGridXml=function(a,b){f(a,b)};c.subGridJson=function(a,b){g(a,b)}}})},expandSubGridRow:function(d){return this.each(function(){if((this.grid||d)&&!0===this.p.subGrid){var c=
a(this).jqGrid("getInd",d,!0);c&&(c=a("td.sgcollapsed",c)[0])&&a(c).trigger("click")}})},collapseSubGridRow:function(d){return this.each(function(){if((this.grid||d)&&!0===this.p.subGrid){var c=a(this).jqGrid("getInd",d,!0);c&&(c=a("td.sgexpanded",c)[0])&&a(c).trigger("click")}})},toggleSubGridRow:function(d){return this.each(function(){if((this.grid||d)&&!0===this.p.subGrid){var c=a(this).jqGrid("getInd",d,!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")}}})}})})(l);(function(a){a.jgrid.extend({groupingSetup:function(){return this.each(function(){var d=this.p.groupingView;if(null!==d&&("object"===typeof d||a.isFunction(d)))if(d.groupField.length){"undefined"==typeof d.visibiltyOnNextGrouping&&(d.visibiltyOnNextGrouping=[]);for(var c=0;c<d.groupField.length;c++)if(d.groupOrder[c]||(d.groupOrder[c]="asc"),d.groupText[c]||(d.groupText[c]="{0}"),"boolean"!=typeof d.groupColumnShow[c]&&(d.groupColumnShow[c]=!0),"boolean"!=typeof d.groupSummary[c]&&
(d.groupSummary[c]=!1),!0===d.groupColumnShow[c]?(d.visibiltyOnNextGrouping[c]=!0,a(this).jqGrid("showCol",d.groupField[c])):(d.visibiltyOnNextGrouping[c]=a("#"+this.p.id+"_"+d.groupField[c]).is(":visible"),a(this).jqGrid("hideCol",d.groupField[c])),d.sortitems[c]=[],d.sortnames[c]=[],d.summaryval[c]=[],d.groupSummary[c]){d.summary[c]=[];for(var b=this.p.colModel,f=0,g=b.length;f<g;f++)b[f].summaryType&&d.summary[c].push({nm:b[f].name,st:b[f].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(d,c,b,f){this.each(function(){c[0]+="";var g=c[0].toString().split(" ").join(""),j=this.p.groupingView,m=this;b.hasOwnProperty(g)?b[g].push(d):(b[g]=[],b[g].push(d),j.sortitems[0].push(g),j.sortnames[0].push(a.trim(c[0].toString())),j.summaryval[0][g]=a.extend(!0,[],j.summary[0]));j.groupSummary[0]&&a.each(j.summaryval[0][g],function(){this.v=a.isFunction(this.st)?
this.st.call(m,this.v,this.nm,f):a(m).jqGrid("groupingCalculations."+this.st,this.v,this.nm,f)})});return b},groupingToggle:function(d){this.each(function(){var c=this.p.groupingView,b=d.lastIndexOf("_"),f=d.substring(0,b+1),b=parseInt(d.substring(b+1),10)+1,g=c.minusicon,j=c.plusicon,m=a("#"+d)[0].nextSibling,e=a("#"+d+" span.tree-wrap-"+this.p.direction),l=!1;if(e.hasClass(g)){if(c.showSummaryOnHide&&c.groupSummary[0]){if(m)for(;m&&!a(m).hasClass("jqfoot");)a(m).hide(),m=m.nextSibling}else if(m)for(;m&&
a(m).attr("id")!=f+(""+b);)a(m).hide(),m=m.nextSibling;e.removeClass(g).addClass(j);l=!0}else{if(m)for(;m&&a(m).attr("id")!=f+(""+b);)a(m).show(),m=m.nextSibling;e.removeClass(j).addClass(g);l=!1}a.isFunction(this.p.onClickGroup)&&this.p.onClickGroup.call(this,d,l)});return!1},groupingRender:function(d,c){return this.each(function(){var b=this,f=b.p.groupingView,g="",j="",m,e="",l,n,r;f.groupDataSorted||(f.sortitems[0].sort(),f.sortnames[0].sort(),"desc"==f.groupOrder[0].toLowerCase()&&(f.sortitems[0].reverse(),
f.sortnames[0].reverse()));e=f.groupCollapse?f.plusicon:f.minusicon;e+=" tree-wrap-"+b.p.direction;for(r=0;r<c;){if(b.p.colModel[r].name==f.groupField[0]){n=r;break}r++}a.each(f.sortitems[0],function(p,r){m=b.p.id+"ghead_"+p;j="<span style='cursor:pointer;' class='ui-icon "+e+"' onclick=\"jQuery('#"+b.p.id+"').jqGrid('groupingToggle','"+m+"');return false;\"></span>";try{l=b.formatter(m,f.sortnames[0][p],n,f.sortitems[0])}catch(s){l=f.sortnames[0][p]}g=g+('<tr id="'+m+'" role="row" class= "ui-widget-content jqgroup ui-row-'+
b.p.direction+'"><td colspan="'+c+'">'+j+a.jgrid.format(f.groupText[0],l,d[r].length)+"</td></tr>");for(var u=0;u<d[r].length;u++)g=g+d[r][u].join("");if(f.groupSummary[0]){u="";f.groupCollapse&&!f.showSummaryOnHide&&(u=' style="display:none;"');g=g+("<tr"+u+' role="row" class="ui-widget-content jqfoot ui-row-'+b.p.direction+'">');for(var u=f.summaryval[0][r],v=b.p.colModel,t,x=d[r].length,y=0;y<c;y++){var z="<td "+b.formatCol(y,1,"")+">&#160;</td>",E="{0}";a.each(u,function(){if(this.nm==v[y].name){if(v[y].summaryTpl)E=
v[y].summaryTpl;if(this.st=="avg"&&this.v&&x>0)this.v=this.v/x;try{t=b.formatter("",this.v,y,this)}catch(c){t=this.v}z="<td "+b.formatCol(y,1,"")+">"+a.jgrid.format(E,t)+"</td>";return false}});g=g+z}g=g+"</tr>"}});a("#"+b.p.id+" tbody:first").append(g);g=null})},groupingGroupBy:function(d,c){return this.each(function(){"string"==typeof d&&(d=[d]);var b=this.p.groupingView;this.p.grouping=!0;for(var f=0;f<b.groupField.length;f++)!b.groupColumnShow[f]&&b.visibiltyOnNextGrouping[f]&&a(this).jqGrid("showCol",
b.groupField[f]);for(f=0;f<d.length;f++)b.visibiltyOnNextGrouping[f]=a("#"+this.p.id+"_"+d[f]).is(":visible");this.p.groupingView=a.extend(this.p.groupingView,c||{});b.groupField=d;a(this).trigger("reloadGrid")})},groupingRemove:function(d){return this.each(function(){"undefined"==typeof d&&(d=!0);this.p.grouping=!1;if(!0===d){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)}}})})(l);(function(a){a.jgrid.extend({setTreeNode:function(d,c){return this.each(function(){var b=this;if(b.grid&&b.p.treeGrid)for(var f=b.p.expColInd,g=b.p.treeReader.expanded_field,j=b.p.treeReader.leaf_field,m=b.p.treeReader.level_field,e=b.p.treeReader.icon_field,l=b.p.treeReader.loaded,n,r,p,q;d<c;)q=b.p.data[b.p._index[b.rows[d].id]],"nested"==b.p.treeGridModel&&!q[j]&&(n=parseInt(q[b.p.treeReader.left_field],10),r=parseInt(q[b.p.treeReader.right_field],
10),q[j]=r===n+1?"true":"false",b.rows[d].cells[b.p._treeleafpos].innerHTML=q[j]),n=parseInt(q[m],10),0===b.p.tree_root_level?(p=n+1,r=n):(p=n,r=n-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!==q[l]&&(q[l]="true"==q[l]||!0===q[l]?!0:!1),"true"==q[j]||!0===q[j]?(p+=(void 0!==q[e]&&""!==q[e]?q[e]:b.p.treeIcons.leaf)+" tree-leaf treeclick'",q[j]=!0,r="leaf"):(q[j]=!1,r=
""),q[g]=("true"==q[g]||!0===q[g]?!0:!1)&&q[l],p+=!0===q[g]?b.p.treeIcons.minus+" tree-minus treeclick'":b.p.treeIcons.plus+" tree-plus treeclick'",p+="</div></div>",a(b.rows[d].cells[f]).wrapInner("<span class='cell-wrapper"+r+"'></span>").prepend(p),n!==parseInt(b.p.tree_root_level,10)&&((q=(q=a(b).jqGrid("getNodeParent",q))&&q.hasOwnProperty(g)?q[g]:!0)||a(b.rows[d]).css("display","none")),a(b.rows[d].cells[f]).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][j])if(b.p.data[c][g]){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[d].cells[f]).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][j])if(b.p.data[d][g]){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}),d++})},setTreeGrid:function(){return this.each(function(){var d=this,c=0,b=!1,f,g,j=[];if(d.p.treeGrid){d.p.treedatatype||a.extend(d.p,{treedatatype:d.p.datatype});d.p.subGrid=!1;d.p.altRows=!1;d.p.pgbuttons=!1;d.p.pginput=!1;d.p.gridview=!0;d.p.multiselect=!1;d.p.rowList=[];d.p.expColInd=0;d.p.treeIcons=a.extend({plus:"ui-icon-triangle-1-"+
("rtl"==d.p.direction?"w":"e"),minus:"ui-icon-triangle-1-s",leaf:"ui-icon-radio-off"},d.p.treeIcons||{});"nested"==d.p.treeGridModel?d.p.treeReader=a.extend({level_field:"level",left_field:"lft",right_field:"rgt",leaf_field:"isLeaf",expanded_field:"expanded",loaded:"loaded",icon_field:"icon"},d.p.treeReader):"adjacency"==d.p.treeGridModel&&(d.p.treeReader=a.extend({level_field:"level",parent_id_field:"parent",leaf_field:"isLeaf",expanded_field:"expanded",loaded:"loaded",icon_field:"icon"},d.p.treeReader));
for(g in d.p.colModel)if(d.p.colModel.hasOwnProperty(g)){f=d.p.colModel[g].name;f==d.p.ExpandColumn&&!b&&(b=!0,d.p.expColInd=c);c++;for(var m in d.p.treeReader)d.p.treeReader[m]==f&&j.push(f)}a.each(d.p.treeReader,function(b,f){if(f&&a.inArray(f,j)===-1){if(b==="leaf_field")d.p._treeleafpos=c;c++;d.p.colNames.push(f);d.p.colModel.push({name:f,width:1,hidden:true,sortable:false,resizable:false,hidedlg:true,editable:true,search:false})}})}})},expandRow:function(d){this.each(function(){var c=this;if(c.grid&&
c.p.treeGrid){var b=a(c).jqGrid("getNodeChildren",d),f=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[f]&&a(c).jqGrid("expandRow",this)})}})},collapseRow:function(d){this.each(function(){var c=this;if(c.grid&&c.p.treeGrid){var b=a(c).jqGrid("getNodeChildren",d),f=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[f]&&a(c).jqGrid("collapseRow",this)})}})},getRootNodes:function(){var d=[];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)&&d.push(this)});break;case "adjacency":var f=c.p.treeReader.parent_id_field;a(c.p.data).each(function(){(null===this[f]||"null"==(""+this[f]).toLowerCase())&&d.push(this)})}});return d},getNodeDepth:function(d){var c=
null;this.each(function(){if(this.grid&&this.p.treeGrid)switch(this.p.treeGridModel){case "nested":c=parseInt(d[this.p.treeReader.level_field],10)-parseInt(this.p.tree_root_level,10);break;case "adjacency":c=a(this).jqGrid("getNodeAncestors",d).length}});return c},getNodeParent:function(d){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,f=this.p.treeReader.right_field,g=this.p.treeReader.level_field,j=parseInt(d[b],
10),m=parseInt(d[f],10),e=parseInt(d[g],10);a(this.p.data).each(function(){if(parseInt(this[g],10)===e-1&&parseInt(this[b],10)<j&&parseInt(this[f],10)>m)return c=this,!1});break;case "adjacency":var l=this.p.treeReader.parent_id_field,n=this.p.localReader.id;a(this.p.data).each(function(){if(this[n]==d[l])return c=this,!1})}});return c},getNodeChildren:function(d){var c=[];this.each(function(){if(this.grid&&this.p.treeGrid)switch(this.p.treeGridModel){case "nested":var b=this.p.treeReader.left_field,
f=this.p.treeReader.right_field,g=this.p.treeReader.level_field,j=parseInt(d[b],10),m=parseInt(d[f],10),e=parseInt(d[g],10);a(this.p.data).each(function(){parseInt(this[g],10)===e+1&&parseInt(this[b],10)>j&&parseInt(this[f],10)<m&&c.push(this)});break;case "adjacency":var l=this.p.treeReader.parent_id_field,n=this.p.localReader.id;a(this.p.data).each(function(){this[l]==d[n]&&c.push(this)})}});return c},getFullTreeNode:function(d){var c=[];this.each(function(){var b;if(this.grid&&this.p.treeGrid)switch(this.p.treeGridModel){case "nested":var f=
this.p.treeReader.left_field,g=this.p.treeReader.right_field,j=this.p.treeReader.level_field,m=parseInt(d[f],10),e=parseInt(d[g],10),l=parseInt(d[j],10);a(this.p.data).each(function(){parseInt(this[j],10)>=l&&parseInt(this[f],10)>=m&&parseInt(this[f],10)<=e&&c.push(this)});break;case "adjacency":if(d){c.push(d);var n=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[n]){c.push(this);break}})}}});return c},getNodeAncestors:function(d){var c=
[];this.each(function(){if(this.grid&&this.p.treeGrid)for(var b=a(this).jqGrid("getNodeParent",d);b;)c.push(b),b=a(this).jqGrid("getNodeParent",b)});return c},isVisibleNode:function(d){var c=!0;this.each(function(){if(this.grid&&this.p.treeGrid){var b=a(this).jqGrid("getNodeAncestors",d),f=this.p.treeReader.expanded_field;a(b).each(function(){c=c&&this[f];if(!c)return!1})}});return c},isNodeLoaded:function(d){var c;this.each(function(){if(this.grid&&this.p.treeGrid){var b=this.p.treeReader.leaf_field;
c=void 0!==d?void 0!==d.loaded?d.loaded:d[b]||0<a(this).jqGrid("getNodeChildren",d).length?!0:!1:!1}});return c},expandNode:function(d){return this.each(function(){if(this.grid&&this.p.treeGrid){var c=this.p.treeReader.expanded_field,b=this.p.treeReader.parent_id_field,f=this.p.treeReader.loaded,g=this.p.treeReader.level_field,j=this.p.treeReader.left_field,m=this.p.treeReader.right_field;if(!d[c]){var e=a.jgrid.getAccessor(d,this.p.localReader.id),l=a("#"+e,this.grid.bDiv)[0],n=this.p._index[e];
a(this).jqGrid("isNodeLoaded",this.p.data[n])?(d[c]=!0,a("div.treeclick",l).removeClass(this.p.treeIcons.plus+" tree-plus").addClass(this.p.treeIcons.minus+" tree-minus")):(d[c]=!0,a("div.treeclick",l).removeClass(this.p.treeIcons.plus+" tree-plus").addClass(this.p.treeIcons.minus+" tree-minus"),this.p.treeANode=l.rowIndex,this.p.datatype=this.p.treedatatype,"nested"==this.p.treeGridModel?a(this).jqGrid("setGridParam",{postData:{nodeid:e,n_left:d[j],n_right:d[m],n_level:d[g]}}):a(this).jqGrid("setGridParam",
{postData:{nodeid:e,parentid:d[b],n_level:d[g]}}),a(this).trigger("reloadGrid"),d[f]=!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(d){return this.each(function(){if(this.grid&&this.p.treeGrid&&d.expanded){d.expanded=!1;var c=a.jgrid.getAccessor(d,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(d,c,b,f){return this.each(function(){if(this.grid&&this.p.treeGrid){var g,j,m,e=[],l=this,n;g=a(this).jqGrid("getRootNodes");g=a.jgrid.from(g);g.orderBy(d,c,b,f);n=g.select();g=0;for(j=n.length;g<j;g++)m=n[g],e.push(m),a(this).jqGrid("collectChildrenSortTree",e,m,d,c,b,f);a.each(e,function(b){var c=a.jgrid.getAccessor(this,l.p.localReader.id);a("#"+l.p.id+" tbody tr:eq("+b+")").after(a("tr#"+c,l.grid.bDiv))});e=n=g=
null}})},collectChildrenSortTree:function(d,c,b,f,g,j){return this.each(function(){if(this.grid&&this.p.treeGrid){var m,e,l,n;m=a(this).jqGrid("getNodeChildren",c);m=a.jgrid.from(m);m.orderBy(b,f,g,j);n=m.select();m=0;for(e=n.length;m<e;m++)l=n[m],d.push(l),a(this).jqGrid("collectChildrenSortTree",d,l,b,f,g,j)}})},setTreeRow:function(d,c){var b=!1;this.each(function(){this.grid&&this.p.treeGrid&&(b=a(this).jqGrid("setRowData",d,c))});return b},delTreeNode:function(d){return this.each(function(){var c=
this.p.localReader.id,b=this.p.treeReader.left_field,f=this.p.treeReader.right_field,g,j,m;if(this.grid&&this.p.treeGrid){var e=this.p._index[d];if(void 0!==e){g=parseInt(this.p.data[e][f],10);j=g-parseInt(this.p.data[e][b],10)+1;e=a(this).jqGrid("getFullTreeNode",this.p.data[e]);if(0<e.length)for(var l=0;l<e.length;l++)a(this).jqGrid("delRowData",e[l][c]);if("nested"===this.p.treeGridModel){c=a.jgrid.from(this.p.data).greater(b,g,{stype:"integer"}).select();if(c.length)for(m in c)c[m][b]=parseInt(c[m][b],
10)-j;c=a.jgrid.from(this.p.data).greater(f,g,{stype:"integer"}).select();if(c.length)for(m in c)c[m][f]=parseInt(c[m][f],10)-j}}}})},addChildNode:function(d,c,b){var f=this[0];if(b){var g=f.p.treeReader.expanded_field,j=f.p.treeReader.leaf_field,m=f.p.treeReader.level_field,e=f.p.treeReader.parent_id_field,l=f.p.treeReader.left_field,n=f.p.treeReader.right_field,r=f.p.treeReader.loaded,p,q,s,u,v;p=0;var t=c,x;if(!d){v=f.p.data.length-1;if(0<=v)for(;0<=v;)p=Math.max(p,parseInt(f.p.data[v][f.p.localReader.id],
10)),v--;d=p+1}var y=a(f).jqGrid("getInd",c);x=!1;if(void 0===c||null===c||""===c)t=c=null,p="last",u=f.p.tree_root_level,v=f.p.data.length+1;else if(p="after",q=f.p._index[c],s=f.p.data[q],c=s[f.p.localReader.id],u=parseInt(s[m],10)+1,v=a(f).jqGrid("getFullTreeNode",s),v.length?(t=v[v.length-1][f.p.localReader.id],v=a(f).jqGrid("getInd",t)+1):v=a(f).jqGrid("getInd",c)+1,s[j])x=!0,s[g]=!0,a(f.rows[y]).find("span.cell-wrapperleaf").removeClass("cell-wrapperleaf").addClass("cell-wrapper").end().find("div.tree-leaf").removeClass(f.p.treeIcons.leaf+
" tree-leaf").addClass(f.p.treeIcons.minus+" tree-minus"),f.p.data[q][j]=!1,s[r]=!0;q=v+1;b[g]=!1;b[r]=!0;b[m]=u;b[j]=!0;"adjacency"===f.p.treeGridModel&&(b[e]=c);if("nested"===f.p.treeGridModel){var z;if(null!==c){j=parseInt(s[n],10);m=a.jgrid.from(f.p.data);m=m.greaterOrEquals(n,j,{stype:"integer"});m=m.select();if(m.length)for(z in m)m[z][l]=m[z][l]>j?parseInt(m[z][l],10)+2:m[z][l],m[z][n]=m[z][n]>=j?parseInt(m[z][n],10)+2:m[z][n];b[l]=j;b[n]=j+1}else{j=parseInt(a(f).jqGrid("getCol",n,!1,"max"),
10);m=a.jgrid.from(f.p.data).greater(l,j,{stype:"integer"}).select();if(m.length)for(z in m)m[z][l]=parseInt(m[z][l],10)+2;m=a.jgrid.from(f.p.data).greater(n,j,{stype:"integer"}).select();if(m.length)for(z in m)m[z][n]=parseInt(m[z][n],10)+2;b[l]=j+1;b[n]=j+2}}if(null===c||a(f).jqGrid("isNodeLoaded",s)||x)a(f).jqGrid("addRowData",d,b,p,t),a(f).jqGrid("setTreeNode",v,q);s&&!s[g]&&a(f.rows[y]).find("div.treeclick").click()}}})})(l);(function(a){a.jgrid.extend({jqGridImport:function(k){k=a.extend({imptype:"xml",
impstring:"",impurl:"",mtype:"GET",impData:{},xmlGrid:{config:"roots>grid",data:"roots>rows"},jsonGrid:{config:"grid",data:"data"},ajaxOptions:{}},k||{});return this.each(function(){var c=this,b=function(b,f){var e=a(f.xmlGrid.config,b)[0],g=a(f.xmlGrid.data,b)[0],k;if(d.xml2json&&a.jgrid.parse){var e=d.xml2json(e," "),e=a.jgrid.parse(e),l;for(l in e)e.hasOwnProperty(l)&&(k=e[l]);g?(g=e.grid.datatype,e.grid.datatype="xmlstring",e.grid.datastr=b,a(c).jqGrid(k).jqGrid("setGridParam",{datatype:g})):
a(c).jqGrid(k)}else alert("xml2json or parse are not present")},f=function(b,d){if(b&&"string"==typeof b){var e=a.jgrid.parse(b),f=e[d.jsonGrid.config];if(e=e[d.jsonGrid.data]){var g=f.datatype;f.datatype="jsonstring";f.datastr=e;a(c).jqGrid(f).jqGrid("setGridParam",{datatype:g})}else a(c).jqGrid(f)}};switch(k.imptype){case "xml":a.ajax(a.extend({url:k.impurl,type:k.mtype,data:k.impData,dataType:"xml",complete:function(c,d){"success"==d&&(b(c.responseXML,k),a.isFunction(k.importComplete)&&k.importComplete(c))}},
k.ajaxOptions));break;case "xmlstring":if(k.impstring&&"string"==typeof k.impstring){var g=a.jgrid.stringToDoc(k.impstring);g&&(b(g,k),a.isFunction(k.importComplete)&&k.importComplete(g),k.impstring=null);g=null}break;case "json":a.ajax(a.extend({url:k.impurl,type:k.mtype,data:k.impData,dataType:"json",complete:function(b,c){"success"==c&&(f(b.responseText,k),a.isFunction(k.importComplete)&&k.importComplete(b))}},k.ajaxOptions));break;case "jsonstring":k.impstring&&"string"==typeof k.impstring&&(f(k.impstring,
k),a.isFunction(k.importComplete)&&k.importComplete(k.impstring),k.impstring=null)}})},jqGridExport:function(k){var k=a.extend({exptype:"xmlstring",root:"grid",ident:"\t"},k||{}),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 f in b.treeReader)b.treeReader.hasOwnProperty(f)&&
(b.colNames.splice(b.colNames.length-1),b.colModel.splice(b.colModel.length-1));switch(k.exptype){case "xmlstring":c="<"+k.root+">"+d.json2xml(b,k.ident)+"</"+k.root+">";break;case "jsonstring":c="{"+d.toJson(b,k.root,k.ident)+"}",void 0!==b.postData.filters&&(c=c.replace(/filters":"/,'filters":'),c=c.replace(/}]}"/,"}]}"))}}});return c},excelExport:function(d){d=a.extend({exptype:"remote",url:null,oper:"oper",tag:"excel",exportOptions:{}},d||{});return this.each(function(){if(this.grid){var c;"remote"==
d.exptype&&(c=a.extend({},this.p.postData),c[d.oper]=d.tag,c=l.param(c),c=-1!=d.url.indexOf("?")?d.url+"&"+c:d.url+"?"+c,window.location=c)}})}})})(l);var d={xml2json:function(a,d){9===a.nodeType&&(a=a.documentElement);var c=this.toJson(this.toObj(this.removeWhite(a)),a.nodeName,"\t");return"{\n"+d+(d?c.replace(/\t/g,d):c.replace(/\t|\n/g,""))+"\n}"},json2xml:function(a,d){var c=function(a,b,d){var e="",f,k;if(a instanceof Array)if(0===a.length)e+=d+"<"+b+">__EMPTY_ARRAY_</"+b+">\n";else{f=0;for(k=
a.length;f<k;f+=1)var l=d+c(a[f],b,d+"\t")+"\n",e=e+l}else if("object"===typeof a){f=!1;e+=d+"<"+b;for(k in a)a.hasOwnProperty(k)&&("@"===k.charAt(0)?e+=" "+k.substr(1)+'="'+a[k].toString()+'"':f=!0);e+=f?">":"/>";if(f){for(k in a)a.hasOwnProperty(k)&&("#text"===k?e+=a[k]:"#cdata"===k?e+="<![CDATA["+a[k]+"]]\>":"@"!==k.charAt(0)&&(e+=c(a[k],k,d+"\t")));e+=("\n"===e.charAt(e.length-1)?d:"")+"</"+b+">"}}else e+="function"===typeof a?d+"<"+b+"><![CDATA["+a+"]]\></"+b+">":'""'===a.toString()||0===a.toString().length?
d+"<"+b+">__EMPTY_STRING_</"+b+">":d+"<"+b+">"+a.toString()+"</"+b+">";return e},b="",f;for(f in a)a.hasOwnProperty(f)&&(b+=c(a[f],f,""));return d?b.replace(/\t/g,d):b.replace(/\t|\n/g,"")},toObj:function(a){var d={},c=/function/i;if(1===a.nodeType){if(a.attributes.length){var b;for(b=0;b<a.attributes.length;b+=1)d["@"+a.attributes[b].nodeName]=(a.attributes[b].nodeValue||"").toString()}if(a.firstChild){var f=b=0,g=!1,j;for(j=a.firstChild;j;j=j.nextSibling)1===j.nodeType?g=!0:3===j.nodeType&&j.nodeValue.match(/[^ \f\n\r\t\v]/)?
b+=1:4===j.nodeType&&(f+=1);if(g)if(2>b&&2>f){this.removeWhite(a);for(j=a.firstChild;j;j=j.nextSibling)3===j.nodeType?d["#text"]=this.escape(j.nodeValue):4===j.nodeType?c.test(j.nodeValue)?d[j.nodeName]=[d[j.nodeName],j.nodeValue]:d["#cdata"]=this.escape(j.nodeValue):d[j.nodeName]?d[j.nodeName]instanceof Array?d[j.nodeName][d[j.nodeName].length]=this.toObj(j):d[j.nodeName]=[d[j.nodeName],this.toObj(j)]:d[j.nodeName]=this.toObj(j)}else a.attributes.length?d["#text"]=this.escape(this.innerXml(a)):d=
this.escape(this.innerXml(a));else if(b)a.attributes.length?d["#text"]=this.escape(this.innerXml(a)):(d=this.escape(this.innerXml(a)),"__EMPTY_ARRAY_"===d?d="[]":"__EMPTY_STRING_"===d&&(d=""));else if(f)if(1<f)d=this.escape(this.innerXml(a));else for(j=a.firstChild;j;j=j.nextSibling)if(c.test(a.firstChild.nodeValue)){d=a.firstChild.nodeValue;break}else d["#cdata"]=this.escape(j.nodeValue)}!a.attributes.length&&!a.firstChild&&(d=null)}else 9===a.nodeType?d=this.toObj(a.documentElement):alert("unhandled node type: "+
a.nodeType);return d},toJson:function(a,d,c,b){void 0===b&&(b=!0);var f=d?'"'+d+'"':"",g="\t",j="\n";b||(j=g="");if("[]"===a)f+=d?":[]":"[]";else if(a instanceof Array){var m,e,l=[];e=0;for(m=a.length;e<m;e+=1)l[e]=this.toJson(a[e],"",c+g,b);f+=(d?":[":"[")+(1<l.length?j+c+g+l.join(","+j+c+g)+j+c:l.join(""))+"]"}else if(null===a)f+=(d&&":")+"null";else if("object"===typeof a){m=[];for(e in a)a.hasOwnProperty(e)&&(m[m.length]=this.toJson(a[e],e,c+g,b));f+=(d?":{":"{")+(1<m.length?j+c+g+m.join(","+
j+c+g)+j+c:m.join(""))+"}"}else f+="string"===typeof a?(d&&":")+'"'+a.replace(/\\/g,"\\\\").replace(/\"/g,'\\"')+'"':(d&&":")+'"'+a.toString()+'"';return f},innerXml:function(a){var d="";if("innerHTML"in a)d=a.innerHTML;else for(var c=function(a){var d="",g;if(1===a.nodeType){d+="<"+a.nodeName;for(g=0;g<a.attributes.length;g+=1)d+=" "+a.attributes[g].nodeName+'="'+(a.attributes[g].nodeValue||"").toString()+'"';if(a.firstChild){d+=">";for(g=a.firstChild;g;g=g.nextSibling)d+=c(g);d+="</"+a.nodeName+
">"}else d+="/>"}else 3===a.nodeType?d+=a.nodeValue:4===a.nodeType&&(d+="<![CDATA["+a.nodeValue+"]]\>");return d},a=a.firstChild;a;a=a.nextSibling)d+=c(a);return d},escape:function(a){return a.replace(/[\\]/g,"\\\\").replace(/[\"]/g,'\\"').replace(/[\n]/g,"\\n").replace(/[\r]/g,"\\r")},removeWhite:function(a){a.normalize();var d;for(d=a.firstChild;d;)if(3===d.nodeType)if(d.nodeValue.match(/[^ \f\n\r\t\v]/))d=d.nextSibling;else{var c=d.nextSibling;a.removeChild(d);d=c}else 1===d.nodeType&&this.removeWhite(d),
d=d.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 d=a.ui.multiselect.prototype._setSelected;a.ui.multiselect.prototype._setSelected=function(c,b){var f=d.call(this,c,b);if(b&&this.selectedList){var g=this.element;this.selectedList.find("li").each(function(){a(this).data("optionLink")&&
a(this).data("optionLink").remove().appendTo(g)})}return f}}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(){d.p.disableClick=true}var d=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 g=a(c.item).parent(),g=a(">th",g),j={};a.each(d.p.colModel,function(a){j[this.name]=a});var k=[];g.each(function(){var b=a(">div",this).get(0).id.replace(/^jqgh_/,"");b in j&&k.push(j[b])});a(d).jqGrid("remapColumns",k,true,true);a.isFunction(d.p.sortable.update)&&d.p.sortable.update(k);setTimeout(function(){d.p.disableClick=false},50)}};if(d.p.sortable.options)a.extend(g,d.p.sortable.options);else if(a.isFunction(d.p.sortable))d.p.sortable={update:d.p.sortable};
if(g.start){var j=g.start;g.start=function(a,c){b();j.call(this,a,c)}}else g.start=b;if(d.p.sortable.exclude)g.items=g.items+(":not("+d.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 d=this;if(!a("#colchooser_"+d[0].p.id).length){var g=a('<div id="colchooser_'+d[0].p.id+'" style="position:relative;overflow:hidden"><div><select multiple="multiple"></select></div></div>'),
j=a("select",g),c=a.extend({width:420,height:240,classname:null,done:function(a){a&&d.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",j).each(function(){this.selected?d.jqGrid("showCol",
k[this.value].name):d.jqGrid("hideCol",k[this.value].name)});var b=[];a("option[selected]",j).each(function(){b.push(parseInt(this.value,10))});a.each(b,function(){delete l[k[parseInt(this,10)].name]});a.each(l,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(d,b)},cleanup:function(a){b(c.dlog,g,"destroy");b(c.msel,j,"destroy");g.remove();a&&c.done&&c.done.call(d)},
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);j.addClass(c.classname)}if(c.width){a(">div",g).css({width:c.width,margin:"0 auto"});j.css("width",c.width)}if(c.height){a(">div",g).css("height",c.height);j.css("height",
c.height-10)}var k=d.jqGrid("getGridParam","colModel"),e=d.jqGrid("getGridParam","colNames"),l={},n=[];j.empty();a.each(k,function(a){l[this.name]=a;this.hidedlg?this.hidden||n.push(a):j.append("<option value='"+a+"' "+(this.hidden?"":"selected='selected'")+">"+e[a]+"</option>")});var r=a.isFunction(c.dlog_opts)?c.dlog_opts.call(d,c):c.dlog_opts;b(c.dlog,g,r);r=a.isFunction(c.msel_opts)?c.msel_opts.call(d,c):c.msel_opts;b(c.msel,j,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(d,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 j=a(g.item).attr("id");try{a(b).jqGrid("collapseSubGridRow",j)}catch(k){}}c._start_&&
c._start_.apply(this,[d,g])};c.update=function(d,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,[d,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(d,"dnd");a("tr.jqgrow:not(.ui-draggable)",d).draggable(a.isFunction(b.drag)?b.drag.call(a(d),b):b.drag)}var d=this;if(d.grid&&!d.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"&&d.p.jqgdnd===true)b();else{c=a.extend({drag:function(b){return a.extend({start:function(c,e){if(d.p.subGrid){var g=a(e.helper).attr("id");try{a(d).jqGrid("collapseSubGridRow",g)}catch(k){}}for(g=0;g<a.data(d,"dnd").connectWith.length;g++)a(a.data(d,"dnd").connectWith[g]).jqGrid("getGridParam","reccount")=="0"&&a(a.data(d,"dnd").connectWith[g]).jqGrid("addRowData",
"jqg_empty_row",{});e.helper.addClass("ui-state-highlight");a("td",e.helper).each(function(a){this.style.width=d.grid.headers[a].width+"px"});b.onstart&&a.isFunction(b.onstart)&&b.onstart.call(a(d),c,e)},stop:function(c,e){if(e.helper.dropped){var g=a(e.helper).attr("id");a(d).jqGrid("delRowData",g)}for(g=0;g<a.data(d,"dnd").connectWith.length;g++)a(a.data(d,"dnd").connectWith[g]).jqGrid("delRowData","jqg_empty_row");b.onstop&&a.isFunction(b.onstop)&&b.onstop.call(a(d),c,e)}},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,e){if(a(e.draggable).hasClass("jqgrow")){var g=a(e.draggable).attr("id"),g=e.draggable.parent().parent().jqGrid("getRowData",g);if(!b.dropbyname){var k=0,l={},p,q=a("#"+this.id).jqGrid("getGridParam","colModel");try{for(var s in g){if(g.hasOwnProperty(s)&&q[k]){p=q[k].name;l[p]=g[s]}k++}g=l}catch(u){}}e.helper.dropped=
true;if(b.beforedrop&&a.isFunction(b.beforedrop)){p=b.beforedrop.call(this,c,e,g,a("#"+d.id),a(this));typeof p!="undefined"&&(p!==null&&typeof p=="object")&&(g=p)}if(e.helper.dropped){var v;if(b.autoid)if(a.isFunction(b.autoid))v=b.autoid.call(this,g);else{v=Math.ceil(Math.random()*1E3);v=b.autoidprefix+v}a("#"+this.id).jqGrid("addRowData",v,g,b.droppos)}b.ondrop&&a.isFunction(b.ondrop)&&b.ondrop.call(this,c,e,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(d,"dnd",c);d.p.reccount!="0"&&!d.p.jqgdnd&&b();d.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(d),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(d,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,d,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)}})}})})(l)});define("jquery-layout",["jquery"],function(l){(function(d){var a=Math.min,k=Math.max,c=Math.floor,b=function(a){return"string"===d.type(a)},f=function(a,c){if(d.isArray(c))for(var f=0,e=c.length;f<e;f++){var k=c[f];try{b(k)&&(k=eval(k)),d.isFunction(k)&&k(a)}catch(l){}}};d.layout={version:"1.3.rc30.7",revision:0.033007,
browser:{mozilla:!!d.browser.mozilla,webkit:!!d.browser.webkit||!!d.browser.safari,msie:!!d.browser.msie,isIE6:d.browser.msie&&6==d.browser.version,boxModel:!1!==d.support.boxModel||!d.browser.msie,version:d.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=d(a);if(a=a.data("layout")||a.data("parentLayout")){a=a.container;if(a.data("layoutPane"))return a;a=a.closest("."+d.layout.defaults.panes.paneClass);if(a.data("layoutPane"))return a}return null},getParentPaneInstance:function(a){return(a=d.layout.getParentPaneElem(a))?a.data("layoutPane"):null},getParentLayoutInstance:function(a){return(a=d.layout.getParentPaneElem(a))?a.data("parentLayout"):
null},getEventObject:function(a){return"object"===typeof a&&a.stopPropagation?a:null},parsePaneName:function(a){var b=d.layout.getEventObject(a);return b?(b.stopPropagation(),d(this).data("layoutEdge")):a},plugins:{draggable:!!d.fn.draggable,effects:{core:!!d.effects,slide:d.effects&&(d.effects.slide||d.effects.effect.slide)}},onCreate:[],onLoad:[],onReady:[],onDestroy:[],onUnload:[],afterOpen:[],afterClose:[],scrollbarWidth:function(){return window.scrollbarWidth||d.layout.getScrollbarSize("width")},
scrollbarHeight:function(){return window.scrollbarHeight||d.layout.getScrollbarSize("height")},getScrollbarSize:function(a){var b=d('<div style="position: absolute; top: -10000px; left: -10000px; width: 100px; height: 100px; overflow: scroll;"></div>').appendTo("body"),c={width:b.css("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&&a.length&&
(b||"none"===a.css("display"))){var c=a[0].style,c={display:c.display||"",visibility:c.visibility||""};a.css({display:"block",visibility:"hidden"});return c}return{}},getElementDimensions:function(a,b){var c={css:{},inset:{}},e=c.css,f={bottom:0},l=d.layout.cssNum,r=a.offset(),p,q,s;c.offsetLeft=r.left;c.offsetTop=r.top;b||(b={});d.each(["Left","Right","Top","Bottom"],function(k,l){p=e["border"+l]=d.layout.borderWidth(a,l);q=e["padding"+l]=d.layout.cssNum(a,"padding"+l);s=l.toLowerCase();c.inset[s]=
0<=b[s]?b[s]:q;f[s]=c.inset[s]+p});e.width=a.css("width");e.height=a.height();e.top=l(a,"top",!0);e.bottom=l(a,"bottom",!0);e.left=l(a,"left",!0);e.right=l(a,"right",!0);c.outerWidth=a.outerWidth();c.outerHeight=a.outerHeight();c.innerWidth=k(0,c.outerWidth-f.left-f.right);c.innerHeight=k(0,c.outerHeight-f.top-f.bottom);c.layoutWidth=a.innerWidth();c.layoutHeight=a.innerHeight();return c},getElementStyles:function(a,b){var c={},d=a[0].style,f=b.split(","),k=["Top","Bottom","Left","Right"],l=["Color",
"Style","Width"],p,q,s,u,v,t;for(u=0;u<f.length;u++)if(p=f[u],p.match(/(border|padding|margin)$/))for(v=0;4>v;v++)if(q=k[v],"border"===p)for(t=0;3>t;t++)s=l[t],c[p+q+s]=d[p+q+s];else c[p+q]=d[p+q];else c[p]=d[p];return c},cssWidth:function(a,b){if(0>=b)return 0;if(!d.layout.browser.boxModel)return b;var c=d.layout.borderWidth,e=d.layout.cssNum,c=b-c(a,"Left")-c(a,"Right")-e(a,"paddingLeft")-e(a,"paddingRight");return k(0,c)},cssHeight:function(a,b){if(0>=b)return 0;if(!d.layout.browser.boxModel)return b;
var c=d.layout.borderWidth,e=d.layout.cssNum,c=b-c(a,"Top")-c(a,"Bottom")-e(a,"paddingTop")-e(a,"paddingBottom");return k(0,c)},cssNum:function(a,b,c){a.jquery||(a=d(a));var e=d.layout.showInvisibly(a),b=d.css(a[0],b,!0),c=c&&"auto"==b?b:Math.round(parseFloat(b)||0);a.css(e);return c},borderWidth:function(a,b){a.jquery&&(a=a[0]);var c="border"+b.substr(0,1).toUpperCase()+b.substr(1);return"none"===d.css(a,c+"Style",!0)?0:Math.round(parseFloat(d.css(a,c+"Width",!0))||0)},isMouseOverElem:function(a,
b){var c=d(b||this),e=c.offset(),f=e.top,e=e.left,k=e+c.outerWidth(),c=f+c.outerHeight(),l=a.pageX,p=a.pageY;return d.layout.browser.msie&&0>l&&0>p||l>=e&&l<=k&&p>=f&&p<=c},msg:function(a,b,c,e){d.isPlainObject(a)&&window.debugData?("string"===typeof b?(e=c,c=b):"object"===typeof c&&(e=c,c=null),c=c||"log( <object> )",e=d.extend({sort:!1,returnHTML:!1,display:!1},e),!0===b||e.display?debugData(a,c,e):window.console&&console.log(debugData(a,c,e))):b?alert(a):window.console?console.log(a):(b=d("#layoutLogger"),
b.length||(b=d('<div id="layoutLogger" style="position: '+(d.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",d(window).width()-b.outerWidth()-5),d.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>"))}};d.layout.defaults={name:"",containerClass:"ui-layout-container",inset:null,scrollToBookmarkOnLoad:!0,resizeWithWindow:!0,resizeWithWindowDelay:200,resizeWithWindowMaxDelay:0,maskPanesEarly:!1,onresizeall_start:null,onresizeall_end:null,onload_start:null,
onload_end:null,onunload_start:null,onunload_end:null,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},errors:{pane:"pane",selector:"selector",addButtonError:"Error Adding Button \n\nInvalid ",containerMissing:"UI Layout Initialization Error\n\nThe specified layout-container does not exist.",centerPaneMissing:"UI Layout Initialization Error\n\nThe center-pane element does not exist.\n\nThe center-pane is a required element.",
noContainerHeight:"UI Layout Initialization Warning\n\nThe layout-container \"CONTAINER\" has no height.\n\nTherefore the layout is 0-height and hence 'invisible'!",callbackError:"UI Layout Callback Error\n\nThe EVENT callback is not a valid function."},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",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,sliderCursor:"pointer",slideTrigger_open:"click",
slideTrigger_close:"mouseleave",slideDelay_open:300,slideDelay_close:300,hideTogglerOnSlide:!1,preventQuickSlideClose:d.layout.browser.webkit,preventPrematureSlideClose:!1,tips:{Open:"Open",Close:"Close",Resize:"Resize",Slide:"Slide Open",Pin:"Pin",Unpin:"Un-Pin",noRoomToOpen:"Not enough room to show this panel.",minSizeWarning:"Panel has reached its minimum size",maxSizeWarning:"Panel has reached its maximum size"},showOverflowOnHover:!1,enableCursorHotkey:!0,customHotkeyModifier:"SHIFT",fxName:"slide",
fxSpeed:null,fxSettings:{},fxOpacityFix:!0,animatePaneSizing:!1,children:null,containerSelector:"",initChildren:!0,destroyChildren:!0,resizeChildren:!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}};d.layout.optionsMap={layout:"name instanceKey stateManagement effects inset zIndexes errors zIndex scrollToBookmarkOnLoad showErrorMessages maskPanesEarly outset resizeWithWindow resizeWithWindowDelay resizeWithWindowMaxDelay onresizeall onresizeall_start onresizeall_end onload onunload".split(" "),
center:"paneClass contentSelector contentIgnoreSelector findNestedContent applyDemoStyles triggerEventsOnLoad showOverflowOnHover maskContents maskObjects liveContentResizing containerSelector children initChildren resizeChildren destroyChildren onresize onresize_start onresize_end onsizecontent onsizecontent_start onsizecontent_end".split(" "),noDefault:["paneSelector","resizerCursor","customHotkey"]};d.layout.transformData=function(a,b){var c=b?{panes:{},center:{}}:{},e,f,k,l,p,q,s;if("object"!==
typeof a)return c;for(f in a){e=c;p=a[f];k=f.split("__");s=k.length-1;for(q=0;q<=s;q++)l=k[q],q===s?e[l]=d.isPlainObject(p)?d.layout.transformData(p):p:(e[l]||(e[l]={}),e=e[l])}return c};d.layout.backwardCompatibility={map:{applyDefaultStyles:"applyDemoStyles",childOptions:"children",initChildLayout:"initChildren",destroyChildLayout:"destroyChildren",resizeChildLayout:"resizeChildren",resizeNestedLayout:"resizeChildren",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",
noRoomToOpenTip:"tips.noRoomToOpen",togglerTip_open:"tips.Close",togglerTip_closed:"tips.Open",resizerTip:"tips.Resize",sliderTip:"tips.Slide"},renameOptions:function(a){function b(c,d){for(var e=c.split("."),f=e.length-1,j={branch:a,key:e[f]},k=0,m;k<f;k++)m=e[k],j.branch=void 0==j.branch[m]?d?j.branch[m]={}:{}:j.branch[m];return j}var c=d.layout.backwardCompatibility.map,e,f,k,l;for(l in c)e=b(l),k=e.branch[e.key],void 0!==k&&(f=b(c[l],!0),f.branch[f.key]=k,delete e.branch[e.key])},renameAllOptions:function(a){var b=
d.layout.backwardCompatibility.renameOptions;b(a);a.defaults&&("object"!==typeof a.panes&&(a.panes={}),d.extend(!0,a.panes,a.defaults),delete a.defaults);a.panes&&b(a.panes);d.each(d.layout.config.allPanes,function(c,d){a[d]&&b(a[d])});return a}};d.fn.layout=function(g){function j(a){if(!a)return!0;var b=a.keyCode;if(33>b)return!0;var c={38:"north",40:"south",37:"west",39:"east"},e=a.shiftKey,f=a.ctrlKey,g,k,j,l;f&&(37<=b&&40>=b)&&t[c[b]].enableCursorHotkey?l=c[b]:(f||e)&&d.each(n.borderPanes,function(a,
c){g=t[c];k=g.customHotkey;j=g.customHotkeyModifier;if(e&&"SHIFT"==j||f&&"CTRL"==j||f&&e)if(k&&b===(isNaN(k)||9>=k?k.toUpperCase().charCodeAt(0):k))return l=c,!1});if(!l||!M[l]||!t[l].closable||x[l].isHidden)return!0;Na(l);a.stopPropagation();return a.returnValue=!1}function m(a){if(H()){this&&this.tagName&&(a=this);var c;b(a)?c=M[a]:d(a).data("layoutRole")?c=d(a):d(a).parents().each(function(){if(d(this).data("layoutRole"))return c=d(this),!1});if(c&&c.length){var f=c.data("layoutEdge"),a=x[f];a.cssSaved&&
e(f);if(a.isSliding||a.isResizing||a.isClosed)a.cssSaved=!1;else{var g={zIndex:t.zIndexes.resizer_normal+1},k={},j=c.css("overflow"),l=c.css("overflowX"),m=c.css("overflowY");"visible"!=j&&(k.overflow=j,g.overflow="visible");l&&!l.match(/(visible|auto)/)&&(k.overflowX=l,g.overflowX="visible");m&&!m.match(/(visible|auto)/)&&(k.overflowY=l,g.overflowY="visible");a.cssSaved=k;c.css(g);d.each(n.allPanes,function(a,b){b!=f&&e(b)})}}}}function e(a){if(H()){this&&this.tagName&&(a=this);var c;b(a)?c=M[a]:
d(a).data("layoutRole")?c=d(a):d(a).parents().each(function(){if(d(this).data("layoutRole"))return c=d(this),!1});if(c&&c.length){var a=c.data("layoutEdge"),a=x[a],e=a.cssSaved||{};!a.isSliding&&!a.isResizing&&c.css("zIndex",t.zIndexes.pane_normal);c.css(e);a.cssSaved=!1}}}var l=d.layout.browser,n=d.layout.config,r=d.layout.cssWidth,p=d.layout.cssHeight,q=d.layout.getElementDimensions,s=d.layout.getElementStyles,u=d.layout.getEventObject,v=d.layout.parsePaneName,t=d.extend(!0,{},d.layout.defaults);
t.effects=d.extend(!0,{},d.layout.effects);var x={id:"layout"+d.now(),initialized:!1,paneResizing:!1,panesSliding:{},container:{innerWidth:0,innerHeight:0,outerWidth:0,outerHeight:0,layoutWidth:0,layoutHeight:0},north:{childIdx:0},south:{childIdx:0},east:{childIdx:0},west:{childIdx:0},center:{childIdx:0}},y={north:null,south:null,east:null,west:null,center:null},z={data:{},set:function(a,b,c){z.clear(a);z.data[a]=setTimeout(b,c)},clear:function(a){var b=z.data;b[a]&&(clearTimeout(b[a]),delete b[a])}},
E=function(a,b,c){var e=t;(e.showErrorMessages&&!c||c&&e.showDebugMessages)&&d.layout.msg(e.name+" / "+a,!1!==b);return!1},A=function(a,c,e){var f=c&&b(c),g=f?x[c]:x,k=f?t[c]:t,j=t.name,l=a+(a.match(/_/)?"":"_end"),m=l.match(/_end$/)?l.substr(0,l.length-4):"",n=k[l]||k[m],o="NC",p=[];!f&&"boolean"===d.type(c)&&(e=c,c="");if(n)try{b(n)&&(n.match(/,/)?(p=n.split(","),n=eval(p[0])):n=eval(n)),d.isFunction(n)&&(o=p.length?n(p[1]):f?n(c,M[c],g,k,j):n(aa,g,k,j))}catch(r){E(t.errors.callbackError.replace(/EVENT/,
d.trim((c||"")+" "+l)),!1)}!e&&!1!==o&&(f?(e=M[c],k=t[c],g=x[c],e.triggerHandler("layoutpane"+l,[c,e,g,k,j]),m&&e.triggerHandler("layoutpane"+m,[c,e,g,k,j])):(W.triggerHandler("layout"+l,[aa,g,k,j]),m&&W.triggerHandler("layout"+m,[aa,g,k,j])));(f&&"onresize_end"===a||"onsizecontent_end"===a)&&Ta(c+"",!0);return o},C=function(a){if(!l.mozilla){var b=M[a];"IFRAME"===x[a].tagName?b.css(n.hidden).css(n.visible):b.find("IFRAME").css(n.hidden).css(n.visible)}},J=function(a){var b=M[a],a=n[a].dir,b={minWidth:1001-
r(b,1E3),minHeight:1001-p(b,1E3)};"horz"===a&&(b.minSize=b.minHeight);"vert"===a&&(b.minSize=b.minWidth);return b},S=function(a,c,e){var f=a;b(a)?f=M[a]:a.jquery||(f=d(a));a=p(f,c);f.css({height:a,visibility:"visible"});0<a&&0<f.innerWidth()?e&&f.data("autoHidden")&&(f.show().data("autoHidden",!1),l.mozilla||f.css(n.hidden).css(n.visible)):e&&!f.data("autoHidden")&&f.hide().data("autoHidden",!0)},F=function(a,e,f){f||(f=n[a].dir);b(e)&&e.match(/%/)&&(e="100%"===e?-1:parseInt(e,10)/100);if(0===e)return 0;
if(1<=e)return parseInt(e,10);var g=t,k=0;"horz"==f?k=U.innerHeight-(M.north?g.north.spacing_open:0)-(M.south?g.south.spacing_open:0):"vert"==f&&(k=U.innerWidth-(M.west?g.west.spacing_open:0)-(M.east?g.east.spacing_open:0));if(-1===e)return k;if(0<e)return c(k*e);if("center"==a)return 0;var f="horz"===f?"height":"width",g=M[a],a="height"===f?wa[a]:!1,k=d.layout.showInvisibly(g),j=g.css(f),l=a?a.css(f):0;g.css(f,"auto");a&&a.css(f,"auto");e="height"===f?g.outerHeight():g.outerWidth();g.css(f,j).css(k);
a&&a.css(f,l);return e},B=function(a,b){var c=M[a],d=t[a],e=x[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"===n[a].dir?c.outerHeight()+f:c.outerWidth()+f},O=function(b,c){if(H()){var d=t[b],e=x[b],f=n[b],g=f.dir;f.sizeType.toLowerCase();var f=void 0!=c?c:e.isSliding,j=d.spacing_open,l=n.oppositeEdge[b],m=x[l],o=M[l],p=!o||!1===m.isVisible||m.isSliding?0:"horz"==g?o.outerHeight():o.outerWidth(),l=(!o||m.isHidden?0:t[l][!1!==m.isClosed?"spacing_closed":
"spacing_open"])||0,m="horz"==g?U.innerHeight:U.innerWidth,o=J("center"),o="horz"==g?k(t.center.minHeight,o.minHeight):k(t.center.minWidth,o.minWidth),f=m-j-(f?0:F("center",o,g)+p+l),g=e.minSize=k(F(b,d.minSize),J(b).minSize),f=e.maxSize=a(d.maxSize?F(b,d.maxSize):1E5,f),e=e.resizerPosition={},j=U.inset.top,p=U.inset.left,l=U.innerWidth,m=U.innerHeight,d=d.spacing_open;switch(b){case "north":e.min=j+g;e.max=j+f;break;case "west":e.min=p+g;e.max=p+f;break;case "south":e.min=j+m-f-d;e.max=j+m-g-d;break;
case "east":e.min=p+l-f-d,e.max=p+l-g-d}}},Y=function(a,b){var c=d(a),e=c.data("layoutRole"),f=c.data("layoutEdge"),g=t[f][e+"Class"],f="-"+f,k=c.hasClass(g+"-closed")?"-closed":"-open",j="-closed"===k?"-open":"-closed",k=g+"-hover "+(g+f+"-hover ")+(g+k+"-hover ")+(g+f+k+"-hover ");b&&(k+=g+j+"-hover "+(g+f+j+"-hover "));"resizer"==e&&c.hasClass(g+"-sliding")&&(k+=g+"-sliding-hover "+(g+f+"-sliding-hover "));return d.trim(k)},R=function(a,b){var c=d(b||this);a&&"toggler"===c.data("layoutRole")&&
a.stopPropagation();c.addClass(Y(c))},V=function(a,b){var c=d(b||this);c.removeClass(Y(c,!0))},G=function(){var a=d(this).data("layoutEdge"),b=x[a];!b.isClosed&&(!b.isResizing&&!x.paneResizing)&&(d.fn.disableSelection&&d("body").disableSelection(),t.maskPanesEarly&&za(a))},N=function(a,b){var c=b||this,e=d(c).data("layoutEdge"),f=e+"ResizerLeave";z.clear(e+"_openSlider");z.clear(f);b?x.paneResizing||(d.fn.enableSelection&&d("body").enableSelection(),t.maskPanesEarly&&Oa()):z.set(f,function(){N(a,
c)},200)},H=function(){return x.initialized||x.creatingLayout?!0:T()},T=function(a){var b=t;if(!W.is(":visible"))return!a&&(l.webkit&&"BODY"===W[0].tagName)&&setTimeout(function(){T(!0)},50),!1;if(!ua("center").length)return E(b.errors.centerPaneMissing);x.creatingLayout=!0;d.extend(U,q(W,b.inset));Ha();b.scrollToBookmarkOnLoad&&(a=self.location,a.hash&&a.replace(a.hash));aa.hasParentLayout?b.resizeWithWindow=!1:b.resizeWithWindow&&d(window).bind("resize."+ja,ga);delete x.creatingLayout;x.initialized=
!0;f(aa,d.layout.onReady);A("onload_end");return!0},Z=function(a,b){var c=v.call(this,a),e=M[c];if(e){var f=wa[c],g=x[c],k=t[c],j=t.stateManagement||{},k=b?k.children=b:k.children;if(d.isPlainObject(k))k=[k];else if(!k||!d.isArray(k))return;d.each(k,function(a,b){d.isPlainObject(b)&&(b.containerSelector?e.find(b.containerSelector):f||e).each(function(){var a=d(this),e=a.data("layout");if(!e){X({container:a,options:b},g);if(j.includeChildren&&x.stateData[c]){var e=(x.stateData[c].children||{})[b.instanceKey],
f=b.stateManagement||(b.stateManagement={autoLoad:!0});!0===f.autoLoad&&e&&(f.autoSave=!1,f.includeChildren=!0,f.autoLoad=d.extend(!0,{},e))}(e=a.layout(b))&&da(c,e)}})})}},X=function(a,b){var c=a.container,d=a.options,e=d.stateManagement,f=d.instanceKey||c.data("layoutInstanceKey");f||(f=(e&&e.cookie?e.cookie.name:"")||d.name);f=f?f.replace(/[^\w-]/gi,"_").replace(/_{2,}/g,"_"):"layout"+ ++b.childIdx;d.instanceKey=f;c.data("layoutInstanceKey",f);return f},da=function(a,b){var c=M[a],e=y[a],f=x[a];
d.isPlainObject(e)&&(d.each(e,function(a,b){b.destroyed&&delete e[a]}),d.isEmptyObject(e)&&(e=y[a]=null));!b&&!e&&(b=c.data("layout"));b&&(b.hasParentLayout=!0,c=b.options,X(b,f),e||(e=y[a]={}),e[c.instanceKey]=b.container.data("layout"));aa[a].children=y[a];b||Z(a)},ga=function(){var a=t,b=Number(a.resizeWithWindowDelay);10>b&&(b=100);z.clear("winResize");z.set("winResize",function(){z.clear("winResize");z.clear("winResizeRepeater");var b=q(W,a.inset);(b.innerWidth!==U.innerWidth||b.innerHeight!==
U.innerHeight)&&ab()},b);z.data.winResizeRepeater||Q()},Q=function(){var a=Number(t.resizeWithWindowMaxDelay);0<a&&z.set("winResizeRepeater",function(){Q();ab()},a)},I=function(){A("onunload_start");f(aa,d.layout.onUnload);A("onunload_end")},P=function(a){a=a?a.split(","):n.borderPanes;d.each(a,function(a,b){var c=t[b];if(c.enableCursorHotkey||c.customHotkey)return d(document).bind("keydown."+ja,j),!1})},D=function(){function a(b){var c=t[b],e=t.panes;c.fxSettings||(c.fxSettings={});e.fxSettings||
(e.fxSettings={});d.each(["_open","_close","_size"],function(a,f){var g="fxName"+f,k="fxSpeed"+f,j="fxSettings"+f,l=c[g]=c[g]||e[g]||c.fxName||e.fxName||"none";if(l==="none"||!t.effects[l]||!d.effects||!d.effects[l]&&!d.effects.effect[l])l=c[g]="none";l=t.effects[l]||{};g=l.all||null;l=l[b]||null;c[k]=c[k]||e[k]||c.fxSpeed||e.fxSpeed||null;c[j]=d.extend(true,{},g,l,e.fxSettings,c.fxSettings,e[j],c[j])});delete c.fxName;delete c.fxSpeed;delete c.fxSettings}var b,c,e,f,j,l;g=d.layout.transformData(g,
!0);g=d.layout.backwardCompatibility.renameAllOptions(g);if(!d.isEmptyObject(g.panes)){b=d.layout.optionsMap.noDefault;f=0;for(j=b.length;f<j;f++)e=b[f],delete g.panes[e];b=d.layout.optionsMap.layout;f=0;for(j=b.length;f<j;f++)e=b[f],delete g.panes[e]}b=d.layout.optionsMap.layout;var m=d.layout.config.optionRootKeys;for(e in g)f=g[e],0>d.inArray(e,m)&&0>d.inArray(e,b)&&(g.panes[e]||(g.panes[e]=d.isPlainObject(f)?d.extend(!0,{},f):f),delete g[e]);d.extend(!0,t,g);d.each(n.allPanes,function(f,k){n[k]=
d.extend(!0,{},n.panes,n[k]);c=t.panes;l=t[k];if("center"===k){b=d.layout.optionsMap.center;f=0;for(j=b.length;f<j;f++)if(e=b[f],!g.center[e]&&(g.panes[e]||!l[e]))l[e]=c[e]}else if(l=t[k]=d.extend(!0,{},c,l),a(k),l.resizerClass||(l.resizerClass="ui-layout-resizer"),!l.togglerClass)l.togglerClass="ui-layout-toggler";l.paneClass||(l.paneClass="ui-layout-pane")});f=g.zIndex;m=t.zIndexes;0<f&&(m.pane_normal=f,m.content_mask=k(f+1,m.content_mask),m.resizer_normal=k(f+2,m.resizer_normal));delete t.panes},
ua=function(a){a=t[a].paneSelector;if("#"===a.substr(0,1))return W.find(a).eq(0);var b=W.children(a).eq(0);return b.length?b:W.children("form:first").children(a).eq(0)},Ha=function(a){v(a);d.each(n.allPanes,function(a,b){ea(b,!0)});ia();d.each(n.borderPanes,function(a,b){M[b]&&x[b].isVisible&&(O(b),ba(b))});sa("center");d.each(n.allPanes,function(a,b){xa(b)})},ea=function(b,c){if(c||H()){var d=t[b],f=x[b],g=n[b],j=g.dir,l="center"===b,o={},q=M[b],u,v;q?Ya(b,!1,!0,!1):wa[b]=!1;q=M[b]=ua(b);if(q.length){q.data("layoutCSS")||
q.data("layoutCSS",s(q,"position,top,left,bottom,right,width,height,overflow,zIndex,display,backgroundColor,padding,margin,border"));aa[b]={name:b,pane:M[b],content:wa[b],options:t[b],state:x[b],children:y[b]};q.data({parentLayout:aa,layoutPane:aa[b],layoutEdge:b,layoutRole:"pane"}).css(g.cssReq).css("zIndex",t.zIndexes.pane_normal).css(d.applyDemoStyles?g.cssDemo:{}).addClass(d.paneClass+" "+d.paneClass+"-"+b).bind("mouseenter."+ja,R).bind("mouseleave."+ja,V);g={hide:"",show:"",toggle:"",close:"",
open:"",slideOpen:"",slideClose:"",slideToggle:"",size:"sizePane",sizePane:"sizePane",sizeContent:"",sizeHandles:"",enableClosable:"",disableClosable:"",enableSlideable:"",disableSlideable:"",enableResizable:"",disableResizable:"",swapPanes:"swapPanes",swap:"swapPanes",move:"swapPanes",removePane:"removePane",remove:"removePane",createChildren:"",resizeChildren:"",resizeAll:"resizeAll",resizeLayout:"resizeAll"};for(v in g)q.bind("layoutpane"+v.toLowerCase()+"."+ja,aa[g[v]||v]);ya(b,!1);l||(u=f.size=
F(b,d.size),l=F(b,d.minSize)||1,v=F(b,d.maxSize)||1E5,0<u&&(u=k(a(u,v),l)),f.autoResize=d.autoResize,f.isClosed=!1,f.isSliding=!1,f.isResizing=!1,f.isHidden=!1,f.pins||(f.pins=[]));f.tagName=q[0].tagName;f.edge=b;f.noRoom=!1;f.isVisible=!0;Ga(b);"horz"===j?o.height=p(q,u):"vert"===j&&(o.width=r(q,u));q.css(o);"horz"!=j&&sa(b,!0);d.initClosed&&d.closable&&!d.initHidden?Pa(b,!0,!0):d.initHidden||d.initClosed?Wa(b):f.noRoom||q.css("display","block");q.css("visibility","visible");d.showOverflowOnHover&&
q.hover(m,e);x.initialized&&(ia(b),P(b),xa(b))}else M[b]=!1}},xa=function(a){var b=M[a],c=x[a],d=t[a];b&&(b.data("layout")&&da(a,b.data("layout")),c.isVisible&&(x.initialized?ab():Sa(a),d.triggerEventsOnLoad?A("onresize_end",a):Ta(a,!0)),d.initChildren&&d.children&&Z(a))},Ga=function(a){a=a?a.split(","):n.borderPanes;d.each(a,function(a,b){var c=M[b],d=fa[b],e=x[b],f=n[b].side,g={};if(c){switch(b){case "north":g.top=U.inset.top;g.left=U.inset.left;g.right=U.inset.right;break;case "south":g.bottom=
U.inset.bottom;g.left=U.inset.left;g.right=U.inset.right;break;case "west":g.left=U.inset.left;break;case "east":g.right=U.inset.right}c.css(g);d&&e.isClosed?d.css(f,U.inset[f]):d&&!e.isHidden&&d.css(f,U.inset[f]+B(b))}})},ia=function(a){a=a?a.split(","):n.borderPanes;d.each(a,function(a,b){var c=M[b];fa[b]=!1;oa[b]=!1;if(c){var c=t[b],e=x[b],f="#"===c.paneSelector.substr(0,1)?c.paneSelector.substr(1):"",g=c.resizerClass,k=c.togglerClass,j="-"+b,l=aa[b],m=l.resizer=fa[b]=d("<div></div>"),l=l.toggler=
c.closable?oa[b]=d("<div></div>"):!1;!e.isVisible&&c.slidable&&m.attr("title",c.tips.Slide).css("cursor",c.sliderCursor);m.attr("id",f?f+"-resizer":"").data({parentLayout:aa,layoutPane:aa[b],layoutEdge:b,layoutRole:"resizer"}).css(n.resizers.cssReq).css("zIndex",t.zIndexes.resizer_normal).css(c.applyDemoStyles?n.resizers.cssDemo:{}).addClass(g+" "+g+j).hover(R,V).hover(G,N).appendTo(W);c.resizerDblClickToggle&&m.bind("dblclick."+ja,Na);l&&(l.attr("id",f?f+"-toggler":"").data({parentLayout:aa,layoutPane:aa[b],
layoutEdge:b,layoutRole:"toggler"}).css(n.togglers.cssReq).css(c.applyDemoStyles?n.togglers.cssDemo:{}).addClass(k+" "+k+j).hover(R,V).bind("mouseenter",G).appendTo(m),c.togglerContent_open&&d("<span>"+c.togglerContent_open+"</span>").data({layoutEdge:b,layoutRole:"togglerContent"}).data("layoutRole","togglerContent").data("layoutEdge",b).addClass("content content-open").css("display","none").appendTo(l),c.togglerContent_closed&&d("<span>"+c.togglerContent_closed+"</span>").data({layoutEdge:b,layoutRole:"togglerContent"}).addClass("content content-closed").css("display",
"none").appendTo(l),na(b));ca(b);e.isVisible?Xa(b):(Ea(b),va(b,!0))}});Aa()},ya=function(a,b){if(H()){var c=t[a],d=c.contentSelector,e=aa[a],f=M[a],g;d&&(g=e.content=wa[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",s(g,"height")),g.css(n.content.cssReq),c.applyDemoStyles&&(g.css(n.content.cssDemo),f.css(n.content.cssDemoPane)),f.css("overflowX").match(/(scroll|auto)/)&&f.css("overflow","hidden"),x[a].content=
{},!1!==b&&Sa(a)):e.content=wa[a]=!1}},ca=function(a){var b=d.layout.plugins.draggable,a=a?a.split(","):n.borderPanes;d.each(a,function(a,e){var f=t[e];if(!b||!M[e]||!f.resizable)return f.resizable=!1,!0;var g=x[e],k=t.zIndexes,j=n[e],l="horz"==j.dir?"top":"left",m=fa[e],o=f.resizerClass,p=0,r,q,s=o+"-drag",u=o+"-"+e+"-drag",v=o+"-dragging",y=o+"-"+e+"-dragging",Ma=o+"-dragging-limit",C=o+"-"+e+"-dragging-limit",B=!1;g.isClosed||m.attr("title",f.tips.Resize).css("cursor",f.resizerCursor);m.draggable({containment:W[0],
axis:"horz"==j.dir?"y":"x",delay:0,distance:1,grid:f.resizingGrid,helper:"clone",opacity:f.resizerDragOpacity,addClasses:!1,zIndex:k.resizer_drag,start:function(a,b){f=t[e];g=x[e];q=f.livePaneResizing;if(!1===A("ondrag_start",e))return!1;g.isResizing=!0;x.paneResizing=e;z.clear(e+"_closeSlider");O(e);r=g.resizerPosition;p=b.position[l];m.addClass(s+" "+u);B=!1;d("body").disableSelection();za(e)},drag:function(a,b){B||(b.helper.addClass(v+" "+y).css({right:"auto",bottom:"auto"}).children().css("visibility",
"hidden"),B=!0,g.isSliding&&M[e].css("zIndex",k.pane_sliding));var d=0;b.position[l]<r.min?(b.position[l]=r.min,d=-1):b.position[l]>r.max&&(b.position[l]=r.max,d=1);d?(b.helper.addClass(Ma+" "+C),window.defaultStatus=0<d&&e.match(/(north|west)/)||0>d&&e.match(/(south|east)/)?f.tips.maxSizeWarning:f.tips.minSizeWarning):(b.helper.removeClass(Ma+" "+C),window.defaultStatus="");q&&Math.abs(b.position[l]-p)>=f.liveResizingTolerance&&(p=b.position[l],c(a,b,e))},stop:function(a,b){d("body").enableSelection();
window.defaultStatus="";m.removeClass(s+" "+u);g.isResizing=!1;x.paneResizing=!1;c(a,b,e,!0)}})});var c=function(a,b,c,d){var e=b.position,f=n[c],a=t[c],b=x[c],g;switch(c){case "north":g=e.top;break;case "west":g=e.left;break;case "south":g=U.layoutHeight-e.top-a.spacing_open;break;case "east":g=U.layoutWidth-e.left-a.spacing_open}g-=U.inset[f.side];d?(!1!==A("ondrag_end",c)&&ra(c,g,!1,!0),Oa(!0),b.isSliding&&za(c)):Math.abs(g-b.size)<a.liveResizingTolerance||(ra(c,g,!1,!0),ta.each(ka))}},ka=function(){var a=
d(this),b=a.data("layoutMask"),b=x[b];"IFRAME"==b.tagName&&b.isVisible&&a.css({top:b.offsetTop,left:b.offsetLeft,width:b.outerWidth,height:b.outerHeight})},za=function(a,b){var c=n[a],e=["center"],f=t.zIndexes,g=d.extend({objectsOnly:!1,forSliding:x[a].isSliding},b),k,j;g.forSliding&&e.push(n.oppositeEdge[a]);"horz"===c.dir&&(e.push("west"),e.push("east"));d.each(e,function(a,b){j=x[b];k=t[b];j.isVisible&&(k.maskObjects||!g.objectsOnly&&k.maskContents)&&jb(b).each(function(){ka.call(this);this.style.zIndex=
j.isSliding?f.pane_sliding+1:f.pane_normal+1;this.style.display="block"})})},Oa=function(a){if(a||!x.paneResizing)ta.hide();else if(!a&&!d.isEmptyObject(x.panesSliding))for(var a=ta.length-1,b,c;0<=a;a--)c=ta.eq(a),b=c.data("layoutMask"),t[b].maskObjects||c.hide()},jb=function(a){for(var b=d([]),c,e=0,f=ta.length;e<f;e++)c=ta.eq(e),c.data("layoutMask")===a&&(b=b.add(c));if(b.length)return b;b=M[a];c=x[a];var e=t[a],f=t.zIndexes,g=d([]),k,j,l,m,n;if(e.maskContents||e.maskObjects)for(n=0;n<(e.maskObjects?
2:1);n++)k=e.maskObjects&&0==n,j=document.createElement(k?"iframe":"div"),l=d(j).data("layoutMask",a),j.className="ui-layout-mask ui-layout-mask-"+a,m=j.style,m.display="block",m.position="absolute",m.background="#FFF",k&&(j.frameborder=0,j.src="about:blank",m.opacity=0,m.filter="Alpha(Opacity='0')",m.border=0),"IFRAME"==c.tagName?(m.zIndex=f.pane_normal+1,W.append(j)):(l.addClass("ui-layout-mask-inside-pane"),m.zIndex=e.maskZindex||f.content_mask,m.top=0,m.left=0,m.width="100%",m.height="100%",b.append(j)),
g=g.add(j),ta=ta.add(j);return g},Ya=function(a,b,c,e){if(H()){var a=v.call(this,a),f=M[a],g=wa[a],k=fa[a],j=oa[a];f&&d.isEmptyObject(f.data())&&(f=!1);g&&d.isEmptyObject(g.data())&&(g=!1);k&&d.isEmptyObject(k.data())&&(k=!1);j&&d.isEmptyObject(j.data())&&(j=!1);f&&f.stop(!0,!0);var l=t[a],m=y[a],n=d.isPlainObject(m)&&!d.isEmptyObject(m),e=void 0!==e?e:l.destroyChildren;n&&e&&(d.each(m,function(a,b){b.destroyed||b.destroy(!0);b.destroyed&&delete m[a]}),d.isEmptyObject(m)&&(m=y[a]=null,n=!1));f&&b&&
!n?f.remove():f&&f[0]&&(b=l.paneClass,e=b+"-"+a,b=[b,b+"-open",b+"-closed",b+"-sliding",e,e+"-open",e+"-closed",e+"-sliding"],d.merge(b,Y(f,!0)),f.removeClass(b.join(" ")).removeData("parentLayout").removeData("layoutPane").removeData("layoutRole").removeData("layoutEdge").removeData("autoHidden").unbind("."+ja),n&&g?(g.width(g.width()),d.each(m,function(a,b){b.resizeAll()})):g&&g.css(g.data("layoutCSS")).removeData("layoutCSS").removeData("layoutRole"),f.data("layout")||f.css(f.data("layoutCSS")).removeData("layoutCSS"));
j&&j.remove();k&&k.remove();aa[a]=M[a]=wa[a]=fa[a]=oa[a]=!1;c||ab()}},K=function(a){var b=M[a],c=b[0].style;t[a].useOffscreenClose?(b.data(n.offscreenReset)||b.data(n.offscreenReset,{left:c.left,right:c.right}),b.css(n.offscreenCSS)):b.hide().removeData(n.offscreenReset)},pa=function(a){var b=M[a],a=t[a],c=n.offscreenCSS,d=b.data(n.offscreenReset),e=b[0].style;b.show().removeData(n.offscreenReset);if(a.useOffscreenClose&&d&&(e.left==c.left&&(e.left=d.left),e.right==c.right))e.right=d.right},Wa=function(a,
b){if(H()){var c=v.call(this,a),d=t[c],e=x[c],f=fa[c];M[c]&&!e.isHidden&&!(x.initialized&&!1===A("onhide_start",c))&&(e.isSliding=!1,delete x.panesSliding[c],f&&f.hide(),!x.initialized||e.isClosed?(e.isClosed=!0,e.isHidden=!0,e.isVisible=!1,x.initialized||K(c),sa("horz"===n[c].dir?"":"center"),(x.initialized||d.triggerEventsOnLoad)&&A("onhide_end",c)):(e.isHiding=!0,Pa(c,!1,b)))}},Fa=function(a,b,c,d){if(H()){var a=v.call(this,a),e=x[a];M[a]&&e.isHidden&&!1!==A("onshow_start",a)&&(e.isShowing=!0,
e.isSliding=!1,delete x.panesSliding[a],!1===b?Pa(a,!0):ha(a,!1,c,d))}},Na=function(a,b){if(H()){var c=u(a),d=v.call(this,a),e=x[d];c&&c.stopImmediatePropagation();e.isHidden?Fa(d):e.isClosed?ha(d,!!b):Pa(d)}},fb=function(a){var b=x[a];K(a);b.isClosed=!0;b.isVisible=!1},Pa=function(a,b,c,d){function e(){j.isMoving=!1;va(f,!0);var a=n.oppositeEdge[f];x[a].noRoom&&(O(a),ba(a));if(!d&&(x.initialized||k.triggerEventsOnLoad))m||A("onclose_end",f),m&&A("onshow_end",f),o&&A("onhide_end",f)}var f=v.call(this,
a);if(!x.initialized&&M[f])fb(f);else if(H()){var g=M[f],k=t[f],j=x[f],l,m,o;W.queue(function(a){if(!g||!k.closable&&!j.isShowing&&!j.isHiding||!b&&j.isClosed&&!j.isShowing)return a();var d=!j.isShowing&&!1===A("onclose_start",f);m=j.isShowing;o=j.isHiding;delete j.isShowing;delete j.isHiding;if(d)return a();l=!c&&!j.isClosed&&"none"!=k.fxName_close;j.isMoving=!0;j.isClosed=!0;j.isVisible=!1;o?j.isHidden=!0:m&&(j.isHidden=!1);j.isSliding?Da(f,!1):sa("horz"===n[f].dir?"":"center",!1);Ea(f);l?(Ra(f,
!0),g.hide(k.fxName_close,k.fxSettings_close,k.fxSpeed_close,function(){Ra(f,false);j.isClosed&&e();a()})):(K(f),e(),a())})}},Ea=function(a){var b=fa[a],c=oa[a],e=t[a],f=n[a].side,g=e.resizerClass,j=e.togglerClass,k="-"+a;b.css(f,U.inset[f]).removeClass(g+"-open "+g+k+"-open").removeClass(g+"-sliding "+g+k+"-sliding").addClass(g+"-closed "+g+k+"-closed");e.resizable&&d.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",e.tips.Open),c.children(".content-open").hide(),c.children(".content-closed").css("display","block"));gb(a,!1);x.initialized&&Aa()},ha=function(a,b,c,d){function e(){j.isMoving=!1;C(f);j.isSliding||sa("vert"==n[f].dir?"center":"",!1);Xa(f)}if(H()){var f=v.call(this,a),g=M[f],k=t[f],j=x[f],l,m;W.queue(function(a){if(!g||!k.resizable&&!k.closable&&!j.isShowing||j.isVisible&&!j.isSliding)return a();if(j.isHidden&&!j.isShowing)a(),
Fa(f,!0);else{j.autoResize&&j.size!=k.size?La(f,k.size,!0,!0,!0):O(f,b);var n=A("onopen_start",f);if("abort"===n)return a();"NC"!==n&&O(f,b);if(j.minSize>j.maxSize)return gb(f,!1),!d&&k.tips.noRoomToOpen&&alert(k.tips.noRoomToOpen),a();b?Da(f,!0):j.isSliding?Da(f,!1):k.slidable&&va(f,!1);j.noRoom=!1;ba(f);m=j.isShowing;delete j.isShowing;l=!c&&j.isClosed&&"none"!=k.fxName_open;j.isMoving=!0;j.isVisible=!0;j.isClosed=!1;m&&(j.isHidden=!1);l?(Ra(f,!0),g.show(k.fxName_open,k.fxSettings_open,k.fxSpeed_open,
function(){Ra(f,false);j.isVisible&&e();a()})):(pa(f),e(),a())}})}},Xa=function(a,b){var c=M[a],e=fa[a],f=oa[a],g=t[a],j=x[a],k=n[a].side,l=g.resizerClass,m=g.togglerClass,o="-"+a;e.css(k,U.inset[k]+B(a)).removeClass(l+"-closed "+l+o+"-closed").addClass(l+"-open "+l+o+"-open");j.isSliding?e.addClass(l+"-sliding "+l+o+"-sliding"):e.removeClass(l+"-sliding "+l+o+"-sliding");V(0,e);g.resizable&&d.layout.plugins.draggable?e.draggable("enable").css("cursor",g.resizerCursor).attr("title",g.tips.Resize):
j.isSliding||e.css("cursor","default");f&&(f.removeClass(m+"-closed "+m+o+"-closed").addClass(m+"-open "+m+o+"-open").attr("title",g.tips.Close),V(0,f),f.children(".content-closed").hide(),f.children(".content-open").css("display","block"));gb(a,!j.isSliding);d.extend(j,q(c));x.initialized&&(Aa(),Sa(a,!0));if(!b&&(x.initialized||g.triggerEventsOnLoad)&&c.is(":visible"))A("onopen_end",a),j.isShowing&&A("onshow_end",a),x.initialized&&A("onresize_end",a)},qa=function(a){function b(){e.isClosed?e.isMoving||
ha(d,!0):Da(d,!0)}if(H()){var c=u(a),d=v.call(this,a),e=x[d],a=t[d].slideDelay_open;c&&c.stopImmediatePropagation();e.isClosed&&c&&"mouseenter"===c.type&&0<a?z.set(d+"_openSlider",b,a):b()}},Za=function(a){function b(){f.isClosed?Da(e,!1):f.isMoving||Pa(e)}if(H()){var c=u(a),e=v.call(this,a),a=t[e],f=x[e],g=f.isMoving?1E3:300;!f.isClosed&&!f.isResizing&&("click"===a.slideTrigger_close?b():a.preventQuickSlideClose&&f.isMoving||a.preventPrematureSlideClose&&c&&d.layout.isMouseOverElem(c,M[e])||(c?z.set(e+
"_closeSlider",b,k(a.slideDelay_close,g)):b()))}},Ra=function(a,b){var c=M[a],d=x[a],e=t[a],f=t.zIndexes;b?(za(a,{objectsOnly:!0}),c.css({zIndex:f.pane_animate}),"south"==a?c.css({top:U.inset.top+U.innerHeight-c.outerHeight()}):"east"==a&&c.css({left:U.inset.left+U.innerWidth-c.outerWidth()})):(Oa(),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"}),l.msie&&(e.fxOpacityFix&&"slide"!=e.fxName_open&&
c.css("filter")&&1==c.css("opacity"))&&c[0].style.removeAttribute("filter"))},va=function(a,b){var c=t[a],d=fa[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");if(c.resizerDblClickToggle&&e.match(/click/))d[b?"unbind":"bind"]("dblclick."+ja,Na);d[b?"bind":"unbind"](e+"."+ja,qa).css("cursor",b?c.sliderCursor:"default").attr("title",b?c.tips.Slide:"")}},Da=function(a,
b){function c(b){z.clear(a+"_closeSlider");b.stopPropagation()}var d=t[a],e=x[a],f=t.zIndexes,g=d.slideTrigger_close.toLowerCase(),j=b?"bind":"unbind",k=M[a],l=fa[a];z.clear(a+"_closeSlider");b?(e.isSliding=!0,x.panesSliding[a]=!0,va(a,!1)):(e.isSliding=!1,delete x.panesSliding[a]);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,Za);"mouseleave"===g&&(k[j]("mouseleave."+ja,
Za),l[j]("mouseenter."+ja,c),k[j]("mouseenter."+ja,c));b?"click"===g&&!d.resizable&&(l.css("cursor",b?d.sliderCursor:"default"),l.attr("title",b?d.tips.Close:"")):z.clear(a+"_closeSlider")},ba=function(a,b,c,e){var b=t[a],f=x[a],g=n[a],j=M[a],k=fa[a],l="vert"===g.dir,m=!1;if("center"===a||l&&f.noVerticalRoom)(m=0<=f.maxHeight)&&f.noRoom?(pa(a),k&&k.show(),f.isVisible=!0,f.noRoom=!1,l&&(f.noVerticalRoom=!1),C(a)):!m&&!f.noRoom&&(K(a),k&&k.hide(),f.isVisible=!1,f.noRoom=!0);if("center"!==a)if(f.minSize<=
f.maxSize){if(f.size>f.maxSize?La(a,f.maxSize,c,!0,e):f.size<f.minSize?La(a,f.minSize,c,!0,e):k&&(f.isVisible&&j.is(":visible"))&&(c=f.size+U.inset[g.side],d.layout.cssNum(k,g.side)!=c&&k.css(g.side,c)),f.noRoom)f.wasOpen&&b.closable?b.autoReopen?ha(a,!1,!0,!0):f.noRoom=!1:Fa(a,f.wasOpen,!0,!0)}else f.noRoom||(f.noRoom=!0,f.wasOpen=!f.isClosed&&!f.isSliding,f.isClosed||(b.closable?Pa(a,!0,!0):Wa(a,!0)))},ra=function(a,b,c,d,e){if(H()){var a=v.call(this,a),f=t[a],g=x[a],e=e||f.livePaneResizing&&!g.isResizing;
g.autoResize=!1;La(a,b,c,d,e)}},La=function(b,c,e,f,g){function j(){for(var a="width"===z?s.outerWidth():s.outerHeight(),a=[{pane:l,count:1,target:c,actual:a,correct:c===a,attempt:c,cssSize:G}],b=a[0],f={},m="Inaccurate size after resizing the "+l+"-pane.";!b.correct;){f={pane:l,count:b.count+1,target:c};f.attempt=b.actual>c?k(0,b.attempt-(b.actual-c)):k(0,b.attempt+(c-b.actual));f.cssSize=("horz"==n[l].dir?p:r)(M[l],f.attempt);s.css(z,f.cssSize);f.actual="width"==z?s.outerWidth():s.outerHeight();
f.correct=c===f.actual;1===a.length&&(E(m,!1,!0),E(b,!1,!0));E(f,!1,!0);if(3<a.length)break;a.push(f);b=a[a.length-1]}o.size=c;d.extend(o,q(s));o.isVisible&&s.is(":visible")&&(u&&u.css(y,c+U.inset[y]),Sa(l));!e&&(!C&&x.initialized&&o.isVisible)&&A("onresize_end",l);e||(o.isSliding||sa("horz"==n[l].dir?"":"center",C,g),Aa());b=n.oppositeEdge[l];c<D&&x[b].noRoom&&(O(b),ba(b,!1,e));1<a.length&&E(m+"\nSee the Error Console for details.",!0,!0)}if(H()){var l=v.call(this,b),m=t[l],o=x[l],s=M[l],u=fa[l],
y=n[l].side,z=n[l].sizeType.toLowerCase(),C=o.isResizing&&!m.triggerEventsDuringLiveResize,B=!0!==f&&m.animatePaneSizing,D,G;W.queue(function(b){O(l);D=o.size;c=F(l,c);c=k(c,F(l,m.minSize));c=a(c,o.maxSize);if(c<o.minSize)b(),ba(l,!1,e);else{if(!g&&c===D)return b();!e&&(x.initialized&&o.isVisible)&&A("onresize_start",l);G=("horz"==n[l].dir?p:r)(M[l],c);if(B&&s.is(":visible")){var f=d.layout.effects.size[l]||d.layout.effects.size.all,f=m.fxSettings_size.easing||f.easing,u=t.zIndexes,v={};v[z]=G+"px";
o.isMoving=!0;s.css({zIndex:u.pane_animate}).show().animate(v,m.fxSpeed_size,f,function(){s.css({zIndex:o.isSliding?u.pane_sliding:u.pane_normal});o.isMoving=!1;j();b()})}else s.css(z,G),s.is(":visible")?j():(o.size=c,d.extend(o,q(s))),b()}})}},sa=function(a,b,c){a=(a?a:"east,west,center").split(",");d.each(a,function(a,e){if(M[e]){var f=t[e],g=x[e],j=M[e],m=!0,n={},s=d.layout.showInvisibly(j),u={top:B("north",!0),bottom:B("south",!0),left:B("west",!0),right:B("east",!0),width:0,height:0};u.width=
U.innerWidth-u.left-u.right;u.height=U.innerHeight-u.bottom-u.top;u.top+=U.inset.top;u.bottom+=U.inset.bottom;u.left+=U.inset.left;u.right+=U.inset.right;d.extend(g,q(j));if("center"===e){if(!c&&g.isVisible&&u.width===g.outerWidth&&u.height===g.outerHeight)return j.css(s),!0;d.extend(g,J(e),{maxWidth:u.width,maxHeight:u.height});n=u;n.width=r(j,n.width);n.height=p(j,n.height);m=0<=n.width&&0<=n.height;if(!x.initialized&&f.minWidth>u.width){var f=f.minWidth-g.outerWidth,u=t.east.minSize||0,v=t.west.minSize||
0,y=x.east.size,z=x.west.size,C=y,D=z;0<f&&(x.east.isVisible&&y>u)&&(C=k(y-u,y-f),f-=y-C);0<f&&(x.west.isVisible&&z>v)&&(D=k(z-v,z-f),f-=z-D);if(0===f){y&&y!=u&&La("east",C,!0,!0,c);z&&z!=v&&La("west",D,!0,!0,c);sa("center",b,c);j.css(s);return}}}else{g.isVisible&&!g.noVerticalRoom&&d.extend(g,q(j),J(e));if(!c&&!g.noVerticalRoom&&u.height===g.outerHeight)return j.css(s),!0;n.top=u.top;n.bottom=u.bottom;n.height=p(j,u.height);g.maxHeight=n.height;m=0<=g.maxHeight;m||(g.noVerticalRoom=!0)}m?(!b&&x.initialized&&
A("onresize_start",e),j.css(n),"center"!==e&&Aa(e),g.noRoom&&(!g.isClosed&&!g.isHidden)&&ba(e),g.isVisible&&(d.extend(g,q(j)),x.initialized&&Sa(e))):!g.noRoom&&g.isVisible&&ba(e);j.css(s);if(!g.isVisible)return!0;"center"===e&&(g=l.isIE6||!l.boxModel,M.north&&(g||"IFRAME"==x.north.tagName)&&M.north.css("width",r(M.north,U.innerWidth)),M.south&&(g||"IFRAME"==x.south.tagName)&&M.south.css("width",r(M.south,U.innerWidth)));!b&&x.initialized&&A("onresize_end",e)}})},ab=function(a){v(a);if(W.is(":visible"))if(x.initialized){if(d.extend(U,
q(W,t.inset)),U.outerHeight){!0===a&&Ga();if(!1===A("onresizeall_start"))return!1;var b,c,e;d.each(["south","north","east","west"],function(a,b){M[b]&&(c=t[b],e=x[b],e.autoResize&&e.size!=c.size?La(b,c.size,!0,!0,!0):(O(b),ba(b,!1,!0,!0)))});sa("",!0,!0);Aa();d.each(n.allPanes,function(a,c){(b=M[c])&&x[c].isVisible&&A("onresize_end",c)});A("onresizeall_end")}}else T()},Ta=function(a,b){var c=v.call(this,a);t[c].resizeChildren&&(b||da(c),c=y[c],d.isPlainObject(c)&&d.each(c,function(a,b){b.resizeAll()}))},
Sa=function(a,b){if(H()){var c=v.call(this,a),c=c?c.split(","):n.allPanes;d.each(c,function(a,c){function d(a){return k(l.css.paddingBottom,parseInt(a.css("marginBottom"),10)||0)}function e(){var a=t[c].contentIgnoreSelector,a=g.nextAll().not(".ui-layout-mask").not(a||":lt(0)"),b=a.filter(":visible"),f=b.filter(":last");m={top:g[0].offsetTop,height:g.outerHeight(),numFooters:a.length,hiddenFooters:a.length-b.length,spaceBelow:0};m.spaceAbove=m.top;m.bottom=m.top+m.height;m.spaceBelow=f.length?f[0].offsetTop+
f.outerHeight()-m.bottom+d(f):d(g)}var f=M[c],g=wa[c],j=t[c],l=x[c],m=l.content;if(!f||!g||!f.is(":visible"))return!0;if(!g.length&&(ya(c,!1),!g))return;if(!1!==A("onsizecontent_start",c)){if(!l.isMoving&&!l.isResizing||j.liveContentResizing||b||void 0==m.top)e(),0<m.hiddenFooters&&"hidden"===f.css("overflow")&&(f.css("overflow","visible"),e(),f.css("overflow","hidden"));f=l.innerHeight-(m.spaceAbove-l.css.paddingTop)-(m.spaceBelow-l.css.paddingBottom);if(!g.is(":visible")||m.height!=f)S(g,f,!0),
m.height=f;x.initialized&&A("onsizecontent_end",c)}})}},Aa=function(a){a=(a=v.call(this,a))?a.split(","):n.borderPanes;d.each(a,function(a,e){var f=t[e],g=x[e],j=M[e],k=fa[e],l=oa[e],m;if(j&&k){var o=n[e].dir,q=g.isClosed?"_closed":"_open",s=f["spacing"+q],u=f["togglerAlign"+q],q=f["togglerLength"+q],v;if(0===s)k.hide();else{!g.noRoom&&!g.isHidden&&k.show();"horz"===o?(v=U.innerWidth,g.resizerLength=v,j=d.layout.cssNum(j,"left"),k.css({width:r(k,v),height:p(k,s),left:-9999<j?j:U.inset.left})):(v=
j.outerHeight(),g.resizerLength=v,k.css({height:p(k,v),width:r(k,s),top:U.inset.top+B("north",!0)}));V(f,k);if(l){if(0===q||g.isSliding&&f.hideTogglerOnSlide){l.hide();return}l.show();if(!(0<q)||"100%"===q||q>v)q=v,u=0;else if(b(u))switch(u){case "top":case "left":u=0;break;case "bottom":case "right":u=v-q;break;default:u=c((v-q)/2)}else j=parseInt(u,10),u=0<=u?j:v-q+j;if("horz"===o){var y=r(l,q);l.css({width:y,height:p(l,s),left:u,top:0});l.children(".content").each(function(){m=d(this);m.css("marginLeft",
c((y-m.outerWidth())/2))})}else{var z=p(l,q);l.css({height:z,width:r(l,s),top:u,left:0});l.children(".content").each(function(){m=d(this);m.css("marginTop",c((z-m.outerHeight())/2))})}V(0,l)}if(!x.initialized&&(f.initHidden||g.noRoom))k.hide(),l&&l.hide()}}})},na=function(a){if(H()){var b=v.call(this,a),a=oa[b],c=t[b];a&&(c.closable=!0,a.bind("click."+ja,function(a){a.stopPropagation();Na(b)}).css("visibility","visible").css("cursor","pointer").attr("title",x[b].isClosed?c.tips.Open:c.tips.Close).show())}},
gb=function(a,b){d.layout.plugins.buttons&&d.each(x[a].pins,function(c,e){d.layout.buttons.setPinState(aa,d(e),a,b)})},W=d(this).eq(0);if(!W.length)return E(t.errors.containerMissing);if(W.data("layoutContainer")&&W.data("layout"))return W.data("layout");var M={},wa={},fa={},oa={},ta=d([]),U=x.container,ja=x.id,aa={options:t,state:x,container:W,panes:M,contents:wa,resizers:fa,togglers:oa,hide:Wa,show:Fa,toggle:Na,open:ha,close:Pa,slideOpen:qa,slideClose:Za,slideToggle:function(a){a=v.call(this,a);
Na(a,!0)},setSizeLimits:O,_sizePane:La,sizePane:ra,sizeContent:Sa,swapPanes:function(a,b){function c(a){var b=M[a],e=wa[a];return!b?!1:{pane:a,P:b?b[0]:!1,C:e?e[0]:!1,state:d.extend(!0,{},x[a]),options:d.extend(!0,{},t[a])}}function e(a,b){if(a){var c=a.P,f=a.C,g=a.pane,j=n[b],m=d.extend(!0,{},x[b]),o=t[b],p={resizerCursor:o.resizerCursor};d.each(["fxName","fxSpeed","fxSettings"],function(a,b){p[b+"_open"]=o[b+"_open"];p[b+"_close"]=o[b+"_close"];p[b+"_size"]=o[b+"_size"]});M[b]=d(c).data({layoutPane:aa[b],
layoutEdge:b}).css(n.hidden).css(j.cssReq);wa[b]=f?d(f):!1;t[b]=d.extend(!0,{},a.options,p);x[b]=d.extend(!0,{},a.state);c.className=c.className.replace(RegExp(o.paneClass+"-"+g,"g"),o.paneClass+"-"+b);ia(b);j.dir!=n[g].dir?(c=l[b]||0,O(b),c=k(c,x[b].minSize),ra(b,c,!0,!0)):fa[b].css(j.side,U.inset[j.side]+(x[b].isVisible?B(b):0));a.state.isVisible&&!m.isVisible?Xa(b,!0):(Ea(b),va(b,!0));a=null}}if(H()){var f=v.call(this,a);x[f].edge=b;x[b].edge=f;if(!1===A("onswap_start",f)||!1===A("onswap_start",
b))x[f].edge=f,x[b].edge=b;else{var g=c(f),j=c(b),l={};l[f]=g?g.state.size:0;l[b]=j?j.state.size:0;M[f]=!1;M[b]=!1;x[f]={};x[b]={};oa[f]&&oa[f].remove();oa[b]&&oa[b].remove();fa[f]&&fa[f].remove();fa[b]&&fa[b].remove();fa[f]=fa[b]=oa[f]=oa[b]=!1;e(g,b);e(j,f);g=j=l=null;M[f]&&M[f].css(n.visible);M[b]&&M[b].css(n.visible);ab();A("onswap_end",f);A("onswap_end",b)}}},showMasks:za,hideMasks:Oa,initContent:ya,addPane:ea,removePane:Ya,createChildren:Z,refreshChildren:da,enableClosable:na,disableClosable:function(a,
b){if(H()){var c=v.call(this,a),d=oa[c];d&&(t[c].closable=!1,x[c].isClosed&&ha(c,!1,!0),d.unbind("."+ja).css("visibility",b?"hidden":"visible").css("cursor","default").attr("title",""))}},enableSlidable:function(a){if(H()){var a=v.call(this,a),b=fa[a];b&&b.data("draggable")&&(t[a].slidable=!0,x[a].isClosed&&va(a,!0))}},disableSlidable:function(a){if(H()){var a=v.call(this,a),b=fa[a];b&&(t[a].slidable=!1,x[a].isSliding?Pa(a,!1,!0):(va(a,!1),b.css("cursor","default").attr("title",""),V(null,b[0])))}},
enableResizable:function(a){if(H()){var a=v.call(this,a),b=fa[a],c=t[a];b&&b.data("draggable")&&(c.resizable=!0,b.draggable("enable"),x[a].isClosed||b.css("cursor",c.resizerCursor).attr("title",c.tips.Resize))}},disableResizable:function(a){if(H()){var a=v.call(this,a),b=fa[a];b&&b.data("draggable")&&(t[a].resizable=!1,b.draggable("disable").css("cursor","default").attr("title",""),V(null,b[0]))}},allowOverflow:m,resetOverflow:e,destroy:function(a,b){d(window).unbind("."+ja);d(document).unbind("."+
ja);"object"===typeof a?v(a):b=a;W.clearQueue().removeData("layout").removeData("layoutContainer").removeClass(t.containerClass).unbind("."+ja);ta.remove();d.each(n.allPanes,function(a,c){Ya(c,!1,!0,b)});W.data("layoutCSS")&&!W.data("layoutRole")&&W.css(W.data("layoutCSS")).removeData("layoutCSS");"BODY"===U.tagName&&(W=d("html")).data("layoutCSS")&&W.css(W.data("layoutCSS")).removeData("layoutCSS");f(aa,d.layout.onDestroy);I();for(var c in aa)c.match(/^(container|options)$/)||delete aa[c];aa.destroyed=
!0;return aa},initPanes:H,resizeAll:ab,runCallbacks:A,hasParentLayout:!1,children:y,north:!1,south:!1,west:!1,east:!1,center:!1};return"cancel"===function(){D();var a=t,b=x;b.creatingLayout=!0;f(aa,d.layout.onCreate);if(!1===A("onload_start"))return"cancel";var c=W[0],e=d("html"),g=U.tagName=c.tagName,j=U.id=c.id,k=U.className=c.className,c=t,m=c.name,n={},p=W.data("parentLayout"),r=W.data("layoutEdge"),u=p&&r,v=d.layout.cssNum,y;U.selector=W.selector.split(".slice")[0];U.ref=(c.name?c.name+" layout / ":
"")+g+(j?"#"+j:k?".["+k+"]":"");U.isBody="BODY"===g;!u&&!U.isBody&&(g=W.closest("."+d.layout.defaults.panes.paneClass),p=g.data("parentLayout"),r=g.data("layoutEdge"),u=p&&r);W.data({layout:aa,layoutContainer:ja}).addClass(c.containerClass);g={destroy:"",initPanes:"",resizeAll:"resizeAll",resize:"resizeAll"};for(m in g)W.bind("layout"+m.toLowerCase()+"."+ja,aa[g[m]||m]);u&&(aa.hasParentLayout=!0,p.refreshChildren(r,aa));W.data("layoutCSS")||(U.isBody?(W.data("layoutCSS",d.extend(s(W,"position,margin,padding,border"),
{height:W.css("height"),overflow:W.css("overflow"),overflowX:W.css("overflowX"),overflowY:W.css("overflowY")})),e.data("layoutCSS",d.extend(s(e,"padding"),{height:"auto",overflow:e.css("overflow"),overflowX:e.css("overflowX"),overflowY:e.css("overflowY")}))):W.data("layoutCSS",s(W,"position,margin,padding,border,top,bottom,left,right,width,height,overflow,overflowX,overflowY")));try{n={overflow:"hidden",overflowX:"hidden",overflowY:"hidden"};W.css(n);c.inset&&!d.isPlainObject(c.inset)&&(y=parseInt(c.inset,
10)||0,c.inset={top:y,bottom:y,left:y,right:y});if(U.isBody)c.outset?d.isPlainObject(c.outset)||(y=parseInt(c.outset,10)||0,c.outset={top:y,bottom:y,left:y,right:y}):c.outset={top:v(e,"paddingTop"),bottom:v(e,"paddingBottom"),left:v(e,"paddingLeft"),right:v(e,"paddingRight")},e.css(n).css({height:"100%",border:"none",padding:0,margin:0}),l.isIE6?(W.css({width:"100%",height:"100%",border:"none",padding:0,margin:0,position:"relative"}),c.inset||(c.inset=q(W).inset)):(W.css({width:"auto",height:"auto",
margin:0,position:"absolute"}),W.css(c.outset)),d.extend(U,q(W,c.inset));else{var z=W.css("position");(!z||!z.match(/(fixed|absolute|relative)/))&&W.css("position","relative");W.is(":visible")&&(d.extend(U,q(W,c.inset)),1>U.innerHeight&&E(c.errors.noContainerHeight.replace(/CONTAINER/,U.ref)))}v(W,"minWidth")&&W.parent().css("overflowX","auto");v(W,"minHeight")&&W.parent().css("overflowY","auto")}catch(C){}P();d(window).bind("unload."+ja,I);f(aa,d.layout.onLoad);a.initPanes&&T();delete b.creatingLayout;
return x.initialized}()?null:aa};d(function(){var a=d.layout.browser;a.msie&&(a.boxModel=d.support.boxModel)})})(l);(function(d){d.ui||(d.ui={});d.ui.cookie={acceptsCookies:!!navigator.cookieEnabled,read:function(a){for(var k=document.cookie,k=k?k.split(";"):[],c,b=0,f=k.length;b<f;b++){c=d.trim(k[b]).split("=");if(c[0]==a)return decodeURIComponent(c[1])}return null},write:function(a,d,c){var b="",f="",g=false,c=c||{},j=c.expires;if(j&&j.toUTCString)f=j;else if(j===null||typeof j==="number"){f=new Date;
if(j>0)f.setDate(f.getDate()+j);else{f.setFullYear(1970);g=true}}f&&(b=b+(";expires="+f.toUTCString()));c.path&&(b=b+(";path="+c.path));c.domain&&(b=b+(";domain="+c.domain));c.secure&&(b=b+";secure");document.cookie=a+"="+(g?"":encodeURIComponent(d))+b},clear:function(a){d.ui.cookie.write(a,"",{expires:-1})}};d.cookie||(d.cookie=function(a,k,c){var b=d.ui.cookie;if(k===null)b.clear(a);else{if(k===void 0)return b.read(a);b.write(a,k,c)}});d.layout.plugins.stateManagement=!0;d.layout.config.optionRootKeys.push("stateManagement");
d.layout.defaults.stateManagement={enabled:!1,autoSave:!0,autoLoad:!0,includeChildren:!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}};d.layout.optionsMap.layout.push("stateManagement");d.layout.state={saveCookie:function(a,k,c){var b=a.options,f=b.stateManagement,c=d.extend(true,{},f.cookie,c||null),a=a.state.stateData=
a.readState(k||f.stateKeys);d.ui.cookie.write(c.name||b.name||"Layout",d.layout.state.encodeJSON(a),c);return d.extend(true,{},a)},deleteCookie:function(a){a=a.options;d.ui.cookie.clear(a.stateManagement.cookie.name||a.name||"Layout")},readCookie:function(a){a=a.options;return(a=d.ui.cookie.read(a.stateManagement.cookie.name||a.name||"Layout"))?d.layout.state.decodeJSON(a):{}},loadCookie:function(a){var k=d.layout.state.readCookie(a);if(k){a.state.stateData=d.extend(true,{},k);a.loadState(k)}return k},
loadState:function(a,k){k=d.layout.transformData(k);if(d.isPlainObject(k)&&!d.isEmptyObject(k)){a.state.stateData=k;var c=d.extend(true,{},k);d.each(d.layout.config.allPanes,function(a,d){c[d]&&delete c[d].children});d.extend(true,a.options,c)}},readState:function(a,k){d.type(k)==="string"&&(k={keys:k});k||(k={});var c=a.options.stateManagement,b=k.includeChildren,b=b!==void 0?b:c.includeChildren,c=k.stateKeys||c.stateKeys,f={isClosed:"initClosed",isHidden:"initHidden"},g=a.state,j=d.layout.config.allPanes,
l={},e,o,n,r,p,q;d.isArray(c)&&(c=c.join(","));for(var c=c.replace(/__/g,".").split(","),s=0,u=c.length;s<u;s++){e=c[s].split(".");o=e[0];e=e[1];if(!(d.inArray(o,j)<0)){n=g[o][e];if(n!=void 0){e=="isClosed"&&g[o].isSliding&&(n=true);(l[o]||(l[o]={}))[f[e]?f[e]:e]=n}}}b&&d.each(j,function(b,c){p=a.children[c];r=g.stateData[c];if(d.isPlainObject(p)&&!d.isEmptyObject(p)){q=l[c]||(l[c]={});if(!q.children)q.children={};d.each(p,function(a,b){b.state.initialized?q.children[a]=d.layout.state.readState(b):
r&&(r.children&&r.children[a])&&(q.children[a]=d.extend(true,{},r.children[a]))})}});return l},encodeJSON:function(a){function k(a){var b=[],f=0,g,j,l,e=d.isArray(a);for(g in a){j=a[g];l=typeof j;l=="string"?j='"'+j+'"':l=="object"&&(j=k(j));b[f++]=(!e?'"'+g+'":':"")+j}return(e?"[":"{")+b.join(",")+(e?"]":"}")}return k(a)},decodeJSON:function(a){try{return d.parseJSON?d.parseJSON(a):window.eval("("+a+")")||{}}catch(k){return{}}},_create:function(a){var k=d.layout.state,c=a.options.stateManagement;
d.extend(a,{readCookie:function(){return k.readCookie(a)},deleteCookie:function(){k.deleteCookie(a)},saveCookie:function(b,c){return k.saveCookie(a,b,c)},loadCookie:function(){return k.loadCookie(a)},loadState:function(b,c){k.loadState(a,b,c)},readState:function(b){return k.readState(a,b)},encodeJSON:k.encodeJSON,decodeJSON:k.decodeJSON});a.state.stateData={};if(c.autoLoad)if(d.isPlainObject(c.autoLoad))d.isEmptyObject(c.autoLoad)||a.loadState(c.autoLoad);else if(c.enabled)if(d.isFunction(c.autoLoad)){var b=
{};try{b=c.autoLoad(a,a.state,a.options,a.options.name||"")}catch(f){}b&&(d.isPlainObject(b)&&!d.isEmptyObject(b))&&a.loadState(b)}else a.loadCookie()},_unload:function(a){var k=a.options.stateManagement;if(k.enabled&&k.autoSave)if(d.isFunction(k.autoSave))try{k.autoSave(a,a.state,a.options,a.options.name||"")}catch(c){}else a.saveCookie()}};d.layout.onCreate.push(d.layout.state._create);d.layout.onUnload.push(d.layout.state._unload);d.layout.plugins.buttons=!0;d.layout.defaults.autoBindCustomButtons=
!1;d.layout.optionsMap.layout.push("autoBindCustomButtons");d.layout.buttons={init:function(a){var k=a.options.name||"",c;d.each(["toggle","open","close","pin","toggle-slide","open-slide"],function(b,f){d.each(d.layout.config.borderPanes,function(b,j){d(".ui-layout-button-"+f+"-"+j).each(function(){c=d(this).data("layoutName")||d(this).attr("layoutName");(c==void 0||c===k)&&a.bindButton(this,f,j)})})})},get:function(a,k,c,b){var f=d(k),a=a.options,g=a.errors.addButtonError;if(f.length)if(d.inArray(c,
d.layout.config.borderPanes)<0){d.layout.msg(g+" "+a.errors.pane+": "+c,true);f=d("")}else{k=a[c].buttonClass+"-"+b;f.addClass(k+" "+k+"-"+c).data("layoutName",a.name)}else d.layout.msg(g+" "+a.errors.selector+": "+k,true);return f},bind:function(a,k,c,b){var f=d.layout.buttons;switch(c.toLowerCase()){case "toggle":f.addToggle(a,k,b);break;case "open":f.addOpen(a,k,b);break;case "close":f.addClose(a,k,b);break;case "pin":f.addPin(a,k,b);break;case "toggle-slide":f.addToggle(a,k,b,true);break;case "open-slide":f.addOpen(a,
k,b,true)}return a},addToggle:function(a,k,c,b){d.layout.buttons.get(a,k,c,"toggle").click(function(d){a.toggle(c,!!b);d.stopPropagation()});return a},addOpen:function(a,k,c,b){d.layout.buttons.get(a,k,c,"open").attr("title",a.options[c].tips.Open).click(function(d){a.open(c,!!b);d.stopPropagation()});return a},addClose:function(a,k,c){d.layout.buttons.get(a,k,c,"close").attr("title",a.options[c].tips.Close).click(function(b){a.close(c);b.stopPropagation()});return a},addPin:function(a,k,c){var b=
d.layout.buttons,f=b.get(a,k,c,"pin");if(f.length){var g=a.state[c];f.click(function(f){b.setPinState(a,d(this),c,g.isSliding||g.isClosed);g.isSliding||g.isClosed?a.open(c):a.close(c);f.stopPropagation()});b.setPinState(a,f,c,!g.isClosed&&!g.isSliding);g.pins.push(k)}return a},setPinState:function(a,d,c,b){var f=d.attr("pin");if(!(f&&b===(f=="down"))){var a=a.options[c],f=a.buttonClass+"-pin",g=f+"-"+c,c=f+"-up "+g+"-up",f=f+"-down "+g+"-down";d.attr("pin",b?"down":"up").attr("title",b?a.tips.Unpin:
a.tips.Pin).removeClass(b?c:f).addClass(b?f:c)}},syncPinBtns:function(a,k,c){d.each(a.state[k].pins,function(b,f){d.layout.buttons.setPinState(a,d(f),k,c)})},_load:function(a){var k=d.layout.buttons;d.extend(a,{bindButton:function(b,c,d){return k.bind(a,b,c,d)},addToggleBtn:function(b,c,d){return k.addToggle(a,b,c,d)},addOpenBtn:function(b,c,d){return k.addOpen(a,b,c,d)},addCloseBtn:function(b,c){return k.addClose(a,b,c)},addPinBtn:function(b,c){return k.addPin(a,b,c)}});for(var c=0;c<4;c++)a.state[d.layout.config.borderPanes[c]].pins=
[];a.options.autoBindCustomButtons&&k.init(a)},_unload:function(){}};d.layout.onLoad.push(d.layout.buttons._load);d.layout.plugins.browserZoom=!0;d.layout.defaults.browserZoomCheckInterval=1E3;d.layout.optionsMap.layout.push("browserZoomCheckInterval");d.layout.browserZoom={_init:function(a){d.layout.browserZoom.ratio()!==false&&d.layout.browserZoom._setTimer(a)},_setTimer:function(a){if(!a.destroyed){var k=a.options,c=a.state,b=a.hasParentLayout?5E3:Math.max(k.browserZoomCheckInterval,100);setTimeout(function(){if(!a.destroyed&&
k.resizeWithWindow){var b=d.layout.browserZoom.ratio();if(b!==c.browserZoom){c.browserZoom=b;a.resizeAll()}d.layout.browserZoom._setTimer(a)}},b)}},ratio:function(){function a(a,b){return(parseInt(a,10)/parseInt(b,10)*100).toFixed()}var k=window,c=screen,b=document,f=b.documentElement||b.body,g=d.layout.browser,j=g.version,l,e,o;return g.msie&&j>8||!g.msie?false:c.deviceXDPI&&c.systemXDPI?a(c.deviceXDPI,c.systemXDPI):g.webkit&&(l=b.body.getBoundingClientRect)?a(l.left-l.right,b.body.offsetWidth):
g.webkit&&(e=k.outerWidth)?a(e,k.innerWidth):(e=c.width)&&(o=f.clientWidth)?a(e,o):false}};d.layout.onReady.push(d.layout.browserZoom._init)})(l)});define("RepositoryBrowser",["jquery","Class","PubSub","repository-browser-i18n-"+(window&&window.__DEPS__&&window.__DEPS__.lang||"en"),"jstree","jqgrid","jquery-layout"],function(l,d,a,k){function c(a){a.each(function(){g(this).attr("unselectable","on").css({"-moz-user-select":"none","-webkit-user-select":"none","user-select":"none"}).each(function(){this.onselectstart=
function(){return!1}})})}function b(a,b){a._cachedRepositoryObjects[b.uid]=b}function f(a,c){var d=++e,g=!1===a.hasMoreItems||"folder"!==a.baseType?null:"closed",j=null;if(a.children){var g="open",j=[],k,m;for(k=0;k<a.children.length;k++)m=f(a.children[k],c),j.push(m),b(c,m.resource)}k=l.extend(a,{uid:d,loaded:!1});m={rel:a.type,"data-repo-obj":d};var o=a.name,x;a:switch(a.baseType){case "folder":x="folder";break a;case "document":x="document";break a;default:x=""}return{state:g,resource:k,children:j,
attr:m,data:{title:o,icon:x,attr:{"data-repo-obj":d}}}}var g=l,j=[],m=0,e=(new Date).getTime(),o={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 d.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(b){b=g.extend({},o,b,{i18n:k});if(!b.element||0===b.element.length)b.isFloating=!0,b.element=this._createOverlay();b.maxWidth<b.minWidth&&(b.maxWidth=b.minWidth);g.extend(this,b);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();j.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",++e);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,b=this.treeWidth/5;this.$_grid.layout({enableCursorHotkey:!1,west__size:this.treeWidth-
1,west__minSize:this.treeWidth-b,west__maxSize:this.treeWidth+b,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();g(function(){g(window).resize(function(){a._onWindowResized()})});this.element.mousedown(function(){g.each(j,function(a){this.element.css("z-index",99999+a)});g(this).css("z-index",99999+
j.length+1)});g(".repository-browser-grid").css("width",this.maxWidth);this.close();this._adaptPageSize()},_setInitialHeight:function(){var a=this.maxHeight-g(window).height()+this.verticalPadding;this.$_grid.height(0<a?Math.max(this.minHeight,this.maxHeight-a):this.maxHeight)},_onWindowResized:function(){var a=this.maxWidth-g(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,c,d){"function"===typeof c&&(d=c,c=void 0);var e=this,g=[],j=e._currentFolder&&e._currentFolder.id,k=null,l,m;for(m=0;m<a.length;m++)l=f(a[m],e),g.push(l),b(e,l.resource),j===l.resource.id&&(k=l.resource);d(g,c);k&&window.setTimeout(function(){e.$_tree.jstree("select_node",'li[data-repo-obj="'+k.uid+'"]')},0)},_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;if(c=this._cachedRepositoryObjects[b.rslt.obj.find("a:first").attr("data-repo-obj")])this._pagingOffset=0,this._currentFolder=c,this._clearSearch(),this._fetchItems(c),this.folderSelected(c)}},_createTree:function(a){var b=
g('<div class="repository-browser-tree">'),c=g('<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(){l(this).find(">ul>li:first").css("padding-top",5);l(this).find('li[rel="repository"]:first').each(function(a,c){b.jstree("open_node",c)})});var d=this;b.bind("select_node.jstree",function(a,b){d._onTreeNodeSelected(a,b)});b.bind("open_node.jstree",
function(a,b){d.folderOpened(b.rslt.obj)});b.bind("close_node.jstree",function(a,b){d.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){d.repositoryManager?(d.jstree_callback=b,d._fetchSubnodes(a,b)):b()},correct_state:!0},ui:{select_limit:1}});return b},_createGrid:function(a){var b=g('<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=g('<table id="repository-browser-list-'+ ++e+'" class="repository-browser-list"></table>'),c=[{name:"id",sorttype:"int",firstsortorder:"asc",hidden:!0}],d=[""];g.each(this.columns,function(a,b){d.push(b.title||"&nbsp;");c.push({name:a,width:b.width,sortable:b.sortable,sorttype:b.sorttype,resizable:b.resizable,fixed:b.fixed})});var f="repository-browser-list-page-"+ ++e;a.append(b,g('<div id="'+f+'">'));b.jqGrid({datatype:"local",width:a.width(),
shrinkToFit:!0,colNames:d,colModel:c,caption:"&nbsp;",altRows:!0,altclass:"repository-browser-list-altrow",resizeclass:"repository-browser-list-resizable",pager:"#"+f,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]=g(this).parent().addClass("ui-state-disabled").click(function(){g(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 k=b[0].p;a.find(".ui-jqgrid-view tr:first th div").each(function(a){!1!==k.colModel[a].sortable&&
(g(this).css("cursor","pointer"),g(this).unbind().click(function(b){b.stopPropagation();j._sortList(k.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=g('<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(){g(this).val()===c._prefilledValue&&g(this).val("").removeClass("repository-browser-search-field-empty")});
b.blur(function(){""===g(this).val()&&c._clearSearch()});a.find(".repository-browser-close-btn").click(function(){c.close()});a.find(".repository-browser-btn").mousedown(function(){g(this).addClass("repository-browser-pressed")}).mouseup(function(){g(this).removeClass("repository-browser-pressed")})},_triggerSearch:function(){var a=this.$_grid.find("input.repository-browser-search-field"),b=a.val();if(g(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";g(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={},d=!1,e=this._orderBy||[],f,g,j;c[a]=b||"asc";for(j=0;j<e.length;++j){f=e[j];for(g in f)if(f.hasOwnProperty(g)&&g===a){e.splice(j,1);e.unshift(c);d=!0;break}if(d)break}d&&e.unshift(c);this._orderBy=e},_listItems:function(a){var b=
this.$_list.clearGridData(),c,d;for(c=0;c<a.length;c++)d=a[c].resource,b.addRowData(d.uid,g.extend({id:d.id},this.renderRowCols(d)))},handleTimeout:function(){},_processItems:function(a,b){this._pagingCount=b&&g.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");g.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 d;0===a.length&&0===this._pagingOffset?d=c=0:(c=this._pagingOffset+1,d=c+a.length-1);this.$_grid.find(".ui-paging-info").html(this._i18n("Viewing")+" "+c+" - "+d+" "+this._i18n("of")+" "+(g.isNumeric(this._pagingCount)?
this._pagingCount:this._i18n("numerous")));b&&b.timeout&&this.handleTimeout()},_createOverlay:function(){0===g(".repository-browser-modal-overlay").length&&g("body").append('<div class="repository-browser-modal-overlay" style="top: -99999px; z-index: 99999;"></div>');var a=this;g(".repository-browser-modal-overlay").click(function(){a.close()});var b=g('<div class="repository-browser-modal-window" style="top: -99999px; z-index: 99999;">');g("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 d=this._getObjectFromCache(a.eq(c));d&&this.fetchChildren(d,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={};g.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(d){c._cachedRepositoryObjects[a.uid].loaded=!0;"function"===typeof b&&b(d)})}},
rowClicked:function(a){a=g(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?(g(".repository-browser-modal-overlay").stop().css({top:0,left:0}).show(),a.stop().show(),this._onWindowResized(),this.$_grid.resize(),g(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(){g.browser.msie&&
g(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());++m}},close:function(){this._isOpened&&(this._isOpened=!1,this.element.fadeOut(250,function(){g(this).css("top",0).hide();(0===m||0===--m)&&g(".repository-browser-modal-overlay").hide()}))},refresh:function(){this._currentFolder&&this._fetchItems(this._currentFolder)},
folderOpened:function(a){(a=this._cachedRepositoryObjects[a.find("a:first").attr("data-repo-obj")])&&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(l,d,a,k,c,b,f,g,j){var m=g.extend({init:function(a){this._super(a);var d=this;this._linkBrowserButton=c.adopt("linkBrowser",b,{tooltip:j.t("button.addlink.tooltip"),
icon:"aloha-icon-tree",scope:"Aloha.continuoustext",click:function(){d.show()}});this._linkBrowserButton.hide();this.url=l.getAlohaUrl()+"/../plugins/extra/linkbrowser/";l.bind("aloha-link-selected",function(){d._linkBrowserButton.show()});l.bind("aloha-link-unselected",function(){d._linkBrowserButton.hide()})},onSelect:function(a){f.hrefField.setItem(a);var b=l.Selection.getRangeObject(),c=b.startContainer=b.endContainer,d=b.startOffset=b.endOffset;b.select();b.startContainer=b.endContainer=c;b.startOffset=
b.endOffset=d;b.select();l.trigger("aloha-link-selected-in-linkbrowser",a);this.close()},renderRowCols:function(a){var b={},c=this.url;a.id.match(/(\d+)\./);d.each(this.columns,function(d){switch(d){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 d=a.renditions,f=d.length,g=[],j;f>0;--f){j=d[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[d]=a[d]||"--"}});return b}});return a.create("linkbrowser",{dependencies:["link"],browser:null,init:function(){this.browser=new m({repositoryManager:l.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:l.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(l,d,a,k,c,b,f,g,j){var m=g.extend({init:function(a){this._super(a);var d=this;this._imageBrowserButton=c.adopt("imageBrowser",b,{tooltip:j.t("button.addimage.tooltip"),icon:"aloha-icon-tree",scope:"Aloha.continuoustext","class":"aloha-imagebrowser-button",click:function(){d.open()}});this._imageBrowserButton.show(false);this.url=l.getAlohaUrl()+"/../plugins/extra/imagebrowser/";l.bind("aloha-image-selected",function(){d._imageBrowserButton.show(true)});l.bind("aloha-image-unselected",function(){d._imageBrowserButton.show(false)})},
onSelect:function(a){if(a.type.match("image")!==null){f.ui.imgSrcField.setItem(a);f.resetSize();this.close()}},listItems:function(a){var b=this,c=this.list.clearGridData();d.each(a,function(){var a=this.resource;a.type.match("image")!==null&&c.addRowData(a.uid,d.extend({id:a.id},b.renderRowCols(a)))})},renderRowCols:function(a){var b={};a.id.match(/(\d+)\./);d.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 m({repositoryManager:l.RepositoryManager,repositoryFilter:[],objectTypeFilter:["image"],renditionFilter:["*"],filter:["language"],columns:{icon:{title:"",width:75,sortable:false,resizable:false},name:{title:"Name",width:320,sorttype:"text"}},rootPath:l.settings.baseUrl+
"/vendor/repository-browser/"})}})});define("ui/menuButton",["jquery","ui/component","ui/utils","jqueryui"],function(l,d,a){function k(b,d){var f=[];l.each(d,function(d,j){var n=l("<li>");n.append(l("<a>",{href:"javascript:void 0",html:a.makeButtonLabelWithIcon(j)}));j.click&&n.data("aloha-ui-menubutton-select",function(){b();j.click()});if(j.menu){var r=l("<ul>").appendTo(n);r.append(k(c(r,b),j.menu))}f.push(n[0])});return f}function c(a,b){b=b||l.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 f=d.extend({init:function(){this.element=f.makeMenuButton(this)}});f.makeMenuButton=function(d){function f(a){a.hide().parent().removeClass("aloha-ui-menubutton-pressed")}var m=l("<div>",{"class":"aloha-ui-menubutton-container"}),e=a.makeButtonElement({"class":"aloha-ui-menubutton-expand"}),o=l("<ul>",{"class":"aloha-ui-menubutton-menu"}),n=null,r=null;l.browser.msie&&m.addClass("aloha-ui-menubutton-iehack");
d.click?(n=a.makeButton(a.makeButtonElement({"class":"aloha-ui-menubutton-action"}),d).click(d.click),a.makeButton(e,{},!0),r=l("<div>").buttonset().append(n).append(e)):a.makeButton(e,d,!0).addClass("aloha-ui-menubutton-single");if(!d.menu)return m.append(n);e.click(function(){m.addClass("aloha-ui-menubutton-pressed");d.siblingContainer&&d.siblingContainer.find(".aloha-ui-menubutton-menu").each(function(){this!==o[0]&&f(l(this))});if(o.is(":visible"))f(o);else{o.show().position({my:"left top",at:"left bottom",
of:n||e});l(document).bind("click",function(a){l(this).unbind(a);o.hide();m.removeClass("aloha-ui-menubutton-pressed")});return false}});m.append(r||e).append(o);o.append(k(c(o),d.menu));o.hide().menu({select:b});return m};return f});define("ribbon/ribbon-plugin",["jquery","aloha/plugin","ui/menuButton","ui/utils","jqueryui"],function(l,d,a,k){return d.create("ribbon",{init:function(){if(this.settings.enable||"undefined"===typeof this.settings.enable){var a=this;this._visible=!1;this._toolbar=l("<div>",
{"class":"aloha-ribbon-toolbar ui-menubar ui-widget-header ui-helper-clearfix"});var b=k.makeButtonElement({"class":"aloha-ribbon-in"}).button().hide().click(function(){a._toolbar.animate({left:0});l("body").animate({paddingTop:30});b.hide()}).appendTo(this._toolbar);k.makeButtonElement({"class":"aloha-ribbon-out"}).button().click(function(){a._toolbar.animate({left:-a._toolbar.outerWidth()+b.outerWidth()+10});l("body").animate({paddingTop:0});b.show()}).appendTo(this._toolbar);var d=l("<div>",{"class":"aloha aloha-ribbon"}).appendTo("body");
this._icon=l("<div>").prependTo(this._toolbar);this.setIcon("");this._toolbar.appendTo(d);l("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=l.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(l,d,a,k){var c=d.Deferred();return new (l.AbstractRepository.extend({languageCodes:[],locale:"de",iso:"iso639-1",
flags:!1,_constructor:function(){this._super("wai-languages")},init:function(){var a=this,d=l.require("wai-lang/wai-lang-plugin"),g=d.iso639;"de"!==l.settings.locale&&(this.locale="en");"iso639-1"!==g&&(this.iso="iso639-2");this.flags=d.flags;this.repositoryName="WaiLanguages";l.require(["wai-lang/"+this.iso+"-"+this.locale],function(d){a.storeLanguageCodes(d);c.resolve()})},markObject:function(){},errorHandler:function(a){k.log("error",this,"Error while loading languages. "+a)},storeLanguageCodes:function(b){var c=
this,g=l.getPluginUrl("wai-lang");d.each(b,function(b,d){d.id=b;d.repositoryId=c.repositoryId;d.type="language";c.flags&&(d.url=d.flag?a.path+"/img/flags/"+d.flag+".png":g+"/img/button.png");c.languageCodes.push(new l.RepositoryDocument(d))})},_searchInLanguageCodes:function(a,c){var g=RegExp("^"+a.queryString,"i"),j,k=[],e,l,n;for(j=0;j<this.languageCodes.length;++j)n=this.languageCodes[j],e=!a.queryString||n.name.match(g),l=!a.objectTypeFilter||!a.objectTypeFilter.length||-1<d.inArray(n.type,a.objectTypeFilter),
e&&l&&k.push(n);c.call(this,k)},query:function(a,d){var g=this;c.done(function(){g._searchInLanguageCodes(a,d)})},getObjectById:function(a,c){var d,j;for(d=0;d<this.languageCodes.length;++d)if(j=this.languageCodes[d],j.id===a){c.call(this,[j]);break}}}))});define("wai-lang/wai-lang-plugin","aloha jquery PubSub aloha/plugin aloha/selection util/dom ui/ui ui/scopes ui/button ui/toggleButton ui/port-helper-attribute-field i18n!wai-lang/nls/i18n wai-lang/languages".split(" "),function(l,d,a,k,c,b,f,g,
j,m,e,o){function n(a){if(a){a.foreground();a.focus()}y.show();z.show()}function r(){var a=d(this);return a.hasClass(x)||a.is("[lang]")}function p(a){return l.activeEditable?a.findMarkup(r,l.activeEditable.obj):null}function q(a){a.isCollapsed()&&b.extendToWord(a);b.addMarkup(a,d('<span class="'+x+'"></span>'),false);a.select()}function s(a){var c=p(a);if(c){b.removeFromDOM(c,a,true);a.select()}}function u(){if(l.activeEditable){var a=c.getRangeObject();if(p(a))s(a);else{q(a);n(y)}}}function v(a){y=
e({name:"wailangfield",width:320,valueField:"id",minChars:1,scope:"Aloha.continuoustext"});a._wailangButton=f.adopt("wailang",m,{tooltip:o.t("button.add-wai-lang.tooltip"),icon:"aloha-icon aloha-icon-wai-lang",scope:"Aloha.continuoustext",click:u});z=f.adopt("removewailang",j,{tooltip:o.t("button.add-wai-lang-remove.tooltip"),icon:"aloha-icon aloha-icon-wai-lang-remove",scope:"Aloha.continuoustext",click:function(){s(c.getRangeObject())}});y.setTemplate(a.flags?'<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>':
'<div class="aloha-wai-lang-img-item"><div class="aloha-wai-lang-label-item">{name} ({id})</div></div>');y.setObjectTypeFilter(a.objectTypeFilter)}function t(b){a.sub("aloha.editable.activated",function(a){var a=a.data.editable,c=a.getId()+":"+b._instanceId;A[c]||(A[c]=b.getEditableConfig(a.obj));d.inArray("span",A[c])>-1?b._wailangButton.show():b._wailangButton.hide()});l.bind("aloha-selection-changed",function(a,c){var d=p(c);if(d){b._wailangButton.setState(true);y.setTargetObject(d,"lang");y.show();
z.show();g.enterScope(b.name,"wai-lang")}else{b._wailangButton.setState(false);y.setTargetObject(null);y.hide();z.hide();g.leaveScope(b.name,"wai-lang",true)}});y.addListener("blur",function(){this.getValue()||s(c.getRangeObject())});l.bind("aloha-editable-created",function(a,e){e.obj.bind("keydown",b.hotKey.insertAnnotation,function(){var a=c.getRangeObject();p(a)||q(a);n(y);return false});e.obj.find("span[lang]").each(function(){var a=d(this);a.addClass(x).attr("data-gentics-aloha-repository","wai-languages").attr("data-gentics-aloha-object-id",
a.attr("lang"))})})}var x="aloha-wai-lang",y=null,z=null,E=function(a){var b=0;return function(){return a+"-"+ ++b}}(),A={};return k.create("wai-lang",{config:["span"],iso639:"iso639-1",flags:false,objectTypeFilter:["language"],hotKey:{insertAnnotation:o.t("insertAnnotation","ctrl+shift+l")},init:function(){this._instanceId=E("wai-lang");if(this.settings.objectTypeFilter)this.objectTypeFilter=this.settings.objectTypeFilter;this.settings.hotKey&&d.extend(true,this.hotKey,this.settings.hotKey);if(this.settings.iso639)this.iso639=
this.settings.iso639;this.flags=true===this.settings.flags||1===this.settings.flags||"true"===this.settings.flags||"1"===this.settings.flags;v(this);t(this)},formatLanguageSpan:u,makeClean:function(a){a.find("span[lang]").each(function(){var a=d(this);a.removeClass(x).removeAttr("data-gentics-aloha-repository").removeAttr("data-gentics-aloha-object-id").attr("xml:lang",a.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","aloha jquery PubSub aloha/plugin util/html i18n!headerids/nls/i18n".split(" "),function(l,d,a,k,c,b){function f(){var a=[],b=m;j.each(arguments,function(){a.push("."+(this==""?b:b+"-"+this))});return d.trim(a.join(" "))}function g(){var a=[],b=m;j.each(arguments,function(){a.push(this==""?b:b+"-"+this)});return d.trim(a.join(" "))}var j=d,m="aloha-headerids";return k.create("headerids",
{_constructor:function(){this._super("headerids")},config:["true"],init:function(){var b=this,c=function(a){b.check(a.data.obj||a.data.editable.obj)};a.sub("aloha.editable.created",c);a.sub("aloha.editable.activated",c);a.sub("aloha.editable.deactivated",c);l.bind("aloha-plugins-loaded",function(){b.initSidebar(l.Sidebar.right)})},check:function(a){var b=this;j.inArray("true",b.getEditableConfig(a))>-1&&a.find("h1,h2,h3,h4,h5,h6").not(".aloha-customized,.aloha-editable,.aloha-block").each(function(a,
c){b.processH(c)})},processH:function(a){var b=a.id;if(!b){for(var a=j(a),c=b="heading_"+this.sanitize(a.text()),d=1;j("#"+b).length>0;)b=c+"_"+(++d).toString();a.attr("id",b)}return b},sanitize:function(a){return c.trimWhitespaceCharacters(a).replace(/[^a-z0-9]+/gi,"_")},initSidebar:function(a){var c=this;c.sidebar=a;a.addPanel({id:g("sidebar-panel"),title:b.t("internal_hyperlink"),content:"",expanded:true,activeOn:"h1, h2, h3, h4, h5, h6",onInit:function(){var a=this,e=this.setContent('<label class="'+
g("label")+'" for="'+g("input")+'">'+b.t("headerids.label.target")+'</label><input id="'+g("input")+'" class="'+g("input")+'" type="text" name="value"/> <button class="'+g("reset-button")+'">'+b.t("headerids.button.reset")+'</button><button class="'+g("set-button")+'">'+b.t("headerids.button.set")+"</button>").content;e.find(f("set-button")).click(function(){d(a.effective).attr("id",d(f("input")).val()).addClass("aloha-customized")});e.find(f("reset-button")).click(function(){c.processH(a.effective);
d(a.effective).removeClass("aloha-customized");a.content.find(f("input")).val(a.effective.attr("id"))})},onActivate:function(a){this.effective=a;this.content.find(f("input")).val(c.processH(a[0]))}});a.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","jquery aloha/core aloha/plugin ui/ui ui/toggleButton i18n!metaview/nls/i18n i18n!aloha/nls/i18n".split(" "),
function(l,d,a,k,c,b){function f(a,b){a.addClass("aloha-metaview");b.setState(true);j[a[0].id]=true}function g(a,b){a.removeClass("aloha-metaview");b.setState(false);j[a[0].id]=false}var j={},m=k.adopt("toggleMetaView",c,{tooltip:b.t("button.switch-metaview.tooltip"),icon:"aloha-icon aloha-icon-metaview",scope:"Aloha.continuoustext",click:function(){var a=d.activeEditable.obj;j[a[0].id]?g(a,this):f(a,this)}});return a.create("metaview",{config:["metaview"],init:function(){var a=this;d.bind("aloha-editable-activated",
function(){var b=a.getEditableConfig(d.activeEditable.obj);if(l.type(b)==="array"&&l.inArray("enabled",b)!==-1){m.show(true);f(d.activeEditable.obj,m)}else if(l.type(b)==="array"&&l.inArray("metaview",b)!==-1){m.show(true);j[d.activeEditable.obj[0].id]?f(d.activeEditable.obj,m):g(d.activeEditable.obj,m)}else m.show(false)});d.bind("aloha-editable-deactivated",function(){d.activeEditable.obj.removeClass("aloha-metaview")})}})});define("listenforcer/listenforcer-plugin",["aloha","jquery","aloha/plugin",
"aloha/console"],function(l,d,a,k){function c(a,c){if(-1!==d.inArray(a[0],b)){a.find(".aloha-end-br").remove();var j=!1;a.find("li").each(function(){if(""!==d.trim(d(this).text()))return j=!0,!1});j||a.html(c);var k=a.find(">ul,>ol"),e=k.length,l;if(1<e){var n=d(k[0]);for(l=1;l<e;++l)n.append(d(k[l]).find(">li")),d(k[l]).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||
[],j,m,e=b.length;for(m=0;m<e;m++)j=b[m],"string"===typeof j||j.nodeName||j instanceof d?d(j).each(function(){a.addEditableToEnforcementList(this)}):k.warn("Aloha List Enforcer Plugin",'Object "'+j.toString()+'" can not be used as a jQuery selector with which to register an editable to be list enforced.');l.bind("aloha-editable-activated",function(a,b){c(b.editable.obj,"<ul><li><br /></li></ul>")});l.bind("aloha-editable-deactivated",function(a,b){c(b.editable.obj,"")});l.bind("aloha-smart-content-changed",
function(a,b){l.activeEditable&&!0===l.activeEditable.isActive&&c(b.editable.obj,"<ul><li><br /></li></ul>")})},addEditableToEnforcementList:function(a){a&&b.push(a)}})});Aloha._load&&Aloha._load()})();