]> gitweb.fluxo.info Git - lorea/elgg.git/commitdiff
added the inspect tool to developers tool plugin
authorcash <cash.costello@gmail.com>
Sat, 2 Jul 2011 15:36:53 +0000 (11:36 -0400)
committercash <cash.costello@gmail.com>
Sat, 2 Jul 2011 15:36:53 +0000 (11:36 -0400)
29 files changed:
mod/developers/actions/developers/inspect.php [new file with mode: 0644]
mod/developers/classes/ElggInspector.php [new file with mode: 0644]
mod/developers/languages/en.php
mod/developers/start.php
mod/developers/vendors/jsTree/jquery.jstree.js [new file with mode: 0644]
mod/developers/vendors/jsTree/themes/apple/bg.jpg [new file with mode: 0644]
mod/developers/vendors/jsTree/themes/apple/d.png [new file with mode: 0644]
mod/developers/vendors/jsTree/themes/apple/dot_for_ie.gif [new file with mode: 0644]
mod/developers/vendors/jsTree/themes/apple/style.css [new file with mode: 0644]
mod/developers/vendors/jsTree/themes/apple/throbber.gif [new file with mode: 0644]
mod/developers/vendors/jsTree/themes/classic/d.gif [new file with mode: 0644]
mod/developers/vendors/jsTree/themes/classic/d.png [new file with mode: 0644]
mod/developers/vendors/jsTree/themes/classic/dot_for_ie.gif [new file with mode: 0644]
mod/developers/vendors/jsTree/themes/classic/style.css [new file with mode: 0644]
mod/developers/vendors/jsTree/themes/classic/throbber.gif [new file with mode: 0644]
mod/developers/vendors/jsTree/themes/default-rtl/d.gif [new file with mode: 0644]
mod/developers/vendors/jsTree/themes/default-rtl/d.png [new file with mode: 0644]
mod/developers/vendors/jsTree/themes/default-rtl/dots.gif [new file with mode: 0644]
mod/developers/vendors/jsTree/themes/default-rtl/style.css [new file with mode: 0644]
mod/developers/vendors/jsTree/themes/default-rtl/throbber.gif [new file with mode: 0644]
mod/developers/vendors/jsTree/themes/default/d.gif [new file with mode: 0644]
mod/developers/vendors/jsTree/themes/default/d.png [new file with mode: 0644]
mod/developers/vendors/jsTree/themes/default/style.css [new file with mode: 0644]
mod/developers/vendors/jsTree/themes/default/throbber.gif [new file with mode: 0644]
mod/developers/views/default/admin/developers/inspect.php [new file with mode: 0644]
mod/developers/views/default/developers/css.php
mod/developers/views/default/developers/tree.php [new file with mode: 0644]
mod/developers/views/default/forms/developers/inspect.php [new file with mode: 0644]
mod/developers/views/default/js/developers/developers.php [new file with mode: 0644]

