{"version":3,"sources":["mshop-product-page.js"],"names":["mshopProductPage","_configuration","_selectedProductId","_fancyBoxOptions","_fancyBoxSlides","_isDesktop","_loadedReviews","_isSavingReview","_isSavingStockReminder","_isSubmittingFlashSaleForm","_flyOutShowOffset","_flyOutVisible","_isUsingFlashSalePrice","_isSavingQuestion","$_addToCartButton","$_addToCartArea","$_addToCartFormProduct","$_addToCartAdwordsProduct","$_addToCartPriceRunnerProduct","$_imageGallery","$_loadMoreReviewsBar","$_loadMoreReviewsButton","$_loadMoreReviewsHint","$_loadMoreReviewsProgress","$_mainImage","$_outOfStockReminder","$_outOfStockReminderButton","$_outOfStockReminderEmail","$_outOfStockReminderForm","$_outOfStockReminderMessage","$_productPrice","$_productStock","$_reviews","$_selectedVariantName","$_thumbnails","$_variants","$_writeReviewCallout","$_writeReviewFormBody","$_writeReviewFormBodyContainer","$_writeReviewFormBodyMessage","$_writeReviewFormBodyShadow","$_writeReviewFormButton","$_writeReviewFormMessage","$_writeReviewFormName","$_writeReviewFormNameContainer","$_writeReviewFormNameMessage","$_writeReviewFormRating","$_writeReviewCustomerServiceMessage","$_writeReviewFormTitle","$_writeReviewFormTitleContainer","$_writeReviewFormTitleMessage","$_accordionReviewsInput","$_accordionShippingInput","$_writeReviewArea","$_freeFreightLine","$_regularFreightLine","$_salesHint","$_flashSaleHintArea","$_flashSaleHint","$_flashSaleHintFormMessage","$_flashSaleHintSuccessMessage","$_flashSaleHintFormButton","$_flashSaleHintFormInput","$_flashSaleHintTitle","$_flashSaleHintDescription","$_flashSaleAddToCartHash","$_flyOut","$_flyOutImage","$_flyOutPrice","$_flyOutBadge","$_askQuestionButton","$_askQuestionForm","$_askQuestionFormButton","$_askQuestionMessage","$_questionFormEmail","$_questionFormBody","$_questionFormBodyMessage","$_questionFormEmailMessage","$_questionFormEmailField","$_questionFormBodyField","_swiper","boot","XmxApp","isDesktop","window","naeProductConfiguration","selectedProductId","Math","min","reviewSummary","totalReviews","pageSize","loop","infobar","buttons","slideShow","fullScreen","thumbs","closeBtn","touch","keyboard","focus","closeClickOutside","jQuery","on","onOutOfStockFormSubmit","onProductRatingClick","onProductFreightClick","onAccordionInputChange","onVariantClick","onLoadMoreReviewsButtonClick","onWriteReviewButtonClick","onWriteReviewFormSubmit","onWriteReviewFormRatingChange","onWriteReviewFormNameInteraction","onWriteReviewFormTitleInteraction","onWriteReviewFormBodyInteraction","parent","next","onFlashSaleHintHeadClick","onFlashSaleHintFormSubmit","onFlyOutButtonClick","$verticalTabs","length","offset","top","isPreOrder","registerScrollEventObserver","handleScroll","onAskQuestionButtonClick","onAskQuestionFormSubmit","onQuestionVoteButtonClick","updateGallery","googleClickId","isCompletelyOutOfStock","ajax","url","dataType","type","data","productId","storeId","location","href","extractHttpGetParameter","clickId","sendStockAlerts","isComingFromGoogleAdwords","isComingFromPriceRunner","updatePrice","updateFlashSaleHint","sales","elapsedHours","getCurrentTimestamp","time","quantitySold","floor","quantity","speed","hint","translations","salesInfo","replace","html","show","updateSalesHint","updateFlyout","productType","sendGoogleAnalyticsView","XmxEventQueue","trackEvent","p","accordionId","this","a","sendClerkProductView","supportsClerk","Clerk","call","key","naeAppConfig","clerkApiKey","product","parseInt","val","hide","productIds","items","value","i","productData","push","item_id","item_name","price","dataLayer","ecommerce","event","currency","currencyCode","email","body","hasValidationErrors","trim","emailValidationError","validateEmailAddress","addClass","removeClass","reviewMinLength","attr","question","success","response","complete","$button","$question","closest","buttonDirection","questionId","votedDirection","$upVoteButton","$downVoteButton","$upVoteButtonLabel","$downVoteButtonLabel","upVotes","downVotes","newDirection","direction","finalPrice","basePrice","adwordsPrice","priceRunnerPrice","flashSalePrice","baseUnitContent","empty","$price","appendTo","$specialPrice","formatAmount","savingPercent","round","$discount","$regularPrice","$unitPrice","baseUnitValue","baseUnitMeasure","formatUnit","images","mobileThumbnailUrl","badgeText","stockColor","stockLabel","$badge","click","scrollPosition","scrollOffsetY","toggleClass","validationMessage","hash","toLowerCase","generateHashCode","$line1","$line2","$freight","$freightCaption","$oldPrice","$saving","saving","discountInfo","save","formatPrice","readMoreAboutShipping","shipping","freeAt","freeShipping","shipsForX","fee","updateFlashSalePrice","cartHash","stopPropagation","preventDefault","now","showFlashSaleHint","flashSaleStart","flashSaleEnd","title","description","flashSaleMode","flashSaleTitlePercentDiscount","flashSaleTitleAmountDiscount","flashSaleTitleFixedPrice","savingAmount","savingPercentString","savingAmountString","priceAmountString","flashSaleDescription","rating","name","minimumBodyLength","pleaseEnterAName","pleaseEnterATitle","pleaseEnterABody","pleaseEnterALongerBody","updateInputFieldLengthIndicator","$textarea","coolLength","awesomeLength","rockstarLength","$indicator","reviewRockstarLength","reviewAwesomeLength","reviewCoolLength","updateTextareaLengthIndicator","content","height","outerHeight","css","updateReviewFormTextareaSize","$inputField","maxLength","addedReviews","each","noMoreReviewsToLoad","loadedPercent","reviewProgress","$line3","$campaignBadge","isInStock","isDiscontinued","isAdwordsPrice","isPriceRunnerPrice","adwordsDiscountInfo","priceRunnerDiscountInfo","campaignBadge","klarnaPayment","$klarnaPaymentHint","$klarnaLogo","$klarnaLabel","onSwiperSlideChange","realIndex","onSwiperSlideClick","button","image","spoilerAlert","fancybox","open","onMainImageClick","onThumbnailClick","mediaIndex","slideToLoop","imageData","lastImage","$thumbnail","$thumbnailImage","$thumbnailPicture","$mobileThumbnailSource","$desktopThumbnailSource","$swiperContainer","$swiperButtonNext","$swiperButtonPrevious","$swiperWrapper","$swiperSlide","$videoTitle","$videoIcon","$swiperImage","$swiperPicture","$swiperImageSource","galleryImage","totalNumberOfSlides","imageIndex","destroy","desktopThumbnailUrl","label","$spoilerAlert","$spoilerAlertCaption","spoilerAlertCaption","$spoilerAlertDescription","spoilerAlertDescription","$spoilerAlertButton","onSpoilerRevealClick","$spoilerAlertButtonLabel","spoilerAlertButton","galleryIndex","gallery","media","src","zoomImageUrl","opts","spoiler","spoilerCaption","spoilerDescription","spoilerButton","index","className","match","join","videoUrl","galleryIndexB","video","Swiper","containerModifierClass","wrapperClass","slideClass","slideActiveClass","slideVisibleClass","slidePrevClass","slideNextClass","centeredSlides","spaceBetween","loopedSlides","preventClicksPropagation","simulateTouch","threshold","grabCursor","navigation","nextEl","prevEl","disabledClass","slideChange","remove","changeSelectedProduct","superAttributeCode","variantData","$variant","variantIndex","variants","optionLabel","$content","scrollOffset","prop","animate","scrollTop","construct"],"mappings":"AAAA,IAAIA,iBAAmB,WAKnB,IAAIC,EACAC,EACAC,EACAC,EAEAC,EACAC,EACAC,EACHC,EACAC,EACAC,EACAC,EACAC,EACAC,EAKAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EAEAC,EAEAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACGC,EACAC,EACAC,EAGHC,GACAC,GACAC,GAIAC,GACAC,GAGAC,GACAC,GACAC,GACAC,GACAC,GACAC,GACAC,GAGAC,GACAC,GACAC,GAEAC,GAGAC,GACAC,GACAC,GACAC,GAEAC,GACAC,GACAC,GACAC,GACAC,GACAC,GA9FGC,GAAU,KAmGd,SAASC,IAEX5E,EAAa6E,OAAOC,YACdlF,EAAiBmF,OAAOC,wBAC3BnF,EAAqBD,EAAeqF,kBACpChF,EAAiBiF,KAAKC,IAAIvF,EAAewF,cAAcC,aAAczF,EAAewF,cAAcE,UAQ/FxF,EACA,CACIyF,OALVhF,EADAH,EADAD,EADAK,EADGN,GAAkB,GAYXsF,SAAS,EAGTC,SAAS,EAGTC,WAAW,EACXC,YAAY,EACZC,QAAQ,EACRC,UAAU,EAGVC,OAAO,EAGPC,UAAU,EAGVC,OAAO,EAGPC,mBAAmB,GAI7BxF,EAAoByF,OAAO,uBAC3BxF,EAAkBwF,OAAO,qBACzBvF,EAAyBuF,OAAO,6BAChCtF,EAA4BsF,OAAO,qCACnCrF,EAAgCqF,OAAO,yCA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K,OAGrBvH,GAASkG,SAKTrJ,EAAgB0K,OAIXxL,EAAe6L,YAAY5L,GAAoBsU,gBAEnD/S,EAAqB2I,OAItBlG,GAASuH,QAwBVnC,KACAgB,KACAE,GAAwB,CAACtK,IAIzBuK,cAAcC,WAAW,KACzB,CACCC,EAAKzK,IAG4B,gBAA9BD,EAAesK,YAEuB,SAArCtK,EAAeoa,mBAElBtP,GAAqB7K,GAIrB6K,GAAqB9K,EAAe2I,WAKrCmC,GAAqB7K,IAOpB,SAAS2G,GAAewF,GAEvB,IAEIiO,EAFAC,EAAWhU,OAAOsE,MAClBjC,EAAY2R,EAAS5R,KAAK,cAQ9B,IAAK,IAAI6R,KAJTrY,EAAW4K,YAAY,mCACvBwN,EAASzN,SAAS,mCAGO7M,EAAewa,SAIvC,IAFAH,EAAcra,EAAewa,SAASD,IAEtB5R,WAAaA,EAC7B,CACC3G,EAAsBkI,KAAKmQ,EAAYI,aACvC,MAKFN,GAAsBxR,GAGnByD,EAAMmF,iBAMV,SAAS9K,KAER,IAAIiU,EAAWxX,EAAwBmE,OACnCsT,EAAeva,EAAa,IAAM,GAEtC8C,EAAwB0X,KAAK,WAAW,GAExCtU,OAAO,aAAauU,QAAQ,CAACC,UAAWJ,EAAS/S,SAASC,IAAM+S,GAAe,QAMhF,SAASjU,KAER,IAAIgU,EAAWvX,EAAyBkE,OACpCsT,EAAeva,EAAa,IAAM,GAEtC+C,EAAyByX,KAAK,WAAW,GAEzCtU,OAAO,aAAauU,QAAQ,CAACC,UAAWJ,EAAS/S,SAASC,IAAM+S,GAAe,QAMhF,SAAS7T,KAER3E,EAAqBqJ,OACrBpI,EAAkB+G,OAMnB,MAAO,CAKH4Q,UAAW,WAEP/V,MAv6EW,GA66EvBjF,iBAAiBgb","file":"mshop-product-page-4.6.3.min.js","sourcesContent":["var mshopProductPage = (function()\r\n{\r\n /**\r\n * \r\n */\r\n var _configuration;\r\n var _selectedProductId;\r\n var _fancyBoxOptions;\r\n var _fancyBoxSlides;\r\n var _swiper = null;\r\n var _isDesktop;\r\n var _loadedReviews;\r\n var _isSavingReview;\r\n\tvar _isSavingStockReminder;\r\n\tvar _isSubmittingFlashSaleForm;\r\n\tvar _flyOutShowOffset;\r\n\tvar _flyOutVisible;\r\n\tvar _isUsingFlashSalePrice;\r\n\tvar _isSavingQuestion;\r\n\r\n /**\r\n *\r\n */\r\n\tvar $_addToCartButton;\r\n\tvar $_addToCartArea;\r\n\tvar $_addToCartFormProduct;\r\n\tvar $_addToCartAdwordsProduct;\r\n\tvar $_addToCartPriceRunnerProduct;\r\n\tvar $_imageGallery;\r\n\tvar $_loadMoreReviewsBar;\r\n\tvar $_loadMoreReviewsButton;\r\n\tvar $_loadMoreReviewsHint;\r\n\tvar $_loadMoreReviewsProgress;\r\n\tvar $_mainImage;\r\n\tvar $_outOfStockReminder;\r\n\tvar $_outOfStockReminderButton;\r\n\tvar $_outOfStockReminderEmail;\r\n\tvar $_outOfStockReminderForm;\r\n\tvar $_outOfStockReminderMessage;\r\n\tvar $_productFreight;\r\n\tvar $_productPrice;\r\n\tvar $_productRating;\r\n\tvar $_productStock;\r\n\tvar $_reviews;\r\n\tvar $_selectedVariantName;\r\n\tvar $_thumbnails;\r\n\tvar $_variants;\r\n\tvar $_writeReviewCallout;\r\n\tvar $_writeReviewFormBody;\r\n\tvar $_writeReviewFormBodyContainer;\r\n\tvar $_writeReviewFormBodyMessage;\r\n\tvar $_writeReviewFormBodyShadow;\r\n\tvar $_writeReviewFormButton;\r\n\tvar $_writeReviewFormMessage;\r\n\tvar $_writeReviewFormName;\r\n\tvar $_writeReviewFormNameContainer;\r\n\tvar $_writeReviewFormNameMessage;\r\n\tvar $_writeReviewFormRating;\r\n\tvar $_writeReviewCustomerServiceMessage;\r\n\tvar $_writeReviewFormTitle;\r\n\tvar $_writeReviewFormTitleContainer;\r\n\tvar $_writeReviewFormTitleMessage;\r\n var $_accordionReviewsInput;\r\n var $_accordionShippingInput;\r\n var $_writeReviewArea;\r\n var $_writeReviewButton;\r\n var $_writeReviewForm;\r\n\tvar $_freeFreightLine;\r\n\tvar $_regularFreightLine;\r\n\tvar $_salesHint;\r\n\tvar $_accordionInputs;\r\n\r\n\t// Flash Sale\r\n\tvar $_flashSaleHintArea;\r\n\tvar $_flashSaleHint;\r\n\tvar $_flashSaleHintHead;\r\n\tvar $_flashSaleHintForm;\r\n\tvar $_flashSaleHintFormMessage;\r\n\tvar $_flashSaleHintSuccessMessage;\r\n\tvar $_flashSaleHintFormButton;\r\n\tvar $_flashSaleHintFormInput;\r\n\tvar $_flashSaleHintTitle;\r\n\tvar $_flashSaleHintDescription;\r\n\tvar $_flashSaleAddToCartHash;\r\n\r\n\t// Fly-out\r\n\tvar $_flyOut;\r\n\tvar $_flyOutImage;\r\n\tvar $_flyOutPrice;\r\n\tvar $_flyOutButton;\r\n\tvar $_flyOutBadge;\r\n\r\n\t// Questionaire\r\n\tvar $_askQuestionButton;\r\n\tvar $_askQuestionForm;\r\n\tvar $_askQuestionFormButton;\r\n\tvar $_askQuestionMessage;\r\n\tvar $_questionVoteButtons;\r\n\tvar $_questionFormEmail;\r\n\tvar $_questionFormBody;\r\n\tvar $_questionFormBodyMessage;\r\n\tvar $_questionFormEmailMessage;\r\n\tvar $_questionFormEmailField;\r\n\tvar $_questionFormBodyField;\r\n\r\n /**\r\n * Executed one page is loaded\r\n */\r\n function boot()\r\n {\r\n\t\t_isDesktop = XmxApp.isDesktop(); \r\n _configuration = window.naeProductConfiguration;\r\n \t_selectedProductId = _configuration.selectedProductId;\r\n \t_loadedReviews = Math.min(_configuration.reviewSummary.totalReviews, _configuration.reviewSummary.pageSize);\r\n \t_isSavingReview = false;\r\n\t\t_isSavingQuestion = false;\r\n\t\t_isSavingStockReminder = false;\r\n\t\t_isSubmittingFlashSaleForm = false;\r\n\t\t_isUsingFlashSalePrice = false;\r\n\r\n // Settings for the fancy box\r\n _fancyBoxOptions =\r\n {\r\n loop: true,\r\n\r\n // 1/5 and previous/next buttons on top\r\n infobar: true, \r\n\r\n // buttons in the top right corner\r\n buttons: true, \r\n\r\n // What buttons should appear in the toolbar\r\n slideShow: false,\r\n fullScreen: false,\r\n thumbs: false,\r\n closeBtn: true,\r\n\r\n // Enable gestures (tap, zoom, pan and pinch)\r\n touch: true,\r\n\r\n // Enable keyboard navigation\r\n keyboard: true,\r\n\r\n // Try to focus on first focusable element after opening\r\n focus: true,\r\n\r\n // Close when clicked outside of the content\r\n closeClickOutside: true\r\n };\r\n\r\n // Hook the add to cart button\r\n\t\t$_addToCartButton = jQuery('#add-to-cart-button');\r\n\t\t$_addToCartArea = jQuery('#add-to-cart-area');\r\n\t\t$_addToCartFormProduct = jQuery('#add-to-cart-form-product');\r\n\t\t$_addToCartAdwordsProduct = jQuery('#add-to-cart-form-adwords-product');\r\n\t\t$_addToCartPriceRunnerProduct = jQuery('#add-to-cart-form-pricerunner-product');\r\n\r\n\t\t// Freight cost in shipping tab\r\n\t\t$_freeFreightLine = jQuery('#free-freigt-line');\r\n\t\t$_regularFreightLine = jQuery('#regular-freight-line');\r\n\r\n\t\t// Hook out of stock area\r\n\t\t$_outOfStockReminder = jQuery('#out-of-stock-reminder');\r\n\t\t$_outOfStockReminderForm = jQuery('#out-of-stock-reminder-form');\r\n\t\t$_outOfStockReminderForm.on('submit', onOutOfStockFormSubmit);\r\n\t\t$_outOfStockReminderButton = jQuery('#out-of-stock-reminder-button');\r\n\t\t$_outOfStockReminderEmail = jQuery('#out-of-stock-reminder-email');\r\n\t\t$_outOfStockReminderMessage = jQuery('#out-of-stock-reminder-message');\r\n\r\n \t// Make the star rating header clickable\r\n \t$_accordionReviewsInput = jQuery('#accordion-reviews');\r\n\t\t$_productRating = jQuery('#product-rating');\r\n\t\t$_productRating.on('click', onProductRatingClick);\r\n\r\n \t// Make the freight clickable\r\n \t$_accordionShippingInput = jQuery('#accordion-shipping');\r\n\t\t$_productFreight = jQuery('#product-freight');\r\n\t\t$_productFreight.on('click', onProductFreightClick);\r\n\r\n\t\t// Hook all accordions\r\n\t\t$_accordionInputs = jQuery('.xmx-accordion-input');\r\n\t\t$_accordionInputs.on('change', onAccordionInputChange);\r\n\r\n\t\t// Make the variants clickable\r\n\t\t$_variants = jQuery('#product-variants > .xmx-product-variation');\r\n\t\t$_variants.on('click', onVariantClick);\r\n\r\n\t\t// Hook the variant name\r\n\t\t$_selectedVariantName = jQuery('#selected-variant-name');\r\n\r\n\t\t// Hook the stock\r\n\t\t$_productStock = jQuery('#product-stock');\r\n\r\n\t\t// Hook the price\r\n\t\t$_productPrice = jQuery('#product-price');\r\n\r\n\t\t// Hook the thumbnails and main image\r\n\t\t$_thumbnails = jQuery('#thumbnails');\r\n\t\t$_mainImage = jQuery('#main-image');\r\n\t\t$_imageGallery = jQuery('#image-gallery');\r\n\r\n\t\t// Hook the review area\r\n\t\t$_reviews = jQuery('#reviews');\r\n\t\t$_loadMoreReviewsHint = jQuery('#load-more-reviews-hint');\r\n\t\t$_loadMoreReviewsBar = jQuery('#load-more-reviews-bar');\r\n\t\t$_loadMoreReviewsProgress = jQuery('#load-more-reviews-progress');\r\n\t\t$_loadMoreReviewsButton = jQuery('#load-more-reviews-button');\r\n\t\t$_loadMoreReviewsButton.on('click', onLoadMoreReviewsButtonClick);\r\n\r\n // Make the \"Write Review\" button clickable\r\n $_writeReviewArea = jQuery('#write-review-area');\r\n $_writeReviewCallout = jQuery('#write-review-callout');\r\n $_writeReviewButton = jQuery('#write-review-button');\r\n $_writeReviewButton.on('click', onWriteReviewButtonClick);\r\n $_writeReviewFormButton = jQuery('#write-review-form-button');\r\n $_writeReviewForm = jQuery('#write-review-form');\r\n \t$_writeReviewForm.on('submit', onWriteReviewFormSubmit);\r\n\r\n\t\t// Review Customer Service Message\r\n\t\t$_writeReviewCustomerServiceMessage = jQuery('#write-review-customer-service-message');\r\n\r\n \t// Review Form Star Rating\r\n\t\t$_writeReviewFormRating = jQuery('#write-review-form-rating');\r\n\t\t$_writeReviewFormRating.on('change', onWriteReviewFormRatingChange);\r\n\r\n\t\t// Review Form Name Input\r\n\t\t$_writeReviewFormName = jQuery('#write-review-form-name');\r\n\t\t$_writeReviewFormName.on('paste', onWriteReviewFormNameInteraction);\r\n\t\t$_writeReviewFormName.on('keyup', onWriteReviewFormNameInteraction);\r\n\t\t$_writeReviewFormName.on('keydown', onWriteReviewFormNameInteraction);\r\n\t\t$_writeReviewFormName.on('blur', onWriteReviewFormNameInteraction);\r\n\r\n\t\t// Review Form Title Input\r\n\t\t$_writeReviewFormTitle = jQuery('#write-review-form-title');\r\n\t\t$_writeReviewFormTitle.on('paste', onWriteReviewFormTitleInteraction);\r\n\t\t$_writeReviewFormTitle.on('keyup', onWriteReviewFormTitleInteraction);\r\n\t\t$_writeReviewFormTitle.on('keydown', onWriteReviewFormTitleInteraction);\r\n\t\t$_writeReviewFormTitle.on('blur', onWriteReviewFormTitleInteraction);\r\n\r\n\t\t// Review Form Body Text Area\r\n\t\t$_writeReviewFormBodyShadow = jQuery('#write-review-form-body-shadow');\r\n\t\t$_writeReviewFormBody = jQuery('#write-review-form-body');\r\n\t\t$_writeReviewFormBody.on('paste', onWriteReviewFormBodyInteraction);\r\n\t\t$_writeReviewFormBody.on('keyup', onWriteReviewFormBodyInteraction);\r\n\t\t$_writeReviewFormBody.on('keydown', onWriteReviewFormBodyInteraction);\r\n\t\t$_writeReviewFormBody.on('blur', onWriteReviewFormBodyInteraction);\r\n\r\n\t\t// Validation messages\r\n\t\t$_writeReviewFormNameMessage = $_writeReviewFormName.parent().next();\r\n\t\t$_writeReviewFormTitleMessage = $_writeReviewFormTitle.parent().next();\r\n\t\t$_writeReviewFormBodyMessage = $_writeReviewFormBody.parent().next();\r\n\r\n\t\t// Input field wraps\r\n\t\t$_writeReviewFormNameContainer = $_writeReviewFormName.parent().parent();\r\n\t\t$_writeReviewFormTitleContainer = $_writeReviewFormTitle.parent().parent();\r\n\t\t$_writeReviewFormBodyContainer = $_writeReviewFormBody.parent().parent();\r\n\r\n\t\t// Success message\r\n\t\t$_writeReviewFormMessage = jQuery('#write-review-form-message');\r\n\r\n\t\t// Flash Sale\r\n\t\t$_flashSaleHintArea = jQuery('#xmx-flash-sale-hint-area');\r\n\t\t$_flashSaleHint = jQuery('#xmx-flash-sale-hint');\r\n\t\t$_flashSaleHintHead = jQuery('#xmx-flash-sale-hint-head');\r\n\t\t$_flashSaleHintHead.on('click', onFlashSaleHintHeadClick);\r\n\t\t$_flashSaleHintForm = jQuery('#xmx-flash-sale-hint-form');\r\n\t\t$_flashSaleHintForm.on('submit', onFlashSaleHintFormSubmit);\r\n\t\t$_flashSaleHintFormMessage = jQuery('#xmx-flash-sale-hint-form-message');\r\n\t\t$_flashSaleHintSuccessMessage = jQuery('#xmx-flash-sale-hint-success-message');\r\n\t\t$_flashSaleHintFormButton = jQuery('#xmx-flash-sale-hint-form-button');\r\n\t\t$_flashSaleHintFormInput = jQuery('#xmx-flash-sale-hint-form-input');\r\n\t\t$_flashSaleHintTitle = jQuery('#xmx-flash-sale-hint-title');\r\n\t\t$_flashSaleHintDescription = jQuery('#xmx-flash-sale-hint-description');\r\n\t\t$_flashSaleAddToCartHash = jQuery('#add-to-cart-form-flash');\r\n\r\n\t\t// Add-to-cart fly-out\r\n\t\t$_flyOut = jQuery('#cta-flyout');\r\n\t\t$_flyOutImage = jQuery('#cta-flyout-thumbnail-image');\r\n\t\t$_flyOutBadge = jQuery('#cta-flyout-badge');\r\n\t\t$_flyOutPrice = jQuery('#cta-flyout-price');\r\n\t\t$_flyOutButton = jQuery('#cta-flyout-button');\r\n\t\t$_flyOutButton.on('click', onFlyOutButtonClick);\r\n\t\r\n\t\tvar $verticalTabs = jQuery('#vertical-tabs');\r\n\r\n\t\tif ($verticalTabs.length > 0)\r\n\t\t{\r\n\t\t\t_flyOutShowOffset = $verticalTabs.offset().top + 96;\r\n\t\t}\r\n\t\telse \r\n\t\t{\r\n\t\t\t_flyOutShowOffset = 2000;\r\n\t\t}\r\n\r\n\t\t_flyOutVisible = false;\r\n\r\n\t\tif (!_configuration.isPreOrder)\r\n\t\t{\r\n\t\t\t// Hook the scroll observer \r\n\t\t\tXmxApp.registerScrollEventObserver('product', handleScroll);\r\n\t\t}\r\n\t\t\r\n\t\t// Qty. sold\r\n\t\t$_salesHint = jQuery('#product-sales');\r\n\r\n\t\t// Hook the questionaire\r\n\t\t$_askQuestionButton = jQuery('#ask-question-button');\r\n\t\t$_askQuestionButton.on('click', onAskQuestionButtonClick);\r\n\t\t$_askQuestionForm = jQuery('#ask-question-form');\r\n\t\t$_askQuestionForm.on('submit', onAskQuestionFormSubmit);\r\n\t\t$_askQuestionFormButton = jQuery('#ask-question-form-button');\r\n\t\t$_askQuestionMessage = jQuery('#ask-question-message');\r\n\t\t$_questionVoteButtons = jQuery('[data-question-vote-button]');\r\n\t\t$_questionVoteButtons.on('click', onQuestionVoteButtonClick);\r\n\t\t$_questionFormEmail = jQuery('#ask-question-form-email');\r\n\t\t$_questionFormBody = jQuery('#ask-question-form-body');\r\n\t\t$_questionFormBodyMessage = jQuery('#ask-question-form-body-message');\r\n\t\t$_questionFormEmailMessage = jQuery('#ask-question-form-email-message');\r\n\t\t$_questionFormBodyField = jQuery('#ask-question-form-body-field');\r\n\t\t$_questionFormEmailField = jQuery('#ask-question-form-email-field');\r\n\r\n // Start the gallery\r\n\t updateGallery();\r\n\t\tsendStockAlerts();\r\n\t\t\r\n\t\t// If the visitor is coming from Google Adwords or PriceRunner, update the price\r\n\t\tif (XmxApp.isComingFromGoogleAdwords() || XmxApp.isComingFromPriceRunner())\r\n\t\t{\r\n\t\t\tupdatePrice();\r\n\t\t}\r\n\t\t\r\n\t\t// Update flash sale hint\r\n\t\tupdateFlashSaleHint();\r\n\t\t\r\n\t\t// Update sales int\r\n\t\tupdateSalesHint();\r\n\r\n\t\t// Update the flyout\r\n\t\tupdateFlyout();\r\n\r\n\t\t// Send view impression to Google Analytics 4\r\n\t\t// For config products, send the parent and the selected child\r\n\t\tif (_configuration.productType == 'configurable')\r\n\t\t{\r\n\t\t\tsendGoogleAnalyticsView([_configuration.productId, _configuration.selectedProductId]);\r\n\r\n\t\t\t// Send Impressions to ourselves\r\n\t\t\t/*global XmxEventQueue*/\r\n\t\t\tXmxEventQueue.trackEvent('pv', \r\n\t\t\t{\r\n\t\t\t\t'p': _configuration.productId\r\n\t\t\t});\r\n\r\n\t\t\tXmxEventQueue.trackEvent('pv', \r\n\t\t\t{\r\n\t\t\t\t'p': _configuration.selectedProductId\r\n\t\t\t});\r\n\t\t}\r\n\t\telse \r\n\t\t{\r\n\t\t\tsendGoogleAnalyticsView([_configuration.selectedProductId]);\r\n\r\n\t\t\t// Send Impressions to ourselves\r\n\t\t\t/*global XmxEventQueue*/\r\n\t\t\tXmxEventQueue.trackEvent('pv', \r\n\t\t\t{\r\n\t\t\t\t'p': _configuration.selectedProductId\r\n\t\t\t});\r\n\t\t}\r\n\r\n\t\t// Clerk is not loaded yet\r\n\r\n\t\t//initializeRecovery();\r\n }\r\n\r\n\tfunction onAccordionInputChange()\r\n\t{\r\n\t\tvar $input = jQuery(this);\r\n\t\tvar accordionId = $input.data('accordion-id');\r\n\r\n\t\t/*global XmxEventQueue*/\r\n\t\tXmxEventQueue.trackEvent('pac', \r\n\t\t{\r\n\t\t\t'p': _selectedProductId,\r\n\t\t\t'a': accordionId\r\n\t\t});\r\n\t}\r\n\r\n\t/**\r\n\t * Sends a product impression to Clerk\r\n\t */\r\n\tfunction sendClerkProductView(productId)\r\n\t{\r\n\t\tif (XmxApp.supportsClerk())\r\n\t\t{\r\n\t\t\tClerk.call\r\n\t\t\t(\r\n\t\t\t\t'log/product',\r\n\t\t\t\t{\r\n\t\t\t\t\tkey: window.naeAppConfig.clerkApiKey,\r\n\t\t\t\t\tproduct: productId\r\n\t\t\t\t}\r\n\t\t\t);\r\n\t\t}\r\n\t}\r\n\r\n\t/**\r\n\t * \r\n\t */\r\n\t/*function initializeRecovery()\r\n\t{\r\n\t\tvar enableRecoverey = false;\r\n\t\tvar googleClickId = XmxApp.extractHttpGetParameter('gclid');\r\n\r\n\t\tif (googleClickId != '')\r\n\t\t{\r\n\t\t\tenableRecoverey = true;\r\n\t\t}\r\n\t\telse \r\n\t\t{\r\n\t\t\tif (document.referrer != '')\r\n\t\t\t{\r\n\t\t\t\tif (document.referrer.indexOf('.google.') != -1)\r\n\t\t\t\t{\r\n\t\t\t\t\tenableRecoverey = true;\r\n\t\t\t\t}\r\n\t\t\t\telse \r\n\t\t\t\t{\r\n\t\t\t\t\tif (document.referrer.indexOf('.m-shop.') != -1)\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\tenableRecoverey = true;\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\tif (enableRecoverey)\r\n\t\t{\r\n\t\t\tif (typeof window.history !== 'undefined')\r\n\t\t\t{\r\n\t\t\t\twindow.history.pushState({ product: _selectedProductId }, document.title, document.location.href);\r\n\r\n\t\t\t\twindow.addEventListener('popstate', function(event) \r\n\t\t\t\t{\r\n\t\t\t\t\tevent.preventDefault();\r\n\t\t\t\t\tevent.stopPropagation();\r\n\r\n\t\t\t\t\twindow.location = '/clerk/product/alternative?id=' + _selectedProductId;\r\n\r\n\t\t\t\t\treturn false;\r\n\t\t\t\t});\r\n\t\t\t}\r\n\t\t}\r\n\t}*/\r\n\r\n\t/**\r\n\t * Customer has changed the rating of the write review form\r\n\t */\r\n\tfunction onWriteReviewFormRatingChange()\r\n\t{\r\n\t\tvar rating = parseInt($_writeReviewFormRating.val());\r\n\r\n\t\tif (rating <= 3)\r\n\t\t{\r\n\t\t\t$_writeReviewCustomerServiceMessage.show();\r\n\t\t}\r\n\t\telse \r\n\t\t{\r\n\t\t\t$_writeReviewCustomerServiceMessage.hide();\r\n\t\t}\r\n\t}\r\n\r\n\t/**\r\n\t * Sends the view event to Google Analytics 4\r\n\t * \r\n\t * @param array productIds\r\n\t */\r\n\tfunction sendGoogleAnalyticsView(productIds)\r\n\t{\r\n\t\tvar items = [];\r\n\t\tvar value = 0;\r\n\r\n\t\tfor (var i in productIds)\r\n\t\t{\r\n\t\t\tvar productId = productIds[i];\r\n\t\t\tvar productData = _configuration.productData[productId];\r\n\r\n\t\t\titems.push(\r\n\t\t\t{\r\n\t\t\t\titem_id: productData['sku'],\r\n\t\t\t\titem_name: productData['name'],\r\n\t\t\t\tprice: productData['finalPriceExclVat'],\r\n\t\t\t\tquantity: 1\r\n\t\t\t});\r\n\r\n\t\t\tvalue += productData['finalPriceExclVat'];\r\n\t\t}\r\n\r\n\t\twindow.dataLayer = window.dataLayer || [];\r\n\t\twindow.dataLayer.push({ ecommerce: null }); \r\n\t\twindow.dataLayer.push(\r\n\t\t{\r\n\t\t\tevent: 'view_item',\r\n\t\t\tecommerce: \r\n\t\t\t{\r\n\t\t\t\tcurrency: window.naeAppConfig.currencyCode,\r\n\t\t\t\tvalue: value,\r\n\t\t\t\titems: items\r\n\t\t\t}\r\n\t\t});\r\n\t}\r\n\r\n\t/**\r\n\t * User wants to see the \"ask a question section\"\r\n\t */\r\n\tfunction onAskQuestionButtonClick()\r\n\t{\r\n\t\t$_askQuestionButton.hide();\r\n\t\t$_askQuestionForm.show();\r\n\t}\r\n\r\n\t/**\r\n\t * User wants to submit a question\r\n\t * \r\n\t * @param {Event} event \r\n\t */\r\n\tfunction onAskQuestionFormSubmit()\r\n\t{\r\n \tvar email;\r\n \tvar body;\r\n \tvar hasValidationErrors = false;\r\n\r\n\t\t// Grab the email\r\n\t\temail = $_questionFormEmail.val().trim();\r\n\r\n\t\t// If the email is not empty, validate it\r\n\t\tif (email != '')\r\n\t\t{\r\n\t\t\tvar emailValidationError = XmxApp.validateEmailAddress(email);\r\n\r\n\t\t\tif (emailValidationError != '')\r\n\t\t\t{\r\n\t\t\t\t$_questionFormEmailMessage.html(emailValidationError);\r\n\t\t\t\t$_questionFormEmailField.addClass('xmx-form-field--error');\r\n\t\t\t\t$_questionFormEmailField.addClass('xmx-form-field--show-message');\r\n\t\t\t\thasValidationErrors = true;\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\t// Remove email message, if we have no problem here\r\n\t\tif (!hasValidationErrors)\r\n\t\t{\r\n\t\t\t$_questionFormEmailMessage.html('');\r\n\t\t\t$_questionFormEmailField.removeClass('xmx-form-field--error');\r\n\t\t\t$_questionFormEmailField.removeClass('xmx-form-field--show-message');\r\n\t\t}\r\n\r\n\t\t// Check that the body is present\r\n\t\tbody = $_questionFormBody.val().trim();\r\n\r\n\t\tif (body == '')\r\n\t\t{\r\n\t\t\t$_questionFormBodyMessage.html(_configuration.translations.reviewMinLength); // = write a little more\r\n\t\t\t$_questionFormBodyField.addClass('xmx-form-field--error');\r\n\t\t\t$_questionFormBodyField.addClass('xmx-form-field--show-message');\r\n\t\t\thasValidationErrors = true;\r\n\t\t}\r\n\t\telse \r\n\t\t{\r\n\t\t\t$_questionFormBodyMessage.html('');\r\n\t\t\t$_questionFormBodyField.removeClass('xmx-form-field--error');\r\n\t\t\t$_questionFormBodyField.removeClass('xmx-form-field--show-message');\r\n\t\t}\r\n\r\n\t\t// If we have validation errors, get the hell out of here\r\n\t\tif (hasValidationErrors)\r\n\t\t{\r\n\t\t\treturn false;\r\n\t\t}\r\n\r\n \t// If we are already saving the question, abort\r\n\t\tif (_isSavingQuestion)\r\n \t{\r\n\t\t\treturn false;\r\n \t}\r\n\r\n \t// Remember that we are saving the question\r\n\t\t_isSavingQuestion = true;\r\n\r\n \t// Disable the button and show the loading bubbles\r\n \t$_askQuestionFormButton.attr('disabled', true);\r\n\t\t$_askQuestionFormButton.addClass('xmx-button--loading');\r\n\r\n \t// Get some new questions\r\n\t\tjQuery.ajax\r\n\t\t({\r\n\t\t\turl: '/ajax/product/askQuestion',\r\n\t\t\tdataType: 'json',\r\n\t\t\ttype: 'post',\r\n\t\t\tdata:\r\n\t\t\t{\r\n\t\t\t\t'productId': _configuration.productId,\r\n\t\t\t\t'storeId': _configuration.storeId,\r\n\t\t\t\t'email': email,\r\n\t\t\t\t'question': body\r\n\t\t\t},\r\n\t\t\tsuccess: function(response)\r\n\t\t\t{\r\n\t\t\t\tif (response.success)\r\n\t\t\t\t{\r\n\t\t\t\t\t// Reset the form\r\n\t\t\t\t\t$_questionFormEmail.val('');\r\n\t\t\t\t\t$_questionFormBody.val('');\r\n\r\n\t\t\t\t\t// And disable it\r\n\t\t\t\t\t$_questionFormEmail.attr('disabled', true);\r\n\t\t\t\t\t$_questionFormBody.attr('disabled', true);\r\n\r\n\t\t\t\t\t// Show the message\r\n\t\t\t\t\t$_askQuestionFormButton.hide();\r\n\t\t\t\t\t$_askQuestionMessage.show();\r\n\t\t\t\t}\r\n\t\t\t},\r\n\t\t\tcomplete: function()\r\n\t\t\t{\r\n\t\t\t\t// We are not saving anymore\r\n\t\t\t\t_isSavingQuestion = false;\r\n\r\n\t\t\t\t// Enable the button and hide the loading bubbles\r\n\t\t\t\t$_askQuestionFormButton.attr('disabled', false);\r\n\t\t\t\t$_askQuestionFormButton.removeClass('xmx-button--loading');\r\n\t\t\t}\r\n\t\t});\r\n\r\n\t\treturn false;\r\n\t}\r\n\t\r\n\t/**\r\n\t * User has clicked a question vote button\r\n\t */\r\n\tfunction onQuestionVoteButtonClick()\r\n\t{\r\n\t\tvar $button = jQuery(this);\r\n\t\tvar $question = $button.closest('.xmx-question');\r\n\t\tvar buttonDirection = $button.data('question-vote-button');\r\n\t\tvar questionId = $question.data('question-id');\r\n\t\tvar votedDirection = $question.data('voted');\r\n\t\tvar $upVoteButton = jQuery('[data-question-vote-button=\"up\"]', $question);\r\n\t\tvar $downVoteButton = jQuery('[data-question-vote-button=\"down\"]', $question);\r\n\t\tvar $upVoteButtonLabel = jQuery('.xmx-button-label', $upVoteButton);\r\n\t\tvar $downVoteButtonLabel = jQuery('.xmx-button-label', $downVoteButton);\r\n\t\tvar upVotes = $upVoteButtonLabel.data('question-up-votes');\r\n\t\tvar downVotes = $downVoteButtonLabel.data('question-down-votes');\r\n\t\tvar newDirection = 'none';\r\n\r\n\t\tif (votedDirection == 'none')\r\n\t\t{\r\n\t\t\tvotedDirection = null;\r\n\t\t}\r\n\r\n\t\tif (votedDirection == null)\r\n\t\t{\r\n\t\t\t// We have never voted yet\r\n\t\t\tif (buttonDirection == 'up')\r\n\t\t\t{\r\n\t\t\t\t// Add an up vote\r\n\t\t\t\tupVotes++;\r\n\t\t\t\tnewDirection = 'up';\r\n\t\t\t}\r\n\t\t\telse \r\n\t\t\t{\r\n\t\t\t\t// Add a down vote\r\n\t\t\t\tdownVotes++;\r\n\t\t\t\tnewDirection = 'down';\r\n\t\t\t}\r\n\t\t}\r\n\t\telse \r\n\t\t{\r\n\t\t\t// We have already voted\r\n\t\t\tif (buttonDirection == votedDirection)\r\n\t\t\t{\r\n\t\t\t\tnewDirection = 'none';\r\n\r\n\t\t\t\t// We want to undo a vote\r\n\t\t\t\tif (buttonDirection == 'up')\r\n\t\t\t\t{\r\n\t\t\t\t\t// Undo an up vote\r\n\t\t\t\t\tupVotes--;\r\n\t\t\t\t}\r\n\t\t\t\telse \r\n\t\t\t\t{\r\n\t\t\t\t\t// Undo a down vote\r\n\t\t\t\t\tdownVotes--;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\telse \r\n\t\t\t{\r\n\t\t\t\t// We want to change votes\r\n\t\t\t\tif (buttonDirection == 'up')\r\n\t\t\t\t{\r\n\t\t\t\t\t// Change to up vote\r\n\t\t\t\t\tupVotes++;\r\n\t\t\t\t\tdownVotes--;\r\n\t\t\t\t\tnewDirection = 'up';\r\n\t\t\t\t}\r\n\t\t\t\telse \r\n\t\t\t\t{\r\n\t\t\t\t\t// Change to down vote\r\n\t\t\t\t\tdownVotes++;\r\n\t\t\t\t\tupVotes--;\r\n\t\t\t\t\tnewDirection = 'down';\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\t$upVoteButtonLabel.data('question-up-votes', upVotes);\r\n\t\t$upVoteButtonLabel.html(upVotes);\r\n\t\t$downVoteButtonLabel.data('question-down-votes', downVotes);\r\n\t\t$downVoteButtonLabel.html(downVotes);\r\n\t\t$question.data('voted', newDirection);\r\n\r\n\t\tif (newDirection == 'up')\r\n\t\t{\r\n\t\t\t$upVoteButton.addClass('xmx-button--voted');\r\n\t\t}\r\n\t\telse \r\n\t\t{\r\n\t\t\t$upVoteButton.removeClass('xmx-button--voted');\r\n\t\t}\r\n\r\n\t\tif (newDirection == 'down')\r\n\t\t{\r\n\t\t\t$downVoteButton.addClass('xmx-button--voted');\r\n\t\t}\r\n\t\telse \r\n\t\t{\r\n\t\t\t$downVoteButton.removeClass('xmx-button--voted');\r\n\t\t}\r\n\r\n\t\t// Fire and forget\r\n\t\tjQuery.ajax\r\n\t\t({\r\n\t\t\turl: '/ajax/product/voteQuestion',\r\n\t\t\tdataType: 'json',\r\n\t\t\ttype: 'post',\r\n\t\t\tdata:\r\n\t\t\t{\r\n\t\t\t\t'productId': _configuration.productId,\r\n\t\t\t\t'storeId': _configuration.storeId,\r\n\t\t\t\t'questionId': questionId,\r\n\t\t\t\t'direction': newDirection\r\n\t\t\t}\r\n\t\t});\r\n\t}\r\n\r\n\t/**\r\n\t * Updates the Fly-Out\r\n\t */\r\n\tfunction updateFlyout()\r\n\t{\r\n\t\tvar productData = _configuration.productData[_selectedProductId];\r\n\t\tvar finalPrice = productData.finalPrice;\r\n\t\tvar basePrice = productData.basePrice;\r\n\r\n\t\tif (XmxApp.isComingFromGoogleAdwords())\r\n\t\t{\r\n\t\t\tif (productData.adwordsPrice)\r\n\t\t\t{\r\n\t\t\t\tif (productData.adwordsPrice < finalPrice)\r\n\t\t\t\t{\r\n\t\t\t\t\tfinalPrice = productData.adwordsPrice;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\tif (XmxApp.isComingFromPriceRunner())\r\n\t\t{\r\n\t\t\tif (productData.priceRunnerPrice)\r\n\t\t\t{\r\n\t\t\t\tif (productData.priceRunnerPrice < finalPrice)\r\n\t\t\t\t{\r\n\t\t\t\t\tfinalPrice = productData.priceRunnerPrice;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\tif (_isUsingFlashSalePrice)\r\n\t\t{\r\n\t\t\tif (productData.flashSalePrice > 0)\r\n\t\t\t{\r\n\t\t\t\tfinalPrice = productData.flashSalePrice;\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\t// Re-calculate the base price\r\n\t\tif (productData.baseUnitContent > 0)\r\n\t\t{\r\n\t\t\tbasePrice = finalPrice / productData.baseUnitContent;\r\n\t\t}\r\n\r\n\t\t// Empty the price\r\n\t\t$_flyOutPrice.empty();\r\n\r\n\t\t// Rebuild-the price\r\n\t\tvar $price = jQuery('
');\r\n\t\t$price.addClass('xmx-price');\r\n\t\t$price.appendTo($_flyOutPrice);\r\n\t\t\r\n\t\t// Is there a special price?\r\n\t\tif (finalPrice < productData.price)\r\n\t\t{\r\n\t\t\tvar $specialPrice = jQuery('
');\r\n\t\t\t$specialPrice.addClass('xmx-price-new');\r\n\t\t\t$specialPrice.html(XmxApp.formatAmount(finalPrice));\r\n\t\t\t$specialPrice.appendTo($price);\r\n\r\n\t\t\t// productData.discountInfo or productData.adwordsDiscountInfo\r\n\t\t\t// Can be to wide, so lets use classic %\r\n\t\t\tvar savingPercent = finalPrice <= 0 ? 100 : 100 - Math.round(finalPrice * 100 / productData.price);\r\n\r\n\t\t\tvar $discount = jQuery('
');\r\n\t\t\t$discount.addClass('xmx-price-discount');\r\n\t\t\t$discount.html('-' + savingPercent + '%');\r\n\t\t\t$discount.appendTo($price);\r\n\t\t}\r\n\t\telse \r\n\t\t{\r\n\t\t\tvar $regularPrice = jQuery('
');\r\n\t\t\t$regularPrice.addClass('xmx-price-reguar');\r\n\t\t\t$regularPrice.html(XmxApp.formatAmount(finalPrice));\r\n\t\t\t$regularPrice.appendTo($price);\r\n\t\t}\r\n\r\n\t\t// Update the base price\r\n\t\tif (basePrice > 0)\r\n\t\t{\r\n\t\t\tvar $unitPrice = jQuery('
');\r\n\t\t\t$unitPrice.addClass('xmx-price-unit');\r\n\r\n\t\t\tif (productData.baseUnitValue == 1)\r\n\t\t\t{\r\n\t\t\t\t$unitPrice.html(XmxApp.formatAmount(basePrice) + ' / ' + productData.baseUnitMeasure);\r\n\t\t\t}\r\n\t\t\telse \r\n\t\t\t{\r\n\t\t\t\t$unitPrice.html(XmxApp.formatAmount(basePrice) + ' / ' + XmxApp.formatUnit(productData.baseUnitValue, productData.baseUnitMeasure));\r\n\t\t\t}\r\n\r\n\t\t\t$unitPrice.appendTo($_flyOutPrice);\r\n\t\t}\r\n\r\n\t\t// Update the image\r\n\t\tif (productData.images.length > 0)\r\n\t\t{\r\n\t\t\t$_flyOutImage.attr('src', productData.images[0].mobileThumbnailUrl);\r\n\t\t}\r\n\r\n\t\t// Figure out if there is a badge\r\n\t\tvar badgeText = null;\r\n\r\n\t\t// Empty the badge container\r\n\t\t$_flyOutBadge.empty();\r\n\r\n\t\tif (productData.stockColor == 'red')\r\n\t\t{\r\n\t\t\tbadgeText = productData.stockLabel;\r\n\t\t}\r\n\r\n\t\tif (badgeText != null)\r\n\t\t{\r\n\t\t\tvar $badge = jQuery('
');\r\n\t\t\t$badge.addClass('xmx-badge');\r\n\t\t\t$badge.addClass('xmx-badge--special');\r\n\t\t\t$badge.html(badgeText);\r\n\t\t\t$badge.appendTo($_flyOutBadge)\r\n\t\t}\r\n\t}\r\n\r\n\t/**\r\n\t * CTA Fly-Out Button pressed\r\n\t */\r\n\tfunction onFlyOutButtonClick()\r\n\t{\r\n\t\t$_addToCartButton.click();\r\n\t}\r\n\t\r\n\t/**\r\n\t * Called on scroll\r\n\t */\r\n\tfunction handleScroll()\r\n\t{\r\n\t\tvar scrollPosition = XmxApp.scrollOffsetY;\r\n\r\n\t\tif (scrollPosition > _flyOutShowOffset)\r\n\t\t{\r\n\t\t\tif (!_flyOutVisible)\r\n\t\t\t{\r\n\t\t\t\t$_flyOut.addClass('xmx-cta-flyout--visible');\r\n\t\t\t\t_flyOutVisible = true;\r\n\t\t\t}\r\n\t\t}\r\n\t\telse \r\n\t\t{\r\n\t\t\tif (_flyOutVisible)\r\n\t\t\t{\r\n\t\t\t\t$_flyOut.removeClass('xmx-cta-flyout--visible');\r\n\t\t\t\t_flyOutVisible = false;\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n\r\n\t/**\r\n\t * User has clicked flash sale head\r\n\t */\r\n\tfunction onFlashSaleHintHeadClick()\r\n\t{\r\n\t\t$_flashSaleHint.toggleClass('xmx-flash-sale-hint--open');\r\n\t}\r\n\r\n\t/**\r\n\t * User has submitted flash sale form\r\n\t * \r\n\t * @param {event} event \r\n\t */\r\n\tfunction onFlashSaleHintFormSubmit(event)\r\n\t{\r\n\t\tvar email;\r\n\t\tvar validationMessage;\r\n\t\tvar hash;\r\n\r\n\t\t// Do not submit twice\r\n\t\tif (!_isSubmittingFlashSaleForm)\r\n\t\t{\r\n\t\t\t// Check that the email address is not empty\r\n\t\t\temail = $_flashSaleHintFormInput.val().toLowerCase().trim();\r\n\t\t\tvalidationMessage = XmxApp.validateEmailAddress(email);\r\n\r\n\t\t\tif (validationMessage != '')\r\n\t\t\t{\r\n\t\t\t\t// Validation failed\r\n\t\t\t\t$_flashSaleHintFormMessage.html(validationMessage);\r\n\t\t\t\t$_flashSaleHintFormMessage.addClass('xmx-flash-sale-hint-form-message--visible');\r\n\t\t\t}\r\n\t\t\telse \r\n\t\t\t{\r\n\t\t\t\thash = XmxApp.generateHashCode(email);\r\n\r\n\t\t\t\t// Block clicking twice\r\n\t\t\t\t_isSubmittingFlashSaleForm = true;\r\n\r\n\t\t\t\t// Validation passed\r\n\t\t\t\t$_flashSaleHintFormMessage.removeClass('xmx-flash-sale-hint-form-message--visible');\r\n\t\t\t\t$_flashSaleHintFormMessage.html('');\r\n\r\n\t\t\t\t// Show the ajax loader\r\n\t\t\t\t$_flashSaleHintFormInput.attr('disabled', true);\r\n\t\t\t\t$_flashSaleHintFormButton.attr('disabled', true);\r\n\r\n\t\t\t\t// Tell the server\r\n\t\t\t\t// Post the data\r\n\t\t\t\tjQuery.ajax\r\n\t\t\t\t({\r\n\t\t\t\t\turl: '/ajax/product/flashsale',\r\n\t\t\t\t\tdataType: 'json',\r\n\t\t\t\t\ttype: 'post',\r\n\t\t\t\t\tdata:\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\t'productId': _selectedProductId,\r\n\t\t\t\t\t\t'storeId': _configuration.storeId,\r\n\t\t\t\t\t\t'email': email,\r\n\t\t\t\t\t\t'hash': hash\r\n\t\t\t\t\t},\r\n\t\t\t\t\tsuccess: function (response)\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\tif (response.success)\r\n\t\t\t\t\t\t{\r\n\t\t\t\t\t\t\t// Reset the form\r\n\t\t\t\t\t\t\t$_flashSaleHintFormInput.val('');\r\n\r\n\t\t\t\t\t\t\t// Update the price visible for the user\r\n\t\t\t\t\t\t\tupdateFlashSalePrice();\r\n\r\n\t\t\t\t\t\t\t// Tell the add to cart form, it is a flash sale\r\n\r\n\t\t\t\t\t\t\t// Remember that we have a flash sale price\r\n\t\t\t\t\t\t\t_isUsingFlashSalePrice = true;\r\n\r\n\t\t\t\t\t\t\t// Hide the hint\r\n\t\t\t\t\t\t\t$_flashSaleHint.hide();\r\n\r\n\t\t\t\t\t\t\t// Show the success message\r\n\t\t\t\t\t\t\t$_flashSaleHintSuccessMessage.addClass('xmx-message--visible');\r\n\r\n\t\t\t\t\t\t\t// Update the add to cart form, so that the flash sale price is \r\n\t\t\t\t\t\t\t// whenever the user adds it to the cart\r\n\t\t\t\t\t\t\t$_flashSaleAddToCartHash.val(response.cartHash);\r\n\r\n\t\t\t\t\t\t\tupdateFlyout();\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t},\r\n\t\t\t\t\tcomplete: function ()\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\t// We are not saving anymore\r\n\t\t\t\t\t\t_isSubmittingFlashSaleForm = false;\r\n\r\n\t\t\t\t\t\t// Remove loading bubbles\r\n\t\t\t\t\t\t$_flashSaleHintFormInput.attr('disabled', false);\r\n\t\t\t\t\t\t$_flashSaleHintFormButton.attr('disabled', false);\r\n\t\t\t\t\t}\r\n\t\t\t\t});\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\t// Always cancel the event\r\n\t\tevent.stopPropagation();\r\n\t\tevent.preventDefault();\r\n\r\n\t\treturn false;\r\n\t}\r\n\r\n\t/**\r\n\t * \r\n\t */\r\n\tfunction updateSalesHint()\r\n\t{\r\n\t\t// If there is no sales info, get out of here\r\n\t\tif (_configuration.sales === null)\r\n\t\t{\r\n\t\t\treturn;\r\n\t\t}\r\n\r\n\t\tvar elapsedHours = (XmxApp.getCurrentTimestamp() - _configuration.sales.time) / (60 * 60);\r\n\t\tvar quantitySold = Math.floor(_configuration.sales.quantity + _configuration.sales.speed * elapsedHours);\r\n\t\tvar hint = _configuration.translations.salesInfo.replace('$1', quantitySold);\r\n\r\n\t\t$_salesHint.html(hint);\r\n\t\t$_salesHint.show();\r\n\t}\r\n\r\n\t/**\r\n\t * \r\n\t */\r\n\tfunction updateFlashSaleHint()\r\n\t{\r\n\t\tvar productData = _configuration.productData[_selectedProductId];\r\n\t\tvar now = XmxApp.getCurrentTimestamp();\r\n\t\tvar showFlashSaleHint = false;\r\n\r\n\t\tif (productData.flashSalePrice > 0)\r\n\t\t{\r\n\t\t\tif (now >= productData.flashSaleStart)\r\n\t\t\t{\r\n\t\t\t\tif (now <= productData.flashSaleEnd)\r\n\t\t\t\t{\r\n\t\t\t\t\tshowFlashSaleHint = true;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\t// Reset that we are using the flash sale\r\n\t\t_isUsingFlashSalePrice = false;\r\n\r\n\t\tif (!showFlashSaleHint)\r\n\t\t{\r\n\t\t\t$_flashSaleHintArea.hide();\r\n\t\t}\r\n\t\telse \r\n\t\t{\r\n\t\t\t// Update title and description\r\n\t\t\tvar title = '';\r\n\t\t\tvar description = '';\r\n\r\n\t\t\tswitch (productData.flashSaleMode)\r\n\t\t\t{\r\n\t\t\t\t// Save an additional X%\r\n\t\t\t\tcase 'percent-discount':\r\n\t\t\t\t{\r\n\t\t\t\t\ttitle = _configuration.translations.flashSaleTitlePercentDiscount;\r\n\t\t\t\t\tbreak;\r\n\t\t\t\t}\r\n\r\n\t\t\t\t// Save an additional X kr\r\n\t\t\t\tcase 'amount-discount':\r\n\t\t\t\t{\r\n\t\t\t\t\ttitle = _configuration.translations.flashSaleTitleAmountDiscount;\r\n\t\t\t\t\tbreak;\r\n\t\t\t\t}\r\n\r\n\t\t\t\t// Get for it for X kr\r\n\t\t\t\tcase 'fixed-price':\r\n\t\t\t\t{\r\n\t\t\t\t\ttitle = _configuration.translations.flashSaleTitleFixedPrice;\r\n\t\t\t\t\tbreak;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\r\n\t\t\t// Replace placeholders\r\n\t\t\tvar savingPercent = 100 - Math.round(productData.flashSalePrice * 100 / productData.finalPrice);\r\n\t\t\tvar savingAmount = productData.finalPrice - productData.flashSalePrice;\r\n\r\n\t\t\tvar savingPercentString = savingPercent + '%';\r\n\t\t\tvar savingAmountString = XmxApp.formatAmount(savingAmount);\r\n\t\t\tvar priceAmountString = XmxApp.formatAmount(productData.flashSalePrice);\r\n\r\n\t\t\ttitle = title.replace('$1', savingPercentString);\r\n\t\t\ttitle = title.replace('$2', savingAmountString);\r\n\t\t\ttitle = title.replace('$3', priceAmountString);\r\n\r\n\t\t\tdescription = _configuration.translations.flashSaleDescription;\r\n\t\t\tdescription = description.replace('$1', savingPercentString);\r\n\t\t\tdescription = description.replace('$2', savingAmountString);\r\n\t\t\tdescription = description.replace('$3', priceAmountString);\r\n\r\n\t\t\t// Update elements\r\n\t\t\t$_flashSaleAddToCartHash.val('');\r\n\t\t\t$_flashSaleHintFormMessage.removeClass('xmx-flash-sale-hint-form-message--visible');\r\n\t\t\t$_flashSaleHintFormMessage.html('');\r\n\t\t\t$_flashSaleHintSuccessMessage.removeClass('xmx-message--visible');\r\n\t\t\t$_flashSaleHintDescription.html(description);\r\n\t\t\t$_flashSaleHintTitle.html(title);\r\n\t\t\t$_flashSaleHintArea.show();\r\n\t\t\t$_flashSaleHint.addClass('xmx-flash-sale-hint--open');\r\n\t\t\t$_flashSaleHint.show();\r\n\t\t}\r\n\t}\r\n\r\n\t/**\r\n\t * Updates the price UI\r\n\t */\r\n\tfunction updateFlashSalePrice()\r\n\t{\r\n\t\tvar productData = _configuration.productData[_selectedProductId];\r\n\t\tvar $line1;\r\n\t\tvar $line2;\r\n\t\tvar $freight;\r\n\t\tvar $freightCaption;\r\n\t\tvar $oldPrice;\r\n\t\tvar $saving;\r\n\t\tvar $price;\r\n\t\tvar saving;\r\n\t\tvar discountInfo;\r\n\r\n\t\t// Calculate saving %\r\n\t\tsaving = 100 - Math.round(productData.flashSalePrice * 100 / productData.price);\r\n\t\tdiscountInfo = _configuration.translations.save + ' ' + saving + '%';\r\n\r\n\t\t// Throw away the old info\r\n\t\t$_productPrice.empty();\r\n\r\n\t\t// Add line 1\r\n\t\t$line1 = jQuery('
');\r\n\t\t$line1.addClass('xmx-product-detail-price-line-1');\r\n\t\t$line1.appendTo($_productPrice);\r\n\r\n\t\t// Add line 2\r\n\t\t$line2 = jQuery('
');\r\n\t\t$line2.addClass('xmx-product-detail-price-line-2');\r\n\t\t$line2.appendTo($_productPrice);\r\n\r\n\t\t$oldPrice = jQuery('
');\r\n\t\t$oldPrice.addClass('xmx-product-detail-price-old');\r\n\t\t$oldPrice.html(XmxApp.formatPrice(productData.price));\r\n\t\t$oldPrice.appendTo($line1);\r\n\r\n\t\t$saving = jQuery('
');\r\n\t\t$saving.addClass('xmx-product-detail-price-saving');\r\n\t\t$saving.html(discountInfo);\r\n\t\t$saving.appendTo($line1);\r\n\r\n\t\t// Build the price\r\n\t\t$price = jQuery('
');\r\n\t\t$price.addClass('xmx-product-detail-price-special');\r\n\t\t$price.html(XmxApp.formatPrice(productData.flashSalePrice));\r\n\t\t$price.appendTo($line2);\r\n\r\n\t\t// Build shipping\r\n\t\t$freight = jQuery('
');\r\n\t\t$freight.addClass('xmx-product-detail-price-freight');\r\n\t\t$freight.attr('id', 'product-freight');\r\n\t\t$freight.attr('title', _configuration.translations.readMoreAboutShipping);\r\n\t\t$freight.appendTo($line2);\r\n\r\n\t\t// Re-hook it\r\n\t\t$_productFreight = $freight;\r\n\t\t$_productFreight.on('click', onProductFreightClick);\r\n\r\n\t\t// Caption the freight\r\n\t\t$freightCaption = jQuery('');\r\n\t\t$freightCaption.addClass('xmx-product-detail-price-freight-inner');\r\n\r\n\t\tif (productData.flashSalePrice >= _configuration.shipping.freeAt)\r\n\t\t{\r\n\t\t\t$freightCaption.html(_configuration.translations.freeShipping);\r\n\r\n\t\t\t// Update price in shipping tab\r\n\t\t\t$_freeFreightLine.show();\r\n\t\t\t$_regularFreightLine.hide();\r\n\t\t}\r\n\t\telse \r\n\t\t{\r\n\t\t\t$freightCaption.html(_configuration.translations.shipsForX.replace('%1', XmxApp.formatAmount(_configuration.shipping.fee)));\r\n\r\n\t\t\t// Update price in shipping tab\r\n\t\t\t$_freeFreightLine.hide();\r\n\t\t\t$_regularFreightLine.show();\r\n\t\t}\r\n\r\n\t\t$freightCaption.appendTo($freight);\r\n\t}\r\n\r\n /**\r\n * Sends an alert if the visitor comes from Google Adwords and sees an out of stock\r\n * product.\r\n */\r\n function sendStockAlerts()\r\n {\r\n \tvar googleClickId;\r\n\r\n \tif (_configuration.isCompletelyOutOfStock)\r\n \t{\r\n\t\t\tjQuery.ajax\r\n\t\t\t({\r\n\t\t\t\turl: '/ajax/product/logOutOfStockProductView',\r\n\t\t\t\tdataType: 'json',\r\n\t\t\t\ttype: 'post',\r\n\t\t\t\tdata:\r\n\t\t\t\t{\r\n\t\t\t\t\t'productId': _selectedProductId,\r\n\t\t\t\t\t'storeId': _configuration.storeId,\r\n\t\t\t\t\t'url': window.location.href\r\n\t\t\t\t}\r\n\t\t\t});\r\n\r\n \t\t// Google Adwords\r\n \t\tgoogleClickId = XmxApp.extractHttpGetParameter('gclid');\r\n\r\n \t\tif (googleClickId != '')\r\n \t\t{\r\n\t\t\t\tjQuery.ajax\r\n\t\t\t\t({\r\n\t\t\t\t\turl: '/ajax/product/googleAdwordsAlert',\r\n\t\t\t\t\tdataType: 'json',\r\n\t\t\t\t\ttype: 'post',\r\n\t\t\t\t\tdata:\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\t'productId': _selectedProductId,\r\n\t\t\t\t\t\t'storeId': _configuration.storeId,\r\n\t\t\t\t\t\t'url': window.location.href,\r\n\t\t\t\t\t\t'clickId': googleClickId\r\n\t\t\t\t\t}\r\n\t\t\t\t});\r\n \t\t}\r\n \t}\r\n }\r\n\r\n /**\r\n * A user is submitting the \"please send me an email once its back\" form\r\n */\r\n function onOutOfStockFormSubmit()\r\n {\r\n \tvar email = $_outOfStockReminderEmail.val().trim();\r\n\r\n \t// No realy validation for now\r\n \tif (email == '')\r\n \t{\r\n \t\treturn false;\r\n \t}\r\n\r\n \t// If we are already saving things, get out of here\r\n \tif (_isSavingStockReminder)\r\n \t{\r\n \t\treturn false;\r\n \t}\r\n\r\n \t_isSavingStockReminder = true;\r\n\r\n \t// Disable the button and show the loading bubbles\r\n \t$_outOfStockReminderButton.attr('disabled', true);\r\n \t$_outOfStockReminderButton.addClass('xmx-button--loading');\r\n\r\n \t// Post the data\r\n\t\tjQuery.ajax\r\n\t\t({\r\n\t\t\turl: '/ajax/product/postStockReminder',\r\n\t\t\tdataType: 'json',\r\n\t\t\ttype: 'post',\r\n\t\t\tdata:\r\n\t\t\t{\r\n\t\t\t\t'productId': _selectedProductId,\r\n\t\t\t\t'storeId': _configuration.storeId,\r\n\t\t\t\t'email': email\r\n\t\t\t\t// TODO: checksum\r\n\t\t\t},\r\n\t\t\tsuccess: function(response)\r\n\t\t\t{\r\n\t\t\t\tif (response.success)\r\n\t\t\t\t{\r\n\t\t\t\t\t// Reset the form\r\n\t\t\t\t\t$_outOfStockReminderEmail.val('');\r\n\r\n\t\t\t\t\t// Hide the form\r\n\t\t\t\t\t$_outOfStockReminderForm.hide();\r\n\r\n\t\t\t\t\t// Show the message\r\n\t\t\t\t\t$_outOfStockReminderMessage.addClass('xmx-message--visible');\r\n\t\t\t\t}\r\n\t\t\t},\r\n\t\t\tcomplete: function()\r\n\t\t\t{\r\n\t\t\t\t// We are not saving anymore\r\n\t\t\t\t_isSavingStockReminder = false;\r\n\r\n\t\t\t\t// Disable the button and hide the loading bubbles\r\n\t\t\t\t$_outOfStockReminderButton.attr('disabled', false);\r\n\t\t\t\t$_outOfStockReminderButton.removeClass('xmx-button--loading');\r\n\t\t\t}\r\n\t\t});\r\n\r\n \treturn false;\r\n }\r\n\r\n /**\r\n * The user has submittedthe \"Post Review\" form\r\n *\r\n * This solution is not elegant, but does the job for now\r\n */\r\n function onWriteReviewFormSubmit()\r\n {\r\n \tvar rating;\r\n \tvar name;\r\n \tvar title;\r\n \tvar body;\r\n \tvar hasValidationErrors = false;\r\n \tvar minimumBodyLength = $_writeReviewFormBody.data('cool-length');\r\n\r\n \t// The rating is always present, since its a star rating\r\n \trating = $_writeReviewFormRating.val();\r\n\r\n \t// Check that the name is present\r\n\t\tname = $_writeReviewFormName.val().trim();\r\n\r\n\t\tif (name == '')\r\n\t\t{\r\n\t\t\t$_writeReviewFormNameMessage.html(_configuration.translations.pleaseEnterAName);\r\n\t\t\t$_writeReviewFormNameContainer.addClass('xmx-form-field--error');\r\n\t\t\t$_writeReviewFormNameContainer.addClass('xmx-form-field--show-message');\r\n\t\t\thasValidationErrors = true;\r\n\t\t}\r\n\t\telse \r\n\t\t{\r\n\t\t\t$_writeReviewFormNameContainer.removeClass('xmx-form-field--error');\r\n\t\t\t$_writeReviewFormNameContainer.removeClass('xmx-form-field--show-message');\r\n\t\t}\r\n\r\n\t\t// Check that the title is present\r\n\t\ttitle = $_writeReviewFormTitle.val().trim();\r\n\r\n\t\tif (title == '')\r\n\t\t{\r\n\t\t\t$_writeReviewFormTitleMessage.html(_configuration.translations.pleaseEnterATitle);\r\n\t\t\t$_writeReviewFormTitleContainer.addClass('xmx-form-field--error');\r\n\t\t\t$_writeReviewFormTitleContainer.addClass('xmx-form-field--show-message');\r\n\t\t\thasValidationErrors = true;\r\n\t\t}\r\n\t\telse \r\n\t\t{\r\n\t\t\t$_writeReviewFormTitleContainer.removeClass('xmx-form-field--error');\r\n\t\t\t$_writeReviewFormTitleContainer.removeClass('xmx-form-field--show-message');\r\n\t\t}\r\n\r\n\t\t// Check that the body is present\r\n\t\tbody = $_writeReviewFormBody.val().trim();\r\n\r\n\t\tif (body == '')\r\n\t\t{\r\n\t\t\t$_writeReviewFormBodyMessage.html(_configuration.translations.pleaseEnterABody);\r\n\t\t\t$_writeReviewFormBodyContainer.addClass('xmx-form-field--error');\r\n\t\t\t$_writeReviewFormBodyContainer.addClass('xmx-form-field--show-message');\r\n\t\t\thasValidationErrors = true;\r\n\t\t}\r\n\t\telse \r\n\t\t{\r\n\t\t\t// Check that the body is of minimum length\r\n\t\t\tif (body.length < minimumBodyLength)\r\n\t\t\t{\r\n\t\t\t\t$_writeReviewFormBodyMessage.html(_configuration.translations.pleaseEnterALongerBody);\r\n\t\t\t\t$_writeReviewFormBodyContainer.addClass('xmx-form-field--error');\r\n\t\t\t\t$_writeReviewFormBodyContainer.addClass('xmx-form-field--show-message');\r\n\t\t\t\thasValidationErrors = true;\r\n\t\t\t}\r\n\t\t\telse \r\n\t\t\t{\r\n\t\t\t\t$_writeReviewFormBodyContainer.removeClass('xmx-form-field--error');\r\n\t\t\t\t$_writeReviewFormBodyContainer.removeClass('xmx-form-field--show-message');\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\t// If we have validation errors, get the hell out of here\r\n\t\tif (hasValidationErrors)\r\n\t\t{\r\n\t\t\treturn false;\r\n\t\t}\r\n\r\n \t// If we are already saving the review, abort\r\n \tif (_isSavingReview)\r\n \t{\r\n\t\t\treturn false;\r\n \t}\r\n\r\n \t// Remember that we are saving the review\r\n \t_isSavingReview = true;\r\n\r\n \t// Disable the button and show the loading bubbles\r\n \t$_writeReviewFormButton.attr('disabled', true);\r\n \t$_writeReviewFormButton.addClass('xmx-button--loading');\r\n\r\n \t// Get some new reviews\r\n\t\tjQuery.ajax\r\n\t\t({\r\n\t\t\turl: '/ajax/product/postReview',\r\n\t\t\tdataType: 'json',\r\n\t\t\ttype: 'post',\r\n\t\t\tdata:\r\n\t\t\t{\r\n\t\t\t\t'productId': _configuration.productId,\r\n\t\t\t\t'storeId': _configuration.storeId,\r\n\t\t\t\t'rating': rating,\r\n\t\t\t\t'name': name,\r\n\t\t\t\t'title': title,\r\n\t\t\t\t'body': body\r\n\t\t\t},\r\n\t\t\tsuccess: function(response)\r\n\t\t\t{\r\n\t\t\t\tif (response.success)\r\n\t\t\t\t{\r\n\t\t\t\t\t// Reset the form\r\n\t\t\t\t\t$_writeReviewFormRating.val(5);\r\n\t\t\t\t\t$_writeReviewFormName.val('');\r\n\t\t\t\t\t$_writeReviewFormTitle.val('');\r\n\t\t\t\t\t$_writeReviewFormBody.val('');\r\n\r\n\t\t\t\t\t// And disable it\r\n\t\t\t\t\t$_writeReviewFormRating.attr('disabled', true);\r\n\t\t\t\t\t$_writeReviewFormName.attr('disabled', true);\r\n\t\t\t\t\t$_writeReviewFormTitle.attr('disabled', true);\r\n\t\t\t\t\t$_writeReviewFormBody.attr('disabled', true);\r\n\r\n\t\t\t\t\t// Show the message\r\n\t\t\t\t\t$_writeReviewFormButton.hide();\r\n\t\t\t\t\t$_writeReviewFormMessage.show();\r\n\r\n\t\t\t\t\t// Hide the customer service message\r\n\t\t\t\t\t$_writeReviewCustomerServiceMessage.hide();\r\n\t\t\t\t}\r\n\t\t\t},\r\n\t\t\tcomplete: function()\r\n\t\t\t{\r\n\t\t\t\t// We are not saving anymore\r\n\t\t\t\t_isSavingReview = false;\r\n\r\n\t\t\t\t// Disable the button and hide the loading bubbles\r\n\t\t\t\t$_writeReviewFormButton.attr('disabled', false);\r\n\t\t\t\t$_writeReviewFormButton.removeClass('xmx-button--loading');\r\n\t\t\t}\r\n\t\t});\r\n\r\n\t\treturn false;\r\n }\r\n\r\n /** \r\n * Called after the user has done something with the review form name\r\n */\r\n function onWriteReviewFormNameInteraction()\r\n {\r\n \t// Update the length indicator\r\n \tupdateInputFieldLengthIndicator($_writeReviewFormName);\r\n\r\n \t// Remove the error message\r\n\t\t$_writeReviewFormNameContainer.removeClass('xmx-form-field--error');\r\n\t\t$_writeReviewFormNameContainer.removeClass('xmx-form-field--show-message');\r\n }\r\n\r\n /** \r\n * Called after the user has done something with the review form title\r\n */\r\n function onWriteReviewFormTitleInteraction()\r\n {\r\n \t// Update the length indicator\r\n \tupdateInputFieldLengthIndicator($_writeReviewFormTitle);\r\n\r\n \t// Remove the error message\r\n\t\t$_writeReviewFormTitleContainer.removeClass('xmx-form-field--error');\r\n\t\t$_writeReviewFormTitleContainer.removeClass('xmx-form-field--show-message');\r\n }\r\n\r\n /** \r\n * Called after the user has done something with the review form title\r\n */\r\n function onWriteReviewFormBodyInteraction()\r\n {\r\n \t// Update the length indicator\r\n \tupdateTextareaLengthIndicator($_writeReviewFormBody);\r\n \tupdateReviewFormTextareaSize();\r\n\r\n \t// Remove the error message\r\n\t\t$_writeReviewFormBodyContainer.removeClass('xmx-form-field--error');\r\n\t\t$_writeReviewFormBodyContainer.removeClass('xmx-form-field--show-message');\r\n }\r\n\r\n /**\r\n * Updates the size of the review form body. The same \"could\" be done\r\n * with the contenteditable=\"true\", but nah..\r\n */\r\n function updateReviewFormTextareaSize()\r\n {\r\n \tvar content;\r\n \tvar height;\r\n\r\n \t// Get the content from the text area\r\n \tcontent = $_writeReviewFormBody.val();\r\n\r\n \t// Replace all line breaks\r\n \tcontent = content.replace(/\\n/g, '
');\r\n\r\n \t// Add one more character, as the last line break at the \r\n \t// end of the string does not seem to count\r\n \tcontent += '
a';\r\n\r\n \t// Copy over the content from the text area to the shadow\r\n \t$_writeReviewFormBodyShadow.html(content);\r\n\r\n \t// Measure the height of the shadow\r\n \theight = $_writeReviewFormBodyShadow.outerHeight();\r\n\r\n \t// And set the height of the text area\r\n \t$_writeReviewFormBody.css('height', height + 'px');\r\n }\r\n\r\n\t/**\r\n\t * Updates the length indicator of an input field\r\n\t */\r\n\tfunction updateTextareaLengthIndicator($textarea)\r\n\t{\r\n\t\tvar coolLength = $textarea.data('cool-length');\r\n\t\tvar awesomeLength = $textarea.data('awesome-length');\r\n\t\tvar rockstarLength = $textarea.data('rockstar-length');\r\n\t\tvar length = $textarea.val().trim().length;\r\n\t\tvar $indicator = $textarea.next();\r\n\r\n\t\tif (length >= rockstarLength)\r\n\t\t{\r\n\t\t\t$indicator.html(_configuration.translations.reviewRockstarLength + ' (' + length + ' / ' + coolLength + ')');\r\n\t\t}\r\n\t\telse \r\n\t\t{\r\n\t\t\tif (length >= awesomeLength)\r\n\t\t\t{\r\n\t\t\t\t$indicator.html(_configuration.translations.reviewAwesomeLength + ' (' + length + ' / ' + coolLength + ')');\r\n\t\t\t}\r\n\t\t\telse \r\n\t\t\t{\r\n\t\t\t\tif (length >= coolLength)\r\n\t\t\t\t{\r\n\t\t\t\t\t$indicator.html(_configuration.translations.reviewCoolLength + ' (' + length + ' / ' + coolLength + ')');\r\n\t\t\t\t}\r\n\t\t\t\telse \r\n\t\t\t\t{\r\n\t\t\t\t\t$indicator.html(_configuration.translations.reviewMinLength + ' (' + length + ' / ' + coolLength + ')');\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n\r\n\t/**\r\n\t * Updates the length indicator of an input field\r\n\t */\r\n\tfunction updateInputFieldLengthIndicator($inputField)\r\n\t{\r\n\t\tvar maxLength = $inputField.attr('maxlength');\r\n\t\tvar length = $inputField.val().trim().length;\r\n\t\tvar $indicator = $inputField.next();\r\n\r\n\t\t$indicator.html(length + ' / ' + maxLength);\r\n\t}\r\n\r\n /**\r\n * The user has clicked the \"Load More Reviews\" button\r\n */\r\n function onLoadMoreReviewsButtonClick()\r\n {\r\n\t\tvar addedReviews = 0;\r\n\r\n\t\tjQuery('.xmx-review:hidden', $_reviews).each(function()\r\n\t\t{\r\n\t\t\tvar $review = jQuery(this);\r\n\t\t\t$review.show();\r\n\r\n\t\t\taddedReviews++;\r\n\r\n\t\t\t// Add 8 more reviews max\r\n\t\t\tif (addedReviews == 8)\r\n\t\t\t{\r\n\t\t\t\treturn false;\r\n\t\t\t}\r\n\t\t});\r\n\r\n\t\t_loadedReviews += addedReviews;\r\n\r\n\t\t// If we have loaded all reviews, hide the \"load more\" area\r\n\t\tif (_loadedReviews >= _configuration.reviewSummary.totalReviews)\r\n\t\t{\r\n\t\t\t// Hide the progress bar\r\n\t\t\t$_loadMoreReviewsProgress.hide();\r\n\r\n\t\t\t// \"No more reviews to load\"\r\n\t\t\t$_loadMoreReviewsHint.html(_configuration.translations.noMoreReviewsToLoad);\r\n\r\n\t\t\t// Hide le button\r\n\t\t\t$_loadMoreReviewsButton.hide();\r\n\t\t}\r\n\t\telse \r\n\t\t{\r\n\t\t\t// Calculate the %\r\n\t\t\tvar loadedPercent = _loadedReviews * 100 / _configuration.reviewSummary.totalReviews;\r\n\r\n\t\t\t// Update the progress bar\r\n\t\t\t$_loadMoreReviewsBar.css('width', loadedPercent + '%');\r\n\r\n\t\t\t// Update the hint\r\n\t\t\t$_loadMoreReviewsHint.html(_configuration.translations.reviewProgress.replace('%1', _loadedReviews).replace('%2', _configuration.reviewSummary.totalReviews));\r\n\t\t}\r\n }\r\n\r\n /**\r\n * Updates the price UI\r\n */\r\n function updatePrice()\r\n {\r\n \tvar productData = _configuration.productData[_selectedProductId];\r\n \tvar $line1;\r\n \tvar $line2;\r\n \tvar $line3;\r\n \tvar $freight;\r\n \tvar $freightCaption;\r\n \tvar $oldPrice;\r\n\t\tvar $saving;\r\n\t\tvar $campaignBadge;\r\n \tvar $price;\r\n\t\tvar $unitPrice;\r\n\r\n \t// Throw away the old info\r\n \t$_productPrice.empty();\r\n\r\n\t\t// If the product is out of stock and discontinued, dont show the price\r\n\t\tif (!productData.isInStock && productData.isDiscontinued)\r\n\t\t{\r\n\t\t\treturn;\r\n\t\t}\r\n\r\n \t// Add line 1\r\n\t\t$line1 = jQuery('
');\r\n\t\t$line1.addClass('xmx-product-detail-price-line-1');\r\n\t\t$line1.appendTo($_productPrice);\r\n\r\n\t\t// Add line 2\r\n\t\t$line2 = jQuery('
');\r\n\t\t$line2.addClass('xmx-product-detail-price-line-2');\r\n\t\t$line2.appendTo($_productPrice);\r\n\r\n\t\t// Add line 3\r\n\t\t$line3 = jQuery('
');\r\n\t\t$line3.addClass('xmx-product-detail-price-line-3');\r\n\t\t$line3.appendTo($_productPrice);\r\n\r\n\t\tvar finalPrice = productData.finalPrice;\r\n\t\tvar basePrice = productData.basePrice;\r\n\t\tvar isAdwordsPrice = false;\r\n\t\tvar isPriceRunnerPrice = false;\r\n\r\n\t\t$_addToCartAdwordsProduct.val(0);\r\n\r\n\t\tif (XmxApp.isComingFromGoogleAdwords())\r\n\t\t{\r\n\t\t\tif (productData.adwordsPrice)\r\n\t\t\t{\r\n\t\t\t\tif (productData.adwordsPrice < finalPrice)\r\n\t\t\t\t{\r\n\t\t\t\t\tfinalPrice = productData.adwordsPrice;\r\n\t\t\t\t\tisAdwordsPrice = true;\r\n\t\t\t\t\t$_addToCartAdwordsProduct.val(1); \r\n\r\n\t\t\t\t\t// Re-calculate the base price\r\n\t\t\t\t\tif (productData.baseUnitContent > 0)\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\tbasePrice = finalPrice / productData.baseUnitContent;\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\t$_addToCartPriceRunnerProduct.val(0);\r\n\r\n\t\tif (XmxApp.isComingFromPriceRunner())\r\n\t\t{\r\n\t\t\tif (productData.priceRunnerPrice)\r\n\t\t\t{\r\n\t\t\t\tif (productData.priceRunnerPrice < finalPrice)\r\n\t\t\t\t{\r\n\t\t\t\t\tfinalPrice = productData.priceRunnerPrice;\r\n\t\t\t\t\tisPriceRunnerPrice = true;\r\n\t\t\t\t\t$_addToCartPriceRunnerProduct.val(1);\r\n\r\n\t\t\t\t\t// Re-calculate the base price\r\n\t\t\t\t\tif (productData.baseUnitContent > 0)\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\tbasePrice = finalPrice / productData.baseUnitContent;\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\r\n \t// Build line one, if there is a special price\r\n\t\tif (finalPrice < productData.price)\r\n\t\t{\r\n\t\t\t$oldPrice = jQuery('
');\r\n\t\t\t$oldPrice.addClass('xmx-product-detail-price-old');\r\n\t\t\t$oldPrice.html(XmxApp.formatPrice(productData.price));\r\n\t\t\t$oldPrice.appendTo($line1);\r\n\r\n\t\t\t$saving = jQuery('
');\r\n\t\t\t$saving.addClass('xmx-product-detail-price-saving');\r\n\r\n\t\t\tif (isAdwordsPrice)\r\n\t\t\t{\r\n\t\t\t\t$saving.html(productData.adwordsDiscountInfo);\r\n\t\t\t}\r\n\t\t\telse if (isPriceRunnerPrice)\r\n\t\t\t{\r\n\t\t\t\t$saving.html(productData.priceRunnerDiscountInfo);\r\n\t\t\t}\r\n\t\t\telse \r\n\t\t\t{\r\n\t\t\t\t$saving.html(productData.discountInfo);\r\n\t\t\t}\r\n\t\t\t\r\n\t\t\t$saving.appendTo($line1);\r\n\r\n\t\t\tif (productData.campaignBadge != '')\r\n\t\t\t{\r\n\t\t\t\t$campaignBadge = jQuery('
');\r\n\t\t\t\t$campaignBadge.addClass('xmx-product-detail-price-badge');\r\n\t\t\t\t$campaignBadge.html(productData.campaignBadge);\r\n\t\t\t\t$campaignBadge.appendTo($line1);\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\t// Build the price\r\n\t\t$price = jQuery('
');\r\n\r\n\t\tif (finalPrice < productData.price)\r\n\t\t{\r\n\t\t\t$price.addClass('xmx-product-detail-price-special');\r\n\t\t}\r\n\t\telse \r\n\t\t{\r\n\t\t\t$price.addClass('xmx-product-detail-price-regular');\r\n\t\t}\r\n\r\n\t\t$price.html(XmxApp.formatPrice(finalPrice));\r\n\t\t$price.appendTo($line2);\r\n\r\n\t\t// Build shipping\r\n\t\t$freight = jQuery('
');\r\n\t\t$freight.addClass('xmx-product-detail-price-freight');\r\n\t\t$freight.attr('id', 'product-freight');\r\n\t\t$freight.attr('title', _configuration.translations.readMoreAboutShipping); \r\n\t\t$freight.appendTo($line2);\r\n\r\n\t\t// Re-hook it\r\n\t\t$_productFreight = $freight;\r\n\t\t$_productFreight.on('click', onProductFreightClick);\r\n\r\n\t\t// Caption the freight\r\n\t\t$freightCaption = jQuery('');\r\n\t\t$freightCaption.addClass('xmx-product-detail-price-freight-inner');\r\n\r\n\t\tif (finalPrice >= _configuration.shipping.freeAt)\r\n\t\t{\r\n\t\t\t$freightCaption.html(_configuration.translations.freeShipping); \r\n\r\n\t\t\t// Update price in shipping tab\r\n\t\t\t$_freeFreightLine.show();\r\n\t\t\t$_regularFreightLine.hide();\r\n\t\t}\r\n\t\telse \r\n\t\t{\r\n\t\t\t$freightCaption.html(_configuration.translations.shipsForX.replace('%1', XmxApp.formatAmount(_configuration.shipping.fee)));\r\n\r\n\t\t\t// Update price in shipping tab\r\n\t\t\t$_freeFreightLine.hide();\r\n\t\t\t$_regularFreightLine.show();\r\n\t\t}\r\n\r\n\t\t$freightCaption.appendTo($freight);\r\n\t\t\t\t\t\r\n\t\t// Build the base price\r\n\t\tif (basePrice > 0)\r\n\t\t{\r\n\t\t\t$unitPrice = jQuery('
');\r\n\t\t\t$unitPrice.addClass('xmx-price-unit');\r\n\r\n\t\t\tif (productData.baseUnitValue == 1)\r\n\t\t\t{\r\n\t\t\t\t$unitPrice.html(XmxApp.formatAmount(basePrice) + ' / ' + productData.baseUnitMeasure);\r\n\t\t\t}\r\n\t\t\telse \r\n\t\t\t{\r\n\t\t\t\t$unitPrice.html(XmxApp.formatAmount(basePrice) + ' / ' + XmxApp.formatUnit(productData.baseUnitValue, productData.baseUnitMeasure));\r\n\t\t\t}\r\n\r\n\t\t\t$unitPrice.appendTo($line3);\r\n\t\t}\r\n\r\n\t\t// Add the Klarna Delbetalning info, if present\r\n\t\tif (productData.klarnaPayment)\r\n\t\t{\r\n\t\t\tvar $klarnaPaymentHint = jQuery('
');\r\n\t\t\t$klarnaPaymentHint.addClass('xmx-product-detail-price-klarna');\r\n\r\n\t\t\tvar $klarnaLogo = jQuery('');\r\n\t\t\t$klarnaLogo.addClass('xmx-product-detail-price-klarna-logo');\r\n\t\t\t$klarnaLogo.attr('src', '/static/expresscheckout/logo-klarna-2020.svg');\r\n\t\t\t$klarnaLogo.attr('height', 24);\r\n\t\t\t$klarnaLogo.attr('width', 56);\r\n\t\t\t$klarnaLogo.attr('alt', 'Klarna');\r\n\t\t\t$klarnaLogo.appendTo($klarnaPaymentHint);\r\n\r\n\t\t\tvar $klarnaLabel = jQuery('
');\r\n\t\t\t$klarnaLabel.addClass('xmx-product-detail-price-klarna-text');\r\n\t\t\t$klarnaLabel.html('Dela upp och betala månadsvis.');\r\n\t\t\t$klarnaLabel.appendTo($klarnaPaymentHint);\r\n\r\n\t\t\t$klarnaPaymentHint.appendTo($_productPrice);\r\n\t\t}\r\n }\r\n\r\n /**\r\n * A slide has changed\r\n */\r\n function onSwiperSlideChange()\r\n {\r\n \t// This fires on initialization as well, but our member is not set yet\r\n \tif (_swiper == null)\r\n \t{\r\n \t\treturn;\r\n \t}\r\n\r\n \t// Unselect all thumbnails\r\n \tjQuery('> div', $_thumbnails).removeClass('xmx-product-image-thumbnail--selected');\r\n\r\n \t// Select the current one\r\n \tjQuery('> div[data-media-index=\"' + _swiper.realIndex + '\"]', $_thumbnails).addClass('xmx-product-image-thumbnail--selected');\r\n\r\n\t\t// Track the impression\r\n\t\ttrackProductImageImpression(_swiper.realIndex);\r\n }\r\n\r\n\t/**\r\n\t * \r\n\t * @param {*} index \r\n\t */\r\n\tfunction trackProductImageImpression()\r\n\t{\r\n\t\t/*\r\n\t\tvar postData = \r\n\t\t{\r\n\t\t\t'p': _selectedProductId,\r\n\t\t\t'i': index,\r\n\t\t\t't': _fancyBoxSlides.length\r\n\t\t};\r\n\r\n\t\tjQuery.ajax\r\n\t\t({\r\n\t\t\turl: '/ajax/track/pii',\r\n\t\t\tdataType: 'json',\r\n\t\t\ttype: 'post',\r\n\t\t\tcache: false,\r\n\t\t\tdata: postData\r\n\t\t});\t\r\n\t\t*/\r\n\t}\r\n\r\n /**\r\n * User has clicked on a the large display image\r\n */\r\n function onSwiperSlideClick(event)\r\n {\r\n // If this is not the left mouse button, get out of here.\r\n // Mouse button 3 or any mouse back buttons are not functional\r\n // otherwise.\r\n if (typeof(event.button) !== 'undefined')\r\n {\r\n if (event.button != 0)\r\n {\r\n return false;\r\n }\r\n }\r\n\r\n\t\t// May not look at spoilers\r\n\t\tvar image = _configuration.productData[_selectedProductId].images[_swiper.realIndex];\r\n\r\n\t\tif (typeof image !== 'undefined')\r\n\t\t{\r\n\t\t\tif (image.spoilerAlert)\r\n\t\t\t{\r\n\t\t\t\treturn false;\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\tjQuery.fancybox.open\r\n\t\t(\r\n\t\t _fancyBoxSlides,\r\n\t\t _fancyBoxOptions,\r\n\t\t _swiper.realIndex\r\n\t\t);\r\n\r\n event.stopPropagation();\r\n\r\n return false;\r\n }\r\n\r\n /**\r\n * If there is no swiper, open the image directly when the user clicked on it\r\n */\r\n function onMainImageClick()\r\n {\r\n\t\tjQuery.fancybox.open\r\n\t\t(\r\n\t\t _fancyBoxSlides,\r\n\t\t _fancyBoxOptions,\r\n\t\t 0\r\n\t\t);\r\n }\r\n\r\n /**\r\n * A user has a clicked on an image thumbnail\r\n */\r\n function onThumbnailClick()\r\n {\r\n \tvar $thumbnail = jQuery(this);\r\n \tvar mediaIndex = $thumbnail.data('media-index');\r\n\r\n\t\t_swiper.slideToLoop(mediaIndex);\r\n }\r\n\r\n /**\r\n * Updates the gallery UI\r\n */\r\n function updateGallery()\r\n {\r\n \tvar productData = _configuration.productData[_selectedProductId];\r\n \tvar imageData;\r\n var lastImage;\r\n \tvar $thumbnail;\r\n \tvar $thumbnailImage;\r\n var $thumbnailPicture;\r\n var $mobileThumbnailSource;\r\n var $desktopThumbnailSource;\r\n \tvar mediaIndex = 0;\r\n \tvar totalNumberOfSlides = 0;\r\n var $swiperContainer;\r\n var $swiperButtonNext;\r\n var $swiperButtonPrevious;\r\n var $swiperWrapper;\r\n var $swiperSlide;\r\n var $videoTitle;\r\n var $videoIcon;\r\n var $swiperImage;\r\n var $swiperPicture;\r\n var $swiperImageSource;\r\n var galleryImage;\r\n\r\n \t// If there is a swiper, kill it\r\n \tif (_swiper != null)\r\n \t{\r\n \t\t_swiper.destroy();\r\n \t\t_swiper = null;\r\n \t}\r\n\r\n \t// Rebuild the thumbnails and display images\r\n \t$_thumbnails.empty();\r\n \t$_mainImage.empty();\r\n\r\n \t// Rebuild the Fancy Box slides\r\n \t_fancyBoxSlides = [];\r\n\r\n \t// Add a swiper container to the main image\r\n $swiperContainer = jQuery('
');\r\n $swiperContainer.addClass('xmx-swiper-container');\r\n $swiperContainer.attr('id', 'display-swiper-container');\r\n $swiperContainer.appendTo($_mainImage);\r\n\r\n\t\t// Arrow right\r\n\t\t$swiperButtonNext = jQuery('