+ });
+
+ // We use ZeroClipboard to copy the URL
+ ZeroClipboard.setMoviePath('{% media '/media/js/ZeroClipboard.swf' %}');
+
+ // Create the Client Clip
+ var clip = new ZeroClipboard.Client();
+
+ // Create the glue when on mouse-over event
+ $('#copy_clip_button').live('mouseover', function() {
+ // Take the URL from the input
+ clip.setText($('#permanent_link_url').val());
+
+ // Create the glue
+ clip.glue('copy_clip_button');
+
+ // Simulate click on the OK button when we hear a moseDown event on the glue
+ clip.addEventListener('mouseDown', function() {
+ $('#copy_clip_button').click();
+ });
+
+ // Reposition the clip
+ clip.addEventListener('complete', function() {
+ clip.reposition();
+ });
+ });
+
+ // Hide the clip if someone clicks on the cancel button
+ $('.dialog-no').live('click', function() {
+ clip.hide();
+ });
+
+});