Event.observe(window,"load", function() {
	add_rollovers();
	convert_currencies(currentCurrency);
	$$('#new-search-currency span.currency').each(function(el) {
		el.observe('click', function(e) {
			$$('#new-search-currency span.currency').each(function(el) {
				el.removeClassName("active");
			});
			e.target.addClassName("active");
			convert_currencies(e.target.readAttribute("title"));
		});
	});
});

function add_rollovers() {
	$$(".popup").each(function(s) {
		s.observe('click', function() {
			this.down("span").show();
		});
		s.down("span").observe('mouseout', function() {
			this.hide();
		});
	});
};

function convert_currencies(currency) {
	$$("span.currency-to-convert").each(function(s) {
		var converted = (s.readAttribute('rate') / currencies[s.readAttribute('currency')]) * currencies[currency];
		converted = converted.round();
		s.up().previous('dd').update(currency + ' ' + converted);
	});
	
};





