
function popUpImage(image, width, height, title, eng)
{
	var wnd, _left, _top;
	var closeTitle = (eng != undefined) ? "Close the window" : "Закрыть окно";
	_left = (window.screen.width - width) / 2;
	_top = (window.screen.height - height) / 2;
	if (title == null) title = "Image";
	wnd = window.open("", "_blank", "left = " + _left + ", top = " + _top + ", scrollbars = no, resizable = no, titlebar = no, status = no, toolbar = no, location = no, width = " + width + ", height = " + height);
	try {
	    wnd.document.write("<html><head><title>" + title + "</title></head><body leftmargin='0' topmargin='0' rightmargin='0' bottommargin='0'><a href='#' title='" + closeTitle + "' onClick='window.close();'><img src='" + image + "' border='0'></a></body></html>")
	} catch (err) {
	    // ...
	}
	window.event.returnValue = false;
	return wnd;
}

function popUp(url, width, height)
{
	var wnd, _left, _top;
	if (document.readyState != "complete") return false;
	_left = (window.screen.width - width) / 2;
	_top = (window.screen.height - height) / 2;
	wnd = window.open(url, "_blank", "left = " + _left + ", top = " + _top + ", scrollbars = no, resizable = no, titlebar = no, status = no, toolbar = no, location = no, width = " + width + ", height = " + height);
	window.event.returnValue = false;
	return wnd;
}

////////////////////////////////////////

var m_timer = -1;

var prev = null;

if (document.onreadystatechange != undefined) {
    prev = document.onreadystatechange;
    document.onreadystatechange = function() {
        if (prev != null) prev;
        if (document.readyState == 'complete') {
            document.getElementById("idMenu").onmouseout = function() {
                m_hide();
            }
        }
    } 
}

function m_show() {
	if (m_timer != -1) {
	    clearTimeout(m_timer);
	    m_timer = -1;
	}
	
	var left = document.getElementById("idMain").offsetLeft + 270;
	if ((document.selection == undefined) && (window.opera == undefined)) {
	    var aleft = (document.body.clientWidth - 780) / 2;
	    left += aleft;
	}
	
	document.getElementById("idMenu").style.left = left + "px";
	document.getElementById("idMenu").style.top = 120 + "px";
	document.getElementById("idMenu").style.display = "";
}

function m_menuOut() {
	// window.status = "menu out";
	m_hide();
}

function m_reset() {
    // window.status = "reset";
	if (m_timer != -1) {
	    clearTimeout(m_timer);
	    m_timer = -1;
	}
}

function m_hide() {
	// window.status = "hide";
	m_timer = setTimeout("m_doHide();", 500);
}

function m_doHide() {
	document.getElementById("idMenu").style.display = "none";
	m_timer = -1;
}

