//
//  JavaScript for Activities
//

jQuery(document).ready(function() {
    //hide detailed event info on pageload
    jQuery('.activity-description').hide();
    jQuery('#activityDetails').show();

    jQuery('.activity').hover(function(event) {    
        //Associate the clicked Event's ID with the data box and display
        var id = jQuery(this).attr('id') + '-description';             
        var description = jQuery('#' + id).html();
        jQuery('#activityDetailsView').html(description);

        //Display title of activity in heading
        var titleId = jQuery(this).attr('id') + '-title';
        var titleContent = jQuery('#' + titleId).text();
        jQuery('#activityDetailsTitle').html(titleContent);
        
    }, function() {});    //empty function as hover function takes two arguments


    //displayRandomActivitiesQuote();
});

/**
 * displays a random quote from the array
 */
function displayRandomActivitiesQuote() {

  var quotes = [
    {'program':'Hibernation to 5K', 'quote':'"I have already told many people about this program and it’s more than worth the fee paid."'}
  ];

  var randomNumber = Math.floor(Math.random()*quotes.length);
  var quote = quotes[randomNumber];

  jQuery('#activityQuote').html(quote.quote);
  jQuery('#activityQuoteFooter').html(' - ' + quote.program);
}

