Global Directory

Need to locate a UPS Global Freight Forwarding service location? Use our global locator, and whether by air, ocean, road or rail, we’ll get it there for you.

Find a UPS Location

Place your location information in the fields provided below to find nearest UPS service locations.

<style>#map { height: 1525px; } #map-container { position: relative; height: 1525px; border-top: 15px solid #ffc402; margin-top: 23px; font-family: 'Roboto'; box-shadow: 0px 2px 5px rgba(0, 0, 0, 0.14), 0px 4px 12px -3px rgba(0, 0, 0, 0.05); } #side-panel { position: absolute; max-width: 388px; height: 1525px; background-color: #fff; top: 0; left: 0; z-index: 99; padding: 17px 19px 46px 17px; overflow: auto; } #toggle-button { position: relative; top: 0px; left: 200px; z-index: 99; } .details-card_cont { margin-bottom: 10px; border-bottom: 1px solid #DFDBD7; position: relative; } .details-card { padding: 10px; margin-left: 26px; } .details-card h2 { font-size: 20px; line-height: 32px; font-weight: 400; font-family: 'Roboto'; margin: 0; max-width: 370px; } .card-directions { max-width: 220px; line-height: 22px; font-weight: 400; font-family: 'Roboto'; margin: 10px 0; font-size: 16px; } .headPara { font-size: 16px; line-height: 25px; color: #000000; margin-bottom: 20px; font-family: 'Roboto'; padding-left: 10px; } span.numPos { position: absolute; left: 4px; top: 14px; border-radius: 50%; background: #C2E3E2; font-size: 12px; font-family: 'Roboto'; font-weight: bold; display: flex; justify-content: center; align-items: center; width: 24px; height: 24px; } @media(max-width: 993px) { span.numPos { left: 15px; top: -2px; } } .result-conatiner { margin-top: 37px; } .facilities { padding: 10px 0; font-family: 'Roboto'; font-size: 14px; margin-left: 26px; } span.items { min-width: auto; width: 45%; color: #121212; display: inline-block; margin-left: 10px; margin-bottom: 15px; } span.services { font-family: 'Roboto'; font-weight: 500; margin-left: 8px; } .sideContainer { display: none; } .sideContainer .ups-accordion_wrapper { margin-top: 0; padding-top: 0; } .Containers_box { position: absolute; right: -430px; width: 384px; top: 0px; background-color: white; } .right { float: right; font-size: 16px; font-weight: 600; color: #0662BB !important; } .tileContent { height: fit-content; margin: 20px; border-bottom: 1px solid #DFDBD7; } .tileContent a figcaption { color: #0662BB; font-weight: 500; } button.details_link { background: no-repeat; border: none; font-size: 14px; font-family: 'Roboto'; position: absolute; right: 10px; top: 135px; text-decoration: none; color: #0662BB; font-weight: 500; } .page_cont { width: 100%; padding: 15px 5px; margin-bottom: 14px; font-size: 14px; border-bottom: 1px solid #DFDBD7; } .head { font-size: 26px; font-family: Roboto; color: #121212; font-weight: 400; margin: 0; margin-bottom: 7px; padding-left: 10px; } .paginate, .move { font-family: 'Roboto'; line-height: 20px; color: #121212; } span.items.icon:before { margin-right: 4px; } .icon.ups-icon-tick-mark:before { color: #29A855; } .icon.ups-icon-close:before { color: #DF2901; font-weight: bold; } .move { background: none; border: none; color: #0662BB !important; font-weight: 600; } .ups-input_wrapper.location { position: relative; } .ups-input_wrapper.location button { position: absolute; top: 0; left: 0; background: none; border: 1px solid #757575; padding: 5px 8px; font-size: 16px; line-height: 23px; } .ups-input_wrapper.location input { text-indent: 35px; } @media (min-width:992px) { .d-flex { display: flex; } .paginate_maps, .subview { display: none; } } .Containers_box .ups-accordion_list .ups-accordion_wrapper .ups-accordion_content .ups-accordion-item .ups-accordion_expand .ups-contentBlock .ups-contentBlock_wrap p.list_items b { display: inline-block; color: #121212; font-family: 'Roboto'; font-weight: 500; margin-bottom: 4px; } .Containers_box .ups-accordion_list .ups-accordion_wrapper .ups-accordion_content .ups-accordion-item .ups-accordion_expand .ups-contentBlock .ups-contentBlock_wrap p.list_items.icon { margin-bottom: 16px; font-family: upsicons; } .Containers_box .ups-accordion_list .ups-accordion_wrapper .ups-accordion_content .ups-accordion-item .ups-accordion_expand .ups-contentBlock .ups-contentBlock_wrap p.list_items.icon:before { font-size: 12px; padding-right: 10px; margin-left: -20px; } .Containers_box .ups-accordion_list .ups-accordion_wrapper .ups-accordion_content .ups-accordion-item .ups-accordion_expand .ups-contentBlock .ups-contentBlock_wrap p.list_items.icon b { text-align: left; color: #121212; margin-bottom: 4px; } .Containers_box .ups-accordion_list .ups-accordion_wrapper .ups-accordion_content .ups-accordion-item .ups-accordion_expand .ups-contentBlock .ups-contentBlock_wrap p.list_items.icon .list_items_email { color: #616161; margin-top: 5px; word-break: break-word; } .Containers_box .ups-accordion_list .ups-accordion_wrapper .ups-accordion_content .ups-accordion-item .ups-accordion_expand .ups-contentBlock .ups-contentBlock_wrap { padding-left: 0px; } .txt-cntr { text-align: center; margin-top: 15px; } .txt-cntr a.ups-cta.ups-cta_primary { background: #080808; color: #fff; } .toggle_sides { position: absolute; width: 40px; height: 75px; top: 40px; left: 385px; background: #fff; opacity: .75; border: 1px solid #eee; z-index: 11; } .toggle_sides.hide_bar { left: 0px; top: 60px; } .toggle_sides:after { position: absolute; content: ""; border-right: 10px solid #333; border-top: 10px solid #fff; border-bottom: 10px solid #fff; top: 27px; left: 15px; } .toggle_sides.hide_bar:after { border-left: 10px solid #333; border-top: 10px solid #fff; border-bottom: 10px solid #fff; border-right: 0; } a.directions { color: #0662BB !important; font-family: 'Roboto'; border: 0; border-radius: 50%; position: absolute; right: 0px; top: 65px; text-align: center; margin: 15px; } a.directions:hover { text-decoration: none; } a.directions img { width: 40px; } button.ups-cta.displayshadowDom { background: #FFC400; color: #080808; font-family: 'Roboto'; margin: 5px; } .sideContainer .numPos { left: 10px; right: auto; background: #C2E3E2; color: #121212; font-family: upsicons; } .sideContainer .numPos.close { background: #fff; color: #fff; opacity: 1; left: auto; right: 10px; font-size: 16px; padding: 11px; cursor: pointer; } .sideContainer .numPos.close::before { color: #121212; } .sideContainer .ups-accordion_list { padding-top: 0 !important; } .slctCntr { margin: 0 auto; width: 310px; margin-bottom: 20px; margin-top: 36px; } .slctCntr h2.card-title, .slctCntr .card-telephone { font-family: 'Roboto'; font-weight: 500; } .slctCntr h2.card-title { margin-top: 10px; font-size: 20px; font-weight: 400; margin-left: 0px; } span.numPos.cardNum { top: 35px; } .ups-acc-headcont { letter-spacing: 2px; font-weight: 400; color: #121212; text-transform: uppercase; } .shadow-result-container { position: absolute; top: 250px; left: 100px; width: 450px; } .lower_viewport { display: none; } #populateMapList { display: none; } @media (max-width: 993px) { #populateMapList { display: block; } #map-container, #map { height: auto; } #map { height: 500px; } #side-panel { position: relative; width: 100%; height: auto; } .toggle_sides, .result-conatiner { display: none; } .paginate, .move { font-size: 16px; font-weight: 400; font-family: 'Roboto'; } .lower_viewport { margin: 40px 20px; } .sideContainer_small { margin-bottom: 10px; display: none; } .sideContainer_small .Containers_box { position: relative; top: unset; right: unset; width: 100%; background-color: white; } #populateMapList { position: relative; max-width: 450px; width: 100%; margin: 0 auto; display: block; } .sideContainer_small .Containers_box .tileContent { background-color: white; } .sideContainer_small .Containers_box .tileContent .slctCntr { margin: 0 0 0 30px; width: 100%; } .flex_obj { display: flex; flex-wrap: wrap; margin-bottom: 20px; } .sideContainer_small .Containers_box .tileContent .ups-cta_primary { position: relative; right: unset; top: unset; border-radius: 20px; color: #0f0c0c; } .sideContainer_small .Containers_box .tileContent .ups-cta { flex: 1; margin: 0 10px 0 0; box-shadow: 0px 2px 5px rgba(0, 0, 0, 0.14), 0px 4px 12px -3px rgba(0, 0, 0, 0.05); } .sideContainer_small.displayonMap { display: block !important; z-index: 21; bottom: 0; left: 0; width: 100%; } .shadow-result-container.displayformap .ups-accordion_list .ups-accordion_wrapper { margin: 0; } .shadow-result-container.displayformap { display: block !important; position: relative; top: 0; left: 0; width: 100%; } .shadow-result-container.displayformap .numPos.close, .shadow-result-container.displayformap .directions { display: none; } .shadow-result-container.displayformap .subview { display: block; width: 100%; } .Containers_box { position: absolute; left: 0; width: 100%; top: 25px; } .slctCntr { width: 270px; } .slctCntr h2.card-title { font-size: 18px; } .card-directions { max-width: 300px; } } @media (min-width: 768px) and (max-width:992px) { #map-container, #map { height: auto; } #populateMapList { display: block; } .global-directory-search .ups-wrap_inner { max-width: 450px; margin: 0 auto; } .global-directory-search .ups-wrap_inner button:not(#current-location-button, .move) { width: 100%; } .lower_viewport { margin: 40px 0 60px; } #map { height: auto; } #side-panel { position: relative; width: 100%; } #side-panel .side-panel_container { width: 450px; margin: 0 auto; } .shadow-result-container { top: unset; left: 22%; width: 100%; max-width: 450px; height: 500px; bottom: -200px; display: none; } .toggle_sides, .result-conatiner { display: none; } .shadow-result-container .page_cont { top: -30px; position: absolute; padding: 0; left: 23%; border: none; width: 450px; margin: 0 auto; } .shadow-result-container .page_cont .paginate, .shadow-result-container .page_cont .move { font-size: 16px; } .shadow-result-container .sideContainer .Containers_box { right: 0; } .sideContainer_small { margin-bottom: 10px; border: 1px solid #707070; display: none; } .sideContainer_small .Containers_box { position: relative; top: unset; right: unset; width: 100%; } .sideContainer_small .Containers_box .tileContent { background-color: white; } .sideContainer_small .Containers_box .tileContent .slctCntr { margin: 0; width: 385px; } .flex_obj { display: flex; } .sideContainer_small .Containers_box .tileContent .ups-cta_primary { position: relative; right: unset; top: unset; border-radius: 20px; color: #0f0c0c; } .sideContainer_small .Containers_box .tileContent .ups-cta { width: 100%; } .sideContainer_small.displayonMap { display: block !important; z-index: 21; bottom: 0; left: 25%; } .shadow-result-container.displayformap { display: block !important; position: relative; top: 0; } .shadow-result-container.displayformap .numPos.close, .shadow-result-container.displayformap .directions { display: none; } .shadow-result-container.displayformap .subview { display: block; width: 100%; } } .list_items.icon.ups-icon-x:before { color: #EA413A; } .list_items.icon.ups-icon-check:before { color: #9DD6AD; } .maintain_distance { margin-left: 20px; } .sideContainer .ups-accordion_wrapper .ups-accordion_content .ups-accordion-item { margin-top: 0px; } .result-conatiner .details-card_cont .details-card .card-telephone { white-space: pre-line; line-height: 1.5; font-weight: 500; margin-bottom: 0; } .shadow-result-container .sideContainer .Containers_box .ups-accordion_list .ups-accordion_wrapper .ups-wrap_inner .ups-contentBlock_wrap .list_items { word-break: break-word; font-family: 'Roboto'; } .shadow-result-container .Containers_box .ups-accordion_list .ups-accordion_wrapper .ups-accordion_content { background-color: #fff; padding: 0px 20px 20px 20px; display: flex; justify-content: space-between; } .shadow-result-container .Containers_box .ups-accordion_list .ups-accordion_wrapper .ups-accordion_content .ups-accordion-item { width: 48%; } .shadow-result-container .Containers_box .ups-accordion_list .ups-accordion_wrapper .ups-accordion_content .ups-accordion-item .ups-accordion-toggle { font-family: 'Roboto'; font-weight: 600; font-size: 12px; margin-bottom: 16px; } .Containers_box .ups-accordion_list .ups-accordion_wrapper .ups-accordion_content .ups-accordion-item .ups-accordion_expand .ups-contentBlock .ups-contentBlock_wrap p.list_items span { display: block; color: #080808; font-family: 'Roboto'; font-weight: 400; word-break: break-word; } .Containers_box .ups-accordion_list .ups-accordion_wrapper .ups-accordion_content .ups-accordion-item .ups-accordion_expand .ups-contentBlock { margin-bottom: 0 !important; } .Containers_box .ups-accordion_list .ups-accordion_wrapper .ups-accordion_content .ups-accordion-item .ups-accordion_expand .ups-contentBlock .ups-wrap_inner .ups-contentBlock_wrap p { margin-bottom: 16px; word-break: break-word; } .d-flex { justify-content: space-around; } .ups-form_group { width: 30%; position: relative; } @media (max-width: 992px) { .ups-form_group { width: 100%; } } .ups-input_wrapper.location input { text-indent: 5px; padding-top: 0.7rem; } select { padding: 1.5rem 2rem 0.5rem 0.75rem; } .ups-form_label { position: absolute; top: 0.125rem; font-size: 0.75rem; font-weight: 500; padding: 0; left: 0.75rem; color: #5f5753; z-index: 5; line-height: 1.5rem; } input#user-location { padding: 16px; } </style>

