$(document).ready(function()
{
	// menu navigation
	$("#mainNavigation ul div.navBox").each(function()
	{
		var elem=this;
		
		$(this).parent().hover(function()
		{
			$(elem).css("top",($(this).position().top-9)+"px");
			$(elem).css("left",($(this).position().left+75)+"px");
			if($.browser.msie)
			{
				$(elem).show();
			}
			else
			{
				$(elem).attr("opacity",0).show();
				$(elem).stop().animate({opacity:1}, 200);
			}
			
			$(elem).prev().toggleClass("active");
		},
		
		function()
		{
			if($.browser.msie)
			{
				$(elem).hide();
			}
			else
			{
				$(elem).stop().animate({opacity:0}, 200, function()
				{
					$(elem).hide();
				});
			}
			
			$(elem).prev().removeClass("active");
		});
	});
	
	// hover effect for categories
	$(".category").hover(function(){
		$(this).css({"cursor": "pointer"});
		$(this).stop().animate({backgroundColor: "#ffffbb"}, 200);
	}, function(){
		$(this).css({"cursor": "default"});
		$(this).stop().animate({backgroundColor: "#ffffff"}, 300);
	});

	// functions for images (thumbnails) with overlay
	$(".imageOverlayTriggers img").hover(function(){
		$("#imageOverlayEnlarge").css("display", "block");
		$("#imageOverlayEnlarge").css("left",($(this).offset().left - 6) + "px");
		$("#imageOverlayEnlarge").css("top",($(this).offset().top - 6) + "px");
	}, function(){
		$("#imageOverlayEnlarge").css("display", "none");
	});

	$(function(){
		$(".imageOverlayTriggers img[rel]").overlay({effect: 'apple'});
	});
	
	// functions for tooltips
	$(".tooltip").tooltip({
		offset: [10, 0],
		effect: 'slide'
	}).dynamic({
		bottom: {
			direction: 'down',
			bounce: true
		} 
	});

	$(document).ready(function(){
		$("#mainsponsors1 img").tooltip({
			tip: '#mainsponsorstip1',
			offset: [10, 0],
			effect: 'slide'
		}).dynamic({
			bottom: {
				direction: 'down',
				bounce: true
			} 
		});
	});
	
	$(document).ready(function(){
		$("#mainsponsors2 img").tooltip({
			tip: '#mainsponsorstip2',
			offset: [10, 0],
			effect: 'slide'
		}).dynamic({
			bottom: {
				direction: 'down',
				bounce: true
			} 
		});
	});

});
