var CURRENT_SAVE_STATUS = "";

function PrefCurrencies()
{
	this.savePrefCurrencies = savePrefCurrencies;
	this.processFailure = processFailure;
	this.processComplete = processComplete;
	this.processException = processException;
	this.processCurrencyPrefChange = processCurrencyPrefChange;
}

function savePrefCurrencies(prefCurrency)
{
	logToWindow("savePrefCurrencies - started to save currency string: " + prefCurrency);
	var requestString ="/bzJApp/SavePreferredCurrencies.action?sid=100&tid=100&prefCurrency="+prefCurrency;
	$.ajax(
	{	url: requestString,
		success: this.processCurrencyPrefChange, 
		error : this.processFailure, 
		complete : this.processComplete
	});	
}

function processFailure(XMLHttpRequest, textStatus, errorThrown) {
	logToWindow("processFailure - failed. " + textStatus);
	$('#currencySaveStatDiv').html('<span>Save failed.<br />Please try again.<br /></span>'); 
	if (errorThrown != null)
	{
		processException(XMLHttpRequest, errorThrown);
	}
}//END: processFailure

function processComplete(XMLHttpRequest, textStatus) {
	logToWindow("processComplete - complete.");
}//END: processComplete

function processException(Req, Ex1) {
	logToWindow("processException - execption " + Ex1);
}//END: processException

function processCurrencyPrefChange(data, textStatus, XMLHttpRequest)
{
	logToWindow("processCurrencyPrefChange - successful. transport status: " + textStatus);
	$('#currencySaveStatDiv').html('<span>Currencies saved.<br />Refresh to see<br />your new setup.</span>'); 
}
