function fnInit()
{
	fnShowExternalPatients();
}

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

		if (iMedica.ExternalPatient.ExternalPatientCount== 0)
			divExternalPatients.style.visibility = "hidden";
		else
			divExternalPatients.style.visibility = "visible";
	}
	iRequestRetries = 0;
}

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

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