function trim(cadena)
{
  return(cadena.replace(/^\s*|\s*$/g,""));
}

function validar()
{
  email         = trim(document.getElementById('correo').value);
  errorEmail = validarEmail(email);

 if(errorEmail != "")
  {
    document.getElementById('registrar').disabled=true;
	  document.getElementById('msj-error').innerHTML = errorEmail;
	  document.getElementById('registrar').style.background= '#000';
	  document.getElementById('registrar').style.color= '#394551';	
    return(false);
  }
	else
  {
    document.getElementById('registrar').disabled  = false;
	document.getElementById('msj-error').innerHTML = "";
	document.getElementById('registrar').style.background= '#1a446c';
	document.getElementById('registrar').style.color= '#fff';
    return(true);
  }
}

function presionarBoton()
{
  if(validar())
    document.getElementById('formRegistro').submit();
}

function validarEmail(email)
{
  if(email == "")
    error = "El campo Correo Electr&oacute;nico es obligatorio";
  else if(email.match(/^[-A-z0-9\.]+@([-A-z0-9]+\.){1,3}[-A-z0-9]{2,4}$/))
    error = "";
  else  
    error = "Ingresa un Correo Electr&oacute;nico v&aacute;lido";
  return(error);
}
