// find current rates here:  http://www.oanda.com/rtrates
// set rate = 1 for the currency you enter in the product variables.
		var eur_rate = "1";
		var gbp_rate = "0.6697";
		var usd_rate = "1.2627";
		
// calculate other prices
  	function WritePrices(basicmount)
	{
		document.write("<table border='0'>");
		document.write("<tr><td>EU&euro;</td><td align=right>" + roundCorrect(Math.round(100 * (eur_rate * basicmount)) / 100) + "</td></tr>");
		document.write("<tr><td>US$</td><td align=right>" + roundCorrect(Math.round(100 * (usd_rate * basicmount)) / 100) + "</td></tr>");
		document.write("<tr><td>UK&pound;</td><td align=right>" + roundCorrect(Math.round(100 * (gbp_rate * basicmount)) / 100) + "</td></tr>");
		document.write("</table>");		
	}			

// Do not change anything below this line ************************************************************		
		var rate = undefined;
		var currency = undefined;
		
// alterError - fixes a rounding bug in Netscape 2
	function alterError(value) {
		if (value<=0.99) {
			newPounds = '0';
		} else {
			newPounds = parseInt(value);
		}
		newPence = parseInt((value+.0008 - newPounds)* 100);
		if (eval(newPence) <= 9) newPence='0'+newPence;
		newString = newPounds + '.' + newPence;
		return (newString);
	}
	
	function roundCorrect(amount)
	{
		var checkamount = "" + amount;
		if ((checkamount.indexOf(".", 0)) == -1)
		{
			amount = amount + '.00';		
		}
		else if ((checkamount.length - checkamount.indexOf(".", 0)) == 2)
		{
			amount = amount + '0';		
		}
		return amount;
	}	

	// buyItem - adds an item to the shooping basket
	function buyItem(formname) 
	{
		var newItem = formname.desc.value;
		var newPrice = formname.price.value;
		var newQuantity = formname.quant.value;
		if (newQuantity <= 0) {
			rc = alert('The quantity entered is incorrect');
		} else {
			if (confirm('Add '+newQuantity+' x '+newItem+' to basket')) {
				index = document.cookie.indexOf("TheBasket");
				countbegin = (document.cookie.indexOf("=", index) + 1);
        			countend = document.cookie.indexOf(";", index);
	        		if (countend == -1) {
        	    			countend = document.cookie.length;
	        		}
		                document.cookie="TheBasket="+document.cookie.substring(countbegin, countend)+"["+newItem+"|"+newPrice+"|"+newQuantity+"]";
			}
		}
	}

	// resetShoppingBasket - resets to shopping basket to empty
	function resetShoppingBasket() {
		index = document.cookie.indexOf("TheBasket");
		document.cookie="TheBasket=.";
	}
	
function GetCurrency()
{
	var cookies = document.cookie;
	var startpos = cookies.indexOf("currency") + 9;
	var endpos = cookies.indexOf(";", startpos);
	if (endpos == -1) 
	{
		endpos = cookies.length;
	}
	currency = cookies.substring(startpos,endpos);
	if (currency != 'USD' && currency != 'GBP' && currency != 'EUR')
	{
		currency = 'USD';
	}
	document.checkoutform.valuta_code.value = currency;
	if (currency == 'USD')
	{
		rate = usd_rate;
	}
	else if (currency == 'GBP')
	{
		rate = gbp_rate;
	}	
	else if (currency == 'EUR')
	{
		rate = eur_rate;
	}
}	













