var Kurse = Object.extend(new DOMWorker(), {
	EUR: 1,  AUD: 1.8831, BGN: 1.9558, BRL: 2.9977, CAD: 1.6061, CHF: 1.5006, CNY: 9.2908, CZK: 26.1170, DKK: 7.4522, EEK: 15.6466, GBP: 0.9043, HKD: 10.5398, HRK: 7.3019, HUF: 266.1400, IDR: 14750.5801, INR: 66.3640, JPY: 126.7700, KRW: 1780.1300, LTL: 3.4528, LVL: 0.7069, MXN: 18.2717, MYR: 4.7589, NOK: 9.3915, NZD: 2.2717, PHP: 63.1500, PLN: 3.9747, RON: 4.0995, RUB: 39.9068, SEK: 10.5763, SGD: 1.9990, THB: 47.3510, TRY: 2.0672, USD: 1.3595, ZAR: 12.7150,

	kurs:[null,null],
	domElems: [{img:null,input:null}, {img:null,input:null}],
	onDOMLoaded: function() {
		this.kurs[0] = this.EUR;
		this.kurs[1] = this.USD;
		this.domElems[0].img = document.images["kursvon"];
		this.domElems[0].input = document.euroform.kurs1;
		this.domElems[1].img = document.images["kursnach"];
		this.domElems[1].input = document.euroform.kurs2;
	},
	calculate: function() {
		var value1 = this.domElems[0].input.value;
		if (isNaN(value1)) {
			alert("Bitte geben Sie eine korrekte Zahl in das erste Währungsfeld ein.");
		}
		var value2 = Math.round( (this.kurs[1]/this.kurs[0]) * value1 * 100) / 100;
		this.domElems[1].input.value = value2;
	},
	changeKurs: function (kid, land) {
		this.kurs[kid] = this[land];
		this.domElems[kid].img.src="/fileadmin/images/flags/"+land+".gif";
		this.calculate();
	},
});

function changefrom(land) {
	Kurse.changeKurs(0, land);
}
function changeto(land) {
	Kurse.changeKurs(1, land);
}
