/* Table of contents :: Retina.js :: Flexslider - Line 12 :: Fancybox - Line 62 :: Metrojs (Live tiles) - Line 112 */ // retina.js, a high-resolution image swapper (http://retinajs.com), v0.0.2 (function(){function t(e){this.path=e;var t=this.path.split("."),n=t.slice(0,t.length-1).join("."),r=t[t.length-1];this.at_2x_path=n+"@2x."+r}function n(e){this.el=e,this.path=new t(this.el.getAttribute("src"));var n=this;this.path.check_2x_variant(function(e){e&&n.swap()})}var e=typeof exports=="undefined"?window:exports;e.RetinaImagePath=t,t.confirmed_paths=[],t.prototype.is_external=function(){return!!this.path.match(/^https?\:/i)&&!this.path.match("//"+document.domain)},t.prototype.check_2x_variant=function(e){var n,r=this;if(this.is_external())return e(!1);if(this.at_2x_path in t.confirmed_paths)return e(!0);n=new XMLHttpRequest,n.open("HEAD",this.at_2x_path),n.onreadystatechange=function(){return n.readyState!=4?e(!1):n.status>=200&&n.status<=399?(t.confirmed_paths.push(r.at_2x_path),e(!0)):e(!1)},n.send()},e.RetinaImage=n,n.prototype.swap=function(e){function n(){t.el.complete?(t.el.setAttribute("width",t.el.offsetWidth),t.el.setAttribute("height",t.el.offsetHeight),t.el.setAttribute("src",e)):setTimeout(n,5)}typeof e=="undefined"&&(e=this.path.at_2x_path);var t=this;n()},e.devicePixelRatio>1&&(window.onload=function(){var e=document.getElementsByTagName("img"),t=[],r,i;for(r=0;rg?a.getTarget("next"):a.getTarget("prev");a.flexAnimate(d,c.pauseOnAction)});c.pausePlay&&f.pausePlay.setup();c.slideshow&&(c.pauseOnHover&&a.hover(function(){!a.manualPlay&&!a.manualPause&&a.pause()}, function(){!a.manualPause&&!a.manualPlay&&a.play()}),0');if(1':""+b+"",a.controlNavScaffold.append("
  • "+g+"
  • "),b++;a.controlsContainer?d(a.controlsContainer).append(a.controlNavScaffold):a.append(a.controlNavScaffold);f.controlNav.set();f.controlNav.active();a.controlNavScaffold.delegate("a, img",u,function(b){b.preventDefault();b=d(this);var g=a.controlNav.index(b);b.hasClass(e+"active")||(a.direction=g>a.currentSlide?"next":"prev",a.flexAnimate(g,c.pauseOnAction))});q&&a.controlNavScaffold.delegate("a", "click touchstart",function(a){a.preventDefault()})},setupManual:function(){a.controlNav=a.manualControls;f.controlNav.active();a.controlNav.live(u,function(b){b.preventDefault();b=d(this);var g=a.controlNav.index(b);b.hasClass(e+"active")||(g>a.currentSlide?a.direction="next":a.direction="prev",a.flexAnimate(g,c.pauseOnAction))});q&&a.controlNav.live("click touchstart",function(a){a.preventDefault()})},set:function(){a.controlNav=d("."+e+"control-nav li "+("thumbnails"===c.controlNav?"img":"a"), a.controlsContainer?a.controlsContainer:a)},active:function(){a.controlNav.removeClass(e+"active").eq(a.animatingTo).addClass(e+"active")},update:function(b,c){1"+a.count+"")):1===a.pagingCount?a.controlNavScaffold.find("li").remove():a.controlNav.eq(c).closest("li").remove();f.controlNav.set();1
  • '+c.prevText+'
  • '+c.nextText+"
  • ");a.controlsContainer?(d(a.controlsContainer).append(b),a.directionNav=d("."+e+"direction-nav li a",a.controlsContainer)):(a.append(b),a.directionNav=d("."+e+"direction-nav li a",a));f.directionNav.update();a.directionNav.bind(u,function(b){b.preventDefault();b=d(this).hasClass(e+"next")?a.getTarget("next"):a.getTarget("prev");a.flexAnimate(b,c.pauseOnAction)}); q&&a.directionNav.bind("click touchstart",function(a){a.preventDefault()})},update:function(){var b=e+"disabled";1===a.pagingCount?a.directionNav.addClass(b):c.animationLoop?a.directionNav.removeClass(b):0===a.animatingTo?a.directionNav.removeClass(b).filter("."+e+"prev").addClass(b):a.animatingTo===a.last?a.directionNav.removeClass(b).filter("."+e+"next").addClass(b):a.directionNav.removeClass(b)}},pausePlay:{setup:function(){var b=d('
    ');a.controlsContainer? (a.controlsContainer.append(b),a.pausePlay=d("."+e+"pauseplay a",a.controlsContainer)):(a.append(b),a.pausePlay=d("."+e+"pauseplay a",a));f.pausePlay.update(c.slideshow?e+"pause":e+"play");a.pausePlay.bind(u,function(b){b.preventDefault();d(this).hasClass(e+"pause")?(a.manualPause=!0,a.manualPlay=!1,a.pause()):(a.manualPause=!1,a.manualPlay=!0,a.play())});q&&a.pausePlay.bind("click touchstart",function(a){a.preventDefault()})},update:function(b){"play"===b?a.pausePlay.removeClass(e+"pause").addClass(e+ "play").text(c.playText):a.pausePlay.removeClass(e+"play").addClass(e+"pause").text(c.pauseText)}},touch:function(){function b(b){k=m?d-b.touches[0].pageY:d-b.touches[0].pageX;q=m?Math.abs(k)k||a.currentSlide===a.last&&0Number(new Date)-l&&50r/2)?a.flexAnimate(m,c.pauseOnAction):s||a.flexAnimate(a.currentSlide,c.pauseOnAction,!0)}j.removeEventListener("touchend",g,!1);f=k=e=d=null}var d,e,f,r,k,l,q=!1;j.addEventListener("touchstart",function(k){a.animating?k.preventDefault():1===k.touches.length&&(a.pause(),r=m?a.h:a.w,l=Number(new Date),f=h&&n&&a.animatingTo=== a.last?0:h&&n?a.limit-(a.itemW+c.itemMargin)*a.move*a.animatingTo:h&&a.currentSlide===a.last?a.limit:h?(a.itemW+c.itemMargin)*a.move*a.currentSlide:n?(a.last-a.currentSlide+a.cloneOffset)*r:(a.currentSlide+a.cloneOffset)*r,d=m?k.touches[0].pageY:k.touches[0].pageX,e=m?k.touches[0].pageX:k.touches[0].pageY,j.addEventListener("touchmove",b,!1),j.addEventListener("touchend",g,!1))},!1)},resize:function(){!a.animating&&a.is(":visible")&&(h||a.doMath(),s?f.smoothHeight():h?(a.slides.width(a.computedW), a.update(a.pagingCount),a.setProps()):m?(a.viewport.height(a.h),a.setProps(a.h,"setTotal")):(c.smoothHeight&&f.smoothHeight(),a.newSlides.width(a.computedW),a.setProps(a.computedW,"setTotal")))},smoothHeight:function(b){if(!m||s){var c=s?a:a.viewport;b?c.animate({height:a.slides.eq(a.animatingTo).height()},b):c.height(a.slides.eq(a.animatingTo).height())}},sync:function(b){var g=d(c.sync).data("flexslider"),e=a.animatingTo;switch(b){case "animate":g.flexAnimate(e,c.pauseOnAction,!1,!0);break;case "play":!g.playing&& !g.asNav&&g.play();break;case "pause":g.pause()}}};a.flexAnimate=function(b,g,p,j,l){t&&1===a.pagingCount&&(a.direction=a.currentItema.w?2*c.itemMargin:c.itemMargin,b=(a.itemW+b)*a.move*a.animatingTo, b=b>a.limit&&1!==a.visible?a.limit:b):b=0===a.currentSlide&&b===a.count-1&&c.animationLoop&&"next"!==a.direction?n?(a.count+a.cloneOffset)*r:0:a.currentSlide===a.last&&0===b&&c.animationLoop&&"prev"!==a.direction?n?0:(a.count+1)*r:n?(a.count-1-b+a.cloneOffset)*r:(b+a.cloneOffset)*r;a.setProps(b,"",c.animationSpeed);if(a.transitions){if(!c.animationLoop||!a.atEnd)a.animating=!1,a.currentSlide=a.animatingTo;a.container.unbind("webkitTransitionEnd transitionend");a.container.bind("webkitTransitionEnd transitionend", function(){a.wrapup(r)})}else a.container.animate(a.args,c.animationSpeed,c.easing,function(){a.wrapup(r)})}c.smoothHeight&&f.smoothHeight(c.animationSpeed)}};a.wrapup=function(b){!s&&!h&&(0===a.currentSlide&&a.animatingTo===a.last&&c.animationLoop?a.setProps(b,"jumpEnd"):a.currentSlide===a.last&&(0===a.animatingTo&&c.animationLoop)&&a.setProps(b,"jumpStart"));a.animating=!1;a.currentSlide=a.animatingTo;c.after(a)};a.animateSlides=function(){a.animating||a.flexAnimate(a.getTarget("next"))};a.pause= function(){clearInterval(a.animatedSlides);a.playing=!1;c.pausePlay&&f.pausePlay.update("play");a.syncExists&&f.sync("pause")};a.play=function(){a.animatedSlides=setInterval(a.animateSlides,c.slideshowSpeed);a.playing=!0;c.pausePlay&&f.pausePlay.update("pause");a.syncExists&&f.sync("play")};a.canAdvance=function(b,g){var d=t?a.pagingCount-1:a.last;return g?!0:t&&a.currentItem===a.count-1&&0===b&&"prev"===a.direction?!0:t&&0===a.currentItem&&b===a.pagingCount-1&&"next"!==a.direction?!1:b===a.currentSlide&& !t?!1:c.animationLoop?!0:a.atEnd&&0===a.currentSlide&&b===d&&"next"!==a.direction?!1:a.atEnd&&a.currentSlide===d&&0===b&&"next"===a.direction?!1:!0};a.getTarget=function(b){a.direction=b;return"next"===b?a.currentSlide===a.last?0:a.currentSlide+1:0===a.currentSlide?a.last:a.currentSlide-1};a.setProps=function(b,g,d){var e,f=b?b:(a.itemW+c.itemMargin)*a.move*a.animatingTo;e=-1*function(){if(h)return"setTouch"===g?b:n&&a.animatingTo===a.last?0:n?a.limit-(a.itemW+c.itemMargin)*a.move*a.animatingTo:a.animatingTo=== a.last?a.limit:f;switch(g){case "setTotal":return n?(a.count-1-a.currentSlide+a.cloneOffset)*b:(a.currentSlide+a.cloneOffset)*b;case "setTouch":return b;case "jumpEnd":return n?b:a.count*b;case "jumpStart":return n?a.count*b:b;default:return b}}()+"px";a.transitions&&(e=m?"translate3d(0,"+e+",0)":"translate3d("+e+",0,0)",d=void 0!==d?d/1E3+"s":"0s",a.container.css("-"+a.pfx+"-transition-duration",d));a.args[a.prop]=e;(a.transitions||void 0===d)&&a.container.css(a.args)};a.setup=function(b){if(s)a.slides.css({width:"100%", "float":"left",marginRight:"-100%",position:"relative"}),"init"===b&&(q?a.slides.css({opacity:0,display:"block",webkitTransition:"opacity "+c.animationSpeed/1E3+"s ease",zIndex:1}).eq(a.currentSlide).css({opacity:1,zIndex:2}):a.slides.eq(a.currentSlide).fadeIn(c.animationSpeed,c.easing)),c.smoothHeight&&f.smoothHeight();else{var g,p;"init"===b&&(a.viewport=d('
    ').css({overflow:"hidden",position:"relative"}).appendTo(a).append(a.container),a.cloneCount=0,a.cloneOffset= 0,n&&(p=d.makeArray(a.slides).reverse(),a.slides=d(p),a.container.empty().append(a.slides)));c.animationLoop&&!h&&(a.cloneCount=2,a.cloneOffset=1,"init"!==b&&a.container.find(".clone").remove(),a.container.append(a.slides.first().clone().addClass("clone")).prepend(a.slides.last().clone().addClass("clone")));a.newSlides=d(c.selector,a);g=n?a.count-1-a.currentSlide+a.cloneOffset:a.currentSlide+a.cloneOffset;m&&!h?(a.container.height(200*(a.count+a.cloneCount)+"%").css("position","absolute").width("100%"), setTimeout(function(){a.newSlides.css({display:"block"});a.doMath();a.viewport.height(a.h);a.setProps(g*a.h,"init")},"init"===b?100:0)):(a.container.width(200*(a.count+a.cloneCount)+"%"),a.setProps(g*a.computedW,"init"),setTimeout(function(){a.doMath();a.newSlides.css({width:a.computedW,"float":"left",display:"block"});c.smoothHeight&&f.smoothHeight()},"init"===b?100:0))}h||a.slides.removeClass(e+"active-slide").eq(a.currentSlide).addClass(e+"active-slide")};a.doMath=function(){var b=a.slides.first(), d=c.itemMargin,e=c.minItems,f=c.maxItems;a.w=a.width();a.h=b.height();a.boxPadding=b.outerWidth()-b.width();h?(a.itemT=c.itemWidth+d,a.minW=e?e*a.itemT:a.w,a.maxW=f?f*a.itemT:a.w,a.itemW=a.minW>a.w?(a.w-d*e)/e:a.maxWa.w?a.w:c.itemWidth,a.visible=Math.floor(a.w/(a.itemW+d)),a.move=0a.w?(a.itemW+2*d)*a.count-a.w- d:(a.itemW+d)*a.count-a.w-d):(a.itemW=a.w,a.pagingCount=a.count,a.last=a.count-1);a.computedW=a.itemW-a.boxPadding};a.update=function(b,d){a.doMath();h||(ba.controlNav.length)f.controlNav.update("add");else if("remove"===d&&!h||a.pagingCounta.last&&(a.currentSlide-=1,a.animatingTo-=1), f.controlNav.update("remove",a.last);c.directionNav&&f.directionNav.update()};a.addSlide=function(b,e){var f=d(b);a.count+=1;a.last=a.count-1;m&&n?void 0!==e?a.slides.eq(a.count-e).after(f):a.container.prepend(f):void 0!==e?a.slides.eq(e).before(f):a.container.append(f);a.update(e,"add");a.slides=d(c.selector+":not(.clone)",a);a.setup();c.added(a)};a.removeSlide=function(b){var e=isNaN(b)?a.slides.index(d(b)):b;a.count-=1;a.last=a.count-1;isNaN(b)?d(b,a.slides).remove():m&&n?a.slides.eq(a.last).remove(): a.slides.eq(b).remove();a.doMath();a.update(e,"remove");a.slides=d(c.selector+":not(.clone)",a);a.setup();c.removed(a)};f.init()};d.flexslider.defaults={namespace:"flex-",selector:".slides > li",animation:"fade",easing:"swing",direction:"horizontal",reverse:!1,animationLoop:!0,smoothHeight:!1,startAt:0,slideshow:!0,slideshowSpeed:7E3,animationSpeed:600,initDelay:0,randomize:!1,pauseOnAction:!0,pauseOnHover:!1,useCSS:false,touch:!0,video:!1,controlNav:!0,directionNav:!0,prevText:"Previous",nextText:"Next", keyboard:!0,multipleKeyboard:!1,mousewheel:!1,pausePlay:!1,pauseText:"Pause",playText:"Play",controlsContainer:"",manualControls:"",sync:"",asNavFor:"",itemWidth:0,itemMargin:0,minItems:0,maxItems:0,move:0,start:function(){},before:function(){},after:function(){},end:function(){},added:function(){},removed:function(){}};d.fn.flexslider=function(j){void 0===j&&(j={});if("object"===typeof j)return this.each(function(){var a=d(this),c=a.find(j.selector?j.selector:".slides > li");1===c.length?(c.fadeIn(400), j.start&&j.start(a)):void 0==a.data("flexslider")&&new d.flexslider(this,j)});var l=d(this).data("flexslider");switch(j){case "play":l.play();break;case "pause":l.pause();break;case "next":l.flexAnimate(l.getTarget("next"),!0);break;case "prev":case "previous":l.flexAnimate(l.getTarget("prev"),!0);break;default:"number"===typeof j&&l.flexAnimate(j,!0)}}})(jQuery); /*--------------------------------------------------------------------- Fancybox (http://fancyapps.com/fancybox/) ---------------------------------------------------------------------*/ /*! fancyBox v2.1.4 fancyapps.com | fancyapps.com/fancybox/#license */ (function(C,z,f,r){var q=f(C),n=f(z),b=f.fancybox=function(){b.open.apply(this,arguments)},H=navigator.userAgent.match(/msie/),w=null,s=z.createTouch!==r,t=function(a){return a&&a.hasOwnProperty&&a instanceof f},p=function(a){return a&&"string"===f.type(a)},F=function(a){return p(a)&&0
    ',image:'',iframe:'",error:'

    The requested content cannot be loaded.
    Please try again later.

    ',closeBtn:'',next:'',prev:''},openEffect:"fade",openSpeed:250,openEasing:"swing",openOpacity:!0, openMethod:"zoomIn",closeEffect:"fade",closeSpeed:250,closeEasing:"swing",closeOpacity:!0,closeMethod:"zoomOut",nextEffect:"elastic",nextSpeed:250,nextEasing:"swing",nextMethod:"changeIn",prevEffect:"elastic",prevSpeed:250,prevEasing:"swing",prevMethod:"changeOut",helpers:{overlay:!0,title:!0},onCancel:f.noop,beforeLoad:f.noop,afterLoad:f.noop,beforeShow:f.noop,afterShow:f.noop,beforeChange:f.noop,beforeClose:f.noop,afterClose:f.noop},group:{},opts:{},previous:null,coming:null,current:null,isActive:!1, isOpen:!1,isOpened:!1,wrap:null,skin:null,outer:null,inner:null,player:{timer:null,isActive:!1},ajaxLoad:null,imgPreload:null,transitions:{},helpers:{},open:function(a,d){if(a&&(f.isPlainObject(d)||(d={}),!1!==b.close(!0)))return f.isArray(a)||(a=t(a)?f(a).get():[a]),f.each(a,function(e,c){var k={},g,h,j,m,l;"object"===f.type(c)&&(c.nodeType&&(c=f(c)),t(c)?(k={href:c.data("fancybox-href")||c.attr("href"),title:c.data("fancybox-title")||c.attr("title"),isDom:!0,element:c},f.metadata&&f.extend(!0,k, c.metadata())):k=c);g=d.href||k.href||(p(c)?c:null);h=d.title!==r?d.title:k.title||"";m=(j=d.content||k.content)?"html":d.type||k.type;!m&&k.isDom&&(m=c.data("fancybox-type"),m||(m=(m=c.prop("class").match(/fancybox\.(\w+)/))?m[1]:null));p(g)&&(m||(b.isImage(g)?m="image":b.isSWF(g)?m="swf":"#"===g.charAt(0)?m="inline":p(c)&&(m="html",j=c)),"ajax"===m&&(l=g.split(/\s+/,2),g=l.shift(),l=l.shift()));j||("inline"===m?g?j=f(p(g)?g.replace(/.*(?=#[^\s]+$)/,""):g):k.isDom&&(j=c):"html"===m?j=g:!m&&(!g&& k.isDom)&&(m="inline",j=c));f.extend(k,{href:g,type:m,content:j,title:h,selector:l});a[e]=k}),b.opts=f.extend(!0,{},b.defaults,d),d.keys!==r&&(b.opts.keys=d.keys?f.extend({},b.defaults.keys,d.keys):!1),b.group=a,b._start(b.opts.index)},cancel:function(){var a=b.coming;a&&!1!==b.trigger("onCancel")&&(b.hideLoading(),b.ajaxLoad&&b.ajaxLoad.abort(),b.ajaxLoad=null,b.imgPreload&&(b.imgPreload.onload=b.imgPreload.onerror=null),a.wrap&&a.wrap.stop(!0,!0).trigger("onReset").remove(),b.coming=null,b.current|| b._afterZoomOut(a))},close:function(a){b.cancel();!1!==b.trigger("beforeClose")&&(b.unbindEvents(),b.isActive&&(!b.isOpen||!0===a?(f(".fancybox-wrap").stop(!0).trigger("onReset").remove(),b._afterZoomOut()):(b.isOpen=b.isOpened=!1,b.isClosing=!0,f(".fancybox-item, .fancybox-nav").remove(),b.wrap.stop(!0,!0).removeClass("fancybox-opened"),b.transitions[b.current.closeMethod]())))},play:function(a){var d=function(){clearTimeout(b.player.timer)},e=function(){d();b.current&&b.player.isActive&&(b.player.timer= setTimeout(b.next,b.current.playSpeed))},c=function(){d();f("body").unbind(".player");b.player.isActive=!1;b.trigger("onPlayEnd")};if(!0===a||!b.player.isActive&&!1!==a){if(b.current&&(b.current.loop||b.current.index=c.index?"next":"prev"],b.router=e||"jumpto",c.loop&&(0>a&&(a=c.group.length+a%c.group.length),a%=c.group.length),c.group[a]!==r&&(b.cancel(),b._start(a)))},reposition:function(a,d){var e=b.current,c=e?e.wrap:null,k;c&&(k=b._getPosition(d),a&&"scroll"===a.type?(delete k.position,c.stop(!0,!0).animate(k,200)):(c.css(k),e.pos=f.extend({}, e.dim,k)))},update:function(a){var d=a&&a.type,e=!d||"orientationchange"===d;e&&(clearTimeout(w),w=null);b.isOpen&&!w&&(w=setTimeout(function(){var c=b.current;c&&!b.isClosing&&(b.wrap.removeClass("fancybox-tmp"),(e||"load"===d||"resize"===d&&c.autoResize)&&b._setDimension(),"scroll"===d&&c.canShrink||b.reposition(a),b.trigger("onUpdate"),w=null)},e&&!s?0:300))},toggle:function(a){b.isOpen&&(b.current.fitToView="boolean"===f.type(a)?a:!b.current.fitToView,s&&(b.wrap.removeAttr("style").addClass("fancybox-tmp"), b.trigger("onUpdate")),b.update())},hideLoading:function(){n.unbind(".loading");f("#fancybox-loading").remove()},showLoading:function(){var a,d;b.hideLoading();a=f('
    ').click(b.cancel).appendTo("body");n.bind("keydown.loading",function(a){if(27===(a.which||a.keyCode))a.preventDefault(),b.cancel()});b.defaults.fixed||(d=b.getViewport(),a.css({position:"absolute",top:0.5*d.h+d.y,left:0.5*d.w+d.x}))},getViewport:function(){var a=b.current&&b.current.locked|| !1,d={x:q.scrollLeft(),y:q.scrollTop()};a?(d.w=a[0].clientWidth,d.h=a[0].clientHeight):(d.w=s&&C.innerWidth?C.innerWidth:q.width(),d.h=s&&C.innerHeight?C.innerHeight:q.height());return d},unbindEvents:function(){b.wrap&&t(b.wrap)&&b.wrap.unbind(".fb");n.unbind(".fb");q.unbind(".fb")},bindEvents:function(){var a=b.current,d;a&&(q.bind("orientationchange.fb"+(s?"":" resize.fb")+(a.autoCenter&&!a.locked?" scroll.fb":""),b.update),(d=a.keys)&&n.bind("keydown.fb",function(e){var c=e.which||e.keyCode,k= e.target||e.srcElement;if(27===c&&b.coming)return!1;!e.ctrlKey&&(!e.altKey&&!e.shiftKey&&!e.metaKey&&(!k||!k.type&&!f(k).is("[contenteditable]")))&&f.each(d,function(d,k){if(1h[0].clientWidth||h[0].clientHeight&&h[0].scrollHeight>h[0].clientHeight),h=f(h).parent();if(0!==c&&!j&&1g||0>k)b.next(0>g?"up":"right");d.preventDefault()}}))},trigger:function(a,d){var e,c=d||b.coming||b.current;if(c){f.isFunction(c[a])&&(e=c[a].apply(c,Array.prototype.slice.call(arguments,1)));if(!1===e)return!1;c.helpers&&f.each(c.helpers,function(d, e){e&&(b.helpers[d]&&f.isFunction(b.helpers[d][a]))&&(e=f.extend(!0,{},b.helpers[d].defaults,e),b.helpers[d][a](e,c))});f.event.trigger(a+".fb")}},isImage:function(a){return p(a)&&a.match(/(^data:image\/.*,)|(\.(jp(e|g|eg)|gif|png|bmp|webp)((\?|#).*)?$)/i)},isSWF:function(a){return p(a)&&a.match(/\.(swf)((\?|#).*)?$/i)},_start:function(a){var d={},e,c;a=l(a);e=b.group[a]||null;if(!e)return!1;d=f.extend(!0,{},b.opts,e);e=d.margin;c=d.padding;"number"===f.type(e)&&(d.margin=[e,e,e,e]);"number"===f.type(c)&& (d.padding=[c,c,c,c]);d.modal&&f.extend(!0,d,{closeBtn:!1,closeClick:!1,nextClick:!1,arrows:!1,mouseWheel:!1,keys:null,helpers:{overlay:{closeClick:!1}}});d.autoSize&&(d.autoWidth=d.autoHeight=!0);"auto"===d.width&&(d.autoWidth=!0);"auto"===d.height&&(d.autoHeight=!0);d.group=b.group;d.index=a;b.coming=d;if(!1===b.trigger("beforeLoad"))b.coming=null;else{c=d.type;e=d.href;if(!c)return b.coming=null,b.current&&b.router&&"jumpto"!==b.router?(b.current.index=a,b[b.router](b.direction)):!1;b.isActive= !0;if("image"===c||"swf"===c)d.autoHeight=d.autoWidth=!1,d.scrolling="visible";"image"===c&&(d.aspectRatio=!0);"iframe"===c&&s&&(d.scrolling="scroll");d.wrap=f(d.tpl.wrap).addClass("fancybox-"+(s?"mobile":"desktop")+" fancybox-type-"+c+" fancybox-tmp "+d.wrapCSS).appendTo(d.parent||"body");f.extend(d,{skin:f(".fancybox-skin",d.wrap),outer:f(".fancybox-outer",d.wrap),inner:f(".fancybox-inner",d.wrap)});f.each(["Top","Right","Bottom","Left"],function(a,b){d.skin.css("padding"+b,x(d.padding[a]))});b.trigger("onReady"); if("inline"===c||"html"===c){if(!d.content||!d.content.length)return b._error("content")}else if(!e)return b._error("href");"image"===c?b._loadImage():"ajax"===c?b._loadAjax():"iframe"===c?b._loadIframe():b._afterLoad()}},_error:function(a){f.extend(b.coming,{type:"html",autoWidth:!0,autoHeight:!0,minWidth:0,minHeight:0,scrolling:"no",hasError:a,content:b.coming.tpl.error});b._afterLoad()},_loadImage:function(){var a=b.imgPreload=new Image;a.onload=function(){this.onload=this.onerror=null;b.coming.width= this.width;b.coming.height=this.height;b._afterLoad()};a.onerror=function(){this.onload=this.onerror=null;b._error("image")};a.src=b.coming.href;!0!==a.complete&&b.showLoading()},_loadAjax:function(){var a=b.coming;b.showLoading();b.ajaxLoad=f.ajax(f.extend({},a.ajax,{url:a.href,error:function(a,e){b.coming&&"abort"!==e?b._error("ajax",a):b.hideLoading()},success:function(d,e){"success"===e&&(a.content=d,b._afterLoad())}}))},_loadIframe:function(){var a=b.coming,d=f(a.tpl.iframe.replace(/\{rnd\}/g, (new Date).getTime())).attr("scrolling",s?"auto":a.iframe.scrolling).attr("src",a.href);f(a.wrap).bind("onReset",function(){try{f(this).find("iframe").hide().attr("src","//about:blank").end().empty()}catch(a){}});a.iframe.preload&&(b.showLoading(),d.one("load",function(){f(this).data("ready",1);s||f(this).bind("load.fb",b.update);f(this).parents(".fancybox-wrap").width("100%").removeClass("fancybox-tmp").show();b._afterLoad()}));a.content=d.appendTo(a.inner);a.iframe.preload||b._afterLoad()},_preloadImages:function(){var a= b.group,d=b.current,e=a.length,c=d.preload?Math.min(d.preload,e-1):0,f,g;for(g=1;g<=c;g+=1)f=a[(d.index+g)%e],"image"===f.type&&f.href&&((new Image).src=f.href)},_afterLoad:function(){var a=b.coming,d=b.current,e,c,k,g,h;b.hideLoading();if(a&&!1!==b.isActive)if(!1===b.trigger("afterLoad",a,d))a.wrap.stop(!0).trigger("onReset").remove(),b.coming=null;else{d&&(b.trigger("beforeChange",d),d.wrap.stop(!0).removeClass("fancybox-opened").find(".fancybox-item, .fancybox-nav").remove());b.unbindEvents(); e=a.content;c=a.type;k=a.scrolling;f.extend(b,{wrap:a.wrap,skin:a.skin,outer:a.outer,inner:a.inner,current:a,previous:d});g=a.href;switch(c){case "inline":case "ajax":case "html":a.selector?e=f("
    ").html(e).find(a.selector):t(e)&&(e.data("fancybox-placeholder")||e.data("fancybox-placeholder",f('
    ').insertAfter(e).hide()),e=e.show().detach(),a.wrap.bind("onReset",function(){f(this).find(e).length&&e.hide().replaceAll(e.data("fancybox-placeholder")).data("fancybox-placeholder", !1)}));break;case "image":e=a.tpl.image.replace("{href}",g);break;case "swf":e='',h="",f.each(a.swf,function(a,b){e+='';h+=" "+a+'="'+b+'"'}),e+='"}(!t(e)||!e.parent().is(a.inner))&&a.inner.append(e);b.trigger("beforeShow"); a.inner.css("overflow","yes"===k?"scroll":"no"===k?"hidden":k);b._setDimension();b.reposition();b.isOpen=!1;b.coming=null;b.bindEvents();if(b.isOpened){if(d.prevMethod)b.transitions[d.prevMethod]()}else f(".fancybox-wrap").not(a.wrap).stop(!0).trigger("onReset").remove();b.transitions[b.isOpened?a.nextMethod:a.openMethod]();b._preloadImages()}},_setDimension:function(){var a=b.getViewport(),d=0,e=!1,c=!1,e=b.wrap,k=b.skin,g=b.inner,h=b.current,c=h.width,j=h.height,m=h.minWidth,u=h.minHeight,n=h.maxWidth, v=h.maxHeight,s=h.scrolling,q=h.scrollOutside?h.scrollbarWidth:0,y=h.margin,p=l(y[1]+y[3]),r=l(y[0]+y[2]),z,A,t,D,B,G,C,E,w;e.add(k).add(g).width("auto").height("auto").removeClass("fancybox-tmp");y=l(k.outerWidth(!0)-k.width());z=l(k.outerHeight(!0)-k.height());A=p+y;t=r+z;D=F(c)?(a.w-A)*l(c)/100:c;B=F(j)?(a.h-t)*l(j)/100:j;if("iframe"===h.type){if(w=h.content,h.autoHeight&&1===w.data("ready"))try{w[0].contentWindow.document.location&&(g.width(D).height(9999),G=w.contents().find("body"),q&&G.css("overflow-x", "hidden"),B=G.height())}catch(H){}}else if(h.autoWidth||h.autoHeight)g.addClass("fancybox-tmp"),h.autoWidth||g.width(D),h.autoHeight||g.height(B),h.autoWidth&&(D=g.width()),h.autoHeight&&(B=g.height()),g.removeClass("fancybox-tmp");c=l(D);j=l(B);E=D/B;m=l(F(m)?l(m,"w")-A:m);n=l(F(n)?l(n,"w")-A:n);u=l(F(u)?l(u,"h")-t:u);v=l(F(v)?l(v,"h")-t:v);G=n;C=v;h.fitToView&&(n=Math.min(a.w-A,n),v=Math.min(a.h-t,v));A=a.w-p;r=a.h-r;h.aspectRatio?(c>n&&(c=n,j=l(c/E)),j>v&&(j=v,c=l(j*E)),cA||p>r)&&(c>m&&j>u)&&!(19n&&(c=n,j=l(c/E)),g.width(c).height(j),e.width(c+y),a=e.width(),p=e.height();else c=Math.max(m,Math.min(c,c-(a-A))),j=Math.max(u,Math.min(j,j-(p-r)));q&&("auto"===s&&jA||p>r)&&c>m&&j>u;c=h.aspectRatio?cu&&j
    ').appendTo("body"); this.fixed=!1;a.fixed&&b.defaults.fixed&&(this.overlay.addClass("fancybox-overlay-fixed"),this.fixed=!0)},open:function(a){var d=this;a=f.extend({},this.defaults,a);this.overlay?this.overlay.unbind(".overlay").width("auto").height("auto"):this.create(a);this.fixed||(q.bind("resize.overlay",f.proxy(this.update,this)),this.update());a.closeClick&&this.overlay.bind("click.overlay",function(a){f(a.target).hasClass("fancybox-overlay")&&(b.isActive?b.close():d.close())});this.overlay.css(a.css).show()}, close:function(){f(".fancybox-overlay").remove();q.unbind("resize.overlay");this.overlay=null;!1!==this.margin&&(f("body").css("margin-right",this.margin),this.margin=!1);this.el&&this.el.removeClass("fancybox-lock")},update:function(){var a="100%",b;this.overlay.width(a).height("100%");H?(b=Math.max(z.documentElement.offsetWidth,z.body.offsetWidth),n.width()>b&&(a=n.width())):n.width()>q.width()&&(a=n.width());this.overlay.width(a).height(n.height())},onReady:function(a,b){f(".fancybox-overlay").stop(!0, !0);this.overlay||(this.margin=n.height()>q.height()||"scroll"===f("body").css("overflow-y")?f("body").css("margin-right"):!1,this.el=z.all&&!z.querySelector?f("html"):f("body"),this.create(a));a.locked&&this.fixed&&(b.locked=this.overlay.append(b.wrap),b.fixed=!1);!0===a.showEarly&&this.beforeShow.apply(this,arguments)},beforeShow:function(a,b){b.locked&&(this.el.addClass("fancybox-lock"),!1!==this.margin&&f("body").css("margin-right",l(this.margin)+b.scrollbarWidth));this.open(a)},onUpdate:function(){this.fixed|| this.update()},afterClose:function(a){this.overlay&&!b.isActive&&this.overlay.fadeOut(a.speedOut,f.proxy(this.close,this))}};b.helpers.title={defaults:{type:"float",position:"bottom"},beforeShow:function(a){var d=b.current,e=d.title,c=a.type;f.isFunction(e)&&(e=e.call(d.element,d));if(p(e)&&""!==f.trim(e)){d=f('
    '+e+"
    ");switch(c){case "inside":c=b.skin;break;case "outside":c=b.wrap;break;case "over":c=b.inner;break;default:c=b.skin,d.appendTo("body"), H&&d.width(d.width()),d.wrapInner(''),b.current.margin[2]+=Math.abs(l(d.css("margin-bottom")))}d["top"===a.position?"prependTo":"appendTo"](c)}}};f.fn.fancybox=function(a){var d,e=f(this),c=this.selector||"",k=function(g){var h=f(this).blur(),j=d,k,l;!g.ctrlKey&&(!g.altKey&&!g.shiftKey&&!g.metaKey)&&!h.is(".fancybox-wrap")&&(k=a.groupAttr||"data-fancybox-group",l=h.attr(k),l||(k="rel",l=h.get(0)[k]),l&&(""!==l&&"nofollow"!==l)&&(h=c.length?f(c):e,h=h.filter("["+k+'="'+l+ '"]'),j=h.index(this)),a.index=j,!1!==b.open(h,a)&&g.preventDefault())};a=a||{};d=a.index||0;!c||!1===a.live?e.unbind("click.fb-start").bind("click.fb-start",k):n.undelegate(c,"click.fb-start").delegate(c+":not('.fancybox-item, .fancybox-nav')","click.fb-start",k);this.filter("[data-fancybox-start=1]").trigger("click");return this};n.ready(function(){f.scrollbarWidth===r&&(f.scrollbarWidth=function(){var a=f('
    ').appendTo("body"),b=a.children(), b=b.innerWidth()-b.height(99).innerWidth();a.remove();return b});if(f.support.fixedPosition===r){var a=f.support,d=f('
    ').appendTo("body"),e=20===d[0].offsetTop||15===d[0].offsetTop;d.remove();a.fixedPosition=e}f.extend(b.defaults,{scrollbarWidth:f.scrollbarWidth(),fixed:f.support.fixedPosition,parent:f("body")})})})(window,document,jQuery); /*--------------------------------------------------------------------- Metrojs (http://www.drewgreenwell.com/projects/metrojs) ---------------------------------------------------------------------*/ (function(e){e.fn.metrojs={capabilities:null,checkCapabilities:function(t,n){if(e.fn.metrojs.capabilities==null||typeof n!="undefined"&&n==true)e.fn.metrojs.capabilities=new e.fn.metrojs.MetroModernizr(t);return e.fn.metrojs.capabilities}};var t=e.fn.metrojs;var n=99e3;e.fn.liveTile=function(t){if(r[t]){var n=[];for(var i=1;i<=arguments.length;i++){n[i-1]=arguments[i]}return r[t].apply(this,n)}else if(typeof t==="object"||!t){return r.init.apply(this,arguments)}else{e.error("Method "+t+" does not exist on jQuery.liveTile");return null}};e.fn.liveTile.contentModules={modules:{},addContentModule:function(e,t){if(typeof this.modules!=="object")this.modules={};this.modules[e]=t},hasContentModule:function(e){if(typeof e==="undefined"||typeof this.modules!=="object")return false;return typeof this.modules[e]!=="undefined"}};e.fn.liveTile.defaults={mode:"flip-list",speed:800,initDelay:-1,delay:5e3,stops:"100%",stack:false,direction:"vertical",animationDirection:"forward",tileSelector:">div,>li,>p,>img,>a",tileFaceSelector:">div,>li,>p,>img,>a",ignoreDataAttributes:false,click:null,link:"",newWindow:false,bounce:false,pauseOnHover:false,playOnHover:false,onHoverDelay:0,repeatCount:-1,appendBack:true,alwaysTrigger:false,flipListOnHover:false,flipListOnHoverEvent:"mouseout",noHAflipOpacity:"1",currentIndex:0,startNow:true,useModernizr:typeof window.Modernizr!=="undefined",useHardwareAccel:true,faces:{$front:null,$back:null},animationComplete:function(e,t,n){},triggerDelay:function(e){return Math.random()*3e3},swap:"",swapFront:"-",swapBack:"-",contentModules:[]};var r={init:function(n){var r={};e.extend(r,e.fn.liveTile.defaults,n);t.checkCapabilities(r);if(!e.fn.liveTile.contentModules.hasContentModule("image"))e.fn.liveTile.contentModules.addContentModule("image",o.imageSwap);if(!e.fn.liveTile.contentModules.hasContentModule("html"))e.fn.liveTile.contentModules.addContentModule("html",o.htmlSwap);return e(this).each(function(n,s){var o=e(s),u=i.initTileData(o,r);u.faces=i.prepTile(o,u);u.slide=function(e){i.slide(o,e)};u.carousel=function(e){i.carousel(o,e)};u.flip=function(e){i.flip(o,e)};u.flipList=function(e){i.flipList(o,e)};u.doAction=function(e){var t={slide:u.slide,carousel:u.carousel,flip:u.flip,"flip-list":u.flipList},n=t[u.mode];if(typeof n==="function"){u.loopCount=e;n(e);u.hasRun=true}if(e==u.timer.repeatCount)u.runEvents=false};u.timer=new e.fn.metrojs.TileTimer(u.delay,u.doAction,u.repeatCount);o.data("LiveTile",u);if(u.mode!=="flip-list"||u.flipListOnHover==false){if(u.pauseOnHover){i.bindPauseOnHover(o)}else if(u.playOnHover){i.bindPlayOnHover(o)}}if(u.link.length>0||typeof u.click==="function"){o.css({cursor:"pointer"}).bind("click.liveTile",function(){var e=true;if(typeof u.click==="function"){e=u.click(o,u)||false}if(e&&u.link.length>0){if(u.newWindow)window.open(u.link);else window.location=u.link}})}if(u.useHardwareAccel&&t.capabilities.canTransition)i.bindBounce(o,u);if(u.startNow&&u.mode!="none"){u.runEvents=true;u.timer.start(u.initDelay)}})},"goto":function(t){var n,r=typeof t;if(r==="undefined"){n={index:-99,delay:0,autoAniDirection:false}}if(r==="number"||!isNaN(t)){n={index:parseInt(t,10),delay:0}}else if(r==="string"){if(t=="next"){n={index:-99,delay:0}}else if(t.indexOf("prev")===0){n={index:-100,delay:0}}else{e.error(t+' is not a recognized action for .liveTile("goto")');return}}else if(r==="object"){if(typeof t.delay==="undefined"){t.delay=0}var i=typeof t.index;if(i==="undefined"){t.index=0}else if(i==="string"){if(t.index==="next")t.index=-99;else if(t.index.indexOf("prev")===0)t.index=-100}n=t}return e(this).each(function(t,r){var i=e(r),s=i.data("LiveTile"),o=i.data("metrojs.tile"),u=n.index;if(o.animating===true)return;if(s.mode==="carousel"){var a=s.faces.$listTiles.filter(".active");var f=s.faces.$listTiles.index(a);if(u===-100){if(typeof n.autoAniDirection==="undefined"||n.autoAniDirection)s.tempValues.animationDirection=typeof n.animationDirection==="undefined"?"backward":n.animationDirection;u=f===0?s.faces.$listTiles.length-1:f-1}else if(u===-99){if(typeof n.autoAniDirection==="undefined"||n.autoAniDirection)s.tempValues.animationDirection=typeof n.animationDirection==="undefined"?"forward":n.animationDirection;u=f+1}if(f==u){return}if(typeof n.direction!=="undefined"){s.tempValues.direction=n.direction}if(typeof n.animationDirection!=="undefined"){s.tempValues.animationDirection=n.animationDirection}if(u==0)s.currentIndex=s.faces.$listTiles.length;else s.currentIndex=u-1}else s.currentIndex=u;s.runEvents=true;s.timer.start(n.delay>=0?n.delay:s.delay)})},play:function(t){var n,r=typeof t;if(r==="undefined"){n={delay:-1}}else if(r==="number"){n={delay:t}}else if(r==="object"){if(typeof t.delay==="undefined"){t.delay=-1}n=t}return e(this).each(function(t,r){var i=e(r),s=i.data("LiveTile");s.runEvents=true;if(n.delay<0&&!s.hasRun)n.delay=s.initDelay;s.timer.start(n.delay>=0?n.delay:s.delay)})},animate:function(){return e(this).each(function(t,n){var r=e(n),i=r.data("LiveTile");i.doAction()})},stop:function(){return e(this).each(function(t,n){var r=e(n),i=r.data("LiveTile");i.hasRun=false;i.runEvents=false;i.timer.stop();window.clearTimeout(i.eventTimeout);window.clearTimeout(i.flCompleteTimeout);window.clearTimeout(i.completeTimeout);if(i.mode==="flip-list"){window.clearTimeout(i.completeTimeout);i.faces.$listTiles.each(function(t,n){var r=e(n).data("metrojs.tile");window.clearTimeout(r.eventTimeout);window.clearTimeout(r.flCompleteTimeout);window.clearTimeout(r.completeTimeout)})}})},pause:function(){return e(this).each(function(t,n){var r=e(n),i=r.data("LiveTile");i.timer.pause();i.runEvents=false;window.clearTimeout(i.eventTimeout);window.clearTimeout(i.flCompleteTimeout);window.clearTimeout(i.completeTimeout);if(i.mode==="flip-list"){i.faces.$listTiles.each(function(t,n){var r=e(n).data("metrojs.tile");window.clearTimeout(r.eventTimeout);window.clearTimeout(r.flCompleteTimeout);window.clearTimeout(r.completeTimeout)})}})},restart:function(t){var n,r=typeof t;if(r==="undefined"){n={delay:-1}}else if(r==="number"){n={delay:t}}else if(r==="object"){if(typeof t.delay==="undefined"){t.delay=-1}n=t}return e(this).each(function(t,r){var i=e(r),s=i.data("LiveTile");if(n.delay<0&&!s.hasRun)n.delay=s.initDelay;s.hasRun=false;s.runEvents=true;s.timer.restart(n.delay>=0?n.delay:s.delay)})},rebind:function(t){return e(this).each(function(n,i){var s=e(i);if(typeof t!=="undefined"){if(typeof t.timer!=="undefined"&&t.timer!=null){t.timer.stop()}t.hasRun=false;r["init"].apply(i,t)}else{r["init"].apply(i,{})}})},destroy:function(t){var n=typeof t,r;if(n==="undefined"){r={removeCss:false}}else if(n==="boolean"){r={removeCss:t}}else if(n==="object"){if(typeof t.removeCss==="undefined"){t.removeCss=false}r=t}return e(this).each(function(t,n){var o=e(n);var u=o.data("LiveTile");if(typeof u==="undefined")return;o.unbind(".liveTile");var a=s.appendStyleProperties({margin:"",cursor:""},["transform","transition"],["",""]);u.timer.stop();window.clearTimeout(u.eventTimeout);window.clearTimeout(u.flCompleteTimeout);window.clearTimeout(u.completeTimeout);if(u.faces.$listTiles!=null){u.faces.$listTiles.each(function(t,n){var s=e(n);if(u.mode==="flip-list"){var o=s.data("metrojs.tile");window.clearTimeout(o.eventTimeout);window.clearTimeout(o.flCompleteTimeout);window.clearTimeout(o.completeTimeout)}else if(u.mode==="carousel"){var f=u.listData[t];if(f.bounce){i.unbindMsBounce(s,f)}}if(r.removeCss){s.removeClass("ha");s.find(u.tileFaceSelector).unbind(".liveTile").removeClass("bounce flip-front flip-back ha slide slide-front slide-back").css(a)}else{s.find(u.tileFaceSelector).unbind(".liveTile")}s.removeData("metrojs.tile")}).unbind(".liveTile")}if(u.faces.$front!=null&&r.removeCss){u.faces.$front.removeClass("flip-front flip-back ha slide slide-front slide-back").css(a)}if(u.faces.$back!=null&&r.removeCss){u.faces.$back.removeClass("flip-front flip-back ha slide slide-front slide-back").css(a)}if(u.bounce){i.unbindMsBounce(o,u)}if(u.playOnHover){i.unbindMsPlayOnHover(o,u)}if(u.pauseOnhover){i.unbindMsPauseOnHover(o,u)}o.removeClass("ha");o.removeData("LiveTile");o.removeData("metrojs.tile");u=null})}};var i={getDataOrDefault:function(e,t,n){return typeof e.data(t)!=="undefined"?e.data(t):n},initTileData:function(t,n){var r=!n.ignoreDataAttributes;var s;if(r){s={speed:this.getDataOrDefault(t,"speed",n.speed),delay:this.getDataOrDefault(t,"delay",n.delay),stops:this.getDataOrDefault(t,"stops",n.stops),stack:this.getDataOrDefault(t,"stack",n.stack),mode:this.getDataOrDefault(t,"mode",n.mode),direction:this.getDataOrDefault(t,"direction",n.direction),useHardwareAccel:this.getDataOrDefault(t,"ha",n.useHardwareAccel),repeatCount:this.getDataOrDefault(t,"repeat",n.repeatCount),swap:this.getDataOrDefault(t,"swap",n.swap),appendBack:this.getDataOrDefault(t,"appendback",n.appendBack),currentIndex:this.getDataOrDefault(t,"start-index",n.currentIndex),animationDirection:this.getDataOrDefault(t,"slide-direction",n.animationDirection),startNow:this.getDataOrDefault(t,"start-now",n.startNow),tileSelector:this.getDataOrDefault(t,"tile-selector",n.tileSelector),tileFaceSelector:this.getDataOrDefault(t,"face-selector",n.tileFaceSelector),bounce:this.getDataOrDefault(t,"bounce",n.bounce),link:this.getDataOrDefault(t,"link",n.link),newWindow:this.getDataOrDefault(t,"new-window",n.newWindow),alwaysTrigger:this.getDataOrDefault(t,"always-trigger",n.alwaysTrigger),flipListOnHover:this.getDataOrDefault(t,"flip-onhover",n.flipListOnHover),pauseOnHover:this.getDataOrDefault(t,"pause-onhover",n.pauseOnHover),playOnHover:this.getDataOrDefault(t,"play-onhover",n.playOnHover),onHoverDelay:this.getDataOrDefault(t,"hover-delay",n.onHoverDelay),noHAflipOpacity:this.getDataOrDefault(t,"flip-opacity",n.noHAflipOpacity),runEvents:false,isReversed:false,loopCount:0,contentModules:{},listData:[],height:t.height(),width:t.width(),tempValues:{}}}else{s=e.extend({runEvents:false,isReversed:false,loopCount:0,contentModules:{},listData:[],height:t.height(),width:t.width(),tempValues:{}},n)}s.margin=s.direction==="vertical"?s.height/2:s.width/2;s.stops=typeof n.stops==="object"&&n.stops instanceof Array?n.stops:(""+s.stops).split(",");if(s.stops.length===1)s.stops.push("0px");var o=s.swap.replace(" ","").split(",");var u=r?this.getDataOrDefault(t,"swap-front",n.swapFront):n.swapFront;var a=r?this.getDataOrDefault(t,"swap-back",n.swapBack):n.swapBack;s.swapFront=u==="-"?o:u.replace(" ","").split(",");s.swapBack=a==="-"?o:a.replace(" ","").split(",");var f;for(f=0;f0&&e.inArray(s.swapFront[f],o)===-1)o.push(s.swapFront[f])}for(f=0;f0&&e.inArray(s.swapBack[f],o)===-1)o.push(s.swapBack[f])}s.swap=o;for(f=0;f0&&typeof e.fn.liveTile.contentModules.modules[o[f]]!=="undefined"){s.contentModules[o[f]]=e.fn.liveTile.contentModules.modules[o[f]]}}s.initDelay=r?this.getDataOrDefault(t,"initdelay",n.initDelay):n.initDelay;if(s.delay<-1)s.delay=n.triggerDelay(1);else if(s.delay<0)s.delay=3500+Math.random()*4501;if(s.initDelay<0)s.initDelay=s.delay;var l={},c;for(c in s.contentModules)e.extend(l,s.contentModules[c].data);e.extend(l,n,s);var h;if(l.mode==="flip-list"){h=t.find(l.tileSelector).not(".tile-title");h.each(function(t,n){var s=e(n);var o={direction:r?i.getDataOrDefault(s,"direction",l.direction):l.direction,newWindow:r?i.getDataOrDefault(s,"new-window",false):false,link:r?i.getDataOrDefault(s,"link",""):"",faces:{$front:null,$back:null},height:s.height(),width:s.width(),isReversed:false};o.margin=o.direction==="vertical"?o.height/2:o.width/2;l.listData.push(o)})}else if(l.mode==="carousel"){l.stack=true;h=t.find(l.tileSelector).not(".tile-title");h.each(function(t,n){var s=e(n);var o={bounce:r?i.getDataOrDefault(s,"bounce",false):false,link:r?i.getDataOrDefault(s,"link",""):"",newWindow:r?i.getDataOrDefault(s,"new-window",false):false,animationDirection:r?i.getDataOrDefault(s,"ani-direction",""):"",direction:r?i.getDataOrDefault(s,"direction",""):""};l.listData.push(o)})}for(c in l.contentModules){if(typeof l.contentModules[c].initData==="function")l.contentModules[c].initData(l,t)}s=null;return l},prepTile:function(r,o){r.addClass(o.mode);var u={$tileFaces:null,$listTiles:null,$front:null,$back:null};var a,f,l,c;switch(o.mode){case"slide":u.$tileFaces=r.find(o.tileFaceSelector).not(".tile-title");u.$front=o.faces.$front!=null&&o.faces.$front.length>0?o.faces.$front.addClass("slide-front"):u.$tileFaces.first().addClass("slide-front");if(o.faces.$back!=null&&o.faces.$back.length>0)u.$back=o.faces.$back.addClass("slide-back");else if(u.$tileFaces.length>1)u.$back=u.$tileFaces.last().addClass("slide-back");else if(o.appendBack)u.$back=e('
    ').appendTo(r);else u.$back=e("
    ");if(o.stack==true){if(o.direction==="vertical"){u.$back.css({top:-o.height+"px"})}else{u.$back.css({left:-o.width+"px"})}}r.data("metrojs.tile",{animating:false});if(t.capabilities.canTransition&&o.useHardwareAccel){r.addClass("ha");u.$front.addClass("ha");u.$back.addClass("ha")}break;case"carousel":u.$listTiles=r.find(o.tileSelector).not(".tile-title");var h=u.$listTiles.length;r.data("metrojs.tile",{animating:false});o.currentIndex=Math.min(o.currentIndex,h-1);u.$listTiles.each(function(n,r){var s=e(r).addClass("slide");var u=o.listData[n],a=typeof u.animationDirection==="string"&&u.animationDirection.length>0?u.animationDirection:o.animationDirection,f=typeof u.direction==="string"&&u.direction.length>0?u.direction:o.direction;if(n==o.currentIndex){s.addClass("active")}else if(a==="forward"){if(f==="vertical"){s.css({top:o.height+"px",left:"0px"})}else{s.css({left:o.width+"px",top:"0px"})}}else if(a==="backward"){if(f==="vertical"){s.css({top:-o.height+"px",left:"0px"})}else{s.css({left:-o.width+"px",top:"0px"})}}i.bindLink(s,u);if(o.useHardwareAccel&&t.capabilities.canTransition)i.bindBounce(s,u);s=null;u=null});if(t.capabilities.canFlip3d&&o.useHardwareAccel){r.addClass("ha");u.$listTiles.addClass("ha")}break;case"flip-list":u.$listTiles=r.find(o.tileSelector).not(".tile-title");u.$listTiles.each(function(r,u){var h=e(u).addClass("tile-"+(r+1));var p=h.find(o.tileFaceSelector).first().addClass("flip-front").css({margin:"0px"});if(h.find(o.tileFaceSelector).length===1&&o.appendBack==true)h.append("
    ");var d=h.find(o.tileFaceSelector).last().addClass("flip-back").css({margin:"0px"});o.listData[r].faces.$front=p;o.listData[r].faces.$back=d;h.data("metrojs.tile",{animating:false,count:1,completeTimeout:null,flCompleteTimeout:null,index:r});var v=h.data("metrojs.tile");if(t.capabilities.canFlip3d&&o.useHardwareAccel){h.addClass("ha");p.addClass("ha");d.addClass("ha");a=o.listData[r].direction==="vertical"?"rotateX(180deg)":"rotateY(180deg)";f=s.appendStyleProperties({},["transform"],[a]);d.css(f)}else{l=o.listData[r].direction==="vertical"?{height:"100%",width:"100%",marginTop:"0px",opacity:"1"}:{height:"100%",width:"100%",marginLeft:"0px",opacity:"1"};c=o.listData[r].direction==="vertical"?{height:"0px",width:"100%",marginTop:o.listData[r].margin+"px",opacity:o.noHAflipOpacity}:{height:"100%",width:"0px",marginLeft:o.listData[r].margin+"px",opacity:o.noHAflipOpacity};p.css(l);d.css(c)}var m=function(){v.count++;if(v.count>=n)v.count=1};if(o.flipListOnHover){var g=o.flipListOnHoverEvent+".liveTile";p.bind(g,function(){i.flip(h,v.count,o,m)});d.bind(g,function(){i.flip(h,v.count,o,m)})}if(o.listData[r].link.length>0){h.css({cursor:"pointer"}).bind("click.liveTile",function(){if(o.listData[r].newWindow)window.open(o.listData[r].link);else window.location=o.listData[r].link})}});break;case"flip":u.$tileFaces=r.find(o.tileFaceSelector).not(".tile-title");u.$front=o.faces.$front!=null&&o.faces.$front.length>0?o.faces.$front.addClass("flip-front"):u.$tileFaces.first().addClass("flip-front");if(o.faces.$back!=null&&o.faces.$back.length>0){u.$back=o.faces.$back.addClass("flip-back")}else if(u.$tileFaces.length>1){u.$back=u.$tileFaces.last().addClass("flip-back")}else if(o.appendBack){u.$back=e('
    ').appendTo(r)}else{u.$back=e("
    ")}r.data("metrojs.tile",{animating:false});if(t.capabilities.canFlip3d&&o.useHardwareAccel){r.addClass("ha");u.$front.addClass("ha");u.$back.addClass("ha");a=o.direction==="vertical"?"rotateX(180deg)":"rotateY(180deg)";f=s.appendStyleProperties({},["transform"],[a]);u.$back.css(f)}else{l=o.direction==="vertical"?{height:"100%",width:"100%",marginTop:"0px",opacity:"1"}:{height:"100%",width:"100%",marginLeft:"0px",opacity:"1"};c=o.direction==="vertical"?{height:"0px",width:o.width+"px",marginTop:o.margin+"px",opacity:"0"}:{height:o.height+"px",width:"0px",marginLeft:o.margin+"px",opacity:"0"};u.$front.css(l);u.$back.css(c)}break}return u},bindPauseOnHover:function(n){(function(){var r=n.data("LiveTile"),i=false,s=false;r.pOnHoverMethods={over:function(t){if(i||s)return;if(r.runEvents){s=true;r.eventTimeout=window.setTimeout(function(){s=false;i=true;r.timer.pause();if(r.mode==="flip-list"){r.faces.$listTiles.each(function(t,n){window.clearTimeout(e(n).data("metrojs.tile").completeTimeout)})}},r.onHoverDelay)}},out:function(e){if(s){window.clearTimeout(r.eventTimeout);s=false;return}if(!i&&!s)return;if(r.runEvents)r.timer.start(r.hasRun?r.delay:r.initDelay);i=false}};if(!t.capabilities.canTouch){n.bind("mouseover.liveTile",r.pOnHoverMethods.over);n.bind("mouseout.liveTile",r.pOnHoverMethods.out)}else{if(window.navigator.msPointerEnabled){n[0].addEventListener("MSPointerOver",r.pOnHoverMethods.over,false);n[0].addEventListener("MSPointerOut",r.pOnHoverMethods.out,false)}else{n.bind("touchstart.liveTile",r.pOnHoverMethods.over);n.bind("touchend.liveTile",r.pOnHoverMethods.out)}}})()},unbindMsPauseOnHover:function(e,t){if(typeof t.pOnHoverMethods!=="undefined"&&window.navigator.msPointerEnabled){e[0].removeEventListener("MSPointerOver",t.pOnHoverMethods.over,false);e[0].removeEventListener("MSPointerOut",t.pOnHoverMethods.out,false)}},bindPlayOnHover:function(e){(function(){var n=e.data("LiveTile"),i=false,s=false;n.onHoverMethods={over:function(t){if(i||s)return;var o=n.startNow?!n.isReversed:n.isReversed;window.clearTimeout(n.eventTimeout);if(n.runEvents&&o||!n.hasRun){s=true;n.eventTimeout=window.setTimeout(function(){s=false;i=true;r["play"].apply(e[0],[0])},n.onHoverDelay)}},out:function(t){if(s){window.clearTimeout(n.eventTimeout);s=false;return}if(!i&&!s)return;window.clearTimeout(n.eventTimeout);n.eventTimeout=window.setTimeout(function(){var t=n.startNow?n.isReversed:!n.isReversed;if(n.runEvents&&t){r["play"].apply(e[0],[0])}i=false},n.speed+200)}};e.addClass("noselect");if(!t.capabilities.canTouch){e.bind({"mouseenter.liveTile":function(e){n.onHoverMethods.over(e)},"mouseleave.liveTile":function(e){n.onHoverMethods.out(e)}})}else{if(window.navigator.msPointerEnabled){e[0].addEventListener("MSPointerDown",n.onHoverMethods.over,false);e.bind("mouseleave.liveTile",n.onHoverMethods.out)}else{e.bind("touchstart.liveTile",n.onHoverMethods.over);e.bind("touchend.liveTile",n.onHoverMethods.out)}}})()},unbindMsPlayOnHover:function(e,t){if(typeof t.onHoverMethods!=="undefined"&&window.navigator.msPointerEnabled){e[0].removeEventListener("MSPointerDown",t.onHoverMethods.over,false)}},bindBounce:function(e,t){if(t.bounce){var n=s.appendStyleProperties({},["transition-property","transition-duration"],["scale","200ms"]);e.addClass("bounce");(function(){t.bounceMethods={down:false,threshold:10,zeroPos:{x:0,y:0},prevPos:{x:0,y:0},bounceDown:function(t){this.prevPos={x:t.pageX,y:t.pageY};e.addClass("bounce-dwn");this.down=true},bounceUp:function(){if(this.down===true){t.bounceMethods.unBounce()}},bounceMove:function(e){if(this.down===true){if(Math.abs(e.pageX-prevPos.x)>this.threshold||Math.abs(e.pageY-prevPos.y)>this.threshold){}}},unBounce:function(){e.removeClass("bounce-dwn");this.down=false;this.prevPos=this.zeroPos}};if(window.navigator.msPointerEnabled){e[0].addEventListener("MSPointerDown",t.bounceMethods.bounceDown,false);e[0].addEventListener("MSPointerCancel",t.bounceMethods.bounceUp,false);e[0].addEventListener("MSPointerOut",t.bounceMethods.bounceUp,false);e[0].addEventListener("MSPointerUp",t.bounceMethods.bounceUp,false)}else{e.bind("mousedown.liveTile touchstart.liveTile",t.bounceMethods.bounceDown);e.bind("mouseup.liveTile touchend.liveTile, mouseout.liveTile touchcancel.liveTile",t.bounceMethods.bounceUp)}})()}},unbindMsBounce:function(e,t){if(t.bounce&&window.navigator.msPointerEnabled){e[0].removeEventListener("MSPointerDown",t.bounceMethods.bounceDown,false);e[0].removeEventListener("MSPointerCancel",t.bounceMethods.bounceUp,false);e[0].removeEventListener("MSPointerOut",t.bounceMethods.bounceUp,false)}},bindLink:function(e,t){if(t.link.length>0){e.css({cursor:"pointer"}).bind("click.liveTile",function(){if(t.newWindow)window.open(t.link);else window.location=t.link})}},slide:function(n,r,i,o,u){var a=typeof i==="undefined"?n.data("LiveTile"):i;var f=n.data("metrojs.tile");if(f.animating==true||n.is(":animated")){a=null;f=null;return}if(a.mode!=="carousel"){a.isReversed=r%2===0}else a.isReversed=true;a.timer.pause();var l;if(typeof a.tempValues.direction==="string"&&a.tempValues.direction.length>0)l=a.tempValues.direction;else l=a.direction;a.tempValues.direction=null;var c={},h={},p=typeof o==="undefined"?a.currentIndex:o,d=e.trim(a.stops[Math.min(p,a.stops.length-1)]),v=d.indexOf("px"),m=0,g=0,y=l==="vertical"?a.height:a.width,b=l==="vertical"?"top":"left";var w=function(){if(typeof u==="undefined"){a.currentIndex=a.currentIndex+1;if(a.currentIndex>a.stops.length-1){a.currentIndex=0}}else{u()}for(var e in a.contentModules)a.contentModules[e].action(a,a.faces.$front,a.faces.$back,a.currentIndex);a.animationComplete(a,a.faces.$front,a.faces.$back);if(a.timer.repeatCount>0||a.timer.repeatCount==-1){if(a.timer.count!=a.timer.repeatCount){a.timer.start(a.delay)}}a=null;f=null};if(v>0){g=parseInt(d.substring(0,v),10);m=g-y+"px"}else{g=parseInt(d.replace("%",""),10);m=g-100+"%"}if(t.capabilities.canTransition&&a.useHardwareAccel){if(typeof f.animating!=="undefined"&&f.animating==true)return;f.animating=true;c=s.appendStyleProperties(c,["transition-property","transition-duration"],[b,a.speed+"ms"]);if(l==="vertical")c.top=d;else c.left=d;a.faces.$front.css(c);if(a.stack==true){if(l==="vertical")c.top=m;else c.left=m;a.faces.$back.css(c)}window.clearTimeout(a.completeTimeout);a.completeTimeout=window.setTimeout(function(){f.animating=false;w()},a.speed)}else{c[b]=d;h[b]=m;f.animating=true;a.faces.$front.stop().animate(c,a.speed,"linear",function(){f.animating=false;w()});if(a.stack==true){a.faces.$back.stop().animate(h,a.speed,"linear",function(){})}}},carousel:function(e,t){var n=e.data("LiveTile");var r=e.data("metrojs.tile");if(r.animating==true||n.faces.$listTiles.length<=1){r=null;return}n.timer.pause();var o=n.faces.$listTiles.filter(".active");idx=n.faces.$listTiles.index(o),goTo=Math.max(n.currentIndex,0),eq=goTo!=idx?goTo:idx,nxtIdx=eq+1>=n.faces.$listTiles.length?0:eq+1,sdata=n.listData[nxtIdx];if(idx==nxtIdx){r=null;o=null;return}var u;if(typeof n.tempValues.animationDirection==="string"&&n.tempValues.animationDirection.length>0)u=n.tempValues.animationDirection;else if(typeof sdata.animationDirection==="string"&&sdata.animationDirection.length>0){u=sdata.animationDirection}else u=n.animationDirection;n.tempValues.animationDirection=null;var a;if(typeof n.tempValues.direction==="string"&&n.tempValues.direction.length>0){a=n.tempValues.direction}else if(typeof sdata.direction==="string"&&sdata.direction.length>0){a=sdata.direction;n.tempValues.direction=a}else{a=n.direction}var f=n.faces.$listTiles.eq(nxtIdx);var l=s.appendStyleProperties({},["transition-duration"],["0s"]);if(u==="backward"){if(a==="vertical"){l.top="-100%";l.left="0px"}else{l.top="0px";l.left="-100%"}n.faces.$front=o;n.faces.$back=f;n.stops=["100%"]}else{if(a==="vertical"){l.top="100%";l.left="0px"}else{l.top="0px";l.left="100%"}n.faces.$front=f;n.faces.$back=o;n.stops=["0px"]}f.css(l);window.setTimeout(function(){if(n.timer.repeatCount>0||n.timer.repeatCount==-1){if(n.timer.count!=n.timer.repeatCount){n.timer.start(n.delay)}}i.slide(e,t,n,0,function(){o.removeClass("active");f.addClass("active");n.currentIndex=nxtIdx;r=null;o=null;f=null})},200)},flip:function(e,n,r,i){var o=e.data("metrojs.tile");if(o.animating==true){anidata=null;return}var u=typeof r==="object"?r:e.data("LiveTile");var a,f,l,c,h,p,d=typeof i==="undefined",v=0,m=n%2===0;if(u.mode==="flip-list"){v=o.index;a=u.listData[v].faces.$front;f=u.listData[v].faces.$back;u.listData[v].isReversed=m;l=u.listData[v].direction;height=u.listData[v].height;width=u.listData[v].width;margin=u.listData[v].margin}else{a=u.faces.$front;f=u.faces.$back;u.isReversed=m;l=u.direction;height=u.height;width=u.width;margin=u.margin}if(t.capabilities.canFlip3d&&u.useHardwareAccel){c=!m?"180deg":"360deg";h=l==="vertical"?"rotateX("+c+")":"rotateY("+c+")";p=s.appendStyleProperties({},["transform","transition"],[h,"all "+u.speed+"ms ease 0s"]);var g=!m?"360deg":"540deg";var y=l==="vertical"?"rotateX("+g+")":"rotateY("+g+")";var b=s.appendStyleProperties({},["transform","transition"],[y,"all "+u.speed+"ms ease 0s"]);a.css(p);f.css(b);var w=function(){o.animating=false;var e,t,n;if(!m){for(n in u.contentModules)u.contentModules[n].action(u,f,a,v);if(d)u.animationComplete(u,f,a);else i(u,f,a)}else{e=l==="vertical"?"rotateX(0deg)":"rotateY(0deg)";t=s.appendStyleProperties({},["transform","transition"],[e,"all 0s ease 0s"]);a.css(t);for(n in u.contentModules)u.contentModules[n].action(u,a,f,v);if(d)u.animationComplete(u,a,f);else i(u,a,f);a=null;f=null;u=null;o=null}};if(u.mode==="flip-list"){window.clearTimeout(u.listData[v].completeTimeout);u.listData[v].completeTimeout=window.setTimeout(w,u.speed)}else{window.clearTimeout(u.completeTimeout);u.completeTimeout=window.setTimeout(w,u.speed)}}else{var E=u.speed/2;var S=l==="vertical"?{height:"0px",width:"100%",marginTop:margin+"px",opacity:u.noHAflipOpacity}:{height:"100%",width:"0px",marginLeft:margin+"px",opacity:u.noHAflipOpacity};var x=l==="vertical"?{height:"100%",width:"100%",marginTop:"0px",opacity:"1"}:{height:"100%",width:"100%",marginLeft:"0px",opacity:"1"};var T;if(!m){o.animating=true;a.stop().animate(S,{duration:E});T=function(){o.animating=false;f.stop().animate(x,{duration:E,complete:function(){for(var e in u.contentModules)u.contentModules[e].action(u,f,a,v);if(d)u.animationComplete(u,f,a);else i(u,f,a);a=null;f=null;u=null;o=null}})};if(u.mode==="flip-list"){window.clearTimeout(u.listData[o.index].completeTimeout);u.listData[o.index].completeTimeout=window.setTimeout(T,E)}else{window.clearTimeout(u.completeTimeout);u.completeTimeout=window.setTimeout(T,E)}}else{o.animating=true;f.stop().animate(S,{duration:E});T=function(){o.animating=false;a.stop().animate(x,{duration:E,complete:function(){for(var e in u.contentModules)u.contentModules[e].action(u,a,f,v);if(d)u.animationComplete(u,a,f);else i(u,a,f);o=null;a=null;f=null}})};if(u.mode==="flip-list"){window.clearTimeout(u.listData[o.index].completeTimeout);u.listData[o.index].completeTimeout=window.setTimeout(T,E)}else{window.clearTimeout(u.completeTimeout);u.completeTimeout=window.setTimeout(T,E)}}}},flipList:function(t,r){var s=t.data("LiveTile");var o=s.speed;var u=false;s.timer.pause();s.faces.$listTiles.each(function(t,r){var a=e(r);var f=a.data("metrojs.tile");var l=s.triggerDelay(t);var c=s.speed+Math.max(l,0);var h=s.alwaysTrigger;if(!h)h=Math.random()*351>150?true:false;if(h){u=true;o=Math.max(c+s.speed,o);window.clearTimeout(f.flCompleteTimeout);f.flCompleteTimeout=window.setTimeout(function(){i.flip(a,f.count,s,function(e){f.count++;if(f.count>=n)f.count=1;a=null;f=null})},c)}});if(u){window.clearTimeout(s.flCompleteTimeout);s.flCompleteTimeout=window.setTimeout(function(){for(var e in s.contentModules)s.contentModules[e].action(s,null,null,-1);s.animationComplete(s,null,null);if(s.timer.repeatCount>0||s.timer.repeatCount==-1){if(s.timer.count!=s.timer.repeatCount){s.timer.start(s.delay)}}},o+s.speed)}}};var s={stylePrefixes:"Webkit Moz O ms Khtml ".split(" "),domPrefixes:"-webkit- -moz- -o- -ms- -khtml- ".split(" "),appendStyleProperties:function(t,n,r){for(var i=0;i<=n.length-1;i++){for(var s=0;s<=this.domPrefixes.length-1;s++)t[e.trim(this.domPrefixes[s]+n[i])]=r[i]}return t},shuffleArray:function(e){var t=[];while(e.length)t.push(e.splice(Math.random()*e.length,1));while(t.length)e.push(t.pop());return e}};var o={customSwap:{data:{customDoSwapFront:function(){return false},customDoSwapBack:function(){return false},customGetContent:function(e,t,n,r){return null}},initData:function(t,n){var r={};r.doSwapFront=e.inArray("custom",t.swapFront)>-1&&t.customDoSwapFront();r.doSwapBack=e.inArray("custom",t.swapBack)>-1&&t.customDoSwapBack();if(typeof t.customSwap!=="undefined")t.customSwap=e.extend(r,t.customSwap);else t.customSwap=r},action:function(e,t,n,r){}},htmlSwap:{data:{frontContent:[],frontIsRandom:true,frontIsInGrid:false,backContent:[],backIsRandom:true,backIsInGrid:false},initData:function(t,n){var r={backBag:[],backIndex:0,backStaticIndex:0,backStaticRndm:-1,prevBackIndex:-1,frontBag:[],frontIndex:0,frontStaticIndex:0,frontStaticRndm:-1,prevFrontIndex:-1};r.frontIsRandom=!t.ignoreDataAttributes?i.getDataOrDefault(n,"front-israndom",t.frontIsRandom):t.frontIsRandom;r.frontIsInGrid=!t.ignoreDataAttributes?i.getDataOrDefault(n,"front-isingrid",t.frontIsInGrid):t.frontIsInGrid;r.backIsRandom=!t.ignoreDataAttributes?i.getDataOrDefault(n,"back-israndom",t.backIsRandom):t.backIsRandom;r.backIsInGrid=!t.ignoreDataAttributes?i.getDataOrDefault(n,"back-isingrid",t.backIsInGrid):t.backIsInGrid;r.doSwapFront=e.inArray("html",t.swapFront)>-1&&t.frontContent instanceof Array&&t.frontContent.length>0;r.doSwapBack=e.inArray("html",t.swapBack)>-1&&t.backContent instanceof Array&&t.backContent.length>0;if(typeof t.htmlSwap!=="undefined")t.htmlSwap=e.extend(r,t.htmlSwap);else t.htmlSwap=r;if(t.htmlSwap.doSwapFront){t.htmlSwap.frontBag=this.prepBag(t.htmlSwap.frontBag,t.frontContent,t.htmlSwap.prevFrontIndex);t.htmlSwap.frontStaticRndm=t.htmlSwap.frontBag.pop()}if(t.htmlSwap.doSwapBack){t.htmlSwap.backBag=this.prepBag(t.htmlSwap.backBag,t.backContent,t.htmlSwap.prevBackIndex);t.htmlSwap.backStaticRndm=t.htmlSwap.backBag.pop()}},prepBag:function(e,t,n){e=[];var r=0;for(var i=0;i=e.frontContent.length)e.htmlSwap.frontStaticIndex=0}}else{if(e.htmlSwap.doSwapBack){if(e.htmlSwap.backBag.length===0)e.htmlSwap.backBag=this.prepBag(e.htmlSwap.backBag,e.backContent,e.htmlSwap.backStaticRndm);e.htmlSwap.backStaticRndm=e.htmlSwap.backBag.pop();e.htmlSwap.backStaticIndex++;if(e.htmlSwap.backStaticIndex>=e.backContent.length)e.htmlSwap.backStaticIndex=0}}return}if(!o){if(!e.htmlSwap.doSwapFront)return;s=this.getFrontSwapIndex(e);e.htmlSwap.prevFrontIndex=s;if(e.mode==="slide"){if(!e.startNow)t.html(e.frontContent[s]);else n.html(e.frontContent[s])}else n.html(e.frontContent[s]);e.htmlSwap.frontIndex++;if(e.htmlSwap.frontIndex>=e.frontContent.length)e.htmlSwap.frontIndex=0;if(!i){e.htmlSwap.frontStaticIndex++;if(e.htmlSwap.frontStaticIndex>=e.frontContent.length)e.htmlSwap.frontStaticIndex=0}else{}}else{if(!e.htmlSwap.doSwapBack)return;s=this.getBackSwapIndex(e);e.htmlSwap.prevBackIndex=s;n.html(e.backContent[e.htmlSwap.backIndex]);e.htmlSwap.backIndex++;if(e.htmlSwap.backIndex>=e.backContent.length)e.htmlSwap.backIndex=0;if(!i){e.htmlSwap.backStaticIndex++;if(e.htmlSwap.backStaticIndex>=e.backContent.length)e.htmlSwap.backStaticIndex=0}else{}}}},imageSwap:{data:{preloadImages:false,imageCssSelector:">img,>a>img",frontImages:[],frontIsRandom:true,frontIsBackgroundImage:false,frontIsInGrid:false,backImages:null,backIsRandom:true,backIsBackgroundImage:false,backIsInGrid:false},initData:function(t,n){var r={backBag:[],backIndex:0,backStaticIndex:0,backStaticRndm:-1,frontBag:[],frontIndex:0,frontStaticIndex:0,frontStaticRndm:-1,prevBackIndex:-1,prevFrontIndex:-1};r.imageCssSelector=!t.ignoreDataAttributes?i.getDataOrDefault(n,"image-css",t.imageCssSelector):t.imageCssSelector;r.frontIsRandom=!t.ignoreDataAttributes?i.getDataOrDefault(n,"front-israndom",t.frontIsRandom):t.frontIsRandom;r.frontIsInGrid=!t.ignoreDataAttributes?i.getDataOrDefault(n,"front-isingrid",t.frontIsInGrid):t.frontIsInGrid;r.frontIsBackgroundImage=!t.ignoreDataAttributes?i.getDataOrDefault(n,"front-isbg",t.frontIsBackgroundImage):t.frontIsBackgroundImage;r.backIsRandom=!t.ignoreDataAttributes?i.getDataOrDefault(n,"back-israndom",t.backIsRandom):t.backIsRandom;r.backIsInGrid=!t.ignoreDataAttributes?i.getDataOrDefault(n,"back-isingrid",t.backIsInGrid):t.backIsInGrid;r.backIsBackgroundImage=!t.ignoreDataAttributes?i.getDataOrDefault(n,"back-isbg",t.backIsBackgroundImage):t.backIsBackgroundImage;r.doSwapFront=e.inArray("image",t.swapFront)>-1&&t.frontImages instanceof Array&&t.frontImages.length>0;r.doSwapBack=e.inArray("image",t.swapBack)>-1&&t.backImages instanceof Array&&t.backImages.length>0;if(typeof t.imgSwap!=="undefined")t.imgSwap=e.extend(r,t.imgSwap);else t.imgSwap=r;if(t.imgSwap.doSwapFront){t.imgSwap.frontBag=this.prepBag(t.imgSwap.frontBag,t.frontImages,t.imgSwap.prevFrontIndex);t.imgSwap.frontStaticRndm=t.imgSwap.frontBag.pop();if(t.preloadImages)e(t.frontImages).metrojs.preloadImages(function(){})}if(t.imgSwap.doSwapBack){t.imgSwap.backBag=this.prepBag(t.imgSwap.backBag,t.backImages,t.imgSwap.prevBackIndex);t.imgSwap.backStaticRndm=t.imgSwap.backBag.pop();if(t.preloadImages)e(t.backImages).metrojs.preloadImages(function(){})}},prepBag:function(e,t,n){e=[];var r=0;for(var i=0;i=e.frontImages.length)e.imgSwap.frontStaticIndex=0}}else{if(e.imgSwap.doSwapBack){if(e.imgSwap.backBag.length===0)e.imgSwap.backBag=this.prepBag(e.imgSwap.backBag,e.backImages,e.imgSwap.backStaticRndm);e.imgSwap.backStaticRndm=e.imgSwap.backBag.pop();e.imgSwap.backStaticIndex++;if(e.imgSwap.backStaticIndex>=e.backImages.length)e.imgSwap.backStaticIndex=0}}return}var u,a,f;if(!o){if(!e.imgSwap.doSwapFront)return;s=this.getFrontSwapIndex(e);e.imgSwap.prevFrontIndex=s;u=e.mode==="slide"?t:n;a=u.find(e.imgSwap.imageCssSelector);f=typeof e.frontImages[s]==="object"?e.frontImages[s]:{src:e.frontImages[s]};this.setImageProperties(a,f,e.imgSwap.frontIsBackgroundImage);e.imgSwap.frontIndex++;if(e.imgSwap.frontIndex>=e.frontImages.length)e.imgSwap.frontIndex=0;if(!i){e.imgSwap.frontStaticIndex++;if(e.imgSwap.frontStaticIndex>=e.frontImages.length)e.imgSwap.frontStaticIndex=0}else{}}else{if(!e.imgSwap.doSwapBack)return;s=this.getBackSwapIndex(e);e.imgSwap.prevBackIndex=s;u=n;a=u.find(e.imgSwap.imageCssSelector);f=typeof e.backImages[s]==="object"?e.backImages[s]:{src:e.backImages[s]};this.setImageProperties(a,f,e.imgSwap.backIsBackgroundImage);e.imgSwap.backIndex++;if(e.imgSwap.backIndex>=e.backImages.length)e.imgSwap.backIndex=0;if(!i){e.imgSwap.backStaticIndex++;if(e.imgSwap.backStaticIndex>=e.backImages.length)e.imgSwap.backStaticIndex=0}else{}}u=null;a=null}}};e.fn.metrojs.TileTimer=function(e,t,r){this.timerId=null;this.interval=e;this.action=t;this.count=0;this.repeatCount=typeof r==="undefined"?0:r;this.start=function(t){window.clearTimeout(this.timerId);var n=this;this.timerId=window.setTimeout(function(){n.tick.call(n,e)},t)};this.tick=function(e){this.action(this.count+1);this.count++;if(this.count>=n)this.count=0;if(this.repeatCount>0||this.repeatCount==-1){if(this.count!=this.repeatCount){this.start(e)}else this.stop()}};this.stop=function(){this.timerId=window.clearTimeout(this.timerId);this.reset()};this.resume=function(){if(this.repeatCount>0||this.repeatCount==-1){if(this.count!=this.repeatCount){this.start(e)}}};this.pause=function(){this.timerId=window.clearTimeout(this.timerId)};this.reset=function(){this.count=0};this.restart=function(e){this.stop();this.start(e)}};jQuery.fn.metrojs.theme={loadDefaultTheme:function(e){if(typeof e=="undefined"||e==null){e=jQuery.fn.metrojs.theme.defaults}else{var t=jQuery.fn.metrojs.theme.defaults;jQuery.extend(t,e);e=t}var n=typeof window.localStorage!="undefined";var r=function(e){return typeof window.localStorage[e]!="undefined"&&window.localStorage[e]!=null};if(n&&(!r("Metro.JS.AccentColor")||!r("Metro.JS.BaseAccentColor"))){window.localStorage["Metro.JS.AccentColor"]=e.accentColor;window.localStorage["Metro.JS.BaseAccentColor"]=e.baseTheme;jQuery(e.accentCssSelector).addClass(e.accentColor).data("accent",e.accentColor);jQuery(e.baseThemeCssSelector).addClass(e.baseTheme);if(typeof (e.loaded=="function"))e.loaded(e.baseTheme,e.accentColor);if(typeof e.preloadAltBaseTheme!="undefined"&&e.preloadAltBaseTheme)jQuery([e.baseTheme=="dark"?e.metroLightUrl:e.metroDarkUrl]).metrojs.preloadImages(function(){})}else{if(n){e.accentColor=window.localStorage["Metro.JS.AccentColor"];e.baseTheme=window.localStorage["Metro.JS.BaseAccentColor"];jQuery(e.accentCssSelector).addClass(e.accentColor).data("accent",e.accentColor);jQuery(e.baseThemeCssSelector).addClass(e.baseTheme);if(typeof (e.loaded=="function"))e.loaded(e.baseTheme,e.accentColor)}else{jQuery(e.accentCssSelector).addClass(e.accentColor).data("accent",e.accentColor);jQuery(e.baseThemeCssSelector).addClass(e.baseTheme);if(typeof (e.loaded=="function"))e.loaded(e.baseTheme,e.accentColor);if(typeof e.preloadAltBaseTheme!="undefined"&&e.preloadAltBaseTheme)jQuery([e.baseTheme=="dark"?e.metroLightUrl:e.metroDarkUrl]).metrojs.preloadImages(function(){})}}},applyTheme:function(e,t,n){if(typeof n=="undefined"||n==null){n=jQuery.fn.metrojs.theme.defaults}else{var r=jQuery.fn.metrojs.theme.defaults;jQuery.extend(r,n);n=r}if(typeof e!="undefined"&&e!=null){if(typeof window.localStorage!="undefined"){window.localStorage["Metro.JS.BaseAccentColor"]=e}var i=jQuery(n.baseThemeCssSelector);if(i.length>0){if(e=="dark")i.addClass("dark").removeClass("light");else if(e=="light")i.addClass("light").removeClass("dark")}}if(typeof t!="undefined"&&t!=null){if(typeof window.localStorage!="undefined"){window.localStorage["Metro.JS.AccentColor"]=t}var s=jQuery(n.accentCssSelector);if(s.length>0){var o=false;s.each(function(){jQuery(this).addClass(t);var e=jQuery(this).data("accent");if(e!=t){var n=jQuery(this).attr("class").replace(e,"");n=n.replace(/(\s)+/," ");jQuery(this).attr("class",n);jQuery(this).data("accent",t);o=true}});if(o&&typeof n.accentPicked=="function")n.accentPicked(t)}}},appendAccentColors:function(t){if(typeof t=="undefined"||t==null){t=jQuery.fn.metrojs.theme.defaults}else{var n=jQuery.fn.metrojs.theme.defaults;jQuery.extend(n,t);t=n}var r="";var i=t.accentColors;var s=t.accentListTemplate;for(var o=0;o",accentListContainer:".theme-options",baseThemeListTemplate:"
  • ",baseThemeListContainer:".base-theme-options"}};jQuery.fn.applicationBar=function(t){var n=typeof jQuery.fn.metrojs.theme!=="undefined"?jQuery.fn.metrojs.theme.defaults:{};jQuery.extend(n,jQuery.fn.applicationBar.defaults,t);if(typeof jQuery.fn.metrojs.theme!="undefined"){var r=jQuery.fn.metrojs.theme;if(n.shouldApplyTheme){r.loadDefaultTheme(n)}var i=n.accentListContainer+" a";var s=function(){var e=jQuery(this).attr("class").replace("accent","").replace(" ","");r.applyTheme(null,e,n);if(typeof n.accentPicked=="function")n.accentPicked(e)};var o=n.baseThemeListContainer+" a";var u=function(){var e=jQuery(this).attr("class").replace("accent","").replace(" ","");r.applyTheme(e,null,n);if(typeof n.themePicked=="function")n.themePicked(e)};if(typeof e.fn.on==="function"){e(this).on("click.appBar",i,s);e(this).on("click.appBar",o,u)}else{e(i).live("click.appBar",s);e(o).live("click.appBar",u)}}jQuery(this).each(function(){var e=jQuery(this);if(navigator.userAgent.match(/(Android|webOS|iPhone|iPod|BlackBerry|PIE|IEMobile)/i)){if(!navigator.userAgent.match(/(IEMobile\/1)/i)&&!navigator.userAgent.match(/(iPhone OS [56789])/i)){e.css({position:"absolute",bottom:"0px"})}}e.animateAppBar=function(t){var r=t?n.collapseHeight:n.expandHeight;if(t)e.removeClass("expanded");else if(!e.hasClass("expanded"))e.addClass("expanded");e.stop().animate({height:r},{duration:n.duration})};e.find("a.etc").click(function(){e.animateAppBar(e.hasClass("expanded"))});if(n.bindKeyboard==true){jQuery(document.documentElement).keyup(function(t){if(t.keyCode==38){if(t.target&&t.target.tagName.match(/INPUT|TEXTAREA|SELECT/i)==null){if(!e.hasClass("expanded")){e.animateAppBar(false)}}}else if(t.keyCode==40){if(t.target&&t.target.tagName.match(/INPUT|TEXTAREA|SELECT/i)==null){if(e.hasClass("expanded")){e.animateAppBar(true)}}}})}})};jQuery.fn.applicationBar.defaults={applyTheme:true,themePicked:function(e){},accentPicked:function(e){},loaded:function(e,t){},duration:300,expandHeight:"320px",collapseHeight:"60px",bindKeyboard:true,metroLightUrl:"images/metroIcons_light.jpg",metroDarkUrl:"images/metroIcons.jpg",preloadAltBaseTheme:false};jQuery.fn.metrojs.preloadImages=function(e){var t=jQuery(this).toArray();var n=jQuery("").appendTo("body");jQuery(this).each(function(){n.attr({src:this}).load(function(){var n=jQuery(this).attr("src");for(var r=0;r0||h(["@media (",u.join("touch-enabled),("),n,")","{#metromodernizr{top:9px;position:absolute}}"].join(""),function(e){return e.offsetTop===9})};this.canTransform=!!f(["transformProperty","WebkitTransform","MozTransform","OTransform","msTransform"]);this.canTransition=l("transitionProperty");this.canTransform3d=c();this.canAnimate=l("animationName");this.canTouch=p();window.MetroModernizr.canTransform=this.canTransform;window.MetroModernizr.canTransition=this.canTransition;window.MetroModernizr.canTransform3d=this.canTransform3d;window.MetroModernizr.canAnimate=this.canAnimate;window.MetroModernizr.canTouch=this.canTouch;r=null;i=null;s=null;o=null}}else{this.canTransform=e("html").hasClass("csstransforms");this.canTransition=e("html").hasClass("csstransitions");this.canTransform3d=e("html").hasClass("csstransforms3d");this.canAnimate=e("html").hasClass("cssanimations");this.canTouch=e("html").hasClass("touch")||typeof window.navigator.msMaxTouchPoints!=="undefined"&&window.navigator.msMaxTouchPoints>0}}this.canFlip3d=this.canFlip3d&&this.canAnimate&&this.canTransform&&this.canTransform3d}})(jQuery)