text:     /**
       * Prompt dialog object
       *
       * invoked by:
       *	alertify.prompt(message);
       *	alertify.prompt(message, value);
       *	alertify.prompt(message, value, onok);
       *	alertify.prompt(message, value, onok, oncancel);
       *	alertify.prompt(title, message, value, onok, oncancel);
       */
      alertify.dialog('prompt', function () {
          var input = document.createElement('INPUT');
          var p = document.createElement('P');
          return {
              main: function (_title, _message, _value, _onok, _oncancel) {
                  var title, message, value, onok, oncancel;
                  switch (arguments.length) {
                  case 1:
                      message = _title;
                      break;
                  case 2:
                      message = _title;
                      value = _message;
                      break;
                  case 3:
                      message = _title;
                      value = _message;
                      onok = _value;
                      break;
                  case 4:
                      message = _title;
                      value = _message;
                      onok = _value;
                      oncancel = _onok;
                      break;
                  case 5:
                      title = _title;
                      message = _message;
                      value = _value;
                      onok = _onok;
                      oncancel = _oncancel;
                      break;
                  }
                  this.set('title', title);
                  this.set('message', message);
                  this.set('value', value);
                  this.set('onok', onok);
                  this.set('oncancel', oncancel);
                  return this;
              },
              setup: function () {
                  return {
                      buttons: [
                          {
                              text: alertify.defaults.glossary.ok,
                              key: keys.ENTER,
                              className: alertify.defaults.theme.ok,
                          },
                          {
                              text: alertify.defaults.glossary.cancel,
                              key: keys.ESC,
                              invokeOnClose: true,
                              className: alertify.defaults.theme.cancel,
                          }
                      ],
                      focus: {
                          element: input,
                          select: true
                      },
                      options: {
                          maximizable: false,
                          resizable: false
                      }
                  };
              },
              build: function () {
                  input.className = alertify.defaults.theme.input;
                  input.setAttribute('type', 'text');
                  input.value = this.get('value');
                  this.elements.content.appendChild(p);
                  this.elements.content.appendChild(input);
              },
              prepare: function () {
                  //nothing
              },
              setMessage: function (message) {
                  if (typeof message === 'string') {
                      clearContents(p);
                      p.innerHTML = message;
                  } else if (message instanceof window.HTMLElement && p.firstChild !== message) {
                      clearContents(p);
                      p.appendChild(message);
                  }
              },
              settings: {
                  message: undefined,
                  labels: undefined,
                  onok: undefined,
                  oncancel: undefined,
                  value: '',
                  type:'text',
                  reverseButtons: undefined,
              },
              settingUpdated: function (key, oldValue, newValue) {
                  switch (key) {
                  case 'message':
                      this.setMessage(newValue);
                      break;
                  case 'value':
                      input.value = newValue;
                      break;
                  case 'type':
                      switch (newValue) {
                      case 'text':
                      case 'color':
                      case 'date':
                      case 'datetime-local':
                      case 'email':
                      case 'month':
                      case 'number':
                      case 'password':
                      case 'search':
                      case 'tel':
                      case 'time':
                      case 'week':
                          input.type = newValue;
                          break;
                      default:
                          input.type = 'text';
                          break;
                      }
                      break;
                  case 'labels':
                      if (newValue.ok && this.__internal.buttons[0].element) {
                          this.__internal.buttons[0].element.innerHTML = newValue.ok;
                      }
                      if (newValue.cancel && this.__internal.buttons[1].element) {
                          this.__internal.buttons[1].element.innerHTML = newValue.cancel;
                      }
                      break;
                  case 'reverseButtons':
                      if (newValue === true) {
                          this.elements.buttons.primary.appendChild(this.__internal.buttons[0].element);
                      } else {
                          this.elements.buttons.primary.appendChild(this.__internal.buttons[1].element);
                      }
                      break;
                  }
              },
              callback: function (closeEvent) {
                  var returnValue;
                  switch (closeEvent.index) {
                  case 0:
                      this.settings.value = input.value;
                      if (typeof this.get('onok') === 'function') {
                          returnValue = this.get('onok').call(this, closeEvent, this.settings.value);
                          if (typeof returnValue !== 'undefined') {
                              closeEvent.cancel = !returnValue;
                          }
                      }
                      break;
                  case 1:
                      if (typeof this.get('oncancel') === 'function') {
                          returnValue = this.get('oncancel').call(this, closeEvent);
                          if (typeof returnValue !== 'undefined') {
                              closeEvent.cancel = !returnValue;
                          }
                      }
                      if(!closeEvent.cancel){
                          input.value = this.settings.value;
                      }
                      break;
                  }
              }
          };
      });
  