/*
function changeCol(tab, direction) {
    var args = tab.split(",");
    var category = args[0];
    var dir = args[1];
    
    
    var currTab;
    var lastCol;
    if (dir == "next") {
        currTab = "#" + category + " th.date.show:last";
        if ($(currTab).nextAll('th.date').size() > 0) {
            lastCol = 0;
        } else {
            lastCol = 1;
        }
    } else {
        currTab = "#" + category + " th.date.show:first";
        if ($(currTab).prevAll('th.date').size() > 0) {
            lastCol = 0;
        } else {
            lastCol = 1;
        }
    }
    
    var column = "#" + category +  " [class^=\"col\"].show:first";
    if (!lastCol) {
        var col = parseInt(($(column).attr("class")).charAt(3));
        var columns;
            (dir == "next") ? columns = "#" + category + " .col" + col + ", #" + category + " .col" + (col+3) : columns = "#" + category + " .col" + (col-1) + ", #" + category + " .col" + (col+2);

        $(columns).toggleClass('show');
    }
}
*/

function nextCol(tab) {
    var category = tab.id;
    var column = "#" + category +  " [class^=\"col\"].show:first";
    var currTab;
    var lastCol = 1;    // Initalize state to last column true.
        currTab = "#" + category + " th.date.show:last";
        if ($(currTab).nextAll('th.date').size() > 0) {lastCol = 0;}    // If there is another column set last column to false.

    if (!lastCol) {
        var col = parseInt(($(column).attr("class")).charAt(3));    // Get the column number (only set up to handle columns 0-9).
        var columns;
            columns = "#" + category + " .col" + col + ", #" + category + " .col" + (col+3);

        $(columns).toggleClass('show');
    }
}

function prevCol(tab) {
    var category = tab.id;
    var column = "#" + category +  " [class^=\"col\"].show:first";
    var currTab;
    var lastCol = 1;    // Initalize state to last column true.
        currTab = "#" + category + " th.date.show:first";
        if ($(currTab).prevAll('th.date').size() > 0) {lastCol = 0;}    // If there is another column set last column to false.

    if (!lastCol) {
        var col = parseInt(($(column).attr("class")).charAt(3));    // Get the column number (only set up to handle columns 0-9).
        var columns;
            columns = "#" + category + " .col" + (col-1) + ", #" + category + " .col" + (col+2);

        $(columns).toggleClass('show');
    }
}
