
	// browser sniffer
	var ie = navigator.appName.toLowerCase().indexOf('microsoft') != -1 ? 1 : 0;
	var mac =  navigator.userAgent.toLowerCase().indexOf('mac') != -1 ? 1 : 0;
	var win =  navigator.userAgent.toLowerCase().indexOf('windows') != -1 ? 1 : 0;
	var safari =  navigator.userAgent.toLowerCase().indexOf('safari') != -1 ? 1 : 0;
	var mozilla = navigator.appName.toLowerCase().indexOf('netscape') != -1 && !safari ? 1 : 0;
	var winIE = ie && win ? 1 : 0;
	var macIE = ie && mac ? 1 : 0;




	// ULTIMATE flash sniffer (mdi)
	function getFlashVersion(){
		//return 0;	//test
		if (winIE){
			for(var i=10; i>0; i--){
				try{
					var flash = new ActiveXObject("ShockwaveFlash.ShockwaveFlash." + i);
					return i;
				}
				catch(e){}
			}
		}
		else {
			if(navigator.plugins.length){
				for (var i=0; i < navigator.plugins.length; i++) {
					var pluginIdent = navigator.plugins[i].description.split(" ");
					if(pluginIdent[0] == "Shockwave" && pluginIdent[1] == "Flash"){
						var versionArray = pluginIdent[2].split(".");
						return versionArray[0];
					}
				}
			}
		}
		return 0;
	}



	// handige wrapper functie
	var getE = function(el){return document.getElementById(el);}

	// image preloader
	prelImgs = new Array();
	var preloadImage = function(_src){
		var l = prelImgs.length;
		prelImgs[l] = new Image();
		prelImgs[l].src =_src;
	}

	//slideshow
	function SlideShow(el_id,speed,imgPath){
		this.index = SlideShow.instances.length;
		this.el_id = el_id;
		this.speed = speed;
		this.imgPath = imgPath;
		this.counter = 0;
		this.autoplay = true;
		this.numImages = 0;
		this.images = new Array();
		this.timer = false;
		for (var i = 3; i < arguments.length; i++){
			var img = arguments[i];
			preloadImage(imgPath + img);
			this.images[this.numImages] = img;
			this.numImages++;
		}

		this.getNumImages = function(){
			return this.numImages;
		}

		this.next = function(){
			this.counter++;
			if (this.counter > this.numImages - 1){
				this.counter = 0;
			}
			this.setPic();
			this.timeNext();
		}

		this.previous = function(){
			this.counter--;
			if (this.counter < 0){
				this.counter = this.numImages - 1;
			}
			this.setPic();
			this.timeNext();
		}

		this.setPic = function(){
			var d = String(this.imgPath + this.images[this.counter]);
			getE(this.el_id).src = d;
		}

		this.timeNext = function(){
			clearTimeout(this.timer);
			if (!this.autoplay){
				return false;
			}
			this.timer = setTimeout('SlideShow.instances[' + this.index + '].next();', this.speed);
		}

		this.play = function(){
			this.autoplay = true;
			this.timeNext();
		}

		this.pause = function(){
			this.autoplay = false;
			this.timeNext();
		}

		this.playPause = function(){
				var p = this.autoplay ? this.pause() : this.play();
				return this.autoplay;
		}

		SlideShow.instances[this.index] = this;
	}
	SlideShow.instances = [];


	//losse functies alleen voor deze implementatie

	function playPause(o){
		if (projVisuals.playPause()){
			o.src = '_images/slider_pause.gif';
			o.title = 'pause slideshow';
		}
		else{
			o.src = '_images/slider_play.gif';
			o.title = 'speel slideshow';
		}
	}


/*************************
flash header, mdi 1.2
*************************/


//height of calibrated header
var calHeight = 40;


hGTempObjects = Array();

function SwfHeader(_tagName,_size,_color,_hCorr,_vCorr){
	this.tagName = _tagName;
	this.size = _size ? _size : '';
	this.color = _color ? '0x' + _color : '';
	this.hCorr = _hCorr ? _hCorr + 'px' : '0px';
	this.vCorr = _vCorr ? _vCorr + 'px' : '0px';
}

function hGStart(){
	if (getFlashVersion () < 5){return;}
	if (macIE){return;}
	var w = '';
	w += '<style type="text/css">';
	for (var i in swfHeader){
		var h = swfHeader[i];
		w += h.tagName + '{visibility:hidden;}';
	}
	w += '</style>';
	document.write(w);
	window.onload = hGGo;
}

