<!--
var xmlHttp = new Array();
var blockSlideShow = 0, blockSlideHide = 0, firstSlide = 1;
var blockSlide = new Array();

var main_id = 0, menu_id = 0, sub_id = 0, subsub_id = 0
var menu_id_click = 0, direction = 0, first = 1, safarisucks = 0;
var myHorizontalSlide;

window.addEvent('domready', function() {
	myHorizontalSlide = new Fx.Slide('frameContentLayer1Scroll', {mode: 'horizontal'});
	myHorizontalSlide.hide(); 
	myHorizontalSlide.addEvent('complete', function() {
		if (direction == 1) {
			menu_id = menu_id_click;
			document.getElementById('dummysubmenu' + menu_id).style.display = 'none';
			document.getElementById('submenu' + menu_id).style.display = 'block';
			myHorizontalSlide.show(); 
			direction = 0;
			if (sub_id == 0) {
				if (document.getElementById('submenu_ids' + menu_id)) {
					var a = document.getElementById('submenu_ids' + menu_id).value;
					var ids = a.split(',');
					sub_id = ids[0];
				}
			}
			clickSub(sub_id);
		} else if (direction == -1) {
			document.getElementById('dummysubmenu' + menu_id).style.display = 'none';
			document.getElementById('dummysubmenu' + menu_id_click).style.display = 'block';
			direction = 1;
			myHorizontalSlide.toggle();
		}
	});
});

function GetXmlHttpObject() {
	var HttpObj = null;
	try	{
		HttpObj = new XMLHttpRequest();
	} catch (e)	{
		try {
			HttpObj = new ActiveXObject('Msxml2.XMLHTTP');
		}
		catch (e) {
			HttpObj = new ActiveXObject('Microsoft.XMLHTTP');
		}
	}
	return HttpObj;
}

function checkPage(x_main, x_menu, x_sub, x_page) {
	main_id = x_main;
	menu_id = x_menu;
	sub_id = x_sub;
	page_id = x_page;
	if (menu_id > 0) {
		first = 1;
		if (document.getElementById('submenu' + menu_id)) navigateMenu(0, menu_id);
	}
	if (page_id > 0 && page_id != 54 && page_id != 63) {
		putContent(page_id);
	} else {
		putContact(page_id);	
	} 
}

function putContact(page_id) {
	if (page_id == 54 || page_id == 63) {
		xmlHttp[1] = GetXmlHttpObject();
		var url = 'includes/ajax.asp?script=contact' + page_id + '&sid=' + Math.random();
		xmlHttp[1].open('GET', url, true);
		xmlHttp[1].onreadystatechange = function() {
			if (xmlHttp[1].readyState == 4) {
				var result = xmlHttp[1].responseText;
				document.getElementById('contactContent').innerHTML = result;
			}
		}
		xmlHttp[1].send(null);
	}
}

function navigateMenu(direction, id) {
	if (first == 0 && sub_id > 0) {
		if (document.getElementById('menu' + sub_id)) document.getElementById('menu' + sub_id).className = '';
		sub_id = 0;
	}
	menu_id_click = id;
	if (menu_id_click == 0) {
		var a = document.getElementById('menu_ids').value;
		var ids = a.split(',');
		var last = ids.length - 1;
		if (menu_id == 0) {
			if (direction == -1) {
				menu_id_click = ids[last];
			} else {
				menu_id_click = ids[0];
			}
		} else {
			for (var x = 0; x <= last; x++) {
				if (menu_id == ids[x]) {
					var current_index = x;
					break;
				}
			}
			current_index += direction;
			if (current_index > last) current_index = 0;
			if (current_index < 0) current_index = last;
			menu_id_click = ids[current_index]; 
		}
	}
	if (menu_id > 0) document.getElementById('menu' + menu_id).className = '';
	document.getElementById('menu' + menu_id_click).className = 'active';
	toggleMenu();
}

