var lastdblclick=new Date,g_tree=null;
(function(h){function c(){return{cntr:++c.cntr,settings:h.extend({},h.tree.defaults),init:function(a,b){var d=this;g_tree=this;this.container=h(a);if(this.container.size==0)return false;c.inst[this.cntr]=this;this.container.attr("id")||this.container.attr("id","jstree_"+this.cntr);c.inst[this.container.attr("id")]=c.inst[this.cntr];c.focused=this.cntr;this.settings=h.extend(true,{},this.settings,b);if(this.settings.languages&&this.settings.languages.length){this.current_lang=this.settings.languages[0];
for(var e=false,f="#"+this.container.attr("id"),g=0;g<this.settings.languages.length;g++){e=c.add_css(f+" ."+this.settings.languages[g]);if(e!==false)e.style.display=this.settings.languages[g]==this.current_lang?"":"none"}}else this.current_lang=false;this.container.addClass("tree");if(this.settings.ui.theme_name!==false){this.settings.ui.theme_path===false&&h("script").each(function(){if(this.src.toString().match(/jquery\.tree.*?js$/)){d.settings.ui.theme_path=this.src.toString().replace(/jquery\.tree.*?js$/,
"")+"treestyle.css";return false}});if(this.settings.ui.theme_path!=""&&h.inArray(this.settings.ui.theme_path,c.themes)==-1){c.add_sheet({url:this.settings.ui.theme_path});c.themes.push(this.settings.ui.theme_path)}this.container.addClass("tree-"+this.settings.ui.theme_name)}e="";for(var j in this.settings.types)if(this.settings.types.hasOwnProperty(j))if(this.settings.types[j].icon)if(this.settings.types[j].icon.image||this.settings.types[j].icon.position){e+=j=="default"?"#"+this.container.attr("id")+
" li > a ins { ":"#"+this.container.attr("id")+" li[rel="+j+"] > a ins { ";if(this.settings.types[j].icon.image)e+=" background-image:url("+this.settings.types[j].icon.image+"); ";if(this.settings.types[j].icon.position)e+=" background-position:"+this.settings.types[j].icon.position+"; ";e+="} "}e!=""&&c.add_sheet({str:e});if(this.settings.rules.multiple)this.selected_arr=[];this.locked=this.hovered=this.offset=false;if(c.drag_drop.marker===false)c.drag_drop.marker=h("<div>").attr({id:"jstree-marker"}).hide().appendTo("body");
this.callback("oninit",[this]);this.refresh();this.attach_events();this.focus()},refresh:function(a){if(this.locked)return this.error("LOCKED");var b=this;if(a&&!this.settings.data.async)a=false;this.is_partial_refresh=a?true:false;this.opened=[];if(this.settings.opened!=false){h.each(this.settings.opened,function(){this.replace(/^#/,"").length>0&&b.opened.push("#"+this.replace(/^#/,""))});this.settings.opened=false}else this.container.find("li.open").each(function(){this.id&&b.opened.push("#"+this.id)});
if(this.selected){this.settings.selected=[];if(a)h(a).find("li:has(a.clicked)").each(function(){this.id&&b.settings.selected.push("#"+this.id)});else if(this.selected_arr)h.each(this.selected_arr,function(){this.attr("id")&&b.settings.selected.push("#"+this.attr("id"))});else this.selected.attr("id")&&this.settings.selected.push("#"+this.selected.attr("id"))}else if(this.settings.selected!==false){var d=[];if((typeof this.settings.selected).toLowerCase()=="object")h.each(this.settings.selected,function(){this.replace(/^#/,
"").length>0&&d.push("#"+this.replace(/^#/,""))});else this.settings.selected.replace(/^#/,"").length>0&&d.push("#"+this.settings.selected.replace(/^#/,""));this.settings.selected=d}if(a&&this.settings.data.async){this.opened=[];a=this.get_node(a);a.find("li.open").each(function(){b.opened.push("#"+this.id)});a.hasClass("open")&&a.removeClass("open").addClass("closed");a.hasClass("leaf")&&a.removeClass("leaf");a.children("ul:eq(0)").html("");return this.open_branch(a,true,function(){b.reselect.apply(b)})}b=
this;var e=new h.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>");e.load(this.callback("beforedata",[false,this]),this,this.settings.data.opts,function(f){f=b.callback("ondata",[f,b]);e.parse(f,b,b.settings.data.opts,function(g){g=b.callback("onparse",[g,b]);b.container.empty().append(h("<ul class='ltr'>").html(g));
b.container.find("li:last-child").addClass("last").end().find("li:has(ul)").not(".open").addClass("closed");b.container.find("li").not(".open").not(".closed").addClass("leaf");b.reselect()})})},reselect:function(a){var b=this;if(a)this.cl_count--;else this.cl_count=0;if(this.opened&&this.opened.length){a=false;for(var d=0;this.opened&&d<this.opened.length;d++)if(this.settings.data.async){var e=this.get_node(this.opened[d]);if(e.size()&&e.hasClass("closed")>0){a=true;e=this.opened[d].toString().replace("/",
"\\/");delete this.opened[d];this.open_branch(e,true,function(){b.reselect.apply(b,[true])});this.cl_count++}}else this.open_branch(this.opened[d],true);if(this.settings.data.async&&a)return;if(this.cl_count>0)return;delete this.opened}if(!(this.cl_count>0)){this.container.css("direction","ltr").children("ul:eq(0)").addClass("ltr");this.settings.ui.dots==false&&this.container.children("ul:eq(0)").addClass("no_dots");if(this.scrtop){this.container.scrollTop(b.scrtop);delete this.scrtop}if(this.settings.selected!==
false){h.each(this.settings.selected,function(f){b.is_partial_refresh?b.select_branch(h(b.settings.selected[f].toString().replace("/","\\/"),b.container),b.settings.rules.multiple!==false):b.select_branch(h(b.settings.selected[f].toString().replace("/","\\/"),b.container),b.settings.rules.multiple!==false&&f>0)});this.settings.selected=false}this.callback("onload",[b])}},get:function(a,b,d){if(!b)b=this.settings.data.type;if(!d)d=this.settings.data.opts;return(new h.tree.datastores[b]).get(a,this,
d)},attach_events:function(){var a=this;this.container.bind("mousedown.jstree",function(b){if(c.drag_drop.isdown){c.drag_drop.move_type=false;b.preventDefault();b.stopPropagation();b.stopImmediatePropagation();return false}}).bind("mouseup.jstree",function(){setTimeout(function(){a.focus.apply(a)},5)}).bind("click.jstree",function(){return true});h("li",this.container.get(0)).live("click",function(b){if(b.target.tagName!="LI")return true;a.off_height();if(b.pageY-h(b.target).offset().top>a.li_height)return true;
a.toggle_branch.apply(a,[b.target]);b.stopPropagation();return false}).live("contextmenu",function(b){if(a.locked){b.target.blur();return a.error("LOCKED")}return a.callback("onrgtclk",[a.get_node(b.target).get(0),a,b])}).live("mousedown",function(b){a.domousedown(b)});h("a",this.container.get(0)).live("click",function(b){if(b.which&&b.which==3)return true;if(a.locked){b.preventDefault();b.target.blur();return a.error("LOCKED")}a.select_branch.apply(a,[b.target,b.ctrlKey||a.settings.rules.multiple==
"on",b.shiftKey]);a.inp&&a.inp.blur();b.preventDefault();b.target.blur();return false}).live("dblclick",function(b){if(a.locked){b.preventDefault();b.stopPropagation();b.target.blur();return a.error("LOCKED")}a.callback("ondblclk",[a.get_node(b.target).get(0),a]);b.preventDefault();b.stopPropagation();b.target.blur()}).live("contextmenu",function(b){if(a.locked){b.target.blur();return a.error("LOCKED")}return a.callback("onrgtclk",[a.get_node(b.target).get(0),a,b])}).live("mouseover",function(b){if(a.locked){b.preventDefault();
b.stopPropagation();return a.error("LOCKED")}if(a.hovered!==false&&(b.target.tagName=="A"||b.target.tagName=="INS")){a.hovered.children("a").removeClass("hover");a.hovered=false}a.callback("onhover",[a.get_node(b.target).get(0),a])}).live("mousedown",function(b){a.domousedown(b)})},domousedown:function(a){_this=g_tree;if(_this.settings.rules.drag_button=="left"&&a.which&&a.which!=1)return true;if(_this.settings.rules.drag_button=="right"&&a.which&&a.which!=3)return true;_this.focus.apply(_this);if(_this.locked)return _this.error("LOCKED");
var b=_this.get_node(a.target);if(_this.settings.rules.multiple!=false&&_this.selected_arr.length>1&&b.children("a:eq(0)").hasClass("clicked")){var d=0,e;for(e in _this.selected_arr)if(_this.selected_arr.hasOwnProperty(e))if(_this.check("draggable",_this.selected_arr[e])){_this.selected_arr[e].addClass("dragged");c.drag_drop.origin_tree=_this;d++}if(d>0){c.drag_drop.drag_node=_this.check("draggable",b)?b:_this.container.find("li.dragged:eq(0)");c.drag_drop.isdown=true;if(typeof getDragHTML=="function")c.drag_drop.drag_help=
h(getDragHTML(null));else{c.drag_drop.drag_help=h("<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+"' />");d=c.drag_drop.drag_node.clone();_this.settings.languages.length>0&&d.find("a").not("."+_this.current_lang).hide();c.drag_drop.drag_help.children("ul:eq(0)").append(d);c.drag_drop.drag_help.find("li:eq(0)").removeClass("last").addClass("last").children("a").html("<ins>&nbsp;</ins>Multiple selection").end().children("ul").remove()}c.drag_drop.dragged=
_this.container.find("li.dragged")}}else if(_this.check("draggable",b)){_this.settings.languages.length>0&&d.find("a").not("."+_this.current_lang).hide();c.drag_drop.drag_node=b;d=b.clone();if(typeof getDragHTML=="function")c.drag_drop.drag_help=h(getDragHTML(d));else{c.drag_drop.drag_help=h("<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+"' />");c.drag_drop.drag_help.children("ul:eq(0)").append(getDragHTML(d));
c.drag_drop.drag_help.find("li:eq(0)").removeClass("last").addClass("last")}c.drag_drop.isdown=true;c.drag_drop.foreign=false;c.drag_drop.origin_tree=_this;b.addClass("dragged");c.drag_drop.dragged=_this.container.find("li.dragged")}c.drag_drop.init_x=a.pageX;c.drag_drop.init_y=a.pageY;b.blur();a.preventDefault();a.stopPropagation();return false},focus:function(){if(this.locked)return false;if(c.focused!=this.cntr){c.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 a=0;if(a=parseInt(h.curCSS(this.container.get(0),"paddingTop",true),10))this.offset.top+=a;if(a=parseInt(h.curCSS(this.container.get(0),"borderTopWidth",true),10))this.offset.top+=a;this.container.css({position:""})}if(isSafariNative()&&!this.li_height)this.li_height=20;else if(!this.li_height){a=this.container.find("ul li.closed, ul li.leaf").eq(0);this.li_height=a.height();if(a.children("ul:eq(0)").size())this.li_height-=
a.children("ul:eq(0)").height();if(!this.li_height)this.li_height=18}},scroll_check:function(a,b){var d=this,e=d.container,f=d.container.offset(),g=e.scrollTop(),j=e.scrollLeft(),k=e.get(0).scrollWidth>e.width()?40:20;b-f.top<20&&e.scrollTop(Math.max(g-d.settings.ui.scroll_spd,0));e.height()-(b-f.top)<k&&e.scrollTop(g+d.settings.ui.scroll_spd);a-f.left<20&&e.scrollLeft(Math.max(j-d.settings.ui.scroll_spd,0));e.width()-(a-f.left)<40&&e.scrollLeft(j+d.settings.ui.scroll_spd);if(e.scrollLeft()!=j||e.scrollTop()!=
g){c.drag_drop.move_type=false;c.drag_drop.ref_node=false;c.drag_drop.marker.hide()}c.drag_drop.scroll_time=setTimeout(function(){d.scroll_check(a,b)},50)},scroll_into_view:function(a){a=a?this.get_node(a):this.selected;if(!a)return false;a=a.offset().top;var b=this.container.offset().top,d=b+this.container.height(),e=this.container.get(0).scrollWidth>this.container.width()?40:20;a+5<b&&this.container.scrollTop(this.container.scrollTop()-(b-a+5));a+e>d&&this.container.scrollTop(this.container.scrollTop()+
(a+e-d))},get_node:function(a){return h(a).closest("li")},get_type:function(a){if(a=!a?this.selected:this.get_node(a))return a.attr(this.settings.rules.type_attr)||"default"},set_type:function(a,b){(b=!b?this.selected:this.get_node(b))&&a&&b.attr(this.settings.rules.type_attr,a)},get_text:function(a,b){a=this.get_node(a);if(!a||a.size()==0)return"";if(this.settings.languages&&this.settings.languages.length){b=b?b:this.current_lang;a=a.children("a."+b)}else a=a.children("a:visible");var d="";a.contents().each(function(){if(this.nodeType==
3){d=this.data;return false}});return d},check:function(a,b){if(this.locked)return false;var d=false;if(b===-1){if(typeof this.settings.rules[a]!="undefined")d=this.settings.rules[a]}else{b=!b?this.selected:this.get_node(b);if(!b)return;var e=this.get_type(b);if(typeof this.settings.types[e]!="undefined"&&typeof this.settings.types[e][a]!="undefined")d=this.settings.types[e][a];else if(typeof this.settings.types["default"]!="undefined"&&typeof this.settings.types["default"][a]!="undefined")d=this.settings.types["default"][a]}if(typeof d==
"function")d=d.call(null,b,this);return d=this.callback("check",[a,b,d,this])},check_move:function(a,b,d){if(this.locked)return false;if(h(b).closest("li.dragged").size())return false;var e=a.parents(".tree:eq(0)").get(0),f=b.parents(".tree:eq(0)").get(0);if(e&&e!=f){f=h.tree.reference(f.id).settings.rules.multitree;if(f=="none"||h.isArray(f)&&h.inArray(e.id,f)==-1)return false}f=d!="inside"?this.parent(b):this.get_node(b);a=this.get_node(a);if(f==false)return false;e={max_depth:this.settings.rules.use_max_depth?
this.check("max_depth",f):-1,max_children:this.settings.rules.use_max_children?this.check("max_children",f):-1,valid_children:this.check("valid_children",f)};var g=typeof a=="string"?a:this.get_type(a);if(typeof e.valid_children!="undefined"&&(e.valid_children=="none"||typeof e.valid_children=="object"&&h.inArray(g,h.makeArray(e.valid_children))==-1))return false;if(this.settings.rules.use_max_children)if(typeof e.max_children!="undefined"&&e.max_children!=-1){if(e.max_children==0)return false;g=
1;if(c.drag_drop.moving==true&&c.drag_drop.foreign==false){g=c.drag_drop.dragged.size();g-=f.find("> ul > li.dragged").size()}if(e.max_children<f.find("> ul > li").size()+g)return false}if(this.settings.rules.use_max_depth){if(typeof e.max_depth!="undefined"&&e.max_depth===0)return this.error("MOVE: MAX-DEPTH REACHED");e=e.max_depth>0?e.max_depth:false;g=0;for(var j=f;j!==-1;){j=this.parent(j);g++;f=this.check("max_depth",j);if(f>=0)e=e===false?f-g:Math.min(e,f-g);if(e!==false&&e<=0)return this.error("MOVE: MAX-DEPTH REACHED")}if(e!==
false&&e<=0)return this.error("MOVE: MAX-DEPTH REACHED");if(e!==false){f=1;if(typeof a!="string")for(j=a;j.size()>0;){if(e-f<0)return this.error("MOVE: MAX-DEPTH REACHED");j=j.children("ul").children("li");f++}}}if(this.callback("check_move",[a,b,d,this])==false)return false;return true},hover_branch:function(a){if(this.locked)return this.error("LOCKED");a=this.get_node(a);if(!a.size())return this.error("HOVER: NOT A VALID NODE");if(!this.check("clickable",a))return this.error("SELECT: NODE NOT SELECTABLE");
this.hovered&&this.hovered.children("A").removeClass("hover");this.hovered=a;this.hovered.children("a").addClass("hover");this.scroll_into_view(this.hovered)},select_branch:function(a,b,d){if(this.locked)return this.error("LOCKED");if(!a&&this.hovered!==false)a=this.hovered;var e=this;a=e.get_node(a);if(!a.size())return this.error("SELECT: NOT A VALID NODE");a.children("a").removeClass("hover");if(!e.check("clickable",a))return this.error("SELECT: NODE NOT SELECTABLE");if(e.callback("beforechange",
[a.get(0),e])===false)return this.error("SELECT: STOPPED BY USER");if(this.settings.rules.multiple!=false&&b&&a.children("a.clicked").size()>0)return this.deselect_branch(a);if(this.settings.rules.multiple!=false&&(b||d)){if(d&&this.selected_arr.length>0){var f=this.selected_arr[this.selected_arr.length-1],g=this.container.find("li.leaf"),j=a.position().top;f=f.position().top;var k=j>f?j:f,l=j<f?j:f;g.each(function(){var n=h(this).position().top;if(n<k&&n>l&&h(this).html()!=a.html()){e.selected_arr.push(h(this));
h(this).addClass("clicked");h(this).children("A").addClass("clicked")}})}this.selected_arr.push(a)}if(this.settings.rules.multiple!=false&&!b&&!d){for(var m in this.selected_arr)if(this.selected_arr.hasOwnProperty(m)){this.selected_arr[m].children("A").removeClass("clicked");this.selected_arr[m].removeClass("clicked");this.callback("ondeselect",[this.selected_arr[m].get(0),e])}this.selected_arr=[];this.selected_arr.push(a);if(this.selected&&this.selected.children("A").hasClass("clicked")){this.selected.children("A").removeClass("clicked");
this.selected.removeClass("clicked");this.callback("ondeselect",[this.selected.get(0),e])}}if(!this.settings.rules.multiple)if(this.selected){this.selected.children("A").removeClass("clicked");this.selected.removeClass("clicked");this.callback("ondeselect",[this.selected.get(0),e])}this.selected=a;if(this.hovered!==false){this.hovered.children("A").removeClass("hover");this.hovered=a}this.selected.children("a").addClass("clicked").end().parents("li.closed").each(function(){e.open_branch(this,true)});
this.selected.addClass("clicked");this.scroll_into_view(this.selected);this.callback("onselect",[this.selected.get(0),e]);this.callback("onchange",[this.selected.get(0),e])},deselect_branch:function(a){if(this.locked)return this.error("LOCKED");var b=this;a=this.get_node(a);if(a.children("a.clicked").size()==0)return this.error("DESELECT: NODE NOT SELECTED");a.children("a").removeClass("clicked");a.removeClass("clicked");this.callback("ondeselect",[a.get(0),b]);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(){b.selected_arr.push(h(this))});if(a.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",[a.get(0),b])},toggle_branch:function(a){if(this.locked)return this.error("LOCKED");a=this.get_node(a);if(a.hasClass("closed"))return this.open_branch(a);if(a.hasClass("open"))return this.close_branch(a)},
open_branch:function(a,b,d){var e=this;if(this.locked)return this.error("LOCKED");a=this.get_node(a);if(!a.size())return this.error("OPEN: NO SUCH NODE");if(a.hasClass("leaf"))return this.error("OPEN: OPENING LEAF NODE");if(this.settings.data.async&&a.find("li").size()==0){if(this.callback("beforeopen",[a.get(0),this])===false)return this.error("OPEN: STOPPED BY USER");a.children("ul:eq(0)").remove().end().append("<ul><li class='last'><a class='loading' href='#'><ins>&nbsp;</ins>"+(e.settings.lang.loading||
"Loading ...")+"</a></li></ul>");a.removeClass("closed").addClass("open");var f=new h.tree.datastores[this.settings.data.type];f.load(this.callback("beforedata",[a,this]),this,this.settings.data.opts,function(g){g=e.callback("ondata",[g,e]);if(!g||g.length==0){a.removeClass("closed").removeClass("open").addClass("leaf").children("ul").remove();d&&d.call()}else f.parse(g,e,e.settings.data.opts,function(j){j=e.callback("onparse",[j,e]);a.children("ul:eq(0)").replaceWith(h("<ul>").html(j));a.find("li:last-child").addClass("last").end().find("li:has(ul)").not(".open").addClass("closed");
a.find("li").not(".open").not(".closed").addClass("leaf");e.open_branch.apply(e,[a]);d&&d.call()})})}else{if(!this.settings.data.async)if(this.callback("beforeopen",[a.get(0),this])===false)return this.error("OPEN: STOPPED BY USER");if(parseInt(this.settings.ui.animation)>0&&!b){a.children("ul:eq(0)").css("display","none");a.removeClass("closed").addClass("open");a.children("ul:eq(0)").slideDown(parseInt(this.settings.ui.animation),function(){h(this).css("display","");d&&d.call()})}else{a.removeClass("closed").addClass("open");
d&&d.call()}this.callback("onopen",[a.get(0),this])}return true},close_branch:function(a,b){if(this.locked)return this.error("LOCKED");var d=this;a=this.get_node(a);if(!a.size())return this.error("CLOSE: NO SUCH NODE");if(d.callback("beforeclose",[a.get(0),d])===false)return this.error("CLOSE: STOPPED BY USER");if(parseInt(this.settings.ui.animation)>0&&!b&&a.children("ul:eq(0)").size()==1)a.children("ul:eq(0)").slideUp(parseInt(this.settings.ui.animation),function(){a.hasClass("open")&&a.removeClass("open").addClass("closed");
h(this).css("display","")});else a.hasClass("open")&&a.removeClass("open").addClass("closed");if(this.selected&&this.settings.ui.selected_parent_close!==false&&a.children("ul:eq(0)").find("a.clicked").size()>0){a.find("li:has(a.clicked)").each(function(){d.deselect_branch(this)});this.settings.ui.selected_parent_close=="select_parent"&&a.children("a.clicked").size()==0&&this.select_branch(a,this.settings.rules.multiple!=false&&this.selected_arr.length>0)}this.callback("onclose",[a.get(0),this])},
open_all:function(a,b){if(this.locked)return this.error("LOCKED");var d=this;a=a?this.get_node(a):this.container;var e=a.find("li.closed").size();if(b)this.cl_count--;else this.cl_count=0;if(e>0){this.cl_count+=e;a.find("li.closed").each(function(){var f=this;d.open_branch.apply(d,[this,true,function(){d.open_all.apply(d,[f,true])}])})}else this.cl_count==0&&this.callback("onopen_all",[this])},close_all:function(a){if(this.locked)return this.error("LOCKED");var b=this;a=a?this.get_node(a):this.container;
a.find("li.open").each(function(){b.close_branch(this,true)});this.callback("onclose_all",[this])},set_lang:function(a){if(!h.isArray(this.settings.languages)||this.settings.languages.length==0)return false;if(this.locked)return this.error("LOCKED");if(!h.inArray(a,this.settings.languages)&&typeof this.settings.languages[a]!="undefined")a=this.settings.languages[a];if(typeof a=="undefined")return false;if(a==this.current_lang)return true;var b=false,d="#"+this.container.attr("id");b=c.get_css(d+" ."+
this.current_lang);if(b!==false)b.style.display="none";b=c.get_css(d+" ."+a);if(b!==false)b.style.display="";this.current_lang=a;return true},get_lang:function(){if(!h.isArray(this.settings.languages)||this.settings.languages.length==0)return false;return this.current_lang},create:function(a,b,d){if(this.locked)return this.error("LOCKED");var e=false;if(b==-1){e=true;b=this.container}else b=b?this.get_node(b):this.selected;if(!e&&(!b||!b.size()))return this.error("CREATE: NO NODE SELECTED");var f=
d,g=b;if(d=="before"){d=b.parent().children().index(b);b=b.parents("li:eq(0)")}if(d=="after"){d=b.parent().children().index(b)+1;b=b.parents("li:eq(0)")}if(!e&&b.size()==0){e=true;b=this.container}if(!e){if(!this.check("creatable",b))return this.error("CREATE: CANNOT CREATE IN NODE");if(b.hasClass("closed"))if(this.settings.data.async&&b.children("ul").size()==0){var j=this;return this.open_branch(b,true,function(){j.create.apply(j,[a,b,d])})}else this.open_branch(b,true)}var k=false;a=a?h.extend(true,
{},a):{};if(!a.attributes)a.attributes={};a.attributes[this.settings.rules.type_attr]||(a.attributes[this.settings.rules.type_attr]=this.get_type(g)||"default");if(this.settings.languages.length){if(!a.data){a.data={};k=true}for(var l=0;l<this.settings.languages.length;l++)a.data[this.settings.languages[l]]||(a.data[this.settings.languages[l]]=(typeof this.settings.lang.new_node).toLowerCase()!="string"&&this.settings.lang.new_node[l]?this.settings.lang.new_node[l]:this.settings.lang.new_node)}else if(!a.data){a.data=
this.settings.lang.new_node;k=true}a=this.callback("ondata",[a,this]);g=h.tree.datastores.json().parse(a,this);g=this.callback("onparse",[g,this]);g=h(g);if(g.children("ul").size())g.is(".open")||g.addClass("closed");else g.addClass("leaf");g.find("li:last-child").addClass("last").end().find("li:has(ul)").not(".open").addClass("closed");g.find("li").not(".open").not(".closed").addClass("leaf");var m={max_depth:this.settings.rules.use_max_depth?this.check("max_depth",e?-1:b):-1,max_children:this.settings.rules.use_max_children?
this.check("max_children",e?-1:b):-1,valid_children:this.check("valid_children",e?-1:b)},n=this.get_type(g);if(typeof m.valid_children!="undefined"&&(m.valid_children=="none"||h.isArray(m.valid_children)&&h.inArray(n,m.valid_children)==-1))return this.error("CREATE: NODE NOT A VALID CHILD");if(this.settings.rules.use_max_children)if(typeof m.max_children!="undefined"&&m.max_children!=-1&&m.max_children>=this.children(b).size())return this.error("CREATE: MAX_CHILDREN REACHED");if(this.settings.rules.use_max_depth){if(typeof m.max_depth!=
"undefined"&&m.max_depth===0)return this.error("CREATE: MAX-DEPTH REACHED");m=m.max_depth>0?m.max_depth:false;l=0;for(n=b;n!==-1&&!e;){n=this.parent(n);l++;var o=this.check("max_depth",n);if(o>=0)m=m===false?o-l:Math.min(m,o-l);if(m!==false&&m<=0)return this.error("CREATE: MAX-DEPTH REACHED")}if(m!==false&&m<=0)return this.error("CREATE: MAX-DEPTH REACHED");if(m!==false){l=1;for(n=g;n.size()>0;){if(m-l<0)return this.error("CREATE: MAX-DEPTH REACHED");n=n.children("ul").children("li");l++}}}if((typeof d).toLowerCase()==
"undefined"||d=="inside")d=this.settings.rules.createat=="top"?0:b.children("ul:eq(0)").children("li").size();if((b.children("ul").size()==0||e==true&&b.children("ul").children("li").size()==0?e?this.moved(g,this.container.children("ul:eq(0)"),"inside",true):this.moved(g,b.children("a:eq(0)"),"inside",true):f=="before"&&b.children("ul:eq(0)").children("li:nth-child("+(d+1)+")").size()?this.moved(g,b.children("ul:eq(0)").children("li:nth-child("+(d+1)+")").children("a:eq(0)"),"before",true):f=="after"&&
b.children("ul:eq(0)").children("li:nth-child("+d+")").size()?this.moved(g,b.children("ul:eq(0)").children("li:nth-child("+d+")").children("a:eq(0)"),"after",true):b.children("ul:eq(0)").children("li:nth-child("+(d+1)+")").size()?this.moved(g,b.children("ul:eq(0)").children("li:nth-child("+(d+1)+")").children("a:eq(0)"),"before",true):this.moved(g,b.children("ul:eq(0)").children("li:last").children("a:eq(0)"),"after",true))===false)return this.error("CREATE: ABORTED");if(k){this.select_branch(g.children("a:eq(0)"));
this.rename()}return g},rename:function(a,b){if(this.locked)return this.error("LOCKED");a=a?this.get_node(a):this.selected;var d=this;if(!a||!a.size())return this.error("RENAME: NO NODE SELECTED");if(!this.check("renameable",a))return this.error("RENAME: NODE NOT RENAMABLE");if(!this.callback("beforerename",[a.get(0),d.current_lang,d]))return this.error("RENAME: STOPPED BY USER");a.parents("li.closed").each(function(){d.open_branch(this)});a=this.current_lang?a.find("a."+this.current_lang):a.find("a:first");
var e={};e[this.container.attr("id")]=this.get_rollback();var f=a.children("ins").clone();if((typeof b).toLowerCase()=="string"){a.text(b).prepend(f);d.callback("onrename",[d.get_node(a).get(0),d,e])}else{var g="";a.contents().each(function(){if(this.nodeType==3){g=this.data;return false}});d.inp=h("<input type='text' autocomplete='off' />");d.inp.val(g.replace(/&amp;/g,"&").replace(/&gt;/g,">").replace(/&lt;/g,"<")).bind("mousedown",function(k){k.stopPropagation()}).bind("mouseup",function(k){k.stopPropagation()}).bind("click",
function(k){k.stopPropagation()}).bind("keyup",function(k){k=k.keyCode||k.which;if(k==27){this.value=g;this.blur()}else k==13&&this.blur()});d.inp.blur(function(){if(this.value=="")this.value=g;a.text(this.value).prepend(f);a.get(0).style.display="";a.prevAll("span").remove();d.inp=false;d.callback("onrename",[d.get_node(a).get(0),d,e])});var j=h("<span />").addClass(a.attr("class")).append(f).append(d.inp);a.get(0).style.display="none";a.parent().prepend(j);d.inp.get(0).focus();d.inp.get(0).select()}},
remove:function(a){if(this.locked)return this.error("LOCKED");var b=this,d={};d[this.container.attr("id")]=this.get_rollback();if(a&&(!this.selected||this.get_node(a).get(0)!=this.selected.get(0))){a=this.get_node(a);if(a.size()){if(!this.check("deletable",a))return this.error("DELETE: NODE NOT DELETABLE");if(!this.callback("beforedelete",[a.get(0),b]))return this.error("DELETE: STOPPED BY USER");$parent=a.parent();if(a.find("a.clicked").size()){var e=false;b.selected_arr=[];this.container.find("a.clicked").filter(":first-child").parent().each(function(){if(!e&&
this==b.selected.get(0))e=true;if(h(this).parents().index(a)!=-1)return true;b.selected_arr.push(h(this))});if(e)this.selected=this.selected_arr[0]||false}a=a.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",[a.get(0),this,d])}}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),b]))return this.error("DELETE: STOPPED BY USER");$parent=this.selected.parent();a=this.selected;if(this.settings.rules.multiple==false||this.selected_arr.length==1)var f=true,g=this.settings.ui.selected_delete=="select_previous"?this.prev(this.selected):false;a=a.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(!f&&
this.settings.rules.multiple!=false){b=this;this.selected_arr=[];this.container.find("a.clicked").filter(":first-child").parent().each(function(){b.selected_arr.push(h(this))});if(this.selected_arr.length>0){this.selected=this.selected_arr[0];this.remove()}}f&&g&&this.select_branch(g);this.callback("ondelete",[a.get(0),this,d])}else return this.error("DELETE: NO NODE SELECTED")},next:function(a,b){if(typeof this.get_node=="function")a=this.get_node(a);if(!a.size())return false;if(b)return a.nextAll("li").size()>
0?a.nextAll("li:eq(0)"):false;return a.hasClass("open")?a.find("li:eq(0)"):a.nextAll("li").size()>0?a.nextAll("li:eq(0)"):a.parents("li").next("li").eq(0)},prev:function(a,b){if(typeof this.get_node=="function")a=this.get_node(a);if(!a.size())return false;if(b)return a.prevAll("li").size()>0?a.prevAll("li:eq(0)"):false;if(a.prev("li").size()){for(a=a.prev("li").eq(0);a.hasClass("open");)a=a.children("ul:eq(0)").children("li:last");return a}else return a.parents("li:eq(0)").size()?a.parents("li:eq(0)"):
false},parent:function(a){a=this.get_node(a);if(!a.size())return false;return a.parents("li:eq(0)").size()?a.parents("li:eq(0)"):-1},children:function(a){if(a===-1)return this.container.children("ul:eq(0)").children("li");a=this.get_node(a);if(!a.size())return false;return a.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(a,b){var d=false,e=null,f;for(f in this.settings.plugins)if(typeof h.tree.plugins[f]=="object"){d=h.tree.plugins[f];if(d.callbacks&&typeof d.callbacks[a]=="function")e=d.callbacks[a].apply(this,b);if(typeof e!=="undefined"&&e!==null)if(a=="ondata"||a=="onparse")b[0]=e;else return e}d=this.settings.callback[a];if(typeof d=="function")return d.apply(null,b)},get_rollback:function(){var a={};a.html=this.container.html();a.selected=this.selected?this.selected.attr("id"):false;return a},
moved:function(a,b,d,e,f,g){a=h(a);var j=h(a).parents("ul:eq(0)"),k=h(b);if(k.is("ins"))k=k.parent();if(!g){g={};g[this.container.attr("id")]=this.get_rollback();if(!e){var l=a.size()>1?a.eq(0).parents(".tree:eq(0)"):a.parents(".tree:eq(0)");if(l.get(0)!=this.container.get(0)){l=c.inst[l.attr("id")];g[l.container.attr("id")]=l.get_rollback()}delete l}}if(d=="inside"&&this.settings.data.async){var m=this;if(this.get_node(k).hasClass("closed"))return this.open_branch(this.get_node(k),true,function(){m.moved.apply(m,
[a,b,d,e,f,g])});if(this.get_node(k).find("> ul > li > a.loading").size()==1){setTimeout(function(){m.moved.apply(m,[a,b,d,e,f])},200);return}}if(a.size()>1){m=this;l=this.moved(a.eq(0),b,d,false,f,g);a.each(function(q){if(q!=0)if(l)l=m.moved(this,l.children("a:eq(0)"),"after",false,f,g)});return a}if(f){_what=a.clone();_what.each(function(){this.id+="_copy";h(this).find("li").each(function(){this.id+="_copy"});h(this).removeClass("dragged").find("a.clicked").removeClass("clicked").end().find("li.dragged").removeClass("dragged");
h(this).removeClass("dragged").find("li.clicked").removeClass("clicked").end().find("li.dragged").removeClass("dragged")})}else _what=a;if(e){if(!this.callback("beforecreate",[this.get_node(a).get(0),this.get_node(b).get(0),d,this]))return false}else if(!this.callback("beforemove",[a,b,d,this]))return false;if(!e){l=a.parents(".tree:eq(0)");if(l.get(0)!=this.container.get(0)){l=c.inst[l.attr("id")];if(l.settings.languages.length){var n=[];if(this.settings.languages.length==0)n.push("."+l.current_lang);
else for(var o in this.settings.languages)if(this.settings.languages.hasOwnProperty(o))for(var p in l.settings.languages)l.settings.languages.hasOwnProperty(p)&&this.settings.languages[o]==l.settings.languages[p]&&n.push("."+this.settings.languages[o]);if(n.length==0)return this.error("MOVE: NO COMMON LANGUAGES");_what.find("a").not(n.join(",")).remove()}_what.find("a.clicked").removeClass("clicked");_what.find("li.clicked").removeClass("clicked")}}a=_what;switch(d){case "before":k.parents("ul:eq(0)").children("li.last").removeClass("last");
k.parent().before(a.removeClass("last"));k.parents("ul:eq(0)").children("li:last").addClass("last");break;case "after":k.parents("ul:eq(0)").children("li.last").removeClass("last");k.parent().after(a.removeClass("last"));k.parents("ul:eq(0)").children("li:last").addClass("last");break;case "inside":if(k.parent().children("ul:first").size())if(this.settings.rules.createat=="top"){k.parent().children("ul:first").prepend(a.removeClass("last")).children("li:last").addClass("last");n=k.parent().children("ul:first").children("li:first");
if(n.size()){d="before";b=n}}else{n=k.parent().children("ul:first").children(".last");if(n.size()){d="after";b=n}k.parent().children("ul:first").children(".last").removeClass("last").end().append(a.removeClass("last")).children("li:last").addClass("last")}else{a.addClass("last");k.parent().removeClass("leaf").append("<ul/>");k.parent().hasClass("open")||k.parent().addClass("closed");k.parent().children("ul:first").prepend(a)}k.parent().hasClass("closed")&&this.open_branch(k)}if(j.find("li").size()==
0){j=j.parent();j.removeClass("open").removeClass("closed").addClass("leaf");j.is(".tree")||j.children("ul").remove();j.parents("ul:eq(0)").children("li.last").removeClass("last").end().children("li:last").addClass("last")}else{j.children("li.last").removeClass("last");j.children("li:last").addClass("last")}if(f)this.callback("oncopy",[this.get_node(a).get(0),this.get_node(b).get(0),d,this,g]);else e?this.callback("oncreate",[this.get_node(a).get(0),k.is("ul")?-1:this.get_node(b).get(0),d,this,g]):
this.callback("onmove",[this.get_node(a).get(0),this.get_node(b).get(0),d,this,g]);return a},error:function(a){this.callback("error",[a,this]);return false},lock:function(a){(this.locked=a)?this.container.children("ul:eq(0)").addClass("locked"):this.container.children("ul:eq(0)").removeClass("locked")},cut:function(a){if(this.locked)return this.error("LOCKED");a=a?this.get_node(a):this.container.find("a.clicked").filter(":first-child").parent();if(!a||!a.size())return this.error("CUT: NO NODE SELECTED");
c.cut_copy.copy_nodes=false;c.cut_copy.cut_nodes=a},copy:function(a){if(this.locked)return this.error("LOCKED");a=a?this.get_node(a):this.container.find("a.clicked").filter(":first-child").parent();if(!a||!a.size())return this.error("COPY: NO NODE SELECTED");c.cut_copy.copy_nodes=a;c.cut_copy.cut_nodes=false},paste:function(a,b){if(this.locked)return this.error("LOCKED");var d=false;if(a==-1){d=true;a=this.container}else a=a?this.get_node(a):this.selected;if(!d&&(!a||!a.size()))return this.error("PASTE: NO NODE SELECTED");
if(!c.cut_copy.copy_nodes&&!c.cut_copy.cut_nodes)return this.error("PASTE: NOTHING TO DO");var e=b;if(b=="before"){b=a.parent().children().index(a);a=a.parents("li:eq(0)")}else if(b=="after"){b=a.parent().children().index(a)+1;a=a.parents("li:eq(0)")}else if((typeof b).toLowerCase()=="undefined"||b=="inside")b=this.settings.rules.createat=="top"?0:a.children("ul:eq(0)").children("li").size();if(!d&&a.size()==0){d=true;a=this.container}if(c.cut_copy.copy_nodes&&c.cut_copy.copy_nodes.size()){var f=
true;if(!d&&!this.check_move(c.cut_copy.copy_nodes,a.children("a:eq(0)"),"inside"))return false;if(a.children("ul").size()==0||d==true&&a.children("ul").children("li").size()==0)d?this.moved(c.cut_copy.copy_nodes,this.container.children("ul:eq(0)"),"inside",false,true):this.moved(c.cut_copy.copy_nodes,a.children("a:eq(0)"),"inside",false,true);else e=="before"&&a.children("ul:eq(0)").children("li:nth-child("+(b+1)+")").size()?this.moved(c.cut_copy.copy_nodes,a.children("ul:eq(0)").children("li:nth-child("+
(b+1)+")").children("a:eq(0)"),"before",false,true):e=="after"&&a.children("ul:eq(0)").children("li:nth-child("+b+")").size()?this.moved(c.cut_copy.copy_nodes,a.children("ul:eq(0)").children("li:nth-child("+b+")").children("a:eq(0)"),"after",false,true):a.children("ul:eq(0)").children("li:nth-child("+(b+1)+")").size()?this.moved(c.cut_copy.copy_nodes,a.children("ul:eq(0)").children("li:nth-child("+(b+1)+")").children("a:eq(0)"),"before",false,true):this.moved(c.cut_copy.copy_nodes,a.children("ul:eq(0)").children("li:last").children("a:eq(0)"),
"after",false,true);c.cut_copy.copy_nodes=false}if(c.cut_copy.cut_nodes&&c.cut_copy.cut_nodes.size()){f=true;a.parents().andSelf().each(function(){if(c.cut_copy.cut_nodes.index(this)!=-1)return f=false});if(!f)return this.error("Invalid paste");if(!d&&!this.check_move(c.cut_copy.cut_nodes,a.children("a:eq(0)"),"inside"))return false;if(a.children("ul").size()==0||d==true&&a.children("ul").children("li").size()==0)d?this.moved(c.cut_copy.cut_nodes,this.container.children("ul:eq(0)"),"inside"):this.moved(c.cut_copy.cut_nodes,
a.children("a:eq(0)"),"inside");else e=="before"&&a.children("ul:eq(0)").children("li:nth-child("+(b+1)+")").size()?this.moved(c.cut_copy.cut_nodes,a.children("ul:eq(0)").children("li:nth-child("+(b+1)+")").children("a:eq(0)"),"before"):e=="after"&&a.children("ul:eq(0)").children("li:nth-child("+b+")").size()?this.moved(c.cut_copy.cut_nodes,a.children("ul:eq(0)").children("li:nth-child("+b+")").children("a:eq(0)"),"after"):a.children("ul:eq(0)").children("li:nth-child("+(b+1)+")").size()?this.moved(c.cut_copy.cut_nodes,
a.children("ul:eq(0)").children("li:nth-child("+(b+1)+")").children("a:eq(0)"),"before"):this.moved(c.cut_copy.cut_nodes,a.children("ul:eq(0)").children("li:last").children("a:eq(0)"),"after");c.cut_copy.cut_nodes=false}},search:function(a,b){var d=this;if(!a||this.srch&&a!=this.srch){this.srch="";this.srch_opn=false;this.container.find("a.search").removeClass("search")}if(this.srch=a){b||(b="contains");if(this.settings.data.async)if(this.srch_opn)if(this.srch_opn.length){if(this.srch_opn&&this.srch_opn.length){for(var e=
false,f=0;f<this.srch_opn.length;f++)if(this.get_node("#"+this.srch_opn[f]).size()>0){e=true;var g="#"+this.srch_opn[f];delete this.srch_opn[f];this.open_branch(g,true,function(){d.search.apply(d,[a,b])})}if(!e){this.srch_opn=[];d.search.apply(d,[a,b])}}}else{this.srch_opn=false;e="a";if(this.settings.languages.length)e+="."+this.current_lang;this.callback("onsearch",[this.container.find(e+":"+b+"('"+a+"')"),this])}else{e=h.extend({search:a},this.callback("beforedata",[false,this]));h.ajax({type:this.settings.data.opts.method,
url:this.settings.data.opts.url,data:e,dataType:"text",success:function(j){d.srch_opn=h.unique(j.split(","));d.search.apply(d,[a,b])}})}else{e="a";if(this.settings.languages.length)e+="."+this.current_lang;e=this.container.find(e+":"+b+"('"+a+"')");e.parents("li.closed").each(function(){d.open_branch(this,true)});this.callback("onsearch",[e,this])}}},add_sheet:c.add_sheet,destroy:function(){this.callback("ondestroy",[this]);if(typeof LPFromWebsite=="undefined"||typeof LPFromWebsite.ipad!="function"){this.container.unbind(".jstree");
h("#"+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==c.focused)for(var a in c.inst)if(a!=this.cntr&&
a!=this.container.attr("id")){c.inst[a].focus();break}}c.inst[this.cntr]=false;c.inst[this.container.attr("id")]=false;delete c.inst[this.cntr];delete c.inst[this.container.attr("id")];c.cntr--}}}h.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:typeof LPFromWebsite=="undefined"||typeof LPFromWebsite.ipad!="function",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(){return true},
beforeopen:function(){return true},beforeclose:function(){return true},beforemove:function(){return true},beforecreate:function(){return true},beforerename:function(){return true},beforedelete:function(){return true},beforedata:function(a){return{id:h(a).attr("id")||0}},ondata:function(a){return a},onparse:function(a){return a},onhover:function(){},onselect:function(){},ondeselect:function(){},onchange:function(){},onrename:function(){},onmove:function(){},oncopy:function(){},oncreate:function(){},
ondelete:function(){},onopen:function(a,b){typeof lponopen=="function"&&lponopen(a,b)},onopen_all:function(){},onclose_all:function(){},onclose:function(a,b){typeof lponclose=="function"&&lponclose(a,b)},error:function(){},ondblclk:function(a,b){var d=lastdblclick;lastdblclick=new Date;if(!(d.getTime()>lastdblclick.getTime()-1E3)){b.toggle_branch.call(b,a);b.select_branch.call(b,a)}},onrgtclk:function(){},onload:function(){},oninit:function(){},onfocus:function(){},ondestroy:function(){},onsearch:function(a){a.addClass("search")},
ondrop:function(){},check:function(a,b,d){return d},check_move:function(){return true}},plugins:{}},create:function(){return new c},focused:function(){return c.inst[c.focused]},reference:function(a){var b=h(a);b.size()||(b=h("#"+a));if(!b.size())return null;b=b.is(".tree")?b.attr("id"):b.parents(".tree:eq(0)").attr("id");return c.inst[b]||null},rollback:function(a){for(var b in a)if(a.hasOwnProperty(b)){var d=c.inst[b],e=!d.locked;e&&d.lock(true);d.inp=false;d.container.html(a[b].html).find(".dragged").removeClass("dragged").end().find(".hover").removeClass("hover");
if(a[b].selected){d.selected=h("#"+a[b].selected);d.selected_arr=[];d.container.find("a.clicked").each(function(){d.selected_arr.push(d.get_node(this))})}e&&d.lock(false);delete e;delete d}},drop_mode:function(a){a=h.extend(a,{show:false,type:"default",str:"Foreign node"});c.drag_drop.foreign=true;c.drag_drop.isdown=true;c.drag_drop.moving=true;c.drag_drop.appended=false;c.drag_drop.f_type=a.type;c.drag_drop.f_data=a;if(a.show){c.drag_drop.drag_help=h("<div id='jstree-dragged' class='tree tree-default'><ul><li class='last dragged foreign'><a href='#'><ins>&nbsp;</ins>"+
a.str+"</a></li></ul></div>");c.drag_drop.drag_node=c.drag_drop.drag_help.find("li:eq(0)")}else{c.drag_drop.drag_help=false;c.drag_drop.drag_node=false}h.tree.drag_start!==false&&h.tree.drag_start.call(null,false)},drag_start:false,drag:false,drag_end:false};h.fn.tree=function(a){return this.each(function(){var b=h.extend({},a);c.inst&&c.inst[h(this).attr("id")]&&c.inst[h(this).attr("id")].destroy();b!==false&&(new c).init(this,b)})};c.cntr=0;c.inst={};c.themes=[];c.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};c.mouseup=function(a){var b=c.drag_drop;b.open_time&&clearTimeout(b.open_time);b.scroll_time&&clearTimeout(b.scroll_time);b.moving&&h.tree.drag_end!==false&&h.tree.drag_end.call(null,a,b);if(b.foreign===false&&b.drag_node&&b.drag_node.size()){b.drag_help.remove();if(b.move_type){var d=c.inst[b.ref_node.parents(".tree:eq(0)").attr("id")];
if(d)d.moved(b.dragged,b.ref_node,b.move_type,false,b.origin_tree.settings.rules.drag_copy=="on"||b.origin_tree.settings.rules.drag_copy=="ctrl"&&a.ctrlKey)}b.move_type=false;b.ref_node=false}if(b.foreign!==false){b.drag_help&&b.drag_help.remove();if(b.move_type){d=c.inst[b.ref_node.parents(".tree:eq(0)").attr("id")];alert("dropping");d&&d.callback("ondrop",[b.f_data,d.get_node(b.ref_node).get(0),b.move_type,d])}b.foreign=false;b.move_type=false;b.ref_node=false}c.drag_drop.marker&&c.drag_drop.marker.hide();
b.dragged&&b.dragged.size()&&b.dragged.removeClass("dragged");b.dragged=false;b.drag_help=false;b.drag_node=false;b.f_type=false;b.f_data=false;b.init_x=false;b.init_y=false;b.moving=false;b.appended=false;b.origin_tree=false;if(b.isdown){b.isdown=false;a.preventDefault();a.stopPropagation();return false}};c.mousemove=function(a){var b=c.drag_drop,d=false;if(b.isdown){if(!b.moving&&Math.abs(b.init_x-a.pageX)<5&&Math.abs(b.init_y-a.pageY)<5){a.preventDefault();a.stopPropagation();return false}else if(!b.moving)d=
c.drag_drop.moving=true;b.open_time&&clearTimeout(b.open_time);if(b.drag_help!==false){if(!b.appended){if(b.foreign!==false)b.origin_tree=h.tree.focused();h("body").append(b.drag_help);b.w=b.drag_help.width();b.appended=true}b.drag_help.css({left:a.pageX+5,top:a.pageY+15})}d&&h.tree.drag_start!==false&&h.tree.drag_start.call(null,a,b);h.tree.drag!==false&&h.tree.drag.call(null,a,b);if(a.target.tagName=="DIV"&&a.target.id=="jstree-marker")return false;var e=h(a.target);if(e.is("ins"))e=e.parent();
d=e.is(".tree")?e:e.parents(".tree:eq(0)");if(d.size()==0||!c.inst[d.attr("id")]){b.scroll_time&&clearTimeout(b.scroll_time);b.drag_help!==false&&b.drag_help.find("li:eq(0) ins").addClass("forbidden");b.move_type=false;b.ref_node=false;c.drag_drop.marker.hide();return false}var f=c.inst[d.attr("id")];f.off_height();b.scroll_time&&clearTimeout(b.scroll_time);b.scroll_time=setTimeout(function(){f.scroll_check(a.pageX,a.pageY)},50);var g=false;d.scrollTop();if(a.target.tagName=="A"||a.target.tagName==
"INS"){if(e.is("#jstree-dragged"))return false;if(f.get_node(a.target).hasClass("closed"))b.open_time=setTimeout(function(){f.open_branch(e)},500);var j=e.offset(),k={x:j.left-1,y:a.pageY-j.top},l=[];l=k.y<f.li_height/3+1?["before","inside","after"]:k.y>f.li_height*2/3-1?["after","inside","before"]:k.y<f.li_height/2?["inside","before","after"]:["inside","after","before"];var m=false,n=b.foreign==false?b.origin_tree.container.find("li.dragged"):b.f_type;h.each(l,function(o,p){if(f.check_move(n,e,p)){g=
p;m=true;return false}});if(m){switch(g){case "before":k.y=j.top-2;c.drag_drop.marker.attr("class","marker");break;case "after":k.y=j.top-2+f.li_height;c.drag_drop.marker.attr("class","marker");break;case "inside":k.x-=2;k.y=j.top-2+f.li_height/2;c.drag_drop.marker.attr("class","marker_plus")}b.move_type=g;b.ref_node=h(a.target);b.drag_help!==false&&b.drag_help.find(".forbidden").removeClass("forbidden");c.drag_drop.marker.css({left:k.x,top:k.y}).show()}}if((e.is(".tree")||e.is("ul"))&&e.find("li:eq(0)").size()==
0){j=e.offset();b.move_type="inside";b.ref_node=d.children("ul:eq(0)");b.drag_help!==false&&b.drag_help.find(".forbidden").removeClass("forbidden");c.drag_drop.marker.attr("class","marker_plus");c.drag_drop.marker.css({left:j.left+10,top:j.top+15}).show()}else if(a.target.tagName!="A"&&a.target.tagName!="INS"||!m){b.drag_help!==false&&b.drag_help.find("li:eq(0) ins").addClass("forbidden");b.move_type=false;b.ref_node=false;c.drag_drop.marker.hide()}a.preventDefault();a.stopPropagation();return false}return true};
h(function(){h(document).bind("mousemove.jstree",c.mousemove);h(document).bind("mouseup.jstree",c.mouseup)});c.cut_copy={copy_nodes:false,cut_nodes:false};c.css=false;c.get_css=function(a,b){a=a.toLowerCase();var d=c.css.cssRules||c.css.rules,e=0;do{if(d.length&&e>d.length+5)break;if(d[e].selectorText&&d[e].selectorText.toLowerCase()==a)if(b==true){c.css.removeRule&&document.styleSheets[i].removeRule(e);c.css.deleteRule&&document.styleSheets[i].deleteRule(e);return true}else return d[e]}while(d[++e]);
return false};c.add_css=function(a){if(c.get_css(a))return false;c.css.insertRule?c.css.insertRule(a+" { }",0):c.css.addRule(a,null,0);return c.get_css(a)};c.remove_css=function(a){return c.get_css(a,true)};c.add_sheet=function(a){if(a.str){var b=document.createElement("style");b.setAttribute("type","text/css");if(b.styleSheet){document.getElementsByTagName("head")[0].appendChild(b);b.styleSheet.cssText=a.str}else{b.appendChild(document.createTextNode(a.str));document.getElementsByTagName("head")[0].appendChild(b)}return b.sheet||
b.styleSheet}if(a.url)if(document.createStyleSheet)try{document.createStyleSheet(a.url)}catch(d){}else{b=document.createElement("link");b.rel="stylesheet";b.type="text/css";b.media="all";b.href=a.url;document.getElementsByTagName("head")[0].appendChild(b);return b.styleSheet}};h(function(){navigator.userAgent.toLowerCase().match(/.+(?:rv|it|ra|ie)[\/: ]([\d.]+)/);var a='/* 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 2px 1px 2px;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:hidden; } /* 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(h.browser.msie){if(h.browser.version==6)a+='.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(h.browser.version==7)a+='.tree li li { overflow:visible; } .tree .ltr li.last { margin-top: expression( (this.previousSibling && /open/.test(this.previousSibling.className) ) ? "-2px" : "0"); }'}if(h.browser.opera)a+=
'.tree > ul > li.last:after { content:"."; display: block; height:1px; clear:both; visibility:hidden; }';if(h.browser.mozilla&&h.browser.version.indexOf("1.8")==0)a+=".tree .ltr li a { display:inline; float:left; } .tree li ul { clear:both; }";c.css=c.add_sheet({str:a})})})(jQuery);
(function(h){h.extend(h.tree.datastores,{html:function(){return{get:function(c,a){return c&&h(c).size()?h("<div>").append(a.get_node(c).clone()).html():a.container.children("ul:eq(0)").html()},parse:function(c,a,b,d){d&&d.call(null,c);return c},load:function(c,a,b,d){b.url?h.ajax({type:b.method,url:b.url,data:c,dataType:"html",success:function(e){d.call(null,e)},error:function(e,f,g){d.call(null,false);a.error(g+" "+f)}}):d.call(null,b["static"]||a.container.children("ul:eq(0)").html())}}},json:function(){return{get:function(c,
a,b){var d=this;c=!c||h(c).size()==0?a.container.children("ul").children("li"):h(c);b||(b={});if(!b.outer_attrib)b.outer_attrib=["id","rel","class"];if(!b.inner_attrib)b.inner_attrib=[];if(c.size()>1){var e=[];c.each(function(){e.push(d.get(this,a,b))});return e}if(c.size()==0)return[];var f={attributes:{},data:{}};if(c.hasClass("open"))f.data.state="open";if(c.hasClass("closed"))f.data.state="closed";for(var g in b.outer_attrib)if(b.outer_attrib.hasOwnProperty(g)){var j=b.outer_attrib[g]=="class"?
c.attr(b.outer_attrib[g]).replace(/(^| )last( |$)/ig," ").replace(/(^| )(leaf|closed|open)( |$)/ig," "):c.attr(b.outer_attrib[g]);if(typeof j!="undefined"&&j.toString().replace(" ","").length>0)f.attributes[b.outer_attrib[g]]=j;delete j}if(a.settings.languages.length)for(g in a.settings.languages){if(a.settings.languages.hasOwnProperty(g)){var k=c.children("a."+a.settings.languages[g]);if(b.force||b.inner_attrib.length||k.children("ins").get(0).style.backgroundImage.toString().length||k.children("ins").get(0).className.length){f.data[a.settings.languages[g]]=
{};f.data[a.settings.languages[g]].title=a.get_text(c,a.settings.languages[g]);if(k.children("ins").get(0).style.className.length)f.data[a.settings.languages[g]].icon=k.children("ins").get(0).style.className;if(k.children("ins").get(0).style.backgroundImage.length)f.data[a.settings.languages[g]].icon=k.children("ins").get(0).style.backgroundImage.replace("url(","").replace(")","");if(b.inner_attrib.length){f.data[a.settings.languages[g]].attributes={};for(var l in b.inner_attrib)if(b.inner_attrib.hasOwnProperty(l)){j=
k.attr(b.inner_attrib[l]);if(typeof j!="undefined"&&j.toString().replace(" ","").length>0)f.data[a.settings.languages[g]].attributes[b.inner_attrib[l]]=j;delete j}}}else f.data[a.settings.languages[g]]=a.get_text(c,a.settings.languages[g])}}else{k=c.children("a");f.data.title=a.get_text(c);if(k.children("ins").size()&&k.children("ins").get(0).className.length)f.data.icon=k.children("ins").get(0).className;if(k.children("ins").size()&&k.children("ins").get(0).style.backgroundImage.length)f.data.icon=
k.children("ins").get(0).style.backgroundImage.replace("url(","").replace(")","");if(b.inner_attrib.length){f.data.attributes={};for(l in b.inner_attrib)if(b.inner_attrib.hasOwnProperty(l)){j=k.attr(b.inner_attrib[l]);if(typeof j!="undefined"&&j.toString().replace(" ","").length>0)f.data.attributes[b.inner_attrib[l]]=j;delete j}}}if(c.children("ul").size()>0){f.children=[];c.children("ul").children("li").each(function(){f.children.push(d.get(this,a,b))})}return f},parse:function(c,a,b,d){if(Object.prototype.toString.apply(c)===
"[object Array]"){for(var e="",f=0;f<c.length;f++)if(typeof c[f]!="function")e+=this.parse(c[f],a,b);d&&d.call(null,e);return e}if(!c||!c.data){d&&d.call(null,false);return""}e="";e+="<li ";var g=false;if(c.attributes)for(f in c.attributes)if(c.attributes.hasOwnProperty(f))if(f=="class"){e+=" class='"+c.attributes[f]+" ";if(c.state=="closed"||c.state=="open")e+=" "+c.state+" ";e+="' ";g=true}else e+=" "+f+"='"+c.attributes[f]+"' ";if(!g&&(c.state=="closed"||c.state=="open"))e+=" class='"+c.state+
"' ";e+=">";if(a.settings.languages.length)for(f=0;f<a.settings.languages.length;f++){g={};g.href="";g.style="";g["class"]=a.settings.languages[f];if(c.data[a.settings.languages[f]]&&(typeof c.data[a.settings.languages[f]].attributes).toLowerCase()!="undefined")for(var j in c.data[a.settings.languages[f]].attributes)if(c.data[a.settings.languages[f]].attributes.hasOwnProperty(j))if(j=="style"||j=="class")g[j]+=" "+c.data[a.settings.languages[f]].attributes[j];else g[j]=c.data[a.settings.languages[f]].attributes[j];
e+="<a";for(j in g)if(g.hasOwnProperty(j))e+=" "+j+'="'+g[j]+'" ';e+=">";e+=c.data[a.settings.languages[f]]&&c.data[a.settings.languages[f]].icon?"<ins "+(c.data[a.settings.languages[f]].icon.indexOf("/")==-1?" class='"+c.data[a.settings.languages[f]].icon+"' ":" style='background-image:url(\""+c.data[a.settings.languages[f]].icon+"\");' ")+">&nbsp;</ins>":"<ins>&nbsp;</ins>";e+=((typeof c.data[a.settings.languages[f]].title).toLowerCase()!="undefined"?c.data[a.settings.languages[f]].title:c.data[a.settings.languages[f]])+
"</a>"}else{g={};g.href="";g.style="";g["class"]="";if((typeof c.data.attributes).toLowerCase()!="undefined")for(f in c.data.attributes)if(c.data.attributes.hasOwnProperty(f))if(f=="style"||f=="class")g[f]+=" "+c.data.attributes[f];else g[f]=c.data.attributes[f];e+="<a";for(f in g)if(g.hasOwnProperty(f))e+=" "+f+'="'+g[f]+'" ';e+=">";e+=c.data.icon?"<ins "+(c.data.icon.indexOf("/")==-1?" class='"+c.data.icon+"' ":" style='background-image:url(\""+c.data.icon+"\");' ")+">&nbsp;</ins>":"<ins>&nbsp;</ins>";
e+=((typeof c.data.title).toLowerCase()!="undefined"?c.data.title:c.data)+"</a>"}if(c.children&&c.children.length){e+="<ul>";for(f=0;f<c.children.length;f++)e+=this.parse(c.children[f],a,b);e+="</ul>"}e+="</li>";d&&d.call(null,e);return e},load:function(c,a,b,d){b["static"]?d.call(null,b["static"]):h.ajax({type:b.method,url:b.url,data:c,dataType:"json",success:function(e){d.call(null,e)},error:function(e,f,g){d.call(null,false);a.error(g+" "+f)}})}}}})})(jQuery);
