$(document).ready(function (){
	var fullHeight = $(window).height();
	$('.full-height').each(function (i, v) {
		$(this).height(fullHeight);
	})
	$(document).on('click', '.menu-holder a', function (e) {
		e.preventDefault();
		var href = $(this).attr('href');
		var target = $(href);
		if (target.length) {
			$('html,body').animate({
	          scrollTop: target.offset().top
	        }, 1000);
		}
	})
})

$(window).resize(function () {
	var fullHeight = $(window).height();
	$('.full-height').each(function (i, v) {
		$(this).height(fullHeight);
	})
});

$(document).bind('scroll',function(e){
    $('.thepix-section').each(function(){
        if ( $(this).offset().top < window.pageYOffset + 10 && $(this).offset().top + $(this).height() > window.pageYOffset + 10 ) {
			if(history.pushState) {
			    history.pushState(null, null, '#'+$(this).attr('id'));
			} else {
				var el = document.getElementById($(this).attr('id'));
				var id = el.id;
				el.removeAttribute('id');
				location.hash = '#'+id;
				el.setAttribute('id', id);
			}
			$('.menu-holder a').removeClass('active');
			$('a[href="#'+$(this).attr('id')+'"]').addClass('active');
        }
    });
});
