window.csrfToken = 'io42V1uy6b'; 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.data('pageData')){ return $elem.data('pageData'); } $elem = $elem.parent(); } } //emailform 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))); } } }; }//emailform function setupValidation(t) { $(t).parent().parent().addClass("was-validated") } function validateTextarea(t) { var e = $(t).attr("data-regex"), i = $(t).attr("data-message"), a = new RegExp("^" + $(t).attr("pattern") + "$"); $.each($(t).val().split("\n"), (function () { var n = !this.match(a); return n ? $(t).next().text(e) : $(t).next().text(i), "function" == typeof t.setCustomValidity ? t.setCustomValidity(n ? i : "") : ($(t).toggleClass("error", !!n), $(t).toggleClass("ok", !n), n ? $(t).attr("title", i) : $(t).removeAttr("title")), !n })) } window.widgets || (window.widgets = {}), window.widgets.emailform = function (t) { return { submitForm: function () { if ("undefined" == typeof validateChildNodes || validateChildNodes(this.element)) { var t = $("#EmailForm_" + this.id + "_lnkSubmit").val(); $("#EmailForm_" + this.id + "_lnkSubmit").val("Please wait...").attr("disabled", !0); for (var e = {}, i = this.element.find(":input[id*=Question]"), a = 0; a < i.length; a++) { var n = $(i[a]); if ("function" == typeof (n.length && n[0].checkValidity) && !n[0].checkValidity()) return n.css({ outline: "solid 2px #f00" }).addClass("invalid"), n.blur((function () { $(this).css({ outline: "none" }).removeClass("invalid") })), n[0].focus(), void $("#EmailForm_" + this.id + "_lnkSubmit").val(t).removeAttr("disabled"); n.is(":checkbox,:radio") ? e[n.attr("data")] = n.is(":checked") : e[n.attr("name")] = n.val() } this.call("submitForm", e, this.gotResult) } }, gotResult: function (t, e, i) { "success" != i ? alert("An error occurred please try again.\n") : (t.element.empty(), t.element.append($("

").append($("

