/* matchMedia() polyfill - Test a CSS media type/query in JS. Authors & copyright (c) 2012: Scott Jehl, Paul Irish, Nicholas Zakas. Dual MIT/BSD license */ (function(CQ){CQ.WCM=CQ.WCM||{};CQ.WCM.Image=CQ.WCM.Image||function(){var self={};var CONST={MAP_SELECTOR:".cq-wcm-foundation-image-map"};self.handleResize=function(){var elements=document.querySelectorAll(CONST.MAP_SELECTOR);Array.prototype.forEach.call(elements,function(el){if(!el.getAttribute("usemap"))return;var imgSrc=el.getAttribute("src"),onLoadImg=document.createElement("img");onLoadImg.addEventListener("load",function(){var imgWidth=el.getAttribute("width")||el.naturalWidth,imgHeight=el.getAttribute("height")|| el.naturalHeight;if(!imgWidth||!imgHeight){var tempImage=new Image;tempImage.src=imgSrc;if(!imgWidth)imgWidth=tempImage.width;if(!imgHeight)imgHeight=tempImage.height}var relWidth=el.offsetWidth/100,relHeight=el.offsetHeight/100,map=el.getAttribute("usemap");map=map.replace("#","");var maps=document.querySelectorAll('map[name\x3d"'+map+'"]');Array.prototype.forEach.call(maps,function(mapEl){var areas=mapEl.querySelectorAll("area");Array.prototype.forEach.call(areas,function(areaEl){if(!areaEl.dataset.coords)areaEl.dataset.coords= areaEl.getAttribute("coords");var coords=areaEl.dataset.coords.split(","),relCoords=new Array(coords.length);for(var i=0;i0&&$(window.location.hash,context).length>0)window.location=(window.location+"").replace(window.location.hash,"")}catch(e){errorLog(e,"Could not remove hash")}}; var fadingSpeed=$.browser.msie?0:250;try{$(".cq-carousel").each(function(){var carousel=$(this);var playDelay=+$("var[title\x3d'play-delay']",this).text();if(!playDelay)playDelay=6E3;var slidingSpeed=+$("var[title\x3d'transition-time']",this).text();if(!slidingSpeed)slidingSpeed=1E3;var banners=$(".cq-carousel-banners",this);var switcher=$(".cq-carousel-banner-switch",this);var links=switcher.find("a");var items=$(".cq-carousel-banner-item",this);var width=items.outerWidth();var itemActive=items.filter(":first"); var itemPrevious=null;var interval=null;var i=0;var ctlPrev=$("a.cq-carousel-control-prev",this);ctlPrev.click(function(){if(ctlPrev.is(".cq-carousel-active"))$(links[(i+links.length-1)%links.length]).click();return false});var ctlNext=$("a.cq-carousel-control-next",this);ctlNext.click(function(){if(ctlNext.is(".cq-carousel-active"))$(links[(i+1)%links.length]).click();return false});if(links.length>1)ctlNext.addClass("cq-carousel-active");function play(){stop();if(playDelay>0)interval=setInterval(function(){$(links[(i+ 1)%links.length]).click()},playDelay)}function stop(){if(interval!==null){clearInterval(interval);interval=null}}if(fadingSpeed||$.browser.version>6)itemActive.css("left",0);else itemActive.show();links.click(function(){var link=$(this);var itemNew=items.filter(link.attr("href"));var j=itemNew.prevAll().length;var direction=j>i||interval!==null?1:-1;if(!link.is(".cq-carousel-active")){links.removeClass("cq-carousel-active");link.addClass("cq-carousel-active");if(itemActive.is(":animated")){itemActive.stop(true, true);itemPrevious.stop(true,true)}if(fadingSpeed){itemNew.css({"left":direction*width}).animate({"left":0,"opacity":1},slidingSpeed);itemActive.animate({"left":-direction*width,"opacity":0},slidingSpeed)}else if($.browser.version>6){itemNew.css({"left":direction*width,opacity:1}).animate({"left":0},slidingSpeed);itemActive.animate({"left":-direction*width},slidingSpeed)}else{itemNew.fadeIn();itemActive.fadeOut()}itemPrevious=itemActive;itemActive=itemNew;i=j;if(i>0)ctlPrev.addClass("cq-carousel-active"); else ctlPrev.removeClass("cq-carousel-active");if(i0)} function cq5forms_showMsg(fid,field,msg,index){var f=document.forms[fid].elements[field];alert(msg);if(cq5forms_isNodeList(f))f=Array.prototype.slice.call(f);if(cq5forms_isArray(f)){if(!index)index=0;f[index].focus()}else f.focus()} function cq5forms_isEmpty(obj){if(obj===undefined)return false;var empty=true;if(cq5forms_isNodeList(obj))obj=Array.prototype.slice.call(obj);if(cq5forms_isArray(obj))for(i=0;i0)empty=false}else if(obj.type=="radio"||obj.type=="checkbox"){if(obj.checked)empty=false}else if(obj.value.length>0)empty=false;return empty} function cq5forms_regcheck(obj,pattern){var result=false;var t=pattern.exec(obj);if(t){var len=obj.length;var pattlen=t[0].length;result=pattlen==len}return result}function cq5forms_multiResourceChange(evt,name,force){if(!force){if(!evt)evt=window.event;if(evt.keyCode<48&&evt.keyCode!=8&&evt.keyCode!=46)return}try{document.getElementById(name).checked=true}catch(e){}};