function putFocusInFirstForm()
{
	for ( var iLoopForms = 0; iLoopForms < document.forms.length; iLoopForms++ )
	{
		_form = document.forms[iLoopForms];

		for ( var iLoopElements = 0; iLoopElements < _form.elements.length; iLoopElements++ )
		{
			_element = _form.elements[iLoopElements];

			if ( _element.type != "text" &&
				 _element.type != "textarea" &&
				 _element.type != "file" &&
				 _element.type != "password" &&
				 _element.type != "radio" &&
				 _element.type.indexOf( "select" ) != 0 )
			{
				continue;
			}

			if ( _element.tabindex == -1 )
				continue;

			try
			{
				_element.focus();
				return;
			}
			catch( e )
			{
				// Fail gracefully
			}
		}
	}
}

var documentBody;

function waitCursor( timeout )
{
	try
	{
		// Capture document.body as an IE workaround
		
		documentBody = document.body;
		documentBody.style.cursor = 'wait';
	}
	catch( e )
	{
		// Fail gracefully
	}
	finally
	{
		// Always set it back eventually, in case link
		// opened a new window
		
		if ( timeout )
			self.setTimeout( 'autoCursor()', timeout );
		else
			self.setTimeout( 'autoCursor()', 5000 );
	}
}

function autoCursor()
{
	try
	{	
		documentBody.style.cursor = 'auto';
	}
	catch( e )
	{
		// Fail gracefully
	}
}
