// JavaScript Document

<!--
function setFocus() {
	if (document.search_name) {
		document.search_name.name.focus();
	}
}

// document.write("hello");

function focus_name(){
	document.search.name.focus();
	return;
}
	
function validate(){ 
	if ((document.search.name.value=="") &&  
	    (document.search.type.value=="") &&  
	    (document.search.address.value=="") &&  
	    (document.search.barrio.value=="") &&  
	    (document.search.district.value=="") &&  
	    (document.search.telephone.value=="") &&  
	    (document.search.mobile.value=="") &&  
	    (document.search.web.value=="") &&  
	    (document.search.email.value=="") &&  
	    (document.search.metro.value=="") &&  
	    (document.search.price.value=="") &&  
	    (document.search.service.value=="") &&  
	    (document.search.disabled.value=="") &&  
	    (document.search.vegetarian.value=="") &&  
		(document.search.vegan.value=="")){ 
		alert("Hay que rellenar al menos un campo de búsqueda"); 
		document.search.name.focus(); 
	return; 
	} 
		
// if all is valid, submit the form
	document.search_name.submit(); 

}

function validate_contact(){ 
// name validation
	if(document.email_form.name.value==""){ 
		alert("Hay que rellenar tu nombre"); 
		document.email_form.name.focus(); 
	return; 
	} 

// email validation
	if(document.email_form.email.value==""){ 
		alert("Hay que rellenar tu email"); 
		document.email_form.email.focus(); 
	return; 
	} 
		
	rexp = /^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/;
	if (!rexp.test(document.email_form.email.value)) {
		alert("¡E-mail inválido! Por favor, vuelve a escribirlo.");
		document.email_form.email.select(); 
	return;
	}
			
// subject validation
	if(document.email_form.subject.value==""){ 
		alert("hay que rellenar una tema"); 
		document.email_form.subject.focus(); 
	return; 
	} 

// message validation
	if(document.email_form.body.value==""){ 
		alert("Hay que rellenar un mensaje"); 
		document.email_form.body.focus(); 
	return; 
	} 


// if all is valid, submit the form
//	document.contact.submit(); 
	window.document.forms['email_form'].submit();	
}

//-->