<!--
function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_findObj(n, d) { //v4.0
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && document.getElementById) x=document.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}
//-->

var scrollerBG = "img/SCROLL_lijn.gif";
var upSRC      = "img/SCROLL_up.gif";
var downSRC    = "img/SCROLL_down.gif";
var scrollSRC  = "img/SCROLL_scroller.jpg";

var scrollerHeight = 80;
var leftOffset = 0;
var extraSpace = 0;
var scrollbarWidth = 20;
var scrollArrows = true;

// End of layout

var activeBar = null;
var scrollCount = 0;
var areaCount = 0;
var useBar = null;
var arrowActivator = "onmousedown"
document.bars = [];

function scrollbar(x, y, w, h, nest) {
	this.x = x;
	this.y = y;
	this.w = w;
	this.h = h;
	this.eh = scrollerHeight;

	this.sPos = scrollArrows? this.w:0;
	this.sOff = scrollArrows? (2*this.w):0

	this.currentLayer = null;
	this.currentLyrId = "";
	this.contentHeight = 0;
	this.availHeight = 0;
	this.scrolling = false;
	this.speed = 0;
	this.nested = nest;
	this.build();
}

scrollProto = scrollbar.prototype;
scrollProto.build = dynBuildScrollbar;
scrollProto.setLayer = dynScrollSetLayer;
scrollProto.setupElement = dynScrollSetupElm;
scrollProto.setHeight = dynScrollSetHeight;

	function dynBuildScrollbar() {
		this.id = 'bar'+scrollCount;
		this.cId = this.id + 'container';
		
		with(this.container = new dynObject(this.cId, this.nested)) {
			setProperties(this.x, this.y, this.w, this.h, 'visible', false, 1000);
			clipTo(0,this.w,this.h,0);
		}

		with(this.track = new dynObject(this.cId+'track', this.cId)) {
			setProperties(0,0, this.w, this.h, 'visible');
			setBackground(scrollerBG);	
		}	this.setupElement(this.track, 0,0,this.w,this.h,'dynTrackScroll()');

		if(scrollArrows) {
			this.upArrow   = new dynObject(this.id + 'upArrow', this.cId);
			this.downArrow = new dynObject(this.id + 'downArrow', this.cId);
			this.setupElement(this.upArrow, 0, 0, this.w, this.w, 'dynScrollBy(-2)', upSRC);
			this.setupElement(this.downArrow, 0, (this.h - this.w), this.w, this.w, 'dynScrollBy(2)', downSRC);
		}
		
		this.scroller  = new dynObject(this.id + 'scroller', this.cId);
		this.setupElement(this.scroller, 0, this.sPos, this.w, scrollerHeight, false, scrollSRC);
		
		this.availHeight = this.h - this.sOff - scrollerHeight;
		this.scroller.limitMovement(0, this.sPos, this.w, this.h - this.sPos);
		this.scroller.enableDragDrop('vertical');

		document.bars[scrollCount] = this;
		scrollCount ++;
	}

	function dynScrollSetupElm(elm, x, y, w, h, mouseFunction, img) {
		elm.setProperties(x, y, w, h, 'visible');
		elm.clipTo(0,w,h,0);
		elm.css.visibility = "inherit";
		elm.scrollbar = this;
		elm.css.cursor = "hand";
		elm.attachEvent('onmousedown', 'dynGetScrollbar()');
		elm.attachEvent('onmouseup', 'dynStopScroll()');
		if(img) {
			if(is.NS4) elm.setBackground(img);
			else elm.createImage(img, 0, w, h);
		}
		
		if(mouseFunction) {
			elm.attachEvent(arrowActivator, 'dynGetScrollbar()');
			elm.attachEvent('onmouseout', 'dynStopScroll()')
			elm.attachEvent(arrowActivator, mouseFunction);
		}		
	}

	function dynScrollSetHeight(h) {
		this.h = h;
		with(this.container) {
			resizeTo(this.w, this.h);
			clipTo(0, this.w, this.h, 0);
		}

		this.downArrow.moveTo(0,(this.h-this.w));
		this.availHeight = this.h - this.sOff - scrollerHeight;
		this.setLayer(this.currentLayer.id)

		with(this.scroller) {
			moveTo(0,this.sPos);
			limitMovement(0, this.sPos, this.w, this.h - this.sPos);
		}
	}

	function dynScrollBy(dir, target) {
		if(useBar && useBar.needed) {
			var useDy = dir * useBar.speed;
			useBar.scroller.moveBy(0, useDy);
			dynHandleScroll();

			if(!target || Math.abs(useBar.scroller.y - target) > 7)
			setTimeout('dynScrollBy('+dir+','+(target || 0)+')', 40);
		}
	}

	function dynTrackScroll() {
		if(useBar && useBar.needed && arrowActivator != 'onmouseover') {
			var dy = activeObj.clickY - useBar.eh/2 - useBar.scroller.y
			dynScrollBy((dy < 0)? -5:5, activeObj.clickY - useBar.eh/2)
		}
	}

		function dynWheelStep(dir) {
			useBar = activeBar || document.bars[0];
			if(useBar && useBar.needed) {
				useBar.scroller.moveBy(0, dir);
				dynHandleScroll();
			}
			dynStopScroll();
		}

	function dynStopScroll() {
		useBar = false;		
	}

	function dynGetScrollbar() {
		useBar = activeObj.scrollbar;
		activeBar = useBar;
	}

	function dynScrollSetLayer(to) {
		if(!document.dyn[to]) {	new dynObject(to, null, true); }
		if(this.currentLayer) {	this.currentLayer.setVisible(false); }	
		
		this.currentLayer = document.dyn[to];
		this.currentLyrId = to;

		with(this.currentLayer) {
			moveTo(leftOffset, 0);
			getDimensions();
			this.speed = (this.h/h)*7;
			this.pageHeight = this.availHeight/(h/this.h);
		}

		this.scroller.moveTo(0, this.sPos);
		this.contentHeight = this.currentLayer.h - this.h + extraSpace;
		this.currentLayer.setVisible(true);
		this.needed = (this.contentHeight <= 0)? false:true;
		this.container.setVisible(this.needed);
	}

function dynHandleScroll() {
	if(useBar && useBar.currentLayer) {
		contentY = ((useBar.scroller.y - useBar.sPos)/
			useBar.availHeight) * useBar.contentHeight;
		useBar.currentLayer.moveTo(leftOffset, - contentY)
	}
}

document.attachEvent('onmousemove', 'dynHandleScroll()');
document.attachEvent('onmouseup', 'dynStopScroll()');
document.onkeydown = doKeyDown;

if(is.IE6) { document.onmousewheel = doWheel; }

function doWheel() {
	var delta = event.wheelDelta;
	if(delta) dynWheelStep(-delta/15);
}

var KU = is.NS4? 56:38;
var KD = is.NS4? 50:40;
var PU = is.NS4? 1000:33;
var PD = is.NS4? 1000:34;

function doKeyDown(e) {
	useBar = activeBar || document.bars[0];
	var key = is.IE? event.keyCode:e.which;
	if(key == KU) dynWheelStep(-4);
	if(key == KD) dynWheelStep(4);
	if(key == PU) dynWheelStep(-useBar.pageHeight);
	if(key == PD) dynWheelStep(useBar.pageHeight);
}