$(document).ready( function() {
  $.btWebcastTile.updateTileDetail();
  $.btWebcastTile.updateTileHeight();
});

( function($) { // hide the jquery namespace and make it compatible with other
  // libs

  function btWebcastTile() {

  }

  $.extend(btWebcastTile.prototype, {
    updateTileHeight : function() {
      var max_height = 160;
      var flag = 0;
      $(".webcast-tile-container-recorded").each( function(i) {
        var elem = $(this);
        var height = elem.height();
        if (height > max_height) {
          max_height = height;
        }
        flag = 1;
      });
      $(".webcast-tile-container").each( function(i) {
        var elem = $(this);
        var height = elem.height();
        if (height > max_height) {
          max_height = height;
        }
        flag = 1;
      });
      if (flag) {
        $(".webcast-tile-container-recorded").height(max_height);
      }
      // UPCOMMING TILE
    $(".webcast-tile-container").each( function(i) {
      var elem = $(this);
      elem.height(max_height);
    });
  },

  updateTileDetail : function() {
    var max_height = 112;
    var flag = 0;
    $(".webcast-tile-details").each( function(i) {
      var elem = $(this);
      var height = elem.height();
      if (height > max_height) {
        max_height = height;
      }
      flag = 1;
    });
    if (flag) {
      $(".webcast-tile-details").height(max_height);
    }
  }
  });
  $.btWebcastTile = new btWebcastTile();
})(jQuery);
