
RAIZ = "/";

/*********************************************************************************/
/* Crea y envia el elemento HTTPRequest además indica la funcion que va a        */
/* procesar el resultado 														 */
/*********************************************************************************/
function enviarPeticion(url, valores, funcion){
	var params = valores;
	//Send the proper header information along with the request
	if (window.XMLHttpRequest) {
	    // Si IE7, Mozilla, Safari, y demás: Usa native object.
		peticion = new XMLHttpRequest();
		peticion.onreadystatechange = funcion;
		peticion.open("POST", url, true);
		peticion.setRequestHeader('Content-Type','application/x-www-form-urlencoded');
		peticion.setRequestHeader("Content-length", valores.length);
		peticion.setRequestHeader("Connection", "close");
		peticion.send(params);
	}
	else
	{
	  if (window.ActiveXObject) {
	     // sino, usa ActiveX control for IE5.x and IE6.
	     peticion = new ActiveXObject('MSXML2.XMLHTTP.3.0');
		 if(peticion){
			peticion.onreadystatechange = funcion;
			peticion.open("POST", url, true);
			peticion.setRequestHeader('Content-Type','application/x-www-form-urlencoded');
			peticion.setRequestHeader("Content-length", valores.length);
			peticion.setRequestHeader("Connection", "close");
			peticion.send(params);
		 }
	  }
	}
}


/*********************************************************************************/
/* Crea el objeto DOM en función de la version del navegador 					 */
/*********************************************************************************/
function creaDocumento(){
	//Creo array de versiones
	var aVersion = ["MSXML2.DOMDocument.6.0", "MSXML2.DOMDocument.5.0",
			"MSXML2.DOMDocument.4.0","MSXML2.DOMDocument.3.0",
			"MSXMI.2.DOMDocument", "Microsoft.XmlDom"];
	//Recorro en búsqueda
	for (var i =0;i < aVersion.length; i++) {
		try {
			var oXmlDom = new ActiveXObject (aVersion[i]);
			//alert("DATOS");
			//consola(aVersion[i]);
			return oXmlDom;
		}
		catch (oError){
			alert(oError.description);
			//consola(oError.description + " " + oError);
		}
	}
	throw new Error("MSXML no está instalado");
}


/*********************************************************************************/
/* Funcion asociada con el rbutton para cargar zonas desde la base de datos      */
/*********************************************************************************/
function cargaZona(){

	document.getElementById('selec1').style.display = "block";
	document.getElementById('selec2').style.display = "none";
	//document.getElementById('redbuscar').style.display = "none";
	
	document.getElementById('select1').options[0].text = "Seleccione Comunidad";
	
	enviarPeticion( RAIZ + 'COMUN/clases/zonas.asp','accion=seleccionarxml', procesarZonas);
}


/*********************************************************************************/
/* Funcion asociada con el rbutton para cargar servicios desde la base de datos  */
/*********************************************************************************/
function cargaServ(){

	document.getElementById('selec1').style.display = "block";
	document.getElementById('selec2').style.display = "none";
	//document.getElementById('redbuscar').style.display = "none";
	
	document.getElementById('select1').options[0].text = "Seleccione Servicio";
	
	enviarPeticion( RAIZ + 'COMUN/clases/servicios.asp','accion=seleccionarxml', procesarServicios);
}


/*********************************************************************************/
/* Funcion asociada con el boton buscar para cargar centros desde la bd 		 */
/*********************************************************************************/
function cargaCent(){
	//ZONAS
	if (document.getElementById('zonaserv1').checked == true && 
		document.getElementById('select1').selectedIndex > 0) {
		
		enviarPeticion( RAIZ + "COMUN/clases/centros.asp","accion=seleccionarcondicionalxml&valores=*&condicion=zonas_idzonas="+document.getElementById("select1").options[document.getElementById("select1").selectedIndex].value, procesarCentros);
	}
	else
	//SERVICIOS
	if (document.getElementById('zonaserv2').checked == true && 
		document.getElementById('select1').selectedIndex > 0 &&
		document.getElementById('select2').selectedIndex > 0) {
		
		//enviarPeticion("/WEBS3/COMUN/clases/centros.asp","accion=seleccionarcondicionalxml&valores=*&condicion=zonas_idzonas="+document.getElementById("select2").options[document.getElementById("select2").selectedIndex].value, procesarCentros);
		enviarPeticion( RAIZ + "COMUN/clases/centros.asp","accion=seleccionarcondicionalxml&valores=*&condicion=" + encodeURIComponent("idCENTRO IN(SELECT CENTROS_IDCENTRO FROM CENTROS_HAS_SERVICIOS WHERE SERVICIOS_IDSERVICIO = " + document.getElementById("select1").options[document.getElementById("select1").selectedIndex].value + ") AND ZONAS_idZONAS = " + document.getElementById("select2").options[document.getElementById("select2").selectedIndex].value), procesarCentros);
	}
	else
	//ERROR?
		alert('Debes seleccionar zonas o servicios.');
}


