window.Couch = (function() {
  var Couch = {};

  Couch.init = function(host) {
    Couch.host = host;

    var script = document.createElement('script');
    script.src = host + '/couchdb-xd/_design/couchdb-xd/lib/pmdxr-client.js';
    var body = document.getElementsByTagName('body')[0];
    body.appendChild(script);
  };

  Couch.Database = function(name) {
    this.url = Couch.host + '/' + name;
  }

  Couch.Database.prototype.get = function(name, callback) {
    var self = this;
    pmxdr.request({
      uri: self.url + '/' + name,
      callback: function(response) {
        callback(response.data);
      }
    });
  }

  return Couch;
})();
@@ -1,8 +1,411 @@
+/**%0A *---------------------------------------------------------------%0A * CouchDB cross-domain client library%0A *---------------------------------------------------------------%0A *%0A * Example Usage:%0A *  var server = new Couch.Server('http://myserver.com');%0A *  var db = server.getDatabase('test');%0A *  db.get('document-name', function(doc) %7B alert(doc); %7D);%0A *%0A * Copyright Ben Vinegar http://benv.ca%0A */%0A%0A
 window.C
@@ -456,12 +456,14 @@
 uch.
-init
+Server
  = f
@@ -482,21 +482,20 @@
 ) %7B%0A    
-Couch
+this
 .host = 
@@ -719,24 +719,144 @@
 ipt);%0A  %7D;%0A%0A
+  Couch.Server.prototype = %7B%0A    getDatabase: function(name) %7B%0A      return new Couch.Database(this, name);%0A    %7D%0A  %7D;%0A%0A
   Couch.Data
@@ -863,32 +863,40 @@
 base = function(
+server, 
 name) %7B%0A    this
@@ -900,19 +900,42 @@
 his.
-url = Couch
+name = name;%0A    this.url = server
 .hos
@@ -985,14 +985,240 @@
 type
-.get =
+ = %7B%0A    get: function(name, callback) %7B%0A      var self = this;%0A      pmxdr.request(%7B%0A        uri: self.url + '/' + name,%0A        callback: function(response) %7B%0A          callback(response.data);%0A        %7D%0A      %7D);%0A    %7D,%0A%0A    put:
  fun
@@ -1220,32 +1220,38 @@
 : function(name,
+ data,
  callback) %7B%0A   
@@ -1243,24 +1243,26 @@
 callback) %7B%0A
+  
     var self
@@ -1266,24 +1266,26 @@
 elf = this;%0A
+  
     pmxdr.re
@@ -1294,24 +1294,26 @@
 est(%7B%0A      
+  
 uri: self.ur
@@ -1324,24 +1324,85 @@
 '/' + name,%0A
+        method: %22PUT%22,%0A        data: JSON.stringify(data),%0A  
       callba
@@ -1426,32 +1426,34 @@
 onse) %7B%0A        
+  
 callback(respons
@@ -1471,18 +1471,22 @@
     
-%7D%0A
+  %7D%0A  
     %7D);%0A
   %7D%0A
@@ -1481,19 +1481,26 @@
     %7D);%0A
+  
   %7D
+%0A  %7D;
 %0A%0A  retu

PUT document method