/*
# -- BEGIN LICENSE BLOCK ----------------------------------
# This file is part of events, a plugin for Dotclear.
# 
# Copyright (c) 2009 Tomtom
# http://blog.zenstyle.fr/
# 
# Licensed under the GPL version 2.0 license.
# A copy of this license is available in LICENSE file or at
# http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
# -- END LICENSE BLOCK ------------------------------------
*/
$(function() {
	$('#events li').hover(
		function () {
			var li = $(this);
			var id = 'bulle'+$(this).children('span').attr('class');
			$('body').append('<div id="'+id+'" class="bulle"></div>');
			$.get(
				'index.php?rest/blog&f=getPosts&post_id='+$(this).children('span').attr('class'),
				{},
				function(data) {
					var pos = li.position();
					var id = 'bulle'+data.data[0].id;
					$('#'+id).html('<div class="content">'+data.data[0].content+'</div>');
					$('.bulle').css({'position' : 'absolute','left' : (pos.left+50)+'px','top' : (pos.top+20)+'px'});
					$('.bulle').fadeIn('slow');
				},
				'json'
			);
			
		},
		function() {
			$('body').find('#bulle'+$(this).children('span').attr('class')).remove();
		}
	);
});