var url_carga_segundo_combo = "accion_carga_segundo_combo.php?id=";

var http = getHTTPObject(); // We create the HTTP Object

//---------------------------------------------------
//-- Genera xmlHttpRequest
//---------------------------------------------------

function getHTTPObject() {
var xmlhttp;
/*@cc_on
@if (@_jscript_version >= 5)
try {
xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
} catch (e) {
try {
xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
} catch (E) {
xmlhttp = false;
}
}
@else
xmlhttp = false;
@end @*/
if (!xmlhttp && typeof XMLHttpRequest != 'undefined') {
try {
xmlhttp = new XMLHttpRequest();
} catch (e) {
xmlhttp = false;
}
}
return xmlhttp;
}

//------------------------------ on change del 1er combo

function onChange_primer_combo() {

// obtenemos el id seleccionado del 1er combo
var selObj = document.getElementById('form_region');
var selIndex = selObj.selectedIndex;
var v_id = selObj.options[selIndex].value;

// blanquemos el 2do combo
document.getElementById('form_city').options.length = 0;
document.getElementById('form_city').options[0]= new Option("Cargando...");

http.open("GET", url_carga_segundo_combo + escape(v_id) , true);

http.onreadystatechange = handleHttpResponse_onChange_primer_combo;

http.send(null);



}

// y por ultimo publicamos los resultados

//*---------------------------------------------------------------
//-- Publica Combo PERFIL segun seleccion Combo ANCHOS - PASO II
//----------------------------------------------------------------

//function handleHttpResponse_onChange_Combo_Ancho() {
function handleHttpResponse_onChange_primer_combo() {



if (http.readyState == 4) {

var i; 

var total = http.responseXML.getElementsByTagName('LINEA').length;



results = http.responseText.split(",");


document.getElementById('form_city').options.length = 0;
document.getElementById('form_city').options[0]= new Option("Todas");

for(i=0;i<total;i++){

document.getElementById('form_city').options[i+1]= new Option( http.responseXML.getElementsByTagName('COL1')[i].firstChild.data ,http.responseXML.getElementsByTagName('COL2')[i].firstChild.data);

}



window.status = '';


return false;

}

}

