var cc_currencies = new Object;
cc_currencies.AUD = {"title":"Australian Dollar",
										"value":"1.40940000",
										"code":"AUD",
										"symbol_left":"AU $",
										"symbol_right":"",
										"decimal_point":".",
										"thousands_point":",",
										"decimal_places":"2"
										};
cc_currencies.BGN = {"title":"Lew",
										"value":"1.95580000",
										"code":"BGN",
										"symbol_left":"",
										"symbol_right":"BGN",
										"decimal_point":",",
										"thousands_point":".",
										"decimal_places":"2"
										};
cc_currencies.CAD = {"title":"Canadian Dollar",
										"value":"1.35610000",
										"code":"CAD",
										"symbol_left":"",
										"symbol_right":"CAD",
										"decimal_point":",",
										"thousands_point":".",
										"decimal_places":"2"
										};
cc_currencies.CHF = {"title":"Schweizer Franken",
										"value":"1.30430000",
										"code":"CHF",
										"symbol_left":"",
										"symbol_right":"CHF",
										"decimal_point":",",
										"thousands_point":".",
										"decimal_places":"2"
										};
cc_currencies.CNY = {"title":"Chinese yuan",
										"value":"8.73200000",
										"code":"CNY",
										"symbol_left":"",
										"symbol_right":"CNY",
										"decimal_point":",",
										"thousands_point":".",
										"decimal_places":"2"
										};
cc_currencies.CYP = {"title":"Cypriot pound",
										"value":"0.58130000",
										"code":"CYP",
										"symbol_left":"",
										"symbol_right":"CYP",
										"decimal_point":",",
										"thousands_point":".",
										"decimal_places":"2"
										};
cc_currencies.CZK = {"title":"Czech koruna",
										"value":"24.69800000",
										"code":"CZK",
										"symbol_left":"",
										"symbol_right":"CZK",
										"decimal_point":",",
										"thousands_point":".",
										"decimal_places":"2"
										};
cc_currencies.DKK = {"title":"Dansk krone",
										"value":"7.44490000",
										"code":"DKK",
										"symbol_left":"",
										"symbol_right":"Kr",
										"decimal_point":",",
										"thousands_point":".",
										"decimal_places":"2"
										};
cc_currencies.EEK = {"title":"Eesti kroon",
										"value":"15.64660000",
										"code":"EEK",
										"symbol_left":"",
										"symbol_right":"EEK",
										"decimal_point":",",
										"thousands_point":".",
										"decimal_places":"2"
										};
cc_currencies.EUR = {"title":"Euro",
										"value":"1.00000000",
										"code":"EUR",
										"symbol_left":"",
										"symbol_right":"&euro;",
										"decimal_point":",",
										"thousands_point":".",
										"decimal_places":"2"
										};
cc_currencies.GBP = {"title":"Pounds",
										"value":"0.83320000",
										"code":"GBP",
										"symbol_left":"&pound;",
										"symbol_right":"",
										"decimal_point":".",
										"thousands_point":",",
										"decimal_places":"2"
										};
cc_currencies.HKD = {"title":"Hong Kong Dollar",
										"value":"9.97450000",
										"code":"HKD",
										"symbol_left":"",
										"symbol_right":"HKD",
										"decimal_point":",",
										"thousands_point":".",
										"decimal_places":"2"
										};
cc_currencies.HRK = {"title":"Kuna",
										"value":"7.28500000",
										"code":"HRK",
										"symbol_left":"",
										"symbol_right":"HRK",
										"decimal_point":",",
										"thousands_point":".",
										"decimal_places":"2"
										};
cc_currencies.HUF = {"title":"Hungarian forint",
										"value":"284.50000000",
										"code":"HUF",
										"symbol_left":"",
										"symbol_right":"HUF",
										"decimal_point":",",
										"thousands_point":".",
										"decimal_places":"2"
										};
cc_currencies.IDR = {"title":"Indonesian rupiah",
										"value":"11553.45000000",
										"code":"IDR",
										"symbol_left":"",
										"symbol_right":"IDR",
										"decimal_point":",",
										"thousands_point":".",
										"decimal_places":"2"
										};
cc_currencies.ISK = {"title":"Icelandic króna",
										"value":"290.00000000",
										"code":"ISK",
										"symbol_left":"",
										"symbol_right":"ISK",
										"decimal_point":",",
										"thousands_point":".",
										"decimal_places":"2"
										};
cc_currencies.JPY = {"title":"Japanese yen",
										"value":"108.38000000",
										"code":"JPY",
										"symbol_left":"Yen",
										"symbol_right":"",
										"decimal_point":",",
										"thousands_point":".",
										"decimal_places":"2"
										};
cc_currencies.KRW = {"title":"South Korean won",
										"value":"1508.06000000",
										"code":"KRW",
										"symbol_left":"",
										"symbol_right":"KRW",
										"decimal_point":",",
										"thousands_point":".",
										"decimal_places":"2"
										};
cc_currencies.LTL = {"title":"Litas",
										"value":"3.45280000",
										"code":"LTL",
										"symbol_left":"",
										"symbol_right":"LTL",
										"decimal_point":",",
										"thousands_point":".",
										"decimal_places":"2"
										};
cc_currencies.LVL = {"title":"Lats",
										"value":"0.70850000",
										"code":"LVL",
										"symbol_left":"",
										"symbol_right":"LVL",
										"decimal_point":",",
										"thousands_point":".",
										"decimal_places":"2"
										};
cc_currencies.MTL = {"title":"Lira Maltija",
										"value":"0.42930000",
										"code":"MTL",
										"symbol_left":"",
										"symbol_right":"MTL",
										"decimal_point":",",
										"thousands_point":".",
										"decimal_places":"2"
										};
