function updateTitle(title) {
   if (top.document.title)
      top.document.title = title;
   if (top.title)
      top.title = title;
}

function updateNavigation(id) {
   var frame = top.frames["nav"];
   if (frame)
      frame.location.href = "nav.asp?id=" + id;
}

function newwindow(url) {
   window.open(url, "new", "width=" + (screen.width - 160) + ",height=" + (screen.height - 160) + ",screenX=80,screenY=70,location=no,menubar=no,resizable=yes,scrollbars=yes,toolbar=no");
}

function checkFrames() {
   if (top.frames && (top.frames.length < 3) && top.location && top.location.href && top.location.protocol && top.location.hostname)
      top.location.href = top.location.protocol + "//" + top.location.hostname + "/";
}

function scrollDown() {
   window.scrollTo(0, 65535);
}

function clickMenu(td) {
   var a = td.firstChild;
   if (a && a.tagName && a.tagName.toUpperCase() == "A" && a.href && top.frames && a.getAttribute) {
      var w = top.frames[a.getAttribute("target")];
      w.location.href = a.href;
   }
}

function openwindow(url, target) {
   if (target == "_top")
      window.top.location.href = url;
   else if (target == "_blank")
      window.open(url, '_blank', 'location=yes,menubar=yes,toolbar=yes,resizable=yes,scrollbars=yes,status=yes');
   else
      window.top.frames[target].location.href = url;
   event.cancelBubble = true;
}

function switchMenuBackgroundImage(img, mode) {
   var dir = "images/buttons/", images = ["navigatie_links_hover_klein.png", "navigatie_links_hover.png", "navigatie_links_klein.png", "navigatie_links.png"], iimage = 0;
   if (mode != "over") iimage += 2;
   if (img.className.indexOf("menu2") == -1) iimage++;
   img.style.backgroundImage = "url(" + dir + images[iimage] + ")";
}

function getMSIEversion() {
   var v = navigator.appVersion, i1 = v.indexOf("MSIE"), i2 = v.indexOf(";", i1);
   if (i1 >= 0) {
      if (i2 == -1)
         i2 = v.length - 2;
      var version = v.substring(i1 + 4, i2);
      while (version.length > 0 && version.charAt(0) == " ")
         version = version.substr(1);
      while (version.length > 0 && version.charAt(version.length - 1) == " " && version.charAt(version.length - 1) == ")" && version.charAt(version.length - 1) == ";")
         version = version.substr(0, version.length - 1);
      return version;
   }
   return null;
}

function attachMenuEvents() {
   var version = getMSIEversion();
   if (version != null && version < "7.0") {
      var menu = document.getElementById("menu");
      for (var i = 0; i < menu.childNodes.length; i++) {
         menu.childNodes[i].onmouseover = function() { switchMenuBackgroundImage(this, "over"); };
         menu.childNodes[i].onmouseout = function() { switchMenuBackgroundImage(this, "out"); };
      }
   }
}
