var HTTP_Request=false;var Contenedor;function creaObjetoHTTP_Request(){HTTP_Request=false;if(window.XMLHttpRequest){HTTP_Request=new XMLHttpRequest();if(HTTP_Request.overrideMimeType){HTTP_Request.overrideMimeType('text/xml');}}else if(window.ActiveXObject){try{HTTP_Request=new ActiveXObject("Msxml2.XMLHTTP");}catch(e){try{HTTP_Request=new ActiveXObject("Microsoft.XMLHTTP");}catch(e){}}}
if(!HTTP_Request){alert('Falla :( No es posible crear una instancia XMLHTTP');return false;}}
function MyRequestForCombos(divReceptor,url){creaObjetoHTTP_Request();var Contenedor=document.getElementById(divReceptor);HTTP_Request.open("GET",url,true);HTTP_Request.onreadystatechange=function(){if(HTTP_Request.readyState==4){if(HTTP_Request.status==200){Contenedor.innerHTML=HTTP_Request.responseText;}}}
HTTP_Request.send(null);}
function abre_url(mapa,marca,codigo){creaObjetoHTTP_Request();HTTP_Request.open("GET","marca.asp?codigo="+codigo,true);HTTP_Request.onreadystatechange=function(){if(HTTP_Request.readyState==4){if(HTTP_Request.status==200){var myHtml=HTTP_Request.responseText;var point=marca.getPoint();mapa.openInfoWindowHtml(point,myHtml);}}}
HTTP_Request.send(null);}
function PonComunidades(ComboSeleccion,divReceptor){var SelCntrl=document.getElementById(ComboSeleccion);var auxUrl;auxUrl="PonComunidades.asp?Pais="+SelCntrl.options[SelCntrl.selectedIndex].value;MyRequestForCombos(divReceptor,auxUrl);}
function PonProvincias(ComboSeleccion,divReceptor){var SelCntrl=document.getElementById(ComboSeleccion);var auxUrl;auxUrl="PonProvincias.asp?Comunidad="+SelCntrl.options[SelCntrl.selectedIndex].value;MyRequestForCombos(divReceptor,auxUrl);}
function PonLocalidades(ComboSeleccion,divReceptor){var SelCntrl=document.getElementById(ComboSeleccion);var auxUrl;auxUrl="PonLocalidades.asp?Provincia="+SelCntrl.options[SelCntrl.selectedIndex].value;MyRequestForCombos(divReceptor,auxUrl);}
function Listado(){var valor=document.getElementById('destination').value;var auxUrl;auxUrl="search_suggest.asp?busqueda="+valor;MyRequestForCombos('lista',auxUrl);}
function Buscar(){if(document.getElementById('provincia').options[document.getElementById('provincia').selectedIndex].value=="-- Seleccione Comunidad Autonoma --"||document.getElementById('provincia').options[document.getElementById('provincia').selectedIndex].value=="-- Seleccionar una --"){alert("Debe Seleccionar una provincia o localidad.");}else{if(document.getElementById('localidad').options[document.getElementById('localidad').selectedIndex].text=="-- Seleccione Provincia --"){alert("Debe Seleccionar una provincia o localidad.");}else{if(document.getElementById('localidad').options[document.getElementById('localidad').selectedIndex].text!="-- Todas --"){document.getElementById('P').value=document.getElementById('localidad').options[document.getElementById('localidad').selectedIndex].text;document.getElementById('Zoom').value="12";document.getElementById('BoolProv').value="No";document.getElementById('CombosForm').submit();}else{document.getElementById('P').value=document.getElementById('provincia').options[document.getElementById('provincia').selectedIndex].text;document.getElementById('Zoom').value="No";document.getElementById('BoolProv').value="Si";document.getElementById('CombosForm').submit();}}}}