if (typeof jQuery == 'undefined') throw("jQuery could not be found.");

(function($){

  $.fn.popup_and_send = function(settings){
    var link = this;
    var popup_id = settings.popup_id;
    var popup = $(popup_id);
    var popup_height = settings.popup_height;
    var popup_width = settings.popup_width;

    // Bind event handlers
    link.click(function() {
      display_popup();
      return false;
    });

    function display_popup(){
      popup.dialog({
        autoOpen:false,
        resizable: false,
        draggable:false,
        modal: true,
        height: popup_height,
        width: popup_width,
        show: 'slide',
        buttons: null
      });
      popup.dialog("open");
    }
    return this;
  };
  })(jQuery);