function popup(url,w,h,name) {
	var popwidth = parseInt(w);
	var popheight = parseInt(h);
	var parenttop = (self.screenTop)? self.screenTop:self.screenY;
	var parentleft = (self.screenLeft)? self.screenLeft:self.screenX;
	var topcorrection = (navigator.appName == "Microsoft Internet Explorer")? -20:43;
	var parentwidth = (document.documentElement)? document.documentElement.clientWidth:document.body.clientWidth;
	var parentheight = (document.documentElement)? document.documentElement.clientHeight:document.body.clientHeight;
	var popleft = (parentwidth/2 - popwidth/2) + parentleft;
	var poptop = (parentheight/2 - popheight/2) + parenttop + topcorrection;
	var popup = window.open(url,name,'toolbar=0,location=0,directories=0,status=1,menubar=0,scrollbars=yes,resizable=no,width='+popwidth+',height='+popheight+',left='+popleft+',top='+poptop+',screenX='+popleft+',screenY='+poptop)
	popup.focus();
}

currentActiveTab = 1;
function setActive(id){
	oldTabObj = document.getElementById("tab" + currentActiveTab);
	oldLinkObj = document.getElementById("tablink" + currentActiveTab);
	currentActiveTab = id;
	newTabObj = document.getElementById("tab" + currentActiveTab);
	newLinkObj = document.getElementById("tablink" + currentActiveTab);
	
	oldTabObj.className = "hide";
	oldLinkObj.className = "";
	newTabObj.className = "show";
	newLinkObj.className = "active";
	
	setHeight();
}

function init() {
	setHeight();
}

function rollover(obj) {
	(obj.childNodes[0].src.indexOf('_0') != -1) ? obj.childNodes[0].src = obj.childNodes[0].src.replace('_0','_1') : obj.childNodes[0].src = obj.childNodes[0].src.replace('_1','_0');
}

function findObj(id) {
	return ((document.getElementById) ? document.getElementById(id) : document.all[id]);
}

function setHeight() {
	var content = findObj('contentBody');
	var menu = findObj('contentLeft');
	var main = findObj('bodyPage');
	
	if (content) {
		//if (content.offsetHeight <= menu.offsetHeight) { 
		//	content.style.height = menu.offsetHeight - 20 + 'px'; 
		//} else { 
			if (content.offsetHeight < 400) {
				content.style.height = "400px";
			}
			menu.style.height = content.offsetHeight - 15 + 'px'; 
		//}
		
		//if ((content.offsetHeight < 400) || (menu.offsetHeight < 400)) {
		//	menu.style.height = "380px";
		//	content.style.height = "400px";
		//}
	}
	//alert(content.offsetHeight + ' ' + menu.offsetHeight);
}

var openDiv = "";
var openDivArrow = "";
function show(id,obj) {
	var box = findObj(obj);
	var prevBox = findObj(openDiv);
	var aTag = document.getElementsByTagName("a");
	
	if (openDiv != obj) { if (prevBox) prevBox.style.display = "none"; }
	
	for (i = 0; i < aTag.length; i++) {
    	if (aTag[i].style.background.indexOf("url(images/arrowdown.gif)") != -1) { aTag[i].style.background = "url(images/arrowmenuitem1.gif) left 4px no-repeat"; }
	}
	

	if ((box.style.display == "none")||(box.style.display == "")) {
		box.style.display = "block";
		id.style.background = "url(images/arrowdown.gif) left 4px no-repeat";
	} else {
		box.style.display = "none";
		id.style.background = "url(images/arrowmenuitem1.gif) left 4px no-repeat";
	}
	openDiv = obj; 
	setHeight();
}


//Laden discipline pagina
function setUrl(selectbox) {
	if (selectbox[selectbox.selectedIndex].value != "") {
		document.location.href = "content.asp" + selectbox[selectbox.selectedIndex].value
	}
	
	
}

function validateForm(obj,required,msg){
	var errorFields = '';
	var firstField = '';
	var message = '';
	var requiredFields = required.split (/\s*,\s*/);
	var emailfilter = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/;
	
	for(var i=0;i<requiredFields.length;i++){
		var frmObj = findObj(obj);
		var fldObj = eval('frmObj.' + requiredFields[i]);
			if ((fldObj.value == '' || fldObj.value.indexOf("< ") != -1 || fldObj.value.indexOf("-- ") != -1) || ( ((fldObj.id == "email")||(fldObj.id == "Email")) && !(emailfilter.test(fldObj.value)))    ) {
				if (firstField == '')firstField = fldObj;
				if (fldObj.title != ''){
					if (fldObj.title == "< DD >") { errorFields += '- Datum dag\n'; }
					else if (fldObj.title == "< MM >") { errorFields += '- Datum maand\n'; }
					else if (fldObj.title == "< JJJJ >") { errorFields += '- Datum jaar\n'; }
					else { errorFields += '- ' + fldObj.title + '\n'; }
				}else{
					errorFields += '- ' + fldObj.id + '\n';
				}
				fldObj.style.backgroundColor = '#FFD4D4';
			}
	}
	
	if(errorFields != ''){
		alert(msg + '\n\n' + errorFields);
		return false;
	}
	return true;
}

//filter op pagina
function setFilter(selectbox) {
	alert(selectbox[selectbox.selectedIndex].value)
}

//filter op discipline
function setDiscipline(selectbox) {
	var querystring = selectbox[selectbox.selectedIndex].value
	querystring = querystring.split("?").join("")
	var querystringList = querystring.split("&")
	var pageID = querystringList[0].split("=")[1]
	var languageID = querystringList[1].split("=")[1]
	alert(document.location.href)
	alert(pageID)
	alert(languageID)
}

//filter form op producten pagina posten
function postFilterForm(selectbox){
	//alert(selectbox)
	selectbox.form.submit()
}