// JavaScript Document
function valida_busca() {
	if (document.fbusca.clave.value == "" || document.fbusca.clave.value == "Write the word to search"){
		alert ("Please write a word to search");
		return false;
	}else {
		document.forms.fbusca.submit ();
		return true;
	}
}
function valida_userpass() {
	if (document.formalog.usuario.value == "" || document.formalog.usuario.value == "User" || document.formalog.password.value == "" || document.formalog.password.value == "password"){
		alert ("Please write youe user and password");
		return false;
	}else {
		document.forms.formalog.submit ();
		return true;
	}
}
function validareg() {
	if (document.freg.nombre.value == "" || document.freg.nombre.value == "Nombre" || document.freg.apellidopaterno.value == "" || document.freg.apellidopaterno.value == "Apellido" || document.freg.mail.value == "" || document.freg.mail.value == "E-Mail" || document.freg.usuario.value == "" || document.freg.usuario.value == "Usuario" || document.freg.pass.value == "" || document.freg.rep_pass.value == "" || document.freg.sexo.value == "" || document.freg.dia.value == "" || document.freg.mes.value == "" || document.freg.anio.value == ""){
		alert ("All fields are MANDATORY");
		return false;
	} else {
		if (document.freg.pass.value == document.freg.rep_pass.value) {
			if (document.freg.aceptar.checked) {
				document.forms.freg.submit ();
				return true;			
			}else{ 
				alert('Please accept the SERVICE CONTRACT');
				return false;
			}
		} else { 
			alert('Password fields should match');
			return false;
		}
	}
}
function validapersonal() {
	if (document.fpass.antpass.value == "" || document.fpass.pass.value == "" || document.fpass.reppass.value == ""){
		alert ("To modify you password you must fill all the fields");
		return false;
	}else{
		if (document.fpass.pass.value.length<6){
			alert ("Password should have at least 6 characters");
			return false;
		}
		if (document.fpass.pass.value == document.fpass.reppass.value) {
			document.forms.fpass.submit ();
			return true;			
		} else { 
			alert('Password fields should match');
			return false;
		}
	}
}
function valida_anuncio() {
	if (document.myform.titulo.value == "" || document.myform.url.value == "" || document.myform.nombre.value == "" || document.myform.domicilio.value == "" || document.myform.ciudad.value == "" || document.myform.estado.value == "" || document.myform.cp.value == "" || document.myform.telefono.value == "" || document.myform.email.value == "" || document.myform.message.value.length<1){
		alert ("Marked fields are mandatory");
		return false;
	}else{
		document.forms.myform.submit ();
		return true;
	}
}

function valida_premium() {
	if (document.fpremium.nombre.value == "" || document.fpremium.sector.value == "" || document.fpremium.mail.value == "" || document.fpremium.tel.value == ""){
		alert ("Marked fields are mandatory");
		return false;
	}else{
		document.fpremium.myform.submit ();
		return true;
	}
}

function valida_contacto() {
	if (document.fcontacto.nombre.value == "" || document.fcontacto.mail.value == "" || document.fcontacto.tel.value == ""){
		alert ("Marked fields are mandatory");
		return false;
	}else{
		document.fcontacto.submit ();
		return true;
	}
}
