var videoMediaId = 0;

function limelightPlayerCallback (playerId, eventName, data)
{ 
  switch(eventName)
  {
    case 'onPlayerLoad':
      LimelightPlayer.doLoadMedia(videoMediaId);
      break;
  }
}

$(document).ready(function() {
  addVideoClickHandler();
  addCloseVideoClickHandler(); 
});

function addVideoClickHandler() {
  $(".llnw-video").click(function(e){
    e.preventDefault();
    $(".video-modal").show();
    videoMediaId = $(this).data('media');
    LimelightPlayer.doLoadMedia(videoMediaId, true, 0);
  });
}

function addCloseVideoClickHandler() {
  $('.video-modal').click(function() {
    LimelightPlayer.doPause();
    $('.video-modal').hide();
  });
  
  $('.video-modal-content').click(function(e) {
    e.stopPropagation();
  });
}
