function aLogin(url) 
{
    var req = init();
    req.onreadystatechange = processRequest;
    function init() 
		{
      if (window.XMLHttpRequest) 
			{
        return new XMLHttpRequest();
      } 
			else if (window.ActiveXObject)
			{
        return new ActiveXObject("Microsoft.XMLHTTP");
      }
    }
    
    function processRequest () 
		{
      if (req.readyState == 4) 
			{
        if (req.status == 200) 
				{
				 req = req.responseText;
				 if(req == 'OK ' || req == 'OK')
				 {
				  window.location.href = 'success.php';
				 } else {
				  document.getElementById('login_response').innerHTML = req;
				 }
        }
      }
    }
    
    this.doPost = function(body) 
		{
      req.open("POST", url, true);
      req.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
      req.send(body);
    }
}

function doReg(postStr) 
{
  document.getElementById('login_response').innerHTML = '<p style="text-align:center;"><img src="login.gif"></p>';
  var ai = new aLogin('doreg.php');
  ai.doPost(postStr);
}