function comboPCD(){this.executeQuery=function(mode,dataSource,divID){var XMLHttpRequestObject=false;if(window.XMLHttpRequest){try{XMLHttpRequestObject=new XMLHttpRequest();}catch(e){}}else if(window.ActiveXObject){try{XMLHttpRequestObject=new ActiveXObject("Microsoft.XMLHTTP");}catch(e){}}if(XMLHttpRequestObject){var obj=document.getElementById(divID);XMLHttpRequestObject.open("GET",dataSource);XMLHttpRequestObject.onreadystatechange=function(){if(XMLHttpRequestObject.readyState==4&&XMLHttpRequestObject.status==200){switch(mode){case "mostrar_cantones_distritos":setTimeout("DescargarCantonesDistritos('"+XMLHttpRequestObject.responseText+"')",100);break;case "mostrar_subcategorias":setTimeout("DescargarSubcategorias('"+XMLHttpRequestObject.responseText+"')",100);break;case "mostrar_distritos":setTimeout("DescargarDistritos('"+XMLHttpRequestObject.responseText+"')",100);break;case "mostrar_sectores":setTimeout("DescargarSectores('"+XMLHttpRequestObject.responseText+"')",100);break;case "mostrar_sectores_subsectores":eval(XMLHttpRequestObject.responseText);CargarSectores(cacheSectores,"cmbSectores");GlobalSector=cacheSectores[1][0];ReloadVentanasFromSector(GlobalSector,"cmbVentanas","CajaVentana");LoadPuntosRefSector();break;case "mostrar_provincias":setTimeout("DescargarProvinciasCantonesDistritos('"+XMLHttpRequestObject.responseText+"')",100);break;}hideObj("Layer1");}else{showObj("Layer1");}};XMLHttpRequestObject.send(null);}}}function MostrarSubcategorias(val){var conection=new comboPCD();conection.executeQuery("mostrar_subcategorias","../../Administracion/CapaControl/cntrl.php?modo=combo&cual=subcategorias&info="+GetSelectedValue(val),"");}function MostrarProvincias(val){var conection=new comboPCD();conection.executeQuery("mostrar_provincias","../../Administracion/CapaControl/cntrl.php?modo=combo&cual=paisesEs&info="+GetSelectedValue(val),"");}function MostrarCantones(val){var conection=new comboPCD();conection.executeQuery("mostrar_cantones_distritos","../../Administracion/CapaControl/cntrl.php?modo=combo&cual=provincia&info="+GetSelectedValue(val),"");}function MostrarDistritos(val){var conection=new comboPCD();conection.executeQuery("mostrar_distritos","../../Administracion/CapaControl/cntrl.php?modo=combo&cual=canton&info="+GetSelectedValue(val),"");}function MostrarSectores(val){var conection=new comboPCD();conection.executeQuery("mostrar_sectores","../../Administracion/CapaControl/cntrl.php?modo=combo&cual=pais&info="+GetSelectedValue(val),"");}function MostrarSectoresSubsectores(val){var conection=new comboPCD();conection.executeQuery("mostrar_sectores_subsectores","../../Administracion/CapaControl/cntrl.php?modo=combo&cual=SectoresSubsectores&info="+GetSelectedValue(val),"");}function DescargarProvinciasCantonesDistritos(val){var HTMLCombo3=new ComboboxLoader();HTMLCombo3.inicializar("Provincia","Provincia","","MostrarCantones(this);","");var opciones=Get(0,val,"]");var separador="~";var xmlLength=Length(opciones,separador);var seleccion=Get(1,val,"]");var i=0;for(i=0;i<xmlLength-1;i++){var Element=Get(i,opciones,separador);if(Get(0,Element,"`")==seleccion){HTMLCombo3.agregaropcion("selected",Get(0,Element,"`"),Get(1,Element,"`"));}else{HTMLCombo3.agregaropcion("",Get(0,Element,"`"),Get(1,Element,"`"));}}HTMLCombo3.finalizar();window.document.getElementById("Provincia_Div").innerHTML=HTMLCombo3.getCombo();var HTMLCombo=new ComboboxLoader();HTMLCombo.inicializar("Canton","Canton","","MostrarDistritos(this);","");var opciones=Get(2,val,"]");var separador="~";var xmlLength=Length(opciones,separador);var seleccion=Get(3,val,"]");var i=0;for(i=0;i<xmlLength-1;i++){var Element=Get(i,opciones,separador);if(Get(0,Element,"`")==seleccion){HTMLCombo.agregaropcion("selected",Get(0,Element,"`"),Get(1,Element,"`"));}else{HTMLCombo.agregaropcion("",Get(0,Element,"`"),Get(1,Element,"`"));}}HTMLCombo.finalizar();window.document.getElementById("Canton_Div").innerHTML=HTMLCombo.getCombo();var HTMLCombo2=new ComboboxLoader();HTMLCombo2.inicializar("Distrito","Distrito","","","");opciones=Get(4,val,"]");separador="~";xmlLength=Length(opciones,separador);seleccion=Get(5,val,"]");i=0;for(i=0;i<xmlLength-1;i++){var Element=Get(i,opciones,separador);if(Get(0,Element,"`")==seleccion){HTMLCombo2.agregaropcion("selected",Get(0,Element,"`"),Get(1,Element,"`"));}else{HTMLCombo2.agregaropcion("",Get(0,Element,"`"),Get(1,Element,"`"));}}HTMLCombo2.finalizar();window.document.getElementById("Distrito_Div").innerHTML=HTMLCombo2.getCombo();}function DescargarCantonesDistritos(val){var HTMLCombo=new ComboboxLoader();HTMLCombo.inicializar("Canton","Canton","","MostrarDistritos(this);","");var opciones=Get(0,val,"]");var separador="~";var xmlLength=Length(opciones,separador);var seleccion=Get(1,val,"]");var i=0;for(i=0;i<xmlLength-1;i++){var Element=Get(i,opciones,separador);if(Get(0,Element,"`")==seleccion){HTMLCombo.agregaropcion("selected",Get(0,Element,"`"),Get(1,Element,"`"));}else{HTMLCombo.agregaropcion("",Get(0,Element,"`"),Get(1,Element,"`"));}}HTMLCombo.finalizar();window.document.getElementById("Canton_Div").innerHTML=HTMLCombo.getCombo();HTMLCombo2=new ComboboxLoader();HTMLCombo2.inicializar("Distrito","Distrito","","","");opciones=Get(2,val,"]");separador="~";xmlLength=Length(opciones,separador);seleccion=Get(3,val,"]");i=0;for(i=0;i<xmlLength-1;i++){var Element=Get(i,opciones,separador);if(Get(0,Element,"`")==seleccion){HTMLCombo2.agregaropcion("selected",Get(0,Element,"`"),Get(1,Element,"`"));}else{HTMLCombo2.agregaropcion("",Get(0,Element,"`"),Get(1,Element,"`"));}}HTMLCombo2.finalizar();window.document.getElementById("Distrito_Div").innerHTML=HTMLCombo2.getCombo();}function DescargarSectoresSubsectores(val){var HTMLCombo=new ComboboxLoader();HTMLCombo.inicializar("Sector","Sector","","","");var opciones=Get(0,val,"]");var separador="~";var xmlLength=Length(opciones,separador);var seleccion=Get(1,val,"]");var i=0;for(i=0;i<xmlLength-1;i++){var Element=Get(i,opciones,separador);if(Get(0,Element,"`")==seleccion){HTMLCombo.agregaropcion("selected",Get(0,Element,"`"),Get(1,Element,"`"));}else{HTMLCombo.agregaropcion("",Get(0,Element,"`"),Get(1,Element,"`"));}}HTMLCombo.finalizar();window.document.getElementById("Sector_Div").innerHTML=HTMLCombo.getCombo();var HTMLCombo2=new ComboboxLoader();HTMLCombo2.inicializar("cmbVentanas","cmbVentanas","","","");var opciones=Get(2,val,"]");var separador="~";var xmlLength=Length(opciones,separador);var seleccion=Get(3,val,"]");var i=0;for(i=0;i<xmlLength-1;i++){var Element=Get(i,opciones,separador);if(Get(0,Element,"`")==seleccion){HTMLCombo2.agregaropcion("selected",Get(0,Element,"`"),Get(1,Element,"`"));}else{HTMLCombo2.agregaropcion("",Get(0,Element,"`"),Get(1,Element,"`"));}}HTMLCombo2.finalizar();window.document.getElementById("cmbVentanas_Div").innerHTML=HTMLCombo2.getCombo();}function DescargarSectores(val){var HTMLCombo=new ComboboxLoader();HTMLCombo.inicializar("Sector","Sector","","","");var opciones=Get(0,val,"]");var separador="~";var xmlLength=Length(opciones,separador);var seleccion=Get(1,val,"]");var i=0;for(i=0;i<xmlLength-1;i++){var Element=Get(i,opciones,separador);if(Get(0,Element,"`")==seleccion){HTMLCombo.agregaropcion("selected",Get(0,Element,"`"),Get(1,Element,"`"));}else{HTMLCombo.agregaropcion("",Get(0,Element,"`"),Get(1,Element,"`"));}}HTMLCombo.finalizar();window.document.getElementById("Sector_Div").innerHTML=HTMLCombo.getCombo();}function DescargarDistritos(val){var HTMLCombo=new ComboboxLoader();HTMLCombo.inicializar("Distrito","Distrito","","","");var opciones=Get(0,val,"]");var separador="~";var xmlLength=Length(opciones,separador);var seleccion=Get(1,val,"]");var i=0;for(i=0;i<xmlLength-1;i++){var Element=Get(i,opciones,separador);if(Get(0,Element,"`")==seleccion){HTMLCombo.agregaropcion("selected",Get(0,Element,"`"),Get(1,Element,"`"));}else{HTMLCombo.agregaropcion("",Get(0,Element,"`"),Get(1,Element,"`"));}}HTMLCombo.finalizar();window.document.getElementById("Distrito_Div").innerHTML=HTMLCombo.getCombo();}function DescargarSubcategorias(val){var HTMLCombo=new ComboboxLoader();HTMLCombo.inicializar("Subcategorias","Subcategorias","","","");var opciones=Get(0,val,"]");var separador="~";var xmlLength=Length(opciones,separador);var seleccion=Get(1,val,"]");var i=0;for(i=0;i<xmlLength-1;i++){var Element=Get(i,opciones,separador);if(Get(0,Element,"`")==seleccion){HTMLCombo.agregaropcion("selected",Get(0,Element,"`"),Get(1,Element,"`"));}else{HTMLCombo.agregaropcion("",Get(0,Element,"`"),Get(1,Element,"`"));}}HTMLCombo.finalizar();window.document.getElementById("Subcategorias_Div").innerHTML=HTMLCombo.getCombo();}
