var tagArray = new Array();
//[0] : The tag Should be Replaced | The Final Tag.
//[1] : Current Attribute | Final Attribute.
//[2] : Function to run.
var current;
var tagData;
var props;
var searchFor;

var customTag = new Class({

	initialize: function()
	{

	},
	get:function(str)
	{
		return(searchFor.getProperty(str));
	},
	register: function(element)
	{
		tagArray.push(element);
	},
	run: function()
	{
		tagArray.each(function(element)
		{
			current = element;
			$ES(String(current[0]).split('|')[0]).each(function(el)
			{
				searchFor = el;
				tagData = new Element(String(current[0]).split('|')[1]);//Creating the final tag.
				props = current[1];//Fill the Properties array.
				props.each(function(item)
				{
					if(String(item).split('|')[1] != '' && String(item).split('|')[1] != 'undefined' && searchFor.getProperty(String(item).split('|')[0]) != null && searchFor.getProperty(String(item).split('|')[0]) != '')
					{
						tagData.setProperty(String(item).split('|')[1],searchFor.getProperty(String(item).split('|')[0]));//Sets final properties.
					}
				});
				el.replaceWith(tagData);
				if(current[2] && current[2] != '')
				{
					eval(current[2]+'()');
				}
			});
		});
	}
});