// Feel free to create a different function and access window.AxiomWebTools.rate_box.info_block
// if the simple layout from AxiomWebTools.show() doesn't suit you.

if (!window.AxiomWebTools)
	window.AxiomWebTools = {};
window.AxiomWebTools.rate_box = {
	info_block: {"prime":"2.75%","terms":[{"title":"1 Year","posted":"3.30%","our":"2.44%","lender_id":"51","lender_name":"Scotia Mortgage Authority","product_id":"326","product_name":"1 Year Closed"},{"title":"2 Years","posted":"3.55%","our":"3.09%","lender_id":"73","lender_name":"Street Capital","product_id":"1122","product_name":"2 Year Fixed"},{"title":"3 Years","posted":"4.10%","our":"3.44%","lender_id":"11","lender_name":"National Bank of Canada","product_id":"1170","product_name":"Quick Close 3 year"},{"title":"4 Years","posted":"5.04%","our":"3.69%","lender_id":"73","lender_name":"Street Capital","product_id":"1123","product_name":"4 Year Fixed quick close"},{"title":"5 Years","posted":"5.39%","our":"3.65%","lender_id":"7","lender_name":"Home Trust","product_id":"1166","product_name":"Quick Close"},{"title":"7 Years","posted":"6.45%","our":"4.85%","lender_id":"9","lender_name":"Laurentian Bank","product_id":"633","product_name":"7 Year Closed"},{"title":"10 Years","posted":"6.60%","our":"5.19%","lender_id":"48","lender_name":"Firstline Mortgages","product_id":"598","product_name":"Standard Fixed Rate"},{"title":"VIRM","posted":"2.75%","our":"2.10%"}]},
	agent_id: 50,
	brokerage_id: 4,
	show: function(options) {
		if (!options) options = {};
		var rate_box = window.AxiomWebTools.rate_box;
		var info_block = rate_box.info_block;

		window.document.write('<table class="AxiomWebTools rate-box" cellspacing="0" cellpadding="0"><thead><tr><th>Terms</th><th>The Bank</th><th>Our Rates</th></tr></thead><tbody>');
		for (var i = 0; i < info_block.terms.length; i++) {
			var term = info_block.terms[i];
			var odd_even = i%2 ? 'odd' : 'even';
			if (options.linked_to_smartapp && (rate_box.agent_id || rate_box.brokerage_id)) {
				if (rate_box.agent_id)
					var uri = "agent?agent="+rate_box.agent_id;
				else if (rate_box.brokerage_id)
					var uri = "brokerage?brokerage="+rate_box.brokerage_id;

				window.document.write('<tr class="' + odd_even + '"><th>' + term.title + '</th><td>' + term.posted + '</td><td><a href="http://secure-mortgage-online.ca/'+uri+'" title="Apply Today">' + term.our + '</a></td></tr>');
			} else
				window.document.write('<tr class="' + odd_even + '"><th>' + term.title + '</th><td>' + term.posted + '</td><td>' + term.our + '</td></tr>');
		}
		window.document.write('</tbody><tfoot><tr><td colspan="3" class="prime">The prime rate is ' + info_block.prime + '</td></tr><tr><td colspan="3" class="disclaimer">Rates are subject to change without notice as the industry fluctuates.</td></tr></tfoot></table>');
	}
}
