/**
Set the focus onto the first form text input element with the class 'form-focus'
*/
(function()
{
	// Initialisation -- have init() run once page has finished loading
	if( window.addEventListener)
		window.addEventListener('load', init, false);
	else if( window.attachEvent)
		window.attachEvent('onload', init);

	/**
	Add event handlers to all form elements in document that have alt attributes
	*/
	function init()
	{
		// Loop through all forms in document
		formLoop:
		for( var i=0; i<document.forms.length; i++)
		{
			needsValidation = false;
			var form = document.forms[i];

			// Loop through elements in current form
			for( var j=0; j < form.elements.length; j++ )
			{
				var elem = form.elements[j];

				// Ignore everything except text input elements
				if( elem.type != 'text')
					continue;

				// Match class
				if( (' '+elem.className+' ').match(' form-focus ') )
				{
					elem.focus();
					break formLoop;
				}

			}
		}
	}


})();