  // Dialogerクラス for ModalBox 1.6.0
  function Dialoger(){
      var ref = this;
      this.timeout = 0 // msec, if 0, do nothing.
      this.timeoutId = null;
      this.disableCache = true;

      this.beforeLoad = null;
      this.afterLoad = null;
      this.afterHide = null;
      this.afterResize = null;
      this.onShow = null;
      this.onUpdate = null;

      // okm append event for timeout
      this.onFail = null;
      this.onTimeout = null;

      this.width = null;
      this.height = null;

      this.overlayClose = false;
      this.overlayOpacity = 0.5;
      this.slideDownDuration = 0.3;

      this.show = function(url, option){
          /** add events **/
          option.beforeLoad = function() {
              if(ref.timeout > 0){
                  ref.timeoutId = window.setTimeout(
                      function() {
                          ref.onTimeoutHandler();
                      },
                      ref.timeout
                  ); // setTimeout
              }
              ref.beforeLoadHandler();
          };

          // dialoger default
          option.overlayOpacity = 0.5;
          option.slideDownDuration = 0.3;

          option.afterLoad = function(){
              window.clearTimeout(ref.timeoutId);
              ref.afterLoadHandler();
          };
          option.afterHide = function(){
              ref.afterHideHandler();
          };
          option.onShow = function(){
              ref.onShowHandler();
          };
          option.onUpdate = function(){
              ref.onUpdateHandler();
          };
          option.onFail = function(){
              ref.onFailHandler();
          }

          if(option.height != undefined){
              ref.height = option.height;
          }
          if(option.width != undefined){
              ref.width = option.width;
          }

          if(option.overlayClose == undefined){
              option.overlayClose = ref.overlayClose;
          }
          if(option.oveelayOpacity == undefined){
              option.overlayOpacity = ref.overlayOpacity;
          }
          if(option.slideDownDuration == undefined){
              option.slideDownDuration = ref.slideDownDuration;
          }

          if(option.method == undefined){
              option.method = "get";
          }

          if(this.disableCache){
              date = new Date();
              if(option.params != null){
                   option.params += "&"; 
              }else{ 
                   option.params = "";
              }
              option.params += "cahce_=" + date.getTime();
          }
          option.autoFocusing = false;
          Modalbox.show(url, option);
      }

      /* Events */
      this.beforeLoadHandler = function(){
	  if(this.beforeLoad) this.beforeLoad();
      }
      this.afterLoadHandler = function(){
	  if(this.afterLoad) this.afterLoad();

      }
      this.afterHideHandler = function(){
	  if(this.afterHide) this.afterHide();
      }
      this.afterResizeHandler = function(){
	  if(this.afterResize) this.afterResize();
      }
      this.onShowHandler = function(){
	  if(this.onShow) this.onShow();
      }
      this.onUpdateHandler = function(){
	  if(this.onUpdate) this.onUpdate();
      }
      this.onFailHandler = function(){
	  if(this.onFail){
              this.onFail();
          }else{
              Modalbox.hide();
          }
      }
      this.onTimeoutHandler = function(){
          window.clearTimeout(this.timeoutId);        
	  if(this.onTimeout){
              this.onTimeout();
          }
      }

      this.activate = function(){
          Modalbox.activate();
      }
      this.deactivate = function(){
          Modalbox.deactivate();
      }
  }





