/**
 * @author Laura Franco
 */
$(document).ready(function()
{
	// documentation submenu
	if($('div.submenu').size() > 0)
	{
		$('div.submenu').mouseenter(function(){
			$(this).children('ul').css('display', 'block');
		}).mouseleave(function(){
			$(this).children('ul').css('display', 'none');
		});
	}

	// remove right-border of the tenth menu item
	$('#event_menu_list > li:eq(9)').addClass('tenth');

	// adjust image size
	$.each($('.programa img, #speakers_container img, #sponsors_container img, #event-description-par img, .event_new_content img, #section_contents img'), function(){
		var fakeImage = $('<img>').attr('src', $(this).attr('src'));
		var imageRatio = fakeImage.attr('width') / $(this).width();
		var newHeight = $(this).height() / imageRatio;
		$(this).css('height', newHeight);
	});

	// tooltips
	if($('a.tooltip_trigger').length > 0)
	{
		if($('#tooltip_div').length == 0)
		{
			//create tooltip div
			$('<div></div>').attr('id', 'tooltip_div').appendTo($('body'));
		}
		//activate tooltip
		$('a.tooltip_trigger').tooltip({
			tip: '#tooltip_div',
			direction: 'down',
			bounce: true,
			position: 'bottom center'
		}).dynamic({
			bottom: {
			direction: 'down'
		},
			top: {
			direction: 'up'
		}
		});
	}
});