diff --git a/mod/developers/actions/developers/inspect.php b/mod/developers/actions/developers/inspect.php
new file mode 100644 (file)
index 0000000..6fd9e90
--- /dev/null
@@ -0,0 +1,16 @@
+<?php
+/**
+ * Ajax endpoint for inspection
+ *
+ */
+
+$inspect_type = get_input('inspect_type');
+$method = 'get' . str_replace(' ', '', $inspect_type);
+
+$inspector = new ElggInspector();
+if ($inspector && method_exists($inspector, $method)) {
+       $tree = $inspector->$method();
+       echo elgg_view('developers/tree', array('tree' => $tree));
+} else {
+       echo 'error';
+}
diff --git a/mod/developers/classes/ElggInspector.php b/mod/developers/classes/ElggInspector.php
new file mode 100644 (file)
index 0000000..e83fc6b
--- /dev/null
@@ -0,0 +1,201 @@
+<?php
+/**
+ * Inspect Elgg variables
+ *
+ */
+
+class ElggInspector {
+
+       /**
+        * Get Elgg event information
+        *
+        * returns [event,type] => array(handlers)
+        */
+       public function getEvents() {
+               global $CONFIG;
+
+               $tree = array();
+               foreach ($CONFIG->events as $event => $types) {
+                       foreach ($types as $type => $handlers) {
+                               $tree[$event . ',' . $type] = array_values($handlers);
+                       }
+               }
+
+               ksort($tree);
+
+               return $tree;
+       }
+
+       /**
+        * Get Elgg plugin hooks information
+        *
+        * returns [hook,type] => array(handlers)
+        */
+       public function getPluginHooks() {
+               global $CONFIG;
+
+               $tree = array();
+               foreach ($CONFIG->hooks as $hook => $types) {
+                       foreach ($types as $type => $handlers) {
+                               $tree[$hook . ',' . $type] = array_values($handlers);
+                       }
+               }
+
+               ksort($tree);
+
+               return $tree;
+       }
+
+       /**
+        * Get Elgg view information
+        *
+        * returns [view] => array(view location and extensions)
+        */
+       public function getViews() {
+               global $CONFIG;
+
+               $coreViews = $this->recurseFileTree($CONFIG->viewpath . "default/");
+
+               // remove base path and php extension
+               array_walk($coreViews, create_function('&$v,$k', 'global $CONFIG; $v = substr($v, strlen($CONFIG->viewpath . "default/"), -4);'));
+
+               // setup views array before adding extensions and plugin views
+               $views = array();
+               foreach ($coreViews as $view) {
+                       $views[$view] = array($CONFIG->viewpath . "default/" . $view . ".php");
+               }
+
+               // add plugins and handle overrides
+               foreach ($CONFIG->views->locations['default'] as $view => $location) {
+                       $views[$view] = array($location . $view . ".php");
+               }
+
+               // now extensions
+               foreach ($CONFIG->views->extensions as $view => $extensions) {
+                       $view_list = array();
+                       foreach ($extensions as $priority => $ext_view) {
+                               if (isset($views[$ext_view])) {
+                                       $view_list[] = $views[$ext_view][0];
+                               }
+                       }
+                       if (count($view_list) > 0) {
+                               $views[$view] = $view_list;
+                       }
+               }
+
+               ksort($views);
+
+               return $views;
+       }
+
+       /**
+        * Get Elgg widget information
+        *
+        * returns [widget] => array(name, contexts)
+        */
+       public function getWidgets() {
+               global $CONFIG;
+
+               $tree = array();
+               foreach ($CONFIG->widgets->handlers as $handler => $handler_obj) {
+                       $tree[$handler] = array($handler_obj->name, implode(',', array_values($handler_obj->context)));
+               }
+
+               ksort($tree);
+
+               return $tree;
+       }
+
+
+       /**
+        * Get Elgg actions information
+        *
+        * returns [action] => array(file, public, admin)
+        */
+       public function getActions() {
+               global $CONFIG;
+
+               $tree = array();
+               foreach ($CONFIG->actions as $action => $info) {
+                       $tree[$action] = array($info['file'], ($info['public']) ? 'public' : 'logged in only', ($info['admin']) ? 'admin only' : 'non-admin');
+               }
+
+               ksort($tree);
+
+               return $tree;
+       }
+
+       /**
+        * Get simplecache information
+        *
+        * returns [views]
+        */
+       public function getSimpleCache() {
+               global $CONFIG;
+
+               $tree = array();
+               foreach ($CONFIG->views->simplecache as $view) {
+                       $tree[$view] = "";
+               }
+
+               ksort($tree);
+
+               return $tree;
+       }
+
+       /**
+        * Get Elgg web services API methods
+        *
+        * returns [method] => array(function, parameters, call_method, api auth, user auth)
+        */
+       public function getWebServices() {
+               global $API_METHODS;
+
+               $tree = array();
+               foreach ($API_METHODS as $method => $info) {
+                       $params = implode(', ', array_keys($info['parameters']));
+                       if (!$params) {
+                               $params = 'none';
+                       }
+                       $tree[$method] = array(
+                               $info['function'],
+                               "params: $params",
+                               $info['call_method'],
+                               ($info['require_api_auth']) ? 'API authentication required' : 'No API authentication required',
+                               ($info['require_user_auth']) ? 'User authentication required' : 'No user authentication required',
+                       );
+               }
+
+               ksort($tree);
+
+               return $tree;
+       }
+
+       /**
+        * Create array of all php files in directory and subdirectories
+        *
+        * @param $dir full path to directory to begin search
+        * @return array of every php file in $dir or below in file tree
+        */
+       protected function recurseFileTree($dir) {
+               $view_list = array();
+
+               $handle = opendir($dir);
+               while ($file = readdir($handle)) {
+                       if ($file[0] == '.') {
+
+                       } else if (is_dir($dir . $file)) {
+                               $view_list = array_merge($view_list, $this->recurseFileTree($dir . $file. "/"));
+                       } else {
+                               $extension = strrchr(trim($file, "/"), '.');
+                               if ($extension === ".php") {
+                                       $view_list[] = $dir . $file;
+                               }
+                       }
+               }
+               closedir($handle);
+
+               return $view_list;
+       }
+
+}
index 53a9cd686454e56c85736f4f0f687a962fbaf6af..dc763765ce6b6b6bc95f0cccd46591da65c52f3e 100644 (file)
@@ -9,6 +9,7 @@ $english = array(
        'admin:developers' => 'Developers',
        'admin:developers:settings' => 'Developer Settings',
        'admin:developers:preview' => 'Theming Preview',
+       'admin:developers:inspect' => 'Inspect',
 
        // settings
        'elgg_dev_tools:settings:explanation' => 'Control your development and debugging settings below. Some of these settings are also available on other admin pages.',
@@ -25,6 +26,9 @@ $english = array(
        'developers:debug:error' => 'Error',
        'developers:debug:warning' => 'Warning',
        'developers:debug:notice' => 'Notice',
+       
+       // inspection
+       'developers:inspect:help' => 'Inspect configuration of the Elgg framework.',
 
        // theme preview
        'theme_preview:general' => 'Introduction',
index c05432e303c9753c6e884b4563af23a74fe435c4..a53b7eec448df7c614cfdcc4cda92ac1330485fc 100644 (file)
@@ -17,6 +17,13 @@ function developers_init() {
 
        $action_base = elgg_get_plugins_path() . 'developers/actions/developers';
        elgg_register_action('developers/settings', "$action_base/settings.php", 'admin');
+       elgg_register_action('developers/inspect', "$action_base/inspect.php", 'admin');
+
+       elgg_register_js('jquery.jstree', 'mod/developers/vendors/jsTree/jquery.jstree.js', 'footer');
+       elgg_register_css('jquery.jstree', 'mod/developers/vendors/jsTree/themes/default/style.css');
+
+       elgg_register_js('elgg.dev', 'js/developers/developers.js', 'footer');
+       elgg_load_js('elgg.dev');
 }
 
 function developers_process_settings() {
@@ -30,6 +37,7 @@ function developers_process_settings() {
 function developers_setup_menu() {
        if (elgg_in_context('admin')) {
                elgg_register_admin_menu_item('develop', 'settings', 'developers');
+               elgg_register_admin_menu_item('develop', 'inspect', 'developers');
                elgg_register_admin_menu_item('develop', 'preview', 'developers');
        }
 }
diff --git a/mod/developers/vendors/jsTree/jquery.jstree.js b/mod/developers/vendors/jsTree/jquery.jstree.js
new file mode 100644 (file)
index 0000000..965a612
--- /dev/null
@@ -0,0 +1,4544 @@
+/*\r
+ * jsTree 1.0-rc3\r
+ * http://jstree.com/\r
+ *\r
+ * Copyright (c) 2010 Ivan Bozhanov (vakata.com)\r
+ *\r
+ * Licensed same as jquery - under the terms of either the MIT License or the GPL Version 2 License\r
+ *   http://www.opensource.org/licenses/mit-license.php\r
+ *   http://www.gnu.org/licenses/gpl.html\r
+ *\r
+ * $Date: 2011-02-09 01:17:14 +0200 (ср, 09 февр 2011) $\r
+ * $Revision: 236 $\r
+ */\r
+\r
+/*jslint browser: true, onevar: true, undef: true, bitwise: true, strict: true */\r
+/*global window : false, clearInterval: false, clearTimeout: false, document: false, setInterval: false, setTimeout: false, jQuery: false, navigator: false, XSLTProcessor: false, DOMParser: false, XMLSerializer: false*/\r
+\r
+"use strict";\r
+\r
+// top wrapper to prevent multiple inclusion (is this OK?)\r
+(function () { if(jQuery && jQuery.jstree) { return; }\r
+       var is_ie6 = false, is_ie7 = false, is_ff2 = false;\r
+\r
+/* \r
+ * jsTree core\r
+ */\r
+(function ($) {\r
+       // Common functions not related to jsTree \r
+       // decided to move them to a `vakata` "namespace"\r
+       $.vakata = {};\r
+       // CSS related functions\r
+       $.vakata.css = {\r
+               get_css : function(rule_name, delete_flag, sheet) {\r
+                       rule_name = rule_name.toLowerCase();\r
+                       var css_rules = sheet.cssRules || sheet.rules,\r
+                               j = 0;\r
+                       do {\r
+                               if(css_rules.length && j > css_rules.length + 5) { return false; }\r
+                               if(css_rules[j].selectorText && css_rules[j].selectorText.toLowerCase() == rule_name) {\r
+                                       if(delete_flag === true) {\r
+                                               if(sheet.removeRule) { sheet.removeRule(j); }\r
+                                               if(sheet.deleteRule) { sheet.deleteRule(j); }\r
+                                               return true;\r
+                                       }\r
+                                       else { return css_rules[j]; }\r
+                               }\r
+                       }\r
+                       while (css_rules[++j]);\r
+                       return false;\r
+               },\r
+               add_css : function(rule_name, sheet) {\r
+                       if($.jstree.css.get_css(rule_name, false, sheet)) { return false; }\r
+                       if(sheet.insertRule) { sheet.insertRule(rule_name + ' { }', 0); } else { sheet.addRule(rule_name, null, 0); }\r
+                       return $.vakata.css.get_css(rule_name);\r
+               },\r
+               remove_css : function(rule_name, sheet) { \r
+                       return $.vakata.css.get_css(rule_name, true, sheet); \r
+               },\r
+               add_sheet : function(opts) {\r
+                       var tmp = false, is_new = true;\r
+                       if(opts.str) {\r
+                               if(opts.title) { tmp = $("style[id='" + opts.title + "-stylesheet']")[0]; }\r
+                               if(tmp) { is_new = false; }\r
+                               else {\r
+                                       tmp = document.createElement("style");\r
+                                       tmp.setAttribute('type',"text/css");\r
+                                       if(opts.title) { tmp.setAttribute("id", opts.title + "-stylesheet"); }\r
+                               }\r
+                               if(tmp.styleSheet) {\r
+                                       if(is_new) { \r
+                                               document.getElementsByTagName("head")[0].appendChild(tmp); \r
+                                               tmp.styleSheet.cssText = opts.str; \r
+                                       }\r
+                                       else {\r
+                                               tmp.styleSheet.cssText = tmp.styleSheet.cssText + " " + opts.str; \r
+                                       }\r
+                               }\r
+                               else {\r
+                                       tmp.appendChild(document.createTextNode(opts.str));\r
+                                       document.getElementsByTagName("head")[0].appendChild(tmp);\r
+                               }\r
+                               return tmp.sheet || tmp.styleSheet;\r
+                       }\r
+                       if(opts.url) {\r
+                               if(document.createStyleSheet) {\r
+                                       try { tmp = document.createStyleSheet(opts.url); } catch (e) { }\r
+                               }\r
+                               else {\r
+                                       tmp                     = document.createElement('link');\r
+                                       tmp.rel         = 'stylesheet';\r
+                                       tmp.type        = 'text/css';\r
+                                       tmp.media       = "all";\r
+                                       tmp.href        = opts.url;\r
+                                       document.getElementsByTagName("head")[0].appendChild(tmp);\r
+                                       return tmp.styleSheet;\r
+                               }\r
+                       }\r
+               }\r
+       };\r
+\r
+       // private variables \r
+       var instances = [],                     // instance array (used by $.jstree.reference/create/focused)\r
+               focused_instance = -1,  // the index in the instance array of the currently focused instance\r
+               plugins = {},                   // list of included plugins\r
+               prepared_move = {};             // for the move_node function\r
+\r
+       // jQuery plugin wrapper (thanks to jquery UI widget function)\r
+       $.fn.jstree = function (settings) {\r
+               var isMethodCall = (typeof settings == 'string'), // is this a method call like $().jstree("open_node")\r
+                       args = Array.prototype.slice.call(arguments, 1), \r
+                       returnValue = this;\r
+\r
+               // if a method call execute the method on all selected instances\r
+               if(isMethodCall) {\r
+                       if(settings.substring(0, 1) == '_') { return returnValue; }\r
+                       this.each(function() {\r
+                               var instance = instances[$.data(this, "jstree-instance-id")],\r
+                                       methodValue = (instance && $.isFunction(instance[settings])) ? instance[settings].apply(instance, args) : instance;\r
+                                       if(typeof methodValue !== "undefined" && (settings.indexOf("is_") === 0 || (methodValue !== true && methodValue !== false))) { returnValue = methodValue; return false; }\r
+                       });\r
+               }\r
+               else {\r
+                       this.each(function() {\r
+                               // extend settings and allow for multiple hashes and $.data\r
+                               var instance_id = $.data(this, "jstree-instance-id"),\r
+                                       a = [],\r
+                                       b = settings ? $.extend({}, true, settings) : {},\r
+                                       c = $(this), \r
+                                       s = false, \r
+                                       t = [];\r
+                               a = a.concat(args);\r
+                               if(c.data("jstree")) { a.push(c.data("jstree")); }\r
+                               b = a.length ? $.extend.apply(null, [true, b].concat(a)) : b;\r
+\r
+                               // if an instance already exists, destroy it first\r
+                               if(typeof instance_id !== "undefined" && instances[instance_id]) { instances[instance_id].destroy(); }\r
+                               // push a new empty object to the instances array\r
+                               instance_id = parseInt(instances.push({}),10) - 1;\r
+                               // store the jstree instance id to the container element\r
+                               $.data(this, "jstree-instance-id", instance_id);\r
+                               // clean up all plugins\r
+                               b.plugins = $.isArray(b.plugins) ? b.plugins : $.jstree.defaults.plugins.slice();\r
+                               b.plugins.unshift("core");\r
+                               // only unique plugins\r
+                               b.plugins = b.plugins.sort().join(",,").replace(/(,|^)([^,]+)(,,\2)+(,|$)/g,"$1$2$4").replace(/,,+/g,",").replace(/,$/,"").split(",");\r
+\r
+                               // extend defaults with passed data\r
+                               s = $.extend(true, {}, $.jstree.defaults, b);\r
+                               s.plugins = b.plugins;\r
+                               $.each(plugins, function (i, val) { \r
+                                       if($.inArray(i, s.plugins) === -1) { s[i] = null; delete s[i]; } \r
+                                       else { t.push(i); }\r
+                               });\r
+                               s.plugins = t;\r
+\r
+                               // push the new object to the instances array (at the same time set the default classes to the container) and init\r
+                               instances[instance_id] = new $.jstree._instance(instance_id, $(this).addClass("jstree jstree-" + instance_id), s); \r
+                               // init all activated plugins for this instance\r
+                               $.each(instances[instance_id]._get_settings().plugins, function (i, val) { instances[instance_id].data[val] = {}; });\r
+                               $.each(instances[instance_id]._get_settings().plugins, function (i, val) { if(plugins[val]) { plugins[val].__init.apply(instances[instance_id]); } });\r
+                               // initialize the instance\r
+                               setTimeout(function() { instances[instance_id].init(); }, 0);\r
+                       });\r
+               }\r
+               // return the jquery selection (or if it was a method call that returned a value - the returned value)\r
+               return returnValue;\r
+       };\r
+       // object to store exposed functions and objects\r
+       $.jstree = {\r
+               defaults : {\r
+                       plugins : []\r
+               },\r
+               _focused : function () { return instances[focused_instance] || null; },\r
+               _reference : function (needle) { \r
+                       // get by instance id\r
+                       if(instances[needle]) { return instances[needle]; }\r
+                       // get by DOM (if still no luck - return null\r
+                       var o = $(needle); \r
+                       if(!o.length && typeof needle === "string") { o = $("#" + needle); }\r
+                       if(!o.length) { return null; }\r
+                       return instances[o.closest(".jstree").data("jstree-instance-id")] || null; \r
+               },\r
+               _instance : function (index, container, settings) { \r
+                       // for plugins to store data in\r
+                       this.data = { core : {} };\r
+                       this.get_settings       = function () { return $.extend(true, {}, settings); };\r
+                       this._get_settings      = function () { return settings; };\r
+                       this.get_index          = function () { return index; };\r
+                       this.get_container      = function () { return container; };\r
+                       this.get_container_ul = function () { return container.children("ul:eq(0)"); };\r
+                       this._set_settings      = function (s) { \r
+                               settings = $.extend(true, {}, settings, s);\r
+                       };\r
+               },\r
+               _fn : { },\r
+               plugin : function (pname, pdata) {\r
+                       pdata = $.extend({}, {\r
+                               __init          : $.noop, \r
+                               __destroy       : $.noop,\r
+                               _fn                     : {},\r
+                               defaults        : false\r
+                       }, pdata);\r
+                       plugins[pname] = pdata;\r
+\r
+                       $.jstree.defaults[pname] = pdata.defaults;\r
+                       $.each(pdata._fn, function (i, val) {\r
+                               val.plugin              = pname;\r
+                               val.old                 = $.jstree._fn[i];\r
+                               $.jstree._fn[i] = function () {\r
+                                       var rslt,\r
+                                               func = val,\r
+                                               args = Array.prototype.slice.call(arguments),\r
+                                               evnt = new $.Event("before.jstree"),\r
+                                               rlbk = false;\r
+\r
+                                       if(this.data.core.locked === true && i !== "unlock" && i !== "is_locked") { return; }\r
+\r
+                                       // Check if function belongs to the included plugins of this instance\r
+                                       do {\r
+                                               if(func && func.plugin && $.inArray(func.plugin, this._get_settings().plugins) !== -1) { break; }\r
+                                               func = func.old;\r
+                                       } while(func);\r
+                                       if(!func) { return; }\r
+\r
+                                       // context and function to trigger events, then finally call the function\r
+                                       if(i.indexOf("_") === 0) {\r
+                                               rslt = func.apply(this, args);\r
+                                       }\r
+                                       else {\r
+                                               rslt = this.get_container().triggerHandler(evnt, { "func" : i, "inst" : this, "args" : args, "plugin" : func.plugin });\r
+                                               if(rslt === false) { return; }\r
+                                               if(typeof rslt !== "undefined") { args = rslt; }\r
+\r
+                                               rslt = func.apply(\r
+                                                       $.extend({}, this, { \r
+                                                               __callback : function (data) { \r
+                                                                       this.get_container().triggerHandler( i + '.jstree', { "inst" : this, "args" : args, "rslt" : data, "rlbk" : rlbk });\r
+                                                               },\r
+                                                               __rollback : function () { \r
+                                                                       rlbk = this.get_rollback();\r
+                                                                       return rlbk;\r
+                                                               },\r
+                                                               __call_old : function (replace_arguments) {\r
+                                                                       return func.old.apply(this, (replace_arguments ? Array.prototype.slice.call(arguments, 1) : args ) );\r
+                                                               }\r
+                                                       }), args);\r
+                                       }\r
+\r
+                                       // return the result\r
+                                       return rslt;\r
+                               };\r
+                               $.jstree._fn[i].old = val.old;\r
+                               $.jstree._fn[i].plugin = pname;\r
+                       });\r
+               },\r
+               rollback : function (rb) {\r
+                       if(rb) {\r
+                               if(!$.isArray(rb)) { rb = [ rb ]; }\r
+                               $.each(rb, function (i, val) {\r
+                                       instances[val.i].set_rollback(val.h, val.d);\r
+                               });\r
+                       }\r
+               }\r
+       };\r
+       // set the prototype for all instances\r
+       $.jstree._fn = $.jstree._instance.prototype = {};\r
+\r
+       // load the css when DOM is ready\r
+       $(function() {\r
+               // code is copied from jQuery ($.browser is deprecated + there is a bug in IE)\r
+               var u = navigator.userAgent.toLowerCase(),\r
+                       v = (u.match( /.+?(?:rv|it|ra|ie)[\/: ]([\d.]+)/ ) || [0,'0'])[1],\r
+                       css_string = '' + \r
+                               '.jstree ul, .jstree li { display:block; margin:0 0 0 0; padding:0 0 0 0; list-style-type:none; } ' + \r
+                               '.jstree li { display:block; min-height:18px; line-height:18px; white-space:nowrap; margin-left:18px; min-width:18px; } ' + \r
+                               '.jstree-rtl li { margin-left:0; margin-right:18px; } ' + \r
+                               '.jstree > ul > li { margin-left:0px; } ' + \r
+                               '.jstree-rtl > ul > li { margin-right:0px; } ' + \r
+                               '.jstree ins { display:inline-block; text-decoration:none; width:18px; height:18px; margin:0 0 0 0; padding:0; } ' + \r
+                               '.jstree a { display:inline-block; line-height:16px; height:16px; color:black; white-space:nowrap; text-decoration:none; padding:1px 2px; margin:0; } ' + \r
+                               '.jstree a:focus { outline: none; } ' + \r
+                               '.jstree a > ins { height:16px; width:16px; } ' + \r
+                               '.jstree a > .jstree-icon { margin-right:3px; } ' + \r
+                               '.jstree-rtl a > .jstree-icon { margin-left:3px; margin-right:0; } ' + \r
+                               'li.jstree-open > ul { display:block; } ' + \r
+                               'li.jstree-closed > ul { display:none; } ';\r
+               // Correct IE 6 (does not support the > CSS selector)\r
+               if(/msie/.test(u) && parseInt(v, 10) == 6) { \r
+                       is_ie6 = true;\r
+\r
+                       // fix image flicker and lack of caching\r
+                       try {\r
+                               document.execCommand("BackgroundImageCache", false, true);\r
+                       } catch (err) { }\r
+\r
+                       css_string += '' + \r
+                               '.jstree li { height:18px; margin-left:0; margin-right:0; } ' + \r
+                               '.jstree li li { margin-left:18px; } ' + \r
+                               '.jstree-rtl li li { margin-left:0px; margin-right:18px; } ' + \r
+                               'li.jstree-open ul { display:block; } ' + \r
+                               'li.jstree-closed ul { display:none !important; } ' + \r
+                               '.jstree li a { display:inline; border-width:0 !important; padding:0px 2px !important; } ' + \r
+                               '.jstree li a ins { height:16px; width:16px; margin-right:3px; } ' + \r
+                               '.jstree-rtl li a ins { margin-right:0px; margin-left:3px; } ';\r
+               }\r
+               // Correct IE 7 (shifts anchor nodes onhover)\r
+               if(/msie/.test(u) && parseInt(v, 10) == 7) { \r
+                       is_ie7 = true;\r
+                       css_string += '.jstree li a { border-width:0 !important; padding:0px 2px !important; } ';\r
+               }\r
+               // correct ff2 lack of display:inline-block\r
+               if(!/compatible/.test(u) && /mozilla/.test(u) && parseFloat(v, 10) < 1.9) {\r
+                       is_ff2 = true;\r
+                       css_string += '' + \r
+                               '.jstree ins { display:-moz-inline-box; } ' + \r
+                               '.jstree li { line-height:12px; } ' + // WHY??\r
+                               '.jstree a { display:-moz-inline-box; } ' + \r
+                               '.jstree .jstree-no-icons .jstree-checkbox { display:-moz-inline-stack !important; } ';\r
+                               /* this shouldn't be here as it is theme specific */\r
+               }\r
+               // the default stylesheet\r
+               $.vakata.css.add_sheet({ str : css_string, title : "jstree" });\r
+       });\r
+\r
+       // core functions (open, close, create, update, delete)\r
+       $.jstree.plugin("core", {\r
+               __init : function () {\r
+                       this.data.core.locked = false;\r
+                       this.data.core.to_open = this.get_settings().core.initially_open;\r
+                       this.data.core.to_load = this.get_settings().core.initially_load;\r
+               },\r
+               defaults : { \r
+                       html_titles     : false,\r
+                       animation       : 500,\r
+                       initially_open : [],\r
+                       initially_load : [],\r
+                       open_parents : true,\r
+                       notify_plugins : true,\r
+                       rtl                     : false,\r
+                       load_open       : false,\r
+                       strings         : {\r
+                               loading         : "Loading ...",\r
+                               new_node        : "New node",\r
+                               multiple_selection : "Multiple selection"\r
+                       }\r
+               },\r
+               _fn : { \r
+                       init    : function () { \r
+                               this.set_focus(); \r
+                               if(this._get_settings().core.rtl) {\r
+                                       this.get_container().addClass("jstree-rtl").css("direction", "rtl");\r
+                               }\r
+                               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>");\r
+                               this.data.core.li_height = this.get_container_ul().find("li.jstree-closed, li.jstree-leaf").eq(0).height() || 18;\r
+\r
+                               this.get_container()\r
+                                       .delegate("li > ins", "click.jstree", $.proxy(function (event) {\r
+                                                       var trgt = $(event.target);\r
+                                                       if(trgt.is("ins") && event.pageY - trgt.offset().top < this.data.core.li_height) { this.toggle_node(trgt); }\r
+                                               }, this))\r
+                                       .bind("mousedown.jstree", $.proxy(function () { \r
+                                                       this.set_focus(); // This used to be setTimeout(set_focus,0) - why?\r
+                                               }, this))\r
+                                       .bind("dblclick.jstree", function (event) { \r
+                                               var sel;\r
+                                               if(document.selection && document.selection.empty) { document.selection.empty(); }\r
+                                               else {\r
+                                                       if(window.getSelection) {\r
+                                                               sel = window.getSelection();\r
+                                                               try { \r
+                                                                       sel.removeAllRanges();\r
+                                                                       sel.collapse();\r
+                                                               } catch (err) { }\r
+                                                       }\r
+                                               }\r
+                                       });\r
+                               if(this._get_settings().core.notify_plugins) {\r
+                                       this.get_container()\r
+                                               .bind("load_node.jstree", $.proxy(function (e, data) { \r
+                                                               var o = this._get_node(data.rslt.obj),\r
+                                                                       t = this;\r
+                                                               if(o === -1) { o = this.get_container_ul(); }\r
+                                                               if(!o.length) { return; }\r
+                                                               o.find("li").each(function () {\r
+                                                                       var th = $(this);\r
+                                                                       if(th.data("jstree")) {\r
+                                                                               $.each(th.data("jstree"), function (plugin, values) {\r
+                                                                                       if(t.data[plugin] && $.isFunction(t["_" + plugin + "_notify"])) {\r
+                                                                                               t["_" + plugin + "_notify"].call(t, th, values);\r
+                                                                                       }\r
+                                                                               });\r
+                                                                       }\r
+                                                               });\r
+                                                       }, this));\r
+                               }\r
+                               if(this._get_settings().core.load_open) {\r
+                                       this.get_container()\r
+                                               .bind("load_node.jstree", $.proxy(function (e, data) { \r
+                                                               var o = this._get_node(data.rslt.obj),\r
+                                                                       t = this;\r
+                                                               if(o === -1) { o = this.get_container_ul(); }\r
+                                                               if(!o.length) { return; }\r
+                                                               o.find("li.jstree-open:not(:has(ul))").each(function () {\r
+                                                                       t.load_node(this, $.noop, $.noop);\r
+                                                               });\r
+                                                       }, this));\r
+                               }\r
+                               this.__callback();\r
+                               this.load_node(-1, function () { this.loaded(); this.reload_nodes(); });\r
+                       },\r
+                       destroy : function () { \r
+                               var i,\r
+                                       n = this.get_index(),\r
+                                       s = this._get_settings(),\r
+                                       _this = this;\r
+\r
+                               $.each(s.plugins, function (i, val) {\r
+                                       try { plugins[val].__destroy.apply(_this); } catch(err) { }\r
+                               });\r
+                               this.__callback();\r
+                               // set focus to another instance if this one is focused\r
+                               if(this.is_focused()) { \r
+                                       for(i in instances) { \r
+                                               if(instances.hasOwnProperty(i) && i != n) { \r
+                                                       instances[i].set_focus(); \r
+                                                       break; \r
+                                               } \r
+                                       }\r
+                               }\r
+                               // if no other instance found\r
+                               if(n === focused_instance) { focused_instance = -1; }\r
+                               // remove all traces of jstree in the DOM (only the ones set using jstree*) and cleans all events\r
+                               this.get_container()\r
+                                       .unbind(".jstree")\r
+                                       .undelegate(".jstree")\r
+                                       .removeData("jstree-instance-id")\r
+                                       .find("[class^='jstree']")\r
+                                               .andSelf()\r
+                                               .attr("class", function () { return this.className.replace(/jstree[^ ]*|$/ig,''); });\r
+                               $(document)\r
+                                       .unbind(".jstree-" + n)\r
+                                       .undelegate(".jstree-" + n);\r
+                               // remove the actual data\r
+                               instances[n] = null;\r
+                               delete instances[n];\r
+                       },\r
+\r
+                       _core_notify : function (n, data) {\r
+                               if(data.opened) {\r
+                                       this.open_node(n, false, true);\r
+                               }\r
+                       },\r
+\r
+                       lock : function () {\r
+                               this.data.core.locked = true;\r
+                               this.get_container().children("ul").addClass("jstree-locked").css("opacity","0.7");\r
+                               this.__callback({});\r
+                       },\r
+                       unlock : function () {\r
+                               this.data.core.locked = false;\r
+                               this.get_container().children("ul").removeClass("jstree-locked").css("opacity","1");\r
+                               this.__callback({});\r
+                       },\r
+                       is_locked : function () { return this.data.core.locked; },\r
+                       save_opened : function () {\r
+                               var _this = this;\r
+                               this.data.core.to_open = [];\r
+                               this.get_container_ul().find("li.jstree-open").each(function () { \r
+                                       if(this.id) { _this.data.core.to_open.push("#" + this.id.toString().replace(/^#/,"").replace(/\\\//g,"/").replace(/\//g,"\\\/").replace(/\\\./g,".").replace(/\./g,"\\.").replace(/\:/g,"\\:")); }\r
+                               });\r
+                               this.__callback(_this.data.core.to_open);\r
+                       },\r
+                       save_loaded : function () { },\r
+                       reload_nodes : function (is_callback) {\r
+                               var _this = this,\r
+                                       done = true,\r
+                                       current = [],\r
+                                       remaining = [];\r
+                               if(!is_callback) { \r
+                                       this.data.core.reopen = false; \r
+                                       this.data.core.refreshing = true; \r
+                                       this.data.core.to_open = $.map($.makeArray(this.data.core.to_open), function (n) { return "#" + n.toString().replace(/^#/,"").replace(/\\\//g,"/").replace(/\//g,"\\\/").replace(/\\\./g,".").replace(/\./g,"\\.").replace(/\:/g,"\\:"); });\r
+                                       this.data.core.to_load = $.map($.makeArray(this.data.core.to_load), function (n) { return "#" + n.toString().replace(/^#/,"").replace(/\\\//g,"/").replace(/\//g,"\\\/").replace(/\\\./g,".").replace(/\./g,"\\.").replace(/\:/g,"\\:"); });\r
+                                       if(this.data.core.to_open.length) {\r
+                                               this.data.core.to_load = this.data.core.to_load.concat(this.data.core.to_open);\r
+                                       }\r
+                               }\r
+                               if(this.data.core.to_load.length) {\r
+                                       $.each(this.data.core.to_load, function (i, val) {\r
+                                               if(val == "#") { return true; }\r
+                                               if($(val).length) { current.push(val); }\r
+                                               else { remaining.push(val); }\r
+                                       });\r
+                                       if(current.length) {\r
+                                               this.data.core.to_load = remaining;\r
+                                               $.each(current, function (i, val) { \r
+                                                       if(!_this._is_loaded(val)) {\r
+                                                               _this.load_node(val, function () { _this.reload_nodes(true); }, function () { _this.reload_nodes(true); });\r
+                                                               done = false;\r
+                                                       }\r
+                                               });\r
+                                       }\r
+                               }\r
+                               if(this.data.core.to_open.length) {\r
+                                       $.each(this.data.core.to_open, function (i, val) {\r
+                                               _this.open_node(val, false, true); \r
+                                       });\r
+                               }\r
+                               if(done) { \r
+                                       // TODO: find a more elegant approach to syncronizing returning requests\r
+                                       if(this.data.core.reopen) { clearTimeout(this.data.core.reopen); }\r
+                                       this.data.core.reopen = setTimeout(function () { _this.__callback({}, _this); }, 50);\r
+                                       this.data.core.refreshing = false;\r
+                                       this.reopen();\r
+                               }\r
+                       },\r
+                       reopen : function () {\r
+                               var _this = this;\r
+                               if(this.data.core.to_open.length) {\r
+                                       $.each(this.data.core.to_open, function (i, val) {\r
+                                               _this.open_node(val, false, true); \r
+                                       });\r
+                               }\r
+                               this.__callback({});\r
+                       },\r
+                       refresh : function (obj) {\r
+                               var _this = this;\r
+                               this.save_opened();\r
+                               if(!obj) { obj = -1; }\r
+                               obj = this._get_node(obj);\r
+                               if(!obj) { obj = -1; }\r
+                               if(obj !== -1) { obj.children("UL").remove(); }\r
+                               else { this.get_container_ul().empty(); }\r
+                               this.load_node(obj, function () { _this.__callback({ "obj" : obj}); _this.reload_nodes(); });\r
+                       },\r
+                       // Dummy function to fire after the first load (so that there is a jstree.loaded event)\r
+                       loaded  : function () { \r
+                               this.__callback(); \r
+                       },\r
+                       // deal with focus\r
+                       set_focus       : function () { \r
+                               if(this.is_focused()) { return; }\r
+                               var f = $.jstree._focused();\r
+                               if(f) { f.unset_focus(); }\r
+\r
+                               this.get_container().addClass("jstree-focused"); \r
+                               focused_instance = this.get_index(); \r
+                               this.__callback();\r
+                       },\r
+                       is_focused      : function () { \r
+                               return focused_instance == this.get_index(); \r
+                       },\r
+                       unset_focus     : function () {\r
+                               if(this.is_focused()) {\r
+                                       this.get_container().removeClass("jstree-focused"); \r
+                                       focused_instance = -1; \r
+                               }\r
+                               this.__callback();\r
+                       },\r
+\r
+                       // traverse\r
+                       _get_node               : function (obj) { \r
+                               var $obj = $(obj, this.get_container()); \r
+                               if($obj.is(".jstree") || obj == -1) { return -1; } \r
+                               $obj = $obj.closest("li", this.get_container()); \r
+                               return $obj.length ? $obj : false; \r
+                       },\r
+                       _get_next               : function (obj, strict) {\r
+                               obj = this._get_node(obj);\r
+                               if(obj === -1) { return this.get_container().find("> ul > li:first-child"); }\r
+                               if(!obj.length) { return false; }\r
+                               if(strict) { return (obj.nextAll("li").size() > 0) ? obj.nextAll("li:eq(0)") : false; }\r
+\r
+                               if(obj.hasClass("jstree-open")) { return obj.find("li:eq(0)"); }\r
+                               else if(obj.nextAll("li").size() > 0) { return obj.nextAll("li:eq(0)"); }\r
+                               else { return obj.parentsUntil(".jstree","li").next("li").eq(0); }\r
+                       },\r
+                       _get_prev               : function (obj, strict) {\r
+                               obj = this._get_node(obj);\r
+                               if(obj === -1) { return this.get_container().find("> ul > li:last-child"); }\r
+                               if(!obj.length) { return false; }\r
+                               if(strict) { return (obj.prevAll("li").length > 0) ? obj.prevAll("li:eq(0)") : false; }\r
+\r
+                               if(obj.prev("li").length) {\r
+                                       obj = obj.prev("li").eq(0);\r
+                                       while(obj.hasClass("jstree-open")) { obj = obj.children("ul:eq(0)").children("li:last"); }\r
+                                       return obj;\r
+                               }\r
+                               else { var o = obj.parentsUntil(".jstree","li:eq(0)"); return o.length ? o : false; }\r
+                       },\r
+                       _get_parent             : function (obj) {\r
+                               obj = this._get_node(obj);\r
+                               if(obj == -1 || !obj.length) { return false; }\r
+                               var o = obj.parentsUntil(".jstree", "li:eq(0)");\r
+                               return o.length ? o : -1;\r
+                       },\r
+                       _get_children   : function (obj) {\r
+                               obj = this._get_node(obj);\r
+                               if(obj === -1) { return this.get_container().children("ul:eq(0)").children("li"); }\r
+                               if(!obj.length) { return false; }\r
+                               return obj.children("ul:eq(0)").children("li");\r
+                       },\r
+                       get_path                : function (obj, id_mode) {\r
+                               var p = [],\r
+                                       _this = this;\r
+                               obj = this._get_node(obj);\r
+                               if(obj === -1 || !obj || !obj.length) { return false; }\r
+                               obj.parentsUntil(".jstree", "li").each(function () {\r
+                                       p.push( id_mode ? this.id : _this.get_text(this) );\r
+                               });\r
+                               p.reverse();\r
+                               p.push( id_mode ? obj.attr("id") : this.get_text(obj) );\r
+                               return p;\r
+                       },\r
+\r
+                       // string functions\r
+                       _get_string : function (key) {\r
+                               return this._get_settings().core.strings[key] || key;\r
+                       },\r
+\r
+                       is_open         : function (obj) { obj = this._get_node(obj); return obj && obj !== -1 && obj.hasClass("jstree-open"); },\r
+                       is_closed       : function (obj) { obj = this._get_node(obj); return obj && obj !== -1 && obj.hasClass("jstree-closed"); },\r
+                       is_leaf         : function (obj) { obj = this._get_node(obj); return obj && obj !== -1 && obj.hasClass("jstree-leaf"); },\r
+                       correct_state   : function (obj) {\r
+                               obj = this._get_node(obj);\r
+                               if(!obj || obj === -1) { return false; }\r
+                               obj.removeClass("jstree-closed jstree-open").addClass("jstree-leaf").children("ul").remove();\r
+                               this.__callback({ "obj" : obj });\r
+                       },\r
+                       // open/close\r
+                       open_node       : function (obj, callback, skip_animation) {\r
+                               obj = this._get_node(obj);\r
+                               if(!obj.length) { return false; }\r
+                               if(!obj.hasClass("jstree-closed")) { if(callback) { callback.call(); } return false; }\r
+                               var s = skip_animation || is_ie6 ? 0 : this._get_settings().core.animation,\r
+                                       t = this;\r
+                               if(!this._is_loaded(obj)) {\r
+                                       obj.children("a").addClass("jstree-loading");\r
+                                       this.load_node(obj, function () { t.open_node(obj, callback, skip_animation); }, callback);\r
+                               }\r
+                               else {\r
+                                       if(this._get_settings().core.open_parents) {\r
+                                               obj.parentsUntil(".jstree",".jstree-closed").each(function () {\r
+                                                       t.open_node(this, false, true);\r
+                                               });\r
+                                       }\r
+                                       if(s) { obj.children("ul").css("display","none"); }\r
+                                       obj.removeClass("jstree-closed").addClass("jstree-open").children("a").removeClass("jstree-loading");\r
+                                       if(s) { obj.children("ul").stop(true, true).slideDown(s, function () { this.style.display = ""; t.after_open(obj); }); }\r
+                                       else { t.after_open(obj); }\r
+                                       this.__callback({ "obj" : obj });\r
+                                       if(callback) { callback.call(); }\r
+                               }\r
+                       },\r
+                       after_open      : function (obj) { this.__callback({ "obj" : obj }); },\r
+                       close_node      : function (obj, skip_animation) {\r
+                               obj = this._get_node(obj);\r
+                               var s = skip_animation || is_ie6 ? 0 : this._get_settings().core.animation,\r
+                                       t = this;\r
+                               if(!obj.length || !obj.hasClass("jstree-open")) { return false; }\r
+                               if(s) { obj.children("ul").attr("style","display:block !important"); }\r
+                               obj.removeClass("jstree-open").addClass("jstree-closed");\r
+                               if(s) { obj.children("ul").stop(true, true).slideUp(s, function () { this.style.display = ""; t.after_close(obj); }); }\r
+                               else { t.after_close(obj); }\r
+                               this.__callback({ "obj" : obj });\r
+                       },\r
+                       after_close     : function (obj) { this.__callback({ "obj" : obj }); },\r
+                       toggle_node     : function (obj) {\r
+                               obj = this._get_node(obj);\r
+                               if(obj.hasClass("jstree-closed")) { return this.open_node(obj); }\r
+                               if(obj.hasClass("jstree-open")) { return this.close_node(obj); }\r
+                       },\r
+                       open_all        : function (obj, do_animation, original_obj) {\r
+                               obj = obj ? this._get_node(obj) : -1;\r
+                               if(!obj || obj === -1) { obj = this.get_container_ul(); }\r
+                               if(original_obj) { \r
+                                       obj = obj.find("li.jstree-closed");\r
+                               }\r
+                               else {\r
+                                       original_obj = obj;\r
+                                       if(obj.is(".jstree-closed")) { obj = obj.find("li.jstree-closed").andSelf(); }\r
+                                       else { obj = obj.find("li.jstree-closed"); }\r
+                               }\r
+                               var _this = this;\r
+                               obj.each(function () { \r
+                                       var __this = this; \r
+                                       if(!_this._is_loaded(this)) { _this.open_node(this, function() { _this.open_all(__this, do_animation, original_obj); }, !do_animation); }\r
+                                       else { _this.open_node(this, false, !do_animation); }\r
+                               });\r
+                               // so that callback is fired AFTER all nodes are open\r
+                               if(original_obj.find('li.jstree-closed').length === 0) { this.__callback({ "obj" : original_obj }); }\r
+                       },\r
+                       close_all       : function (obj, do_animation) {\r
+                               var _this = this;\r
+                               obj = obj ? this._get_node(obj) : this.get_container();\r
+                               if(!obj || obj === -1) { obj = this.get_container_ul(); }\r
+                               obj.find("li.jstree-open").andSelf().each(function () { _this.close_node(this, !do_animation); });\r
+                               this.__callback({ "obj" : obj });\r
+                       },\r
+                       clean_node      : function (obj) {\r
+                               obj = obj && obj != -1 ? $(obj) : this.get_container_ul();\r
+                               obj = obj.is("li") ? obj.find("li").andSelf() : obj.find("li");\r
+                               obj.removeClass("jstree-last")\r
+                                       .filter("li:last-child").addClass("jstree-last").end()\r
+                                       .filter(":has(li)")\r
+                                               .not(".jstree-open").removeClass("jstree-leaf").addClass("jstree-closed");\r
+                               obj.not(".jstree-open, .jstree-closed").addClass("jstree-leaf").children("ul").remove();\r
+                               this.__callback({ "obj" : obj });\r
+                       },\r
+                       // rollback\r
+                       get_rollback : function () { \r
+                               this.__callback();\r
+                               return { i : this.get_index(), h : this.get_container().children("ul").clone(true), d : this.data }; \r
+                       },\r
+                       set_rollback : function (html, data) {\r
+                               this.get_container().empty().append(html);\r
+                               this.data = data;\r
+                               this.__callback();\r
+                       },\r
+                       // Dummy functions to be overwritten by any datastore plugin included\r
+                       load_node       : function (obj, s_call, e_call) { this.__callback({ "obj" : obj }); },\r
+                       _is_loaded      : function (obj) { return true; },\r
+\r
+                       // Basic operations: create\r
+                       create_node     : function (obj, position, js, callback, is_loaded) {\r
+                               obj = this._get_node(obj);\r
+                               position = typeof position === "undefined" ? "last" : position;\r
+                               var d = $("<li />"),\r
+                                       s = this._get_settings().core,\r
+                                       tmp;\r
+\r
+                               if(obj !== -1 && !obj.length) { return false; }\r
+                               if(!is_loaded && !this._is_loaded(obj)) { this.load_node(obj, function () { this.create_node(obj, position, js, callback, true); }); return false; }\r
+\r
+                               this.__rollback();\r
+\r
+                               if(typeof js === "string") { js = { "data" : js }; }\r
+                               if(!js) { js = {}; }\r
+                               if(js.attr) { d.attr(js.attr); }\r
+                               if(js.metadata) { d.data(js.metadata); }\r
+                               if(js.state) { d.addClass("jstree-" + js.state); }\r
+                               if(!js.data) { js.data = this._get_string("new_node"); }\r
+                               if(!$.isArray(js.data)) { tmp = js.data; js.data = []; js.data.push(tmp); }\r
+                               $.each(js.data, function (i, m) {\r
+                                       tmp = $("<a />");\r
+                                       if($.isFunction(m)) { m = m.call(this, js); }\r
+                                       if(typeof m == "string") { tmp.attr('href','#')[ s.html_titles ? "html" : "text" ](m); }\r
+                                       else {\r
+                                               if(!m.attr) { m.attr = {}; }\r
+                                               if(!m.attr.href) { m.attr.href = '#'; }\r
+                                               tmp.attr(m.attr)[ s.html_titles ? "html" : "text" ](m.title);\r
+                                               if(m.language) { tmp.addClass(m.language); }\r
+                                       }\r
+                                       tmp.prepend("<ins class='jstree-icon'>&#160;</ins>");\r
+                                       if(m.icon) { \r
+                                               if(m.icon.indexOf("/") === -1) { tmp.children("ins").addClass(m.icon); }\r
+                                               else { tmp.children("ins").css("background","url('" + m.icon + "') center center no-repeat"); }\r
+                                       }\r
+                                       d.append(tmp);\r
+                               });\r
+                               d.prepend("<ins class='jstree-icon'>&#160;</ins>");\r
+                               if(obj === -1) {\r
+                                       obj = this.get_container();\r
+                                       if(position === "before") { position = "first"; }\r
+                                       if(position === "after") { position = "last"; }\r
+                               }\r
+                               switch(position) {\r
+                                       case "before": obj.before(d); tmp = this._get_parent(obj); break;\r
+                                       case "after" : obj.after(d);  tmp = this._get_parent(obj); break;\r
+                                       case "inside":\r
+                                       case "first" :\r
+                                               if(!obj.children("ul").length) { obj.append("<ul />"); }\r
+                                               obj.children("ul").prepend(d);\r
+                                               tmp = obj;\r
+                                               break;\r
+                                       case "last":\r
+                                               if(!obj.children("ul").length) { obj.append("<ul />"); }\r
+                                               obj.children("ul").append(d);\r
+                                               tmp = obj;\r
+                                               break;\r
+                                       default:\r
+                                               if(!obj.children("ul").length) { obj.append("<ul />"); }\r
+                                               if(!position) { position = 0; }\r
+                                               tmp = obj.children("ul").children("li").eq(position);\r
+                                               if(tmp.length) { tmp.before(d); }\r
+                                               else { obj.children("ul").append(d); }\r
+                                               tmp = obj;\r
+                                               break;\r
+                               }\r
+                               if(tmp === -1 || tmp.get(0) === this.get_container().get(0)) { tmp = -1; }\r
+                               this.clean_node(tmp);\r
+                               this.__callback({ "obj" : d, "parent" : tmp });\r
+                               if(callback) { callback.call(this, d); }\r
+                               return d;\r
+                       },\r
+                       // Basic operations: rename (deal with text)\r
+                       get_text        : function (obj) {\r
+                               obj = this._get_node(obj);\r
+                               if(!obj.length) { return false; }\r
+                               var s = this._get_settings().core.html_titles;\r
+                               obj = obj.children("a:eq(0)");\r
+                               if(s) {\r
+                                       obj = obj.clone();\r
+                                       obj.children("INS").remove();\r
+                                       return obj.html();\r
+                               }\r
+                               else {\r
+                                       obj = obj.contents().filter(function() { return this.nodeType == 3; })[0];\r
+                                       return obj.nodeValue;\r
+                               }\r
+                       },\r
+                       set_text        : function (obj, val) {\r
+                               obj = this._get_node(obj);\r
+                               if(!obj.length) { return false; }\r
+                               obj = obj.children("a:eq(0)");\r
+                               if(this._get_settings().core.html_titles) {\r
+                                       var tmp = obj.children("INS").clone();\r
+                                       obj.html(val).prepend(tmp);\r
+                                       this.__callback({ "obj" : obj, "name" : val });\r
+                                       return true;\r
+                               }\r
+                               else {\r
+                                       obj = obj.contents().filter(function() { return this.nodeType == 3; })[0];\r
+                                       this.__callback({ "obj" : obj, "name" : val });\r
+                                       return (obj.nodeValue = val);\r
+                               }\r
+                       },\r
+                       rename_node : function (obj, val) {\r
+                               obj = this._get_node(obj);\r
+                               this.__rollback();\r
+                               if(obj && obj.length && this.set_text.apply(this, Array.prototype.slice.call(arguments))) { this.__callback({ "obj" : obj, "name" : val }); }\r
+                       },\r
+                       // Basic operations: deleting nodes\r
+                       delete_node : function (obj) {\r
+                               obj = this._get_node(obj);\r
+                               if(!obj.length) { return false; }\r
+                               this.__rollback();\r
+                               var p = this._get_parent(obj), prev = $([]), t = this;\r
+                               obj.each(function () {\r
+                                       prev = prev.add(t._get_prev(this));\r
+                               });\r
+                               obj = obj.detach();\r
+                               if(p !== -1 && p.find("> ul > li").length === 0) {\r
+                                       p.removeClass("jstree-open jstree-closed").addClass("jstree-leaf");\r
+                               }\r
+                               this.clean_node(p);\r
+                               this.__callback({ "obj" : obj, "prev" : prev, "parent" : p });\r
+                               return obj;\r
+                       },\r
+                       prepare_move : function (o, r, pos, cb, is_cb) {\r
+                               var p = {};\r
+\r
+                               p.ot = $.jstree._reference(o) || this;\r
+                               p.o = p.ot._get_node(o);\r
+                               p.r = r === - 1 ? -1 : this._get_node(r);\r
+                               p.p = (typeof pos === "undefined" || pos === false) ? "last" : pos; // TODO: move to a setting\r
+                               if(!is_cb && prepared_move.o && prepared_move.o[0] === p.o[0] && prepared_move.r[0] === p.r[0] && prepared_move.p === p.p) {\r
+                                       this.__callback(prepared_move);\r
+                                       if(cb) { cb.call(this, prepared_move); }\r
+                                       return;\r
+                               }\r
+                               p.ot = $.jstree._reference(p.o) || this;\r
+                               p.rt = $.jstree._reference(p.r) || this; // r === -1 ? p.ot : $.jstree._reference(p.r) || this\r
+                               if(p.r === -1 || !p.r) {\r
+                                       p.cr = -1;\r
+                                       switch(p.p) {\r
+                                               case "first":\r
+                                               case "before":\r
+                                               case "inside":\r
+                                                       p.cp = 0; \r
+                                                       break;\r
+                                               case "after":\r
+                                               case "last":\r
+                                                       p.cp = p.rt.get_container().find(" > ul > li").length; \r
+                                                       break;\r
+                                               default:\r
+                                                       p.cp = p.p;\r
+                                                       break;\r
+                                       }\r
+                               }\r
+                               else {\r
+                                       if(!/^(before|after)$/.test(p.p) && !this._is_loaded(p.r)) {\r
+                                               return this.load_node(p.r, function () { this.prepare_move(o, r, pos, cb, true); });\r
+                                       }\r
+                                       switch(p.p) {\r
+                                               case "before":\r
+                                                       p.cp = p.r.index();\r
+                                                       p.cr = p.rt._get_parent(p.r);\r
+                                                       break;\r
+                                               case "after":\r
+                                                       p.cp = p.r.index() + 1;\r
+                                                       p.cr = p.rt._get_parent(p.r);\r
+                                                       break;\r
+                                               case "inside":\r
+                                               case "first":\r
+                                                       p.cp = 0;\r
+                                                       p.cr = p.r;\r
+                                                       break;\r
+                                               case "last":\r
+                                                       p.cp = p.r.find(" > ul > li").length; \r
+                                                       p.cr = p.r;\r
+                                                       break;\r
+                                               default: \r
+                                                       p.cp = p.p;\r
+                                                       p.cr = p.r;\r
+                                                       break;\r
+                                       }\r
+                               }\r
+                               p.np = p.cr == -1 ? p.rt.get_container() : p.cr;\r
+                               p.op = p.ot._get_parent(p.o);\r
+                               p.cop = p.o.index();\r
+                               if(p.op === -1) { p.op = p.ot ? p.ot.get_container() : this.get_container(); }\r
+                               if(!/^(before|after)$/.test(p.p) && p.op && p.np && p.op[0] === p.np[0] && p.o.index() < p.cp) { p.cp++; }\r
+                               //if(p.p === "before" && p.op && p.np && p.op[0] === p.np[0] && p.o.index() < p.cp) { p.cp--; }\r
+                               p.or = p.np.find(" > ul > li:nth-child(" + (p.cp + 1) + ")");\r
+                               prepared_move = p;\r
+                               this.__callback(prepared_move);\r
+                               if(cb) { cb.call(this, prepared_move); }\r
+                       },\r
+                       check_move : function () {\r
+                               var obj = prepared_move, ret = true, r = obj.r === -1 ? this.get_container() : obj.r;\r
+                               if(!obj || !obj.o || obj.or[0] === obj.o[0]) { return false; }\r
+                               if(obj.op && obj.np && obj.op[0] === obj.np[0] && obj.cp - 1 === obj.o.index()) { return false; }\r
+                               obj.o.each(function () { \r
+                                       if(r.parentsUntil(".jstree", "li").andSelf().index(this) !== -1) { ret = false; return false; }\r
+                               });\r
+                               return ret;\r
+                       },\r
+                       move_node : function (obj, ref, position, is_copy, is_prepared, skip_check) {\r
+                               if(!is_prepared) { \r
+                                       return this.prepare_move(obj, ref, position, function (p) {\r
+                                               this.move_node(p, false, false, is_copy, true, skip_check);\r
+                                       });\r
+                               }\r
+                               if(is_copy) { \r
+                                       prepared_move.cy = true;\r
+                               }\r
+                               if(!skip_check && !this.check_move()) { return false; }\r
+\r
+                               this.__rollback();\r
+                               var o = false;\r
+                               if(is_copy) {\r
+                                       o = obj.o.clone(true);\r
+                                       o.find("*[id]").andSelf().each(function () {\r
+                                               if(this.id) { this.id = "copy_" + this.id; }\r
+                                       });\r
+                               }\r
+                               else { o = obj.o; }\r
+\r
+                               if(obj.or.length) { obj.or.before(o); }\r
+                               else { \r
+                                       if(!obj.np.children("ul").length) { $("<ul />").appendTo(obj.np); }\r
+                                       obj.np.children("ul:eq(0)").append(o); \r
+                               }\r
+\r
+                               try { \r
+                                       obj.ot.clean_node(obj.op);\r
+                                       obj.rt.clean_node(obj.np);\r
+                                       if(!obj.op.find("> ul > li").length) {\r
+                                               obj.op.removeClass("jstree-open jstree-closed").addClass("jstree-leaf").children("ul").remove();\r
+                                       }\r
+                               } catch (e) { }\r
+\r
+                               if(is_copy) { \r
+                                       prepared_move.cy = true;\r
+                                       prepared_move.oc = o; \r
+                               }\r
+                               this.__callback(prepared_move);\r
+                               return prepared_move;\r
+                       },\r
+                       _get_move : function () { return prepared_move; }\r
+               }\r
+       });\r
+})(jQuery);\r
+//*/\r
+\r
+/* \r
+ * jsTree ui plugin\r
+ * This plugins handles selecting/deselecting/hovering/dehovering nodes\r
+ */\r
+(function ($) {\r
+       var scrollbar_width, e1, e2;\r
+       $(function() {\r
+               if (/msie/.test(navigator.userAgent.toLowerCase())) {\r
+                       e1 = $('<textarea cols="10" rows="2"></textarea>').css({ position: 'absolute', top: -1000, left: 0 }).appendTo('body');\r
+                       e2 = $('<textarea cols="10" rows="2" style="overflow: hidden;"></textarea>').css({ position: 'absolute', top: -1000, left: 0 }).appendTo('body');\r
+                       scrollbar_width = e1.width() - e2.width();\r
+                       e1.add(e2).remove();\r
+               } \r
+               else {\r
+                       e1 = $('<div />').css({ width: 100, height: 100, overflow: 'auto', position: 'absolute', top: -1000, left: 0 })\r
+                                       .prependTo('body').append('<div />').find('div').css({ width: '100%', height: 200 });\r
+                       scrollbar_width = 100 - e1.width();\r
+                       e1.parent().remove();\r
+               }\r
+       });\r
+       $.jstree.plugin("ui", {\r
+               __init : function () { \r
+                       this.data.ui.selected = $(); \r
+                       this.data.ui.last_selected = false; \r
+                       this.data.ui.hovered = null;\r
+                       this.data.ui.to_select = this.get_settings().ui.initially_select;\r
+\r
+                       this.get_container()\r
+                               .delegate("a", "click.jstree", $.proxy(function (event) {\r
+                                               event.preventDefault();\r
+                                               event.currentTarget.blur();\r
+                                               if(!$(event.currentTarget).hasClass("jstree-loading")) {\r
+                                                       this.select_node(event.currentTarget, true, event);\r
+                                               }\r
+                                       }, this))\r
+                               .delegate("a", "mouseenter.jstree", $.proxy(function (event) {\r
+                                               if(!$(event.currentTarget).hasClass("jstree-loading")) {\r
+                                                       this.hover_node(event.target);\r
+                                               }\r
+                                       }, this))\r
+                               .delegate("a", "mouseleave.jstree", $.proxy(function (event) {\r
+                                               if(!$(event.currentTarget).hasClass("jstree-loading")) {\r
+                                                       this.dehover_node(event.target);\r
+                                               }\r
+                                       }, this))\r
+                               .bind("reopen.jstree", $.proxy(function () { \r
+                                               this.reselect();\r
+                                       }, this))\r
+                               .bind("get_rollback.jstree", $.proxy(function () { \r
+                                               this.dehover_node();\r
+                                               this.save_selected();\r
+                                       }, this))\r
+                               .bind("set_rollback.jstree", $.proxy(function () { \r
+                                               this.reselect();\r
+                                       }, this))\r
+                               .bind("close_node.jstree", $.proxy(function (event, data) { \r
+                                               var s = this._get_settings().ui,\r
+                                                       obj = this._get_node(data.rslt.obj),\r
+                                                       clk = (obj && obj.length) ? obj.children("ul").find("a.jstree-clicked") : $(),\r
+                                                       _this = this;\r
+                                               if(s.selected_parent_close === false || !clk.length) { return; }\r
+                                               clk.each(function () { \r
+                                                       _this.deselect_node(this);\r
+                                                       if(s.selected_parent_close === "select_parent") { _this.select_node(obj); }\r
+                                               });\r
+                                       }, this))\r
+                               .bind("delete_node.jstree", $.proxy(function (event, data) { \r
+                                               var s = this._get_settings().ui.select_prev_on_delete,\r
+                                                       obj = this._get_node(data.rslt.obj),\r
+                                                       clk = (obj && obj.length) ? obj.find("a.jstree-clicked") : [],\r
+                                                       _this = this;\r
+                                               clk.each(function () { _this.deselect_node(this); });\r
+                                               if(s && clk.length) { \r
+                                                       data.rslt.prev.each(function () { \r
+                                                               if(this.parentNode) { _this.select_node(this); return false; /* if return false is removed all prev nodes will be selected */}\r
+                                                       });\r
+                                               }\r
+                                       }, this))\r
+                               .bind("move_node.jstree", $.proxy(function (event, data) { \r
+                                               if(data.rslt.cy) { \r
+                                                       data.rslt.oc.find("a.jstree-clicked").removeClass("jstree-clicked");\r
+                                               }\r
+                                       }, this));\r
+               },\r
+               defaults : {\r
+                       select_limit : -1, // 0, 1, 2 ... or -1 for unlimited\r
+                       select_multiple_modifier : "ctrl", // on, or ctrl, shift, alt\r
+                       select_range_modifier : "shift",\r
+                       selected_parent_close : "select_parent", // false, "deselect", "select_parent"\r
+                       selected_parent_open : true,\r
+                       select_prev_on_delete : true,\r
+                       disable_selecting_children : false,\r
+                       initially_select : []\r
+               },\r
+               _fn : { \r
+                       _get_node : function (obj, allow_multiple) {\r
+                               if(typeof obj === "undefined" || obj === null) { return allow_multiple ? this.data.ui.selected : this.data.ui.last_selected; }\r
+                               var $obj = $(obj, this.get_container()); \r
+                               if($obj.is(".jstree") || obj == -1) { return -1; } \r
+                               $obj = $obj.closest("li", this.get_container()); \r
+                               return $obj.length ? $obj : false; \r
+                       },\r
+                       _ui_notify : function (n, data) {\r
+                               if(data.selected) {\r
+                                       this.select_node(n, false);\r
+                               }\r
+                       },\r
+                       save_selected : function () {\r
+                               var _this = this;\r
+                               this.data.ui.to_select = [];\r
+                               this.data.ui.selected.each(function () { if(this.id) { _this.data.ui.to_select.push("#" + this.id.toString().replace(/^#/,"").replace(/\\\//g,"/").replace(/\//g,"\\\/").replace(/\\\./g,".").replace(/\./g,"\\.").replace(/\:/g,"\\:")); } });\r
+                               this.__callback(this.data.ui.to_select);\r
+                       },\r
+                       reselect : function () {\r
+                               var _this = this,\r
+                                       s = this.data.ui.to_select;\r
+                               s = $.map($.makeArray(s), function (n) { return "#" + n.toString().replace(/^#/,"").replace(/\\\//g,"/").replace(/\//g,"\\\/").replace(/\\\./g,".").replace(/\./g,"\\.").replace(/\:/g,"\\:"); });\r
+                               // this.deselect_all(); WHY deselect, breaks plugin state notifier?\r
+                               $.each(s, function (i, val) { if(val && val !== "#") { _this.select_node(val); } });\r
+                               this.data.ui.selected = this.data.ui.selected.filter(function () { return this.parentNode; });\r
+                               this.__callback();\r
+                       },\r
+                       refresh : function (obj) {\r
+                               this.save_selected();\r
+                               return this.__call_old();\r
+                       },\r
+                       hover_node : function (obj) {\r
+                               obj = this._get_node(obj);\r
+                               if(!obj.length) { return false; }\r
+                               //if(this.data.ui.hovered && obj.get(0) === this.data.ui.hovered.get(0)) { return; }\r
+                               if(!obj.hasClass("jstree-hovered")) { this.dehover_node(); }\r
+                               this.data.ui.hovered = obj.children("a").addClass("jstree-hovered").parent();\r
+                               this._fix_scroll(obj);\r
+                               this.__callback({ "obj" : obj });\r
+                       },\r
+                       dehover_node : function () {\r
+                               var obj = this.data.ui.hovered, p;\r
+                               if(!obj || !obj.length) { return false; }\r
+                               p = obj.children("a").removeClass("jstree-hovered").parent();\r
+                               if(this.data.ui.hovered[0] === p[0]) { this.data.ui.hovered = null; }\r
+                               this.__callback({ "obj" : obj });\r
+                       },\r
+                       select_node : function (obj, check, e) {\r
+                               obj = this._get_node(obj);\r
+                               if(obj == -1 || !obj || !obj.length) { return false; }\r
+                               var s = this._get_settings().ui,\r
+                                       is_multiple = (s.select_multiple_modifier == "on" || (s.select_multiple_modifier !== false && e && e[s.select_multiple_modifier + "Key"])),\r
+                                       is_range = (s.select_range_modifier !== false && e && e[s.select_range_modifier + "Key"] && this.data.ui.last_selected && this.data.ui.last_selected[0] !== obj[0] && this.data.ui.last_selected.parent()[0] === obj.parent()[0]),\r
+                                       is_selected = this.is_selected(obj),\r
+                                       proceed = true,\r
+                                       t = this;\r
+                               if(check) {\r
+                                       if(s.disable_selecting_children && is_multiple && \r
+                                               (\r
+                                                       (obj.parentsUntil(".jstree","li").children("a.jstree-clicked").length) ||\r
+                                                       (obj.children("ul").find("a.jstree-clicked:eq(0)").length)\r
+                                               )\r
+                                       ) {\r
+                                               return false;\r
+                                       }\r
+                                       proceed = false;\r
+                                       switch(!0) {\r
+                                               case (is_range):\r
+                                                       this.data.ui.last_selected.addClass("jstree-last-selected");\r
+                                                       obj = obj[ obj.index() < this.data.ui.last_selected.index() ? "nextUntil" : "prevUntil" ](".jstree-last-selected").andSelf();\r
+                                                       if(s.select_limit == -1 || obj.length < s.select_limit) {\r
+                                                               this.data.ui.last_selected.removeClass("jstree-last-selected");\r
+                                                               this.data.ui.selected.each(function () {\r
+                                                                       if(this !== t.data.ui.last_selected[0]) { t.deselect_node(this); }\r
+                                                               });\r
+                                                               is_selected = false;\r
+                                                               proceed = true;\r
+                                                       }\r
+                                                       else {\r
+                                                               proceed = false;\r
+                                                       }\r
+                                                       break;\r
+                                               case (is_selected && !is_multiple): \r
+                                                       this.deselect_all();\r
+                                                       is_selected = false;\r
+                                                       proceed = true;\r
+                                                       break;\r
+                                               case (!is_selected && !is_multiple): \r
+                                                       if(s.select_limit == -1 || s.select_limit > 0) {\r
+                                                               this.deselect_all();\r
+                                                               proceed = true;\r
+                                                       }\r
+                                                       break;\r
+                                               case (is_selected && is_multiple): \r
+                                                       this.deselect_node(obj);\r
+                                                       break;\r
+                                               case (!is_selected && is_multiple): \r
+                                                       if(s.select_limit == -1 || this.data.ui.selected.length + 1 <= s.select_limit) { \r
+                                                               proceed = true;\r
+                                                       }\r
+                                                       break;\r
+                                       }\r
+                               }\r
+                               if(proceed && !is_selected) {\r
+                                       if(!is_range) { this.data.ui.last_selected = obj; }\r
+                                       obj.children("a").addClass("jstree-clicked");\r
+                                       if(s.selected_parent_open) {\r
+                                               obj.parents(".jstree-closed").each(function () { t.open_node(this, false, true); });\r
+                                       }\r
+                                       this.data.ui.selected = this.data.ui.selected.add(obj);\r
+                                       this._fix_scroll(obj.eq(0));\r
+                                       this.__callback({ "obj" : obj, "e" : e });\r
+                               }\r
+                       },\r
+                       _fix_scroll : function (obj) {\r
+                               var c = this.get_container()[0], t;\r
+                               if(c.scrollHeight > c.offsetHeight) {\r
+                                       obj = this._get_node(obj);\r
+                                       if(!obj || obj === -1 || !obj.length || !obj.is(":visible")) { return; }\r
+                                       t = obj.offset().top - this.get_container().offset().top;\r
+                                       if(t < 0) { \r
+                                               c.scrollTop = c.scrollTop + t - 1; \r
+                                       }\r
+                                       if(t + this.data.core.li_height + (c.scrollWidth > c.offsetWidth ? scrollbar_width : 0) > c.offsetHeight) { \r
+                                               c.scrollTop = c.scrollTop + (t - c.offsetHeight + this.data.core.li_height + 1 + (c.scrollWidth > c.offsetWidth ? scrollbar_width : 0)); \r
+                                       }\r
+                               }\r
+                       },\r
+                       deselect_node : function (obj) {\r
+                               obj = this._get_node(obj);\r
+                               if(!obj.length) { return false; }\r
+                               if(this.is_selected(obj)) {\r
+                                       obj.children("a").removeClass("jstree-clicked");\r
+                                       this.data.ui.selected = this.data.ui.selected.not(obj);\r
+                                       if(this.data.ui.last_selected.get(0) === obj.get(0)) { this.data.ui.last_selected = this.data.ui.selected.eq(0); }\r
+                                       this.__callback({ "obj" : obj });\r
+                               }\r
+                       },\r
+                       toggle_select : function (obj) {\r
+                               obj = this._get_node(obj);\r
+                               if(!obj.length) { return false; }\r
+                               if(this.is_selected(obj)) { this.deselect_node(obj); }\r
+                               else { this.select_node(obj); }\r
+                       },\r
+                       is_selected : function (obj) { return this.data.ui.selected.index(this._get_node(obj)) >= 0; },\r
+                       get_selected : function (context) { \r
+                               return context ? $(context).find("a.jstree-clicked").parent() : this.data.ui.selected; \r
+                       },\r
+                       deselect_all : function (context) {\r
+                               var ret = context ? $(context).find("a.jstree-clicked").parent() : this.get_container().find("a.jstree-clicked").parent();\r
+                               ret.children("a.jstree-clicked").removeClass("jstree-clicked");\r
+                               this.data.ui.selected = $([]);\r
+                               this.data.ui.last_selected = false;\r
+                               this.__callback({ "obj" : ret });\r
+                       }\r
+               }\r
+       });\r
+       // include the selection plugin by default\r
+       $.jstree.defaults.plugins.push("ui");\r
+})(jQuery);\r
+//*/\r
+\r
+/* \r
+ * jsTree CRRM plugin\r
+ * Handles creating/renaming/removing/moving nodes by user interaction.\r
+ */\r
+(function ($) {\r
+       $.jstree.plugin("crrm", { \r
+               __init : function () {\r
+                       this.get_container()\r
+                               .bind("move_node.jstree", $.proxy(function (e, data) {\r
+                                       if(this._get_settings().crrm.move.open_onmove) {\r
+                                               var t = this;\r
+                                               data.rslt.np.parentsUntil(".jstree").andSelf().filter(".jstree-closed").each(function () {\r
+                                                       t.open_node(this, false, true);\r
+                                               });\r
+                                       }\r
+                               }, this));\r
+               },\r
+               defaults : {\r
+                       input_width_limit : 200,\r
+                       move : {\r
+                               always_copy                     : false, // false, true or "multitree"\r
+                               open_onmove                     : true,\r
+                               default_position        : "last",\r
+                               check_move                      : function (m) { return true; }\r
+                       }\r
+               },\r
+               _fn : {\r
+                       _show_input : function (obj, callback) {\r
+                               obj = this._get_node(obj);\r
+                               var rtl = this._get_settings().core.rtl,\r
+                                       w = this._get_settings().crrm.input_width_limit,\r
+                                       w1 = obj.children("ins").width(),\r
+                                       w2 = obj.find("> a:visible > ins").width() * obj.find("> a:visible > ins").length,\r
+                                       t = this.get_text(obj),\r
+                                       h1 = $("<div />", { css : { "position" : "absolute", "top" : "-200px", "left" : (rtl ? "0px" : "-1000px"), "visibility" : "hidden" } }).appendTo("body"),\r
+                                       h2 = obj.css("position","relative").append(\r
+                                       $("<input />", { \r
+                                               "value" : t,\r
+                                               "class" : "jstree-rename-input",\r
+                                               // "size" : t.length,\r
+                                               "css" : {\r
+                                                       "padding" : "0",\r
+                                                       "border" : "1px solid silver",\r
+                                                       "position" : "absolute",\r
+                                                       "left"  : (rtl ? "auto" : (w1 + w2 + 4) + "px"),\r
+                                                       "right" : (rtl ? (w1 + w2 + 4) + "px" : "auto"),\r
+                                                       "top" : "0px",\r
+                                                       "height" : (this.data.core.li_height - 2) + "px",\r
+                                                       "lineHeight" : (this.data.core.li_height - 2) + "px",\r
+                                                       "width" : "150px" // will be set a bit further down\r
+                                               },\r
+                                               "blur" : $.proxy(function () {\r
+                                                       var i = obj.children(".jstree-rename-input"),\r
+                                                               v = i.val();\r
+                                                       if(v === "") { v = t; }\r
+                                                       h1.remove();\r
+                                                       i.remove(); // rollback purposes\r
+                                                       this.set_text(obj,t); // rollback purposes\r
+                                                       this.rename_node(obj, v);\r
+                                                       callback.call(this, obj, v, t);\r
+                                                       obj.css("position","");\r
+                                               }, this),\r
+                                               "keyup" : function (event) {\r
+                                                       var key = event.keyCode || event.which;\r
+                                                       if(key == 27) { this.value = t; this.blur(); return; }\r
+                                                       else if(key == 13) { this.blur(); return; }\r
+                                                       else {\r
+                                                               h2.width(Math.min(h1.text("pW" + this.value).width(),w));\r
+                                                       }\r
+                                               },\r
+                                               "keypress" : function(event) {\r
+                                                       var key = event.keyCode || event.which;\r
+                                                       if(key == 13) { return false; }\r
+                                               }\r
+                                       })\r
+                               ).children(".jstree-rename-input"); \r
+                               this.set_text(obj, "");\r
+                               h1.css({\r
+                                               fontFamily              : h2.css('fontFamily')          || '',\r
+                                               fontSize                : h2.css('fontSize')            || '',\r
+                                               fontWeight              : h2.css('fontWeight')          || '',\r
+                                               fontStyle               : h2.css('fontStyle')           || '',\r
+                                               fontStretch             : h2.css('fontStretch')         || '',\r
+                                               fontVariant             : h2.css('fontVariant')         || '',\r
+                                               letterSpacing   : h2.css('letterSpacing')       || '',\r
+                                               wordSpacing             : h2.css('wordSpacing')         || ''\r
+                               });\r
+                               h2.width(Math.min(h1.text("pW" + h2[0].value).width(),w))[0].select();\r
+                       },\r
+                       rename : function (obj) {\r
+                               obj = this._get_node(obj);\r
+                               this.__rollback();\r
+                               var f = this.__callback;\r
+                               this._show_input(obj, function (obj, new_name, old_name) { \r
+                                       f.call(this, { "obj" : obj, "new_name" : new_name, "old_name" : old_name });\r
+                               });\r
+                       },\r
+                       create : function (obj, position, js, callback, skip_rename) {\r
+                               var t, _this = this;\r
+                               obj = this._get_node(obj);\r
+                               if(!obj) { obj = -1; }\r
+                               this.__rollback();\r
+                               t = this.create_node(obj, position, js, function (t) {\r
+                                       var p = this._get_parent(t),\r
+                                               pos = $(t).index();\r
+                                       if(callback) { callback.call(this, t); }\r
+                                       if(p.length && p.hasClass("jstree-closed")) { this.open_node(p, false, true); }\r
+                                       if(!skip_rename) { \r
+                                               this._show_input(t, function (obj, new_name, old_name) { \r
+                                                       _this.__callback({ "obj" : obj, "name" : new_name, "parent" : p, "position" : pos });\r
+                                               });\r
+                                       }\r
+                                       else { _this.__callback({ "obj" : t, "name" : this.get_text(t), "parent" : p, "position" : pos }); }\r
+                               });\r
+                               return t;\r
+                       },\r
+                       remove : function (obj) {\r
+                               obj = this._get_node(obj, true);\r
+                               var p = this._get_parent(obj), prev = this._get_prev(obj);\r
+                               this.__rollback();\r
+                               obj = this.delete_node(obj);\r
+                               if(obj !== false) { this.__callback({ "obj" : obj, "prev" : prev, "parent" : p }); }\r
+                       },\r
+                       check_move : function () {\r
+                               if(!this.__call_old()) { return false; }\r
+                               var s = this._get_settings().crrm.move;\r
+                               if(!s.check_move.call(this, this._get_move())) { return false; }\r
+                               return true;\r
+                       },\r
+                       move_node : function (obj, ref, position, is_copy, is_prepared, skip_check) {\r
+                               var s = this._get_settings().crrm.move;\r
+                               if(!is_prepared) { \r
+                                       if(typeof position === "undefined") { position = s.default_position; }\r
+                                       if(position === "inside" && !s.default_position.match(/^(before|after)$/)) { position = s.default_position; }\r
+                                       return this.__call_old(true, obj, ref, position, is_copy, false, skip_check);\r
+                               }\r
+                               // if the move is already prepared\r
+                               if(s.always_copy === true || (s.always_copy === "multitree" && obj.rt.get_index() !== obj.ot.get_index() )) {\r
+                                       is_copy = true;\r
+                               }\r
+                               this.__call_old(true, obj, ref, position, is_copy, true, skip_check);\r
+                       },\r
+\r
+                       cut : function (obj) {\r
+                               obj = this._get_node(obj, true);\r
+                               if(!obj || !obj.length) { return false; }\r
+                               this.data.crrm.cp_nodes = false;\r
+                               this.data.crrm.ct_nodes = obj;\r
+                               this.__callback({ "obj" : obj });\r
+                       },\r
+                       copy : function (obj) {\r
+                               obj = this._get_node(obj, true);\r
+                               if(!obj || !obj.length) { return false; }\r
+                               this.data.crrm.ct_nodes = false;\r
+                               this.data.crrm.cp_nodes = obj;\r
+                               this.__callback({ "obj" : obj });\r
+                       },\r
+                       paste : function (obj) { \r
+                               obj = this._get_node(obj);\r
+                               if(!obj || !obj.length) { return false; }\r
+                               var nodes = this.data.crrm.ct_nodes ? this.data.crrm.ct_nodes : this.data.crrm.cp_nodes;\r
+                               if(!this.data.crrm.ct_nodes && !this.data.crrm.cp_nodes) { return false; }\r
+                               if(this.data.crrm.ct_nodes) { this.move_node(this.data.crrm.ct_nodes, obj); this.data.crrm.ct_nodes = false; }\r
+                               if(this.data.crrm.cp_nodes) { this.move_node(this.data.crrm.cp_nodes, obj, false, true); }\r
+                               this.__callback({ "obj" : obj, "nodes" : nodes });\r
+                       }\r
+               }\r
+       });\r
+       // include the crr plugin by default\r
+       // $.jstree.defaults.plugins.push("crrm");\r
+})(jQuery);\r
+//*/\r
+\r
+/* \r
+ * jsTree themes plugin\r
+ * Handles loading and setting themes, as well as detecting path to themes, etc.\r
+ */\r
+(function ($) {\r
+       var themes_loaded = [];\r
+       // this variable stores the path to the themes folder - if left as false - it will be autodetected\r
+       $.jstree._themes = false;\r
+       $.jstree.plugin("themes", {\r
+               __init : function () { \r
+                       this.get_container()\r
+                               .bind("init.jstree", $.proxy(function () {\r
+                                               var s = this._get_settings().themes;\r
+                                               this.data.themes.dots = s.dots; \r
+                                               this.data.themes.icons = s.icons; \r
+                                               this.set_theme(s.theme, s.url);\r
+                                       }, this))\r
+                               .bind("loaded.jstree", $.proxy(function () {\r
+                                               // bound here too, as simple HTML tree's won't honor dots & icons otherwise\r
+                                               if(!this.data.themes.dots) { this.hide_dots(); }\r
+                                               else { this.show_dots(); }\r
+                                               if(!this.data.themes.icons) { this.hide_icons(); }\r
+                                               else { this.show_icons(); }\r
+                                       }, this));\r
+               },\r
+               defaults : { \r
+                       theme : "default", \r
+                       url : false,\r
+                       dots : true,\r
+                       icons : true\r
+               },\r
+               _fn : {\r
+                       set_theme : function (theme_name, theme_url) {\r
+                               if(!theme_name) { return false; }\r
+                               if(!theme_url) { theme_url = $.jstree._themes + theme_name + '/style.css'; }\r
+                               if($.inArray(theme_url, themes_loaded) == -1) {\r
+                                       $.vakata.css.add_sheet({ "url" : theme_url });\r
+                                       themes_loaded.push(theme_url);\r
+                               }\r
+                               if(this.data.themes.theme != theme_name) {\r
+                                       this.get_container().removeClass('jstree-' + this.data.themes.theme);\r
+                                       this.data.themes.theme = theme_name;\r
+                               }\r
+                               this.get_container().addClass('jstree-' + theme_name);\r
+                               if(!this.data.themes.dots) { this.hide_dots(); }\r
+                               else { this.show_dots(); }\r
+                               if(!this.data.themes.icons) { this.hide_icons(); }\r
+                               else { this.show_icons(); }\r
+                               this.__callback();\r
+                       },\r
+                       get_theme       : function () { return this.data.themes.theme; },\r
+\r
+                       show_dots       : function () { this.data.themes.dots = true; this.get_container().children("ul").removeClass("jstree-no-dots"); },\r
+                       hide_dots       : function () { this.data.themes.dots = false; this.get_container().children("ul").addClass("jstree-no-dots"); },\r
+                       toggle_dots     : function () { if(this.data.themes.dots) { this.hide_dots(); } else { this.show_dots(); } },\r
+\r
+                       show_icons      : function () { this.data.themes.icons = true; this.get_container().children("ul").removeClass("jstree-no-icons"); },\r
+                       hide_icons      : function () { this.data.themes.icons = false; this.get_container().children("ul").addClass("jstree-no-icons"); },\r
+                       toggle_icons: function () { if(this.data.themes.icons) { this.hide_icons(); } else { this.show_icons(); } }\r
+               }\r
+       });\r
+       // autodetect themes path\r
+       $(function () {\r
+               if($.jstree._themes === false) {\r
+                       $("script").each(function () { \r
+                               if(this.src.toString().match(/jquery\.jstree[^\/]*?\.js(\?.*)?$/)) { \r
+                                       $.jstree._themes = this.src.toString().replace(/jquery\.jstree[^\/]*?\.js(\?.*)?$/, "") + 'themes/'; \r
+                                       return false; \r
+                               }\r
+                       });\r
+               }\r
+               if($.jstree._themes === false) { $.jstree._themes = "themes/"; }\r
+       });\r
+       // include the themes plugin by default\r
+       $.jstree.defaults.plugins.push("themes");\r
+})(jQuery);\r
+//*/\r
+\r
+/*\r
+ * jsTree hotkeys plugin\r
+ * Enables keyboard navigation for all tree instances\r
+ * Depends on the jstree ui & jquery hotkeys plugins\r
+ */\r
+(function ($) {\r
+       var bound = [];\r
+       function exec(i, event) {\r
+               var f = $.jstree._focused(), tmp;\r
+               if(f && f.data && f.data.hotkeys && f.data.hotkeys.enabled) { \r
+                       tmp = f._get_settings().hotkeys[i];\r
+                       if(tmp) { return tmp.call(f, event); }\r
+               }\r
+       }\r
+       $.jstree.plugin("hotkeys", {\r
+               __init : function () {\r
+                       if(typeof $.hotkeys === "undefined") { throw "jsTree hotkeys: jQuery hotkeys plugin not included."; }\r
+                       if(!this.data.ui) { throw "jsTree hotkeys: jsTree UI plugin not included."; }\r
+                       $.each(this._get_settings().hotkeys, function (i, v) {\r
+                               if(v !== false && $.inArray(i, bound) == -1) {\r
+                                       $(document).bind("keydown", i, function (event) { return exec(i, event); });\r
+                                       bound.push(i);\r
+                               }\r
+                       });\r
+                       this.get_container()\r
+                               .bind("lock.jstree", $.proxy(function () {\r
+                                               if(this.data.hotkeys.enabled) { this.data.hotkeys.enabled = false; this.data.hotkeys.revert = true; }\r
+                                       }, this))\r
+                               .bind("unlock.jstree", $.proxy(function () {\r
+                                               if(this.data.hotkeys.revert) { this.data.hotkeys.enabled = true; }\r
+                                       }, this));\r
+                       this.enable_hotkeys();\r
+               },\r
+               defaults : {\r
+                       "up" : function () { \r
+                               var o = this.data.ui.hovered || this.data.ui.last_selected || -1;\r
+                               this.hover_node(this._get_prev(o));\r
+                               return false; \r
+                       },\r
+                       "ctrl+up" : function () { \r
+                               var o = this.data.ui.hovered || this.data.ui.last_selected || -1;\r
+                               this.hover_node(this._get_prev(o));\r
+                               return false; \r
+                       },\r
+                       "shift+up" : function () { \r
+                               var o = this.data.ui.hovered || this.data.ui.last_selected || -1;\r
+                               this.hover_node(this._get_prev(o));\r
+                               return false; \r
+                       },\r
+                       "down" : function () { \r
+                               var o = this.data.ui.hovered || this.data.ui.last_selected || -1;\r
+                               this.hover_node(this._get_next(o));\r
+                               return false;\r
+                       },\r
+                       "ctrl+down" : function () { \r
+                               var o = this.data.ui.hovered || this.data.ui.last_selected || -1;\r
+                               this.hover_node(this._get_next(o));\r
+                               return false;\r
+                       },\r
+                       "shift+down" : function () { \r
+                               var o = this.data.ui.hovered || this.data.ui.last_selected || -1;\r
+                               this.hover_node(this._get_next(o));\r
+                               return false;\r
+                       },\r
+                       "left" : function () { \r
+                               var o = this.data.ui.hovered || this.data.ui.last_selected;\r
+                               if(o) {\r
+                                       if(o.hasClass("jstree-open")) { this.close_node(o); }\r
+                                       else { this.hover_node(this._get_prev(o)); }\r
+                               }\r
+                               return false;\r
+                       },\r
+                       "ctrl+left" : function () { \r
+                               var o = this.data.ui.hovered || this.data.ui.last_selected;\r
+                               if(o) {\r
+                                       if(o.hasClass("jstree-open")) { this.close_node(o); }\r
+                                       else { this.hover_node(this._get_prev(o)); }\r
+                               }\r
+                               return false;\r
+                       },\r
+                       "shift+left" : function () { \r
+                               var o = this.data.ui.hovered || this.data.ui.last_selected;\r
+                               if(o) {\r
+                                       if(o.hasClass("jstree-open")) { this.close_node(o); }\r
+                                       else { this.hover_node(this._get_prev(o)); }\r
+                               }\r
+                               return false;\r
+                       },\r
+                       "right" : function () { \r
+                               var o = this.data.ui.hovered || this.data.ui.last_selected;\r
+                               if(o && o.length) {\r
+                                       if(o.hasClass("jstree-closed")) { this.open_node(o); }\r
+                                       else { this.hover_node(this._get_next(o)); }\r
+                               }\r
+                               return false;\r
+                       },\r
+                       "ctrl+right" : function () { \r
+                               var o = this.data.ui.hovered || this.data.ui.last_selected;\r
+                               if(o && o.length) {\r
+                                       if(o.hasClass("jstree-closed")) { this.open_node(o); }\r
+                                       else { this.hover_node(this._get_next(o)); }\r
+                               }\r
+                               return false;\r
+                       },\r
+                       "shift+right" : function () { \r
+                               var o = this.data.ui.hovered || this.data.ui.last_selected;\r
+                               if(o && o.length) {\r
+                                       if(o.hasClass("jstree-closed")) { this.open_node(o); }\r
+                                       else { this.hover_node(this._get_next(o)); }\r
+                               }\r
+                               return false;\r
+                       },\r
+                       "space" : function () { \r
+                               if(this.data.ui.hovered) { this.data.ui.hovered.children("a:eq(0)").click(); } \r
+                               return false; \r
+                       },\r
+                       "ctrl+space" : function (event) { \r
+                               event.type = "click";\r
+                               if(this.data.ui.hovered) { this.data.ui.hovered.children("a:eq(0)").trigger(event); } \r
+                               return false; \r
+                       },\r
+                       "shift+space" : function (event) { \r
+                               event.type = "click";\r
+                               if(this.data.ui.hovered) { this.data.ui.hovered.children("a:eq(0)").trigger(event); } \r
+                               return false; \r
+                       },\r
+                       "f2" : function () { this.rename(this.data.ui.hovered || this.data.ui.last_selected); },\r
+                       "del" : function () { this.remove(this.data.ui.hovered || this._get_node(null)); }\r
+               },\r
+               _fn : {\r
+                       enable_hotkeys : function () {\r
+                               this.data.hotkeys.enabled = true;\r
+                       },\r
+                       disable_hotkeys : function () {\r
+                               this.data.hotkeys.enabled = false;\r
+                       }\r
+               }\r
+       });\r
+})(jQuery);\r
+//*/\r
+\r
+/* \r
+ * jsTree JSON plugin\r
+ * The JSON data store. Datastores are build by overriding the `load_node` and `_is_loaded` functions.\r
+ */\r
+(function ($) {\r
+       $.jstree.plugin("json_data", {\r
+               __init : function() {\r
+                       var s = this._get_settings().json_data;\r
+                       if(s.progressive_unload) {\r
+                               this.get_container().bind("after_close.jstree", function (e, data) {\r
+                                       data.rslt.obj.children("ul").remove();\r
+                               });\r
+                       }\r
+               },\r
+               defaults : { \r
+                       // `data` can be a function:\r
+                       //  * accepts two arguments - node being loaded and a callback to pass the result to\r
+                       //  * will be executed in the current tree's scope & ajax won't be supported\r
+                       data : false, \r
+                       ajax : false,\r
+                       correct_state : true,\r
+                       progressive_render : false,\r
+                       progressive_unload : false\r
+               },\r
+               _fn : {\r
+                       load_node : function (obj, s_call, e_call) { var _this = this; this.load_node_json(obj, function () { _this.__callback({ "obj" : _this._get_node(obj) }); s_call.call(this); }, e_call); },\r
+                       _is_loaded : function (obj) { \r
+                               var s = this._get_settings().json_data;\r
+                               obj = this._get_node(obj); \r
+                               return obj == -1 || !obj || (!s.ajax && !s.progressive_render && !$.isFunction(s.data)) || obj.is(".jstree-open, .jstree-leaf") || obj.children("ul").children("li").length > 0;\r
+                       },\r
+                       refresh : function (obj) {\r
+                               obj = this._get_node(obj);\r
+                               var s = this._get_settings().json_data;\r
+                               if(obj && obj !== -1 && s.progressive_unload && ($.isFunction(s.data) || !!s.ajax)) {\r
+                                       obj.removeData("jstree-children");\r
+                               }\r
+                               return this.__call_old();\r
+                       },\r
+                       load_node_json : function (obj, s_call, e_call) {\r
+                               var s = this.get_settings().json_data, d,\r
+                                       error_func = function () {},\r
+                                       success_func = function () {};\r
+                               obj = this._get_node(obj);\r
+\r
+                               if(obj && obj !== -1 && (s.progressive_render || s.progressive_unload) && !obj.is(".jstree-open, .jstree-leaf") && obj.children("ul").children("li").length === 0 && obj.data("jstree-children")) {\r
+                                       d = this._parse_json(obj.data("jstree-children"), obj);\r
+                                       if(d) {\r
+                                               obj.append(d);\r
+                                               if(!s.progressive_unload) { obj.removeData("jstree-children"); }\r
+                                       }\r
+                                       this.clean_node(obj);\r
+                                       if(s_call) { s_call.call(this); }\r
+                                       return;\r
+                               }\r
+\r
+                               if(obj && obj !== -1) {\r
+                                       if(obj.data("jstree-is-loading")) { return; }\r
+                                       else { obj.data("jstree-is-loading",true); }\r
+                               }\r
+                               switch(!0) {\r
+                                       case (!s.data && !s.ajax): throw "Neither data nor ajax settings supplied.";\r
+                                       // function option added here for easier model integration (also supporting async - see callback)\r
+                                       case ($.isFunction(s.data)):\r
+                                               s.data.call(this, obj, $.proxy(function (d) {\r
+                                                       d = this._parse_json(d, obj);\r
+                                                       if(!d) { \r
+                                                               if(obj === -1 || !obj) {\r
+                                                                       if(s.correct_state) { this.get_container().children("ul").empty(); }\r
+                                                               }\r
+                                                               else {\r
+                                                                       obj.children("a.jstree-loading").removeClass("jstree-loading");\r
+                                                                       obj.removeData("jstree-is-loading");\r
+                                                                       if(s.correct_state) { this.correct_state(obj); }\r
+                                                               }\r
+                                                               if(e_call) { e_call.call(this); }\r
+                                                       }\r
+                                                       else {\r
+                                                               if(obj === -1 || !obj) { this.get_container().children("ul").empty().append(d.children()); }\r
+                                                               else { obj.append(d).children("a.jstree-loading").removeClass("jstree-loading"); obj.removeData("jstree-is-loading"); }\r
+                                                               this.clean_node(obj);\r
+                                                               if(s_call) { s_call.call(this); }\r
+                                                       }\r
+                                               }, this));\r
+                                               break;\r
+                                       case (!!s.data && !s.ajax) || (!!s.data && !!s.ajax && (!obj || obj === -1)):\r
+                                               if(!obj || obj == -1) {\r
+                                                       d = this._parse_json(s.data, obj);\r
+                                                       if(d) {\r
+                                                               this.get_container().children("ul").empty().append(d.children());\r
+                                                               this.clean_node();\r
+                                                       }\r
+                                                       else { \r
+                                                               if(s.correct_state) { this.get_container().children("ul").empty(); }\r
+                                                       }\r
+                                               }\r
+                                               if(s_call) { s_call.call(this); }\r
+                                               break;\r
+                                       case (!s.data && !!s.ajax) || (!!s.data && !!s.ajax && obj && obj !== -1):\r
+                                               error_func = function (x, t, e) {\r
+                                                       var ef = this.get_settings().json_data.ajax.error; \r
+                                                       if(ef) { ef.call(this, x, t, e); }\r
+                                                       if(obj != -1 && obj.length) {\r
+                                                               obj.children("a.jstree-loading").removeClass("jstree-loading");\r
+                                                               obj.removeData("jstree-is-loading");\r
+                                                               if(t === "success" && s.correct_state) { this.correct_state(obj); }\r
+                                                       }\r
+                                                       else {\r
+                                                               if(t === "success" && s.correct_state) { this.get_container().children("ul").empty(); }\r
+                                                       }\r
+                                                       if(e_call) { e_call.call(this); }\r
+                                               };\r
+                                               success_func = function (d, t, x) {\r
+                                                       var sf = this.get_settings().json_data.ajax.success; \r
+                                                       if(sf) { d = sf.call(this,d,t,x) || d; }\r
+                                                       if(d === "" || (d && d.toString && d.toString().replace(/^[\s\n]+$/,"") === "") || (!$.isArray(d) && !$.isPlainObject(d))) {\r
+                                                               return error_func.call(this, x, t, "");\r
+                                                       }\r
+                                                       d = this._parse_json(d, obj);\r
+                                                       if(d) {\r
+                                                               if(obj === -1 || !obj) { this.get_container().children("ul").empty().append(d.children()); }\r
+                                                               else { obj.append(d).children("a.jstree-loading").removeClass("jstree-loading"); obj.removeData("jstree-is-loading"); }\r
+                                                               this.clean_node(obj);\r
+                                                               if(s_call) { s_call.call(this); }\r
+                                                       }\r
+                                                       else {\r
+                                                               if(obj === -1 || !obj) {\r
+                                                                       if(s.correct_state) { \r
+                                                                               this.get_container().children("ul").empty(); \r
+                                                                               if(s_call) { s_call.call(this); }\r
+                                                                       }\r
+                                                               }\r
+                                                               else {\r
+                                                                       obj.children("a.jstree-loading").removeClass("jstree-loading");\r
+                                                                       obj.removeData("jstree-is-loading");\r
+                                                                       if(s.correct_state) { \r
+                                                                               this.correct_state(obj);\r
+                                                                               if(s_call) { s_call.call(this); } \r
+                                                                       }\r
+                                                               }\r
+                                                       }\r
+                                               };\r
+                                               s.ajax.context = this;\r
+                                               s.ajax.error = error_func;\r
+                                               s.ajax.success = success_func;\r
+                                               if(!s.ajax.dataType) { s.ajax.dataType = "json"; }\r
+                                               if($.isFunction(s.ajax.url)) { s.ajax.url = s.ajax.url.call(this, obj); }\r
+                                               if($.isFunction(s.ajax.data)) { s.ajax.data = s.ajax.data.call(this, obj); }\r
+                                               $.ajax(s.ajax);\r
+                                               break;\r
+                               }\r
+                       },\r
+                       _parse_json : function (js, obj, is_callback) {\r
+                               var d = false, \r
+                                       p = this._get_settings(),\r
+                                       s = p.json_data,\r
+                                       t = p.core.html_titles,\r
+                                       tmp, i, j, ul1, ul2;\r
+\r
+                               if(!js) { return d; }\r
+                               if(s.progressive_unload && obj && obj !== -1) { \r
+                                       obj.data("jstree-children", d);\r
+                               }\r
+                               if($.isArray(js)) {\r
+                                       d = $();\r
+                                       if(!js.length) { return false; }\r
+                                       for(i = 0, j = js.length; i < j; i++) {\r
+                                               tmp = this._parse_json(js[i], obj, true);\r
+                                               if(tmp.length) { d = d.add(tmp); }\r
+                                       }\r
+                               }\r
+                               else {\r
+                                       if(typeof js == "string") { js = { data : js }; }\r
+                                       if(!js.data && js.data !== "") { return d; }\r
+                                       d = $("<li />");\r
+                                       if(js.attr) { d.attr(js.attr); }\r
+                                       if(js.metadata) { d.data(js.metadata); }\r
+                                       if(js.state) { d.addClass("jstree-" + js.state); }\r
+                                       if(!$.isArray(js.data)) { tmp = js.data; js.data = []; js.data.push(tmp); }\r
+                                       $.each(js.data, function (i, m) {\r
+                                               tmp = $("<a />");\r
+                                               if($.isFunction(m)) { m = m.call(this, js); }\r
+                                               if(typeof m == "string") { tmp.attr('href','#')[ t ? "html" : "text" ](m); }\r
+                                               else {\r
+                                                       if(!m.attr) { m.attr = {}; }\r
+                                                       if(!m.attr.href) { m.attr.href = '#'; }\r
+                                                       tmp.attr(m.attr)[ t ? "html" : "text" ](m.title);\r
+                                                       if(m.language) { tmp.addClass(m.language); }\r
+                                               }\r
+                                               tmp.prepend("<ins class='jstree-icon'>&#160;</ins>");\r
+                                               if(!m.icon && js.icon) { m.icon = js.icon; }\r
+                                               if(m.icon) { \r
+                                                       if(m.icon.indexOf("/") === -1) { tmp.children("ins").addClass(m.icon); }\r
+                                                       else { tmp.children("ins").css("background","url('" + m.icon + "') center center no-repeat"); }\r
+                                               }\r
+                                               d.append(tmp);\r
+                                       });\r
+                                       d.prepend("<ins class='jstree-icon'>&#160;</ins>");\r
+                                       if(js.children) { \r
+                                               if(s.progressive_render && js.state !== "open") {\r
+                                                       d.addClass("jstree-closed").data("jstree-children", js.children);\r
+                                               }\r
+                                               else {\r
+                                                       if(s.progressive_unload) { d.data("jstree-children", js.children); }\r
+                                                       if($.isArray(js.children) && js.children.length) {\r
+                                                               tmp = this._parse_json(js.children, obj, true);\r
+                                                               if(tmp.length) {\r
+                                                                       ul2 = $("<ul />");\r
+                                                                       ul2.append(tmp);\r
+                                                                       d.append(ul2);\r
+                                                               }\r
+                                                       }\r
+                                               }\r
+                                       }\r
+                               }\r
+                               if(!is_callback) {\r
+                                       ul1 = $("<ul />");\r
+                                       ul1.append(d);\r
+                                       d = ul1;\r
+                               }\r
+                               return d;\r
+                       },\r
+                       get_json : function (obj, li_attr, a_attr, is_callback) {\r
+                               var result = [], \r
+                                       s = this._get_settings(), \r
+                                       _this = this,\r
+                                       tmp1, tmp2, li, a, t, lang;\r
+                               obj = this._get_node(obj);\r
+                               if(!obj || obj === -1) { obj = this.get_container().find("> ul > li"); }\r
+                               li_attr = $.isArray(li_attr) ? li_attr : [ "id", "class" ];\r
+                               if(!is_callback && this.data.types) { li_attr.push(s.types.type_attr); }\r
+                               a_attr = $.isArray(a_attr) ? a_attr : [ ];\r
+\r
+                               obj.each(function () {\r
+                                       li = $(this);\r
+                                       tmp1 = { data : [] };\r
+                                       if(li_attr.length) { tmp1.attr = { }; }\r
+                                       $.each(li_attr, function (i, v) { \r
+                                               tmp2 = li.attr(v); \r
+                                               if(tmp2 && tmp2.length && tmp2.replace(/jstree[^ ]*/ig,'').length) {\r
+                                                       tmp1.attr[v] = (" " + tmp2).replace(/ jstree[^ ]*/ig,'').replace(/\s+$/ig," ").replace(/^ /,"").replace(/ $/,""); \r
+                                               }\r
+                                       });\r
+                                       if(li.hasClass("jstree-open")) { tmp1.state = "open"; }\r
+                                       if(li.hasClass("jstree-closed")) { tmp1.state = "closed"; }\r
+                                       if(li.data()) { tmp1.metadata = li.data(); }\r
+                                       a = li.children("a");\r
+                                       a.each(function () {\r
+                                               t = $(this);\r
+                                               if(\r
+                                                       a_attr.length || \r
+                                                       $.inArray("languages", s.plugins) !== -1 || \r
+                                                       t.children("ins").get(0).style.backgroundImage.length || \r
+                                                       (t.children("ins").get(0).className && t.children("ins").get(0).className.replace(/jstree[^ ]*|$/ig,'').length)\r
+                                               ) { \r
+                                                       lang = false;\r
+                                                       if($.inArray("languages", s.plugins) !== -1 && $.isArray(s.languages) && s.languages.length) {\r
+                                                               $.each(s.languages, function (l, lv) {\r
+                                                                       if(t.hasClass(lv)) {\r
+                                                                               lang = lv;\r
+                                                                               return false;\r
+                                                                       }\r
+                                                               });\r
+                                                       }\r
+                                                       tmp2 = { attr : { }, title : _this.get_text(t, lang) }; \r
+                                                       $.each(a_attr, function (k, z) {\r
+                                                               tmp2.attr[z] = (" " + (t.attr(z) || "")).replace(/ jstree[^ ]*/ig,'').replace(/\s+$/ig," ").replace(/^ /,"").replace(/ $/,"");\r
+                                                       });\r
+                                                       if($.inArray("languages", s.plugins) !== -1 && $.isArray(s.languages) && s.languages.length) {\r
+                                                               $.each(s.languages, function (k, z) {\r
+                                                                       if(t.hasClass(z)) { tmp2.language = z; return true; }\r
+                                                               });\r
+                                                       }\r
+                                                       if(t.children("ins").get(0).className.replace(/jstree[^ ]*|$/ig,'').replace(/^\s+$/ig,"").length) {\r
+                                                               tmp2.icon = t.children("ins").get(0).className.replace(/jstree[^ ]*|$/ig,'').replace(/\s+$/ig," ").replace(/^ /,"").replace(/ $/,"");\r
+                                                       }\r
+                                                       if(t.children("ins").get(0).style.backgroundImage.length) {\r
+                                                               tmp2.icon = t.children("ins").get(0).style.backgroundImage.replace("url(","").replace(")","");\r
+                                                       }\r
+                                               }\r
+                                               else {\r
+                                                       tmp2 = _this.get_text(t);\r
+                                               }\r
+                                               if(a.length > 1) { tmp1.data.push(tmp2); }\r
+                                               else { tmp1.data = tmp2; }\r
+                                       });\r
+                                       li = li.find("> ul > li");\r
+                                       if(li.length) { tmp1.children = _this.get_json(li, li_attr, a_attr, true); }\r
+                                       result.push(tmp1);\r
+                               });\r
+                               return result;\r
+                       }\r
+               }\r
+       });\r
+})(jQuery);\r
+//*/\r
+\r
+/* \r
+ * jsTree languages plugin\r
+ * Adds support for multiple language versions in one tree\r
+ * This basically allows for many titles coexisting in one node, but only one of them being visible at any given time\r
+ * This is useful for maintaining the same structure in many languages (hence the name of the plugin)\r
+ */\r
+(function ($) {\r
+       $.jstree.plugin("languages", {\r
+               __init : function () { this._load_css();  },\r
+               defaults : [],\r
+               _fn : {\r
+                       set_lang : function (i) { \r
+                               var langs = this._get_settings().languages,\r
+                                       st = false,\r
+                                       selector = ".jstree-" + this.get_index() + ' a';\r
+                               if(!$.isArray(langs) || langs.length === 0) { return false; }\r
+                               if($.inArray(i,langs) == -1) {\r
+                                       if(!!langs[i]) { i = langs[i]; }\r
+                                       else { return false; }\r
+                               }\r
+                               if(i == this.data.languages.current_language) { return true; }\r
+                               st = $.vakata.css.get_css(selector + "." + this.data.languages.current_language, false, this.data.languages.language_css);\r
+                               if(st !== false) { st.style.display = "none"; }\r
+                               st = $.vakata.css.get_css(selector + "." + i, false, this.data.languages.language_css);\r
+                               if(st !== false) { st.style.display = ""; }\r
+                               this.data.languages.current_language = i;\r
+                               this.__callback(i);\r
+                               return true;\r
+                       },\r
+                       get_lang : function () {\r
+                               return this.data.languages.current_language;\r
+                       },\r
+                       _get_string : function (key, lang) {\r
+                               var langs = this._get_settings().languages,\r
+                                       s = this._get_settings().core.strings;\r
+                               if($.isArray(langs) && langs.length) {\r
+                                       lang = (lang && $.inArray(lang,langs) != -1) ? lang : this.data.languages.current_language;\r
+                               }\r
+                               if(s[lang] && s[lang][key]) { return s[lang][key]; }\r
+                               if(s[key]) { return s[key]; }\r
+                               return key;\r
+                       },\r
+                       get_text : function (obj, lang) {\r
+                               obj = this._get_node(obj) || this.data.ui.last_selected;\r
+                               if(!obj.size()) { return false; }\r
+                               var langs = this._get_settings().languages,\r
+                                       s = this._get_settings().core.html_titles;\r
+                               if($.isArray(langs) && langs.length) {\r
+                                       lang = (lang && $.inArray(lang,langs) != -1) ? lang : this.data.languages.current_language;\r
+                                       obj = obj.children("a." + lang);\r
+                               }\r
+                               else { obj = obj.children("a:eq(0)"); }\r
+                               if(s) {\r
+                                       obj = obj.clone();\r
+                                       obj.children("INS").remove();\r
+                                       return obj.html();\r
+                               }\r
+                               else {\r
+                                       obj = obj.contents().filter(function() { return this.nodeType == 3; })[0];\r
+                                       return obj.nodeValue;\r
+                               }\r
+                       },\r
+                       set_text : function (obj, val, lang) {\r
+                               obj = this._get_node(obj) || this.data.ui.last_selected;\r
+                               if(!obj.size()) { return false; }\r
+                               var langs = this._get_settings().languages,\r
+                                       s = this._get_settings().core.html_titles,\r
+                                       tmp;\r
+                               if($.isArray(langs) && langs.length) {\r
+                                       lang = (lang && $.inArray(lang,langs) != -1) ? lang : this.data.languages.current_language;\r
+                                       obj = obj.children("a." + lang);\r
+                               }\r
+                               else { obj = obj.children("a:eq(0)"); }\r
+                               if(s) {\r
+                                       tmp = obj.children("INS").clone();\r
+                                       obj.html(val).prepend(tmp);\r
+                                       this.__callback({ "obj" : obj, "name" : val, "lang" : lang });\r
+                                       return true;\r
+                               }\r
+                               else {\r
+                                       obj = obj.contents().filter(function() { return this.nodeType == 3; })[0];\r
+                                       this.__callback({ "obj" : obj, "name" : val, "lang" : lang });\r
+                                       return (obj.nodeValue = val);\r
+                               }\r
+                       },\r
+                       _load_css : function () {\r
+                               var langs = this._get_settings().languages,\r
+                                       str = "/* languages css */",\r
+                                       selector = ".jstree-" + this.get_index() + ' a',\r
+                                       ln;\r
+                               if($.isArray(langs) && langs.length) {\r
+                                       this.data.languages.current_language = langs[0];\r
+                                       for(ln = 0; ln < langs.length; ln++) {\r
+                                               str += selector + "." + langs[ln] + " {";\r
+                                               if(langs[ln] != this.data.languages.current_language) { str += " display:none; "; }\r
+                                               str += " } ";\r
+                                       }\r
+                                       this.data.languages.language_css = $.vakata.css.add_sheet({ 'str' : str, 'title' : "jstree-languages" });\r
+                               }\r
+                       },\r
+                       create_node : function (obj, position, js, callback) {\r
+                               var t = this.__call_old(true, obj, position, js, function (t) {\r
+                                       var langs = this._get_settings().languages,\r
+                                               a = t.children("a"),\r
+                                               ln;\r
+                                       if($.isArray(langs) && langs.length) {\r
+                                               for(ln = 0; ln < langs.length; ln++) {\r
+                                                       if(!a.is("." + langs[ln])) {\r
+                                                               t.append(a.eq(0).clone().removeClass(langs.join(" ")).addClass(langs[ln]));\r
+                                                       }\r
+                                               }\r
+                                               a.not("." + langs.join(", .")).remove();\r
+                                       }\r
+                                       if(callback) { callback.call(this, t); }\r
+                               });\r
+                               return t;\r
+                       }\r
+               }\r
+       });\r
+})(jQuery);\r
+//*/\r
+\r
+/*\r
+ * jsTree cookies plugin\r
+ * Stores the currently opened/selected nodes in a cookie and then restores them\r
+ * Depends on the jquery.cookie plugin\r
+ */\r
+(function ($) {\r
+       $.jstree.plugin("cookies", {\r
+               __init : function () {\r
+                       if(typeof $.cookie === "undefined") { throw "jsTree cookie: jQuery cookie plugin not included."; }\r
+\r
+                       var s = this._get_settings().cookies,\r
+                               tmp;\r
+                       if(!!s.save_loaded) {\r
+                               tmp = $.cookie(s.save_loaded);\r
+                               if(tmp && tmp.length) { this.data.core.to_load = tmp.split(","); }\r
+                       }\r
+                       if(!!s.save_opened) {\r
+                               tmp = $.cookie(s.save_opened);\r
+                               if(tmp && tmp.length) { this.data.core.to_open = tmp.split(","); }\r
+                       }\r
+                       if(!!s.save_selected) {\r
+                               tmp = $.cookie(s.save_selected);\r
+                               if(tmp && tmp.length && this.data.ui) { this.data.ui.to_select = tmp.split(","); }\r
+                       }\r
+                       this.get_container()\r
+                               .one( ( this.data.ui ? "reselect" : "reopen" ) + ".jstree", $.proxy(function () {\r
+                                       this.get_container()\r
+                                               .bind("open_node.jstree close_node.jstree select_node.jstree deselect_node.jstree", $.proxy(function (e) { \r
+                                                               if(this._get_settings().cookies.auto_save) { this.save_cookie((e.handleObj.namespace + e.handleObj.type).replace("jstree","")); }\r
+                                                       }, this));\r
+                               }, this));\r
+               },\r
+               defaults : {\r
+                       save_loaded             : "jstree_load",\r
+                       save_opened             : "jstree_open",\r
+                       save_selected   : "jstree_select",\r
+                       auto_save               : true,\r
+                       cookie_options  : {}\r
+               },\r
+               _fn : {\r
+                       save_cookie : function (c) {\r
+                               if(this.data.core.refreshing) { return; }\r
+                               var s = this._get_settings().cookies;\r
+                               if(!c) { // if called manually and not by event\r
+                                       if(s.save_loaded) {\r
+                                               this.save_loaded();\r
+                                               $.cookie(s.save_loaded, this.data.core.to_load.join(","), s.cookie_options);\r
+                                       }\r
+                                       if(s.save_opened) {\r
+                                               this.save_opened();\r
+                                               $.cookie(s.save_opened, this.data.core.to_open.join(","), s.cookie_options);\r
+                                       }\r
+                                       if(s.save_selected && this.data.ui) {\r
+                                               this.save_selected();\r
+                                               $.cookie(s.save_selected, this.data.ui.to_select.join(","), s.cookie_options);\r
+                                       }\r
+                                       return;\r
+                               }\r
+                               switch(c) {\r
+                                       case "open_node":\r
+                                       case "close_node":\r
+                                               if(!!s.save_opened) { \r
+                                                       this.save_opened(); \r
+                                                       $.cookie(s.save_opened, this.data.core.to_open.join(","), s.cookie_options); \r
+                                               }\r
+                                               if(!!s.save_loaded) { \r
+                                                       this.save_loaded(); \r
+                                                       $.cookie(s.save_loaded, this.data.core.to_load.join(","), s.cookie_options); \r
+                                               }\r
+                                               break;\r
+                                       case "select_node":\r
+                                       case "deselect_node":\r
+                                               if(!!s.save_selected && this.data.ui) { \r
+                                                       this.save_selected(); \r
+                                                       $.cookie(s.save_selected, this.data.ui.to_select.join(","), s.cookie_options); \r
+                                               }\r
+                                               break;\r
+                               }\r
+                       }\r
+               }\r
+       });\r
+       // include cookies by default\r
+       // $.jstree.defaults.plugins.push("cookies");\r
+})(jQuery);\r
+//*/\r
+\r
+/*\r
+ * jsTree sort plugin\r
+ * Sorts items alphabetically (or using any other function)\r
+ */\r
+(function ($) {\r
+       $.jstree.plugin("sort", {\r
+               __init : function () {\r
+                       this.get_container()\r
+                               .bind("load_node.jstree", $.proxy(function (e, data) {\r
+                                               var obj = this._get_node(data.rslt.obj);\r
+                                               obj = obj === -1 ? this.get_container().children("ul") : obj.children("ul");\r
+                                               this.sort(obj);\r
+                                       }, this))\r
+                               .bind("rename_node.jstree create_node.jstree create.jstree", $.proxy(function (e, data) {\r
+                                               this.sort(data.rslt.obj.parent());\r
+                                       }, this))\r
+                               .bind("move_node.jstree", $.proxy(function (e, data) {\r
+                                               var m = data.rslt.np == -1 ? this.get_container() : data.rslt.np;\r
+                                               this.sort(m.children("ul"));\r
+                                       }, this));\r
+               },\r
+               defaults : function (a, b) { return this.get_text(a) > this.get_text(b) ? 1 : -1; },\r
+               _fn : {\r
+                       sort : function (obj) {\r
+                               var s = this._get_settings().sort,\r
+                                       t = this;\r
+                               obj.append($.makeArray(obj.children("li")).sort($.proxy(s, t)));\r
+                               obj.find("> li > ul").each(function() { t.sort($(this)); });\r
+                               this.clean_node(obj);\r
+                       }\r
+               }\r
+       });\r
+})(jQuery);\r
+//*/\r
+\r
+/*\r
+ * jsTree DND plugin\r
+ * Drag and drop plugin for moving/copying nodes\r
+ */\r
+(function ($) {\r
+       var o = false,\r
+               r = false,\r
+               m = false,\r
+               ml = false,\r
+               sli = false,\r
+               sti = false,\r
+               dir1 = false,\r
+               dir2 = false,\r
+               last_pos = false;\r
+       $.vakata.dnd = {\r
+               is_down : false,\r
+               is_drag : false,\r
+               helper : false,\r
+               scroll_spd : 10,\r
+               init_x : 0,\r
+               init_y : 0,\r
+               threshold : 5,\r
+               helper_left : 5,\r
+               helper_top : 10,\r
+               user_data : {},\r
+\r
+               drag_start : function (e, data, html) { \r
+                       if($.vakata.dnd.is_drag) { $.vakata.drag_stop({}); }\r
+                       try {\r
+                               e.currentTarget.unselectable = "on";\r
+                               e.currentTarget.onselectstart = function() { return false; };\r
+                               if(e.currentTarget.style) { e.currentTarget.style.MozUserSelect = "none"; }\r
+                       } catch(err) { }\r
+                       $.vakata.dnd.init_x = e.pageX;\r
+                       $.vakata.dnd.init_y = e.pageY;\r
+                       $.vakata.dnd.user_data = data;\r
+                       $.vakata.dnd.is_down = true;\r
+                       $.vakata.dnd.helper = $("<div id='vakata-dragged' />").html(html); //.fadeTo(10,0.25);\r
+                       $(document).bind("mousemove", $.vakata.dnd.drag);\r
+                       $(document).bind("mouseup", $.vakata.dnd.drag_stop);\r
+                       return false;\r
+               },\r
+               drag : function (e) { \r
+                       if(!$.vakata.dnd.is_down) { return; }\r
+                       if(!$.vakata.dnd.is_drag) {\r
+                               if(Math.abs(e.pageX - $.vakata.dnd.init_x) > 5 || Math.abs(e.pageY - $.vakata.dnd.init_y) > 5) { \r
+                                       $.vakata.dnd.helper.appendTo("body");\r
+                                       $.vakata.dnd.is_drag = true;\r
+                                       $(document).triggerHandler("drag_start.vakata", { "event" : e, "data" : $.vakata.dnd.user_data });\r
+                               }\r
+                               else { return; }\r
+                       }\r
+\r
+                       // maybe use a scrolling parent element instead of document?\r
+                       if(e.type === "mousemove") { // thought of adding scroll in order to move the helper, but mouse poisition is n/a\r
+                               var d = $(document), t = d.scrollTop(), l = d.scrollLeft();\r
+                               if(e.pageY - t < 20) { \r
+                                       if(sti && dir1 === "down") { clearInterval(sti); sti = false; }\r
+                                       if(!sti) { dir1 = "up"; sti = setInterval(function () { $(document).scrollTop($(document).scrollTop() - $.vakata.dnd.scroll_spd); }, 150); }\r
+                               }\r
+                               else { \r
+                                       if(sti && dir1 === "up") { clearInterval(sti); sti = false; }\r
+                               }\r
+                               if($(window).height() - (e.pageY - t) < 20) {\r
+                                       if(sti && dir1 === "up") { clearInterval(sti); sti = false; }\r
+                                       if(!sti) { dir1 = "down"; sti = setInterval(function () { $(document).scrollTop($(document).scrollTop() + $.vakata.dnd.scroll_spd); }, 150); }\r
+                               }\r
+                               else { \r
+                                       if(sti && dir1 === "down") { clearInterval(sti); sti = false; }\r
+                               }\r
+\r
+                               if(e.pageX - l < 20) {\r
+                                       if(sli && dir2 === "right") { clearInterval(sli); sli = false; }\r
+                                       if(!sli) { dir2 = "left"; sli = setInterval(function () { $(document).scrollLeft($(document).scrollLeft() - $.vakata.dnd.scroll_spd); }, 150); }\r
+                               }\r
+                               else { \r
+                                       if(sli && dir2 === "left") { clearInterval(sli); sli = false; }\r
+                               }\r
+                               if($(window).width() - (e.pageX - l) < 20) {\r
+                                       if(sli && dir2 === "left") { clearInterval(sli); sli = false; }\r
+                                       if(!sli) { dir2 = "right"; sli = setInterval(function () { $(document).scrollLeft($(document).scrollLeft() + $.vakata.dnd.scroll_spd); }, 150); }\r
+                               }\r
+                               else { \r
+                                       if(sli && dir2 === "right") { clearInterval(sli); sli = false; }\r
+                               }\r
+                       }\r
+\r
+                       $.vakata.dnd.helper.css({ left : (e.pageX + $.vakata.dnd.helper_left) + "px", top : (e.pageY + $.vakata.dnd.helper_top) + "px" });\r
+                       $(document).triggerHandler("drag.vakata", { "event" : e, "data" : $.vakata.dnd.user_data });\r
+               },\r
+               drag_stop : function (e) {\r
+                       if(sli) { clearInterval(sli); }\r
+                       if(sti) { clearInterval(sti); }\r
+                       $(document).unbind("mousemove", $.vakata.dnd.drag);\r
+                       $(document).unbind("mouseup", $.vakata.dnd.drag_stop);\r
+                       $(document).triggerHandler("drag_stop.vakata", { "event" : e, "data" : $.vakata.dnd.user_data });\r
+                       $.vakata.dnd.helper.remove();\r
+                       $.vakata.dnd.init_x = 0;\r
+                       $.vakata.dnd.init_y = 0;\r
+                       $.vakata.dnd.user_data = {};\r
+                       $.vakata.dnd.is_down = false;\r
+                       $.vakata.dnd.is_drag = false;\r
+               }\r
+       };\r
+       $(function() {\r
+               var css_string = '#vakata-dragged { display:block; margin:0 0 0 0; padding:4px 4px 4px 24px; position:absolute; top:-2000px; line-height:16px; z-index:10000; } ';\r
+               $.vakata.css.add_sheet({ str : css_string, title : "vakata" });\r
+       });\r
+\r
+       $.jstree.plugin("dnd", {\r
+               __init : function () {\r
+                       this.data.dnd = {\r
+                               active : false,\r
+                               after : false,\r
+                               inside : false,\r
+                               before : false,\r
+                               off : false,\r
+                               prepared : false,\r
+                               w : 0,\r
+                               to1 : false,\r
+                               to2 : false,\r
+                               cof : false,\r
+                               cw : false,\r
+                               ch : false,\r
+                               i1 : false,\r
+                               i2 : false,\r
+                               mto : false\r
+                       };\r
+                       this.get_container()\r
+                               .bind("mouseenter.jstree", $.proxy(function (e) {\r
+                                               if($.vakata.dnd.is_drag && $.vakata.dnd.user_data.jstree) {\r
+                                                       if(this.data.themes) {\r
+                                                               m.attr("class", "jstree-" + this.data.themes.theme); \r
+                                                               if(ml) { ml.attr("class", "jstree-" + this.data.themes.theme); }\r
+                                                               $.vakata.dnd.helper.attr("class", "jstree-dnd-helper jstree-" + this.data.themes.theme);\r
+                                                       }\r
+                                                       //if($(e.currentTarget).find("> ul > li").length === 0) {\r
+                                                       if(e.currentTarget === e.target && $.vakata.dnd.user_data.obj && $($.vakata.dnd.user_data.obj).length && $($.vakata.dnd.user_data.obj).parents(".jstree:eq(0)")[0] !== e.target) { // node should not be from the same tree\r
+                                                               var tr = $.jstree._reference(e.target), dc;\r
+                                                               if(tr.data.dnd.foreign) {\r
+                                                                       dc = tr._get_settings().dnd.drag_check.call(this, { "o" : o, "r" : tr.get_container(), is_root : true });\r
+                                                                       if(dc === true || dc.inside === true || dc.before === true || dc.after === true) {\r
+                                                                               $.vakata.dnd.helper.children("ins").attr("class","jstree-ok");\r
+                                                                       }\r
+                                                               }\r
+                                                               else {\r
+                                                                       tr.prepare_move(o, tr.get_container(), "last");\r
+                                                                       if(tr.check_move()) {\r
+                                                                               $.vakata.dnd.helper.children("ins").attr("class","jstree-ok");\r
+                                                                       }\r
+                                                               }\r
+                                                       }\r
+                                               }\r
+                                       }, this))\r
+                               .bind("mouseup.jstree", $.proxy(function (e) {\r
+                                               //if($.vakata.dnd.is_drag && $.vakata.dnd.user_data.jstree && $(e.currentTarget).find("> ul > li").length === 0) {\r
+                                               if($.vakata.dnd.is_drag && $.vakata.dnd.user_data.jstree && e.currentTarget === e.target && $.vakata.dnd.user_data.obj && $($.vakata.dnd.user_data.obj).length && $($.vakata.dnd.user_data.obj).parents(".jstree:eq(0)")[0] !== e.target) { // node should not be from the same tree\r
+                                                       var tr = $.jstree._reference(e.currentTarget), dc;\r
+                                                       if(tr.data.dnd.foreign) {\r
+                                                               dc = tr._get_settings().dnd.drag_check.call(this, { "o" : o, "r" : tr.get_container(), is_root : true });\r
+                                                               if(dc === true || dc.inside === true || dc.before === true || dc.after === true) {\r
+                                                                       tr._get_settings().dnd.drag_finish.call(this, { "o" : o, "r" : tr.get_container(), is_root : true });\r
+                                                               }\r
+                                                       }\r
+                                                       else {\r
+                                                               tr.move_node(o, tr.get_container(), "last", e[tr._get_settings().dnd.copy_modifier + "Key"]);\r
+                                                       }\r
+                                               }\r
+                                       }, this))\r
+                               .bind("mouseleave.jstree", $.proxy(function (e) {\r
+                                               if(e.relatedTarget && e.relatedTarget.id && e.relatedTarget.id === "jstree-marker-line") {\r
+                                                       return false; \r
+                                               }\r
+                                               if($.vakata.dnd.is_drag && $.vakata.dnd.user_data.jstree) {\r
+                                                       if(this.data.dnd.i1) { clearInterval(this.data.dnd.i1); }\r
+                                                       if(this.data.dnd.i2) { clearInterval(this.data.dnd.i2); }\r
+                                                       if(this.data.dnd.to1) { clearTimeout(this.data.dnd.to1); }\r
+                                                       if(this.data.dnd.to2) { clearTimeout(this.data.dnd.to2); }\r
+                                                       if($.vakata.dnd.helper.children("ins").hasClass("jstree-ok")) {\r
+                                                               $.vakata.dnd.helper.children("ins").attr("class","jstree-invalid");\r
+                                                       }\r
+                                               }\r
+                                       }, this))\r
+                               .bind("mousemove.jstree", $.proxy(function (e) {\r
+                                               if($.vakata.dnd.is_drag && $.vakata.dnd.user_data.jstree) {\r
+                                                       var cnt = this.get_container()[0];\r
+\r
+                                                       // Horizontal scroll\r
+                                                       if(e.pageX + 24 > this.data.dnd.cof.left + this.data.dnd.cw) {\r
+                                                               if(this.data.dnd.i1) { clearInterval(this.data.dnd.i1); }\r
+                                                               this.data.dnd.i1 = setInterval($.proxy(function () { this.scrollLeft += $.vakata.dnd.scroll_spd; }, cnt), 100);\r
+                                                       }\r
+                                                       else if(e.pageX - 24 < this.data.dnd.cof.left) {\r
+                                                               if(this.data.dnd.i1) { clearInterval(this.data.dnd.i1); }\r
+                                                               this.data.dnd.i1 = setInterval($.proxy(function () { this.scrollLeft -= $.vakata.dnd.scroll_spd; }, cnt), 100);\r
+                                                       }\r
+                                                       else {\r
+                                                               if(this.data.dnd.i1) { clearInterval(this.data.dnd.i1); }\r
+                                                       }\r
+\r
+                                                       // Vertical scroll\r
+                                                       if(e.pageY + 24 > this.data.dnd.cof.top + this.data.dnd.ch) {\r
+                                                               if(this.data.dnd.i2) { clearInterval(this.data.dnd.i2); }\r
+                                                               this.data.dnd.i2 = setInterval($.proxy(function () { this.scrollTop += $.vakata.dnd.scroll_spd; }, cnt), 100);\r
+                                                       }\r
+                                                       else if(e.pageY - 24 < this.data.dnd.cof.top) {\r
+                                                               if(this.data.dnd.i2) { clearInterval(this.data.dnd.i2); }\r
+                                                               this.data.dnd.i2 = setInterval($.proxy(function () { this.scrollTop -= $.vakata.dnd.scroll_spd; }, cnt), 100);\r
+                                                       }\r
+                                                       else {\r
+                                                               if(this.data.dnd.i2) { clearInterval(this.data.dnd.i2); }\r
+                                                       }\r
+\r
+                                               }\r
+                                       }, this))\r
+                               .bind("scroll.jstree", $.proxy(function (e) { \r
+                                               if($.vakata.dnd.is_drag && $.vakata.dnd.user_data.jstree && m && ml) {\r
+                                                       m.hide();\r
+                                                       ml.hide();\r
+                                               }\r
+                                       }, this))\r
+                               .delegate("a", "mousedown.jstree", $.proxy(function (e) { \r
+                                               if(e.which === 1) {\r
+                                                       this.start_drag(e.currentTarget, e);\r
+                                                       return false;\r
+                                               }\r
+                                       }, this))\r
+                               .delegate("a", "mouseenter.jstree", $.proxy(function (e) { \r
+                                               if($.vakata.dnd.is_drag && $.vakata.dnd.user_data.jstree) {\r
+                                                       this.dnd_enter(e.currentTarget);\r
+                                               }\r
+                                       }, this))\r
+                               .delegate("a", "mousemove.jstree", $.proxy(function (e) { \r
+                                               if($.vakata.dnd.is_drag && $.vakata.dnd.user_data.jstree) {\r
+                                                       if(!r || !r.length || r.children("a")[0] !== e.currentTarget) {\r
+                                                               this.dnd_enter(e.currentTarget);\r
+                                                       }\r
+                                                       if(typeof this.data.dnd.off.top === "undefined") { this.data.dnd.off = $(e.target).offset(); }\r
+                                                       this.data.dnd.w = (e.pageY - (this.data.dnd.off.top || 0)) % this.data.core.li_height;\r
+                                                       if(this.data.dnd.w < 0) { this.data.dnd.w += this.data.core.li_height; }\r
+                                                       this.dnd_show();\r
+                                               }\r
+                                       }, this))\r
+                               .delegate("a", "mouseleave.jstree", $.proxy(function (e) { \r
+                                               if($.vakata.dnd.is_drag && $.vakata.dnd.user_data.jstree) {\r
+                                                       if(e.relatedTarget && e.relatedTarget.id && e.relatedTarget.id === "jstree-marker-line") {\r
+                                                               return false; \r
+                                                       }\r
+                                                               if(m) { m.hide(); }\r
+                                                               if(ml) { ml.hide(); }\r
+                                                       /*\r
+                                                       var ec = $(e.currentTarget).closest("li"), \r
+                                                               er = $(e.relatedTarget).closest("li");\r
+                                                       if(er[0] !== ec.prev()[0] && er[0] !== ec.next()[0]) {\r
+                                                               if(m) { m.hide(); }\r
+                                                               if(ml) { ml.hide(); }\r
+                                                       }\r
+                                                       */\r
+                                                       this.data.dnd.mto = setTimeout( \r
+                                                               (function (t) { return function () { t.dnd_leave(e); }; })(this),\r
+                                                       0);\r
+                                               }\r
+                                       }, this))\r
+                               .delegate("a", "mouseup.jstree", $.proxy(function (e) { \r
+                                               if($.vakata.dnd.is_drag && $.vakata.dnd.user_data.jstree) {\r
+                                                       this.dnd_finish(e);\r
+                                               }\r
+                                       }, this));\r
+\r
+                       $(document)\r
+                               .bind("drag_stop.vakata", $.proxy(function () {\r
+                                               if(this.data.dnd.to1) { clearTimeout(this.data.dnd.to1); }\r
+                                               if(this.data.dnd.to2) { clearTimeout(this.data.dnd.to2); }\r
+                                               if(this.data.dnd.i1) { clearInterval(this.data.dnd.i1); }\r
+                                               if(this.data.dnd.i2) { clearInterval(this.data.dnd.i2); }\r
+                                               this.data.dnd.after             = false;\r
+                                               this.data.dnd.before    = false;\r
+                                               this.data.dnd.inside    = false;\r
+                                               this.data.dnd.off               = false;\r
+                                               this.data.dnd.prepared  = false;\r
+                                               this.data.dnd.w                 = false;\r
+                                               this.data.dnd.to1               = false;\r
+                                               this.data.dnd.to2               = false;\r
+                                               this.data.dnd.i1                = false;\r
+                                               this.data.dnd.i2                = false;\r
+                                               this.data.dnd.active    = false;\r
+                                               this.data.dnd.foreign   = false;\r
+                                               if(m) { m.css({ "top" : "-2000px" }); }\r
+                                               if(ml) { ml.css({ "top" : "-2000px" }); }\r
+                                       }, this))\r
+                               .bind("drag_start.vakata", $.proxy(function (e, data) {\r
+                                               if(data.data.jstree) { \r
+                                                       var et = $(data.event.target);\r
+                                                       if(et.closest(".jstree").hasClass("jstree-" + this.get_index())) {\r
+                                                               this.dnd_enter(et);\r
+                                                       }\r
+                                               }\r
+                                       }, this));\r
+                               /*\r
+                               .bind("keydown.jstree-" + this.get_index() + " keyup.jstree-" + this.get_index(), $.proxy(function(e) {\r
+                                               if($.vakata.dnd.is_drag && $.vakata.dnd.user_data.jstree && !this.data.dnd.foreign) {\r
+                                                       var h = $.vakata.dnd.helper.children("ins");\r
+                                                       if(e[this._get_settings().dnd.copy_modifier + "Key"] && h.hasClass("jstree-ok")) {\r
+                                                               h.parent().html(h.parent().html().replace(/ \(Copy\)$/, "") + " (Copy)");\r
+                                                       } \r
+                                                       else {\r
+                                                               h.parent().html(h.parent().html().replace(/ \(Copy\)$/, ""));\r
+                                                       }\r
+                                               }\r
+                                       }, this)); */\r
+\r
+\r
+\r
+                       var s = this._get_settings().dnd;\r
+                       if(s.drag_target) {\r
+                               $(document)\r
+                                       .delegate(s.drag_target, "mousedown.jstree-" + this.get_index(), $.proxy(function (e) {\r
+                                               o = e.target;\r
+                                               $.vakata.dnd.drag_start(e, { jstree : true, obj : e.target }, "<ins class='jstree-icon'></ins>" + $(e.target).text() );\r
+                                               if(this.data.themes) { \r
+                                                       if(m) { m.attr("class", "jstree-" + this.data.themes.theme); }\r
+                                                       if(ml) { ml.attr("class", "jstree-" + this.data.themes.theme); }\r
+                                                       $.vakata.dnd.helper.attr("class", "jstree-dnd-helper jstree-" + this.data.themes.theme); \r
+                                               }\r
+                                               $.vakata.dnd.helper.children("ins").attr("class","jstree-invalid");\r
+                                               var cnt = this.get_container();\r
+                                               this.data.dnd.cof = cnt.offset();\r
+                                               this.data.dnd.cw = parseInt(cnt.width(),10);\r
+                                               this.data.dnd.ch = parseInt(cnt.height(),10);\r
+                                               this.data.dnd.foreign = true;\r
+                                               e.preventDefault();\r
+                                       }, this));\r
+                       }\r
+                       if(s.drop_target) {\r
+                               $(document)\r
+                                       .delegate(s.drop_target, "mouseenter.jstree-" + this.get_index(), $.proxy(function (e) {\r
+                                                       if(this.data.dnd.active && this._get_settings().dnd.drop_check.call(this, { "o" : o, "r" : $(e.target), "e" : e })) {\r
+                                                               $.vakata.dnd.helper.children("ins").attr("class","jstree-ok");\r
+                                                       }\r
+                                               }, this))\r
+                                       .delegate(s.drop_target, "mouseleave.jstree-" + this.get_index(), $.proxy(function (e) {\r
+                                                       if(this.data.dnd.active) {\r
+                                                               $.vakata.dnd.helper.children("ins").attr("class","jstree-invalid");\r
+                                                       }\r
+                                               }, this))\r
+                                       .delegate(s.drop_target, "mouseup.jstree-" + this.get_index(), $.proxy(function (e) {\r
+                                                       if(this.data.dnd.active && $.vakata.dnd.helper.children("ins").hasClass("jstree-ok")) {\r
+                                                               this._get_settings().dnd.drop_finish.call(this, { "o" : o, "r" : $(e.target), "e" : e });\r
+                                                       }\r
+                                               }, this));\r
+                       }\r
+               },\r
+               defaults : {\r
+                       copy_modifier   : "ctrl",\r
+                       check_timeout   : 100,\r
+                       open_timeout    : 500,\r
+                       drop_target             : ".jstree-drop",\r
+                       drop_check              : function (data) { return true; },\r
+                       drop_finish             : $.noop,\r
+                       drag_target             : ".jstree-draggable",\r
+                       drag_finish             : $.noop,\r
+                       drag_check              : function (data) { return { after : false, before : false, inside : true }; }\r
+               },\r
+               _fn : {\r
+                       dnd_prepare : function () {\r
+                               if(!r || !r.length) { return; }\r
+                               this.data.dnd.off = r.offset();\r
+                               if(this._get_settings().core.rtl) {\r
+                                       this.data.dnd.off.right = this.data.dnd.off.left + r.width();\r
+                               }\r
+                               if(this.data.dnd.foreign) {\r
+                                       var a = this._get_settings().dnd.drag_check.call(this, { "o" : o, "r" : r });\r
+                                       this.data.dnd.after = a.after;\r
+                                       this.data.dnd.before = a.before;\r
+                                       this.data.dnd.inside = a.inside;\r
+                                       this.data.dnd.prepared = true;\r
+                                       return this.dnd_show();\r
+                               }\r
+                               this.prepare_move(o, r, "before");\r
+                               this.data.dnd.before = this.check_move();\r
+                               this.prepare_move(o, r, "after");\r
+                               this.data.dnd.after = this.check_move();\r
+                               if(this._is_loaded(r)) {\r
+                                       this.prepare_move(o, r, "inside");\r
+                                       this.data.dnd.inside = this.check_move();\r
+                               }\r
+                               else {\r
+                                       this.data.dnd.inside = false;\r
+                               }\r
+                               this.data.dnd.prepared = true;\r
+                               return this.dnd_show();\r
+                       },\r
+                       dnd_show : function () {\r
+                               if(!this.data.dnd.prepared) { return; }\r
+                               var o = ["before","inside","after"],\r
+                                       r = false,\r
+                                       rtl = this._get_settings().core.rtl,\r
+                                       pos;\r
+                               if(this.data.dnd.w < this.data.core.li_height/3) { o = ["before","inside","after"]; }\r
+                               else if(this.data.dnd.w <= this.data.core.li_height*2/3) {\r
+                                       o = this.data.dnd.w < this.data.core.li_height/2 ? ["inside","before","after"] : ["inside","after","before"];\r
+                               }\r
+                               else { o = ["after","inside","before"]; }\r
+                               $.each(o, $.proxy(function (i, val) { \r
+                                       if(this.data.dnd[val]) {\r
+                                               $.vakata.dnd.helper.children("ins").attr("class","jstree-ok");\r
+                                               r = val;\r
+                                               return false;\r
+                                       }\r
+                               }, this));\r
+                               if(r === false) { $.vakata.dnd.helper.children("ins").attr("class","jstree-invalid"); }\r
+                               \r
+                               pos = rtl ? (this.data.dnd.off.right - 18) : (this.data.dnd.off.left + 10);\r
+                               switch(r) {\r
+                                       case "before":\r
+                                               m.css({ "left" : pos + "px", "top" : (this.data.dnd.off.top - 6) + "px" }).show();\r
+                                               if(ml) { ml.css({ "left" : (pos + 8) + "px", "top" : (this.data.dnd.off.top - 1) + "px" }).show(); }\r
+                                               break;\r
+                                       case "after":\r
+                                               m.css({ "left" : pos + "px", "top" : (this.data.dnd.off.top + this.data.core.li_height - 6) + "px" }).show();\r
+                                               if(ml) { ml.css({ "left" : (pos + 8) + "px", "top" : (this.data.dnd.off.top + this.data.core.li_height - 1) + "px" }).show(); }\r
+                                               break;\r
+                                       case "inside":\r
+                                               m.css({ "left" : pos + ( rtl ? -4 : 4) + "px", "top" : (this.data.dnd.off.top + this.data.core.li_height/2 - 5) + "px" }).show();\r
+                                               if(ml) { ml.hide(); }\r
+                                               break;\r
+                                       default:\r
+                                               m.hide();\r
+                                               if(ml) { ml.hide(); }\r
+                                               break;\r
+                               }\r
+                               last_pos = r;\r
+                               return r;\r
+                       },\r
+                       dnd_open : function () {\r
+                               this.data.dnd.to2 = false;\r
+                               this.open_node(r, $.proxy(this.dnd_prepare,this), true);\r
+                       },\r
+                       dnd_finish : function (e) {\r
+                               if(this.data.dnd.foreign) {\r
+                                       if(this.data.dnd.after || this.data.dnd.before || this.data.dnd.inside) {\r
+                                               this._get_settings().dnd.drag_finish.call(this, { "o" : o, "r" : r, "p" : last_pos });\r
+                                       }\r
+                               }\r
+                               else {\r
+                                       this.dnd_prepare();\r
+                                       this.move_node(o, r, last_pos, e[this._get_settings().dnd.copy_modifier + "Key"]);\r
+                               }\r
+                               o = false;\r
+                               r = false;\r
+                               m.hide();\r
+                               if(ml) { ml.hide(); }\r
+                       },\r
+                       dnd_enter : function (obj) {\r
+                               if(this.data.dnd.mto) { \r
+                                       clearTimeout(this.data.dnd.mto);\r
+                                       this.data.dnd.mto = false;\r
+                               }\r
+                               var s = this._get_settings().dnd;\r
+                               this.data.dnd.prepared = false;\r
+                               r = this._get_node(obj);\r
+                               if(s.check_timeout) { \r
+                                       // do the calculations after a minimal timeout (users tend to drag quickly to the desired location)\r
+                                       if(this.data.dnd.to1) { clearTimeout(this.data.dnd.to1); }\r
+                                       this.data.dnd.to1 = setTimeout($.proxy(this.dnd_prepare, this), s.check_timeout); \r
+                               }\r
+                               else { \r
+                                       this.dnd_prepare(); \r
+                               }\r
+                               if(s.open_timeout) { \r
+                                       if(this.data.dnd.to2) { clearTimeout(this.data.dnd.to2); }\r
+                                       if(r && r.length && r.hasClass("jstree-closed")) { \r
+                                               // if the node is closed - open it, then recalculate\r
+                                               this.data.dnd.to2 = setTimeout($.proxy(this.dnd_open, this), s.open_timeout);\r
+                                       }\r
+                               }\r
+                               else {\r
+                                       if(r && r.length && r.hasClass("jstree-closed")) { \r
+                                               this.dnd_open();\r
+                                       }\r
+                               }\r
+                       },\r
+                       dnd_leave : function (e) {\r
+                               this.data.dnd.after             = false;\r
+                               this.data.dnd.before    = false;\r
+                               this.data.dnd.inside    = false;\r
+                               $.vakata.dnd.helper.children("ins").attr("class","jstree-invalid");\r
+                               m.hide();\r
+                               if(ml) { ml.hide(); }\r
+                               if(r && r[0] === e.target.parentNode) {\r
+                                       if(this.data.dnd.to1) {\r
+                                               clearTimeout(this.data.dnd.to1);\r
+                                               this.data.dnd.to1 = false;\r
+                                       }\r
+                                       if(this.data.dnd.to2) {\r
+                                               clearTimeout(this.data.dnd.to2);\r
+                                               this.data.dnd.to2 = false;\r
+                                       }\r
+                               }\r
+                       },\r
+                       start_drag : function (obj, e) {\r
+                               o = this._get_node(obj);\r
+                               if(this.data.ui && this.is_selected(o)) { o = this._get_node(null, true); }\r
+                               var dt = o.length > 1 ? this._get_string("multiple_selection") : this.get_text(o),\r
+                                       cnt = this.get_container();\r
+                               if(!this._get_settings().core.html_titles) { dt = dt.replace(/</ig,"&lt;").replace(/>/ig,"&gt;"); }\r
+                               $.vakata.dnd.drag_start(e, { jstree : true, obj : o }, "<ins class='jstree-icon'></ins>" + dt );\r
+                               if(this.data.themes) { \r
+                                       if(m) { m.attr("class", "jstree-" + this.data.themes.theme); }\r
+                                       if(ml) { ml.attr("class", "jstree-" + this.data.themes.theme); }\r
+                                       $.vakata.dnd.helper.attr("class", "jstree-dnd-helper jstree-" + this.data.themes.theme); \r
+                               }\r
+                               this.data.dnd.cof = cnt.offset();\r
+                               this.data.dnd.cw = parseInt(cnt.width(),10);\r
+                               this.data.dnd.ch = parseInt(cnt.height(),10);\r
+                               this.data.dnd.active = true;\r
+                       }\r
+               }\r
+       });\r
+       $(function() {\r
+               var css_string = '' + \r
+                       '#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; ' + \r
+                       ' -moz-border-radius:4px; border-radius:4px; -webkit-border-radius:4px; ' +\r
+                       '} ' + \r
+                       '#vakata-dragged .jstree-ok { background:green; } ' + \r
+                       '#vakata-dragged .jstree-invalid { background:red; } ' + \r
+                       '#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; } ' + \r
+                       '#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; ' + \r
+                       ' 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; ' + \r
+                       ' -moz-border-radius:1px; border-radius:1px; -webkit-border-radius:1px; ' +\r
+                       '}' + \r
+                       '';\r
+               $.vakata.css.add_sheet({ str : css_string, title : "jstree" });\r
+               m = $("<div />").attr({ id : "jstree-marker" }).hide().html("&raquo;")\r
+                       .bind("mouseleave mouseenter", function (e) { \r
+                               m.hide();\r
+                               ml.hide();\r
+                               e.preventDefault(); \r
+                               e.stopImmediatePropagation(); \r
+                               return false; \r
+                       })\r
+                       .appendTo("body");\r
+               ml = $("<div />").attr({ id : "jstree-marker-line" }).hide()\r
+                       .bind("mouseup", function (e) { \r
+                               if(r && r.length) { \r
+                                       r.children("a").trigger(e); \r
+                                       e.preventDefault(); \r
+                                       e.stopImmediatePropagation(); \r
+                                       return false; \r
+                               } \r
+                       })\r
+                       .bind("mouseleave", function (e) { \r
+                               var rt = $(e.relatedTarget);\r
+                               if(rt.is(".jstree") || rt.closest(".jstree").length === 0) {\r
+                                       if(r && r.length) { \r
+                                               r.children("a").trigger(e); \r
+                                               m.hide();\r
+                                               ml.hide();\r
+                                               e.preventDefault(); \r
+                                               e.stopImmediatePropagation(); \r
+                                               return false; \r
+                                       }\r
+                               }\r
+                       })\r
+                       .appendTo("body");\r
+               $(document).bind("drag_start.vakata", function (e, data) {\r
+                       if(data.data.jstree) { m.show(); if(ml) { ml.show(); } }\r
+               });\r
+               $(document).bind("drag_stop.vakata", function (e, data) {\r
+                       if(data.data.jstree) { m.hide(); if(ml) { ml.hide(); } }\r
+               });\r
+       });\r
+})(jQuery);\r
+//*/\r
+\r
+/*\r
+ * jsTree checkbox plugin\r
+ * Inserts checkboxes in front of every node\r
+ * Depends on the ui plugin\r
+ * DOES NOT WORK NICELY WITH MULTITREE DRAG'N'DROP\r
+ */\r
+(function ($) {\r
+       $.jstree.plugin("checkbox", {\r
+               __init : function () {\r
+                       this.data.checkbox.noui = this._get_settings().checkbox.override_ui;\r
+                       if(this.data.ui && this.data.checkbox.noui) {\r
+                               this.select_node = this.deselect_node = this.deselect_all = $.noop;\r
+                               this.get_selected = this.get_checked;\r
+                       }\r
+\r
+                       this.get_container()\r
+                               .bind("open_node.jstree create_node.jstree clean_node.jstree refresh.jstree", $.proxy(function (e, data) { \r
+                                               this._prepare_checkboxes(data.rslt.obj);\r
+                                       }, this))\r
+                               .bind("loaded.jstree", $.proxy(function (e) {\r
+                                               this._prepare_checkboxes();\r
+                                       }, this))\r
+                               .delegate( (this.data.ui && this.data.checkbox.noui ? "a" : "ins.jstree-checkbox") , "click.jstree", $.proxy(function (e) {\r
+                                               e.preventDefault();\r
+                                               if(this._get_node(e.target).hasClass("jstree-checked")) { this.uncheck_node(e.target); }\r
+                                               else { this.check_node(e.target); }\r
+                                               if(this.data.ui && this.data.checkbox.noui) {\r
+                                                       this.save_selected();\r
+                                                       if(this.data.cookies) { this.save_cookie("select_node"); }\r
+                                               }\r
+                                               else {\r
+                                                       e.stopImmediatePropagation();\r
+                                                       return false;\r
+                                               }\r
+                                       }, this));\r
+               },\r
+               defaults : {\r
+                       override_ui : false,\r
+                       two_state : false,\r
+                       real_checkboxes : false,\r
+                       checked_parent_open : true,\r
+                       real_checkboxes_names : function (n) { return [ ("check_" + (n[0].id || Math.ceil(Math.random() * 10000))) , 1]; }\r
+               },\r
+               __destroy : function () {\r
+                       this.get_container()\r
+                               .find("input.jstree-real-checkbox").removeClass("jstree-real-checkbox").end()\r
+                               .find("ins.jstree-checkbox").remove();\r
+               },\r
+               _fn : {\r
+                       _checkbox_notify : function (n, data) {\r
+                               if(data.checked) {\r
+                                       this.check_node(n, false);\r
+                               }\r
+                       },\r
+                       _prepare_checkboxes : function (obj) {\r
+                               obj = !obj || obj == -1 ? this.get_container().find("> ul > li") : this._get_node(obj);\r
+                               if(obj === false) { return; } // added for removing root nodes\r
+                               var c, _this = this, t, ts = this._get_settings().checkbox.two_state, rc = this._get_settings().checkbox.real_checkboxes, rcn = this._get_settings().checkbox.real_checkboxes_names;\r
+                               obj.each(function () {\r
+                                       t = $(this);\r
+                                       c = t.is("li") && (t.hasClass("jstree-checked") || (rc && t.children(":checked").length)) ? "jstree-checked" : "jstree-unchecked";\r
+                                       t.find("li").andSelf().each(function () {\r
+                                               var $t = $(this), nm;\r
+                                               $t.children("a" + (_this.data.languages ? "" : ":eq(0)") ).not(":has(.jstree-checkbox)").prepend("<ins class='jstree-checkbox'>&#160;</ins>").parent().not(".jstree-checked, .jstree-unchecked").addClass( ts ? "jstree-unchecked" : c );\r
+                                               if(rc) {\r
+                                                       if(!$t.children(":checkbox").length) {\r
+                                                               nm = rcn.call(_this, $t);\r
+                                                               $t.prepend("<input type='checkbox' class='jstree-real-checkbox' id='" + nm[0] + "' name='" + nm[0] + "' value='" + nm[1] + "' />");\r
+                                                       }\r
+                                                       else {\r
+                                                               $t.children(":checkbox").addClass("jstree-real-checkbox");\r
+                                                       }\r
+                                                       if(c === "jstree-checked") { \r
+                                                               $t.children(":checkbox").attr("checked","checked"); \r
+                                                       }\r
+                                               }\r
+                                               if(c === "jstree-checked" && !ts) {\r
+                                                       $t.find("li").addClass("jstree-checked");\r
+                                               }\r
+                                       });\r
+                               });\r
+                               if(!ts) {\r
+                                       if(obj.length === 1 && obj.is("li")) { this._repair_state(obj); }\r
+                                       if(obj.is("li")) { obj.each(function () { _this._repair_state(this); }); }\r
+                                       else { obj.find("> ul > li").each(function () { _this._repair_state(this); }); }\r
+                                       obj.find(".jstree-checked").parent().parent().each(function () { _this._repair_state(this); }); \r
+                               }\r
+                       },\r
+                       change_state : function (obj, state) {\r
+                               obj = this._get_node(obj);\r
+                               var coll = false, rc = this._get_settings().checkbox.real_checkboxes;\r
+                               if(!obj || obj === -1) { return false; }\r
+                               state = (state === false || state === true) ? state : obj.hasClass("jstree-checked");\r
+                               if(this._get_settings().checkbox.two_state) {\r
+                                       if(state) { \r
+                                               obj.removeClass("jstree-checked").addClass("jstree-unchecked"); \r
+                                               if(rc) { obj.children(":checkbox").removeAttr("checked"); }\r
+                                       }\r
+                                       else { \r
+                                               obj.removeClass("jstree-unchecked").addClass("jstree-checked"); \r
+                                               if(rc) { obj.children(":checkbox").attr("checked","checked"); }\r
+                                       }\r
+                               }\r
+                               else {\r
+                                       if(state) { \r
+                                               coll = obj.find("li").andSelf();\r
+                                               if(!coll.filter(".jstree-checked, .jstree-undetermined").length) { return false; }\r
+                                               coll.removeClass("jstree-checked jstree-undetermined").addClass("jstree-unchecked"); \r
+                                               if(rc) { coll.children(":checkbox").removeAttr("checked"); }\r
+                                       }\r
+                                       else { \r
+                                               coll = obj.find("li").andSelf();\r
+                                               if(!coll.filter(".jstree-unchecked, .jstree-undetermined").length) { return false; }\r
+                                               coll.removeClass("jstree-unchecked jstree-undetermined").addClass("jstree-checked"); \r
+                                               if(rc) { coll.children(":checkbox").attr("checked","checked"); }\r
+                                               if(this.data.ui) { this.data.ui.last_selected = obj; }\r
+                                               this.data.checkbox.last_selected = obj;\r
+                                       }\r
+                                       obj.parentsUntil(".jstree", "li").each(function () {\r
+                                               var $this = $(this);\r
+                                               if(state) {\r
+                                                       if($this.children("ul").children("li.jstree-checked, li.jstree-undetermined").length) {\r
+                                                               $this.parentsUntil(".jstree", "li").andSelf().removeClass("jstree-checked jstree-unchecked").addClass("jstree-undetermined");\r
+                                                               if(rc) { $this.parentsUntil(".jstree", "li").andSelf().children(":checkbox").removeAttr("checked"); }\r
+                                                               return false;\r
+                                                       }\r
+                                                       else {\r
+                                                               $this.removeClass("jstree-checked jstree-undetermined").addClass("jstree-unchecked");\r
+                                                               if(rc) { $this.children(":checkbox").removeAttr("checked"); }\r
+                                                       }\r
+                                               }\r
+                                               else {\r
+                                                       if($this.children("ul").children("li.jstree-unchecked, li.jstree-undetermined").length) {\r
+                                                               $this.parentsUntil(".jstree", "li").andSelf().removeClass("jstree-checked jstree-unchecked").addClass("jstree-undetermined");\r
+                                                               if(rc) { $this.parentsUntil(".jstree", "li").andSelf().children(":checkbox").removeAttr("checked"); }\r
+                                                               return false;\r
+                                                       }\r
+                                                       else {\r
+                                                               $this.removeClass("jstree-unchecked jstree-undetermined").addClass("jstree-checked");\r
+                                                               if(rc) { $this.children(":checkbox").attr("checked","checked"); }\r
+                                                       }\r
+                                               }\r
+                                       });\r
+                               }\r
+                               if(this.data.ui && this.data.checkbox.noui) { this.data.ui.selected = this.get_checked(); }\r
+                               this.__callback(obj);\r
+                               return true;\r
+                       },\r
+                       check_node : function (obj) {\r
+                               if(this.change_state(obj, false)) { \r
+                                       obj = this._get_node(obj);\r
+                                       if(this._get_settings().checkbox.checked_parent_open) {\r
+                                               var t = this;\r
+                                               obj.parents(".jstree-closed").each(function () { t.open_node(this, false, true); });\r
+                                       }\r
+                                       this.__callback({ "obj" : obj }); \r
+                               }\r
+                       },\r
+                       uncheck_node : function (obj) {\r
+                               if(this.change_state(obj, true)) { this.__callback({ "obj" : this._get_node(obj) }); }\r
+                       },\r
+                       check_all : function () {\r
+                               var _this = this, \r
+                                       coll = this._get_settings().checkbox.two_state ? this.get_container_ul().find("li") : this.get_container_ul().children("li");\r
+                               coll.each(function () {\r
+                                       _this.change_state(this, false);\r
+                               });\r
+                               this.__callback();\r
+                       },\r
+                       uncheck_all : function () {\r
+                               var _this = this,\r
+                                       coll = this._get_settings().checkbox.two_state ? this.get_container_ul().find("li") : this.get_container_ul().children("li");\r
+                               coll.each(function () {\r
+                                       _this.change_state(this, true);\r
+                               });\r
+                               this.__callback();\r
+                       },\r
+\r
+                       is_checked : function(obj) {\r
+                               obj = this._get_node(obj);\r
+                               return obj.length ? obj.is(".jstree-checked") : false;\r
+                       },\r
+                       get_checked : function (obj, get_all) {\r
+                               obj = !obj || obj === -1 ? this.get_container() : this._get_node(obj);\r
+                               return get_all || this._get_settings().checkbox.two_state ? obj.find(".jstree-checked") : obj.find("> ul > .jstree-checked, .jstree-undetermined > ul > .jstree-checked");\r
+                       },\r
+                       get_unchecked : function (obj, get_all) { \r
+                               obj = !obj || obj === -1 ? this.get_container() : this._get_node(obj);\r
+                               return get_all || this._get_settings().checkbox.two_state ? obj.find(".jstree-unchecked") : obj.find("> ul > .jstree-unchecked, .jstree-undetermined > ul > .jstree-unchecked");\r
+                       },\r
+\r
+                       show_checkboxes : function () { this.get_container().children("ul").removeClass("jstree-no-checkboxes"); },\r
+                       hide_checkboxes : function () { this.get_container().children("ul").addClass("jstree-no-checkboxes"); },\r
+\r
+                       _repair_state : function (obj) {\r
+                               obj = this._get_node(obj);\r
+                               if(!obj.length) { return; }\r
+                               var rc = this._get_settings().checkbox.real_checkboxes,\r
+                                       a = obj.find("> ul > .jstree-checked").length,\r
+                                       b = obj.find("> ul > .jstree-undetermined").length,\r
+                                       c = obj.find("> ul > li").length;\r
+                               if(c === 0) { if(obj.hasClass("jstree-undetermined")) { this.change_state(obj, false); } }\r
+                               else if(a === 0 && b === 0) { this.change_state(obj, true); }\r
+                               else if(a === c) { this.change_state(obj, false); }\r
+                               else { \r
+                                       obj.parentsUntil(".jstree","li").andSelf().removeClass("jstree-checked jstree-unchecked").addClass("jstree-undetermined");\r
+                                       if(rc) { obj.parentsUntil(".jstree", "li").andSelf().children(":checkbox").removeAttr("checked"); }\r
+                               }\r
+                       },\r
+                       reselect : function () {\r
+                               if(this.data.ui && this.data.checkbox.noui) { \r
+                                       var _this = this,\r
+                                               s = this.data.ui.to_select;\r
+                                       s = $.map($.makeArray(s), function (n) { return "#" + n.toString().replace(/^#/,"").replace(/\\\//g,"/").replace(/\//g,"\\\/").replace(/\\\./g,".").replace(/\./g,"\\.").replace(/\:/g,"\\:"); });\r
+                                       this.deselect_all();\r
+                                       $.each(s, function (i, val) { _this.check_node(val); });\r
+                                       this.__callback();\r
+                               }\r
+                               else { \r
+                                       this.__call_old(); \r
+                               }\r
+                       },\r
+                       save_loaded : function () {\r
+                               var _this = this;\r
+                               this.data.core.to_load = [];\r
+                               this.get_container_ul().find("li.jstree-closed.jstree-undetermined").each(function () {\r
+                                       if(this.id) { _this.data.core.to_load.push("#" + this.id); }\r
+                               });\r
+                       }\r
+               }\r
+       });\r
+       $(function() {\r
+               var css_string = '.jstree .jstree-real-checkbox { display:none; } ';\r
+               $.vakata.css.add_sheet({ str : css_string, title : "jstree" });\r
+       });\r
+})(jQuery);\r
+//*/\r
+\r
+/* \r
+ * jsTree XML plugin\r
+ * The XML data store. Datastores are build by overriding the `load_node` and `_is_loaded` functions.\r
+ */\r
+(function ($) {\r
+       $.vakata.xslt = function (xml, xsl, callback) {\r
+               var rs = "", xm, xs, processor, support;\r
+               // TODO: IE9 no XSLTProcessor, no document.recalc\r
+               if(document.recalc) {\r
+                       xm = document.createElement('xml');\r
+                       xs = document.createElement('xml');\r
+                       xm.innerHTML = xml;\r
+                       xs.innerHTML = xsl;\r
+                       $("body").append(xm).append(xs);\r
+                       setTimeout( (function (xm, xs, callback) {\r
+                               return function () {\r
+                                       callback.call(null, xm.transformNode(xs.XMLDocument));\r
+                                       setTimeout( (function (xm, xs) { return function () { $(xm).remove(); $(xs).remove(); }; })(xm, xs), 200);\r
+                               };\r
+                       })(xm, xs, callback), 100);\r
+                       return true;\r
+               }\r
+               if(typeof window.DOMParser !== "undefined" && typeof window.XMLHttpRequest !== "undefined" && typeof window.XSLTProcessor === "undefined") {\r
+                       xml = new DOMParser().parseFromString(xml, "text/xml");\r
+                       xsl = new DOMParser().parseFromString(xsl, "text/xml");\r
+                       // alert(xml.transformNode());\r
+                       // callback.call(null, new XMLSerializer().serializeToString(rs));\r
+                       \r
+               }\r
+               if(typeof window.DOMParser !== "undefined" && typeof window.XMLHttpRequest !== "undefined" && typeof window.XSLTProcessor !== "undefined") {\r
+                       processor = new XSLTProcessor();\r
+                       support = $.isFunction(processor.transformDocument) ? (typeof window.XMLSerializer !== "undefined") : true;\r
+                       if(!support) { return false; }\r
+                       xml = new DOMParser().parseFromString(xml, "text/xml");\r
+                       xsl = new DOMParser().parseFromString(xsl, "text/xml");\r
+                       if($.isFunction(processor.transformDocument)) {\r
+                               rs = document.implementation.createDocument("", "", null);\r
+                               processor.transformDocument(xml, xsl, rs, null);\r
+                               callback.call(null, new XMLSerializer().serializeToString(rs));\r
+                               return true;\r
+                       }\r
+                       else {\r
+                               processor.importStylesheet(xsl);\r
+                               rs = processor.transformToFragment(xml, document);\r
+                               callback.call(null, $("<div />").append(rs).html());\r
+                               return true;\r
+                       }\r
+               }\r
+               return false;\r
+       };\r
+       var xsl = {\r
+               'nest' : '<' + '?xml version="1.0" encoding="utf-8" ?>' + \r
+                       '<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" >' + \r
+                       '<xsl:output method="html" encoding="utf-8" omit-xml-declaration="yes" standalone="no" indent="no" media-type="text/html" />' + \r
+                       '<xsl:template match="/">' + \r
+                       '       <xsl:call-template name="nodes">' + \r
+                       '               <xsl:with-param name="node" select="/root" />' + \r
+                       '       </xsl:call-template>' + \r
+                       '</xsl:template>' + \r
+                       '<xsl:template name="nodes">' + \r
+                       '       <xsl:param name="node" />' + \r
+                       '       <ul>' + \r
+                       '       <xsl:for-each select="$node/item">' + \r
+                       '               <xsl:variable name="children" select="count(./item) &gt; 0" />' + \r
+                       '               <li>' + \r
+                       '                       <xsl:attribute name="class">' + \r
+                       '                               <xsl:if test="position() = last()">jstree-last </xsl:if>' + \r
+                       '                               <xsl:choose>' + \r
+                       '                                       <xsl:when test="@state = \'open\'">jstree-open </xsl:when>' + \r
+                       '                                       <xsl:when test="$children or @hasChildren or @state = \'closed\'">jstree-closed </xsl:when>' + \r
+                       '                                       <xsl:otherwise>jstree-leaf </xsl:otherwise>' + \r
+                       '                               </xsl:choose>' + \r
+                       '                               <xsl:value-of select="@class" />' + \r
+                       '                       </xsl:attribute>' + \r
+                       '                       <xsl:for-each select="@*">' + \r
+                       '                               <xsl:if test="name() != \'class\' and name() != \'state\' and name() != \'hasChildren\'">' + \r
+                       '                                       <xsl:attribute name="{name()}"><xsl:value-of select="." /></xsl:attribute>' + \r
+                       '                               </xsl:if>' + \r
+                       '                       </xsl:for-each>' + \r
+                       '       <ins class="jstree-icon"><xsl:text>&#xa0;</xsl:text></ins>' + \r
+                       '                       <xsl:for-each select="content/name">' + \r
+                       '                               <a>' + \r
+                       '                               <xsl:attribute name="href">' + \r
+                       '                                       <xsl:choose>' + \r
+                       '                                       <xsl:when test="@href"><xsl:value-of select="@href" /></xsl:when>' + \r
+                       '                                       <xsl:otherwise>#</xsl:otherwise>' + \r
+                       '                                       </xsl:choose>' + \r
+                       '                               </xsl:attribute>' + \r
+                       '                               <xsl:attribute name="class"><xsl:value-of select="@lang" /> <xsl:value-of select="@class" /></xsl:attribute>' + \r
+                       '                               <xsl:attribute name="style"><xsl:value-of select="@style" /></xsl:attribute>' + \r
+                       '                               <xsl:for-each select="@*">' + \r
+                       '                                       <xsl:if test="name() != \'style\' and name() != \'class\' and name() != \'href\'">' + \r
+                       '                                               <xsl:attribute name="{name()}"><xsl:value-of select="." /></xsl:attribute>' + \r
+                       '                                       </xsl:if>' + \r
+                       '                               </xsl:for-each>' + \r
+                       '                                       <ins>' + \r
+                       '                                               <xsl:attribute name="class">jstree-icon ' + \r
+                       '                                                       <xsl:if test="string-length(attribute::icon) > 0 and not(contains(@icon,\'/\'))"><xsl:value-of select="@icon" /></xsl:if>' + \r
+                       '                                               </xsl:attribute>' + \r
+                       '                                               <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>' + \r
+                       '                                               <xsl:text>&#xa0;</xsl:text>' + \r
+                       '                                       </ins>' + \r
+                       '                                       <xsl:copy-of select="./child::node()" />' + \r
+                       '                               </a>' + \r
+                       '                       </xsl:for-each>' + \r
+                       '                       <xsl:if test="$children or @hasChildren"><xsl:call-template name="nodes"><xsl:with-param name="node" select="current()" /></xsl:call-template></xsl:if>' + \r
+                       '               </li>' + \r
+                       '       </xsl:for-each>' + \r
+                       '       </ul>' + \r
+                       '</xsl:template>' + \r
+                       '</xsl:stylesheet>',\r
+\r
+               'flat' : '<' + '?xml version="1.0" encoding="utf-8" ?>' + \r
+                       '<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" >' + \r
+                       '<xsl:output method="html" encoding="utf-8" omit-xml-declaration="yes" standalone="no" indent="no" media-type="text/xml" />' + \r
+                       '<xsl:template match="/">' + \r
+                       '       <ul>' + \r
+                       '       <xsl:for-each select="//item[not(@parent_id) or @parent_id=0 or not(@parent_id = //item/@id)]">' + /* the last `or` may be removed */\r
+                       '               <xsl:call-template name="nodes">' + \r
+                       '                       <xsl:with-param name="node" select="." />' + \r
+                       '                       <xsl:with-param name="is_last" select="number(position() = last())" />' + \r
+                       '               </xsl:call-template>' + \r
+                       '       </xsl:for-each>' + \r
+                       '       </ul>' + \r
+                       '</xsl:template>' + \r
+                       '<xsl:template name="nodes">' + \r
+                       '       <xsl:param name="node" />' + \r
+                       '       <xsl:param name="is_last" />' + \r
+                       '       <xsl:variable name="children" select="count(//item[@parent_id=$node/attribute::id]) &gt; 0" />' + \r
+                       '       <li>' + \r
+                       '       <xsl:attribute name="class">' + \r
+                       '               <xsl:if test="$is_last = true()">jstree-last </xsl:if>' + \r
+                       '               <xsl:choose>' + \r
+                       '                       <xsl:when test="@state = \'open\'">jstree-open </xsl:when>' + \r
+                       '                       <xsl:when test="$children or @hasChildren or @state = \'closed\'">jstree-closed </xsl:when>' + \r
+                       '                       <xsl:otherwise>jstree-leaf </xsl:otherwise>' + \r
+                       '               </xsl:choose>' + \r
+                       '               <xsl:value-of select="@class" />' + \r
+                       '       </xsl:attribute>' + \r
+                       '       <xsl:for-each select="@*">' + \r
+                       '               <xsl:if test="name() != \'parent_id\' and name() != \'hasChildren\' and name() != \'class\' and name() != \'state\'">' + \r
+                       '               <xsl:attribute name="{name()}"><xsl:value-of select="." /></xsl:attribute>' + \r
+                       '               </xsl:if>' + \r
+                       '       </xsl:for-each>' + \r
+                       '       <ins class="jstree-icon"><xsl:text>&#xa0;</xsl:text></ins>' + \r
+                       '       <xsl:for-each select="content/name">' + \r
+                       '               <a>' + \r
+                       '               <xsl:attribute name="href">' + \r
+                       '                       <xsl:choose>' + \r
+                       '                       <xsl:when test="@href"><xsl:value-of select="@href" /></xsl:when>' + \r
+                       '                       <xsl:otherwise>#</xsl:otherwise>' + \r
+                       '                       </xsl:choose>' + \r
+                       '               </xsl:attribute>' + \r
+                       '               <xsl:attribute name="class"><xsl:value-of select="@lang" /> <xsl:value-of select="@class" /></xsl:attribute>' + \r
+                       '               <xsl:attribute name="style"><xsl:value-of select="@style" /></xsl:attribute>' + \r
+                       '               <xsl:for-each select="@*">' + \r
+                       '                       <xsl:if test="name() != \'style\' and name() != \'class\' and name() != \'href\'">' + \r
+                       '                               <xsl:attribute name="{name()}"><xsl:value-of select="." /></xsl:attribute>' + \r
+                       '                       </xsl:if>' + \r
+                       '               </xsl:for-each>' + \r
+                       '                       <ins>' + \r
+                       '                               <xsl:attribute name="class">jstree-icon ' + \r
+                       '                                       <xsl:if test="string-length(attribute::icon) > 0 and not(contains(@icon,\'/\'))"><xsl:value-of select="@icon" /></xsl:if>' + \r
+                       '                               </xsl:attribute>' + \r
+                       '                               <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>' + \r
+                       '                               <xsl:text>&#xa0;</xsl:text>' + \r
+                       '                       </ins>' + \r
+                       '                       <xsl:copy-of select="./child::node()" />' + \r
+                       '               </a>' + \r
+                       '       </xsl:for-each>' + \r
+                       '       <xsl:if test="$children">' + \r
+                       '               <ul>' + \r
+                       '               <xsl:for-each select="//item[@parent_id=$node/attribute::id]">' + \r
+                       '                       <xsl:call-template name="nodes">' + \r
+                       '                               <xsl:with-param name="node" select="." />' + \r
+                       '                               <xsl:with-param name="is_last" select="number(position() = last())" />' + \r
+                       '                       </xsl:call-template>' + \r
+                       '               </xsl:for-each>' + \r
+                       '               </ul>' + \r
+                       '       </xsl:if>' + \r
+                       '       </li>' + \r
+                       '</xsl:template>' + \r
+                       '</xsl:stylesheet>'\r
+       },\r
+       escape_xml = function(string) {\r
+               return string\r
+                       .toString()\r
+                       .replace(/&/g, '&amp;')\r
+                       .replace(/</g, '&lt;')\r
+                       .replace(/>/g, '&gt;')\r
+                       .replace(/"/g, '&quot;')\r
+                       .replace(/'/g, '&apos;');\r
+       };\r
+       $.jstree.plugin("xml_data", {\r
+               defaults : { \r
+                       data : false,\r
+                       ajax : false,\r
+                       xsl : "flat",\r
+                       clean_node : false,\r
+                       correct_state : true,\r
+                       get_skip_empty : false,\r
+                       get_include_preamble : true\r
+               },\r
+               _fn : {\r
+                       load_node : function (obj, s_call, e_call) { var _this = this; this.load_node_xml(obj, function () { _this.__callback({ "obj" : _this._get_node(obj) }); s_call.call(this); }, e_call); },\r
+                       _is_loaded : function (obj) { \r
+                               var s = this._get_settings().xml_data;\r
+                               obj = this._get_node(obj);\r
+                               return obj == -1 || !obj || (!s.ajax && !$.isFunction(s.data)) || obj.is(".jstree-open, .jstree-leaf") || obj.children("ul").children("li").size() > 0;\r
+                       },\r
+                       load_node_xml : function (obj, s_call, e_call) {\r
+                               var s = this.get_settings().xml_data,\r
+                                       error_func = function () {},\r
+                                       success_func = function () {};\r
+\r
+                               obj = this._get_node(obj);\r
+                               if(obj && obj !== -1) {\r
+                                       if(obj.data("jstree-is-loading")) { return; }\r
+                                       else { obj.data("jstree-is-loading",true); }\r
+                               }\r
+                               switch(!0) {\r
+                                       case (!s.data && !s.ajax): throw "Neither data nor ajax settings supplied.";\r
+                                       case ($.isFunction(s.data)):\r
+                                               s.data.call(this, obj, $.proxy(function (d) {\r
+                                                       this.parse_xml(d, $.proxy(function (d) {\r
+                                                               if(d) {\r
+                                                                       d = d.replace(/ ?xmlns="[^"]*"/ig, "");\r
+                                                                       if(d.length > 10) {\r
+                                                                               d = $(d);\r
+                                                                               if(obj === -1 || !obj) { this.get_container().children("ul").empty().append(d.children()); }\r
+                                                                               else { obj.children("a.jstree-loading").removeClass("jstree-loading"); obj.append(d); obj.removeData("jstree-is-loading"); }\r
+                                                                               if(s.clean_node) { this.clean_node(obj); }\r
+                                                                               if(s_call) { s_call.call(this); }\r
+                                                                       }\r
+                                                                       else {\r
+                                                                               if(obj && obj !== -1) { \r
+                                                                                       obj.children("a.jstree-loading").removeClass("jstree-loading");\r
+                                                                                       obj.removeData("jstree-is-loading");\r
+                                                                                       if(s.correct_state) { \r
+                                                                                               this.correct_state(obj);\r
+                                                                                               if(s_call) { s_call.call(this); } \r
+                                                                                       }\r
+                                                                               }\r
+                                                                               else {\r
+                                                                                       if(s.correct_state) { \r
+                                                                                               this.get_container().children("ul").empty();\r
+                                                                                               if(s_call) { s_call.call(this); } \r
+                                                                                       }\r
+                                                                               }\r
+                                                                       }\r
+                                                               }\r
+                                                       }, this));\r
+                                               }, this));\r
+                                               break;\r
+                                       case (!!s.data && !s.ajax) || (!!s.data && !!s.ajax && (!obj || obj === -1)):\r
+                                               if(!obj || obj == -1) {\r
+                                                       this.parse_xml(s.data, $.proxy(function (d) {\r
+                                                               if(d) {\r
+                                                                       d = d.replace(/ ?xmlns="[^"]*"/ig, "");\r
+                                                                       if(d.length > 10) {\r
+                                                                               d = $(d);\r
+                                                                               this.get_container().children("ul").empty().append(d.children());\r
+                                                                               if(s.clean_node) { this.clean_node(obj); }\r
+                                                                               if(s_call) { s_call.call(this); }\r
+                                                                       }\r
+                                                               }\r
+                                                               else { \r
+                                                                       if(s.correct_state) { \r
+                                                                               this.get_container().children("ul").empty(); \r
+                                                                               if(s_call) { s_call.call(this); }\r
+                                                                       }\r
+                                                               }\r
+                                                       }, this));\r
+                                               }\r
+                                               break;\r
+                                       case (!s.data && !!s.ajax) || (!!s.data && !!s.ajax && obj && obj !== -1):\r
+                                               error_func = function (x, t, e) {\r
+                                                       var ef = this.get_settings().xml_data.ajax.error; \r
+                                                       if(ef) { ef.call(this, x, t, e); }\r
+                                                       if(obj !== -1 && obj.length) {\r
+                                                               obj.children("a.jstree-loading").removeClass("jstree-loading");\r
+                                                               obj.removeData("jstree-is-loading");\r
+                                                               if(t === "success" && s.correct_state) { this.correct_state(obj); }\r
+                                                       }\r
+                                                       else {\r
+                                                               if(t === "success" && s.correct_state) { this.get_container().children("ul").empty(); }\r
+                                                       }\r
+                                                       if(e_call) { e_call.call(this); }\r
+                                               };\r
+                                               success_func = function (d, t, x) {\r
+                                                       d = x.responseText;\r
+                                                       var sf = this.get_settings().xml_data.ajax.success; \r
+                                                       if(sf) { d = sf.call(this,d,t,x) || d; }\r
+                                                       if(d === "" || (d && d.toString && d.toString().replace(/^[\s\n]+$/,"") === "")) {\r
+                                                               return error_func.call(this, x, t, "");\r
+                                                       }\r
+                                                       this.parse_xml(d, $.proxy(function (d) {\r
+                                                               if(d) {\r
+                                                                       d = d.replace(/ ?xmlns="[^"]*"/ig, "");\r
+                                                                       if(d.length > 10) {\r
+                                                                               d = $(d);\r
+                                                                               if(obj === -1 || !obj) { this.get_container().children("ul").empty().append(d.children()); }\r
+                                                                               else { obj.children("a.jstree-loading").removeClass("jstree-loading"); obj.append(d); obj.removeData("jstree-is-loading"); }\r
+                                                                               if(s.clean_node) { this.clean_node(obj); }\r
+                                                                               if(s_call) { s_call.call(this); }\r
+                                                                       }\r
+                                                                       else {\r
+                                                                               if(obj && obj !== -1) { \r
+                                                                                       obj.children("a.jstree-loading").removeClass("jstree-loading");\r
+                                                                                       obj.removeData("jstree-is-loading");\r
+                                                                                       if(s.correct_state) { \r
+                                                                                               this.correct_state(obj);\r
+                                                                                               if(s_call) { s_call.call(this); } \r
+                                                                                       }\r
+                                                                               }\r
+                                                                               else {\r
+                                                                                       if(s.correct_state) { \r
+                                                                                               this.get_container().children("ul").empty();\r
+                                                                                               if(s_call) { s_call.call(this); } \r
+                                                                                       }\r
+                                                                               }\r
+                                                                       }\r
+                                                               }\r
+                                                       }, this));\r
+                                               };\r
+                                               s.ajax.context = this;\r
+                                               s.ajax.error = error_func;\r
+                                               s.ajax.success = success_func;\r
+                                               if(!s.ajax.dataType) { s.ajax.dataType = "xml"; }\r
+                                               if($.isFunction(s.ajax.url)) { s.ajax.url = s.ajax.url.call(this, obj); }\r
+                                               if($.isFunction(s.ajax.data)) { s.ajax.data = s.ajax.data.call(this, obj); }\r
+                                               $.ajax(s.ajax);\r
+                                               break;\r
+                               }\r
+                       },\r
+                       parse_xml : function (xml, callback) {\r
+                               var s = this._get_settings().xml_data;\r
+                               $.vakata.xslt(xml, xsl[s.xsl], callback);\r
+                       },\r
+                       get_xml : function (tp, obj, li_attr, a_attr, is_callback) {\r
+                               var result = "", \r
+                                       s = this._get_settings(), \r
+                                       _this = this,\r
+                                       tmp1, tmp2, li, a, lang;\r
+                               if(!tp) { tp = "flat"; }\r
+                               if(!is_callback) { is_callback = 0; }\r
+                               obj = this._get_node(obj);\r
+                               if(!obj || obj === -1) { obj = this.get_container().find("> ul > li"); }\r
+                               li_attr = $.isArray(li_attr) ? li_attr : [ "id", "class" ];\r
+                               if(!is_callback && this.data.types && $.inArray(s.types.type_attr, li_attr) === -1) { li_attr.push(s.types.type_attr); }\r
+\r
+                               a_attr = $.isArray(a_attr) ? a_attr : [ ];\r
+\r
+                               if(!is_callback) { \r
+                                       if(s.xml_data.get_include_preamble) { \r
+                                               result += '<' + '?xml version="1.0" encoding="UTF-8"?' + '>'; \r
+                                       }\r
+                                       result += "<root>"; \r
+                               }\r
+                               obj.each(function () {\r
+                                       result += "<item";\r
+                                       li = $(this);\r
+                                       $.each(li_attr, function (i, v) { \r
+                                               var t = li.attr(v);\r
+                                               if(!s.xml_data.get_skip_empty || typeof t !== "undefined") {\r
+                                                       result += " " + v + "=\"" + escape_xml((" " + (t || "")).replace(/ jstree[^ ]*/ig,'').replace(/\s+$/ig," ").replace(/^ /,"").replace(/ $/,"")) + "\""; \r
+                                               }\r
+                                       });\r
+                                       if(li.hasClass("jstree-open")) { result += " state=\"open\""; }\r
+                                       if(li.hasClass("jstree-closed")) { result += " state=\"closed\""; }\r
+                                       if(tp === "flat") { result += " parent_id=\"" + escape_xml(is_callback) + "\""; }\r
+                                       result += ">";\r
+                                       result += "<content>";\r
+                                       a = li.children("a");\r
+                                       a.each(function () {\r
+                                               tmp1 = $(this);\r
+                                               lang = false;\r
+                                               result += "<name";\r
+                                               if($.inArray("languages", s.plugins) !== -1) {\r
+                                                       $.each(s.languages, function (k, z) {\r
+                                                               if(tmp1.hasClass(z)) { result += " lang=\"" + escape_xml(z) + "\""; lang = z; return false; }\r
+                                                       });\r
+                                               }\r
+                                               if(a_attr.length) { \r
+                                                       $.each(a_attr, function (k, z) {\r
+                                                               var t = tmp1.attr(z);\r
+                                                               if(!s.xml_data.get_skip_empty || typeof t !== "undefined") {\r
+                                                                       result += " " + z + "=\"" + escape_xml((" " + t || "").replace(/ jstree[^ ]*/ig,'').replace(/\s+$/ig," ").replace(/^ /,"").replace(/ $/,"")) + "\"";\r
+                                                               }\r
+                                                       });\r
+                                               }\r
+                                               if(tmp1.children("ins").get(0).className.replace(/jstree[^ ]*|$/ig,'').replace(/^\s+$/ig,"").length) {\r
+                                                       result += ' icon="' + escape_xml(tmp1.children("ins").get(0).className.replace(/jstree[^ ]*|$/ig,'').replace(/\s+$/ig," ").replace(/^ /,"").replace(/ $/,"")) + '"';\r
+                                               }\r
+                                               if(tmp1.children("ins").get(0).style.backgroundImage.length) {\r
+                                                       result += ' icon="' + escape_xml(tmp1.children("ins").get(0).style.backgroundImage.replace("url(","").replace(")","").replace(/'/ig,"").replace(/"/ig,"")) + '"';\r
+                                               }\r
+                                               result += ">";\r
+                                               result += "<![CDATA[" + _this.get_text(tmp1, lang) + "]]>";\r
+                                               result += "</name>";\r
+                                       });\r
+                                       result += "</content>";\r
+                                       tmp2 = li[0].id || true;\r
+                                       li = li.find("> ul > li");\r
+                                       if(li.length) { tmp2 = _this.get_xml(tp, li, li_attr, a_attr, tmp2); }\r
+                                       else { tmp2 = ""; }\r
+                                       if(tp == "nest") { result += tmp2; }\r
+                                       result += "</item>";\r
+                                       if(tp == "flat") { result += tmp2; }\r
+                               });\r
+                               if(!is_callback) { result += "</root>"; }\r
+                               return result;\r
+                       }\r
+               }\r
+       });\r
+})(jQuery);\r
+//*/\r
+\r
+/*\r
+ * jsTree search plugin\r
+ * Enables both sync and async search on the tree\r
+ * DOES NOT WORK WITH JSON PROGRESSIVE RENDER\r
+ */\r
+(function ($) {\r
+       $.expr[':'].jstree_contains = function(a,i,m){\r
+               return (a.textContent || a.innerText || "").toLowerCase().indexOf(m[3].toLowerCase())>=0;\r
+       };\r
+       $.expr[':'].jstree_title_contains = function(a,i,m) {\r
+               return (a.getAttribute("title") || "").toLowerCase().indexOf(m[3].toLowerCase())>=0;\r
+       };\r
+       $.jstree.plugin("search", {\r
+               __init : function () {\r
+                       this.data.search.str = "";\r
+                       this.data.search.result = $();\r
+                       if(this._get_settings().search.show_only_matches) {\r
+                               this.get_container()\r
+                                       .bind("search.jstree", function (e, data) {\r
+                                               $(this).children("ul").find("li").hide().removeClass("jstree-last");\r
+                                               data.rslt.nodes.parentsUntil(".jstree").andSelf().show()\r
+                                                       .filter("ul").each(function () { $(this).children("li:visible").eq(-1).addClass("jstree-last"); });\r
+                                       })\r
+                                       .bind("clear_search.jstree", function () {\r
+                                               $(this).children("ul").find("li").css("display","").end().end().jstree("clean_node", -1);\r
+                                       });\r
+                       }\r
+               },\r
+               defaults : {\r
+                       ajax : false,\r
+                       search_method : "jstree_contains", // for case insensitive - jstree_contains\r
+                       show_only_matches : false\r
+               },\r
+               _fn : {\r
+                       search : function (str, skip_async) {\r
+                               if($.trim(str) === "") { this.clear_search(); return; }\r
+                               var s = this.get_settings().search, \r
+                                       t = this,\r
+                                       error_func = function () { },\r
+                                       success_func = function () { };\r
+                               this.data.search.str = str;\r
+\r
+                               if(!skip_async && s.ajax !== false && this.get_container_ul().find("li.jstree-closed:not(:has(ul)):eq(0)").length > 0) {\r
+                                       this.search.supress_callback = true;\r
+                                       error_func = function () { };\r
+                                       success_func = function (d, t, x) {\r
+                                               var sf = this.get_settings().search.ajax.success; \r
+                                               if(sf) { d = sf.call(this,d,t,x) || d; }\r
+                                               this.data.search.to_open = d;\r
+                                               this._search_open();\r
+                                       };\r
+                                       s.ajax.context = this;\r
+                                       s.ajax.error = error_func;\r
+                                       s.ajax.success = success_func;\r
+                                       if($.isFunction(s.ajax.url)) { s.ajax.url = s.ajax.url.call(this, str); }\r
+                                       if($.isFunction(s.ajax.data)) { s.ajax.data = s.ajax.data.call(this, str); }\r
+                                       if(!s.ajax.data) { s.ajax.data = { "search_string" : str }; }\r
+                                       if(!s.ajax.dataType || /^json/.exec(s.ajax.dataType)) { s.ajax.dataType = "json"; }\r
+                                       $.ajax(s.ajax);\r
+                                       return;\r
+                               }\r
+                               if(this.data.search.result.length) { this.clear_search(); }\r
+                               this.data.search.result = this.get_container().find("a" + (this.data.languages ? "." + this.get_lang() : "" ) + ":" + (s.search_method) + "(" + this.data.search.str + ")");\r
+                               this.data.search.result.addClass("jstree-search").parent().parents(".jstree-closed").each(function () {\r
+                                       t.open_node(this, false, true);\r
+                               });\r
+                               this.__callback({ nodes : this.data.search.result, str : str });\r
+                       },\r
+                       clear_search : function (str) {\r
+                               this.data.search.result.removeClass("jstree-search");\r
+                               this.__callback(this.data.search.result);\r
+                               this.data.search.result = $();\r
+                       },\r
+                       _search_open : function (is_callback) {\r
+                               var _this = this,\r
+                                       done = true,\r
+                                       current = [],\r
+                                       remaining = [];\r
+                               if(this.data.search.to_open.length) {\r
+                                       $.each(this.data.search.to_open, function (i, val) {\r
+                                               if(val == "#") { return true; }\r
+                                               if($(val).length && $(val).is(".jstree-closed")) { current.push(val); }\r
+                                               else { remaining.push(val); }\r
+                                       });\r
+                                       if(current.length) {\r
+                                               this.data.search.to_open = remaining;\r
+                                               $.each(current, function (i, val) { \r
+                                                       _this.open_node(val, function () { _this._search_open(true); }); \r
+                                               });\r
+                                               done = false;\r
+                                       }\r
+                               }\r
+                               if(done) { this.search(this.data.search.str, true); }\r
+                       }\r
+               }\r
+       });\r
+})(jQuery);\r
+//*/\r
+\r
+/* \r
+ * jsTree contextmenu plugin\r
+ */\r
+(function ($) {\r
+       $.vakata.context = {\r
+               hide_on_mouseleave : false,\r
+\r
+               cnt             : $("<div id='vakata-contextmenu' />"),\r
+               vis             : false,\r
+               tgt             : false,\r
+               par             : false,\r
+               func    : false,\r
+               data    : false,\r
+               rtl             : false,\r
+               show    : function (s, t, x, y, d, p, rtl) {\r
+                       $.vakata.context.rtl = !!rtl;\r
+                       var html = $.vakata.context.parse(s), h, w;\r
+                       if(!html) { return; }\r
+                       $.vakata.context.vis = true;\r
+                       $.vakata.context.tgt = t;\r
+                       $.vakata.context.par = p || t || null;\r
+                       $.vakata.context.data = d || null;\r
+                       $.vakata.context.cnt\r
+                               .html(html)\r
+                               .css({ "visibility" : "hidden", "display" : "block", "left" : 0, "top" : 0 });\r
+\r
+                       if($.vakata.context.hide_on_mouseleave) {\r
+                               $.vakata.context.cnt\r
+                                       .one("mouseleave", function(e) { $.vakata.context.hide(); });\r
+                       }\r
+\r
+                       h = $.vakata.context.cnt.height();\r
+                       w = $.vakata.context.cnt.width();\r
+                       if(x + w > $(document).width()) { \r
+                               x = $(document).width() - (w + 5); \r
+                               $.vakata.context.cnt.find("li > ul").addClass("right"); \r
+                       }\r
+                       if(y + h > $(document).height()) { \r
+                               y = y - (h + t[0].offsetHeight); \r
+                               $.vakata.context.cnt.find("li > ul").addClass("bottom"); \r
+                       }\r
+\r
+                       $.vakata.context.cnt\r
+                               .css({ "left" : x, "top" : y })\r
+                               .find("li:has(ul)")\r
+                                       .bind("mouseenter", function (e) { \r
+                                               var w = $(document).width(),\r
+                                                       h = $(document).height(),\r
+                                                       ul = $(this).children("ul").show(); \r
+                                               if(w !== $(document).width()) { ul.toggleClass("right"); }\r
+                                               if(h !== $(document).height()) { ul.toggleClass("bottom"); }\r
+                                       })\r
+                                       .bind("mouseleave", function (e) { \r
+                                               $(this).children("ul").hide(); \r
+                                       })\r
+                                       .end()\r
+                               .css({ "visibility" : "visible" })\r
+                               .show();\r
+                       $(document).triggerHandler("context_show.vakata");\r
+               },\r
+               hide    : function () {\r
+                       $.vakata.context.vis = false;\r
+                       $.vakata.context.cnt.attr("class","").css({ "visibility" : "hidden" });\r
+                       $(document).triggerHandler("context_hide.vakata");\r
+               },\r
+               parse   : function (s, is_callback) {\r
+                       if(!s) { return false; }\r
+                       var str = "",\r
+                               tmp = false,\r
+                               was_sep = true;\r
+                       if(!is_callback) { $.vakata.context.func = {}; }\r
+                       str += "<ul>";\r
+                       $.each(s, function (i, val) {\r
+                               if(!val) { return true; }\r
+                               $.vakata.context.func[i] = val.action;\r
+                               if(!was_sep && val.separator_before) {\r
+                                       str += "<li class='vakata-separator vakata-separator-before'></li>";\r
+                               }\r
+                               was_sep = false;\r
+                               str += "<li class='" + (val._class || "") + (val._disabled ? " jstree-contextmenu-disabled " : "") + "'><ins ";\r
+                               if(val.icon && val.icon.indexOf("/") === -1) { str += " class='" + val.icon + "' "; }\r
+                               if(val.icon && val.icon.indexOf("/") !== -1) { str += " style='background:url(" + val.icon + ") center center no-repeat;' "; }\r
+                               str += ">&#160;</ins><a href='#' rel='" + i + "'>";\r
+                               if(val.submenu) {\r
+                                       str += "<span style='float:" + ($.vakata.context.rtl ? "left" : "right") + ";'>&raquo;</span>";\r
+                               }\r
+                               str += val.label + "</a>";\r
+                               if(val.submenu) {\r
+                                       tmp = $.vakata.context.parse(val.submenu, true);\r
+                                       if(tmp) { str += tmp; }\r
+                               }\r
+                               str += "</li>";\r
+                               if(val.separator_after) {\r
+                                       str += "<li class='vakata-separator vakata-separator-after'></li>";\r
+                                       was_sep = true;\r
+                               }\r
+                       });\r
+                       str = str.replace(/<li class\='vakata-separator vakata-separator-after'\><\/li\>$/,"");\r
+                       str += "</ul>";\r
+                       $(document).triggerHandler("context_parse.vakata");\r
+                       return str.length > 10 ? str : false;\r
+               },\r
+               exec    : function (i) {\r
+                       if($.isFunction($.vakata.context.func[i])) {\r
+                               // if is string - eval and call it!\r
+                               $.vakata.context.func[i].call($.vakata.context.data, $.vakata.context.par);\r
+                               return true;\r
+                       }\r
+                       else { return false; }\r
+               }\r
+       };\r
+       $(function () {\r
+               var css_string = '' + \r
+                       '#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; } ' + \r
+                       '#vakata-contextmenu ul { min-width:180px; *width:180px; } ' + \r
+                       '#vakata-contextmenu ul, #vakata-contextmenu li { margin:0; padding:0; list-style-type:none; display:block; } ' + \r
+                       '#vakata-contextmenu li { line-height:20px; min-height:20px; position:relative; padding:0px; } ' + \r
+                       '#vakata-contextmenu li a { padding:1px 6px; line-height:17px; display:block; text-decoration:none; margin:1px 1px 0 1px; } ' + \r
+                       '#vakata-contextmenu li ins { float:left; width:16px; height:16px; text-decoration:none; margin-right:2px; } ' + \r
+                       '#vakata-contextmenu li a:hover, #vakata-contextmenu li.vakata-hover > a { background:gray; color:white; } ' + \r
+                       '#vakata-contextmenu li ul { display:none; position:absolute; top:-2px; left:100%; background:#ebebeb; border:1px solid gray; } ' + \r
+                       '#vakata-contextmenu .right { right:100%; left:auto; } ' + \r
+                       '#vakata-contextmenu .bottom { bottom:-1px; top:auto; } ' + \r
+                       '#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; } ';\r
+               $.vakata.css.add_sheet({ str : css_string, title : "vakata" });\r
+               $.vakata.context.cnt\r
+                       .delegate("a","click", function (e) { e.preventDefault(); })\r
+                       .delegate("a","mouseup", function (e) {\r
+                               if(!$(this).parent().hasClass("jstree-contextmenu-disabled") && $.vakata.context.exec($(this).attr("rel"))) {\r
+                                       $.vakata.context.hide();\r
+                               }\r
+                               else { $(this).blur(); }\r
+                       })\r
+                       .delegate("a","mouseover", function () {\r
+                               $.vakata.context.cnt.find(".vakata-hover").removeClass("vakata-hover");\r
+                       })\r
+                       .appendTo("body");\r
+               $(document).bind("mousedown", function (e) { if($.vakata.context.vis && !$.contains($.vakata.context.cnt[0], e.target)) { $.vakata.context.hide(); } });\r
+               if(typeof $.hotkeys !== "undefined") {\r
+                       $(document)\r
+                               .bind("keydown", "up", function (e) { \r
+                                       if($.vakata.context.vis) { \r
+                                               var o = $.vakata.context.cnt.find("ul:visible").last().children(".vakata-hover").removeClass("vakata-hover").prevAll("li:not(.vakata-separator)").first();\r
+                                               if(!o.length) { o = $.vakata.context.cnt.find("ul:visible").last().children("li:not(.vakata-separator)").last(); }\r
+                                               o.addClass("vakata-hover");\r
+                                               e.stopImmediatePropagation(); \r
+                                               e.preventDefault();\r
+                                       } \r
+                               })\r
+                               .bind("keydown", "down", function (e) { \r
+                                       if($.vakata.context.vis) { \r
+                                               var o = $.vakata.context.cnt.find("ul:visible").last().children(".vakata-hover").removeClass("vakata-hover").nextAll("li:not(.vakata-separator)").first();\r
+                                               if(!o.length) { o = $.vakata.context.cnt.find("ul:visible").last().children("li:not(.vakata-separator)").first(); }\r
+                                               o.addClass("vakata-hover");\r
+                                               e.stopImmediatePropagation(); \r
+                                               e.preventDefault();\r
+                                       } \r
+                               })\r
+                               .bind("keydown", "right", function (e) { \r
+                                       if($.vakata.context.vis) { \r
+                                               $.vakata.context.cnt.find(".vakata-hover").children("ul").show().children("li:not(.vakata-separator)").removeClass("vakata-hover").first().addClass("vakata-hover");\r
+                                               e.stopImmediatePropagation(); \r
+                                               e.preventDefault();\r
+                                       } \r
+                               })\r
+                               .bind("keydown", "left", function (e) { \r
+                                       if($.vakata.context.vis) { \r
+                                               $.vakata.context.cnt.find(".vakata-hover").children("ul").hide().children(".vakata-separator").removeClass("vakata-hover");\r
+                                               e.stopImmediatePropagation(); \r
+                                               e.preventDefault();\r
+                                       } \r
+                               })\r
+                               .bind("keydown", "esc", function (e) { \r
+                                       $.vakata.context.hide(); \r
+                                       e.preventDefault();\r
+                               })\r
+                               .bind("keydown", "space", function (e) { \r
+                                       $.vakata.context.cnt.find(".vakata-hover").last().children("a").click();\r
+                                       e.preventDefault();\r
+                               });\r
+               }\r
+       });\r
+\r
+       $.jstree.plugin("contextmenu", {\r
+               __init : function () {\r
+                       this.get_container()\r
+                               .delegate("a", "contextmenu.jstree", $.proxy(function (e) {\r
+                                               e.preventDefault();\r
+                                               if(!$(e.currentTarget).hasClass("jstree-loading")) {\r
+                                                       this.show_contextmenu(e.currentTarget, e.pageX, e.pageY);\r
+                                               }\r
+                                       }, this))\r
+                               .delegate("a", "click.jstree", $.proxy(function (e) {\r
+                                               if(this.data.contextmenu) {\r
+                                                       $.vakata.context.hide();\r
+                                               }\r
+                                       }, this))\r
+                               .bind("destroy.jstree", $.proxy(function () {\r
+                                               // TODO: move this to descruct method\r
+                                               if(this.data.contextmenu) {\r
+                                                       $.vakata.context.hide();\r
+                                               }\r
+                                       }, this));\r
+                       $(document).bind("context_hide.vakata", $.proxy(function () { this.data.contextmenu = false; }, this));\r
+               },\r
+               defaults : { \r
+                       select_node : false, // requires UI plugin\r
+                       show_at_node : true,\r
+                       items : { // Could be a function that should return an object like this one\r
+                               "create" : {\r
+                                       "separator_before"      : false,\r
+                                       "separator_after"       : true,\r
+                                       "label"                         : "Create",\r
+                                       "action"                        : function (obj) { this.create(obj); }\r
+                               },\r
+                               "rename" : {\r
+                                       "separator_before"      : false,\r
+                                       "separator_after"       : false,\r
+                                       "label"                         : "Rename",\r
+                                       "action"                        : function (obj) { this.rename(obj); }\r
+                               },\r
+                               "remove" : {\r
+                                       "separator_before"      : false,\r
+                                       "icon"                          : false,\r
+                                       "separator_after"       : false,\r
+                                       "label"                         : "Delete",\r
+                                       "action"                        : function (obj) { if(this.is_selected(obj)) { this.remove(); } else { this.remove(obj); } }\r
+                               },\r
+                               "ccp" : {\r
+                                       "separator_before"      : true,\r
+                                       "icon"                          : false,\r
+                                       "separator_after"       : false,\r
+                                       "label"                         : "Edit",\r
+                                       "action"                        : false,\r
+                                       "submenu" : { \r
+                                               "cut" : {\r
+                                                       "separator_before"      : false,\r
+                                                       "separator_after"       : false,\r
+                                                       "label"                         : "Cut",\r
+                                                       "action"                        : function (obj) { this.cut(obj); }\r
+                                               },\r
+                                               "copy" : {\r
+                                                       "separator_before"      : false,\r
+                                                       "icon"                          : false,\r
+                                                       "separator_after"       : false,\r
+                                                       "label"                         : "Copy",\r
+                                                       "action"                        : function (obj) { this.copy(obj); }\r
+                                               },\r
+                                               "paste" : {\r
+                                                       "separator_before"      : false,\r
+                                                       "icon"                          : false,\r
+                                                       "separator_after"       : false,\r
+                                                       "label"                         : "Paste",\r
+                                                       "action"                        : function (obj) { this.paste(obj); }\r
+                                               }\r
+                                       }\r
+                               }\r
+                       }\r
+               },\r
+               _fn : {\r
+                       show_contextmenu : function (obj, x, y) {\r
+                               obj = this._get_node(obj);\r
+                               var s = this.get_settings().contextmenu,\r
+                                       a = obj.children("a:visible:eq(0)"),\r
+                                       o = false,\r
+                                       i = false;\r
+                               if(s.select_node && this.data.ui && !this.is_selected(obj)) {\r
+                                       this.deselect_all();\r
+                                       this.select_node(obj, true);\r
+                               }\r
+                               if(s.show_at_node || typeof x === "undefined" || typeof y === "undefined") {\r
+                                       o = a.offset();\r
+                                       x = o.left;\r
+                                       y = o.top + this.data.core.li_height;\r
+                               }\r
+                               i = obj.data("jstree") && obj.data("jstree").contextmenu ? obj.data("jstree").contextmenu : s.items;\r
+                               if($.isFunction(i)) { i = i.call(this, obj); }\r
+                               this.data.contextmenu = true;\r
+                               $.vakata.context.show(i, a, x, y, this, obj, this._get_settings().core.rtl);\r
+                               if(this.data.themes) { $.vakata.context.cnt.attr("class", "jstree-" + this.data.themes.theme + "-context"); }\r
+                       }\r
+               }\r
+       });\r
+})(jQuery);\r
+//*/\r
+\r
+/* \r
+ * jsTree types plugin\r
+ * Adds support types of nodes\r
+ * You can set an attribute on each li node, that represents its type.\r
+ * According to the type setting the node may get custom icon/validation rules\r
+ */\r
+(function ($) {\r
+       $.jstree.plugin("types", {\r
+               __init : function () {\r
+                       var s = this._get_settings().types;\r
+                       this.data.types.attach_to = [];\r
+                       this.get_container()\r
+                               .bind("init.jstree", $.proxy(function () { \r
+                                               var types = s.types, \r
+                                                       attr  = s.type_attr, \r
+                                                       icons_css = "", \r
+                                                       _this = this;\r
+\r
+                                               $.each(types, function (i, tp) {\r
+                                                       $.each(tp, function (k, v) { \r
+                                                               if(!/^(max_depth|max_children|icon|valid_children)$/.test(k)) { _this.data.types.attach_to.push(k); }\r
+                                                       });\r
+                                                       if(!tp.icon) { return true; }\r
+                                                       if( tp.icon.image || tp.icon.position) {\r
+                                                               if(i == "default")      { icons_css += '.jstree-' + _this.get_index() + ' a > .jstree-icon { '; }\r
+                                                               else                            { icons_css += '.jstree-' + _this.get_index() + ' li[' + attr + '="' + i + '"] > a > .jstree-icon { '; }\r
+                                                               if(tp.icon.image)       { icons_css += ' background-image:url(' + tp.icon.image + '); '; }\r
+                                                               if(tp.icon.position){ icons_css += ' background-position:' + tp.icon.position + '; '; }\r
+                                                               else                            { icons_css += ' background-position:0 0; '; }\r
+                                                               icons_css += '} ';\r
+                                                       }\r
+                                               });\r
+                                               if(icons_css !== "") { $.vakata.css.add_sheet({ 'str' : icons_css, title : "jstree-types" }); }\r
+                                       }, this))\r
+                               .bind("before.jstree", $.proxy(function (e, data) { \r
+                                               var s, t, \r
+                                                       o = this._get_settings().types.use_data ? this._get_node(data.args[0]) : false, \r
+                                                       d = o && o !== -1 && o.length ? o.data("jstree") : false;\r
+                                               if(d && d.types && d.types[data.func] === false) { e.stopImmediatePropagation(); return false; }\r
+                                               if($.inArray(data.func, this.data.types.attach_to) !== -1) {\r
+                                                       if(!data.args[0] || (!data.args[0].tagName && !data.args[0].jquery)) { return; }\r
+                                                       s = this._get_settings().types.types;\r
+                                                       t = this._get_type(data.args[0]);\r
+                                                       if(\r
+                                                               ( \r
+                                                                       (s[t] && typeof s[t][data.func] !== "undefined") || \r
+                                                                       (s["default"] && typeof s["default"][data.func] !== "undefined") \r
+                                                               ) && this._check(data.func, data.args[0]) === false\r
+                                                       ) {\r
+                                                               e.stopImmediatePropagation();\r
+                                                               return false;\r
+                                                       }\r
+                                               }\r
+                                       }, this));\r
+                       if(is_ie6) {\r
+                               this.get_container()\r
+                                       .bind("load_node.jstree set_type.jstree", $.proxy(function (e, data) {\r
+                                                       var r = data && data.rslt && data.rslt.obj && data.rslt.obj !== -1 ? this._get_node(data.rslt.obj).parent() : this.get_container_ul(),\r
+                                                               c = false,\r
+                                                               s = this._get_settings().types;\r
+                                                       $.each(s.types, function (i, tp) {\r
+                                                               if(tp.icon && (tp.icon.image || tp.icon.position)) {\r
+                                                                       c = i === "default" ? r.find("li > a > .jstree-icon") : r.find("li[" + s.type_attr + "='" + i + "'] > a > .jstree-icon");\r
+                                                                       if(tp.icon.image) { c.css("backgroundImage","url(" + tp.icon.image + ")"); }\r
+                                                                       c.css("backgroundPosition", tp.icon.position || "0 0");\r
+                                                               }\r
+                                                       });\r
+                                               }, this));\r
+                       }\r
+               },\r
+               defaults : {\r
+                       // defines maximum number of root nodes (-1 means unlimited, -2 means disable max_children checking)\r
+                       max_children            : -1,\r
+                       // defines the maximum depth of the tree (-1 means unlimited, -2 means disable max_depth checking)\r
+                       max_depth                       : -1,\r
+                       // defines valid node types for the root nodes\r
+                       valid_children          : "all",\r
+\r
+                       // whether to use $.data\r
+                       use_data : false, \r
+                       // where is the type stores (the rel attribute of the LI element)\r
+                       type_attr : "rel",\r
+                       // a list of types\r
+                       types : {\r
+                               // the default type\r
+                               "default" : {\r
+                                       "max_children"  : -1,\r
+                                       "max_depth"             : -1,\r
+                                       "valid_children": "all"\r
+\r
+                                       // Bound functions - you can bind any other function here (using boolean or function)\r
+                                       //"select_node" : true\r
+                               }\r
+                       }\r
+               },\r
+               _fn : {\r
+                       _types_notify : function (n, data) {\r
+                               if(data.type && this._get_settings().types.use_data) {\r
+                                       this.set_type(data.type, n);\r
+                               }\r
+                       },\r
+                       _get_type : function (obj) {\r
+                               obj = this._get_node(obj);\r
+                               return (!obj || !obj.length) ? false : obj.attr(this._get_settings().types.type_attr) || "default";\r
+                       },\r
+                       set_type : function (str, obj) {\r
+                               obj = this._get_node(obj);\r
+                               var ret = (!obj.length || !str) ? false : obj.attr(this._get_settings().types.type_attr, str);\r
+                               if(ret) { this.__callback({ obj : obj, type : str}); }\r
+                               return ret;\r
+                       },\r
+                       _check : function (rule, obj, opts) {\r
+                               obj = this._get_node(obj);\r
+                               var v = false, t = this._get_type(obj), d = 0, _this = this, s = this._get_settings().types, data = false;\r
+                               if(obj === -1) { \r
+                                       if(!!s[rule]) { v = s[rule]; }\r
+                                       else { return; }\r
+                               }\r
+                               else {\r
+                                       if(t === false) { return; }\r
+                                       data = s.use_data ? obj.data("jstree") : false;\r
+                                       if(data && data.types && typeof data.types[rule] !== "undefined") { v = data.types[rule]; }\r
+                                       else if(!!s.types[t] && typeof s.types[t][rule] !== "undefined") { v = s.types[t][rule]; }\r
+                                       else if(!!s.types["default"] && typeof s.types["default"][rule] !== "undefined") { v = s.types["default"][rule]; }\r
+                               }\r
+                               if($.isFunction(v)) { v = v.call(this, obj); }\r
+                               if(rule === "max_depth" && obj !== -1 && opts !== false && s.max_depth !== -2 && v !== 0) {\r
+                                       // also include the node itself - otherwise if root node it is not checked\r
+                                       obj.children("a:eq(0)").parentsUntil(".jstree","li").each(function (i) {\r
+                                               // check if current depth already exceeds global tree depth\r
+                                               if(s.max_depth !== -1 && s.max_depth - (i + 1) <= 0) { v = 0; return false; }\r
+                                               d = (i === 0) ? v : _this._check(rule, this, false);\r
+                                               // check if current node max depth is already matched or exceeded\r
+                                               if(d !== -1 && d - (i + 1) <= 0) { v = 0; return false; }\r
+                                               // otherwise - set the max depth to the current value minus current depth\r
+                                               if(d >= 0 && (d - (i + 1) < v || v < 0) ) { v = d - (i + 1); }\r
+                                               // if the global tree depth exists and it minus the nodes calculated so far is less than `v` or `v` is unlimited\r
+                                               if(s.max_depth >= 0 && (s.max_depth - (i + 1) < v || v < 0) ) { v = s.max_depth - (i + 1); }\r
+                                       });\r
+                               }\r
+                               return v;\r
+                       },\r
+                       check_move : function () {\r
+                               if(!this.__call_old()) { return false; }\r
+                               var m  = this._get_move(),\r
+                                       s  = m.rt._get_settings().types,\r
+                                       mc = m.rt._check("max_children", m.cr),\r
+                                       md = m.rt._check("max_depth", m.cr),\r
+                                       vc = m.rt._check("valid_children", m.cr),\r
+                                       ch = 0, d = 1, t;\r
+\r
+                               if(vc === "none") { return false; } \r
+                               if($.isArray(vc) && m.ot && m.ot._get_type) {\r
+                                       m.o.each(function () {\r
+                                               if($.inArray(m.ot._get_type(this), vc) === -1) { d = false; return false; }\r
+                                       });\r
+                                       if(d === false) { return false; }\r
+                               }\r
+                               if(s.max_children !== -2 && mc !== -1) {\r
+                                       ch = m.cr === -1 ? this.get_container().find("> ul > li").not(m.o).length : m.cr.find("> ul > li").not(m.o).length;\r
+                                       if(ch + m.o.length > mc) { return false; }\r
+                               }\r
+                               if(s.max_depth !== -2 && md !== -1) {\r
+                                       d = 0;\r
+                                       if(md === 0) { return false; }\r
+                                       if(typeof m.o.d === "undefined") {\r
+                                               // TODO: deal with progressive rendering and async when checking max_depth (how to know the depth of the moved node)\r
+                                               t = m.o;\r
+                                               while(t.length > 0) {\r
+                                                       t = t.find("> ul > li");\r
+                                                       d ++;\r
+                                               }\r
+                                               m.o.d = d;\r
+                                       }\r
+                                       if(md - m.o.d < 0) { return false; }\r
+                               }\r
+                               return true;\r
+                       },\r
+                       create_node : function (obj, position, js, callback, is_loaded, skip_check) {\r
+                               if(!skip_check && (is_loaded || this._is_loaded(obj))) {\r
+                                       var p  = (typeof position == "string" && position.match(/^before|after$/i) && obj !== -1) ? this._get_parent(obj) : this._get_node(obj),\r
+                                               s  = this._get_settings().types,\r
+                                               mc = this._check("max_children", p),\r
+                                               md = this._check("max_depth", p),\r
+                                               vc = this._check("valid_children", p),\r
+                                               ch;\r
+                                       if(typeof js === "string") { js = { data : js }; }\r
+                                       if(!js) { js = {}; }\r
+                                       if(vc === "none") { return false; } \r
+                                       if($.isArray(vc)) {\r
+                                               if(!js.attr || !js.attr[s.type_attr]) { \r
+                                                       if(!js.attr) { js.attr = {}; }\r
+                                                       js.attr[s.type_attr] = vc[0]; \r
+                                               }\r
+                                               else {\r
+                                                       if($.inArray(js.attr[s.type_attr], vc) === -1) { return false; }\r
+                                               }\r
+                                       }\r
+                                       if(s.max_children !== -2 && mc !== -1) {\r
+                                               ch = p === -1 ? this.get_container().find("> ul > li").length : p.find("> ul > li").length;\r
+                                               if(ch + 1 > mc) { return false; }\r
+                                       }\r
+                                       if(s.max_depth !== -2 && md !== -1 && (md - 1) < 0) { return false; }\r
+                               }\r
+                               return this.__call_old(true, obj, position, js, callback, is_loaded, skip_check);\r
+                       }\r
+               }\r
+       });\r
+})(jQuery);\r
+//*/\r
+\r
+/* \r
+ * jsTree HTML plugin\r
+ * The HTML data store. Datastores are build by replacing the `load_node` and `_is_loaded` functions.\r
+ */\r
+(function ($) {\r
+       $.jstree.plugin("html_data", {\r
+               __init : function () { \r
+                       // this used to use html() and clean the whitespace, but this way any attached data was lost\r
+                       this.data.html_data.original_container_html = this.get_container().find(" > ul > li").clone(true);\r
+                       // remove white space from LI node - otherwise nodes appear a bit to the right\r
+                       this.data.html_data.original_container_html.find("li").andSelf().contents().filter(function() { return this.nodeType == 3; }).remove();\r
+               },\r
+               defaults : { \r
+                       data : false,\r
+                       ajax : false,\r
+                       correct_state : true\r
+               },\r
+               _fn : {\r
+                       load_node : function (obj, s_call, e_call) { var _this = this; this.load_node_html(obj, function () { _this.__callback({ "obj" : _this._get_node(obj) }); s_call.call(this); }, e_call); },\r
+                       _is_loaded : function (obj) { \r
+                               obj = this._get_node(obj); \r
+                               return obj == -1 || !obj || (!this._get_settings().html_data.ajax && !$.isFunction(this._get_settings().html_data.data)) || obj.is(".jstree-open, .jstree-leaf") || obj.children("ul").children("li").size() > 0;\r
+                       },\r
+                       load_node_html : function (obj, s_call, e_call) {\r
+                               var d,\r
+                                       s = this.get_settings().html_data,\r
+                                       error_func = function () {},\r
+                                       success_func = function () {};\r
+                               obj = this._get_node(obj);\r
+                               if(obj && obj !== -1) {\r
+                                       if(obj.data("jstree-is-loading")) { return; }\r
+                                       else { obj.data("jstree-is-loading",true); }\r
+                               }\r
+                               switch(!0) {\r
+                                       case ($.isFunction(s.data)):\r
+                                               s.data.call(this, obj, $.proxy(function (d) {\r
+                                                       if(d && d !== "" && d.toString && d.toString().replace(/^[\s\n]+$/,"") !== "") {\r
+                                                               d = $(d);\r
+                                                               if(!d.is("ul")) { d = $("<ul />").append(d); }\r
+                                                               if(obj == -1 || !obj) { 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"); }\r
+                                                               else { obj.children("a.jstree-loading").removeClass("jstree-loading"); obj.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"); obj.removeData("jstree-is-loading"); }\r
+                                                               this.clean_node(obj);\r
+                                                               if(s_call) { s_call.call(this); }\r
+                                                       }\r
+                                                       else {\r
+                                                               if(obj && obj !== -1) {\r
+                                                                       obj.children("a.jstree-loading").removeClass("jstree-loading");\r
+                                                                       obj.removeData("jstree-is-loading");\r
+                                                                       if(s.correct_state) { \r
+                                                                               this.correct_state(obj);\r
+                                                                               if(s_call) { s_call.call(this); } \r
+                                                                       }\r
+                                                               }\r
+                                                               else {\r
+                                                                       if(s.correct_state) { \r
+                                                                               this.get_container().children("ul").empty();\r
+                                                                               if(s_call) { s_call.call(this); } \r
+                                                                       }\r
+                                                               }\r
+                                                       }\r
+                                               }, this));\r
+                                               break;\r
+                                       case (!s.data && !s.ajax):\r
+                                               if(!obj || obj == -1) {\r
+                                                       this.get_container()\r
+                                                               .children("ul").empty()\r
+                                                               .append(this.data.html_data.original_container_html)\r
+                                                               .find("li, a").filter(function () { return !this.firstChild || !this.firstChild.tagName || this.firstChild.tagName !== "INS"; }).prepend("<ins class='jstree-icon'>&#160;</ins>").end()\r
+                                                               .filter("a").children("ins:first-child").not(".jstree-icon").addClass("jstree-icon");\r
+                                                       this.clean_node();\r
+                                               }\r
+                                               if(s_call) { s_call.call(this); }\r
+                                               break;\r
+                                       case (!!s.data && !s.ajax) || (!!s.data && !!s.ajax && (!obj || obj === -1)):\r
+                                               if(!obj || obj == -1) {\r
+                                                       d = $(s.data);\r
+                                                       if(!d.is("ul")) { d = $("<ul />").append(d); }\r
+                                                       this.get_container()\r
+                                                               .children("ul").empty().append(d.children())\r
+                                                               .find("li, a").filter(function () { return !this.firstChild || !this.firstChild.tagName || this.firstChild.tagName !== "INS"; }).prepend("<ins class='jstree-icon'>&#160;</ins>").end()\r
+                                                               .filter("a").children("ins:first-child").not(".jstree-icon").addClass("jstree-icon");\r
+                                                       this.clean_node();\r
+                                               }\r
+                                               if(s_call) { s_call.call(this); }\r
+                                               break;\r
+                                       case (!s.data && !!s.ajax) || (!!s.data && !!s.ajax && obj && obj !== -1):\r
+                                               obj = this._get_node(obj);\r
+                                               error_func = function (x, t, e) {\r
+                                                       var ef = this.get_settings().html_data.ajax.error; \r
+                                                       if(ef) { ef.call(this, x, t, e); }\r
+                                                       if(obj != -1 && obj.length) {\r
+                                                               obj.children("a.jstree-loading").removeClass("jstree-loading");\r
+                                                               obj.removeData("jstree-is-loading");\r
+                                                               if(t === "success" && s.correct_state) { this.correct_state(obj); }\r
+                                                       }\r
+                                                       else {\r
+                                                               if(t === "success" && s.correct_state) { this.get_container().children("ul").empty(); }\r
+                                                       }\r
+                                                       if(e_call) { e_call.call(this); }\r
+                                               };\r
+                                               success_func = function (d, t, x) {\r
+                                                       var sf = this.get_settings().html_data.ajax.success; \r
+                                                       if(sf) { d = sf.call(this,d,t,x) || d; }\r
+                                                       if(d === "" || (d && d.toString && d.toString().replace(/^[\s\n]+$/,"") === "")) {\r
+                                                               return error_func.call(this, x, t, "");\r
+                                                       }\r
+                                                       if(d) {\r
+                                                               d = $(d);\r
+                                                               if(!d.is("ul")) { d = $("<ul />").append(d); }\r
+                                                               if(obj == -1 || !obj) { 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"); }\r
+                                                               else { obj.children("a.jstree-loading").removeClass("jstree-loading"); obj.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"); obj.removeData("jstree-is-loading"); }\r
+                                                               this.clean_node(obj);\r
+                                                               if(s_call) { s_call.call(this); }\r
+                                                       }\r
+                                                       else {\r
+                                                               if(obj && obj !== -1) {\r
+                                                                       obj.children("a.jstree-loading").removeClass("jstree-loading");\r
+                                                                       obj.removeData("jstree-is-loading");\r
+                                                                       if(s.correct_state) { \r
+                                                                               this.correct_state(obj);\r
+                                                                               if(s_call) { s_call.call(this); } \r
+                                                                       }\r
+                                                               }\r
+                                                               else {\r
+                                                                       if(s.correct_state) { \r
+                                                                               this.get_container().children("ul").empty();\r
+                                                                               if(s_call) { s_call.call(this); } \r
+                                                                       }\r
+                                                               }\r
+                                                       }\r
+                                               };\r
+                                               s.ajax.context = this;\r
+                                               s.ajax.error = error_func;\r
+                                               s.ajax.success = success_func;\r
+                                               if(!s.ajax.dataType) { s.ajax.dataType = "html"; }\r
+                                               if($.isFunction(s.ajax.url)) { s.ajax.url = s.ajax.url.call(this, obj); }\r
+                                               if($.isFunction(s.ajax.data)) { s.ajax.data = s.ajax.data.call(this, obj); }\r
+                                               $.ajax(s.ajax);\r
+                                               break;\r
+                               }\r
+                       }\r
+               }\r
+       });\r
+       // include the HTML data plugin by default\r
+       $.jstree.defaults.plugins.push("html_data");\r
+})(jQuery);\r
+//*/\r
+\r
+/* \r
+ * jsTree themeroller plugin\r
+ * Adds support for jQuery UI themes. Include this at the end of your plugins list, also make sure "themes" is not included.\r
+ */\r
+(function ($) {\r
+       $.jstree.plugin("themeroller", {\r
+               __init : function () {\r
+                       var s = this._get_settings().themeroller;\r
+                       this.get_container()\r
+                               .addClass("ui-widget-content")\r
+                               .addClass("jstree-themeroller")\r
+                               .delegate("a","mouseenter.jstree", function (e) {\r
+                                       if(!$(e.currentTarget).hasClass("jstree-loading")) {\r
+                                               $(this).addClass(s.item_h);\r
+                                       }\r
+                               })\r
+                               .delegate("a","mouseleave.jstree", function () {\r
+                                       $(this).removeClass(s.item_h);\r
+                               })\r
+                               .bind("init.jstree", $.proxy(function (e, data) { \r
+                                               data.inst.get_container().find("> ul > li > .jstree-loading > ins").addClass("ui-icon-refresh");\r
+                                               this._themeroller(data.inst.get_container().find("> ul > li"));\r
+                                       }, this))\r
+                               .bind("open_node.jstree create_node.jstree", $.proxy(function (e, data) { \r
+                                               this._themeroller(data.rslt.obj);\r
+                                       }, this))\r
+                               .bind("loaded.jstree refresh.jstree", $.proxy(function (e) {\r
+                                               this._themeroller();\r
+                                       }, this))\r
+                               .bind("close_node.jstree", $.proxy(function (e, data) {\r
+                                               this._themeroller(data.rslt.obj);\r
+                                       }, this))\r
+                               .bind("delete_node.jstree", $.proxy(function (e, data) {\r
+                                               this._themeroller(data.rslt.parent);\r
+                                       }, this))\r
+                               .bind("correct_state.jstree", $.proxy(function (e, data) {\r
+                                               data.rslt.obj\r
+                                                       .children("ins.jstree-icon").removeClass(s.opened + " " + s.closed + " ui-icon").end()\r
+                                                       .find("> a > ins.ui-icon")\r
+                                                               .filter(function() { \r
+                                                                       return this.className.toString()\r
+                                                                               .replace(s.item_clsd,"").replace(s.item_open,"").replace(s.item_leaf,"")\r
+                                                                               .indexOf("ui-icon-") === -1; \r
+                                                               }).removeClass(s.item_open + " " + s.item_clsd).addClass(s.item_leaf || "jstree-no-icon");\r
+                                       }, this))\r
+                               .bind("select_node.jstree", $.proxy(function (e, data) {\r
+                                               data.rslt.obj.children("a").addClass(s.item_a);\r
+                                       }, this))\r
+                               .bind("deselect_node.jstree deselect_all.jstree", $.proxy(function (e, data) {\r
+                                               this.get_container()\r
+                                                       .find("a." + s.item_a).removeClass(s.item_a).end()\r
+                                                       .find("a.jstree-clicked").addClass(s.item_a);\r
+                                       }, this))\r
+                               .bind("dehover_node.jstree", $.proxy(function (e, data) {\r
+                                               data.rslt.obj.children("a").removeClass(s.item_h);\r
+                                       }, this))\r
+                               .bind("hover_node.jstree", $.proxy(function (e, data) {\r
+                                               this.get_container()\r
+                                                       .find("a." + s.item_h).not(data.rslt.obj).removeClass(s.item_h);\r
+                                               data.rslt.obj.children("a").addClass(s.item_h);\r
+                                       }, this))\r
+                               .bind("move_node.jstree", $.proxy(function (e, data) {\r
+                                               this._themeroller(data.rslt.o);\r
+                                               this._themeroller(data.rslt.op);\r
+                                       }, this));\r
+               },\r
+               __destroy : function () {\r
+                       var s = this._get_settings().themeroller,\r
+                               c = [ "ui-icon" ];\r
+                       $.each(s, function (i, v) {\r
+                               v = v.split(" ");\r
+                               if(v.length) { c = c.concat(v); }\r
+                       });\r
+                       this.get_container()\r
+                               .removeClass("ui-widget-content")\r
+                               .find("." + c.join(", .")).removeClass(c.join(" "));\r
+               },\r
+               _fn : {\r
+                       _themeroller : function (obj) {\r
+                               var s = this._get_settings().themeroller;\r
+                               obj = !obj || obj == -1 ? this.get_container_ul() : this._get_node(obj).parent();\r
+                               obj\r
+                                       .find("li.jstree-closed")\r
+                                               .children("ins.jstree-icon").removeClass(s.opened).addClass("ui-icon " + s.closed).end()\r
+                                               .children("a").addClass(s.item)\r
+                                                       .children("ins.jstree-icon").addClass("ui-icon")\r
+                                                               .filter(function() { \r
+                                                                       return this.className.toString()\r
+                                                                               .replace(s.item_clsd,"").replace(s.item_open,"").replace(s.item_leaf,"")\r
+                                                                               .indexOf("ui-icon-") === -1; \r
+                                                               }).removeClass(s.item_leaf + " " + s.item_open).addClass(s.item_clsd || "jstree-no-icon")\r
+                                                               .end()\r
+                                                       .end()\r
+                                               .end()\r
+                                       .end()\r
+                                       .find("li.jstree-open")\r
+                                               .children("ins.jstree-icon").removeClass(s.closed).addClass("ui-icon " + s.opened).end()\r
+                                               .children("a").addClass(s.item)\r
+                                                       .children("ins.jstree-icon").addClass("ui-icon")\r
+                                                               .filter(function() { \r
+                                                                       return this.className.toString()\r
+                                                                               .replace(s.item_clsd,"").replace(s.item_open,"").replace(s.item_leaf,"")\r
+                                                                               .indexOf("ui-icon-") === -1; \r
+                                                               }).removeClass(s.item_leaf + " " + s.item_clsd).addClass(s.item_open || "jstree-no-icon")\r
+                                                               .end()\r
+                                                       .end()\r
+                                               .end()\r
+                                       .end()\r
+                                       .find("li.jstree-leaf")\r
+                                               .children("ins.jstree-icon").removeClass(s.closed + " ui-icon " + s.opened).end()\r
+                                               .children("a").addClass(s.item)\r
+                                                       .children("ins.jstree-icon").addClass("ui-icon")\r
+                                                               .filter(function() { \r
+                                                                       return this.className.toString()\r
+                                                                               .replace(s.item_clsd,"").replace(s.item_open,"").replace(s.item_leaf,"")\r
+                                                                               .indexOf("ui-icon-") === -1; \r
+                                                               }).removeClass(s.item_clsd + " " + s.item_open).addClass(s.item_leaf || "jstree-no-icon");\r
+                       }\r
+               },\r
+               defaults : {\r
+                       "opened"        : "ui-icon-triangle-1-se",\r
+                       "closed"        : "ui-icon-triangle-1-e",\r
+                       "item"          : "ui-state-default",\r
+                       "item_h"        : "ui-state-hover",\r
+                       "item_a"        : "ui-state-active",\r
+                       "item_open"     : "ui-icon-folder-open",\r
+                       "item_clsd"     : "ui-icon-folder-collapsed",\r
+                       "item_leaf"     : "ui-icon-document"\r
+               }\r
+       });\r
+       $(function() {\r
+               var css_string = '' + \r
+                       '.jstree-themeroller .ui-icon { overflow:visible; } ' + \r
+                       '.jstree-themeroller a { padding:0 2px; } ' + \r
+                       '.jstree-themeroller .jstree-no-icon { display:none; }';\r
+               $.vakata.css.add_sheet({ str : css_string, title : "jstree" });\r
+       });\r
+})(jQuery);\r
+//*/\r
+\r
+/* \r
+ * jsTree unique plugin\r
+ * Forces different names amongst siblings (still a bit experimental)\r
+ * NOTE: does not check language versions (it will not be possible to have nodes with the same title, even in different languages)\r
+ */\r
+(function ($) {\r
+       $.jstree.plugin("unique", {\r
+               __init : function () {\r
+                       this.get_container()\r
+                               .bind("before.jstree", $.proxy(function (e, data) { \r
+                                               var nms = [], res = true, p, t;\r
+                                               if(data.func == "move_node") {\r
+                                                       // obj, ref, position, is_copy, is_prepared, skip_check\r
+                                                       if(data.args[4] === true) {\r
+                                                               if(data.args[0].o && data.args[0].o.length) {\r
+                                                                       data.args[0].o.children("a").each(function () { nms.push($(this).text().replace(/^\s+/g,"")); });\r
+                                                                       res = this._check_unique(nms, data.args[0].np.find("> ul > li").not(data.args[0].o), "move_node");\r
+                                                               }\r
+                                                       }\r
+                                               }\r
+                                               if(data.func == "create_node") {\r
+                                                       // obj, position, js, callback, is_loaded\r
+                                                       if(data.args[4] || this._is_loaded(data.args[0])) {\r
+                                                               p = this._get_node(data.args[0]);\r
+                                                               if(data.args[1] && (data.args[1] === "before" || data.args[1] === "after")) {\r
+                                                                       p = this._get_parent(data.args[0]);\r
+                                                                       if(!p || p === -1) { p = this.get_container(); }\r
+                                                               }\r
+                                                               if(typeof data.args[2] === "string") { nms.push(data.args[2]); }\r
+                                                               else if(!data.args[2] || !data.args[2].data) { nms.push(this._get_string("new_node")); }\r
+                                                               else { nms.push(data.args[2].data); }\r
+                                                               res = this._check_unique(nms, p.find("> ul > li"), "create_node");\r
+                                                       }\r
+                                               }\r
+                                               if(data.func == "rename_node") {\r
+                                                       // obj, val\r
+                                                       nms.push(data.args[1]);\r
+                                                       t = this._get_node(data.args[0]);\r
+                                                       p = this._get_parent(t);\r
+                                                       if(!p || p === -1) { p = this.get_container(); }\r
+                                                       res = this._check_unique(nms, p.find("> ul > li").not(t), "rename_node");\r
+                                               }\r
+                                               if(!res) {\r
+                                                       e.stopPropagation();\r
+                                                       return false;\r
+                                               }\r
+                                       }, this));\r
+               },\r
+               defaults : { \r
+                       error_callback : $.noop\r
+               },\r
+               _fn : { \r
+                       _check_unique : function (nms, p, func) {\r
+                               var cnms = [];\r
+                               p.children("a").each(function () { cnms.push($(this).text().replace(/^\s+/g,"")); });\r
+                               if(!cnms.length || !nms.length) { return true; }\r
+                               cnms = cnms.sort().join(",,").replace(/(,|^)([^,]+)(,,\2)+(,|$)/g,"$1$2$4").replace(/,,+/g,",").replace(/,$/,"").split(",");\r
+                               if((cnms.length + nms.length) != cnms.concat(nms).sort().join(",,").replace(/(,|^)([^,]+)(,,\2)+(,|$)/g,"$1$2$4").replace(/,,+/g,",").replace(/,$/,"").split(",").length) {\r
+                                       this._get_settings().unique.error_callback.call(null, nms, p, func);\r
+                                       return false;\r
+                               }\r
+                               return true;\r
+                       },\r
+                       check_move : function () {\r
+                               if(!this.__call_old()) { return false; }\r
+                               var p = this._get_move(), nms = [];\r
+                               if(p.o && p.o.length) {\r
+                                       p.o.children("a").each(function () { nms.push($(this).text().replace(/^\s+/g,"")); });\r
+                                       return this._check_unique(nms, p.np.find("> ul > li").not(p.o), "check_move");\r
+                               }\r
+                               return true;\r
+                       }\r
+               }\r
+       });\r
+})(jQuery);\r
+//*/\r
+\r
+/*\r
+ * jsTree wholerow plugin\r
+ * Makes select and hover work on the entire width of the node\r
+ * MAY BE HEAVY IN LARGE DOM\r
+ */\r
+(function ($) {\r
+       $.jstree.plugin("wholerow", {\r
+               __init : function () {\r
+                       if(!this.data.ui) { throw "jsTree wholerow: jsTree UI plugin not included."; }\r
+                       this.data.wholerow.html = false;\r
+                       this.data.wholerow.to = false;\r
+                       this.get_container()\r
+                               .bind("init.jstree", $.proxy(function (e, data) { \r
+                                               this._get_settings().core.animation = 0;\r
+                                       }, this))\r
+                               .bind("open_node.jstree create_node.jstree clean_node.jstree loaded.jstree", $.proxy(function (e, data) { \r
+                                               this._prepare_wholerow_span( data && data.rslt && data.rslt.obj ? data.rslt.obj : -1 );\r
+                                       }, this))\r
+                               .bind("search.jstree clear_search.jstree reopen.jstree after_open.jstree after_close.jstree create_node.jstree delete_node.jstree clean_node.jstree", $.proxy(function (e, data) { \r
+                                               if(this.data.to) { clearTimeout(this.data.to); }\r
+                                               this.data.to = setTimeout( (function (t, o) { return function() { t._prepare_wholerow_ul(o); }; })(this,  data && data.rslt && data.rslt.obj ? data.rslt.obj : -1), 0);\r
+                                       }, this))\r
+                               .bind("deselect_all.jstree", $.proxy(function (e, data) { \r
+                                               this.get_container().find(" > .jstree-wholerow .jstree-clicked").removeClass("jstree-clicked " + (this.data.themeroller ? this._get_settings().themeroller.item_a : "" ));\r
+                                       }, this))\r
+                               .bind("select_node.jstree deselect_node.jstree ", $.proxy(function (e, data) { \r
+                                               data.rslt.obj.each(function () { \r
+                                                       var ref = data.inst.get_container().find(" > .jstree-wholerow li:visible:eq(" + ( parseInt((($(this).offset().top - data.inst.get_container().offset().top + data.inst.get_container()[0].scrollTop) / data.inst.data.core.li_height),10)) + ")");\r
+                                                       // ref.children("a")[e.type === "select_node" ? "addClass" : "removeClass"]("jstree-clicked");\r
+                                                       ref.children("a").attr("class",data.rslt.obj.children("a").attr("class"));\r
+                                               });\r
+                                       }, this))\r
+                               .bind("hover_node.jstree dehover_node.jstree", $.proxy(function (e, data) { \r
+                                               this.get_container().find(" > .jstree-wholerow .jstree-hovered").removeClass("jstree-hovered " + (this.data.themeroller ? this._get_settings().themeroller.item_h : "" ));\r
+                                               if(e.type === "hover_node") {\r
+                                                       var ref = this.get_container().find(" > .jstree-wholerow li:visible:eq(" + ( parseInt(((data.rslt.obj.offset().top - this.get_container().offset().top + this.get_container()[0].scrollTop) / this.data.core.li_height),10)) + ")");\r
+                                                       // ref.children("a").addClass("jstree-hovered");\r
+                                                       ref.children("a").attr("class",data.rslt.obj.children(".jstree-hovered").attr("class"));\r
+                                               }\r
+                                       }, this))\r
+                               .delegate(".jstree-wholerow-span, ins.jstree-icon, li", "click.jstree", function (e) {\r
+                                               var n = $(e.currentTarget);\r
+                                               if(e.target.tagName === "A" || (e.target.tagName === "INS" && n.closest("li").is(".jstree-open, .jstree-closed"))) { return; }\r
+                                               n.closest("li").children("a:visible:eq(0)").click();\r
+                                               e.stopImmediatePropagation();\r
+                                       })\r
+                               .delegate("li", "mouseover.jstree", $.proxy(function (e) {\r
+                                               e.stopImmediatePropagation();\r
+                                               if($(e.currentTarget).children(".jstree-hovered, .jstree-clicked").length) { return false; }\r
+                                               this.hover_node(e.currentTarget);\r
+                                               return false;\r
+                                       }, this))\r
+                               .delegate("li", "mouseleave.jstree", $.proxy(function (e) {\r
+                                               if($(e.currentTarget).children("a").hasClass("jstree-hovered").length) { return; }\r
+                                               this.dehover_node(e.currentTarget);\r
+                                       }, this));\r
+                       if(is_ie7 || is_ie6) {\r
+                               $.vakata.css.add_sheet({ str : ".jstree-" + this.get_index() + " { position:relative; } ", title : "jstree" });\r
+                       }\r
+               },\r
+               defaults : {\r
+               },\r
+               __destroy : function () {\r
+                       this.get_container().children(".jstree-wholerow").remove();\r
+                       this.get_container().find(".jstree-wholerow-span").remove();\r
+               },\r
+               _fn : {\r
+                       _prepare_wholerow_span : function (obj) {\r
+                               obj = !obj || obj == -1 ? this.get_container().find("> ul > li") : this._get_node(obj);\r
+                               if(obj === false) { return; } // added for removing root nodes\r
+                               obj.each(function () {\r
+                                       $(this).find("li").andSelf().each(function () {\r
+                                               var $t = $(this);\r
+                                               if($t.children(".jstree-wholerow-span").length) { return true; }\r
+                                               $t.prepend("<span class='jstree-wholerow-span' style='width:" + ($t.parentsUntil(".jstree","li").length * 18) + "px;'>&#160;</span>");\r
+                                       });\r
+                               });\r
+                       },\r
+                       _prepare_wholerow_ul : function () {\r
+                               var o = this.get_container().children("ul").eq(0), h = o.html();\r
+                               o.addClass("jstree-wholerow-real");\r
+                               if(this.data.wholerow.last_html !== h) {\r
+                                       this.data.wholerow.last_html = h;\r
+                                       this.get_container().children(".jstree-wholerow").remove();\r
+                                       this.get_container().append(\r
+                                               o.clone().removeClass("jstree-wholerow-real")\r
+                                                       .wrapAll("<div class='jstree-wholerow' />").parent()\r
+                                                       .width(o.parent()[0].scrollWidth)\r
+                                                       .css("top", (o.height() + ( is_ie7 ? 5 : 0)) * -1 )\r
+                                                       .find("li[id]").each(function () { this.removeAttribute("id"); }).end()\r
+                                       );\r
+                               }\r
+                       }\r
+               }\r
+       });\r
+       $(function() {\r
+               var css_string = '' + \r
+                       '.jstree .jstree-wholerow-real { position:relative; z-index:1; } ' + \r
+                       '.jstree .jstree-wholerow-real li { cursor:pointer; } ' + \r
+                       '.jstree .jstree-wholerow-real a { border-left-color:transparent !important; border-right-color:transparent !important; } ' + \r
+                       '.jstree .jstree-wholerow { position:relative; z-index:0; height:0; } ' + \r
+                       '.jstree .jstree-wholerow ul, .jstree .jstree-wholerow li { width:100%; } ' + \r
+                       '.jstree .jstree-wholerow, .jstree .jstree-wholerow ul, .jstree .jstree-wholerow li, .jstree .jstree-wholerow a { margin:0 !important; padding:0 !important; } ' + \r
+                       '.jstree .jstree-wholerow, .jstree .jstree-wholerow ul, .jstree .jstree-wholerow li { background:transparent !important; }' + \r
+                       '.jstree .jstree-wholerow ins, .jstree .jstree-wholerow span, .jstree .jstree-wholerow input { display:none !important; }' + \r
+                       '.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; } ' + \r
+                       '.jstree .jstree-wholerow-span { position:absolute; left:0; margin:0px; padding:0; height:18px; border-width:0; padding:0; z-index:0; }';\r
+               if(is_ff2) {\r
+                       css_string += '' + \r
+                               '.jstree .jstree-wholerow a { display:block; height:18px; margin:0; padding:0; border:0; } ' + \r
+                               '.jstree .jstree-wholerow-real a { border-color:transparent !important; } ';\r
+               }\r
+               if(is_ie7 || is_ie6) {\r
+                       css_string += '' + \r
+                               '.jstree .jstree-wholerow, .jstree .jstree-wholerow li, .jstree .jstree-wholerow ul, .jstree .jstree-wholerow a { margin:0; padding:0; line-height:18px; } ' + \r
+                               '.jstree .jstree-wholerow a { display:block; height:18px; line-height:18px; overflow:hidden; } ';\r
+               }\r
+               $.vakata.css.add_sheet({ str : css_string, title : "jstree" });\r
+       });\r
+})(jQuery);\r
+//*/\r
+\r
+/*\r
+* jsTree model plugin\r
+* This plugin gets jstree to use a class model to retrieve data, creating great dynamism\r
+*/\r
+(function ($) {\r
+       var nodeInterface = ["getChildren","getChildrenCount","getAttr","getName","getProps"],\r
+               validateInterface = function(obj, inter) {\r
+                       var valid = true;\r
+                       obj = obj || {};\r
+                       inter = [].concat(inter);\r
+                       $.each(inter, function (i, v) {\r
+                               if(!$.isFunction(obj[v])) { valid = false; return false; }\r
+                       });\r
+                       return valid;\r
+               };\r
+       $.jstree.plugin("model", {\r
+               __init : function () {\r
+                       if(!this.data.json_data) { throw "jsTree model: jsTree json_data plugin not included."; }\r
+                       this._get_settings().json_data.data = function (n, b) {\r
+                               var obj = (n == -1) ? this._get_settings().model.object : n.data("jstree_model");\r
+                               if(!validateInterface(obj, nodeInterface)) { return b.call(null, false); }\r
+                               if(this._get_settings().model.async) {\r
+                                       obj.getChildren($.proxy(function (data) {\r
+                                               this.model_done(data, b);\r
+                                       }, this));\r
+                               }\r
+                               else {\r
+                                       this.model_done(obj.getChildren(), b);\r
+                               }\r
+                       };\r
+               },\r
+               defaults : {\r
+                       object : false,\r
+                       id_prefix : false,\r
+                       async : false\r
+               },\r
+               _fn : {\r
+                       model_done : function (data, callback) {\r
+                               var ret = [], \r
+                                       s = this._get_settings(),\r
+                                       _this = this;\r
+\r
+                               if(!$.isArray(data)) { data = [data]; }\r
+                               $.each(data, function (i, nd) {\r
+                                       var r = nd.getProps() || {};\r
+                                       r.attr = nd.getAttr() || {};\r
+                                       if(nd.getChildrenCount()) { r.state = "closed"; }\r
+                                       r.data = nd.getName();\r
+                                       if(!$.isArray(r.data)) { r.data = [r.data]; }\r
+                                       if(_this.data.types && $.isFunction(nd.getType)) {\r
+                                               r.attr[s.types.type_attr] = nd.getType();\r
+                                       }\r
+                                       if(r.attr.id && s.model.id_prefix) { r.attr.id = s.model.id_prefix + r.attr.id; }\r
+                                       if(!r.metadata) { r.metadata = { }; }\r
+                                       r.metadata.jstree_model = nd;\r
+                                       ret.push(r);\r
+                               });\r
+                               callback.call(null, ret);\r
+                       }\r
+               }\r
+       });\r
+})(jQuery);\r
+//*/\r
+\r
+})();
\ No newline at end of file
diff --git a/mod/developers/vendors/jsTree/themes/apple/bg.jpg b/mod/developers/vendors/jsTree/themes/apple/bg.jpg
new file mode 100644 (file)
index 0000000..3aad05d
Binary files /dev/null and b/mod/developers/vendors/jsTree/themes/apple/bg.jpg differ
diff --git a/mod/developers/vendors/jsTree/themes/apple/d.png b/mod/developers/vendors/jsTree/themes/apple/d.png
new file mode 100644 (file)
index 0000000..2463ba6
Binary files /dev/null and b/mod/developers/vendors/jsTree/themes/apple/d.png differ
diff --git a/mod/developers/vendors/jsTree/themes/apple/dot_for_ie.gif b/mod/developers/vendors/jsTree/themes/apple/dot_for_ie.gif
new file mode 100644 (file)
index 0000000..c0cc5fd
Binary files /dev/null and b/mod/developers/vendors/jsTree/themes/apple/dot_for_ie.gif differ
diff --git a/mod/developers/vendors/jsTree/themes/apple/style.css b/mod/developers/vendors/jsTree/themes/apple/style.css
new file mode 100644 (file)
index 0000000..db7a143
--- /dev/null
@@ -0,0 +1,61 @@
+/*\r
+ * jsTree apple theme 1.0\r
+ * Supported features: dots/no-dots, icons/no-icons, focused, loading\r
+ * Supported plugins: ui (hovered, clicked), checkbox, contextmenu, search\r
+ */\r
+\r
+.jstree-apple > ul { background:url("bg.jpg") left top repeat; }\r
+.jstree-apple li, \r
+.jstree-apple ins { background-image:url("d.png"); background-repeat:no-repeat; background-color:transparent; }\r
+.jstree-apple li { background-position:-90px 0; background-repeat:repeat-y;  }\r
+.jstree-apple li.jstree-last { background:transparent; }\r
+.jstree-apple .jstree-open > ins { background-position:-72px 0; }\r
+.jstree-apple .jstree-closed > ins { background-position:-54px 0; }\r
+.jstree-apple .jstree-leaf > ins { background-position:-36px 0; }\r
+\r
+.jstree-apple a { border-radius:4px; -moz-border-radius:4px; -webkit-border-radius:4px; text-shadow:1px 1px 1px white; }\r
+.jstree-apple .jstree-hovered { background:#e7f4f9; border:1px solid #d8f0fa; padding:0 3px 0 1px; text-shadow:1px 1px 1px silver; }\r
+.jstree-apple .jstree-clicked { background:#beebff; border:1px solid #99defd; padding:0 3px 0 1px; }\r
+.jstree-apple a .jstree-icon { background-position:-56px -20px; }\r
+.jstree-apple a.jstree-loading .jstree-icon { background:url("throbber.gif") center center no-repeat !important; }\r
+\r
+.jstree-apple.jstree-focused { background:white; }\r
+\r
+.jstree-apple .jstree-no-dots li, \r
+.jstree-apple .jstree-no-dots .jstree-leaf > ins { background:transparent; }\r
+.jstree-apple .jstree-no-dots .jstree-open > ins { background-position:-18px 0; }\r
+.jstree-apple .jstree-no-dots .jstree-closed > ins { background-position:0 0; }\r
+\r
+.jstree-apple .jstree-no-icons a .jstree-icon { display:none; }\r
+\r
+.jstree-apple .jstree-search { font-style:italic; }\r
+\r
+.jstree-apple .jstree-no-icons .jstree-checkbox { display:inline-block; }\r
+.jstree-apple .jstree-no-checkboxes .jstree-checkbox { display:none !important; }\r
+.jstree-apple .jstree-checked > a > .jstree-checkbox { background-position:-38px -19px; }\r
+.jstree-apple .jstree-unchecked > a > .jstree-checkbox { background-position:-2px -19px; }\r
+.jstree-apple .jstree-undetermined > a > .jstree-checkbox { background-position:-20px -19px; }\r
+.jstree-apple .jstree-checked > a > .checkbox:hover { background-position:-38px -37px; }\r
+.jstree-apple .jstree-unchecked > a > .jstree-checkbox:hover { background-position:-2px -37px; }\r
+.jstree-apple .jstree-undetermined > a > .jstree-checkbox:hover { background-position:-20px -37px; }\r
+\r
+#vakata-dragged.jstree-apple ins { background:transparent !important; }\r
+#vakata-dragged.jstree-apple .jstree-ok { background:url("d.png") -2px -53px no-repeat !important; }\r
+#vakata-dragged.jstree-apple .jstree-invalid { background:url("d.png") -18px -53px no-repeat !important; }\r
+#jstree-marker.jstree-apple { background:url("d.png") -41px -57px no-repeat !important; text-indent:-100px; }\r
+\r
+.jstree-apple a.jstree-search { color:aqua; }\r
+.jstree-apple .jstree-locked a { color:silver; cursor:default; }\r
+\r
+#vakata-contextmenu.jstree-apple-context, \r
+#vakata-contextmenu.jstree-apple-context li ul { background:#f0f0f0; border:1px solid #979797; -moz-box-shadow: 1px 1px 2px #999; -webkit-box-shadow: 1px 1px 2px #999; box-shadow: 1px 1px 2px #999; }\r
+#vakata-contextmenu.jstree-apple-context li { }\r
+#vakata-contextmenu.jstree-apple-context a { color:black; }\r
+#vakata-contextmenu.jstree-apple-context a:hover, \r
+#vakata-contextmenu.jstree-apple-context .vakata-hover > a { padding:0 5px; background:#e8eff7; border:1px solid #aecff7; color:black; -moz-border-radius:2px; -webkit-border-radius:2px; border-radius:2px; }\r
+#vakata-contextmenu.jstree-apple-context li.jstree-contextmenu-disabled a, \r
+#vakata-contextmenu.jstree-apple-context li.jstree-contextmenu-disabled a:hover { color:silver; background:transparent; border:0; padding:1px 4px; }\r
+#vakata-contextmenu.jstree-apple-context li.vakata-separator { background:white; border-top:1px solid #e0e0e0; margin:0; }\r
+#vakata-contextmenu.jstree-apple-context li ul { margin-left:-4px; }\r
+\r
+/* TODO: IE6 support - the `>` selectors */
\ No newline at end of file
diff --git a/mod/developers/vendors/jsTree/themes/apple/throbber.gif b/mod/developers/vendors/jsTree/themes/apple/throbber.gif
new file mode 100644 (file)
index 0000000..5b33f7e
Binary files /dev/null and b/mod/developers/vendors/jsTree/themes/apple/throbber.gif differ
diff --git a/mod/developers/vendors/jsTree/themes/classic/d.gif b/mod/developers/vendors/jsTree/themes/classic/d.gif
new file mode 100644 (file)
index 0000000..6eb0004
Binary files /dev/null and b/mod/developers/vendors/jsTree/themes/classic/d.gif differ
diff --git a/mod/developers/vendors/jsTree/themes/classic/d.png b/mod/developers/vendors/jsTree/themes/classic/d.png
new file mode 100644 (file)
index 0000000..275daec
Binary files /dev/null and b/mod/developers/vendors/jsTree/themes/classic/d.png differ
diff --git a/mod/developers/vendors/jsTree/themes/classic/dot_for_ie.gif b/mod/developers/vendors/jsTree/themes/classic/dot_for_ie.gif
new file mode 100644 (file)
index 0000000..c0cc5fd
Binary files /dev/null and b/mod/developers/vendors/jsTree/themes/classic/dot_for_ie.gif differ
diff --git a/mod/developers/vendors/jsTree/themes/classic/style.css b/mod/developers/vendors/jsTree/themes/classic/style.css
new file mode 100644 (file)
index 0000000..492856d
--- /dev/null
@@ -0,0 +1,77 @@
+/*\r
+ * jsTree classic theme 1.0\r
+ * Supported features: dots/no-dots, icons/no-icons, focused, loading\r
+ * Supported plugins: ui (hovered, clicked), checkbox, contextmenu, search\r
+ */\r
+\r
+.jstree-classic li, \r
+.jstree-classic ins { background-image:url("d.png"); background-repeat:no-repeat; background-color:transparent; }\r
+.jstree-classic li { background-position:-90px 0; background-repeat:repeat-y;  }\r
+.jstree-classic li.jstree-last { background:transparent; }\r
+.jstree-classic .jstree-open > ins { background-position:-72px 0; }\r
+.jstree-classic .jstree-closed > ins { background-position:-54px 0; }\r
+.jstree-classic .jstree-leaf > ins { background-position:-36px 0; }\r
+\r
+.jstree-classic .jstree-hovered { background:#e7f4f9; border:1px solid #e7f4f9; padding:0 2px 0 1px; }\r
+.jstree-classic .jstree-clicked { background:navy; border:1px solid navy; padding:0 2px 0 1px; color:white; }\r
+.jstree-classic a .jstree-icon { background-position:-56px -19px; }\r
+.jstree-classic .jstree-open > a .jstree-icon { background-position:-56px -36px; }\r
+.jstree-classic a.jstree-loading .jstree-icon { background:url("throbber.gif") center center no-repeat !important; }\r
+\r
+.jstree-classic.jstree-focused { background:white; }\r
+\r
+.jstree-classic .jstree-no-dots li, \r
+.jstree-classic .jstree-no-dots .jstree-leaf > ins { background:transparent; }\r
+.jstree-classic .jstree-no-dots .jstree-open > ins { background-position:-18px 0; }\r
+.jstree-classic .jstree-no-dots .jstree-closed > ins { background-position:0 0; }\r
+\r
+.jstree-classic .jstree-no-icons a .jstree-icon { display:none; }\r
+\r
+.jstree-classic .jstree-search { font-style:italic; }\r
+\r
+.jstree-classic .jstree-no-icons .jstree-checkbox { display:inline-block; }\r
+.jstree-classic .jstree-no-checkboxes .jstree-checkbox { display:none !important; }\r
+.jstree-classic .jstree-checked > a > .jstree-checkbox { background-position:-38px -19px; }\r
+.jstree-classic .jstree-unchecked > a > .jstree-checkbox { background-position:-2px -19px; }\r
+.jstree-classic .jstree-undetermined > a > .jstree-checkbox { background-position:-20px -19px; }\r
+.jstree-classic .jstree-checked > a > .jstree-checkbox:hover { background-position:-38px -37px; }\r
+.jstree-classic .jstree-unchecked > a > .jstree-checkbox:hover { background-position:-2px -37px; }\r
+.jstree-classic .jstree-undetermined > a > .jstree-checkbox:hover { background-position:-20px -37px; }\r
+\r
+#vakata-dragged.jstree-classic ins { background:transparent !important; }\r
+#vakata-dragged.jstree-classic .jstree-ok { background:url("d.png") -2px -53px no-repeat !important; }\r
+#vakata-dragged.jstree-classic .jstree-invalid { background:url("d.png") -18px -53px no-repeat !important; }\r
+#jstree-marker.jstree-classic { background:url("d.png") -41px -57px no-repeat !important; text-indent:-100px; }\r
+\r
+.jstree-classic a.jstree-search { color:aqua; }\r
+.jstree-classic .jstree-locked a { color:silver; cursor:default; }\r
+\r
+#vakata-contextmenu.jstree-classic-context, \r
+#vakata-contextmenu.jstree-classic-context li ul { background:#f0f0f0; border:1px solid #979797; -moz-box-shadow: 1px 1px 2px #999; -webkit-box-shadow: 1px 1px 2px #999; box-shadow: 1px 1px 2px #999; }\r
+#vakata-contextmenu.jstree-classic-context li { }\r
+#vakata-contextmenu.jstree-classic-context a { color:black; }\r
+#vakata-contextmenu.jstree-classic-context a:hover, \r
+#vakata-contextmenu.jstree-classic-context .vakata-hover > a { padding:0 5px; background:#e8eff7; border:1px solid #aecff7; color:black; -moz-border-radius:2px; -webkit-border-radius:2px; border-radius:2px; }\r
+#vakata-contextmenu.jstree-classic-context li.jstree-contextmenu-disabled a, \r
+#vakata-contextmenu.jstree-classic-context li.jstree-contextmenu-disabled a:hover { color:silver; background:transparent; border:0; padding:1px 4px; }\r
+#vakata-contextmenu.jstree-classic-context li.vakata-separator { background:white; border-top:1px solid #e0e0e0; margin:0; }\r
+#vakata-contextmenu.jstree-classic-context li ul { margin-left:-4px; }\r
+\r
+/* IE6 BEGIN */\r
+.jstree-classic li, \r
+.jstree-classic ins,\r
+#vakata-dragged.jstree-classic .jstree-invalid, \r
+#vakata-dragged.jstree-classic .jstree-ok, \r
+#jstree-marker.jstree-classic { _background-image:url("d.gif"); }\r
+.jstree-classic .jstree-open ins { _background-position:-72px 0; }\r
+.jstree-classic .jstree-closed ins { _background-position:-54px 0; }\r
+.jstree-classic .jstree-leaf ins { _background-position:-36px 0; }\r
+.jstree-classic .jstree-open a ins.jstree-icon { _background-position:-56px -36px; }\r
+.jstree-classic .jstree-closed a ins.jstree-icon { _background-position:-56px -19px; }\r
+.jstree-classic .jstree-leaf a ins.jstree-icon { _background-position:-56px -19px; }\r
+#vakata-contextmenu.jstree-classic-context ins { _display:none; }\r
+#vakata-contextmenu.jstree-classic-context li { _zoom:1; }\r
+.jstree-classic .jstree-undetermined a .jstree-checkbox { _background-position:-20px -19px; }\r
+.jstree-classic .jstree-checked a .jstree-checkbox { _background-position:-38px -19px; }\r
+.jstree-classic .jstree-unchecked a .jstree-checkbox { _background-position:-2px -19px; }\r
+/* IE6 END */
\ No newline at end of file
diff --git a/mod/developers/vendors/jsTree/themes/classic/throbber.gif b/mod/developers/vendors/jsTree/themes/classic/throbber.gif
new file mode 100644 (file)
index 0000000..5b33f7e
Binary files /dev/null and b/mod/developers/vendors/jsTree/themes/classic/throbber.gif differ
diff --git a/mod/developers/vendors/jsTree/themes/default-rtl/d.gif b/mod/developers/vendors/jsTree/themes/default-rtl/d.gif
new file mode 100644 (file)
index 0000000..d85aba0
Binary files /dev/null and b/mod/developers/vendors/jsTree/themes/default-rtl/d.gif differ
diff --git a/mod/developers/vendors/jsTree/themes/default-rtl/d.png b/mod/developers/vendors/jsTree/themes/default-rtl/d.png
new file mode 100644 (file)
index 0000000..5179cf6
Binary files /dev/null and b/mod/developers/vendors/jsTree/themes/default-rtl/d.png differ
diff --git a/mod/developers/vendors/jsTree/themes/default-rtl/dots.gif b/mod/developers/vendors/jsTree/themes/default-rtl/dots.gif
new file mode 100644 (file)
index 0000000..0043364
Binary files /dev/null and b/mod/developers/vendors/jsTree/themes/default-rtl/dots.gif differ
diff --git a/mod/developers/vendors/jsTree/themes/default-rtl/style.css b/mod/developers/vendors/jsTree/themes/default-rtl/style.css
new file mode 100644 (file)
index 0000000..d51aef6
--- /dev/null
@@ -0,0 +1,84 @@
+/*\r
+ * jsTree default-rtl theme 1.0\r
+ * Supported features: dots/no-dots, icons/no-icons, focused, loading\r
+ * Supported plugins: ui (hovered, clicked), checkbox, contextmenu, search\r
+ */\r
+\r
+.jstree-default-rtl li, \r
+.jstree-default-rtl ins { background-image:url("d.png"); background-repeat:no-repeat; background-color:transparent; }\r
+.jstree-default-rtl li { background-position:-90px 0; background-repeat:repeat-y; }\r
+.jstree-default-rtl li.jstree-last { background:transparent; }\r
+.jstree-default-rtl .jstree-open > ins { background-position:-72px 0; }\r
+.jstree-default-rtl .jstree-closed > ins { background-position:-54px 0; }\r
+.jstree-default-rtl .jstree-leaf > ins { background-position:-36px 0; }\r
+\r
+.jstree-default-rtl .jstree-hovered { background:#e7f4f9; border:1px solid #d8f0fa; padding:0 2px 0 1px; }\r
+.jstree-default-rtl .jstree-clicked { background:#beebff; border:1px solid #99defd; padding:0 2px 0 1px; }\r
+.jstree-default-rtl a .jstree-icon { background-position:-56px -19px; }\r
+.jstree-default-rtl a.jstree-loading .jstree-icon { background:url("throbber.gif") center center no-repeat !important; }\r
+\r
+.jstree-default-rtl.jstree-focused { background:#ffffee; }\r
+\r
+.jstree-default-rtl .jstree-no-dots li, \r
+.jstree-default-rtl .jstree-no-dots .jstree-leaf > ins { background:transparent; }\r
+.jstree-default-rtl .jstree-no-dots .jstree-open > ins { background-position:-18px 0; }\r
+.jstree-default-rtl .jstree-no-dots .jstree-closed > ins { background-position:0 0; }\r
+\r
+.jstree-default-rtl .jstree-no-icons a .jstree-icon { display:none; }\r
+\r
+.jstree-default-rtl .jstree-search { font-style:italic; }\r
+\r
+.jstree-default-rtl .jstree-no-icons .jstree-checkbox { display:inline-block; }\r
+.jstree-default-rtl .jstree-no-checkboxes .jstree-checkbox { display:none !important; }\r
+.jstree-default-rtl .jstree-checked > a > .jstree-checkbox { background-position:-38px -19px; }\r
+.jstree-default-rtl .jstree-unchecked > a > .jstree-checkbox { background-position:-2px -19px; }\r
+.jstree-default-rtl .jstree-undetermined > a > .jstree-checkbox { background-position:-20px -19px; }\r
+.jstree-default-rtl .jstree-checked > a > .jstree-checkbox:hover { background-position:-38px -37px; }\r
+.jstree-default-rtl .jstree-unchecked > a > .jstree-checkbox:hover { background-position:-2px -37px; }\r
+.jstree-default-rtl .jstree-undetermined > a > .jstree-checkbox:hover { background-position:-20px -37px; }\r
+\r
+#vakata-dragged.jstree-default-rtl ins { background:transparent !important; }\r
+#vakata-dragged.jstree-default-rtl .jstree-ok { background:url("d.png") -2px -53px no-repeat !important; }\r
+#vakata-dragged.jstree-default-rtl .jstree-invalid { background:url("d.png") -18px -53px no-repeat !important; }\r
+#jstree-marker.jstree-default-rtl { background:url("d.png") -41px -57px no-repeat !important; text-indent:-100px; }\r
+\r
+.jstree-default-rtl a.jstree-search { color:aqua; }\r
+.jstree-default-rtl .jstree-locked a { color:silver; cursor:default; }\r
+\r
+#vakata-contextmenu.jstree-default-rtl-context, \r
+#vakata-contextmenu.jstree-default-rtl-context li ul { background:#f0f0f0; border:1px solid #979797; -moz-box-shadow: 1px 1px 2px #999; -webkit-box-shadow: 1px 1px 2px #999; box-shadow: 1px 1px 2px #999; }\r
+#vakata-contextmenu.jstree-default-rtl-context li { }\r
+#vakata-contextmenu.jstree-default-rtl-context a { color:black; }\r
+#vakata-contextmenu.jstree-default-rtl-context a:hover, \r
+#vakata-contextmenu.jstree-default-rtl-context .vakata-hover > a { padding:0 5px; background:#e8eff7; border:1px solid #aecff7; color:black; -moz-border-radius:2px; -webkit-border-radius:2px; border-radius:2px; }\r
+#vakata-contextmenu.jstree-default-rtl-context li.jstree-contextmenu-disabled a, \r
+#vakata-contextmenu.jstree-default-rtl-context li.jstree-contextmenu-disabled a:hover { color:silver; background:transparent; border:0; padding:1px 4px; }\r
+#vakata-contextmenu.jstree-default-rtl-context li.vakata-separator { background:white; border-top:1px solid #e0e0e0; margin:0; }\r
+#vakata-contextmenu.jstree-default-rtl-context li ul { margin-left:-4px; }\r
+\r
+/* IE6 BEGIN */\r
+.jstree-default-rtl li, \r
+.jstree-default-rtl ins,\r
+#vakata-dragged.jstree-default-rtl .jstree-invalid, \r
+#vakata-dragged.jstree-default-rtl .jstree-ok, \r
+#jstree-marker.jstree-default-rtl { _background-image:url("d.gif"); }\r
+.jstree-default-rtl .jstree-open ins { _background-position:-72px 0; }\r
+.jstree-default-rtl .jstree-closed ins { _background-position:-54px 0; }\r
+.jstree-default-rtl .jstree-leaf ins { _background-position:-36px 0; }\r
+.jstree-default-rtl a ins.jstree-icon { _background-position:-56px -19px; }\r
+#vakata-contextmenu.jstree-default-rtl-context ins { _display:none; }\r
+#vakata-contextmenu.jstree-default-rtl-context li { _zoom:1; }\r
+.jstree-default-rtl .jstree-undetermined a .jstree-checkbox { _background-position:-18px -19px; }\r
+.jstree-default-rtl .jstree-checked a .jstree-checkbox { _background-position:-36px -19px; }\r
+.jstree-default-rtl .jstree-unchecked a .jstree-checkbox { _background-position:0px -19px; }\r
+/* IE6 END */\r
+\r
+/* RTL part */\r
+.jstree-default-rtl .jstree-hovered, .jstree-default-rtl .jstree-clicked { padding:0 1px 0 2px; }\r
+.jstree-default-rtl li { background-image:url("dots.gif"); background-position: 100% 0px; }\r
+.jstree-default-rtl .jstree-checked > a > .jstree-checkbox { background-position:-36px -19px; margin-left:2px; }\r
+.jstree-default-rtl .jstree-unchecked > a > .jstree-checkbox { background-position:0px -19px; margin-left:2px; }\r
+.jstree-default-rtl .jstree-undetermined > a > .jstree-checkbox { background-position:-18px -19px; margin-left:2px; }\r
+.jstree-default-rtl .jstree-checked > a > .jstree-checkbox:hover { background-position:-36px -37px; }\r
+.jstree-default-rtl .jstree-unchecked > a > .jstree-checkbox:hover { background-position:0px -37px; }\r
+.jstree-default-rtl .jstree-undetermined > a > .jstree-checkbox:hover { background-position:-18px -37px; }
\ No newline at end of file
diff --git a/mod/developers/vendors/jsTree/themes/default-rtl/throbber.gif b/mod/developers/vendors/jsTree/themes/default-rtl/throbber.gif
new file mode 100644 (file)
index 0000000..5b33f7e
Binary files /dev/null and b/mod/developers/vendors/jsTree/themes/default-rtl/throbber.gif differ
diff --git a/mod/developers/vendors/jsTree/themes/default/d.gif b/mod/developers/vendors/jsTree/themes/default/d.gif
new file mode 100644 (file)
index 0000000..0e958d3
Binary files /dev/null and b/mod/developers/vendors/jsTree/themes/default/d.gif differ
diff --git a/mod/developers/vendors/jsTree/themes/default/d.png b/mod/developers/vendors/jsTree/themes/default/d.png
new file mode 100644 (file)
index 0000000..8540175
Binary files /dev/null and b/mod/developers/vendors/jsTree/themes/default/d.png differ
diff --git a/mod/developers/vendors/jsTree/themes/default/style.css b/mod/developers/vendors/jsTree/themes/default/style.css
new file mode 100644 (file)
index 0000000..238ce1a
--- /dev/null
@@ -0,0 +1,74 @@
+/*\r
+ * jsTree default theme 1.0\r
+ * Supported features: dots/no-dots, icons/no-icons, focused, loading\r
+ * Supported plugins: ui (hovered, clicked), checkbox, contextmenu, search\r
+ */\r
+\r
+.jstree-default li, \r
+.jstree-default ins { background-image:url("d.png"); background-repeat:no-repeat; background-color:transparent; }\r
+.jstree-default li { background-position:-90px 0; background-repeat:repeat-y; }\r
+.jstree-default li.jstree-last { background:transparent; }\r
+.jstree-default .jstree-open > ins { background-position:-72px 0; }\r
+.jstree-default .jstree-closed > ins { background-position:-54px 0; }\r
+.jstree-default .jstree-leaf > ins { background-position:-36px 0; }\r
+\r
+.jstree-default .jstree-hovered { background:#e7f4f9; border:1px solid #d8f0fa; padding:0 2px 0 1px; }\r
+.jstree-default .jstree-clicked { background:#beebff; border:1px solid #99defd; padding:0 2px 0 1px; }\r
+.jstree-default a .jstree-icon { background-position:-56px -19px; }\r
+.jstree-default a.jstree-loading .jstree-icon { background:url("throbber.gif") center center no-repeat !important; }\r
+\r
+.jstree-default.jstree-focused { background:#ffffee; }\r
+\r
+.jstree-default .jstree-no-dots li, \r
+.jstree-default .jstree-no-dots .jstree-leaf > ins { background:transparent; }\r
+.jstree-default .jstree-no-dots .jstree-open > ins { background-position:-18px 0; }\r
+.jstree-default .jstree-no-dots .jstree-closed > ins { background-position:0 0; }\r
+\r
+.jstree-default .jstree-no-icons a .jstree-icon { display:none; }\r
+\r
+.jstree-default .jstree-search { font-style:italic; }\r
+\r
+.jstree-default .jstree-no-icons .jstree-checkbox { display:inline-block; }\r
+.jstree-default .jstree-no-checkboxes .jstree-checkbox { display:none !important; }\r
+.jstree-default .jstree-checked > a > .jstree-checkbox { background-position:-38px -19px; }\r
+.jstree-default .jstree-unchecked > a > .jstree-checkbox { background-position:-2px -19px; }\r
+.jstree-default .jstree-undetermined > a > .jstree-checkbox { background-position:-20px -19px; }\r
+.jstree-default .jstree-checked > a > .jstree-checkbox:hover { background-position:-38px -37px; }\r
+.jstree-default .jstree-unchecked > a > .jstree-checkbox:hover { background-position:-2px -37px; }\r
+.jstree-default .jstree-undetermined > a > .jstree-checkbox:hover { background-position:-20px -37px; }\r
+\r
+#vakata-dragged.jstree-default ins { background:transparent !important; }\r
+#vakata-dragged.jstree-default .jstree-ok { background:url("d.png") -2px -53px no-repeat !important; }\r
+#vakata-dragged.jstree-default .jstree-invalid { background:url("d.png") -18px -53px no-repeat !important; }\r
+#jstree-marker.jstree-default { background:url("d.png") -41px -57px no-repeat !important; text-indent:-100px; }\r
+\r
+.jstree-default a.jstree-search { color:aqua; }\r
+.jstree-default .jstree-locked a { color:silver; cursor:default; }\r
+\r
+#vakata-contextmenu.jstree-default-context, \r
+#vakata-contextmenu.jstree-default-context li ul { background:#f0f0f0; border:1px solid #979797; -moz-box-shadow: 1px 1px 2px #999; -webkit-box-shadow: 1px 1px 2px #999; box-shadow: 1px 1px 2px #999; }\r
+#vakata-contextmenu.jstree-default-context li { }\r
+#vakata-contextmenu.jstree-default-context a { color:black; }\r
+#vakata-contextmenu.jstree-default-context a:hover, \r
+#vakata-contextmenu.jstree-default-context .vakata-hover > a { padding:0 5px; background:#e8eff7; border:1px solid #aecff7; color:black; -moz-border-radius:2px; -webkit-border-radius:2px; border-radius:2px; }\r
+#vakata-contextmenu.jstree-default-context li.jstree-contextmenu-disabled a, \r
+#vakata-contextmenu.jstree-default-context li.jstree-contextmenu-disabled a:hover { color:silver; background:transparent; border:0; padding:1px 4px; }\r
+#vakata-contextmenu.jstree-default-context li.vakata-separator { background:white; border-top:1px solid #e0e0e0; margin:0; }\r
+#vakata-contextmenu.jstree-default-context li ul { margin-left:-4px; }\r
+\r
+/* IE6 BEGIN */\r
+.jstree-default li, \r
+.jstree-default ins,\r
+#vakata-dragged.jstree-default .jstree-invalid, \r
+#vakata-dragged.jstree-default .jstree-ok, \r
+#jstree-marker.jstree-default { _background-image:url("d.gif"); }\r
+.jstree-default .jstree-open ins { _background-position:-72px 0; }\r
+.jstree-default .jstree-closed ins { _background-position:-54px 0; }\r
+.jstree-default .jstree-leaf ins { _background-position:-36px 0; }\r
+.jstree-default a ins.jstree-icon { _background-position:-56px -19px; }\r
+#vakata-contextmenu.jstree-default-context ins { _display:none; }\r
+#vakata-contextmenu.jstree-default-context li { _zoom:1; }\r
+.jstree-default .jstree-undetermined a .jstree-checkbox { _background-position:-20px -19px; }\r
+.jstree-default .jstree-checked a .jstree-checkbox { _background-position:-38px -19px; }\r
+.jstree-default .jstree-unchecked a .jstree-checkbox { _background-position:-2px -19px; }\r
+/* IE6 END */
\ No newline at end of file
diff --git a/mod/developers/vendors/jsTree/themes/default/throbber.gif b/mod/developers/vendors/jsTree/themes/default/throbber.gif
new file mode 100644 (file)
index 0000000..5b33f7e
Binary files /dev/null and b/mod/developers/vendors/jsTree/themes/default/throbber.gif differ
diff --git a/mod/developers/views/default/admin/developers/inspect.php b/mod/developers/views/default/admin/developers/inspect.php
new file mode 100644 (file)
index 0000000..cfa3de2
--- /dev/null
@@ -0,0 +1,14 @@
+<?php
+/**
+* Inspect View
+*
+* Inspect global variables of Elgg
+*/
+
+elgg_load_js('jquery.jstree');
+elgg_load_css('jquery.jstree');
+
+echo elgg_view_form('developers/inspect', array('class' => 'developers-form-inspect'));
+
+echo '<div id="developers-inspect-results"></div>';
+echo elgg_view('graphics/ajax_loader', array('id' => 'developers-ajax-loader'));
index 5e8419945cae327533d309673bf1d74e6df33c5a..3aa226d0a96821a2b5dd9afa69f08aa0b6d3c420 100644 (file)
@@ -12,3 +12,6 @@
 #developer-settings-form label {
        margin-right: 5px;
 }
+.elgg-page .jstree-default.jstree-focused {
+       background-color: transparent;
+}
diff --git a/mod/developers/views/default/developers/tree.php b/mod/developers/views/default/developers/tree.php
new file mode 100644 (file)
index 0000000..a8e4733
--- /dev/null
@@ -0,0 +1,18 @@
+<?php
+/**
+ * Displays a tree for inspection
+ *
+ * @uses $vars['tree']
+ */
+
+echo "<ul>";
+foreach ($vars['tree'] as $key => $arr) {
+       echo "<li><a>$key</a>";
+       echo "<ul>";
+       foreach ($arr as $value) {
+               echo "<li><a>$value</a></li>";
+       }
+       echo "</ul>";
+       echo "</li>";
+}
+echo "</ul>";
diff --git a/mod/developers/views/default/forms/developers/inspect.php b/mod/developers/views/default/forms/developers/inspect.php
new file mode 100644 (file)
index 0000000..a1b433f
--- /dev/null
@@ -0,0 +1,23 @@
+<?php
+/**
+ * Configuration inspection form
+ */
+
+echo '<div>';
+echo '<p>' . elgg_echo('developers:inspect:help') . '</p>';
+
+echo elgg_view('input/dropdown', array(
+       'name' => 'inspect_type',
+       'options_values' => array(
+               'Actions' => 'Actions',
+               'Events' => 'Events',
+               'Plugin Hooks' => 'Plugin Hooks',
+               'Simple Cache' => 'Simple Cache',
+               'Views' => 'Views',
+               'Web Services' => 'Web Services',
+               'Widgets' => 'Widgets',
+       ),
+));
+
+echo elgg_view('input/submit', array('value' => elgg_echo('submit')));
+echo '</div>';
diff --git a/mod/developers/views/default/js/developers/developers.php b/mod/developers/views/default/js/developers/developers.php
new file mode 100644 (file)
index 0000000..e6c249e
--- /dev/null
@@ -0,0 +1,43 @@
+<?php
+/**
+ * Elgg developers tool JavaScript
+ */
+?>
+
+elgg.provide('elgg.dev');
+
+elgg.dev.init = function() {
+       $('.developers-form-inspect').live('submit', elgg.dev.inspectSubmit);
+}
+
+/**
+ * Submit the inspect form through Ajax
+ *
+ * Requires the jQuery Form Plugin.
+ *
+ * @param {Object} event
+ */
+elgg.dev.inspectSubmit = function(event) {
+
+       $("#developers-inspect-results").hide();
+       $("#developers-ajax-loader").show();
+       
+       $(this).ajaxSubmit({
+               success  : function(response) {
+                       if (response) {
+                               $("#developers-inspect-results").html(response.output);
+                               $("#developers-inspect-results").jstree({
+                                       "plugins" : [ "themes", "html_data" ],
+                                       "themes" : {"icons" : false}
+                               }).bind("loaded.jstree", function() {
+                                       $("#developers-inspect-results").fadeIn();
+                                       $("#developers-ajax-loader").hide();
+                               });
+                       }
+               }
+       });
+
+       event.preventDefault();
+}
+
+elgg.register_hook_handler('init', 'system', elgg.dev.init);
\ No newline at end of file