// JavaScript Document
function checkForm() {  

		erroresValidacion = [];
		var msg = "";


		msg += checkRequired($("nombre"));			
		msg += checkRequired($("email"));												
		msg += checkEmail($("email"));	
		if(document.getElementById("categoria").value=='0'){
			var hotel=0;
		}		
		else{
			var hotel=1;
		}
		msg += checkRequired($("comentarios"));						
				
		if((msg == "")&&(hotel==1)) {
			document.forms[0].submit();
			return true;
		} else {
			alert(getListadoErrores(hotel));
			return false;
		}
}

	function getListadoErrores(hotel) {
		var lst = erroresValidacion;
		var str = "";
		var dots = "";
		for(var i=0;i<lst.length;i++) {
			if(lst[i].nombreControl == "") dots = "";
			else dots = " ";
			str += '- ' + lst[i].nombreControl + dots + lst[i].error + '\n';
		}
		if(hotel==0){
			str +="-"+" Por favor, seleccione un hotel";
		}
		return str;
	}