<!--
//
//	(C)	1998 Applicare Medical Imaging B.V.
//
//	Version	control:
//		$Archive: /releases/FreeViewer_2.0/src/WebViewer/FreeViewer/HTML/btnroll.htc $
//		$Revision: 6 $
//		$Date: 3/05/03 6:47p $
//		$Author: Marceld $
// -->
<PUBLIC:COMPONENT tagName="queryParam" lightweight="true">
	<PUBLIC:ATTACH EVENT="onmousedown"    ONEVENT="fnOnMouseDown()" />
	<PUBLIC:ATTACH EVENT="onmouseup"      ONEVENT="fnOnMouseUp()" />
	<PUBLIC:ATTACH EVENT="oncontentready" ONEVENT="fnOnContentReady()" />

	<PUBLIC:PROPERTY NAME="checked" put="setChecked" get="getChecked" />

	<PUBLIC:METHOD NAME="Enable"/>
</PUBLIC:COMPONENT>


<SCRIPT language="javascript">


//
// fnOnContentReady
//
function fnOnContentReady()
{
	element._baseImage = element.currentStyle.backgroundImage;
	element._bChecked = false;

	UpdateBackground('normal');
}


//
// UpdateBackground
//
function UpdateBackground(strState)
{
	element._strState = strState;

	var strStyle = '.';
	
	if (strState == 'clicked' || _bChecked)
	{
		strStyle = 'd.';
	}

	var idx = element._baseImage.lastIndexOf('.');
	if (idx != -1)
	{
		element.style.backgroundImage = element._baseImage.substring(0, idx) + strStyle +  element._baseImage.substring(idx + 1)
	}
}

//
// fnOnMouseDown
//
function fnOnMouseDown()
{
	UpdateBackground('clicked');
}


//
// fnOnMouseUp
//
function fnOnMouseUp()
{
	UpdateBackground('hover');
}


//
// fnOnPropertyChange()
//
function setChecked(bChecked)
{
	element._bChecked = bChecked;
	UpdateBackground(element._strState);
}


//
// getChecked()
//
function getChecked()
{
	return element._bChecked;
}


//
// Enable
//
// Purpose: Enable or disables a button. The image is set to prevent
//          'sticked' images if a button is disabled when the mouse
//          pointer hovers over the button.
function Enable(bEnable) // btnSrc, 
{
	if (!bEnable)
	{
		UpdateBackground('normal');
		element.disabled = true;
		element.className = 'classDisabled';
	}
	else
	{
		element.disabled = false;
		element.className = '';
	}

}


</SCRIPT>
