<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array">
    <added>
      <filename>test/draggable_ajax.haml</filename>
    </added>
  </added>
  <modified type="array">
    <modified>
      <diff>@@ -132,18 +132,21 @@ Popup.AbstractWindow = Class.create({
   },
   
   makeDraggable: function() {
-    new Draggable(this.element.identify(), {handle: 'h3.title', scroll: window});
+    if (!this.draggable) {
+      console.log('making draggable');
+      this.draggable = new Draggable(this.element.identify(), {handle: 'h3.title', scroll: window});
+    }
   },
   
   show: function() {
     this.beforeShow();
-    if (this.element.down('.popup.draggable')) this.makeDraggable();
     this.element.show();
     this.afterShow();
   },
   
   hide: function() {
     this.element.hide();
+    this.draggable.destroy();
   },
   
   toggle: function() {
@@ -174,6 +177,7 @@ Popup.AbstractWindow = Class.create({
   },
   
   afterShow: function() {
+    if (this.element.down('.popup.draggable')) this.makeDraggable();
     this.focus();
   },
 </diff>
      <filename>javascripts/popup.js</filename>
    </modified>
    <modified>
      <diff>@@ -1,5 +1,5 @@
 .popup#just_a_test
-  %h3 AJAX Popup
+  %h3.title AJAX Popup
   .popup_content
     %p Hello from the AJAX world!
     %p</diff>
      <filename>test/ajax.haml</filename>
    </modified>
    <modified>
      <diff>@@ -25,6 +25,9 @@
     %p
       %a.popup{:href=&gt;&quot;#dragme&quot;} Draggable
     
+    %p
+      %a.popup{:href=&gt;&quot;/test/draggable_ajax.haml&quot;} Draggable Ajax Popup
+    
     .popup#test{:style=&gt;&quot;display: none&quot;}
       %h3.title Popup Window
       .popup_content</diff>
      <filename>test/index.haml</filename>
    </modified>
  </modified>
  <removed type="array"/>
  <parents type="array">
    <parent>
      <id>a588c4da6685a2bed0dd5ddb739a9f54b444bacf</id>
    </parent>
  </parents>
  <author>
    <name>John W. Long</name>
    <email>me@johnwlong.com</email>
  </author>
  <url>http://github.com/jlong/popupjs/commit/6ca188091d09b16c9e58d050f621d82708fa4324</url>
  <id>6ca188091d09b16c9e58d050f621d82708fa4324</id>
  <committed-date>2008-07-09T19:26:33-07:00</committed-date>
  <authored-date>2008-07-09T19:26:33-07:00</authored-date>
  <message>more draggable tweaks</message>
  <tree>09d75e158f94cdfcfbcb0b4782159fca637d7456</tree>
  <committer>
    <name>John W. Long</name>
    <email>me@johnwlong.com</email>
  </committer>
</commit>
