// HighlightForm.js -- Highlight form element in focus.
// Usage: <BODY onload="initEvents();> 
// Warren Blatt, May 2005.

var highlightcolor="#eae6f0"
var ns6=document.getElementById&&!document.all
var previous=''
var eventobj

// Function to highlight form element.
function highlightEl(e)
{
  if (previous != '')
    { previous.style.backgroundColor=''; }

  eventobj = ns6 ? e.target : event.srcElement;
  eventobj.style.backgroundColor=highlightcolor;
  previous = eventobj;

  return true;
}


// Function to assign the "highlightEl()" callback to every 
//   form element's onFocus event handler.
function initEvents()
{
  // Assumes that there's only one form in the document.
  var elements = document.forms[0].elements;
  for (i=0; i < elements.length; i++)
    {
      elements[i].onfocus = highlightEl;
    }
}


