function actualiza_combo(valor, caso, idcombo, path){  
	// Los datos de tdatos se obtienen de buscador.module > buscador_actualizar_combo() y le pasamos los valores id y elem
	jQuery.get(path, {id: valor, caso: caso, elem: idcombo}, function(tdatos) {
		var elementos = document.getElementById(idcombo);
		for(x=0;x<elementos.options.length;x){
			elementos.remove(elementos.options[x]);
		}
		var opcion = null;
		var dato = null;
		datos = tdatos.split(';');
		
		dato = datos[0].split(':');
		opcion=document.createElement('Option');
		opcion.appendChild(document.createTextNode(dato[1]));
		opcion.value = 0;
		elementos.appendChild(opcion);  		
	 	for (var i = 1; i < datos.length - 1; i++)
		{
			dato = datos[i].split(':');	
			opcion=document.createElement('Option');
			opcion.appendChild(document.createTextNode(dato[1]));
			opcion.value = dato[0];
			elementos.appendChild(opcion);  		
		}
		if(idcombo!='id_mes'){
			$("#interior").removeAttr("disabled");
		}
	})
	
} 

function actualiza_alojamiento(valor, caso, idcombo, path){  
	// Los datos de tdatos se obtienen de buscador.module > buscador_actualizar_combo() y le pasamos los valores id y elem
	jQuery.get(path, {id: valor, caso: caso, elem: idcombo}, function(tdatos) {
		var elementos = document.getElementById(idcombo);
		for(x=0;x<elementos.options.length;x){
			elementos.remove(elementos.options[x]);
		}
		var opcion = null;
		var dato = null;

		datos = tdatos.split(';');
	 	for (var i = 0; i < datos.length - 1; i++)
		{
		    
			dato = datos[i].split(':');	
			opcion=document.createElement('Option');
			opcion.appendChild(document.createTextNode(dato[1]));
			opcion.value = dato[0];
			elementos.appendChild(opcion);  		
		}
	})
	
} 



function actualiza_info(type, path){
	if(document.getElementById('zona_turistica')){
		var zona = document.getElementById('zona_turistica').options[document.getElementById('zona_turistica').selectedIndex].value;
	}
	if(document.getElementById('municipios')){
		var municipio = document.getElementById('municipios').options[document.getElementById('municipios').selectedIndex].value;
	}
	if(document.getElementById('zona')){
		var zona_ws = document.getElementById('zona').options[document.getElementById('zona').selectedIndex].value;
	}
	if(document.getElementById('municipio')){
		var municipio_ws = document.getElementById('municipio').options[document.getElementById('municipio').selectedIndex].value;
	}
	
    var browser=navigator.appName;
	switch(type){
	    default:
			$(document).ready(function(){
			   if(browser=="Microsoft Internet Explorer"){
			       jQuery.get(path, {type: type, zona_turistica: zona, municipios: municipio, zona: zona_ws, municipio: municipio_ws}, function(tdatos) {
				       $("#add_info").html(tdatos);
					   if(municipio==0){
							$("#interior").removeAttr("disabled");
						}else{
							$("#interior").removeAttr("checked");
							$("#interior").attr("disabled","disabled");
						}
                   },"html")
				}else{
			       jQuery.get(path, {type: type, zona_turistica: zona, municipios: municipio, zona: zona_ws, municipio: municipio_ws}, function(tdatos) {
				       $("#add_info").html(tdatos);
					   if(municipio==0){
							$("#interior").removeAttr("disabled");
						}else{
							$("#interior").removeAttr("checked");
							$("#interior").attr("disabled","disabled");
						}
                   })
				}
				$("#interior").removeAttr("disabled");
            });
		    break;
	}
}

function actualiza_interior(municipio, path){
	$(document).ready(function(){
		if(municipio==0){
			$("#interior").removeAttr("disabled");
		}else{
			$("#interior").removeAttr("checked");
			$("#interior").attr("disabled","disabled");
		}
    });
}

function actualiza_servicios(total, total_servicios, muestra , path){
	for (var i = 1; i <= total ; i++){
		elem_activo=$("#catnau"+i).attr("checked");
		elem_val=$("#catnau"+i).val();
		if((elem_activo==true) && ((elem_val==270) || (elem_val==271) || (elem_val==272) || (elem_val==273) || (elem_val==274))){
			muestra=1;
		}
	}
    var browser=navigator.appName;
	$(document).ready(function(){
		if(browser=="Microsoft Internet Explorer"){
			jQuery.post(path, {muestra: muestra}, function(tdatos) {
			    if(muestra==1){
					$("#add_servicios").css("display","block");
					$("#add_servicios").css("visibility","visible");
					//$("#add_servicios").show();
				}else{
					$("#add_servicios").css("display","none");
					for (var i = 1; i <= total_servicios ; i++){
					$("#add_servicios").css("visibility","hidden");
						elem_activo=$("#servn"+i).attr('checked', false);
					}
				}
            },"html")
		}else{
			jQuery.post(path, {muestra: muestra}, function(tdatos) {
			    if(muestra==1){
					$("#add_servicios").css("display","block");
					$("#add_servicios").css("visibility","visible");
				}else{
					$("#add_servicios").css("display","none");
					$("#add_servicios").css("visibility","hidden");
					for (var i = 1; i <= total_servicios ; i++){
						elem_activo=$("#servn"+i).attr('checked', false);
					}
				}
            })
		}
		$("#interior").removeAttr("disabled");
    });
}

