// 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;
	  theForm.idmunicipio5.checked = theElement.checked;
	  theForm.idmunicipio6.checked = theElement.checked;
	  theForm.idmunicipio7.checked = theElement.checked;
	  theForm.idmunicipio8.checked = theElement.checked;
	  theForm.idmunicipio9.checked = theElement.checked;
	  theForm.idmunicipio10.checked = theElement.checked;
	  theForm.idmunicipio11.checked = theElement.checked;
	  theForm.idmunicipio12.checked = theElement.checked;
	  theForm.idmunicipio13.checked = theElement.checked;
	  theForm.idmunicipio14.checked = theElement.checked;
	  
	  }
     }
    }
	
		function checkUncheckAllAlojamientos(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;

	  }
     }
    }
		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(form_alojamientos){
var pueblos=0;
var tipos=0;


    if (form_alojamientos.idmunicipio1.checked)  {    pueblos=1;  }
    if (form_alojamientos.idmunicipio2.checked)  {    pueblos=1;  }
    if (form_alojamientos.idmunicipio3.checked)  {    pueblos=1;  }
    if (form_alojamientos.idmunicipio4.checked)  {    pueblos=1;  }
    if (form_alojamientos.idmunicipio5.checked)  {    pueblos=1;  }
    if (form_alojamientos.idmunicipio6.checked)  {    pueblos=1;  }
    if (form_alojamientos.idmunicipio7.checked)  {    pueblos=1;  }
    if (form_alojamientos.idmunicipio8.checked)  {    pueblos=1;  }
    if (form_alojamientos.idmunicipio9.checked)  {    pueblos=1;  }
    if (form_alojamientos.idmunicipio10.checked)  {    pueblos=1;  }
    if (form_alojamientos.idmunicipio11.checked)  {    pueblos=1;  }
   	if (form_alojamientos.idmunicipio12.checked)  {    pueblos=1;  }
    if (form_alojamientos.idmunicipio13.checked)  {    pueblos=1;  }
    if (form_alojamientos.idmunicipio14.checked)  {    pueblos=1;  }
  
  	  if (pueblos == "0")	  {
		alert("Debe Seleccionar al menos un pueblo");
		return (false);
	  }  
  
  
    if (form_alojamientos.idtipo1.checked)	{    tipos=1;  }
    if (form_alojamientos.idtipo2.checked)  {    tipos=1;  }
    if (form_alojamientos.idtipo3.checked)  {    tipos=1;  }
    if (form_alojamientos.idtipo4.checked)  {    tipos=1;  }
     
  
	if (tipos == "0")	  {
		alert("Debe Seleccionar al menos un tipo");
		return (false);
	  }  
   
  
return (true);
}

// formulario Agenda -----------------------------------------------------------------------------*//


function validarAgenda(form_elem){
var dato1=0;

    if (form_elem.idmunicipio1.checked)  {    dato1=1;  }
    if (form_elem.idmunicipio2.checked)  {    dato1=1;  }
    if (form_elem.idmunicipio3.checked)  {    dato1=1;  }
    if (form_elem.idmunicipio4.checked)  {    dato1=1;  }
    if (form_elem.idmunicipio5.checked)  {    dato1=1;  }
    if (form_elem.idmunicipio6.checked)  {    dato1=1;  }
    if (form_elem.idmunicipio7.checked)  {    dato1=1;  }
    if (form_elem.idmunicipio8.checked)  {    dato1=1;  }
    if (form_elem.idmunicipio9.checked)  {    dato1=1;  }
    if (form_elem.idmunicipio10.checked)  {    dato1=1;  }
    if (form_elem.idmunicipio11.checked)  {    dato1=1;  }
   	if (form_elem.idmunicipio12.checked)  {    dato1=1;  }
    if (form_elem.idmunicipio13.checked)  {    dato1=1;  }
    if (form_elem.idmunicipio14.checked)  {    dato1=1;  }
  
  	  if (dato1 == "0")	  {
		alert("Debe Seleccionar al menos un pueblo");
		return (false);
	  }  
	  
  
  
/*var form = form_elem;
	if (form.fechaaux1.value == "Pulse aquí -->") {
	alert ("esta vacio el campo \""+form.fechaaux1.id+"\"");
	focus (form.fechaaux1.id);
	return (false);
	}
	
		if (form.fechaaux2.value == "Pulse aquí -->") {
	alert ("esta vacio el campo \""+form.fechaaux2.id+"\"");
	focus (form.fechaaux2.id);
	return (false);
	}*/

   
  
return (true);
}

// formulario patrimonio cultural--------------------------------------------------------------

function validarAlojamientosPtr(form_alojamientos){
var pueblos=0;
var tipos=0;


    if (form_alojamientos.idmunicipio1.checked)  {    pueblos=1;  }
    if (form_alojamientos.idmunicipio2.checked)  {    pueblos=1;  }
    if (form_alojamientos.idmunicipio3.checked)  {    pueblos=1;  }
    if (form_alojamientos.idmunicipio4.checked)  {    pueblos=1;  }
    if (form_alojamientos.idmunicipio5.checked)  {    pueblos=1;  }
    if (form_alojamientos.idmunicipio6.checked)  {    pueblos=1;  }
    if (form_alojamientos.idmunicipio7.checked)  {    pueblos=1;  }
    if (form_alojamientos.idmunicipio8.checked)  {    pueblos=1;  }
    if (form_alojamientos.idmunicipio9.checked)  {    pueblos=1;  }
    if (form_alojamientos.idmunicipio10.checked)  {    pueblos=1;  }
    if (form_alojamientos.idmunicipio11.checked)  {    pueblos=1;  }
   	if (form_alojamientos.idmunicipio12.checked)  {    pueblos=1;  }
    if (form_alojamientos.idmunicipio13.checked)  {    pueblos=1;  }
    if (form_alojamientos.idmunicipio14.checked)  {    pueblos=1;  }
  
  	  if (pueblos == "0")	  {
		alert("Debe Seleccionar al menos un pueblo");
		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 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)
}

// formulario edit_datos1 en privado --------------------------------------------------------------------------*//

function validarDatos2(formDatos1)
{
	
  if (formDatos1.alojamiento.value == "")
  {
    alert("Escriba un valor para el campo \"Alojamiento\".");
    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)
}
