').append($(contents).clone()).html(); contents = "
" + contents + "
"; //update the page num contents = $(contents + ".scrollingcontentblock").attr("data-page", pg); return contents; }function replaceURL(scroll_pos, last_scroll){// Adjust the URL based on the top item shownif (Math.abs(scroll_pos - last_scroll) > $(window).height() * 0.1) {last_scroll = scroll_pos;$('.scrollingcontentblock').each(function (index) {if (mostlyVisible(this)) {var page_replace = replaceUrlParam(url, param_name, $(this).attr("data-page"));history.replaceState(null, null, page_replace);//Add GA code here for page clicksreturn (false);}});}}function mostlyVisible(element) { // if ca 25% of element is visible var scroll_pos = $(window).scrollTop(); var window_height = $(window).height(); var el_top = $(element).offset().top; var el_height = $(element).height(); var el_bottom = el_top + el_height; return ((el_bottom - el_height * 0.25 > scroll_pos) && (el_top < (scroll_pos + 0.5 * window_height))); } //Handles the url in case there are any parameters function replaceUrlParam(url, paramName, paramValue) { var pattern = new RegExp('\\b(' + paramName + '=).*?(&|$)') if (url.search(pattern) >= 0) { return url.replace(pattern, '$1' + paramValue + '$2'); } return url + (url.indexOf('?') > 0 ? '&' : '?') + paramName + '=' + paramValue } function getParameterByName(name) { name = name.replace(/[\[]/, "\\[").replace(/[\]]/, "\\]"); var regex = new RegExp("[\\?&]" + name + "=([^]*)"), results = regex.exec(location.search); return results === null ? "" : decodeURIComponent(results[1].replace(/\+/g, " ")); }About Us secondary banner