/*
 * SimpleModal Confirm Modal Dialog
 * http://www.ericmmartin.com/projects/simplemodal/
 * http://code.google.com/p/simplemodal/
 *
 * Copyright (c) 2007 Eric Martin - http://ericmmartin.com
 *
 * Licensed under the MIT license:
 *   http://www.opensource.org/licenses/mit-license.php
 *
 * Revision: $Id: confirm.js 97 2008-01-18 06:07:03Z emartin24 $
 *
 */

function confirm(message, callback, elem) {
	/*if ($(elem))
	{
		//var pos = $(elem).offset();
	}*/
	$('#confirm').modal({
		close:false, 
		overlayId:'confirmModalOverlay',
		containerId:'confirmModalContainer', 
		onShow: function (dialog) {
			dialog.data.find('.message').append(message);

			// if the user clicks "yes"
			dialog.data.find('.yes').click(function () {
				// call the callback
				if ($.isFunction(callback)) {
					callback.apply();
				}
				// close the dialog
				$.modal.close();
			});
			
			//$("#confirmModalContainer").css({ left: pos.left + 360, top: pos.top + 10 });
		}
	});
}

function open_modal(elem_id, callback) {
	$('#' + elem_id).modal({
		close:false, 
		overlayId:'confirmModalOverlay',
		containerId:'modal_tease_container', 
		onShow: function (dialog) {

			// if the user clicks "yes"
			dialog.data.find('.yes').click(function () {
				// call the callback
				if ($.isFunction(callback)) {
					callback.apply();
				}
				// close the dialog
				$.modal.close();
			});
		}
	});
}