$(document).ready(function(){ 
		/*var slug ="";
        $("#sidebar .event").hover(function(e){
	        slug = $(this).attr("id"); 
			var xval = $(this).pageX;
			var yval = $(this).pageY;
			 $(this).append('<div id="tooltip"></div>');
			 $("#sidebar #tooltip").load('/_inc/event-popup-detail.php',{'slug':slug});
			 /$(this).mousemove(function(e){
			      //calculating offset for displaying popup message
			      leftVal=e.xval+(5) +"px";
			      topVal=e.yval+(5) +"px";
			      //show the popup message and hide with fading effect 
			      $("#tooltip").css({"top":topVal, "left":leftVal, "z-index":"10"}); 
			    });
			
			     /* $(this).mouseout(function(){
			          $("#tooltip").css({"z-index":"5"});
			          $("#tooltip").everyTime(500,'fade', function(){
			              $(this).fadeOut(200,function(){
			                  $(this).stopTime('fade');
			              });
			          });       

			      });    
		},function(){ 
			$("#tooltip").remove();
	   }); */
	
	//$("#side-event-list").append("<div class='tooltip'></div>"); 
	 $("#sidebar #side-event-list #tooltip").hide(); 
	
	
  $("#sidebar .event").tooltip({ 

	    // change trigger opacity slowly to 0.8
	 	tip: '#tooltip',
		delay: 0,
		offset:[5,-100],
		position: ['top','right'],
		effect: 'toggle',
	    /*onShow: function() { 
	        //this.getTrigger().fadeTo("fast", 1);
			
	    }, */
		
		onBeforeShow: function(){
			var slug = this.getTrigger().attr("id");
			$("#sidebar #tooltip").html("<img src='/_img/spinner3.gif' alt='loading'/>");
			$("#sidebar #side-event-list #tooltip").load('/_inc/event-popup-detail.php',{'slug':slug},function(){ 
				//load rsvp into colorbox
				$('.tooltip .rsvp .thickbox').colorbox({iframe:true,width:450, height:570});
				//re-init colorbox  
				$.fn.colorbox.init();
			});
		},
		onHide: function(){
			$("#sidebar #side-event-list #tooltip").html("");
		} 

	}); 
	
	
		 
});
