// changes page in CompanyViews (by company or analyst menu) or in SectorViews
function changePage(subPage, menuName, cvAspId, action) {
    if(subPage == null || subPage == "") {
        subPage = "overview";
    }
    if(cvAspId == null || cvAspId == "") {
        cvAspId = "-1";
    }
    eval("var parameters = document.menuForm." + menuName + ".value");
    var targetPage = "";
    // target page is action
    if(action != null) {
        targetPage = action + ".action?fid=" + parameters + "&page=" + subPage +"&cvAspId=" + cvAspId;
    } else {
        // normal page with ids and sub page name
        targetPage = "/jsp/displayPage.jsp?fid=" + parameters + "&page=" + subPage +"&cvAspId=" + cvAspId;
    }
    window.location = targetPage;
}

// changes Recommendations page
function changeRecommendationsPage() {
    var aspId = document.menuForm.asps.value;
    window.location = "Recommendations.action?acAspId=" + aspId;
}

// changes Recommendations page
function changeGraphsCollectionPage(setNo, companyPageNo) {
    var aspId = document.menuForm.asps.value;
    window.location = "GraphCollections.action?setNo=" + setNo + "&companyPageNo=" + companyPageNo + "&acAspId=" + aspId;
}

// opens points window (give points or info)
function openPointsWin(page) {
    if(page == null) {
        page = '/PointsInfo.action';
    }
    window.open(page, 'Help', 'height=550, width=550, scrollbars=yes, resizable=no');
}

// opens consensus parameter info window
function openConsensusParamWin(varname, pos, fid, aid) {  
    var page = "/ConsensusParameterInfo.action?varname=" + varname + "&pos=" + pos + "&fid=" + fid + "&a=" + aid;
    window.open(page, 'ConsensusParameterInfo', 'height=550, width=500, scrollbars=yes, resizable=no');
}
// open brief news window
function openNewsInNewWindow(newsId) {
    window.open('/jsp/briefNewsWindow.jsp?newsId=' + newsId, 'Brief_News',
        'width=500,height=500,scrollbars=yes,resizable=yes');
}

// open comment window
function openCommentInNewWindow(researchLibId) {
    window.open('/Comment.action?researchLibId=' + researchLibId + '&popup=true', 'Comment',
        'width=500,height=500,scrollbars=yes,resizable=yes');
}