Service & Parts
*'+$('#paymentNoticeText').val()+'
'; } if (typeof $('#' + titleKey).attr('id') != 'undefined') $('#' + titleKey).remove(); if (typeof $('#' + dataKey).attr('id') != 'undefined') $('#' + dataKey).remove(); var divToAppend = (equipSection == true ? 'mainEquipCompareView' : 'mainCompareView'); $(html).appendTo('#' + divToAppend); removeEmptyRows(); }, setupTrimGroupsScrolling: function (container) { container = container || $("#styles-container"); if(container && container.find('.trim-group-list').length > 0) { var scroller = new Scroller(container[0], { listSelector: ".trim-group-list", onUpdateScroll: function () { //DWP-12480: Adjust the positioning of the tech specs popup when scrolling var currentMenuTechSpecs = container.find('.specSheet .menu-tech-specs'); if (currentMenuTechSpecs.length) { var specSheetOriginalLeft = currentMenuTechSpecs.data('original-left'); if (!specSheetOriginalLeft) { specSheetOriginalLeft = currentMenuTechSpecs.position().left; currentMenuTechSpecs.data('original-left', specSheetOriginalLeft); } currentMenuTechSpecs.css('left', specSheetOriginalLeft - this._list.scrollLeft); } } }); } // var list = container.find(".trim-group-list"); // // // if the content is smaller or the same size as the outer width, don't display scrolling // if (list[0].scrollWidth <= list.outerWidth()) { // return; // } // //DWP-12480: set graybox position absolute z-index 1 if there is a scrollbar to prevent trim hover overlapping CTAs // var grayBox = document.querySelector('body#NEWCARDETAILS .graybox'); // if (grayBox && grayBox.style) { // grayBox.style.position = "absolute"; // grayBox.style.zIndex = 1; // } // var scroll = { // position: 0, // speed : 0, // max : (list[0].scrollWidth - list.innerWidth()) + 15, // }; // // var showScroll = function () { // if (list[0].scrollLeft > 0) { // container.find("span[class*='left']").removeClass("hidden"); // } else { // container.find("span[class*='left']").addClass("hidden"); // } // // if (list[0].scrollLeft < scroll.max) { // container.find("span[class*='right']").removeClass("hidden"); // } else { // container.find("span[class*='right']").addClass("hidden"); // } // }; // // showScroll(); // // container.find("span[class*='left']") // .on('mouseover', function () { scroll.speed = -15; }) // .on ('mouseleave', function() { scroll.speed = 0; }); // // container.find("span[class*='right']") // .on('mouseover', function () { scroll.speed = 15; }) // .on ('mouseleave', function() { scroll.speed = 0; }); // // var updateScroll = function () { // if (scroll.speed !== 0) { // scroll.position += scroll.speed / 5; // // if (scroll.position < 0) { // scroll.position = 0; // } // // if (scroll.position > scroll.max) { // scroll.position = scroll.max; // } // // list.scrollLeft(scroll.position); // } // //DWP-12480: Adjust the positioning of the tech specs popup when scrolling // var currentMenuTechSpecs = container.find('.specSheet .menu-tech-specs'); // if (currentMenuTechSpecs.length) { // var specSheetOriginalLeft = currentMenuTechSpecs.data('original-left'); // if (!specSheetOriginalLeft) { // specSheetOriginalLeft = currentMenuTechSpecs.position().left; // currentMenuTechSpecs.data('original-left', specSheetOriginalLeft); // } // currentMenuTechSpecs.css('left', specSheetOriginalLeft - list.scrollLeft()); // } // showScroll(); // window.requestAnimationFrame(updateScroll); // }; // // window.requestAnimationFrame(updateScroll); }, getSelectedTrimGroup: function () { var container = $("#styles-container"); var trimName = container.find("span.active").data("trim"); if(typeof trimName === 'undefined' || trimName == null) { trimName = "all"; } return trimName; }, /** * Filtered vehicle styles * * This method will return a filtered list of styles depending on the selected trim * group (if show all or a specific one) and then will re-order the list according * to their price. * * @param styles * * @return {*} */ filteredVehicleStyles: function (styles) { var group = newcarDetails.getSelectedTrimGroup(); var filteredStyles = styles.filter(function (val) { let cmp = val.englishTrim; //Mazda 2021.5 trim exception let match = val.CFStyleName.match(/(2021[,|.]5)/); if(match){ cmp += (' ' + match[0] || '').replace(',','.'); } return (['all', cmp].includes(group)); }); filteredStyles.sort(function (a, b) { return a.msrpAllIn > b.msrpAllIn; }); return filteredStyles; }, /** * Get override style ID * * This method will find the override style ID if necessary. It will either return the * one in the URL or look for it as a trim group name. When found it will also add the * 'overrideStyleID' attribute to the newcarDetails object. * * @return {any|number} */ getOverrideStyleId: function () { var pathname = window.location.pathname; var htmlFile = decodeURIComponent(pathname.substring(pathname.lastIndexOf('/') + 1)); var group = newcarDetails.getSelectedTrimGroup(); if (htmlFile.indexOf('-id') === -1 && group === "all") { return newcarDetails.getInitialCompareFirstId(); } if (group !== "all") { var styles = newcarDetails.filteredVehicleStyles(newcarDetails.activeModel.styles); return styles[0].id; } var urlStyleID = htmlFile.match("-id(.*).html"); if (urlStyleID === null) { return newcarDetails.getInitialCompareFirstId(); } return urlStyleID[1]; }, getInitialCompareFirstId: function() { if($('#initcomparestyles').length){ var id = $('#initcomparestyles').val().split('|||')[0]; if(id) return id; } return 0; }, getStylesToCompare: function () { // get the first 4 styles in the list var result = newcarDetails.activeModel.styles.slice(0, 4); // if there is an override style, put it first in list if (newcarDetails.overrideStyleID > 0) { result = result.filter( function (val){ return (val.id != newcarDetails.overrideStyleID); }); var style = newcarDetails.activeModel.styles.filter(function (val) { return (val.id == newcarDetails.overrideStyleID); }); if (style.length) { result.unshift(style[0]); } } return result.slice(0, 4); }, getVehicleURL: function (extras) { var make = newcarDetails.activeModel.make; var model = newcarDetails.activeModel.model; var year = newcarDetails.activeModel.year; var extraParam = extras.join(""); if (newcarDetails.overrideStyleID != null && !isNaN(newcarDetails.overrideStyleID) && newcarDetails.overrideStyleID > 0) { make = ($('#textMakeOverride').val() !== '') ? $('#textMakeOverride').val() : make; model = ($('#textModelOverride').val() !== '') ? $('#textModelOverride').val() : model; year = ($('#textYearOverride').val() !== '') ? $('#textYearOverride').val() : year; } make = make.replace(/-/g, '_'); model = model.replace(/[-\s]/g, '_'); if ($('#textLanguage').val() === "ENGLISH") { return year + '-' + make + '-' + model + extraParam + '.html'; } else { return make + '-' + model + '-' + year + extraParam + '.html'; } }, showSpecTooltip: function(styleid, self) { var currentSpecSheet = self.find('.menu-tech-specs'); if (currentSpecSheet && currentSpecSheet.length){ currentSpecSheet.css('opacity', '1'); currentSpecSheet.css('z-index', '12'); return; } var template = $('#menu-specs-template').clone(); $(template).find('.arrow').remove(); $(template).css('display', 'block'); $(template).css('visibility', 'visible'); $(template).css('opacity', '1'); $(template).css('left', '0'); $(template).css('top', '20px'); $(template).css('z-index', '12'); const escapeHTML = str => str.replace(/[&<>"']/g, char => ({'&': '&', '<': '<', '>': '>', '"': '"', "'": '''}[char])); var make = escapeHTML(newcarDetails.activeModel.make); var model = escapeHTML(newcarDetails.activeModel.model); var year = escapeHTML(newcarDetails.activeModel.year); var trimImage = '(document.documentMode||0);document.write(('").replace(/;/g, "!important;"));var D={};return function(k,r,t,f,A,m,y){var L=null===r;L&&(r=A.alt);var E=k.viewBox,v;if(!(v=t.computedFontSize)){v=Cufon.CSS.Size;var z=t.get("fontSize");z=M(m,/(?:em|ex|%)$|^[a-z-]+$/i.test(z)?"1em":z);v=t.computedFontSize=new v(z+"px",k.baseSize)}z=v;if(L)v=A,A=A.firstChild;else{v=document.createElement("cufon");v.className="cufon cufon-vml";v.alt=r;A=document.createElement("cufoncanvas");v.appendChild(A);if(f.printable){var G=document.createElement("cufontext");G.appendChild(document.createTextNode(r)); v.appendChild(G)}y||v.appendChild(document.createElement("cvml:shape"))}y=v.style;var I=A.style,w=z.convert(E.height);G=Math.ceil(w);w=G/w*Cufon.CSS.fontStretch(t.get("fontStretch"));var B=E.minX,a=E.minY;I.height=G;I.top=Math.round(z.convert(a-k.ascent));I.left=Math.round(z.convert(B));y.height=z.convert(k.height)+"px";var c=t.get("color"),d=Cufon.CSS.textTransform(r,t).split(""),b=k.spacing(d,P(m,t,z,"letterSpacing"),P(m,t,z,"wordSpacing"));if(!b.length)return null;r=b.total;var g=-B+r+(E.width- b[b.length-1]);I=z.convert(g*w);I=Math.round(I);E=g+","+E.height;var e;g="r"+E+"ns";var n;if(n=f.textGradient){var h=f.textGradient;n=h.id;if(!D[n]){h=h.stops;var l=document.createElement("cvml:fill"),u=[];l.type="gradient";l.angle=180;l.focus="0";l.method="sigma";l.color=h[0][1];for(var q=1,C=h.length-1;qE&&(E=a);B>v&&(v=B);a =d.endAt&&G(!0)}}function G(b){c.removeEventListener("mousedown",n);c.removeEventListener("mousemove",n);document.removeEventListener("mouseup",t);c.removeEventListener("mouseover",B);c.removeEventListener("mouseout",C);c.removeEventListener("mousemove",D);c.removeEventListener("touchstart",n);c.removeEventListener("touchmove",n);document.removeEventListener("touchend",t);f.addEventListener("touchmove", function(e){e.preventDefault();return!1});b&&!a.hasEnded?(a.hasEnded=!0,f.style.setProperty("cursor","default","important"),c.style.setProperty("cursor","default","important"),l.style.display="none",delete a.scratchedOverlay,f.innerHTML="",0!=d.counter&&"function"===typeof y&&y(z,a),b=window[a.callback],"function"===typeof b&&b(a)):b||a.hasEnded||(0!=E&&(f.style.width=E),0!=F&&(f.style.height=F),a.scratchedOverlay=R(),f.style.backgroundImage="none",f.innerHTML="")}function P(b){if(0==S++%Q||b){b= 0;for(var e=k.getImageData(0,0,g,h).data,m=0,u=e.length-20;m':(b.appendChild(m),b.appendChild(u),b.appendChild(r),b.appendChild(A),a.container.appendChild(b));a.locked=!0;a.container.lock=function(M){"undefined"===typeof M&&(M=a.locked);a.locked=!a.locked;b.lock(M)};a.container.restart=function(){b.restart()};a.container.clean=function(){b.clean()}},d.bottomImage.src=a.background),!1;f.innerHTML="Your browser does not support HTML5 canvas tag."}if("undefined"!= typeof a.container){var f=a.container;g=f.offsetWidth;h=f.offsetHeight;f.style.setProperty("position","relative","important");f.style.setProperty("padding","0","important");K(f)}else return!1;if("undefined"==typeof a.background||a.hasEnded)return!1;d.bottomImage.onload=function(){0!=g&&0==h?(F="auto",h=g/d.bottomImage.width*d.bottomImage.height,f.style.height=h+"px"):0==g&&0!=h&&(E="auto",g=h/d.bottomImage.height*d.bottomImage.width,f.style.width=g+"px");0==g*h&&(F=E="auto",g=d.bottomImage.width, h=d.bottomImage.height,f.style.width=g+"px",f.style.height=h+"px");"undefined"==typeof a.responsiveRatio?a.responsiveRatio=g/d.bottomImage.width:x=g/d.bottomImage.width;x=g/d.bottomImage.width/a.responsiveRatio;c.width=g;c.height=h;K(c);H()};d.bottomImage.src=a.background;var c=document.createElement("canvas");c.className="scratchcard-Overlay";var k=c.getContext("2d");k.translate(0,0);var l=document.createElement("div");l.className="scratchcard-Cursor";var I=0,J=0;document.addEventListener("touchstart", w);document.addEventListener("touchmove",w);document.addEventListener("touchend",w);a.locked=!1;a.container.lock=function(b){"undefined"!==typeof b&&(a.locked=!b);a.locked?(c.addEventListener("mousedown",n),c.addEventListener("mousemove",n),document.addEventListener("mouseup",t),c.addEventListener("mouseover",B),c.addEventListener("mouseout",C),c.addEventListener("mousemove",D),c.addEventListener("touchstart",n),c.addEventListener("touchmove",n),document.addEventListener("touchend",t),"undefined"== typeof a.coin&&(c.style.cursor=d.defaultCursor)):(c.removeEventListener("mousedown",n),c.removeEventListener("mousemove",n),document.removeEventListener("mouseup",t),c.removeEventListener("mouseover",B),c.removeEventListener("mouseout",C),c.removeEventListener("mousemove",D),c.removeEventListener("touchstart",n),c.removeEventListener("touchmove",n),document.removeEventListener("touchend",t),c.style.cursor="default");a.locked=!a.locked};a.container.restart=function(){a.hasEnded=!1;G(!1);a.scratchedOverlay= void 0;window.removeEventListener("resize",q);createScratchCard(a)};a.container.clean=function(){a.hasEnded=!0;a.container.lock(!0);delete a.scratchedOverlay;f.innerHTML="";f.style.setProperty("cursor","default")}} function generateScratchSlides(){if(lt_IE9)scratchEndCallback(!0);else{img=$(".scratchContainerImg","ul.slides").last();if(0===img.naturalWidth)return setTimeout(generateScratchSlides,500),!1;var a="1"==$("#ismobile").val()?"#owl-car-slider":"ul.slides";$(".scratchContainer",a).each(function(){setScratch(this);$(".scratchContainerImg",$(this)).hide()})}} function setScratch(a){var p=$(".scratchContainerImg",$(a)).attr("src");createScratchCard({container:$(".scratchContainer",$(a)).context,background:p,foreground:"/images/scratch/slider-scratch-foreground.png",percent:75,coin:"/images/scratch/coin2.png",thickness:15,callback:"scratchEndCallback",flashPath:"/flash/scratchcard.swf"})} function afterScratchPopupSubmit(){var a="used"==$("#currentStatus").val()?searchDetails:newcarDetails,p="1"==$("#ismobile").val()?"#owl-car-slider":"ul.slides";$(".slider-overlay",p).hide();scratchSlide=$(".scratchContainer",p).first().parents("li");a.goToSlide(scratchSlide.index());a.stopSlider()} function scratchEndCallback(a){var p="used"==$("#currentStatus").val()?searchDetails:newcarDetails;Cookies.set("sliderScratchWon",1,null,"/");p.stopSlider();!0!==a&&$("#scratchWinnerMsg").reveal({animation:"fadeAndPop",animationspeed:300,closeonbackgroundclick:!1,dismissmodalclass:"close-reveal-modal",closeonescape:!1});afterScratchSliderReset()}function afterScratchSliderReset(){var a="used"==$("#currentStatus").val()?searchDetails:newcarDetails;setTimeout(function(){a.resetSlider()},2E3)} function generateScratchSlidesIframe(){Cookies.get("scratchandsave")&&$(".slider-overlay","ul.slides").hide();$("iframe","ul.slides").each(function(){var a=$(this)[0];a=a.contentDocument||a.contentWindow.document;var p=document.createElement("script");p.type="text/javascript";p.src="/js/scratch.js";var q=document.createElement("script");q.type="text/javascript";q.text="document.getElementById('scratchContainerImg').style.display = 'none'; setTimeout(function(){startScratch();}, 1000);";q.text+="function startScratch(){if (typeof setScratch == 'function') {console.log('SET SCRATCH');setScratch();} else {setTimeout(function(){console.log('NO SCRATCH');startScratch();}, 1000);}}"; $("img",".iframeContent").css("margin","0");var H=$(".iframeContent",$(this).parent()).html();$(".iframeContent",$(this).parent()).remove();var v=$(a.body);$(a.head)[0].appendChild(p);v.css("margin","0");v.prepend(H);v[0].appendChild(q);v.find("#scratchEndedFlag").on("click",function(){scratchEndCallback()})})}; /** /js/jquery.prettyPhoto.js **/ var ___d2c_jqueryprettyPhotojs_c_on="2025-05-23 17:11:34";'use strict';var ___d2c_jqueryprettyPhotojs_c_on="2024-03-25 12:33:27";"use strict"; (function(a){function y(){var e=location.href;return hashtag=-1!==e.indexOf("#prettyPhoto")?decodeURI(e.substring(e.indexOf("#prettyPhoto")+1,e.length)):!1}function l(e,p){e=e.replace(/[\[]/,"\\[").replace(/[\]]/,"\\]");e=(new RegExp("[\\?&]"+e+"=([^]*)")).exec(p);return null==e?"":e[1]}a.prettyPhoto={version:"3.1.5"};a.fn.prettyPhoto=function(e){function p(){a(".pp_loaderIcon").hide();projectedTop=scroll_pos.scrollTop+(k/2-d.containerHeight/2);0>projectedTop&&(projectedTop=0);$ppt.fadeTo(b.animation_speed, 1);$pp_pic_holder.find(".pp_content").animate({height:d.contentHeight,width:d.contentWidth},b.animation_speed);$pp_pic_holder.animate({top:projectedTop,left:0>h/2-d.containerWidth/2?0:h/2-d.containerWidth/2,width:d.containerWidth},b.animation_speed,function(){$pp_pic_holder.find(".pp_hoverContainer,#fullResImage").height(d.height).width(d.width);$pp_pic_holder.find(".pp_fade").fadeIn(b.animation_speed);isSet&&"image"==t(pp_images[set_position])?$pp_pic_holder.find(".pp_hoverContainer").show():$pp_pic_holder.find(".pp_hoverContainer").hide(); b.allow_expand&&(d.resized?a("a.pp_expand,a.pp_contract").show():a("a.pp_expand").hide());!b.autoplay_slideshow||q||u||a.prettyPhoto.startSlideshow();b.changepicturecallback();u=!0});isSet&&b.overlay_gallery&&"image"==t(pp_images[set_position])?(itemWidth=57,navWidth="facebook"==b.theme||"pp_default"==b.theme?50:30,itemsPerPage=Math.floor((d.containerWidth-100-navWidth)/itemWidth),itemsPerPage=itemsPerPage h||n>k)&&doresize&&b.allow_resize&&!r){resized=!0;for(fitting=!1;!fitting;)m>h?(imageWidth=h-200,imageHeight=f/c*imageWidth):n>k?(imageHeight=k-200,imageWidth=c/f*imageHeight):fitting=!0,n=imageHeight,m=imageWidth;(m>h||n>k)&&g(m,n);A(imageWidth,imageHeight)}return{width:Math.floor(imageWidth),height:Math.floor(imageHeight),containerHeight:Math.floor(n),containerWidth:Math.floor(m)+2*b.horizontal_padding,contentHeight:Math.floor(v),contentWidth:Math.floor(B),resized}}function A(c, f){c=parseFloat(c);f=parseFloat(f);$pp_details=$pp_pic_holder.find(".pp_details");$pp_details.width(c);detailsHeight=parseFloat($pp_details.css("marginTop"))+parseFloat($pp_details.css("marginBottom"));$pp_details=$pp_details.clone().addClass(b.theme).width(c).appendTo(a("body")).css({position:"absolute",top:-1E4});detailsHeight+=$pp_details.height();detailsHeight=34>=detailsHeight?36:detailsHeight;$pp_details.remove();$pp_title=$pp_pic_holder.find(".ppt");$pp_title.width(c);titleHeight=parseFloat($pp_title.css("marginTop"))+ parseFloat($pp_title.css("marginBottom"));$pp_title=$pp_title.clone().appendTo(a("body")).css({position:"absolute",top:-1E4});titleHeight+=$pp_title.height();$pp_title.remove();v=f+detailsHeight;B=c;n=v+titleHeight+$pp_pic_holder.find(".pp_top").height()+$pp_pic_holder.find(".pp_bottom").height();m=c}function t(c){return c.match(/youtube\.com\/watch/i)||c.match(/youtu\.be/i)?"youtube":c.match(/vimeo\.com/i)?"vimeo":c.match(/\.mp4/i)?"mp4":c.match(/avu3d/i)?"avu3d":c.match(/\b.mov\b/i)?"quicktime": c.match(/\b.swf\b/i)?"flash":c.match(/\biframe=true\b/i)?"iframe":c.match(/\bajax=true\b/i)?"ajax":c.match(/\bcustom=true\b/i)?"custom":"#"==c.substr(0,1)?"inline":"image"}function w(){doresize&&"undefined"!=typeof $pp_pic_holder&&(scroll_pos=C(),contentHeight=$pp_pic_holder.height(),contentwidth=$pp_pic_holder.width(),projectedTop=k/2+scroll_pos.scrollTop-contentHeight/2,0>projectedTop&&(projectedTop=0),contentHeight>k||$pp_pic_holder.css({top:projectedTop,left:h/2+scroll_pos.scrollLeft-contentwidth/ 2}))}function C(){if(self.pageYOffset)return{scrollTop:self.pageYOffset,scrollLeft:self.pageXOffset};if(document.documentElement&&document.documentElement.scrollTop)return{scrollTop:document.documentElement.scrollTop,scrollLeft:document.documentElement.scrollLeft};if(document.body)return{scrollTop:document.body.scrollTop,scrollLeft:document.body.scrollLeft}}function D(c){b.social_tools&&(facebook_like_link=b.social_tools.replace("{location_href}",encodeURIComponent(location.href)));b.markup=b.markup.replace("{pp_social}", "");a("body").append(b.markup);$pp_pic_holder=a(".pp_pic_holder");$ppt=a(".ppt");$pp_overlay=a("div.pp_overlay");if(isSet&&b.overlay_gallery){currentGalleryPage=0;toInject="";for(c=0;c