	function AJAX(url) {
	  this.url=url
	}
	
	var ajax=new AJAX(AjaxServerUrl);
  
	AJAX.prototype.execCall=function (command,params,sobj,callback) {
	  try {
  	  var ajax = this.getAJAXobject()
      ajax.open('POST', this.url, true);
  	  var code=Math.random()
  	  ajax.onreadystatechange = function() { 
  	      try
  	      {
             if (ajax.readyState == 4) 
             {
               if (ajax.status == 200)
               {
                 if (callback!=null) {      
                   var response = ajax.responseText.parseJSON()
                   if (response==null)
                   {
                     callback(command,null,sobj,response)
                     return false
                   }
                   callback(command,response.status,sobj,response.result)   
                 }           
               }	  
    	      };	
  	      }
  	      catch (e)
  	      {
  	      }
  	  }
	    var data=new Object();
      data.command=command
      data.request=params
	 //   var p='data='+encodeURI(data.toJSONString())
	    var p='data='+escape(data.toJSONString())   
      ajax.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
      ajax.setRequestHeader("Content-length", p.length);
      ajax.setRequestHeader("Connection", "close");	    
      ajax.send(p);	 
    } catch (e)
    {
      alert (e)
    } 
	}
	
	 AJAX.prototype.getAJAXobject=function() {
      var ajax=null
      if (window.XMLHttpRequest) {
          ajax = new XMLHttpRequest();
      } else if (window.ActiveXObject) {
          try {
              ajax = new ActiveXObject("Msxml2.XMLHTTP");
          } catch (e) {
              try {
                  ajax = new ActiveXObject("Microsoft.XMLHTTP");
              } catch (e) {}
          }
      }	  
      return ajax
	}

// ---------------------

Array.prototype.toJSONString = function () {
    var a = ['['], b, i, l = this.length, v;
    for (i = 0; i < l; i += 1) {
        v = this[i];
        switch (typeof v) {
        case 'undefined':
        case 'function':
        case 'unknown':
            break;
        default:
            if (b) {
                a.push(',');
            }
            a.push(v === null ? "null" : v.toJSONString());
            b = true;
        }
    }
    if (a.length==1)
    {
      var x = ['{'], b, i, v;
      for (i in this) {
          if (this.hasOwnProperty(i)) {
              v = this[i];
              switch (typeof v) {
              case 'undefined':
              case 'function':
              case 'unknown':
                  break;
              default:
                  if (b) {
                      x.push(',');
                  }
                  x.push(i.toJSONString(), ':',
                          v === null ? "null" : v.toJSONString());
                  b = true;
              }
          }
      }
      x.push('}');
      if (x.length>1) return x.join('');
    }
    a.push(']');
    return a.join('');    
};

Boolean.prototype.toJSONString = function () {
    return String(this);
};

Date.prototype.toJSONString = function () {

    function f(n) {
        return n < 10 ? '0' + n : n;
    }

    return '"' + this.getFullYear() + '-' +
            f(this.getMonth() + 1) + '-' +
            f(this.getDate()) + 'T' +
            f(this.getHours()) + ':' +
            f(this.getMinutes()) + ':' +
            f(this.getSeconds()) + '"';
};

Number.prototype.toJSONString = function () {
    return isFinite(this) ? String(this) : "null";
};

Object.prototype.toJSONString = function () {
    var a = ['{'], b, i, v;
    for (i in this) {
        if (this.hasOwnProperty(i)) {
            v = this[i];
            switch (typeof v) {
            case 'undefined':
            case 'function':
            case 'unknown':
                break;
            default:
                if (b) {
                    a.push(',');
                }
                a.push(i.toJSONString(), ':',
                        v === null ? "null" : v.toJSONString());
                b = true;
            }
        }
    }
    a.push('}');
    return a.join('');
};

String.prototype.parseJSON = function () {
    try {
        if (/^("(\\.|[^"\\\n\r])*?"|[,:{}\[\]0-9.\-+Eaeflnr-u \n\r\t])+?$/.test(this)) {
            return eval('(' + this + ')');
        }
    } catch (e) {
    }
    return null;
};

(function () {
    var m = {
        '\b': '\\b',
        '\t': '\\t',
        '\n': '\\n',
        '\f': '\\f',
        '\r': '\\r',
        '"' : '\\"',
        '\\': '\\\\'
    };

    String.prototype.toJSONString = function () {  
        var r=''  
        for (var i=0;i<this.length;i++)
        {
          if (m[this.charAt(i)]!=null)
          {
            r+=m[this.charAt(i)]
          } else
          {
            var c=this.charCodeAt(i)         
            if (c<32||c>127)
            {
              var code=c.toString(16)
              r+='\\u'+'00'.substring(0,4-code.length)+code
            } else r+=this.charAt(i)
          }         
        }                
        return '"' + r + '"';
    };

})();
