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

(function(a){var b=function(){};a.extend(b.prototype,{name:"ElementRepeatableTextarea",options:{msgDeleteElement:null},initialize:function(b,d){this.options=a.extend({},this.options,d);var c=b.find("ul.repeatable-list");c.find("li.hidden").each(function(){a(this).find("*").each(function(){a(this).attr("name")&&(a(this).data("name",a(this).attr("name")),a(this).attr("name",""))})});b.delegate("span.delete","click",function(){a(this).closest("li.repeatable-element").fadeOut(200,function(){a(this).remove()})});
b.find("p.add a").bind("click",function(){var b=a(c.find("li.hidden").get(0)).removeClass("hidden");b.find("*").each(function(){a(this).data("name")&&a(this).attr("name",a(this).data("name"))});b.find("div.repeatable-content").effect("highlight",{},1E3);c.find("li.hidden").length==0&&a(this).parent().hide()})}});a.fn[b.prototype.name]=function(){var e=arguments,d=e[0]?e[0]:null;return this.each(function(){var c=a(this);if(b.prototype[d]&&c.data(b.prototype.name)&&d!="initialize")c.data(b.prototype.name)[d].apply(c.data(b.prototype.name),
Array.prototype.slice.call(e,1));else if(!d||a.isPlainObject(d)){var f=new b;b.prototype.initialize&&f.initialize.apply(f,a.merge([c],e));c.data(b.prototype.name,f)}else a.error("Method "+d+" does not exist on jQuery."+b.name)})}})(jQuery);
