
window.onload = darFoco;

function darFoco(){
	if(document.frmSend.parEmail != undefined)
		document.frmSend.parEmail.focus();
}


function esEmail(argvalue) {

  if (argvalue.indexOf(" ") != -1)
    return false;
  else if (argvalue.indexOf("@") == -1)
    return false;
  else if (argvalue.indexOf("@") == 0)
    return false;
  else if (argvalue.indexOf("@") == (argvalue.length-1))
    return false;

  return true;

}

function estaVacio(texto){
	if (texto == null || texto == ""){ 
		return true;
	}
	return false;
}

function validarDatos(theForm){
	if(estaVacio(theForm.parEmail.value)){
		alert("Ingrese correo electronico");
		theForm.parEmail.focus();
		return false;		
	}else if(!esEmail(theForm.parEmail.value)){
		alert("Correo electronico no valido");
		theForm.parEmail.focus();
		return false;		
	}
	
	theForm.parEmail.value = theForm.parEmail.value.toLowerCase();
	return true;
	
}

function recuperar(theForm){
    if(validarDatos(theForm)){
         theForm.submit();
    }
}

function salir(theForm,pagAnt){
	theForm.action = pagAnt;
	theForm.submit();
}	