function toggleMenu() {
	if (menu_id != 0 && first == 0) {
		direction = -1;
		if (document.getElementById('submenu' + menu_id)) {
			document.getElementById('submenu' + menu_id).style.display = 'none';
			document.getElementById('dummysubmenu' + menu_id).style.display = 'block';
		}
	} else {
		direction = 1;
		if (document.getElementById('submenu' + menu_id_click)) {
			if (first == 0) {
				document.getElementById('submenu' + menu_id_click).style.display = 'block';
				document.getElementById('dummysubmenu' + menu_id_click).style.display = 'none';
			} else {
				document.getElementById('dummysubmenu' + menu_id_click).style.display = 'block';
			}
		}
	}
	first = 0;
	if (document.getElementById('submenu' + menu_id_click)) {
		var strAgent = navigator.userAgent.toLowerCase();
		if (strAgent.indexOf('safari') != -1) {
			if (myHorizontalSlide) {
				myHorizontalSlide.toggle();
			} else {
				menu_id = menu_id_click;
				safarisucks = 1;
				putContent(menu_id);
			}
		}	else {
			myHorizontalSlide.toggle();	
		}
	} else {
		menu_id = menu_id_click;
		if (menu_id != 54 && menu_id != 63) {
			putContent(menu_id);
		} else {
			putContact(menu_id);
		}
	}
}

function clickSub(id) {
	firstSlide = 1;
	if (sub_id > 0) document.getElementById('menu' + sub_id).className = '';
	sub_id = id;
	document.getElementById('menu' + sub_id).className = 'active';
	putContent(sub_id);
}

function navigateMain(direction, id) {
	var a = document.getElementById('main_ids').value;
	var ids = a.split(',');
	if (id > 0) {
		main_id = id;
	} else {
		var last = ids.length - 1;
		if (main_id == 0) {
			if (direction == -1) {
				main_id = ids[last];
			} else {
				main_id = ids[0];
			}
		} else {
			for (var x = 0; x <= last; x++) {
				if (main_id == ids[x]) {
					var current_index = x;
					break;
				}
			}
			current_index += direction;
			if (current_index > last) current_index = 0;
			if (current_index < 0) current_index = last;
			main_id = ids[current_index]; 
		}
	}
	for (var x = 0; x < ids.length; x++) {
		if (parseInt(main_id) == parseInt(ids[x])) {
			document.getElementById('main' + ids[x]).className = 'active';
		}	else {
			document.getElementById('main' + ids[x]).className = '';
		}
	}
	document.location.href = '?page_id=' + (0 - main_id);
}



function putContent(id) {
	if (document.getElementById('imgWork')) document.getElementById('imgWork').style.display = 'none';
	xmlHttp[1] = GetXmlHttpObject();
	var url = 'includes/ajax.asp?script=putnumbers&page_id=' + id + '&sid=' + Math.random();
	xmlHttp[1].open('GET', url, true);
	xmlHttp[1].onreadystatechange = function() {
		if (xmlHttp[1].readyState == 4) {
			var result = xmlHttp[1].responseText;
			if (parseInt(result) == 0) {
				if (document.getElementById('frameProductInfo')) document.getElementById('frameProductInfo').innerHTML = '';
				document.getElementById('frameImageInfo-white').style.display = 'none';
				document.getElementById('frameImageInfo-grey').style.display = 'none';
				document.getElementById('blockContent1').innerHTML = '';
			} else {
				var a = result.split('##||##');
				var b = a[0];
				var c = parseInt(a[1]);
				var d = parseInt(a[2]);
				var block_id = parseInt(a[3]);
				if (document.getElementById('frameProductInfo')) document.getElementById('frameProductInfo').innerHTML = b;
				if (d == 1) {
					if (document.getElementById('frameContent-grey')) document.getElementById('frameContent-grey').style.display = 'none';
					if (document.getElementById('frameContent-pink')) document.getElementById('frameContent-pink').style.display = 'block';
					if (document.getElementById('navImageGrey')) document.getElementById('navImageGrey').style.display = 'none';
					if (document.getElementById('navImagePink')) document.getElementById('navImagePink').style.display = 'block';
					document.getElementById('body').className = 'pink';
					if (document.getElementById('blokje')) document.getElementById('blokje').src = 'images/blok2.gif';
				} else {
					if (document.getElementById('frameContent-pink')) document.getElementById('frameContent-pink').style.display = 'none';
					if (document.getElementById('frameContent-grey')) document.getElementById('frameContent-grey').style.display = 'block';
					if (document.getElementById('navImagePink')) document.getElementById('navImagePink').style.display = 'none';
					if (document.getElementById('navImageGrey')) document.getElementById('navImageGrey').style.display = 'block';
					document.getElementById('body').className = 'grey';
					if (document.getElementById('blokje')) document.getElementById('blokje').src = 'images/blok1.gif';
				}
				if (c == 1) {
					if (document.getElementById('frameImageInfo-grey')) document.getElementById('frameImageInfo-grey').style.display = 'none';
					if (document.getElementById('frameImageInfo-white')) document.getElementById('frameImageInfo-white').style.display = 'block';
				} else {
					if (document.getElementById('frameImageInfo-white')) document.getElementById('frameImageInfo-white').style.display = 'none';
					if (document.getElementById('frameImageInfo-grey')) document.getElementById('frameImageInfo-grey').style.display = 'block';
				}
				if (block_id > 0) showBlock(block_id);
			}
		}
	}
	xmlHttp[1].send(null);
}

