function nuevoAjax(){ 
  var xmlhttp=false; 
  try { 
   // Creación del objeto ajax para navegadores diferentes a Explorer 
   xmlhttp = new ActiveXObject("Msxml2.XMLHTTP"); 
  } catch (e) { 
   // o bien 
   try { 
     // Creación del objet ajax para Explorer 
     xmlhttp = new ActiveXObject("Microsoft.XMLHTTP"); } catch (E) { 
     xmlhttp = false; 
   } 
  } 

  if (!xmlhttp && typeof XMLHttpRequest!='undefined') { 
   xmlhttp = new XMLHttpRequest(); 
  } 
  return xmlhttp; 
} 

function ciudad()
{	
	document.getElementById("ciudades").innerHTML ='';
	document.getElementById("areas").innerHTML ='';
	if(document.frmbuscararea.paises.value==0)
	{
		document.getElementById("ciudades").innerHTML ='';
		return '';
	}
	ajax=nuevoAjax();
		ajax.open("POST", "etc/exe.php",true);	
		document.getElementById("ciudades").innerHTML ='<img src=etc/ld.gif> Buscando datos...';
		ajax.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
		ajax.send("p="+document.frmbuscararea.paises.value);
		ajax.onreadystatechange=function() { 
		if (ajax.readyState == 4) { 
			   if (ajax.status == 200) { 
				  if (ajax.responseText.indexOf('invalid') == -1) {
					// Armamos un array, usando la coma para separar elementos			
					document.getElementById("ciudades").innerHTML = ajax.responseText;
					enProceso = false;
					return ajax.responseText;
				}
			}
		}		
	} 
}

function area()
{	
	//document.getElementById("ciudades").innerHTML ='';
	//document.getElementById("areas").innerHTML ='';
	if(document.frmbuscararea.ciudades.value==0)
	{
		document.getElementById("areas").innerHTML ='';
		return '';
	}
	ajax=nuevoAjax();
		ajax.open("POST", "etc/exe.php",true);	
		document.getElementById("areas").innerHTML ='<img src=etc/ld.gif> Buscando datos...';
		ajax.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
		ajax.send("p="+document.frmbuscararea.paises.value+"&c="+document.frmbuscararea.ciudad.value);
		ajax.onreadystatechange=function() { 
		if (ajax.readyState == 4) { 
			   if (ajax.status == 200) { 
				  if (ajax.responseText.indexOf('invalid') == -1) {
					// Armamos un array, usando la coma para separar elementos			
					document.getElementById("areas").innerHTML = ajax.responseText;
					enProceso = false;
					return ajax.responseText;
				}
			}
		}		
	} 
}

function new_image()
{
	var div=document.getElementById('up')
	div.innerHTML  ='<iframe src="etc/subir_imagen.php" frameborder="0" width="100%" height="120" scrolling="no"></iframe>';
}


function reg_serviciotipo()
{ 
	if(document.frm.servicios.value==0){
		document.getElementById("serviciostipos").innerHTML = "";
		return "";
	}
	ajax=nuevoAjax();
		ajax.open("POST", "etc/servicios.php",true);	
		document.getElementById("serviciostipos").innerHTML ='<img src=etc/ld.gif> Buscando datos';
		ajax.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
		ajax.send("s="+document.frm.servicios.value);
		ajax.onreadystatechange=function() { 
		if (ajax.readyState == 4) { 
			   if (ajax.status == 200) { 
				  if (ajax.responseText.indexOf('invalid') == -1) {
					// Armamos un array, usando la coma para separar elementos			
					document.getElementById("serviciostipos").innerHTML = ajax.responseText;
					enProceso = false;
					return ajax.responseText;
				}
			}
		}		
	} 
}

function reg_ciudad()
{ 
	document.getElementById("areas").innerHTML  ='';
	ajax=nuevoAjax();
		ajax.open("POST", "etc/mapas.php",true);	
		document.getElementById("ciudad").innerHTML  ='<img src=etc/ld.gif> Buscando datos';
		ajax.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
		ajax.send("p="+document.frm.paises.value);
		ajax.onreadystatechange=function() { 
		if (ajax.readyState == 4) { 
			   if (ajax.status == 200) { 
				  if (ajax.responseText.indexOf('invalid') == -1) {
					// Armamos un array, usando la coma para separar elementos			
					document.getElementById("ciudad").innerHTML = ajax.responseText;
					enProceso = false;
					return ajax.responseText;
				}
			}
		}		
	} 
}

function reg_area(c)
{ 
	ajax=nuevoAjax();	
	document.getElementById("areas").innerHTML  ='<img src=etc/ld.gif> Buscando datos';
		ajax.open("POST", "etc/mapas.php",true);			
		ajax.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
		ajax.send("c="+c);		
		ajax.onreadystatechange=function() { 
		if (ajax.readyState == 4) { 
			   if (ajax.status == 200) { 
				  if (ajax.responseText.indexOf('invalid') == -1) {
					// Armamos un array, usando la coma para separar elementos			
					document.getElementById("areas").innerHTML = ajax.responseText;
					enProceso = false;
					return ajax.responseText;
				}
			}
		}		
	}
	
}
