 // AJAX
Object.Extend = function(sub,parent){
    sub.prototype = new parent;        
}
function AjaxRequest(){}; 
AjaxRequest.prototype.invoke=function(method, data, callback) {
        if (this.initialize != null) this.initialize();
        var async = (callback != null);         
        var json = $.toJSON(data);        
        var sendData = "method="+method+"&param="+json
        
        if(async) {
            $.ajax({
                type: "POST",
                url: this.url,
                data: sendData,
                success:  function(re){
                    if (callback != null)
                        callback(eval("("+re + ")"));
                }
            });
           
        }else
        {
            var re = $.ajax({
                type: "POST",
                url: this.url,
                data: sendData,
                async: false
            }).responseText;
            return eval("("+re + ")");
        }
    }