/*********************************************************************************/
/* Procesa el resultado del HTTPRequest enviado desde cargaZona() 				 */
/*********************************************************************************/
function procesarZonas(){ 
	// if peticion está cargada
	if (peticion.readyState == 4){
		// si "OK"
		if(peticion.status == 200){
			//Seleccionamos la version del navegador ya que de ello depende ***
			//el uso de un tipo de objeto DOM u otro **************************
			if(window.ActiveXObject){ //SI Internet Explorer
				var xmlDocument = creaDocumento(); //Creamos el documento que se va a encargar del fichero xml
				try{//Tratamos de capturar un posible error, en el supuesto de que se produzca
					var texto = peticion.responseText; //Asignamos la respuesta a variable
					xmlDocument.loadXML(texto); //Cargamos el texto en un tipo DOM xml
					//Limpiamos el combo del contenido que tenga actualmente
					document.getElementById("select1").options.length = 0;
					document.getElementById("select1").width = 110;
					
					var nuevaOpcion=document.createElement("option"); 
					nuevaOpcion.value = 0; 
					nuevaOpcion.innerHTML = 'Seleccione Comunidad';
					document.getElementById("select1").appendChild(nuevaOpcion);
					
					//Insertamos los datos en el combobox
					//recorriendo los tags del documento XML implementado
					for (i=0; i<xmlDocument.getElementsByTagName('zona').length; i++){
						//Creamos las distintas variables que manejaran el resultado
						var item = xmlDocument.getElementsByTagName('zona')[i];
				        var txt = item.getElementsByTagName('descripcion')[0].firstChild.data;
						var idzona = item.getElementsByTagName('idzona')[0].firstChild.data;
						
						//Creamos el elemento "option" para añadirselo al combo "provincias"
						var nuevaOpcion=document.createElement("option"); 
						nuevaOpcion.value = idzona; 
						nuevaOpcion.innerHTML = txt;
						document.getElementById("select1").appendChild(nuevaOpcion);
					}
				}catch(e){
					alert("ERROR: "+e.description);
				}
			}else{ //Sino, resto de navegadores
				var documento = peticion.responseXML; //Tratamos la respuesta como objeto xml
				try{//Tratamos de capturar un posible error, en el supuesto de que se produzca
					//Limpiamos el combo del contenido que tenga actualmente
					document.getElementById("select1").options.length = 0;
					document.getElementById("select1").width = 110;
					
					var nuevaOpcion=document.createElement("option"); 
					nuevaOpcion.value = 0; 
					nuevaOpcion.innerHTML = 'Seleccione Comunidad';
					document.getElementById("select1").appendChild(nuevaOpcion);
					
					//Insertamos los datos en el combobox
					//recorriendo los tags del documento XML implementado
					for (i=0; i<documento.getElementsByTagName('zona').length; i++){
						//Creamos las distintas variables que manejaran el resultado
						var item = documento.getElementsByTagName('zona')[i];
				        var txt = item.getElementsByTagName('descripcion')[0].firstChild.data;
						var idzona = item.getElementsByTagName('idzona')[0].firstChild.data;
						//Creamos el elemento "option" para añadirselo al combo "provincias"
						var nuevaOpcion=document.createElement("option"); 
						nuevaOpcion.value = idzona; 
						nuevaOpcion.innerHTML = txt;
						document.getElementById("select1").appendChild(nuevaOpcion);
					}
				}catch(e){
					alert("ERROR: "+e.description);
				}
			}
		}
		//Si existe algún error en la recepcion de los datos se presentará 
		//dentro del div correspondiente, en este caso "paginacontenido"
		else{ 
			document.getElementById('selec1').innerHTML = "<h1>Error en la recepción de los datos</h1>" + peticion.responseText
			document.getElementById('selec1').style.display = "";
		}
	}
}


