// version 1.02 modified by Jeroen klein Gebbink - (c)2004 Communicatie Kant

// enige basis browser en os checks:
var agent = navigator.userAgent.toLowerCase();
var os = navigator.platform.toLowerCase();
var win = (os.indexOf('win32')!=-1);
var mac = (os.indexOf('mac')!=-1);
var ie5 = (agent.indexOf('msie 5')!=-1);
var ie6 = (agent.indexOf('msie 6')!=-1);
var ie7 = (agent.indexOf('msie 7')!=-1);
var nn = (agent.indexOf('netscape')!=-1);
var mz = (agent.indexOf('gecko')!=-1 && !nn);
var op5 = (agent.indexOf('opera 5')!=-1);
var op6 = (agent.indexOf('opera 6')!=-1);
if (op5 || op6) {	ie5 = false; ie6 = false; nn = false;	}
if (ie7) { ie6 = true; }

// dit te doen wanneer browsers dit script niet ondersteund; verwijder dit desgewenst:
if (!document.getElementById || op5) {    window.location = "http://www.sturris.nl/error.html"	}

// initiatie variabelen:
var scrollnum = 3;	// aantal scrollers op de pagina (eigenlijk enige te wijzigen variabele)
var interval = 25; // aantal miliseconden tussen de scrollupdates (lager = sneller)
var speed = 3;	// speed of movement pr. interval - normal scroll
var barspeed = 6; // speed of movment pr. interval - click on scrollbg
var wheelspeed = 20; //	speed of movment pr. interval  - mousewheel
var px = (op5 || op6) ? '' : 'px';
var scrollers = new Array();
var dobarscroll = false;
var orgslide = false;
var loadedscroll = false;
var dowheelscroll = false;
var loadedlayers = false;
var thenum;
var thetimer;
var evy;
var evx;
var direction;
var scrollerbasewidth = 15;
var horscroller = false;
var vertscroller = false;
var dotsheight;
var navmenuheight;
var mainWindow = null;

// Verbergen vensterscrollbars:
function hideScrollbars() {
	if (ie5 || ie6) {
		document.body.scroll = "no";
	} else if (nn) {
		//netscape.security.PrivilegeManager.enablePrivilege("UniversalBrowserWrite");
		self.scrollbars.visible = false;
	}
}

// get cookie functie:
function getCookie(Name) {
	var search = Name + "=";
	if (document.cookie.length > 0) {
		offset = document.cookie.indexOf(search);
		if (offset != -1) {
			offset += search.length;
			end = document.cookie.indexOf(";", offset);
			if (end == -1) end = document.cookie.length;
				return unescape(document.cookie.substring(offset, end));
		}
	}
}

// set cookie functie:
function setCookie(name, value, expire) {
	document.cookie = name + "=" + escape(value) + ((expire == null) ? "" : ("; expires=" + expire.toGMTString()))
}

// functies om eigenschappen van objecten te krijgen:
function getObjStyle(name) {
	if (document.all) {
		return document.all[name].style;
	} else if (document.getElementById) {
		return document.getElementById(name).style;
	} else if (document.layers) {
		return document.layers[name];
	}
}

// functie om objecten aan te roepen:
function getObj(name) {
	if (document.all) {
		return document.all[name];//.document
	} else if (document.getElementById) {
		return document.getElementById(name);
	} else if (document.layers) {
		return document.layers[name];
	}
}

// overige tijdbesparende gedeelde functies:
function gety(el) {
	if (op5) {
		return getObjStyle(el).pixelTop; 
	} else {
		return getObj(el).offsetTop;
	}
}

function geth(el) {
	if (op5) {
		return getObjStyle(el).pixelHeight;
	} else {
		return getObj(el).offsetHeight;
	}
}

function sety(el,y) {
	getObjStyle(el).top = y+px;
}

function seth(el,y) {
	getObjStyle(el).height = y+px;
}

function getx(el) {
	if (op5) {
		return getObjStyle(el).pixelLeft;
	} else {
		return getObj(el).offsetLeft;
	}
}

function getw(el) {
	if (op5) {
		return getObjStyle(el).pixelWidth;
	} else {
		return getObj(el).offsetWidth;
	}
}

function setx(el,x) {
	getObjStyle(el).left = x+px;
}

function setw(el,x) {
	getObjStyle(el).width = x+px;
}

function setZIndex(layers,value) {
	layertochange = getObjStyle(layers);
	layertochange.zIndex = value;
}

function setTop(layers,value) {
	layertochange = getObjStyle(layers);
	layertochange.top = value;
}

function setLeft(layers,value) {
	layertochange = getObjStyle(layers);
	layertochange.left = value;
}

function setWidth(layers,value) {
	layertochange = getObjStyle(layers);
	layertochange.width = value;
}

