
jQuery.fn.keepscroll = function() {
	return this.each(function() {
		$(this).click(function() {
			$.cookie('keepScrollPosition', $(window).scrollTop(), { expires: 1, path: '/' });
			return true;
		});
	});
}

$(function() {
	if ($.cookie('keepScrollPosition') !== null) {
		$('html, body').animate({
			scrollTop: $.cookie('keepScrollPosition')
			}, 0);
		$.cookie('keepScrollPosition', null);
	}
});
