$(document).ready(function() {

    // Set current navigation 
    var path = window.location.pathname;
    var fileName = path.substring(path.lastIndexOf('/') + 1).toLowerCase();
    var navCurrent = "";
    switch (fileName) {
        case "catch-directions.aspx":
            navCurrent = "CatchDirections";
            break;
        case "catch-happy-hour.aspx":
            navCurrent = "CatchHappyHour";
            break;
        case "catch-schedule.aspx":
            navCurrent = "CatchSchedule";
            break;
        case "mahi-directions.aspx":
            navCurrent = "MahiDirections";
            break;
        case "mahi-happy-hour.aspx":
            navCurrent = "MahiHappyHour";
            break;
        case "mahi-schedule.aspx":
            navCurrent = "MahiSchedule";
            break;
    }

    if (navCurrent == "") {
        $("#navMahiHome").hide();
        $("#navCatchHome").hide();
    } else {
        $("#nav" + navCurrent).addClass("current");
    }

    // roll over for footer links
    $('.skybar img').hover(function() {
        $(this).attr('src', 'images/skybarRO.png');
    }, function() {
        $(this).attr('src', 'images/skybar.png');
    });
    $('.summer_concert img').hover(function() {
        $(this).attr('src', 'images/summer_concertRO.png');
    }, function() {
        $(this).attr('src', 'images/summer_concert.png');
    });
    // Printing only the current & future events
    // Define the current date
    var d = new Date();
    var cMonth = d.getMonth();
    var cDay = d.getDate();
    // Display Schedule
    var currentMth = 0;
    for (m = 0; m < cSchedule.length; m++) {
        var aMth = m + 5;
        if (aMth >= cMonth) {
            if (aMth > currentMth) {
                $('#accordion').append('<!-- ' + m_names[aMth] + ' 2010 Event Schedule-->\n');
                $('#accordion').append('<h3><a href="#">' + m_names[aMth] + '</a></h3>\n<div class="' + m_names[aMth] + '">\n<ul>\n');
            }
            for (e = 0; e < cSchedule[m].length; e++) {
                var aEvent = cSchedule[m][e];
                var month = aMth - 5;
                if (aEvent[1] >= cDay || aMth > cMonth) {
                    $('#accordion div.' + m_names[aMth] + ' ul').append('<li class="sched-list"><span class="dow">' + aEvent[0] + ' ' + aEvent[1] + '</span><span class="bandtime">   ' + aEvent[2] + '</span></li>\n');
                }
            }
            $('#accordion').append('</ul>\n</div><!--Event ' + m_names[aMth] + '-->\n');
            currentMth = aMth;
        }
    }
    $('#accordion').accordion({
        collapse: true,
        autoHeight: false
    });

});
