 function cargarCombo(ciudad){

    var xmlhttp=false;
    try {xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");}catch (e) {try {xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");} catch (E) {xmlhttp = false;}}
    if (!xmlhttp && typeof XMLHttpRequest!='undefined') {xmlhttp = new XMLHttpRequest();}
	  var elSel = document.getElementById('direccion');
	  var i;
	  while (elSel.length > 0) {
		  elSel.remove(elSel.selectedIndex);
	  }
    path='ajax/archivo_ajax_1.php?ciudad='+ciudad;
	
    xmlhttp.open("GET",path);
           xmlhttp.onreadystatechange=function() {
                   if (xmlhttp.readyState==4) {
                           var datos = xmlhttp.responseText
						   if(datos==''){
                            alert('No hay sucursales en esta provincia.');
								var y=document.createElement('option');
								y.text='No hay dirección';
								y.value='0';
								var x=document.getElementById("direccion");
								try
								  {
								  x.add(y,null); // standards compliant
								  }
								catch(ex)
								  {
								  x.add(y); // IE only
								  }
								}							
                           
                           else{
								var y=document.createElement('option');
								var x=document.getElementById("direccion");				   
                                var datos2=datos.split('%');
								
								for(var i=0;i<datos2.length-1;i++){
									var correo = datos2[i].split('$');
									y.text=correo[0];
									y.value=correo[1];
							
									try
									{
										x.options[x.options.length] = new Option(y.text, y.value);

										//x.add(y,null); // standards compliant
									}
									catch(ex)
									{
										x.options[x.options.length] = new Option(y.text, y.value);
										//x.add(y); // IE only
									}									
								}
                           }
                             
                   }
			}
   xmlhttp.send(null)
}
 