").text(e.result)))) } } };//photogallery /*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 }); } } } }//photogallery if(void 0===window.jQuery);else{function resizePhotoSlide(){$(".scrolling-photo-wrapper").length&&$(".scrolling-photo-wrapper").each((function(t){parseInt($(this).attr("data-count"));var i=parseInt($(this).parent().parent().width());$(this).attr("data-width",i),$(this).width(i);var e=parseInt($(this).attr("data-index"));$(this).find(".scrolling-item").width(i).css({left:i}),$(this).find(".scrolling-item.item_"+e).css({left:0}),$(this).find(".scrolling-item img").width(i);var s=$(this).find(".scrolling-item.item_"+e+" img").height();$(this).height(s),$(this).parent().height(s),$(this).find(".btn-left > i").css({marginTop:$(this).height()/2-20}),$(this).find(".btn-right > i").css({marginTop:$(this).height()/2-20})}))}function photoSlide(t,i,e){if($this=$('.photogallery[data-widget-id="'+t+'"]').find(".scrolling-photo-wrapper"),$this.isInViewport()&&(!e&&!$this.hasClass("hovered")||e)){var s=parseInt($this.parent().parent().width()),h=parseInt($this.attr("data-index")),n=parseInt($this.attr("data-count"));if("left"==i){if(h==n)return;var r=$this.find(".scrolling-item.item_"+(h+1)+" img").height();$this.height(r),$this.parent().height(r),2==h&&($this.find(".scrolling-item.item_1").css({left:s}),$this.find(".scrolling-item.item_"+n).css({left:s})),$this.find(".scrolling-item.item_"+h).animate({left:"-"+s},500),h==n&&($this.find(".scrolling-item").css({left:s}),h=0),$this.find(".scrolling-item.item_"+(h+1)).animate({left:"0"},500),$this.attr("data-index",h+1)}else if(h>1&&"right"==i){r=$this.find(".scrolling-item.item_"+(h-1)+" img").height();$this.height(r),$this.parent().height(r),2==h&&$this.find(".scrolling-item.item_1").css({left:-s}),$this.find(".scrolling-item.item_"+h).animate({left:s},500),$this.find(".scrolling-item.item_"+(h-1)).animate({left:"0"},500),$this.attr("data-index",h-1)}h=parseInt($this.attr("data-index")),$this.find(".icons i").removeClass("selected"),$this.find(".icons .item_"+h).addClass("selected"),$this.find(".scrolling-item img").width(s),$this.find(".btn-left > i").css({marginTop:$this.height()/2-20}),$this.find(".btn-right > i").css({marginTop:$this.height()/2-20})}}$(document).ready((function(){$.fn.isInViewport=function(){if($(this).offset()){var t=$(this).offset().top,i=t+$(this).outerHeight(),e=$(window).scrollTop(),s=e+$(window).height();return i>e&&t i").css({marginTop:$(this).height()/2-40}),$(this).find(".btn-right > i").css({marginTop:$(this).height()/2-40}),setInterval((function(){photoSlide(e,"left",!1)}),8e3),$(window).scroll((function(){if(!$(this).attr("data-setup")){$(this).attr("data-setup","true");var t=$(this).find(".scrolling-item.item_1 img").height(),i=parseInt($(this).attr("data-count"));$(this).find(".scrolling-item.item_"+i).height(),$(this).height(t),$(this).parent().height(t)}}))})),setTimeout((function(){resizePhotoSlide(),$(".scrolling-item.item_1").css({left:0})}),500))})),$(window).on("resize",(function(){resizePhotoSlide()}))}//scrollingcontent /*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-wrapper').length) { $('.scrolling-wrapper').mouseenter(function () { $(this).addClass('hovered'); }).mouseleave(function () { $(this).removeClass('hovered'); }); $('.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 () { scrollerSlide(dataId, "left", true) }); $(this).find(".btn-left").click(function () { scrollerSlide(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 () { scrollerSlide(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 () { resizeContentSlide(); $(".scrolling-item.item_1").css({ left: 0 }); }, 500); } }); $(window).on('resize', function () { resizeContentSlide(); }); function resizeContentSlide() { if ($('.scrolling-wrapper').length) { $('.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_" + count).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 scrollerSlide(ctlId, direction, clicked) { $this = $('.scrollingcontent[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 }); } } } }//scrollingcontent function resizeContentSlide() { $(".scrolling-wrapper").length && $(".scrolling-wrapper").each(function (t) { var i = parseInt($(this).attr("data-count")), e = parseInt($(this).parent().parent().width()); $(this).attr("data-width", e), $(this).width(e); var s = parseInt($(this).attr("data-index")); $(this).find(".scrolling-item").width(e).css({ left: e }), $(this).find(".scrolling-item.item_" + s).css({ left: 0 }), $(this).find(".scrolling-item img").width(e); i = $(this).find(".scrolling-item.item_" + i).height() - 8; $(this).height(i), $(this).parent().height(i), $(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 scrollerSlide(t, i, e) { if ($this = $('.scrollingcontent[data-widget-id="' + t + '"]').find(".scrolling-wrapper"), $this.isInViewport() && (!e && !$this.hasClass("hovered") || e)) { var s = parseInt($this.parent().parent().width()), n = parseInt($this.attr("data-index")), t = parseInt($this.attr("data-count")); if ("left" == i) { if (e && n == t) return; var h = n + 1, r = $this.find(".scrolling-item.item_" + h).height() - 8; $this.height(r), $this.parent().height(r), 2 == n && ($this.find(".scrolling-item.item_1").css({ left: s }), $this.find(".scrolling-item.item_" + t).css({ left: s })), $this.find(".scrolling-item.item_" + n).animate({ left: "-" + s }, 500), n == t && ($this.find(".scrolling-item").css({ left: s }), n = 0), $this.find(".scrolling-item.item_" + (n + 1)).animate({ left: "0" }, 500), $this.attr("data-index", n + 1) } else 1 < n && "right" == i && (h = n - 1, r = $this.find(".scrolling-item.item_" + h).height() - 8, $this.height(r), $this.parent().height(r), 2 == n && $this.find(".scrolling-item.item_1").css({ left: -s }), $this.find(".scrolling-item.item_" + n).animate({ left: s }, 500), $this.find(".scrolling-item.item_" + (n - 1)).animate({ left: "0" }, 500), $this.attr("data-index", n - 1)); n = parseInt($this.attr("data-index")), $this.find(".icons i").removeClass("selected"), $this.find(".icons .item_" + n).addClass("selected"), $this.find(".scrolling-item img").width(s), $this.find(".btn-left > i").css({ marginTop: $this.height() / 2 - 20 }), $this.find(".btn-right > i").css({ marginTop: $this.height() / 2 - 20 }) } } void 0 === window.jQuery || ($(document).ready(function () { $.fn.isInViewport = function () { if ($(this).offset()) { var t = $(this).offset().top, i = t + $(this).outerHeight(), e = $(window).scrollTop(), s = e + $(window).height(); return e < i && t < s } return !1 }, $(".scrolling-wrapper").length && ($(".scrolling-wrapper").mouseenter(function () { $(this).addClass("hovered") }).mouseleave(function () { $(this).removeClass("hovered") }), $(".scrolling-wrapper").each(function (t) { var i = $(this).parent().parent().width(); $(this).width(i), $(this).attr("data-index", "1").attr("data-count", "0").attr("data-width", $(this).width()); var e = $(this).parent().parent().attr("data-widget-id"); $(this).find(".btn-right").click(function () { scrollerSlide(e, "left", !0) }), $(this).find(".btn-left").click(function () { scrollerSlide(e, "right", !0) }), $(this).find(".scrolling-item").width(i).css({ left: i }), $(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 () { scrollerSlide(e, "left", !1) }, 8e3), $(window).scroll(function () { var t, i; $(this).attr("data-setup") || ($(this).attr("data-setup", "true"), t = $(this).find(".scrolling-item.item_1").height(), i = parseInt($(this).attr("data-count")), $(this).find(".scrolling-item.item_" + i).height(), $(this).height(t), $(this).parent().height(t)) }) }), setTimeout(function () { resizeContentSlide(), $(".scrolling-item.item_1").css({ left: 0 }) }, 500)) }), $(window).on("resize", function () { resizeContentSlide() }));