//Copyright (c) 2000 Microsoft Corporation.  All rights reserved.
//<script>
var g_WinDoc			=	window.document;
var g_WinDocAll			=	g_WinDoc.all;
var g_szButtonUp		=	"THREEDHIGHLIGHT THREEDDARKSHADOW THREEDDARKSHADOW THREEDHIGHLIGHT";
var g_szButtonDown		=	"THREEDDARKSHADOW THREEDHIGHLIGHT THREEDHIGHLIGHT THREEDDARKSHADOW";
var g_szButtonNeutral	=	"buttonface";
var g_szMenuText;
var g_objOpenMenu		=	null;

function btnRecip_onmouseup()
{
	this.onmouseup=null;
	this.onmouseout=null;
	this.runtimeStyle.borderColor=g_szButtonUp;
}

function btnRecip_onmouseout()
{
	this.onmouseup=null;
	this.onmouseout=null;
	this.runtimeStyle.borderColor=g_szButtonUp;
}

function onRecipFaceDown( obj )
{
	obj.runtimeStyle.borderColor = g_szButtonDown;
	obj.onmouseup=btnRecip_onmouseup;
	obj.onmouseout=btnRecip_onmouseout;
}
/********MENU ITEM METHODS*************/
function onDocumentMouseDown()
{
	if(event.srcElement.name != "cbButton")
	{
		CbMenuHide();
	}
}
function onDocumentMouseOut()
{
	if(null == event.toElement)
	{
		CbMenuHide();
	}
}
function onCbMenuItemMouseOut(obj)
{
	obj.runtimeStyle.backgroundColor	=	g_szButtonNeutral;
	obj.runtimeStyle.color	=	 obj.color;
}

function onCbMenuItemMouseOver(obj)
{
	obj.runtimeStyle.backgroundColor = "highlight";
	obj.color = obj.runtimeStyle.color;
	obj.runtimeStyle.color = "highlighttext";
	onOverOrOut(obj, g_szButtonDown);
}
function onCbMenuItemClick(obj)
{
	if(null == obj.suppress)
	{
		onCbClick(obj.id, true)
	}
	CbMenuHide();
}
function CbMenuHide()
{
	var obj =g_objOpenMenu.openingbutton;
	obj.buttondown = false;	
	cbSwitchMenuState(obj, false);		
	onCbMouseOut(obj)
}
/********END MENU ITEM METHODS*************/
/********NONSTICKY BUTTON METHODS*************/
function onCbMouseUp(obj)
{
	if(null != obj.sticky || null != obj.menuitem)
	{
		return;
	}
	obj.runtimeStyle.borderColor=g_szButtonUp;
}
function onCbMouseDown(obj)
{

	if(null != obj.sticky || null != obj.menuitem)
	{
		return;
	}
	obj.runtimeStyle.borderColor=g_szButtonDown;
}
function onOverOrOut(obj, szBorderColor)
{
	if(null != obj.overelements)
	{
		var rg_szItems	=	obj.overelements.split(";");
		var tempObj		=	null;
		for( x=0; x < rg_szItems.length; x++ )
		{
			tempObj	=	AccessFld(g_WinDocAll[rg_szItems[x]]);
			if(null != tempObj && true != tempObj.buttondown)
			{
				tempObj.runtimeStyle.borderColor=szBorderColor;
			}			
		}	
	}
}
function onCbMouseOver(obj)
{
	if(null != obj.menuitem)
	{
		onCbMenuItemMouseOver(obj);
		return;
	}
	if(true != obj.buttondown)
	{
		obj.runtimeStyle.borderColor=g_szButtonUp;
		onOverOrOut(obj, g_szButtonUp);
	}
}
function onCbMouseOut(obj)
{
	if(null != obj.menuitem)
	{
		onCbMenuItemMouseOut(obj);
		return;
	}
	if(true != obj.buttondown)
	{
		obj.runtimeStyle.borderColor=g_szButtonNeutral;	
		onOverOrOut(obj, g_szButtonNeutral);
	}	
}

function onCbClickEvent(obj, fNoEvent)
{
	event.cancelBubble=true;
	if(null != obj.sticky)
	{
		onCbStickyClickEvent(obj, fNoEvent);
		return(false);
	}
	if(null != obj.menuitem)
	{
		onCbMenuItemClick(obj);
		return(false);
	}	
	if(null != obj.swapitems )
	{
		var x;
		var rg_szItems = obj.swapitems.split(";");
		for( x=0; x < rg_szItems.length; x++ )
		{
			with(g_WinDocAll[rg_szItems[x]].style)
			{
				display = ("none" == display) ? "" : "none";
			}
		}
	}
	if(null == obj.suppress)
	{
		onCbClick(obj.id, true);
	}
	return(false);
}
/********END NONSTICKY BUTTON METHODS*************/
/********STICKY BUTTON METHODS*************/
function cbSwitchMenuState(obj, fHide)
{
	if(null != obj.submenu)
	{
		g_objOpenMenu =	AccessFld(g_WinDocAll[obj.submenu]);;
		var objStyle = g_objOpenMenu.style;
		if(true == fHide)
		{
			objStyle.display = "";
			objStyle.posLeft = obj.offsetLeft;
			objStyle.posTop = obj.offsetHeight+2;
			g_objOpenMenu.openingbutton	=	obj;
			g_WinDoc.onmouseup = onDocumentMouseDown;
			g_WinDoc.onmouseout = onDocumentMouseOut;
		}
		else
		{
			objStyle.display = "none";
			g_WinDoc.onmouseup = null;
			g_WinDoc.onmouseout = null;
		}
	}
}

function onCbStickyClickEvent(obj, fNoEvent)
{
	obj.buttondown = (true == obj.buttondown);
	if(false == obj.buttondown)
	{
		obj.runtimeStyle.borderColor	=	g_szButtonDown;
		obj.buttondown					=	true;
		var szToggles = (null != obj.stickytoggle)?obj.stickytoggle:obj.radio;
		if(null != szToggles)
		{	
			var x;
			var tempobj;
			var rg_szItems = szToggles.split(";");
			for( x=0;x<rg_szItems.length;x++ )
			{
				tempobj	=	AccessFld(g_WinDocAll[rg_szItems[x]]);
				tempobj.runtimeStyle.borderColor	= g_szButtonNeutral;
				tempobj.buttondown					= false;
			}
		}
		cbSwitchMenuState(obj, true);
	}
	else if(true == obj.buttondown && (null == obj.radio))
	{
		obj.runtimeStyle.borderColor	=	g_szButtonNeutral;
		obj.buttondown					=	false;	
		cbSwitchMenuState(obj, false);	
	}
	if(null == obj.suppress && true != fNoEvent)
	{
		onCbClick(obj.id, obj.buttondown);
	}
	return(false);
}




