/**
 * В© Conjecture corporation 2008
 *
 * jQuery customized context menu plugin 
 *
 * created by Ivan Klimenko
 * 
 */

(function($) {

	$.fn.showMenu = function(options) {
		
        var opts = $.extend({}, $.fn.showMenu.defaults, options);
        
		$(this).bind("contextmenu",function(e){
        
            var bShowContext = (!!opts.onShow) ? opts.onShow(e) : true;

            if(bShowContext) {
            
			  $(opts.query).show().css({
				  top:e.pageY+"px",
				  left:e.pageX+"px",
				  position:"absolute",
				  zIndex: opts.zindex
			  });
              
            }
            
			return false;
            
		});
        
		$('body').bind("click",function(e) {
			$(opts.query).hide();
		});
        
	};
	
	$.fn.showMenu.defaults = {
	  zindex: 2000,
	  query: document
	};
    
})(jQuery);
