PageSourceSearch

https://medicalkidnap.com/wp-content/themes/medicalkidnap-child/js/main.js

js medicalkidnap.com collected 2026-10-03 21:06:08 UTC 369,395 bytes, 9,998 lines download raw bytes

1/**
2 * jQuery Equal Heights
3 */
4(function($) {
5	$.fn.equalHeights = function(minHeight, maxHeight) {
6		tallest = (minHeight) ? minHeight : 0;
7		this.each(function() {
8			$(this).css('height', 'auto');
9			if($(this).outerHeight() > tallest) {
10				tallest = $(this).outerHeight();
11			}
12		});
13		if((maxHeight) && tallest > maxHeight) {
14			tallest = maxHeight;
15		}
16		return this.each(function() {
17			$(this).css( 'min-height', tallest ).css("overflow","auto");
18		});
19	};
20})(jQuery);
21
22/* jQuery CounTo */
23
24(function(a){a.fn.countTo=function(g){g=g||{};return a(this).each(function(){function e(a){a=b.formatter.call(h,a,b);f.html(a)}var b=a.extend({},a.fn.countTo.defaults,{from:a(this).data("from"),to:a(this).data("to"),speed:a(this).data("speed"),refreshInterval:a(this).data("refresh-interval"),decimals:a(this).data("decimals")},g),j=Math.ceil(b.speed/b.refreshInterval),l=(b.to-b.from)/j,h=this,f=a(this),k=0,c=b.from,d=f.data("countTo")||{};f.data("countTo",d);d.interval&&clearInterval(d.interval);d.interval=
25setInterval(function(){c+=l;k++;e(Math.abs(c));"function"==typeof b.onUpdate&&b.onUpdate.call(h,c);k>=j&&(f.removeData("countTo"),clearInterval(d.interval),c=b.to,"function"==typeof b.onComplete&&b.onComplete.call(h,c))},b.refreshInterval);e(c)})};a.fn.countTo.defaults={from:0,to:0,speed:1E3,refreshInterval:100,decimals:0,formatter:function(a,e){return a.toFixed(e.decimals)},onUpdate:null,onComplete:null}})(jQuery);
26
27/*
28* hoverFlow - A Solution to Animation Queue Buildup in jQuery
29* Version 1.00
30*
31* Copyright (c) 2009 Ralf Stoltze, http://www.2meter3.de/code/hoverFlow/
32* Dual-licensed under the MIT and GPL licenses.
33* http://www.opensource.org/licenses/mit-license.php
34* http://www.gnu.org/licenses/gpl.html
35*/
36(function($){$.fn.hoverFlow=function(c,d,e,f,g){if($.inArray(c,['mouseover','mouseenter','mouseout','mouseleave'])==-1){return this}var h=typeof e==='object'?e:{complete:g||!g&&f||$.isFunction(e)&&e,duration:e,easing:g&&f||f&&!$.isFunction(f)&&f};h.queue=false;var i=h.complete;h.complete=function(){$(this).dequeue();if($.isFunction(i)){i.call(this)}};return this.each(function(){var b=$(this);if(c=='mouseover'||c=='mouseenter'){b.data('jQuery.hoverFlow',true)}else{b.removeData('jQuery.hoverFlow')}b.queue(function(){var a=(c=='mouseover'||c=='mouseenter')?b.data('jQuery.hoverFlow')!==undefined:b.data('jQuery.hoverFlow')===undefined;if(a){b.animate(d,h)}else{b.queue([])}})})}})(jQuery);
37
38/**
39 * User agent
40 * http://cssuseragent.org/
41 */
42var cssua=function(n,l,p){var q=/\s*([\-\w ]+)[\s\/\:]([\d_]+\b(?:[\-\._\/]\w+)*)/,r=/([\w\-\.]+[\s\/][v]?[\d_]+\b(?:[\-\._\/]\w+)*)/g,s=/\b(?:(blackberry\w*|bb10)|(rim tablet os))(?:\/(\d+\.\d+(?:\.\w+)*))?/,t=/\bsilk-accelerated=true\b/,u=/\bfluidapp\b/,v=/(\bwindows\b|\bmacintosh\b|\blinux\b|\bunix\b)/,w=/(\bandroid\b|\bipad\b|\bipod\b|\bwindows phone\b|\bwpdesktop\b|\bxblwp7\b|\bzunewp7\b|\bwindows ce\b|\bblackberry\w*|\bbb10\b|\brim tablet os\b|\bmeego|\bwebos\b|\bpalm|\bsymbian|\bj2me\b|\bdocomo\b|\bpda\b|\bchtml\b|\bmidp\b|\bcldc\b|\w*?mobile\w*?|\w*?phone\w*?)/,
43x=/(\bxbox\b|\bplaystation\b|\bnintendo\s+\w+)/,k={parse:function(b,d){var a={};d&&(a.standalone=d);b=(""+b).toLowerCase();if(!b)return a;for(var c,e,g=b.split(/[()]/),f=0,k=g.length;f<k;f++)if(f%2){var m=g[f].split(";");c=0;for(e=m.length;c<e;c++)if(q.exec(m[c])){var h=RegExp.$1.split(" ").join("_"),l=RegExp.$2;if(!a[h]||parseFloat(a[h])<parseFloat(l))a[h]=l}}else if(m=g[f].match(r))for(c=0,e=m.length;c<e;c++)h=m[c].split(/[\/\s]+/),h.length&&"mozilla"!==h[0]&&(a[h[0].split(" ").join("_")]=h.slice(1).join("-"));
44w.exec(b)?(a.mobile=RegExp.$1,s.exec(b)&&(delete a[a.mobile],a.blackberry=a.version||RegExp.$3||RegExp.$2||RegExp.$1,RegExp.$1?a.mobile="blackberry":"0.0.1"===a.version&&(a.blackberry="7.1.0.0"))):v.exec(b)?a.desktop=RegExp.$1:x.exec(b)&&(a.game=RegExp.$1,c=a.game.split(" ").join("_"),a.version&&!a[c]&&(a[c]=a.version));a.intel_mac_os_x?(a.mac_os_x=a.intel_mac_os_x.split("_").join("."),delete a.intel_mac_os_x):a.cpu_iphone_os?(a.ios=a.cpu_iphone_os.split("_").join("."),delete a.cpu_iphone_os):a.cpu_os?
45(a.ios=a.cpu_os.split("_").join("."),delete a.cpu_os):"iphone"!==a.mobile||a.ios||(a.ios="1");a.opera&&a.version?(a.opera=a.version,delete a.blackberry):t.exec(b)?a.silk_accelerated=!0:u.exec(b)&&(a.fluidapp=a.version);if(a.applewebkit)a.webkit=a.applewebkit,delete a.applewebkit,a.opr&&(a.opera=a.opr,delete a.opr,delete a.chrome),a.safari&&(a.chrome||a.crios||a.opera||a.silk||a.fluidapp||a.phantomjs||a.mobile&&!
45a.ios?delete a.safari:a.safari=a.version&&!a.rim_tablet_os?a.version:{419:"2.0.4",417:"2.0.3",
46416:"2.0.2",412:"2.0",312:"1.3",125:"1.2",85:"1.0"}[parseInt(a.safari,10)]||a.safari);else if(a.msie||a.trident)if(a.opera||(a.ie=a.msie||a.rv),delete a.msie,a.windows_phone_os)a.windows_phone=a.windows_phone_os,delete a.windows_phone_os;else{if("wpdesktop"===a.mobile||"xblwp7"===a.mobile||"zunewp7"===a.mobile)a.mobile="windows desktop",a.windows_phone=9>+a.ie?"7.0":10>+a.ie?"7.5":"8.0",delete a.windows_nt}else if(a.gecko||a.firefox)a.gecko=a.rv;a.rv&&delete a.rv;a.version&&delete a.version;return a},
47format:function(b){var d="",a;for(a in b)if(a&&b.hasOwnProperty(a)){var c=a,e=b[a],c=c.split(".").join("-"),g=" ua-"+c;if("string"===typeof e){for(var e=e.split(" ").join("_").split(".").join("-"),f=e.indexOf("-");0<f;)g+=" ua-"+c+"-"+e.substring(0,f),f=e.indexOf("-",f+1);g+=" ua-"+c+"-"+e}d+=g}return d},encode:function(b){var d="",a;for(a in b)a&&b.hasOwnProperty(a)&&(d&&(d+="\x26"),d+=encodeURIComponent(a)+"\x3d"+encodeURIComponent(b[a]));return d}};k.userAgent=k.ua=k.parse(l,p);l=k.format(k.ua)+
48" js";n.className=n.className?n.className.replace(/\bno-js\b/g,"")+l:l.substr(1);return k}(document.documentElement,navigator.userAgent,navigator.standalone);
49
50
51var generateCarousel = function() {
52	if(jQuery().carouFredSel) {
53		jQuery('.es-carousel-wrapper').not('.fusion-woo-featured-products-slider').each(function() {
54			jQuery(this).find('ul').carouFredSel({
55				auto: false,
56				prev: jQuery(this).find('.es-nav-prev'),
57				next: jQuery(this).find('.es-nav-next'),
58				width: '100%',
59				height: 'variable',
60				align: 'center',
61				onCreate: function(data) {
62					jQuery( this ).find( '.image' ).css('visibility', 'visible');
63				}
64			});
65		});
66
67		jQuery('.fusion-woo-featured-products-slider').each(function() {
68			var carousel = jQuery(this).find('ul');
69			carousel.carouFredSel({
70				auto: false,
71				prev: jQuery(this).find('.es-nav-prev'),
72				next: jQuery(this).find('.es-nav-next'),
73				align: 'left',
74				left: 0,
75				width: '100%',
76				height: 'variable',
77				responsive: true,
78				scroll: {
79					items: 1
80				},
81				items: {
82					width: 500,
83					height: 'variable',
84					visible: {
85						min: 1,
86						max: 30
87					}
88				},
89				onCreate: function(data) {
90					jQuery( this ).find( '.image' ).css('visibility', 'visible');
91					jQuery( this ).parent().css('overflow', '');
92				}
93			});
94		});
95
96		jQuery('.simple-products-slider-variable').each(function() {
97			var carousel = jQuery(this).find('ul');
98			carousel.carouFredSel({
99				auto: false,
100				prev: jQuery(this).find('.es-nav-prev'),
101				next: jQuery(this).find('.es-nav-next'),
102				width: '100%',
103				height: 'variable',
104				align: 'center'
105			});
106		});
107	}
108};
109
110var calcTabsLayout = function(tab_selector) {
111	jQuery(tab_selector).each(function() {
112		var menuWidth = jQuery(this).parent().width();
113	    var menuItems = jQuery(this).find('li').length;
114		var mod = menuWidth % menuItems;
115		var itemWidth = (menuWidth - mod)/menuItems;
116	    var lastItemWidth = menuWidth - itemWidth*(menuItems - 1);
117
118	    jQuery(this).css({'width': menuWidth +'px'});
119	    jQuery(this).find('li').css({'width': itemWidth +'px'});
120	    jQuery(this).find('li:last').css({'width': lastItemWidth +'px'}).addClass('no-border-right');
121	});
122};
123
124var fusion_reanimate_slider = function(element) {
125
126	var elements = jQuery('.tfs-slider').find('.slide-content');
127
128	jQuery(elements).each(function() {
129
130		jQuery(this).stop(true, true);
131
132		jQuery(this).css('opacity', '0');
133		jQuery(this).css('margin-top', '50px');
134
135		jQuery(this).animate({
136			'opacity': '1',
137			'margin-top': '0'
138		}, 1000 );
139	});
140};
141
142
143function onPlayerStateChange(frame, slider) {
144	return function(event) {
145        if(event.data == YT.PlayerState.PLAYING) {
146            jQuery(slider).flexslider("pause");
147        }
148        if(event.data == YT.PlayerState.PAUSED) {
149        	jQuery(slider).flexslider("play");
150        }
151        if(event.data == YT.PlayerState.BUFFERING) {
152            jQuery(slider).flexslider("pause");
153        }
154	}
155}
156function onPlayerReady(slide) {
157	return function(event) {
158		if( jQuery(slide).attr('data-mute') == 'yes' ) {
159			event.target.mute();
160		}
161	}
162}
163
164(function( jQuery ) {
165
166	"use strict";
167
168	// init sticky header
169	jQuery.fn.init_sticky_header = function() {
170
171		var sticky_mobile_menu_padding;
172
173	    var sticky_header_height = 65;
174		// var sticky_header_height = 102;
175		var sticky_top = jQuery('.sticky-header').css('top');
176		var sticky_start = sticky_top.replace('px','') - 55;
177		var logo = '.sticky-header .logo img.normal_logo';
178		var not_logo = '.sticky-header .logo img.retina_logo';
179		var orig_logo_height, orig_logo_width, logo_max_width, width_ratio, calc_width, calc_height,
180			logo_height, logo_line_height, logo_width, logo_margin_top	= 0;
181
182		var anchor_scrolling = 0;
183		jQuery('.sticky-header').css('top', sticky_start+'px');
184		jQuery('.init-sticky-header').waypoint(function(direction) {
185			if(direction === "down") {
186
187				// one page anchor page load scrolling
188				var adminbar_height = jQuery('#wpadminbar').outerHeight();
189				var anchor = window.location.hash.toString();
190
191				if( anchor.length > 1 && jQuery(anchor).length && ! anchor_scrolling ) {
192					jQuery('html, body').animate({
193						scrollTop: jQuery(anchor).offset().top - adminbar_height - 65 + 1
194					}, 350, 'easeInOutExpo');
195					anchor_scrolling = 1;
196				}
197
198				if(jQuery('#wpadminbar').length >= 1) {
199					sticky_top = jQuery('#wpadminbar').outerHeight()+"px";
200				}
201				jQuery('.sticky-header').show();
202				jQuery('.sticky-header').animate({
203					height: sticky_header_height + 3 + 'px',
204					top: sticky_top
205					}, 500 );
206				jQuery('.sticky-shadow').animate({
207					height: sticky_header_height  + 'px',
208					top: sticky_top
209				}, 500 );
210
211
212				if( jQuery('#header .retina_logo').is(':visible')) {
213					logo = '.sticky-header .logo img.retina_logo';
214					not_logo ='.sticky-header .logo img.normal_logo';
215				} else {
216					logo = '.sticky-header .logo img.normal_logo';
217					not_logo = '.sticky-header .logo img.retina_logo';
218				}
219
220				orig_logo_height = jQuery(logo).height();
221				orig_logo_width = jQuery(logo).width();
222				logo_max_width = jQuery(logo).data("max-width");
223
224				//IE8 quirks
225				if (jQuery('.no-svg').length >= 1) {
226					orig_logo_height = orig_logo_height + 4;
227					orig_logo_width = orig_logo_width + 4;
228				}
229
230				calc_width = orig_logo_width;
231				calc_height = orig_logo_height;
232				if (logo_max_width > 0) {
233					width_ratio = logo_max_width / orig_logo_width;
234					calc_width = logo_max_width;
235					calc_height = orig_logo_height * width_ratio;
236				}
237
238				if (calc_height > 55) {
239					logo_height = "55px";
240					logo_line_height = "55px";
241					logo_width =  55 / orig_logo_height * orig_logo_width;
242					logo_margin_top = "5px";
243				} else {
244					logo_height = calc_height+"px";
245					logo_line_height = calc_height+"px";
246					logo_width = calc_width;
247					logo_margin_top = (65 - calc_height) / 2;
248				}
249
250				sticky_mobile_menu_padding = logo_width+25;
251
252				jQuery('body #header-sticky.sticky-header .sticky-shadow .mobile-nav-holder').css('padding-left', sticky_mobile_menu_padding+"px");
253				logo_width = logo_width+"px";
254
255				//IE8 quirks
256				if (jQuery('.no-svg').length >= 1) {
257					jQuery(logo).animate({
258						height: logo_height,
259						'line-height': logo_line_height,
260						'max-width': logo_width,
261						'margin-top': logo_margin_top
262					}, 500 );
263					jQuery(not_logo).css('height', logo_height).css('line-height', logo_line_height).css('max-width', logo_width).css('margin-top', logo_margin_top);
264					jQuery(logo).css('display', '');
265				} else {
266					jQuery(logo).animate({
267						height: logo_height,
268						'line-height': logo_line_height,
269						width: logo_width,
270						'margin-top': logo_margin_top
271					}, 500 );
272					jQuery(not_logo).css('height', logo_height).css('line-height', logo_line_height).css('width', logo_width).css('margin-top', logo_margin_top);
273					jQuery(logo).css('display', '');
274				}
275
276				jQuery('.sticky-header #sticky-nav ul.menu > li > a').animate({
277					height: sticky_header_height + 'px',
278					'line-height': sticky_header_height + 'px'
279				}, 500 );
280
281
282				jQuery('.sticky-header').addClass('sticky');
283				jQuery('#small-nav').css('visibility', 'hidden');
284		 } else if(direction === "up") {
285				jQuery('.sticky-header').css( 'height', '' );
286				jQuery('.sticky-shadow').css( 'height', '' );
287
288				jQuery('#header .retina_logo, #header-sticky .retina_logo').css( 'height', orig_logo_height );
289				jQuery('#header .retina_logo, #header-sticky .retina_logo').css( 'width', orig_logo_width );
290				jQuery('#header-sticky .retina_logo').css( 'margin-top', '' );
291				jQuery('#header .normal_logo, #header-sticky .normal_logo').css( 'height', '' );
292				jQuery('#header .normal_logo, #header-sticky .normal_logo').css( 'width', '' );
293				jQuery('#header-sticky .retina_logo').css( 'margin-top', '' );
294
295				jQuery(logo+','+not_logo).css( 'line-height', '' );
296				jQuery(logo+','+not_logo).css( 'padding-top', '' );
297				jQuery(logo+','+not_logo).css( 'max-width', '' );
298				jQuery(logo+','+not_logo).css( 'margin-top', '' );
299
300				jQuery('.sticky-header #sticky-nav ul.menu > li > a').css( 'height', '' );
301				jQuery('.sticky-header #sticky-nav ul.menu > li > a').css( 'line-height', '' );
302
303				jQuery('.sticky-header').removeClass( 'sticky' );
304				jQuery('.sticky-header').hide();
305				jQuery('#small-nav').css('visibility', 'visible');
306
307				jQuery('.sticky-header .mobile-nav-holder #mobile-nav').css( 'display', 'none' );
308			 }
309		});
310	};
311
312	// animate counter boxes
313	jQuery.fn.fusion_box_counting = function() {
314		var count_value = jQuery( this ).data( 'value' );
315		var count_direction = jQuery( this ).data( 'direction' );
316
317		if( count_direction == 'down' ) {
318			jQuery(this).countTo( { from: count_value, to: 0, refreshInterval: 10, speed: 1000 } );
319		} else {
320			jQuery(this).countTo( { from: 0, to: count_value, refreshInterval: 10, speed: 1000 } );
321		}
322	};
323
324	// animate counter circles
325	jQuery.fn.fusion_draw_circles = function() {
326		var circle = jQuery(this);
327		var countdown = circle.children('.counter-circle').attr('data-countdown');
328		var filledcolor = circle.children('.counter-circle').attr('data-filledcolor');
329		var unfilledcolor = circle.children('.counter-circle').attr('data-unfilledcolor');
330		var scale = circle.children('.counter-circle').attr('data-scale');
331		var size = circle.children('.counter-circle').attr('data-size');
332		var speed = circle.children('.counter-circle').attr('data-speed');
333		var stroksize = circle.children('.counter-circle').attr('data-strokesize');
334
335		var percentage = circle.children('.counter-circle').attr('data-percent');
336
337		if( scale ) {
338			scale = jQuery( 'body' ).css( 'color' );
339		}
340
341		if( countdown ) {
342			circle.children('.counter-circle').attr('data-percent', 100);
343
344			circle.children('.counter-circle').easyPieChart({
345				barColor: filledcolor,
346				trackColor: unfilledcolor,
347				scaleColor: scale,
348				scaleLength: 5,
349				lineCap: 'round',
350				lineWidth: stroksize,
351				size: size,
352				rotate: 0,
353				animate: {
354					duration: speed, enabled: true
355				}
356			});
357			circle.children('.counter-circle').data('easyPieChart').enableAnimation();
358			circle.children('.counter-circle').data('easyPieChart').update(percentage);
359		} else {
360			circle.children('.counter-circle').easyPieChart({
361				barColor: filledcolor,
362				trackColor: unfilledcolor,
363				scaleColor: scale,
364				scaleLength: 5,
365				lineCap: 'round',
366				lineWidth: stroksize,
367				size: size,
368				rotate: 0,
369				animate: {
370					duration: speed, enabled: true
371				}
372			});
373		}
374	};
375
376	// set flip boxes equal front/back height
377/*
378	jQuery.fn.fusion_calc_flip_boxes_height = function() {
379		var flip_box = jQuery( this );
380		var outer_height, height, top_margin = 0;
381
382		if( flip_box.find( '.flip-box-front' ).height() > flip_box.find( '.flip-box-back' ).height() ) {
383			outer_height = flip_box.find( '.flip-box-front' ).height();
384			height = flip_box.find( '.flip-box-front' ).height();
385			top_margin = ( height - flip_box.find( '.flip-box-back-inner' ).height() ) / 2;
386
387			flip_box.find( '.flip-box-front, .flip-box-back' ).css( 'height', outer_height );
388			//flip_box.css( 'height', outer_height );
389			flip_box.find( '.flip-box-back-inner' ).css( 'margin-top', top_margin );
390		} else {
391			outer_height = flip_box.find( '.flip-box-back' ).height();
392			height = flip_box.find( '.flip-box-back' ).height();
393			top_margin = ( height - flip_box.find( '.flip-box-front-inner' ).height() ) / 2;
394
395			flip_box.find( '.flip-box-front, .flip-box-back' ).css( 'height', outer_height );
396			//flip_box.css( 'height', outer_height );
397			flip_box.find( '.flip-box-front-inner' ).css( 'margin-top', top_margin );
398		}
399	};
400	*/
401
402
403	jQuery.fn.fusion_calc_flip_boxes_height = function() {
404		var flip_box = jQuery( this );
405		var outer_height, height, top_margin = 0;
406
407
408		flip_box.find( '.flip-box-front' ).css( 'min-height', '' );
409		flip_box.find( '.flip-box-back' ).css( 'min-height', '' );
410		flip_box.find( '.flip-box-front-inner' ).css( 'margin-top', '' );
411		flip_box.find( '.flip-box-back-inner' ).css( 'margin-top', '' );
412		flip_box.css( 'min-height', '' );
413
414		setTimeout( function() {
415			if( flip_box.find( '.flip-box-front' ).outerHeight() > flip_box.find( '.flip-box-back' ).outerHeight() ) {
416				outer_height = flip_box.find( '.flip-box-front' ).outerHeight();
417				height = flip_box.find( '.flip-box-front' ).height();
418				top_margin = ( height - flip_box.find( '.flip-box-back-inner' ).outerHeight() ) / 2;
419
420				flip_box.find( '.flip-box-back' ).css( 'min-height', outer_height );
421				flip_box.css( 'min-height', outer_height );
422				flip_box.find( '.flip-box-back-inner' ).css( 'margin-top', top_margin );
423			} else {
424				outer_height = flip_box.find( '.flip-box-back' ).outerHeight();
425				height = flip_box.find( '.flip-box-back' ).height();
426				top_margin = ( height - flip_box.find( '.flip-box-front-inner' ).outerHeight() ) / 2;
427
428				flip_box.find( '.flip-box-front' ).css( 'min-height', outer_height );
429				flip_box.css( 'min-height', outer_height );
430				flip_box.find( '.flip-box-front-inner' ).css( 'margin-top', top_margin );
431			}
432		}, 100 );
433	};
434
435
436	// animate progress bar
437	jQuery.fn.fusion_draw_progress = function() {
438		var progressbar = jQuery( this );
439		if ( jQuery( 'html' ).hasClass( 'lt-ie9' ) ) {
440			progressbar.css( 'visibility', 'visible' );
441			progressbar.each( function() {
442				var percentage = progressbar.find( '.progress' ).attr("aria-valuenow");
443				progressbar.find( '.progress' ).css( 'width', '0%' );
444				progressbar.find( '.progress' ).animate( {
445					width: percentage+'%'
446				}, 'slow' );
447			} );
448		} else {
449			progressbar.find( '.progress' ).css( "width", function() {
450				return jQuery( this ).attr( "aria-valuenow" ) + "%";
451			});
452		}
453	};
454
455	// position mega menu correctly
456	jQuery.fn.fusion_position_megamenu = function( variables ) {
457
458		var reference_elem = '';
459		if( jQuery( '.header-v4' ).length ) {
460			reference_elem = jQuery( this ).parent('nav').parent();
461		} else {
462			reference_elem = jQuery( this ).parent('nav');
463		}
464
465		if(jQuery( this ).parent('nav').length) {
466
467			var main_nav_container = reference_elem,
468				main_nav_container_position = main_nav_container.offset(),
469				main_nav_container_width = main_nav_container.width(),
470				main_nav_container_left_edge = main_nav_container_position.left,
471				main_nav_container_right_edge = main_nav_container_left_edge + main_nav_container_width;
472
473			if( ! jQuery( '.rtl' ).length ) {
474				return this.each( function() {
475
476					jQuery( this ).children( 'li' ).each( function() {
477						var li_item = jQuery( this ),
478							li_item_position = li_item.offset(),
479							megamenu_wrapper = li_item.find( '.fusion-megamenu-wrapper' ),
480							megamenu_wrapper_width = megamenu_wrapper.outerWidth(),
481							megamenu_wrapper_position = 0;
482
483						//check if there is a megamenu
484						if( megamenu_wrapper.length ) {
485							megamenu_wrapper.removeAttr( 'style' );
486
487							if( li_item_position.left + megamenu_wrapper_width > main_nav_container_right_edge ) {
488
489								megamenu_wrapper_position = -1 * ( li_item_position.left - ( main_nav_container_right_edge - megamenu_wrapper_width ) );
490
491								if( js_local_vars.logo_alignment.toLowerCase() == 'right' ) {
492									if( li_item_position.left + megamenu_wrapper_position < main_nav_container_left_edge ) {
493										megamenu_wrapper_position = -1 * ( li_item_position.left - main_nav_container_left_edge );
494									}
495								}
496
497								megamenu_wrapper.css( 'left', megamenu_wrapper_position );
498							}
499						}
500					});
501				});
502
503			} else {
504				return this.each( function() {
505
506					jQuery( this ).children( 'li' ).each( function() {
507						var li_item = jQuery( this ),
508							li_item_position = li_item.offset(),
509							li_item_right_edge = li_item_position.left + li_item.outerWidth(),
510							megamenu_wrapper = li_item.find( '.fusion-megamenu-wrapper' ),
511							megamenu_wrapper_width = megamenu_wrapper.outerWidth(),
512							megamenu_wrapper_position = 0;
513
514						//check if there is a megamenu
515						if( megamenu_wrapper.length ) {
516							megamenu_wrapper.removeAttr( 'style' );
517
518							if( li_item_right_edge - megamenu_wrapper_width < main_nav_container_left_edge ) {
519
520								megamenu_wrapper_position = -1 * ( megamenu_wrapper_width - ( li_item_right_edge - main_nav_container_left_edge ) );
521
522								if( js_local_vars.logo_alignment.toLowerCase() == 'left' || ( js_local_vars.logo_alignment.toLowerCase() == 'center' && ! jQuery( '.header-v5' ).length ) ) {
523									if( li_item_right_edge - megamenu_wrapper_position > main_nav_container_right_edge ) {
524										megamenu_wrapper_position = -1 * ( main_nav_container_right_edge - li_item_right_edge );
525									}
526								}
527
528								megamenu_wrapper.css( 'right', megamenu_wrapper_position );
529							}
530						}
531					});
532				});
533			}
534		}
535	};
536
537	jQuery.fn.position_last_top_menu_item = function( variables ) {
538		if( jQuery( this ).children( 'ul' ).length || jQuery( this).children( 'div' ).length ) {
539			var last_item = jQuery( this ),
540				last_item_left_pos = last_item.position().left,
541				last_item_width = last_item.outerWidth(),
542				last_item_child,
543				parent_container = jQuery( '.header-social .avada-row' ),
544				parent_container_left_pos = parent_container.position().left,
545				parent_container_width = parent_container.outerWidth();
546
547			if( last_item.children( 'ul' ).length ) {
548				last_item_child =  last_item.children( 'ul' );
549			} else if( last_item.children('div').length ) {
550				last_item_child =  last_item.children( 'div' );
551			}
552
553			if( ! jQuery( '.rtl' ).length ) {
554				if( last_item_left_pos + last_item_child.outerWidth() > parent_container_left_pos + parent_container_width ) {
555					last_item_child.css( 'right', '-1px' ).css( 'left', 'auto' );
556
557					last_item_child.find( '.sub-menu' ).each( function() {
558						jQuery( this ).css( 'right', '100px' ).css( 'left', 'auto' );
559					});
560				}
561			} else {
562				if( last_item_child.position().left < last_item_left_pos ) {
563					last_item_child.css( 'left', '-1px' ).css( 'right', 'auto' );
564
565					last_item_child.find( '.sub-menu' ).each( function() {
566						jQuery( this ).css( 'left', '100px' ).css( 'right', 'auto' );
567					});
568				}
569			}
570		}
571	};
572
573	// Waypoint
574	jQuery.fn.init_waypoint = function() {
575		if( jQuery().waypoint ) {
576
577			// Counters Box
578			jQuery('.fusion-counter-box').not('.fusion-modal .fusion-counter-box').waypoint(function() {
579				jQuery(this).find('.display-counter').each(function() {
580					jQuery(this).fusion_box_counting();
581				});
582			}, {
583				triggerOnce: true,
584				offset: 'bottom-in-view'
585			});
586
587			// Counter Circles
588			jQuery('.counter-circle-wrapper').not('.fusion-modal .counter-circle-wrapper').waypoint(function() {
589				jQuery(this).fusion_draw_circles();
590			}, {
591				triggerOnce: true,
592				offset: 'bottom-in-view'
593			});
594
595			// Progressbar
596			jQuery( '.fusion-progressbar' ).not('.fusion-modal .fusion-progressbar').waypoint( function() {
597				jQuery(this).fusion_draw_progress();
598			}, {
599				triggerOnce: true,
600				offset: 'bottom-in-view'
601			});
602
603			// CSS Animations
604			jQuery('.fusion-animated').waypoint(function() {
605				jQuery(this).css('visibility', 'visible');
606
607				// this code is executed for each appeared element
608				var animation_type = jQuery(this).data('animationtype');
609				var animation_duration = jQuery(this).data('animationduration');
610
611				jQuery(this).addClass('animated-	'+animation_type);
612
613				if(animation_duration) {
614					jQuery(this).css('-moz-animation-duration', animation_duration+'s');
615					jQuery(this).css('-webkit-animation-duration', animation_duration+'s');
616					jQuery(this).css('-ms-animation-duration', animation_duration+'s');
617					jQuery(this).css('-o-animation-duration', animation_duration+'s');
618					jQuery(this).css('animation-duration', animation_duration+'s');
619				}
620			},{ triggerOnce: true, offset: 'bottom-in-view' });
621		}
622	};
623})( jQuery );
624
625jQuery(window).load(function() {
626
627	// Initialize Waypoint
628	jQuery(window).init_waypoint();
629
630	jQuery('.fusion-flip-box').each(function() {
631		jQuery(this).fusion_calc_flip_boxes_height();
632	});
633
634	jQuery( window ).on( 'resize', function() {
635		jQuery('.fusion-flip-box').each(function() {
636			jQuery(this).fusion_calc_flip_boxes_height();
637		});
638	});
639
640
641	// Counters Box - Modals
642	jQuery('.fusion-modal .fusion-counter-box').each(function() {
643		jQuery(this).appear(function() {
644			jQuery(this).find('.display-counter').each(function() {
645				jQuery(this).fusion_box_counting();
646			});
647		});
648	});
649
650	// Counter Circles - Modals
651	jQuery('.fusion-modal .counter-circle-wrapper').each(function() {
652		jQuery(this).appear(function() {
653			jQuery(this).fusion_draw_circles();
654		});
655	});
656
657	// Progressbar - Modals
658	jQuery('.fusion-modal .fusion-progressbar').each(function() {
659		jQuery(this).appear(function() {
660			jQuery(this).fusion_draw_progress();
661		});
662	});
663
664	// Testimonials
665	function onAfter( curr, next, opts, fwd ) {
666	  var $ht = jQuery( this ).height();
667
668	  //set the container's height to that of the current slide
669	  jQuery( this ).parent().css( 'height' , $ht );
670	}
671
672	if( jQuery().cycle ) {
673		var reviews_cycle_args = {
674			fx: 'fade',
675			after: onAfter,
676			delay: 0
677		};
678
679		if ( js_local_vars.testimonials_speed ) {
680			reviews_cycle_args.timeout = parseInt(js_local_vars.testimonials_speed);
681		}
682	    jQuery( '.reviews' ).cycle( reviews_cycle_args );
683	}
684
685	// Toggles
686	jQuery( '.fusion-accordian .panel-title a' ).on( 'click', function () {
687		if( jQuery( this ).hasClass( 'active' ) ) {
688			jQuery( this ).parents( '.fusion-accordian ').find( '.panel-title a' ).removeClass( 'active' );
689		} else {
690			jQuery( this ).parents( '.fusion-accordian ').find( '.panel-title a' ).removeClass( 'active' );
691			jQuery( this ).addClass( 'active' );
692		}
693
694		var clicked_tab = jQuery(this);
695
696		setTimeout( function(){
697			clicked_tab.parents( '.fusion-panel' ).find( '.shortcode-map' ).each(function() {
698				var map_id = jQuery(this).attr('id');
699				window['fusion_run_map_' + map_id]();
700			});
701
702			if( clicked_tab.parents( '.fusion-panel' ).find( '.es-carousel-wrapper' ).length ) {
703				generateCarousel();
704			}
705
706			clicked_tab.parents( '.fusion-panel' ).find( '.portfolio' ).each( function() {
707				jQuery( this).find( '.portfolio-wrapper' ).isotope( 'reLayout' );
708			});
709
710			clicked_tab.parents( '.fusion-panel' ).find( '.fusion-blog-shortcode' ).each( function() {
711
712				if(jQuery( this ).find( '.grid-layout' ).hasClass( 'grid-layout-3' ) ) {
713					var gridwidth = (jQuery('.grid-layout-3').width() / 3) - 30;
714				} else if( jQuery( this ).find( '.grid-layout' ).hasClass( 'grid-layout-4' ) )  {
715					var gridwidth = (jQuery('.grid-layout-4').width() / 4) - 35;
716				} else {
717					var gridwidth = (jQuery('.grid-layout').width() / 2) - 22;
718				}
719
720				jQuery( this ).find( '.grid-layout .post' ).css('width', gridwidth);
721
722				jQuery( this ).find( '.grid-layout' ).isotope( 'option', {
723					masonry: {
724						columnWidth: gridwidth,
725						gutterWidth: 40
726					}
727				});
728
729				jQuery( this).find( '.grid-layout' ).isotope( 'reLayout' );
730			});
731		}, 350);
732
733	});
734
735	// Initialize Bootstrap Modals
736	jQuery( '.fusion-modal' ).each( function() {
737		jQuery( '#wrapper' ).append( jQuery( this ) );
738	});
739
740	jQuery( '.fusion-modal' ).bind('hidden.bs.modal', function () {
741	  jQuery( 'html' ).css( 'overflow', '' );
742	});
743
744	jQuery( '.fusion-modal' ).bind('show.bs.modal', function () {
745	  jQuery( 'html' ).css( 'overflow', 'visible' );
746	});
747
748	if( jQuery( '.tfs-slider' ).data( 'parallax' ) == 1 ) {
749		jQuery( '.fusion-modal' ).css( 'top', jQuery( '.header-wrapper' ).height() );
750	}
751
752	jQuery( '.fusion-hook-modal a' ).click( function( e ) {
753		e.preventDefault();
754	});
755
756	// stop videos in modals when closed
757	jQuery( '.fusion-modal' ).each(function() {
758		jQuery( this ).on( 'hide.bs.modal', function() {
759			// Youtube
760			jQuery( this ).find('iframe').each(function(i) {
761				var func = 'stopVideo';
762				this.contentWindow.postMessage('{"event":"command","func":"' + func + '","args":""}', '*');
763			});
764
765			// Vimeo
766			jQuery( this ).find('.fusion-vimeo iframe').each(function(i) {
767				$f(this).api('pause');
768			});
769		});
770	});
771
772	if(cssua.ua.mobile || cssua.ua.tablet_pc) {
773		jQuery('.fusion-popover, .fusion-tooltip').each(function() {
774			jQuery(this).attr('data-trigger', 'click');
775			jQuery(this).data('trigger', 'click');
776		});
777	}
778
779	// Initialize Bootstrap Popovers
780	jQuery( '[data-toggle~="popover"]' ).popover({
781		container: 'body'
782	});
783
784	// Initialize Bootstrap Tabs
785	// Initialize vertical tabs content container height
786    if( jQuery( '.vertical-tabs' ).length ) {
787        jQuery( '.vertical-tabs .tab-content .tab-pane' ).each( function() {
788            jQuery ( this ).css( 'min-height', jQuery( '.vertical-tabs .nav-tabs' ).outerHeight() );
789
790            if( jQuery ( this ).find( '.video-shortcode' ).length ) {
791                var video_width = parseInt( jQuery ( this ).find( '.fusion-video' ).css( 'max-width' ).replace( 'px', '' ) );
792                jQuery ( this ).css({
793                    'float': 'none',
794                    'max-width': video_width + 60
795                });
796            }
797        });
798    }
799
800	jQuery( window ).on( 'resize', function() {
801		if( jQuery( '.vertical-tabs' ).length ) {
802			jQuery( '.vertical-tabs .tab-content .tab-pane' ).css( 'min-height', jQuery( '.vertical-tabs .nav-tabs' ).outerHeight() );
803		}
804	});
805
806	// Initialize Bootstrap Tooltip
807	jQuery( '[data-toggle~="tooltip"]' ).tooltip({
808		container: 'body'
809	});
810
811	generateCarousel();
812
813	if(jQuery().waypoint) {
814		jQuery('.fusion-animated').waypoint(function() {
815			jQuery(this).css('visibility', 'visible');
816
817			// this code is executed for each appeared element
818			var animation_type = jQuery(this).data('animationtype');
819			var animation_duration = jQuery(this).data('animationduration');
820
821			jQuery(this).addClass('animated-	'+animation_type);
822
823			if(animation_duration) {
824				jQuery(this).css('-moz-animation-duration', animation_duration+'s');
825				jQuery(this).css('-webkit-animation-duration', animation_duration+'s');
826				jQuery(this).css('-ms-animation-duration', animation_duration+'s');
827				jQuery(this).css('-o-animation-duration', animation_duration+'s');
828				jQuery(this).css('animation-duration', animation_duration+'s');
829			}
830		},{ triggerOnce: true, offset: 'bottom-in-view' });
831	}
832
833	if(jQuery().flexslider && jQuery('.woocommerce .images #carousel').length >= 1) {
834		var WooThumbWidth = 100;
835		if(jQuery('body.woocommerce #sidebar').is(':visible')) {
836			wooThumbWidth = 100;
837		} else {
838			wooThumbWidth = 118;
839		}
840
841		if(typeof jQuery('.woocommerce .images #carousel').data('flexslider') !== 'undefined') {
842			jQuery('.woocommerce .images #carousel').flexslider('destroy');
843			jQuery('.woocommerce .images #slider').flexslider('destroy');
844		}
845
846		jQuery('.woocommerce .images #carousel').flexslider({
847			animation: 'slide',
848			controlNav: false,
849			directionNav: false,
850			animationLoop: false,
851			slideshow: false,
852			itemWidth: wooThumbWidth,
853			itemMargin: 9,
854			touch: false,
855			useCSS: false,
856			asNavFor: '.woocommerce .images #slider',
857			smoothHeight: false,
858			prevText: '&#xf104;',
859			nextText: '&#xf105;'
860		});
861
862		jQuery('.woocommerce .images #slider').flexslider({
863			animation: 'slide',
864			controlNav: false,
865			animationLoop: false,
866			slideshow: false,
867			smoothHeight: true,
868			touch: true,
869			useCSS: false,
870			sync: '.woocommerce .images #carousel',
871			prevText: '&#xf104;',
872			nextText: '&#xf105;'
873		});
874	}
875
876	if(jQuery().flexslider && jQuery('.flexslider-attachments').length >= 1) {
877		if(typeof jQuery('.flexslider-attachments').data('flexslider') !== 'undefined') {
878			jQuery('.flexslider-attachments').flexslider('destroy');
879		}
880
881		jQuery('.flexslider-attachments').flexslider({
882            slideshow: Boolean(Number(js_local_vars.slideshow_autoplay)),
883            slideshowSpeed: js_local_vars.slideshow_speed,
884			video: false,
885			smoothHeight: false,
886			pauseOnHover: false,
887			useCSS: false,
888			prevText: '&#xf104;',
889			nextText: '&#xf105;',
890			controlNav: 'thumbnails'
891		});
892	}
893});
894jQuery(document).ready(function($) {
895	if(js_local_vars.disable_mobile_animate_css == '1' && cssua.ua.mobile) {
896		jQuery('body').addClass('dont-animate');
897	} else {
898		jQuery('body').addClass('do-animate');
899	}
900
901	jQuery('.fusion-flip-box').mouseover(function() {
902		jQuery(this).addClass('hover');
903	});
904
905	jQuery('.fusion-flip-box').mouseout(function() {
906		jQuery(this).removeClass('hover');
907	});
908
909	// One page scrolling effect
910	var adminbar_height = jQuery('#wpadminbar').outerHeight();
911	var sticky_height = 0;
912
913	if(jQuery('.sticky-header').length ) {
914		sticky_height = 65;
915	}
916
917	jQuery('.fusion-accordian .panel-title a').click(function(e) {
918		e.preventDefault();
919	});
920
921
922
923
924	jQuery('a[href*=#]:not([href=#])').not('.fusion-accordian .panel-heading a, .fusion-tabs .nav-tabs a, .pyre_tabs .tabset a, .fancybox').click(function() {
925		if (location.pathname.replace(/^\//,'') == this.pathname.replace(/^\//,'') || location.hostname == this.hostname) {
926
927			var target = jQuery(this.hash);
928			target = target.length ? target : jQuery('[name=' + this.hash.slice(1) +']');
929			if (target.length) {
930				 jQuery('html, body').animate({
931					 scrollTop: target.offset().top - adminbar_height - sticky_height + 1
932				}, 850, 'easeInOutExpo');
933				return false;
934			}
935		}
936	});
937
938	// Top Menu last item positioning
939	jQuery('.top-menu > ul > li:last-child').position_last_top_menu_item();
940
941	// Activates the mega menu
942	if( jQuery.fn.fusion_position_megamenu ) {
943		jQuery( '.fusion-navbar-nav' ).fusion_position_megamenu();
944
945		jQuery( '.fusion-navbar-nav .fusion-megamenu-menu' ).mouseenter( function() {
946			jQuery( this ).parent().fusion_position_megamenu();
947		});
948	}
949
950	jQuery('.fusion-megamenu-menu').mouseenter(function() {
951		if(jQuery(this).find('.shortcode-map').length >= 1) {
952			jQuery(this).find('.shortcode-map').each(function() {
953				jQuery(this).goMap(window[this.id]);
954				marker = jQuery.goMap.markers[0];
955				if(marker) {
956					info = jQuery.goMap.getInfo(marker);
957					jQuery.goMap.setInfo(marker, info);
958				}
959				var center = jQuery.goMap.getMap().getCenter();
960				google.maps.event.trigger(jQuery.goMap.getMap(), 'resize');
961				jQuery.goMap.getMap().setCenter(center);
962			});
963		}
964	});
965
966	jQuery(".my-show").click(function(){
967		jQuery(".my-hidden").css('visibility', 'visible');
968	});
969
970	if (jQuery(".demo_store").length ) {
971		jQuery("#wrapper").css('margin-top', jQuery(".demo_store").outerHeight());
972		if(jQuery("#slidingbar-area").outerHeight()  > 0) {
973			jQuery(".header-wrapper").css('margin-top', '0');
974		}
975		if(jQuery('.sticky-header').length ) {
976			jQuery('.sticky-header').css('margin-top', jQuery('.demo_store').outerHeight());
977		}
978	}
979
980	// sliding bar
981	var slidingbar_state = 0;
982
983	if(jQuery('#slidingbar-area.open_onload').length >= 1) {
984		jQuery("div#slidingbar").slideDown(240,'easeOutQuad');
985		jQuery('.sb_toggle').addClass('open');
986		slidingbar_state = 1;
987
988		if(jQuery('#slidingbar .shortcode-map').length >= 1) {
989			jQuery('#slidingbar').find('.shortcode-map').each(function() {
990				jQuery("#"+this.id).goMap();
991				marker = jQuery.goMap.markers[0];
992				if(marker) {
993					info = jQuery.goMap.getInfo(marker);
994					jQuery.goMap.setInfo(marker, info);
995				}
996				var center = jQuery.goMap.getMap().getCenter();
997				google.maps.event.trigger(jQuery.goMap.getMap(), 'resize');
998				jQuery.goMap.getMap().setCenter(center);
999			});
1000		}
1001
1002		jQuery('#slidingbar-area').removeClass('open_onload');
1003	}
1004
1005	jQuery(".sb_toggle").click(function(){
1006		//Expand
1007		if(slidingbar_state == 0) {
1008			jQuery("div#slidingbar").slideDown(240,'easeOutQuad');
1009			jQuery('.sb_toggle').addClass('open');
1010			slidingbar_state = 1;
1011
1012			if(jQuery('#slidingbar .shortcode-map').length >= 1) {
1013				jQuery('#slidingbar').find('.shortcode-map').each(function() {
1014					jQuery("#"+this.id).goMap();
1015					marker = jQuery.goMap.markers[0];
1016					if(marker) {
1017						info = jQuery.goMap.getInfo(marker);
1018						jQuery.goMap.setInfo(marker, info);
1019					}
1020					var center = jQuery.goMap.getMap().getCenter();
1021					google.maps.event.trigger(jQuery.goMap.getMap(), 'resize');
1022					jQuery.goMap.getMap().setCenter(center);
1023				});
1024			}
1025
1026		//Collapse
1027		} else if(slidingbar_state == 1) {
1028			jQuery("div#slidingbar").slideUp(240,'easeOutQuad');
1029			jQuery('.sb_toggle').removeClass('open');
1030			slidingbar_state = 0;
1031		}
1032	});
1033
1034	// to top
1035	if(jQuery().UItoTop) {
1036		if(cssua.ua.mobile && js_local_vars.status_totop_mobile == '1') {
1037			jQuery().UItoTop({ easingType: 'easeOutQuart' });
1038		} else if( ! cssua.ua.mobile ) {
1039			jQuery().UItoTop({ easingType: 'easeOutQuart' });
1040		}
1041	}
1042
1043	// sticky header resizing control
1044	jQuery(window).on('resize', function() {
1045		// check for woo demo bar which can take on 2 lines and thus sticky position must be calculated
1046		if(jQuery(".demo_store").length) {
1047			jQuery("#wrapper").css('margin-top', jQuery(".demo_store").outerHeight());
1048			if(jQuery('.sticky-header').length) {
1049				jQuery(".sticky-header").css('margin-top', jQuery(".demo_store").outerHeight());
1050			}
1051		}
1052
1053		if(jQuery(".sticky-header").length ) {
1054			if(jQuery(window).width() < 765) {
1055				jQuery('body.admin-bar #header-sticky.sticky-header').css('top', '46px');
1056			} else {
1057				jQuery('body.admin-bar #header-sticky.sticky-header').css('top', '32px');
1058			}
1059		}
1060	});
1061
1062	//top nav
1063	jQuery('.header-wrapper .mobile-topnav-holder').append('<div class="mobile-selector"><span>'+js_local_vars.dropdown_goto+'</span></div>');
1064	jQuery('.header-wrapper .mobile-topnav-holder .mobile-selector').append('<div class="selector-down"></div>');
1065	jQuery('.header-wrapper .mobile-topnav-holder').append(jQuery('.header-wrapper .top-menu ul#snav').clone());
1066	jQuery('.header-wrapper .mobile-topnav-holder ul#snav').attr("class","mobile-topnav");
1067	jQuery('.header-wrapper .mobile-topnav-holder ul#snav').attr("id","mobile-nav");
1068	jQuery('.header-wrapper .mobile-topnav-holder ul#mobile-nav').children('.cart').each(function () {
1069	    jQuery(this).children('.my-cart-link').text(js_local_vars.mobile_nav_cart);
1070	    jQuery(this).children('.cart-contents').remove();
1071	});
1072	jQuery('.header-wrapper .mobile-topnav-holder ul#mobile-nav').children('li').each(function () {
1073	    jQuery( this ).attr( 'class', 'mobile-nav-item' );
1074	    if( jQuery( this ).attr('id' ) ) {
1075	    	jQuery( this ).attr( 'id', jQuery( this ).attr( 'id' ).replace( 'menu-item', 'mobile-topmenu-item' ) );
1076		}
1077	    jQuery( this ).attr( 'style', '' );
1078	});
1079	jQuery('.header-wrapper .mobile-topnav-holder .mobile-selector').click(function(){
1080		jQuery('.header-wrapper .mobile-topnav-holder #mobile-nav').slideToggle(240,'easeOutQuad');
1081	});
1082
1083	//main nav
1084	jQuery('.header-wrapper .mobile-nav-holder').append('<div class="mobile-selector"><span>'+js_local_vars.dropdown_goto+'</span></div>');
1085	jQuery('.header-wrapper .mobile-nav-holder .mobile-selector').append('<div class="selector-down"></div>');
1086	jQuery('.header-wrapper .mobile-nav-holder').append(jQuery('.header-wrapper .nav-holder ul.navigation').clone());
1087	jQuery('.header-wrapper .mobile-nav-holder ul.navigation').attr("id","mobile-nav");
1088	jQuery('.header-wrapper .mobile-nav-holder ul#mobile-nav').removeClass('fusion-navbar-nav');
1089	jQuery('.header-wrapper .mobile-nav-holder ul#mobile-nav').children('.cart').each(function () {
1090	    jQuery(this).children('.my-cart-link').text(js_local_vars.mobile_nav_cart);
1091	    jQuery(this).children('.cart-contents').remove();
1092	});
1093	jQuery('.header-wrapper .mobile-nav-holder ul#mobile-nav li').children('#main-nav-search-link').each(function () {
1094	    //jQuery(this).parents('li').remove();
1095		jQuery(this).remove();
1096	});
1097	jQuery('.header-wrapper .mobile-nav-holder ul#mobile-nav').children('li').each(function () {
1098	    jQuery( this ).attr( 'class', 'mobile-nav-item' );
1099
1100	    if( jQuery( this ).attr('id' ) ) {
1101	    	jQuery( this ).attr( 'id', jQuery( this ).attr( 'id' ).replace( 'menu-item', 'mobile-menu-item' ) );
1102		}
1103	});
1104	jQuery('.header-wrapper .mobile-nav-holder .mobile-selector').click(function(){
1105		if( jQuery('.header-wrapper .mobile-nav-holder #mobile-nav').hasClass( 'mobile-menu-expanded' ) ) {
1106			jQuery('.header-wrapper .mobile-nav-holder #mobile-nav').removeClass( 'mobile-menu-expanded' );
1107		} else {
1108			jQuery('.header-wrapper .mobile-nav-holder #mobile-nav').addClass( 'mobile-menu-expanded' );
1109	}
1110		jQuery('.header-wrapper .mobile-nav-holder #mobile-nav').slideToggle(240,'easeOutQuad');
1111	});
1112
1113	//sticky header nav
1114	jQuery('.sticky-header .fusion-navbar-nav').children('li').each(function () {
1115		 jQuery( this ).removeAttr( 'id' );
1116	});
1117	jQuery('.sticky-header .mobile-nav-holder').append('<div class="mobile-selector"><span>'+js_local_vars.dropdown_goto+'</span></div>');
1118	jQuery('.sticky-header .mobile-nav-holder .mobile-selector').append('<div class="selector-down"></div>');
1119	jQuery('.sticky-header .mobile-nav-holder').append(jQuery('.sticky-header .nav-holder ul.navigation').clone());
1120	jQuery('.sticky-header .mobile-nav-holder ul.navigation').attr("class","navigation mobile-sticky-nav");
1121	jQuery('.sticky-header .mobile-nav-holder ul.navigation').removeClass('fusion-navbar-nav');
1122	jQuery('.sticky-header .mobile-nav-holder .mobile-sticky-nav').children( '.cart' ).each(function () {
1123	    jQuery(this).children('.my-cart-link').text(js_local_vars.mobile_nav_cart);
1124	    jQuery(this).children('.cart-contents').remove();
1125	});
1126	jQuery('.sticky-header .mobile-nav-holder ul.navigation').attr("id","mobile-nav");
1127	jQuery('.sticky-header .mobile-nav-holder .mobile-sticky-nav').children('li').each(function () {
1128	    jQuery( this ).attr( 'class', 'mobile-nav-item' );
1129	    jQuery( this ).removeAttr( 'id' );
1130	    jQuery( this ).children( 'a' ).css( 'style', '' );
1131	});
1132	jQuery('.sticky-header .mobile-nav-holder .mobile-sticky-nav li').children('#sticky-nav-search-link').each(function () {
1133	    //jQuery(this).parents('li').remove();
1134		jQuery(this).remove();
1135	});
1136	jQuery('.sticky-header .mobile-nav-holder .mobile-selector').click(function(){
1137		jQuery('.sticky-header .mobile-nav-holder .mobile-sticky-nav').slideToggle(240,'easeOutQuad');
1138	});
1139	jQuery('body #header-sticky.sticky-header .sticky-shadow .mobile-nav-holder').css('padding-left', jQuery('.sticky-header .sticky-shadow .logo').width() + 25 + "px");
1140
1141
1142	// Make megamenu items mobile ready
1143	jQuery('.header-wrapper .mobile-nav-holder .navigation > .mobile-nav-item, .sticky-header .mobile-nav-holder .navigation > .mobile-nav-item').each(function() {
1144		jQuery(this).find('.fusion-megamenu-widgets-container').remove();
1145
1146		jQuery(this).find('.fusion-megamenu-holder > ul').each( function() {
1147			jQuery(this).attr('class', 'sub-menu');
1148			jQuery(this).attr('style', '');
1149			jQuery(this).find('> li').each( function() {
1150				jQuery(this).attr('class', 'mobile-nav-item');
1151				if( ! jQuery(this).find('.fusion-megamenu-title a, > a').length ) {
1152					jQuery(this).find('.fusion-megamenu-title').each( function() {
1153						if( ! jQuery( this ).children( 'a' ).length ) {
1154							jQuery( this ).append( '<a href="#">
1154' + jQuery( this ).text() + '</a>' );
1155						}
1156					});
1157
1158					if( ! jQuery(this).find('.fusion-megamenu-title').length ) {
1159
1160						var parent_li = jQuery(this);
1161
1162						jQuery( this ).find( '.sub-menu').each( function() {
1163							parent_li.after( jQuery( this ) );
1164
1165						});
1166						jQuery( this ).remove();
1167					}
1168				}
1169				jQuery( this ).prepend( jQuery( this ).find( '.fusion-megamenu-title a, > a' ) );
1170
1171				jQuery( this ).find( '.fusion-megamenu-title' ).remove();
1172			});
1173			jQuery( this ).parents( '.mobile-nav-item' ).append( jQuery( this ) );
1174		});
1175
1176		jQuery( this ).find( '.fusion-megamenu-wrapper, .caret, .fusion-megamenu-bullet' ).remove();
1177	});
1178
1179	// Make mobile menu sub-menu toggles
1180	if( js_local_vars.submenu_slideout == 1 ) {
1181		jQuery('.header-wrapper .mobile-topnav-holder .mobile-topnav li, .header-wrapper .mobile-nav-holder .navigation li, .sticky-header .mobile-nav-holder .navigation li').each(function() {
1182			//jQuery(this).attr('class', 'mobile-nav-item');
1183
1184			if( jQuery( this ).find( ' > ul' ).length ) {
1185				jQuery( this ).prepend('<span href="#" aria-haspopup="true" class="open-submenu"></span>' );
1186
1187				jQuery( this ).find( ' > ul' ).hide();
1188			}
1189		});
1190
1191		jQuery('.header-wrapper .mobile-topnav-holder .open-submenu, .header-wrapper .mobile-nav-holder .open-submenu, .sticky-header .mobile-nav-holder .open-submenu').click( function() {
1192			jQuery( this ).parent().children( '.sub-menu' ).slideToggle(240,'easeOutQuad');
1193
1194		});
1195	}
1196
1197	// side nav drop downs
1198	jQuery('.side-nav li').each(function() {
1199		if(jQuery(this).find('> .children').length >=1) {
1200			jQuery(this).find('> a').append('<span class="arrow"></span>');
1201		}
1202	});
1203
1204	jQuery('.side-nav .current_page_item').each(function() {
1205		if(jQuery(this).find('.children').length >= 1){
1206			jQuery(this).find('.children').show('slow');
1207		}
1208	});
1209
1210	jQuery('.side-nav .current_page_item').each(function() {
1211		if(jQuery(this).parent().hasClass('side-nav')) {
1212			jQuery(this).find('ul').show('slow');
1213		}
1214
1215		if(jQuery(this).parent().hasClass('children')){
1216			jQuery(this).parents('ul').show('slow');
1217		}
1218	});
1219
1220	if ('ontouchstart' in document.documentElement || navigator.msMaxTouchPoints) {
1221		jQuery('.nav-holder li.menu-item-has-children > a, .order-dropdown > li .current-li').on("click", function (e) {
1222			var link = jQuery(this);
1223			if (link.hasClass('hover')) {
1224				link.removeClass("hover");
1225				return true;
1226			} else {
1227				link.addClass("hover");
1228				jQuery('.nav-holder li.menu-item-has-children > a, .order-dropdown > li .current-li').not(this).removeClass("hover");
1229				e.preventDefault();
1230				return false;
1231			}
1232		});
1233
1234		jQuery('.sub-menu li, .mobile-nav-item li').not('li.menu-item-has-children').find('a').on("click", function (e) {
1235			var link = jQuery(this).attr('href');
1236			window.location = link;
1237
1238      		return true;
1239		});
1240	}
1241
1242	// Touch support for win phone devices
1243	jQuery('#nav li a, .top-menu li a, #sticky-nav li a, .side-nav li a, .mobile-nav-item a').each(function() {
1244		jQuery(this).attr('aria-haspopup', 'true');
1245	});
1246
1247	var scrollspy_target = '.nav-holder .fusion-navbar-nav li > a';
1248	jQuery('body').scrollspy({
1249		target: scrollspy_target,
1250		offset: adminbar_height + sticky_height
1251	});
1252
1253	// Ubermenu responsive fix
1254	if(jQuery('.megaResponsive').length >= 1) {
1255		jQuery('.mobile-nav-holder.main-menu').addClass('set-invisible');
1256	}
1257
1258	// WPML search form input add
1259	if( js_local_vars.language_flag != '') {
1260		jQuery('.search-field, #searchform').each( function() {
1261			if( ! jQuery( this ).find( 'input[name="lang"]' ).length && ! jQuery( this ).parents( '#searchform' ).find( 'input[name="lang"]' ).length ) {
1262				jQuery( this ).append('<input type="hidden" name="lang" value="'+js_local_vars.language_flag+'"/>');
1263			}
1264		});
1265	}
1266
1267	jQuery( '#wrapper .share-box' ).each( function() {
1268		if( ! jQuery( 'meta[property="og:title"]' ).length ) {
1269			jQuery( 'head title' ).after( '<meta property="og:title" content="' + jQuery( this ).data( 'title' )  + '"/>' );
1270			jQuery( 'head title' ).after( '<meta property="og:description" content="' + jQuery( this ).data( 'description' )  + '"/>' );
1271			jQuery( 'head title' ).after( '<meta property="og:type" content="article"/>' );
1272			jQuery( 'head title' ).after( '<meta property="og:url" content="' + jQuery( this ).data( 'link' )  + '"/>' );
1273			jQuery( 'head title' ).after( '<meta property="og:image" content="' + jQuery( this ).data( 'image' )  + '"/>' );
1274		}
1275	});
1276
1277	sharebox_h4_width = jQuery('#wrapper .share-box h4').outerWidth();
1278	sharebox_ul = jQuery('.share-box ul').outerWidth();
1279	// social share box alignment on resize
1280	if( sharebox_h4_width + sharebox_ul > jQuery('.post-content').width() && ! jQuery('.single-avada_portfolio').length ) {
1281		jQuery('#wrapper .share-box').css('height', 'auto');
1282		jQuery('#wrapper .share-box h4').css('float', 'none').css('line-height', '20px').css('padding-bottom', '25px').css('padding-top', '25px');
1283		jQuery('.share-box ul').css('float', 'none').css('margin-top', '0').css('overflow', 'hidden').css('padding', '0 25px 25px');
1284	} else {
1285		jQuery('#wrapper .share-box').css( 'height', '' );
1286	}
1287
1288	// Chrome soical icons drop to second row bug quirks
1289	header_social_social_networks = 0;
1290	jQuery('.header-social .social-networks li').each(function() {
1291		header_social_social_networks += jQuery(this).outerWidth(true);
1292	});
1293	if(header_social_social_networks > jQuery('.header-social .social-networks').css('max-width')) {
1294		header_social_social_networks = jQuery('.header-social .social-networks').css('max-width');
1295	}
1296
1297	jQuery(window).on('resize', function() {
1298		jQuery('.title').each(function(index) {
1299			if(special_titles_width[index] > jQuery(this).parent().width()) {
1300				jQuery(this).addClass('border-below-title');
1301			} else {
1302				jQuery(this).removeClass('border-below-title');
1303			}
1304		});
1305
1306		// social share box alignment on resize
1307		if( sharebox_h4_width + sharebox_ul > jQuery('#content').width() ) {
1308			jQuery('#wrapper .share-box').css('height', 'auto');
1309    		jQuery('#wrapper .share-box h4').css('float', 'none').css('line-height', '20px').css('padding-bottom', '25px').css('padding-top', '25px');
1310			jQuery('.share-box ul').css('float', 'none').css('margin-top', '0').css('overflow', 'hidden').css('padding', '0 25px 25px');
1311		} else {
1312			jQuery('#wrapper .share-box').css( 'height', '' );
1313			//jQuery('#wrapper .share-box, #wrapper .share-box h4, .share-box ul').attr("style", "");
1314		}
1315
1316		// Chrome soical icons drop to second row bug quirks
1317		if(jQuery(window).width() >= 784) {
1318			jQuery('.header-social .social-networks').css('width', header_social_social_networks);
1319		} else {
1320			jQuery('.header-social .social-networks').css('width', '');
1321		}
1322	});
1323
1324	/* search icon show/hide */
1325	jQuery(document).click(function() {
1326		jQuery('.main-nav-search-form').hide();
1327		jQuery('.esep-search-results-dropdown').html('');
1328		jQuery('.esep-live-search').val('');
1329	});
1330	jQuery('.main-nav-search-form').click(function(e) {
1331		e.stopPropagation();
1332	});
1333	jQuery('.main-nav-search .search-link').click(function(e) {
1334		e.stopPropagation();
1335		if(jQuery(this).parent().find('.main-nav-search-form').css('display') == 'block') {
1336			jQuery(this).parent().find('.main-nav-search-form').hide();
1337			jQuery('.esep-search-results-dropdown').html('');
1338			jQuery('.esep-live-search').val('');
1339		} else {
1340			jQuery(this).parent().find('.main-nav-search-form').show();
1341			jQuery('.esep-search-results-dropdown').html('');
1342			jQuery('.esep-live-search').val('');
1343		}
1344	});
1345
1346	var special_titles_width = [];
1347	jQuery('.title').each(function(index) {
1348		special_titles_width[index] = jQuery(this).width();
1349		if(jQuery(this).find('h1,h2,h3,h4,h5,h6').width() > jQuery(this).parent().width()) {
1350			jQuery(this).addClass('border-below-title');
1351		}
1352	});
1353
1354	jQuery('[data-toggle=modal]').on('click', function(e) {
1355		e.preventDefault();
1356	});
1357
1358	// Tabs
1359	// On page load
1360    // Direct linked tab handling
1361    jQuery( '.fusion-tabs' ).each( function() {
1362        if( document.location.hash && jQuery( this ).find( '.nav-tabs li a[href="' + document.location.hash + '"]' ).length ) {
1363            jQuery( this ).find( '.nav-tabs li' ).removeClass( 'active' );
1364            jQuery( this ).find( '.nav-tabs li a[href="' + document.location.hash + '"]' ).parent().addClass( 'active' );
1365
1366            jQuery( this ).find( '.tab-content .tab-pane' ).removeClass( 'in' ).removeClass( 'active' );
1367            jQuery( this ).find( '.tab-content .tab-pane[id="' + document.location.hash.split('#')[1]  + '"]' ).addClass( 'in' ).addClass( 'active' );
1368        }
1369    });
1370
1371	//On Click Event
1372	jQuery(".nav-tabs li").click(function(e) {
1373		var clicked_tab = jQuery(this);
1374		var tab_content_to_activate = jQuery(this).find("a").attr("href");
1375		var map_id = clicked_tab.attr('id');
1376
1377		setTimeout( function(){
1378			clicked_tab.parents( '.fusion-tabs' ).find( tab_content_to_activate ).find( '.shortcode-map' ).each(function() {
1379				var map_id = jQuery(this).attr('id');
1380				window['fusion_run_map_' + map_id]();
1381			});
1382
1383			if( clicked_tab.parents( '.fusion-tabs' ).find( tab_content_to_activate ).find( '.es-carousel-wrapper' ).length ) {
1384				generateCarousel();
1385			}
1386
1387			clicked_tab.parents( '.fusion-tabs' ).find( tab_content_to_activate ).find( '.portfolio' ).each( function() {
1388				jQuery( this).find( '.portfolio-wrapper' ).isotope( 'reLayout' );
1389			});
1390
1391			clicked_tab.parents( '.fusion-tabs' ).find( tab_content_to_activate ).find( '.fusion-blog-shortcode' ).each( function() {
1392				if(jQuery( this ).find( '.grid-layout' ).hasClass( 'grid-layout-3' ) ) {
1393					var gridwidth = (jQuery('.grid-layout-3').width() / 3) - 30;
1394				} else if( jQuery( this ).find( '.grid-layout' ).hasClass( 'grid-layout-4' ) )  {
1395					var gridwidth = (jQuery('.grid-layout-4').width() / 4) - 35;
1396				} else {
1397					var gridwidth = (jQuery('.grid-layout').width() / 2) - 22;
1398				}
1399
1400				jQuery( this ).find( '.grid-layout .post' ).css('width', gridwidth);
1401
1402				jQuery( this ).find( '.grid-layout' ).isotope( 'option', {
1403					masonry: {
1404						columnWidth: gridwidth,
1405						gutterWidth: 40
1406					}
1407				});
1408
1409				jQuery( this).find( '.grid-layout' ).isotope( 'reLayout' );
1410			});
1411		}, 350);
1412
1413		e.preventDefault();
1414	});
1415
1416	// Tabs Widget
1417	jQuery( '.tabs-widget .tabset li a' ).click( function( e ) {
1418		e.preventDefault();
1419	});
1420
1421	// When page loads
1422	jQuery( '.tabs-widget' ).each(function() {
1423		jQuery( this ).find( '.tabset li:first' ).addClass( 'active' ).show(); //Activate first tab
1424		jQuery( this ).find( '.tab_content:first' ).show(); //Show first tab content
1425	});
1426
1427	//On Click Event
1428	jQuery( '.tabs-widget .tabset li' ).click(function(e) {
1429		var tab_to_activate = jQuery( this ).find( 'a' ).attr( 'href' );
1430
1431		jQuery( this ).parent().find( ' > li' ).removeClass( 'active' ); //Remove all 'active' classes
1432		jQuery( this ).addClass( 'active' ); // Add 'active' class to selected tab
1433
1434		jQuery( this ).parents( '.tabs-widget' ).find( '.tab_content' ).hide(); //Hide all tab content
1435		jQuery( this ).parents( '.tabs-widget' ).find( tab_to_activate ).fadeIn(); //Fade in the new active tab content
1436	});
1437
1438
1439
1440	jQuery('.woocommerce .images #carousel a').click(function(e) {
1441		e.preventDefault();
1442	});
1443
1444	jQuery('.tooltip-shortcode, .author_social .social-networks li, #footer .social-networks li, .footer-area .social-networks li, #sidebar .social-networks li, .social_links_shortcode li, .share-box li, .social-icon, .social li').mouseenter(function(e){
1445		jQuery(this).find('.popup').hoverFlow(e.type, {
1446			'opacity' :'show'
1447		});
1448	});
1449
1450	jQuery('.tooltip-shortcode, .author_social .social-networks li, #footer .social-networks li, .footer-area .social-networks li, #sidebar .social-networks li, .social_links_shortcode li, .share-box li, .social-icon, .social li').mouseleave(function(e){
1451		jQuery(this).find('.popup').hoverFlow(e.type, {
1452			'opacity' :'hide'
1453		});
1454	});
1455
1456	jQuery('.portfolio-tabs a').click(function(e){
1457		e.preventDefault();
1458
1459		var selector = jQuery(this).attr('data-filter');
1460		jQuery(this).parents('.portfolio').find('.portfolio-wrapper').isotope({ filter: selector });
1461
1462		jQuery(this).parents('ul').find('li').removeClass('active');
1463		jQuery(this).parent().addClass('active');
1464	});
1465
1466	jQuery('.faq-tabs a').click(function(e){
1467		e.preventDefault();
1468
1469		var selector = jQuery(this).attr('data-filter');
1470
1471		jQuery('.faqs .portfolio-wrapper .faq-item').fadeOut();
1472		jQuery('.faqs .portfolio-wrapper .faq-item'+selector).fadeIn();
1473
1474		jQuery(this).parents('ul').find('li').removeClass('active');
1475		jQuery(this).parent().addClass('active');
1476	});
1477
1478	function isScrolledIntoView(elem)
1479	{
1480	    var docViewTop = jQuery(window).scrollTop();
1481	    var docViewBottom = docViewTop + jQuery(window).height();
1482
1483	    var elemTop = jQuery(elem).offset().top;
1484	    var elemBottom = elemTop + jQuery(elem).height();
1485
1486	    return ((elemBottom <= docViewBottom) && (elemTop >= docViewTop));
1487	}
1488
1489	jQuery('.fusion-alert .close').click(function(e) {
1490		e.preventDefault();
1491
1492		jQuery(this).parent().slideUp();
1493	});
1494
1495	jQuery('input, textarea').placeholder();
1496
1497	function checkForImage(url) {
1498	    return(url.match(/\.(jpeg|jpg|gif|png)$/) != null);
1499	}
1500
1501	if(Modernizr.mq('only screen and (max-width: 479px)')) {
1502		jQuery('.overlay-full.layout-text-left .slide-excerpt p').each(function () {
1503			var excerpt = jQuery(this).html();
1504		    var wordArray = excerpt.split(/[\s\.\?]+/); //Split based on regular expression for spaces
1505		    var maxWords = 10; //max number of words
1506		    var total_words = wordArray.length; //current total of words
1507		    var newString = "";
1508		    //Roll back the textarea value with the words that it had previously before the maximum was reached
1509		    if (total_words > maxWords+1) {
1510		         for (var i = 0; i < maxWords; i++) {
1511		            newString += wordArray[i] + " ";
1512		        }
1513		        jQuery(this).html(newString);
1514		    }
1515		});
1516
1517		jQuery('.portfolio .gallery-icon').each(function () {
1518			var img = jQuery(this).attr('href');
1519
1520			if(checkForImage(img) == true) {
1521				jQuery(this).parents('.image').find('> img').attr('src', img).attr('width', '').attr('height', '');
1522			}
1523			jQuery(this).parents('.portfolio-item').css('width', 'auto');
1524			jQuery(this).parents('.portfolio-item').css('height', 'auto');
1525			jQuery(this).parents('.portfolio-one:not(.portfolio-one-text)').find('.portfolio-item').css('margin', '0');
1526		});
1527
1528		if(jQuery('.portfolio').length >= 1) {
1529			jQuery('.portfolio-wrapper').isotope('reLayout');
1530		}
1531	}
1532
1533	if(Modernizr.mq('only screen and (max-width: 800px)')) {
1534		jQuery('.tabs-vertical').addClass('tabs-horizontal').removeClass('tabs-vertical');
1535	}
1536
1537	jQuery(window).on('resize', function() {
1538		if(Modernizr.mq('only screen and (max-width: 800px)')) {
1539			jQuery('.tabs-vertical').addClass('tabs-original-vertical');
1540			jQuery('.tabs-vertical').addClass('tabs-horizontal').removeClass('tabs-vertical');
1541		} else {
1542			jQuery('.tabs-original-vertical').removeClass('tabs-horizontal').addClass('tabs-vertical');
1543		}
1544	});
1545
1546	generateCarousel();
1547
1548	// Woocommerce
1549	jQuery('.catalog-ordering .orderby .current-li a').html(jQuery('.catalog-ordering .orderby ul li.current a').html());
1550	jQuery('.catalog-ordering .sort-count .current-li a').html(jQuery('.catalog-ordering .sort-count ul li.current a').html());
1551	jQuery('.woocommerce #calc_shipping_state').parent().addClass('one_half');
1552	jQuery('.woocommerce #calc_shipping_postcode').parent().addClass('one_half last');
1553	jQuery('.woocommerce .shop_table .variation dd').after('<br />');
1554	jQuery('.woocommerce .avada-myaccount-data th.order-actions').text(js_local_vars.order_actions);
1555
1556	jQuery( '.rtl .woocommerce .wc-forward' ).each( function() {
1557        var checkout_button = jQuery( this );
1558        checkout_button.val( '\u2190 ' + checkout_button.val().replace( '\u2192', '' ) );
1559	});
1560
1561	var avada_myaccount_active = jQuery('.avada-myaccount-nav').find('.active a');
1562
1563	if(avada_myaccount_active.hasClass('address') ) {
1564		jQuery('.avada-myaccount-data .edit_address_heading').fadeIn();
1565	} else {
1566		jQuery('.avada-myaccount-data h2:nth-of-type(1)').fadeIn();
1567	}
1568
1569	if(avada_myaccount_active.hasClass('downloads') ) {
1570		jQuery('.avada-myaccount-data .digital-downloads').fadeIn();
1571	} else if(avada_myaccount_active.hasClass('orders') ) {
1572		jQuery('.avada-myaccount-data .my_account_orders').fadeIn();
1573	} else if(avada_myaccount_active ) {
1574		jQuery('.avada-myaccount-data .myaccount_address, .avada-myaccount-data .addresses').fadeIn();
1575	}
1576
1577	jQuery('.rtl .avada-myaccount-data .my_account_orders .order-status').each( function() {
1578		jQuery( this ).css( 'text-align', 'right' );
1579	});
1580
1581	jQuery('.woocommerce input').each(function() {
1582		if(!jQuery(this).has('#coupon_code')) {
1583			name = jQuery(this).attr('id');
1584			jQuery(this).attr('placeholder', jQuery(this).parent().find('label[for='+name+']').text());
1585		}
1586	});
1587
1588
1589	if(jQuery('.woocommerce #reviews #comments .comment_container .comment-text').length ) {
1590		jQuery('.woocommerce #reviews #comments .comment_container').append('<div class="clear"></div>');
1591	}
1592
1593	if( jQuery('.woocommerce.single-product .related.products > h2').length ) {
1594		jQuery('.woocommerce.single-product .related.products > h2').addClass( 'title-heading-left' );
1595		jQuery('.woocommerce.single-product .related.products > h2').wrap( '<div class="fusion-title title"></div>' );
1596		jQuery('.woocommerce.single-product .related.products > .title').append( '<div class="title-sep-container"><div class="title-sep sep-double"></div></div>' );
1597	}
1598
1599	if( jQuery('.woocommerce.single-product .upsells.products > h2').length ) {
1600		jQuery('.woocommerce.single-product .upsells.products > h2').wrap( '<div class="title"></div>' );
1601		jQuery('.woocommerce.single-product .upsells.products > h2').wrap( '<div class="fusion-title title"></div>' );
1602		jQuery('.woocommerce.single-product .upsells.products > .title').append( '<div class="title-sep-container"><div class="title-sep sep-double"></div></div>' );
1603	}
1604
1605	if(jQuery('body #sidebar').css('display') == "block") {
1606		jQuery('body').addClass('has-sidebar');
1607		calcTabsLayout('.woocommerce-tabs .tabs-horizontal');
1608	}
1609
1610	if(jQuery('body.archive.woocommerce #sidebar').css('display') == "block") {
1611		jQuery('#main ul.products').removeClass('products-1');
1612		jQuery('#main ul.products').removeClass('products-2');
1613	}
1614
1615	if(jQuery('body.single.woocommerce #sidebar').css('display') == "block") {
1616		jQuery('.upsells.products ul.products,.related.products ul.products').removeClass('products-1');
1617		jQuery('.upsells.products ul.products,.related.products ul.products').removeClass('products-2');
1618		jQuery('.upsells.products ul.products,.related.products ul.products').removeClass('products-4').addClass('products-3');
1619		jQuery('.upsells.products ul.products').html(jQuery('.upsells.products ul.products li').slice(0, 3));
1620		jQuery('.related.products ul.products').html(jQuery('.related.products ul.products li').slice(0, 3));
1621	}
1622
1623	jQuery('#sidebar .products,.footer-area .products,#slidingbar-area .products').each(function() {
1624		jQuery(this).removeClass('products-4');
1625		jQuery(this).removeClass('products-3');
1626		jQuery(this).removeClass('products-2');
1627		jQuery(this).addClass('products-1');
1628	});
1629
1630	jQuery('.products-4 li, .products-3 li, .products-3 li').removeClass('last');
1631
1632	jQuery( '.woocommerce-tabs .panel .panel' ).css('display', 'inherit');
1633	jQuery('.woocommerce-tabs ul.tabs li a').unbind( 'click' );
1634	jQuery('.woocommerce-tabs > ul.tabs li a').click(function(){
1635
1636		var $tab = $(this);
1637		var $tabs_wrapper = $tab.closest('.woocommerce-tabs');
1638
1639		$('ul.tabs li', $tabs_wrapper).removeClass('active');
1640		$('div.panel', $tabs_wrapper).hide();
1641		$('div' + $tab.attr('href'), $tabs_wrapper).show();
1642		$tab.parent().addClass('active');
1643
1644		return false;
1645	});
1646
1647
1648	jQuery('.woocommerce-checkout-nav a,.continue-checkout').click(function(e) {
1649		e.preventDefault();
1650
1651		if( ! jQuery( '.woocommerce .avada-checkout' ).find( '.woocommerce-invalid' ).is( ':visible' ) ) {
1652			var data_name = $(this).attr('data-name');
1653			var name = data_name;
1654			if(data_name != '#order_review') {
1655				name = '.' + data_name;
1656			}
1657
1658			jQuery('form.checkout .col-1, form.checkout .col-2, form.checkout #order_review_heading, form.checkout #order_review').hide();
1659
1660			jQuery('form.checkout').find(name).fadeIn();
1661			if(name == '#order_review') {
1662				jQuery('form.checkout').find('#order_review_heading').fadeIn();
1663			}
1664
1665			jQuery('.woocommerce-checkout-nav li').removeClass('active');
1666			jQuery('.woocommerce-checkout-nav').find('[data-name='+data_name+']').parent().addClass('active');
1667
1668			if( jQuery( this ).hasClass( 'continue-checkout' ) && jQuery( window ).scrollTop() > 0 ) {
1669				jQuery('html, body').animate({scrollTop: jQuery( '.woocommerce-content-box.avada-checkout' ).offset().top - adminbar_height - sticky_height }, 500);
1670			}
1671		}
1672	});
1673
1674
1675	jQuery('.avada-myaccount-nav a').click(function(e) {
1676		e.preventDefault();
1677
1678		jQuery('.avada-myaccount-data h2, .avada-myaccount-data .digital-downloads, .avada-myaccount-data .my_account_orders, .avada-myaccount-data .myaccount_address, .avada-myaccount-data .addresses, .avada-myaccount-data .edit-account-heading, .avada-myaccount-data .edit-account-form').hide();
1679
1680		if(jQuery(this).hasClass('downloads') ) {
1681			jQuery('.avada-myaccount-data h2:nth-of-type(1), .avada-myaccount-data .digital-downloads').fadeIn();
1682		} else if(jQuery(this).hasClass('orders') ) {
1683
1684			if( jQuery(this).parents('.avada-myaccount-nav').find('.downloads').length ) {
1685				heading = jQuery('.avada-myaccount-data h2:nth-of-type(2)');
1686			} else {
1687				heading = jQuery('.avada-myaccount-data h2:nth-of-type(1)');
1688			}
1689
1690			heading.fadeIn();
1691			jQuery('.avada-myaccount-data .my_account_orders').fadeIn();
1692		} else if(jQuery(this).hasClass('address') ) {
1693
1694			if( jQuery(this).parents('.avada-myaccount-nav').find('.downloads').length && jQuery(this).parents('.avada-myaccount-nav').find('.orders').length ) {
1695				heading = jQuery('.avada-myaccount-data h2:nth-of-type(3)');
1696			} else if( jQuery(this).parents('.avada-myaccount-nav').find('.downloads').length || jQuery(this).parents('.avada-myaccount-nav').find('.orders').length ) {
1697				heading = jQuery('.avada-myaccount-data h2:nth-of-type(2)');
1698			} else {
1699				heading = jQuery('.avada-myaccount-data h2:nth-of-type(1)');
1700			}
1701
1702			heading.fadeIn();
1703			jQuery('.avada-myaccount-data .myaccount_address, .avada-myaccount-data .addresses').fadeIn();
1704		} else if(jQuery(this).hasClass('account') ) {
1705			jQuery('.avada-myaccount-data .edit-account-heading, .avada-myaccount-data .edit-account-form').fadeIn();
1706		}
1707
1708		jQuery('.avada-myaccount-nav li').removeClass('active');
1709		jQuery(this).parent().addClass('active');
1710	});
1711
1712	jQuery('a.add_to_cart_button').click(function(e) {
1713		var link = this;
1714		jQuery(link).closest('.product').find('.cart-loading').find('i').removeClass('icon-check-square-o').addClass('icon-spinner');
1715		jQuery(this).closest('.product').find('.cart-loading').fadeIn();
1716		setTimeout(function(){
1717			jQuery(link).closest('.product').find('.product-images img').animate({opacity: 0.75});
1718			jQuery(link).closest('.product').find('.cart-loading').find('i').hide().removeClass('icon-spinner').addClass('icon-check-square-o').fadeIn();
1719
1720			setTimeout(function(){
1721				jQuery(link).closest('.product').find('.cart-loading').fadeOut().closest('.product').find('.product-images img').animate({opacity: 1});
1722			}, 2000);
1723		}, 2000);
1724	});
1725
1726	jQuery('li.product').mouseenter(function() {
1727		if(jQuery(this).find('.cart-loading').find('i').hasClass('icon-check-square-o')) {
1728			jQuery(this).find('.cart-loading').fadeIn();
1729		}
1730	}).mouseleave(function() {
1731		if(jQuery(this).find('.cart-loading').find('i').hasClass('icon-check-square-o')) {
1732			jQuery(this).find('.cart-loading').fadeOut();
1733		}
1734	});
1735
1736	jQuery('.content-boxes-icon-boxed').each(function() {
1737		jQuery(this).find('.content-box-column .content-wrapper-boxed').equalHeights();
1738		jQuery(this).find('.content-box-column .content-wrapper-boxed').css( 'overflow', 'visible' );
1739	});
1740
1741	jQuery( '.cart-collaterals #calc_shipping_country, .widget_layered_nav select').wrap('<p class="avada-select-parent"></p>').after('<div class="select-arrow">&#xe61f;</div>');
1742	jQuery( '.cart-collaterals #calc_shipping_state' ).after('<div class="select-arrow">&#xe61f;</div>');
1743
1744	if( ! jQuery( '#billing_country_field .chosen-container').length ) {
1745		jQuery( '#billing_country_field	select.country_select').wrap('<p class="avada-select-parent"></p>').after('<span class="select-arrow">&#xe61f;</span>');
1746		jQuery( '#billing_state_field select.state_select').wrap('<div class="avada-select-parent"></div>').after('<div class="select-arrow">&#xe61f;</div>');
1747	}
1748
1749	if( ! jQuery( '#shipping_country_field .chosen-container').length ) {
1750		jQuery( '#shipping_country_field select.country_select').wrap('<p class="avada-select-parent"></p>').after('<span class="select-arrow">&#xe61f;</span>');
1751		jQuery( '#shipping_state_field select.state_select').wrap('<div class="avada-select-parent"></div>').after('<div class="select-arrow">&#xe61f;</div>');
1752	}
1753
1754	jQuery( "#calc_shipping_country" ).change(function() {
1755
1756		if( jQuery('.avada-shipping-calculator-form #calc_shipping_state.input-text').length) {
1757			jQuery('.avada-shipping-calculator-form #calc_shipping_state').parent().children('.select-arrow').hide();
1758		} else {
1759			jQuery('.avada-shipping-calculator-form #calc_shipping_state').parent().children('.select-arrow').show();
1760		}
1761
1762		calc_select_arrow_dimensions();
1763	});
1764
1765	jQuery( "#billing_country" ).change(function() {
1766
1767		if( jQuery( '#billing_state_field .chosen-container').length ) {
1768			jQuery( '#billing_state_field .avada-select-parent' ).hide();
1769		} else {
1770			jQuery( '#billing_state_field .avada-select-parent' ).show();
1771		}
1772
1773		if( jQuery('#billing_state_field input').length) {
1774			jQuery('#billing_state_field .select-arrow').hide();
1775		} else {
1776			jQuery('#billing_state_field .select-arrow').show();
1777		}
1778	});
1779
1780	jQuery( "#shipping_country" ).change(function() {
1781
1782		if( jQuery( '#shipping_country_field .chosen-container').length ) {
1783			jQuery( '#shipping_country_field .avada-select-parent' ).hide();
1784		} else {
1785			jQuery( '#shipping_country_field .avada-select-parent' ).show();
1786		}
1787
1788		if( jQuery('#shipping_state_field input').length) {
1789			jQuery('#shipping_state_field .select-arrow').hide();
1790		} else {
1791			jQuery('#shipping_state_field .select-arrow').show();
1792		}
1793	});
1794
1795	// wrap variation forms select and add arrow
1796	jQuery('table.variations select').wrap('<div class="avada-select-parent"></div>');
1797	jQuery('<div class="select-arrow">&#xe61f;</div>').appendTo('table.variations .avada-select-parent');
1798
1799	// wrap cf7 select and add arrow
1800	jQuery('.wpcf7-select').wrap('<div class="wpcf7-select-parent"></div>');
1801	jQuery('<div class="select-arrow">&#xe61f;
1801</div>').appendTo('.wpcf7-select-parent');
1802
1803	// wrap gravity forms select and add arrow
1804	jQuery('.gform_wrapper select:not([multiple])').each( function() {
1805		var select_width = jQuery( this ).css('width');
1806		jQuery( this ).wrap('<div class="gravity-select-parent"></div>');
1807		jQuery( this ).parent().width( select_width );
1808		jQuery( this ).css( 'cssText', "width: 100% !important;" );
1809		jQuery('<div class="select-arrow">&#xe61f;</div>').appendTo( jQuery( this ).parent( '.gravity-select-parent' ) );
1810	});
1811
1812	// wrap woo and bbpress select and add arrow
1813	jQuery('#bbp_stick_topic_select, #bbp_topic_status_select, #bbp_forum_id, #bbp_destination_topic').wrap('<div class="avada-select-parent"></div>').after('<div class="select-arrow">&#xe61f;</div>');
1814
1815	jQuery('.variations_form select').change(function() {
1816		jQuery('.product #slider').flexslider(0);
1817	});
1818});
1819
1820// set heights of select arrows correctly
1821jQuery(window).load(function() {
1822	calc_select_arrow_dimensions();
1823});
1824
1825function calc_select_arrow_dimensions() {
1826	jQuery( '.avada-select-parent .select-arrow, .gravity-select-parent .select-arrow, .wpcf7-select-parent .select-arrow' ).each( function() {
1827		if( jQuery( this ).prev().innerHeight() > 0 ) {
1828			jQuery( this ).css( {
1829				height: jQuery( this ).prev().innerHeight(),
1830				width: jQuery( this ).prev().innerHeight(),
1831				'line-height': jQuery( this ).prev().innerHeight() + 'px'
1832			});
1833		}
1834	});
1835}
1836
1837jQuery(document).bind('gform_post_conditional_logic', function(){
1838	var select = jQuery('.gform_wrapper select');
1839	jQuery(select).each(function() {
1840		if(jQuery(this).hasClass('chzn-done') && jQuery(this).parent().hasClass('gravity-select-parent')) {
1841			jQuery('.gform_wrapper select.chzn-done').unwrap('<div class="gravity-select-parent"></div>');
1842			jQuery('.gform_wrapper select.chzn-done').parent().find('.select-arrow').remove();
1843		}
1844	});
1845});
1846
1847
1848/*!
1849 * Bootstrap v3.1.1 (http://getbootstrap.com)
1850 * Copyright 2011-2014 Twitter, Inc.
1851 * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
1852 * scrollspy.js
1853 * modified by ThemeFusion 2014
1854 */
1855
1856+function ($) {
1857  'use strict';
1858
1859  // SCROLLSPY CLASS DEFINITION
1860  // ==========================
1861
1862  function ScrollSpy(element, options) {
1863    var href;
1864    var process  = $.proxy(this.process, this);
1865
1866    this.$element       = $(element).is('body') ? $(window) : $(element);
1867    this.$body          = $('body');
1868    this.$scrollElement = this.$element.on('scroll.bs.scroll-spy.data-api', process);
1869    this.options        = $.extend({}, ScrollSpy.DEFAULTS, options);
1870    this.selector       = (this.options.target
1871      || ((href = $(element).attr('href')) && href.replace(/.*(?=#[^\s]+$)/, '')) //strip for ie7
1872      || '');
1873    this.offsets        = $([]);
1874    this.targets        = $([]);
1875    this.activeTarget   = null;
1876
1877    this.refresh();
1878    this.process();
1879  }
1880
1881  ScrollSpy.DEFAULTS = {
1882    offset: 10
1883  };
1884
1885  ScrollSpy.prototype.refresh = function () {
1886    var offsetMethod = this.$element[0] == window ? 'offset' : 'position';
1887
1888    this.offsets = $([]);
1889    this.targets = $([]);
1890
1891    var self     = this;
1892    var $targets = this.$body
1893      .find(this.selector)
1894      .map(function () {
1895        var $el   = $(this);
1896        var href  = $el.data('target') || $el.attr('href');
1897        var $href = /^#./.test(href) && $(href);
1898
1899        return ($href
1900          && $href.length
1901          && $href.is(':visible')
1902          && [[ $href[offsetMethod]().top + (!$.isWindow(self.$scrollElement.get(0)) && self.$scrollElement.scrollTop()), href ]]) || null;
1903      })
1904      .sort(function (a, b) { return a[0] - b[0]; })
1905      .each(function () {
1906        self.offsets.push(this[0]);
1907        self.targets.push(this[1]);
1908      });
1909  };
1910
1911  ScrollSpy.prototype.process = function () {
1912    var scrollTop    = this.$scrollElement.scrollTop() + this.options.offset;
1913    var scrollHeight = this.$scrollElement[0].scrollHeight || this.$body[0].scrollHeight;
1914    var maxScroll    = scrollHeight - this.$scrollElement.height();
1915    var offsets      = this.offsets;
1916    var targets      = this.targets;
1917    var activeTarget = this.activeTarget;
1918    var i;
1919
1920    if (scrollTop >= maxScroll) {
1921      return activeTarget != (i = targets.last()[0]) && this.activate(i);
1922    }
1923
1924    for (i = offsets.length; i--;) {
1925      activeTarget != targets[i]
1926        && scrollTop >= offsets[i]
1927        && (!offsets[i + 1] || scrollTop <= offsets[i + 1])
1928        && this.activate( targets[i] );
1929    }
1930  };
1931
1932  ScrollSpy.prototype.activate = function (target) {
1933    this.activeTarget = target;
1934
1935    $(this.selector)
1936      .parents('.current-menu-item')
1937      .removeClass('current-menu-item');
1938
1939    var selector = this.selector +
1940        '[data-target="' + target + '"],' +
1941        this.selector + '[href="' + target + '"]';
1942
1943    var active = $(selector)
1944      .parents('li')
1945      .addClass('current-menu-item');
1946
1947    if (active.parent('.sub-menu').length) {
1948      active = active
1949        .closest('li.fusion-dropdown-menu')
1950        .addClass('current-menu-item');
1951    }
1952
1953    active.trigger('activate.bs.scrollspy');
1954  };
1955
1956
1957  // SCROLLSPY PLUGIN DEFINITION
1958  // ===========================
1959
1960  var old = $.fn.scrollspy;
1961
1962  $.fn.scrollspy = function (option) {
1963    return this.each(function () {
1964      var $this   = $(this);
1965      var data    = $this.data('bs.scrollspy');
1966      var options = typeof option == 'object' && option;
1967
1968      if (!data) $this.data('bs.scrollspy', (data = new ScrollSpy(this, options)));
1969      if (typeof option == 'string') data[option]();
1970    });
vendor: 13,792 bytes, lines 1971-2387
1971  };
1972
1973  $.fn.scrollspy.Constructor = ScrollSpy;
1974
1975
1976  // SCROLLSPY NO CONFLICT
1977  // =====================
1978
1979  $.fn.scrollspy.noConflict = function () {
1980    $.fn.scrollspy = old;
1981    return this;
1982  };
1983
1984
1985  // SCROLLSPY DATA-API
1986  // ==================
1987
1988  $(window).on('load', function () {
1989    $('[data-spy="scroll"]').each(function () {
1990      var $spy = $(this);
1991      $spy.scrollspy($spy.data());
1992    });
1993  });
1994
1995}(jQuery);
1996
1997// Generated by CoffeeScript 1.6.2
1998/*
1999jQuery Waypoints - v2.0.3
2000Copyright (c) 2011-2013 Caleb Troughton
2001Dual licensed under the MIT license and GPL license.
2002https://github.com/imakewebthings/jquery-waypoints/blob/master/licenses.txt
2003*/
2004
2005
2006(function() {
2007  var __indexOf = [].indexOf || function(item) { for (var i = 0, l = this.length; i < l; i++) { if (i in this && this[i] === item) return i; } return -1; },
2008    __slice = [].slice;
2009
2010  (function(root, factory) {
2011    if (typeof define === 'function' && define.amd) {
2012      return define('waypoints', ['jquery'], function($) {
2013        return factory($, root);
2014      });
2015    } else {
2016      return factory(root.jQuery, root);
2017    }
2018  })(this, function($, window) {
2019    var $w, Context, Waypoint, allWaypoints, contextCounter, contextKey, contexts, isTouch, jQMethods, methods, resizeEvent, scrollEvent, waypointCounter, waypointKey, wp, wps;
2020
2021    $w = $(window);
2022    isTouch = __indexOf.call(window, 'ontouchstart') >= 0;
2023    allWaypoints = {
2024      horizontal: {},
2025      vertical: {}
2026    };
2027    contextCounter = 1;
2028    contexts = {};
2029    contextKey = 'waypoints-context-id';
2030    resizeEvent = 'resize.waypoints';
2031    scrollEvent = 'scroll.waypoints';
2032    waypointCounter = 1;
2033    waypointKey = 'waypoints-waypoint-ids';
2034    wp = 'waypoint';
2035    wps = 'waypoints';
2036    Context = (function() {
2037      function Context($element) {
2038        var _this = this;
2039
2040        this.$element = $element;
2041        this.element = $element[0];
2042        this.didResize = false;
2043        this.didScroll = false;
2044        this.id = 'context' + contextCounter++;
2045        this.oldScroll = {
2046          x: $element.scrollLeft(),
2047          y: $element.scrollTop()
2048        };
2049        this.waypoints = {
2050          horizontal: {},
2051          vertical: {}
2052        };
2053        $element.data(contextKey, this.id);
2054        contexts[this.id] = this;
2055        $element.bind(scrollEvent, function() {
2056          var scrollHandler;
2057
2058          if (!(_this.didScroll || isTouch)) {
2059            _this.didScroll = true;
2060            scrollHandler = function() {
2061              _this.doScroll();
2062              return _this.didScroll = false;
2063            };
2064            return window.setTimeout(scrollHandler, $[wps].settings.scrollThrottle);
2065          }
2066        });
2067        $element.bind(resizeEvent, function() {
2068          var resizeHandler;
2069
2070          if (!_this.didResize) {
2071            _this.didResize = true;
2072            resizeHandler = function() {
2073              $[wps]('refresh');
2074              return _this.didResize = false;
2075            };
2076            return window.setTimeout(resizeHandler, $[wps].settings.resizeThrottle);
2077          }
2078        });
2079      }
2080
2081      Context.prototype.doScroll = function() {
2082        var axes,
2083          _this = this;
2084
2085        axes = {
2086          horizontal: {
2087            newScroll: this.$element.scrollLeft(),
2088            oldScroll: this.oldScroll.x,
2089            forward: 'right',
2090            backward: 'left'
2091          },
2092          vertical: {
2093            newScroll: this.$element.scrollTop(),
2094            oldScroll: this.oldScroll.y,
2095            forward: 'down',
2096            backward: 'up'
2097          }
2098        };
2099        if (isTouch && (!axes.vertical.oldScroll || !axes.vertical.newScroll)) {
2100          $[wps]('refresh');
2101        }
2102        $.each(axes, function(aKey, axis) {
2103          var direction, isForward, triggered;
2104
2105          triggered = [];
2106          isForward = axis.newScroll > axis.oldScroll;
2107          direction = isForward ? axis.forward : axis.backward;
2108          $.each(_this.waypoints[aKey], function(wKey, waypoint) {
2109            var _ref, _ref1;
2110
2111            if ((axis.oldScroll < (_ref = waypoint.offset) && _ref <= axis.newScroll)) {
2112              return triggered.push(waypoint);
2113            } else if ((axis.newScroll < (_ref1 = waypoint.offset) && _ref1 <= axis.oldScroll)) {
2114              return triggered.push(waypoint);
2115            }
2116          });
2117          triggered.sort(function(a, b) {
2118            return a.offset - b.offset;
2119          });
2120          if (!isForward) {
2121            triggered.reverse();
2122          }
2123          return $.each(triggered, function(i, waypoint) {
2124            if (waypoint.options.continuous || i === triggered.length - 1) {
2125              return waypoint.trigger([direction]);
2126            }
2127          });
2128        });
2129        return this.oldScroll = {
2130          x: axes.horizontal.newScroll,
2131          y: axes.vertical.newScroll
2132        };
2133      };
2134
2135      Context.prototype.refresh = function() {
2136        var axes, cOffset, isWin,
2137          _this = this;
2138
2139        isWin = $.isWindow(this.element);
2140        cOffset = this.$element.offset();
2141        this.doScroll();
2142        axes = {
2143          horizontal: {
2144            contextOffset: isWin ? 0 : cOffset.left,
2145            contextScroll: isWin ? 0 : this.oldScroll.x,
2146            contextDimension: this.$element.width(),
2147            oldScroll: this.oldScroll.x,
2148            forward: 'right',
2149            backward: 'left',
2150            offsetProp: 'left'
2151          },
2152          vertical: {
2153            contextOffset: isWin ? 0 : cOffset.top,
2154            contextScroll: isWin ? 0 : this.oldScroll.y,
2155            contextDimension: isWin ? $[wps]('viewportHeight') : this.$element.height(),
2156            oldScroll: this.oldScroll.y,
2157            forward: 'down',
2158            backward: 'up',
2159            offsetProp: 'top'
2160          }
2161        };
2162        return $.each(axes, function(aKey, axis) {
2163          return $.each(_this.waypoints[aKey], function(i, waypoint) {
2164            var adjustment, elementOffset, oldOffset, _ref, _ref1;
2165
2166            adjustment = waypoint.options.offset;
2167            oldOffset = waypoint.offset;
2168            elementOffset = $.isWindow(waypoint.element) ? 0 : waypoint.$element.offset()[axis.offsetProp];
2169            if ($.isFunction(adjustment)) {
2170              adjustment = adjustment.apply(waypoint.element);
2171            } else if (typeof adjustment === 'string') {
2172              adjustment = parseFloat(adjustment);
2173              if (waypoint.options.offset.indexOf('%') > -1) {
2174                adjustment = Math.ceil(axis.contextDimension * adjustment / 100);
2175              }
2176            }
2177            waypoint.offset = elementOffset - axis.contextOffset + axis.contextScroll - adjustment;
2178            if ((waypoint.options.onlyOnScroll && (oldOffset != null)) || !waypoint.enabled) {
2179              return;
2180            }
2181            if (oldOffset !== null && (oldOffset < (_ref = axis.oldScroll) && _ref <= waypoint.offset)) {
2182              return waypoint.trigger([axis.backward]);
2183            } else if (oldOffset !== null && (oldOffset > (_ref1 = axis.oldScroll) && _ref1 >= waypoint.offset)) {
2184              return waypoint.trigger([axis.forward]);
2185            } else if (oldOffset === null && axis.oldScroll >= waypoint.offset) {
2186              return waypoint.trigger([axis.forward]);
2187            }
2188          });
2189        });
2190      };
2191
2192      Context.prototype.checkEmpty = function() {
2193        if ($.isEmptyObject(this.waypoints.horizontal) && $.isEmptyObject(this.waypoints.vertical)) {
2194          this.$element.unbind([resizeEvent, scrollEvent].join(' '));
2195          return delete contexts[this.id];
2196        }
2197      };
2198
2199      return Context;
2200
2201    })();
2202    Waypoint = (function() {
2203      function Waypoint($element, context, options) {
2204        var idList, _ref;
2205
2206        options = $.extend({}, $.fn[wp].defaults, options);
2207        if (options.offset === 'bottom-in-view') {
2208          options.offset = function() {
2209            var contextHeight;
2210
2211            contextHeight = $[wps]('viewportHeight');
2212            if (!$.isWindow(context.element)) {
2213              contextHeight = context.$element.height();
2214            }
2215            return contextHeight - $(this).outerHeight();
2216          };
2217        }
2218        this.$element = $element;
2219        this.element = $element[0];
2220        this.axis = options.horizontal ? 'horizontal' : 'vertical';
2221        this.callback = options.handler;
2222        this.context = context;
2223        this.enabled = options.enabled;
2224        this.id = 'waypoints' + waypointCounter++;
2225        this.offset = null;
2226        this.options = options;
2227        context.waypoints[this.axis][this.id] = this;
2228        allWaypoints[this.axis][this.id] = this;
2229        idList = (_ref = $element.data(waypointKey)) != null ? _ref : [];
2230        idList.push(this.id);
2231        $element.data(waypointKey, idList);
2232      }
2233
2234      Waypoint.prototype.trigger = function(args) {
2235        if (!this.enabled) {
2236          return;
2237        }
2238        if (this.callback != null) {
2239          this.callback.apply(this.element, args);
2240        }
2241        if (this.options.triggerOnce) {
2242          return this.destroy();
2243        }
2244      };
2245
2246      Waypoint.prototype.disable = function() {
2247        return this.enabled = false;
2248      };
2249
2250      Waypoint.prototype.enable = function() {
2251        this.context.refresh();
2252        return this.enabled = true;
2253      };
2254
2255      Waypoint.prototype.destroy = function() {
2256        delete allWaypoints[this.axis][this.id];
2257        delete this.context.waypoints[this.axis][this.id];
2258        return this.context.checkEmpty();
2259      };
2260
2261      Waypoint.getWaypointsByElement = function(element) {
2262        var all, ids;
2263
2264        ids = $(element).data(waypointKey);
2265        if (!ids) {
2266          return [];
2267        }
2268        all = $.extend({}, allWaypoints.horizontal, allWaypoints.vertical);
2269        return $.map(ids, function(id) {
2270          return all[id];
2271        });
2272      };
2273
2274      return Waypoint;
2275
2276    })();
2277    methods = {
2278      init: function(f, options) {
2279        var _ref;
2280
2281        if (options == null) {
2282          options = {};
2283        }
2284        if ((_ref = options.handler) == null) {
2285          options.handler = f;
2286        }
2287        this.each(function() {
2288          var $this, context, contextElement, _ref1;
2289
2290          $this = $(this);
2291          contextElement = (_ref1 = options.context) != null ? _ref1 : $.fn[wp].defaults.context;
2292          if (!$.isWindow(contextElement)) {
2293            contextElement = $this.closest(contextElement);
2294          }
2295          contextElement = $(contextElement);
2296          context = contexts[contextElement.data(contextKey)];
2297          if (!context) {
2298            context = new Context(contextElement);
2299          }
2300          return new Waypoint($this, context, options);
2301        });
2302        $[wps]('refresh');
2303        return this;
2304      },
2305      disable: function() {
2306        return methods._invoke(this, 'disable');
2307      },
2308      enable: function() {
2309        return methods._invoke(this, 'enable');
2310      },
2311      destroy: function() {
2312        return methods._invoke(this, 'destroy');
2313      },
2314      prev: function(axis, selector) {
2315        return methods._traverse.call(this, axis, selector, function(stack, index, waypoints) {
2316          if (index > 0) {
2317            return stack.push(waypoints[index - 1]);
2318          }
2319        });
2320      },
2321      next: function(axis, selector) {
2322        return methods._traverse.call(this, axis, selector, function(stack, index, waypoints) {
2323          if (index < waypoints.length - 1) {
2324            return stack.push(waypoints[index + 1]);
2325          }
2326        });
2327      },
2328      _traverse: function(axis, selector, push) {
2329        var stack, waypoints;
2330
2331        if (axis == null) {
2332          axis = 'vertical';
2333        }
2334        if (selector == null) {
2335          selector = window;
2336        }
2337        waypoints = jQMethods.aggregate(selector);
2338        stack = [];
2339        this.each(function() {
2340          var index;
2341
2342          index = $.inArray(this, waypoints[axis]);
2343          return push(stack, index, waypoints[axis]);
2344        });
2345        return this.pushStack(stack);
2346      },
2347      _invoke: function($elements, method) {
2348        $elements.each(function() {
2349          var waypoints;
2350
2351          waypoints = Waypoint.getWaypointsByElement(this);
2352          return $.each(waypoints, function(i, waypoint) {
2353            waypoint[method]();
2354            return true;
2355          });
2356        });
2357        return this;
2358      }
2359    };
2360    $.fn[wp] = function() {
2361      var args, method;
2362
2363      method = arguments[0], args = 2 <= arguments.length ? __slice.call(arguments, 1) : [];
2364      if (methods[method]) {
2365        return methods[method].apply(this, args);
2366      } else if ($.isFunction(method)) {
2367        return methods.init.apply(this, arguments);
2368      } else if ($.isPlainObject(method)) {
2369        return methods.init.apply(this, [null, method]);
2370      } else if (!method) {
2371        return $.error("jQuery Waypoints needs a callback function or handler option.");
2372      } else {
2373        return $.error("The " + method + " method does not exist in jQuery Waypoints.");
2374      }
2375    };
2376    $.fn[wp].defaults = {
2377      context: window,
2378      continuous: true,
2379      enabled: true,
2380      horizontal: false,
2381      offset: 0,
2382      triggerOnce: false
2383    };
2384    jQMethods = {
2385      refresh: function() {
2386        return $.each(contexts, function(i, context) {
2387          return context.refresh();
2388        });
2389      },
2390      viewportHeight: function() {
2391        var _ref;
2392
2393        return (_ref = window.innerHeight) != null ? _ref : $w.height();
2394      },
2395      aggregate: function(contextSelector) {
2396        var collection, waypoints, _ref;
2397
2398        collection = allWaypoints;
2399        if (contextSelector) {
2400          collection = (_ref = contexts[$(contextSelector).data(contextKey)]) != null ? _ref.waypoints : void 0;
2401        }
2402        if (!collection) {
2403          return [];
2404        }
2405        waypoints = {
2406          horizontal: [],
2407          vertical: []
2408        };
2409        $.each(waypoints, function(axis, arr) {
2410          $.each(collection[axis], function(key, waypoint) {
2411            return arr.push(waypoint);
2412          });
2413          arr.sort(function(a, b) {
2414            return a.offset - b.offset;
2415          });
2416          waypoints[axis] = $.map(arr, function(waypoint) {
2417            return waypoint.element;
2418          });
2419          return waypoints[axis] = $.unique(waypoints[axis]);
2420        });
2421        return waypoints;
2422      },
2423      above: function(contextSelector) {
2424        if (contextSelector == null) {
2425          contextSelector = window;
2426        }
2427        return jQMethods._filter(contextSelector, 'vertical', function(context, waypoint) {
2428          return waypoint.offset <= context.oldScroll.y;
2429        });
2430      },
2431      below: function(contextSelector) {
2432        if (contextSelector == null) {
2433          contextSelector = window;
2434        }
2435        return jQMethods._filter(contextSelector, 'vertical', function(context, waypoint) {
2436          return waypoint.offset > context.oldScroll.y;
2437        });
2438      },
2439      left: function(contextSelector) {
2440        if (contextSelector == null) {
2441          contextSelector = window;
2442        }
2443        return jQMethods._filter(contextSelector, 'horizontal', function(context, waypoint) {
2444          return waypoint.offset <= context.oldScroll.x;
2445        });
2446      },
2447      right: function(contextSelector) {
2448        if (contextSelector == null) {
2449          contextSelector = window;
2450        }
2451        return jQMethods._filter(contextSelector, 'horizontal', function(context, waypoint) {
2452          return waypoint.offset > context.oldScroll.x;
2453        });
2454      },
2455      enable: function() {
2456        return jQMethods._invoke('enable');
2457      },
2458      disable: function() {
2459        return jQMethods._invoke('disable');
2460      },
2461      destroy: function() {
2462        return jQMethods._invoke('destroy');
2463      },
2464      extendFn: function(methodName, f) {
2465        return methods[methodName] = f;
2466      },
2467      _invoke: function(method) {
2468        var waypoints;
2469
2470        waypoints = $.extend({}, allWaypoints.vertical, allWaypoints.horizontal);
2471        return $.each(waypoints, function(key, waypoint) {
2472          waypoint[method]();
2473          return true;
2474        });
2475      },
2476      _filter: function(selector, axis, test) {
2477        var context, waypoints;
2478
2479        context = contexts[$(selector).data(contextKey)];
2480        if (!context) {
2481          return [];
2482        }
2483        waypoints = [];
2484        $.each(context.waypoints[axis], function(i, waypoint) {
2485          if (test(context, waypoint)) {
2486            return waypoints.push(waypoint);
2487          }
2488        });
2489        waypoints.sort(function(a, b) {
2490          return a.offset - b.offset;
2491        });
2492        return $.map(waypoints, function(waypoint) {
2493          return waypoint.element;
2494        });
2495      }
2496    };
2497    $[wps] = function() {
2498      var args, method;
2499
2500      method = arguments[0], args = 2 <= arguments.length ? __slice.call(arguments, 1) : [];
2501      if (jQMethods[method]) {
2502        return jQMethods[method].apply(null, args);
2503      } else {
2504        return jQMethods.aggregate.call(null, method);
2505      }
2506    };
2507    $[wps].settings = {
2508      resizeThrottle: 100,
2509      scrollThrottle: 30
2510    };
2511    return $w.load(function() {
2512      return $[wps]('refresh');
2513    });
2514  });
2515
2516}).call(this);
2517
2518/*! http://mths.be/placeholder v2.0.7 by @mathias */
2519;(function(window, document, $) {
2520
2521	var isInputSupported = 'placeholder' in document.createElement('input');
2522	var isTextareaSupported = 'placeholder' in document.createElement('textarea');
2523	var prototype = $.fn;
2524	var valHooks = $.valHooks;
2525	var propHooks = $.propHooks;
2526	var hooks;
2527	var placeholder;
2528
2529	if (isInputSupported && isTextareaSupported) {
2530
2531		placeholder = prototype.placeholder = function() {
2532			return this;
2533		};
2534
2535		placeholder.input = placeholder.textarea = true;
2536
2537	} else {
2538
2539		placeholder = prototype.placeholder = function() {
2540			var $this = this;
2541			$this
2542				.filter((isInputSupported ? 'textarea' : ':input') + '[placeholder]')
2543				.not('.placeholder')
2544				.bind({
2545					'focus.placeholder': clearPlaceholder,
2546					'blur.placeholder': setPlaceholder
2547				})
2548				.data('placeholder-enabled', true)
2549				.trigger('blur.placeholder');
2550			return $this;
2551		};
2552
2553		placeholder.input = isInputSupported;
2554		placeholder.textarea = isTextareaSupported;
2555
2556		hooks = {
2557			'get': function(element) {
2558				var $element = $(element);
2559
2560				var $passwordInput = $element.data('placeholder-password');
2561				if ($passwordInput) {
2562					return $passwordInput[0].value;
2563				}
2564
2565				return $element.data('placeholder-enabled') && $element.hasClass('placeholder') ? '' : element.value;
2566			},
2567			'set': function(element, value) {
2568				var $element = $(element);
2569
2570				var $passwordInput = $element.data('placeholder-password');
2571				if ($passwordInput) {
2572					return $passwordInput[0].value = value;
2573				}
2574
2575				if (!$element.data('placeholder-enabled')) {
2576					return element.value = value;
2577				}
2578				if (value == '') {
2579					element.value = value;
2580					// Issue #56: Setting the placeholder causes problems if the element continues to have focus.
2581					if (element != safeActiveElement()) {
2582						// We can't use `triggerHandler` here because of dummy text/password inputs :(
2583						setPlaceholder.call(element);
2584					}
2585				} else if ($element.hasClass('placeholder')) {
2586					clearPlaceholder.call(element, true, value) || (element.value = value);
2587				} else {
2588					element.value = value;
2589				}
2590				// `set` can not return `undefined`; see http://jsapi.info/jquery/1.7.1/val#L2363
2591				return $element;
2592			}
2593		};
2594
2595		if (!isInputSupported) {
2596			valHooks.input = hooks;
2597			propHooks.value = hooks;
2598		}
2599		if (!isTextareaSupported) {
2600			valHooks.textarea = hooks;
2601			propHooks.value = hooks;
2602		}
2603
2604		$(function() {
2605			// Look for forms
2606			$(document).delegate('form', 'submit.placeholder', function() {
2607				// Clear the placeholder values so they don't get submitted
2608				var $inputs = $('.placeholder', this).each(clearPlaceholder);
2609				setTimeout(function() {
2610					$inputs.each(setPlaceholder);
2611				}, 10);
2612			});
2613		});
2614
2615		// Clear placeholder values upon page reload
2616		$(window).bind('beforeunload.placeholder', function() {
2617			$('.placeholder').each(function() {
2618				this.value = '';
2619			});
2620		});
2621
2622	}
2623
2624	function args(elem) {
2625		// Return an object of element attributes
2626		var newAttrs = {};
2627		var rinlinejQuery = /^jQuery\d+$/;
2628		$.each(elem.attributes, function(i, attr) {
2629			if (attr.specified && !rinlinejQuery.test(attr.name)) {
2630				newAttrs[attr.name] = attr.value;
2631			}
2632		});
2633		return newAttrs;
2634	}
2635
2636	function clearPlaceholder(event, value) {
2637		var input = this;
2638		var $input = $(input);
2639		if (input.value == $input.attr('placeholder') && $input.hasClass('placeholder')) {
2640			if ($input.data('placeholder-password')) {
2641				$input = $input.hide().next().show().attr('id', $input.removeAttr('id').data('placeholder-id'));
2642				// If `clearPlaceholder` was called from `$.valHooks.input.set`
2643				if (event === true) {
2644					return $input[0].value = value;
2645				}
2646				$input.focus();
2647			} else {
2648				input.value = '';
2649				$input.removeClass('placeholder');
2650				input == safeActiveElement() && input.select();
2651			}
2652		}
2653	}
2654
2655	function setPlaceholder() {
2656		var $replacement;
2657		var input = this;
2658		var $input = $(input);
2659		var id = this.id;
2660		if (input.value == '') {
2661			if (input.type == 'password') {
2662				if (!$input.data('placeholder-textinput')) {
2663					try {
2664						$replacement = $input.clone().attr({ 'type': 'text' });
2665					} catch(e) {
2666						$replacement = $('<input>').attr($.extend(args(this), { 'type': 'text' }));
2667					}
2668					$replacement
2669						.removeAttr('name')
2670						.data({
2671							'placeholder-password': $input,
2672							'placeholder-id': id
2673						})
2674						.bind('focus.placeholder', clearPlaceholder);
2675					$input
2676						.data({
2677							'placeholder-textinput': $replacement,
2678							'placeholder-id': id
2679						})
2680						.before($replacement);
2681				}
2682				$input = $input.removeAttr('id').hide().prev().attr('id', id).show();
2683				// Note: `$input[0] != input` now!
2684			}
2685			$input.addClass('placeholder');
2686			$input[0].value = $input.attr('placeholder');
2687		} else {
2688			$input.removeClass('placeholder');
2689		}
2690	}
2691
2692	function safeActiveElement() {
2693		// Avoid IE9 `document.activeElement` of death
2694		// https://github.com/mathiasbynens/jquery-placeholder/pull/99
2695		try {
2696			return document.activeElement;
2697		} catch (err) {}
2698	}
2699
2700}(this, document, jQuery));
2701
2702/**
2703 * Isotope v1.5.25
2704 * An exquisite jQuery plugin for magical layouts
2705 * http://isotope.metafizzy.co
2706 *
2707 * Commercial use requires one-time purchase of a commercial license
2708 * http://isotope.metafizzy.co/docs/license.html
2709 *
2710 * Non-commercial use is licensed under the MIT License
2711 *
2712 * Copyright 2013 Metafizzy
2713 */
2714
2715/*jshint asi: true, browser: true, curly: true, eqeqeq: true, forin: false, immed: false, newcap: true, noempty: true, strict: true, undef: true */
2716/*global jQuery: false */
2717
2718(function( window, $, undefined ){
2719
2720  'use strict';
2721
2722  // get global vars
2723  var document = window.document;
2724  var Modernizr = window.Modernizr;
2725
2726  // helper function
2727  var capitalize = function( str ) {
2728    return str.charAt(0).toUpperCase() + str.slice(1);
2729  };
2730
2731  // ========================= getStyleProperty by kangax ===============================
2732  // http://perfectionkills.com/feature-testing-css-properties/
2733
2734  var prefixes = 'Moz Webkit O Ms'.split(' ');
2735
2736  var getStyleProperty = function( propName ) {
2737    var style = document.documentElement.style,
2738        prefixed;
2739
2740    // test standard property first
2741    if ( typeof style[propName] === 'string' ) {
2742      return propName;
2743    }
2744
2745    // capitalize
2746    propName = capitalize( propName );
2747
2748    // test vendor specific properties
2749    for ( var i=0, len = prefixes.length; i < len; i++ ) {
2750      prefixed = prefixes[i] + propName;
2751      if ( typeof style[ prefixed ] === 'string' ) {
2752        return prefixed;
2753      }
2754    }
2755  };
2756
2757  var transformProp = getStyleProperty('transform'),
2758      transitionProp = getStyleProperty('transitionProperty');
2759
2760
2761  // ========================= miniModernizr ===============================
2762  // <3<3<3 and thanks to Faruk and Paul for doing the heavy lifting
2763
2764  /*!
2765   * Modernizr v1.6ish: miniModernizr for Isotope
2766   * http://www.modernizr.com
2767   *
2768   * Developed by:
2769   * - Faruk Ates  http://farukat.es/
2770   * - Paul Irish  http://paulirish.com/
2771   *
2772   * Copyright (c) 2009-2010
2773   * Dual-licensed under the BSD or MIT licenses.
2774   * http://www.modernizr.com/license/
2775   */
2776
2777  /*
2778   * This version whittles down the script just to check support for
2779   * CSS transitions, transforms, and 3D transforms.
2780  */
2781
2782  var tests = {
2783    csstransforms: function() {
2784      return !!transformProp;
2785    },
2786
2787    csstransforms3d: function() {
2788      var test = !!getStyleProperty('perspective');
2789      // double check for Chrome's false positive
2790      if ( test ) {
2791        var vendorCSSPrefixes = ' -o- -moz- -ms- -webkit- -khtml- '.split(' '),
2792            mediaQuery = '@media (' + vendorCSSPrefixes.join('transform-3d),(') + 'modernizr)',
2793            $style = $('<style>' + mediaQuery + '{#modernizr{height:3px}}' + '</style>')
2794                        .appendTo('head'),
2795            $div = $('<div id="modernizr" />').appendTo('html');
2796
2797        test = $div.height() === 3;
2798
2799        $div.remove();
2800        $style.remove();
2801      }
2802      return test;
2803    },
2804
2805    csstransitions: function() {
2806      return !!transitionProp;
2807    }
2808  };
2809
2810  var testName;
2811
2812  if ( Modernizr ) {
2813    // if there's a previous Modernzir, check if there are necessary tests
2814    for ( testName in tests) {
2815      if ( !Modernizr.hasOwnProperty( testName ) ) {
2816        // if test hasn't been run, use addTest to run it
2817        Modernizr.addTest( testName, tests[ testName ] );
2818      }
2819    }
2820  } else {
2821    // or create new mini Modernizr that just has the 3 tests
2822    Modernizr = window.Modernizr = {
2823      _version : '1.6ish: miniModernizr for Isotope'
2824    };
2825
2826    var classes = ' ';
2827    var result;
2828
2829    // Run through tests
2830    for ( testName in tests) {
2831      result = tests[ testName ]();
2832      Modernizr[ testName ] = result;
2833      classes += ' ' + ( result ?  '' : 'no-' ) + testName;
2834    }
2835
2836    // Add the new classes to the <html> element.
2837    $('html').addClass( classes );
2838  }
2839
2840
2841  // ========================= isoTransform ===============================
2842
2843  /**
2844   *  provides hooks for .css({ scale: value, translate: [x, y] })
2845   *  Progressively enhanced CSS transforms
2846   *  Uses hardware accelerated 3D transforms for Safari
2847   *  or falls back to 2D transforms.
2848   */
2849
2850  if ( Modernizr.csstransforms ) {
2851
2852        // i.e. transformFnNotations.scale(0.5) >> 'scale3d( 0.5, 0.5, 1)'
2853    var transformFnNotations = Modernizr.csstransforms3d ?
2854      { // 3D transform functions
2855        translate : function ( position ) {
2856          return 'translate3d(' + position[0] + 'px, ' + position[1] + 'px, 0) ';
2857        },
2858        scale : function ( scale ) {
2859          return 'scale3d(' + scale + ', ' + scale + ', 1) ';
2860        }
2861      } :
2862      { // 2D transform functions
2863        translate : function ( position ) {
2864          return 'translate(' + position[0] + 'px, ' + position[1] + 'px) ';
2865        },
2866        scale : function ( scale ) {
2867          return 'scale(' + scale + ') ';
2868        }
2869      }
2870    ;
2871
2872    var setIsoTransform = function ( elem, name, value ) {
2873          // unpack current transform data
2874      var data =  $.data( elem, 'isoTransform' ) || {},
2875          newData = {},
2876          fnName,
2877          transformObj = {},
2878          transformValue;
2879
2880      // i.e. newData.scale = 0.5
2881      newData[ name ] = value;
2882      // extend new value over current data
2883      $.extend( data, newData );
2884
2885      for ( fnName in data ) {
2886        transformValue = data[ fnName ];
2887        transformObj[ fnName ] = transformFnNotations[ fnName ]( transformValue );
2888      }
2889
2890      // get proper order
2891      // ideally, we could loop through this give an array, but since we only have
2892      // a couple transforms we're keeping track of, we'll do it like so
2893      var translateFn = transformObj.translate || '',
2894          scaleFn = transformObj.scale || '',
2895          // sorting so translate always comes first
2896          valueFns = translateFn + scaleFn;
2897
2898      // set data back in elem
2899      $.data( elem, 'isoTransform', data );
2900
2901      // set name to vendor specific property
2902      elem.style[ transformProp ] = valueFns;
2903    };
2904
2905    // ==================== scale ===================
2906
2907    $.cssNumber.scale = true;
2908
2909    $.cssHooks.scale = {
2910      set: function( elem, value ) {
2911        // uncomment this bit if you want to properly parse strings
2912        // if ( typeof value === 'string' ) {
2913        //   value = parseFloat( value );
2914        // }
2915        setIsoTransform( elem, 'scale', value );
2916      },
2917      get: function( elem, computed ) {
2918        var transform = $.data( elem, 'isoTransform' );
2919        return transform && transform.scale ? transform.scale : 1;
2920      }
2921    };
2922
2923    $.fx.step.scale = function( fx ) {
2924      $.cssHooks.scale.set( fx.elem, fx.now+fx.unit );
2925    };
2926
2927
2928    // ==================== translate ===================
2929
2930    $.cssNumber.translate = true;
2931
2932    $.cssHooks.translate = {
2933      set: function( elem, value ) {
2934
2935        // uncomment this bit if you want to properly parse strings
2936        // if ( typeof value === 'string' ) {
2937        //   value = value.split(' ');
2938        // }
2939        //
2940        // var i, val;
2941        // for ( i = 0; i < 2; i++ ) {
2942        //   val = value[i];
2943        //   if ( typeof val === 'string' ) {
2944        //     val = parseInt( val );
2945        //   }
2946        // }
2947
2948        setIsoTransform( elem, 'translate', value );
2949      },
2950
2951      get: function( elem, computed ) {
2952        var transform = $.data( elem, 'isoTransform' );
2953        return transform && transform.translate ? transform.translate : [ 0, 0 ];
2954      }
2955    };
2956
2957  }
2958
2959  // ========================= get transition-end event ===============================
2960  var transitionEndEvent, transitionDurProp;
2961
2962  if ( Modernizr.csstransitions ) {
2963    transitionEndEvent = {
2964      WebkitTransitionProperty: 'webkitTransitionEnd',  // webkit
2965      MozTransitionProperty: 'transitionend',
2966      OTransitionProperty: 'oTransitionEnd otransitionend',
2967      transitionProperty: 'transitionend'
2968    }[ transitionProp ];
2969
2970    transitionDurProp = getStyleProperty('transitionDuration');
2971  }
2972
2973  // ========================= smartresize ===============================
2974
2975  /*
2976   * smartresize: debounced resize event for jQuery
2977   *
2978   * latest version and complete README available on Github:
2979   * https://github.com/louisremi/jquery.smartresize.js
2980   *
2981   * Copyright 2011 @louis_remi
2982   * Licensed under the MIT license.
2983   */
2984
2985  var $event = $.event,
2986      dispatchMethod = $.event.handle ? 'handle' : 'dispatch',
2987      resizeTimeout;
2988
2989  $event.special.smartresize = {
2990    setup: function() {
2991      $(this).bind( "resize", $event.special.smartresize.handler );
2992    },
2993    teardown: function() {
2994      $(this).unbind( "resize", $event.special.smartresize.handler );
2995    },
2996    handler: function( event, execAsap ) {
2997      // Save the context
2998      var context = this,
2999          args = arguments;
3000
3001      // set correct event type
3002      event.type = "smartresize";
3003
3004      if ( resizeTimeout ) { clearTimeout( resizeTimeout ); }
3005      resizeTimeout = setTimeout(function() {
3006        $event[ dispatchMethod ].apply( context, args );
3007      }, execAsap === "execAsap"? 0 : 100 );
3008    }
3009  };
3010
3011  $.fn.smartresize = function( fn ) {
3012    return fn ? this.bind( "smartresize", fn ) : this.trigger( "smartresize", ["execAsap"] );
3013  };
3014
3015
3016
3017// ========================= Isotope ===============================
3018
3019
3020  // our "Widget" object constructor
3021  $.Isotope = function( options, element, callback ){
3022    this.element = $( element );
3023
3024    this._create( options );
3025    this._init( callback );
3026  };
3027
3028  // styles of container element we want to keep track of
3029  var isoContainerStyles = [ 'width', 'height' ];
3030
3031  var $window = $(window);
3032
3033  $.Isotope.settings = {
3034    resizable: true,
3035    layoutMode : 'masonry',
3036    containerClass : 'isotope',
3037    itemClass : 'isotope-item',
3038    hiddenClass : 'isotope-hidden',
3039    hiddenStyle: { opacity: 0, scale: 0.001 },
3040    visibleStyle: { opacity: 1, scale: 1 },
3041    containerStyle: {
3042      position: 'relative',
3043      overflow: 'hidden'
3044    },
3045    animationEngine: 'best-available',
3046    animationOptions: {
3047      queue: false,
3048      duration: 800
3049    },
3050    sortBy : 'original-order',
3051    sortAscending : true,
3052    resizesContainer : true,
3053    transformsEnabled: true,
3054    itemPositionDataEnabled: false
3055  };
3056
3057  $.Isotope.prototype = {
3058
3059    // sets up widget
3060    _create : function( options ) {
3061
3062      this.options = $.extend( {}, $.Isotope.settings, options );
3063
3064      this.styleQueue = [];
3065      this.elemCount = 0;
3066
3067      // get original styles in case we re-apply them in .destroy()
3068      var elemStyle = this.element[0].style;
3069      this.originalStyle = {};
3070      // keep track of container styles
3071      var containerStyles = isoContainerStyles.slice(0);
3072      for ( var prop in this.options.containerStyle ) {
3073        containerStyles.push( prop );
3074      }
3075      for ( var i=0, len = containerStyles.length; i < len; i++ ) {
3076        prop = containerStyles[i];
3077        this.originalStyle[ prop ] = elemStyle[ prop ] || '';
3078      }
3079      // apply container style from options
3080      this.element.css( this.options.containerStyle );
3081
3082      this._updateAnimationEngine();
3083      this._updateUsingTransforms();
3084
3085      // sorting
3086      var originalOrderSorter = {
3087        'original-order' : function( $elem, instance ) {
3088          instance.elemCount ++;
3089          return instance.elemCount;
3090        },
3091        random : function() {
3092          return Math.random();
3093        }
3094      };
3095
3096      this.options.getSortData = $.extend( this.options.getSortData, originalOrderSorter );
3097
3098      // need to get atoms
3099      this.reloadItems();
3100
3101      // get top left position of where the bricks should be
3102      this.offset = {
3103        left: parseInt( ( this.element.css('padding-left') || 0 ), 10 ),
3104        top: parseInt( ( this.element.css('padding-top') || 0 ), 10 )
3105      };
3106
3107      // add isotope class first time around
3108      var instance = this;
3109      setTimeout( function() {
3110        instance.element.addClass( instance.options.containerClass );
3111      }, 0 );
3112
3113      // bind resize method
3114      if ( this.options.resizable ) {
3115        $window.bind( 'smartresize.isotope', function() {
3116          instance.resize();
3117        });
3118      }
3119
3120      // dismiss all click events from hidden events
3121      this.element.delegate( '.' + this.options.hiddenClass, 'click', function(){
3122        return false;
3123      });
3124
3125    },
3126
3127    _getAtoms : function( $elems ) {
3128      var selector = this.options.itemSelector,
3129          // filter & find
3130          $atoms = selector ? $elems.filter( selector ).add( $elems.find( selector ) ) : $elems,
3131          // base style for atoms
3132          atomStyle = { position: 'absolute' };
3133
3134      // filter out text nodes
3135      $atoms = $atoms.filter( function( i, atom ) {
3136        return atom.nodeType === 1;
3137      });
3138
3139      if ( this.usingTransforms ) {
3140        atomStyle.left = 0;
3141        atomStyle.top = 0;
3142      }
3143
3144      $atoms.css( atomStyle ).addClass( this.options.itemClass );
3145
3146      this.updateSortData( $atoms, true );
3147
3148      return $atoms;
3149    },
3150
3151    // _init fires when your instance is first created
3152    // (from the constructor above), and when you
3153    // attempt to initialize the widget again (by the bridge)
3154    // after it has already been initialized.
3155    _init : function( callback ) {
3156
3157      this.$filteredAtoms = this._filter( this.$allAtoms );
3158      this._sort();
3159      this.reLayout( callback );
3160
3161    },
3162
3163    option : function( opts ){
3164      // change options AFTER initialization:
3165      // signature: $('#foo').bar({ cool:false });
3166      if ( $.isPlainObject( opts ) ){
3167        this.options = $.extend( true, this.options, opts );
3168
3169        // trigger _updateOptionName if it exists
3170        var updateOptionFn;
3171        for ( var optionName in opts ) {
3172          updateOptionFn = '_update' + capitalize( optionName );
3173          if ( this[ updateOptionFn ] ) {
3174            this[ updateOptionFn ]();
3175          }
3176        }
3177      }
3178    },
3179
3180    // ====================== updaters ====================== //
3181    // kind of like setters
3182
3183    _updateAnimationEngine : function() {
3184      var animationEngine = this.options.animationEngine.toLowerCase().replace( /[ _\-]/g, '');
3185      var isUsingJQueryAnimation;
3186      // set applyStyleFnName
3187      switch ( animationEngine ) {
3188        case 'css' :
3189        case 'none' :
3190          isUsingJQueryAnimation = false;
3191          break;
3192        case 'jquery' :
3193          isUsingJQueryAnimation = true;
3194          break;
3195        default : // best available
3196          isUsingJQueryAnimation = !Modernizr.csstransitions;
3197      }
3198      this.isUsingJQueryAnimation = isUsingJQueryAnimation;
3199      this._updateUsingTransforms();
3200    },
3201
3202    _updateTransformsEnabled : function() {
3203      this._updateUsingTransforms();
3204    },
3205
3206    _updateUsingTransforms : function() {
3207      var usingTransforms = this.usingTransforms = this.options.transformsEnabled &&
3208        Modernizr.csstransforms && Modernizr.csstransitions && !this.isUsingJQueryAnimation;
3209
3210      // prevent scales when transforms are disabled
3211      if ( !usingTransforms ) {
3212        delete this.options.hiddenStyle.scale;
3213        delete this.options.visibleStyle.scale;
3214      }
3215
3216      this.getPositionStyles = usingTransforms ? this._translate : this._positionAbs;
3217    },
3218
3219
3220    // ====================== Filtering ======================
3221
3222    _filter : function( $atoms ) {
3223      var filter = this.options.filter === '' ? '*' : this.options.filter;
3224
3225      if ( !filter ) {
3226        return $atoms;
3227      }
3228
3229      var hiddenClass    = this.options.hiddenClass,
3230          hiddenSelector = '.' + hiddenClass,
3231          $hiddenAtoms   = $atoms.filter( hiddenSelector ),
3232          $atomsToShow   = $hiddenAtoms;
3233
3234      if ( filter !== '*' ) {
3235        $atomsToShow = $hiddenAtoms.filter( filter );
3236        var $atomsToHide = $atoms.not( hiddenSelector ).not( filter ).addClass( hiddenClass );
3237        this.styleQueue.push({ $el: $atomsToHide, style: this.options.hiddenStyle });
3238      }
3239
3240      this.styleQueue.push({ $el: $atomsToShow, style: this.options.visibleStyle });
3241      $atomsToShow.removeClass( hiddenClass );
3242
3243      return $atoms.filter( filter );
3244    },
3245
3246    // ====================== Sorting ======================
3247
3248    updateSortData : function( $atoms, isIncrementingElemCount ) {
3249      var instance = this,
3250          getSortData = this.options.getSortData,
3251          $this, sortData;
3252      $atoms.each(function(){
3253        $this = $(this);
3254        sortData = {};
3255        // get value for sort data based on fn( $elem ) passed in
3256        for ( var key in getSortData ) {
3257          if ( !isIncrementingElemCount && key === 'original-order' ) {
3258            // keep original order original
3259            sortData[ key ] = $.data( this, 'isotope-sort-data' )[ key ];
3260          } else {
3261            sortData[ key ] = getSortData[ key ]( $this, instance );
3262          }
3263        }
3264        // apply sort data to element
3265        $.data( this, 'isotope-sort-data', sortData );
3266      });
3267    },
3268
3269    // used on all the filtered atoms
3270    _sort : function() {
3271
3272      var sortBy = this.options.sortBy,
3273          getSorter = this._getSorter,
3274          sortDir = this.options.sortAscending ? 1 : -1,
3275          sortFn = function( alpha, beta ) {
3276            var a = getSorter( alpha, sortBy ),
3277                b = getSorter( beta, sortBy );
3278            // fall back to original order if data matches
3279            if ( a === b && sortBy !== 'original-order') {
3280              a = getSorter( alpha, 'original-order' );
3281              b = getSorter( beta, 'original-order' );
3282            }
3283            return ( ( a > b ) ? 1 : ( a < b ) ? -1 : 0 ) * sortDir;
3284          };
3285
3286      this.$filteredAtoms.sort( sortFn );
3287    },
3288
3289    _getSorter : function( elem, sortBy ) {
3290      return $.data( elem, 'isotope-sort-data' )[ sortBy ];
3291    },
3292
3293    // ====================== Layout Helpers ======================
3294
3295    _translate : function( x, y ) {
3296      return { translate : [ x, y ] };
3297    },
3298
3299    _positionAbs : function( x, y ) {
3300      return { left: x, top: y };
3301    },
3302
3303    _pushPosition : function( $elem, x, y ) {
3304      x = Math.round( x + this.offset.left );
3305      y = Math.round( y + this.offset.top );
3306      var position = this.getPositionStyles( x, y );
3307      this.styleQueue.push({ $el: $elem, style: position });
3308      if ( this.options.itemPositionDataEnabled ) {
3309        $elem.data('isotope-item-position', {x: x, y: y} );
3310      }
3311    },
3312
3313
3314    // ====================== General Layout ======================
3315
3316    // used on collection of atoms (should be filtered, and sorted before )
3317    // accepts atoms-to-be-laid-out to start with
3318    layout : function( $elems, callback ) {
3319
3320      var layoutMode = this.options.layoutMode;
3321
3322      // layout logic
3323      this[ '_' +  layoutMode + 'Layout' ]( $elems );
3324
3325      // set the size of the container
3326      if ( this.options.resizesContainer ) {
3327        var containerStyle = this[ '_' +  layoutMode + 'GetContainerSize' ]();
3328        this.styleQueue.push({ $el: this.element, style: containerStyle });
3329      }
3330
3331      this._processStyleQueue( $elems, callback );
3332
3333      this.isLaidOut = true;
3334    },
3335
3336    _processStyleQueue : function( $elems, callback ) {
3337      // are we animating the layout arrangement?
3338      // use plugin-ish syntax for css or animate
3339      var styleFn = !this.isLaidOut ? 'css' : (
3340            this.isUsingJQueryAnimation ? 'animate' : 'css'
3341          ),
3342          animOpts = this.options.animationOptions,
3343          onLayout = this.options.onLayout,
3344          objStyleFn, processor,
3345          triggerCallbackNow, callbackFn;
3346
3347      // default styleQueue processor, may be overwritten down below
3348      processor = function( i, obj ) {
3349        obj.$el[ styleFn ]( obj.style, animOpts );
3350      };
3351
3352      if ( this._isInserting && this.isUsingJQueryAnimation ) {
3353        // if using styleQueue to insert items
3354        processor = function( i, obj ) {
3355          // only animate if it not being inserted
3356          objStyleFn = obj.$el.hasClass('no-transition') ? 'css' : styleFn;
3357          obj.$el[ objStyleFn ]( obj.style, animOpts );
3358        };
3359
3360      } else if ( callback || onLayout || animOpts.complete ) {
3361        // has callback
3362        var isCallbackTriggered = false,
3363            // array of possible callbacks to trigger
3364            callbacks = [ callback, onLayout, animOpts.complete ],
3365            instance = this;
3366        triggerCallbackNow = true;
3367        // trigger callback only once
3368        callbackFn = function() {
3369          if ( isCallbackTriggered ) {
3370            return;
3371          }
3372          var hollaback;
3373          for (var i=0, len = callbacks.length; i < len; i++) {
3374            hollaback = callbacks[i];
3375            if ( typeof hollaback === 'function' ) {
3376              hollaback.call( instance.element, $elems, instance );
3377            }
3378          }
3379          isCallbackTriggered = true;
3380        };
3381
3382        if ( this.isUsingJQueryAnimation && styleFn === 'animate' ) {
3383          // add callback to animation options
3384          animOpts.complete = callbackFn;
3385          triggerCallbackNow = false;
3386
3387        } else if ( Modernizr.csstransitions ) {
3388          // detect if first item has transition
3389          var i = 0,
3390              firstItem = this.styleQueue[0],
3391              testElem = firstItem && firstItem.$el,
3392              styleObj;
3393          // get first non-empty jQ object
3394          while ( !testElem || !testElem.length ) {
3395            styleObj = this.styleQueue[ i++ ];
3396            // HACK: sometimes styleQueue[i] is undefined
3397            if ( !styleObj ) {
3398              return;
3399            }
3400            testElem = styleObj.$el;
3401          }
3402          // get transition duration of the first element in that object
3403          // yeah, this is inexact
3404          var duration = parseFloat( getComputedStyle( testElem[0] )[ transitionDurProp ] );
3405          if ( duration > 0 ) {
3406            processor = function( i, obj ) {
3407              obj.$el[ styleFn ]( obj.style, animOpts )
3408                // trigger callback at transition end
3409                .one( transitionEndEvent, callbackFn );
3410            };
3411            triggerCallbackNow = false;
3412          }
3413        }
3414      }
3415
3416      // process styleQueue
3417      $.each( this.styleQueue, processor );
3418
3419      if ( triggerCallbackNow ) {
3420        callbackFn();
3421      }
3422
3423      // clear out queue for next time
3424      this.styleQueue = [];
3425    },
3426
3427
3428    resize : function() {
3429      if ( this[ '_' + this.options.layoutMode + 'ResizeChanged' ]() ) {
3430        this.reLayout();
3431      }
3432    },
3433
3434
3435    reLayout : function( callback ) {
3436
3437      this[ '_' +  this.options.layoutMode + 'Reset' ]();
3438      this.layout( this.$filteredAtoms, callback );
3439
3440    },
3441
3442    // ====================== Convenience methods ======================
3443
3444    // ====================== Adding items ======================
3445
3446    // adds a jQuery object of items to a isotope container
3447    addItems : function( $content, callback ) {
3448      var $newAtoms = this._getAtoms( $content );
3449      // add new atoms to atoms pools
3450      this.$allAtoms = this.$allAtoms.add( $newAtoms );
3451
3452      if ( callback ) {
3453        callback( $newAtoms );
3454      }
3455    },
3456
3457    // convienence method for adding elements properly to any layout
3458    // positions items, hides them, then animates them back in <--- very sezzy
3459    insert : function( $content, callback ) {
3460      // position items
3461      this.element.append( $content );
3462
3463      var instance = this;
3464      this.addItems( $content, function( $newAtoms ) {
3465        var $newFilteredAtoms = instance._filter( $newAtoms );
3466        instance._addHideAppended( $newFilteredAtoms );
3467        instance._sort();
3468        instance.reLayout();
3469        instance._revealAppended( $newFilteredAtoms, callback );
3470      });
3471
3472    },
3473
3474    // convienence method for working with Infinite Scroll
3475    appended : function( $content, callback ) {
3476      var instance = this;
3477      this.addItems( $content, function( $newAtoms ) {
3478        instance._addHideAppended( $newAtoms );
3479        instance.layout( $newAtoms );
3480        instance._revealAppended( $newAtoms, callback );
3481      });
3482    },
3483
3484    // adds new atoms, then hides them before positioning
3485    _addHideAppended : function( $newAtoms ) {
3486      this.$filteredAtoms = this.$filteredAtoms.add( $newAtoms );
3487      $newAtoms.addClass('no-transition');
3488
3489      this._isInserting = true;
3490
3491      // apply hidden styles
3492      this.styleQueue.push({ $el: $newAtoms, style: this.options.hiddenStyle });
3493    },
3494
3495    // sets visible style on new atoms
3496    _revealAppended : function( $newAtoms, callback ) {
3497      var instance = this;
3498      // apply visible style after a sec
3499      setTimeout( function() {
3500        // enable animation
3501        $newAtoms.removeClass('no-transition');
3502        // reveal newly inserted filtered elements
3503        instance.styleQueue.push({ $el: $newAtoms, style: instance.options.visibleStyle });
3504        instance._isInserting = false;
3505        instance._processStyleQueue( $newAtoms, callback );
3506      }, 10 );
3507    },
3508
3509    // gathers all atoms
3510    reloadItems : function() {
3511      this.$allAtoms = this._getAtoms( this.element.children() );
3512    },
3513
3514    // removes elements from Isotope widget
3515    remove: function( $content, callback ) {
3516      // remove elements immediately from Isotope instance
3517      this.$allAtoms = this.$allAtoms.not( $content );
3518      this.$filteredAtoms = this.$filteredAtoms.not( $content );
3519      // remove() as a callback, for after transition / animation
3520      var instance = this;
3521      var removeContent = function() {
3522        $content.remove();
3523        if ( callback ) {
3524          callback.call( instance.element );
3525        }
3526      };
3527
3528      if ( $content.filter( ':not(.' + this.options.hiddenClass + ')' ).length ) {
3529        // if any non-hidden content needs to be removed
3530        this.styleQueue.push({ $el: $content, style: this.options.hiddenStyle });
3531        this._sort();
3532        this.reLayout( removeContent );
3533      } else {
3534        // remove it now
3535        removeContent();
3536      }
3537
3538    },
3539
3540    shuffle : function( callback ) {
3541      this.updateSortData( this.$allAtoms );
3542      this.options.sortBy = 'random';
3543      this._sort();
3544      this.reLayout( callback );
3545    },
3546
3547    // destroys widget, returns elements and container back (close) to original style
3548    destroy : function() {
3549
3550      var usingTransforms = this.usingTransforms;
3551      var options = this.options;
3552
3553      this.$allAtoms
3554        .removeClass( options.hiddenClass + ' ' + options.itemClass )
3555        .each(function(){
3556          var style = this.style;
3557          style.position = '';
3558          style.top = '';
3559          style.left = '';
3560          style.opacity = '';
3561          if ( usingTransforms ) {
3562            style[ transformProp ] = '';
3563          }
3564        });
3565
3566      // re-apply saved container styles
3567      var elemStyle = this.element[0].style;
3568      for ( var prop in this.originalStyle ) {
3569        elemStyle[ prop ] = this.originalStyle[ prop ];
3570      }
3571
3572      this.element
3573        .unbind('.isotope')
3574        .undelegate( '.' + options.hiddenClass, 'click' )
3575        .removeClass( options.containerClass )
3576        .removeData('isotope');
3577
3578      $window.unbind('.isotope');
3579
3580    },
3581
3582
3583    // ====================== LAYOUTS ======================
3584
3585    // calculates number of rows or columns
3586    // requires columnWidth or rowHeight to be set on namespaced object
3587    // i.e. this.masonry.columnWidth = 200
3588    _getSegments : function( isRows ) {
3589      var namespace = this.options.layoutMode,
3590          measure  = isRows ? 'rowHeight' : 'columnWidth',
3591          size     = isRows ? 'height' : 'width',
3592          segmentsName = isRows ? 'rows' : 'cols',
3593          containerSize = this.element[ size ](),
3594          segments,
3595                    // i.e. options.masonry && options.masonry.columnWidth
3596          segmentSize = this.options[ namespace ] && this.options[ namespace ][ measure ] ||
3597                    // or use the size of the first item, i.e. outerWidth
3598                    this.$filteredAtoms[ 'outer' + capitalize(size) ](true) ||
3599                    // if there's no items, use size of container
3600                    containerSize;
3601
3602      segments = Math.floor( containerSize / segmentSize );
3603      segments = Math.max( segments, 1 );
3604
3605      // i.e. this.masonry.cols = ....
3606      this[ namespace ][ segmentsName ] = segments;
3607      // i.e. this.masonry.columnWidth = ...
3608      this[ namespace ][ measure ] = segmentSize;
3609
3610    },
3611
3612    _checkIfSegmentsChanged : function( isRows ) {
3613      var namespace = this.options.layoutMode,
3614          segmentsName = isRows ? 'rows' : 'cols',
3615          prevSegments = this[ namespace ][ segmentsName ];
3616      // update cols/rows
3617      this._getSegments( isRows );
3618      // return if updated cols/rows is not equal to previous
3619      return ( this[ namespace ][ segmentsName ] !== prevSegments );
3620    },
3621
3622    // ====================== Masonry ======================
3623
3624    _masonryReset : function() {
3625      // layout-specific props
3626      this.masonry = {};
3627      // FIXME shouldn't have to call this again
3628      this._getSegments();
3629      var i = this.masonry.cols;
3630      this.masonry.colYs = [];
3631      while (i--) {
3632        this.masonry.colYs.push( 0 );
3633      }
3634    },
3635
3636    _masonryLayout : function( $elems ) {
3637      var instance = this,
3638          props = instance.masonry;
3639      $elems.each(function(){
3640        var $this  = $(this),
3641            //how many columns does this brick span
3642            colSpan = Math.ceil( $this.outerWidth(true) / props.columnWidth );
3643        colSpan = Math.min( colSpan, props.cols );
3644
3645        if ( colSpan === 1 ) {
3646          // if brick spans only one column, just like singleMode
3647          instance._masonryPlaceBrick( $this, props.colYs );
3648        } else {
3649          // brick spans more than one column
3650          // how many different places could this brick fit horizontally
3651          var groupCount = props.cols + 1 - colSpan,
3652              groupY = [],
3653              groupColY,
3654              i;
3655
3656          // for each group potential horizontal position
3657          for ( i=0; i < groupCount; i++ ) {
3658            // make an array of colY values for that one group
3659            groupColY = props.colYs.slice( i, i+colSpan );
3660            // and get the max value of the array
3661            groupY[i] = Math.max.apply( Math, groupColY );
3662          }
3663
3664          instance._masonryPlaceBrick( $this, groupY );
3665        }
3666      });
3667    },
3668
3669    // worker method that places brick in the columnSet
3670    //   with the the minY
3671    _masonryPlaceBrick : function( $brick, setY ) {
3672      // get the minimum Y value from the columns
3673      var minimumY = Math.min.apply( Math, setY ),
3674          shortCol = 0;
3675
3676      // Find index of short column, the first from the left
3677      for (var i=0, len = setY.length; i < len; i++) {
3678        if ( setY[i] === minimumY ) {
3679          shortCol = i;
3680          break;
3681        }
3682      }
3683
3684      // position the brick
3685      var x = this.masonry.columnWidth * shortCol,
3686          y = minimumY;
3687      this._pushPosition( $brick, x, y );
3688
3689      // apply setHeight to necessary columns
3690      var setHeight = minimumY + $brick.outerHeight(true),
3691          setSpan = this.masonry.cols + 1 - len;
3692      for ( i=0; i < setSpan; i++ ) {
3693        this.masonry.colYs[ shortCol + i ] = setHeight;
3694      }
3695
3696    },
3697
3698    _masonryGetContainerSize : function() {
3699      var containerHeight = Math.max.apply( Math, this.masonry.colYs );
3700      return { height: containerHeight };
3701    },
3702
3703    _masonryResizeChanged : function() {
3704      return this._checkIfSegmentsChanged();
3705    },
3706
3707    // ====================== fitRows ======================
3708
3709    _fitRowsReset : function() {
3710      this.fitRows = {
3711        x : 0,
3712        y : 0,
3713        height : 0
3714      };
3715    },
3716
3717    _fitRowsLayout : function( $elems ) {
3718      var instance = this,
3719          containerWidth = this.element.width(),
3720          props = this.fitRows;
3721
3722      $elems.each( function() {
3723        var $this = $(this),
3724            atomW = $this.outerWidth(true),
3725            atomH = $this.outerHeight(true);
3726
3727        if ( props.x !== 0 && atomW + props.x > containerWidth ) {
3728          // if this element cannot fit in the current row
3729          props.x = 0;
3730          props.y = props.height;
3731        }
3732
3733        // position the atom
3734        instance._pushPosition( $this, props.x, props.y );
3735
3736        props.height = Math.max( props.y + atomH, props.height );
3737        props.x += atomW;
3738
3739      });
3740    },
3741
3742    _fitRowsGetContainerSize : function () {
3743      return { height : this.fitRows.height };
3744    },
3745
3746    _fitRowsResizeChanged : function() {
3747      return true;
3748    },
3749
3750
3751    // ====================== cellsByRow ======================
3752
3753    _cellsByRowReset : function() {
3754      this.cellsByRow = {
3755        index : 0
3756      };
3757      // get this.cellsByRow.columnWidth
3758      this._getSegments();
3759      // get this.cellsByRow.rowHeight
3760      this._getSegments(true);
3761    },
3762
3763    _cellsByRowLayout : function( $elems ) {
3764      var instance = this,
3765          props = this.cellsByRow;
3766      $elems.each( function(){
3767        var $this = $(this),
3768            col = props.index % props.cols,
3769            row = Math.floor( props.index / props.cols ),
3770            x = ( col + 0.5 ) * props.columnWidth - $this.outerWidth(true) / 2,
3771            y = ( row + 0.5 ) * props.rowHeight - $this.outerHeight(true) / 2;
3772        instance._pushPosition( $this, x, y );
3773        props.index ++;
3774      });
3775    },
3776
3777    _cellsByRowGetContainerSize : function() {
3778      return { height : Math.ceil( this.$filteredAtoms.length / this.cellsByRow.cols ) * this.cellsByRow.rowHeight + this.offset.top };
3779    },
3780
3781    _cellsByRowResizeChanged : function() {
3782      return this._checkIfSegmentsChanged();
3783    },
3784
3785
3786    // ====================== straightDown ======================
3787
3788    _straightDownReset : function() {
3789      this.straightDown = {
3790        y : 0
3791      };
3792    },
3793
3794    _straightDownLayout : function( $elems ) {
3795      var instance = this;
3796      $elems.each( function( i ){
3797        var $this = $(this);
3798        instance._pushPosition( $this, 0, instance.straightDown.y );
3799        instance.straightDown.y += $this.outerHeight(true);
3800      });
3801    },
3802
3803    _straightDownGetContainerSize : function() {
3804      return { height : this.straightDown.y };
3805    },
3806
3807    _straightDownResizeChanged : function() {
3808      return true;
3809    },
3810
3811
3812    // ====================== masonryHorizontal ======================
3813
3814    _masonryHorizontalReset : function() {
3815      // layout-specific props
3816      this.masonryHorizontal = {};
3817      // FIXME shouldn't have to call this again
3818      this._getSegments( true );
3819      var i = this.masonryHorizontal.rows;
3820      this.masonryHorizontal.rowXs = [];
3821      while (i--) {
3822        this.masonryHorizontal.rowXs.push( 0 );
3823      }
3824    },
3825
3826    _masonryHorizontalLayout : function( $elems ) {
3827      var instance = this,
3828          props = instance.masonryHorizontal;
3829      $elems.each(function(){
3830        var $this  = $(this),
3831            //how many rows does this brick span
3832            rowSpan = Math.ceil( $this.outerHeight(true) / props.rowHeight );
3833        rowSpan = Math.min( rowSpan, props.rows );
3834
3835        if ( rowSpan === 1 ) {
3836          // if brick spans only one column, just like singleMode
3837          instance._masonryHorizontalPlaceBrick( $this, props.rowXs );
3838        } else {
3839          // brick spans more than one row
3840          // how many different places could this brick fit horizontally
3841          var groupCount = props.rows + 1 - rowSpan,
3842              groupX = [],
3843              groupRowX, i;
3844
3845          // for each group potential horizontal position
3846          for ( i=0; i < groupCount; i++ ) {
3847            // make an array of colY values for that one group
3848            groupRowX = props.rowXs.slice( i, i+rowSpan );
3849            // and get the max value of the array
3850            groupX[i] = Math.max.apply( Math, groupRowX );
3851          }
3852
3853          instance._masonryHorizontalPlaceBrick( $this, groupX );
3854        }
3855      });
3856    },
3857
3858    _masonryHorizontalPlaceBrick : function( $brick, setX ) {
3859      // get the minimum Y value from the columns
3860      var minimumX  = Math.min.apply( Math, setX ),
3861          smallRow  = 0;
3862      // Find index of smallest row, the first from the top
3863      for (var i=0, len = setX.length; i < len; i++) {
3864        if ( setX[i] === minimumX ) {
3865          smallRow = i;
3866          break;
3867        }
3868      }
3869
3870      // position the brick
3871      var x = minimumX,
3872          y = this.masonryHorizontal.rowHeight * smallRow;
3873      this._pushPosition( $brick, x, y );
3874
3875      // apply setHeight to necessary columns
3876      var setWidth = minimumX + $brick.outerWidth(true),
3877          setSpan = this.masonryHorizontal.rows + 1 - len;
3878      for ( i=0; i < setSpan; i++ ) {
3879        this.masonryHorizontal.rowXs[ smallRow + i ] = setWidth;
3880      }
3881    },
3882
3883    _masonryHorizontalGetContainerSize : function() {
3884      var containerWidth = Math.max.apply( Math, this.masonryHorizontal.rowXs );
3885      return { width: containerWidth };
3886    },
3887
3888    _masonryHorizontalResizeChanged : function() {
3889      return this._checkIfSegmentsChanged(true);
3890    },
3891
3892
3893    // ====================== fitColumns ======================
3894
3895    _fitColumnsReset : function() {
3896      this.fitColumns = {
3897        x : 0,
3898        y : 0,
3899        width : 0
3900      };
3901    },
3902
3903    _fitColumnsLayout : function( $elems ) {
3904      var instance = this,
3905          containerHeight = this.element.height(),
3906          props = this.fitColumns;
3907      $elems.each( function() {
3908        var $this = $(this),
3909            atomW = $this.outerWidth(true),
3910            atomH = $this.outerHeight(true);
3911
3912        if ( props.y !== 0 && atomH + props.y > containerHeight ) {
3913          // if this element cannot fit in the current column
3914          props.x = props.width;
3915          props.y = 0;
3916        }
3917
3918        // position the atom
3919        instance._pushPosition( $this, props.x, props.y );
3920
3921        props.width = Math.max( props.x + atomW, props.width );
3922        props.y += atomH;
3923
3924      });
3925    },
3926
3927    _fitColumnsGetContainerSize : function () {
3928      return { width : this.fitColumns.width };
3929    },
3930
3931    _fitColumnsResizeChanged : function() {
3932      return true;
3933    },
3934
3935
3936
3937    // ====================== cellsByColumn ======================
3938
3939    _cellsByColumnReset : function() {
3940      this.cellsByColumn = {
3941        index : 0
3942      };
3943      // get this.cellsByColumn.columnWidth
3944      this._getSegments();
3945      // get this.cellsByColumn.rowHeight
3946      this._getSegments(true);
3947    },
3948
3949    _cellsByColumnLayout : function( $elems ) {
3950      var instance = this,
3951          props = this.cellsByColumn;
3952      $elems.each( function(){
3953        var $this = $(this),
3954            col = Math.floor( props.index / props.rows ),
3955            row = props.index % props.rows,
3956            x = ( col + 0.5 ) * props.columnWidth - $this.outerWidth(true) / 2,
3957            y = ( row + 0.5 ) * props.rowHeight - $this.outerHeight(true) / 2;
3958        instance._pushPosition( $this, x, y );
3959        props.index ++;
3960      });
3961    },
3962
3963    _cellsByColumnGetContainerSize : function() {
3964      return { width : Math.ceil( this.$filteredAtoms.length / this.cellsByColumn.rows ) * this.cellsByColumn.columnWidth };
3965    },
3966
3967    _cellsByColumnResizeChanged : function() {
3968      return this._checkIfSegmentsChanged(true);
3969    },
3970
3971    // ====================== straightAcross ======================
3972
3973    _straightAcrossReset : function() {
3974      this.straightAcross = {
3975        x : 0
3976      };
3977    },
3978
3979    _straightAcrossLayout : function( $elems ) {
3980      var instance = this;
3981      $elems.each( function( i ){
3982        var $this = $(this);
3983        instance._pushPosition( $this, instance.straightAcross.x, 0 );
3984        instance.straightAcross.x += $this.outerWidth(true);
3985      });
3986    },
3987
3988    _straightAcrossGetContainerSize : function() {
3989      return { width : this.straightAcross.x };
3990    },
3991
3992    _straightAcrossResizeChanged : function() {
3993      return true;
3994    }
3995
3996  };
3997
3998
3999  // ======================= imagesLoaded Plugin ===============================
4000  /*!
4001   * jQuery imagesLoaded plugin v1.1.0
4002   * http://github.com/desandro/imagesloaded
4003   *
4004   * MIT License. by Paul Irish et al.
4005   */
4006
4007
4008  // $('#my-container').imagesLoaded(myFunction)
4009  // or
4010  // $('img').imagesLoaded(myFunction)
4011
4012  // execute a callback when all images have loaded.
4013  // needed because .load() doesn't work on cached images
4014
4015  // callback function gets image collection as argument
4016  //  `this` is the container
4017
4018  $.fn.imagesLoaded = function( callback ) {
4019    var $this = this,
4020        $images = $this.find('img').add( $this.filter('img') ),
4021        len = $images.length,
4022        blank = js_local_vars.theme_url + '/images/blank.gif',
4023        loaded = [];
4024
4025    function triggerCallback() {
4026      callback.call( $this, $images );
4027    }
4028
4029    function imgLoaded( event ) {
4030      var img = event.target;
4031      if ( img.src !== blank && $.inArray( img, loaded ) === -1 ){
4032        loaded.push( img );
4033        if ( --len <= 0 ){
4034          setTimeout( triggerCallback );
4035          $images.unbind( '.imagesLoaded', imgLoaded );
4036        }
4037      }
4038    }
4039
4040    // if no images, trigger immediately
4041    if ( !len ) {
4042      triggerCallback();
4043    }
4044
4045    $images.bind( 'load.imagesLoaded error.imagesLoaded',  imgLoaded ).each( function() {
4046      // cached images don't fire load sometimes, so we reset src.
4047      var src = this.src;
4048      // webkit hack from http://groups.google.com/group/jquery-dev/browse_thread/thread/eee6ab7b2da50e1f
4049      // data uri bypasses webkit log warning (thx doug jones)
4050      this.src = blank;
4051      this.src = src;
4052    });
4053
4054    return $this;
4055  };
4056
4057
4058  // helper function for logging errors
4059  // $.error breaks jQuery chaining
4060  var logError = function( message ) {
4061    if ( window.console ) {
4062      window.console.error( message );
4063    }
4064  };
4065
4066  // =======================  Plugin bridge  ===============================
4067  // leverages data method to either create or return $.Isotope constructor
4068  // A bit from jQuery UI
4069  //   https://github.com/jquery/jquery-ui/blob/master/ui/jquery.ui.widget.js
4070  // A bit from jcarousel
4071  //   https://github.com/jsor/jcarousel/blob/master/lib/jquery.jcarousel.js
4072
4073  $.fn.isotope = function( options, callback ) {
4074    if ( typeof options === 'string' ) {
4075      // call method
4076      var args = Array.prototype.slice.call( arguments, 1 );
4077
4078      this.each(function(){
4079        var instance = $.data( this, 'isotope' );
4080        if ( !instance ) {
4081          logError( "cannot call methods on isotope prior to initialization; " +
4082              "attempted to call method '" + options + "'" );
4083          return;
4084        }
4085        if ( !$.isFunction( instance[options] ) || options.charAt(0) === "_" ) {
4086          logError( "no such method '" + options + "' for isotope instance" );
4087          return;
4088        }
4089        // apply method
4090        instance[ options ].apply( instance, args );
4091      });
4092    } else {
4093      this.each(function() {
4094        var instance = $.data( this, 'isotope' );
4095        if ( instance ) {
4096          // apply options & init
4097          instance.option( options );
4098          instance._init( callback );
4099        } else {
4100          // initialize new instance
4101          $.data( this, 'isotope', new $.Isotope( options, this, callback ) );
4102        }
4103      });
4104    }
4105    // return jQuery object
4106    // so plugin methods do not have to
4107    return this;
4108  };
4109
4110})( window, jQuery );
4111
4112/**
4113 * Isotope v1.5.25
4114 * An exquisite jQuery plugin for magical layouts
4115 * http://isotope.metafizzy.co
4116 *
4117 * Commercial use requires one-time purchase of a commercial license
4118 * http://isotope.metafizzy.co/docs/license.html
4119 *
4120 * Non-commercial use is licensed under the MIT License
4121 *
4122 * Copyright 2013 Metafizzy
4123 *//*jshint asi: true, browser: true, curly: true, eqeqeq: true, forin: false, immed: false, newcap: true, noempty: true, strict: true, undef: true *//*global jQuery: false */(function(e,t,n){"use strict";var r=e.document,i=e.Modernizr,s=function(e){return e.charAt(0).toUpperCase()+e.slice(1)},o="Moz Webkit O Ms".split(" "),u=function(e){var t=r.documentElement.style,n;if(typeof t[e]=="string")return e;e=s(e);for(var i=0,u=o.length;i<u;i++){n=o[i]+e;if(typeof t[n]=="string")return n}},a=u("transform"),f=u("transitionProperty"),l={csstransforms:function(){return!!a},csstransforms3d:function(){var e=!!u("perspective");if(e){var n=" -o- -moz- -ms- -webkit- -khtml- ".split(" "),r="@media ("+n.join("transform-3d),(")+"modernizr)",i=t("<style>"+r+"{#modernizr{height:3px}}"+"</style>").appendTo("head"),s=t('<div id="modernizr" />').appendTo("html");e=s.height()===3;s.remove();i.remove()}return e},csstransitions:function(){return!!f}},c;if(i)for(c in l)i.hasOwnProperty(c)||i.addTest(c,l[c]);else{i=e.Modernizr={_version:"1.6ish: miniModernizr for Isotope"};var h=" ",p;for(c in l){p=l[c]();i[c]=p;h+=" "+(p?"":"no-")+c}t("html").addClass(h)}if(i.csstransforms){var d=i.csstransforms3d?{translate:function(e){return"translate3d("+e[0]+"px, "+e[1]+"px, 0) "},scale:function(e){return"scale3d("+e+", "+e+", 1) "}}:{translate:function(e){return"translate("+e[0]+"px, "+e[1]+"px) "},scale:function(e){return"scale("+e+") "}},v=function(e,n,r){var i=t.data(e,"isoTransform")||{},s={},o,u={},f;s[n]=r;t.extend(i,s);for(o in i){f=i[o];u[o]=d[o](f)}var l=u.translate||"",c=u.scale||"",h=l+c;t.data(e,"isoTransform",i);e.style[a]=h};t.cssNumber.scale=!0;t.cssHooks.scale={set:function(e,t){v(e,"scale",t)},get:function(e,n){var r=t.data(e,"isoTransform");return r&&r.scale?r.scale:1}};t.fx.step.scale=function(e){t.cssHooks.scale.set(e.elem,e.now+e.unit)};t.cssNumber.translate=!0;t.cssHooks.translate={set:function(e,t){v(e,"translate",t)},get:function(e,n){var r=t.data(e,"isoTransform");return r&&r.translate?r.translate:[0,0]}}}var m,g;if(i.csstransitions){m={WebkitTransitionProperty:"webkitTransitionEnd",MozTransitionProperty:"transitionend",OTransitionProperty:"oTransitionEnd otransitionend",transitionProperty:"transitionend"}[f];g=u("transitionDuration")}var y=t.event,b=t.event.handle?"handle":"dispatch",w;y.special.smartresize={setup:function(){t(this).bind("resize",y.special.smartresize.handler)},teardown:function(){t(this).unbind("resize",y.special.smartresize.handler)},handler:function(e,t){var n=this,r=arguments;e.type="smartresize";w&&clearTimeout(w);w=setTimeout(function(){y[b].apply(n,r)},t==="execAsap"?0:100)}};t.fn.smartresize=function(e){return e?this.bind("smartresize",e):this.trigger("smartresize",["execAsap"])};t.Isotope=function(e,n,r){this.element=t(n);this._create(e);this._init(r)};var E=["width","height"],S=t(e);t.Isotope.settings={resizable:!0,layoutMode:"masonry",containerClass:"isotope",itemClass:"isotope-item",hiddenClass:"isotope-hidden",hiddenStyle:{opacity:0,scale:.001},visibleStyle:{opacity:1,scale:1}
4123,containerStyle:{position:"relative",overflow:"hidden"},animationEngine:"best-available",animationOptions:{queue:!1,duration:800},sortBy:"original-order",sortAscending:!0,resizesContainer:!0,transformsEnabled:!0,itemPositionDataEnabled:!1};t.Isotope.prototype={_create:function(e){this.options=t.extend({},t.Isotope.settings,e);this.styleQueue=[];this.elemCount=0;var n=this.element[0].style;this.originalStyle={};var r=E.slice(0);for(var i in this.options.containerStyle)r.push(i);for(var s=0,o=r.length;s<o;s++){i=r[s];this.originalStyle[i]=n[i]||""}this.element.css(this.options.containerStyle);this._updateAnimationEngine();this._updateUsingTransforms();var u={"original-order":function(e,t){t.elemCount++;return t.elemCount},random:function(){return Math.random()}};this.options.getSortData=t.extend(this.options.getSortData,u);this.reloadItems();this.offset={left:parseInt(this.element.css("padding-left")||0,10),top:parseInt(this.element.css("padding-top")||0,10)};var a=this;setTimeout(function(){a.element.addClass(a.options.containerClass)},0);this.options.resizable&&S.bind("smartresize.isotope",function(){a.resize()});this.element.delegate("."+this.options.hiddenClass,"click",function(){return!1})},_getAtoms:function(e){var t=this.options.itemSelector,n=t?e.filter(t).add(e.find(t)):e,r={position:"absolute"};n=n.filter(function(e,t){return t.nodeType===1});if(this.usingTransforms){r.left=0;r.top=0}n.css(r).addClass(this.options.itemClass);this.updateSortData(n,!0);return n},_init:function(e){this.$filteredAtoms=this._filter(this.$allAtoms);this._sort();this.reLayout(e)},option:function(e){if(t.isPlainObject(e)){this.options=t.extend(!0,this.options,e);var n;for(var r in e){n="_update"+s(r);this[n]&&this[n]()}}},_updateAnimationEngine:function(){var e=this.options.animationEngine.toLowerCase().replace(/[ _\-]/g,""),t;switch(e){case"css":case"none":t=!1;break;case"jquery":t=!0;break;default:t=!i.csstransitions}this.isUsingJQueryAnimation=t;this._updateUsingTransforms()},_updateTransformsEnabled:function(){this._updateUsingTransforms()},_updateUsingTransforms:function(){var e=this.usingTransforms=this.options.transformsEnabled&&i.csstransforms&&i.csstransitions&&!this.isUsingJQueryAnimation;if(!e){delete this.options.hiddenStyle.scale;delete this.options.visibleStyle.scale}this.getPositionStyles=e?this._translate:this._positionAbs},_filter:function(e){var t=this.options.filter===""?"*":this.options.filter;if(!t)return e;var n=this.options.hiddenClass,r="."+n,i=e.filter(r),s=i;if(t!=="*"){s=i.filter(t);var o=e.not(r).not(t).addClass(n);this.styleQueue.push({$el:o,style:this.options.hiddenStyle})}this.styleQueue.push({$el:s,style:this.options.visibleStyle});s.removeClass(n);return e.filter(t)},updateSortData:function(e,n){var r=this,i=this.options.getSortData,s,o;e.each(function(){s=t(this);o={};for(var e in i)!n&&e==="original-order"?o[e]=t.data(this,"isotope-sort-data")[e]:o[e]=i[e](s,r);t.data(this,"isotope-sort-data",o)})},_sort:function(){var e=this.options.sortBy,t=this._getSorter,n=this.options.sortAscending?1:-1,r=function(r,i){var s=t(r,e),o=t(i,e);if(s===o&&e!=="original-order"){s=t(r,"original-order");o=t(i,"original-order")}return(s>o?1:s<o?-1:0)*n};this.$filteredAtoms.sort(r)},_getSorter:function(e,n){return t.data(e,"isotope-sort-data")[n]},_translate:function(e,t){return{translate:[e,t]}},_positionAbs:function(e,t){return{left:e,top:t}},_pushPosition:function(e,t,n){t=Math.round(t+this.offset.left);n=Math.round(n+this.offset.top);var r=this.getPositionStyles(t,n);this.styleQueue.push({$el:e,style:r});this.options.itemPositionDataEnabled&&e.data("isotope-item-position",{x:t,y:n})},layout:function(e,t){var n=this.options.layoutMode;this["_"+n+"Layout"](e);if(this.options.resizesContainer){var r=this["_"+n+"GetContainerSize"]();this.styleQueue.push({$el:this.element,style:r})}this._processStyleQueue(e,t);this.isLaidOut=!0},_processStyleQueue:function(e,n){var r=this.isLaidOut?this.isUsingJQueryAnimation?"animate":"css":"css",s=this.options.animationOptions,o=this.options.onLayout,u,a,f,l;a=function(e,t){t.$el[r](t.style,s)};if(this._isInserting&&this.isUsingJQueryAnimation)a=function(e,t){u=t.$el.hasClass("no-transition")?"css":r;t.$el[u](t.style,s)};
4123else if(n||o||s.complete){var c=!1,h=[n,o,s.complete],p=this;f=!0;l=function(){if(c)return;var t;for(var n=0,r=h.length;n<r;n++){t=h[n];typeof t=="function"&&t.call(p.element,e,p)}c=!0};if(this.isUsingJQueryAnimation&&r==="animate"){s.complete=l;f=!1}else if(i.csstransitions){var d=0,v=this.styleQueue[0],y=v&&v.$el,b;while(!y||!y.length){b=this.styleQueue[d++];if(!b)return;y=b.$el}var w=parseFloat(getComputedStyle(y[0])[g]);if(w>0){a=function(e,t){t.$el[r](t.style,s).one(m,l)};f=!1}}}t.each(this.styleQueue,a);f&&l();this.styleQueue=[]},resize:function(){this["_"+this.options.layoutMode+"ResizeChanged"]()&&this.reLayout()},reLayout:function(e){this["_"+this.options.layoutMode+"Reset"]();this.layout(this.$filteredAtoms,e)},addItems:function(e,t){var n=this._getAtoms(e);this.$allAtoms=this.$allAtoms.add(n);t&&t(n)},insert:function(e,t){this.element.append(e);var n=this;this.addItems(e,function(e){var r=n._filter(e);n._addHideAppended(r);n._sort();n.reLayout();n._revealAppended(r,t)})},appended:function(e,t){var n=this;this.addItems(e,function(e){n._addHideAppended(e);n.layout(e);n._revealAppended(e,t)})},_addHideAppended:function(e){this.$filteredAtoms=this.$filteredAtoms.add(e);e.addClass("no-transition");this._isInserting=!0;this.styleQueue.push({$el:e,style:this.options.hiddenStyle})},_revealAppended:function(e,t){var n=this;setTimeout(function(){e.removeClass("no-transition");n.styleQueue.push({$el:e,style:n.options.visibleStyle});n._isInserting=!1;n._processStyleQueue(e,t)},10)},reloadItems:function(){this.$allAtoms=this._getAtoms(this.element.children())},remove:function(e,t){this.$allAtoms=this.$allAtoms.not(e);this.$filteredAtoms=this.$filteredAtoms.not(e);var n=this,r=function(){e.remove();t&&t.call(n.element)};if(e.filter(":not(."+this.options.hiddenClass+")").length){this.styleQueue.push({$el:e,style:this.options.hiddenStyle});this._sort();this.reLayout(r)}else r()},shuffle:function(e){this.updateSortData(this.$allAtoms);this.options.sortBy="random";this._sort();this.reLayout(e)},destroy:function(){var e=this.usingTransforms,t=this.options;this.$allAtoms.removeClass(t.hiddenClass+" "+t.itemClass).each(function(){var t=this.style;t.position="";t.top="";t.left="";t.opacity="";e&&(t[a]="")});var n=this.element[0].style;for(var r in this.originalStyle)n[r]=this.originalStyle[r];this.element.unbind(".isotope").undelegate("."+t.hiddenClass,"click").removeClass(t.containerClass).removeData("isotope");S.unbind(".isotope")},_getSegments:function(e){var t=this.options.layoutMode,n=e?"rowHeight":"columnWidth",r=e?"height":"width",i=e?"rows":"cols",o=this.element[r](),u,a=this.options[t]&&this.options[t][n]||this.$filteredAtoms["outer"+s(r)](!0)||o;u=Math.floor(o/a);u=Math.max(u,1);this[t][i]=u;this[t][n]=a},_checkIfSegmentsChanged:function(e){var t=this.options.layoutMode,n=e?"rows":"cols",r=this[t][n];this._getSegments(e);return this[t][n]!==r},_masonryReset:function(){this.masonry={};this._getSegments();var e=this.masonry.cols;this.masonry.colYs=[];while(e--)this.masonry.colYs.push(0)},_masonryLayout:function(e){var n=this,r=n.masonry;e.each(function(){var e=t(this),i=Math.ceil(e.outerWidth(!0)/r.columnWidth);i=Math.min(i,r.cols);if(i===1)n._masonryPlaceBrick(e,r.colYs);else{var s=r.cols+1-i,o=[],u,a;for(a=0;a<s;a++){u=r.colYs.slice(a,a+i);o[a]=Math.max.apply(Math,u)}n._masonryPlaceBrick(e,o)}})},_masonryPlaceBrick:function(e,t){var n=Math.min.apply(Math,t),r=0;for(var i=0,s=t.length;i<s;i++)if(t[i]===n){r=i;break}var o=this.masonry.columnWidth*r,u=n;this._pushPosition(e,o,u);var a=n+e.outerHeight(!0),f=this.masonry.cols+1-s;for(i=0;i<f;i++)this.masonry.colYs[r+i]=a},_masonryGetContainerSize:function(){var e=Math.max.apply(Math,this.masonry.colYs);return{height:e}},_masonryResizeChanged:function(){return this._checkIfSegmentsChanged()},_fitRowsReset:function(){this.fitRows={x:0,y:0,height:0}},_fitRowsLayout:function(e){var n=this,r=this.element.width(),i=this.fitRows;e.each(function(){var e=t(this),s=e.outerWidth(!0),o=e.outerHeight(!0);if(i.x!==0&&s+i.x>r){i.x=0;i.y=i.height}n._pushPosition(e,i.x,i.y);i.height=Math.max(i.y+o,i.height);i.x+=s})},_fitRowsGetContainerSize:function(){return{height:this.fitRows.height}},_fitRowsResizeChanged:function(){return!0},_cellsByRowReset:function(){this.cellsByRow={index:0};this._getSegments();this._getSegments(!0)},_cellsByRowLayout:function(e){var n=this,r=this.cellsByRow;e.each(function(){var e=t(this),i=r.index%r.cols,s=Math.floor(r.index/r.cols),o=(i+.5)*r.columnWidth-e.outerWidth(!0)/2,u=(s+.5)*r.rowHeight-e.outerHeight(!0)/2;n._pushPosition(e,o,u);r.index++})},_cellsByRowGetContainerSize:function(){return{height:Math.ceil(this.$filteredAtoms.length/this.cellsByRow.cols)*this.cellsByRow.rowHeight+this.offset.top}},_cellsByRowResizeChanged:function(){return this._checkIfSegmentsChanged()},_straightDownReset:function(){this.straightDown={y:0}},_straightDownLayout:function(e){var n=this;e.each(function(e){var r=t(this);n._pushPosition(r,0,n.straightDown.y);n.straightDown.y+=r.outerHeight(!0)})},_straightDownGetContainerSize:function(){return{height:this.straightDown.y}},_straightDownResizeChanged:function(){return!0},_masonryHorizontalReset:function(){this.masonryHorizontal={};this._getSegments(!0);var e=this.masonryHorizontal.rows;this.masonryHorizontal.rowXs=[];while(e--)this.masonryHorizontal.rowXs.push(0)},_masonryHorizontalLayout:function(e){var n=this,r=n.masonryHorizontal;e.each(function(){var e=t(this),i=Math.ceil(e.outerHeight(!0)/r.rowHeight);i=Math.min(i,r.rows);if(i===1)n._masonryHorizontalPlaceBrick(e,r.rowXs);else{var s=r.rows+1-i,o=[],u,a;for(a=0;a<s;a++){u=r.rowXs.slice(a,a+i);o[a]=Math.max.apply(Math,u)}n._masonryHorizontalPlaceBrick(e,o)}})},_masonryHorizontalPlaceBrick:function(e,t){var n=Math.min.apply(Math,t),r=0;for(var i=0,s=t.length;i<s;i++)if(t[i]===n){r=i;break}var o=n,u=this.masonryHorizontal.rowHeight*r;this._pushPosition(e,o,u);var a=n+e.outerWidth(!0),f=this.masonryHorizontal.rows+1-s;for(i=0;i<f;i++)this.masonryHorizontal.rowXs[r+i]=a},_masonryHorizontalGetContainerSize:function(){var e=Math.max.apply(Math,this.masonryHorizontal.rowXs);return{width:e}},_masonryHorizontalResizeChanged:function(){return this._checkIfSegmentsChanged(!0)},_fitColumnsReset:function(){this.fitColumns={x:0,y:0,width:0}},_fitColumnsLayout:function(e){var n=this,r=this.element.height(),i=this.fitColumns;e.each(function(){var e=t(this),s=e.outerWidth(!0),o=e.outerHeight(!0);if(i.y!==0&&o+i.y>r){i.x=i.width;i.y=0}n._pushPosition(e,i.x,i.y);i.width=Math.max(i.x+s,i.width);i.y+=o})},_fitColumnsGetContainerSize:function(){return{width:this.fitColumns.width}},_fitColumnsResizeChanged:function(){return!0},_cellsByColumnReset:function(){this.cellsByColumn={index:0};this._getSegments();this._getSegments(!0)},_cellsByColumnLayout:function(e){var n=this,r=this.cellsByColumn;e.each(function(){var e=t(this),i=Math.floor(r.index/r.rows),s=r.index%r.rows,o=(i+.5)*r.columnWidth-e.outerWidth(!0)/2,u=(s+.5)*r.rowHeight-e.outerHeight(!0)/2;n._pushPosition(e,o,u);r.index++})},_cellsByColumnGetContainerSize:function(){return{width:Math.ceil(this.$filteredAtoms.length/this.cellsByColumn.rows)*this.cellsByColumn.columnWidth}},_cellsByColumnResizeChanged:function(){return this._checkIfSegmentsChanged(!0)},_straightAcrossReset:function(){this.straightAcross={x:0}},_straightAcrossLayout:function(e){var n=this;e.each(function(e){var r=t(this);n._pushPosition(r,n.straightAcross.x,0);n.straightAcross.x+=r.outerWidth(!0)})},_straightAcrossGetContainerSize:function(){return{width:this.straightAcross.x}},_straightAcrossResizeChanged:function(){return!0}};t.fn.imagesLoaded=function(e){function u(){e.call(n,r)}function a(e){var n=e.target;if(n.src!==s&&t.inArray(n,o)===-1){o.push(n);if(--i<=0){setTimeout(u);r.unbind(".imagesLoaded",a)}}}var n=this,r=n.find("img").add(n.filter("img")),i=r.length,s=js_local_vars.theme_url+'/images/blank.gif',o=[];i||u();r.bind("load.imagesLoaded error.imagesLoaded",a).each(function(){var e=this.src;this.src=s;this.src=e});return n};var x=function(t){e.console&&e.console.error(t)};t.fn.isotope=function(e,n){if(typeof e=="string"){var r=Array.prototype.slice.call(arguments,1
4123);this.each(function(){var n=t.data(this,"isotope");if(!n){x("cannot call methods on isotope prior to initialization; attempted to call method '"+e+"'");return}if(!t.isFunction(n[e])||e.charAt(0)==="_"){x("no such method '"+e+"' for isotope instance");return}n[e].apply(n,r)})}else this.each(function(){var r=t.data(this,"isotope");if(r){r.option(e);r._init(n)}else t.data(this,"isotope",new t.Isotope(e,this,n))});return this}})(window,jQuery);
4124
4125// RTL support for grid layouts
4126if(jQuery('body.rtl').length >= 1){
4127	jQuery.Isotope.prototype._positionAbs = function( x, y ) {
4128	  return { right: x, top: y };
4129	};
4130}
4131
4132 /*!
4133 * hoverIntent r7 // 2013.03.11 // jQuery 1.9.1+
4134 * http://cherne.net/brian/resources/jquery.hoverIntent.html
4135 *
4136 * You may use hoverIntent under the terms of the MIT license. Basically that
4137 * means you are free to use hoverIntent as long as this header is left intact.
4138 * Copyright 2007, 2013 Brian Cherne
4139 */
4140
4141/* hoverIntent is similar to jQuery's built-in "hover" method except that
4142 * instead of firing the handlerIn function immediately, hoverIntent checks
4143 * to see if the user's mouse has slowed down (beneath the sensitivity
4144 * threshold) before firing the event. The handlerOut function is only
4145 * called after a matching handlerIn.
4146 *
4147 * // basic usage ... just like .hover()
4148 * .hoverIntent( handlerIn, handlerOut )
4149 * .hoverIntent( handlerInOut )
4150 *
4151 * // basic usage ... with event delegation!
4152 * .hoverIntent( handlerIn, handlerOut, selector )
4153 * .hoverIntent( handlerInOut, selector )
4154 *
4155 * // using a basic configuration object
4156 * .hoverIntent( config )
4157 *
4158 * @param  handlerIn   function OR configuration object
4159 * @param  handlerOut  function OR selector for delegation OR undefined
4160 * @param  selector    selector OR undefined
4161 * @author Brian Cherne <brian(at)cherne(dot)net>
4162 */
4163(function($) {
4164    $.fn.hoverIntent = function(handlerIn,handlerOut,selector) {
4165
4166        // default configuration values
4167        var cfg = {
4168            interval: 100,
4169            sensitivity: 7,
4170            timeout: 0
4171        };
4172
4173        if ( typeof handlerIn === "object" ) {
4174            cfg = $.extend(cfg, handlerIn );
4175        } else if ($.isFunction(handlerOut)) {
4176            cfg = $.extend(cfg, { over: handlerIn, out: handlerOut, selector: selector } );
4177        } else {
4178            cfg = $.extend(cfg, { over: handlerIn, out: handlerIn, selector: handlerOut } );
4179        }
4180
4181        // instantiate variables
4182        // cX, cY = current X and Y position of mouse, updated by mousemove event
4183        // pX, pY = previous X and Y position of mouse, set by mouseover and polling interval
4184        var cX, cY, pX, pY;
4185
4186        // A private function for getting mouse position
4187        var track = function(ev) {
4188            cX = ev.pageX;
4189            cY = ev.pageY;
4190        };
4191
4192        // A private function for comparing current and previous mouse position
4193        var compare = function(ev,ob) {
4194            ob.hoverIntent_t = clearTimeout(ob.hoverIntent_t);
4195            // compare mouse positions to see if they've crossed the threshold
4196            if ( ( Math.abs(pX-cX) + Math.abs(pY-cY) ) < cfg.sensitivity ) {
4197                $(ob).off("mousemove.hoverIntent",track);
4198                // set hoverIntent state to true (so mouseOut can be called)
4199                ob.hoverIntent_s = 1;
4200                return cfg.over.apply(ob,[ev]);
4201            } else {
4202                // set previous coordinates for next time
4203                pX = cX; pY = cY;
4204                // use self-calling timeout, guarantees intervals are spaced out properly (avoids JavaScript timer bugs)
4205                ob.hoverIntent_t = setTimeout( function(){compare(ev, ob);} , cfg.interval );
4206            }
4207        };
4208
4209        // A private function for delaying the mouseOut function
4210        var delay = function(ev,ob) {
4211            ob.hoverIntent_t = clearTimeout(ob.hoverIntent_t);
4212            ob.hoverIntent_s = 0;
4213            return cfg.out.apply(ob,[ev]);
4214        };
4215
4216        // A private function for handling mouse 'hovering'
4217        var handleHover = function(e) {
4218            // copy objects to be passed into t (required for event object to be passed in IE)
4219            var ev = jQuery.extend({},e);
4220            var ob = this;
4221
4222            // cancel hoverIntent timer if it exists
4223            if (ob.hoverIntent_t) { ob.hoverIntent_t = clearTimeout(ob.hoverIntent_t); }
4224
4225            // if e.type == "mouseenter"
4226            if (e.type == "mouseenter") {
4227                // set "previous" X and Y position based on initial entry point
4228                pX = ev.pageX; pY = ev.pageY;
4229                // update "current" X and Y position based on mousemove
4230                $(ob).on("mousemove.hoverIntent",track);
4231                // start polling interval (self-calling timeout) to compare mouse coordinates over time
4232                if (ob.hoverIntent_s != 1) { ob.hoverIntent_t = setTimeout( function(){compare(ev,ob);} , cfg.interval );}
4233
4234                // else e.type == "mouseleave"
4235            } else {
4236                // unbind expensive mousemove event
4237                $(ob).off("mousemove.hoverIntent",track);
4238                // if hoverIntent state is true, then call the mouseOut function after the specified delay
4239                if (ob.hoverIntent_s == 1) { ob.hoverIntent_t = setTimeout( function(){delay(ev,ob);} , cfg.timeout );}
4240            }
4241        };
4242
4243        // listen for mouseenter and mouseleave
4244        return this.on({'mouseenter.hoverIntent':handleHover,'mouseleave.hoverIntent':handleHover}, cfg.selector);
4245    };
4246})(jQuery);
4247
4248/*
4249|--------------------------------------------------------------------------
4250| UItoTop jQuery Plugin 1.2 by Matt Varone
4251| http://www.mattvarone.com/web-design/uitotop-jquery-plugin/
4252|--------------------------------------------------------------------------
4253*/
4254(function($){
4255	$.fn.UItoTop = function(options) {
4256
4257 		var defaults = {
4258    			text: '',
4259    			min: 200,
4260    			inDelay:600,
4261    			outDelay:400,
4262      			containerID: 'toTop',
4263    			containerHoverID: 'toTopHover',
4264    			scrollSpeed: 1200,
4265    			easingType: 'linear'
4266 		    },
4267            settings = $.extend(defaults, options),
4268            containerIDhash = '#' + settings.containerID,
4269            containerHoverIDHash = '#'+settings.containerHoverID;
4270
4271		$('body').append('<div class="to-top-container"><a href="#" id="'+settings.containerID+'">'+settings.text+'</a></div>');
4272		$(containerIDhash).hide().on('click.UItoTop',function(){
4273			$('html, body').animate({scrollTop:0}, settings.scrollSpeed, settings.easingType);
4274			$('#'+settings.containerHoverID, this).stop().animate({'opacity': 0 }, settings.inDelay, settings.easingType);
4275			return false;
4276		})
4277		.prepend('<span id="'+settings.containerHoverID+'"></span>')
4278		.hover(function() {
4279				$(containerHoverIDHash, this).stop().animate({
4280					'opacity': 1
4281				}, 600, 'linear');
4282			}, function() {
4283				$(containerHoverIDHash, this).stop().animate({
4284					'opacity': 0
4285				}, 700, 'linear');
4286			});
4287
4288		$(window).scroll(function() {
4289			var sd = $(window).scrollTop();
4290			if(typeof document.body.style.maxHeight === "undefined") {
4291				$(containerIDhash).css({
4292					'position': 'absolute',
4293					'top': sd + $(window).height() - 50
4294				});
4295			}
4296			if ( sd > settings.min ) {
4297				$(containerIDhash).fadeIn(settings.inDelay);
4298			} else {
4299				$(containerIDhash).fadeOut(settings.Outdelay);
4300			}
4301		});
4302};
4303})(jQuery);
4304
4305(function( window, $, undefined ) {
4306
4307	/*
4308	* smartresize: debounced resize event for jQuery
4309	*
4310	* latest version and complete README available on Github:
4311	* https://github.com/louisremi/jquery.smartresize.js
4312	*
4313	* Copyright 2011 @louis_remi
4314	* Licensed under the MIT license.
4315	*/
4316
4317	var $event = $.event, resizeTimeout;
4318
4319	$event.special.smartresize 	= {
4320		setup: function() {
4321			$(this).bind( "resize", $event.special.smartresize.handler );
4322		},
4323		teardown: function() {
4324			$(this).unbind( "resize", $event.special.smartresize.handler );
4325		},
4326		handler: function( event, execAsap ) {
4327			// Save the context
4328			var context = this,
4329				args 	= arguments;
4330
4331			// set correct event type
4332			event.type = "smartresize";
4333
4334			if ( resizeTimeout ) { clearTimeout( resizeTimeout ); }
4335			resizeTimeout = setTimeout(function() {
4336				jQuery.event.handle.apply( context, args );
4337			}, execAsap === "execAsap"? 0 : 100 );
4338		}
4339	};
4340
4341	$.fn.smartresize 			= function( fn ) {
4342		return fn ? this.bind( "smartresize", fn ) : this.trigger( "smartresize", ["execAsap"] );
4343	};
4344
4345	$.Slideshow 				= function( options, element ) {
4346
4347		this.$el			= $( element );
4348
4349		/***** images ****/
4350
4351		// list of image items
4352		this.$list			= this.$el.find('ul.ei-slider-large');
4353		// image items
4354		this.$imgItems		= this.$list.children('li');
4355		// total number of items
4356		this.itemsCount		= this.$imgItems.length;
4357		// images
4358		this.$images		= this.$imgItems.find('img:first');
4359
4360		/***** thumbs ****/
4361
4362		// thumbs wrapper
4363		this.$sliderthumbs	= this.$el.find('ul.ei-slider-thumbs').hide();
4364		// slider elements
4365		this.$sliderElems	= this.$sliderthumbs.children('li');
4366		// sliding div
4367		this.$sliderElem	= this.$sliderthumbs.children('li.ei-slider-element');
4368		// thumbs
4369		this.$thumbs		= this.$sliderElems.not('.ei-slider-element');
4370
4371		// initialize slideshow
4372		this._init( options );
4373
4374	};
4375
4376	$.Slideshow.defaults 		= {
4377		// animation types:
4378		// "sides" : new slides will slide in from left / right
4379		// "center": new slides will appear in the center
4380		animation			: 'sides', // sides || center
4381		// if true the slider will automatically slide, and it will only stop if the user clicks on a thumb
4382		autoplay			: false,
4383		// interval for the slideshow
4384		slideshow_interval	: 3000,
4385		// speed for the sliding animation
4386		speed			: 800,
4387		// easing for the sliding animation
4388		easing			: '',
4389		// percentage of speed for the titles animation. Speed will be speed * titlesFactor
4390		titlesFactor		: 0.60,
4391		// titles animation speed
4392		titlespeed			: 800,
4393		// titles animation easing
4394		titleeasing			: '',
4395		// maximum width for the thumbs in pixels
4396		thumbMaxWidth		: 150
4397    };
4398
4399	$.Slideshow.prototype 		= {
4400		_init 				: function( options ) {
4401
4402			this.options 		= $.extend( true, {}, $.Slideshow.defaults, options );
4403
4404			// set the opacity of the title elements and the image items
4405			this.$imgItems.css( 'opacity', 0 );
4406			this.$imgItems.find('div.ei-title > *').css( 'opacity', 0 );
4407
4408			// index of current visible slider
4409			this.current		= 0;
4410
4411			var _self			= this;
4412
4413			// preload images
4414			// add loading status
4415			this.$loading		= $('<div class="ei-slider-loading">Loading</div>').prependTo( _self.$el );
4416
4417			$.when( this._preloadImages() ).done( function() {
4418
4419				// hide loading status
4420				_self.$loading.hide();
4421
4422				// calculate size and position for each image
4423				_self._setImagesSize();
4424
4425				// configure thumbs container
4426				_self._initThumbs();
4427
4428				// show first
4429				_self.$imgItems.eq( _self.current ).css({
4430					'opacity' 	: 1,
4431					'z-index'	: 10
4432				}).show().find('div.ei-title > *').css( 'opacity', 1 );
4433
4434				// if autoplay is true
4435				if( _self.options.autoplay ) {
4436
4437					_self._startSlideshow();
4438
4439				}
4440
4441				// initialize the events
4442				_self._initEvents();
4443
4444			});
4445
4446		},
4447		_preloadImages		: function() {
4448
4449			// preloads all the large images
4450
4451			var _self	= this,
4452				loaded	= 0;
4453
4454			return $.Deferred(
4455
4456				function(dfd) {
4457
4458					_self.$images.each( function( i ) {
4459
4460						$('<img/>').load( function() {
4461
4462							if( ++loaded === _self.itemsCount ) {
4463
4464								dfd.resolve();
4465
4466							}
4467
4468						}).attr( 'src', $(this).attr('src') );
4469
4470					});
4471
4472				}
4473
4474			).promise();
4475
4476		},
4477		_setImagesSize		: function() {
4478
4479			// save ei-slider's width
4480			this.elWidth	= this.$el.width();
4481
4482			var _self	= this;
4483
4484			this.$images.each( function( i ) {
4485
4486				var $img	= $(this);
4487					imgDim	= _self._getImageDim( $img.attr('src') );
4488
4489				$img.css({
4490					width		: imgDim.width,
4491					height		: imgDim.height,
4492					marginLeft	: imgDim.left,
4493					marginTop	: imgDim.top
4494				});
4495
4496			});
4497
4498		},
4499		_getImageDim		: function( src ) {
4500
4501			var $img    = new Image();
4502
4503			$img.src    = src;
4504
4505			var c_w		= this.elWidth,
4506				c_h		= this.$el.height(),
4507				r_w		= c_h / c_w,
4508
4509				i_w		= $img.width,
4510				i_h		= $img.height,
4511				r_i		= i_h / i_w,
4512				new_w, new_h, new_left, new_top;
4513
4514			if( r_w > r_i ) {
4515
4516				new_h	= c_h;
4517				new_w	= c_h / r_i;
4518
4519			}
4520			else {
4521
4522				new_h	= c_w * r_i;
4523				new_w	= c_w;
4524
4525			}
4526
4527			return {
4528				width	: new_w,
4529				height	: new_h,
4530				left	: ( c_w - new_w ) / 2,
4531				top		: ( c_h - new_h ) / 2
4532			};
4533
4534		},
4535		_initThumbs			: function() {
4536
4537			// set the max-width of the slider elements to the one set in the plugin's options
4538			// also, the width of each slider element will be 100% / total number of elements
4539			this.$sliderElems.css({
4540				'max-width' : this.options.thumbMaxWidth + 'px',
4541				'width'		: 100 / this.itemsCount + '%'
4542			});
4543
4544			// set the max-width of the slider and show it
4545			this.$sliderthumbs.css( 'max-width', this.options.thumbMaxWidth * this.itemsCount + 'px' ).show();
4546
4547		},
4548		_startSlideshow		: function() {
4549
4550			var _self	= this;
4551
4552			this.slideshow	= setTimeout( function() {
4553
4554				var pos;
4555
4556				( _self.current === _self.itemsCount - 1 ) ? pos = 0 : pos = _self.current + 1;
4557
4558				_self._slideTo( pos );
4559
4560				if( _self.options.autoplay ) {
4561
4562					_self._startSlideshow();
4563
4564				}
4565
4566			}, this.options.slideshow_interval);
4567
4568		},
4569		// shows the clicked thumb's slide
4570		_slideTo			: function( pos ) {
4571
4572			// return if clicking the same element or if currently animating
4573			if( pos === this.current || this.isAnimating )
4574				return false;
4575
4576			this.isAnimating	= true;
4577
4578			var $currentSlide	= this.$imgItems.eq( this.current ),
4579				$nextSlide		= this.$imgItems.eq( pos ),
4580				_self			= this,
4581
4582				preCSS			= {zIndex	: 10},
4583				animCSS			= {opacity	: 1};
4584
4585			// new slide will slide in from left or right side
4586			if( this.options.animation === 'sides' ) {
4587
4588				preCSS.left		= ( pos > this.current ) ? -1 * this.elWidth : this.elWidth;
4589				animCSS.left	= 0;
4590
4591			}
4592
4593			// titles animation
4594			$nextSlide.find('div.ei-title > h2')
4595					  .css( 'margin-right', 50 + 'px' )
4596					  .stop()
4597					  .delay( this.options.speed * this.options.titlesFactor )
4598					  .animate({ marginRight : 0 + 'px', opacity : 1 }, this.options.titlespeed, this.options.titleeasing )
4599					  .end()
4600					  .find('div.ei-title > h3')
4601					  .css( 'margin-right', -50 + 'px' )
4602					  .stop()
4603					  .delay( this.options.speed * this.options.titlesFactor )
4604					  .animate({ marginRight : 0 + 'px', opacity : 1 }, this.options.titlespeed, this.options.titleeasing );
4605
4606			$.when(
4607
4608				// fade out current titles
4609				$currentSlide.css( 'z-index' , 1 ).find('div.ei-title > *').stop().fadeOut( this.options.speed / 2, function() {
4610					// reset style
4611					$(this).show().css( 'opacity', 0 );
4612				}),
4613
4614				// animate next slide in
4615				$nextSlide.css( preCSS ).stop().animate( animCSS, this.options.speed, this.options.easing ),
4616
4617				// "sliding div" moves to new position
4618				this.$sliderElem.stop().animate({
4619					left	: this.$thumbs.eq( pos ).position().left
4620				}, this.options.speed )
4621
4622			).done( function() {
4623
4624				// reset values
4625				$currentSlide.css( 'opacity' , 0 ).find('div.ei-title > *').css( 'opacity', 0 );
4626					_self.current	= pos;
4627					_self.isAnimating		= false;
4628
4629				});
4630
4631		},
4632		_initEvents			: function() {
4633
4634			var _self	= this;
4635
4636			// window resize
4637			$(window).on( 'smartresize.eislideshow', function( event ) {
4638
4639				// resize the images
4640				_self._setImagesSize();
4641
4642				// reset position of thumbs sliding div
4643				_self.$sliderElem.css( 'left', _self.$thumbs.eq( _self.current ).position().left );
4644
4645			});
4646
4647			// click the thumbs
4648			this.$thumbs.on( 'click.eislideshow', function( event ) {
4649
4650				if( _self.options.autoplay ) {
4651
4652					clearTimeout( _self.slideshow );
4653					_self.options.autoplay	= false;
4654
4655				}
4656
4657				var $thumb	= $(this),
4658					idx		= $thumb.index() - 1; // exclude sliding div
4659
4660				_self._slideTo( idx );
4661
4662				return false;
4663
4664			});
4665
4666		}
4667	};
4668
4669	var logError 				= function( message ) {
4670
4671		if ( this.console ) {
4672
4673			console.error( message );
4674
4675		}
4676
4677	};
4678
4679	$.fn.eislideshow			= function( options ) {
4680
4681		if ( typeof options === 'string' ) {
4682
4683			var args = Array.prototype.slice.call( arguments, 1 );
4684
4685			this.each(function() {
4686
4687				var instance = $.data( this, 'eislideshow' );
4688
4689				if ( !instance ) {
4690					logError( "cannot call methods on eislideshow prior to initialization; " +
4691					"attempted to call method '" + options + "'" );
4692					return;
4693				}
4694
4695				if ( !$.isFunction( instance[options] ) || options.charAt(0) === "_" ) {
4696					logError( "no such method '" + options + "' for eislideshow instance" );
4697					return;
4698				}
4699
4700				instance[ options ].apply( instance, args );
4701
4702			});
4703
4704		}
4705		else {
4706
4707			this.each(function() {
4708
4709				var instance = $.data( this, 'eislideshow' );
4710				if ( !instance ) {
4711					$.data( this, 'eislideshow', new $.Slideshow( options, this ) );
4712				}
4713
4714			});
4715
4716		}
4717
4718		return this;
4719
4720	};
4721
4722})( window, jQuery );
4723
4724/*!
4725 * jQuery Cycle Lite Plugin
4726 * http://malsup.com/jquery/cycle/lite/
4727 * Copyright (c) 2008-2012 M. Alsup
4728 * Version: 1.7 (20-FEB-2013)
4729 * Dual licensed under the MIT and GPL licenses:
4730 * http://www.opensource.org/licenses/mit-license.php
4731 * http://www.gnu.org/licenses/gpl.html
4732 * Requires: jQuery v1.3.2 or later
4733 */
4734;(function($) {
4735"use strict";
4736
4737var ver = 'Lite-1.7';
4738var msie = /MSIE/.test(navigator.userAgent);
4739
4740$.fn.cycle = function(options) {
4741    return this.each(function() {
4742        options = options || {};
4743
4744        if (this.cycleTimeout)
4745            clearTimeout(this.cycleTimeout);
4746
4747        this.cycleTimeout = 0;
4748        this.cyclePause = 0;
4749
4750        var $cont = $(this);
4751        var $slides = options.slideExpr ? $(options.slideExpr, this) : $cont.children();
4752        var els = $slides.get();
4753        if (els.length < 2) {
4754            return; // don't bother
4755        }
4756
4757        // support metadata plugin (v1.0 and v2.0)
4758        var opts = $.extend({}, $.fn.cycle.defaults, options || {}, $.metadata ? $cont.metadata() : $.meta ? $cont.data() : {});
4759        var meta = $.isFunction($cont.data) ? $cont.data(opts.metaAttr) : null;
4760        if (meta)
4761            opts = $.extend(opts, meta);
4762
4763        opts.before = opts.before ? [opts.before] : [];
4764        opts.after = opts.after ? [opts.after] : [];
4765        opts.after.unshift(function(){ opts.busy=0; });
4766
4767        // allow shorthand overrides of width, height and timeout
4768        var cls = this.className;
4769        opts.width = parseInt((cls.match(/w:(\d+)/)||[])[1], 10) || opts.width;
4770        opts.height = parseInt((cls.match(/h:(\d+)/)||[])[1], 10) || opts.height;
4771        opts.timeout = parseInt((cls.match(/t:(\d+)/)||[])[1], 10) || opts.timeout;
4772
4773        if ($cont.css('position') == 'static')
4774            $cont.css('position', 'relative');
4775        if (opts.width)
4776            $cont.width(opts.width);
4777        if (opts.height && opts.height != 'auto')
4778            $cont.height(opts.height);
4779
4780        var first = 0;
4781        $slides.css({position: 'absolute', top:0}).each(function(i) {
4782            $(this).css('z-index', els.length-i);
4783        });
4784
4785        $(els[first]).css('opacity',1).show(); // opacity bit needed to handle reinit case
4786        if (msie)
4787            els[first].style.removeAttribute('filter');
4788
4789        if (opts.fit && opts.width)
4790            $slides.width(opts.width);
4791        if (opts.fit && opts.height && opts.height != 'auto')
4792            $slides.height(opts.height);
4793        if (opts.pause)
4794            $cont.hover(function(){this.cyclePause=1;}, function(){this.cyclePause=0;});
4795
4796        var txFn = $.fn.cycle.transitions[opts.fx];
4797        if (txFn)
4798            txFn($cont, $slides, opts);
4799
4800        $slides.each(function() {
4801            var $el = $(this);
4802            this.cycleH = (opts.fit && opts.height) ? opts.height : $el.height();
4803            this.cycleW = (opts.fit && opts.width) ? opts.width : $el.width();
4804        });
4805
4806        if (opts.cssFirst)
4807            $($slides[first]).css(opts.cssFirst);
4808
4809        if (opts.timeout) {
4810            // ensure that timeout and speed settings are sane
4811            if (opts.speed.constructor == String)
4812                opts.speed = {slow: 600, fast: 200}[opts.speed] || 400;
4813            if (!opts.sync)
4814                opts.speed = opts.speed / 2;
4815            while((opts.timeout - opts.speed) < 250)
4816                opts.timeout += opts.speed;
4817        }
4818        opts.speedIn = opts.speed;
4819        opts.speedOut = opts.speed;
4820
4821        opts.slideCount = els.length;
4822        opts.currSlide = first;
4823        opts.nextSlide = 1;
4824
4825        // fire artificial events
4826        var e0 = $slides[first];
4827        if (opts.before.length)
4828            opts.before[0].apply(e0, [e0, e0, opts, true]);
4829        if (opts.after.length > 1)
4830            opts.after[1].apply(e0, [e0, e0, opts, true]);
4831
4832        if (opts.click && !opts.next)
4833            opts.next = opts.click;
4834        if (opts.next)
4835            $(opts.next).unbind('click.cycle').bind('click.cycle', function(){return advance(els,opts,opts.rev?-1:1);});
4836        if (opts.prev)
4837            $(opts.prev).unbind('click.cycle').bind('click.cycle', function(){return advance(els,opts,opts.rev?1:-1);});
4838
4839        if (opts.timeout)
4840            this.cycleTimeout = setTimeout(function() {
4841                go(els,opts,0,!opts.rev);
4842            }, opts.timeout + (opts.delay||0));
4843    });
4844};
4845
4846function go(els, opts, manual, fwd) {
4847    if (opts.busy)
4848        return;
4849    var p = els[0].parentNode, curr = els[opts.currSlide], next = els[opts.nextSlide];
4850    if (p.cycleTimeout === 0 && !manual)
4851        return;
4852
4853    if (manual || !p.cyclePause) {
4854        if (opts.before.length)
4855            $.each(opts.before, function(i,o) { o.apply(next, [curr, next, opts, fwd]); });
4856        var after = function() {
4857            if (msie)
4858                this.style.removeAttribute('filter');
4859            $.each(opts.after, function(i,o) { o.apply(next, [curr, next, opts, fwd]); });
4860            queueNext(opts);
4861        };
4862
4863        if (opts.nextSlide != opts.currSlide) {
4864            opts.busy = 1;
4865            $.fn.cycle.custom(curr, next, opts, after);
4866        }
4867        var roll = (opts.nextSlide + 1) == els.length;
4868        opts.nextSlide = roll ? 0 : opts.nextSlide+1;
4869        opts.currSlide = roll ? els.length-1 : opts.nextSlide-1;
4870    } else {
4871      queueNext(opts);
4872    }
4873
4874    function queueNext(opts) {
4875        if (opts.timeout)
4876            p.cycleTimeout = setTimeout(function() { go(els,opts,0,!opts.rev); }, opts.timeout);
4877    }
4878}
4879
4880// advance slide forward or back
4881function advance(els, opts, val) {
4882    var p = els[0].parentNode, timeout = p.cycleTimeout;
4883    if (timeout) {
4884        clearTimeout(timeout);
4885        p.cycleTimeout = 0;
4886    }
4887    opts.nextSlide = opts.currSlide + val;
4888    if (opts.nextSlide < 0) {
4889        opts.nextSlide = els.length - 1;
4890    }
4891    else if (opts.nextSlide >= els.length) {
4892        opts.nextSlide = 0;
4893    }
4894    go(els, opts, 1, val>=0);
4895    return false;
4896}
4897
4898$.fn.cycle.custom = function(curr, next, opts, cb) {
4899    var $l = $(curr), $n = $(next);
4900    $n.css(opts.cssBefore);
4901    var fn = function() {$n.animate(opts.animIn, opts.speedIn, opts.easeIn, cb);};
4902    $l.animate(opts.animOut, opts.speedOut, opts.easeOut, function() {
4903        $l.css(opts.cssAfter);
4904        if (!opts.sync)
4905            fn();
4906    });
4907    if (opts.sync)
4908        fn();
4909};
4910
4911$.fn.cycle.transitions = {
4912    fade: function($cont, $slides, opts) {
4913        $slides.not(':eq(0)').hide();
4914        opts.cssBefore = { opacity: 0, display: 'block' };
4915        opts.cssAfter  = { display: 'none' };
4916        opts.animOut = { opacity: 0 };
4917        opts.animIn = { opacity: 1 };
4918    },
4919    fadeout: function($cont, $slides, opts) {
4920        opts.before.push(function(curr,next,opts,fwd) {
4921            $(curr).css('zIndex',opts.slideCount + (fwd === true ? 1 : 0));
4922            $(next).css('zIndex',opts.slideCount + (fwd === true ? 0 : 1));
4923        });
4924        $slides.not(':eq(0)').hide();
4925        opts.cssBefore = { opacity: 1, display: 'block', zIndex: 1 };
4926        opts.cssAfter  = { display: 'none', zIndex: 0 };
4927        opts.animOut = { opacity: 0 };
4928        opts.animIn = { opacity: 1 };
4929    }
4930};
4931
4932$.fn.cycle.ver = function() { return ver; };
4933
4934// @see: http://malsup.com/jquery/cycle/lite/
4935$.fn.cycle.defaults = {
4936    animIn:        {},
4937    animOut:       {},
4938    fx:           'fade',
4939    after:         null,
4940    before:        null,
4941    cssBefore:     {},
4942    cssAfter:      {},
4943    delay:         0,
4944    fit:           0,
4945    height:       'auto',
4946    metaAttr:     'cycle',
4947    next:          null,
4948    pause:         false,
4949    prev:          null,
4950    speed:         1000,
4951    slideExpr:     null,
4952    sync:          true,
4953    timeout:       4000
4954};
4955
4956})(jQuery);
4957
4958/*!
4959 * imagesLoaded PACKAGED v3.0.4
4960 * JavaScript is all like "You images are done yet or what?"
4961 * MIT License
4962 */
4963
4964(function(){"use strict";function e(){}function t(e,t){for(var n=e.length;n--;)if(e[n].listener===t)return n;return-1}function n(e){return function(){return this[e].apply(this,arguments)}}var i=e.prototype;i.getListeners=function(e){var t,n,i=this._getEvents();if("object"==typeof e){t={};for(n in i)i.hasOwnProperty(n)&&e.test(n)&&(t[n]=i[n])}else t=i[e]||(i[e]=[]);return t},i.flattenListeners=function(e){var t,n=[];for(t=0;e.length>t;t+=1)n.push(e[t].listener);return n},i.getListenersAsObject=function(e){var t,n=this.getListeners(e);return n instanceof Array&&(t={},t[e]=n),t||n},i.addListener=function(e,n){var i,r=this.getListenersAsObject(e),o="object"==typeof n;for(i in r)r.hasOwnProperty(i)&&-1===t(r[i],n)&&r[i].push(o?n:{listener:n,once:!1});return this},i.on=n("addListener"),i.addOnceListener=function(e,t){return this.addListener(e,{listener:t,once:!0})},i.once=n("addOnceListener"),i.defineEvent=function(e){return this.getListeners(e),this},i.defineEvents=function(e){for(var t=0;e.length>t;t+=1)this.defineEvent(e[t]);return this},i.removeListener=function(e,n){var i,r,o=this.getListenersAsObject(e);for(r in o)o.hasOwnProperty(r)&&(i=t(o[r],n),-1!==i&&o[r].splice(i,1));return this},i.off=n("removeListener"),i.addListeners=function(e,t){return this.manipulateListeners(!1,e,t)},i.removeListeners=function(e,t){return this.manipulateListeners(!0,e,t)},i.manipulateListeners=function(e,t,n){var i,r,o=e?this.removeListener:this.addListener,s=e?this.removeListeners:this.addListeners;if("object"!=typeof t||t instanceof RegExp)for(i=n.length;i--;)o.call(this,t,n[i]);else for(i in t)t.hasOwnProperty(i)&&(r=t[i])&&("function"==typeof r?o.call(this,i,r):s.call(this,i,r));return this},i.removeEvent=function(e){var t,n=typeof e,i=this._getEvents();if("string"===n)delete i[e];else if("object"===n)for(t in i)i.hasOwnProperty(t)&&e.test(t)&&delete i[t];else delete this._events;return this},i.removeAllListeners=n("removeEvent"),i.emitEvent=function(e,t){var n,i,r,o,s=this.getListenersAsObject(e);for(r in s)if(s.hasOwnProperty(r))for(i=s[r].length;i--;)n=s[r][i],n.once===!0&&this.removeListener(e,n.listener),o=n.listener.apply(this,t||[]),o===this._getOnceReturnValue()&&this.removeListener(e,n.listener);return this},i.trigger=n("emitEvent"),i.emit=function(e){var t=Array.prototype.slice.call(arguments,1);return this.emitEvent(e,t)},i.setOnceReturnValue=function(e){return this._onceReturnValue=e,this},i._getOnceReturnValue=function(){return this.hasOwnProperty("_onceReturnValue")?this._onceReturnValue:!0},i._getEvents=function(){return this._events||(this._events={})},"function"==typeof define&&define.amd?define(function(){return e}):"object"==typeof module&&module.exports?module.exports=e:this.EventEmitter=e}).call(this),function(e){"use strict";var t=document.documentElement,n=function(){};t.addEventListener?n=function(e,t,n){e.addEventListener(t,n,!1)}:t.attachEvent&&(n=function(t,n,i){t[n+i]=i.handleEvent?function(){var t=e.event;t.target=t.target||t.srcElement,i.handleEvent.call(i,t)}:function(){var n=e.event;n.target=n.target||n.srcElement,i.call(t,n)},t.attachEvent("on"+n,t[n+i])});var i=function(){};t.removeEventListener?i=function(e,t,n){e.removeEventListener(t,n,!1)}:t.detachEvent&&(i=function(e,t,n){e.detachEvent("on"+t,e[t+n]);try{delete e[t+n]}catch(i){e[t+n]=void 0}});var r={bind:n,unbind:i};"function"==typeof define&&define.amd?define(r):e.eventie=r}(this),function(e){"use strict";function t(e,t){for(var n in t)e[n]=t[n];return e}function n(e){return"[object Array]"===c.call(e)}function i(e){var t=[];if(n(e))t=e;else if("number"==typeof e.length)for(var i=0,r=e.length;r>i;i++)t.push(e[i]);else t.push(e);return t}function r(e,n){function r(e,n,s){if(!(this instanceof r))return new r(e,n);"string"==typeof e&&(e=document.querySelectorAll(e)),this.elements=i(e),this.options=t({},this.options),"function"==typeof n?s=n:t(this.options,n),s&&this.on("always",s),this.getImages(),o&&(this.jqDeferred=new o.Deferred);var a=this;setTimeout(function(){a.check()})}function c(e){this.img=e}r.prototype=new e,r.prototype.options={},r.prototype.getImages=function(){this.images=[];for(var e=0,t=this.elements.length;t>e;e++){var n=this.elements[e];"IMG"===n.nodeName&&this.addImage(n);for(var i=n.querySelectorAll("img"),r=0,o=i.length;o>r;r++){var s=i[r];this.addImage(s)}}},r.prototype.addImage=function(e){var t=new c(e);this.images.push(t)},r.prototype.check=function(){function e(e,r){return t.options.debug&&a&&s.log("confirm",e,r),t.progress(e),n++,n===i&&t.complete(),!0}var t=this,n=0,i=this.images.length;if(this.hasAnyBroken=!1,!i)return this.complete(),void 0;for(var r=0;i>r;r++){var o=this.images[r];o.on("confirm",e),o.check()}},r.prototype.progress=function(e){this.hasAnyBroken=this.hasAnyBroken||!e.isLoaded;var t=this;setTimeout(function(){t.emit("progress",t,e),t.jqDeferred&&t.jqDeferred.notify(t,e)})},r.prototype.complete=function(){var e=this.hasAnyBroken?"fail":"done";this.isComplete=!0;var t=this;setTimeout(function(){if(t.emit(e,t),t.emit("always",t),t.jqDeferred){var n=t.hasAnyBroken?"reject":"resolve";t.jqDeferred[n](t)}})},o&&(o.fn.imagesLoaded=function(e,t){var n=new r(this,e,t);return n.jqDeferred.promise(o(this))});var f={};return c.prototype=new e,c.prototype.check=function(){var e=f[this.img.src];if(e)return this.useCached(e),void 0;if(f[this.img.src]=this,this.img.complete&&void 0!==this.img.naturalWi
4964dth)return this.confirm(0!==this.img.naturalWidth,"naturalWidth"),void 0;var t=this.proxyImage=new Image;n.bind(t,"load",this),n.bind(t,"error",this),t.src=this.img.src},c.prototype.useCached=function(e){if(e.isConfirmed)this.confirm(e.isLoaded,"cached was confirmed");else{var t=this;e.on("confirm",function(e){return t.confirm(e.isLoaded,"cache emitted confirmed"),!0})}},c.prototype.confirm=function(e,t){this.isConfirmed=!0,this.isLoaded=e,this.emit("confirm",this,t)},c.prototype.handleEvent=function(e){var t="on"+e.type;this[t]&&this[t](e)},c.prototype.onload=function(){this.confirm(!0,"onload"),this.unbindProxyEvents()},c.prototype.onerror=function(){this.confirm(!1,"onerror"),this.unbindProxyEvents()},c.prototype.unbindProxyEvents=function(){n.unbind(this.proxyImage,"load",this),n.unbind(this.proxyImage,"error",this)},r}var o=e.jQuery,s=e.console,a=s!==void 0,c=Object.prototype.toString;"function"==typeof define&&define.amd?define(["eventEmitter/EventEmitter","eventie/eventie"],r):e.imagesLoaded=r(e.EventEmitter,e.eventie)}(window);
4965
4966/*jshint undef: true */
4967/*global jQuery: true */
4968
4969/*
4970   --------------------------------
4971   Infinite Scroll
4972   --------------------------------
4973   + https://github.com/paulirish/infinite-scroll
4974   + version 2.0b2.120519
4975   + Copyright 2011/12 Paul Irish & Luke Shumard
4976   + Licensed under the MIT license
4977
4978   + Documentation: http://infinite-scroll.com/
4979*/
4980
4981(function (window, $, undefined) {
4982	"use strict";
4983
4984    $.infinitescroll = function infscr(options, callback, element) {
4985        this.element = $(element);
4986
4987        // Flag the object in the event of a failed creation
4988        if (!this._create(options, callback)) {
4989            this.failed = true;
4990        }
4991    };
4992
4993    $.infinitescroll.defaults = {
4994        loading: {
4995            finished: undefined,
4996            finishedMsg: "<em>Congratulations, you've reached the end of the internet.</em>",
4997			img: js_local_vars.theme_url + '/images/loading.gif',
4998            msg: null,
4999            msgText: "<em>Loading the next set of posts...</em>",
5000            selector: null,
5001            speed: 'fast',
5002            start: undefined
5003        },
5004        state: {
5005            isDuringAjax: false,
5006            isInvalidPage: false,
5007            isDestroyed: false,
5008            isDone: false, // For when it goes all the way through the archive.
5009            isPaused: false,
5010            isBeyondMaxPage: false,
5011            currPage: 1
5012        },
5013        debug: false,
5014		behavior: undefined,
5015        binder: $(window), // used to cache the selector
5016        nextSelector: "div.navigation a:first",
5017        navSelector: "div.navigation",
5018        contentSelector: null, // rename to pageFragment
5019        extraScrollPx: 150,
5020        itemSelector: "div.post",
5021        animate: false,
5022        pathParse: undefined,
5023        dataType: 'html',
5024        appendCallback: true,
5025        bufferPx: 40,
5026        errorCallback: function () { },
5027        infid: 0, //Instance ID
5028        pixelsFromNavToBottom: undefined,
5029        path: undefined, // Either parts of a URL as an array (e.g. ["/page/", "/"] or a function that takes in the page number and returns a URL
5030		prefill: false, // When the document is smaller than the window, load data until the document is larger or links are exhausted
5031        maxPage: undefined // to manually control maximum page (when maxPage is undefined, maximum page limitation is not work)
5032	};
5033
5034    $.infinitescroll.prototype = {
5035
5036        /*
5037            ----------------------------
5038            Private methods
5039            ----------------------------
5040            */
5041
5042        // Bind or unbind from scroll
5043        _binding: function infscr_binding(binding) {
5044
5045            var instance = this,
5046            opts = instance.options;
5047
5048            opts.v = '2.0b2.120520';
5049
5050            // if behavior is defined and this function is extended, call that instead of default
5051            if (!!opts.behavior && this['_binding_'+opts.behavior] !== undefined) {
5052                this['_binding_'+opts.behavior].call(this);
5053                return;
5054            }
5055
5056            if (binding !== 'bind' && binding !== 'unbind') {
5057                this._debug('Binding value  ' + binding + ' not valid');
5058                return false;
5059            }
5060
5061            if (binding === 'unbind') {
5062                (this.options.binder).unbind('smartscroll.infscr.' + instance.options.infid);
5063            } else {
5064                (this.options.binder)[binding]('smartscroll.infscr.' + instance.options.infid, function () {
5065                    instance.scroll();
5066                });
5067            }
5068
5069            this._debug('Binding', binding);
5070        },
5071
5072        // Fundamental aspects of the plugin are initialized
5073        _create: function infscr_create(options, callback) {
5074
5075            // Add custom options to defaults
5076            var opts = $.extend(true, {}, $.infinitescroll.defaults, options);
5077			this.options = opts;
5078			var $window = $(window);
5079			var instance = this;
5080
5081			// Validate selectors
5082            if (!instance._validate(options)) {
5083				return false;
5084			}
5085
5086            // Validate page fragment path
5087            var path = $(opts.nextSelector).attr('href');
5088            if (!path) {
5089                this._debug('Navigation selector not found');
5090                return false;
5091            }
5092
5093            // Set the path to be a relative URL from root.
5094            opts.path = opts.path || this._determinepath(path);
5095
5096            // contentSelector is 'page fragment' option for .load() / .ajax() calls
5097            opts.contentSelector = opts.contentSelector || this.element;
5098
5099            // loading.selector - if we want to place the load message in a specific selector, defaulted to the contentSelector
5100            opts.loading.selector = opts.loading.selector || opts.contentSelector;
5101
5102            // Define loading.msg
5103            opts.loading.msg = opts.loading.msg || $('<div id="infscr-loading"><img alt="Loading..." src="' + opts.loading.img + '" /><div>' + opts.loading.msgText + '</div></div>');
5104
5105            // Preload loading.img
5106            (new Image()).src = opts.loading.img;
5107
5108            // distance from nav links to bottom
5109            // computed as: height of the document + top offset of container - top offset of nav link
5110            if(opts.pixelsFromNavToBottom === undefined) {
5111				opts.pixelsFromNavToBottom = $(document).height() - $(opts.navSelector).offset().top;
5112				this._debug("pixelsFromNavToBottom: " + opts.pixelsFromNavToBottom);
5113			}
5114
5115			var self = this;
5116
5117            // determine loading.start actions
5118            opts.loading.start = opts.loading.start || function() {
5119                $(opts.navSelector).hide();
5120                opts.loading.msg
5121                .appendTo(opts.loading.selector)
5122                .show(opts.loading.speed, $.proxy(function() {
5123					this.beginAjax(opts);
5124				}, self));
5125            };
5126
5127            // determine loading.finished actions
5128            opts.loading.finished = opts.loading.finished || function() {
5129                if (!opts.state.isBeyondMaxPage)
5130                    opts.loading.msg.fadeOut(opts.loading.speed);
5131            };
5132
5133			// callback loading
5134            opts.callback = function(instance, data, url) {
5135                if (!!opts.behavior && instance['_callback_'+opts.behavior] !== undefined) {
5136                    instance['_callback_'+opts.behavior].call($(opts.contentSelector)[0], data, url);
5137                }
5138
5139                if (callback) {
5140                    callback.call($(opts.contentSelector)[0], data, opts, url);
5141                }
5142
5143				if (opts.prefill) {
5144					$window.bind("resize.infinite-scroll", instance._prefill);
5145				}
5146            };
5147
5148			if (options.debug) {
5149				// Tell IE9 to use its built-in console
5150				if (Function.prototype.bind && (typeof console === 'object' || typeof console === 'function') && typeof console.log === "object") {
5151					["log","info","warn","error","assert","dir","clear","profile","profileEnd"]
5152						.forEach(function (method) {
5153							console[method] = this.call(console[method], console);
5154						}, Function.prototype.bind);
5155				}
5156			}
5157
5158            this._setup();
5159
5160			// Setups the prefill method for use
5161			if (opts.prefill) {
5162				this._prefill();
5163			}
5164
5165            // Return true to indicate successful creation
5166            return true;
5167        },
5168
5169		_prefill: function infscr_prefill() {
5170			var instance = this;
5171			var $window = $(window);
5172
5173			function needsPrefill() {
5174				return (instance.options.contentSelector.height() <= $window.height());
5175			}
5176
5177			this._prefill = function() {
5178				if (needsPrefill()) {
5179					instance.scroll();
5180				}
5181
5182				$window.bind("resize.infinite-scroll", function() {
5183					if (needsPrefill()) {
5184						$window.unbind("resize.infinite-scroll");
5185						instance.scroll();
5186					}
5187				});
5188			};
5189
5190			// Call self after setting up the new function
5191			this._prefill();
5192		},
5193
5194        // Console log wrapper
5195        _debug: function infscr_debug() {
5196			if (true !== this.options.debug) {
5197				return;
5198			}
5199
5200			if (typeof console !== 'undefined' && typeof console.log === 'function') {
5201				// Modern browsers
5202				// Single argument, which is a string
5203				if ((Array.prototype.slice.call(arguments)).length === 1 && typeof Array.prototype.slice.call(arguments)[0] === 'string') {
5204					console.log( (Array.prototype.slice.call(arguments)).toString() );
5205				} else {
5206					console.log( Array.prototype.slice.call(arguments) );
5207				}
5208			} else if (!Function.prototype.bind && typeof console !== 'undefined' && typeof console.log === 'object') {
5209				// IE8
5210				Function.prototype.call.call(console.log, console, Array.prototype.slice.call(arguments));
5211			}
5212        },
5213
5214        // find the number to increment in the path.
5215        _determinepath: function infscr_determinepath(path) {
5216
5217            var opts = this.options;
5218
5219            // if behavior is defined and this function is extended, call that instead of default
5220            if (!!opts.behavior && this['_determinepath_'+opts.behavior] !== undefined) {
5221                return this['_determinepath_'+opts.behavior].call(this,path);
5222            }
5223
5224            if (!!opts.pathParse) {
5225
5226                this._debug('pathParse manual');
5227                return opts.pathParse(path, this.options.state.currPage+1);
5228
5229            } else if (path.match(/^(.*?)\b2\b(.*?$)/)) {
5230                path = path.match(/^(.*?)\b2\b(.*?$)/).slice(1);
5231
5232                // if there is any 2 in the url at all.
5233            } else if (path.match(/^(.*?)2(.*?$)/)) {
5234
5235                // page= is used in django:
5236                // http://www.infinite-scroll.com/changelog/comment-page-1/#comment-127
5237                if (path.match(/^(.*?page=)2(\/.*|$)/)) {
5238                    path = path.match(/^(.*?page=)2(\/.*|$)/).slice(1);
5239                    return path;
5240                }
5241
5242                path = path.match(/^(.*?)2(.*?$)/).slice(1);
5243
5244            } else {
5245
5246                // page= is used in drupal too but second page is page=1 not page=2:
5247                // thx Jerod Fritz, vladikoff
5248                if (path.match(/^(.*?page=)1(\/.*|$)/)) {
5249                    path = path.match(/^(.*?page=)1(\/.*|$)/).slice(1);
5250                    return path;
5251                } else {
5252                    this._debug('Sorry, we couldn\'t parse your Next (Previous Posts) URL. Verify your the css selector points to the correct A tag. If you still get this error: yell, scream, and kindly ask for help at infinite-scroll.com.');
5253                    // Get rid of isInvalidPage to allow permalink to state
5254                    opts.state.isInvalidPage = true;  //prevent it from running on this page.
5255                }
5256            }
5257            this._debug('determinePath', path);
5258            return path;
5259
5260        },
5261
5262        // Custom error
5263        _error: function infscr_error(xhr) {
5264
5265            var opts = this.options;
5266
5267            // if behavior is defined and this function is extended, call that instead of default
5268            if (!!opts.behavior && this['_error_'+opts.behavior] !== undefined) {
5269                this['_error_'+opts.behavior].call(this,xhr);
5270                return;
5271            }
5272
5273            if (xhr !== 'destroy' && xhr !== 'end') {
5274                xhr = 'unknown';
5275            }
5276
5277            this._debug('Error', xhr);
5278
5279            if (xhr === 'end' || opts.state.isBeyondMaxPage) {
5280                this._showdonemsg();
5281            }
5282
5283            opts.state.isDone = true;
5284            opts.state.currPage = 1; // if you need to go back to this instance
5285            opts.state.isPaused = false;
5286            opts.state.isBeyondMaxPage = false;
5287            this._binding('unbind');
5288
5289        },
5290
5291        // Load Callback
5292        _loadcallback: function infscr_loadcallback(box, data, url) {
5293            var opts = this.options,
5294            callback = this.options.callback, // GLOBAL OBJECT FOR CALLBACK
5295            result = (opts.state.isDone) ? 'done' : (!opts.appendCallback) ? 'no-append' : 'append',
5296            frag;
5297
5298            // if behavior is defined and this function is extended, call that instead of default
5299            if (!!opts.behavior && this['_loadcallback_'+opts.behavior] !== undefined) {
5300                this['_loadcallback_'+opts.behavior].call(this,box,data);
5301                return;
5302            }
5303
5304			switch (result) {
5305				case 'done':
5306					this._showdonemsg();
5307					return false;
5308
5309				case 'no-append':
5310					if (opts.dataType === 'html') {
5311						data = '<div>' + data + '</div>';
5312						data = $(data).find(opts.itemSelector);
5313					}
5314					break;
5315
5316				case 'append':
5317					var children = box.children();
5318					// if it didn't return anything
5319					if (children.length === 0) {
5320						return this._error('end');
5321					}
5322
5323					// use a documentFragment because it works when content is going into a table or UL
5324					frag = document.createDocumentFragment();
5325					while (box[0].firstChild) {
5326						frag.appendChild(box[0].firstChild);
5327					}
5328
5329					this._debug('contentSelector', $(opts.contentSelector)[0]);
5330					$(opts.contentSelector)[0].appendChild(frag);
5331					// previously, we would pass in the new DOM element as context for the callback
5332					// however we're now using a documentfragment, which doesn't have parents or children,
5333					// so the context is the contentContainer guy, and we pass in an array
5334					// of the elements collected as the first argument.
5335
5336					data = children.get();
5337					break;
5338			}
5339
5340            // loadingEnd function
5341            opts.loading.finished.call($(opts.contentSelector)[0],opts);
5342
5343            // smooth scroll to ease in the new content
5344            if (opts.animate) {
5345                var scrollTo = $(window).scrollTop() + $(opts.loading.msg).height() + opts.extraScrollPx + 'px';
5346                $('html,body').animate({ scrollTop: scrollTo }, 800, function () { opts.state.isDuringAjax = false; });
5347            }
5348
5349            if (!opts.animate) {
5350				// once the call is done, we can allow it again.
5351				opts.state.isDuringAjax = false;
5352			}
5353
5354            callback(this, data, url);
5355
5356			if (opts.prefill) {
5357				this._prefill();
5358			}
5359		},
5360
5361        _nearbottom: function infscr_nearbottom() {
5362
5363            var opts = this.options,
5364            pixelsFromWindowBottomToBottom = 0 + $(document).height() - (opts.binder.scrollTop()) - $(window).height();
5365
5366            // if behavior is defined and this function is extended, call that instead of default
5367            if (!!opts.behavior && this['_nearbottom_'+opts.behavior] !== undefined) {
5368                return this['_nearbottom_'+opts.behavior].call(this);
5369            }
5370
5371            this._debug('math:', pixelsFromWindowBottomToBottom, opts.pixelsFromNavToBottom);
5372
5373            // if distance remaining in the scroll (including buffer) is less than the orignal nav to bottom....
5374            return (pixelsFromWindowBottomToBottom - opts.bufferPx < opts.pixelsFromNavToBottom);
5375
5376        },
5377
5378        // Pause / temporarily disable plugin from firing
5379        _pausing: function infscr_pausing(pause) {
5380
5381            var opts = this.options;
5382
5383            // if behavior is defined and this function is extended, call that instead of default
5384            if (!!opts.behavior && this['_pausing_'+opts.behavior] !== undefined) {
5385                this['_pausing_'+opts.behavior].call(this,pause);
5386                return;
5387            }
5388
5389            // If pause is not 'pause' or 'resume', toggle it's value
5390            if (pause !== 'pause' && pause !== 'resume' && pause !== null) {
5391                this._debug('Invalid argument. Toggling pause value instead');
5392            }
5393
5394            pause = (pause && (pause === 'pause' || pause === 'resume')) ? pause : 'toggle';
5395
5396            switch (pause) {
5397                case 'pause':
5398                    opts.state.isPaused = true;
5399                break;
5400
5401                case 'resume':
5402                    opts.state.isPaused = false;
5403                break;
5404
5405                case 'toggle':
5406                    opts.state.isPaused = !opts.state.isPaused;
5407                break;
5408            }
5409
5410            this._debug('Paused', opts.state.isPaused);
5411            return false;
5412
5413        },
5414
5415        // Behavior is determined
5416        // If the behavior option is undefined, it will set to default and bind to scroll
5417        _setup: function infscr_setup() {
5418
5419            var opts = this.options;
5420
5421            // if behavior is defined and this function is extended, call that instead of default
5422            if (!!opts.behavior && this['_setup_'+opts.behavior] !== undefined) {
5423                this['_setup_'+opts.behavior].call(this);
5424                return;
5425            }
5426
5427            this._binding('bind');
5428
5429            return false;
5430
5431        },
5432
5433        // Show done message
5434        _showdonemsg: function infscr_showdonemsg() {
5435
5436            var opts = this.options;
5437
5438            // if behavior is defined and this function is extended, call that instead of default
5439            if (!!opts.behavior && this['_showdonemsg_'+opts.behavior] !== undefined) {
5440                this['_showdonemsg_'+opts.behavior].call(this);
5441                return;
5442            }
5443
5444            opts.loading.msg
5445            .find('img')
5446            .hide()
5447            .parent()
5448            .find('div').html(opts.loading.finishedMsg).animate({ opacity: 1 }, 2000, function () {
5449                $(this).parent().fadeOut(opts.loading.speed);
5450            });
5451
5452            // user provided callback when done
5453            opts.errorCallback.call($(opts.contentSelector)[0],'done');
5454        },
5455
5456        // grab each selector option and see if any fail
5457        _validate: function infscr_validate(opts) {
5458            for (var key in opts) {
5459                if (key.indexOf && key.indexOf('Selector') > -1 && $(opts[key]).length === 0) {
5460                    this._debug('Your ' + key + ' found no elements.');
5461                    return false;
5462                }
5463            }
5464
5465            return true;
5466        },
5467
5468        /*
5469            ----------------------------
5470            Public methods
5471            ----------------------------
5472            */
5473
5474        // Bind to scroll
5475        bind: function infscr_bind() {
5476            this._binding('bind');
5477        },
5478
5479        // Destroy current instance of plugin
5480        destroy: function infscr_destroy() {
5481            this.options.state.isDestroyed = true;
5482			this.options.loading.finished();
5483            return this._error('destroy');
5484        },
5485
5486        // Set pause value to false
5487        pause: function infscr_pause() {
5488            this._pausing('pause');
5489        },
5490
5491        // Set pause value to false
5492        resume: function infscr_resume() {
5493            this._pausing('resume');
5494        },
5495
5496		beginAjax: function infscr_ajax(opts) {
5497			var instance = this,
5498				path = opts.path,
5499				box, desturl, method, condition;
5500
5501			// increment the URL bit. e.g. /page/3/
5502			opts.state.currPage++;
5503
5504            // Manually control maximum page
5505            if ( opts.maxPage != undefined && opts.state.currPage > opts.maxPage ){
5506                opts.state.isBeyondMaxPage = true;
5507                this.destroy();
5508                return;
5509            }
5510
5511			// if we're dealing with a table we can't use DIVs
5512			box = $(opts.contentSelector).is('table, tbody') ? $('<tbody/>') : $('<div/>');
5513
5514			desturl = (typeof path === 'function') ? path(opts.state.currPage) : path.join(opts.state.currPage);
5515			instance._debug('heading into ajax', desturl);
5516
5517			method = (opts.dataType === 'html' || opts.dataType === 'json' ) ? opts.dataType : 'html+callback';
5518			if (opts.appendCallback && opts.dataType === 'html') {
5519				method += '+callback';
5520			}
5521
5522			switch (method) {
5523				case 'html+callback':
5524					instance._debug('Using HTML via .load() method');
5525					box.load(desturl + ' ' + opts.itemSelector, undefined, function infscr_ajax_callback(responseText) {
5526						instance._loadcallback(box, responseText, desturl);
5527					});
5528
5529					break;
5530
5531				case 'html':
5532					instance._debug('Using ' + (method.toUpperCase()) + ' via $.ajax() method');
5533					$.ajax({
5534						// params
5535						url: desturl,
5536						dataType: opts.dataType,
5537						complete: function infscr_ajax_callback(jqXHR, textStatus) {
5538							condition = (typeof (jqXHR.isResolved) !== 'undefined') ? (jqXHR.isResolved()) : (textStatus === "success" || textStatus === "notmodified");
5539							if (condition) {
5540								instance._loadcallback(box, jqXHR.responseText, desturl);
5541							} else {
5542								instance._error('end');
5543							}
5544						}
5545					});
5546
5547					break;
5548				case 'json':
5549					instance._debug('Using ' + (method.toUpperCase()) + ' via $.ajax() method');
5550					$.ajax({
5551						dataType: 'json',
5552						type: 'GET',
5553						url: desturl,
5554						success: function (data, textStatus, jqXHR) {
5555							condition = (typeof (jqXHR.isResolved) !== 'undefined') ? (jqXHR.isResolved()) : (textStatus === "success" || textStatus === "notmodified");
5556							if (opts.appendCallback) {
5557								// if appendCallback is true, you must defined template in options.
5558								// note that data passed into _loadcallback is already an html (after processed in opts.template(data)).
5559								if (opts.template !== undefined) {
5560									var theData = opts.template(data);
5561									box.append(theData);
5562									if (condition) {
5563										instance._loadcallback(box, theData);
5564									} else {
5565										instance._error('end');
5566									}
5567								} else {
5568									instance._debug("template must be defined.");
5569									instance._error('end');
5570								}
5571							} else {
5572								// if appendCallback is false, we will pass in the JSON object. you should handle it yourself in your callback.
5573								if (condition) {
5574									instance._loadcallback(box, data, desturl);
5575								} else {
5576									instance._error('end');
5577								}
5578							}
5579						},
5580						error: function() {
5581							instance._debug("JSON ajax request failed.");
5582							instance._error('end');
5583						}
5584					});
5585
5586					break;
5587			}
5588		},
5589
5590        // Retrieve next set of content items
5591        retrieve: function infscr_retrieve(pageNum) {
5592			pageNum = pageNum || null;
5593
5594			var instance = this,
5595            opts = instance.options;
5596
5597            // if behavior is defined and this function is extended, call that instead of default
5598            if (!!opts.behavior && this['retrieve_'+opts.behavior] !== undefined) {
5599                this['retrieve_'+opts.behavior].call(this,pageNum);
5600                return;
5601            }
5602
5603            // for manual triggers, if destroyed, get out of here
5604            if (opts.state.isDestroyed) {
5605                this._debug('Instance is destroyed');
5606                return false;
5607            }
5608
5609            // we dont want to fire the ajax multiple times
5610            opts.state.isDuringAjax = true;
5611
5612            opts.loading.start.call($(opts.contentSelector)[0],opts);
5613        },
5614
5615        // Check to see next page is needed
5616        scroll: function infscr_scroll() {
5617
5618            var opts = this.options,
5619            state = opts.state;
5620
5621            // if behavior is defined and this function is extended, call that instead of default
5622            if (!!opts.behavior && this['scroll_'+opts.behavior] !== undefined) {
5623                this['scroll_'+opts.behavior].call(this);
5624                return;
5625            }
5626
5627            if (state.isDuringAjax || state.isInvalidPage || state.isDone || state.isDestroyed || state.isPaused) {
5628				return;
5629			}
5630
5631            if (!this._nearbottom()) {
5632				return;
5633			}
5634
5635            this.retrieve();
5636
5637        },
5638
5639        // Toggle pause value
5640        toggle: function infscr_toggle() {
5641            this._pausing();
5642        },
5643
5644        // Unbind from scroll
5645        unbind: function infscr_unbind() {
5646            this._binding('unbind');
5647        },
5648
5649        // update options
5650        update: function infscr_options(key) {
5651            if ($.isPlainObject(key)) {
5652                this.options = $.extend(true,this.options,key);
5653            }
5654        }
5655    };
5656
5657
5658    /*
5659        ----------------------------
5660        Infinite Scroll function
5661        ----------------------------
5662
5663        Borrowed logic from the following...
5664
5665        jQuery UI
5666        - https://github.com/jquery/jquery-ui/blob/master/ui/jquery.ui.widget.js
5667
5668        jCarousel
5669        - https://github.com/jsor/jcarousel/blob/master/lib/jquery.jcarou
5669sel.js
5670
5671        Masonry
5672        - https://github.com/desandro/masonry/blob/master/jquery.masonry.js
5673
5674*/
5675
5676    $.fn.infinitescroll = function infscr_init(options, callback) {
5677
5678
5679        var thisCall = typeof options;
5680
5681        switch (thisCall) {
5682
5683            // method
5684            case 'string':
5685                var args = Array.prototype.slice.call(arguments, 1);
5686
5687				this.each(function () {
5688					var instance = $.data(this, 'infinitescroll');
5689
5690					if (!instance) {
5691						// not setup yet
5692						// return $.error('Method ' + options + ' cannot be called until Infinite Scroll is setup');
5693						return false;
5694					}
5695
5696					if (!$.isFunction(instance[options]) || options.charAt(0) === "_") {
5697						// return $.error('No such method ' + options + ' for Infinite Scroll');
5698						return false;
5699					}
5700
5701					// no errors!
5702					instance[options].apply(instance, args);
5703				});
5704
5705            break;
5706
5707            // creation
5708            case 'object':
5709
5710                this.each(function () {
5711
5712                var instance = $.data(this, 'infinitescroll');
5713
5714                if (instance) {
5715
5716                    // update options of current instance
5717                    instance.update(options);
5718
5719                } else {
5720
5721                    // initialize new instance
5722                    instance = new $.infinitescroll(options, callback, this);
5723
5724                    // don't attach if instantiation failed
5725                    if (!instance.failed) {
5726                        $.data(this, 'infinitescroll', instance);
5727                    }
5728
5729                }
5730
5731            });
5732
5733            break;
5734
5735        }
5736
5737        return this;
5738    };
5739
5740
5741
5742    /*
5743     * smartscroll: debounced scroll event for jQuery *
5744     * https://github.com/lukeshumard/smartscroll
5745     * Based on smartresize by @louis_remi: https://github.com/lrbabe/jquery.smartresize.js *
5746     * Copyright 2011 Louis-Remi & Luke Shumard * Licensed under the MIT license. *
5747     */
5748
5749    var event = $.event,
5750    scrollTimeout;
5751
5752    event.special.smartscroll = {
5753        setup: function () {
5754            $(this).bind("scroll", event.special.smartscroll.handler);
5755        },
5756        teardown: function () {
5757            $(this).unbind("scroll", event.special.smartscroll.handler);
5758        },
5759        handler: function (event, execAsap) {
5760            // Save the context
5761            var context = this,
5762            args = arguments;
5763
5764            // set correct event type
5765            event.type = "smartscroll";
5766
5767            if (scrollTimeout) { clearTimeout(scrollTimeout); }
5768            scrollTimeout = setTimeout(function () {
5769                $(context).trigger('smartscroll', args);
5770            }, execAsap === "execAsap" ? 0 : 100);
5771        }
5772    };
5773
5774    $.fn.smartscroll = function (fn) {
5775        return fn ? this.bind("smartscroll", fn) : this.trigger("smartscroll", ["execAsap"]);
5776    };
5777
5778
5779})(window, jQuery);
5780
5781// Init style shamelessly stolen from jQuery http://jquery.com
5782var Froogaloop = (function(){
5783    // Define a local copy of Froogaloop
5784    function Froogaloop(iframe) {
5785        // The Froogaloop object is actually just the init constructor
5786        return new Froogaloop.fn.init(iframe);
5787    }
5788
5789    var eventCallbacks = {},
5790        hasWindowEvent = false,
5791        isReady = false,
5792        slice = Array.prototype.slice,
5793        playerDomain = '';
5794
5795    Froogaloop.fn = Froogaloop.prototype = {
5796        element: null,
5797
5798        init: function(iframe) {
5799            if (typeof iframe === "string") {
5800                iframe = document.getElementById(iframe);
5801            }
5802
5803            this.element = iframe;
5804
5805            // Register message event listeners
5806            playerDomain = getDomainFromUrl(this.element.getAttribute('src'));
5807
5808            return this;
5809        },
5810
5811        /*
5812         * Calls a function to act upon the player.
5813         *
5814         * @param {string} method The name of the Javascript API method to call. Eg: 'play'.
5815         * @param {Array|Function} valueOrCallback params Array of parameters to pass when calling an API method
5816         *                                or callback function when the method returns a value.
5817         */
5818        api: function(method, valueOrCallback) {
5819            if (!this.element || !method) {
5820                return false;
5821            }
5822
5823            var self = this,
5824                element = self.element,
vendor: 8,332 bytes, lines 5825-6095
5825                target_id = element.id !== '' ? element.id : null,
5826                params = !isFunction(valueOrCallback) ? valueOrCallback : null,
5827                callback = isFunction(valueOrCallback) ? valueOrCallback : null;
5828
5829            // Store the callback for get functions
5830            if (callback) {
5831                storeCallback(method, callback, target_id);
5832            }
5833
5834            postMessage(method, params, element);
5835            return self;
5836        },
5837
5838        /*
5839         * Registers an event listener and a callback function that gets called when the event fires.
5840         *
5841         * @param eventName (String): Name of the event to listen for.
5842         * @param callback (Function): Function that should be called when the event fires.
5843         */
5844        addEvent: function(eventName, callback) {
5845            if (!this.element) {
5846                return false;
5847            }
5848
5849            var self = this,
5850                element = self.element,
5851                target_id = element.id !== '' ? element.id : null;
5852
5853
5854            storeCallback(eventName, callback, target_id);
5855
5856            // The ready event is not registered via postMessage. It fires regardless.
5857            if (eventName != 'ready') {
5858                postMessage('addEventListener', eventName, element);
5859            }
5860            else if (eventName == 'ready' && isReady) {
5861                callback.call(null, target_id);
5862            }
5863
5864            return self;
5865        },
5866
5867        /*
5868         * Unregisters an event listener that gets called when the event fires.
5869         *
5870         * @param eventName (String): Name of the event to stop listening for.
5871         */
5872        removeEvent: function(eventName) {
5873            if (!this.element) {
5874                return false;
5875            }
5876
5877            var self = this,
5878                element = self.element,
5879                target_id = element.id !== '' ? element.id : null,
5880                removed = removeCallback(eventName, target_id);
5881
5882            // The ready event is not registered
5883            if (eventName != 'ready' && removed) {
5884                postMessage('removeEventListener', eventName, element);
5885            }
5886        }
5887    };
5888
5889    /**
5890     * Handles posting a message to the parent window.
5891     *
5892     * @param method (String): name of the method to call inside the player. For api calls
5893     * this is the name of the api method (api_play or api_pause) while for events this method
5894     * is api_addEventListener.
5895     * @param params (Object or Array): List of parameters to submit to the method. Can be either
5896     * a single param or an array list of parameters.
5897     * @param target (HTMLElement): Target iframe to post the message to.
5898     */
5899    function postMessage(method, params, target) {
5900        if (!target.contentWindow.postMessage) {
5901            return false;
5902        }
5903
5904        var url = target.getAttribute('src').split('?')[0],
5905            data = JSON.stringify({
5906                method: method,
5907                value: params
5908            });
5909
5910        if (url.substr(0, 2) === '//') {
5911            url = window.location.protocol + url;
5912        }
5913
5914        target.contentWindow.postMessage(data, url);
5915    }
5916
5917    /**
5918     * Event that fires whenever the window receives a message from its parent
5919     * via window.postMessage.
5920     */
5921    function onMessageReceived(event) {
5922        var data, method;
5923
5924        try {
5925            data = JSON.parse(event.data);
5926            method = data.event || data.method;
5927        }
5928        catch(e)  {
5929            //fail silently... like a ninja!
5930        }
5931
5932        if (method == 'ready' && !isReady) {
5933            isReady = true;
5934        }
5935
5936        // Handles messages from moogaloop only
5937        if (event.origin != playerDomain) {
5938            return false;
5939        }
5940
5941        var value = data.value,
5942            eventData = data.data,
5943            target_id = target_id === '' ? null : data.player_id,
5944
5945            callback = getCallback(method, target_id),
5946            params = [];
5947
5948        if (!callback) {
5949            return false;
5950        }
5951
5952        if (value !== undefined) {
5953            params.push(value);
5954        }
5955
5956        if (eventData) {
5957            params.push(eventData);
5958        }
5959
5960        if (target_id) {
5961            params.push(target_id);
5962        }
5963
5964        return params.length > 0 ? callback.apply(null, params) : callback.call();
5965    }
5966
5967
5968    /**
5969     * Stores submitted callbacks for each iframe being tracked and each
5970     * event for that iframe.
5971     *
5972     * @param eventName (String): Name of the event. Eg. api_onPlay
5973     * @param callback (Function): Function that should get executed when the
5974     * event is fired.
5975     * @param target_id (String) [Optional]: If handling more than one iframe then
5976     * it stores the different callbacks for different iframes based on the iframe's
5977     * id.
5978     */
5979    function storeCallback(eventName, callback, target_id) {
5980        if (target_id) {
5981            if (!eventCallbacks[target_id]) {
5982                eventCallbacks[target_id] = {};
5983            }
5984            eventCallbacks[target_id][eventName] = callback;
5985        }
5986        else {
5987            eventCallbacks[eventName] = callback;
5988        }
5989    }
5990
5991    /**
5992     * Retrieves stored callbacks.
5993     */
5994    function getCallback(eventName, target_id) {
5995        if (target_id) {
5996            return eventCallbacks[target_id][eventName];
5997        }
5998        else {
5999            return eventCallbacks[eventName];
6000        }
6001    }
6002
6003    function removeCallback(eventName, target_id) {
6004        if (target_id && eventCallbacks[target_id]) {
6005            if (!eventCallbacks[target_id][eventName]) {
6006                return false;
6007            }
6008            eventCallbacks[target_id][eventName] = null;
6009        }
6010        else {
6011            if (!eventCallbacks[eventName]) {
6012                return false;
6013            }
6014            eventCallbacks[eventName] = null;
6015        }
6016
6017        return true;
6018    }
6019
6020    /**
6021     * Returns a domain's root domain.
6022     * Eg. returns http://vimeo.com when http://vimeo.com/channels is sbumitted
6023     *
6024     * @param url (String): Url to test against.
6025     * @return url (String): Root domain of submitted url
6026     */
6027    function getDomainFromUrl(url) {
6028        if (url.substr(0, 2) === '//') {
6029            url = window.location.protocol + url;
6030        }
6031
6032        var url_pieces = url.split('/'),
6033            domain_str = '';
6034
6035        for(var i = 0, length = url_pieces.length; i < length; i++) {
6036            if(i<3) {domain_str += url_pieces[i];}
6037            else {break;}
6038            if(i<2) {domain_str += '/';}
6039        }
6040
6041        return domain_str;
6042    }
6043
6044    function isFunction(obj) {
6045        return !!(obj && obj.constructor && obj.call && obj.apply);
6046    }
6047
6048    function isArray(obj) {
6049        return toString.call(obj) === '[object Array]';
6050    }
6051
6052    // Give the init function the Froogaloop prototype for later instantiation
6053    Froogaloop.fn.init.prototype = Froogaloop.fn;
6054
6055    // Listens for the message event.
6056    // W3C
6057    if (window.addEventListener) {
6058        window.addEventListener('message', onMessageReceived, false);
6059    }
6060    // IE
6061    else {
6062        window.attachEvent('onmessage', onMessageReceived);
6063    }
6064
6065    // Expose froogaloop to the global object
6066    return (window.Froogaloop = window.$f = Froogaloop);
6067
6068})();
6069
6070/**!
6071 * easyPieChart
6072 * Lightweight plugin to render simple, animated and retina optimized pie charts
6073 *
6074 * @license
6075 * @author Robert Fleischmann <[email protected]> (http://robert-fleischmann.de)
6076 * @version 2.1.3
6077 **/
6078
6079(function(root, factory) {
6080    if(typeof exports === 'object') {
6081        module.exports = factory(require('jquery'));
6082    }
6083    else if(typeof define === 'function' && define.amd) {
6084        define(['jquery'], factory);
6085    }
6086    else {
6087        factory(root.jQuery);
6088    }
6089}(this, function($) {
6090/**
6091 * Renderer to render the chart on a canvas object
6092 * @param {DOMElement} el      DOM element to host the canvas (root of the plugin)
6093 * @param {object}     options options object of the plugin
6094 */
6095var CanvasRenderer = function(el, options) {
6096	var cachedBackground;
6097	var canvas = document.createElement('canvas');
6098
6099	el.appendChild(canvas);
6100
6101	if (typeof(G_vmlCanvasManager) !== 'undefined') {
6102		G_vmlCanvasManager.initElement(canvas);
6103	}
6104
6105	var ctx = canvas.getContext('2d');
6106
6107	canvas.width = canvas.height = options.size;
6108
6109	// canvas on retina devices
6110	var scaleBy = 1;
6111	if (window.devicePixelRatio > 1) {
6112		scaleBy = window.devicePixelRatio;
6113		canvas.style.width = canvas.style.height = [options.size, 'px'].join('');
6114		canvas.width = canvas.height = options.size * scaleBy;
6115		ctx.scale(scaleBy, scaleBy);
6116	}
6117
6118	// move 0,0 coordinates to the center
6119	ctx.translate(options.size / 2, options.size / 2);
6120
6121	// rotate canvas -90deg
6122	ctx.rotate((-1 / 2 + options.rotate / 180) * Math.PI);
6123
6124	var radius = (options.size - options.lineWidth) / 2;
6125	if (options.scaleColor && options.scaleLength) {
6126		radius -= options.scaleLength + 2; // 2 is the distance between scale and bar
6127	}
6128
6129	// IE polyfill for Date
6130	Date.now = Date.now || function() {
6131		return +(new Date());
6132	};
6133
6134	/**
6135	 * Draw a circle around the center of the canvas
6136	 * @param {strong} color     Valid CSS color string
6137	 * @param {number} lineWidth Width of the line in px
6138	 * @param {number} percent   Percentage to draw (float between -1 and 1)
6139	 */
6140	var drawCircle = function(color, lineWidth, percent) {
6141		percent = Math.min(Math.max(-1, percent || 0), 1);
6142		var isNegative = percent <= 0 ? true : false;
6143
6144		ctx.beginPath();
6145		ctx.arc(0, 0, radius, 0, Math.PI * 2 * percent, isNegative);
6146
6147		ctx.strokeStyle = color;
6148		ctx.lineWidth = lineWidth;
6149
6150		ctx.stroke();
6151	};
6152
6153	/**
6154	 * Draw the scale of the chart
6155	 */
6156	var drawScale = function() {
6157		var offset;
6158		var length;
6159
6160		ctx.lineWidth = 1;
6161		ctx.fillStyle = options.scaleColor;
6162
6163		ctx.save();
6164		for (var i = 24; i > 0; --i) {
6165			if (i % 6 === 0) {
6166				length = options.scaleLength;
6167				offset = 0;
6168			} else {
6169				length = options.scaleLength * 0.6;
6170				offset = options.scaleLength - length;
6171			}
6172			ctx.fillRect(-options.size/2 + offset, 0, length, 1);
6173			ctx.rotate(Math.PI / 12);
6174		}
6175		ctx.restore();
6176	};
6177
6178	/**
6179	 * Request animation frame wrapper with polyfill
6180	 * @return {function} Request animation frame method or timeout fallback
6181	 */
6182	var reqAnimationFrame = (function() {
6183		return  window.requestAnimationFrame ||
6184				window.webkitRequestAnimationFrame ||
6185				window.mozRequestAnimationFrame ||
6186				function(callback) {
6187					window.setTimeout(callback, 1000 / 60);
6188				};
6189	}());
6190
6191	/**
6192	 * Draw the background of the plugin including the scale and the track
6193	 */
6194	var drawBackground = function() {
6195		if(options.scaleColor) drawScale();
6196		if(options.trackColor) drawCircle(options.trackColor, options.lineWidth, 1);
6197	};
6198
6199  /**
6200    * Canvas accessor
6201   */
6202  this.getCanvas = function() {
6203    return canvas;
6204  };
6205
6206  /**
6207    * Canvas 2D context 'ctx' accessor
6208   */
6209  this.getCtx = function() {
6210    return ctx;
6211  };
6212
6213	/**
6214	 * Clear the complete canvas
6215	 */
6216	this.clear = function() {
6217		ctx.clearRect(options.size / -2, options.size / -2, options.size, options.size);
6218	};
6219
6220	/**
6221	 * Draw the complete chart
6222	 * @param {number} percent Percent shown by the chart between -100 and 100
6223	 */
6224	this.draw = function(percent) {
6225		// do we need to render a background
6226		if (!!options.scaleColor || !!options.trackColor) {
6227			// getImageData and putImageData are supported
6228			if (ctx.getImageData && ctx.putImageData) {
6229				if (!cachedBackground) {
6230					drawBackground();
6231					cachedBackground = ctx.getImageData(0, 0, options.size * scaleBy, options.size * scaleBy);
6232				} else {
6233					ctx.putImageData(cachedBackground, 0, 0);
6234				}
6235			} else {
6236				this.clear();
6237				drawBackground();
6238			}
6239		} else {
6240			this.clear();
6241		}
6242
6243		ctx.lineCap = options.lineCap;
6244
6245		// if barcolor is a function execute it and pass the percent as a value
6246		var color;
6247		if (typeof(options.barColor) === 'function') {
6248			color = options.barColor(percent);
6249		} else {
6250			color = options.barColor;
6251		}
6252
6253		// draw bar
6254		drawCircle(color, options.lineWidth, percent / 100);
6255	}.bind(this);
6256
6257	/**
6258	 * Animate from some percent to some other percentage
6259	 * @param {number} from Starting percentage
6260	 * @param {number} to   Final percentage
6261	 */
6262	this.animate = function(from, to) {
6263		var startTime = Date.now();
6264		options.onStart(from, to);
6265		var animation = function() {
6266			var process = Math.min(Date.now() - startTime, options.animate.duration);
6267			var currentValue = options.easing(this, process, from, to - from, options.animate.duration);
6268			this.draw(currentValue);
6269			options.onStep(from, to, currentValue);
6270			if (process >= options.animate.duration) {
6271				options.onStop(from, to);
6272			} else {
6273				reqAnimationFrame(animation);
6274			}
6275		}.bind(this);
6276
6277		reqAnimationFrame(animation);
6278	}.bind(this);
6279};
6280
6281var EasyPieChart = function(el, opts) {
6282	var defaultOptions = {
6283		barColor: '#ef1e25',
6284		trackColor: '#f9f9f9',
6285		scaleColor: '#dfe0e0',
6286		scaleLength: 5,
6287		lineCap: 'round',
6288		lineWidth: 3,
6289		size: 110,
6290		rotate: 0,
6291		animate: {
6292			duration: 1000,
6293			enabled: true
6294		},
6295		easing: function (x, t, b, c, d) { // more can be found here: http://gsgd.co.uk/sandbox/jquery/easing/
6296			t = t / (d/2);
6297			if (t < 1) {
6298				return c / 2 * t * t + b;
6299			}
6300			return -c/2 * ((--t)*(t-2) - 1) + b;
6301		},
6302		onStart: function(from, to) {
6303			return;
6304		},
6305		onStep: function(from, to, currentValue) {
6306			return;
6307		},
6308		onStop: function(from, to) {
6309			return;
6310		}
6311	};
6312
6313	// detect present renderer
6314	if (typeof(CanvasRenderer) !== 'undefined') {
6315		defaultOptions.renderer = CanvasRenderer;
6316	} else if (typeof(SVGRenderer) !== 'undefined') {
6317		defaultOptions.renderer = SVGRenderer;
6318	} else {
6319		throw new Error('Please load either the SVG- or the CanvasRenderer');
6320	}
6321
6322	var options = {};
6323	var currentValue = 0;
6324
6325	/**
6326	 * Initialize the plugin by creating the options object and initialize rendering
6327	 */
6328	var init = function() {
6329		this.el = el;
6330		this.options = options;
6331
6332		// merge user options into default options
6333		for (var i in defaultOptions) {
6334			if (defaultOptions.hasOwnProperty(i)) {
6335				options[i] = opts && typeof(opts[i]) !== 'undefined' ? opts[i] : defaultOptions[i];
6336				if (typeof(options[i]) === 'function') {
6337					options[i] = options[i].bind(this);
6338				}
6339			}
6340		}
6341
6342		// check for jQuery easing
6343		if (typeof(options.easing) === 'string' && typeof(jQuery) !== 'undefined' && jQuery.isFunction(jQuery.easing[options.easing])) {
6344			options.easing = jQuery.easing[options.easing];
6345		} else {
6346			options.easing = defaultOptions.easing;
6347		}
6348
6349		// process earlier animate option to avoid bc breaks
6350		if (typeof(options.animate) === 'number') {
6351			options.animate = {
6352				duration: options.animate,
6353				enabled: true
6354			};
6355		}
6356
6357		if (typeof(options.animate) === 'boolean' && !options.animate) {
6358			options.animate = {
6359				duration: 1000,
6360				enabled: options.animate
6361			};
6362		}
6363
6364		// create renderer
6365		this.renderer = new options.renderer(el, options);
6366
6367		// initial draw
6368		this.renderer.draw(currentValue);
6369
6370		// initial update
6371		if (el.dataset && el.dataset.percent) {
6372			this.update(parseFloat(el.dataset.percent));
6373		} else if (el.getAttribute && el.getAttribute('data-percent')) {
6374			this.update(parseFloat(el.getAttribute('data-percent')));
6375		}
6376	}.bind(this);
6377
6378	/**
6379	 * Update the value of the chart
6380	 * @param  {number} newValue Number between 0 and 100
6381	 * @return {object}          Instance of the plugin for method chaining
6382	 */
6383	this.update = function(newValue) {
6384		newValue = parseFloat(newValue);
6385		if (options.animate.enabled) {
6386			this.renderer.animate(currentValue, newValue);
6387		} else {
6388			this.renderer.draw(newValue);
6389		}
6390		currentValue = newValue;
6391		return this;
6392	}.bind(this);
6393
6394	/**
6395	 * Disable animation
6396	 * @return {object} Instance of the plugin for method chaining
6397	 */
6398	this.disableAnimation = function() {
6399		options.animate.enabled = false;
6400		return this;
6401	};
6402
6403	/**
6404	 * Enable animation
6405	 * @return {object} Instance of the plugin for method chaining
6406	 */
6407	this.enableAnimation = function() {
6408		options.animate.enabled = true;
6409		return this;
6410	};
6411
6412	init();
6413};
6414
6415$.fn.easyPieChart = function(options) {
6416	return this.each(function() {
6417		var instanceOptions;
6418
6419		if (!$.data(this, 'easyPieChart')) {
6420			instanceOptions = $.extend({}, options, $(this).data());
6421			$.data(this, 'easyPieChart', new EasyPieChart(this, instanceOptions));
6422		}
6423	});
6424};
6425
6426}));
6427
6428/*
6429 * jQuery.appear
6430 * https://github.com/bas2k/jquery.appear/
6431 * http://code.google.com/p/jquery-appear/
6432 *
6433 * Copyright (c) 2009 Michael Hixson
6434 * Copyright (c) 2012 Alexander Brovikov
6435 * Licensed under the MIT license (http://www.opensource.org/licenses/mit-license.php)
6436 */
6437(function($) {
6438    $.fn.appear = function(fn, options) {
6439
6440        var settings = $.extend({
6441
6442            //arbitrary data to pass to fn
6443            data: undefined,
6444
6445            //call fn only on the first appear?
6446            one: true,
6447
6448            // X & Y accuracy
6449            accX: 0,
6450            accY: 0
6451
6452        }, options);
6453
6454        return this.each(function() {
6455
6456            var t = $(this);
6457
6458            //whether the element is currently visible
6459            t.appeared = false;
6460
6461            if (!fn) {
6462
6463                //trigger the custom event
6464                t.trigger('appear', settings.data);
6465                return;
6466            }
6467
6468            var w = $(window);
6469
6470            //fires the appear event when appropriate
6471            var check = function() {
6472
6473                //is the element hidden?
6474                if (!t.is(':visible')) {
6475
6476                    //it became hidden
6477                    t.appeared = false;
6478                    return;
6479                }
6480
6481                //is the element inside the visible window?
6482                var a = w.scrollLeft();
6483                var b = w.scrollTop();
6484                var o = t.offset();
6485                var x = o.left;
6486                var y = o.top;
6487
6488                var ax = settings.accX;
6489                var ay = settings.accY;
6490                var th = t.height();
6491                var wh = w.height();
6492                var tw = t.width();
6493                var ww = w.width();
6494
6495                if (y + th + ay >= b &&
6496                    y <= b + wh + ay &&
6497                    x + tw + ax >= a &&
6498                    x <= a + ww + ax) {
6499
6500                    //trigger the custom event
6501                    if (!t.appeared) t.trigger('appear', settings.data);
6502
6503                } else {
6504
6505                    //it scrolled out of view
6506                    t.appeared = false;
6507                }
6508            };
6509
6510            //create a modified fn with some additional logic
6511            var modifiedFn = function() {
6512
6513                //mark the element as visible
6514                t.appeared = true;
6515
6516                //is this supposed to happen only once?
6517                if (settings.one) {
6518
6519                    //remove the check
6520                    w.unbind('scroll', check);
6521                    var i = $.inArray(check, $.fn.appear.checks);
6522                    if (i >= 0) $.fn.appear.checks.splice(i, 1);
6523                }
6524
6525                //trigger the original fn
6526                fn.apply(this, arguments);
6527            };
6528
6529            //bind the modified fn to the element
6530            if (settings.one) t.one('appear', settings.data, modifiedFn);
6531            else t.bind('appear', settings.data, modifiedFn);
6532
6533            //check whenever the window scrolls
6534            w.scroll(check);
6535
6536            //check whenever the dom changes
6537            $.fn.appear.checks.push(check);
6538
6539            //check now
6540            (check)();
6541        });
6542    };
6543
6544    //keep a queue of appearance checks
6545    $.extend($.fn.appear, {
6546
6547        checks: [],
6548        timeout: null,
6549
6550        //process the queue
6551        checkAll: function() {
6552            var length = $.fn.appear.checks.length;
6553            if (length > 0) while (length--) ($.fn.appear.checks[length])();
6554        },
6555
6556        //check the queue asynchronously
6557        run: function() {
6558            if ($.fn.appear.timeout) clearTimeout($.fn.appear.timeout);
6559            $.fn.appear.timeout = setTimeout($.fn.appear.checkAll, 20);
6560        }
6561    });
6562
6563    //run checks when these methods are called
6564    $.each(['append', 'prepend', 'after', 'before', 'attr',
6565        'removeAttr', 'addClass', 'removeClass', 'toggleClass',
6566        'remove', 'css', 'show', 'hide'], function(i, n) {
6567        var old = $.fn[n];
6568        if (old) {
6569            $.fn[n] = function() {
6570                var r = old.apply(this, arguments);
6571                $.fn.appear.run();
6572                return r;
6573            }
6574        }
6575    });
6576
6577})(jQuery);
6578
6579/* ========================================================================
6580 * Bootstrap: transition.js v3.1.1
6581 * http://getbootstrap.com/javascript/#transitions
6582 * ========================================================================
6583 * Copyright 2011-2014 Twitter, Inc.
6584 * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
6585 * ======================================================================== */
6586
6587
6588+function ($) {
6589  'use strict';
6590
6591  // CSS TRANSITION SUPPORT (Shoutout: http://www.modernizr.com/)
6592  // ============================================================
6593
6594  function transitionEnd() {
6595    var el = document.createElement('bootstrap');
6596
6597    var transEndEventNames = {
6598      'WebkitTransition' : 'webkitTransitionEnd',
6599      'MozTransition'    : 'transitionend',
6600      'OTransition'      : 'oTransitionEnd otransitionend',
6601      'transition'       : 'transitionend'
6602    };
6603
6604    for (var name in transEndEventNames) {
6605      if (el.style[name] !== undefined) {
6606        return { end: transEndEventNames[name] }
6607      }
6608    }
6609
6610    return false; // explicit for ie8 (  ._.)
6611  }
6612
6613  // http://blog.alexmaccaw.com/css-transitions
6614  $.fn.emulateTransitionEnd = function (duration) {
6615    var called = false, $el = this;
6616    $(this).one($.support.transition.end, function () { called = true });
6617    var callback = function () { if (!called) $($el).trigger($.support.transition.end) };
6618    setTimeout(callback, duration);
6619    return this;
6620  };
6621
6622  $(function () {
6623    $.support.transition = transitionEnd();
6624  })
6625
6626}(jQuery);
6627
6628/* ========================================================================
6629 * Bootstrap: collapse.js v3.1.1
6630 * http://getbootstrap.com/javascript/#collapse
6631 * ========================================================================
6632 * Copyright 2011-2014 Twitter, Inc.
6633 * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
6634 * ======================================================================== */
6635
6636
6637+function ($) {
6638  'use strict';
6639
6640  // COLLAPSE PUBLIC CLASS DEFINITION
6641  // ================================
6642
6643  var Collapse = function (element, options) {
6644    this.$element      = $(element);
6645    this.options       = $.extend({}, Collapse.DEFAULTS, options);
6646    this.transitioning = null;
6647
6648    if (this.options.parent) this.$parent = $(this.options.parent);
6649    if (this.options.toggle) this.toggle();
6650  };
6651
6652  Collapse.DEFAULTS = {
6653    toggle: true
6654  };
6655
6656  Collapse.prototype.dimension = function () {
6657    var hasWidth = this.$element.hasClass('width');
6658    return hasWidth ? 'width' : 'height';
6659  };
6660
6661  Collapse.prototype.show = function () {
6662    if (this.transitioning || this.$element.hasClass('in')) return;
6663
6664    var startEvent = $.Event('show.bs.collapse');
6665    this.$element.trigger(startEvent);
6666    if (startEvent.isDefaultPrevented()) return;
6667
6668    var actives = this.$parent && this.$parent.find('> .fusion-panel > .in');
6669
6670    if (actives && actives.length) {
6671      var hasData = actives.data('bs.collapse');
6672      if (hasData && hasData.transitioning) return;
6673      actives.collapse('hide');
6674      hasData || actives.data('bs.collapse', null)
6675    }
6676
6677    var dimension = this.dimension();
6678
6679    this.$element
6680      .removeClass('collapse')
6681      .addClass('collapsing')
6682      [dimension](0);
6683
6684    this.transitioning = 1;
6685
6686    var complete = function () {
6687      this.$element
6688        .removeClass('collapsing')
6689        .addClass('collapse in')
6690        [dimension]('auto');
6691      this.transitioning = 0;
6692      this.$element.trigger('shown.bs.collapse');
6693    };
6694
6695    if (!$.support.transition) return complete.call(this);
6696
6697    var scrollSize = $.camelCase(['scroll', dimension].join('-'));
6698
6699    this.$element
6700      .one($.support.transition.end, $.proxy(complete, this))
6701      .emulateTransitionEnd(350)
6702      [dimension](this.$element[0][scrollSize]);
6703  };
6704
6705  Collapse.prototype.hide = function () {
6706    if (this.transitioning || !this.$element.hasClass('in')) return;
6707
6708    var startEvent = $.Event('hide.bs.collapse');
6709    this.$element.trigger(startEvent);
6710    if (startEvent.isDefaultPrevented()) return;
6711
6712    var dimension = this.dimension();
6713
6714    this.$element
6715      [dimension](this.$element[dimension]())
6716      [0].offsetHeight;
6717
6718    this.$element
6719      .addClass('collapsing')
6720      .removeClass('collapse')
6721      .removeClass('in');
6722
6723    this.transitioning = 1;
6724
6725    var complete = function () {
6726      this.transitioning = 0;
6727      this.$element
6728        .trigger('hidden.bs.collapse')
6729        .removeClass('collapsing')
6730        .addClass('collapse');
6731    };
6732
6733    if (!$.support.transition) return complete.call(this);
6734
6735    this.$element
6736      [dimension](0)
6737      .one($.support.transition.end, $.proxy(complete, this))
6738      .emulateTransitionEnd(350);
6739  };
6740
6741  Collapse.prototype.toggle = function () {
6742    this[this.$element.hasClass('in') ? 'hide' : 'show']();
6743  };
6744
6745
6746  // COLLAPSE PLUGIN DEFINITION
6747  // ==========================
6748
6749  var old = $.fn.collapse;
6750
6751  $.fn.collapse = function (option) {
6752    return this.each(function () {
6753      var $this   = $(this);
6754      var data    = $this.data('bs.collapse');
6755      var options = $.extend({}, Collapse.DEFAULTS, $this.data(), typeof option == 'object' && option);
6756
6757      if (!data && options.toggle && option == 'show') option = !option;
6758      if (!data) $this.data('bs.collapse', (data = new Collapse(this, options)));
6759      if (typeof option == 'string') data[option]();
6760    })
6761  };
6762
6763  $.fn.collapse.Constructor = Collapse;
6764
6765
6766  // COLLAPSE NO CONFLICT
6767  // ====================
6768
6769  $.fn.collapse.noConflict = function () {
6770    $.fn.collapse = old;
6771    return this;
6772  };
6773
6774
6775  // COLLAPSE DATA-API
6776  // =================
6777
6778  $(document).on('click.bs.collapse.data-api', '[data-toggle=collapse]', function (e) {
6779    var $this   = $(this), href;
6780    var target  = $this.attr('data-target')
6781        || e.preventDefault()
6782        || (href = $this.attr('href')) && href.replace(/.*(?=#[^\s]+$)/, ''); //strip for ie7
6783    var $target = $(target);
6784    var data    = $target.data('bs.collapse');
6785    var option  = data ? 'toggle' : $this.data();
6786    var parent  = $this.attr('data-parent');
6787    var $parent = parent && $(parent);
6788
6789    if (!data || !data.transitioning) {
6790      if ($parent) $parent.find('[data-toggle=collapse][data-parent="' + parent + '"]').not($this).addClass('collapsed');
6791      $this[$target.hasClass('in') ? 'addClass' : 'removeClass']('collapsed');
6792    }
6793
6794    $target.collapse(option);
6795  });
6796
6797  jQuery('click.bs.collapse.data-api, [data-toggle=collapse]').each(function() {
6798  	var parent = jQuery(this).attr('data-parent');
6799
6800    if(jQuery(this).parents('.panel-group').length == 0) {
6801    	var random = Math.floor((Math.random() * 10) + 1);
6802    	var single_panel = jQuery(this).parents('.fusion-panel');
6803    	jQuery(this).attr('data-parent', 'accordian-' + random);
6804    	jQuery(single_panel).wrap('<div class="accordian fusion-accordian fusion-single-accordian"><div class="panel-group" id="accordion-' + random + '"></div></div>');
6805    }
6806  });
6807
6808}(jQuery);
6809
6810
6811/* ========================================================================
6812 * Bootstrap: modal.js v3.1.1
6813 * http://getbootstrap.com/javascript/#modals
6814 * ========================================================================
6815 * Copyright 2011-2014 Twitter, Inc.
6816 * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
6817 * ======================================================================== */
6818
6819
6820+function ($) {
6821  'use strict';
6822
6823  // MODAL CLASS DEFINITION
6824  // ======================
6825
6826  var Modal = function (element, options) {
6827    this.options   = options;
6828    this.$element  = $(element);
6829    this.$backdrop = '';
6830    this.isShown   = null;
6831
6832    if (this.options.remote) {
6833      this.$element
6834        .find('.modal-content')
6835        .load(this.options.remote, $.proxy(function () {
6836          this.$element.trigger('loaded.bs.modal');
6837        }, this));
6838    }
6839  };
6840
6841  Modal.DEFAULTS = {
6842    backdrop: true,
6843    keyboard: true,
6844    show: true
6845  };
6846
6847  Modal.prototype.toggle = function (_relatedTarget) {
6848    return this[!this.isShown ? 'show' : 'hide'](_relatedTarget);
6849  };
6850
6851  Modal.prototype.show = function (_relatedTarget) {
6852    var that = this;
6853    var e    = $.Event('show.bs.modal', { relatedTarget: _relatedTarget });
6854
6855    this.$element.trigger(e);
6856
6857    if (this.isShown || e.isDefaultPrevented()) return;
6858
6859    this.isShown = true;
6860
6861    this.escape();
6862
6863    this.$element.on('click.dismiss.bs.modal', '[data-dismiss="modal"]', $.proxy(this.hide, this));
6864
6865    this.backdrop(function () {
6866      var transition = $.support.transition && that.$element.hasClass('fade');
6867
6868      if (!that.$element.parent().length) {
6869        that.$element.appendTo(document.body); // don't move modals dom position
6870      }
6871
6872      that.$element
6873        .show()
6874        .scrollTop(0);
6875
6876      if (transition) {
6877        that.$element[0].offsetWidth; // force reflow
6878      }
6879
6880      that.$element
6881        .addClass('in')
6882        .attr('aria-hidden', false);
6883
6884      that.enforceFocus();
6885
6886      var e = $.Event('shown.bs.modal', { relatedTarget: _relatedTarget });
6887
6888      transition ?
6889        that.$element.find('.modal-dialog') // wait for modal to slide in
6890          .one($.support.transition.end, function () {
6891            that.$element.focus().trigger(e);
6892          })
6893          .emulateTransitionEnd(300) :
6894        that.$element.focus().trigger(e);
6895    })
6896  };
6897
6898  Modal.prototype.hide = function (e) {
6899    if (e) e.preventDefault();
6900
6901    e = $.Event('hide.bs.modal');
6902
6903    this.$element.trigger(e);
6904
6905    if (!this.isShown || e.isDefaultPrevented()) return;
6906
6907    this.isShown = false;
6908
6909    this.escape();
6910
6911    $(document).off('focusin.bs.modal');
6912
6913    this.$element
6914      .removeClass('in')
6915      .attr('aria-hidden', true)
6916      .off('click.dismiss.bs.modal');
6917
6918    $.support.transition && this.$element.hasClass('fade') ?
6919      this.$element
6920        .one($.support.transition.end, $.proxy(this.hideModal, this))
6921        .emulateTransitionEnd(300) :
6922      this.hideModal();
6923  };
6924
6925  Modal.prototype.enforceFocus = function () {
6926    $(document)
6927      .off('focusin.bs.modal') // guard against infinite focus loop
6928      .on('focusin.bs.modal', $.proxy(function (e) {
6929        if (this.$element[0] !== e.target && !this.$element.has(e.target).length) {
6930          this.$element.focus();
6931        }
6932      }, this));
6933  };
6934
6935  Modal.prototype.escape = function () {
6936    if (this.isShown && this.options.keyboard) {
6937      this.$element.on('keyup.dismiss.bs.modal', $.proxy(function (e) {
6938        e.which == 27 && this.hide();
6939      }, this));
6940    } else if (!this.isShown) {
6941      this.$element.off('keyup.dismiss.bs.modal');
6942    }
6943  };
6944
6945  Modal.prototype.hideModal = function () {
6946    var that = this;
6947    this.$element.hide();
6948    this.backdrop(function () {
6949      that.removeBackdrop();
6950      that.$element.trigger('hidden.bs.modal');
6951    });
6952  };
6953
6954  Modal.prototype.removeBackdrop = function () {
6955    this.$backdrop && this.$backdrop.remove();
6956    this.$backdrop = null;
6957  };
6958
6959  Modal.prototype.backdrop = function (callback) {
6960    var animate = this.$element.hasClass('fade') ? 'fade' : '';
6961
6962    if (this.isShown && this.options.backdrop) {
6963      var doAnimate = $.support.transition && animate;
6964
6965      this.$backdrop = $('<div class="modal-backdrop ' + animate + '" />')
6966        .appendTo(document.body);
6967
6968      this.$element.on('click.dismiss.bs.modal', $.proxy(function (e) {
6969        if (e.target !== e.currentTarget) return;
6970        this.options.backdrop == 'static'
6971          ? this.$element[0].focus.call(this.$element[0])
6972          : this.hide.call(this);
6973      }, this));
6974
6975      if (doAnimate) this.$backdrop[0].offsetWidth; // force reflow
6976
6977      this.$backdrop.addClass('in');
6978
6979      if (!callback) return;
6980
6981      doAnimate ?
6982        this.$backdrop
6983          .one($.support.transition.end, callback)
6984          .emulateTransitionEnd(150) :
6985        callback();
6986
6987    } else if (!this.isShown && this.$backdrop) {
6988      this.$backdrop.removeClass('in');
6989
6990      $.support.transition && this.$element.hasClass('fade') ?
6991        this.$backdrop
6992          .one($.support.transition.end, callback)
6993          .emulateTransitionEnd(150) :
6994        callback();
6995
6996    } else if (callback) {
6997      callback();
6998    }
6999  };
7000
7001
7002  // MODAL PLUGIN DEFINITION
7003  // =======================
7004
7005  var old = $.fn.modal;
7006
7007  $.fn.modal = function (option, _relatedTarget) {
7008    return this.each(function () {
7009      var $this   = $(this);
7010      var data    = $this.data('bs.modal');
7011      var options = $.extend({}, Modal.DEFAULTS, $this.data(), typeof option == 'object' && option);
7012
7013      if (!data) $this.data('bs.modal', (data = new Modal(this, options)));
7014      if (typeof option == 'string') data[option](_relatedTarget);
7015      else if (options.show) data.show(_relatedTarget);
7016    });
7017  };
7018
7019  $.fn.modal.Constructor = Modal;
7020
7021
7022  // MODAL NO CONFLICT
7023  // =================
7024
7025  $.fn.modal.noConflict = function () {
7026    $.fn.modal = old;
7027    return this;
7028  };
7029
7030
7031  // MODAL DATA-API
7032  // ==============
7033
7034  $(document).on('click.bs.modal.data-api', '[data-toggle="modal"]', function (e) {
7035    var $this   = $(this);
7036    var href    = $this.attr('href');
7037    var $target = $($this.attr('data-target') || (href && href.replace(/.*(?=#[^\s]+$)/, ''))); //strip for ie7
7038    var option  = $target.data('bs.modal') ? 'toggle' : $.extend({ remote: !/#/.test(href) && href }, $target.data(), $this.data());
7039
7040    if ($this.is('a')) e.preventDefault();
7041
7042    $target
7043      .modal(option, this)
7044      .one('hide', function () {
7045        $this.is(':visible') && $this.focus();
7046      });
7047  });
7048
7049  $(document)
7050    .on('show.bs.modal', '.modal', function () { $(document.body).addClass('modal-open') })
7051    .on('hidden.bs.modal', '.modal', function () { $(document.body).removeClass('modal-open') });
7052
7053}(jQuery);
7054
7055/* ========================================================================
7056 * Bootstrap: tab.js v3.1.1
7057 * http://getbootstrap.com/javascript/#tabs
7058 * ========================================================================
7059 * Copyright 2011-2014 Twitter, Inc.
7060 * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
7061 * ======================================================================== */
7062
7063
7064+function ($) {
7065  'use strict';
7066
7067  // TAB CLASS DEFINITION
7068  // ====================
7069
7070  var Tab = function (element) {
7071    this.element = $(element);
7072  };
7073
7074  Tab.prototype.show = function () {
7075    var $this    = this.element;
7076    var $ul      = $this.closest('ul:not(.dropdown-menu)');
7077    var selector = $this.data('target');
7078
7079    if (!selector) {
7080      selector = $this.attr('href');
7081      selector = selector && selector.replace(/.*(?=#[^\s]*$)/, ''); //strip for ie7
7082    }
7083
7084    if ($this.parent('li').hasClass('active')) return;
7085
7086    var previous = $ul.find('.active:last a')[0];
7087    var e        = $.Event('show.bs.tab', {
7088      relatedTarget: previous
7089    });
7090
7091    $this.trigger(e);
7092
7093    if (e.isDefaultPrevented()) return;
7094
7095    var $target = $(selector);
7096
7097    this.activate($this.parent('li'), $ul);
7098    this.activate($target, $target.parent(), function () {
7099      $this.trigger({
7100        type: 'shown.bs.tab',
7101        relatedTarget: previous
7102      });
7103    });
7104  };
7105
7106  Tab.prototype.activate = function (element, container, callback) {
7107    var $active    = container.find('> .active');
7108    var transition = callback
7109      && $.support.transition
7110      && $active.hasClass('fade');
7111
7112    function next() {
7113      $active
7114        .removeClass('active')
7115        .find('> .dropdown-menu > .active')
7116        .removeClass('active');
7117
7118      element.addClass('active');
7119
7120      if (transition) {
7121        element[0].offsetWidth; // reflow for transition
7122        element.addClass('in');
7123      } else {
7124        element.removeClass('fade');
7125      }
7126
7127      if (element.parent('.dropdown-menu')) {
7128        element.closest('li.dropdown').addClass('active');
7129      }
7130
7131      callback && callback();
7132    }
7133
7134    transition ?
7135      $active
7136        .one($.support.transition.end, next)
7137        .emulateTransitionEnd(150) :
7138      next();
7139
7140    $active.removeClass('in');
7141  };
7142
7143
7144  // TAB PLUGIN DEFINITION
7145  // =====================
7146
7147  var old = $.fn.tab;
7148
7149  $.fn.tab = function ( option ) {
7150    return this.each(function () {
7151      var $this = $(this);
7152      var data  = $this.data('bs.tab');
7153
7154      if (!data) $this.data('bs.tab', (data = new Tab(this)));
7155      if (typeof option == 'string') data[option]();
7156    });
7157  };
7158
7159  $.fn.tab.Constructor = Tab;
7160
7161
7162  // TAB NO CONFLICT
7163  // ===============
7164
7165  $.fn.tab.noConflict = function () {
7166    $.fn.tab = old;
7167    return this;
7168  };
7169
7170
7171  // TAB DATA-API
7172  // ============
7173
7174  $(document).on('click.bs.tab.data-api', '[data-toggle="tab"], [data-toggle="pill"]', function (e) {
7175    e.preventDefault();
7176    $(this).tab('show');
7177  });
7178
7179}(jQuery);
7180
7181
7182/* ========================================================================
7183 * Bootstrap: tooltip.js v3.1.1
7184 * http://getbootstrap.com/javascript/#tooltip
7185 * Inspired by the original jQuery.tipsy by Jason Frame
7186 * ========================================================================
7187 * Copyright 2011-2014 Twitter, Inc.
7188 * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
7189 * ======================================================================== */
7190
7191
7192+function ($) {
7193  'use strict';
7194
7195  // TOOLTIP PUBLIC CLASS DEFINITION
7196  // ===============================
7197
7198  var Tooltip = function (element, options) {
7199    this.type       = '';
7200    this.options    = '';
7201    this.enabled    = '';
7202    this.timeout    = '';
7203    this.hoverState = '';
7204    this.$element   = null;
7205
7206    this.init('tooltip', element, options);
7207  };
7208
7209  Tooltip.DEFAULTS = {
7210    animation: true,
7211    placement: 'top',
7212    selector: false,
7213    template: '<div class="tooltip"><div class="tooltip-arrow"></div><div class="tooltip-inner"></div></div>',
7214    trigger: 'hover focus',
7215    title: '',
7216    delay: 0,
7217    html: false,
7218    container: false
7219  };
7220
7221  Tooltip.prototype.init = function (type, element, options) {
7222    this.enabled  = true;
7223    this.type     = type;
7224    this.$element = $(element);
7225    this.options  = this.getOptions(options);
7226
7227    var triggers = this.options.trigger.split(' ');
7228
7229    for (var i = triggers.length; i--;) {
7230      var trigger = triggers[i];
7231
7232      if (trigger == 'click') {
7233        this.$element.on('click.' + this.type, this.options.selector, $.proxy(this.toggle, this));
7234      } else if (trigger != 'manual') {
7235        var eventIn  = trigger == 'hover' ? 'mouseenter' : 'focusin';
7236        var eventOut = trigger == 'hover' ? 'mouseleave' : 'focusout';
7237
7238        this.$element.on(eventIn  + '.' + this.type, this.options.selector, $.proxy(this.enter, this));
7239        this.$element.on(eventOut + '.' + this.type, this.options.selector, $.proxy(this.leave, this));
7240      }
7241    }
7242
7243    this.options.selector ?
7244      (this._options = $.extend({}, this.options, { trigger: 'manual', selector: '' })) :
7245      this.fixTitle();
7246  };
7247
7248  Tooltip.prototype.getDefaults = function () {
7249    return Tooltip.DEFAULTS;
7250  };
7251
7252  Tooltip.prototype.getOptions = function (options) {
7253    options = $.extend({}, this.getDefaults(), this.$element.data(), options);
7254
7255    if (options.delay && typeof options.delay == 'number') {
7256      options.delay = {
7257        show: options.delay,
7258        hide: options.delay
7259      };
7260    }
7261
7262    return options;
7263  };
7264
7265  Tooltip.prototype.getDelegateOptions = function () {
7266    var options  = {};
7267    var defaults = this.getDefaults();
7268
7269    this._options && $.each(this._options, function (key, value) {
7270      if (defaults[key] != value) options[key] = value;
7271    });
7272
7273    return options;
7274  };
7275
7276  Tooltip.prototype.enter = function (obj) {
7277    var self = obj instanceof this.constructor ?
7278      obj : $(obj.currentTarget)[this.type](this.getDelegateOptions()).data('bs.' + this.type);
7279
7280    clearTimeout(self.timeout);
7281
7282    self.hoverState = 'in';
7283
7284    if (!self.options.delay || !self.options.delay.show) return self.show();
7285
7286    self.timeout = setTimeout(function () {
7287      if (self.hoverState == 'in') self.show();
7288    }, self.options.delay.show);
7289  };
7290
7291  Tooltip.prototype.leave = function (obj) {
7292    var self = obj instanceof this.constructor ?
7293      obj : $(obj.currentTarget)[this.type](this.getDelegateOptions()).data('bs.' + this.type);
7294
7295    clearTimeout(self.timeout);
7296
7297    self.hoverState = 'out';
7298
7299    if (!self.options.delay || !self.options.delay.hide) return self.hide();
7300
7301    self.timeout = setTimeout(function () {
7302      if (self.hoverState == 'out') self.hide();
7303    }, self.options.delay.hide);
7304  };
7305
7306  Tooltip.prototype.show = function () {
7307    var e = $.Event('show.bs.' + this.type);
7308
7309    if (this.hasContent() && this.enabled) {
7310      this.$element.trigger(e);
7311
7312      if (e.isDefaultPrevented()) return;
7313      var that = this;
7314
7315      var $tip = this.tip();
7316
7317      this.setContent();
7318
7319      if (this.options.animation) $tip.addClass('fade');
7320
7321      var placement = typeof this.options.placement == 'function' ?
7322        this.options.placement.call(this, $tip[0], this.$element[0]) :
7323        this.options.placement;
7324
7325      var autoToken = /\s?auto?\s?/i;
7326      var autoPlace = autoToken.test(placement);
7327      if (autoPlace) placement = placement.replace(autoToken, '') || 'top';
7328
7329      $tip
7330        .detach()
7331        .css({ top: 0, left: 0, display: 'block' })
7332        .addClass(placement)
7333        .addClass(this.$element.data('class')); // Avada Edit
7334
7335      this.options.container ? $tip.appendTo(this.options.container) : $tip.insertAfter(this.$element);
7336
7337      var pos          = this.getPosition();
7338      var actualWidth  = $tip[0].offsetWidth;
7339      var actualHeight = $tip[0].offsetHeight;
7340
7341      if (autoPlace) {
7342        var $parent = this.$element.parent();
7343
7344        var orgPlacement = placement;
7345        var docScroll    = document.documentElement.scrollTop || document.body.scrollTop;
7346        var parentWidth  = this.options.container == 'body' ? window.innerWidth  : $parent.outerWidth();
7347        var parentHeight = this.options.container == 'body' ? window.innerHeight : $parent.outerHeight();
7348        var parentLeft   = this.options.container == 'body' ? 0 : $parent.offset().left;
7349
7350        placement = placement == 'bottom' && pos.top   + pos.height  + actualHeight - docScroll > parentHeight  ? 'top'    :
7351                    placement == 'top'    && pos.top   - docScroll   - actualHeight < 0                         ? 'bottom' :
7352                    placement == 'right'  && pos.right + actualWidth > parentWidth                              ? 'left'   :
7353                    placement == 'left'   && pos.left  - actualWidth < parentLeft                               ? 'right'  :
7354                    placement;
7355
7356        $tip
7357          .removeClass(orgPlacement)
7358          .addClass(placement);
7359      }
7360
7361      var calculatedOffset = this.getCalculatedOffset(placement, pos, actualWidth, actualHeight);
7362
7363      this.applyPlacement(calculatedOffset, placement);
7364      this.hoverState = null;
7365
7366      var complete = function() {
7367        that.$element.trigger('shown.bs.' + that.type);
7368      };
7369
7370      $.support.transition && this.$tip.hasClass('fade') ?
7371        $tip
7372          .one($.support.transition.end, complete)
7373          .emulateTransitionEnd(150) :
7374        complete();
7375    }
7376  };
7377
7378  Tooltip.prototype.applyPlacement = function (offset, placement) {
7379    var replace;
7380    var $tip   = this.tip();
7381    var width  = $tip[0].offsetWidth;
7382    var height = $tip[0].offsetHeight;
7383
7384    // manually read margins because getBoundingClientRect includes difference
7385    var marginTop = parseInt($tip.css('margin-top'), 10);
7386    var marginLeft = parseInt($tip.css('margin-left'), 10);
7387
7388    // we must check for NaN for ie 8/9
7389    if (isNaN(marginTop))  marginTop  = 0;
7390    if (isNaN(marginLeft)) marginLeft = 0;
7391
7392    offset.top  = offset.top  + marginTop;
7393    offset.left = offset.left + marginLeft;
7394
7395    // $.fn.offset doesn't round pixel values
7396    // so we use setOffset directly with our own function B-0
7397    $.offset.setOffset($tip[0], $.extend({
7398      using: function (props) {
7399        $tip.css({
7400          top: Math.round(props.top),
7401          left: Math.round(props.left)
7402        });
7403      }
7404    }, offset), 0);
7405
7406    $tip.addClass('in');
7407
7408    // check to see if placing tip in new offset caused the tip to resize itself
7409    var actualWidth  = $tip[0].offsetWidth;
7410    var actualHeight = $tip[0].offsetHeight;
7411
7412    if (placement == 'top' && actualHeight != height) {
7413      replace = true;
7414      offset.top = offset.top + height - actualHeight;
7415    }
7416
7417    if (/bottom|top/.test(placement)) {
7418      var delta = 0;
7419
7420      if (offset.left < 0) {
7421        delta       = offset.left * -2;
7422        offset.left = 0;
7423
7424        $tip.offset(offset);
7425
7426        actualWidth  = $tip[0].offsetWidth;
7427        actualHeight = $tip[0].offsetHeight;
7428      }
7429
7430      this.replaceArrow(delta - width + actualWidth, actualWidth, 'left');
7431    } else {
7432      this.replaceArrow(actualHeight - height, actualHeight, 'top');
7433    }
7434
7435    if (replace) $tip.offset(offset);
7436  };
7437
7438  Tooltip.prototype.replaceArrow = function (delta, dimension, position) {
7439    this.arrow().css(position, delta ? (50 * (1 - delta / dimension) + '%') : '');
7440  };
7441
7442  Tooltip.prototype.setContent = function () {
7443    var $tip  = this.tip();
7444    var title = this.getTitle();
7445
7446    $tip.find('.tooltip-inner')[this.options.html ? 'html' : 'text'](title);
7447    $tip.removeClass('fade in top bottom left right');
7448  };
7449
7450  Tooltip.prototype.hide = function () {
7451    var that = this;
7452    var $tip = this.tip();
7453    var e    = $.Event('hide.bs.' + this.type);
7454
7455    function complete() {
7456      if (that.hoverState != 'in') $tip.detach();
7457      that.$element.trigger('hidden.bs.' + that.type);
7458    };
7459
7460    this.$element.trigger(e);
7461
7462    if (e.isDefaultPrevented()) return;
7463
7464    $tip.removeClass('in');
7465
7466    $.support.transition && this.$tip.hasClass('fade') ?
7467      $tip
7468        .one($.support.transition.end, complete)
7469        .emulateTransitionEnd(150) :
7470      complete();
7471
7472    this.hoverState = null;
7473
7474    return this;
7475  };
7476
7477  Tooltip.prototype.fixTitle = function () {
7478    var $e = this.$element;
7479    if ($e.attr('title') || typeof($e.attr('data-original-title')) != 'string') {
7480      $e.attr('data-original-title', $e.attr('title') || '').attr('title', '');
7481    }
7482  };
7483
7484  Tooltip.prototype.hasContent = function () {
7485    return this.getTitle();
7486  };
7487
7488  Tooltip.prototype.getPosition = function () {
7489    var el = this.$element[0];
7490    return $.extend({}, (typeof el.getBoundingClientRect == 'function') ? el.getBoundingClientRect() : {
7491      width: el.offsetWidth,
7492      height: el.offsetHeight
7493    }, this.$element.offset());
7494  };
7495
7496  Tooltip.prototype.getCalculatedOffset = function (placement, pos, actualWidth, actualHeight) {
7497    return placement == 'bottom' ? { top: pos.top + pos.height,   left: pos.left + pos.width / 2 - actualWidth / 2  } :
7498           placement == 'top'    ? { top: pos.top - actualHeight, left: pos.left + pos.width / 2 - actualWidth / 2  } :
7499           placement == 'left'   ? { top: pos.top + pos.height / 2 - actualHeight / 2, left: pos.left - actualWidth } :
7500        /* placement == 'right' */ { top: pos.top + pos.height / 2 - actualHeight / 2, left: pos.left + pos.width   };
7501  };
7502
7503  Tooltip.prototype.getTitle = function () {
7504    var title;
7505    var $e = this.$element;
7506    var o  = this.options;
7507
7508    title = $e.attr('data-original-title')
7509      || (typeof o.title == 'function' ? o.title.call($e[0]) :  o.title);
7510
7511    return title;
7512  };
7513
7514  Tooltip.prototype.tip = function () {
7515    return this.$tip = this.$tip || $(this.options.template);
7516  };
7517
7518  Tooltip.prototype.arrow = function () {
7519    return this.$arrow = this.$arrow || this.tip().find('.tooltip-arrow');
7520  };
7521
7522  Tooltip.prototype.validate = function () {
7523    if (!this.$element[0].parentNode) {
7524      this.hide();
7525      this.$element = null;
7526      this.options  = null;
7527    }
7528  };
7529
7530  Tooltip.prototype.enable = function () {
7531    this.enabled = true;
7532  };
7533
7534  Tooltip.prototype.disable = function () {
7535    this.enabled = false;
7536  };
7537
7538  Tooltip.prototype.toggleEnabled = function () {
7539    this.enabled = !this.enabled;
7540  };
7541
7542  Tooltip.prototype.toggle = function (e) {
7543    var self = e ? $(e.currentTarget)[this.type](this.getDelegateOptions()).data('bs.' + this.type) : this;
7544    self.tip().hasClass('in') ? self.leave(self) : self.enter(self);
7545  };
7546
7547  Tooltip.prototype.destroy = function () {
7548    clearTimeout(this.timeout);
7549    this.hide().$element.off('.' + this.type).removeData('bs.' + this.type);
7550  };
7551
7552
7553  // TOOLTIP PLUGIN DEFINITION
7554  // =========================
7555
7556  var old = $.fn.tooltip;
7557
7558  $.fn.tooltip = function (option) {
7559    return this.each(function () {
7560      var $this   = $(this);
7561      var data    = $this.data('bs.tooltip');
7562      var options = typeof option == 'object' && option;
7563
7564      if (!data && option == 'destroy') return;
7565      if (!data) $this.data('bs.tooltip', (data = new Tooltip(this, options)));
7566      if (typeof option == 'string') data[option]();
7567    });
7568  };
7569
7570  $.fn.tooltip.Constructor = Tooltip;
7571
7572
7573  // TOOLTIP NO CONFLICT
7574  // ===================
7575
7576  $.fn.tooltip.noConflict = function () {
7577    $.fn.tooltip = old;
7578    return this;
7579  };
7580
7581}(jQuery);
7582
7583/* ========================================================================
7584 * Bootstrap: popover.js v3.1.1
7585 * http://getbootstrap.com/javascript/#popovers
7586 * ========================================================================
7587 * Copyright 2011-2014 Twitter, Inc.
7588 * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
7589 * ======================================================================== */
7590
7591
7592+function ($) {
7593  'use strict';
7594
7595  // POPOVER PUBLIC CLASS DEFINITION
7596  // ===============================
7597
7598  var Popover = function (element, options) {
7599    this.init('popover', element, options);
7600  };
7601
7602  if (!$.fn.tooltip) throw new Error('Popover requires tooltip.js');
7603
7604  Popover.DEFAULTS = $.extend({}, $.fn.tooltip.Constructor.DEFAULTS, {
7605    placement: 'right',
7606    trigger: 'click',
7607    content: '',
7608    template: '<div class="popover"><div class="arrow"></div><h3 class="popover-title"></h3><div class="popover-content"></div></div>'
7609  });
7610
7611
7612  // NOTE: POPOVER EXTENDS tooltip.js
7613  // ================================
7614
7615  Popover.prototype = $.extend({}, $.fn.tooltip.Constructor.prototype);
7616
7617  Popover.prototype.constructor = Popover;
7618
7619  Popover.prototype.getDefaults = function () {
7620    return Popover.DEFAULTS;
7621  };
7622
7623  Popover.prototype.setContent = function () {
7624    var $tip    = this.tip();
7625    var title   = this.getTitle();
7626    var content = this.getContent();
7627
7628    $tip.find('.popover-title')[this.options.html ? 'html' : 'text'](title);
7629    $tip.find('.popover-content')[ // we use append for html objects to maintain js events
7630      this.options.html ? (typeof content == 'string' ? 'html' : 'append') : 'text'
7631    ](content);
7632
7633    $tip.removeClass('fade top bottom left right in');
7634
7635    // IE8 doesn't accept hiding via the `:empty` pseudo selector, we have to do
7636    // this manually by checking the contents.
7637    if (!$tip.find('.popover-title').html()) $tip.find('.popover-title').hide();
7638  };
7639
7640  Popover.prototype.hasContent = function () {
7641    return this.getTitle() || this.getContent();
7642  };
7643
7644  Popover.prototype.getContent = function () {
7645    var $e = this.$element;
7646    var o  = this.options;
7647
7648    return $e.attr('data-content')
7649      || (typeof o.content == 'function' ?
7650            o.content.call($e[0]) :
7651            o.content);
7652  };
7653
7654  Popover.prototype.arrow = function () {
7655    return this.$arrow = this.$arrow || this.tip().find('.arrow');
7656  };
7657
7658  Popover.prototype.tip = function () {
7659    if (!this.$tip) this.$tip = $(this.options.template);
7660    return this.$tip;
7661  };
7662
7663
7664  // POPOVER PLUGIN DEFINITION
7665  // =========================
7666
7667  var old = $.fn.popover;
7668
7669  $.fn.popover = function (option) {
7670    return this.each(function () {
7671      var $this   = $(this);
7672      var data    = $this.data('bs.popover');
7673      var options = typeof option == 'object' && option;
7674
7675      if (!data && option == 'destroy') return;
7676      if (!data) $this.data('bs.popover', (data = new Popover(this, options)));
7677      if (typeof option == 'string') data[option]();
7678    });
7679  };
7680
7681  $.fn.popover.Constructor = Popover;
7682
7683
7684  // POPOVER NO CONFLICT
7685  // ===================
7686
7687  $.fn.popover.noConflict = function () {
7688    $.fn.popover = old;
7689    return this;
7690  };
7691
7692}(jQuery);
7693
7694
7695/*
7696 * jQuery Easing v1.3 - http://gsgd.co.uk/sandbox/jquery/easing/
7697 *
7698 * Uses the built in easing capabilities added In jQuery 1.1
7699 * to offer multiple easing options
7700 *
7701 * TERMS OF USE - jQuery Easing
7702 *
7703 * Open source under the BSD License.
7704 *
7705 * Copyright © 2008 George McGinley Smith
7706 * All rights reserved.
7707 *
7708 * Redistribution and use in source and binary forms, with or without modification,
7709 * are permitted provided that the following conditions are met:
7710 *
7711 * Redistributions of source code must retain the above copyright notice, this list of
7712 * conditions and the following disclaimer.
7713 * Redistributions in binary form must reproduce the above copyright notice, this list
7714 * of conditions and the following disclaimer in the documentation and/or other materials
7715 * provided with the distribution.
7716 *
7717 * Neither the name of the author nor the names of contributors may be used to endorse
7718 * or promote products derived from this software without specific prior written permission.
7719 *
7720 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
7721 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
7722 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
7723 *  COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
7724 *  EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
7725 *  GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
7726 * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
7727 *  NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
7728 * OF THE POSSIBILITY OF SUCH DAMAGE.
7729 *
7730*/
7731
7732// t: current time, b: begInnIng value, c: change In value, d: duration
7733jQuery.easing['jswing'] = jQuery.easing['swing'];
7734
7735jQuery.extend( jQuery.easing,
7736{
7737	def: 'easeOutQuad',
7738	swing: function (x, t, b, c, d) {
7739		//alert(jQuery.easing.default);
7740		return jQuery.easing[jQuery.easing.def](x, t, b, c, d);
7741	},
7742	easeInQuad: function (x, t, b, c, d) {
7743		return c*(t/=d)*t + b;
7744	},
7745	easeOutQuad: function (x, t, b, c, d) {
7746		return -c *(t/=d)*(t-2) + b;
7747	},
7748	easeInOutQuad: function (x, t, b, c, d) {
7749		if ((t/=d/2) < 1) return c/2*t*t + b;
7750		return -c/2 * ((--t)*(t-2) - 1) + b;
7751	},
7752	easeInCubic: function (x, t, b, c, d) {
7753		return c*(t/=d)*t*t + b;
7754	},
7755	easeOutCubic: function (x, t, b, c, d) {
7756		return c*((t=t/d-1)*t*t + 1) + b;
7757	},
7758	easeInOutCubic: function (x, t, b, c, d) {
7759		if ((t/=d/2) < 1) return c/2*t*t*t + b;
7760		return c/2*((t-=2)*t*t + 2) + b;
7761	},
7762	easeInQuart: function (x, t, b, c, d) {
7763		return c*(t/=d)*t*t*t + b;
7764	},
7765	easeOutQuart: function (x, t, b, c, d) {
7766		return -c * ((t=t/d-1)*t*t*t - 1) + b;
7767	},
7768	easeInOutQuart: function (x, t, b, c, d) {
7769		if ((t/=d/2) < 1) return c/2*t*t*t*t + b;
7770		return -c/2 * ((t-=2)*t*t*t - 2) + b;
7771	},
7772	easeInQuint: function (x, t, b, c, d) {
7773		return c*(t/=d)*t*t*t*t + b;
7774	},
7775	easeOutQuint: function (x, t, b, c, d) {
7776		return c*((t=t/d-1)*t*t*t*t + 1) + b;
7777	},
7778	easeInOutQuint: function (x, t, b, c, d) {
7779		if ((t/=d/2) < 1) return c/2*t*t*t*t*t + b;
7780		return c/2*((t-=2)*t*t*t*t + 2) + b;
7781	},
7782	easeInSine: function (x, t, b, c, d) {
7783		return -c * Math.cos(t/d * (Math.PI/2)) + c + b;
7784	},
7785	easeOutSine: function (x, t, b, c, d) {
7786		return c * Math.sin(t/d * (Math.PI/2)) + b;
7787	},
7788	easeInOutSine: function (x, t, b, c, d) {
7789		return -c/2 * (Math.cos(Math.PI*t/d) - 1) + b;
7790	},
7791	easeInExpo: function (x, t, b, c, d) {
7792		return (t==0) ? b : c * Math.pow(2, 10 * (t/d - 1)) + b;
7793	},
7794	easeOutExpo: function (x, t, b, c, d) {
7795		return (t==d) ? b+c : c * (-Math.pow(2, -10 * t/d) + 1) + b;
7796	},
7797	easeInOutExpo: function (x, t, b, c, d) {
7798		if (t==0) return b;
7799		if (t==d) return b+c;
7800		if ((t/=d/2) < 1) return c/2 * Math.pow(2, 10 * (t - 1)) + b;
7801		return c/2 * (-Math.pow(2, -10 * --t) + 2) + b;
7802	},
7803	easeInCirc: function (x, t, b, c, d) {
7804		return -c * (Math.sqrt(1 - (t/=d)*t) - 1) + b;
7805	},
7806	easeOutCirc: function (x, t, b, c, d) {
7807		return c * Math.sqrt(1 - (t=t/d-1)*t) + b;
7808	},
7809	easeInOutCirc: function (x, t, b, c, d) {
7810		if ((t/=d/2) < 1) return -c/2 * (Math.sqrt(1 - t*t) - 1) + b;
7811		return c/2 * (Math.sqrt(1 - (t-=2)*t) + 1) + b;
7812	},
7813	easeInElastic: function (x, t, b, c, d) {
7814		var s=1.70158;var p=0;var a=c;
7815		if (t==0) return b;  if ((t/=d)==1) return b+c;  if (!p) p=d*.3;
7816		if (a < Math.abs(c)) { a=c; var s=p/4; }
7817		else var s = p/(2*Math.PI) * Math.asin (c/a);
7818		return -(a*Math.pow(2,10*(t-=1)) * Math.sin( (t*d-s)*(2*Math.PI)/p )) + b;
7819	},
7820	easeOutElastic: function (x, t, b, c, d) {
7821		var s=1.70158;var p=0;var a=c;
7822		if (t==0) return b;  if ((t/=d)==1) return b+c;  if (!p) p=d*.3;
7823		if (a < Math.abs(c)) { a=c; var s=p/4; }
7824		else var s = p/(2*Math.PI) * Math.asin (c/a);
7825		return a*Math.pow(2,-10*t) * Math.sin( (t*d-s)*(2*Math.PI)/p ) + c + b;
7826	},
7827	easeInOutElastic: function (x, t, b, c, d) {
7828		var s=1.70158;var p=0;var a=c;
7829		if (t==0) return b;  if ((t/=d/2)==2) return b+c;  if (!p) p=d*(.3*1.5);
7830		if (a < Math.abs(c)) { a=c; var s=p/4; }
7831		else var s = p/(2*Math.PI) * Math.asin (c/a);
7832		if (t < 1) return -.5*(a*Math.pow(2,10*(t-=1)) * Math.sin( (t*d-s)*(2*Math.PI)/p )) + b;
7833		return a*Math.pow(2,-10*(t-=1)) * Math.sin( (t*d-s)*(2*Math.PI)/p )*.5 + c + b;
7834	},
7835	easeInBack: function (x, t, b, c, d, s) {
7836		if (s == undefined) s = 1.70158;
7837		return c*(t/=d)*t*((s+1)*t - s) + b;
7838	},
7839	easeOutBack: function (x, t, b, c, d, s) {
7840		if (s == undefined) s = 1.70158;
7841		return c*((t=t/d-1)*t*((s+1)*t + s) + 1) + b;
7842	},
7843	easeInOutBack: function (x, t, b, c, d, s) {
7844		if (s == undefined) s = 1.70158;
7845		if ((t/=d/2) < 1) return c/2*(t*t*(((s*=(1.525))+1)*t - s)) + b;
7846		return c/2*((t-=2)*t*(((s*=(1.525))+1)*t + s) + 2) + b;
7847	},
7848	easeInBounce: function (x, t, b, c, d) {
7849		return c - jQuery.easing.easeOutBounce (x, d-t, 0, c, d) + b;
7850	},
7851	easeOutBounce: function (x, t, b, c, d) {
7852		if ((t/=d) < (1/2.75)) {
7853			return c*(7.5625*t*t) + b;
7854		} else if (t < (2/2.75)) {
7855			return c*(7.5625*(t-=(1.5/2.75))*t + .75) + b;
7856		} else if (t < (2.5/2.75)) {
7857			return c*(7.5625*(t-=(2.25/2.75))*t + .9375) + b;
7858		} else {
7859			return c*(7.5625*(t-=(2.625/2.75))*t + .984375) + b;
7860		}
7861	},
7862	easeInOutBounce: function (x, t, b, c, d) {
7863		if (t < d/2) return jQuery.easing.easeInBounce (x, t*2, 0, c, d) * .5 + b;
7864		return jQuery.easing.easeOutBounce (x, t*2-d, 0, c, d) * .5 + c*.5 + b;
7865	}
7866});
7867
7868
7869/*
7870 * Dynamic javascript File Port
7871 */
7872
7873function insertParam(url, parameterName, parameterValue, atStart){
7874	replaceDuplicates = true;
7875
7876	if(url.indexOf('#') > 0){
7877		var cl = url.indexOf('#');
7878		urlhash = url.substring(url.indexOf('#'),url.length);
7879	} else {
7880		urlhash = '';
7881		cl = url.length;
7882	}
7883	sourceUrl = url.substring(0,cl);
7884
7885	var urlParts = sourceUrl.split("?");
7886	var newQueryString = "";
7887
7888	if (urlParts.length > 1)
7889	{
7890		var parameters = urlParts[1].split("&");
7891		for (var i=0; (i < parameters.length); i++)
7892		{
7893			var parameterParts = parameters[i].split("=");
7894			if (!(replaceDuplicates && parameterParts[0] == parameterName))
7895			{
7896				if (newQueryString == "") {
7897					newQueryString = "?" + parameterParts[0] + "=" + (parameterParts[1]?parameterParts[1]:'');
7898				}
7899				else {
7900					newQueryString += "&";
7901					newQueryString += parameterParts[0] + "=" + (parameterParts[1]?parameterParts[1]:'');
7902				}
7903			}
7904		}
7905	}
7906	if (newQueryString == "")
7907		newQueryString = "?";
7908
7909	if(atStart){
7910		newQueryString = '?'+ parameterName + "=" + parameterValue + (newQueryString.length>1?'&'+newQueryString.substring(1):'');
7911	} else {
7912		if (newQueryString !== "" && newQueryString != '?')
7913			newQueryString += "&";
7914		newQueryString += parameterName + "=" + (parameterValue?parameterValue:'');
7915	}
7916	return urlParts[0] + newQueryString + urlhash;
7917}
7918
7919function ytVidId(url) {
7920	var p = /^(?:https?:)?(\/\/)?(?:www\.)?(?:youtu\.be\/|youtube\.com\/(?:embed\/|v\/|watch\?v=|watch\?.+&v=))((\w|-){11}
7920)(?:\S+)?$/;
7921	return (url.match(p)) ? RegExp.$1 : false;
7922	//return (url.match(p)) ? true : false;
7923}
7924
7925jQuery(document).ready(function() {
7926	jQuery('.portfolio-wrapper').hide();
7927	jQuery('.portfolio-tabs ').hide();
7928	jQuery('.faq-tabs ').hide();
7929	if(jQuery('.portfolio').length >= 1) {
7930		jQuery('#content').append('<div class="loading-container"><img src="' + js_local_vars.theme_url + '/images/loading.gif' + '" alt="Loading..."><div class="loading-msg">'+js_local_vars.portfolio_loading_text+'</div>');
7931	}
7932	if(jQuery('.faqs').length >= 1) {
7933		jQuery('#content').append('<div class="loading-container"><img src="' + js_local_vars.theme_url + '/images/loading.gif' + '" alt="Loading..."><div class="loading-msg">'+js_local_vars.faqs_loading_text+'</div>');
7934	}
7935
7936	var iframes = jQuery('iframe');
7937	jQuery.each(iframes, function(i, v) {
7938		var src = jQuery(this).attr('src');
7939		if(src) {
7940			if(!Number(js_local_vars.status_vimeo) && src.indexOf('vimeo') >= 1) {
7941				jQuery(this).attr('id', 'player_'+(i+1));
7942				var new_src = insertParam(src, 'api', '1', false);
7943				var new_src_2 = insertParam(new_src, 'player_id', 'player_'+(i+1), false);
7944
7945				jQuery(this).attr('src', new_src_2);
7946			}
7947
7948			if(!Number(js_local_vars.status_yt) && ytVidId(src)) {
7949                jQuery(this).attr('id', 'player_'+(i+1));
7950				jQuery(this).parent().wrap('<span class="play3" />');
7951
7952				var new_src = insertParam(src, 'enablejsapi', '1', false);
7953
7954				jQuery(this).attr('src', new_src);
7955
7956				window.yt_vid_exists = true;
7957			}
7958		}
7959	});
7960
7961	if(!Number(js_local_vars.status_yt) && window.yt_vid_exists == true) {
7962		var tag = document.createElement('script');
7963		tag.src = window.location.protocol + "//www.youtube.com/iframe_api";
7964		var firstScriptTag = document.getElementsByTagName('script')[0];
7965		firstScriptTag.parentNode.insertBefore(tag, firstScriptTag);
7966	}
7967});
7968
7969
7970// Define YT_ready function.
7971var YT_ready = (function() {
7972	var onReady_funcs = [], api_isReady = false;
7973	/* @param func function     Function to execute on ready
7974	 * @param func Boolean      If true, all qeued functions are executed
7975	 * @param b_before Boolean  If true, the func will added to the first
7976	 position in the queue*/
7977	return function(func, b_before) {
7978		if (func === true) {
7979			api_isReady = true;
7980			while (onReady_funcs.length) {
7981				// Removes the first func from the array, and execute func
7982				onReady_funcs.shift()();
7983			}
7984		} else if (typeof func == "function") {
7985			if (api_isReady) func();
7986			else onReady_funcs[b_before?"unshift":"push"](func);
7987		}
7988	}
7989})();
7990
7991// This function will be called when the API is fully loaded
7992function onYouTubePlayerAPIReady() {YT_ready(true);}
7993
7994// Control header-v1 and sticky on tfs parallax pages
7995
7996// Setting some global vars. Those are also needed for the correct header resizing on none parallax slider pages
7997var orig_logo_height = jQuery('.header-wrapper' ).find( '.logo' ).height();
7998var orig_logo_container_margin_top = jQuery('.header-wrapper' ).find( '.logo' ).data( 'margin-top' );
7999var orig_logo_container_margin_bottom = jQuery('.header-wrapper' ).find( '.logo' ).data( 'margin-bottom' );
8000var orig_menu_height = jQuery( '.header-wrapper .fusion-navbar-nav > li > a' ).outerHeight();
8001var wrapper_position = jQuery( '#wrapper' ).position().left;
8002var is_parallax_tfs_slider = false;
8003
8004// Make sure that the modern sticky header animation is only used for the parallax special case with header above slider and on none transparent header
8005if( js_local_vars.header_sticky == '1' && jQuery( '.header-v1' ).length && jQuery( '.header-wrapper' ).css( 'position' ) != 'absolute' && jQuery( '.header-wrapper' ).prev().attr( 'id' ) != 'sliders-container'  ) {
8006
8007	jQuery( '.tfs-slider' ).each( function() {
8008		if( ! jQuery( this ).parents('.post-content').length && jQuery( this ).data( 'parallax' ) == 1 ) {
8009			is_parallax_tfs_slider = true;
8010
8011			jQuery( window ).scroll( animate_scrolled_header_v1 );
8012
8013			if( ! Modernizr.mq('only screen and (max-width: 1000px)') ) {
8014				jQuery( '#header-sticky' ).addClass( 'tfs_parallax' );
8015			}
8016		}
8017	});
8018
8019	// Only use modern sticky when parallax slider in sliders container is used
8020	if( is_parallax_tfs_slider ) {
8021
8022		if( orig_logo_height + parseInt(orig_logo_container_margin_top.replace( 'px', '' ) ) + parseInt( orig_logo_container_margin_bottom.replace( 'px', '' ) ) > orig_menu_height ) {
8023			var orig_header_height = orig_logo_height + parseInt(orig_logo_container_margin_top.replace( 'px', '' ) ) + parseInt( orig_logo_container_margin_bottom.replace( 'px', '' ) );
8024		} else {
8025			var orig_header_height = orig_menu_height;
8026		}
8027
8028		var is_scrolled = false;
8029		var scrolled_header_height = 65;
8030
8031		if( jQuery( '.header-wrapper' ).find( '.logo .logo_normal:visible' ) ) {
8032			var scrolled_logo_height = jQuery( '.header-v1' ).find( '.logo .normal_logo' ).height();
8033			if(  scrolled_logo_height < scrolled_header_height - 10 ) {
8034				var scrolled_logo_container_margin = ( scrolled_header_height - scrolled_logo_height ) / 2;
8035			} else {
8036				scrolled_logo_height = scrolled_header_height - 10;
8037				var scrolled_logo_container_margin = 5;
8038			}
8039		}
8040
8041		jQuery(window).on('resize', function() {
8042			wrapper_position = jQuery( '#wrapper' ).position().left;
8043
8044			if( Modernizr.mq('only screen and (max-width: 1000px)') ) {
8045				jQuery( '.header-v1' ).css( {
8046					'height': '',
8047					'position': ''
8048				});
8049
8050				jQuery( '#header-sticky' ).removeClass( 'tfs_parallax' );
8051			}
8052
8053			if( ! Modernizr.mq('only screen and (max-width: 1000px)') ) {
8054				if( is_scrolled ) {
8055					jQuery( '.header-wrapper' ).css({
8056						'margin-left': -wrapper_position + 'px',
8057						'height': scrolled_header_height
8058					});
8059
8060					jQuery( '.header-v1' ).css({
8061						'position': 'fixed',
8062						'left': '0',
8063						'height': scrolled_header_height,
8064						'width': '100%',
8065						'-webkit-box-shadow': '0 1px 3px rgba(0, 0, 0, 0.12)',
8066						'-moz-box-shadow': '0 1px 3px rgba(0, 0, 0, 0.12)',
8067						'box-shadow': '0 1px 3px rgba(0, 0, 0, 0.12)'
8068					});
8069
8070					jQuery( '.header-wrapper' ).find( '.avada-row' ).css({
8071						'padding-top': '0',
8072						'padding-bottom': '0'
8073					});
8074
8075					if( jQuery( '.header-wrapper' ).find( '.logo .logo_normal:visible' ) ) {
8076						jQuery( '.header-wrapper' ).find( '.logo .logo_normal' ).css({
8077							'height': scrolled_logo_height
8078						});
8079					}
8080
8081					jQuery( '.header-wrapper' ).find( '.logo' ).css({
8082						'margin-top': scrolled_logo_container_margin,
8083						'margin-bottom': scrolled_logo_container_margin
8084					});
8085
8086					jQuery( '.header-wrapper' ).find( '.fusion-navbar-nav > li > a' ).css({
8087						'height': scrolled_header_height - 3 + 'px',
8088						'line-height': scrolled_header_height - 3 + 'px'
8089					});
8090				}
8091
8092				if( ! is_scrolled ) {
8093					jQuery( '.header-wrapper, .header-v1' ).css( 'height', orig_header_height );
8094
8095					jQuery( '.header-wrapper' ).find( '.logo' ).css({
8096						'margin-top': orig_logo_container_margin_top,
8097						'margin-bottom': orig_logo_container_margin_top,
8098						'height': orig_logo_height
8099					});
8100
8101					jQuery( '.header-wrapper' ).find( '.fusion-navbar-nav > li > a' ).css({
8102						'height': orig_menu_height + 'px',
8103						'line-height': orig_menu_height + 'px'
8104					});
8105				}
8106
8107				jQuery( '#header-sticky' ).addClass( 'tfs_parallax' );
8108			}
8109		});
8110	}
8111}
8112
8113function animate_scrolled_header_v1() {
8114	wrapper_position = jQuery( '#wrapper' ).position().left;
8115
8116	if( ! Modernizr.mq('only screen and (max-width: 1000px)') ) {
8117		if( jQuery(window).scrollTop() > 0 ) {
8118			if( ! is_scrolled ) {
8119				jQuery( '.header-wrapper' ).css({
8120					'z-index': '5',
8121					'position': '',
8122					'margin-left': -wrapper_position + 'px',
8123					'height': orig_header_height
8124				});
8125
8126				jQuery( '.header-v1' ).css( {
8127					'z-index': '5',
8128					'position': 'fixed',
8129					'left': '0',
8130					'height': orig_header_height,
8131					'width': '100%',
8132					'-webkit-box-shadow': '0 1px 3px rgba(0, 0, 0, 0.12)',
8133					'-moz-box-shadow': '0 1px 3px rgba(0, 0, 0, 0.12)',
8134					'box-shadow': '0 1px 3px rgba(0, 0, 0, 0.12)',
8135					'-webkit-backface-visibility': 'hidden'
8136				});
8137
8138				jQuery( '.header-wrapper' ).find( '.fusion-navbar-nav > li > a' ).css( 'height', orig_menu_height );
8139
8140				jQuery( '.header-wrapper,	 .header-v1' ).stop(true, true).animate({
8141					height: scrolled_header_height
8142				}, { queue:false, duration:350, easing: 'easeOutCubic' });
8143
8144				jQuery( '.header-wrapper' ).find( '.avada-row' ).stop(true, true).animate({
8145					'padding-top': '0',
8146					'padding-bottom': '0'
8147				}, { queue:false, duration:350, easing: 'easeOutCubic' });
8148
8149				if( jQuery( '.header-wrapper' ).find( '.logo .logo_normal:visible' ) ) {
8150					var scrolled_logo_height = jQuery( '.header-v1' ).find( '.logo .normal_logo' ).height();
8151					if(  scrolled_logo_height < scrolled_header_height - 10 ) {
8152						var scrolled_logo_container_margin = ( scrolled_header_height - scrolled_logo_height ) / 2;
8153					} else {
8154						scrolled_logo_height = scrolled_header_height - 10;
8155						var scrolled_logo_container_margin = 5;
8156					}
8157
8158					jQuery( '.header-wrapper' ).find( '.logo .logo_normal' ).stop(true, true).animate({
8159						'height': scrolled_logo_height
8160					}, { queue:false, duration:350, easing: 'easeOutCubic' });
8161				}
8162
8163				jQuery( '.header-wrapper' ).find( '.logo' ).stop(true, true).animate({
8164					'margin-top': scrolled_logo_container_margin,
8165					'margin-bottom': scrolled_logo_container_margin
8166				}, { queue:false, duration:350, easing: 'easeOutCubic' });
8167
8168				jQuery( '.header-wrapper' ).find( '.fusion-navbar-nav > li > a' ).stop(true, true).animate({
8169					height: scrolled_header_height - 3,
8170					'line-height': scrolled_header_height - 3
8171				}, { queue:false, duration:350, easing: 'easeOutCubic', complete: function() {
8172						if( ! jQuery( '.header-v1 .nav-holder style' ).length ) {
8173							jQuery( '.header-v1 .nav-holder' ).prepend( '<style>.header-v1 #nav.nav-holder .navigation > .cart > a { height:' + scrolled_header_height + ';line-height:' + scrolled_header_height + '; }</style>' );
8174						}
8175					}
8176				});
8177			}
8178		} else {
8179			if( is_scrolled ) {
8180
8181				jQuery( '.header-v1' ).css( {
8182					'-webkit-box-shadow': '',
8183					'-moz-box-shadow': '',
8184					'box-shadow': '',
8185					'-webkit-backface-visibility': ''
8186				});
8187
8188				jQuery( '.header-wrapper, .header-v1' ).stop(true, true).animate({
8189					'height': orig_header_height
8190				}, { queue:false, duration:350, easing: 'easeOutCubic', complete: function() {
8191						jQuery( '.header-wrapper' ).css( 'margin-left', '' );
8192
8193						jQuery( this ).css({
8194							'position': 'relative',
8195							'width': ''
8196						});
8197					}
8198				});
8199
8200				jQuery( '.header-wrapper' ).find( '.avada-row' ).stop(true, true).animate({
8201					'padding-top': '0',
8202					'padding-bottom': '0'
8203				}, { queue:false, duration:350, easing: 'easeOutCubic' });
8204
8205				if( jQuery( '.header-wrapper' ).find( '.logo .logo_normal:visible' ) ) {
8206					jQuery( '.header-wrapper' ).find( '.logo .logo_normal' ).stop(true, true).animate({
8207						'height': orig_logo_height
8208					}, { queue:false, duration:350, easing: 'easeOutCubic' });
8209				}
8210
8211				jQuery( '.header-wrapper' ).find( '.logo' ).stop(true, true).animate({
8212					'margin-top': orig_logo_container_margin_top,
8213					'margin-bottom': orig_logo_container_margin_bottom
8214				}, { queue:false, duration:350, easing: 'easeOutCubic' });
8215
8216				jQuery( '.header-wrapper' ).find( '.fusion-navbar-nav > li > a' ).stop(true, true).animate({
8217					'height': orig_menu_height,
8218					'line-height': orig_menu_height
8219				}, { queue:false, duration:350, easing: 'easeOutCubic', complete: function() {
8220						if( jQuery( '.header-wrapper .nav-holder style' ).length ) {
8221							jQuery( '.header-wrapper .nav-holder style' ).remove();
8222						}
8223					}
8224				});
8225			}
8226		}
8227	}
8228
8229	if( jQuery(window).scrollTop() > 0 ) {
8230		is_scrolled = true;
8231	} else {
8232		is_scrolled = false;
8233	}
8234}
8235
8236jQuery(window).load(function() {
8237	var headerHeight = jQuery('.header-wrapper').height();
8238
8239	if( jQuery( '.header-v1' ).length ) {
8240		if( orig_logo_height + parseInt(orig_logo_container_margin_top.replace( 'px', '' ) ) + parseInt( orig_logo_container_margin_bottom.replace( 'px', '' ) ) > orig_menu_height ) {
8241			headerHeight = orig_logo_height + parseInt(orig_logo_container_margin_top.replace( 'px', '' ) ) + parseInt( orig_logo_container_margin_bottom.replace( 'px', '' ) );
8242		} else {
8243			headerHeight = orig_menu_height;
8244		}
8245	}
8246
8247	if(jQuery('#sidebar').is(':visible')) {
8248		jQuery('.post-content div.portfolio').each(function() {
8249			var columns = jQuery(this).data('columns');
8250			jQuery(this).addClass('portfolio-'+columns+'-sidebar');
8251		});
8252	}
8253
8254	if(jQuery().isotope) {
8255		// modified Isotope methods for gutters in masonry
8256		jQuery.Isotope.prototype._getMasonryGutterColumns = function() {
8257			var gutter = this.options.masonry && this.options.masonry.gutterWidth || 0;
8258			containerWidth = this.element.width();
8259
8260			this.masonry.columnWidth = this.options.masonry && this.options.masonry.columnWidth ||
8261				// or use the size of the first item
8262			this.$filteredAtoms.outerWidth(true) ||
8263				// if there's no items, use size of container
8264			containerWidth;
8265
8266			this.masonry.columnWidth += gutter;
8267
8268			this.masonry.cols = Math.floor( ( containerWidth + gutter ) / this.masonry.columnWidth );
8269			this.masonry.cols = Math.max( this.masonry.cols, 1 );
8270		};
8271
8272		jQuery.Isotope.prototype._masonryReset = function() {
8273			// layout-specific props
8274			this.masonry = {};
8275			// FIXME shouldn't have to call this again
8276			this._getMasonryGutterColumns();
8277			var i = this.masonry.cols;
8278			this.masonry.colYs = [];
8279			while (i--) {
8280				this.masonry.colYs.push( 0 );
8281			}
8282		};
8283
8284		jQuery.Isotope.prototype._masonryResizeChanged = function() {
8285			var prevSegments = this.masonry.cols;
8286			// update cols/rows
8287			this._getMasonryGutterColumns();
8288			// return if updated cols/rows is not equal to previous
8289			return ( this.masonry.cols !== prevSegments );
8290		};
8291
8292		imagesLoaded(jQuery('.portfolio-one .portfolio-wrapper'), function() {
8293			jQuery('.portfolio-wrapper').fadeIn();
8294			jQuery('.portfolio-tabs').fadeIn();
8295			jQuery('.faq-tabs').fadeIn();
8296			jQuery('.loading-container').fadeOut();
8297			jQuery('.portfolio-one .portfolio-wrapper').isotope({
8298				// options
8299				itemSelector: '.portfolio-item',
8300				layoutMode: 'straightDown',
8301				transformsEnabled: false
8302			});
8303			jQuery('[data-spy="scroll"]').each(function () {
8304				var $spy = jQuery(this).scrollspy('refresh');
8305			});
8306		});
8307
8308		imagesLoaded(jQuery('.portfolio-two .portfolio-wrapper, .portfolio-three .portfolio-wrapper, .portfolio-four .portfolio-wrapper'),function() {
8309			jQuery('.portfolio-wrapper').fadeIn();
8310			jQuery('.portfolio-tabs').fadeIn();
8311			jQuery('.loading-container').fadeOut();
8312			jQuery('.portfolio-two .portfolio-wrapper, .portfolio-three .portfolio-wrapper, .portfolio-four .portfolio-wrapper').isotope({
8313				// options
8314				itemSelector: '.portfolio-item',
8315				layoutMode: 'fitRows',
8316				transformsEnabled: false
8317			});
8318			jQuery('[data-spy="scroll"]').each(function () {
8319				var $spy = jQuery(this).scrollspy('refresh');
8320			});
8321		});
8322
8323		var masonryContainer = jQuery('.portfolio-masonry .portfolio-wrapper');
8324		imagesLoaded(masonryContainer, function() {
8325			jQuery('.portfolio-wrapper').fadeIn();
8326			jQuery('.portfolio-tabs').fadeIn();
8327			jQuery('.loading-container').fadeOut();
8328			var gridTwo = masonryContainer.parent().hasClass('portfolio-gri
8328d-2');
8329			var columns;
8330			if(gridTwo) {
8331				columns = 2;
8332			} else {
8333				columns = 3;
8334			}
8335			masonryContainer.isotope({
8336				// options
8337				itemSelector: '.portfolio-item',
8338				layoutMode: 'masonry',
8339				transformsEnabled: false,
8340				masonry: { columnWidth: masonryContainer.width() / columns }
8341			});
8342			jQuery('[data-spy="scroll"]').each(function () {
8343				var $spy = jQuery(this).scrollspy('refresh');
8344			});
8345		});
8346	}
8347
8348	if(jQuery().flexslider) {
8349		var avada_ytplayer;
8350
8351		if(!Number(js_local_vars.status_vimeo)) {
8352			function ready(player_id) {
8353				var froogaloop = $f(player_id);
8354
8355				var slide = jQuery('#' + player_id).parents('li');
8356
8357				froogaloop.addEvent('play', function (data) {
8358					jQuery('#' + player_id).parents('li').parent().parent().flexslider("pause");
8359				});
8360
8361				froogaloop.addEvent('pause', function (data) {
8362					if(jQuery(slide).attr('data-loop') == 'yes') {
8363						jQuery('#' + player_id).parents('li').parent().parent().flexslider("pause");
8364					} else {
8365						jQuery('#' + player_id).parents('li').parent().parent().flexslider("play");
8366					}
8367				});
8368			}
8369
8370			var vimeoPlayers = jQuery('.flexslider').find('iframe'), player;
8371
8372			jQuery('.flexslider').find('iframe').each(function () {
8373				var id = jQuery(this).attr('id');
8374
8375				if(id) {
8376					$f(id).addEvent('ready', ready);
8377				}
8378			});
8379
8380			function addEvent(element, eventName, callback) {
8381				if (element.addEventListener) {
8382					element.addEventListener(eventName, callback, false)
8383				} else {
8384					element.attachEvent(eventName, callback, false);
8385				}
8386			}
8387		}
8388
8389		jQuery('.full-video, .video-shortcode, .wooslider .slide-content').not('#bbpress-forums full-video, #bbpress-forums .video-shortcode, #bbpress-forums .wooslider .slide-content').fitVids();
8390		jQuery('#bbpress-forums').fitVids();
8391
8392		jQuery('.tfs-slider').each(function() {
8393			var this_tfslider = this;
8394
8395			var first_slide = jQuery(this_tfslider).find('li').get(0);
8396
8397			if(jQuery(this_tfslider).parents('.post-content').length >= 1) {
8398				jQuery(this_tfslider).data('parallax', 0);
8399			}
8400
8401			if(cssua.ua.tablet_pc) {
8402				jQuery(this_tfslider).data('full_screen', 0);
8403				jQuery(this_tfslider).data('parallax', 0);
8404			}
8405
8406			if(cssua.ua.mobile) {
8407				jQuery(this_tfslider).data('parallax', 0);
8408			}
8409
8410			wpadminbarHeight = 0;
8411			if(jQuery('#wpadminbar').length >= 1) {
8412				var wpadminbarHeight = jQuery('#wpadminbar').height();
8413			}
8414
8415			if(jQuery(this_tfslider).data('full_screen') == 1) {
8416				var sliderHeight = jQuery(window).height();
8417				if(jQuery(this_tfslider).parents('#sliders-container').next().hasClass('header-wrapper')) {
8418					sliderHeight = sliderHeight + (headerHeight - wpadminbarHeight);
8419				}
8420
8421				if(Modernizr.mq('only screen and (max-width: 800px)')) {
8422					var sliderHeight = jQuery(window).height() - (headerHeight + wpadminbarHeight);
8423				}
8424
8425				jQuery(this_tfslider).find('video').each(function() {
8426					var aspect_ratio = jQuery(this).width() / jQuery(this).height();
8427					var arc_sliderWidth = aspect_ratio * sliderHeight;
8428					var arc_sliderLeft = '-' + ((arc_sliderWidth - jQuery(this_tfslider).width()) / 2) + 'px';
8429					if(jQuery('#wrapper').width() > arc_sliderWidth) {
8430						arc_sliderWidth = '100%';
8431						arc_sliderLeft = 0;
8432					}
8433					jQuery(this).width(arc_sliderWidth);
8434					jQuery(this).css('left', arc_sliderLeft);
8435				});
8436			} else {
8437				var sliderWidth = jQuery(this_tfslider).data('slider_width');
8438				var sliderHeight = parseInt(jQuery(this_tfslider).data('slider_height'));
8439			}
8440
8441			if(jQuery(this_tfslider).data('full_screen') == 1) {
8442				jQuery(this_tfslider).css('max-width', '100%');
8443				jQuery(this_tfslider).find('.slides, .background').css('width', '100%');
8444			}
8445
8446			jQuery(this_tfslider).parents('.fusion-slider-container').css('height', sliderHeight);
8447			jQuery(this_tfslider).css('height', sliderHeight);
8448			jQuery(this_tfslider).find('.background, .mobile_video_image').css('height', sliderHeight);
8449
8450			if(jQuery('.layout-boxed-mode').length >= 1) {
8451				var boxed_mode_width = jQuery('.layout-boxed-mode #wrapper').width();
8452				jQuery(this_tfslider).css('width', boxed_mode_width);
8453				jQuery(this_tfslider).css('margin-left', 'auto');
8454				jQuery(this_tfslider).css('margin-right', 'auto');
8455				/*
8456				if(jQuery(this_tfslider).data('slider_width') == '100%') {
8457					jQuery(this_tfslider).css('left', Math.ceil(jQuery(window).width() / 2));
8458					jQuery(this_tfslider).css('margin-left', '-' + (boxed_mode_width / 2) + 'px');
8459				}
8460				*/
8461				if(jQuery(this_tfslider).data('parallax') == 1 && ! Modernizr.mq('only screen and (max-width: 1000px)')) {
8462					jQuery(this_tfslider).css('left', '50%');
8463					jQuery(this_tfslider).css('margin-left', '-' + (boxed_mode_width / 2) + 'px');
8464				}
8465				jQuery(this_tfslider).find('.slides, .background').css('width', '100%');
8466			}
8467
8468			if(cssua.ua.mobile) {
8469				jQuery(this_tfslider).find('a.button').each(function() {
8470					jQuery(this).removeClass('xlarge large medium button-xlarge button-large button-medium');
8471					jQuery(this).addClass('small button-small');
8472				});
8473				jQuery(this_tfslider).find('li').each(function() {
8474					jQuery(this).attr('data-autoplay', 'no');
8475					jQuery(this).data('autoplay', 'no');
8476				});
8477			}
8478
8479			jQuery(this_tfslider).find('a.button').each(function() {
8480				jQuery(this).data('old', jQuery(this).attr('class'));
8481			});
8482
8483			if(Modernizr.mq('only screen and (max-width: 800px)')) {
8484				jQuery(this_tfslider).find('a.button').each(function() {
8485					jQuery(this).data('old', jQuery(this).attr('class'));
8486					jQuery(this).removeClass('xlarge large medium button-xlarge button-large button-medium');
8487					jQuery(this).addClass('small button-small');
8488				});
8489			} else {
8490				jQuery(this_tfslider).find('a.button').each(function() {
8491					jQuery(this).attr('class', jQuery(this).data('old'));
8492				});
8493			}
8494
8495			if(jQuery(this_tfslider).data('parallax') == 1) {
8496				jQuery(window).scroll(function () {
8497				    if(jQuery(window).scrollTop() >= jQuery(this_tfslider).parents('#sliders-container').position().top + jQuery(this_tfslider).parents('#sliders-container').height()) {
8498				    	jQuery(this_tfslider).css('display', 'none');
8499				    } else {
8500				    	jQuery(this_tfslider).css('display', 'block');
8501				    }
8502				});
8503			}
8504
8505			jQuery(window).on('resize', function() {
8506				var wpadminbarHeight = 0;
8507				var headerHeight = jQuery('.header-wrapper').height();
8508
8509				if( orig_logo_height + parseInt(orig_logo_container_margin_top.replace( 'px', '' ) ) + parseInt( orig_logo_container_margin_bottom.replace( 'px', '' ) ) > orig_menu_height ) {
8510					headerHeight = orig_logo_height + parseInt(orig_logo_container_margin_top.replace( 'px', '' ) ) + parseInt( orig_logo_container_margin_bottom.replace( 'px', '' ) );
8511				} else {
8512					headerHeight = orig_menu_height;
8513				}
8514
8515				if(jQuery('#wpadminbar').length >= 1) {
8516					var wpadminbarHeight = jQuery('#wpadminbar').height();
8517				}
8518
8519				if(jQuery(this_tfslider).data('full_screen') == 1) {
8520					var sliderHeight = jQuery(window).height();
8521					if(jQuery(this_tfslider).parents('#sliders-container').next().hasClass('header-wrapper')) {
8522						sliderHeight = sliderHeight + (headerHeight - wpadminbarHeight);
8523					}
8524					if(Modernizr.mq('only screen and (max-width: 800px)')) {
8525						var sliderHeight = jQuery(window).height() - (headerHeight + wpadminbarHeight);
8526					}
8527
8528					jQuery(this_tfslider).find('video').each(function() {
8529						var aspect_ratio = jQuery(this).width() / jQuery(this).height();
8530						var arc_sliderWidth = aspect_ratio * jQuery(window).height();
8531						var arc_sliderLeft = '-' + ((arc_sliderWidth - jQuery(this_tfslider).width()) / 2) + 'px';
8532						if(jQuery('#wrapper').width() > arc_sliderWidth) {
8533							arc_sliderWidth = '100%';
8534							arc_sliderLeft = 0;
8535						}
8536						jQuery(this).width(arc_sliderWidth);
8537						jQuery(this).css('left', arc_sliderLeft);
8538					});
8539				} else {
8540					var sliderWidth = jQuery(this_tfslider).data('slider_width');
8541
8542					if(sliderWidth.indexOf('%') != -1) {
8543						sliderWidth = jQuery(this_tfslider).data('first_slide_width');
8544
8545						if( sliderWidth < jQuery(this_tfslider).data('slider_width') ) {
8546							sliderWidth = jQuery(this_tfslider).data('slider_width');
8547						}
8548
8549						var percentage_width = true;
8550					} else {
8551						sliderWidth = parseInt(jQuery(this_tfslider).data('slider_width'));
8552					}
8553
8554					var sliderHeight = parseInt(jQuery(this_tfslider).data('slider_height'));
8555					var aspect_ratio = sliderHeight / sliderWidth;
8556
8557					if(aspect_ratio < 0.5) {
8558						aspect_ratio = 0.5;
8559					}
8560
8561					var sliderHeight = aspect_ratio * jQuery('#wrapper').width();
8562
8563					if(sliderHeight > parseInt(jQuery(this_tfslider).data('slider_height'))) {
8564						sliderHeight = parseInt(jQuery(this_tfslider).data('slider_height'));
8565					}
8566
8567					if(sliderHeight < 200) {
8568						sliderHeight = 300;
8569					}
8570
8571					jQuery(this_tfslider).find('video').each(function() {
8572						var aspect_ratio = jQuery(this).width() / jQuery(this).height();
8573						var arc_sliderWidth = aspect_ratio * sliderHeight;
8574
8575						if(arc_sliderWidth < sliderWidth && !jQuery(this_tfslider).hasClass('full-width-slider')) {
8576							arc_sliderWidth = sliderWidth;
8577						}
8578
8579						var arc_sliderLeft = '-' + ((arc_sliderWidth - jQuery(this_tfslider).width()) / 2) + 'px';
8580						var compare_width = jQuery('#wrapper').width();
8581						if(jQuery(this_tfslider).parents('.post-content').length >= 1) {
8582							compare_width = jQuery(this_tfslider).width();
8583						}
8584						if(compare_width > arc_sliderWidth && percentage_width == true && jQuery(this_tfslider).data('full_screen') != 1) {
8585							arc_sliderWidth = '100%';
8586							arc_sliderLeft = 0;
8587						}
8588						jQuery(this).width(arc_sliderWidth);
8589						jQuery(this).css('left', arc_sliderLeft);
8590					});
8591
8592					if(Modernizr.mq('only screen and (max-width: 800px)')) {
8593						jQuery(this_tfslider).find('a.button').each(function() {
8594							jQuery(this).removeClass('xlarge large medium button-xlarge button-large button-medium');
8595							jQuery(this).addClass('small button-small');
8596						});
8597					} else {
8598						jQuery(this_tfslider).find('a.button').each(function() {
8599							jQuery(this).attr('class', jQuery(this).data('old'));
8600						});
8601					}
8602				}
8603
8604				if(jQuery(this_tfslider).data('full_screen') == 1) {
8605					jQuery(this_tfslider).css('max-width', '100%');
8606					jQuery(this_tfslider).find('.slides, .background').css('width', '100%');
8607				}
8608
8609				jQuery(this_tfslider).parents('.fusion-slider-container').css('height', sliderHeight);
8610				jQuery(this_tfslider).css('height', sliderHeight);
8611				jQuery(this_tfslider).find('.background, .mobile_video_image').css('height', sliderHeight);
8612
8613				if(jQuery('.layout-boxed-mode').length >= 1) {
8614					var boxed_mode_width = jQuery('.layout-boxed-mode #wrapper').width();
8615					jQuery(this_tfslider).css('width', boxed_mode_width);
8616					jQuery(this_tfslider).css('margin-left', 'auto');
8617					jQuery(this_tfslider).css('margin-right', 'auto');
8618					/*
8619					if(jQuery(this_tfslider).data('slider_width') == '100%') {
8620						jQuery(this_tfslider).css('left', Math.ceil(jQuery(window).width() / 2));
8621						jQuery(this_tfslider).css('margin-left', '-' + (boxed_mode_width / 2) + 'px');
8622					}
8623					*/
8624					if(jQuery(this_tfslider).data('parallax') == 1 && ! Modernizr.mq('only screen and (max-width: 1000px)')) {
8625						jQuery(this_tfslider).css('left', '50%');
8626						jQuery(this_tfslider).css('margin-left', '-' + (boxed_mode_width / 2) + 'px');
8627					}
8628
8629					jQuery(this_tfslider).find('.slides, .background').css('width', '100%');
8630				}
8631
8632				if(jQuery(this_tfslider).data('parallax') == 1 && ! Modernizr.mq('only screen and (max-width: 1000px)')) {
8633					jQuery(this_tfslider).css('position', 'fixed');
8634					if( jQuery( '.header-wrapper' ).css( 'position' ) != 'absolute' ) {
8635						jQuery('.header-wrapper').css('position', 'relative');
8636						jQuery(this_tfslider).parents('.fusion-slider-container').css('margin-top', '-' + headerHeight + 'px');
8637					}
8638					jQuery('#main, .footer-area, #footer, .page-title-container').css('position', 'relative');
8639					jQuery('#main, .footer-area, #footer, .page-title-container').css('z-index', '3');
8640					jQuery('.header-wrapper').css('z-index', '5');
8641					jQuery('.header-wrapper').css('height', headerHeight);
8642
8643					jQuery(this_tfslider).find('.flex-direction-nav li a').css('-webkit-transform', 'translate(0, ' + (headerHeight / 2) + 'px)');
8644					jQuery(this_tfslider).find('.flex-direction-nav li a').css('-ms-transform', 'translate(0, ' + (headerHeight / 2) + 'px)');
8645					jQuery(this_tfslider).find('.flex-direction-nav li a').css('-o-transform', 'translate(0, ' + (headerHeight / 2) + 'px)');
8646					jQuery(this_tfslider).find('.flex-direction-nav li a').css('-moz-transform', 'translate(0, ' + (headerHeight / 2) + 'px)');
8647					jQuery(this_tfslider).find('.flex-direction-nav li a').css('transform', 'translate(0, ' + (headerHeight / 2) + 'px)');
8648
8649					if(jQuery(this_tfslider).hasClass('fixed-width-slider')) {
8650						var fixed_width_center = '-' + (jQuery(this_tfslider).width() / 2) + 'px';
8651						jQuery(this_tfslider).css('left', '50%');
8652						jQuery(this_tfslider).css('margin-left', fixed_width_center);
8653					}
8654
8655					jQuery(this_tfslider).find('.flex-control-nav').css('bottom', (headerHeight / 2));
8656				} else if(jQuery(this_tfslider).data('parallax') == 1 && Modernizr.mq('only screen and (max-width: 1000px)')) {
8657					jQuery(this_tfslider).css('position', 'relative');
8658					jQuery(this_tfslider).css('left', '0');
8659					jQuery(this_tfslider).css('margin-left', '0');
8660					if( jQuery( '.header-wrapper' ).css( 'position' ) != 'absolute' ) {
8661						jQuery('.header-wrapper').css('position', 'relative');
8662					}
8663					jQuery('#main, .footer-area, #footer, .page-title-container').css('position', 'relative');
8664					jQuery('#main, .footer-area, #footer, .page-title-container').css('z-index', '3');
8665					jQuery('.header-wrapper').css('z-index', '5');
8666					jQuery('.header-wrapper').css('height', 'auto');
8667					jQuery(this_tfslider).parents('.fusion-slider-container').css('margin-top', '');
8668					jQuery(this_tfslider).find('.flex-direction-nav li a').css('-webkit-transform', 'translate(0, 0)');
8669					jQuery(this_tfslider).find('.flex-direction-nav li a').css('-ms-transform', 'translate(0, 0)');
8670					jQuery(this_tfslider).find('.flex-direction-nav li a').css('-o-transform', 'translate(0, 0)');
8671					jQuery(this_tfslider).find('.flex-direction-nav li a').css('-moz-transform', 'translate(0, 0)');
8672					jQuery(this_tfslider).find('.flex-direction-nav li a').css('transform', 'translate(0, 0)');
8673
8674					jQuery(this_tfslider).find('.flex-control-nav').css('bottom', 0);
8675				}
8676
8677				if(Modernizr.mq('only screen and (max-width: 640px)')) {
8678					jQuery(this_tfslider).parents('.fusion-slider-container').css('height', sliderHeight);
8679					jQuery(this_tfslider).css('height', sliderHeight);
8680					jQuery(this_tfslider).find('.background, .mobile_video_image').css('height', sliderHeight);
8681
8682					var slideContent = jQuery(this_tfslider).find('.slide-content-container');
8683					jQuery(slideContent).each(function() {
8684						var contentHeight = '-' + (jQuery(this).find('.slide-content').height() / 2) + 'px';
8685						var contentPadding = '0px';
8686
8687						jQuery(this).css('margin-top', contentHeight);
8688						jQuery(this).css('padding-top', contentPadding);
8689					});
8690				} else if(Modernizr.mq('only screen and (max-width: 1000px)')) {
8691					jQuery(this_tfslider).parents('.fusion-slider-container').css('height', sliderHeight);
8692					jQuery(this_tfslider).css('height', sliderHeight);
8693					jQuery(this_tfslider).find('.background, .mobile_video_image').css('height', sliderHeight);
8694
8695					var slideContent = jQuery(this_tfslider).find('.slide-content-container');
8696					jQuery(slideContent).each(function() {
8697						var contentHeight = '-' + (jQuery(this).find('.slide-content').height() / 2) + 'px';
8698						var contentPadding = '0px';
8699
8700						jQuery(this).css('margin-top', contentHeight);
8701						jQuery(this).css('padding-top', contentPadding);
8702					});
8703				} else {
8704					jQuery(this_tfslider).parents('.fusion-slider-container').css('height', sliderHeight);
8705					jQuery(this_tfslider).css('height', sliderHeight);
8706					jQuery(this_tfslider).find('.background, .mobile_video_image').css('height', sliderHeight);
8707
8708					var slideContent = jQuery(this_tfslider).find('.slide-content-container');
8709					jQuery(slideContent).each(function() {
8710						jQuery(this).css('-webkit-transform', '');
8711						jQuery(this).css('-ms-transform', '');
8712						jQuery(this).css('-o-transform', '');
8713						jQuery(this).css('-moz-transform', '');
8714						jQuery(this).css('transform', '');
8715
8716						var contentHeight = '-' + (jQuery(this).find('.slide-content').height() / 2) + 'px';
8717						if(jQuery(this_tfslider).data('parallax') == '1' && jQuery(this_tfslider).parents('.post-content').length == 0) {
8718							var contentPadding = headerHeight / 2;
8719						}
8720
8721						jQuery(this).css('margin-top', contentHeight);
8722						jQuery(this).css('padding-top', contentPadding);
8723					});
8724				}
8725
8726				if(cssua.ua.mobile && cssua.ua.mobile != 'ipad' ) {
8727					jQuery(this_tfslider).parents('.fusion-slider-container').css('height', 'auto');
8728					jQuery(this_tfslider).find('.mobile_video_image').each(function() {
8729						var img_url = jQuery('.mobile_video_image').css('background-image').replace('url(', '').replace(')', '');
8730						if(img_url) {
8731							var preview_image = new Image();
8732							preview_image.name = img_url;
8733							preview_image.src = img_url;
8734							preview_image.onload = function() {
8735								var ar = this.height / this.width;
8736								var mobile_preview_height = ar * jQuery('#wrapper').width();
8737								jQuery(this_tfslider).find('.mobile_video_image').css('height', mobile_preview_height);
8738								if(mobile_preview_height < sliderHeight) {
8739									jQuery(this_tfslider).css('height', mobile_preview_height);
8740								}
8741							}
8742						}
8743					});
8744				}
8745
8746				if(Modernizr.mq('only screen and (max-width: 1000px)')) {
8747						jQuery('.header-wrapper').css('height', '' );
8748				}
8749			});
8750
8751/*
8752			jQuery( this ).find('iframe').each(function(i) {
8753				var func = 'stopVideo';
8754				this.contentWindow.postMessage('{"event":"command","func":"' + func + '","args":""}', '*');
8755			});*/
8756
8757			jQuery(this_tfslider).find('video').each(function() {
8758				if( typeof jQuery(this)[0].pause === "function" ) {
8759					jQuery(this)[0].pause();
8760				}
8761			});
8762
8763			jQuery(this_tfslider).flexslider({
8764				animation: jQuery(this_tfslider).data('animation'),
8765				slideshow: jQuery(this_tfslider).data('autoplay'),
8766				slideshowSpeed: jQuery(this_tfslider).data('slideshow_speed'),
8767				animationSpeed: jQuery(this_tfslider).data('animation_speed'),
8768				controlNav: Boolean(Number(jQuery(this_tfslider).data('pagination_circles'))),
8769				directionNav: Boolean(Number(jQuery(this_tfslider).data('nav_arrows'))),
8770				animationLoop: Boolean(Number(jQuery(this_tfslider).data('loop'))),
8771				smoothHeight: true,
8772				pauseOnHover: false,
8773				useCSS: false,
8774				video: true,
8775				touch: true,
8776				prevText: '&#xe61e;',
8777				nextText: '&#xe620;',
8778				start: function(slider) {
8779					wpadminbarHeight = 0;
8780					if(jQuery('#wpadminbar').length >= 1) {
8781						var wpadminbarHeight = jQuery('#wpadminbar').height();
8782					}
8783
8784					if(jQuery(this_tfslider).data('full_screen') == 1) {
8785						var sliderHeight = jQuery(window).height();
8786						if(jQuery(this_tfslider).parents('#sliders-container').next().hasClass('header-wrapper')) {
8787							sliderHeight = sliderHeight + (headerHeight - wpadminbarHeight);
8788						}
8789 						if(Modernizr.mq('only screen and (max-width: 1000px)')) {
8790							var sliderHeight = jQuery(window).height() - (headerHeight + wpadminbarHeight);
8791						}
8792
8793						jQuery(this_tfslider).find('video').each(function() {
8794							var aspect_ratio = jQuery(this).width() / jQuery(this).height();
8795							var arc_sliderWidth = aspect_ratio * sliderHeight;
8796							var arc_sliderLeft = '-' + ((arc_sliderWidth - jQuery(this_tfslider).width()) / 2) + 'px';
8797
8798							if(jQuery('#wrapper').width() > arc_sliderWidth) {
8799								arc_sliderWidth = '100%';
8800								arc_sliderLeft = 0;
8801							}
8802							jQuery(this).width(arc_sliderWidth);
8803							jQuery(this).css('left', arc_sliderLeft);
8804						});
8805					} else {
8806						var sliderWidth = jQuery(this_tfslider).data('slider_width');
8807
8808						if(sliderWidth.indexOf('%') != -1) {
8809							sliderWidth = jQuery(first_slide).find('.background-image').data('imgwidth');
8810
8811							if( ! sliderWidth && ! cssua.ua.mobile ) {
8812								sliderWidth = jQuery(first_slide).find('video').width();
8813							}
8814
8815							if( ! sliderWidth ) {
8816								sliderWidth = 940;
8817							}
8818
8819							jQuery(this_tfslider).data('first_slide_width', sliderWidth);
8820
8821							if(sliderWidth < jQuery(this_tfslider).data('slider_width')) {
8822								sliderWidth = jQuery(this_tfslider).data('slider_width');
8823							}
8824
8825							var percentage_width = true;
8826						} else {
8827							sliderWidth = parseInt(jQuery(this_tfslider).data('slider_width'));
8828						}
8829
8830						var sliderHeight = parseInt(jQuery(this_tfslider).data('slider_height'));
8831						var aspect_ratio = sliderHeight / sliderWidth;
8832
8833						if(aspect_ratio < 0.5) {
8834							aspect_ratio = 0.5;
8835						}
8836
8837						var sliderHeight = aspect_ratio * jQuery('#wrapper').width();
8838
8839						if(sliderHeight > parseInt(jQuery(this_tfslider).data('slider_height'))) {
8840							sliderHeight = parseInt(jQuery(this_tfslider).data('slider_height'));
8841						}
8842
8843						if(sliderHeight < 200) {
8844							sliderHeight = 300;
8845						}
8846
8847						jQuery(this_tfslider).find('video').each(function() {
8848							var aspect_ratio = jQuery(this).width() / jQuery(this).height();
8849							var arc_sliderWidth = aspect_ratio * sliderHeight;
8850
8851							if(arc_sliderWidth < sliderWidth && !jQuery(this_tfslider).hasClass('full-width-slider')) {
8852								arc_sliderWidth = sliderWidth;
8853							}
8854
8855							var arc_sliderLeft = '-' + ((arc_sliderWidth - jQuery(this_tfslider).width()) / 2) + 'px';
8856							var compare_width = jQuery('#wrapper').width();
8857							if(jQuery(this_tfslider).parents('.post-content').length >= 1) {
8858								compare_width = jQuery(this_tfslider).width();
8859							}
8860							if(compare_width > arc_sliderWidth && percentage_width == true && jQuery(this_tfslider).data('full_screen') != 1) {
8861								arc_sliderWidth = '100%';
8862								arc_sliderLeft = 0;
8863							}
8864							jQuery(this).width(arc_sliderWidth);
8865							jQuery(this).css('left', arc_sliderLeft);
8866						});
8867					}
8868
8869					jQuery(this_tfslider).parents('.fusion-slider-container').css('max-height', sliderHeight);
8870					jQuery(this_tfslider).parents('.fusion-slider-container').css('height', sliderHeight);
8871					jQuery(this_tfslider).css('height', sliderHeight);
8872					jQuery(this_tfslider).find('.background, .mobile_video_image').css('height', sliderHeight);
8873
8874					if(cssua.ua.mobile && cssua.ua.mobile != 'ipad') {
8875						jQuery(this_tfslider).parents('.fusion-slider-container').css('height', 'auto');
8876						jQuery(this_tfslider).find('.mobile_video_image').each(function() {
8877							var img_url = jQuery('.mobile_video_image').css('background-image').replace('url(', '').replace(')', '');
8878							if(img_url) {
8879								var preview_image = new Image();
8880								preview_image.name = img_url;
8881								preview_image.src = img_url;
8882								preview_image.onload = function() {
8883									var ar = this.height / this.width;
8884									var mobile_preview_height = ar * jQuery(window).width();
8885									if(mobile_preview_height < sliderHeight) {
8886										jQuery(this_tfslider).find('.mobile_video_image').css('height', mobile_preview_height);
8887									}
8888								}
8889							}
8890						});
8891						if(jQuery(slider.slides.eq(slider.currentSlide)).find('video').length >= 1 && jQuery(slider.slides.eq(slider.currentSlide)).find('.mobile_video_image').length >= 1) {
8892							var img_url = jQuery(slider.slides.eq(slider.currentSlide)).find('.mobile_video_image').css('background-image').replace('url(', '').replace(')', '');
8893							if(img_url) {
8894								var preview_image = new Image();
8895								preview_image.name = img_url;
8896								preview_image.src = img_url;
8897								preview_image.onload = function() {
8898									var ar = this.height / this.width;
8899									var mobile_preview_height = ar * jQuery(window).width();
8900									if(mobile_preview_height < sliderHeight) {
8901										jQuery(this_tfslider).css('height', mobile_preview_height);
8902									}
8903								}
8904							}
8905						}
8906					}
8907
8908					if(jQuery(this_tfslider).data('parallax') == 1 && ! Modernizr.mq('only screen and (max-width: 1000px)')) {
8909						jQuery(this_tfslider).css('position', 'fixed');
8910						if( jQuery( '.header-wrapper' ).css( 'position' ) != 'absolute' ) {
8911							jQuery('.header-wrapper').css('position', 'relative');
8912							jQuery(this_tfslider).parents('.fusion-slider-container').css('margin-top', '-' + headerHeight + 'px');
8913						}
8914						jQuery('#main, .footer-area, #footer, .page-title-container').css('position', 'relative');
8915						jQuery('#main, .footer-area, #footer, .page-title-container').css('z-index', '3');
8916						jQuery('.header-wrapper').css('z-index', '5');
8917						jQuery('.header-wrapper').css('height', headerHeight);
8918
8919						jQuery(this_tfslider).find('.flex-direction-nav li a').css('-webkit-transform', 'translate(0, ' + (headerHeight / 2) + 'px)');
8920						jQuery(this_tfslider).find('.flex-direction-nav li a').css('-ms-transform', 'translate(0, ' + (headerHeight / 2) + 'px)');
8921						jQuery(this_tfslider).find('.flex-direction-nav li a').css('-o-transform', 'translate(0, ' + (headerHeight / 2) + 'px)');
8922						jQuery(this_tfslider).find('.flex-direction-nav li a').css('-moz-transform', 'translate(0, ' + (headerHeight / 2) + 'px)');
8923						jQuery(this_tfslider).find('.flex-direction-nav li a').css('transform', 'translate(0, ' + (headerHeight / 2) + 'px)');
8924
8925						if(jQuery(this_tfslider).data('full_screen') == 1) {
8926							jQuery(slider).find('.flex-control-nav').css('bottom', (headerHeight / 2));
8927						} else {
8928							jQuery(slider).find('.flex-control-nav').css('bottom', 0);
8929						}
8930
8931						if(jQuery(this_tfslider).hasClass('fixed-width-slider')) {
8932							var fixed_width_center = '-' + (jQuery(this_tfslider).width() / 2) + 'px';
8933							jQuery(this_tfslider).css('left', '50%');
8934							jQuery(this_tfslider).css('margin-left', fixed_width_center);
8935						}
8936					} else if(jQuery(this_tfslider).data('parallax') == 1 && Modernizr.mq('only screen and (max-width: 1000px)')) {
8937						jQuery(slider).find('.flex-control-nav').css('bottom', 0);
8938					}
8939
8940					if(Modernizr.mq('only screen and (max-width: 640px)')) {
8941						var slideContent = jQuery(this_tfslider).find('.slide-content-container');
8942						jQuery(slideContent).each(function() {
8943							var contentHeight = '-' + (jQuery(this).find('.slide-content').height() / 2) + 'px';
8944							var contentPadding = '0px';
8945
8946							jQuery(this).css('margin-top', contentHeight);
8947							jQuery(this).css('padding-top', contentPadding);
8948						});
8949					} else if(Modernizr.mq('only screen and (max-width: 800px)')) {
8950						var slideContent = jQuery(this_tfslider).find('.slide-content-container');
8951						jQuery(slideContent).each(function() {
8952							var contentHeight = '-' + (jQuery(this).find('.slide-content').height() / 2) + 'px';
8953							var contentPadding = '0px';
8954
8955							jQuery(this).css('margin-top', contentHeight);
8956							jQuery(this).css('padding-top', contentPadding);
8957						});
8958					} else {
8959						var slideContent = jQuery(this_tfslider).find('.slide-content-container');
8960						jQuery(slideContent).each(function() {
8961							jQuery(this).css('-webkit-transform', '');
8962							jQuery(this).css('-ms-transform', '');
8963							jQuery(this).css('-o-transform', '');
8964							jQuery(this).css('-moz-transform', '');
8965							jQuery(this).css('transform', '');
8966
8967							var contentHeight = '-' + (jQuery(this).find('.slide-content').height() / 2) + 'px';
8968							if(jQuery(this_tfslider).data('parallax') == '1' && jQuery(this_tfslider).parents('.post-content').length == 0) {
8969								var contentPadding = headerHeight / 2;
8970							}
8971
8972							jQuery(this).css('margin-top', contentHeight);
8973							jQuery(this).css('padding-top', contentPadding);
8974						});
8975					}
8976
8977					jQuery(slider.slides.eq(slider.currentSlide)).find('video').each(function() {
8978						if(jQuery(this).parents('li').attr('data-autoplay') == 'yes') {
8979							if( typeof jQuery(this)[0].play === "function" ) {
8980								jQuery(this)[0].play();
8981							}
8982						}
8983					});
8984
8985					jQuery(slider.slides.eq(slider.currentSlide)).find('iframe').each(function() {
8986						if(jQuery(this).parents('li').attr('data-autoplay') == 'yes') {
8987							jQuery(this_tfslider).flexslider('pause');
8988							var video = this;
8989							setTimeout(function() {
8990								video.contentWindow.postMessage('{"event":"command","func":"' + 'playVideo' + '","args":""}', '*');
8991							}, 1000);
8992						}
8993					});
8994
8995					fusion_reanimate_slider();
8996
8997					if(typeof(slider.slides) !== 'undefined' && slider.slides.eq(slider.currentSlide).find('iframe').length !== 0) {
8998						if(!Number(js_local_vars.status_yt) && window.yt_vid_exists == true) {
8999							YT_ready(function() {
9000								new YT.Player(slider.slides.eq(slider.currentSlide).find('iframe').attr('id'), {
9001									events: {
9002										'onReady': onPlayerReady(slider.slides.eq(slider.currentSlide)),
9003										'onStateChange': onPlayerStateChange(slider.slides.eq(slider.currentSlide).find('iframe').attr('id'), slider)
9004									}
9005								});
9006							});
9007						}
9008						if(!Number(js_local_vars.status_vimeo)) {
9009							$f(slider.slides.eq(slider.currentSlide).find('iframe')[0]).api('pause');
9010
9011							if(jQuery(slider.slides.eq(slider.currentSlide)).data('autoplay') == 'yes') {
9012								$f(slider.slides.eq(slider.currentSlide).find('iframe')[0]).api('play');
9013							}
9014							if(jQuery(slider.slides.eq(slider.currentSlide)).data('mute') == 'yes') {
9015								$f(slider.slides.eq(slider.currentSlide).find('iframe')[0]).api('setVolume', 0);
9016							}
9017						}
9018					}
9019
9020					jQuery(this_tfslider).find('.overlay-link').hide();
9021					jQuery(slider.slides.eq(slider.currentSlide)).find('.overlay-link').show();
9022
9023					// Reinitialize waypoint
9024					jQuery.waypoints( 'viewportHeight' );
9025					jQuery.waypoints('refresh');
9026				},
9027			    before: function(slider) {
9028					if(slider.slides.eq(slider.currentSlide).find('iframe').length !== 0) {
9029						if(!Number(js_local_vars.status_vimeo)) {
9030							jQuery(this_tfslider).find('iframe').each(function() {
9031								$f(jQuery(this)[0]).api('pause');
9032							});
9033
9034							if(jQuery(slider.slides.eq(slider.currentSlide)).data('autoplay') == 'yes') {
9035								$f(slider.slides.eq(slider.currentSlide).find('iframe')[0]).api('play');
9036							}
9037							if(jQuery(slider.slides.eq(slider.currentSlide)).data('mute') == 'yes') {
9038								$f(slider.slides.eq(slider.currentSlide).find('iframe')[0]).api('setVolume', 0);
9039							}
9040						}
9041
9042						if(!Number(js_local_vars.status_yt) && window.yt_vid_exists == true) {
9043							YT_ready(function() {
9044								new YT.Player(slider.slides.eq(slider.currentSlide).find('iframe').attr('id'), {
9045									events: {
9046										'onReady': onPlayerReady(slider.slides.eq(slider.currentSlide)),
9047										'onStateChange': onPlayerStateChange(slider.slides.eq(slider.currentSlide).find('iframe').attr('id'), slider)
9048									}
9049								});
9050							});
9051						}
9052					}
9053
9054					playVideoAndPauseOthers(slider);
9055
9056					fusion_reanimate_slider();
9057			    },
9058				after: function(slider) {
9059					if(slider.slides.eq(slider.currentSlide).find('iframe').length !== 0) {
9060						if(!Number(js_local_vars.status_yt) && window.yt_vid_exists == true) {
9061							YT_ready(function() {
9062								new YT.Player(slider.slides.eq(slider.currentSlide).find('iframe').attr('id'), {
9063									events: {
9064										'onReady': onPlayerReady(slider.slides.eq(slider.currentSlide)),
9065										'onStateChange': onPlayerStateChange(slider.slides.eq(slider.currentSlide).find('iframe').attr('id'), slider)
9066									}
9067								});
9068							});
9069						}
9070						if(!Number(js_local_vars.status_vimeo)) {
9071							jQuery(this_tfslider).find('iframe').each(function() {
9072								$f(jQuery(this)[0]).api('pause');
9073							});
9074
9075							if(jQuery(slider.slides.eq(slider.currentSlide)).data('autoplay') == 'yes') {
9076								$f(slider.slides.eq(slider.currentSlide).find('iframe')[0]).api('play');
9077							}
9078							if(jQuery(slider.slides.eq(slider.currentSlide)).data('mute') == 'yes') {
9079								$f(slider.slides.eq(slider.currentSlide).find('iframe')[0]).api('setVolume', 0);
9080							}
9081						}
9082					}
9083
9084					jQuery(this_tfslider).find('.overlay-link').hide();
9085					jQuery(slider.slides.eq(slider.currentSlide)).find('.overlay-link').show();
9086
9087					playVideoAndPauseOthers(slider);
9088
9089					jQuery('[data-spy="scroll"]').each(function () {
9090					  var $spy = jQuery(this).scrollspy('refresh');
9091					});
9092				}
9093			});
9094		});
9095
9096		if(js_local_vars.page_smoothHeight === 'false') {
9097			page_smoothHeight = false;
9098		} else {
9099			page_smoothHeight = true;
9100		}
9101
9102        jQuery('.grid-layout .flexslider').flexslider({
9103            slideshow: Boolean(Number(js_local_vars.slideshow_autoplay)),
9104            slideshowSpeed: Number(js_local_vars.slideshow_speed),
9105            video: true,
9106            smoothHeight: page_smoothHeight,
9107            pauseOnHover: false,
9108            useCSS: false,
9109			prevText: '&#xf104;',
9110			nextText: '&#xf105;',
9111			start: function(slider) {
9112				if(typeof(slider.slides) !== 'undefined' && slider.slides.eq(slider.currentSlide).find('iframe').length !== 0) {
9113					if(Number(js_local_vars.pagination_video_slide)) {
9114						jQuery(slider).find('.flex-control-nav').css('bottom', '-30px');
9115					} else {
9116						jQuery(slider).find('.flex-control-nav').hide();
9117					}
9118					if(!Number(js_local_vars.status_yt) && window.yt_vid_exists == true) {
9119						YT_ready(function() {
9120							new YT.Player(slider.slides.eq(slider.currentSlide).find('iframe').attr('id'), {
9121								events: {
9122									'onStateChange': onPlayerStateChange(slider.slides.eq(slider.currentSlide).find('iframe').attr('id'), slider)
9123								}
9124							});
9125						});
9126					}
9127				} else {
9128					if(Number(js_local_vars.pagination_video_slide)) {
9129						jQuery(slider).find('.flex-control-nav').css('bottom', '0px');
9130					} else {
9131						jQuery(slider).find('.flex-control-nav').show();
9132					}
9133				}
9134			},
9135		    before: function(slider) {
9136				if(slider.slides.eq(slider.currentSlide).find('iframe').length !== 0) {
9137					if(!Number(js_local_vars.status_vimeo)) {
9138						$f(slider.slides.eq(slider.currentSlide).find('iframe')[0] ).api('pause');
9139					}
9140
9141					if(!Number(js_local_vars.status_yt) && window.yt_vid_exists == true) {
9142						YT_ready(function() {
9143							new YT.Player(slider.slides.eq(slider.currentSlide).find('iframe').attr('id'), {
9144								events: {
9145									'onStateChange': onPlayerStateChange(slider.slides.eq(slider.currentSlide).find('iframe').attr('id'), slider)
9146								}
9147							});
9148						});
9149					}
9150
9151					/* ------------------  YOUTUBE FOR AUTOSLIDER ------------------ */
9152					playVideoAndPauseOthers(slider);
9153				}
9154		    },
9155			after: function(slider) {
9156				if(slider.slides.eq(slider.currentSlide).find('iframe').length !== 0) {
9157					if(Number(js_local_vars.pagination_video_slide)) {
9158						jQuery(slider).find('.flex-control-nav').css('bottom', '-30px');
9159					} else {
9160						jQuery(slider).find('.flex-control-nav').hide();
9161					}
9162
9163					if(!Number(js_local_vars.status_yt) && window.yt_vid_exists == true) {
9164						YT_ready(function() {
9165							new YT.Player(slider.slides.eq(slider.currentSlide).find('iframe').attr('id'), {
9166								events: {
9167									'onStateChange': onPlayerStateChange(slider.slides.eq(slider.currentSlide).find('iframe').attr('id'), slider)
9168								}
9169							});
9170						});
9171					}
9172				} else {
9173					if(Number(js_local_vars.pagination_video_slide)) {
9174						jQuery(slider).find('.flex-control-nav').css('bottom', '0px');
9175					} else {
9176						jQuery(slider).find('.flex-control-nav').show();
9177					}
9178				}
9179				jQuery('[data-spy="scroll"]').each(function () {
9180				  var $spy = jQuery(this).scrollspy('refresh');
9181				});
9182			}
9183        });
9184
9185		jQuery('.fusion-flexslider').flexslider({
9186            slideshow: Boolean(Number(js_local_vars.slideshow_autoplay)),
9187            slideshowSpeed: js_local_vars.slideshow_speed,
9188			video: true,
9189			smoothHeight: true,
9190			pauseOnHover: false,
9191			useCSS: false,
9192			prevText: '&#xf104;',
9193			nextText: '&#xf105;'
9194		});
9195
9196		if(js_local_vars.flex_smoothHeight === 'false') {
9197			flex_smoothHeight = false;
9198		} else {
9199			flex_smoothHeight = true;
9200		}
9201
9202		jQuery('.flexslider').flexslider({
9203            slideshow: Boolean(Number(js_local_vars.slideshow_autoplay)),
9204            slideshowSpeed: js_local_vars.slideshow_speed,
9205			video: true,
9206			smoothHeight: flex_smoothHeight,
9207			pauseOnHover: false,
9208			useCSS: false,
9209			prevText: '&#xf104;',
9210			nextText: '&#xf105;',
9211			start: function(slider) {
9212				if(typeof(slider.slides) !== 'undefined' && slider.slides.eq(slider.currentSlide).find('iframe').length !== 0) {
9213					if(Number(js_local_vars.pagination_video_slide)) {
9214						jQuery(slider).find('.flex-control-nav').css('bottom', '-30px');
9215					} else {
9216						jQuery(slider).find('.flex-control-nav').hide();
9217					}
9218					if(!Number(js_local_vars.status_yt) && window.yt_vid_exists == true) {
9219						YT_ready(function() {
9220							new YT.Player(slider.slides.eq(slider.currentSlide).find('iframe').attr('id'), {
9221								events: {
9222									'onStateChange': onPlayerStateChange(slider.slides.eq(slider.currentSlide).find('iframe').attr('id'), slider)
9223								}
9224							});
9225						});
9226					}
9227				} else {
9228					if(Number(js_local_vars.pagination_video_slide)) {
9229						jQuery(slider).find('.flex-control-nav').css('bottom', '0px');
9230					} else {
9231						jQuery(slider).find('.flex-control-nav').show();
9232					}
9233				}
9234
9235				// Reinitialize waypoint
9236				jQuery.waypoints( 'viewportHeight' );
9237				jQuery.waypoints('refresh');
9238			},
9239		    before: function(slider) {
9240				if(slider.slides.eq(slider.currentSlide).find('iframe').length !== 0) {
9241					if(!Number(js_local_vars.status_vimeo)) {
9242						$f( slider.slides.eq(slider.currentSlide).find('iframe')[0] ).api('pause');
9243					}
9244
9245					if(!Number(js_local_vars.status_yt) && window.yt_vid_exists == true) {
9246						YT_ready(function() {
9247							new YT.Player(slider.slides.eq(slider.currentSlide).find('iframe').attr('id'), {
9248								events: {
9249									'onStateChange': onPlayerStateChange(slider.slides.eq(slider.currentSlide).find('iframe').attr('id'), slider)
9250								}
9251							});
9252						});
9253					}
9254
9255					/* ------------------  YOUTUBE FOR AUTOSLIDER ------------------ */
9256					playVideoAndPauseOthers(slider);
9257				}
9258		    },
9259			after: function(slider) {
9260				if(slider.slides.eq(slider.currentSlide).find('iframe').length !== 0) {
9261					if(Number(js_local_vars.pagination_video_slide)) {
9262						jQuery(slider).find('.flex-control-nav').css('bottom', '-30px');
9263					} else {
9264						jQuery(slider).find('.flex-control-nav').hide();
9265					}
9266
9267					if(!Number(js_local_vars.status_yt) && window.yt_vid_exists == true) {
9268						YT_ready(function() {
9269							new YT.Player(slider.slides.eq(slider.currentSlide).find('iframe').attr('id'), {
9270								events: {
9271									'onStateChange': onPlayerStateChange(slider.slides.eq(slider.currentSlide).find('iframe').attr('id'), slider)
9272								}
9273							});
9274						});
9275					}
9276				} else {
9277					if(Number(js_local_vars.pagination_video_slide)) {
9278						jQuery(slider).find('.flex-control-nav').css('bottom', '0px');
9279					} else {
9280						jQuery(slider).find('.flex-control-nav').show();
9281					}
9282				}
9283				jQuery('[data-spy="scroll"]').each(function () {
9284				  var $spy = jQuery(this).scrollspy('refresh');
9285				});
9286			}
9287		});
9288
9289		function playVideoAndPauseOthers(slider) {
9290			jQuery(slider).find('iframe').each(function(i) {
9291				var func = 'stopVideo';
9292				this.contentWindow.postMessage('{"event":"command","func":"' + func + '","args":""}', '*');
9293				if(!jQuery(this).parents('li').hasClass('clone') && jQuery(this).parents('li').hasClass('flex-active-slide') && jQuery(this).parents('li').attr('data-autoplay') == 'yes') {
9294					jQuery(this).parents('.flexslider').flexslider('pause');
9295					this.contentWindow.postMessage('{"event":"command","func":"' + 'playVideo' + '","args":""}', '*');
9296
9297					if(jQuery(this).parents('li').attr('data-mute') == 'yes') {
9298						this.contentWindow.postMessage('{"event":"command","func":"' + 'mute' + '","args":""}', '*');
9299					}
9300				}
9301			});
9302			jQuery(slider).find('video').each(function(i) {
9303				if( typeof jQuery(this)[0].pause === "function" ) {
9304					jQuery(this)[0].pause();
9305				}
9306				if(!jQuery(this).parents('li').hasClass('clone') && jQuery(this).parents('li').hasClass('flex-active-slide') && jQuery(this).parents('li').attr('data-autoplay') == 'yes') {
9307					if( typeof jQuery(this)[0].play === "function" ) {
9308						jQuery(this)[0].play();
9309					}
9310				}
9311			});
9312		}
9313
9314		/* ------------------ PREV & NEXT BUTTON FOR FLEXSLIDER (YOUTUBE) ------------------ */
9315		jQuery('.flex-next, .flex-prev').click(function() {
9316			//playVideoAndPauseOthers(jQuery(this).parents('.flexslider'));
9317		});
9318	}
9319
9320	if(jQuery().isotope) {
9321		var gridwidth = (jQuery('.grid-layout').width() / 2) - 22;
9322		jQuery('.grid-layout .post').css('width', gridwidth);
9323		jQuery('.grid-layout').isotope({
9324			layoutMode: 'masonry',
9325			itemSelector: '.post',
9326			transformsEnabled: false,
9327			masonry: {
9328				columnWidth: gridwidth,
9329				gutterWidth: 40
9330			},
9331		});
9332
9333		var gridwidth = (jQuery('.grid-layout-3').width() / 3) - 30;
9334		jQuery('.grid-layout-3 .post').css('width', gridwidth);
9335		jQuery('.grid-layout-3').isotope({
9336			layoutMode: 'masonry',
9337			itemSelector: '.post',
9338			transformsEnabled: false,
9339			masonry: {
9340				columnWidth: gridwidth,
9341				gutterWidth: 40
9342			}
9343		});
9344
9345		var gridwidth = (jQuery('.grid-layout-4').width() / 4) - 35;
9346		jQuery('.grid-layout-4 .post').css('width', gridwidth);
9347		jQuery('.grid-layout-4').isotope({
9348			layoutMode: 'masonry',
9349			itemSelector: '.post',
9350			transformsEnabled: false,
9351			masonry: {
9352				columnWidth: gridwidth,
9353				gutterWidth: 40
9354			}
9355		});
9356	}
9357
9358	if(!Boolean(Number(js_local_vars.avada_rev_styles))) {
9359		jQuery('.rev_slider_wrapper').each(function() {
9360			if(jQuery(this).length >=1 && jQuery(this).find('.tp-bannershadow').length == 0) {
9361				jQuery('<div class="shadow-left">').appendTo(this);
9362				jQuery('<div class="shadow-right">').appendTo(this);
9363
9364				jQuery(this).addClass('avada-skin-rev');
9365			}
9366
9367			if( ! jQuery(this).find( '.tp-leftarrow' ).hasClass( 'preview1' ) && ! jQuery(this).find( '.tp-leftarrow' ).hasClass( 'preview2' ) && ! jQuery(this).find( '.tp-leftarrow' ).hasClass( 'preview3' ) && ! jQuery(this).find( '.tp-leftarrow' ).hasClass( 'preview4' ) ) {
9368				jQuery(this).addClass('avada-skin-rev-nav');
9369			}
9370		});
9371	}
9372});
9373
9374jQuery(window).load(function($) {
9375	var header_social_height = jQuery( '.header-social' ).height();
9376
9377	jQuery( '.header-social .menu > li' ).height( header_social_height );
9378	jQuery( '.header-social .menu > li' ).css( 'line-height', header_social_height + 'px' );
9379
9380	jQuery(window).on('resize', function() {
9381		if( jQuery( '.header-social' ).find( '.alignleft' ).height() > jQuery( '.header-social' ).find( '.alignright' ).height() ) {
9382			header_social_height = jQuery( '.header-social' ).find( '.alignleft' ).height();
9383		} else {
9384			header_social_height = jQuery( '.header-social' ).find( '.alignright' ).height();
9385		}
9386	});
9387
9388	if(jQuery('.top-menu .cart').width() > 150) {
9389		new_width = jQuery('.top-menu .cart').outerWidth();
9390		jQuery('.top-menu .cart-contents').css("width", new_width+'px');
9391		new_width -= 2;
9392		jQuery('.top-menu .cart-content a').css("width", new_width+'px');
9393	};
9394
9395	if(jQuery().prettyPhoto) {
9396		var ppArgs = {
9397			overlay_gallery: Boolean(Number(js_local_vars.lightbox_gallery)),
9398			autoplay_slideshow: Boolean(Number(js_local_vars.lightbox_autoplay)),
9399			show_title: Boolean(Number(js_local_vars.lightbox_title)),
9400			show_desc: Boolean(Number(js_local_vars.lightbox_desc))
9401		};
9402		if(js_local_vars.lightbox_animation_speed) {
9403			ppArgs.animation_speed = js_local_vars.lightbox_animation_speed.toLowerCase();
9404		}
9405		if(js_local_vars.lightbox_slideshow_speed) {
9406			ppArgs.slideshow = js_local_vars.lightbox_slideshow_speed;
9407		}
9408		if(js_local_vars.lightbox_opacity) {
9409			ppArgs.opacity = js_local_vars.lightbox_opacity;
9410		}
9411		if(!Boolean(Number(js_local_vars.lightbox_social))) {
9412			ppArgs.social_tools = '';
9413		}
9414
9415		jQuery("a[rel^='prettyPhoto']").prettyPhoto(ppArgs);
9416
9417		var ppArgs_woo = ppArgs;
9418		ppArgs_woo.hook = 'data-rel';
9419		jQuery("a.zoom, a[data-rel^='prettyPhoto']").prettyPhoto(ppArgs_woo);
9420
9421		if(Boolean(Number(js_local_vars.lightbox_post_images))) {
9422			jQuery('.single-post .post-content a').has('img').prettyPhoto(ppArgs);
9423		}
9424
9425		jQuery('.lightbox-enabled a').has('img').prettyPhoto(ppArgs);
9426
9427		var mediaQuery = 'desk';
9428
9429		if (Modernizr.mq('only screen and (max-width: 600px)') || Modernizr.mq('only screen and (max-height: 520px)')) {
9430
9431			mediaQuery = 'mobile';
9432			jQuery("a.zoom, a[data-rel^='prettyPhoto'], a[rel^='prettyPhoto']").unbind('click');
9433			if(Boolean(Number(js_local_vars.lightbox_post_images))) {
9434				jQuery('.single-post .post-content a').has('img').unbind('click');
9435			}
9436			jQuery('.lightbox-enabled a').has('img').unbind('click');
9437		}
9438
9439		// Disables prettyPhoto if screen small
9440		jQuery(window).on('resize', function() {
9441			if ((Modernizr.mq('only screen and (max-width: 600px)') || Modernizr.mq('only screen and (max-height: 520px)')) && mediaQuery == 'desk') {
9442				jQuery("a.zoom, a[data-rel^='prettyPhoto'], a[rel^='prettyPhoto']").unbind('click.prettyphoto');
9443				if(Boolean(Number(js_local_vars.lightbox_post_images))) {
9444					jQuery('.single-post .post-content a').has('img').unbind('click.prettyphoto');
9445				}
9446				jQuery('.lightbox-enabled a').has('img').unbind('click.prettyphoto');
9447				mediaQuery = 'mobile';
9448			} else if (!Modernizr.mq('only screen and (max-width: 600px)') && !Modernizr.mq('only screen and (max-height: 520px)') && mediaQuery == 'mobile') {
9449				jQuery("a.zoom, a[data-rel^='prettyPhoto'], a[rel^='prettyPhoto']").prettyPhoto(ppArgs);
9450				if(Boolean(Number(js_local_vars.lightbox_post_images))) {
9451					jQuery('.single-post .post-content a').has('img').prettyPhoto(ppArgs);
9452				}
9453				jQuery('.lightbox-enabled a').has('img').prettyPhoto(ppArgs);
9454				mediaQuery = 'desk';
9455			}
9456		});
9457	}
9458
9459	if( js_local_vars.sidenav_behavior == 'Click' ) {
9460		jQuery('.side-nav li a').on('click', function(e) {
9461			if( jQuery(this).parent('.page_item_has_children').length ) {
9462				if(jQuery(this).parent().find('> .children').length  && ! jQuery(this).parent().find('> .children').is(':visible') ) {
9463					jQuery(this).parent().find('> .children').stop(true, true).slideDown('slow');
9464				} else {
9465					jQuery(this).parent().find('>
9465 .children').stop(true, true).slideUp('slow');
9466				}
9467			}
9468
9469			if( jQuery(this).parent('.page_item_has_children.current_page_item').length ) {
9470				return false;
9471			}
9472		});
9473	} else {
9474		jQuery('.side-nav li').hoverIntent({
9475		over: function() {
9476			if( jQuery(this).find('> .children').length ) {
9477				jQuery(this).find('> .children').stop(true, true).slideDown('slow');
9478			}
9479		},
9480		out: function() {
9481			if(jQuery(this).find('.current_page_item').length == 0 && jQuery(this).hasClass('current_page_item') == false) {
9482				jQuery(this).find('.children').stop(true, true).slideUp('slow');
9483			}
9484		},
9485		timeout: 500
9486		});
9487	}
9488
9489	if(jQuery().eislideshow) {
9490		var eislideshow_args = {
9491			autoplay: Boolean(Number(js_local_vars.tfes_autoplay))
9492		};
9493
9494		if(js_local_vars.tfes_animation) {
9495			eislideshow_args.animation = js_local_vars.tfes_animation;
9496		}
9497		if(js_local_vars.tfes_interval) {
9498			eislideshow_args.slideshow_interval = js_local_vars.tfes_interval;
9499		}
9500		if(js_local_vars.tfes_speed) {
9501			eislideshow_args.speed = js_local_vars.tfes_speed;
9502		}
9503		if(js_local_vars.tfes_width) {
9504			eislideshow_args.thumbMaxWidth = js_local_vars.tfes_width;
9505		}
9506
9507        jQuery('#ei-slider').eislideshow(eislideshow_args);
9508	}
9509
9510    var retina = window.devicePixelRatio > 1 ? true : false;
9511
9512    if(js_local_vars.custom_icon_image_retina && retina) {
9513    	jQuery('.fusion-social-networks a.custom').each(function() {
9514    		jQuery(this).find('img').attr('src', js_local_vars.custom_icon_image_retina);
9515        	jQuery(this).find('img').attr('width', js_local_vars.retina_icon_width);
9516        	jQuery(this).find('img').attr('height', js_local_vars.retina_icon_height);
9517    	})
9518    }
9519
9520    /* wpml flag in center */
9521	var wpml_flag = jQuery('ul#navigation > li > a > .iclflag');
9522	var wpml_h = wpml_flag.height();
9523	wpml_flag.css('margin-top', '-' +  (( wpml_h / 2 ) - 3) + "px");
9524
9525	var wpml_flag = jQuery('.top-menu > ul > li > a > .iclflag');
9526	var wpml_h = wpml_flag.height();
9527	wpml_flag.css('margin-top', '-' + (( wpml_h / 2 ) - 3) + "px");
9528
9529	if(js_local_vars.blog_pagination_type == 'Infinite Scroll') {
9530		jQuery('#posts-container').infinitescroll({
9531		    navSelector  : "div.pagination",
9532		                   // selector for the paged navigation (it will be hidden)
9533		    nextSelector : "a.pagination-next",
9534		                   // selector for the NEXT link (to page 2)
9535		    itemSelector : "div.post, .timeline-date",
9536		                   // selector for all items you'll retrieve
9537			loading      : {
9538							finishedMsg: js_local_vars.infinite_blog_finished_msg,
9539							msgText: js_local_vars.infinite_blog_text,
9540			},
9541		    errorCallback: function() {
9542		    	if(jQuery('#posts-container').hasClass('isotope')) {
9543		    		jQuery('#posts-container').isotope('reLayout');
9544		    	}
9545		    }
9546		}, function(posts) {
9547			if(jQuery().isotope) {
9548				jQuery(posts).hide();
9549				imagesLoaded(posts, function() {
9550					jQuery(posts).fadeIn();
9551					if(jQuery('#posts-container').hasClass('isotope')) {
9552						jQuery('#posts-container').isotope('appended', jQuery(posts));
9553						jQuery('#posts-container').isotope('reLayout');
9554					}
9555
9556					jQuery('[data-spy="scroll"]').each(function () {
9557						  var $spy = jQuery(this).scrollspy('refresh');
9558					});
9559				});
9560
9561				var gridwidth = (jQuery('.grid-layout').width() / 2) - 22;
9562				jQuery('.grid-layout .post').css('width', gridwidth);
9563
9564				var gridwidth = (jQuery('.grid-layout-3').width() / 3) - 30;
9565				jQuery('.grid-layout-3 .post').css('width', gridwidth);
9566
9567				var gridwidth = (jQuery('.grid-layout-4').width() / 4) - 35;
9568				jQuery('.grid-layout-4 .post').css('width', gridwidth);
9569
9570				if(jQuery('#posts-container').hasClass('isotope')) {
9571					jQuery('#posts-container').isotope('reLayout');
9572				}
9573			}
9574
9575			jQuery('.flexslider').flexslider({
9576            	slideshow: Boolean(Number(js_local_vars.slideshow_autoplay)),
9577            	slideshowSpeed: js_local_vars.slideshow_speed,
9578				video: true,
9579				pauseOnHover: false,
9580				useCSS: false,
9581				prevText: '&#xf104;',
9582				nextText: '&#xf105;',
9583				start: function(slider) {
9584					if(typeof(slider.slides) !== 'undefined' && slider.slides.eq(slider.currentSlide).find('iframe').length !== 0) {
9585						if(Number(js_local_vars.pagination_video_slide)) {
9586							jQuery(slider).find('.flex-control-nav').css('bottom', '-30px');
9587						} else {
9588							jQuery(slider).find('.flex-control-nav').hide();
9589						}
9590						if(!Number(js_local_vars.status_yt) && window.yt_vid_exists == true) {
9591							YT_ready(function() {
9592								new YT.Player(slider.slides.eq(slider.currentSlide).find('iframe').attr('id'), {
9593									events: {
9594										'onStateChange': onPlayerStateChange(slider.slides.eq(slider.currentSlide).find('iframe').attr('id'), slider)
9595									}
9596								});
9597							});
9598						}
9599					} else {
9600						if(Number(js_local_vars.pagination_video_slide)) {
9601							jQuery(slider).find('.flex-control-nav').css('bottom', '0px');
9602						} else {
9603							jQuery(slider).find('.flex-control-nav').show();
9604						}
9605					}
9606
9607					// Reinitialize waypoint
9608					jQuery.waypoints( 'viewportHeight' );
9609					jQuery.waypoints('refresh');
9610				},
9611			    before: function(slider) {
9612					if(slider.slides.eq(slider.currentSlide).find('iframe').length !== 0) {
9613						if(!Number(js_local_vars.status_vimeo)) {
9614							$f( slider.slides.eq(slider.currentSlide).find('iframe')[0] ).api('pause');
9615						}
9616
9617						if(!Number(js_local_vars.status_yt) && window.yt_vid_exists == true) {
9618							YT_ready(function() {
9619								new YT.Player(slider.slides.eq(slider.currentSlide).find('iframe').attr('id'), {
9620									events: {
9621										'onStateChange': onPlayerStateChange(slider.slides.eq(slider.currentSlide).find('iframe').attr('id'), slider)
9622									}
9623								});
9624							});
9625						}
9626
9627						/* ------------------  YOUTUBE FOR AUTOSLIDER ------------------ */
9628						//playVideoAndPauseOthers(slider);
9629					}
9630			    },
9631				after: function(slider) {
9632					if(slider.slides.eq(slider.currentSlide).find('iframe').length !== 0) {
9633						if(Number(js_local_vars.pagination_video_slide)) {
9634							jQuery(slider).find('.flex-control-nav').css('bottom', '-30px');
9635						} else {
9636							jQuery(slider).find('.flex-control-nav').hide();
9637						}
9638
9639						if(!Number(js_local_vars.status_yt) && window.yt_vid_exists == true) {
9640							YT_ready(function() {
9641								new YT.Player(slider.slides.eq(slider.currentSlide).find('iframe').attr('id'), {
9642									events: {
9643										'onStateChange': onPlayerStateChange(slider.slides.eq(slider.currentSlide).find('iframe').attr('id'), slider)
9644									}
9645								});
9646							});
9647						}
9648					} else {
9649						if(Number(js_local_vars.pagination_video_slide)) {
9650							jQuery(slider).find('.flex-control-nav').css('bottom', '0px');
9651						} else {
9652							jQuery(slider).find('.flex-control-nav').show();
9653						}
9654					}
9655					jQuery('[data-spy="scroll"]').each(function () {
9656					  var $spy = jQuery(this).scrollspy('refresh');
9657					});
9658				}
9659			});
9660
9661			if(jQuery().prettyPhoto) { jQuery("a.zoom, a[data-rel^='prettyPhoto'], a[rel^='prettyPhoto']").prettyPhoto(ppArgs); }
9662			jQuery(posts).each(function() {
9663				jQuery(this).find('.full-video, .video-shortcode, .wooslider .slide-content').fitVids();
9664			});
9665
9666			if(jQuery().isotope && jQuery('#posts-container').hasClass('isotope')) {
9667				jQuery('#posts-container').isotope('reLayout');
9668			}
9669		});
9670	}
9671
9672	jQuery('.posts-container-infinite.grid-layout').infinitescroll({
9673	    navSelector  : "div.pagination",
9674	                   // selector for the paged navigation (it will be hidden)
9675	    nextSelector : "a.pagination-next",
9676	                   // selector for the NEXT link (to page 2)
9677	    itemSelector : "div.post, .timeline-date",
9678	                   // selector for all items you'll retrieve
9679		loading      : {
9680						finishedMsg: js_local_vars.infinite_blog_finished_msg,
9681						msgText: js_local_vars.infinite_blog_text,
9682		},
9683	    errorCallback: function() {
9684	    	if(jQuery('.posts-container-infinite.grid-layout').hasClass('isotope')) {
9685	    		jQuery('.posts-container-infinite.grid-layout').isotope('reLayout');
9686	    	}
9687	    }
9688	}, function(posts) {
9689		if(jQuery().isotope) {
9690			jQuery(posts).hide();
9691			imagesLoaded(posts, function() {
9692				jQuery(posts).fadeIn();
9693				if(jQuery('.posts-container-infinite.grid-layout').hasClass('isotope')) {
9694					jQuery('.posts-container-infinite.grid-layout').isotope('appended', jQuery(posts));
9695					jQuery('.posts-container-infinite.grid-layout').isotope('reLayout');
9696				}
9697
9698				jQuery('[data-spy="scroll"]').each(function () {
9699					  var $spy = jQuery(this).scrollspy('refresh');
9700				});
9701			});
9702
9703			var gridwidth = (jQuery('.grid-layout').width() / 2) - 22;
9704			jQuery('.grid-layout .post').css('width', gridwidth);
9705
9706			var gridwidth = (jQuery('.grid-layout-3').width() / 3) - 30;
9707			jQuery('.grid-layout-3 .post').css('width', gridwidth);
9708
9709			var gridwidth = (jQuery('.grid-layout-4').width() / 4) - 35;
9710			jQuery('.grid-layout-4 .post').css('width', gridwidth);
9711
9712			if(jQuery('.posts-container-infinite.grid-layout').hasClass('isotope')) {
9713				jQuery('.posts-container-infinite.grid-layout').isotope('reLayout');
9714			}
9715		}
9716
9717		jQuery('.flexslider').flexslider({
9718            slideshow: Boolean(Number(js_local_vars.slideshow_autoplay)),
9719            slideshowSpeed: js_local_vars.slideshow_speed,
9720			video: true,
9721			pauseOnHover: false,
9722			useCSS: false,
9723			prevText: '&#xf104;',
9724			nextText: '&#xf105;',
9725			start: function(slider) {
9726				if(typeof(slider.slides) !== 'undefined' && slider.slides.eq(slider.currentSlide).find('iframe').length !== 0) {
9727					if(Number(js_local_vars.pagination_video_slide)) {
9728						jQuery(slider).find('.flex-control-nav').css('bottom', '-30px');
9729					} else {
9730						jQuery(slider).find('.flex-control-nav').hide();
9731					}
9732					if(!Number(js_local_vars.status_yt) && window.yt_vid_exists == true) {
9733						YT_ready(function() {
9734							new YT.Player(slider.slides.eq(slider.currentSlide).find('iframe').attr('id'), {
9735								events: {
9736									'onStateChange': onPlayerStateChange(slider.slides.eq(slider.currentSlide).find('iframe').attr('id'), slider)
9737								}
9738							});
9739						});
9740					}
9741				} else {
9742					if(Number(js_local_vars.pagination_video_slide)) {
9743						jQuery(slider).find('.flex-control-nav').css('bottom', '0px');
9744					} else {
9745						jQuery(slider).find('.flex-control-nav').show();
9746					}
9747				}
9748
9749				// Reinitialize waypoint
9750				jQuery.waypoints( 'viewportHeight' );
9751				jQuery.waypoints('refresh');
9752			},
9753		    before: function(slider) {
9754				if(slider.slides.eq(slider.currentSlide).find('iframe').length !== 0) {
9755					if(!Number(js_local_vars.status_vimeo)) {
9756						$f( slider.slides.eq(slider.currentSlide).find('iframe')[0] ).api('pause');
9757					}
9758
9759					if(!Number(js_local_vars.status_yt) && window.yt_vid_exists == true) {
9760						YT_ready(function() {
9761							new YT.Player(slider.slides.eq(slider.currentSlide).find('iframe').attr('id'), {
9762								events: {
9763									'onStateChange': onPlayerStateChange(slider.slides.eq(slider.currentSlide).find('iframe').attr('id'), slider)
9764								}
9765							});
9766						});
9767					}
9768
9769					/* ------------------  YOUTUBE FOR AUTOSLIDER ------------------ */
9770					playVideoAndPauseOthers(slider);
9771				}
9772		    },
9773			after: function(slider) {
9774				if(slider.slides.eq(slider.currentSlide).find('iframe').length !== 0) {
9775					if(Number(js_local_vars.pagination_video_slide)) {
9776						jQuery(slider).find('.flex-control-nav').css('bottom', '-30px');
9777					} else {
9778						jQuery(slider).find('.flex-control-nav').hide();
9779					}
9780
9781					if(!Number(js_local_vars.status_yt) && window.yt_vid_exists == true) {
9782						YT_ready(function() {
9783							new YT.Player(slider.slides.eq(slider.currentSlide).find('iframe').attr('id'), {
9784								events: {
9785									'onStateChange': onPlayerStateChange(slider.slides.eq(slider.currentSlide).find('iframe').attr('id'), slider)
9786								}
9787							});
9788						});
9789					}
9790				} else {
9791					if(Number(js_local_vars.pagination_video_slide)) {
9792						jQuery(slider).find('.flex-control-nav').css('bottom', '0px');
9793					} else {
9794						jQuery(slider).find('.flex-control-nav').show();
9795					}
9796				}
9797				jQuery('[data-spy="scroll"]').each(function () {
9798				  var $spy = jQuery(this).scrollspy('refresh');
9799				});
9800			}
9801		});
9802		if(jQuery().prettyPhoto) { jQuery("a.zoom, a[data-rel^='prettyPhoto'], a[rel^='prettyPhoto']").prettyPhoto(ppArgs); }
9803		jQuery(posts).each(function() {
9804			jQuery(this).find('.full-video, .video-shortcode, .wooslider .slide-content').fitVids();
9805		});
9806
9807		if(jQuery().isotope && jQuery('.posts-container-infinite.grid-layout').hasClass('isotope')) {
9808			jQuery('.posts-container-infinite.grid-layout').isotope('reLayout');
9809		}
9810	});
9811
9812	jQuery('.posts-container-infinite .blog-timeline-layout').infinitescroll({
9813	    navSelector  : "div.pagination",
9814	                   // selector for the paged navigation (it will be hidden)
9815	    nextSelector : "a.pagination-next",
9816	                   // selector for the NEXT link (to page 2)
9817	    itemSelector : "div.post, .timeline-date",
9818	                   // selector for all items you'll retrieve
9819		loading      : {
9820						finishedMsg: js_local_vars.infinite_blog_finished_msg,
9821						msgText: js_local_vars.infinite_blog_text,
9822		},
9823	    errorCallback: function() {
9824	    	if(jQuery('.posts-container-infinite .blog-timeline-layout').hasClass('isotope')) {
9825	    		jQuery('.posts-container-infinite .blog-timeline-layout').isotope('reLayout');
9826	    	}
9827	    }
9828	}, function(posts) {
9829		if(jQuery().isotope) {
9830			jQuery(posts).hide();
9831			imagesLoaded(posts, function() {
9832				jQuery(posts).fadeIn();
9833				if(jQuery('.posts-container-infinite .blog-timeline-layout').hasClass('isotope')) {
9834					jQuery('.posts-container-infinite .blog-timeline-layout').isotope('appended', jQuery(posts));
9835					jQuery('.posts-container-infinite .blog-timeline-layout').isotope('reLayout');
9836				}
9837
9838				jQuery('[data-spy="scroll"]').each(function () {
9839					  var $spy = jQuery(this).scrollspy('refresh');
9840				});
9841			});
9842
9843			var gridwidth = (jQuery('.grid-layout').width() / 2) - 22;
9844			jQuery('.grid-layout .post').css('width', gridwidth);
9845
9846			var gridwidth = (jQuery('.grid-layout-3').width() / 3) - 30;
9847			jQuery('.grid-layout-3 .post').css('width', gridwidth);
9848
9849			var gridwidth = (jQuery('.grid-layout-4').width() / 4) - 35;
9850			jQuery('.grid-layout-4 .post').css('width', gridwidth);
9851
9852			if(jQuery('.posts-container-infinite .blog-timeline-layout').hasClass('isotope')) {
9853				jQuery('.posts-container-infinite .blog-timeline-layout').isotope('reLayout');
9854			}
9855		}
9856
9857		jQuery('.flexslider').flexslider({
9858            slideshow: Boolean(Number(js_local_vars.slideshow_autoplay)),
9859            slideshowSpeed: js_local_vars.slideshow_speed,
9860			video: true,
9861			pauseOnHover: false,
9862			useCSS: false,
9863			prevText: '&#xf104;',
9864			nextText: '&#xf105;',
9865			start: function(slider) {
9866				if(typeof(slider.slides) !== 'undefined' && slider.slides.eq(slider.currentSlide).find('iframe').length !== 0) {
9867					if(Number(js_local_vars.pagination_video_slide)) {
9868						jQuery(slider).find('.flex-control-nav').css('bottom', '-30px');
9869					} else {
9870						jQuery(slider).find('.flex-control-nav').hide();
9871					}
9872					if(!Number(js_local_vars.status_yt) && window.yt_vid_exists == true) {
9873						YT_ready(function() {
9874							new YT.Player(slider.slides.eq(slider.currentSlide).find('iframe').attr('id'), {
9875								events: {
9876									'onStateChange': onPlayerStateChange(slider.slides.eq(slider.currentSlide).find('iframe').attr('id'), slider)
9877								}
9878							});
9879						});
9880					}
9881				} else {
9882					if(Number(js_local_vars.pagination_video_slide)) {
9883						jQuery(slider).find('.flex-control-nav').css('bottom', '0px');
9884					} else {
9885						jQuery(slider).find('.flex-control-nav').show();
9886					}
9887				}
9888
9889				// Reinitialize waypoint
9890				jQuery.waypoints( 'viewportHeight' );
9891				jQuery.waypoints('refresh');
9892			},
9893		    before: function(slider) {
9894				if(slider.slides.eq(slider.currentSlide).find('iframe').length !== 0) {
9895					if(!Number(js_local_vars.status_vimeo)) {
9896						$f( slider.slides.eq(slider.currentSlide).find('iframe')[0] ).api('pause');
9897					}
9898
9899					if(!Number(js_local_vars.status_yt) && window.yt_vid_exists == true) {
9900						YT_ready(function() {
9901							new YT.Player(slider.slides.eq(slider.currentSlide).find('iframe').attr('id'), {
9902								events: {
9903									'onStateChange': onPlayerStateChange(slider.slides.eq(slider.currentSlide).find('iframe').attr('id'), slider)
9904								}
9905							});
9906						});
9907					}
9908
9909					/* ------------------  YOUTUBE FOR AUTOSLIDER ------------------ */
9910					playVideoAndPauseOthers(slider);
9911				}
9912		    },
9913			after: function(slider) {
9914				if(slider.slides.eq(slider.currentSlide).find('iframe').length !== 0) {
9915					if(Number(js_local_vars.pagination_video_slide)) {
9916						jQuery(slider).find('.flex-control-nav').css('bottom', '-30px');
9917					} else {
9918						jQuery(slider).find('.flex-control-nav').hide();
9919					}
9920
9921					if(!Number(js_local_vars.status_yt) && window.yt_vid_exists == true) {
9922						YT_ready(function() {
9923							new YT.Player(slider.slides.eq(slider.currentSlide).find('iframe').attr('id'), {
9924								events: {
9925									'onStateChange': onPlayerStateChange(slider.slides.eq(slider.currentSlide).find('iframe').attr('id'), slider)
9926								}
9927							});
9928						});
9929					}
9930				} else {
9931					if(Number(js_local_vars.pagination_video_slide)) {
9932						jQuery(slider).find('.flex-control-nav').css('bottom', '0px');
9933					} else {
9934						jQuery(slider).find('.flex-control-nav').show();
9935					}
9936				}
9937				jQuery('[data-spy="scroll"]').each(function () {
9938				  var $spy = jQuery(this).scrollspy('refresh');
9939				});
9940			}
9941		});
9942		if(jQuery().prettyPhoto) { jQuery("a.zoom, a[data-rel^='prettyPhoto'], a[rel^='prettyPhoto']").prettyPhoto(ppArgs); }
9943		jQuery(posts).each(function() {
9944			jQuery(this).find('.full-video, .video-shortcode, .wooslider .slide-content').fitVids();
9945		});
9946
9947		if(jQuery().isotope && jQuery('.posts-container-infinite .blog-timeline-layout').hasClass('isotope')) {
9948			jQuery('.posts-container-infinite .blog-timeline-layout').isotope('reLayout');
9949		}
9950	});
9951
9952	if(js_local_vars.grid_pagination_type == 'Infinite Scroll') {
9953		jQuery('.portfolio-masonry .portfolio-wrapper').infinitescroll({
9954		   	//behavior: 'local',
9955		    //binder: jQuery('.portfolio-infinite .portfolio-wrapper'),
9956		    navSelector  : "div.pagination",
9957		                   // selector for the paged navigation (it will be hidden)
9958		    nextSelector : "a.pagination-next",
9959		                   // selector for the NEXT link (to page 2)
9960		    itemSelector : "div.portfolio-item",
9961		                   // selector for all items you'll retrieve
9962			loading      : {
9963							finishedMsg: js_local_vars.infinite_finished_msg,
9964							msgText: js_local_vars.infinite_blog_text,
9965			},
9966		    errorCallback: function() {
9967		    },
9968		    contentSelector: jQuery('.portfolio-masonry .portfolio-wrapper'),
9969		}, function(posts) {
9970			if(jQuery().isotope) {
9971				jQuery(posts).hide();
9972
9973				imagesLoaded(jQuery(posts), function() {
9974					jQuery(posts).fadeIn();
9975
9976					jQuery('.portfolio-masonry .portfolio-wrapper').isotope('appended', jQuery(posts));
9977
9978					if(jQuery().prettyPhoto) { jQuery("a.zoom, a[data-rel^='prettyPhoto'], a[rel^='prettyPhoto']").prettyPhoto(ppArgs); }
9979
9980					jQuery(posts).each(function() {
9981						jQuery(this).find('.full-video, .video-shortcode, .wooslider .slide-content').fitVids();
9982					});
9983
9984					jQuery('.portfolio-masonry .portfolio-wrapper').isotope('reLayout');
9985
9986					jQuery('[data-spy="scroll"]').each(function () {
9987						  var $spy = jQuery(this).scrollspy('refresh');
9988					});
9989				});
9990			}
9991		});
9992	}
9993
9994	// sticky header v1 - v5
9995	if( jQuery( '.sticky-header' ).length ) {
9996		jQuery('.sticky-header').init_sticky_header();
9997	}
9998});

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.