var zkTitel = "direct zoeken...";
var qResults = "zoekresultaten";
var qExt = "html";
var zkMethod = "GET";

var oZoek = document.forms["zoeker"];
var vRobot = true;

if(oZoek)
{	// zoekformulier voorbereiden
	oZoek.action = "javascript:startZoeken();";
	if(oZoek.elements["qZoek"].value == "" || oZoek.elements["qZoek"].value == zkTitel)
	{
		oZoek.elements["qZoek"].value = zkTitel;
		oZoek.elements["qZoek"].style.color = "#8c8c8c";
	}
	var oKnop = document.getElementById("zoekknop");
	if(document.all)
	{ // IE
		var onfocus = new Function("checkZoeker('focus');");
		oZoek.elements["qZoek"].setAttribute("onFocus", onfocus);
		var onblur = new Function("checkZoeker('blur');");
		oZoek.elements["qZoek"].setAttribute("onBlur", onblur);
		var onmousedown = new Function("vRobot=true;");
		oZoek.elements["qZoek"].setAttribute("onMouseDown", onmousedown);
		var onclick = new Function("startZoeken();");
		//oKnop.setAttribute("onClick", onclick);
		oKnop.href="javascript:startZoeken();";
	}
	else
	{ // other
		oZoek.elements["qZoek"].setAttribute("onfocus", "checkZoeker('focus');");
		oZoek.elements["qZoek"].setAttribute("onblur", "checkZoeker('blur');");
		oZoek.elements["qZoek"].setAttribute("onmousedown", "vRobot=true;");
		oKnop.setAttribute("onclick", "startZoeken();");
		oKnop.href="javascript:void(0);";
	}
	//if(document.forms.length == 1) oZoek.elements["qZoek"].focus();
}

function checkZoeker(actie)
{	// default tekstweergave afhandelen
	if(oZoek.elements["qZoek"].value == zkTitel && actie == "focus")
	{
		oZoek.elements["qZoek"].value = "";
		oZoek.elements["qZoek"].style.color = "#3f3f3f";
	}
	else if(oZoek.elements["qZoek"].value == "" || oZoek.elements["qZoek"].value == zkTitel)
	{
		oZoek.elements["qZoek"].value = zkTitel;
		oZoek.elements["qZoek"].style.color = "#8c8c8c";
	}
}

function startZoeken()
{	// op zoeken geklikt
	if(oZoek.elements["qZoek"].value == "" || oZoek.elements["qZoek"].value == zkTitel)
	{	// er valt nix te zoeken
		document.location.href = "zoek.html";
	}
	else
	{
		if(vRobot)
		{	// alleen als er expliciet door een gebruiker op het invulveld is geklikt
			oZoek.method = zkMethod;
			oZoek.action = qResults+"."+qExt;
			oZoek.elements["qSpam"].value = "ok";
			oZoek.submit();
		}
	}
}