function SwitchPmMessages()
{
	var NewPmImg = document.getElementById("NewPmImg");
	var NewPmText = document.getElementById("NewPmText");

	if(NewPmImg.style.visible == kwVisHide)
	{
		NewPmImg.style.visible = kwVisShow;
		NewPmText.style.color = "blue";
	}
	else
	{
		NewPmImg.style.visible = kwVisHide;
		NewPmText.style.color = "darkblue";
	}
}

function ShowDesc(e, bCalledByTimer)
{
	if(bCalledByTimer)
		document.getElementById("SiteDesc").style.display = "";
	else
		CheckForActivePopupPauseTimer(GetElementForEvent(e), function() {ShowDesc(null, true);});
}

function HideDesc(e)
{
	document.getElementById("SiteDesc").style.display = kwNone;

	CancelPopupPauseTimer();
}

function GetBalloonIdFromBtnId(BtnId)
{
	return BtnId + "_balloon";
}

function BtnOn(e, BtnId, UrlForOnImage)
{
	CancelEvent(e);

	var Btn = document.getElementById(BtnId);

	Btn.src = UrlForOnImage;

	ShowBln(GetBalloonIdFromBtnId(BtnId), false);
}

function BtnOff(e, BtnId, UrlForOffImage)
{
	CancelEvent(e);

	var Btn = document.getElementById(BtnId);

	Btn.src = UrlForOffImage;

	HideBln(GetBalloonIdFromBtnId(BtnId));
	CancelPopupPauseTimer();
}

function RegisterBtnForHotEffects(BtnId, UrlForOffImage, UrlForOnImage, bLeftPtForBln, BlnCtnt, bAddGrinToBalloon)
{
	var Btn = document.getElementById(BtnId);

	var Balloon = MakeBln(bLeftPtForBln, BlnCtnt, Btn.parentNode, bAddGrinToBalloon, false, false, false);
	Balloon.id = GetBalloonIdFromBtnId(BtnId);

	RegisterElementForEvent(Btn.parentNode, "mouseover", function(e){return BtnOn(e, BtnId, UrlForOnImage);});
	RegisterElementForEvent(Btn.parentNode, "mouseout", function(e){return BtnOff(e, BtnId, UrlForOffImage);});
}

function IsElementDisplayed(WhichElementId, bDisplayedAndVisible)
{
	var WhichElement = document.getElementById(WhichElementId);

	if(bDisplayedAndVisible)
		return WhichElement.style.display && WhichElement.style.visible;

	return WhichElement.style.display;
}

function ShowAdminMenu(e)
{
	document.getElementById("uzadpn").style.display = "";
	document.getElementById("VertSpacerForWhenAdminMenuIsHidden").style.display = kwNone;
}

function AttemptToHideAdminMenu(e)
{
		// Hide the menu only if it has no children open.
	if(IsElementDisplayed("admBarM1", true) && IsElementDisplayed("admBarM2", true) && IsElementDisplayed("admBarM7", true) && IsElementDisplayed("admBarM8", true) &&
		IsElementDisplayed("admBarM3", true) && IsElementDisplayed("admBarM9", true) && IsElementDisplayed("admBarM4", true))
	{
		document.getElementById("uzadpn").style.display = kwNone;
		document.getElementById("VertSpacerForWhenAdminMenuIsHidden").style.display = "";
	}
}

function PosLogo(e)
{
	var rectTitleGroup = document.getElementById("TitleGroup").getBoundingClientRect();
	var SiteLogo = document.getElementById("SiteLogo");
	var rectSiteLogo = SiteLogo.getBoundingClientRect();

	SiteLogo.style.left = (rectTitleGroup.left - rectSiteLogo.right) / 2 + "px";
}