var block_id = 0;
var doSlide = 1;

function showBlock(id) {
	if (document.getElementById('homeWerk')) document.getElementById('homeWerk').style.display = 'none';
	if (document.getElementById('homeRaakvlak')) {
		document.getElementById('homeRaakvlak').style.display = 'none';
		document.getElementById('frameContentLayer3').style.display = 'block';
	} 
	var a = document.getElementById('block_ids').value;
	var ids = a.split(',');
	if (document.getElementById('frameContact')) {
		if (id == 0) {
			block_id = ids[0];
		} else {
			block_id = id;
		}
		xmlHttp[3] = GetXmlHttpObject();
		var url = 'includes/ajax.asp?script=putblock&block_id=' + block_id + '&sid=' + Math.random();
		xmlHttp[3].open('GET', url, true);
		xmlHttp[3].onreadystatechange = function() {
			if (xmlHttp[3].readyState == 4) {
				var a = xmlHttp[3].responseText.split('##||##');
				var result = a[0];
				var counter = parseInt(a[1]);
				var category = a[5];
				if (category == 'about' || category == 'contact') {
					xmlHttp[4] = GetXmlHttpObject();
					var url = 'includes/ajax.asp?script=putaboutimage&block_id=' + block_id + '&sid=' + Math.random();
					xmlHttp[4].open('GET', url, true);
					xmlHttp[4].onreadystatechange = function() {
						if (xmlHttp[4].readyState == 4) {
							var im = xmlHttp[4].responseText; 
							
							
							
							
							
							document.getElementById('aboutBG').innerHTML = im;
							
							
							
							
							
							
						}
					}
					xmlHttp[4].send(null);
				}
				document.getElementById('frameContact').innerHTML = result;
				for (var x = 1; x <= counter; x++) {
					if (document.getElementById('media' + x)) {
						var a = document.getElementById('media' + x).value;
						var arr = a.split(',');
						var media_id = parseInt(arr[0]);
						if (media_id == 3) {
							var s1 = new SWFObject(arr[1],arr[2],arr[3],arr[4],arr[5]);
							s1.addVariable('quality','high');
							s1.write('blockitem' + x);
						} else if (media_id == 2) {
							var s1 = new SWFObject(arr[1],arr[2],arr[3],arr[4],arr[5]);
							s1.addVariable('file','../files/' + arr[6] + '.flv');
							s1.addVariable('width',arr[3]);
							s1.addVariable('height',arr[4]);
							s1.write('blockitem' + x);
						} else if (media_id == 4) {
							var a = arr[1];
							document.getElementById('blockitem' + x).innerHTML = a;
						}
					}
				}
			}
		}
		xmlHttp[3].send(null);
	} else {
		if (blockSlideShow == 1) {
			blockSlideShow	= 2;
			blockSlideHide = 1;
		} else {
			blockSlideShow = 1;
			blockSlideHide = 2;
		}
		if (!blockSlide[blockSlideShow]) {
			blockSlide[blockSlideShow] = new Fx.Slide('blockScroll' + blockSlideShow, {mode: 'horizontal'});
			blockSlide[blockSlideShow].addEvent('complete', function() {
				if (blockSlide[blockSlideHide]) {
					blockSlide[blockSlideHide].hide();
				}
			});
		}
		if (document.getElementById('block' + block_id)) document.getElementById('block' + block_id).className = '';
		if (id == 0) {
			block_id = ids[0];
		} else {
			block_id = id;
		}
		document.getElementById('block' + block_id).className = 'active';
		if (ids.length > 4) {
			var blockSequence = 0;
			for (var x = 0; x < ids.length; x++) {
				blockSequence += 1;
				if (block_id == ids[x]) break;
			}
			var begin = blockSequence - 3;
			if (begin < 0) begin = 0;
			if ((ids.length - begin) < 4) {
				begin = ids.length - 4
				document.getElementById('blockDot').style.display = 'none';
			} else {
				if (begin + 4 >= ids.length) {
					if (document.getElementById('blockDot')) document.getElementById('blockDot').style.display = 'none';
				} else {
					if (document.getElementById('blockDot')) document.getElementById('blockDot').style.display = 'inline';
				}
			}
			var count = 0;
			for (var x = 0; x < ids.length; x++) {
				if (x < begin) {
					document.getElementById('block' + ids[x]).style.display = 'none';
				} else {
					count += 1;
					if (count <= 4) {
						document.getElementById('block' + ids[x]).style.display = 'inline';
					} else {
						document.getElementById('block' + ids[x]).style.display = 'none';
					}
				}
			}
		}
		if (doSlide == 0) document.getElementById('blockContent' + blockSlideShow).innerHTML = '';
		if (document.getElementById('blockScroll' + blockSlideShow)) document.getElementById('blockScroll' + blockSlideShow).style.zIndex = 2;
		if (document.getElementById('blockScroll' + blockSlideHide)) document.getElementById('blockScroll' + blockSlideHide).style.zIndex = 1;
		xmlHttp[5] = GetXmlHttpObject();
		var url = 'includes/ajax.asp?script=putblock&block_id=' + block_id + '&sid=' + Math.random();
		xmlHttp[5].open('GET', url, true);
		xmlHttp[5].onreadystatechange = function() {
			if (xmlHttp[5].readyState == 4) {
				var a = xmlHttp[5].responseText.split('##||##');
				var result = a[0];
				var counter = parseInt(a[1]);
				var BlockHasMedia = parseInt(a[2]);
				var img_ids = trim(a[3]).split(',');
				var iBlock = a[4];
				var category = a[5];
				if (BlockHasMedia == 0 && firstSlide == 1) {
					doSlide = 1;
				} else {
					doSlide = 0;
					blockSlide[blockSlideShow].show();
				}
				firstSlide = 0;
				document.getElementById('infoBlock').innerHTML = iBlock;
				document.getElementById('blockContent' + blockSlideShow).innerHTML = result;
				var allow;
				if (img_ids.length > 1) {
					var imageLoaded = new Array();
					for (var x = 1; x < img_ids.length; x++) {
						imageLoaded[img_ids[x]] = 0;
						if (document.getElementById('img' + img_ids[x]).addEventListener) {
							document.getElementById('img' + img_ids[x]).addEvent('load', function() {
								var id = this.id.substr(3)
								imageLoaded[id] = 1;
								allow = 1;
								for (var y = 1; y < img_ids.length; y++) {
									if (imageLoaded[img_ids[y]] == 0) allow = 0;
								}
								if (allow == 1) blockSlide[blockSlideShow].slideIn();
							});
						} else {
							blockSlide[blockSlideShow].slideIn();	
						}
					}
				} else {
					if (doSlide == 1) blockSlide[blockSlideShow].slideIn();
				}
				for (var x = 1; x <= counter; x++) {
					if (document.getElementById('media' + x)) {
						var a = document.getElementById('media' + x).value;
						var arr = a.split(',');
						var media_id = parseInt(arr[0]);
						if (media_id == 3) {
							var s1 = new SWFObject(arr[1],arr[2],arr[3],arr[4],arr[5]);
							s1.addVariable('quality','high');
							s1.write('blockitem' + x);
						} else if (media_id == 2) {
							var s1 = new SWFObject(arr[1],arr[2],arr[3],arr[4],arr[5]);
							s1.addVariable('file','../files/' + arr[6] + '.flv');
							s1.addVariable('width',arr[3]);
							s1.addVariable('height',arr[4]);
							s1.write('blockitem' + x);
						} else if (media_id == 4) {
							var a = arr[1];
							document.getElementById('blockitem' + x).innerHTML = a;
						}
					}
				}
			}
		}
		xmlHttp[5].send(null);
	}
}

