
/**
 * Provides a base object to extend that provides an adapter around Prototype's ajax methods.
 * A class extending this one should define a local 'ajaxBase' property which contains the 
 * url of the target ajax service
 */
C.BaseAjax = Class.create({
	
	/**
	 * @param cfg directly passed to Prototype's Ajax.Request method, should provide 
	 *    a onSuccess callback if needed
	 *
	 * @param params object of key-values converted to querystring when querying ajax service
	 *
	 */
	doAjax : function( cfg, params )
	{
		var url = this.ajaxBase;
		if ( params ) url += "&" + Object.toQueryString(params);
		new Ajax.Request( url, cfg );
	},
	
	evalJSON : function( transport )
	{
		return transport.responseText.evalJSON();	
	}
	
});
