//
//  JavaScript for Activities
//

$(document).ready(function() {
    //hide detailed event info on pageload
    $('.activity-description').hide();
    $('#activityDetails').show();

    $('.activity').hover(function(event) {    
        //Associate the clicked Event's ID with the data box and display
        var id = $(this).attr('id') + '-description';             
        $('#' + id).fadeIn('fast');

        //Display title of activity in heading
        var titleId = $(this).attr('id') + '-title';
        var titleContent = $('#' + titleId).text();
        $('#activityDetailsTitle').html(titleContent);
        
        //hide any other open events
        //(e.g. only display one event details at a time)
        $('#' + id).siblings('div:visible').toggle();        
        console.log($('#' + id).siblings());

        // clear other selected Events
        $('.activity').removeClass('selectedEvent');

        // indicate this is the selected Event
        //$(this).toggleClass('selectedEvent');

    }, function() {});    //empty function as hover function takes two arguments
});
