(function () {

var EventCalendarDemo = function () {
  var B = Buttress;
  var oCal;

  return {
    cal: null,
    run: function () {
      oCal = new B.widget.EventCalendar({
        security: { mode: 'user' },

        container: 'ec-cal-container',

        addEventBtn: 'ec-admin-addevent',
        previousMonthBtn: 'ec-page-nav-previous',
        nextMonthBtn: 'ec-page-nav-next'
      });
      this.cal = oCal;
      oCal.render();
      oCal.load();
    }
  };
}();

Buttress.register('ecdemo', EventCalendarDemo);

YAHOO.util.Event.onDOMReady(function() {
  try {
    EventCalendarDemo.run();
  }
  catch (e) {
    var msg = '';
    msg += "I'm sorry, but there has been an internal error:\n\n";
    msg += e.message + "\n\n";
    msg += "in file " + e.fileName + " (" + e.lineNumber + ")";
    alert(msg);
  }
});

})();
