function startRequest(id)
{
  url = "http://localhost/galeria.php?id=" + id;
  url = encodeURI(url);
  startGETRequest(url, onComplete, onEnd);
}

function onComplete(text, xml)
{
  arr = text.split("\n");
  if(arr.length != 2){
    alert("Nieprawidłowa odpowiedź serwera.");
  }
  else if(arr[0] == "error"){
    alert(arr[1]);
  }
  else{
    var img1 = document.getElementById('img1');
    var spanDiv = document.getElementById('spanDiv');
    img1.src = arr[1];
    spanDiv.innerHTML = arr[0];
  }
}

function onEnd()
{
}