/************************************************************************
Author: Eric Simmons
Contact: info@jswitch.com
Website: http://www.jswitch.com
Version: 1.0 5/2005
Browser Target: Mozilla 6+/FireFox Netscape 6+, IE 5.0+
Title : JSwitch Form Highlights

DISCLAIMER:
THIS SOFTWARE IS PROVIDED "AS IS" AND WITHOUT
ANY EXPRESS OR IMPLIED WARRANTIES, JSWITCH.COM
IS NOT RESPONSIBLE FOR ANY ADVERSE AFFECTS TO
YOUR COMPUTER OR SYSTEMS RUNNING THIS SCRIPT.

LICENSE:
YOU ARE GRANTED THE RIGHT TO USE THE SCRIPT
PERSONALLY OR COMMERCIALLY. THE AUTHOR, WEBSITE LINKS
AND LICENSE INFORMATION IN THE HEADER OF THIS SCRIPT
MUST NOT BE MODIFIED OR REMOVED.

NOTES:
Add the javascript deceleration after the last </FORM> element on the page.
The javascript will automatically set up all the handlers for all the forms
on the page.
You can change the color of the highlight by changing the "clrNew" value.
If there are already event handlers assigned to the controls in form
the handlers will not be overwritten and so that particular control will
not be highlighted. Text controls that are not contained in a form won't
be highlighted.

***********************************************************************/


var clrNew = "#E9EFF5";
var clrOrg;

for (i=0; i<document.forms.length; i++)
{
    SetFuncHandler(document.forms.item(i));
}

function SetFuncHandler(elemtObj)
{
    var elemInput = elemtObj.getElementsByTagName("INPUT");
    for (a=0;a<elemInput.length;a++)
    {
        if ((elemInput.item(a).type == "text")||(elemInput.item(a).type == "password"))
        {
            if (elemInput.item(a).onfocus == null)
                elemInput.item(a).onfocus = HighlightBG;
            if (elemInput.item(a).onblur == null)
                elemInput.item(a).onblur = UnHighlightBG;
        }
    }
}

function HighlightBG()
{
    clrOrg = this.style.backgroundColor;
    this.style.backgroundColor = clrNew;
}

function UnHighlightBG()
{
    this.style.backgroundColor = clrOrg;
}
//this is for version 1.1 not being used in version 1.0
//function InsertFunc()
//{
//}
