/*
 * In this file, the events from presenter iframe are recieved and
 * these events are send to the audience frame.
 */

window.onload = function() {

  var presenter = document.getElementById('presenter');
  var audience = document.getElementById('audience');

  this.Webcast = function(){};

  this.Webcast.RecieveProgress = function(step, slide, playPrevious) {

    audience.contentWindow.GotoStep (step, slide, playPrevious);
  };
  /*
  Recieves the content height from the player.js file.
   */
  this.SetFrameHeight = function (height) {
    frameHeight = height;
  };
  /*
    Adjust the height of iframe as the content resizes
   */
  var frameHeight = 661;
  setInterval(function () {
    var iframes = document.getElementsByTagName('iframe');
    for (var iframeIndex = 0; iframeIndex < iframes.length; iframeIndex++) {
      iframes[iframeIndex].style.height = frameHeight + 'px';
    }
  }, 300);

  presenter.src = "presenter.html";
  audience.src  = "audience.html";
};