function navigateBlock(direction) {
	var a = document.getElementById('block_ids').value;
	var ids = a.split(',');
	for (var x = 0; x < ids.length; x++) {
		if (document.getElementById('block' + ids[x]).className == 'active') {
			var current_index = x;
			break;
		}
	}
	current_index += direction;
	if (current_index < 0) current_index = ids.length - 1;
	if (current_index >= ids.length) current_index = 0;
	showBlock(ids[current_index]);
}

function keyStroke(e, validate) {
	var key = window.event ? e.keyCode : e.which;
	if (key == 8 || key == 0) return true;
	if (key == 124 ) return false;
	if (validate == 1 && key == 32) return false;
	if (validate == 3 || validate == 2) {
		if (key < 48 || key > 57) {
			if (key != 44 && key != 45) {
				return false;
			} else {
				if (validate == 2 && key == 44) {
					return false;
				}
			}
		}
	}
}

function checkForm(block_id) {
	var a = document.getElementById('checkfields' + block_id).value;
	var melding = '';
	var formitem = a.split('#**#');
	for (var x = 0; x < formitem.length; x++) {
		var formproperties = formitem[x].split('#|#');
		var form_id = formproperties[0];
		var fieldname = formproperties[1];
		var validate = parseInt(formproperties[2]);
		var compulsary = parseInt(formproperties[3]);
		var unique = parseInt(formproperties[4]);
		if (validate != 2) {
			if (document.getElementById(form_id)) {
				var a = doTrim(document.getElementById(form_id));
				document.getElementById(form_id).value = a;
			}
		}
		if (validate == 2) {
			var found = false;
			for (var i = 0; i < document.getElementsByName(form_id).length; i++) {
				if (document.getElementsByName(form_id)[i].checked) found = true;
			}
			if (found == false) {
				melding = 'Een veld is nog niet geselecteerd: ' + fieldname;
				alert(melding);
				return false;
			}
		}
		if (compulsary == 1) {
			if (document.getElementById(form_id).value == '') {
				if (document.getElementById(form_id).style.visibility != 'hidden') {
					melding = 'Een verplicht veld is niet ingevuld: ' + fieldname;
					alert(melding);
					document.getElementById(form_id).focus();
					return false;
				}
			}
		}
		if (validate == 1) {
			if (emailCheck(form_id, compulsary) == false) {
				melding = 'Het ingevoerde e-mail adres is onjuist.';
				alert(melding);
				document.getElementById(form_id).focus();
				return false;
			}
		}
		if (unique == 1) {
			var result = parseInt(document.getElementById(form_id + '_unique').value);
			if (result == 0) {
				melding = 'Dit veld moet uniek zijn: ' + fieldname;
				alert(melding);
				document.getElementById(form_id).focus();
				return false;
			}
		}
	}
	return;
}

