
	addLoadEvent (function() {

		//--------------------------------------------------
		// Go though each input field on the page

			var focusOn = null;
			var inputs = document.getElementsByTagName('input');

			for (var i = inputs.length-1; i >= 0; i--) {
				var inputType = inputs[i].type.toLowerCase();
				if (inputType == 'text' || inputType == 'password') {

					//--------------------------------------------------
					// When the user focuses on this field, then
					// select any text already in there - hopefully
					// will make it easier to replace the value

						inputs[i].onfocus = function () { this.select(); }

					//--------------------------------------------------
					// If this field does not have a value, then
					// its a potential candidate to recive focus.
					// But remember we go though the form backwards,
					// so there may be another field which has
					// yet to be checked

						if (inputs[i].value == '' && cssjs('check', inputs[i], 'noFocus') == false) {
							focusOn = inputs[i];
						}

				}
			}

		//--------------------------------------------------
		// Focus on the first field which does not
		// have a value.

			if (focusOn) {
				focusOn.focus();
			}

	});

