/**

----------------------------------
DOCUMENT HISTORY:
----------------------------------

Created by: Ryan J. Salva, http://www.capitolmedia.com
Date created: July 24, 2004


----------------------------------
DESCRIPTION
----------------------------------

Changes input class to "clsFormFocus" when user brings
focus onto the form element. Increases usability by
providing a visual que indicating the current form element.


----------------------------------
TESTED WITH:
----------------------------------
Mozilla Firefox 0.9.1
IE 6.0
Netscap 6.2

----------------------------------
REQUIRED ASSETS: 
----------------------------------
form_focus.css

----------------------------------
IMPLEMENTATION:
----------------------------------

Simply place both the js and css files in the header.
No other action required.

**/

fnFormFocus = function() {

	// build an array of all the target form elements
	var a = new Array(3);
	a[0] = "INPUT";
	a[1] = "TEXTAREA";
	a[2] = "SELECT";
	
	// loop through the array of form elements
	for (var y=0; y<a.length; y++) {
		var i = document.getElementsByTagName(a[y]);

		// loop through the page elements
		for (var x=0; x<i.length; x++) {
			i[x].onfocus=function() {
				this.className+=" clsFormFocus";
			}
			i[x].onblur=function() {
				this.className=this.className.replace(new RegExp(" clsFormFocus\\b"), "");
			}
		}
	}
}
if (window.attachEvent) window.attachEvent("onload", fnFormFocus);