/*********************************************************************************/
/* Procesa el resultado del HTTPRequest enviado desde el primer select			 */
/*********************************************************************************/
function procesarZonas2(){ 
	// if peticion está cargada
	if (peticion.readyState == 4){
		// si "OK"
		if(peticion.status == 200){
			//Seleccionamos la version del navegador ya que de ello depende ***
			//el uso de un tipo de objeto DOM u otro **************************
			if(window.ActiveXObject){ //SI Internet Explorer
				var xmlDocument = creaDocumento(); //Creamos el documento que se va a encargar del fichero xml
				try{//Tratamos de capturar un posible error, en el supuesto de que se produzca
					var texto = peticion.responseText; //Asignamos la respuesta a variable
					xmlDocument.loadXML(texto); //Cargamos el texto en un tipo DOM xml
					//Limpiamos el combo del contenido que tenga actualmente
					document.getElementById("select2").options.length = 0;
					document.getElementById("select2").width = 110;
					
					var nuevaOpcion=document.createElement("option"); 
					nuevaOpcion.value = 0; 
					nuevaOpcion.innerHTML = 'Seleccione Comunidad';
					document.getElementById("select2").appendChild(nuevaOpcion);
					
					//Insertamos los datos en el combobox
					//recorriendo los tags del documento XML implementado
					for (i=0; i<xmlDocument.getElementsByTagName('zona').length; i++){
						//Creamos las distintas variables que manejaran el resultado
						var item = xmlDocument.getElementsByTagName('zona')[i];
				        var txt = item.getElementsByTagName('descripcion')[0].firstChild.data;
						var idzona = item.getElementsByTagName('idzona')[0].firstChild.data;
						
						//Creamos el elemento "option" para añadirselo al combo "provincias"
						var nuevaOpcion=document.createElement("option"); 
						nuevaOpcion.value = idzona; 
						nuevaOpcion.innerHTML = txt;
						document.getElementById("select2").appendChild(nuevaOpcion);
					}
				}catch(e){
					alert("ERROR: "+e.description);
				}
			}else{ //Sino, resto de navegadores
				var documento = peticion.responseXML; //Tratamos la respuesta como objeto xml
				try{//Tratamos de capturar un posible error, en el supuesto de que se produzca
					//Limpiamos el combo del contenido que tenga actualmente
					document.getElementById("select2").options.length = 0;
					document.getElementById("select2").width = 110;
					
					var nuevaOpcion=document.createElement("option"); 
					nuevaOpcion.value = 0; 
					nuevaOpcion.innerHTML = 'Seleccione Comunidad';
					document.getElementById("select2").appendChild(nuevaOpcion);
					
					//Insertamos los datos en el combobox
					//recorriendo los tags del documento XML implementado
					for (i=0; i<documento.getElementsByTagName('zona').length; i++){
						//Creamos las distintas variables que manejaran el resultado
						var item = documento.getElementsByTagName('zona')[i];
				        var txt = item.getElementsByTagName('descripcion')[0].firstChild.data;
						var idzona = item.getElementsByTagName('idzona')[0].firstChild.data;
						//Creamos el elemento "option" para añadirselo al combo "provincias"
						var nuevaOpcion=document.createElement("option"); 
						nuevaOpcion.value = idzona; 
						nuevaOpcion.innerHTML = txt;
						document.getElementById("select2").appendChild(nuevaOpcion);
					}
				}catch(e){
					alert("ERROR: "+e.description);
				}
			}
		}
		//Si existe algún error en la recepcion de los datos se presentará 
		//dentro del div correspondiente, en este caso "paginacontenido"
		else{ 
			document.getElementById('selec2').innerHTML = "<h1>Error en la recepción de los datos</h1>" + peticion.responseText
			document.getElementById('selec2').style.display = "";
		}
	}
}