<div class="global-directory-container ups-container"><div class=global-directory-search><div class=ups-wrap><div class=ups-wrap_inner><div class="d-flex row ups-form_wrap"><div class="ups-form_group typed ups-dropdown-control country-input"><label class=ups-form_label for=countries>Select a Country or Territory</label><div class="ups-input_wrapper ups-dropdown_wrapper"><select class=ups-dropdown id=country-select name=countries><option value=-1>Select</select></div></div><div class="ups-form_group location-input ups-input"><label class=ups-form_label for=location></label><div class="ups-input_wrapper location ups-text_wrapper"><input class=ups-form_input id=user-location placeholder="Postal Code or City"></div></div><div class="ups-form_group typed ups-dropdown-control service-input"><label class=ups-form_label for=services>Select a Service</label><div class="ups-input_wrapper ups-dropdown_wrapper"><select class=ups-dropdown id=service-select name=services><option value="">All<option value="Air Freight">Air Freight<option value="Ocean Freight">Ocean Freight<option value="Ground Freight">Ground Freight<option value=Brokerage>Brokerage</select></div></div></div><div class=txt-cntr><button class="ups-cta search-button ups-analytics ups-cta-primary"id=search-button type=button>Search<span aria-hidden=true class="icon ups-icon-right-arrow"></span></button></div></div></div><div class=ups-wrap_inner><div class="txt-cntr lower_viewport"id=lower_viewport><button class="ups-cta search-button ups-cta_primary"id=listView type=button>View List</button></div><div class=paginate_maps></div></div></div><div id=map-container style=display:none><div id=map></div><div id=populateMapList></div><div id=side-panel><div class=side-panel_container><h3 class=head>Ready to Ship Your Freight Now?</h3><p class=headPara>Get your freight quote online on the UPS<sup>®</sup> Forwarding Hub, book and track shipments and manage your shipping details on one easy-to-navigate dashboard.<div><a class="ups-cta ups-analytics ups-cta-primary"href=https://scsapps.ups.com/ >Get a Freight Quote <span aria-hidden=true class="icon ups-icon-right-arrow"></span></a></div><div class=result-conatiner></div></div></div><button class=toggle_sides></button><div class=shadow-result-container id=shadow-result-container></div></div></div>

