/*
- Notities
	- SWFObject
		<div id="intro_flash">
			Download FLASH om het element te zien wat op deze plaats staat.<br />
			<a href="http://www.adobe.com/go/getflashplayer"><img src="http://www.adobe.com/images/shared/download_buttons/get_flash_player.gif" alt="Get Adobe Flash player" /></a>
		</div>
		<script type="text/javascript">
			swfobject.embedSWF("/player.swf", "intro_flash", "444", "350", "10.0.0", "/include/js/expressInstall.swf", false, {allowfullscreen:"true",allowscriptaccess:"always",wmode:"opaque",menu:"false",stretching:"none",flashvars:"var1=value1&var2=value2&var3=value3"});
		</script>
*/

//incl. .js
var jsPath = "/include/js/";
document.write('<scr'+'ipt type="text/javascript" src="' + jsPath + 'swfobject.js"><\/scr'+'ipt>');
document.write('<scr'+'ipt type="text/javascript" src="' + jsPath + 'jqueryslidemenu.js"><\/scr'+'ipt>');


$(function(){

});


// afvangen framing
if (top!=self) top.location.href = self.location.href;


// browser sniffer
var Browser = function(){
  this.uA = navigator.userAgent.toLowerCase();
  this.aN = navigator.appName.toLowerCase();
  this.iE = this.aN.indexOf('microsoft') != -1 ? 1 : 0;
  this.mac =  this.uA.indexOf('mac') != -1 ? 1 : 0;
  this.win = this.uA.indexOf('windows') != -1 ? 1 : 0;
  this.safari =  this.uA.indexOf('webkit') != -1 ? 1 : 0;
  this.opera =  this.uA.indexOf('opera') != -1 ? 1 : 0;   
  this.operaMini =  this.uA.indexOf('mini') != -1 ? 1 : 0;  
  this.mozilla = this.aN.indexOf('netscape') != -1 && !this.safari ? 1 : 0;
  this.winMozilla = this.mozilla && this.win ? 1 : 0;
  this.winIE = this.iE && this.win && !this.opera ? 1 : 0;
  this.winIE6Down = this.winIE && /msie|MSIE 6/.test(navigator.userAgent) == 1 ? 1 : 0;
  this.macIE = this.iE && this.mac ? 1 : 0;
};
var browser = new Browser();


// determine the screen width and height
// default values
var lngScreenWidth = 1024;
var lngScreenHeight = 768;
var lngAvailWidth = lngScreenWidth;
var lngAvailHeight = (lngScreenHeight - 30);
if (parseInt(navigator.appVersion)>3){
	lngScreenWidth = screen.width;
	lngScreenHeight = screen.height;
	lngAvailWidth = screen.availWidth;
	lngAvailHeight = screen.availHeight;
}else if (navigator.appName == "Netscape" && parseInt(navigator.appVersion)==3 && navigator.javaEnabled()){
	var jToolkit = java.awt.Toolkit.getDefaultToolkit();
	var jScreenSize = jToolkit.getScreenSize();
	lngScreenWidth = jScreenSize.width;
	lngScreenHeight = jScreenSize.height;
}
// end determine the screen width and height