/*********************************************************************************/
/* Procesa el resultado del HHTPRequest enviado desde cargaServ() 				 */
/*********************************************************************************/
function procesarServicios(){
	// if peticion está cargada
	if (peticion.readyState == 4){
		// si "OK"
		if(peticion.status == 200){
			//Seleccionamos la version del navegador ya que de ello depende ***
			//el uso de un tipo de objeto DOM u otro **************************
			if(window.ActiveXObject){ //SI Internet Explorer
				var xmlDocument = creaDocumento(); //Creamos el documento que se va a encargar del fichero xml
				try{//Tratamos de capturar un posible error, en el supuesto de que se produzca
					var texto = peticion.responseText; //Asignamos la respuesta a variable
					xmlDocument.loadXML(texto); //Cargamos el texto en un tipo DOM xml
					//Limpiamos el combo del contenido que tenga actualmente
					document.getElementById("select1").options.length = 0;
					document.getElementById("select1").width = 110;
					
					var nuevaOpcion=document.createElement("option"); 
					nuevaOpcion.value = 0; 
					nuevaOpcion.innerHTML = 'Seleccione Servicio';
					document.getElementById("select1").appendChild(nuevaOpcion);
					
					//Insertamos los datos en el combobox
					//recorriendo los tags del documento XML implementado
					for (i=0; i<xmlDocument.getElementsByTagName('servicio').length; i++){
						//Creamos las distintas variables que manejaran el resultado
						var item = xmlDocument.getElementsByTagName('servicio')[i];
				        var txt = item.getElementsByTagName('nombre')[0].firstChild.data;
						var idzona = item.getElementsByTagName('idservicio')[0].firstChild.data;
						//Creamos el elemento "option" para añadirselo al combo "provincias"
						var nuevaOpcion=document.createElement("option"); 
						nuevaOpcion.value = idzona; 
						nuevaOpcion.innerHTML = txt;
						document.getElementById("select1").appendChild(nuevaOpcion);
					}
				}catch(e){
					alert("ERROR: "+e.description);
				}
			}else{ //Sino, resto de navegadores
				var documento = peticion.responseXML; //Tratamos la respuesta como objeto xml
				try{//Tratamos de capturar un posible error, en el supuesto de que se produzca
					//Limpiamos el combo del contenido que tenga actualmente
					document.getElementById("select1").options.length = 0;
					document.getElementById("select1").width = 110;
					
					var nuevaOpcion=document.createElement("option"); 
					nuevaOpcion.value = 0; 
					nuevaOpcion.innerHTML = 'Seleccione Servicio';
					document.getElementById("select1").appendChild(nuevaOpcion);
					
					//Insertamos los datos en el combobox
					//recorriendo los tags del documento XML implementado
					for (i=0; i<documento.getElementsByTagName('servicio').length; i++){
						//Creamos las distintas variables que manejaran el resultado
						var item = documento.getElementsByTagName('servicio')[i];
				        var txt = item.getElementsByTagName('nombre')[0].firstChild.data;
						var idzona = item.getElementsByTagName('idservicio')[0].firstChild.data;
						//Creamos el elemento "option" para añadirselo al combo "provincias"
						var nuevaOpcion=document.createElement("option"); 
						nuevaOpcion.value = idzona; 
						nuevaOpcion.innerHTML = txt;
						document.getElementById("select1").appendChild(nuevaOpcion);
					}
				}catch(e){
					alert("ERROR: "+e.description);
				}
			}
		}
		//Si existe algún error en la recepcion de los datos se presentará 
		//dentro del div correspondiente, en este caso "paginacontenido"
		else{ 
			document.getElementById('selec1').innerHTML = "<h1>Error en la recepción de los datos</h1>" + peticion.responseText
			document.getElementById('selec1').style.display = "";
		}
	}
}


