$(function() {

	$(".toggle-block").hide();
	
	$(".toggler").addClass("closed").click(function(){
		$(this).next(".toggle-block").slideToggle("fast");
		$(this).toggleClass("closed");
		return false;
	});
	
	$(".jq-scroll").click(function(){
		var id = $(this).attr("href");
		var top = $(id).offset().top - 50;
		if (top < 0) top = 0;
		$("html,body").animate({scrollTop:top},{easing:"easeInOutQuad",duration: 1000});
		return false;
	});
	
	var hash = document.location.hash;
	if(hash && hash.length && $(hash).length) {
		var top = $(hash).offset().top - 50;
		if (top < 0) top = 0;
		$("html,body").animate({scrollTop:top},{easing:"easeInOutQuad",duration: 500});
	}
});

$.extend( jQuery.easing,
{
	easeInQuad: function (x, t, b, c, d) {
		return c*(t/=d)*t + b;
	},
	easeOutQuad: function (x, t, b, c, d) {
		return -c *(t/=d)*(t-2) + b;
	},
	easeInOutQuad: function (x, t, b, c, d) {
		if ((t/=d/2) < 1) {
			return c/2*t*t + b;
		}
		return -c/2 * ((--t)*(t-2) - 1) + b;
	}
});