/* Copyright (C) 2007 - 2011 YOOtheme GmbH, YOOtheme Proprietary Use License (http://www.yootheme.com/license) */

(function(b){var a=function(){};b.extend(a.prototype,{name:"SortCategories",options:{url:"index.php"},initialize:function(a,c){this.options=b.extend({},this.options,c);var d=this,e=b("#categories");e&&e.nestedSortable({forcePlaceholderSize:!0,handle:"td.handle",items:"li",placeholder:"placeholder",tabSize:25,tolerance:"pointer",toleranceElement:"> div",listType:"ul",start:function(b,a){a.placeholder.height(a.helper.height()-2);a.helper.addClass("drag")},stop:function(c,g){var h="option=com_zoo&controller=category&task=saveorder&format=raw&"+
a.find("input[value=1]:hidden:not([name=boxchecked])").attr("name")+"=1&"+e.nestedSortable("serialize");g.item.addClass("loader").find("li").addClass("loader");b.ajax({url:d.options.url,type:"POST",data:h,success:function(a){e.find("li").removeClass("loader");b.Message(a,!0)},complete:function(){d.markCollapsibles()}});g.item.removeClass("drag")}})}});b.fn[a.prototype.name]=function(){var f=arguments,c=f[0]?f[0]:null;return this.each(function(){var d=b(this);if(a.prototype[c]&&d.data(a.prototype.name)&&
c!="initialize")d.data(a.prototype.name)[c].apply(d.data(a.prototype.name),Array.prototype.slice.call(f,1));else if(!c||b.isPlainObject(c)){var e=new a;a.prototype.initialize&&e.initialize.apply(e,b.merge([d],f));d.data(a.prototype.name,e)}else b.error("Method "+c+" does not exist on jQuery."+a.name)})}})(jQuery);
(function(b){var a=function(){};b.extend(a.prototype,{name:"BrowseCategories",initialize:function(a,c){this.options=b.extend({},this.options,c);b("#categories").delegate("li.collapsible > div td.icon","click",function(){var a=b(this).closest("li");a.is(".collapsed")?a.removeClass("collapsed").children("ul").show():a.addClass("collapsed").children("ul").hide()});b("#categories-list .collapse-all").bind("click",function(){b("#categories li.collapsible").each(function(){b(this).addClass("collapsed").children("ul").hide()})});
b("#categories-list .expand-all").bind("click",function(){b("#categories li.collapsible").each(function(){b(this).removeClass("collapsed").children("ul").show()})});this.markCollapsibles()},markCollapsibles:function(){b("#categories").find("li").each(function(){b(this).removeClass("collapsible");b(this).has("ul").length&&b(this).addClass("collapsible")})}});b.fn[a.prototype.name]=function(){var f=arguments,c=f[0]?f[0]:null;return this.each(function(){var d=b(this);if(a.prototype[c]&&d.data(a.prototype.name)&&
c!="initialize")d.data(a.prototype.name)[c].apply(d.data(a.prototype.name),Array.prototype.slice.call(f,1));else if(!c||b.isPlainObject(c)){var e=new a;a.prototype.initialize&&e.initialize.apply(e,b.merge([d],f));d.data(a.prototype.name,e)}else b.error("Method "+c+" does not exist on jQuery."+a.name)})}})(jQuery);
(function(b){var a=function(){};b.extend(a.prototype,{name:"EditCategory",initialize:function(a){b.each(["apply","save","saveandnew"],function(c,d){b("#toolbar-"+d+" a").bind("validate.adminForm",function(b){a.find('input[name="name"]').val()==""&&(a.find("span.message-name").css("display","block"),b.preventDefault())})})}});b.fn[a.prototype.name]=function(){var f=arguments,c=f[0]?f[0]:null;return this.each(function(){var d=b(this);if(a.prototype[c]&&d.data(a.prototype.name)&&c!="initialize")d.data(a.prototype.name)[c].apply(d.data(a.prototype.name),
Array.prototype.slice.call(f,1));else if(!c||b.isPlainObject(c)){var e=new a;a.prototype.initialize&&e.initialize.apply(e,b.merge([d],f));d.data(a.prototype.name,e)}else b.error("Method "+c+" does not exist on jQuery."+a.name)})}})(jQuery);
