(function (context, $) {

  "use strict";

  context.JK = context.JK || {};

  context.JK.SignupDialog = function (app) {
    var logger = context.JK.logger;
    var rest = context.JK.Rest();
    var dialogId = '#signup-dialog';
    var $dialog = null;
    var signupHelper = null;
    var EVENTS = context.JK.EVENTS;

    function beforeShow() {
    }

    function afterHide() {
    }

    function initialize() {

      var dialogBindings = {
        'beforeShow': beforeShow,
        'afterHide': afterHide
      };

      app.bindDialog('signup-dialog', dialogBindings);

      $dialog = $(dialogId);

      signupHelper = new context.JK.SignupHelper(app);
      $(signupHelper).on(EVENTS.SHOW_SIGNIN, function () {
        app.layout.closeDialog('signup-dialog')
        app.layout.showDialog('signin-dialog')
      })
      signupHelper.initialize($dialog);
    }

    this.initialize = initialize;

  }
})(window, jQuery);