/*
Script: mooflXHR adapter
License:
	GPLv3  (http://www.gnu.org/licenses/gpl-3.0.txt)
Copyright:
	MaXPert [Zohaib Sibt-e-Hassan] (http://www.gnu.org/licenses/gpl-3.0.txt)
*/
var mooflXHR = new Class(
{
	Extends: Request,

	initialize: function(options){
		var flXOpts = $extend(options.XDomain || {}, {
								instancePooling: true,
								autoUpdatePlayer: true,
							});
		this.xhr = new flensed.flXHR(flXOpts);
		this.options.headers = {};
		this.setOptions(options);
		this.options.isSuccess = this.options.isSuccess || this.isSuccess;
		this.headers = new Hash(this.options.headers);
	}
	
	
}
);

mooflXHR.JSON = new Class({

	Extends: mooflXHR,

	options: {
		secure: true
	},

	initialize: function(options){
		this.parent(options);
	},

	success: function(text){
		this.response.json = JSON.decode(text, this.options.secure);
		this.onSuccess(this.response.json, text);
	}

});