!function(e){if(void 0===e.cookie)throw"jsTree cookie: jQuery cookie plugin not included.";e.extend(e.tree.plugins,{cookie:{defaults:{prefix:"",options:{expires:!1,path:!1,domain:!1,secure:!1},types:{selected:!0,open:!0},keep_selected:!1,keep_opened:!1},set_cookie:function(i){var t=e.extend(!0,{},e.tree.plugins.cookie.defaults,this.settings.plugins.cookie);if(!0!==t.types[i])return!1;switch(i){case"selected":if(0!=this.settings.rules.multiple&&this.selected_arr.length>1){var o=Array();e.each(this.selected_arr,function(){this.attr("id")&&o.push(this.attr("id"))}),o=o.join(",")}else o=!!this.selected&&this.selected.attr("id");e.cookie(t.prefix+"selected",o,t.options);break;case"open":var s="";this.container.find("li.open").each(function(e){this.id&&(s+=this.id+",")}),e.cookie(t.prefix+"open",s.replace(/,$/gi,""),t.options)}},callbacks:{oninit:function(i){var t=e.extend(!0,{},e.tree.plugins.cookie.defaults,this.settings.plugins.cookie),o=!1;(o=e.cookie(t.prefix+"open"))&&(o=o.split(","),t.keep_opened?this.settings.opened=e.unique(e.merge(o,this.settings.opened)):this.settings.opened=o),(o=e.cookie(t.prefix+"selected"))&&(o=o.split(","),t.keep_selected?this.settings.selected=e.unique(e.merge(o,this.settings.opened)):this.settings.selected=o)},onchange:function(){e.tree.plugins.cookie.set_cookie.apply(this,["selected"])},onopen:function(){e.tree.plugins.cookie.set_cookie.apply(this,["open"])},onclose:function(){e.tree.plugins.cookie.set_cookie.apply(this,["open"])},ondelete:function(){e.tree.plugins.cookie.set_cookie.apply(this,["open"])},oncopy:function(){e.tree.plugins.cookie.set_cookie.apply(this,["open"])},oncreate:function(){e.tree.plugins.cookie.set_cookie.apply(this,["open"])},onmoved:function(){e.tree.plugins.cookie.set_cookie.apply(this,["open"])}}}})}(jQuery);