function createXMLHttpRequest() {



   try{ return new ActiveXObject("Msxml2.XMLHTTP"); }catch(e){}



   try{ return new ActiveXObject("Microsoft.XMLHTTP"); }catch(e){}



   try{ return new XMLHttpRequest(); }catch(e){}



   alert("XMLHttpRequest not supported");



   return null;



}











var xhReq = createXMLHttpRequest();







function geraJS(texto){



        



          var ini = 0;



          while (ini!=-1){



              ini = texto.indexOf('<script', ini);



              if (ini >=0){



                  ini = texto.indexOf('>', ini) + 1;



                  var fim = texto.indexOf('</script>', ini);



                  codigo = texto.substring(ini,fim);



                  eval(codigo);



              }



          }



 }







          function ajax(url,div){



               var div = document.getElementById(div);



               div.innerHTML = "<table border=0 align=center><tr><td valign=top align=center><img src=imagens/ajax_loader.gif><br><font color=#000000 size=2px>AGUARDE, ISTO PODERA LEVAR VARIOS MINUTOS...</font></td></tr></table>"; 







               xhReq.open("GET",url,true);



               



               xhReq.onreadystatechange=function() {



                    if(xhReq.readyState == 4) {



                         div.innerHTML = xhReq.responseText ;



                         geraJS(xhReq.responseText);



                    }



               }



               xhReq.send(null);



          }