function checkUnique(dbtable, dbfield, id, formfield) {
	xmlHttp[1] = GetXmlHttpObject();
	var url = 'includes/ajax.asp?script=checkunique&dbtable=' + dbtable + '&dbfield=' + dbfield + '&dbvalue=' + escape(document.getElementById(formfield).value) + '&id=' + id + '&sid=' + Math.random();
	xmlHttp[1].open('GET', url, true);
	xmlHttp[1].onreadystatechange = function() {
		if (xmlHttp[1].readyState == 4) {
			
			
				
				
				alert(xmlHttp[1].responseText);
				
				
				
				
			
			result = xmlHttp[1].responseText;
			document.getElementById(formfield + '_unique').value = result;
		}
	}
	xmlHttp[1].send(null);
}

function emailCheck(formfield, compulsary) {
	var emailStr=document.getElementById(formfield).value
	if (compulsary == 0 && emailStr == '') return true;
	var checkTLD=1;
	var knownDomsPat=/^(com|net|org|edu|int|mil|gov|arpa|biz|aero|name|coop|info|pro|museum)$/;
	var emailPat=/^(.+)@(.+)$/;
	var specialChars="\\(\\)><@,;:\\\\\\\"\\.\\[\\]";
	var validChars="\[^\\s" + specialChars + "\]";
	var quotedUser="(\"[^\"]*\")";
	var ipDomainPat=/^\[(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})\]$/;
	var atom=validChars + '+';
	var word="(" + atom + "|" + quotedUser + ")";
	var userPat=new RegExp("^" + word + "(\\." + word + ")*$");
	var domainPat=new RegExp("^" + atom + "(\\." + atom +")*$");
	var matchArray=emailStr.match(emailPat);
	if (matchArray==null) return false;
	var user=matchArray[1];
	var domain=matchArray[2];
	for (i = 0; i < user.length; i++) {
		if (user.charCodeAt(i) > 127) return false;
	}
	for (i=0; i<domain.length; i++) {
		if (domain.charCodeAt(i) > 127) return false;
	}
	if (user.match(userPat)==null) return false;
	var IPArray=domain.match(ipDomainPat);
	if (IPArray!=null) {
		for (var i = 1;i <= 4; i++) {
			if (IPArray[i] > 255) return false;
		}
		return true;
	}
	var atomPat=new RegExp("^" + atom + "$");
	var domArr=domain.split(".");
	var len=domArr.length;
	for (i = 0; i < len; i++) {
		if (domArr[i].search(atomPat) == -1) return false;
	}
	if (checkTLD && domArr[domArr.length-1].length!=2 && domArr[domArr.length-1].search(knownDomsPat)==-1) return false;
	if (len < 2) return false;
	return true;
}

