





(function() {
	var footerHeight = jQuery('.footer-element').height(); 
	
	
	var scrollLink = jQuery('<a></a>')
		.attr('href', '#top')
		.addClass('scroll-to-top-link')
		.addClass('scroll-to-top-link-round-black')
		.hide();
		
	
	

	var image= jQuery('<img/>')
		.attr('src', '/digitalAssets/463/c_463224-l_3-k_top-icon.png')
		.attr('alt', 'To the top of the page.');

	scrollLink.append(image);

	jQuery('.page-content, .page-content-fullwidth').append(scrollLink);


	
	var showHideLink = function() {
		var windowHeight = jQuery(window).height();
		var scrollTopOffset = jQuery(document).scrollTop();

		// Toggle display of link
		if (scrollTopOffset > windowHeight / 2) {
			scrollLink.fadeIn(100);
		} else {
			scrollLink.fadeOut(100);
		}
	}
	
	
	showHideLink();
	
	
	jQuery(document).scroll(function() {
		showHideLink();
	});
	
	  
	jQuery('a[href*=#]:not([href=#])').click(function(e) {
		var linkDestination = jQuery(this).attr('href');
		 
		if (jQuery(this).hasClass("scroll-to-top-link") || jQuery(this).hasClass("btn-skip")) {
			e.preventDefault();
			jQuery(linkDestination).attr('tabindex', '-1').focus();
		}
		 
		if (location.pathname.replace(/^\//, '') == this.pathname.replace(/^\//, '') && location.hostname == this.hostname) {
			var target = jQuery(this.hash);
			target = target.length ? target : jQuery('[name=' + this.hash.slice(1) + ']');
			if (target.length) {
				jQuery('html,body').animate({
					scrollTop: target.offset().top
				}, 400);
			}
		}
	});
})();
