obj = document.getElementById("check_login");
obj.onblur = Check;

function Check()
     {
     query = obj.value;
     filename = "sub/check-form.php?query=" + query;
     ajaxCallback = DisplayAlert;
     ajaxRequest(filename);
     }

function DisplayAlert()
     {
     alert = document.getElementById("alert");
     wynik = ajaxreq.responseXML.getElementsByTagName("error");

     if ( wynik.length > 0 )
          {
          alert.innerHTML = "Login " +query+ " jest już zajęty!";
          obj.style.backgroundColor = "red";
          }
          else
          {
          alert.innerHTML = "";
          obj.style.backgroundColor = "transparent";
          }
     }

