MSV FM

dot.antimicrobial@66.96.161.157: ~ $
Path : /hermes/bosweb01/b1720/bunkiekit.ca/phboost/c/js/
File Upload :
Current < : /hermes/bosweb01/b1720/bunkiekit.ca/phboost/c/js/jquery_002.js

/*
 * jQuery FlexSlider v2.1
 * http://www.woothemes.com/flexslider/
 *
 * Copyright 2012 WooThemes
 * Free to use under the GPLv2 license.
 * http://www.gnu.org/licenses/gpl-2.0.html
 *
 * Contributing author: Tyler Smith (@mbmufffin)
 *
 * Modified by Emerald
 */

(function(d){d.flexslider=function(h,n){var a=d(h),c=d.extend({},d.flexslider.defaults,n),e=c.namespace,r="ontouchstart"in window||window.DocumentTouch&&document instanceof DocumentTouch,t=r?"touchend":"click",m="vertical"===c.direction,q=c.reverse,k=0<c.itemWidth,u="fade"===c.animation,v=""!==c.asNavFor,f={};d.data(h,"flexslider",a);f={init:function(){a.animating=!1;a.currentSlide=c.startAt;a.animatingTo=a.currentSlide;a.atEnd=0===a.currentSlide||a.currentSlide===a.last;a.containerSelector=c.selector.substr(0, c.selector.search(" "));a.slides=d(c.selector,a);a.container=d(a.containerSelector,a);a.count=a.slides.length;a.syncExists=0<d(c.sync).length;"slide"===c.animation&&(c.animation="swing");a.prop=m?"top":"marginLeft";a.args={};a.manualPause=!1;a.pauseOnAction=c.pauseOnAction;a.transitions=!c.video&&!u&&c.useCSS&&function(){var b=document.createElement("div"),c=["perspectiveProperty","WebkitPerspective","MozPerspective","OPerspective","msPerspective"],d;for(d in c)if(void 0!==b.style[c[d]])return a.pfx= c[d].replace("Perspective","").toLowerCase(),a.prop="-"+a.pfx+"-transform",!0;return!1}();""!==c.controlsContainer&&(a.controlsContainer=0<d(c.controlsContainer).length&&d(c.controlsContainer));""!==c.manualControls&&(a.manualControls=0<d(c.manualControls).length&&d(c.manualControls));c.randomize&&(a.slides.sort(function(){return Math.round(Math.random())-0.5}),a.container.empty().append(a.slides));a.doMath();v&&f.asNav.setup();a.setup("init");c.controlNav&&f.controlNav.setup();c.directionNav&&f.directionNav.setup(); c.keyboard&&(1===d(a.containerSelector).length||c.multipleKeyboard)&&d(document).bind("keyup",function(b){b=b.keyCode;a.animating||39!==b&&37!==b||(b=39===b?a.getTarget("next"):37===b?a.getTarget("prev"):!1,a.flexAnimate(b,c.pauseOnAction))});c.mousewheel&&a.bind("mousewheel",function(b,g,d,e){b.preventDefault();b=0>g?a.getTarget("next"):a.getTarget("prev");a.flexAnimate(b,c.pauseOnAction)});c.pausePlay&&f.pausePlay.setup();c.slideshow&&(c.pauseOnHover&&(a.is("#home-slider")?r||d("#home-header").hover(function(){a.manualPlay|| a.manualPause||a.pause()},function(){a.manualPause||a.manualPlay||a.play()}):a.hover(function(){a.manualPlay||a.manualPause||a.pause()},function(){a.manualPause||a.manualPlay||a.play()})),0<c.initDelay?setTimeout(a.play,c.initDelay):a.play());r&&c.touch&&f.touch();(!u||u&&c.smoothHeight)&&d(window).bind("resize focus",f.resize);setTimeout(function(){c.start(a)},200)},asNav:{setup:function(){a.asNav=!0;a.animatingTo=Math.floor(a.currentSlide/a.move);a.currentItem=a.currentSlide;a.slides.removeClass(e+ "active-slide").eq(a.currentItem).addClass(e+"active-slide");a.slides.click(function(b){b.preventDefault();b=d(this);var g=b.index();d(c.asNavFor).data("flexslider").animating||b.hasClass("active")||(a.direction=a.currentItem<g?"next":"prev",a.flexAnimate(g,c.pauseOnAction,!1,!0,!0))})}},controlNav:{setup:function(){a.manualControls?f.controlNav.setupManual():f.controlNav.setupPaging()},setupPaging:function(){var b=1,g;a.controlNavScaffold=d('<ol class="'+e+"control-nav "+e+("thumbnails"===c.controlNav? "control-thumbs":"control-paging")+'"></ol>');if(1<a.pagingCount)for(var s=0;s<a.pagingCount;s++)g="thumbnails"===c.controlNav?'<img src="'+a.slides.eq(s).attr("data-thumb")+'"/>':"<a><span>"+b+"</span></a>",a.controlNavScaffold.append("<li>"+g+"</li>"),b++;a.controlsContainer?d(a.controlsContainer).append(a.controlNavScaffold):a.append(a.controlNavScaffold);f.controlNav.set();f.controlNav.active();a.controlNavScaffold.delegate("a, img",t,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))});r&&a.controlNavScaffold.delegate("a","click touchstart",function(a){a.preventDefault()})},setupManual:function(){a.controlNav=a.manualControls;f.controlNav.active();a.controlNav.live(t,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))});r&&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.pagingCount&&"add"===b?a.controlNavScaffold.append(d("<li><a>"+a.count+"</a></li>")):1===a.pagingCount?a.controlNavScaffold.find("li").remove():a.controlNav.eq(c).closest("li").remove();f.controlNav.set();1<a.pagingCount&& a.pagingCount!==a.controlNav.length?a.update(c,b):f.controlNav.active()}},directionNav:{setup:function(){var b=d('<ul class="'+e+'direction-nav"><li><a class="'+e+'prev" href="#">'+c.prevText+'</a></li><li><a class="'+e+'next" href="#">'+c.nextText+"</a></li></ul>");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(t,function(b){b.preventDefault(); b=d(this).hasClass(e+"next")?a.getTarget("next"):a.getTarget("prev");a.flexAnimate(b,c.pauseOnAction)});r&&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('<div class="'+e+'pauseplay"><a></a></div>');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(t,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())});r&&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){l=m?e-b.touches[0].pageY:e-b.touches[0].pageX;n=m?Math.abs(l)<Math.abs(b.touches[0].pageX-f):Math.abs(l)<Math.abs(b.touches[0].pageY-f);if(!n||500<Number(new Date)-t)b.preventDefault(),!u&&a.transitions&&(c.animationLoop||(l/=0===a.currentSlide&&0>l||a.currentSlide===a.last&&0<l?Math.abs(l)/p+2: 1),a.setProps(r+l,"setTouch"))}function d(m){h.removeEventListener("touchmove",b,!1);if(a.animatingTo===a.currentSlide&&!n&&null!==l){m=q?-l:l;var k=0<m?a.getTarget("next"):a.getTarget("prev");a.canAdvance(k)&&(550>Number(new Date)-t&&50<Math.abs(m)||Math.abs(m)>p/2)?a.flexAnimate(k,c.pauseOnAction):u||a.flexAnimate(a.currentSlide,c.pauseOnAction,!0)}h.removeEventListener("touchend",d,!1);r=l=f=e=null}var e,f,r,p,l,t,n=!1;h.addEventListener("touchstart",function(l){a.animating?l.preventDefault(): 1===l.touches.length&&(p=m?a.h:a.w,t=Number(new Date),r=k&&q&&a.animatingTo===a.last?0:k&&q?a.limit-(a.itemW+c.itemMargin)*a.move*a.animatingTo:k&&a.currentSlide===a.last?a.limit:k?(a.itemW+c.itemMargin)*a.move*a.currentSlide:q?(a.last-a.currentSlide+a.cloneOffset)*p:(a.currentSlide+a.cloneOffset)*p,e=m?l.touches[0].pageY:l.touches[0].pageX,f=m?l.touches[0].pageX:l.touches[0].pageY,h.addEventListener("touchmove",b,!1),h.addEventListener("touchend",d,!1))},!1)},resize:function(){!a.animating&&a.is(":visible")&& (k||a.doMath(),u?f.smoothHeight():k?(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||u){var c=u?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,s,h,t){v&&1===a.pagingCount&&(a.direction=a.currentItem<b?"next":"prev");if(!a.animating&&(a.canAdvance(b,t)||s)&&a.is(":visible")){if(v&&h)if(s=d(c.asNavFor).data("flexslider"),a.atEnd=0===b||b===a.count-1,s.flexAnimate(b,!0,!1,!0,t),a.direction=a.currentItem<b?"next":"prev",s.direction=a.direction,Math.ceil((b+1)/a.visible)-1!==a.currentSlide&&0!==b)a.currentItem=b,a.slides.removeClass(e+ "active-slide").eq(b).addClass(e+"active-slide"),b=Math.floor(b/a.visible);else return a.currentItem=b,a.slides.removeClass(e+"active-slide").eq(b).addClass(e+"active-slide"),!1;a.animating=!0;a.animatingTo=b;c.before(a);g&&a.pause();!c.slideshow||c.pauseOnAction||c.pauseOnHover&&!r||(clearInterval(a.animatedSlides),a.animatedSlides=setInterval(a.animateSlides,c.slideshowSpeed));parseInt(((new Date).getTime()-13890285E5)/1E3);a.syncExists&&!t&&f.sync("animate");c.controlNav&&f.controlNav.active(); k||a.slides.removeClass(e+"active-slide").eq(b).addClass(e+"active-slide");a.atEnd=0===b||b===a.last;c.directionNav&&f.directionNav.update();b===a.last&&(c.end(a),c.animationLoop||a.pause());if(u)r?(a.slides.eq(a.currentSlide).css({opacity:0,zIndex:1}),a.slides.eq(b).css({opacity:1,zIndex:2}),a.slides.unbind("webkitTransitionEnd transitionend"),a.slides.eq(a.currentSlide).bind("webkitTransitionEnd transitionend",function(){c.after(a)}),a.animating=!1,a.currentSlide=a.animatingTo):(d("html").hasClass("ie8")&& a.slides.eq(a.currentSlide).children(".flex-caption").hide(),a.slides.eq(a.currentSlide).fadeOut(c.animationSpeed,c.easing,function(){d("html").hasClass("ie8")&&d(".flex-caption",this).show()}),a.slides.eq(b).fadeIn(c.animationSpeed,c.easing,a.wrapup));else{var p=m?a.slides.filter(":first").height():a.computedW;k?(b=c.itemWidth>a.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? q?(a.count+a.cloneOffset)*p:0:a.currentSlide===a.last&&0===b&&c.animationLoop&&"prev"!==a.direction?q?0:(a.count+1)*p:q?(a.count-1-b+a.cloneOffset)*p:(b+a.cloneOffset)*p;a.setProps(b,"",c.animationSpeed);a.transitions?(c.animationLoop&&a.atEnd||(a.animating=!1,a.currentSlide=a.animatingTo),a.container.unbind("webkitTransitionEnd transitionend"),a.container.bind("webkitTransitionEnd transitionend",function(){a.wrapup(p)})):a.container.animate(a.args,c.animationSpeed,c.easing,function(){a.wrapup(p)})}c.smoothHeight&& f.smoothHeight(c.animationSpeed)}};a.wrapup=function(b){u||k||(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,d){var e=v?a.pagingCount-1:a.last;return d?!0:v&&a.currentItem===a.count-1&&0===b&&"prev"===a.direction?!0:v&&0===a.currentItem&&b===a.pagingCount-1&&"next"!==a.direction?!1:b!==a.currentSlide||v?c.animationLoop?!0:a.atEnd&&0===a.currentSlide&&b===e&&"next"!==a.direction?!1:a.atEnd&&a.currentSlide===e&&0===b&&"next"=== a.direction?!1:!0:!1};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,d,e){var f=function(){var e=b?b:(a.itemW+c.itemMargin)*a.move*a.animatingTo;return-1*function(){if(k)return"setTouch"===d?b:q&&a.animatingTo===a.last?0:q?a.limit-(a.itemW+c.itemMargin)*a.move*a.animatingTo:a.animatingTo===a.last?a.limit:e;switch(d){case "setTotal":return q?(a.count-1-a.currentSlide+a.cloneOffset)* b:(a.currentSlide+a.cloneOffset)*b;case "setTouch":return b;case "jumpEnd":return q?b:a.count*b;case "jumpStart":return q?a.count*b:b;default:return b}}()+"px"}();a.transitions&&(f=m?"translate3d(0,"+f+",0)":"translate3d("+f+",0,0)",e=void 0!==e?e/1E3+"s":"0s",a.container.css("-"+a.pfx+"-transition-duration",e));a.args[a.prop]=f;(a.transitions||void 0===e)&&a.container.css(a.args)};a.setup=function(b){if(u)a.slides.css({width:"100%","float":"left",marginRight:"-100%",position:"relative"}),"init"=== b&&(r?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,s;"init"===b&&(a.viewport=d('<div class="'+e+'viewport"></div>').css({overflow:"hidden",position:"relative"}).appendTo(a).append(a.container),a.cloneCount=0,a.cloneOffset=0,q&&(s=d.makeArray(a.slides).reverse(),a.slides=d(s),a.container.empty().append(a.slides))); c.animationLoop&&!k&&(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=q?a.count-1-a.currentSlide+a.cloneOffset:a.currentSlide+a.cloneOffset;m&&!k?(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))}k||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();k?(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.maxW<a.w?(a.w-d*f)/f:c.itemWidth>a.w?a.w:c.itemWidth,a.visible=Math.floor(a.w/(a.itemW+d)),a.move=0<c.move&&c.move<a.visible?c.move:a.visible,a.pagingCount=Math.ceil((a.count-a.visible)/a.move+1),a.last=a.pagingCount-1,a.limit=1===a.pagingCount?0:c.itemWidth>a.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();k||(b<a.currentSlide?a.currentSlide+=1:b<=a.currentSlide&&0!==b&&(a.currentSlide-=1),a.animatingTo=a.currentSlide);if(c.controlNav&&!a.manualControls)if("add"===d&&!k||a.pagingCount>a.controlNav.length)f.controlNav.update("add");else if("remove"===d&&!k||a.pagingCount<a.controlNav.length)k&&a.currentSlide>a.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&&q?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&&q?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:!0,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(h){void 0===h&&(h={});if("object"===typeof h)return this.each(function(){var a=d(this),c=a.find(h.selector?h.selector:".slides > li");a.is("#home-slider")&&!a.is("#home-hero-content.full-width-image #home-slider")||c.each(function(a){c.eq(a).find(".flex-caption").each(function(){var a= d(this),c=a.attr("data-bg-color"),e=a.attr("data-bg-opacity"),h=a.attr("data-border-color"),k=a.attr("data-left"),n=a.attr("data-right"),v=a.attr("data-top"),f=a.attr("data-bottom"),b=a.attr("data-x-centered"),g=a.attr("data-y-centered"),s=a.attr("data-width"),x=a.attr("data-height"),w;if(c||e){c||(c="ffffff");e||(e=0.7);w=e;for(var p=c.replace("#","").match(/(.{2})/g),l=3;l--;)p[l]=parseInt(p[l],16);w="undefined"==typeof w?"rgb("+p.join(", ")+")":"rgba("+p.join(", ")+", "+w+")";d("html").hasClass("ie8")? (e=Math.round(255*e).toString(16),a.css({"background-color":c,background:"transparent",filter:"progid:DXImageTransform.Microsoft.gradient(startColorstr=#"+e+c+",endColorstr=#"+e+c+")"})):a.css({background:w})}h&&(h=h.replace("#",""),a.css({"border-left":"4px solid #"+h}));"undefined"!=typeof k&&a.css({left:k,right:"auto"});"undefined"!=typeof n&&a.css({left:"auto",right:n});"undefined"!=typeof v&&a.css({top:v,bottom:"auto"});"undefined"!=typeof f&&a.css({top:"auto",bottom:f});s&&a.css({width:s}); x&&a.css({height:x});"yes"==b&&a.css({left:"0",right:"0","margin-left":"auto","margin-right":"auto"});"yes"==g&&a.css({top:"50%",bottom:"auto","margin-top":-parseInt(a.outerHeight()/2)})})});1===c.length?(c.fadeIn(400),h.start&&h.start(a)):void 0==a.data("flexslider")&&new d.flexslider(this,h)});var n=d(this).data("flexslider");switch(h){case "play":n.play();break;case "pause":n.pause();break;case "next":n.flexAnimate(n.getTarget("next"),!0);break;case "prev":case "previous":n.flexAnimate(n.getTarget("prev"), !0);break;default:"number"===typeof h&&n.flexAnimate(h,n.pauseOnAction)}}})(jQuery);


/* ---------------------------------------------------------------------- */
/*	Additional code for FlexSlider
/* ---------------------------------------------------------------------- */

jQuery(document).ready(function() {
	
	// Default FlexSlider parameters
	if (typeof fs_params == 'undefined') {
		fs_params = {animation: 'fade', controlNav: true, directionNav: true, slideshow: false, pauseOnAction: true, pauseOnHover: false, animationSpeed: 600, slideshowSpeed: 7000};
	}
	
	// Homepage FlexSlider parameters
	if (typeof fs_params_homepage == 'undefined') {
		fs_params_homepage = {animation: 'fade', controlNav: false, directionNav: true, slideshow: true, pauseOnAction: false, pauseOnHover: true, animationSpeed: 600, slideshowSpeed: 7000};
	}
	
	// Note: fs_params / fs_params_homepage can be overwritten by setting its value in an html file
	
	
	// *** FLEXSLIDER INITIALIZATION
	$('.flexslider').each(function() {
		var $this = $(this);
		
		if ($this.is('#home-slider')) {
			
			// Callback function: fires asynchronously with each slider animation
			fs_params_homepage.before = function(slider){
				var next_index = slider.animatingTo + 1,
					current_index = slider.currentSlide + 1,
					$next_caption = $('.slider-caption div[id=caption'+next_index+']'),
					$current_caption = $('.slider-caption div[id=caption'+current_index+']');
				
				$('.slider-menu li').removeClass('active').siblings().find('a')
						.filter(function () {
							return $(this).attr('href') == '#slide'+next_index;
						}).parent().addClass('active');
				
				if ($('html').hasClass('ie8')) { // IE8 hack
					$current_caption.hide();
				}
				$current_caption.fadeOut(400, 'swing', function() {
					if ($('html').hasClass('ie8')) { // IE8 hack
						$next_caption.show();
					} else {
						$next_caption.fadeIn(300, 'swing');
					}
					setCaptionHeight($next_caption);
				});
			};
			
			// Callback function: fires after each slider animation completes
			fs_params_homepage.after = function(slider){
				
			};
			
			// Init homepage slider:
			
			// full-width slider with center-aligned image
			if ($this.parent().parent().parent().parent().hasClass('full-width-image')) {
				if ($this.attr('data-slideshow') == 'yes') { fs_params_homepage.slideshow = true; }
				if ($this.attr('data-slideshow') == 'no') { fs_params_homepage.slideshow = false; }
				if ($this.attr('data-animation') == 'fade') { fs_params_homepage.animation = 'fade'; }
				if ($this.attr('data-animation') == 'slide') { fs_params_homepage.animation = 'slide'; }
				if ($this.attr('data-control-nav') == 'yes') { fs_params_homepage.controlNav = true; }
				if ($this.attr('data-control-nav') == 'no') { fs_params_homepage.controlNav = false; }
				if ($this.attr('data-direction-nav') == 'yes') { fs_params_homepage.directionNav = true; }
				if ($this.attr('data-direction-nav') == 'no') { fs_params_homepage.directionNav = false; }
				if ($this.attr('data-pause-on-action') == 'yes') { fs_params_homepage.pauseOnAction = true; }
				if ($this.attr('data-pause-on-action') == 'no') { fs_params_homepage.pauseOnAction = false; }
			}
			
			// slider with right-aligned image
			else {
				fs_params_homepage.animation = 'fade';
			}
			
			if ($this.attr('data-slideshow-speed') > 0) { fs_params_homepage.slideshowSpeed = $this.attr('data-slideshow-speed'); }
			$this.flexslider(fs_params_homepage);
		}
		
		else {
			// Init default slider
			var params = $.extend({}, fs_params);
			if ($this.attr('data-slideshow') == 'yes') { params.slideshow = true; }
			if ($this.attr('data-slideshow') == 'no') { params.slideshow = false; }
			if ($this.attr('data-slideshow-speed') > 0) { params.slideshowSpeed = $this.attr('data-slideshow-speed'); }
			if ($this.attr('data-animation') == 'fade') { params.animation = 'fade'; }
			if ($this.attr('data-animation') == 'slide') { params.animation = 'slide'; }
			if ($this.attr('data-control-nav') == 'yes') { params.controlNav = true; }
			if ($this.attr('data-control-nav') == 'no') { params.controlNav = false; }
			if ($this.attr('data-direction-nav') == 'yes') { params.directionNav = true; }
			if ($this.attr('data-direction-nav') == 'no') { params.directionNav = false; }
			if ($this.attr('data-pause-on-action') == 'yes') { params.pauseOnAction = true; }
			if ($this.attr('data-pause-on-action') == 'no') { params.pauseOnAction = false; }
			$this.flexslider(params);
		}
		
	});
	
	
	// *** HOMEPAGE SLIDER
	$homeSlider = $('#home-slider').data('flexslider');
	
	// Slider menu
	$('.slider-menu li').on('click', function(e) {
		e.preventDefault();
		var slide_index = $('a', this).attr('href').substr(6) - 1;
		$homeSlider.flexslider(slide_index);
		return false; // IE9 hack
	});
	
	// Position the right side navigation ("right-side-nav" class)
	function positionRightSideNav() {
		if ($(window).width() >= 768) {
			var homeHero_x = 0.5 * ($(window).width() - $('#home-hero').width()),
				heroImage_marginLeft = parseInt($('#home-hero .hero-image').css('margin-left')),
				col_marginLeft = parseInt($('#home-hero-content .columns').css('margin-left')),
				rightSideNav_width = $('#home-slider.right-side-nav .flex-direction-nav a').width(),
				navLeft = $(window).width() - (homeHero_x + col_marginLeft + heroImage_marginLeft) - rightSideNav_width;
			$('#home-slider.right-side-nav .flex-direction-nav a').css('left', navLeft + 'px');
		} else {
			$('#home-slider.right-side-nav .flex-direction-nav a').css('left', '');
		}
	}
	positionRightSideNav();
	
	// Slider caption initial appearance
	if ($('html').hasClass('ie8')) { // IE8 hack
		$('.slider-caption > div:first-child').show();
	} else {
		$('.slider-caption > div:first-child').fadeIn(fs_params_homepage.animationSpeed, 'swing');
	}
	
	// Position the slider caption (if placed inside the "intro" section)
	function positionCaption() {
		if ($(window).width() >= 960) {
			var captionTop = $('.intro-content').height() + 30;
			$('.intro-content .slider-caption').css('top', captionTop + 'px');
		} else {
			$('.intro-content .slider-caption').css('top', '');
		}
	}
	positionCaption();
	
	// Set the height for a caption block (for small-screen mobile devices)
	function setCaptionHeight($cap) {
		if ($(window).width() < 768) {
			var captionHeight = $cap.height() + 15;
			$('.slider-caption').css('height', captionHeight + 'px');
		} else {
			$('.slider-caption').css('height', '');
		}
	}
	setCaptionHeight($('.slider-caption > div:first-child'));
	
	// Window resize event
	$(window).on('resize', function() {
		positionRightSideNav();
		setCaptionHeight($('.slider-caption > div')
			.filter(function () {
				return $(this).css('display') == 'block';
			})
		);
		positionCaption();
	});
	
	// Individual styling for slider caption
	var hex2rgb = function(hex, opacity) {
		var rgb = hex.replace('#', '').match(/(.{2})/g); 
		var i = 3;
		while (i--) {
			rgb[i] = parseInt(rgb[i], 16);
		} 
		if (typeof opacity == 'undefined') {
			return 'rgb(' + rgb.join(', ') + ')';
		} 
		return 'rgba(' + rgb.join(', ') + ', ' + opacity + ')';
	};
	
	$('.slider-caption > div').each(function() {
		var $caption = $(this),
			bgColor = $caption.attr('data-bg-color'),
			bgOpacity = $caption.attr('data-bg-opacity'),
			width = $caption.attr('data-width'),
			align = $caption.attr('data-align'),
			bgRGBA;
		
		// background color and background opacity
		if (bgColor || bgOpacity) {
			if (!bgColor) { bgColor = '000000'; }
			else { bgColor = bgColor.replace('#', ''); }
			if (!bgOpacity) { bgOpacity = 0.5; }
			bgRGBA = hex2rgb(bgColor, bgOpacity);
			if ($('html').hasClass('ie8')) { // IE8 hack
				var hexBgOpacity = Math.round(255*bgOpacity).toString(16);
				$caption.css({'background-color': bgColor, 'background': 'transparent',
						'filter': 'progid:DXImageTransform.Microsoft.gradient(startColorstr=#' + hexBgOpacity + bgColor + ',endColorstr=#' + hexBgOpacity + bgColor + ')'});
			} else {
				$caption.css({'background': bgRGBA});
			}				
		}
		
		// caption width
		function adjustCaptionWidth() {
			if (width) {
				if ($(window).width() >= 768) {
					width = parseInt(width);
					var maxWidth = parseInt($caption.parent().css('max-width')) - parseInt($caption.css('padding-left')) - parseInt($caption.css('padding-right'));
					if (width >= maxWidth) {
						$caption.css({'width': maxWidth + 'px'});
					} else {
						$caption.css({'width': width + 'px'});
					}
				} else {
					$caption.css('width', '');
				}
			}
		}
		adjustCaptionWidth();
		
		$(window).on('resize', function() {
			adjustCaptionWidth();
		});
		
		// caption horizontal alignment
		if (align == 'right') {
			$caption.css({'left': 'auto', 'right': '0'});
		} else if (align == 'center') {
			$caption.css({'left': '0', 'right': '0', 'margin-left': 'auto', 'margin-right': 'auto'});
		}
		
	});
	
});