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("El email indicado no es válido")
		   return false
		}

		if (str.indexOf(at)==-1 || str.indexOf(at)==0 || str.indexOf(at)==lstr){
		   alert("The email is not valid")
		   return false
		}

		if (str.indexOf(dot)==-1 || str.indexOf(dot)==0 || str.indexOf(dot)==lstr){
		    alert("The email is not valid")
		    return false
		}

		 if (str.indexOf(at,(lat+1))!=-1){
		    alert("The email is not valid")
		    return false
		 }

		 if (str.substring(lat-1,lat)==dot || str.substring(lat+1,lat+2)==dot){
		    alert("The email is not valid")
		    return false
		 }

		 if (str.indexOf(dot,(lat+2))==-1){
		    alert("The email is not valid")
		    return false
		 }
		
		 if (str.indexOf(" ")!=-1){
		    alert("The email is not valid")
		    return false
		 }

 		 return true					
	}

function ValidateForm(){
	var emailID=document.usuarios.email
	var pass=document.usuarios.pass
	var pass2=document.usuarios.pass2
	var nombre=document.usuarios.nombre
	var apellido=document.usuarios.apellido
	var usuario=document.usuarios.usuario
	
	
	
	if (nombre.value == null || nombre.value == "")
	{
		alert('Please, type the name')
		return false
	}
	if (apellido.value == null || apellido.value == "")
	{
		alert('Please, type the lastname')
		return false
	}
	if (usuario.value == null || usuario.value == "")
	{
		alert('Please, type the username')
		return false
	}
	if (pass.value == null || pass.value == "")
	{
		alert('You must type a password')
		return false
	}
	if (pass.value != pass2.value)
	{
		alert('The password and the confirmation are not the same')
		return false
	}
	if ((emailID.value==null)||(emailID.value=="")){
		alert("Please, type the email")
		emailID.focus()
		return false
	}
	if (echeck(emailID.value)==false){
		emailID.value=""
		emailID.focus()
		return false
	}
	return true
 }

