window.csrfToken = 'VRvMhoNlcZ'; //cms has col-sm-6 this has changed in bootstrap, so hotfix $(document).ready(function () { $('.col-xs-6').removeClass('col-xs-6').addClass('col-6'); }); function buildWidget(widgetType, args) { var constructor = window.widgets[widgetType.toLowerCase()]; function F() { return constructor.apply(this, args); } F.prototype = constructor.prototype; return new F(); } function widget(elem) { var $widgetElem = $(elem); while (!$widgetElem.is('[data-widget-id],[data-widget-non-interactive-start]')) { $widgetElem = $widgetElem.parent(); if ($widgetElem.length === 0) { return null; // No widget found } } var widgetId = $widgetElem.attr('data-widget-id'); var widgetType = $widgetElem.attr('data-widget-type'); var widgetInstance = buildWidget(widgetType, [widgetId, $widgetElem]); var widgetBaseFunctionality = { id: widgetId, type: widgetType, element: $widgetElem, call: function (method, args, callback, cacheClientSide) { var widget = this; var url = '/widgetResources.axd?widgetCall=' + widgetId; if (!cacheClientSide) { url += '&rnd=' + Math.random(); } $.ajax({ url: window.location.protocol + '//' + window.location.hostname + ':' + window.location.port + url, type: "POST", data: 'token=' + window.csrfToken + '&method=' + method + '&pageData=' + encodeURIComponent(JSON.stringify(getPageData($widgetElem))) + '&data=' + encodeURIComponent(JSON.stringify(args)), success: function (data, status, xhr) { callback(widget, data, status, xhr); }, error: function (xhr, status, err) { callback(widget, err, status, xhr); } }); } }; return $.extend(widgetInstance, widgetBaseFunctionality); } function getPageData($elem) { while ($elem.length) { if ($elem.attr('data-pageData')) { return JSON.parse($elem.attr('data-pageData')); } $elem = $elem.parent(); } } if (!window.widgets) { window.widgets = {}; } function setupValidation(input) { $(input).parent().parent().addClass('was-validated'); } function validateTextarea(textarea) { var regexMsg = $(textarea).attr('data-regex'); var errorMsg = $(textarea).attr('data-message'); var pattern = new RegExp('^' + $(textarea).attr('pattern') + '$'); // check each line of text $.each($(textarea).val().split("\n"), function () { // check if the line matches the pattern var hasError = !this.match(pattern); if (hasError) { $(textarea).next().text(regexMsg); } else { $(textarea).next().text(errorMsg); } if (typeof textarea.setCustomValidity === 'function') { textarea.setCustomValidity(hasError ? errorMsg : ''); } else { // Not supported by the browser, fallback to manual error display... $(textarea).toggleClass('error', !!hasError); $(textarea).toggleClass('ok', !hasError); if (hasError) { $(textarea).attr('title', errorMsg); } else { $(textarea).removeAttr('title'); } } return !hasError; }); } window.widgets.assetdownloadform = function (args) { return { submitForm: function () { if (typeof (validateChildNodes) != 'undefined') { // This might not be used so check if present if (!validateChildNodes(this.element)) { return; // Invalid } } var buttonText = $('#AssetDownloadForm_' + this.id + '_lnkSubmit').val(); $('#AssetDownloadForm_' + this.id + '_lnkSubmit').val('Please wait...').attr('disabled', true); var data = {}; var $questions = this.element.find(':input[id*=Question]'); // Even though "none" questions dont have any inputs we still need to iterate through them or i will be wrong for (var i = 0; i < $questions.length; i++) { var $question = $($questions[i]); if (typeof ($question.length && $question[0].checkValidity) == 'function') { if (!$question[0].checkValidity()) { $question.css({ outline: 'solid 2px #f00' }).addClass('invalid'); $question.blur(function () { $(this).css({ outline: 'none' }).removeClass('invalid'); }); $question[0].focus(); $('#AssetDownloadForm_' + this.id + '_lnkSubmit').val(buttonText).removeAttr('disabled'); return; } } if ($question.is(':checkbox,:radio')) { data[$question.attr('data')] = $question.is(':checked'); } else { data[$question.attr('name')] = $question.val(); } } this.call('submitForm', data, this.gotResult); }, gotResult: function (widget, data, status) { if (status != 'success') { alert('An error occurred please try again.\n'); } else { widget.element.empty(); widget.element.append($('
').html(data.result)); } } }; } function createCookie(name, value, days) { var expires; if (days) { var date = new Date(); date.setTime(date.getTime() + (days * 24 * 60 * 60 * 1000)); expires = "; expires=" + date.toGMTString(); } else { expires = ""; } document.cookie = encodeURIComponent(name) + "=" + encodeURIComponent(value) + expires + "; path=/"; } function readCookie(name) { var nameEQ = encodeURIComponent(name) + "="; var ca = document.cookie.split(';'); for (var i = 0; i < ca.length; i++) { var c = ca[i]; while (c.charAt(0) === ' ') c = c.substring(1, c.length); if (c.indexOf(nameEQ) === 0) return decodeURIComponent(c.substring(nameEQ.length, c.length)); } return null; } function setupComponentPopup() { if ('undefined' !== typeof window.jQuery && $('.component-popup-close').length) { var id = $('.component-popup').attr("data-id"); $('.component-popup-close').click(function () { //store a cookie createCookie('component-popup-close', id, 10000); }); //open the popup if (readCookie('component-popup-close') != id) { $('.component-popup').modal('show'); } } } setupComponentPopup(); if (!window.widgets) { window.widgets = {}; } function setupValidation(input) { $(input).parent().parent().addClass('was-validated'); } function validateTextarea(textarea) { var regexMsg = $(textarea).attr('data-regex'); var errorMsg = $(textarea).attr('data-message'); var pattern = new RegExp('^' + $(textarea).attr('pattern') + '$'); // check each line of text $.each($(textarea).val().split("\n"), function () { // check if the line matches the pattern var hasError = !this.match(pattern); if (hasError) { $(textarea).next().text(regexMsg); } else { $(textarea).next().text(errorMsg); } if (typeof textarea.setCustomValidity === 'function') { textarea.setCustomValidity(hasError ? errorMsg : ''); } else { // Not supported by the browser, fallback to manual error display... $(textarea).toggleClass('error', !!hasError); $(textarea).toggleClass('ok', !hasError); if (hasError) { $(textarea).attr('title', errorMsg); } else { $(textarea).removeAttr('title'); } } return !hasError; }); } window.widgets.emailform = function (args) { return { submitForm: function () { if (typeof (validateChildNodes) != 'undefined') { // This might not be used so check if present if (!validateChildNodes(this.element)) { return; // Invalid } } var buttonText = $('#EmailForm_' + this.id + '_lnkSubmit').val(); $('#EmailForm_' + this.id + '_lnkSubmit').val('Please wait...').attr('disabled', true); var data = {}; var $questions = this.element.find(':input[id*=Question]'); // Even though "none" questions dont have any inputs we still need to iterate through them or i will be wrong for (var i = 0; i < $questions.length; i++) { var $question = $($questions[i]); if (typeof ($question.length && $question[0].checkValidity) == 'function') { if (!$question[0].checkValidity()) { $question.css({ outline: 'solid 2px #f00' }).addClass('invalid'); $question.blur(function () { $(this).css({ outline: 'none' }).removeClass('invalid'); }); $question[0].focus(); $('#EmailForm_' + this.id + '_lnkSubmit').val(buttonText).removeAttr('disabled'); return; } } if ($question.is(':checkbox,:radio')) { data[$question.attr('data')] = $question.is(':checked'); } else { data[$question.attr('name')] = $question.val(); } } this.call('submitForm', data, this.gotResult); }, gotResult: function (widget, data, status) { if (status != 'success') { alert('An error occurred please try again.\n'); } else { widget.element.empty(); widget.element.append($('
').append($('

