function imgPopup(imgId){
	var thisImg = document.getElementById(imgId);
	if (thisImg!=null){
		var newImg = new Image();
		newImg.src = thisImg.src;
		var h = newImg.height + 30;
		var w = newImg.width + 40;
		window.open(thisImg.src,"Afbeelding","width="+w+",height="+h+",resizable=yes");
	}
	return false;
}

function jsOnlyElt(eltId, innerHtml, display) {
	var jsOnlyElt = document.getElementById(eltId);
	if (!(jsOnlyElt == null || jsOnlyElt == undefined)) {
		jsOnlyElt.innerHTML = innerHtml;
		if ("hidden" == jsOnlyElt.className) {
			jsOnlyElt.className="";
		}
	}
}

/* Original: http://www.infimum.dk/HTML/multiselect.html */
function initLinkedSelect(from,to) {
	from.parentNode.className = "clear";

	var options = new Array();
	for (var i=0; i < to.options.length; i++) {
		options[i] = new Array(to.options[i].text,to.options[i].value);
	}

	from.onchange = function() {
		if(from.selectedIndex > 0){
			var fromCode = from.options[from.selectedIndex].value;
			to.options.length = 0;
			
			while (to.firstChild) {
		    to.removeChild(to.firstChild);
		 	}
	
			var selectedTo = getRequestParameter('subthema');
			
			if(fromCode.length > 0) {
				for (i = 0; i < options.length; i++) {
					if (options[i][1].indexOf(fromCode) == 0) {
						to.options[to.options.length] = new Option(options[i][0], options[i][1]);
						if (selectedTo.length > 0 && options[i][1] == selectedTo) {
							to.options[to.options.length - 1].selected = true;
						}
					}
				}
				(to.parentNode.style || to.parentNode).display = "block";
			}
		} else {
			
			to.options[to.selectedIndex].selected = false;
			(to.parentNode.style || to.parentNode).display = "none";
		} 
	}
	
	from.onchange();
} 

function getRequestParameter( name ) {
	name = name.replace(/[\[]/,"\\\[").replace(/[\]]/,"\\\]");
	var regexS = "[\\?&]"+name+"=([^&#]*)";
	var regex = new RegExp( regexS );
	var results = regex.exec( decodeURI(window.location.href) );
	if( results == null )
		return "";
	else
		return results[1];
}