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

Zoo.ElementRepeatableTextarea=Zoo.ElementRepeatable.extend({initialize:function(b){this.setOptions({element:"",msgDeleteElement:null},b);this.element=$(this.options.element);this.list=this.element.getElement("ul.repeatable-list");this.hiddens=this.list.getElements("li.hidden");this.hiddens.each(function(a){a.getElements("*").each(function(c){if(c.getProperty("name")){c.__name=c.getProperty("name");c.setProperty("name","")}})});this.element.getElements("li.repeatable-element").each(function(a){a.getElement("div.delete").addEvent("click",
function(){this.deleteElement(a)}.bind(this))}.bind(this));this.add=this.element.getElement("div.add");this.add.addEvent("click",function(){this.addElement()}.bind(this))},addElement:function(){var b=this.hiddens.shift().removeClass("hidden");this.hiddens.remove(b);b.getElements("*").each(function(a){a.__name&&a.setProperty("name",a.__name)});this.highlight(b);this.hiddens.length==0&&this.add.setStyle("display","none")}});Zoo.ElementRepeatableTextarea.implement(new Options); 
