 function getForm(url)
 {
     document.getElementById('divForm').style.display='none';			
     if (window.XMLHttpRequest)
     {
         req = new XMLHttpRequest();
    }
     else if (window.ActiveXObject)
     {
         req = new ActiveXObject("Microsoft.XMLHTTP");
     }
     
     if(req)
     {
         req.onreadystatechange = resposta;
         req.open("GET", url, true);
         req.setRequestHeader("content-type","application/x-www-form-urlencoded");
         req.send(null);
     }
     else
     {
         alert('O seu navegador não suporta recursos de Ajax.');
     }
 }
 
function resposta()
 {
     if (req.readyState == 4)
     {
         if (req.status == 200)
         {
			var swappableSection = document.getElementById('divForm');
			swappableSection.innerHTML = req.responseText ;
			swappableSection.style.display='block';
			inp = swappableSection.getElementsByTagName('input');
			for(i=0; i < inp.length-1;i++) {
				if(inp[i].type=='text') { inp[i].focus(); break; }
			}
         }
         else
         {
             var swappableSection = document.getElementById('divForm');
             swappableSection.innerHTML = "Problema ao obter dados. Verifique sua conexão a internet.";
         	 swappableSection.style.display='block';			
         }
     }
 }
 // correct