var backoffice = false; var useKeepAlive = true; $(document).ready(function () { checkIfFormIsSubmitted(); if ($('div.controlBorder').length > 0) { $('body').addClass('backoffice'); backoffice = true; } keepAlive(); capsLockCheck(); shopDetailPageGallery(); }); //CMS-282 - Wouter Dirks - 06-10-2010 function checkIfFormIsSubmitted() { $('form').submit(function () { if ($('form').attr("isSubmitted")) { return false; } //CMS-441 - Wouter Dirks - 14-10-2010 - Page_IsValid is sometimes undefined if (typeof(Page_IsValid) != "undefined" && Page_IsValid) { $('form').attr("isSubmitted", true); } }); } function keepAlive() { //call callKeepAlive every minute if (useKeepAlive) { setInterval("callKeepAlive()", 5000 * 60); } } function callKeepAlive() { $.ajax({ type: "GET", url: "/handlers/keepalive.ashx" }); } function capsLockCheck() { // Caps lock check if ($('.capsLockMessage').length > 0 && $('input[type="password"]').length > 0) { $('input[type="password"]').focus(function () { $(this).keypress(function (e) { e = e || window.event; // We need alphabetic characters to make a match. var character = String.fromCharCode(e.keyCode | e.which); if (character.toUpperCase() === character.toLowerCase()) { return; } // SHIFT doesn't usually give us a lowercase character. Check for this // and for when we get a lowercase character when SHIFT is enabled. if ((e.shiftKey && character.toLowerCase() === character) || (!e.shiftKey && character.toUpperCase() === character)) { $(this).parents('div.customForm').find('.capsLockMessage').show(); } else { $(this).parents('div.customForm').find('.capsLockMessage').hide(); } }); }); } } function passwordStrength(password, resultClientId, score0, score1, score2, score3, score4) { var desc = new Array(); desc[0] = score0; desc[1] = score1; desc[2] = score2; desc[3] = score3; desc[4] = score4; var score = 0; if (password.match(/[a-z]/)) score++; if (password.match(/[A-Z]/)) score++; if (password.match(/\d+/)) score++; if (password.match(/.[!,@,#,$,%,^,&,*,?,_,~,-,(,)]/)) score++; document.getElementById(resultClientId).innerHTML = desc[score]; } // shopDetailPageGallery function shopDetailPageGallery(){var c=$(".productImages"),b=c.find(".productLargeImage"),a=c.find(".productImage"),d;video={youtube:{URL:"http://www.youtube.com/embed/",params:"?rel=0&autoplay=1",attr:{width:b.width(),height:b.height(),frameborder:0}},vimeo:{URL:"http://player.vimeo.com/video/",params:"?title=0&byline=0&portrait=0&color=cccccc&autoplay=1",attr:{width:b.width(),height:b.height(),frameborder:0}}};a.filter(".productVideo").append('
');a.on("click",function(){d=$(this).parent();if($(this).is(".productVideo")){var h=$(this).data("videoProvider"),e={};e.src=video[h].URL+$(this).data("videoId")+video[h].params;var f=$("").attr($.extend({},video[h].attr,e));b.empty().append(f)}else{b.empty();var g=$(this).find("img").clone(false);g.attr("src",g.attr("src").replace(/\/thumb_/i,"/Medium_"));g.appendTo(b)}$(this).parent().addClass("activeImg").siblings(".activeImg").removeClass("activeImg")}).eq(0).trigger("click")};