function setHeight(layers,value) {
	layertochange = getObjStyle(layers);
	layertochange.height = value;
}

// verschaal venster to maximale afmeting en verplaats venster naar coordinaat 0,0
var windowWidth,windowHeight;

function maxWindowSize() {
	window.moveTo(0,0);
	if (ie5 || ie6) {
		window.resizeTo(screen.availWidth,screen.availHeight);
	} else if (nn) {
		window.outerWidth = screen.availWidth;
		window.outerHeight = screen.availHeight;
	}
}

function getWindowInnerWidth() {
	if (nn) {
		windowWidth = window.innerWidth;
	} else {
		windowWidth = document.body.clientWidth;
	}
	return windowWidth;
}

function getWindowInnerHeight() {
	if (nn) {
		windowHeight = window.innerHeight;
	} else {
		windowHeight = document.body.clientHeight;
	}	
	return windowHeight;
}

// start event capturing:
document.onmousemove = mouseMove;
document.onmouseup = mouseUp;
document.onmousedown = mouseDown;

// setup alle benodigde scrollers, etc. op de pagina, ook bij resize:
//window.onload = setUp;//dient uitgeschakeld te zijn, omdat setUp() binnen andere functies wordt aangeroepen bij het laden van de betreffende pagina! Tevens bij index.html geeft dit een error
window.onresize = setUp;

// functie om het target element te bepalen (t.b.v. event capturing):
function getTargetElement(evt) {
	var elem = (evt.target)	? evt.target : evt.srcElement;
	if (elem.nodeType == 3 || elem.tagName.toLowerCase()=='img') { 
		return elem.parentNode;//parent container dient event te ontvangen
	} else {
		return elem;
		}
	}

// functies om lagen te tonen of te verbergen:
function showLayer(layer) {
	layertoshow = getObjStyle(layer);
	if (document.layers) {
		vista = 'show';
	} else if (document.all || document.getElementById) {
		vista = 'visible';
	}
	layertoshow.visibility = vista;
}

function hideLayer(layer) {
	layertohide = getObjStyle(layer);
	if (document.layers) {
		vista = 'hide';
	} else if (document.all || document.getElementById) {
		vista = 'hidden';
	}
	layertohide.visibility = vista;
}

// reset scrollers bijvoorbeeld bij mouseup event buiten scroller:
function resetScroller() {
	if (thetimer) clearTimeout(thetimer);
	if (dobarscroll) dobarscroll = false;
	if (thenum) {
		//vertikaal
		scrollers[thenum].main_starty = scrollers[thenum].main_starty_org;
		scrollers[thenum].main_endy = scrollers[thenum].main_endy_org;
		scrollers[thenum].scroll_height = scrollers[thenum].scroll_height_org;
		//horizontaal
		scrollers[thenum].main_startx = scrollers[thenum].main_startx_org;
		scrollers[thenum].main_endx = scrollers[thenum].main_endx_org;
		scrollers[thenum].scroll_width = scrollers[thenum].scroll_width_org;
	}
}