function tagReaction(reaction_id) {
	xmlHttp[1] = GetXmlHttpObject();
	var url = 'includes/ajax.asp?script=tagreaction&reaction_id=' + reaction_id + '&tagged=1&rid=' + Math.random();
	xmlHttp[1].open('GET', url, true);
	xmlHttp[1].onreadystatechange = function() {
		if (xmlHttp[1].readyState == 4) {
			document.getElementById('ok' + reaction_id).innerHTML = '<img src="images/bell_error.png" title="Deze reactie is aangemeld als niet okee." width="16" height="16" alt="Deze reactie is aangemeld als niet okee." />'
			var response = 'Deze reactie is gemarkeerd als niet okee.\nHet bericht zal worden beoordeeld door een moderator.';
			alert(response);
		}
	}
	xmlHttp[1].send(null);
}

function doTrim(obj) {
	var a = trim(obj.value);
	obj.value = a;
	return a;
}

function trim(strValue) {
	if (strValue.length < 1) return '';
	strValue = rTrim(strValue);
	strValue = lTrim(strValue);
	return strValue;
}

function rTrim(strValue) {
	var w_space = String.fromCharCode(32);
	var v_length = strValue.length;
	var strTemp = '';
	if (v_length < 0) return '';
	var iTemp = v_length - 1;
	while(iTemp > -1) {
		if (strValue.charAt(iTemp) != w_space) {
			strTemp = strValue.substring(0, iTemp + 1);
			break;
		}
		iTemp = iTemp - 1;
	}
	return strTemp;
}

function lTrim(strValue) {
	var w_space = String.fromCharCode(32);
	if (v_length < 1) return '';
	var v_length = strValue.length;
	var strTemp = '';
	var iTemp = 0;
	while (iTemp < v_length) {
		if (strValue.charAt(iTemp) != w_space) {
			strTemp = strValue.substring(iTemp, v_length);
			break;
		}
		iTemp = iTemp + 1;
	}
	return strTemp;
}

//-->