// JavaScript Document
function ClassForm()
{
	this.error = null;
	this.HTML = '';
	
	this.verifMail = function (value)
	{
		var regexp = /^[a-zA-Z0-9][a-zA-Z0-9\_\.\-]*\@([a-zA-Z0-9]{1,}[a-zA-Z0-9\-\_]*\.)+[a-zA-Z]{2,}$/;
  	return regexp.test(value);		
	}
	
	this.isEmpty = function(value)
	{
		return (value=='');
	}
	
	this.errorHTML = function (value)
	{
		var tempGen = new ClassGeneral();
		this.texHTML='';
		for (i=0;i<value.length;i++)
		{
			tempGen.changeClass(value[i][2],'errorInput');
			if (value[i][1]==0)
					this.texHTML += 'Campo <strong>"' + value[i][0] +'"</strong> no puede ser vacio<br>';
			else
					this.texHTML += 'Campo <strong>"' + value[i][0] +'"</strong> no es una direccion de email valida<br>';
		}
	}
	
	
	this.verifData = function(data)
	{
		var tempGen = new ClassGeneral();
		this.error=new Array();
		for (i=0;i<data.length;i++)
		{
			tempGen.changeClass(data[i][0],'');
			if (data[i][2]==null)
					{
					if (this.isEmpty(document.getElementById(data[i][0]).value))
							this.error[this.error.length] = new Array(data[i][1],0,data[i][0]);
					}
			else
					if (eval('this.'+data[i][2]+'("'+document.getElementById(data[i][0]).value+'")')==false)
							this.error[this.error.length] = new Array(data[i][1],1,data[i][0]);
		}
		
		
		if (this.error.length>0)
				{
					var ObjTmGen = new ClassGeneral();
						
					this.errorHTML(this.error);
					ObjTmGen.createBox(this.texHTML);	
					return false;
				}
		else
				return true;
		
	}
}