/*
 * SimpleModal Confirm Modal Dialog
 * http://www.ericmmartin.com/projects/simplemodal/
 * http://code.google.com/p/simplemodal/
 *
 * Copyright (c) 2010 Eric Martin - http://ericmmartin.com
 *
 * Licensed under the MIT license:
 *   http://www.opensource.org/licenses/mit-license.php
 *
 * Revision: $Id: confirm.js 238 2010-03-11 05:56:57Z emartin24 $
 *
 */
 
function hey() {
		// example of calling the confirm function
		// you must use a callback function to perform the "yes" action
		window.parent.confirm("Please indicate if you are...", function () {
			top.location.href = 'check_this_out.php?ref=12';
		}, function () {
			top.location.href = 'check_this_out.php?ref=13';
		});
}

jQuery(function ($) {
	$('#bancon, #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("Please indicate if you are...", function () {
			window.location.href = 'check_this_out.php?ref=12';
		}, function () {
			window.location.href = 'check_this_out.php?ref=13';
		});
	});
});

function confirm(message, callback, callback2) {
	$('#confirm').modal({
		closeHTML: "",
		position: [180,],
		overlayId: 'confirm-overlay',
		containerId: 'confirm-container', 
		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();
			});
			$('.no', dialog.data[0]).click(function () {
				// call the callback
				if ($.isFunction(callback)) {
					callback2.apply();
				}
				// close the dialog
				$.modal.close();
			});
		}
	});
}

function confirm2(message, callback, callback2) {
	$('#confirm').modal({
		closeHTML: "",
		position: [180,],
		overlayId: 'confirm-overlay',
		containerId: 'confirm-container', 
		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();
			});
			$('.no', dialog.data[0]).click(function () {
				// call the callback
				if ($.isFunction(callback)) {
					callback2.apply();
				}
				// close the dialog
				$.modal.close();
			});
		}
	});
}