function fnInit()
{
	fnShowVisitFilter();
}

var iRequestRetries = 0;
function fnShowVisitFilter()
{
	divVisits.innerHTML = iMedica.VisitFilter.HTML;
	if (divVisits.innerHTML.indexOf("id=sysError") > 0) // if there was an error, try the request again.
	{
		if (iRequestRetries < 3)
		{
			iRequestRetries++;
			fnShowVisitFilter();
		}
		else
		{
			spanNumVisits.innerHTML = "(Server Error)";
			divVisits.style.visibility = "visible";
		}
		return;
	}
	else
	{	
		spanNumVisits.innerHTML = "(" + iMedica.VisitFilter.VisitCount + ")";

		if (iMedica.VisitFilter.VisitCount== 0)
			divVisits.style.visibility = "hidden";
		else
			divVisits.style.visibility = "visible";
	}
	iRequestRetries = 0;
}

function showContextMenu(sVisitUid, sTableID)
{
	gbContextMenuClick = true;
	iMedica.VisitFilter.ShowContextMenu(sVisitUid, event.clientX, event.clientY);
	gbContextMenuClick = false;
	DisableAlphaFilter(sTableID);
}

function openOnePageSummaryForMessage(sMsgUid)
{
	if (iMedica.Message.OpenPSDoctor(sMsgUid))
		fnFindMessageFilters(MessageFiltersFindUid);
}
