var currID = 0;
var currColor = "#ff0ff0";
var currLogo = "";
var currHdr = "";

var aImages = new Array('clup', 'pluc', 'buzz', 'crux', 'vrijwilligers');
var aColors = new Array('#008adc', '#c84c8b', '#0037b8', '#ff1414', '#8ec812');

function fnSetActive(ID) {
	try {
		var obj = document.getElementById('mnuImg' + ID);
		var nr = obj.style.zIndex;
		nr--;
		currColor = aColors[nr];
		//changeColors(aColors[nr]);
		rollMenu(ID, 1);
		currID = ID;
	}
	catch(ex){}
}

function fnMnuActivate(ID) {
	try{
		document.getElementById('mnutxt' + ID).style.color = "#27438b";
	}
	catch(ex){}
}

function checkEmail(strEmail) { return (strEmail.search(/^[\w\.\-_]*[A-Z|a-z|0-9]{1}@([\w\-_]+\.)+[A-Za-z]{2,4}$/) != -1) }

function rollMenu(ID, State) {
	var obj = document.getElementById('mnuImg' + ID);
	var nr = obj.style.zIndex;
	nr--;
	if(State == 1) {
		obj.src = 'img/item_bottom_a_' + aImages[nr] + '.gif';
	} else {
		if(ID != currID) {
			obj.src = 'img/item_bottom_ia_' + aImages[nr] + '.gif';
		}
	}
}

function popUpFoto(URL) {
	var	W = 500;
	var H = 500;
	var L = (screen.width - W) / 2;
	var T = (screen.height - H) / 2;
	day = new Date();
	id = day.getTime();
	var sRef = "picture.asp?img=" + URL;
	eval("page" + id + " = window.open(sRef, '" + id + "', 'toolbar=0,scrollbars=0,location=0,statusbar=0,menubar=0,resizable=0,width='+W+',height='+H+',left ='+L+',top ='+T+'');");
}

function changeColors(color) {
	document.getElementById('divCluplogo').style.backgroundColor = color;
	document.getElementById('tblHeader').style.backgroundColor = color;
	document.getElementById('tblHeaderLeft').style.backgroundColor = color;
	document.getElementById('tblHeaderRight').style.backgroundColor = color;
	document.getElementById('tblCenterHeader').style.backgroundColor = color;
	document.getElementById('divCenterHeaderRight').style.backgroundColor = color;
	document.getElementById('divCenterHeaderLeft').style.backgroundColor = color;
	document.getElementById('txtInput').style.border = 'solid 1px ' + color;
	document.getElementById('tblCenterLogoBottom').style.backgroundColor = color;
}

function UpdateQuickResult() {
	var oSector = document.getElementById("SearchSector");
	var oWerksoort = document.getElementById("SearchWerksoort");
	var oDoelgroep = document.getElementById("SearchDoelgroep");
	
	var iSector, iWerksoort, iDoelgroep
	iSector = iWerksoort = iDoelgroep = -1;
	if (oSector.value > -1) {
		iSector = oSector.value;
	}
	if (oWerksoort.value > -1) {
		iWerksoort = oWerksoort.value;
	}
	if (oDoelgroep.value > -1) {
		iDoelgroep = oDoelgroep.value;
	}
	
	AsyncRequest("xt_countvacancies.asp?s=" + iSector + "&w=" + iWerksoort + "&d=" + iDoelgroep,
		function(html) {
			var oTonen = document.getElementById("btnTonen");
			document.getElementById("SearchQuickResult").innerHTML = html;
			oTonen.src = (html.indexOf("<!--(result)-->") > -1 ? imgTonen.src : imgTonenGray.src);
			oTonen.style.cursor = (html.indexOf("<!--(result)-->") > -1 ? "pointer" : "default");
		});
	
}

function AsyncRequest(u, rf) {
	u+= (u.indexOf("?") > -1 ? "&" : "?") + "rnd=" + (Math.random() * 200000);
	srtRefreshing = true;
	var req;
	var stateChanged = function() {
		if (req.readyState == 4) {
			rf(req.responseText);
		}
	}
	if (window.XMLHttpRequest) {
		req = new XMLHttpRequest();
		req.onreadystatechange = stateChanged;
		req.open("GET", u, true);
		req.send(null);
	} else if (window.ActiveXObject) {
		req = new ActiveXObject("Microsoft.XMLHTTP");
		if (req) {
			req.onreadystatechange = stateChanged;
			req.open("GET", u, true);
			req.send();
		}
	} else {
		void(0);
	}
}