').text(data.result))); } } }; } if ('undefined' == typeof window.jQuery) { } else { $(document).ready(function () { $.fn.isInViewport = function () { if ($(this).offset()) { var elementTop = $(this).offset().top; var elementBottom = elementTop + $(this).outerHeight(); var viewportTop = $(window).scrollTop(); var viewportBottom = viewportTop + $(window).height(); return elementBottom > viewportTop && elementTop < viewportBottom; } else { return false; } }; $(window).on('resize', function () { AnimateImages(); }); $(window).scroll(function () { AnimateImages(); }); $(document).ready(function () { if ($('.four-image-wrapper').length) { var fullWidth = $('.four-image-wrapper').width(); var itemWidth = $('.four-image-wrapper').parent().parent().height() / 2; $('.fourimageblock > div').height('100%'); $('.four-image-wrapper').width('100%').css({ position: 'relative' }); $('.four-image-item').width(itemWidth).height(itemWidth).css({ right: 0, position: 'absolute' }); $('.four-image-item.item_1').css('z-index', 4); $('.four-image-item.item_2').css('z-index', 3); $('.four-image-item.item_3').css('z-index', 2); $('.four-image-item.item_4').css('z-index', 1); } AnimateImages(); }); function AnimateImages() { if (!$('.four-image-wrapper').hasClass('setup')) { if ($('.four-image-wrapper').isInViewport()) { $('.four-image-wrapper').addClass('setup'); var itemWidth = $('.four-image-item.item_1').width(); $('.four-image-item').animate({ 'right': itemWidth + 'px' }, 500, function () { $('.four-image-item.item_2').animate({ 'top': itemWidth + 'px' }, 500, function () { $('.four-image-item.item_3').css({ top: itemWidth + 'px' }); $('.four-image-item.item_4').css({ top: itemWidth + 'px' }); $('.four-image-item.item_3').animate({ 'right': 0 }, 500, function () { $('.four-image-item.item_4').css({ right: 0 }); $('.four-image-item.item_4').animate({ 'top': '0' }, 500, function () { // Animation complete. }); }); }); }); } } else { var itemWidth = $('.four-image-wrapper').parent().parent().height() / 2; $('.four-image-item.item_1').width(itemWidth).height(itemWidth).css({ right: itemWidth }); $('.four-image-item.item_2').width(itemWidth).height(itemWidth).css({ right: itemWidth, top: itemWidth + 'px' }); $('.four-image-item.item_3').width(itemWidth).height(itemWidth).css({ top: itemWidth + 'px' }); $('.four-image-item.item_4').width(itemWidth).height(itemWidth).css({ top: 0 }); } } }); } if (!window.widgets) { window.widgets = {}; } function setupValidation(input) { $(input).parent().parent().addClass('was-validated'); } function validateTextarea(textarea) { var regexMsg = $(textarea).attr('data-regex'); var errorMsg = $(textarea).attr('data-message'); var pattern = new RegExp('^' + $(textarea).attr('pattern') + '$'); // check each line of text $.each($(textarea).val().split("\n"), function () { // check if the line matches the pattern var hasError = !this.match(pattern); if (hasError) { $(textarea).next().text(regexMsg); } else { $(textarea).next().text(errorMsg); } if (typeof textarea.setCustomValidity === 'function') { textarea.setCustomValidity(hasError ? errorMsg : ''); } else { // Not supported by the browser, fallback to manual error display... $(textarea).toggleClass('error', !!hasError); $(textarea).toggleClass('ok', !hasError); if (hasError) { $(textarea).attr('title', errorMsg); } else { $(textarea).removeAttr('title'); } } return !hasError; }); } window.widgets.newsletterform = function (args) { return { submitForm: function () { if (typeof (validateChildNodes) != 'undefined') { // This might not be used so check if present if (!validateChildNodes(this.element)) { return; // Invalid } } var buttonText = $('#NewsletterForm_' + this.id + '_lnkSubmit').val(); $('#NewsletterForm_' + this.id + '_lnkSubmit').val('Please wait...').attr('disabled', true); var data = {}; var $questions = this.element.find(':input[id*=Question]'); // Even though "none" questions dont have any inputs we still need to iterate through them or i will be wrong for (var i = 0; i < $questions.length; i++) { var $question = $($questions[i]); if (typeof ($question.length && $question[0].checkValidity) == 'function') { if (!$question[0].checkValidity()) { $question.css({ outline: 'solid 2px #f00' }).addClass('invalid'); $question.blur(function () { $(this).css({ outline: 'none' }).removeClass('invalid'); }); $question[0].focus(); $('#NewsletterForm_' + this.id + '_lnkSubmit').val(buttonText).removeAttr('disabled'); return; } } if ($question.is(':checkbox,:radio')) { data[$question.attr('data')] = $question.is(':checked'); } else { data[$question.attr('name')] = $question.val(); } } this.call('submitForm', data, this.gotResult); }, gotResult: function (widget, data, status) { if (status != 'success') { alert('An error occurred please try again.\n'); } else { widget.element.empty(); widget.element.append($('

