function findLabels()
{
//adds a behaviour to all submit buttons - disables after click to stop multiple submissions
var el = document.getElementsByTagName("label");
for (i=0;i<el.length;i++)
	{
	var thisId = el[i].getAttribute("for");
	if ((thisId)==null)
		{
		thisId = el[i].htmlFor;
		}
	if(thisId!="")
		{
		//apply to label
		el[i].onmouseover = highlightRelationship;
		el[i].onmouseout = hideRelationship;
		}
	}
}

function highlightRelationship()
{
	var thisId = this.getAttribute("for");
	if ((thisId)==null)
		{
		thisId = this.htmlFor;
		}	
	this.className="showRel";
	document.getElementById(thisId).className="showRel";
	if (document.getElementById(thisId).type=="text") document.getElementById(thisId).select();
}
function hideRelationship()
{
	var thisId = this.getAttribute("for");
	if ((thisId)==null)
		{
		thisId = this.htmlFor;
		}	
	this.className="";
	document.getElementById(thisId).className="";
}

addEvent(window, 'load', findLabels, false);

