//mi miAHAHlib.js

  function createREQ(){
    try{
       http = new XMLHttpRequest();
    }catch(e){
      try{
         //http= new ActiveXObject("Msxml2.XMLHTTP");
         http= new ActiveXObject("Microsoft.XMLHTTP");
      }catch(e){
         http= false;
      }
    }
    return http;  
  }
  function requestGet(url,query,req){
       var q = query.split("|");  
       var param1 = q.splice(0,1);
       var param2=  q.splice(0,2);      
      param1 =encodeURIComponent(param1);      
       var solicitud = url+'?param1='+param1+'&param2='+param2;       
      req.open("GET",solicitud,true);
      req.send(null);      	
  }
  function requestPost(url,query,req){  
	
    query = "obj="+query;
    req.open("POST",url,true);     
	req.send(query);          
  }
   function doCallback(callback,item){
        //que ejecute la funcion     
    eval(callback +'(item)');
   }

  function doAjax(url,query,callback,reqtype,getxml){       
    var myreq = createREQ();
    myreq.onreadystatechange = function(){
           if(myreq.readyState == 4){
              if(myreq.status == 200){
		         var item = myreq.responseText;
                 if(getxml==1){
                   item = myreq.responseXML;
                 }                 
		         doCallback(callback,item); 
                //            
              }
           }
	}
    if(reqtype =='post'){       
       requestPost(url,query,myreq);
    }else{        
       requestGet(url,query,myreq);    
    }   
    
  } 
  

  


