// JavaScript Document

//Highlight form element- © Dynamic Drive (www.dynamicdrive.com)
//For full source code, 100's more DHTML scripts, and TOS,
//visit http://www.dynamicdrive.com

var highlightcolor="#C3D3F3"

var ns_h6=document.getElementById&&!document.all
var previous_h=''
var eventobj_h

//Regular expression to highlight only form elements
var intended=/INPUT|TEXTAREA|SELECT|OPTION/

//Function to check whether element clicked is form element
function checkel(which){
if (which.style&&intended.test(which.tagName)){
if (ns_h6&&eventobj_h.nodeType==3)
eventobj_h=eventobj_h.parentNode.parentNode
return true
}
else
return false
}

//Function to highlight form element
function highlight(e){
eventobj_h=ns_h6? e.target : event.srcElement
if (previous_h!=''){
if (checkel(previous_h))
previous_h.style.backgroundColor=''
previous_h=eventobj_h
if (checkel(eventobj_h))
eventobj_h.style.backgroundColor=highlightcolor
}
else{
if (checkel(eventobj_h))
eventobj_h.style.backgroundColor=highlightcolor
previous_h=eventobj_h
}
}