var TodayDT = new Date();
function CheckDate(field){
	var checkstr = "0123456789";
	var DateField = field;
	var Datevalue = "";
	var DateTemp = "";
	var seperator = "-";
	var day;
	var month;
	var year;
	var leap = 0;
	var err = 0;
	var i;
	err = 0;
	DateValue = DateField.value;
	/* Delete all chars except 0..9 */
	for (i = 0; i < DateValue.length; i++){
		if (checkstr.indexOf(DateValue.substr(i,1)) >= 0) {
			DateTemp = DateTemp + DateValue.substr(i,1);
		}
	}
	DateValue = DateTemp;
	/* date entered as 4 digits, add current year */
	if (DateValue.length == 4) DateValue += TodayDT.getUTCFullYear();
	/* Always change date to 8 digits, if year is entered as 2-digit / if year > 30 then 19.. else 20.. */
	if (DateValue.length == 6) {
		if (parseInt(DateValue.substr(4,2)) > 29){
			DateValue = DateValue.substr(0,4) + '19' + DateValue.substr(4,2); 
		}else{
			DateValue = DateValue.substr(0,4) + '20' + DateValue.substr(4,2); 
		}
	}
	if (DateValue.length != 8) err = 19;
	/* year is wrong if year = 0000 */
	year = DateValue.substr(4,4);
	if (year == 0) err = 20;
	/* Validation of month*/
	month = DateValue.substr(2,2);
	if ((month < 1) || (month > 12)) err = 21;
	/* Validation of day*/
	day = DateValue.substr(0,2);
	if (day < 1) err = 22;
	/* Validation leap-year / february / day */
	if ((year % 4 == 0) || (year % 100 == 0) || (year % 400 == 0)) leap = 1;
	if ((month == 2) && (leap == 1) && (day > 29)) err = 23;
	if ((month == 2) && (leap != 1) && (day > 28)) err = 24;
	/* Validation of other months */
	if ((day > 31) && ((month == "01") || (month == "03") || (month == "05") || (month == "07") || (month == "08") || (month == "10") || (month == "12"))) err = 25;
	if ((day > 30) && ((month == "04") || (month == "06") || (month == "09") || (month == "11"))) err = 26;
	/* if 00 ist entered, no error, deleting the entry */
	if ((day == 0) && (month == 0) && (year == 00)) {
		err = 0; day = ""; month = ""; year = ""; seperator = "";
	}
	/* if no error, write the completed date to Input-Field (e.g. 13.12.2001) */
	if (err == 0) {
		DateField.value = day + seperator + month + seperator + year;
	}else{
		alert("Datum is onjuist (err:" + err + ")!");
		//field.value = "";
		field.focus();
		field.select();
	}
}

function checkNumeric(field, varDefaultValue, lngPrecisie){
	var lngPrecisieFactor = Math.pow(10, lngPrecisie);
	if (field.value != ""){
		field.value = field.value.replace(/,/g,'.');
		field.value = parseFloat(field.value);
		if (isNaN(field.value)) {
			if (varDefaultValue == null){
				field.value = "";
			}else{
				field.value = varDefaultValue;
			}
		}
	}else{
		if (varDefaultValue == null){
			field.value = "";
		}else{
			field.value = varDefaultValue;
		}
	}
	if (isNaN(parseFloat(field.value)) == false){
		field.value = Math.round(parseFloat(field.value) * lngPrecisieFactor) / lngPrecisieFactor;
		// field.value = field.value.replace(/\./g,',');
	}
}

function confirmDelete(){
	var agree=confirm("Weet u zeker dat u wilt verwijderen?");
	if (agree){
		return true; 
	}else{
		return false;
	}
}

function UpperMe(field){
	field.value = field.value.toUpperCase();
	// alleen bepaalde chars toestaan
	var strOK = "";
	var strField = field.value;
	for (i = 0; i < strField.length; i++){
	 	if (!('/-0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ'.indexOf(strField.charAt(i)) < 0)){
			strOK = strOK + strField.charAt(i);
		}
	}
	field.value = strOK;
}

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_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_findObj(n, d) { //v4.01
  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 && d.getElementById) x=d.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];}
}

function MM_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}

function MM_jumpMenu(targ,selObj,restore){ //v3.0
  eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
  if (restore) selObj.selectedIndex=0;
}

function MA_setTextOfLayer(objName,newText) { //v4.01
  if ((obj=MM_findObj(objName))!=null) with (obj)
    if (document.layers) {document.write(unescape(newText)); document.close();}
    else innerHTML = unescape(newText);
}

