function OpenWindowDef(oAnchor, strWindowName)
{
    var oNewWindow = window.open(oAnchor.href, strWindowName);
    if (oNewWindow != null)
        oNewWindow.focus();
}

function OpenWindow(oAnchor, strWindowName, nWidth, nHeight)
{
    var oNewWindow = window.open(oAnchor.href, strWindowName, "directories=no,location=no,menubar=no,status=no,toolbar=no,scrollbars=yes,resizable=yes,width=" + nWidth + ",height=" + nHeight);
    if (oNewWindow != null)
        oNewWindow.focus();
}

function OpenWindow_withNavigate(oAnchor, strWindowName, nWidth, nHeight)
{
    var oNewWindow = window.open(oAnchor.href, strWindowName, "directories=no,location=no,menubar=no,status=no,toolbar=yes,scrollbars=yes,resizable=yes,width=" + nWidth + ",height=" + nHeight);
    if (oNewWindow != null)
        oNewWindow.focus();
}

function OpenWindowStr(strHref, strWindowName, nWidth, nHeight)
{
    var oNewWindow = window.open(strHref, strWindowName, "directories=no,location=no,menubar=no,status=no,toolbar=no,scrollbars=yes,resizable=yes,width=" + nWidth + ",height=" + nHeight);
    if (oNewWindow != null)
        oNewWindow.focus();
}

function OpenArticle(oAnchor)
{
    var strWindowName = "Articles";
    var oRegExp = new RegExp("([0-9]{8})-([0-9]{2})\\.(html|asp)", "i");
    if (oRegExp.exec(oAnchor.href) != null)
        strWindowName += RegExp.$1 + RegExp.$2;
    else
        strWindowName += "Unknown";
    OpenWindow(oAnchor, strWindowName, 540, 410);
}

function OpenArticle2(oAnchor)
{
    var strWindowName = "Article";
    var oRegExp = new RegExp("Clanek.asp?articleId=([0-9]+)&articleVersion=([0-9]+)", "i");
    if (oRegExp.exec(oAnchor.href) != null)
        strWindowName += "Id" + RegExp.$1 + "Version" + RegExp.$2;
    else
        strWindowName += "Unknown";
    OpenWindow(oAnchor, strWindowName, 645, 500);
}

function OpenArticle_withNavigate(oAnchor)
{
    var strWindowName = "Articles";
    var oRegExp = new RegExp("([0-9]{8})-([0-9]{2})\\.(html|asp)", "i");
    if (oRegExp.exec(oAnchor.href) != null)
        strWindowName += RegExp.$1 + RegExp.$2;
    else
        strWindowName += "Unknown";
    OpenWindow_withNavigate(oAnchor, strWindowName, 540, 410);
}

function OpenWeekComment(oAnchor)
{
    var strWindowName = "WeekComment";
    var oRegExp = new RegExp("TydeniKomentar\\.asp\\?week=([0-9]{4}w[0-9]{2})$", "i");
    if (oRegExp.exec(oAnchor.href) != null)
        strWindowName += RegExp.$1;
    else
        strWindowName += "Unknown";
    OpenWindow(oAnchor, strWindowName, 540, 410);
}

function OpenPortfolio(oAnchor)
{
    var strWindowName = "PortfolioPT" + oAnchor.href.substr(oAnchor.href.length - 13, 8);  // jmeno okna ve tvaru "PortfolioPTyyyymmdd"
    OpenWindow(oAnchor, strWindowName, 625, 420);
}

function OpenMonthComment(oAnchor)
{
    var strWindowName = "MonthComment";
    var oRegExp = new RegExp("Komentar\\.asp\\?fond=([a-z]+)&mesic=([0-9]{6})$", "i");
    if (oRegExp.exec(oAnchor.href) != null)
        strWindowName += RegExp.$1 + RegExp.$2;
    else
        strWindowName += "Unknown";
    OpenWindow(oAnchor, strWindowName, 540, 410);
}

function OpenDownload(oAnchor)
{
    var oNewWindow = window.open(oAnchor.href, "SecureDownload", "directories=no,location=no,menubar=no,status=no,toolbar=no,scrollbars=no,resizable=no,width=430,height=260");
    if (oNewWindow != null)
        oNewWindow.focus();
}

function OpenQuickPrices(oAnchor)
{
    var oNewWindow = window.open(oAnchor.href, "QuickPricesSetup", "directories=no,location=no,menubar=no,status=no,toolbar=no,scrollbars=no,resizable=no,width=400,height=450");
    if (oNewWindow != null)
        oNewWindow.focus();
}

function OpenPriceInfoWizard(oAnchor)
{
    var oNewWindow = window.open(oAnchor.href, "PriceInfoWizard", "directories=no,location=no,menubar=no,status=no,toolbar=no,scrollbars=no,resizable=no,width=640,height=467");
    if (oNewWindow != null)
        oNewWindow.focus();
}

function OpenEditor(strUrl)
{
    var oNewWindow = window.open(strUrl, "HtmlEditor", "directories=no,location=no,menubar=no,status=no,toolbar=no,scrollbars=no,resizable=no,width=650,height=540");
    if (oNewWindow != null)
        oNewWindow.focus();
}

function OpenPioneerFundGraph(strHref)
{
    var oNewWindow = window.open(strHref, "PioneerFundGraph", "directories=no,location=no,menubar=no,status=no,toolbar=no,scrollbars=no,resizable=no,width=750,height=440");
    if (oNewWindow != null)
        oNewWindow.focus();
}
