// JavaScript Document by Ryabtsev 22.11.2009
function openWinCentered(loc, winname, widthh, heightt, params)
{
    var tp = Math.ceil((screen.height - heightt) / 2);
    var lf = Math.ceil((screen.width - widthh) / 2);
    if (params.length > 0)
        params = "," + params;

    var win = window.open(loc, winname, "width=" + widthh + ",height=" + heightt + ",top=" + tp + ",left=" + lf + params);
    win.focus();
    return win;
}