var DomainList = ObjClass.extend({
	$html: null,
	$cleanBtn: null,
	init: function(conf)
	{
		var $this = this;
		
		this.$html = $(conf.$html);
		
		this.$cleanBtn = $(conf.$cleanBtn).click(function()
		{
			$this.removeAll();
			return false;
		});
		
		this.$html.closest("form").submit(function()
		{
			return false;
		});
	},
	addItem: function(data)
	{
		var $this = this;
		this.openBox();
		if($("#dli_" + data.name).size()==0)
		{
			var $li = $("<li>",
			{
				id: "dli_" + data.name,
				text: " " + data.name + ".com.ar"
			});
			
			var $deleteHandler = $("<a>",
			{
				href: "#",
				click: function(){
					$this.removeItem(this);
					return false;
				},
				text: "x"
			}).prependTo($li);
								
			this.$html.append($li);
		}
	},
	removeItem: function(a)
	{
		$(a).closest("li").remove();
		if(this.$html.find("li").size() == 0)
			this.closeBox();
		return false;
	},
	removeAll: function()
	{
		this.$html.empty();
		this.closeBox();
	},
	openBox: function()
	{
		this.$html.closest(".resultBox").slideDown("slow");
	},
	closeBox: function()
	{
		this.$html.closest(".resultBox").slideUp("slow");
	}
});
