// functions for the Dansk KirkegårdsIndex - DKI pages

var nameField = false;

function init(evnt) { 
// use onload="init(event)" in all body (or frameset) start tags to initialize the page
// giving focus to window, and to text field "safeseek" in the first form where it exists
// and is not disabled. Call function userInit if it exists with the event argument.
// If "userInit" refers to a function, it is executed too.
	var i, forms = document.forms, element;	
	window.focus();
	for (i=0; i<forms.length; i++)
		if (typeof(element=forms[i].elements['seekPerson'])=='object'
				&& element.type.toLowerCase()=='text' && !element.disabled) {
			(nameField = element).focus();
				// after window.focus(), or else the focus is lost again
			break;
		} // if (typeof(forms[i]...
	if (typeof(userInit)=='function') userInit(evnt);
} // function init()

function submitForm(id) {
// submits form with id="(value of id)" after inserting succeeding name/value pairs
// e.g. href="javascript:submitForm('myForm','name1','value1','name2','value2')"
	var arg, form = document.getElementById(id);
	for (arg=1; arg<arguments.length-1; arg+=2)
		form[arguments[arg]].value = arguments[arg+1];
	form.submit();
} // function submitForm()

