//	----------------------------------------------------------------------------------------------
//	Forms Focus

//	Attempt to focus on the first text field in the document with id="focus"
//	Returns true if focus done.

function autofocus()
{
	var forms;
	var elements;
	var element;
	var iForm, iElement;
	
	//	check each Form
	forms = document.forms;
	for (iForm = 0; iForm < forms.length; iForm++) {
		elements = forms[iForm].elements;
		
		//	check each Element
		for (iElement = 0; iElement < elements.length; iElement++) {
			element = elements[iElement];
			
			//	focus on Element
			if ((element.id == "focus") && ((element.type == "text") || (element.type == "textarea"))) {
				element.focus();
				return true;
			}
		}
	}
	return false;
}

	
