$(function() {      
	$(".content").css({"opacity": 0, 'display': 'none'});

	$("#navigation li a.nav_link").click(function() {
		var href = $(this).attr("href");
		if ( href && href.indexOf("#") >= 0){
			clicked = $("." + href.split("#")[1])
			if (display[0] !== clicked[0]) { switchContent(clicked);}
			var c = this;
			$("#navigation a.nav_link").each(function(){
				this.parentNode.className = this.parentNode == c.parentNode ? "active" : "";
			});
			return false;      
		}
	});
  
	$('.events img').tooltip({ 
		track: true, 
		delay: 0, 
		showURL: false, 
		showBody: " - "
	});
	
	display = $(".events");        
	switchContent(display);
  
});
    
function switchContent(section) {
	display.animate({ opacity: 0 }, 500, function() {
		display.css("display", "none");
		section.css("display", "block").animate({ opacity: 1 }, 500);
		display = section;
	});        
}

$(function(){
  $('a[href*=#].contact').click(function() {
    if (location.pathname.replace(/^\//,'') == this.pathname.replace(/^\//,'')
    && location.hostname == this.hostname) {
      var $target = $(this.hash);
      $target = $target.length && $target
      || $('[name=' + this.hash.slice(1) +']');
      if ($target.length) {
        var targetOffset = $target.offset().top;
        $('html,body')
        .animate({scrollTop: targetOffset}, 1000);
       return false;
      }
    }
  });
});