// functie die de mousedown events afwikkelt:
function mouseDown(evt) {
	evt = (evt) ? evt : ((window.event) ? window.event : "");
    if (evt) {
        var elem = getTargetElement(evt);//ontvangende element
		var theid = elem.id; //layer id van het event ontvangende element 
		// scroll functies
		if (loadedscroll) { //loadedscroll hoeft niet gechecked te worden; eventueel veranderen
			resetScroller();
			if (theid.slice(0,6) == 'scroll') {//check of het ontvangende element deel uit maakt van de scrollbars
				var thefunc = theid.slice(0,theid.length-1); //thefunc extraheert de naam van de layer (scrollvup, scrollhbar, etc.)
				thenum = theid.charAt(theid.length-1); //welke scroller ontvangt event (nummer)
				// als het event ontvangend element is 'scrolldown' of 'scrollup'
				if (thefunc == 'scrollvup' || thefunc == 'scrollvdown') {	
					if (thefunc == 'scrollvup') {
						scrollers[thenum].currspeed = speed;
					} else {
						scrollers[thenum].currspeed = -speed;
					}
					direction = "vertical";
					doScroll(direction);	
					return;
				}
				// als het event ontvangend element 'scrollleft' of 'scrollright'
				if (thefunc == 'scrollhleft' || thefunc == 'scrollhright') {	
					if (thefunc == 'scrollhleft') {
						scrollers[thenum].currspeed = speed;
					} else {
						scrollers[thenum].currspeed = -speed;
					}
					direction = "horizontal";
					doScroll(direction);	
					return;
				}
				// als het event ontvangend element is 'scrollbg'
				if (thefunc == 'scrollvbg') {
					evy = (ie5 || ie6 || op6) ? evt.offsetY : evt.layerY;
					var ratioy = scrollers[thenum].main_endy / scrollers[thenum].scroll_height;
					evy = evy - (scrollers[thenum].bar_height / 2);
					if (evy < gety(scrollers[thenum].bar_v_id)) {
						scrollers[thenum].currspeed = barspeed;
						scrollers[thenum].main_starty = Math.round(evy*ratioy);
						if (scrollers[thenum].main_starty > scrollers[thenum].main_starty_org) scrollers[thenum].main_starty = scrollers[thenum].main_starty_org;
					}
					if (evy > gety(scrollers[thenum].bar_v_id)) {
						scrollers[thenum].currspeed = -barspeed;
						if (evy > scrollers[thenum].scroll_height_org) evy = scrollers[thenum].scroll_height_org;
						scrollers[thenum].main_endy = Math.round(evy * ratioy);
						scrollers[thenum].scroll_height = evy;
					}
					direction = "vertical";
					doScroll(direction);
					return;
				}
				if (thefunc == 'scrollhbg') {
					evx = (ie5 || ie6 || op6) ? evt.offsetX : evt.layerX;
					var ratiox = scrollers[thenum].main_endx / scrollers[thenum].scroll_width;
					evx = evx - (scrollers[thenum].bar_width / 2);
					if (evx < getx(scrollers[thenum].bar_h_id)) {
						scrollers[thenum].currspeed = barspeed;
						scrollers[thenum].main_startx = Math.round(evx*ratiox);
						if (scrollers[thenum].main_startx > scrollers[thenum].main_startx_org) scrollers[thenum].main_startx = scrollers[thenum].main_startx_org;
					}
					if (evx > getx(scrollers[thenum].bar_h_id)) {
						scrollers[thenum].currspeed = -barspeed;
						if (evx > scrollers[thenum].scroll_width_org) evx = scrollers[thenum].scroll_width_org;
						scrollers[thenum].main_endx = Math.round(evx * ratiox);
						scrollers[thenum].scroll_width = evx;
					}
					direction = "horizontal";
					doScroll(direction);	
					return;
				}
				// als het event ontvangend element is 'scrollbar'
				if (thefunc == 'scrollvbar')	{
					direction = "vertical";
					dobarscroll = true;	
					evy = (ie5 || ie6 || op6) ? evt.offsetY : evt.layerY;
					return;
				}
				if (thefunc == 'scrollhbar')	{
					direction = "horizontal";
					dobarscroll = true;	
					evx = (ie5 || ie6 || op6) ? evt.offsetX : evt.layerX;
					return;
				}
			} else {
				if (elem.name == "icon") {
					if ((ie5 || ie6) && (event.button == 2 || event.button == 3)) {
						alert('(c)Sturris B.V. Dit icon is auteursrechtelijk beschermd.');
					}
				}
			}
		} 
	}
}

// functie die de mouseup events afwikkeld:
function mouseUp(evt) {
	evt = (evt) ? evt : ((window.event) ? window.event : "");
	if (evt) {
		var elem = getTargetElement(evt);//ontvangende element
		var theid = elem.id; //layer id van het event ontvangende element 
		// scroll functies
		if (loadedscroll) { //loadedscroll hoeft niet gechecked te worden; eventueel veranderen
			resetScroller();
		// andere functies
	//	} else {
		//	return;
		}
	}
}

// functie die de mousemove events afwikkelt:
function mouseMove(evt) {
	evt = (evt) ? evt : ((window.event) ? window.event : "");
	if (evt) {
		var elem = getTargetElement(evt);
		// scroll functies
		if (dobarscroll && thenum) {
			if (direction == "vertical") {
				var my = evt.clientY;
				var y = (my - evy) - scrollers[thenum].scroll_top;
				if (y < scrollers[thenum].bar_starty) y = scrollers[thenum].bar_starty;	
				if (y > scrollers[thenum].bar_endy) y = scrollers[thenum].bar_endy;
				sety(scrollers[thenum].bar_v_id,y);	
				var barslide = Math.round((gety(scrollers[thenum].bar_v_id) - (scrollers[thenum].bar_starty)) * (1 / scrollers[thenum].slide_v_length));
				sety(scrollers[thenum].main_id,-barslide);
				if (barslide==0 && gety(scrollers[thenum].main_id)!=scrollers[thenum].main_starty) sety(scrollers[thenum].main_id,scrollers[thenum].main_starty);
				return false;
			}
			if (direction == "horizontal") {
				var mx = evt.clientX;	
				var x = (mx - evx) - scrollers[thenum].scroll_left;
				if (x < scrollers[thenum].bar_startx) x = scrollers[thenum].bar_startx;	
				if (x > scrollers[thenum].bar_endx) x = scrollers[thenum].bar_endx;
				setx(scrollers[thenum].bar_h_id,x);	
				var barslide = Math.round((getx(scrollers[thenum].bar_h_id) - (scrollers[thenum].bar_startx)) * (1 / scrollers[thenum].slide_h_length));
				setx(scrollers[thenum].main_id,-barslide);
				if (barslide==0 && getx(scrollers[thenum].main_id)!=scrollers[thenum].main_startx) sety(scrollers[thenum].main_id,scrollers[thenum].main_startx);
				return false;
			}
		}
	} else {
		return;
	}
}

