function initBalloonInElement(elem) {
	jQuery.each(jQuery(elem).find('.balloon'), function() {
		var offset = jQuery(this).height()-12;
		jQuery(this).css('margin-top','-' + offset + 'px');
	});

	var parentElem = jQuery(elem).find('.balloon').parent();

	parentElem.bind('mouseenter', function() {
		showBalloon(this);
	});

	parentElem.bind('mouseleave', function() {
		hideBalloon(this);
	});
}

function showBalloon(element) {
	jQuery(element).children('.balloon').addClass('mouseover');
	t = setTimeout(function(){
		if(jQuery(element).children('.balloon').hasClass('mouseover')) {
			jQuery(element).children('.balloon').fadeIn();
		}
	}, 500);
}

function hideBalloon(element) {
	jQuery(element).children('.balloon').removeClass('mouseover');
	jQuery(element).children('.balloon').fadeOut();
}

jQuery(document).ready(function() {


	jQuery.each(jQuery('.balloon'), function() {
		var offset = jQuery(this).height()-12;
		jQuery(this).css('margin-top','-' + offset + 'px');
	});

	jQuery('.balloon').parent().bind('mouseenter', function() {
		showBalloon(this);
	});

	jQuery('.balloon').parent().bind('mouseleave', function() {
		hideBalloon(this);
	});

});
