[Mapbender-commits] r6040 - in trunk/mapbender/http/extensions: . jsTree.v.0.9.9a2

svn_mapbender at osgeo.org svn_mapbender at osgeo.org
Thu Apr 29 10:24:50 EDT 2010


Author: christoph
Date: 2010-04-29 10:24:49 -0400 (Thu, 29 Apr 2010)
New Revision: 6040

Added:
   trunk/mapbender/http/extensions/jsTree.v.0.9.9a2/
   trunk/mapbender/http/extensions/jsTree.v.0.9.9a2/README.txt
   trunk/mapbender/http/extensions/jsTree.v.0.9.9a2/changelog.txt
   trunk/mapbender/http/extensions/jsTree.v.0.9.9a2/documentation.html
   trunk/mapbender/http/extensions/jsTree.v.0.9.9a2/documentation_plugins.html
   trunk/mapbender/http/extensions/jsTree.v.0.9.9a2/jquery.tree.js
   trunk/mapbender/http/extensions/jsTree.v.0.9.9a2/jquery.tree.min.js
   trunk/mapbender/http/extensions/jsTree.v.0.9.9a2/jquery.tree.min.js~
Log:
jsTree

Added: trunk/mapbender/http/extensions/jsTree.v.0.9.9a2/README.txt
===================================================================
--- trunk/mapbender/http/extensions/jsTree.v.0.9.9a2/README.txt	                        (rev 0)
+++ trunk/mapbender/http/extensions/jsTree.v.0.9.9a2/README.txt	2010-04-29 14:24:49 UTC (rev 6040)
@@ -0,0 +1,40 @@
+jsTree 0.9.9
+http://jstree.com/
+
+Copyright (c) 2009 Ivan Bozhanov (vakata.com)
+
+Dual licensed under the MIT and GPL licenses:
+  http://www.opensource.org/licenses/mit-license.php
+  http://www.gnu.org/licenses/gpl.html
+
+Date: 2009-09-24
+
+
+
+In the root directory you will find jquery.tree.js and jquery.tree.min.js (minified version of jquery.tree.js). 
+To be able to use the jsTree jquery tree plugin all you need to do is include jquery (http://jquery.com) and one of the above files in your page.
+For more - check the documentation.html and examples.html files.
+
+In the plugins/ dir you will find all of the official plugins, along with a documentation.html file - it contains the docs for all the plugins.
+
+In the lib/ dir you will find a copy of jquery.js, along with all other dependencies of the plugins. 
+If you use a plugin - it will alert you about a missing dependency.
+
+All themes are located in the themes/ dir. Make sure to keep it relative to the jquery.tree.js file, so that your chosen theme will be included.
+If that is not an option for you - search the documentation.html file for "theme_path".
+
+For users upgrading from a previous version to 0.9.9:
+1) jQuery.tree_reference became jQuery.tree.reference (the function is also upgraded)
+2) jQuery.tree_focused became jQuery.tree.focused
+3) jQuery.tree_create became jQuery.tree.create
+4) The data config section is changed (all the options for the datastore are in the "data.opts" object) - check the docs for more.
+5) If you use XML - you will have to include the appropriate plugin and Sarissa - again - check the options - they are a bit changed.
+6) getXML and getJSON no longer exist - use the "get" function - check the documentation on how to use it.
+7) If you used the checkbox callback - switch to the checkbox plugin
+8) If you used the cookie option - switch to the cookie plugin - check the plugin docs for info.
+9) onJSONdata became ondata callback - you get what the server returned before jsTree displays it
+10) async_data becomes beforedata callback
+11) Drag, clickable, deletable rules are out of the picture. Enter type definitions - all types inherit from the "default" type. 
+You can now set valid children, max_depth, max_children, clickable, deletable, etc - any of those can also be functions, so you can dinamically check.
+It is all in the docs - check the "types" section. For global tree rules - check the "rules" config section.
+

Added: trunk/mapbender/http/extensions/jsTree.v.0.9.9a2/changelog.txt
===================================================================
--- trunk/mapbender/http/extensions/jsTree.v.0.9.9a2/changelog.txt	                        (rev 0)
+++ trunk/mapbender/http/extensions/jsTree.v.0.9.9a2/changelog.txt	2010-04-29 14:24:49 UTC (rev 6040)
@@ -0,0 +1,289 @@
+BUGS/FEATURES:
+   E: scroll_spd enhancement - accelerate/deccelerate
+   E: more programmatic move/create (without opening the parents)
+   E: PLUGIN: context menu plugin - slight flicker on two consecutive right clicks
+   E: DOCS: show how to build a datastore/plugin
+
+   ************ FOR LATER OR NO WAY TO FIX/TEST *****************
+   E: option to show loading as an icon - not below the node
+   B: horizontal scroll in Opera may be a bit too short
+   E: refresh X levels deep
+   E: multiple move callback to fire only once (or set a parameter if it is final)
+   E: finish RTL plugin
+   B: max_depth check - how about async?
+   B: on dump check for loading nodes and skip them
+   B: initial drag'n'drop does not work on OS X
+   E: preloading content (open_all)
+   E: native undo using rollback (maybe plugin)
+   E: whole row selection & columns
+
+CHANGELOG:
+ v.0.9.9a
+   fixed bug with creating root nodes
+ v.0.9.9
+   added use_max_children and use_max_depth settings
+   fixed small bug in get methods in all datastores (now classes like "my-last" are returned correctly)
+   drag_start, drag, drag_end callbacks
+   can now specify icons (even if using a sprite) for each node type
+   added tree_component.drag_drop.dragged variable to speed things up and to solve misterious bug :)
+   switched from DOM cloneNode to jQuery clone for drag_help (may cause slowdown) but is data() safe
+   sprites in all themes
+   themeroller theme + plugin BETA!
+   checkbox theme + plugin
+   delete function correctly resets selected variable
+   fixed refresh on a node, when async is not used
+   added a get function that expects data format and an object
+   fixed ctrl+click in IE7/IE8Compatibility
+   fixed context menu positioning if near edge
+   create stylesheet improvement
+   ondestroy callback
+   context menu css cleanup
+   onparentclose option
+   json get method fixed if tree is empty
+   reference function upgraded
+   fixed async reopening with cookies bug
+   fixed bug with moved function opening/closing nodes
+   search function now accepts a second optional argument (defaults to contains) so if you extend jQuery[:] with any case insensitive method - quote it there
+   onsearch callback
+   ondata and onparse - data is chained through all plugins
+   ondata and onparse - now called in create method
+   fixed datastores "get" functions (toString() on val)
+   fixed default theme using inline image and sprites (IE6 will no longer look nice - UPGRADE)
+   themeroller theme and plugin
+   checkbox theme & plugin
+   no more multiple inclusions of the same theme
+   can cut, copy, paste from one tree to another
+   better multitree - all, none or [ids] to accept from
+   multiple drag now max_children is correctly checked
+   drop just before loading -> node disappears bug FIXED
+   added get_text method
+   context menu as plugin
+   added onhover callback
+   keyboard navigation plugin (lost all the get_* functions and hover_mode setting)
+   metadata as plugin
+   beginning of a plugin system
+   oninit callback (mainly for plugins)
+   cookie is now plugin
+   fixed cookies with / in them (jQuery selector escaping issue)
+   added check move callback
+   restrict move to same parent - demo with function
+   added drop_mode function (jqueryUI connecting point?)
+   cookies changed
+   types rework - type_attr - meta_attr - meta_data - boolean
+   onrename LANG param removed (added tree.get_lang())
+   removed cycle_lang, improved show_lang
+   added CSS inside tree itself
+   plugin compatible (changed names)
+   no need to include stylesheet - will include itself (if you change the path - include it yourself and pass the $.tree.path)
+   flat & nested XSLs - merged into datasource itself
+   removed path setting in favour of global $.tree.path
+   no longer dependant on CSS.js and jquery.xslt.js
+   enabled datastore plugins + 4 data stores - JSON, HTML, XML_FLAT, XML_NESTED - all support async + fixed
+   defaults moved to $.tree - you can now modify all future tree's defaults
+   create, focused, rollback - become children of $.tree (no more polluting the jQuery object)
+   rename method accepts a string
+   onJSONdata becomes ondata callback - you get what the server returned before jsTree displays it
+   async_data becomes beforedata callback
+ v.0.9.8
+   fixed context menu icon wobble in IE
+   better error handling (no more infinite loading icon - now marks the node as closed again)
+   added TREE_OBJ as parameter to async_data
+   can now copy a node inside itself
+   when called on a node refresh() no longer reselects all selected nodes
+   onload was called multiple times in some occasions
+   CSS fixes, container can once more correctly autosize if overflow:hidden and zoom:1;
+   RTL improvements (Chrome nightly is OK, in RTL dots in IE7 will brake, still no horizontal scrollbar in Opera in RTL)
+   fixed Opera horizontal scrollbar (right-to-left mode still has problems)
+   themes redesign
+   destroy method die() part had to be rewritten
+   container can once more have position:relative
+   nested xml theme fix (was set on every ul)
+   fixed create function not to selected the newly created node if it will not be renamed
+   fixed create function to be able to pass children too
+   fixed create function not to modify the object passed to it
+   implemented next/prev/parent/children methods
+   can drag nodes onto an empty tree
+   can now paste root nodes
+   Opera xml_flat XSL bug workaround
+   jsTree should now be "immune" to object & array extending (prototype problem)
+   minor changes in create & paste functions (when before or after passed as position)
+   onJSONdata added (so that you can process any JSON to the required structure of jsTree)
+ v.0.9.7
+   can now create root nodes with 'create' function
+   create & paste functions rewritten
+   check stylesheet - fallback
+   disabled collapse when clicking below the arrow
+   numerous bugfixes
+   context menu is now appended to the body
+   bringing up the context menu does not change selection
+   tree can be created in a not yet appended node
+   refresh node bug
+   apple theme now works with dots (on/off)
+   added themeroller support - you can pass the classes in every data type (icons too), the active, hover & highlight classes are automatic
+   function to get a tree reference by ID
+   ondelete, oncreate, onmove, oncopy, onrename callbacks now receive additional rollback parameter
+   added getXML function to get the tree as XML (same as getJSON)
+   fixed default theme being included multiple times when more than 1 tree is used
+   fixed rename bug when html entities are used
+   added ability to pass an xml string as data source
+   added position argument in create function
+   option to which button initiates drag'n'drop
+   added 5px threshold for dragging
+   Chrome clear float
+   Fixed scrollbars (issue remains in ff - multiple root elements are not connected with dots)
+   small bug fixes in classic theme & apple theme
+ v.0.9.6
+   smarter drop location calculation (now if hovering a node where the before & after drops are not allowed, the whole node becomes a "inside" drop target)
+   open_all callback
+   no more hardcoded background - can now specify container background image
+   added checkbox theme (with optional onchange callback for tri-state checkboxes)
+   added apple theme with alternating background (!not compatible with dots)
+   can now disable a specific cookie type by setting settings.cookies._type_here_ : false
+   rightclick while dragging cancels drag'n'drop (by ali1024)
+   CSS rewrite for inline-block, instead of float - speed gain and drag&drop fixes
+   $.tree_focused() replaces tree_component.focusInst()
+   $.tree_create() replaces new tree_component(). No more leakage to the global name space. (by Johan "Spocke" Sörlin)
+   leakage of i and j variables fixed. (by Johan "Spocke" Sörlin)
+   wrapped in anonymous function (by Johan "Spocke" Sörlin)
+   added onselect, ondeselect callbacks
+   context menu in FF3 (linux) fixed (by KasperNyboHansen)
+   if theme_name is false, no CSS file is included, only images are looked up in theme_path (by groogs)
+   context menu Create & Delete functions fix for multiselect
+   reselect bug (by JensGabe)
+   fixed multiselector bug ($(".demo,#demo").tree...)
+   rewritten drag events (speed improvements, bug fixes)
+   now uses jQuery's native live instead of listen plugin
+   beforeopen and beforeclose callbacks added (by starmonkey)
+   context menu fix when refreshing (by airbedman)
+   can now use Dean Edward's packer (by Hafeyang)
+   create bug fixed (by dantan)
+   drag_copy bug fixed (by dantan)
+   theme background bug fixed (by JensGabe)
+ v.0.9.5
+   context menu items can be hidden or DISABLED (using the visible function)
+   fixed theme including on Mac OS (FF, Safari) (by alvin.schur)
+   fixed async JSON bug when server returned empty result (by JensGabe)
+   loading icon is now part of the theme
+   native context menu (by damir.secki)
+   multiple typeO (by JensGabe)
+   can now specify attributes for the nested <a> nodes (href, etc) - updated json format
+   event optimization (fixed bug where beforemove/copy/etc where called from the origin tree)
+   added scroll_spd setting (the speed at which the container scrolls if dragging near the edge)
+   fixed scoll while drag & drop
+   Safari & Chrome drag & drop fix
+   close_all - no animation
+   xml_flat and async bug fixed (by Alain)
+   can supply id in create function (by ludo)
+   more "IE8 compatible" :)
+   added support for themes (+2 themes) (by j9850s) - in any data type if icon does not contain a "/" it is loaded form the theme folder
+   fixed opening leaf nodes (by Limor.Schweitzer)
+   dragging bug (by ignoranceisbliss0)
+   added search functionality (opens all parents and adds class "search" to results) - if async - a request is made to the server with a GET parameter, that should return commaseparated id's of nodes to be opened
+   jQuery plugin mode - $().tree({opts})
+ v.0.9.2
+   async_data function fixed (by Alvin Schur)
+   remove enhancement and event order fix (by j9850s)
+   create bug fixed (by j9850s)
+   borderTopWidth bug in IE fixed (by me.khaled)
+   !NO MORE settings.dflt - now settings.selected - false, string or array & settings.opened - array
+   selected cookie is now CSV (if multiple is on)
+   getJSON attrib bug fixed (by eddie.con.carne)
+   negation dragrules - begin with "!" (order is respected)
+   drag various nodes on the tree (settings.rules.droppable)
+   jQuery compatible mode (all $ are now jQuery)
+   fixed remove bug when a node appears as selected but isn't (by nomen)
+   fixed create bug when passing a name for the new node and the parent node is closed (by Oliver)
+   async_data added in settings.data - a function to return an object that will be passed to the server in async mode
+   method added in settings.data - set all requests to GET or POST
+ v.0.9.1
+   various minor bugs fixed & optimizations
+   create function now accepts value & icon for the newly created node
+ v.0.9
+   multitree drag & drop - now the receiving tree's dragrules are respected
+   multitree language cleanup
+   added instance manager & focusInst function - tree_component.inst & tree_component.focusInst()
+   fixed get_left, get_right in RTL mode
+ v.0.8.2 
+   get_* functions receive a "force" argument that selects the node even if hover_mode is on
+   create function enhancement - can pass a node to create in (by anotherhero)
+   remove function enhancement - can pass a node to delete (by anotherhero)
+   fixed drag position in IE (by Nuno Mota)
+   fixed multitree drag rules check against origin tree (by bogdan)
+   rename function fix (when ESC is used) (by bogdan)
+   #marker z-index is now higher (by bogdan)
+   fixed get_json function (an attrib array can now be passed, icon fix) (by bogdan)
+   get_left, get_right functions fixed to match explorer functions' behavious (by bogdan)
+   implemented drag-to-copy - changes the default behaviour from drag to copy
+ v.0.8.1
+   fixed renaming bug (by anotherhero)
+   fixed #marker bug (by anotherhero)
+ v.0.8
+   onload callback - fired when the tree is loaded for the first time and when the tree or a node is refreshed
+   * in dragrules
+   refreshing a single node is possible (in async mode)
+   passed json can now be an object, not an array of objects (by Marius Bratu)
+   onchange called in deselect_branch (by jstreeuser)
+   id is urlencoded (by Arjan Haverkamp)
+ v.0.7.1
+   fixed create bug in async mode (by William)
+   create function returns the created node (by Nuno Mota)
+   fixed bug when dropped node did not open branch in async mode (by William)
+   fixed bug when passing empty array as children (by William)
+   fixed async xml loading (empty array && recursion problem)
+   fixed leaf bug (by Nuno Mota)
+   fixed inside moving to respect the createat rule
+ v.0.7
+   native async loading
+   added lock() function to lock/unlock the tree
+   added language customization for standard strings
+   hover_mode option added (for changing hover state with keyboard)
+   options object refactoring
+   fixed bug with closing parent of selected if parent is selected (multiple - on)
+   multiple added (can now be always on - no need for holding Ctrl)
+   onrgtclk callback added (See commented code on how to prevent default)
+   fixed bug where Ctrl+clicking selected node did not deselect the node
+   removed optional XML structure for single language
+   Google Code issues (typos) (by peter.kalvin)
+ v.0.6.5
+   tree now allows for some node sizing (see demo)
+   fixed bug when created nodes did not have the leaf class (by addwin)
+   optimized rtl position and images
+   can now change
+   fixed changing focus when closing focused node (by Karf)
+   fixed before- callbacks parameters (by Colin)
+   fixed dragging position (by Karf)
+   returned optional path parameter (by Karf)
+   added ondblclk callback, which defaults to toggle and then select node (by Arno)
+   tree object is passed as final argument in every callback
+ v.0.6.0.1
+   removed bug with switched beforemove/beforecreate callbacks (by Colin)
+   fixed mistake with mov / TYPE (by newuni)
+ v.0.6
+   added drag & drop between trees with correct marker placement
+   optimized jQuery selectors
+   added cut/copy/paste + oncopy callback
+   added error callback - attach custom function to errors
+   added multiple selection with move & delete
+   added getJSON - return the tree as an object
+   added before handlers
+   optimized css, added 'leaf' class
+   added basic rtl support (user opinions?)
+   added cookie support with definable prefix and options - default is false
+   added if selected node is within closed parent - select parent
+   added CSS solution when dragging large sets - all inner nodes are closed while dragging
+   added solid background color option (not white) - set background color on "li.last", ".tree"
+   added animation support (slideUp/slideDown) - specify duration (disabled for msie 6 - slow)
+   updated listen plugin
+   updated sarissa
+   added insertAt option for creating nodes ('top' or 'bottom')
+ v.0.5
+   current language is passed when renaming
+   added onbeforechange callback
+   'data' can be JSON and none (only events attached to structure)
+   Opera comaptible
+   scroll node into view when node selected
+   scroll container while dragging and mouse is near the edge
+   'remove' function 
+   rules and rule checking reinvented (added inline_rules, max_depth, max_children, valid_children, renameable)
+   dots are optional ('toggleDots' function, '.no_dots' classname)
+   various optimizations
\ No newline at end of file

Added: trunk/mapbender/http/extensions/jsTree.v.0.9.9a2/documentation.html
===================================================================
--- trunk/mapbender/http/extensions/jsTree.v.0.9.9a2/documentation.html	                        (rev 0)
+++ trunk/mapbender/http/extensions/jsTree.v.0.9.9a2/documentation.html	2010-04-29 14:24:49 UTC (rev 6040)
@@ -0,0 +1,1315 @@
+<!DOCTYPE html
+PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
+"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+	<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
+	<title>jsTree documentation</title>
+	<style type="text/css">
+	html, body { padding:0; margin:0; background:white; }
+	body, input, th, td, select, option { font-family:"Trebuchet MS",Verdana,Helvetica,Arial,sans-serif !important; font-size:62.5%; color:black; }
+	#container { width:800px; margin:0 auto; }
+	h1 { background:#1B3A6D; color:white; font-size:1.6em; margin:10px 0 1px 0; padding:0 0 0 1em; letter-spacing:0; line-height:25px; font-weight:normal; border-radius:5px; -moz-border-radius:5px; }
+	h2 { background:#E2EDF4; color:#1B3A6D; font-size:11pt; margin:0 0 0.5em 0; padding:0 0 0 1em; letter-spacing:0; line-height:25px; font-weight:normal; border-radius:5px; -moz-border-radius:5px; overflow:hidden; }
+	h3 { background:gray; color:white; font-size:11pt; margin:1.5em 0 1px 0; padding:0 0 0 1em; letter-spacing:0; line-height:25px; font-weight:normal; border-radius:5px; -moz-border-radius:5px; overflow:hidden; }
+	pre, p { font-size:10pt; line-height:1.6em; padding:0 1em; margin:0 0 0.5em 0; }
+	pre, code { font-size:10pt; }
+	.fp { color:navy; }
+	.type { color:green; }
+	h2 span { float:left; line-height:25px; }
+	h2 em { float:right; width:200px; font-size:10pt; line-height:25px; color:gray; margin:0; padding:0; font-style:none; }
+	h2 em code { padding:0 5px; }
+	.arguments { margin-bottom:10px; }
+	.arguments p { margin-bottom:0; }
+	.arguments strong, .arguments code { display:block; }
+	.arguments .inner_description { display:block; }
+	.arguments ul { list-style-type:none; }
+	.arguments code { display:inline; float:none; margin:0; }
+	.arguments li p { padding:0; }
+	.indent { margin-left:50px; }
+
+	@media print { 
+		#container { width:auto; margin:0 1em; }
+		h1, h2, h3 { page-break-after:avoid; }
+	}
+	</style>
+</head>
+<body>
+	<div id="container">
+		<p style="line-height:20px; margin-top:10px; color:gray;">Go to: <a href="#creating">Creating an instance</a> | <a href="#configuration">Configuration</a> | <a href="#datastores">Datastores</a> | <a href="#api">API</a></p>
+		<h1>Using jsTree</h1>
+		<div class="content">
+		<h2>Including the files</h2>
+		<p>First of all, as jsTree is a <a href="http://jquery.com">jQuery</a> component, you need to include jQuery itself. Currently jsTree uses version 1.3.2 (the latest as of 14.Sept.2009)</p>
+		<p><code class="fp">&lt;script type=&quot;text/javascript&quot; src=&quot;</code><code class="type">source/lib/jquery.js</code><code class="fp">&quot;&gt;&lt;/script&gt;</code></p>
+		<p>Then you need to include jsTree:</p>
+		<p><code class="fp">&lt;script type=&quot;text/javascript&quot; src=&quot;</code><code class="type">source/jquery.tree.js</code><code class="fp">&quot;&gt;&lt;/script&gt;</code></p>
+
+		<p>Or you could use the minified version:</p>
+		<p><code class="fp">&lt;script type=&quot;text/javascript&quot; src=&quot;</code><code class="type">source/jquery.tree.min.js</code><code class="fp">&quot;&gt;&lt;/script&gt;</code></p>
+
+		<p>You may change the path to whatever you like, but <strong>it is recommended not to rename <code class="type">jquery.tree.js</code> or <code class="type">jquery.tree.min.js</code></strong> as the filenames are used in path autodetection. If you decide to rename them make sure you set the <code class="fp">theme_path</code> config option, so that jsTree succesfully includes your chosen theme (you also MUST set this option if you decide to move the folder of your chosen theme out of <code class="type">jstree-location/themes/</code>).</p>
+
+		<p>Additionally you may decide to include some of the plugins from the <code class="type">plugins/</code> folder. If you do that the first time you open a page the plugin you loaded will alert you about missing dependancies - they can all be found <code class="type">lib/</code> folder.</p>
+
+		<h2 style="margin-top:2em;" id="creating">Creating an instance</h2>
+		<p>You can create an instance in one of two ways. Make sure that you do not use an <code class="fp">&lt;ul&gt;</code> node for the container node.</p>
+		<h3 style="margin-top:0;">Method 1:</h3>
+		<p><code class="fp">jQuery("selector-to-container-node-here").tree( options <sup>*</sup> );</code></p>
+		<p>* You may pass the configuration options as a parameter to the <code class="fp">tree()</code> function. Detailed information about configuring can be found below.</p>
+		<p>If you use this method, to get the address the instance you just created use this code:</p>
+		<p><code class="fp">jQuery.tree.reference( selector <sup>*</sup> );</code></p>
+		<p>* Selector can be: the ID of the container node, the ID of any contained DOM element, an actual DOM element contained within the tree, or a jQuery extended DOM node container within the tree</p>
+
+		<h3>Method 2:</h3>
+		<p><code class="fp">var your-tree-var = jQuery.tree.create();<br />your-tree-var.init( options <sup>*</sup> )</code></p>
+		<p>* You may pass the configuration options as a parameter to the <code class="fp">init()</code> function. Detailed information about configuring can be found below.</p>
+		<p>If you use this method, the <code class="fp">your-tree-var</code> is a reference to the instance. You can still use <code class="fp">jQuery.tree.reference()</code>. A note regarding IE8 - it has been known to cause some trouble if you use <code class="fp">tree</code> as variable name, so please don't.</p>
+
+		</div>
+		<h1 id="configuration">Configuration</h1>
+		<div class="content">
+		<p>The object storing all default values for newly created instances can be found in <code class="fp">jQuery.tree.defaults</code>. If you extend or modify the object, all instances created after the modification will use the modified object as default settings. When configuring an instance only pass those values, that are different from the defaults.</p>
+
+		<h2 id="data">
+			<span>data</span>
+			<em><code class="type">Object</code></em>
+		</h2>
+		<p class="description">This section of the config stores all data source related settings.</p>
+
+		<div class="indent">
+			<h2 id="data.async">
+				<span>data.async</span>
+				<em><code class="type">Boolean</code></em>
+			</h2>
+			<p class="description">If this is set to <code class="fp">true</code> a request will be made each time a closed node is opened, and its data is not yet loaded.</p>
+			<p class="description">Default is <code class="fp">false</code>.</p>
+
+			<h2 id="data.type">
+				<span>data.type</span>
+				<em><code class="type">String</code></em>
+			</h2>
+			<p class="description">A string specifying one of the included datastores (<code class="fp">"html"</code> and <code class="fp">"json"</code> are in the main source file (<code class="type">jquery.tree.js</code>) and <code class="fp">"xml_flat"</code> and <code class="fp">"xml_nested"</code> are available in the <code class="type">plugins/</code> directory).</p>
+			<p class="description">Default is <code class="fp">"html"</code>.</p>
+
+			<h2 id="data.opts">
+				<span>data.opts</span>
+				<em><code class="type">Object</code></em>
+			</h2>
+			<p class="description">An object specifying all the options for the chosen datastore.</p>
+			<p class="description">Default is <code class="fp">{ method: "GET", url: false }</code>.</p>
+
+			<div class="indent">
+				<h2 id="data.opts.method">
+					<span>data.opts.method</span>
+					<em><code class="type">String</code></em>
+				</h2>
+				<p class="description">The method used when querying the server for data. Either <code class="fp">"GET"</code> or <code class="fp">"POST"</code>. Keep in mind that while all included datastore plugins respect this setting, other third party datastore plugins may choose not to.</p>
+				<p class="description">Default is <code class="fp">"GET"</code>.</p>
+			</div>
+			<div class="indent">
+				<h2 id="data.opts.url">
+					<span>data.opts.url</span>
+					<em><code class="type">String</code></em>
+				</h2>
+				<p class="description">The URL used when querying the server for data. You may specify GET parameters here, or use the <code class="fp">beforedata</code> callback.</p>
+				<p class="description">Default is <code class="fp">false</code>.</p>
+			</div>
+		</div>
+
+		<h2 id="config.selected">
+			<span>selected</span>
+			<em><code class="type">mixed</code></em>
+		</h2>
+		<p class="description">A single node ID, or a list of node IDs to be initially selected when the tree first loads. Either a <code class="type">String</code>, an <code class="type">Array</code> or <code class="fp">false</code>.</p>
+		<p class="description">Default is <code class="fp">false</code>.</p>
+
+		<h2 id="opened">
+			<span>opened</span>
+			<em><code class="type">Array</code></em>
+		</h2>
+		<p class="description">An array of node IDs to be initially opened when the tree first loads.</p>
+		<p class="description">Default is <code class="fp">[]</code>.</p>
+
+		<h2 id="languages">
+			<span>languages</span>
+			<em><code class="type">Array</code></em>
+		</h2>
+		<p class="description">An array of string values, each one representing a language. Keep in mind those string will be used internally for CSS classes, so each string must be a valid CSS classname (a safe approach is to use typical language codes <code class="fp">"en"</code>, <code class="fp">"de"</code>, etc).</p>
+		<p class="description">Default is <code class="fp">[]</code>.</p>
+
+		<h2 id="ui">
+			<span>ui</span>
+			<em><code class="type">Object</code></em>
+		</h2>
+		<p class="description">This section of the config stores various user interface related settings.</p>
+
+		<div class="indent">
+			<h2 id="ui.dots">
+				<span>ui.dots</span>
+				<em><code class="type">Boolean</code></em>
+			</h2>
+			<p class="description">Should the tree have guiding dots or not.</p>
+			<p class="description">Default is <code class="fp">true</code>.</p>
+
+			<h2 id="ui.animation">
+				<span>ui.animation</span>
+				<em><code class="type">Integer</code></em>
+			</h2>
+			<p class="description">The duration in milliseconds of the open/close animation.</p>
+			<p class="description">Default is <code class="fp">0</code> (meaning no animation).</p>
+
+			<h2 id="ui.scroll_spd">
+				<span>ui.scroll_spd</span>
+				<em><code class="type">Integer</code></em>
+			</h2>
+			<p class="description">When dragging near the edge of the tree container it scrolls if neccessary. This setting controls the speed of the scroll.</p>
+			<p class="description">Default is <code class="fp">4</code>.</p>
+
+			<h2 id="ui.selected_parent_close">
+				<span>ui.selected_parent_close</span>
+				<em><code class="type">mixed</code></em>
+			</h2>
+			<p class="description">This option specifies the behavior of the tree when a parent of a selected node is closed. The options are <code class="fp">"select_parent"</code> - which deselects the selected node and selects the closed one (similar to windows explorer), <code class="fp">"deselect"</code> - only deselects the selected node or <code class="fp">false</code> - does nothing.</p>
+			<p class="description">Default is <code class="fp">"select_parent"</code>.</p>
+
+			<h2 id="ui.selected_delete">
+				<span>ui.selected_delete</span>
+				<em><code class="type">mixed</code></em>
+			</h2>
+			<p class="description">This option specifies the behavior of the tree when a selected node is deleted. The options are <code class="fp">"select_previous"</code> - which selects the previous node (similar to windows explorer) or <code class="fp">false</code> - does nothing.</p>
+			<p class="description">Default is <code class="fp">"select_previous"</code>.</p>
+
+			<h2 id="ui.theme_path">
+				<span>ui.theme_path</span>
+				<em><code class="type">String</code></em>
+			</h2>
+			<p class="description">The folder where jsTree's themes are located. If this is set to false, jsTree will autodetect the folder using its own folder location and appending <code class="type">themes/</code> at the end.</p>
+			<p class="description">Default is <code class="fp">false</code> (meaning autodetect).</p>
+
+			<h2 id="ui.theme_name">
+				<span>ui.theme_name</span>
+				<em><code class="type">String</code></em>
+			</h2>
+			<p class="description">The theme to use. If set to <code class="fp">false</code> no theme is loaded.</p>
+			<p class="description">Default is <code class="fp">"default"</code>.</p>
+		</div>
+
+		<h2 id="types">
+			<span>types</span>
+			<em><code class="type">Object</code></em>
+		</h2>
+		<p class="description">This section of the config stores all defined node types and their possible interactions. Each setting (except for <code class="fp">icon</code>) may be set to a function - if so whenever a user interaction is evaluated this function will be invoked and will receive two arguments - the node that is being checked and the tree instance. In any new types you define you may only supply the rules that are different from the default type.</p>
+		<p class="description">By default only the <code class="fp">"default"</code> node type is defined:</p>
+<pre class="fp">
+{
+	"default" : {
+		clickable	: true,
+		renameable	: true,
+		deletable	: true,
+		creatable	: true,
+		draggable	: true,
+		max_children	: -1,
+		max_depth	: -1,
+		valid_children	: "all",
+
+		icon : {
+			image : false,
+			position : false
+		}
+	}
+}
+</pre>
+		<div class="indent">
+			<h2 id="type.clickable">
+				<span>type.clickable</span>
+				<em><code class="type">mixed</code></em>
+			</h2>
+			<p class="description">Are nodes of this type clickable. <code class="type">Boolean</code> or <code class="type">Function</code>.</p>
+
+			<h2 id="type.renameable">
+				<span>type.renameable</span>
+				<em><code class="type">mixed</code></em>
+			</h2>
+			<p class="description">Are nodes of this type renameable. <code class="type">Boolean</code> or <code class="type">Function</code>.</p>
+
+			<h2 id="type.deletable">
+				<span>type.deletable</span>
+				<em><code class="type">mixed</code></em>
+			</h2>
+			<p class="description">Are nodes of this type deletable. <code class="type">Boolean</code> or <code class="type">Function</code>.</p>
+
+			<h2 id="type.creatable">
+				<span>type.creatable</span>
+				<em><code class="type">mixed</code></em>
+			</h2>
+			<p class="description">Can new nodes be created in nodes of that type. <code class="type">Boolean</code> or <code class="type">Function</code>.</p>
+
+			<h2 id="type.draggable">
+				<span>type.draggable</span>
+				<em><code class="type">mixed</code></em>
+			</h2>
+			<p class="description">Are nodes of this type draggable. <code class="type">Boolean</code> or <code class="type">Function</code>.</p>
+
+			<h2 id="type.max_children">
+				<span>type.max_children</span>
+				<em><code class="type">mixed</code></em>
+			</h2>
+			<p class="description">The maximum number of direct children allowed in this type of node. <code class="fp">-1</code> means unlimited amount of direct children, <code class="fp">0</code> means no children are allowed, <code class="fp">1</code> means maximum one child is allowed, etc. <code class="type">Integer</code> or <code class="type">Function</code>.</p>
+
+			<h2 id="type.max_depth">
+				<span>type.max_depth</span>
+				<em><code class="type">mixed</code></em>
+			</h2>
+			<p class="description">The maximum number of levels below this type of node. <code class="fp">-1</code> means unlimited amount of levels, <code class="fp">0</code> means no children are allowed, <code class="fp">1</code> means maximum one level is allowed, etc. <code class="type">Integer</code> or <code class="type">Function</code>.</p>
+
+			<h2 id="type.valid_children">
+				<span>type.valid_children</span>
+				<em><code class="type">mixed</code></em>
+			</h2>
+			<p class="description">Types of nodes allowed inside this type of node. Can be an <code class="type">Array</code> of string values (one for each allowed type), if set to <code class="type">String</code> <code class="fp">"all"</code> nodes of any type can be children of a nodes of this type. Can also be a <code class="type">Function</code></p>
+
+			<h2 id="type.icon">
+				<span>type.icon</span>
+				<em><code class="type">Object</code></em>
+			</h2>
+			<p class="description">An optional configuration of the icon used for that node type. If using a sprite (a big image with a lot of icons in it) define the <code class="fp">image</code> property on the <code class="fp">"default"</code> node type and for all other types just define the <code class="fp">position</code> property. Keep in mind IE6 is not supported (internally this uses a <code class="fp">node[attribute=value] &gt; node</code> selector).</p>
+			<p class="description">Default is: <code class="fp">{ image : false, position : false }</code>, which means the icon is defined in the theme.</p>
+		</div>
+
+		<h2 id="rules">
+			<span>rules</span>
+			<em><code class="type">Object</code></em>
+		</h2>
+		<p class="description">This section is for defining a few rules for the whole tree.</p>
+		
+		<div class="indent">
+			<h2 id="rules.multiple">
+				<span>rules.multiple</span>
+				<em><code class="type">mixed</code></em>
+			</h2>
+			<p class="description">This controls multiple selection. Can be either <code class="fp">false</code> - multiple selection is off, <code class="fp">"ctrl"</code> - multiple selection is on when the Ctrl key is held down or <code class="fp">"on"</code> - multiple selection is always on.</p>
+			<p class="description">Default is: <code class="fp">"ctrl"</code></p>
+
+			<h2 id="rules.multitree">
+				<span>rules.multitree</span>
+				<em><code class="type">mixed</code></em>
+			</h2>
+			<p class="description">This controls accepting nodes from other trees. Can be either <code class="fp">"none"</code> - will not accept any nodes from any tree, <code class="fp">"all"</code> - will accept from any tree or <code class="type">Array</code> - an array of strings, each one representing the ID of the container of a tree to accept from.</p>
+			<p class="description">Default is: <code class="fp">"none"</code></p>
+
+			<h2 id="rules.type_attr">
+				<span>rules.type_attr</span>
+				<em><code class="type">String</code></em>
+			</h2>
+			<p class="description">The attribute to read the type of the node from.</p>
+			<p class="description">Default is: <code class="fp">"rel"</code></p>
+
+			<h2 id="rules.createat">
+				<span>rules.createat</span>
+				<em><code class="type">String</code></em>
+			</h2>
+			<p class="description">Specifies the default location to insert new nodes at - at the top amongst the parent node's children or at the bottom. Also controls what happens if a node is dropped onto another node. Should be either <code class="fp">"top"</code> or <code class="fp">"bottom"</code>.</p>
+			<p class="description">Default is: <code class="fp">"bottom"</code></p>
+
+			<h2 id="rules.drag_copy">
+				<span>rules.drag_copy</span>
+				<em><code class="type">mixed</code></em>
+			</h2>
+			<p class="description">This controls how to copy when dragging. Can be either <code class="fp">false</code> - when the user drags a move is always performed, <code class="fp">"ctrl"</code> - a copy is made if the Ctrl key is held down or <code class="fp">"on"</code> - the drag always results in a copy.</p>
+			<p class="description">Default is: <code class="fp">"ctrl"</code></p>
+
+			<h2 id="rules.drag_button">
+				<span>rules.drag_button</span>
+				<em><code class="type">String</code></em>
+			</h2>
+			<p class="description">This controls which button initiates a drag. Can be either <code class="fp">"left"</code>, <code class="fp">"right"</code> or <code class="fp">"both"</code>.</p>
+			<p class="description">Default is: <code class="fp">"left"</code></p>
+
+			<h2 id="rules.use_max_children">
+				<span>rules.use_max_children</span>
+				<em><code class="type">Boolean</code></em>
+			</h2>
+			<p class="description">Should max_children rules be checked when moving/copying nodes.</p>
+			<p class="description">Default is: <code class="fp">true</code></p>
+
+			<h2 id="rules.use_max_depth">
+				<span>rules.use_max_depth</span>
+				<em><code class="type">Boolean</code></em>
+			</h2>
+			<p class="description">Should max_depth rules be checked when moving/copying nodes.</p>
+			<p class="description">Default is: <code class="fp">true</code></p>
+
+			<h2 id="rules.max_children">
+				<span>type.max_children</span>
+				<em><code class="type">Integer</code></em>
+			</h2>
+			<p class="description">The maximum number of root nodes allowed. <code class="fp">-1</code> means unlimited amount of root nodes, <code class="fp">1</code> means maximum one root node is allowed, etc.</p>
+			<p class="description">Default is: <code class="fp">-1</code></p>
+
+			<h2 id="rules.max_depth">
+				<span>type.max_depth</span>
+				<em><code class="type">Integer</code></em>
+			</h2>
+			<p class="description">The maximum number of levels. <code class="fp">-1</code> means unlimited amount of levels, <code class="fp">1</code> means maximum one level is allowed, etc.</p>
+			<p class="description">Default is: <code class="fp">-1</code></p>
+
+			<h2 id="rules.valid_children">
+				<span>type.valid_children</span>
+				<em><code class="type">mixed</code></em>
+			</h2>
+			<p class="description">Types of nodes allowed as root nodes. Can be an <code class="type">Array</code> of string values (one for each allowed type), if set to <code class="type">String</code> <code class="fp">"all"</code> nodes of any type can be root nodes.</p>
+			<p class="description">Default is: <code class="fp">"all"</code></p>
+		</div>
+
+		<h2 id="lang">
+			<span>langs</span>
+			<em><code class="type">Object</code></em>
+		</h2>
+		<p class="description">This section of the config stores various settings related to languages.</p>
+
+		<div class="indent">
+			<h2 id="lang.new_node">
+				<span>lang.new_node</span>
+				<em><code class="type">mixed</code></em>
+			</h2>
+			<p class="description">The default name for newly created nodes (if the new name is not specified on creation). Can be a <code class="type">String</code> or an <code class="type">Array</code> of strings for each defined language. If you use multiple languages but set this to a single string - it will be used in all languages.</p>
+			<p class="description">Default is <code class="fp">"New folder"</code>.</p>
+
+			<h2 id="lang.loading">
+				<span>lang.loading</span>
+				<em><code class="type">String</code></em>
+			</h2>
+			<p class="description">The string displayed when loading content from the server.</p>
+			<p class="description">Default is <code class="fp">"Loading ..."</code>.</p>
+		</div>
+
+		<h2 id="config.callback">
+			<span>callback</span>
+			<em><code class="type">Object</code></em>
+		</h2>
+		<p class="description">This section is for defining all callback functions which fire on various events.</p>
+
+		<div class="indent">
+			<h2 id="callback.beforechange">
+				<span>callback.beforechange</span>
+				<em>Should return: <code class="type">Boolean</code></em>
+			</h2>
+			<p class="description">Triggered before selection changes. Receives two parameters - the node involved in the event and a reference to the tree instance. If <code class="fp">false</code> is returned selection is not changed.</p>
+			<p class="description">Default is: <code class="fp">function(NODE, TREE_OBJ) { return true }</code></p>
+
+			<h2 id="callback.beforeopen">
+				<span>callback.beforeopen</span>
+				<em>Should return: <code class="type">Boolean</code></em>
+			</h2>
+			<p class="description">Triggered before opening a node. Receives two parameters - the node about to be opened and a reference to the tree instance. If <code class="fp">false</code> is returned the node is not opened.</p>
+			<p class="description">Default is: <code class="fp">function(NODE, TREE_OBJ) { return true }</code></p>
+
+			<h2 id="callback.beforeclose">
+				<span>callback.beforeclose</span>
+				<em>Should return: <code class="type">Boolean</code></em>
+			</h2>
+			<p class="description">Triggered before closing a node. Receives two parameters - the node about to be closed and a reference to the tree instance. If <code class="fp">false</code> is returned the node is not closed.</p>
+			<p class="description">Default is: <code class="fp">function(NODE, TREE_OBJ) { return true }</code></p>
+
+			<h2 id="callback.beforemove">
+				<span>callback.beforemove</span>
+				<em>Should return: <code class="type">Boolean</code></em>
+			</h2>
+			<p class="description">Triggered before moving a node. Receives four parameters - the node about to be moved, the reference node in the move, the new position relative to the reference node (one of <code class="fp">"before"</code>, <code class="fp">"after"</code> or <code class="fp">"inside"</code>) and a reference to the tree instance. If <code class="fp">false</code> is returned the node is not moved.</p>
+			<p class="description">Default is: <code class="fp">function(NODE, REF_NODE, TYPE, TREE_OBJ) { return true }</code></p>
+
+			<h2 id="callback.beforecreate">
+				<span>callback.beforecreate</span>
+				<em>Should return: <code class="type">Boolean</code></em>
+			</h2>
+			<p class="description">Triggered before creating a node. Receives four parameters - the node about to be created, the reference node in the creation, the new position relative to the reference node (one of <code class="fp">"before"</code>, <code class="fp">"after"</code> or <code class="fp">"inside"</code>) and a reference to the tree instance. If <code class="fp">false</code> is returned the node is not created.</p>
+			<p class="description">Default is: <code class="fp">function(NODE, REF_NODE, TYPE, TREE_OBJ) { return true }</code></p>
+
+			<h2 id="callback.beforerename">
+				<span>callback.beforerename</span>
+				<em>Should return: <code class="type">Boolean</code></em>
+			</h2>
+			<p class="description">Triggered before renaming a node. Receives three parameters - the node about to be renamed, the current language and a reference to the tree instance. If <code class="fp">false</code> is returned the node is not renamed.</p>
+			<p class="description">Default is: <code class="fp">function(NODE, LANG, TREE_OBJ) { return true }</code></p>
+
+			<h2 id="callback.beforedelete">
+				<span>callback.beforedelete</span>
+				<em>Should return: <code class="type">Boolean</code></em>
+			</h2>
+			<p class="description">Triggered before deleting a node. Receives two parameters - the node about to be deleted and a reference to the tree instance. If <code class="fp">false</code> is returned the node is not deleted.</p>
+			<p class="description">Default is: <code class="fp">function(NODE, TREE_OBJ) { return true }</code></p>
+
+			<h2 id="callback.beforedata">
+				<span>callback.beforedata</span>
+				<em>Should return: <code class="type">Object</code></em>
+			</h2>
+			<p class="description">Used for passing custom parameters to the server. Receives two parameters - a node (if applicable) and a reference to the tree instance.</p>
+			<p class="description">Default is: <code class="fp">function(NODE, TREE_OBJ) { return { id : $(NODE).attr("id") || 0 } }</code></p>
+
+			<h2 id="callback.ondata">
+				<span>callback.ondata</span>
+				<em>Should return: <code class="type">mixed</code></em>
+			</h2>
+			<p class="description">Used for modifying the data received from the server before parsing it.</p>
+			<p class="description">Default is: <code class="fp">function(DATA, TREE_OBJ) { return DATA; }</code></p>
+
+			<h2 id="callback.onparse">
+				<span>callback.onparse</span>
+				<em>Should return: <code class="type">String</code></em>
+			</h2>
+			<p class="description">Used for modifying the HTML about to be inserted in the DOM before actually inserting it.</p>
+			<p class="description">Default is: <code class="fp">function(STR, TREE_OBJ) { return STR; }</code></p>
+
+			<h2 id="callback.onhover">
+				<span>callback.onhover</span>
+			</h2>
+			<p class="description">Triggered when a node is hovered. Receives two parameters - the hovered node and a reference to the tree instance.</p>
+			<p class="description">Default is: <code class="fp">function(NODE, TREE_OBJ) { }</code></p>
+
+			<h2 id="callback.onselect">
+				<span>callback.onselect</span>
+			</h2>
+			<p class="description">Triggered when a node is selected. Receives two parameters - the selected node and a reference to the tree instance.</p>
+			<p class="description">Default is: <code class="fp">function(NODE, TREE_OBJ) { }</code></p>
+
+			<h2 id="callback.ondeselect">
+				<span>callback.ondeselect</span>
+			</h2>
+			<p class="description">Triggered when a node is deselected. Receives two parameters - the deselected node and a reference to the tree instance.</p>
+			<p class="description">Default is: <code class="fp">function(NODE, TREE_OBJ) { }</code></p>
+
+			<h2 id="callback.onchange">
+				<span>callback.onchange</span>
+			</h2>
+			<p class="description">Triggered when selection is changed in any way (select or deselect). Receives two parameters - the node involved  and a reference to the tree instance.</p>
+			<p class="description">Default is: <code class="fp">function(NODE, TREE_OBJ) { }</code></p>
+
+			<h2 id="callback.onrename">
+				<span>callback.onrename</span>
+			</h2>
+			<p class="description">Triggered when a node is renamed. Receives three parameters - the renamed node, a reference to the tree instance and a rollback object that you can use with <code class="fp">jQuery.tree.rollback</code>.</p>
+			<p class="description">Default is: <code class="fp">function(NODE, TREE_OBJ, RB) { }</code></p>
+
+			<h2 id="callback.onmove">
+				<span>callback.onmove</span>
+			</h2>
+			<p class="description">Triggered when a node is moved. Receives five parameters - the node that was moved, the reference node in the move, the new position relative to the reference node (one of <code class="fp">"before"</code>, <code class="fp">"after"</code> or <code class="fp">"inside"</code>), a reference to the tree instance and a rollback object that you can use with <code class="fp">jQuery.tree.rollback</code>.</p>
+			<p class="description">Default is: <code class="fp">function(NODE, REF_NODE, TYPE, TREE_OBJ, RB) { }</code></p>
+
+			<h2 id="callback.oncopy">
+				<span>callback.oncopy</span>
+			</h2>
+			<p class="description">Triggered when a node is copied. Receives five parameters - the node that was copied, the reference node in the copy, the new position relative to the reference node (one of <code class="fp">"before"</code>, <code class="fp">"after"</code> or <code class="fp">"inside"</code>), a reference to the tree instance and a rollback object that you can use with <code class="fp">jQuery.tree.rollback</code>.</p>
+			<p class="description">Default is: <code class="fp">function(NODE, REF_NODE, TYPE, TREE_OBJ, RB) { }</code></p>
+
+			<h2 id="callback.oncreate">
+				<span>callback.oncreate</span>
+			</h2>
+			<p class="description">Triggered when a node is created. Receives five parameters - the node that was created, the reference node in the create operation, the new position relative to the reference node (one of <code class="fp">"before"</code>, <code class="fp">"after"</code> or <code class="fp">"inside"</code>), a reference to the tree instance and a rollback object that you can use with <code class="fp">jQuery.tree.rollback</code>.</p>
+			<p class="description">Default is: <code class="fp">function(NODE, REF_NODE, TYPE, TREE_OBJ, RB) { }</code></p>
+
+			<h2 id="callback.ondelete">
+				<span>callback.ondelete</span>
+			</h2>
+			<p class="description">Triggered when a node is deleted. Receives three parameters - the node that was deleted, a reference to the tree instance and a rollback object that you can use with <code class="fp">jQuery.tree.rollback</code>.</p>
+			<p class="description">Default is: <code class="fp">function(NODE, TREE_OBJ, RB) { }</code></p>
+
+			<h2 id="callback.onopen">
+				<span>callback.onopen</span>
+			</h2>
+			<p class="description">Triggered when a node is opened. Receives two parameters - the node that was opened and a reference to the tree instance.</p>
+			<p class="description">Default is: <code class="fp">function(NODE, TREE_OBJ) { }</code></p>
+
+			<h2 id="callback.onopen_all">
+				<span>callback.onopen_all</span>
+			</h2>
+			<p class="description">Triggered when a <code class="fp">open_all</code> operation completes. Receives one parameter - a reference to the tree instance.</p>
+			<p class="description">Default is: <code class="fp">function(TREE_OBJ) { }</code></p>
+
+			<h2 id="callback.onclose">
+				<span>callback.onclose</span>
+			</h2>
+			<p class="description">Triggered when a node is closed. Receives two parameters - the node that was closed and a reference to the tree instance.</p>
+			<p class="description">Default is: <code class="fp">function(NODE, TREE_OBJ) { }</code></p>
+
+			<h2 id="callback.onclose_all">
+				<span>callback.onclose_all</span>
+			</h2>
+			<p class="description">Triggered when a <code class="fp">close_all</code> operation completes. Receives one parameter - a reference to the tree instance.</p>
+			<p class="description">Default is: <code class="fp">function(TREE_OBJ) { }</code></p>
+
+			<h2 id="callback.error">
+				<span>callback.error</span>
+			</h2>
+			<p class="description">Triggered when an error occurs. Receives two parameters - the error string and a reference to the tree instance.</p>
+			<p class="description">Default is: <code class="fp">function(TEXT, TREE_OBJ) { }</code></p>
+
+			<h2 id="callback.ondblclk">
+				<span>callback.ondblclk</span>
+			</h2>
+			<p class="description">Triggered when a node is doubleclicked. Receives two parameters - the node that was doubleclicked and a reference to the tree instance.</p>
+			<p class="description">Default is:</p>
+<pre class="fp">
+function(NODE, TREE_OBJ) { 
+	TREE_OBJ.toggle_branch.call(TREE_OBJ, NODE);
+	TREE_OBJ.select_branch.call(TREE_OBJ, NODE);
+}
+</pre>
+
+			<h2 id="callback.onrgtclk">
+				<span>callback.onrgtclk</span>
+			</h2>
+			<p class="description">Triggered when a node is rightclicked. Receives three parameters - the node that was rightclicked, a reference to the tree instance and the event object. To prevent the browser menu use:</p>
+<pre class="fp">
+function(NODE, TREE_OBJ, EV) { 
+	EV.preventDefault(); 
+	EV.stopPropagation(); 
+	return false; 
+}</pre>
+			<p class="description">Default is: <code class="fp">function(NODE, TREE_OBJ, EV) { }</code></p>
+
+			<h2 id="callback.onload">
+				<span>callback.onload</span>
+			</h2>
+			<p class="description">Triggered when the tree is loaded with data for the first time or refreshed. Receives one parameter - a reference to the tree instance.</p>
+			<p class="description">Default is: <code class="fp">function(TREE_OBJ) { }</code></p>
+
+			<h2 id="callback.oninit">
+				<span>callback.oninit</span>
+			</h2>
+			<p class="description">Triggered when the tree is initialized and before any data is requested or parsed. Receives one parameter - a reference to the tree instance.</p>
+			<p class="description">Default is: <code class="fp">function(TREE_OBJ) { }</code></p>
+
+			<h2 id="callback.onfocus">
+				<span>callback.onfocus</span>
+			</h2>
+			<p class="description">Triggered when the tree is focused. When creating a new tree it is always focused and the callback fires after <code class="fp">oninit</code>, but if a data request should be made to the server - possibly before <code class="fp">onload</code>. Receives one parameter - a reference to the tree instance.</p>
+			<p class="description">Default is: <code class="fp">function(TREE_OBJ) { }</code></p>
+
+			<h2 id="callback.ondestroy">
+				<span>callback.ondestroy</span>
+			</h2>
+			<p class="description">Triggered before the tree is destroyed. Receives one parameter - a reference to the tree instance.</p>
+			<p class="description">Default is: <code class="fp">function(TREE_OBJ) { }</code></p>
+
+			<h2 id="callback.onsearch">
+				<span>callback.onsearch</span>
+			</h2>
+			<p class="description">Triggered after a search is performed and results are ready. Receives two parameters - a jQuery collection of nodes matching the search and a reference to the tree instance.</p>
+			<p class="description">Default is: <code class="fp">function(NODES, TREE_OBJ) { NODES.addClass("search"); }</code></p>
+
+			<h2 id="callback.ondrop">
+				<span>callback.ondrop</span>
+			</h2>
+			<p class="description">Triggered when a foreign node is dropped on the tree. Receives four parameters - the foreign node that was dropped, the reference node in the move, the new position relative to the reference node (one of <code class="fp">"before"</code>, <code class="fp">"after"</code> or <code class="fp">"inside"</code>) and a reference to the tree instance.</p>
+			<p class="description">Default is: <code class="fp">function(NODE, REF_NODE, TYPE, TREE_OBJ) { }</code></p>
+
+			<h2 id="callback.check">
+				<span>callback.check</span>
+			</h2>
+			<p class="description">Triggered when a node is checked for a certain rule. Receives four parameters - the rule that is checked, the node that is checked, the value computed so far (as the callback is called last - before that types are evaluated) and a reference to the tree instance.</p>
+			<p class="description">Default is: <code class="fp">function(RULE,NODE,VALUE,TREE_OBJ) { return VALUE; }</code></p>
+
+			<h2 id="callback.check_move">
+				<span>callback.check_move</span>
+				<em>Should return: <code class="type">Boolean</code></em>
+			</h2>
+			<p class="description">Triggered when a move is evaluated. Receives four parameters - the node that is moved, the reference node in the move, the new position relative to the reference node (one of <code class="fp">"before"</code>, <code class="fp">"after"</code> or <code class="fp">"inside"</code>) and a reference to the tree instance.</p>
+			<p class="description">Default is: <code class="fp">function(NODE, REF_NODE, TYPE, TREE_OBJ) { return true; }</code></p>
+		</div>
+
+		<h2 id="plugins">
+			<span>plugins</span>
+			<em><code class="type">Object</code></em>
+		</h2>
+		<p class="description">This section is for defining active plugins on the instance. Each plugin is a key in this object, and corresponding to that key is the options object for the plugin. For example:</p>
+<pre class="fp">
+plugins : {
+	"plugin-name" : { plugin-option-one : "value", plugin-option-two : { } }
+	"second-plugin" : { } <code class="type">// This just activates the plugin without modifying its defaults.</code>
+}
+</pre>
+		<p class="description">Default is: <code class="fp">{ }</code></p>
+		</div>
+
+		<h1 id="datastores">Datastores</h1>
+		<div class="content">
+			<p>In this section you will find the data format description of the two bundled datasources.</p>
+			<h2 id="html">HTML</h2>
+			<p>The simplest of datastores. Used when you need to converted a nested list into an interactive tree. The required structure is as follows:</p>
+<pre class="fp">
+&lt;some-container-node&gt;
+	&lt;ul&gt;
+		&lt;li id=&quot;node-identificator&quot; rel=&quot;node-type&quot;&gt;
+			&lt;a href=&quot;#&quot;&gt;&lt;ins&gt;&amp;nbsp;&lt;/ins&gt;Root node&lt;/a&gt;
+			&lt;ul&gt;
+				&lt;li id=&quot;node-identificator&quot; rel=&quot;node-type&quot;&gt;
+					&lt;a href=&quot;#&quot;&gt;&lt;ins&gt;&amp;nbsp;&lt;/ins&gt;Child node&lt;/a&gt;
+				&lt;/li&gt;
+			&lt;/ul&gt;
+		&lt;/li&gt;
+	&lt;/ul&gt;
+&lt;/some-container-node&gt;
+</pre>
+			<p>You can have whatever attributes you like in any of the elements. Also keep in mind that the node ID and type can be omitted and the node type may be stored in some other attribute if you decide to configure it (check the <code class="fp">type_attr</code> section).</p>
+			<p>If you use language versions you will have multiple <code class="fp">&lt;a&gt;</code> (one for each language) elements inside any <code class="fp">&lt;li&gt;</code> element, they must have a language code (one of the codes defined in the <code class="fp">langauges</code> section of the config) for a classname. Like so:</p>
+<pre class="fp">
+&lt;li id=&quot;node-identificator&quot; rel=&quot;node-type&quot;&gt;
+	&lt;a href=&quot;#&quot; class=&quot;en&quot;&gt;&lt;ins&gt;&amp;nbsp;&lt;/ins&gt;Title in English&lt;/a&gt;
+	&lt;a href=&quot;#&quot; class=&quot;bg&quot;&gt;&lt;ins&gt;&amp;nbsp;&lt;/ins&gt;Title in Bulgarian&lt;/a&gt;
+&lt;/li&gt;
+</pre>
+			<h2 id="json">JSON</h2>
+			<p>The JSON data format is definitely the most widely used amongst jsTree users. Each node has the following structure:</p>
+<pre class="fp">
+{ 
+	attributes: { id : "node_identificator", some-other-attribute : "attribute_value" }, 
+	data: "node_title", 
+	<code class="type">// Properties below are only used for NON-leaf nodes</code>
+	state: "closed", <code class="type">// or "open"</code>
+	children: [ <code class="type">/* an array of child nodes objects */</code> ]
+}
+</pre>
+			<p>As you can see you can pass any attributes you like in the <code class="fp">attributes</code> object - in the resulting HTML output those attributes are bound to the <code class="fp">&lt;li&gt;</code> element. If you have a leaf node (one with no children) omit the <code class="fp">state</code> and <code class="fp">children</code> properties.</p>
+			<p>If you need to specify some attributes for the <code class="fp">&lt;a&gt;</code> node in the output, or want to set a custom icon instead of a string, pass an object for the data section. Like so:</p>
+<pre class="fp" style="color:silver;">
+{ 
+	attributes: { id : "node_identificator", some-other-attribute : "attribute_value" }, 
+	<code class="fp">data: { title : "Node title", icon : "path_to/icon.pic", attributes : {"key" : "value" } }, </code>
+	// Properties below are only used for NON-leaf nodes
+	state: "closed", // or "open"
+	children: [ /* an array of child nodes objects */ ]
+}
+</pre>
+
+			<p>If language versions are used use this syntax for the data property:</p>
+<pre class="fp">
+data: { 
+	"en" : "Title in English", 
+	"bg" : "Title in Bulgarian"
+}
+</pre>
+			<p>Or if you need icons and attributes:</p>
+<pre class="fp">
+data: { 
+	"en" : { title : "Title in English", icon : "path_to/icon.pic", attributes : { "key" : "value" } },
+	"bg" : "Title in Bulgarian"
+}
+</pre>
+			<p>As you can see - you can mix the short and long syntax.</p>
+		</div>
+
+		<h1 id="api">API</h1>
+		<div class="content">
+		<h2 id="jQuery">
+			<span>jQuery(selector).tree([options])</span>
+			<em>Return value: <code class="type">jQuery</code></em>
+		</h2>
+		<p class="description">Used on a jQuery selector the tree function converts all matched elements to trees, using the options provided. If a tree already exists in one of the selected DOM nodes, it is first destroyed and then recreated using the passed options object.</p>
+		<div class="arguments">
+			<p>
+				<strong>Arguments:</strong>
+				<code class="type">object</code> <code class="fp">options</code>
+			</p>
+			<p class="inner_description">An optional object, specifing all the options for the tree (or trees) that will be created. This object internally extends the global defaults object. So you may only pass values that are different from the defaults.</p>
+		</div>
+		
+		<h3>Functions and properties bound directly to the global tree object.</h3>
+		<h2 id="tree.create">
+			<span>jQuery.tree.create()</span>
+			<em>Return value: <code class="type">jsTree</code></em> 
+		</h2>
+		<p class="description">Creates a new tree instance. Accepts no arguments - the configuration object is passed in a subsequest <code class="fp">init</code> call on the returned tree object.</p>
+
+		<h2 id="tree.datastores">
+			<span>jQuery.tree.datastores</span>
+		</h2>
+		<p class="description">This object stores all defined datastores on a global level. Every added datastore extends this object. In order to use a datastore in a tree instance, the datastore should be defined in this object.</p>
+		
+		<h2 id="tree.defaults">
+			<span>jQuery.tree.defaults</span>
+		</h2>
+		<p class="description">The object storing all default values for newly created instances. If you extend or modify the object, all instances created after the modification will use the modified object as default settings. This means that you can even define plugins that should be active on all instances.</p>
+
+		<h2 id="tree.drag_start">
+			<span>jQuery.tree.drag_start</span>
+			<em><code class="type">function</code></em>
+		</h2>
+		<p class="description">You can set this to a function - it will be called each time the user initiates a drag. You will receive the event object and a jsTree drag_drop object as parameters. Please note that you attach this callback globally and not on a specific instance. To get the instance involved in the drag start - use the <code class="fp">jQuery.tree.reference()</code> function.</p>
+
+		<h2 id="tree.drag">
+			<span>jQuery.tree.drag</span>
+			<em><code class="type">function</code></em>
+		</h2>
+		<p class="description">You can set this to a function - it will be called each time the mousemove event is fired. You will receive the event object and a jsTree drag_drop object as parameters. Please note that you attach this callback globally and not on a specific instance. To get the instance/instances involved in the drag - use the <code class="fp">jQuery.tree.reference()</code> function.</p>
+
+		<h2 id="tree.drag_end">
+			<span>jQuery.tree.drag_end</span>
+			<em><code class="type">function</code></em>
+		</h2>
+		<p class="description">You can set this to a function - it will be called each time the user finishes a drag. You will receive the event object and a jsTree drag_drop object as parameters. Please note that you attach this callback globally and not on a specific instance. To get the instance/instances involved in the drag - use the <code class="fp">jQuery.tree.reference()</code> function. Do not confuse with the onmove callback which will also be fired if there was a valid move.</p>
+
+		<h2 id="tree.drop_mode">
+			<span>jQuery.tree.drop_mode([options])</span>
+			<em>Return value: <code class="fp">none</code></em>
+		</h2>
+		<p class="description">This function sets all initialized trees on the page in "drop mode", meaning that all the trees start handling mouseover events and evaluating the possible drop, and giving the user feedback.</p>
+		<div class="arguments">
+			<p>
+				<strong>Arguments:</strong> 
+				<code class="type">object</code> <code class="fp">options</code>
+			</p>
+			<p>An optional object, specifing a few options:</p>
+			<ul>
+				<li>
+					<code class="type">boolean</code> <code class="fp">show</code>
+					<p>Should there be a drag helper. Defaults to <code class="fp">false</code>.</p>
+				</li>
+				<li>
+					<code class="type">string</code> <code class="fp">type</code>
+					<p>The node type that should be used for the current drop when evaluating the drag rules. Defaults to <code class="fp">"default"</code>.</p>
+				</li>
+				<li>
+					<code class="type">string</code> <code class="fp">str</code>
+					<p>The text used in the drag helper. Defaults to <code class="fp">"Foreign node"</code>.</p>
+				</li>
+			</ul>
+		</div>
+
+		<h2 id="tree.focused">
+			<span>jQuery.tree.focused()</span>
+			<em>Return value: <code class="type">jsTree</code></em>
+		</h2>
+		<p class="description">This functions returns the currently focused tree instance.</p>
+
+		<h2 id="jQuery.tree.plugins">
+			<span>jQuery.tree.plugins</span>
+		</h2>
+		<p class="description">This object stores all defined plugins on a global level. Every added plugin extends this object. In order to use a specific plugin, it should be defined in this object. Only having a plugin defined here, does not mean it is activated with every instance. If you want to use a plugin with an instance you should define that in the particular instance config.</p>
+
+		<h2 id="tree.reference">
+			<span>jQuery.tree.reference(needle)</span>
+			<em>Return value: <code class="type">jsTree</code></em>
+		</h2>
+		<p class="description">This functions returns a specific tree instance by an ID or contained node.</p>
+		<div class="arguments">
+			<p>
+				<strong>Arguments:</strong>
+				<code class="type">mixed</code> <code class="fp">needle</code>
+			</p>
+			<p>This can be either the instance ID (the ID of the container node), an ID of any contained DOM element, an actual DOM element contained within the tree, or a jQuery extended DOM node container within the tree.</p>
+		</div>
+
+		<h2 id="tree.rollback">
+			<span>jQuery.tree.rollback(data)</span>
+			<em>Return value: <code class="fp">none</code></em>
+		</h2>
+		<p class="description">This function performs a rollback when passed a rollback object. It sets all trees involved in the rollback to the state described in the rollback object.</p>
+		<div class="arguments">
+			<p><strong>Arguments:</strong> <code class="type">object</code> <code class="fp">data</code></p>
+			<p>This is a rollback object, usually obtained in a callback or by calling <code class="fp">get_rollback</code> on a specific instance.</p>
+		</div>
+
+		<h3>Functions and properties in a tree instance</h3>
+		<h2 id="attach_events">
+			<span>attach_events()</span>
+			<em>Return value: <code class="fp">none</code></em>
+		</h2>
+		<p class="description">This function binds all the events required for user interaction with the tree. It only fires once at creation time. It is used internally.</p>
+
+		<h2 id="callback">
+			<span>callback(callback_name, arguments)</span>
+			<em>Return value: <code class="fp">none</code></em>
+		</h2>
+		<p class="description">This function is used internally. It fires all callbacks.</p>
+		<div class="arguments">
+			<p><strong>Arguments:</strong> <code class="type">string</code> <code class="fp">callback_name</code></p>
+			<p>The callback to fire.</p>
+			<p><code class="type">array</code> <code class="fp">args</code></p>
+			<p>The arguments for the callback.</p>
+		</div>
+
+		<h2 id="check">
+			<span>check(rule, node)</span>
+			<em>Return value: <code class="type">boolean</code></em>
+		</h2>
+		<p class="description">Checks if a certain action is allowed on a node (for example create, delete, rename, etc) and returns <code class="fp">true</code> or <code class="fp">false</code> accordingly. Used mainly internally.</p>
+		<div class="arguments">
+			<p><strong>Arguments:</strong></p> 
+			<p><code class="type">string</code> <code class="fp">rule</code></p>
+			<p>The rule you want to check.</p>
+			<p><code class="type">mixed</code> <code class="fp">node</code></p>
+			<p>A DOM node, jQuery object or selector, pointing to the node you want to check inside the tree.</p>
+		</div>
+
+		<h2 id="check_move">
+			<span>check_move(node, ref_node, move_type)</span>
+			<em>Return value: <code class="type">boolean</code></em>
+		</h2>
+		<p class="description">Checks if a certain move is allowed. Used mainly internally.</p>
+		<div class="arguments">
+			<p><strong>Arguments:</strong></p> 
+			<p><code class="type">mixed</code> <code class="fp">node</code></p>
+			<p>A DOM node, jQuery object or selector, pointing to the node that is being moved.</p>
+			<p><code class="type">mixed</code> <code class="fp">ref_node</code></p>
+			<p>A DOM node, jQuery object or selector, pointing to the reference node.</p>
+			<p><code class="type">string</code> <code class="fp">move_type</code></p>
+			<p>One of <code class="fp">"before"</code>, <code class="fp">"after"</code> or <code class="fp">"inside"</code>.</p>
+		</div>
+
+		<h2 id="children">
+			<span>children(reference_node)</span>
+			<em>Return value: <code class="type">jQuery</code></em>
+		</h2>
+		<p class="description">Get the child nodes of the reference node. Returns <code class="fp">false</code> on failure.</p>
+		<div class="arguments">
+			<p><strong>Arguments:</strong></p> 
+			<p><code class="type">mixed</code> <code class="fp">reference_node</code></p>
+			<p>The reference node. A DOM node, jQuery object or selector, pointing to a node inside the tree.</p>
+		</div>
+
+		<h2 id="close_all">
+			<span>close_all([node])</span>
+		</h2>
+		<p class="description">Closes all nodes, so that their children are not visible. Has no return value, but returns <code class="fp">false</code> on failure (invalid node for example).</p>
+		<div class="arguments"><p><strong>Arguments:</strong></p> 
+			<p><code class="type">mixed</code> <code class="fp">node</code></p>
+			<p>Optional argument. A DOM node, jQuery object or selector, pointing to a node inside the tree. If passed only this node and its children are closed, if not passed - every node in the tree is closed.</p>
+		</div>
+
+		<h2 id="close_branch">
+			<span>close_branch(node [, disable_animation])</span>
+		</h2>
+		<p class="description">Close a node, so that its children are not visible. Has no return value, but returns <code class="fp">false</code> on failure (invalid node for example).</p>
+		<div class="arguments">
+			<p><strong>Arguments:</strong></p> 
+			<p><code class="type">mixed</code> <code class="fp">node</code></p>
+			<p>A DOM node, jQuery object or selector, pointing to a node inside the tree.</p>
+			<p><code class="type">boolean</code> <code class="fp">disable_animation</code></p>
+			<p>Optional argument. If <code class="fp">true</code> is passed, there will be no animation regardless of the settings in the tree config.</p>
+		</div>
+
+		<h2 id="cntr">
+			<span>cntr</span>
+		</h2>
+		<p class="description">The number of the tree. This is used internally.</p>
+
+		<h2 id="copy">
+			<span>copy([node])</span>
+		</h2>
+		<p class="description">Marks a node as copied. A paste operation following the copy operation will create a copy of that node. Has no return value, but returns <code class="fp">false</code> on failure (invalid node for example).</p>
+		<div class="arguments">
+			<p><strong>Arguments:</strong></p> 
+			<p><code class="type">mixed</code> <code class="fp">node</code></p>
+			<p>Optional argument - the node to be copied. A DOM node, jQuery object or selector, pointing to a node inside the tree. If omitted the currently selected node (or nodes) are marked.</p>
+		</div>
+
+		<h2 id="create">
+			<span>create([data, reference_node, position])</span>
+			<em>Return value:  <code class="type">jQuery</code></em>
+		</h2>
+		<p class="description">Create a new node. Please note this function should mainly be used for user interaction and not for populating the tree initially. Returns the newly created node or <code class="fp">false</code> on failure.</p>
+		<div class="arguments">
+			<p><strong>Arguments:</strong></p> 
+			<p><code class="type">object</code> <code class="fp">data</code></p>
+			<p>Optional argument. The object follows the built in JSON structure, so you can specify name (or names if using language versions) for the newly created node, attributes, type of the node, open/closed state, etc. If omitted the new node's type is "default" and as soon as it is inserted the <code class="fp">rename</code> function is called on the node.</p>
+			<p><code class="type">mixed</code> <code class="fp">reference_node</code></p>
+			<p>Optional argument. A DOM node, jQuery object or selector, pointing to a node inside the tree. If <code class="fp">-1</code> is passed a new root node is created. If omitted the currently selected node is used as reference node.</p>
+			<p><code class="type">mixed</code> <code class="fp">position</code></p>
+			<p>Optional argument. Possible values are <code class="fp">"before"</code>, <code class="fp">"after"</code> or <code class="fp">"inside"</code>, which mark the position relative to the reference node. An integer may also be passed - in that case the new node will be created at that specific offset among the reference node's children.</p>
+		</div>
+
+		<h2 id="current_lang">
+			<span>current_lang</span>
+		</h2>
+		<p class="description">The language code of the currently visible language.</p>
+
+		<h2 id="cut">
+			<span>cut([node])</span>
+		</h2>
+		<p class="description">Marks a node as cut. A paste operation following the cut operation will move that node. Has no return value, but returns <code class="fp">false</code> on failure (invalid node for example).</p>
+		<div class="arguments">
+			<p><strong>Arguments:</strong></p> 
+			<p><code class="type">mixed</code> <code class="fp">node</code>
+			<p>Optional argument - the node to be cut. A DOM node, jQuery object or selector, pointing to a node inside the tree. If omitted the currently selected node (or nodes) are marked.</p>
+		</div>
+
+		<h2 id="deselect_branch">
+			<span>deselect_branch(node)</span>
+		</h2>
+		<p class="description">Removes the selected state from a node in the tree. Has no return value, but returns <code class="fp">false</code> on failure (invalid node for example).</p>
+		<div class="arguments">
+			<p><strong>Arguments:</strong></p> 
+			<p><code class="type">mixed</code> <code class="fp">node</code></p>
+			<p>A DOM node, jQuery object or selector, pointing to a node inside the tree.</p>
+		</div>
+
+		<h2 id="destroy">
+			<span>destroy()</span>
+		</h2>
+		<p class="description">Destroys the instance.</p>
+
+		<h2 id="error">
+			<span>error(error_string)</span>
+			<em>Return value: <code class="fp">false</code></em>
+		</h2>
+		<p class="description">All errors go through this function. Used internally.</p>
+		<div class="arguments">
+			<p><strong>Arguments:</strong></p> 
+			<p><code class="type">string</code> <code class="fp">error_string</code></p>
+		</div>
+
+		<h2 id="focus">
+			<span>focus()</span>
+		</h2>
+		<p class="description">This function sets the current tree as the focused one in the page.</p>
+
+		<h2 id="get">
+			<span>get([node, format, options])</span>
+			<em>Return value: <code class="type">mixed</code></em>
+		</h2>
+		<p class="description">Return the whole tree or a part of it in a given format.</p>
+		<div class="arguments">
+			<p><strong>Arguments:</strong></p> 
+			<p><code class="type">mixed</code> <code class="fp">node</code></p>
+			<p>A DOM node, jQuery object or selector, pointing to a node inside the tree. This is the node you want returned, if this argument omitted the whole tree is returned.</p>
+			<p><code class="type">string</code> <code class="fp">format</code></p>
+			<p>Optional argument. The format you want the returned data in. It should be one of the defined datasources. If omitted the tree's current datasource is used.</p>
+			<p><code class="type">object</code> <code class="fp">options</code></p>
+			<p>Optional argument. The options for the datasource - if omitted, the tree's current options are used.</p>
+		</div>
+
+		<h2 id="get_lang">
+			<span>get_lang()</span>
+			<em>Return value: <code class="type">string</code></em>
+		</h2>
+		<p class="description">This function is only useful if language versions are used. Returns the currently visible language or <code class="fp">false</code> on failure.</p>
+
+		<h2 id="get_node">
+			<span>get_node(node)</span>
+			<em>Return value: <code class="type">jQuery</code></em>
+		</h2>
+		<p class="description">This function returns the jQuery extended LI DOM node that represents a given tree node.</p>
+		<div class="arguments">
+			<p><strong>Arguments:</strong></p> 
+			<p><code class="type">mixed</code> <code class="fp">node</code></p>
+			<p>A DOM node, jQuery object or selector, pointing to a node inside the tree.</p>
+		</div>
+
+		<h2 id="get_rollback">
+			<span>get_rollback()</span>
+			<em>Return value: <code class="type">object</code></em>
+		</h2>
+		<p class="description">Returns a rollback object for the tree. The rollback object actually has two properties <code class="fp">html</code> (containing the HTML of the container) and <code class="fp">selected</code> (the ID of the last selected node - if there is one).</p>
+
+		<h2 id="get_text">
+			<span>get_text(node [, language])</span>
+			<em>Return value: <code class="type">string</code></em>
+		</h2>
+		<p class="description">This function returns the title of the node passed as first parameter.</p>
+		<div class="arguments">
+			<p><strong>Arguments:</strong></p> 
+			<p><code class="type">mixed</code> <code class="fp">node</code></p>
+			<p>A DOM node, jQuery object or selector, pointing to a node inside the tree.</p>
+			<p><code class="type">string</code> <code class="fp">language</code></p>
+			<p>This parameter is optional and only useful if language versions are used. You may specify the language in which you want the title (it should be one of the defined languages). If you ommit this parameter the title is returned in the currently visible language.</p>
+		</div>
+
+		<h2 id="get_type">
+			<span>get_type(node)</span>
+			<em>Return value: <code class="type">string</code></em>
+		</h2>
+		<p class="description">This function returns the type of a node (types are used to determine nesting/interaction rules). The function returns <code class="fp">"default"</code> if no type attribute is found.</p>
+		<div class="arguments">
+			<p><strong>Arguments:</strong></p> 
+			<p><code class="type">mixed</code> <code class="fp">node</code></p>
+			<p>A DOM node, jQuery object or selector, pointing to a node inside the tree.</p>
+		</div>
+
+		<h2 id="hover_branch">
+			<span>hover_branch(node)</span>
+		</h2>
+		<p class="description">Sets a node in the tree as hovered. Has no return value, but returns <code class="fp">false</code> on failure (invalid node for example).</p>
+		<div class="arguments">
+			<p><strong>Arguments:</strong></p> 
+			<p><code class="type">mixed</code> <code class="fp">node</code></p>
+			<p>A DOM node, jQuery object or selector, pointing to a node inside the tree.</p>
+		</div>
+
+		<h2 id="init">
+			<span>init(element [, config])</span>
+		</h2>
+		<p class="description">This function initializes a tree in the given container element, using the optional config passed as a parameter. Usually used after <code class="fp">create()</code>.</p>
+		<div class="arguments">
+			<p><strong>Arguments:</strong></p> 
+			<p><code class="type">mixed</code> <code class="fp">element</code></p>
+			<p>This is a DOM node, jQuery object, or a valid jQuery selector, pointing to a container element. This parameter is required.</p>
+			<p><code class="type">object</code> <code class="fp">config</code></p>
+			<p>An optional object, specifing all the options for the tree (or trees) that will be created. This object internally extends the global defaults object. So you may only pass values that are different from the defaults.</p>
+		</div>
+
+		<h2 id="lock">
+			<span>lock(state)</span>
+		</h2>
+		<p class="description">Locks or unlocks the tree instance. A locked tree blocks all user interactions.</p>
+		<div class="arguments">
+			<p><strong>Arguments:</strong></p> 
+			<p><code class="type">boolean</code> <code class="fp">state</code></p>
+			<p>To lock or unlock (<code class="fp">true</code> means lock).</p>
+		</div>
+
+		<h2 id="locked">
+			<span>locked</span>
+		</h2>
+		<p class="description">A boolean indicating the lock state of the tree.</p>
+
+		<h2 id="moved">
+			<span>moved(what, where, how [, is_new, is_copy, rollback])</span>
+			<em>Return value: <code class="type">jQuery</code></em>
+		</h2>
+		<p class="description">This function is used internally. It performs all moves and manipulates the DOM. Returns the moved node, but there is no return value if there are multiple moves to be performed or the required data is not yet loaded.</p>
+		<div class="arguments">
+			<p><strong>Arguments:</strong></p> 
+			<p><code class="type">mixed</code> <code class="fp">what</code></p>
+			<p>The node (or nodes) to move/copy/create. A DOM node, jQuery object or selector, pointing to a node inside the tree.</p>
+			<p><code class="type">mixed</code> <code class="fp">where</code></p>
+			<p>The reference node in the operation. A DOM node, jQuery object or selector, pointing to a node inside the tree.</p>
+			<p><code class="type">string</code> <code class="fp">how</code></p>
+			<p>One of <code class="fp">"before"</code>, <code class="fp">"after"</code> or <code class="fp">"inside"</code>.</p>
+			<p><code class="type">boolean</code> <code class="fp">is_new</code></p>
+			<p>If it is a create operation.</p>
+			<p><code class="type">boolean</code> <code class="fp">is_copy</code></p>
+			<p>If it is a copy operation.</p>
+			<p><code class="type">object</code> <code class="fp">rollback</code></p>
+			<p>The rollback object created in the first call to the <code class="fp">moved</code> function.</p>
+		</div>
+
+		<h2 id="next">
+			<span>next(reference_node [, strict])</span>
+			<em>Return value: <code class="type">jQuery</code></em>
+		</h2>
+		<p class="description">Get the node next to the reference node. Returns <code class="fp">false</code> on failure.</p>
+		<div class="arguments">
+			<p><strong>Arguments:</strong></p> 
+			<p><code class="type">mixed</code><code class="fp">reference_node</code></p>
+			<p>The reference node. A DOM node, jQuery object or selector, pointing to a node inside the tree.</p>
+			<p><code class="type">boolean</code><code class="fp">strict</code></p>
+			<p>Optional argument - if set to <code class="fp">true</code> only siblings are returned (nodes within the same parent as the reference node). If not present or <code class="fp">false</code> behaves like in Windows explorer - when the last child is the reference node the next sibling of the parent node is returned.</p>
+		</div>
+
+		<h2 id="off_height">
+			<span>off_height()</span>
+		</h2>
+		<p class="description">This function computates the offset of the tree's container node, and also the height of a single node. It is used internally.</p>
+
+		<h2 id="open_all">
+			<span>open_all([node, callback])</span>
+		</h2>
+		<p class="description">Open all nodes, so that their children are visible. Returns <code class="fp">false</code> on failure.</p>
+		<div class="arguments">
+			<p><strong>Arguments:</strong></p> 
+			<p><code class="type">mixed</code> <code class="fp">node</code></p>
+			<p>Optional argument. A DOM node, jQuery object or selector, pointing to a node inside the tree. If passed only this node and its children are opened, if not passed - every node in the tree is opened.</p>
+			<p><code class="type">function</code> <code class="fp">callback</code></p>
+			<p>Optional argument. A function to be executed once the operation is complete. Used internally, if you need similiar functionality use the <code class="fp">onopen_all</code> callback.</p>
+		</div>
+
+		<h2 id="open_branch">
+			<span>open_branch(node [, disable_animation, callback])</span>
+			<em>Return value: <code class="type">boolean</code></em>
+		</h2>
+		<p class="description">Open a node, so that its children are visible. Returns <code class="fp">true</code> if succesfull, <code class="fp">false</code> if not.</p>
+		<div class="arguments"><p><strong>Arguments:</strong></p> 
+			<p><code class="type">mixed</code> <code class="fp">node</code></p>
+			<p>A DOM node, jQuery object or selector, pointing to a node inside the tree.</p>
+			<p><code class="type">boolean</code> <code class="fp">disable_animation</code></p>
+			<p>Optional argument. If <code class="fp">true</code> is passed, there will be no animation regardless of the settings in the tree config.</p>
+			<p><code class="type">function</code> <code class="fp">callback</code></p>
+			<p>Optional argument. A function to be executed once the operation is complete. Used internally, if you need similiar functionality use the <code class="fp">onopen</code> callback.</p>
+		</div>
+
+		<h2 id="parent">
+			<span>parent(reference_node)</span>
+			<em>Return value: <code class="type">mixed</code></em>
+		</h2>
+		<p class="description">Get the parent node of the reference node. Normally returns a <code class="type">jQuery</code> extended node, but will return <code class="fp">-1</code> if a root node is passed as reference node, or <code class="fp">false</code> on failure (invalid reference node for exmaple).</p>
+		<div class="arguments">
+			<p><strong>Arguments:</strong></p> 
+			<p><code class="type">mixed</code> <code class="fp">reference_node</code></p>
+			<p>The reference node. A DOM node, jQuery object or selector, pointing to a node inside the tree.</p>
+		</div>
+
+		<h2 id="paste">
+			<span>paste([node, position])</span>
+		</h2>
+		<p class="description">Pastes any copied or cut nodes in the new position. Has no return value, but will return <code class="fp">false</code> on failure.</p>
+		<div class="arguments">
+			<p><strong>Arguments:</strong></p> 
+			<p><code class="type">mixed</code> <code class="fp">node</code></p>
+			<p>Optional argument - the reference node in the operation. A DOM node, jQuery object or selector, pointing to a node inside the tree. If omitted the currently selected node (or nodes) are marked.</p>
+			<p><code class="type">mixed</code> <code class="fp">position</code></p>
+			<p>Optional argument. Possible values are <code class="fp">"before"</code>, <code class="fp">"after"</code> or <code class="fp">"inside"</code>, which mark the position relative to the reference node. An integer may also be passed - in that case the node will be moved/copied at that speicific offset among the reference node's children.</p>
+		</div>
+
+		<h2 id="prev">
+			<span>prev(reference_node [, strict])</span>
+			<em>Return value: <code class="type">jQuery</code></em>
+		</h2>
+		<p class="description">Get the node previous to the reference node. Returns <code class="fp">false</code> on failure.</p>
+		<div class="arguments">
+			<p><strong>Arguments:</strong></p> 
+			<p><code class="type">mixed</code> <code class="fp">reference_node</code></p>
+			<p>The reference node. A DOM node, jQuery object or selector, pointing to a node inside the tree.</p>
+			<p><code class="type">boolean</code> <code class="fp">strict</code></p>
+			<p>Optional argument - if set to <code class="fp">true</code> only siblings are returned (nodes within the same parent as the reference node). If not present or <code class="fp">false</code> behaves like in Windows explorer - when a first child is the reference node the parent node is returned.</p>
+		</div>
+
+		<h2 id="refresh">
+			<span>refresh([element])</span>
+		</h2>
+		<p class="description">This function refreshes the whole tree, or a given node (if passed as a parameter). Opened nodes and selected nodes are saved and reopened/reselected (the <code class="fp">reselect</code> function is used for reselecting and reopening).</p>
+		<div class="arguments">
+			<p><strong>Arguments:</strong></p> 
+			<p><code class="type">mixed</code> <code class="fp">element</code></p>
+			<p>This is a DOM node, jQuery object, or a valid jQuery selector, pointing to a node in the tree. If this parameter is passed, only that node is refreshed, if this parameter is absent, the whole tree is refreshed.</p>
+		</div>
+
+		<h2 id="remove">
+			<span>remove([node])</span>
+		</h2>
+		<p class="description">Removes a node. Has no return value, but will return <code class="fp">false</code> on failure.</p>
+		<div class="arguments">
+			<p><strong>Arguments:</strong></p> 
+			<p><code class="type">mixed</code> <code class="fp">node</code></p>
+			<p>Optional argument - the node to be removed. A DOM node, jQuery object or selector, pointing to a node inside the tree. If omitted the currently selected node is removed.</p>
+		</div>
+
+		<h2 id="rename">
+			<span>rename([node, new_name])</span>
+		</h2>
+		<p class="description">Rename a node. If language versions are used only the title in the currently visible language is modified. Has no return value, but will return <code class="fp">false</code> on failure.</p>
+		<div class="arguments">
+			<p><strong>Arguments:</strong></p> 
+			<p><code class="type">mixed</code> <code class="fp">node</code></p>
+			<p>Optional argument - the node to be renamed. A DOM node, jQuery object or selector, pointing to a node inside the tree. If omitted the currently selected node is renamed.</p>
+			<p><code class="type">string</code> <code class="fp">new_name</code></p>
+			<p>Optional argument - the new name. If omitted - an input box is displayed.</p>
+		</div>
+
+		<h2 id="reselect">
+			<span>reselect([is_callback])</span>
+		</h2>
+		<p class="description">This function reselects and reopens nodes in the tree after a refresh. It is used internally.</p>
+		<div class="arguments">
+			<p><strong>Arguments:</strong></p> 
+			<p><code class="type">boolean</code> <code class="fp">is_callback</code></p>
+			<p>As the function sometimes calls recursively this parameter shows if this is a recursive call, or the first one.</p>
+		</div>
+
+		<h2 id="scroll_check">
+			<span>scroll_check(x, y)</span>
+		</h2>
+		<p class="description">This function detects the need to scroll and scrolls the container (if neccessary) while the user drags a node (or nodes). It is used internally.</p>
+		<div class="arguments">
+			<p><strong>Arguments:</strong></p>
+			<p><code class="type">number</code> <code class="fp">x</code></p>
+			<p>The x coordinate to check.</p>
+			<p><code class="type">number</code> <code class="fp">y</code></p>
+			<p>The y coordinate to check.</p>
+		</div>
+
+		<h2 id="scroll_into_view">
+			<span>scroll_into_view([node])</span>
+		</h2>
+		<p class="description">This function scrolls the container node so that the node passed as parameter is in view. If the parameter is missing the currently selected node is used.</p>
+		<div class="arguments">
+			<p><strong>Arguments:</strong></p> 
+			<p><code class="type">mixed</code> <code class="fp">node</code></p>
+			<p>A DOM node, jQuery object or selector, pointing to a node inside the tree.</p>
+		</div>
+
+		<h2 id="search">
+			<span>search(needle [, compare_function])</span>
+		</h2>
+		<p class="description">Searches all nodes whose titles match a given string. If async is used a request is made to the server, the response should contain the comma-separated IDs of nodes that need to be opened so that all nodes that match the search string are visible. The search string is provided in the request. The function triggers the <code class="fp">onsearch</code> callback, with the nodes found as a parameter.</p>
+		<div class="arguments">
+			<p><strong>Arguments:</strong></p> 
+			<p><code class="type">string</code> <code class="fp">needle</code></p>
+			<p>The search string.</p>
+			<p><code class="type">string</code> <code class="fp">compare_function</code></p>
+			<p>Optional argument. The jQuery function to be used for comparing titles to the string - defaults to <code class="fp">"contains"</code>.</p>
+		</div>
+
+		<h2 id="selected">
+			<span>selected</span>
+		</h2>
+		<p class="description">The currently selected jQuery extended node (if mutliselect is possible this holds the lastly selected node).</p>
+
+		<h2 id="selected_arr">
+			<span class="fp">selected_arr</span>
+		</h2>
+		<p class="description">An array of jQuery extended DOM nodes that are currently selected.</p>
+
+		<h2 id="select_branch">
+			<span>select_branch(node [, is_multiple])</span>
+		</h2>
+		<p class="description">Sets a node in the tree as selected. Has no return value but will return <code class="fp">false</code> on failure (invalid node for example).</p>
+		<div class="arguments">
+			<p><strong>Arguments:</strong></p> 
+			<p><code class="type">mixed</code> <code class="fp">node</code></p>
+			<p>A DOM node, jQuery object or selector, pointing to a node inside the tree.</p>
+			<p><code class="type">boolean</code> <code class="fp">is_multiple</code></p>
+			<p>Optional argument. If <code class="fp">true</code> is passed, it will trigger multiselect (the previously selected node won't be deselected, but the both nodes will be selected).</p>
+		</div>
+
+		<h2 id="settings">
+			<span>settings</span>
+		</h2>
+		<p class="description">All the settings for the current tree. You can modify some of the properties at runtime.</p>
+
+		<h2 id="set_lang">
+			<span>set_lang(lang)</span>
+			<em>Return value: <code class="type">boolean</code></em>
+		</h2>
+		<p class="description">This function is only useful if language versions are used. Sets the current language to the specified one so that the tree is visible in that language. Returns <code class="fp">true</code> on success and <code class="fp">false</code> otherwise.</p>
+		<div class="arguments">
+			<p><strong>Arguments:</strong></p> 
+			<p><code class="type">mixed</code> <code class="fp">lang</code></p>
+			<p>Either one of the language strings defined in the tree's config, or its key in the array.</p>
+		</div>
+
+		<h2 id="set_type">
+			<span>set_type(type [, node])</span>
+		</h2>
+		<p class="description">This function sets the type of a node to a given value (types are used to determine nesting/interaction rules).</p>
+		<div class="arguments">
+			<p><strong>Arguments:</strong></p> 
+			<p><code class="type">string</code> <code class="fp">type</code></p>
+			<p>The new type of the node.</p>
+			<p><code class="type">mixed</code> <code class="fp">node</code></p>
+			<p>A DOM node, jQuery object or selector, pointing to a node inside the tree. This argument is optional - if not specified - the currently selected node is used.</p>
+		</div>
+
+		<h2 id="toggle_branch">
+			<span>toggle_branch(node)</span>
+			<em>Return value: <code class="type">boolean</code></em>
+		</h2>
+		<p class="description">Toggles the opened/closed state of the node. Returns <code class="fp">true</code> on success and <code class="fp">false</code> otherwise.</p>
+		<div class="arguments">
+			<p><strong>Arguments:</strong></p> 
+			<p><code class="type">mixed</code> <code class="fp">node</code></p>
+			<p>A DOM node, jQuery object or selector, pointing to a node inside the tree.</p>
+		</div>
+
+		<h2 id="toggle_dots">
+			<span>toggle_dots()</span>
+		</h2>
+		<p class="description">Turns dots on or off.</p>
+
+		<h2 id="others">
+			<span>others</span>
+		</h2>
+		<p class="description">A few other variables may emerge at runtime, but they are only used internally, such as: <code class="fp">srch</code> , <code class="fp">srch_opn</code> , <code class="fp">hovered</code> , <code class="fp">offset</code> , <code class="fp">is_partial_refresh</code> , <code class="fp">opened</code> , <code class="fp">cl_count</code> , <code class="fp">li_height</code> , <code class="fp">inp</code>.</p>
+	</div>
+</div></body></html>

Added: trunk/mapbender/http/extensions/jsTree.v.0.9.9a2/documentation_plugins.html
===================================================================
--- trunk/mapbender/http/extensions/jsTree.v.0.9.9a2/documentation_plugins.html	                        (rev 0)
+++ trunk/mapbender/http/extensions/jsTree.v.0.9.9a2/documentation_plugins.html	2010-04-29 14:24:49 UTC (rev 6040)
@@ -0,0 +1,359 @@
+<!DOCTYPE html
+PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
+"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+	<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
+	<title>jsTree bundled plugins documentation</title>
+	<style type="text/css">
+	html, body { padding:0; margin:0; background:white; }
+	body, input, th, td, select, option { font-family:"Trebuchet MS",Verdana,Helvetica,Arial,sans-serif !important; font-size:62.5%; color:black; }
+	#container { width:800px; margin:0 auto; }
+	h1 { background:#1B3A6D; color:white; font-size:1.6em; margin:10px 0 1px 0; padding:0 0 0 1em; letter-spacing:0; line-height:25px; font-weight:normal; border-radius:5px; -moz-border-radius:5px; }
+	h2 { background:#E2EDF4; color:#1B3A6D; font-size:11pt; margin:0 0 0.5em 0; padding:0 0 0 1em; letter-spacing:0; line-height:25px; font-weight:normal; border-radius:5px; -moz-border-radius:5px; overflow:hidden; }
+	h3 { background:gray; color:white; font-size:11pt; margin:1.5em 0 1px 0; padding:0 0 0 1em; letter-spacing:0; line-height:25px; font-weight:normal; border-radius:5px; -moz-border-radius:5px; overflow:hidden; }
+	pre, p { font-size:10pt; line-height:1.6em; padding:0 1em; margin:0 0 0.5em 0; }
+	pre, code { font-size:10pt; }
+	.fp { color:navy; }
+	.type { color:green; }
+	h2 span { float:left; line-height:25px; }
+	h2 em { float:right; width:200px; font-size:10pt; line-height:25px; color:gray; margin:0; padding:0; font-style:none; }
+	h2 em code { padding:0 5px; }
+	.arguments { margin-bottom:10px; }
+	.arguments p { margin-bottom:0; }
+	.arguments strong, .arguments code { display:block; }
+	.arguments .inner_description { display:block; }
+	.arguments ul { list-style-type:none; }
+	.arguments code { display:inline; float:none; margin:0; }
+	.arguments li p { padding:0; }
+	.indent { margin-left:50px; }
+
+	@media print { 
+		#container { width:auto; margin:0 1em; }
+		h1, h2, h3 { page-break-after:avoid; }
+	}
+	</style>
+</head>
+<body>
+	<div id="container">
+		<p style="line-height:20px; margin-top:10px; color:gray;">Go to: <a href="#checkbox">Checkbox</a> | <a href="#contextmenu">Contextmenu</a> | <a href="#cookie">Cookie</a> | <a href="#hotkeys">Hotkeys</a> | <a href="#metadata">Metadata</a> | <a href="#themeroller">Themeroller</a> | <a href="#xml_flat">XML flat</a> | <a href="#xml_nested">XML nested</a></p>
+
+		<p class="description">To be able to use any plugin, all you need to do is include its source:</p>
+		<p><code class="fp">&lt;script type=&quot;text/javascript&quot; src=&quot;</code><code class="type">path-to-source/jquery.tree.plugin.js</code><code class="fp">&quot;&gt;&lt;/script&gt;</code></p>
+
+		<p class="description">If you included a datastore you can already use it in any instance with the <code class="fp">get</code> function. Or to use it to populate an entire tree - check the <code class="fp">data.type</code> config option.</p>
+		<p class="description">If the included plugin is not a datasore you need to activate it for every instance you want to use it, or just activate it for all instances. To activate it on an instance check the <code class="fp">plugins</code> config option. To activate it on all instances modify the <code class="fp">jQuery.tree.defaults</code> object - all instances created AFTER the modification will have the plugin enabled.</p>
+		<p class="description">To just activate the plugin without modifying any options (if available) use this code in the <code class="fp">plugins</code> section:</p>
+<pre class="fp">
+plugins : {
+	"plugin-name" : { }
+}
+</pre>
+		<p class="description">To modify any of the options (if available) use this code in the <code class="fp">plugins</code> section:</p>
+<pre class="fp">
+plugins : {
+	"plugin-name" : { option : value, other-option : other-value }
+}
+</pre>
+
+		<h1 id="checkbox">Checkbox</h1>
+		<p class="description">Converts a tree to a checkbox three where each node can be checked, unchecked or undetermined (if for example it has two children and one of the is checked and the other isn't). To get the visual feedback it is recommended to use the "checkbox" theme or define your own classes to handle the visualization of the items.</p>
+		<h3>Options</h3>
+		<h2 id="checkbox.three_state">
+			<span>three_state</span>
+			<em><code class="type">Boolean</code></em>
+		</h2>
+		<p class="description">If set to <code class="fp">true</code> each node will respect the state of its children - like an options tree in windows, so the "undetermined" state will be available. If set to <code class="fp">false</code> each node is either checked or not, regardless of its children states.</p>
+		<p class="description">Default is: <code class="fp">true</code></p>
+
+		<h3>Functions</h3>
+		<h2 id="tree.plugins.checkbox.get_checked">
+			<span>jQuery.tree.plugins.checkbox.get_checked([ tree ])</span>
+			<em>Return value: <code class="type">jQuery</code></em>
+		</h2>
+		<p class="description">This functions returns a collection of all checked nodes within a tree.</p>
+		<div class="arguments">
+			<p>
+				<strong>Arguments:</strong>
+				<code class="type">jsTree</code> <code class="fp">tree</code>
+			</p>
+			<p>The instance to use - defaults to the currently focused tree.</p>
+		</div>
+
+		<h2 id="tree.plugins.checkbox.get_unchecked">
+			<span>jQuery.tree.plugins.checkbox.get_unchecked([ tree ])</span>
+			<em>Return value: <code class="type">jQuery</code></em>
+		</h2>
+		<p class="description">This functions returns a collection of all unchecked nodes within a tree.</p>
+		<div class="arguments">
+			<p>
+				<strong>Arguments:</strong>
+				<code class="type">jsTree</code> <code class="fp">tree</code>
+			</p>
+			<p>The instance to use - defaults to the currently focused tree.</p>
+		</div>
+
+		<h2 id="tree.plugins.checkbox.get_undetermined">
+			<span>jQuery.tree.plugins.checkbox.get_undetermined([ tree ])</span>
+			<em>Return value: <code class="type">jQuery</code></em>
+		</h2>
+		<p class="description">This functions returns a collection of all undetermined nodes within a tree.</p>
+		<div class="arguments">
+			<p>
+				<strong>Arguments:</strong>
+				<code class="type">jsTree</code> <code class="fp">tree</code>
+			</p>
+			<p>The instance to use - defaults to the currently focused tree.</p>
+		</div>
+
+		<h2 id="tree.plugins.checkbox.uncheck">
+			<span>jQuery.tree.plugins.checkbox.uncheck(node)</span>
+			<em>Return value: <code class="type">Boolean</code></em>
+		</h2>
+		<p class="description">This functions unchecks a node.</p>
+		<div class="arguments">
+			<p>
+				<strong>Arguments:</strong>
+				<code class="type">mixed</code> <code class="fp">node</code>
+			</p>
+			<p>A DOM node, jQuery object or selector, pointing to the node you want to uncheck inside the tree.</p>
+		</div>
+
+		<h2 id="tree.plugins.checkbox.check">
+			<span>jQuery.tree.plugins.checkbox.check(node)</span>
+			<em>Return value: <code class="type">Boolean</code></em>
+		</h2>
+		<p class="description">This functions checks a node.</p>
+		<div class="arguments">
+			<p>
+				<strong>Arguments:</strong>
+				<code class="type">mixed</code> <code class="fp">node</code>
+			</p>
+			<p>A DOM node, jQuery object or selector, pointing to the node you want to check inside the tree.</p>
+		</div>
+
+
+		<h1 id="contextmenu">Contextmenu</h1>
+		<p class="description">Enables a custom context menu in the tree. Please not this does not work in Opera, as the browser has a policy against custom context menus.</p>
+		<h3>Options</h3>
+		<h2 id="contextmenu.class_name">
+			<span>class_name</span>
+			<em><code class="type">String</code></em>
+		</h2>
+		<p class="description">A class name to use on the item that invoked the context menu.</p>
+		<p class="description">Default is: <code class="fp">"hover"</code></p>
+
+		<h2 id="contextmenu.items">
+			<span>items</span>
+			<em><code class="type">Object</code></em>
+		</h2>
+		<p class="description">An object containing all the items of the context menu.</p>
+		<p class="description">Default is:</p>
+<pre class="fp">
+items : {
+	create : {
+		label	: "Create", 
+		icon	: "create",
+		visible	: function (NODE, TREE_OBJ) { 
+			if(NODE.length != 1) return 0; 
+			return TREE_OBJ.check("creatable", NODE); 
+		}, 
+		action	: function (NODE, TREE_OBJ) { 
+			TREE_OBJ.create(false, TREE_OBJ.get_node(NODE[0])); 
+		},
+		separator_after : true
+	},
+	rename : {
+		label	: "Rename", 
+		icon	: "rename",
+		visible	: function (NODE, TREE_OBJ) { 
+			if(NODE.length != 1) return false; 
+			return TREE_OBJ.check("renameable", NODE); 
+		}, 
+		action	: function (NODE, TREE_OBJ) { 
+			TREE_OBJ.rename(NODE); 
+		} 
+	},
+	remove : {
+		label	: "Delete",
+		icon	: "remove",
+		visible	: function (NODE, TREE_OBJ) { 
+			var ok = true; 
+			$.each(NODE, function () { 
+				if(TREE_OBJ.check("deletable", this) == false) {
+					ok = false; 
+					return false; 
+				}
+			}); 
+			return ok; 
+		}, 
+		action	: function (NODE, TREE_OBJ) { 
+			$.each(NODE, function () { 
+				TREE_OBJ.remove(this); 
+			}); 
+		} 
+	}
+}
+</pre>
+		<div class="indent">
+			<p>Each item consists of a few settings:</p>
+
+			<h2 id="contextmenu.item.label">
+				<span>label</span>
+				<em><code class="type">String</code></em>
+			</h2>
+			<p>The label of the menu item.</p>
+
+			<h2 id="contextmenu.item.icon">
+				<span>icon</span>
+				<em><code class="type">String</code></em>
+			</h2>
+			<p>The icon used infront of the menu item - if left blank - no icon is shown. If the string contains a <code class="fp">/</code> it is interpreted as a path to an image, otherwise it is used as a class that you can style yourself using a selector like:<br /><code class="fp">.tree-<em style="color:red;">theme_name_here</em>-context a ins.<em style="color:red;">icon-string-here</em> { }</code></p>
+
+			<h2 id="contextmenu.item.visible">
+				<span>visible(node, tree)</span>
+				<em>Should return: <code class="type">1, 0 or -1</code></em>
+			</h2>
+			<p>This function is called just before the context menu is shown. You receive the node the menu is invoked on and the tree instance as arguments. You can hide or disable some of the items. <code class="fp">1</code> means show, <code class="fp">0</code> means disable and <code class="fp">-1</code> means hide.</p>
+
+			<h2 id="contextmenu.item.action">
+				<span>action(node, tree)</span>
+			</h2>
+			<p>This function is called when this specific menu item is clicked. You receive the node the menu is invoked on and the tree instance as arguments.</p>
+		</div>
+
+		<h1 id="cookie">Cookie</h1>
+		<p class="description">Enables the user to save the state of the tree across sessions. What this basically does is save the opened and selected nodes in a cookie, and reopens/reselects them the next time the user uses the tree. Depends on the jQuery Cookie plugin, which can be found in the <code class="type">lib/</code> folder.</p>
+		<h3>Options</h3>
+		<h2 id="cookie.prefix">
+			<span>prefix</span>
+			<em><code class="type">String</code></em>
+		</h2>
+		<p class="description">A prefix to prepent on all cookies created by that specific instance. Useful if you have multiple trees.</p>
+		<p class="description">Default is: <code class="fp">""</code></p>
+
+		<h2 id="cookie.options">
+			<span>options</span>
+			<em><code class="type">Object</code></em>
+		</h2>
+		<p class="description">All the options used in the jQuery Cookie plugin.</p>
+		<p class="description">Default is:</p>
+<pre class="fp">
+options : { 
+	expires: false, 
+	path: false, 
+	domain: false, 
+	secure: false 
+}
+</pre>
+		<h2 id="cookie.types">
+			<span>types</span>
+			<em><code class="type">Object</code></em>
+		</h2>
+		<p class="description">An object of Boolean values storing which cookies should be set (currently <code class="fp">selected</code> and <code class="fp">open</code> are the only options). If you don't want to save the selected state of the tree (for example) just set <code class="fp">selected</code> to <code class="fp">false</code>.</p>
+		<p class="description">Default is:</p>
+<pre class="fp">
+types : {
+	selected	: true,
+	open		: true
+}
+</pre>
+
+		<h2 id="cookie.keep_selected">
+			<span>keep_selected</span>
+			<em><code class="type">Boolean</code></em>
+		</h2>
+		<p class="description">If some nodes are marked for selection in the config of the tree (using <code class="fp">selected</code>) should the plugin respect those or remove them.</p>
+		<p class="description">Default is: <code class="fp">false</code></p>
+
+		<h2 id="cookie.keep_opened">
+			<span>keep_opened</span>
+			<em><code class="type">Boolean</code></em>
+		</h2>
+		<p class="description">If some nodes are marked for opening in the config of the tree (using <code class="fp">opened</code>) should the plugin respect those or remove them.</p>
+		<p class="description">Default is: <code class="fp">false</code></p>
+
+		<h1 id="hotkeys">Hotkeys</h1>
+		<p class="description">Enables keyboard navigation on the tree. Depends on the jQuery Hotkeys plugin, which can be found in the <code class="type">lib/</code> folder.</p>
+		<h3>Options</h3>
+		<h2 id="hotkeys.hover_move">
+			<span>hover_move</span>
+			<em><code class="type">Boolean</code></em>
+		</h2>
+		<p class="description">Should the navigation functions only move the hover state or change the selected node.</p>
+		<p class="description">Default is: <code class="fp">false</code>, meaning the selected node is changed.</p>
+
+		<h2 id="hotkeys.functions">
+			<span>functions</span>
+			<em><code class="type">Object</code></em>
+		</h2>
+		<p class="description">Each key in this object is a string representing a keyboard button (or combination of buttons) and its value is the function to be executed. In the function <code class="fp">this</code> points to the tree instance.</p>
+		<p class="description">Default is: </p>
+<pre class="fp">
+functions : {
+	"up"	: function () { $.tree.plugins.hotkeys.get_prev.apply(this); return false; },
+	"down"	: function () { $.tree.plugins.hotkeys.get_next.apply(this); return false; },
+	"left"	: function () { $.tree.plugins.hotkeys.get_left.apply(this); return false; },
+	"right"	: function () { $.tree.plugins.hotkeys.get_right.apply(this); return false; },
+	"f2"	: function () { if(this.selected) this.rename(); return false; },
+	"del"	: function () { if(this.selected) this.remove(); return false; },
+	"ctrl+c": function () { if(this.selected) this.copy(); return false; },
+	"ctrl+x": function () { if(this.selected) this.cut(); return false; },
+	"ctrl+v": function () { if(this.selected) this.paste(); return false; }
+}
+</pre>
+
+		<h1 id="metadata">Metadata</h1>
+		<p class="description">Enables inline rule definitions (such as clickable, deletable, etc). You can define those in an arbitrary attribute. Each bundled datastore provides the ability to pass attributes, so that should not be an issue. Depends on the jQuery Metadata plugin, which can be found in the <code class="type">lib/</code> folder.</p>
+		<h3>Options</h3>
+		<h2 id="metadata.attribute">
+			<span>attribute</span>
+			<em><code class="type">Sting</code></em>
+		</h2>
+		<p class="description">The attribute used for storing metadata.</p>
+		<p class="description">Default is: <code class="fp">"data"</code>.</p>
+
+		<h1 id="themeroller">Themeroller</h1>
+		<p class="description">Enables the tree to use the Themeroller (jQuery UI) styles by assigning various classes provided by the library. It is neccessary to use the "themeroller" theme when using this plugin.</p>
+
+		<h1 id="xml_flat">XML flat</h1>
+		<p>A datastore - depends on Sarrissa for transformations - Sarrissa can be found in the <code class="type">lib/</code> folder. Supports <code class="fp">async</code> and the <code class="fp">static</code> option (check the <code class="fp">data.opts</code> config option). Data should follow this structure:</p>
+<pre class="fp">
+&lt;root&gt;
+	&lt;item id=&quot;node_id&quot; parent_id=&quot;the_parent_node_id&quot; state=&quot;open&quot; attribute=&quot;value&quot;&gt;
+		&lt;content&gt;
+			&lt;name lang=&quot;language_code&quot; icon=&quot;&quot;&gt;&lt;![CDATA[Root node 1]]&gt;&lt;/name&gt;
+		&lt;/content&gt;
+	&lt;/item&gt;
+	&lt;item id=&quot;node_id&quot; parent_id=&quot;the_parent_node_id&quot; state=&quot;open&quot; attribute=&quot;value&quot;&gt;
+		&lt;content&gt;
+			&lt;name lang=&quot;language_code&quot; icon=&quot;&quot;&gt;&lt;![CDATA[Root node 2]]&gt;&lt;/name&gt;
+		&lt;/content&gt;
+	&lt;/item&gt;
+&lt;/root&gt;
+</pre>
+<p>For root nodes or when using async set <code class="fp">parent_id</code> to 0. All attributes of <code class="fp">&lt;item&gt;</code> nodes get copied over to the resulting <code class="fp">&lt;li&gt;</code> nodes. All attributes you set on <code class="fp">&lt;name&gt;</code> nodes get copied over to the resulting <code class="fp">&lt;a&gt;</code> nodes. Each language is represented by a <code class="fp">&lt;name&gt;</code> node. If you use only one language you may omit the <code class="fp">lang</code> attribute. Use the <code class="fp">icon</code> attribute only for a custom icon - otherwise theme and type icons are applied.</p>
+
+		<h1 id="xml_nested">XML nested</h1>
+		<p>A datastore - depends on Sarrissa for transformations - Sarrissa can be found in the <code class="type">lib/</code> folder. Supports <code class="fp">async</code> and the <code class="fp">static</code> option (check the <code class="fp">data.opts</code> config option). The structure is the same as in XML flat with all the same clarifications, the only thing different is that you should not set a <code class="fp">parent_id</code> attribute on <code class="fp">&lt;item&gt;</code> nodes and you should instead nest the nodes. Like so:
+<pre class="fp">
+&lt;root&gt;
+	&lt;item id=&quot;node_id&quot; state=&quot;open&quot; attribute=&quot;value&quot;&gt;
+		&lt;content&gt;
+			&lt;name&gt;&lt;![CDATA[Root node 1]]&gt;&lt;/name&gt;
+		&lt;/content&gt;<span style="color:red;">
+		&lt;item id=&quot;node_id&quot; state=&quot;open&quot; attribute=&quot;value&quot;&gt;
+			&lt;content&gt;
+				&lt;name&lt;![CDATA[Child node 1]]&gt;&lt;/name&gt;
+			&lt;/content&gt;
+		&lt;/item&gt;</span>
+	&lt;/item&gt;
+	&lt;item id=&quot;node_id&quot; attribute=&quot;value&quot;&gt;
+		&lt;content&gt;
+			&lt;name&gt;&lt;![CDATA[Root node 2]]&gt;&lt;/name&gt;
+		&lt;/content&gt;
+	&lt;/item&gt;
+&lt;/root&gt;
+</pre>
+
+</div></body></html>

Added: trunk/mapbender/http/extensions/jsTree.v.0.9.9a2/jquery.tree.js
===================================================================
--- trunk/mapbender/http/extensions/jsTree.v.0.9.9a2/jquery.tree.js	                        (rev 0)
+++ trunk/mapbender/http/extensions/jsTree.v.0.9.9a2/jquery.tree.js	2010-04-29 14:24:49 UTC (rev 6040)
@@ -0,0 +1,2064 @@
+/*
+ * jsTree 0.9.9a
+ * http://jstree.com/
+ *
+ * Copyright (c) 2009 Ivan Bozhanov (vakata.com)
+ *
+ * Dual licensed under the MIT and GPL licenses:
+ *   http://www.opensource.org/licenses/mit-license.php
+ *   http://www.gnu.org/licenses/gpl.html
+ *
+ * Date: 2009-10-06
+ *
+ */
+
+(function($) {
+	// jQuery plugin
+	$.tree = {
+		datastores	: { },
+		plugins		: { },
+		defaults	: {
+			data	: {
+				async	: false,		// Are async requests used to load open_branch contents
+				type	: "html",		// One of included datastores
+				opts	: { method: "GET", url: false } // Options passed to datastore
+			},
+			selected	: false,		// FALSE or STRING or ARRAY
+			opened		: [],			// ARRAY OF INITIALLY OPENED NODES
+			languages	: [],			// ARRAY of string values (which will be used as CSS classes - so they must be valid)
+			ui		: {
+				dots		: true,		// BOOL - dots or no dots
+				animation	: 0,		// INT - duration of open/close animations in miliseconds
+				scroll_spd	: 4,
+				theme_path	: false,	// Path to the theme CSS file - if set to false and theme_name is not false - will lookup jstree-path-here/themes/theme-name-here/style.css
+				theme_name	: "default",// if set to false no theme will be loaded
+				selected_parent_close	: "select_parent", // false, "deselect", "select_parent"
+				selected_delete			: "select_previous" // false, "select_previous"
+			},
+			types	: {
+				"default" : {
+					clickable	: true, // can be function
+					renameable	: true, // can be function
+					deletable	: true, // can be function
+					creatable	: true, // can be function
+					draggable	: true, // can be function
+					max_children	: -1, // -1 - not set, 0 - no children, 1 - one child, etc // can be function
+					max_depth		: -1, // -1 - not set, 0 - no children, 1 - one level of children, etc // can be function
+					valid_children	: "all", // all, none, array of values // can be function
+					icon : {
+						image : false,
+						position : false
+					}
+				}
+			},
+			rules	: {
+				multiple	: false,	// FALSE | CTRL | ON - multiple selection off/ with or without holding Ctrl
+				multitree	: "none",	// all, none, array of tree IDs to accept from
+				type_attr	: "rel",	// STRING attribute name (where is the type stored as string)
+				createat	: "bottom",	// STRING (top or bottom) new nodes get inserted at top or bottom
+				drag_copy	: "ctrl",	// FALSE | CTRL | ON - drag to copy off/ with or without holding Ctrl
+				drag_button	: "left",	// left, right or both
+				use_max_children	: true,
+				use_max_depth		: true,
+
+				max_children: -1,
+				max_depth	: -1,
+				valid_children : "all"
+			},
+			lang : {
+				new_node	: "New folder",
+				loading		: "Loading ..."
+			},
+			callback	: {
+				beforechange: function(NODE,TREE_OBJ) { return true },
+				beforeopen	: function(NODE,TREE_OBJ) { return true },
+				beforeclose	: function(NODE,TREE_OBJ) { return true },
+				beforemove	: function(NODE,REF_NODE,TYPE,TREE_OBJ) { return true }, 
+				beforecreate: function(NODE,REF_NODE,TYPE,TREE_OBJ) { return true }, 
+				beforerename: function(NODE,LANG,TREE_OBJ) { return true }, 
+				beforedelete: function(NODE,TREE_OBJ) { return true }, 
+				beforedata	: function(NODE,TREE_OBJ) { return { id : $(NODE).attr("id") || 0 } }, // PARAMETERS PASSED TO SERVER
+				ondata		: function(DATA,TREE_OBJ) { return DATA; },		// modify data before parsing it
+				onparse		: function(STR,TREE_OBJ) { return STR; },		// modify string before visualizing it
+				onhover		: function(NODE,TREE_OBJ) { },					// node hovered
+				onselect	: function(NODE,TREE_OBJ) { },					// node selected
+				ondeselect	: function(NODE,TREE_OBJ) { },					// node deselected
+				onchange	: function(NODE,TREE_OBJ) { },					// focus changed
+				onrename	: function(NODE,TREE_OBJ,RB) { },				// node renamed
+				onmove		: function(NODE,REF_NODE,TYPE,TREE_OBJ,RB) { },	// move completed
+				oncopy		: function(NODE,REF_NODE,TYPE,TREE_OBJ,RB) { },	// copy completed
+				oncreate	: function(NODE,REF_NODE,TYPE,TREE_OBJ,RB) { },	// node created
+				ondelete	: function(NODE,TREE_OBJ,RB) { },				// node deleted
+				onopen		: function(NODE,TREE_OBJ) { },					// node opened
+				onopen_all	: function(TREE_OBJ) { },						// all nodes opened
+				onclose_all	: function(TREE_OBJ) { },						// all nodes closed
+				onclose		: function(NODE,TREE_OBJ) { },					// node closed
+				error		: function(TEXT,TREE_OBJ) { },					// error occured
+				ondblclk	: function(NODE,TREE_OBJ) { TREE_OBJ.toggle_branch.call(TREE_OBJ, NODE); TREE_OBJ.select_branch.call(TREE_OBJ, NODE); },
+				onrgtclk	: function(NODE,TREE_OBJ,EV) { },				// right click - to prevent use: EV.preventDefault(); EV.stopPropagation(); return false
+				onload		: function(TREE_OBJ) { },
+				oninit		: function(TREE_OBJ) { },
+				onfocus		: function(TREE_OBJ) { },
+				ondestroy	: function(TREE_OBJ) { },
+				onsearch	: function(NODES, TREE_OBJ) { NODES.addClass("search"); },
+				ondrop		: function(NODE,REF_NODE,TYPE,TREE_OBJ) { },
+				check		: function(RULE,NODE,VALUE,TREE_OBJ) { return VALUE; },
+				check_move	: function(NODE,REF_NODE,TYPE,TREE_OBJ) { return true; }
+			},
+			plugins : { }
+		},
+
+		create		: function () { return new tree_component(); },
+		focused		: function () { return tree_component.inst[tree_component.focused]; },
+		reference	: function (obj) { 
+			var o = $(obj); 
+			if(!o.size()) o = $("#" + obj);
+			if(!o.size()) return null; 
+			o = (o.is(".tree")) ? o.attr("id") : o.parents(".tree:eq(0)").attr("id"); 
+			return tree_component.inst[o] || null; 
+		},
+		rollback	: function (data) {
+			for(var i in data) {
+				if(!data.hasOwnProperty(i)) continue;
+				var tmp = tree_component.inst[i];
+				var lock = !tmp.locked;
+
+				// if not locked - lock the tree
+				if(lock) tmp.lock(true);
+				// Cancel ongoing rename
+				tmp.inp = false;
+				tmp.container.html(data[i].html).find(".dragged").removeClass("dragged").end().find(".hover").removeClass("hover");
+
+				if(data[i].selected) {
+					tmp.selected = $("#" + data[i].selected);
+					tmp.selected_arr = [];
+					tmp.container
+						.find("a.clicked").each( function () {
+							tmp.selected_arr.push(tmp.get_node(this));
+						});
+				}
+				// if this function set the lock - unlock
+				if(lock) tmp.lock(false);
+
+				delete lock;
+				delete tmp;
+			}
+		},
+		drop_mode	: function (opts) {
+			opts = $.extend(opts, { show : false, type : "default", str : "Foreign node" });
+			tree_component.drag_drop.foreign	= true;
+			tree_component.drag_drop.isdown		= true;
+			tree_component.drag_drop.moving		= true;
+			tree_component.drag_drop.appended	= false;
+			tree_component.drag_drop.f_type		= opts.type;
+			tree_component.drag_drop.f_data		= opts;
+
+
+			if(!opts.show) {
+				tree_component.drag_drop.drag_help	= false;
+				tree_component.drag_drop.drag_node	= false;
+			}
+			else {
+				tree_component.drag_drop.drag_help	= $("<div id='jstree-dragged' class='tree tree-default'><ul><li class='last dragged foreign'><a href='#'><ins>&nbsp;</ins>" + opts.str + "</a></li></ul></div>");
+				tree_component.drag_drop.drag_node	= tree_component.drag_drop.drag_help.find("li:eq(0)");
+			}
+			if($.tree.drag_start !== false) $.tree.drag_start.call(null, false);
+		},
+		drag_start	: false,
+		drag		: false,
+		drag_end	: false
+	};
+	$.fn.tree = function (opts) {
+		return this.each(function() {
+			var conf = $.extend({},opts);
+			if(tree_component.inst && tree_component.inst[$(this).attr('id')]) tree_component.inst[$(this).attr('id')].destroy();
+			if(conf !== false) new tree_component().init(this, conf);
+		});
+	};
+
+	// core
+	function tree_component () {
+		return {
+			cntr : ++tree_component.cntr,
+			settings : $.extend({},$.tree.defaults),
+
+			init : function(elem, conf) {
+				var _this = this;
+				this.container = $(elem);
+				if(this.container.size == 0) return false;
+				tree_component.inst[this.cntr] = this;
+				if(!this.container.attr("id")) this.container.attr("id","jstree_" + this.cntr); 
+				tree_component.inst[this.container.attr("id")] = tree_component.inst[this.cntr];
+				tree_component.focused = this.cntr;
+				this.settings = $.extend(true, {}, this.settings, conf);
+
+				// DEAL WITH LANGUAGE VERSIONS
+				if(this.settings.languages && this.settings.languages.length) {
+					this.current_lang = this.settings.languages[0];
+					var st = false;
+					var id = "#" + this.container.attr("id");
+					for(var ln = 0; ln < this.settings.languages.length; ln++) {
+						st = tree_component.add_css(id + " ." + this.settings.languages[ln]);
+						if(st !== false) st.style.display = (this.settings.languages[ln] == this.current_lang) ? "" : "none";
+					}
+				}
+				else this.current_lang = false;
+				// THEMES
+				this.container.addClass("tree");
+				if(this.settings.ui.theme_name !== false) {
+					if(this.settings.ui.theme_path === false) {
+						$("script").each(function () { 
+							if(this.src.toString().match(/jquery\.tree.*?js$/)) { _this.settings.ui.theme_path = this.src.toString().replace(/jquery\.tree.*?js$/, "") + "themes/" + _this.settings.ui.theme_name + "/style.css"; return false; }
+						});
+					}
+					if(this.settings.ui.theme_path != "" && $.inArray(this.settings.ui.theme_path, tree_component.themes) == -1) {
+						tree_component.add_sheet({ url : this.settings.ui.theme_path });
+						tree_component.themes.push(this.settings.ui.theme_path);
+					}
+					this.container.addClass("tree-" + this.settings.ui.theme_name);
+				}
+				// TYPE ICONS
+				var type_icons = "";
+				for(var t in this.settings.types) {
+					if(!this.settings.types.hasOwnProperty(t)) continue;
+					if(!this.settings.types[t].icon) continue;
+					if( this.settings.types[t].icon.image || this.settings.types[t].icon.position) {
+						if(t == "default")  type_icons += "#" + this.container.attr("id") + " li > a ins { ";
+						else type_icons += "#" + this.container.attr("id") + " li[rel=" + t + "] > a ins { ";
+						if(this.settings.types[t].icon.image) type_icons += " background-image:url(" + this.settings.types[t].icon.image + "); ";
+						if(this.settings.types[t].icon.position) type_icons += " background-position:" + this.settings.types[t].icon.position + "; ";
+						type_icons += "} ";
+					}
+				}
+				if(type_icons != "") tree_component.add_sheet({ str : type_icons });
+
+				if(this.settings.rules.multiple) this.selected_arr = [];
+				this.offset = false;
+				this.hovered = false;
+				this.locked = false;
+
+				if(tree_component.drag_drop.marker === false) tree_component.drag_drop.marker = $("<div>").attr({ id : "jstree-marker" }).hide().appendTo("body");
+				this.callback("oninit", [this]);
+				this.refresh();
+				this.attach_events();
+				this.focus();
+			},
+			refresh : function (obj) {
+				if(this.locked) return this.error("LOCKED");
+				var _this = this;
+				if(obj && !this.settings.data.async) obj = false;
+				this.is_partial_refresh = obj ? true : false;
+
+				// SAVE OPENED
+				this.opened = Array();
+				if(this.settings.opened != false) {
+					$.each(this.settings.opened, function (i, item) {
+						if(this.replace(/^#/,"").length > 0) { _this.opened.push("#" + this.replace(/^#/,"")); }
+					});
+					this.settings.opened = false;
+				}
+				else {
+					this.container.find("li.open").each(function (i) { if(this.id) { _this.opened.push("#" + this.id); } });
+				}
+
+				// SAVE SELECTED
+				if(this.selected) {
+					this.settings.selected = Array();
+					if(obj) {
+						$(obj).find("li:has(a.clicked)").each(function () {
+							if(this.id) _this.settings.selected.push("#" + this.id);
+						});
+					}
+					else {
+						if(this.selected_arr) {
+							$.each(this.selected_arr, function () {
+								if(this.attr("id")) _this.settings.selected.push("#" + this.attr("id"));
+							});
+						}
+						else {
+							if(this.selected.attr("id")) this.settings.selected.push("#" + this.selected.attr("id"));
+						}
+					}
+				}
+				else if(this.settings.selected !== false) {
+					var tmp = Array();
+					if((typeof this.settings.selected).toLowerCase() == "object") {
+						$.each(this.settings.selected, function () {
+							if(this.replace(/^#/,"").length > 0) tmp.push("#" + this.replace(/^#/,""));
+						});
+					}
+					else {
+						if(this.settings.selected.replace(/^#/,"").length > 0) tmp.push("#" + this.settings.selected.replace(/^#/,""));
+					}
+					this.settings.selected = tmp;
+				}
+
+				if(obj && this.settings.data.async) {
+					this.opened = Array();
+					obj = this.get_node(obj);
+					obj.find("li.open").each(function (i) { _this.opened.push("#" + this.id); });
+					if(obj.hasClass("open")) obj.removeClass("open").addClass("closed");
+					if(obj.hasClass("leaf")) obj.removeClass("leaf");
+					obj.children("ul:eq(0)").html("");
+					return this.open_branch(obj, true, function () { _this.reselect.apply(_this); });
+				}
+
+				var _this = this;
+				var _datastore = new $.tree.datastores[this.settings.data.type]();
+				if(this.container.children("ul").size() == 0) {
+					this.container.html("<ul class='ltr' style='direction:ltr;'><li class='last'><a class='loading' href='#'><ins>&nbsp;</ins>" + (this.settings.lang.loading || "Loading ...") + "</a></li></ul>");
+				}
+				_datastore.load(this.callback("beforedata",[false,this]),this,this.settings.data.opts,function(data) {
+					data = _this.callback("ondata",[data, _this]);
+					_datastore.parse(data,_this,_this.settings.data.opts,function(str) {
+						str = _this.callback("onparse", [str, _this]);
+						_this.container.empty().append($("<ul class='ltr'>").html(str));
+						_this.container.find("li:last-child").addClass("last").end().find("li:has(ul)").not(".open").addClass("closed");
+						_this.container.find("li").not(".open").not(".closed").addClass("leaf");
+						_this.reselect();
+					});
+				});
+			},
+			reselect : function (is_callback) {
+				var _this = this;
+
+				if(!is_callback)	this.cl_count = 0;
+				else				this.cl_count --;
+				// REOPEN BRANCHES
+				if(this.opened && this.opened.length) {
+					var opn = false;
+					for(var j = 0; this.opened && j < this.opened.length; j++) {
+						if(this.settings.data.async) {
+							var tmp = this.get_node(this.opened[j]);
+							if(tmp.size() && tmp.hasClass("closed") > 0) {
+								opn = true;
+								var tmp = this.opened[j].toString().replace('/','\\/');
+								delete this.opened[j];
+								this.open_branch(tmp, true, function () { _this.reselect.apply(_this, [true]); } );
+								this.cl_count ++;
+							}
+						}
+						else this.open_branch(this.opened[j], true);
+					}
+					if(this.settings.data.async && opn) return;
+					if(this.cl_count > 0) return;
+					delete this.opened;
+				} 
+				if(this.cl_count > 0) return;
+
+				// DOTS and RIGHT TO LEFT
+				this.container.css("direction","ltr").children("ul:eq(0)").addClass("ltr");
+				if(this.settings.ui.dots == false)	this.container.children("ul:eq(0)").addClass("no_dots");
+
+				// REPOSITION SCROLL
+				if(this.scrtop) {
+					this.container.scrollTop(_this.scrtop);
+					delete this.scrtop;
+				}
+				// RESELECT PREVIOUSLY SELECTED
+				if(this.settings.selected !== false) {
+					$.each(this.settings.selected, function (i) {
+						if(_this.is_partial_refresh)	_this.select_branch($(_this.settings.selected[i].toString().replace('/','\\/'), _this.container), (_this.settings.rules.multiple !== false) );
+						else							_this.select_branch($(_this.settings.selected[i].toString().replace('/','\\/'), _this.container), (_this.settings.rules.multiple !== false && i > 0) );
+					});
+					this.settings.selected = false;
+				}
+				this.callback("onload", [_this]);
+			},
+
+			get : function (obj, format, opts) {
+				if(!format) format = this.settings.data.type;
+				if(!opts) opts = this.settings.data.opts;
+				return new $.tree.datastores[format]().get(obj, this, opts);
+			},
+
+			attach_events : function () {
+				var _this = this;
+
+				this.container
+					.bind("mousedown.jstree", function (event) {
+						if(tree_component.drag_drop.isdown) {
+							tree_component.drag_drop.move_type = false;
+							event.preventDefault();
+							event.stopPropagation();
+							event.stopImmediatePropagation();
+							return false;
+						}
+					})
+					.bind("mouseup.jstree", function (event) {
+						setTimeout( function() { _this.focus.apply(_this); }, 5);
+					})
+					.bind("click.jstree", function (event) { 
+						//event.stopPropagation(); 
+						return true;
+					});
+				$("li", this.container.get(0))
+					.live("click", function(event) { // WHEN CLICK IS ON THE ARROW
+						if(event.target.tagName != "LI") return true;
+						_this.off_height();
+						if(event.pageY - $(event.target).offset().top > _this.li_height) return true;
+						_this.toggle_branch.apply(_this, [event.target]);
+						event.stopPropagation();
+						return false;
+					});
+				$("a", this.container.get(0))
+					.live("click", function (event) { // WHEN CLICK IS ON THE TEXT OR ICON
+						if(event.which && event.which == 3) return true;
+						if(_this.locked) {
+							event.preventDefault(); 
+							event.target.blur();
+							return _this.error("LOCKED");
+						}
+						_this.select_branch.apply(_this, [event.target, event.ctrlKey || _this.settings.rules.multiple == "on"]);
+						if(_this.inp) { _this.inp.blur(); }
+						event.preventDefault(); 
+						event.target.blur();
+						return false;
+					})
+					.live("dblclick", function (event) { // WHEN DOUBLECLICK ON TEXT OR ICON
+						if(_this.locked) {
+							event.preventDefault(); 
+							event.stopPropagation();
+							event.target.blur();
+							return _this.error("LOCKED");
+						}
+						_this.callback("ondblclk", [_this.get_node(event.target).get(0), _this]);
+						event.preventDefault(); 
+						event.stopPropagation();
+						event.target.blur();
+					})
+					.live("contextmenu", function (event) {
+						if(_this.locked) {
+							event.target.blur();
+							return _this.error("LOCKED");
+						}
+						return _this.callback("onrgtclk", [_this.get_node(event.target).get(0), _this, event]);
+					})
+					.live("mouseover", function (event) {
+						if(_this.locked) {
+							event.preventDefault();
+							event.stopPropagation();
+							return _this.error("LOCKED");
+						}
+						if(_this.hovered !== false && (event.target.tagName == "A" || event.target.tagName == "INS")) {
+							_this.hovered.children("a").removeClass("hover");
+							_this.hovered = false;
+						}
+						_this.callback("onhover",[_this.get_node(event.target).get(0), _this]);
+					})
+					.live("mousedown", function (event) {
+						if(_this.settings.rules.drag_button == "left" && event.which && event.which != 1)	return true;
+						if(_this.settings.rules.drag_button == "right" && event.which && event.which != 3)	return true;
+						_this.focus.apply(_this);
+						if(_this.locked) return _this.error("LOCKED");
+						// SELECT LIST ITEM NODE
+						var obj = _this.get_node(event.target);
+						// IF ITEM IS DRAGGABLE
+						if(_this.settings.rules.multiple != false && _this.selected_arr.length > 1 && obj.children("a:eq(0)").hasClass("clicked")) {
+							var counter = 0;
+							for(var i in _this.selected_arr) {
+								if(!_this.selected_arr.hasOwnProperty(i)) continue;
+								if(_this.check("draggable", _this.selected_arr[i])) {
+									_this.selected_arr[i].addClass("dragged");
+									tree_component.drag_drop.origin_tree = _this;
+									counter ++;
+								}
+							}
+							if(counter > 0) {
+								if(_this.check("draggable", obj))	tree_component.drag_drop.drag_node = obj;
+								else								tree_component.drag_drop.drag_node = _this.container.find("li.dragged:eq(0)");
+								tree_component.drag_drop.isdown		= true;
+								tree_component.drag_drop.drag_help	= $("<div id='jstree-dragged' class='tree " + ( _this.settings.ui.theme_name != "" ? " tree-" + _this.settings.ui.theme_name : "" ) + "' />").append("<ul class='" + _this.container.children("ul:eq(0)").get(0).className + "' />");
+								var tmp = tree_component.drag_drop.drag_node.clone();
+								if(_this.settings.languages.length > 0) tmp.find("a").not("." + _this.current_lang).hide();
+								tree_component.drag_drop.drag_help.children("ul:eq(0)").append(tmp);
+								tree_component.drag_drop.drag_help.find("li:eq(0)").removeClass("last").addClass("last").children("a").html("<ins>&nbsp;</ins>Multiple selection").end().children("ul").remove();
+
+								tree_component.drag_drop.dragged = _this.container.find("li.dragged");
+							}
+						}
+						else {
+							if(_this.check("draggable", obj)) {
+								tree_component.drag_drop.drag_node	= obj;
+								tree_component.drag_drop.drag_help	= $("<div id='jstree-dragged' class='tree " + ( _this.settings.ui.theme_name != "" ? " tree-" + _this.settings.ui.theme_name : "" ) + "' />").append("<ul class='" + _this.container.children("ul:eq(0)").get(0).className + "' />");
+								var tmp = obj.clone();
+								if(_this.settings.languages.length > 0) tmp.find("a").not("." + _this.current_lang).hide();
+								tree_component.drag_drop.drag_help.children("ul:eq(0)").append(tmp);
+								tree_component.drag_drop.drag_help.find("li:eq(0)").removeClass("last").addClass("last");
+								tree_component.drag_drop.isdown		= true;
+								tree_component.drag_drop.foreign	= false;
+								tree_component.drag_drop.origin_tree = _this;
+								obj.addClass("dragged");
+
+								tree_component.drag_drop.dragged = _this.container.find("li.dragged");
+							}
+						}
+						tree_component.drag_drop.init_x = event.pageX;
+						tree_component.drag_drop.init_y = event.pageY;
+						obj.blur();
+						event.preventDefault(); 
+						event.stopPropagation();
+						return false;
+					});
+			},
+			focus : function () {
+				if(this.locked) return false;
+				if(tree_component.focused != this.cntr) {
+					tree_component.focused = this.cntr;
+					this.callback("onfocus",[this]);
+				}
+			},
+
+			off_height : function () {
+				if(this.offset === false) {
+					this.container.css({ position : "relative" });
+					this.offset = this.container.offset();
+					var tmp = 0;
+					tmp = parseInt($.curCSS(this.container.get(0), "paddingTop", true),10);
+					if(tmp) this.offset.top += tmp;
+					tmp = parseInt($.curCSS(this.container.get(0), "borderTopWidth", true),10);
+					if(tmp) this.offset.top += tmp;
+					this.container.css({ position : "" });
+				}
+				if(!this.li_height) {
+					var tmp = this.container.find("ul li.closed, ul li.leaf").eq(0);
+					this.li_height = tmp.height();
+					if(tmp.children("ul:eq(0)").size()) this.li_height -= tmp.children("ul:eq(0)").height();
+					if(!this.li_height) this.li_height = 18;
+				}
+			},
+			scroll_check : function (x,y) { 
+				var _this = this;
+				var cnt = _this.container;
+				var off = _this.container.offset();
+
+				var st = cnt.scrollTop();
+				var sl = cnt.scrollLeft();
+				// DETECT HORIZONTAL SCROLL
+				var h_cor = (cnt.get(0).scrollWidth > cnt.width()) ? 40 : 20;
+
+				if(y - off.top < 20)						cnt.scrollTop(Math.max( (st - _this.settings.ui.scroll_spd) ,0));	// NEAR TOP
+				if(cnt.height() - (y - off.top) < h_cor)	cnt.scrollTop(st + _this.settings.ui.scroll_spd);					// NEAR BOTTOM
+				if(x - off.left < 20)						cnt.scrollLeft(Math.max( (sl - _this.settings.ui.scroll_spd),0));	// NEAR LEFT
+				if(cnt.width() - (x - off.left) < 40)		cnt.scrollLeft(sl + _this.settings.ui.scroll_spd);					// NEAR RIGHT
+
+				if(cnt.scrollLeft() != sl || cnt.scrollTop() != st) {
+					tree_component.drag_drop.move_type	= false;
+					tree_component.drag_drop.ref_node	= false;
+					tree_component.drag_drop.marker.hide();
+				}
+				tree_component.drag_drop.scroll_time = setTimeout( function() { _this.scroll_check(x,y); }, 50);
+			},
+			scroll_into_view : function (obj) {
+				obj = obj ? this.get_node(obj) : this.selected;
+				if(!obj) return false;
+				var off_t = obj.offset().top;
+				var beg_t = this.container.offset().top;
+				var end_t = beg_t + this.container.height();
+				var h_cor = (this.container.get(0).scrollWidth > this.container.width()) ? 40 : 20;
+				if(off_t + 5 < beg_t) this.container.scrollTop(this.container.scrollTop() - (beg_t - off_t + 5) );
+				if(off_t + h_cor > end_t) this.container.scrollTop(this.container.scrollTop() + (off_t + h_cor - end_t) );
+			},
+
+			get_node : function (obj) {
+				return $(obj).closest("li");
+			},
+			get_type : function (obj) {
+				obj = !obj ? this.selected : this.get_node(obj);
+				if(!obj) return;
+				var tmp = obj.attr(this.settings.rules.type_attr);
+				return tmp || "default";
+			},
+			set_type : function (str, obj) {
+				obj = !obj ? this.selected : this.get_node(obj);
+				if(!obj || !str) return;
+				obj.attr(this.settings.rules.type_attr, str);
+			},
+			get_text : function (obj, lang) {
+				obj = this.get_node(obj);
+				if(!obj || obj.size() == 0) return "";
+				if(this.settings.languages && this.settings.languages.length) {
+					lang = lang ? lang : this.current_lang;
+					obj = obj.children("a." + lang);
+				}
+				else obj = obj.children("a:visible");
+				var val = "";
+				obj.contents().each(function () {
+					if(this.nodeType == 3) { val = this.data; return false; }
+				});
+				return val;
+			},
+
+			check : function (rule, obj) {
+				if(this.locked) return false;
+				var v = false;
+				// if root node
+				if(obj === -1) { if(typeof this.settings.rules[rule] != "undefined") v = this.settings.rules[rule]; }
+				else {
+					obj = !obj ? this.selected : this.get_node(obj);
+					if(!obj) return;
+					var t = this.get_type(obj);
+					if(typeof this.settings.types[t] != "undefined" && typeof this.settings.types[t][rule] != "undefined") v = this.settings.types[t][rule];
+					else if(typeof this.settings.types["default"] != "undefined" && typeof this.settings.types["default"][rule] != "undefined") v = this.settings.types["default"][rule];
+				}
+				if(typeof v == "function") v = v.call(null, obj, this);
+				v = this.callback("check", [rule, obj, v, this]);
+				return v;
+			},
+			check_move : function (nod, ref_node, how) {
+				if(this.locked) return false;
+				if($(ref_node).closest("li.dragged").size()) return false;
+
+				var tree1 = nod.parents(".tree:eq(0)").get(0);
+				var tree2 = ref_node.parents(".tree:eq(0)").get(0);
+				// if different trees
+				if(tree1 && tree1 != tree2) {
+					var m = $.tree.reference(tree2.id).settings.rules.multitree;
+					if(m == "none" || ($.isArray(m) && $.inArray(tree1.id, m) == -1)) return false;
+				}
+
+				var p = (how != "inside") ? this.parent(ref_node) : this.get_node(ref_node);
+				nod = this.get_node(nod);
+				if(p == false) return false;
+				var r = {
+					max_depth : this.settings.rules.use_max_depth ? this.check("max_depth", p) : -1,
+					max_children : this.settings.rules.use_max_children ? this.check("max_children", p) : -1,
+					valid_children : this.check("valid_children", p)
+				};
+				var nod_type = (typeof nod == "string") ? nod : this.get_type(nod);
+				if(typeof r.valid_children != "undefined" && (r.valid_children == "none" || (typeof r.valid_children == "object" && $.inArray(nod_type, $.makeArray(r.valid_children)) == -1))) return false;
+				
+				if(this.settings.rules.use_max_children) {
+					if(typeof r.max_children != "undefined" && r.max_children != -1) {
+						if(r.max_children == 0) return false;
+						var c_count = 1;
+						if(tree_component.drag_drop.moving == true && tree_component.drag_drop.foreign == false) {
+							c_count = tree_component.drag_drop.dragged.size();
+							c_count = c_count - p.find('> ul > li.dragged').size();
+						}
+						if(r.max_children < p.find('> ul > li').size() + c_count) return false;
+					}
+				}
+
+				if(this.settings.rules.use_max_depth) {
+					if(typeof r.max_depth != "undefined" && r.max_depth === 0) return this.error("MOVE: MAX-DEPTH REACHED");
+					// check for max_depth up the chain
+					var mx = (r.max_depth > 0) ? r.max_depth : false;
+					var i = 0;
+					var t = p;
+					while(t !== -1) {
+						t = this.parent(t);
+						i ++;
+						var m = this.check("max_depth",t);
+						if(m >= 0) {
+							mx = (mx === false) ? (m - i) : Math.min(mx, m - i);
+						}
+						if(mx !== false && mx <= 0) return this.error("MOVE: MAX-DEPTH REACHED");
+					}
+					if(mx !== false && mx <= 0) return this.error("MOVE: MAX-DEPTH REACHED");
+					if(mx !== false) { 
+						var incr = 1;
+						if(typeof nod != "string") {
+							var t = nod;
+							// possible async problem - when nodes are not all loaded down the chain
+							while(t.size() > 0) {
+								if(mx - incr < 0) return this.error("MOVE: MAX-DEPTH REACHED");
+								t = t.children("ul").children("li");
+								incr ++;
+							}
+						}
+					}
+				}
+				if(this.callback("check_move", [nod, ref_node, how, this]) == false) return false;
+				return true;
+			},
+
+			hover_branch : function (obj) {
+				if(this.locked) return this.error("LOCKED");
+				var _this = this;
+				var obj = _this.get_node(obj);
+				if(!obj.size()) return this.error("HOVER: NOT A VALID NODE");
+				if(!_this.check("clickable", obj)) return this.error("SELECT: NODE NOT SELECTABLE");
+				if(this.hovered) this.hovered.children("A").removeClass("hover");
+				this.hovered = obj;
+				this.hovered.children("a").addClass("hover");
+				this.scroll_into_view(this.hovered);
+			},
+			select_branch : function (obj, multiple) {
+				if(this.locked) return this.error("LOCKED");
+				if(!obj && this.hovered !== false) obj = this.hovered;
+				var _this = this;
+				obj = _this.get_node(obj);
+				if(!obj.size()) return this.error("SELECT: NOT A VALID NODE");
+				obj.children("a").removeClass("hover");
+				// CHECK AGAINST RULES FOR SELECTABLE NODES
+				if(!_this.check("clickable", obj)) return this.error("SELECT: NODE NOT SELECTABLE");
+				if(_this.callback("beforechange",[obj.get(0),_this]) === false) return this.error("SELECT: STOPPED BY USER");
+				// IF multiple AND obj IS ALREADY SELECTED - DESELECT IT
+				if(this.settings.rules.multiple != false && multiple && obj.children("a.clicked").size() > 0) {
+					return this.deselect_branch(obj);
+				}
+				if(this.settings.rules.multiple != false && multiple) {
+					this.selected_arr.push(obj);
+				}
+				if(this.settings.rules.multiple != false && !multiple) {
+					for(var i in this.selected_arr) {
+						if(!this.selected_arr.hasOwnProperty(i)) continue;
+						this.selected_arr[i].children("A").removeClass("clicked");
+						this.callback("ondeselect", [this.selected_arr[i].get(0), _this]);
+					}
+					this.selected_arr = [];
+					this.selected_arr.push(obj);
+					if(this.selected && this.selected.children("A").hasClass("clicked")) {
+						this.selected.children("A").removeClass("clicked");
+						this.callback("ondeselect", [this.selected.get(0), _this]);
+					}
+				}
+				if(!this.settings.rules.multiple) {
+					if(this.selected) {
+						this.selected.children("A").removeClass("clicked");
+						this.callback("ondeselect", [this.selected.get(0), _this]);
+					}
+				}
+				// SAVE NEWLY SELECTED
+				this.selected = obj;
+				if(this.hovered !== false) {
+					this.hovered.children("A").removeClass("hover");
+					this.hovered = obj;
+				}
+
+				// FOCUS NEW NODE AND OPEN ALL PARENT NODES IF CLOSED
+				this.selected.children("a").addClass("clicked").end().parents("li.closed").each( function () { _this.open_branch(this, true); });
+
+				// SCROLL SELECTED NODE INTO VIEW
+				this.scroll_into_view(this.selected);
+
+				this.callback("onselect", [this.selected.get(0), _this]);
+				this.callback("onchange", [this.selected.get(0), _this]);
+			},
+			deselect_branch : function (obj) {
+				if(this.locked) return this.error("LOCKED");
+				var _this = this;
+				var obj = this.get_node(obj);
+				if(obj.children("a.clicked").size() == 0) return this.error("DESELECT: NODE NOT SELECTED");
+
+				obj.children("a").removeClass("clicked");
+				this.callback("ondeselect", [obj.get(0), _this]);
+				if(this.settings.rules.multiple != false && this.selected_arr.length > 1) {
+					this.selected_arr = [];
+					this.container.find("a.clicked").filter(":first-child").parent().each(function () {
+						_this.selected_arr.push($(this));
+					});
+					if(obj.get(0) == this.selected.get(0)) {
+						this.selected = this.selected_arr[0];
+					}
+				}
+				else {
+					if(this.settings.rules.multiple != false) this.selected_arr = [];
+					this.selected = false;
+				}
+				this.callback("onchange", [obj.get(0), _this]);
+			},
+			toggle_branch : function (obj) {
+				if(this.locked) return this.error("LOCKED");
+				var obj = this.get_node(obj);
+				if(obj.hasClass("closed"))	return this.open_branch(obj);
+				if(obj.hasClass("open"))	return this.close_branch(obj); 
+			},
+			open_branch : function (obj, disable_animation, callback) {
+				var _this = this;
+
+				if(this.locked) return this.error("LOCKED");
+				var obj = this.get_node(obj);
+				if(!obj.size()) return this.error("OPEN: NO SUCH NODE");
+				if(obj.hasClass("leaf")) return this.error("OPEN: OPENING LEAF NODE");
+				if(this.settings.data.async && obj.find("li").size() == 0) {
+					
+					if(this.callback("beforeopen",[obj.get(0),this]) === false) return this.error("OPEN: STOPPED BY USER");
+
+					obj.children("ul:eq(0)").remove().end().append("<ul><li class='last'><a class='loading' href='#'><ins>&nbsp;</ins>" + (_this.settings.lang.loading || "Loading ...") + "</a></li></ul>");
+					obj.removeClass("closed").addClass("open");
+
+					var _datastore = new $.tree.datastores[this.settings.data.type]();
+					_datastore.load(this.callback("beforedata",[obj,this]),this,this.settings.data.opts,function(data){
+						data = _this.callback("ondata", [data, _this]);
+						if(!data || data.length == 0) {
+							obj.removeClass("closed").removeClass("open").addClass("leaf").children("ul").remove();
+							if(callback) callback.call();
+							return;
+						}
+						_datastore.parse(data,_this,_this.settings.data.opts,function(str){
+							str = _this.callback("onparse", [str, _this]);
+							// if(obj.children('ul:eq(0)').children('li').size() > 1) obj.children("ul").find('.loaading').parent().replaceWith(str); else 
+							obj.children("ul:eq(0)").replaceWith($("<ul>").html(str));
+							obj.find("li:last-child").addClass("last").end().find("li:has(ul)").not(".open").addClass("closed");
+							obj.find("li").not(".open").not(".closed").addClass("leaf");
+							_this.open_branch.apply(_this, [obj]);
+							if(callback) callback.call();
+						});
+					});
+					return true;
+				}
+				else {
+					if(!this.settings.data.async) {
+						if(this.callback("beforeopen",[obj.get(0),this]) === false) return this.error("OPEN: STOPPED BY USER");
+					}
+					if(parseInt(this.settings.ui.animation) > 0 && !disable_animation ) {
+						obj.children("ul:eq(0)").css("display","none");
+						obj.removeClass("closed").addClass("open");
+						obj.children("ul:eq(0)").slideDown(parseInt(this.settings.ui.animation), function() {
+							$(this).css("display","");
+							if(callback) callback.call();
+						});
+					} else {
+						obj.removeClass("closed").addClass("open");
+						if(callback) callback.call();
+					}
+					this.callback("onopen", [obj.get(0), this]);
+					return true;
+				}
+			},
+			close_branch : function (obj, disable_animation) {
+				if(this.locked) return this.error("LOCKED");
+				var _this = this;
+				var obj = this.get_node(obj);
+				if(!obj.size()) return this.error("CLOSE: NO SUCH NODE");
+				if(_this.callback("beforeclose",[obj.get(0),_this]) === false) return this.error("CLOSE: STOPPED BY USER");
+				if(parseInt(this.settings.ui.animation) > 0 && !disable_animation && obj.children("ul:eq(0)").size() == 1) {
+					obj.children("ul:eq(0)").slideUp(parseInt(this.settings.ui.animation), function() {
+						if(obj.hasClass("open")) obj.removeClass("open").addClass("closed");
+						$(this).css("display","");
+					});
+				} 
+				else {
+					if(obj.hasClass("open")) obj.removeClass("open").addClass("closed");
+				}
+				if(this.selected && this.settings.ui.selected_parent_close !== false && obj.children("ul:eq(0)").find("a.clicked").size() > 0) {
+					obj.find("li:has(a.clicked)").each(function() {
+						_this.deselect_branch(this);
+					});
+					if(this.settings.ui.selected_parent_close == "select_parent" && obj.children("a.clicked").size() == 0) this.select_branch(obj, (this.settings.rules.multiple != false && this.selected_arr.length > 0) );
+				}
+				this.callback("onclose", [obj.get(0), this]);
+			},
+			open_all : function (obj, callback) {
+				if(this.locked) return this.error("LOCKED");
+				var _this = this;
+				obj = obj ? this.get_node(obj) : this.container;
+
+				var s = obj.find("li.closed").size();
+				if(!callback)	this.cl_count = 0;
+				else			this.cl_count --;
+				if(s > 0) {
+					this.cl_count += s;
+					// maybe add .andSelf()
+					obj.find("li.closed").each( function () { var __this = this; _this.open_branch.apply(_this, [this, true, function() { _this.open_all.apply(_this, [__this, true]); } ]); });
+				}
+				else if(this.cl_count == 0) this.callback("onopen_all",[this]);
+			},
+			close_all : function (obj) {
+				if(this.locked) return this.error("LOCKED");
+				var _this = this;
+				obj = obj ? this.get_node(obj) : this.container;
+				// maybe add .andSelf()
+				obj.find("li.open").each( function () { _this.close_branch(this, true); });
+				this.callback("onclose_all",[this]);
+			},
+
+			set_lang : function (i) { 
+				if(!$.isArray(this.settings.languages) || this.settings.languages.length == 0) return false;
+				if(this.locked) return this.error("LOCKED");
+				if(!$.inArray(i,this.settings.languages) && typeof this.settings.languages[i] != "undefined") i = this.settings.languages[i];
+				if(typeof i == "undefined") return false;
+				if(i == this.current_lang) return true;
+				var st = false;
+				var id = "#" + this.container.attr("id");
+				st = tree_component.get_css(id + " ." + this.current_lang);
+				if(st !== false) st.style.display = "none";
+				st = tree_component.get_css(id + " ." + i);
+				if(st !== false) st.style.display = "";
+				this.current_lang = i;
+				return true;
+			},
+			get_lang : function () {
+				if(!$.isArray(this.settings.languages) || this.settings.languages.length == 0) return false;
+				return this.current_lang;
+			},
+
+			create : function (obj, ref_node, position) { 
+				if(this.locked) return this.error("LOCKED");
+				
+				var root = false;
+				if(ref_node == -1) { root = true; ref_node = this.container; }
+				else ref_node = ref_node ? this.get_node(ref_node) : this.selected;
+
+				if(!root && (!ref_node || !ref_node.size())) return this.error("CREATE: NO NODE SELECTED");
+
+				var pos = position;
+
+				var tmp = ref_node; // for type calculation
+				if(position == "before") {
+					position = ref_node.parent().children().index(ref_node);
+					ref_node = ref_node.parents("li:eq(0)");
+				}
+				if(position == "after") {
+					position = ref_node.parent().children().index(ref_node) + 1;
+					ref_node = ref_node.parents("li:eq(0)");
+				}
+				if(!root && ref_node.size() == 0) { root = true; ref_node = this.container; }
+
+				if(!root) {
+					if(!this.check("creatable", ref_node)) return this.error("CREATE: CANNOT CREATE IN NODE");
+					if(ref_node.hasClass("closed")) {
+						if(this.settings.data.async && ref_node.children("ul").size() == 0) {
+							var _this = this;
+							return this.open_branch(ref_node, true, function () { _this.create.apply(_this, [obj, ref_node, position]); } );
+						}
+						else this.open_branch(ref_node, true);
+					}
+				}
+
+				// creating new object to pass to parseJSON
+				var torename = false; 
+				if(!obj)	obj = {};
+				else		obj = $.extend(true, {}, obj);
+				if(!obj.attributes) obj.attributes = {};
+				if(!obj.attributes[this.settings.rules.type_attr]) obj.attributes[this.settings.rules.type_attr] = this.get_type(tmp) || "default";
+				if(this.settings.languages.length) {
+					if(!obj.data) { obj.data = {}; torename = true; }
+					for(var i = 0; i < this.settings.languages.length; i++) {
+						if(!obj.data[this.settings.languages[i]]) obj.data[this.settings.languages[i]] = ((typeof this.settings.lang.new_node).toLowerCase() != "string" && this.settings.lang.new_node[i]) ? this.settings.lang.new_node[i] : this.settings.lang.new_node;
+					}
+				}
+				else {
+					if(!obj.data) { obj.data = this.settings.lang.new_node; torename = true; }
+				}
+
+				obj = this.callback("ondata",[obj, this]);
+				var obj_s = $.tree.datastores.json().parse(obj,this);
+				obj_s = this.callback("onparse", [obj_s, this]);
+				var $li = $(obj_s);
+
+				if($li.children("ul").size()) {
+					if(!$li.is(".open")) $li.addClass("closed");
+				}
+				else $li.addClass("leaf");
+				$li.find("li:last-child").addClass("last").end().find("li:has(ul)").not(".open").addClass("closed");
+				$li.find("li").not(".open").not(".closed").addClass("leaf");
+
+				var r = {
+					max_depth : this.settings.rules.use_max_depth ? this.check("max_depth", (root ? -1 : ref_node) ) : -1,
+					max_children : this.settings.rules.use_max_children ? this.check("max_children", (root ? -1 : ref_node) ) : -1,
+					valid_children : this.check("valid_children", (root ? -1 : ref_node) )
+				};
+				var nod_type = this.get_type($li);
+				if(typeof r.valid_children != "undefined" && (r.valid_children == "none" || ($.isArray(r.valid_children) && $.inArray(nod_type, r.valid_children) == -1))) return this.error("CREATE: NODE NOT A VALID CHILD");
+
+				if(this.settings.rules.use_max_children) {
+					if(typeof r.max_children != "undefined" && r.max_children != -1 && r.max_children >= this.children(ref_node).size()) return this.error("CREATE: MAX_CHILDREN REACHED");
+				}
+
+				if(this.settings.rules.use_max_depth) {
+					if(typeof r.max_depth != "undefined" && r.max_depth === 0) return this.error("CREATE: MAX-DEPTH REACHED");
+					// check for max_depth up the chain
+					var mx = (r.max_depth > 0) ? r.max_depth : false;
+					var i = 0;
+					var t = ref_node;
+
+					while(t !== -1 && !root) {
+						t = this.parent(t);
+						i ++;
+						var m = this.check("max_depth",t);
+						if(m >= 0) {
+							mx = (mx === false) ? (m - i) : Math.min(mx, m - i);
+						}
+						if(mx !== false && mx <= 0) return this.error("CREATE: MAX-DEPTH REACHED");
+					}
+					if(mx !== false && mx <= 0) return this.error("CREATE: MAX-DEPTH REACHED");
+					if(mx !== false) { 
+						var incr = 1;
+						var t = $li;
+						while(t.size() > 0) {
+							if(mx - incr < 0) return this.error("CREATE: MAX-DEPTH REACHED");
+							t = t.children("ul").children("li");
+							incr ++;
+						}
+					}
+				}
+
+				if((typeof position).toLowerCase() == "undefined" || position == "inside") 
+					position = (this.settings.rules.createat == "top") ? 0 : ref_node.children("ul:eq(0)").children("li").size();
+				if(ref_node.children("ul").size() == 0 || (root == true && ref_node.children("ul").children("li").size() == 0) ) {
+					if(!root)	var a = this.moved($li,ref_node.children("a:eq(0)"),"inside", true);
+					else		var a = this.moved($li,this.container.children("ul:eq(0)"),"inside", true);
+				}
+				else if(pos == "before" && ref_node.children("ul:eq(0)").children("li:nth-child(" + (position + 1) + ")").size())
+					var a = this.moved($li,ref_node.children("ul:eq(0)").children("li:nth-child(" + (position + 1) + ")").children("a:eq(0)"),"before", true);
+				else if(pos == "after" &&  ref_node.children("ul:eq(0)").children("li:nth-child(" + (position) + ")").size())
+					var a = this.moved($li,ref_node.children("ul:eq(0)").children("li:nth-child(" + (position) + ")").children("a:eq(0)"),"after", true);
+				else if(ref_node.children("ul:eq(0)").children("li:nth-child(" + (position + 1) + ")").size())
+					var a = this.moved($li,ref_node.children("ul:eq(0)").children("li:nth-child(" + (position + 1) + ")").children("a:eq(0)"),"before", true);
+				else
+					var a = this.moved($li,ref_node.children("ul:eq(0)").children("li:last").children("a:eq(0)"),"after",true);
+
+				if(a === false) return this.error("CREATE: ABORTED");
+
+				if(torename) {
+					this.select_branch($li.children("a:eq(0)"));
+					this.rename();
+				}
+				return $li;
+			},
+			rename : function (obj, new_name) {
+				if(this.locked) return this.error("LOCKED");
+				obj = obj ? this.get_node(obj) : this.selected;
+				var _this = this;
+				if(!obj || !obj.size()) return this.error("RENAME: NO NODE SELECTED");
+				if(!this.check("renameable", obj)) return this.error("RENAME: NODE NOT RENAMABLE");
+				if(!this.callback("beforerename",[obj.get(0), _this.current_lang, _this])) return this.error("RENAME: STOPPED BY USER");
+
+				obj.parents("li.closed").each(function () { _this.open_branch(this) });
+				if(this.current_lang)	obj = obj.find("a." + this.current_lang);
+				else					obj = obj.find("a:first");
+
+				// Rollback
+				var rb = {}; 
+				rb[this.container.attr("id")] = this.get_rollback();
+
+				var icn = obj.children("ins").clone();
+				if((typeof new_name).toLowerCase() == "string") {
+					obj.text(new_name).prepend(icn);
+					_this.callback("onrename", [_this.get_node(obj).get(0), _this, rb]);
+				}
+				else {
+					var last_value = "";
+					obj.contents().each(function () {
+						if(this.nodeType == 3) { last_value = this.data; return false; }
+					});
+					_this.inp = $("<input type='text' autocomplete='off' />");
+					_this.inp
+						.val(last_value.replace(/&amp;/g,"&").replace(/&gt;/g,">").replace(/&lt;/g,"<"))
+						.bind("mousedown",		function (event) { event.stopPropagation(); })
+						.bind("mouseup",		function (event) { event.stopPropagation(); })
+						.bind("click",			function (event) { event.stopPropagation(); })
+						.bind("keyup",			function (event) { 
+								var key = event.keyCode || event.which;
+								if(key == 27) { this.value = last_value; this.blur(); return }
+								if(key == 13) { this.blur(); return; }
+							});
+					_this.inp.blur(function(event) {
+							if(this.value == "") this.value = last_value; 
+							obj.text(this.value).prepend(icn);
+							obj.get(0).style.display = ""; 
+							obj.prevAll("span").remove(); 
+							_this.inp = false;
+							_this.callback("onrename", [_this.get_node(obj).get(0), _this, rb]);
+						});
+
+					var spn = $("<span />").addClass(obj.attr("class")).append(icn).append(_this.inp);
+					obj.get(0).style.display = "none";
+					obj.parent().prepend(spn);
+					_this.inp.get(0).focus();
+					_this.inp.get(0).select();
+				}
+			},
+			remove : function(obj) {
+				if(this.locked) return this.error("LOCKED");
+				var _this = this;
+
+				// Rollback
+				var rb = {}; 
+				rb[this.container.attr("id")] = this.get_rollback();
+
+				if(obj && (!this.selected || this.get_node(obj).get(0) != this.selected.get(0) )) {
+					obj = this.get_node(obj);
+					if(obj.size()) {
+						if(!this.check("deletable", obj)) return this.error("DELETE: NODE NOT DELETABLE");
+						if(!this.callback("beforedelete",[obj.get(0), _this])) return this.error("DELETE: STOPPED BY USER");
+						$parent = obj.parent();
+						if(obj.find("a.clicked").size()) {
+							var reset_selected = false;
+							_this.selected_arr = [];
+							this.container.find("a.clicked").filter(":first-child").parent().each(function () {
+								if(!reset_selected && this == _this.selected.get(0)) reset_selected = true;
+								if($(this).parents().index(obj) != -1) return true;
+								_this.selected_arr.push($(this));
+							});
+							if(reset_selected) this.selected = this.selected_arr[0] || false;
+						}
+						obj = obj.remove();
+						$parent.children("li:last").addClass("last");
+						if($parent.children("li").size() == 0) {
+							$li = $parent.parents("li:eq(0)");
+							$li.removeClass("open").removeClass("closed").addClass("leaf").children("ul").remove();
+						}
+						this.callback("ondelete", [obj.get(0), this, rb]);
+					}
+				}
+				else if(this.selected) {
+					if(!this.check("deletable", this.selected)) return this.error("DELETE: NODE NOT DELETABLE");
+					if(!this.callback("beforedelete",[this.selected.get(0), _this])) return this.error("DELETE: STOPPED BY USER");
+					$parent = this.selected.parent();
+					var obj = this.selected;
+					if(this.settings.rules.multiple == false || this.selected_arr.length == 1) {
+						var stop = true;
+						var tmp = this.settings.ui.selected_delete == "select_previous" ? this.prev(this.selected) : false;
+					}
+					obj = obj.remove();
+					$parent.children("li:last").addClass("last");
+					if($parent.children("li").size() == 0) {
+						$li = $parent.parents("li:eq(0)");
+						$li.removeClass("open").removeClass("closed").addClass("leaf").children("ul").remove();
+					}
+					if(!stop && this.settings.rules.multiple != false) {
+						var _this = this;
+						this.selected_arr = [];
+						this.container.find("a.clicked").filter(":first-child").parent().each(function () {
+							_this.selected_arr.push($(this));
+						});
+						if(this.selected_arr.length > 0) {
+							this.selected = this.selected_arr[0];
+							this.remove();
+						}
+					}
+					if(stop && tmp) this.select_branch(tmp); 
+					this.callback("ondelete", [obj.get(0), this, rb]);
+				}
+				else return this.error("DELETE: NO NODE SELECTED");
+			},
+
+			next : function (obj, strict) {
+				obj = this.get_node(obj);
+				if(!obj.size()) return false;
+				if(strict) return (obj.nextAll("li").size() > 0) ? obj.nextAll("li:eq(0)") : false;
+
+				if(obj.hasClass("open")) return obj.find("li:eq(0)");
+				else if(obj.nextAll("li").size() > 0) return obj.nextAll("li:eq(0)");
+				else return obj.parents("li").next("li").eq(0);
+			},
+			prev : function(obj, strict) {
+				obj = this.get_node(obj);
+				if(!obj.size()) return false;
+				if(strict) return (obj.prevAll("li").size() > 0) ? obj.prevAll("li:eq(0)") : false;
+
+				if(obj.prev("li").size()) {
+					var obj = obj.prev("li").eq(0);
+					while(obj.hasClass("open")) obj = obj.children("ul:eq(0)").children("li:last");
+					return obj;
+				}
+				else return obj.parents("li:eq(0)").size() ? obj.parents("li:eq(0)") : false;
+			},
+			parent : function(obj) {
+				obj = this.get_node(obj);
+				if(!obj.size()) return false;
+				return obj.parents("li:eq(0)").size() ? obj.parents("li:eq(0)") : -1;
+			},
+			children : function(obj) {
+				if(obj === -1) return this.container.children("ul:eq(0)").children("li");
+
+				obj = this.get_node(obj);
+				if(!obj.size()) return false;
+				return obj.children("ul:eq(0)").children("li");
+			},
+
+			toggle_dots : function () {
+				if(this.settings.ui.dots) {
+					this.settings.ui.dots = false;
+					this.container.children("ul:eq(0)").addClass("no_dots");
+				}
+				else {
+					this.settings.ui.dots = true;
+					this.container.children("ul:eq(0)").removeClass("no_dots");
+				}
+			},
+
+			callback : function (cb, args) {
+				var p = false;
+				var r = null;
+				for(var i in this.settings.plugins) {
+					if(typeof $.tree.plugins[i] != "object") continue;
+					p = $.tree.plugins[i];
+					if(p.callbacks && typeof p.callbacks[cb] == "function") r = p.callbacks[cb].apply(this, args);
+					if(typeof r !== "undefined" && r !== null) {
+						if(cb == "ondata" || cb == "onparse") args[0] = r; // keep the chain if data or parse
+						else return r;
+					}
+				}
+				p = this.settings.callback[cb];
+				if(typeof p == "function") return p.apply(null, args);
+			},
+			get_rollback : function () {
+				var rb = {};
+				rb.html = this.container.html();
+				rb.selected = this.selected ? this.selected.attr("id") : false;
+				return rb;
+			},
+			moved : function (what, where, how, is_new, is_copy, rb) {
+				var what	= $(what);
+				var $parent	= $(what).parents("ul:eq(0)");
+				var $where	= $(where);
+				if($where.is("ins")) $where = $where.parent();
+
+				// Rollback
+				if(!rb) {
+					var rb = {}; 
+					rb[this.container.attr("id")] = this.get_rollback();
+					if(!is_new) {
+						var tmp = what.size() > 1 ? what.eq(0).parents(".tree:eq(0)") : what.parents(".tree:eq(0)");
+						if(tmp.get(0) != this.container.get(0)) {
+							tmp = tree_component.inst[tmp.attr("id")];
+							rb[tmp.container.attr("id")] = tmp.get_rollback();
+						}
+						delete tmp;
+					}
+				}
+
+				if(how == "inside" && this.settings.data.async) {
+					var _this = this;
+					if(this.get_node($where).hasClass("closed")) {
+						return this.open_branch(this.get_node($where), true, function () { _this.moved.apply(_this, [what, where, how, is_new, is_copy, rb]); });
+					}
+					if(this.get_node($where).find("> ul > li > a.loading").size() == 1) {
+						setTimeout(function () { _this.moved.apply(_this, [what, where, how, is_new, is_copy]); }, 200);
+						return;
+					}
+				}
+
+
+				// IF MULTIPLE
+				if(what.size() > 1) {
+					var _this = this;
+					var tmp = this.moved(what.eq(0), where, how, false, is_copy, rb);
+					what.each(function (i) {
+						if(i == 0) return;
+						if(tmp) { // if tmp is false - the previous move was a no-go
+							tmp = _this.moved(this, tmp.children("a:eq(0)"), "after", false, is_copy, rb);
+						}
+					});
+					return what;
+				}
+
+				if(is_copy) {
+					_what = what.clone();
+					_what.each(function (i) {
+						this.id = this.id + "_copy";
+						$(this).find("li").each(function () {
+							this.id = this.id + "_copy";
+						});
+						$(this).removeClass("dragged").find("a.clicked").removeClass("clicked").end().find("li.dragged").removeClass("dragged");
+					});
+				}
+				else _what = what;
+				if(is_new) {
+					if(!this.callback("beforecreate", [this.get_node(what).get(0), this.get_node(where).get(0),how,this])) return false;
+				}
+				else {
+					if(!this.callback("beforemove", [this.get_node(what).get(0), this.get_node(where).get(0),how,this])) return false;
+				}
+
+				if(!is_new) {
+					var tmp = what.parents(".tree:eq(0)");
+					// if different trees
+					if(tmp.get(0) != this.container.get(0)) {
+						tmp = tree_component.inst[tmp.attr("id")];
+
+						// if there are languages - otherwise - no cleanup needed
+						if(tmp.settings.languages.length) {
+							var res = [];
+							// if new tree has no languages - use current visible
+							if(this.settings.languages.length == 0) res.push("." + tmp.current_lang);
+							else {
+								for(var i in this.settings.languages) {
+									if(!this.settings.languages.hasOwnProperty(i)) continue;
+									for(var j in tmp.settings.languages) {
+										if(!tmp.settings.languages.hasOwnProperty(j)) continue;
+										if(this.settings.languages[i] == tmp.settings.languages[j]) res.push("." + this.settings.languages[i]);
+									}
+								}
+							}
+							if(res.length == 0) return this.error("MOVE: NO COMMON LANGUAGES");
+							_what.find("a").not(res.join(",")).remove();
+						}
+						_what.find("a.clicked").removeClass("clicked");
+					}
+				}
+				what = _what;
+
+				// ADD NODE TO NEW PLACE
+				switch(how) {
+					case "before":
+						$where.parents("ul:eq(0)").children("li.last").removeClass("last");
+						$where.parent().before(what.removeClass("last"));
+						$where.parents("ul:eq(0)").children("li:last").addClass("last");
+						break;
+					case "after":
+						$where.parents("ul:eq(0)").children("li.last").removeClass("last");
+						$where.parent().after(what.removeClass("last"));
+						$where.parents("ul:eq(0)").children("li:last").addClass("last");
+						break;
+					case "inside":
+						if($where.parent().children("ul:first").size()) {
+							if(this.settings.rules.createat == "top") {
+								$where.parent().children("ul:first").prepend(what.removeClass("last")).children("li:last").addClass("last");
+
+								// restored this section
+								var tmp_node = $where.parent().children("ul:first").children("li:first");
+								if(tmp_node.size()) {
+									how = "before";
+									where = tmp_node;
+								}
+							}
+							else {
+								// restored this section
+								var tmp_node = $where.parent().children("ul:first").children(".last");
+								if(tmp_node.size()) {
+									how = "after";
+									where = tmp_node;
+								}
+
+								$where.parent().children("ul:first").children(".last").removeClass("last").end().append(what.removeClass("last")).children("li:last").addClass("last");
+							}
+						}
+						else {
+							what.addClass("last");
+							$where.parent().removeClass("leaf").append("<ul/>");
+							if(!$where.parent().hasClass("open")) $where.parent().addClass("closed");
+							$where.parent().children("ul:first").prepend(what);
+						}
+						if($where.parent().hasClass("closed")) { this.open_branch($where); }
+						break;
+					default:
+						break;
+				}
+				// CLEANUP OLD PARENT
+				if($parent.find("li").size() == 0) {
+					var $li = $parent.parent();
+					$li.removeClass("open").removeClass("closed").addClass("leaf");
+					if(!$li.is(".tree")) $li.children("ul").remove();
+					$li.parents("ul:eq(0)").children("li.last").removeClass("last").end().children("li:last").addClass("last");
+				}
+				else {
+					$parent.children("li.last").removeClass("last");
+					$parent.children("li:last").addClass("last");
+				}
+
+				// NO LONGER CORRECT WITH position PARAM - if(is_new && how != "inside") where = this.get_node(where).parents("li:eq(0)");
+				if(is_copy)		this.callback("oncopy", [this.get_node(what).get(0), this.get_node(where).get(0), how, this, rb]);
+				else if(is_new)	this.callback("oncreate", [this.get_node(what).get(0), ($where.is("ul") ? -1 : this.get_node(where).get(0) ), how, this, rb]);
+				else			this.callback("onmove", [this.get_node(what).get(0), this.get_node(where).get(0), how, this, rb]);
+				return what;
+			},
+			error : function (code) {
+				this.callback("error",[code,this]);
+				return false;
+			},
+			lock : function (state) {
+				this.locked = state;
+				if(this.locked)	this.container.children("ul:eq(0)").addClass("locked");
+				else			this.container.children("ul:eq(0)").removeClass("locked");
+			},
+			cut : function (obj) {
+				if(this.locked) return this.error("LOCKED");
+				obj = obj ? this.get_node(obj) : this.container.find("a.clicked").filter(":first-child").parent();
+				if(!obj || !obj.size()) return this.error("CUT: NO NODE SELECTED");
+				tree_component.cut_copy.copy_nodes = false;
+				tree_component.cut_copy.cut_nodes = obj;
+			},
+			copy : function (obj) {
+				if(this.locked) return this.error("LOCKED");
+				obj = obj ? this.get_node(obj) : this.container.find("a.clicked").filter(":first-child").parent();
+				if(!obj || !obj.size()) return this.error("COPY: NO NODE SELECTED");
+				tree_component.cut_copy.copy_nodes = obj;
+				tree_component.cut_copy.cut_nodes = false;
+			},
+			paste : function (obj, position) {
+				if(this.locked) return this.error("LOCKED");
+
+				var root = false;
+				if(obj == -1) { root = true; obj = this.container; }
+				else obj = obj ? this.get_node(obj) : this.selected;
+
+				if(!root && (!obj || !obj.size())) return this.error("PASTE: NO NODE SELECTED");
+				if(!tree_component.cut_copy.copy_nodes && !tree_component.cut_copy.cut_nodes) return this.error("PASTE: NOTHING TO DO");
+
+				var _this = this;
+
+				var pos = position;
+
+				if(position == "before") {
+					position = obj.parent().children().index(obj);
+					obj = obj.parents("li:eq(0)");
+				}
+				else if(position == "after") {
+					position = obj.parent().children().index(obj) + 1;
+					obj = obj.parents("li:eq(0)");
+				}
+				else if((typeof position).toLowerCase() == "undefined" || position == "inside") {
+					position = (this.settings.rules.createat == "top") ? 0 : obj.children("ul:eq(0)").children("li").size();
+				}
+				if(!root && obj.size() == 0) { root = true; obj = this.container; }
+
+				if(tree_component.cut_copy.copy_nodes && tree_component.cut_copy.copy_nodes.size()) {
+					var ok = true;
+					if(!root && !this.check_move(tree_component.cut_copy.copy_nodes, obj.children("a:eq(0)"), "inside")) return false;
+
+					if(obj.children("ul").size() == 0 || (root == true && obj.children("ul").children("li").size() == 0) ) {
+						if(!root)	var a = this.moved(tree_component.cut_copy.copy_nodes,obj.children("a:eq(0)"),"inside", false, true);
+						else		var a = this.moved(tree_component.cut_copy.copy_nodes,this.container.children("ul:eq(0)"),"inside", false, true);
+					}
+					else if(pos == "before" && obj.children("ul:eq(0)").children("li:nth-child(" + (position + 1) + ")").size())
+						var a = this.moved(tree_component.cut_copy.copy_nodes,obj.children("ul:eq(0)").children("li:nth-child(" + (position + 1) + ")").children("a:eq(0)"),"before", false, true);
+					else if(pos == "after" && obj.children("ul:eq(0)").children("li:nth-child(" + (position) + ")").size())
+						var a = this.moved(tree_component.cut_copy.copy_nodes,obj.children("ul:eq(0)").children("li:nth-child(" + (position) + ")").children("a:eq(0)"),"after", false, true);
+					else if(obj.children("ul:eq(0)").children("li:nth-child(" + (position + 1) + ")").size())
+						var a = this.moved(tree_component.cut_copy.copy_nodes,obj.children("ul:eq(0)").children("li:nth-child(" + (position + 1) + ")").children("a:eq(0)"),"before", false, true);
+					else
+						var a = this.moved(tree_component.cut_copy.copy_nodes,obj.children("ul:eq(0)").children("li:last").children("a:eq(0)"),"after", false, true);
+					tree_component.cut_copy.copy_nodes = false;
+				}
+				if(tree_component.cut_copy.cut_nodes && tree_component.cut_copy.cut_nodes.size()) {
+					var ok = true;
+					obj.parents().andSelf().each(function () {
+						if(tree_component.cut_copy.cut_nodes.index(this) != -1) {
+							ok = false;
+							return false;
+						}
+					});
+					if(!ok) return this.error("Invalid paste");
+					if(!root && !this.check_move(tree_component.cut_copy.cut_nodes, obj.children("a:eq(0)"), "inside")) return false;
+
+					if(obj.children("ul").size() == 0 || (root == true && obj.children("ul").children("li").size() == 0) ) {
+						if(!root)	var a = this.moved(tree_component.cut_copy.cut_nodes,obj.children("a:eq(0)"),"inside");
+						else		var a = this.moved(tree_component.cut_copy.cut_nodes,this.container.children("ul:eq(0)"),"inside");
+					}
+					else if(pos == "before" && obj.children("ul:eq(0)").children("li:nth-child(" + (position + 1) + ")").size())
+						var a = this.moved(tree_component.cut_copy.cut_nodes,obj.children("ul:eq(0)").children("li:nth-child(" + (position + 1) + ")").children("a:eq(0)"),"before");
+					else if(pos == "after" && obj.children("ul:eq(0)").children("li:nth-child(" + (position) + ")").size())
+						var a = this.moved(tree_component.cut_copy.cut_nodes,obj.children("ul:eq(0)").children("li:nth-child(" + (position) + ")").children("a:eq(0)"),"after");
+					else if(obj.children("ul:eq(0)").children("li:nth-child(" + (position + 1) + ")").size())
+						var a = this.moved(tree_component.cut_copy.cut_nodes,obj.children("ul:eq(0)").children("li:nth-child(" + (position + 1) + ")").children("a:eq(0)"),"before");
+					else
+						var a = this.moved(tree_component.cut_copy.cut_nodes,obj.children("ul:eq(0)").children("li:last").children("a:eq(0)"),"after");
+					tree_component.cut_copy.cut_nodes = false;
+				}
+			},
+			search : function(str, func) {
+				var _this = this;
+				if(!str || (this.srch && str != this.srch) ) {
+					this.srch = "";
+					this.srch_opn = false;
+					this.container.find("a.search").removeClass("search");
+				}
+				this.srch = str;
+				if(!str) return;
+
+				if(!func) func = "contains";
+				if(this.settings.data.async) {
+					if(!this.srch_opn) {
+						var dd = $.extend( { "search" : str } , this.callback("beforedata", [false, this] ) );
+						$.ajax({
+							type		: this.settings.data.opts.method,
+							url			: this.settings.data.opts.url, 
+							data		: dd, 
+							dataType	: "text",
+							success		: function (data) {
+								_this.srch_opn = $.unique(data.split(","));
+								_this.search.apply(_this,[str, func]);
+							} 
+						});
+					}
+					else if(this.srch_opn.length) {
+						if(this.srch_opn && this.srch_opn.length) {
+							var opn = false;
+							for(var j = 0; j < this.srch_opn.length; j++) {
+								if(this.get_node("#" + this.srch_opn[j]).size() > 0) {
+									opn = true;
+									var tmp = "#" + this.srch_opn[j];
+									delete this.srch_opn[j];
+									this.open_branch(tmp, true, function () { _this.search.apply(_this,[str, func]); } );
+								}
+							}
+							if(!opn) {
+								this.srch_opn = [];
+								 _this.search.apply(_this,[str, func]);
+							}
+						}
+					}
+					else {
+						this.srch_opn = false;
+						var selector = "a";
+						// IF LANGUAGE VERSIONS
+						if(this.settings.languages.length) selector += "." + this.current_lang;
+						this.callback("onsearch", [this.container.find(selector + ":" + func + "('" + str + "')"), this]);
+					}
+				}
+				else {
+					var selector = "a";
+					// IF LANGUAGE VERSIONS
+					if(this.settings.languages.length) selector += "." + this.current_lang;
+					var nn = this.container.find(selector + ":" + func + "('" + str + "')");
+					nn.parents("li.closed").each( function () { _this.open_branch(this, true); });
+					this.callback("onsearch", [nn, this]);
+				}
+			},
+			add_sheet : tree_component.add_sheet,
+
+			destroy : function() {
+				this.callback("ondestroy", [this]);
+
+				this.container.unbind(".jstree");
+				$("#" + this.container.attr("id")).die("click.jstree").die("dblclick.jstree").die("mouseover.jstree").die("mouseout.jstree").die("mousedown.jstree");
+				this.container.removeClass("tree ui-widget ui-widget-content tree-default tree-" + this.settings.ui.theme_name).children("ul").removeClass("no_dots ltr locked").find("li").removeClass("leaf").removeClass("open").removeClass("closed").removeClass("last").children("a").removeClass("clicked hover search");
+
+				if(this.cntr == tree_component.focused) {
+					for(var i in tree_component.inst) {
+						if(i != this.cntr && i != this.container.attr("id")) {
+							tree_component.inst[i].focus();
+							break;
+						}
+					}
+				}
+
+				tree_component.inst[this.cntr] = false;
+				tree_component.inst[this.container.attr("id")] = false;
+				delete tree_component.inst[this.cntr];
+				delete tree_component.inst[this.container.attr("id")];
+				tree_component.cntr --;
+			}
+		}
+	};
+
+	// instance manager
+	tree_component.cntr = 0;
+	tree_component.inst = {};
+
+	// themes
+	tree_component.themes = [];
+
+	// drag'n'drop stuff
+	tree_component.drag_drop = {
+		isdown		: false,	// Is there a drag
+		drag_node	: false,	// The actual node
+		drag_help	: false,	// The helper
+		dragged		: false,
+
+		init_x		: false,
+		init_y		: false,
+		moving		: false,
+
+		origin_tree	: false,
+		marker		: false,
+
+		move_type	: false,	// before, after or inside
+		ref_node	: false,	// reference node
+		appended	: false,	// is helper appended
+
+		foreign		: false,	// Is the dragged node a foreign one
+		droppable	: [],		// Array of classes that can be dropped onto the tree
+
+		open_time	: false,	// Timeout for opening nodes
+		scroll_time	: false		// Timeout for scrolling
+	};
+	tree_component.mouseup = function(event) {
+		var tmp = tree_component.drag_drop;
+		if(tmp.open_time)	clearTimeout(tmp.open_time);
+		if(tmp.scroll_time)	clearTimeout(tmp.scroll_time);
+
+		if(tmp.moving && $.tree.drag_end !== false) $.tree.drag_end.call(null, event, tmp);
+
+		if(tmp.foreign === false && tmp.drag_node && tmp.drag_node.size()) {
+			tmp.drag_help.remove();
+			if(tmp.move_type) {
+				var tree1 = tree_component.inst[tmp.ref_node.parents(".tree:eq(0)").attr("id")];
+				if(tree1) tree1.moved(tmp.dragged, tmp.ref_node, tmp.move_type, false, (tmp.origin_tree.settings.rules.drag_copy == "on" || (tmp.origin_tree.settings.rules.drag_copy == "ctrl" && event.ctrlKey) ) );
+			}
+			tmp.move_type	= false;
+			tmp.ref_node	= false;
+		}
+		if(tmp.foreign !== false) {
+			if(tmp.drag_help) tmp.drag_help.remove();
+			if(tmp.move_type) {
+				var tree1 = tree_component.inst[tmp.ref_node.parents(".tree:eq(0)").attr("id")];
+				if(tree1) tree1.callback("ondrop",[tmp.f_data, tree1.get_node(tmp.ref_node).get(0), tmp.move_type, tree1]);
+			}
+			tmp.foreign		= false;
+			tmp.move_type	= false;
+			tmp.ref_node	= false;
+		}
+		// RESET EVERYTHING
+		if(tree_component.drag_drop.marker) tree_component.drag_drop.marker.hide();
+		if(tmp.dragged && tmp.dragged.size()) tmp.dragged.removeClass("dragged");
+		tmp.dragged		= false;
+		tmp.drag_help	= false;
+		tmp.drag_node	= false;
+		tmp.f_type		= false;
+		tmp.f_data		= false;
+		tmp.init_x		= false;
+		tmp.init_y		= false;
+		tmp.moving		= false;
+		tmp.appended	= false;
+		tmp.origin_tree	= false;
+		if(tmp.isdown) {
+			tmp.isdown = false;
+			event.preventDefault(); 
+			event.stopPropagation();
+			return false;
+		}
+	};
+	tree_component.mousemove = function(event) {
+		var tmp = tree_component.drag_drop;
+		var is_start = false;
+
+		if(tmp.isdown) {
+			if(!tmp.moving && Math.abs(tmp.init_x - event.pageX) < 5 && Math.abs(tmp.init_y - event.pageY) < 5) {
+				event.preventDefault();
+				event.stopPropagation();
+				return false;
+			}
+			else {
+				if(!tmp.moving) {
+					tree_component.drag_drop.moving = true;
+					is_start = true;
+				}
+			}
+
+			if(tmp.open_time) clearTimeout(tmp.open_time);
+
+			if(tmp.drag_help !== false) {
+				if(!tmp.appended) {
+					if(tmp.foreign !== false) tmp.origin_tree = $.tree.focused();
+					$("body").append(tmp.drag_help);
+					tmp.w = tmp.drag_help.width();
+					tmp.appended = true;
+				}
+				tmp.drag_help.css({ "left" : (event.pageX + 5 ), "top" : (event.pageY + 15) });
+			}
+
+			if(is_start && $.tree.drag_start !== false) $.tree.drag_start.call(null, event, tmp);
+			if($.tree.drag !== false) $.tree.drag.call(null, event, tmp);
+
+			if(event.target.tagName == "DIV" && event.target.id == "jstree-marker") return false;
+
+			var et = $(event.target);
+			if(et.is("ins")) et = et.parent();
+			var cnt = et.is(".tree") ? et : et.parents(".tree:eq(0)");
+
+			// if not moving over a tree
+			if(cnt.size() == 0 || !tree_component.inst[cnt.attr("id")]) {
+				if(tmp.scroll_time) clearTimeout(tmp.scroll_time);
+				if(tmp.drag_help !== false) tmp.drag_help.find("li:eq(0) ins").addClass("forbidden");
+				tmp.move_type	= false;
+				tmp.ref_node	= false;
+				tree_component.drag_drop.marker.hide();
+				return false;
+			}
+
+			var tree2 = tree_component.inst[cnt.attr("id")];
+			tree2.off_height();
+
+			if(tmp.scroll_time) clearTimeout(tmp.scroll_time);
+			tmp.scroll_time = setTimeout( function() { tree2.scroll_check(event.pageX,event.pageY); }, 50);
+
+			var mov = false;
+			var st = cnt.scrollTop();
+
+			if(event.target.tagName == "A" || event.target.tagName == "INS") {
+				// just in case if hover is over the draggable
+				if(et.is("#jstree-dragged")) return false;
+				if(tree2.get_node(event.target).hasClass("closed")) {
+					tmp.open_time = setTimeout( function () { tree2.open_branch(et); }, 500);
+				}
+
+				var et_off = et.offset();
+				var goTo = { 
+					x : (et_off.left - 1),
+					y : (event.pageY - et_off.top)
+				};
+
+				var arr = [];
+				if(goTo.y < tree2.li_height/3 + 1 )			arr = ["before","inside","after"];
+				else if(goTo.y > tree2.li_height*2/3 - 1 )	arr = ["after","inside","before"];
+				else {
+					if(goTo.y < tree2.li_height/2)			arr = ["inside","before","after"];
+					else									arr = ["inside","after","before"];
+				}
+				var ok = false;
+				var nn = (tmp.foreign == false) ? tmp.origin_tree.container.find("li.dragged") : tmp.f_type;
+				$.each(arr, function(i, val) {
+					if(tree2.check_move(nn, et, val)) {
+						mov = val;
+						ok = true;
+						return false;
+					}
+				});
+				if(ok) {
+					switch(mov) {
+						case "before":
+							goTo.y = et_off.top - 2;
+							tree_component.drag_drop.marker.attr("class","marker");
+							break;
+						case "after":
+							goTo.y = et_off.top - 2 + tree2.li_height;
+							tree_component.drag_drop.marker.attr("class","marker");
+							break;
+						case "inside":
+							goTo.x -= 2;
+							goTo.y = et_off.top - 2 + tree2.li_height/2;
+							tree_component.drag_drop.marker.attr("class","marker_plus"); 
+							break;
+					}
+					tmp.move_type	= mov;
+					tmp.ref_node	= $(event.target);
+					if(tmp.drag_help !== false) tmp.drag_help.find(".forbidden").removeClass("forbidden");
+					tree_component.drag_drop.marker.css({ "left" : goTo.x , "top" : goTo.y }).show();
+				}
+			}
+
+			if( (et.is(".tree") || et.is("ul") ) && et.find("li:eq(0)").size() == 0) {
+				var et_off = et.offset();
+				tmp.move_type	= "inside";
+				tmp.ref_node	= cnt.children("ul:eq(0)");
+				if(tmp.drag_help !== false) tmp.drag_help.find(".forbidden").removeClass("forbidden");
+				tree_component.drag_drop.marker.attr("class","marker_plus");
+				tree_component.drag_drop.marker.css({ "left" : (et_off.left + 10) , "top" : et_off.top + 15 }).show();
+			}
+			else if( (event.target.tagName != "A" && event.target.tagName != "INS") || !ok) {
+				if(tmp.drag_help !== false) tmp.drag_help.find("li:eq(0) ins").addClass("forbidden");
+				tmp.move_type	= false;
+				tmp.ref_node	= false;
+				tree_component.drag_drop.marker.hide();
+			}
+			event.preventDefault();
+			event.stopPropagation();
+			return false;
+		}
+		return true;
+	};
+	$(function () { 
+		$(document).bind("mousemove.jstree",	tree_component.mousemove); 
+		$(document).bind("mouseup.jstree",		tree_component.mouseup); 
+	});
+
+	// cut, copy, paste stuff
+	tree_component.cut_copy = { 
+		copy_nodes : false,
+		cut_nodes : false
+	};
+
+	// css stuff
+	tree_component.css = false;
+	tree_component.get_css = function(rule_name, delete_flag) {
+		rule_name = rule_name.toLowerCase();
+		var css_rules = tree_component.css.cssRules || tree_component.css.rules;
+		var j = 0;
+		do {
+			if(css_rules.length && j > css_rules.length + 5) return false;
+			if(css_rules[j].selectorText && css_rules[j].selectorText.toLowerCase() == rule_name) {
+				if(delete_flag == true) {
+					if(tree_component.css.removeRule) document.styleSheets[i].removeRule(j);
+					if(tree_component.css.deleteRule) document.styleSheets[i].deleteRule(j);
+					return true;
+				}
+				else return css_rules[j];
+			}
+		}
+		while (css_rules[++j]);
+		return false;
+	};
+	tree_component.add_css = function(rule_name) {
+		if(tree_component.get_css(rule_name)) return false;
+		(tree_component.css.insertRule) ? tree_component.css.insertRule(rule_name + ' { }', 0) : tree_component.css.addRule(rule_name, null, 0);
+		return tree_component.get_css(rule_name);
+	};
+	tree_component.remove_css = function(rule_name) { 
+		return tree_component.get_css(rule_name, true); 
+	};
+	tree_component.add_sheet = function(opts) {
+		if(opts.str) {
+			var tmp = document.createElement("style");
+			tmp.setAttribute('type',"text/css");
+			if(tmp.styleSheet) {
+				document.getElementsByTagName("head")[0].appendChild(tmp);
+				tmp.styleSheet.cssText = opts.str;
+			}
+			else {
+				tmp.appendChild(document.createTextNode(opts.str));
+				document.getElementsByTagName("head")[0].appendChild(tmp);
+			}
+			return tmp.sheet || tmp.styleSheet;
+		}
+		if(opts.url) {
+			if(document.createStyleSheet) {
+				try { document.createStyleSheet(opts.url); } catch (e) { };
+			}
+			else {
+				var newSS	= document.createElement('link');
+				newSS.rel	= 'stylesheet';
+				newSS.type	= 'text/css';
+				newSS.media	= "all";
+				newSS.href	= opts.url;
+				// var styles	= "@import url(' " + url + " ');";
+				// newSS.href	='data:text/css,'+escape(styles);
+				document.getElementsByTagName("head")[0].appendChild(newSS);
+				return newSS.styleSheet;
+			}
+		}
+	};
+	$(function () {
+		var u = navigator.userAgent.toLowerCase();
+		var v = (u.match( /.+(?:rv|it|ra|ie)[\/: ]([\d.]+)/ ) || [0,'0'])[1];
+
+		var css = '/* TREE LAYOUT */ .tree ul { margin:0 0 0 5px; padding:0 0 0 0; list-style-type:none; } .tree li { display:block; min-height:18px; line-height:18px; padding:0 0 0 15px; margin:0 0 0 0; /* Background fix */ clear:both; } .tree li ul { display:none; } .tree li a, .tree li span { display:inline-block;line-height:16px;height:16px;color:black;white-space:nowrap;text-decoration:none;padding:1px 4px 1px 4px;margin:0; } .tree li a:focus { outline: none; } .tree li a input, .tree li span input { margin:0;padding:0 0;display:inline-block;height:12px !important;border:1px solid white;background:white;font-size:10px;font-family:Verdana; } .tree li a input:not([class="xxx"]), .tree li span input:not([class="xxx"]) { padding:1px 0; } /* FOR DOTS */ .tree .ltr li.last { float:left; } .tree > ul li.last { overflow:visible; } /* OPEN OR CLOSE */ .tree li.open ul { display:block; } .tree li.closed ul { display:none !important; } /* FOR DRAGGING */ #jstree-dragged { position:absolute; top:-10px; left:-10px; margin:0; padding:0; } #jstree-dragged ul ul ul { display:none; } #jstree-marker { padding:0; margin:0; line-height:5px; font-size:1px; overflow:hidden; height:5px; position:absolute; left:-45px; top:-30px; z-index:1000; background-color:transparent; background-repeat:no-repeat; display:none; } #jstree-marker.marker { width:45px; background-position:-32px top; } #jstree-marker.marker_plus { width:5px; background-position:right top; } /* BACKGROUND DOTS */ .tree li li { overflow:hidden; } .tree > .ltr > li { display:table; } /* ICONS */ .tree ul ins { display:inline-block; text-decoration:none; width:16px; height:16px; } .tree .ltr ins { margin:0 4px 0 0px; } ';
+		if($.browser.msie) { 
+			if($.browser.version == 6) css += '.tree li { height:18px; zoom:1; } .tree li li { overflow:visible; } .tree .ltr li.last { margin-top: expression( (this.previousSibling && /open/.test(this.previousSibling.className) ) ? "-2px" : "0"); } .marker { width:45px; background-position:-32px top; } .marker_plus { width:5px; background-position:right top; }';
+			if($.browser.version == 7) css += '.tree li li { overflow:visible; } .tree .ltr li.last { margin-top: expression( (this.previousSibling && /open/.test(this.previousSibling.className) ) ? "-2px" : "0"); }';
+		}
+		if($.browser.opera) css += '.tree > ul > li.last:after { content:"."; display: block; height:1px; clear:both; visibility:hidden; }';
+		if($.browser.mozilla && $.browser.version.indexOf("1.8") == 0) css += '.tree .ltr li a { display:inline; float:left; } .tree li ul { clear:both; }';
+		tree_component.css = tree_component.add_sheet({ str : css });
+	});
+})(jQuery);
+
+// Datastores
+// HTML and JSON are included here by default
+(function ($) {
+	$.extend($.tree.datastores, {
+		"html" : function () {
+			return {
+				get		: function(obj, tree, opts) {
+					return obj && $(obj).size() ? $('<div>').append(tree.get_node(obj).clone()).html() : tree.container.children("ul:eq(0)").html();
+				},
+				parse	: function(data, tree, opts, callback) {
+					if(callback) callback.call(null, data);
+					return data;
+				},
+				load	: function(data, tree, opts, callback) {
+					if(opts.url) {
+						$.ajax({
+							'type'		: opts.method,
+							'url'		: opts.url, 
+							'data'		: data, 
+							'dataType'	: "html",
+							'success'	: function (d, textStatus) {
+								callback.call(null, d);
+							},
+							'error'		: function (xhttp, textStatus, errorThrown) { 
+								callback.call(null, false);
+								tree.error(errorThrown + " " + textStatus); 
+							}
+						});
+					}
+					else {
+						callback.call(null, opts.static || tree.container.children("ul:eq(0)").html());
+					}
+				}
+			};
+		},
+		"json" : function () {
+			return {
+				get		: function(obj, tree, opts) { 
+					var _this = this;
+					if(!obj || $(obj).size() == 0) obj = tree.container.children("ul").children("li");
+					else obj = $(obj);
+
+					if(!opts) opts = {};
+					if(!opts.outer_attrib) opts.outer_attrib = [ "id", "rel", "class" ];
+					if(!opts.inner_attrib) opts.inner_attrib = [ ];
+
+					if(obj.size() > 1) {
+						var arr = [];
+						obj.each(function () {
+							arr.push(_this.get(this, tree, opts));
+						});
+						return arr;
+					}
+					if(obj.size() == 0) return [];
+
+					var json = { attributes : {}, data : {} };
+					if(obj.hasClass("open")) json.data.state = "open";
+					if(obj.hasClass("closed")) json.data.state = "closed";
+
+					for(var i in opts.outer_attrib) {
+						if(!opts.outer_attrib.hasOwnProperty(i)) continue;
+						var val = (opts.outer_attrib[i] == "class") ? obj.attr(opts.outer_attrib[i]).replace(/(^| )last( |$)/ig," ").replace(/(^| )(leaf|closed|open)( |$)/ig," ") : obj.attr(opts.outer_attrib[i]);
+						if(typeof val != "undefined" && val.toString().replace(" ","").length > 0) json.attributes[opts.outer_attrib[i]] = val;
+						delete val;
+					}
+					
+					if(tree.settings.languages.length) {
+						for(var i in tree.settings.languages) {
+							if(!tree.settings.languages.hasOwnProperty(i)) continue;
+							var a = obj.children("a." + tree.settings.languages[i]);
+							if(opts.force || opts.inner_attrib.length || a.children("ins").get(0).style.backgroundImage.toString().length || a.children("ins").get(0).className.length) {
+								json.data[tree.settings.languages[i]] = {};
+								json.data[tree.settings.languages[i]].title = tree.get_text(obj,tree.settings.languages[i]);
+								if(a.children("ins").get(0).style.className.length) {
+									json.data[tree.settings.languages[i]].icon = a.children("ins").get(0).style.className;
+								}
+								if(a.children("ins").get(0).style.backgroundImage.length) {
+									json.data[tree.settings.languages[i]].icon = a.children("ins").get(0).style.backgroundImage.replace("url(","").replace(")","");
+								}
+								if(opts.inner_attrib.length) {
+									json.data[tree.settings.languages[i]].attributes = {};
+									for(var j in opts.inner_attrib) {
+										if(!opts.inner_attrib.hasOwnProperty(j)) continue;
+										var val = a.attr(opts.inner_attrib[j]);
+										if(typeof val != "undefined" && val.toString().replace(" ","").length > 0) json.data[tree.settings.languages[i]].attributes[opts.inner_attrib[j]] = val;
+										delete val;
+									}
+								}
+							}
+							else {
+								json.data[tree.settings.languages[i]] = tree.get_text(obj,tree.settings.languages[i]);
+							}
+						}
+					}
+					else {
+						var a = obj.children("a");
+						json.data.title = tree.get_text(obj);
+
+						if(a.children("ins").size() && a.children("ins").get(0).className.length) {
+							json.data.icon = a.children("ins").get(0).className;
+						}
+						if(a.children("ins").size() && a.children("ins").get(0).style.backgroundImage.length) {
+							json.data.icon = a.children("ins").get(0).style.backgroundImage.replace("url(","").replace(")","");
+						}
+
+						if(opts.inner_attrib.length) {
+							json.data.attributes = {};
+							for(var j in opts.inner_attrib) {
+								if(!opts.inner_attrib.hasOwnProperty(j)) continue;
+								var val = a.attr(opts.inner_attrib[j]);
+								if(typeof val != "undefined" && val.toString().replace(" ","").length > 0) json.data.attributes[opts.inner_attrib[j]] = val;
+								delete val;
+							}
+						}
+					}
+
+					if(obj.children("ul").size() > 0) {
+						json.children = [];
+						obj.children("ul").children("li").each(function () {
+							json.children.push(_this.get(this, tree, opts));
+						});
+					}
+					return json;
+				},
+				parse	: function(data, tree, opts, callback) { 
+					if(Object.prototype.toString.apply(data) === "[object Array]") {
+						var str = '';
+						for(var i = 0; i < data.length; i ++) {
+							if(typeof data[i] == "function") continue;
+							str += this.parse(data[i], tree, opts);
+						}
+						if(callback) callback.call(null, str);
+						return str;
+					}
+
+					if(!data || !data.data) {
+						if(callback) callback.call(null, false);
+						return "";
+					}
+
+					var str = '';
+					str += "<li ";
+					var cls = false;
+					if(data.attributes) {
+						for(var i in data.attributes) {
+							if(!data.attributes.hasOwnProperty(i)) continue;
+							if(i == "class") {
+								str += " class='" + data.attributes[i] + " ";
+								if(data.state == "closed" || data.state == "open") str += " " + data.state + " ";
+								str += "' ";
+								cls = true;
+							}
+							else str += " " + i + "='" + data.attributes[i] + "' ";
+						}
+					}
+					if(!cls && (data.state == "closed" || data.state == "open")) str += " class='" + data.state + "' ";
+					str += ">";
+
+					if(tree.settings.languages.length) {
+						for(var i = 0; i < tree.settings.languages.length; i++) {
+							var attr = {};
+							attr["href"] = "";
+							attr["style"] = "";
+							attr["class"] = tree.settings.languages[i];
+							if(data.data[tree.settings.languages[i]] && (typeof data.data[tree.settings.languages[i]].attributes).toLowerCase() != "undefined") {
+								for(var j in data.data[tree.settings.languages[i]].attributes) {
+									if(!data.data[tree.settings.languages[i]].attributes.hasOwnProperty(j)) continue;
+									if(j == "style" || j == "class")	attr[j] += " " + data.data[tree.settings.languages[i]].attributes[j];
+									else								attr[j]  = data.data[tree.settings.languages[i]].attributes[j];
+								}
+							}
+							str += "<a";
+							for(var j in attr) {
+								if(!attr.hasOwnProperty(j)) continue;
+								str += ' ' + j + '="' + attr[j] + '" ';
+							}
+							str += ">";
+							if(data.data[tree.settings.languages[i]] && data.data[tree.settings.languages[i]].icon) {
+								str += "<ins " + (data.data[tree.settings.languages[i]].icon.indexOf("/") == -1 ? " class='" + data.data[tree.settings.languages[i]].icon + "' " : " style='background-image:url(\"" + data.data[tree.settings.languages[i]].icon + "\");' " ) + ">&nbsp;</ins>";
+							}
+							else str += "<ins>&nbsp;</ins>";
+							str += ( (typeof data.data[tree.settings.languages[i]].title).toLowerCase() != "undefined" ? data.data[tree.settings.languages[i]].title : data.data[tree.settings.languages[i]] ) + "</a>";
+						}
+					}
+					else {
+						var attr = {};
+						attr["href"] = "";
+						attr["style"] = "";
+						attr["class"] = "";
+						if((typeof data.data.attributes).toLowerCase() != "undefined") {
+							for(var i in data.data.attributes) {
+								if(!data.data.attributes.hasOwnProperty(i)) continue;
+								if(i == "style" || i == "class")	attr[i] += " " + data.data.attributes[i];
+								else								attr[i]  = data.data.attributes[i];
+							}
+						}
+						str += "<a";
+						for(var i in attr) {
+							if(!attr.hasOwnProperty(i)) continue;
+							str += ' ' + i + '="' + attr[i] + '" ';
+						}
+						str += ">";
+						if(data.data.icon) {
+							str += "<ins " + (data.data.icon.indexOf("/") == -1 ? " class='" + data.data.icon + "' " : " style='background-image:url(\"" + data.data.icon + "\");' " ) + ">&nbsp;</ins>";
+						}
+						else str += "<ins>&nbsp;</ins>";
+						str += ( (typeof data.data.title).toLowerCase() != "undefined" ? data.data.title : data.data ) + "</a>";
+					}
+					if(data.children && data.children.length) {
+						str += '<ul>';
+						for(var i = 0; i < data.children.length; i++) {
+							str += this.parse(data.children[i], tree, opts);
+						}
+						str += '</ul>';
+					}
+					str += "</li>";
+					if(callback) callback.call(null, str);
+					return str;
+				},
+				load	: function(data, tree, opts, callback) {
+					if(opts.static) {
+						callback.call(null, opts.static);
+					} 
+					else {
+						$.ajax({
+							'type'		: opts.method,
+							'url'		: opts.url, 
+							'data'		: data, 
+							'dataType'	: "json",
+							'success'	: function (d, textStatus) {
+								callback.call(null, d);
+							},
+							'error'		: function (xhttp, textStatus, errorThrown) { 
+								callback.call(null, false);
+								tree.error(errorThrown + " " + textStatus); 
+							}
+						});
+					}
+				}
+			}
+		}
+	});
+})(jQuery);
\ No newline at end of file

Added: trunk/mapbender/http/extensions/jsTree.v.0.9.9a2/jquery.tree.min.js
===================================================================
--- trunk/mapbender/http/extensions/jsTree.v.0.9.9a2/jquery.tree.min.js	                        (rev 0)
+++ trunk/mapbender/http/extensions/jsTree.v.0.9.9a2/jquery.tree.min.js	2010-04-29 14:24:49 UTC (rev 6040)
@@ -0,0 +1,185 @@
+
+(function($){$.tree={datastores:{},plugins:{},defaults:{data:{async:false,type:"html",opts:{method:"GET",url:false}},selected:false,opened:[],languages:[],ui:{dots:true,animation:0,scroll_spd:4,theme_path:false,theme_name:"default",selected_parent_close:"select_parent",selected_delete:"select_previous"},types:{"default":{clickable:true,renameable:true,deletable:true,creatable:true,draggable:true,max_children:-1,max_depth:-1,valid_children:"all",icon:{image:false,position:false}}},rules:{multiple:false,multitree:"none",type_attr:"rel",createat:"bottom",drag_copy:"ctrl",drag_button:"left",use_max_children:true,use_max_depth:true,max_children:-1,max_depth:-1,valid_children:"all"},lang:{new_node:"New folder",loading:"Loading ..."},callback:{beforechange:function(NODE,TREE_OBJ){return true},beforeopen:function(NODE,TREE_OBJ){return true},beforeclose:function(NODE,TREE_OBJ){return true},beforemove:function(NODE,REF_NODE,TYPE,TREE_OBJ){return true},beforecreate:function(NODE,REF_NODE,TYPE,TREE_OBJ){return true},beforerename:function(NODE,LANG,TREE_OBJ){return true},beforedelete:function(NODE,TREE_OBJ){return true},beforedata:function(NODE,TREE_OBJ){return{id:$(NODE).attr("id")||0}},ondata:function(DATA,TREE_OBJ){return DATA;},onparse:function(STR,TREE_OBJ){return STR;},onhover:function(NODE,TREE_OBJ){},onselect:function(NODE,TREE_OBJ){},ondeselect:function(NODE,TREE_OBJ){},onchange:function(NODE,TREE_OBJ){},onrename:function(NODE,TREE_OBJ,RB){},onmove:function(NODE,REF_NODE,TYPE,TREE_OBJ,RB){},oncopy:function(NODE,REF_NODE,TYPE,TREE_OBJ,RB){},oncreate:function(NODE,REF_NODE,TYPE,TREE_OBJ,RB){},ondelete:function(NODE,TREE_OBJ,RB){},onopen:function(NODE,TREE_OBJ){},onopen_all:function(TREE_OBJ){},onclose_all:function(TREE_OBJ){},onclose:function(NODE,TREE_OBJ){},error:function(TEXT,TREE_OBJ){},ondblclk:function(NODE,TREE_OBJ){TREE_OBJ.toggle_branch.call(TREE_OBJ,NODE);TREE_OBJ.select_branch.call(TREE_OBJ,NODE);},onrgtclk:function(NODE,TREE_OBJ,EV){},onload:function(TREE_OBJ){},oninit:function(TREE_OBJ){},onfocus:function(TREE_OBJ){},ondestroy:function(TREE_OBJ){},onsearch:function(NODES,TREE_OBJ){NODES.addClass("search");},ondrop:function(NODE,REF_NODE,TYPE,TREE_OBJ){},check:function(RULE,NODE,VALUE,TREE_OBJ){return VALUE;},check_move:function(NODE,REF_NODE,TYPE,TREE_OBJ){return true;}},plugins:{}},create:function(){return new tree_component();},focused:function(){return tree_component.inst[tree_component.focused];},reference:function(obj){var o=$(obj);if(!o.size())o=$("#"+obj);if(!o.size())return null;o=(o.is(".tree"))?o.attr("id"):o.parents(".tree:eq(0)").attr("id");return tree_component.inst[o]||null;},rollback:function(data){for(var i in data){if(!data.hasOwnProperty(i))continue;var tmp=tree_component.inst[i];var lock=!tmp.locked;if(lock)tmp.lock(true);tmp.inp=false;tmp.container.html(data[i].html).find(".dragged").removeClass("dragged").end().find(".hover").removeClass("hover");if(data[i].selected){tmp.selected=$("#"+data[i].selected);tmp.selected_arr=[];tmp.container.find("a.clicked").each(function(){tmp.selected_arr.push(tmp.get_node(this));});}
+if(lock)tmp.lock(false);delete lock;delete tmp;}},drop_mode:function(opts){opts=$.extend(opts,{show:false,type:"default",str:"Foreign node"});tree_component.drag_drop.foreign=true;tree_component.drag_drop.isdown=true;tree_component.drag_drop.moving=true;tree_component.drag_drop.appended=false;tree_component.drag_drop.f_type=opts.type;tree_component.drag_drop.f_data=opts;if(!opts.show){tree_component.drag_drop.drag_help=false;tree_component.drag_drop.drag_node=false;}
+else{tree_component.drag_drop.drag_help=$("<div id='jstree-dragged' class='tree tree-default'><ul><li class='last dragged foreign'><a href='#'><ins>&nbsp;</ins>"+opts.str+"</a></li></ul></div>");tree_component.drag_drop.drag_node=tree_component.drag_drop.drag_help.find("li:eq(0)");}
+if($.tree.drag_start!==false)$.tree.drag_start.call(null,false);},drag_start:false,drag:false,drag_end:false};$.fn.tree=function(opts){return this.each(function(){var conf=$.extend({},opts);if(tree_component.inst&&tree_component.inst[$(this).attr('id')])tree_component.inst[$(this).attr('id')].destroy();if(conf!==false)new tree_component().init(this,conf);});};function tree_component(){return{cntr:++tree_component.cntr,settings:$.extend({},$.tree.defaults),init:function(elem,conf){var _this=this;this.container=$(elem);if(this.container.size==0)return false;tree_component.inst[this.cntr]=this;if(!this.container.attr("id"))this.container.attr("id","jstree_"+this.cntr);tree_component.inst[this.container.attr("id")]=tree_component.inst[this.cntr];tree_component.focused=this.cntr;this.settings=$.extend(true,{},this.settings,conf);if(this.settings.languages&&this.settings.languages.length){this.current_lang=this.settings.languages[0];var st=false;var id="#"+this.container.attr("id");for(var ln=0;ln<this.settings.languages.length;ln++){st=tree_component.add_css(id+" ."+this.settings.languages[ln]);if(st!==false)st.style.display=(this.settings.languages[ln]==this.current_lang)?"":"none";}}
+else this.current_lang=false;this.container.addClass("tree");if(this.settings.ui.theme_name!==false){if(this.settings.ui.theme_path===false){$("script").each(function(){if(this.src.toString().match(/jquery\.tree.*?js$/)){_this.settings.ui.theme_path=this.src.toString().replace(/jquery\.tree.*?js$/,"")+"themes/"+_this.settings.ui.theme_name+"/style.css";return false;}});}
+if(this.settings.ui.theme_path!=""&&$.inArray(this.settings.ui.theme_path,tree_component.themes)==-1){tree_component.add_sheet({url:this.settings.ui.theme_path});tree_component.themes.push(this.settings.ui.theme_path);}
+this.container.addClass("tree-"+this.settings.ui.theme_name);}
+var type_icons="";for(var t in this.settings.types){if(!this.settings.types.hasOwnProperty(t))continue;if(!this.settings.types[t].icon)continue;if(this.settings.types[t].icon.image||this.settings.types[t].icon.position){if(t=="default")type_icons+="#"+this.container.attr("id")+" li > a ins { ";else type_icons+="#"+this.container.attr("id")+" li[rel="+t+"] > a ins { ";if(this.settings.types[t].icon.image)type_icons+=" background-image:url("+this.settings.types[t].icon.image+"); ";if(this.settings.types[t].icon.position)type_icons+=" background-position:"+this.settings.types[t].icon.position+"; ";type_icons+="} ";}}
+if(type_icons!="")tree_component.add_sheet({str:type_icons});if(this.settings.rules.multiple)this.selected_arr=[];this.offset=false;this.hovered=false;this.locked=false;if(tree_component.drag_drop.marker===false)tree_component.drag_drop.marker=$("<div>").attr({id:"jstree-marker"}).hide().appendTo("body");this.callback("oninit",[this]);this.refresh();this.attach_events();this.focus();},refresh:function(obj){if(this.locked)return this.error("LOCKED");var _this=this;if(obj&&!this.settings.data.async)obj=false;this.is_partial_refresh=obj?true:false;this.opened=Array();if(this.settings.opened!=false){$.each(this.settings.opened,function(i,item){if(this.replace(/^#/,"").length>0){_this.opened.push("#"+this.replace(/^#/,""));}});this.settings.opened=false;}
+else{this.container.find("li.open").each(function(i){if(this.id){_this.opened.push("#"+this.id);}});}
+if(this.selected){this.settings.selected=Array();if(obj){$(obj).find("li:has(a.clicked)").each(function(){if(this.id)_this.settings.selected.push("#"+this.id);});}
+else{if(this.selected_arr){$.each(this.selected_arr,function(){if(this.attr("id"))_this.settings.selected.push("#"+this.attr("id"));});}
+else{if(this.selected.attr("id"))this.settings.selected.push("#"+this.selected.attr("id"));}}}
+else if(this.settings.selected!==false){var tmp=Array();if((typeof this.settings.selected).toLowerCase()=="object"){$.each(this.settings.selected,function(){if(this.replace(/^#/,"").length>0)tmp.push("#"+this.replace(/^#/,""));});}
+else{if(this.settings.selected.replace(/^#/,"").length>0)tmp.push("#"+this.settings.selected.replace(/^#/,""));}
+this.settings.selected=tmp;}
+if(obj&&this.settings.data.async){this.opened=Array();obj=this.get_node(obj);obj.find("li.open").each(function(i){_this.opened.push("#"+this.id);});if(obj.hasClass("open"))obj.removeClass("open").addClass("closed");if(obj.hasClass("leaf"))obj.removeClass("leaf");obj.children("ul:eq(0)").html("");return this.open_branch(obj,true,function(){_this.reselect.apply(_this);});}
+var _this=this;var _datastore=new $.tree.datastores[this.settings.data.type]();if(this.container.children("ul").size()==0){this.container.html("<ul class='ltr' style='direction:ltr;'><li class='last'><a class='loading' href='#'><ins>&nbsp;</ins>"+(this.settings.lang.loading||"Loading ...")+"</a></li></ul>");}
+_datastore.load(this.callback("beforedata",[false,this]),this,this.settings.data.opts,function(data){data=_this.callback("ondata",[data,_this]);_datastore.parse(data,_this,_this.settings.data.opts,function(str){str=_this.callback("onparse",[str,_this]);_this.container.empty().append($("<ul class='ltr'>").html(str));_this.container.find("li:last-child").addClass("last").end().find("li:has(ul)").not(".open").addClass("closed");_this.container.find("li").not(".open").not(".closed").addClass("leaf");_this.reselect();});});},reselect:function(is_callback){var _this=this;if(!is_callback)this.cl_count=0;else this.cl_count--;if(this.opened&&this.opened.length){var opn=false;for(var j=0;this.opened&&j<this.opened.length;j++){if(this.settings.data.async){var tmp=this.get_node(this.opened[j]);if(tmp.size()&&tmp.hasClass("closed")>0){opn=true;var tmp=this.opened[j].toString().replace('/','\\/');delete this.opened[j];this.open_branch(tmp,true,function(){_this.reselect.apply(_this,[true]);});this.cl_count++;}}
+else this.open_branch(this.opened[j],true);}
+if(this.settings.data.async&&opn)return;if(this.cl_count>0)return;delete this.opened;}
+if(this.cl_count>0)return;this.container.css("direction","ltr").children("ul:eq(0)").addClass("ltr");if(this.settings.ui.dots==false)this.container.children("ul:eq(0)").addClass("no_dots");if(this.scrtop){this.container.scrollTop(_this.scrtop);delete this.scrtop;}
+if(this.settings.selected!==false){$.each(this.settings.selected,function(i){if(_this.is_partial_refresh)_this.select_branch($(_this.settings.selected[i].toString().replace('/','\\/'),_this.container),(_this.settings.rules.multiple!==false));else _this.select_branch($(_this.settings.selected[i].toString().replace('/','\\/'),_this.container),(_this.settings.rules.multiple!==false&&i>0));});this.settings.selected=false;}
+this.callback("onload",[_this]);},get:function(obj,format,opts){if(!format)format=this.settings.data.type;if(!opts)opts=this.settings.data.opts;return new $.tree.datastores[format]().get(obj,this,opts);},attach_events:function(){var _this=this;this.container.bind("mousedown.jstree",function(event){if(tree_component.drag_drop.isdown){tree_component.drag_drop.move_type=false;event.preventDefault();event.stopPropagation();event.stopImmediatePropagation();return false;}}).bind("mouseup.jstree",function(event){setTimeout(function(){_this.focus.apply(_this);},5);}).bind("click.jstree",function(event){return true;});$("li",this.container.get(0)).live("click",function(event){if(event.target.tagName!="LI")return true;_this.off_height();if(event.pageY-$(event.target).offset().top>_this.li_height)return true;_this.toggle_branch.apply(_this,[event.target]);event.stopPropagation();return false;});$("a",this.container.get(0)).live("click",function(event){if(event.which&&event.which==3)return true;if(_this.locked){event.preventDefault();event.target.blur();return _this.error("LOCKED");}
+_this.select_branch.apply(_this,[event.target,event.ctrlKey||_this.settings.rules.multiple=="on"]);if(_this.inp){_this.inp.blur();}
+event.preventDefault();event.target.blur();return false;}).live("dblclick",function(event){if(_this.locked){event.preventDefault();event.stopPropagation();event.target.blur();return _this.error("LOCKED");}
+_this.callback("ondblclk",[_this.get_node(event.target).get(0),_this]);event.preventDefault();event.stopPropagation();event.target.blur();}).live("contextmenu",function(event){if(_this.locked){event.target.blur();return _this.error("LOCKED");}
+return _this.callback("onrgtclk",[_this.get_node(event.target).get(0),_this,event]);}).live("mouseover",function(event){if(_this.locked){event.preventDefault();event.stopPropagation();return _this.error("LOCKED");}
+if(_this.hovered!==false&&(event.target.tagName=="A"||event.target.tagName=="INS")){_this.hovered.children("a").removeClass("hover");_this.hovered=false;}
+_this.callback("onhover",[_this.get_node(event.target).get(0),_this]);}).live("mousedown",function(event){if(_this.settings.rules.drag_button=="left"&&event.which&&event.which!=1)return true;if(_this.settings.rules.drag_button=="right"&&event.which&&event.which!=3)return true;_this.focus.apply(_this);if(_this.locked)return _this.error("LOCKED");var obj=_this.get_node(event.target);if(_this.settings.rules.multiple!=false&&_this.selected_arr.length>1&&obj.children("a:eq(0)").hasClass("clicked")){var counter=0;for(var i in _this.selected_arr){if(!_this.selected_arr.hasOwnProperty(i))continue;if(_this.check("draggable",_this.selected_arr[i])){_this.selected_arr[i].addClass("dragged");tree_component.drag_drop.origin_tree=_this;counter++;}}
+if(counter>0){if(_this.check("draggable",obj))tree_component.drag_drop.drag_node=obj;else tree_component.drag_drop.drag_node=_this.container.find("li.dragged:eq(0)");tree_component.drag_drop.isdown=true;tree_component.drag_drop.drag_help=$("<div id='jstree-dragged' class='tree "+(_this.settings.ui.theme_name!=""?" tree-"+_this.settings.ui.theme_name:"")+"' />").append("<ul class='"+_this.container.children("ul:eq(0)").get(0).className+"' />");var tmp=tree_component.drag_drop.drag_node.clone();if(_this.settings.languages.length>0)tmp.find("a").not("."+_this.current_lang).hide();tree_component.drag_drop.drag_help.children("ul:eq(0)").append(tmp);tree_component.drag_drop.drag_help.find("li:eq(0)").removeClass("last").addClass("last").children("a").html("<ins>&nbsp;</ins>Multiple selection").end().children("ul").remove();tree_component.drag_drop.dragged=_this.container.find("li.dragged");}}
+else{if(_this.check("draggable",obj)){tree_component.drag_drop.drag_node=obj;tree_component.drag_drop.drag_help=$("<div id='jstree-dragged' class='tree "+(_this.settings.ui.theme_name!=""?" tree-"+_this.settings.ui.theme_name:"")+"' />").append("<ul class='"+_this.container.children("ul:eq(0)").get(0).className+"' />");var tmp=obj.clone();if(_this.settings.languages.length>0)tmp.find("a").not("."+_this.current_lang).hide();tree_component.drag_drop.drag_help.children("ul:eq(0)").append(tmp);tree_component.drag_drop.drag_help.find("li:eq(0)").removeClass("last").addClass("last");tree_component.drag_drop.isdown=true;tree_component.drag_drop.foreign=false;tree_component.drag_drop.origin_tree=_this;obj.addClass("dragged");tree_component.drag_drop.dragged=_this.container.find("li.dragged");}}
+tree_component.drag_drop.init_x=event.pageX;tree_component.drag_drop.init_y=event.pageY;obj.blur();event.preventDefault();event.stopPropagation();return false;});},focus:function(){if(this.locked)return false;if(tree_component.focused!=this.cntr){tree_component.focused=this.cntr;this.callback("onfocus",[this]);}},off_height:function(){if(this.offset===false){this.container.css({position:"relative"});this.offset=this.container.offset();var tmp=0;tmp=parseInt($.curCSS(this.container.get(0),"paddingTop",true),10);if(tmp)this.offset.top+=tmp;tmp=parseInt($.curCSS(this.container.get(0),"borderTopWidth",true),10);if(tmp)this.offset.top+=tmp;this.container.css({position:""});}
+if(!this.li_height){var tmp=this.container.find("ul li.closed, ul li.leaf").eq(0);this.li_height=tmp.height();if(tmp.children("ul:eq(0)").size())this.li_height-=tmp.children("ul:eq(0)").height();if(!this.li_height)this.li_height=18;}},scroll_check:function(x,y){var _this=this;var cnt=_this.container;var off=_this.container.offset();var st=cnt.scrollTop();var sl=cnt.scrollLeft();var h_cor=(cnt.get(0).scrollWidth>cnt.width())?40:20;if(y-off.top<20)cnt.scrollTop(Math.max((st-_this.settings.ui.scroll_spd),0));if(cnt.height()-(y-off.top)<h_cor)cnt.scrollTop(st+_this.settings.ui.scroll_spd);if(x-off.left<20)cnt.scrollLeft(Math.max((sl-_this.settings.ui.scroll_spd),0));if(cnt.width()-(x-off.left)<40)cnt.scrollLeft(sl+_this.settings.ui.scroll_spd);if(cnt.scrollLeft()!=sl||cnt.scrollTop()!=st){tree_component.drag_drop.move_type=false;tree_component.drag_drop.ref_node=false;tree_component.drag_drop.marker.hide();}
+tree_component.drag_drop.scroll_time=setTimeout(function(){_this.scroll_check(x,y);},50);},scroll_into_view:function(obj){obj=obj?this.get_node(obj):this.selected;if(!obj)return false;var off_t=obj.offset().top;var beg_t=this.container.offset().top;var end_t=beg_t+this.container.height();var h_cor=(this.container.get(0).scrollWidth>this.container.width())?40:20;if(off_t+5<beg_t)this.container.scrollTop(this.container.scrollTop()-(beg_t-off_t+5));if(off_t+h_cor>end_t)this.container.scrollTop(this.container.scrollTop()+(off_t+h_cor-end_t));},get_node:function(obj){return $(obj).closest("li");},get_type:function(obj){obj=!obj?this.selected:this.get_node(obj);if(!obj)return;var tmp=obj.attr(this.settings.rules.type_attr);return tmp||"default";},set_type:function(str,obj){obj=!obj?this.selected:this.get_node(obj);if(!obj||!str)return;obj.attr(this.settings.rules.type_attr,str);},get_text:function(obj,lang){obj=this.get_node(obj);if(!obj||obj.size()==0)return"";if(this.settings.languages&&this.settings.languages.length){lang=lang?lang:this.current_lang;obj=obj.children("a."+lang);}
+else obj=obj.children("a:visible");var val="";obj.contents().each(function(){if(this.nodeType==3){val=this.data;return false;}});return val;},check:function(rule,obj){if(this.locked)return false;var v=false;if(obj===-1){if(typeof this.settings.rules[rule]!="undefined")v=this.settings.rules[rule];}
+else{obj=!obj?this.selected:this.get_node(obj);if(!obj)return;var t=this.get_type(obj);if(typeof this.settings.types[t]!="undefined"&&typeof this.settings.types[t][rule]!="undefined")v=this.settings.types[t][rule];else if(typeof this.settings.types["default"]!="undefined"&&typeof this.settings.types["default"][rule]!="undefined")v=this.settings.types["default"][rule];}
+if(typeof v=="function")v=v.call(null,obj,this);v=this.callback("check",[rule,obj,v,this]);return v;},check_move:function(nod,ref_node,how){if(this.locked)return false;if($(ref_node).closest("li.dragged").size())return false;var tree1=nod.parents(".tree:eq(0)").get(0);var tree2=ref_node.parents(".tree:eq(0)").get(0);if(tree1&&tree1!=tree2){var m=$.tree.reference(tree2.id).settings.rules.multitree;if(m=="none"||($.isArray(m)&&$.inArray(tree1.id,m)==-1))return false;}
+var p=(how!="inside")?this.parent(ref_node):this.get_node(ref_node);nod=this.get_node(nod);if(p==false)return false;var r={max_depth:this.settings.rules.use_max_depth?this.check("max_depth",p):-1,max_children:this.settings.rules.use_max_children?this.check("max_children",p):-1,valid_children:this.check("valid_children",p)};var nod_type=(typeof nod=="string")?nod:this.get_type(nod);if(typeof r.valid_children!="undefined"&&(r.valid_children=="none"||(typeof r.valid_children=="object"&&$.inArray(nod_type,$.makeArray(r.valid_children))==-1)))return false;if(this.settings.rules.use_max_children){if(typeof r.max_children!="undefined"&&r.max_children!=-1){if(r.max_children==0)return false;var c_count=1;if(tree_component.drag_drop.moving==true&&tree_component.drag_drop.foreign==false){c_count=tree_component.drag_drop.dragged.size();c_count=c_count-p.find('> ul > li.dragged').size();}
+if(r.max_children<p.find('> ul > li').size()+c_count)return false;}}
+if(this.settings.rules.use_max_depth){if(typeof r.max_depth!="undefined"&&r.max_depth===0)return this.error("MOVE: MAX-DEPTH REACHED");var mx=(r.max_depth>0)?r.max_depth:false;var i=0;var t=p;while(t!==-1){t=this.parent(t);i++;var m=this.check("max_depth",t);if(m>=0){mx=(mx===false)?(m-i):Math.min(mx,m-i);}
+if(mx!==false&&mx<=0)return this.error("MOVE: MAX-DEPTH REACHED");}
+if(mx!==false&&mx<=0)return this.error("MOVE: MAX-DEPTH REACHED");if(mx!==false){var incr=1;if(typeof nod!="string"){var t=nod;while(t.size()>0){if(mx-incr<0)return this.error("MOVE: MAX-DEPTH REACHED");t=t.children("ul").children("li");incr++;}}}}
+if(this.callback("check_move",[nod,ref_node,how,this])==false)return false;return true;},hover_branch:function(obj){if(this.locked)return this.error("LOCKED");var _this=this;var obj=_this.get_node(obj);if(!obj.size())return this.error("HOVER: NOT A VALID NODE");if(!_this.check("clickable",obj))return this.error("SELECT: NODE NOT SELECTABLE");if(this.hovered)this.hovered.children("A").removeClass("hover");this.hovered=obj;this.hovered.children("a").addClass("hover");this.scroll_into_view(this.hovered);},select_branch:function(obj,multiple){if(this.locked)return this.error("LOCKED");if(!obj&&this.hovered!==false)obj=this.hovered;var _this=this;obj=_this.get_node(obj);if(!obj.size())return this.error("SELECT: NOT A VALID NODE");obj.children("a").removeClass("hover");if(!_this.check("clickable",obj))return this.error("SELECT: NODE NOT SELECTABLE");if(_this.callback("beforechange",[obj.get(0),_this])===false)return this.error("SELECT: STOPPED BY USER");if(this.settings.rules.multiple!=false&&multiple&&obj.children("a.clicked").size()>0){return this.deselect_branch(obj);}
+if(this.settings.rules.multiple!=false&&multiple){this.selected_arr.push(obj);}
+if(this.settings.rules.multiple!=false&&!multiple){for(var i in this.selected_arr){if(!this.selected_arr.hasOwnProperty(i))continue;this.selected_arr[i].children("A").removeClass("clicked");this.callback("ondeselect",[this.selected_arr[i].get(0),_this]);}
+this.selected_arr=[];this.selected_arr.push(obj);if(this.selected&&this.selected.children("A").hasClass("clicked")){this.selected.children("A").removeClass("clicked");this.callback("ondeselect",[this.selected.get(0),_this]);}}
+if(!this.settings.rules.multiple){if(this.selected){this.selected.children("A").removeClass("clicked");this.callback("ondeselect",[this.selected.get(0),_this]);}}
+this.selected=obj;if(this.hovered!==false){this.hovered.children("A").removeClass("hover");this.hovered=obj;}
+this.selected.children("a").addClass("clicked").end().parents("li.closed").each(function(){_this.open_branch(this,true);});this.scroll_into_view(this.selected);this.callback("onselect",[this.selected.get(0),_this]);this.callback("onchange",[this.selected.get(0),_this]);},deselect_branch:function(obj){if(this.locked)return this.error("LOCKED");var _this=this;var obj=this.get_node(obj);if(obj.children("a.clicked").size()==0)return this.error("DESELECT: NODE NOT SELECTED");obj.children("a").removeClass("clicked");this.callback("ondeselect",[obj.get(0),_this]);if(this.settings.rules.multiple!=false&&this.selected_arr.length>1){this.selected_arr=[];this.container.find("a.clicked").filter(":first-child").parent().each(function(){_this.selected_arr.push($(this));});if(obj.get(0)==this.selected.get(0)){this.selected=this.selected_arr[0];}}
+else{if(this.settings.rules.multiple!=false)this.selected_arr=[];this.selected=false;}
+this.callback("onchange",[obj.get(0),_this]);},toggle_branch:function(obj){if(this.locked)return this.error("LOCKED");var obj=this.get_node(obj);if(obj.hasClass("closed"))return this.open_branch(obj);if(obj.hasClass("open"))return this.close_branch(obj);},open_branch:function(obj,disable_animation,callback){var _this=this;if(this.locked)return this.error("LOCKED");var obj=this.get_node(obj);if(!obj.size())return this.error("OPEN: NO SUCH NODE");if(obj.hasClass("leaf"))return this.error("OPEN: OPENING LEAF NODE");if(this.settings.data.async&&obj.find("li").size()==0){if(this.callback("beforeopen",[obj.get(0),this])===false)return this.error("OPEN: STOPPED BY USER");obj.children("ul:eq(0)").remove().end().append("<ul><li class='last'><a class='loading' href='#'><ins>&nbsp;</ins>"+(_this.settings.lang.loading||"Loading ...")+"</a></li></ul>");obj.removeClass("closed").addClass("open");var _datastore=new $.tree.datastores[this.settings.data.type]();_datastore.load(this.callback("beforedata",[obj,this]),this,this.settings.data.opts,function(data){data=_this.callback("ondata",[data,_this]);if(!data||data.length==0){obj.removeClass("closed").removeClass("open").addClass("leaf").children("ul").remove();if(callback)callback.call();return;}
+_datastore.parse(data,_this,_this.settings.data.opts,function(str){str=_this.callback("onparse",[str,_this]);obj.children("ul:eq(0)").replaceWith($("<ul>").html(str));obj.find("li:last-child").addClass("last").end().find("li:has(ul)").not(".open").addClass("closed");obj.find("li").not(".open").not(".closed").addClass("leaf");_this.open_branch.apply(_this,[obj]);if(callback)callback.call();});});return true;}
+else{if(!this.settings.data.async){if(this.callback("beforeopen",[obj.get(0),this])===false)return this.error("OPEN: STOPPED BY USER");}
+if(parseInt(this.settings.ui.animation)>0&&!disable_animation){obj.children("ul:eq(0)").css("display","none");obj.removeClass("closed").addClass("open");obj.children("ul:eq(0)").slideDown(parseInt(this.settings.ui.animation),function(){$(this).css("display","");if(callback)callback.call();});}else{obj.removeClass("closed").addClass("open");if(callback)callback.call();}
+this.callback("onopen",[obj.get(0),this]);return true;}},close_branch:function(obj,disable_animation){if(this.locked)return this.error("LOCKED");var _this=this;var obj=this.get_node(obj);if(!obj.size())return this.error("CLOSE: NO SUCH NODE");if(_this.callback("beforeclose",[obj.get(0),_this])===false)return this.error("CLOSE: STOPPED BY USER");if(parseInt(this.settings.ui.animation)>0&&!disable_animation&&obj.children("ul:eq(0)").size()==1){obj.children("ul:eq(0)").slideUp(parseInt(this.settings.ui.animation),function(){if(obj.hasClass("open"))obj.removeClass("open").addClass("closed");$(this).css("display","");});}
+else{if(obj.hasClass("open"))obj.removeClass("open").addClass("closed");}
+if(this.selected&&this.settings.ui.selected_parent_close!==false&&obj.children("ul:eq(0)").find("a.clicked").size()>0){obj.find("li:has(a.clicked)").each(function(){_this.deselect_branch(this);});if(this.settings.ui.selected_parent_close=="select_parent"&&obj.children("a.clicked").size()==0)this.select_branch(obj,(this.settings.rules.multiple!=false&&this.selected_arr.length>0));}
+this.callback("onclose",[obj.get(0),this]);},open_all:function(obj,callback){if(this.locked)return this.error("LOCKED");var _this=this;obj=obj?this.get_node(obj):this.container;var s=obj.find("li.closed").size();if(!callback)this.cl_count=0;else this.cl_count--;if(s>0){this.cl_count+=s;obj.find("li.closed").each(function(){var __this=this;_this.open_branch.apply(_this,[this,true,function(){_this.open_all.apply(_this,[__this,true]);}]);});}
+else if(this.cl_count==0)this.callback("onopen_all",[this]);},close_all:function(obj){if(this.locked)return this.error("LOCKED");var _this=this;obj=obj?this.get_node(obj):this.container;obj.find("li.open").each(function(){_this.close_branch(this,true);});this.callback("onclose_all",[this]);},set_lang:function(i){if(!$.isArray(this.settings.languages)||this.settings.languages.length==0)return false;if(this.locked)return this.error("LOCKED");if(!$.inArray(i,this.settings.languages)&&typeof this.settings.languages[i]!="undefined")i=this.settings.languages[i];if(typeof i=="undefined")return false;if(i==this.current_lang)return true;var st=false;var id="#"+this.container.attr("id");st=tree_component.get_css(id+" ."+this.current_lang);if(st!==false)st.style.display="none";st=tree_component.get_css(id+" ."+i);if(st!==false)st.style.display="";this.current_lang=i;return true;},get_lang:function(){if(!$.isArray(this.settings.languages)||this.settings.languages.length==0)return false;return this.current_lang;},create:function(obj,ref_node,position){if(this.locked)return this.error("LOCKED");var root=false;if(ref_node==-1){root=true;ref_node=this.container;}
+else ref_node=ref_node?this.get_node(ref_node):this.selected;if(!root&&(!ref_node||!ref_node.size()))return this.error("CREATE: NO NODE SELECTED");var pos=position;var tmp=ref_node;if(position=="before"){position=ref_node.parent().children().index(ref_node);ref_node=ref_node.parents("li:eq(0)");}
+if(position=="after"){position=ref_node.parent().children().index(ref_node)+1;ref_node=ref_node.parents("li:eq(0)");}
+if(!root&&ref_node.size()==0){root=true;ref_node=this.container;}
+if(!root){if(!this.check("creatable",ref_node))return this.error("CREATE: CANNOT CREATE IN NODE");if(ref_node.hasClass("closed")){if(this.settings.data.async&&ref_node.children("ul").size()==0){var _this=this;return this.open_branch(ref_node,true,function(){_this.create.apply(_this,[obj,ref_node,position]);});}
+else this.open_branch(ref_node,true);}}
+var torename=false;if(!obj)obj={};else obj=$.extend(true,{},obj);if(!obj.attributes)obj.attributes={};if(!obj.attributes[this.settings.rules.type_attr])obj.attributes[this.settings.rules.type_attr]=this.get_type(tmp)||"default";if(this.settings.languages.length){if(!obj.data){obj.data={};torename=true;}
+for(var i=0;i<this.settings.languages.length;i++){if(!obj.data[this.settings.languages[i]])obj.data[this.settings.languages[i]]=((typeof this.settings.lang.new_node).toLowerCase()!="string"&&this.settings.lang.new_node[i])?this.settings.lang.new_node[i]:this.settings.lang.new_node;}}
+else{if(!obj.data){obj.data=this.settings.lang.new_node;torename=true;}}
+obj=this.callback("ondata",[obj,this]);var obj_s=$.tree.datastores.json().parse(obj,this);obj_s=this.callback("onparse",[obj_s,this]);var $li=$(obj_s);if($li.children("ul").size()){if(!$li.is(".open"))$li.addClass("closed");}
+else $li.addClass("leaf");$li.find("li:last-child").addClass("last").end().find("li:has(ul)").not(".open").addClass("closed");$li.find("li").not(".open").not(".closed").addClass("leaf");var r={max_depth:this.settings.rules.use_max_depth?this.check("max_depth",(root?-1:ref_node)):-1,max_children:this.settings.rules.use_max_children?this.check("max_children",(root?-1:ref_node)):-1,valid_children:this.check("valid_children",(root?-1:ref_node))};var nod_type=this.get_type($li);if(typeof r.valid_children!="undefined"&&(r.valid_children=="none"||($.isArray(r.valid_children)&&$.inArray(nod_type,r.valid_children)==-1)))return this.error("CREATE: NODE NOT A VALID CHILD");if(this.settings.rules.use_max_children){if(typeof r.max_children!="undefined"&&r.max_children!=-1&&r.max_children>=this.children(ref_node).size())return this.error("CREATE: MAX_CHILDREN REACHED");}
+if(this.settings.rules.use_max_depth){if(typeof r.max_depth!="undefined"&&r.max_depth===0)return this.error("CREATE: MAX-DEPTH REACHED");var mx=(r.max_depth>0)?r.max_depth:false;var i=0;var t=ref_node;while(t!==-1&&!root){t=this.parent(t);i++;var m=this.check("max_depth",t);if(m>=0){mx=(mx===false)?(m-i):Math.min(mx,m-i);}
+if(mx!==false&&mx<=0)return this.error("CREATE: MAX-DEPTH REACHED");}
+if(mx!==false&&mx<=0)return this.error("CREATE: MAX-DEPTH REACHED");if(mx!==false){var incr=1;var t=$li;while(t.size()>0){if(mx-incr<0)return this.error("CREATE: MAX-DEPTH REACHED");t=t.children("ul").children("li");incr++;}}}
+if((typeof position).toLowerCase()=="undefined"||position=="inside")
+position=(this.settings.rules.createat=="top")?0:ref_node.children("ul:eq(0)").children("li").size();if(ref_node.children("ul").size()==0||(root==true&&ref_node.children("ul").children("li").size()==0)){if(!root)var a=this.moved($li,ref_node.children("a:eq(0)"),"inside",true);else var a=this.moved($li,this.container.children("ul:eq(0)"),"inside",true);}
+else if(pos=="before"&&ref_node.children("ul:eq(0)").children("li:nth-child("+(position+1)+")").size())
+var a=this.moved($li,ref_node.children("ul:eq(0)").children("li:nth-child("+(position+1)+")").children("a:eq(0)"),"before",true);else if(pos=="after"&&ref_node.children("ul:eq(0)").children("li:nth-child("+(position)+")").size())
+var a=this.moved($li,ref_node.children("ul:eq(0)").children("li:nth-child("+(position)+")").children("a:eq(0)"),"after",true);else if(ref_node.children("ul:eq(0)").children("li:nth-child("+(position+1)+")").size())
+var a=this.moved($li,ref_node.children("ul:eq(0)").children("li:nth-child("+(position+1)+")").children("a:eq(0)"),"before",true);else
+var a=this.moved($li,ref_node.children("ul:eq(0)").children("li:last").children("a:eq(0)"),"after",true);if(a===false)return this.error("CREATE: ABORTED");if(torename){this.select_branch($li.children("a:eq(0)"));this.rename();}
+return $li;},rename:function(obj,new_name){if(this.locked)return this.error("LOCKED");obj=obj?this.get_node(obj):this.selected;var _this=this;if(!obj||!obj.size())return this.error("RENAME: NO NODE SELECTED");if(!this.check("renameable",obj))return this.error("RENAME: NODE NOT RENAMABLE");if(!this.callback("beforerename",[obj.get(0),_this.current_lang,_this]))return this.error("RENAME: STOPPED BY USER");obj.parents("li.closed").each(function(){_this.open_branch(this)});if(this.current_lang)obj=obj.find("a."+this.current_lang);else obj=obj.find("a:first");var rb={};rb[this.container.attr("id")]=this.get_rollback();var icn=obj.children("ins").clone();if((typeof new_name).toLowerCase()=="string"){obj.text(new_name).prepend(icn);_this.callback("onrename",[_this.get_node(obj).get(0),_this,rb]);}
+else{var last_value="";obj.contents().each(function(){if(this.nodeType==3){last_value=this.data;return false;}});_this.inp=$("<input type='text' autocomplete='off' />");_this.inp.val(last_value.replace(/&amp;/g,"&").replace(/&gt;/g,">").replace(/&lt;/g,"<")).bind("mousedown",function(event){event.stopPropagation();}).bind("mouseup",function(event){event.stopPropagation();}).bind("click",function(event){event.stopPropagation();}).bind("keyup",function(event){var key=event.keyCode||event.which;if(key==27){this.value=last_value;this.blur();return}
+if(key==13){this.blur();return;}});_this.inp.blur(function(event){if(this.value=="")this.value=last_value;obj.text(this.value).prepend(icn);obj.get(0).style.display="";obj.prevAll("span").remove();_this.inp=false;_this.callback("onrename",[_this.get_node(obj).get(0),_this,rb]);});var spn=$("<span />").addClass(obj.attr("class")).append(icn).append(_this.inp);obj.get(0).style.display="none";obj.parent().prepend(spn);_this.inp.get(0).focus();_this.inp.get(0).select();}},remove:function(obj){if(this.locked)return this.error("LOCKED");var _this=this;var rb={};rb[this.container.attr("id")]=this.get_rollback();if(obj&&(!this.selected||this.get_node(obj).get(0)!=this.selected.get(0))){obj=this.get_node(obj);if(obj.size()){if(!this.check("deletable",obj))return this.error("DELETE: NODE NOT DELETABLE");if(!this.callback("beforedelete",[obj.get(0),_this]))return this.error("DELETE: STOPPED BY USER");$parent=obj.parent();if(obj.find("a.clicked").size()){var reset_selected=false;_this.selected_arr=[];this.container.find("a.clicked").filter(":first-child").parent().each(function(){if(!reset_selected&&this==_this.selected.get(0))reset_selected=true;if($(this).parents().index(obj)!=-1)return true;_this.selected_arr.push($(this));});if(reset_selected)this.selected=this.selected_arr[0]||false;}
+obj=obj.remove();$parent.children("li:last").addClass("last");if($parent.children("li").size()==0){$li=$parent.parents("li:eq(0)");$li.removeClass("open").removeClass("closed").addClass("leaf").children("ul").remove();}
+this.callback("ondelete",[obj.get(0),this,rb]);}}
+else if(this.selected){if(!this.check("deletable",this.selected))return this.error("DELETE: NODE NOT DELETABLE");if(!this.callback("beforedelete",[this.selected.get(0),_this]))return this.error("DELETE: STOPPED BY USER");$parent=this.selected.parent();var obj=this.selected;if(this.settings.rules.multiple==false||this.selected_arr.length==1){var stop=true;var tmp=this.settings.ui.selected_delete=="select_previous"?this.prev(this.selected):false;}
+obj=obj.remove();$parent.children("li:last").addClass("last");if($parent.children("li").size()==0){$li=$parent.parents("li:eq(0)");$li.removeClass("open").removeClass("closed").addClass("leaf").children("ul").remove();}
+if(!stop&&this.settings.rules.multiple!=false){var _this=this;this.selected_arr=[];this.container.find("a.clicked").filter(":first-child").parent().each(function(){_this.selected_arr.push($(this));});if(this.selected_arr.length>0){this.selected=this.selected_arr[0];this.remove();}}
+if(stop&&tmp)this.select_branch(tmp);this.callback("ondelete",[obj.get(0),this,rb]);}
+else return this.error("DELETE: NO NODE SELECTED");},next:function(obj,strict){obj=this.get_node(obj);if(!obj.size())return false;if(strict)return(obj.nextAll("li").size()>0)?obj.nextAll("li:eq(0)"):false;if(obj.hasClass("open"))return obj.find("li:eq(0)");else if(obj.nextAll("li").size()>0)return obj.nextAll("li:eq(0)");else return obj.parents("li").next("li").eq(0);},prev:function(obj,strict){obj=this.get_node(obj);if(!obj.size())return false;if(strict)return(obj.prevAll("li").size()>0)?obj.prevAll("li:eq(0)"):false;if(obj.prev("li").size()){var obj=obj.prev("li").eq(0);while(obj.hasClass("open"))obj=obj.children("ul:eq(0)").children("li:last");return obj;}
+else return obj.parents("li:eq(0)").size()?obj.parents("li:eq(0)"):false;},parent:function(obj){obj=this.get_node(obj);if(!obj.size())return false;return obj.parents("li:eq(0)").size()?obj.parents("li:eq(0)"):-1;},children:function(obj){if(obj===-1)return this.container.children("ul:eq(0)").children("li");obj=this.get_node(obj);if(!obj.size())return false;return obj.children("ul:eq(0)").children("li");},toggle_dots:function(){if(this.settings.ui.dots){this.settings.ui.dots=false;this.container.children("ul:eq(0)").addClass("no_dots");}
+else{this.settings.ui.dots=true;this.container.children("ul:eq(0)").removeClass("no_dots");}},callback:function(cb,args){var p=false;var r=null;for(var i in this.settings.plugins){if(typeof $.tree.plugins[i]!="object")continue;p=$.tree.plugins[i];if(p.callbacks&&typeof p.callbacks[cb]=="function")r=p.callbacks[cb].apply(this,args);if(typeof r!=="undefined"&&r!==null){if(cb=="ondata"||cb=="onparse")args[0]=r;else return r;}}
+p=this.settings.callback[cb];if(typeof p=="function")return p.apply(null,args);},get_rollback:function(){var rb={};rb.html=this.container.html();rb.selected=this.selected?this.selected.attr("id"):false;return rb;},moved:function(what,where,how,is_new,is_copy,rb){var what=$(what);var $parent=$(what).parents("ul:eq(0)");var $where=$(where);if($where.is("ins"))$where=$where.parent();if(!rb){var rb={};rb[this.container.attr("id")]=this.get_rollback();if(!is_new){var tmp=what.size()>1?what.eq(0).parents(".tree:eq(0)"):what.parents(".tree:eq(0)");if(tmp.get(0)!=this.container.get(0)){tmp=tree_component.inst[tmp.attr("id")];rb[tmp.container.attr("id")]=tmp.get_rollback();}
+delete tmp;}}
+if(how=="inside"&&this.settings.data.async){var _this=this;if(this.get_node($where).hasClass("closed")){return this.open_branch(this.get_node($where),true,function(){_this.moved.apply(_this,[what,where,how,is_new,is_copy,rb]);});}
+if(this.get_node($where).find("> ul > li > a.loading").size()==1){setTimeout(function(){_this.moved.apply(_this,[what,where,how,is_new,is_copy]);},200);return;}}
+if(what.size()>1){var _this=this;var tmp=this.moved(what.eq(0),where,how,false,is_copy,rb);what.each(function(i){if(i==0)return;if(tmp){tmp=_this.moved(this,tmp.children("a:eq(0)"),"after",false,is_copy,rb);}});return what;}
+if(is_copy){_what=what.clone();_what.each(function(i){this.id=this.id+"_copy";$(this).find("li").each(function(){this.id=this.id+"_copy";});$(this).removeClass("dragged").find("a.clicked").removeClass("clicked").end().find("li.dragged").removeClass("dragged");});}
+else _what=what;if(is_new){if(!this.callback("beforecreate",[this.get_node(what).get(0),this.get_node(where).get(0),how,this]))return false;}
+else{if(!this.callback("beforemove",[this.get_node(what).get(0),this.get_node(where).get(0),how,this]))return false;}
+if(!is_new){var tmp=what.parents(".tree:eq(0)");if(tmp.get(0)!=this.container.get(0)){tmp=tree_component.inst[tmp.attr("id")];if(tmp.settings.languages.length){var res=[];if(this.settings.languages.length==0)res.push("."+tmp.current_lang);else{for(var i in this.settings.languages){if(!this.settings.languages.hasOwnProperty(i))continue;for(var j in tmp.settings.languages){if(!tmp.settings.languages.hasOwnProperty(j))continue;if(this.settings.languages[i]==tmp.settings.languages[j])res.push("."+this.settings.languages[i]);}}}
+if(res.length==0)return this.error("MOVE: NO COMMON LANGUAGES");_what.find("a").not(res.join(",")).remove();}
+_what.find("a.clicked").removeClass("clicked");}}
+what=_what;switch(how){case"before":$where.parents("ul:eq(0)").children("li.last").removeClass("last");$where.parent().before(what.removeClass("last"));$where.parents("ul:eq(0)").children("li:last").addClass("last");break;case"after":$where.parents("ul:eq(0)").children("li.last").removeClass("last");$where.parent().after(what.removeClass("last"));$where.parents("ul:eq(0)").children("li:last").addClass("last");break;case"inside":if($where.parent().children("ul:first").size()){if(this.settings.rules.createat=="top"){$where.parent().children("ul:first").prepend(what.removeClass("last")).children("li:last").addClass("last");var tmp_node=$where.parent().children("ul:first").children("li:first");if(tmp_node.size()){how="before";where=tmp_node;}}
+else{var tmp_node=$where.parent().children("ul:first").children(".last");if(tmp_node.size()){how="after";where=tmp_node;}
+$where.parent().children("ul:first").children(".last").removeClass("last").end().append(what.removeClass("last")).children("li:last").addClass("last");}}
+else{what.addClass("last");$where.parent().removeClass("leaf").append("<ul/>");if(!$where.parent().hasClass("open"))$where.parent().addClass("closed");$where.parent().children("ul:first").prepend(what);}
+if($where.parent().hasClass("closed")){this.open_branch($where);}
+break;default:break;}
+if($parent.find("li").size()==0){var $li=$parent.parent();$li.removeClass("open").removeClass("closed").addClass("leaf");if(!$li.is(".tree"))$li.children("ul").remove();$li.parents("ul:eq(0)").children("li.last").removeClass("last").end().children("li:last").addClass("last");}
+else{$parent.children("li.last").removeClass("last");$parent.children("li:last").addClass("last");}
+if(is_copy)this.callback("oncopy",[this.get_node(what).get(0),this.get_node(where).get(0),how,this,rb]);else if(is_new)this.callback("oncreate",[this.get_node(what).get(0),($where.is("ul")?-1:this.get_node(where).get(0)),how,this,rb]);else this.callback("onmove",[this.get_node(what).get(0),this.get_node(where).get(0),how,this,rb]);return what;},error:function(code){this.callback("error",[code,this]);return false;},lock:function(state){this.locked=state;if(this.locked)this.container.children("ul:eq(0)").addClass("locked");else this.container.children("ul:eq(0)").removeClass("locked");},cut:function(obj){if(this.locked)return this.error("LOCKED");obj=obj?this.get_node(obj):this.container.find("a.clicked").filter(":first-child").parent();if(!obj||!obj.size())return this.error("CUT: NO NODE SELECTED");tree_component.cut_copy.copy_nodes=false;tree_component.cut_copy.cut_nodes=obj;},copy:function(obj){if(this.locked)return this.error("LOCKED");obj=obj?this.get_node(obj):this.container.find("a.clicked").filter(":first-child").parent();if(!obj||!obj.size())return this.error("COPY: NO NODE SELECTED");tree_component.cut_copy.copy_nodes=obj;tree_component.cut_copy.cut_nodes=false;},paste:function(obj,position){if(this.locked)return this.error("LOCKED");var root=false;if(obj==-1){root=true;obj=this.container;}
+else obj=obj?this.get_node(obj):this.selected;if(!root&&(!obj||!obj.size()))return this.error("PASTE: NO NODE SELECTED");if(!tree_component.cut_copy.copy_nodes&&!tree_component.cut_copy.cut_nodes)return this.error("PASTE: NOTHING TO DO");var _this=this;var pos=position;if(position=="before"){position=obj.parent().children().index(obj);obj=obj.parents("li:eq(0)");}
+else if(position=="after"){position=obj.parent().children().index(obj)+1;obj=obj.parents("li:eq(0)");}
+else if((typeof position).toLowerCase()=="undefined"||position=="inside"){position=(this.settings.rules.createat=="top")?0:obj.children("ul:eq(0)").children("li").size();}
+if(!root&&obj.size()==0){root=true;obj=this.container;}
+if(tree_component.cut_copy.copy_nodes&&tree_component.cut_copy.copy_nodes.size()){var ok=true;if(!root&&!this.check_move(tree_component.cut_copy.copy_nodes,obj.children("a:eq(0)"),"inside"))return false;if(obj.children("ul").size()==0||(root==true&&obj.children("ul").children("li").size()==0)){if(!root)var a=this.moved(tree_component.cut_copy.copy_nodes,obj.children("a:eq(0)"),"inside",false,true);else var a=this.moved(tree_component.cut_copy.copy_nodes,this.container.children("ul:eq(0)"),"inside",false,true);}
+else if(pos=="before"&&obj.children("ul:eq(0)").children("li:nth-child("+(position+1)+")").size())
+var a=this.moved(tree_component.cut_copy.copy_nodes,obj.children("ul:eq(0)").children("li:nth-child("+(position+1)+")").children("a:eq(0)"),"before",false,true);else if(pos=="after"&&obj.children("ul:eq(0)").children("li:nth-child("+(position)+")").size())
+var a=this.moved(tree_component.cut_copy.copy_nodes,obj.children("ul:eq(0)").children("li:nth-child("+(position)+")").children("a:eq(0)"),"after",false,true);else if(obj.children("ul:eq(0)").children("li:nth-child("+(position+1)+")").size())
+var a=this.moved(tree_component.cut_copy.copy_nodes,obj.children("ul:eq(0)").children("li:nth-child("+(position+1)+")").children("a:eq(0)"),"before",false,true);else
+var a=this.moved(tree_component.cut_copy.copy_nodes,obj.children("ul:eq(0)").children("li:last").children("a:eq(0)"),"after",false,true);tree_component.cut_copy.copy_nodes=false;}
+if(tree_component.cut_copy.cut_nodes&&tree_component.cut_copy.cut_nodes.size()){var ok=true;obj.parents().andSelf().each(function(){if(tree_component.cut_copy.cut_nodes.index(this)!=-1){ok=false;return false;}});if(!ok)return this.error("Invalid paste");if(!root&&!this.check_move(tree_component.cut_copy.cut_nodes,obj.children("a:eq(0)"),"inside"))return false;if(obj.children("ul").size()==0||(root==true&&obj.children("ul").children("li").size()==0)){if(!root)var a=this.moved(tree_component.cut_copy.cut_nodes,obj.children("a:eq(0)"),"inside");else var a=this.moved(tree_component.cut_copy.cut_nodes,this.container.children("ul:eq(0)"),"inside");}
+else if(pos=="before"&&obj.children("ul:eq(0)").children("li:nth-child("+(position+1)+")").size())
+var a=this.moved(tree_component.cut_copy.cut_nodes,obj.children("ul:eq(0)").children("li:nth-child("+(position+1)+")").children("a:eq(0)"),"before");else if(pos=="after"&&obj.children("ul:eq(0)").children("li:nth-child("+(position)+")").size())
+var a=this.moved(tree_component.cut_copy.cut_nodes,obj.children("ul:eq(0)").children("li:nth-child("+(position)+")").children("a:eq(0)"),"after");else if(obj.children("ul:eq(0)").children("li:nth-child("+(position+1)+")").size())
+var a=this.moved(tree_component.cut_copy.cut_nodes,obj.children("ul:eq(0)").children("li:nth-child("+(position+1)+")").children("a:eq(0)"),"before");else
+var a=this.moved(tree_component.cut_copy.cut_nodes,obj.children("ul:eq(0)").children("li:last").children("a:eq(0)"),"after");tree_component.cut_copy.cut_nodes=false;}},search:function(str,func){var _this=this;if(!str||(this.srch&&str!=this.srch)){this.srch="";this.srch_opn=false;this.container.find("a.search").removeClass("search");}
+this.srch=str;if(!str)return;if(!func)func="contains";if(this.settings.data.async){if(!this.srch_opn){var dd=$.extend({"search":str},this.callback("beforedata",[false,this]));$.ajax({type:this.settings.data.opts.method,url:this.settings.data.opts.url,data:dd,dataType:"text",success:function(data){_this.srch_opn=$.unique(data.split(","));_this.search.apply(_this,[str,func]);}});}
+else if(this.srch_opn.length){if(this.srch_opn&&this.srch_opn.length){var opn=false;for(var j=0;j<this.srch_opn.length;j++){if(this.get_node("#"+this.srch_opn[j]).size()>0){opn=true;var tmp="#"+this.srch_opn[j];delete this.srch_opn[j];this.open_branch(tmp,true,function(){_this.search.apply(_this,[str,func]);});}}
+if(!opn){this.srch_opn=[];_this.search.apply(_this,[str,func]);}}}
+else{this.srch_opn=false;var selector="a";if(this.settings.languages.length)selector+="."+this.current_lang;this.callback("onsearch",[this.container.find(selector+":"+func+"('"+str+"')"),this]);}}
+else{var selector="a";if(this.settings.languages.length)selector+="."+this.current_lang;var nn=this.container.find(selector+":"+func+"('"+str+"')");nn.parents("li.closed").each(function(){_this.open_branch(this,true);});this.callback("onsearch",[nn,this]);}},add_sheet:tree_component.add_sheet,destroy:function(){this.callback("ondestroy",[this]);this.container.unbind(".jstree");$("#"+this.container.attr("id")).die("click.jstree").die("dblclick.jstree").die("mouseover.jstree").die("mouseout.jstree").die("mousedown.jstree");this.container.removeClass("tree ui-widget ui-widget-content tree-default tree-"+this.settings.ui.theme_name).children("ul").removeClass("no_dots ltr locked").find("li").removeClass("leaf").removeClass("open").removeClass("closed").removeClass("last").children("a").removeClass("clicked hover search");if(this.cntr==tree_component.focused){for(var i in tree_component.inst){if(i!=this.cntr&&i!=this.container.attr("id")){tree_component.inst[i].focus();break;}}}
+tree_component.inst[this.cntr]=false;tree_component.inst[this.container.attr("id")]=false;delete tree_component.inst[this.cntr];delete tree_component.inst[this.container.attr("id")];tree_component.cntr--;}}};tree_component.cntr=0;tree_component.inst={};tree_component.themes=[];tree_component.drag_drop={isdown:false,drag_node:false,drag_help:false,dragged:false,init_x:false,init_y:false,moving:false,origin_tree:false,marker:false,move_type:false,ref_node:false,appended:false,foreign:false,droppable:[],open_time:false,scroll_time:false};tree_component.mouseup=function(event){var tmp=tree_component.drag_drop;if(tmp.open_time)clearTimeout(tmp.open_time);if(tmp.scroll_time)clearTimeout(tmp.scroll_time);if(tmp.moving&&$.tree.drag_end!==false)$.tree.drag_end.call(null,event,tmp);if(tmp.foreign===false&&tmp.drag_node&&tmp.drag_node.size()){tmp.drag_help.remove();if(tmp.move_type){var tree1=tree_component.inst[tmp.ref_node.parents(".tree:eq(0)").attr("id")];if(tree1)tree1.moved(tmp.dragged,tmp.ref_node,tmp.move_type,false,(tmp.origin_tree.settings.rules.drag_copy=="on"||(tmp.origin_tree.settings.rules.drag_copy=="ctrl"&&event.ctrlKey)));}
+tmp.move_type=false;tmp.ref_node=false;}
+if(tmp.foreign!==false){if(tmp.drag_help)tmp.drag_help.remove();if(tmp.move_type){var tree1=tree_component.inst[tmp.ref_node.parents(".tree:eq(0)").attr("id")];if(tree1)tree1.callback("ondrop",[tmp.f_data,tree1.get_node(tmp.ref_node).get(0),tmp.move_type,tree1]);}
+tmp.foreign=false;tmp.move_type=false;tmp.ref_node=false;}
+if(tree_component.drag_drop.marker)tree_component.drag_drop.marker.hide();if(tmp.dragged&&tmp.dragged.size())tmp.dragged.removeClass("dragged");tmp.dragged=false;tmp.drag_help=false;tmp.drag_node=false;tmp.f_type=false;tmp.f_data=false;tmp.init_x=false;tmp.init_y=false;tmp.moving=false;tmp.appended=false;tmp.origin_tree=false;if(tmp.isdown){tmp.isdown=false;event.preventDefault();event.stopPropagation();return false;}};tree_component.mousemove=function(event){var tmp=tree_component.drag_drop;var is_start=false;if(tmp.isdown){if(!tmp.moving&&Math.abs(tmp.init_x-event.pageX)<5&&Math.abs(tmp.init_y-event.pageY)<5){event.preventDefault();event.stopPropagation();return false;}
+else{if(!tmp.moving){tree_component.drag_drop.moving=true;is_start=true;}}
+if(tmp.open_time)clearTimeout(tmp.open_time);if(tmp.drag_help!==false){if(!tmp.appended){if(tmp.foreign!==false)tmp.origin_tree=$.tree.focused();$("body").append(tmp.drag_help);tmp.w=tmp.drag_help.width();tmp.appended=true;}
+tmp.drag_help.css({"left":(event.pageX+5),"top":(event.pageY+15)});}
+if(is_start&&$.tree.drag_start!==false)$.tree.drag_start.call(null,event,tmp);if($.tree.drag!==false)$.tree.drag.call(null,event,tmp);if(event.target.tagName=="DIV"&&event.target.id=="jstree-marker")return false;var et=$(event.target);if(et.is("ins"))et=et.parent();var cnt=et.is(".tree")?et:et.parents(".tree:eq(0)");if(cnt.size()==0||!tree_component.inst[cnt.attr("id")]){if(tmp.scroll_time)clearTimeout(tmp.scroll_time);if(tmp.drag_help!==false)tmp.drag_help.find("li:eq(0) ins").addClass("forbidden");tmp.move_type=false;tmp.ref_node=false;tree_component.drag_drop.marker.hide();return false;}
+var tree2=tree_component.inst[cnt.attr("id")];tree2.off_height();if(tmp.scroll_time)clearTimeout(tmp.scroll_time);tmp.scroll_time=setTimeout(function(){tree2.scroll_check(event.pageX,event.pageY);},50);var mov=false;var st=cnt.scrollTop();if(event.target.tagName=="A"||event.target.tagName=="INS"){if(et.is("#jstree-dragged"))return false;if(tree2.get_node(event.target).hasClass("closed")){tmp.open_time=setTimeout(function(){tree2.open_branch(et);},500);}
+var et_off=et.offset();var goTo={x:(et_off.left-1),y:(event.pageY-et_off.top)};var arr=[];if(goTo.y<tree2.li_height/3+1)arr=["before","inside","after"];else if(goTo.y>tree2.li_height*2/3-1)arr=["after","inside","before"];else{if(goTo.y<tree2.li_height/2)arr=["inside","before","after"];else arr=["inside","after","before"];}
+var ok=false;var nn=(tmp.foreign==false)?tmp.origin_tree.container.find("li.dragged"):tmp.f_type;$.each(arr,function(i,val){if(tree2.check_move(nn,et,val)){mov=val;ok=true;return false;}});if(ok){switch(mov){case"before":goTo.y=et_off.top-2;tree_component.drag_drop.marker.attr("class","marker");break;case"after":goTo.y=et_off.top-2+tree2.li_height;tree_component.drag_drop.marker.attr("class","marker");break;case"inside":goTo.x-=2;goTo.y=et_off.top-2+tree2.li_height/2;tree_component.drag_drop.marker.attr("class","marker_plus");break;}
+tmp.move_type=mov;tmp.ref_node=$(event.target);if(tmp.drag_help!==false)tmp.drag_help.find(".forbidden").removeClass("forbidden");tree_component.drag_drop.marker.css({"left":goTo.x,"top":goTo.y}).show();}}
+if((et.is(".tree")||et.is("ul"))&&et.find("li:eq(0)").size()==0){var et_off=et.offset();tmp.move_type="inside";tmp.ref_node=cnt.children("ul:eq(0)");if(tmp.drag_help!==false)tmp.drag_help.find(".forbidden").removeClass("forbidden");tree_component.drag_drop.marker.attr("class","marker_plus");tree_component.drag_drop.marker.css({"left":(et_off.left+10),"top":et_off.top+15}).show();}
+else if((event.target.tagName!="A"&&event.target.tagName!="INS")||!ok){if(tmp.drag_help!==false)tmp.drag_help.find("li:eq(0) ins").addClass("forbidden");tmp.move_type=false;tmp.ref_node=false;tree_component.drag_drop.marker.hide();}
+event.preventDefault();event.stopPropagation();return false;}
+return true;};$(function(){$(document).bind("mousemove.jstree",tree_component.mousemove);$(document).bind("mouseup.jstree",tree_component.mouseup);});tree_component.cut_copy={copy_nodes:false,cut_nodes:false};tree_component.css=false;tree_component.get_css=function(rule_name,delete_flag){rule_name=rule_name.toLowerCase();var css_rules=tree_component.css.cssRules||tree_component.css.rules;var j=0;do{if(css_rules.length&&j>css_rules.length+5)return false;if(css_rules[j].selectorText&&css_rules[j].selectorText.toLowerCase()==rule_name){if(delete_flag==true){if(tree_component.css.removeRule)document.styleSheets[i].removeRule(j);if(tree_component.css.deleteRule)document.styleSheets[i].deleteRule(j);return true;}
+else return css_rules[j];}}
+while(css_rules[++j]);return false;};tree_component.add_css=function(rule_name){if(tree_component.get_css(rule_name))return false;(tree_component.css.insertRule)?tree_component.css.insertRule(rule_name+' { }',0):tree_component.css.addRule(rule_name,null,0);return tree_component.get_css(rule_name);};tree_component.remove_css=function(rule_name){return tree_component.get_css(rule_name,true);};tree_component.add_sheet=function(opts){if(opts.str){var tmp=document.createElement("style");tmp.setAttribute('type',"text/css");if(tmp.styleSheet){document.getElementsByTagName("head")[0].appendChild(tmp);tmp.styleSheet.cssText=opts.str;}
+else{tmp.appendChild(document.createTextNode(opts.str));document.getElementsByTagName("head")[0].appendChild(tmp);}
+return tmp.sheet||tmp.styleSheet;}
+if(opts.url){if(document.createStyleSheet){try{document.createStyleSheet(opts.url);}catch(e){};}
+else{var newSS=document.createElement('link');newSS.rel='stylesheet';newSS.type='text/css';newSS.media="all";newSS.href=opts.url;document.getElementsByTagName("head")[0].appendChild(newSS);return newSS.styleSheet;}}};$(function(){var u=navigator.userAgent.toLowerCase();var v=(u.match(/.+(?:rv|it|ra|ie)[\/: ]([\d.]+)/)||[0,'0'])[1];var css='/* TREE LAYOUT */ .tree ul { margin:0 0 0 5px; padding:0 0 0 0; list-style-type:none; } .tree li { display:block; min-height:18px; line-height:18px; padding:0 0 0 15px; margin:0 0 0 0; /* Background fix */ clear:both; } .tree li ul { display:none; } .tree li a, .tree li span { display:inline-block;line-height:16px;height:16px;color:black;white-space:nowrap;text-decoration:none;padding:1px 4px 1px 4px;margin:0; } .tree li a:focus { outline: none; } .tree li a input, .tree li span input { margin:0;padding:0 0;display:inline-block;height:12px !important;border:1px solid white;background:white;font-size:10px;font-family:Verdana; } .tree li a input:not([class="xxx"]), .tree li span input:not([class="xxx"]) { padding:1px 0; } /* FOR DOTS */ .tree .ltr li.last { float:left; } .tree > ul li.last { overflow:visible; } /* OPEN OR CLOSE */ .tree li.open ul { display:block; } .tree li.closed ul { display:none !important; } /* FOR DRAGGING */ #jstree-dragged { position:absolute; top:-10px; left:-10px; margin:0; padding:0; } #jstree-dragged ul ul ul { display:none; } #jstree-marker { padding:0; margin:0; line-height:5px; font-size:1px; overflow:hidden; height:5px; position:absolute; left:-45px; top:-30px; z-index:1000; background-color:transparent; background-repeat:no-repeat; display:none; } #jstree-marker.marker { width:45px; background-position:-32px top; } #jstree-marker.marker_plus { width:5px; background-position:right top; } /* BACKGROUND DOTS */ .tree li li { overflow:hidden; } .tree > .ltr > li { display:table; } /* ICONS */ .tree ul ins { display:inline-block; text-decoration:none; width:16px; height:16px; } .tree .ltr ins { margin:0 4px 0 0px; } ';if($.browser.msie){if($.browser.version==6)css+='.tree li { height:18px; zoom:1; } .tree li li { overflow:visible; } .tree .ltr li.last { margin-top: expression( (this.previousSibling && /open/.test(this.previousSibling.className) ) ? "-2px" : "0"); } .marker { width:45px; background-position:-32px top; } .marker_plus { width:5px; background-position:right top; }';if($.browser.version==7)css+='.tree li li { overflow:visible; } .tree .ltr li.last { margin-top: expression( (this.previousSibling && /open/.test(this.previousSibling.className) ) ? "-2px" : "0"); }';}
+if($.browser.opera)css+='.tree > ul > li.last:after { content:"."; display: block; height:1px; clear:both; visibility:hidden; }';if($.browser.mozilla&&$.browser.version.indexOf("1.8")==0)css+='.tree .ltr li a { display:inline; float:left; } .tree li ul { clear:both; }';tree_component.css=tree_component.add_sheet({str:css});});})(jQuery);(function($){$.extend($.tree.datastores,{"html":function(){return{get:function(obj,tree,opts){return obj&&$(obj).size()?$('<div>').append(tree.get_node(obj).clone()).html():tree.container.children("ul:eq(0)").html();},parse:function(data,tree,opts,callback){if(callback)callback.call(null,data);return data;},load:function(data,tree,opts,callback){if(opts.url){$.ajax({'type':opts.method,'url':opts.url,'data':data,'dataType':"html",'success':function(d,textStatus){callback.call(null,d);},'error':function(xhttp,textStatus,errorThrown){callback.call(null,false);tree.error(errorThrown+" "+textStatus);}});}
+else{callback.call(null,opts.static||tree.container.children("ul:eq(0)").html());}}};},"json":function(){return{get:function(obj,tree,opts){var _this=this;if(!obj||$(obj).size()==0)obj=tree.container.children("ul").children("li");else obj=$(obj);if(!opts)opts={};if(!opts.outer_attrib)opts.outer_attrib=["id","rel","class"];if(!opts.inner_attrib)opts.inner_attrib=[];if(obj.size()>1){var arr=[];obj.each(function(){arr.push(_this.get(this,tree,opts));});return arr;}
+if(obj.size()==0)return[];var json={attributes:{},data:{}};if(obj.hasClass("open"))json.data.state="open";if(obj.hasClass("closed"))json.data.state="closed";for(var i in opts.outer_attrib){if(!opts.outer_attrib.hasOwnProperty(i))continue;var val=(opts.outer_attrib[i]=="class")?obj.attr(opts.outer_attrib[i]).replace(/(^| )last( |$)/ig," ").replace(/(^| )(leaf|closed|open)( |$)/ig," "):obj.attr(opts.outer_attrib[i]);if(typeof val!="undefined"&&val.toString().replace(" ","").length>0)json.attributes[opts.outer_attrib[i]]=val;delete val;}
+if(tree.settings.languages.length){for(var i in tree.settings.languages){if(!tree.settings.languages.hasOwnProperty(i))continue;var a=obj.children("a."+tree.settings.languages[i]);if(opts.force||opts.inner_attrib.length||a.children("ins").get(0).style.backgroundImage.toString().length||a.children("ins").get(0).className.length){json.data[tree.settings.languages[i]]={};json.data[tree.settings.languages[i]].title=tree.get_text(obj,tree.settings.languages[i]);if(a.children("ins").get(0).style.className.length){json.data[tree.settings.languages[i]].icon=a.children("ins").get(0).style.className;}
+if(a.children("ins").get(0).style.backgroundImage.length){json.data[tree.settings.languages[i]].icon=a.children("ins").get(0).style.backgroundImage.replace("url(","").replace(")","");}
+if(opts.inner_attrib.length){json.data[tree.settings.languages[i]].attributes={};for(var j in opts.inner_attrib){if(!opts.inner_attrib.hasOwnProperty(j))continue;var val=a.attr(opts.inner_attrib[j]);if(typeof val!="undefined"&&val.toString().replace(" ","").length>0)json.data[tree.settings.languages[i]].attributes[opts.inner_attrib[j]]=val;delete val;}}}
+else{json.data[tree.settings.languages[i]]=tree.get_text(obj,tree.settings.languages[i]);}}}
+else{var a=obj.children("a");json.data.title=tree.get_text(obj);if(a.children("ins").size()&&a.children("ins").get(0).className.length){json.data.icon=a.children("ins").get(0).className;}
+if(a.children("ins").size()&&a.children("ins").get(0).style.backgroundImage.length){json.data.icon=a.children("ins").get(0).style.backgroundImage.replace("url(","").replace(")","");}
+if(opts.inner_attrib.length){json.data.attributes={};for(var j in opts.inner_attrib){if(!opts.inner_attrib.hasOwnProperty(j))continue;var val=a.attr(opts.inner_attrib[j]);if(typeof val!="undefined"&&val.toString().replace(" ","").length>0)json.data.attributes[opts.inner_attrib[j]]=val;delete val;}}}
+if(obj.children("ul").size()>0){json.children=[];obj.children("ul").children("li").each(function(){json.children.push(_this.get(this,tree,opts));});}
+return json;},parse:function(data,tree,opts,callback){if(Object.prototype.toString.apply(data)==="[object Array]"){var str='';for(var i=0;i<data.length;i++){if(typeof data[i]=="function")continue;str+=this.parse(data[i],tree,opts);}
+if(callback)callback.call(null,str);return str;}
+if(!data||!data.data){if(callback)callback.call(null,false);return"";}
+var str='';str+="<li ";var cls=false;if(data.attributes){for(var i in data.attributes){if(!data.attributes.hasOwnProperty(i))continue;if(i=="class"){str+=" class='"+data.attributes[i]+" ";if(data.state=="closed"||data.state=="open")str+=" "+data.state+" ";str+="' ";cls=true;}
+else str+=" "+i+"='"+data.attributes[i]+"' ";}}
+if(!cls&&(data.state=="closed"||data.state=="open"))str+=" class='"+data.state+"' ";str+=">";if(tree.settings.languages.length){for(var i=0;i<tree.settings.languages.length;i++){var attr={};attr["href"]="";attr["style"]="";attr["class"]=tree.settings.languages[i];if(data.data[tree.settings.languages[i]]&&(typeof data.data[tree.settings.languages[i]].attributes).toLowerCase()!="undefined"){for(var j in data.data[tree.settings.languages[i]].attributes){if(!data.data[tree.settings.languages[i]].attributes.hasOwnProperty(j))continue;if(j=="style"||j=="class")attr[j]+=" "+data.data[tree.settings.languages[i]].attributes[j];else attr[j]=data.data[tree.settings.languages[i]].attributes[j];}}
+str+="<a";for(var j in attr){if(!attr.hasOwnProperty(j))continue;str+=' '+j+'="'+attr[j]+'" ';}
+str+=">";if(data.data[tree.settings.languages[i]]&&data.data[tree.settings.languages[i]].icon){str+="<ins "+(data.data[tree.settings.languages[i]].icon.indexOf("/")==-1?" class='"+data.data[tree.settings.languages[i]].icon+"' ":" style='background-image:url(\""+data.data[tree.settings.languages[i]].icon+"\");' ")+">&nbsp;</ins>";}
+else str+="<ins>&nbsp;</ins>";str+=((typeof data.data[tree.settings.languages[i]].title).toLowerCase()!="undefined"?data.data[tree.settings.languages[i]].title:data.data[tree.settings.languages[i]])+"</a>";}}
+else{var attr={};attr["href"]="";attr["style"]="";attr["class"]="";if((typeof data.data.attributes).toLowerCase()!="undefined"){for(var i in data.data.attributes){if(!data.data.attributes.hasOwnProperty(i))continue;if(i=="style"||i=="class")attr[i]+=" "+data.data.attributes[i];else attr[i]=data.data.attributes[i];}}
+str+="<a";for(var i in attr){if(!attr.hasOwnProperty(i))continue;str+=' '+i+'="'+attr[i]+'" ';}
+str+=">";if(data.data.icon){str+="<ins "+(data.data.icon.indexOf("/")==-1?" class='"+data.data.icon+"' ":" style='background-image:url(\""+data.data.icon+"\");' ")+">&nbsp;</ins>";}
+else str+="<ins>&nbsp;</ins>";str+=((typeof data.data.title).toLowerCase()!="undefined"?data.data.title:data.data)+"</a>";}
+if(data.children&&data.children.length){str+='<ul>';for(var i=0;i<data.children.length;i++){str+=this.parse(data.children[i],tree,opts);}
+str+='</ul>';}
+str+="</li>";if(callback)callback.call(null,str);return str;},load:function(data,tree,opts,callback){if(opts.static){callback.call(null,opts.static);}
+else{$.ajax({'type':opts.method,'url':opts.url,'data':data,'dataType':"json",'success':function(d,textStatus){callback.call(null,d);},'error':function(xhttp,textStatus,errorThrown){callback.call(null,false);tree.error(errorThrown+" "+textStatus);}});}}}}});})(jQuery);

Added: trunk/mapbender/http/extensions/jsTree.v.0.9.9a2/jquery.tree.min.js~
===================================================================
--- trunk/mapbender/http/extensions/jsTree.v.0.9.9a2/jquery.tree.min.js~	                        (rev 0)
+++ trunk/mapbender/http/extensions/jsTree.v.0.9.9a2/jquery.tree.min.js~	2010-04-29 14:24:49 UTC (rev 6040)
@@ -0,0 +1,2064 @@
+/*
+ * jsTree 0.9.9a
+ * http://jstree.com/
+ *
+ * Copyright (c) 2009 Ivan Bozhanov (vakata.com)
+ *
+ * Dual licensed under the MIT and GPL licenses:
+ *   http://www.opensource.org/licenses/mit-license.php
+ *   http://www.gnu.org/licenses/gpl.html
+ *
+ * Date: 2009-10-06
+ *
+ */
+
+(function($) {
+	// jQuery plugin
+	$.tree = {
+		datastores	: { },
+		plugins		: { },
+		defaults	: {
+			data	: {
+				async	: false,		// Are async requests used to load open_branch contents
+				type	: "html",		// One of included datastores
+				opts	: { method: "GET", url: false } // Options passed to datastore
+			},
+			selected	: false,		// FALSE or STRING or ARRAY
+			opened		: [],			// ARRAY OF INITIALLY OPENED NODES
+			languages	: [],			// ARRAY of string values (which will be used as CSS classes - so they must be valid)
+			ui		: {
+				dots		: true,		// BOOL - dots or no dots
+				animation	: 0,		// INT - duration of open/close animations in miliseconds
+				scroll_spd	: 4,
+				theme_path	: false,	// Path to the theme CSS file - if set to false and theme_name is not false - will lookup jstree-path-here/themes/theme-name-here/style.css
+				theme_name	: "default",// if set to false no theme will be loaded
+				selected_parent_close	: "select_parent", // false, "deselect", "select_parent"
+				selected_delete			: "select_previous" // false, "select_previous"
+			},
+			types	: {
+				"default" : {
+					clickable	: true, // can be function
+					renameable	: true, // can be function
+					deletable	: true, // can be function
+					creatable	: true, // can be function
+					draggable	: true, // can be function
+					max_children	: -1, // -1 - not set, 0 - no children, 1 - one child, etc // can be function
+					max_depth		: -1, // -1 - not set, 0 - no children, 1 - one level of children, etc // can be function
+					valid_children	: "all", // all, none, array of values // can be function
+					icon : {
+						image : false,
+						position : false
+					}
+				}
+			},
+			rules	: {
+				multiple	: false,	// FALSE | CTRL | ON - multiple selection off/ with or without holding Ctrl
+				multitree	: "none",	// all, none, array of tree IDs to accept from
+				type_attr	: "rel",	// STRING attribute name (where is the type stored as string)
+				createat	: "bottom",	// STRING (top or bottom) new nodes get inserted at top or bottom
+				drag_copy	: "ctrl",	// FALSE | CTRL | ON - drag to copy off/ with or without holding Ctrl
+				drag_button	: "left",	// left, right or both
+				use_max_children	: true,
+				use_max_depth		: true,
+
+				max_children: -1,
+				max_depth	: -1,
+				valid_children : "all"
+			},
+			lang : {
+				new_node	: "New folder",
+				loading		: "Loading ..."
+			},
+			callback	: {
+				beforechange: function(NODE,TREE_OBJ) { return true },
+				beforeopen	: function(NODE,TREE_OBJ) { return true },
+				beforeclose	: function(NODE,TREE_OBJ) { return true },
+				beforemove	: function(NODE,REF_NODE,TYPE,TREE_OBJ) { return true }, 
+				beforecreate: function(NODE,REF_NODE,TYPE,TREE_OBJ) { return true }, 
+				beforerename: function(NODE,LANG,TREE_OBJ) { return true }, 
+				beforedelete: function(NODE,TREE_OBJ) { return true }, 
+				beforedata	: function(NODE,TREE_OBJ) { return { id : $(NODE).attr("id") || 0 } }, // PARAMETERS PASSED TO SERVER
+				ondata		: function(DATA,TREE_OBJ) { return DATA; },		// modify data before parsing it
+				onparse		: function(STR,TREE_OBJ) { return STR; },		// modify string before visualizing it
+				onhover		: function(NODE,TREE_OBJ) { },					// node hovered
+				onselect	: function(NODE,TREE_OBJ) { },					// node selected
+				ondeselect	: function(NODE,TREE_OBJ) { },					// node deselected
+				onchange	: function(NODE,TREE_OBJ) { },					// focus changed
+				onrename	: function(NODE,TREE_OBJ,RB) { },				// node renamed
+				onmove		: function(NODE,REF_NODE,TYPE,TREE_OBJ,RB) { },	// move completed
+				oncopy		: function(NODE,REF_NODE,TYPE,TREE_OBJ,RB) { },	// copy completed
+				oncreate	: function(NODE,REF_NODE,TYPE,TREE_OBJ,RB) { },	// node created
+				ondelete	: function(NODE,TREE_OBJ,RB) { },				// node deleted
+				onopen		: function(NODE,TREE_OBJ) { },					// node opened
+				onopen_all	: function(TREE_OBJ) { },						// all nodes opened
+				onclose_all	: function(TREE_OBJ) { },						// all nodes closed
+				onclose		: function(NODE,TREE_OBJ) { },					// node closed
+				error		: function(TEXT,TREE_OBJ) { },					// error occured
+				ondblclk	: function(NODE,TREE_OBJ) { TREE_OBJ.toggle_branch.call(TREE_OBJ, NODE); TREE_OBJ.select_branch.call(TREE_OBJ, NODE); },
+				onrgtclk	: function(NODE,TREE_OBJ,EV) { },				// right click - to prevent use: EV.preventDefault(); EV.stopPropagation(); return false
+				onload		: function(TREE_OBJ) { },
+				oninit		: function(TREE_OBJ) { },
+				onfocus		: function(TREE_OBJ) { },
+				ondestroy	: function(TREE_OBJ) { },
+				onsearch	: function(NODES, TREE_OBJ) { NODES.addClass("search"); },
+				ondrop		: function(NODE,REF_NODE,TYPE,TREE_OBJ) { },
+				check		: function(RULE,NODE,VALUE,TREE_OBJ) { return VALUE; },
+				check_move	: function(NODE,REF_NODE,TYPE,TREE_OBJ) { return true; }
+			},
+			plugins : { }
+		},
+
+		create		: function () { return new tree_component(); },
+		focused		: function () { return tree_component.inst[tree_component.focused]; },
+		reference	: function (obj) { 
+			var o = $(obj); 
+			if(!o.size()) o = $("#" + obj);
+			if(!o.size()) return null; 
+			o = (o.is(".tree")) ? o.attr("id") : o.parents(".tree:eq(0)").attr("id"); 
+			return tree_component.inst[o] || null; 
+		},
+		rollback	: function (data) {
+			for(var i in data) {
+				if(!data.hasOwnProperty(i)) continue;
+				var tmp = tree_component.inst[i];
+				var lock = !tmp.locked;
+
+				// if not locked - lock the tree
+				if(lock) tmp.lock(true);
+				// Cancel ongoing rename
+				tmp.inp = false;
+				tmp.container.html(data[i].html).find(".dragged").removeClass("dragged").end().find(".hover").removeClass("hover");
+
+				if(data[i].selected) {
+					tmp.selected = $("#" + data[i].selected);
+					tmp.selected_arr = [];
+					tmp.container
+						.find("a.clicked").each( function () {
+							tmp.selected_arr.push(tmp.get_node(this));
+						});
+				}
+				// if this function set the lock - unlock
+				if(lock) tmp.lock(false);
+
+				delete lock;
+				delete tmp;
+			}
+		},
+		drop_mode	: function (opts) {
+			opts = $.extend(opts, { show : false, type : "default", str : "Foreign node" });
+			tree_component.drag_drop.foreign	= true;
+			tree_component.drag_drop.isdown		= true;
+			tree_component.drag_drop.moving		= true;
+			tree_component.drag_drop.appended	= false;
+			tree_component.drag_drop.f_type		= opts.type;
+			tree_component.drag_drop.f_data		= opts;
+
+
+			if(!opts.show) {
+				tree_component.drag_drop.drag_help	= false;
+				tree_component.drag_drop.drag_node	= false;
+			}
+			else {
+				tree_component.drag_drop.drag_help	= $("<div id='jstree-dragged' class='tree tree-default'><ul><li class='last dragged foreign'><a href='#'><ins>&nbsp;</ins>" + opts.str + "</a></li></ul></div>");
+				tree_component.drag_drop.drag_node	= tree_component.drag_drop.drag_help.find("li:eq(0)");
+			}
+			if($.tree.drag_start !== false) $.tree.drag_start.call(null, false);
+		},
+		drag_start	: false,
+		drag		: false,
+		drag_end	: false
+	};
+	$.fn.tree = function (opts) {
+		return this.each(function() {
+			var conf = $.extend({},opts);
+			if(tree_component.inst && tree_component.inst[$(this).attr('id')]) tree_component.inst[$(this).attr('id')].destroy();
+			if(conf !== false) new tree_component().init(this, conf);
+		});
+	};
+
+	// core
+	function tree_component () {
+		return {
+			cntr : ++tree_component.cntr,
+			settings : $.extend({},$.tree.defaults),
+
+			init : function(elem, conf) {
+				var _this = this;
+				this.container = $(elem);
+				if(this.container.size == 0) return false;
+				tree_component.inst[this.cntr] = this;
+				if(!this.container.attr("id")) this.container.attr("id","jstree_" + this.cntr); 
+				tree_component.inst[this.container.attr("id")] = tree_component.inst[this.cntr];
+				tree_component.focused = this.cntr;
+				this.settings = $.extend(true, {}, this.settings, conf);
+
+				// DEAL WITH LANGUAGE VERSIONS
+				if(this.settings.languages && this.settings.languages.length) {
+					this.current_lang = this.settings.languages[0];
+					var st = false;
+					var id = "#" + this.container.attr("id");
+					for(var ln = 0; ln < this.settings.languages.length; ln++) {
+						st = tree_component.add_css(id + " ." + this.settings.languages[ln]);
+						if(st !== false) st.style.display = (this.settings.languages[ln] == this.current_lang) ? "" : "none";
+					}
+				}
+				else this.current_lang = false;
+				// THEMES
+				this.container.addClass("tree");
+				if(this.settings.ui.theme_name !== false) {
+					if(this.settings.ui.theme_path === false) {
+						$("script").each(function () { 
+							if(this.src.toString().match(/jquery\.tree.*?js$/)) { _this.settings.ui.theme_path = this.src.toString().replace(/jquery\.tree.*?js$/, "") + "themes/" + _this.settings.ui.theme_name + "/style.css"; return false; }
+						});
+					}
+					if(this.settings.ui.theme_path != "" && $.inArray(this.settings.ui.theme_path, tree_component.themes) == -1) {
+						tree_component.add_sheet({ url : this.settings.ui.theme_path });
+						tree_component.themes.push(this.settings.ui.theme_path);
+					}
+					this.container.addClass("tree-" + this.settings.ui.theme_name);
+				}
+				// TYPE ICONS
+				var type_icons = "";
+				for(var t in this.settings.types) {
+					if(!this.settings.types.hasOwnProperty(t)) continue;
+					if(!this.settings.types[t].icon) continue;
+					if( this.settings.types[t].icon.image || this.settings.types[t].icon.position) {
+						if(t == "default")  type_icons += "#" + this.container.attr("id") + " li > a ins { ";
+						else type_icons += "#" + this.container.attr("id") + " li[rel=" + t + "] > a ins { ";
+						if(this.settings.types[t].icon.image) type_icons += " background-image:url(" + this.settings.types[t].icon.image + "); ";
+						if(this.settings.types[t].icon.position) type_icons += " background-position:" + this.settings.types[t].icon.position + "; ";
+						type_icons += "} ";
+					}
+				}
+				if(type_icons != "") tree_component.add_sheet({ str : type_icons });
+
+				if(this.settings.rules.multiple) this.selected_arr = [];
+				this.offset = false;
+				this.hovered = false;
+				this.locked = false;
+
+				if(tree_component.drag_drop.marker === false) tree_component.drag_drop.marker = $("<div>").attr({ id : "jstree-marker" }).hide().appendTo("body");
+				this.callback("oninit", [this]);
+				this.refresh();
+				this.attach_events();
+				this.focus();
+			},
+			refresh : function (obj) {
+				if(this.locked) return this.error("LOCKED");
+				var _this = this;
+				if(obj && !this.settings.data.async) obj = false;
+				this.is_partial_refresh = obj ? true : false;
+
+				// SAVE OPENED
+				this.opened = Array();
+				if(this.settings.opened != false) {
+					$.each(this.settings.opened, function (i, item) {
+						if(this.replace(/^#/,"").length > 0) { _this.opened.push("#" + this.replace(/^#/,"")); }
+					});
+					this.settings.opened = false;
+				}
+				else {
+					this.container.find("li.open").each(function (i) { if(this.id) { _this.opened.push("#" + this.id); } });
+				}
+
+				// SAVE SELECTED
+				if(this.selected) {
+					this.settings.selected = Array();
+					if(obj) {
+						$(obj).find("li:has(a.clicked)").each(function () {
+							if(this.id) _this.settings.selected.push("#" + this.id);
+						});
+					}
+					else {
+						if(this.selected_arr) {
+							$.each(this.selected_arr, function () {
+								if(this.attr("id")) _this.settings.selected.push("#" + this.attr("id"));
+							});
+						}
+						else {
+							if(this.selected.attr("id")) this.settings.selected.push("#" + this.selected.attr("id"));
+						}
+					}
+				}
+				else if(this.settings.selected !== false) {
+					var tmp = Array();
+					if((typeof this.settings.selected).toLowerCase() == "object") {
+						$.each(this.settings.selected, function () {
+							if(this.replace(/^#/,"").length > 0) tmp.push("#" + this.replace(/^#/,""));
+						});
+					}
+					else {
+						if(this.settings.selected.replace(/^#/,"").length > 0) tmp.push("#" + this.settings.selected.replace(/^#/,""));
+					}
+					this.settings.selected = tmp;
+				}
+
+				if(obj && this.settings.data.async) {
+					this.opened = Array();
+					obj = this.get_node(obj);
+					obj.find("li.open").each(function (i) { _this.opened.push("#" + this.id); });
+					if(obj.hasClass("open")) obj.removeClass("open").addClass("closed");
+					if(obj.hasClass("leaf")) obj.removeClass("leaf");
+					obj.children("ul:eq(0)").html("");
+					return this.open_branch(obj, true, function () { _this.reselect.apply(_this); });
+				}
+
+				var _this = this;
+				var _datastore = new $.tree.datastores[this.settings.data.type]();
+				if(this.container.children("ul").size() == 0) {
+					this.container.html("<ul class='ltr' style='direction:ltr;'><li class='last'><a class='loading' href='#'><ins>&nbsp;</ins>" + (this.settings.lang.loading || "Loading ...") + "</a></li></ul>");
+				}
+				_datastore.load(this.callback("beforedata",[false,this]),this,this.settings.data.opts,function(data) {
+					data = _this.callback("ondata",[data, _this]);
+					_datastore.parse(data,_this,_this.settings.data.opts,function(str) {
+						str = _this.callback("onparse", [str, _this]);
+						_this.container.empty().append($("<ul class='ltr'>").html(str));
+						_this.container.find("li:last-child").addClass("last").end().find("li:has(ul)").not(".open").addClass("closed");
+						_this.container.find("li").not(".open").not(".closed").addClass("leaf");
+						_this.reselect();
+					});
+				});
+			},
+			reselect : function (is_callback) {
+				var _this = this;
+
+				if(!is_callback)	this.cl_count = 0;
+				else				this.cl_count --;
+				// REOPEN BRANCHES
+				if(this.opened && this.opened.length) {
+					var opn = false;
+					for(var j = 0; this.opened && j < this.opened.length; j++) {
+						if(this.settings.data.async) {
+							var tmp = this.get_node(this.opened[j]);
+							if(tmp.size() && tmp.hasClass("closed") > 0) {
+								opn = true;
+								var tmp = this.opened[j].toString().replace('/','\\/');
+								delete this.opened[j];
+								this.open_branch(tmp, true, function () { _this.reselect.apply(_this, [true]); } );
+								this.cl_count ++;
+							}
+						}
+						else this.open_branch(this.opened[j], true);
+					}
+					if(this.settings.data.async && opn) return;
+					if(this.cl_count > 0) return;
+					delete this.opened;
+				} 
+				if(this.cl_count > 0) return;
+
+				// DOTS and RIGHT TO LEFT
+				this.container.css("direction","ltr").children("ul:eq(0)").addClass("ltr");
+				if(this.settings.ui.dots == false)	this.container.children("ul:eq(0)").addClass("no_dots");
+
+				// REPOSITION SCROLL
+				if(this.scrtop) {
+					this.container.scrollTop(_this.scrtop);
+					delete this.scrtop;
+				}
+				// RESELECT PREVIOUSLY SELECTED
+				if(this.settings.selected !== false) {
+					$.each(this.settings.selected, function (i) {
+						if(_this.is_partial_refresh)	_this.select_branch($(_this.settings.selected[i].toString().replace('/','\\/'), _this.container), (_this.settings.rules.multiple !== false) );
+						else							_this.select_branch($(_this.settings.selected[i].toString().replace('/','\\/'), _this.container), (_this.settings.rules.multiple !== false && i > 0) );
+					});
+					this.settings.selected = false;
+				}
+				this.callback("onload", [_this]);
+			},
+
+			get : function (obj, format, opts) {
+				if(!format) format = this.settings.data.type;
+				if(!opts) opts = this.settings.data.opts;
+				return new $.tree.datastores[format]().get(obj, this, opts);
+			},
+
+			attach_events : function () {
+				var _this = this;
+
+				this.container
+					.bind("mousedown.jstree", function (event) {
+						if(tree_component.drag_drop.isdown) {
+							tree_component.drag_drop.move_type = false;
+							event.preventDefault();
+							event.stopPropagation();
+							event.stopImmediatePropagation();
+							return false;
+						}
+					})
+					.bind("mouseup.jstree", function (event) {
+						setTimeout( function() { _this.focus.apply(_this); }, 5);
+					})
+					.bind("click.jstree", function (event) { 
+						//event.stopPropagation(); 
+						return true;
+					});
+				$("li", this.container.get(0))
+					.live("click", function(event) { // WHEN CLICK IS ON THE ARROW
+						if(event.target.tagName != "LI") return true;
+						_this.off_height();
+						if(event.pageY - $(event.target).offset().top > _this.li_height) return true;
+						_this.toggle_branch.apply(_this, [event.target]);
+						event.stopPropagation();
+						return false;
+					});
+				$("a", this.container.get(0))
+					.live("click", function (event) { // WHEN CLICK IS ON THE TEXT OR ICON
+						if(event.which && event.which == 3) return true;
+						if(_this.locked) {
+							event.preventDefault(); 
+							event.target.blur();
+							return _this.error("LOCKED");
+						}
+						_this.select_branch.apply(_this, [event.target, event.ctrlKey || _this.settings.rules.multiple == "on"]);
+						if(_this.inp) { _this.inp.blur(); }
+						event.preventDefault(); 
+						event.target.blur();
+						return false;
+					})
+					.live("dblclick", function (event) { // WHEN DOUBLECLICK ON TEXT OR ICON
+						if(_this.locked) {
+							event.preventDefault(); 
+							event.stopPropagation();
+							event.target.blur();
+							return _this.error("LOCKED");
+						}
+						_this.callback("ondblclk", [_this.get_node(event.target).get(0), _this]);
+						event.preventDefault(); 
+						event.stopPropagation();
+						event.target.blur();
+					})
+					.live("contextmenu", function (event) {
+						if(_this.locked) {
+							event.target.blur();
+							return _this.error("LOCKED");
+						}
+						return _this.callback("onrgtclk", [_this.get_node(event.target).get(0), _this, event]);
+					})
+					.live("mouseover", function (event) {
+						if(_this.locked) {
+							event.preventDefault();
+							event.stopPropagation();
+							return _this.error("LOCKED");
+						}
+						if(_this.hovered !== false && (event.target.tagName == "A" || event.target.tagName == "INS")) {
+							_this.hovered.children("a").removeClass("hover");
+							_this.hovered = false;
+						}
+						_this.callback("onhover",[_this.get_node(event.target).get(0), _this]);
+					})
+					.live("mousedown", function (event) {
+						if(_this.settings.rules.drag_button == "left" && event.which && event.which != 1)	return true;
+						if(_this.settings.rules.drag_button == "right" && event.which && event.which != 3)	return true;
+						_this.focus.apply(_this);
+						if(_this.locked) return _this.error("LOCKED");
+						// SELECT LIST ITEM NODE
+						var obj = _this.get_node(event.target);
+						// IF ITEM IS DRAGGABLE
+						if(_this.settings.rules.multiple != false && _this.selected_arr.length > 1 && obj.children("a:eq(0)").hasClass("clicked")) {
+							var counter = 0;
+							for(var i in _this.selected_arr) {
+								if(!_this.selected_arr.hasOwnProperty(i)) continue;
+								if(_this.check("draggable", _this.selected_arr[i])) {
+									_this.selected_arr[i].addClass("dragged");
+									tree_component.drag_drop.origin_tree = _this;
+									counter ++;
+								}
+							}
+							if(counter > 0) {
+								if(_this.check("draggable", obj))	tree_component.drag_drop.drag_node = obj;
+								else								tree_component.drag_drop.drag_node = _this.container.find("li.dragged:eq(0)");
+								tree_component.drag_drop.isdown		= true;
+								tree_component.drag_drop.drag_help	= $("<div id='jstree-dragged' class='tree " + ( _this.settings.ui.theme_name != "" ? " tree-" + _this.settings.ui.theme_name : "" ) + "' />").append("<ul class='" + _this.container.children("ul:eq(0)").get(0).className + "' />");
+								var tmp = tree_component.drag_drop.drag_node.clone();
+								if(_this.settings.languages.length > 0) tmp.find("a").not("." + _this.current_lang).hide();
+								tree_component.drag_drop.drag_help.children("ul:eq(0)").append(tmp);
+								tree_component.drag_drop.drag_help.find("li:eq(0)").removeClass("last").addClass("last").children("a").html("<ins>&nbsp;</ins>Multiple selection").end().children("ul").remove();
+
+								tree_component.drag_drop.dragged = _this.container.find("li.dragged");
+							}
+						}
+						else {
+							if(_this.check("draggable", obj)) {
+								tree_component.drag_drop.drag_node	= obj;
+								tree_component.drag_drop.drag_help	= $("<div id='jstree-dragged' class='tree " + ( _this.settings.ui.theme_name != "" ? " tree-" + _this.settings.ui.theme_name : "" ) + "' />").append("<ul class='" + _this.container.children("ul:eq(0)").get(0).className + "' />");
+								var tmp = obj.clone();
+								if(_this.settings.languages.length > 0) tmp.find("a").not("." + _this.current_lang).hide();
+								tree_component.drag_drop.drag_help.children("ul:eq(0)").append(tmp);
+								tree_component.drag_drop.drag_help.find("li:eq(0)").removeClass("last").addClass("last");
+								tree_component.drag_drop.isdown		= true;
+								tree_component.drag_drop.foreign	= false;
+								tree_component.drag_drop.origin_tree = _this;
+								obj.addClass("dragged");
+
+								tree_component.drag_drop.dragged = _this.container.find("li.dragged");
+							}
+						}
+						tree_component.drag_drop.init_x = event.pageX;
+						tree_component.drag_drop.init_y = event.pageY;
+						obj.blur();
+						event.preventDefault(); 
+						event.stopPropagation();
+						return false;
+					});
+			},
+			focus : function () {
+				if(this.locked) return false;
+				if(tree_component.focused != this.cntr) {
+					tree_component.focused = this.cntr;
+					this.callback("onfocus",[this]);
+				}
+			},
+
+			off_height : function () {
+				if(this.offset === false) {
+					this.container.css({ position : "relative" });
+					this.offset = this.container.offset();
+					var tmp = 0;
+					tmp = parseInt($.curCSS(this.container.get(0), "paddingTop", true),10);
+					if(tmp) this.offset.top += tmp;
+					tmp = parseInt($.curCSS(this.container.get(0), "borderTopWidth", true),10);
+					if(tmp) this.offset.top += tmp;
+					this.container.css({ position : "" });
+				}
+				if(!this.li_height) {
+					var tmp = this.container.find("ul li.closed, ul li.leaf").eq(0);
+					this.li_height = tmp.height();
+					if(tmp.children("ul:eq(0)").size()) this.li_height -= tmp.children("ul:eq(0)").height();
+					if(!this.li_height) this.li_height = 18;
+				}
+			},
+			scroll_check : function (x,y) { 
+				var _this = this;
+				var cnt = _this.container;
+				var off = _this.container.offset();
+
+				var st = cnt.scrollTop();
+				var sl = cnt.scrollLeft();
+				// DETECT HORIZONTAL SCROLL
+				var h_cor = (cnt.get(0).scrollWidth > cnt.width()) ? 40 : 20;
+
+				if(y - off.top < 20)						cnt.scrollTop(Math.max( (st - _this.settings.ui.scroll_spd) ,0));	// NEAR TOP
+				if(cnt.height() - (y - off.top) < h_cor)	cnt.scrollTop(st + _this.settings.ui.scroll_spd);					// NEAR BOTTOM
+				if(x - off.left < 20)						cnt.scrollLeft(Math.max( (sl - _this.settings.ui.scroll_spd),0));	// NEAR LEFT
+				if(cnt.width() - (x - off.left) < 40)		cnt.scrollLeft(sl + _this.settings.ui.scroll_spd);					// NEAR RIGHT
+
+				if(cnt.scrollLeft() != sl || cnt.scrollTop() != st) {
+					tree_component.drag_drop.move_type	= false;
+					tree_component.drag_drop.ref_node	= false;
+					tree_component.drag_drop.marker.hide();
+				}
+				tree_component.drag_drop.scroll_time = setTimeout( function() { _this.scroll_check(x,y); }, 50);
+			},
+			scroll_into_view : function (obj) {
+				obj = obj ? this.get_node(obj) : this.selected;
+				if(!obj) return false;
+				var off_t = obj.offset().top;
+				var beg_t = this.container.offset().top;
+				var end_t = beg_t + this.container.height();
+				var h_cor = (this.container.get(0).scrollWidth > this.container.width()) ? 40 : 20;
+				if(off_t + 5 < beg_t) this.container.scrollTop(this.container.scrollTop() - (beg_t - off_t + 5) );
+				if(off_t + h_cor > end_t) this.container.scrollTop(this.container.scrollTop() + (off_t + h_cor - end_t) );
+			},
+
+			get_node : function (obj) {
+				return $(obj).closest("li");
+			},
+			get_type : function (obj) {
+				obj = !obj ? this.selected : this.get_node(obj);
+				if(!obj) return;
+				var tmp = obj.attr(this.settings.rules.type_attr);
+				return tmp || "default";
+			},
+			set_type : function (str, obj) {
+				obj = !obj ? this.selected : this.get_node(obj);
+				if(!obj || !str) return;
+				obj.attr(this.settings.rules.type_attr, str);
+			},
+			get_text : function (obj, lang) {
+				obj = this.get_node(obj);
+				if(!obj || obj.size() == 0) return "";
+				if(this.settings.languages && this.settings.languages.length) {
+					lang = lang ? lang : this.current_lang;
+					obj = obj.children("a." + lang);
+				}
+				else obj = obj.children("a:visible");
+				var val = "";
+				obj.contents().each(function () {
+					if(this.nodeType == 3) { val = this.data; return false; }
+				});
+				return val;
+			},
+
+			check : function (rule, obj) {
+				if(this.locked) return false;
+				var v = false;
+				// if root node
+				if(obj === -1) { if(typeof this.settings.rules[rule] != "undefined") v = this.settings.rules[rule]; }
+				else {
+					obj = !obj ? this.selected : this.get_node(obj);
+					if(!obj) return;
+					var t = this.get_type(obj);
+					if(typeof this.settings.types[t] != "undefined" && typeof this.settings.types[t][rule] != "undefined") v = this.settings.types[t][rule];
+					else if(typeof this.settings.types["default"] != "undefined" && typeof this.settings.types["default"][rule] != "undefined") v = this.settings.types["default"][rule];
+				}
+				if(typeof v == "function") v = v.call(null, obj, this);
+				v = this.callback("check", [rule, obj, v, this]);
+				return v;
+			},
+			check_move : function (nod, ref_node, how) {
+				if(this.locked) return false;
+				if($(ref_node).closest("li.dragged").size()) return false;
+
+				var tree1 = nod.parents(".tree:eq(0)").get(0);
+				var tree2 = ref_node.parents(".tree:eq(0)").get(0);
+				// if different trees
+				if(tree1 && tree1 != tree2) {
+					var m = $.tree.reference(tree2.id).settings.rules.multitree;
+					if(m == "none" || ($.isArray(m) && $.inArray(tree1.id, m) == -1)) return false;
+				}
+
+				var p = (how != "inside") ? this.parent(ref_node) : this.get_node(ref_node);
+				nod = this.get_node(nod);
+				if(p == false) return false;
+				var r = {
+					max_depth : this.settings.rules.use_max_depth ? this.check("max_depth", p) : -1,
+					max_children : this.settings.rules.use_max_children ? this.check("max_children", p) : -1,
+					valid_children : this.check("valid_children", p)
+				};
+				var nod_type = (typeof nod == "string") ? nod : this.get_type(nod);
+				if(typeof r.valid_children != "undefined" && (r.valid_children == "none" || (typeof r.valid_children == "object" && $.inArray(nod_type, $.makeArray(r.valid_children)) == -1))) return false;
+				
+				if(this.settings.rules.use_max_children) {
+					if(typeof r.max_children != "undefined" && r.max_children != -1) {
+						if(r.max_children == 0) return false;
+						var c_count = 1;
+						if(tree_component.drag_drop.moving == true && tree_component.drag_drop.foreign == false) {
+							c_count = tree_component.drag_drop.dragged.size();
+							c_count = c_count - p.find('> ul > li.dragged').size();
+						}
+						if(r.max_children < p.find('> ul > li').size() + c_count) return false;
+					}
+				}
+
+				if(this.settings.rules.use_max_depth) {
+					if(typeof r.max_depth != "undefined" && r.max_depth === 0) return this.error("MOVE: MAX-DEPTH REACHED");
+					// check for max_depth up the chain
+					var mx = (r.max_depth > 0) ? r.max_depth : false;
+					var i = 0;
+					var t = p;
+					while(t !== -1) {
+						t = this.parent(t);
+						i ++;
+						var m = this.check("max_depth",t);
+						if(m >= 0) {
+							mx = (mx === false) ? (m - i) : Math.min(mx, m - i);
+						}
+						if(mx !== false && mx <= 0) return this.error("MOVE: MAX-DEPTH REACHED");
+					}
+					if(mx !== false && mx <= 0) return this.error("MOVE: MAX-DEPTH REACHED");
+					if(mx !== false) { 
+						var incr = 1;
+						if(typeof nod != "string") {
+							var t = nod;
+							// possible async problem - when nodes are not all loaded down the chain
+							while(t.size() > 0) {
+								if(mx - incr < 0) return this.error("MOVE: MAX-DEPTH REACHED");
+								t = t.children("ul").children("li");
+								incr ++;
+							}
+						}
+					}
+				}
+				if(this.callback("check_move", [nod, ref_node, how, this]) == false) return false;
+				return true;
+			},
+
+			hover_branch : function (obj) {
+				if(this.locked) return this.error("LOCKED");
+				var _this = this;
+				var obj = _this.get_node(obj);
+				if(!obj.size()) return this.error("HOVER: NOT A VALID NODE");
+				if(!_this.check("clickable", obj)) return this.error("SELECT: NODE NOT SELECTABLE");
+				if(this.hovered) this.hovered.children("A").removeClass("hover");
+				this.hovered = obj;
+				this.hovered.children("a").addClass("hover");
+				this.scroll_into_view(this.hovered);
+			},
+			select_branch : function (obj, multiple) {
+				if(this.locked) return this.error("LOCKED");
+				if(!obj && this.hovered !== false) obj = this.hovered;
+				var _this = this;
+				obj = _this.get_node(obj);
+				if(!obj.size()) return this.error("SELECT: NOT A VALID NODE");
+				obj.children("a").removeClass("hover");
+				// CHECK AGAINST RULES FOR SELECTABLE NODES
+				if(!_this.check("clickable", obj)) return this.error("SELECT: NODE NOT SELECTABLE");
+				if(_this.callback("beforechange",[obj.get(0),_this]) === false) return this.error("SELECT: STOPPED BY USER");
+				// IF multiple AND obj IS ALREADY SELECTED - DESELECT IT
+				if(this.settings.rules.multiple != false && multiple && obj.children("a.clicked").size() > 0) {
+					return this.deselect_branch(obj);
+				}
+				if(this.settings.rules.multiple != false && multiple) {
+					this.selected_arr.push(obj);
+				}
+				if(this.settings.rules.multiple != false && !multiple) {
+					for(var i in this.selected_arr) {
+						if(!this.selected_arr.hasOwnProperty(i)) continue;
+						this.selected_arr[i].children("A").removeClass("clicked");
+						this.callback("ondeselect", [this.selected_arr[i].get(0), _this]);
+					}
+					this.selected_arr = [];
+					this.selected_arr.push(obj);
+					if(this.selected && this.selected.children("A").hasClass("clicked")) {
+						this.selected.children("A").removeClass("clicked");
+						this.callback("ondeselect", [this.selected.get(0), _this]);
+					}
+				}
+				if(!this.settings.rules.multiple) {
+					if(this.selected) {
+						this.selected.children("A").removeClass("clicked");
+						this.callback("ondeselect", [this.selected.get(0), _this]);
+					}
+				}
+				// SAVE NEWLY SELECTED
+				this.selected = obj;
+				if(this.hovered !== false) {
+					this.hovered.children("A").removeClass("hover");
+					this.hovered = obj;
+				}
+
+				// FOCUS NEW NODE AND OPEN ALL PARENT NODES IF CLOSED
+				this.selected.children("a").addClass("clicked").end().parents("li.closed").each( function () { _this.open_branch(this, true); });
+
+				// SCROLL SELECTED NODE INTO VIEW
+				this.scroll_into_view(this.selected);
+
+				this.callback("onselect", [this.selected.get(0), _this]);
+				this.callback("onchange", [this.selected.get(0), _this]);
+			},
+			deselect_branch : function (obj) {
+				if(this.locked) return this.error("LOCKED");
+				var _this = this;
+				var obj = this.get_node(obj);
+				if(obj.children("a.clicked").size() == 0) return this.error("DESELECT: NODE NOT SELECTED");
+
+				obj.children("a").removeClass("clicked");
+				this.callback("ondeselect", [obj.get(0), _this]);
+				if(this.settings.rules.multiple != false && this.selected_arr.length > 1) {
+					this.selected_arr = [];
+					this.container.find("a.clicked").filter(":first-child").parent().each(function () {
+						_this.selected_arr.push($(this));
+					});
+					if(obj.get(0) == this.selected.get(0)) {
+						this.selected = this.selected_arr[0];
+					}
+				}
+				else {
+					if(this.settings.rules.multiple != false) this.selected_arr = [];
+					this.selected = false;
+				}
+				this.callback("onchange", [obj.get(0), _this]);
+			},
+			toggle_branch : function (obj) {
+				if(this.locked) return this.error("LOCKED");
+				var obj = this.get_node(obj);
+				if(obj.hasClass("closed"))	return this.open_branch(obj);
+				if(obj.hasClass("open"))	return this.close_branch(obj); 
+			},
+			open_branch : function (obj, disable_animation, callback) {
+				var _this = this;
+
+				if(this.locked) return this.error("LOCKED");
+				var obj = this.get_node(obj);
+				if(!obj.size()) return this.error("OPEN: NO SUCH NODE");
+				if(obj.hasClass("leaf")) return this.error("OPEN: OPENING LEAF NODE");
+				if(this.settings.data.async && obj.find("li").size() == 0) {
+					
+					if(this.callback("beforeopen",[obj.get(0),this]) === false) return this.error("OPEN: STOPPED BY USER");
+
+					obj.children("ul:eq(0)").remove().end().append("<ul><li class='last'><a class='loading' href='#'><ins>&nbsp;</ins>" + (_this.settings.lang.loading || "Loading ...") + "</a></li></ul>");
+					obj.removeClass("closed").addClass("open");
+
+					var _datastore = new $.tree.datastores[this.settings.data.type]();
+					_datastore.load(this.callback("beforedata",[obj,this]),this,this.settings.data.opts,function(data){
+						data = _this.callback("ondata", [data, _this]);
+						if(!data || data.length == 0) {
+							obj.removeClass("closed").removeClass("open").addClass("leaf").children("ul").remove();
+							if(callback) callback.call();
+							return;
+						}
+						_datastore.parse(data,_this,_this.settings.data.opts,function(str){
+							str = _this.callback("onparse", [str, _this]);
+							// if(obj.children('ul:eq(0)').children('li').size() > 1) obj.children("ul").find('.loaading').parent().replaceWith(str); else 
+							obj.children("ul:eq(0)").replaceWith($("<ul>").html(str));
+							obj.find("li:last-child").addClass("last").end().find("li:has(ul)").not(".open").addClass("closed");
+							obj.find("li").not(".open").not(".closed").addClass("leaf");
+							_this.open_branch.apply(_this, [obj]);
+							if(callback) callback.call();
+						});
+					});
+					return true;
+				}
+				else {
+					if(!this.settings.data.async) {
+						if(this.callback("beforeopen",[obj.get(0),this]) === false) return this.error("OPEN: STOPPED BY USER");
+					}
+					if(parseInt(this.settings.ui.animation) > 0 && !disable_animation ) {
+						obj.children("ul:eq(0)").css("display","none");
+						obj.removeClass("closed").addClass("open");
+						obj.children("ul:eq(0)").slideDown(parseInt(this.settings.ui.animation), function() {
+							$(this).css("display","");
+							if(callback) callback.call();
+						});
+					} else {
+						obj.removeClass("closed").addClass("open");
+						if(callback) callback.call();
+					}
+					this.callback("onopen", [obj.get(0), this]);
+					return true;
+				}
+			},
+			close_branch : function (obj, disable_animation) {
+				if(this.locked) return this.error("LOCKED");
+				var _this = this;
+				var obj = this.get_node(obj);
+				if(!obj.size()) return this.error("CLOSE: NO SUCH NODE");
+				if(_this.callback("beforeclose",[obj.get(0),_this]) === false) return this.error("CLOSE: STOPPED BY USER");
+				if(parseInt(this.settings.ui.animation) > 0 && !disable_animation && obj.children("ul:eq(0)").size() == 1) {
+					obj.children("ul:eq(0)").slideUp(parseInt(this.settings.ui.animation), function() {
+						if(obj.hasClass("open")) obj.removeClass("open").addClass("closed");
+						$(this).css("display","");
+					});
+				} 
+				else {
+					if(obj.hasClass("open")) obj.removeClass("open").addClass("closed");
+				}
+				if(this.selected && this.settings.ui.selected_parent_close !== false && obj.children("ul:eq(0)").find("a.clicked").size() > 0) {
+					obj.find("li:has(a.clicked)").each(function() {
+						_this.deselect_branch(this);
+					});
+					if(this.settings.ui.selected_parent_close == "select_parent" && obj.children("a.clicked").size() == 0) this.select_branch(obj, (this.settings.rules.multiple != false && this.selected_arr.length > 0) );
+				}
+				this.callback("onclose", [obj.get(0), this]);
+			},
+			open_all : function (obj, callback) {
+				if(this.locked) return this.error("LOCKED");
+				var _this = this;
+				obj = obj ? this.get_node(obj) : this.container;
+
+				var s = obj.find("li.closed").size();
+				if(!callback)	this.cl_count = 0;
+				else			this.cl_count --;
+				if(s > 0) {
+					this.cl_count += s;
+					// maybe add .andSelf()
+					obj.find("li.closed").each( function () { var __this = this; _this.open_branch.apply(_this, [this, true, function() { _this.open_all.apply(_this, [__this, true]); } ]); });
+				}
+				else if(this.cl_count == 0) this.callback("onopen_all",[this]);
+			},
+			close_all : function (obj) {
+				if(this.locked) return this.error("LOCKED");
+				var _this = this;
+				obj = obj ? this.get_node(obj) : this.container;
+				// maybe add .andSelf()
+				obj.find("li.open").each( function () { _this.close_branch(this, true); });
+				this.callback("onclose_all",[this]);
+			},
+
+			set_lang : function (i) { 
+				if(!$.isArray(this.settings.languages) || this.settings.languages.length == 0) return false;
+				if(this.locked) return this.error("LOCKED");
+				if(!$.inArray(i,this.settings.languages) && typeof this.settings.languages[i] != "undefined") i = this.settings.languages[i];
+				if(typeof i == "undefined") return false;
+				if(i == this.current_lang) return true;
+				var st = false;
+				var id = "#" + this.container.attr("id");
+				st = tree_component.get_css(id + " ." + this.current_lang);
+				if(st !== false) st.style.display = "none";
+				st = tree_component.get_css(id + " ." + i);
+				if(st !== false) st.style.display = "";
+				this.current_lang = i;
+				return true;
+			},
+			get_lang : function () {
+				if(!$.isArray(this.settings.languages) || this.settings.languages.length == 0) return false;
+				return this.current_lang;
+			},
+
+			create : function (obj, ref_node, position) { 
+				if(this.locked) return this.error("LOCKED");
+				
+				var root = false;
+				if(ref_node == -1) { root = true; ref_node = this.container; }
+				else ref_node = ref_node ? this.get_node(ref_node) : this.selected;
+
+				if(!root && (!ref_node || !ref_node.size())) return this.error("CREATE: NO NODE SELECTED");
+
+				var pos = position;
+
+				var tmp = ref_node; // for type calculation
+				if(position == "before") {
+					position = ref_node.parent().children().index(ref_node);
+					ref_node = ref_node.parents("li:eq(0)");
+				}
+				if(position == "after") {
+					position = ref_node.parent().children().index(ref_node) + 1;
+					ref_node = ref_node.parents("li:eq(0)");
+				}
+				if(!root && ref_node.size() == 0) { root = true; ref_node = this.container; }
+
+				if(!root) {
+					if(!this.check("creatable", ref_node)) return this.error("CREATE: CANNOT CREATE IN NODE");
+					if(ref_node.hasClass("closed")) {
+						if(this.settings.data.async && ref_node.children("ul").size() == 0) {
+							var _this = this;
+							return this.open_branch(ref_node, true, function () { _this.create.apply(_this, [obj, ref_node, position]); } );
+						}
+						else this.open_branch(ref_node, true);
+					}
+				}
+
+				// creating new object to pass to parseJSON
+				var torename = false; 
+				if(!obj)	obj = {};
+				else		obj = $.extend(true, {}, obj);
+				if(!obj.attributes) obj.attributes = {};
+				if(!obj.attributes[this.settings.rules.type_attr]) obj.attributes[this.settings.rules.type_attr] = this.get_type(tmp) || "default";
+				if(this.settings.languages.length) {
+					if(!obj.data) { obj.data = {}; torename = true; }
+					for(var i = 0; i < this.settings.languages.length; i++) {
+						if(!obj.data[this.settings.languages[i]]) obj.data[this.settings.languages[i]] = ((typeof this.settings.lang.new_node).toLowerCase() != "string" && this.settings.lang.new_node[i]) ? this.settings.lang.new_node[i] : this.settings.lang.new_node;
+					}
+				}
+				else {
+					if(!obj.data) { obj.data = this.settings.lang.new_node; torename = true; }
+				}
+
+				obj = this.callback("ondata",[obj, this]);
+				var obj_s = $.tree.datastores.json().parse(obj,this);
+				obj_s = this.callback("onparse", [obj_s, this]);
+				var $li = $(obj_s);
+
+				if($li.children("ul").size()) {
+					if(!$li.is(".open")) $li.addClass("closed");
+				}
+				else $li.addClass("leaf");
+				$li.find("li:last-child").addClass("last").end().find("li:has(ul)").not(".open").addClass("closed");
+				$li.find("li").not(".open").not(".closed").addClass("leaf");
+
+				var r = {
+					max_depth : this.settings.rules.use_max_depth ? this.check("max_depth", (root ? -1 : ref_node) ) : -1,
+					max_children : this.settings.rules.use_max_children ? this.check("max_children", (root ? -1 : ref_node) ) : -1,
+					valid_children : this.check("valid_children", (root ? -1 : ref_node) )
+				};
+				var nod_type = this.get_type($li);
+				if(typeof r.valid_children != "undefined" && (r.valid_children == "none" || ($.isArray(r.valid_children) && $.inArray(nod_type, r.valid_children) == -1))) return this.error("CREATE: NODE NOT A VALID CHILD");
+
+				if(this.settings.rules.use_max_children) {
+					if(typeof r.max_children != "undefined" && r.max_children != -1 && r.max_children >= this.children(ref_node).size()) return this.error("CREATE: MAX_CHILDREN REACHED");
+				}
+
+				if(this.settings.rules.use_max_depth) {
+					if(typeof r.max_depth != "undefined" && r.max_depth === 0) return this.error("CREATE: MAX-DEPTH REACHED");
+					// check for max_depth up the chain
+					var mx = (r.max_depth > 0) ? r.max_depth : false;
+					var i = 0;
+					var t = ref_node;
+
+					while(t !== -1 && !root) {
+						t = this.parent(t);
+						i ++;
+						var m = this.check("max_depth",t);
+						if(m >= 0) {
+							mx = (mx === false) ? (m - i) : Math.min(mx, m - i);
+						}
+						if(mx !== false && mx <= 0) return this.error("CREATE: MAX-DEPTH REACHED");
+					}
+					if(mx !== false && mx <= 0) return this.error("CREATE: MAX-DEPTH REACHED");
+					if(mx !== false) { 
+						var incr = 1;
+						var t = $li;
+						while(t.size() > 0) {
+							if(mx - incr < 0) return this.error("CREATE: MAX-DEPTH REACHED");
+							t = t.children("ul").children("li");
+							incr ++;
+						}
+					}
+				}
+
+				if((typeof position).toLowerCase() == "undefined" || position == "inside") 
+					position = (this.settings.rules.createat == "top") ? 0 : ref_node.children("ul:eq(0)").children("li").size();
+				if(ref_node.children("ul").size() == 0 || (root == true && ref_node.children("ul").children("li").size() == 0) ) {
+					if(!root)	var a = this.moved($li,ref_node.children("a:eq(0)"),"inside", true);
+					else		var a = this.moved($li,this.container.children("ul:eq(0)"),"inside", true);
+				}
+				else if(pos == "before" && ref_node.children("ul:eq(0)").children("li:nth-child(" + (position + 1) + ")").size())
+					var a = this.moved($li,ref_node.children("ul:eq(0)").children("li:nth-child(" + (position + 1) + ")").children("a:eq(0)"),"before", true);
+				else if(pos == "after" &&  ref_node.children("ul:eq(0)").children("li:nth-child(" + (position) + ")").size())
+					var a = this.moved($li,ref_node.children("ul:eq(0)").children("li:nth-child(" + (position) + ")").children("a:eq(0)"),"after", true);
+				else if(ref_node.children("ul:eq(0)").children("li:nth-child(" + (position + 1) + ")").size())
+					var a = this.moved($li,ref_node.children("ul:eq(0)").children("li:nth-child(" + (position + 1) + ")").children("a:eq(0)"),"before", true);
+				else
+					var a = this.moved($li,ref_node.children("ul:eq(0)").children("li:last").children("a:eq(0)"),"after",true);
+
+				if(a === false) return this.error("CREATE: ABORTED");
+
+				if(torename) {
+					this.select_branch($li.children("a:eq(0)"));
+					this.rename();
+				}
+				return $li;
+			},
+			rename : function (obj, new_name) {
+				if(this.locked) return this.error("LOCKED");
+				obj = obj ? this.get_node(obj) : this.selected;
+				var _this = this;
+				if(!obj || !obj.size()) return this.error("RENAME: NO NODE SELECTED");
+				if(!this.check("renameable", obj)) return this.error("RENAME: NODE NOT RENAMABLE");
+				if(!this.callback("beforerename",[obj.get(0), _this.current_lang, _this])) return this.error("RENAME: STOPPED BY USER");
+
+				obj.parents("li.closed").each(function () { _this.open_branch(this) });
+				if(this.current_lang)	obj = obj.find("a." + this.current_lang);
+				else					obj = obj.find("a:first");
+
+				// Rollback
+				var rb = {}; 
+				rb[this.container.attr("id")] = this.get_rollback();
+
+				var icn = obj.children("ins").clone();
+				if((typeof new_name).toLowerCase() == "string") {
+					obj.text(new_name).prepend(icn);
+					_this.callback("onrename", [_this.get_node(obj).get(0), _this, rb]);
+				}
+				else {
+					var last_value = "";
+					obj.contents().each(function () {
+						if(this.nodeType == 3) { last_value = this.data; return false; }
+					});
+					_this.inp = $("<input type='text' autocomplete='off' />");
+					_this.inp
+						.val(last_value.replace(/&amp;/g,"&").replace(/&gt;/g,">").replace(/&lt;/g,"<"))
+						.bind("mousedown",		function (event) { event.stopPropagation(); })
+						.bind("mouseup",		function (event) { event.stopPropagation(); })
+						.bind("click",			function (event) { event.stopPropagation(); })
+						.bind("keyup",			function (event) { 
+								var key = event.keyCode || event.which;
+								if(key == 27) { this.value = last_value; this.blur(); return }
+								if(key == 13) { this.blur(); return; }
+							});
+					_this.inp.blur(function(event) {
+							if(this.value == "") this.value = last_value; 
+							obj.text(this.value).prepend(icn);
+							obj.get(0).style.display = ""; 
+							obj.prevAll("span").remove(); 
+							_this.inp = false;
+							_this.callback("onrename", [_this.get_node(obj).get(0), _this, rb]);
+						});
+
+					var spn = $("<span />").addClass(obj.attr("class")).append(icn).append(_this.inp);
+					obj.get(0).style.display = "none";
+					obj.parent().prepend(spn);
+					_this.inp.get(0).focus();
+					_this.inp.get(0).select();
+				}
+			},
+			remove : function(obj) {
+				if(this.locked) return this.error("LOCKED");
+				var _this = this;
+
+				// Rollback
+				var rb = {}; 
+				rb[this.container.attr("id")] = this.get_rollback();
+
+				if(obj && (!this.selected || this.get_node(obj).get(0) != this.selected.get(0) )) {
+					obj = this.get_node(obj);
+					if(obj.size()) {
+						if(!this.check("deletable", obj)) return this.error("DELETE: NODE NOT DELETABLE");
+						if(!this.callback("beforedelete",[obj.get(0), _this])) return this.error("DELETE: STOPPED BY USER");
+						$parent = obj.parent();
+						if(obj.find("a.clicked").size()) {
+							var reset_selected = false;
+							_this.selected_arr = [];
+							this.container.find("a.clicked").filter(":first-child").parent().each(function () {
+								if(!reset_selected && this == _this.selected.get(0)) reset_selected = true;
+								if($(this).parents().index(obj) != -1) return true;
+								_this.selected_arr.push($(this));
+							});
+							if(reset_selected) this.selected = this.selected_arr[0] || false;
+						}
+						obj = obj.remove();
+						$parent.children("li:last").addClass("last");
+						if($parent.children("li").size() == 0) {
+							$li = $parent.parents("li:eq(0)");
+							$li.removeClass("open").removeClass("closed").addClass("leaf").children("ul").remove();
+						}
+						this.callback("ondelete", [obj.get(0), this, rb]);
+					}
+				}
+				else if(this.selected) {
+					if(!this.check("deletable", this.selected)) return this.error("DELETE: NODE NOT DELETABLE");
+					if(!this.callback("beforedelete",[this.selected.get(0), _this])) return this.error("DELETE: STOPPED BY USER");
+					$parent = this.selected.parent();
+					var obj = this.selected;
+					if(this.settings.rules.multiple == false || this.selected_arr.length == 1) {
+						var stop = true;
+						var tmp = this.settings.ui.selected_delete == "select_previous" ? this.prev(this.selected) : false;
+					}
+					obj = obj.remove();
+					$parent.children("li:last").addClass("last");
+					if($parent.children("li").size() == 0) {
+						$li = $parent.parents("li:eq(0)");
+						$li.removeClass("open").removeClass("closed").addClass("leaf").children("ul").remove();
+					}
+					if(!stop && this.settings.rules.multiple != false) {
+						var _this = this;
+						this.selected_arr = [];
+						this.container.find("a.clicked").filter(":first-child").parent().each(function () {
+							_this.selected_arr.push($(this));
+						});
+						if(this.selected_arr.length > 0) {
+							this.selected = this.selected_arr[0];
+							this.remove();
+						}
+					}
+					if(stop && tmp) this.select_branch(tmp); 
+					this.callback("ondelete", [obj.get(0), this, rb]);
+				}
+				else return this.error("DELETE: NO NODE SELECTED");
+			},
+
+			next : function (obj, strict) {
+				obj = this.get_node(obj);
+				if(!obj.size()) return false;
+				if(strict) return (obj.nextAll("li").size() > 0) ? obj.nextAll("li:eq(0)") : false;
+
+				if(obj.hasClass("open")) return obj.find("li:eq(0)");
+				else if(obj.nextAll("li").size() > 0) return obj.nextAll("li:eq(0)");
+				else return obj.parents("li").next("li").eq(0);
+			},
+			prev : function(obj, strict) {
+				obj = this.get_node(obj);
+				if(!obj.size()) return false;
+				if(strict) return (obj.prevAll("li").size() > 0) ? obj.prevAll("li:eq(0)") : false;
+
+				if(obj.prev("li").size()) {
+					var obj = obj.prev("li").eq(0);
+					while(obj.hasClass("open")) obj = obj.children("ul:eq(0)").children("li:last");
+					return obj;
+				}
+				else return obj.parents("li:eq(0)").size() ? obj.parents("li:eq(0)") : false;
+			},
+			parent : function(obj) {
+				obj = this.get_node(obj);
+				if(!obj.size()) return false;
+				return obj.parents("li:eq(0)").size() ? obj.parents("li:eq(0)") : -1;
+			},
+			children : function(obj) {
+				if(obj === -1) return this.container.children("ul:eq(0)").children("li");
+
+				obj = this.get_node(obj);
+				if(!obj.size()) return false;
+				return obj.children("ul:eq(0)").children("li");
+			},
+
+			toggle_dots : function () {
+				if(this.settings.ui.dots) {
+					this.settings.ui.dots = false;
+					this.container.children("ul:eq(0)").addClass("no_dots");
+				}
+				else {
+					this.settings.ui.dots = true;
+					this.container.children("ul:eq(0)").removeClass("no_dots");
+				}
+			},
+
+			callback : function (cb, args) {
+				var p = false;
+				var r = null;
+				for(var i in this.settings.plugins) {
+					if(typeof $.tree.plugins[i] != "object") continue;
+					p = $.tree.plugins[i];
+					if(p.callbacks && typeof p.callbacks[cb] == "function") r = p.callbacks[cb].apply(this, args);
+					if(typeof r !== "undefined" && r !== null) {
+						if(cb == "ondata" || cb == "onparse") args[0] = r; // keep the chain if data or parse
+						else return r;
+					}
+				}
+				p = this.settings.callback[cb];
+				if(typeof p == "function") return p.apply(null, args);
+			},
+			get_rollback : function () {
+				var rb = {};
+				rb.html = this.container.html();
+				rb.selected = this.selected ? this.selected.attr("id") : false;
+				return rb;
+			},
+			moved : function (what, where, how, is_new, is_copy, rb) {
+				var what	= $(what);
+				var $parent	= $(what).parents("ul:eq(0)");
+				var $where	= $(where);
+				if($where.is("ins")) $where = $where.parent();
+
+				// Rollback
+				if(!rb) {
+					var rb = {}; 
+					rb[this.container.attr("id")] = this.get_rollback();
+					if(!is_new) {
+						var tmp = what.size() > 1 ? what.eq(0).parents(".tree:eq(0)") : what.parents(".tree:eq(0)");
+						if(tmp.get(0) != this.container.get(0)) {
+							tmp = tree_component.inst[tmp.attr("id")];
+							rb[tmp.container.attr("id")] = tmp.get_rollback();
+						}
+						delete tmp;
+					}
+				}
+
+				if(how == "inside" && this.settings.data.async) {
+					var _this = this;
+					if(this.get_node($where).hasClass("closed")) {
+						return this.open_branch(this.get_node($where), true, function () { _this.moved.apply(_this, [what, where, how, is_new, is_copy, rb]); });
+					}
+					if(this.get_node($where).find("> ul > li > a.loading").size() == 1) {
+						setTimeout(function () { _this.moved.apply(_this, [what, where, how, is_new, is_copy]); }, 200);
+						return;
+					}
+				}
+
+
+				// IF MULTIPLE
+				if(what.size() > 1) {
+					var _this = this;
+					var tmp = this.moved(what.eq(0), where, how, false, is_copy, rb);
+					what.each(function (i) {
+						if(i == 0) return;
+						if(tmp) { // if tmp is false - the previous move was a no-go
+							tmp = _this.moved(this, tmp.children("a:eq(0)"), "after", false, is_copy, rb);
+						}
+					});
+					return what;
+				}
+
+				if(is_copy) {
+					_what = what.clone();
+					_what.each(function (i) {
+						this.id = this.id + "_copy";
+						$(this).find("li").each(function () {
+							this.id = this.id + "_copy";
+						});
+						$(this).removeClass("dragged").find("a.clicked").removeClass("clicked").end().find("li.dragged").removeClass("dragged");
+					});
+				}
+				else _what = what;
+				if(is_new) {
+					if(!this.callback("beforecreate", [this.get_node(what).get(0), this.get_node(where).get(0),how,this])) return false;
+				}
+				else {
+					if(!this.callback("beforemove", [this.get_node(what).get(0), this.get_node(where).get(0),how,this])) return false;
+				}
+
+				if(!is_new) {
+					var tmp = what.parents(".tree:eq(0)");
+					// if different trees
+					if(tmp.get(0) != this.container.get(0)) {
+						tmp = tree_component.inst[tmp.attr("id")];
+
+						// if there are languages - otherwise - no cleanup needed
+						if(tmp.settings.languages.length) {
+							var res = [];
+							// if new tree has no languages - use current visible
+							if(this.settings.languages.length == 0) res.push("." + tmp.current_lang);
+							else {
+								for(var i in this.settings.languages) {
+									if(!this.settings.languages.hasOwnProperty(i)) continue;
+									for(var j in tmp.settings.languages) {
+										if(!tmp.settings.languages.hasOwnProperty(j)) continue;
+										if(this.settings.languages[i] == tmp.settings.languages[j]) res.push("." + this.settings.languages[i]);
+									}
+								}
+							}
+							if(res.length == 0) return this.error("MOVE: NO COMMON LANGUAGES");
+							_what.find("a").not(res.join(",")).remove();
+						}
+						_what.find("a.clicked").removeClass("clicked");
+					}
+				}
+				what = _what;
+
+				// ADD NODE TO NEW PLACE
+				switch(how) {
+					case "before":
+						$where.parents("ul:eq(0)").children("li.last").removeClass("last");
+						$where.parent().before(what.removeClass("last"));
+						$where.parents("ul:eq(0)").children("li:last").addClass("last");
+						break;
+					case "after":
+						$where.parents("ul:eq(0)").children("li.last").removeClass("last");
+						$where.parent().after(what.removeClass("last"));
+						$where.parents("ul:eq(0)").children("li:last").addClass("last");
+						break;
+					case "inside":
+						if($where.parent().children("ul:first").size()) {
+							if(this.settings.rules.createat == "top") {
+								$where.parent().children("ul:first").prepend(what.removeClass("last")).children("li:last").addClass("last");
+
+								// restored this section
+								var tmp_node = $where.parent().children("ul:first").children("li:first");
+								if(tmp_node.size()) {
+									how = "before";
+									where = tmp_node;
+								}
+							}
+							else {
+								// restored this section
+								var tmp_node = $where.parent().children("ul:first").children(".last");
+								if(tmp_node.size()) {
+									how = "after";
+									where = tmp_node;
+								}
+
+								$where.parent().children("ul:first").children(".last").removeClass("last").end().append(what.removeClass("last")).children("li:last").addClass("last");
+							}
+						}
+						else {
+							what.addClass("last");
+							$where.parent().removeClass("leaf").append("<ul/>");
+							if(!$where.parent().hasClass("open")) $where.parent().addClass("closed");
+							$where.parent().children("ul:first").prepend(what);
+						}
+						if($where.parent().hasClass("closed")) { this.open_branch($where); }
+						break;
+					default:
+						break;
+				}
+				// CLEANUP OLD PARENT
+				if($parent.find("li").size() == 0) {
+					var $li = $parent.parent();
+					$li.removeClass("open").removeClass("closed").addClass("leaf");
+					if(!$li.is(".tree")) $li.children("ul").remove();
+					$li.parents("ul:eq(0)").children("li.last").removeClass("last").end().children("li:last").addClass("last");
+				}
+				else {
+					$parent.children("li.last").removeClass("last");
+					$parent.children("li:last").addClass("last");
+				}
+
+				// NO LONGER CORRECT WITH position PARAM - if(is_new && how != "inside") where = this.get_node(where).parents("li:eq(0)");
+				if(is_copy)		this.callback("oncopy", [this.get_node(what).get(0), this.get_node(where).get(0), how, this, rb]);
+				else if(is_new)	this.callback("oncreate", [this.get_node(what).get(0), ($where.is("ul") ? -1 : this.get_node(where).get(0) ), how, this, rb]);
+				else			this.callback("onmove", [this.get_node(what).get(0), this.get_node(where).get(0), how, this, rb]);
+				return what;
+			},
+			error : function (code) {
+				this.callback("error",[code,this]);
+				return false;
+			},
+			lock : function (state) {
+				this.locked = state;
+				if(this.locked)	this.container.children("ul:eq(0)").addClass("locked");
+				else			this.container.children("ul:eq(0)").removeClass("locked");
+			},
+			cut : function (obj) {
+				if(this.locked) return this.error("LOCKED");
+				obj = obj ? this.get_node(obj) : this.container.find("a.clicked").filter(":first-child").parent();
+				if(!obj || !obj.size()) return this.error("CUT: NO NODE SELECTED");
+				tree_component.cut_copy.copy_nodes = false;
+				tree_component.cut_copy.cut_nodes = obj;
+			},
+			copy : function (obj) {
+				if(this.locked) return this.error("LOCKED");
+				obj = obj ? this.get_node(obj) : this.container.find("a.clicked").filter(":first-child").parent();
+				if(!obj || !obj.size()) return this.error("COPY: NO NODE SELECTED");
+				tree_component.cut_copy.copy_nodes = obj;
+				tree_component.cut_copy.cut_nodes = false;
+			},
+			paste : function (obj, position) {
+				if(this.locked) return this.error("LOCKED");
+
+				var root = false;
+				if(obj == -1) { root = true; obj = this.container; }
+				else obj = obj ? this.get_node(obj) : this.selected;
+
+				if(!root && (!obj || !obj.size())) return this.error("PASTE: NO NODE SELECTED");
+				if(!tree_component.cut_copy.copy_nodes && !tree_component.cut_copy.cut_nodes) return this.error("PASTE: NOTHING TO DO");
+
+				var _this = this;
+
+				var pos = position;
+
+				if(position == "before") {
+					position = obj.parent().children().index(obj);
+					obj = obj.parents("li:eq(0)");
+				}
+				else if(position == "after") {
+					position = obj.parent().children().index(obj) + 1;
+					obj = obj.parents("li:eq(0)");
+				}
+				else if((typeof position).toLowerCase() == "undefined" || position == "inside") {
+					position = (this.settings.rules.createat == "top") ? 0 : obj.children("ul:eq(0)").children("li").size();
+				}
+				if(!root && obj.size() == 0) { root = true; obj = this.container; }
+
+				if(tree_component.cut_copy.copy_nodes && tree_component.cut_copy.copy_nodes.size()) {
+					var ok = true;
+					if(!root && !this.check_move(tree_component.cut_copy.copy_nodes, obj.children("a:eq(0)"), "inside")) return false;
+
+					if(obj.children("ul").size() == 0 || (root == true && obj.children("ul").children("li").size() == 0) ) {
+						if(!root)	var a = this.moved(tree_component.cut_copy.copy_nodes,obj.children("a:eq(0)"),"inside", false, true);
+						else		var a = this.moved(tree_component.cut_copy.copy_nodes,this.container.children("ul:eq(0)"),"inside", false, true);
+					}
+					else if(pos == "before" && obj.children("ul:eq(0)").children("li:nth-child(" + (position + 1) + ")").size())
+						var a = this.moved(tree_component.cut_copy.copy_nodes,obj.children("ul:eq(0)").children("li:nth-child(" + (position + 1) + ")").children("a:eq(0)"),"before", false, true);
+					else if(pos == "after" && obj.children("ul:eq(0)").children("li:nth-child(" + (position) + ")").size())
+						var a = this.moved(tree_component.cut_copy.copy_nodes,obj.children("ul:eq(0)").children("li:nth-child(" + (position) + ")").children("a:eq(0)"),"after", false, true);
+					else if(obj.children("ul:eq(0)").children("li:nth-child(" + (position + 1) + ")").size())
+						var a = this.moved(tree_component.cut_copy.copy_nodes,obj.children("ul:eq(0)").children("li:nth-child(" + (position + 1) + ")").children("a:eq(0)"),"before", false, true);
+					else
+						var a = this.moved(tree_component.cut_copy.copy_nodes,obj.children("ul:eq(0)").children("li:last").children("a:eq(0)"),"after", false, true);
+					tree_component.cut_copy.copy_nodes = false;
+				}
+				if(tree_component.cut_copy.cut_nodes && tree_component.cut_copy.cut_nodes.size()) {
+					var ok = true;
+					obj.parents().andSelf().each(function () {
+						if(tree_component.cut_copy.cut_nodes.index(this) != -1) {
+							ok = false;
+							return false;
+						}
+					});
+					if(!ok) return this.error("Invalid paste");
+					if(!root && !this.check_move(tree_component.cut_copy.cut_nodes, obj.children("a:eq(0)"), "inside")) return false;
+
+					if(obj.children("ul").size() == 0 || (root == true && obj.children("ul").children("li").size() == 0) ) {
+						if(!root)	var a = this.moved(tree_component.cut_copy.cut_nodes,obj.children("a:eq(0)"),"inside");
+						else		var a = this.moved(tree_component.cut_copy.cut_nodes,this.container.children("ul:eq(0)"),"inside");
+					}
+					else if(pos == "before" && obj.children("ul:eq(0)").children("li:nth-child(" + (position + 1) + ")").size())
+						var a = this.moved(tree_component.cut_copy.cut_nodes,obj.children("ul:eq(0)").children("li:nth-child(" + (position + 1) + ")").children("a:eq(0)"),"before");
+					else if(pos == "after" && obj.children("ul:eq(0)").children("li:nth-child(" + (position) + ")").size())
+						var a = this.moved(tree_component.cut_copy.cut_nodes,obj.children("ul:eq(0)").children("li:nth-child(" + (position) + ")").children("a:eq(0)"),"after");
+					else if(obj.children("ul:eq(0)").children("li:nth-child(" + (position + 1) + ")").size())
+						var a = this.moved(tree_component.cut_copy.cut_nodes,obj.children("ul:eq(0)").children("li:nth-child(" + (position + 1) + ")").children("a:eq(0)"),"before");
+					else
+						var a = this.moved(tree_component.cut_copy.cut_nodes,obj.children("ul:eq(0)").children("li:last").children("a:eq(0)"),"after");
+					tree_component.cut_copy.cut_nodes = false;
+				}
+			},
+			search : function(str, func) {
+				var _this = this;
+				if(!str || (this.srch && str != this.srch) ) {
+					this.srch = "";
+					this.srch_opn = false;
+					this.container.find("a.search").removeClass("search");
+				}
+				this.srch = str;
+				if(!str) return;
+
+				if(!func) func = "contains";
+				if(this.settings.data.async) {
+					if(!this.srch_opn) {
+						var dd = $.extend( { "search" : str } , this.callback("beforedata", [false, this] ) );
+						$.ajax({
+							type		: this.settings.data.opts.method,
+							url			: this.settings.data.opts.url, 
+							data		: dd, 
+							dataType	: "text",
+							success		: function (data) {
+								_this.srch_opn = $.unique(data.split(","));
+								_this.search.apply(_this,[str, func]);
+							} 
+						});
+					}
+					else if(this.srch_opn.length) {
+						if(this.srch_opn && this.srch_opn.length) {
+							var opn = false;
+							for(var j = 0; j < this.srch_opn.length; j++) {
+								if(this.get_node("#" + this.srch_opn[j]).size() > 0) {
+									opn = true;
+									var tmp = "#" + this.srch_opn[j];
+									delete this.srch_opn[j];
+									this.open_branch(tmp, true, function () { _this.search.apply(_this,[str, func]); } );
+								}
+							}
+							if(!opn) {
+								this.srch_opn = [];
+								 _this.search.apply(_this,[str, func]);
+							}
+						}
+					}
+					else {
+						this.srch_opn = false;
+						var selector = "a";
+						// IF LANGUAGE VERSIONS
+						if(this.settings.languages.length) selector += "." + this.current_lang;
+						this.callback("onsearch", [this.container.find(selector + ":" + func + "('" + str + "')"), this]);
+					}
+				}
+				else {
+					var selector = "a";
+					// IF LANGUAGE VERSIONS
+					if(this.settings.languages.length) selector += "." + this.current_lang;
+					var nn = this.container.find(selector + ":" + func + "('" + str + "')");
+					nn.parents("li.closed").each( function () { _this.open_branch(this, true); });
+					this.callback("onsearch", [nn, this]);
+				}
+			},
+			add_sheet : tree_component.add_sheet,
+
+			destroy : function() {
+				this.callback("ondestroy", [this]);
+
+				this.container.unbind(".jstree");
+				$("#" + this.container.attr("id")).die("click.jstree").die("dblclick.jstree").die("mouseover.jstree").die("mouseout.jstree").die("mousedown.jstree");
+				this.container.removeClass("tree ui-widget ui-widget-content tree-default tree-" + this.settings.ui.theme_name).children("ul").removeClass("no_dots ltr locked").find("li").removeClass("leaf").removeClass("open").removeClass("closed").removeClass("last").children("a").removeClass("clicked hover search");
+
+				if(this.cntr == tree_component.focused) {
+					for(var i in tree_component.inst) {
+						if(i != this.cntr && i != this.container.attr("id")) {
+							tree_component.inst[i].focus();
+							break;
+						}
+					}
+				}
+
+				tree_component.inst[this.cntr] = false;
+				tree_component.inst[this.container.attr("id")] = false;
+				delete tree_component.inst[this.cntr];
+				delete tree_component.inst[this.container.attr("id")];
+				tree_component.cntr --;
+			}
+		}
+	};
+
+	// instance manager
+	tree_component.cntr = 0;
+	tree_component.inst = {};
+
+	// themes
+	tree_component.themes = [];
+
+	// drag'n'drop stuff
+	tree_component.drag_drop = {
+		isdown		: false,	// Is there a drag
+		drag_node	: false,	// The actual node
+		drag_help	: false,	// The helper
+		dragged		: false,
+
+		init_x		: false,
+		init_y		: false,
+		moving		: false,
+
+		origin_tree	: false,
+		marker		: false,
+
+		move_type	: false,	// before, after or inside
+		ref_node	: false,	// reference node
+		appended	: false,	// is helper appended
+
+		foreign		: false,	// Is the dragged node a foreign one
+		droppable	: [],		// Array of classes that can be dropped onto the tree
+
+		open_time	: false,	// Timeout for opening nodes
+		scroll_time	: false		// Timeout for scrolling
+	};
+	tree_component.mouseup = function(event) {
+		var tmp = tree_component.drag_drop;
+		if(tmp.open_time)	clearTimeout(tmp.open_time);
+		if(tmp.scroll_time)	clearTimeout(tmp.scroll_time);
+
+		if(tmp.moving && $.tree.drag_end !== false) $.tree.drag_end.call(null, event, tmp);
+
+		if(tmp.foreign === false && tmp.drag_node && tmp.drag_node.size()) {
+			tmp.drag_help.remove();
+			if(tmp.move_type) {
+				var tree1 = tree_component.inst[tmp.ref_node.parents(".tree:eq(0)").attr("id")];
+				if(tree1) tree1.moved(tmp.dragged, tmp.ref_node, tmp.move_type, false, (tmp.origin_tree.settings.rules.drag_copy == "on" || (tmp.origin_tree.settings.rules.drag_copy == "ctrl" && event.ctrlKey) ) );
+			}
+			tmp.move_type	= false;
+			tmp.ref_node	= false;
+		}
+		if(tmp.foreign !== false) {
+			if(tmp.drag_help) tmp.drag_help.remove();
+			if(tmp.move_type) {
+				var tree1 = tree_component.inst[tmp.ref_node.parents(".tree:eq(0)").attr("id")];
+				if(tree1) tree1.callback("ondrop",[tmp.f_data, tree1.get_node(tmp.ref_node).get(0), tmp.move_type, tree1]);
+			}
+			tmp.foreign		= false;
+			tmp.move_type	= false;
+			tmp.ref_node	= false;
+		}
+		// RESET EVERYTHING
+		if(tree_component.drag_drop.marker) tree_component.drag_drop.marker.hide();
+		if(tmp.dragged && tmp.dragged.size()) tmp.dragged.removeClass("dragged");
+		tmp.dragged		= false;
+		tmp.drag_help	= false;
+		tmp.drag_node	= false;
+		tmp.f_type		= false;
+		tmp.f_data		= false;
+		tmp.init_x		= false;
+		tmp.init_y		= false;
+		tmp.moving		= false;
+		tmp.appended	= false;
+		tmp.origin_tree	= false;
+		if(tmp.isdown) {
+			tmp.isdown = false;
+			event.preventDefault(); 
+			event.stopPropagation();
+			return false;
+		}
+	};
+	tree_component.mousemove = function(event) {
+		var tmp = tree_component.drag_drop;
+		var is_start = false;
+
+		if(tmp.isdown) {
+			if(!tmp.moving && Math.abs(tmp.init_x - event.pageX) < 5 && Math.abs(tmp.init_y - event.pageY) < 5) {
+				event.preventDefault();
+				event.stopPropagation();
+				return false;
+			}
+			else {
+				if(!tmp.moving) {
+					tree_component.drag_drop.moving = true;
+					is_start = true;
+				}
+			}
+
+			if(tmp.open_time) clearTimeout(tmp.open_time);
+
+			if(tmp.drag_help !== false) {
+				if(!tmp.appended) {
+					if(tmp.foreign !== false) tmp.origin_tree = $.tree.focused();
+					$("body").append(tmp.drag_help);
+					tmp.w = tmp.drag_help.width();
+					tmp.appended = true;
+				}
+				tmp.drag_help.css({ "left" : (event.pageX + 5 ), "top" : (event.pageY + 15) });
+			}
+
+			if(is_start && $.tree.drag_start !== false) $.tree.drag_start.call(null, event, tmp);
+			if($.tree.drag !== false) $.tree.drag.call(null, event, tmp);
+
+			if(event.target.tagName == "DIV" && event.target.id == "jstree-marker") return false;
+
+			var et = $(event.target);
+			if(et.is("ins")) et = et.parent();
+			var cnt = et.is(".tree") ? et : et.parents(".tree:eq(0)");
+
+			// if not moving over a tree
+			if(cnt.size() == 0 || !tree_component.inst[cnt.attr("id")]) {
+				if(tmp.scroll_time) clearTimeout(tmp.scroll_time);
+				if(tmp.drag_help !== false) tmp.drag_help.find("li:eq(0) ins").addClass("forbidden");
+				tmp.move_type	= false;
+				tmp.ref_node	= false;
+				tree_component.drag_drop.marker.hide();
+				return false;
+			}
+
+			var tree2 = tree_component.inst[cnt.attr("id")];
+			tree2.off_height();
+
+			if(tmp.scroll_time) clearTimeout(tmp.scroll_time);
+			tmp.scroll_time = setTimeout( function() { tree2.scroll_check(event.pageX,event.pageY); }, 50);
+
+			var mov = false;
+			var st = cnt.scrollTop();
+
+			if(event.target.tagName == "A" || event.target.tagName == "INS") {
+				// just in case if hover is over the draggable
+				if(et.is("#jstree-dragged")) return false;
+				if(tree2.get_node(event.target).hasClass("closed")) {
+					tmp.open_time = setTimeout( function () { tree2.open_branch(et); }, 500);
+				}
+
+				var et_off = et.offset();
+				var goTo = { 
+					x : (et_off.left - 1),
+					y : (event.pageY - et_off.top)
+				};
+
+				var arr = [];
+				if(goTo.y < tree2.li_height/3 + 1 )			arr = ["before","inside","after"];
+				else if(goTo.y > tree2.li_height*2/3 - 1 )	arr = ["after","inside","before"];
+				else {
+					if(goTo.y < tree2.li_height/2)			arr = ["inside","before","after"];
+					else									arr = ["inside","after","before"];
+				}
+				var ok = false;
+				var nn = (tmp.foreign == false) ? tmp.origin_tree.container.find("li.dragged") : tmp.f_type;
+				$.each(arr, function(i, val) {
+					if(tree2.check_move(nn, et, val)) {
+						mov = val;
+						ok = true;
+						return false;
+					}
+				});
+				if(ok) {
+					switch(mov) {
+						case "before":
+							goTo.y = et_off.top - 2;
+							tree_component.drag_drop.marker.attr("class","marker");
+							break;
+						case "after":
+							goTo.y = et_off.top - 2 + tree2.li_height;
+							tree_component.drag_drop.marker.attr("class","marker");
+							break;
+						case "inside":
+							goTo.x -= 2;
+							goTo.y = et_off.top - 2 + tree2.li_height/2;
+							tree_component.drag_drop.marker.attr("class","marker_plus"); 
+							break;
+					}
+					tmp.move_type	= mov;
+					tmp.ref_node	= $(event.target);
+					if(tmp.drag_help !== false) tmp.drag_help.find(".forbidden").removeClass("forbidden");
+					tree_component.drag_drop.marker.css({ "left" : goTo.x , "top" : goTo.y }).show();
+				}
+			}
+
+			if( (et.is(".tree") || et.is("ul") ) && et.find("li:eq(0)").size() == 0) {
+				var et_off = et.offset();
+				tmp.move_type	= "inside";
+				tmp.ref_node	= cnt.children("ul:eq(0)");
+				if(tmp.drag_help !== false) tmp.drag_help.find(".forbidden").removeClass("forbidden");
+				tree_component.drag_drop.marker.attr("class","marker_plus");
+				tree_component.drag_drop.marker.css({ "left" : (et_off.left + 10) , "top" : et_off.top + 15 }).show();
+			}
+			else if( (event.target.tagName != "A" && event.target.tagName != "INS") || !ok) {
+				if(tmp.drag_help !== false) tmp.drag_help.find("li:eq(0) ins").addClass("forbidden");
+				tmp.move_type	= false;
+				tmp.ref_node	= false;
+				tree_component.drag_drop.marker.hide();
+			}
+			event.preventDefault();
+			event.stopPropagation();
+			return false;
+		}
+		return true;
+	};
+	$(function () { 
+		$(document).bind("mousemove.jstree",	tree_component.mousemove); 
+		$(document).bind("mouseup.jstree",		tree_component.mouseup); 
+	});
+
+	// cut, copy, paste stuff
+	tree_component.cut_copy = { 
+		copy_nodes : false,
+		cut_nodes : false
+	};
+
+	// css stuff
+	tree_component.css = false;
+	tree_component.get_css = function(rule_name, delete_flag) {
+		rule_name = rule_name.toLowerCase();
+		var css_rules = tree_component.css.cssRules || tree_component.css.rules;
+		var j = 0;
+		do {
+			if(css_rules.length && j > css_rules.length + 5) return false;
+			if(css_rules[j].selectorText && css_rules[j].selectorText.toLowerCase() == rule_name) {
+				if(delete_flag == true) {
+					if(tree_component.css.removeRule) document.styleSheets[i].removeRule(j);
+					if(tree_component.css.deleteRule) document.styleSheets[i].deleteRule(j);
+					return true;
+				}
+				else return css_rules[j];
+			}
+		}
+		while (css_rules[++j]);
+		return false;
+	};
+	tree_component.add_css = function(rule_name) {
+		if(tree_component.get_css(rule_name)) return false;
+		(tree_component.css.insertRule) ? tree_component.css.insertRule(rule_name + ' { }', 0) : tree_component.css.addRule(rule_name, null, 0);
+		return tree_component.get_css(rule_name);
+	};
+	tree_component.remove_css = function(rule_name) { 
+		return tree_component.get_css(rule_name, true); 
+	};
+	tree_component.add_sheet = function(opts) {
+		if(opts.str) {
+			var tmp = document.createElement("style");
+			tmp.setAttribute('type',"text/css");
+			if(tmp.styleSheet) {
+				document.getElementsByTagName("head")[0].appendChild(tmp);
+				tmp.styleSheet.cssText = opts.str;
+			}
+			else {
+				tmp.appendChild(document.createTextNode(opts.str));
+				document.getElementsByTagName("head")[0].appendChild(tmp);
+			}
+			return tmp.sheet || tmp.styleSheet;
+		}
+		if(opts.url) {
+			if(document.createStyleSheet) {
+				try { document.createStyleSheet(opts.url); } catch (e) { };
+			}
+			else {
+				var newSS	= document.createElement('link');
+				newSS.rel	= 'stylesheet';
+				newSS.type	= 'text/css';
+				newSS.media	= "all";
+				newSS.href	= opts.url;
+				// var styles	= "@import url(' " + url + " ');";
+				// newSS.href	='data:text/css,'+escape(styles);
+				document.getElementsByTagName("head")[0].appendChild(newSS);
+				return newSS.styleSheet;
+			}
+		}
+	};
+	$(function () {
+		var u = navigator.userAgent.toLowerCase();
+		var v = (u.match( /.+(?:rv|it|ra|ie)[\/: ]([\d.]+)/ ) || [0,'0'])[1];
+
+		var css = '/* TREE LAYOUT */ .tree ul { margin:0 0 0 5px; padding:0 0 0 0; list-style-type:none; } .tree li { display:block; min-height:18px; line-height:18px; padding:0 0 0 15px; margin:0 0 0 0; /* Background fix */ clear:both; } .tree li ul { display:none; } .tree li a, .tree li span { display:inline-block;line-height:16px;height:16px;color:black;white-space:nowrap;text-decoration:none;padding:1px 4px 1px 4px;margin:0; } .tree li a:focus { outline: none; } .tree li a input, .tree li span input { margin:0;padding:0 0;display:inline-block;height:12px !important;border:1px solid white;background:white;font-size:10px;font-family:Verdana; } .tree li a input:not([class="xxx"]), .tree li span input:not([class="xxx"]) { padding:1px 0; } /* FOR DOTS */ .tree .ltr li.last { float:left; } .tree > ul li.last { overflow:visible; } /* OPEN OR CLOSE */ .tree li.open ul { display:block; } .tree li.closed ul { display:none !important; } /* FOR DRAGGING */ #jstree-dragged { position:absolute; top:-10px; left:-10px; margin:0; padding:0; } #jstree-dragged ul ul ul { display:none; } #jstree-marker { padding:0; margin:0; line-height:5px; font-size:1px; overflow:hidden; height:5px; position:absolute; left:-45px; top:-30px; z-index:1000; background-color:transparent; background-repeat:no-repeat; display:none; } #jstree-marker.marker { width:45px; background-position:-32px top; } #jstree-marker.marker_plus { width:5px; background-position:right top; } /* BACKGROUND DOTS */ .tree li li { overflow:hidden; } .tree > .ltr > li { display:table; } /* ICONS */ .tree ul ins { display:inline-block; text-decoration:none; width:16px; height:16px; } .tree .ltr ins { margin:0 4px 0 0px; } ';
+		if($.browser.msie) { 
+			if($.browser.version == 6) css += '.tree li { height:18px; zoom:1; } .tree li li { overflow:visible; } .tree .ltr li.last { margin-top: expression( (this.previousSibling && /open/.test(this.previousSibling.className) ) ? "-2px" : "0"); } .marker { width:45px; background-position:-32px top; } .marker_plus { width:5px; background-position:right top; }';
+			if($.browser.version == 7) css += '.tree li li { overflow:visible; } .tree .ltr li.last { margin-top: expression( (this.previousSibling && /open/.test(this.previousSibling.className) ) ? "-2px" : "0"); }';
+		}
+		if($.browser.opera) css += '.tree > ul > li.last:after { content:"."; display: block; height:1px; clear:both; visibility:hidden; }';
+		if($.browser.mozilla && $.browser.version.indexOf("1.8") == 0) css += '.tree .ltr li a { display:inline; float:left; } .tree li ul { clear:both; }';
+		tree_component.css = tree_component.add_sheet({ str : css });
+	});
+})(jQuery);
+
+// Datastores
+// HTML and JSON are included here by default
+(function ($) {
+	$.extend($.tree.datastores, {
+		"html" : function () {
+			return {
+				get		: function(obj, tree, opts) {
+					return obj && $(obj).size() ? $('<div>').append(tree.get_node(obj).clone()).html() : tree.container.children("ul:eq(0)").html();
+				},
+				parse	: function(data, tree, opts, callback) {
+					if(callback) callback.call(null, data);
+					return data;
+				},
+				load	: function(data, tree, opts, callback) {
+					if(opts.url) {
+						$.ajax({
+							'type'		: opts.method,
+							'url'		: opts.url, 
+							'data'		: data, 
+							'dataType'	: "html",
+							'success'	: function (d, textStatus) {
+								callback.call(null, d);
+							},
+							'error'		: function (xhttp, textStatus, errorThrown) { 
+								callback.call(null, false);
+								tree.error(errorThrown + " " + textStatus); 
+							}
+						});
+					}
+					else {
+						callback.call(null, opts.static || tree.container.children("ul:eq(0)").html());
+					}
+				}
+			};
+		},
+		"json" : function () {
+			return {
+				get		: function(obj, tree, opts) { 
+					var _this = this;
+					if(!obj || $(obj).size() == 0) obj = tree.container.children("ul").children("li");
+					else obj = $(obj);
+
+					if(!opts) opts = {};
+					if(!opts.outer_attrib) opts.outer_attrib = [ "id", "rel", "class" ];
+					if(!opts.inner_attrib) opts.inner_attrib = [ ];
+
+					if(obj.size() > 1) {
+						var arr = [];
+						obj.each(function () {
+							arr.push(_this.get(this, tree, opts));
+						});
+						return arr;
+					}
+					if(obj.size() == 0) return [];
+
+					var json = { attributes : {}, data : {} };
+					if(obj.hasClass("open")) json.data.state = "open";
+					if(obj.hasClass("closed")) json.data.state = "closed";
+
+					for(var i in opts.outer_attrib) {
+						if(!opts.outer_attrib.hasOwnProperty(i)) continue;
+						var val = (opts.outer_attrib[i] == "class") ? obj.attr(opts.outer_attrib[i]).replace(/(^| )last( |$)/ig," ").replace(/(^| )(leaf|closed|open)( |$)/ig," ") : obj.attr(opts.outer_attrib[i]);
+						if(typeof val != "undefined" && val.toString().replace(" ","").length > 0) json.attributes[opts.outer_attrib[i]] = val;
+						delete val;
+					}
+					
+					if(tree.settings.languages.length) {
+						for(var i in tree.settings.languages) {
+							if(!tree.settings.languages.hasOwnProperty(i)) continue;
+							var a = obj.children("a." + tree.settings.languages[i]);
+							if(opts.force || opts.inner_attrib.length || a.children("ins").get(0).style.backgroundImage.toString().length || a.children("ins").get(0).className.length) {
+								json.data[tree.settings.languages[i]] = {};
+								json.data[tree.settings.languages[i]].title = tree.get_text(obj,tree.settings.languages[i]);
+								if(a.children("ins").get(0).style.className.length) {
+									json.data[tree.settings.languages[i]].icon = a.children("ins").get(0).style.className;
+								}
+								if(a.children("ins").get(0).style.backgroundImage.length) {
+									json.data[tree.settings.languages[i]].icon = a.children("ins").get(0).style.backgroundImage.replace("url(","").replace(")","");
+								}
+								if(opts.inner_attrib.length) {
+									json.data[tree.settings.languages[i]].attributes = {};
+									for(var j in opts.inner_attrib) {
+										if(!opts.inner_attrib.hasOwnProperty(j)) continue;
+										var val = a.attr(opts.inner_attrib[j]);
+										if(typeof val != "undefined" && val.toString().replace(" ","").length > 0) json.data[tree.settings.languages[i]].attributes[opts.inner_attrib[j]] = val;
+										delete val;
+									}
+								}
+							}
+							else {
+								json.data[tree.settings.languages[i]] = tree.get_text(obj,tree.settings.languages[i]);
+							}
+						}
+					}
+					else {
+						var a = obj.children("a");
+						json.data.title = tree.get_text(obj);
+
+						if(a.children("ins").size() && a.children("ins").get(0).className.length) {
+							json.data.icon = a.children("ins").get(0).className;
+						}
+						if(a.children("ins").size() && a.children("ins").get(0).style.backgroundImage.length) {
+							json.data.icon = a.children("ins").get(0).style.backgroundImage.replace("url(","").replace(")","");
+						}
+
+						if(opts.inner_attrib.length) {
+							json.data.attributes = {};
+							for(var j in opts.inner_attrib) {
+								if(!opts.inner_attrib.hasOwnProperty(j)) continue;
+								var val = a.attr(opts.inner_attrib[j]);
+								if(typeof val != "undefined" && val.toString().replace(" ","").length > 0) json.data.attributes[opts.inner_attrib[j]] = val;
+								delete val;
+							}
+						}
+					}
+
+					if(obj.children("ul").size() > 0) {
+						json.children = [];
+						obj.children("ul").children("li").each(function () {
+							json.children.push(_this.get(this, tree, opts));
+						});
+					}
+					return json;
+				},
+				parse	: function(data, tree, opts, callback) { 
+					if(Object.prototype.toString.apply(data) === "[object Array]") {
+						var str = '';
+						for(var i = 0; i < data.length; i ++) {
+							if(typeof data[i] == "function") continue;
+							str += this.parse(data[i], tree, opts);
+						}
+						if(callback) callback.call(null, str);
+						return str;
+					}
+
+					if(!data || !data.data) {
+						if(callback) callback.call(null, false);
+						return "";
+					}
+
+					var str = '';
+					str += "<li ";
+					var cls = false;
+					if(data.attributes) {
+						for(var i in data.attributes) {
+							if(!data.attributes.hasOwnProperty(i)) continue;
+							if(i == "class") {
+								str += " class='" + data.attributes[i] + " ";
+								if(data.state == "closed" || data.state == "open") str += " " + data.state + " ";
+								str += "' ";
+								cls = true;
+							}
+							else str += " " + i + "='" + data.attributes[i] + "' ";
+						}
+					}
+					if(!cls && (data.state == "closed" || data.state == "open")) str += " class='" + data.state + "' ";
+					str += ">";
+
+					if(tree.settings.languages.length) {
+						for(var i = 0; i < tree.settings.languages.length; i++) {
+							var attr = {};
+							attr["href"] = "";
+							attr["style"] = "";
+							attr["class"] = tree.settings.languages[i];
+							if(data.data[tree.settings.languages[i]] && (typeof data.data[tree.settings.languages[i]].attributes).toLowerCase() != "undefined") {
+								for(var j in data.data[tree.settings.languages[i]].attributes) {
+									if(!data.data[tree.settings.languages[i]].attributes.hasOwnProperty(j)) continue;
+									if(j == "style" || j == "class")	attr[j] += " " + data.data[tree.settings.languages[i]].attributes[j];
+									else								attr[j]  = data.data[tree.settings.languages[i]].attributes[j];
+								}
+							}
+							str += "<a";
+							for(var j in attr) {
+								if(!attr.hasOwnProperty(j)) continue;
+								str += ' ' + j + '="' + attr[j] + '" ';
+							}
+							str += ">";
+							if(data.data[tree.settings.languages[i]] && data.data[tree.settings.languages[i]].icon) {
+								str += "<ins " + (data.data[tree.settings.languages[i]].icon.indexOf("/") == -1 ? " class='" + data.data[tree.settings.languages[i]].icon + "' " : " style='background-image:url(\"" + data.data[tree.settings.languages[i]].icon + "\");' " ) + ">&nbsp;</ins>";
+							}
+							else str += "<ins>&nbsp;</ins>";
+							str += ( (typeof data.data[tree.settings.languages[i]].title).toLowerCase() != "undefined" ? data.data[tree.settings.languages[i]].title : data.data[tree.settings.languages[i]] ) + "</a>";
+						}
+					}
+					else {
+						var attr = {};
+						attr["href"] = "";
+						attr["style"] = "";
+						attr["class"] = "";
+						if((typeof data.data.attributes).toLowerCase() != "undefined") {
+							for(var i in data.data.attributes) {
+								if(!data.data.attributes.hasOwnProperty(i)) continue;
+								if(i == "style" || i == "class")	attr[i] += " " + data.data.attributes[i];
+								else								attr[i]  = data.data.attributes[i];
+							}
+						}
+						str += "<a";
+						for(var i in attr) {
+							if(!attr.hasOwnProperty(i)) continue;
+							str += ' ' + i + '="' + attr[i] + '" ';
+						}
+						str += ">";
+						if(data.data.icon) {
+							str += "<ins " + (data.data.icon.indexOf("/") == -1 ? " class='" + data.data.icon + "' " : " style='background-image:url(\"" + data.data.icon + "\");' " ) + ">&nbsp;</ins>";
+						}
+						else str += "<ins>&nbsp;</ins>";
+						str += ( (typeof data.data.title).toLowerCase() != "undefined" ? data.data.title : data.data ) + "</a>";
+					}
+					if(data.children && data.children.length) {
+						str += '<ul>';
+						for(var i = 0; i < data.children.length; i++) {
+							str += this.parse(data.children[i], tree, opts);
+						}
+						str += '</ul>';
+					}
+					str += "</li>";
+					if(callback) callback.call(null, str);
+					return str;
+				},
+				load	: function(data, tree, opts, callback) {
+					if(opts.static) {
+						callback.call(null, opts.static);
+					} 
+					else {
+						$.ajax({
+							'type'		: opts.method,
+							'url'		: opts.url, 
+							'data'		: data, 
+							'dataType'	: "json",
+							'success'	: function (d, textStatus) {
+								callback.call(null, d);
+							},
+							'error'		: function (xhttp, textStatus, errorThrown) { 
+								callback.call(null, false);
+								tree.error(errorThrown + " " + textStatus); 
+							}
+						});
+					}
+				}
+			}
+		}
+	});
+})(jQuery);



More information about the Mapbender_commits mailing list