// wheelscroll functie
function wheelScroll() {
	if (!dowheelscroll) {
		var el = event.srcElement;
		if (el.id.slice(0,el.id.length-1)!='main') {
		do {
			el = el.parentNode;
		} while (el.tagName.toLowerCase()!='div' || el.id.slice(0,el.id.length-1)!='main')
	}
	thenum = el.id.charAt(el.id.length-1);
	var vertscroller = new getObj(("scrollv"+thenum));
	//alleen wheelscroll wanneer scroller visible!
	if (vertscroller.style.visibility == "visible") {
		if (thenum) oldnum = thenum;
		if (!thenum) thenum = oldnum;
		if (event.wheelDelta >= 120) scrollers[thenum].currspeed = wheelspeed;
		else if (event.wheelDelta <= -120) scrollers[thenum].currspeed = -wheelspeed;
		dowheelscroll = true;
		doScroll('vertical');
		return;
		}
	}
}

// hoofd scroll functie:
function doScroll(whichdirection)	{
	direction = whichdirection;
	if (!thenum) return;
	// vertikaal scrollen
	if (direction == "vertical") {
		if (gety(scrollers[thenum].main_id)+scrollers[thenum].currspeed>scrollers[thenum].main_starty) scrollers[thenum].currspeed = scrollers[thenum].main_starty - gety(scrollers[thenum].main_id);
		if (gety(scrollers[thenum].main_id)+scrollers[thenum].currspeed<scrollers[thenum].main_endy) scrollers[thenum].currspeed = scrollers[thenum].main_endy - gety(scrollers[thenum].main_id);	 
		sety(scrollers[thenum].main_id, gety(scrollers[thenum].main_id)+scrollers[thenum].currspeed);
		var mainslidev = Math.round(gety(scrollers[thenum].main_id)/(scrollers[thenum].main_endy/scrollers[thenum].scroll_height));
		if (mainslidev<0) mainslidev = 0;
		if (mainslidev>scrollers[thenum].scroll_height) mainslidev = scrollers[thenum].scroll_height;
		sety(scrollers[thenum].bar_v_id, scrollers[thenum].bar_starty+mainslidev);
	}
	// horizontaal scrollen
	if (direction == "horizontal") {
		if (getx(scrollers[thenum].main_id)+scrollers[thenum].currspeed>scrollers[thenum].main_startx) scrollers[thenum].currspeed = scrollers[thenum].main_startx - getx(scrollers[thenum].main_id);
		if (getx(scrollers[thenum].main_id)+scrollers[thenum].currspeed<scrollers[thenum].main_endx) scrollers[thenum].currspeed = scrollers[thenum].main_endx - getx(scrollers[thenum].main_id);	 
		setx(scrollers[thenum].main_id, getx(scrollers[thenum].main_id)+scrollers[thenum].currspeed);
		var mainslideh = Math.round(getx(scrollers[thenum].main_id)/(scrollers[thenum].main_endx/scrollers[thenum].scroll_width));
		if (mainslideh<0) mainslideh = 0;
		if (mainslideh>scrollers[thenum].scroll_width) mainslideh = scrollers[thenum].scroll_width;
		setx(scrollers[thenum].bar_h_id, scrollers[thenum].bar_startx+mainslideh);
	}
	//
	if (!dowheelscroll) thetimer = setTimeout('doScroll(direction)', interval);
	dowheelscroll = false;
	return false;
}

/*
in de setup functie voor de scrollers hieronder is 'cont' is veranderd in 'table' 
bij main_endx en main_endx_org t.b.v. nn versie 7!
*/

