// source --> https://ambassadorinteriors.com/wp-content/plugins/responsive-lightbox/js/front.js?ver=2.7.8 
(e=>{const t=(e,t)=>{const a=new RegExp("[?&]"+e.replace(/[\[\]]/g,"\\$&")+"(=([^&#]*)|&|#|$)").exec("&"+t);return a&&a[2]?decodeURIComponent(a[2].replace(/\+/g," ")):""},a=(e,t,a)=>{"undefined"!=typeof MutationObserver&&new MutationObserver((e,l)=>{t?e[0].addedNodes.length&&a():(e[0].addedNodes.length||e[0].removedNodes.length)&&a()}).observe(e,{childList:!0,subtree:!0})};e(()=>{l()}),e(document).on(rlArgs.customEvents,()=>{l()});const l=()=>{const t=[];if(e(".rl-gallery-container").each((a,l)=>{const r=e(l);r.hasClass("rl-pagination-infinite")?t.push(r):r.removeClass("rl-loading")}),t.length>0){const a=[];for(let l=0;l<t.length;l++){const r=t[l],i=r.find(".rl-gallery"),o=parseInt(r.data("gallery_id")),n=r.find(".rl-pagination-bottom").data("button"),s=void 0!==n&&"manually"===n;a[l]={container:r,gallery:i,galleryId:o,galleryButton:s},a[l].gallery.infiniteScroll({path:`.rl-gallery-container[data-gallery_id="${a[l].galleryId}"] .rl-pagination-bottom .next`,append:`.rl-gallery-container[data-gallery_id="${a[l].galleryId}"] .rl-gallery-item`,status:!1,hideNav:`.rl-gallery-container[data-gallery_id="${a[l].galleryId}"] .rl-pagination-bottom`,prefill:!a[l].galleryButton,loadOnScroll:!0,scrollThreshold:!a[l].galleryButton&&400,button:!!a[l].galleryButton&&`.rl-gallery-container[data-gallery_id="${a[l].galleryId}"] .rl-load-more`,debug:!1,history:!1,responseBody:"text",onInit(){const t=a[l];t.container.hasClass("rl-pagination-infinite")&&t.galleryButton&&t.container.removeClass("rl-loading"),this.on("request",()=>{t.container.addClass("rl-loading")}),this.on("append",(a,l,r,i)=>{t.container.removeClass("rl-loading"),e.event.trigger({type:"doResponsiveLightbox",script:rlArgs.script,selector:rlArgs.selector,args:rlArgs,pagination_type:"infinite",gallery_id:t.galleryId,masonry:t.gallery.hasClass("rl-masonry-gallery")||t.gallery.hasClass("rl-basicmasonry-gallery"),delayLightbox:t.gallery.hasClass("rl-expander-gallery"),infinite:{gallery:t.gallery,body:a,items:r,response:i}})})}})}}e.event.trigger({type:"doResponsiveLightbox",script:rlArgs.script,selector:rlArgs.selector,args:rlArgs})};e(document).on("click",".rl-pagination a.page-numbers",a=>{const l=e(a.currentTarget),r=l.closest(".rl-gallery-container");if(r.hasClass("rl-pagination-ajax")){a.preventDefault(),a.stopPropagation();const i=r.data("gallery_id"),o=r.find(".rl-gallery").data("gallery_no");return r.addClass("rl-loading"),e.post(rlArgs.ajaxurl,{action:"rl-get-gallery-page-content",gallery_id:i,gallery_no:o,post_id:rlArgs.postId,page:t("rl_page",l.prop("href")),nonce:rlArgs.nonce,preview:rlArgs.preview?"true":"false",lightbox:rlArgs.script}).done(t=>{r.replaceWith(e(t).removeClass("rl-loading")),e.event.trigger({type:"doResponsiveLightbox",script:rlArgs.script,selector:rlArgs.selector,args:rlArgs,pagination_type:"ajax",gallery_id:i,gallery_no:o})}).always(()=>{r.removeClass("rl-loading")}),!1}}),e(document).on("doResponsiveLightbox",t=>{if(void 0!==t.masonry&&!0===t.masonry)return!1;const a=t.script,l=t.selector;if(void 0===a||void 0===l)return!1;const i=t.args;let o=!1;void 0!==t.delayLightbox&&!0===t.delayLightbox&&(o=!0),rl_view_image=(t,a)=>{e.event.trigger({type:"doLightboxViewImage",script:t,url:a})},rl_hide_image=(t,a)=>{e.event.trigger({type:"doLightboxHideImage",script:t,url:a})},setTimeout(()=>{const t=e(".flex-viewport");if(i.woocommerce_gallery){const l=e(".woocommerce-product-gallery");0===l.find(".woocommerce-product-gallery__trigger").length&&(l.prepend('<a href="#" class="woocommerce-product-gallery__trigger">🔍</a>'),l.on("click",".woocommerce-product-gallery__trigger",e=>{if(e.preventDefault(),e.stopPropagation(),"lightgallery"===a)if(t.length){const e=t.find(".flex-active-slide a[data-rel] img"),a=t.find(".flex-active-slide a[data-rel]").data("lg-id");e.trigger("click.lgcustom-item-"+a)}else{const e=l.find("a[data-rel]").first();e.find("img").trigger("click.lgcustom-item-"+e.data("lg-id"))}else if("fancybox_pro"===a)if(t.length){const e=t.find(".flex-active-slide").index(),a=t.find(".flex-active-slide a[data-rel]").data("fancybox");Fancybox.fromOpener(`[data-fancybox="${a}"]`,{startIndex:e})}else{const e=l.find("a[data-rel]").first();Fancybox.fromOpener(`[data-fancybox="${e.data("fancybox")}"]`,{startIndex:0})}else t.length?t.find(".flex-active-slide a[data-rel]").trigger("click"):l.find("a[data-rel]").first().trigger("click")}))}},10),o?setTimeout(()=>{r(t)},0):r(t)});const r=t=>{const l=t.script,r=t.selector,i=t.args;switch(l){case"swipebox":let o=e("#swipebox-overlay").find(".slide.current"),n="",s=!1,d=!1;e(`a[rel*="${r}"], a[data-rel*="${r}"]`).swipebox({useCSS:i.animation,useSVG:i.useSVG,hideCloseButtonOnMobile:i.hideCloseButtonOnMobile,removeBarsOnMobile:i.removeBarsOnMobile,hideBarsDelay:i.hideBars?parseInt(i.hideBarsDelay):0,videoMaxWidth:parseInt(i.videoMaxWidth),loopAtEnd:i.loopAtEnd,afterOpen:()=>{d=!1,o=e("#swipebox-overlay").find(".slide.current");const t=o.find("img").attr("src");void 0!==t?(n=t,rl_view_image(l,n)):n="",a(document.getElementById("swipebox-slider"),!1,()=>{if(""===n){const e=o.find("img").attr("src");void 0!==e?(n=e,rl_view_image(l,n)):n=""}})},nextSlide:()=>{o=e("#swipebox-overlay").find(".slide.current");const t=o.find("img").attr("src");void 0!==t?(n=t,rl_view_image(l,n)):n=""},prevSlide:()=>{o=e("#swipebox-overlay").find(".slide.current");const t=o.find("img").attr("src");void 0!==t?(n=t,rl_view_image(l,n)):n=""},afterClose:()=>{d=!0,s&&(rl_hide_image(l,n),s=!1)}}),e(window).on("resize",()=>{d||(s=!0)});break;case"prettyphoto":let c=!1,g="";e(`a[rel*="${r}"], a[data-rel*="${r}"]`).each((t,a)=>{const l=e(a);let r=l.data("rl_title"),i=l.data("rl_caption");if(r=r?r.replace(/[^]/g,e=>"&#"+e.charCodeAt(0)+";"):"",i=i?i.replace(/[^]/g,e=>"&#"+e.charCodeAt(0)+";"):"",l.attr("title",i),r){const e=l.find("img"),t=e.attr("alt");void 0!==t&&""!==t||e.attr("alt",r)}}),e(`a[rel*="${r}"], a[data-rel*="${r}"]`).prettyPhoto({hook:"data-rel",animation_speed:i.animationSpeed,slideshow:!!i.slideshow&&parseInt(i.slideshowDelay),autoplay_slideshow:i.slideshowAutoplay,opacity:i.opacity,show_title:i.showTitle,allow_resize:i.allowResize,allow_expand:i.allowExpand,default_width:parseInt(i.width),default_height:parseInt(i.height),counter_separator_label:i.separator,theme:i.theme,horizontal_padding:parseInt(i.horizontalPadding),hideflash:i.hideFlash,wmode:i.wmode,autoplay:i.videoAutoplay,modal:i.modal,deeplinking:i.deeplinking,overlay_gallery:i.overlayGallery,keyboard_shortcuts:i.keyboardShortcuts,social_tools:i.social?`<div class="pp_social"><div class="twitter"><a href="//twitter.com/share" class="twitter-share-button" data-count="none">Tweet</a><script type="text/javascript" src="//platform.twitter.com/widgets.js"><\/script></div><div class="facebook"><iframe src="//www.facebook.com/plugins/like.php?locale=en_US&href=${location.href}&amp;layout=button_count&amp;show_faces=true&amp;width=500&amp;action=like&amp;font&amp;colorscheme=light&amp;height=23" scrolling="no" frameborder="0" style="border:none; overflow:hidden; width:500px; height:23px;" allowTransparency="true"></iframe></div></div>`:"",ie6_fallback:!0,changepicturecallback:()=>{c?c=!1:(g=e("#pp_full_res").find("img").attr("src"),rl_view_image(l,g),i.allowExpand&&e("a.pp_expand").on("click",()=>{c=!0}))},callback:()=>{rl_hide_image(l,g)}});break;case"nivo":e.each(e(`a[rel*="${r}"], a[data-rel*="${r}"]`),(t,a)=>{const l=e(a);let i=l.attr("data-rel");const o=l.data("rl_content");void 0!==i&&0!=i||(i=l.attr("rel")),void 0!==i&&!1!==i&&(i.startsWith(r+"-gallery-")||"gallery"===o||e(`a[data-rel="${i}"], a[rel="${i}"]`).length>1)&&l.attr("data-lightbox-gallery",i)});let p=!1,h=!0,f="";e(`a[rel*="${r}"], a[data-rel*="${r}"]`).nivoLightbox({effect:i.effect,clickOverlayToClose:i.clickOverlayToClose,keyboardNav:i.keyboardNav,errorMessage:i.errorMessage,afterShowLightbox:t=>{const r=e(t)[0].find(".nivo-lightbox-content");p||(p=!0,a(document.getElementsByClassName("nivo-lightbox-content")[0],!0,()=>{h&&(f=r.find(".nivo-lightbox-image img").attr("src"),rl_view_image(l,f),h=!1)}))},afterHideLightbox:()=>{h=!0,rl_hide_image(l,f)},onPrev:e=>{h=!1,f=e[0].attr("href"),rl_view_image(l,f)},onNext:e=>{h=!1,f=e[0].attr("href"),rl_view_image(l,f)}});break;case"imagelightbox":let m=[],u="";e(`a[rel*="${r}"], a[data-rel*="${r}"]`).each((t,a)=>{let l=e(a).attr("data-rel");void 0!==l&&!1!==l&&"norl"!==l?m.push(l):(l=e(a).attr("rel"),void 0!==l&&!1!==l&&"norl"!==l&&m.push(l))}),m.length>0&&(m=_.uniq(m),e(m).each((a,r)=>{void 0!==t.pagination_type&&e(`a[data-rel="${r}"], a[rel="${r}"]`).each((t,a)=>{e(a).off("click.imageLightbox")}),e(`a[data-rel="${r}"], a[rel="${r}"]`).imageLightbox({animationSpeed:parseInt(i.animationSpeed),preloadNext:i.preloadNext,enableKeyboard:i.enableKeyboard,quitOnEnd:i.quitOnEnd,quitOnImgClick:i.quitOnImageClick,quitOnDocClick:i.quitOnDocumentClick,onLoadEnd:()=>{u=e("#imagelightbox").attr("src"),rl_view_image(l,u)},onEnd:()=>{rl_hide_image(l,u)}})}));break;case"tosrus":let y=[],w="";const v=["jpg","jpe","jpeg","gif","png","webp","avif"];e(`a[rel*="${r}"], a[data-rel*="${r}"]`).each((t,a)=>{let l=e(a).attr("data-rel");void 0!==l&&!1!==l&&"norl"!==l?y.push(l):(l=e(a).attr("rel"),void 0!==l&&!1!==l&&"norl"!==l&&y.push(l))}),y.length>0&&(y=_.uniq(y),e(y).each((a,r)=>{void 0!==t.pagination_type&&(e("body").find(".tosrus-"+r).remove(),e(`a[data-rel="${r}"], a[rel="${r}"]`).each((t,a)=>{e(a).off("click.tos")}));const o=e(`a[data-rel="${r}"], a[rel="${r}"]`).tosrus({drag:!0,infinite:i.infinite,media:{image:{filterAnchors:function(e){const t=e.attr("href");if("string"!=typeof t)return!1;const a=t.toLowerCase().split(/[?#]/)[0].split(".").pop();return v.indexOf(a)>-1}}},autoplay:{play:i.autoplay,pauseOnHover:i.pauseOnHover,timeout:i.timeout},effect:i.effect,keys:{prev:i.keys,next:i.keys,close:i.keys},pagination:{add:i.pagination,type:i.paginationType},show:!1,buttons:!0,caption:{add:!0,attributes:["title"]},wrapper:{classes:"tosrus-"+r,onClick:i.closeOnClick?"close":"toggleUI"}});o.on("sliding.tos",(t,a)=>{w=e(e(t.target).find(".tos-slider .tos-slide")[a]).find("img").attr("src"),rl_view_image(l,w)}),o.on("closing.tos",()=>{rl_hide_image(l,w)})}));break;case"featherlight":{const a=/\.(png|jpg|jpeg|gif|tiff?|bmp|svg|webp|avif)(?:[?#].*)?$/i;delete e.featherlight.contentFilters.jquery,e.extend(e.featherlight.contentFilters,{html:{regex:/[^]/,process:t=>e("<div>",{text:t})}}),e.featherlight.contentFilters.image.regex=a,e.featherlight.contentFilters.ajax.process=function(t){var a=e("<div/>");return e.get(t).done(function(e){a.html(window.RLG&&window.RLG.sanitizeHtml?window.RLG.sanitizeHtml(e):e)}).fail(function(){a.text("No content found.")}).promise(a)},e.featherlight.contentFilters.iframe.process=function(t){if(window.RLG&&window.RLG.isAllowedEmbedUrl&&!window.RLG.isAllowedEmbedUrl(t)){var a=e("<div/>");return a.text("Iframe not allowed."),a.contents()}var l=e("<div/>"),r=e("<iframe>",{src:t});return r.attr({allowfullscreen:"",webkitallowfullscreen:"",mozallowfullscreen:""}),l.append(r),l.contents()},e.featherlight.contentFilters.image.process=function(t){if(window.RLG&&window.RLG.isAllowedMediaUrl&&!window.RLG.isAllowedMediaUrl(t)){var a=e("<div/>");return a.text("Image not allowed."),a.contents()}var l=e.Deferred(),r=new Image,i=e("<img>",{alt:"",class:this.namespace+"-image"});return r.onload=function(){i.naturalWidth=r.width,i.naturalHeight=r.height,l.resolve(i)},r.onerror=function(){l.reject(i)},i.attr("src",t),r.src=t,l.promise()},e.featherlight.readElementConfig=function(e,t){return{}};let o=[],n="";e('a[rel*="'+r+'"], a[data-rel*="'+r+'"]').each((t,a)=>{let l=e(a).attr("data-rel");void 0!==l&&!1!==l&&"norl"!==l?o.push(l):(l=e(a).attr("rel"),void 0!==l&&!1!==l&&"norl"!==l&&o.push(l))}),o.length>0&&(o=_.uniq(o),e.extend(e.featherlight.defaults,{contentFilters:["image","html","ajax","iframe","text"],openSpeed:parseInt(i.openSpeed),closeSpeed:parseInt(i.closeSpeed),closeOnClick:i.closeOnClick,closeOnEsc:i.closeOnEsc,afterOpen:e=>{n=e.currentTarget.href,rl_view_image(l,n)},afterClose:()=>{rl_hide_image(l,n)}}),e(o).each((a,l)=>{const r=e('a[data-rel="'+l+'"], a[rel="'+l+'"]'),o=e(r[0]).data("rl_content"),n="gallery"===o||/-gallery-/.test(l)||r.length>1,s="video"===o||/-video-/.test(l);void 0!==t.pagination_type&&r.each((t,a)=>{e(a).off("click.featherlight")}),n&&!s?r.featherlightGallery({galleryFadeIn:parseInt(i.galleryFadeIn),galleryFadeOut:parseInt(i.galleryFadeOut),previousIcon:"&#10094;",nextIcon:"&#10095;"}):r.featherlight()}));break}case"magnific":{let t=[];e('a[rel*="'+r+'"], a[data-rel*="'+r+'"]').each((a,l)=>{let r=e(l).attr("data-rel");void 0!==r&&!1!==r&&"norl"!==r?t.push(r):(r=e(l).attr("rel"),void 0!==r&&!1!==r&&"norl"!==r&&t.push(r))}),t.length>0&&(t=_.uniq(t),e(t).each((t,a)=>{const r=e('a[data-rel="'+a+'"], a[rel="'+a+'"]'),o=e(r[0]);let n=o.data("magnific_type");const s=o.data("rl_content");void 0!==s&&(n=s),void 0===n&&(n="image");let d="auto",c="auto";"true"===i.fixedContentPos?d=!0:"false"===i.fixedContentPos&&(d=!1),"true"===i.fixedBgPos?c=!0:"false"===i.fixedBgPos&&(c=!1),r.magnificPopup({allowHTMLInStatusIndicator:!1,allowHTMLInTemplate:!0,type:"gallery"===n?"image":"video"===n?"iframe":n,disableOn:i.disableOn,midClick:i.midClick,preloader:i.preloader,closeOnContentClick:i.closeOnContentClick,closeOnBgClick:i.closeOnBgClick,closeBtnInside:i.closeBtnInside,showCloseBtn:i.showCloseBtn,enableEscapeKey:i.enableEscapeKey,alignTop:i.alignTop,autoFocusLast:i.autoFocusLast,fixedContentPos:d,fixedBgPos:c,image:{titleSrc:e=>{let t=e.el.data("rl_title"),a=e.el.data("rl_caption");return t=t?t.replace(/[^]/g,e=>"&#"+e.charCodeAt(0)+";"):"",a=a?a.replace(/[^]/g,e=>"&#"+e.charCodeAt(0)+";"):"",t+"<small>"+a+"</small>"}},gallery:{enabled:r.length>1&&"gallery"===n,navigateByImgClick:!0,preload:[0,1]},callbacks:{close(){rl_hide_image(l,this.currItem.src)},imageLoadComplete(){rl_view_image(l,this.currItem.src)},elementParse:e=>{e.src.trim().includes("<")&&("inline"===e.type?e.src="<div>HTML is disallowed.</div>":"iframe"!==e.type&&"ajax"!==e.type||(e.src=""))}}})}));break}case"glightbox":{void 0!==window.rl_glightbox&&null!==window.rl_glightbox&&window.rl_glightbox.destroy();const t=`a[rel*="${r}"]:not([rel*="-video-"]), a[data-rel*="${r}"]:not([data-rel*="-video-"])`;e(t).each((t,a)=>{const l=e(a),r=l.data("rl_title"),i=l.data("rl_caption");r&&l.attr("data-title",window.RLG&&window.RLG.sanitizeHtml?window.RLG.sanitizeHtml(r):r),i&&l.attr("data-description",window.RLG&&window.RLG.sanitizeHtml?window.RLG.sanitizeHtml(i):i);const o=l.attr("data-rel")||l.attr("rel");o&&l.attr("data-gallery",o)}),window.rl_glightbox=GLightbox({selector:t,slideEffect:i.slideEffect,closeButton:i.closeButton,touchNavigation:i.touchNavigation,keyboardNavigation:i.keyboardNavigation,closeOnOutsideClick:i.closeOnOutsideClick,loop:i.loop,zoomable:i.zoomable,moreLength:0,preload:!1}),window.rl_glightbox.on("slide_after_load",e=>{rl_view_image(l,e.slideConfig.href)}),window.rl_glightbox.on("close",()=>{const e=window.rl_glightbox.index,t=window.rl_glightbox.elements[e];t&&t.href&&rl_hide_image(l,t.href)});break}}}})(jQuery);
// source --> https://ambassadorinteriors.com/wp-content/plugins/slider-wd/js/jquery.mobile.js?ver=1.0.46 
/*! jQuery Mobile v1.3.2 | Copyright 2010, 2013 jQuery Foundation, Inc. | jquery.org/license */
(function(e,t,n){typeof define=="function"&&define.amd?define(["jquery"],function(r){return n(r,e,t),r.mobile}):n(e.jQuery,e,t)})(this,document,function(e,t,n,r){(function(e,t,n,r){function x(e){while(e&&typeof e.originalEvent!="undefined")e=e.originalEvent;return e}function T(t,n){var i=t.type,s,o,a,l,c,h,p,d,v;t=e.Event(t),t.type=n,s=t.originalEvent,o=e.event.props,i.search(/^(mouse|click)/)>-1&&(o=f);if(s)for(p=o.length,l;p;)l=o[--p],t[l]=s[l];i.search(/mouse(down|up)|click/)>-1&&!t.which&&(t.which=1);if(i.search(/^touch/)!==-1){a=x(s),i=a.touches,c=a.changedTouches,h=i&&i.length?i[0]:c&&c.length?c[0]:r;if(h)for(d=0,v=u.length;d<v;d++)l=u[d],t[l]=h[l]}return t}function N(t){var n={},r,s;while(t){r=e.data(t,i);for(s in r)r[s]&&(n[s]=n.hasVirtualBinding=!0);t=t.parentNode}return n}function C(t,n){var r;while(t){r=e.data(t,i);if(r&&(!n||r[n]))return t;t=t.parentNode}return null}function k(){g=!1}function L(){g=!0}function A(){E=0,v.length=0,m=!1,L()}function O(){k()}function M(){_(),c=setTimeout(function(){c=0,A()},e.vmouse.resetTimerDuration)}function _(){c&&(clearTimeout(c),c=0)}function D(t,n,r){var i;if(r&&r[t]||!r&&C(n.target,t))i=T(n,t),e(n.target).trigger(i);return i}function P(t){var n=e.data(t.target,s);if(!m&&(!E||E!==n)){var r=D("v"+t.type,t);r&&(r.isDefaultPrevented()&&t.preventDefault(),r.isPropagationStopped()&&t.stopPropagation(),r.isImmediatePropagationStopped()&&t.stopImmediatePropagation())}}function H(t){var n=x(t).touches,r,i;if(n&&n.length===1){r=t.target,i=N(r);if(i.hasVirtualBinding){E=w++,e.data(r,s,E),_(),O(),d=!1;var o=x(t).touches[0];h=o.pageX,p=o.pageY,D("vmouseover",t,i),D("vmousedown",t,i)}}}function B(e){if(g)return;d||D("vmousecancel",e,N(e.target)),d=!0,M()}function j(t){if(g)return;var n=x(t).touches[0],r=d,i=e.vmouse.moveDistanceThreshold,s=N(t.target);d=d||Math.abs(n.pageX-h)>i||Math.abs(n.pageY-p)>i,d&&!r&&D("vmousecancel",t,s),D("vmousemove",t,s),M()}function F(e){if(g)return;L();var t=N(e.target),n;D("vmouseup",e,t);if(!d){var r=D("vclick",e,t);r&&r.isDefaultPrevented()&&(n=x(e).changedTouches[0],v.push({touchID:E,x:n.clientX,y:n.clientY}),m=!0)}D("vmouseout",e,t),d=!1,M()}function I(t){var n=e.data(t,i),r;if(n)for(r in n)if(n[r])return!0;return!1}function q(){}function R(t){var n=t.substr(1);return{setup:function(r,s){I(this)||e.data(this,i,{});var o=e.data(this,i);o[t]=!0,l[t]=(l[t]||0)+1,l[t]===1&&b.bind(n,P),e(this).bind(n,q),y&&(l.touchstart=(l.touchstart||0)+1,l.touchstart===1&&b.bind("touchstart",H).bind("touchend",F).bind("touchmove",j).bind("scroll",B))},teardown:function(r,s){--l[t],l[t]||b.unbind(n,P),y&&(--l.touchstart,l.touchstart||b.unbind("touchstart",H).unbind("touchmove",j).unbind("touchend",F).unbind("scroll",B));var o=e(this),u=e.data(this,i);u&&(u[t]=!1),o.unbind(n,q),I(this)||o.removeData(i)}}}var i="virtualMouseBindings",s="virtualTouchID",o="vmouseover vmousedown vmousemove vmouseup vclick vmouseout vmousecancel".split(" "),u="clientX clientY pageX pageY screenX screenY".split(" "),a=e.event.mouseHooks?e.event.mouseHooks.props:[],f=e.event.props.concat(a),l={},c=0,h=0,p=0,d=!1,v=[],m=!1,g=!1,y="addEventListener"in n,b=e(n),w=1,E=0,S;e.vmouse={moveDistanceThreshold:10,clickDistanceThreshold:10,resetTimerDuration:1500};for(var U=0;U<o.length;U++)e.event.special[o[U]]=R(o[U]);y&&n.addEventListener("click",function(t){var n=v.length,r=t.target,i,o,u,a,f,l;if(n){i=t.clientX,o=t.clientY,S=e.vmouse.clickDistanceThreshold,u=r;while(u){for(a=0;a<n;a++){f=v[a],l=0;if(u===r&&Math.abs(f.x-i)<S&&Math.abs(f.y-o)<S||e.data(u,s)===f.touchID){t.preventDefault(),t.stopPropagation();return}}u=u.parentNode}}},!0)})(e,t,n),function(e){e.mobile={}}(e),function(e,t){var r={touch:"ontouchend"in n};e.mobile.support=e.mobile.support||{},e.extend(e.support,r),e.extend(e.mobile.support,r)}(e),function(e,t,r){function l(t,n,r){var i=r.type;r.type=n,e.event.dispatch.call(t,r),r.type=i}var i=e(n);e.each("touchstart touchmove touchend tap taphold swipe swipeleft swiperight scrollstart scrollstop".split(" "),function(t,n){e.fn[n]=function(e){return e?this.bind(n,e):this.trigger(n)},e.attrFn&&(e.attrFn[n]=!0)});var s=e.mobile.support.touch,o="touchmove scroll",u=s?"touchstart":"mousedown",a=s?"touchend":"mouseup",f=s?"touchmove":"mousemove";e.event.special.scrollstart={enabled:!0,setup:function(){function s(e,n){r=n,l(t,r?"scrollstart":"scrollstop",e)}var t=this,n=e(t),r,i;n.bind(o,function(t){if(!e.event.special.scrollstart.enabled)return;r||s(t,!0),clearTimeout(i),i=setTimeout(function(){s(t,!1)},50)})}},e.event.special.tap={tapholdThreshold:750,setup:function(){var t=this,n=e(t);n.bind("vmousedown",function(r){function a(){clearTimeout(u)}function f(){a(),n.unbind("vclick",c).unbind("vmouseup",a),i.unbind("vmousecancel",f)}function c(e){f(),s===e.target&&l(t,"tap",e)}if(r.which&&r.which!==1)return!1;var s=r.target,o=r.originalEvent,u;n.bind("vmouseup",a).bind("vclick",c),i.bind("vmousecancel",f),u=setTimeout(function(){l(t,"taphold",e.Event("taphold",{target:s}))},e.event.special.tap.tapholdThreshold)})}},e.event.special.swipe={scrollSupressionThreshold:10,durationThreshold:1000,horizontalDistanceThreshold:10,verticalDistanceThreshold:475,start:function(t){var n=t.originalEvent.touches?t.originalEvent.touches[0]:t;return{time:(new Date).getTime(),coords:[n.pageX,n.pageY],origin:e(t.target)}},stop:function(e){var t=e.originalEvent.touches?e.originalEvent.touches[0]:e;return{time:(new Date).getTime(),coords:[t.pageX,t.pageY]}},handleSwipe:function(t,n){n.time-t.time<e.event.special.swipe.durationThreshold&&Math.abs(t.coords[0]-n.coords[0])>e.event.special.swipe.horizontalDistanceThreshold&&Math.abs(t.coords[1]-n.coords[1])<e.event.special.swipe.verticalDistanceThreshold&&t.origin.trigger("swipe").trigger(t.coords[0]>n.coords[0]?"swipeleft":"swiperight")},setup:function(){var t=this,n=e(t);n.bind(u,function(t){function o(t){if(!i)return;s=e.event.special.swipe.stop(t),Math.abs(i.coords[0]-s.coords[0])>e.event.special.swipe.scrollSupressionThreshold&&t.preventDefault()}var i=e.event.special.swipe.start(t),s;n.bind(f,o).one(a,function(){n.unbind(f,o),i&&s&&e.event.special.swipe.handleSwipe(i,s),i=s=r})})}},e.each({scrollstop:"scrollstart",taphold:"tap",swipeleft:"swipe",swiperight:"swipe"},function(t,n){e.event.special[t]={setup:function(){e(this).bind(n,e.noop)}}})}(e,this)});
// source --> https://ambassadorinteriors.com/wp-content/plugins/slider-wd/js/jquery.featureCarouselslider.js?ver=1.0.46 
(function($){
  $.fn.featureCarouselslider = function (options) {
    // Adds support for multiple carousels on one page.
    if (this.length > 1) {
      this.each(function() {
        $(this).featureCarouselslider(options);
      });
      return this;
    }

    // override the default options with user defined options
    options = $.extend({}, $.fn.featureCarouselslider.defaults, options || {});

    /* These are univeral values that are used throughout the plugin. Do not modify them
     * unless you know what you're doing. Most of them feed off the options
     * so most customization can be achieved by modifying the options values 
    */
    var pluginData = {      
     
      containerWidth:       0,
      containerHeight:      0,
      largeFeatureWidth:    0,
      largeFeatureHeight:   0,
      smallFeatureHeight:   0,
      smallFeatureWidth:    0,       
      totalFeatureCount:    $(this).children().first().children().first().children("span").length,
      featuresContainer:    $(this),
      featuresArray:        [],
      containerIDTag:       "." + $(this).attr("id"),
      timeoutVar:           null,
      rotationsRemaining:   0,
      itemsToAnimate:       0,
      borderWidth:		      0,     
      autoTime:             0   
    };

    /**
     * Function to preload the images in the carousel if desired.
     * This is not recommended if there are a lot of images in the carousel because
     * it may take a while. Functionality does not depend on preloading the images 
     */ 
    var preload = function(callback) {
      callback(); 
    }
 
    // Gets the feature container based on the number
    var getContainer = function(featureNum) {
      return pluginData.featuresArray[featureNum-1];
    }

    // get previous feature number
    var getPreviousNum = function(num) {
      if ((num - 1) == 0) {
        return pluginData.totalFeatureCount;
      } else {
        return num - 1;
      }
    }

    // get next feature number
    var getNextNum = function(num) {
      if ((num + 1) > pluginData.totalFeatureCount) {
        return 1;
      } else {
        return num + 1;
      }
    }

    /**
     * Because there are several options the user can set for the width and height
     * of the feature images, this function is used to determine which options were set
     * and to set the appropriate dimensions used for a small and large feature	
     */
    var setupFeatureDimensions = function() {
      // Set the height and width of the entire carousel container
      options.containerWidth = pluginData.featuresContainer.width();
      options.containerHeight = pluginData.featuresContainer.height();
    
      // Grab the first image for reference
      var $firstFeatureImage = $(pluginData.containerIDTag).find(".wds_slider_car_image" + options.wds_number + ":first");
 
      // Large Feature Width
      if (options.largeFeatureWidth > 1) {
        pluginData.largeFeatureWidth = options.largeFeatureWidth;
      }
	    else if (options.largeFeatureWidth > 0 && options.largeFeatureWidth < 1) {
        pluginData.largeFeatureWidth = $firstFeatureImage.width() * options.largeFeatureWidth;
      }
      else {
        pluginData.largeFeatureWidth = $firstFeatureImage.outerWidth();
      }
      // Large Feature Height
      if (options.largeFeatureHeight > 1) {
        pluginData.largeFeatureHeight = options.largeFeatureHeight;
      }
      else if (options.largeFeatureHeight > 0 && options.largeFeatureHeight < 1) {
        pluginData.largeFeatureHeight = $firstFeatureImage.height() * options.largeFeatureHeight;
      }
      else {
        pluginData.largeFeatureHeight = $firstFeatureImage.outerHeight();
      }
    }

    /**
     * Function to take care of setting up various aspects of the carousel,
     * most importantly the default positions for the features	
     */
    var setupCarousel = function() {
      // Set the total feature count to the amount the user wanted to cutoff
      if (options.displayCutoff > 0 && options.displayCutoff < pluginData.totalFeatureCount) {
        pluginData.totalFeatureCount = options.displayCutoff;
      }

      // Fill in the features array .
      pluginData.featuresContainer.find(".wds_slider_car_image" + options.wds_number).each(function (index) {
        if (index < pluginData.totalFeatureCount) {
          pluginData.featuresArray[index] = $(this);
        }
      });
 
      // Determine the total border width around the feature if there is one.
      if (pluginData.featuresContainer.find(".wds_slider_car_image" + options.wds_number).first().css("borderLeftWidth") != "medium") {
        pluginData.borderWidth = parseInt(pluginData.featuresContainer.find(".wds_slider_car_image" + options.wds_number).first().css("borderLeftWidth"))*2;
      }
      // Place all the features in a center hidden position to start off.
      if (options.imagecount != 1) {
        pluginData.featuresContainer
        .find(".wds_slider_car_image" + options.wds_number).each(function () {
          // Center all the features in the middle and hide them.
          $(this).css({
            'left': (options.containerWidth / 2) - (options.largeFeatureWidth * options.smallFeaturePar / 2) - (pluginData.borderWidth / 2) - options.parf,
            'width': options.largeFeatureWidth * options.smallFeaturePar * options.parametr / 100,
            'height': options.largeFeatureHeight * options.smallFeaturePar * options.parametr / 100,
            'top': options.smallFeatureOffset + options.topPadding + options.parf,
            'opacity': 0,
            'filter': 'Alpha(opacity=0)'
          });
        });
      } 
      else {
        pluginData.featuresContainer
        .find(".wds_slider_car_image" + options.wds_number).each(function () {
          // Center all the features in the middle and hide them.
          $(this).css({
            'left': 0,
            'width': options.largeFeatureWidth * options.smallFeaturePar,
            'height': options.largeFeatureHeight * options.smallFeaturePar,
            'top': 0,
            'opacity': 0,
            'filter': 'Alpha(opacity=0)'
          });
        });
      }        
      // Set position to relative of captions if displaying below image.
      if (options.captionBelow) {
        pluginData.featuresContainer.find(".wds_slider_car_image" + options.wds_number).css('position','absolute');
      }

      // Figure out number of items that will rotate each time.
      if (pluginData.totalFeatureCount < options.imagecount) {
        pluginData.itemsToAnimate = pluginData.totalFeatureCount;  
      }  else {
        pluginData.itemsToAnimate = options.imagecount + 2 ;
      }       
    }

    /**
     * Here all the position data is set for the features.
     * This is an important part of the carousel to keep track of where
     * each feature within the carousel is	 
     */
    var setupFeaturePositions = function() {
      // give all features a set number that won't change so they remember their
      // original order 
      $.each(pluginData.featuresArray, function (i) {
        $(this).data('setPosition', i + 1);
      });

      // Go back one - This is done because we call the move function right away, which
      // shifts everything to the right. So we set the current center back one, so that
      // it displays in the center when that happens
      var oneBeforeStarting = getPreviousNum(window["wds_currentCenterNum" +options.wds_number]);

      window["wds_currentCenterNum" +options.wds_number] = oneBeforeStarting;

      // Center feature will be position 1
      var $centerFeature = getContainer(oneBeforeStarting);
      $centerFeature.data('position', 1);

      // Everything before that center feature...
      var $prevFeatures = $centerFeature.prevAll();
      $prevFeatures.each(function (i) {
        $(this).data('position', (pluginData.totalFeatureCount - i));
      });
        
      // And everything after that center feature...
      var $nextFeatures = $centerFeature.nextAll();
      $nextFeatures.each(function (i) {
        if ($(this).data('setPosition') != undefined) {
          $(this).data('position',(i + 2));
        }
      });
    }

    /**
     * This function will set the autoplay for the carousel to
     * automatically rotate it given the time in the options
     * pass in TRUE to just clear the timer
     */
    var setTimer = function(stop) {
      return;
      // clear the timeout var if it exists
      clearTimeout(pluginData.timeoutVar);

      // set interval for moving if autoplay is set
      if (!stop && options.autoPlay != 0) {
        var autoTime = (Math.abs(options.autoPlay) < options.carouselSpeed) ? options.carouselSpeed : Math.abs(options.autoPlay);
        pluginData.timeoutVar = setTimeout(function () {
          (options.autoPlay > 0) ? initiateMove(true,1) : initiateMove(false,1);
        }, autoTime);
      }
    }
 
    // This is a helper function for the animateFeature function that
    // will update the positions of all the features based on the direction
    var rotatePositions = function(direction) {
      $.each(pluginData.featuresArray, function () {
        var newPos;
        if (direction == false) {
          newPos = getNextNum($(this).data().position);
        } else {
          newPos = getPreviousNum($(this).data().position);
        }

        $(this).data('position',newPos);
      });
    }

    /* Animate the given feature to the given location. Valid locations are "left", "right", "center", "hidden".*/
    var animateFeature = function($feature, direction, onload) {
      if (typeof onload == "undefined") {
        var onload = 0;
      }
      $feature.find(".wds_slideshow_image_" + options.wds_number).children().each(function() {
        jQuery(this).hide();
      });
      $feature.find(".wds_video_hide" + options.wds_number).each(function() {
        jQuery(this).show();
      });
      var new_width, new_height, new_top, new_left, new_zindex, new_padding, new_fade, new_fade1, new_left1;
      // Determine the old and new positions of the feature.
      var oldPosition = $feature.data('position');
      var newPosition;
      if (direction == true) {
        newPosition = getPreviousNum(oldPosition);
      }
      else {
        newPosition = getNextNum(oldPosition);
      }
      // Callback for moving out of center pos.
      if (oldPosition == 1) {
        options.leavingCenter($feature);
      }
      // Caculate new new css values depending on where the feature will be located center.
      if (newPosition == 1) {
        new_width = pluginData.largeFeatureWidth;        
        new_height = pluginData.largeFeatureHeight;
        new_top =(options.containerHeight / 2 - new_height / 2 );
        new_zindex = $feature.css("z-index");
        new_left = (options.containerWidth / 2) - (pluginData.largeFeatureWidth / 2) - (pluginData.borderWidth / 2);
        new_fade = 1.0;
        new_fade1 = 100;
        $feature.find(".wds_slideshow_image_" + options.wds_number).children().each(function() {
          jQuery(this).show();
        });
        $feature.find(".wds_video_hide" + options.wds_number).each(function() {
          jQuery(this).hide();
        });
      }
      else {
        // Left.
        if (newPosition <= pluginData.totalFeatureCount && newPosition > pluginData.totalFeatureCount - options.imagecount / 2 + 1) {
          new_width = (pluginData.largeFeatureWidth * Math.pow(options.smallFeaturePar, pluginData.totalFeatureCount - newPosition + 1));      
          new_height = (pluginData.largeFeatureHeight * Math.pow(options.smallFeaturePar, pluginData.totalFeatureCount - newPosition + 1));
          new_top = (options.containerHeight/ 2  - new_height / 2 ) ;         
          new_fade = 1;           
          new_fade1 = 100;          
          if(options.fit_containerWidth == false && options.smallFeaturePar < 1){
            new_left = (options.containerWidth / 2 - pluginData.largeFeatureWidth / 2)-(pluginData.largeFeatureWidth * (1 - options.smallFeaturePar) * options.smallFeaturePar * (pluginData.totalFeatureCount - newPosition + 1));             
          } else if(options.fit_containerWidth == false && options.smallFeaturePar == 1){
            new_left = (options.containerWidth / 2 - pluginData.largeFeatureWidth / 2)-(pluginData.largeFeatureWidth * ( options.smallFeaturePar) * options.smallFeaturePar * (pluginData.totalFeatureCount - newPosition + 1));             
          } else {
              new_left1 = (options.containerWidth / 2 - pluginData.largeFeatureWidth / 2) / (options.imagecount / 2 - 0.5);
              new_left =  ((options.containerWidth / 2) - (pluginData.largeFeatureWidth / 2) - (pluginData.borderWidth / 2)) - (new_left1 * (pluginData.totalFeatureCount - newPosition+1  ));             
          }                        
        }
        // Right.
        else if (newPosition >= 2 && newPosition <= options.imagecount / 2 + 1) {
          new_width = (pluginData.largeFeatureWidth * Math.pow(options.smallFeaturePar,newPosition - 1));
          new_height =( pluginData.largeFeatureHeight * Math.pow(options.smallFeaturePar, newPosition - 1));
          new_top = ( options.containerHeight / 2 - new_height / 2);
          new_fade = 1;
          new_fade1 = 100;
          if (options.fit_containerWidth == false && options.smallFeaturePar < 1) {
            new_left = (options.containerWidth / 2 + pluginData.largeFeatureWidth / 2) + (pluginData.largeFeatureWidth * options.smallFeaturePar * (1 - options.smallFeaturePar) * (newPosition - 1)) - new_width;
          } else if (options.fit_containerWidth == false && options.smallFeaturePar == 1) {
            new_left = (options.containerWidth / 2 + pluginData.largeFeatureWidth / 2) + (pluginData.largeFeatureWidth * options.smallFeaturePar * (options.smallFeaturePar) * (newPosition - 1)) - new_width;
          } else {
            new_left1 = ( (options.containerWidth / 2 -pluginData.largeFeatureWidth / 2)) / (options.imagecount / 2 - 0.5);
            new_left = (options.containerWidth / 2 + pluginData.largeFeatureWidth / 2) - new_width + (new_left1 * (newPosition - 1));
          }
        }
        // Hidden.
        else {
          new_left = (options.containerWidth / 2) - (pluginData.largeFeatureWidth * options.smallFeaturePar / 2) - (pluginData.borderWidth / 2);
          new_fade = 0;
          new_fade1 = 0;
        }
      }
      // This code block takes care of hiding the feature information if the feature is leaving the center.
      if (oldPosition == 1) {
        // Slide up the story information.
        $feature.find(".wds_slider_car_image" + options.wds_number).hide();
      }

      // Animate the feature div to its new location.
      $feature
        .animate(
          {
            width: new_width,
            height: new_height,
            top: new_top,
            left: new_left,                      
            opacity: new_fade,
            filter: new_fade1
          },
          onload ? 0 : options.carouselSpeed,
          options.animationEasing,
          function () {
            // Take feature info out of hiding if new position is center
            if (newPosition == 1) {
              // need to set the height to auto to accomodate caption if displayed below image
              if (options.captionBelow)
               $feature.css('height','auto');
              // fade in the feature information
              $feature.find(".wds_slider_car_image" + options.wds_number)
                .fadeTo("fast",0.85);
              // callback for moved to center
              options.movedToCenter($feature);
            }
            // decrement the animation queue
            pluginData.rotationsRemaining = pluginData.rotationsRemaining - 1;
            // have to change the z-index after the animation is done
            $feature.css("z-index", new_zindex);
            // change trackers if using them
            if (options.trackerIndividual || options.trackerSummation) {
              // just update the tracker once; once the new center feature has arrived in center
              if (newPosition == 1) {
                // figure out what item was just in the center, and what item is now in the center
                var newCenterItemNum = pluginData.featuresContainer.find(".wds_slider_car_image" + options.wds_number).index($feature) + 1;
                var oldCenterItemNum;
                if (direction == false) {
                  oldCenterItemNum = getNextNum(newCenterItemNum);
                }
                else {
                  oldCenterItemNum = getPreviousNum(newCenterItemNum);
                }
              }
            }

            // did all the the animations finish yet?
            var divide = pluginData.rotationsRemaining / pluginData.itemsToAnimate;
            if (divide % 1 == 0) {
              // Set moving to false.
              window["wds_currentlyMoving" +options.wds_number]   = false;
              // Change positions for all items.
              rotatePositions(direction);

              // Move carousel again if queue is not empty.
              if (pluginData.rotationsRemaining > 0)
                move(direction);
            }
            // Reset timer and auto rotate again.
            setTimer(false); 
          }
        )
        .end();
    }

    /* Move the carousel to the left or to the right. The features that
     * will move into the four positions are calculated and then animated
     * rotate to the RIGHT when direction is TRUE and
     * rotate to the LEFT when direction is FALSE.
     */
    var move = function(direction, onload) {
      // Set the carousel to currently moving
      window["wds_currentlyMoving" + options.wds_number]  = true;
      // Obtain the new feature positions based on the direction that the carousel is moving
      var $newCenter, $newLefts, $newRights, $newHidden, $curNum;

      if (direction == true) {
        // Shift features to the left
        $newCenter = getContainer(getNextNum(window["wds_currentCenterNum" +options.wds_number]));
        $newLefts = [];
        $curNum = window["wds_currentCenterNum" +options.wds_number];        
        for (var i = 1; i <= options.imagecount / 2 + 1; ++i) {
          $newLefts.push(getContainer($curNum));
          $curNum = getPreviousNum($curNum);
        }
        $newRights = [];
        $curNum = getNextNum(window["wds_currentCenterNum" + options.wds_number]);
        for (var i = 1; i <= options.imagecount / 2 + 1; ++i) {
          $curNum = getNextNum($curNum);
          $newRights.push(getContainer($curNum));
        }
        window["wds_currentCenterNum" + options.wds_number] = getNextNum(window["wds_currentCenterNum" + options.wds_number]);
      }
      else {
        $newCenter = getContainer(getPreviousNum(window["wds_currentCenterNum" +options.wds_number]));
        $newLefts = [];
        $curNum = getPreviousNum(window["wds_currentCenterNum" +options.wds_number]);        
        for (var i = 1; i <= options.imagecount / 2 +1; ++i) {
          $curNum = getPreviousNum($curNum);   
          $newLefts.push(getContainer($curNum));
        }
        $newRights = [];
        $curNum = window["wds_currentCenterNum" + options.wds_number];
        for (var i = 1; i <= options.imagecount / 2 + 1; ++i) {
          $newRights.push(getContainer($curNum));
          $curNum = getNextNum($curNum);
        }
        window["wds_currentCenterNum" +options.wds_number] = getPreviousNum(window["wds_currentCenterNum" + options.wds_number]);
      }
      // Animate the features into their new positions.
      for (i = 0; i < $newLefts.length; i++) {
        $newLefts[i].css("z-index", $newLefts.length - i + 3);
        animateFeature($newLefts[i], direction, onload);
      }
      $newCenter.css("z-index", Math.max($newLefts.length, $newRights.length) + 4);
      animateFeature($newCenter, direction, onload);
      for (i = 0; i < $newRights.length; i++) {
        $newRights[i].css("z-index", $newRights.length - i + 3);
        animateFeature($newRights[i], direction, onload);
      }
    }

    // This is used to relegate carousel movement throughout the plugin.
    // It will only initiate a move if the carousel isn't currently moving.
    // It will set the animation queue to the number of rotations given.
    var initiateMove = function(direction, rotations, onload) {
      if (typeof onload == "undefined") {
        var onload = 0;
      }
      if (window["wds_currentlyMoving" +options.wds_number]  == false) {
        var queue = rotations * pluginData.itemsToAnimate ;
        pluginData.rotationsRemaining = queue ;      
        window["wds_set_filmstrip_class_" + options.wds_number]();
        window["wds_set_dots_class_" + options.wds_number]();
        move(direction, onload);
      }
    }

    // Add event listener to all clicks within the features container
    // This is done to disable any links that aren't within the center feature
    $("a", pluginData.containerIDTag).on("click", function (event) {
      // travel up to the container
      var $parents = $(this).parentsUntil(pluginData.containerIDTag);
      // now check each of the feature divs within it
      $parents.each(function () {
        var position = $(this).data('position');
        // if there are more than just feature divs within the container, they will
        // not have a position and it may come back as undefined. Throw these out
        if (position != undefined) {
          // if any of the links on a feature OTHER THAN the center feature were clicked,
          // initiate a carousel move but then throw the link action away
          if (position != 1) {
            if (position == pluginData.totalFeatureCount) {
              initiateMove(false,1);
            } else if (position == 2) {
              initiateMove(true, 1);
            }
            event.preventDefault();
            return false;
          // if the position WAS the center (i.e. 1), fire callback
          } else {
            options.clickedCenter($(this));
          }
        }
      });
    });

    // Public functions.
    this.initialize = function () {
      // Call the preloader and pass in our callback, which is just a slew of function calls
      // that should only be executed after the images have been loaded
      preload(function () {
        setupFeatureDimensions();
        setupCarousel();
        if (window["wds_currentlyMoving" +options.wds_number]  == false ) {
          setupFeaturePositions();
          initiateMove(true, 1, 1);
        }
      }); 
      return this;
    };

    this.next = function() {
      initiateMove(true, 1);
    }
    this.prev = function () {
      initiateMove(false, 1);
    }
    this.shift = function (that) {
      var position = $(that).data('position');
      if (position == 1) {
        return;
      }
      if (position > pluginData.totalFeatureCount / 2 + 1) {
        initiateMove(false, pluginData.totalFeatureCount - position + 1);
        options.carouselSpeed = 400;
        options.animationEasing;
      }
      else {
        initiateMove(true, position - 1);
        options.carouselSpeed = 400;
        options.animationEasing;
      }
    }
    this.pause = function () {
      options.autoPlay = false;
      setTimer(true);
    }
    this.start = function () {
      options.autoPlay = options.interval;
      setTimer(false);
    }
    // Initialize the plugin.
    return this.initialize();
  };

  $.fn.featureCarouselslider.defaults = {
    // If zero, take original width and height of image
    // If between 0 and 1, multiply by original width and height (acts as a percentage)
    // If greater than one, use as a forced width/height for all of the images
    largeFeatureWidth :   0,
    largeFeatureHeight:		0,
    containerWidth:       0,
    containerHeight:      0,
    fit_containerWidth:   0,
    wds_number:           0,
    // how much to pad the top of the carousel
    topPadding:           20,
    // spacing between the sides of the container
    sidePadding:          50,
    // the additional offset to pad the side features from the top of the carousel
    smallFeatureOffset:		50,
    //smallFeature parameters
    smallFeaturePar:      0,
    // indicates which feature to start the carousel at
    startingFeature:      1,
    // speed in milliseconds it takes to rotate the carousel
    carouselSpeed:        400,
    // time in milliseconds to set interval to autorotate the carousel
    // set to zero to disable it, negative to go left
    autoPlay:             4000,
    interval:             true,
    //imagecounts
    imagecount:           7,
    // with autoplay enabled, set this option to true to have the carousel pause rotating
    // when a user hovers over any feature
    pauseOnHover:         true,
    // with autoplay enabled, set this option to completely stop the autorotate functionality
    stopOnHover:          false,
    // numbered blips can appear and be used to track the currently centered feature, as well as 
    // allow the user to click a number to move to that feature. Set to false to not process these at all
    // and true to process and display them//and true to process and display them
    trackerIndividual:    true,
    // a summation of the features can also be used to display an "x Of y" style of tracking
    // this can be combined with the above option as well
    trackerSummation:     true,
    // Will only display this many features in the carousel
    // set to zero to disable
    displayCutoff:        0,
    data:                 "",
    // an easing can be specified for the animation of the carousel
    animationEasing:      'swing',
    // display captions below the image instead of on top
    captionBelow:         false,
    parf:                 0,
    // callback function for when a feature has animated to the center
    movedToCenter:        $.noop,
    // callback function for when feature left center
    leavingCenter:        $.noop,
    // callback function for when center feature was clicked
    clickedCenter:        $.noop
  };
})(jQuery);
// source --> https://ambassadorinteriors.com/wp-content/plugins/slider-wd/js/wds_hotspot.js?ver=1.0.46 
function wds_display_hotspot() {
	jQuery(".wds_layer").each(function() {
		jQuery(this).hover(function() {
      jQuery(this).next().next().hide();
			jQuery(this).next().next().stop().fadeIn();
		  }, function() {
			  jQuery(this).next().next().stop().fadeOut();
		});
	});
}

function wds_hotspot_position(prefix, ratio) {
  if (typeof prefix == 'undefined' || prefix == "") {
    var hotspot_layer = ".hotspot_container";
  }
  else {
    hotspot_layer = "#" + prefix + "_div";
  }
  if (typeof ratio == 'undefined') {
    var ratio = 1;
  }
  var arrow_size = Math.round(7 * ratio);
  var distance = Math.round(20 * ratio);

  jQuery(hotspot_layer).each(function() {
    var layer_id = jQuery(this).attr("id").replace("_div", "");
    var text_pos = jQuery(this).attr("data-text_position");
    var slide_width = jQuery(this).parent().outerWidth();
    var slide_height = jQuery(this).parent().outerHeight();
    var layer_left = parseFloat(jQuery(this).css("left"));
    var layer_top = parseFloat(jQuery(this).css("top"));
    var layer_text_bgcolor = jQuery(this).find("span:nth-child(3)").css("background-color");

    var chw1, chw2, chw3, chh1, chh2, chh3, marginTop, left, right;
    var right_border, left_border, top_border, bottom_border, bottom_angle, top_angle;
    chw1 = parseFloat(jQuery(this).find("span:nth-child(1)").outerWidth());
    chw2 = parseFloat(jQuery(this).find("span:nth-child(2)").outerWidth());
    chw3 = parseFloat(jQuery(this).find("span:nth-child(3)").outerWidth());

    chh1 = parseFloat(jQuery(this).find("span:nth-child(1)").outerHeight());
    chh2 = parseFloat(jQuery(this).find("span:nth-child(2)").outerHeight());
    chh3 = parseFloat(jQuery(this).find("span:nth-child(3)").outerHeight());

    right_border = layer_left + ((text_pos == "top" || text_pos == "bottom") ? (chw3 / 2 + chw1 / 2) : (chw2 + chw3 + distance));
    left_border = layer_left - ((text_pos == "top" || text_pos == "bottom") ? (chw3 / 2 - chw1 / 2) : (chw3 + distance));

    top_border = (text_pos == "left" || text_pos == "right") ? layer_top : (layer_top - chh3 - distance);
    bottom_border = (text_pos == "left" || text_pos == "right") ? (layer_top + chh2) : (layer_top + chh2 + chh3 + distance);

    bottom_angle = layer_top + chh2 / 2 + chh3 / 2;
    top_angle = layer_top - chh3 / 2 + chh2 / 2;

    if (right_border > slide_width) {
      text_pos = "left";
    }
    else if (left_border < 0) {
      text_pos = "right";
    }
    else if (top_border < 0) {
      text_pos = "bottom";
    }
    else if (bottom_border > slide_height) {
      text_pos = "top";
    }

    if (top_angle < 0) {
      if (text_pos == "right") {
        text_pos = "top-left";
      }
      else if (text_pos == "left") {
        text_pos = "top-right";
      }
    }
    else if (bottom_angle > slide_height) {
      if (text_pos == "right") {
        text_pos = "bottom-left";
      }
      else if (text_pos == "left") {
        text_pos = "bottom-right";
      }
    }

    jQuery(this).find("span.hotspot_text_before").removeAttr("style");
    if (text_pos == "bottom-left") {
      marginTop = "-" + (chh3 - chw2) + "px";
      left = (chw2 + distance) + 'px';
      right = 'auto';
      jQuery(this).find("span.hotspot_text_before").css({
        left: "-" + arrow_size + "px",
        top: (chh3 - (2 * arrow_size + 3)) + "px",
        borderTop: arrow_size + "px solid transparent",
        borderBottom: arrow_size + "px solid transparent",
        borderRight: arrow_size + "px solid " + layer_text_bgcolor
      });
    }
    else if (text_pos == "bottom-right") {
      marginTop = "-" + (chh3 - chw2) + "px";
      left = 'auto';
      right = (chw2 + distance) + 'px';
      jQuery(this).find("span.hotspot_text_before").css({
        right: "-" + arrow_size + "px",
        top: (chh3 - (2 * arrow_size + 3)) + "px",
        borderTop: arrow_size + "px solid transparent",
        borderBottom: arrow_size + "px solid transparent",
        borderLeft: arrow_size + "px solid " + layer_text_bgcolor
      });
    }
    else if (text_pos == "top-left") {
      marginTop = 0;
      left = (chw2 + distance) + 'px';
      right = 'auto';
      jQuery(this).find("span.hotspot_text_before").css({
        left: "-" + arrow_size + "px",
        top: "3px",
        borderTop: arrow_size + "px solid transparent",
        borderBottom: arrow_size + "px solid transparent",
        borderRight: arrow_size + "px solid " + layer_text_bgcolor
      });
    }
    else if (text_pos == "top-right") {
      marginTop = 0;
      left = 'auto';
      console.log(chw2);
      right = (chw2 + distance) + 'px';
      jQuery(this).find("span.hotspot_text_before").css({
        right: "-" + arrow_size + "px",
        top: "3px",
        borderTop: arrow_size + "px solid transparent",
        borderBottom: arrow_size + "px solid transparent",
        borderLeft: arrow_size + "px solid " + layer_text_bgcolor
      });
    }
    else if (text_pos == "top") {
      marginTop = (-1 * (chh3 + distance)) + 'px';
      left = '-' + ((chw3 - chw2) / 2) + 'px';
      right = 'auto';
      jQuery(this).find("span.hotspot_text_before").css({
        left: (chw3 / 2 - arrow_size) + "px",
        bottom: "-" + arrow_size + "px",
        borderLeft: arrow_size + "px solid transparent",
        borderRight: arrow_size + "px solid transparent",
        borderTop: arrow_size + "px solid " + layer_text_bgcolor
      });
    }
    else if (text_pos == "bottom") {
      marginTop = (chw2 + distance) + 'px';
      left = '-' + ((chw3 - chw2) / 2) + 'px';
      right = 'auto';
      jQuery(this).find("span.hotspot_text_before").css({
        left: (chw3 / 2 - arrow_size) + "px",
        top: "-" + arrow_size + "px",
        borderLeft: arrow_size + "px solid transparent",
        borderRight: arrow_size + "px solid transparent",
        borderBottom: arrow_size + "px solid " + layer_text_bgcolor
      });
    }
    else if (text_pos == "left") {
      marginTop = (-1 * ((chh3 - chw2) / 2)) + "px";
      left = 'auto';
      right = (chw2 + distance) + 'px';
      jQuery(this).find("span.hotspot_text_before").css({
        right: "-" + arrow_size + "px",
        top: (chh3 / 2 - arrow_size) + "px",
        borderTop: arrow_size + "px solid transparent",
        borderBottom: arrow_size + "px solid transparent",
        borderLeft: arrow_size + "px solid " + layer_text_bgcolor
      });
    }
    else if (text_pos == "right") {
      marginTop = ((chw2 - chh3) / 2) + "px";
      left = (chw2 + distance) + 'px';
      right = 'auto';
      jQuery(this).find("span.hotspot_text_before").css({
        left: "-" + arrow_size + "px",
        top: (chh3 / 2 - arrow_size) + "px",
        borderTop: arrow_size + "px solid transparent",
        borderBottom: arrow_size + "px solid transparent",
        borderRight: arrow_size + "px solid " + layer_text_bgcolor
      });
    }
    jQuery(this).find(".wds_hotspot_text").css({ 
      marginTop : marginTop,
      left : left,
      right : right,
    });

    /*var random = Math.random() * 10;
    random = random.toFixed(2) + "s";
    jQuery(this).find("span:nth-child(2)").css({animationDelay: random, "-webkit-animation-delay": random});*/
  });
};
// source --> https://ambassadorinteriors.com/wp-content/plugins/slider-wd/js/wds_frontend.js?ver=1.0.46 
// Parallax.
function wds_parallax(wds, slide_id) {
  var current_key = jQuery("#wds_current_image_key_" + wds).val();
  var slide_id = window["wds_data_" + wds][current_key]["id"];
  var layers_cont = ".wds_slideshow_image_" + wds + ">[id^='wds_" + wds + "_slide" + slide_id + "_layer']";

  var slide_width = jQuery(".wds_slideshow_image_" + wds + "[image_id='" + slide_id + "']").outerWidth();
  var slide_height = jQuery(".wds_slideshow_image_" + wds + "[image_id='" + slide_id + "']").outerHeight();

  var zIndex_arr = [];
  var hor = [];
  var ver = [];
  
  jQuery(layers_cont).each(function() {
    jQuery(this).css({
      'transform': 'matrix3d(1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, -0.002, 0, 0, 0, 1)',
      '-ms-transform': 'matrix3d(1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, -0.002, 0, 0, 0, 1)',
      '-webkit-transform': 'matrix3d(1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, -0.002, 0, 0, 0, 1)',
      'transform-origin': '50% 50% 0px',
      '-ms-transform-origin': '50% 50% 0px',
      '-webkit-transform-origin': '50% 50% 0px'
    });
    var cur_zIndex = parseInt(jQuery(this).css("z-index"));
    hor[cur_zIndex] = 0;
    ver[cur_zIndex] = 0;
    zIndex_arr.push(cur_zIndex);
  });

  // Arithmetic average for layer movement direction.
  var average = (zIndex_arr[0] + zIndex_arr[zIndex_arr.length - 1]) / 2;

  zIndex_arr.sort();

  var last_position = {};
  jQuery("#wds_container1_" + wds).off("mousemove touchmove");
  jQuery("#wds_container1_" + wds).off("mouseleave touchcancel");

  jQuery("#wds_container1_" + wds).on("mousemove touchmove", function (event) {
    // Check to make sure there is data to compare against.
    if (typeof(last_position.x) != 'undefined') {
      // Get the change from last position to this position.
      var deltaX = last_position.x - event.clientX,
          deltaY = last_position.y - event.clientY;

      jQuery(layers_cont).each(function() {
        var cur_zIndex = jQuery(this).css('z-index');
        var layer_left = parseFloat(jQuery(this).css("left"));
        var layer_top = parseFloat(jQuery(this).css("top"));
        var layer_width = jQuery(this).outerWidth();
        var layer_height = jQuery(this).outerHeight();
        for (var j in zIndex_arr) {
          if (zIndex_arr[j] == cur_zIndex) {
            j = parseFloat(j);
            var step = (j + 1) / 10;
            // Check which direction had the highest amplitude and then figure out direction by checking if the value is greater or less than zero.
            if (Math.abs(deltaX) > Math.abs(deltaY) && deltaX > 0) {
              // Left.
              hor[cur_zIndex] = hor[cur_zIndex] + step;
            } else if (Math.abs(deltaX) > Math.abs(deltaY) && deltaX < 0) {
              // Right.
              hor[cur_zIndex] = hor[cur_zIndex] - step;
            } else if (Math.abs(deltaY) > Math.abs(deltaX) && deltaY > 0) {
              // Up.
              ver[cur_zIndex] = ver[cur_zIndex] + step;
            } else if (Math.abs(deltaY) > Math.abs(deltaX) && deltaY < 0) {
              // Down.
              ver[cur_zIndex] = ver[cur_zIndex] - step;
            }
            // Layer movement direction.
            var dir = (average >= cur_zIndex ? -1 : 1);

            if (layer_left + dir * hor[cur_zIndex] < 0) {
              hor[cur_zIndex] += dir * step;
            }
            if (layer_left + layer_width + dir * hor[cur_zIndex] > slide_width) {
              hor[cur_zIndex] -= dir * step;
            }
            if (layer_top + dir * ver[cur_zIndex] < 0) {
              ver[cur_zIndex] += dir * step;
            }
            if (layer_top + layer_height + dir * ver[cur_zIndex] > slide_height) {
              ver[cur_zIndex] -= dir * step;
            }
            jQuery(this).stop();
            jQuery(this).css({
              marginTop: (ver[cur_zIndex] *  dir).toFixed(2) + 'px',
              marginLeft: (hor[cur_zIndex] * dir).toFixed(2) + 'px'
            });
          }
        }
      });
    }
    // Set the new last position to the current for next time.
    last_position = {
      x : event.clientX,
      y : event.clientY
    };
    
  });
  // Reset layer positions on mouse out.
  jQuery("#wds_container1_" + wds).on("mouseleave touchcancel", function (event) {
    jQuery(layers_cont).each(function() {
      jQuery(this).animate({
          marginTop: 0,
          marginLeft: 0
        },
        500);
      var cur_zIndex = jQuery(this).css('z-index');
      hor[cur_zIndex] = 0;
      ver[cur_zIndex] = 0;
    });
  });
}

function wds_embed_slide_autoplay(slide_id){
  jQuery(slide_id).find("iframe:not([class^='wds_video_layer_frame'])").each(function () {
    if (typeof jQuery(this)[0].contentWindow != "undefined") {
      jQuery(this)[0].contentWindow.postMessage('{"event":"command","func":"playVideo","args":""}', '*');
      jQuery(this)[0].contentWindow.postMessage('{"method": "play"}', "*");
      jQuery(this)[0].contentWindow.postMessage('play', '*');
    }
  });
}

// Uploaded video.
function wds_video_dimenstion(wds, current_key) {
  var slide_id = window["wds_data_" + wds][current_key]["id"];
  var is_video = window["wds_data_" + wds][current_key]["is_video"];
  var autoplay = window["wds_data_" + wds][current_key]["target_attr_slide"];
  var bg_fit = window["wds_data_" + wds][current_key]["bg_fit"];
  var att_width = window["wds_data_" + wds][current_key]["width"];
  var att_height = window["wds_data_" + wds][current_key]["height"];
  if (is_video == 'video') {
    if (bg_fit == 'cover') {
      var video_slide_width = jQuery("#wds_slide_container_" + wds + "").width();
      var video_slide_height = jQuery("#wds_slide_container_" + wds + "").height();
      var video_width = att_width;
      var video_height = att_height;
      var ratio = video_width / video_height;
      if ((video_slide_width / video_slide_height) <= (video_width / video_height)) {
        jQuery("#wds_slide_" + wds + '_' + slide_id).attr("height", video_slide_height);
        video_width = jQuery("#wds_slide_" + wds + '_' + slide_id).height() * ratio ;
        video_width = (video_width - video_slide_width) / 2;
        jQuery("#wds_slide_" + wds + '_' + slide_id).css({'position': 'relative', 'left': -video_width});
      }
      else {
        jQuery("#wds_slide_" + wds + '_' + slide_id).attr("width", video_slide_width);
        video_height = jQuery("#wds_slide_" + wds + '_' + slide_id).width() / ratio ;
        video_height = (video_height - video_slide_height) / 2;
        jQuery("#wds_slide_" + wds + '_' + slide_id).css({'position': 'relative', 'top': -video_height});
      }
    }
    else {
      jQuery("#wds_slide_" + wds + '_' + slide_id).attr("height", "100%");
    }
    if (autoplay == 1) {
      jQuery("#wds_slide_" + wds + '_' + slide_id).get(0).load();		  
      jQuery("#wds_slide_" + wds + '_' + slide_id).get(0).play();
    }
  }
}

function wds_upvideo_layer_dimenstion(wds, key, j) {
  var slide_id = window["wds_data_" + wds][key]["id"];
  var data = window["wds_data_" + wds][key];
  var autoplay = window["wds_data_" + wds][key]["layer_" + j + "_video_autoplay"];
  var width = window["wds_data_" + wds][key]["layer_" + j + "_attr_width"];
  var height = window["wds_data_" + wds][key]["layer_" + j + "_attr_height"];

  if (data["layer_" + j + "_type"] == "upvideo")  {
    var video_layer_width = jQuery('#wds_' + wds + '_slide' + slide_id + '_layer' + data["layer_" + j + "_id"]).width();
    var video_layer_height = jQuery('#wds_' + wds + '_slide' + slide_id + '_layer' +data["layer_" + j + "_id"]).height();
    var video_width = width;
    var video_height = height;

    if ((video_layer_width / video_layer_height) <= (video_width / video_height)) {
      jQuery("#wds_slide_" + wds + "_" + slide_id + "_layer_" + data['layer_' + j + '_id']).attr("height", video_layer_height);
      video_width = jQuery("#wds_slide_" + wds + "_" + slide_id + "_layer_" + data['layer_' + j + '_id']).width();
      video_width = (video_width - video_layer_width) / 2;
      jQuery("#wds_slide_" + wds + "_" + slide_id + "_layer_" + data['layer_' + j + '_id']).css({'position': 'relative', 'left': -video_width});
    }
    else {
      jQuery("#wds_slide_" + wds + "_" + slide_id + "_layer_" + data['layer_' + j + '_id']).attr("width", video_layer_width);
      video_height = jQuery("#wds_slide_" + wds + "_" + slide_id + "_layer_" + data['layer_' + j + '_id']).height();
      video_height = (video_height - video_layer_height) / 2;
      jQuery("#wds_slide_" + wds + "_" + slide_id + "_layer_" + data['layer_' + j + '_id']).css({'position': 'relative', 'top': -video_height});
    }
    if (autoplay == 'on') {
      jQuery("#wds_slide_" + wds + "_" + slide_id + '_layer_' + data["layer_" + j + "_id"]).get(0).load();		  
      jQuery("#wds_slide_" + wds + "_" + slide_id + '_layer_' + data["layer_" + j + "_id"]).get(0).play();
    }
  } 
}

function wds_video_play_pause(id, wds) {
  if (jQuery(id).get(0).paused) {
    jQuery(id).get(0).play();
    jQuery('.wds_bigplay_' + wds).hide();
  }
  else {
    jQuery(id).get(0).pause();
    jQuery('.wds_bigplay_' + wds).show();
  }
}

function wsd_video_play_pause_layer(id, wds) {
  if (jQuery(id).get(0).paused) {
    jQuery(id).get(0).play();
    jQuery('.wds_bigplay_layer_' + wds).hide();
  }
  else {
    jQuery(id).get(0).pause();
    jQuery('.wds_bigplay_layer_' + wds).show();
  }
}

function wds_show_thumb(key, wds) {
  var data = window["wds_data_" + wds][key];
  var bg_fit = window["wds_data_" + wds][key]["bg_fit"];
  var full_width = window["wds_data_" + wds][key]["full_width"];
  var bull_position = window["wds_data_" + wds][key]["bull_position"];
  var image_url = data["image_thumb_url"];
  var dot_conteiner_width = jQuery('.wds_slideshow_dots_container_' + wds).width() / 2;
  var dot_conteiner_height = jQuery('.wds_slideshow_dots_container_' + wds).height();
  var wds_bulframe_width = jQuery('.wds_bulframe_' + wds).width() / 2;
  var dot_position = jQuery('#wds_dots_' + key + '_' + wds ).position();
  var dot_width = jQuery('#wds_dots_' + key + '_' + wds ).width() / 2;
  dot_position = dot_position.left;
  var childPos = jQuery('#wds_dots_' + key + '_' + wds ).offset();
  var parentPos = jQuery('.wds_slideshow_dots_thumbnails_' + wds).parent().offset();
  var childOffset = childPos.left - parentPos.left;
  var right_offset = 0;
  var rt = (dot_conteiner_width * 2) - childOffset;
  if (wds_bulframe_width >= rt && rt > 0 ){
    right_offset =  wds_bulframe_width - rt ;
    dot_width = 0;
  }
  if (full_width == '1') {
    if (wds_bulframe_width >= childOffset) {
      wds_bulframe_width = childOffset - parentPos.left ;  
      dot_width = 0;
    }
  }
  else {
    if (wds_bulframe_width >= childOffset) {
      wds_bulframe_width = childOffset ;  
      dot_width = 0;
    }
  }
  dot_position = childOffset - wds_bulframe_width + dot_width - right_offset ;
  jQuery('.wds_bulframe_' + wds ).css({
    'position' : 'absolute',
    'z-index' : '9999',
    'left': dot_position,
    'background-image' :'url("' + image_url + '")',
    'background-size' : bg_fit,
    'background-repeat' : 'no-repeat',
    'background-position' : 'center center'});
  jQuery('.wds_bulframe_' + wds ).css(bull_position, dot_conteiner_height);
  jQuery('.wds_bulframe_' + wds ).fadeIn();
}

function wds_hide_thumb(wds) {
  jQuery('.wds_bulframe_' + wds ).css({'background-image':''});
  jQuery('.wds_bulframe_' + wds ).fadeOut();
};