/*********************************************************************************/
/* Procesa el resultado del HHTPRequest enviado desde cargaCent() 				 */
/*********************************************************************************/
function procesarCentros(){
	// if peticion está cargada
	if (peticion.readyState == 4){
		// si "OK"
		if(peticion.status == 200){ 
			//Seleccionamos la version del navegador ya que de ello depende ***
			//el uso de un tipo de objeto DOM u otro **************************
			if(window.ActiveXObject){ //SI Internet Explorer
				var xmlDocument = creaDocumento(); //Creamos el documento que se va a encargar del fichero xml
				try{//Tratamos de capturar un posible error, en el supuesto de que se produzca
					var texto = peticion.responseText; //Asignamos la respuesta a variable
					xmlDocument.loadXML(texto); //Cargamos el texto en un tipo DOM xml
					//Insertamos los datos en la tabla correspondiente
					//recorriendo los tags del documento XML implementado
					
					if (document.getElementById("select2").style.display == "visible")
						comunidad = document.getElementById("select2").options[document.getElementById("select2").selectedIndex].text.toUpperCase();
					else
						comunidad = document.getElementById("select1").options[document.getElementById("select1").selectedIndex].text.toUpperCase();

					contenido = "<div id='dvEspacioV10'></div>";
					contenido = contenido + "<div style='float:left; font-size: 1px; width: 7px; height: 7px; margin: 5px; background-color: #FFAC1C;'></div>";
					contenido = contenido + "<div style='float: left; font-family: Tahoma; font-size: 13px; font-weight: bold; color: #757575;'>" + comunidad + "</div><br>";
					contenido = contenido + "<div id='dvEspacioV10'></div>";
					contenido = contenido + "<table id='tbRedrc'><tr>";
					for (i=0; i<xmlDocument.getElementsByTagName('centro').length; i++){
						//Creamos las distintas variables que manejaran el resultado
						var item = xmlDocument.getElementsByTagName('centro')[i];
						if (item.getElementsByTagName('descripcion')[0].childNodes.length > 0) txt = item.getElementsByTagName('descripcion')[0].firstChild.data; else txt = '';
						if (item.getElementsByTagName('direccion')[0].childNodes.length > 0) direccion = item.getElementsByTagName('direccion')[0].firstChild.data; else direccion = '';
						if (item.getElementsByTagName('localidad')[0].childNodes.length > 0) localidad = item.getElementsByTagName('localidad')[0].firstChild.data; else localidad = '';
						if (item.getElementsByTagName('codigo_postal')[0].childNodes.length > 0) cp = item.getElementsByTagName('codigo_postal')[0].firstChild.data; else cp = '';
						if (item.getElementsByTagName('telefono')[0].childNodes.length > 0) telefono = item.getElementsByTagName('telefono')[0].firstChild.data; else telefono = '';
						if (item.getElementsByTagName('fax')[0].childNodes.length > 0) fax = item.getElementsByTagName('fax')[0].firstChild.data; else fax = '';
						
						//Insertamos los datos en la tabla
						//document.getElementById('contenidoredrc').innerHTML = document.getElementById('contenidoredrc').innerHTML + "<div style='font-size: 9px;'><a href=\"javascript:getRecursoX('../COMUN/includes/directorio/centros.asp?id=" + item.getElementsByTagName('idcentro')[0].firstChild.data + "', 'contenidoredrc')\" class=\"linkdirectorio\">"+txt+"</a><br>"+localidad+"<br>"+direccion+"<br>"+cp+"<br>Tlf: "+telefono+"<br>Fax: "+fax+"<br><br></div>";
						contenido = contenido + "<td width='200'><a href=\"javascript:getRecursoX('CORPORACION/includes/paginas/redrc_centros.asp?id=" + item.getElementsByTagName('idcentro')[0].firstChild.data + "&com=" + comunidad + "', 'contenidoredrc')\" id=\"lkRedrc\">"+txt+"</a><br>"+localidad+"<br>"+direccion+"<br>"+cp+"<br>Tlf: "+telefono+"<br>Fax: "+fax+"<br><br></td>";
						if (i%3 == 2) contenido = contenido + "</tr><tr>";
					}
					contenido = contenido + "</tr></table>";
					document.getElementById('contenidoredrc').innerHTML = contenido;
					
					//document.getElementById('resultadosB').innerHTML = document.getElementById('resultadosB').innerHTML + "</table></font>";
					//alert(document.getElementById('resultadosB').innerHTML);
					//document.getElementById('resultadosB').innerHTML = tabla;
				}catch(e){
					alert("ERROR: "+e.description);
				}
			}else{ //Sino, resto de navegadores
				var xmlDocument = peticion.responseXML; //Tratamos la respuesta como objeto xml
				try{//Tratamos de capturar un posible error, en el supuesto de que se produzca
					//Insertamos los datos en la tabla correspondiente
					//recorriendo los tags del documento XML implementado
					//document.getElementById('contenidoredrc').innerHTML = peticion.responseText;
			
					comunidad = document.getElementById("select1").options[document.getElementById("select1").selectedIndex].text.toUpperCase();
							
					contenido = "<div id='dvEspacioV10'></div>";
					contenido = contenido + "<div style='float:left; font-size: 1px; width: 7px; height: 7px; margin: 5px; background-color: #FFAC1C;'></div>";
					contenido = contenido + "<div style='float: left; font-family: Tahoma; font-size: 13px; font-weight: bold; color: #757575;'>" + comunidad + "</div><br>";
					contenido = contenido + "<div id='dvEspacioV10'></div>";
					contenido = contenido + "<table id='tbRedrc'><tr>";
					for (i=0; i<xmlDocument.getElementsByTagName('centro').length; i++){
						//Creamos las distintas variables que manejaran el resultado
						var item = xmlDocument.getElementsByTagName('centro')[i];
						if (item.getElementsByTagName('descripcion')[0].childNodes.length > 0) txt = item.getElementsByTagName('descripcion')[0].firstChild.data; else txt = '';
						if (item.getElementsByTagName('direccion')[0].childNodes.length > 0) direccion = item.getElementsByTagName('direccion')[0].firstChild.data; else direccion = '';
						if (item.getElementsByTagName('localidad')[0].childNodes.length > 0) localidad = item.getElementsByTagName('localidad')[0].firstChild.data; else localidad = '';
						if (item.getElementsByTagName('codigo_postal')[0].childNodes.length > 0) cp = item.getElementsByTagName('codigo_postal')[0].firstChild.data; else cp = '';
						if (item.getElementsByTagName('telefono')[0].childNodes.length > 0) telefono = item.getElementsByTagName('telefono')[0].firstChild.data; else telefono = '';
						if (item.getElementsByTagName('fax')[0].childNodes.length > 0) fax = item.getElementsByTagName('fax')[0].firstChild.data; else fax = '';
						
						//Insertamos los datos en la tabla
						//document.getElementById('contenidoredrc').innerHTML = document.getElementById('contenidoredrc').innerHTML + "<div style='font-size: 9px;'><a href=\"javascript:getRecursoX('../COMUN/includes/directorio/centros.asp?id=" + item.getElementsByTagName('idcentro')[0].firstChild.data + "', 'contenidoredrc')\" class=\"linkdirectorio\">"+txt+"</a><br>"+localidad+"<br>"+direccion+"<br>"+cp+"<br>Tlf: "+telefono+"<br>Fax: "+fax+"<br><br></div>";
						contenido = contenido + "<td width='200'><a href=\"javascript:getRecursoX('CORPORACION/includes/paginas/redrc_centros.asp?id=" + item.getElementsByTagName('idcentro')[0].firstChild.data + "&com=" + comunidad + "', 'contenidoredrc')\" id=\"lkRedrc\">"+txt+"</a><br>"+localidad+"<br>"+direccion+"<br>"+cp+"<br>Tlf: "+telefono+"<br>Fax: "+fax+"<br><br></td>";
						if (i%3 == 2) contenido = contenido + "</tr><tr>";
					}
					contenido = contenido + "</tr></table>";
					document.getElementById('contenidoredrc').innerHTML = contenido;

					
				}catch(e){
					alert("ERROR: "+e.description);
				}
			}
		}
		//Si existe algún error en la recepcion de los datos se presentará 
		//dentro del div correspondiente, en este caso "paginacontenido"
		else{ 
			document.getElementById('paginacontenido').innerHTML = "<h1>Error en la recepción de los datos</h1>" + peticion.responseText
			document.getElementById('paginacontenido').style.display = "";
		}
	}
	
}


