/**
 * Configs the document
 */
window.onload = function ()
{
    // color alternate table rows
    docs_colorAlternateTableRows();
}

/**
 *  Colors alternate rows of marked tables
 */
function docs_colorAlternateTableRows()
{
    // stripe table rows
    var body    = document.body;
    var tables  = body.getElementsByTagName('table');

    // by table
    var bAlternateOdd = true;
    for (var i = 0; i < tables.length; i++)
    {
        // if it has an alternate class
        var table = tables[i];
        if (table.className == "nocolor") continue;
        
        // alternate row colors
        var trs = table.rows;
        for (var j = 1; j < trs.length; j++)
        {
            // row
            var row = trs[j];
            var bOdd = (j % 2 == 1);
            
            // if its a group and even, swap to alternate odd
            if (row.className == "grp")
            {
                bAlternateOdd = !bOdd;
                continue;
            }
            // add class to alternate rows
            if (bAlternateOdd)
            {
                if (j % 2 == 1) row.className = "alternate";
            }
            else
            {
                if (j % 2 == 0) row.className = "alternate";
            }
        }
    }
}

