function registrarUsuario(idioma) {
	nombre = document.crearUsuario.nombre_usuario.value;

	if (nombre == '') {
		if( idioma == 'en' ){
			alert("Please enter Name");
		}else{
			alert("Nombre Usuario no puede estar vacio");
		}
		return;
	}
	if ( nombre.length < 4 || nombre.length > 12 ) {
		if( idioma == 'en' ){
			alert("Name must be longer than 4 and minor than 13");
		}else{
			alert("Nombre Usuario debe tener una longitud mayor que 4 y menor que 13");
		}
		return;
	}
	password = document.crearUsuario.password.value;
	if (password == '') {
		if( idioma == 'en' ){
			alert("Please enter Password");
		}else{
			alert("Password no puede estar vacio...");
		}
		return;
	}
	if (password.length > 8) {
		if( idioma == 'en' ){
			alert("Password must be minor than 8 characters");
		}else{
			alert("Password no puede tener mas de 8 caracteres");
		}
		return;
	}
	re_password = document.crearUsuario.re_password.value;
	if (re_password == '') {
		if( idioma == 'en' ){
			alert("Please enter Password Again field.");
		}else{
			alert("El campo de chequeo de Password no puede estar vacio...");
		}
		return;
	}
	if (re_password != password) {
		if( idioma == 'en' ){
			alert("Password and Repeat Password must be equals");
		}else{
			alert("Los campos de password no son identicos");
		}
		return;
	}
	
	email =  document.crearUsuario.email.value;
	if(email == '' || email.indexOf('@') == -1 ){
		if( idioma == 'en' ){
			alert("Invalid e-mail");
		}else{
			alert("E-mail no valido.");
		}
		return;
	}
	document.crearUsuario.submit();
}

function registrarseEnGrupo(idioma){

	nombre = document.crearUsuario.nombre_usuario.value;
	if (nombre == '') {
		if( idioma == 'en' ){
			alert("Please enter Name");
		}else{
			alert("Nombre Usuario no puede estar vacio");
		}
		return;
	}
	password = document.crearUsuario.password.value;
	if (password == '') {
		if( idioma == 'en' ){
			alert("Please enter Password");
		}else{

			alert("Password no puede estar vacio...");
		}
		return;
	}
	if (document.crearUsuario.id_grupo.value == 0) {
		if( idioma == 'en' ){
			alert("Please select a Public Group");
		}else{

			alert("Debes seleccionar un grupo publico.");
		}
		return;
	}
	
	document.crearUsuario.submit();
}
function cambiarPassword(idioma) {
	nombre = document.cambiarPassword.nombre_usuario.value;

	if (nombre == '') {
		if( idioma == 'en' ){
			alert("Please enter User");
		}else{

			alert("Nombre Usuario no puede estar vacio");
		}
		return;
	}
	password = document.cambiarPassword.password.value;
	if (password == '') {
		if( idioma == 'en' ){
			alert("Please enter Password");
		}else{

			alert("Password no puede estar vacio...");
		}
		return;
	}
	new_password = document.cambiarPassword.new_password.value;
	if (new_password == '') {
		if( idioma == 'en' ){
			alert("Please enter New Password");
		}else{

			alert("El campo  de Nueva Password no puede estar vacio...");
		}
		return;
	}
	if (new_password.length > 8) {
		if( idioma == 'en' ){
			alert("New Password max lenght is 8 characters");
		}else{

			alert("El campo  de Nueva Password no puede tener mas de 8 caracteres");
		}
		return;
	}
	re_password = document.cambiarPassword.re_password.value;
	if (re_password != new_password) {
		if( idioma == 'en' ){
			alert("New Password and Password must be equals");
		}else{

			alert("Los campos de password no son identicos");
		}
		return;
	}

	document.cambiarPassword.submit();
}

function enviarConsulta(){
	nombre = document.contactaKhef.nombre.value;

	if( nombre == ''){
		alert("El campo nombre no puede ser vacio");
		return;
	}

	email = document.contactaKhef.email.value;

	if( email == ''){
		alert("El campo email no puede ser vacio");
		return;
	}

	pregunta = document.contactaKhef.msg.value;

	if( pregunta == ''){
		alert("El campo pregunta no puede ser vacio");
		return;
	}
	
	document.contactaKhef.submit();

}
function enviarConsultaIdioma(idioma){
	nombre = document.contactaKhef.nombre.value;
	if( nombre == ''){
		if( idioma == 'en' ){
			alert("Please enter your Name.");
		}else{
			alert("El campo nombre no puede ser vacio");
		}
		return;
	}

	email = document.contactaKhef.email.value;

	if( email == ''){
		if(idioma == 'en')
			alert("Please enter your e-mail");
		else
			alert("El campo email no puede ser vacio");
		return;
	}

	pregunta = document.contactaKhef.msg.value;

	if( pregunta == ''){
		if(idioma == 'en')
			alert("Please enter your Text");
		else
			alert("El campo pregunta no puede ser vacio");
		return;
	}
	
	document.contactaKhef.submit();

}

function abrirVentana(url,kk){
window.open(url,kk,'toolbar=0,width=800,height=600,directories=0,status=0,scrollbars=1,resize=0,menubar=0');
}