function imageBoxShow(strImage) {		
	var img = document.getElementById('imageSrc');
	if (img != null){
		img.src = strImage;
	}
}
function imageBoxHide() {
	var img  = document.getElementById('imageBox');
	if (img != null) img.style.visibility = 'hidden';
}
function imageBoxResize() {	
	img = document.getElementById('imageSrc');
	box = document.getElementById('imageBox');
	if (img != null) {
		b = document.body;
		w = img.width;
		h = img.height;
		if (img != null && (img.src.indexOf('/images/spacer.gif') < 0)) {
			document.getElementById('imageBox').style.visibility = 'visible';			
			box.style.pixelTop = ((b.clientHeight - box.clientHeight) / 2) + b.scrollTop;
			box.style.pixelLeft = ((b.clientWidth - box.clientWidth) / 2) + b.scrollLeft;						
		}
	}
}

function Copy2Clipboard(strTekst){
	// Copyright (C) krikkit - krikkit@gmx.net
	// --> http://www.krikkit.net/
	//
	// This program is free software; you can redistribute it and/or
	// modify it under the terms of the GNU General Public License
	// as published by the Free Software Foundation; either version 2
	// of the License, or (at your option) any later version.
	if (window.clipboardData){
		// the IE-manier
		window.clipboardData.setData("Text", strTekst);
		// waarschijnlijk niet de beste manier om Moz/NS te detecteren;
		// het is mij echter onbekend vanaf welke versie dit precies werkt:
	}else if (window.netscape){ 
		// dit is belangrijk maar staat nergens duidelijk vermeld:
		// you have to sign the code to enable this, or see notes below 
		netscape.security.PrivilegeManager.enablePrivilege('UniversalXPConnect');
		// maak een interface naar het clipboard
		var clip = Components.classes['@mozilla.org/widget/clipboard;1'].createInstance(Components.interfaces.nsIClipboard);
		if (!clip){
			alert("Tekst naar clipboard wordt niet ondersteund door uw browser (1).");
			return false;
		}
		// maak een transferable
		var trans = Components.classes['@mozilla.org/widget/transferable;1'].createInstance(Components.interfaces.nsITransferable);
		if (!trans){
			alert("Tekst naar clipboard wordt niet ondersteund door uw browser (2).");
			return false;
		}
		// specificeer wat voor soort data we op willen halen; text in dit geval
		trans.addDataFlavor('text/unicode');
		// om de data uit de transferable te halen hebben we 2 nieuwe objecten 
		// nodig om het in op te slaan
		var str = new Object();
		var len = new Object();
		var str = Components.classes["@mozilla.org/supports-string;1"].createInstance(Components.interfaces.nsISupportsString);
		var copytext = strTekst;
		str.data = copytext;
		trans.setTransferData("text/unicode", str, copytext.length*2);
		var clipid = Components.interfaces.nsIClipboard;
		if (!clip){
			alert("Tekst naar clipboard wordt niet ondersteund door uw browser (3).");
			return false;
		}else{
			clip.setData(trans,null,clipid.kGlobalClipboard);
			return true;
		}
	}
	alert("De onderstaande text staat nu in het clipboard:\n\n" + strTekst);
	return false;
}

// reloads the window if Nav4 resized
function MM_reloadPage(init) {
  if (init==true) with (navigator) {if ((appName=="Netscape")&&(parseInt(appVersion)==4)) {
    document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage; }}
  else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload();
}
MM_reloadPage(true);
// end reloads the window if Nav4 resized

