//all codes copyright by Plataforma, 2003, except differently specified

//functies voor menu
var active = false;
var buffer = new Array(6);
buffer[0] = null;
buffer[1] = null;
buffer[2] = null;
buffer[3] = null;
buffer[4] = null;
buffer[5] = null;

function showMenu(i, layerName) {
	hideAll();
	buffer[i]=layerName;
	if (document.all) {
		document.all[layerName].style.visibility='visible';
	}
	else if (document.getElementById) {
		document.getElementById(layerName).style.visibility='visible';
	}
	else if (document.layers) {
		document.layers[layerName].visibility='show';
	}
}

function hideAll() {
	if (!active) {
		for (x=0;x<buffer.length;x++) {
			if (buffer[x]!=null) {
				if (document.all) {
					document.all[buffer[x]].style.visibility = 'hidden';
				}
				else if (document.getElementById) {
					document.getElementById(buffer[x]).style.visibility = 'hidden';
				}
				else if (document.layers) {
					document.layers[buffer[x]].visibility = 'hide';
				}
				buffer[x]=null;
			}
		}
	}
}


if (document.layers)
{
	var i = 0;
	window.captureEvents(Event.MOUSEDOWN);
	window.onmousedown = hideAll;
	document.write("<link rel=stylesheet href='js/nbnn.css' type='text/css'>");
}


//functie om pagina altijd in het midden te plaatsen
function centralize()	{
var browserwidth
var browserheight
if (window.innerWidth) {
  browserwidth  = window.innerWidth;
  browserheight = window.innerHeight;
} else {
  browserwidth  = document.body.clientWidth;
  browserheight = document.body.clientHeight;              
}
var links
var boven
links = (browserwidth/2) - 450;
boven = (browserheight/2) - 225;
if (links < 0) { links = 0}
if (boven < 0) { boven = 0}
document.write("<div id=\"website\" style=\"position: absolute; left: "+ links +"; top: "+ boven +"\">");
}


// ASM SCROLLER 2.0 - (c) 2000 Brent Gustafson, vitaflo.com and assembler.org
//
// Feel free to hack around with this code for personal use, it's open source
// so do what ya want w/ it.  Though a link would be nice. ;)  While this code
// doesn't have a ton of documentation, please remember that I am a busy man,
// so support of this code will be very minimal.  Use at your own risk.
//
// -Brent (brent@assembler.org)
// assembler.org || vitaflo.com

var w3c = (document.getElementById) ? 1:0
var ns4 = (document.layers) ? 1:0
var ie4 = (document.all) ? 1:0

var range = "";
var cap = "";
var mutex = 0;
var yplace = 0;
var ymax = 0;
var ymin = 0;
var xplace = 0;
var newsHeight = 0;

/** The only code you should ever need to change here are the following 3 vars **/
var speed = 2;                         //speed at which the news scrolls
var newsId = "content";                //name of the overall news div
var newsClipId = "contentClipping";    //name of the news clipping div

function redrawScreen() {
  location.reload();
  return false
}

function shiftTo(obj, x, y) {
  if (w3c) {
    obj.style.left = x + "px";
    obj.style.top = y + "px";
  }
  else if (ns4) {
	 obj.moveTo(x,y);
  } 
  else if (ie4) {
    obj.style.pixelLeft = x;
	obj.style.pixelTop = y;
  }
}

function getObject(obj) {
	var theObj = eval("document." + range + obj + cap);
	return theObj;
} 

function scrollUp() {
  if (mutex == 1){
    var theObj = getObject(newsId);
    if (yplace < ymax) {
      yplace = yplace + speed;
      if (yplace > ymax) yplace = ymax;
      shiftTo(theObj, xplace, yplace);
      setTimeout("scrollUp()",25);
    }
  }
}
  
function scrollDown() {
  if (mutex == 2){
    var theObj = getObject(newsId);
    if (yplace > ymin) {
      yplace = yplace - speed;
      if (yplace < ymin) yplace = ymin;
      shiftTo(theObj, xplace, yplace);
      setTimeout("scrollDown()",25);
    }
  }
}

function scrollIt(msg, dir) {
  window.status = msg; 
  mutex = dir;
  if (mutex == 1) scrollUp();
  else if (mutex == 2) scrollDown();
}

function init() {
  if (w3c) {
    range = "getElementById(\"";
    cap = "\")";
    theObj = getObject(newsClipId);
    newsHeight = parseInt(theObj.offsetHeight);
    theObj = getObject(newsId);
    ymin = (parseInt(theObj.offsetHeight) - newsHeight) * -1;
  }
  else if (ns4) {
    window.captureEvents(Event.RESIZE);
    window.onresize = redrawScreen;
    theObj = getObject(newsClipId);
    newsHeight = theObj.clip.height;
    newsId = newsClipId + ".document." + newsId;
    theObj = getObject(newsId);
    ymin = (theObj.clip.height - newsHeight) * -1;
  }
  else if (ie4) {
    range = "all.";
    theObj = getObject(newsClipId);
    newsHeight = theObj.offsetHeight;
    theObj = getObject(newsId);
    ymin = (theObj.offsetHeight - newsHeight) * -1;
  }
}


// END OF LINE



function newImage(arg) {
	if (document.images) {
		rslt = new Image();
		rslt.src = arg;
		return rslt;
	}
}

function changeImages() {
	if (document.images && (preloadFlag == true)) {
		for (var i=0; i<changeImages.arguments.length; i+=2) {
			document[changeImages.arguments[i]].src = changeImages.arguments[i+1];
		}
	}
}

var preloadFlag = false;
function preloadImages() {
	if (document.images) {
		navigatiemenu_01_over = newImage("images/navigatiemenu_01-over.gif");
		preloadFlag = true;
	}
}