function setUpScrollers() {
	for (var i = 0; i < scrollnum; i++) {
		if (getObj("cont"+i)) {
			if (nn) {
				scrollers[i] = {
					bar_starty				: gety('scrollvup'+i)+geth('scrollvup'+i),
					bar_height				: geth('scrollvbar'+i),
					bar_endy				: gety('scrollvdown'+i)-geth('scrollvbar'+i),
					bar_v_id				: 'scrollvbar'+i,
					scroll_height			: geth('scrollvbg'+i)-geth('scrollvbar'+i),
					scroll_height_org	: geth('scrollvbg'+i)-geth('scrollvbar'+i),
					scroll_top				: gety('scrollv'+i),
					bar_startx				: getx('scrollhleft'+i)+getw('scrollhleft'+i),
					bar_width				: getw('scrollhbar'+i),
					bar_endx				: getx('scrollhright'+i)-getw('scrollhbar'+i),
					bar_h_id				: 'scrollhbar'+i,
					scroll_width			: getw('scrollhbg'+i)-getw('scrollhbar'+i),
					scroll_width_org		: getw('scrollhbg'+i)-getw('scrollhbar'+i),
					scroll_left				: getx('scrollh'+i),
					main_starty			: gety('main'+i),
					main_starty_org	 	: gety('main'+i),
					main_endy				: ((geth('main'+i)*-1)+geth('cont'+i)),
					main_endy_org		: ((geth('main'+i)*-1)+geth('cont'+i)),
					main_startx			: getx('main'+i),
					main_startx_org	 	: getx('main'+i),
					main_endx				: ((getw('table'+i)*-1)+getw('main'+i)),
					main_endx_org		: ((getw('table'+i)*-1)+getw('main'+i)),
					main_id					: 'main'+i,
					currspeed				: -speed,
					slide_v_length		: (geth('scrollvbg'+i)-geth('scrollvbar'+i))/(geth('main'+i)-geth('cont'+i)),
					slide_h_length		: (getw('scrollhbg'+i)-getw('scrollhbar'+i))/(getw('table'+i)-getw('cont'+i))
				}
			} else {
				scrollers[i] = {
					bar_starty				: gety('scrollvup'+i)+geth('scrollvup'+i),
					bar_height				: geth('scrollvbar'+i),
					bar_endy				: gety('scrollvdown'+i)-geth('scrollvbar'+i),
					bar_v_id				: 'scrollvbar'+i,
					scroll_height			: geth('scrollvbg'+i)-geth('scrollvbar'+i),
					scroll_height_org	: geth('scrollvbg'+i)-geth('scrollvbar'+i),
					scroll_top				: gety('scrollv'+i),
					bar_startx				: getx('scrollhleft'+i)+getw('scrollhleft'+i),
					bar_width				: getw('scrollhbar'+i),
					bar_endx				: getx('scrollhright'+i)-getw('scrollhbar'+i),
					bar_h_id				: 'scrollhbar'+i,
					scroll_width			: getw('scrollhbg'+i)-getw('scrollhbar'+i),
					scroll_width_org		: getw('scrollhbg'+i)-getw('scrollhbar'+i),
					scroll_left				: getx('scrollh'+i),
					main_starty			: gety('main'+i),
					main_starty_org	 	: gety('main'+i),
					main_endy				: ((geth('main'+i)*-1)+geth('cont'+i)),
					main_endy_org		: ((geth('main'+i)*-1)+geth('cont'+i)),
					main_startx			: getx('main'+i),
					main_startx_org	 	: getx('main'+i),
					main_endx				: ((getw('main'+i)*-1)+getw('cont'+i)),
					main_endx_org		: ((getw('main'+i)*-1)+getw('cont'+i)),
					main_id					: 'main'+i,
					currspeed				: -speed,
					slide_v_length		: (geth('scrollvbg'+i)-geth('scrollvbar'+i))/(geth('main'+i)-geth('cont'+i)),
					slide_h_length		: (getw('scrollhbg'+i)-getw('scrollhbar'+i))/(getw('main'+i)-getw('cont'+i))
				}
			}
			if (ie6 && !mac) {
				getObj(scrollers[i].main_id).onmousewheel = function() {
					wheelScroll();
				}	
			}
		}
	}
}