function rawurlencode(str){
	// http://kevin.vanzonneveld.net/techblog/article/javascript_equivalent_for_phps_rawurlencode/
	var hash_map = {}, unicodeStr='', hexEscStr='';
	var ret = str.toString();
	var replacer = function(search, replace, str) {
		var tmp_arr = [];
		tmp_arr = str.split(search);
		return tmp_arr.join(replace);
	};
	// The hash_map is identical to the one in urldecode.
	hash_map["'"]   = '%27';
	hash_map['(']   = '%28';
	hash_map[')']   = '%29';
	hash_map['*']   = '%2A';
	hash_map['~']   = '%7E';
	hash_map['!']   = '%21';
	hash_map['\u20AC'] = '%80';
	hash_map['\u0081'] = '%81';
	hash_map['\u201A'] = '%82';
	hash_map['\u0192'] = '%83';
	hash_map['\u201E'] = '%84';
	hash_map['\u2026'] = '%85';
	hash_map['\u2020'] = '%86';
	hash_map['\u2021'] = '%87';
	hash_map['\u02C6'] = '%88';
	hash_map['\u2030'] = '%89';
	hash_map['\u0160'] = '%8A';
	hash_map['\u2039'] = '%8B';
	hash_map['\u0152'] = '%8C';
	hash_map['\u008D'] = '%8D';
	hash_map['\u017D'] = '%8E';
	hash_map['\u008F'] = '%8F';
	hash_map['\u0090'] = '%90';
	hash_map['\u2018'] = '%91';
	hash_map['\u2019'] = '%92';
	hash_map['\u201C'] = '%93';
	hash_map['\u201D'] = '%94';
	hash_map['\u2022'] = '%95';
	hash_map['\u2013'] = '%96';
	hash_map['\u2014'] = '%97';
	hash_map['\u02DC'] = '%98';
	hash_map['\u2122'] = '%99';
	hash_map['\u0161'] = '%9A';
	hash_map['\u203A'] = '%9B';
	hash_map['\u0153'] = '%9C';
	hash_map['\u009D'] = '%9D';
	hash_map['\u017E'] = '%9E';
	hash_map['\u0178'] = '%9F';
	// Begin with encodeURIComponent, which most resembles PHP's encoding functions
	ret = encodeURIComponent(ret);
	for (unicodeStr in hash_map) {
		hexEscStr = hash_map[unicodeStr];
		ret = replacer(unicodeStr, hexEscStr, ret); // Custom replace. No regexing
	}
	// Uppercase for full PHP compatibility
	return ret.replace(/(\%([a-z0-9]{2}))/g, function(full, m1, m2) {
		return "%"+m2.toUpperCase();
	});
}
function rawurldecode( str ) {
	// http://kevin.vanzonneveld.net/techblog/article/javascript_equivalent_for_phps_rawurldecode/
	var hash_map = {}, ret = str.toString(), unicodeStr='', hexEscStr='';
	var replacer = function(search, replace, str) {
		var tmp_arr = [];
		tmp_arr = str.split(search);
		return tmp_arr.join(replace);
	};
	// The hash_map is identical to the one in urlencode.
	hash_map["'"]   = '%27';
	hash_map['(']   = '%28';
	hash_map[')']   = '%29';
	hash_map['*']   = '%2A';
	hash_map['~']   = '%7E';
	hash_map['!']   = '%21';
	for (unicodeStr in hash_map) {
		hexEscStr = hash_map[unicodeStr]; // Switch order when decoding
		ret = replacer(hexEscStr, unicodeStr, ret); // Custom replace. No regexing
	}
	// End with decodeURIComponent, which most resembles PHP's encoding functions
	ret = ret.replace(/%([a-fA-F][0-9a-fA-F])/g, function (all, hex) {return String.fromCharCode('0x'+hex);}); // These Latin-B have the same values in Unicode, so we can convert them like this
	ret = decodeURIComponent(ret);
	return ret;
}

function get_cookies_array() {
	var cookies = { };
	if (document.cookie && document.cookie != '') {
		var split = document.cookie.split(';');
		for (var i = 0; i < split.length; i++) {
			var name_value = split[i].split("=");
			name_value[0] = name_value[0].replace(/^ /, '');
			cookies[decodeURIComponent(name_value[0])] = decodeURIComponent(name_value[1]);
		}
	}
	return cookies;
}
/*
	var cookies = get_cookies_array();
	for(var name in cookies) {
		document.write( name + " : " + cookies[name] + "<br />" );
	}
*/

