	
var popupLinkConfig = new Array;
	 popupLinkConfig["tellafriend"] = new Array("", "scrollbars=yes,status=no, resizable,width=566,height=550");
	 popupLinkConfig["flyerservice"] = new Array("", "scrollbars=yes,status=no, resizable,width=615,height=550");
	 popupLinkConfig["customerservice"] = new Array("", "scrollbars=yes,status=yes,resizable,width=670,height=550");
	 popupLinkConfig["faq"] = new Array("", "scrollbars=yes,status=yes,resizable,width=670,height=550");
	 popupLinkConfig["signup"] = new Array("", "scrollbars=yes,status=yes,resizable,width=700,height=600");
	 popupLinkConfig["login"] = new Array("", "scrollbars=yes,status=yes,resizable,width=700,height=600");
	 popupLinkConfig["help"] = new Array("", "scrollbars=yes,status=yes,resizable,width=670,height=550");
	 popupLinkConfig["tariffnotice"] = new Array("", "scrollbars=no,status=no,resizable,width=350,height=400");
	 popupLinkConfig["comments"] = new Array("", "scrollbars=no,status=no,resizable,width=350,height=400");
	window.onload = initPage;  
	// Make sure that no other javscripts assign a fuction to window.onload
	// There can be only one window.onload at a time
	
	function initPage() {
	  initPopupLinks();
	  // place here any other code you wish to run when the page loads.
	}
	
	function bannerPop(bannerFile) {
		window.open("pop.php?banner="+bannerFile, "popup", "toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=0,resizable=0,width=100,height=100,left=-150,top=-150");
	}
	
	function initPopupLinks() {
		if (!document.getElementsByTagName) {
			return true;
		}
		var pageLinks = document.getElementsByTagName("a");
		for (var i = 0; i < pageLinks.length; i++) {
			if (  ((pageLinks[i].className != null) && (pageLinks[i].className != "") ) 
			   ||	((pageLinks[i].parentNode.className != null) && (pageLinks[i].parentNode.className != "")))
			{
				var linkClass = " " + pageLinks[i].className + " ";
				if ((linkClass == "  ") && (pageLinks[i].parentNode.className != "")) {
					linkClass = " " + pageLinks[i].parentNode.className + " ";
				}
				for (var theKey in popupLinkConfig) {
					if (linkClass.indexOf(" " + theKey + " ") > -1) {
						if ((pageLinks[i].target == "") || (pageLinks[i].target == null)) {
							pageLinks[i].target = (popupLinkConfig[theKey][0] != "") ? popupLinkConfig[theKey][0] : theKey;
						}
						pageLinks[i].settings = popupLinkConfig[theKey][1];
						pageLinks[i].onclick = popUp;
					}
				}
			}
		}
		return true;
	}

	function popUp() {
		newWin = window.open(this.href, this.target, this.settings);
		newWin.focus();
		return false;
	} 

	function bookmark(website, title) {
		var ver = navigator.appVersion;
		ver = ver.substr(0, ver.indexOf('(')-1);	
		var num = parseFloat(ver);		
		if ((navigator.platform!="MacPPC") && (navigator.appName=="Microsoft Internet Explorer") && (num>=4)) {	
			window.external.addFavorite(website,title);
		} else {
			alert('Uw browser ondersteunt het automatisch toevoegen van favorieten niet.\nRaadpleeg de handleiding van uw browser.\nNetscape & Mozilla: Ctrl+D / Command+D\nOpera: Ctrl+T / Command+T');
		}
	}

		function noenter() {
		return !(window.event && window.event.keyCode == 13); 
	}

	function isEmail(address) {
		var isValid = false;
		// basic checks (relying on lazy evaluation for correct behaviour!)
		// not empty
		// at least 7 characters (x@yy.zz)
		// has @
		// has only 1 @
		// has at least one . (domain.ext)
		isValid = (address!=null) 
		       && (address.length >= 7) 
		       && (address.indexOf('@')!=-1) 
		       && (address.indexOf('@') == address.lastIndexOf('@'))
		       && (address.indexOf('.')!=-1)
		;
		
		if (isValid) {
			var parts = address.split('@');
			var name  = parts[0].split('.');
			var host  = parts[1].split('.');
			var regName  = new RegExp("^([!#$%&'*+-/0-9=?A-Z^_a-z{}~]+)$"); // at least length 1
			var regLabel = new RegExp("^(^[-0-9A-Za-z][-0-9A-Za-z]+)$"); // at least length 2
			var regExt   = new RegExp("^([A-Za-z]{2,63})$"); // at least length 2
			var i;
			for (i=0; i < name.length; i++) {
				isValid = isValid && (name[i].search(regName) != -1);
			}
			for (i=0; i < host.length-1; i++) {
				isValid = isValid && (host[i].search(regLabel) != -1) && (host[i].length <= 63);
			}
			isValid = isValid && (host[host.length-1].search(regExt) != -1);
		}
		return isValid;
	}

	function checkNewsletter(theForm) {
		var isOK = isEmail(theForm.email.value);
		if (!isOK) {
			alert('Het ingevoerde emailadres is onjuist.');
		}
		return isOK;
	}	
	
	/*
		big advanced function for basic form checks!
	 	checks only on form fields containing 'form_'
		recognizes:
		 form_	: only checks fields with form_ in the name
		 req_		: required field
		 sel_		: selections (select)
		 opt_		: options (radio buttons)
		 
		 email	: email field
		 anr		: -> phone
		 bnr		: -> phone
		 cust		: customernumber
		 fax		: -> phone
		 mobile	: -> phone
	 */
	
	function checkForm(theForm) {
		var formElements = theForm.elements;
		var formOK = true;
		var formElementOK = true;
		var name;
		var value;
		var type;
		var required;
		var i = 0;
		var msg = "";
		
		while (formOK && (i < formElements.length)) {
			name  = formElements[i].name;
     		value = formElements[i].value;
			if ( (typeof(name) != 'undefined') && (name != '') && (name.search("form_") != -1) ) {
	     		if (value != "") {
	     			value = trim(value);
	     		}
	     		type  = "";
	     		required = false;
				msg   = "";
				name = name.replace("/form_/g", "");
				
	     		if (name.search("opt_")  != -1) { 
	     			type = "opt"; 
	     			name = name.replace("/opt_/g",  "");  
	     		}
	     		if (name.search("sel_")  != -1) { 
     				type = "sel"; 
     				name = name.replace("/sel_/g",  "");  
     				value = "filled";
	     		}
	     		if (name.search("email") != -1) { type = "email"; }
	     		if (name.search("number")!= -1) { type = "number"; }
	     		if (name.search("account")!=-1) { type = "number"; }
	     		if (name.search("anr")   != -1) { type = "number"; }
	     		if (name.search("cli")	 != -1) { type = "number"; }
	     		if (name.search("bnr")   != -1) { type = "number"; }
	     		if (name.search("cust")	 != -1) { type = "cust";  }
	     		if (name.search("fax")   != -1) { type = "number"; }
	     		if (name.search("mobile")!= -1) { type = "number"; }
	
				if (name.search("req_") != -1) {
					name = name.replace("/req_/g", "");
					formElementOK = (value != '');
					msg = 'Alle velden met * zijn verplicht.';
					required = true;
				}
				if (formElementOK) {
					switch (type) {
						case "email": 
							formElementOK = isEmail(value); 
							msg = 'Het ingevoerde emailadres is onjuist.';
							break;
						case "number": 
							value = keepNumbers(value);
							theForm.elements[i].value = value;
							formElementOK = true; // real checking should be done on site!!
							break;
						case "opt":   
							formElementOK = optionChecked(formElements[i]); 
						   msg = 'Kies een optie.'; 
						   break;
						case "sel":
							if (required) {
								formElementOK = optionSelected(formElements[i]);
							} else {
								formElementOK = true;
							}
							msg = 'Kies een optie.';
							break;
						case "cust":
							formElementOK = (value.length == 9) || ((value.length == 0) && !required);
							msg = 'Het ingevoerde klantnummer is onjuist.';
							break;
					}		
				}
				// need to check again because of possible stripping and trimming
				// only check if no error was detected before
				if (required) {
					if (formElementOK) {
						formElementOK = (value != '');
						msg = 'Alle velden met * zijn verplicht.';
					}
				}				
				formOK = formOK && formElementOK;
			}
			i++;
	   } // while
	   if (!formOK) {
	   	alert(msg);
	   	formOK = false;
	   }
	   return formOK;
	}
	
	function optionChecked(field) {
		var checked;
		var i = 0;
		while (!checked && (i < field.length)) {
			checked = field[i].checked;
			i++;
		}
		return checked;	
	}
	
	function optionSelected(element) {
		return (element.selectedIndex != 0);
	}	
	
	// strips all non-numbers
	function keepNumbers(theString) {
		var theString2 = theString.replace(new RegExp("[^0-9]*", "g"), ''); // strip all non-digits
		return theString2;	
	}

	// strips everything that's not a digit or alphanumeric character
	function keepAlpha(theString) {
		theString = theString.replace(new RegExp("[^a-zA-Z0-9]*", "g"), ''); // strip all non-alphanumeric
		return theString;	
	}
		
	// strip all whitespace (spaces, tabs, newlines, etc.) from beginning and end of string
	function trim(theString) {
   	theString = theString.replace(new RegExp("^(\s)*"), ''); // strip all whitespace in front (^)
   	theString = theString.replace(new RegExp("(\s)*$"), ''); // strip all whitespace at end ($)
   	return theString;
	}
	
	function submitForm(theFormName) {
		var theForm = document.getElementById(theFormName);
		if (theForm.onsubmit()) {
			theForm.submit();
		}
		return false;
	}
	
	