<PUBLIC:COMPONENT>

<PUBLIC:PROPERTY name="selected" get="get_selected" put="put_selected"/>

<PUBLIC:ATTACH event="onmouseover" onevent="OnMouseOver();"/>
<PUBLIC:ATTACH event="onmouseout"  onevent="OnMouseOut();" />
<PUBLIC:ATTACH event="onkeypress"  onevent="OnKeyPress();" />

<SCRIPT language="JavaScript">

var _bSelected = false;

function Hilite()
{
    style.padding = '0';
    style.border = '1px solid highlight';
}

function Unhilite()
{
    style.border = '';
    style.padding = '1px'
}

function get_selected()
{
    return _bSelected;
}

function put_selected(val)
{
    if (val == true)
    {
        _bSelected = true;
        Hilite();
    }
    else
    {
        _bSelected = false;
        Unhilite();
    }
}

function OnMouseOver()
{
    if (!_bSelected && !this.contains(event.fromElement))
        Hilite();
}

function OnMouseOut()
{
    if (!_bSelected && !this.contains(event.toElement))
        Unhilite();
}

function OnKeyPress()
{
    // If it's Enter or Space, click the element and stop the event
    // from bubbling so Enter keys don't go to the default button.

    if (event.keyCode == 13 /*|| event.keyCode == 32*/)
    {
        event.returnValue = false;
        event.srcElement.click();
    }
}

</SCRIPT>

</PUBLIC:COMPONENT>
