/**
 * @package JLive! Chat
 * @version 4.1.1
 * @copyright (C) Copyright 2008-2010 CMS Fruit, CMSFruit.com. All rights reserved.
 * @license GNU/LGPL http://www.gnu.org/licenses/lgpl-3.0.txt

 This program is free software; you can redistribute it and/or modify
 it under the terms of the GNU Lesser General Public License as published by
 the Free Software Foundation; either version 3 of the License, or (at your
 option) any later version.

 This program is distributed in the hope that it will be useful, but
 WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
 or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
 License for more details.

 You should have received a copy of the GNU Lesser General Public License
 along with this program.  If not, see http://www.gnu.org/licenses/.
 */

var jlcRemoteXHR = {
    ajaxInitialized: false,
    hostedModeUri:null,
    jsLoaded: false,
    
    init: function () {
	if(!this.ajaxInitialized) {
	    this.ajaxInitialized = true;
	    
	    jQuery.flXHRproxy.registerOptions(this.hostedModeUri+'/',{xmlResponseText:false, instancePooling:false, autoUpdatePlayer:true});
	}
    }
}

function jlcRemotePost(handlerUri, postData, successCallback) {
    jQuery.ajaxSetup({
	transport:'flXHRproxy',
	error: function (XHRobj,errtype,errObj) {
	    alert("Error: "+errObj.number
		    +"\nType: "+errObj.name
		    +"\nDescription: "+errObj.description
		    +"\nSource Object Id: "+errObj.srcElement.instanceId
	    );
	}
    });
			    
    var request = jQuery.ajax({
				url: handlerUri,
				success: successCallback,
				dataType: "json",
				typeString: 'POST',
				cache: false,
				data: postData
			    });
		    
    return request;
}

