
//Function to check whether element clicked is form element
function checkel(which)
{
	if (which.style&&top.frames.global.intended.test(which.tagName))
	{
		if (top.frames.global.ns6&&top.frames.global.eventobj.nodeType==3)	top.frames.global.eventobj=top.frames.global.eventobj.parentNode.parentNode;
		return true;
	}
	else return false;
}


//Function to highlight all form element
function highlightFormElements(f, color)
{
  for(i = 0; i < f.length; i++)
  {
	if (/INPUT/.test(f.elements(i).tagName))
	{
		if(!/text|button|checkbox|password/.test(f.elements(i).type)) 
			continue;
	}


	f.elements(i).attachEvent ('onfocus', highlight);
	f.elements(i).attachEvent ('onblur', unhighlight);
	
  }
  if (color) top.frames.global.highlightcolor = color;

}
//Function to highlight form element
function highlight(e)
{
	top.frames.global.eventobj=top.frames.global.ns6? e.target : event.srcElement;

	if (checkel(top.frames.global.eventobj)) top.frames.global.eventobj.style.backgroundColor=top.frames.global.highlightcolor;
}

function unhighlight(e)
{
	top.frames.global.eventobj=top.frames.global.ns6? e.target : event.srcElement;

	if (checkel(top.frames.global.eventobj)) top.frames.global.eventobj.style.backgroundColor='';
}
