/**
 * class	SparkleRemover
 * author	Paul Kruijt
 */
var SparkleRemover = new Class({
	
	/**
	 * initialize
	 * @param	string	root_node_id
	 * @param	string	item_node_tag
	 * @param	string	new_class
	 * @return	void
	 */
	initialize: function(root_node_id, item_node_tag, new_class)
	{
		// nodes
		this.root_node		= $(root_node_id);
		
		// tags
		this.item_node_tag	= item_node_tag;
		
		// classes
		this.new_class	= new_class;
		
		// functions
		this.start();
	},
	
	/**
	 * start
	 * @return	void
	 */
	start: function()
	{
		if (this.root_node && this.item_node_tag && this.new_class)
		{
			
			// remove sparks
			this.remove();
		}
	},
		
	/**
	 * remove sparks
	 * @return	void
	 */
	remove: function()
	{
		// set vars
		var _this				= this;
		var item_nodes			= this.root_node.getElements(this.item_node_tag);
		var total_item_nodes	= item_nodes.length;
		
		if (total_item_nodes > 0)
		{
			item_nodes.each(function(item_node, index)
			{
				if ((index + 1) == total_item_nodes)
				{
					item_node.addClass(_this.new_class);
				}
			});
		}
	}
});
