   /*

   Javascript interface between client and server

   */

   function Server() {

      if (typeof ActiveXObject == 'function') {
         this.http = new ActiveXObject("Microsoft.XMLHTTP");
      } else {
         this.http = new XMLHttpRequest;
      }

      if (typeof(server_initialised) == 'undefined') {
         server_initialised = true;

         Server.prototype.get = _get;
         Server.prototype.send = _send;
         //Server.prototype.postURL = _postURL_Moz;
      }


      function _get(url, callback) {
         this.http.Open("GET", url, false);
         this.http.Send('');
         callback(this.http.responseText);
      }

      function _send(url, postdata) {
         var poststring = '';
         if(typeof postdata == 'object') {
            for(var item in postdata)
            poststring += (poststring.length > 0 ? '&' : '') + escape(item) + '=' + escape(postdata[item]);
         }
         else
         poststring = postdata;

         this.http.open("POST", url, false);
         this.http.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
         this.http.send(poststring);
         return this.http.responseText;
      }

   }
