if (window.location.hostname == "payment.esolutionsgroup.ca") {
// For payment pages
pgJQuery('document').ready(function ($){
// Declare CMS hostname
var cmsUrl = new URL($('div#logo > a').attr("href"));
var cmsHost = cmsUrl.origin;
cmsHost += "/";
// Disable second large stylesheet
$('body link[href*="/sb/sitebuilder-css-large-bundle.css.v1"]').attr("disabled", "disabled");
// Insert HTML direction
$("html").attr("dir", "ltr");
// Insert body classes
$("body").removeClass().addClass("body-bg body-bg-solid header-19-lg header-02-sm hide_header-on-scroll-lg hide_header-on-scroll-sm directional-icons-chevron full-page has-heading-seperator-below main-navigation-underline-link-hover secondary-navigation-underline-link-hover content-underline-link-hover footer-underline-link ");
// Load CMS icon library
$("head").prepend("");
// Replace default site search action
$('form[name="searchForm"]').attr("action", cmsHost + "search/");
// Replace Cludo search URL
$('div[name="cludo_search_field-topnav"]').attr("data-cludo-search-url", cmsHost + "search?cludo");
// Replace logo image source
$('#logo picture source').each(function(){
if ('#logo picture source' != "undefined") {
var logoSrcPath = $(this).attr("srcset").split(",")[0];
$(this).attr("srcset", logoSrcPath.replace(/^\/+/, cmsHost));
}
});
// Replace image sources
$('.item picture source').each(function(){
if ('.item picture source' != "undefined") {
var pictureSrcPath = $(this).attr("data-srcset").split(",")[0];
$(this).attr("data-srcset", pictureSrcPath.replace(/^\/+/, cmsHost));
$(this).attr("srcset", pictureSrcPath.replace(/^\/+/, cmsHost));
}
});
$('.item picture img').each(function(){
if ('.item picture img' != "undefined") {
var pictureImgPath = $(this).attr("data-srcset").split(",")[0];
$(this).attr("data-srcset", pictureImgPath.replace(/^\/+/, cmsHost));
$(this).attr("srcset", pictureImgPath.replace(/^\/+/, cmsHost));
}
});
$('.menu-cta-image picture source').each(function(){
if ('.item picture source' != "undefined") {
var pictureSrcPath = $(this).attr("data-srcset").split(",")[0];
$(this).attr("data-srcset", pictureSrcPath.replace(/^\/+/, cmsHost));
$(this).attr("srcset", pictureSrcPath.replace(/^\/+/, cmsHost));
}
});
$('.menu-cta-image picture img').each(function(){
if ('.item picture img' != "undefined") {
var pictureImgPath = $(this).attr("data-srcset").split(",")[0];
$(this).attr("data-srcset", pictureImgPath.replace(/^\/+/, cmsHost));
$(this).attr("srcset", pictureImgPath.replace(/^\/+/, cmsHost));
}
});
$('.background-image').each(function(){
if ('.background-image' != "undefined") {
var backgroundImgPath = $(this).attr("data-bgset").split("?")[0];
$(this).css("background-image", "url(" + backgroundImgPath.replace(/^\/+/, cmsHost) + ")");
}
});
});
} else {
// For non-payment pages
$('document').ready(function (){
// Declare CMS hostname
var cmsUrl = new URL($('div#logo > a').attr("href"));
var cmsHost = cmsUrl.origin;
cmsHost += "/";
// Disable second large stylesheet
$('body link[href*="/sb/sitebuilder-css-large-bundle.css.v1"]').attr("disabled", "disabled");
// Insert HTML direction
$("html").attr("dir", "ltr");
// Insert body classes
$("body").removeClass().addClass("body-bg body-bg-solid header-19-lg header-02-sm hide_header-on-scroll-lg hide_header-on-scroll-sm directional-icons-chevron full-page has-heading-seperator-below main-navigation-underline-link-hover secondary-navigation-underline-link-hover content-underline-link-hover footer-underline-link ");
// Load CMS icon library
$("head").prepend("");
// Replace default site search action
$('form[name="searchForm"]').attr("action", cmsHost + "search/");
// Replace Cludo search URL
$('div[name="cludo_search_field-topnav"]').attr("data-cludo-search-url", cmsHost + "search?cludo");
// Replace logo image source
$('#logo picture source').each(function(){
if ('#logo picture source' != "undefined") {
var logoSrcPath = $(this).attr("srcset").split(",")[0];
$(this).attr("srcset", logoSrcPath.replace(/^\/+/, cmsHost));
}
});
// Replace image sources
$('.item picture source').each(function(){
if ('.item picture source' != "undefined") {
var pictureSrcPath = $(this).attr("data-srcset").split(",")[0];
$(this).attr("data-srcset", pictureSrcPath.replace(/^\/+/, cmsHost));
$(this).attr("srcset", pictureSrcPath.replace(/^\/+/, cmsHost));
}
});
$('.item picture img').each(function(){
if ('.item picture img' != "undefined") {
var pictureImgPath = $(this).attr("data-srcset").split(",")[0];
$(this).attr("data-srcset", pictureImgPath.replace(/^\/+/, cmsHost));
$(this).attr("srcset", pictureImgPath.replace(/^\/+/, cmsHost));
}
});
$('.menu-cta-image picture source').each(function(){
if ('.item picture source' != "undefined") {
var pictureSrcPath = $(this).attr("data-srcset").split(",")[0];
$(this).attr("data-srcset", pictureSrcPath.replace(/^\/+/, cmsHost));
$(this).attr("srcset", pictureSrcPath.replace(/^\/+/, cmsHost));
}
});
$('.menu-cta-image picture img').each(function(){
if ('.item picture img' != "undefined") {
var pictureImgPath = $(this).attr("data-srcset").split(",")[0];
$(this).attr("data-srcset", pictureImgPath.replace(/^\/+/, cmsHost));
$(this).attr("srcset", pictureImgPath.replace(/^\/+/, cmsHost));
}
});
$('.background-image').each(function(){
if ('.background-image' != "undefined") {
var backgroundImgPath = $(this).attr("data-bgset").split("?")[0];
$(this).css("background-image", "url(" + backgroundImgPath.replace(/^\/+/, cmsHost) + ")");
}
});
});
}