
var msAccID = "0070HjtH";

function extendLinks()
{if(!document.getElementsByTagName){return;}
var anchors=document.getElementsByTagName("a");for(var i=0;i<anchors.length;i++)
{var anchor=anchors[i];if(anchor.getAttribute("href")&&anchor.getAttribute("rel")=="external")
{anchor.onclick=function(){window.open(this.getAttribute("href"));return false;};}
if(anchor.getAttribute("href")&&anchor.getAttribute("rel")=="popup")
{anchor.onclick=function(){window.open(this.getAttribute("href"),'','scrollbars=no,menu=no,status=no,width=400,height=480');return false;};}}}

function recalculate(){
	var sum = $('#amount').val().replace(/[^\d\.]/g,"");
	var rate = $('#rate').val();
	var s = $('#rate')[0].selectedIndex;
	var currency = $('#rate')[0].options[s].text.split(" ");
	var symbol;
	switch (currency[2]){
		case 'GBP':
			symbol ='&pound;';
			break;
		case 'JPY':
			symbol = '&yen;';
			break;
		case 'EUR':
			symbol = '&euro;';
			break;
		default:
			symbol = '$';
	};
	$('#answr').html(symbol + Math.round((sum*rate)*100)/100 + " " + currency[2]);
}

$(function() {
	$('#amount').keyup(recalculate);
	$('#rate').change(recalculate);
	extendLinks();
	recalculate();
}
);
