$(document).ready(function () {
	// grab the initial top offset of the navigation 
	var stickyNavTop = $('header.sticky-bar').offset().top;
	var scollUpBtn = $("a[id='scrollUp']");


	// our function that decides weather the navigation bar should have "fixed" css position or not.
	var stickyNav = function () {
		var scrollTop = $(window).scrollTop(); // our current vertical position from the top
		// if we've scrolled more than the navigation, change its position to fixed to stick to top,
		// otherwise change it back to relative
		if (scrollTop > stickyNavTop) {
			//$('header.sticky-bar').addClass('sticky');
			scollUpBtn.addClass('scrollUpVisible');
		} else {
			//$('header.sticky-bar').removeClass('sticky');
			scollUpBtn.removeClass('scrollUpVisible');
		}
	};

	stickyNav();


	// and run it again every time you scroll
	$(window).scroll(function () {
		stickyNav();
	});

	$(".search-post").on("click", function () {
		if ($(".form-search-top").css("display") == "none") {
			$(".form-search-top").slideDown();
		} else {
			$(".form-search-top").slideUp();
		}
	});
});