/**
 * @author syndicat
 * 
 * ARRM => Ajax Request and Result Mananger for Prototype 1.6
 * 
 * Class that will handle all the communication between the server and the frontend
 * ARRM will connect and return the data from the server and pass it on to the supplied Class and Function
 * 
 * Example of ARRM.request 
 * ARRM.request({type: 'Test', method: 'showTest', id: '14', name: 'Prototype'});
 * 
 * @return 'type' and 'method' for determining which class to call and which method to execute 
 */

var ARRM = Class.create({
	initialize:function(url){
		this.url = url;
	},
	jsonRequest: function(params){
		data = "json=" + Object.toJSON(params);
		new Ajax.Request(this.url, { 
			method: 'post',
			postBody: data,
			onComplete: function(transport) {
				var data = transport.responseText.evalJSON(true);
				eval( data.type + '.' + data.method + '(data)' );
			}  
		})
	}
});
//alert('ARRM loaded');
