Showing source for: https://embed.gabrielny.com/
Duration: 2.088413s
Server: Apache/2.4.33 (Amazon) OpenSSL/1.0.2k-fips PHP/5.6.40

<!doctype html>
<html class="iosfix">

<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no" />
    <meta name="author" content="">
    <meta name="theme-color" content="">
    <meta name="msapplication-navbutton-color" content="">
    <meta name="apple-mobile-web-app-status-bar-style" content="">
    <meta name="apple-mobile-web-app-capable" content="yes">
    <meta name="mobile-web-app-capable" content="yes">

    <link rel="shortcut icon" type="image/x-icon" href="https://cdn-themes.gabrielny.com/site2017theme/images/favicon.ico" />
    <link rel="icon" type="image/x-icon" href="https://cdn-themes.gabrielny.com/site2017theme/images/favicon.ico" />
    <link rel="apple-touch-icon" href="https://cdn-images.gabrielny.com/is/image/GabrielCo/thmimg-touch-icon?$trans$" />
    <!-- IE8 & lower version CSS -->
    <!--[if (lte IE 8) & (!IEMobile)]>
      <link href="https://cdn-themes.gabrielny.com/site2017theme/css/ie8.css" rel="stylesheet" type="text/css" />
      <![endif]-->
    
    <link rel="stylesheet" type="text/css" href="https://cdn-themes.gabrielny.com/site2017theme/css/fonts.css?v=70">
    <link rel="stylesheet" type="text/css" href="https://cdn-themes.gabrielny.com/site2017theme/css/metro-bootstrap.css?v=70">
    <link rel="stylesheet" type="text/css" href="https://cdn-themes.gabrielny.com/site2017theme/css/header-footer.css?v=70">
    <link rel="stylesheet" type="text/css" href="https://cdn-themes.gabrielny.com/site2017theme/css/jquery-ui.css?v=70">
    <link rel="stylesheet" type="text/css" href="https://cdn-themes.gabrielny.com/site2017theme/css/newtheme-items-slider.css?v=70">
    <link rel="stylesheet" type="text/css" href="https://cdn-themes.gabrielny.com/site2017theme/css/storewidget.css?v=70"> 
    <!-- HTML 5 And Responsd.js support for Other Browser -->
    <!-- HTML5 shim and Respond.js for IE8 support of HTML5 elements and media queries -->
    <!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
    <!--[if lt IE 9]><script src="https://oss.maxcdn.com/html5shiv/3.7.2/html5shiv.min.js"></script><script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script><![endif]-->
    <!-- HTML 5 And Responsd.js support for Other Browser -->

    <title>Engagement Rings & Fine Jewelry | Diamond Wedding Rings | Gabriel & Co</title>
<meta name="Description" content="Gabriel & Co fine jewelry represents so much more. See our collection of handcrafted engagement rings, jewelry, wedding rings and diamond bands for women.">
<meta name="keywords" content="Engagement Rings, Diamonds Wedding Rings, engagement ring, diamond rings, jewelry designer, diamond engagement rings, engagement rings for women">
<meta name="developer" content="Derek Hutchinson, James Bartlett">
<meta property="og:title" content="Engagement Rings & Fine Jewelry | Diamond Wedding Rings | Gabriel & Co" />
<meta property="og:description" content="Gabriel & Co fine jewelry represents so much more. See our collection of handcrafted engagement rings, jewelry, wedding rings and diamond bands for women." />
<meta property="og:price:amount" content="" />
<meta property="og:price:currency" content="" />
<meta property="product:price:amount" content="" />
<meta property="product:price:currency" content="" />
<meta name="revisit-after" content="3 days">
<meta name="distribution" content="global">
<link href="https://plus.google.com/+Gabrielnyjewelry/posts" rel="publisher" />
<link rel="alternate" hreflang="en-us" href="https://embed.gabrielny.com" />
<link rel="alternate" hreflang="en-ca" href="https://embed.gabrielny.ca" />
<link rel="canonical" href="https://www.gabrielny.com/" />

         <script type="application/ld+json">
            { "@context" : "http://schema.org",
              "@type" : "Organization",
              "name" : "Gabriel & Co.",
              "url" : "https://embed.gabrielny.com",
              "legalName" : "Gabriel & Company",
              "logo" : "https://images.gabrielny.com/is/image/GabrielCo/Default/~gabriel_structure_logo.jpg",
              "description": "See our collection of engagement rings, jewelry, wedding rings and bands for women at Gabriel & Co.",
              "brand": "Gabriel & Co",
              "sameAs" : [ "https://www.facebook.com/GabrielandCompanyNY",
                "https://www.twitter.com/GabrielCoNY",
                "https://www.pinterest.com/gabrielco",
                "https://instagram.com/gabrielandco",
                "https://plus.google.com/+Gabrielnyjewelry"
                ],
                 "location": [
                    {
                        "@type" : "PostalAddress",
                        "streetAddress" : "545 West 45th Street",
                        "addressLocality" : "New York",
                        "addressRegion" : "NY",
                        "postalCode": "10036"
                    }
                ],
                "contactPoint": [
                    { "@type": "ContactPoint",
                      "telephone": "+1-212-519-1400",
                      "contactType": "customer service"
                    }
                  ]
            }
            </script>
        
<script data-file="hash-preserver.js">(function() {
    'use strict';
    
    function preserveHash() {
        const hash = window.location.hash;
        if (hash && hash.length > 1) {
            try {
                sessionStorage.setItem('preservedHash', hash);
                sessionStorage.setItem('preservedHashURL', window.location.href);
            } catch (e) {
                console.warn('Could not store hash in sessionStorage:', e);
            }
        }
    }
    
    function restoreHash() {
        try {
            const preservedHash = sessionStorage.getItem('preservedHash');
            const preservedURL = sessionStorage.getItem('preservedHashURL');
            const isLoginPage = window.location.href.indexOf('/login') >= 0;
            
            if (!isLoginPage && preservedHash && preservedURL) {
                const currentURLWithoutHash = window.location.href.split('#')[0];
                const preservedURLWithoutHash = preservedURL.split('#')[0];
                if (currentURLWithoutHash === preservedURLWithoutHash) {
                    if (!window.location.hash || window.location.hash === '') {
                        window.location.hash = preservedHash;
                    }
                    sessionStorage.removeItem('preservedHash');
                    sessionStorage.removeItem('preservedHashURL');
                }
            }
        } catch (e) {
            console.warn('Could not restore hash from sessionStorage:', e);
        }
    }
    
    if (document.readyState === 'loading') {
        document.addEventListener('DOMContentLoaded', function() {
            preserveHash();
            restoreHash();
        });
    } else {
        preserveHash();
        restoreHash();
    }
    
    window.addEventListener('beforeunload', preserveHash);
    window.preserveHashFragment = preserveHash;
    window.restoreHashFragment = restoreHash;
})();

</script>
<script data-file="session.js">function checkLoggedInCookieEvery5Seconds() {
    if (window.location.href.indexOf('login') >= 0) {
        return
    }
    const gabrielny2013 = (window.location.hostname.includes('gabrielny.com') || window.location.hostname.includes('gabrielny.ca')) ?
        document.cookie.split('; ').find(row => row.startsWith('GabrielNY2013=')) :
        document.cookie.split('; ').find(row => row.startsWith('GabrielNY2013Staging='));
    if (!gabrielny2013) {
        $('#sessionExpiredOverlay').show();
        $('#sessionExpiredOverlay .session-expired-ok-btn').on('click', function () {
            // Preserve hash fragment in sessionStorage before redirect
            if (window.location.hash && typeof window.preserveHashFragment === 'function') {
                window.preserveHashFragment();
            }
            var fullUrl = window.location.href;
            var hashFragment = window.location.hash;
            if (hashFragment) {
                window.location.href = '/login?goto=' + encodeURIComponent(fullUrl) + '&hash=' + encodeURIComponent(hashFragment);
            } else {
                window.location.href = '/login?goto=' + encodeURIComponent(fullUrl);
            }
        });
    } else {
        $('#sessionExpiredOverlay').hide();
        $('#sessionExpiredOverlay .session-expired-ok-btn').on('click', function () {});
    }
}

let sessionInterval = setInterval(checkLoggedInCookieEvery5Seconds, 5000);

function startSessionCheckInterval() {
    checkLoggedInCookieEvery5Seconds();
    if (!sessionInterval) {
        sessionInterval = setInterval(checkLoggedInCookieEvery5Seconds, 5000);
    }
}

function stopSessionCheckInterval() {
    if (sessionInterval) {
        clearInterval(sessionInterval);
        sessionInterval = null;
    }
}

document.addEventListener('visibilitychange', function () {
    if (document.hidden) {
        stopSessionCheckInterval();
    } else {
        startSessionCheckInterval();
    }
});

window.addEventListener('blur', function () {
    stopSessionCheckInterval();
});

window.addEventListener('focus', function () {
    startSessionCheckInterval();
});</script>
<script type="application/ld+json">
                            {
                              "@context": "https://schema.org",
                              "@type": "WebSite",
                              "url": "https://embed.gabrielny.com",
                              "potentialAction": {
                                "@type": "SearchAction",
                                "target": "https://embed.gabrielny.com/products-advanced/searchkeywordstring-{search}",
                                "query-input": "required name=search"
                              }
                            }
                            </script>
<script src="https://cdn-localassets.gabrielny.com/javascript/jQuery/jquery.combine2018.js"></script>
<script type="text/javascript" excluded>
            window.GUMLET_CONFIG = {
                hosts: [{
                    current: "cdn-images.gabrielny.com",
                    gumlet: "cdn-images.gabrielny.com"
                }],
                lazy_load: true
            };
         
            (function() {
                d = document;
                s = d.createElement("script");
                s.src = 'https://cdn.jsdelivr.net/npm/[email protected]/dist/gumlet.min.js';
                s.async = 1;
                d.getElementsByTagName("head")[0].appendChild(s);
            })();
        </script> 
<script type="text/javascript"> var dataLayer = dataLayer || []; </script>
<script type="text/javascript"> 
                var site_js_eshopembed = 1;
                var site_js_domain_retailers = "https://b2b.gabrielny.com";
                var site_js_domain_eshop = "https://www.gabrielny.com";
                var site_js_domain_assets = "https://assets.gabrielny.com";
                var site_js_domain_embed = "https://embed.gabrielny.com";
                var site_js_domain_www = "https://www.gabrielny.com";
                var site_js_domain_localassets = "https://cdn-localassets.gabrielny.com";
                var site_js_domain_theme = "https://cdn-themes.gabrielny.com";
                var site_js_domain_new_theme = "https://cdn-themes.gabrielny.com/site2017theme/";
                var site_js_b2ccssversion = "144";
                var site_js_b2cjsversion = "14";
                var site_js_b2bcssversion = "195";
                var site_js_b2bjsversion = "195";
                var site_js_iscanadiansite = "";
                 </script>
<script data-file="newtheme-ui/common_new.js">/**
 * common_new.js
 */

var $buoop = { c: 2 };

function $buo_f() {
    var e = document.createElement("script");
    e.src = "//browser-update.org/update.js";
    document.body.appendChild(e);
};
try {
    document.addEventListener("DOMContentLoaded", $buo_f, false)
} catch (e) {
    window.attachEvent("onload", $buo_f)
}

var __lc = {};
__lc.license = 3986581;
var screenWidth = 0;


$(function() {
    screenWidth = parseInt($(window).width());
    $(window).resize(function() {
        if (screenWidth !== parseInt($(window).width())) {
            $(".carousel").each(function(index) {
                var height = $(this).first().find('div.slide').filter(':visible').first().find('img').height();
                if (height > 0) {
                    $(this).css({
                        height: height
                    });
                }
            });
        }
    });

    $('.loadproposalembed').bind('click', function (el) {
        var routePath = $(this).attr('data-routePath');
        $.redirect(IcarusConfig.SITE_DOMAIN_B2B + '/recommender', { 'routePath': routePath });
    });

    //    var lc = document.createElement('script'); lc.type = 'text/javascript'; lc.async = true;
    //    lc.src = ('https:' == document.location.protocol ? 'https://' : 'http://') + 'cdn.livechatinc.com/tracking.js';
    //    var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(lc, s);

    $('.loaduosembed').bind('click', function(el) {
        var routePath = $(this).attr('data-routePath');
        var cartType = $(this).attr('data-cartType');
        var userCode = $(this).attr('data-userCode');
        var isStaff = $(this).attr('data-staff');
        // console.log('isStaff 2', isStaff);

        if (typeof(userCode) === "undefined" || userCode === '' || userCode === null) {
            //alert('Company mapping is missing. Please contact Gabriel customer service for more details.');
            $('#progressmodal .close').remove();
            $('#progressmodal .modal-title').html('<button class="close" style="height:14px !important;top:8px !important;" type="button" data-dismiss="modal" aria-hidden="true"></button><h4 class="modal-title">Gabriel NY</h4>');
            $('#progressmodal .modal-body').html('Company mapping is missing. Please contact Gabriel customer service for more details.');
            $('#progressmodal').modal({ backdrop: 'static', keyboard: false }).show();
        } else {

            // if (isStaff == "1") {

                if (routePath === "os-cart") {
                    routePath = "cart";
                }

                if (routePath === "os-pastOrder") {
                    routePath = "orders-history";
                }

                $.redirect(IcarusConfig.SITE_DOMAIN_B2B + '/uos', { 'routePath': routePath, 'cartType': cartType });
            // } else {
            //     $.redirect(IcarusConfig.SITE_DOMAIN_B2B + '/universalordering', { 'routePath': routePath, 'cartType': cartType });
            // }

            // $.redirect(IcarusConfig.SITE_DOMAIN_B2B + '/universalordering', { 'routePath': routePath, 'cartType': cartType });
        }
        //$.redirect("https://b2b.gabrielny.com"+'/universalordering', {'routePath':routePath,'cartType':cartType});
        //$.redirect(IcarusConfig.SITE_DOMAIN_B2B+'/universalordering', {'routePath':routePath,'cartType':cartType});
    });

    //loadCurrencyEngine();


});


$(function() {
    $("#newsLetterForm").validate({
        rules: {
            nlEmail: {
                //required: true,/*TKT-34562-V7F3*/
                required: {
                    depends: function() {
                        $(this).val($.trim($(this).val()));
                        return true;
                    }
                },
                email: true
            }
        },
        messages: {
            nlEmail: "Please enter a valid email address"
        },
        submitHandler: function(form) {
            $.getJSON('/ajax/_global/newsletter-add-remove', $(form).serialize(), function(data) {
                if (data.status == "success") {
                    $('#newsLetterForm').html("Thank You for subscribing to the Gabriel & Co. newsletter program with   " + data.email);
                    if (typeof pintrk == 'function') {
                        pintrk('track', 'signup');
                    }
                    dataLayer.push({
                        'event': 'ga_newsletter_signup',
                        'ga_newsletter_email': data.email
                    });
                } else {
                    $('#newsLetterForm').html(data.error);
                }
            });
        }
    });
});
/* Site Search and  EShop Integration related code STARTS */

//var tmp_full_domain = location.protocol+'//'+window.location.host;
var tmp_full_url = window.location.host;
var tmp_parts_url = tmp_full_url.split('.');
var tmp_sub_domain = tmp_parts_url[0];
//var keywordSearch= ["PK1039","PK1031","PK1013","PK1014","PK1015","PK1016","PK1017","PK1018","PK1019","PK1021","PK1022","PK1026","PK1038","PK1040","PK1041","PK1042","PK845","PK846","PK937","PK949","PK958","PK968","PK969","PK970","PK971","PK972","PK973","PK974","PK975","PK976","PK977","PK978","PK979","PK980","PK981","PK982","PK983","PK984","PK986","PK987","PK988","PK989","PK990","PK991","PK992","PK993","PK996","PK1050","Zodiac","ADOR2017","GBBR2017","PK1051","PK1031L","PK767","PK781","PK867","PK998","PK1000","PK1001","PK1002","PK1003","PK1004","PK1005","PK1006","PK1007","PK1008","PK1009","PK1010","PK1011","PK1012","PK1020","PK1025","PK1027","PK1028","PK1029","PK1030","PK1032","PK1033","PK1034","PK1035","PK1036","PK1037","PK1043","PK1044","PK1045","PK1047","PK1048","PK1049","GABY2017","GBST2017","PK1052","PK1053","PK1054","PK1056","PK1046","AMAV2017","BTBR2017","PK1057","PK1058","PK1067","PK1068C","PK1068B","PK1068A","PK1068D","PK1068E","PK1068F","PK1068","PK1070","PK1062","GBRL2017","AMAF2017","BTSV2017","Anv1","Anv3","Anv5","Anv7","Anv10","Anv60","Anv15","Anv40","Anv20","Anv25","Anv50","Anv35","PK1063","PK1064","PK1076","PK1078L","PK1079A","PK1065","PK1089","PK1090","PK1087","PK1092","PK1093","PK1102","PK1103","PK1098","PK1095","PK1096","PK1097","PK1099","BTBR2019","AMAV2019","GBBR2019","DEVO2019","PK1160","PK1077-19","PK1111","PK1112","PK1113","PK1114","PK1115","PK1116","PK1118","PK1119","PK1120","PK1121","PK1122","PK1123","PK1124","PK1125","PK1127","PK1129","PK1131","PK1132","PK1133","PK1134","PK1135","PK1139","PK1119-1","PK1138","PK1151","PK1137","PK1156","PK1157","AMAF2019","BTSV2019","GABY2019","GBRL2019","GGLD2019","GBST2019","GBSV2019","FASHION2019","BRIDAL2019","PK1144","PK1144B","PK1144A","PK1145","PK1146","PK1147","PK1148","PK1158","PK1159","PK1161","PK1162","PK1163","PK1112A","PK1112B","PK1112C","PK1119-1L","PK1119-2A","PK1119-3A","PK1123A","PK1123B","PK1123C","PK1123D","PK1123E","PK1123F","PK1123G","PK1123H","PK1123I","PK1123J","PK1123K","PK1123L","PK1123M","PK1123N","PK1123O","PK1123P","PK1123Q","PK1160A","PK1160B","PK1160C","PK1165","PK1091"];

$(document).ready(function() {

    /* Top Search Box Start */
    $(".search-box .btnSearch").on('click', function(e) {
        e.stopPropagation();
        e.preventDefault();
        var textBox = $('.search-box .itemSearch').val().trim();
        if (!textBox || typeof textBox === undefined || textBox === null) {
            $('.search-box .itemSearch').focus();
        } else {
            searchURL(e, null, textBox);
        }
    });

    $(".search-box .btnSearchMob").on('click', function(e) {
        e.stopPropagation();
        e.preventDefault();
        var textBox = $('.search-box .itemSearchMob').val().trim();
        if (!textBox || typeof textBox === undefined || textBox === null) {
            $('.search-box .itemSearchMob').focus();
        } else {
            searchURL(e, null, textBox);
        }
    });

    var ww = document.body.clientWidth;

    $('.itemSearch, .itemSearchMob').focus(function() {
        var search = $(this).val().trim();
        if (search != "" && $('#topSearchResult').css('display') == 'none') {
            if (ww > 991) {
                if (!$('.top_search_desk #topSearchBySerial').is(":checked")) {
                    callTopSearchAutoComplete(search);
                }
            } else {
                if (!$('.top_search_mob #topSearchBySerial').is(":checked")) {
                    callTopSearchAutoComplete(search);
                } else {
                    $("#topSearchResultMob").empty();
                    $("#topSearchResultMob").hide();
                    $("#topSearchResult").empty();
                    $("#topSearchResult").hide();
                }
            }
        } else {
            $("#topSearchResultMob").empty();
            $("#topSearchResultMob").hide();
            $("#topSearchResult").empty();
            $("#topSearchResult").hide();
        }
    });

    $('.itemSearch, .itemSearchMob').keyup(function() {

        var searchval = $(this).val().trim();
        //if(keywordSearch.indexOf(searchval.toUpperCase()) == -1)
        //{
        if (ww > 991) {
            if (!$('.top_search_desk #topSearchBySerial').is(":checked")) {
                callTopSearchAutoComplete(searchval);
            }
        } else {
            if (!$('.top_search_mob #topSearchBySerial').is(":checked")) {
                callTopSearchAutoComplete(searchval);
            } else {
                $("#topSearchResultMob").empty();
                $("#topSearchResultMob").hide();
                $("#topSearchResult").empty();
                $("#topSearchResult").hide();
            }
        }
        /*}
        else
        {
           $("#topSearchResultMob").empty();
           $("#topSearchResultMob").hide();
           $("#topSearchResult").empty();
           $("#topSearchResult").hide();
        }*/

    });



    $(".search-box .btnSearchEmbed").on('click', function(e) {
        e.stopPropagation();
        e.preventDefault();
        var textBox = $('.search-box .itemSearch').val().trim();
        if (!textBox || typeof textBox === undefined || textBox === null) {
            $('.search-box .itemSearch').focus();
        } else {
            searchURL(e, null, textBox);
        }
    });

    $(document.body).on('keypress', '.search-box .itemSearch', function(event) {
        event.stopPropagation();
        if (event.which == 13) {
            event.preventDefault();
            searchURL(event, this);
        }
    });
    /* Top Search Box End */

});

/* Site Search and  EShop Integration related code ENDS */


var IcarusRedirect = new(function() {
    this.now = function(url) {
        document.location.href = url;
    };

    this.soon = function(url, time) {
        setTimeout(function() {
            IcarusRedirect.now(url);
        }, time);
    }
})();

function passwordStrength(password) {
    var desc = new Array();
    desc[0] = "Very Weak (0)";
    desc[1] = "Weak (1)";
    desc[2] = "Better (2)";
    desc[3] = "Medium (3)";
    desc[4] = "Strong (4)";
    desc[5] = "Strongest (5)";
    var score = 0;

    //if password bigger than 6 give 1 point
    if (password.length > 6) score++;

    //if password has both lower and uppercase characters give 1 point
    if ((password.match(/[a-z]/)) && (password.match(/[A-Z]/))) score++;

    //if password has at least one number give 1 point
    if (password.match(/\d+/)) score++;

    //if password has at least one special caracther give 1 point
    if (password.match(/.[!,@,#,$,%,^,&,*,?,_,~,-,(,)]/)) score++;

    //if password bigger than 12 give another 1 point
    if (password.length > 12) score++;
    document.getElementById("passwordDescription").innerHTML = desc[score];
    document.getElementById("passwordStrength").className = "strength" + score;
}

function getPasswordLevel(password) {
    var score = 0;

    //if password bigger than 6 give 1 point
    if (password.length > 6) score++;

    //if password has both lower and uppercase characters give 1 point
    if ((password.match(/[a-z]/)) && (password.match(/[A-Z]/))) score++;

    //if password has at least one number give 1 point
    if (password.match(/\d+/)) score++;

    //if password has at least one special caracther give 1 point
    if (password.match(/.[!,@,#,$,%,^,&,*,?,_,~,-,(,)]/)) score++;

    //if password bigger than 12 give another 1 point
    if (password.length > 12) score++;

    return score;
}


/* Site Search and  EShop Integration related code STARTS */


$(document).ready(function() {

    postsize();

    $(".pagination").on('click', function() {
        postsize();
    })

    var LinkingOption = function() {
        $('.colorMeThis').off('click').on('click', function(e) {
            e.preventDefault();
            e.stopPropagation();
            var color = $(this).data('color');
            var URL = $(this).data('url');
            var image = $(this).data('image');
            var redeemPoints = $(this).data('redeempts');
            var title = $(this).data('title');
            var prodLine = $(this).data('prodline');
            var base = $(this).data('base');
            var baseItemId = $(this).data('baseitmid');
            var prodURL = URL.replace(base.toLowerCase(), color.toLowerCase());
            var price = $(this).data('price');
            var imgAngle = $(this).data('angle');
            var baseElement = $('#product' + base);
            var itemSliderImageListing = '';
            var itemSliderSmallImageListing = '';
            var baseImage = $('#largimg' + baseItemId);
            var thumbImage = $('#smallimg' + baseItemId);
            var callType = $(this).data('calltype');
            var hasVideo = 0;
            var dataImg = '';
            var datacnt = 0;

            if ($("#dspItemCode" + base).length) {
                $("#dspItemCode" + base).html(color);
            }

            //For AI Similar
            baseElement.find('.product-ai-similar').attr("id", "pais-" + color).attr("data-prod", color);
            baseElement.find('.product_similar_icon').attr("id", "paisi-" + color);

            if (baseElement.find('.videoClick').length > 0) {
                hasVideo = baseElement.find('.videoClick').data('hasvideo');
                dataImg = baseElement.find('.videoClick').data('img');
                datacnt = baseElement.find('.videoClick').data('cnt');
            }

            baseElement.find('.product-metal > ul > li').removeClass('active');
            if (callType == "metal") {
                $(this).closest("li").addClass('active');

                $('#product' + base + ' .product_show .product-metal li').each(function() {
                    if ($(this).hasClass('active')) {
                        if ($(this).find('img').attr("data-imgsel") != "") {
                            $(this).find('img').attr('src', $(this).find('img').attr("data-imgsel"));
                        }
                    } else {
                        if ($(this).find('img').attr("data-imgorg") != "") {
                            $(this).find('img').attr('src', $(this).find('img').attr("data-imgorg"));
                        }
                    }
                });
            }

            baseElement.find('.product-shape > ul > li').removeClass('active');
            if (callType == "shape") {
                $(this).closest("li").addClass('active');

                //Shape
                $('#product' + base + ' .product_show .product-shape li').each(function() {
                    if ($(this).hasClass('active')) {
                        if ($(this).find('img').attr("data-imgsel") != "") {
                            $(this).find('img').attr('src', $(this).find('img').attr("data-imgsel"));
                        }
                    } else {
                        if ($(this).find('img').attr("data-imgorg") != "") {
                            $(this).find('img').attr('src', $(this).find('img').attr("data-imgorg"));
                        }
                    }
                });
            }

            baseElement.find('.product-stone > ul > li').removeClass('active');
            if (callType == "stonecolor") {
                $(this).closest("li").addClass('active');
            }

            baseElement.find('.product-size > ul > li').removeClass('active');
            if (callType == "size") {
                $(this).closest("li").addClass('active');
            }

            baseElement.find('.product-total-diamond > ul > li').removeClass('active');
            if (callType == "tdiamondw") {
                $(this).closest("li").addClass('active');
            }

            if (image == true) {

                //var loadimg = $('#loading-image').attr('src');
                //$('#progressmodal .close').remove();
                //$('#progressmodal .modal-body').html('<p class="f16 mt20 tac">Please wait...<br><img data-src="' + loadimg + '" alt="loading..." class="loadimgcls" /></p>');
                //$('#progressmodal').modal({backdrop: 'static', keyboard: false}).show();

                $.ajax({
                    type: "POST",
                    url: '/ajax/_global/itemImageListing',
                    //data: "itemStyle="+color+"&callType="+callType+"&base="+base+"&baseItemId="+baseItemId,
                    data: "itemStyle=" + color + "&callType=" + callType + "&base=" + base + "&baseItemId=" + baseItemId + "&hasVideo=" + hasVideo + '&dataImg=' + dataImg + '&datacnt=' + datacnt,
                    dataType: "json",
                    success: function(data) {
                        var curItemId = data.id;
                        baseImage.html(data.itemSliderImageListing);

                        if (thumbImage.length) {
                            thumbImage.html(data.itemSliderSmallImageListing);
                        }


                        var savedItemFlag = data.savedItem;
                        if (savedItemFlag == 'no') {
                            $('#product' + base).find('.itemSavedCheck >a').removeClass("alreadyAvail");
                            $('#product' + base).find('.itemSavedCheck >a').html('SAVE');
                        } else if (savedItemFlag == 'yes') {
                            $('#product' + base).find('.itemSavedCheck >a').addClass("alreadyAvail");
                            $('#product' + base).find('.itemSavedCheck >a').html('SAVED');
                        }

                        $('.imgcontainer' + baseItemId).attr("data-itemId", data.baseItemId).end();
                        $('.imgcontainer' + baseItemId).attr("data-spritevideo", data.spritevideo).end();
                        $('.imgcontainer' + baseItemId + ' .mainimage li>a').attr("href", prodURL.toLowerCase()).end();

                        if (baseImage.hasClass('owl-theme')) { //resize event was triggering an error, this if statement is to go around it

                            baseImage.trigger('destroy.owl.carousel'); //these 3 lines kill the owl, and returns the markup to the initial state
                            baseImage.find('.owl-stage-outer').children().unwrap();
                            baseImage.removeClass("owl-center owl-loaded owl-text-select-on");
                        }

                        if (thumbImage.length) {
                            if (thumbImage.hasClass('owl-theme')) { //resize event was triggering an error, this if statement is to go around it

                                thumbImage.trigger('destroy.owl.carousel'); //these 3 lines kill the owl, and returns the markup to the initial state
                                thumbImage.find('.owl-stage-outer').children().unwrap();
                                thumbImage.removeClass("owl-center owl-loaded owl-text-select-on");
                            }
                        }

                        var flag = false;
                        var duration = 300;
                        var mobWidth = $(window).width();
                        var dot = false;
                        if (width < 767) {
                            dot = false;
                        }
                        baseImage.owlCarousel({
                                loop: false,
                                navRewind: !1,
                                responsiveClass: false,
                                dots: dot,
                                nav: true,
                                responsive: { 0: { items: 1, dots: dot }, 768: { items: 1 } }
                            })
                            .on('changed.owl.carousel', function(e) {
                                if (!flag) {
                                    flag = true;
                                    thumbImage.trigger('to.owl.carousel', [e.item.index, duration, true]);
                                    thumbImage.find(".owl-item a").removeClass('active');
                                    thumbImage.find(".owl-item").eq(e.item.index).children('a').addClass("active");
                                    flag = false;
                                }
                            });

                        if (thumbImage.length) {
                            thumbImage.owlCarousel({
                                    loop: false,
                                    navRewind: !1,
                                    margin: 10,
                                    responsiveClass: false,
                                    dots: dot,
                                    nav: true,
                                    responsive: { 0: { items: 1 }, 600: { items: 3 }, 1000: { items: 4 } }
                                })
                                .on('click', '.owl-item', function() {
                                    baseImage.trigger('to.owl.carousel', [$(this).index(), duration, true]);
                                    thumbImage.find(".owl-item a").removeClass('active');
                                    thumbImage.find(".owl-item").eq($(this).index()).children('a').addClass("active");
                                })
                                .on('changed.owl.carousel', function(e) {
                                    if (!flag) {
                                        flag = true;
                                        baseImage.trigger('to.owl.carousel', [e.item.index, duration, true]);
                                        flag = false;
                                    }
                                });
                        }

                        $('.videoClick').on('click', function(e) {
                            e.preventDefault();
                            e.stopPropagation();

                            $('#productmatch').hide();

                            $('#modal-item-video').remove();
                            $('.modal-backdrop').remove();

                            var sku = $(this).data('sku');
                            var dimg = "https://assets.gabrielny.com/videos/m360/" + $(this).attr('data-sku') + "/" + $(this).attr('data-img');
                            var dcnt = $(this).attr('data-cnt');

                            if ($(this).attr('data-img') != '' && dcnt > 0) {
                                //var vhtml = '<div id="modal-item-video" class="modal fade" tabindex="-1" role="dialog" aria-labelledby="lg_popup" aria-hidden="true"> <div class="modal_vah"> <div class="modal-dialog modal-dialog-vac modal-xs"> <div class="modal-content" style="max-width:322px;"> <div class="pop-top"> <h3>View 360 For '+sku+'</h3>   <button type="button" class="close" data-dismiss="modal" aria-hidden="true"><i class="fa fa-times"></i></button></div> <div class="modal-body" style="padding:0px;"><div class="videoElement tac pt5"><div class="app-figure" id="zoom-fig"><a id="spin360" class="Magic360" data-options="columns: '+dcnt+';autospin-speed:10000;column-increment:2;" href="'+dimg+'"><img data-src="'+dimg+'"></a></div></div> <div class="clear"></div></div></div> </div> </div> </div>';
                                var vhtml = '<div id="modal-item-video" class="modal fade"><div class="modal_vah"><div class="modal-dialog modal-sm">   <div class="modal-content"><div class="modal-header"><button type="button" class="close" data-dismiss="modal" aria-hidden="true"></button><h4 class="modal-title">360 Video //' + base + '</h4></div><div class="modal-body"><div class="videoElement tac pt5"><div class="app-figure" id="zoom-fig"><a id="spin360" class="Magic360" data-options="columns: ' + dcnt + ';autospin-speed:10000;column-increment:2;" href="' + dimg + '"><img data-src="' + dimg + '"></a></div></div><div class="clearfix"></div></div></div></div></div></div>';
                                $(vhtml).modal();

                                setTimeout(function() {
                                    var Magic360Options = {};
                                    Magic360Options = {
                                        onready: function() {
                                            //console.log('onready', arguments[0]);
                                        },
                                        onstart: function() {
                                            //console.log('onstart', arguments[0]);
                                        },
                                        onstop: function() {
                                            //console.log('onstop', arguments[0]);
                                        },
                                        onzoomin: function() {
                                            // console.log('onzoomin', arguments[0]);
                                        },
                                        onzoomout: function() {
                                            //console.log('onzoomout', arguments[0]);
                                        },
                                        onspin: function() {
                                            //console.log('onspin', arguments[0]);
                                        },
                                    };
                                    Magic360.start('spin360');
                                }, 2000);
                            } else {
                                var video = "https://assets.gabrielny.com/videos/" + $(this).attr('data-baseItem') + ".mp4";
                                var vhtml = '<div id="modal-item-video" class="modal fade"><div class="modal_vah"><div class="modal-dialog modal-sm"><div class="modal-content"><div class="modal-header"><button type="button" class="close" data-dismiss="modal" aria-hidden="true"></button><h4 class="modal-title">360 Video //' + $(this).attr('data-baseItem') + '</h4></div><div class="modal-body"><div class="videoElement tac pt5"><div class="tac" id="videoElement">Loading the player...</div></div><div class="clearfix"></div></div></div></div></div></div>';
                                $(vhtml).modal();
                                setTimeout(function() { showViedoPlayer('', video); }, 2000);
                            }
                        });

                        var spriteVal = $('.imgcontainer' + baseItemId).attr('data-spritevideo');
                        if (spriteVal == '' || spriteVal == 0) {
                            $('.spritevideo' + baseItemId).hide();
                        } else {
                            $('.spritevideo' + baseItemId).attr("data-itemcode", color);
                            $('.spritevideo' + baseItemId).show();
                        }

                        var itemShortDesc = data.title_tag_new_mob;
                        if (itemShortDesc) {
                            baseElement.find('.pname a h3').html(itemShortDesc);
                        }


                        //Start Linking option buttons on product box
                        var availOptionCnt = data.availOptionCnt;
                        var selectedOption = callType.toLowerCase();

                        var totalAvilMetal = data.availMetalOptionCnt;
                        var totalAvailShape = data.availShapeOptionCnt;
                        var totalAvailColor = data.availColorOptionCnt;
                        var totalAvailSize = data.availSizeOptionCnt;
                        var totalAvailDiamondWeight = data.availTotalDiamondWeightOptionCnt;



                        if (totalAvilMetal > 0 || totalAvailShape > 0 || totalAvailColor > 0 || totalAvailSize > 0 || totalAvailDiamondWeight > 0) {

                            if (selectedOption == "shape") {
                                //For Metal
                                if (totalAvilMetal > 0) {
                                    baseElement.find('.product-metal').show();
                                    baseElement.find('.product-metal > ul > li').hide();
                                    $.each(data.availMetalOption, function(k, v) {
                                        baseElement.find('.product-metal > ul .' + k).show();
                                        baseElement.find('.product-metal > ul > li.' + k).html(v);
                                    });
                                } else {
                                    baseElement.find('.product-metal').hide();
                                }

                                //For Stone Color
                                if (totalAvailColor > 0) {
                                    baseElement.find('.product-stone').show();
                                    baseElement.find('.product-stone > ul > li').hide();
                                    $.each(data.availColorOption, function(k, v) {
                                        baseElement.find('.product-stone > ul .' + k).show();
                                        baseElement.find('.product-stone > ul > li.' + k).html(v);
                                    });
                                } else {
                                    baseElement.find('.product-stone').hide();
                                }

                                //For Size
                                if (totalAvailSize > 0) {
                                    baseElement.find('.product-size').show();
                                    baseElement.find('.product-size > ul > li').hide();
                                    $.each(data.availSizeOption, function(k, v) {
                                        baseElement.find('.product-size > ul .' + k).show();
                                        baseElement.find('.product-size > ul > li.' + k).html(v);
                                    });
                                } else {
                                    baseElement.find('.product-size').hide();
                                }

                                //For Total Diamond Weight
                                if (totalAvailDiamondWeight > 0) {
                                    baseElement.find('.product-tdw').html('');
                                    $.each(data.availTotalDiamondWeightOption, function(k, v) {
                                        baseElement.find('.product-tdw').append(v);
                                    });
                                    baseElement.find('.product-total-diamond').show();
                                } else {
                                    baseElement.find('.product-total-diamond').hide();
                                }
                            } else if (selectedOption == "metal") {

                                //For Shape
                                if (totalAvailShape > 0) {
                                    baseElement.find('.product-shape').show();
                                    baseElement.find('.product-shape > ul > li').hide();
                                    $.each(data.availShapeOption, function(k, v) {
                                        baseElement.find('.product-shape > ul .' + k).show();
                                        baseElement.find('.product-shape > ul > li.' + k).html(v);
                                    });
                                } else {
                                    baseElement.find('.product-shape').hide();
                                }

                                //For Stone Color
                                if (totalAvailColor > 0) {
                                    baseElement.find('.product-stone').show();
                                    baseElement.find('.product-stone > ul > li').hide();
                                    $.each(data.availColorOption, function(k, v) {
                                        baseElement.find('.product-stone > ul .' + k).show();
                                        baseElement.find('.product-stone > ul > li.' + k).html(v);
                                    });
                                } else {
                                    baseElement.find('.product-stone').hide();
                                }

                                //For Size

                                if (totalAvailSize > 0) {
                                    baseElement.find('.product-size').show();
                                    baseElement.find('.product-size > ul > li').hide();
                                    $.each(data.availSizeOption, function(k, v) {
                                        baseElement.find('.product-size > ul .' + k).show();
                                        baseElement.find('.product-size > ul > li.' + k).html(v);
                                    });
                                } else {
                                    baseElement.find('.product-size').hide();
                                }

                                //For Total Diamond Weight
                                if (totalAvailDiamondWeight > 0) {
                                    baseElement.find('.product-tdw').html('');
                                    $.each(data.availTotalDiamondWeightOption, function(k, v) {
                                        baseElement.find('.product-tdw').append(v);
                                    });
                                    baseElement.find('.product-total-diamond').show();
                                } else {
                                    baseElement.find('.product-total-diamond').hide();
                                }

                            } else if (selectedOption == "stonecolor") {
                                //For Shape
                                if (totalAvailShape > 0) {
                                    baseElement.find('.product-shape').show();
                                    baseElement.find('.product-shape > ul > li').hide();
                                    $.each(data.availShapeOption, function(k, v) {
                                        baseElement.find('.product-shape > ul .' + k).show();
                                        baseElement.find('.product-shape > ul > li.' + k).html(v);
                                    });
                                } else {
                                    baseElement.find('.product-shape').hide();
                                }

                                //For Metal
                                if (totalAvilMetal > 0) {
                                    baseElement.find('.product-metal').show();
                                    baseElement.find('.product-metal > ul > li').hide();
                                    $.each(data.availMetalOption, function(k, v) {
                                        baseElement.find('.product-metal > ul .' + k).show();
                                        baseElement.find('.product-metal > ul > li.' + k).html(v);
                                    });
                                } else {
                                    baseElement.find('.product-metal').hide();
                                }

                                //For Size
                                if (totalAvailSize > 0) {
                                    baseElement.find('.product-size').show();
                                    baseElement.find('.product-size > ul > li').hide();
                                    $.each(data.availSizeOption, function(k, v) {
                                        baseElement.find('.product-size > ul .' + k).show();
                                        baseElement.find('.product-size > ul > li.' + k).html(v);
                                    });
                                } else {
                                    baseElement.find('.product-size').hide();
                                }

                                //For Total Diamond Weight
                                if (totalAvailDiamondWeight > 0) {
                                    baseElement.find('.product-tdw').html('');
                                    $.each(data.availTotalDiamondWeightOption, function(k, v) {
                                        baseElement.find('.product-tdw').append(v);
                                    });
                                    baseElement.find('.product-total-diamond').show();
                                } else {
                                    baseElement.find('.product-total-diamond').hide();
                                }

                            } else if (selectedOption == "size") {
                                //For Shape
                                if (totalAvailShape > 0) {
                                    baseElement.find('.product-shape').show();
                                    baseElement.find('.product-shape > ul > li').hide();
                                    $.each(data.availShapeOption, function(k, v) {
                                        baseElement.find('.product-shape > ul .' + k).show();
                                        baseElement.find('.product-shape > ul > li.' + k).html(v);
                                    });
                                } else {
                                    baseElement.find('.product-shape').hide();
                                }

                                //For Metal
                                if (totalAvilMetal > 0) {
                                    baseElement.find('.product-metal').show();
                                    baseElement.find('.product-metal > ul > li').hide();
                                    $.each(data.availMetalOption, function(k, v) {
                                        baseElement.find('.product-metal > ul .' + k).show();
                                        baseElement.find('.product-metal > ul > li.' + k).html(v);
                                    });
                                } else {
                                    baseElement.find('.product-metal').hide();
                                }

                                //For Stone Color
                                if (totalAvailColor > 0) {
                                    baseElement.find('.product-stone').show();
                                    baseElement.find('.product-stone > ul > li').hide();
                                    $.each(data.availColorOption, function(k, v) {
                                        baseElement.find('.product-stone > ul .' + k).show();
                                        baseElement.find('.product-stone > ul > li.' + k).html(v);
                                    });
                                } else {
                                    baseElement.find('.product-stone').hide();
                                }

                                //For Total Diamond Weight
                                if (totalAvailDiamondWeight > 0) {
                                    baseElement.find('.product-tdw').html('');
                                    $.each(data.availTotalDiamondWeightOption, function(k, v) {
                                        baseElement.find('.product-tdw').append(v);
                                    });
                                    baseElement.find('.product-total-diamond').show();
                                } else {
                                    baseElement.find('.product-total-diamond').hide();
                                }
                            } else if (selectedOption == "tdiamondw") {
                                //For Shape
                                if (totalAvailShape > 0) {
                                    baseElement.find('.product-shape').show();
                                    baseElement.find('.product-shape > ul > li').hide();
                                    $.each(data.availShapeOption, function(k, v) {
                                        baseElement.find('.product-shape > ul .' + k).show();
                                        baseElement.find('.product-shape > ul > li.' + k).html(v);
                                    });
                                } else {
                                    baseElement.find('.product-shape').hide();
                                }

                                //For Metal

                                if (totalAvilMetal > 0) {
                                    baseElement.find('.product-metal').show();
                                    baseElement.find('.product-metal > ul > li').hide();
                                    $.each(data.availMetalOption, function(k, v) {
                                        baseElement.find('.product-metal > ul .' + k).show();
                                        baseElement.find('.product-metal > ul > li.' + k).html(v);
                                    });
                                } else {
                                    baseElement.find('.product-metal').hide();
                                }

                                //For Stone Color
                                if (totalAvailColor > 0) {
                                    baseElement.find('.product-stone').show();
                                    baseElement.find('.product-stone > ul > li').hide();
                                    $.each(data.availColorOption, function(k, v) {
                                        baseElement.find('.product-stone > ul .' + k).show();
                                        baseElement.find('.product-stone > ul > li.' + k).html(v);
                                    });
                                } else {
                                    baseElement.find('.product-stone').hide();
                                }

                                //For Size
                                if (totalAvailSize > 0) {
                                    baseElement.find('.product-size').show();
                                    baseElement.find('.product-size > ul > li').hide();
                                    $.each(data.availSizeOption, function(k, v) {
                                        baseElement.find('.product-size > ul .' + k).show();
                                        baseElement.find('.product-size > ul > li.' + k).html(v);
                                    });
                                } else {
                                    baseElement.find('.product-size').hide();
                                }
                            }
                            //HighLightSwitchoption();
                        } else {
                            if (selectedOption == "shape") {
                                baseElement.find('.product-metal').hide();
                                baseElement.find('.product-stone').hide();
                                baseElement.find('.product-size').hide();
                                baseElement.find('.product-total-diamond').hide();
                            } else if (selectedOption == "metal") {
                                baseElement.find('.product-shape').hide();
                                baseElement.find('.product-stone').hide();
                                baseElement.find('.product-size').hide();
                                baseElement.find('.product-total-diamond').hide();
                            } else if (selectedOption == "stonecolor") {
                                baseElement.find('.product-metal').hide();
                                baseElement.find('.product-shape').hide();
                                baseElement.find('.product-size').hide();
                                baseElement.find('.product-total-diamond').hide();
                            } else if (selectedOption == "size") {
                                baseElement.find('.product-metal').hide();
                                baseElement.find('.product-shape').hide();
                                baseElement.find('.product-stone').hide();
                                baseElement.find('.product-total-diamond').hide();
                            } else if (selectedOption == "tdiamondw") {
                                baseElement.find('.product-metal').hide();
                                baseElement.find('.product-shape').hide();
                                baseElement.find('.product-stone').hide();
                                baseElement.find('.product-size').hide();
                            }

                        }
                        LinkingOption();
                        //End Linking option buttons on product box
                        //$('#progressmodal').modal('hide');
                    }
                });
            } else {
                itemSliderImageListing = '<a href="javascript:void(0);"><img data-src="//assets.gabrielny.com/noimage.jpg" alt="' + title + '"  title="' + title + '" data-zoom-image="" class="prod-zoom-img" /></a>';
                itemSliderSmallImageListing = "";
                baseImage.html(itemSliderImageListing);
                thumbImage.html(itemSliderSmallImageListing);
            }
            prodURL = prodURL.toLowerCase();
            $('.imgcontainer' + baseItemId).attr("data-path", prodURL).end();
            $('.imgcontainer' + baseItemId).attr("data-itemImage", '').end();
            $('.imgcontainer' + baseItemId).attr("data-hover-image", '').end();
            //baseElement.find('.pname > a').attr("href", prodURL).text(title).end();
            if (prodLine != undefined && prodLine != '') {
                baseElement.find('.pname a>h3').text(prodLine + ' - ' + title).end();
            } else {
                baseElement.find('.pname a>h3').text(title).end();
            }
            baseElement.find('.normalqv').attr("data-code", color).end();
            baseElement.find('.normalqv').attr("data-link", prodURL).end();
            baseElement.find('.ercod > a').attr("href", prodURL).text(color).end();
            //baseElement.find('.ptitle > a').attr("href", prodURL).end();
            baseElement.find('.pname > a').attr("href", prodURL).end();
            baseElement.find('.btnSaveStackable').attr("data-code", color).end();
            baseElement.find('.pprice').html(price);
            baseElement.find('.rewardpriceval').html(redeemPoints);
            optionImgHighlight();
            //HighLightSwitchoption();
        });

        $('.owl-next,.owl-prev').on("click", function(e) {
            e.stopPropagation();
        });
    }

    LinkingOption();

    //Start highlight on switcher button
    var HighLightSwitchoption = function() {

        $('.product').each(function(i) {
            var prod_id = $(this).data('id');
            var tmp_prod_id = $('#product' + prod_id).data("id");

            //Metal               
            $('#product' + prod_id + ' .product_show .product-metal li').each(function() {
                if (tmp_prod_id == $(this).find('a').attr('data-color')) {
                    $(this).addClass('active');
                    if ($(this).find('img').attr("data-imgsel") != "") {
                        $(this).find('img').attr('src', $(this).find('img').attr("data-imgsel"));
                    }
                }
            });

            //Shape
            $('#product' + prod_id + ' .product_show .product-shape li').each(function() {
                if (tmp_prod_id == $(this).find('a').attr('data-color')) {
                    $(this).addClass('active');
                    if ($(this).find('img').attr("data-imgsel") != "") {
                        $(this).find('img').attr('src', $(this).find('img').attr("data-imgsel"));
                    }
                }
            });

            //Stone
            $('#product' + prod_id + ' .product_show .product-stone li').each(function() {
                if (tmp_prod_id == $(this).find('a').attr('data-color')) {
                    $(this).addClass('active');
                }
            });

            //Size
            $('#product' + prod_id + ' .product-overlay .product-size li').each(function() {
                if (tmp_prod_id == $(this).find('a').attr('data-color')) {
                    $(this).addClass('active');
                }
            });

            //TDW
            $('#product' + prod_id + ' .product-overlay .product-total-diamond li').each(function() {
                if (tmp_prod_id == $(this).find('a').attr('data-color')) {
                    $(this).addClass('active');
                }
            });
        });
    }
    HighLightSwitchoption();
    //Start highlight on switcher button

    //Change Metal and Shape images when hover.
    var optionImgHighlight = function() {
        $(".option-image-container").mouseover(function() {
            var checkcls = $(this).parent().parent().hasClass('active');
            var imagehover = $(this).data("imghov");
            if (!checkcls) {
                if (imagehover != "") {
                    $(this).attr('src', imagehover);
                }
            }
        }).mouseout(function() {
            var checkcls = $(this).parent().parent().hasClass('active');
            var imagehover = $(this).data("imghov");
            var imageorg = $(this).data("imgorg");
            if (!checkcls) {
                if (imageorg != "") {
                    $(this).attr('src', imageorg);
                }
            }
        });
    }
    optionImgHighlight();

    //Start Set Link of image on listing page
    var setLinkOnSlider = function() {
        $('.redirectlink').each(function(i) {
            var baseItemId = $(this).data('itemid');
            var imageURL = $('.imgcontainer' + baseItemId).attr('data-path');
            $('.imgcontainer' + baseItemId + ' .mainimage').find('a').attr("href", imageURL);
        });
    }
    setLinkOnSlider();
    //End Set Link of image on listing page

    //Start Listing Page quick view
    /*$('div.product-extra .quickview').off('click').on('click', function (el) {
        el.preventDefault();
        el.stopPropagation();
        var $t = $(this);
        quickViewDetail($t.attr('data-code'),$t.attr('data-link'));
    });*/
    //End Listing page quick view

    //===========================Start Set Favorites==============================//
    $(document.body).off('click', '.fav-icon').on('click', '.fav-icon', function(e) {
        e.preventDefault();
        e.stopPropagation();

        $('.modal-backdrop').remove();
        $('#modal-add-to-favorite').remove();
        $('#modal-move-to-favorite').remove();

        $.ajax({
            type: "POST",
            url: '/ajax/account/favorites',
            data: "mode=getStatus&item=" + $(this).attr('data-code'),
            dataType: "json",
            success: function(data) {
                $('body').append($(data.html).modal());
            }
        });
    });
    //===========================End Set Favorites==============================//



});

function quickViewDetail(val, path) {
    $("#loader").show();
    var querystr = "code=" + val + "&url=" + path;
    $.post("/ajax/eshop/quickview", querystr, function(data) {
        data = JSON.parse(data);
        $("#quickview").html(data.aaData["product_data"]);
        $('#productmatch').modal({ backdrop: 'static', keyboard: false }).show();

        $('#productmatch').on('shown.bs.modal', function(e) {
            var e = $("#dtl-large"),
                s = $("#dtl-eximg");
            e.owlCarousel({
                item: 1,
                loop: false,
                //margin: 10,
                responsiveClass: false,
                dots: false,
                nav: false,
                navText: ['<i class="fa fa-angle-left"></i>', '<i class="fa fa-angle-right"></i>'],
                responsive: { 0: { items: 1, dots: false, }, 768: { items: 1 } }
            }).on("changed.owl.carousel", function(e) {
                var i = e.item.index;
                s.trigger("to.owl.carousel", [i, 0, !0]);
                s.find(".owl-item a").removeClass('active');
                s.find(".owl-item").eq(i).children('a').addClass("active");
            }), s.owlCarousel({
                loop: false,
                navRewind: !1,
                margin: 10,
                responsiveClass: false,
                dots: false,
                nav: true,
                navText: ['<i class="fa fa-angle-left"></i>', '<i class="fa fa-angle-right"></i>'],
                responsive: { 0: { items: 3, }, 580: { items: 4 }, 1000: { items: 4 } }
            }).on("changed.owl.carousel", function(s) {
                var i = s.item.index;
                e.trigger("to.owl.carousel", [i, 0, !0]);
            }).on("click", ".owl-item", function() {
                e.trigger("to.owl.carousel", [$(this).index(), 0, !0]);
                s.find(".owl-item a").removeClass('active');
                s.find(".owl-item").eq($(this).index()).children('a').addClass("active");
            });
        });

        $("#frontBack").click(function() {
            $(".modal-content", '#productmatch').height($("#second-slide").height());
            $("#dtl-large", '#productmatch').css({ 'opacity': '0' });
            $("#dtl-eximg", '#productmatch').css({ 'opacity': '0' });
            $('#productmatch').scrollTop(0);

            $("#first-slide").removeClass('flip-on').addClass('flip-of');
            $("#second-slide").removeClass('flip-of').addClass('flip-on');

            // reAssignzoom();

        });
        $("#frontBack1").click(function() {
            $(".modal-content", '#productmatch').height($("#third-slide").height());
            $("#dtl-large", '#productmatch').css({ 'opacity': '0' });
            $("#dtl-eximg", '#productmatch').css({ 'opacity': '0' });
            $('#productmatch').scrollTop(0);

            $("#first-slide").removeClass('flip-on').addClass('flip-of');
            $("#third-slide").removeClass('flip-of').addClass('flip-on');

            //reAssignzoom();
        });

        $("#frontBack2").click(function(e) {
            $('#productmatch').modal('hide');
            e.preventDefault();
            e.stopPropagation();
            var that = $(this);
            $('#progressmodal .close').remove();
            $('#progressmodal .modal-body').html('Your item is being added to the cart, please wait...');
            $('#progressmodal').modal({ backdrop: 'static', keyboard: false }).show();
            $('#progressmodal .loadimgcls').attr('src', $('#loading-image').attr('src'));
            $.ajax({
                type: 'POST',
                dataType: 'json',
                url: '/ajax/addtocart',
                data: 'itemCode=' + that.data('code') + '&mode=add'
            }).done(function(data) {
                if (data.success) {
                    $('#progressmodal .close').remove();
                    $('#progressmodal .modal-body').html('Item added to basket successfully');
                    $('#progressmodal').modal({ backdrop: 'static', keyboard: false }).show();
                    $('#item_count').html(data.itemcount);
                    setTimeout(function() {
                        $('#progressmodal').modal('hide')
                    }, 1000);
                }
            });

        });

        $("#backSide").click(function() {
            $(".modal-content", '#productmatch').height($("#first-slide").height());
            $("#dtl-large", '#productmatch').css({ 'opacity': '1' });
            $("#dtl-eximg", '#productmatch').css({ 'opacity': '1' });
            $('#productmatch').scrollTop(0);

            $("#second-slide").removeClass('flip-on').addClass('flip-of');
            $("#first-slide").removeClass('flip-of').addClass('flip-on');
        });

        $("#backSide1").click(function() {
            $(".modal-content", '#productmatch').height($("#first-slide").height());
            $("#pop-small", '#productmatch').css({ 'opacity': '1' });
            $('#productmatch').scrollTop(0);

            $("#third-slide").removeClass('flip-on').addClass('flip-of');
            $("#first-slide").removeClass('flip-of').addClass('flip-on');
        });


        setTimeout(function() {
            processScreen();
            screenWidth = parseInt($(window).width())
            var zoomConfig = '';

            //zoomConfig = {cursor: 'crosshair', zoomType: "inner"};
            //$('#prodImage, #prodImageMobile').elevateZoom(zoomConfig);

        }, 2000);

        /*
         $('.imageLoader').on('click', function (e) {
         var zoomConfig = '';

         zoomConfig = {cursor: 'crosshair', zoomType: "inner"};

         var that = $(this);
         e.preventDefault();
         e.stopPropagation();
         $('#prodImage').attr('src', that.attr('src'));

         processScreen();
         $('#prodImage, #prodImageMobile').attr('src', that.attr('src')).data('zoom-image', that.data('zoom-image'));
         $('.zoomWindow').css('background-image', "url('" + that.attr('data-zoom-image') + "')").data('zoom-image', that.data('zoom-image'));
         $('#prodImage, #prodImageMobile').elevateZoom(zoomConfig);
         });
         */

        //getQuantity(data.aaData["product_stock"]);
        $("#loader").hide();

        $('#productmatch').on('hidden.bs.modal', function() {
            processScreen();
        });

        // for measurement diagram start
        /*
         $("body").delegate(".measurementDiagram", "click", function () {
         var diagram = $("body").find('[data-diagram*="width-diagram"]');
         var attr = $(diagram[0]).attr('data-diagram');
         var category = findCategory(attr);

         attr = attr.split("-");
         buildDiagram(attr[0], category);
         });

         function buildDiagram(type, category) {
         var popTitle = category.charAt(0).toUpperCase() + category.slice(1);
         if(category == 'engagementring') var popTitle = 'Engagement Ring';
         else if(category == 'rings') var popTitle = 'Ring';

         $.Dialog({
         overlay: true,
         shadow: true,
         flat: true,
         //title: category.charAt(0).toUpperCase() + category.slice(1) + " Measurements",
         title: popTitle + " Measurements",
         width: 300,
         height: 415,
         onShow: function (_dialog) {
         var content = _dialog.children('.content');
         var buttons = [];
         var valueSelector = "[data-diagram*='" + type + "']";
         var i = 0;
         $('*[data-diagram]').each(function () {
         i++;
         var diagram = this.getAttribute("data-diagram");
         console.log(popTitle,category,type);
         console.log(diagram);
         var name = diagram.split("-");
         diagram = name[0] + "-diagram-" + findCategory(diagram);
         if (type == name[0])
         buttons.push('<button class="selected" style=\'margin-top:5px;\' onclick=\'changeInfoListing(\"' + diagram + '\")\'data-diagram=\'' + diagram + '\'>' + findLetter(name[0]) + '</button>');
         else
         buttons.push('<button style=\'margin-left:5px;margin-top:5px;\' onclick=\'changeInfoListing(\"' + diagram + '\")\'data-diagram=\''
         + diagram + '\'>' + findLetter(name[0]) + '</button>');
         });
         var letter = findLetter(type);
         var value = $(valueSelector).siblings("span").html();
         content.html("<div style='position:relative;'>" +
         "<img style='max-height: 300px;' src='//assets.gabrielny.com/site-images/eshop/diagram/" + type + "-diagram-" + category
         + ".jpg'/><div class='diagramVal' style='width:100%;position:absolute;bottom:0;text-align:center;'>" +
         letter + " = " + value + "</div></div>"
         + "<div style='text-align:center;'>" + buttons.join("") + "</div>");
         }
         });

         $("button[data-diagram]").on("click", function () {
         var button = $(this).attr("data-diagram");
         $('button[data-diagram]').each(function () {
         if ($(this).attr("data-diagram") == button) {
         $(this).attr("class", "selected");
         } else {
         $(this).attr("class", "");
         }
         });
         });
         }
         */

        if (parseInt("1")) {
            dialogCenter();
            // console.log("Center Dialog");
        }


        //For Addt o cart
        $('.shopnow').unbind('click').bind('click', function(e) {

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

            if ('1')
                domain = 'https://embed.gabrielny.com';
            else
                domain = 'https://embed.gabrielny.com';

            e.preventDefault();
            e.stopPropagation();
            var that = $(this);
            var loadimg = $('#loading-image').attr('src');

            $('#progressmodal .close').remove();
            $('#progressmodal .modal-body').html('Your item is being added to the cart, please wait...<br><img data-src="' + loadimg + '" alt="loading..." class="loadimgcls" />');
            $('#progressmodal').modal({ backdrop: 'static', keyboard: false }).show();
            $.ajax({
                type: 'POST',
                dataType: 'json',
                url: '/ajax/addtocart',
                data: 'itemCode=' + that.data('code') + '&mode=add'
            }).done(function(data) {
                if (data.success) {
                    $('#progressmodal .close').remove();
                    $('#progressmodal .modal-body').html('Item added to basket successfully');
                    $('#progressmodal').modal({ backdrop: 'static', keyboard: false }).show();
                    $('#item_count').html(data.itemcount);
                    //$(".cartitem_popup").html(data.content["orderItem"]);
                    setTimeout(function() {
                        $('#progressmodal').modal('hide')
                    }, 1000);
                }
                $(".modal-backdrop").remove();
            });
        });

        //For gcny addto cart
        $('.shopusernow').unbind('click').bind('click', function(e) {
            $("#productmatch").hide();
            domain = 'https://embed.gabrielny.com';
            e.preventDefault();
            e.stopPropagation();
            var that = $(this);
            var loadimg = $('#loading-image').attr('src');
            $('#progressmodal .close').remove();
            $('#progressmodal .modal-body').html('<p class="f16 mt20 tac">Your item is being added to the cart, please wait...<br><img data-src="' + loadimg + '" alt="loading..." class="loadimgcls" /></p>');
            $('#progressmodal').modal({ backdrop: 'static', keyboard: false }).show();
            $.ajax({
                type: 'POST',
                dataType: 'json',
                url: '/ajax/useraddtocart',
                data: 'itemCode=' + that.data('code') + '&mode=add'
            }).done(function(data) {
                if (data.success) {
                    $('#progressmodal .close').remove();
                    $('#progressmodal .modal-body').html('Item added to basket successfully');
                    $('#progressmodal').modal({ backdrop: 'static', keyboard: false }).show();
                    $('#cart_item_count').html(data.itemcount);
                    /*
                     setTimeout(function () {
                     $('#progressmodal').modal('hide')
                     }, 1000);
                     */
                } else {
                    $('#progressmodal .close').remove();
                    $('#progressmodal .modal-body').html(data.error);
                    $('#progressmodal').modal({ backdrop: 'static', keyboard: false }).show();
                    //$('#cart_item_count').html(data.itemcount);
                    /*
                     setTimeout(function () {
                     $('#cartprogressmodal').modal('hide')
                     }, 1000);
                     */
                }
                $('#progressmodal .modal-title').html('<button class="close" type="button" data-dismiss="modal" aria-hidden="true"></button><h4 class="modal-title">Gabriel NY</h4>');

                $('#progressmodal').on('hidden.bs.modal', function() {
                    $('html, body').animate({
                        scrollTop: $('#cart_item_count').offset().top
                    }, 1000);
                    $(".modal-backdrop").remove();
                });
            });
        });

        /* Find a Store*/
        $('.btnFindStorePop').unbind('click').bind('click', function(e) {
            e.preventDefault();
            e.stopPropagation();
            /*
             pintrk​(​'track'​,​ ​'storesearch'​,​ {
             lead_type​:​ ​'Search For Store'
             ​});
             */
            var division = $(this).attr('data-division');
            var sku = $(this).attr('data-item');


            if (!!$.cookie('{MyCookiePrefix}MY_LOCATION')) {
                $.ajax({
                    type: 'POST',
                    url: '/ajax/_global/mylocation',
                    data: 'mode=getlocation',
                    dataType: 'json',
                    success: function(data) {
                        console.log('Loading....', data);
                        if (data.status == 'OK') {
                            window.location = 'https://www.gabrielny.com/schedule-a-private-show/results?productId=' + sku + '&division=' + division + '&lat=' + data.lat + '&lng=' + data.lng;
                        } else {
                            console.log('Unable to read cookie.');
                            if (navigator.geolocation) {
                                var self = this;
                                navigator.geolocation.getCurrentPosition(function(position) {
                                    showMyPositionLocal(position, self, sku, division)
                                }, showMyErrorLocal);
                            } else {
                                alert("Your browser does not support geo location.");
                            }
                        }
                    },
                    error: function() {
                        //alert('Error occured');
                    }
                });

            } else {
                if (navigator.geolocation) {
                    var self = this;
                    navigator.geolocation.getCurrentPosition(function(position) {
                        showMyPositionLocal(position, self, sku, division)
                    }, showMyErrorLocal);
                } else {
                    alert("Your browser does not support geo location.");
                }
            }



            //document.location.href = 'https://www.gabrielny.com/storelocator/?eshopMode='+division+'&sku='+sku;
        });

        function showMyPositionLocal(position, self, sku, division) {
            var lat = position.coords.latitude;
            var lng = position.coords.longitude;
            $("#loader").show();
            $.post("/ajax/_global/mylocation/", { lat: position.coords.latitude, lng: position.coords.longitude },
                function(data) {
                    window.location = 'https://www.gabrielny.com/schedule-a-private-show/results?productId=' + sku + '&division=' + division + '&lat=' + lat + '&lng=' + lng;
                });
        }

        function showMyErrorLocal(error) {
            var errorCode = "";
            switch (error.code) {
                case error.PERMISSION_DENIED:
                    errorCode = "User denied the request for Geolocation.";
                    break;
                case error.POSITION_UNAVAILABLE:
                    errorCode = "Location information is unavailable.";
                    break;
                case error.TIMEOUT:
                    errorCode = "The request to get user location timed out.";
                    break;
                case error.UNKNOWN_ERROR:
                    errorCode = "An unknown error occurred.";
                    break;
            }
            alert(errorCode);
        }

        //For 360 video
        $(document.body).on('click', '.videoClick', function(e) {
            // console.log("test common");
            e.preventDefault();
            e.stopPropagation();

            $('#productmatch').hide();

            $('#modal-item-video').remove();
            $('.modal-backdrop').remove();

            var sku = $(this).data('sku');
            var dimg = "https://assets.gabrielny.com/videos/m360/" + $(this).attr('data-sku') + "/" + $(this).attr('data-img');
            var dcnt = $(this).attr('data-cnt');

            if ($(this).attr('data-img') != '' && dcnt > 0) {
                //var vhtml = '<div id="modal-item-video" class="modal fade" tabindex="-1" role="dialog" aria-labelledby="lg_popup" aria-hidden="true"> <div class="modal_vah"> <div class="modal-dialog modal-dialog-vac modal-xs"> <div class="modal-content" style="max-width:322px;"> <div class="pop-top"> <h3>View 360 For '+sku+'</h3>   <button type="button" class="close" data-dismiss="modal" aria-hidden="true"><i class="fa fa-times"></i></button></div> <div class="modal-body" style="padding:0px;"><div class="videoElement tac pt5"><div class="app-figure" id="zoom-fig"><a id="spin360" class="Magic360" data-options="columns: '+dcnt+';autospin-speed:10000;column-increment:2;" href="'+dimg+'"><img data-src="'+dimg+'"></a></div></div> <div class="clear"></div></div></div> </div> </div> </div>';
                var vhtml = '<div id="modal-item-video" class="modal fade" tabindex="-1" role="dialog" aria-labelledby="lg_popup" aria-hidden="true"> <div class="modal_vah"> <div class="modal-dialog quickview-w"> <div class="modal-content"> <div class="modal-header tac"> <button type="button" class="close" data-dismiss="modal" aria-hidden="true"></button><h4 class="modal-title">View 360 For ' + sku + '</h4></div> <div class="modal-body" style="padding:0px;"><div class="videoElement tac pt5"><div class="app-figure" id="zoom-fig"><a id="spin360" class="Magic360" data-options="columns: ' + dcnt + ';autospin-speed:10000;column-increment:2;" href="' + dimg + '"><img data-src="' + dimg + '"></a></div></div> </div></div> </div> </div> </div>';
                $(vhtml).modal();

                setTimeout(function() {
                    var Magic360Options = {};
                    Magic360Options = {
                        onready: function() {
                            //console.log('onready', arguments[0]);
                        },
                        onstart: function() {
                            //console.log('onstart', arguments[0]);
                        },
                        onstop: function() {
                            //console.log('onstop', arguments[0]);
                        },
                        onzoomin: function() {
                            // console.log('onzoomin', arguments[0]);
                        },
                        onzoomout: function() {
                            //console.log('onzoomout', arguments[0]);
                        },
                        onspin: function() {
                            //console.log('onspin', arguments[0]);
                        },
                    };
                    Magic360.start('spin360');
                }, 2000);
            } else {

                var video = $(this).data('video');
                var vhtml = '<div id="modal-item-video" class="modal fade" tabindex="-1" role="dialog" aria-labelledby="lg_popup" aria-hidden="true"> <div class="modal_vah"> <div class="modal-dialog modal-dialog-vac modal-xs"> <div class="modal-content" style="max-width:322px;"> <div class="pop-top"> <h3>View 360 For ' + sku + ' </h3>    <button type="button" class="close" data-dismiss="modal" aria-hidden="true"><i class="fa fa-times"></i></button></div> <div class="modal-body" style="padding:0px;"><div class="videoElement tac pt5">  <div class="tac" id="videoElement">Loading the player...</div>      </div> <div class="clear"></div> </div> </div> </div> </div> </div>';
                $(vhtml).modal();
                setTimeout(function() { showViedoPlayer('', video); }, 2000);
            }
        });


    });

}

function getQuantity(navName) {
    function success(data) {
        if (data) {
            var elem = "<div id='salestock' class='fg-red heading not-in-stock'>Not In Stock<i class='icon-cancel-2 on-right fg-red'></i></div>";
            if (data == "yes") {
                elem = "<div id='salestock' class='fg-green heading in-stock'>In Stock<i class='icon-checkmark on-right fg-green'></i></div>";
            }
            $("#stockstatus").html(elem);
        }
    }

    $.post("/ajax/eshop/quantity?product=" + navName + "&mode=check", success);
    $.post("/ajax/eshop/quantity?product=" + navName + "&mode=num", function(data) {
        $(".stocknum").html(data);
    });
}

var currentTopSearchRequest = null;
var currentTopSearchMinLength = 3;
var yopSearchCacheQueryString = null;
var search_is_retail = 0;
var is_old_search = 0;

function callTopSearchAutoComplete(search) {
    if (search != "" && search.length >= currentTopSearchMinLength && yopSearchCacheQueryString != search) {

        if (currentTopSearchRequest != null) {
            currentTopSearchRequest.abort();
        }
        currentTopSearchRequest = $.ajax({
            url: '/ajax/_global/es_search_autocomplete',
            type: 'post',
            data: { query: search },
            dataType: 'json',
            beforeSend: function() {
                if (currentTopSearchRequest != null) {
                    currentTopSearchRequest.abort();
                }
            },
            success: function(response) {
                yopSearchCacheQueryString = search;

                var wwauto = document.body.clientWidth;

                if (wwauto > 991) {
                    if ($("#topSearchResult").length === 0) {
                        $("<ul id='topSearchResult' class='top_auto_search'></ul>").insertAfter('.top_search_desk');
                    }
                    if ($('#topSearchResult').css('display') == 'none') {
                        $('#topSearchResult').show();
                    }
                    search_is_retail = response.is_retail;
                    is_old_search = response.old_search_result;

                    var len = response.products.length;
                    $("#topSearchResult").empty();

                    if (response.old_search_result == 1) {
                        for (var i = 0; i < len; i++) {
                            $("#topSearchResult").append("<li value='" + response.products[i]['Sku'] + "'>" + "<div class='s_thumb'><a href='" + response.products[i]['Url'] + "'><img data-src='" + response.products[i]['Image'] + "' alt='" + response.products[i]['Name'] + "' title='" + response.products[i]['Name'] + "'></a></div><div class='s_info'>" + "<span class='s_name'><a href='" + response.products[i]['Url'] + "'>" + response.products[i]['Name'] + "</a></span><span class='s_sku'>" + response.products[i]['Sku'] + "</span><span class='s_price'>" + response.products[i]['Price'] + "</span>" + "</div>" + "</li>");
                        }
                        if (len > 3) {
                            $("#topSearchResult").append("<li ><a href='javascript:void(0);' id='topSearchShowAll'>Show all results →</li>");
                        }
                    } else {
                        for (var i = 0; i < len; i++) {
                            $("#topSearchResult").append("<li value='" + response.products[i]['Sku'] + "'>" + "<div class='s_thumb'><a href='" + response.products[i]['Url'] + "'><img data-src='" + response.products[i]['Image'] + "' alt='" + response.products[i]['Name'] + "' title='" + response.products[i]['Name'] + "'></a></div><div class='s_info'>" + "<span class='s_name'><a href='" + response.products[i]['Url'] + "'>" + response.products[i]['Name'] + "</a></span><span class='s_sku'>" + response.products[i]['Sku'] + "</span><span class='s_price'>" + response.products[i]['Price'] + "</span>" + "</div>" + "</li>");
                        }
                        if (len > 3) {
                            $("#topSearchResult").append("<li ><a href='javascript:void(0);' id='topSearchShowAll'>Show all results →</li>");
                        }
                    }

                    if (len == 0) {
                        $("#topSearchResult").append("<li ><a href='javascript:void(0);'>No Record Found</li>");
                    }

                    $("#topSearchResult li").bind("click", function() {});
                } else {
                    //For mobile
                    if ($("#topSearchResultMob").length === 0) {
                        $("<ul id='topSearchResultMob' class='top_auto_search'></ul>").insertAfter('.search_box');
                    }
                    if ($('#topSearchResultMob').css('display') == 'none') {
                        $('#topSearchResultMob').show();
                    }
                    is_old_search = response.old_search_result;
                    var len = response.products.length;
                    $("#topSearchResultMob").empty();

                    if (response.old_search_result == 1) {
                        for (var i = 0; i < len; i++) {
                            $("#topSearchResultMob").append("<li value='" + response.products[i]['Sku'] + "'>" + "<div class='s_thumb'><a href='" + response.products[i]['Url'] + "'><img data-src='" + response.products[i]['Image'] + "' alt='" + response.products[i]['Name'] + "' title='" + response.products[i]['Name'] + "'></a></div><div class='s_info'>" + "<span class='s_name'><a href='" + response.products[i]['Url'] + "'>" + response.products[i]['Name'] + "</a></span><span class='s_sku'>" + response.products[i]['Sku'] + "</span><span class='s_price'>" + response.products[i]['Price'] + "</span>" + "</div>" + "</li>");

                        }
                        if (len > 3) {
                            if (tmp_sub_domain == 'b2b') {
                                parentDomain = "https://b2b.gabrielny.com";
                            } else {
                                parentDomain = "https://embed.gabrielny.com";
                            }

                            var url = parentDomain + "/products-advanced/searchkeywordstring-" + search;
                            $("#topSearchResultMob").append("<li ><a href='" + url + "' id='topSearchShowAllMob' class='topSearchShowAllMob'>Show all results →</li>");
                        }
                    } else {
                        for (var i = 0; i < len; i++) {
                            $("#topSearchResultMob").append("<li value='" + response.products[i]['Sku'] + "'>" + "<div class='s_thumb'><a href='" + response.products[i]['Url'] + "'><img data-src='" + response.products[i]['Image'] + "' alt='" + response.products[i]['Name'] + "' title='" + response.products[i]['Name'] + "'></a></div><div class='s_info'>" + "<span class='s_name'><a href='" + response.products[i]['Url'] + "'>" + response.products[i]['Name'] + "</a></span><span class='s_sku'>" + response.products[i]['Sku'] + "</span><span class='s_price'>" + response.products[i]['Price'] + "</span>" + "</div>" + "</li>");

                        }
                        if (len > 3) {
                            if (tmp_sub_domain == 'b2b') {
                                parentDomain = "https://b2b.gabrielny.com";
                            } else {
                                parentDomain = "https://embed.gabrielny.com";
                            }

                            var url = parentDomain + "/products-advanced2/searchkeywordstring-" + search;
                            $("#topSearchResultMob").append("<li ><a href='" + url + "' id='topSearchShowAllMob' class='topSearchShowAllMob'>Show all results →</li>");
                        }
                    }

                    if (len == 0) {
                        $("#topSearchResultMob").append("<li ><a href='javascript:void(0);'>No Record Found</li>");
                    }

                }
            }
        });
    } else if (search == "") {
        $("#topSearchResult").empty();
        $("#topSearchResult").hide();

        $("#topSearchResultMob").empty();
        $("#topSearchResultMob").hide();
    }

}
$(document).on('click', '#topSearchShowAll', function(e) {
    $('.newsearchbox-icon').click();
});

$(document).click(function(e) {
    var container = $('#topSearchResult');
    if (!$(e.target).closest(container).length && !$(e.target).closest('.search-box').length && container.is(':visible')) {
        $('#topSearchResult').hide();
    }
});

function processScreen() {
    return;
    $('#prodImage, #prodImageMobile').removeData('elevateZoom');
    $('.zoomContainer').remove();
}

function searchURL(e, elem, term) {
    if (!term || typeof term === undefined || term === null) term = $(elem).val().trim();

    if (term && term.length > 1) {
        term = encodeURIComponent(term);
        var locationUrl = $(location).attr('href');
        if (locationUrl.indexOf('fashion-stackable') !== -1 || locationUrl.indexOf('eternity-stackable') !== -1) {
            var redirectUrl = "https://www.gabrielny.com";
            if (tmp_sub_domain == 'b2b') {
                redirectUrl = "https://b2b.gabrielny.com";
            }
            if (locationUrl.indexOf('fashion-stackable') !== -1) {
                redirectUrl = redirectUrl + '/fashion-stackable';
            }
            if (locationUrl.indexOf('eternity-stackable') !== -1) {
                redirectUrl = redirectUrl + '/eternity-stackable';
            }
            gotoStackableFilter(redirectUrl, term);
        } else {
            gotoAdvanceFilter(term);
        }
    }
}

function gotoStackableFilter(locationUrl, term) {
    //console.log(locationUrl+'/searchkeywordstring-'+term)
    $('#loader').show();
    window.location.href = locationUrl + '/searchkeywordstring-' + term;
}

function gotoAdvanceFilter(term) {
    //debugger;

    term = term.toLowerCase();

    var term2 = term.replace(/[&\/\\#,+()$~'":*?<>{}]/g, '');

    term = term.replace(/[&\/\\#,+()$~.'":*?<>{}]/g, '');
    // Ticket #2741 - Allow Searches for "Serial Number" on website Start
    var serialSearch = false;
    var w = document.body.clientWidth;
    if (w > 991) {
        if ($('.top_search_desk #topSearchBySerial').is(":checked")) {
            serialSearch = true;
        }
    } else {
        if ($('.top_search_mob #topSearchBySerial').is(":checked")) {
            serialSearch = true;
        }
    }

    if (serialSearch) {
        if (window.location.host.indexOf("embed") >= 0) {

        } else {
            var serialNo = term;
            $.ajax({
                type: 'POST',
                dataType: 'json',
                url: '/ajax/eshop/getstylenofromserialno',
                data: { serialNo: serialNo },
                async: true
            }).done(function(data) {

                if (data.success) {

                    if (data.specialItem == '1' || data.itemStatusFilter == 'Discontinued') {
                        var url = "https://embed.gabrielny.com/discontinued-items";
                        if (tmp_sub_domain == 'b2b') {
                            url = "https://b2b.gabrielny.com/discontinued-items";
                        }
                        window.location.href = url;
                        return;
                    } else if (data.itemCode != '') {
                        term = data.itemCode;
                        var url = "https://embed.gabrielny.com/products-advanced/searchkeywordstring-" + term;
                        if (tmp_sub_domain == 'b2b') {
                            url = "https://b2b.gabrielny.com/products-advanced/searchkeywordstring-" + term;
                        }
                        window.location.href = url;
                        return;
                    }
                } else {
                    var url = "https://embed.gabrielny.com/products-advanced/searchkeywordstring-" + term;
                    if (tmp_sub_domain == 'b2b') {
                        url = "https://b2b.gabrielny.com/products-advanced/searchkeywordstring-" + term;
                    }
                    window.location.href = url;
                    return;
                }
            });
        }
    } else {

        var parentDomain;
        if (window.location.host.indexOf("embed") >= 0) {
            parentDomain = "";
        } else if (tmp_sub_domain == 'b2b') {
            parentDomain = "https://b2b.gabrielny.com";
        } else {
            parentDomain = "https://embed.gabrielny.com";
        }

        if (is_old_search == 1) {
            var url = parentDomain + "/products-advanced/searchkeywordstring-" + term;
        } else {
            var url = parentDomain + "/products-advanced2/searchkeywordstring-" + term2;
        }


        if (url.indexOf('https://embed.gabrielny.com') >= 0 || url.indexOf('https://b2b.gabrielny.com') >= 0) {
            url = url.replace("https://embed.gabrielny.com", location.origin);
            url = url.replace("https://b2b.gabrielny.com", location.origin);
        }
        /*if(keywordSearch.indexOf(term.toUpperCase()) == -1){
            var url = parentDomain + "/products-advanced2/searchkeywordstring-" + term2;
        }
        else{
            var url = parentDomain + "/products-advanced/searchkeywordstring-" + term;
        }*/

        //var url = parentDomain + "/products-advanced/searchkeywordstring-" + term;

        window.location.href = url;
    }
}

function postsize() {

    var height = 0;
    // var body = document.body, html = document.documentElement;
    // height = Math.max( body.scrollHeight, body.offsetHeight, html.clientHeight, html.scrollHeight, html.offsetHeight );
    //var body = document.body, html = document.documentElement, height = Math.max(body.scrollHeight, body.offsetHeight, html.clientHeight, html.scrollHeight, html.offsetHeight);
    // var height = $("body").outerHeight(true);
    // var height = $("html").height();
    //var height = document.getElementsByTagName("html")[0].scrollHeight;
    height = $("html").outerHeight();
    window.parent.postMessage(["setHeight", height], "*");
    // console.log("height posted " + height);
}


function postFavorites($item) {

    window.parent.postMessage(["setFavorite", $item], "*");
    console.log("favorite posted " + $item);
}



function appendPathToURI(path, url) {
    if (url) {
        if (url.indexOf('?') > 0) {
            var sep = url.split('?');
            var uLen = (sep[0] + '').length;
            if (sep[0] && (sep[0] + '').lastIndexOf('/') == (uLen - 1)) {
                sep[0] = sep[0].substring(0, (uLen - 1));
            }
            url = sep[0] + path;
            if (sep.length > 1) {
                url += '?' + sep[1];
            }
        } else {
            url += path;
        }
    }
    return url;
}

/* Site Search and  EShop Integration related code ENDS */



// Extra CSS control

/*! Copyright (c) 2010 Brandon Aaron (http://brandonaaron.net)
 * Licensed under the MIT License (LICENSE.txt).
 */


var ESHOP_CONFIG = {
    isEmbed: function() {
        try {
            return window.self !== window.top;
        } catch (e) {
            return true;
        }
    },
    embedOrigin: '{HTTP_REFERER}'
};

window.addEventListener("message", function(message) {
    if (ESHOP_CONFIG && ESHOP_CONFIG.isEmbed() && message && message.data) {
        if (message.data.search && typeof message.data === "object" && typeof message.data.search === "string") {
            console.log(message);
            searchURL(null, null, message.data.search);
        } else if (message.data.origin) {
            ESHOP_CONFIG['embedOrigin'] = message.data.origin;
            alert('origin: ' + message.data.origin);
        }
        //alert (JSON.stringify(message.data));
    }
});

jQuery.uaMatch = function(ua) {
    ua = ua.toLowerCase();

    var match = /(chrome)[ /]([w.]+)/.exec(ua) ||
        /(webkit)[ /]([w.]+)/.exec(ua) ||
        /(opera)(?:.*version|)[ /]([w.]+)/.exec(ua) ||
        /(msie) ([w.]+)/.exec(ua) ||
        ua.indexOf("compatible") < 0 && /(mozilla)(?:.*? rv:([w.]+)|)/.exec(ua) || [];

    return {
        browser: match[1] || "",
        version: match[2] || "0"
    };
};


function LoadSmallImage() {

    $('.product-extra ul>li').off('click').on('click', function(e) {

        var item = $(this).data('item');
        var currentItem = $(this).data('current');
        var id = $(this).data('id');
        var baseImgElement = $('#product' + currentItem);

        if (id > 0) {
            url = "https://s7d4.scene7.com/is/image/GabrielCo/" + item + "-" + id + "?$Medium$";
            baseImgElement.find('.itemListingImage').attr({ "src": url });
        }
    });
}

// Don't clobber any existing jQuery.browser in case it's different
if (!jQuery.browser) {
    matched = jQuery.uaMatch(navigator.userAgent);
    browser = {};

    if (matched.browser) {
        browser[matched.browser] = true;
        browser.version = matched.version;
    }

    // Chrome is Webkit, but Webkit is also Safari.
    if (browser.chrome) {
        browser.webkit = true;
    } else if (browser.webkit) {
        browser.safari = true;
    }

    jQuery.browser = browser;
};

/* Embed Top Shoppingcart Start */
$(function() {
    $(document).on('click', '.basketcls', function(e) {
        var that = $(this);
        var path = that.data('path');
        $('#progressmodal .modal-body').html('Going to cart, please wait...');
        $('#progressmodal').modal({
            backdrop: 'static',
            keyboard: false
        }).show();
        setInterval(function() {
            $('#progressmodal').modal('hide');
            $('#progressmodal').data('modal', null);
        }, 1500);
        window.location.href = path;
    });
});
/* Embed Top Shoppingcart End */

$(document).on('hidden.bs.modal', function(event) {
    if ($('.modal:visible').length) {
        $('body').addClass('modal-open');
        //if ($(".modal-backdrop").length < 1) {
        //  $('body').append('<div class="modal-backdrop fade in"></div>');
        //}
    }
});

function requestClearCache(object) {
    var $that = $(object);

    console.log($that.data('path'), $that.data('uri'));

    if (confirm("Are you sure you wish to delete any cached files for:\r\n" + $that.data('path') + "?")) {
        $.ajax({
            type: "POST",
            url: '/ajax/_global/clear-cache',
            data: { uri: $that.data('uri') },
            dataType: "json",
            success: function(data) {
                if (data.success) {
                    location.reload();
                }
            }
        });
    }
}


$(function() {

    //var gRDD = ($('#global_Retailer_DD').length > 0);
    var gRDD = ($('.global_Retailer_DD').length > 0);

    //if (gRDD && $('#global_Retailer_DD').is(':visible')) {
    //if (gRDD && $('.global_Retailer_DD').is(':visible')) {
    if (gRDD) {

        //$('#global_Retailer_DD').autocomplete({
        $('.global_Retailer_DD').autocomplete({
            serviceUrl: "/ajax/_global/staff_company",
            minChars: 2,
            dataType: 'json',
            maxHeight: 300,
            //width:'100%',
            maxWidth: 300,
            triggerSelectOnValidInput: false,
            formatResult: function(suggestion, currentValue) {
                var pattern = '(' + (currentValue.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g, "\\$&")) + ')';
                if (!suggestion.combo) suggestion.combo = suggestion.value;
                return suggestion.combo.replace(new RegExp(pattern, 'gi'), '<strong>$1<\/strong>');
            },
            transformResult: function(response) {
                return {
                    suggestions: $.map(response, function(dataItem) {
                        $val = dataItem.retCode + " - " + dataItem.retName;
                        return { value: dataItem.retName, combo: $val, data: dataItem };
                    })
                };
            },
            onSearchStart: function() {},
            onSearchComplete: function() {},
            onSelect: function(suggestion) {
                $(this).val(suggestion.data.retName);

                if (suggestion.data.retCode != ''); {
                    var querystr = "global_Retailer_Code=" + suggestion.data.retCode;
                    $.post("/ajax/_global/staff_retailer", querystr, function(data) {
                        data = JSON.parse(data);
                        if (data.success) {
                            location.reload();
                        }

                    });
                }

            }
        });

    }

});


/***************** Store Locator Widget Start **************/
/*
$(document).ready(function () {

    $('#retailer_box .btnchangeauthstore, #retailer_box2 .btnchangeauthstore, #retailer_box_mobile .btnchangeauthstore, #serviceProvider .btnchangeauthstore, .btnchangeauthstore').on('click', function(e)
    {
        e.preventDefault();
        e.stopPropagation();
        $("#loader").show();
        $('.modal-backdrop').remove();
        $('#modal-change-store').remove();
        var productId = $('#widgetProductId').val();
        var division = $('#widgetDivision').val();
        var zipcode = $('#widgetZip').val();

        if(zipcode === 'undefined' || zipcode === '') {
            zipcode = $('#widgetZip_mobile').val();
        }
        if (division === 'undefined' || division === '') {
            division = $('#widgetDivision_mobile').val();
        }
        if (productId  === 'undefined' || productId === ''){
            productId = $('#widgetProductId_mobile').val();
        }
        $.ajax({
            type: "POST",
            url: '/ajax/_global/change-store',
            data: "mode=changeStore&productId="+productId+'&division='+division+'&widgetZip='+zipcode,
            dataType: "json",
            success: function(data)
            {
                $('body').append($(data.html).modal('show'));
                $("#loader").hide();
                initChangeStore();
                return false;
            }
        }).done(function(data) {
            $("#loader").hide();
        });
        $(".modal-content").hide();
    });

    getSLWidgetStockStatus();   //get Stock avaibility status for store locator widget

});

function changeStoreModel() {
    $('#modal-change-store').modal('hide');
    $('.modal-backdrop').remove();
    $('#modal-change-store').remove();
    $("#loader").hide();
}


function initChangeStore()
{
    //hide retailer logo if not exist
    // $('#retailer_change_box_inner .rectangle').each(function(i, obj) {
    // if(!$(this).find('img').length){
    // $(this).hide();
    // }
    // });

    $('#modal-change-store .btnpickauthstore').unbind('click').on('click', function(e)
    {
        e.preventDefault();
        e.stopPropagation();
        $("#loader").show();
        $('.modal-backdrop').remove();
        $('#modal-change-store').remove();

        var retCode = $(this).data('retcode');
        var retName = $(this).data('retname');
        var addName = $(this).data('addname');
        var addAddress1 = $(this).data('addaddress1');
        var tierTitle = $(this).data('tiertitle');
        var address = $(this).data('address');
        var addLat = $(this).data('addlat');
        var addLong = $(this).data('addlong');
        var addAppointment = $(this).data('addappointment');
        var addEmail = $(this).data('addemail');
        var addImage = $(this).data('addimage');
        var shiptostore = $(this).data('shiptostore');

        var eshopMode = $(this).data('mode');
        var pathname = window.location.href;
        //console.log(pathname);
        $.ajax({
            type: "POST",
            url: '/ajax/_global/change-store',
            data: "mode=setStore&retCode="+retCode+'&retName='+retName+'&addName='+addName+'&addAddress1='+addAddress1+'&tierTitle='+tierTitle+'&address='+address+'&addLat='+addLat+'&addLong='+addLong+'&addAppointment='+addAppointment+'&addEmail='+addEmail+'&addImage='+addImage+'&eshopMode='+eshopMode+'&shiptostore='+shiptostore,
            dataType: "json",
            success: function(data)
            {
                if(data.status == 'OK')
                {
                    if (pathname.indexOf('cart') > -1) {
                        $.redirect(pathname, {'review':1});
                    }else{
                        location.reload();
                    }
                    return false;
                }
            }
        }).done(function(data) {
            $("#loader").hide();
        });
    });

    $("#findauthstore").off('submit').on("submit", function(){

        var Widgetzip = $('#widgetZipLocal').val();
        var Widgetmode = $('#Widgetmode').val();
        var WidgetProductId = $('#widgetProductId').val();

        if(Widgetzip == '')
        {
            alert("Please enter location.");
            $('#Widgetzip').focus();
            return false;
        }

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

        $.ajax({
            type: "POST",
            url: '/ajax/_global/change-store',
            data: "mode=findStore&widgetZip="+Widgetzip+'&division='+Widgetmode+'&productId='+WidgetProductId,
            dataType: "json",
            success: function(data)
            {
                if(data.status == 'OK')
                {
                    $('#retailer_change_box_inner').html(data.html);
                    //location.reload();
                    $("#loader").hide();
                    initChangeStore();
                    return false;
                }
                else
                {
                    $("#loader").hide();
                    alert('Sorry, something went wrong: Please try again.');
                    return false;
                }
            }
        }).done(function(data) {
            $("#loader").hide();
        });

        return false;
    });

    // $('#modal-change-store .gcny-retailer-stock').each(function(i, obj) {

    //  var retCode = $(this).attr("data-retCode");
    //  var productId = $(this).attr("data-productId");

    //  var aobj = $(this);

    //     $.ajax({
    //      type: 'POST',
    //      dataType: 'json',
    //      url: '/ajax/_global/store-widget-stock-status',
    //      data: {retCode: retCode,productId: productId},
    //      async: false
    //  }).done(function(data)
    //  {
    //      var elem = "View - <span class=\"tcolor4\">1 Week</span>";
    //      if(data.success)
    //      {
    //          if(data.result != '')
    //          {
    //              elem = data.result;
    //          }
    //      }
    //      aobj.html(elem);
    //  });
    // });

}

//get Stock avaibility status for store locator widget
function getSLWidgetStockStatus()
{
    $('#retailer_box .gcny-retailer-stock, #retailer_box2 .gcny-retailer-stock, #retailer_box_mobile .gcny-retailer-stock, #serviceProvider .gcny-retailer-stock').each(function(i, obj) {

        var retCode = $(this).attr("data-retCode");
        var productId = $(this).attr("data-productId");
        if(productId == '')
        {
            productId = '{navName}';
        }
        var aobj = $(this);

        $.ajax({
            type: 'POST',
            dataType: 'json',
            url: '/ajax/_global/store-widget-stock-status',
            data: {retCode: retCode,productId: productId},
            async: true
        }).done(function(data)
        {
            var elem = "View - <span class=\"tcolor4\">7 Days</span>";
            if(data.success)
            {
                if(data.result != '')
                {
                    elem = data.result;
                    //alert(data.days);
                    $('#widgetViewInDays').val(data.days);
                }
                else
                {
                    // elem = 'Available to view at <br/>' + data.retName;
                    elem = 'Available to view at our Gabriel Authorized Independent Retailer  <br/>';
                }
            }
            else
            {
                $('#widgetViewInDays').val(data.days);
                // elem = 'Available to view at <br/>' + data.retName;
                elem = 'Available to view at our Gabriel Authorized Independent Retailer <br/>';
            }
            aobj.html(elem);
        });
    });
}
*/
/***************** Store Locator Widget End **************/
$(document).on('click', '.userbasketcls', function(e) {
    var that = $(this);
    var loadimg = that.data('loadimg');
    var path = that.data('path');
    $('#modal-size-view').addClass('modal-xs');
    $('#progressmodal .modal-body').html('<p class="f16 mt20 tac">Going to cart, please wait...<br><img data-src="' + loadimg + '" alt="loading..." class="loadimgcls" /></p>');
    $('#progressmodal').modal({
        keyboard: false
    }).show();
    setInterval(function() {
        $('#progressmodal').modal('hide');
        $('#progressmodal').data('modal', null);
    }, 1500);
    window.location.href = path;
});

$(document).on('click', '.userb2cbasketcls', function(e) {
    /* var that = $(this);
     var loadimg = that.data('loadimg');
     var path = that.data('path');
     $('#modal-size-view').addClass('modal-xs');
     $('#progressmodal .modal-body').html('<p class="f16 mt20 tac">Going to cart, please wait...<br><img data-src="' + loadimg + '" alt="loading..." class="loadimgcls" /></p>');
     $('#progressmodal').modal({
         keyboard: false
     }).show();
     window.location.href = path;*/
});

$(document).ready(function() {
    //Ticket #631
    //Start Retailer POPUP
    $('#confirmYes').on('click', function(el) {
        $.ajax({
            type: 'POST',
            url: '/ajax/_global/retailercustomer',
            data: 'is_customer=yes'
        }).done(function(data) {
            data = JSON.parse(data);
            if (data.success == true && data.reload == true) {
                location.reload();
            } else {
                $('#retailer_customer').modal('hide');
            }
        });
    });

    $('#closeYes').on('click', function(el) {
        el.preventDefault();
        el.stopPropagation();

        $.ajax({
            type: 'POST',
            url: '/ajax/_global/retailercustomer',
            data: 'is_customer=no'
        }).done(function(data) {
            $('#retailer_customer').modal('hide');
        });
    });

    $('#pricemodeYes').on('click', function(el) {
        var dataval = $(this).attr('data-code');
        $.ajax({
            type: 'POST',
            url: '/ajax/_global/retailercustomer',
            data: 'is_customer=' + dataval
        }).done(function(data) {
            data = JSON.parse(data);
            if (data.success == true && data.reload == true) {
                location.reload();
            } else {
                $('#pricemode').modal('hide');
            }
        });
    });
    $('#pricemodeNo').on('click', function(el) {
        el.preventDefault();
        el.stopPropagation();
        var dataval = $(this).attr('data-code');
        $.ajax({
            type: 'POST',
            url: '/ajax/_global/retailercustomer',
            data: 'is_customer=' + dataval
        }).done(function(data) {
            data = JSON.parse(data);
            if (data.success == true && data.reload == true) {
                location.reload();
            } else {
                $('#pricemode').modal('hide');
            }
        });
    });
    //End Retailer POPUP
    $('#pricemodeRewards').on('click', function(el) {
        el.preventDefault();
        el.stopPropagation();
        /*var redirect = window.location.pathname;
         $.redirect(redirect,{'isRewards':1}); */
        var dataval = $(this).attr('data-code');
        $.ajax({
            type: 'POST',
            url: '/ajax/_global/retailercustomer',
            data: 'is_customer=' + dataval
        }).done(function(data) {
            data = JSON.parse(data);
            if (data.success == true && data.reload == true) {
                //location.reload();
                window.location.href = window.location.pathname;
            } else {
                $('#pricemode').modal('hide');
            }
        });
    });
});

$(document).ready(function() {

    /*$('#retailer_box .gcnysw-stockstatus').each(function(i, obj) {
        var retCode = $(this).attr("data-retCode");
        var productId = $(this).attr("data-productId");
        var aobj = $(this);
        $.ajax({
            type: 'POST',
            dataType: 'json',
            url: '/ajax/_global/getstorewidgetstockstatus',
            data: {retCode: retCode,productId: productId},
            async: true
        }).done(function(data)
        {
            var elem = "Available to view at this Gabriel Authorized Independent Retailer";
            if(data.resp != '')
            {
                elem = "Available to view " + data.resp + " at this Gabriel Authorized Independent Retailer";
            }
            aobj.html(elem);
            $('#retailer_box_mobile .gcnysw-stockstatus').html(elem);
        });
    });*/

    //Start For Event popup
    $('#eventnearme').on('hidden.bs.modal', function(e) {
        $.ajax({
            type: 'POST',
            url: '/ajax/_global/eventsave',
            data: 'eventinfo=off'
        }).done(function(data) {
            var data = JSON.parse(data);
            if (data.success) {}
        });
    });

    $('#rsvp_event').on('click', function(el) {
        $.ajax({
            type: 'POST',
            url: '/ajax/_global/eventsave',
            data: 'eventinfo=off'
        }).done(function(data) {
            var data = JSON.parse(data);
            if (data.success) {
                if ($('#rsvp_event').attr('data-link') != "") {
                    window.location.href = $('#rsvp_event').attr('data-link');
                }
            }
        });
    });
    //End For Event popup

});



/* Expand searchbox on click */

$(document).ready(function() {
    var submitIcon = $('.newsearchbox-icon');
    var inputBox = $('.newsearchbox-input');
    var searchBox = $('.newsearchbox');
    var isOpen = false;
    submitIcon.click(function(e) {
        var inputVal = $('.newsearchbox-input').val();
        inputVal = $.trim(inputVal).length;
        if (inputVal !== 0) {
            e.stopPropagation();
            e.preventDefault();
            var textBox = $('.search-box .itemSearch').val().trim();
            if (!textBox || typeof textBox === undefined || textBox === null) {
                $('.search-box .itemSearch').focus();
            } else {
                searchURL(e, null, textBox);
            }
            return false;
        }

        if (isOpen == false) {
            searchBox.addClass('newsearchbox-open');
            inputBox.focus();
            isOpen = true;
            $('.top_checkboxes').show();
        } else {
            searchBox.removeClass('newsearchbox-open');
            inputBox.focusout();
            isOpen = false;
            $('.top_checkboxes').hide();
        }
    });
    submitIcon.mouseup(function() {
        return false;
    });
    searchBox.mouseup(function() {
        return false;
    });
    $(document).mouseup(function(e) {
        if (isOpen == true) {
            if (!$(e.target).closest('.top_checkboxes').length) {
                $('.newsearchbox-icon').css('display', 'block');
                //submitIcon.click();
            }
        }
    });
});

//Retailer Site
$(document).ready(function() {
    $(".rtmenu li.sub").hover(
        function() {
            $(this).addClass("hover");
        },
        function() {
            $(this).removeClass("hover");
        }
    );
});

function trackAppointmentLeadsEvents(eventCategory, eventAction, eventLabel) {
    eventLabel = (typeof eventLabel !== 'undefined') ? eventLabel : '';
    dataLayer.push({
        'event': 'GeoLocFindStoreBookAppointment',
        'eventCategory': eventCategory,
        'eventAction': eventAction,
        'eventLabel': eventLabel
    });
}

// View In Store Start

function trackGeoLocFindStoreBookAppointmentEvents(eventCategory, eventAction, eventLabel, eventValue) {
    eventValue = (typeof eventValue !== 'undefined') ? eventValue : '';
    //console.log('trackGeoLocFindStoreBookAppointmentEvents - '+eventCategory+' - '+eventAction+' - '+eventLabel+' - '+eventValue);
    if (eventLabel != '' && eventLabel != undefined) {
        //var dataLayer = dataLayer || [];
        dataLayer.push({
            'event': 'GeoLocFindStoreBookAppointment',
            'eventCategory': eventCategory,
            'eventAction': eventAction,
            'eventLabel': eventLabel,
            'eventValue': eventValue
        });
        //console.log(dataLayer);
        if (eventCategory == "Store Locator Requests") {
            trackFacebookSubmissionEvents(eventCategory, eventAction, eventLabel);
        }
    }

}

function trackOtherStoreRequestsEvents(eventCategory, eventAction, eventLabel) {
    if (eventLabel != '' && eventLabel != undefined) {
        dataLayer.push({
            'event': 'otherStoreRequestsEvents',
            'eventCategory': eventCategory,
            'eventAction': eventAction,
            'eventLabel': eventLabel
        });
    }
}

function trackFacebookSubmissionEvents(eventCategory, eventAction, eventLabel) {
    eventLabel = (typeof eventLabel !== 'undefined') ? eventLabel : '';
    dataLayer.push({
        'event': 'FBBookAppoinment',
        'eventCategory': eventCategory,
        'eventAction': eventAction,
        'eventLabel': eventLabel
    });

    if (eventCategory == "Store Locator Requests") {
        var klaviyo_store_locator_request_data = {
            "eventCategory": eventCategory,
            "eventAction": eventAction,
            "eventLabel": eventLabel
        };
        dataLayer.push({
            "event": "klaviyo_store_locator_request",
            "klaviyo_store_locator_request_data": klaviyo_store_locator_request_data
        });
    }
}

function trackKlaviyoBookAppointment(event, action, data) {
    if (event == "Initiate Book Appointment") {
        var klaviyo_initiate_book_appointment_data = {
            "Action": action
        };
        if (data != undefined) {
            Object.assign(klaviyo_initiate_book_appointment_data, data);
        }
        dataLayer.push({
            "event": "klaviyo_initiate_book_appointment",
            "klaviyo_initiate_book_appointment_data": klaviyo_initiate_book_appointment_data
        });
    }

    if (event == "Book Appointment lead") {
        var klaviyo_book_appointment_lead_data = {
            "Action": action
        };
        if (data != undefined) {
            Object.assign(klaviyo_book_appointment_lead_data, data);
        }
        dataLayer.push({
            "event": "klaviyo_book_appointment_lead",
            "klaviyo_book_appointment_lead_data": klaviyo_book_appointment_lead_data
        });
    }
}


if ('1' == '1') {
    $(function() {


        function showMyPositionLocalNew(position, self, callback) {
            var lat = position.coords.latitude;
            var lng = position.coords.longitude;
            //var lat = '40.761';
            //var lng = '-73.330';
            $.post("/ajax/_global/user_location/", { lat: lat, lng: lng, mode: 'set_my_geo_coords' },
                function(data) {
                    data = JSON.parse(data);
                    if (data.status == "OK") {
                        callback(data);
                    }
                });
        }

        function showMyErrorLocal(error) {
            var errorCode = "";
            switch (error.code) {
                case error.PERMISSION_DENIED:
                    errorCode = "User denied the request for Geolocation.";
                    break;
                case error.POSITION_UNAVAILABLE:
                    errorCode = "Location information is unavailable.";
                    break;
                case error.TIMEOUT:
                    errorCode = "The request to get user location timed out.";
                    break;
                case error.UNKNOWN_ERROR:
                    errorCode = "An unknown error occurred.";
                    break;
            }
            alert(errorCode);
        }


        // Your Location Popup Start
        var prevent_track_confirm_btn_click = 'no';
        if ($("#show_location_popup").val() == 1) {

            $.ajax({
                type: "POST",
                url: '/ajax/_global/user_location',
                data: "mode=show_location_popup",
                dataType: "json",
                success: function(data) {
                    if (data.status == "OK") {
                        /* // Disable location popup
                        $('body').append(data.html);
                        var w = document.body.clientWidth;
                        if (w > 991) {
                            if($('#top_location_popup').length) {
                                $('#top_location_popup').appendTo("body").modal('show');
                                $('#prddtl-find-store #findStoreZip').val($('#top_location_popup #userloc_td_zip').val());
                                $('.find_sop #zip').val($('#top_location_popup #userloc_td_zip').val());
                                $('.find_store #zip').val($('#top_location_popup #userloc_td_zip').val());
                                trackGeoLocFindStoreBookAppointmentEvents('Geo-Location Popup', 'impression', $('#top_location_popup #userloc_td_zip').val());
                                trackGeoLocFindStoreBookAppointmentEvents('Store Locator Leads', 'web traffic', $('#top_location_popup #userloc_td_zip').val());
                                
                            }
                        } else {
                            if($('#top_location_popup_outer').length) {
                                $("#top_location_popup_outer").addClass("sideNavMob");
                                $(".toploc_section .sidenavbg").show();
                                $('#prddtl-find-store #findStoreZip').val($('#toploc_section #userloc_tm_zip').val());
                                $('.find_sop #zip').val($('#toploc_section #userloc_tm_zip').val());
                                $('.find_store #zip').val($('#toploc_section #userloc_tm_zip').val());
                                trackGeoLocFindStoreBookAppointmentEvents('Geo-Location Popup', 'impression', $('#toploc_section #userloc_tm_zip').val());
                                trackGeoLocFindStoreBookAppointmentEvents('Store Locator Leads', 'web traffic', $('#toploc_section #userloc_tm_zip').val());
                                
                            }
                        }
                        $("#show_location_popup").val(0);
                        
                        var uloc_device = 'desk';
                        if (w > 991) {
                            uloc_device = 'desk';
                        } else {
                            uloc_device = 'mob';
                        }
                        productPageMobileScrollSetting(uloc_device);
                        */
                    }
                }
            }).done(function(data) {

            });


        }

        $(document.body).off('click', '#top_location_popup_outer .closeWindow').on('click', '#top_location_popup_outer .closeWindow', function(e) {
            if ($("#top_location_popup_outer").hasClass("sideNavMob") && !$('#top_location_popup').hasClass('ignore-track')) {
                trackGeoLocFindStoreBookAppointmentEvents('Geo-Location Popup', 'ignore/close popup click', $('#toploc_section #userloc_tm_zip').val());
            }
            $(".toploc_section .sidenavbg").hide();
            $("#top_location_popup_outer").removeClass("sideNavMob");
        });

        $(document.body).off('click', '.toploc_section .sidenavbg').on('click', '.toploc_section .sidenavbg', function(e) {
            $(".closeWindow").trigger("click");
        });

        //~ $(document.body).on('click', '#top_location_popup .close', function(e)
        //~ {  
        //~ if($('#top_location_popup').hasClass('initpopup')){
        //~ trackGeoLocFindStoreBookAppointmentEvents('Geo-Location Popup', 'ignore/close popup click', $('#userloc_tm_zip').val());
        //~ }
        //~ });

        //$("#top_location_popup").on("hidden.bs.modal", function () {
        $(document).on('hidden.bs.modal', function(event) {
            if ((/iPad|iPhone|iPod/.test(navigator.userAgent) && !window.MSStream) || /^((?!chrome|android).)*safari/i.test(navigator.userAgent)) {
                document.body.removeEventListener("wheel", preventPageScroll, { passive: false });
                document.body.removeEventListener("touchmove", preventPageScroll, { passive: false });
                unlockBody();
            }

            if ($("body").hasClass("noscroll-vertical")) {
                if (!$('#userb2cbasketcls').hasClass('act')) {
                    $("body").removeClass("noscroll-vertical");
                }
            }
            if ($('#top_location_popup').hasClass('initpopup') && !$('#top_location_popup').hasClass('ignore-track')) {
                $('#top_location_popup').addClass('ignore-track');
                trackGeoLocFindStoreBookAppointmentEvents('Geo-Location Popup', 'ignore/close popup click', $('#userloc_td_zip').val());
            }
        });

        $('body').on('click', '#userloc_td_confirm_btn, #userloc_tm_confirm_btn', function(el) {
            var clckd_elm_id = $(this).attr('id');
            var userloc_td_zip = '';
            if (clckd_elm_id == 'userloc_td_confirm_btn') {
                userloc_td_zip = $('#top_location_popup #userloc_td_zip').val();
            } else if (clckd_elm_id == 'userloc_tm_confirm_btn') {
                userloc_td_zip = $('#toploc_section #userloc_tm_zip').val();
            }

            if (userloc_td_zip.trim() == '') {
                alert('Please enter a valid zip/postal code');
                return;
            }
            $("#loader").show();
            $.ajax({
                type: "POST",
                url: '/ajax/_global/user_location',
                data: "mode=confirm_zip&zip=" + userloc_td_zip,
                dataType: "json",
                success: function(data) {
                    if (data.status == "OK") {
                        if (clckd_elm_id == 'userloc_td_confirm_btn') {
                            $('#top_location_popup').modal('hide');
                            $('.modal-backdrop').remove();
                        } else if (clckd_elm_id == 'userloc_tm_confirm_btn') {
                            $(".closeWindow").trigger("click");
                        }
                        $('#prddtl-find-store #findStoreZip').val(userloc_td_zip);
                        $('.find_sop #zip').val(userloc_td_zip);
                        $('.find_store #zip').val(userloc_td_zip);
                        if (prevent_track_confirm_btn_click != 'yes') {
                            trackGeoLocFindStoreBookAppointmentEvents('Geo-Location Popup', 'confirm button click', userloc_td_zip);
                        }
                        $('#top_location_popup').addClass('ignore-track');
                    }
                }
            }).done(function(data) {
                $("#loader").hide();
            });
        });




        $('body').on('click', '#userloc_td_usemy_loc, #userloc_tm_usemy_loc', function(el) {

            var clckd_elm_id = $(this).attr('id');
            if (navigator.geolocation) {
                var self = this;
                navigator.geolocation.getCurrentPosition(function(position) {
                    if (clckd_elm_id == 'userloc_td_usemy_loc') {
                        var zip = showMyPositionLocalNew(position, self, function(data) {
                            $('#top_location_popup #userloc_td_zip').val(data.location.zip);
                            prevent_track_confirm_btn_click = 'yes';
                            trackGeoLocFindStoreBookAppointmentEvents('Geo-Location Popup', 'update current location link click', data.location.zip);
                            $('#top_location_popup').addClass('ignore-track');
                            $("#userloc_td_confirm_btn").click();
                        });
                    } else if (clckd_elm_id == 'userloc_tm_usemy_loc') {
                        var zip = showMyPositionLocalNew(position, self, function(data) {
                            $('#toploc_section #userloc_tm_zip').val(data.location.zip);
                            prevent_track_confirm_btn_click = 'yes';
                            trackGeoLocFindStoreBookAppointmentEvents('Geo-Location Popup', 'update current location link click', data.location.zip);
                            $('#top_location_popup').addClass('ignore-track');
                            $("#userloc_tm_confirm_btn").click();
                        });
                    }
                }, showMyErrorLocal);
            } else {
                alert("Your browser does not support geo location.");
            }

            //Temp
            /*
            if(clckd_elm_id == 'userloc_td_usemy_loc') {
                var zip = showMyPositionLocalNew(1, 1,function(data) {
                    $('#top_location_popup #userloc_td_zip').val(data.location.zip);
                    $("#userloc_td_confirm_btn").click();
                });
            } else if(clckd_elm_id == 'userloc_tm_usemy_loc') {
                var zip = showMyPositionLocalNew(1, 1,function(data) {
                    $('#toploc_section #userloc_tm_zip').val(data.location.zip);
                    $("#userloc_tm_confirm_btn").click();
                });
            }
            */

        });

        // Your Location Popup End


        // Find A Store Detail Page Start

        $('body').on('click', '#prddtl-find-store #findStoreSubmit, #findstore_popup_outer #findStorePopSubmit, #findstore_popup_outer #fs_m_upzipbx_submit, #findstore_popup_outer #fndstorebackarw', function(el) {
            var clckd_elm_id = $(this).attr('id');
            var show_schedule_viewing_in_store_btn = 0;
            if ($('#show_schedule_viewing_in_store_btn').length) {
                show_schedule_viewing_in_store_btn = $('#show_schedule_viewing_in_store_btn').val();
            }

            var userloc_fs_zip = '';
            if (clckd_elm_id == 'findStoreSubmit') {
                trackAppointmentLeadsEvents('Appointment Leads', 'Find Nearest Store Clicks (PDP)', userloc_fs_zip);
                userloc_fs_zip = $('#prddtl-find-store #findStoreZip').val();
            } else if (clckd_elm_id == 'findStorePopSubmit') {
                userloc_fs_zip = $('#findstore_popup_outer #findStorePopZip').val();
            } else if (clckd_elm_id == 'fs_m_upzipbx_submit') {
                userloc_fs_zip = $('#findstore_popup_outer #fs_m_upzipbx_zip').val();
            } else if (clckd_elm_id == 'fndstorebackarw') {
                userloc_fs_zip = $('#prddtl-find-store #findStoreZip').val();
            }

            if (clckd_elm_id != 'findStoreSubmit' && userloc_fs_zip.trim() == '') {
                alert('Please enter a valid zip/postal code');
                return;
            }


            var w = document.body.clientWidth;
            var uloc_device = 'desk';
            if (w > 991) {
                uloc_device = 'desk';
            } else {
                uloc_device = 'mob';
            }

            productPageMobileScrollSetting(uloc_device);

            var data_str = '';
            if (clckd_elm_id == 'findStoreSubmit') {
                trackAppointmentLeadsEvents('Appointment Leads', 'Find Nearest Store Clicks (PDP)', userloc_fs_zip);
                data_str = 'mode=find_store_popup&zip=' + userloc_fs_zip + '&uloc_device=' + uloc_device + '&show_schedule_viewing_in_store_btn=' + show_schedule_viewing_in_store_btn + '&itemcode=' + $('#findStoreSubmit').attr('data-itemcode');
            } else if (clckd_elm_id == 'findStorePopSubmit') {
                data_str = 'mode=find_store_popup&zip=' + userloc_fs_zip + '&uloc_device=' + uloc_device + '&inner_contents=1&show_schedule_viewing_in_store_btn=' + show_schedule_viewing_in_store_btn + '&itemcode=' + $('#findStoreSubmit').attr('data-itemcode');
            } else if (clckd_elm_id == 'fs_m_upzipbx_submit') {
                data_str = 'mode=find_store_popup&zip=' + userloc_fs_zip + '&uloc_device=' + uloc_device + '&inner_contents=1&itemcode=' + $('#findStoreSubmit').attr('data-itemcode');
            } else if (clckd_elm_id == 'fndstorebackarw') {
                data_str = 'mode=find_store_popup&zip=' + userloc_fs_zip + '&uloc_device=' + uloc_device + '&itemcode=' + $('#findStoreSubmit').attr('data-itemcode');
            }

            $("#loader").show();
            $.ajax({
                type: "POST",
                url: '/ajax/_global/user_location',
                data: data_str,
                dataType: "json",
                success: function(data) {
                    if (data.status == "OK") {

                        if (clckd_elm_id == 'findStoreSubmit') {
                            $('.show_back_bg').remove();
                            $('.sidenavbg').remove();
                            $('#findstore_popup_outer').remove();
                            $('body').append(data.html);
                            trackGeoLocFindStoreBookAppointmentEvents('Store Locator Leads', 'find store click on product page', userloc_fs_zip);
                        } else if (clckd_elm_id == 'findStorePopSubmit') {
                            $('#findstore_popup_outer .loc_l-inner').html(data.html);
                        } else if (clckd_elm_id == 'fs_m_upzipbx_submit') {
                            $('#findstore_popup_outer #fs_m_store_res').html(data.html);
                        } else if (clckd_elm_id == 'fndstorebackarw') {
                            //$('#findstore_popup_outer .sttoploc_section').html(data.html);
                            var htmlcontent_1 = $('.sttoploc_section', data.html).html();
                            $('#findstore_popup_outer .sttoploc_section').html(htmlcontent_1);
                        }

                        if (clckd_elm_id == 'findStoreSubmit' || clckd_elm_id == 'findStorePopSubmit' || clckd_elm_id == 'fs_m_upzipbx_submit') {
                            if ($('#findStoreSubmit').attr('data-eshopmode') == 'bridal') {
                                trackGeoLocFindStoreBookAppointmentEvents('Store Locator Requests', 'Bridal Product Page', userloc_fs_zip);
                            } else if ($('#findStoreSubmit').attr('data-eshopmode') == 'fashion') {
                                trackGeoLocFindStoreBookAppointmentEvents('Store Locator Requests', 'Fashion Product Page', userloc_fs_zip);
                            }
                        }

                        var e = $("#store-hoz-slider");
                        e.children().each(function(index) {
                            $(this).attr('data-position', index);
                        });
                        //~ e.owlCarousel({
                        //~ loop: false,
                        //~ margin:10,
                        //~ responsiveClass: true,
                        //~ nav: true,
                        //~ dots:false,
                        //~ mouseDrag: true,
                        //~ items: 1,
                        //~ navText: ['<i class="fa fa-angle-left"></i>', '<i class="fa fa-angle-right"></i>'],
                        //~ responsive: {
                        //~ 0: {items: 1, stagePadding:50},
                        //~ 480: {items: 2, stagePadding:50},
                        //~ 768: {items: 2, stagePadding:50},
                        //~ 992: {items: 2, stagePadding:50}
                        //~ }
                        //~ }).on("changed.owl.carousel", function(s) {
                        //~ var i = s.item.index;
                        //~ $("#findstore_popup_outer #store-hoz-slider .owl-item li").removeClass('active');
                        //~ $("#findstore_popup_outer #store-hoz-slider").find("[data-fdstore-id='" + i + "']").addClass('active');
                        //~ });

                        //~ $('#store-hoz-slider').off('click').on('click', '.owl-item>li', function (el){
                        //~ if(!$(this).hasClass('active')) {
                        //~ e.trigger("to.owl.carousel", [ $(this).attr( 'data-position'), 500, !0 ]);
                        //~ e.find(".owl-item li").removeClass('active');
                        //~ e.find(".owl-item").eq($(this).attr( 'data-position')).children('li').addClass("active");
                        //~ }
                        //~ });
                        if (w <= 991) {
                            $('#store-hoz-slider').off('click').on('click', 'li', function(el) {
                                if (!$(this).hasClass('active')) {
                                    //e.trigger("to.owl.carousel", [ $(this).attr( 'data-position'), 500, !0 ]);
                                    $('#store-hoz-slider').find("li").removeClass('active');
                                    $('#store-hoz-slider li').eq($(this).attr('data-position')).addClass("active");
                                }
                            });
                        }


                        if (clckd_elm_id == 'findStoreSubmit') {
                            setTimeout(function() {
                                $("#findstore_popup_outer").addClass("sideNavMob");
                                $(".sidenavbg").show();
                            }, 50);
                        } else if (clckd_elm_id == 'findStorePopSubmit') {
                            $('#prddtl-find-store #findStoreZip').val(userloc_fs_zip);
                            $('.find_sop #zip').val(userloc_fs_zip);
                            $('.find_store #zip').val(userloc_fs_zip);
                        } else if (clckd_elm_id == 'fs_m_upzipbx_submit') {
                            $('#prddtl-find-store #findStoreZip').val(userloc_fs_zip);
                            $('.find_sop #zip').val(userloc_fs_zip);
                            $('.find_store #zip').val(userloc_fs_zip);
                        }
                        AddProductPagePopMobileScroll();
                    }
                }
            }).done(function(data) {
                $("#loader").hide();
            });
        });

        $(document.body).off('click', '#findstore_popup_outer .closeWindow').on('click', '#findstore_popup_outer .closeWindow', function(e) {
            $(".sidenavbg").hide();
            $("#findstore_popup_outer").removeClass("sideNavMob");
        });

        $(document.body).off('click', '.sidenavbg').on('click', '.sidenavbg', function(e) {
            $("#findstore_popup_outer .closeWindow").trigger("click");
        });

        $('body').on('click', '#prddtl-find-store #prddtl-use-my-loc, #findstore_popup_outer #findStorePopUseMyLoc', function(el) {
            var clckd_elm_id = $(this).attr('id');
            if (navigator.geolocation) {
                var self = this;
                navigator.geolocation.getCurrentPosition(function(position) {
                    if (clckd_elm_id == 'prddtl-use-my-loc') {
                        var zip = showMyPositionLocalNew(position, self, function(data) {
                            $('#prddtl-find-store #findStoreZip').val(data.location.zip);
                            $('.find_sop #zip').val(data.location.zip);
                            $('.find_store #zip').val(data.location.zip);
                            $("#prddtl-find-store .findStoreSubmit").click();
                        });
                    } else if (clckd_elm_id == 'findStorePopUseMyLoc') {
                        var zip = showMyPositionLocalNew(position, self, function(data) {
                            var w = document.body.clientWidth;
                            if (w > 991) {
                                $('#findstore_popup_outer #findStorePopZip').val(data.location.zip);
                                $('#prddtl-find-store #findStoreZip').val(data.location.zip);
                                $('.find_sop #zip').val(data.location.zip);
                                $('.find_store #zip').val(data.location.zip);
                                $("#findstore_popup_outer .findStorePopSubmit").click();
                            } else {
                                $('#findstore_popup_outer #fs_m_upzipbx_zip').val(data.location.zip);
                                $('#prddtl-find-store #fs_m_upzipbx_zip').val(data.location.zip);
                                $("#findstore_popup_outer .fs_m_upzipbx_submit").click();
                            }
                        });
                    }

                }, showMyErrorLocal);
            } else {
                alert("Your browser does not support geo location.");
            }

        });


        $('body').on('click', '.fdstore', function(el) {
            if (!$(this).hasClass('active')) {
                $('#findstore_popup_outer .fdstore').removeClass('active');
                $(this).addClass('active');
                var fdstore_id = $(this).attr("data-fdstore-id");
                //$('#findstore_popup_outer .mbrow').hide();
                //$("#findstore_popup_outer").find("[data-mbrow-id='" + fdstore_id + "']").show(); 
            }
        });




        // Find A Store Detail Page Popup Start

        // Find A Store Detail Page Mobile Popup Start
        $('body').on('click', '#findstore_popup_outer .fs_m_upzip_chng_lnk', function(el) {
            $('#findstore_popup_outer .fs_m_upzip').hide();
            $('#findstore_popup_outer .fs_m_upzipbx').show();
        });


        $('body').on('click', '#findstore_popup_outer #fs_m_upzip_nxt', function(el) {
            var w = document.body.clientWidth;
            var uloc_device = 'desk';
            if (w > 991) {
                uloc_device = 'desk';
            } else {
                uloc_device = 'mob';
            }

            var show_schedule_viewing_in_store_btn = 0;
            if ($('#show_schedule_viewing_in_store_btn').length) {
                show_schedule_viewing_in_store_btn = $('#show_schedule_viewing_in_store_btn').val();
            }
            var retId = $("#findstore_popup_outer #store-hoz-slider li.active").attr('data-ret');
            var addId = $("#findstore_popup_outer #store-hoz-slider li.active").attr('data-sto');

            if (retId == undefined || addId == undefined) {
                alert('Please choose a store.');
                return false;
            }
            $("#loader").show();
            $.ajax({
                type: "POST",
                url: '/ajax/_global/user_location',
                data: 'mode=find_store_popup_step_2&uloc_device=' + uloc_device + '&retId=' + retId + '&addId=' + addId + '&inner_contents=1&show_schedule_viewing_in_store_btn=' + show_schedule_viewing_in_store_btn + '&itemcode=' + $('#findStoreSubmit').attr('data-itemcode'),
                dataType: "json",
                success: function(data) {
                    if (data.status == "OK") {
                        $('#findstore_popup_outer .sttoploc_section').html(data.html);
                    }
                    AddProductPagePopMobileScroll();
                }
            }).done(function(data) {
                $("#loader").hide();
            });
        });

        // Find A Store Detail Page Mobile Popup End



        // Find A Store Detail Page Popup End

        // Book An Appointment Start
        $('body').on('click', '#book-appointment-btn, #findstore_popup_outer #book_appmntpop_submit,#findstore_popup_outer #bookappbackarw', function(el) {
            var clckd_elm_id = $(this).attr('id');
            var w = document.body.clientWidth;
            var uloc_device = 'desk';
            if (w > 991) {
                uloc_device = 'desk';
            } else {
                uloc_device = 'mob';
            }

            productPageMobileScrollSetting(uloc_device);

            var data_str = 'mode=book_appointment_popup&uloc_device=' + uloc_device;
            if (clckd_elm_id == 'book-appointment-btn') {
                data_str = 'mode=book_appointment_popup&uloc_device=' + uloc_device + '&itemcode=' + $('#findStoreSubmit').attr('data-itemcode');
            } else if (clckd_elm_id == 'book_appmntpop_submit') {
                var userloc_fs_zip = $('#findstore_popup_outer #book_appmntpop_zip').val();
                if (userloc_fs_zip.trim() == '') {
                    alert('Please enter a valid zip/postal code');
                    return;
                }
                data_str = 'mode=book_appointment_popup&zip=' + userloc_fs_zip + '&uloc_device=' + uloc_device + '&inner_contents=1&itemcode=' + $('#findStoreSubmit').attr('data-itemcode');
            } else if (clckd_elm_id == 'bookappbackarw') {
                data_str = 'mode=book_appointment_popup&uloc_device=' + uloc_device + '&track_impression=false&itemcode=' + $('#findStoreSubmit').attr('data-itemcode');
            }


            $("#loader").show();
            $.ajax({
                type: 'POST',
                url: '/ajax/_global/user_location',
                data: data_str,
                dataType: "json",
                success: function(data) {
                    if (data.status == "OK") {
                        if (clckd_elm_id == 'book-appointment-btn') {
                            $('.show_back_bg').remove();
                            $('.sidenavbg').remove();
                            $('#findstore_popup_outer').remove();
                            $('body').append(data.html);
                            trackGeoLocFindStoreBookAppointmentEvents('Store Locator Leads', 'book appointment click on product page', $('#findStoreZip').val());
                            trackKlaviyoBookAppointment('Initiate Book Appointment', 'Book An Appointment Clicks (PDP)', { 'Zip Code': $('#findStoreZip').val() });
                        } else if (clckd_elm_id == 'book_appmntpop_submit') {
                            $('#findstore_popup_outer .loc_l-inner .inner').html(data.html);
                        } else if (clckd_elm_id == 'bookappbackarw') {
                            //var html = $(data);
                            var htmlcontent_1 = $('.sttoploc_section', data.html).html();
                            $('#findstore_popup_outer .sttoploc_section').html(htmlcontent_1);
                            //$('.show_back_bg').remove();
                            //$('.sidenavbg').remove();
                            //$('#findstore_popup_outer').remove();
                            //$('body').append(data.html);
                        }

                        if (w <= 991) {
                            var e = $("#store-hoz-slider");
                            e.children().each(function(index) {
                                $(this).attr('data-position', index);
                            });
                            e.owlCarousel({
                                loop: false,
                                margin: 10,
                                responsiveClass: true,
                                nav: true,
                                dots: false,
                                mouseDrag: true,
                                items: 1,
                                navText: ['<i class="fa fa-angle-left"></i>', '<i class="fa fa-angle-right"></i>'],
                                responsive: {
                                    0: { items: 1, stagePadding: 50 },
                                    480: { items: 2, stagePadding: 50 },
                                    768: { items: 2, stagePadding: 50 },
                                    992: { items: 2, stagePadding: 50 }
                                }
                            }).on("changed.owl.carousel", function(s) {
                                var i = s.item.index;
                                $("#findstore_popup_outer #store-hoz-slider .owl-item li").removeClass('active');
                                $("#findstore_popup_outer #store-hoz-slider").find("[data-fdstore-id='" + i + "']").addClass('active');
                            });


                            $('#store-hoz-slider').off('click').on('click', '.owl-item>li', function(el) {
                                if (!$(this).hasClass('active')) {
                                    e.trigger("to.owl.carousel", [$(this).attr('data-position'), 500, !0]);
                                    e.find(".owl-item li").removeClass('active');
                                    e.find(".owl-item").eq($(this).attr('data-position')).children('li').addClass("active");
                                }
                            });

                            if (userloc_fs_zip != undefined) {
                                $('#prddtl-find-store #fs_m_upzipbx_zip').val(userloc_fs_zip);
                            }
                        } else {
                            $('#findstore_popup_outer #store-hoz-slider li').off('click').on('click', function(e) {
                                $("#findstore_popup_outer #store-hoz-slider li").removeClass('active');
                                $(this).addClass('active');
                            });
                            if (userloc_fs_zip != undefined) {
                                $('#prddtl-find-store #findStoreZip').val(userloc_fs_zip);
                                $('.find_sop #zip').val(userloc_fs_zip);
                                $('.find_store #zip').val(userloc_fs_zip);
                            }

                        }

                        if (clckd_elm_id == 'book-appointment-btn') {
                            setTimeout(function() {
                                $("#findstore_popup_outer").addClass("sideNavMob");
                                $(".sidenavbg").show();
                            }, 50);
                        }
                        if (clckd_elm_id == 'bookappbackarw') {
                            setTimeout(function() {
                                $("#findstore_popup_outer").addClass("sideNavMob");
                                $(".sidenavbg").show();
                            }, 50);
                        }

                        AddProductPagePopMobileScroll();
                    }
                }
            }).done(function(data) {
                $("#loader").hide();
            });
        });

        $('body').on('click', '#findstore_popup_outer .bookAppmntPopMyLoc', function(el) {
            if (navigator.geolocation) {
                var self = this;
                navigator.geolocation.getCurrentPosition(function(position) {

                    var zip = showMyPositionLocalNew(position, self, function(data) {
                        $('#findstore_popup_outer #book_appmntpop_zip').val(data.location.zip);
                        $('#prddtl-find-store #findStoreZip').val(data.location.zip);
                        $('.find_sop #zip').val(data.location.zip);
                        $('.find_store #zip').val(data.location.zip);
                        $("#findstore_popup_outer .book_appmntpop__submit").click();

                    });



                }, showMyErrorLocal);
            } else {
                alert("Your browser does not support geo location.");
            }

        });


        // Book Appointment Step 2
        $('body').on('click', '#findstore_popup_outer #book_appmnt_nxt_btn, #findstore_popup_outer .findStorePopBookApp', function(el) {
            var that = $(this);
            var w = document.body.clientWidth;
            var uloc_device = 'desk';
            if (w > 991) {
                uloc_device = 'desk';
            } else {
                uloc_device = 'mob';
            }

            productPageMobileScrollSetting(uloc_device);

            var retId = '';
            var addId = '';
            var sourcemd = '';
            if ($(this).hasClass('book_appmnt_nxt_btn')) {
                retId = $("#findstore_popup_outer #store-hoz-slider li.active").attr('data-ret');
                addId = $("#findstore_popup_outer #store-hoz-slider li.active").attr('data-sto');
                sourcemd = 'appointment';
            } else {
                retId = $(this).attr('data-ret');
                addId = $(this).attr('data-sto');
                sourcemd = 'findstore';
            }

            $("#loader").show();
            $.ajax({
                type: 'POST',
                url: '/ajax/_global/user_location',
                data: 'mode=book_appointment_popup_step_2&uloc_device=' + uloc_device + '&retId=' + retId + '&addId=' + addId + '&itemCode=' + $('#findStoreSubmit').attr('data-itemcode') + '&sourcemd=' + sourcemd,
                dataType: "json",
                success: function(data) {

                    if (data.status == "OK") {
                        $('#findstore_popup_outer .sttoploc_section').html(data.html);
                        AddProductPagePopMobileScroll();
                        if (that.hasClass('findStorePopBookApp')) {
                            if ($('#book_appmntpop_zip').length > 0) {
                                var userloc_fs_zip = $('#book_appmntpop_zip').val();
                            }
                            if ($('#productRequestForm #zipcode').length > 0) {
                                var userloc_fs_zip = $('#productRequestForm #zipcode').val();
                            }
                            trackGeoLocFindStoreBookAppointmentEvents('Store Locator Leads', 'book appointment click on product page', userloc_fs_zip);
                            trackKlaviyoBookAppointment('Initiate Book Appointment', 'Book An Appointment Clicks (PDP)', { 'Zip Code': userloc_fs_zip });
                        }
                    }
                }
            }).done(function(data) {
                $("#loader").hide();
            });
        });

        $('body').on('click', '#findstore_popup_outer .radiosec .custom-checkbox', function(el) {
            $('#findstore_popup_outer .radiosec .custom-checkbox').removeClass('active');
            $(this).addClass('active');
        });





        $('body').on('click', '#findstore_popup_outer .book_appmnt_submit_btn', function(el) {
            $("#productRequestForm").unbind('validate').validate({
                rules: {
                    name: {
                        required: true
                    },
                    zipcode: {
                        required: true
                    },
                    phone: {
                        required: {
                            depends: function(element) {
                                return ($("input[name='contactMethod']:checked").val() == 'Text' || $("input[name='contactMethod']:checked").val() == 'Call');
                            }
                        },
                    },
                    email: {
                        required: {
                            depends: function(element) {
                                return ($("input[name='contactMethod']:checked").val() == 'Email');
                            }
                        },
                    },

                }
            });

            $('input[name="contactMethod"]').on('change', function() {
                $('#productRequestForm #phone').valid();
                $('#productRequestForm #email').valid();
            });

            var w = document.body.clientWidth;
            var uloc_device = 'desk';
            if (w > 991) {
                uloc_device = 'desk';
            } else {
                uloc_device = 'mob';
            }

            //$('#productRequestForm').submit(function (e) {
            //e.preventDefault();
            //e.stopPropagation()

            if (!$("#productRequestForm").valid()) return false;

            // Prevent Xss attempts start
            //$('#requestForm #name').val(jsEscape($('#requestForm #name').val()));

            var nameStr = $('#productRequestForm #name').val();
            if (nameStr.match(/[<|,|>|\?|\/|:|;|"|'|{|\[|}|\]|\||\\|~|`|!|@|#|\$|%|\^|&|\*|\(|\)|_|\-|\+|=]+/) != null) {
                alert('Your name contains invalid characters');
                $('#productRequestForm #name').focus();
                return false;
            }

            var ConcTitleStr = $('#productRequestForm #ConcTitle').val();
            if (ConcTitleStr.match(/[<|,|>|\?|\/|:|;|"|'|{|\[|}|\]|\||\\|~|`|!|@|#|\$|%|\^|&|\*|\(|\)|_|\-|\+|=]+/) != null) {
                alert('Invalid Form Title');
                return false;
            }

            var retIdStr = $('#productRequestForm #retId').val();
            if (retIdStr != '') {
                if (!retIdStr.match(/^\d+$/)) {
                    alert('Invalid Retailer Id');
                    return false;
                }
            }

            var storeIdStr = $('#productRequestForm #storeId').val();
            if (storeIdStr != '') {
                if (!storeIdStr.match(/^\d+$/)) {
                    alert('Invalid Store Id');
                    return false;
                }
            }

            var zipcodeStr = $('#productRequestForm #zipcode').val();
            if (zipcodeStr != '') {
                if (zipcodeStr.match(/[<|,|>|\?|\/|:|;|"|'|{|\[|}|\]|\||\\|~|`|!|@|#|\$|%|\^|&|\*|\(|\)|_|\+|=]+/) != null) {
                    alert('Invalid Zip Code');
                    $('#productRequestForm #zipcode').focus();
                    return false;
                }
            }

            var phoneStr = $('#productRequestForm #phone').val();
            if (phoneStr != '') {
                if (phoneStr.match(/[<|,|>|\?|\/|:|;|"|'|{|\[|}|\]|\||\\|~|`|!|@|#|\$|%|\^|&|\*|_|\+|=]+/) != null) {
                    alert('Invalid Phone Number');
                    $('#productRequestForm #phone').focus();
                    return false;
                }
            }

            var emailreg = /^([A-Za-z0-9_\-\.])+\@([A-Za-z0-9_\-\.])+\.([A-Za-z]{2,4})$/;
            if (emailreg.test($('#productRequestForm #email').val()) == false) {
                alert('Invalid Email Address');
                $('#productRequestForm #email').focus();
                return false;
            }

            // Prevent Xss attempts end

            if (typeof pintrk == 'function') {
                pintrk('track', 'lead', {});
            }

            $("#loader").show();
            $.post('/ajax/_global/privaterequestsave', $('#productRequestForm').serialize(), function(data) {

                trackGeoLocFindStoreBookAppointmentEvents('Store Locator Leads', 'submitted appointment leads', $('#productRequestForm #zipcode').val());
                trackAppointmentLeadsEvents('Appointment Leads', 'Find Nearest Store Appointment Submission (PDP)', $('#productRequestForm #zipcode').val());
                trackFacebookSubmissionEvents('Appointment Leads', 'Find Nearest Store Appointment Submission (PDP)', $('#productRequestForm #zipcode').val());

                var klaviyo_book_appointment_lead_data = {
                    'Name': $('#productRequestForm #name').val(),
                    'Email': $('#productRequestForm #email').val(),
                    'Phone': $('#productRequestForm #phone').val(),
                    'Zip Code': $('#productRequestForm #zipcode').val(),
                    'Retailer Code': $("#productRequestForm #retCode").val(),
                    'Item SKU': $('#productRequestForm #itemCode').val(),
                    'Contact Method': $('#productRequestForm input[name="contactMethod"]:checked').val(),
                    'Note': $("#productRequestForm #note").val(),
                };
                trackKlaviyoBookAppointment('Book Appointment lead', 'Book An Appointment Submission (PDP)', klaviyo_book_appointment_lead_data);

                //Start GTM
                dataLayer.push({
                    'event': 'productscheduleviewing',
                    'virtualpage': window.location.pathname + '/view-in-store-submission',
                    'virtualtitle': 'product schedule viewing'
                });

                var curlocation = window.location;
                var live = curlocation.toString();

                if (live.indexOf("dev") <= 0) {
                    (function(w, d, s, l, i) {
                        w[l] = w[l] || [];
                        w[l].push({
                            'gtm.start': new Date().getTime(),
                            event: 'gtm.js'
                        });
                        var f = d.getElementsByTagName(s)[0],
                            j = d.createElement(s),
                            dl = l != 'dataLayer' ? '&l=' + l : '';
                        j.async = true;
                        j.src = 'https://www.googletagmanager.com/gtm.js?id=' + i + dl;
                        f.parentNode.insertBefore(j, f);
                    })(window, document, 'script', 'dataLayer', 'GTM-WGPZ3WF');


                    //AJAX GOOGLE TRACKING//
                    (function(i, s, o, g, r, a, m) {
                        i['GoogleAnalyticsObject'] = r;
                        i[r] = i[r] || function() {
                            (i[r].q = i[r].q || []).push(arguments)
                        }, i[r].l = 1 * new Date();
                        a = s.createElement(o),
                            m = s.getElementsByTagName(o)[0];
                        a.async = 1;
                        a.src = g;
                        m.parentNode.insertBefore(a, m)
                    })(window, document, 'script', '//www.google-analytics.com/analytics.js', 'ga');
                    ga('send', { hitType: 'pageview', page: '/thankyou/', title: 'Free Preview Thank You' });

                }
                //End GTM

                window.location.href = 'https://www.gabrielny.com/schedule-private-viewing/thankyou?itemcode=' + $('#productRequestForm #itemCode').val();
                return;

                /*
                $.ajax({
                    type: "POST",
                    url: '/ajax/_global/user_location',
                    data: 'mode=book_appointment_submit&uloc_device='+uloc_device+'&inner_contents=1',
                    dataType: "json",
                    success: function(data)
                    {
                        if (data.status == "OK") {
                            
                            var w = document.body.clientWidth;
                            if (w > 991) {
                                $('#findstore_popup_outer .findstore_popup_inner').html(data.html);
                            } else {
                                $("#findstore_popup_outer .closeWindow").trigger("click");
                                $('#top_location_popup').remove();
                                $('body').append(data.html);
                                if($('#top_location_popup').length) {
                                    $('#top_location_popup').appendTo("body").modal('show');
                                }
                            }
                        }
                    }
                }).done(function(data) {
                    $("#loader").hide();
                });
                */

            });



            //$(".schedule_view").hide();

            //});


        });

        var $docEl = $('body'),
            $wrap = $('body > .wrapper'),
            scrollTop;

        if ((/iPad|iPhone|iPod/.test(navigator.userAgent) && !window.MSStream)) {
            var $docEl = $('html, body');
        }

        lockBody = function() {
            if (window.pageYOffset) {
                scrollTop = window.pageYOffset;

                if (document.body.clientWidth < 768) {
                    $wrap.css({
                        top: -(scrollTop),
                        position: "relative"
                    });
                }
            }

            $docEl.css({
                height: "100%",
                overflow: "hidden"
            });
        }

        unlockBody = function() {
            $docEl.css({
                height: "",
                overflow: ""
            });

            if (document.body.clientWidth < 768) {
                $wrap.css({
                    top: '',
                    position: ''
                });
            }

            if (scrollTop != undefined && scrollTop > 0) {
                window.scrollTo(0, scrollTop);
                window.setTimeout(function() {
                    scrollTop = null;
                }, 0);
            }
        }

        function preventPageScroll(e) {

            if ((/iPad|iPhone|iPod/.test(navigator.userAgent) && !window.MSStream) || /^((?!chrome|android).)*safari/i.test(navigator.userAgent)) {
                //console.log('preventPageScroll- '+!$(e.target).closest('.sideNavMob').length);
                //console.log($(e.target).closest('.sideNavMob').length);
                if (!$(e.target).closest('.sideNavMob').length) {
                    e = e || window.event;
                    if (e.preventDefault)
                        e.preventDefault();
                    e.returnValue = false;
                }
                //console.log(e.target);

            }
        }


        function productPageMobileScrollSetting(device) {

            //if(device=="mob"){            
            //$("body").css("overflow-y", "hidden");
            if (!$("body").hasClass("noscroll-vertical")) {
                $("body").addClass("noscroll-vertical");
            }
            //console.log((/iPad|iPhone|iPod/.test(navigator.userAgent) && !window.MSStream) || /^((?!chrome|android).)*safari/i.test(navigator.userAgent));
            if ((/iPad|iPhone|iPod/.test(navigator.userAgent) && !window.MSStream) || /^((?!chrome|android).)*safari/i.test(navigator.userAgent)) {
                document.body.addEventListener("wheel", preventPageScroll, { passive: false });
                document.body.addEventListener("touchmove", preventPageScroll, { passive: false });
                lockBody();
            }

            //}
            $(document.body).off('click', '.closeWindow,.closebtn').on('click', '.closeWindow,.closebtn', function(e) {
                //$("body").removeClass("prodmobscrhide");   
                //$("body").removeAttr("style")
                if ($("body").hasClass("noscroll-vertical")) {
                    $("body").removeClass("noscroll-vertical")
                }
                if ((/iPad|iPhone|iPod/.test(navigator.userAgent) && !window.MSStream) || /^((?!chrome|android).)*safari/i.test(navigator.userAgent)) {
                    document.body.removeEventListener("wheel", preventPageScroll, { passive: false });
                    document.body.removeEventListener("touchmove", preventPageScroll, { passive: false });
                    unlockBody();
                }

            });
        }

        function AddProductPagePopMobileScroll() {
            var w = document.body.clientWidth;
            var uloc_device = 'desk';
            if (w > 991) {
                device = 'desk';
            } else {
                device = 'mob';
            }
            if (device == "mob") {
                var margval = 150;
                if ($('.mobscrollenable').closest('.find-store-second-step').hasClass('find-store-second-step')) {
                    margval = 0;
                }
                if ($('.mobscrollenable').closest('.find-store-first-step').hasClass('find-store-first-step')) {
                    margval = 100;
                }
                setTimeout(function() {
                    if ($('.mobscrollenable').height() + margval >= $(window.top).height()) {
                        if (!$('.mobscrollenable').hasClass('mobscrollenabled')) {
                            $('.mobscrollenable').addClass('mobscrollenabled');
                            $('.mobscrollenable').overlayScrollbars({
                                className: "os-theme-round-dark",
                                resize: "both",
                                sizeAutoCapable: true,
                                paddingAbsolute: false
                            });
                            if ($('.mobscrollenable').closest('.book-appointment-second-step').hasClass('book-appointment-second-step')) {
                                $('.mobscrollenable').addClass('mobscrollenabled3');
                            }
                        }
                    }
                }, 500);
            }

            if (device == "desk") {

                if ($('.deskscrollenable').closest('.find-store-first-step').hasClass('find-store-first-step') || $('.deskscrollenable').closest('.book-appointment-second-step').hasClass('book-appointment-second-step') || $('.deskscrollenable').closest('.book-appointment-first-step').hasClass('book-appointment-first-step')) {
                    var margval = 150;
                    if ($('.deskscrollenable').closest('.find-store-first-step').hasClass('find-store-first-step')) {
                        margval = 150;
                    }
                    if ($('.deskscrollenable').closest('.book-appointment-second-step').hasClass('book-appointment-second-step')) {
                        margval = 350;
                    }
                    if ($('.deskscrollenable').closest('.book-appointment-first-step').hasClass('book-appointment-first-step')) {
                        margval = 50;
                    }

                    setTimeout(function() {
                        if ($('.deskscrollenable').height() + margval > $(window.top).height()) {
                            if (!$('.deskscrollenable').hasClass('deskscrollenabled')) {
                                $('.deskscrollenable').addClass('deskscrollenabled');
                                $('.deskscrollenable').overlayScrollbars({
                                    className: "os-theme-round-dark",
                                    resize: "both",
                                    sizeAutoCapable: true,
                                    paddingAbsolute: false
                                });
                            }
                        }
                    }, 500);


                }
            }
        }

        $(window).bind("orientationchange", function() {
            AddProductPagePopMobileScroll();
        });

        // Book An Appointment End

        //~ $('body').on('click', '#store-hoz-slider .owl-item', function (el){
        //~ e.trigger("to.owl.carousel", [ $(this).index(), 500, !0 ]);
        //~ e.find(".owl-item li").removeClass('active');
        //~ e.find(".owl-item").eq($(this).index()).children('li').addClass("active");
        //~ });


        // Store analytics event impression start
        $(document.body).on('click', '.analyticsEventLogButton', function(e) {
            if ($(this).data('action') == 'phone') {
                if ($('#findStorePopZip').length > 0) {
                    var userloc_fs_zip = $('#findStorePopZip').val();
                } else if ($('#findStoreZip').length > 0) {
                    var userloc_fs_zip = $('#findStoreZip').val();
                }
                trackOtherStoreRequestsEvents('Other Store Requests', 'Calls (product page)', userloc_fs_zip);
            }
            if ($(this).data('action') == 'direction') {
                if ($('#findStorePopZip').length > 0) {
                    var userloc_fs_zip = $('#findStorePopZip').val();
                } else if ($('#findStoreZip').length > 0) {
                    var userloc_fs_zip = $('#findStoreZip').val();
                }
                trackOtherStoreRequestsEvents('Other Store Requests', 'Directions (product page)', userloc_fs_zip);
            }
            var sRetaillerCode = $(this).data('retcode');
            var sRetailler = $(this).data('ret');
            var sStore = $(this).data('sto');
            var sAction = $(this).data('action');
            $.post('/ajax/_global/storelog_analytics_event', { logRetailerCode: sRetaillerCode, logRetailer: sRetailler, logStore: sStore, logAction: sAction });
        });
        // Store analytics event impression end

        // Find A Store Detail Page End
    });
}
// View In Store End

// Mini Shopping Cart Start

if (!(typeof showErrorDialog === "function")) {
    function showErrorDialog(msg) {
        if ($('#errmsg-modal').length) {
            $('#errmsg-modal .modal-body').html(msg);
            $('#errmsg-modal').modal().show();
        } else {

            var errmsgdialoghtml = '<div id="errmsg-modal" class="modal fade" tabindex="-1" role="dialog" aria-labelledby="lg_popup" aria-hidden="true">';
            errmsgdialoghtml += '<div class="modal_vah">';
            errmsgdialoghtml += '<div class="modal-dialog quickview-w">';
            errmsgdialoghtml += '<div class="modal-content">';
            errmsgdialoghtml += '<div class="modal-header tac">';
            errmsgdialoghtml += '<button class="close" type="button" data-dismiss="modal" aria-hidden="true"></button>';
            errmsgdialoghtml += '<h4 class="modal-title">Gabriel Secure Checkout</h4>';
            errmsgdialoghtml += '</div>';
            errmsgdialoghtml += '<div class="modal-body tac"></div>';
            errmsgdialoghtml += '</div>';
            errmsgdialoghtml += '</div>';
            errmsgdialoghtml += '</div>';
            errmsgdialoghtml += '</div>';
            $('body').append(errmsgdialoghtml);
            $('#errmsg-modal .modal-body').html(msg);
            $('#errmsg-modal').modal().show();
        }
        $('#errmsg-modal .close').off('click').on('click', function(e) {
            e.preventDefault();
            e.stopPropagation();
            $('#errmsg-modal').modal('hide');
        });
        $('#errmsg-modal').off('click').on('click', function(e) {
            e.preventDefault();
            e.stopPropagation();
            if (!$(e.target).closest('.modal-content').length) {

                $('#errmsg-modal').modal('hide');
            }
        });
    }
}
if (!(typeof showSuccessDialog === "function")) {
    function showSuccessDialog(msg) {
        if ($('#errmsg-modal').length) {
            $('#errmsg-modal .modal-body').html(msg + " <i class='fa fa-check success' aria-hidden='true'></i>");
            $('#errmsg-modal').modal().show();
        } else {

            var errmsgdialoghtml = '<div id="errmsg-modal" class="modal fade" tabindex="-1" role="dialog" aria-labelledby="lg_popup" aria-hidden="true">';
            errmsgdialoghtml += '<div class="modal_vah">';
            errmsgdialoghtml += '<div class="modal-dialog quickview-w">';
            errmsgdialoghtml += '<div class="modal-content">';
            errmsgdialoghtml += '<div class="modal-header tac">';
            errmsgdialoghtml += '<button class="close" type="button" data-dismiss="modal" aria-hidden="true"></button>';
            errmsgdialoghtml += '<h4 class="modal-title">Gabriel Secure Checkout</h4>';
            errmsgdialoghtml += '</div>';
            errmsgdialoghtml += '<div class="modal-body tac"></div>';
            errmsgdialoghtml += '</div>';
            errmsgdialoghtml += '</div>';
            errmsgdialoghtml += '</div>';
            errmsgdialoghtml += '</div>';
            $('body').append(errmsgdialoghtml);
            $('#errmsg-modal .modal-body').html(msg + " <i class='fa fa-check success' aria-hidden='true'></i>");
            $('#errmsg-modal').modal().show();
        }
        $('#errmsg-modal .close').off('click').on('click', function(e) {
            e.preventDefault();
            e.stopPropagation();
            $('#errmsg-modal').modal('hide');
        });

    }
}

function loadAjaxMiniCart(callback = function() {}) {
    $.ajax({
        type: "POST",
        url: '/ajax/www/getminiusercart',
        data: '',
        success: function(data) {
            data = JSON.parse(data);
            if (data.status == "OK") {
                $('.mini-cart-container').html(data.html);
                if ($('#userb2cbasketcls').find('.top_bag_count').length) {
                    $('#userb2cbasketcls').find('.top_bag_count').text(data.item_count);
                } else {
                    if (data.item_count > 0) {
                        $('#userb2cbasketcls').find('.top_icon_text').after('<span class="top_bag_count">' + data.item_count + '</span>');
                    }
                }
                if (!$('#userb2cbasketcls').hasClass('act')) {
                    $('.mini-cart-container .smrsticky').hide();
                } else {
                    if (document.body.clientWidth > 991) {
                        var h = $('.mini-cart-container .smrsticky').height() + $('.mini-cart-container .main_hd').height() + 60;
                        $('.mini-cart-container .probox').css({ 'max-height': 'calc(99vh - ' + h + 'px)' });
                    }
                }
                callback();
            }
        }
    }).done(function(data) {

    });
}
$(document).ready(function() {
    if ('1' == '1') {
        if ($('.mini-cart-container').length) {
            //loadAjaxMiniCart();
        }
    }
});

/*==============================Start Update Mini Cart================================*/
//setup before functions
var typingTimer; //timer identifier
var doneTypingInterval = 1000; //time in ms, 5 second for example
var isCanadian = '{isCanadian}';

$(function() {

    $('.mini-cart-container').on('click', '.closeWindow', function(e) {
        e.preventDefault();
        e.stopPropagation();
        $('.mini-cart-container').slideToggle();
        console.log($('.mini-cart-container .dotoggle-inner'));
        $('body').removeClass('noscroll-vertical');
        $('#userb2cbasketcls').removeClass('act')
        if ($('.nav-backdrop').length) {
            $('.mini-cart-container .smrsticky').hide();
            setTimeout(function() { $('.nav-backdrop').remove();
                $('.stickyheader').removeClass('stickyfixedheader'); }, 400);
        }
    });

    //on keyup, start the countdown
    $(document).on('focusout', '.mini-cart-container input[id^=qty_]', function(e) {
        clearTimeout(typingTimer);

        var itemCode = $(this).attr('data-code');
        var id = $(this).attr('id');
        var customflag = $(this).attr('data-custom');

        if ($(this).val() != $(this).val().replace(/[^0-9]/g, '')) {
            $(this).val($(this).val().replace(/[^0-9]/g, ''));
        }

        var val = $(this).val();

        if (val == "" || val == 0) {
            $('#progressmodal').modal('show');
            $('#progressmodal .modal-body').html("Item Quantity should be greater than zero");
            $(this).val(1);
            val = $(this).val();
            doneTypingInterval = 3000;
        }

        if (id != "") {
            typingTimer = setTimeout(function() {
                updateQtyMiniCart(itemCode, val, id, customflag);

            }, doneTypingInterval);
        }
        doneTypingInterval = 1000;

    });
});


function updateQtyMiniCart(itemCode, val, id, customflag) {
    var loadimg = $('#loading-image').attr('src');
    var nyState = $(".mini-cart-container #orderbillState").val();
    var country = $(".mini-cart-container #orderbillCountry").val();
    $('#progressmodal .modal-body').html('Updating quantity, please wait...<br><img data-src="' + loadimg + '" alt="loading..." class="loadimgcls" />');
    $('#progressmodal').modal({
        backdrop: 'static',
        keyboard: false
    }).show();

    $.ajax({
        type: 'POST',
        dataType: 'json',
        url: '/ajax/www/usercartupdate',
        //data: 'itemCode=' + itemCode + '&mode=update&qty=' + val
        data: 'itemCode=' + itemCode + '&mode=update&qty=' + val + '&customizeflag=' + customflag + '&minicart=' + 1
    }).done(function(data) {
        if (data.success) {
            $(".mini-cart-container .probox").html(data.content["orderItem"]);
            //$("#cart-total").html(data.content["orderSummery"]);
            //$("#orderReview").html(data.content["orderreview"]);
            var mini_cart_item_count = data.itemcount;
            $('.mini-cart-container #mini_cart_item_count').html('(' + mini_cart_item_count.replace(/\D/g, '') + ')');
            $('.mini-cart-container #mini_cart_sub_total').html(data.sub_total);
            $('.mini-cart-container #mini_cart_tax').html(data.tax);
            $('.mini-cart-container #mini_cart_shipping').html(data.shipping);
            $('.mini-cart-container #mini_cart_coupon_discount').html(data.coupon_discount);
            $('.mini-cart-container #mini_cart_total').html(data.total);
            $('.mini-cart-container #mini_cart_top_total').html(data.total);
            $('.mini-cart-container .totalPriceVal').html(data.totalPriceVal);
            if ((nyState != "NY" || country != "US") && country != "CA") {
                saletaxCalMiniCart();
            } else
            ////showPriceRangeContent();
            if (width < 767) {
                $('.secured').css({ 'padding-top': '0px' });
            }
            $('#progressmodal').modal('hide');

            if (data.content["gtmUpdate"] != "") {
                var gtmloadimg = $('#loading-image').attr('src');
                $('#gtm-load').html('');
                $('#gtm-load').html('<img data-src="' + gtmloadimg + '" alt="loading..." class="loadimgcls" /><br>Please wait...');
                $("#gtm-content-load").html('');
                $("#gtm-content-load").html(data.content["gtmUpdate"] + data.content["klaviyoUpdate"] + data.content["gtmTrigger"]);
                $('#shop-gtm-product').modal({
                    backdrop: 'static',
                    keyboard: false
                }).show();
                setTimeout(function() { $('#shop-gtm-product').modal('hide'); }, 1000);
            }

            //Check coupon
            if ($("#coupon_number_mini_cart").val() != "") {
                //$('.modal-backdrop').remove();                    
                setTimeout(function() { $(".applycoupon").trigger("click"); }, 1100);
            }
            if (window.location.href.indexOf("/cart") > -1) {
                $.redirect('/cart');
            }
            loadAjaxMiniCart();
        } else {

            $('#progressmodal .modal-title').html('<button class="close" type="button" data-dismiss="modal" aria-hidden="true"></button><h4 class="modal-title">Gabriel NY</h4>');
            $('#progressmodal .modal-body').html("<div class='error'>Requested product quantity not in stock.</div>");
            $("#" + id).val(data.content["productQty"]);

            $('#close-msg').on('click', function(el) {
                el.preventDefault();
                el.stopPropagation();
                $('#progressmodal').modal('hide');
            });
        }
        ////initFreeItem();
        ////updateQtyHeader();
    });
}

function saletaxCalMiniCart() {
    var reviewSubtotal = $('.mini-cart-container .reviewSubtotalMiniCart').val();
    var nyState = $(".mini-cart-container #orderbillStateMiniCart").val();
    var country = $(".mini-cart-container #orderbillCountryMiniCart").val();
    if (nyState != "NY" || nyState != "NEW YORK" || country != "US" || country != "United States") {
        $(".mini-cart-container #mini_cart_tax").text('$ 0.00');
        if (isCanadian == 'no') {
            $(".mini-cart-container #mini_cart_total").text('$ ' + reviewSubtotal);
            $(".mini-cart-container #mini_cart_top_total").text('$ ' + reviewSubtotal);
            $(".mini-cart-container .totalPriceVal").val(reviewSubtotal);
            //showPriceRangeContentMiniCart();
        }
    }
}

/*==============================End Update Mini Cart================================*/

/*==============================Start for Remove Item From Mini Cart================================*/
$(function() {
    $(".mini-cart-container").on('click', "a[id^=removeItem_]", function(e) {
        e.preventDefault();
        e.stopPropagation();
        var code = $(this).data('code');
        var id = parseInt($(this).data('id'));
        var iid = parseInt($(this).data('iid'));
        var customflag = $(this).data('custom');

        if (iid > 0 && id > 0 && code != "") {
            $('#removeDialog').remove();
            var removedialoghtml = '<div id="removeDialog" class="modal fade" tabindex="-1" role="dialog" aria-labelledby="lg_popup" aria-hidden="true">';
            removedialoghtml += '<div class="modal_vah">';
            removedialoghtml += '<div class="modal-dialog quickview-w">';
            removedialoghtml += '<div class="modal-content">';
            removedialoghtml += '<div class="modal-header tac">';
            removedialoghtml += '<h4 class="modal-title">Gabriel Remove Item</h4>';
            removedialoghtml += '</div>';
            removedialoghtml += '<div class="modal-body">';
            removedialoghtml += '<div class="row">';
            removedialoghtml += '<div class="tac">';
            removedialoghtml += '<p class="f16 mt20" id="rmLoading">Are you sure you wish to remove this item from your shopping cart?</p>';
            removedialoghtml += '<div class="clearfix"></div>';
            removedialoghtml += '<p class="mt20" id="rmButton">';
            removedialoghtml += '<button class="btn btn1 btn-small" type="button" id="confirmDel">Yes <span class=""></span></button>';
            removedialoghtml += '&nbsp;';
            removedialoghtml += '<button class="btn btn1 btn-small" type="button" id="closeprogress">No <span class=""></span></button>';
            removedialoghtml += '</p>';
            removedialoghtml += '</div>';
            removedialoghtml += '</div>';
            removedialoghtml += '</div>';
            removedialoghtml += '</div>';
            removedialoghtml += '</div>';
            removedialoghtml += '</div>';
            removedialoghtml += '</div>';
            $('body').append(removedialoghtml);
            $('#removeDialog').modal('show');

            $('#confirmDel').on('click', function(el) {
                el.preventDefault();
                el.stopPropagation();

                var loadimg = $('#loading-image').attr('src');
                $('#rmLoading').html('<img data-src="' + loadimg + '" alt="loading..." class="loadimgcls" /><br>Your item is being removed from the cart, please wait...');
                $('#rmButton').html('');

                /* var reportForm = $('<form />').attr('method', 'POST').attr('action', domain + '/cart');
                $('<input />').attr('type', 'hidden').attr('name', 'cartRemoveItems').val(code).appendTo(reportForm);
                $('<input />').attr('type', 'hidden').attr('name', 'id').val(id).appendTo(reportForm);
                $('<input />').attr('type', 'hidden').attr('name', 'iid').val(iid).appendTo(reportForm);
                $('<input />').attr('type', 'hidden').attr('name', 'cartMode').val('remove').appendTo(reportForm);
                $('<input />').attr('type', 'hidden').attr('name', 'customflag').val(customflag).appendTo(reportForm);
                reportForm.appendTo('body').submit(); */
                //console.log('itemCode=' + code + '&cartItemId=' + id + '&cartId=' + iid +'&customizeflag=' + customflag);


                $.ajax({
                    type: 'POST',
                    dataType: 'json',
                    url: '/shoppingcart/removeOrderItem',
                    data: 'itemCode=' + code + '&cartItemId=' + id + '&cartId=' + iid + '&customizeflag=' + customflag
                }).done(function(data) {
                    if (data.status == 'success') {
                        $("#removeDialog").find("#rmLoading").html("Item Removed Successfully");
                        setTimeout(function() {
                            $('#removeDialog').modal('hide');
                            if (window.location.href.indexOf("/cart") > -1) {
                                $('#loader').show();
                                $.redirect('/cart');
                            } else {
                                loadAjaxMiniCart();
                            }
                        }, 1000);

                    }
                });
            });

            $('#closeprogress').on('click', function(el) {
                el.preventDefault();
                el.stopPropagation();
                $('#removeDialog').modal('hide');
            });

        }
    });
});

/*==============================End for Remove Item From Mini Cart================================*/


$(document).ready(function() {
    $(".mini-cart-container").on('click', ".miniCartCheckoutBtn", function(e) {
        //$.redirect('/cart'+$(this).data('pathutm'));
        window.location.href = '/cart' + $(this).data('pathutm');
    });

    $(".mini-cart-container").on('click', ".applycoupon", function(e) {
        $('.modal-backdrop').remove();
        if ($(".mini-cart-container #coupon_number_mini_cart").val().replace(/^\s+|\s+$/g, "") == "") {
            showErrorDialog("Please enter promo code");
            /* $('html, body').animate({
                 scrollTop: $('.error:visible:first').offset().top
             }, 1000);*/
            return false;
        }
        checkPromoMiniCart();
    });

});

//Promocode functionality for load retailer data
function checkPromoMiniCart() {
    // if ($("#orderHearAbout").val() != '') {
    ajaxInProgress = true;
    ////$("#store-widget-billing").hide();
    ////$("#store-widget-billing-loader").show();
    $.ajax({
        type: 'POST',
        dataType: 'json',
        url: '/ajax/www/usercartpromocode',
        data: 'mode=checkpromo&orderHearAbout=' + $("#coupon_number_mini_cart").val() + '&orderbillZip=' + $('#orderbillZip').val()
    }).done(function(data) {
        ajaxInProgress = false;
        if (data.status == "OK") {
            /*
            ajaxInProgress = false;
            if(data.status == "OK")
            {
                $('#promo-form-group').addClass("has-success");
                $("#loader").show();
                location.reload();
                
            }
            */
            ajaxInProgress = false;
            if (data.status == "OK") {
                ////$("#store-widget-billing").html(data.HTML);
            }
            checkCouponPromo(0);
            ////$("#store-widget-billing-loader").hide();
            ////$("#store-widget-billing").show();

            if (data.status == "OK") {
                return true;
            }
        } else {
            ////$("#store-widget-billing-loader").hide();
            ////$("#store-widget-billing").show();
            checkCouponPromoMiniCart(1);

            //Reset Retailer if not found
            ////var orderbillZip=$("#orderbillZip");
            ////orderbillZip.blur();
            loadAjaxMiniCart();
            return false;
        }
    });
    // }
}

//Promocode functionality for check coupon 
function checkCouponPromoMiniCart(codefound) {

    var checkcpnType;
    if (codefound == "" || typeof(codefound) == undefined) {
        checkcpnType = 0;
    } else {
        checkcpnType = codefound;
    }
    var couponCode = $(".mini-cart-container #coupon_number_mini_cart").val();
    var orderbillEmail = $("#orderbillEmail").val();
    var loadimg = $('#loading-image').attr('src');
    var nyState = $("#orderbillState option:selected").val();
    var country = $("#orderbillCountry option:selected").val();

    $('#progressmodal .modal-body').html('Applying promo code, please wait...<br><img data-src="' + loadimg + '" alt="loading..." class="loadimgcls" />');
    $('#progressmodal').modal({
        backdrop: 'static',
        keyboard: false
    }).show();

    $.ajax({
        type: "POST",
        url: '/ajax/www/checkcouponcode',
        data: "couponCode=" + couponCode + '&billEmail=' + orderbillEmail + '&checkcpnType=' + checkcpnType,
        dataType: "json"
    }).done(function(data) {

        if (data.success) {
            //$('#cart_item_count').html(data.itemcount);

            /*
            $("#cart-table").fadeOut(100, function(){
                $("#cart-table").html(data.content["orderItem"]).fadeIn().delay(200);
            });

            $("#orderReview").fadeOut(100, function(){
                $("#orderReview").html(data.content["orderreview"]).fadeIn().delay(200);
            });
            */

            // $("#cart-table").html(data.content["orderItem"]);                    
            // $("#orderReview").html(data.content["orderreview"]);
            $('.toplink #cart_item_count').html(data.content["itemcount"]);
            if ((nyState != "NY" || country != "US") && country != "CA") {
                saletaxCalMiniCart();
            } else {
                ////showPriceRangeContent();    
            }

            $('#progressmodal').modal('hide');

            if (data.error != '' && data.error != null) {
                $(".mini-cart-container #coupon_number_mini_cart").val('');
                showErrorDialog(data.error);
                $('html, body').animate({
                    scrollTop: $('.error:visible:first').offset().top
                }, 1000);
                return false;
            }

            if (width < 767) {
                $('.secured').css({ 'padding-top': '0px' });
            }


            if (data.content["gtmUpdate"] != "") {
                var gtmloadimg = $('#loading-image').attr('src');
                $('#gtm-load').html('');
                $('#gtm-load').html('<img data-src="' + gtmloadimg + '" alt="loading..." class="loadimgcls" /><br>Please wait...');
                $("#gtm-content-load").html('');
                $("#gtm-content-load").html(data.content["gtmUpdate"] + data.content["klaviyoUpdate"] + data.content["gtmTrigger"]);
                $('#shop-gtm-product').modal({
                    backdrop: 'static',
                    keyboard: false
                }).show();
                setTimeout(function() { $('#shop-gtm-product').modal('hide'); }, 1000);
            }

            if (window.location.href.indexOf("/cart") > -1) {
                $.redirect('/cart');
            }
        } else {
            $('#progressmodal').modal('hide');
        }
    });
}


// Mini Shopping Cart End</script>
<script data-file="icarus_new_theme.js">/**
 * icarus_new_theme.js
 */

function showViedoPlayer(_dialog, video) {
    jwplayer("videoElement")
        .setup({
            primary: "html5",
            file: video,
            width: 320,
            height: 320,
            autostart: true,
            repeat: true,
            controlbar: "none",
            dock: false,
            backcolor: 'transparent',
            wmode: 'transparent',
            skin: ESHOP_CONFIG.videoPlayerSkin
        });
}

function showDialog(sMessage) {
    $('#progressmodal .close').remove();
    $('#progressmodal .modal-header').append('<button type="button" class="close closemodal sendclose" data-dismiss="modal" aria-hidden="true"></button>');
    $('#progressmodal .modal-body').html(sMessage);
    $('#progressmodal').modal({ backdrop: 'static', keyboard: false }).show();
}

var ESHOP_CONFIG = {
    isEmbed: function() {
        try {
            return window.self !== window.top;
        } catch (e) {
            return true;
        }
    },
    videoPlayerSkin: "https://cdn-localassets.gabrielny.com/jwplayer/skins/five.xml"
};


$(function() {

    $(".btnGotoLogin").on('click', function(e) {
        e.preventDefault();
        e.stopPropagation();
        var address = $(this).attr('data-path');

        if (address != "") {
            document.location.href = address;
        } else {
            document.location.href = 'https://www.gabrielny.com';
        }
    });
});



//==============================Start Commmon Msg for Favorites Section===================
var str = '<div id="modal-category-character" class="modal fade" tabindex="-1" role="dialog" aria-labelledby="sm_popup" aria-hidden="true">';
str += '<div class="modal_vah">';
str += '<div class="modal-dialog modal-sm">';
str += '<div class="modal-content">';
str += '<div class="modal-header tac" style="border:1px solid #eaedf2;">';
str += '<button type="button" class="close" data-dismiss="modal" aria-hidden="true"></button>';
str += '<h3 class="modal-title">Category Characters</h3>';

str += '</div>';
str += '<div class="modal-body" style="background-color:#eaedf2;">';
str += '<div class="modal-favorite" id="favorite-form-content">';
str += '<div class="p10">50 characters limit.Excessive data will be truncated.</div>';
str += '</div>';
str += '</div>';
str += '</div>';
str += '</div>';
str += '</div>';
str += '</div>';

//==============================End Commmon Msg for Favorites Section===================

function processFavListAddForm() {

    $("#favTitle").keyup(function() {

        $('.modal-backdrop').remove();
        $('#modal-category-character').remove();

        if ($("#favTitle").val().length > 50) {
            $(str).modal();
            $("#favTitle").val($("#favTitle").val().substring(0, 50));
            $("#favTitle").focus();
        }
    });

    $("#favTitle").keydown(function() {

        $(".modal-backdrop").remove();
        $("#modal-category-character").remove();
        if ($("#favTitle").val().length > 50) {
            $(str).modal();
            $("#favTitle").val($("#favTitle").val().substring(0, 50));
            $("#favTitle").focus();
        }

    });

    $(document.body).off('click', '#btnSubmit').on('click', '#btnSubmit', function(e) {
        e.preventDefault();
        e.stopPropagation();

        var str = '<div id="modal-select-category" class="modal fade" tabindex="-1" role="dialog" aria-labelledby="sm_popup" aria-hidden="true">';
        str += '<div class="modal_vah">';
        str += '<div class="modal-dialog modal-sm">';
        str += '<div class="modal-content">';
        str += '<div class="modal-header tac" style="border:1px solid #eaedf2;">';
        str += '<button type="button" class="close" data-dismiss="modal" aria-hidden="true"></button>';
        str += '<h3 class="modal-title">Wish List Name</h3>';
        str += '</div>';
        str += '<div class="modal-body" style="background-color:#eaedf2;">';
        str += '<div class="modal-favorite" id="favorite-form-content">';
        str += '<div class="p10">Enter Wish List Name</div>';
        str += '</div>';
        str += '</div>';
        str += '</div>';
        str += '</div>';
        str += '</div>';
        str += '</div>';


        if ($("#favTitle").val() == "") {
            $('.modal-backdrop').remove();
            $('#modal-select-category').remove();
            $(str).modal();
            return false;
        }


        $.getJSON("/ajax/account/favorites", {
                "mode": "addCat",
                "favTitle": $("#favTitle").val(),
                "favStatus": $("#favStatus").val(),
                "favItem": $("#favItemCode").val()
            },
            function(data) {
                /*TKT-19637-R2M0*/
                if (data.status == "duplicate") {
                    var tmplistName = " A wishlist with this name already exist. Please change the name.";
                    $('#favorite-form-content').html(tmplistName);
                    return false;
                } else if (data.status == "ok") {
                    var tmplistName = " Added to your wishlist";
                    if (data.listname != "") {
                        //tmplistName=" Added to your "+data.listname;
                        tmplistName = " Added to your wishlist";
                    }
                    $('#favorite-form-content').html(tmplistName);
                    //$('#favorite-form-content').html("Removed from your wishlist"+tmplistName);
                    setTimeout(function() { location.reload(); }, 2000);
                } else {
                    $('#favorite-form-content').html("An unknown error has occurred");

                    var close = setInterval(function() {
                        $('.modal-backdrop').remove();
                        $('#modal-add-to-favorite').modal('hide');
                        $('#modal-add-to-favorite').data('modal', null);

                        clearInterval(close);
                    }, 2000);

                }
            });
    });
}
/**GAB-09826-M2X9**/
function processFavListAddPKForm() {

    $("#favTitle").keyup(function() {

        $('.modal-backdrop').remove();
        $('#modal-category-character').remove();

        if ($("#favTitle").val().length > 50) {
            $(str).modal();
            $("#favTitle").val($("#favTitle").val().substring(0, 50));
            $("#favTitle").focus();
        }
    });

    $("#favTitle").keydown(function() {

        $(".modal-backdrop").remove();
        $("#modal-category-character").remove();
        if ($("#favTitle").val().length > 50) {
            $(str).modal();
            $("#favTitle").val($("#favTitle").val().substring(0, 50));
            $("#favTitle").focus();
        }

    });

    $(document.body).off('click', '#btnSubmit').on('click', '#btnSubmit', function(e) {
        e.preventDefault();
        e.stopPropagation();

        var str = '<div id="modal-select-category" class="modal fade" tabindex="-1" role="dialog" aria-labelledby="sm_popup" aria-hidden="true">';
        str += '<div class="modal_vah">';
        str += '<div class="modal-dialog modal-sm">';
        str += '<div class="modal-content">';
        str += '<div class="modal-header tac" style="border:1px solid #eaedf2;">';
        str += '<button type="button" class="close" data-dismiss="modal" aria-hidden="true"></button>';
        str += '<h3 class="modal-title">Wish List Name</h3>';
        str += '</div>';
        str += '<div class="modal-body" style="background-color:#eaedf2;">';
        str += '<div class="modal-favorite" id="favorite-form-content">';
        str += '<div class="p10">Enter Wish List Name</div>';
        str += '</div>';
        str += '</div>';
        str += '</div>';
        str += '</div>';
        str += '</div>';
        str += '</div>';


        if ($("#favTitle").val() == "") {
            $('.modal-backdrop').remove();
            $('#modal-select-category').remove();
            $(str).modal();
            return false;
        }


        $.getJSON("/ajax/account/favorites", {
                "mode": "addPK",
                "favTitle": $("#favTitle").val(),
                "favStatus": $("#favStatus").val()
                    /*"favItem": $("#favItemCode").val()**/
            },
            function(data) {
                if (data.status == "duplicate") {
                    var tmplistName = " A wishlist with this name already exist. Please change the name.";
                    $('#favorite-form-content').html(tmplistName);
                    return false;
                } else if (data.status == "pkfail") {
                    var tmplistName = " PK Number does not exists. Please change the PK entry.";
                    $('#favorite-form-content').html(tmplistName);
                    return false;
                } else if (data.status == "ok") {
                    var tmplistName = " Added to your wishlist";
                    if (data.listname != "") {
                        tmplistName = " Added to your wishlist";
                    }
                    $('#favorite-form-content').html(tmplistName);
                    setTimeout(function() { window.location.href = "/favorites/view/" + data.addedCatName; }, 2000);
                } else {
                    $('#favorite-form-content').html("An unknown error has occurred");

                    var close = setInterval(function() {
                        $('.modal-backdrop').remove();
                        $('#modal-add-to-favorite').modal('hide');
                        $('#modal-add-to-favorite').data('modal', null);

                        clearInterval(close);
                    }, 2000);

                }
            });
    });
}

function processFavList(sItem, sitemType, diamondsId, companyId, diamonduserType) {
    if (sItem == undefined) sItem = "";

    $("#favTitle").keyup(function() {

        //$('.modal-backdrop').remove();
        $('#modal-category-character').remove();

        if ($("#favTitle").val().length > 50) {
            $(str).modal();
            $("#favTitle").val($("#favTitle").val().substring(0, 50));
            $("#favTitle").focus();
        }
    });

    $("#favTitle").keydown(function() {

        //$('.modal-backdrop').remove();
        $('#modal-category-character').remove();
        if ($("#favTitle").val().length > 50) {
            $(str).modal();
            $("#favTitle").val($("#favTitle").val().substring(0, 50));
            $("#favTitle").focus();
        }

    });

    $(document.body).off('click', '.mov-toggle').on('click', '.mov-toggle', function(e) {
        $(".modal-confav").hide();
        e.preventDefault();
        e.stopPropagation();

        //$(".tabfav li.a").removeClass('active');

        $('ul.tabfav li a').each(function() {
            $(this).removeClass('active');
        });

        var that = $(this);
        var menu_id = that.attr('data-id');
        $("#tab-content-" + menu_id).show();
        $("#tab-" + menu_id).addClass('active');
    });

    $(document.body).off('click', '.favEvent').on('click', '.favEvent', function(e) {
        e.preventDefault();
        e.stopPropagation();
        /* GAB-09496-S7Y9 Fix Favorites Interaction */
        var that = $('#favItemCode').val();
        var itemno = '';
        var countFavouriteList = 0;
        if (that.indexOf('_') > -1) {
            var itemval = $(this).data('prod').split('_');
            itemno = itemval[0];
        } else {
            itemno = that;
        }
        var dataStore = (function() {
            var tempCount;
            $.ajax({
                type: "POST",
                async: false,
                url: "/ajax/account/favorites",
                data: { mode: 'favListCount', item: itemno },
                success: function(data) {
                    data = JSON.parse(data);
                    tempCount = data.count;
                }
            });
            return {
                getTempCount: function() {
                    if (tempCount) {
                        return tempCount;

                    } else {
                        console.log('empty');
                    }

                }
            };
        })();
        countFavouriteList = dataStore.getTempCount();
        if (countFavouriteList == 1) {
            var checkStr = "";
            var favlink = "";
            var cntFav = 0;

            $('.bxrList').each(function() {
                if ($(this).is(":checked")) {
                    cntFav++;
                    favlink += "," + $(this).data('link');
                }

            });



            if (cntFav > 0) {

                favlink = favlink.substring(1);

                $.post('/ajax/account/favorites', {
                    'mode': 'remmulCatItem',
                    'favLink': favlink,
                    'item': sItem,
                    'type': '',
                }, function(data) {
                    data = JSON.parse(data);
                    if (data.status == "ok") {
                        $('.modal-backdrop').remove();
                        $('#modal-delete-product').remove();
                        $('#modal-move-to-favorite').remove();

                        var str = '<div id="modal-delete-product" class="modal fade" tabindex="-1" role="dialog" aria-labelledby="sm_popup" aria-hidden="true">';
                        str += '<div class="modal_vah">';
                        str += '<div class="modal-dialog modal-sm">';
                        str += '<div class="modal-content">';
                        str += '<div class="modal-header tac" style="border:1px solid #eaedf2;">';
                        str += '<h3 class="modal-title">Wishlist</h3>';
                        str += '<button type="button" class="close" data-dismiss="modal" aria-hidden="true" id="favorite-close"><i class="fa fa-times"></i></button>';
                        str += '</div>';
                        str += '<div class="modal-body" style="background-color:#eaedf2;">';
                        str += '<div class="modal-favorite" id="favorite-form-content">';
                        str += '<div class="p10">Removed from your wishlist</div>';
                        str += '</div>';
                        str += '</div>';
                        str += '</div>';
                        str += '</div>';
                        str += '</div>';
                        str += '</div>';
                        $(str).modal();

                        $(document.body).off('click', '#favorite-close').on('click', '#favorite-close', function(e) {
                            //window.location.reload();
                            var url = window.location.href;
                            var subUrl = "/favorites/view/";
                            if (url.indexOf(subUrl) != -1) {
                                //console.log(subUrl + " found");
                                window.location.reload();
                            }
                        });
                    }
                });
            }
        } else if (countFavouriteList > 1) {
            /* GAB-09496-S7Y9 Fix Favorites Interaction */
            $(".RemoveSubmit").bind("click", (function() {
                var checkStr = "";
                var favlink = "";
                var cntFav = 0;

                $('.bxrList').each(function() {
                    if ($(this).is(":checked")) {
                        cntFav++;
                        favlink += "," + $(this).data('link');
                    }

                });
                favlink = favlink.substring(1);
                $.post('/ajax/account/favorites', {
                    'mode': 'remmulCatItem',
                    'favLink': favlink,
                    'item': sItem,
                    'type': '',
                }, function(data) {
                    data = JSON.parse(data);
                    if (data.status == "ok") {
                        $('#modal-move-to-favorite').remove();
                        $('#modal-delete-product').remove();

                        $('.modal-backdrop').remove();
                        $('#modal-add-to-favorite').remove();
                        var str = '<div id="modal-delete-product" class="modal fade" tabindex="-1" role="dialog" aria-labelledby="sm_popup" aria-hidden="true">';
                        str += '<div class="modal_vah">';
                        str += '<div class="modal-dialog modal-sm">';
                        str += '<div class="modal-content">';
                        str += '<div class="modal-header tac" style="border:1px solid #eaedf2;">';
                        str += '<h3 class="modal-title">Wishlist</h3>';
                        str += '<button type="button" class="close" data-dismiss="modal" aria-hidden="true" id="favorite-close"><i class="fa fa-times"></i></button>';
                        str += '</div>';
                        str += '<div class="modal-body" style="background-color:#eaedf2;">';
                        str += '<div class="modal-favorite" id="favorite-form-content">';
                        str += '<div class="p10">Removed from your wishlist</div>';
                        str += '</div>';
                        str += '</div>';
                        str += '</div>';
                        str += '</div>';
                        str += '</div>';
                        str += '</div>';
                        $(str).modal();
                        $(document.body).off('click', '#favorite-close').on('click', '#favorite-close', function(e) { //window.location.reload();
                            var url = window.location.href;
                            var subUrl = "/favorites/view/";
                            if (url.indexOf(subUrl) != -1) {
                                //console.log(subUrl + " found");
                                window.location.reload();
                            }
                        });
                    }
                });
            }));
        }
    });

    $(document.body).off('click', '#btnSubmit').on('click', '#btnSubmit', function(e) {
        e.preventDefault();
        e.stopPropagation();


        $('.modal-backdrop').remove();
        $('#modal-delete-product').remove();

        var str = '<div id="modal-select-category" class="modal fade" tabindex="-1" role="dialog" aria-labelledby="sm_popup" aria-hidden="true">';
        str += '<div class="modal_vah">';
        str += '<div class="modal-dialog modal-sm">';
        str += '<div class="modal-content">';
        str += '<div class="modal-header tac" style="border:1px solid #eaedf2;">';
        str += '<button type="button" class="close" data-dismiss="modal" aria-hidden="true"></button>';
        str += '<h3 class="modal-title">Wish List Name</h3>';
        str += '</div>';
        str += '<div class="modal-body" style="background-color:#eaedf2;">';
        str += '<div class="modal-favorite" id="favorite-form-content">';
        str += '<div class="p10">Enter Wish List Name</div>';
        str += '</div>';
        str += '</div>';
        str += '</div>';
        str += '</div>';
        str += '</div>';
        str += '</div>';


        if ($("#favTitle").val() == "") {
            $('#modal-select-category').remove();
            $(str).modal();
            return false;
        }


        $.getJSON("/ajax/account/favorites", {
                "mode": "addCat",
                "favTitle": $("#favTitle").val(),
                "favStatus": $("#favStatus").val(),
                "favItem": $("#favItemCode").val()
            },
            function(data) {
                if (data.status == "ok") {
                    var tmplistName = " Added to your wishlist";
                    if (data.listname != "") {
                        // tmplistName=" Added to your "+data.listname+" Wishlist";
                        tmplistName = " Added to your " + data.listname;
                    }

                    $('.modal-backdrop').remove();
                    $('#modal-move-to-favorite').remove();

                    var str = '<div id="modal-delete-product" class="modal fade" tabindex="-1" role="dialog" aria-labelledby="sm_popup" aria-hidden="true">';
                    str += '<div class="modal_vah">';
                    str += '<div class="modal-dialog modal-sm">';
                    str += '<div class="modal-content">';
                    str += '<div class="modal-header tac" style="border:1px solid #eaedf2;">';
                    str += '<button type="button" class="close" data-dismiss="modal" aria-hidden="true"></button>';
                    str += '<h3 class="modal-title">Wishlist</h3>';
                    str += '</div>';
                    str += '<div class="modal-body" style="background-color:#eaedf2;">';
                    str += '<div class="modal-favorite" id="favorite-form-content">';
                    str += '<div class="p10">' + tmplistName + '</div>';
                    str += '</div>';
                    str += '</div>';
                    str += '</div>';
                    str += '</div>';
                    str += '</div>';
                    str += '</div>';
                    $(str).modal();

                    $(document.body).off('click', '#favorite-close').on('click', '#favorite-close', function(e) { //window.location.reload();
                    });
                } else {
                    var str = '<div id="modal-delete-product" class="modal fade" tabindex="-1" role="dialog" aria-labelledby="sm_popup" aria-hidden="true">';
                    str += '<div class="modal_vah">';
                    str += '<div class="modal-dialog modal-sm">';
                    str += '<div class="modal-content">';
                    str += '<div class="modal-header tac" style="border:1px solid #eaedf2;">';
                    str += '<button type="button" class="close" data-dismiss="modal" aria-hidden="true"></button>';
                    str += '<h3 class="modal-title">Wishlist</h3>';

                    str += '</div>';
                    str += '<div class="modal-body" style="background-color:#eaedf2;">';
                    str += '<div class="modal-favorite" id="favorite-form-content">';
                    str += '<div class="p10">An unknown error has occurred</div>';
                    str += '</div>';
                    str += '</div>';
                    str += '</div>';
                    str += '</div>';
                    str += '</div>';
                    str += '</div>';
                    $(str).modal();
                }
            });
    });

    $(document.body).off('click', '.addFavList').on('click', '.addFavList', function(e) {
        e.preventDefault();
        e.stopPropagation();

        $('.modal-backdrop').remove();
        $('#modal-add-to-favorite').remove();

        var checkStr = "";
        var favlink = "";
        var cntFav = 0;

        $('.bxselectList').each(function() {
            if ($(this).is(":checked")) {
                cntFav++;
                favlink += "," + $(this).data('link');
            }

        });


        $('.modal-backdrop').remove();
        $('#modal-delete-product').remove();


        if (cntFav > 0) {
            $('#modal-move-to-favorite').remove();
            favlink = favlink.substring(1);
            checkStr = checkStr.substring(1);

            $.post('/ajax/account/favorites', {
                'mode': 'addMulItem',
                'favLink': favlink,
                'item': sItem,
                'type': '',
            }, function(data) {
                data = JSON.parse(data);
                if (data.status == "ok") {

                    var tmplistCatName = " Added to your wishlist";
                    if (data.addedCatName != "") {
                        //tmplistCatName=" Added to your "+data.addedCatName+" Wishlist";
                        tmplistName = " Added to your " + data.addedCatName;
                    }

                    var str = '<div id="modal-delete-product" class="modal fade" tabindex="-1" role="dialog" aria-labelledby="sm_popup"  aria-hidden="true">';
                    str += '<div class="modal_vah">';
                    str += '<div class="modal-dialog modal-sm">';
                    str += '<div class="modal-content">';
                    str += '<div class="modal-header tac" style="border:1px solid #eaedf2;">';
                    str += '<button type="button" class="close" data-dismiss="modal" aria-hidden="true"></button>';
                    str += '<h3 class="modal-title">Wishlist</h3>';
                    str += '</div>';
                    str += '<div class="modal-body" style="background-color:#eaedf2;">';
                    str += '<div class="modal-favorite" id="favorite-form-content">';
                    str += '<div class="p10">' + tmplistCatName + '</div>';
                    str += '</div>';
                    str += '</div>';
                    str += '</div>';
                    str += '</div>';
                    str += '</div>';
                    str += '</div>';
                    $(str).modal();

                    $(document.body).off('click', '#favorite-close').on('click', '#favorite-close', function(e) { //window.location.reload();
                    });
                }
            });

        } else {
            var str = '<div id="modal-delete-product" class="modal fade" tabindex="-1" role="dialog" aria-labelledby="sm_popup" aria-hidden="true">';
            str += '<div class="modal_vah">';
            str += '<div class="modal-dialog modal-sm">';
            str += '<div class="modal-content">';
            str += '<div class="modal-header tac" style="border:1px solid #eaedf2;">';
            str += '<button type="button" class="close" data-dismiss="modal" aria-hidden="true"></button>';
            str += '<h3 class="modal-title">Select List</h3>';
            str += '</div>';
            str += '<div class="modal-body" style="background-color:#eaedf2;">';
            str += '<div class="modal-favorite" id="favorite-form-content">';
            str += '<div class="p10">Select list to add product.</div>';
            str += '</div>';
            str += '</div>';
            str += '</div>';
            str += '</div>';
            str += '</div>';
            str += '</div>';
            $(str).modal();
        }

    });

}

function moveProduct() {

    $("#favTitle").keyup(function() {

        //$('.modal-backdrop').remove();
        $('#modal-category-character').remove();

        if ($("#favTitle").val().length > 50) {
            $(str).modal();
            $("#favTitle").val($("#favTitle").val().substring(0, 50));
            $("#favTitle").focus();
        }
    });

    $("#favTitle").keydown(function() {

        //$('.modal-backdrop').remove();
        $('#modal-category-character').remove();
        if ($("#favTitle").val().length > 50) {
            $(str).modal();
            $("#favTitle").val($("#favTitle").val().substring(0, 50));
            $("#favTitle").focus();
        }

    });

    $(document.body).off('click', '.mov-toggle').on('click', '.mov-toggle', function(e) {
        e.preventDefault();
        e.stopPropagation();

        var that = $(this);
        var menu_id = that.attr('data-id');
        $(".modal-confav").fadeOut();
        $("#tab-content-" + menu_id).fadeIn();
    });
    $(document.body).off('click', '.movFavList').on('click', '.movFavList', function(e) {
        e.preventDefault();
        e.stopPropagation();

        var cntCheck = 0;
        var checkStr = "";
        var favlink = "";
        var cntFav = 0;

        $('.bxselectList').each(function() {
            if ($(this).is(":checked")) {
                cntFav++;
                favlink += "," + $(this).data('link');
            }

        });

        $('.bxRadio').each(function() {
            if ($(this).is(":checked")) {
                cntCheck++;
                checkStr += "," + $(this).data('value');
            }

        });

        $('.modal-backdrop').remove();
        $('#modal-delete-product').remove();
        $('#modal-move-to-favorite').remove();

        if (cntFav > 0) {
            if (cntCheck > 0) {
                favlink = favlink.substring(1);
                checkStr = checkStr.substring(1);

                $.post('/ajax/account/favorites', {
                    'mode': 'addMulItem',
                    'favLink': favlink,
                    'item': checkStr,
                    'type': '',
                }, function(data) {
                    data = JSON.parse(data);
                    if (data.status == "ok") {
                        var str = '<div id="modal-delete-product" class="modal fade" tabindex="-1" role="dialog" aria-labelledby="sm_popup" aria-hidden="true">';
                        str += '<div class="modal_vah">';
                        str += '<div class="modal-dialog modal-sm">';
                        str += '<div class="modal-content">';
                        str += '<div class="modal-header tac" style="border:1px solid #eaedf2;">';
                        str += '<button type="button" class="close" data-dismiss="modal" aria-hidden="true"></button>';
                        str += '<h3 class="modal-title">Product Move</h3>';
                        str += '</div>';
                        str += '<div class="modal-body" style="background-color:#eaedf2;">';
                        str += '<div class="modal-favorite" id="favorite-form-content">';
                        str += '<div class="p10">Selected products are moved successfully.</div>';
                        str += '</div>';
                        str += '</div>';
                        str += '</div>';
                        str += '</div>';
                        str += '</div>';
                        str += '</div>';
                        $(str).modal();
                    }
                });
            } else {

                var str = '<div id="modal-delete-product" class="modal fade" tabindex="-1" role="dialog" aria-labelledby="sm_popup" aria-hidden="true">';
                str += '<div class="modal_vah">';
                str += '<div class="modal-dialog modal-sm">';
                str += '<div class="modal-content">';
                str += '<div class="modal-header tac" style="border:1px solid #eaedf2;">';
                str += '<button type="button" class="close" data-dismiss="modal" aria-hidden="true"></button>';
                str += '<h3 class="modal-title">Select Product</h3>';
                str += '</div>';
                str += '<div class="modal-body" style="background-color:#eaedf2;">';
                str += '<div class="modal-favorite" id="favorite-form-content">';
                str += '<div class="p10">Select product to move.</div>';
                str += '</div>';
                str += '</div>';
                str += '</div>';
                str += '</div>';
                str += '</div>';
                str += '</div>';
                $(str).modal();
            }
        } else {
            var str = '<div id="modal-delete-product" class="modal fade" tabindex="-1" role="dialog" aria-labelledby="sm_popup" aria-hidden="true">';
            str += '<div class="modal_vah">';
            str += '<div class="modal-dialog modal-sm">';
            str += '<div class="modal-content">';
            str += '<div class="modal-header tac" style="border:1px solid #eaedf2;">';
            str += '<button type="button" class="close" data-dismiss="modal" aria-hidden="true"></button>';
            str += '<h3 class="modal-title">Select List</h3>';
            str += '</div>';
            str += '<div class="modal-body" style="background-color:#eaedf2;" >';
            str += '<div class="modal-favorite" id="favorite-form-content">';
            str += '<div class="p10">Select list to move product.</div>';
            str += '</div>';
            str += '</div>';
            str += '</div>';
            str += '</div>';
            str += '</div>';
            str += '</div>';
            $(str).modal();
        }

    });

    $(document.body).off('click', '#btnSubmitMul').on('click', '#btnSubmitMul', function(e) {
        e.preventDefault();
        e.stopPropagation();

        var checkStr = '';
        var cntCheck = 0;

        var str = '<div id="modal-select-category" class="modal fade" tabindex="-1" role="dialog" aria-labelledby="sm_popup" aria-hidden="true">';
        str += '<div class="modal_vah">';
        str += '<div class="modal-dialog modal-sm">';
        str += '<div class="modal-content">';
        str += '<div class="modal-header tac" style="border:1px solid #eaedf2;">';
        str += '<button type="button" class="close" data-dismiss="modal" aria-hidden="true"></button>';
        str += '<h3 class="modal-title">Wish List Name</h3>';
        str += '</div>';
        str += '<div class="modal-body" style="background-color:#eaedf2;">';
        str += '<div class="modal-favorite" id="favorite-form-content">';
        str += '<div class="p10">Enter Wish List Name</div>';
        str += '</div>';
        str += '</div>';
        str += '</div>';
        str += '</div>';
        str += '</div>';
        str += '</div>';


        if ($("#favTitle").val() == "") {
            $('#modal-select-category').remove();
            $(str).modal();
            return false;
        }


        $('.bxRadio').each(function() {
            if ($(this).is(":checked")) {
                cntCheck++;
                checkStr += "," + $(this).data('value');
            }

        });

        if (cntCheck > 0) {
            checkStr = checkStr.substring(1);
            $.getJSON("/ajax/account/favorites", {
                    "mode": "addCatMul",
                    "favTitle": $("#favTitle").val(),
                    "favStatus": $("#favStatus").val(),
                    "favItem": checkStr
                },
                function(data) {
                    if (data.status == "ok") {

                        $('#favorite-form-content').html("Removed from your wishlist");

                        setTimeout(function() { location.reload(); }, 2000);
                    } else {
                        $('#favorite-form-content').html("An unknown error has occurred");


                        var close = setInterval(function() {
                            $('.modal-backdrop').remove();
                            $('#modal-add-to-favorite').modal('hide');
                            $('#modal-add-to-favorite').data('modal', null);

                            clearInterval(close);
                        }, 2000);

                    }
                });
        }
    });


}

function showWait(message) {
    var loadimg = $('#loading-image').attr('src');
    $('#progressmodal .modal-body').html(message + '<br><img data-src="' + loadimg + '" alt="loading..." class="loadimgcls" />');
    $(".quickview-w").css("width", "300");
    $('#progressmodal').modal({
        backdrop: 'static',
        keyboard: false
    }).show();
}

function hideWait() {
    $('#progressmodal').modal('hide');
}

//For Floater Button
/*
$(document).ready(function () {
    w = document.body.clientWidth;
    adjustFolterButton();
});
$(window).bind("resize orientationchange", function() {
    w = document.body.clientWidth;
    adjustFolterButton();
});
function adjustFolterButton(){
    if (w <= 767){
        $(function($){
            $('.right-drawer-btn').click(function() {
                var it = $(this).data('it') || 1;
                switch ( it ){
                    case 1 :
                        $(this).parent().animate({bottom:'0px'}, {queue:false, duration: 300});
                        break;
                    case 2 :
                        $(this).parent().animate({bottom:'-105px'}, {queue: false, duration: 300});
                        break;
                }
                it++;
                if(it > 2) it = 1;
                $(this).data('it', it);
            })
        });
    }
}
*/</script>
<!--[if lte IE 9]>
<script type="text/javascript" src="https://cdn-localassets.gabrielny.com/javascript/system/legacy.js"></script>
<![endif]-->
<script src="https://cdn-localassets.gabrielny.com/javascript/jQuery/jquery.overlayScrollbars.min.js?v=14"></script><script src="https://cdn-localassets.gabrielny.com/javascript/jQuery/jquery.address.js?autoUpdate=1&state=/&strict=0&v=14"></script><script src="https://cdn-localassets.gabrielny.com/javascript/jQuery/jquery.lazy.min.js?v=14"></script>

<!-- Begin Raw -->
<script data-file="eshop/eshop.js">/**
 * Created by v-pvaithilingam on 2/27/2015.
 */
ESHOP_CONFIG.embedOrigin = '{HTTP_REFERER}';
$(function () {

    if (!ESHOP_CONFIG.isEmbed() && $.cookie('embedPRODUCTION') && $.cookie('embedPRODUCTION') != '') {
        $.cookie('embedPRODUCTION', '', {path: '/', domain: '.gabrielny.com', expires: -1});
        window.location.reload();
    }

    if (ESHOP_CONFIG.isEmbed() && $.cookie('embedPRODUCTION') && $.cookie('embedPRODUCTION') != '') {
        $('div.row.restSearchText').show();
    }

    /*=====================Color Change =================================*/

    //$(".colorMeThis").on("click", function(){
    /*
     $(document.body).off('click', '.colorMeThis').on('click', '.colorMeThis', function() {
     var prodUrl = "/product/" + $(this).attr("data-color");
     var image = $(this).attr("data-image");
     var url, hoverUrl= "";
     if(image == "true") {
     url = "https://s7d4.scene7.com/is/image/GabrielCo/" + $(this).attr("data-color") + "-1?$Medium$";
     hoverUrl = "https://s7d4.scene7.com/is/image/GabrielCo/" + $(this).attr("data-color") + "-2?$Medium$";
     } else {
     url = "//assets.gabrielny.com/noimage.jpg";
     hoverUrl = "//assets.gabrielny.com/noimage.jpg";
     }

     $(this).parent().parent().parent().parent().siblings(".thumb").children("a").children("img").remove();
     var img = $("<img class='itemListingImage' src='' data-role='imagetilehover' width='95%'/>");
     $(this).parent().parent().parent().parent().siblings(".thumb").children("a").append(img);
     $(this).parent().parent().parent().parent().siblings(".thumb")
     .find("img").attr({"src" : url, "data-default-image" : url, "data-hover-image" : hoverUrl})
     .data('original-image', url);

     $(this).parent().parent().parent().parent().siblings(".thumb")
     .find("img").parent().attr("href", prodUrl );

     $(".colorMeThis").on("click", function(){
     $(this).parent().parent().parent().parent()
     .siblings(".thumb").siblings(".product-bottom").children(".bottomstyle").children(".quickview")
     .children("a").attr("data-code", $(this).attr("data-color")); });

     $(this).parent().parent().parent().parent().siblings(".thumb")
     .find("img").parent().siblings(".overlay-fluid-top").children().children()
     .attr("href", prodUrl).text($(this).attr("data-color"));$(this).parent().parent().parent().parent()
     .siblings(".thumb").find(".itemListingImage").on(
     {
     mouseenter: function() {
     $(this).attr('src', $(this).data('hover-image'));
     },
     mouseleave: function() {
     $(this).attr('src', $(this).data('default-image'));
     }
     });
     });
     */
    /*================== End color Change ================================*/

});
/*
 $(window).resize(viewModeSwitched);

 function viewModeSwitched(){
 var mode = getViewMode();
 console.log(mode);
 if(mode && mode == "on-tablet-landscape"){
 $('.eshop-content').addClass('on-tablet-landscape');
 }else if($('.eshop-content').hasClass('on-tablet-landscape')){
 $('.eshop-content').removeClass('on-tablet-landscape');
 }
 }*/

$(document).ready(function () {
    $(document).trigger('initEshopFunctions');
});

$(document).on('initEshopFunctions', initEshop);
$(document).on('triggerRestSearch', triggerRestSearch);

function initEshop() {
    //viewModeSwitched();

    if (typeof(pageTitle) !== "undefined" && pageTitle && pageTitle.length > 0 && pageTitle != "{PAGE_TITLE}") {
        document.title = pageTitle + ' | Gabriel & Co';
    }

    /* Add Remove Favorites*/

    $('#btnFavoritesEMBED').on('click', function (e) {
        postFavorites($(this).data('prod'));
    });

    /* Add Remove Clientelling*/

    $('#btnClientellingEMBED').on('click', function (e) {
        postClientelling($(this).data('prod'));
    });

    //$('#btnFavorites,.itemFavourite').on('click', function (e) {
    $(document.body).off('click', '#btnFavorites,.itemFavourite').on('click', '#btnFavorites,.itemFavourite', function(e){
        e.preventDefault();
        if($(this).find('img').length>0) {
			if($(this).find('img').attr('src').indexOf('-selected') != -1){
				e.stopPropagation();
			}
		} else {
			if($(this).hasClass('active')) {
				e.stopPropagation();
			}
		}
		
		var is_remove = "No";
		var imgtag = $(this).find("img").attr("src");
		// if($(this).hasClass('active') || (typeof(imgtag) !== "undefined" && imgtag.indexOf('heart-selected') != -1)) {
		if(($(this).hasClass('active') && typeof(imgtag) === "undefined") || (typeof(imgtag) !== "undefined" && imgtag.indexOf('heart-selected') != -1)) {
			is_remove = "Yes";
		}

        $('#modal-move-to-favorite').remove();
        $('#modal-delete-product').remove();

        $('.modal-backdrop').remove();
        $('#modal-add-to-favorite').remove();
        var heart_elem = $(this);
        var that = $(this).data('prod');
        var itemno = '';
        var itemtype = '';
        var diamondsId = '';
        var companyId = '';
        var diamonduserType = '';
        if (that.indexOf('_') > -1) {
            var itemval = $(this).data('prod').split('_');
            itemno = itemval[0];
            itemtype = itemval[1];
            diamondsId = itemval[2];
            companyId = itemval[3];
            if (itemval[4] == '1')
                diamonduserType = 'Dealer';
            else
                diamonduserType = 'Retailer';
        }
        else {
            itemno = that;
            itemtype = 'Others';
        }


        $.ajax({
            type: "POST",
            url: '/ajax/account/favorites',
            data: "mode=getStatus&item=" + itemno + "&itemtype=" + itemtype + "&diamondsId=" + diamondsId + "&companyId=" + companyId + "&diamonduserType=" + diamonduserType,
            dataType: "json",
            success: function (data) {
                //$(data.html).modal('show');

                var modal_txt = (is_remove == "Yes") ? "hide" : "show";

                $('body').append($(data.html).modal(modal_txt));

                if($(heart_elem).parent().parent().hasClass('matching_slider'))
                {
                    $(heart_elem).find('img').attr("src",$(heart_elem).find('img').attr("data-imgsel"));
                }
            }
        });
    });

    $(document.body).off('click', '#btnClientelling,.itemClientelling').on('click', '#btnClientelling,.itemClientelling', function(e){
        e.preventDefault();
        if($(this).find('img').length>0) {
			if($(this).find('img').attr('src').indexOf('-selected') != -1){
				e.stopPropagation();
			}
		} else {
			if($(this).hasClass('active')) {
				e.stopPropagation();
			}
		}

        $('#modal-move-to-clientelling').remove();
        $('#modal-delete-product-cli').remove();

        $('.modal-backdrop').remove();
        $('#modal-add-to-clientelling').remove();
        var heart_elem = $(this);
        var that = $(this).data('prod');
        var itemno = '';
        var itemtype = '';
        var itemSort = '';
        var itemRecommendBy = 'User';
        if (that.indexOf('_') > -1) {
            var itemval = $(this).data('prod').split('_');
            itemno = itemval[0];
            itemtype = itemval[1];
        }
        else {
            itemno = that;
            itemtype = 'Others';
        }

        $.ajax({
            type: "POST",
            url: '/ajax/b2b/clientelling',
            data: "mode=getStatus&item=" + itemno + "&cliItemType=" + itemtype + "&cliItemSort=" + itemSort + "&cliItemRecommendBy=" + itemRecommendBy ,
            dataType: "json",
            success: function (data) {
                //$(data.html).modal('show');

                $('body').append($(data.html).modal());

                if($(heart_elem).parent().parent().hasClass('matching_slider'))
                {
                    $(heart_elem).find('img').attr("src",$(heart_elem).find('img').attr("data-imgsel"));
                }
            }
        });

    });


}


function triggerRestSearch() {
}

/*=====================Start Top Control=============================*/
/*
 var scrolltotop={
 //startline: Integer. Number of pixels from top of doc scrollbar is scrolled before showing control
 //scrollto: Keyword (Integer, or "Scroll_to_Element_ID"). How far to scroll document up when control is clicked on (0=top).
 setting: {startline:100, scrollto: 0, scrollduration:1000, fadeduration:[500, 100]},
 controlHTML: '<img class="as-common as-icon-up" src="https://cdn-themes.gabrielny.com/site2017theme/images/top-control.png"/>', //HTML for control, which is auto wrapped in DIV w/ ID="topcontrol"
 controlattrs: {offsetx:5, offsety:5}, //offset of control relative to right/ bottom of window corner
 anchorkeyword: '#top', //Enter href value of HTML anchors on the page that should also act as "Scroll Up" links

 state: {isvisible:false, shouldvisible:false},

 scrollup:function(){
 if (!this.cssfixedsupport) //if control is positioned using JavaScript
 this.$control.css({opacity:0}) //hide control immediately after clicking it
 var dest=isNaN(this.setting.scrollto)? this.setting.scrollto : parseInt(this.setting.scrollto)
 if (typeof dest=="string" && jQuery('#'+dest).length==1) //check element set by string exists
 dest=jQuery('#'+dest).offset().top
 else
 dest=0
 this.$body.animate({scrollTop: dest}, this.setting.scrollduration);
 },

 keepfixed:function(){
 var $window=jQuery(window)
 var controlx=$window.scrollLeft() + $window.width() - this.$control.width() - this.controlattrs.offsetx
 var controly=$window.scrollTop() + $window.height() - this.$control.height() - this.controlattrs.offsety
 this.$control.css({left:controlx+'px', top:controly+'px'})
 },

 togglecontrol:function(){
 var scrolltop=jQuery(window).scrollTop()
 if (!this.cssfixedsupport)
 this.keepfixed()
 this.state.shouldvisible=(scrolltop>=this.setting.startline)? true : false
 if (this.state.shouldvisible && !this.state.isvisible){
 this.$control.stop().animate({opacity:1}, this.setting.fadeduration[0])
 this.state.isvisible=true
 }
 else if (this.state.shouldvisible==false && this.state.isvisible){
 this.$control.stop().animate({opacity:0}, this.setting.fadeduration[1])
 this.state.isvisible=false
 }
 },

 init:function(){
 jQuery(document).ready(function($){
 var mainobj=scrolltotop
 var iebrws=document.all
 mainobj.cssfixedsupport=!iebrws || iebrws && document.compatMode=="CSS1Compat" && window.XMLHttpRequest //not IE or IE7+ browsers in standards mode
 mainobj.$body=(window.opera)? (document.compatMode=="CSS1Compat"? $('html') : $('body')) : $('html,body')
 mainobj.$control=$('<div id="topcontrol">'+mainobj.controlHTML+'</div>')
 .css({position:mainobj.cssfixedsupport? 'fixed' : 'absolute', bottom:mainobj.controlattrs.offsety, right:mainobj.controlattrs.offsetx, opacity:0, cursor:'pointer'})
 .attr({title:'Scroll Back to Top'})
 .click(function(){mainobj.scrollup(); return false})
 .appendTo('body')
 if (document.all && !window.XMLHttpRequest && mainobj.$control.text()!='') //loose check for IE6 and below, plus whether control contains any text
 mainobj.$control.css({width:mainobj.$control.width()}) //IE6- seems to require an explicit width on a DIV containing text
 mainobj.togglecontrol()
 $('a[href="' + mainobj.anchorkeyword +'"]').click(function(){
 mainobj.scrollup()
 return false
 })
 $(window).bind('scroll resize', function(e){
 mainobj.togglecontrol()
 })
 })
 }
 }
 scrolltotop.init();
 */
/*=====================End Top Control===============================*/


</script>
<script data-file="eshop/eshop_listing.js">var sw = $(window).width();
var sh = $(window).height();
$('.product_show').show();

$(window).bind("resize orientationchange", function() {
    w = document.body.clientWidth;
    if (sw != $(window).width() && sh != $(window).height()) {
        sw = $(window).width();
        sh = $(window).height();
        //w > 991?setHeight('.cat-list>li', '.product_show'):$('.cat-list>li').removeAttr('style');           
        // setHeight('.cat-list>li:not(.pitchboxli)', '.product_show');
        if (isMobileView()) {
            columnConform('.product', '.product_show');
            columnConformPitchbox('ul.cat-list li.pitchboxli', 'ul.cat-list li.lazy');
        } else {
            columnConform('.cat-list>li:not(.pitchboxli)', '.product_show');
        }
        aiSimilarScroll();
    }
});


$(window).load(function() {
    // w > 991?setHeight('.cat-list>li', '.product_show'):$('.cat-list>li').removeAttr('style');
    //setHeight('.cat-list>li:not(.pitchboxli)', '.product_show');
    if (isMobileView()) {
        columnConform('.product', '.product_show');
        columnConformPitchbox('ul.cat-list li.pitchboxli', 'ul.cat-list li.lazy');
    } else {
        columnConform('.cat-list>li:not(.pitchboxli)', '.product_show');
    }
});

function setHeight(column, hidden, loadval) {
    column = $(column);
    var maxHeight = 0;
    $('.product_show').show();
    column.each(function() {
        if ($(this).find(hidden).is(":hidden")) {
            var thisHeight = $(this).height() + $(this).find(hidden).height();
        } else {
            var thisHeight = $(this).height();
        }
        if (thisHeight > maxHeight) {
            maxHeight = thisHeight;
        }
    });
    column.height(maxHeight);
    //column.height('550');
    //$('.product_show').removeAttr('style');
    setTimeout(function() {
        $('.product_show').removeAttr('style');
    }, 500);
}



var currentTallest = 0,
    currentRowStart = 0,
    rowDivs = new Array();

function setConformingHeight(el, newHeight) {
    // set the height to something new, but remember the original height in case things change
    el.data("originalHeight", (el.data("originalHeight") == undefined) ? (el.height()) : (el.data("originalHeight")));
    el.height(newHeight);
}

function getOriginalHeight(el) {
    // if the height has changed, send the originalHeight
    return (el.data("originalHeight") == undefined) ? (el.height()) : (el.data("originalHeight"));
}

function columnConform(column, hidden) {

    $('.product_show').show();
    // find the tallest DIV in the row, and set the heights of all of the DIVs to match it.
    $(column).each(function() {
        // "caching"
        var $el = $(this);

        var topPosition = $el.position().top;

        if (currentRowStart != topPosition) {
            // we just came to a new row.  Set all the heights on the completed row
            for (currentDiv = 0; currentDiv < rowDivs.length; currentDiv++) setConformingHeight(rowDivs[currentDiv], currentTallest);
            // set the variables for the new row
            rowDivs.length = 0; // empty the array
            currentRowStart = topPosition;
            currentTallest = getOriginalHeight($el);
            rowDivs.push($el);
        } else {
            // another div on the current row.  Add it to the list and check if it's taller
            rowDivs.push($el);
            currentTallest = (currentTallest < getOriginalHeight($el)) ? (getOriginalHeight($el)) : (currentTallest);
        }
        // do the last row
        for (currentDiv = 0; currentDiv < rowDivs.length; currentDiv++) {
            setConformingHeight(rowDivs[currentDiv], currentTallest);
        }
    });
    setTimeout(function() {
        $('.product_show').removeAttr('style');
    }, 500);
}

function columnConformPitchbox(setcolumn, ascolumn) {
    var newHeight = $(ascolumn).height();
    $(setcolumn).each(function(el) {
        $(this).height(newHeight);
    });
}



var topfilteroption = function() {

    $("#filter_setting").click(function() {
        //$(".filter_ring_style").toggleClass("show_filter");
        $(".product-filter .filter-box-content").first().toggleClass("show_filter");
        $("body").toggleClass("body-filter");
    });
    $(".scsm-close").click(function() {
        //$(".filter_ring_style").removeClass("show_filter");
        $(".filter_ring_style").removeClass("show_filter");
        $(".product-filter .filter-box-content").first().removeClass("show_filter");
        $(".product-filter .stoneheadshape .filter-box-content").removeClass("show_filter");
        $(".product-filter .metal .filter-box-content").removeClass("show_filter");
        $("body").removeClass("body-filter");
    });
    $("#filter_shape").click(function() {
        //$(".filter_shape").toggleClass("show_filter");
        $(".product-filter .stoneheadshape .filter-box-content").toggleClass("show_filter");
        $("body").toggleClass("body-filter");
    });
    /*$(".close_filter").click(function () {
        $(".filter_shape").removeClass("show_filter");
        $("body").removeClass("body-filter");
    });*/
    $("#filter_metal").click(function() {
        //$(".filter_metal").toggleClass("show_filter");
        $(".product-filter .metal .filter-box-content").toggleClass("show_filter");
        $("body").toggleClass("body-filter");
    });
    /*$(".close_filter").click(function () {
        $(".filter_metal").removeClass("show_filter");
        $("body").removeClass("body-filter");
    });*/
    $("#filter_sort").click(function() {
        $(".filter_short_by").toggleClass("show_filter");
        $("body").toggleClass("body-filter");
    });
    $(".close_filter").click(function() {
        $(".filter_short_by").removeClass("show_filter");
        $("body").removeClass("body-filter");
    });

    $("#filter").click(function() {
        $(".select_filter").toggleClass("show_filter");
        $("body").toggleClass("body-filter");
    });
    $(".close_filter").click(function() {
        $(".select_filter").removeClass("show_filter");
        $("body").removeClass("body-filter");
    });

    /*$(".prd_list_metal").click(function () {
        $(".filter_metal").toggleClass("show_filter");
        $("body").toggleClass("body-filter");
    });
    $(".list_shape_link").click(function () {
        $(".filter_shape").toggleClass("show_filter");
        $("body").toggleClass("body-filter");
    });*/
    $(".fdrpdwn-box-hd").click(function() {
        $(".fdrpdwn-box-hd").not(this).removeClass("act");
        $(".fdrpdwn-box-hd").not(this).next("div.fdrpdwn-box-content").hide();
        $(this).toggleClass("act");
        $(this).next().slideToggle();
    });
    $(document).on("click", function(e) {
        if ($(e.target).is(".fdrpdwn-box-hd") === false) {
            $("div.fdrpdwn-box-content").hide();
            $(".fdrpdwn-box-hd").removeClass("act");
        }
    });

}

//For Pagination
var pagination = function() {
    $('div.pagination a, .listingloadmore').bind('click', function(e) {
        e.preventDefault();
        e.stopPropagation();
        $('#loader').hide();
        $(".listingloadmore").fadeOut();
        $(".loadingmoreitem").fadeIn();

        goto($(this).attr('data-path'), 'lazypaging', 'After');
    });
}

//For Breadcrumb
var bredcrumb = function() {
    $('.breadcrumb-item').bind('click', function(el) {
        el.preventDefault();
        el.stopPropagation();
        var $l = $(this).children('a');
        if (typeof($l.attr('href')) != "undefined") {
            goto($l.attr('href'), 'lazybreadcrumb', 'replace');
        }
    });
}

//For Price shorting
var sortoption = function() {
    $('.sort').bind('click', function(el) {
        el.preventDefault();
        el.stopPropagation();
        var path = $(this).attr('data-path');
        var re = /\/page-(\d*)/;
        path = path.replace(re, '/page-1');
        $("#currentPage").val(1);
        goto(path, 'lazysort', 'replace');

        $(".sort").siblings().each(function() {
            $(this).removeClass('active');
        });
        $(this).addClass('active');

    });

    //For Item per page
    $('#sub-display2 li').bind('click', function(el) {
        el.preventDefault();
        el.stopPropagation();
        var l = $(this).children('li');
        $("#currentPage").val(1);
        goto($(this).children('a').attr('data-path'), 'lazyperpage', 'replace');
    });

    //For Overstock,Instock
    $('.saleitem, .instock, .overstock, .purchase').bind('click', function(el) {
        el.preventDefault();
        el.stopPropagation();
        var path = $(this).attr('data-path');

        $(".cat-option-text").siblings().each(function() {
            $(this).removeClass('active');
        });
        $(this).addClass('active');
        $("#currentPage").val(1);
        goto(path, 'lazysort', 'replace');
    });
}

var parseurlcheck = function() {
    var url = getActualPath();
    var lcaseURL = url.toLowerCase();
    var urlsPath = url.split("/");
    var urlAttr = {};

    $.each(urlsPath, function(k, v) {
        if (v != "") {
            var key = v.split('-', 1);
            if (key != "" && key != "engagement") {
                v = decodeURIComponent(v);
                urlAttr[key.toString().toLowerCase().trim()] = { "value": v.replace(key + '-', ''), "path": v };
            }
        }
    });
    pathAttr = JSON.parse(JSON.stringify(urlAttr));


    var url = getActualPath();
    var lcaseURL = url.toLowerCase();
    var urlsPath = url.split("/");
    var urlAttr = {};

    $.each(urlsPath, function(k, v) {
        if (v != "") {
            var key = v.split('-', 1);
            if (key != "" && key != "engagement") {
                v = decodeURIComponent(v);
                urlAttr[key.toString().toLowerCase().trim()] = { "value": v.replace(key + '-', ''), "path": v };
            }
        }
    });
    pathAttr = JSON.parse(JSON.stringify(urlAttr));

    //For Category URL
    var url = getActualPath();

    var eshopMode = parseInt('1');

    if (eshopMode) {
        domain = 'https://embed.gabrielny.com';
    } else {
        domain = 'https://embed.gabrielny.com';
    }

    $('.mobselectedfilter li.advance-product-filter').on('click', selectProductSubFilter);
    $('.mobselectedfilter li.advance-sub-filter').on('click', defaultProductSubFilter);

    $('.reseat-icon').on('click', function(e) {

        $('.advance-product-filter').each(function() {
            if ($(this).children('a').hasClass('active')) {
                $('.' + $(this).children('a').attr('data-class')).removeClass('active');
            }
        });

        /*$('.advance-product-filter .image-container').each(function (){
           $(this).attr("src",$(this).attr("data-imgorg"));
        });*/

        $('.advance-sub-filter').each(function() {
            if ($(this).children('a').hasClass('active')) {
                $('.' + $(this).children('a').attr('data-class')).removeClass('active');
            }
        });

        //Hide Mobile Left option if clear all
        if ($(".morefiltersidenav").hasClass("sideNavMobFilter")) {
            $('.close-m').trigger("click");
        }

        //Remove all selected Fitlers
        $('.filter-select-op').empty();
        goto(domain + "/" + $(this).data('path'), "lazyfilter", "replace", "remove");
    });

    $('.clearall').on('click', function(e) {
        $('.reseat-icon').trigger("click");
    });
}

var changeimageover = function() {
    $(".advance-product-filter .style a").mouseover(function() {

        var checkcls = $(this).hasClass('active');

        var imagehover = $(this).find('img').data("imghov");
        var imagesele = $(this).find('img').data("imgsel");
        var imageorg = $(this).find('img').data("imgorg");
        if (!checkcls) {
            if (imagehover != "") {
                $(this).find('img').attr('src', imagehover);
            }
        } else if (checkcls) {
            $(this).find('img').attr('src', imagesele);
        }
    }).mouseout(function() {
        var checkcls = $(this).hasClass('active');

        var imagehover = $(this).find('img').data("imghov");
        var imageorg = $(this).find('img').data("imgorg");
        var imagesele = $(this).find('img').data("imgsel");
        if (!checkcls) {
            if (imageorg != "") {
                $(this).find('img').attr('src', imageorg);
            }
        } else if (checkcls) {
            $(this).find('img').attr('src', imagesele);
        }
    });
}

var setfavorites = function() {
    //Favorites Item
    var favProdId = '';
    $('.product_heart_icon').on('click', function(e) {
        favProdId = $(this).data("prod");

    })
    $(document.body).off('click', '#modal-delete-product').on('click', '#modal-delete-product', function(e) {
        if (favProdId != "") {
            $.ajax({
                type: 'POST',
                dataType: 'json',
                url: '/ajax/eshop/checkfavorite',
                data: { favProdId: favProdId }
            }).done(function(data) {
                var heartSel = $("#fav-" + favProdId).find('img').attr("data-imgsel");
                var heartOrg = $("#fav-" + favProdId).find('img').attr("data-imgorg");

                if (data.favstatus == "active") {
                    $("#fav-" + favProdId + '.product_heart_icon').find('img').attr("src", heartSel);
                    $("#favm-" + favProdId + '.product_heart_icon').find('img').attr("src", heartSel);
                } else {
                    $("#fav-" + favProdId + '.product_heart_icon').find('img').attr("src", heartOrg);
                    $("#favm-" + favProdId + '.product_heart_icon').find('img').attr("src", heartOrg);
                }
            });
        }
    });

    $(".product_heart_icon").mouseover(function() {
        var checkcls = $(this).find('img').attr("src");
        var imagehover = $(this).find('img').attr("data-imghov");
        if (imagehover != "" && checkcls.indexOf('-selected') <= 0) {
            $(this).find('img').attr('src', imagehover);
        }
    }).mouseout(function() {
        var checkcls = $(this).find('img').attr("src");
        var imageorg = $(this).find('img').attr("data-imgorg");
        if (imageorg != "" && checkcls.indexOf('-selected') <= 0) {
            $(this).find('img').attr('src', imageorg);
        }
    });
}

var setaigps = function() {
    //Check GPS Item
    /*$('.product-ai-similar').each(function (ind, val) {
        var tmpItemCode=$(this).attr('data-prod');
         $.ajax({
                type: 'POST',
                dataType: 'json',
                url: '/ajax/eshop/checkgps',
                data: {gpstype: "productsearch",itemcode: tmpItemCode}
            }).done(function(data){

                if(data.foundproduct){
                    //$('#pais-'+tmpItemCode).css('display','block');
                }
                else{
                    $('#pais-'+tmpItemCode).css('display','none');
                }
            });
    });*/

    $(document.body).off('click', '.product-ai-similar').on('click', '.product-ai-similar', function(e) {

        $("#productAISimilar .psimilar").html($('.loder-img').html());
        //$("#productAISimilar").css("width", 500);
        $("#productAISimilar").addClass("sideNavMob");
        $(".sidenavbg").show();

        $(".filter-bottom-m").hide();

        $.ajax({
            type: 'POST',
            dataType: 'json',
            url: '/ajax/eshop/checkgps',
            data: { gpstype: "gpsprodutinfo", itemcode: $(this).attr('data-prod') }
        }).done(function(data) {

            $("#productAISimilar .psimilar").html("");
            $("#productAISimilar .psimilar").html(data.subhtml);

            aiSimilarScroll();

            setfavorites();
            initEshop();

            $(document.body).off('click', '.closeWindow').on('click', '.closeWindow', function(e) {
                //$("#productAISimilar").css("width", 0);
                $(".sidenavbg").hide();
                $("#productAISimilar").removeClass("sideNavMob");
                $(".filter-bottom-m").show();
            });

            //exit the slider when clicked on other part of page
            $(document.body).off('click', '.sidenavbg').on('click', '.sidenavbg', function(e) {
                $(".closeWindow").trigger("click");
            });


        });
    });
}

var itemPerPage = function() {
    $(document.body).off('click', '.dotoggle').on('click', '.dotoggle', function(e) {
        e.stopPropagation();
        var ethis = $(this).find('.dotoggle-inner');
        $('.dotoggle').find('.dotoggle-inner').not(ethis).slideUp();
        if (!$(e.target).parents('ul').hasClass('dropdown-list') && !$(e.target).closest('.dotoggle-inner').length) {
            $(this).find('.dotoggle-inner').slideToggle();
            if ($(this).find('.dropdown-select').hasClass('act')) {
                $(this).find('.dropdown-select').removeClass('act');
            } else {
                $('.dotoggle').find('.dropdown-select').removeClass('act');
                $(this).find('.dropdown-select').addClass('act');
            }
        }
    });
}

function aiSimilarScroll() {

    if (sw > 768) {
        $('.ringsec').attr('style', 'max-height:' + parseInt(sh - 50) + 'px');
    }

    if ($(".ringsec").length > 0) {
        $('.ringsec').overlayScrollbars({
            className: "os-theme-round-dark",
            resize: "both",
            sizeAutoCapable: true,
            paddingAbsolute: false
        });
    }
}

//Start For GTM Product Impression and Click Tracking
var googlegtmtrack = function() {
        var prod_currency = '';
        var productImpressionItem = document.getElementsByClassName('product');

        if (productImpressionItem.length > 0) {

            var tempListImpressionArr = [];

            $('.product').each(function(i) {
                if (i > 34) {
                    return;
                }

                prod_currency = $(this).data('currency');

                var $this = $(this),
                    prod_id = $this.data('id'),
                    prod_name = $this.data('name'),
                    prod_cat = $this.data('category'),
                    prod_price = $this.data('price'),
                    prod_division = $this.data('division');


                if (prod_id && prod_name && prod_cat && prod_price) {
                    $this.find('.ptitle > a, .pname > a, .redirectlink').on('click', function(e) {
                        dataLayer.push({
                            'event': 'productClick',
                            'ecommerce': {
                                'click': {
                                    'actionField': { 'list': prod_division },
                                    'products': [{
                                        'id': prod_id,
                                        'name': prod_name,
                                        'category': prod_cat,
                                        'price': prod_price,
                                        'brand': 'Gabriel & Co',
                                        'position': i

                                    }]
                                }
                            }
                        });
                    });

                    tempListImpressionArr.push({
                        'id': prod_id,
                        'name': prod_name,
                        'category': prod_cat,
                        'price': prod_price,
                        'brand': 'Gabriel & Co',
                        'position': i,
                        'list': prod_division
                    });
                }
            });

            dataLayer.push({
                'ecommerce': {
                    'currencyCode': prod_currency,
                    'impressions': tempListImpressionArr
                }
            });
        }
    }
    //End for GTM Product Impression and Click Tracking

jQuery.fn.extend({
    isInViewport: function() {
        var elementTop = $(this).offset().top;
        var elementBottom = elementTop + $(this).outerHeight();
        var viewportTop = $(window).scrollTop();
        var viewportBottom = viewportTop + $(window).height();
        return elementBottom > viewportTop && elementTop < viewportBottom;
    }
});

function bindScroll() {
    if ($('#paginationresult').isInViewport()) {
        $(window).unbind('scroll');
        $(".listingloadmore").trigger('click');
        $('body').off('scroll mousewheel touchmove');
    }
}

var lazyloadPartialSection = function() {
    if ($(".lazy").length > 0) {
        $(".lazy").Lazy({
            // callback
            beforeLoad: function(element) {
                //console.log("start loading " + element.prop("tagName"));
            },
            // custom loaders
            producBoxLoader: function(element) {
                // console.log("lazypartial111");
                //element.html("element handled by custom loader");
                element.removeClass('lazyload');
                element.addClass('lazyloaded');
                element.load();
            }
        });
    }
}

//Lazy Loading
var lastScroll = 0;
var loadMore = function() {

    var totPages = parseInt($('#totPages').val());

    var currentPage = parseInt($('#currentPage').val());
    var pageNu = 0;
    var currentUrl = $("#currentURL").val();

    $(".listingloadmore").hide();

    var newurl = '';
    if (currentUrl && currentUrl.indexOf('/page-') > 0) {
        pageNu = currentUrl.match(/\/page-(\d*)/)[1];
        pageNu = parseInt(pageNu) + 1;
        var regEx = /\/page-(\d*)/;
        newurl = currentUrl.replace(regEx, '/page-' + pageNu);
        $("#currentPage").val(pageNu);
    } else {
        pageNu = 2;
        newurl = currentUrl + '/page-' + pageNu;
        $("#currentPage").val(pageNu);
    }


    if (totPages >= pageNu && totPages > 1) {
        $(".listingloadmore").attr('data-path', newurl)
        $('#loader').hide();

        var tmpProductCnt = parseInt($("ul.cat-list>li:not(.pitchboxli)").size());
        if ((tmpProductCnt % 48) == 0 && tmpProductCnt != 1) {
            $(".listingloadmore").show();
        } else {
            $(window).bind('scroll', bindScroll);
        }
    } else {
        $(".listingloadmore").hide();
    }
}

//PreLoad page if any
var preloadpage = function() {
    var cURL = $.address.value();
    var totPages = parseInt($('#totPages').val());

    if (cURL.indexOf('/page-') > 0) {
        var pageNum = cURL.match(/page-([0-9]+)/)[1];
        pageNum = parseInt(pageNum) - 1;
        var tmpPageNum = pageNum + 2;

        if (totPages > pageNum) {
            /*for(var z = pageNum; z >= 1; z--) {

                var regEx = /\/page-(\d*)/;
                var newurl = cURL.replace(regEx, '/page-'+z);
                if(z==1){
                   newurl = cURL.replace('/page-'+(pageNum+1),'');
                }
                ajaxPreListLoad(newurl,'lazypreload','before');
             }*/
            $('#currentPage').val(tmpPageNum);
            $('#currentURL').val(cURL);
            var regMEx = /\/page-(\d*)/;
            $(".listingloadmore").attr('data-path', cURL.replace(regMEx, '/page-' + tmpPageNum));
        }
    }
}

var ajaxPreListLoad = function(tmp1, tmp2, tmp3) {
    $.ajax({
        type: 'POST',
        dataType: 'json',
        url: '/ajax/eshop/lazylisting',
        data: { type: tmp2, url: tmp1 }
    }).done(function(data) {

        if (data.success) {
            //Listing
            if (tmp3 == "before") {
                $(".cat-list").prepend(data.aaData['itemListing']);
            }
        }

        setfavorites();
        initEshop();
        setaigps();
        itemPerPage();
        $.getScript("https://cdn-localassets.gabrielny.com/javascript/newtheme-ui/common_new.js?v=" + site_js_b2cjsversion);

        setpitchboxes();
        trackPitchBoxesGAEvents();

    });
}

var mobselectedfiltercnt = function() {
    var selectedFilterCnt = $(".reseat-icon").attr('data-cnt');
    $(".clearall").hide();
    $('.filter-btn-m').find('span').remove();
    if (selectedFilterCnt > 0) {
        $(".clearall").show();
        $('.filter-btn-m').append(' <span>' + selectedFilterCnt + '</span>');
    } else {
        $('.filter-btn-m').append('');
    }
}

var setGetWindowHistory = function() {

    $(document.body).off('click', '.mainimage').on('click', '.mainimage', function(e) {
        if (window.history && window.history.pushState) {
            window.history.pushState('forward', null, $("#currentURL").val() + '#' + $(this).attr('data-id'));
        }
    });

    if ($.address.hash() != "") {
        var previouSKU = $.address.hash();
        var tmpCURL = window.location.href.split('#')[0];
        $("#currentURL").val(tmpCURL);
        //$('#product'+previouSKU).focus();

        var body = $("html, body");
        body.stop().animate({
            scrollTop: $('#product' + previouSKU).offset().top
        }, 2000);
        $.address.value(tmpCURL);
    }

}

var xhr;
var activeajax = false;

$(document).ready(function() {

    pagination();

    bredcrumb();

    sortoption();

    parseurlcheck();

    $('.product-filter .filter-box .filter-box-content .advance-product-filter li').on('click', selectProductSubFilter);
    $('.mobselectedfilter li.advance-product-filter').on('click', selectProductSubFilter);

    $('.product-filter .filter-box .filter-box-content .advance-sub-filter li').on('click', defaultProductSubFilter);
    $('.mobselectedfilter li.advance-sub-filter').on('click', defaultProductSubFilter);

    changeimageover();

    setfavorites();

    setaigps();

    googlegtmtrack();

    loadMore();

    mobselectedfiltercnt();

    topfilteroption();

    // setGetWindowHistory();

    // preloadpage();

    lazyloadPartialSection();
});

function ajaxListLoad(path2, type2, replacetype2, tracktype2, ltfiltersel2, trackingVal2) {

    if (activeajax) { console.log("killing active");
        xhr.abort(); }

    activeajax = true;
    xhr = $.ajax({
        type: 'POST',
        dataType: 'json',
        url: '/ajax/eshop/lazylisting',
        data: { type: type2, replacetype: replacetype2, url: path2, ltfilter: ltfiltersel2 }
    }).done(function(data) {
        $("#loader").hide();
        if (data.success) {
            //Load Main Filter if logged in
            if (data.aaData['isLogin'] && data.aaData['filterOptions'] != '') {
                $(".list-filter").html(data.aaData['filterOptions']);

                //$('.product-filter .filter-box .filter-box-content .advance-product-filter li').off('click',selectProductSubFilter).on('click',selectProductSubFilter);
                //$('.product-filter .filter-box .filter-box-content .advance-sub-filter li').off('click',defaultProductSubFilter).on('click',defaultProductSubFilter);

                $(document.body).off('click', '.product-filter .filter-box .filter-box-content .advance-product-filter li').on('click', '.product-filter .filter-box .filter-box-content .advance-product-filter li', selectProductSubFilter);
                $(document.body).off('click', '.product-filter .filter-box .filter-box-content .advance-sub-filter li').on('click', '.product-filter .filter-box .filter-box-content .advance-sub-filter li', defaultProductSubFilter);
                topfilteroption();
            }

            $(".noresultLIS").remove();

            if (data.aaData['selectedFilter'] != "") {
                //Selected Filters
                $('div.mobselectedfilter .filter-select-op').html(data.aaData['selectedFilter']);
            }


            //Update URL
            if (data.aaData['url'] != '' && data.aaData['url'] != null) {
                var tmpurl1 = handleUTMQueryString(data.aaData['url']);
                $.address.value(tmpurl1);
            } else {
                //$.address.value($("#currentURL").val());
                var tmpurl = $("#currentURL").val()
                if (type2 == 'lazypaging') {
                    if ('' != '' && '' != '{' + 'pathalias' + '}' && ''.toLowerCase() != '/engagement-rings/category-er') {
                        tmppath1 = '';
                        tmppath1 = tmppath1.toLowerCase();
                        tmpwinloc = window.location.pathname;
                        if (tmpwinloc && tmpwinloc.indexOf('/page-') > 0) {
                            pageNu = tmpwinloc.match(/\/page-(\d*)/)[1];
                            tmpwinloc = tmpwinloc.replace('/page-' + pageNu, '');
                        }
                        tmpurl = tmpurl.replace(tmppath1, tmpwinloc);
                        tmpurl = tmpurl.replace('//', '/');

                        // Remove duplicates
                        var tmppathArray = tmpurl.split('/');
                        var tmpuniqueItems = [...new Set(tmppathArray)];
                        tmpurl = tmpuniqueItems.join("/")
                    }
                }

                //console.log("SS:"+tmpurl);
                tmpurl = handleUTMQueryString(tmpurl);
                $.address.value(tmpurl);
            }

            //BreadCrumb
            if (data.aaData['breadcrumbs'] != '' && data.aaData['breadcrumbs'] != null) {
                $("#page_breadcrumbs ul").html(data.aaData['breadcrumbs']);
            }

            //Metadata, top text, bottom text
            if (type2 == 'lazyfilter' || type2 == 'lazybreadcrumb') {
                document.title = data.aaData['meta']['pageMetaTitle'];
                $('meta[name=Description]').attr('content', data.aaData['meta']['pageMetaDescription']);
                $('meta[name=keywords]').attr('content', data.aaData['meta']['pageMetaKeyWords']);
                $('link[rel=canonical]').attr('href', data.aaData['meta']['pageCanonicalURL']);
                $('#pageBannerTopText').html(data.aaData['meta']['pageBannerTopText']);
                $('#pageBannerBottomText2').html(data.aaData['meta']['pageBannerBottomText2']);
                $('#pageBlogContent').html(data.aaData['meta']['pageBlogContent']);
                $('#pagePopularSearchFaqContent').html(data.aaData['meta']['pagePopularSearchFaqContent']);
                if ($('#intersting_section').length) {
                    $('#intersting_section').owlCarousel({
                        loop: false,
                        navRewind: !1,
                        margin: 10,
                        responsiveClass: false,
                        dots: true,
                        nav: false,
                        responsive: { 0: { items: 1, margin: 0, }, 768: { items: 2, margin: 23, }, 992: { items: 3, margin: 47, } }
                    });
                }
                if (document.body.clientWidth > 991) {
                    $('.bottomtxtd h2').css("font-size", "20px");
                } else {
                    $('.bottomtxtd h2').css("font-size", "18px");
                }
                $('.owl-dots').css("bottom", "0px!important");
                $('.bottomtxtd h2').css("font-weight", "400");
                $('.bottomtxtd h2').css("font-family", "poppins");
            }

            //Listing
            if (data.aaData['itemListing'] != '' && data.aaData['itemListing'] != null) {

                if (replacetype2 == "After") {
                    $(".cat-list").append(data.aaData['itemListing']);
                } else if (replacetype2 == "replace") {
                    $(".cat-list").html(data.aaData['itemListing']);
                    /*pitchboxes_json = $.parseJSON(data.aaData['pitchboxes_json']);
                          pitchboxes_cntadded = 0;
						  pitchboxes_addedkeys = [];
						  pitchboxes = {};
                          if(pitchboxes_json != '' && pitchboxes_json != undefined){
							  $.each(pitchboxes_json, function(key, value) {
								pitchboxes[key] = value;
							  });
						  }*/
                } else if (replacetype2 == "before") {
                    $(".cat-list").prepend(data.aaData['itemListing']);
                }

            }

            //Pagination
            if (data.aaData['pagination'] != '' && data.aaData['pagination'] != null) {
                $("#paginationresult").html(data.aaData['pagination']);
            }

            //Pageoption
            if (data.aaData['pageoption'] != '' && data.aaData['pageoption'] != null) {
                $(".filter_short_by").html(data.aaData['pageoption']);
            }

            //No Result Message
            if (data.aaData['noresultmsg'] != '' && data.aaData['noresultmsg'] != null) {
                $(".cat-list").before(data.aaData['noresultmsg']);
            }

            //Total Pages
            if (data.aaData['totPages'] != '' && data.aaData['totPages'] != null) {
                $("#totPages").val(data.aaData['totPages']);
            }

            if (type2 == "lazybreadcrumb" && data.aaData['raw_url'] != '' && data.aaData['raw_url'] != undefined) {
                $("#currentURL").val(data.aaData['raw_url']);
            }

            activeajax = false;
        }
        //$(".cat-list").css('opacity', '1');
        $(".filter-bottom-m").css('opacity', '1');
        $('#loader').hide();
        //$(".listingloadmore").fadeOut();
        $(".loadingmoreitem").fadeOut();

        $(window).unbind('scroll');
        $('body').on('scroll mousewheel touchmove');

        loadMore();
        pagination();

        bredcrumb();

        sortoption();

        parseurlcheck();

        changeimageover();

        setfavorites();
        initEshop();

        setaigps();
        itemPerPage();

        $.getScript("https://cdn-localassets.gabrielny.com/javascript/newtheme-ui/common_new.js?v=" + site_js_b2cjsversion);

        googlegtmtrack();

        //saveItemListingImpression();

        mobselectedfiltercnt();

        lazyloadPartialSection();

        // setGetWindowHistory();

        //Close Drop Down
        $("div.fdrpdwn-box-content").hide();
        $("div.fdrpdwn-box-hd").removeClass("act");
        /*==============Start Sticky Header ===============*/
        if (typeof w === 'undefined') {
            var w = document.body.clientWidth;
        }
        if (w > 991) {
            $(window).scroll(b2csticky_header);
            b2csticky_header();
        }
        /*==============End Sticky Header ===============*/

        $.getScript("https://cdn-localassets.gabrielny.com/javascript/jQuery/lazysizes.min.js");

        setpitchboxes();
        trackPitchBoxesGAEvents();

        if (isMobileView()) {
            columnConform('.product', '.product_show');
            columnConformPitchbox('ul.cat-list li.pitchboxli', 'ul.cat-list li.lazy');
        } else {
            columnConform('.cat-list>li:not(.pitchboxli)', '.product_show');
        }


        if (tracktype2 == "add") {
            $("#selectionfiltertrack").val(trackingVal2);
            trackSelectedFiltersGAEvents();
        }


    });
}

function isMobileView() {
    if (sw > 768) {
        return false;
    } else {
        return true;
    }
}

function goto(path1, type, replacetype, tracktype = '', ltfiltersel = '', trackingVal = '') {
    if (path1 != "") {
        $("#currentURL").val(path1);
    }
    //Close Sort Filter bar For mobile when select any filter
    if ($(".morefiltersidenav").hasClass('sortm')) {
        $('.morecloseWindow').trigger('click');
    }

    //Close deskop side filter when select any value
    if ($(".morefiltersidenav").hasClass('sideNavDesFilter')) {
        $('.morecloseWindow').trigger('click');
    }

    //Close deskop side filter when select any value
    if ($(".morefiltersidenav").hasClass('sideNavMobFilter')) {
        return false;
    }

    if (path1 != "") {

        $("#currentURL").val(path1);
        if (type == 'lazypaging') {
            $("#loader").hide();
        } else {
            $("#loader").show();
        }
        $(".filter-bottom-m").css('opacity', '0.1');
        //$(".cat-list").css('opacity', '0.1');
        ajaxListLoad(path1, type, replacetype, tracktype, ltfiltersel, trackingVal);
        //window.location.href=path1;
    }
}

function getSmallAttInitialPath(path) {
    var attributes = { '/Division-': ['/division-'], '/Category-': ['/category-'], '/Style-': ['/style-'], '/Metal-': ['/metal-'], '/Collection-': ['/collection-'], '/Price-': ['/price-'], '/StoneColorQuality-': ['/stonecolorquality-'], '/StoneHeadshape-': ['/stoneheadshape-'], '/CenterStoneCarWeight-': ['/centerstonecarweight-'], '/FashionGem-': ['/fashiongem-'], '/EngagementGem-': ['/engagementgem-'], '/BirthStone-': ['/birthstone-'], '/NecklaceLength-': ['/necklacelength-'], '/DiamondColor-': ['/diamondcolor-'] };
    $.each(attributes, function(k, v) {
        if (v != "") {
            path = path.replace(k, v);
        }
    });
    return path;
}

function getActualPath() {
    var path = document.location.pathname;
    path = getSmallAttInitialPath(path);

    if (path == "") path += "/engagement-rings";
    else if (path == "/") path += "engagement-rings";
    else {
        var re = /\/page-(\d*)/;
        path = path.replace(re, '/page-1');
    }

    //if(usealias != 'usealias')
    //{
    if ('' != '' && '' != '{' + 'pathalias' + '}') {
        path = '';
    }
    //}

    var currentURL = $("#currentURL").val();
    if (currentURL == "" || currentURL == undefined) {
        $("#currentURL").val(path.toLowerCase());
    } else {
        path = $("#currentURL").val();
    }

    var re = /\/page-(\d*)/;
    path = path.replace(re, '/page-1');
    return path;
}

function lowerCaseStr(str) {
    return str.toLowerCase();
}

function toTitleCase(str) {
    return str.replace(/\w\S*/g, function(txt) { return txt.charAt(0).toUpperCase() + txt.substr(1).toLowerCase(); });
}

function selectProductSubFilter(e) {
    e.preventDefault();
    e.stopPropagation();
    var that = $(this);
    var aChild = that.children('a');
    if (!aChild.hasClass('stackplay')) {
        var context = decodeURIComponent(getActualPath());
        context = context.toLowerCase();
        var context1 = context.toLowerCase();
        var navigationstyCls = that.hasClass('navselectedfilter');
        var prdclassName = aChild.attr('data-class');
        var lastFilterSel = aChild.attr('data-fieldname');
        var trackingVal = aChild.attr('data-track');

        if (aChild.hasClass('disableFilter')) {
            return false;
        }

        var path = aChild.data('path');
        //var mainFilter = $('.product-filter .filter-box .filter-box-hd');
        var mainFilter = $('.product-filter .filter-box');

        if (path.indexOf('metal-') >= 0) {
            return false;
        }

        var categoryPath = mainFilter.data('path').replace('/', '');
        var categoryPath1 = mainFilter.data('path');
        var category = "category";
        var div = mainFilter.data('division');

        if (aChild.hasClass('active')) {

            var rep1;

            if (context.indexOf('style') > 0) {
                var rep = path;
                path = path.replace('/', '');
            }
            if (pathAttr['style'].path == path ||
                '/' + pathAttr['style'].path == path) {} else {
                rep = path.replace('advanced-false', '');
                rep = rep.replace('advanced-true', '');
                rep = rep.replace('style-', '');
                rep1 = rep.replace(' ', '_');
            }
            //context = context.replace(' ','_');
            if (context.indexOf('advanced-') > 0) {
                context = context.replace('/advanced-false', '');
                context = context.replace('/advanced-true', '');
            }

            //alert("context:"+context+":rep:"+rep+":rep1:"+rep1+":pathAttr");
            /*context = context.replace(rep.toLowerCase(), '');
            context = context.replace(rep.toUpperCase(), '');
            context = context.replace(toTitleCase(rep), '');
            context = context.replace(rep, '');
            context = context.replace(rep1, '');
            context = context.replace("-/","/");*/

            context = context.replace(new RegExp("\\b" + rep.toLowerCase() + "\\b"), '');
            context = context.replace(new RegExp("\\b" + rep.toUpperCase() + "\\b"), '');
            context = context.replace(new RegExp("\\b" + toTitleCase(rep) + "\\b"), '');
            context = context.replace(new RegExp("\\b" + rep + "\\b"), '');
            context = context.replace(new RegExp("\\b" + rep1 + "\\b"), '');
            context = context.replace("-/", "/");

            if (rep.toLowerCase() == "fashion" && (pathAttr['category'].path == "category-lr" || pathAttr['category'].path == "category-LR")) {
                context = context.replace("products/", "products-fashion/");
            }
            //alert("Before:"+context);

            var tmp_style = 'style-';

            //alert("Before1:"+context.length+":context"+context);

            if (context.substring(context.length, context.length - tmp_style.length) === 'style-') {
                context = context.replace('/style-', '');
            }

            //alert("After:"+context);

            if (context.indexOf('/style/') > 0 || context.indexOf('/style-/') > 0 || context.indexOf('/style-_/') > 0) {
                context = context.replace('/style', '');
                context = context.replace('/style-', '');
                context = context.replace('/style-_', '');
            }

            context = context.replace('--', '-');
            if (context.substr(-1, 1) == '-') context = context.substr(0, context.length - 1);

            if (context1.indexOf('/advanced-false') > 0) {
                context = context.replace('/advanced-false', '').replace('/advanced-false', '').replace('/advanced-false', '');

                var found_var = 0;
                $.each(pathAttr, function(k, v) {
                    if (context.indexOf('/' + k) > 0 && k != "advanced") {
                        found_var = 1;
                    }
                });
                if (found_var == 1) {
                    context += '/advanced-false';
                }
            }

            if (context1.indexOf('/advanced-true') > 0) {
                context = context.replace('/advanced-true', '').replace('/advanced-true', '').replace('/advanced-true', '');

                var found_var = 0;
                $.each(pathAttr, function(k, v) {
                    if (context.indexOf('/' + k) > 0 && k != "advanced") {
                        found_var = 1;
                    }
                });
                if (found_var == 1) {
                    context += '/advanced-true';
                }
            }
            if (context.indexOf('/advanced-true') < 0) {
                var found_var1 = 0;
                $.each(pathAttr, function(k, v) {
                    if (context.indexOf('/' + k) > 0 && k != "advanced" && k != "products" && k != "category") {
                        found_var1 = 1;
                    }
                });
                if (found_var1 == 1) {
                    context += '/advanced-true';
                }
            }
            //OLD CODE if(context.indexOf('/advanced-false') > 0 && context.indexOf('/advanced-true') > 0) {
            if (context.indexOf('/advanced-false') > 0) {
                context = context.replace('/advanced-false', '').replace('/advanced-false', '').replace('/advanced-false', '');
                //OLD CODE context = context.replace('/advanced-true','').replace('/advanced-true','').replace('/advanced-true','');
                //OLD CODE context+= '/advanced-false';
            }
            if (prdclassName != "" && prdclassName != null) {
                $("." + prdclassName).removeClass('active');
                $("." + prdclassName).find('img').attr("src", $("." + prdclassName).find('img').attr("data-imgorg"));
                $(".mobselectedfilter ." + prdclassName).remove();
            }
            goto(context, "lazyfilter", "replace", "remove", lastFilterSel, trackingVal);

        } else {
            var multiSelection = true; //false;
            var isSameDiv = true;
            if (div) {
                if (context.indexOf('division') > 0) {
                    if (context.indexOf(div) < 0) {
                        var re = pathAttr['division'].path;
                        context = context.replace(re, div);
                        isSameDiv = false;
                    }
                } else {
                    context += '/' + div;
                }
            }

            if (context.indexOf(category) > 0 || context.indexOf('Category') > 0) {

                if (context.indexOf(categoryPath) < 0) {
                    var re = pathAttr['category'].path;
                    var tmpContext = context.split('/');
                    var tmpCatPath = categoryPath1.split('/');

                    context = context.replace(re, categoryPath1);

                    if (tmpContext[1] == tmpCatPath[0]) {
                        context = context.replace("/" + tmpContext[1], '');
                    }
                } else if (isSameDiv && (!div || (div && context.indexOf(div) > 0))) {
                    multiSelection = true;
                }
            } else {
                if (context.indexOf(categoryPath1) > 0) {} else {
                    context += '/' + categoryPath1;
                }
            }

            var styleTmp = new RegExp("\\bstyle\\b");
            var styleTmp1 = new RegExp("\\bStyle\\b");

            //if (context.indexOf('style') > 0 || context.indexOf('Style') > 0) {
            if (context.match(styleTmp) || context.match(styleTmp1)) {
                var attSty = pathAttr['style'].path;

                if (context.indexOf('-All') > 0 || path.indexOf('-All') > 0) {
                    multiSelection = false;
                }

                if (multiSelection) {
                    attSty = attSty.toLowerCase();
                    //path = path.replace('attStyle', attSty);
                    path = path.replace('style', attSty);
                    context = context.replace('/' + attSty, '/' + path);

                } else if (context.indexOf(path) < 0) {
                    context = context.replace('/' + attSty, path);
                }
            } else {
                context += '/' + path;
            }

            if (context.indexOf('/advanced-false') > 0) {
                context = context.replace('/advanced-false', '').replace('/advanced-false', '').replace('/advanced-false', '');

                var found_var = 0;
                $.each(pathAttr, function(k, v) {
                    if (context.indexOf('/' + k) > 0 && k != "advanced") {
                        found_var = 1;
                    }
                });
                if (found_var == 1) {
                    context += '/advanced-false';
                }
            }

            if (context.indexOf('/advanced-true') > 0) {
                context = context.replace('/advanced-true', '').replace('/advanced-true', '').replace('/advanced-true', '');

                var found_var = 0;
                $.each(pathAttr, function(k, v) {
                    if (context.indexOf('/' + k) > 0 && k != "advanced") {
                        found_var = 1;
                    }
                });
                if (found_var == 1) {
                    context += '/advanced-true';
                }
            }
            if (context.indexOf('/advanced-true') < 0) {
                var found_var2 = 0;
                $.each(pathAttr, function(k, v) {
                    if (context.indexOf('/' + k) > 0 && k != "advanced" && k != "products" && k != "category") {
                        found_var2 = 1;
                    }
                });
                if (found_var2 == 1) {
                    context += '/advanced-true';
                }
            }
            //OLD CODE if(context.indexOf('/advanced-false') > 0 && context.indexOf('/advanced-true') > 0) {
            if (context.indexOf('/advanced-false') > 0) {
                context = context.replace('/advanced-false', '').replace('/advanced-false', '').replace('/advanced-false', '');
                //OLD CODE context = context.replace('/advanced-true','').replace('/advanced-true','').replace('/advanced-true','');
                //OLD CODE context+= '/advanced-false';
            }
            $("." + prdclassName).addClass('active');
            goto(context, "lazyfilter", "replace", "add", lastFilterSel, trackingVal);

        }
    } else {
        var path = aChild.data('path');
        $('#loader').show();
        $.redirect(path);
    }
}

function defaultProductSubFilter(e) {

    e.preventDefault();
    e.stopPropagation();
    var that = $(this);
    var aChild = that.children('a');

    if (aChild.hasClass('disableFilter')) {
        return false;
    }

    var context = decodeURIComponent(getActualPath());
    context = context.toLowerCase();
    var path = aChild.data('path');
    var parent = that.parents().closest('li.sub-filter');
    var navigationCls = that.hasClass('navselectedfilter');
    var className = aChild.attr('data-class');
    var lastFilterSele = aChild.attr('data-fieldname');
    var trackingVal = aChild.attr('data-track');

    var trackFitler = '';

    var path1 = path.split('/');

    if (path1[0] != "") {
        var filterexplode = path1[0].split('-');

        var flitervar = (filterexplode[0] != '' ? filterexplode[0] : '');
        var filtervals = '';

        for (var n = 1; n < filterexplode.length; n++) {
            filtervals += "-" + filterexplode[n];
        }
    }
    if (path1[1] != "" && typeof(path1[1]) !== undefined && context.indexOf('/advanced-') <= 0) {
        var filterexplode1 = path1[1].split('-');
        var flitervar1 = (filterexplode1[0] != '' ? filterexplode1[0] : '');
        var filtervals1 = '';

        for (var m = 1; m < filterexplode1.length; m++) {
            filtervals1 += "-" + filterexplode1[m];
        }
    } else {
        var filterexplode1 = {};
    }



    if (aChild.hasClass('active')) {


        if (context.indexOf(filtervals) > 0) {
            context = context.replace(filtervals, '');

            if (context.indexOf('metal') > 0) {
                context = context.replace(filtervals, '');
            }
        }
        if (context.indexOf(filtervals1) > 0) {
            context = context.replace(filtervals1, '');
        }

        var frmtedURL = context.split('/');

        var check_other_val = 0;
        for (var k = 1; k < frmtedURL.length; k++) {
            if (filterexplode[0] == frmtedURL[k]) {
                var checkval = frmtedURL[k].split('-');
                if (typeof(checkval[1]) == "undefined" || checkval[1] == "") {
                    check_other_val = 1;
                }
            }
        }

        if (check_other_val == 1) {


            if (context.indexOf('metal') > 0) {
                context = context.replace("/centerstoneseries", '');
            }
            context = context.replace("/" + filterexplode[0], '');
            if (typeof(filterexplode1[0]) !== undefined) {
                context = context.replace("/" + filterexplode1[0], '');
            }
        }
        aChild.removeClass('active');


        if (className != "") {
            $("." + className).removeClass('active');
            //$('.'+className+' .image-container').attr("src",$('.'+className+' .image-container').attr("data-imgorg"));
            $(".mobselectedfilter ." + className).remove();
        }

        trackFitler = "remove";
    } else {


        if (context.indexOf(filterexplode[0]) > 0) {
            if (checkAttribute(filterexplode[0], filtervals, context)) {} else {

                context = context.replace(filterexplode[0], filterexplode[0] + filtervals);


                if (context.indexOf('metal') > 0) {
                    context = context.replace('centerstoneseries', 'centerstoneseries' + filtervals);
                }
                /*
                 if(path1[1]!="" && typeof(path1[1])!==undefined){
                 context = context.replace(filterexplode1[0], filterexplode1[0]+ filtervals1);
                 }
                 */
            }
        } else {
            context += '/' + path;
        }
        aChild.addClass('active');

        if (className != "") {
            $("." + className).addClass('active');
            //$('.'+className+' .image-container').attr("src",$('.'+className+' .image-container').attr("data-imgsel"));

        }
        trackFitler = "add";
    }


    if (context.indexOf('/advanced-false') > 0) {
        context = context.replace('/advanced-false', '').replace('/advanced-false', '').replace('/advanced-false', '');
        var found_var = 0;
        $.each(pathAttr, function(k, v) {
            if (context.indexOf('/' + k) > 0 && k != "advanced") {
                found_var = 1;
            }
        });
        if (found_var == 1) {
            context += '/advanced-false';
        }
    }
    if (context.indexOf('/advanced-true') > 0) {
        context = context.replace('/advanced-true', '').replace('/advanced-true', '').replace('/advanced-true', '');
        var found_var = 0;

        $.each(pathAttr, function(k, v) {
            if (context.indexOf('/' + k) > 0 && k != "advanced") {
                found_var = 1;
            }
        });
        if (found_var == 1) {
            context += '/advanced-true';
        }
    }

    if (context.indexOf('/advanced-true') < 0) {
        var found_var1 = 0;
        $.each(pathAttr, function(k, v) {
            if (context.indexOf('/' + k) > 0 && k != "advanced" && k != "products" && k != "category") {
                found_var1 = 1;
            }
        });
        if (found_var1 == 1) {
            context += '/advanced-true';
        }
    }
    //OLD CODE if(context.indexOf('/advanced-false') > 0 && context.indexOf('/advanced-true') > 0) {
    if (context.indexOf('/advanced-false') > 0) {
        context = context.replace('/advanced-false', '').replace('/advanced-false', '').replace('/advanced-false', '');
        //OLD CODE context = context.replace('/advanced-true','').replace('/advanced-true','').replace('/advanced-true','');
        //OLD CODE context+= '/advanced-false';
    }
    goto(context, "lazyfilter", "replace", trackFitler, lastFilterSele, trackingVal);
}

function checkAttribute(attr, attrVal, path) {
    var context = decodeURI((!path) ? getActualPath() : path);
    return (context.indexOf(attr) > 0) && (context.indexOf(attrVal) > 0)
}

var currencyRate = parseFloat('1.0000000000');
var currencySymbol = '$ ';
var currencyMarkup = parseFloat('1.00000');


//More Filter Option
$(document).ready(function() {

    $(document.body).off('click', '.filter-btn-m').on('click', '.filter-btn-m', function(e) {
        $(".filter-bottom-m").show();
        $(".morefiltersidenav").addClass("sideNavMob");
        $(".morefiltersidenav").addClass("sideNavMobFilter");
        $(".sidenavbg").show();
    });

    $(document.body).off('click', '.more-filter').on('click', '.more-filter', function(e) {
        $(".filter-bottom-m").show();
        $(".morefiltersidenav").addClass("sideNavMob");
        $(".morefiltersidenav").addClass("sideNavDesFilter");
        $(".sidenavbg").show();
    });

    $(document.body).off('click', '.morecloseWindow,.close-m').on('click', '.morecloseWindow,.close-m', function(e) {
        $(".sidenavbg").hide();
        $(".morefiltersidenav").removeClass("sideNavMob");
        $(".morefiltersidenav").removeClass("sortm");
        $(".morefiltersidenav").removeClass("sideNavDesFilter");
        $(".morefiltersidenav").removeClass("sideNavMobFilter");
    });


    $(document.body).off('click', '.sort-btn-m').on('click', '.sort-btn-m', function(e) {
        $(".morefiltersidenav").addClass("sideNavMob");
        $(".sidenavbg").show();
        $("#sideMoreFilter").addClass("sortm");
    });
    $(document.body).off('click', '.filter-r-btn').on('click', '.filter-r-btn', function(e) {
        $(".close-m").trigger("click");
        $(".filter-bottom-m").css('opacity', '0.1');
        goto($("#currentURL").val(), 'lazyfilter', 'replace');

    });

});

//Pitchbox read more
$(document).ready(function() {
    $(document.body).off('click', '.pitchbox_readmore_acc').on('click', '.pitchbox_readmore_acc', function(e) {
        const moreText = "Read more";
        const lessText = "Read less";
        const moreButton = $(".pitchbox_readmore_acc");


        const $this = $(this);
        $this.html($.trim($this.text()) == moreText ? lessText + '<svg class="svg-down-arrow" style="vertical-align:sub; margin-left:5px;" width="16px" height="16px" aria-hidden="true" role="img"><use href="#svg-down-arrow" xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="#svg-down-arrow"></use></svg>' : moreText + '<svg class="svg-down-arrow" style="vertical-align:sub; margin-left:5px;" width="16px" height="16px" aria-hidden="true" role="img"><use href="#svg-down-arrow" xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="#svg-down-arrow"></use></svg>');
        if ($this.text() == moreText) {
            $('.pitchbox_dots').show();
            $(".pitchbox_readmore_acc").removeClass('pitcact');
        } else {
            $(".pitchbox_readmore_acc").addClass('pitcact');
            $('.pitchbox_dots').hide();
        }
        $('.pitchbox_readmore_more_txt').slideToggle({
            duration: 400,
            complete: function() {
                if ($(this).css('display') == 'block' || $(this).css('display') == 'inline-block') {
                    $(this).css('display', 'inline');
                }
            }
        });
    });
});

// Pitch Boxes GA Events start
function trackPitchBoxesGAEvents() {
    $('.pitchboxli:not(.ptcbxgatrakced):visible').each(function() {
        var title = $(this).find('h4').html();
        if (title == '' || title == undefined) {
            title = $(this).find('p').html();
        }
        if ($(this).hasClass('pitchboxvideo')) {
            title = $(this).attr('data-title');
            if (title == '' || title == undefined) {
                title = $(this).attr('data-description');
            }
        }
        if ($(this).hasClass('pitchboxwithtext')) {
            title = $(this).attr('data-title');
            if (title == '' || title == undefined) {
                title = $(this).attr('data-description');
            }
        }
        if (title != '' && title != undefined) {
            title = title.replace("&amp;", "&");
            trackGAEvents('PitchBoxesEvent', 'Pitch Boxes', 'Impressions', title);
        }
        $(this).find('a').on('click', function(event) {
            var title = $(this).closest('.pitchboxli').find('h4').html();
            if (title == '' || title == undefined) {
                title = $(this).closest('.pitchboxli').find('p').html();
            }
            if ($(this).closest('.pitchboxli').hasClass('pitchboxvideo')) {
                title = $(this).closest('.pitchboxli').attr('data-title');
                if (title == '' || title == undefined) {
                    title = $(this).closest('.pitchboxli').attr('data-description');
                }
            }
            if ($(this).closest('.pitchboxli').hasClass('pitchboxwithtext')) {
                title = $(this).closest('.pitchboxli').attr('data-title');
                if (title == '' || title == undefined) {
                    title = $(this).closest('.pitchboxli').attr('data-description');
                }
            }
            title = title.replace("&amp;", "&");
            var href = $(this).attr('href');
            if (title != '' && title != undefined) {
                event.preventDefault();
                event.stopPropagation();
                trackGAEvents('PitchBoxesEvent', 'Pitch Boxes', 'Clicks', title);
                window.location.href = href;
            }
        });

        $(this).addClass('ptcbxgatrakced');
    });
}
// Pitch Boxes GA Events end


$(window).load(function() {
    trackPitchBoxesGAEvents();
});

function trackSelectedFiltersGAEvents() {
    var trackVal = $("#selectionfiltertrack").val();
    if (trackVal != "") {
        var lastTrack = trackVal.split("@");

        //console.log(lastTrack);

        var evCat = lastTrack[0];
        var evAc = lastTrack[1];
        var evLa = lastTrack[2];

        if (evCat != "" && evAc != "" && evLa != "") {
            trackGAEvents('ProductFiltersEvent', evCat, evAc, evLa);
        }
    }
}

$(window).load(function() {
    trackSelectedFiltersGAEvents();
});




function storeLocatorAnniFormSub() {
    if ($('#anniZipForm #annifindStoreZip').val() == "") {
        alert("Please enter a valid zip/postal code");
        return false;
    }

    $('.listing-store-result-disp').html('');
    $('.listing-store-result-disp').html('<div class="pb20 tac myTableem3 seploading"><img data-src="' + $('#loading-image').attr('src') + '" alt="loading..." id="loading-image"></div>');
    $('.listing-store-result-disp').show();

    trackGeoLocFindStoreBookAppointmentEvents('Store Locator Requests', $('#pageURLCategory').val() + ' Listing Page', $('#anniZipForm #annifindStoreZip').val());

    xhr = $.ajax({
        type: 'POST',
        dataType: 'json',
        url: '/ajax/_global/listingstorelocator',
        data: { listingzip: $('#anniZipForm #annifindStoreZip').val(), pagename: $('#pageURLCategory').val() + ' Listing Page', pageurl: $('#pageURLLocator').val() }
    }).done(function(data) {

        if (data.success) {
            $('.listing-store-result-disp').html('');
            $('.listing-store-result-disp').html('<div class="listing-store-result owl-carousel">');
            $('.listing-store-result').append(data.aaData['stores_res']);
            $('.listing-store-result-disp').show();
            var owl = $(".listing-store-result");
            owl.owlCarousel({
                loop: false,
                navRewind: !1,
                margin: 0,
                responsiveClass: false,
                dots: false,
                nav: true,
                responsive: { 0: { items: 1 }, 600: { items: 2 }, 1000: { items: 3 } }
            });
        } else {
            $('.listing-store-result-disp').html('');
            $('.listing-store-result-disp').hide();
            alert(data.aaData['errorMsg']);
        }

    });
}

$(function() {
    $('#anniZipForm #btnannifindStoreSubmit').on('click', function(e) {
        e.preventDefault();
        e.stopPropagation();
        storeLocatorAnniFormSub();
    });
    $(document.body).on('keypress', '#anniZipForm #annifindStoreZip', function(event) {
        event.stopPropagation();
        if (event.which == 13) {
            event.preventDefault();
            storeLocatorAnniFormSub();
        }
    });
});

function getRefQueryParam(name) {
    name = name.replace(/[\[]/, '\\[').replace(/[\]]/, '\\]');
    var regex = new RegExp('[\\?&]' + name + '=([^&#]*)');
    var results = regex.exec(location.search);
    return results === null ? '' : decodeURIComponent(results[1].replace(/\+/g, ' '));
};



function handleUTMQueryString(url) {
    var utmParamQueryString = '',
        utmParamQueryStringTrimmed = '',
        utm_source = '',
        utm_medium = '',
        utm_campaign = '',
        utm_term = '';
    utm_content = '',
        epik = '';

    utm_source = getRefQueryParam("utm_source");
    utm_medium = getRefQueryParam("utm_medium");
    utm_campaign = getRefQueryParam("utm_campaign");
    utm_term = getRefQueryParam("utm_term");
    utm_content = getRefQueryParam("utm_content");
    epik = getRefQueryParam("epik");

    if (utm_source) {
        utmParamQueryString += '&utm_source=' + utm_source;
    }
    if (utm_medium) {
        utmParamQueryString += '&utm_medium=' + utm_medium;
    }
    if (utm_campaign) {
        utmParamQueryString += '&utm_campaign=' + utm_campaign;
    }
    if (utm_term) {
        utmParamQueryString += '&utm_term=' + utm_term;
    }
    if (utm_content) {
        utmParamQueryString += '&utm_content=' + utm_content;
    }
    if (epik) {
        utmParamQueryString += '&epik=' + epik;
    }


    //console.log(utmParamQueryString+"=>"+url);
    // if there are utm values add them all up
    if (utmParamQueryString.length > 0) {
        utmParamQueryString = utmParamQueryString.substring(1);
        //utmParamQueryStringTrimmed = utmParamQueryString;
        //utmParamQueryString = '?' + utmParamQueryString;
    }

    var tmpUURL1 = url.indexOf("utm_source");
    //console.log("tmpUURL1:"+tmpUURL1+"URL:"+url);
    if (tmpUURL1 <= -1) {
        if (url.indexOf("?") > 0 && utmParamQueryString.length > 0) {
            url = url + '&' + utmParamQueryString;
        } else if (utmParamQueryString.length > 0) {
            url = url + '/?' + utmParamQueryString;
        }
    }
    //console.log("return:"+url);
    return url;
}</script>
<script data-file="www/owl.carousel.js">/**
 * Owl Carousel v2.3.4
 * Copyright 2013-2018 David Deutsch
 * Licensed under: SEE LICENSE IN https://github.com/OwlCarousel2/OwlCarousel2/blob/master/LICENSE
 */
! function(a, b, c, d) {
    function e(b, c) {
        this.settings = null, this.options = a.extend({}, e.Defaults, c), this.$element = a(b), this._handlers = {}, this._plugins = {}, this._supress = {}, this._current = null, this._speed = null, this._coordinates = [], this._breakpoint = null, this._width = null, this._items = [], this._clones = [], this._mergers = [], this._widths = [], this._invalidated = {}, this._pipe = [], this._drag = {
            time: null,
            target: null,
            pointer: null,
            stage: {
                start: null,
                current: null
            },
            direction: null
        }, this._states = {
            current: {},
            tags: {
                initializing: ["busy"],
                animating: ["busy"],
                dragging: ["interacting"]
            }
        }, a.each(["onResize", "onThrottledResize"], a.proxy(function(b, c) {
            this._handlers[c] = a.proxy(this[c], this)
        }, this)), a.each(e.Plugins, a.proxy(function(a, b) {
            this._plugins[a.charAt(0).toLowerCase() + a.slice(1)] = new b(this)
        }, this)), a.each(e.Workers, a.proxy(function(b, c) {
            this._pipe.push({
                filter: c.filter,
                run: a.proxy(c.run, this)
            })
        }, this)), this.setup(), this.initialize()
    }
    e.Defaults = {
        items: 3,
        loop: !1,
        center: !1,
        rewind: !1,
        checkVisibility: !0,
        mouseDrag: !0,
        touchDrag: !0,
        pullDrag: !0,
        freeDrag: !1,
        margin: 0,
        stagePadding: 0,
        merge: !1,
        mergeFit: !0,
        autoWidth: !1,
        startPosition: 0,
        rtl: !1,
        smartSpeed: 250,
        fluidSpeed: !1,
        dragEndSpeed: !1,
        responsive: {},
        responsiveRefreshRate: 200,
        responsiveBaseElement: b,
        fallbackEasing: "swing",
        slideTransition: "",
        info: !1,
        nestedItemSelector: !1,
        itemElement: "div",
        stageElement: "div",
        refreshClass: "owl-refresh",
        loadedClass: "owl-loaded",
        loadingClass: "owl-loading",
        rtlClass: "owl-rtl",
        responsiveClass: "owl-responsive",
        dragClass: "owl-drag",
        itemClass: "owl-item",
        stageClass: "owl-stage",
        stageOuterClass: "owl-stage-outer",
        grabClass: "owl-grab"
    }, e.Width = {
        Default: "default",
        Inner: "inner",
        Outer: "outer"
    }, e.Type = {
        Event: "event",
        State: "state"
    }, e.Plugins = {}, e.Workers = [{
        filter: ["width", "settings"],
        run: function() {
            this._width = this.$element.width()
        }
    }, {
        filter: ["width", "items", "settings"],
        run: function(a) {
            a.current = this._items && this._items[this.relative(this._current)]
        }
    }, {
        filter: ["items", "settings"],
        run: function() {
            this.$stage.children(".cloned").remove()
        }
    }, {
        filter: ["width", "items", "settings"],
        run: function(a) {
            var b = this.settings.margin || "",
                c = !this.settings.autoWidth,
                d = this.settings.rtl,
                e = {
                    width: "auto",
                    "margin-left": d ? b : "",
                    "margin-right": d ? "" : b
                };
            !c && this.$stage.children().css(e), a.css = e
        }
    }, {
        filter: ["width", "items", "settings"],
        run: function(a) {
            var b = (this.width() / this.settings.items).toFixed(3) - this.settings.margin,
                c = null,
                d = this._items.length,
                e = !this.settings.autoWidth,
                f = [];
            for (a.items = {
                    merge: !1,
                    width: b
                }; d--;) c = this._mergers[d], c = this.settings.mergeFit && Math.min(c, this.settings.items) || c, a.items.merge = c > 1 || a.items.merge, f[d] = e ? b * c : this._items[d].width();
            this._widths = f
        }
    }, {
        filter: ["items", "settings"],
        run: function() {
            var b = [],
                c = this._items,
                d = this.settings,
                e = Math.max(2 * d.items, 4),
                f = 2 * Math.ceil(c.length / 2),
                g = d.loop && c.length ? d.rewind ? e : Math.max(e, f) : 0,
                h = "",
                i = "";
            for (g /= 2; g > 0;) b.push(this.normalize(b.length / 2, !0)), h += c[b[b.length - 1]][0].outerHTML, b.push(this.normalize(c.length - 1 - (b.length - 1) / 2, !0)), i = c[b[b.length - 1]][0].outerHTML + i, g -= 1;
            this._clones = b, a(h).addClass("cloned").appendTo(this.$stage), a(i).addClass("cloned").prependTo(this.$stage)
        }
    }, {
        filter: ["width", "items", "settings"],
        run: function() {
            for (var a = this.settings.rtl ? 1 : -1, b = this._clones.length + this._items.length, c = -1, d = 0, e = 0, f = []; ++c < b;) d = f[c - 1] || 0, e = this._widths[this.relative(c)] + this.settings.margin, f.push(d + e * a);
            this._coordinates = f
        }
    }, {
        filter: ["width", "items", "settings"],
        run: function() {
            var a = this.settings.stagePadding,
                b = this._coordinates,
                c = {
                    width: Math.ceil(Math.abs(b[b.length - 1])) + 2 * a,
                    "padding-left": a || "",
                    "padding-right": a || ""
                };
            this.$stage.css(c)
        }
    }, {
        filter: ["width", "items", "settings"],
        run: function(a) {
            var b = this._coordinates.length,
                c = !this.settings.autoWidth,
                d = this.$stage.children();
            if (c && a.items.merge)
                for (; b--;) a.css.width = this._widths[this.relative(b)], d.eq(b).css(a.css);
            else c && (a.css.width = a.items.width, d.css(a.css))
        }
    }, {
        filter: ["items"],
        run: function() {
            this._coordinates.length < 1 && this.$stage.removeAttr("style")
        }
    }, {
        filter: ["width", "items", "settings"],
        run: function(a) {
            a.current = a.current ? this.$stage.children().index(a.current) : 0, a.current = Math.max(this.minimum(), Math.min(this.maximum(), a.current)), this.reset(a.current)
        }
    }, {
        filter: ["position"],
        run: function() {
            this.animate(this.coordinates(this._current))
        }
    }, {
        filter: ["width", "position", "items", "settings"],
        run: function() {
            var a, b, c, d, e = this.settings.rtl ? 1 : -1,
                f = 2 * this.settings.stagePadding,
                g = this.coordinates(this.current()) + f,
                h = g + this.width() * e,
                i = [];
            for (c = 0, d = this._coordinates.length; c < d; c++) a = this._coordinates[c - 1] || 0, b = Math.abs(this._coordinates[c]) + f * e, (this.op(a, "<=", g) && this.op(a, ">", h) || this.op(b, "<", g) && this.op(b, ">", h)) && i.push(c);
            this.$stage.children(".active").removeClass("active"), this.$stage.children(":eq(" + i.join("), :eq(") + ")").addClass("active"), this.$stage.children(".center").removeClass("center"), this.settings.center && this.$stage.children().eq(this.current()).addClass("center")
        }
    }], e.prototype.initializeStage = function() {
        this.$stage = this.$element.find("." + this.settings.stageClass), this.$stage.length || (this.$element.addClass(this.options.loadingClass), this.$stage = a("<" + this.settings.stageElement + ">", {
            class: this.settings.stageClass
        }).wrap(a("<div/>", {
            class: this.settings.stageOuterClass
        })), this.$element.append(this.$stage.parent()))
    }, e.prototype.initializeItems = function() {
        var b = this.$element.find(".owl-item");
        if (b.length) return this._items = b.get().map(function(b) {
            return a(b)
        }), this._mergers = this._items.map(function() {
            return 1
        }), void this.refresh();
        this.replace(this.$element.children().not(this.$stage.parent())), this.isVisible() ? this.refresh() : this.invalidate("width"), this.$element.removeClass(this.options.loadingClass).addClass(this.options.loadedClass)
    }, e.prototype.initialize = function() {
        if (this.enter("initializing"), this.trigger("initialize"), this.$element.toggleClass(this.settings.rtlClass, this.settings.rtl), this.settings.autoWidth && !this.is("pre-loading")) {
            var a, b, c;
            a = this.$element.find("img"), b = this.settings.nestedItemSelector ? "." + this.settings.nestedItemSelector : d, c = this.$element.children(b).width(), a.length && c <= 0 && this.preloadAutoWidthImages(a)
        }
        this.initializeStage(), this.initializeItems(), this.registerEventHandlers(), this.leave("initializing"), this.trigger("initialized")
    }, e.prototype.isVisible = function() {
        return !this.settings.checkVisibility || this.$element.is(":visible")
    }, e.prototype.setup = function() {
        var b = this.viewport(),
            c = this.options.responsive,
            d = -1,
            e = null;
        c ? (a.each(c, function(a) {
            a <= b && a > d && (d = Number(a))
        }), e = a.extend({}, this.options, c[d]), "function" == typeof e.stagePadding && (e.stagePadding = e.stagePadding()), delete e.responsive, e.responsiveClass && this.$element.attr("class", this.$element.attr("class").replace(new RegExp("(" + this.options.responsiveClass + "-)\\S+\\s", "g"), "$1" + d))) : e = a.extend({}, this.options), this.trigger("change", {
            property: {
                name: "settings",
                value: e
            }
        }), this._breakpoint = d, this.settings = e, this.invalidate("settings"), this.trigger("changed", {
            property: {
                name: "settings",
                value: this.settings
            }
        })
    }, e.prototype.optionsLogic = function() {
        this.settings.autoWidth && (this.settings.stagePadding = !1, this.settings.merge = !1)
    }, e.prototype.prepare = function(b) {
        var c = this.trigger("prepare", {
            content: b
        });
        return c.data || (c.data = a("<" + this.settings.itemElement + "/>").addClass(this.options.itemClass).append(b)), this.trigger("prepared", {
            content: c.data
        }), c.data
    }, e.prototype.update = function() {
        for (var b = 0, c = this._pipe.length, d = a.proxy(function(a) {
                return this[a]
            }, this._invalidated), e = {}; b < c;)(this._invalidated.all || a.grep(this._pipe[b].filter, d).length > 0) && this._pipe[b].run(e), b++;
        this._invalidated = {}, !this.is("valid") && this.enter("valid")
    }, e.prototype.width = function(a) {
        switch (a = a || e.Width.Default) {
            case e.Width.Inner:
            case e.Width.Outer:
                return this._width;
            default:
                return this._width - 2 * this.settings.stagePadding + this.settings.margin
        }
    }, e.prototype.refresh = function() {
        this.enter("refreshing"), this.trigger("refresh"), this.setup(), this.optionsLogic(), this.$element.addClass(this.options.refreshClass), this.update(), this.$element.removeClass(this.options.refreshClass), this.leave("refreshing"), this.trigger("refreshed")
    }, e.prototype.onThrottledResize = function() {
        b.clearTimeout(this.resizeTimer), this.resizeTimer = b.setTimeout(this._handlers.onResize, this.settings.responsiveRefreshRate)
    }, e.prototype.onResize = function() {
        return !!this._items.length && (this._width !== this.$element.width() && (!!this.isVisible() && (this.enter("resizing"), this.trigger("resize").isDefaultPrevented() ? (this.leave("resizing"), !1) : (this.invalidate("width"), this.refresh(), this.leave("resizing"), void this.trigger("resized")))))
    }, e.prototype.registerEventHandlers = function() {
        a.support.transition && this.$stage.on(a.support.transition.end + ".owl.core", a.proxy(this.onTransitionEnd, this)), !1 !== this.settings.responsive && this.on(b, "resize", this._handlers.onThrottledResize), this.settings.mouseDrag && (this.$element.addClass(this.options.dragClass), this.$stage.on("mousedown.owl.core", a.proxy(this.onDragStart, this)), this.$stage.on("dragstart.owl.core selectstart.owl.core", function() {
            return !1
        })), this.settings.touchDrag && (this.$stage.on("touchstart.owl.core", a.proxy(this.onDragStart, this)), this.$stage.on("touchcancel.owl.core", a.proxy(this.onDragEnd, this)))
    }, e.prototype.onDragStart = function(b) {
        var d = null;
        3 !== b.which && (a.support.transform ? (d = this.$stage.css("transform").replace(/.*\(|\)| /g, "").split(","), d = {
            x: d[16 === d.length ? 12 : 4],
            y: d[16 === d.length ? 13 : 5]
        }) : (d = this.$stage.position(), d = {
            x: this.settings.rtl ? d.left + this.$stage.width() - this.width() + this.settings.margin : d.left,
            y: d.top
        }), this.is("animating") && (a.support.transform ? this.animate(d.x) : this.$stage.stop(), this.invalidate("position")), this.$element.toggleClass(this.options.grabClass, "mousedown" === b.type), this.speed(0), this._drag.time = (new Date).getTime(), this._drag.target = a(b.target), this._drag.stage.start = d, this._drag.stage.current = d, this._drag.pointer = this.pointer(b), a(c).on("mouseup.owl.core touchend.owl.core", a.proxy(this.onDragEnd, this)), a(c).one("mousemove.owl.core touchmove.owl.core", a.proxy(function(b) {
            var d = this.difference(this._drag.pointer, this.pointer(b));
            a(c).on("mousemove.owl.core touchmove.owl.core", a.proxy(this.onDragMove, this)), Math.abs(d.x) < Math.abs(d.y) && this.is("valid") || (b.preventDefault(), this.enter("dragging"), this.trigger("drag"))
        }, this)))
    }, e.prototype.onDragMove = function(a) {
        var b = null,
            c = null,
            d = null,
            e = this.difference(this._drag.pointer, this.pointer(a)),
            f = this.difference(this._drag.stage.start, e);
        this.is("dragging") && (a.preventDefault(), this.settings.loop ? (b = this.coordinates(this.minimum()), c = this.coordinates(this.maximum() + 1) - b, f.x = ((f.x - b) % c + c) % c + b) : (b = this.settings.rtl ? this.coordinates(this.maximum()) : this.coordinates(this.minimum()), c = this.settings.rtl ? this.coordinates(this.minimum()) : this.coordinates(this.maximum()), d = this.settings.pullDrag ? -1 * e.x / 5 : 0, f.x = Math.max(Math.min(f.x, b + d), c + d)), this._drag.stage.current = f, this.animate(f.x))
    }, e.prototype.onDragEnd = function(b) {
        var d = this.difference(this._drag.pointer, this.pointer(b)),
            e = this._drag.stage.current,
            f = d.x > 0 ^ this.settings.rtl ? "left" : "right";
        a(c).off(".owl.core"), this.$element.removeClass(this.options.grabClass), (0 !== d.x && this.is("dragging") || !this.is("valid")) && (this.speed(this.settings.dragEndSpeed || this.settings.smartSpeed), this.current(this.closest(e.x, 0 !== d.x ? f : this._drag.direction)), this.invalidate("position"), this.update(), this._drag.direction = f, (Math.abs(d.x) > 3 || (new Date).getTime() - this._drag.time > 300) && this._drag.target.one("click.owl.core", function() {
            return !1
        })), this.is("dragging") && (this.leave("dragging"), this.trigger("dragged"))
    }, e.prototype.closest = function(b, c) {
        var e = -1,
            f = 30,
            g = this.width(),
            h = this.coordinates();
        return this.settings.freeDrag || a.each(h, a.proxy(function(a, i) {
            return "left" === c && b > i - f && b < i + f ? e = a : "right" === c && b > i - g - f && b < i - g + f ? e = a + 1 : this.op(b, "<", i) && this.op(b, ">", h[a + 1] !== d ? h[a + 1] : i - g) && (e = "left" === c ? a + 1 : a), -1 === e
        }, this)), this.settings.loop || (this.op(b, ">", h[this.minimum()]) ? e = b = this.minimum() : this.op(b, "<", h[this.maximum()]) && (e = b = this.maximum())), e
    }, e.prototype.animate = function(b) {
        var c = this.speed() > 0;
        this.is("animating") && this.onTransitionEnd(), c && (this.enter("animating"), this.trigger("translate")), a.support.transform3d && a.support.transition ? this.$stage.css({
            transform: "translate3d(" + b + "px,0px,0px)",
            transition: this.speed() / 1e3 + "s" + (this.settings.slideTransition ? " " + this.settings.slideTransition : "")
        }) : c ? this.$stage.animate({
            left: b + "px"
        }, this.speed(), this.settings.fallbackEasing, a.proxy(this.onTransitionEnd, this)) : this.$stage.css({
            left: b + "px"
        })
    }, e.prototype.is = function(a) {
        return this._states.current[a] && this._states.current[a] > 0
    }, e.prototype.current = function(a) {
        if (a === d) return this._current;
        if (0 === this._items.length) return d;
        if (a = this.normalize(a), this._current !== a) {
            var b = this.trigger("change", {
                property: {
                    name: "position",
                    value: a
                }
            });
            b.data !== d && (a = this.normalize(b.data)), this._current = a, this.invalidate("position"), this.trigger("changed", {
                property: {
                    name: "position",
                    value: this._current
                }
            })
        }
        return this._current
    }, e.prototype.invalidate = function(b) {
        return "string" === a.type(b) && (this._invalidated[b] = !0, this.is("valid") && this.leave("valid")), a.map(this._invalidated, function(a, b) {
            return b
        })
    }, e.prototype.reset = function(a) {
        (a = this.normalize(a)) !== d && (this._speed = 0, this._current = a, this.suppress(["translate", "translated"]), this.animate(this.coordinates(a)), this.release(["translate", "translated"]))
    }, e.prototype.normalize = function(a, b) {
        var c = this._items.length,
            e = b ? 0 : this._clones.length;
        return !this.isNumeric(a) || c < 1 ? a = d : (a < 0 || a >= c + e) && (a = ((a - e / 2) % c + c) % c + e / 2), a
    }, e.prototype.relative = function(a) {
        return a -= this._clones.length / 2, this.normalize(a, !0)
    }, e.prototype.maximum = function(a) {
        var b, c, d, e = this.settings,
            f = this._coordinates.length;
        if (e.loop) f = this._clones.length / 2 + this._items.length - 1;
        else if (e.autoWidth || e.merge) {
            if (b = this._items.length)
                for (c = this._items[--b].width(), d = this.$element.width(); b-- && !((c += this._items[b].width() + this.settings.margin) > d););
            f = b + 1
        } else f = e.center ? this._items.length - 1 : this._items.length - e.items;
        return a && (f -= this._clones.length / 2), Math.max(f, 0)
    }, e.prototype.minimum = function(a) {
        return a ? 0 : this._clones.length / 2
    }, e.prototype.items = function(a) {
        return a === d ? this._items.slice() : (a = this.normalize(a, !0), this._items[a])
    }, e.prototype.mergers = function(a) {
        return a === d ? this._mergers.slice() : (a = this.normalize(a, !0), this._mergers[a])
    }, e.prototype.clones = function(b) {
        var c = this._clones.length / 2,
            e = c + this._items.length,
            f = function(a) {
                return a % 2 == 0 ? e + a / 2 : c - (a + 1) / 2
            };
        return b === d ? a.map(this._clones, function(a, b) {
            return f(b)
        }) : a.map(this._clones, function(a, c) {
            return a === b ? f(c) : null
        })
    }, e.prototype.speed = function(a) {
        return a !== d && (this._speed = a), this._speed
    }, e.prototype.coordinates = function(b) {
        var c, e = 1,
            f = b - 1;
        return b === d ? a.map(this._coordinates, a.proxy(function(a, b) {
            return this.coordinates(b)
        }, this)) : (this.settings.center ? (this.settings.rtl && (e = -1, f = b + 1), c = this._coordinates[b], c += (this.width() - c + (this._coordinates[f] || 0)) / 2 * e) : c = this._coordinates[f] || 0, c = Math.ceil(c))
    }, e.prototype.duration = function(a, b, c) {
        return 0 === c ? 0 : Math.min(Math.max(Math.abs(b - a), 1), 6) * Math.abs(c || this.settings.smartSpeed)
    }, e.prototype.to = function(a, b) {
        var c = this.current(),
            d = null,
            e = a - this.relative(c),
            f = (e > 0) - (e < 0),
            g = this._items.length,
            h = this.minimum(),
            i = this.maximum();
        this.settings.loop ? (!this.settings.rewind && Math.abs(e) > g / 2 && (e += -1 * f * g), a = c + e, (d = ((a - h) % g + g) % g + h) !== a && d - e <= i && d - e > 0 && (c = d - e, a = d, this.reset(c))) : this.settings.rewind ? (i += 1, a = (a % i + i) % i) : a = Math.max(h, Math.min(i, a)), this.speed(this.duration(c, a, b)), this.current(a), this.isVisible() && this.update()
    }, e.prototype.next = function(a) {
        a = a || !1, this.to(this.relative(this.current()) + 1, a)
    }, e.prototype.prev = function(a) {
        a = a || !1, this.to(this.relative(this.current()) - 1, a)
    }, e.prototype.onTransitionEnd = function(a) {
        if (a !== d && (a.stopPropagation(), (a.target || a.srcElement || a.originalTarget) !== this.$stage.get(0))) return !1;
        this.leave("animating"), this.trigger("translated")
    }, e.prototype.viewport = function() {
        var d;
        return this.options.responsiveBaseElement !== b ? d = a(this.options.responsiveBaseElement).width() : b.innerWidth ? d = b.innerWidth : c.documentElement && c.documentElement.clientWidth ? d = c.documentElement.clientWidth : console.warn("Can not detect viewport width."), d
    }, e.prototype.replace = function(b) {
        this.$stage.empty(), this._items = [], b && (b = b instanceof jQuery ? b : a(b)), this.settings.nestedItemSelector && (b = b.find("." + this.settings.nestedItemSelector)), b.filter(function() {
            return 1 === this.nodeType
        }).each(a.proxy(function(a, b) {
            b = this.prepare(b), this.$stage.append(b), this._items.push(b), this._mergers.push(1 * b.find("[data-merge]").addBack("[data-merge]").attr("data-merge") || 1)
        }, this)), this.reset(this.isNumeric(this.settings.startPosition) ? this.settings.startPosition : 0), this.invalidate("items")
    }, e.prototype.add = function(b, c) {
        var e = this.relative(this._current);
        c = c === d ? this._items.length : this.normalize(c, !0), b = b instanceof jQuery ? b : a(b), this.trigger("add", {
            content: b,
            position: c
        }), b = this.prepare(b), 0 === this._items.length || c === this._items.length ? (0 === this._items.length && this.$stage.append(b), 0 !== this._items.length && this._items[c - 1].after(b), this._items.push(b), this._mergers.push(1 * b.find("[data-merge]").addBack("[data-merge]").attr("data-merge") || 1)) : (this._items[c].before(b), this._items.splice(c, 0, b), this._mergers.splice(c, 0, 1 * b.find("[data-merge]").addBack("[data-merge]").attr("data-merge") || 1)), this._items[e] && this.reset(this._items[e].index()), this.invalidate("items"), this.trigger("added", {
            content: b,
            position: c
        })
    }, e.prototype.remove = function(a) {
        (a = this.normalize(a, !0)) !== d && (this.trigger("remove", {
            content: this._items[a],
            position: a
        }), this._items[a].remove(), this._items.splice(a, 1), this._mergers.splice(a, 1), this.invalidate("items"), this.trigger("removed", {
            content: null,
            position: a
        }))
    }, e.prototype.preloadAutoWidthImages = function(b) {
        b.each(a.proxy(function(b, c) {
            this.enter("pre-loading"), c = a(c), a(new Image).one("load", a.proxy(function(a) {
                c.attr("src", a.target.src), c.css("opacity", 1), this.leave("pre-loading"), !this.is("pre-loading") && !this.is("initializing") && this.refresh()
            }, this)).attr("src", c.attr("src") || c.attr("data-src") || c.attr("data-src-retina"))
        }, this))
    }, e.prototype.destroy = function() {
        this.$element.off(".owl.core"), this.$stage.off(".owl.core"), a(c).off(".owl.core"), !1 !== this.settings.responsive && (b.clearTimeout(this.resizeTimer), this.off(b, "resize", this._handlers.onThrottledResize));
        for (var d in this._plugins) this._plugins[d].destroy();
        this.$stage.children(".cloned").remove(), this.$stage.unwrap(), this.$stage.children().contents().unwrap(), this.$stage.children().unwrap(), this.$stage.remove(), this.$element.removeClass(this.options.refreshClass).removeClass(this.options.loadingClass).removeClass(this.options.loadedClass).removeClass(this.options.rtlClass).removeClass(this.options.dragClass).removeClass(this.options.grabClass).attr("class", this.$element.attr("class").replace(new RegExp(this.options.responsiveClass + "-\\S+\\s", "g"), "")).removeData("owl.carousel")
    }, e.prototype.op = function(a, b, c) {
        var d = this.settings.rtl;
        switch (b) {
            case "<":
                return d ? a > c : a < c;
            case ">":
                return d ? a < c : a > c;
            case ">=":
                return d ? a <= c : a >= c;
            case "<=":
                return d ? a >= c : a <= c
        }
    }, e.prototype.on = function(a, b, c, d) {
        a.addEventListener ? a.addEventListener(b, c, d) : a.attachEvent && a.attachEvent("on" + b, c)
    }, e.prototype.off = function(a, b, c, d) {
        a.removeEventListener ? a.removeEventListener(b, c, d) : a.detachEvent && a.detachEvent("on" + b, c)
    }, e.prototype.trigger = function(b, c, d, f, g) {
        var h = {
                item: {
                    count: this._items.length,
                    index: this.current()
                }
            },
            i = a.camelCase(a.grep(["on", b, d], function(a) {
                return a
            }).join("-").toLowerCase()),
            j = a.Event([b, "owl", d || "carousel"].join(".").toLowerCase(), a.extend({
                relatedTarget: this
            }, h, c));
        return this._supress[b] || (a.each(this._plugins, function(a, b) {
            b.onTrigger && b.onTrigger(j)
        }), this.register({
            type: e.Type.Event,
            name: b
        }), this.$element.trigger(j), this.settings && "function" == typeof this.settings[i] && this.settings[i].call(this, j)), j
    }, e.prototype.enter = function(b) {
        a.each([b].concat(this._states.tags[b] || []), a.proxy(function(a, b) {
            this._states.current[b] === d && (this._states.current[b] = 0), this._states.current[b]++
        }, this))
    }, e.prototype.leave = function(b) {
        a.each([b].concat(this._states.tags[b] || []), a.proxy(function(a, b) {
            this._states.current[b]--
        }, this))
    }, e.prototype.register = function(b) {
        if (b.type === e.Type.Event) {
            if (a.event.special[b.name] || (a.event.special[b.name] = {}), !a.event.special[b.name].owl) {
                var c = a.event.special[b.name]._default;
                a.event.special[b.name]._default = function(a) {
                    return !c || !c.apply || a.namespace && -1 !== a.namespace.indexOf("owl") ? a.namespace && a.namespace.indexOf("owl") > -1 : c.apply(this, arguments)
                }, a.event.special[b.name].owl = !0
            }
        } else b.type === e.Type.State && (this._states.tags[b.name] ? this._states.tags[b.name] = this._states.tags[b.name].concat(b.tags) : this._states.tags[b.name] = b.tags, this._states.tags[b.name] = a.grep(this._states.tags[b.name], a.proxy(function(c, d) {
            return a.inArray(c, this._states.tags[b.name]) === d
        }, this)))
    }, e.prototype.suppress = function(b) {
        a.each(b, a.proxy(function(a, b) {
            this._supress[b] = !0
        }, this))
    }, e.prototype.release = function(b) {
        a.each(b, a.proxy(function(a, b) {
            delete this._supress[b]
        }, this))
    }, e.prototype.pointer = function(a) {
        var c = {
            x: null,
            y: null
        };
        return a = a.originalEvent || a || b.event, a = a.touches && a.touches.length ? a.touches[0] : a.changedTouches && a.changedTouches.length ? a.changedTouches[0] : a, a.pageX ? (c.x = a.pageX, c.y = a.pageY) : (c.x = a.clientX, c.y = a.clientY), c
    }, e.prototype.isNumeric = function(a) {
        return !isNaN(parseFloat(a))
    }, e.prototype.difference = function(a, b) {
        return {
            x: a.x - b.x,
            y: a.y - b.y
        }
    }, a.fn.owlCarousel = function(b) {
        var c = Array.prototype.slice.call(arguments, 1);
        return this.each(function() {
            var d = a(this),
                f = d.data("owl.carousel");
            f || (f = new e(this, "object" == typeof b && b), d.data("owl.carousel", f), a.each(["next", "prev", "to", "destroy", "refresh", "replace", "add", "remove"], function(b, c) {
                f.register({
                    type: e.Type.Event,
                    name: c
                }), f.$element.on(c + ".owl.carousel.core", a.proxy(function(a) {
                    a.namespace && a.relatedTarget !== this && (this.suppress([c]), f[c].apply(this, [].slice.call(arguments, 1)), this.release([c]))
                }, f))
            })), "string" == typeof b && "_" !== b.charAt(0) && f[b].apply(f, c)
        })
    }, a.fn.owlCarousel.Constructor = e
}(window.Zepto || window.jQuery, window, document),
function(a, b, c, d) {
    var e = function(b) {
        this._core = b, this._interval = null, this._visible = null, this._handlers = {
            "initialized.owl.carousel": a.proxy(function(a) {
                a.namespace && this._core.settings.autoRefresh && this.watch()
            }, this)
        }, this._core.options = a.extend({}, e.Defaults, this._core.options), this._core.$element.on(this._handlers)
    };
    e.Defaults = {
        autoRefresh: !0,
        autoRefreshInterval: 500
    }, e.prototype.watch = function() {
        this._interval || (this._visible = this._core.isVisible(), this._interval = b.setInterval(a.proxy(this.refresh, this), this._core.settings.autoRefreshInterval))
    }, e.prototype.refresh = function() {
        this._core.isVisible() !== this._visible && (this._visible = !this._visible, this._core.$element.toggleClass("owl-hidden", !this._visible), this._visible && this._core.invalidate("width") && this._core.refresh())
    }, e.prototype.destroy = function() {
        var a, c;
        b.clearInterval(this._interval);
        for (a in this._handlers) this._core.$element.off(a, this._handlers[a]);
        for (c in Object.getOwnPropertyNames(this)) "function" != typeof this[c] && (this[c] = null)
    }, a.fn.owlCarousel.Constructor.Plugins.AutoRefresh = e
}(window.Zepto || window.jQuery, window, document),
function(a, b, c, d) {
    var e = function(b) {
        this._core = b, this._loaded = [], this._handlers = {
            "initialized.owl.carousel change.owl.carousel resized.owl.carousel": a.proxy(function(b) {
                if (b.namespace && this._core.settings && this._core.settings.lazyLoad && (b.property && "position" == b.property.name || "initialized" == b.type)) {
                    var c = this._core.settings,
                        e = c.center && Math.ceil(c.items / 2) || c.items,
                        f = c.center && -1 * e || 0,
                        g = (b.property && b.property.value !== d ? b.property.value : this._core.current()) + f,
                        h = this._core.clones().length,
                        i = a.proxy(function(a, b) {
                            this.load(b)
                        }, this);
                    for (c.lazyLoadEager > 0 && (e += c.lazyLoadEager, c.loop && (g -= c.lazyLoadEager, e++)); f++ < e;) this.load(h / 2 + this._core.relative(g)), h && a.each(this._core.clones(this._core.relative(g)), i), g++
                }
            }, this)
        }, this._core.options = a.extend({}, e.Defaults, this._core.options), this._core.$element.on(this._handlers)
    };
    e.Defaults = {
        lazyLoad: !1,
        lazyLoadEager: 0
    }, e.prototype.load = function(c) {
        var d = this._core.$stage.children().eq(c),
            e = d && d.find(".owl-lazy");
        !e || a.inArray(d.get(0), this._loaded) > -1 || (e.each(a.proxy(function(c, d) {
            var e, f = a(d),
                g = b.devicePixelRatio > 1 && f.attr("data-src-retina") || f.attr("data-src") || f.attr("data-srcset");
            this._core.trigger("load", {
                element: f,
                url: g
            }, "lazy"), f.is("img") ? f.one("load.owl.lazy", a.proxy(function() {
                f.css("opacity", 1), this._core.trigger("loaded", {
                    element: f,
                    url: g
                }, "lazy")
            }, this)).attr("src", g) : f.is("source") ? f.one("load.owl.lazy", a.proxy(function() {
                this._core.trigger("loaded", {
                    element: f,
                    url: g
                }, "lazy")
            }, this)).attr("srcset", g) : (e = new Image, e.onload = a.proxy(function() {
                f.css({
                    "background-image": 'url("' + g + '")',
                    opacity: "1"
                }), this._core.trigger("loaded", {
                    element: f,
                    url: g
                }, "lazy")
            }, this), e.src = g)
        }, this)), this._loaded.push(d.get(0)))
    }, e.prototype.destroy = function() {
        var a, b;
        for (a in this.handlers) this._core.$element.off(a, this.handlers[a]);
        for (b in Object.getOwnPropertyNames(this)) "function" != typeof this[b] && (this[b] = null)
    }, a.fn.owlCarousel.Constructor.Plugins.Lazy = e
}(window.Zepto || window.jQuery, window, document),
function(a, b, c, d) {
    var e = function(c) {
        this._core = c, this._previousHeight = null, this._handlers = {
            "initialized.owl.carousel refreshed.owl.carousel": a.proxy(function(a) {
                a.namespace && this._core.settings.autoHeight && this.update()
            }, this),
            "changed.owl.carousel": a.proxy(function(a) {
                a.namespace && this._core.settings.autoHeight && "position" === a.property.name && this.update()
            }, this),
            "loaded.owl.lazy": a.proxy(function(a) {
                a.namespace && this._core.settings.autoHeight && a.element.closest("." + this._core.settings.itemClass).index() === this._core.current() && this.update()
            }, this)
        }, this._core.options = a.extend({}, e.Defaults, this._core.options), this._core.$element.on(this._handlers), this._intervalId = null;
        var d = this;
        a(b).on("load", function() {
            d._core.settings.autoHeight && d.update()
        }), a(b).resize(function() {
            d._core.settings.autoHeight && (null != d._intervalId && clearTimeout(d._intervalId), d._intervalId = setTimeout(function() {
                d.update()
            }, 250))
        })
    };
    e.Defaults = {
        autoHeight: !1,
        autoHeightClass: "owl-height"
    }, e.prototype.update = function() {
        var b = this._core._current,
            c = b + this._core.settings.items,
            d = this._core.settings.lazyLoad,
            e = this._core.$stage.children().toArray().slice(b, c),
            f = [],
            g = 0;
        a.each(e, function(b, c) {
            f.push(a(c).height())
        }), g = Math.max.apply(null, f), g <= 1 && d && this._previousHeight && (g = this._previousHeight), this._previousHeight = g, this._core.$stage.parent().height(g).addClass(this._core.settings.autoHeightClass)
    }, e.prototype.destroy = function() {
        var a, b;
        for (a in this._handlers) this._core.$element.off(a, this._handlers[a]);
        for (b in Object.getOwnPropertyNames(this)) "function" != typeof this[b] && (this[b] = null)
    }, a.fn.owlCarousel.Constructor.Plugins.AutoHeight = e
}(window.Zepto || window.jQuery, window, document),
function(a, b, c, d) {
    var e = function(b) {
        this._core = b, this._videos = {}, this._playing = null, this._handlers = {
            "initialized.owl.carousel": a.proxy(function(a) {
                a.namespace && this._core.register({
                    type: "state",
                    name: "playing",
                    tags: ["interacting"]
                })
            }, this),
            "resize.owl.carousel": a.proxy(function(a) {
                a.namespace && this._core.settings.video && this.isInFullScreen() && a.preventDefault()
            }, this),
            "refreshed.owl.carousel": a.proxy(function(a) {
                a.namespace && this._core.is("resizing") && this._core.$stage.find(".cloned .owl-video-frame").remove()
            }, this),
            "changed.owl.carousel": a.proxy(function(a) {
                a.namespace && "position" === a.property.name && this._playing && this.stop()
            }, this),
            "prepared.owl.carousel": a.proxy(function(b) {
                if (b.namespace) {
                    var c = a(b.content).find(".owl-video");
                    c.length && (c.css("display", "none"), this.fetch(c, a(b.content)))
                }
            }, this)
        }, this._core.options = a.extend({}, e.Defaults, this._core.options), this._core.$element.on(this._handlers), this._core.$element.on("click.owl.video", ".owl-video-play-icon", a.proxy(function(a) {
            this.play(a)
        }, this))
    };
    e.Defaults = {
        video: !1,
        videoHeight: !1,
        videoWidth: !1
    }, e.prototype.fetch = function(a, b) {
        var c = function() {
                return a.attr("data-vimeo-id") ? "vimeo" : a.attr("data-vzaar-id") ? "vzaar" : "youtube"
            }(),
            d = a.attr("data-vimeo-id") || a.attr("data-youtube-id") || a.attr("data-vzaar-id"),
            e = a.attr("data-width") || this._core.settings.videoWidth,
            f = a.attr("data-height") || this._core.settings.videoHeight,
            g = a.attr("href");
        if (!g) throw new Error("Missing video URL.");
        if (d = g.match(/(http:|https:|)\/\/(player.|www.|app.)?(vimeo\.com|youtu(be\.com|\.be|be\.googleapis\.com|be\-nocookie\.com)|vzaar\.com)\/(video\/|videos\/|embed\/|channels\/.+\/|groups\/.+\/|watch\?v=|v\/)?([A-Za-z0-9._%-]*)(\&\S+)?/), d[3].indexOf("youtu") > -1) c = "youtube";
        else if (d[3].indexOf("vimeo") > -1) c = "vimeo";
        else {
            if (!(d[3].indexOf("vzaar") > -1)) throw new Error("Video URL not supported.");
            c = "vzaar"
        }
        d = d[6], this._videos[g] = {
            type: c,
            id: d,
            width: e,
            height: f
        }, b.attr("data-video", g), this.thumbnail(a, this._videos[g])
    }, e.prototype.thumbnail = function(b, c) {
        var d, e, f, g = c.width && c.height ? "width:" + c.width + "px;height:" + c.height + "px;" : "",
            h = b.find("img"),
            i = "src",
            j = "",
            k = this._core.settings,
            l = function(c) {
                e = '<div class="owl-video-play-icon"></div>', d = k.lazyLoad ? a("<div/>", {
                    class: "owl-video-tn " + j,
                    srcType: c
                }) : a("<div/>", {
                    class: "owl-video-tn",
                    style: "opacity:1;background-image:url(" + c + ")"
                }), b.after(d), b.after(e)
            };
        if (b.wrap(a("<div/>", {
                class: "owl-video-wrapper",
                style: g
            })), this._core.settings.lazyLoad && (i = "data-src", j = "owl-lazy"), h.length) return l(h.attr(i)), h.remove(), !1;
        "youtube" === c.type ? (f = "//img.youtube.com/vi/" + c.id + "/hqdefault.jpg", l(f)) : "vimeo" === c.type ? a.ajax({
            type: "GET",
            url: "//vimeo.com/api/v2/video/" + c.id + ".json",
            jsonp: "callback",
            dataType: "jsonp",
            success: function(a) {
                f = a[0].thumbnail_large, l(f)
            }
        }) : "vzaar" === c.type && a.ajax({
            type: "GET",
            url: "//vzaar.com/api/videos/" + c.id + ".json",
            jsonp: "callback",
            dataType: "jsonp",
            success: function(a) {
                f = a.framegrab_url, l(f)
            }
        })
    }, e.prototype.stop = function() {
        this._core.trigger("stop", null, "video"), this._playing.find(".owl-video-frame").remove(), this._playing.removeClass("owl-video-playing"), this._playing = null, this._core.leave("playing"), this._core.trigger("stopped", null, "video")
    }, e.prototype.play = function(b) {
        var c, d = a(b.target),
            e = d.closest("." + this._core.settings.itemClass),
            f = this._videos[e.attr("data-video")],
            g = f.width || "100%",
            h = f.height || this._core.$stage.height();
        this._playing || (this._core.enter("playing"), this._core.trigger("play", null, "video"), e = this._core.items(this._core.relative(e.index())), this._core.reset(e.index()), c = a('<iframe frameborder="0" allowfullscreen mozallowfullscreen webkitAllowFullScreen ></iframe>'), c.attr("height", h), c.attr("width", g), "youtube" === f.type ? c.attr("src", "//www.youtube.com/embed/" + f.id + "?autoplay=1&rel=0&v=" + f.id) : "vimeo" === f.type ? c.attr("src", "//player.vimeo.com/video/" + f.id + "?autoplay=1") : "vzaar" === f.type && c.attr("src", "//view.vzaar.com/" + f.id + "/player?autoplay=true"), a(c).wrap('<div class="owl-video-frame" />').insertAfter(e.find(".owl-video")), this._playing = e.addClass("owl-video-playing"))
    }, e.prototype.isInFullScreen = function() {
        var b = c.fullscreenElement || c.mozFullScreenElement || c.webkitFullscreenElement;
        return b && a(b).parent().hasClass("owl-video-frame")
    }, e.prototype.destroy = function() {
        var a, b;
        this._core.$element.off("click.owl.video");
        for (a in this._handlers) this._core.$element.off(a, this._handlers[a]);
        for (b in Object.getOwnPropertyNames(this)) "function" != typeof this[b] && (this[b] = null)
    }, a.fn.owlCarousel.Constructor.Plugins.Video = e
}(window.Zepto || window.jQuery, window, document),
function(a, b, c, d) {
    var e = function(b) {
        this.core = b, this.core.options = a.extend({}, e.Defaults, this.core.options), this.swapping = !0, this.previous = d, this.next = d, this.handlers = {
            "change.owl.carousel": a.proxy(function(a) {
                a.namespace && "position" == a.property.name && (this.previous = this.core.current(), this.next = a.property.value)
            }, this),
            "drag.owl.carousel dragged.owl.carousel translated.owl.carousel": a.proxy(function(a) {
                a.namespace && (this.swapping = "translated" == a.type)
            }, this),
            "translate.owl.carousel": a.proxy(function(a) {
                a.namespace && this.swapping && (this.core.options.animateOut || this.core.options.animateIn) && this.swap()
            }, this)
        }, this.core.$element.on(this.handlers)
    };
    e.Defaults = {
        animateOut: !1,
        animateIn: !1
    }, e.prototype.swap = function() {
        if (1 === this.core.settings.items && a.support.animation && a.support.transition) {
            this.core.speed(0);
            var b, c = a.proxy(this.clear, this),
                d = this.core.$stage.children().eq(this.previous),
                e = this.core.$stage.children().eq(this.next),
                f = this.core.settings.animateIn,
                g = this.core.settings.animateOut;
            this.core.current() !== this.previous && (g && (b = this.core.coordinates(this.previous) - this.core.coordinates(this.next), d.one(a.support.animation.end, c).css({
                left: b + "px"
            }).addClass("animated owl-animated-out").addClass(g)), f && e.one(a.support.animation.end, c).addClass("animated owl-animated-in").addClass(f))
        }
    }, e.prototype.clear = function(b) {
        a(b.target).css({
            left: ""
        }).removeClass("animated owl-animated-out owl-animated-in").removeClass(this.core.settings.animateIn).removeClass(this.core.settings.animateOut), this.core.onTransitionEnd()
    }, e.prototype.destroy = function() {
        var a, b;
        for (a in this.handlers) this.core.$element.off(a, this.handlers[a]);
        for (b in Object.getOwnPropertyNames(this)) "function" != typeof this[b] && (this[b] = null)
    }, a.fn.owlCarousel.Constructor.Plugins.Animate = e
}(window.Zepto || window.jQuery, window, document),
function(a, b, c, d) {
    var e = function(b) {
        this._core = b, this._call = null, this._time = 0, this._timeout = 0, this._paused = !0, this._handlers = {
            "changed.owl.carousel": a.proxy(function(a) {
                a.namespace && "settings" === a.property.name ? this._core.settings.autoplay ? this.play() : this.stop() : a.namespace && "position" === a.property.name && this._paused && (this._time = 0)
            }, this),
            "initialized.owl.carousel": a.proxy(function(a) {
                a.namespace && this._core.settings.autoplay && this.play()
            }, this),
            "play.owl.autoplay": a.proxy(function(a, b, c) {
                a.namespace && this.play(b, c)
            }, this),
            "stop.owl.autoplay": a.proxy(function(a) {
                a.namespace && this.stop()
            }, this),
            "mouseover.owl.autoplay": a.proxy(function() {
                this._core.settings.autoplayHoverPause && this._core.is("rotating") && this.pause()
            }, this),
            "mouseleave.owl.autoplay": a.proxy(function() {
                this._core.settings.autoplayHoverPause && this._core.is("rotating") && this.play()
            }, this),
            "touchstart.owl.core": a.proxy(function() {
                this._core.settings.autoplayHoverPause && this._core.is("rotating") && this.pause()
            }, this),
            "touchend.owl.core": a.proxy(function() {
                this._core.settings.autoplayHoverPause && this.play()
            }, this)
        }, this._core.$element.on(this._handlers), this._core.options = a.extend({}, e.Defaults, this._core.options)
    };
    e.Defaults = {
        autoplay: !1,
        autoplayTimeout: 5e3,
        autoplayHoverPause: !1,
        autoplaySpeed: !1
    }, e.prototype._next = function(d) {
        this._call = b.setTimeout(a.proxy(this._next, this, d), this._timeout * (Math.round(this.read() / this._timeout) + 1) - this.read()), this._core.is("interacting") || c.hidden || this._core.next(d || this._core.settings.autoplaySpeed)
    }, e.prototype.read = function() {
        return (new Date).getTime() - this._time
    }, e.prototype.play = function(c, d) {
        var e;
        this._core.is("rotating") || this._core.enter("rotating"), c = c || this._core.settings.autoplayTimeout, e = Math.min(this._time % (this._timeout || c), c), this._paused ? (this._time = this.read(), this._paused = !1) : b.clearTimeout(this._call), this._time += this.read() % c - e, this._timeout = c, this._call = b.setTimeout(a.proxy(this._next, this, d), c - e)
    }, e.prototype.stop = function() {
        this._core.is("rotating") && (this._time = 0, this._paused = !0, b.clearTimeout(this._call), this._core.leave("rotating"))
    }, e.prototype.pause = function() {
        this._core.is("rotating") && !this._paused && (this._time = this.read(), this._paused = !0, b.clearTimeout(this._call))
    }, e.prototype.destroy = function() {
        var a, b;
        this.stop();
        for (a in this._handlers) this._core.$element.off(a, this._handlers[a]);
        for (b in Object.getOwnPropertyNames(this)) "function" != typeof this[b] && (this[b] = null)
    }, a.fn.owlCarousel.Constructor.Plugins.autoplay = e
}(window.Zepto || window.jQuery, window, document),
function(a, b, c, d) {
    "use strict";
    var e = function(b) {
        this._core = b, this._initialized = !1, this._pages = [], this._controls = {}, this._templates = [], this.$element = this._core.$element, this._overrides = {
            next: this._core.next,
            prev: this._core.prev,
            to: this._core.to
        }, this._handlers = {
            "prepared.owl.carousel": a.proxy(function(b) {
                b.namespace && this._core.settings.dotsData && this._templates.push('<div class="' + this._core.settings.dotClass + '">' + a(b.content).find("[data-dot]").addBack("[data-dot]").attr("data-dot") + "</div>")
            }, this),
            "added.owl.carousel": a.proxy(function(a) {
                a.namespace && this._core.settings.dotsData && this._templates.splice(a.position, 0, this._templates.pop())
            }, this),
            "remove.owl.carousel": a.proxy(function(a) {
                a.namespace && this._core.settings.dotsData && this._templates.splice(a.position, 1)
            }, this),
            "changed.owl.carousel": a.proxy(function(a) {
                a.namespace && "position" == a.property.name && this.draw()
            }, this),
            "initialized.owl.carousel": a.proxy(function(a) {
                a.namespace && !this._initialized && (this._core.trigger("initialize", null, "navigation"), this.initialize(), this.update(), this.draw(), this._initialized = !0, this._core.trigger("initialized", null, "navigation"))
            }, this),
            "refreshed.owl.carousel": a.proxy(function(a) {
                a.namespace && this._initialized && (this._core.trigger("refresh", null, "navigation"), this.update(), this.draw(), this._core.trigger("refreshed", null, "navigation"))
            }, this)
        }, this._core.options = a.extend({}, e.Defaults, this._core.options), this.$element.on(this._handlers)
    };
    e.Defaults = {
        nav: !1,
        //navText: ['<span aria-label="Previous"><img data-src="https://cdn-themes.gabrielny.com/site2017theme/images/theme2019/svg/aleft.svg"></span>', '<span aria-label="Next" ><img data-src="https://cdn-themes.gabrielny.com/site2017theme/images/theme2019/svg/aright.svg"></span>'],
        navText: ['<span aria-label="Previous"><img data-src="https://cdn-themes.gabrielny.com/site2017theme/images/theme2019/svg/aleft.svg"></span>', '<span aria-label="Next" ><img data-src="https://cdn-themes.gabrielny.com/site2017theme/images/theme2019/svg/aright.svg"></span>'],
        navSpeed: !1,
        navElement: 'button type="button" role="presentation"',
        navContainer: !1,
        navContainerClass: "owl-nav",
        navClass: ["owl-prev", "owl-next"],
        slideBy: 1,
        dotClass: "owl-dot",
        dotsClass: "owl-dots",
        dots: !0,
        dotsEach: !1,
        dotsData: !1,
        dotsSpeed: !1,
        dotsContainer: !1
    }, e.prototype.initialize = function() {
        var b, c = this._core.settings;
        this._controls.$relative = (c.navContainer ? a(c.navContainer) : a("<div>").addClass(c.navContainerClass).appendTo(this.$element)).addClass("disabled"), this._controls.$previous = a("<" + c.navElement + ">").addClass(c.navClass[0]).html(c.navText[0]).prependTo(this._controls.$relative).on("click", a.proxy(function(a) {
            this.prev(c.navSpeed)
        }, this)), this._controls.$next = a("<" + c.navElement + ">").addClass(c.navClass[1]).html(c.navText[1]).appendTo(this._controls.$relative).on("click", a.proxy(function(a) {
            this.next(c.navSpeed)
        }, this)), c.dotsData || (this._templates = [a('<button role="button">').addClass(c.dotClass).append(a("<span>")).prop("outerHTML")]), this._controls.$absolute = (c.dotsContainer ? a(c.dotsContainer) : a("<div>").addClass(c.dotsClass).appendTo(this.$element)).addClass("disabled"), this._controls.$absolute.on("click", "button", a.proxy(function(b) {
            var d = a(b.target).parent().is(this._controls.$absolute) ? a(b.target).index() : a(b.target).parent().index();
            b.preventDefault(), this.to(d, c.dotsSpeed)
        }, this));
        for (b in this._overrides) this._core[b] = a.proxy(this[b], this)
    }, e.prototype.destroy = function() {
        var a, b, c, d, e;
        e = this._core.settings;
        for (a in this._handlers) this.$element.off(a, this._handlers[a]);
        for (b in this._controls) "$relative" === b && e.navContainer ? this._controls[b].html("") : this._controls[b].remove();
        for (d in this.overides) this._core[d] = this._overrides[d];
        for (c in Object.getOwnPropertyNames(this)) "function" != typeof this[c] && (this[c] = null)
    }, e.prototype.update = function() {
        var a, b, c, d = this._core.clones().length / 2,
            e = d + this._core.items().length,
            f = this._core.maximum(!0),
            g = this._core.settings,
            h = g.center || g.autoWidth || g.dotsData ? 1 : g.dotsEach || g.items;
        if ("page" !== g.slideBy && (g.slideBy = Math.min(g.slideBy, g.items)), g.dots || "page" == g.slideBy)
            for (this._pages = [], a = d, b = 0, c = 0; a < e; a++) {
                if (b >= h || 0 === b) {
                    if (this._pages.push({
                            start: Math.min(f, a - d),
                            end: a - d + h - 1
                        }), Math.min(f, a - d) === f) break;
                    b = 0, ++c
                }
                b += this._core.mergers(this._core.relative(a))
            }
    }, e.prototype.draw = function() {
        var b, c = this._core.settings,
            d = this._core.items().length <= c.items,
            e = this._core.relative(this._core.current()),
            f = c.loop || c.rewind;
        this._controls.$relative.toggleClass("disabled", !c.nav || d), c.nav && (this._controls.$previous.toggleClass("disabled", !f && e <= this._core.minimum(!0)), this._controls.$next.toggleClass("disabled", !f && e >= this._core.maximum(!0))), this._controls.$absolute.toggleClass("disabled", !c.dots || d), c.dots && (b = this._pages.length - this._controls.$absolute.children().length, c.dotsData && 0 !== b ? this._controls.$absolute.html(this._templates.join("")) : b > 0 ? this._controls.$absolute.append(new Array(b + 1).join(this._templates[0])) : b < 0 && this._controls.$absolute.children().slice(b).remove(), this._controls.$absolute.find(".active").removeClass("active"), this._controls.$absolute.children().eq(a.inArray(this.current(), this._pages)).addClass("active"))
    }, e.prototype.onTrigger = function(b) {
        var c = this._core.settings;
        b.page = {
            index: a.inArray(this.current(), this._pages),
            count: this._pages.length,
            size: c && (c.center || c.autoWidth || c.dotsData ? 1 : c.dotsEach || c.items)
        }
    }, e.prototype.current = function() {
        var b = this._core.relative(this._core.current());
        return a.grep(this._pages, a.proxy(function(a, c) {
            return a.start <= b && a.end >= b
        }, this)).pop()
    }, e.prototype.getPosition = function(b) {
        var c, d, e = this._core.settings;
        return "page" == e.slideBy ? (c = a.inArray(this.current(), this._pages), d = this._pages.length, b ? ++c : --c, c = this._pages[(c % d + d) % d].start) : (c = this._core.relative(this._core.current()), d = this._core.items().length, b ? c += e.slideBy : c -= e.slideBy), c
    }, e.prototype.next = function(b) {
        a.proxy(this._overrides.to, this._core)(this.getPosition(!0), b)
    }, e.prototype.prev = function(b) {
        a.proxy(this._overrides.to, this._core)(this.getPosition(!1), b)
    }, e.prototype.to = function(b, c, d) {
        var e;
        !d && this._pages.length ? (e = this._pages.length, a.proxy(this._overrides.to, this._core)(this._pages[(b % e + e) % e].start, c)) : a.proxy(this._overrides.to, this._core)(b, c)
    }, a.fn.owlCarousel.Constructor.Plugins.Navigation = e
}(window.Zepto || window.jQuery, window, document),
function(a, b, c, d) {
    "use strict";
    var e = function(c) {
        this._core = c, this._hashes = {}, this.$element = this._core.$element, this._handlers = {
            "initialized.owl.carousel": a.proxy(function(c) {
                c.namespace && "URLHash" === this._core.settings.startPosition && a(b).trigger("hashchange.owl.navigation")
            }, this),
            "prepared.owl.carousel": a.proxy(function(b) {
                if (b.namespace) {
                    var c = a(b.content).find("[data-hash]").addBack("[data-hash]").attr("data-hash");
                    if (!c) return;
                    this._hashes[c] = b.content
                }
            }, this),
            "changed.owl.carousel": a.proxy(function(c) {
                if (c.namespace && "position" === c.property.name) {
                    var d = this._core.items(this._core.relative(this._core.current())),
                        e = a.map(this._hashes, function(a, b) {
                            return a === d ? b : null
                        }).join();
                    if (!e || b.location.hash.slice(1) === e) return;
                    b.location.hash = e
                }
            }, this)
        }, this._core.options = a.extend({}, e.Defaults, this._core.options), this.$element.on(this._handlers), a(b).on("hashchange.owl.navigation", a.proxy(function(a) {
            var c = b.location.hash.substring(1),
                e = this._core.$stage.children(),
                f = this._hashes[c] && e.index(this._hashes[c]);
            f !== d && f !== this._core.current() && this._core.to(this._core.relative(f), !1, !0)
        }, this))
    };
    e.Defaults = {
        URLhashListener: !1
    }, e.prototype.destroy = function() {
        var c, d;
        a(b).off("hashchange.owl.navigation");
        for (c in this._handlers) this._core.$element.off(c, this._handlers[c]);
        for (d in Object.getOwnPropertyNames(this)) "function" != typeof this[d] && (this[d] = null)
    }, a.fn.owlCarousel.Constructor.Plugins.Hash = e
}(window.Zepto || window.jQuery, window, document),
function(a, b, c, d) {
    function e(b, c) {
        var e = !1,
            f = b.charAt(0).toUpperCase() + b.slice(1);
        return a.each((b + " " + h.join(f + " ") + f).split(" "), function(a, b) {
            if (g[b] !== d) return e = !c || b, !1
        }), e
    }

    function f(a) {
        return e(a, !0)
    }
    var g = a("<support>").get(0).style,
        h = "Webkit Moz O ms".split(" "),
        i = {
            transition: {
                end: {
                    WebkitTransition: "webkitTransitionEnd",
                    MozTransition: "transitionend",
                    OTransition: "oTransitionEnd",
                    transition: "transitionend"
                }
            },
            animation: {
                end: {
                    WebkitAnimation: "webkitAnimationEnd",
                    MozAnimation: "animationend",
                    OAnimation: "oAnimationEnd",
                    animation: "animationend"
                }
            }
        },
        j = {
            csstransforms: function() {
                return !!e("transform")
            },
            csstransforms3d: function() {
                return !!e("perspective")
            },
            csstransitions: function() {
                return !!e("transition")
            },
            cssanimations: function() {
                return !!e("animation")
            }
        };
    j.csstransitions() && (a.support.transition = new String(f("transition")), a.support.transition.end = i.transition.end[a.support.transition]), j.cssanimations() && (a.support.animation = new String(f("animation")), a.support.animation.end = i.animation.end[a.support.animation]), j.csstransforms() && (a.support.transform = new String(f("transform")), a.support.transform3d = j.csstransforms3d())
}(window.Zepto || window.jQuery, window, document);</script>
<!-- End Raw -->
<script>var IcarusConfig = {"GAIN_MODE" : "Online","SITE_MAIN_THEME" : "site2015beta","SITE_DOMAIN_WWW" : "https://www.gabrielny.com","SITE_DOMAIN_B2B" : "https://b2b.gabrielny.com", "NODE_API_URL" : "https://9cxwnihtbj.execute-api.us-east-1.amazonaws.com"};</script>

            <!-- Pinterest Pixel Base Code -->
             <script type="text/javascript">
             !function(e){if(!window.pintrk){window.pintrk=function(){window.pintrk.queue.push(
             Array.prototype.slice.call(arguments))};var
             n=window.pintrk;n.queue=[],n.version="3.0";var
             t=document.createElement("script");t.async=!0,t.src=e;var
             r=document.getElementsByTagName("script")[0];r.parentNode.insertBefore(t,r)}}("https://s.pinimg.com/ct/core.js");
             pintrk('load','2615072634521', {
             em: '',
             });
             if (typeof pintrk == 'function') {
                    pintrk('page');
                    pintrk('track', 'pagevisit');
             }
             </script>
             <noscript>
             <img height="1" width="1" style="display:none;" alt="" src="https://ct.pinterest.com/v3/?tid=2615072634521&noscript=1" />
             <img height="1" width="1" style="display:none;" alt=""src="https://ct.pinterest.com/v3/?tid=2615072634521&event=pagevisit&noscript=1"/>
             </noscript>
             <!-- End Pinterest Pixel Base Code -->
            
<script data-file="b2bsearch/b2bsearch.js">var tmp_full_url = window.location.host;
var tmp_parts_url = tmp_full_url.split('.');
var tmp_sub_domain = tmp_parts_url[0];

function gotoStackableFilter(locationUrl, term) {
    $('#loader').show();
    window.location.href = locationUrl + '/searchkeywordstring-' + term;
}

function gotoAdvanceFilter(term) {

    term = term.toLowerCase();

    var term2 = term.replace(/[&\/\\#,+()$~'":*?<>{}]/g, '');

    term = term.replace(/[&\/\\#,+()$~.'":*?<>{}]/g, '');
    var serialSearch = false;
    var w = document.body.clientWidth;
    if (w > 991) {
        if ($('.top_search_desk #topSearchBySerial').is(":checked")) {
            serialSearch = true;
        }
        if ($('#search_overlay_popup_outer #topSearchBySerial').is(":checked")) {
            serialSearch = true;
        }
    } else {
        if ($('.top_search_mob #topSearchBySerial').is(":checked")) {
            serialSearch = true;
        }
        if ($('#search_overlay_popup_outer #topSearchBySerial').is(":checked")) {
            serialSearch = true;
        }
    }

    if (serialSearch) {
        if (window.location.host.indexOf("embed") >= 0) {

        } else {
            var serialNo = term;
            $.ajax({
                type: 'POST',
                dataType: 'json',
                url: '/ajax/eshop/getstylenofromserialno',
                data: { serialNo: serialNo },
                async: true
            }).done(function (data) {

                if (data.success) {

                    if (data.specialItem == '1' || data.itemStatusFilter == 'Discontinued') {
                        var url = site_js_domain_eshop + "/discontinued-items";
                        if (tmp_sub_domain == 'b2b') {
                            url = site_js_domain_retailers + "/discontinued-items";
                        }
                        window.location.href = url;
                        return;
                    } else if (data.itemCode != '') {
                        term = data.itemCode;
                        var url = site_js_domain_eshop + "/products-advanced/searchkeywordstring-" + term;
                        if (tmp_sub_domain == 'b2b') {
                            url = site_js_domain_retailers + "/products-advanced/searchkeywordstring-" + term;
                        }
                        window.location.href = url;
                        return;
                    }
                } else {
                    var url = site_js_domain_eshop + "/products-advanced/searchkeywordstring-" + term;
                    if (tmp_sub_domain == 'b2b') {
                        url = site_js_domain_retailers + "/products-advanced/searchkeywordstring-" + term;
                    }
                    window.location.href = url;
                    return;
                }
            });
        }
    } else {

        var parentDomain;
        if (window.location.host.indexOf("embed") >= 0) {
            parentDomain = "";
        } else if (tmp_sub_domain == 'b2b') {
            parentDomain = site_js_domain_retailers;
        } else {
            parentDomain = site_js_domain_eshop;
        }

        if (is_old_search == 1) {
            var url = parentDomain + "/products-advanced/searchkeywordstring-" + term;
        } else {
            var url = parentDomain + "/products-advanced2/searchkeywordstring-" + term2;
        }

        if (url.indexOf(site_js_domain_eshop) >= 0 || url.indexOf(site_js_domain_retailers) >= 0) {
            url = url.replace(site_js_domain_eshop, location.origin);
            url = url.replace(site_js_domain_retailers, location.origin);
        }

        window.location.href = url;
    }
}

function searchURL(e, elem, term) {
    if (!term || typeof term === undefined || term === null) term = $(elem).val().trim();
    if (term && term.length > 1) {
        term = encodeURIComponent(term);
        var locationUrl = $(location).attr('href');
        if (locationUrl.indexOf('fashion-stackable') !== -1 || locationUrl.indexOf('eternity-stackable') !== -1) {
            var redirectUrl = site_js_domain_www;
            if (tmp_sub_domain == 'b2b') {
                redirectUrl = site_js_domain_retailers;
            }
            if (locationUrl.indexOf('fashion-stackable') !== -1) {
                redirectUrl = redirectUrl + '/fashion-stackable';
            }
            if (locationUrl.indexOf('eternity-stackable') !== -1) {
                redirectUrl = redirectUrl + '/eternity-stackable';
            }
            gotoStackableFilter(redirectUrl, term);
        } else {
            gotoAdvanceFilter(term);
        }
    }
}

let searchBoxValue = '';
function openNewOverlaySearch() {
    $('#search_overlay_popup').show();
    $('#search_overlay_popup .itemSearch').focus();
    $(document).ready(function () {
        $("#ai-search-input-2").val(searchBoxValue);
        $('#ai-search-input-2').focus();
    })
    $('body').addClass('ov_hidden');
}
function closeNewOverlaySearch() {
    $('#search_overlay_popup').hide();
    $('.search-box .itemSearch').blur();
    $(document).ready(function () {
        $("#ai-search-input").val(searchBoxValue);
    })
    $('body').removeClass('ov_hidden');
}
function showAiIcon(isAISearchActive) {
    if (isAISearchActive) {
        $("#aiActive").css("display", "block");
        $("#aiInactive").css("display", "none");
    } else {
        $("#aiActive").css("display", "none");
        $("#aiInactive").css("display", "block");
    }
}
function showClearTextboxButton() {
    if (searchBoxValue) {
        $('.aisearchbar-clearSearchContainer').css('display', 'flex');
    } else {
        $('.aisearchbar-clearSearchContainer').css('display', 'none');
    }
}
function clearSearchBar() {
    $("#ai-search-input").val('');
    $("#ai-search-input-2").val('');
    searchBoxValue = '';
    acCache = { query: '', results: [] };
    acKeywordCache = { query: '', results: [] };
    currentAcType = null;
    offsett = 0;
    keywordOffset = 0;
    acSkuExhausted = false;
    acKeywordExhausted = false;
    $('.aisearchbar-clearSearchContainer').css('display', 'none');
    closeAIAutocompleteOverlay();
}

function openAIAutocompleteOverlay() {
    $('.autocomplete-results').show();
}
function closeAIAutocompleteOverlay() {
    $('.autocomplete-results').hide();
}


let offsett = 0;
let keywordOffset = 0;
let acSkuExhausted = false;
let acKeywordExhausted = false;
let currentAcType = null;
let acCache = { query: '', results: [] };
let acKeywordCache = { query: '', results: [] };

function isSkuInput(term) {
    if (/^pk/i.test(term)) {
        return false;
    }
    if (term.length < 3 || !/\d/.test(term)) {
        return false;
    }
    let leadingLetters = term.match(/^([a-zA-Z]+)/);
    if (!leadingLetters) {
        return false;
    }
    let letterCount = leadingLetters[1].length;
    return letterCount >= 2 && letterCount <= 3;
}

function isKeywordInput(term) {
    return term.length >= 4 && !isSkuInput(term);
}

function renderAutocompleteResults(autocompleteContainer, results, filterInput) {
    let filter = filterInput.toUpperCase();
    let filtered = filter
        ? results.filter(r => r.itemCode.toUpperCase().indexOf(filter) === 0)
        : results;

    $('.autocomplete-results').html('');
    if (filtered.length === 0) {
        closeAIAutocompleteOverlay();
        return;
    }
    openAIAutocompleteOverlay();
    let escapedFilter = filter.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
    let filterRegex = escapedFilter ? new RegExp(escapedFilter, 'i') : null;
    filtered.forEach((result) => {
        let item = document.createElement('div');
        item.classList.add('autocomplete-item');
        let boldCode = filterRegex
            ? result.itemCode.replace(filterRegex, match => `<b>${match}</b>`)
            : result.itemCode;
        item.innerHTML = `<div class="autocomplete-item-image-container">
                            <img class="autocomplete-item-image" src="${result.itemImage}"/>
                          </div>
                          <div class="autocomplete-item-details">
                            <h4 class="itemDesc">${result.itemDesc}</h4>
                            <h5 class="itemCode">${boldCode}</h5>
                          </div>`;
        item.addEventListener('click', function () {
            window.location.href = '/product/' + result.itemCode;
        });
        $('.autocomplete-results').append(item);
    });
}

function parseSearchAlternates(alternates) {
    if (!alternates) {
        return [];
    }
    return alternates.split(',').map(a => a.trim()).filter(Boolean);
}

function getKeywordMatchLabel(result, filter) {
    if (!filter) {
        return (result.searchKeyword || '').trim() || null;
    }
    let filterLower = filter.toLowerCase();
    let keyword = (result.searchKeyword || '').trim();
    if (keyword.toLowerCase().indexOf(filterLower) === 0) {
        return keyword;
    }
    for (let alt of parseSearchAlternates(result.searchAlternates)) {
        if (alt.toLowerCase().indexOf(filterLower) === 0) {
            return alt;
        }
    }
    return null;
}

function canUseKeywordCache(filter) {
    if (!acKeywordCache.query || filter.toLowerCase().indexOf(acKeywordCache.query.toLowerCase()) !== 0) {
        return false;
    }
    return acKeywordCache.results.some(r => getKeywordMatchLabel(r, filter) !== null);
}

function boldKeywordPrefix(keyword, prefix) {
    if (!prefix) {
        return keyword;
    }
    if (keyword.toLowerCase().indexOf(prefix.toLowerCase()) !== 0) {
        return keyword;
    }
    let matched = keyword.slice(0, prefix.length);
    let remainder = keyword.slice(prefix.length);
    return `<b>${matched}</b>${remainder}`;
}

function renderKeywordAutocompleteResults(autocompleteContainer, results, filterInput) {
    let filter = filterInput;
    let filtered = filter
        ? results.filter(r => getKeywordMatchLabel(r, filter) !== null)
        : results;

    $('.autocomplete-results').html('');
    if (filtered.length === 0) {
        closeAIAutocompleteOverlay();
        return;
    }
    openAIAutocompleteOverlay();
    filtered.forEach((result) => {
        let item = document.createElement('div');
        item.classList.add('autocomplete-keyword-item');
        let matchLabel = getKeywordMatchLabel(result, filter) || result.searchKeyword;
        let boldKeyword = boldKeywordPrefix(matchLabel, filter);
        item.innerHTML = `<span class="autocomplete-keyword-label">Keyword: ${boldKeyword}</span>`;
        item.addEventListener('click', function () {
            window.location.href = '/products-advanced3?search=' + encodeURIComponent(matchLabel);
        });
        $('.autocomplete-results').append(item);
    });
}

function getNLPautocomplete(autocompleteContainer, input, offset = 0, lazy = false, acType = 'sku') {
    let queryInput = acType === 'sku' ? input.toUpperCase() : input.trim();
    const origin = window.location.origin.replace('b2b.', 'api.');
    const acLimit = 10;
    currentTopSearchRequest = $.ajax({
        url: origin + ':8080/ai_NatQuery2.php?queryString=' + encodeURIComponent(queryInput) + '&ac=1&acType=' + encodeURIComponent(acType) + '&limit=' + acLimit + '&offset=' + encodeURIComponent(offset),
        type: 'get',
        dataType: 'json',
        success: function (response) {
            let currentInput = ($("#ai-search-input").val() || '').trim();
            let hasResults = Array.isArray(response.Results) && response.Results.length > 0 && response.Status === 'Success';

            if (hasResults) {
                if (acType === 'keyword') {
                    if (!lazy) {
                        keywordOffset = 0;
                        acKeywordExhausted = false;
                        autocompleteContainer.scrollTop = 0;
                        acKeywordCache = { query: queryInput, results: response.Results };
                    } else {
                        acKeywordCache.results = acKeywordCache.results.concat(response.Results);
                    }
                    keywordOffset += response.Results.length;
                    if (response.Results.length < acLimit) {
                        acKeywordExhausted = true;
                    }
                    renderKeywordAutocompleteResults(autocompleteContainer, acKeywordCache.results, currentInput);
                } else {
                    if (!lazy) {
                        offsett = 0;
                        acSkuExhausted = false;
                        autocompleteContainer.scrollTop = 0;
                        acCache = { query: queryInput, results: response.Results };
                    } else {
                        acCache.results = acCache.results.concat(response.Results);
                    }
                    offsett += response.Results.length;
                    if (response.Results.length < acLimit) {
                        acSkuExhausted = true;
                    }
                    renderAutocompleteResults(autocompleteContainer, acCache.results, currentInput);
                }
            } else if (lazy) {
                if (acType === 'keyword') {
                    acKeywordExhausted = true;
                    if (acKeywordCache.results.length > 0) {
                        renderKeywordAutocompleteResults(autocompleteContainer, acKeywordCache.results, currentInput);
                    } else {
                        closeAIAutocompleteOverlay();
                    }
                } else {
                    acSkuExhausted = true;
                    if (acCache.results.length > 0) {
                        renderAutocompleteResults(autocompleteContainer, acCache.results, currentInput);
                    } else {
                        closeAIAutocompleteOverlay();
                    }
                }
            } else {
                closeAIAutocompleteOverlay();
            }
        },
        error: function (request, status, error) {
        }
    });
}

$(document).ready(function () {
    document.querySelector('#price-mode-apply')?.addEventListener('click', function () {
        if (document.location.href.includes('products-advanced3') && document.readyState === "complete") {
            document.querySelector('#price-mode-apply').innerHTML = "<div style='display: block; margin: auto' class='lds-ring'><div></div><div></div><div></div><div></div></div>";
        }
    });
});

const isNLPon = document.cookie.split('; ').find(row => row.startsWith('isNLPon='))?.split('=')[1] == 1;
// let isAISearchActive = window.location.href.includes('products-advanced3') || isNLPon;
let isAISearchActive = true;
$(document).ready(function () {
    let searchPhrase = $("#hidden-search-phrase").val();
    let autocompleteContainer = document.getElementById('autocomplete-results');
    showAiIcon(isAISearchActive);

    if (searchPhrase) {
        searchBoxValue = searchPhrase;
        $("#ai-search-input").val(searchPhrase);
        showClearTextboxButton();
    }

    $(".aisearchbar-clearSearchIcon").on("click", function () {
        clearSearchBar();
        closeNewOverlaySearch();
    });

    $("#ai-search-input-2").on("keyup", function (e) {
        callOverlaySearchAutoComplete(searchBoxValue.trim());
        callActItemSearchAutoComplete(searchBoxValue);
        if (e.key === "Escape" || e.keyCode === 27) {
            closeNewOverlaySearch();
        }
    });

    $("#search-close").on("click", function () {
        closeNewOverlaySearch();
    });

    $("#aiInactive-2").on("click", function () {
        isAISearchActive = true;
        closeNewOverlaySearch();
        $(document).ready(function () {
            showAiIcon(isAISearchActive);
            $('#ai-search-input').focus();
        });
    });

    // $("#aisearchbar-image-search").on("click", function () {
    //     window.location.href = '/imageSearch';
    // });

    // $("#aiInactive, #aiActive").on("click", function () {
    //     isAISearchActive = !isAISearchActive;
    //     showAiIcon(isAISearchActive);
    //     if (isAISearchActive) {
    //         document.cookie = 'isNLPon=1; max-age=' + (60 * 60 * 24 * 365 * 100) + '; path=/';
    //         $(document).ready(function () {
    //             $('#ai-search-input').focus();
    //         });
    //     } else {
    //         document.cookie = 'isNLPon=0; max-age=' + (60 * 60 * 24 * 365 * 100) + '; path=/';
    //         if (searchBoxValue) {
    //             openNewOverlaySearch();
    //         }
    //     }
    // })

    let debounceTimeout1;
    $("#ai-search-input").on("keyup", function (e) {
        searchBoxValue = $("#ai-search-input").val();
        showClearTextboxButton();
        if (e.key === "Escape" || e.keyCode === 27) {
            closeAIAutocompleteOverlay();
            return;
        }
        let trimmed = searchBoxValue.trim();
        if (isSkuInput(trimmed)) {
            currentAcType = 'sku';
            if (acCache.query && trimmed.toUpperCase().indexOf(acCache.query) === 0) {
                renderAutocompleteResults(autocompleteContainer, acCache.results, trimmed);
            } else {
                clearTimeout(debounceTimeout1);
                debounceTimeout1 = setTimeout(() => {
                    getNLPautocomplete(autocompleteContainer, trimmed, 0, false, 'sku');
                }, 300);
            }
        } else if (isKeywordInput(trimmed)) {
            currentAcType = 'keyword';
            if (canUseKeywordCache(trimmed)) {
                renderKeywordAutocompleteResults(autocompleteContainer, acKeywordCache.results, trimmed);
            } else {
                clearTimeout(debounceTimeout1);
                debounceTimeout1 = setTimeout(() => {
                    getNLPautocomplete(autocompleteContainer, trimmed, 0, false, 'keyword');
                }, 300);
            }
        } else {
            currentAcType = null;
            closeAIAutocompleteOverlay();
        }
    })
    $("#ai-search-input-2").on("keyup", function () {
        searchBoxValue = $("#ai-search-input-2").val();
        showClearTextboxButton();
    })

    $(".svg-search").on("click", function () {
        if (!$(".search_bx div.pd0").hasClass('open')) {
            $(".search_bx div.pd0").addClass('open');
            $(".search_bx div.pd0").removeClass('hidden-sm-down');;
            $(".aisearchbar-container").addClass('mobile');
        } else {
            $(".search_bx div.pd0").removeClass('open');
            $(".search_bx div.pd0").addClass('hidden-sm-down');;
            $(".aisearchbar-container").removeClass('mobile');
        }
    })

    let debounceTimeout;
    if (autocompleteContainer) {
        autocompleteContainer.addEventListener('scroll', () => {
            clearTimeout(debounceTimeout);
            debounceTimeout = setTimeout(() => {
                const { scrollTop, scrollHeight, clientHeight } = autocompleteContainer;
                const scrollPosition = (scrollTop + clientHeight) / scrollHeight;
                if (scrollPosition > 0.75) {
                    let trimmedScroll = searchBoxValue.trim();
                    if (currentAcType === 'sku' && isSkuInput(trimmedScroll) && !acSkuExhausted) {
                        getNLPautocomplete(autocompleteContainer, trimmedScroll, offsett, true, 'sku');
                    } else if (currentAcType === 'keyword' && isKeywordInput(trimmedScroll) && !acKeywordExhausted) {
                        getNLPautocomplete(autocompleteContainer, trimmedScroll, keywordOffset, true, 'keyword');
                    }
                }
            }, 400);
        });
    }

});

$(document).on('keydown', '#ai-search-input', function (e) {
    if (e.which == 13) {
        if ($(this).val().length > 2) {
            document.querySelector('.aisearchbar-clearSearchIcon').style.display = 'none';
            if (isAISearchActive) {
                window.location.href = `/products-advanced3?search=${encodeURIComponent($(this).val())}`;
            }
        }
    }
});

$(document).on('keydown', '#ai-search-input-2', function (e) {
    e.stopPropagation();
    if (e.which == 13) {
        e.preventDefault();
        let searchval = $('#ai-search-input-2').val().trim();
        if (searchval && searchval.length > 0) {
            searchURL(e, null, searchval);
        }
    }
});

// VOICE RECOGNITION -->
$(document).ready(function () {

    let isRecording = false;
    let selectedSearchBox;

    let recognition = window.SpeechRecognition || window.webkitSpeechRecognition;
    if (recognition) {
        recognition = new recognition();
        recognition.continuous = true;
        recognition.autoPunctuation = false;
        recognition.interimResults = true;
        recognition.lang = 'en-US';
        let silenceTimer = null;
        let finalTranscript = '';

        recognition.onstart = () => {
            console.log('recognition started');
            $('.aisearchbar-searchMic').css('background-color', '#d3d3d3');
            $('.aisearchbar-searchMic').attr('disabled', true);
            console.log('Recording started');
        };

        recognition.onresult = function (event) {
            finalTranscript = $(selectedSearchBox).val() ? $(selectedSearchBox).val() + ' ' : '';
            for (let i = event.resultIndex; i < event.results.length; i++) {
                const result = event.results[i];
                if (result.isFinal) {
                    finalTranscript += result[0].transcript + ' ';
                }
            }
            finalTranscript = finalTranscript.replace(/[,\.]/g, '').toLowerCase().trim();
            $(selectedSearchBox).val(finalTranscript);

            clearTimeout(silenceTimer);
            silenceTimer = setTimeout(() => {
                console.log('No speech detected, stopping recognition.');
                $('.aisearchbar-searchMic').css('background-color', '');
                isRecording = false;
                recognition.stop();
                showClearTextboxButton(selectedSearchBox);
                $(selectedSearchBox).focus();
            }, 1150);
        };

    } else {
        $('.aisearchbar-searchMic').css('display', 'none');
    }

    $('.aisearchbar-searchMic').on('click', function () {
        console.log('clicked microphone')
        if (isAISearchActive) {
            selectedSearchBox = '#ai-search-input';
        } else {
            selectedSearchBox = '#ai-search-input-2';
        }

        if (!isRecording) {
            isRecording = true;
            console.log('Attempting to start recognition');
            try {
                recognition.start();
            } catch {
                recognition.stop();
                recognition.start();
            }
        } else {
            isRecording = false;
            recognition.stop();
            $(selectedSearchBox).focus();
            showClearTextboxButton(selectedSearchBox);
            $('.aisearchbar-searchMic').css('background-color', '');
        }
    })

})



var currentTopSearchRequest = null;
var currentTopSearchMinLength = 3;
var yopSearchCacheQueryString = null;
var search_is_retail = 0;
var is_old_search = 0;
function callOverlaySearchAutoComplete(search) {

    if (search != "" && /^(S|s)\d{2,}$/gi.test(search)) {
        return;
    }

    if (search != "" || search.length < currentTopSearchMinLength) {
        if (currentTopSearchRequest != null) {
            currentTopSearchRequest.abort();
        }
    }

    if (search != "" && search.length >= currentTopSearchMinLength && yopSearchCacheQueryString != search) {

        if (currentTopSearchRequest != null) {
            currentTopSearchRequest.abort();
        }

        $('#search_overlay_result_loader').show();
        $("#search_overlay_result").empty();
        currentTopSearchRequest = $.ajax({
            url: '/ajax/_global/es_search_autocomplete_b2b',
            type: 'post',
            data: { query: search },
            dataType: 'json',
            beforeSend: function () {
                if (currentTopSearchRequest != null) {
                    currentTopSearchRequest.abort();
                }
            },
            success: function (response) {
                $('#search_overlay_result_loader').hide();
                yopSearchCacheQueryString = search;

                var searchResHTML = '';
                var len = response.products.length > 0 ? response.products.length : 0;
                var pagelen = response.pages.length > 0 ? response.pages.length : 0;
                var categorylen = response.category.length > 0 ? response.category.length : 0;
                var matchingbandlen = response.matching_bands.length > 0 ? response.matching_bands.length : 0;

                // To track GA Built-In search start
                dataLayer.push({
                    'event': 'customSearch',
                    'customSearchInput': search
                });
                // To track GA Built-In search end

                if (len == 0 && pagelen == 0 && categorylen == 0 && matchingbandlen == 0) {
                    trackGAEvents('SiteSearchEvent', 'Site Search', 'Zero Search Results', search);
                } else {
                    trackGAEvents('SiteSearchEvent', 'Site Search', 'Search Results', search);
                }
                console.log(len)
                if (len > 0) {
                    searchResHTML += '<div class="box_slid_sear">';
                    searchResHTML += '<div class="inn_bor">';
                    searchResHTML += '<h3>Products</h3>';
                    searchResHTML += '<div class="inn_slid">';
                    searchResHTML += '<ul class="owl-carousel" id="search_overlay_prodres_slider">';
                    for (var i = 0; i < len; i++) {
                        searchResHTML += '<li>';
                        searchResHTML += '<a href="javascript:void(0);" data-href="' + response.products[i]['Url'] + '" data-title="' + response.products[i]['Sku'] + '" class="tracksearchresultclick">';
                        searchResHTML += '<div class="pr_inn">';
                        searchResHTML += '<div class="thumb"><img data-src="' + response.products[i]['Image'] + '" alt="' + response.products[i]['Name'] + '" /></div>';
                        searchResHTML += '<div class="pro_name">';
                        searchResHTML += '<h4>' + response.products[i]['Sku'] + '</h4>';
                        searchResHTML += '<h3>' + response.products[i]['Name'] + '</h3>';
                        //searchResHTML += '<h3>Retail : $ 2,475</h3>';
                        searchResHTML += '<h3>' + response.products[i]['Price'] + '</h3>';
                        searchResHTML += '</div>';
                        searchResHTML += '</div>';
                        searchResHTML += '</a>';
                        searchResHTML += '</li>';
                    }
                    searchResHTML += '</ul>';
                    searchResHTML += '</div>';
                    searchResHTML += '</div>';
                    searchResHTML += '</div>';
                    searchResHTML += '<br>';
                    searchResHTML += '<br>';
                }

                if (pagelen > 0 || categorylen > 0 || matchingbandlen > 0) {
                    searchResHTML += '<div class="row">';
                    if (categorylen > 0) {
                        searchResHTML += '<div class="' + (categorylen > 5 ? 'col-sm-6 two_column' : 'col-lg-3 col-md-4 col-sm-6 col-sm-12') + '">';
                        searchResHTML += '<div class="inn_bor">';
                        searchResHTML += '<h3>Categories</h3>';
                        searchResHTML += '<ul>';
                        for (var j = 0; j < categorylen; j++) {
                            searchResHTML += '<li><a href="javascript:void(0);" data-href="' + response.category[j]['PageURL'] + '" data-title="' + response.category[j]['PageTitle'] + '" class="tracksearchresultclick">' + response.category[j]['PageTitle'] + '</a></li>';
                            if (j == 5 && categorylen > 5) {
                                searchResHTML += '</ul>';
                                searchResHTML += '<ul>';
                            }
                        }
                        searchResHTML += '</ul>';
                        searchResHTML += '</div>';
                        searchResHTML += '</div>';
                    }
                    if (pagelen > 0) {
                        searchResHTML += '<div class="' + (pagelen > 5 ? 'col-sm-6 two_column' : 'col-lg-3 col-md-4 col-sm-6 col-sm-12') + '">';
                        searchResHTML += '<div class="inn_bor">';
                        searchResHTML += '<h3>Pages</h3>';
                        searchResHTML += '<ul>';
                        for (var j = 0; j < pagelen; j++) {
                            searchResHTML += '<li><a href="javascript:void(0);" data-href="' + response.pages[j]['PageURL'] + '" data-title="' + response.pages[j]["PageTitle"] + '" class="tracksearchresultclick">' + response.pages[j]["PageTitle"] + '</a></li>';
                            if (j == 5 && pagelen > 5) {
                                searchResHTML += '</ul>';
                                searchResHTML += '<ul>';
                            }
                        }
                        searchResHTML += '</ul>';
                        searchResHTML += '</div>';
                        searchResHTML += '</div>';
                    }
                    if (matchingbandlen > 0) {
                        searchResHTML += '<div class="col-lg-3 col-md-4 col-sm-6 col-sm-12">';
                        searchResHTML += '<div class="inn_bor inn_matchingbands">';
                        searchResHTML += '<h3>Matching Bands</h3>';
                        searchResHTML += '<ul>';
                        for (var j = 0; j < matchingbandlen; j++) {
                            searchResHTML += '<li>';
                            searchResHTML += '<div class="thumb">';
                            searchResHTML += '<a href="javascript:void(0);" data-href="' + response.matching_bands[j]['Url'] + '" data-title="' + response.matching_bands[j]['Sku'] + '" class="tracksearchresultclick"><img data-src="' + response.matching_bands[j]['Image'] + '" alt="' + response.matching_bands[j]['Name'] + '" width="87"></a></div>';
                            searchResHTML += '<div class="inner_sdf">';
                            searchResHTML += '<a href="javascript:void(0);" data-href="' + response.matching_bands[j]['Url'] + '" data-title="' + response.matching_bands[j]['Sku'] + '" class="tracksearchresultclick">' + response.matching_bands[j]['Name'] + '</a>';
                            searchResHTML += '<span>' + response.matching_bands[j]['Sku'] + '</span>';
                            searchResHTML += '<span class="price">' + response.matching_bands[j]['Price'] + '</span>';
                            searchResHTML += '</div>';
                            searchResHTML += '</li>';
                        }
                        searchResHTML += '</ul>';
                        searchResHTML += '</div>';
                        searchResHTML += '</div>';
                    }

                    searchResHTML += '</div>';
                }




                if (len > 3) {
                    //~ searchResHTML += '<a href="javascript:void(0);" id="topSearchShowAll">Show all results →</a>';
                }

                if (len == 0) {
                    searchResHTML += '<a href="javascript:void(0);">No Products Found</a>';
                }

                $('#search_overlay_result').html(searchResHTML);

                if (len > 0) {
                    if ($.fn.owlCarousel == undefined) {
                        var fileref = document.createElement("link");
                        fileref.rel = "stylesheet";
                        fileref.type = "text/css";
                        fileref.onload = RTOwlCSSDone;
                        fileref.href = site_js_domain_new_theme + "css/owl-carousel.css";
                        document.getElementsByTagName("head")[0].appendChild(fileref)
                        RTLoadJSScript(site_js_domain_localassets + '/javascript/www/owl.carousel.js', function () {
                            RTOwlJSDone();
                            //RTSearchProductOwlCarousel();
                        });
                    } else {
                        RTSearchProductOwlCarousel();
                    }
                }
            },
            error: function (request, status, error) {
                //console.log(request.responseText);
                $('#search_overlay_result_loader').hide();
            }

        });
    } else if (search == "") {
        $('#search_overlay_result').empty();
    }

}

var accountItemSearchRequest = null;
var accountItemSearchMinLength = 3;
var yopSearchCacheQueryString1 = null;
var actItem_search_is_retail = 0;
var actItem_is_old_search = 0;

function callActItemSearchAutoComplete(search) {
    if (search != "" && search.length >= accountItemSearchMinLength) {

        if (accountItemSearchRequest != null) {
            accountItemSearchRequest.abort();
        }
        accountItemSearchRequest = $.ajax({
            url: '/ajax/_global/actitem_search_autocomplete',
            type: 'post',
            data: { query: search, actitemsearch: 1 },
            dataType: 'json',
            beforeSend: function () {
                if (accountItemSearchRequest != null) {
                    accountItemSearchRequest.abort();
                }
            },
            success: function (response) {
                var wwauto = document.body.clientWidth;
                if (wwauto > 991) {
                    if ($("#actItemSearchResult").length === 0) {
                        $("<ul id='actItemSearchResult' class='actItem_auto_search'></ul>").insertAfter('.actitem_search_desk');
                    }
                    if ($('#actItemSearchResult').css('display') == 'none') {
                        $('#actItemSearchResult').show();
                    }
                    var len = response.products.length;
                    if (len > 3) {
                        len = 3;
                    }
                    $("#actItemSearchResult").empty();
                    for (var i = 0; i < len; i++) {
                        console.log("appending results")
                        $("#actItemSearchResult").append("<li value='" + response.products[i]['Sku'] + "'>" + "<div class='s_thumb'><a href='javascript:;'><img data-src='" + response.products[i]['Image'] + "' alt='" + response.products[i]['Name'] + "' title='" + response.products[i]['Name'] + "'></a></div><div class='s_info'>" + "<span class='s_sku'>" + response.products[i]['Sku'] + "</span><span class='s_price'>" + response.products[i]['Price'] + "</span>" + "</div><div class='cart_btn'><button name='addcartbtn' class='addb2bcartbtn' value='" + response.products[i]['Sku'] + "'>Add</div>" + "</li>");
                    }
                    if (len > 3) {
                        //$("#actItemSearchResult").append("<li ><a href='javascript:void(0);' id='topSearchShowAll'>Show all results →</li>");
                    }
                    if (len == 0) {
                        $("#actItemSearchResult").append("<li ><a href='javascript:void(0);'>No Record Found</li>");
                    }
                    $(".addb2bcartbtn").bind("click", function () {
                        var styleno = $(this).val();
                        console.log('styleno=' + styleno);
                        global_addtob2bcart(styleno);
                    });
                } else {
                    //For mobile
                    if ($("#actItemSearchResultMob").length === 0) {
                        $("<ul id='actItemSearchResultMob' class='actItem_auto_search'></ul>").insertAfter('.actitem_search_desk_mob');
                    }
                    if ($('#actItemSearchResultMob').css('display') == 'none') {
                        $('#actItemSearchResultMob').show();
                    }
                    var len = response.products.length;
                    $("#actItemSearchResultMob").empty();
                    if (len > 3) {
                        len = 3;
                    }
                    for (var i = 0; i < len; i++) {
                        $("#actItemSearchResultMob").append("<li value='" + response.products[i]['Sku'] + "'>" + "<div class='s_thumb'><a href='javascript:;'><img data-src='" + response.products[i]['Image'] + "' alt='" + response.products[i]['Name'] + "' title='" + response.products[i]['Name'] + "'></a></div><div class='s_info' style='text-align:left'>" + "<span class='s_sku'>" + response.products[i]['Sku'] + "</span><span class='s_price'>" + response.products[i]['Price'] + "</span>" + "</div><div class='cart_btn'><button name='addcartbtn' class='addb2bcartbtn' value='" + response.products[i]['Sku'] + "'>Add</div>" + "</li>");
                    }
                    if (len == 0) {
                        $("#actItemSearchResultMob").append("<li ><a href='javascript:void(0);'>No Record Found</li>");
                    }
                    $(".addb2bcartbtn").bind("click", function () {
                        var styleno = $(this).val();
                        console.log('styleno=' + styleno);
                        global_addtob2bcart(styleno);
                    });
                }
            }
        });
    } else if (search == "") {
        $("#actItemSearchResult").empty();
        $("#actItemSearchResult").hide();
        $("#actItemSearchResultMob").empty();
        $("#actItemSearchResultMob").hide();
    }


    

}
</script>
<script data-file="b2bsearch/imageSearch.js">const IMAGE_SEARCH_URL = '/ajax/eshop/newsearchImageSearch';
const IMAGE_SEARCH_RESULTS_PAGE_URL = '/products-advanced3';

const IMAGE_SEARCH_PREVIEW_STORAGE_KEY = 'imageSearchPreview';
const IMAGE_SEARCH_PREVIEW_MAX_WIDTH = 160;

const IMAGE_SEARCH_DATABASE_NAME = 'imageSearch';
const IMAGE_SEARCH_FILE_STORE_NAME = 'searchedImages';

const IMAGE_SEARCH_ERROR_OVERLAYS = {
    imageTooLarge: '#imageTooLargeOverlay',
    unsupportedType: '#imageUnsupportedTypeOverlay',
    notRecognized: '#imageNotRecognizedOverlay',
};

// The preview is either a small copy of the uploaded file or the pasted image URL, both usable as an image source.
async function runImageSearch(formData, previewImage) {
    showLoader(true);
    try {
        const response = await fetch(IMAGE_SEARCH_URL, {
            method: 'POST',
            body: formData,
        });
        const result = await response.json();

        if (result.imagesearchtoken) {
            storeImageSearchPreview(result.imagesearchtoken, await previewImage);
            // formData holds the uploaded file, or nothing at all when the search was run from a URL.
            await storeImageSearchFile(result.imagesearchtoken, formData.get('image'));
            window.location.href = `${IMAGE_SEARCH_RESULTS_PAGE_URL}?imagesearchtoken=${result.imagesearchtoken}`;
            return;
        }
        showLoader(false);
        showImageSearchError(result.error);
    } catch (error) {
        console.error('Error running the image search:', error);
        showLoader(false);
        showImageSearchError('notRecognized');
    }
}

function searchByImageFile(imageFile) {
    const formData = new FormData();
    formData.append('image', imageFile);
    // The preview is built while the search runs so that it does not hold up the upload.
    runImageSearch(formData, createImageSearchPreview(imageFile));
}

function searchByImageURL(imageURL) {
    if (!imageURL) return;
    const formData = new FormData();
    formData.append('imageURL', imageURL);
    runImageSearch(formData, imageURL);
}

function showImageSearchError(errorCode) {
    // A URL we could not download is shown inline on the input, everything else gets its own dialog.
    if (errorCode === 'invalidImageURL') {
        showImageURLerror(true);
        return;
    }
    closeImageSearchOverlays();
    $(IMAGE_SEARCH_ERROR_OVERLAYS[errorCode] || IMAGE_SEARCH_ERROR_OVERLAYS.notRecognized).css('display', 'flex');
}

function closeImageSearchOverlays() {
    $('#imageSearchOverlay').css('display', 'none');
    $('#imageSearchOverlayMobile').css('display', 'none');
    $('#image-url-input').val('');
    $('#image-url-input-mobile').val('');
}

function openImageSearchOverlay() {
    const screenWidth = window.innerWidth || document.documentElement.clientWidth || document.body.clientWidth;
    if (screenWidth > 600) {
        $('#imageSearchOverlay').css('display', 'flex');
    } else {
        $('#imageSearchOverlayMobile').css('display', 'flex');
    }
}

function addButtonsFunctionality() {
    $('#aisearchbar-image-search, #imageSearchIconMobile').on('click', function () {
        openImageSearchOverlay();
    });

    $('.close-btn').on('click', function () {
        closeImageSearchOverlays();
        showImageURLerror(false);
    });

    $('#cancelImageSearch').on('click', function () {
        localStorage.removeItem(IMAGE_SEARCH_PREVIEW_STORAGE_KEY);
        setSearchBarIntoImageSearchMode(false);
        $('#ai-search-input').focus();
    });

    $('.search-btn').on('click', async function () {
        searchByImageURL($('#image-url-input').val());
    });

    $('.search-btn-mobile').on('click', async function () {
        searchByImageURL($('#image-url-input-mobile').val());
    });

    //Image URL input reset error on change
    $('#image-url-input, #image-url-input-mobile').on('change', function () {
        showImageURLerror(false);
    });

    // Close the Too Large Overlay
    $('#imageTooLargeOverlay .close-btn').on('click', function () {
        $('#imageTooLargeOverlay').css('display', 'none');
        closeImageSearchOverlays();
    });

    $('.image-too-large-ok-btn').on('click', function () {
        $('#imageTooLargeOverlay').css('display', 'none');
        openImageSearchOverlay();
    });

    // Close the Unsupported Image Type Overlay
    $('#imageUnsupportedTypeOverlay .close-btn').on('click', function () {
        $('#imageUnsupportedTypeOverlay').css('display', 'none');
        closeImageSearchOverlays();
    });

    $('.image-unsupported-type-ok-btn').on('click', function () {
        $('#imageUnsupportedTypeOverlay').css('display', 'none');
        openImageSearchOverlay();
    });

    // Close the Image Not Recognized Overlay
    $('#imageNotRecognizedOverlay .close-btn').on('click', function () {
        $('#imageNotRecognizedOverlay').css('display', 'none');
        closeImageSearchOverlays();
    });

    $('.image-not-recognized-ok-btn').on('click', function () {
        $('#imageNotRecognizedOverlay').css('display', 'none');
        openImageSearchOverlay();
    });
}

function addManualFileUploadFunctionality() {
    $(".upload-link, #fileInputMobile").on("click", function () {
        $("#fileInput").click();
    });

    $("#fileInput").on("change", function (event) {
        const file = event.target.files[0];
        if (!file) return;

        searchByImageFile(file);
        $("#fileInput").val("");
    });
}

function addDragAndDropFunctionality() {
    const mainOverlay = $("#imageSearchOverlay");
    let dragCounter = 0;

    function isFileDrag(event) {
        return event.originalEvent.dataTransfer && Array.from(event.originalEvent.dataTransfer.types).includes("Files");
    }

    mainOverlay.on("dragenter", (event) => {
        if (isFileDrag(event)) {
            event.preventDefault();
            dragCounter++;
            if (dragCounter === 1) {
                showBigDropArea(true);
            }
        }
    });

    mainOverlay.on("dragover", (event) => {
        if (isFileDrag(event)) {
            event.preventDefault(); // Necessary to allow drop
        }
    });

    mainOverlay.on("dragleave", (event) => {
        dragCounter--;
        if (dragCounter === 0) {
            showBigDropArea(false);
        }
    });

    mainOverlay.on("drop", (event) => {
        event.preventDefault();
        dragCounter = 0;
        showBigDropArea(false);

        if (event.originalEvent.dataTransfer && event.originalEvent.dataTransfer.files.length > 0) {
            searchByImageFile(event.originalEvent.dataTransfer.files[0]);
        }
    });
}

function showBigDropArea(mode) {
    if (mode) {
        $('.notDragging').css('display', 'none');
        $('.dragging').css('display', 'flex');
    } else {
        $('.dragging').css('display', 'none');
        $('.notDragging').css('display', 'block');
    }
}

function showLoader(mode) {
    if (mode) {
        $('#loader').css('display', 'block');
    } else {
        $('#loader').css('display', 'none');
    }
}

/** Downscaled copy of the uploaded image, small enough to keep in localStorage for the search bar. */
function createImageSearchPreview(imageFile) {
    return new Promise((resolve) => {
        const objectURL = URL.createObjectURL(imageFile);
        const image = new Image();

        image.onload = function () {
            const scale = Math.min(1, IMAGE_SEARCH_PREVIEW_MAX_WIDTH / image.width);
            const canvas = document.createElement('canvas');
            canvas.width = image.width * scale;
            canvas.height = image.height * scale;
            canvas.getContext('2d').drawImage(image, 0, 0, canvas.width, canvas.height);
            URL.revokeObjectURL(objectURL);
            resolve(canvas.toDataURL('image/jpeg', 0.7));
        };

        image.onerror = function () {
            URL.revokeObjectURL(objectURL);
            resolve('');
        };

        image.src = objectURL;
    });
}

/**
 * The searched image is kept in localStorage only to display it in the search bar. A single key is
 * used so that every search replaces the previous image, and it is dropped as soon as it is stale.
 */
function storeImageSearchPreview(imageSearchToken, previewImage) {
    if (!previewImage) return;
    try {
        localStorage.setItem(IMAGE_SEARCH_PREVIEW_STORAGE_KEY, JSON.stringify({ imageSearchToken, previewImage }));
    } catch (error) {
        console.error('Could not store the image search preview:', error);
    }
}

function openImageSearchDatabase() {
    return new Promise((resolve, reject) => {
        const openRequest = indexedDB.open(IMAGE_SEARCH_DATABASE_NAME, 1);
        openRequest.onupgradeneeded = () => openRequest.result.createObjectStore(IMAGE_SEARCH_FILE_STORE_NAME);
        openRequest.onsuccess = () => resolve(openRequest.result);
        openRequest.onerror = () => reject(openRequest.error);
    });
}

/**
 * The uploaded image is kept in IndexedDB because filtering an image search re-runs it on the
 * API, which needs the image again. Only the latest search is kept, like the preview above.
 */
async function storeImageSearchFile(imageSearchToken, imageFile) {
    if (!imageFile) return;
    try {
        const database = await openImageSearchDatabase();
        const transaction = database.transaction(IMAGE_SEARCH_FILE_STORE_NAME, 'readwrite');
        transaction.objectStore(IMAGE_SEARCH_FILE_STORE_NAME).clear();
        transaction.objectStore(IMAGE_SEARCH_FILE_STORE_NAME).put(imageFile, imageSearchToken);
        // The page leaves for the results as soon as this resolves, so the write has to be committed.
        await new Promise(resolve => {
            transaction.oncomplete = resolve;
            transaction.onerror = resolve;
        });
    } catch (error) {
        console.error('Could not store the searched image:', error);
    }
}

async function readImageSearchFile(imageSearchToken) {
    try {
        const database = await openImageSearchDatabase();
        const fileRequest = database.transaction(IMAGE_SEARCH_FILE_STORE_NAME).objectStore(IMAGE_SEARCH_FILE_STORE_NAME).get(imageSearchToken);
        return await new Promise((resolve) => {
            fileRequest.onsuccess = () => resolve(fileRequest.result || null);
            fileRequest.onerror = () => resolve(null);
        });
    } catch (error) {
        console.error('Could not read the searched image:', error);
        return null;
    }
}

function readImageSearchPreview(imageSearchToken) {
    try {
        const storedPreview = JSON.parse(localStorage.getItem(IMAGE_SEARCH_PREVIEW_STORAGE_KEY));
        if (storedPreview && storedPreview.imageSearchToken === imageSearchToken) {
            return storedPreview.previewImage;
        }
    } catch (error) {
        console.error('Could not read the image search preview:', error);
    }
    localStorage.removeItem(IMAGE_SEARCH_PREVIEW_STORAGE_KEY);
    return '';
}

/** The results page renders the token of the search, the search bar only displays it. */
function showImageSearchInSearchBar() {
    const imageSearchToken = $('#hidden-image-search-token').val();
    if (!imageSearchToken) return;

    const previewImage = readImageSearchPreview(imageSearchToken);
    if (previewImage) {
        $('#imageSearchPreview img').attr('src', previewImage);
        $('#imageSearchPreview').css('display', 'block');
    }
    setSearchBarIntoImageSearchMode(true);
}

function setSearchBarIntoImageSearchMode(mode) {
    if (mode) {
        $('#ai-search-input').attr('placeholder', 'Image Search').css('pointer-events', 'none');
        $('.aisearchbar-rightIconContainer').css('display', 'none');
        $('#cancelImageSearch').css('display', 'block');
    } else {
        $('#imageSearchPreview').css('display', 'none');
        $('#ai-search-input').attr('placeholder', 'Search here').css('pointer-events', 'all');
        $('.aisearchbar-rightIconContainer').css('display', 'flex');
        $('#cancelImageSearch').css('display', 'none');
    }
}

function showImageURLerror(show = true) {
    if (show) {
        $('#imageSearchOverlay .upload-area').css('padding-bottom', '6px');
        $('.image-url-fail').css('display', 'block');
        $('.image-link-input').css('border', '1px solid #CD2C3D');
        $('.image-link-input').css('color', '#CD2C3D');
    } else {
        $('#imageSearchOverlay .upload-area').css('padding-bottom', '20px');
        $('.image-url-fail').css('display', 'none');
        $('.image-link-input').css('border', '1px solid #D8D8D8');
        $('.image-link-input').css('color', '#000');
    }
}


// --------------- MAIN ----------------

$(document).ready(function () {
    addButtonsFunctionality();
    addManualFileUploadFunctionality();
    addDragAndDropFunctionality();
    showImageSearchInSearchBar();
});
</script>
<script data-file="notifications/notifications.js">document.addEventListener("DOMContentLoaded", function() {
    $("div.noti_inner ul a").click(function() {
        const $li = $(this).children("li");
        if ($li.hasClass("unread_ms")) {
            $li.removeClass("unread_ms");
            const $countContainer = $("div.cont span.cont_inner");
            const newCount = parseInt($countContainer.html(), 10) - 1;
            if (newCount <= 0) {
                $countContainer.hide();
            } else {
                $countContainer.text(newCount);
            }
        }
    });
})
</script>
<script data-file="cadNotice/cadNotice.js">window.addEventListener("load", function () {
    const pageURL = window.location.href;

    const pagesToShowCADnotice = [
        '/custom-order-platform-v3/#/create',
        '/custom-order-platform-v3',
        '/custom-order-platform-v3/#/advanced-create/',
        '/sod/pending-approval#/pending-approval',
        '/halo/#/advanced-create',
        '/halo',
    ];

    const showUntil = new Date('2026-10-09T00:00:00Z').getTime();
    const now = new Date().getTime();
    if (now > showUntil) {
        return;
    }

    const currentPageIsSOD = pagesToShowCADnotice.some(page => pageURL.includes(page));

    if (currentPageIsSOD) {
        console.log('SOD Page');
        $('.sod-cad-ok-btn').on('click', function () {
            $('#sodCadOverlay').hide();
        });
        $('.sod-cad-overlay .close-btn').on('click', function () {
            $('#sodCadOverlay').hide();
        });
        $('#sodCadOverlay').show();
    } else {
        console.log('not an SOD page');
        $('#sodCadOverlay').hide();
    }
}); </script>

            <script async src='https://www.googletagmanager.com/gtag/js?id=G-0TC3J7H9PJ'></script>
            <script>
                window.dataLayer = window.dataLayer || [];

                function gtag() {
                    dataLayer.push(arguments);
                }

                window.gtag('js', new Date());

                window.gtag('config', 'G-0TC3J7H9PJ');
            </script>
<script data-file="checkEmail.js">window.addEventListener("load", function () {
    console.log('checking for user email')
    const email = '';
    const userId = '';
    const noEmailMessageSuppressedUntil = localStorage.getItem('noEmailMessageSuppressedUntil');
    const showOverlay = !noEmailMessageSuppressedUntil || Math.floor(Date.now() / 1000) > parseInt(noEmailMessageSuppressedUntil);
    if ((!email || email == '') && showOverlay) {
        document.getElementById('noEmailOverlay').style.display = 'flex';
        const oneDayFromNow = Math.floor(Date.now() / 1000) + 24 * 60 * 60;
        localStorage.setItem('noEmailMessageSuppressedUntil', oneDayFromNow);
    }

    $('.no-email-cancel-btn, #noEmailOverlay .close-btn').on('click', function () {
        document.getElementById('noEmailOverlay').style.display = 'none';
    });

    $('.no-email-confirm-btn').on('click', function () {
        const email = $('#noEmailInput').val();
        const emailRegex = /^[^\s@]+@[^\s@]+\.[^\s@]+$/;
        if (email == '' || !emailRegex.test(email)) {
            $('#noEmailError').show();
            return;
        }
        $('#noEmailError').hide();
        $('#loader').show();
        if (email && email != '') {
            $.ajax({
                url: '/ajax/addEmail',
                type: 'POST',
                data: {
                    email: email,
                    userId: userId
                },
                success: function (response) {
                    $('#loader').hide();
                    const data = JSON.parse(response);
                    if (data.success) {
                        document.getElementById('noEmailOverlay').style.display = 'none';
                    } else {
                        $('#noEmailError').show();
                        $('#noEmailError').text(data.message);
                    }
                }
            });
        }
    });
}); </script>

                <script type="text/javascript"> 
                var klaviyo_viewed_category_data = {
                    "CategoryName" : "",
                    "URL": window.location.href,
                };
                dataLayer.push({
                    "event": "klaviyo_viewed_category",
                    "klaviyo_viewed_category_data": klaviyo_viewed_category_data
                });
                </script>
                

            <script type="text/javascript">
                (function(c,l,a,r,i,t,y){
                    c[a]=c[a]||function(){(c[a].q=c[a].q||[]).push(arguments)};
                    t=l.createElement(r);t.async=1;t.src="https://www.clarity.ms/tag/"+i;
                    y=l.getElementsByTagName(r)[0];y.parentNode.insertBefore(t,y);
                })(window, document, "clarity", "script", "r1hrdkdkpx");
            </script>
<!-- Google Tag Manager -->
                <script>(function(w,d,s,l,i){w[l]=w[l]||[];w[l].push({'gtm.start':
                new Date().getTime(),event:'gtm.js'});var f=d.getElementsByTagName(s)[0],
                j=d.createElement(s),dl=l!='dataLayer'?'&l='+l:'';j.async=true;j.src=
                'https://www.googletagmanager.com/gtm.js?id='+i+dl;f.parentNode.insertBefore(j,f);
                })(window,document,'script','dataLayer','GTM-TRRSKSKF');</script>
                <!-- End Google Tag Manager -->
</head>

<body class="iosfix" data-responsejs='{ "create": [ { "breakpoints": [0,320,768], "mode": "src", "prefix": "src" }]}'>
    <div class="wrapper" canvas="container">
        <header >
            <section class="header-row2 bg-color2">
                <div class="container">
                    <textarea style="position: absolute; top: -500px; left: -500px;" id="copyField" class="copyField">?gcnyload=/</textarea>
                    <div class="row">
                        <div class="col-sm-4 col-xs-3 hidden-md-up">
                            <div class="menu-icon">
                                <label for="spinner-form" class="spinner-spin">
									<div class="spinner diagonal part-1"></div>
									<div class="spinner horizontal"></div>
									<div class="spinner diagonal part-2"></div>
								</label>
                            </div>
                        </div>
                        <div class="col-sm-4 col-xs-6 col-md-3">
                            <div class="logo">
                                <h1>
                                    <!--<a href="https://embed.gabrielny.com/products-bridal">-->
                                    <a href="#">
                                        <img data-src="https://cdn-themes.gabrielny.com/site2017theme/images/logo.svg" class="logo-header" alt="Gabriel & Co Jewelry" title="Gabriel & Co Jewelry" />
                                    </a>
                                </h1>
                            </div>
                        </div>
                        <div class="col-sm-4 col-xs-3 hidden-md-up search-icon-991">
                            <span style="top: 16px;position: absolute;color: #FFFFFF;right: 54px;" class="copyLinkClipboard">
								<i class="fa fa-share" aria-hidden="true" style="font-size: 25px;" title="Copy link to clipboard."></i>
							</span>
                            <div class="search-icon fr">
                                <input type="checkbox" id="spinner-form1" />
                                <label for="spinner-form1" class="spinner-spin mob-search">
									<div class="spinner diagonal part-1"></div>
									<div class="spinner horizontal"></div>
									<div class="spinner diagonal part-2"></div>
								</label>
                            </div>
                        </div>
                    </div>
                    <div class="search-box">
                        <div class="search-box-inner">
                            <input class="form-control itemSearch" placeholder="Search" type="search">
                            <a href="javascript:void(0);" class="fa fa-search btnSearchEmbed"></a>
                        </div>
                    </div>
                </div>
            </section>
            <nav class="bg-color3">
                <div class="toplink-man">
                    <div class="container">
                        <ul class="toplink embedCls">
                            <!--<li><a href="https://embed.gabrielny.com/products-bridal"><span class="link-text hidden-md-up">Home</span> <i class="fa fa-home"></i></a></li>-->
                            <!---->
                            <!---->
                            <!---->
                            <!--<li><a href="https://embed.gabrielny.com/storelocator"><span class="link-text">Find a Store</span> <i class="fa fa-map-marker"></i></a></li>-->
                            <!--<li>
								<span style="color: #FFFFFF;" class="copyLinkClipboard">
									<i class="fa fa-share" aria-hidden="true" style="font-size: 25px;" title="Copy link to clipboard."></i>
								</span>
							</li>-->
                            <li><a href="https://embed.gabrielny.com/concierge?retailer={TopEmbedRet}"><span class="link-text">Contact Us</span> <i class="fa fa-comment-o"></i></a></li>
                            <li><a href="https://embed.gabrielny.com/ordertracking"><span class="link-text">Order Status</span> <i class="fa fa-truck"></i></a></li>
                            
                            <!--<li><a href="javascript:void(0);"><span class="link-text">faq</span> <i class="fa fa-question-circle-o"></i></a></li>-->
                            
                        </ul>
                    </div>
                </div>
                <div class="container">
    <ul class="menu">
        <li class="sub">
            <a href="javascript:void(0);" class="f1"><span class="f1table"><span class="f1table-cell">Engagement Rings</span></span><span class="menu-arrow fa fa-angle-right"></span></a>
            <div class="menu-inner">
                <div class="container">
                    <div class="row">
                        <div class="col-md-6">
                            <div class="menu-box">
                                <div class="menu-box-hd half-line">Settings <span class="menu-arrow fa fa-angle-right"></span></div>
                                <div class="menu-box-cont">
                                    <ul class="choose-list menu-setting">
                                        <li>
                                            <a href="https://embed.gabrielny.com/engagement-rings" class="choose-product"> <span class="thumb" style="width: 80px;"><img width="100%" src="https://cdn-images.gabrielny.com/is/image/GabrielCo/Default/~thmimg-setting-50.jpg" alt="All" /></span> <span class="name"><span>All</span></span>
                                            </a>
                                        </li>
                                        <li>
                                            <a href="https://embed.gabrielny.com/engagement-rings/halo-engagement-rings" class="choose-product"> <span class="thumb" style="width: 80px;"><img width="100%" src="https://cdn-images.gabrielny.com/is/image/GabrielCo/Default/~thmimg-Halo_50.jpg" alt="Halo" /></span> <span class="name"><span>Halo</span></span>
                                            </a>
                                        </li>
                                        <li>
                                            <a href="https://embed.gabrielny.com/engagement-rings/double-halo-engagement-rings" class="choose-product"> <span class="thumb" style="width: 80px;"><img width="100%" src="https://cdn-images.gabrielny.com/is/image/GabrielCo/Default/~thmimg-Double-Halo_50.jpg" alt="Double Halo" /></span> <span class="name"><span>Double Halo</span></span>
                                            </a>
                                        </li>
                                        <li>
                                            <a href="https://embed.gabrielny.com/engagement-rings/3-stones-engagement-rings" class="choose-product"> <span class="thumb" style="width: 80px;"><img width="100%" src="https://cdn-images.gabrielny.com/is/image/GabrielCo/Default/~thmimg-3-Stone_50.jpg" alt="3 Stone" /></span> <span class="name"><span>3 Stone</span></span>
                                            </a>
                                        </li>
                                        <li>
                                            <a href="https://embed.gabrielny.com/engagement-rings/3-stones-halo-engagement-rings" class="choose-product"> <span class="thumb" style="width: 80px;"><img width="100%" src="https://cdn-images.gabrielny.com/is/image/GabrielCo/Default/~thmimg-3-Stone-Halo_50.jpg" alt="3 Stone Halo" /></span> <span class="name"><span>3 Stone Halo</span></span>
                                            </a>
                                        </li>
                                        <li>
                                            <a href="https://embed.gabrielny.com/engagement-rings/free-form-engagement-rings" class="choose-product"> <span class="thumb" style="width: 80px;"><img width="100%" src="https://cdn-images.gabrielny.com/is/image/GabrielCo/Default/~thmimg-Freeform_50.jpg" alt="Free Form" /></span> <span class="name"><span>Free Form</span></span>
                                            </a>
                                        </li>
                                        <li>
                                            <a href="https://embed.gabrielny.com/engagement-rings/split-shank-engagement-rings" class="choose-product"> <span class="thumb" style="width: 80px;"><img width="100%" src="https://cdn-images.gabrielny.com/is/image/GabrielCo/Default/~thmimg-Split-Shank_50.jpg" alt="Split Shank" /></span> <span class="name"><span>Split Shank</span></span>
                                            </a>
                                        </li>
                                        <li>
                                            <a href="https://embed.gabrielny.com/engagement-rings/straight-engagement-rings" class="choose-product"> <span class="thumb" style="width: 80px;"><img width="100%" src="https://cdn-images.gabrielny.com/is/image/GabrielCo/Default/~thmimg-Straight_50.jpg" alt="Straight" /></span> <span class="name"><span>Straight</span></span>
                                            </a>
                                        </li>
                                        <li>
                                            <a href="https://embed.gabrielny.com/engagement-rings/solitaire-engagement-rings" class="choose-product"> <span class="thumb" style="width: 80px;"><img width="100%" src="https://cdn-images.gabrielny.com/is/image/GabrielCo/Default/~thmimg-Solitaire_50.jpg" alt="Solitaire" /></span> <span class="name"><span>Solitaire</span></span>
                                            </a>
                                        </li>
                                    </ul>
                                </div>
                            </div>
                        </div>
                        <div class="col-md-3">
                            <div class="menu-box">
                                <div class="menu-box-hd half-line">Life Style <span class="menu-arrow fa fa-angle-right"></span></div>
                                <div class="menu-box-cont">
                                    <ul class="menu-link">
                                        <!--<li><a href="https://embed.gabrielny.com/engagement-rings/itemStyles-2017"><span style="color:#fa451c">New! </span>Customize Your Ring</a></li>-->
                                        <li><a href="https://embed.gabrielny.com/engagement-rings/Division-GBBR">Gabriel</a></li>
                                        <!--<li><a href="https://embed.gabrielny.com/products-amavidabridal">AMAVIDA</a></li>-->
                                        <li><a href="https://embed.gabrielny.com/engagement-rings/Division-ADOR">Preset Rings</a></li>
                                        <li><a href="https://embed.gabrielny.com/renewal-bridal-collections">Renewal (Remount)</a></li>
                                        <li><a href="https://embed.gabrielny.com/engagement-rings/vintage-engagement-rings">Vintage</a></li>
                                    </ul>
                                </div>
                            </div>
                        </div>
                        <!--<div class="col-md-3">-->
                        <!--<div class="menu-box-hd half-line">Guides <span class="menu-arrow fa fa-angle-right"></span></div>-->
                        <!--<div class="menu-box-cont">-->
                        <!--<ul class="menu-link">-->
                        <!--<li><a href="https://embed.gabrielny.com/engagement-rings-settings/bridal">Discover Engagement</a></li>-->
                        <!--<li><a href="https://embed.gabrielny.com/life-stories">Life Stories</a></li>-->
                        <!--<li><a href="https://embed.gabrielny.com/engagement-rings/engagement-rings-guide">Engagement Ring Guide</a></li>-->
                        <!--<li><a href="https://embed.gabrielny.com/the-gabriel-experience">Why Choose Gabriel</a></li>-->
                        <!--</ul>-->
                        <!--</div>-->
                        <!--</div>-->
                    </div>
                    <div class="row">
                        <div class="col-md-6">
                            <div class="menu-box">
                                <div class="menu-box-hd half-line">Shape <span class="menu-arrow fa fa-angle-right"></span></div>
                                <div class="menu-box-cont">
                                    <ul class="choose-list menu-shape">
                                        <li>
                                            <a href="https://embed.gabrielny.com/engagement-rings/round-engagement-rings" class="choose-product"> <span class="thumb"><img data-src="https://cdn-images.gabrielny.com/is/image/GabrielCo/thmimg-shape-round?$trans$" alt="Round" /></span> <span class="name"><span>Round</span></span>
                                            </a>
                                        </li>
                                        <li>
                                            <a href="https://embed.gabrielny.com/engagement-rings/cushion-cut-engagement-rings" class="choose-product"> <span class="thumb"><img data-src="https://cdn-images.gabrielny.com/is/image/GabrielCo/thmimg-shape-cushion?$trans$" alt="Cushion" /></span> <span class="name"><span>Cushion</span></span>
                                            </a>
                                        </li>
                                        <li>
                                            <a href="https://embed.gabrielny.com/engagement-rings/oval-engagement-rings" class="choose-product"> <span class="thumb"><img data-src="https://cdn-images.gabrielny.com/is/image/GabrielCo/thmimg-shape-oval?$trans$" alt="Oval" /></span> <span class="name"><span>Oval</span></span>
                                            </a>
                                        </li>
                                        <li>
                                            <a href="https://embed.gabrielny.com/engagement-rings/princess-cut-engagement-rings" class="choose-product"> <span class="thumb"><img data-src="https://cdn-images.gabrielny.com/is/image/GabrielCo/thmimg-shape-princess?$trans$" alt="Princess" /></span> <span class="name"><span>Princess</span></span>
                                            </a>
                                        </li>
                                        <li>
                                            <a href="https://embed.gabrielny.com/engagement-rings/emerald-cut-engagement-rings" class="choose-product"> <span class="thumb"><img data-src="https://cdn-images.gabrielny.com/is/image/GabrielCo/thmimg-shape-emerald?$trans$" alt="Emerald" /></span> <span class="name"><span>Emerald</span></span>
                                            </a>
                                        </li>
                                        <li>
                                            <a href="https://embed.gabrielny.com/engagement-rings/pear-shaped-engagement-rings" class="choose-product"> <span class="thumb"><img data-src="https://cdn-images.gabrielny.com/is/image/GabrielCo/thmimg-shape-pear?$trans$" alt="Pear" /></span> <span class="name"><span>Pear</span></span>
                                            </a>
                                        </li>
                                        <li>
                                            <a href="https://embed.gabrielny.com/engagement-rings/marquise-engagement-rings" class="choose-product"> <span class="thumb"><img data-src="https://cdn-images.gabrielny.com/is/image/GabrielCo/thmimg-shape-marquise?$trans$" alt="Marquise" /></span> <span class="name"><span>Marquise</span></span>
                                            </a>
                                        </li>
                                    </ul>
                                </div>
                            </div>
                        </div>
                        <div class="col-md-6 tal tac-sm">
                            <div class="range-slider-man menu-range-slider">
                                <div class="range-slider-hd tal">price range</div>
                                <div class="range-slider-content">
                                    <div class="range-slider">
                                        <div class="catinner">
                                            <div class="slider-corner">
                                                <div id="menu-slider-price-range"></div>
                                            </div>
                                        </div>
                                        <div class="serch-input">
                                            <div class="fl" id="menu_dminprice">$&nbsp;1238</div>
                                            <div class="fr" id="menu_dmaxprice">$&nbsp;7162</div>
                                            <input type="hidden" name="menu_price_low" id="menu_price_low" value="1238" />
                                            <input type="hidden" name="menu_min_price" id="menu_min_price" value="1238" />
                                            <input type="hidden" name="menu_price_high" id="menu_price_high" value="7162" />
                                            <input type="hidden" name="menu_max_price" id="menu_max_price" value="7162" />
                                        </div>
                                    </div>
                                    <div class="clearfix"></div>
                                    <div class="tac"><a href="javascript:void(0);" class="btn btn2" id="btnTopPriceRange">ok</a></div>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </li>
        <li class="sub">
            <a href="javascript:void(0);" class="f1"><span class="f1table"><span class="f1table-cell">Wedding Rings</span></span><span class="menu-arrow fa fa-angle-right"></span></a>
            <div class="menu-inner">
                <div class="container">
                    <div class="row">
                        <div class="col-md-6">
                            <div class="menu-box no-border">
                                <div class="menu-box-hd half-line hidden-sm-down">Wedding Rings <span class="menu-arrow fa fa-angle-right"></span></div>
                                <div class="menu-box-cont block">
                                    <ul class="choose-list menu-wedding-rings">
                                        <li>
                                            <a href="https://embed.gabrielny.com/diamond-bands/category-AN" class="choose-product"> <span class="thumb"><img data-src="https://cdn-images.gabrielny.com/is/image/GabrielCo/Default/~thmimg-Anniversary-Bands-Thumbnail_120.jpg" alt="Anniversary Bands" /></span> <span class="name"><span>Anniversary Bands</span></span>
                                            </a>
                                        </li>
                                        <li>
                                            <a href="https://embed.gabrielny.com/diamond-bands/eternity-anniversary-rings" class="choose-product"> <span class="thumb"><img data-src="https://cdn-images.gabrielny.com/is/image/GabrielCo/Default/~thmimg-Eternity-Bands-Thumbnail_120.jpg" alt="Eternity Bands" /></span> <span class="name"><span>Eternity Bands</span></span>
                                            </a>
                                        </li>
                                        <li>
                                            <a href="https://embed.gabrielny.com/diamond-bands/curved-anniversary-bands" class="choose-product"> <span class="thumb"><img data-src="https://cdn-images.gabrielny.com/is/image/GabrielCo/Default/~thmimg-Curved-Rings-Thumbnail_120.jpg" alt="Curved Bands" /></span> <span class="name"><span>Curved Bands</span></span>
                                            </a>
                                        </li>
                                        <li>
                                            <a href="https://embed.gabrielny.com/diamond-bands/fancy-anniversary-bands" class="choose-product"> <span class="thumb"><img data-src="https://cdn-images.gabrielny.com/is/image/GabrielCo/Default/~thmimg-Fancy-Rings-Thumbnail_120.jpg" alt="Fancy Bands" /></span> <span class="name"><span>Fancy Bands</span></span>
                                            </a>
                                        </li>
                                        <li>
                                            <a href="https://embed.gabrielny.com/diamond-bands/ring-jacket-anniversary-bands" class="choose-product"> <span class="thumb"><img data-src="https://cdn-images.gabrielny.com/is/image/GabrielCo/Default/~thmimg-Rings-Jackets-Wrap-Thumbnail_120.jpg" alt="Ring Jackets" /></span> <span class="name"><span>Ring  Jackets</span></span>
                                            </a>
                                        </li>
                                    </ul>
                                </div>
                            </div>
                        </div>
                        <div class="col-md-6 hidden-sm-down pt15"><img data-src="https://cdn-images.gabrielny.com/is/image/GabrielCo/Default/~thmimg-Wedding-Rings-eternity.jpg" alt=""></div>
                    </div>
                </div>
            </div>
        </li>
    </ul>
</div>
            </nav>
        </header>
        <main>
            <br />
<b>Fatal error</b>:  Call to a member function hasConfig() on array in <b>/var/www/vhosts/gabrielny.com/_production/site/application/_icarus/IcarusFunctions.php</b> on line <b>90</b><br />

Latest requests

# Url Url Source Date
1 https://embed.gabrielny.com/ 2026-10-16 17:04:28
2 https://www.guardiandoors.net/ 2026-10-16 17:04:28
3 https://www.texarkanatwins.com/%25… 2026-10-16 17:04:28
4 https://surfaceprorefinishing.b-cd… 2026-10-16 17:04:28
5 https://www.texarkanatwins.com/%25… 2026-10-16 17:04:28
6 https://henrikq530cxu6.celticwiki.… 2026-10-16 17:04:27
7 http://datuangka.org/ 2026-10-16 17:04:27
8 https://www.thebolditalic.com/?gi=… 2026-10-16 17:04:26
9 https://auth.mediacorp.sg/u/login?… 2026-10-16 17:04:26
10 https://gratisafhalen.be/author/sh… 2026-10-16 17:04:25
11 https://www.thebolditalic.com/?gi=… 2026-10-16 17:04:24
12 https://www.thebolditalic.com/?gi=… 2026-10-16 17:04:24
13 https://dinkes.burukab.go.id/ 2026-10-16 17:04:23
14 https://torpedosapi-00001.web.app/ 2026-10-16 17:04:23
15 https://allmyfaves.com/regaisphzv 2026-10-16 17:04:23
16 https://www.thebolditalic.com/?gi=… 2026-10-16 17:04:23
17 https://www.thebolditalic.com/?gi=… 2026-10-16 17:04:23
18 https://auth.mediacorp.sg/u/login?… 2026-10-16 17:04:21
19 https://www.texarkanatwins.com/%25… 2026-10-16 17:04:21
20 https://www.texarkanatwins.com/&%2… 2026-10-16 17:04:20