function setUp() {
	windowHeight = getWindowInnerHeight();
	windowWidth = getWindowInnerWidth();

//nu met functie voor tonen disclaimer laag onderin het browser-venster

	//nieuws kolom:
	if (getObj("newscolumn")) {
		var scrollmargin = 179;//180-1 voor overlap border van 1px!
		sety("newscolumn",0);
		seth("newscolumn",(windowHeight));
		setx("newscolumn",(windowWidth-scrollmargin-1));
		showLayer("newscolumn");
	} else {
		var scrollmargin = 20;
	}
	// postionering lagen:
	if (getObj("cont0")) {
		//
		hideScroller(0);
		//
		seth("cont0",(windowHeight-154-45));
		setw("cont0",(windowWidth-221-scrollmargin-15));//-30 is een extra marge t.b.v. de klantlijn aan de rechterzijde
		//
		seth("scrollv0",(windowHeight-115-30));
		setx("scrollv0",(windowWidth-scrollmargin-15));
		seth("scrollvbg0",(geth('scrollv0')-30));
		sety("scrollvdown0",(geth('scrollv0')-15));
		//
		setw("scrollh0",(windowWidth-204-scrollmargin));//-30
		sety("scrollh0",(windowHeight-45));
		setw("scrollhbg0",(getw('scrollh0')-scrollmargin));//-30
		setx("scrollhright0",(getw('scrollh0')-15));
		setw("scrollhvoor0",(windowWidth-geth('scrollh0')-204-30));
		sety("scrollhvoor0",(windowHeight-45));
		//
		setw("disclaimer", (windowWidth-204));
		sety("disclaimer", (windowHeight-30-1));//-1 is overlap met scrollh
		showLayer("disclaimer");
	}/**/
	if (getObj("cont1")) {
		//
		hideScroller(1);
		//
		seth("cont1",(windowHeight-130-20-168));
		setw("cont1",350);//windowWidth-234-370-180
		//
		seth("scrollv1",(windowHeight-91-9-168));
		setx("scrollv1",(204+400-15+1));//correctiefaktor? of altijd goed?
		seth("scrollvbg1",(geth('scrollv1')-30));
		sety("scrollvdown1",(geth('scrollv1')-15));
		//
		setw("scrollh1",401);//(windowWidth-204-30)
		sety("scrollh1",(windowHeight-100-68-15+1));//correctiefaktor
		setw("scrollhbg1",(getw('scrollh1')-30));
		setx("scrollhright1",(getw('scrollh1')-15));
		setw("scrollhvoor1",(30));
		sety("scrollhvoor1",(windowHeight-100-68-15+1));
		//
	}
	if (getObj("cont2")) {
		seth("cont2",(windowHeight-130-20-138+6));//+6 = correctie hoogte volgens scrollv
		setw("cont2",540);//windowWidth-234-370-180
		//
		seth("scrollv2",(windowHeight-91-9-178));
		setx("scrollv2",(201+540-15+1));//correctiefaktor? of altijd goed?
		seth("scrollvbg2",(geth('scrollv2')-30));
		sety("scrollvdown2",(geth('scrollv2')-15));
		//
		setw("scrollh2",401);//(windowWidth-204-30)
		sety("scrollh2",(windowHeight-100-68-15+1));//correctiefaktor
		setw("scrollhbg2",(getw('scrollh2')-30));
		setx("scrollhright2",(getw('scrollh2')-15));
		setw("scrollhvoor2",(30));
		sety("scrollhvoor2",(windowHeight-128-15+1));
		//
	}
	// scrollers:
	for (var i = 0; i < scrollnum; i++) {
		if (getObj("cont"+i)) {
			var horscroller = false;
			var vertscroller = false;
			contHeight = geth('cont'+i);
			mainHeight = geth('main'+i);
			contWidth = getw('cont'+i);
			if (nn) {
				mainWidth = getw('table'+i);
			} else {
				mainWidth = getw('main'+i);
			}		
			if (contHeight < mainHeight) {
				setw(('cont'+i),(contWidth-15));
				vertscroller = true;
			}
			if (vertscroller == true) {
				contWidth = getw('cont'+i);
				if (nn) {
					mainWidth = getw('table'+i);
				} else {
					mainWidth = getw('main'+i);
				}
				showVertScrollBars(i);
			}
			if (contWidth < mainWidth) {
				seth(('cont'+i),(contHeight-15));
				horscroller = true;
			}
			if (horscroller == true) {
				showHorScrollBars(i);
			}
			if (vertscroller == true && horscroller == true) {
				scrollcorner = getObj("scrollcorner"+i);
				sety(('scrollcorner'+i),(gety("scrollh"+i)));
				setx(('scrollcorner'+i),(getx("scrollv"+i)));
				scrollcorner.style.visibility = "visible";
				seth(('scrollv'+i),(geth('scrollv'+i)-15));
				seth(('scrollvbg'+i),(geth('scrollvbg'+i)-15));
				sety(('scrollvdown'+i),(gety('scrollvdown'+i)-15));
				setw(('scrollh'+i),(getw('scrollh'+i)-15));
				setw(('scrollhbg'+i),(getw('scrollhbg'+i)-15));
				setx(('scrollhright'+i),(getx('scrollhright'+i)-15));
			}
		}
		//tijdelijk:
		if (getObj('scrollvvoor2')) {
			scrollvx = getObj('scrollvvoor2');
			scrollvx.style.visibility = "hidden";
		}
	}
	if (getObj("cont0")) {
		if (horscroller == true) {
			if (vertscroller == true) {
				setw("scrollhvoor0",(windowWidth-getw('scrollh0')-149-45));
			} else {
				setw("scrollhvoor0",(windowWidth-getw('scrollh0')-149-30));
			}
			sety("scrollhvoor0",(windowHeight-45));
			setx("scrollhvoor0",149);
		}
		if (vertscroller == true) {
			if (horscroller == true) {
				seth("scrollvvoor0",(windowHeight-geth('scrollv0')-102-45));
			} else {
				seth("scrollvvoor0",(windowHeight-geth('scrollv0')-102-30));
			}
			sety("scrollvvoor0",102);
			setx("scrollvvoor0",(windowWidth-scrollmargin-15));
		}
	}
	if (getObj("cont1")) {
		if (horscroller == true) {
			if (vertscroller == true) {
				setw("scrollhvoor1",(56));//windowWidth-getw('scrollh1')-149-45
			} else {
				setw("scrollhvoor1",(56));//windowWidth-getw('scrollh1')-149-30
			}
			sety("scrollhvoor1",(windowHeight-100-68-15+1));
			setx("scrollhvoor1",149);
		}
		if (vertscroller == true) {
			if (horscroller == true) {
				seth("scrollvvoor1",(41));//windowHeight-geth('scrollv1')-102-45
			} else {
				seth("scrollvvoor1",(41));//windowHeight-geth('scrollv1')-200-30
			}
			sety("scrollvvoor1",60);
			setx("scrollvvoor1",(204+400-15+1));
		}
	}
	if (getObj("cont2")) {
		if (horscroller == true) {
			if (vertscroller == true) {
				setw("scrollhvoor2",(56));//windowWidth-getw('scrollh2')-149-45
			} else {
				setw("scrollhvoor2",(56));//windowWidth-getw('scrollh2')-149-30
			}
			sety("scrollhvoor2",(windowHeight-100-68-15+1));
			setx("scrollhvoor2",149);
		}
		if (vertscroller == true) {
			if (horscroller == true) {
				seth("scrollvvoor2",(41));//windowHeight-geth('scrollv2')-102-45
			} else {
				seth("scrollvvoor2",(41));//windowHeight-geth('scrollv2')-200-30
			}
			sety("scrollvvoor2",60);
			setx("scrollvvoor2",(204+400-15+1));
		}
	}
	setUpScrollers();
	loadedscroll = true;
}


