var $j = jQuery.noConflict();
		function cargaLightBoxComponente(componente) {
			$j(componente).lightBox();
		}
		function limpiaInputText (id){
			document.getElementById(id).value="";
		}
		function BuscadorSel(selec){
			if(selec == 'true'){
        	 	document.getElementById('hoteles').checked = true;
          		cambiarbuscador('false');
         	}
		}
		
     	function cambiarbuscador(restaurantes){
	   		if(restaurantes == 'true'){ //Si hemos seleccionado restaurantes ocultamos el criterio de busqueda de los hoteles
	   	 		var Resultado = document.getElementById('busquedarestaurantes'); <!-- ocultamos hoteles y ponemos restaurantes -->
		 		Resultado.style.visibility = 'visible';
			 	var Resultado2 = document.getElementById('busquedahoteles'); 
 		 		Resultado2.style.visibility = 'hidden'; 
	   		}
	   		else{
		 		var Resultado = document.getElementById('busquedarestaurantes'); <!-- ocultamos restaurantes y ponemos hoteles -->
			 	Resultado.style.visibility = 'hidden';
		 		var Resultado2 = document.getElementById('busquedahoteles'); 
 		 		Resultado2.style.visibility = 'visible'; 		 	
			}
	  	}

	  	function cargaCombosDeOtroPortal(provincia, comarca, municipio) {		  	
	  		if (document.getElementById('provincia').disabled == true && provincia != -1 && comarca != -1 && municipio != -1){
    			setTimeout('cargaCombosDeOtroPortal('+provincia+', '+comarca+', '+municipio+');',1000);
        	} else {
		  	     selectCombosValue(provincia, comarca, municipio);
        	}
		}

	  	function cargaCombo(elemento,idCombo,idPadre,cadenaInicial){		
	  		cargaCombo(elemento,idCombo,idPadre,cadenaInicial, null);
	  	}
	  	
     	function cargaCombo(elemento,idCombo,idPadre,cadenaInicial, value){		
    		var objCombo = document.getElementById(idCombo);
    		var url="jsp/portal/utilidades/elementos.jsp?elemento="+elemento+"&id="+idPadre;
    		borraCombo(idCombo,cadenaInicial);    		
    		$j.getJSON(url,function(data){			
    			var jsonObject = data;
    			var i=1;
    			if (cadenaInicial.length==0){
    				i=0;
    			}			
    			
    			for(var element in jsonObject.elementos){
    				objCombo.options[i++]= new Option(jsonObject.elementos[element].value, jsonObject.elementos[element].key);    						
    			}
    			
    			objCombo.disabled= false;		
    			if(value != null && value != ''){
    				objCombo.selectedIndex = devuelveIndiceCombo(objCombo,value);
    			}
    	    }
    	   );		
    	}

    	function borraCombo(idCombo,cadenaInicial){
    		var objCombo = document.getElementById(idCombo);
    		objCombo.disabled= true;
    		var i;
    		for(i=objCombo.options.length-1;i>=0;i--)
    		{	objCombo.remove(i);	}		
    		if (cadenaInicial.length > 0){
    			objCombo.options[0]= new Option(cadenaInicial,-1);
    		}
    	}

    	function inicializaVisorGoogle(coordenadaX, coordenadaY) {
            initialize(coordenadaX, coordenadaY);
       }


    	function devuelveIndiceCombo(combo,valor){
			var op = combo.options;
			var l = combo.length;
			var i = 0;
			for (i=0;i<l;i++){
				if (op[i].value == valor){
					break;
				}
			}
			return i;
		} 

    	
    	function selectCombosValue(provincia, comarca, municipio){
        		
        		if (document.getElementById('provincia').disabled == true && provincia!= -1 && municipio!= -1){
        			setTimeout('selectCombosValue('+provincia+', '+comarca+', '+municipio+');',1000);
            	} else {
    				var control;
	    			control= document.getElementById('provincia');
	    			control.selectedIndex = devuelveIndiceCombo(control,provincia);    		
	    			control.onchange();    		
	    			setTimeout('seleccionaComarca('+comarca+','+municipio+');',1000);
            	}
    	}


    	function seleccionaComarca(comarca,municipio){
        	var comboC;
        	
    		comboC = document.getElementById("comarca");
    		if (comboC.length < 2 && comarca != -1 ){
    			setTimeout('seleccionaComarca('+comarca+','+municipio+');',1000);
    		}  
    		comboC.selectedIndex = devuelveIndiceCombo(comboC,comarca);
    		comboC.onchange();
    		if(comarca != -1 ){
    			setTimeout('seleccionaMunicipio('+municipio+');',1000);
    		}    		
    	}

    	function seleccionaMunicipio(municipio){
    			
    		var comboM;
    		comboM = document.getElementById("municipio");
    		if (comboM.length < 2 && municipio != -1){
    			setTimeout('seleccionaMunicipio('+municipio+');',1000);
    		}
    		comboM.selectedIndex = devuelveIndiceCombo(comboM,municipio);
    	}

    	function limpiarTodosLosCombos() {
        	selectCombosValue(-1,-1,-1); 
        	document.getElementById("categoriaRestaurantes").selectedIndex = 0;
        	document.getElementById("tipoRestaurantes").selectedIndex = 0;
        	document.getElementById("categoriaHoteles").selectedIndex = 0;
        	document.getElementById("tipoHoteles").selectedIndex = 0;
        	document.getElementById("precio").selectedIndex = 0;
        	document.getElementById("habitaciones").selectedIndex = 0;
    	}

    	function restablecerTodosLosCombosHoteles(provincia,comarca,municipio,categoriaHoteles,tipoHoteles,precio,habitaciones) {
    		document.getElementById("hoteles").checked = true;
    		cambiarbuscador('false');
        	selectCombosValue(provincia,comarca,municipio);
        	document.getElementById("categoriaHoteles").selectedIndex = devuelveIndiceCombo('categoriaHoteles',categoriaHoteles);
        	document.getElementById("tipoHoteles").selectedIndex = devuelveIndiceCombo('tipoHoteles',tipoHoteles);
        	document.getElementById("precio").selectedIndex = devuelveIndiceCombo('precio',precio);
        	document.getElementById("habitaciones").selectedIndex = devuelveIndiceCombo('habitaciones',habitaciones); 
    	}

    	function restablecerTodosLosCombosRestaurantes(provincia,comarca,municipio,categoriaRestaurantes,tipoRestaurantes) {
    		document.getElementById("restaurantes").checked = true;
    		cambiarbuscador('true');
        	selectCombosValue(provincia,comarca,municipio);
        	document.getElementById("categoriaRestaurantes").selectedIndex = devuelveIndiceCombo('categoriaRestaurantes',categoriaRestaurantes);
        	document.getElementById("tipoRestaurantes").selectedIndex = devuelveIndiceCombo('tipoRestaurantes',tipoRestaurantes);
    	}
