ActionHandler = new ( Class.create({
    
    initialize : function()
    {
    },
    
    DictionaryConfigs : new Array(),
    
    Handler : function(originalRequest)
    {
        try
        {
            this.responseObject = originalRequest.responseText.evalJSON();
            //alert(originalRequest.responseText);
        }
        catch(exception)
        {
            this.responseObject = originalRequest.responseText;
            alert(originalRequest.responseText);
        }
    },
    
    GetResponse : function(config)
    {
        this.config = config;
        
        if(Object.isUndefined(this.config.parameters))
        {
            this.config.parameters = "";
        }
        
        this.config.handler = this.Handler.bind(this);
        new Ajax.Request(
            this.config.url,
            {
                asynchronous : false,
                method: "post",
                parameters: "action=" + this.config.action + "&" + this.config.parameters,
                onComplete: this.config.handler
            }
        );
        
        // Dictionary
        if(!Object.isUndefined(this.config.isDictionary) && this.config.isDictionary == true)
        {
            var responseDictionary = new Array();
            if(this.responseObject.rows != null)
            {
                for(var i = 0; i < this.responseObject.rows.length; i++)
                {
                    currentRow = this.responseObject.rows[i];
                    responseDictionary[i] = new Object;
                    responseDictionary[i].ValueMember = currentRow.valueMember
                    responseDictionary[i].DisplayMember = currentRow.displayMember;
                }
            }            
            return responseDictionary;
        }
        
        // Non dictionary
        return this.responseObject;
    },
    
    GetDictionary : function(config)
    {
        config.isDictionary = true;
        this.DictionaryConfigs[config.id] = config;
        return this.GetResponse(this.DictionaryConfigs[config.id]);
    },
    
    RefreshDictionary : function(id)
    {
        return this.GetResponse(this.DictionaryConfigs[id]);
    }
}))();