cc_currencies.MYR = {"title":"Ringgit",
										"value":"4.00350000",
										"code":"MYR",
										"symbol_left":"",
										"symbol_right":"MYR",
										"decimal_point":",",
										"thousands_point":".",
										"decimal_places":"2"
										};
cc_currencies.NOK = {"title":"Norsk krone",
										"value":"7.88900000",
										"code":"NOK",
										"symbol_left":"",
										"symbol_right":"NOK",
										"decimal_point":",",
										"thousands_point":".",
										"decimal_places":"2"
										};
cc_currencies.NZD = {"title":"New Zealand Dollar",
										"value":"1.79000000",
										"code":"NZD",
										"symbol_left":"",
										"symbol_right":"NZD",
										"decimal_point":"",
										"thousands_point":"",
										"decimal_places":""
										};
cc_currencies.PHP = {"title":"Piso",
										"value":"57.29000000",
										"code":"PHP",
										"symbol_left":"",
										"symbol_right":"PHP",
										"decimal_point":"",
										"thousands_point":"",
										"decimal_places":""
										};
cc_currencies.PLN = {"title":"Zloty",
										"value":"3.95200000",
										"code":"PLN",
										"symbol_left":"",
										"symbol_right":"PLN",
										"decimal_point":",",
										"thousands_point":".",
										"decimal_places":"2"
										};
cc_currencies.RON = {"title":"Romanian leu",
										"value":"4.27950000",
										"code":"RON",
										"symbol_left":"",
										"symbol_right":"RON",
										"decimal_point":",",
										"thousands_point":".",
										"decimal_places":"2"
										};
cc_currencies.RUB = {"title":"Rubel",
										"value":"39.38200000",
										"code":"RUB",
										"symbol_left":"",
										"symbol_right":"RUB",
										"decimal_point":",",
										"thousands_point":".",
										"decimal_places":"2"
										};
cc_currencies.SEK = {"title":"Svensk krona",
										"value":"9.31310000",
										"code":"SEK",
										"symbol_left":"",
										"symbol_right":"SEK",
										"decimal_point":",",
										"thousands_point":".",
										"decimal_places":"2"
										};
cc_currencies.SGD = {"title":"Singapore Dollar",
										"value":"1.72720000",
										"code":"SGD",
										"symbol_left":"",
										"symbol_right":"SGD",
										"decimal_point":"",
										"thousands_point":"",
										"decimal_places":""
										};
cc_currencies.SKK = {"title":"Slovak koruna",
										"value":"30.12600000",
										"code":"SKK",
										"symbol_left":"",
										"symbol_right":"SKK",
										"decimal_point":",",
										"thousands_point":".",
										"decimal_places":"2"
										};
cc_currencies.THB = {"title":"Thai baht",
										"value":"40.02200000",
										"code":"THB",
										"symbol_left":"",
										"symbol_right":"THB",
										"decimal_point":"",
										"thousands_point":"",
										"decimal_places":""
										};
cc_currencies.TRY = {"title":"Turkish lira",
										"value":"1.93300000",
										"code":"TRY",
										"symbol_left":"",
										"symbol_right":"TRY",
										"decimal_point":",",
										"thousands_point":".",
										"decimal_places":"2"
										};
cc_currencies.USD = {"title":"US Dollar",
										"value":"1.28340000",
										"code":"USD",
										"symbol_left":"$",
										"symbol_right":"",
										"decimal_point":".",
										"thousands_point":",",
										"decimal_places":"2"
										};
cc_currencies.ZAR = {"title":"Rand",
										"value":"9.26450000",
										"code":"ZAR",
										"symbol_left":"",
										"symbol_right":"ZAR",
										"decimal_point":"",
										"thousands_point":"",
										"decimal_places":""
										};

var ccBtn = false;
var ccFrm = false;
window.addEvent('domready', function() {
    if($defined(document.ccalc)){
    	document.ccalc.cc_value_from.value = number_format(DblCfg.get('currConvVal'),2,',','');
    	ccBtn = new Fx.Style($$('#ccconv div')[0],'opacity',{duration:500,wait:false});
    	ccFrm = new Fx.Style($$('#ccconv div')[1],'opacity',{hide:1,duration:500,wait:false});
    	ccFrm.hide();
	}
});

var CurrCalc = new Class({
	ccalc: function(){
		f = document.ccalc;
		var src_obj = cc_currencies[DblCfg.get('appCurr')];
		var src_value = parseFloat(htmlnumber2float(f.cc_value_from.value));
		src_value = !(src_value>0) ? 1 : src_value;
		var dest_value = '';
		var dest_curr = f.cc_dest_cur[f.cc_dest_cur.selectedIndex].value;
		var dest_obj = eval("cc_currencies."+dest_curr);
		dest_value = (src_value / src_obj.value) * dest_obj.value;
		dest_value = dest_obj.symbol_left + " " + number_format(dest_value, dest_obj.decimal_places, dest_obj.decimal_point, dest_obj.thousands_point) + " " + dest_obj.symbol_right;
		$('cc_dest_value').innerHTML = " = " + dest_value;
	}

});
var CC = new CurrCalc;

var displayPrice = function(value,curr)
{
    var price = '';
    var value = parseFloat(value) || 0;
    var curr = curr || 'USD';
    if( cc_currencies[curr] != undefined ){
        var currO = cc_currencies[curr];
    }else{
        var currO = cc_currencies.USD;
    }
    price = currO.symbol_left + " " + number_format(value, currO.decimal_places, currO.decimal_point, currO.thousands_point) + " " + currO.symbol_right;
    return price;
};