PageSourceSearch

https://arcb.ro/website/wp-content/themes/envision/lib/js/extensions.js?ver=2.0.9.3

js arcb.ro collected 2026-10-03 17:36:45 UTC 92,785 bytes, 3,113 lines download raw bytes

1/**
2*	@package: CloudFw / Envision
3*	@access: Envision
4*/
5
6/* ========================================
7    ACCORDIONS (includes.shortcodes.shortcode.accordions)
8========================================*/
9jQuery(document).ready(function(){
10	"use strict";
11
12	jQuery.fn.extend({
13
14		CloudFwAccordions: function() {
15			var in_progress = false,
16				accordion_wrap  = this,
17				accordion_items = accordion_wrap.children().not('.ui--accordion-state-static');
18
19			accordion_items.find('> a').click(function( e ) {
20				e.preventDefault();
21
22				if ( in_progress === true ) {
23					return false;
24				}
25
26				in_progress = true;
27
28				var that = jQuery(this),
29					item = that.parents('.ui--accordion-item').first();
30
31				item.addClass('not');
32				accordion_items.not('.not').removeClass('ui--accordion-state-opened').addClass('ui--accordion-state-closed');
33
34				if (item.hasClass('ui--accordion-state-opened')) {
35					item.removeClass('ui--accordion-state-opened').removeClass('not').addClass('ui--accordion-state-closed');
36					in_progress = false;
37
38				} else {
39					item.removeClass('ui--accordion-state-closed').removeClass('not').addClass('ui--accordion-state-opened');
40					in_progress = false;
41
42				}
43
44				jQuery(window).trigger('scroll');
45				jQuery(window).trigger('make@2x');
46				jQuery(window).trigger('resize');
47
48			});
49
50		}
51
52	});
53
54    /** Init Toggles */
55    jQuery('.ui--accordion').each(function () {
56        jQuery(this).CloudFwAccordions();
57    });
58
59});
60
61/* ========================================
62    CAROUSEL (includes.shortcodes.shortcode.carousel)
63========================================*/
64var boxGalleryInit;
65
66jQuery(document).ready(function(){
67	"use strict";
68
69	if ( jQuery.isFunction( jQuery.fn.flexslider ) ) {
70
71		var carouselInit = function( parent ){
72			if ( typeof parent == 'undefined' || !parent.jquery )
73				parent = jQuery( '.ui--carousel' );
74
75			parent.each(function(){
76				var that = jQuery(this);
77				var fullwidth = ! that.parents('.ui-row').length;
78				var pass = that.parents('.ui--pass');
79				var wrapper = pass.length ? pass : that;
80
81				var title_bordered = that.prev('.ui--title-bordered').length ? that.prev('.ui--title-bordered') : wrapper.prev('.ui--title-bordered');
82				var title_widget = wrapper.prev('.ui--widget-title');
83				var slider_data = that.data('flexslider');
84
85
86				if ( !slider_data ) {
87	
88					var slides = that.find('.slides');
89
90					if ( slides.length > 1 ) {
91						slides.last().unwrap();
92					}
93
94					if ( fullwidth ) {
95						that.addClass( 'fullwidth-content' );
96						var children = slides.first().children();
97
98						children.each(function(){
99							var child = jQuery(this);
100
101							if ( child.hasClass('.ui-row') ) {
102								child.wrap('<div class="ui--carousel-content clearfix" />').wrap('<div class="container" />');
103							} else {
104								child.wrap('<div class="ui--carousel-content clearfix" />').wrap('<div class="container" />').wrap('<div class="ui-row" />');
105							}
106
107						});
108
109						prepareResponsiveFullwidthContainerPage( that );
110					} else {
111						slides.first().children('.ui-row').wrap('<div class="ui--carousel-content clearfix" />');
112					}
113
114					var items = slides.children(); 
115					if ( !( items.length > 1 ) ) {
116						items.show();
117						return false;
118					}
119
120					var options = CloudFwParseAttribute(that.attr('data-options'));
121
122					//console.log(options);
123
124					if ( options.auto_rotate == '1' ) {
125						options.auto_rotate = true;
126					} else {
127						options.auto_rotate = false; 
128					}
129
130					if ( options.animation_loop == '1' ) {
131						options.animation_loop = true;
132					} else {
133						options.animation_loop = false; 
134					}
135
136					if ( typeof options.animate == 'undefined' || options.animate == '1' ) {
137						options.animate = 600;
138					} else {
139						options.animate = 1; 
140					}
141
142					var that = that.flexslider({
143						namespace: "ui--carousel-",
144						selector: ".slides > div",
145						animation: options.effect || "slide",
146						slideshow: options.auto_rotate,
147						//slideshow: false,
148						slideshowSpeed: options.rotate_time || 7000,
149						smoothHeight: true,
150						animationLoop: options.animation_loop || false,
151						controlNav: false,
152						directionNav: false,
153						pauseOnHover: true,
154						animationSpeed: 1000,
155						itemMargin: 30,
156						start: function( obj ) {
157							if ( typeof boxGalleryInit != 'undefined' ) {
158								boxGalleryInit( that );
159							}
160						}
161
162					});
163
164					var slider_data = that.data('flexslider');
165
166					if ( options.arrows == '1' ) {
167
168						var to_prev = function(){ that.flexslider('prev'); jQuery(window).scroll(); } 
169						var to_next = function(){ that.flexslider('next'); jQuery(window).scroll(); } 
170
171						if ( title_bordered.length ) {
172							title_bordered.addClass('with-navigation');
173							title_bordered.find('.ui--title-navigation').remove();
174							title_bordered.append( jQuery('<div/>').addClass('ui--title-navigation') );
175							title_bordered.find('.ui--title-navigation').html('<span class=\"arr arr-small arr-plain arr-left ui--carosuel-prev\"><span></span><i class=\"fontawesome-angle-left px18\"></i></span> <span class=\"arr arr-small arr-plain ui--carosuel-next\"><span></span><i class=\"fontawesome-angle-right px18\"></i></span>');
176							title_bordered.find('.ui--title-navigation > .ui--carosuel-prev').click( to_prev );
177							title_bordered.find('.ui--title-navigation > .ui--carosuel-next').click( to_next );
178						} else if ( title_widget.length ) {
179							title_widget.addClass('with-navigation');
180							title_widget.find('.ui--title-navigation').remove();
181							title_widget.append( jQuery('<div/>').addClass('ui--title-navigation') );
182							title_widget.find('.ui--title-navigation').html('<span class=\"arr arr-plain arr-left ui--carosuel-prev\"><span></span><i class=\"fontawesome-angle-left px18\"></i></span> <span class=\"arr arr-plain ui--carosuel-next\"><span></span><i class=\"fontawesome-angle-right px18\"></i></span>');
183							title_widget.find('.ui--title-navigation > .ui--carosuel-prev').click( to_prev );
184							title_widget.find('.ui--title-navigation > .ui--carosuel-next').click( to_next );
185						} else {
186							that.find('.ui--carousel-navigation').remove();
187							that.append( jQuery('<div/>').addClass('ui--carousel-navigation clearfix') );
188							that.find('.ui--carousel-navigation').html('<span class=\"arr arr-normal arr-left ui--carosuel-prev\"><span></span><i class=\"fontawesome-chevron-left px18\"></i></span> <span class=\"arr arr-normal ui--carosuel-next\"><span></span><i class=\"fontawesome-chevron-right px18\"></i></span>');
189							that.find('.ui--carousel-navigation > .ui--carosuel-prev').click( to_prev );
190							that.find('.ui--carousel-navigation > .ui--carosuel-next').click( to_next );
191						}
192
193					}
194
195				}
196
197			});
198
199		} 
200
201		/*var timeout = setTimeout( function(){
202			carouselInit();
203			clearTimeout( timeout );
204		}, 500);
205		*/
206		jQuery( '.ui--carousel' ).each(function(){
207			var that = jQuery(this);
208			that.find('.slides > div:first').find('img:first').imagesLoaded(function(){
209				var timeout = setTimeout( function(){
210					carouselInit( that );
211					clearTimeout( timeout );
212				}, 300);
213				
214			});
215		});
216		jQuery(window).load(carouselInit);
217
218
219
220
221		boxGalleryInit = function( parent ){
222
223			parent.find( '.ui--content-box-gallery' ).each(function(){
224				var that = jQuery(this);
225				var slider_data = that.data('flexslider');
226
227
228				if ( !slider_data ) {
229
230					jQuery(window).load(function(){ boxGalleryInit( parent ); });
231					var options = CloudFwParseAttribute(that.attr('data-options'));
232						options.auto_rotate = (options.auto_rotate == '1') ? true : false;
233
234					that.flexslider({
235						namespace: "ui--content-box-gallery-",
236						selector: ".mini-slides > div",
237						animation: options.effect || "slide",
238						slideshow: options.auto_rotate || false,
239						slideshowSpeed: 7000,
240						smoothHeight: true,
241						controlNav: false,
242						directionNav: false,
243						keyboard: false
244					});
245
246					var slider_data = that.data('flexslider');
247
248					var to_prev = function(){ that.flexslider("prev"); } 
249					var to_next = function(){ that.flexslider("next"); } 
250
251					that.find('.ui--content-box-gallery-navigation').remove();
252					that.append( jQuery('<div/>').addClass('ui--content-box-gallery-navigation') );
253					that.find('.ui--content-box-gallery-navigation').html('<span class=\"arr arr-normal arr-left ui--carosuel-prev\"><span></span><i class=\"fontawesome-chevron-left px18\"></i></span> <span class=\"arr arr-normal ui--carosuel-next\"><span></span><i class=\"fontawesome-chevron-right px18\"></i></span>');
254					that.find('.ui--content-box-gallery-navigation > .ui--carosuel-prev').click( to_prev );
255					that.find('.ui--content-box-gallery-navigation > .ui--carosuel-next').click( to_next );
256					
257
258				}
259
260			});
261
262		} 
263
264		jQuery('.ui--content-box').each(function(){
265			var that = jQuery(this),
266				parents = that.parents(); 
267
268			if ( !parents.filter('.ui--carousel').length && !parents.filter('.ui--masonry').length ) {
269				boxGalleryInit( that );
270				jQuery(window).load(function(){ boxGalleryInit( that ); });
271			}
272			
273
274		});
275
276
277
278
279	} 
280
281});
282
283/* ========================================
284    GALLERY (includes.shortcodes.shortcode.gallery)
285========================================*/
286(function( jQuery ){
287	"use strict";
288
289	jQuery(document).ready(function(){
290
291		if ( !CloudFwOp.gallery_overlay_opacity ) {
292			CloudFwOp.gallery_overlay_opacity = 0.60;
293		}
294
295		jQuery('.ui--gallery-item a').hover(function(){
296			var that = jQuery(this),
297				overlay = that.find('.ui--gallery-overlay');
298
299			overlay.stop(1).fadeTo(500, CloudFwOp.gallery_overlay_opacity);
300
301		},function(){
302			var that = jQuery(this),
303				overlay = that.find('.ui--gallery-overlay');
304
305			overlay.stop(1).fadeTo(500,0);
306
307		});
308
309	});
310
311})(jQuery);
312
313/* ========================================
314    GMAP (includes.shortcodes.shortcode.gmap)
315========================================*/
316jQuery(document).ready(function(){
317	"use strict";
318
319	jQuery(".gmap").each(function(){
320		var that     = jQuery(this),
321			gmap     = '',
322			api      = '',
323			data     = that.attr('data-gmap-options') || '',
324			defaults = {};
325		
326		try {
327			
328			if ( typeof data != 'object' ) {
329				var gmap_metadata = jQuery.parseJSON( data );
330			} else {
331				var gmap_metadata = data;
332			}
333
334		} catch (e) {
335			var gmap_metadata = {};
336		}
337
338		var defaults = {
339			zoom            : 12,
340			latitude        : 0,
341			longitude       : 0,
342			maptype         : "ROADMAP",
343			doubleclickzoom : 1,
344			scrollwheel     : 1,
345			controls        : false
346		};
347
348		
349		var gmap_options = jQuery.extend( {}, defaults, gmap_metadata );
350		jQuery( gmap_options.markers ).each(function( index, value ) {
351			gmap_options.markers[ index ].html = jQuery('<div />').html( gmap_options.markers[ index ].html ).text().replace(/\n/g,'<br/>');
352		});
353
354		that.unbind('gMapReady').bind('gMapReady',function(){
355			gmap = that.gMap( gmap_options );
356			api  = that.data('gMap.reference');
357			that.data( "gMapReady", true );
358
359			var styles = gmap_options.stylers || {};
360
361			if ( styles ) {
362				api.setOptions({styles: styles});
363			}
364		
365		}).data("gMapReady", false);
366
367		var init_now = true;
368
369		if ( init_now ) {
370			that.trigger( 'gMapReady' );
371		}
372
373		var device_callback = function(){
374			var device = detectDeviceViaPageWidth(); 
375
376			if ( device == 'phone' ) {
377				that.trigger('gMapReady');
378			}
379		}
380
381		device_callback();
382		//jQuery(window).bind('CloudFwDetectDevice', device_callback );
383
384	});
385
386}); 
387
388/* ========================================
389    MASONRY (includes.shortcodes.shortcode.masonry)
390========================================*/
391jQuery(document).ready(function(){
392	"use strict";
393
394	//return true;
395
396	if ( jQuery.isFunction( jQuery.fn.CloudFwisotope ) ) {
397
398		// code found on this page: http://isotope.metafizzy.co/custom-layout-modes/masonry-gutters.html
399
400		// modified Isotope methods for gutters in masonry
401		jQuery.CloudFwisotope.prototype._getMasonryGutterColumns = function() {
402			var gutter = this.options.masonry && this.options.masonry.gutterWidth || 0;
403			var containerWidth = this.element.width();
404
405			this.masonry.columnWidth = this.options.masonry && this.options.masonry.columnWidth ||
406			// or use the size of the first item
407			this.$filteredAtoms.outerWidth(true) ||
408			containerWidth;
409
410			this.masonry.columnWidth += gutter;
411
412			this.masonry.cols = Math.floor((containerWidth + gutter) / this.masonry.columnWidth);
413			this.masonry.cols = Math.max(this.masonry.cols, 1);
414		}
415
416		jQuery.CloudFwisotope.prototype._masonryReset = function() {
417			// layout-specific props
418			this.masonry = {};
419			this._getMasonryGutterColumns();
420			var i = this.masonry.cols;
421			this.masonry.colYs = [];
422			while (i--) {
423				this.masonry.colYs.push(0);
424			}
425		}
426
427		jQuery.CloudFwisotope.prototype._masonryResizeChanged = function() {
428			var prevSegments = this.masonry.cols;
429			// update cols/rows
430			this._getMasonryGutterColumns();
431			// return if updated cols/rows is not equal to previous
432			return (this.masonry.cols !== prevSegments);
433		}
434
435		var masonryInit = function(){
436
437			jQuery( '.ui--masonry' ).each(function(){
438				var that = jQuery(this);
439				var title_bordered = that.prev('.ui--title-bordered');
440				var title_widget = that.prev('.ui--widget-title');
441				var masonry_data = that.data('masonry');
442				var init = new Object();
443				var is_fluid = false;
444
445				if ( that.hasClass('row-fluid') || that.parents('.ui-row').length ) {
446					is_fluid = true; 
447				}
448
449				if ( ! masonry_data ) {
450					
451					CloudFwLoaded( that );
452
453					var items = that.find('.ui--content-item');
454					items.each(function(){
455						if( !jQuery(this).parent().hasClass('ui-column') ) {
456							jQuery(this).wrap('<div class="ui-column span12"/>');
457						}
458					});
459					
460					that.find('> .ui-row > .ui-column').addClass('ui--isotope-item');
461					//that.imagesLoaded(masonryInit);				
462				}
463
464				if ( masonry_data == true && !is_fluid ) {
465					that.CloudFwisotope( 'reLayout' );
466					return false;
467				}
468
469				/** Init Object */
470				init.resizable = false;
471				init.itemSelector = '.ui--isotope-item';
472				init.onLayout = function(){
473					that.show();
474					if ( typeof boxGalleryInit != 'undefined' )
475						boxGalleryInit( that );
476				};
477				init.layoutMode = 'masonry';
478
479				if ( is_fluid ) {
480					var containerWidth = that.width(),
481						column = CloudFwGetColumByClassname( that.find('.ui--isotope-item') ),
482						gutter = (containerWidth * column) / 100, 
483						gutterWidth = gutter * (column - 1),
484						columnWidth = Math.floor(((containerWidth - gutterWidth) / column));
485
486					init.masonry = {
487						columnWidth: columnWidth,
488						gutterWidth: gutter
489					};
490				}
491
492				that.data('masonry',true);
493				that.css("visibility", "visible").css("overflow", "visible").CloudFwisotope(init);
494				that.addClass('ui--done');
495
496			});
497
498		} 
499
500		if ( BrowserDetect.browser == 'IE' ) {
501			jQuery(window).load(masonryInit);
502		} else {
503			masonryInit();
504		}
505		
506		jQuery(window).smartresize(masonryInit, 5000);
507		jQuery(document).ajaxSuccess(masonryInit);
508
509	} 
510
511});
512
513/* ========================================
514    TABLE (includes.shortcodes.shortcode.pricing_table)
515========================================*/
516jQuery(document).ready(function(){
517	"use strict";
518
519	var pricingTableInit = function(){
520
521		jQuery('.ui--pricing-table').each(function(){
522			var that = jQuery(this),
523				before_htmls = that.find( '.ui--pricing-table-before-html' ),
524				features = that.find( '.ui--pricing-table-features' );
525
526			before_htmls.css({'min-height': ''}).css({'min-height': Math.max.apply(null, before_htmls.map(function(){return jQuery(this).height();}).get())});
527
528			features.first().children('.ui--pricing-table-feature').each(function(){
529				var group = jQuery(this).attr('data-group'),
530					items = that.find( '.' + group ); 
531
532				items.css({'min-height': ''}).css({'min-height': Math.max.apply(null, items.map(function(){return jQuery(this).height();}).get())});
533
534			});
535
536		});
537
538	}
539
540	pricingTableInit();
541	jQuery(window).load( pricingTableInit );
542	jQuery(window).smartresize( pricingTableInit );
543
544});
545
546/* ========================================
547    PROGRESS BAR (includes.shortcodes.shortcode.progress_bar)
548========================================*/
549jQuery(document).ready(function(){
550	"use strict";
551
552	if ( ! jQuery.isFunction( jQuery.inviewport ) ) 
553		return false;
554
555	var progressBarInit = function(){
556
557		jQuery('.ui--progress:in-viewport').each(function(){
558			var that = jQuery(this);
559
560			if( ! that.hasClass('animated') ) {
561				var percent	= that.find('.ui--progress-percent');
562				var callback = function(){
563
564				}
565
566				percent.css({'visibility': 'visible'});
567				if ( animation_type == 'css' ) {
568
569					that.addClass('lock');
570					that.addClass('animated');
571
572			        var delay = setInterval(function(){
573						that.removeClass('lock');
574			            clearInterval(delay);
575			        }, 500);
576
577					that.bind("transitionend webkitTransitionEnd oTransitionEnd MSTransitionEnd", callback);
578
579				} else {
580					
581					that.addClass('animated');
582					var width = percent.attr('data-value');
583					percent.width('0').animate({'width': width}, 600, callback);
584				
585				}
586				
587
588			}
589		});
590
591	} 
592
593	if ( jQuery('.ui--progress').length ) {
594		var animation_type = jQuery('html').hasClass('cssanimations') ? 'css' : 'javascript';
595
596		if ( animation_type == 'css' ) {
597			progressBarInit();
598			jQuery(window).load( progressBarInit );
599			jQuery(window).scroll( jQuery.throttle( 250, progressBarInit ) );
600		}
601		
602	}
603});
604
605/* ========================================
606    PROGRESS CIRCLE (includes.shortcodes.shortcode.progress_circle)
607========================================*/
608jQuery(document).ready(function(){
609	"use strict";
610
611	if ( ! jQuery.isFunction( jQuery.inviewport ) || ! jQuery.isFunction( jQuery.easyPieChart ) ) {
612		return false;
613	}
614
615	var initPieChart = function() {
616		jQuery('.ui--progress-circle').each(function(){
617			var that = jQuery(this),
618				wrapper = that.parent(),
619				wrapper_width = wrapper.width(),
620				percent_text = wrapper.find('.ui--progress-circle-percent'),
621				percent = parseInt(that.attr('data-percent-update'), 10),
622				width = parseInt(that.attr('data-width'), 10);
623
624			if ( !width || width > wrapper_width ) {
625				width = wrapper_width;
626			}
627
628			that.easyPieChart({
629				animate: 1000,
630				trackColor: '#f1f1f1',
631				barColor: '#169FE5',
632				scaleColor: false,
633				lineCap: 'butt',
634				rotate: -90,
635				lineWidth: 15,
636				size: width,
637				onStep: function(value) { percent_text.text(~~value); },
638				onStop: function(value) { percent_text.text(percent); }
639			});
640
641			that.find('.ui--center-vertical').uiVerticalCenter();
642
643
644		});
645
646		initPieChartUpdate();
647
648	};
649
650	var initPieChartResize = function() {
651
652		jQuery('.ui--progress-circle').each(function(){
653			var that = jQuery(this);
654
655			that.removeData( 'easyPieChart' );
656			that.removeData( 'inViewport' );
657			that.css({
658				'width'			: '',
659				'height'		: '',
660				'line-height'	: ''
661			});
662			that.find('canvas').remove();
663
664		});
665
666		initPieChart();
667
668	};
669
670	var initPieChartUpdate = function() {
671		jQuery('.ui--progress-circle:in-viewport').each(function(){
672			var that = jQuery(this);
673
674			if ( ! that.is(':visible') ) {
675				return true;
676			}
677
678			if ( that.data('inViewport') ) {
679				return true;
680			}
681
682			that.data('inViewport', true);
683
684			var percent = parseInt(that.attr('data-percent-update'), 10);
685			that.data('easyPieChart').update( percent );
686		});
687	};
688
689
690	if ( jQuery('.ui--progress-circle').length ) {
691		var animation_type = jQuery('html').hasClass('cssanimations') ? 'css' : 'javascript';
692
693		if ( animation_type == 'css' ) {
694			initPieChart();
695			jQuery(window).load( initPieChartUpdate );
696			jQuery(window).scroll( jQuery.throttle( 250, initPieChartUpdate ) );
697			jQuery(window).smartresize( initPieChartResize, 5000 );
698		}
699	};
700
701});
702
703/* ========================================
704    TABS (includes.shortcodes.shortcode.tabs)
705========================================*/
706jQuery(document).ready(function(){
707	"use strict";
708
709	jQuery.fn.extend({
710		/**
711		 *  CloudFw Tabs
712		 *
713		 *  @since 1.0
714		 */
715		CloudFwTabs: function() {
716			var in_proccess = false,
717				tabs = this,
718				titles = tabs.find('.ui--tabs-header .ui--tabs-titles').children('li'),
719				border_before = tabs.find('.ui--tabs-header .ui--tabs-border-before'),
720				border_after = tabs.find('.ui--tabs-header .ui--tabs-border-after'),
721				border_top = tabs.find('.ui--tabs-header .ui--tabs-border-top'),
722				border_bottom = tabs.find('.ui--tabs-header .ui--tabs-border-bottom'),
723				contents = tabs.children('.ui--tabs-contents').children('li');
724
725			titles.first().addClass('first-item');
726			titles.last().addClass('last-item');
727
728			contents.first().show().removeClass('hidden').addClass('active').addClass('first-item');
729			contents.last().addClass('last-item');
730
731			titles.find('a').click(function(e) {
732				//e.preventDefault();
733
734				var that    = jQuery(this),
735					li      = that.parents('li').first(),
736					width   = li.width(),
737					height  = li.height(),
738					pos     = li.position(),
739					index   = li.index();
740
741
742				if (in_proccess === true ) {
743					return false;
744				}
745
746				in_proccess = true;
747
748				if ( ! li.hasClass('active') ) {
749					contents.filter('.active').removeClass('active').addClass('hidden');
750					var current_item = contents.eq(index);
751
752					current_item.removeClass('hidden').addClass('active');
753
754					titles.filter('.active').removeClass('active');
755					li.addClass('active');
756
757					/*if ( ! current_item.is(':in-viewport' ) ) {
758						var pos = parseInt(current_item.offset().top, 10);
759
760						if ( pos > 100 ) {
761							pos = pos - 200;
762						}
763
764						jQuery("html, body").scrollTop( pos );
765					}*/
766
767				}
768
769				border_after.css( { left: (pos.left + width) } );
770				border_before.css( { left: -(border_before.width() - pos.left) } );
771
772				border_top.css( { top: -(border_top.height() - pos.top) } );
773				border_bottom.css( { top: (pos.top + height) } );
774
775				tabs.addClass('ui--done');
776
777				in_proccess = false;
778				jQuery(window).trigger('scroll');
779				jQuery(window).trigger('make@2x');
780
781
782			});
783
784			titles.first().find('a').click();
785
786			var refresh_titles = function(){
787				titles.filter('.active').find('a').click();
788			};
789
790			jQuery(window).smartresize(refresh_titles, 20);
791			jQuery(document).ready(refresh_titles);
792			jQuery(window).load(refresh_titles);
793
794		}
795
796	});
797
798	/** Prepare Tabs */
799	jQuery('.ui--tabs').each(function () {
800		jQuery(this).CloudFwTabs();
801	});
802
803});
804
805/* ========================================
806    TITLES (includes.shortcodes.shortcode.titles)
807========================================*/
808jQuery(document).ready(function(){
809	"use strict";
810
811	var bordered_titles_callback = function(){
812		jQuery('.ui--title-bordered').each(function(){
813			var that		 = jQuery(this),
814				text 		 = that.find('.ui--title-text'),
815				pos			 = text.position(),
816				width		 = text.outerWidth(),
817				border_left  = that.find('.ui--title-border-left'),
818				border_right = that.find('.ui--title-border-right');
819
820
821			border_left.show().css({ left: 0 - (border_left.width() - pos.left) });
822			border_right.show().css( { left: (pos.left + width) } );
823
824		});
825	}
826
827	bordered_titles_callback();
828	jQuery(window).load( bordered_titles_callback );
829	jQuery(window).smartresize( bordered_titles_callback );
830
831
832});
833
834/* ========================================
835    TOGGLES (includes.shortcodes.shortcode.toggles)
836========================================*/
837jQuery(document).ready(function(){
838	"use strict";
839
840	jQuery.fn.extend({
841
842		CloudFwToggle: function() {
843			var in_progress = false,
844				toggle      = this,
845				title       = toggle.children('.ui--toggle-title'),
846				title_link  = title.children('a'),
847				content     = toggle.children('.ui--toggle-content');
848
849			title_link.click(function( e ) {
850				e.preventDefault();
851
852				if (in_progress === true) {
853					return false;
854				}
855
856				in_progress = true;
857
858				var that = jQuery(this),
859					group = toggle.attr("data-group");
860
861				toggle.addClass('not');
862
863				if (group && toggle.hasClass('ui--toggle-state-closed')) {
864					jQuery('[data-group="' + group + '"]').not('.not').removeClass('ui--toggle-state-opened').addClass('ui--toggle-state-closed');
865				}
866
867				if (toggle.hasClass('ui--toggle-state-opened')) {
868					toggle.removeClass('ui--toggle-state-opened').removeClass('not').addClass('ui--toggle-state-closed');
869					in_progress = false;
870
871				} else {
872					toggle.removeClass('ui--toggle-state-closed').removeClass('not').addClass('ui--toggle-state-opened');
873					in_progress = false;
874					jQuery(window).trigger('scroll');
875					jQuery(window).trigger('make@2x');
876				}
877
878			});
879
880
881		}
882
883	});
884
885	/** Init Toggles */
886	jQuery('.ui--toggle').each(function () {
887		jQuery(this).CloudFwToggle();
888	});
889
890});
891
892/* ========================================
893    GALLERY (includes.shortcodes.shortcode.ui_box)
894========================================*/
895jQuery(document).ready(function(){
896	"use strict";
897
898	if ( jQuery.isFunction( jQuery.fn.flexslider ) ) {
899		//jQuery( '.ui--carousel' ).imagesLoaded(boxGalleryInit);
900
901	} 
902
903	jQuery('.ui--content-box').each(function(){
904		var that = jQuery(this);
905		var options = CloudFwParseAttribute(that.attr('data-ligthbox'));
906
907		if ( options ) {
908			if ( options.src ) {
909				that.find('.ui--content-box-link').bind('click', function(){
910					jQuery.CloudFwPrettyPhoto.open(options.src, null, options.desc);
911					return false;
912				});
913			}
914		}
915
916
917	});
918
919
920
921});
922
923/* ========================================
924    BLOG (includes.modules.module.blog)
925========================================*/
926jQuery(document).ready(function(){
927
928	blogGalleryInit = function( parent ){
929
930		jQuery( '.ui--blog-gallery' ).each(function(){
931			var that = jQuery(this);
932			var slider_data = that.data('flexslider');
933
934
935			if ( !slider_data ) {
936
937				var first_item = jQuery('.ui--blog-gallery-item-1 img', that);
938				first_item.imagesLoaded(function(){
939
940					that.css({height: first_item.height()});
941
942					jQuery(window).load(function(){ blogGalleryInit( parent ); });
943
944					var options = CloudFwParseAttribute(that.attr('data-options'));
945						options.auto_rotate = (options.auto_rotate == '1') ? true : false;
946
947					that.flexslider({
948						namespace: "ui--blog-gallery-",
949						selector: ".slides > div",
950						animation: options.effect || "slide",
951						slideshow: options.auto_rotate || false,
952						slideshowSpeed: options.rotate_time || 7000,
953						smoothHeight: true,
954						controlNav: false,
955						directionNav: false,
956						keyboard: false
957					});
958
959					var slider_data = that.data('flexslider');
960
961					var to_prev = function(){ that.flexslider("prev"); } 
962					var to_next = function(){ that.flexslider("next"); } 
963
964					that.find('.ui--blog-gallery-navigation').remove();
965					that.append( jQuery('<div/>').addClass('ui--blog-gallery-navigation') );
966					that.find('.ui--blog-gallery-navigation').html('<span class=\"arr arr-normal arr-left ui--carosuel-prev\"><span></span><i class=\"fontawesome-chevron-left px18\"></i></span> <span class=\"arr arr-normal ui--carosuel-next\"><span></span><i class=\"fontawesome-chevron-right px18\"></i></span>');
967					that.find('.ui--blog-gallery-navigation > .ui--carosuel-prev').click( to_prev );
968					that.find('.ui--blog-gallery-navigation > .ui--carosuel-next').click( to_next );
969				
970				});
971
972			}
973
974		});
975
976	} 
977
978	blogGalleryInit();
979	jQuery(window).load(function(){ blogGalleryInit(); });
980
981});
982
983/* ========================================
984    EFFECTS (includes.modules.module.effects)
985========================================*/
986jQuery(document).ready(function(){
987	'use strict';
988
989	var initEffects = function() {
990
991		jQuery('.ui--animation-in:in-viewport').each(function(){
992			var parent = jQuery(this);
993
994			if ( ! parent.is(':visible') ) {
995				return true;
996			}
997
998			if ( parent.data('inViewport') ) {
999				return true;
1000			}
1001
1002			parent.data('inViewport', true);
1003
1004			initEffectsFire( parent );
1005
1006		});
1007		
1008	};
1009
1010	var initEffectsFire = function( parent ) {
1011
1012		var animator    = parent.hasClass('ui--animation-in') ? parent : parent.parents('.ui--animation-in:first');
1013
1014		var elements    = parent.find('.ui--animation'),
1015			effect      = animator.attr('data-fx'),
1016			start_delay = parseInt( parent.attr('data-start-delay'), 10 ) || 0,
1017			delay       = parseInt( animator.attr('data-delay'), 10 ) || 150;
1018
1019		var carousel = parent.find('.ui--carousel');
1020		if ( carousel.length ) {
1021			var active_carousel = carousel.find('.ui--carousel-active-slide'); 
1022
1023			if ( active_carousel.length ) {
1024				var passive_elements = elements;
1025
1026				if ( carousel.parents('.ui--animation').length ) {
1027					initEffectsFire( carousel.find('.ui--carousel-active-slide') );
1028				} else {
1029					elements = carousel.find('.ui--carousel-active-slide').find('.ui--animation');
1030				}
1031				passive_elements.not( elements ).addClass('ui--animation-fire');/*.removeClass('ui--animation')*/;
1032			}
1033
1034		}
1035
1036		elements = elements.filter(function(index){
1037			var parent_animations = jQuery(this).parents('.ui--animation');
1038
1039			parent_animations = parent_animations.filter(function(){
1040				return jQuery(this).find('.ui--animation-in').length === 0;
1041			});
1042
1043			return parent_animations.length === 0;
1044		});
1045
1046		/*elements = elements.filter(function(index){
1047			var all_parents = jQuery(this).parents();
1048			var has_ui_animation = false;
1049
1050			all_parents.each(function(){
1051				var up_element = jQuery(this);
1052				if ( up_element.hasClass( '.ui--animation-in' ) ) {
1053					return false;
1054				} else if ( up_element.hasClass( '.ui--animation' ) ) {
1055					has_ui_animation = true;
1056					return false;
1057				}
1058			});
1059
1060			return has_ui_animation ? false : true;
1061		});*/
1062
1063
1064
1065		elements.each(function(i){
1066
1067			var element         = jQuery(this),
1068				element_effect  = element.attr('data-fx'),
1069				element_delay   = parseInt( element.attr('data-delay'), 10 ) || 0,
1070				current_delay   = (start_delay + element_delay) + (i * delay);
1071
1072			//element.attr('data-current-delay', current_delay);
1073
1074			if ( element_effect ) {
1075				element.addClass( element_effect );
1076			} else if ( effect ) {
1077				element.addClass( effect );
1078			}
1079
1080			var timeout = setTimeout(function(){ 
1081
1082				//element.bind("animationend webkitAnimationEnd oAnimationEnd MSAnimationEnd", function(){});
1083				element.addClass('ui--animation-fire').attr('delay', current_delay);
1084
1085				if ( element.find('.ui--animation') ) {
1086					element.removeClass('ui--animation');
1087					initEffectsFire( element );
1088				}
1089
1090			}, (current_delay));
1091
1092		});
1093
1094	};
1095
1096	var animation_type = jQuery('html').hasClass('cssanimations') ? 'css' : 'javascript';
1097
1098	if ( animation_type == 'css' ) {
1099		//setTimeout( initEffects, 200 );
1100		jQuery(document).ready( initEffects );
1101		jQuery(document).ajaxSuccess( initEffects );
1102		jQuery(window).load( initEffects );
1103		jQuery(window).focus( initEffects );
1104		jQuery(window).scroll( jQuery.throttle( 250, initEffects ) );
1105	}
1106
1107});
1108
1109/* ========================================
1110    LIKES (includes.modules.module.likes)
1111========================================*/
1112jQuery(document).ready(function($){
1113
1114	jQuery('.ui--likes').on('click',
1115		function() {
1116			var that = jQuery(this);
1117
1118			//if(that.hasClass('active')) 
1119			//  return false;
1120
1121			var id      = that.attr('data-post-id'),
1122				options = CloudFwParseAttribute(that.attr('data-options'));
1123
1124			var options_encoded = {};
1125			jQuery.each( options, function( k, v ){
1126				options_encoded[ k ] = encodeURIComponent(v);
1127			});
1128
1129			jQuery.post(CloudFwOp.ajaxUrl, {
1130				action: 'cloudfw_likes',
1131				likes_id: id,
1132				options: options_encoded
1133			}, function(data){
1134				that.html(data).addClass('active').attr('title','You already like this');
1135			});
1136
1137			return false;
1138	});
1139
1140});
1141
1142/* ========================================
1143    PRIMARY NAVIGATION (includes.modules.module.nav)
1144========================================*/
1145jQuery(document).ready(function(){
1146
1147	if ( jQuery.isFunction( jQuery.fn.superfish ) ) {
1148		var navigation = jQuery('#header-navigation');
1149
1150		navigation.superfish({
1151			hoverClass: 'hover',
1152			fire_event: CloudFwOp.navigation_event || 'hover',
1153			cssArrows: false,
1154			delay: 10,
1155			speed: 200,
1156			speedOut: 200,
1157			onBeforeShow: function( $sub ){
1158
1159				var $device = detectDeviceViaPageWidth();
1160				if ( $device != 'phone' ) {
1161					var $parent = $sub.parent('li').first();
1162
1163					if ( $parent.hasClass('level-0') ) {
1164						var $height = $parent.height();
1165						if ( $parent.css('position') != 'relative' ) {
1166							var $pos = $parent.position().top;
1167						}
1168						$sub.css({'top': $height + $pos});
1169					}
1170				}
1171				navigation.addClass('active');
1172
1173			},
1174			onShow: function( $sub ){
1175
1176				jQuery(window).trigger('scroll');
1177				jQuery(window).trigger('make@2x');
1178			},
1179			onBeforeHide: function( $sub ){
1180				var $parent = $sub.parent('li').first();
1181
1182				if ( $parent.hasClass('level-0') ) {
1183					navigation.removeClass('active');
1184					$sub.css({'top': ''});
1185				}
1186
1187			}
1188		});
1189	}
1190
1191
1192	jQuery('#header-navigation-toggle > a').click(function(){
1193		var that = jQuery(this),
1194			nav = jQuery('#header-navigation'); 
1195
1196		if ( nav.is(':visible') ) {
1197			nav.slideUp();
1198		} else {
1199			nav.slideDown();
1200		}
1201
1202	});
1203
1204});
1205
1206
1207(function(){
1208
1209	jQuery(document).ready(function(){
1210
1211		var header_overlapping = function(){
1212			var win_height = win_height_alias = jQuery(window).height();
1213			var header = jQuery('#page-header');
1214
1215			if( header.length ) {
1216				var device = detectDeviceViaPageWidth();
1217				var header_height = header.height();
1218				var helper = jQuery('#header-overlapping-helper');
1219
1220				if ( helper.length ) {
1221					if ( device == 'widescreen' ) {
1222						helper.height( header_height );
1223					} else {
1224						helper.css('height', '' );
1225					}
1226					
1227				} else {
1228				
1229					var titlebar = jQuery('#titlebar');
1230					if( titlebar.length ) {
1231
1232						if ( device == 'widescreen' ) {
1233							titlebar.css('padding-top', header_height );
1234						} else {
1235							titlebar.css('padding-top', '' );
1236						}
1237
1238					}
1239				
1240				}
1241
1242				jQuery('body').addClass('header-overlapping-ok');
1243
1244			}
1245
1246		}
1247
1248		if ( jQuery('body').hasClass('header-overlapping') ) {
1249			header_overlapping();
1250			jQuery(window).load( header_overlapping );
1251			jQuery(window).smartresize( header_overlapping, 20 );
1252		}
1253
1254	});
1255
1256})(jQuery);
1257
1258/* ========================================
1259    PORTFOLIO (includes.modules.module.portfolio)
1260========================================*/
1261jQuery(document).ready(function(){
1262
1263	function splitarray(input, spacing)
1264	{
1265	    var output = [];
1266
1267	    for (var i = 0; i < input.length; i += spacing)
1268	    {
1269	        output[output.length] = input.slice(i, spacing);
1270	    }
1271
1272	    return output;
1273	}
1274
1275    /** Portfolio Filters */
1276	var filters = [];
1277	jQuery('.portfolio-filters > li > a').click(function(e){
1278		e.preventDefault();
1279
1280		var that  	  = jQuery(this),
1281			wrapper   = that.parents('.portfolio-container-wrapper').first(),
1282			container = wrapper.find('.portfolio-container'),
1283			layout    = wrapper.attr('data-layout'),
1284			columns   = parseInt(wrapper.attr('data-columns')),
1285			parent    = that.parents('.portfolio-filters').first(),
1286			parent_li = that.parent('li'),
1287			isotope   = parent.attr('data-isotope'),
1288			multiple  = parent.attr('data-multiple'),
1289			selector  = that.attr('data-filter');
1290
1291
1292		if ( layout == 'masonry' ) {
1293			if ( parent_li.hasClass('active-item') ){
1294				filters = jQuery.grep(filters, function(value) {
1295				  return value != selector;
1296				});
1297			} else {
1298				filters.push( selector );
1299			}
1300			
1301			if ( multiple != '1' ) {
1302				filters = [ selector ];
1303			}
1304
1305			if ( selector == '*' ) {
1306				filters = [];
1307			}
1308			  
1309			parent.children('li.active-item').removeClass('active-item');
1310			var filterValue = '';
1311			for ( var prop in filters ) {
1312				filterValue += filters[ prop ];
1313				jQuery('[data-filter="'+ filters[ prop ] +'"]', parent).parent().addClass('active-item');
1314			}
1315
1316			if ( filters.length === 0 ) {
1317				filterValue = '*';
1318				jQuery('[data-filter="*"]', parent).parent().addClass('active-item');
1319			}
1320
1321			jQuery(""+isotope+"").find('.ui--masonry').first().CloudFwisotope({ filter: filterValue });
1322			
1323		} else if ( layout == 'carousel' ) {
1324
1325		} else {
1326
1327			var items = container.find('> .ui-row > .ui-column'),
1328				count = items.length,
1329				rows  = container.children('.ui-row');
1330
1331			items.show().removeClass('passive-item').fadeTo(1000,1).not('' + selector).stop(1).addClass('passive-item').fadeTo(1000,.3);
1332	
1333			parent.children('li.active-item').removeClass('active-item');
1334			parent_li.addClass('active-item');
1335			parent.children('li').not('.active-item');
1336		}
1337
1338		
1339	});
1340
1341});
1342
1343/* ========================================
1344    REVSLIDER (includes.modules.module.revslider)
1345========================================*/
1346jQuery(document).ready(function(){
1347	"use strict";
1348		
1349	jQuery('.rev_slider_wrapper').bind("revolution.slide.onloaded",function (e) {
1350		var that = jQuery(this);
1351
1352		that.find( '.caption-primary' ).wrapInner('<div />');
1353		that.find( '.tp-leftarrow.custom' ).html( '<div class="slider-navigation-wrapper"><i class="fontawesome-chevron-left"></i></div>' );
1354		that.find( '.tp-rightarrow.custom' ).html( '<div class="slider-navigation-wrapper"><i class="fontawesome-chevron-right"></i></div>' );
1355		that.find( '.tp-bullets.custom > .bullet' ).html( '<div class="ui--bullets"><div class="ui--bullets-color ui--accent-gradient"></div></div>' );
1356
1357	});
1358		
1359
1360});	
1361
1362
1363
1364/* ========================================
1365    BROWSER (includes.modules.module.script)
1366========================================*/
1367var BrowserDetect = 
1368{
1369    init: function () 
1370    {
1371        this.browser = this.searchString(this.dataBrowser) || "Other";
1372        this.version = this.searchVersion(navigator.userAgent) || this.searchVersion(navigator.appVersion) || "Unknown";
1373    },
1374
1375    searchString: function (data) 
1376    {
1377        for (var i=0 ; i < data.length ; i++)   
1378        {
1379            var dataString = data[i].string;
1380            this.versionSearchString = data[i].subString;
1381
1382            if (dataString.indexOf(data[i].subString) != -1)
1383            {
1384                return data[i].identity;
1385            }
1386        }
1387    },
1388
1389    searchVersion: function (dataString) 
1390    {
1391        var index = dataString.indexOf(this.versionSearchString);
1392        if (index == -1) return;
1393        return parseFloat(dataString.substring(index+this.versionSearchString.length+1));
1394    },
1395
1396    dataBrowser: 
1397    [
1398        { string: navigator.userAgent, subString: "Chrome",  identity: "Chrome" },
1399        { string: navigator.userAgent, subString: "MSIE",    identity: "IE" },
1400        { string: navigator.userAgent, subString: "Trident/", identity: "IE" },
1401        { string: navigator.userAgent, subString: "Firefox", identity: "Firefox" },
1402        { string: navigator.userAgent, subString: "Safari",  identity: "Safari" },
1403        { string: navigator.userAgent, subString: "Opera",   identity: "Opera" },
1404    ]
1405
1406};
1407BrowserDetect.init();
1408
1409/* ========================================
1410    HOVER INTENT (includes.modules.module.script)
1411========================================*/
1412/*!
1413 * hoverIntent r7 // 2013.03.11 // jQuery 1.9.1+
1414 * http://cherne.net/brian/resources/jquery.hoverIntent.html
1415 *
1416 * You may use hoverIntent under the terms of the MIT license. Basically that
1417 * means you are free to use hoverIntent as long as this header is left intact.
1418 * Copyright 2007, 2013 Brian Cherne
1419 */
1420 
1421/* hoverIntent is similar to jQuery's built-in "hover" method except that
1422 * instead of firing the handlerIn function immediately, hoverIntent checks
1423 * to see if the user's mouse has slowed down (beneath the sensitivity
1424 * threshold) before firing the event. The handlerOut function is only
1425 * called after a matching handlerIn.
1426 *
1427 * // basic usage ... just like .hover()
1428 * .hoverIntent( handlerIn, handlerOut )
1429 * .hoverIntent( handlerInOut )
1430 *
1431 * // basic usage ... with event delegation!
1432 * .hoverIntent( handlerIn, handlerOut, selector )
1433 * .hoverIntent( handlerInOut, selector )
1434 *
1435 * // using a basic configuration object
1436 * .hoverIntent( config )
1437 *
1438 * @param  handlerIn   function OR configuration object
1439 * @param  handlerOut  function OR selector for delegation OR undefined
1440 * @param  selector    selector OR undefined
1441 * @author Brian Cherne <brian(at)cherne(dot)net>
1442 */
1443(function($) {
1444    $.fn.hoverIntent = function(handlerIn,handlerOut,selector) {
1445
1446        // default configuration values
1447        var cfg = {
1448            interval: 100,
1449            sensitivity: 7,
1450            timeout: 0
1451        };
1452
1453        if ( typeof handlerIn === "object" ) {
1454            cfg = $.extend(cfg, handlerIn );
1455        } else if ($.isFunction(handlerOut)) {
1456            cfg = $.extend(cfg, { over: handlerIn, out: handlerOut, selector: selector } );
1457        } else {
1458            cfg = $.extend(cfg, { over: handlerIn, out: handlerIn, selector: handlerOut } );
1459        }
1460
1461        // instantiate variables
1462        // cX, cY = current X and Y position of mouse, updated by mousemove event
1463        // pX, pY = previous X and Y position of mouse, set by mouseover and polling interval
1464        var cX, cY, pX, pY;
1465
1466        // A private function for getting mouse position
1467        var track = function(ev) {
1468            cX = ev.pageX;
1469            cY = ev.pageY;
1470        };
1471
1472        // A private function for comparing current and previous mouse position
1473        var compare = function(ev,ob) {
1474            ob.hoverIntent_t = clearTimeout(ob.hoverIntent_t);
1475            // compare mouse positions to see if they've crossed the threshold
1476            if ( ( Math.abs(pX-cX) + Math.abs(pY-cY) ) < cfg.sensitivity ) {
1477                $(ob).off("mousemove.hoverIntent",track);
1478                // set hoverIntent state to true (so mouseOut can be called)
1479                ob.hoverIntent_s = 1;
1480                return cfg.over.apply(ob,[ev]);
1481            } else {
1482                // set previous coordinates for next time
1483                pX = cX; pY = cY;
1484                // use self-calling timeout, guarantees intervals are spaced out properly (avoids JavaScript timer bugs)
1485                ob.hoverIntent_t = setTimeout( function(){compare(ev, ob);} , cfg.interval );
1486            }
1487        };
1488
1489        // A private function for delaying the mouseOut function
1490        var delay = function(ev,ob) {
1491            ob.hoverIntent_t = clearTimeout(ob.hoverIntent_t);
1492            ob.hoverIntent_s = 0;
1493            return cfg.out.apply(ob,[ev]);
1494        };
1495
1496        // A private function for handling mouse 'hovering'
1497        var handleHover = function(e) {
1498            // copy objects to be passed into t (required for event object to be passed in IE)
1499            var ev = jQuery.extend({},e);
1500            var ob = this;
1501
1502            // cancel hoverIntent timer if it exists
1503            if (ob.hoverIntent_t) { ob.hoverIntent_t = clearTimeout(ob.hoverIntent_t); }
1504
1505            // if e.type == "mouseenter"
1506            if (e.type == "mouseenter") {
1507                // set "previous" X and Y position based on initial entry point
1508                pX = ev.pageX; pY = ev.pageY;
1509                // update "current" X and Y position based on mousemove
1510                $(ob).on("mousemove.hoverIntent",track);
1511                // start polling interval (self-calling timeout) to compare mouse coordinates over time
1512                if (ob.hoverIntent_s != 1) { ob.hoverIntent_t = setTimeout( function(){compare(ev,ob);} , cfg.interval );}
1513
1514                // else e.type == "mouseleave"
1515            } else {
1516                // unbind expensive mousemove event
1517                $(ob).off("mousemove.hoverIntent",track);
1518                // if hoverIntent state is true, then call the mouseOut function after the specified delay
1519                if (ob.hoverIntent_s == 1) { ob.hoverIntent_t = setTimeout( function(){delay(ev,ob);} , cfg.timeout );}
1520            }
1521        };
1522
1523        // listen for mouseenter and mouseleave
1524        return this.on({'mouseenter.hoverIntent':handleHover,'mouseleave.hoverIntent':handleHover}, cfg.selector);
1525    };
1526})(jQuery);
1527
1528/* ========================================
1529    SUPERFISH (includes.modules.module.script)
1530========================================*/
1531/*
1532 * jQuery Superfish Menu Plugin
1533 * Copyright (c) 2013 Joel Birch
1534 *
1535 * Dual licensed under the MIT and GPL licenses:
1536 *	http://www.opensource.org/licenses/mit-license.php
1537 *	http://www.gnu.org/licenses/gpl.html
1538 */
1539(function ($) {
1540	"use strict";
1541
1542	var methods = (function () {
1543		// private properties and methods go here
1544		var c = {
1545				bcClass: 'sf-breadcrumb',
1546				menuClass: 'sf-js-enabled',
1547				anchorClass: 'sf-with-ul',
1548				menuArrowClass: 'sf-arrows'
1549			},
1550			ios = (function () {
1551				var ios = /iphone|ipad|ipod/i.test(navigator.userAgent.toLowerCase());
1552				if (ios) {
1553					// iOS clicks only bubble as far as body children
1554					$(window).load(function () {
1555						$('body').children().on('click', $.noop);
1556					});
1557				}
1558				return ios;
1559			})(),
1560			wp7 = (function () {
1561				var style = document.documentElement.style;
1562				return ('behavior' in style && 'fill' in style && /iemobile/i.test(navigator.userAgent));
1563			})(),
1564			toggleMenuClasses = function ($menu, o) {
1565				var classes = c.menuClass;
1566				if (o.cssArrows) {
1567					classes += ' ' + c.menuArrowClass;
1568				}
1569				$menu.toggleClass(classes);
1570			},
1571			setPathToCurrent = function ($menu, o) {
1572				return $menu.find('li.' + o.pathClass).slice(0, o.pathLevels)
1573					.addClass(o.hoverClass + ' ' + c.bcClass)
1574						.filter(function () {
1575							return ($(this).children(o.popUpSelector).hide().show().length);
1576						}).removeClass(o.pathClass);
1577			},
1578			toggleAnchorClass = function ($li) {
1579				$li.children('a').toggleClass(c.anchorClass);
1580			},
1581			toggleTouchAction = function ($menu) {
1582				var touchAction = $menu.css('ms-touch-action');
1583				touchAction = (touchAction === 'pan-y') ? 'auto' : 'pan-y';
1584				$menu.css('ms-touch-action', touchAction);
1585			},
1586			applyHandlers = function ($menu, o) {
1587				var targets = 'li:has(' + o.popUpSelector + ')';
1588
1589				if ( o.fire_event == 'click' ) {
1590					$menu
1591						.on('click.superfish', targets, over)
1592						.on('mouseleave.superfish', targets, out);
1593
1594				} else if ($.fn.hoverIntent && !o.disableHI) {
1595					$menu.hoverIntent(over, out, targets);
1596				}
1597				else {
1598					$menu
1599						.on('mouseenter.superfish', targets, over)
1600						.on('mouseleave.superfish', targets, out);
1601				}
1602				var touchevent = 'MSPointerDown.superfish';
1603				if (!ios) {
1604					touchevent += ' touchend.superfish';
1605				}
1606				if (wp7) {
1607					touchevent += ' mousedown.superfish';
1608				}
1609				$menu
1610					.on('focusin.superfish', 'li', over)
1611					.on('focusout.superfish', 'li', out)
1612					.on(touchevent, 'a', o, touchHandler);
1613			},
1614			touchHandler = function (e) {
1615				var $this = $(this),
1616					$ul = $this.siblings(e.data.popUpSelector);
1617
1618				if ($ul.length > 0 && $ul.is(':hidden')) {
1619					$this.one('click.superfish', false);
1620					if (e.type === 'MSPointerDown') {
1621						$this.trigger('focus');
1622					} else {
1623						$.proxy(over, $this.parent('li'))();
1624					}
1625				}
1626			},
1627			over = function () {
1628				var $this = $(this),
1629					o = getOptions($this);
1630				clearTimeout(o.sfTimer);
1631				$this.siblings().superfish('hide').end().superfish('show');
1632			},
1633			out = function () {
1634				var $this = $(this),
1635					o = getOptions($this);
1636				if (ios) {
1637					$.proxy(close, $this, o)();
1638				}
1639				else {
1640					if ( o.sfTimer ) {
1641						clearTimeout(o.sfTimer);
1642					}
1643					o.sfTimer = setTimeout($.proxy(close, $this, o), o.delay);
1644				}
1645			},
1646			close = function (o) {
1647				o.retainPath = ($.inArray(this[0], o.$path) > -1);
1648				this.superfish('hide');
1649
1650				if (!this.parents('.' + o.hoverClass).length) {
1651					o.onIdle.call(getMenu(this));
1652					if (o.$path.length) {
1653						$.proxy(over, o.$path)();
1654					}
1655				}
1656			},
1657			getMenu = function ($el) {
1658				return $el.closest('.' + c.menuClass);
1659			},
1660			getOptions = function ($el) {
1661				return getMenu($el).data('sf-options');
1662			};
1663
1664		return {
1665			// public methods
1666			hide: function (instant) {
1667				if (this.length) {
1668					var $this = this,
1669						o = getOptions($this);
1670					if (!o) {
1671						return this;
1672					}
1673					var not = (o.retainPath === true) ? o.$path : '',
1674						$ul = $this.find('li.' + o.hoverClass).add(this).not(not).removeClass(o.hoverClass).children(o.popUpSelector),
1675						speed = o.speedOut;
1676
1677					if (instant) {
1678						$ul.show();
1679						speed = 0;
1680					}
1681					o.retainPath = false;
1682					o.onBeforeHide.call(this, $ul);
1683					$ul.stop(true, true).animate(o.animationOut, speed, function () {
1684						var $this = $(this);
1685						o.onHide.call($this);
1686					});
1687				}
1688				return this;
1689			},
1690			show: function () {
1691				var o = getOptions(this);
1692				if (!o) {
1693					return this;
1694				}
1695				var $this = this.addClass(o.hoverClass),
1696					$ul = $this.children(o.popUpSelector);
1697
1698				o.onBeforeShow.call(this, $ul);
1699				$ul.stop(true, true).animate(o.animation, o.speed, function () {
1700					o.onShow.call(this, $ul);
1701				});
1702				return this;
1703			},
1704			destroy: function () {
1705				return this.each(function () {
1706					var $this = $(this),
1707						o = $this.data('sf-options'),
1708						$hasPopUp;
1709					if (!o) {
1710						return false;
1711					}
1712					$hasPopUp = $this.find(o.popUpSelector).parent('li');
1713					clearTimeout(o.sfTimer);
1714					toggleMenuClasses($this, o);
1715					toggleAnchorClass($hasPopUp);
1716					toggleTouchAction($this);
1717					// remove event handlers
1718					$this.off('.superfish').off('.hoverIntent');
1719					// clear animation's inline display style
1720					$hasPopUp.children(o.popUpSelector).attr('style', function (i, style) {
1721						return style.replace(/display[^;]+;?/g, '');
1722					});
1723					// reset 'current' path classes
1724					o.$path.removeClass(o.hoverClass + ' ' + c.bcClass).addClass(o.pathClass);
1725					$this.find('.' + o.hoverClass).removeClass(o.hoverClass);
1726					o.onDestroy.call($this);
1727					$this.removeData('sf-options');
1728				});
1729			},
1730			init: function (op) {
1731				return this.each(function () {
1732					var $this = $(this);
1733					if ($this.data('sf-options')) {
1734						return false;
1735					}
1736					var o = $.extend({}, $.fn.superfish.defaults, op),
1737						$hasPopUp = $this.find(o.popUpSelector).parent('li');
1738					o.$path = setPathToCurrent($this, o);
1739
1740					$this.data('sf-options', o);
1741
1742					toggleMenuClasses($this, o);
1743					toggleAnchorClass($hasPopUp);
1744					toggleTouchAction($this);
1745					applyHandlers($this, o);
1746
1747					$hasPopUp.not('.' + c.bcClass).superfish('hide', true);
1748
1749					o.onInit.call(this);
1750
1751					var iosnavfix_force = false;
1752					if ( o.fire_event == 'click' ) {
1753						iosnavfix_force = true; 
1754					}
1755
1756					$this.iosnavfix(iosnavfix_force);
1757				});
1758			}
1759		};
1760	})();
1761
1762	$.fn.superfish = function (method, args) {
1763		if (methods[method]) {
1764			return methods[method].apply(this, Array.prototype.slice.call(arguments, 1));
1765		}
1766		else if (typeof method === 'object' || ! method) {
1767			return methods.init.apply(this, arguments);
1768		}
1769		else {
1770			return $.error('Method ' +  method + ' does not exist on jQuery.fn.superfish');
1771		}
1772	};
1773
1774	$.fn.superfish.defaults = {
1775		popUpSelector: 'ul, .sf-mega', // within menu context
1776		hoverClass: 'sfHover',
1777		pathClass: 'overrideThisToUse',
1778		fire_event: 'hover',
1779		pathLevels: 1,
1780		delay: 800,
1781		animation: {opacity: 'show'},
1782		animationOut: {opacity: 'hide'},
1783		speed: 'normal',
1784		speedOut: 'fast',
1785		cssArrows: true,
1786		disableHI: false,
1787		onInit: $.noop,
1788		onBeforeShow: $.noop,
1789		onShow: $.noop,
1790		onBeforeHide: $.noop,
1791		onHide: $.noop,
1792		onIdle: $.noop,
1793		onDestroy: $.noop
1794	};
1795
1796	// soon to be deprecated
1797	$.fn.extend({
1798		hideSuperfishUl: methods.hide,
1799		showSuperfishUl: methods.show
1800	});
1801
1802})(jQuery);
1803
1804
1805/*!
1806 * iOS Nav Fix - Dropdown menu fix for iOS devices
1807 *
1808 * Version:  1.0
1809 * Released: 19-02-2013
1810 * Source:   http://github.com/Vheissu/IOSNavFix
1811 * Plugin:   Iosnavfix
1812 * Author:   Dwayne Charrington ([email protected])
1813 * Modified: Orkun Gursel ([email protected])
1814 * License:  MIT Licence 
1815 *           http://www.opensource.org/licenses/mit-license.php
1816 * 
1817 * Copyright (c) 2013 Dwayne Charrington.
1818 *
1819 */
1820;(function(w, $) {  
1821
1822	$.fn.iosnavfix = function( force ) {
1823
1824		return this.each(function() {
1825
1826			if ( isMobile() || force ) {
1827				var $this = $(this);
1828				var $list       = []; 
1829
1830				$("li", $this).each(function() {
1831					var $this       = $(this);
1832					var $parentLink = $("> a", $this);
1833
1834
1835					// If we have children
1836					if ($this.children('ul').length || $this.children('ol').length) {
1837
1838						// Set default clicked state
1839						$parentLink.data('clicked', false);
1840
1841						// When the link is clicked
1842						$parentLink.on("click", function(e) {
1843
1844							jQuery.each($list, function(k,v){
1845								if ( v.jquery && v != $parentLink ) {
1846									v.data('clicked', false);
1847								}
1848							});
1849
1850							// if we haven't already clicked, false
1851							if ($parentLink.data('clicked') == false) {
1852								// Inform everyone we've now clicked
1853								$parentLink.data('clicked', true);
1854
1855								$list.push( $parentLink );
1856
1857								// Prevent link being followed into next click
1858								return false;
1859							} else {
1860								// Reset link click state
1861								$parentLink.data('clicked', false);
1862
1863								// Allow link to be followed now
1864								return true;
1865							}
1866
1867						});
1868					}
1869				});
1870			}
1871
1872		});
1873
1874		/** 
1875		 * If a user is pretending to be an iOS device, too bad for them.
1876		 * As if you would imitate an iPad or iPhone for non-testing purposes.
1877		 *
1878		 * Anyway, this function will detect iOS user agents, simple.
1879		 */
1880		function isMobile() {
1881			if ( (navigator.userAgent.match(/iPhone/i)) || (navigator.userAgent.match(/iPod/i) ) || (navigator.userAgent.match(/iPad/i) )|| (navigator.userAgent.toLowerCase().match(/android/i) ) ) { return true; } else { return false; }
1882		}
1883
1884	}
1885
1886})(window, jQuery);
1887
1888/* ========================================
1889    IMAGELOADED (includes.modules.module.script)
1890========================================*/
1891/*!
1892 * imagesLoaded PACKAGED v3.0.4
1893 * JavaScript is all like "You images are done yet or what?"
1894 */
1895
1896(function(){"use strict";function e(){}function t(e,t){for(var n=e.length;n--;)if(e[n].listener===t)return n;return-1}var n=e.prototype;n.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},n.flattenListeners=function(e){var t,n=[];for(t=0;e.length>t;t+=1)n.push(e[t].listener);return n},n.getListenersAsObject=function(e){var t,n=this.getListeners(e);return n instanceof Array&&(t={},t[e]=n),t||n},n.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},n.on=n.addListener,n.addOnceListener=function(e,t){return this.addListener(e,{listener:t,once:!0})},n.once=n.addOnceListener,n.defineEvent=function(e){return this.getListeners(e),this},n.defineEvents=function(e){for(var t=0;e.length>t;t+=1)this.defineEvent(e[t]);return this},n.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},n.off=n.removeListener,n.addListeners=function(e,t){return this.manipulateListeners(!1,e,t)},n.removeListeners=function(e,t){return this.manipulateListeners(!0,e,t)},n.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},n.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},n.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],o=n.listener.apply(this,t||[]),(o===this._getOnceReturnValue()||n.once===!0)&&this.removeListener(e,s[r][i].listener);return this},n.trigger=n.emitEvent,n.emit=function(e){var t=Array.prototype.slice.call(arguments,1
1896);return this.emitEvent(e,t)},n.setOnceReturnValue=function(e){return this._onceReturnValue=e,this},n._getOnceReturnValue=function(){return this.hasOwnProperty("_onceReturnValue")?this._onceReturnValue:!0},n._getEvents=function(){return this._events||(this._events={})},"function"==typeof define&&define.amd?define(function(){return e}):"undefined"!=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.naturalWidth)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);
1897
1898/* ========================================
1899    UI (includes.modules.module.script)
1900========================================*/
1901;(function ( $, window, document, undefined ) {
1902
1903	// Create the defaults once
1904	var pluginName = "uiVerticalCenter",
1905		defaults = {};
1906
1907	// The actual plugin constructor
1908	function Plugin( element, options ) {
1909		this.element = element;
1910		this.options = $.extend( {}, defaults, options );
1911
1912		this._defaults = defaults;
1913		this._name = pluginName;
1914
1915		this.init();
1916	}
1917
1918	Plugin.prototype = {
1919
1920		init: function() {
1921			var element = jQuery(this.element);
1922			var images = element.find('img');
1923			var height = element.outerHeight();
1924
1925			element.css({'margin-top' : - (height / 2) }).attr('data-height', height );
1926			if ( images.length ) {
1927				images.imagesLoaded(function(){
1928					var height = element.outerHeight();
1929					element.css({'margin-top' : - (height / 2) });
1930				});
1931			}
1932
1933		},
1934
1935        calcHeight: function () {
1936            var that = jQuery(this.element);
1937
1938            var height =
1939                parseInt(that.css('margin-top'), 10) +
1940                parseInt(that.css('padding-top'), 10) +
1941                parseInt(that.css('border-top-width'), 10) +
1942                parseInt(that.height(), 10) +
1943                parseInt(that.css('border-bottom-width'), 10) +
1944                parseInt(that.css('padding-bottom'), 10) +
1945                parseInt(that.css('margin-bottom'), 10);
1946
1947            return height;
1948        }
1949
1950
1951	};
1952
1953	$.fn[pluginName] = function ( options ) {
1954		return this.each(function () {
1955			if (!$.data(this, "plugin_" + pluginName)) {
1956				$.data(this, "plugin_" + pluginName, new Plugin( this, options ));
1957			}
1958		});
1959	};
1960
1961})( jQuery, window, document );
1962
1963jQuery(document).ready(function(){
1964	var centerVertical = function(){
1965		jQuery('.ui--center-vertical').uiVerticalCenter();
1966	};
1967
1968	setTimeout(function(){
1969		centerVertical();
1970	}, 100 );
1971
1972	jQuery(window).resize( centerVertical );
1973	jQuery(window).load( centerVertical );	
1974
1975
1976});
1977
1978/* ========================================
1979    BOXED LAYOUT (includes.modules.module.script)
1980========================================*/
1981jQuery(document).ready(function(){
1982
1983	if( jQuery('body').hasClass('layout--boxed') ) {
1984		var calc_header_width = function(){
1985			var page_wrap_width = jQuery('#page-wrap').width();
1986			var header_container = jQuery('#header-container');
1987
1988			header_container.width( page_wrap_width );
1989			
1990		}
1991
1992		calc_header_width();
1993		jQuery(window).smartresize( calc_header_width );
1994
1995	}
1996
1997});
1998
1999/* ========================================
2000    CURRENT MENU (includes.modules.module.script)
2001========================================*/
2002jQuery(document).ready(function(){
2003	"use strict";
2004
2005	jQuery.fn.extend({
2006		/**
2007		 *	CloudFw Select Current Menu Item
2008		 *
2009		 *	@since 1.0
2010		 */
2011		selectCurrentMenu : function() {
2012
2013			jQuery.fn.extend({
2014
2015				/* Match Classes */
2016				matchClasses : function() {
2017
2018					//this.addClass('passed');
2019
2020					if ( this.is('.current-menu-item, .current-menu-ancestor, .current-menu-parent, .current_page_parent, .current_page_ancestor, .current_page_item') ) {
2021						if ( this.parents('.depth-0').length ) {
2022							this.parents('.depth-0').last().addClass('current-item-handler');
2023						} else {
2024							this.addClass('current-item-handler').addClass('current-sub-item');
2025						}
2026					}
2027					this.removeClass('current-menu-item current-menu-ancestor current-menu-parent current_page_parent current_page_ancestor current_page_item');
2028					return this;
2029				},
2030
2031				/* Loop Items */
2032				loopItems : function() {
2033
2034					if ( this.length ){
2035
2036						this.each(function(){
2037							var item = jQuery(this);
2038							item.matchClasses();
2039
2040							if ( item.children('.sub-menu').length ) {
2041
2042								var children = item.children('.sub-menu').children();
2043
2044								if ( !children.length ) {
2045									item.find('.ui--caret').remove();
2046									item.children('.sub-menu').remove();
2047								} else {
2048									children.loopItems();
2049								}
2050							}
2051
2052						});
2053
2054					}
2055
2056				},
2057
2058				/* Set Final */
2059				setCurrentItem : function() {
2060
2061					var currentItemClass = 'current-menu-item';
2062
2063					if ( this.find( '.current-item-handler' ).length ){
2064						if ( this.find( '.current-item-handler' ).is('.force-for-select') )
2065							this.find( '.current-item-handler.force-for-select' ).removeClass( 'current-item-handler' ).first().addClass( currentItemClass );
2066						else
2067							this.find( '.current-item-handler' ).removeClass( 'current-item-handler' ).first().addClass( currentItemClass );
2068					}
2069					/*else
2070						this.children().first().addClass( currentItemClass );*/
2071
2072				}
2073
2074
2075			});
2076
2077			/* Run the Plugin */
2078			return this.each(function() {
2079				var theMenu = jQuery(this);
2080				var menuItems = theMenu.children();
2081
2082				menuItems.loopItems();
2083				theMenu.setCurrentItem();
2084			});
2085		},
2086
2087		/**
2088		 *	CloudFw Prepare Menus
2089		 *
2090		 *	@since 1.0
2091		 */
2092		prepareMenu: function() {
2093			/* Run the Plugin */
2094			return this.each(function() {
2095				var theMenu = jQuery(this);
2096				var navMenuItems = theMenu.find('li');
2097
2098				navMenuItems.each(function(){
2099
2100					if ( jQuery(this).find('.sub-menu').length ) {
2101
2102						if ( !jQuery(this).hasClass('has-sub-menu') )
2103							jQuery(this)
2104								.addClass('has-sub-menu')
2105								.find('a')
2106								.first()
2107								.append('<span class="indicator"></span>');
2108
2109					}
2110
2111				});
2112
2113				/** Add class to first level navigation menu items */
2114				var navMenuFirstLevelItems = theMenu.children('ul > li.depth-0');
2115				var navMenuFirstLevelItemsLenght = navMenuFirstLevelItems.length;
2116				navMenuFirstLevelItems.each(function(itemNumber) {
2117					jQuery(this).addClass('asc-' + itemNumber++ ).addClass('desc-' + parseInt(navMenuFirstLevelItemsLenght - itemNumber, 10));
2118				});
2119
2120			});
2121
2122		}
2123
2124
2125	});
2126
2127	jQuery('#header-navigation').selectCurrentMenu();
2128
2129});
2130
2131/* ========================================
2132    FILL PARENT (includes.modules.module.script)
2133========================================*/
2134/*
2135 * jQuery Fill Parent
2136 * 
2137 * Author: Orkun Gursel 
2138 */
2139;(function ( $, window, document, undefined ) {
2140    "use strict";
2141
2142    var pluginName = 'fillParent',
2143        defaults = {
2144
2145        };
2146 
2147    function Plugin( element, options ) {
2148        this.element = element;
2149        this.options = $.extend( {}, defaults, options);
2150 
2151        this._defaults = defaults;
2152        this._name = pluginName;
2153 
2154        var that = this;
2155        this.init();
2156        jQuery(window).load(function(){
2157            that.init();
2158        });
2159        jQuery(window).smartresize(function(){
2160            that.init();
2161        });
2162    }
2163 
2164    Plugin.prototype = {
2165        init: function () {
2166
2167            var element = jQuery( this.element ),
2168                parent = element.parent();
2169
2170            var parentWidth = parent.width(); 
2171            var parentHeight = parent.height();
2172
2173            var elementWidth = element.attr('width');
2174            var elementHeight = element.attr('height');
2175
2176            if ( ! elementWidth ) {
2177                element.css({ width: '' });
2178                elementWidth = element.width();
2179            }
2180
2181            if ( ! elementHeight ) {
2182                element.css({ height: '' });
2183                elementHeight = element.height();
2184            }
2185
2186            var newsizes = this.fill( parentWidth, parentHeight, elementWidth, elementHeight ); 
2187
2188            element.css( newsizes ).addClass('ui--filled');
2189
2190            /*console.log( 'parentWidth: ' + parentWidth );
2191            console.log( 'parentHeight: ' + parentHeight );
2192            console.log( 'elementWidth: ' + elementWidth );
2193            console.log( 'elementHeight: ' + elementHeight );
2194            console.log( newsizes );*/
2195        }, 
2196
2197        fill: function( parentWidth, boxHeight, elementWidth, elementHeight ) {
2198            var out = {};
2199            var initW = elementWidth;
2200            var initH = elementHeight;
2201            var ratio = initH / initW;
2202
2203            elementWidth = parentWidth;
2204            elementHeight = parentWidth * ratio;
2205
2206            if(elementHeight < boxHeight){
2207                elementHeight = boxHeight;
2208                elementWidth = elementHeight / ratio;
2209            }
2210
2211            elementWidth = Math.round(elementWidth);
2212            elementHeight = Math.round(elementHeight);
2213
2214            out.width = elementWidth;
2215            out.height = elementHeight;
2216
2217            if( elementWidth > parentWidth ) {
2218                out.marginLeft = Math.round( (parentWidth - elementWidth) / 2 );
2219                out.marginTop = ''; 
2220            } else {    
2221                out.marginLeft = ''; 
2222                out.marginTop = Math.round( (boxHeight - elementHeight) / 2 );
2223            }
2224
2225            return out;
2226        }
2227
2228    };
2229 
2230    $.fn[pluginName] = function ( options ) {
2231        return this.each(function () {
2232            if (!$.data(this, 'plugin_' + pluginName)) {
2233                $.data(this, 'plugin_' + pluginName,
2234                new Plugin( this, options ));
2235            }
2236        });
2237    }
2238 
2239})( jQuery, window, document );
2240
2241/* ========================================
2242    FULL HEIGHT CONTAINER (includes.modules.module.script)
2243========================================*/
2244(function(){
2245
2246	jQuery(document).ready(function(){
2247
2248		var video_bg_page_height = function(){
2249			var win_height = win_height_alias = jQuery(window).height();
2250			var body = jQuery('body');
2251			var header = jQuery('#page-header');
2252			var titlebar = jQuery('#titlebar');
2253			var adminbar = jQuery('#wpadminbar');
2254			var total_content_height = 0;
2255
2256			var is_overlapping = body.hasClass('header-overlapping');
2257
2258			if( ! is_overlapping && header.length ) {
2259				var header_height = header.height();
2260				win_height = win_height - header_height;
2261				total_content_height += header_height;
2262			}
2263
2264			if( titlebar.length ) {
2265				var titlebar_height = titlebar.height();
2266				win_height = win_height - titlebar_height;
2267				total_content_height += titlebar_height;
2268			}
2269
2270			if( adminbar.length ) {
2271				var adminbar_height = adminbar.height();
2272				win_height = win_height - adminbar_height;
2273				total_content_height += adminbar_height;
2274			}
2275
2276			jQuery('.ui--section-content-v-center').css({
2277				'height': win_height > 0 ? win_height : win_height_alias
2278			});
2279
2280			/** Sticky Footer */
2281			if ( body.hasClass('sticky-footer') ) {
2282				var footer = jQuery('#page-wrap > footer'),
2283					footer_height = footer.height(),
2284					page_content = jQuery('#page-content');
2285
2286				page_content.css({'min-height': ''});
2287				var	page_content_height = page_content.outerHeight() - page_content.height() + 1;
2288
2289				if( footer.length ) {
2290
2291					var value = win_height_alias - (total_content_height + footer_height) - page_content_height;
2292					page_content.css({
2293						'min-height': value > 0 ? value : ''
2294					});
2295
2296				}
2297
2298			}
2299
2300		}
2301
2302		if ( jQuery('.ui--section-content-v-center').length || jQuery('body').hasClass('sticky-footer') ) {
2303			video_bg_page_height();
2304			jQuery(window).load( video_bg_page_height );
2305			jQuery(window).smartresize( video_bg_page_height, 20 );
2306		}
2307
2308		jQuery('.ui--video-background-video video, .ui--video-background-video iframe').fillParent();
2309	});
2310
2311})(jQuery);
2312
2313/* ========================================
2314    GLOBAL (includes.modules.module.script)
2315========================================*/
2316jQuery(document).ready(function(){
2317
2318	jQuery("a[data-rel^='prettyPhoto']").each(function(){
2319		var that = jQuery(this),
2320			href = that.attr('href');
2321
2322		var same_hrefs = jQuery('a[href^="'+ href +'"]').not(that);
2323
2324		if( same_hrefs.length ) {
2325			same_hrefs.each(function(){
2326				if (jQuery(this).attr('data-rel') == that.attr('data-rel')){
2327					jQuery(this).attr('data-rel', 'prettyPhoto');
2328				}
2329			});
2330		}
2331
2332	});
2333
2334
2335	jQuery("a[data-rel^='prettyPhoto']").CloudFwPrettyPhoto({
2336		theme: 'pp_envision',
2337		show_title: true,
2338		slideshow: false,
2339		social_tools: false,
2340		deeplinking: false,
2341		modal: false
2342	});
2343
2344});
2345
2346/* ========================================
2347    HASHCHANGE (includes.modules.module.script)
2348========================================*/
2349/*
2350 * jQuery hashchange event - v1.3 - 7/21/2010
2351 * http://benalman.com/projects/jquery-hashchange-plugin/
2352 * 
2353 * Copyright (c) 2010 "Cowboy" Ben Alman
2354 * Dual licensed under the MIT and GPL licenses.
2355 * http://benalman.com/about/license/
2356 */
2357(function($,e,b){var c="hashchange",h=document,f,g=$.event.special,i=h.documentMode,d="on"+c in e&&(i===b||i>7);function a(j){
2357j=j||location.href;return"#"+j.replace(/^[^#]*#?(.*)$/,"$1")}$.fn[c]=function(j){return j?this.bind(c,j):this.trigger(c)};$.fn[c].delay=50;g[c]=$.extend(g[c],{setup:function(){if(d){return false}$(f.start)},teardown:function(){if(d){return false}$(f.stop)}});f=(function(){var j={},p,m=a(),k=function(q){return q},l=k,o=k;j.start=function(){p||n()};j.stop=function(){p&&clearTimeout(p);p=b};function n(){var r=a(),q=o(m);if(r!==m){l(m=r,q);$(e).trigger(c)}else{if(q!==m){location.href=location.href.replace(/#.*/,"")+q}}p=setTimeout(n,$.fn[c].delay)}$('html').hasClass('ie')&&!d&&(function(){var q,r;j.start=function(){if(!q){r=$.fn[c].src;r=r&&r+a();q=$('<iframe tabindex="-1" title="empty"/>').hide().one("load",function(){r||l(a());n()}).attr("src",r||"javascript:0").insertAfter("body")[0].contentWindow;h.onpropertychange=function(){try{if(event.propertyName==="title"){q.document.title=h.title}}catch(s){}}}};j.stop=k;o=function(){return a(q.location.href)};l=function(v,s){var u=q.document,t=$.fn[c].domain;if(v!==s){u.title=h.title;u.open();t&&u.write('<script>document.domain="'+t+'"<\/script>');u.close();q.location.hash=v}}})();return j})()})(jQuery,this);
2358
2359jQuery(function(){
2360	"use strict";
2361
2362	jQuery(window).hashchange( function() {
2363
2364		var hash = location.hash.replace('#', '');
2365		/*if ( hash.match("^to:") ) {
2366			hash = hash.replace('to:', '');
2367			location.hash = '';
2368
2369			var toElement = jQuery( '#' + hash );
2370			if ( toElement.length ) {
2371				jQuery.smoothScroll({
2372					speed: 500,
2373					scrollTarget: '#' + hash,
2374					afterScroll: function() { location.hash = hash; }
2375				});
2376			}
2377
2378		} else */if ( hash ) {   
2379			jQuery('a[href$="' + hash + '"]').click(); 
2380		}
2381
2382	});
2383
2384	jQuery(window).hashchange();
2385
2386});
2387
2388/* ========================================
2389    LOADING (includes.modules.module.script)
2390========================================*/
2391var CloudFwLoaded = function( item ){
2392	if ( typeof item.jquery == 'undefined' )
2393		return false;
2394
2395	if ( item.hasClass('ui--loading') ) {
2396		item.removeClass('ui--loading');
2397		item.next('.ui--loading-progress').addClass('loaded');
2398
2399		//console.log(item.next('.ui--loading-progress'));
2400	}
2401
2402};
2403
2404/* ========================================
2405    MIDWAY (includes.modules.module.script)
2406========================================*/
2407/**
2408 * Midway.js
2409 * Version: 1.0
2410 * Author: Shipp Co. (Brandon Jacoby, Jordan Singer, Jeremy Goldberg)
2411 * Copyright (c) 2013 - Midway.  All rights reserved.
2412 * http://www.shipp.co/midway
2413 */
2414(function($) {
2415	eval(function(p,a,c,k,e,r){e=function(c){return c.toString(a)};if(!''.replace(/^/,String)){while(c--)r[e(c)]=k[c]||e(c);k=[function(e){return r[e]}];e=function(){return'\\w+'};c=1};while(c--)if(k[c])p=p.replace(new RegExp('\\b'+e(c)+'\\b','g'),k[c]);return p}('$(m).l(5(){4 c=$(\'.0\').1(\'6\',- +$(\'.0\').7()/2);4 d=$(\'.3\').1(\'8\',- +$(\'.3\').9()/2);c;d;$(".0").1({\'h\':\'f\',\'g\':\'e%\',\'i\':\'e%\'});$(j).k(5(){4 a=$(\'.0\').1(\'6\',- +$(\'.0\').7()/2);4 b=$(\'.3\').1(\'8\',- +$(\'.3\').9()/2);a;b})});',23,23,'centerHorizontal|css||centerVertical|var|function|marginLeft|width|marginTop|outerHeight|||||50|absolute|top|position|left|window|resize|ready|document'.split('|'),0,{}))
2416})(jQuery);
2417
2418/* ========================================
2419    PARALLAX (includes.modules.module.script)
2420========================================*/
2421(function($) {
2422    "use strict";
2423
2424    $(document).ready(function()
2425    {
2426    	$.cloudfw_utilities = $.cloudfw_utilities || {};
2427		$.cloudfw_utilities.supported	= {};
2428		$.cloudfw_utilities.supports	= (function() {
2429			var div		= document.createElement('div'),
2430				vendors	= ['Khtml', 'Ms', 'Moz', 'Webkit'];
2431
2432			return function(prop, vendor_overwrite)	{
2433				if ( div.style[prop] !== undefined  ) { return ""; }
2434				if (vendor_overwrite !== undefined) { vendors = vendor_overwrite; }
2435
2436				prop = prop.replace(/^[a-z]/, function(val) {
2437					return val.toUpperCase();
2438				});
2439
2440				var len	= vendors.length;
2441				while(len--) {
2442					if ( div.style[vendors[len] + prop] !== undefined ){
2443						return "-" + vendors[len].toLowerCase() + "-";
2444					}
2445				}
2446
2447				return false;
2448			};
2449
2450		}());
2451
2452		$.cloudfw_utilities.isMobile = /Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent) && 'ontouchstart' in document.documentElement;
2453
2454    	//activate parallax scrolling for backgrounds.
2455    	if( $.fn.cloudfw_parallax ) {
2456			$('.ui--parallax').cloudfw_parallax();
2457    	}
2458
2459    });
2460
2461	$.CloudFwParallaxElement  =  function(options, element) {
2462	    this.$el  	  	 = $( element ).addClass('active-parallax');
2463	    this.$win	  	 = $( window );
2464	    this.$parent  	 = this.$el.parent();
2465	    this.property	 = {};
2466	    this.isMobile 	 = $.cloudfw_utilities.isMobile;
2467	    this.ratio		 = this.$el.data('data-stellar-ratio') || 0.5;
2468	    this.transform   = document.documentElement.className.indexOf('csstransforms') !== -1 ? true : false;
2469	    this.transform3d = document.documentElement.className.indexOf('csstransforms3d') !== -1 ? true : false;
2470
2471	    if( $.cloudfw_utilities.supported.transition === undefined ){
2472			$.cloudfw_utilities.supported.transition = $.cloudfw_utilities.supports('transition');
2473		}
2474
2475	    this._init( options );
2476	}
2477
2478	$.CloudFwParallaxElement.prototype = {
2479
2480		_init: function( options )
2481    	{
2482    		var _self = this;
2483			/*if( _self.isMobile )
2484			{
2485				return; //disable parallax scrolling on mobile
2486			}*/
2487
2488			//fetch window constants
2489			this._fetch_properties();
2490			//this.$win.on("load resize make@2x",  $.proxy( _self._fetch_properties, _self));
2491			this.$win.load($.proxy( _self._fetch_properties, _self));
2492			this.$win.smartresize($.proxy( _self._fetch_properties, _self));
2493
2494			setTimeout(function(){
2495				_self._fetch_properties();
2496    		},1000);
2497
2498			//activate the scrolling
2499			setTimeout(function()
2500			{
2501    			_self.$win.on( 'scroll',  function(){ window.requestAnimationFrame( $.proxy( _self._parallax_scroll, _self) )} );
2502
2503    		},100);
2504		},
2505
2506		_fetch_properties: function()
2507		{
2508			this.property.offset 	= this.$parent.offset().top;
2509			this.property.wh 		= this.$win.height();
2510			this.property.height 	= this.$parent.outerHeight();
2511
2512			//set the height of the element based on the windows height, offset ratio and parent height
2513			this.$el.height(Math.ceil((this.property.wh * this.ratio) + this.property.height));
2514
2515			//re-position the element
2516			this._parallax_scroll();
2517		},
2518
2519		_parallax_scroll: function(e) {
2520    		var winTop		=  this.$win.scrollTop(),
2521    			winBottom	=  winTop + this.property.wh,
2522    			scrollPos 	= "0",
2523    			prop = {};
2524
2525    		if( this.property.offset < winBottom && winTop <= this.property.offset + this.property.height )
2526    		{
2527    			scrollPos = Math.round( (winBottom - this.property.offset) * this.ratio );
2528
2529    			if( this.transform3d ) {
2530    				prop[$.cloudfw_utilities.supported.transition+"transform"] = "translate3d(0px,"+ scrollPos +"px, 0px)";
2531    			} else if( this.transform ) {
2532    				prop[$.cloudfw_utilities.supported.transition+"transform"] = "translate(0px,"+ scrollPos +"px)";
2533    			} else {
2534    				prop["background-position"] = "0px "+ scrollPos +"px";
2535    			}
2536
2537	    		this.$el.css(prop);
2538    		}
2539    	}
2540	}
2541
2542
2543	$.fn.cloudfw_parallax = function(options){
2544
2545		return this.each(function(){
2546			var self = $.data( this, 'cloudfw_parallax' );
2547			if( ! self ) {
2548				self = $.data( this, 'cloudfw_parallax', new $.CloudFwParallaxElement( options, this ) );
2549			}
2550		});
2551	}
2552
2553}(jQuery));
2554
2555/* ========================================
2556    RESPONSIVE OPTIONS (includes.modules.module.script)
2557========================================*/
2558function detectDeviceViaPageWidth(){
2559	"use strict";
2560
2561	var device;
2562
2563	if ( Modernizr.mq('only all and (max-width: 767px)') ) {
2564		device = 'phone';
2565	}
2566	else if ( Modernizr.mq('only all and (min-width: 768px) and (max-width: 979px)') ) {
2567		device = 'tablet';
2568	}
2569	else {
2570		device = 'widescreen';
2571	}
2572
2573	if ( ! CloudFwOp.responsive ) {
2574		device = 'widescreen';
2575	}
2576
2577	return device;
2578
2579};
2580
2581var responsiveOptionsCallback = function(){
2582	"use strict";
2583
2584	var elements = jQuery("[data-responsive]");
2585	elements.each(function(){
2586		var that = jQuery(this);
2587		var options = {};
2588		var data_responsive = that.attr('data-responsive');
2589		var device = detectDeviceViaPageWidth();
2590
2591		if ( data_responsive ) {
2592			try {
2593				options = jQuery.parseJSON( data_responsive );
2594			} catch (e) {}
2595
2596			if ( options.replaceClass ) {
2597				jQuery.each( options.replaceClass, function( k,v ){
2598					var default_val = k,
2599						new_class = '';
2600
2601					if ( typeof v[ device ] != 'undefined' || v[ device ] !== null )
2602						new_class = v[ device ];
2603					else
2604						new_class = default_val;
2605
2606
2607					if ( new_class !== '' && new_class != default_val ) {
2608						that.removeClass( that.attr('data-replaced-class') ).removeClass( default_val ).addClass( new_class );
2609						that.attr('data-replaced-class', new_class);
2610					} else {
2611						var replaced_class = that.attr('data-replaced-class'); 
2612						if ( replaced_class )
2613							that.removeClass( replaced_class ).addClass( default_val );
2614
2615					}
2616
2617				});
2618			}
2619
2620			if ( options.css ) {
2621				jQuery.each( options.css, function( k,v ){
2622					var property = k,
2623						object = {};
2624
2625					object[ property ] = (typeof v[ device ] == 'undefined' || v[ device ] === null) ? 
2626										( (typeof v.widescreen != 'undefined' && v.widescreen !== null) ? v.widescreen : '' )
2627									: v[ device ];
2628
2629					that.css(object);
2630
2631				});
2632			}
2633
2634		}
2635
2636	});
2637
2638
2639};
2640
2641jQuery(document).ready(responsiveOptionsCallback);
2642jQuery(window).resize(responsiveOptionsCallback);
2643
2644
2645var prepareResponsiveFullwidthContainer = function(){
2646	"use strict";
2647
2648	var fullwidth_containers = jQuery('.fullwidth-container');
2649
2650	if ( fullwidth_containers.length ) {
2651
2652		var prepareResponsiveFullwidthContainer_Resize = function(){
2653
2654			var page_width = jQuery('body').innerWidth();
2655			if ( page_width <= 767 ) {
2656				fullwidth_containers.each(function(){
2657					var that = jQuery(this); 
2658					that.width( that.parent().width() );
2659				});
2660
2661			} else {
2662				fullwidth_containers.css({width: ''});
2663			}
2664
2665		}
2666		
2667		prepareResponsiveFullwidthContainer_Resize();
2668		jQuery(window).resize(prepareResponsiveFullwidthContainer_Resize);
2669
2670	}
2671};
2672jQuery(document).ready(prepareResponsiveFullwidthContainer);
2673
2674/**
2675 * Resizes fullwidth container by the page width
2676 * @return void
2677 */
2678var prepareResponsiveFullwidthContainerPage = function(){
2679	"use strict";
2680
2681	var fullwidth_contents = jQuery('.fullwidth-content');
2682
2683	if ( fullwidth_contents.length ) {
2684
2685		var prepareResponsiveFullwidthContainerPage_Resize = function(){
2686
2687			var page_width = jQuery('body').innerWidth();
2688			var content_width = jQuery('#page-content > .container').width();
2689
2690			if ( ! CloudFwOp.RTL ) {
2691				fullwidth_contents.css({
2692					'width': page_width + 1,
2693					'margin-left': 0 - (( page_width - content_width ) / 2) - 1,
2694					'margin-right': 0
2695				});
2696			} else {
2697				fullwidth_contents.css({
2698					'width': page_width + 1,
2699					'margin-right': 0 - (( page_width - content_width ) / 2) - 1,
2700					'margin-left': 0
2701				});
2702			}
2703		}
2704		
2705		prepareResponsiveFullwidthContainerPage_Resize();
2706		jQuery(window).resize(prepareResponsiveFullwidthContainerPage_Resize);
2707
2708	}
2709};
2710jQuery(document).ready(prepareResponsiveFullwidthContainerPage);
2711
2712
2713var parseResponsiveAttribute = function( data_responsive, selector, default_value ){
2714	"use strict";
2715
2716	var data = {};
2717
2718	if ( data_responsive ) {
2719		try {
2720			
2721			if ( typeof data_responsive != 'object' )
2722				data = jQuery.parseJSON( data_responsive );
2723
2724		} catch (e) {}
2725
2726		if ( typeof data[ selector ] != 'undefined' || data[ selector ] !== null )
2727			return data[ selector ];
2728		else
2729			return default_value;
2730	}
2731
2732};
2733
2734/* ========================================
2735    SCROLLTO (includes.modules.module.script)
2736========================================*/
2737jQuery(function(){
2738	"use strict";
2739
2740	var getParam = function (name,url){
2741	  name = name.replace(/[\[]/,"\\\[").replace(/[\]]/,"\\\]");
2742	  var regexS = ""+name+"[\:|\=]([^&#]*)";
2743	  var regex = new RegExp( regexS );
2744	  var results = regex.exec( url );
2745	  return ( results == null ) ? "" : results[1];
2746	}
2747
2748	var listenHash = function( hash, that ){
2749		if ( hash == '' || hash == '#' ) {
2750			return true;
2751		}
2752
2753		/** Scroll */
2754		var to = getParam( 'to', hash );
2755		if ( typeof to !== undefined && to != '' ) {
2756
2757			var anchor = jQuery('#' + to);
2758			if ( anchor.length === 0 ) {
2759				return true;
2760			}
2761
2762			if ( to == 'top' && anchor.length === 0 ) {
2763				var scrollTo = '0';
2764			} else {
2765				var scrollTo = anchor.offset().top;
2766				var offset = getParam( 'offset', hash );
2767
2768				if ( typeof offset !== undefined && offset !== '' ) {
2769					scrollTo = scrollTo + parseInt(offset, 10);
2770					if ( scrollTo < 0 ) {
2771						scrollTo = 0;
2772					}
2773				}
2774
2775			}
2776
2777			jQuery('html, body').stop( true ).animate({scrollTop: scrollTo}, 500, function () {/**window.location.hash = id;*/});
2778
2779			var update_hash = getParam( 'update', hash );
2780			if ( typeof update_hash !== undefined && update_hash == 'true' ) {
2781				return true;
2782			}
2783
2784			return false;
2785
2786		}
2787
2788		/** Sidepanel */
2789		var sidepanel = getParam( 'sidepanel', hash );
2790		if ( typeof sidepanel !== undefined && sidepanel != '' ) {
2791			jQuery( document ).trigger( "openSidePanel", [ sidepanel ] );
2792			return false;
2793		}
2794
2795		return true;
2796
2797	}
2798
2799	jQuery("[href^='#']").click(function() {
2800		var that = jQuery(this),
2801			hash = that.attr('href').replace('#', '');
2802
2803		return listenHash( hash, that );
2804	});
2805
2806	jQuery(window).on('load hashchange',function(){
2807		var hash = location.hash.replace('#', '');
2808		listenHash( hash, undefined );
2809	});
2810
2811});
2812
2813/* ========================================
2814    TOPBAR (includes.modules.module.script)
2815========================================*/
2816jQuery(document).ready(function(){
2817
2818	if ( jQuery.isFunction( jQuery.fn.superfish ) ) {
2819
2820		var topbar_menu = jQuery('.ui--custom-menu', '#top-bar');
2821		var topbar_menu_custom_animation_speed = topbar_menu.attr('data-animation-speed');
2822
2823		topbar_menu.superfish({
2824			hoverClass: 'hover',
2825			cssArrows: false,
2826			delay: 500,
2827			speed: topbar_menu_custom_animation_speed || 50,
2828			speedOut: topbar_menu_custom_animation_speed || 50
2829		});
2830	}
2831
2832
2833	var search_form = jQuery('#widget--search', '#top-bar'),
2834		toggle 		= search_form.find('a'),
2835		input 		= search_form.find('input'),
2836		form 		= search_form.find('.ui--search-form'),
2837		cssanimations = jQuery('html').hasClass('cssanimations'); 
2838
2839
2840	toggle.click(function(e){
2841		e.preventDefault();
2842		input.focus();
2843
2844	});
2845
2846	input.bind('focus', function(){
2847		if( cssanimations )
2848			search_form.addClass('state--open');
2849		else
2850			form.stop(1).animate({'width': 150});
2851		
2852		//toggle.addClass('ui--gradient-primary').removeClass('ui--gradient-grey');
2853
2854	});
2855
2856	input.bind('blur', function(){
2857		if( cssanimations )
2858			search_form.removeClass('state--open');
2859		else
2860			form.stop(1).animate({'width': 0});
2861		
2862		//toggle.removeClass('ui--gradient-primary').addClass('ui--gradient-grey');
2863	});
2864
2865});
2866
2867/* ========================================
2868    PANEL (includes.modules.module.side_panel)
2869========================================*/
2870jQuery(document).ready(function(){
2871	"use strict";
2872
2873	var side_panel_handlers = jQuery('.ui--side-panel'),
2874		side_panel          = jQuery('#side-panel'),
2875		side_panel_items    = jQuery('#side-panel').children('div'),
2876		html               = jQuery('html'),
2877		listener           = false;
2878
2879	if ( side_panel.length && side_panel_handlers.length ) {
2880
2881		var side_panel_close_listener = function(){
2882			listener = true;
2883
2884			jQuery('#main-container').click(function(){
2885				html.removeClass('side-panel-open');
2886			});
2887
2888			jQuery('#ui--side-panel-close-button').click(function(){
2889				html.removeClass('side-panel-open');
2890			});
2891		}
2892
2893		var side_panel_toggle = function( target ){
2894
2895			if ( ! html.hasClass('side-panel-open') ) {
2896
2897				setTimeout( function() {
2898					side_panel.show();
2899					side_panel_items.hide();
2900
2901					if ( target ) {
2902						side_panel_items.filter('#' + target).show();
2903					} else {
2904						side_panel_items.first().show();
2905					}
2906
2907					jQuery('body, html').animate({scrollTop:0}, '500', 'swing', function() {
2908						html.addClass('side-panel-open');
2909					});
2910
2911				}, 25 );
2912
2913			} else {
2914				html.removeClass('side-panel-open');
2915			}
2916
2917			if ( ! listener ) {
2918				side_panel_close_listener();
2919			}
2920
2921		}
2922
2923		side_panel_handlers.bind('click', function(e){
2924			e.preventDefault();
2925			side_panel_toggle( jQuery(this).attr('data-target') );
2926		});
2927
2928		jQuery( document ).on( "openSidePanel", {}, function( event, target ) {
2929			side_panel_toggle( target );
2930		});
2931		
2932	}
2933
2934});
2935
2936/* ========================================
2937    UNIFORM (includes.modules.module.uniform)
2938========================================*/
2939jQuery(document).ready(function(){
2940	"use strict";
2941
2942	if ( ! CloudFwOp.uniform_elements ) {
2943		return true;
2944	}
2945
2946	var CloudFw_Uniform = function( wrapper ){
2947
2948		if( jQuery('html').hasClass('old-browser') )
2949			return true;
2950
2951		if ( ! wrapper )
2952			wrapper = null;
2953		else {
2954			if ( typeof wrapper.jquery == 'undefined' )
2955				wrapper = jQuery( wrapper );
2956
2957			if ( ! wrapper.length )
2958				return true;
2959		}
2960
2961		/**
2962		 *	Select
2963		 */
2964		jQuery("select", wrapper).each(function(){
2965			var that = jQuery(this);
2966
2967			if ( that.css('display') == 'none' ) {
2968				return true;
2969			}
2970
2971			if ( that.hasClass('no-uniform') ) {
2972				return true;
2973			}
2974		
2975			if ( CloudFwOp.disable_gravity_uniform_select ) {
2976				if ( that.hasClass('gfield_select') ) {
2977					return true;
2978				}
2979			}
2980
2981			if ( CloudFw_jQueried('cloudfw-select', that) ) {
2982				return true;
2983			}
2984
2985			if ( that.attr('multiple') ) {
2986				return true;
2987			}
2988
2989			var ui_wrapper = jQuery('<span/>').addClass('ui--select-wrapper ui--box ui--gradient ui--gradient-grey').addClass( that.attr('data-wrapper-classes') );
2990	        var resize_callback = function(){
2991	        	var margin = that.css({'margin': ''}).css('margin');
2992	        	var width = that.css({'width': ''}).css('width');
2993
2994	        	ui_wrapper.css({'margin': margin});
2995	        	ui_wrapper.css({'width': width});
2996
2997	        }
2998	        resize_callback();
2999
3000			that.wrap( ui_wrapper );
3001
3002			var	title = jQuery('<span/>').addClass('ui--select-title');
3003			that.before( title );
3004
3005			var	arrow = jQuery('<i/>
3005').addClass('ui--icon icon fontawesome-angle-down ui--select-arrow');
3006			that.before( arrow );
3007
3008
3009			var change_callback = function() {
3010	        	var val = that.find(':selected').first().text();
3011
3012	        	if ( val == '' ) {
3013	        		var default_title = that.attr('data-default-title'); 
3014	        		if ( default_title )
3015	        			var val = default_title; 
3016	        	}
3017
3018	        	title.text(val);
3019	        }
3020
3021	        jQuery(document).delegate( that, 'change', change_callback);
3022	        change_callback();
3023
3024	        that.bind('focus', function(){
3025	        	that.parent().addClass('active');
3026	        });
3027
3028	        that.bind('blur', function(){
3029	        	that.parent().removeClass('active');
3030	        });
3031
3032	        if ( that.attr('data-init') )
3033	        	that.change();
3034
3035			
3036
3037		});
3038		
3039
3040	} 	
3041
3042	CloudFw_Uniform();
3043	jQuery(document).on('ajaxSuccess',CloudFw_Uniform);
3044
3045});
3046
3047/* ========================================
3048    WOOCOMMERCE (includes.modules.module.woocommerce)
3049========================================*/
3050jQuery(document).ready(function(){
3051
3052	jQuery( '.woocommerce-tabs' ).each( function() {
3053		var hash		= window.location.hash,
3054			url			= window.location.href,
3055			tabs		= jQuery( this ),
3056			tabs_offset	= tabs.offset().top;
3057
3058		if ( hash.toLowerCase().indexOf( "comment-" ) >= 0 ) {
3059			jQuery('ul.ui--tabs-titles li.reviews_tab a', tabs ).click();
3060		    
3061		    jQuery('html, body').animate({
3062		        scrollTop: tabs_offset
3063		    }, 2000);
3064
3065		} else if ( url.indexOf( "comment-page-" ) > 0 || url.indexOf( "cpage=" ) > 0 ) {
3066			jQuery('ul.ui--tabs-titles li.reviews_tab a', tabs ).click();
3067
3068		    jQuery('html, body').animate({
3069		        scrollTop: tabs_offset
3070		    }, 2000);
3071
3072		}
3073	});
3074
3075	jQuery( 'a.woocommerce-review-link' ).click( function() {
3076		jQuery('ul.ui--tabs-titles li.reviews_tab a', jQuery( '.woocommerce-tabs' ) ).click();
3077
3078	    jQuery('html, body').animate({
3079	        scrollTop: jQuery( '.woocommerce-tabs' ).offset().top
3080	    }, 2000);
3081
3082		return true;
3083	});
3084
3085});
3086
3087/* ========================================
3088    FLEXSLIDER (includes.sliders.flex_slider)
3089========================================*/
3090jQuery(document).ready(function(){
3091
3092	jQuery('.flexslider-navigation-prev').click(function(){
3093		var that = jQuery(this);
3094		var slider = that.parents('.flexslider-wrapper').first().find('.flexslider');
3095
3096		slider.flexslider("prev");
3097	});
3098
3099
3100	jQuery('.flexslider-navigation-next').click(function(){
3101		var that = jQuery(this);
3102		var slider = that.parents('.flexslider-wrapper').first().find('.flexslider');
3103
3104		slider.flexslider("next");
3105	});
3106
3107
3108});
3109
3110jQuery(window).load(function(){
3111	jQuery('.flexslider .flex-control-paging li a').html('<div class="ui--bullets"><div class="ui--bullets-color ui--accent-gradient"></div></div>');
3112});
3113

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.