function hGGo(){
	var cHS = getE('checkHeaderSize');
	var fontScale = cHS ? cHS.offsetHeight / calHeight : 1;
	for (var i in swfHeader){
		var o = swfHeader[i];
		var eTN = document.getElementsByTagName(o.tagName);
		for (var j = 0;j < eTN.length; j++){
			var el = eTN[j];
			el.style.visibility = 'visible';
			var width = el.offsetWidth;
			var height = el.offsetHeight;
			var text = macIE ? URLEncode(el.innerText) : URLEncode(el.innerHTML);
			var id = 'hG_'+ o.tagName + '_' +j;
			hGTempObjects[id] = o;
			var swfURL = hGPath + '?hId=' + id + '&hText=' + text + '&hSize=' + parseInt(o.size * fontScale,10)  + '&hWidth=' + width + '&hColor=' + o.color + '&winIE=' + winIE ;
			if (safari || macIE){
				var w =  '<embed class="headerObject" src="' + swfURL +'" id="' + id + '" quality="high" scale="noscale" salign="lt" wmode="transparent" width="100%" height="' + height +'" name="headergenerator" allowScriptAccess="sameDomain" type="application/x-shockwave-flash" />';
			}
			else {
				var w =  '<object class="headerObject" data="' + swfURL +'" id="' + id + '" type="application/x-shockwave-flash"  width="100%" height="' + height +'" ><param name="movie" value="'+swfURL+'" /><param name="scale" value="noscale" /><param name="wmode" value="transparent" /><param name="quality" value="best" /><param name="salign" value="lt" /></object>';
			}
			el.innerHTML = '<span class="oldHeader">' + el.innerHTML + '</span>' + w;
			el.style.marginLeft = '-1000px';
		}
	}
	if (winIE) {
		hGShowAll();
	}
}

// win ie try and catch routine
function hGShowAll(){
	for (var i in hGTempObjects){
		hGTry(i);
	}
}
var numTrys = 0;
function hGTry(i){
	var h = getE(i);
	if (h){
		try {
			hGShow(i,h.GetVariable('headerHeight'));
		} catch (e) {
			numTrys++;
			if (numTrys < 400){
				setTimeout('hGTry(\''+i+'\')',200);
				//status = i + '--' + numTrys;
			}
		}
	}
}


function hGShow(_id,_height){
	var o = hGTempObjects[_id];
	var el = getE(_id);
	el.style.height = _height +'px';
	el.style.marginLeft = o.hCorr;
	el.style.marginTop = o.vCorr;
	el.parentNode.style.marginLeft = '0px';
  //spookyHeightHack();
  setTimeout('spookyHeightHack()',500);
}

// ie hack voor stukken content die soms verdwijnen (zucht)
function spookyHeightHack(){
	if (winIE){
		var desc = getE('description');
		if (desc){
			desc.style.height = '1%';
		}
	}
}

/*************************
einde flash header
*************************/



/*uitschrijven flash menu*/
function flashMenu(swfSuffix){
	if (getFlashVersion() < 6){
		return '';
	}
	getE('noFlashMenu').style.display = 'none';
	// mdj
	var swfUrl='_swf/container.swf' + swfSuffix + '&swf=_swf/fabnav02%2Eswf';
	var w =
	'<object data="'+swfUrl+'" type="application/x-shockwave-flash" width="188" height="500" id="fabnav" style="position:absolute;">' +
	'<param name="allowScriptAccess" value="sameDomain" />'+
	'<param name="movie" value="'+swfUrl+'" />'+
	'<param name="quality" value="best" />'+
	'<param name="bgcolor" value="#ffffff" />'+
	'</object>';
	return (w);
}


/*encrypted contact*/
function contactMe(prefix,suffix){
	var m =  Array(109,97,105,108,116,111,58);
	var a =  Array(64);
	var s = '';
	for (var i = 0; i < m.length; i++){
		s += String.fromCharCode(m[i]);
	}
	window.location.replace(s + prefix + String.fromCharCode(64) + suffix);
	return false;
}

/*fabSPAM*/
function spam(spamName){
	var w = window.open('fabspam/' + spamName + '.html','fabspam','scrollbars=yes,width=760,height=540');
}

/*real urlencoding*/
function URLEncode(inp){
	// The Javascript escape and unescape functions do not correspond
	// with what browsers actually do...
	var SAFECHARS = "0123456789" +					// Numeric
					"ABCDEFGHIJKLMNOPQRSTUVWXYZ" +	// Alphabetic
					"abcdefghijklmnopqrstuvwxyz" +
					//"éëèêáäãâöõóôüúùûïíìîÉËÈÊÁÄÃÂÖÕÓÔÜÚÙÛÏÍÌÎ" +
					"-_.!~*'()";					// RFC2396 Mark characters
	var HEX = "0123456789ABCDEF";
	var SAFECHARCODES = "|233|235|232|234|225|228|227|226|246|245|243|244|252|250|249|251|239|237|236|238|201|203|200|202|193|196|195|194|214|213|211|212|220|218|217|219|207|205|204|206"

	var plaintext = inp;
	var encoded = "";
	for (var i = 0; i < plaintext.length; i++ ) {
		var ch = plaintext.charAt(i);
	    if (ch == " ") {
		    encoded += "+";				// x-www-urlencoded, rather than %20
		}//
		else if (SAFECHARS.indexOf(ch) != -1) {
		    encoded += ch;
		}
		else {
		    var charCode = ch.charCodeAt(0);
			if (SAFECHARCODES.indexOf('|'+charCode+'|') != -1){
				encoded += ch;

				//alert(charCode);
			}
			else if (charCode > 255) {
				encoded += "+";
			}
			else {
				encoded += "%";
				encoded += HEX.charAt((charCode >> 4) & 0xF);
				encoded += HEX.charAt(charCode & 0xF);
			}
		}
	}
	return encoded;
}
