// general ---------------------------------------------------------------------------------------------*//
function retroceder1() {window.onmousedown = history.go(-1);}

// checkbox --------------------------------------------------------------------------------------------*//

	function checkUncheckAllPueblos(theElement) {
     var theForm = theElement.form, z = 0;
	 for(z=0; z<theForm.length;z++){
      if(theForm[z].type == 'checkbox' && theForm[z].name != 'checkall'){
	  theForm.idmunicipio1.checked = theElement.checked;
	  theForm.idmunicipio2.checked = theElement.checked;
	  theForm.idmunicipio3.checked = theElement.checked;
	  theForm.idmunicipio4.checked = theElement.checked;
	  
	  }
     }
    }
		function checkUncheckAll2(theElement) {
     var theForm = theElement.form, z = 0;
	 for(z=0; z<theForm.length;z++){
      if(theForm[z].type == 'checkbox' && theForm[z].name != 'checkall'){
	  theForm.idtipo1.checked = theElement.checked;
	  theForm.idtipo2.checked = theElement.checked;
	  theForm.idtipo3.checked = theElement.checked;
	  theForm.idtipo4.checked = theElement.checked;
	  theForm.idtipo5.checked = theElement.checked;
	  }
     }
    }
		function checkUncheckAll3(theElement) {
     var theForm = theElement.form, z = 0;
	 for(z=0; z<theForm.length;z++){
      if(theForm[z].type == 'checkbox' && theForm[z].name != 'checkall'){
	  theForm.idcategoria1.checked = theElement.checked;
	  theForm.idcategoria2.checked = theElement.checked;
	  theForm.idcategoria3.checked = theElement.checked;
	  theForm.idcategoria4.checked = theElement.checked;
	  theForm.idcategoria5.checked = theElement.checked;
	  theForm.idcategoria6.checked = theElement.checked;
	  theForm.idcategoria7.checked = theElement.checked;
	  theForm.idcategoria8.checked = theElement.checked;
	  theForm.idcategoria9.checked = theElement.checked;
	  
	  }
     }
    }
	
			function checkUncheckAll4(theElement) {
     var theForm = theElement.form, z = 0;
	 for(z=0; z<theForm.length;z++){
      if(theForm[z].type == 'checkbox' && theForm[z].name != 'checkall'){
	  theForm.idactividad1.checked = theElement.checked;
	  theForm.idactividad2.checked = theElement.checked;
	  theForm.idactividad3.checked = theElement.checked;
	  theForm.idactividad4.checked = theElement.checked;
	  theForm.idactividad5.checked = theElement.checked;
	  theForm.idactividad6.checked = theElement.checked;
	  theForm.idactividad7.checked = theElement.checked;
	  theForm.idactividad8.checked = theElement.checked;
	  theForm.idactividad9.checked = theElement.checked;
	  theForm.idactividad10.checked = theElement.checked;
	  theForm.idactividad11.checked = theElement.checked;
	  
	  }
     }
    }
	
// formulario Alojamientos -----------------------------------------------------------------------------*//


function validarAlojamientos(form1)
{
var pueblos=0;
var tipos=0;


  if (form1.idmunicipio1.checked)
  {
    pueblos=1;
  }
    if (form1.idmunicipio2.checked)
  {
    pueblos=1;
  }
    if (form1.idmunicipio3.checked)
  {
    pueblos=1;
  }
    if (form1.idmunicipio4.checked)
  {
    pueblos=1;
  }
  
  if (pueblos == "0")
  {
    alert("Debe Seleccionar al menos un pueblo");
    return (false);
  }
  
  
     if (form1.idtipo1.checked)
  {
    tipos=1;
  }
    if (form1.idtipo2.checked)
  {
    tipos=1;
  }
    if (form1.idtipo3.checked)
  {
    tipos=1;
  }
    if (form1.idtipo4.checked)
  {
    tipos=1;
  }
    if (form1.idtipo5.checked)
  {
    tipos=1;
  }

   
if (tipos == "0")
  {
    alert("Debe Seleccionar al menos un tipo de alojamiento");
    return (false);

  } 
  

return (true)
}

// formulario Natural Cultural --------------------------------------------------------------------------*//


