(function () {
  if (location.href.indexOf('/cart') > -1 || location.href.indexOf('/checkout') > -1 || location.href.indexOf('/confirmation') > -1) {
    var waitForConfirmationPage = setInterval(function () {
      if (location.href.indexOf('confirmation') > -1) {
        var waitForReact = setInterval(function() {
          var container = document.querySelector('.order-confirmation_body_details');
    
          if (container) {
		    var checkDisclaimer = document.querySelector('.order-confirmation_body_details .confirmation-delay-notice');
			if (!checkDisclaimer) {
				var emailDisclaimer = document.createElement('strong');
				emailDisclaimer.className = "confirmation-delay-notice";
				emailDisclaimer.textContent = 'You\'ll receive an email confirmation but it may be delayed a few hours due to high levels of orders currently being experienced.';
		
				container.appendChild(emailDisclaimer);
			}
            clearInterval(waitForConfirmationPage);
            clearInterval(waitForReact);
          }
        }, 50);
      }
    }, 500);
  }
}());
$(function () {
   console.log('soo-global-js');

   //clear Feature Toggle cookie
   var resetCookie = (document.cookie.match(/^(?:.*;)?\s*siteFeatureToggles_VICMetro_reset\s*=\s*([^;]+)(?:.*)?$/)||[,null])[1];
   if (resetCookie != '3') {
      document.cookie = 'siteFeatureToggles_VICMetro=; Path=/; Expires=Thu, 01 Jan 1970 00:00:01 GMT;';
      document.cookie = 'siteFeatureToggles_VICMetro_reset=3; Path=/; Expires=Fri, 31 Dec 9999 23:59:59 GMT';
   }
   console.log('soo-reset',resetCookie);

  /* setTimeout(function () {
      console.log('soo-delivery');
      $('[data-component]="ConfirmedOption" .panel_container.panel_container--delivery p:last').text('Leaves supplier warehouse in 2-3 business days.');
   },200);*/

});


(function () {
  if ((' ' + document.body.className + ' ').indexOf(' external-script-restricted ') == -1) {
	/*Powerfront Live chat JS snippet start*/
	(function(u,t,d){ var i=d.createElement(t);i.type='text/javascript';i.async=true;i.src='//'+u; var s=d.getElementsByTagName(t)[0]; s.parentNode.insertBefore(i,s); })('au12-tracker.inside-graph.com/gtm/IN-1000746/include.js','script',document);
	/*Powerfront Live chat JS snippet end*/
  }
}());
$(function () {
   if($('body').hasClass('range-page-type')) {
		var breadcrumbTitle = $('.bui-breadcrumbs__nav li.bui-breadcrumbs__breadcrumb > span').last().text().trim();
		if(breadcrumbTitle) {
			var targetElement = $(".bui-hero-banner_container .bui-hero-banner_title");
			if(targetElement.length > 0) {
				targetElement.text(breadcrumbTitle).css('visibility', 'visible');
			}
		}
	}
});

/* BUNIJAGUAR-147 */

(function () {
  var productDetailContainer = document.querySelector('.product-detail__container');
  var waitForReact = setInterval(function() {
    if (productDetailContainer) {
      var priceContainer = document.querySelector('.price-point');
      if (priceContainer && (window.productDetailsData && typeof window.productDetailsData.price === 'undefined')) {
        priceContainer.style.display = 'none';
        clearInterval(waitForReact);
      }
      if (priceContainer && (window.productDetailsData && typeof window.productDetailsData.price === 'string')) {
        clearInterval(waitForReact);
      }
    }
  }, 50);
}());
