//------------------------------ CLASE MailValidator-------------------------/

MailValidator = function (nombre)
{
	this.Validator = Validator;
	this.Validator(nombre);
	this.nombre= nombre;
	this.mensaje = ' (El email debe ser del estilo nombre@dominio.extension)';
}
MailValidator.prototype = new Validator();
MailValidator.prototype.validateOld = MailValidator.prototype.validate

MailValidator.prototype.validate = function ()
{
	var valor=document.getElementById(this.nombre).value;
	if (this.isEmail(valor))
		{return true;}
	else
		{return false;}
}

MailValidator.prototype.isEmail = function (valor)
{
  var str = valor;
  //se deben soportar las expresiones regulares.
  var supported = 0;

  if (window.RegExp) {
    var tempStr = "a";
    var tempReg = new RegExp(tempStr);
    if (tempReg.test(tempStr)) supported = 1;
  }
  if (!supported) 
    return (str.indexOf(".") > 2) && (str.indexOf("@") > 0);
	var r = new RegExp("^([\\w\\-\\.]+)@((\\[([0-9]{1,3}\\.){3}[0-9]{1,3}\\])|(([\\w\\-]+\\.)+)([a-zA-Z]{2,4}))$");
  return (r.test(str));
}

MailValidator.prototype.getMensaje = function() {
	return this.mensaje;
}
