
// Call example: <input name="username" id="username" type="text" value="Username" onfocus="javascript:autoClearInput('username');" />
function autoClearInput(id_str)
{
	var input = document.getElementById(id_str);
	if (input.value == "Wat zoekt u?")
	{
		document.getElementById(id_str).value = "";
	}
}

function autoSetInput(id_str)
{
	var input = document.getElementById(id_str);
	if (input.value == "")
	{
		document.getElementById(id_str).value = "Wat zoekt u?";
	}
}

function addLoadEvent(callBack)
{
	var oldOnload = window.onload;
	if (typeof window.onload != 'function')
	{
		window.onload = callBack;
	} else
	{
		window.onload = function()
		{
			if (oldOnload) { oldOnload(); }
			callBack();
		}
	}
}

function addSubmitCheckElement()
{
	for (var i = 0; i < document.forms.length; i++)
	{
		var form = document.forms[i];
		var hiddenInput = document.createElement("input");
		hiddenInput.setAttribute("name", "submitCheck");
		hiddenInput.setAttribute("type", "hidden");
		hiddenInput.setAttribute("value", "submitAllowed");
		
		form.appendChild(hiddenInput);
	}
}