var bFound = false;

// for each form
for (f = 0; f < document.forms.length; f++)
{
	// for each element in each form
	for(i = 0; i < document.forms[f].length; i++)
	{
		
		if (document.forms[f][i].disabled != true && document.forms[f][i].type != "button")
		{
				// set the focus to it
				document.forms[f][i].focus();
				
				var bFound = true;
		}
	
// 		if (document.forms[f][i].type != "hidden" || document.forms[f][i].type != "button")
// 		{
// 			if (document.forms[f][i].disabled != true)
// 			{
// 					document.forms[f][i].focus();	
// 					var bFound = true;
// 			}
// 		}
		
		// if found in this element, stop looking
		if (bFound == true)
			break;
	}
	// if found in this form, stop looking
	if (bFound == true)
		break;
}
