// definice cen
var prices1 = new Array();
prices1[1] = 49;
prices1[3] = 59;
prices1[5] = 79;
prices1[10] = 119;

var prices2 = new Array();
prices2[1] = 69;
prices2[2] = 89;
prices2[3] = 109;
prices2[4] = 129;
prices2[5] = 149;
prices2[6] = 169;
prices2[7] = 189;
prices2[8] = 209;
prices2[9] = 229;
prices2[10] = 249;

var prices4 = 8;
var prices5 = 8;

// kurzy dalsich men
var usd = 0.75;
var gbp = 1.12;

function updatePrices()
{
	oo1Elem = document.getElementById('oo1');
	oo2Elem = document.getElementById('oo2');
	p1Elem = document.getElementById('p1');
	p2Elem = document.getElementById('p2');
	p4Elem = document.getElementById('p4');
	p5Elem = document.getElementById('p5');
	currencyElem = document.getElementById('currency');
	
	price1 = prices1[oo1Elem.value];
	price2 = prices2[oo2Elem.value];
	price4 = prices4;
	price5 = prices5;

	if (currencyElem.value == 'EUR')
	{
		price1 = price1 + ' €';
		price2 = price2 + ' €';
		price4 = price4 + ' €';
		price5 = price5 + ' €';
	}

	if (currencyElem.value == 'USD')
	{
		price1 = Math.round((price1 / usd) * 100) / 100;
		price2 = Math.round((price2 / usd) * 100) / 100;
		price4 = Math.round((price4 / usd) * 100) / 100;
		price5 = Math.round((price5 / usd) * 100) / 100;

		price1 = '$' + price1;
		price2 = '$' + price2;
		price4 = '$' + price4;
		price5 = '$' + price5;
	}
	
	if (currencyElem.value == 'GBP')
	{
		price1 = Math.round((price1 / gbp) * 100) / 100;
		price2 = Math.round((price2 / gbp) * 100) / 100;
		price4 = Math.round((price4 / gbp) * 100) / 100;
		price5 = Math.round((price5 / gbp) * 100) / 100;

		price1 = '£' + price1;
		price2 = '£' + price2;
		price4 = '£' + price4;
		price5 = '£' + price5;
	}

	p1Elem.value = price1;
	p2Elem.value = price2;
	p4Elem.value = price4;
	p5Elem.value = price5;
}
