

/*
navigatiefunctie gekopieerd van de originele iiyama site
*/
function replace_navi() {
	if( document.getElementById("subnavigation") ) {
    var ns = (navigator.appName.indexOf("Netscape") != -1);
    var startY = document.getElementById("subnavigation").offsetHeight + 20;
    var topmost = 220;
    
    function ml(id) {
      var el=document.getElementById ? document.getElementById(id) : document.all ? document.all[id]:document.layers[id];
      if(document.layers) el.style=el;
      el.sP=function(x,y) {
        if(y >= topmost) {
          //this.style.left=x;
          this.style.top=y+'px';
        }
      }
      el.x = 650;
      el.y = ns ? pageYOffset + innerHeight : document.body.scrollTop + document.body.clientHeight;
      el.y -= startY;
      return el;
    }
    
    window.stayTopLeft=function() {
      var pY = ns ? pageYOffset + innerHeight : document.body.scrollTop + document.body.clientHeight;
      ftlObj.y += (pY - startY - ftlObj.y)/8;
      ftlObj.sP(ftlObj.x, ftlObj.y);
      setTimeout("stayTopLeft()", 20);
    }
    ftlObj = ml("subnavigation");
    stayTopLeft();
	}
}

//addLoadEvent(replace_navi);

var startY = 0;
function move_subnav()
{
  var subnav = $('subnavigation');
  if (subnav) {
    setTimeout('move_subnav()', 20);
    var mintop = 100;
    var targetY = document.viewport.getScrollOffsets().top;
    if (targetY < mintop) targetY = mintop;
    if ((targetY + subnav.getHeight() + 50) > $('apps-bar').offsetTop) targetY = $('apps-bar').offsetTop-(subnav.getHeight() + 50);
    if (startY == 0) {
      startY = targetY;
    }
    var delta = (targetY - startY) / 8;
    startY += delta;
    subnav.style.top = Math.round(startY) + 'px';
  }
}

addLoadEvent(move_subnav);