function validarNatCult(form2)
{
var pueblos=0;
var tipos=0;


  if (form2.idmunicipio1.checked)
  {
    pueblos=1;
  }
    if (form2.idmunicipio2.checked)
  {
    pueblos=1;
  }
    if (form2.idmunicipio3.checked)
  {
    pueblos=1;
  }
    if (form2.idmunicipio4.checked)
  {
    pueblos=1;
  }
  
  if (pueblos == "0")
  {
    alert("Debe Seleccionar al menos un pueblo");
    return (false);
  }
  
  
     if (form2.idcategoria1.checked)
  {
    tipos=1;
  }
    if (form2.idcategoria2.checked)
  {
    tipos=1;
  }
    if (form2.idcategoria3.checked)
  {
    tipos=1;
  }
    if (form2.idcategoria4.checked)
  {
    tipos=1;
  }
    if (form2.idcategoria5.checked)
  {
    tipos=1;
  }
      if (form2.idcategoria6.checked)
  {
    tipos=1;
  }
      if (form2.idcategoria7.checked)
  {
    tipos=1;
  }
      if (form2.idcategoria8.checked)
  {
    tipos=1;
  }
        if (form2.idcategoria9.checked)
  {
    tipos=1;
  }

   
if (tipos == "0")
  {
    alert("Debe Seleccionar al menos un tipo");
    return (false);

  } 
  
return (true)
}


// formulario Directorio de empresas --------------------------------------------------------------------------*//


function validarEmpre(form3)
{
var pueblos=0;
var tipos=0;


  if (form3.idmunicipio1.checked)
  {
    pueblos=1;
  }
    if (form3.idmunicipio2.checked)
  {
    pueblos=1;
  }
    if (form3.idmunicipio3.checked)
  {
    pueblos=1;
  }
    if (form3.idmunicipio4.checked)
  {
    pueblos=1;
  }
  
  if (pueblos == "0")
  {
    alert("Debe Seleccionar al menos un pueblo");
    return (false);
  }
  
  
     if (form3.idactividad1.checked)
  {
    tipos=1;
  }
    if (form3.idactividad2.checked)
  {
    tipos=1;
  }
    if (form3.idactividad3.checked)
  {
    tipos=1;
  }
    if (form3.idactividad4.checked)
  {
    tipos=1;
  }
    if (form3.idactividad5.checked)
  {
    tipos=1;
  }
      if (form3.idactividad6.checked)
  {
    tipos=1;
  }
      if (form3.idactividad7.checked)
  {
    tipos=1;
  }
      if (form3.idactividad8.checked)
  {
    tipos=1;
  }
        if (form3.idactividad9.checked)
  {
    tipos=1;
  }
          if (form3.idactividad10.checked)
  {
    tipos=1;
  }
          if (form3.idactividad11.checked)
  {
    tipos=1;
  }
   
if (tipos == "0")
  {
    alert("Debe Seleccionar al menos una actividad");
    return (false);

  } 
  
return (true)
}

// formulario Donde comer --------------------------------------------------------------------------*//


function validarRes(form3)
{
var pueblos=0;


  if (form3.idmunicipio1.checked)
  {
    pueblos=1;
  }
    if (form3.idmunicipio2.checked)
  {
    pueblos=1;
  }
    if (form3.idmunicipio3.checked)
  {
    pueblos=1;
  }
    if (form3.idmunicipio4.checked)
  {
    pueblos=1;
  }
  
  if (pueblos == "0")
  {
    alert("Debe Seleccionar al menos un pueblo");
    return (false);
  }
  
return (true)
}

// formulario edit_datos1 --------------------------------------------------------------------------*//

function validarDatos1(formDatos1)
{
	
  if (formDatos1.nombre.value == "")
  {
    alert("Escriba un valor para el campo \"Nombre\".");
    formDatos1.nombre.focus();
    return (false);
  }
  
    if (formDatos1.direccion.value == "")
  {
    alert("Escriba un valor para el campo \"Direccion\".");
    formDatos1.direccion.focus();
    return (false);
  }
  
      if (formDatos1.telefono.value == "")
  {
    alert("Escriba un valor para el campo \"Telefono\".");
    formDatos1.telefono.focus();
    return (false);
  }
  
        if (formDatos1.persona_contacto.value == "")
  {
    alert("Escriba un valor para el campo \"Persona de contacto\".");
    formDatos1.persona_contacto.focus();
    return (false);
  }
  
          if (formDatos1.email.value == "")
  {
    alert("Escriba un valor para el campo \"E-mail\".");
    formDatos1.email.focus();
    return (false);
  }
  
            if (formDatos1.cp.value == "")
  {
    alert("Escriba un valor para el campo \"Codigo Postal\".");
    formDatos1.cp.focus();
    return (false);
  }
  
              if (formDatos1.localidad.value == "")
  {
    alert("Escriba un valor para el campo \"Localidad\".");
    formDatos1.localidad.focus();
    return (false);
  }
  
                if (formDatos1.num_habitaciones.value == "")
  {
    alert("Escriba un valor para el campo \"Numero de habitaciones\".");
    formDatos1.num_habitaciones.focus();
    return (false);
  }
  
                  if (formDatos1.descripcion.value == "")
  {
    alert("Escriba un valor para el campo \"Descripcion\".");
    formDatos1.descripcion.focus();
    return (false);
  }
  
  
  return (true)
}