var formHelper = {
	focus: function() {
		var input;
		var inputCount;
		var inputFocus;
		var inputOffset;
		var inputs;

		if ( document.getElementsByTagName ) {
			inputs = document.getElementsByTagName('input');
			inputCount = inputs.length;
			inputFocus = -1;

			for ( inputOffset = -1; ++inputOffset < inputCount; ) {
				input = inputs[inputOffset];

				//	only process text or password inputs
				if ( input.id.toLowerCase() != 'sitekeywords' && (input.type.toLowerCase() == 'text' || input.type.toLowerCase() == 'password') ) {

					//	remember the first input
					if ( inputFocus == -1 ) {
						inputFocus = inputOffset;
					}

					//	check that no input values have changed
					if ( input.value != input.defaultValue ) {
						inputFocus = -1;
						inputOffset = inputCount;
					}
				}
			}

			//	if no input values have changed, focus the first input
			if ( inputFocus > -1 ) {

				try {
					inputs[inputFocus].focus();
					inputs[inputFocus].select();
				}
				catch(e) {
				}
			}
		}
	}
};

helper.addEvent(window, 'load', formHelper.focus, false);
