window.onload = init;

function init() {
  var res = screen.availWidth;
  if (res>1024) {
    if (res>1280) {
      var image = document.getElementById("imageBanner");
      image.src = "images/banner_navrh_1400.png";
    } else {
      var image = document.getElementById("imageBanner");
      image.src = "images/banner_navrh_1280.png";
    }
  }
  
  document.getElementById("guestBook").onmouseover = backgroundOver;
  document.getElementById("guestBook").onmouseout = backgroundOut;
  
  document.getElementById("articles").onmouseover = backgroundOver;
  document.getElementById("articles").onmouseout = backgroundOut;
  
  document.getElementById("history").onmouseover = backgroundOver;
  document.getElementById("history").onmouseout = backgroundOut;
  
  document.getElementById("other").onmouseover = backgroundOver;
  document.getElementById("other").onmouseout = backgroundOut;
  
  document.getElementById("contact").onmouseover = backgroundOver;
  document.getElementById("contact").onmouseout = backgroundOut;
  
  document.getElementById("activity").onmouseover = backgroundOver;
  document.getElementById("activity").onmouseout = backgroundOut;
  
  document.getElementById("archive").onmouseover = backgroundOver;
  document.getElementById("archive").onmouseout = backgroundOut;
  
  document.getElementById("photo").onmouseover = backgroundOver;
  document.getElementById("photo").onmouseout = backgroundOut;
}

function backgroundOver() {
  this.style.backgroundImage = "url(images/menu_background_over.gif)";
}

function backgroundOut() {
  this.style.backgroundImage = "url(images/menu_background_out.gif)";
}

function showImage(id, position) {
  var res = screen.availWidth;
  if (res>1024) {
    if (res>1280) {
      document.getElementById("hidden").width = "637";
    } else {
      document.getElementById("hidden").width = "660";
    }
  }
  document.getElementById("hidden").src = "showImage.php?imageId="+id;
  document.getElementById("hidden").style.visibility = "visible";
  document.getElementById("hidden").style.top = position+"px";
}

function hideImage() {
  document.getElementById("hidden").src = "";
  document.getElementById("hidden").style.visibility = "hidden";
}
