var controller;

$(document).ready(function() {
  controller = new Controller();

  controller.activatePlayButton();
});

function Controller() {
  
  var $this = this;

  this.player = {};
  this.isPlaying = false;

  this.activatePlayButton = function() {
    $("#watch_trailer_button").click(function() {
      if ($this.isPlaying)
        $this.player.sendEvent("STOP", "true");
      else
        $this.player.sendEvent("PLAY", "true");

      $this.isPlaying = ($this.isPlaying) ? false: true;

      return false;
    });
  }

}

function playerReady(obj) {
  controller.player = document.getElementById(obj.id);
}

