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

  function pedirDatos1(fuenteDatos, divID){
	   
	   ajax=objetoAjax(); 
	   var obj = document.getElementById(divID);
	   ajax.open("POST", fuenteDatos,true);
	   ajax.onreadystatechange = function(){
	   if (ajax.readyState == 4 && ajax.status == 200) {
	   obj.innerHTML = ajax.responseText;
	   
	   }
	   }
	   ajax.setRequestHeader("Content-Type","application/x-www-form-urlencoded");
	   ajax.send(null);	    
  } 
  
function cargar_user(fuenteDatos, divID){
	//donde se mostrará lo resultados
	divResultado = document.getElementById(divID);
 	//valores de los inputs	 
	nom=document.user.usuario.value;
	pass=document.user.clave.value;	 
	//instanciamos el objetoAjax
	ajax=objetoAjax();
	//usando del medoto POST	 
	ajax.open("POST",fuenteDatos,true);
	ajax.onreadystatechange=function() {
		if (ajax.readyState==4) {
			//mostrar los nuevos registros en esta capa
			divResultado.innerHTML = ajax.responseText			 
		}
	}
	//muy importante este encabezado ya que hacemos uso de un formulario
	ajax.setRequestHeader("Content-Type","application/x-www-form-urlencoded");
	//enviando los valores
	ajax.send("nombre="+nom+"&pass="+pass)
}

 