/*function setUp() {
	// postionering lagen:
	var windowWidth = getWindowInnerWidth();
	var windowHeight = getWindowInnerHeight();
	//
	seth("cont0",(windowHeight-154-45));
	setw("cont0",(windowWidth-221-45));
	//
	seth("scrollv0",(windowHeight-115-30));
	setx("scrollv0",(windowWidth-45));
	seth("scrollvbg0",(geth('scrollv0')-30));
	sety("scrollvdown0",(geth('scrollv0')-15));
	//
	setw("scrollh0",(windowWidth-204-30));
	sety("scrollh0",(windowHeight-45));
	setw("scrollhbg0",(getw('scrollh0')-30));
	setx("scrollhright0",(getw('scrollh0')-15));
	setw("scrollhvoor0",(windowWidth-geth('scrollh0')-204-30));
	sety("scrollhvoor0",(windowHeight-45));
	//
	// scrollers:
	for (var i = 0; i < scrollnum; i++) {
		var horscroller = false;
		var vertscroller = false;
		contHeight = geth('cont'+i);
		mainHeight = geth('main'+i);
		contWidth = getw('cont'+i);
		if (nn) {
			mainWidth = getw('table'+i);
		} else {
			mainWidth = getw('main'+i);
		}		
		if (contHeight < mainHeight) {
			setw(('cont'+i),(contWidth-15));
			vertscroller = true;
		}
		if (vertscroller == true) {
			contWidth = getw('cont'+i);
			if (nn) {
				mainWidth = getw('table'+i);
			} else {
				mainWidth = getw('main'+i);
			}
			showVertScrollBars(i);
		}
		if (contWidth < mainWidth) {
			seth(('cont'+i),(contHeight-15));
			horscroller = true;
		}
		if (horscroller == true) {
			showHorScrollBars(i);
		}
		if (vertscroller == true && horscroller == true) {
			scrollcorner = getObj("scrollcorner"+i);
			sety(('scrollcorner'+i),(windowHeight-45));
			setx(('scrollcorner'+i),(windowWidth-45));
			scrollcorner.style.visibility = "visible";
			seth(('scrollv'+i),(geth('scrollv'+i)-15));
			seth(('scrollvbg'+i),(geth('scrollvbg'+i)-15));
			sety(('scrollvdown'+i),(gety('scrollvdown'+i)-15));
			setw(('scrollh'+i),(getw('scrollh'+i)-15));
			setw(('scrollhbg'+i),(getw('scrollhbg'+i)-15));
			setx(('scrollhright'+i),(getx('scrollhright'+i)-15));
		}
		if (horscroller == true) {
			if (vertscroller == true) {
				setw("scrollhvoor0",(windowWidth-getw('scrollh0')-149-45));
			} else {
				setw("scrollhvoor0",(windowWidth-getw('scrollh0')-149-30));
			}
			sety("scrollhvoor0",(windowHeight-45));
			setx("scrollhvoor0",149);
		}
		if (vertscroller == true) {
			if (horscroller == true) {
				seth("scrollvvoor0",(windowHeight-geth('scrollv0')-102-45));
			} else {
				seth("scrollvvoor0",(windowHeight-geth('scrollv0')-102-30));
			}
			sety("scrollvvoor0",102);
			setx("scrollvvoor0",(windowWidth-45));
		}
	}
	setUpScrollers();
	loadedscroll = true;
}*/

