function opacity(id, opacStart, opacEnd, millisec) {
    var speed = Math.round(millisec / 100);
    var timer = 0;
	if(opacStart > opacEnd) {
        for(i = opacStart; i >= opacEnd; i--) {
            setTimeout("changeOpac(" + i + ",'" + id + "')",(timer * speed));
            timer++;
        }
    } else if(opacStart < opacEnd) {
        for(i = opacStart; i <= opacEnd; i++)
            {
            setTimeout("changeOpac(" + i + ",'" + id + "')",(timer * speed));
            timer++;
        }
    }
}

function changeOpac(opacity, id) {
	var object = document.getElementById(id).style;
    object.opacity = (opacity / 100.0);
    object.MozOpacity = (opacity / 100.0);
    object.KhtmlOpacity = (opacity / 100.0);
    object.filter = "alpha(opacity=" + opacity + ")";
}

function switchKey(paramsx) {
	document.getElementById("key").value = paramsx;
	document.getElementById("key").select();
}

function selectName() {		
	if (document.getElementById("key").value != '') {
		document.getElementById("livesearch").innerHTML = "<table cellspacing='0' cellpadding='5'><tr><td><img src=\"images/loading.gif\" /> De opdracht wordt uitgevoerd, een ogenblik geduld a.u.b...</td></tr></table>";
		
		var xmlHttpReq = false;
		var self = this;
	
		if (window.XMLHttpRequest) {
			self.xmlHttpReq = new XMLHttpRequest();
		} else if (window.ActiveXObject) {
			self.xmlHttpReq = new ActiveXObject("Microsoft.XMLHTTP");
		}
	
		// open POST verbinding
		self.xmlHttpReq.open('POST', "includes/werknemers.php", true);
		
		// header
		self.xmlHttpReq.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
			
		// updatepage als pagina gepost is
		self.xmlHttpReq.onreadystatechange = function() {
			if (self.xmlHttpReq.readyState == 4) {
				ajaxOutput = "<p>"+self.xmlHttpReq.responseText+"</p>";
				setTimeout("document.getElementById(\"livesearch\").innerHTML = ajaxOutput;", 500);
			}
		}
	
		// vraagt querystring op uit functie afhankelijk van pagina
		self.xmlHttpReq.send("key=" + document.getElementById("key").value);
	}
}