var markers = []; //some array var map = false; var locationmaps = []; var isTouch = false; function checkImageWidths() { // when the holder is wider than the landscape image... need to make it full width jQuery('img.landscape').each(function () { if (jQuery(this).parent().hasClass('img-hold')) { if (jQuery(this).width() < jQuery(this).parent().width()) { jQuery(this).addClass('boxWider'); } else { if (jQuery(this).height() < jQuery(this).parent().height()) { jQuery(this).removeClass('boxWider'); } } } }); } jQuery(window).on("resize", checkImageWidths); jQuery(window).load(function () { checkImageWidths(); }); jQuery(document).ready(function () { // make mychart links all open in new tabs jQuery('a[href*="ht.org"]').attr("target", '_blank'); // check for touch capability isTouch = (('ontouchstart' in window) || (navigator.msMaxTouchPoints > 0)); var n = jQuery("#site-navigation"); var navBottom = n.position().top + n.outerHeight(true) + 200; jQuery(window).scroll(function () { // n = jQuery(".site-navigation"); if (jQuery(this).scrollTop() > navBottom) { n.addClass("navScrolled"); jQuery('BODY').addClass("navScrolled"); } else { n.removeClass("navScrolled"); jQuery('BODY').removeClass("navScrolled"); } }); // make boxlist items clickable jQuery('.boxlist div').click(function (e) { url = jQuery(this).data('url'); if (url) { e.preventDefault(); location.href = url; } }); jQuery('li.li-click').click(function (e) { url = jQuery(this).data('url'); if (url) { e.preventDefault(); location.href = url; } }); jQuery('#menu-item-search-parent i').click(function () { if (jQuery('#header-search-container').hasClass('show-search')) { jQuery('#header-search-container').fadeOut('medium'); jQuery('#header-search-container').removeClass('show-search'); } else { jQuery('#header-search-container').fadeIn('slow'); jQuery('#header-search-container').addClass('show-search'); } }); jQuery('.mobile-search i').click(function () { if (jQuery('#header-search-container').hasClass('show-mobile-search')) { jQuery('#header-search-container').removeClass('show-mobile-search'); } else { jQuery('#header-search-container').addClass('show-mobile-search'); } }); jQuery('.search-close').click(function () { if (jQuery('#header-search-container').hasClass('show-mobile-search')) { jQuery('#header-search-container').removeClass('show-mobile-search'); } else { jQuery('#header-search-container').addClass('show-mobile-search'); } }); //img gallery shortcode jQuery('.sgsi-inner').click(function () { var img = jQuery(this).first().data('imgsrc'); var caption = jQuery(this).find('.sgsi-inner-caption').html(); jQuery('.igs-current-img').find('img').attr('src', img); jQuery('.igs-current-img').find('img').attr('srcset', img); jQuery('.igs-current-img').find('.igs-current-img-caption').html(caption); }); // toggle jQuery('a.showproviderupdateform').click(function (e) { jQuery(this).addClass('clicked'); jQuery(this).parent().parent().find('#providerUpdateFormBox').css('display','block'); e.preventDefault(); }); jQuery('.shownextthing').click(function (e) { jQuery(this).parent().parent().find('div').fadeIn(); jQuery(this).fadeOut(500); e.preventDefault(); }); jQuery('.showcloakedsibs').click(function (e) { if (jQuery(this).parents('div').find('.boxlist').find('.cloaked').length == 0) { jQuery(this).parents('div').find('.boxlist').find('.was-cloaked').fadeOut().addClass('cloaked').removeClass('was-cloaked'); } else { jQuery(this).parents('div').find('.boxlist').find('.cloaked').addClass('was-cloaked').fadeIn().removeClass('cloaked'); } e.preventDefault() }); jQuery('.alpha-list-hide').click(function () { jQuery(this).parents('.alpha-list').parent().find('.shownextthing').fadeIn(500); jQuery(this).parents('.alpha-list').fadeOut(500); }); jQuery('.provider-update-close').click(function () { jQuery(this).parents('#providerUpdateFormBox').fadeOut(500); }); jQuery('.toggle-list > li h4').click(function () { jQuery(this).parent().toggleClass('showtoggle'); jQuery(this).parent().find('div').toggle(); }).parent().find('div').toggle(); jQuery('#providerSort').on('change', function () { // console.log('sortchange'+this.value); if (this.value == 'name') { var sortedProviders = jQuery('#provider-grid .type-provider').sort(function (a, b) { var contentA = jQuery(a).data('name'); var contentB = jQuery(b).data('name'); //console.log('sort'+contentA); return (contentA < contentB) ? -1 : (contentA > contentB) ? 1 : 0; }); } if (this.value == 'specialty') { // console.log('special'); var sortedProviders = jQuery('#provider-grid .type-provider').sort(function (a, b) { var contentA = jQuery(a).data('specialty'); var contentB = jQuery(b).data('specialty'); //console.log('sort '+contentA); //return (contentA > contentB?1:0) ; return (contentA < contentB) ? -1 : (contentA > contentB) ? 1 : 0; }); } jQuery('#provider-grid').html(sortedProviders); }); jQuery('.provider-filter').on('change', function () { var filterString = ''; jQuery('#providerFilterBox .provider-filter').each(function () { if (this.value) { filterString = filterString + '.' + this.value } }); // console.log(filterString); jQuery('#provider-grid provider').not(filterString).fadeOut(); jQuery('#provider-grid provider' + filterString).removeClass('cloaked').fadeIn(); jQuery('#providercounthead').show(); visresults = jQuery('#provider-grid provider' + filterString).length; jQuery('#providerCount').html(visresults); if (visresults == 0) { jQuery('#providerFilterBox').append('
No Providers Match Your Filter Set
'); jQuery('.delayfade').delay(1000).fadeOut(1000); } }) var url = stvajdata.ajaxurl + "?action=provider_search"; if (jQuery("#providerSearch").length) { jQuery("#providerSearch").keydown(function (e) { if (e.keyCode === 13) { jQuery(this.form).trigger('submit'); } }); jQuery("#providerSearch").autocomplete({ source: url, delay: 500, minLength: 3, select: function (event, ui) { if (ui.item) { //console.log(ui.item.link); location.href = ui.item.link; //url = jQuery(ui.item).data('url'); //console.log(url); event.preventDefault(); } } }).data("ui-autocomplete")._renderItem = function (ul, item) { if (item.autocontent) { return jQuery('') .data("item.autocomplete", item) /* .append("" + item.title + "
")*/ .append("" + item.autocontent + "") .appendTo(ul); } else { return jQuery('') .data("item.autocomplete", item) .append("" + item.title + "
") .appendTo(ul); } }; } jQuery('.location-filter').change(function (e) { console.log('filter'); filter = ''; //loctionsGridBox jQuery('.location-filter').each(function () { if (jQuery(this).prop('checked')) { filter = filter + ' .' + jQuery(this).val(); } }); console.log(filter); jQuery('#loctionsGridBox .location-grid').not(filter).fadeOut(); jQuery('#loctionsGridBox ').find(filter).fadeIn(); }); jQuery('#clearFilters').click(function (e) { jQuery('#providerSearch').val(''); jQuery('.provider-filter').val(''); jQuery('.location-filter').prop('checked', false).first().change(); jQuery('#filterSpecialties').change(); e.preventDefault(); }); //gmaps_results_initialize(); if (jQuery('#providerMapCanvas').length) { google.maps.event.addDomListener(window, 'load', gmaps_results_initialize); } if (jQuery('#locationMapCanvas').length) { google.maps.event.addDomListener(window, 'load', gmaps_results_initialize_location); } if (jQuery('#locationMapCanvas_2').length) { google.maps.event.addDomListener(window, 'load', gmaps_results_initialize_location_2); } if (jQuery('.gmapBodyContent ').length) { google.maps.event.addDomListener(window, 'load', gmaps_results_initialize_sidebar); } if (jQuery('.sideBarMapCanvasClass').length) { google.maps.event.addDomListener(window, 'load', gmaps_results_initialize_sidebar); } if (jQuery('.archiveTaxMapCanvasClass').length) { google.maps.event.addDomListener(window, 'load', gmaps_results_initialize_sidebar); } if (jQuery('#grouplocationMapCanvas').length) { google.maps.event.addDomListener(window, 'load', gmaps_results_initialize_grouplocation); } if (jQuery('div[id^="locationMapSmall"]').length) { google.maps.event.addDomListener(window, 'load', gmaps_initialize_locations_grid); } if (jQuery('.imgscrollloader.notloaded').length) { jQuery(window).scroll(checkLazyLoaders); // only hook if target is in the page } jQuery(window).resize(mobileTransition); mobileTransition(); jQuery('.counter').each(function () { jQuery(this).prop('Counter', 0).animate({ Counter: jQuery(this).text() }, { duration: 4000, easing: 'swing', step: function (now) { jQuery(this).text(Math.ceil(now)); } }); }); /* slick slider for read mores */ jQuery('.pageAlsoRead').slick({ dots: false, infinite: false, speed: 300, slidesToShow: 3, slidesToScroll: 2, responsive: [{ breakpoint: 1024, settings: { slidesToShow: 2, slidesToScroll: 1, infinite: true, dots: true, } }, { breakpoint: 600, settings: { slidesToShow: 2, slidesToScroll: 1, } }, { breakpoint: 480, settings: { slidesToShow: 1, slidesToScroll: 1, } } // You can unslick at a given breakpoint now by adding: // settings: "unslick" // instead of a settings object ] }); jQuery('.teamlist-viewall-btn').click(function () { jQuery('.single-department .team-slider,.tax-specialty .team-slider').slick('unslick'); jQuery('.single-location .team-slider').slick('unslick'); jQuery(this).hide(); }); jQuery('.single-department .team-slider, .tax-specialty .team-slider').slick({ dots: false, infinite: false, speed: 300, slidesToShow: 4, slidesToScroll: 2, responsive: [{ breakpoint: 1024, settings: { slidesToShow: 2, slidesToScroll: 1, infinite: true, dots: true } }, { breakpoint: 600, settings: { slidesToShow: 2, slidesToScroll: 1 } }, { breakpoint: 480, settings: { slidesToShow: 1, slidesToScroll: 1 } } // You can unslick at a given breakpoint now by adding: // settings: "unslick" // instead of a settings object ] }); jQuery('.single-location .team-slider ').slick({ dots: false, infinite: false, speed: 300, slidesToShow: 4, slidesToScroll: 2, responsive: [{ breakpoint: 1024, settings: { slidesToShow: 2, slidesToScroll: 1, infinite: true, dots: true } }, { breakpoint: 600, settings: { slidesToShow: 2, slidesToScroll: 1 } }, { breakpoint: 480, settings: { slidesToShow: 1, slidesToScroll: 1 } } // You can unslick at a given breakpoint now by adding: // settings: "unslick" // instead of a settings object ] }); }); // end of doc ready function checkLazyLoaders() { //console.log('lload'); jQuery('.imgscrollloader.notloaded').each(function () { if (elementScrolled(jQuery(this))) { jQuery(this).attr('src', jQuery(this).data('loadsrc')); jQuery(this).attr('srcset', jQuery(this).data('srcset')); jQuery(this).removeClass('notloaded'); } }); } function elementScrolled(elem) { var docViewTop = jQuery(window).scrollTop(); var docViewBottom = docViewTop + window.innerHeight; //jQuery(window).height(); // console.log(jQuery(window).height()); console.log(window.innerHeight); var elemTop = jQuery(elem).offset().top; console.log(docViewTop + '--' + docViewBottom + '--' + elemTop); return ((elemTop <= docViewBottom) && (elemTop >= docViewTop)); } function gmaps_results_initialize_sidebar() { var markers = []; //some array jQuery('.sideBarMapCanvasClass, .archiveTaxMapCanvasClass, .gmapBodyContent ').each(function () { //console.log(jQuery(this)); if (jQuery(this).data('zoom')) { zoom = jQuery(this).data('zoom'); } else { zoom = 10; } geocoder = new google.maps.Geocoder(); var map = new google.maps.Map(document.getElementById(jQuery(this).attr('id')), { zoom: zoom, center: new google.maps.LatLng(41.245019, -96.048286), }); address = jQuery(this).data('address'); console.log(address); if (address != '') { //console.log('geocode'); geocoder.geocode({ 'address': address }, function (results, status) { if (status == google.maps.GeocoderStatus.OK) { map.setCenter(results[0].geometry.location); var marker = new google.maps.Marker({ map: map, position: results[0].geometry.location }); map.setCenter(marker.getPosition()); if (zooom = jQuery(this).data('zoom')) { map.setZoom(zooom); } else { map.setZoom(14); } } else { console.log('can not geocde that address' + address); } }); } }); // end of each } function gmaps_initialize_locations_grid() { var locationmaps = []; jQuery('article.location-grid div[id^="locationMapSmall"] ').each(function () { address = jQuery(this).parent().data('address'); idofthismap = jQuery(this).attr('id'); console.log(idofthismap + '--' + address); locationmaps[idofthismap] = new google.maps.Map(document.getElementById(idofthismap), { zoom: 10, center: new google.maps.LatLng(41.245019, -96.048286), }); geocoder.geocode({ 'address': address }, function (results, status) { if (status == google.maps.GeocoderStatus.OK) { console.log('---'); // console.log(locationBox); // map.setCenter(results[0].geometry.location); locationmaps[idofthismap].setCenter(results[0].geometry.location); var markerx = new google.maps.Marker({ map: locationmaps[idofthismap], position: results[0].geometry.location }); } else { console.log(google.maps.GeocoderStatus); console.log('no geo code'); } }); //var boundstx = new google.maps.LatLngBounds(); }); } function gmaps_results_initialize_grouplocation() { var markers = []; geocoder = new google.maps.Geocoder(); var map = new google.maps.Map(document.getElementById('grouplocationMapCanvas'), { zoom: 10, center: new google.maps.LatLng(41.245019, -96.048286), }); var boundst = new google.maps.LatLngBounds(); jQuery('article.location,.locationMapBox .locations-grid > div').each(function () { var locationBox = jQuery(this); //console.log(jQuery(this).data('address')); if (jQuery(this).data('address') != '') { //console.log('geocode'); geocoder.geocode({ 'address': jQuery(this).data('address') }, function (results, status) { if (status == google.maps.GeocoderStatus.OK) { // console.log('---'); // console.log(locationBox); // map.setCenter(results[0].geometry.location); var marker = new google.maps.Marker({ map: map, position: results[0].geometry.location }); marker.address = locationBox.data('address'); marker.divID = locationBox.attr('id'); boundst.extend(marker.getPosition()); //marker.bindInfoWindow(''+jQuery(this).data('address')+'
'); marker.infoWindow = new google.maps.InfoWindow({ content: '' + locationBox.find('.entry-header').html() + '' }); key = markers.push(marker); key = key - 1; // marker.addListener('click', function() { // infoWindow.open(map, this); // }); google.maps.event.addListener(marker, 'click', function () { for (var i = 0; i < markers.length; i++) { markers[i].infoWindow.close(); } marker.infoWindow.open(map, marker); }); google.maps.event.addListener(marker, 'click', function (latlng) { var thediv = jQuery('#' + this.divID); //access the sidebar element // console.log(this.divID); thediv.css('order', 1); // console.log(thediv); thediv.css('background', '#efefef'); // etc... }); } else { console.log('can not geocde that address' + jQuery(this).data('address')); } }); } }); // console.log(markers); setTimeout(mapFitToMarkers, 1000); function mapFitToMarkers() { var bounds = new google.maps.LatLngBounds(); //console.log('h343'); for (var i = 0; i < markers.length; i++) { //console.log(markers[i]); bounds.extend(markers[i].getPosition()); } if (markers.length > 1) { map.fitBounds(bounds); } else { map.setCenter(markers[0].getPosition()); map.setZoom(14); } } } // function gmaps_results_initialize_location() { var markers = []; //some array geocoder = new google.maps.Geocoder(); var map = new google.maps.Map(document.getElementById('locationMapCanvas'), { zoom: 10, center: new google.maps.LatLng(41.245019, -96.048286), }); address = jQuery('#locationMapCanvas').parent().data('address'); //console.log(address); if (address != '') { // console.log('geocode'); geocoder.geocode({ 'address': address }, function (results, status) { if (status == google.maps.GeocoderStatus.OK) { map.setCenter(results[0].geometry.location); var marker = new google.maps.Marker({ map: map, position: results[0].geometry.location }); } else { console.log('can not geocde that address' + address); } }); } } function gmaps_results_initialize() { var markers = []; //some array geocoder = new google.maps.Geocoder(); var map = new google.maps.Map(document.getElementById('providerMapCanvas'), { zoom: 14, center: new google.maps.LatLng(41.245019, -96.048286), }); jQuery('.practice.formap').each(function () { //console.log(jQuery(this).data('address')); if (jQuery(this).data('address') != '') { // console.log('geocode'); geocoder.geocode({ 'address': jQuery(this).data('address') }, function (results, status) { if (status == google.maps.GeocoderStatus.OK) { map.setCenter(results[0].geometry.location); var marker = new google.maps.Marker({ map: map, position: results[0].geometry.location }); } else { console.log('can not geocde that address'); } }); } }); // zoom to bounds } function gmaps_results_initialize_location_2() { var markers = []; //some array geocoder = new google.maps.Geocoder(); var map = new google.maps.Map(document.getElementById('locationMapCanvas_2'), { zoom: 10, center: new google.maps.LatLng(41.245019, -96.048286), }); address = jQuery('#locationMapCanvas_2').parent().data('address'); //console.log(address); if (address != '') { // console.log('geocode'); geocoder.geocode({ 'address': address }, function (results, status) { if (status == google.maps.GeocoderStatus.OK) { map.setCenter(results[0].geometry.location); var marker = new google.maps.Marker({ map: map, position: results[0].geometry.location }); } else { console.log('can not geocde that address' + address); } }); } } function mobileTransition() { if (jQuery(window).width() < 767 && jQuery(window).width() > 600) { if (!jQuery('#primary-menu.find-hidden').length) { items = jQuery('#primary-menu > li:nth-of-type(1n+2) > a'); items.each(function () { innerText = jQuery(this).text(); if (innerText.search("Find") > -1) { innerTextFixed = innerText.replace('Find', 'Find'); jQuery(this).html(innerTextFixed); } }); jQuery('#primary-menu').addClass('find-hidden'); } } else if (jQuery(window).width() > 767) { if (jQuery('#primary-menu.find-hidden').length) { items = jQuery('#primary-menu > li:nth-of-type(1n+2) > a'); items.each(function () { innerText = jQuery(this).text(); if (innerText.search("Find") > -1) { innerTextFixed = innerText.replace('Find', 'Find'); jQuery(this).html(innerTextFixed); } }); jQuery('#primary-menu').removeClass('find-hidden'); } } /* move the top right menu into the main menu*/ //console.log('calling mobile'); if (jQuery(window).width() < 600) { // console.log('m'); if (!jQuery('body.in-mobile').length) { menuparts = jQuery('#menu-top-right-menu li'); jQuery(menuparts).each(function () { //jQuery(this).addClass('from-top-menu'); }); jQuery('#primary-menu > li#menu-item-search-parent').last().fadeOut(); //menuparts.appendTo(jQuery('#primary-menu')); // console.log(jQuery( '#menu-large-footer-menu li:has(ul)' )); // prepend closer jQuery('#primary-menu').prepend("