moneyObj = {}
currencyObj = {}

function AME(elm, amount){
	moneyObj[elm] = amount;
}

function AME2(elm, currency){
	currencyObj[elm] = currency;
}

function beforeChangeCurrency(code){
	getContent2("/ajax.cfm", "html=changeCurrency&code="+code, "voidAjaxReturn");
}

function voidAjaxReturn(c){
	return true;
}

function changeCurrency(content){
//	var contentArray = content.split(",");
	var code = content;
	var rate = currencies[code].rate;
	var pre = currencies[code].pre;
	var post = currencies[code].post;
	var thousand = currencies[code].th;
	var decimal = currencies[code].de;
	for(i in moneyObj){
		var newMoney = (Math.round(moneyObj[i]/(rate/100)*100)/100) +"";
		if(newMoney.indexOf(".") == -1){
			newMoney = newMoney + ".00";
		}
		if(newMoney.indexOf(".") != -1){
			var aTmp = newMoney.split('.');
			if(aTmp[1].length == 1){
				aTmp[1] = aTmp[1] + "0";
			}
			if(aTmp[0].length >= 4 ){	
				var tmplength = aTmp[0].length -3;
				var tmpP1 = aTmp[0].substring(0, tmplength);
				var tmpP2 = aTmp[0].substring(tmplength,aTmp[0].length);
				aTmp[0] = tmpP1 + "," + tmpP2;
			}
			newMoney = aTmp[0] +"."+ aTmp[1];
		}
		
		if (thousand!=','||decimal!='.'){
			newMoney = newMoney.replace(".","~").replace(",", thousand).replace("~", decimal);
		}
		
					
		
		document.getElementById(i).innerHTML = pre + newMoney + post;
	}
	
	/*for(j in currencyObj){
		document.getElementById(j).innerHTML = code;
	}*/
	
}