/*********************************************************************************/
/* Mostrar Buscar o nuevo Select según opción de radiobutton					 */
/*********************************************************************************/
function validaSelec1(){

	if (document.getElementById('zonaserv1').checked == true && 
		document.getElementById('select1').selectedIndex > 0) {
		
		//document.getElementById('redbuscar').style.display = "block";
		cargaCent();
	}
	else
	if (document.getElementById('zonaserv2').checked == true && 
		document.getElementById('select1').selectedIndex > 0) {
		
		enviarPeticion( RAIZ + "COMUN/clases/zonas.asp","accion=seleccionarcondicionalxml&valores=*&condicion=" + encodeURIComponent("idZONAS IN(SELECT ZONAS_idZONAS FROM CENTROS where idCENTRO IN(SELECT CENTROS_IDCENTRO FROM CENTROS_HAS_SERVICIOS WHERE SERVICIOS_IDSERVICIO = " + document.getElementById("select1").options[document.getElementById("select1").selectedIndex].value + "))"), procesarZonas2);
		document.getElementById('selec2').style.display = "block";
	}
	else {
		document.getElementById('selec2').style.display = "none";
		//document.getElementById('redbuscar').style.display = "none";
	}

}


/*********************************************************************************/
/* Mostrar Buscar o nuevo Select según opción de radiobutton					 */
/*********************************************************************************/
function validaSelec2(){
	if (document.getElementById('zonaserv2').checked == true && 
		document.getElementById('select2').selectedIndex > 0) {
		
		//document.getElementById('redbuscar').style.display = "block";
		cargaCent();
	}
	else {
	
		//document.getElementById('redbuscar').style.display = "none";
	}
	
}