function ExtractInfo(iPage,IsHtml,IsAsinc,pFuncToGenAsinc){
    if (!IsAsinc){IsAsinc=false;}    
    if (!IsHtml){IsHtml=true;}    
    iPage+="&nocache=" + Math.random();
    if (window.XMLHttpRequest) { // code for Mozilla, Safari, etc 
        xmlhttp=new XMLHttpRequest();       
    }else if (window.ActiveXObject) { //IE 
        xmlhttp=new ActiveXObject('Msxml2.XMLHTTP');   //Microsoft  o Msxml2   Msxml2.XMLHTTP.3.0      Msxml2.XMLHTTP
        if (!xmlhttp) {   //xmlhttp.onreadystatechange=ReciveOpenFileCFG;  //eval('xmlhttp.onreadystatechange='+pFunc+';');              Opcional para Explorer
           return;           
        }
    }     
    if (typeof pFuncToGenAsinc!='undefined'){ 
      eval('xmlhttp.onreadystatechange='+pFuncToGenAsinc +';'); 
    }
    //   xmlhttp.onload=ejemplo;   eventos on load 
    //xmlhttp.onprogress=ejemplo;   eventos para on progress             
    xmlhttp.open("GET",iPage, IsAsinc); // leave true for Gecko   true  asincrono  false no es asincrono  si es true  ejecuta la Funcion Arriba Mencionada           
    xmlhttp.setRequestHeader('Content-Type','text/' + (IsHtml)?'html':'plain' + ';charset=windows-1252');    //charset=ISO-8859-1  windows-1252
    xmlhttp.send(null);      
    var DataToReturn=xmlhttp.responseText;
    return DataToReturn;    
}
  
function SaveToDB(iPage,iParams,IsAsinc,iDivWait,pFuncToGenAsinc){ 
   //------------- Genera el Wait
   if(iDivWait!="" && document.getElementById(iDivWait)){
      document.getElementById(iDivWait).innerHTML="<img border='0' src='Images/wait.gif'>";
   }
   var xmlHttp = new XMLHttpRequest()   
   xmlHttp.open("POST", iPage, IsAsinc);   // False Sincrono    True Asyncrono 
   xmlHttp.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded;  charset=windows-1252');
   if (typeof pFuncToGenAsinc!='undefined'){ 
      eval('xmlHttp.onreadystatechange='+pFuncToGenAsinc +';'); 
    }
    var wCadtoPass=iParams + "&nocache=" + Math.random();
    xmlHttp.send(wCadtoPass);
    if(iDivWait!="" && document.getElementById(iDivWait)){document.getElementById(iDivWait).innerHTML="";}    
    return xmlHttp.responseText;
}
      
function RecibeIfonHttp() {        // Funcion que recibira la informacion cuando el .open = true  por supuesto esta es el prototipo ya que solo me servira como modelo de datos as
 if (xmlhttp.readyState==4) { 
    if (xmlhttp.status==200) {var wCadDev =xmlhttp.responseText;}   //responseXML  responseText           
  }        
}

function ReturnAllFields(iForm){
    var wCadRet='';
    for(var j=0;j<=iForm.elements.length-1;j++){      
        var iElement=iForm.elements[j];
         if(iElement.type=='text'|| iElement.type=='textarea' || iElement.type=='password' || iElement.type=='hidden' || iElement.type=='select-one'){
            wCadRet+=((wCadRet!='')?'&':'') + iElement.id + '=' + encodeURIComponent(iElement.value);}else if (iElement.type=='checkbox'){
            wCadRet+=((wCadRet!='')?'&':'') + iElement.id + '=' + encodeURIComponent(iElement.checked)
            }
      } 
    return wCadRet
}