').html(data.result)); } } }; } /*Scrolling Widget*/ if ('undefined' == typeof window.jQuery) { } else { $(document).ready(function () { $.fn.isInViewport = function () { if ($(this).offset()) { var elementTop = $(this).offset().top; var elementBottom = elementTop + $(this).outerHeight(); var viewportTop = $(window).scrollTop(); var viewportBottom = viewportTop + $(window).height(); return elementBottom > viewportTop && elementTop < viewportBottom; } else { return false; } }; if ($('.scrolling-photo-wrapper').length) { $('.scrolling-photo-wrapper').mouseenter(function () { $(this).addClass('hovered'); }).mouseleave(function () { $(this).removeClass('hovered'); }); $('.scrolling-photo-wrapper').each(function (index) { var width = $(this).parent().parent().width(); $(this).width(width); $(this).attr("data-index", "1").attr("data-count", "0").attr("data-width", $(this).width()); var dataId = $(this).parent().parent().attr("data-widget-id"); $(this).find(".btn-right").click(function () { photoSlide(dataId, "left", true) }); $(this).find(".btn-left").click(function () { photoSlide(dataId, "right", true) }); $(this).find(".scrolling-item").width(width).css({ left: width }); $(this).find(".scrolling-item img").width(width); $(this).attr("data-count", $(this).find(".scrolling-item").length); $(this).find(".btn-left > i").css({ marginTop: ($(this).height() / 2) - 40 }); $(this).find(".btn-right > i").css({ marginTop: ($(this).height() / 2) - 40 }); setInterval(function () { photoSlide(dataId, 'left', false); }, 8000); $(window).scroll(function () { if (!$(this).attr("data-setup")) { $(this).attr("data-setup", "true"); var height = $(this).find(".scrolling-item.item_1 img").height(); var count = parseInt($(this).attr("data-count")); $(this).find(".scrolling-item.item_" + count).height() + 20; $(this).height(height); $(this).parent().height(height); } }); }); setTimeout( function () { resizePhotoSlide(); $(".scrolling-item.item_1").css({ left: 0 }); }, 500); } }); $(window).on('resize', function () { resizePhotoSlide(); }); function resizePhotoSlide() { if ($('.scrolling-photo-wrapper').length) { $('.scrolling-photo-wrapper').each(function (i) { var count = parseInt($(this).attr("data-count")); var width = parseInt($(this).parent().parent().width()); $(this).attr("data-width", width); $(this).width(width); var index = parseInt($(this).attr("data-index")); $(this).find(".scrolling-item").width(width).css({ left: width }); $(this).find(".scrolling-item.item_" + index).css({ left: 0 }); $(this).find(".scrolling-item img").width(width); var height = $(this).find(".scrolling-item.item_" + index + " img").height(); $(this).height(height); $(this).parent().height(height); $(this).find(".btn-left > i").css({ marginTop: ($(this).height() / 2) - 20 }); $(this).find(".btn-right > i").css({ marginTop: ($(this).height() / 2) - 20 }); }); } } function photoSlide(ctlId, direction, clicked) { $this = $('.photogallery[data-widget-id="' + ctlId + '"]').find('.scrolling-photo-wrapper'); if ($this.isInViewport()) { if (!clicked && !$this.hasClass('hovered') || clicked) { var width = parseInt($this.parent().parent().width()); var index = parseInt($this.attr("data-index")); var count = parseInt($this.attr("data-count")); if (direction == 'left') { if (index == count) { return; } var height = $this.find(".scrolling-item.item_" + (index + 1) + " img").height(); $this.height(height); $this.parent().height(height); if (index == 2) { $this.find(".scrolling-item.item_1").css({ left: width }); $this.find(".scrolling-item.item_" + count).css({ left: width }); } $this.find(".scrolling-item.item_" + index).animate({ left: "-" + width }, 500); if (index == count) { $this.find(".scrolling-item").css({ left: width }); index = 0; } $this.find(".scrolling-item.item_" + (index + 1)).animate({ left: "0" }, 500); $this.attr("data-index", index + 1); } else if (index > 1 && direction == 'right') { var height = $this.find(".scrolling-item.item_" + (index - 1) + " img").height(); $this.height(height); $this.parent().height(height); if (index == 2) { $this.find(".scrolling-item.item_1").css({ left: - width }); } $this.find(".scrolling-item.item_" + index).animate({ left: width }, 500); $this.find(".scrolling-item.item_" + (index - 1)).animate({ left: "0" }, 500); $this.attr("data-index", index - 1); } index = parseInt($this.attr("data-index")); $this.find(".icons i").removeClass('selected'); $this.find(".icons .item_" + index).addClass('selected'); $this.find(".scrolling-item img").width(width); $this.find(".btn-left > i").css({ marginTop: ($this.height() / 2) - 20 }); $this.find(".btn-right > i").css({ marginTop: ($this.height() / 2) - 20 }); } } } } /*light-box*/ function lightboxOpen() { $('.lightbox-modal').show(); } function lightboxClose() { $('.lightbox-modal').hide(); } var lightboxIndex = 1; function lightboxSlide(n) { lightboxSlides(lightboxIndex += n); } function lightboxCurrent(n) { lightboxSlides(lightboxIndex = n); } function lightboxSlides(n) { var i; var slides = $('.lightbox-slide'); if (n > slides.length) { lightboxIndex = 1 } if (n < 1) { lightboxIndex = slides.length } for (i = 0; i < slides.length; i++) { $(slides[i]).hide(); } if ($(window).width() > 575) { var imgWidth = $(slides[lightboxIndex - 1]).find('img')[0].width; $(slides[lightboxIndex - 1]).parent().width(imgWidth); } $(slides[lightboxIndex - 1]).show(); } if ('undefined' == typeof window.jQuery) { } else { $(document).ready(function () { if ($(".video-data").length) { var e = document.createElement("script"); e.src = "https://www.youtube.com/player_api"; var t = document.getElementsByTagName("script")[0]; t.parentNode.insertBefore(e, t) } }); function onYouTubePlayerAPIReady() { var e = $(".video-data"); if (void 0 !== e) for (var a = 0; a < e.length; a++) { var t = createPlayer(e[a].attributes["video-data"].value.split(",")); players[a] = t } } var players = new Array; function createPlayer(e) { return new YT.Player(e[0], { width: "100%", videoId: e[4], playerVars: { controls: e[1], autoplay: e[2], rel: 0, fs: 1, origin: "https://" + $(location).attr('host') }, events: { onReady: onPlayerReady, onStateChange: onPlayerStateChange } }) } function onPlayerReady(e) { var a = e.target.getIframe().attributes["video-data"].value; a.length && (1 == a.split(",")[2] && (e.target.mute(), e.target.playVideo())) } function onPlayerStateChange(e) { if (e.data == YT.PlayerState.ENDED) { var a = e.target.getIframe().attributes["video-data"].value; if (a.length) 1 == a.split(",")[3] && (e.target.seekTo(0), e.target.playVideo()) } } } /*Scrolling Widget*/ if ('undefined' == typeof window.jQuery) { } else { window.onload = function () { $(document).ready(function () { $.fn.isInViewport = function () { if ($(this).offset()) { var elementTop = $(this).offset().top; var elementBottom = elementTop + $(this).outerHeight(); var viewportTop = $(window).scrollTop(); var viewportBottom = viewportTop + $(window).height(); return elementBottom > viewportTop && elementTop < viewportBottom; } else { return false; } }; if ($('.componentscroller .scrolling-wrapper').length) { $('.componentscroller .scrolling-wrapper').mouseenter(function () { $(this).addClass('hovered'); }).mouseleave(function () { $(this).removeClass('hovered'); }); $('.componentscroller .scrolling-wrapper').each(function (i) { var width = $(this).parent().parent().width(); $(this).width(width); $(this).attr("data-index", "1").attr("data-count", "0").attr("data-width", $(this).width()); var dataId = $(this).parent().parent().attr("data-widget-id"); $(this).find(".btn-right").click(function () { componentSlide(dataId, "left", true) }); $(this).find(".btn-left").click(function () { componentSlide(dataId, "right", true) }); $(this).find(".scrolling-item").width(width).css({ left: width }); $(this).find(".scrolling-item.item_1").css({ left: 0 }); $(this).attr("data-count", $(this).find(".scrolling-item").length); $(this).find(".btn-left > i").css({ marginTop: ($(this).height() / 2) - 40 }); $(this).find(".btn-right > i").css({ marginTop: ($(this).height() / 2) - 40 }); setInterval(function () { componentSlide(dataId, 'left', false); }, 8000); $(window).scroll(function () { if (!$(this).attr("data-setup")) { $(this).attr("data-setup", "true"); var height = $(this).find(".scrolling-item.item_1").height(); var count = parseInt($(this).attr("data-count")); $(this).find(".scrolling-item.item_" + count).height() + 20; $(this).height(height); $(this).parent().height(height); } }); }); setTimeout( function () { resizeComponentSlide(); $(".componentscroller .scrolling-item.item_1").css({ left: 0 }); }, 500); } }); $(window).on('resize', function () { resizeComponentSlide(); }); } function resizeComponentSlide() { if ($('.componentscroller .scrolling-wrapper').length) { $('.componentscroller .scrolling-wrapper').each(function (i) { var count = parseInt($(this).attr("data-count")); var width = parseInt($(this).parent().parent().width()); $(this).attr("data-width", width); $(this).width(width); var index = parseInt($(this).attr("data-index")); $(this).find(".scrolling-item").width(width).css({ left: width }); $(this).find(".scrolling-item.item_" + index).css({ left: 0 }); $(this).find(".scrolling-item img").width(width); var height = $(this).find(".scrolling-item.item_" + index).height() - 8; $(this).height(height); $(this).parent().height(height); $(this).find(".btn-left > i").css({ marginTop: ($(this).height() / 2) - 20 }); $(this).find(".btn-right > i").css({ marginTop: ($(this).height() / 2) - 20 }); $(this).find(".btn-left").css({ height: $(this).height() }); $(this).find(".btn-right").css({ height: $(this).height() }); }); } } function componentSlide(ctlId, direction, clicked) { $this = $('.componentscroller[data-widget-id="' + ctlId + '"]').find('.scrolling-wrapper'); if ($this.isInViewport()) { if (!clicked && !$this.hasClass('hovered') || clicked) { var width = parseInt($this.parent().parent().width()); var index = parseInt($this.attr("data-index")); var count = parseInt($this.attr("data-count")); if (direction == 'left') { if (clicked && index == count) { return; } var findIndex = index + 1; var height = $this.find(".scrolling-item.item_" + findIndex).height() - 8; $this.height(height); $this.parent().height(height); if (index == 2) { $this.find(".scrolling-item.item_1").css({ left: width }); $this.find(".scrolling-item.item_" + count).css({ left: width }); } $this.find(".scrolling-item.item_" + index).animate({ left: "-" + width }, 500); if (index == count) { $this.find(".scrolling-item").css({ left: width }); index = 0; } $this.find(".scrolling-item.item_" + (index + 1)).animate({ left: "0" }, 500); $this.attr("data-index", index + 1); } else if (index > 1 && direction == 'right') { var findIndex = index - 1; var height = $this.find(".scrolling-item.item_" + findIndex).height() - 8; $this.height(height); $this.parent().height(height); if (index == 2) { $this.find(".scrolling-item.item_1").css({ left: - width }); } $this.find(".scrolling-item.item_" + index).animate({ left: width }, 500); $this.find(".scrolling-item.item_" + (index - 1)).animate({ left: "0" }, 500); $this.attr("data-index", index - 1); } index = parseInt($this.attr("data-index")); $this.find(".icons i").removeClass('selected'); $this.find(".icons .item_" + index).addClass('selected'); $this.find(".scrolling-item img").width(width); $this.find(".btn-left > i").css({ marginTop: ($this.height() / 2) - 20 }); $this.find(".btn-right > i").css({ marginTop: ($this.height() / 2) - 20 }); } } } }