$(document).ready(function() {
    var news = $('.NewsEventsSwitcher .news .tabContainer');
    var events = $('.NewsEventsSwitcher .events .tabContainer');

    // For each time the page loads, there should be a 50% chance the News tab is shown, and 50% chance the Events tab is shown.
    var showEventsTab = (Math.random() >= 0.5);   

    if (showEventsTab && showEventsTab == true) {
        // Hide the News Tab
        $('.NewsEventsSwitcher .news').addClass(' disabled');
    }
    else {
        // Hide the Events Tab
        $('.NewsEventsSwitcher .events').addClass(' disabled');
    }

    // Add the click handlers to hide the other tab when a tab is clicked.
    events.click(function() {
        $('.NewsEventsSwitcher .events').removeClass(' disabled');
        $('.NewsEventsSwitcher .news').addClass(' disabled');
        $('.NewsEventsSwitcher').attr('style', 'background-position: right top');
    });

    news.click(function() {
        $('.NewsEventsSwitcher .news').removeClass(' disabled');
        $('.NewsEventsSwitcher .events').addClass(' disabled');
        $('.NewsEventsSwitcher').attr('style', 'background-position: left top');
    });
});