<script>

        var countryVAl = '', isFocusEnabled = false;

        $('#user-location').on("keyup", action);

        $('#country-select').on("change", function () {

            countryVAl = $(this).val();

            $("#user-location").val('');

            action();

        });

        action();

        $('#user-location,#country-select,#service-select').on("focus", function () {

            if (!isFocusEnabled) {

                isFocusEnabled = true;

                var obj = {

                    destination_url: "#",

                    link_name: "Form Focus",

                    link_page_name: document.title,

                    event_desc: "Initiation | Global Directory Search",

                    event_flag: "generic_event_counter",

                    form_name: "Global Directory"

                }

                callAnalytics(obj);

            }

        });

        function action() {

            if ($('#country-select').val() == '-1' || $('#country-select').val() == 'US') {

                if ($("#user-location").val() == '') {

                    $('#search-button').prop("disabled", true);

                } else {

                    $('#search-button').prop("disabled", false);

                }

            } else {

                $('#search-button').prop("disabled", false);

            }

        }

        function geoLocate() {

            navigator.geolocation.getCurrentPosition(success, fail, { enableHighAccuracy: false, maximumAge: 'Infinity', timeout: 10000 })

        }

        function fail(e) {

            console.log(e)

        }

        function success(position) {

            const geocoder = new google.maps.Geocoder();

            const pos = {

                lat: position.coords.latitude,

                lng: position.coords.longitude,

            };

            var latlng = new google.maps.LatLng(pos);

            geocoder.geocode({ 'latLng': latlng }, function (results, status) {

                if (status !== google.maps.GeocoderStatus.OK) {

                    console.log(status);

                }

                if (status == google.maps.GeocoderStatus.OK && results.length > 0) {

                    var address = (results[0].formatted_address);

                    if (results[0].address_components.length > 0) {

                        results[0].address_components.forEach(function (data) {

                            if (data.types.indexOf('country') > -1) {

                                $('#country-select option[value="' + data.short_name + '"]').attr("selected", "selected");

                                countryVAl = data.short_name;

                            }

                        });

                    }

                    document.getElementById('user-location').value = address;

                    $('#search-button').prop("disabled", false);

                }

            });

        }

        function geocodeAddress(geocoder, resultsMap, allMarkers) {

            let address = document.getElementById("user-location").value;

            var radius = 200;

            if (address == null || address == '') {

                address = $("#country-select option:selected").text()

            }

            geocoder.geocode({ address: address }, function (results, status) {

                if (status === "OK") {

                    resLatLng = results[0].geometry.location;

                    map = new google.maps.Map(document.getElementById('map'), {

                        center: resLatLng,

                        zoom: 9,

                        gestureHandling: "cooperative"

                    });

                    markers = allMarkers.filter(function (marker) {

                        if (marker) {

                            if (($("#country-select").val() == 'US') && $("#user-location").val() != '' && google.maps.geometry.spherical.computeDistanceBetween(marker['maps'].getPosition(), results[0].geometry.location) < 643737) {

                                marker['distance'] = google.maps.geometry.spherical.computeDistanceBetween(marker['maps'].getPosition(), results[0].geometry.location);

                                return marker;

                            } else if ($("#country-select").val() != 'US') {

                                if ($("#user-location").val() != '' && google.maps.geometry.spherical.computeDistanceBetween(marker['maps'].getPosition(), results[0].geometry.location) < 643737) {

                                    marker['distance'] = google.maps.geometry.spherical.computeDistanceBetween(marker['maps'].getPosition(), results[0].geometry.location);

                                    return marker;

                                } else {

                                    marker['distance'] = google.maps.geometry.spherical.computeDistanceBetween(marker['maps'].getPosition(), results[0].geometry.location);

                                    return marker;

                                }

                            }

                        }

                    });

                    markers.sort(function (a, b) { return a['distance'] - b['distance'] });

                    if (markers.length > maxResult) {

                        maxPageNumber = markers.length / maxResult;

                    } else {

                        maxPageNumber = 1;

                    }

                    paintResult(0);

                } else {

                    alert("Geocode was not successful for the following reason: " + status);

                }

            });

        }

        function paintResult(counter) {

            var markersLen = 0;

            if (markers?.length > 0) {

                const anayltics = {

                    link_name: "Search",

                    link_page_name: document.title,

                    event_desc: "Search Results Loaded | Global Directory Search",

                    event_flag: "generic_event_counter",

                    on_site_search_results: markers?.length,

                    on_site_search_term: $("#country-select").val() + " | " + $("#user-location").val() + " | " + $("#service-select").val(),

                    on_site_search_type_super_category: "Global Directory",

                }

                callAnalytics(anayltics);

                markersLen = markers.length;

                markers.forEach(function (marker) { marker['maps'].setMap(null) });

                let drawMarkers = markers.filter(function (data, i) {

                    if (counter == 0 && i < (counter + 1) * maxResult) {

                        return data;

                    } else if (counter > 0 && (counter * maxResult) <= i && i < (counter + 1) * maxResult) {

                        return data;

                    }

                });

                document.getElementById("map-container").style.display = "block";

                var card = '', shadowCard = "", mapCards = '';

                $.each(drawMarkers, function (i, item) {

                    item['maps'].setMap(map)

                    google.maps.event.addListener(item['maps'], 'click', function (e) {

                        if (windowWidth < 992) {

                            $(".sideContainer_small").removeClass('displayonMap').hide();

                            $("#displaymap" + i).addClass("displayonMap");

                            $("#side-panel").show();

                        } else {

                            $('.sideContainer').hide();

                            $('.sideContainer#shadow' + i).show();

                        }

                        var obj = {

                            destination_url: "#",

                            link_name: "Location Pins | Global Directory Results Map",

                            link_page_name: document.title,

                            event_desc: "Interaction | Global Directory Results Map",

                            event_flag: "generic_event_counter"

                        }

                        callAnalytics(obj);

                    });

                    if (windowWidth < 992) {

                        document.getElementById("lower_viewport").style.display = "block";

                        document.getElementById("shadow-result-container").style.display = "none";

                    } else {

                        document.getElementById("shadow-result-container").style.display = "block";

                    }

                    item['maps'].setLabel(((counter * maxResult) + (i + 1)).toString());

                    let comma = item.zipCode.length == 0 && item.stateCode != 0 ? ' ' : ' ';

                    let statezip = item.stateCode.length == 0 && item.zipCode.length == 0 ? ' ' : ', ';

                    card += "<div class='details-card_cont'><div class='details-card'>" +

                        "<span class='numPos'>" + ((counter * maxResult) + (i + 1)) + "</span> <h2 class='card-title'>" + item.companyName + "</h2>" +

                        "<p class='card-directions'>" + item.address + '<br/>' + item.city + statezip + item.stateCode + comma + item.zipCode + "</p>" +

                        "<p class='card-directions'>" + item.country + "</p>" +

                        "<p class='card-telephone'>" + item.phone + "</p>" +

                        "<a href='https://www.google.com/maps/dir/" + document.getElementById("user-location").value + "/" + item.address + ', ' + item.city + ", " + item.country + ", " + item.zipCode + "/' class='directions' target='_blank'><img src='/assets/resources/webcontent/supplychain/images/Icon-Map.png' alt='directions'/></a>"

                        +

                        "<button class='details_link' data-id='shadow" + i + "'>Details</span></button></div>" +

                        "<div class='facilities'><span class='items icon " + (item.isAirFreight ? 'icon ups-icon-tick-mark' : 'icon ups-icon-close') + "'><span class='services'>Air Freight</span></span><span class='items  icon " + (item.isGroundFreight ? 'icon ups-icon-tick-mark' : 'icon ups-icon-close') + "'><span class='services'>Ground Freight</span></span><span class='items icon " + (item.isOceanFreight ? 'icon ups-icon-tick-mark' : 'icon ups-icon-close') + "'><span class='services'>Ocean Freight</span></span><span class='items icon " + (item.isBrokerage ? 'icon ups-icon-tick-mark' : 'icon ups-icon-close') + "'><span class='services'>Brokerage</span></span></div></div>";

                    shadowCard += inforWindowContent(item, counter, i)

                    mapCards += smallViewContent(item, counter, i)

                });

                if (maxPageNumber > 1) {

                    pageniate = '<div class="page_cont"><span class="paginate">Showing ' + ((maxResult * counter) + 1) + '-' + (((maxResult * counter) + 5) < markersLen ? (maxResult * counter) + 5 : markersLen) + ' of ' + markersLen + '</span><span class="paginate right">&#5176; <button class="prev move">Prev 5</button> | <button class="next move">Next 5 &#5171;</button></span></div>'

                }

                $('.result-conatiner').html(pageniate + card + pageniate);

                $(".paginate_maps").html(pageniate);

                $("#populateMapList").html(mapCards);

                $('.shadow-result-container').html(shadowCard);

                var accordionWrapper = $('.ups-accordion_wrapper');

                for (var i = 0; i < accordionWrapper.length; i++) {

                    $(accordionWrapper[i]).upsAccordion({});

                }

            } else {

                const anayltics = {

                    link_name: "Search",

                    link_page_name: document.title,

                    event_desc: "No Results found | Global Directory Search",

                    event_flag: "generic_event_counter",

                    on_site_search_results: 0,

                    on_site_search_term: $("#country-select").val() + " | " + $("#user-location").val() + " | " + $("#service-select").val(),

                    on_site_search_type_super_category: "Global Directory",

                }

                callAnalytics(anayltics);

            }

        }

        let markers, resLatLng, counter = 0, pagination = 0, pageniate = '', markersLocArray, pagenumber = 0, maxResult = 5, maxPageNumber = 0;

        function inforWindowContent(item, counter, i) {

            let airemail = $.trim(item.airEmail);

            let comma = item.zipCode.length == 0 && item.stateCode != 0 ? ' ' : ' ';

            let statezip = item.stateCode.length == 0 && item.zipCode.length == 0 ? ' ' : ', ';

            return "<div class='sideContainer' id='shadow" + i + "'><div class='Containers_box'><div class='tileContent'><span class='numPos close icon ups-icon-close'></span>" +

                "<div class='slctCntr'><span class='numPos cardNum'>" + ((counter * maxResult) + (i + 1)) + "</span><h2 class='card-title'>" + item.companyName + "</h2><p class='card-directions'>" + item.address + '<br/>' + item.city + statezip + item.stateCode + comma + item.zipCode + "</p>" +

                "<p class='card-directions'>" + item.country + "</p></div><a href='https://www.google.com/maps/dir/" + document.getElementById("user-location").value + "/" + item.address + item.city + ", " + item.country + ", " + item.zipCode + "/' class='directions' target='_blank'><img src='/assets/resources/webcontent/supplychain/images/Icon-Map.png' alt='directions'/><figcaption>Directions</figcaption></a><a class='ups-cta subview' href='https://www.google.com/maps/dir/" + document.getElementById("user-location").value + "/" + item.address + item.city + ", " + item.country + ", " + item.zipCode + "/'>Directions</a></div><div class='ups-accordion_list'><div class='ups-wrap_inner ups-analytics-render'><div class='ups-accordion_wrapper' data-noscroll='true'><div class=ups-accordion_content role=presentation><div class=ups-accordion-item><div class=ups-acc-headcont role=heading aria-level=3><div class='ups-accordion-toggle ups-analytics' href=# role=button aria-expanded=false aria-controls=ups-accordionPanel1 id=ups-accordionHead1 data-content-block-id=M22 data-event-id=21 data-list-title='Freight 101 FAQs'>CONTACT INFO</div></div><div class=ups-accordion_expand role=region aria-hidden=true id=ups-accordionPanel1 aria-labelledby=ups-accordionHead1><div class='ups-contentBlock'><div class=ups-wrap_inner><div class='ups-contentBlock_wrap clearfix'><p class='list_items'><b>Phone</b> <span>" + item.phone + " </span> </p>" + (item.fax ? "<p class='list_items'><b>Fax</b> <span> " + item.fax + "</span> </p>" : "") +

                (item.airEmail && item.airEmail != '' ? "<p class='list_items'><b>Air Email</b><span>" + item.airEmail + "</span></p>" : "") +

                (item.oceanEmail && item.oceanEmail != '' ? "<p class='list_items'><b>Ocean Email</b>: " + item.oceanEmail + "</p>" : "") +

                "</div></div></div></div></div><div class=ups-accordion-item><div class=ups-acc-headcont role=heading aria-level=3><div class='ups-accordion-toggle ups-analytics' href=# role=button aria-expanded=false aria-controls=ups-accordionPanel7 id=ups-accordionHead7 data-content-block-id=M22 data-event-id=21 data-list-title='Freight 101 FAQs'>SERVICES AVAILABLE</div></div><div class=ups-accordion_expand role=region aria-hidden=true id=ups-accordionPanel7 aria-labelledby=ups-accordionHead7><div class='ups-contentBlock'><div class=ups-wrap_inner><div class='ups-contentBlock_wrap clearfix'><div class='ups-contentBlock_wrap clearfix'><div class='maintain_distance'><p class='list_items icon " + (!item.isAirFreight ? 'ups-icon-close' : 'ups-icon-tick-mark') + "'><b>Air Freight</b><span class='list_items_email'>" + (item.isAirFreight ? (item.airEmail ? airemail : '') : " ") + "</span></p><p class='list_items icon " + (!item.isGroundFreight ? 'ups-icon-close' : 'ups-icon-tick-mark') + "'><b>Ground Freight</b></p>" + "<p class='list_items icon " + (!item.isOceanFreight ? 'ups-icon-close' : 'ups-icon-tick-mark') + "'><b>Ocean Freight</b></p>" + "<p class='list_items icon " + (!item.isBrokerage ? 'ups-icon-close' : 'ups-icon-tick-mark') + "'><b>Brokerage</b></p>" + "</div></div></div></div></div></div></div></div></div></div></div></div></div>"

        }

        function smallViewContent(item, counter, i) {

            let comma = item.zipCode.length == 0 && item.stateCode != 0 ? ' ' : '  &nbsp';

            let statezip = item.stateCode.length == 0 && item.zipCode.length == 0 ? ' ' : ', ';

            return "<div class='sideContainer_small' id='displaymap" + i + "'><div class='Containers_box'><div class='tileContent'><span class='numPos'>" + ((counter * maxResult) + (i + 1)) + "</span>" +

                "<div class='slctCntr'><h2 class='card-title'>" + item.companyName + "</h2><p class='card-directions'>" + item.address + '<br/>' + item.city + statezip + item.stateCode + comma + item.country + ", " + item.zipCode + "</p>" +

                "<p class='card-telephone'>" + item.phone + "</p></div><div class='flex_obj'><a href='https://www.google.com/maps/dir/" + document.getElementById("user-location").value + "/" + item.address + item.city + ", " + item.country + ", " + item.zipCode + "/' class='directions ups-cta ups-cta_primary' target='_blank'>Directions</a><button class='ups-cta displayshadowDom' data-id='" + i + "'>Details</button></div></div></div></div>";

        }

        function addCircle(center) {

            circle = new google.maps.Circle({ map, center, radius: 643737.6, zindex: 100 });

        }

        function callAnalytics(utag_data) {

            var updateObj = {}

            Object.assign(updateObj, window['utag_data'], utag_data);

            if (window['utag'] != undefined) {

                utag.track("link", updateObj);

            }

        }

        var windowWidth = $(window).width();

        $(document).ready(function () {

            let timestamp = new Date().getTime().toString();

            const calculatetime = timestamp

                .substr(timestamp.length - 6)

                .split('')

                .map(Number)

                ?.reduce(function (acc, val) {

                    return acc + val;

                }, 0);

            const scskey = btoa(

                '2cb220c0-9972-41ed-bc6d-257433b6d0ae^' + timestamp + '|' + calculatetime

            );

            $.ajax({

                url: "https://scsapps.ups.com/api/ufhapp/geo/GetGlobalDirectoryCountries",

                type: "get",

                header: { 'SCS-API-KEY': scskey },

                beforeSend: function (jqXHR, settings) {

                    jqXHR.setRequestHeader('scs-api-key', scskey

                    );

                },

                success: function (data) {

                    var script = document.createElement('script');

                    script.onload = function () {

                        console.log("Script loaded and ready");

                        geocoder = new google.maps.Geocoder();

                        infoWindow = new google.maps.InfoWindow();

                        geoLocate();

                    };

                    script.defer = true;

                    script.src = "https://maps.googleapis.com/maps/api/js?key=" + data.marketingGoogleAPIKey + "&libraries=geometry,places";

                    document.getElementsByTagName('head')[0].appendChild(script);

                    if (data.countryDetails.length > 0) {

                        data.countryDetails.forEach(function (item) {

                            $("#country-select").append("<option value='" + item.code + "'>" + item.name + "</option>")

                        })

                    }

                }

            })

            let geocoder, infoWindow;

            geoLocate()

            $(document).on("click", ".details_link", function (e) {

                var count = $(this).data('id');

                $('.sideContainer').hide();

                $('.sideContainer#' + count).show();

                $('html, body').animate({

                    scrollTop: $(".shadow-result-container").offset().top - 250

                }, "fast");

                var obj = {

                    destination_url: "#",

                    link_name: "Details | Global Directory Results Map",

                    link_page_name: document.title,

                    event_desc: "Interaction | Global Directory Results Map",

                    event_flag: "generic_event_counter"

                }

                callAnalytics(obj);

            });

            $(document).on("click", ".prev", function () {

                if (counter > 0) {

                    counter--;

                    paintResult(counter)

                }

            });

            $(document).on("click", ".next", function () {

                if (counter < Math.floor(maxPageNumber)) {

                    counter++;

                    paintResult(counter)

                }

            });

            $(document).on("click", ".close", function () {

                $(this).parents(".sideContainer").hide();

                if (windowWidth < 992) {

                    $("#shadow-result-container").hide();

                }

            })

            $(document).on("click", ".toggle_sides", function () {

                $(this).toggleClass("hide_bar");

                $("#side-panel").toggle('slow');

            })

            $(window).resize(function (e) {

                windowWidth = $(this).width();

                if (map) {

                    if (windowWidth > 992) {

                        $("#lower_viewport").hide();

                    } else {

                        if (markers?.length > 0) {

                            $("#lower_viewport").show();

                        }

                    }

                }

            });

            $("#search-button").click(function () {

                let timestamp = new Date().getTime().toString();

                const calculatetime = timestamp

                    .substr(timestamp.length - 6)

                    .split('')

                    .map(Number)

                    ?.reduce(function (acc, val) {

                        return acc + val;

                    }, 0);

                const scskey = btoa(

                    '2cb220c0-9972-41ed-bc6d-257433b6d0ae^' + timestamp + '|' + calculatetime

                );

                $.ajax({

                    type: "GET",

                    url: "https://scsapps.ups.com/api/ufhapp/geo/GetGlobalDirectoryData",

                    data: { 'countryCode': $("#country-select").val() },

                    contentType: "application/json; charset=utf-8",

                    dataType: "json",

                    header: { 'SCS-API-KEY': scskey },

                    beforeSend: function (jqXHR, settings) {

                        jqXHR.setRequestHeader('scs-api-key', scskey

                        );

                    },

                    success: function (data) {

                        pagenumber = 0;

                        markers, resLatLng, counter = 0, pagination = 0, pageniate = '', markersLocArray, maxResult = 5, maxPageNumber = 0

                        if (data instanceof Array && data?.length > 0) {

                            const contentData = data;

                            document.getElementById("map-container").style.display = "none";

                            markersLocArray = contentData.filter(function (data1, i) {

                                if ($('#service-select').val() == '' && data1.latitude != 0 && data1.longitude != 0) {

                                    data1['maps'] = new google.maps.Marker({ position: { lat: data1.latitude, lng: data1.longitude } })

                                    return data;

                                } else if ($('#service-select').val() == 'Air Freight' && data1.isAirFreight && data1.latitude != 0 && data1.longitude != 0) {

                                    data1['maps'] = new google.maps.Marker({ position: { lat: data1.latitude, lng: data1.longitude } })

                                    return data;

                                } else if ($('#service-select').val() == 'Ocean Freight' && data1.isOceanFreight && data1.latitude != 0 && data1.longitude != 0) {

                                    data1['maps'] = new google.maps.Marker({ position: { lat: data1.latitude, lng: data1.longitude } })

                                    return data;

                                } else if ($('#service-select').val() == 'Ground Freight' && data1.isGroundFreight && data1.latitude != 0 && data1.longitude != 0) {

                                    data1['maps'] = new google.maps.Marker({ position: { lat: data1.latitude, lng: data1.longitude } })

                                    return data;

                                } else if ($('#service-select').val() == 'Brokerage' && data1.isBrokerage && data1.latitude != 0 && data1.longitude != 0) {

                                    data1['maps'] = new google.maps.Marker({ position: { lat: data1.latitude, lng: data1.longitude } })

                                    return data;

                                } else {

                                }

                            });

                            markersLocArray?.forEach(function (marker) { marker['maps'].setMap(null) });

                            if (markersLocArray.length > 0) {

                                geocodeAddress(geocoder, map, markersLocArray);

                            }

                        }

                    },

                    failure: function (data) {

                    },

                    error: function (data) {

                    }

                });

            });

            $("#user-location").keyup(function (countriess) {

                if ($("#country-select").val() != '-1') {

                    const options = {

                        fields: ["address_components", "geometry", "icon", "name"],

                    };

                    const autocomplete = new google.maps.places.Autocomplete(document.getElementById('user-location'), options);

                    autocomplete.setComponentRestrictions({ country: countryVAl });

                    autocomplete.setOptions({ offset: 3 });

                    const infowindow = new google.maps.InfoWindow();

                    const infowindowContent = document.getElementById("infowindow-content");

                    infowindow.setContent(infowindowContent);

                    autocomplete.addListener("place_changed", function () {

                        infowindow.close();

                        const place = autocomplete.getPlace();

                        if (!place.geometry) {

                            return;

                        } else {

                        }

                    });

                }

            });

            $("#current-location-button").click(function () {

                geoLocate();

            });

            $(document).on("click", "#listView", function () {

                $(".sideContainer_small").toggle();

                $("#map").toggle();

                $("#shadow-result-container").removeClass('displayformap');

                $("#side-panel").show();

            });

            $(document).on("click", ".displayshadowDom", function () {

                $("#shadow" + $(this).data('id')).show();

                $("#shadow-result-container").addClass("displayformap");

                $(this).parents(".displayonMap").removeClass('displayonMap');

                $("#side-panel").hide();

            });

            $("#toggle-button").on('click', function () {

                $('#side-panel').toggle();

            });

            $(document).on("click", ".directions", function (e) {

                var obj = {

                    destination_url: $(this).attr('href'),

                    link_name: "Directions | Global Directory Results Map",

                    link_page_name: document.title,

                    event_desc: "Interaction | Global Directory Results Map",

                    event_flag: "generic_event_counter"

                }

                callAnalytics(obj);

            });

            $(document).on("click", ".ups-accordion_toggle", function () {

                if ($(this).attr('aria-expanded') == 'true') {

                    var obj = {

                        destination_url: "#",

                        link_name: $(this).text() + " | Global Directory Search Results",

                        link_page_name: document.title,

                        event_desc: "Interaction | Global Directory Results Map",

                        event_flag: "generic_event_counter"

                    }

                    callAnalytics(obj);

                }

            });

        });

</script>