
function calc(amount,from,to,result) {

re=d(result);
am=d(amount);
fr=d(from);
to=d(to);

re.value="";
re.title="";

if (am) {
	f=fr.value;
	t=to.value;
	a=am.value;

	a=keyPressInput.formatNumber(a);
	//keypress event makes it always! in the form of , for decimal point and . for thousands
	
	
	//get rid of thousands
	a=a.replace(".","");
	
	//change , to point
	a=a.replace(",",".");
	a=Number(a);
		
	//alert(a);
		
	//convert a amount to EUROS (always)	
	if (f=="USD") a=a /EX_USD;
	if (f=="GBP") a=a /EX_GBP;
	if (f=="CYP") a=a /EX_CYP;
	if (f=="EUR") a=a /EX_EUR;
	

	if (t=="USD") a=a * EX_USD;
	if (t=="GBP") a=a * EX_GBP;
	if (t=="CYP") a=a * EX_CYP;
	if (t=="EUR") a=a * EX_EUR;
		
	a=a.toFixed(2); 
	//change , to point
	a=a.replace(".",",");
	
	
	a=keyPressInput.formatNumber(a); 
	re.value=a;
	re.title=am.value + " " + fr.value + "=" + a +" "+ to.value;	
}



}
