window.addEvent('domready',function(){
	/*
	global lang!
	*/
	
});



/* validaciones */
function validarReserva(f, type) {
	var nombre = $(type + "-nombre").value;
	var apellidos = $(type + "-apellidos").value;
	var email = $(type + "-email").value;
	var telefono = $(type + "-telefono").value;
	var fecha = $(type + "-fecha").value;
	var hora = $(type + "-hora").value;
	var comensales = $(type + "-comensales").value;
	var evento = $(type + "-evento").value;
	var observaciones = $(type + "-observaciones").value;
	var como = $(type + "-como").value;
	var privacidad = $(type + "-privacidad").checked;
	
	if (type == "bar") {
		lugar = "Bar ML";
		var privacidad = $("bar-privacidad").checked;
	}
	if (type == "casa") {
		lugar = "Casa ML";
		var privacidad = $("casa-privacidad").checked;
	}
	
	if (privacidad) {
		if (nombre != "" && fecha != "" && comensales != "" && email != "" && telefono != "") {
			f.submit();
		} else {
			alert("Debe completar los campos obligatorios");
		}
	} else {
		alert("Debe aceptar la politica de privacidad");
	}
	
}

function validarSatisfaccion(f, type) {
	
	var servicio = "";
	var productos = "";
	var calidad = "";
	var instalaciones = "";
	var limpieza = "";
	var general = "";
	
	var allChecked = true;
	var collectionPath = "#f-satisfaccion-" + type + " table tr td input.eval";
	var evaluation = $$(collectionPath);
	evaluation.each(function(option) {
		
		if (option.checked) {
			switch (option.name) {
				case "servicio":
					servicio = option.value;
					break;
				case "productos":
					productos = option.value;
					break;
				case "calidad":
					calidad = option.value;
					break;
				case "instalaciones":
					instalaciones = option.value;
					break;
				case "limpieza":
					limpieza = option.value;
					break;
				case "general":
					general = option.value;
					break;
			}
		}
	});
	
	var observaciones = $(type + "-satisfaccion-observaciones").value;
	
	var privacidad = $(type + "-satisfaccion-privacidad").checked;
	
	if (type == "bar") {
		lugar = "Bar ML";
	}
	if (type == "casa") {
		lugar = "Casa ML";
	}
	if (type == "catering") {
		lugar = "Catering ML";
	}
	
	if (privacidad) {
		if (allChecked) {
			f.submit();
		} else {
			alert("Debe indicar una valoracion en todos los campos");
		}
	} else {
		alert("Debe aceptar la politica de privacidad");
	}
	
}

function validarContacto(f, type) {
	var nombre = $(type + "-nombre").value;
	var email = $(type + "-email").value;
	var consulta = $(type + "-consulta").value;
	var privacidad = $(type + "-privacidad").checked;
	
	if (type == "bar") {
		lugar = "Bar ML";
		var privacidad = $("bar-privacidad").checked;
	}
	if (type == "casa") {
		lugar = "Casa ML";
		var privacidad = $("casa-privacidad").checked;
	}
	if (type == "catering") {
		lugar = "Catering ML";
		var privacidad = $("catering-privacidad").checked;
	}
	
	if (privacidad) {
		if (nombre != "" && consulta != "") {
			f.submit();
		} else {
			alert("Debe completar los campos obligatorios");
		}
	} else {
		alert("Debe aceptar la politica de privacidad");
	}
}


