var onprogress = false;

function startRequest()
{
  if(onprogress){
    return;
  }
  tfHasloText = document.getElementById('tfHaslo').value;
  if(tfHasloText == ""){
    alert("Proszę wprowadzić hasło.");
    return;
  }

  if(document.getElementById('rbPolski').checked){
    direction = 1;
  }
  else{
    direction = 2;
  }

  url = "http://localhost/dane.php?haslo=" + tfHasloText;
  url += "&direction=" + direction;
  url = encodeURI(url);

  var onprogress = true;
  startGETRequest(url, onComplete, onEnd);
}

function onComplete(text, xml)
{
  var dataDiv = document.getElementById('dataDiv');
  dataDiv.innerHTML = text;
}

function onEnd()
{
  var onprogress = false;
}