// functie om te bepalen of een bepaalde vertikale scrollbar getoond moet worden:
function showVertScrollBars(numv) {
	scrollvnames = new Array();
	scrollvnames[1] = "scrollv";
	scrollvnames[2] = "scrollvup";
	scrollvnames[3] = "scrollvdown";
	scrollvnames[4] = "scrollvbar";
	scrollvnames[5] = "scrollvbg";
	scrollvnames[6] = "scrollvvoor";//alleen voor Sturris!
	for (var j = 1; j <= 6; j++) {
		scrollv = getObj(scrollvnames[j] +numv);
		scrollv.style.visibility = "visible";
	}
}

// functie om te bepalen of een bepaalde horizontale scrollbar getoond moet worden:
function showHorScrollBars(numh) {
	scrollhnames = new Array();
	scrollhnames[1] = "scrollh";
	scrollhnames[2] = "scrollhright";
	scrollhnames[3] = "scrollhleft";
	scrollhnames[4] = "scrollhbar";
	scrollhnames[5] = "scrollhbg";
	scrollhnames[6] = "scrollhvoor";//alleen voor Sturris!
	for (var j = 1; j <= 6; j++) {
		scrollh = getObj(scrollhnames[j] +numh);
		scrollh.style.visibility = "visible";
	}
}

// functie om te bepalen of een bepaalde vertikale scrollbar getoond moet worden:
function hideVertScrollBars(numv) {
	scrollvnames = new Array();
	scrollvnames[1] = "scrollv";
	scrollvnames[2] = "scrollvup";
	scrollvnames[3] = "scrollvdown";
	scrollvnames[4] = "scrollvbar";
	scrollvnames[5] = "scrollvbg";
	scrollvnames[6] = "scrollvvoor";//alleen voor Sturris!
	for (var j = 1; j <= 6; j++) {
		scrollv = getObj(scrollvnames[j] +numv);
		scrollv.style.visibility = "hidden";
	}
}

// functie om te bepalen of een bepaalde horizontale scrollbar getoond moet worden:
function hideHorScrollBars(numh) {
	scrollhnames = new Array();
	scrollhnames[1] = "scrollh";
	scrollhnames[2] = "scrollhright";
	scrollhnames[3] = "scrollhleft";
	scrollhnames[4] = "scrollhbar";
	scrollhnames[5] = "scrollhbg";
	scrollhnames[6] = "scrollhvoor";//alleen voor Sturris!
	for (var j = 1; j <= 6; j++) {
		scrollh = getObj(scrollhnames[j] +numh);
		scrollh.style.visibility = "hidden";
	}
}

function hideScroller(num) {
	hideVertScrollBars(num);
	hideHorScrollBars(num);
}

// functie voor popup (privacy, copyright en disclaimer:
function popUp(url) {
	var popupwin = window.open(url,"","left=10,top=10,width=424,height=280");
}

// functie voor playing video content:
function videoWin(url) {
	var popupwin = window.open(url,"","left=10,top=10,width=424,height=380");
}

// functie voor iFrame met vrij input voor src (=volledig pad of relatief pad):
function writeNewIFrame(src,name) {
	windowWidth = getWindowInnerWidth();
	windowHeight = getWindowInnerHeight();
	var residuWidth = windowWidth-182-30;
	var residuHeight = windowHeight-91-48-15-20;
	content = '<iframe height="'+residuHeight+'" width="'+residuWidth+'" frameborder="no" allowtransparency=true name="'+name +'" src="'+src+'"></iframe>';
	document.write(content);
}


// functie om menuitem rollovers te verwerken:
function imgToggle(oImg) {
	var strImg = oImg.src;
	if (strImg.indexOf("01") != -1 || strImg.indexOf("02") != -1) {
		var strOver = "01";// image to be used with mouse over
		var strOff = "02";// normal image
	} else if (strImg.indexOf("03") != -1 || strImg.indexOf("04") != -1) {
		var strOver = "03";// image to be used with mouse over
		var strOff = "04";// normal image
	}
	if (strImg.indexOf(strOver) != -1) {
		oImg.src = strImg.replace(strOver,strOff);
	} else {
		oImg.src = strImg.replace(strOff,strOver);
	}
}

// functie om mp3 bestanden te spelen:
function playMp3(file) {
	var url = "http://www.sturris.nl/audio/"+file;
	location.href = url;
}

//functie om ander url te laden:
function loadUrl(url) {
	location.href = url;
}
