function objetoAjax(){
	var xmlhttp;
	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();
	}
	return xmlhttp;
}

function RecibirDatos(idObj)
{
	var valoresReturn = "";
	if(idObj.search(",") > 0)
	{
		var arrNew = Array();
		var elemento;
		
		arrNew = idObj.split(",");
		
		for(var i = 0; i < arrNew.length; i++)
		{
			elemento = "";
			if(arrNew[i] != null)
			{
				elemento = document.getElementById(arrNew[i]);
				valoresReturn += arrNew[i] + ": " + elemento.value + "; ";
			}
		}
		EjecutarConsulta(valoresReturn);
	}
	else
	{
		valoresReturn = "";
		return false;
	}
}	

function EjecutarConsulta(datos){
	ajax=objetoAjax();
	var newDatos = 'insertarDatos.php?datos=' + datos;
	ajax.open("GET", newDatos, true);
	ajax.onreadystatechange=function() {
		if (ajax.readyState==4) {
			if(ajax.status==200){
				if(ajax.responseText == ' ')
					alert('No se hallaron resultados');	
			}		
            else if(ajax.status==404)
                {
					alert("La direccion no existe");
                }
		}
	}
	ajax.send(null);
	return;
}