function validar(cual){
	if(eval('document.'+cual).nombre.value==''){
		alert('enter your name');
		eval('document.'+cual).nombre.focus();
		return;
	}
	if(eval('document.'+cual).email.value==''){
		alert('enter your email');
		eval('document.'+cual).email.focus();
		return;
	}
	if(!Emailcheck(eval('document.'+cual).email.value)) {
		alert("enter your email correctly");
		eval('document.'+cual).email.focus();
		return;
	}
	if(eval('document.'+cual).telefono.value==''){
		alert('enter your phone');
		eval('document.'+cual).telefono.focus();
		return;
	}
	if(eval('document.'+cual).direccion.value==''){
		alert('enter your address');
		eval('document.'+cual).direccion.focus();
		return;
	}
	if(eval('document.'+cual).ciudad.value==''){
		alert('enter your city');
		eval('document.'+cual).ciudad.focus();
		return;
	}
	if(eval('document.'+cual).provincia.value==''){
		alert('enter your state');
		eval('document.'+cual).provincia.focus();
		return;
	}
	if(eval('document.'+cual).pais.value==''){
		alert('enter your country');
		eval('document.'+cual).pais.focus();
		return;
	}
	if(eval('document.'+cual).comentarios.value==''){
		alert('enter your comments');
		eval('document.'+cual).comentarios.focus();
		return;
	}
	eval('document.'+cual).submit();
}
function Emailcheck(str) {
	var at="@"
	var dot="."
	var lat=str.indexOf(at)
	var lstr=str.length
	var ldot=str.indexOf(dot)
	if (str.indexOf(at)==-1){ return false }
	if (str.indexOf(at)==-1 || str.indexOf(at)==0 || str.indexOf(at)==lstr){ return false }
	if (str.indexOf(dot)==-1 || str.indexOf(dot)==0 || str.indexOf(dot)==lstr){ return false }
	if (str.indexOf(at,(lat+1))!=-1){ return false }
	if (str.substring(lat-1,lat)==dot || str.substring(lat+1,lat+2)==dot){ return false }
	if (str.indexOf(dot,(lat+2))==-1){ return false }
	if (str.indexOf(" ")!=-1){ return false }
	ext=str.substring(ldot+1)
	for(ind=0; ind < ext.length; ind++){
		letra=ext.charAt(ind)
		if(!letra.match(/[a-zA-Z]/)){
			if(letra != '.'){
				return false
			}
		}
	}
	return true
}
var array_avisos = new Array();
array_avisos[0]='incorrect, please try again';
array_avisos[1]='user not found, please try again';
array_avisos[2]='we send your password via email';
function validar_usuario(cual){
	if(eval('document.'+cual).user.value==''){
		alert('your user');
		eval('document.'+cual).user.focus();
		return;
	}
	if(!Emailcheck(eval('document.'+cual).user.value)) {
		alert("enter the user correctly");
		eval('document.'+cual).user.focus();
		return;
	}
	if(eval('document.'+cual).pass.value==''){
		alert('your password');
		eval('document.'+cual).pass.focus();
		return;
	}
	eval('document.'+cual).accion.value='login';
	eval('document.'+cual).submit();
}
function recordar_pass(cual){
	if(eval('document.'+cual).user.value==''){
		alert('enter the user and we will send your password via email');
		eval('document.'+cual).user.focus();
		return;
	}
	if(!Emailcheck(eval('document.'+cual).user.value)) {
		alert("enter the user correctly and we will send your password via email");
		eval('document.'+cual).user.focus();
		return;
	}
	eval('document.'+cual).accion.value='recordar';
	eval('document.'+cual).submit();
}
function avisos(cual){
	alert(array_avisos[cual]);
}
