function hideElement(elmID)
{
	var y = (document.body.offsetHeight - 170) / 2;
	var x = (document.body.offsetWidth  - 265) / 2;
	for (i = 0; i < document.all.tags(elmID).length; i++)
	{
		obj = document.all.tags(elmID)[i];
		if (! obj || ! obj.offsetParent)
			continue;

		// Find the element's offsetTop and offsetLeft relative to the BODY tag.
		objLeft   = obj.offsetLeft;
		objTop    = obj.offsetTop;
		objParent = obj.offsetParent;
		while (objParent.tagName.toUpperCase() != "BODY")
		{
			objLeft  += objParent.offsetLeft;
			objTop   += objParent.offsetTop;
			objParent = objParent.offsetParent;
		}
		// Adjust the element's offsetTop relative to the dropdown menu
		objTop = objTop - y;

		if (x > (objLeft + obj.offsetWidth) || objLeft > (x + 265))
			;
		else if (objTop > (180 + document.body.scrollTop))
			;
		else
			obj.style.visibility = "hidden";
	}
}

function showElement(elmID)
{
	for (i = 0; i < document.all.tags(elmID).length; i++)
	{
		obj = document.all.tags(elmID)[i];
		if (! obj || ! obj.offsetParent)
			continue;
		obj.style.visibility = "";
	}
}

//-- показ окна "сообщение системы"
function ShowAlert(sMessage) {
	var x = event.clientX+12;
	var y = event.clientY-8;
	idAlertBody.innerHTML = sMessage;
	idErrorWindow.style.left = (document.body.offsetWidth - 265) / 2;
	idErrorWindow.style.top  = ((document.body.offsetHeight - 170) / 2) + document.body.scrollTop;
	hideElement("SELECT");
	hideElement("IFRAME");
	hideElement("OBJECT");
	idErrorWindow.style.display = "block";
}

//-- скрыть окно "собщение системы"
function CloseAlert() {
	idErrorWindow.style.display = "none";
	showElement("SELECT");
	showElement("IFRAME");
	showElement("OBJECT");
}

