// common scripts

function switchLang(s) { // goto same page in either NL or EN version
	var sURL = new String(location.href);
	if (s=="EN") { // switch to EN
		sNEWURL = sURL.replace(/\/nl\//gi,"/en/");
		setCookie("lang","EN","/");
	} else { // switch to NL
		sNEWURL = sURL.replace(/\/en\//gi,"/nl/");
		setCookie("lang","NL","/");
	}
	if (sNEWURL!=sURL) location.href  = sNEWURL;
}

//

function setCookie (name,value,pad) {
	var sCookie = " "+ name + "=" + escape(value);
	var duur = new Date(); duur.setTime(duur.getTime() + (120 * 24 * 60 * 60 * 1000) ); // live long and prosper
	duur = duur.toGMTString(); // VERY important !
	sCookie += "; expires="+duur;
	if (pad) sCookie += "; path="+pad;
	document.cookie = sCookie;
	//alert ("document.cookie = "+document.cookie);
}

function getVal(str,naam) {	
	// usage: var currentSelected =  getVal(string,zoekstring); 
	eval ("var re = /"+naam+"=([^,;]*)/gi;"); 
	var retVal = ""; // returns "" als niks gevonden wordt, anders value
	// onderstaande 'vreemde' constructie omwille van IE 5.5
	if (str!="") if (re.test(str)) retVal  = RegExp.$1;
	return retVal;
}
