function setFocus()
{
	var stopNow=false;
	
	// Ensure there is at least one form on the page before continuing
	for (var i=0; i < document.forms.length; i++)
	{
		// Get all the form elements
		var currSet=document.forms[i].elements;

			// Ingore 2 specific forms which may or may not be on the page
			if (document.forms[i].name!='searchSearchHeaderForm' && document.forms[i].name!='inlinecommentform')
			{
				for (var j = 0; j < currSet.length; j++)
				{
					// If the form element is one that can accept input, set the focus
					if (currSet[j].type=='text' || currSet[j].type=='password' || currSet[j].type=='textarea')
					{
						if (getStyle(currSet[j], "display") != 'none')
						{
							currSet[j].focus();

							// If the current element is the 'login.username' element and that element
							// has data in it, we want to make sure we set the focus on the next element, which
							// in this case, will be the password element.
							if (!(currSet[j].name == 'login.username' && currSet[j].value != ''))
							{
								stopNow=true;
								break;
							}
						}
					}
				}
			}

			if (stopNow)
			{
				break;
			}
	}
}
