/* Copyright (c) 2008 Kean Loong Tan http://www.gimiti.com/kltan
 * Licensed under the MIT (http://www.opensource.org/licenses/mit-license.php)
 * Name: jContext
 * Version: 1.0 (April 28, 2008)
 * Requires: jQuery 1.2+
 */
(function(jQuery) 
{
	jQuery.fn.showMenu = function(options) 
	{
		var opts = jQuery.extend({}, jQuery.fn.showMenu.defaults, options);
		jQuery(this).bind("click",function(e)
		{
			jQuery('div.contextMenu').hide();
			
			jQuery('div#contextMenu_' + jQuery(this).attr('guardianType') + '_' +  jQuery(this).attr('guardianID')).show().css(
			{
				top:e.pageY + "px",
				left:e.pageX + "px",
				position:"absolute",
				opacity: opts.opacity,
				zIndex: opts.zindex
			});
			return false;
		});
		jQuery(document).bind("click",function(e)
		{
			jQuery('div.contextMenu').hide();
		});
	};
	
	jQuery.fn.showMenu.defaults = {
		zindex: 2000,
		query: document,
		opacity: 1.0
	};
})(jQuery);