var showHighlightsInd	= false;

var highlightBtnSet	= 	'<div style="margin-top: 8px;"><input id="showHighlights" type="checkbox"/><label for="showHighlights"><span id="showHighlightsText">Show Highlights</span></label></div>';

$(document).ready( function () {
  $('<div id="loading">Loading...</div>')
    .insertBefore('#scores')
    .ajaxStart(function() {
      $(this).show();
    }).ajaxStop(function() {

		if ( !showHighlightsInd ) {
			$('.game-highlights').toggle();
		}

		$(this).hide();
    });
	
    $('.scoreboard-date-chooser a').click( function() {
        $('.scoreboard-date-chooser a').removeClass( 'dc-selected' );
        var scoresDiv = $('#scores');
        scoresDiv.empty();
        scoresDiv.load( $(this).attr('href') );
        $(this).addClass( 'dc-selected' );
		return false;
    });

	$(highlightBtnSet).insertBefore('#scores');
	var showH	= $('#showHighlights');
	showH.button();
	showH.click( function() {
		$('.game-highlights').slideToggle();
		showHighlightsInd	= !showHighlightsInd;
		
		if ( showHighlightsInd ) {
			$('#showHighlightsText').html( 'Hide Highlights' );
		} else {
			$('#showHighlightsText').html( 'Show Highlights' );
		}
		
		});

	$('.game-highlights').hide();

});


