Fix document copying

To COPY a doc the client must specify the target doc id in Destination
header. Additionally, it may add the revision parameter if document
already exists and we want to copy over it.
diff --git a/jquery.couch.js b/jquery.couch.js
index a46e05d..f368b2a 100644
--- a/jquery.couch.js
+++ b/jquery.couch.js
@@ -736,6 +736,16 @@
          */
         copyDoc: function(docId, options, ajaxOptions) {
           ajaxOptions = $.extend(ajaxOptions, {
+            beforeSend: function(XMLHttpRequest) {
+              if (!options || !options.docid) {
+                  throw "Target docid required";
+              }
+              var header = options.docid;
+              if (options.rev) {
+                  header += '?rev=' + options.rev
+              }
+              XMLHttpRequest.setRequestHeader("Destination", header);
+            },
             complete: function(req) {
               var resp = $.parseJSON(req.responseText);
               if (req.status == 201) {