/*
 * SimpleModal Confirm Modal Dialog
 * http://www.ericmmartin.com/projects/simplemodal/
 * http://code.google.com/p/simplemodal/
 *
 * Copyright (c) 2009 Eric Martin - http://ericmmartin.com
 *
 * Licensed under the MIT license:
 *   http://www.opensource.org/licenses/mit-license.php
 *
 * Revision: $Id: confirm.js 212 2009-09-03 05:33:44Z emartin24 $
 *
 */

$(document).ready(function () {
	$('#confirm-dialog input.confirm, #confirm-dialog a.confirm').click(function (e) {
		e.preventDefault();

		// example of calling the confirm function
		// you must use a callback function to perform the "yes" action
		confirm("<span>Due to the high level of demand we have experienced, Willis Owen has partnered with Scottish Widows Bank to provide investors with access to a Cash ISA. Also available online is Scottish Widows Direct Transfer Account.</span><span>By clicking the &quot;Continue&quot; button below you will be taken to the Scottish Widows Bank website where you can find out more information and apply. None of the information provided is intended as a personal recommendation, and the content of the linked website relates only to products offered by Scottish Widows Bank.</span><span>Willis Owen Limited does not control the content of the Scottish Widows website and is not responsible for the information contained therein.</span><span>If you take out the Scottish Widows Cash ISA or Direct Transfer Account, Willis Owen will receive 0.2% commission annually based on the average balance of your account. For example, if your investment value averages &pound;4,000 over a one year period this will generate a fee to Willis Owen of &pound;8.</span>It is your responsibility to ensure that these products meet your needs, and if you have any doubts concerning whether the products described are suitable for you, you should obtain independent financial advice.", function() {
			window.location.href = 'http://www.scottishwidows.co.uk/bank/willisowen';
		});
	});
});

function confirm(message, callback) {
	$('#confirm').modal({
		closeHTML:"<a href='#' title='Close' class='modal-close'>x</a>",
		position: ["20%",],
		overlayId:'confirm-overlay',
		containerId:'confirm-container-sw', 
		onShow: function (dialog) {
			$('.message', dialog.data[0]).append(message);

			// if the user clicks "yes"
			$('.yes', dialog.data[0]).click(function () {
				// call the callback
				if ($.isFunction(callback)) {
					callback.apply();
				}
				// close the dialog
				$.modal.close();
			});
		}
	});
}
