/**
 * Rivet Software Inc.
 *
 * @copyright Copyright � 2006-2007 Rivet Software, Inc. All rights reserved.
 *
 */

function hideDiv(objId) {
    document.getElementById(objId).style.display = "none";
}

function showDiv(objId) {
    document.getElementById(objId).style.display = "block";
}

function export_report( url ){
    //find active tab
    var div = Tabs.getActiveTabDiv();
    div = Tabs.getChildWithClass( div, 'ReportWrapper' );

    var rows, myRow, cells;
    var tables = div.getElementsByTagName( 'table' );
    var tablesTooBig = '';
    var tablesTooBigCnt = 0;

    for( var tableIdx = 0; tableIdx < tables.length; tableIdx++ ){
        rows = tables[tableIdx].getElementsByTagName( 'tr' );

        myRow = rows[ Math.min( 2, rows.length ) ];
        cells = myRow.getElementsByTagName( 'td' );

        if( cells.length > 254 ){
            tablesTooBigCnt++;
            tablesTooBig += tableIdx + 1 + ', ';
        }
    }

    if( tablesTooBigCnt > 0 ){
        tablesTooBig = tablesTooBig.substr( 0, tablesTooBig.length - 2 );
        var reports = tablesTooBigCnt != 1 ? 'Reports ' : 'Report ';
        var have = tablesTooBigCnt != 1 ? 'have' : 'has';

        alert("Please Note:\n" +
            reports + tablesTooBig + " (in order) " + have + " too many columns (>255).\n" +
            "This is only supported by Excel 2007."
        );
    }

    window.location = url;
}

function print_report(accNumber, xmlFile, reportType) {
    window.open('/xfilings/printreport/?a=' + accNumber + '&f=' + xmlFile + '&t=' + reportType);
}

function print_comparison_report(acc1, acc1Xml, acc2, acc2Xml) {
    window.open('/xfilings/printreport/?acc1=' + acc1 + '&acc1Xml=' + acc1Xml + '&acc2=' + acc2 + '&acc2Xml=' + acc2Xml + '&f=&t=CustomComparison');
}
