var ExpFav = Class.create();

ExpFav.prototype = {
	initialize: function(element){
		this.button = element;
		Event.observe(this.button , 'click' , this.send.bindAsEventListener(this));
	},

	send: function(event) {
		Event.stop(event);

		var id = Element.down(this.button , 'span').innerHTML;
		Element.hide(Element.up(this.button , 'tr'));

		new Ajax.Request('/favorites/delete/id/' + id , {
				onSuccess: function(transport) {
					Element.remove(Element.up(this.button , 'tr'));
				}.bind(this)
		});

		return false;
	}
}

Event.observe(window , 'load' , function() {
	$$('a.favDel').each(function (e) {
		new ExpFav(e);
	});
});
