PageSourceSearch

https://my3dtwin.com/wp-content/themes/multicorp/assets/frontend/js/main.js

js my3dtwin.com collected 2026-10-07 02:58:20 UTC 91,734 bytes, 3,260 lines download raw bytes

1(function($) {
2	"use strict";
3
4	/* *********************************************************************************************************************
5	 * Global namespace "ish"
6	 */
7	if (ish == null || typeof(ish) !== "object") {
8		var ish = {}
9	}
10
11
12	/* *********************************************************************************************************************
13	 * Global variables
14	 */
15	var logo;
16	var nav;
17	var mainNav;
18	var topNav;
19	var WAIT_INTERVAL = 100;
20	var BREAKINGPOINT = 768;
21	var RESPONSIVE = true;
22	var skillz;
23	var onepage_sections;
24	var onepage_current;
25	var chartz;
26	var counters;
27	var floated_areas_opened = false;
28	var ie11;
29
30	var sidenav_opened;
31	var sidenavWidth;
32	var sidenavSize;
33	var sidenavSizeType;
34	var sidenavDel = 250;
35	var sidenav_flBtn;
36
37	var isFullNav = true;
38	var FullNavBreakingPoint;
39
40	var isFullHeaderBar = true;
41	var FullHeaderBarBreakingPoint;
42
43	var boxed_padding = 60;
44
45	var top_nav_resp_menu_btn = 'Open menu';
46
47	var $container;
48
49	if (typeof ishyoboy_fe_globals !== 'undefined') {
50		if (typeof ishyoboy_fe_globals.IYB_RESPONSIVE !== 'undefined') {
51			RESPONSIVE = ishyoboy_fe_globals.IYB_RESPONSIVE;
52		}
53		if (typeof ishyoboy_fe_globals.IYB_BREAKINGPOINT !== 'undefined') {
54			BREAKINGPOINT = ishyoboy_fe_globals.IYB_BREAKINGPOINT;
55		}
56	}
57
58
59	/* *********************************************************************************************************************
60	 * After resize function
61	 */
62	var waitForFinalEvent = (function () {
63		var timers = {};
64		return function (callback, ms, uniqueId) {
65			if (!uniqueId) {
66				uniqueId = "Don't call this twice without a uniqueId";
67			}
68			if (timers[uniqueId]) {
69				clearTimeout(timers[uniqueId]);
70			}
71			timers[uniqueId] = setTimeout(callback, ms);
72		};
73	})();
74
75
76	/* *********************************************************************************************************************
77	 * jQuery Ready - Activate everything
78	 */
79	jQuery(document).ready(function ($) {
80
81		// Detect IE
82		jQuery.browser = {};
83		(function () {
84			jQuery.browser.msie = false;
85			jQuery.browser.version = 0;
86			if (navigator.userAgent.match(/MSIE ([0-9]+)\./)) {
87				jQuery.browser.msie = true;
88				jQuery.browser.version = RegExp.$1
89			}
90		})();
91
92		ie11 = !!window.MSStream;
93		// Detect browser != IE
94		jQuery.browser.mozilla = /mozilla/.test(navigator.userAgent.toLowerCase()) && !/webkit/.test(navigator.userAgent.toLowerCase());
95		jQuery.browser.webkit = /webkit/.test(navigator.userAgent.toLowerCase());
96		jQuery.browser.opera = /opera/.test(navigator.userAgent.toLowerCase());
97
98		// Global variables ------------------------------------------------------------------------------------------------
99		mainNav = jQuery('.ish-ph-main_nav').find('ul');
100		topNav = jQuery('.ish-top_nav_container').find('ul');
101
102		// Call the rest ---------------------------------------------------------------------------------------------------
103		ish.activate_sticky_navigation();
104		ish.activate_header_resize();
105		ish.activate_header_bar_resize();
106		ish.activate_main_navigation();
107		ish.activate_side_navigation();
108		ish.activate_header_bar_navigation();
109		ish.activate_breadcrumbs();
110		ish.activate_floated_areas();
111		ish.activate_smooth_scroll();
112		ish.activate_back_to_top_link();
113		ish.activate_onepage_menu();
114		ish.activate_skillbars();
115		ish.activate_portfolio_preloader();
116		ish.activate_portfolio_3dcube();
117		ish.activate_portfolio_filter();
118		ish.activate_portfolio_packery();
119		ish.activate_portfolio_ie_no_3d();
120		ish.activate_gallery_packery();
121		ish.activate_dynamic_parallax();
122		ish.activate_shortcode_slidable();
123		ish.activate_tooltips();
124		ish.activate_blog_packery();
125		ish.activate_iframe_embed_video_heigh_fix();
126		ish.activate_ish_like_it();
127		ish.activate_vunit();
128		ish.activate_fancybox();
129		ish.activate_text_separator_size_fix();
130		ish.activate_accordions();
131		ish.activate_accordions_filter();
132		ish.activate_tabs();
133		ish.activate_last_shape_footer();
134		ish.activate_masonry_blog_responsive_class();
135		ish.activate_masonry_blog_preloader();
136		ish.activate_scroll_on_resize();
137		ish.activate_charts();
138		ish.activate_counters();
139
140		jQuery(window).resize();
141		jQuery(window).scroll();
142
143	});
144
145	/* *********************************************************************************************************************
146	 * jQuery Load - Deactivate Pre-loader
147	 */
148	jQuery(window).load(function () {
149
150		// Do not add code here. This event triggers after ALL JavaScripts have loaded
151		ish.deactivate_site_preloader();
152
153	});
154
155	/* *****************************************************************************************************************
156	 * jQuery Unload - Activate Pre-loader
157	 */
158	jQuery(window).bind('beforeunload', function () {
159
160		// Do not add code here. This event triggers before user navigates away from current site
161		ish.activate_site_preloader();
162
163	});
164
165
166	/* *****************************************************************************************************************
167	 * function_exists() definition
168	 */
169	function function_exists(name) {
170		return ( 'function' === eval('typeof ish.' + name) );
171	}
172
173
174	/* *****************************************************************************************************************
175	 * ISH pluggable functions
176	 */
177
178
179	// Sticky nav ******************************************************************************************************
180	if (!function_exists('activate_sticky_navigation')) {
181		ish.activate_sticky_navigation = function () {
182
183			if (jQuery('.ish-sticky-on').length > 0) {
184				var header = jQuery('.ish-sticky-on .ish-part_header');
185				var headerHeight = iyb_globals.header_height;
186				var headerStickyHeight = iyb_globals.sticky_height + 'px';
187				var lastScrollTop = 0;
188				var isSticky = false;
189				var header_bar = jQuery('.ish-part_header_bar');
190				var header_bar_height = ( header_bar.length > 0 ) ? header_bar.height() : 0;
191				var nav_css_position_switch = 0;
192
193				var responsive_sticky_on = !( jQuery('.ish-sticky_resp-off').length > 0);
194
195				jQuery(window).scroll(function () {
196					var scrollPos = jQuery(this).scrollTop();
197
198					var is_boxed_layout = ( jQuery('.ish-boxed').length > 0 );
199
200					var scroll_break = ( header_bar_height > 0 ) ? header_bar_height : ( headerHeight / 2 );
201
202					// Boxed version top padding
203					if ( is_boxed_layout ) {
204						scroll_break += boxed_padding;
205						nav_css_position_switch = boxed_padding;
206
207						if ( jQuery(window).width() < iyb_globals.page_width ) {
208							scroll_break -= boxed_padding;
209							nav_css_position_switch = 0;
210						}
211					}
212
213					// Fix if admin bar present and on screen width < 600px
214					if ( ( jQuery('#wpadminbar').length > 0 ) && ( jQuery(window).width() <= 600 ) ){
215						scroll_break = ( header_bar_height > 0 ) ? ( header_bar_height + 46 ) : ( headerHeight / 2 );
216						nav_css_position_switch = scroll_break;
217					}
218
219					//alert( responsive_sticky_on );
220
221					/* Fix horizontal scroll of position fixed header
222					 jQuery(window).scroll(function(){
223					 jQuery('.ish-sticky-scrolling').css('left', 0 - jQuery(this).scrollLeft());
224					 });
225					 */
226
227					if ( !RESPONSIVE || ( responsive_sticky_on || jQuery(window).width() > BREAKINGPOINT )) {
228
229						if (scrollPos > lastScrollTop) {
230							// Scroll down
231
232							// Fix header position if no top bar present
233							if ( is_boxed_layout && ( 0 == header_bar_height) && (scrollPos > nav_css_position_switch) ) {
234								header.css('position', 'fixed');
235
236								var wpadminbar = jQuery('#wpadminbar');
237
238								if ( wpadminbar.length > 0 ){
239									header.css('top', wpadminbar.outerHeight() );
240								} else {
241									header.css('top', 0 );
242								}
243
244							}
245
246
247							if (scrollPos > scroll_break) {
248								// Remove general scrolldown class
249								header.addClass('ish-sticky-scrolling');
250
251								// Animate header height
252								header.find('.ish-row_inner').css('height', headerStickyHeight);
253
254								isSticky = true;
255							}
256						} else {
257							// Scroll top
258
259							// Fix header position if no top bar present
260							if ( is_boxed_layout && ( 0 == header_bar_height) && (scrollPos <= nav_css_position_switch) ) {
261								header.css('position', '');
262								header.css('top', '');
263							}
264
265							if (scrollPos <= scroll_break) {
266								// Remove general scrolldown class
267								header.removeClass('ish-sticky-scrolling');
268
269								// Animate header height
270								header.find('.ish-row_inner').css('height', headerHeight);
271							}
272						}
273					}
274
275					lastScrollTop = scrollPos;
276
277					// console.log(headerHeight);
278				});
279			}
280
281		}
282	}
283
284	// Check header menu length ----------------------------------------------------------------------------------------
285	if ( ! function_exists( 'activate_header_resize' ) ) {
286		ish.activate_header_resize = function (){
287
288			if ( jQuery('.ish-ph-main_nav').length > 0 ) {
289
290				jQuery(window).resize(function() {
291					waitForFinalEvent(function(){
292
293						ish.do_header_resize_check();
294
295					}
295, WAIT_INTERVAL, "HeaderMenuResize");
296				});
297
298			}
299
300		}
301	}
302
303	// Check header menu length ----------------------------------------------------------------------------------------
304	if ( ! function_exists( 'do_header_resize_check' ) ) {
305		ish.do_header_resize_check = function (){
306			var _main_nav = jQuery('.ish-ph-main_nav');
307			var _logo = jQuery('.ish-ph-logo');
308			var _logo_width = ( _logo.length > 0 ) ? _logo.width() : 0;
309			var _tagline = jQuery('.ish-ph-wp_tagline');
310			var _tagline_width = ( _tagline.length > 0 ) ? _tagline.width() : 0;
311			var _nav_width = _main_nav.width();
312
313			if ( true == isFullNav ) {
314
315				if ( ( _nav_width + 15 ) > ( jQuery('.ish-part_header > .ish-row > .ish-row_inner').width() - _logo_width - _tagline_width ) ) {
316
317					// Hide main wp nav
318					jQuery('.ish-ph-main_nav .ish-ph-mn-main_nav').css({
319						'display': 'none'
320					});
321
322					// Show responsive button navigation
323					jQuery('.ish-ph-main_nav .ish-ph-mn-resp_nav.ish-ph-mn-hidden').css({
324						'max-width': '100%',
325						'position': 'relative',
326						'display': 'table-cell',
327						'vertical-align': 'middle'
328					});
329
330					isFullNav = false;
331					FullNavBreakingPoint = jQuery(window).width();
332				}
333			}
334			else {
335				if ( jQuery(window).width() > ( FullNavBreakingPoint + 10 ) ) {
336					isFullNav = true;
337
338					// Hide responsive button navigation
339					jQuery('.ish-ph-main_nav .ish-ph-mn-resp_nav.ish-ph-mn-hidden').css({
340						'display': 'none'
341					});
342
343					// Show main wp nav
344					jQuery('.ish-ph-main_nav .ish-ph-mn-main_nav').css({
345						'display': 'table-cell'
346					});
347				}
348			}
349		}
350	}
351
352
353	// Check header bar menu length ----------------------------------------------------------------------------------------
354	if ( ! function_exists( 'activate_header_bar_resize' ) ) {
355		ish.activate_header_bar_resize = function (){
356
357			if ( jQuery('.ish-top_nav').length > 0 ) {
358
359				jQuery(window).resize(function() {
360					waitForFinalEvent(function(){
361
362						ish.do_header_bar_resize_check();
363
364					}, WAIT_INTERVAL, "HeaderBarMenuResize");
365				});
366
367			}
368
369		}
370	}
371
372	// Check header bar menu length ----------------------------------------------------------------------------------------
373	if ( ! function_exists( 'do_header_bar_resize_check' ) ) {
374		ish.do_header_bar_resize_check = function (){
375
376			var _top_nav = jQuery('.ish-top_nav');
377			var _top_nav_width = _top_nav.width();
378
379			var _hb_socials = jQuery('.ish-hb-social');
380
381			var _hb_socials_width = ( _hb_socials.length > 0) ? _hb_socials.width() : 0;
382
383			if ( true == isFullHeaderBar ) {
384				if ( ( _top_nav_width + 15 ) > ( jQuery('.ish-part_header_bar > .ish-row > .ish-row_inner').width() - _hb_socials_width  ) ) {
385
386					// Hide original nav
387					jQuery('.ish-top_nav_container .ish-top_nav').css({
388						'display': 'none'
389					});
390
391					// Show responsive button navigation
392					jQuery('.ish-top_nav_container .ish-phb-resp_nav.ish-phb-hidden').css({
393						'max-width': '100%',
394						'position': 'relative',
395						'display': 'table-cell',
396						'vertical-align': 'middle'
397					});
398
399					isFullHeaderBar = false;
400					FullHeaderBarBreakingPoint = jQuery(window).width();
401				}
402			}
403			else {
404				if ( jQuery(window).width() > ( FullHeaderBarBreakingPoint + 10 ) ) {
405					isFullHeaderBar = true;
406
407					// Hide responsive button navigation
408					jQuery('.ish-top_nav_container .ish-phb-resp_nav.ish-phb-hidden').css({
409						'display': 'none'
410					});
411
412					// Show main wp nav
413					jQuery('.ish-top_nav_container .ish-top_nav').css({
414						'display': 'table-cell'
415					});
416				}
417			}
418		}
419	}
420
421	// MultipleDropDown main navigation --------------------------------------------------------------------------------
422	if (!function_exists('activate_main_navigation')) {
423		ish.activate_main_navigation = function () {
424
425			if (mainNav.length > 0) {
426				mainNav.multipleDropDown();
427			}
428
429		}
430	}
431
432
433	// Floated menu ----------------------------------------------------------------------------------------------------
434	if (!function_exists('activate_side_navigation')) {
435		ish.activate_side_navigation = function () {
436
437			if (jQuery('.ish-sidenav').length > 0) {
438				//var ishBody = jQuery('.ish-body');
439				var flMenu = jQuery('.ish-sidenav');
440				sidenav_flBtn = jQuery('a[href="#sidenav"]');
441				var closeBtn = jQuery('.ish-sidenav-close');
442				sidenav_opened = false;
443				sidenavWidth = iyb_globals.sidenav_width;
444
445				// sidenav width px vs %
446				if (sidenavWidth.indexOf('px') > 0) {
447					sidenavSizeType = 'px';
448					sidenavSize = sidenavWidth.replace('px', '');
449				}
450				else if (sidenavWidth.indexOf('%') > 0) {
451					sidenavSizeType = '%';
452					sidenavSize = sidenavWidth.replace('%', '');
453				}
454
455				// Height of sidenav -> horizontal scroll
456				jQuery(window).resize(function () {
457					flMenu.css({
458						'height': jQuery(window).height()
459					});
460				});
461
462				// Open sidenav
463				sidenav_flBtn.click(function () {
464					ish.open_sidenav();
465					ish.do_text_separator_size_fix();
466					return false;
467				});
468
469
470				// Close sidenav
471				closeBtn.click(function () {
472					if (sidenav_opened) {
473						ish.close_sidenav();
474					}
475
476					return false;
477				});
478
479				// Close on ESC
480				jQuery(document).keyup(function (e) {
481					if (sidenav_opened) {
482						if (e.keyCode == 27) {
483							var isExp = jQuery('.ish-a-expandable');
484							var isSearch = jQuery('.ish-a-search');
485
486							if (isExp.length > 0 && isSearch.length > 0) {
487								if (( !isExp.hasClass('ish-opened') ) && ( !isSearch.hasClass('ish-opened') )) {
488									ish.close_sidenav();
489								}
490							}
491							else if (isExp.length > 0) {
492								if (!isExp.hasClass('ish-opened')) {
493									ish.close_sidenav();
494								}
495							}
496							else if (isSearch.length > 0) {
497								if (!isSearch.hasClass('ish-opened')) {
498									ish.close_sidenav();
499								}
500							}
501						}
502					}
503				});
504			}
505		}
506	}
507
508	// MultipleDropDown header bar navigation --------------------------------------------------------------------------------
509	if (!function_exists('activate_header_bar_navigation')) {
510		ish.activate_header_bar_navigation = function () {
511
512			if ( topNav.length > 0 ) {
513				topNav.multipleDropDown();
514			}
515
516		}
517	}
518
519	// Breadcrumbs animation -------------------------------------------------------------------------------------------
520	if (!function_exists('activate_breadcrumbs')) {
521		ish.activate_breadcrumbs = function () {
522
523			var bc = jQuery('.ish-pt-taglines-right');
524
525			if ( bc.length > 0 ) {
526				bc.hover(
527					function() {
528						// MOUSE ENTER
529						if ( jQuery(window).width() > BREAKINGPOINT ) {
530							jQuery('.ish-pt-taglines-left').stop(true, true).fadeTo( 300, 0.1 );
531						}
532					},
533					function() {
534						// MOUSE LEAVE
535						if ( jQuery(window).width() > BREAKINGPOINT ) {
536							jQuery('.ish-pt-taglines-left').stop(true, true).fadeTo( 300, 1 );
537						}
538					}
539				)
540			}
541
542		}
543	}
544
545	// Open sidenav function
546	if ( ! function_exists( 'open_sidenav' ) ) {
547		ish.open_sidenav = function () {
548
549			jQuery('body').addClass('ish-sidenav-opened').css('overflow-x', 'hidden');
550
551			if ( ! sidenav_opened ) {
552
553				var flMenu = jQuery('.ish-sidenav');
554				//var ishBody = jQuery('.ish-body');
555				//var header = jQuery('.ish-sticky-on .ish-part_header');
556
557				// Left
558				if (flMenu.hasClass('ish-sn_left')) {
559
560					// Slide menu from left to right
561					flMenu.show().css({
562						'left': '-' + sidenavSize + sidenavSizeType
563					}).animate({
564						'left': 0
565					}, sidenavDel);
566
567					//ishBody.animate({'right': '-' + sidenavSize + sidenavSizeType}, sidenavDel);
568					flMenu.animate({'left': '0'}, sidenavDel);
569					/*jQuery('.ish-back_to_top').animate({
570					 'right': -sidenavSize + sidenavSizeType,
571					 'margin-left': '10px'
572					 }, sidenavDel);*/
573
574					// Unboxed
575					if (jQuery('.ish-sticky-on').length > 0) {
576						/*header.css({'right': header.position().left}).animate({'right': header.position().left - Number(sidenavSize) + sidenavSizeType}, sidenavDel, function () {
577						 // Center sticky nav in boxed version on resize
578						 if (jQuery('.ish-boxed').length > 0 && flMenu.is(':visible')) {
579						 jQuery(window).resize(function () {
580						 header.css({'right': ( ( jQuery(window).width() - header.width() ) / 2 ) - jQuery('.ish-sidenav').outerWidth()});
581						 }).resize();
582						 }
583
584						 sidenav_opened = true;
585						 });*/
586
587						sidenav_opened = true;
588					}
589				}
590				// Right - default
591				else {
592
593					// Slide menu from right to left
594					flMenu.show().css({
595						'right': '-' + sidenavSize + sidenavSizeType
596					}).animate({
597						'right': 0
598					}, sidenavDel);
599
600					//ishBody.animate({'left': '-' + sidenavSize + sidenavSizeType}, sidenavDel);
601					flMenu.animate({'right': '0'}, sidenavDel);
602					/*jQuery('.ish-back_to_top').animate({
603					 'right': sidenavSize + sidenavSizeType,
604					 'margin-right': '10px'
605					 }, sidenavDel);*/
606
607					// Unboxed
608					if (jQuery('.ish-sticky-on').length > 0) {
609						/*header.css({'left': header.position().left}).animate({'left': header.position().left - Number(sidenavSize) + sidenavSizeType}, sidenavDel, function () {
610						 // Center sticky nav in boxed version on resize
611						 if (jQuery('.ish-boxed').length > 0 && flMenu.is(':visible')) {
612						 jQuery(window).resize(function () {
613						 header.css({'left': ( ( jQuery(window).width() - header.width() ) / 2 ) - jQuery('.ish-sidenav').outerWidth()});
614						 }).resize();
615						 }
616
617						 sidenav_opened = true;
618						 });*/
619
620						sidenav_opened = true;
621					}
622				}
623
624				sidenav_opened = true;
625
626				sidenav_flBtn.addClass('ish-active');
627			}
628			else {
629				ish.close_sidenav();
630			}
631		}
632	}
633
634
635	// Close sidenav function
636	if ( ! function_exists( 'close_sidenav' ) ) {
637		ish.close_sidenav = function () {
638
639			if (sidenav_opened) {
640
641				var flMenu = jQuery('.ish-sidenav');
642				//var ishBody = jQuery('.ish-body');
643				//var header = jQuery('.ish-sticky-on .ish-part_header');
644
645				// Left
646				if (flMenu.hasClass('ish-sn_left')) {
647
648					if (jQuery(window).width() < 560) {
649						// Slide menu from right to left
650						flMenu.animate({
651							'left': -Number(sidenavSize * 2) + sidenavSizeType
652						}, sidenavDel);
653					}
654					else {
655						// Slide menu from right to left
656						flMenu.animate({
657							'left': -sidenavSize + sidenavSizeType
658						}, sidenavDel);
659					}
660
661					//ishBody.animate({'right': '0'}, sidenavDel);
662					flMenu.animate({'right': '-' + sidenavSize + sidenavSizeType}, sidenavDel);
663					/*jQuery('.ish-back_to_top').animate({'right': 10}, sidenavDel, function () {
664					 jQuery('body').css('overflow-x', 'auto');
665					 });*/
666
667					if (jQuery('.ish-sticky-on').length > 0) {
668						/*header.animate({'right': ( jQuery(window).width() - header.width() ) / 2}, sidenavDel, function () {
669						 // Center sticky nav in boxed version on resize
670						 if (jQuery('.ish-boxed').length > 0 && flMenu.is(':hidden')) {
671						 jQuery(window).resize(function () {
672						 header.css({'right': ( jQuery(window).width() - header.width() ) / 2});
673						 }).resize();
674						 }
675
676						 jQuery('body').removeClass('ish-sidenav-opened');
677						 });*/
678
679						jQuery('body').removeClass('ish-sidenav-opened');
680					}
681				}
682				// Right - default
683				else {
684					if (jQuery(window).width() < 560) {
685						// Slide menu from right to left
686						flMenu.stop().animate({
687							'right': -Number(sidenavSize * 2) + sidenavSizeType
688						}, sidenavDel);
689					}
690					else {
691						// Slide menu from right to left
692						flMenu.stop().animate({
693							'right': -sidenavSize + sidenavSizeType
694						}, sidenavDel);
695					}
696
697					//ishBody.animate({'left': '0'}, sidenavDel);
698					/*jQuery('.ish-back_to_top').animate({'right': 10}, sidenavDel, function () {
699					 jQuery('body').css('overflow-x', 'auto');
700					 });*/
701
702					if (jQuery('.ish-sticky-on').length > 0) {
703						/*header.animate({'left': ( jQuery(window).width() - header.width() ) / 2}, sidenavDel, function () {
704						 // Center sticky nav in boxed version on resize
705						 if (jQuery('.ish-boxed').length > 0 && flMenu.is(':hidden')) {
706						 jQuery(window).resize(function () {
707						 header.css({'left': ( jQuery(window).width() - header.width() ) / 2});
708						 }).resize();
709						 }
710
711						 jQuery('body').removeClass('ish-sidenav-opened');
712						 });*/
713
714						jQuery('body').removeClass('ish-sidenav-opened');
715					}
716				}
717
718				sidenav_flBtn.removeClass('ish-active');
719				sidenav_opened = false;
720			}
721		}
722	}
723
724
725// Floated areas - (search, expandable, resp menu) ---------------------------------------------------------------------
726	if ( ! function_exists( 'activate_floated_areas' ) ) {
727		ish.activate_floated_areas = function () {
728
729			// Create resp menu if not exist
730			if ( jQuery('.ish-ph-mn-be_resp').length == 0 ) {
731				jQuery('.ish-ph-main_nav .ish-ph-mn-main_nav').clone().appendTo('body').addClass('ish-ph-mn-be_resp ish-a-respnav').hide();
732			}
733
734			// Create close button for resp menu if not exist
735			if ( jQuery('.ish-ph-mn-be_resp-close').length == 0 ) {
736				jQuery('.ish-ph-mn-be_resp').append('<a href="#close" class="ish-ph-mn-be_resp-close ish-icon-cancel"></a>');
737			}
738
739			// Create Header Bar's resp menu if not exist
740			if ( jQuery('.ish-phb-be_resp').length == 0 ) {
741				if ( jQuery('.ish-top_nav_container .ish-top_nav').length > 0 ){
742					jQuery('.ish-top_nav_container .ish-top_nav').clone().appendTo('body').addClass('ish-phb-be_resp ish-a-phb-respnav').hide();
743				}
744
745				// Create close button for header bar's resp menu if not exist
746				if ( jQuery('.ish-phb-be_resp-close').length == 0 ) {
747					jQuery('.ish-phb-be_resp').append('<a href="#phb-close" class="ish-phb-be_resp-close ish-icon-cancel"></a>');
748				}
749
750			}
751
752			// Variables
753			var areas = jQuery('.ish-a-search, .ish-a-expandable, .ish-a-respnav, .ish-a-phb-respnav');
754			var opens = jQuery('a[href="#search"], a[href="#expandable"], a[href="#respnav"], a[href="#phb-respnav"]');
755			var closes = jQuery('.ish-ps-searchform_close, .ish-pe-close, .ish-ph-mn-be_resp-close, .ish-phb-be_resp-close');
756			floated_areas_opened = false;
757			var del = 150; // If you change this, please change also the value on the line with comment "RESP_NAV_CLOSE_DURATION"
758
759
760			// Open areas
761			opens.click(function() {
762				if ( ! floated_areas_opened ) {
763					var _this = jQuery(this);
764					var _who = _this.attr('href').replace('#', '');
765
766					jQuery('.ish-a-' + _who).fadeIn(del, function() {
767						// Wait until end of fadein
768						setTimeout(function() {
769							// Focus on search field
770							if ( _who == "search" ) {
771								jQuery('.ish-a-search input[type="text"]').focus();
772							}
773
774							// Fix body & make scrollable only floated area
775							jQuery('body').css('overflow', 'hidden');
776							jQuery('.ish-a-' + _who).css('overflow-y', 'scroll').addClass('ish-opened');
777
778						}, del);
779					});
780
781					// Must re-check all visible lined separators widths again
782					ish.do_text_separator_size_fix();
783
784					floated_areas_opened = true;
785				}
786
787				return false;
788			});
789
790			// Close areas
791			closes.click(function() {
792				closeAllAreas();
793				return false;
794			});
795
796			// Close on ESC
797			jQuery(document).keyup(function(e) {
798				if ( floated_areas_opened ) {
799					if (e.keyCode == 27) {
800						closeAllAreas();
801					}
802				}
803			});
804
805
806
807			// Close all areas
808			function closeAllAreas() {
809				// Disable scroll for floated area and make scrollable body
810				areas
811					.css('overflow-y', 'hidden')
812					.fadeOut(del, function() {
813						jQuery('body').css({ 'overflow-y': 'auto' });
814						areas.removeClass('ish-opened');
815					});
816
817				floated_areas_opened = false;
818			}
819
820		}
821	}
822
823
824// HTML5 placeholder ---------------------------------------------------------------------------------------------------
825	if ( ! function_exists( 'activate_html5_placeholders' ) ) {
826		ish.activate_html5_placeholders = function () {
827
828			if( !isPlaceholder() ) {
829				var placeholder = jQuery('[placeholder]');
830
831				placeholder.focus(function() {
832					var input = jQuery(this);
833
834					if ( input.val() == input.attr('placeholder') ) {
835						input.val('').removeClass('placeholder');
836					}
837				}).blur(function() {
838					var input = jQuery(this);
839
840					if ( input.val() == '' || input.val() == input.attr('placeholder') ) {
841						input.addClass('placeholder').val( input.attr('placeholder') );
842					}
843				}).blur();
844
845				placeholder.parents('form').submit(function() {
846					jQuery(this).find('[placeholder]').each(function() {
847						var input = jQuery(this);
848
849						if ( input.val() == input.attr('placeholder') ) {
850							input.val('');
851						}
852					});
853				});
854			}
855
856			// Check if placeholder is supported -----------------------------------------------------------------------------------
857			function isPlaceholder() {
858				var inp = document.createElement('input');
859				return ('placeholder' in inp);
860			}
861
862		}
863	}
864
865
866// Smooth scroll -------------------------------------------------------------------------------------------------------
867	if ( ! function_exists( 'activate_smooth_scroll' ) ) {
868		ish.activate_smooth_scroll = function (){
869
870			jQuery('.ish-smooth_scroll, .ish-ph-mn-main_nav a, .ish-sc_icon a[href*="#"], .ish-sc_svg_icon a[href*="#"], .ish-sc_button[href*="#"], .widget_nav_menu a, .ish-sc_menu a').smoothScrollAnchor();
871
872		}
873	}
874
875
876// Back to top link ----------------------------------------------------------------------------------------------------
877	if ( ! function_exists( 'activate_back_to_top_link' ) ) {
878		ish.activate_back_to_top_link = function (){
879
880			var fixedTop = jQuery('.ish-back_to_top');
881			var del = 250;
882
883			jQuery(window).scroll(function() {
884				if ( jQuery(window).scrollTop() > 150 ) {
885					fixedTop.fadeIn(del);
886				}
887				else {
888					fixedTop.fadeOut(del);
889				}
890			});
891		}
892	}
893
894// Text Separator fix ---------------------------------------------------------------------------------------------
895	if ( ! function_exists( 'do_text_separator_size_fix' ) ) {
896		ish.do_text_separator_size_fix = function (){
897
898			// remove line and change white-space if title is too long
899			var lined = jQuery('.ish-sc_text_separator');
900
901			if ( lined.length > 0 ) {
902				lined.each(function() {
903					var self = jQuery(this);
904
905					var textwidth = parseInt(self.textWidth());
906					var selfwidth = parseInt(self.parent().width());
907
908					if ( selfwidth > 0 ) {
909						if (textwidth >= selfwidth) {
910							self.css('white-space', 'normal').find('.ish-line:visible').addClass('ish-hidden').hide();
911						}
912						else {
913							self.css('white-space', 'nowrap').find('.ish-line.ish-hidden').show();
914						}
915					}
916				});
917			}
918
919		}
920	}
921
922// Text Separator breaking ---------------------------------------------------------------------------------------------
923	if ( ! function_exists( 'activate_text_separator_size_fix' ) ) {
924		ish.activate_text_separator_size_fix = function (){
925
926			// remove line and change white-space if title is too long
927			var lined = jQuery('.ish-sc_text_separator');
928
929			if ( lined.length > 0 ) {
930				jQuery(window).resize(function() {
931					waitForFinalEvent(function(){
932
933						ish.do_text_separator_size_fix();
934
935					}
935, WAIT_INTERVAL, "LinedTitlesResize");
936				});
937			}
938
939		}
940	}
941
942
943// Skill bars ----------------------------------------------------------------------------------------------------------
944	if ( ! function_exists( 'activate_skillbars' ) ) {
945		ish.activate_skillbars = function (){
946
947			skillz = jQuery('.ish-sc_skills');
948			if ( skillz.length > 0 ) {
949				skillz = skillz.find('div div');
950
951				jQuery(window).scroll(function() {
952					animateSkillBars();
953				});
954			}
955
956		}
957	}
958
959// Skill bars animation
960	function animateSkillBars(){
961
962		skillz.find('span:in-viewport').each(function() {
963			var me = jQuery(this);
964			if (!me.hasClass('done')){
965				var skillzDel = 1000;
966				me.addClass('done').animate({
967					'width': me.attr('data-count') + '%',
968					'opacity': '1'
969				}, skillzDel);
970
971			}
972		});
973
974	}
975
976// OnePage menu --------------------------------------------------------------------------------------------------------
977
978	if ( ! function_exists( 'activate_onepage_menu' ) ) {
979		ish.activate_onepage_menu = function (){
980
981			onepage_sections = jQuery('.wpb_row[id]');
982			if ( onepage_sections.length > 0 ) {
983				jQuery(window).scroll(function() {
984					ish.highlight_onepage_menu();
985				});
986			}
987
988		}
989	}
990
991// Highlight OnePage Menu Sections
992	if ( ! function_exists( 'highlight_onepage_menu' ) ) {
993		ish.highlight_onepage_menu = function (){
994			var fold = jQuery(window).height() + jQuery(window).scrollTop();
995			var top = jQuery(window).scrollTop();
996			var offset = 0;
997			var sticky_nav = jQuery('.ish-sticky-scrolling');
998			var wpadminbar = jQuery('#wpadminbar');
999
1000			if ( wpadminbar.length > 0 ){
1001				offset = offset - ( -1 * wpadminbar.outerHeight() );
1002			}
1003
1004			if ( sticky_nav.length > 0 ){
1005				offset = offset - ( -1 * sticky_nav.outerHeight() );
1006			}
1007
1008			onepage_sections.each(function() {
1009				var me = jQuery(this);
1010				var is_below = fold <= me.offset().top - offset;
1011				var is_above = top >= me.offset().top + me.height() - offset;
1012
1013				if ( !is_above && !is_below ){
1014					var me_id = me.attr('id');
1015					if ( onepage_current != me_id ){
1016						onepage_current = me_id;
1017
1018						jQuery('.ish-ph-mn-main_nav li').removeClass('ish-op-active');
1019						jQuery('.ish-ph-mn-main_nav a[href*="#' + me_id + '"]').each(function(){
1020
1021							var this_link = jQuery(this);
1022							var current_url = window.location.href.split("#");
1023							var this_href = this_link.attr("href").split("#");
1024							if ( current_url[0] == this_href[0] ){
1025								this_link.parent().addClass('ish-op-active');
1026							}
1027
1028						});
1029
1030					}
1031					return false;
1032				}
1033
1034			});
1035		}
1036	}
1037
1038// Portfolio 3d cube----------------------------------------------------------------------------------------------------
1039	if ( ! function_exists( 'activate_portfolio_3dcube' ) ) {
1040		ish.activate_portfolio_3dcube = function (){
1041
1042			var cube = jQuery('[class*="ish-p-3dcube-"]');
1043
1044			if ( cube.length > 0 ) {
1045				jQuery(window).resize(function(){
1046					cube.each(function() {
1047						calculate3dcube(jQuery(this));
1048					});
1049				});
1050			}
1051
1052		}
1053	}
1054
1055// Calculate 3d cube attributes
1056	function calculate3dcube(cube) {
1057
1058		/*var a = jQuery('[class*="ish-p-3dcube-"] a');
1059		 var p3dType = jQuery('[class*="ish-p-3dcube-"]');
1060		 var pitem = p3dType.find('.ish-p-item');*/
1061		var a = cube.find('a');
1062		var p3dType = cube;
1063		var pitem = p3dType.find('.ish-p-item');
1064
1065		// Common definitions top / bottom
1066		if ( p3dType.hasClass('ish-p-3dcube-top') || p3dType.hasClass('ish-p-3dcube-bottom') ) {
1067			pitem.each(function() {
1068				var _this = jQuery(this), _height = _this.height() / 2;
1069
1070				var def1_1 = 'translateZ( -' + _height + 'px )', def1_2 = '50% ' + _height + 'px )';
1071				_this.css({ '-webkit-transform': def1_1, 'transform': def1_1, '-webkit-transform-origin:': def1_2, 'transform-origin:': def1_2 });
1072
1073				var def2 = 'translateZ( ' + _height + 'px )';
1074				_this.find('.ish-p-img').css({ '-webkit-transform': def2, 'transform': def2 });
1075			});
1076
1077			a.hover(function() {
1078			}, function() {
1079				var _this = jQuery(this), _height = _this.height() / 2;
1080
1081				var def1 = 'rotateX(0deg) translateZ( -' + _height + 'px )';
1082				_this.find('.ish-p-item').css({ '-webkit-transform': def1, 'transform': def1 });
1083
1084				// FF fix unhover z-index
1085				if ( jQuery.browser.mozilla ) _this.css( 'z-index', '98' );
1086			});
1087		}
1088
1089		// Top
1090		if ( p3dType.hasClass('ish-p-3dcube-top') ) {
1091			pitem.each(function() {
1092				var _this = jQuery(this), _height = _this.height() / 2;
1093
1094				var def3 = 'rotateX(-90deg) translateY( ' + _height + 'px )';
1095				_this.find('.ish-p-overlay').css({ '-webkit-transform': def3, 'transform': def3 });
1096			});
1097
1098			a.hover(function() {
1099				var _this = jQuery(this), _height = _this.height() / 2;
1100
1101				var def1 = 'rotateX(90deg) translateY( -' + _height + 'px )';
1102				_this.find('.ish-p-item').css({ '-webkit-transform': def1, 'transform': def1 });
1103			}, function() {});
1104		}
1105
1106		// Bottom
1107		if ( p3dType.hasClass('ish-p-3dcube-bottom') ) {
1108			pitem.each(function() {
1109				var _this = jQuery(this), _height = _this.height() / 2;
1110
1111				var def3 = 'rotateX(90deg) translateY( ' + _height + 'px ) translateZ( ' + _height*2 + 'px )';
1112				_this.find('.ish-p-overlay').css({ '-webkit-transform': def3, 'transform': def3 });
1113			});
1114
1115			a.hover(function() {
1116				var _this = jQuery(this), _height = _this.height() / 2;
1117
1118				var def1 = 'rotateX(-90deg) translateY( ' + _height + 'px )';
1119				_this.find('.ish-p-item').css({ '-webkit-transform': def1, 'transform': def1 });
1120			}, function() {});
1121		}
1122
1123		// Common definitions left / right
1124		if ( p3dType.hasClass('ish-p-3dcube-left') || p3dType.hasClass('ish-p-3dcube-right') ) {
1125			pitem.each(function() {
1126				var _this = jQuery(this), _width = _this.width() / 2;
1127
1128				var def1_1 = 'translateZ( -' + _width + 'px )', def1_2 = '50% ' + _width + 'px )';
1129				_this.css({ '-webkit-transform': def1_1, 'transform': def1_1, '-webkit-transform-origin:': def1_2, 'transform-origin:': def1_2 });
1130
1131				var def2 = 'translateZ( ' + _width + 'px )';
1132				_this.find('.ish-p-img').css({ '-webkit-transform': def2, 'transform': def2 });
1133			});
1134
1135			a.hover(function() {
1136			}, function() {
1137				var _this = jQuery(this), _width = _this.width() / 2;
1138
1139				var def1 = 'rotateX(0deg) translateZ( -' + _width + 'px )';
1140				_this.find('.ish-p-item').css({ '-webkit-transform': def1, 'transform': def1 });
1141
1142				// FF fix unhover z-index
1143				if ( jQuery.browser.mozilla ) _this.css( 'z-index', '98' );
1144			});
1145		}
1146
1147		// Left
1148		if ( p3dType.hasClass('ish-p-3dcube-left') ) {
1149			pitem.each(function() {
1150				var _this = jQuery(this), _width = _this.width() / 2;
1151
1152				var def3 = 'rotateY(90deg) translateZ( ' + _width + 'px )';
1153				_this.find('.ish-p-overlay').css({ '-webkit-transform': def3, 'transform': def3 });
1154			});
1155
1156			a.hover(function() {
1157				var _this = jQuery(this), _width = _this.width() / 2;
1158
1159				var def1 = 'rotateY(-90deg) translateX( -' + _width + 'px )';
1160				_this.find('.ish-p-item').css({ '-webkit-transform': def1, 'transform': def1 });
1161			}, function() {});
1162		}
1163
1164		// Right
1165		if ( p3dType.hasClass('ish-p-3dcube-right') ) {
1166			pitem.each(function() {
1167				var _this = jQuery(this), _width = _this.width() / 2;
1168
1169				var def3 = 'rotateY(-90deg) translateZ( ' + _width + 'px )';
1170				_this.find('.ish-p-overlay').css({ '-webkit-transform': def3, 'transform': def3 });
1171			});
1172
1173			a.hover(function() {
1174				var _this = jQuery(this), _width = _this.width() / 2;
1175
1176				var def1 = 'rotateY(90deg) translateX( ' + _width + 'px )';
1177				_this.find('.ish-p-item').css({ '-webkit-transform': def1, 'transform': def1 });
1178			}, function() {});
1179		}
1180
1181		// Common definitions left / right inverse
1182		if ( p3dType.hasClass('ish-p-3dcube-inverse-left') || p3dType.hasClass('ish-p-3dcube-inverse-right') ) {
1183			pitem.each(function() {
1184				var _this = jQuery(this), _width = _this.width() / 2;
1185
1186				var def1_1 = 'translateZ( -' + _width + 'px )', def1_2 = '50% ' + _width + 'px )';
1187				_this.css({ '-webkit-transform': def1_1, 'transform': def1_1, '-webkit-transform-origin:': def1_2, 'transform-origin:': def1_2 });
1188
1189				var def2 = 'translateZ( ' + _width + 'px )';
1190				_this.find('.ish-p-img').css({ '-webkit-transform': def2, 'transform': def2 });
1191			});
1192
1193			a.hover(function() {
1194			}, function() {
1195				var _this = jQuery(this);
1196				// FF fix unhover z-index
1197				if ( jQuery.browser.mozilla ) _this.css( 'z-index', '98' );
1198			});
1199		}
1200
1201		// Left
1202		if ( p3dType.hasClass('ish-p-3dcube-inverse-left') ) {
1203			pitem.each(function() {
1204				var _this = jQuery(this), _width = _this.width() / 2;
1205
1206				var def1 = 'rotateY(90deg) translateX( ' + _width + 'px )';
1207				_this.css({ '-webkit-transform': def1, 'transform': def1 });
1208
1209				var def2 = 'rotateY(-90deg) translateZ( ' + _width + 'px )';
1210				_this.find('.ish-p-overlay').css({ '-webkit-transform': def2, 'transform': def2 });
1211			});
1212
1213			a.hover(function() {
1214				var _this = jQuery(this), _width = _this.width() / 2;
1215
1216				var def1 = 'rotateY(0deg) translateZ( -' + _width + 'px )';
1217				_this.find('.ish-p-item').css({ '-webkit-transform': def1, 'transform': def1 });
1218			}, function() {
1219				var _this = jQuery(this), _width = _this.width() / 2;
1220
1221				var def1 = 'rotateY(90deg) translateX( ' + _width + 'px )';
1222				_this.find('.ish-p-item').css({ '-webkit-transform': def1, 'transform': def1 });
1223			});
1224		}
1225
1226		// Right
1227		if ( p3dType.hasClass('ish-p-3dcube-inverse-right') ) {
1228			pitem.each(function() {
1229				var _this = jQuery(this), _width = _this.width() / 2;
1230
1231				var def1 = 'rotateY(-90deg) translateX( -' + _width + 'px )';
1232				_this.css({ '-webkit-transform': def1, 'transform': def1 });
1233
1234				var def3 = 'rotateY(90deg) translateZ( ' + _width + 'px )';
1235				_this.find('.ish-p-overlay').css({ '-webkit-transform': def3, 'transform': def3 });
1236			});
1237
1238			a.hover(function() {
1239				var _this = jQuery(this), _width = _this.width() / 2;
1240
1241				var def1 = 'rotateY(0deg) translateZ( -' + _width + 'px )';
1242				_this.find('.ish-p-item').css({ '-webkit-transform': def1, 'transform': def1 });
1243			}, function() {
1244				var _this = jQuery(this), _width = _this.width() / 2;
1245
1246				var def1 = 'rotateY(-90deg) translateX( -' + _width + 'px )';
1247				_this.find('.ish-p-item').css({ '-webkit-transform': def1, 'transform': def1 });
1248			});
1249		}
1250
1251		// Common definitions top / bottom inverse
1252		if ( p3dType.hasClass('ish-p-3dcube-inverse-top') || p3dType.hasClass('ish-p-3dcube-inverse-bottom') ) {
1253			pitem.each(function() {
1254				var _this = jQuery(this), _height = _this.height() / 2;
1255
1256				var def1_1 = 'translateZ( -' + _height + 'px )', def1_2 = '50% ' + _height + 'px )';
1257				_this.css({ '-webkit-transform': def1_1, 'transform': def1_1, '-webkit-transform-origin:': def1_2, 'transform-origin:': def1_2 });
1258
1259				var def2 = 'translateZ( ' + _height + 'px )';
1260				_this.find('.ish-p-img').css({ '-webkit-transform': def2, 'transform': def2 });
1261			});
1262
1263			a.hover(function() {
1264			}, function() {
1265				var _this = jQuery(this);
1266				// FF fix unhover z-index
1267				if ( jQuery.browser.mozilla ) _this.css( 'z-index', '98' );
1268			});
1269		}
1270
1271		// Top
1272		if ( p3dType.hasClass('ish-p-3dcube-inverse-top') ) {
1273			pitem.each(function() {
1274				var _this = jQuery(this), _height = _this.height() / 2;
1275
1276				var def1 = 'rotateX(-90deg) translateY( ' + _height + 'px )';
1277				_this.css({ '-webkit-transform': def1, 'transform': def1 });
1278
1279				var def3 = 'rotateX(90deg) translateY( ' + _height + 'px ) translateZ( ' + _height*2 + 'px )';
1280				_this.find('.ish-p-overlay').css({ '-webkit-transform': def3, 'transform': def3 });
1281			});
1282
1283			a.hover(function() {
1284				var _this = jQuery(this), _height = _this.height() / 2;
1285
1286				var def1 = 'rotateX(0deg) translateZ( -' + _height + 'px )';
1287				_this.find('.ish-p-item').css({ '-webkit-transform': def1, 'transform': def1 });
1288			}, function() {
1289				var _this = jQuery(this), _height = _this.height() / 2;
1290
1291				var def1 = 'rotateX(-90deg) translateY( ' + _height + 'px )';
1292				_this.find('.ish-p-item').css({ '-webkit-transform': def1, 'transform': def1 });
1293			});
1294		}
1295
1296		// Bottom
1297		if ( p3dType.hasClass('ish-p-3dcube-inverse-bottom') ) {
1298			pitem.each(function() {
1299				var _this = jQuery(this), _height = _this.height() / 2;
1300
1301				var def1 = 'rotateX(90deg) translateY( -' + _height + 'px )';
1302				_this.css({ '-webkit-transform': def1, 'transform': def1 });
1303
1304				var def3 = 'rotateX(-90deg) translateY( ' + _height + 'px )';
1305				_this.find('.ish-p-overlay').css({ '-webkit-transform': def3, 'transform': def3 });
1306			});
1307
1308			a.hover(function() {
1309				var _this = jQuery(this), _height = _this.height() / 2;
1310
1311				var def1 = 'rotateX(0deg) translateZ( -' + _height + 'px )';
1312				_this.find('.ish-p-item').css({ '-webkit-transform': def1, 'transform': def1 });
1313			}, function() {
1314				var _this = jQuery(this), _height = _this.height() / 2;
1315
1316				var def1 = 'rotateX(90deg) translateY( -' + _height + 'px )';
1317				_this.find('.ish-p-item').css({ '-webkit-transform': def1, 'transform': def1 });
1318			});
1319		}
1320
1321	}
1322
1323
1324// Portfolio filter ----------------------------------------------------------------------------------------------------
1325	if ( ! function_exists( 'activate_portfolio_filter' ) ) {
1326		ish.activate_portfolio_filter = function (){
1327
1328			var pfilter = jQuery('.ish-p-filter');
1329
1330			if ( pfilter.length > 0 ) {
1331				var portfolio = jQuery('.ish-sc_portfolio');
1332
1333				portfolio.each(function() {
1334					var _thisp = jQuery(this);
1335					var link = _thisp.find('.ish-p-filter a');
1336					var filterType = _thisp.find('.ish-p-filter').attr('data-type');
1337					var items = _thisp.find('.ish-p-col');
1338					var del = 200;
1339					var fadeTo = 0.1;
1340					var onFire = false;
1341					var wasActive = '*';
1342
1343					if ( '' != filterType && 'link' != filterType ){
1344						// Filter
1345						link.click(function() {
1346							var _thisl = jQuery(this);
1347							var clicked = _thisl.attr('data-filter');
1348							var notclicked;
1349
1350							// Acrove item in filter
1351							link.removeClass('ish-active');
1352							link.filter('[data-filter="' + clicked + '"]').addClass('ish-active');
1353
1354							if ( _thisl.attr('data-filter') == '*' ) {
1355								if ( !_thisl.hasClass('selected-all') ) {
1356									if ( !onFire ) {
1357										// Organize effect
1358										if ( filterType == 'organize' ) {
1359											// render them but not show
1360											items.fadeTo(0, 1);
1361
1362											// Relayout packery
1363											_thisp.find('.ish-p-items-container').packery();
1364
1365											// Now show them
1366											items.fadeIn(del);
1367
1368
1369											setTimeout(function() {
1370												onFire = false;
1371											}, del);
1372										}
1373
1374										// Fade effect
1375										if ( filterType == 'fade' ) {
1376											items.css({
1377												'pointer-events': 'auto',
1378												'cursor': 'pointer'
1379											}).animate({
1380												'opacity': '1'
1381											}, del, function() {
1382												onFire = false;
1383											});
1384
1385										}
1386
1387										onFire = true;
1388										_thisl.addClass('selected-all');
1389									}
1390								}
1391							}
1392							else {
1393								if ( wasActive != clicked ) {
1394									link.removeClass('selected-all');
1395
1396									if ( ! onFire ) {
1397
1398										onFire = true;
1399
1400										// Organize effect
1401										if ( filterType == 'organize' ) {
1402											if ( wasActive == '*' ) {
1403												items.show();
1404												notclicked = items.not( clicked );
1405												if ( notclicked.length > 0 ) {
1406													notclicked.hide(0);
1407													_thisp.find('.ish-p-items-container').packery();
1408													onFire = false;
1409												}else{
1410													onFire = false;
1411												}
1412											}
1413											else {
1414												items.filter( clicked ).fadeTo(0.00001, 1);
1415												notclicked = items.not( clicked );
1416												if ( notclicked.length > 0 ) {
1417													notclicked.hide(0);
1418													// Now show them
1419													items.filter( clicked ).fadeIn(del);
1420
1421													// Relayout packery
1422													_thisp.find('.ish-p-items-container').packery();
1423
1424													onFire = false;
1425
1426												} else{
1427													// Now show them
1428													items.filter( clicked ).fadeIn(del);
1429
1430													// Relayout packery
1431													_thisp.find('.ish-p-items-container').packery();
1432
1433													// Stop animation lock if no items are animated
1434													onFire = false;
1435												}
1436											}
1437										}
1438
1439										// Fade effect
1440										if ( filterType == 'fade' ) {
1441											items.css({
1442												'pointer-events': 'none',
1443												'cursor': 'default'
1444											}).animate({
1445												'opacity': fadeTo
1446											}, del);
1447
1448											var items_to_show = _thisp.find('.ish-p-col' + clicked);
1449
1450											if ( items_to_show.length > 0 ) {
1451												items_to_show.css({
1452													'pointer-events': 'auto',
1453													'cursor': 'pointer'
1454												}).animate({
1455													'opacity': '1'
1456												}, del, function() {
1457													onFire = false;
1458												});
1459											} else{
1460												// Stop animation lock if no items are animated
1461												onFire = false;
1462											}
1463										}
1464									}
1465								}
1466							}
1467
1468							wasActive = _thisl.attr('data-filter');
1469
1470							return false;
1471						});
1472					}
1473
1474				});
1475			}
1476
1477		}
1478	}
1479
1480
1481// Portfolio pre-loader ------------------------------------------------------------------------------------------------
1482	if ( ! function_exists( 'activate_portfolio_preloader' ) ) {
1483		ish.activate_portfolio_preloader = function (){
1484
1485			var portfolio = jQuery('.ish-sc_portfolio');
1486
1487			portfolio.each(function() {
1488				var _thisp = jQuery(this);
1489				var del = 200;
1490
1491				// Preloading
1492				_thisp.imagesLoaded( function() {
1493					_thisp.find('.ish-section-filter .ish-sc-element, .ish-p-col').css({
1494						'visibility': 'visible',
1495						'opacity': '0'
1496					}).fadeTo(del * 5, 1);
1497
1498					jQuery('.ish-preloader').fadeOut(del);
1499				});
1500
1501			});
1502
1503		}
1504	}
1505
1506
1507	// Portfolio packery ---------------------------------------------------------------------------------------------------
1508	if ( ! function_exists( 'activate_portfolio_packery' ) ) {
1509		ish.activate_portfolio_packery = function (){
1510
1511			//$container = jQuery('.ish-sc_portfolio.ish-p-packery .ish-p-items-container');
1512			$container = jQuery('.ish-sc_portfolio .ish-p-items-container');
1513
1514			// initialize
1515			$container.each( function(){
1516				var _this = jQuery(this);
1517
1518				// Preloading
1519				_this.imagesLoaded().done( function() {
1520					_this.packery({
1521						itemSelector: '.ish-p-col'
1522					});
1523				});
1524
1525			});
1526			$container.packery();
1527
1528		}
1529	}
1530
1531
1532	// Portfolio IE no 3D ------------------------------------------------------------------------------------------------------------
1533	if ( ! function_exists( 'activate_portfolio_ie_no_3d' ) ) {
1534		ish.activate_portfolio_ie_no_3d = function (){
1535
1536			// Check IE
1537			if ( jQuery.browser.msie || ie11 ) {
1538				var p3d = jQuery('[class*="ish-p-flip-"], [class*="ish-p-3dcube-"]');
1539				var toReplace = 'ish-p-flip-left ish-p-flip-right ish-p-flip-top ish-p-flip-bottom ish-p-flip-inverse-left ish-p-flip-inverse-right ish-p-flip-inverse-top ish-p-flip-inverse-bottom ish-p-3dcube-left ish-p-3dcube-right ish-p-3dcube-top ish-p-3dcube-bottom ish-p-3dcube-inverse-left ish-p-3dcube-inverse-right ish-p-3dcube-inverse-top ish-p-3dcube-inverse-bottom';
1540				var replaceWith = 'ish-p-zoomin';
1541
1542				p3d.removeClass( toReplace ).addClass( replaceWith );
1543			}
1544
1545		}
1546	}
1547
1548	// Gallery packery ---------------------------------------------------------------------------------------------------
1549	if ( ! function_exists( 'activate_gallery_packery' ) ) {
1550		ish.activate_gallery_packery = function (){
1551
1552			var $container = jQuery('.ish-sc_gallery.ish-g-masonry .ish-row');
1553
1554			// initialize
1555			$container.each( function(){
1556				var _this = jQuery(this);
1557
1558				// Preloading
1559				_this.imagesLoaded().done( function() {
1560					_this.packery({
1561						itemSelector: '.ish-gallery-image'
1562					});
1563				});
1564
1565			});
1566
1567		}
1568	}
1569
1570
1571	// Ajax history --------------------------------------------------------------------------------------------------------
1572	if ( ! function_exists( 'activate_content_fade' ) ) {
1573		ish.activate_content_fade = function (){
1574			/*
1575			 var content = jQuery('.ish-wrapper-all');
1576			 jQuery('body').css('visibility','visible');
1577			 content.hide().fadeIn(250);
1578
1579			 jQuery('a').click( function(e){
1580
1581			 var me = jQuery(this);
1582			 var href = me.attr( 'href' );
1583
1584			 if ( href && href.indexOf( document.domain ) !== -1 && href.indexOf('#') == -1) {
1585			 var content = jQuery('.ish-wrapper-all');
1586			 content.fadeTo( 350, 0 );
1587			 }
1588
1589			 });
1590			 */
1591
1592		}
1593	}
1594
1595
1596// Parallax dynamic ----------------------------------------------------------------------------------------------------
1597	if ( ! function_exists( 'activate_dynamic_parallax' ) ) {
1598		ish.activate_dynamic_parallax = function (){
1599
1600			var parallaxDyn = jQuery('.ish-parallax-dynamic');
1601
1602			if ( parallaxDyn.length > 0 ) {
1603				parallaxDyn.each( function() {
1604
1605					var $div = jQuery(this);
1606					var $dataScroll = $div.data( 'scroll' );
1607					var $dataAmount = $div.data( 'amount' );
1608					var $dur = $div.data( 'duration' );
1609					var $eas = $div.data( 'easing' );
1610
1611					if ( ! $dataScroll  || $dataScroll == "" || $dataScroll === null ) { $dataScroll = '0.1' }
1612					if ( ! $dataAmount  || $dataAmount == "" || $dataAmount === null ) { $dataAmount = '50%' }
1613					if ( ! $dur  || $dur == "" || $dur === null ) { $dur = '250' }
1614					if ( ! $eas  || $eas == "" || $eas === null ) { $eas = 'easeOutExpo' }
1615
1616					var bg = $div.css( 'background-image' );
1617
1618					if ( bg ) {
1619						var src = bg.replace(/(^url\()|(\)$|[\"\'])/g, ''),
1620							$img = jQuery('<img>').attr( 'src', src ).on( 'load', function() {
1621
1622								// do something, maybe:
1623								$div.parallax( $dataAmount, $dataScroll, true, $dur, $eas );
1624							});
1625					}
1626				});
1627			}
1628
1629		}
1630	}
1631
1632
1633// Slidable container --------------------------------------------------------------------------------------------------
1634	if ( ! function_exists( 'activate_shortcode_slidable' ) ) {
1635		ish.activate_shortcode_slidable = function (){
1636
1637			var slidable = jQuery('.ish-slidable');
1638
1639			if ( slidable.length > 0 ) {
1640				slidable.each(function() {
1641					jQuery(this).find('[class*="ish-slide"]').wrapAll('<div class="ish-slidable-container" />');
1642				});
1643
1644				slidable.each(function() {
1645					var me = jQuery(this);
1646					var me_slider = me.find('.ish-slidable-container');
1647					var dataAttr = {
1648						autoslide: me.attr('data-autoslide'),
1649						interval: me.attr('data-interval'),
1650						animation: me.attr('data-animation'),
1651						navigation: me.attr('data-navigation'),
1652						prevnext: me.attr('data-prevnext'),
1653						maxheight: me.attr('data-maxheight'),
1654						itemscount: me.attr('data-itemscount')
1655					};
1656
1657					var opts = {
1658
1659						transitionStyle : false, // Add CSS3 transition style. Works only with one item on screen.
1660						navigation: true, // Show next and prev buttons
1661						pagination: true, // Show dots for each slide
1662						autoPlay: false,
1663						autoHeight: true,
1664						navigationText: ['<span></span>', '<span></span>'],	//["prev","next"]	array	You can cusomize your own text for navigation. To get empty buttons use navigationText : false. Also HTML can be used here
1665						stopOnHover: true,
1666						singleItem: true,
1667						theme: 'ish-owl-theme',
1668						baseClass: 'ish-slidable-container',
1669
1670						rewindNav: true, // Make the slides rotate to the first once they reach the end
1671						mouseDrag: true,
1672
1673						afterInit: function(){
1674
1675							me.resize();
1676
1677							// Hide images from the very beginning
1678							jQuery('.ish-slidable img').css('visibility', 'visible');
1679
1680							// Show navigation arrows on hover
1681							me.hover(function () {
1682								me.find('.owl-buttons').stop(true, true).fadeIn();
1683							}, function() {
1684								me.find('.owl-buttons').stop(true, true).fadeOut();
1685							});
1686
1687							// Turn off navigation
1688							if ( dataAttr.maxheight != undefined ) {
1689								me.find('.owl-wrapper-outer').css('max-height', dataAttr.maxheight + 'px');
1690							}
1691
1692
1693						}
1694
1695
1696						// "singleItem:true" is a shortcut for:
1697						// items : 1,
1698						// itemsDesktop : false,
1699						// itemsDesktopSmall : false,
1700						// itemsTablet: false,
1701						// itemsMobile : false
1702
1703					}
1704
1705					// Only if autoslide is 'yes' set the interval -> default / custom
1706					if ( dataAttr.autoslide == 'yes' ) {
1707
1708						//opts.autoPlay = true;
1709
1710						if ( dataAttr.interval != undefined ) {
1711							//opts.slideSpeed = dataAttr.interval * 1000;
1712							//opts.paginationSpeed = opts.slideSpeed;
1713							//opts.rewindSpeed = opts.slideSpeed;
1714							opts.autoPlay = dataAttr.interval * 1000;
1715						}
1716						else {
1717							//opts.slideSpeed = 4000;
1718							//opts.paginationSpeed = 4000;
1719							//opts.rewindSpeed = 4000;
1720							opts.autoPlay = 4000;
1721						}
1722
1723					}
1724
1725					// Change animation to fade
1726					if ( dataAttr.animation == 'fade' ) {
1727						opts.transitionStyle = 'fade';
1728						//me.addClass('anim-fade');
1729					}
1730
1731					// Turn off navigation
1732					if ( dataAttr.navigation == 'no' ) {
1733						opts.pagination = false;
1734					}
1735
1736					// Turn off direction Nav
1737					if ( dataAttr.prevnext == 'no' ) {
1738						opts.navigation = false;
1739					}
1740
1741					// Turn off autoheight if using max heght
1742					if ( dataAttr.maxheight != undefined ) {
1743						//opts.autoHeight = false;
1744					}
1745
1746					// Set items per slide
1747					if ( ( dataAttr.itemscount != undefined ) && ( dataAttr.itemscount > 1 ) ) {
1748						opts.items = dataAttr.itemscount;
1749						opts.singleItem = false;
1750						//opts.scrollPerPage = true; - Crashes Chrome
1751						opts.autoHeight = false;
1752						opts.itemsDesktop = false;
1753						opts.itemsDesktopSmall = false;
1754
1755
1756						if ( 3 <= opts.items) {
1757							opts.itemsTablet = [768, 3]; // between 768 and 481px
1758						}
1759						if ( 2 <= opts.items) {
1760							opts.itemsTabletSmall = [480,2]; // 2 items between 480 and 321px
1761						}
1762
1763						if ( 1 <= opts.items) {
1764							opts.itemsMobile = [320,1]; // itemsMobile
1765						}
1766
1767
1768					}
1769
1770					fixVideoHeights();
1771
1772					me.imagesLoaded(function() {
1773
1774						me_slider.owlCarousel( opts );
1775						me_slider.data('owlCarousel').reinit( opts );
1776
1777
1778
1779						// Stop when slider not in viewport
1780						jQuery(window).scroll(function() {
1781
1782							if ( me.isOnScreen() ) {
1783								me_slider.data('owlCarousel').play(); // Autoplay Stop
1784							}
1785							else {
1786								me_slider.data('owlCarousel').stop(); // Autoplay Stop
1787							}
1788
1789						});
1790
1791						if ( me.isOnScreen() ) {
1792							me_slider.data('owlCarousel').play(); // Autoplay Stop
1793						}
1794						else {
1795							me_slider.data('owlCarousel').stop(); // Autoplay Stop
1796						}
1797
1798					});
1799
1800
1801
1802				});
1803			}
1804
1805		}
1806	}
1807
1808
1809
1810// Tooltip -------------------------------------------------------------------------------------------------------------
1811	if ( ! function_exists( 'activate_tooltips' ) ) {
1812		ish.activate_tooltips = function (){
1813
1814			var tooltip = jQuery('[data-type="tooltip"]');
1815
1816			if ( tooltip.length > 0 ) {
1817				tooltip.tooltipster({
1818					functionReady: function(origin) {
1819						var classList = origin.attr('class').split(/\s+/);
1820						var col = '';
1821
1822						jQuery.each( classList, function(index, item){
1823							if ( item.indexOf('ish-tooltip-color') === 0 ) {
1824								col += item;
1825							}
1826							if ( item.indexOf('ish-tooltip-text-color') === 0 ) {
1827								col += ' ' + item;
1828							}
1829						});
1830
1831						jQuery('.tooltipster-default').addClass( col );
1832					}
1833				});
1834			}
1835
1836		}
1837	}
1838
1839
1840// Blog packery ---------------------------------------------------------------------------------------------------
1841	if ( ! function_exists( 'activate_blog_packery' ) ) {
1842		ish.activate_blog_packery = function (){
1843
1844			var $container = jQuery('.ish-blog-masonry .ish-packery');
1845
1846			// initialize
1847			$container.packery({
1848				itemSelector: '.ish-blog-post-masonry'
1849			});
1850
1851		}
1852	}
1853
1854
1855// Video ---------------------------------------------------------------------------------------------------------------
1856	function fixVideoHeights(){
1857		var src = jQuery('.ish-blog-video-content');
1858		var rec_post = jQuery('.recent_posts_post_content');
1859
1860		src.each(function() {
1861			var me = jQuery(this);
1862			var iframe = me.find('iframe');
1863			var iframe_w = iframe.attr('width');
1864			var iframe_h = iframe.attr('height');
1865
1866			var parent_w = me.width();
1867
1868			if (iframe_h > 0 && 0 == parent_w) {
1869
1870				var visible_parent_w = 0;
1871				var visible_parent = me.parents('.ish-slidable').find('.recent_posts_post_content');
1872				if (visible_parent.length > 0 ){
1873					visible_parent_w = visible_parent.width();
1874				}
1875
1876				parent_w = visible_parent_w;
1877			}
1878
1879			var rat = parent_w / iframe_w;
1880
1881			if ( parent_w > 0 && iframe_h > 0 ){
1882				iframe.attr('width', parent_w);
1883				iframe.attr('height', iframe_h * rat);
1884				iframe.show();
1885			}
1886		});
1887	}
1888
1889
1890// Iframe video height fix ---------------------------------------------------------------------------------------------
1891	if ( ! function_exists( 'activate_iframe_embed_video_heigh_fix' ) ) {
1892		ish.activate_iframe_embed_video_heigh_fix = function (){
1893
1894			if ( jQuery('.ish-blog-video-content').length > 0 ) {
1895				jQuery(window).resize(function() {
1896					fixVideoHeights();
1897				});
1898			}
1899
1900			if ( jQuery('embed').length > 0 ) {
1901				jQuery(window).resize(function() {
1902					var src = jQuery('embed');
1903					src.each(function() {
1904						var self = jQuery(this);
1905						var parent = self.parent();
1906						var ow = parent.width();
1907
1908						var w = self.attr('width');
1909						var h = self.attr('height');
1910						var rat = ow / w;
1911
1912						self.attr('width', ow);
1913						self.attr('height', parseInt(h * rat));
1914
1915						self.show();
1916					});
1917				});
1918			}
1919			if ( jQuery('iframe').length > 0 ) {
1920				jQuery(window).resize(function() {
1921					var src = jQuery('iframe');
1922					src.each(function() {
1923						var self = jQuery(this);
1924						var parent = self.parent();
1925						var ow = parent.width();
1926
1927						var attsrc = self.attr('src');
1928
1929						if ( attsrc ){
1930
1931							var w = self.attr('width');
1932							var h = self.attr('height');
1933							var rat = ow / w;
1934
1935							self.css('width', '100%');
1936
1937							if ( ow > 0 ){
1938								self.attr('width', ow);
1939								self.attr('height', parseInt(h * rat));
1940							}
1941
1942							self.show();
1943						}
1944					});
1945				});
1946			}
1947
1948		}
1949	}
1950
1951
1952// Ish Like It ---------------------------------------------------------------------------------------------------------
1953	if ( ! function_exists( 'activate_ish_like_it' ) ) {
1954		ish.activate_ish_like_it = function (){
1955
1956			var likes_btn = jQuery('a.ish-likes');
1957
1958			if ( likes_btn.length > 0 ) {
1959
1960				likes_btn.live('click',
1961					function() {
1962						var link = jQuery(this);
1963						if ( link.hasClass('active') ) return false;
1964
1965						var id = link.attr('id');
1966
1967						link.addClass('active');
1968
1969						jQuery.post( iyb_globals.admin_ajax, { action:'ish-like-it', likes_id: id }, function(data){
1970							link.find('.ish-likes-count').html(data);
1971							link.replaceWith(function(){
1972								return jQuery('<span class="' + jQuery(this).attr('class') + '">' + jQuery(this).html() + '</span>');
1973							});
1974						});
1975
1976						return false;
1977					}
1978				);
1979
1980			}
1981
1982		}
1983	}
1984
1985
1986// V Unit --------------------------------------------------------------------------------------------------------------
1987	if ( ! function_exists( 'activate_vunit' ) ) {
1988		ish.activate_vunit = function (){
1989
1990			/* https://github.com/joaocunha/v-unit */
1991			(function(h,c){var b={a:{c:"v-unit-sheet",h:100},b:{height:0,width:0},j:function(){b.e();b.l()},l:function(){return h.setInterval(b.e,b.a.h)},e:function(){var a=b.b.height,d=b.b.width,c=b.d();c.height==a&&c.width==d||b.i()},g:function(){var a=c.createElement("style");a.rel="stylesheet";a.type="text/css";a.id=b.a.c;return a},k:function(a){for(var d=b.d(),f=d.height/100,d=d.width/100,g="",e=1;100>=e;e++)g+=".vh"+e+"{height:"+Math.round(f*e)+"px;}.vw"+e+"{width:"+Math.round(d*e)+"px;}\n";a.styleSheet?
1992				a.styleSheet.cssText=g:a.appendChild(c.createTextNode(g))},f:function(a){var d=c.getElementById(b.a.c),f=c.head||c.getElementsByTagName("head")[0]||c.documentElement;d&&f.removeChild(d);f.appendChild(a)},d:function(){var a={height:c.documentElement.clientHeight,width:c.documentElement.clientWidth};return b.b=a},i:function(){var a=b.g();b.k(a);b.f(a)}};b.j()})(window,document);
1993
1994		}
1995	}
1996
1997
1998// Fancybox ------------------------------------------------------------------------------------------------------------
1999	if ( ! function_exists( 'activate_fancybox' ) ) {
2000		ish.activate_fancybox = function (){
2001
2002			fancybox_init();
2003
2004			// Fancybox ------------------------------------------------------------------------------------------------------------
2005			function fancybox_init() {
2006				if ( jQuery('.openfancybox-video').length > 0 ) {
2007					jQuery(".openfancybox-video").each(function(){
2008						var target = jQuery(jQuery(this).attr("href"));
2009						var src = target.find('iframe').attr("src");
2010						jQuery(this).fancybox({
2011							'type': "inline",
2012							'content': target,
2013							'transitionIn'	: 'none',
2014							'transitionOut'	: 'none',
2015							'onClosed': function(){
2016								target.find('iframe').attr("src", src);
2017							}
2018						});
2019					});
2020				}
2021
2022				if ( jQuery('.openfancybox-image').length > 0 ) {
2023					jQuery(".openfancybox-image").fancybox({
2024						'padding' : 10,
2025						'helpers' : {
2026							'title': {
2027								'type': 'over'
2028							}
2029						}
2030					});
2031				}
2032
2033				if ( jQuery('.openfancybox-audio').length > 0 ) {
2034					jQuery(".openfancybox-audio").fancybox({
2035						'padding' : 10,
2036						'helpers' : {
2037							'title': {
2038								'type': 'over'
2039							}
2040						}
2041					});
2042				}
2043			}
2044
2045		}
2046	}
2047
2048
2049// Accordion -----------------------------------------------------------------------------------------------------------
2050	if ( ! function_exists( 'activate_accordions' ) ) {
2051		ish.activate_accordions = function (){
2052
2053			var acc = jQuery('.ish-sc_tgg_acc');
2054
2055			if ( acc.length > 0 ) {
2056				// for each accordion on page
2057				acc.each(function() {
2058					var accDel = 250;
2059					var _this = jQuery(this);
2060					var iconP = 'ish-icon-right-open';
2061					var iconM = 'ish-icon-down-open';
2062
2063					// pointer active
2064					_this.find('.ish-active i.pointer').removeClass(iconP).addClass(iconM);
2065
2066					// Hide all apart from 'active'
2067					//_this.find('li').not('.ish-active').children('div').hide();
2068
2069					if ( _this.attr('class').indexOf("accordion") !== -1 ) {
2070						_this.find('.ish-tgg-acc-title').click(function() {
2071							var _t = jQuery(this);
2072
2073							// Close previous
2074							_this.parent().find('.ish-tgg-acc-content').stop().slideUp(accDel);
2075							setTimeout(function() {
2076								_this.parent().find('.ish-tgg-acc-title').removeClass('ish-active');
2077								_t.addClass('ish-active');
2078							}, accDel);
2079							_this.parent().find('.ish-tgg-acc-title').find('i.pointer').removeClass(iconM).addClass(iconP);
2080
2081							_t.siblings('.ish-tgg-acc-content').stop().slideDown(accDel);
2082							_t.find('i.pointer').removeClass(iconP).addClass(iconM);
2083
2084							jQuery(window).resize();
2085						});
2086					}
2087					else if ( _this.attr('class').indexOf("toggle") !== -1 ) {
2088						_this.find('.ish-tgg-acc-title').each(function() {
2089							var _t = jQuery(this);
2090
2091							if ( _t.hasClass('ish-active') )
2092								var tggOpened = true;
2093							else
2094								var tggOpened = false;
2095
2096							_t.click(function() {
2097								if ( !tggOpened ) {
2098									_t.siblings('div').stop().slideDown(accDel);
2099									_t.parent().find('.ish-tgg-acc-title').addClass('ish-active');
2100									_t.find('i.pointer').removeClass(iconP).addClass(iconM);
2101									tggOpened = true;
2102								}
2103								else {
2104									_t.siblings('div').stop().slideUp(accDel);
2105									setTimeout(function() {
2106										_t.parent().find('.ish-tgg-acc-title').removeClass('ish-active');
2107									}, accDel);
2108									_t.find('i.pointer').removeClass(iconM).addClass(iconP);
2109									tggOpened = false;
2110								}
2111								jQuery(window).resize();
2112							});
2113						});
2114					}
2115				});
2116			}
2117
2118		}
2119	}
2120
2121
2122// Accordion filter ----------------------------------------------------------------------------------------------------
2123	if ( ! function_exists( 'activate_accordions_filter' ) ) {
2124		ish.activate_accordions_filter = function (){
2125
2126			//var acc = jQuery('.ish-tgg_acc_filter');
2127			var accF = jQuery('.ish-tgg-acc-filter');
2128
2129			if ( accF.length > 0 ) {
2130
2131				accF.each(function() {
2132					var _t = jQuery(this);
2133					var del = 250;
2134
2135					var items = _t.parent().find('.ish-sc_tgg_acc_item');
2136
2137					var who = items.attr('class');
2138
2139					_t.find('a').click(function() {
2140						var clicked = jQuery(this).attr('href');
2141						var who = clicked.replace('#', '');
2142
2143						// Change class
2144						_t.find('a').removeClass('ish-active');
2145						_t.find('a[href="' + clicked + '"]').addClass('ish-active');
2146
2147						if ( who == 'all' ) {
2148							items.fadeIn(del);
2149						}
2150						else {
2151							items.hide();
2152							items.filter( '.' + who ).fadeIn(del);
2153						}
2154
2155						return false;
2156					});
2157
2158				});
2159			}
2160
2161		}
2162	}
2163
2164
2165// Tabs ----------------------------------------------------------------------------------------------------------------
2166	if ( ! function_exists( 'activate_tabs' ) ) {
2167		ish.activate_tabs = function (){
2168
2169			var tabs = jQuery('.ish-sc_tabs');
2170
2171			if ( tabs.length > 0 ) {
2172				tabs.each(function() {
2173					var nav = jQuery(this).find('.ish-tabs-navigation li');
2174					var tab = jQuery(this).find('.ish-tabs-content .ish-sc_tab');
2175					var tabsDel = 350;
2176
2177					// Click tab
2178					nav.find('a').click(function( e ) {
2179
2180						e.preventDefault();
2181
2182						var _this = jQuery(this);
2183						var idx = _this.parent().index();
2184
2185						// Switch tabs
2186						tab.hide();
2187
2188						// Temporarily change tab content ID so we can change location.hash without page-scrolling
2189						var id = tab.eq(idx).attr('id');
2190						tab.eq(idx).attr('id', 'ish_temp_' + id );
2191
2192						// Change URL hash
2193						if ( window.location.hash != this.hash ) {
2194							window.location.hash = this.hash;
2195						}
2196
2197						// Change the id back to original
2198						tab.eq(idx).attr('id', id );
2199
2200						// Show tab content
2201						tab.eq(idx).fadeIn(tabsDel);
2202
2203						nav.removeClass('ish-active');
2204						tab.removeClass('ish-active');
2205
2206						_this.parent().addClass('ish-active');
2207
2208						// Must re-check all visible lined separators widths again
2209						ish.do_text_separator_size_fix();
2210					});
2211
2212					if ( '' != window.location.hash ) {
2213						var hash = window.location.hash;
2214
2215						var nav_item_from_uri = jQuery(this).find('.ish-tabs-navigation li a[href^="' + hash + '"]');
2216						nav_item_from_uri.click();
2217
2218						// Initiate hash change to scroll to the selected tab
2219						window.location.hash = hash;
2220					}
2221
2222				});
2223			}
2224
2225		}
2226	}
2227
2228
2229// Last bottom shape + footer padding top ------------------------------------------------------------------------------
2230	if ( ! function_exists( 'activate_last_shape_footer' ) ) {
2231		ish.activate_last_shape_footer = function (){
2232
2233			jQuery('[class*="ish-row-svg-bottom-"]:last-child').parent().find('+ .ish-part_footer > .ish-row:first-child').css({'padding-top': '50px'});
2234
2235		}
2236	}
2237
2238
2239// Masonry blog responsive class ---------------------------------------------------------------------------------------
2240	if ( ! function_exists( 'activate_masonry_blog_responsive_class' ) ) {
2241		ish.activate_masonry_blog_responsive_class = function (){
2242
2243			var masCont = jQuery('.ish-part_content.ish-blog-masonry:not(.ish-blog-masonry-layout-grid)');
2244
2245			if ( masCont.length > 0 ) {
2246				var ww;
2247
2248				jQuery(window).resize(function() {
2249					ww = jQuery(window).width();
2250
2251					if ( ww < BREAKINGPOINT ) {
2252						masCont.addClass('ish-blog-masonry-layout-grid');
2253					}
2254					else {
2255						masCont.removeClass('ish-blog-masonry-layout-grid');
2256					}
2257				});
2258			}
2259
2260		}
2261	}
2262
2263
2264// Masonry blog preloader ----------------------------------------------------------------------------------------------
2265	if ( ! function_exists( 'activate_masonry_blog_preloader' ) ) {
2266		ish.activate_masonry_blog_preloader = function (){
2267
2268			var masonry_blog = jQuery('.ish-part_content.ish-blog-masonry');
2269
2270			masonry_blog.each(function() {
2271				var _thisp = jQuery(this);
2272				var del = 200;
2273
2274				// Preloading
2275				_thisp.find('.ish-blog-post-media').imagesLoaded().done( function() {
2276					masonry_blog.find('.ish-packery').packery();
2277
2278					_thisp.find('.ish-section-filter .ish-vc_row_inner *, .ish-masonry-container .ish-packery').css({
2279						'visibility': 'visible',
2280						'opacity': '0'
2281					}).fadeTo(del * 5, 1);
2282
2283					jQuery('.ish-preloader').fadeOut(del);
2284				});
2285
2286			});
2287
2288		}
2289	}
2290
2291
2292	// Scroll on resize ----------------------------------------------------------------------------------------------------
2293	if ( ! function_exists( 'activate_scroll_on_resize' ) ) {
2294		ish.activate_scroll_on_resize = function (){
2295
2296			jQuery(window).resize(function(){
2297				jQuery(window).scroll();
2298			});
2299
2300		}
2301	}
2302
2303
2304	/*
2305	 * Charts animation
2306	 */
2307	if ( ! function_exists( 'animate_charts' ) ) {
2308		ish.animate_charts = function (){
2309
2310			jQuery('.ish-sc_chart:in-viewport').each(function() {
2311				var me = jQuery(this);
2312				if ( ! me.hasClass('done') ) {
2313					me.addClass('done');
2314					var percent = parseInt( me.attr('data-percent') , 10 );
2315					me.data('easyPieChart').update(percent);
2316				}
2317			});
2318
2319		}
2320	}
2321
2322
2323	// Charts - EasyPieChart -----------------------------------------------------------------------------------------------
2324	if ( ! function_exists( 'activate_charts' ) ) {
2325		ish.activate_charts = function (){
2326
2327			var chart = jQuery('.ish-sc_chart');
2328			chartz = chart;
2329
2330			if ( chart.length > 0 ) {
2331				chart.each(function() {
2332					var me = jQuery(this);
2333
2334					// attributes from html
2335					var dataAttr = {
2336						lineCap: me.attr('data-linecap'),
2337						lineWidth: me.attr('data-linewidth'),
2338						size: me.attr('data-size'),
2339						barColor: me.attr('data-barcolor'),
2340						trackColor: me.attr('data-trackcolor'),
2341						animate: me.attr('data-animate')
2342					};
2343
2344					// options for easyPieChart
2345					var opts = {
2346						scaleColor: false,
2347						lineCap: 'square',
2348						lineWidth: 10,
2349						size: 150
2350					};
2351
2352					if ( dataAttr.lineCap== 'round' ) {
2353						opts.lineCap = 'round';
2354					}
2355					if ( dataAttr.lineWidth != undefined ) {
2356						opts.lineWidth = dataAttr.lineWidth;
2357					}
2358					if ( dataAttr.size != undefined ) {
2359						opts.size = dataAttr.size;
2360					}
2361					if ( dataAttr.barColor != undefined ) {
2362						opts.barColor = dataAttr.barColor;
2363					}
2364					if ( dataAttr.trackColor != undefined ) {
2365						opts.trackColor = dataAttr.trackColor;
2366					}
2367					if ( dataAttr.animate != undefined ) {
2368						opts.animate = dataAttr.animate;
2369					}
2370
2371					// do charts
2372					me.easyPieChart(opts);
2373					me.data('easyPieChart').update(0);
2374				});
2375
2376				jQuery(window).scroll(function() {
2377					ish.animate_charts();
2378				});
2379			}
2380
2381		}
2382	}
2383
2384	/*
2385	 * Counters animation
2386	 */
2387	if ( ! function_exists( 'animate_counters' ) ) {
2388		ish.animate_counters = function (){
2389
2390			jQuery('.ish-sc_counter:in-viewport').each(function() {
2391				var me = jQuery(this);
2392				if ( ! me.hasClass('done') ) {
2393					me.addClass('done');
2394
2395					var counter = me.find('.ish-counter');
2396
2397					// attributes from html
2398					var duration = me.attr('data-duration');
2399					var value = counter.text();
2400
2401					if ( duration != undefined ) {
2402						duration = duration * 1000;
2403					} else {
2404						duration = 1000;
2405					}
2406
2407					jQuery({ Counter: 0 }).animate({ Counter: counter.text() }, {
2408						duration: duration,
2409						easing: 'swing',
2410						step: function () {
2411							counter.text(Math.ceil(this.Counter));
2412						},
2413						done: function () {
2414							counter.text( value );
2415						}
2416					});
2417				}
2418			});
2419
2420		}
2421	}
2422
2423
2424	// Counters --------------------------------------------------------------------------------------------------------
2425	if ( ! function_exists( 'activate_counters' ) ) {
2426		ish.activate_counters = function (){
2427
2428			var counter = jQuery('.ish-sc_counter');
2429			counters = counter;
2430
2431			if ( counter.length > 0 ) {
2432
2433				jQuery(window).scroll(function() {
2434					ish.animate_counters();
2435				});
2436			}
2437
2438		}
2439	}
2440
2441	// Site Preloader ------------------------------------------------------------------------------------------------------
2442	if ( ! function_exists( 'activate_site_preloader' ) ) {
2443		ish.activate_site_preloader = function (){
2444
2445			var site_preloader = jQuery('.ish-site-preloader-holder');
2446
2447			if ( site_preloader.length > 0 ) {
2448				site_preloader.fadeIn(250);
2449			}
2450
2451		}
2452	}
2453	if ( ! function_exists( 'deactivate_site_preloader' ) ) {
2454		ish.deactivate_site_preloader = function (){
2455
2456			var site_preloader = jQuery('.ish-site-preloader-holder');
2457
2458			if ( site_preloader.length > 0 ) {
2459				site_preloader.fadeOut(250);
2460			}
2461
2462		}
2463	}
2464
2465
2466
2467
2468
2469
2470
2471
2472
2473
2474
2475
2476
2477
2478
2479
2480
2481
2482
2483
2484
2485
2486
2487
2488
2489
2490
2491
2492
2493
2494
2495
2496
2497
2498
2499
2500
2501
2502
2503
2504
2505
2506
2507
2508
2509
2510
2511
2512
2513
2514
2515
2516
2517	/*
2518	 * Boxgroup - same height for boxes
2519	 */
2520	if ( ! function_exists( 'activate_shortcode_boxgroup' ) ) {
2521		ish.activate_shortcode_boxgroup = function (){
2522
2523			var boxgroup = jQuery('.boxgroup');
2524			if ( boxgroup.length > 0 ) {
2525				jQuery(window).resize(function() {
2526
2527					if ( RESPONSIVE === true ){
2528						// only if the layout is responsive
2529
2530						waitForFinalEvent(function(){
2531							if ( jQuery(window).width() > BREAKINGPOINT ) {
2532								boxgroup.each(function() {
2533									var box = jQuery(this).find('.box');
2534
2535									box.css('height', 'auto');
2536									box.sameHeight();
2537								});
2538							}
2539							else {
2540								boxgroup.find('.box').each(function() {
2541									jQuery(this).css('height', 'auto');
2542								});
2543							}
2544						}
2544, WAIT_INTERVAL, "BoxgroupResize");
2545					}
2546					else{
2547						waitForFinalEvent(function(){
2548							boxgroup.each(function() {
2549								var box = jQuery(this).find('.box');
2550
2551								box.css('height', 'auto');
2552								box.sameHeight();
2553							});
2554						}, WAIT_INTERVAL, "BoxgroupResize");
2555					}
2556				});
2557			}
2558
2559		}
2560	}
2561
2562
2563	/*
2564	 * Alerts - close button
2565	 */
2566	if ( ! function_exists( 'activate_shortcode_alert' ) ) {
2567		ish.activate_shortcode_alert = function (){
2568
2569			var alertsClose = jQuery('.box.success.close, .box.warning.close, .box.info.close, .box.error.close');
2570
2571			if ( alertsClose.length > 0 ) {
2572				alertsClose.prepend('<a href="#alert-close" class="icon-cancel-squared"></a>');
2573
2574				var alertsCloseBtn = alertsClose.find('a[href="#alert-close"]');
2575
2576				alertsCloseBtn.click(function() {
2577					jQuery(this).parent().fadeOut(500);
2578
2579					return false;
2580				});
2581			}
2582
2583		}
2584	}
2585
2586	/*
2587	 * Table column highlight
2588	 */
2589	if ( ! function_exists( 'activate_shortcode_table_highlight' ) ) {
2590		ish.activate_shortcode_table_highlight = function (){
2591
2592			var highCol = jQuery('.highlight-col');
2593
2594			if ( highCol.length > 0 ) {
2595				//highCol.parents('table').each(function() {
2596				highCol.each(function() {
2597					var tbl = jQuery(this).parents('table');
2598					var me = jQuery(this);
2599					var idx = me.index() + 1;
2600					var classList = me.attr('class');
2601
2602					tbl.find('th:nth-child(' + idx + '), td:nth-child(' + idx + ')').addClass(classList);
2603					tbl.find('tr:nth-child(even)').find('th:nth-child(' + idx + '), td:nth-child(' + idx + ')').addClass('even');
2604				});
2605			}
2606
2607		}
2608	}
2609
2610	/*
2611	 * EasyPieChart - charts
2612	 */
2613	if ( ! function_exists( 'activate_shortcode_chart' ) ) {
2614		ish.activate_shortcode_chart = function (){
2615
2616			var chart = jQuery('.chart');
2617			chartz = chart;
2618
2619			if ( chart.length > 0 ) {
2620				chart.each(function() {
2621					var me = jQuery(this);
2622
2623					// attributes from html
2624					var dataAttr = {
2625						lineCap: me.attr('data-linecap'),
2626						lineWidth: me.attr('data-linewidth'),
2627						size: me.attr('data-size'),
2628						barColor: me.attr('data-barcolor'),
2629						trackColor: me.attr('data-trackcolor'),
2630						animate: me.attr('data-animate')
2631					};
2632
2633					// options for easyPieChart
2634					var opts = {
2635						scaleColor: false,
2636						lineCap: 'square',
2637						lineWidth: 10,
2638						size: 150
2639					};
2640
2641					if ( dataAttr.lineCap== 'round' ) {
2642						opts.lineCap = 'round';
2643					}
2644					if ( dataAttr.lineWidth != undefined ) {
2645						opts.lineWidth = dataAttr.lineWidth;
2646					}
2647					if ( dataAttr.size != undefined ) {
2648						opts.size = dataAttr.size;
2649					}
2650					if ( dataAttr.barColor != undefined ) {
2651						opts.barColor = dataAttr.barColor;
2652					}
2653					if ( dataAttr.trackColor != undefined ) {
2654						opts.trackColor = dataAttr.trackColor;
2655					}
2656					if ( dataAttr.animate != undefined ) {
2657						opts.animate = dataAttr.animate;
2658					}
2659
2660					// do charts
2661					me.easyPieChart(opts);
2662					me.data('easyPieChart').update(0);
2663				});
2664
2665				jQuery(window).scroll(function() {
2666					animateCharts();
2667				});
2668			}
2669
2670		}
2671	}
2672
2673
2674	/* *********************************************************************************************************************
2675	 * Plugins
2676	 */
2677
2678
2679// Multiple dropdown menu ----------------------------------------------------------------------------------------------
2680	jQuery.fn.multipleDropDown = function() {
2681
2682		var nav = this;
2683
2684		// Check all menu items
2685		nav.children('li').each(function() {
2686
2687			var me = jQuery(this);
2688
2689			// If exist child ul
2690			if ( me.find('ul').length > 0  ) {
2691
2692				me.children('a').click(function(e){
2693					if (jQuery(this).attr('href') == '#'){
2694						e.preventDefault();
2695					}
2696				});
2697
2698				// Add arrow for current parent
2699				var currItem = me.children('a');
2700				currItem.addClass('sub');
2701
2702				// Show 1st level submenu
2703				var currChild = me.children('ul');
2704				var hasActive = false;
2705
2706				// If exists active child mark all parents active
2707				if ( me.find('.active').length > 0  ) {
2708					me.addClass('active');
2709				}
2710
2711				// Over
2712				var currParent = currItem.parent();
2713				currParent.hover(function() {
2714
2715					var me = jQuery(this);
2716					var me_parent = me.parent();
2717					var me_submenu = me.children('ul.sub-menu');
2718					var currChild = me.children('ul');
2719
2720					if ( me.hasClass('active') ) {
2721						hasActive = true;
2722					}
2723					else {
2724						me.addClass('active');
2725					}
2726
2727					currChild.stop( true, true ).fadeIn(100);
2728
2729					var submenu_width;
2730
2731					if ( me_parent.hasClass('sub-menu') ){
2732						// 2nd level submenu and on
2733
2734						submenu_width = me_parent.offset().left + me_parent.width() + currChild.width();
2735
2736						if ( submenu_width >= jQuery(window).width() ){
2737							// The submenu does not fit the screen, show it from right to left
2738							me_submenu.css({
2739								'left': -1 * currChild.width()
2740							});
2741
2742						}
2743						else{
2744							// The submenu fits the screen width, show it from left to right
2745							me_submenu.css({
2746								'left': -1 + 1 + me_parent.width()
2747							});
2748
2749						}
2750
2751					} else {
2752						// 1sr level submenu - we need to count the position differently
2753
2754						submenu_width = me.offset().left + currChild.width();
2755
2756						if ( submenu_width >= jQuery(window).width() ){
2757							// The submenu does not fit the screen, show it from right to left
2758							currChild.css({
2759								'left': -1 * Math.abs( me.width() - currChild.width() )
2760							});
2761
2762						}
2763						else{
2764							// The submenu fits the screen width, show it from left to right
2765							currChild.css({
2766								'left': 0
2767							});
2768
2769						}
2770
2771					}
2772
2773				}, function() {
2774					var me = jQuery(this);
2775					var currChild = me.children('ul');
2776
2777					if ( !hasActive ){
2778						currParent.removeClass('active');
2779					}
2780
2781					currChild.stop( true, true ).hide();
2782
2783					hasActive = false;
2784				});
2785			}
2786		});
2787
2788	};
2789
2790
2791// Smooth scroll -------------------------------------------------------------------------------------------------------
2792	jQuery.fn.smoothScrollAnchor = function() {
2793		var who = this;
2794
2795		if ( who.length != 0 ) {
2796			var scrollDel = 500;
2797			var inScroll = false;
2798
2799			who.click( function() {
2800
2801				if ( jQuery(this).attr("href").indexOf('#') >= 0 ) {
2802
2803					var current_url = window.location.href.split("#");
2804					var where_id = jQuery(this).attr("href").split("#");
2805
2806					// Only scroll if the current URL is the same as the one of the link
2807					if ( ( current_url[0] == where_id[0] ) || ( '' == where_id[0] ) ) {
2808
2809						// Set the ID
2810						where_id = '#' + where_id[1];
2811
2812
2813						if (( jQuery(where_id).length > 0 ) || ( '#top' == where_id )) {
2814							// Check if element with the given ID even Exists
2815
2816							if (!inScroll) {
2817								var where;
2818
2819								if (jQuery(this).attr("href") == '#top')
2820									where = 0;
2821								else {
2822									where = where_id;
2823								}
2824
2825								var sticky_nav = jQuery('.ish-sticky-scrolling');
2826								var offset = 0;
2827
2828								var wpadminbar = jQuery('#wpadminbar');
2829
2830								if (wpadminbar.length > 0) {
2831									offset = offset + ( -1 * wpadminbar.outerHeight() );
2832								}
2833
2834								if ( jQuery(where).hasClass('ish-row-full-height') ) {
2835									offset = offset + 50;
2836								}
2837
2838								// Check if tab with the given ID exists and open it
2839								var selected_tab = jQuery('.ish-tabs-navigation li a[href^="' + where + '"]');
2840								if ( selected_tab.length > 0 ) {
2841									selected_tab.click();
2842								}
2843
2844								jQuery(window).scrollTo(where, {
2845									duration: scrollDel,
2846									offset: offset,
2847									easing: 'easeInOutQuart',
2848									axis: 'y',
2849									onAfter: function () {
2850										inScroll = false;
2851
2852										var sticky_nav = jQuery('.ish-sticky-scrolling');
2853										var offset = 0;
2854
2855										var wpadminbar = jQuery('#wpadminbar');
2856
2857										if (wpadminbar.length > 0) {
2858											offset = offset + ( -1 * wpadminbar.outerHeight() );
2859										}
2860
2861										if (!jQuery(where).hasClass('ish-row-full-height')) {
2862											if (sticky_nav.length > 0) {
2863												// offset = offset + ( -1 * sticky_nav.outerHeight() );
2864												offset = offset + ( -1 * sticky_nav.children('.ish-row').outerHeight() ); // .children('.ish-row') because of the gradient "shadow" effect
2865											}
2866										}
2867
2868										jQuery(window).scrollTo(where, {
2869											duration: scrollDel * 0.75,
2870											offset: offset,
2871											axis: 'y',
2872											onAfter: function () {
2873												inScroll = false;
2874											}
2875										});
2876									}
2877								});
2878
2879								inScroll = true;
2880							}
2881
2882							var resp_nav = jQuery('.ish-ph-mn-be_resp.ish-opened');
2883							var del = 150; // If you change this, please change also the value on the line with comment "RESP_NAV_CLOSE_DURATION"
2884
2885							if (resp_nav.length > 0) {
2886								resp_nav
2887									.css('overflow-y', 'hidden')
2888									.fadeOut(del, function () {
2889										jQuery('body').css({'overflow-y': 'auto'});
2890										resp_nav.removeClass('ish-opened');
2891									});
2892
2893								floated_areas_opened = false;
2894							}
2895
2896							return false;
2897
2898						}
2899					}
2900				}
2901			});
2902
2903		}
2904	};
2905
2906
2907// String width --------------------------------------------------------------------------------------------------------
2908	jQuery.fn.textWidth = function(){
2909
2910
2911		var html_calc = jQuery('#html_calc');
2912
2913		if (html_calc.length > 0){
2914			html_calc.css('font-size',jQuery(this).css('font-size'));
2915			html_calc.html(jQuery(this).html());
2916		}else{
2917			var nhtml_calc = jQuery('<span id="html_calc">' + jQuery(this).html() + '</span>');
2918			nhtml_calc.css('font-size',jQuery(this).css('font-size')).hide();
2919			nhtml_calc.prependTo('body');
2920			html_calc = nhtml_calc;
2921		}
2922
2923		return html_calc.width();
2924	};
2925
2926
2927// Same height for boxes - .boxgroup -----------------------------------------------------------------------------------
2928	jQuery.fn.sameHeight = function(){
2929		return this.height( Math.max.apply(this, jQuery.map( this , function(e){ return jQuery(e).height() }) ) );
2930	};
2931
2932
2933// Check if element is on viewport -------------------------------------------------------------------------------------
2934	jQuery.fn.isOnScreen = function(){
2935
2936		var win = jQuery(window);
2937
2938		var viewport = {
2939			top : win.scrollTop(),
2940			left : win.scrollLeft()
2941		};
2942		viewport.right = viewport.left + win.width();
2943		viewport.bottom = viewport.top + win.height();
2944
2945		var bounds = this.offset();
2946		bounds.right = bounds.left + this.outerWidth();
2947		bounds.bottom = bounds.top + this.outerHeight();
2948
2949		return (!(viewport.right < bounds.left || viewport.left >
2949 bounds.right || viewport.bottom < bounds.top || viewport.top > bounds.bottom));
2950
2951	};
2952
2953
2954	/* *********************************************************************************************************************
2955	 * Initialization of google maps
2956	 */
2957
2958	jQuery.fn.initGoogleMaps = function () {
2959
2960		// LOAD GOOGLE MAPS JS INFOBOX
2961		var script = document.createElement("script");
2962		script.type = "text/javascript";
2963		script.src = iyb_globals.js_uri + "/vendor/infobox_packed.js";
2964		document.body.appendChild(script);
2965
2966	};
2967
2968
2969	/*
2970	 * Viewport - jQuery selectors for finding elements in viewport
2971	 *
2972	 * Copyright (c) 2008-2009 Mika Tuupola
2973	 *
2974	 * Licensed under the MIT license:
2975	 *   http://www.opensource.org/licenses/mit-license.php
2976	 *
2977	 * Project home:
2978	 *  http://www.appelsiini.net/projects/viewport
2979	 *
2980	 */
2981	(function($){$.belowthefold=function(element,settings){var fold=$(window).height()+$(window).scrollTop();return fold<=$(element).offset().top-settings.threshold;};$.abovethetop=function(element,settings){var top=$(window).scrollTop();return top>=$(element).offset().top+$(element).height()-settings.threshold;};$.rightofscreen=function(element,settings){var fold=$(window).width()+$(window).scrollLeft();
2981return fold<=$(element).offset().left-settings.threshold;};$.leftofscreen=function(element,settings){var left=$(window).scrollLeft();return left>=$(element).offset().left+$(element).width()-settings.threshold;};$.inviewport=function(element,settings){return!$.rightofscreen(element,settings)&&!$.leftofscreen(element,settings)&&!$.belowthefold(element,settings)&&!$.abovethetop(element,settings);};$.extend($.expr[':'],{"below-the-fold":function(a,i,m){return $.belowthefold(a,{threshold:0});},"above-the-top":function(a,i,m){return $.abovethetop(a,{threshold:0});},"left-of-screen":function(a,i,m){return $.leftofscreen(a,{threshold:0});},"right-of-screen":function(a,i,m){return $.rightofscreen(a,{threshold:0});},"in-viewport":function(a,i,m){return $.inviewport(a,{threshold:0});}});})(jQuery);
2982
2983
2984
2985	/* *********************************************************************************************************************
2986	 * Width function override to fix mediaelements responsiveness
2987	 */
2988	var ish_orig_width = jQuery.fn.width;
2989
2990	jQuery.fn.width = function(){
2991
2992		var objClass = jQuery(this).attr("class");
2993
2994		if (objClass == 'mejs-time-rail')
2995		{
2996			if (arguments.length)
2997			{
2998				arguments[0] = arguments[0] - 1;
2999			}
3000		}
3001
3002		var ret = ish_orig_width.apply(this, arguments);
3003
3004		return ret;
3005	}
3006
3007})(jQuery);
3008
3009/* *********************************************************************************************************************
3010 * Global Functions
3011 */
3012
3013
3014// Charts bars animation -----------------------------------------------------------------------------------------------
3015function animateCharts(){
3016
3017	jQuery('.chart:in-viewport').each(function() {
3018		var me = jQuery(this);
3019		if (!me.hasClass('done')){
3020			me.addClass('done');
3021			var percent = parseInt( me.attr('data-percent') , 10 );
3022			me.data('easyPieChart').update(percent);
3023		}
3024	});
3025
3026}
3027
3028
3029// Color for Google map ------------------------------------------------------------------------------------------------
3030function rgb2hex(rgb){
3031	if (rgb.indexOf("#") == -1){
3032		rgb = rgb.match(/^rgb\((\d+),\s*(\d+),\s*(\d+)\)$/);
3033
3034		return "#" +
3035			("0" + parseInt(rgb[1],10).toString(16)).slice(-2) +
3036			("0" + parseInt(rgb[2],10).toString(16)).slice(-2) +
3037			("0" + parseInt(rgb[3],10).toString(16)).slice(-2);
3038	}
3039	else{
3040		return rgb;
3041	}
3042}
3043
3044
3045// Google map ------------------------------------------------------------------------------------------------------
3046function initialize(){
3047
3048	var $mapObject = jQuery('.ish-sc_map');
3049
3050
3051	// Google Maps module
3052	google.maps.visualRefresh = true;
3053
3054	// Init InfoBox
3055	if ($mapObject.length > 0){
3056		$mapObject.initGoogleMaps();
3057	}
3058
3059	$mapObject.each( function(){
3060
3061		me = jQuery(this);
3062
3063
3064		var styles = [
3065			{
3066				"stylers": [
3067					{ "invert_lightness" : !!(( 'yes' == me.attr('data-invert') )) },
3068					{ "hue": ( me.attr('data-color') ) ? rgb2hex( me.attr('data-color') ) : '' }
3069				]
3070
3071			},
3072			{
3073				"elementType": "geometry.fill",
3074				"stylers": [
3075					{ "weight": 2 }
3076				]
3077			}
3078		];
3079
3080		var positions = [];
3081		var locations = [];
3082
3083
3084		var $map_locations = me.find('.ish-sc_map_location');
3085
3086		var i = 1;
3087		$map_locations.each( function(){
3088			var latlngStr = jQuery(this).attr('data-latlng').split( ",", 2 );
3089			positions[i - 1] = new google.maps.LatLng( parseFloat(latlngStr[0]) , parseFloat(latlngStr[1]) );
3090			locations[i - 1] = jQuery(this);
3091			locations[i - 1].removeClass('ish-sc_map_location');
3092			i++;
3093		});
3094
3095
3096		if ( ! positions[0] ) {
3097			positions[0] = new google.maps.LatLng(0, 0);
3098		}
3099
3100		var zoom = 15;
3101
3102		if ( '' != me.attr('data-zoom') ){
3103			zoom = parseInt(me.attr('data-zoom'));
3104		}
3105
3106		var $mapOptions;
3107		$mapOptions = {
3108			center: positions[0],
3109			zoom: zoom,
3110			disableDefaultUI: true,
3111			backgroundColor: me.css('background-color'),       //Color used for the background of the Map div. This color will be visible when tiles have not yet loaded as the user pans. This option can only be set when the map is initialized.
3112			styles: styles,
3113			overviewMapControl: false,
3114			scrollwheel: false,                   //If false, disables scrollwheel zooming on the map. The scrollwheel is enabled by default.
3115			mapTypeControl: true,
3116			streetViewControl: true,
3117			rotateControl: true,
3118			zoomControl: true,
3119			zoomControlOptions: {
3120				style: google.maps.ZoomControlStyle.DEFAULT
3121			},
3122			mapTypeId: google.maps.MapTypeId.ROADMAP
3123		};
3124
3125		var $map;
3126		$map = new google.maps.Map(document.getElementById( me.attr('id') ), $mapOptions);
3127
3128
3129		var markers = new Array();
3130		var last_marker = null;
3131
3132		var infobox = null;
3133		var default_marker = {
3134			path: 'M768 896q0 106 -75 181t-181 75t-181 -75t-75 -181t75 -181t181 -75t181 75t75 181zM1024 896q0 -109 -33 -179l-364 -774q-16 -33 -47.5 -52t-67.5 -19t-67.5 19t-46.5 52l-365 774q-33 70 -33 179q0 212 150 362t362 150t362 -150t150 -362z',
3135			scale: 0.02,
3136			strokeWeight: 0,
3137			strokeColor: '#f74926',
3138			strokeOpacity: 1,
3139			fillColor: '#f74926',
3140			fillOpacity: 1,
3141			rotation: 180
3142		};
3143
3144		if ( jQuery('html').hasClass('ie8') ){
3145			default_marker = '//maps.google.com/mapfiles/ms/icons/red-dot.png';
3146		}
3147
3148
3149		for (var j = 0; j < positions.length; j++){
3150
3151			markers[j] = new google.maps.Marker({
3152				position: positions[j],
3153				map: $map,
3154				animation: google.maps.Animation.DROP,
3155				icon: default_marker,
3156				id : j
3157			});
3158
3159
3160			google.maps.event.addListener(markers[j], 'click', function() {
3161
3162				var box_class =  locations[this.id].attr('class');
3163				var box_style =  locations[this.id].attr('style');
3164
3165
3166				if ( 'undefined' != typeof(box_style) && box_style.length > 0 ) {
3167
3168					var stylestemp = box_style.split(';');
3169					var styles = {};
3170					var c = '';
3171					for (var x = 0, l = stylestemp.length -1 ; x < l; x++) {
3172						c = stylestemp[x].split(':');
3173						styles[ jQuery.trim( c[0] ) ] = jQuery.trim( c[1] );
3174					}
3175					box_style = styles;
3176
3177				}
3178
3179
3180
3181				var boxText = document.createElement("div");
3182				boxText.innerHTML = locations[this.id].html();
3183
3184				var box_offset = -160;
3185				if ( jQuery('html').hasClass('ie8') ){
3186					box_offset = -150;
3187				}
3188
3189				var myOptions = {
3190					content: boxText,
3191					disableAutoPan: false,
3192					maxWidth: 0,
3193					pixelOffset: new google.maps.Size( box_offset, 3 ),
3194					zIndex: null,
3195					boxClass: "ish-gmap_box " + box_class,
3196					closeBoxMargin: "10px 2px 2px 2px",
3197					closeBoxURL: "",
3198					infoBoxClearance: new google.maps.Size(1, 1),
3199					isHidden: false,
3200					pane: "floatPane",
3201					enableEventPropagation: false,
3202					boxStyle: box_style
3203				};
3204
3205				if (infobox) {
3206					infobox.close();
3207
3208					if (last_marker) {
3209						last_marker.setIcon(default_marker);
3210					}
3211				}
3212
3213				infobox = new InfoBox(myOptions);
3214				infobox.open($map, this);
3215
3216				if ( !jQuery('html').hasClass('ie8') ){
3217					var color_class = box_class.match(/color(\d+)/);
3218					if ( null !== color_class ){
3219
3220						this.setIcon({
3221							path: 'M768 896q0 106 -75 181t-181 75t-181 -75t-75 -181t75 -181t181 -75t181 75t75 181zM1024 896q0 -109 -33 -179l-364 -774q-16 -33 -47.5 -52t-67.5 -19t-67.5 19t-46.5 52l-365 774q-33 70 -33 179q0 212 150 362t362 150t362 -150t150 -362z',
3222							scale: 0.02,
3223							strokeWeight: 1,
3224							strokeColor: '#000000',
3225							strokeOpacity: 0.1,
3226							fillColor: iyb_globals.colors[color_class[0]],
3227							fillOpacity: 1,
3228							rotation: 180
3229						});
3230
3231					}
3232				}
3233
3234				last_marker = this;
3235
3236
3237			});
3238
3239		}
3240
3241		google.maps.event.addListener($map, 'click', function() {
3242			if(infobox){
3243				infobox.close();
3244				infobox = null;
3245			}
3246			if (last_marker) {
3247				last_marker.setIcon(default_marker);
3248				last_marker = null;
3249			}
3250		});
3251
3252
3253		jQuery(window).resize( function(){
3254			google.maps.event.trigger($map, 'resize');
3255			$map.setCenter(positions[0]);
3256		});
3257
3258	});
3259
3260}

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.