
var Dialogue = Class.create( {

  initialize: function(dialogue_container_element, dialogue_element) {
    this.dialogue_container_element = dialogue_container_element;
    this.dialogue_element = dialogue_element;
    this.x = 0;
    this.y = 0;
    this.open_effect = 'SlideDown';
    this.open_effect = 'SlideUp';  
  },

  open:  function(content_url, x, y) {
    if (x != null) this.x = x;
    if (y != null) this.y = y;
    
    
    $(this.dialogue_container_element).setStyle({ top: this.y+'px', left: this.x+'px' });
    
    el = this.dialogue_container_element;
    
    new Ajax.Updater($(this.dialogue_element), content_url, {
      method: 'get',
//      onComplete: function(transport) { Effect.SlideDown(el, { duration: 0.5 }) }
      onComplete: function(transport) { Effect.Appear(el, { duration: 0.5 }) }
    });
  },
  
  close: function(cleanup) {

    Effect.Fade('dialogue_container', 
      {
        duration: 0.5,
        afterFinish: function() {
          $('dialogue_body').update('<br />');
          // return menu to off state
          // UserClipboard.change_menu_btn(menu, 'out', true);
          cleanup();
        }
      }
    );

  },
  
  visible: function() {
    return $(this.dialogue_container_element).visible();
  }

});