$(document).ready(function () {
	$('.content a.confirm').click(function (e) {
		var n = $(this);
		e.preventDefault();

		// example of calling the confirm function
		// you must use a callback function to perform the "yes" action
		confirm("Continue to the SimpleModal Project page?", function () {
			window.location.href = (n.attr("href"));
			// alert('The value of n is ' . $n)
			//window.location.href = 'http://www.ericmmartin.com/projects/simplemodal/';
		});
	});
});

function confirm(message, callback) {
	$('#confirm').modal({
		opacity: 80,
		overlayCss: {backgroundColor:"#000"},		
		overlayId:'confirm-overlay',
		closeClass:'no',
		overlayClose:true,
		onOpen: function (dialog) {
			dialog.overlay.fadeIn('fast', function () {
				dialog.container.slideDown('fast', function () {
					dialog.data.fadeIn('fast');
				});
			});
		},
		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();
			});
		}
	});
}
