
/**
 validar form pronexo.com  v 1.0
 Este script es propiedad de pronexo.com  www.pronexo.com
 */

function echeck(str) {

		var at="@"
		var dot="."
		var lat=str.indexOf(at)
		var lstr=str.length
		var ldot=str.indexOf(dot)
		if (str.indexOf(at)==-1){
		   alert("Email mal tipeado o incorrecto")
		   return false
		}

		if (str.indexOf(at)==-1 || str.indexOf(at)==0 || str.indexOf(at)==lstr){
		   alert("Email mal tipeado o incorrecto")
		   return false
		}

		if (str.indexOf(dot)==-1 || str.indexOf(dot)==0 || str.indexOf(dot)==lstr){
		    alert("Email mal tipeado o incorrecto")
		    return false
		}

		 if (str.indexOf(at,(lat+1))!=-1){
		    alert("Email mal tipeado o incorrecto")
		    return false
		 }

		 if (str.substring(lat-1,lat)==dot || str.substring(lat+1,lat+2)==dot){
		    alert("Email mal tipeado o incorrecto")
		    return false
		 }

		 if (str.indexOf(dot,(lat+2))==-1){
		    alert("Email mal tipeado o incorrecto")
		    return false
		 }
		
		 if (str.indexOf(" ")!=-1){
		    alert("Email mal tipeado o incorrecto")
		    return false
		 }

 		 return true					
	}

	function ValidateForm(){
	var nombreID=document.datos.Nombre
	var emailID=document.datos.Email
	var telefonoID=document.datos.Telefono
	
	
	if ((nombreID.value==null)||(nombreID.value=="")){
		alert("Por favor, escriba su NOMBRE")
		nombreID.focus()
		return false
	}
	
	
	
	if ((telefonoID.value==null)||(telefonoID.value=="")){
		alert("Por favor, escriba un TELEFONO")
		telefonoID.focus()
		return false
	}
	
		
	if ((emailID.value==null)||(emailID.value=="")){
		alert("Por favor, escriba un E-MAIL")
		emailID.focus()
		return false
	}
	
	if (echeck(emailID.value)==false){
		emailID.value=""
		emailID.focus()
		return false
	}
	
	datos.Enviar.disabled = true;
    datos.Enviar.value = "Enviando..";
	return true
 }