﻿var CurrencyConverter = {

	show: function (amount) {
		var jqCurrencyConverter = $("#CurrencyConverter");
		jqCurrencyConverter.find("iframe").attr("src", "http://" + window.location.hostname + "/CurrencyConverter.aspx?amount=" + encodeURIComponent(amount));
		jqCurrencyConverter.overlay({ click: function () { CurrencyConverter.hide(); } });

		if (X) X.attachTo(jqCurrencyConverter, CurrencyConverter.hide);
	},

	hide: function () {
		var jqCurrencyConverter = $("#CurrencyConverter");
		jqCurrencyConverter.unoverlay();

		if (X) X.unattach();
	}

};

$(function () {

	$(document.body).append(
		'<div id="CurrencyConverter" style="display:none;position:absolute;z-index:10;width:480px;height:124px;padding:20px 0px 0px 0px;background-color:#eb8623;">' +
			'<h1 style="text-align:center;margin:0px 0px 20px 0px;font-size:36pt;font-weight:900;font-family:Lato,Arial;letter-spacing:-2px;color:#ffffff">Currency Converter</h1>' +
			'<div>' +
				'<iframe style="width:480px;height:40px;margin:0px;border-width:0px;background-color:#eb8623;" frameborder="0" marginwidth="0" marginheight="0" bgcolor="#eb8623"></iframe>' +
			'</div>' +
		'</div>'
	);

});
