function $(ID)
{
	return document.getElementById(ID);
}
function $$(Name)
{
	return eval(Name);
}

Validator =
{
	Fields		:		[],
	Status		:		1,
	ErrorId		:		"", 
	Add			:		function(Settings)
	{
		this[Settings.Name]		=	Settings;
		
		this.Fields.push(Settings.Name);
	},
	
	FastAdd		:		function(Names)
	{
		if(Names.constructor == Array)
		{
			var Total = Names.length;
			for(x=0; x<Total; x++) this.Add({Name:Names[x], Filled:1, ECC:"Error"});
		}
	},
	
	Do			:		function()
	{
		this.Status				=	1;
		this.ErrorId ? this.HideErrorDiv(this.ErrorId) : NULL;
		for(x=0; x< this.Fields.length; x++)
		{
			var Elem = this[this.Fields[x]];
			
			if(!this.Check(Elem))
			{
				this.Status		=	0;
				Elem.ECC ?	this.SetErrorClass(Elem, 1) : NULL;
			}
			else	this.SetErrorClass(Elem,0);
		}
		!this.Status ? this.ShowErrorDiv(this.ErrorId) : NULL;
		return this.Status;
	},
	Check		:		function(Elem)
	{
		if(Elem.Filled && !$(Elem.Name).value)	return 0;
		return 1;
	},
	ShowErrorDiv:		function(Name)
	{
		if(!$(Name))return;
		$(Name).style.display	=	"block";
	},
	HideErrorDiv:		function(Name)
	{
		if(!$(Name))return;
		$(Name).style.display	=	"none";
	},
	SetErrorClass:		function(Elem, What)
	{
		var Variable		=		$(Elem.Name);
		if(What)
		{
			if(Variable.parentNode.className.indexOf(Elem.ECC) ==-1) Variable.parentNode.className = Variable.parentNode.className+Elem.ECC;
		}
		else Variable.parentNode.className = Variable.parentNode.className.replace(/Error/g, "");
	}
}