PageSourceSearch

https://pacificbridgearts.org/wp-content/themes/stockholm/js/default.js?ver=5.0.22

js pacificbridgearts.org collected 2026-10-02 18:09:07 UTC 227,648 bytes, 6,036 lines download raw bytes

1var $j = jQuery.noConflict();
2window.qode = {};
3qode.modules = {};
4
5var common = {};
6qode.modules.common = common;
7
8var $scroll = 0;
9var $scrollEnd = 0;
10var $scroll_direction;
11var qode_body = $j('body');
12var qode_document = $j('document');
13var qode_htmlEl = $j('html');
14var $window_width = $j(window).width();
15var $window_height = $j(window).height();
16var logo_height;
17var menu_dropdown_height_set = false;
18var sticky_amount = 0;
19var content_menu_position;
20var content_menu_top;
21var content_menu_top_add = 0;
22var src;
23var next_image;
24var prev_image;
25var $top_header_height;
26
27if (typeof paspartu_width_init === "undefined") {
28    var paspartu_width_init = 0.02;
29}
30var paspartu_width;
31
32
33
34var min_w = 1500; // minimum video width allowed
35var video_width_original = 1280;  // original video dimensions
36var video_height_original = 720;
37var vid_ratio = 1280/720;
38var skrollr_slider;
39
40if($j('.portfolio_single_sticky').length){
41    var stickyInfoTopOffset;
42    var stickyInfoHeight;
43}
44
45common.getLoadMoreData = getLoadMoreData;
46common.setLoadMoreAjaxData = setLoadMoreAjaxData;
47common.qodeEnableScroll = qodeEnableScroll;
48common.qodeDisableScroll = qodeDisableScroll;
49
50$j(document).ready(function() {
51    "use strict";
52
53    $j('.content').css('min-height',$j(window).height()-$j('header.page_header').height()-$j('footer').height());
54
55    if($j('header').hasClass('regular')){
56        content_menu_top = 0;
57    }
58    if($j('header').hasClass('fixed')){
59        content_menu_top = min_header_height_scroll;
60    }
61    if($j('header').hasClass('stick') || $j('header').hasClass('stick_with_left_right_menu')){
62        content_menu_top = 0;
63    }
64    if((!$j('header.page_header').hasClass('scroll_top')) && ($j('header.page_header').hasClass('has_top')) && ($j('header.page_header').hasClass('fixed'))){
65        content_menu_top_add = 33;
66    }
67    if($j('body').hasClass('vertical_menu_enabled')){
68        content_menu_top = 0;
69        content_menu_top_add = 0;
70        var min_header_height_sticky = 0;
71    }
72
73    //check paspartu width depending on window size
74    paspartu_width = $window_width < 1024 ? 0.02 : paspartu_width_init;
75
76
77    contentMinHeightWithPaspartu();
78
79    setDropDownMenuPosition();
80    initDropDownMenu();
81    initVerticalMenuToggle();
82    initVerticalMobileMenu();
83    initQodeSlider();
84    initSideMenu();
85    initPopupMenu();
86    initMessageHeight();
87    initToCounter();
88    initCounter();
89    initCountdown();
90    initProgressBars();
91    initListAnimation();
92    initPieChart();
93    initPieChartWithIcon();
94    initParallaxTitle();
95    initSideAreaScroll();
96    initVerticalAreaMenuScroll();
97    loadMore();
98    qodefPortfolioFullScreenSlider().init();
99    prettyPhoto();
100    initMobileMenu();
101    initFlexSlider();
102    fitVideo();
103    fitAudio();
104    initAccordion();
105    initAccordionContentLink();
106    initMessages();
107    initProgressBarsIcon();
108    initMoreFacts();
109    placeholderReplace();
110    backButtonShowHide();
111    backToTop();
112    initProgressBarsVertical();
113    initElementsAnimation();
114    updateShoppingCart();
115    initHashClick();
116    initImageHover();
117    initIconWithTextAnimation();
118    initVideoBackground();
119    initCheckSafariBrowser();
120    initCheckFirefoxMacBrowser();
121    initSearchButton();
122    initCoverBoxes();
123    createContentMenu();
124    contentMenuScrollTo();
125    createSelectContentMenu();
126    initButtonHover();
127    initSocialIconHover();
128    initIconHover();
129    alterWPMLSwitcherHeaderBottom();
130    intPortfolioOWLSlider();
131    intCarouselOWLSlider();
132    qodeOwlSlider();
133    qodeShowGoogleMap();
134    qodeInitClosedSideAreaMenuWidget();
135
136    $j('.widget #searchform').mousedown(function(){$j(this).addClass('form_focus');}).focusout(function(){$j(this).removeClass('form_focus');});
137    $scroll = $j(window).scrollTop();
138    checkTitleToShowOrHide(); //this has to be after setting $scroll since function uses $scroll variable
139    checkVerticalMenuTransparency(); //this has to be after setting $scroll since function uses $scroll variable
140
141    /* set header and content menu position and appearance on page load - START */
142    if($j(window).width() > 1000){
143        headerSize($scroll);
144    }else{
145        logoSizeOnSmallScreens();
146    }
147
148    $j('header:not(.stick_with_left_right_menu) .q_logo a').css('visibility','visible');
149    /* set header and content menu position and appearance on page load - END */
150
151    if($j(window).width() > 768){
152        contentMenuPosition();
153    }
154    contentMenuCheckLastSection();
155
156    initFullScreenTemplate();
157    qodeParallaxHolder();
158    qodeRowAnimateBackground();
159});
160
161$j(window).load(function(){
162    "use strict";
163
164    $j('.touch .main_menu li:has(div.second)').doubleTapToGo(); // load script to close menu on touch devices
165    setDropDownMenuPosition();
166    initDropDownMenu();
167    initPortfolio();
168    initPortfolioZIndex();
169    initPortfolioSingleInfo();
170    initTestimonials();
171    initTwitterShortcode();
172    initVideoBackgroundSize();
173    initBlog();
174    initBlogMasonryFullWidth();
175    initBlogChequered();
176    initPortfolioMasonry();
177    //initPortfolioMasonryFilter();
178    initPortfolioSingleMasonry();
179    initTabs();
180    animatedTextIconHeight();
181    countAnimatedTextIconPerRow();
182    initTitleAreaAnimation();
183    setContentBottomMargin();
184    footerWidth();
185    initPortfolioJustifiedGallery();
186    qodeInitBlogListShortcodeAppear();
187    qodeInitImageWithOverlappingInfo();
188
189    if($j('nav.content_menu').length > 0){
190        content_menu_position = $j('nav.content_menu').offset().top;
191        contentMenuPosition();
192    }
193    contentMenuCheckLastSection();
194    initQodeCarousel();
195    initPortfolioSlider();
196    setFooterHeight();
197
198    stickyInfoPortfolioWidth();
199
200    if($j('.portfolio_single_sticky').length){
201        stickyInfoTopOffset = $j('.portfolio_single_sticky').offset().top;
202        stickyInfoHeight = $j('.portfolio_single_sticky').height();
203    }
204    if($j(window).width() > 600){
205        stickyInfoPortfolio($scroll, stickyInfoTopOffset, stickyInfoHeight);
206    }
207    removeStickyInfoPortfolioClass();
208
209
210
211    $j('header.stick_with_left_right_menu .q_logo a').css('visibility','visible');
212
213    if($j('.portfolio_justified_gallery').length) {
214        $j('.portfolio_justified_gallery').css('opacity', '1');
215    }
216
217    setMargingsForLeftAndRightMenu();
218    initImageGallerySliderNoSpace();
219    initParallax(); //has to be here on last place since some function is interfering with parallax
220    setTimeout(function(){
221        checkAnchorOnScroll();
222        checkAnchorOnLoad(); // it has to be after content top margin initialization to know where to scroll
223    },700); //timeout is set because of some function that interferes with calculating
224});
225
226$j(window).scroll(function() {
227    "use strict";
228
229    $scroll = $j(window).scrollTop();
230    if ($scroll > $scrollEnd) {
231        $scroll_direction = 'down';
232    }
233    else {
234        $scroll_direction = 'up';
235    }
236    $scrollEnd = $scroll;
237    if($j(window).width() > 1000){
238        headerSize($scroll);
239    }
240
241    if($j(window).width() > 768){
242        contentMenuPosition();
243    }
244    contentMenuCheckLastSection();
245    checkVerticalMenuTransparency();
246
247    if($j(window).width() > 600){
248        stickyInfoPortfolio($scroll, stickyInfoTopOffset, stickyInfoHeight);
249    }
250
251    $j('.touch .drop_down > ul > li').mouseleave();
252    $j('.touch .drop_down > ul > li').blur();
253});
254
255$j(window).resize(function() {
256    "use strict";
257
258    $window_width = $j(window).width();
259    $window_height = $j(window).height();
260
261    //check paspartu width depending on window size
262    paspartu_width = $window_width < 1024 ? 0.02 : paspartu_width_init;
263
264    if($j(window).width() > 1000){
265        headerSize($scroll);
266    }else{
267        logoSizeOnSmallScreens();
268    }
269    stickyInfoPortfolioWidth();
270    if($j(window).width() > 600){
271        stickyInfoHeight = $j('.portfolio_single_sticky').height();
272        stickyInfoPortfolio($scroll, stickyInfoTopOffset, stickyInfoHeight);
273    }
274    removeStickyInfoPortfolioClass();
275    intCarouselOWLSlider();
276    initMessageHeight();
277    initTestimonials();
278    initTwitterShortcode();
279    fitAudio();
280    initBlog();
281    initBlogMasonryFullWidth();
282    initPortfolioSingleMasonry();
283    initBlogChequered();
284    animatedTextIconHeight();
285    countAnimatedTextIconPerRow();
286    initVideoBackgroundSize();
287    setContentBottomMargin();
288    footerWidth();
289    setFooterHeight();
290    calculateHeights();
291});
292
293/*
294 **	Calculating header size on page load and page scroll
295 */
296var sticky_animate;
297function headerSize($scroll){
298    "use strict";
299
300    if(($j('header.page_header').hasClass('scroll_top')) && ($j('header.page_header').hasClass('has_top')) && ($j('header.page_header').hasClass('fixed'))){
301        if($scroll >= 0 && $scroll <= 33){
302            $j('header.page_header').css('top',-$scroll);
303            $j('header.page_header').css('margin-top',0);
304            $j('.header_top').show();
305        }else if($scroll > 33){
306            $j('header.page_header').css('top','-33px');
307            $j('header.page_header').css('margin-top',33);
308            $j('.header_top').hide();
309        }
310    }
311
312    //is scroll amount for sticky set on page?
313    if(typeof page_scroll_amount_for_sticky !== 'undefined') {
314        sticky_amount = page_scroll_amount_for_sticky;
315    }
316    //do we have slider on the page?
317    else if($j('.carousel.full_screen').length) {
318        sticky_amount = $j('.carousel').height();
319    }
320
321    //take value from theme options
322    else {
323        sticky_amount = scroll_amount_for_sticky;
324    }
325
326    if($j('header').hasClass('regular')){
327        if(header_height - logo_height > 0){
328            $j('.q_logo a').height(logo_height);
329        }else{
330            $j('.q_logo a').height(header_height);
331        }
332
333        $j('.q_logo a img').css('height','100%');
334    }
335
336    if($j('header.page_header').hasClass('fixed')){
337        if($j('header.page_header').hasClass('scroll_top')){
338            $top_header_height = 33;
339        }else{
340            $top_header_height = 0;
341        }
342
343        if((header_height - $scroll + $top_header_height >= min_header_height_scroll) && ($scroll >= $top_header_height)){
344            $j('header.page_header').removeClass('scrolled');
345            $j('header:not(.centered_logo.centered_logo_animate) nav.main_menu > ul > li > a').css('line-height', header_height - $scroll + $top_header_height+'px');
346            $j('header:not(.centered_logo.centered_logo_animate) .side_menu_button').css('height', header_height - $scroll + $top_header_height+'px');
347            $j('header:not(.centered_logo.centered_logo_animate) .shopping_cart_inner').css('height', header_height - $scroll + $top_header_height+'px');
348            $j('header:not(.centered_logo.centered_logo_animate) .logo_wrapper').css('height', header_height - $scroll + $top_header_height +'px');
349            $j('.header_bottom .qode-login-register-widget.qode-user-not-logged-in .qode-login-opener').css({'height': header_height - $scroll + $top_header_height +'px','line-height': header_height - $scroll + $top_header_height +'px'});
350            $j('.header_bottom .qode-login-register-widget.qode-user-logged-in .qode-logged-in-user .qode-logged-in-user-inner > span').css({'height': header_height - $scroll + $top_header_height +'px','line-height': header_height - $scroll + $top_header_height +'px'});
351
352            if(header_height - logo_height > 0){
353                $j('header:not(.centered_logo.centered_logo_animate) .q_logo a').css('height', logo_height +'px');
354            }else{
355                $j('header:not(.centered_logo.centered_logo_animate) .q_logo a').css('height', (header_height - $scroll + $top_header_height) +'px');
356            }
357
358        }else if($scroll < $top_header_height){
359            $j('header.page_header').removeClass('scrolled');
360            $j('header:not(.centered_logo.centered_logo_animate) nav.main_menu > ul > li > a').css('line-height', header_height+'px');
361            $j('header:not(.centered_logo.centered_logo_animate) .side_menu_button').css('height', header_height+'px');
362            $j('header:not(.centered_logo.centered_logo_animate) .shopping_cart_inner').css('height', header_height+'px');
363            $j('header:not(.centered_logo.centered_logo_animate) .logo_wrapper').css('height', header_height+'px');
364            $j('.header_bottom .qode-login-register-widget.qode-user-not-logged-in .qode-login-opener').css({'height': header_height+'px','line-height': header_height+'px'});
365            $j('.header_bottom .qode-login-register-widget.qode-user-logged-in .qode-logged-in-user .qode-logged-in-user-inner > span').css({'height': header_height+'px','line-height': header_height+'px'});
366            if(header_height - logo_height > 0){
367                $j('header:not(.centered_logo.centered_logo_animate) .q_logo a').css('height', logo_height +'px');
368            }else{
369                $j('header:not(.centered_logo.centered_logo_animate) .q_logo a').css('height', header_height +'px');
370            }
371
372        }else if((header_height - $scroll + $top_header_height) < min_header_height_scroll){
373            $j('header.page_header').addClass('scrolled');
374            $j('header:not(.centered_logo.centered_logo_animate) nav.main_menu > ul > li > a').css('line-height', min_header_height_scroll+'px');
375            $j('header:not(.centered_logo.centered_logo_animate) .side_menu_button').css('height', min_header_height_scroll+'px');
376            $j('header:not(.centered_logo.centered_logo_animate) .shopping_cart_inner').css('height', min_header_height_scroll+'px');
377            $j('header:not(.centered_logo.centered_logo_animate) .logo_wrapper').css('height', min_header_height_scroll+'px');
378            $j('.header_bottom .qode-login-register-widget.qode-user-not-logged-in .qode-login-opener').css({'height': min_header_height_scroll+'px','line-height': min_header_height_scroll+'px'});
379            $j('.header_bottom .qode-login-register-widget.qode-user-logged-in .qode-logged-in-user .qode-logged-in-user-inner > span').css({'height': min_header_height_scroll+'px', 'line-height': min_header_height_scroll+'px'});
380            if(min_header_height_scroll - logo_height > 0){
381                $j('header:not(.centered_logo.centered_logo_animate) .q_logo a').css('height', logo_height +'px');
382            }else{
383                $j('header:not(.centered_logo.centered_logo_animate) .q_logo a').css('height', min_header_height_scroll+'px');
384            }
385        }
386
387        // logo part - start //
388
389        if($j('header.page_header').hasClass('centered_logo') && $j('header.page_header').hasClass('centered_logo_animate')){
390            if((header_height - $scroll + $top_header_height < logo_height) && (header_height - $scroll + $top_header_height >= min_header_height_scroll) && (logo_height > min_header_height_scroll) && ($scroll >
390= $top_header_height)){
391                $j('.q_logo a').height(header_height - $scroll + $top_header_height);
392            }else if((header_height - $scroll + $top_header_height < logo_height) && (header_height - $scroll + $top_header_height >= min_header_height_scroll) && (logo_height > min_header_height_scroll) && ($scroll < $top_header_height)){
393                $j('.q_logo a').height(header_height);
394            }else if((header_height - $scroll + $top_header_height < logo_height) && (header_height - $scroll + $top_header_height < min_header_height_scroll) && (logo_height > min_header_height_scroll)){
395                $j('.q_logo a').height(min_header_height_scroll);
396            }else if((header_height - $scroll + $top_header_height < logo_height) && (header_height - $scroll + $top_header_height < min_header_height_scroll) && (logo_height < min_header_height_scroll)){
397                $j('.q_logo a').height(logo_height);
398            }else if(($scroll + $top_header_height === 0) && (logo_height > header_height)){
399                $j('.q_logo a').height(logo_height);
400            }else{
401                $j('.q_logo a').height(logo_height);
402            }
403        }else if($j('header.page_header').hasClass('centered_logo')) {
404            $j('.q_logo a').height(logo_height);
405            $j('.q_logo img').height('auto');
406        }else{
407            $j('.q_logo img').height('100%');
408        }
409        // logo part - end //
410    }
411
412    if($j('header.page_header').hasClass('fixed_hiding')){
413
414        if($scroll < scroll_amount_for_fixed_hiding){
415            $j('header.page_header').removeClass('scrolled');
416        }else{
417            $j('header.page_header').addClass('scrolled');
418        }
419
420        $j('.q_logo a').height(logo_height/2); //because of retina displays
421        $j('.q_logo img').height('100%');
422    }
423
424    if($j('header.page_header').hasClass('stick') || $j('header.page_header').hasClass('stick_with_left_right_menu')){
425        if($scroll > sticky_amount){
426            if(!$j('header.page_header').hasClass('sticky')){
427                if($j('header.page_header').hasClass('has_top')){
428                    $top_header_height = 33;
429                }else{
430                    $top_header_height = 0;
431                }
432                var padding_top = $j('header.page_header').hasClass('centered_logo') ? $j('header.page_header').height() : header_height + $top_header_height;
433                if($j('header.page_header').hasClass('menu_bottom')){
434                    padding_top = header_height + 60; //60 is menu height for Sticky Advance header type
435                }
436                $j('header.page_header').addClass('sticky');
437                $j('.content').css('padding-top',padding_top);
438
439                window.clearTimeout(sticky_animate);
440                sticky_animate = window.setTimeout(function(){$j('header.page_header').addClass('sticky_animate');},100);
441
442                if(min_header_height_sticky - logo_height > 0){
443                    $j('.q_logo a').height(logo_height);
444                }else{
445                    $j('.q_logo a').height(min_header_height_sticky);
446                }
447
448                if($j('header.page_header').hasClass('menu_bottom')){
449                    initDropDownMenu(); //recalculate dropdown menu position
450                }
451            }
452
453            if(min_header_height_sticky - logo_height > 0){
454                $j('.q_logo a').height(logo_height);
455            }else{
456                $j('.q_logo a').height(min_header_height_sticky);
457            }
458            //  logo part - end //
459        }else{
460            if($j('header.page_header').hasClass('sticky')){
461                $j('header').removeClass('sticky_animate');
462                $j('header').removeClass('sticky');
463                $j('.content').css('padding-top','0px');
464
465                if($j('header.page_header').hasClass('menu_bottom')){
466                    initDropDownMenu(); //recalculate dropdown menu position
467                }
468            }
469
470            setMargingsForLeftAndRightMenu();
471
472            // logo part - start //
473            if(!$j('header.page_header').hasClass('centered_logo')){
474                if(header_height - logo_height > 0){
475                    $j('.q_logo a').height(logo_height);
476                }else{
477                    $j('.q_logo a').height(header_height);
478                }
479            }else{
480                $j('.q_logo a').height(logo_height);
481                $j('.q_logo img').height('auto');
482            }
483            $j('.q_logo a img').css('height','100%');
484            // logo part - end //
485        }
486    }
487}
488
489function setMargingsForLeftAndRightMenu(){
490    "use strict";
491
492    if($j('header.page_header').hasClass('stick_with_left_right_menu') && !$j('header.page_header').hasClass('left_right_margin_set')){
493        var logo_width = $j('.q_logo a img').width()/2;
494        if($scroll === 0 && logo_width !== 0){
495            $j('header.page_header').addClass('left_right_margin_set');
496        }
497        $j('.logo_wrapper').width(logo_width*2);
498        $j('nav.main_menu.left_side > ul > li:last-child').css('margin-right',logo_width);
499        $j('nav.main_menu.right_side > ul > li:first-child').css('margin-left',logo_width);
500    }
501}
502
503/*
504 **	Calculating logo size on smaller screens
505 */
506function logoSizeOnSmallScreens() { 
507"use strict"; 
508    var headerHeight=$j('.page_header').outerHeight(); 
509        headerHeight - logo_height > 0 ? $j(".q_logo a").height(logo_height) : $j(".q_logo a").height(headerHeight), 
510    $j(".q_logo a img").css("height", "100%"), 
511    $j("header.page_header").removeClass("sticky_animate sticky"), 
512    $j(".content").css("padding-top", "0px") 
513}
514
515/*
516 **	Initialize Qode Slider
517 */
518var default_header_style;
519function initQodeSlider(){
520    "use strict";
521
522    var image_regex = /url\(["']?([^'")]+)['"]?\)/;
523    default_header_style = "";
524    if($j('header.page_header').hasClass('light')){ default_header_style = 'light';}
525    if($j('header.page_header').hasClass('dark')){ default_header_style = 'dark';}
526
527    if($j('.carousel').length){
528        $j('.carousel').each(function(){
529            var $this = $j(this);
530            var mobile_header;
531
532            var paspartu_amount_with_top = $j('.paspartu_top').length > 0 ? Math.round($window_width*paspartu_width ) : 0;
533            var paspartu_amount_with_bottom = $j('.paspartu_bottom').length > 0 ? Math.round($window_width*paspartu_width) : 0;
534
535            if($this.hasClass('full_screen')){
536
537                mobile_header = $j(window).width() < 1000 ? $j('header.page_header').height() - 6 : 0; // 6 is because of the display: inline-block
538                $this.css({'height': ($j(window).height() - mobile_header - paspartu_amount_with_top - paspartu_amount_with_bottom) + 'px'});
539                $this.find('.qode_slider_preloader').css({'height': ($j(window).height() - mobile_header - paspartu_amount_with_top - paspartu_amount_with_bottom) + 'px'});
540                $this.find('.qode_slider_preloader .ajax_loader').css({'display': 'block'});
541                $this.find('.item').css({'height': ($j(window).height() - mobile_header - paspartu_amount_with_top - paspartu_amount_with_bottom) + 'px'});
542                $j(window).resize(function() {
543                    var mobile_header = $j(window).width() < 1000 ? $j('header.page_header').height() - 6 : 0; // 6 is because of the display: inline-block
544                    $this.css({'height': ($j(window).height() - mobile_header - paspartu_amount_with_top - paspartu_amount_with_bottom) + 'px'});
545                    $this.find('.item').css({'height': ($j(window).height() - mobile_header - paspartu_amount_with_top - paspartu_amount_with_bottom) + 'px'});
546                });
547            }else if($this.hasClass('responsive_height')){
548                mobile_header = $j(window).width() < 1000 ? $j('header.page_header').height() - 6 : 0; // 6 is because of the display: inline-block
549                var $def_height = $this.data('height');
550
551                $this.find('.qode_slider_preloader').css({'height': ($this.height() - mobile_header - paspartu_amount_with_top - paspartu_amount_with_bottom) + 'px', 'display': 'block'});
552                var slider_height = $def_height;
553                if($window_width > 1600){
554                    var slider_height = $def_height;
555                }else if($window_width <= 1600 && $window_width > 1300){
556                    var slider_height = $def_height * 0.8;
557                }else if($window_width <= 1300 && $window_width > 1000){
558                    var slider_height = $def_height * 0.8;
559                }else if($window_width <= 1000 && $window_width > 768){
560                    var slider_height = $def_height * 0.55;
561                }else if($window_width <= 768){
562                    var slider_height = $def_height * 1;
563                }
564
565                $this.css({'height': (slider_height) + 'px'});
566                $this.find('.qode_slider_preloader').css({'height': (slider_height) + 'px'});
567                $this.find('.qode_slider_preloader .ajax_loader').css({'display': 'block'});
568                $this.find('.item').css({'height': (slider_height) + 'px'});
569
570                $j(window).resize(function() {
571
572                    if($window_width > 1600){
573                        var slider_height = $def_height;
574                    }else if($window_width <= 1600 && $window_width > 1300){
575                        var slider_height = $def_height * 0.8;
576                    }else if($window_width <= 1300 && $window_width > 1000){
577                        var slider_height = $def_height * 0.8;
578                    }else if($window_width <= 1000 && $window_width > 768){
579                        var slider_height = $def_height * 0.55;
580                    }else if($window_width <= 768){
581                        var slider_height = $def_height * 1;
582                    }
583
584                    $this.css({'height': (slider_height) + 'px'});
585                    $this.find('.item').css({'height': (slider_height) + 'px'});
586                });
587            }else {
588                mobile_header = $j(window).width() < 1000 ? $j('header.page_header').height() - 6 : 0; // 6 is because of the display: inline-block
589                $this.find('.qode_slider_preloader').css({'height': ($this.height() - mobile_header) + 'px', 'display': 'block'});
590                $this.find('.qode_slider_preloader .ajax_loader').css({'display': 'block'});
591            }
592
593            if($j('body:not(.boxed):not(.vertical_menu_transparency)').hasClass('vertical_menu_enabled') && $j(window).width() > 1000){
594                var paspartu_add = $j('body').hasClass('paspartu_enabled') ? 2*Math.round($window_width*paspartu_width) : 0; //2 times paspartu (left and right side)
595                $this.find('.carousel-inner').width($window_width - 260 - paspartu_add);
596                $j(window).resize(function() {
597                    if($j(window).width() > 1000){
598                        paspartu_add = $j('body').hasClass('paspartu_enabled') ? 2*Math.round($window_width*paspartu_width) : 0; //2 times paspartu (left and right side)
599                        $this.find('.carousel-inner').width($window_width - 260 - paspartu_add);
600                    } else {
601                        $this.find('.carousel-inner').css('width','100%');
602                    }
603                });
604            }
605
606            $j(window).scroll(function() {
607                if($scroll > $j(window).height() && $j(window).width() > 1000){
608                    $this.find('.carousel-inner, .carousel-indicators, button').hide();
609                }else{
610                    $this.find('.carousel-inner, .carousel-indicators, button').show();
611                }
612            });
613
614            var $slide_animation = $this.data('slide_animation');
615            if($slide_animation === ""){
616                $slide_animation = 6000;
617            }
618
619            // function for setting prev/next numbers on arrows
620            var all_items_count = $j('div.item').length;
621            function setPrevNextNumbers(curr_item, all_items_count){
622                if(curr_item == 1){
623                    $this.find('.left.carousel-control .prev').html(all_items_count);
624                    $this.find('.right.carousel-control .next').html(curr_item + 1);
625                }else if(curr_item == all_items_count){
626                    $this.find('.left.carousel-control .prev').html(curr_item - 1);
627                    $this.find('.right.carousel-control .next').html(1);
628                }else{
629                    $this.find('.left.carousel-control .prev').html(curr_item - 1);
630                    $this.find('.right.carousel-control .next').html(curr_item + 1);
631                }
632            }
633
634            function initSlider(){
635                //set active class on first item
636                $this.find('.carousel-inner .item:first-child').addClass('active');
637                checkSliderForHeaderStyle($j('.carousel .active'), $this.hasClass('header_effect'));
638
639                if($this.hasClass('slider_thumbs')){
640                    // initial state of prev/next numbers
641                    setPrevNextNumbers(1, all_items_count);
642
643                    //set prev and next thumb on load
644                    if($this.find('.active').next('div').find('.image').length){
645                        src = image_regex.exec($this.find('.active').next('div').find('.image').attr('style'));
646                        next_image = new Image();
647                        next_image.src = src[1];
648                    }else{
649                        next_image = $this.find('.active').next('div').find('> .video').clone();
650                        next_image.find('.video-overlay').remove();
651                        next_image.find('.video-wrap').width(170).height(95);
652                        next_image.find('.mejs-container').width(170).height(95);
653                        next_image.find('video').width(170).height(95);
654                    }
655                    $this.find('.right.carousel-control .img').html(next_image).find('img, div.video').addClass('old');
656
657                    if($this.find('.carousel-inner .item:last-child .image').length){
658                        src = image_regex.exec($this.find('.carousel-inner .item:last-child .image').attr('style'));
659                        prev_image = new Image();
660                        prev_image.src = src[1];
661                    }else{
662                        prev_image = $this.find('.carousel-inner .item:last-child > .video').clone();
663                        prev_image.find('.video-overlay').remove();
664                        prev_image.find('.video-wrap').width(170).height(95);
665                        prev_image.find('.mejs-container').width(170).height(95);
666                        prev_image.find('video').width(170).height(95);
667                    }
668                    $this.find('.left.carousel-control .img').html(prev_image).find('img, div.video').addClass('old');
669                }
670
671                if($this.hasClass('q_auto_start')){
672                    $this.carousel({
673                        interval: $slide_animation,
674                        pause: false
675                    });
676                } else {
677                    $this.carousel({
678                        interval: 0,
679                        pause: false
680                    });
681                }
682                if($this.find('.item video').length){
683                    initVideoBackgroundSize();
684                }
685            }
686
687            if($j('html').hasClass('touch')){
688                if($this.find('.item:first-child .mobile-video-image').length > 0){
689                    src = image_regex.exec($this.find('.item:first-child .mobile-video-image').attr('style'));
690                    if (src) {
691                        var backImg = new Image();
692                        backImg.src = src[1];
693                        $j(backImg).load(function(){
694                            $j('.qode_slider_preloader').fadeOut(500);
695                            initSlider();
696                        });
697                    }
698                }
699                else{
700                    src = image_regex.exec($this.find('.item:first-child .image').attr('style'));
701                    if (src) {
702                        var backImg = new Image();
703                        backImg.src = src[1];
704                        $j(backImg).load(function(){
705                            $j('.qode_slider_preloader').fadeOut(500);
706                            initSlider();
707                        });
708                    }
709                }
710            } else {
711                if($this.find('.item:first-child video').length > 0){
712                    $this.find('.item:first-child video').get(0).addEventListener('loadeddata',function(){
713                        $j('.qode_slider_preloader').fadeOut(500);
714                        initSlider();
715                    });
716                }else{
717                    src = image_regex.exec($this.find('.item:first-child .image').attr('style'));
718                    if (src) {
719                        var backImg = new Image();
720                        backImg.src = src[1];
721                        $j(backImg).load(function(){
722                            $j('.qode_slider_preloader').fadeOut(500);
723                            initSlider();
724                        });
725                    }
726                }
727            }
728
729            $this.on('slide.bs.carousel', function () {
730                $this.addClass('in_progress');
731                $this.find('.active .slider_content_outer').fadeTo(800,0);
732            });
733            $this.on('slid.bs.carousel', function () {
734                $this.removeClass('in_progress');
735                $this.find('.active .slider_content_outer').fadeTo(0,1);
736
737                if($this.hasClass('slider_thumbs')){
738                    var curr_item = $j('div.item').index($j('div.item.active')[0]) + 1;
739                    setPrevNextNumbers(curr_item, all_items_count);
740
741                    // prev thumb
742                    if($this.find('.active').prev('div.item').length){
743                        if($this.find('.active').prev('div').find('.image').length){
744                            src = image_regex.exec($this.find('.active').prev('div').find('.image').attr('style'));
745                            prev_image = new Image();
746                            prev_image.src = src[1];
747                        }else{
748                            prev_image = $this.find('.active').prev('div').find('> .video').clone();
749                            prev_image.find('.video-overlay').remove();
750                            prev_image.find('.video-wrap').width(170).height(95);
751                            prev_image.find('.mejs-container').width(170).height(95);
752                            prev_image.find('video').width(170).height(95);
753                        }
754                        $this.find('.left.carousel-control .img .old').fadeOut(300,function(){
755                            $j(this).remove();
756                        });
757                        $this.find('.left.carousel-control .img').append(prev_image).find('img, div.video').fadeIn(300).addClass('old');
758
759                    }else{
760                        if($this.find('.carousel-inner .item:last-child .image').length){
761                            src = image_regex.exec($this.find('.carousel-inner .item:last-child .image').attr('style'));
762                            prev_image = new Image();
763                            prev_image.src = src[1];
764                        }else{
765                            prev_image = $this.find('.carousel-inner .item:last-child > .video').clone();
766                            prev_image.find('.video-overlay').remove();
767                            prev_image.find('.video-wrap').width(170).height(95);
768                            prev_image.find('.mejs-container').width(170).height(95);
769                            prev_image.find('video').width(170).height(95);
770                        }
771                        $this.find('.left.carousel-control .img .old').fadeOut(300,function(){
772                            $j(this).remove();
773                        });
774                        $this.find('.left.carousel-control .img').append(prev_image).find('img, div.video').fadeIn(300).addClass('old');
775                    }
776
777                    // next thumb
778                    if($this.find('.active').next('div.item').length){
779                        if($this.find('.active').next('div').find('.image').length){
780                            src = image_regex.exec($this.find('.active').next('div').find('.image').attr('style'));
781                            next_image = new Image();
782                            next_image.src = src[1];
783                        }else{
784                            next_image = $this.find('.active').next('div').find('> .video').clone();
785                            next_image.find('.video-overlay').remove();
786                            next_image.find('.video-wrap').width(170).height(95);
787                            next_image.find('.mejs-container').width(170).height(95);
788                            next_image.find('video').width(170).height(95);
789                        }
790
791                        $this.find('.right.carousel-control .img .old').fadeOut(300,function(){
792                            $j(this).remove();
793                        });
794                        $this.find('.right.carousel-control .img').append(next_image).find('img, div.video').fadeIn(300).addClass('old');
795
796                    }else{
797                        if($this.find('.carousel-inner .item:first-child .image').length){
798                            src = image_regex.exec($this.find('.carousel-inner .item:first-child .image').attr('style'));
799                            next_image = new Image();
800                            next_image.src = src[1];
801                        }else{
802                            next_image = $this.find('.carousel-inner .item:first-child > .video').clone();
803                            next_image.find('.video-overlay').remove();
804                            next_image.find('.video-wrap').width(170).height(95);
805                            next_image.find('.mejs-container').width(170).height(95);
806                            next_image.find('video').width(170).height(95);
807                        }
808                        $this.find('.right.carousel-control .img .old').fadeOut(300,function(){
809                            $j(this).remove();
810                        });
811                        $this.find('.right.carousel-control .img').append(next_image).find('img, div.video').fadeIn(300).addClass('old');
812                    }
813                }
814            });
815
816            $this.swipe( {
817                swipeLeft: function(event, direction, distance, duration, fingerCount){ $this.carousel('next'); },
818                swipeRight: function(event, direction, distance, duration, fingerCount){ $this.carousel('prev'); },
819                threshold:20
820            });
821
822        });
823
824        if($j('.carousel').data('parallax') == 'yes'){
825            if ($j('.no-touch .carousel').length) {
826                skrollr_slider = skrollr.init({
827                    edgeStrategy: 'set',
828                    smoothScrolling: true,
829                    forceHeight: false
830                });
831                skrollr_slider.refresh();
832            }
833        }
834    }
835}
836
837function checkSliderForHeaderStyle($this, header_effect){
838    "use strict";
839
840    var slide_header_style = "";
841    if($this.hasClass('light')){ slide_header_style = 'light';}
842    if($this.hasClass('dark')){ slide_header_style = 'dark';}
843
844    if( slide_header_style !== ""){
845        if(header_effect){
846            $j('header.page_header').removeClass('dark light').addClass(slide_header_style);
847            $j('aside.vertical_menu_area').removeClass('dark light').addClass(slide_header_style);
848        }
849        $j('.carousel .carousel-control, .carousel .carousel-indicators').removeClass('dark light').addClass(slide_header_style);
850    }else{
851        if(header_effect) {
852            if(default_header_style !== '') {
853                $j('header.page_header').removeClass('dark light').addClass(default_header_style);
854                $j('aside.vertical_menu_area').removeClass('dark light').addClass(default_header_style);
855            }
856        }
857        $j('.carousel .carousel-control, .carousel .carousel-indicators').removeClass('dark light').addClass(default_header_style);
858    }
859}
860
861/*
862 ** Set heights for qode carousel and portfolio slider
863 */
864function calculateHeights(){
865    if($j('.portfolio_slides').length){
866        $j('.portfolio_slides').each(function(){
867            $j(this).parents('.caroufredsel_wrapper').css({'height' : ($j(this).find('li.item').outerHeight()-3) + 'px'}); //3 is because of the white line bellow the slider
868        });
869    }
870
871    if($j('.qode_carousels .slides').length){
872        $j('.qode_carousels .slides').each(function(){
873            $j(this).parents('.caroufredsel_wrapper').css({'height' : ($j(this).find('li.item').outerHeight()) + 'px'});
874        });
875    }
876}
877
878/*
879 ** Init Qode Carousel
880 */
881function initQodeCarousel(){
882    "use strict";
883
884    if($j('.qode_carousels:not(.carousel_owl)').length){
885        $j('.qode_carousels:not(.carousel_owl)').each(function(){
886            var instance = this;
887
888            var number_of_items;
889            var items_number_set;
890            var fullWidth  = (!($j(this).parents('.grid_section').length == 1) && ($j(this).parents('.page-template-full_width').length == 1)) ? true : false;
891            if(typeof $j(this).data('number_of_items') !== 'undefined') {
892                number_of_items = $j(this).data('number_of_items');
893                items_number_set = true;
894            }
895            else {
896                number_of_items = 5;
897                items_number_set = false;
898            }
899
900            var itemWidth = ($j(this).parents('.grid_section').length == 1) ? 216 : 380;
901
902            var itemWidthTemp;
903
904            if (fullWidth) {
905                switch (number_of_items) {
906                    case 3:
907                        itemWidthTemp = 660;
908                        break;
909                    case 4:
910                        itemWidthTemp = 500;
911                        break;
912                    case 5:
913                        itemWidthTemp = 380;
914                        break;
915                    default:
916                        itemWidthTemp = 380;
917
918                        break;
919                }
920            }
921            else {
922                switch (number_of_items) {
923                    case 3:
924                        itemWidthTemp = 380;
925                        break;
926                    case 4:
927                        itemWidthTemp = 275;
928                        break;
929                    case 5:
930                        itemWidthTemp = 216;
931                        break;
932                    default:
933                        itemWidthTemp = 216;
934
935                        break;
936                }
937            }
938
939            itemWidth = (items_number_set) ? itemWidthTemp : itemWidth;
940
941            $j(this).find('.slides').carouFredSel({
942                circular: true,
943                responsive: true,
944                scroll : {
945                    items           : 1,
946                    duration        : 1000,
947                    pauseOnHover    : false
948                },
949                prev : {
950                    button : function() {
951                        return $j(this).parent().siblings('.caroufredsel-direction-nav').find('.qode_carousel_prev');
952                    }
953                },
954                next : {
955                    button : function() {
956                        return $j(this).parent().siblings('.caroufredsel-direction-nav').find('.qode_carousel_next');
957                    }
958                },
959                items: {
960                    width: itemWidth,
961                    visible: {
962                        min: 1,
963                        max: number_of_items
964                    }
965                },
966                auto: true,
967                mousewheel: false,
968                swipe: {
969                    onMouse: true,
970                    onTouch: true
971                }
972
973            }).animate({'opacity': 1},1000);
974        });
975        calculateHeights();
976    }
977}
978
979
980/*
981 **	Init portfolio owl slider
982 */
983function intCarouselOWLSlider(){
984    "use strict";
985
986    if ($j('.qode_carousels.carousel_owl').length) {
987        $j('.qode_carousels.carousel_owl').each(function () {
988
989            var navigation = false;
990            if (typeof $j(this).data('enable-navigation') !== 'undefined' && $j(this).data('enable-navigation') === 'yes') {
991                navigation = true;
992            }
993
994            $j(this).find('.slides').owlCarousel({
995                center: true,
996                loop: true,
997                margin: 0,
998                nav: navigation,
999                video: true,
1000                autoplay:true,
1001                autoplayTimeout:5000,
1002                autoplaySpeed:1000,
1003                autoplayHoverPause:true,
1004                navText: [
1005                    '<span class="qode-prev-icon fa fa-angle-left"></span>',
1006                    '<span class="qode-next-icon fa fa-angle-right"></span>'
1007                ],
1008                responsive: {
1009                    0: {
1010                        items: 1,
1011                        stagePadding: 0
1012                    },
1013                    600: {
1014                        items: 2,
1015                        stagePadding: 50
1016                    },
1017                    1100: {
1018                        items: 3,
1019                        stagePadding: 100
1020                    },
1021                    1500: {
1022                        items: 3,
1023                        stagePadding: 200
1024                    }
1025                }
1026            }).animate({'opacity': 1}, 600);
1027        });
1028    }
1029}
1030
1031/*
1032 ** Init Portfolio Slider
1033 */
1034function initPortfolioSlider(){
1035    "use strict";
1036
1037    if($j('.portfolio_slider').length){
1038
1039        $j('.portfolio_slider').each(function(){
1040            var maxItems = ($j(this).parents('.grid_section').length == 1) ? 3 : 'auto';
1041            var itemWidth = ($j(this).parents('.grid_section').length == 1) ? 353 : 500;
1042
1043            $j('.portfolio_slides').carouFredSel({
1044                circular: true,
1045                responsive: true,
1046                scroll: 1,
1047                prev : {
1048                    button : function() {
1049                        return $j(this).parent().siblings('.caroufredsel-direction-nav').find('#caroufredsel-prev');
1050                    }
1051                },
1052                next : {
1053                    button : function() {
1054                        return $j(this).parent().siblings('.caroufredsel-direction-nav').find('#caroufredsel-next');
1055                    }
1056                },
1057                items: {
1058                    width: itemWidth,
1059                    visible: {
1060                        min: 1,
1061                        max: maxItems
1062                    }
1063                },
1064                auto: false,
1065                mousewheel: true,
1066                swipe: {
1067                    onMouse: true,
1068                    onTouch: true
1069                }
1070            }).animate({'opacity': 1},1000);
1071        });
1072
1073        calculateHeights();
1074
1075        $j('.portfolio_slider .flex-direction-nav a').click(function(e){
1076            e.preventDefault();
1077            e.stopImmediatePropagation();
1078            e.stopPropagation();
1079        });
1080    }
1081}
1082
1083/*
1084 **	Opening side menu on "menu button" click
1085 */
1086var current_scroll;
1087function initSideMenu() {
1088    "use strict";
1089
1090
1091    if ($j('body').hasClass('side_area_uncovered')) {
1092        $j('.side_menu_button_wrapper a.side_menu_button_link,  a.close_side_menu,  a.close_side_menu_fold').click(function (e) {
1093            e.preventDefault();
1094            $j('.side_menu').css({'right': '0'});
1095            if (!$j('.side_menu_button_wrapper a.side_menu_button_link').hasClass('opened')) {
1096                $j('.side_menu').css({'visibility': 'visible'});
1097                $j(this).addClass('opened');
1098                $j('body').addClass('right_side_menu_opened');
1099                current_scroll = $j(window).scrollTop();
1100
1101                $j(window).scroll(function () {
1102                    if (Math.abs($scroll - current_scroll) > 400) {
1103                        $j('body').removeClass('right_side_menu_opened');
1104                        $j('.side_menu_button_wrapper a').removeClass('opened');
1105                        var hide_side_menu = setTimeout(function () {
1106                            $j('.side_menu').css({'visibility': 'hidden'});
1107                            clearTimeout(hide_side_menu);
1108                        }, 400);
1109                    }
1110                });
1111            } else {
1112                $j('.side_menu_button_wrapper a.side_menu_button_link').removeClass('opened');
1113                $j('body').removeClass('right_side_menu_opened');
1114                var hide_side_menu = setTimeout(function () {
1115                    $j('.side_menu').css({'visibility': 'hidden'});
1116                    clearTimeout(hide_side_menu);
1117                }, 400);
1118            }
1119        });
1120    }
1121
1122    if ($j('body').hasClass('side_area_over_content')) {
1123
1124        $j('.wrapper').prepend('<div class="cover"/>');
1125
1126        $j('.side_menu_button_wrapper a.side_menu_button_link,  a.close_side_menu,  a.close_side_menu_fold').click(function (e) {
1127            e.preventDefault();
1128
1129            if (!$j('.side_menu_button_wrapper a.side_menu_button_link').hasClass('opened')) {
1130                $j(this).addClass('opened');
1131                $j('body').addClass('side_area_uncovered_opened');
1132
1133                $j(' .wrapper .cover').click(function () {
1134                    $j('.side_menu_button_wrapper a.side_menu_button_link').removeClass('opened');
1135                    $j('body').removeClass('side_area_uncovered_opened');
1136                    $j('.side_menu_button_wrapper a').removeClass('opened');
1137                });
1138                current_scroll = $j(window).scrollTop();
1139                $j(window).scroll(function () {
1140                    if (Math.abs($scroll - current_scroll) > 400) {
1141                        $j('body').removeClass('side_area_uncovered_opened');
1142                        $j('.side_menu_button_wrapper a').removeClass('opened');
1143                    }
1144                });
1145            } else {
1146                $j('.side_menu_button_wrapper a.side_menu_button_link').removeClass('opened');
1147                $j('body').removeClass('side_area_uncovered_opened');
1148            }
1149        });
1150
1151    }
1152
1153    if ($j('body').hasClass('side_area_slide_with_content')) {
1154        $j('.side_menu_button_wrapper a.side_menu_button_link,  a.close_side_menu,  a.close_side_menu_fold').click(function (e) {
1155            e.preventDefault();
1156
1157            if(!$j('.side_menu_button_wrapper a.side_menu_button_link').hasClass('opened')){
1158                $j(this).addClass('opened');
1159                $j('body').addClass('side_menu_open');
1160                current_scroll = $j(window).scrollTop();
1161                $j(window).scroll(function() {
1162
1163                    if(Math.abs($scroll - current_scroll) > 400){
1164                        $j('body').removeClass('side_menu_open');
1165                        $j('.side_menu_button_wrapper a').removeClass('opened');
1166                    }
1167                });
1168            }else{//hamburger icon has class open on its click
1169                $j('body').removeClass('side_menu_open');
1170
1171
1172                $j('.side_menu_button_wrapper a.side_menu_button_link').removeClass('opened');
1173                $j('body').removeClass('side_menu_open');
1174
1175            }
1176
1177            e.stopPropagation();
1178            $j('.wrapper').click(function() {
1179                e.preventDefault();
1180                $j('body').removeClass('side_menu_open');
1181                $j('.side_menu_button_wrapper a.side_menu_button_link').removeClass('opened');
1182                $j('body').removeClass('side_menu_open');
1183            });
1184        });
1185    }
1186
1187}
1188
1189function setDropDownMenuPosition(){
1190    "use strict";
1191
1192    var menu_items = $j(".drop_down > ul > li.narrow");
1193    menu_items.each( function(i) {
1194
1195        var browser_width = $j(window).width()-16; // 16 is width of scroll bar
1196        var boxed_layout = 1150; // boxed layout width
1197        var menu_item_position = $j(menu_items[i]).offset().left;
1198        var sub_menu_width = $j(menu_items[i]).find('.second .inner ul').width();
1199        var menu_item_from_left = 0;
1200        if($j('body').hasClass('boxed')){
1201            menu_item_from_left = boxed_layout - (menu_item_position - (browser_width - boxed_layout)/2) + 24; // 24 is right padding between menu elements
1202        } else {
1203            menu_item_from_left = browser_width - menu_item_position + 24; // 24 is right padding between menu elements
1204        }
1205
1206        var sub_menu_from_left;
1207
1208        if($j(menu_items[i]).find('li.sub').length > 0){
1209            sub_menu_from_left = menu_item_from_left - sub_menu_width;
1210        }
1211
1212        if(menu_item_from_left < sub_menu_width || sub_menu_from_left < sub_menu_width){
1213            $j(menu_items[i]).find('.second').addClass('right');
1214            $j(menu_items[i]).find('.second .inner ul').addClass('right');
1215        }
1216    });
1217}
1218
1219function initDropDownMenu(){
1220    "use strict";
1221
1222    var menu_items = $j('.drop_down > ul > li');
1223
1224    menu_items.each( function(i) {
1225        if ($j(menu_items[i]).find('.second').length > 0) {
1226            if($j(menu_items[i]).hasClass('wide')){
1227                var dropdown = $j(this).find('.inner > ul');
1228                var dropdownPadding = parseInt(dropdown.css('padding-left').slice(0, -2)) + parseInt(dropdown.css('padding-right').slice(0, -2));
1229
1230                if(!$j(this).hasClass('left_position') && !$j(this).hasClass('right_position')){
1231                    $j(this).find('.second').css('left',0);
1232                }
1233
1234                var tallest = 0;
1235                $j(this).find('.second > .inner > ul > li').each(function() {
1236                    var thisHeight = $j(this).height();
1237                    if(thisHeight > tallest) {
1238                        tallest = thisHeight;
1239                    }
1240                });
1241
1242                $j(this).find('.second > .inner > ul > li').height(tallest);
1243
1244                var row_number;
1245                if($j(this).find('.second > .inner > ul > li').length > 4){
1246                    row_number = 4;
1247                }else{
1248                    row_number = $j(this).find('.second > .inner > ul > li').length;
1249                }
1250
1251                var width = row_number*($j(this).find('.second > .inner > ul > li').outerWidth());
1252                $j(this).find('.second > .inner > ul').width(width);
1253                if(!$j(this).hasClass('wide_background')) {
1254                    if (!$j(this).hasClass('left_position') && !$j(this).hasClass('right_position')) {
1255                        var left_position = ($j(window).width() - 2 * ($j(window).width() - $j(this).find('.second').offset().left)) / 2 + (width + dropdownPadding) / 2;
1256                        $j(this).find('.second').css('left', -left_position);
1257                    }
1258                } else{
1259                    if(!$j(this).hasClass('left_position') && !$j(this).hasClass('right_position')){
1260                        var left_position = $j(this).find('.second').offset().left;
1261                        $j(this).find('.second').css('left',-left_position);
1262                        $j(this).find('.second').css('width',$j(window).width());
1263                    }
1264                }
1265            }
1266
1267            if(!menu_dropdown_height_set){
1268                $j(menu_items[i]).data('original_height', $j(menu_items[i]).find('.second').height() + 'px');
1269                $j(menu_items[i]).find('.second').height(0);
1270            }
1271
1272            if (navigator.userAgent.match(/(iPod|iPhone|iPad)/)) {
1273                $j(menu_items[i]).on("touchstart mouseenter",function(){
1274                    $j(menu_items[i]).find('.second').css({'height': $j(menu_items[i]).data('original_height'), 'overflow': 'visible', 'visibility': 'visible', 'opacity': '1'});
1275                }).on("mouseleave", function(){
1276                    $j(menu_items[i]).find('.second').css({'height': '0px','overflow': 'hidden', 'visivility': 'hidden', 'opacity': '0'});
1277                });
1278
1279            }else{
1280
1281                if($j('.drop_down.animate_height ').length){
1282                    $j(menu_items[i]).mouseenter(function() {
1283                        $j(menu_items[i]).find('.second').css({
1284                            'visibility': 'visible',
1285                            'height': '0px',
1286                            'opacity': '0'
1287                        });
1288                        $j(menu_items[i]).find('.second').stop().animate({
1289                            'height': $j(menu_items[i]).data('original_height'),
1290                            opacity: 1
1291                        }, 300, function() {
1292                            $j(menu_items[i]).find('.second').css('overflow', 'visible');
1293                        });
1294
1295                    }).mouseleave(function() {
1296                        $j(menu_items[i]).find('.second').stop().animate({
1297                            'height': '0px'
1298                        }, 0, function() {
1299                            $j(menu_items[i]).find('.second').css({
1300                                'overflow': 'hidden',
1301                                'visibility': 'hidden'
1302                            });
1303                        });
1304                    });
1305
1306                }else{
1307                    var config = {
1308                        interval: 0,
1309                        over: function(){
1310                            setTimeout(function() {
1311                                $j(menu_items[i]).find('.second').addClass('drop_down_start');
1312                                $j(menu_items[i]).find('.second').stop().css({'height': $j(menu_items[i]).data('original_height')});
1313                            }, 150);
1314                        },
1315                        timeout: 150,
1316                        out: function(){
1317                            $j(menu_items[i]).find('.second').stop().css({'height': '0px'});
1318                            $j(menu_items[i]).find('.second').removeClass('drop_down_start');
1319                        }
1320                    };
1321                    $j(menu_items[i]).hoverIntent(config);
1322                }
1323
1324
1325            }
1326        }
1327    });
1328    $j('.drop_down ul li.wide ul li a').on('click',function(){
1329        var $this = $j(this);
1330        setTimeout(function() {
1331            $this.mouseleave();
1332        }, 500);
1333
1334    });
1335
1336    menu_dropdown_height_set = true;
1337}
1338
1339/*
1340 **	Vertical menu toggle dropdown
1341 */
1342function initVerticalMenuToggle(){
1343    "use strict";
1344
1345    if($j('.no-touch .vertical_menu').hasClass('vm_click_event')){
1346        //show dropdown on menu item click, no link available on menu item click if it has dropdown
1347
1348        var menu_items = $j('.no-touch .vertical_menu_toggle > ul > li > a');
1349        var menu_items_2 = $j('.no-touch .vertical_menu_toggle ul li ul li a');
1350
1351        menu_items.each( function(i) {
1352            if($j(menu_items[i]).parent().hasClass('has_sub')){
1353                var subitems_number = $j(menu_items[i]).find('.inner > ul > li').length;
1354
1355                $j(menu_items[i]).on('click',function(e) {
1356                    e.preventDefault();
1357                    if(!$j(this).parent().hasClass('open') && !$j(this).parent().hasClass('current-menu-ancestor')) {
1358
1359                        $j('.no-touch .vertical_menu_toggle > ul > li').removeClass('open current-menu-ancestor');
1360                        $j('.no-touch .vertical_menu_toggle > ul >
1360 li').find('.second').slideUp('fast');
1361
1362                        $j(this).parent().addClass('open');
1363                        $j(this).parent().find('.second').slideDown('slow', function () {
1364                            $j('.vertical_menu_area.with_scroll').getNiceScroll().resize();
1365                        });
1366                    }else{
1367                        $j(this).parent().removeClass('open');
1368                        $j(this).parent().find('.second').slideUp('fast', function () {
1369                            $j(this).parent().removeClass('current-menu-ancestor');
1370                            $j('.vertical_menu_area.with_scroll').getNiceScroll().resize();
1371                        });
1372                    }
1373                    return false;
1374                });
1375            }
1376        });
1377
1378        menu_items_2.each( function(i) {
1379            if($j(menu_items_2[i]).parent().hasClass('menu-item-has-children')){
1380                var subitems_number = $j(menu_items_2[i]).find('ul > li').length;
1381                $j(menu_items_2[i]).on('click',function(e) {
1382                    e.preventDefault();
1383                    if(!$j(this).parent().hasClass('open') && !$j(this).parent().hasClass('current_page_parent')) {
1384                        $j('.no-touch .vertical_menu_toggle ul li ul li').removeClass('open current_page_parent');
1385                        $j('.no-touch .vertical_menu_toggle ul li ul li').find('ul').slideUp('fast');
1386
1387                        $j(this).parent().addClass('open');
1388                        $j(this).parent().find('ul').slideDown('slow', function () {
1389                            $j('.vertical_menu_area.with_scroll').getNiceScroll().resize();
1390                        });
1391                    }else{
1392                        $j(this).parent().removeClass('open');
1393                        $j(this).parent().find('ul').slideUp('fast', function () {
1394                            $j(this).parent().removeClass('current_page_parent');
1395                            $j('.vertical_menu_area.with_scroll').getNiceScroll().resize();
1396                        });
1397                    }
1398                    return false;
1399                });
1400            }
1401        });
1402    } else {
1403        var menu_items = $j('.no-touch .vertical_menu_toggle > ul > li');
1404        var menu_items_2 = $j('.no-touch .vertical_menu_toggle ul li ul li');
1405
1406        menu_items.each( function(i) {
1407            if($j(menu_items[i]).hasClass('has_sub')){
1408                var subitems_number = $j(menu_items[i]).find('.inner > ul > li').length;
1409                $j(menu_items[i]).hoverIntent({
1410                    over: function() {
1411                        $j(menu_items[i]).addClass('open');
1412                        $j(menu_items[i]).find('.second').slideDown(subitems_number*40, 'easeInOutSine', function(){
1413                            $j('.vertical_menu_area.with_scroll').getNiceScroll().resize();
1414                        });
1415
1416                    },
1417                    out: function() {
1418                        //if(!$j(menu_items[i]).hasClass('active')){
1419                        $j(menu_items[i]).removeClass('open');
1420                        $j(menu_items[i]).find('.second').slideUp(subitems_number*40, 'easeInOutSine');
1421                        //}
1422                    },
1423                    timeout: 1000
1424                });
1425            }
1426        });
1427
1428        menu_items_2.each( function(i) {
1429            if($j(menu_items_2[i]).hasClass('menu-item-has-children')){
1430                var subitems_number = $j(menu_items_2[i]).find('ul > li').length;
1431                $j(menu_items_2[i]).hoverIntent({
1432                    over: function() {
1433                        $j(menu_items_2[i]).addClass('open');
1434                        $j(menu_items_2[i]).find('ul').slideDown(subitems_number*40, 'easeInOutSine', function(){
1435                            $j('.vertical_menu_area.with_scroll').getNiceScroll().resize();
1436                        });
1437                    },
1438                    out: function() {
1439                        $j(menu_items_2[i]).removeClass('open');
1440                        $j(menu_items_2[i]).find('ul').slideUp(subitems_number*40, 'easeInOutSine');
1441                    },
1442                    timeout: 1000
1443                });
1444            }
1445        });
1446    }
1447}
1448
1449/*
1450 **	Show/Hide Vertical menu for mobile
1451 */
1452function initVerticalMobileMenu(){
1453    "use strict";
1454
1455    //register tap / click event for main menu item plus icon
1456    $j('.touch .vertical_menu_toggle > ul > li.has_sub > a').on('tap click', function(e){
1457        //first prevent event propagation and it's default behavior
1458        e.stopPropagation();
1459        e.preventDefault();
1460
1461        //is dropdown for clicked item visible?
1462        if($j(this).next('div.second').is(":visible")){
1463            //if it is remove 'open' class and slide it up
1464            $j(this).parents('.touch .vertical_menu_toggle > ul > li.has_sub').removeClass('open');
1465            $j(this).next('div.second').slideUp(200);
1466        } else {
1467            //if it's not visible add 'open' class and slide it down
1468            $j(this).parents('.touch .vertical_menu_toggle > ul > li.has_sub').addClass('open');
1469            $j(this).next('div.second').slideDown(200);
1470        }
1471    });
1472
1473    //register tap / click event for second level main menu item plus icon
1474    $j('.touch .vertical_menu_toggle ul li ul li.sub > a').on('tap click', function(e){
1475        //first prevent event propagation and it's default behavior
1476        e.stopPropagation();
1477        e.preventDefault();
1478
1479        //is dropdown for clicked item visible?
1480        if($j(this).next('ul').is(":visible")){
1481            //if it is remove 'open' class and slide it up
1482            $j(this).parents('.touch .vertical_menu_toggle ul li ul li').removeClass('open');
1483            $j(this).next('ul').slideUp(200);
1484        } else {
1485            //if it's not visible add 'open' class and slide it down
1486            $j(this).parents('.touch .vertical_menu_toggle ul li ul li').addClass('open');
1487            $j(this).next('ul').slideDown(200);
1488        }
1489    });
1490}
1491
1492/*
1493 **	Set transparency for left menu area
1494 */
1495function checkVerticalMenuTransparency(){
1496    "use strict";
1497
1498    if($scroll !== 0){
1499        $j('body.vertical_menu_transparency').removeClass('vertical_menu_transparency_on');
1500        $j('body.vertical_menu_transparency').addClass('vertical_menu_transparency_off');
1501    }else{
1502        $j('body.vertical_menu_transparency').addClass('vertical_menu_transparency_on');
1503        $j('body.vertical_menu_transparency').removeClass('vertical_menu_transparency_off');
1504    }
1505}
1506
1507/*
1508 **	Plugin for counter shortcode
1509 */
1510(function($) {
1511    "use strict";
1512
1513    $.fn.countTo = function(options) {
1514        // merge the default plugin settings with the custom options
1515        options = $.extend({}, $.fn.countTo.defaults, options || {});
1516
1517        // how many times to update the value, and how much to increment the value on each update
1518        var loops = Math.ceil(options.speed / options.refreshInterval),
1519            increment = (options.to - options.from) / loops;
1520
1521        return $(this).each(function() {
1522            var _this = this,
1523                loopCount = 0,
1524                value = options.from,
1525                interval = setInterval(updateTimer, options.refreshInterval);
1526
1527            function updateTimer() {
1528                value += increment;
1529                loopCount++;
1530                $(_this).html(value.toFixed(options.decimals));
1531
1532                if (typeof(options.onUpdate) === 'function') {
1533                    options.onUpdate.call(_this, value);
1534                }
1535
1536                if (loopCount >= loops) {
1537                    clearInterval(interval);
1538                    value = options.to;
1539
1540                    if (typeof(options.onComplete) === 'function') {
1541                        options.onComplete.call(_this, value);
1542                    }
1543                }
1544            }
1545        });
1546    };
1547
1548    $.fn.countTo.defaults = {
1549        from: 0,  // the number the element should start at
1550        to: 100,  // the number the element should end at
1551        speed: 1000,  // how long it should take to count between the target numbers
1552        refreshInterval: 100,  // how often the element should be updated
1553        decimals: 0,  // the number of decimal places to show
1554        onUpdate: null,  // callback method for every time the element is updated,
1555        onComplete: null  // callback method for when the element finishes updating
1556    };
1557})(jQuery);
1558
1559/*
1560 **	Counter from zero to defined number
1561 */
1562function initToCounter(){
1563    "use strict";
1564
1565    if($j('.counter.zero').length){
1566        $j('.counter.zero').each(function() {
1567            if(!$j(this).hasClass('executed')){
1568                $j(this).addClass('executed');
1569                $j(this).appear(function() {
1570                    $j(this).parent().css('opacity', '1');
1571                    var $max = parseFloat($j(this).text());
1572                    $j(this).countTo({
1573                        from: 0,
1574                        to: $max,
1575                        speed: 1500,
1576                        refreshInterval: 100
1577                    });
1578                }
1578,{accX: 0, accY: -150});
1579            }
1580        });
1581    }
1582}
1583
1584/*
1585 **	Counter with random effect
1586 */
1587function initCounter(){
1588    "use strict";
1589
1590    if($j('.counter.random').length){
1591        $j('.counter.random').each(function() {
1592            if(!$j(this).hasClass('executed')){
1593                $j(this).addClass('executed');
1594                $j(this).appear(function() {
1595                    $j(this).parent().css('opacity', '1');
1596                    $j(this).absoluteCounter({
1597                        speed: 2000,
1598                        fadeInDelay: 1000
1599                    });
1600                },{accX: 0, accY: -150});
1601            }
1602        });
1603    }
1604}
1605
1606/*
1607 **	Countdown shortcode
1608 */
1609function initCountdown() {
1610    "use strict";
1611
1612    var countdowns = $j('.qode-countdown'),
1613        year,
1614        month,
1615        day,
1616        hour,
1617        minute,
1618        timezone,
1619        monthLabel,
1620        dayLabel,
1621        hourLabel,
1622        minuteLabel,
1623        secondLabel;
1624
1625    if (countdowns.length) {
1626
1627        countdowns.each(function(){
1628
1629            //Find countdown elements by id-s
1630            var countdownId = $j(this).attr('id'),
1631                countdown = $j('#'+countdownId),
1632                digitFontSize,
1633                labelFontSize,
1634                digitColor;
1635
1636            //Get data for countdown
1637            year = countdown.data('year');
1638            month = countdown.data('month');
1639            day = countdown.data('day');
1640            hour = countdown.data('hour');
1641            minute = countdown.data('minute');
1642            timezone = countdown.data('timezone');
1643            monthLabel = countdown.data('month-label');
1644            dayLabel = countdown.data('day-label');
1645            hourLabel = countdown.data('hour-label');
1646            minuteLabel = countdown.data('minute-label');
1647            secondLabel = countdown.data('second-label');
1648            digitFontSize = countdown.data('digit-size');
1649            labelFontSize = countdown.data('label-size');
1650            digitColor = countdown.data('digit-color');
1651
1652
1653            //Initialize countdown
1654            countdown.countdown({
1655                until: new Date(year, month - 1, day, hour, minute, 44),
1656                labels: ['Years', monthLabel, 'Weeks', dayLabel, hourLabel, minuteLabel, secondLabel],
1657                format: 'ODHMS',
1658                timezone: timezone,
1659                padZeroes: true,
1660                onTick: setCountdownStyle
1661            });
1662
1663            function setCountdownStyle() {
1664                countdown.find('.countdown-amount').css({
1665                    'font-size' : digitFontSize+'px',
1666                    'line-height' : digitFontSize+'px',
1667                    'color' : digitColor
1668                });
1669                countdown.find('.countdown-period').css({
1670                    'font-size' : labelFontSize+'px'
1671                });
1672            }
1673
1674        });
1675
1676    }
1677
1678}
1679
1680/*
1681 **	Horizontal progress bars shortcode
1682 */
1683function initProgressBars(){
1684    "use strict";
1685
1686    if($j('.q_progress_bar').length){
1687        $j('.q_progress_bar').each(function() {
1688            $j(this).appear(function() {
1689                initToCounterHorizontalProgressBar($j(this));
1690                var percentage = $j(this).find('.progress_content').data('percentage');
1691                $j(this).find('.progress_content').css('width', '0%');
1692                $j(this).find('.progress_content').animate({'width': percentage+'%'}, 1500);
1693                $j(this).find('.progress_number_wrapper').css('width', '0%');
1694                $j(this).find('.progress_number_wrapper').animate({'width': percentage+'%'}, 1500);
1695
1696
1697            },{accX: 0, accY: -150});
1698        });
1699    }
1700}
1701
1702/*
1703 **	Counter for horizontal progress bars percent from zero to defined percent
1704 */
1705function initToCounterHorizontalProgressBar($this){
1706    "use strict";
1707
1708    var percentage = parseFloat($this.find('.progress_content').data('percentage'));
1709    if($this.find('.progress_number span').length) {
1710        $this.find('.progress_number span').each(function() {
1711            $j(this).parents('.progress_number_wrapper').css('opacity', '1');
1712            $j(this).countTo({
1713                from: 0,
1714                to: percentage,
1715                speed: 1500,
1716                refreshInterval: 50
1717            });
1718        });
1719    }
1720}
1721
1722/*
1723 **	Unordered list animation effect
1724 */
1725function initListAnimation(){
1726    "use strict";
1727
1728    if($j('.animate_list').length > 0 && $j('.no_animation_on_touch').length === 0){
1729        $j('.animate_list').each(function(){
1730            $j(this).appear(function() {
1731                $j(this).find("li").each(function (l) {
1732                    var k = $j(this);
1733                    setTimeout(function () {
1734                        k.animate({
1735                            opacity: 1,
1736                            top: 0
1737                        }, 1500);
1738                    }, 100*l);
1739                });
1740            }
1740,{accX: 0, accY: -150});
1741        });
1742    }
1743}
1744
1745/*
1746 **	Pie Chart shortcode
1747 */
1748function initPieChart(){
1749    "use strict";
1750
1751    if($j('.q_percentage').length){
1752        $j('.q_percentage').each(function() {
1753
1754            var $barColor = piechartcolor;
1755            var $size = 174;
1756
1757            if($j(this).data('active') !== ""){
1758                $barColor = $j(this).data('active');
1759            }
1760
1761            var $trackColor = '#fff';
1762
1763            if($j(this).data('noactive') !== ""){
1764                $trackColor = $j(this).data('noactive');
1765            }
1766
1767            var $line_width = 10;
1768
1769            if($j(this).data('linewidth') !== ""){
1770                $line_width = $j(this).data('linewidth');
1771            }
1772
1773            if($j(this).data('chartwidth') !== ""){
1774                $size = $j(this).data('chartwidth');
1775            }
1776
1777            $j(this).appear(function() {
1778                initToCounterPieChart($j(this));
1779                $j(this).parent().css('opacity', '1');
1780
1781                $j(this).easyPieChart({
1782                    barColor: $barColor,
1783                    trackColor: $trackColor,
1784                    scaleColor: false,
1785                    lineCap: 'butt',
1786                    lineWidth: $line_width,
1787                    animate: 1500,
1788                    size: $size
1789                });
1790            },{accX: 0, accY: -150});
1791        });
1792    }
1793}
1794
1795/*
1796 **	Pie Chart shortcode
1797 */
1798function initPieChartWithIcon(){
1799    "use strict";
1800
1801    if($j('.q_percentage_with_icon').length){
1802        $j('.q_percentage_with_icon').each(function() {
1803
1804            var $barColor = piechartcolor;
1805            var $size = 174;
1806
1807            if($j(this).data('active') !== ""){
1808                $barColor = $j(this).data('active');
1809            }
1810
1811            var $trackColor = '#fff';
1812
1813            if($j(this).data('noactive') !== ""){
1814                $trackColor = $j(this).data('noactive');
1815            }
1816
1817            var $line_width = 10;
1818
1819            if($j(this).data('linewidth') !== ""){
1820                $line_width = $j(this).data('linewidth');
1821            }
1822
1823            if($j(this).data('chartwidth') !== ""){
1824                $size = $j(this).data('chartwidth');
1825            }
1826
1827            $j(this).appear(function() {
1828                $j(this).parent().css('opacity', '1');
1829                $j(this).css('opacity', '1');
1830                $j(this).easyPieChart({
1831                    barColor: $barColor,
1832                    trackColor: $trackColor,
1833                    scaleColor: false,
1834                    lineCap: 'butt',
1835                    lineWidth: $line_width,
1836                    animate: 1500,
1837                    size: $size
1838                });
1839            },{accX: 0, accY: -150});
1840        });
1841    }
1842}
1843
1844/*
1845 **	Counter for pie chart number from zero to defined number
1846 */
1847function initToCounterPieChart($this){
1848    "use strict";
1849
1850    $j($this).css('opacity', '1');
1851    var $max = parseFloat($j($this).find('.tocounter').text());
1852    $j($this).find('.tocounter').countTo({
1853        from: 0,
1854        to: $max,
1855        speed: 1500,
1856        refreshInterval: 50
1857    });
1858}
1859
1860/*
1861 **	Init Portfolio list and Portfolio Filter
1862 */
1863function initPortfolio(){
1864    "use strict";
1865
1866    if($j('.projects_holder_outer:not(.masonry_with_space, .portfolio_justified_gallery)').length){
1867        $j('.projects_holder_outer').each(function(){
1868
1869            $j('.filter_holder .filter').on('click',function(){
1870                var $this = $j(this).text();
1871                var dropLabels = $j('.filter_holder').find('.label span');
1872                dropLabels.each(function(){
1873                    $j(this).text($this);
1874                });
1875            });
1876
1877            $j(this).find('.projects_holder').mixitup({
1878                showOnLoad: 'all',
1879                transitionSpeed: 600,
1880                minHeight: 150,
1881                onMixEnd: function(){
1882                    initParallax();
1883                }
1884            });
1885        });
1886    }
1887}
1888
1889/*
1890 **	Init z-index for portfolio items
1891 */
1892function initPortfolioZIndex(){
1893    "use strict";
1894
1895    if($j('.projects_holder_outer.portfolio_no_space').length){
1896        $j('.no_space.hover_text article').each(function(i){
1897            $j(this).css('z-index', i +10);
1898        });
1899    }
1900}
1901
1902function initPortfolioJustifiedGallery() {
1903    "use strict";
1904
1905    if($j('.portfolio_justified_gallery').length) {
1906        var project_holder = $j('.projects_holder_outer.portfolio_justified_gallery');
1907        project_holder.each(function () {
1908            var filter_holder = $j(this).find('.filter_holder');
1909
1910            filter_holder.find('li.filter').first().addClass('current');
1911
1912
1913            filter_holder.find('.filter').on('click', function () {
1914                var $this = $j(this).text();
1915                var dropLabels = filter_holder.find('.label span');
1916                dropLabels.each(function () {
1917                    $j(this).text($this);
1918                });
1919
1920                var selector = $j(this).attr('data-filter');
1921                var articles = the_gallery.find('article');
1922                var transition_duration = 500;
1923                articles.css('transition', 'all ' + transition_duration + 'ms ease');
1924                articles.not(selector).css({
1925                    'transform': 'scale(0)'
1926                });
1927
1928                setTimeout(function () {
1929                    articles.filter(selector).css({
1930                        'transform': ''
1931                    });
1932                    the_gallery.css('transition', 'height ' + transition_duration + 'ms ease').justifiedGallery({selector: '>article' + (selector != '*' ? selector : '')});
1933                }, 1.1 * transition_duration);
1934                setTimeout(function () {
1935                    articles.css('transition', '');
1936                    the_gallery.css('transition', '');
1937                }, 2.2 * transition_duration);
1938
1939                $j(".filter").removeClass("current active");
1940                $j(this).addClass("current active");
1941
1942                return false;
1943            });
1944
1945
1946            var the_gallery = $j(this).find('.projects_holder');
1947            var row_height = typeof the_gallery.data('row-height') !== 'undefined' ? the_gallery.data('row-height') : 200,
1948                spacing = typeof the_gallery.data('spacing') !== 'undefined' ? the_gallery.data('spacing') : 0,
1949                last_row = typeof the_gallery.data('last-row') !== 'undefined' ? the_gallery.data('last-row') : 'nojustify',
1950                justify_threshold = typeof the_gallery.data('justify-threshold') !== 'undefined' ? the_gallery.data('justify-threshold') : 0.75;
1951            the_gallery
1952                .justifiedGallery({
1953                    captions: false,
1954                    rowHeight: row_height,
1955                    margins: spacing,
1956                    border: 0,
1957                    lastRow: last_row,
1958                    justifyThreshold: justify_threshold,
1959                    selector: '> article'
1960                })
1961                .on('jg.complete jg.rowflush', function() {
1962                    $j(this).find('article').addClass('show').each(function() {
1963                        $j(this).height(Math.round($j(this).height()));
1964                    });
1965                });
1966        });
1967    }
1968}
1969
1970
1971function initPortfolioMasonry(){
1972    "use strict";
1973
1974    if($j('.projects_masonry_holder, .masonry_with_space').length){
1975
1976        $j('.projects_masonry_holder, .masonry_with_space .projects_holder').each(function(){
1977            var $window = jQuery(window);
1978            var $this = $j(this);
1979            $this.animate({opacity:1});
1980            if($j('.projects_masonry_holder').length){
1981                resizeMasonry($this);
1982            }
1983            $this.isotope({
1984                itemSelector: '.portfolio_masonry_item, .masonry_with_space .mix',
1985                layoutMode: 'masonry'
1986            });
1987
1988            if($this.hasClass('appear_from_bottom')) {
1989                $this.find('article').each(function(l) {
1990                    $j(this).appear(function() {
1991                        var $this = $j(this);
1992                        $this.addClass('show');
1993                        setTimeout(function(){
1994                            $this.addClass('shown');
1995                        }, 1000);
1996                    },{accX: 0, accY: 0});
1997                });
1998            }
1999
2000            initPortfolioMasonryFilter($this);
2001
2002            if($j('.projects_masonry_holder').length){
2003                setPortfolioMasZIndex();
2004                $window.resize(function() {resizeMasonry($this); setPortfolioMasZIndex();});
2005            }
2006            setPortfolioParallax($this);
2007
2008            if($j('.parallax_section_holder').length) {
2009                initParallax();
2010            }
2011        });
2012    }
2013}
2014
2015var portfolio_width;
2016function resizeMasonry(container){
2017    "use strict";
2018
2019    var $window = jQuery(window);
2020
2021    if($j('.full_width').length){
2022        if($j('body').hasClass('vertical_menu_enabled') && $window_width > 1000){
2023            portfolio_width = $window.innerWidth() - 260; // 260 is left menu area width
2024        } else {
2025            portfolio_width = $window.innerWidth();
2026        }
2027
2028        if(container.hasClass('masonry_extended')) {
2029            portfolio_width = portfolio_width - 60;
2030        }
2031
2032    }else{
2033        var closest_container =  container.closest('.container_inner');
2034        if(closest_container.has('.column_inner').length) {
2035            portfolio_width =  container.closest('.column_inner').innerWidth();
2036        } else {
2037            portfolio_width = closest_container.innerWidth();
2038        }
2039
2040        if(container.hasClass('masonry_extended')) {
2041            portfolio_width = portfolio_width + 60;
2042        }
2043    }
2044    container.width(portfolio_width);
2045
2046    var $cols = 5;
2047    if(portfolio_width > 1600){
2048        $cols = 5;
2049    }else if(portfolio_width <= 1600 && portfolio_width > 1300){
2050        $cols = 4;
2051    }else if(portfolio_width <= 1300 && portfolio_width > 1000){
2052        $cols = 3;
2053    }else if(portfolio_width <= 1000 && portfolio_width > 480){
2054        $cols = 2;
2055    }else if(portfolio_width <= 480){
2056        $cols = 1;
2057    }
2058    if(container.hasClass('masonry_extended')) {
2059        if(portfolio_width > 1600){
2060            $cols = 4;
2061        }else if(portfolio_width <= 1600 && portfolio_width > 964){
2062            $cols = 4;
2063        }else if(portfolio_width <= 964 && portfolio_width > 728){
2064            $cols = 3;
2065        }else if(portfolio_width <= 728 && portfolio_width > 540){
2066            $cols = 2;
2067        }else if(portfolio_width <= 540){
2068            $cols = 1;
2069        }
2070    }
2071    var largeItemHeight = container.find('article[class*="default"]:first img').height();
2072    var largeWidthItemHeight = container.find('article[class*="default"]:first img').height();
2073    var double = ($window.innerWidth() > 480) ? 2 : 1 ;
2074    if(container.hasClass('masonry_extended')) {
2075        largeItemHeight += 30;
2076        container.find('article[class*="large_width"] img').css('height',(largeWidthItemHeight));
2077    }
2078    container.find('article[class*="large_width_height"] img, article[class*="large_height"] img').css('height',(largeItemHeight*double));
2079
2080    container.isotope({
2081        masonry: { columnWidth: portfolio_width / parseInt($cols)}
2082    });
2083}
2084
2085(function( $ ){
2086    "use strict";
2087
2088    var $window = $(window);
2089    $.fn.masonryParallax = function(speedFactor, outerHeight, startPosition) {
2090        var $this = $(this);
2091        var getHeight;
2092        var firstTop;
2093        var startPositionAdd = 0;
2094
2095        //get the starting position of element to have parallax applied to it
2096        firstTop = $this.offset().top;
2097
2098        //get the height element
2099        if (outerHeight) {
2100            getHeight = function(jqo) {
2101                return jqo.outerHeight(true);
2102            };
2103        } else {
2104            getHeight = function(jqo) {
2105                return jqo.height();
2106            };
2107        }
2108
2109        //get type so elements could take it's initial position
2110        if(startPosition != 0){
2111            startPositionAdd = startPosition;
2112        }
2113
2114        // setup defaults if arguments aren't specified
2115        if (arguments.length < 1 || speedFactor === null) speedFactor = 0.1;
2116        if (arguments.length < 2 || outerHeight === null) outerHeight = true;
2117
2118        // function to be called whenever the window is scrolled or resized
2119        var top = $this.offset().top;
2120        var height = getHeight($this);
2121        function update(){
2122            // Check if totally above or totally below viewport
2123            if (top + height < $scroll || top > $scroll + $window_height) {
2124                return;
2125            }
2126            $this.css('transform', 'translate3d(0px, '+ (Math.round((firstTop - height - $scroll) * speedFactor + startPositionAdd)) +'px, 0px)');
2127        }
2128
2129        $window.bind('scroll', update).resize(update);
2130        update();
2131    };
2132})(jQuery);
2133
2134function setPortfolioParallax(container) {
2135    if(container.hasClass('masonry_extended')) {
2136        container.find('.portfolio_masonry_item.parallax_item').each(function(i){
2137            $j(this).masonryParallax(container.data('parallax_item_speed'), true, container.data('parallax_item_offset'));
2138
2139        });
2140    }
2141}
2142
2143function setPortfolioMasZIndex(){
2144    "use strict";
2145
2146    var $elemXPos = {};
2147    var $elemZIndex = {};
2148
2149    $j('.projects_masonry_holder article').each(function(){
2150        $elemXPos[$j(this).index()] = getPortfolioXPos($j(this).css('left'));
2151    });
2152
2153    var $elemXPosArray = $j.map($elemXPos, function (value) { return value; });
2154    $elemXPosArray = cleanPortfolioMasXArray($elemXPosArray);
2155    $elemXPosArray.sort(function(x,y){return x-y});
2156
2157    for(var i = 0; i < $elemXPosArray.length; i++){
2158        $elemZIndex[$elemXPosArray[i]] = i*10;
2159    }
2160
2161    $j.each($elemXPos,function(key,val){
2162
2163        var $zi;
2164        var $bgd = val;
2165        $j.each($elemZIndex,function(key,val){
2166            if($bgd == key) {
2167                $zi = val;
2168            }
2169        });
2170
2171        $j('.projects_masonry_holder article:eq('+key+')').css('z-index',$zi);
2172    });
2173}
2174
2175function getPortfolioXPos(css) {
2176    //return css.substr(7, css.length - 8).split(', ')[4];
2177    return css.substr(0, css.length - 2);
2178}
2179
2180function initPortfolioMasonryFilter(masonry){
2181    "use strict";
2182    var filter = masonry.parent().find('.filter_outer .filter_holder .filter');
2183    masonry.parent().find('.filter:first').addClass('current');
2184    filter.click(function(){
2185
2186        var selector = $j(this).attr('data-filter');
2187        $j(selector).each(function() {
2188            var item = $j(this);
2189            item.addClass('show shown');
2190        });
2191        masonry.isotope({ filter: selector });
2192
2193        filter.removeClass("current");
2194        $j(this).addClass("current");
2195
2196        setTimeout(function(){setPortfolioMasZIndex();initParallax();},700);
2197
2198        return false;
2199    });
2200
2201}
2202
2203/*
2204 **	Load more portfolios
2205 */
2206function loadMore(){
2207    "use strict";
2208
2209    var i = 1;
2210
2211    $j('.load_more a').on('click', function(e)  {
2212        e.preventDefault();
2213
2214        var link = $j(this).attr('href');
2215        var $content = '.projects_holder';
2216        var $anchor = '.portfolio_paging .load_more a';
2217        var $elem = '.mix';
2218        var $next_href = $j($anchor).attr('href'); // Get URL for the next set of posts
2219        var filler_num = $j('.projects_holder .filler').length;
2220
2221        var load_more_holder = $j('.portfolio_paging');
2222        var loading_holder   = $j('.portfolio_paging_loading');
2223
2224        load_more_holder.hide();
2225        loading_holder.show();
2226
2227        $j.get(link+'', function(data){
2228
2229            if (!$j($content).is('.justified-gallery')) {
2230                $j('.projects_holder .filler').slice(-filler_num).remove();
2231
2232                var $new_content = $j($content, data).wrapInner('').html(); // Grab just the content
2233                $next_href = $j($anchor, data).attr('href'); // Get the new href
2234
2235                $j($content, data).waitForImages(function() {
2236
2237                    $j('article.mix:last').after($new_content); // Append the new content
2238
2239
2240
2241
2242                    if($j('.masonry_with_space').length){
2243                        $j('.masonry_with_space .projects_holder').isotope('reloadItems').isotope();
2244                    }else{
2245                        var min_height = $j('article.mix:first').height();
2246                        $j('article.mix').css('min-height',min_height);
2247                        $j('.projects_holder').mixitup('remix','all');
2248                    }
2249                    prettyPhoto();
2250                    if($j('.load_more').attr('rel') > i) {
2251                        $j('.load_more a').attr('href', $next_href); // Change the next URL
2252                    } else {
2253                        $j('.load_more').remove();
2254                    }
2255                    $j('.projects_holder .portfolio_paging:last').remove(); // Remove the original navigation
2256                    $j('article.mix').css('min-height',0);
2257
2258                    load_more_holder.show();
2259                    loading_holder.hide();
2260                    setTimeout(function(){
2261                        $j('.projects_holder article').css('visibility','visible');
2262                        $j('article:not(.show)').each(function(l){
2263                            $j(this).addClass('show');
2264                            setTimeout(function(){
2265                                $j(this).addClass('shown');
2266                            }, 1000);
2267                        });
2268                    }, 600);
2269                });
2270
2271            } else {
2272                var $new_content = $j($content, data).wrapInner('').html(); // Grab just the content
2273                $next_href = $j($anchor, data).attr('href'); // Get the new href
2274                $j($content, data).waitForImages(function() {
2275
2276                    $j($content).find('article:last').after($new_content); // Append the new content
2277
2278                    $j($content).find('article').css('visibility','visible');
2279                    $j($content).justifiedGallery('norewind');
2280                    prettyPhoto();
2281                    if($j('.load_more').attr('rel') > i) {
2282                        $j('.load_more a').attr('href', $next_href); // Change the next URL
2283                    } else {
2284                        $j('.load_more').remove();
2285                    }
2286                    $j('.projects_holder .portfolio_paging:last').remove(); // Remove the original navigation
2287
2288                    load_more_holder.show();
2289                    loading_holder.hide();
2290                });
2291            }
2292
2293        });
2294        i++;
2295    });
2296}
2297
2298
2299/*
2300 **	Picture popup for portfolio lists and portfolio single
2301 */
2302function prettyPhoto(){
2303    "use strict";
2304
2305    $j('a[data-rel]').each(function() {
2306        $j(this).attr('rel', $j(this).data('rel'));
2307    });
2308
2309    $j("a[rel^='prettyPhoto']").prettyPhoto({
2310        animation_speed: 'normal', /* fast/slow/normal */
2311        slideshow: false, /* false OR interval time in ms */
2312        autoplay_slideshow: false, /* true/false */
2313        opacity: 0.80, /* Value between 0 and 1 */
2314        show_title: true, /* true/false */
2315        allow_resize: true, /* Resize the photos bigger than viewport. true/false */
2316        horizontal_padding: 0,
2317        default_width: 960,
2318        default_height: 540,
2319        counter_separator_label: '/', /* The separator for the gallery counter 1 "of" 2 */
2320        theme: 'pp_default', /* light_rounded / dark_rounded / light_square / dark_square / facebook */
2321        hideflash: false, /* Hides all the flash object on a page, set to TRUE if flash appears over prettyPhoto */
2322        wmode: 'opaque', /* Set the flash wmode attribute */
2323        autoplay: true, /* Automatically start videos: True/False */
2324        modal: false, /* If set to true, only the close button will close the window */
2325        overlay_gallery: false, /* If set to true, a gallery will overlay the fullscreen image on mouse over */
2326        keyboard_shortcuts: true, /* Set to false if you open forms inside prettyPhoto */
2327        deeplinking: false,
2328        social_tools: false
2329    });
2330}
2331
2332function checkTitleToShowOrHide(){
2333    if($j('.title_outer.animate_title_area').length){
2334        var title_area_height = $j('.title_outer').data('height');
2335        if($scroll > $j('.title').height()){
2336            $j('.title_outer').css({'height':title_area_height, 'opacity':'1', 'overflow':'visible'});
2337        }
2338    }
2339}
2340
2341/*
2342 **	Title area animation
2343 */
2344function initTitleAreaAnimation(){
2345    if($j('.title_outer.animate_title_area').length){
2346
2347        var title_area_height = $j('.title_outer').data('height');
2348        if($j('.title_outer').hasClass('with_image')){
2349            title_area_height = $j('.image.responsive').height();
2350        }
2351        if($scroll < $j('.title').height()){
2352            $j('.title_outer').animate({ height: title_area_height, opacity: 1}, 500, function(){
2353                $j(this).css({'overflow':'visible'});
2354                initPortfolioSingleInfo();
2355                if($j('nav.content_menu').length > 0){
2356                    content_menu_position = $j('nav.content_menu').offset().top;
2357                    contentMenuPosition();
2358                }
2359            });
2360        }
2361    }
2362}
2363
2364function cleanPortfolioMasXArray($elemXPosArray) {
2365    var i;
2366    var length = $elemXPosArray.length;
2367    var $elemXPosOutArray = [];
2368    var tmp = {};
2369
2370    for (i = 0; i < length; i++) {
2371        tmp[$elemXPosArray[i]] = 0;
2372    }
2373    for (i in tmp) {
2374        $elemXPosOutArray.push(i);
2375    }
2376    return $elemXPosOutArray;
2377}
2378
2379/*
2380 **	Title image with parallax effect
2381 */
2382function initParallaxTitle(){
2383    "use strict";
2384
2385    if(($j('.title').length > 0) && ($j('.touch').length === 0)){
2386
2387        if($j('.title.has_fixed_background').length){
2388
2389            var $background_size_width = parseInt($j('.title.has_fixed_background').css('background-size').match(/\d+/));
2390
2391            var title_holder_height = $j('.title.has_fixed_background').height();
2392            var title_rate = (title_holder_height / 10000) * 7;
2393
2394            var title_distance = $scroll - $j('.title.has_fixed_background').offset().top;
2395            var title_bpos = -(title_distance * title_rate);
2396            $j('.title.has_fixed_background').css({'background-position': 'center '+ (0+add_for_admin_bar) +'px' });
2397            if($j('.title.has_fixed_background').hasClass('zoom_out')){
2398                $j('.title.has_fixed_background').css({'background-size': $background_size_width-$scroll + 'px auto'});
2399            }
2400        }
2401
2402        $j(window).on('scroll', function() {
2403            if($j('.title.has_fixed_background').length){
2404
2405                var title_distance = $scroll - $j('.title.has_fixed_background').offset().top;
2406
2407                var title_bpos = -(title_distance * title_rate);
2408                $j('.title.has_fixed_background').css({'background-position': 'center ' + (title_bpos+add_for_admin_bar) + 'px' });
2409                if($j('.title.has_fixed_background').hasClass('zoom_out')){
2410                    $j('.title.has_fixed_background').css({'background-size': $background_size_width-$scroll + 'px auto'});
2411                }
2412            }
2413        });
2414    }
2415}
2416
2417/*
2418 Plugin: jQuery Parallax
2419 Version 1.1.3
2420 Author: Ian Lunn
2421 Twitter: @IanLunn
2422 Author URL: http://www.ianlunn.co.uk/
2423 Plugin URL: http://www.ianlunn.co.uk/plugins/jquery-parallax/
2424
2425 Dual licensed under the MIT and GPL licenses:
2426 http://www.opensource.org/licenses/mit-license.php
2427 http://www.gnu.org/licenses/gpl.html
2428 */
2429
2430(function( $ ){
2431    var $window = $(window);
2432    var windowHeight = $window.height();
2433
2434    $window.resize(function () {
2435        windowHeight = $window.height();
2436    });
2437
2438    $.fn.parallax = function(xpos, speedFactor, outerHeight) {
2439        var $this = $(this);
2440        var getHeight;
2441        var firstTop;
2442        var paddingTop = 0;
2443
2444        //get the starting position of each element to have parallax applied to it
2445        $this.each(function(){
2446            firstTop = $this.offset().top;
2447        });
2448
2449        if (outerHeight) {
2450            getHeight = function(jqo) {
2451                return jqo.outerHeight(true);
2452            };
2453        } else {
2454            getHeight = function(jqo) {
2455                return jqo.height();
2456            };
2457        }
2458
2459        // setup defaults if arguments aren't specified
2460        if (arguments.length < 1 || xpos === null) xpos = "50%";
2461        if (arguments.length < 2 || speedFactor === null) speedFactor = 0.1;
2462        if (arguments.length < 3 || outerHeight === null) outerHeight = true;
2463
2464        // function to be called whenever the window is scrolled or resized
2465        function update(){
2466            var pos = $window.scrollTop();
2467
2468            $this.each(function(){
2469                var $element = $(this);
2470                var top = $element.offset().top;
2471                var height = getHeight($element);
2472
2473                // Check if totally above or totally below viewport
2474                if (top + height < pos || top > pos + windowHeight) {
2475                    return;
2476                }
2477
2478                $this.css('backgroundPosition', xpos + " " + Math.round((firstTop - pos) * speedFactor) + "px");
2479            });
2480        }
2481
2482        $window.bind('scroll', update).resize(update);
2483        update();
2484    };
2485})(jQuery);
2486
2487
2488/*
2489 **	Sections with parallax background image
2490 */
2491function initParallax(){
2492    "use strict";
2493
2494    if($j('.parallax_section_holder').length){
2495        $j('.parallax_section_holder').each(function() {
2496            if($j(this).hasClass('full_screen_height_parallax')){ $j(this).height($window_height); $j(this).find('.parallax_content_outer').css('padding',0); }
2497            var speed = $j(this).data('speed')*0.4;
2498            $j(this).parallax("50%", speed);
2499        });
2500    }
2501}
2502
2503/*
2504 **	Smooth scroll functionality for Side Area
2505 */
2506function initSideAreaScroll(){
2507    "use strict";
2508
2509    if($j('.side_menu').length){
2510        $j(".side_menu").niceScroll({
2511            scrollspeed: 60,
2512            mousescrollstep: 40,
2513            cursorwidth: 0,
2514            cursorborder: 0,
2515            cursorborderradius: 0,
2516            cursorcolor: "transparent",
2517            autohidemode: false,
2518            horizrailenabled: false
2519        });
2520    }
2521}
2522
2523/*
2524 **	Smooth scroll functionality for Vertical Menu Area Toogle style
2525 */
2526function initVerticalAreaMenuScroll(){
2527    "use strict";
2528
2529    if($j('.vertical_menu_area.with_scroll').length){
2530        $j(".vertical_menu_area.with_scroll").niceScroll({
2531            scrollspeed: 60,
2532            mousescrollstep: 40,
2533            cursorwidth: 0,
2534            cursorborder: 0,
2535            cursorborderradius: 0,
2536            cursorcolor: "transparent",
2537            autohidemode: false,
2538            horizrailenabled: false
2539        });
2540    }
2541}
2542
2543/*
2544 **	Show/Hide Mobile menu
2545 */
2546function initMobileMenu(){
2547    "use strict";
2548
2549    $j(".mobile_menu_button span").on('tap click', function(e){
2550        e.preventDefault();
2551
2552        if ($j(".mobile_menu > ul").is(":visible")){
2553            $j(".mobile_menu > ul").slideUp(200);
2554        } else {
2555            $j(".mobile_menu > ul").slideDown(200);
2556        }
2557    });
2558
2559    $j(".mobile_menu > ul > li.has_sub > span.mobile_arrow, .mobile_menu > ul > li.has_sub > h3, .mobile_menu > ul > li.has_sub > a[href*='#']").on('tap click', function(e){
2560        e.preventDefault();
2561
2562        if ($j(this).closest('li.has_sub').find("> ul.sub_menu").is(":visible")){
2563            $j(this).closest('li.has_sub').find("> ul.sub_menu").slideUp(200);
2564            $j(this).closest('li.has_sub').removeClass('open_sub');
2565        } else {
2566            $j(this).closest('li.has_sub').addClass('open_sub');
2567            $j(this).closest('li.has_sub').find("> ul.sub_menu").slideDown(200);
2568        }
2569    });
2570
2571    $j(".mobile_menu > ul > li.has_sub > ul.sub_menu > li.has_sub > span.mobile_arrow, .mobile_menu > ul > li.has_sub > ul.sub_menu > li.has_sub > h3, .mobile_menu > ul > li.has_sub > ul.sub_menu > li.has_sub > a[href*='#']").on('tap click', function(e){
2572        e.preventDefault();
2573
2574        if ($j(this).parent().find("ul.sub_menu").is(":visible")){
2575            $j(this).parent().find("ul.sub_menu").slideUp(200);
2576            $j(this).parent().removeClass('open_sub');
2577        } else {
2578            $j(this).parent().addClass('open_sub');
2579            $j(this).parent().find("ul.sub_menu").slideDown(200);
2580        }
2581    });
2582
2583    $j(".mobile_menu ul li > a, .q_logo a").on('click', function(){
2584
2585        if(($j(this).attr('href') !== "http://#") && ($j(this).attr('href') !== "#")){
2586            $j(".mobile_menu > ul").slideUp();
2587        }
2588    });
2589}
2590
2591
2592/*
2593 **	Init flexslider for portfolio single
2594 */
2595function initFlexSlider(){
2596    "use strict";
2597    $j('.flexslider').each(function(){
2598        var interval = 8000;
2599        if(typeof $j(this).data('interval') !== 'undefined' && $j(this).data('interval') !== false) {
2600            interval = parseFloat($j(this).data('interval')) * 1000;
2601        }
2602
2603        var slideshow = true;
2604        if(interval === 0) {
2605            slideshow = false;
2606        }
2607
2608        var animation = 'slide';
2609        if(typeof $j(this).data('flex_fx') !== 'undefined' && $j(this).data('flex_fx') !== false) {
2610            animation = $j(this).data('flex_fx');
2611        }
2612
2613        $j(this).flexslider({
2614            animationLoop: true,
2615            controlNav: false,
2616            useCSS: false,
2617            pauseOnAction: true,
2618            pauseOnHover: true,
2619            slideshow: slideshow,
2620            animation: animation,
2621            prevText: "<span class='arrow_carrot-left'></span>",
2622            nextText: "<span class='arrow_carrot-right'></span>",
2623            animationSpeed: 600,
2624            slideshowSpeed: interval,
2625            start: function(){
2626                setTimeout(function(){$j(".flexslider").fitVids();},100);
2627            }
2628        });
2629
2630        $j('.flex-direction-nav a').click(function(e){
2631            e.preventDefault();
2632            e.stopImmediatePropagation();
2633            e.stopPropagation();
2634        });
2635    });
2636}
2637
2638/*
2639 **	Init fitVideo function for responsive video files
2640 */
2641function fitVideo(){
2642    "use strict";
2643
2644    $j(".portfolio_images").fitVids();
2645    $j(".video_holder").fitVids();
2646    $j(".format-video .post_image").fitVids();
2647    $j(".format-video .q_masonry_blog_post_image").fitVids();
2648    $j(".portfolio_owl_slider").fitVids();
2649}
2650
2651/*
2652 **	Function for follow portfolio single descripton
2653 */
2654var $scrollHeight;
2655function initPortfolioSingleInfo(){
2656    "use strict";
2657
2658    var $sidebar = $j(".portfolio_single_follow");
2659    if($j(".portfolio_single_follow").length > 0){
2660
2661        var offset = $sidebar.offset();
2662        $scrollHeight = $j(".portfolio_container").height();
2663        var $scrollOffset = $j(".portfolio_container").offset();
2664        var $window = $j(window);
2665
2666        var $headerHeight = parseInt($j('header.page_header').css('height'), 10);
2667        var $headerTopHeight = $j('.header_top').length ? $j('.header_top').height() : 0;
2668
2669        var paspartuAdd = $j('body').hasClass('paspartu_enabled') ? $window_width*paspartu_width : 0;
2670
2671        $window.scroll(function() {
2672            if($window.width() > 960){
2673                if ($scroll + $headerHeight + paspartuAdd > offset.top) {
2674                    if ($scroll + $headerHeight + $headerTopHeight + paspartuAdd + $sidebar.height() + 24 < $scrollOffset.top + $scrollHeight) {
2675
2676                        $sidebar.stop().animate({
2677                            top: $window.scrollTop() - offset.top + $headerHeight + $headerTopHeight + paspartuAdd
2678                        });
2679                    } else {
2680                        $sidebar.stop().animate({
2681                            top: $scrollHeight - $sidebar.height() - 24
2682                        });
2683                    }
2684                } else {
2685                    $sidebar.stop().animate({
2686                        top: 0
2687                    });
2688                }
2689            }else{
2690                $sidebar.css('top',0);
2691            }
2692        });
2693    }
2694}
2695
2696
2697
2698/**
2699 * Init Portfolio Full Screen Slider
2700 */
2701var qodefPortfolioFullScreenSlider = function() {
2702
2703    var sliderHolder = $j('.qodef-full-screen-slider-holder');
2704    var content = $j('.wrapper .content');
2705    var sliders = $j('.qodef-portfolio-full-screen-slider');
2706
2707
2708    var qodefFullScreenSliderHeight = function() {
2709        if (sliderHolder.length) {
2710
2711            var contentMargin = parseInt(content.css('margin-top'));
2712            var header_height = $j('.page_header').height();
2713
2714            var paspartuAdd = $j('body').hasClass('paspartu_enabled') ? $window_width*paspartu_width*2 : 0;
2715
2716            if($window_width > 1000) {
2717                if($j('header').hasClass('regular')){
2718                    sliderHolder.css("height", $window_height - header_height - paspartuAdd);
2719                } else {
2720                    sliderHolder.css("height", $window_height - paspartuAdd);
2721                }
2722            }
2723            else {
2724                sliderHolder.css("height", $window_height - header_height - paspartuAdd); // window height - mobile height
2725            }
2726        }
2727    }
2728
2729    var qodefFullScreenOwlSlider = function() {
2730
2731        if (sliderHolder.length) {
2732
2733            sliders.each(function () {
2734
2735                var slider = $j(this);
2736                slider.owlCarousel({
2737                    items: 1,
2738                    center: true,
2739                    loop: true,
2740                    margin: 0,
2741                    animateOut: 'fadeOut',
2742                    animateIn: 'fadeIn',
2743                    dots: false,
2744                    nav: true,
2745                    video: true,
2746                    navText: [
2747                        "<span class='arrow_carrot-left'></span>",
2748                        "<span class='arrow_carrot-right'></span>"
2749                    ]
2750                }).animate({'opacity': 1}, 600);
2751
2752            });
2753        }
2754
2755    }
2756
2757    var qodefFullScreenSliderInfo = function() {
2758
2759        if (sliderHolder.length) {
2760
2761            var sliderContent = $j('.qodef-portfolio-slider-content');
2762            var close = $j('.qodef-control.qodef-close');
2763            var description = $j('.qodef-description');
2764            var info = $j('.qodef-portfolio-slider-content-info');
2765
2766            sliderContent.on('click',function(e){
2767                if (!sliderContent.hasClass('opened')) {
2768                    e.preventDefault();
2769                    description.fadeOut(400, function() {
2770                        sliderContent.addClass('opened');
2771                        setTimeout(function(){
2772                            info.fadeIn(400);
2773                        }, 400);
2774                        setTimeout(function(){
2775                            $j(".qodef-portfolio-slider-content-info").niceScroll({
2776                                scrollspeed: 60,
2777                                mousescrollstep: 40,
2778                                cursorwidth: 0,
2779                                cursorborder: 0,
2780                                cursorborderradius: 0,
2781                                cursorcolor: "transparent",
2782                                autohidemode: false,
2783                                horizrailenabled: false
2784                            });
2785                        }, 800);
2786                    });
2787                }
2788            });
2789
2790            close.on('click',function(e){
2791                e.preventDefault();
2792                e.stopPropagation();
2793                info.fadeOut( 400, function() {
2794                    sliderContent.removeClass('opened');
2795                    setTimeout(function() {
2796                        description.fadeIn(400);
2797                    }, 400);
2798                });
2799            });
2800
2801        }
2802
2803    }
2804    return {
2805        init : function() {
2806            qodefFullScreenSliderHeight();
2807            qodefFullScreenOwlSlider();
2808            qodefFullScreenSliderInfo();
2809
2810            $j(window).resize(function(){
2811                qodefFullScreenSliderHeight();
2812            });
2813        }
2814    };
2815}
2816
2817
2818/*
2819 **	Init portfolio owl slider
2820 */
2821function intPortfolioOWLSlider(){
2822    "use strict";
2823
2824    $j('.portfolio_owl_slider').each(function(){
2825        $j(this).owlCarousel({
2826            items: 1,
2827            center: true,
2828            stagePadding: 140,
2829            loop:true,
2830            margin:0,
2831            nav:true,
2832            video:true,
2833            navText:[
2834                "<span class='arrow_carrot-left'></span>",
2835                "<span class='arrow_carrot-right'></span>"
2836            ],
2837            responsive:{
2838                0:{
2839                    stagePadding: 60
2840                },
2841                600:{
2842                    stagePadding: 120
2843                },
2844                1000:{
2845                    stagePadding: 160
2846                }
2847            }
2848
2849        }).animate({'opacity': 1},600);
2850    });
2851}
2852
2853
2854
2855/*
2856 **	Init tabs shortcodes
2857 */
2858function initTabs(){
2859    "use strict";
2860    if($j('.q_tabs').length){
2861        $j('.q_tabs').appear(function() {
2862            $j('.q_tabs').css('visibility', 'visible');
2863        },{accX: 0, accY: -100});
2864        var $tabsNav = $j('.tabs-nav');
2865        var $tabsNavLis = $tabsNav.children('li');
2866        $tabsNav.each(function() {
2867            var $this = $j(this);
2868            $this.next().children('.tab-content').stop(true,true).hide().first().show();
2869            $this.children('li').first().addClass('active').stop(true,true).show();
2870        });
2871        $tabsNavLis.on('click', function(e) {
2872            var $this = $j(this);
2873            $this.siblings().removeClass('active').end().addClass('active');
2874            $this.parent().next().children('.tab-content').stop(true,true).hide().siblings( $this.find('a').attr('href') ).fadeIn();
2875            e.preventDefault();
2876        });
2877    }
2878}
2879
2880/*
2881 **	Init accordion and toogle shortcodes
2882 */
2883function initAccordion() {
2884    "use strict";
2885
2886    if($j(".q_accordion_holder").length){
2887        $j(".q_accordion_holder").appear(function() {
2888            $j(".q_accordion_holder").css('visibility', 'visible');
2889        },{accX: 0, accY: -100});
2890
2891        if ($j(".accordion").length) {
2892            $j(".accordion").accordion({
2893                animate: "swing",
2894                collapsible: true,
2895                active: false,
2896                icons: "",
2897                heightStyle: "content"
2898            });
2899
2900            //define custom options for each accordion
2901            $j(".accordion").each(function() {
2902                var activeTab = parseInt($j(this).data('active-tab'));
2903                if(activeTab !== "") {
2904                    activeTab = activeTab - 1; // - 1 because active tab is set in 0 index base
2905                    $j(this).accordion('option', 'active', activeTab);
2906                }
2907                var borderRadius = parseInt($j(this).data('border-radius'));
2908
2909                if(borderRadius !== "") {
2910                    $j(this).find('.accordion_mark').css('border-radius', borderRadius+"px");
2911                }
2912                var collapsible = ($j(this).data('collapsible') == 'yes') ? true : false;
2913                $j(this).accordion('option', 'collapsible', collapsible);
2914                $j(this).accordion('option', 'collapsible', collapsible);
2915            });
2916        }
2917        $j(".toggle").addClass("accordion ui-accordion ui-accordion-icons ui-widget ui-helper-reset")
2918            .find(".title-holder")
2919            .addClass("ui-accordion-header ui-helper-reset ui-state-default ui-corner-top ui-corner-bottom")
2920            .hover(function() {
2921                $j(this).toggleClass("ui-state-hover");
2922            })
2923            .click(function() {
2924                $j(this)
2925                    .toggleClass("ui-accordion-header-active ui-state-active ui-state-default ui-corner-bottom")
2926                    .next().toggleClass("ui-accordion-content-active").slideToggle(400);
2927                return false;
2928            })
2929            .next()
2930            .addClass("ui-accordion-content ui-helper-reset ui-widget-content ui-corner-bottom")
2931            .hide();
2932
2933        $j(".toggle").each(function() {
2934            var activeTab = parseInt($j(this).data('active-tab'));
2935
2936            var borderRadius = parseInt($j(this).data('border-radius'));
2937
2938            if(borderRadius !== "") {
2939                $j(this).find('.accordion_mark').css('border-radius', borderRadius+"px");
2940            }
2941
2942            if(activeTab !== "" && activeTab >= 1) {
2943                activeTab = activeTab - 1; // - 1 because active tab is set in 0 index base
2944                $j(this).find('.ui-accordion-content').eq(activeTab).show();
2945                $j(this).find('.ui-accordion-header').eq(activeTab).addClass('ui-state-active'); //set active accordion header
2946            }
2947
2948        });
2949    }
2950}
2951
2952/*
2953 **	Function to enable link in accordion
2954 */
2955function initAccordionContentLink(){
2956    "use strict";
2957
2958    if($j(".accordion").length){
2959        $j('.accordion_holder .accordion_inner .accordion_content a').click(function(){
2960            if($j(this).attr('target') === '_blank'){
2961                window.open($j(this).attr('href'),'_blank');
2962            }else{
2963                window.open($j(this).attr('href'),'_self');
2964            }
2965            return false;
2966        });
2967    }
2968}
2969
2970/*
2971 **	Init testimonials shortcode
2972 */
2973function initTestimonials(){
2974    "use strict";
2975
2976    if($j('.testimonials_carousel').length){
2977        $j('.testimonials_carousel').each(function(){
2978            $j(this).appear(function() {
2979                $j(this).css('visibility','visible');
2980            },{accX: 0, accY: -100});
2981
2982            var interval = 5000;
2983            if(typeof $j(this).data('auto-rotate-slides') !== 'undefined' && $j(this).data('auto-rotate-slides') !== false) {
2984                interval = parseFloat($j(this).data('auto-rotate-slides')) * 1000;
2985            }
2986
2987            var slideshow = true;
2988            if(interval === 0) {
2989                slideshow = false;
2990            }
2991
2992            var animation = 'fade';
2993            if(typeof $j(this).data('animation-type') !== 'undefined' && $j(this).data('animation-type') !== false) {
2994                animation = $j(this).data('animation-type');
2995            }
2996
2997            var directionNav = true;
2998            if(typeof $j(this).data('show-navigation') !== 'undefined') {
2999                directionNav = $j(this).data('show-navigation') == 'no' ? false : true;
3000            }
3001
3002            var animationSpeed = 600;
3003            if(typeof $j(this).data('animation-speed') !== 'undefined' && $j(this).data('animation-speed') !== false) {
3004                animationSpeed = $j(this).data('animation-speed');
3005            }
3006
3007            $j(this).flexslider({
3008                animationLoop: true,
3009                controlNav: directionNav,
3010                directionNav: false,
3011                useCSS: false,
3012                pauseOnAction: true,
3013                pauseOnHover: false,
3014                slideshow: slideshow,
3015                animation: animation,
3016                itemMargin: 25,
3017                minItems: 1,
3018                maxItems: 1,
3019                animationSpeed: animationSpeed,
3020                slideshowSpeed: interval,
3021                start: function(slider){
3022                    initParallax();
3023                }
3024            });
3025        });
3026
3027    }
3028}
3029
3030/*
3031 **	Function to close message shortcode
3032 */
3033function initMessages(){
3034    "use strict";
3035
3036    if($j('.q_message').length){
3037        $j('.q_message').each(function(){
3038            $j(this).find('.close').click(function(e){
3039                e.preventDefault();
3040                $j(this).parent().parent().fadeOut(500);
3041            });
3042        });
3043    }
3044}
3045/*
3046 **	Init Element Animations
3047 */
3048function initElementsAnimation(){
3049    "use strict";
3050
3051    if($j(".element_from_fade").length > 0 && $j('.no_animation_on_touch').length === 0){
3052        $j('.element_from_fade').each(function(){
3053            var $this = $j(this);
3054
3055            $this.appear(function() {
3056                $this.addClass('element_from_fade_on');
3057            }
3057,{accX: 0, accY: -100});
3058        });
3059    }
3060
3061    if($j(".element_from_left").length > 0 && $j('.no_animation_on_touch').length === 0){
3062        $j('.element_from_left').each(function(){
3063            var $this = $j(this);
3064
3065            $this.appear(function() {
3066                $this.addClass('element_from_left_on');
3067            },{accX: 0, accY: -100});
3068        });
3069    }
3070
3071    if($j(".element_from_right").length > 0 && $j('.no_animation_on_touch').length === 0){
3072        $j('.element_from_right').each(function(){
3073            var $this = $j(this);
3074
3075            $this.appear(function() {
3076                $this.addClass('element_from_right_on');
3077            },{accX: 0, accY: -100});
3078        });
3079    }
3080
3081    if($j(".element_from_top").length > 0 && $j('.no_animation_on_touch').length === 0){
3082        $j('.element_from_top').each(function(){
3083            var $this = $j(this);
3084
3085            $this.appear(function() {
3086                $this.addClass('element_from_top_on');
3087            },{accX: 0, accY: -100});
3088        });
3089    }
3090
3091    if($j(".element_from_bottom").length > 0 && $j('.no_animation_on_touch').length === 0){
3092        $j('.element_from_bottom').each(function(){
3093            var $this = $j(this);
3094
3095            $this.appear(function() {
3096                $this.addClass('element_from_bottom_on');
3097            },{accX: 0, accY: -100});
3098        });
3099    }
3100
3101    if($j(".element_transform").length > 0 && $j('.no_animation_on_touch').length === 0){
3102        $j('.element_transform').each(function(){
3103            var $this = $j(this);
3104
3105            $this.appear(function() {
3106                $this.addClass('element_transform_on');
3107            },{accX: 0, accY: -100});
3108        });
3109    }
3110}
3111
3112/*
3113 **	Init audio player for blog layout
3114 */
3115function fitAudio(){
3116    "use strict";
3117
3118    $j('audio.blog_audio').mediaelementplayer({
3119        audioWidth: '100%'
3120    });
3121}
3122
3123/*
3124 **	Init masonry layout for blog template
3125 */
3126function initBlog(){
3127    "use strict";
3128
3129    if($j('.blog_holder.masonry').length){
3130        var width_blog = $j(this).closest('.container_inner').width();
3131        if($j('.blog_holder.masonry').closest(".column_inner").length) {
3132            width_blog = $j('.blog_holder.masonry').closest(".column_inner").width();
3133        }
3134        $j('.blog_holder.masonry').width(width_blog);
3135        var $container = $j('.blog_holder.masonry');
3136        var $cols = 3;
3137
3138        if($container.width() < 420) {
3139            $cols = 1;
3140        } else if($container.width() <= 805) {
3141            $cols = 2;
3142        }
3143
3144        $container.isotope({
3145            itemSelector: 'article',
3146            resizable: false,
3147            masonry: { columnWidth: $j('.blog_holder.masonry').width() / $cols }
3148        });
3149
3150
3151        $j('.filter').click(function(){
3152            var selector = $j(this).attr('data-filter');
3153            $container.isotope({ filter: selector });
3154            return false;
3155        });
3156
3157        if( $container.hasClass('masonry_infinite_scroll')){
3158            $container.infinitescroll({
3159                    navSelector  : '.blog_infinite_scroll_button span',
3160                    nextSelector : '.blog_infinite_scroll_button span a',
3161                    itemSelector : 'article',
3162                    loading: {
3163                        finishedMsg: finished_text,
3164                        msgText  : loading_text
3165                    }
3166                },
3167                // call Isotope as a callback
3168                function( newElements ) {
3169                    $container.isotope( 'appended', $j( newElements ) );
3170                    fitVideo();
3171                    fitAudio();
3172                    initFlexSlider();
3173                    setTimeout(function(){
3174                        $j('.blog_holder.masonry').isotope( 'layout');
3175                    },400);
3176
3177
3178                }
3179            );
3180        }else if($container.hasClass('masonry_load_more')){
3181
3182            var i = 1;
3183            $j('.blog_load_more_button a').on('click', function(e)  {
3184                e.preventDefault();
3185
3186                var link = $j(this).attr('href');
3187                var $content = '.masonry_load_more';
3188                var $anchor = '.blog_load_more_button a';
3189                var $next_href = $j($anchor).attr('href');
3190                $j.get(link+'', function(data){
3191                    var $new_content = $j($content, data).wrapInner('').html();
3192                    $next_href = $j($anchor, data).attr('href');
3193                    $container.append( $j( $new_content) ).isotope( 'reloadItems' ).isotope({ sortBy: 'original-order' });
3194                    fitVideo();
3195                    fitAudio();
3196                    initFlexSlider();
3197                    setTimeout(function(){
3198                        $j('.blog_holder.masonry').isotope( 'layout');
3199                    },400);
3200                    if($j('.blog_load_more_button span').attr('rel') > i) {
3201                        $j('.blog_load_more_button a').attr('href', $next_href); // Change the next URL
3202                    } else {
3203                        $j('.blog_load_more_button').remove();
3204                    }
3205
3206                    setTimeout(function(){
3207                        $j('article:not(.show)').each(function(l){
3208                            $j(this).addClass('show');
3209                        });
3210                    }, 1000);
3211
3212                });
3213                i++;
3214
3215            });
3216        }
3217
3218        $j(window).resize(function(){
3219            if($container.width() < 420) {
3220                $cols = 1;
3221            } else if($container.width() <= 785) {
3222                $cols = 2;
3223            } else {
3224                $cols = 3;
3225            }
3226        });
3227
3228        if($j('.blog_appear_from_bottom').length){
3229            $j('.blog_holder').find('article').each(function(l) {
3230                $j(this).appear(function() {
3231                    var $this = $j(this);
3232                    $this.addClass('show');
3233                }
3233,{accX: 0, accY: -70});
3234            });
3235        }
3236
3237        $j('.blog_holder.masonry, .blog_load_more_button_holder').animate({opacity: "1"}, 400, function(){
3238            $j('.blog_holder.masonry').isotope( 'layout');
3239        });
3240    }
3241}
3242
3243/*
3244 **	Init full width masonry layout for blog template
3245 */
3246function initBlogMasonryFullWidth(){
3247    "use strict";
3248
3249    if($j('.masonry_full_width').length){
3250        var width_blog = $j('.full_width_inner').width();
3251
3252        $j('.masonry_full_width').width(width_blog);
3253        var $container = $j('.masonry_full_width');
3254
3255
3256        if($j('.masonry_full_width').hasClass('pinterest_full_width')) {
3257            var $cols = 4;
3258
3259            if($container.width() < 480) {
3260                $cols = 1;
3261            } else if($container.width() <= 950) {
3262                $cols = 2;
3263            } else if($container.width() <= 1320) {
3264                $cols = 3;
3265            }
3266
3267
3268        } else {
3269            var $cols = 5;
3270
3271            if($container.width() < 480) {
3272                $cols = 1;
3273            } else if($container.width() <= 703) {
3274                $cols = 2;
3275            } else if($container.width() <= 920) {
3276                $cols = 3;
3277            } else if($container.width() <= 1320) {
3278                $cols = 4;
3279            }
3280        }
3281
3282
3283        $j('.filter').click(function(){
3284            var selector = $j(this).attr('data-filter');
3285            $container.isotope({ filter: selector });
3286            return false;
3287        });
3288        if( $container.hasClass('masonry_infinite_scroll')){
3289            $container.infinitescroll({
3290                    navSelector  : '.blog_infinite_scroll_button span',
3291                    nextSelector : '.blog_infinite_scroll_button span a',
3292                    itemSelector : 'article',
3293                    loading: {
3294                        finishedMsg: finished_text,
3295                        msgText  : loading_text
3296                    }
3297                },
3298                // call Isotope as a callback
3299                function( newElements ) {
3300                    $container.isotope( 'appended', $j( newElements ) );
3301                    fitVideo();
3302                    fitAudio();
3303                    initFlexSlider();
3304                    setTimeout(function(){
3305                        $j('.blog_holder.masonry_full_width').isotope( 'layout');
3306                    },400);
3307                }
3308            );
3309        }else if($container.hasClass('masonry_load_more')){
3310
3311            var i = 1;
3312            $j('.blog_load_more_button a').on('click', function(e)  {
3313                e.preventDefault();
3314
3315                var link = $j(this).attr('href');
3316                var $content = '.masonry_load_more';
3317                var $anchor = '.blog_load_more_button a';
3318                var $next_href = $j($anchor).attr('href');
3319                $j.get(link+'', function(data){
3320                    var $new_content = $j($content, data).wrapInner('').html();
3321                    $next_href = $j($anchor, data).attr('href');
3322                    $container.append( $j( $new_content) ).isotope( 'reloadItems' ).isotope({ sortBy: 'original-order' });
3323                    fitVideo();
3324                    fitAudio();
3325                    initFlexSlider();
3326                    setTimeout(function(){
3327                        $j('.blog_holder.masonry_full_width').isotope( 'layout');
3328                    },400);
3329                    if($j('.blog_load_more_button span').attr('rel') > i) {
3330                        $j('.blog_load_more_button a').attr('href', $next_href); // Change the next URL
3331                    } else {
3332                        $j('.blog_load_more_button').remove();
3333                    }
3334
3335                    setTimeout(function(){
3336                        $j('article:not(.show)').each(function(l){
3337                            $j(this).addClass('show');
3338                        });
3339                    }, 1000);
3340                });
3341                i++;
3342
3343            });
3344        }
3345        $container.isotope({
3346            itemSelector: 'article',
3347            resizable: false,
3348            masonry: { columnWidth: $j('.masonry_full_width').width() / $cols }
3349        });
3350
3351        $j(window).resize(function(){
3352            if($container.width() < 480) {
3353                $cols = 1;
3354            } else if($container.width() <= 703) {
3355                $cols = 2;
3356            } else if($container.width() <= 920) {
3357                $cols = 3;
3358            } else if($container.width() <= 1320) {
3359                $cols = 4;
3360            } else {
3361                $cols = 5;
3362            }
3363        });
3364
3365        if($j('.blog_appear_from_bottom').length){
3366            $j('.blog_holder').find('article').each(function(l) {
3367                $j(this).appear(function() {
3368                    var $this = $j(this);
3369                    $this.addClass('show');
3370                }
3370,{accX: 0, accY: -70});
3371            });
3372        }
3373
3374        $j('.masonry_full_width, .blog_load_more_button_holder').animate({opacity: "1"}, 400, function(){
3375            $j('.blog_holder.masonry_full_width').isotope( 'layout');
3376        });
3377    }
3378}
3379
3380/*
3381 **	Init full width masonry layout for blog template
3382 */
3383function initBlogChequered() {
3384    "use strict";
3385    var blogHolder = $j('.blog_holder.blog_chequered');
3386    var maxHeight = -1;
3387    if(blogHolder.length){
3388        var elements = blogHolder.find('article');
3389        elements.each(function() {
3390            maxHeight = maxHeight > $j(this).find('.qodef-post-content-inner').outerHeight() ? maxHeight : $j(this).find('.qodef-post-content-inner').outerHeight();
3391        });
3392        elements.each(function() {
3393            $j(this).find('.qodef-post-content').height(maxHeight);
3394            $j(this).css("opacity","1");
3395        });
3396    }
3397}
3398
3399
3400
3401/*
3402 **	Init portfolio single masonry
3403 */
3404function initPortfolioSingleMasonry(){
3405    "use strict";
3406
3407    if($j('.portfolio_single.masonry-gallery').length){
3408
3409        var width = $j('.portfolio_single.masonry-gallery').width();
3410        $j('.portfolio_single .portfolio_masonry_gallery').width(width);
3411
3412        var $container = $j('.portfolio_single .portfolio_masonry_gallery');
3413        var $cols = 4;
3414
3415        if($container.width() < 420) {
3416            $cols = 1;
3417        } else if($container.width() <= 805) {
3418            $cols = 3;
3419        }
3420
3421        $container.isotope({
3422            itemSelector: '.mix',
3423            resizable: false,
3424            masonry: { columnWidth: $j('.portfolio_single .portfolio_masonry_gallery').width() / $cols }
3425        });
3426
3427        $j('.portfolio_single .portfolio_masonry_gallery').css("opacity", "1");
3428
3429
3430        $j(window).resize(function(){
3431            if($container.width() <= 420) {
3432                $cols = 1;
3433            } else if($container.width() <= 785) {
3434                $cols = 3;
3435            } else {
3436                $cols = 4;
3437            }
3438        });
3439
3440    }
3441}
3442
3443/*
3444 **	Init progress bar with icon
3445 */
3446var timeOuts = [];
3447function initProgressBarsIcon(){
3448    "use strict";
3449
3450    if($j('.q_progress_bars_icons_holder').length){
3451        $j('.q_progress_bars_icons_holder').each(function() {
3452            var $this = $j(this);
3453            $this.appear(function() {
3454                $this.find('.q_progress_bars_icons').css('opacity','1');
3455                $this.find('.q_progress_bars_icons').each(function() {
3456                    var number = $j(this).find('.q_progress_bars_icons_inner').data('number');
3457                    var size = $j(this).find('.q_progress_bars_icons_inner').data('size');
3458
3459                    if(size !== ""){
3460                        $j(this).find('.q_progress_bars_icons_inner.custom_size .bar').css({'width': size+'px','height':size+'px'});
3461                        $j(this).find('.q_progress_bars_icons_inner.custom_size .bar .fa-stack').css({'font-size': size/2+'px'});
3462                    }
3463
3464                    var bars = $j(this).find('.bar');
3465
3466                    bars.each(function(i){
3467                        if(i < number){
3468                            var time = (i + 1)*150;
3469                            timeOuts[i] = setTimeout(function(){
3470                                $j(bars[i]).addClass('active');
3471                            },time);
3472                        }
3473                    });
3474                });
3475            },{accX: 0, accY: -150});
3476        });
3477    }
3478}
3479
3480/*
3481 **	Init more facts shortcode
3482 */
3483function initMoreFacts(){
3484    "use strict";
3485
3486    if($j('.more_facts_holder').length){
3487        $j('.more_facts_holder').each(function(){
3488            var $this = $j(this);
3489
3490            var $more_label = 'More Facts';
3491
3492            if($this.find('.more_facts_button').data('morefacts') !== ""){
3493                $more_label = $this.find('.more_facts_button').data('morefacts');
3494            }
3495
3496            var $less_label = 'Less Facts';
3497
3498            if($this.find('.more_facts_button').data('lessfacts') !== ""){
3499                $less_label = $this.find('.more_facts_button').data('lessfacts');
3500            }
3501
3502            var height = $this.find('.more_facts_inner').height() + 70;
3503
3504            var speed;
3505            if(height > 0 && height < 601){
3506                speed = 800;
3507            } else if(height > 600 && height < 1201){
3508                speed = 1500;
3509            } else{
3510                speed = 2100;
3511            }
3512            $this.find('.more_facts_outer').css({'height':'0px','display':'none','opacity':'0'});
3513
3514            $this.find('.more_facts_button').on("mouseenter",function(){
3515                $j(this).css('color',$j(this).data('hovercolor'));
3516            }).on("mouseleave",function() {
3517                if(!$this.find('.more_facts_outer').is(':visible')){
3518                    $j(this).css('color',$j(this).data('color'));
3519                }
3520            });
3521
3522            $this.find('.more_facts_button').click(function(){
3523                if(!$this.find('.more_facts_outer').is(':visible')){
3524                    $this.find('.more_facts_fake_arrow').fadeIn(speed);
3525                    $this.addClass('more_fact_opened');
3526                    $j(this).parent().parent().find('.more_facts_outer').css({'display':'block','opacity':'1'}).stop().animate({'height': height+30}, speed, function() {
3527                        if($j('.parallax_section_holder').length) {
3528                            initParallax();
3529                        }
3530                    });
3531                    $j(this).find('.more_facts_button_text').text($less_label);
3532                    $j(this).find('.more_facts_button_arrow').addClass('rotate_arrow');
3533                } else {
3534                    $this.find('.more_facts_fake_arrow').fadeOut(speed);
3535                    $j(this).parent().parent().find('.more_facts_outer').stop().animate({'height': '0px'}, speed,function(){
3536                        $j(this).css({'display':'none','opacity':'0'});
3537
3538                        if(!$this.find('.more_facts_button').is(":hover")){$this.find('.more_facts_button').css('color',$this.find('.more_facts_button').data('color'));}
3539                        $this.removeClass('more_fact_opened');
3540                        if($j('.parallax_section_holder').length) {
3541                            initParallax();
3542                        }
3543                    });
3544                    $j(this).find('.more_facts_button_text').text($more_label);
3545                    $j(this).find('.more_facts_button_arrow').removeClass('rotate_arrow');
3546                }
3547            });
3548        });
3549    }
3550}
3551
3552/*
3553 ** Calculating minimal height for content when paspartu is enabled
3554 */
3555
3556function contentMinHeightWithPaspartu(){
3557    "use strict";
3558
3559    if ($j('.paspartu_enabled').length) {
3560        var content_height;
3561        var paspartu_final_width_px = 0;
3562        var paspartu_width_px = $window_width*paspartu_width;
3563        var footer_height = $j('footer').height();
3564
3565        paspartu_final_width_px = 2*paspartu_width_px;
3566
3567        content_height = $window_height - header_height - paspartu_final_width_px - footer_height;
3568
3569        if($j('.content').length){
3570            $j('.content').css('min-height',content_height);
3571        }
3572    }
3573}
3574
3575/*
3576 **	Replace plceholder
3577 */
3578function placeholderReplace(){
3579    "use strict";
3580
3581    $j('#contact-form [placeholder]').focus(function() {
3582        var input = $j(this);
3583        if (input.val() === input.attr('placeholder')) {
3584            if (this.originalType) {
3585                this.type = this.originalType;
3586                delete this.originalType;
3587            }
3588            input.val('');
3589            input.removeClass('placeholder');
3590        }
3591    }).blur(function() {
3592        var input = $j(this);
3593        if (input.val() === '') {
3594            if (this.type === 'password') {
3595                this.originalType = this.type;
3596                this.type = 'text';
3597            }
3598            input.addClass('placeholder');
3599            input.val(input.attr('placeholder'));
3600        }
3601    }).blur();
3602
3603    $j('#contact-form [placeholder]').parents('form').submit(function () {
3604        $j(this).find('[placeholder]').each(function () {
3605            var input = $j(this);
3606            if (input.val() === input.attr('placeholder')) {
3607                input.val('');
3608            }
3609        });
3610    });
3611}
3612
3613function totop_button(a) {
3614    "use strict";
3615
3616    var b = $j("#back_to_top");
3617    b.removeClass("off on");
3618    if (a === "on") { b.addClass("on"); } else { b.addClass("off"); }
3619}
3620
3621function backButtonShowHide(){
3622    "use strict";
3623
3624    $j(window).scroll(function () {
3625        var b = $j(this).scrollTop();
3626        var c = $j(this).height();
3627        var d;
3628        if (b > 0) { d = b + c / 2; } else { d = 1; }
3629        if (d < 1e3) { totop_button("off"); } else { totop_button("on"); }
3630    });
3631}
3632
3633function backToTop(){
3634    "use strict";
3635
3636    $j(document).on('click','#back_to_top',function(e){
3637        e.preventDefault();
3638
3639        $j('body,html').animate({scrollTop: 0}, $j(window).scrollTop()/3, 'linear');
3640    });
3641}
3642
3643/*
3644 **	Init message height
3645 */
3646function initMessageHeight(){
3647    "use strict";
3648    if($j('.q_message.with_icon').length){
3649        $j('.q_message.with_icon').each(function(){
3650            if($j(this).find('.message_text_holder').height() > $j(this).find('.q_message_icon_holder').height()) {
3651                $j(this).find('.q_message_icon_holder').height($j(this).find('.message_text').height());
3652            } else {
3653                $j(this).find('.message_text').height($j(this).find('.q_message_icon_holder').height());
3654            }
3655        });
3656    }
3657}
3658
3659/**
3660 * Init image hover
3661 */
3662function initImageHover() {
3663    "use strict";
3664    if($j('.image_hover').length){
3665        $j('.image_hover').each(function(){
3666            $j(this).appear(function() {
3667
3668                var default_visible_time = 300;
3669                var transition_delay = $j(this).attr('data-transition-delay');
3670                var real_transition_delay = default_visible_time + parseFloat(transition_delay);
3671                var object = $j(this);
3672
3673                //wait for other hovers to complete
3674                setTimeout(function() {
3675                    object.addClass('show');
3676                }, parseFloat(transition_delay));
3677
3678                //hold that image a little, than remove class
3679                setTimeout(function() {
3680                    object.removeClass('show');
3681                }, real_transition_delay);
3682
3683            },{accX: 0, accY: -200});
3684        });
3685    }
3686}
3687
3688/*
3689 * Initializes vertical progress bars
3690 */
3691function initProgressBarsVertical(){
3692    "use strict";
3693
3694    if($j('.q_progress_bars_vertical').length){
3695        $j('.q_progress_bars_vertical').each(function() {
3696            $j(this).appear(function() {
3697                initToCounterVerticalProgressBar($j(this));
3698                var percentage = $j(this).find('.progress_content').data('percentage');
3699                $j(this).find('.progress_content').css('height', '0%');
3700                $j(this).find('.progress_content').animate({
3701                    height: percentage+'%'
3702                }, 1500);
3703            },{accX: 0, accY: -150});
3704        });
3705    }
3706}
3707
3708/*
3709 * Initializes vertical progress bar count to max value
3710 */
3711function initToCounterVerticalProgressBar($this){
3712    "use strict";
3713
3714    if($this.find('.progress_number span').length){
3715        $this.find('.progress_number span').each(function() {
3716            var $max = parseFloat($j(this).text());
3717            $j(this).countTo({
3718                from: 0,
3719                to: $max,
3720                speed: 1500,
3721                refreshInterval: 50
3722            });
3723        });
3724    }
3725}
3726
3727/*
3728 *	Check if there is anchor on load and scroll to it
3729 */
3730function checkAnchorOnLoad(){
3731    "use strict";
3732
3733    var hash = window.location.hash;
3734    var scrollToAmount;
3735    var top_header_height;
3736    var paspartuScrollAdd = $j('body').hasClass('paspartu_enabled') ? $window_width*paspartu_width : 0;
3737    if(hash !== "" && $j('[data-q_id="'+hash+'"]').length > 0){
3738        if($j('header.page_header').hasClass('fixed') && !$j('body').hasClass('vertical_menu_enabled')){
3739            if($j('header.page_header').hasClass('scroll_top')){
3740                top_header_height = 33;
3741            }else{
3742                top_header_height = 0;
3743            }
3744
3745            if(!$j('header.page_header').hasClass('transparent') || $j('header.page_header').hasClass('scrolled_not_transparent')) {
3746                if(header_height - ($j('[data-q_id="' + hash + '"]').offset().top + top_header_height)/4 >= min_header_height_scroll){
3747                    var diff_of_header_and_section = $j('[data-q_id="' + hash + '"]').offset().top -  header_height - paspartuScrollAdd;
3748                    scrollToAmount = diff_of_header_and_section + (diff_of_header_and_section/4) + (diff_of_header_and_section/16) + (diff_of_header_and_section/64) + 1;
3748 //several times od dividing to minimize the error, because fixed header is shrinking while scroll, 1 is just to ensure
3749                }else{
3750                    if($j('header.page_header').hasClass('centered_logo')){
3751                        scrollToAmount = $j('[data-q_id="' + hash + '"]').offset().top - min_header_height_scroll - logo_height - 20 - paspartuScrollAdd; //20 is top margin of logo
3752                    } else {
3753                        scrollToAmount = $j('[data-q_id="' + hash + '"]').offset().top - min_header_height_scroll - paspartuScrollAdd;
3754                    }
3755                }
3756            }else{
3757                scrollToAmount = $j('[data-q_id="' + hash + '"]').offset().top - paspartuScrollAdd;
3758            }
3759        } else if($j('header.page_header').hasClass('fixed_hiding') && !$j('body').hasClass('vertical_menu_enabled')){
3760            if(!$j('header.page_header').hasClass('transparent') || $j('header.page_header').hasClass('scrolled_not_transparent')) {
3761                if ($j('[data-q_id="' + hash + '"]').offset().top - (header_height + logo_height / 2 + 40) <= scroll_amount_for_fixed_hiding) {
3762                    scrollToAmount = $j('[data-q_id="' + hash + '"]').offset().top - header_height - logo_height / 2 - 40 - paspartuScrollAdd; //40 is top/bottom margin of logo
3763                } else {
3764                    scrollToAmount = $j('[data-q_id="' + hash + '"]').offset().top - min_header_height_fixed_hidden - 40 - paspartuScrollAdd; //40 is top/bottom margin of logo
3765                }
3766            }else{
3767                scrollToAmount = $j('[data-q_id="' + hash + '"]').offset().top - paspartuScrollAdd;
3768            }
3769        }else if($j('header.page_header').hasClass('stick') || $j('header.page_header').hasClass('stick_with_left_right_menu') && !$j('body').hasClass('vertical_menu_enabled')) {
3770            if(!$j('header.page_header').hasClass('transparent') || $j('header.page_header').hasClass('scrolled_not_transparent')) {
3771                if (sticky_amount >= $j('[data-q_id="' + hash + '"]').offset().top) {
3772                    scrollToAmount = $j('[data-q_id="' + hash + '"]').offset().top + 1 - paspartuScrollAdd; // 1 is to show sticky menu
3773                } else {
3774                    scrollToAmount = $j('[data-q_id="' + hash + '"]').offset().top - min_header_height_sticky - paspartuScrollAdd;
3775                }
3776            }else{
3777                scrollToAmount = $j('[data-q_id="' + hash + '"]').offset().top - paspartuScrollAdd;
3778            }
3779        } else{
3780            scrollToAmount = $j('[data-q_id="' + hash + '"]').offset().top - paspartuScrollAdd;
3781        }
3782        $j('html, body').animate({
3783            scrollTop: Math.round(scrollToAmount)
3784        }, 1500, function() {});
3785    }
3786
3787    //remove active state on anchors if section is not visible
3788    $j(".main_menu a, .vertical_menu a, .mobile_menu a").each(function(){
3789        var i = $j(this).prop("hash");
3790        if(i !== "" && ($j('[data-q_id="' + i + '"]').length > 0) && ($j('[data-q_id="' + i + '"]').offset().top >= $window_height) && $scroll === 0){
3791            $j(this).parent().removeClass('active');
3792            $j(this).removeClass('current');
3793        }
3794    });
3795}
3796
3797/*
3798 *	Check active state of anchor links on scroll
3799 */
3800function changeActiveState(id){
3801    "use strict";
3802
3803    if($j(".main_menu a[href*='#']").length) {
3804        $j('.main_menu a').parent().removeClass('active');
3805    }
3806
3807    $j(".main_menu a").each(function(){
3808        var i = $j(this).prop("hash");
3809        if(i === id){
3810            if($j(this).closest('.second').length === 0){
3811                $j(this).parent().addClass('active');
3812            }else{
3813                $j(this).closest('.second').parent().addClass('active');
3814            }
3815            $j('.main_menu a').removeClass('current');
3816            $j(this).addClass('current');
3817        }
3818    });
3819
3820    if($j(".vertical_menu a[href*='#']").length) {
3821        $j('.vertical_menu a').parent().removeClass('active');
3822    }
3823
3824    $j(".vertical_menu a").each(function(){
3825        var i = $j(this).prop("hash");
3826        if(i === id){
3827            if($j(this).closest('.second').length === 0){
3828                $j(this).parent().addClass('active');
3829            }else{
3830                $j(this).closest('.second').parent().addClass('active');
3831            }
3832            $j('.vertical_menu a').removeClass('current');
3833            $j(this).addClass('current');
3834        }
3835    });
3836
3837    if($j(".mobile_menu a[href*='#']").length) {
3838        $j('.mobile_menu a').parent().removeClass('active');
3839    }
3840
3841    $j(".mobile_menu a").each(function(){
3842        var i = $j(this).prop("hash");
3843        if(i === id){
3844            if($j(this).closest('.sub_menu').length === 0){
3845                $j(this).parent().addClass('active');
3846            }else{
3847                $j(this).closest('.sub_menu').parent().addClass('active');
3848            }
3849            $j('.mobile_menu a').removeClass('current');
3850            $j(this).addClass('current');
3851        }
3852    });
3853}
3854
3855/*
3856 *	Check active state of anchor links on scroll
3857 */
3858function checkAnchorOnScroll(){
3859    "use strict";
3860
3861    if($j('[data-q_id]').length && !$j('header.page_header').hasClass('regular')){
3862        $j('[data-q_id]').waypoint( function(direction) {
3863            if(direction === 'down') {
3864                changeActiveState($j(this).data("q_id"));
3865            }
3866        }, { offset: '50%' });
3867
3868        $j('[data-q_id]').waypoint( function(direction) {
3869            if(direction === 'up') {
3870                changeActiveState($j(this).data("q_id"));
3871            }
3872        }, { offset: function(){
3873            return -($j(this).outerHeight() - 150);
3874        } });
3875    }
3876}
3877
3878/*
3879 *	Init scroll to section link if that link has hash value
3880 */
3881function initHashClick(){
3882    "use strict";
3883
3884    var $doc = $j('html, body');
3885    var scrollToAmount;
3886    var paspartuScrollAdd = $j('body').hasClass('paspartu_enabled') ? $window_width*paspartu_width : 0;
3887
3888    $j(document).on( "click", ".main_menu a, .vertical_menu a, .qbutton:not(.contact_form_button), .anchor, .widget li.anchor a", function(){
3889        var $this = $j(this);
3890        var hash = $j(this).prop("hash");
3891        var top_header_height;
3892        if((hash !== "" && $j(this).attr('href').split('#')[0] === "") || (hash !== "" && $j(this).attr('href').split('#')[0] !== "" && hash === window.location.hash) || (hash !== "" && $j(this).attr('href').split('#')[0] === window.location.href.split('#')[0])){ //in third condition 'hash !== ""' stays to prevent reload of page when link is active and ajax enabled
3893            if($j('header.page_header').hasClass('fixed') && !$j('body').hasClass('vertical_menu_enabled')){
3894                if($j('header.page_header').hasClass('scroll_top')){
3895                    top_header_height = 33;
3896                }else{
3897                    top_header_height = 0;
3898                }
3899
3900                if(!$j('header.page_header').hasClass('transparent') || $j('header.page_header').hasClass('scrolled_not_transparent')) {
3901                    if (header_height - ($j('[data-q_id="' + hash + '"]').offset().top + top_header_height) / 4 >= min_header_height_scroll) {
3902                        var diff_of_header_and_section = $j('[data-q_id="' + hash + '"]').offset().top - header_height - paspartuScrollAdd;
3903                        scrollToAmount = diff_of_header_and_section + (diff_of_header_and_section / 4) + (diff_of_header_and_section / 16) + (diff_of_header_and_section / 64) + 1;
3903 //several times od dividing to minimize the error, because fixed header is shrinking while scroll, 1 is just to ensure
3904                    } else {
3905                        if($j('header.page_header').hasClass('centered_logo')){
3906                            scrollToAmount = $j('[data-q_id="' + hash + '"]').offset().top - min_header_height_scroll - logo_height - 20 - paspartuScrollAdd; //20 is top margin of logo
3907                        } else {
3908                            scrollToAmount = $j('[data-q_id="' + hash + '"]').offset().top - min_header_height_scroll - paspartuScrollAdd;
3909                        }
3910                    }
3911                }else{
3912                    scrollToAmount = $j('[data-q_id="' + hash + '"]').offset().top - paspartuScrollAdd;
3913                }
3914            } else if($j('header.page_header').hasClass('fixed_hiding') && !$j('body').hasClass('vertical_menu_enabled')){
3915                if(!$j('header.page_header').hasClass('transparent') || $j('header.page_header').hasClass('scrolled_not_transparent')) {
3916                    if ($j('[data-q_id="' + hash + '"]').offset().top - (header_height + logo_height / 2 + 40) <= scroll_amount_for_fixed_hiding) {
3917                        scrollToAmount = $j('[data-q_id="' + hash + '"]').offset().top - header_height - logo_height / 2 - 40 - paspartuScrollAdd; //20 is top/bottom margin of logo
3918                    } else {
3919                        scrollToAmount = $j('[data-q_id="' + hash + '"]').offset().top - min_header_height_fixed_hidden - 40 - paspartuScrollAdd; //20 is top/bottom margin of logo
3920                    }
3921                }else{
3922                    scrollToAmount = $j('[data-q_id="' + hash + '"]').offset().top - paspartuScrollAdd;
3923                }
3924            }else if($j('header.page_header').hasClass('stick') || $j('header.page_header').hasClass('stick_with_left_right_menu') && !$j('body').hasClass('vertical_menu_enabled')) {
3925                if(!$j('header.page_header').hasClass('transparent') || $j('header.page_header').hasClass('scrolled_not_transparent')) {
3926                    if (sticky_amount >= $j('[data-q_id="' + hash + '"]').offset().top) {
3927                        if($j('[data-q_id="' + hash + '"]').offset().top != 0) {
3928                            scrollToAmount = $j('[data-q_id="' + hash + '"]').offset().top + 1 - paspartuScrollAdd; // 1 is to show sticky menu
3929                        }
3930                        else {
3931                            scrollToAmount = $j('[data-q_id="' + hash + '"]').offset().top - paspartuScrollAdd; // if scrolled top to first section, don't add 1px as empty space remains bellow section if it is fullscreen slider
3932                        }
3933                    } else {
3934                        scrollToAmount = $j('[data-q_id="' + hash + '"]').offset().top - min_header_height_sticky - paspartuScrollAdd;
3935                    }
3936                }else{
3937                    scrollToAmount = $j('[data-q_id="' + hash + '"]').offset().top - paspartuScrollAdd;
3938                }
3939            } else{
3940                scrollToAmount = $j('[data-q_id="' + hash + '"]').offset().top - paspartuScrollAdd;
3941            }
3942
3943            if($j('[data-q_id="'+hash+'"]').length > 0){
3944                $doc.stop().animate({
3945                    scrollTop: Math.round(scrollToAmount)
3946                }, 1500, function() {
3947                    anchorActiveState($this);
3948                });
3949            }
3950
3951            if(history.pushState) {
3952                history.pushState(null, null, hash);
3953            }
3954            return false;
3955        }
3956    });
3957
3958    $j(document).on( "click", ".mobile_menu a", function(){
3959        var $this = $j(this);
3960        var hash = $j(this).prop("hash");
3961        if((hash !== "" && $j(this).attr('href').split('#')[0] === "") || (hash !== "" && $j(this).attr('href').split('#')[0] !== "" && hash === window.location.hash) || (hash !== "" && $j(this).attr('href').split('#')[0] === window.location.href.split('#')[0])){ //in third condition 'hash !== ""' stays to prevent reload of page when link is active and ajax enabled
3962
3963            if($j('[data-q_id="'+hash+'"]').length > 0){
3964                $doc.animate({
3965                    scrollTop: Math.round($j('[data-q_id="'+hash+'"]').offset().top - $j('.mobile_menu').height())
3966                }, 500,function(){
3967                    anchorActiveState($this);
3968                });
3969            }
3970            if(history.pushState) {
3971                history.pushState(null, null, hash);
3972            }
3973            return false;
3974        }
3975    });
3976}
3977
3978/*
3979 **	Calculate height for animated text icon shortcode
3980 */
3981function animatedTextIconHeight(){
3982    "use strict";
3983
3984    if($j('.animated_icons_with_text').length){
3985        var $icons = $j('.animated_icons_with_text');
3986        var maxHeight;
3987
3988        $icons.find('.animated_text p').each(function() {
3989            maxHeight = maxHeight > $j(this).height() ? maxHeight : $j(this).height();
3990        });
3991
3992        if(maxHeight < 155) {
3993            maxHeight = 155;
3994
3995        }
3996        $icons.find('.animated_icon_with_text_inner').height(maxHeight);
3997    }
3998}
3999
4000/*
4001 **	Add class to items in last row in animated text icon shortcode
4002 */
4003function countAnimatedTextIconPerRow(){
4004    "use strict";
4005
4006    if($j('.animated_icons_with_text').length){
4007        $j('.animated_icons_with_text').each(function() {
4008            var $icons = $j(this);
4009            var qode_icons_height = $icons.height();
4010            var qode_icons_width = $icons.width();
4011            var maxHeightIcons;
4012            var iconWidth = $icons.find('.animated_icon_with_text_holder').width() + 1; // 1px because safari round on smaller number
4013            var countIcons = $icons.find('.animated_icon_with_text_holder').length;
4014            $icons.find('.animated_icon_with_text_holder').each(function() {
4015                maxHeightIcons = maxHeightIcons > $j(this).height() ? maxHeightIcons : $j(this).height();
4016            });
4017            maxHeightIcons = maxHeightIcons + 30; //margin for client is 30
4018            var numberOfIconsPerRow =  Math.ceil((qode_icons_width/iconWidth));
4019            var numberOffullRows = Math.floor(countIcons / numberOfIconsPerRow);
4020            var numberOfIconsInLastRow = countIcons - (numberOfIconsPerRow * numberOffullRows);
4021            if(numberOfIconsInLastRow === 0){
4022                numberOfIconsInLastRow = numberOfIconsPerRow;
4023            }
4024            $icons.find( ".animated_icon_with_text_holder" ).removeClass('border-bottom-none');
4025            var item_start_from = countIcons - numberOfIconsInLastRow - 1;
4026            $icons.find( ".animated_icon_with_text_holder:gt("+ item_start_from +")" ).addClass('border-bottom-none');
4027        });
4028    }
4029}
4030
4031/*
4032 *	Set active state in maim menu on anchor click
4033 */
4034function anchorActiveState(me){
4035    if(me.closest('.main_menu').length > 0){
4036        $j('.main_menu a').parent().removeClass('active');
4037    }
4038
4039    if(me.closest('.vertical_menu').length > 0){
4040        $j('.vertical_menu a').parent().removeClass('active');
4041    }
4042
4043    if(me.closest('.second').length === 0){
4044        me.parent().addClass('active');
4045    }else{
4046        me.closest('.second').parent().addClass('active');
4047    }
4048    if(me.closest('.mobile_menu').length > 0){
4049        $j('.mobile_menu a').parent().removeClass('active');
4050        me.parent().addClass('active');
4051    }
4052
4053    $j('.mobile_menu a, .main_menu a, .vertical_menu a').removeClass('current');
4054    me.addClass('current');
4055}
4056
4057/*
4058 **	Video background initialization
4059 */
4060function initVideoBackground(){
4061    "use strict";
4062
4063    $j('.video-wrap .video').mediaelementplayer({
4064        enableKeyboard: false,
4065        iPadUseNativeControls: false,
4066        pauseOtherPlayers: false,
4067        // force iPhone's native controls
4068        iPhoneUseNativeControls: false,
4069        // force Android's native controls
4070        AndroidUseNativeControls: false
4071    });
4072
4073    //mobile check
4074    if(navigator.userAgent.match(/(Android|iPod|iPhone|iPad|IEMobile|Opera Mini)/)){
4075        initVideoBackgroundSize();
4076        $j('.mobile-video-image').show();
4077        $j('.video-wrap').remove();
4078    }
4079}
4080
4081/*
4082 **	Calculate video background size
4083 */
4084function initVideoBackgroundSize(){
4085    "use strict";
4086
4087    $j('.section .video-wrap').each(function(i){
4088
4089        var $sectionWidth = $j(this).closest('.section').outerWidth();
4090        $j(this).width($sectionWidth);
4091
4092        var $sectionHeight = $j(this).closest('.section').outerHeight();
4093        min_w = vid_ratio * ($sectionHeight+20);
4094        $j(this).height($sectionHeight);
4095
4096        var scale_h = $sectionWidth / video_width_original;
4097        var scale_v = ($sectionHeight - header_height) / video_height_original;
4098        var scale =  scale_v;
4099        if (scale_h > scale_v)
4100            scale =  scale_h;
4101        if (scale * video_width_original < min_w) {scale = min_w / video_width_original;}
4102
4103        $j(this).find('video, .mejs-overlay, .mejs-poster').width(Math.ceil(scale * video_width_original +2));
4104        $j(this).find('video, .mejs-overlay, .mejs-poster').height(Math.ceil(scale * video_height_original +2));
4105        $j(this).scrollLeft(($j(this).find('video').width() - $sectionWidth) / 2);
4106        $j(this).find('.mejs-overlay, .mejs-poster').scrollTop(($j(this).find('video').height() - ($sectionHeight)) / 2);
4107        $j(this).scrollTop(($j(this).find('video').height() - ($sectionHeight)) / 2);
4108    });
4109
4110    $j('.carousel .item .video .video-wrap').each(function(i){
4111
4112        var $slideWidth = $j(window).width();
4113        $j(this).width($slideWidth);
4114
4115        var mob_header = $j(window).width() < 1000 ? $j('header.page_header').height() - 6 : 0; // 6 is because of the display: inline-block
4116        var $slideHeight = $j(this).closest('.carousel.slide').height() - mob_header;
4117
4118        min_w = vid_ratio * ($slideHeight+20);
4119        $j(this).height($slideHeight);
4120
4121        var scale_h = $slideWidth / video_width_original;
4122        var scale_v = ($slideHeight - header_height) / video_height_original;
4123        var scale =  scale_v;
4124        if (scale_h > scale_v)
4125            scale =  scale_h;
4126        if (scale * video_width_original < min_w) {scale = min_w / video_width_original;}
4127
4128        $j(this).find('video, .mejs-overlay, .mejs-poster').width(Math.ceil(scale * video_width_original +2));
4129        $j(this).find('video, .mejs-overlay, .mejs-poster').height(Math.ceil(scale * video_height_original +2));
4130        $j(this).scrollLeft(($j(this).find('video').width() - $slideWidth) / 2);
4131        $j(this).find('.mejs-overlay, .mejs-poster').scrollTop(($j(this).find('video').height() - ($slideHeight)) / 2);
4132        $j(this).scrollTop(($j(this).find('video').height() - ($slideHeight)) / 2);
4133    });
4134
4135    $j('.portfolio_single .video .video-wrap, .blog_holder .video .video-wrap').each(function(i){
4136
4137        var $this = $j(this);
4138
4139        var $videoWidth = $j(this).closest('.video').outerWidth();
4140        $j(this).width($videoWidth);
4141        var $videoHeight = ($videoWidth*9)/16;
4142
4143        if(navigator.userAgent.match(/(Android|iPod|iPhone|iPad|IEMobile|Opera Mini)/)){
4144            $this.parent().width($videoWidth);
4145            $this.parent().height($videoHeight);
4146        }
4147
4148        min_w = vid_ratio * ($videoHeight+20);
4149        $j(this).height($videoHeight);
4150
4151        var scale_h = $videoWidth / video_width_original;
4152        var scale_v = ($videoHeight - header_height) / video_height_original;
4153        var scale =  scale_v;
4154        if (scale_h > scale_v)
4155            scale =  scale_h;
4156        if (scale * video_width_original < min_w) {scale = min_w / video_width_original;}
4157
4158        $j(this).find('video, .mejs-overlay, .mejs-poster').width(Math.ceil(scale * video_width_original +2));
4159        $j(this).find('video, .mejs-overlay, .mejs-poster').height(Math.ceil(scale * video_height_original +2));
4160        $j(this).scrollLeft(($j(this).find('video').width() - $videoWidth) / 2);
4161        $j(this).find('.mejs-overlay, .mejs-poster').scrollTop(($j(this).find('video').height() - ($videoHeight)) / 2);
4162        $j(this).scrollTop(($j(this).find('video').height() - ($videoHeight)) / 2);
4163    });
4164
4165}
4166
4167/*
4168 **	Icon With Text animation effect
4169 */
4170function initIconWithTextAnimation(){
4171    "use strict";
4172    if($j('.q_icon_animation').length > 0 && $j('.no_animation_on_touch').length === 0){
4173        $j('.q_icon_animation').each(function(){
4174            $j(this).appear(function() {
4175                $j(this).addClass('q_show_animation');
4176            },{accX: 0, accY: -100});
4177        });
4178    }
4179}
4180
4181/*
4182 **	Add class on body if browser is Safari
4183 */
4184function initCheckSafariBrowser(){
4185    "use strict";
4186
4187    if (navigator.userAgent.indexOf('Safari') !== -1 && navigator.userAgent.indexOf('Chrome') === -1) {
4188        $j('body').addClass('safari_browser');
4189    }
4190}
4191
4192/*
4193 **	Add class on body if browser is Firefox Mac
4194 */
4195function initCheckFirefoxMacBrowser(){
4196    "use strict";
4197
4198    var browser = navigator.userAgent.toLowerCase();
4199    var os = navigator.appVersion.toLowerCase();
4200
4201    if (browser.indexOf('firefox') > -1 && os.indexOf("mac") > -1) {
4202        $j('body').addClass('firefox_mac_browser');
4203    }
4204}
4205
4206
4207
4208
4209/*
4210 **	Initialize Qode search form
4211 */
4212function initSearchButton(){
4213
4214    if($j('.search_button.from_window_top').length){
4215        $j('.search_button.from_window_top').click(function(e){
4216            e.preventDefault();
4217
4218            if($j('html').hasClass('touch')){
4219                if ($j('.qode_search_form').height() == "0") {
4220                    $j('.qode_search_form input[type="text"]').onfocus = function () {
4221                        window.scrollTo(0, 0);
4222                        document.body.scrollTop = 0;
4223                    };
4224                    $j('.qode_search_form input[type="text"]').onclick = function () {
4225                        window.scrollTo(0, 0);
4226                        document.body.scrollTop = 0;
4227                    };
4228                    $j('.header_top_bottom_holder').css('top',search_header_height+"px");
4229                    $j('.qode_search_form').css('height',search_header_height+"px");
4230                    $j('.content_inner').css('margin-top',search_header_height+"px");
4231                    if($scroll < 34){ $j('header.page_header').css('top','0'); }
4232                } else {
4233                    $j('.qode_search_form').css('height','0');
4234                    $j('.header_top_bottom_holder').css('top','0');
4235                    $j('.content_inner').css('margin-top','0');
4236                    if($scroll < 34){ $j('header.page_header').css('top',-$scroll);}
4237                }
4238
4239                $j(window).scroll(function() {
4240                    if ($j('.qode_search_form').height() != "0" && $scroll > 50) {
4241                        $j('.qode_search_form').css('height','0');
4242                        $j('.header_top_bottom_holder').css('top','0');
4243                        $j('.content_inner').css('margin-top','0');
4244                    }
4245                });
4246
4247                $j('.qode_search_close').click(function(e){
4248                    e.preventDefault();
4249                    $j('.qode_search_form').css('height','0');
4250                    $j('.header_top_bottom_holder').css('top','0');
4251                    $j('.content_inner').css('margin-top','0');
4252                    if($scroll < 34){ $j('header.page_header').css('top',-$scroll);}
4253                });
4254
4255            } else {
4256                if($j('.title').hasClass('has_fixed_background')){
4257                    var yPos = parseInt($j('.title.has_fixed_background').css('backgroundPosition').split(" ")[1]);
4258                }else {
4259                    var yPos = 0;
4260                }
4261                if ($j('.qode_search_form').height() == "0") {
4262                    $j('.qode_search_form input[type="text"]').focus();
4263                    $j('.header_top_bottom_holder').stop().animate({top:search_header_height+"px"},150);
4264                    $j('.qode_search_form').stop().animate({height:search_header_height+"px"},150);
4265                    $j('.content_inner').stop().animate({marginTop:search_header_height+"px"},150);
4266                    if($scroll < 34){ $j('header.page_header').stop().animate({top:0},150); }
4267                    $j('.title.has_fixed_background').animate({
4268                        'background-position-y': (yPos + 50)+'px'
4269                    }, 150);
4270                } else {
4271                    $j('.qode_search_form').stop().animate({height:"0"},150);
4272                    $j('.header_top_bottom_holder').stop().animate({top:"0px"},150);
4273                    $j('.content_inner').stop().animate({marginTop:"0"},150);
4274                    if($scroll < 34){ $j('header.page_header').stop().animate({top:-$scroll},150);}
4275                    $j('.title.has_fixed_background').animate({
4276                        'background-position-y': (yPos - 50)+'px'
4277                    }, 150);
4278                }
4279
4280                $j(window).scroll(function() {
4281                    if ($j('.qode_search_form').height() != "0" && $scroll > 50) {
4282                        $j('.qode_search_form').stop().animate({height:"0"},150);
4283                        $j('.header_top_bottom_holder').stop().animate({top:"0px"},150);
4284                        $j('.content_inner').stop().animate({marginTop:"0"},150);
4285                        $j('.title.has_fixed_background').css('backgroundPosition', 'center '+(yPos)+'px');
4286                    }
4287                });
4288
4289                $j('.qode_search_close').click(function(e){
4290                    e.preventDefault();
4291                    $j('.qode_search_form').stop().animate({height:"0"},150);
4292                    $j('.content_inner').stop().animate({marginTop:"0"},150);
4293                    $j('.header_top_bottom_holder').stop().animate({top:"0px"},150);
4294                    if($scroll < 34){ $j('header.page_header').stop().animate({top:-$scroll},150);}
4295                    $j('.title.has_fixed_background').animate({
4296                        'background-position-y': (yPos)+'px'
4297                    }, 150);
4298                });
4299            }
4300        });
4301    }
4302
4303    //search type - fullscreen search
4304    if($j(".fullscreen_search").length){
4305        $j('.fullscreen_search').on('click',function(e){
4306            e.preventDefault();
4307            if($j('.fullscreen_search_holder').hasClass('animate')) {
4308                $j('body').removeClass('fullscreen_search_opened');
4309                $j('.fullscreen_search_holder').removeClass('animate');
4310                $j('body').removeClass('search_fade_out');
4311                $j('body').removeClass('search_fade_in');
4312                if(!$j('body').hasClass('page-template-full_screen-php')){
4313                    qodeEnableScroll();
4314                }
4315            } else {
4316                $j('body').addClass('fullscreen_search_opened');
4317                $j('body').removeClass('search_fade_out');
4318                $j('body').addClass('search_fade_in');
4319                $j('.fullscreen_search_holder').addClass('animate');
4320                if(!$j('body').hasClass('page-template-full_screen-php')){
4321                    qodeDisableScroll();
4322                }
4323            }
4324        });
4325        $j('.fullscreen_search_close').on('click',function(e){
4326            e.preventDefault();
4327            $j('body').removeClass('fullscreen_search_opened');
4328            $j('.fullscreen_search_holder').removeClass('animate');
4329            $j('body').removeClass('search_fade_in');
4330            $j('body').addClass('search_fade_out');
4331            if(!$j('body').hasClass('page-template-full_screen-php')){
4332                qodeEnableScroll();
4333            }
4334        });
4335    }
4336
4337}
4338
4339/*
4340 **	Init update Shopping Cart
4341 */
4342function updateShoppingCart(){
4343    "use strict";
4344
4345    $j('body').bind('added_to_cart', add_to_cart);
4346    $j('body').bind('removed_from_cart', add_to_cart);
4347    function add_to_cart(event, parts, hash) {
4348        var miniCart = $j('.shopping_cart_header');
4349        if ( parts['div.widget_shopping_cart_content'] ) {
4350            var $cartContent = jQuery(parts['div.widget_shopping_cart_content']),
4351                $itemsList = $cartContent .find('.cart_list'),
4352                $total = $cartContent.find('.total').contents(':not(strong)').text();
4353            miniCart.find('.shopping_cart_dropdown_inner').html('').append($itemsList);
4354            miniCart.find('.total span').html('').append($total);
4355        }
4356    }
4357}
4358
4359/*
4360 **	Set content bottom margin because of the uncovering footer
4361 */
4362function setContentBottomMargin(){
4363    if($j('.uncover').length){
4364        $j('.content').css('margin-bottom', $j('footer').height());
4365    }
4366}
4367
4368/*
4369 **	Set footer uncover with vertical area
4370 */
4371function footerWidth(){
4372    "use strict";
4373
4374    if($j('.uncover').length && $j('body').hasClass('vertical_menu_enabled') && $window_width > 1000){
4375        $j('.uncover').width($window_width -  $j('.vertical_menu_area').width());
4376    } else{
4377        $j('.uncover').css('width','100%');
4378    }
4379}
4380
4381/*
4382 **	Init footer height for left border line
4383 */
4384function setFooterHeight(){
4385    "use strict";
4386
4387    if($window_width > 600){
4388        $j('.footer_top > div').innerHeight();
4389        $j(".footer_top .qode_column").css('min-height', 0).css('min-height', $j('.footer_top > div').innerHeight());
4390    }
4391}
4392
4393/*
4394 **	Boxes which reveal text on hover
4395 */
4396function initCoverBoxes(){
4397    if($j('.cover_boxes').length) {
4398        $j('.cover_boxes').each(function(){
4399            var active_element = 0;
4400            var data_active_element = 1;
4401            if(typeof $j(this).data('active-element') !== 'undefined' && $j(this).data('active-element') !== false) {
4402                data_active_element = parseFloat($j(this).data('active-element'));
4403                active_element = data_active_element - 1;
4404            }
4405
4406            var number_of_columns = 3;
4407
4408            //validate active element
4409            active_element = data_active_element > number_of_columns ? 0 : active_element;
4410
4411            $j(this).find('li').eq(active_element).addClass('act');
4412            var cover_boxed = $j(this);
4413            $j(this).find('li').each(function(){
4414                $j(this).hover(function() {
4415                    $j(cover_boxed).find('li').removeClass('act');
4416                    $j(this).addClass('act');
4417                });
4418
4419            });
4420        });
4421    }
4422}
4423
4424/*
4425 **	Create content menu from selected rows
4426 */
4427function createContentMenu(){
4428    "use strict";
4429
4430    var content_menu = $j(".content_menu");
4431    content_menu.each(function(){
4432        if($j(this).find('ul').length === 0){
4433
4434            if($j(this).css('background-color') !== ""){
4435                var background_color = $j(this).css('background-color');
4436            }
4437
4438            var content_menu_ul = $j("<ul class='menu'></ul>");
4439            content_menu_ul.appendTo($j(this));
4440
4441            var sections = $j(this).siblings('.in_content_menu');
4442
4443            if(sections.length){
4444                sections.each(function(){
4445                    var section_href = $j(this).data("q_id");
4446                    var section_title = $j(this).data('q_title');
4447                    var section_icon = $j(this).data('q_icon');
4448
4449                    var li = $j("<li />");
4450                    var icon = $j("<i />", {"class": section_icon});
4451                    var link = $j("<a />", {"href": section_href, "html": "<span>" + section_title + "</span>"});
4452                    var arrow;
4453                    if(background_color !== ""){
4454                        arrow = $j("<div />", {"class": 'arrow', "style": 'border-color: '+background_color+' transparent transparent transparent'});
4455                    } else {
4456                        arrow = $j("<div />", {"class": 'arrow'});
4457                    }
4458                    icon.prependTo(link);
4459                    link.appendTo(li);
4460                    arrow.appendTo(li);
4461                    li.appendTo(content_menu_ul);
4462
4463                });
4464            }
4465        }
4466    });
4467}
4468
4469/*
4470 **	Create content menu (select menu for responsiveness)from selected rows
4471 */
4472function createSelectContentMenu(){
4473    "use strict";
4474
4475    var content_menu = $j(".content_menu");
4476    content_menu.each(function(){
4477
4478        var $this = $j(this);
4479
4480        var $menu_select = $j("<ul></ul>");
4481        $menu_select.appendTo($j(this).find('.nav_select_menu'));
4482
4483
4484        $j(this).find("ul.menu li a").each(function(){
4485
4486            var menu_url = $j(this).attr("href");
4487            var menu_text = $j(this).text();
4488            var menu_icon = $j(this).find('i').clone();
4489
4490            if ($j(this).parents("li").length === 2) { menu_text = "&nbsp;&nbsp;&nbsp;" + menu_text; }
4491            if ($j(this).parents("li").length === 3) { menu_text = "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;" + menu_text; }
4492            if ($j(this).parents("li").length > 3) { menu_text = "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;" + menu_text; }
4493
4494            var li = $j("<li />");
4495            var link = $j("<a />", {"href": menu_url, "html": menu_text});
4496            menu_icon.prependTo(link);
4497            link.appendTo(li);
4498            li.appendTo($menu_select);
4499        });
4500
4501
4502        $this.find(".nav_select_button").on('click', function() {
4503            if ($this.find('.nav_select_menu ul').is(":visible")){
4504                $this.find('.nav_select_menu ul').slideUp();
4505            } else {
4506                $this.find('.nav_select_menu ul').slideDown();
4507            }
4508            return false;
4509        });
4510
4511        $this.find(".nav_select_menu ul li a").on('click',function () {
4512            $this.find('.nav_select_menu ul').slideUp();
4513            var $link = $j(this);
4514
4515            var $target = $link.attr("href");
4516            var targetOffset = $j("div.wpb_row[data-q_id='" + $target + "'],section.parallax_section_holder[data-q_id='" + $target + "']").offset().top;
4517
4518            $j('html,body').stop().animate({scrollTop: targetOffset }, 500, 'swing', function(){
4519                $j('nav.content_menu ul li').removeClass('active');
4520                $link.parent().addClass('active');
4521            });
4522
4523            return false;
4524        });
4525    });
4526}
4527
4528/*
4529 **	Calculate content menu position and fix it when needed
4530 */
4531function contentMenuPosition(){
4532    "use strict";
4533
4534    if($j('nav.content_menu').length){
4535
4536        if(content_menu_position > sticky_amount){
4537            var x = min_header_height_sticky;
4538        }else{
4539            var x = 0;
4540        }
4541
4542        if(content_menu_position - x - content_menu_top_add - $scroll <= 0 && ($j('header').hasClass('stick') || $j('header').hasClass('stick_with_left_right_menu'))){
4543
4544            if(content_menu_position < sticky_amount){
4545                if($scroll > sticky_amount){
4546                    $j('nav.content_menu').css({'position': 'fixed', 'top': min_header_height_sticky + content_menu_top_add}).addClass('fixed');
4547
4548                }else{
4549                    $j('nav.content_menu').css({'position': 'fixed', 'top': 0, transition:'none'}).addClass('fixed');
4550                }
4551            }else{
4552                $j('nav.content_menu').css({'position': 'fixed', 'top': min_header_height_sticky + content_menu_top_add}).addClass('fixed');
4553            }
4554            $j('header.sticky').addClass('no_shadow');
4555            $j('.content > .content_inner > .container > .container_inner').css('margin-top',content_line_height);
4556            $j('.content > .content_inner > .full_width').css('margin-top',content_line_height);
4557
4558        } else if(content_menu_position - content_menu_top - content_menu_top_add - $scroll <= 0 && !($j('header').hasClass('stick'))) {
4559            $j('nav.content_menu').css({'position': 'fixed', 'top': content_menu_top + content_menu_top_add}).addClass('fixed');
4560            $j('.content > .content_inner > .container > .container_inner').css('margin-top',content_line_height);
4561            $j('.content > .content_inner > .full_width').css('margin-top',content_line_height);
4562        } else {
4563            $j('nav.content_menu').css({'position': 'relative', 'top': '0px'}).removeClass('fixed');
4564            $j('header.sticky').removeClass('no_shadow');
4565            $j('.content > .content_inner > .container > .container_inner').css('margin-top','0px');
4566            $j('.content > .content_inner > .full_width').css('margin-top','0px');
4567        }
4568
4569        $j('.content .in_content_menu').waypoint( function(direction) {
4570            var $active = $j(this);
4571            var id = $active.data("q_id");
4572
4573            $j("nav.content_menu.fixed li a").each(function(){
4574                var i = $j(this).attr("href");
4575                if(i === id){
4576                    $j(this).parent().addClass('active');
4577                }else{
4578                    $j(this).parent().removeClass('active');
4579                }
4580            });
4581        }, { offset: '150' });
4582    }
4583}
4584
4585/*
4586 **	Check first and last content menu included rows for active state in content menu
4587 */
4588function contentMenuCheckLastSection(){
4589    "use strict";
4590
4591    if($j('nav.content_menu').length){
4592
4593        if($j('.content .in_content_menu').length){
4594            var last_from_top = $j('.content .in_content_menu:last').offset().top + $j('.content .in_content_menu:last').height();
4595            var first_from_top = $j('.content .in_content_menu:first').offset().top - content_menu_top - content_menu_top_add - 72; //72 is height of content menu
4596            if(last_from_top < $scroll){
4597                $j("nav.content_menu.fixed li").removeClass('active');
4598            }
4599            if(first_from_top > $scroll){
4600                $j('nav.content_menu li:first, nav.content_menu ul.menu li:first').removeClass('active');
4601
4602            }
4603        }
4604    }
4605}
4606
4607/*
4608 **	Scroll to section when item in content menu is clicked
4609 */
4610function contentMenuScrollTo(){
4611    "use strict";
4612
4613    if($j('nav.content_menu').length){
4614
4615        $j("nav.content_menu ul.menu li a").on('click', function(e){
4616            e.preventDefault();
4617            var $this = $j(this);
4618
4619            if($j(this).parent().hasClass('active')){
4620                return false;
4621            }
4622
4623            var $target = $this.attr("href");
4624            var targetOffset = $j("div.wpb_row[data-q_id='" + $target + "'],section.parallax_section_holder[data-q_id='" + $target + "']").offset().top - content_line_height - content_menu_top - content_menu_top_add;
4625
4626            $j('html,body').stop().animate({scrollTop: targetOffset }, 500, 'swing', function(){
4627                $j('nav.content_menu ul li').removeClass('active');
4628                $this.parent().addClass('active');
4629            });
4630
4631            return false;
4632        });
4633    }
4634}
4635
4636function initButtonHover() {
4637    "use strict";
4638
4639    if($j('.qbutton').length) {
4640        $j('.qbutton').each(function() {
4641
4642            //hover background color
4643            if(typeof $j(this).data('hover-background-color') !== 'undefined' && $j(this).data('hover-background-color') !== false) {
4644                var hover_background_color = $j(this).data('hover-background-color');
4645                var initial_background_color = $j(this).css('background-color');
4646                $j(this).hover(
4647                    function() {
4648                        $j(this).css('background-color', hover_background_color);
4649                    },
4650                    function() {
4651                        $j(this).css('background-color', initial_background_color);
4652                    });
4653            }
4654
4655            //hover border color
4656            if(typeof $j(this).data('hover-border-color') !== 'undefined' && $j(this).data('hover-border-color') !== false && !$j(this).hasClass('underlined')) {
4657                var hover_border_color = $j(this).data('hover-border-color');
4658                var initial_border_color = $j(this).css('border-top-color');
4659                $j(this).hover(
4660                    function() {
4661                        $j(this).css('border-color', hover_border_color);
4662                    },
4663                    function() {
4664                        $j(this).css('border-color', initial_border_color);
4665                    });
4666            }
4667
4668            //hover color
4669            if(typeof $j(this).data('hover-color') !== 'undefined' && $j(this).data('hover-color') !== false) {
4670                var hover_color = $j(this).data('hover-color');
4671                var initial_color = $j(this).css('color');
4672                $j(this).hover(
4673                    function() {
4674                        $j(this).css('color', hover_color);
4675                    },
4676                    function() {
4677                        $j(this).css('color', initial_color);
4678                    });
4679            }
4680        });
4681    }
4682}
4683
4684function initSocialIconHover() {
4685    "use strict";
4686
4687    if($j('.q_social_icon_holder').length) {
4688        $j('.q_social_icon_holder').each(function() {
4689
4690            var hover_style   = '';
4691            var initial_style = '';
4692
4693            //hover background color
4694            if(typeof $j(this).data('hover-background-color') !== 'undefined' && $j(this).data('hover-background-color') !== false && $j(this).find('.simple_social').length === 0) {
4695                var hover_background_color = $j(this).data('hover-background-color');
4696                hover_style += 'background-color: '+ hover_background_color + '!important;';
4697            }
4698
4699            if($j(this).find('.simple_social').length === 0){
4700                var initial_background_color = $j(this).find('.fa-stack').css('background-color');
4701                initial_style += 'background-color: '+ initial_background_color + '!important;';
4702            }
4703
4704            //hover border color
4705            if(typeof $j(this).data('hover-border-color') !== 'undefined' && $j(this).data('hover-border-color') !== false && $j(this).find('.simple_social').length === 0) {
4706                var hover_border_color = $j(this).data('hover-border-color');
4707                hover_style += 'border-color: '+ hover_border_color + '!important;';
4708            }
4709
4710            if($j(this).find('.simple_social').length === 0){
4711                var initial_border_color = $j(this).find('.fa-stack').css('border-color');
4712                initial_style += 'border-color: '+ initial_border_color + '!important;';
4713            }
4714
4715            //hover color
4716            if(typeof $j(this).data('hover-color') !== 'undefined' && $j(this).data('hover-color') !== false) {
4717                var hover_color = $j(this).data('hover-color');
4718                hover_style += 'color: '+ hover_color + '!important;';
4719            }
4720
4721            var initial_color = $j(this).css('color');
4722
4723            if($j(this).find('.fa-stack .social_icon').length) {
4724                initial_color = $j(this).find('.fa-stack').css('color');
4725            } else if($j(this).find('.simple_social').length) {
4726                initial_color = $j(this).find('.simple_social').css('color');
4727            }
4728
4729            initial_style += 'color: '+ initial_color + '!important;';
4730
4731            if(hover_style !== ""){
4732                if($j(this).find('.fa-stack .social_icon').length) {
4733                    $j(this).find('.fa-stack').hover(
4734                        function() {
4735                            $j(this).attr('style', function() { return hover_style; });
4736                        },
4737                        function() {
4738                            $j(this).attr('style', function() { return initial_style; });
4739                        });
4740                } else if($j(this).find('.simple_social').length) {
4741                    $j(this).find('.simple_social').hover(
4742                        function() {
4743                            $j(this).attr('style', function() { return hover_style; });
4744                        },
4745                        function() {
4746                            $j(this).attr('style', function() { return initial_style; });
4747                        });
4748                }
4749            }
4750        });
4751    }
4752}
4753
4754function initIconHover() {
4755    "use strict";
4756
4757    if($j('.q_icon_shortcode').length) {
4758        $j('.q_icon_shortcode').each(function() {
4759
4760            var hover_background_style, hover_border_style, hover_color_style = '';
4761            var initial_background_style, initial_border_style, initial_color_style = '';
4762            var hover_link_style = '';
4763            var initial_link_style = '';
4764
4765            //hover background color
4766            if(typeof $j(this).data('hover-background-color') !== 'undefined' && $j(this).data('hover-background-color') !== false && $j(this).hasClass('normal') === false) {
4767                hover_background_style = $j(this).data('hover-background-color');
4768            }
4769
4770            if(!$j(this).hasClass('normal')){
4771                initial_background_style = $j(this).css('background-color');
4772            }
4773
4774            //hover border color
4775            if(typeof $j(this).data('hover-border-color') !== 'undefined' && $j(this).data('hover-border-color') !== false && $j(this).hasClass('normal') === false) {
4776                hover_border_style = $j(this).data('hover-border-color');
4777            }
4778
4779            if($j(this).hasClass('normal') === false){
4780                initial_border_style = $j(this).css('border-color');
4781            }
4782
4783            //hover color
4784            if(typeof $j(this).data('hover-color') !== 'undefined' && $j(this).data('hover-color') !== false) {
4785                hover_color_style = $j(this).data('hover-color');
4786                hover_link_style += 'color: '+ hover_color_style + ';';
4787            }
4788
4789            initial_color_style = $j(this).css('color');
4790            initial_link_style += 'color: '+ initial_color_style + ';';
4791
4792
4793            if(hover_background_style !== "" || hover_border_style !== "" || hover_color_style !== "") {
4794                $j(this).hover(
4795                    function () {
4796                        if(hover_background_style !== "")
4797                            $j(this).css("background-color", hover_background_style);
4798                        if(hover_border_style !== "")
4799                            $j(this).css("border-color", hover_border_style);
4800                        if(hover_color_style !== "")
4801                            $j(this).css("color", hover_color_style);
4802                        $j(this).find('a').attr('style', function () {
4803                            return hover_link_style;
4804                        });
4805                    },
4806                    function () {
4807                        if(hover_background_style !== "")
4808                            $j(this).css("background-color", initial_background_style);
4809                        if(hover_border_style !== "")
4810                            $j(this).css("border-color", initial_border_style);
4811                        if(hover_color_style !== "")
4812                            $j(this).css("color", initial_color_style);
4813                        $j(this).find('a').attr('style', function () {
4814                            return initial_link_style;
4815                        });
4816                    }
4817                );
4818            }
4819        });
4820    }
4821}
4822
4823/*
4824 **	Popup menu initialization
4825 */
4826function initPopupMenu(){
4827    "use strict";
4828
4829    if($j('a.popup_menu').length){
4830        //var body_top;
4831
4832        //set height of popup holder and initialize nicescroll
4833        $j(".popup_menu_holder_outer").height($window_height).niceScroll({
4834            scrollspeed: 30,
4835            mousescrollstep: 20,
4836            cursorwidth: 0,
4837            cursorborder: 0,
4838            cursorborderradius: 0,
4839            cursorcolor: "transparent",
4840            autohidemode: false,
4841            horizrailenabled: false
4842        }); //200 is top and bottom padding of holder
4843
4844        //set height of popup holder on resize
4845        $j(window).resize(function() {
4846            $j(".popup_menu_holder_outer").height($window_height);
4847        });
4848
4849        // Open popup menu
4850        $j('a.popup_menu').on('click',function(e){
4851            e.preventDefault();
4852
4853            if(!$j(this).hasClass('opened')){
4854                $j(this).addClass('opened');
4855                $j('body').addClass('popup_menu_opened');
4856                if(!$j('body').hasClass('page-template-full_screen-php')){
4857                    qodeDisableScroll();
4858                }
4859            }else{
4860                $j(this).removeClass('opened');
4861                $j('body').removeClass('popup_menu_opened');
4862
4863                if(!$j('body').hasClass('page-template-full_screen-php')){
4864                    qodeEnableScroll();
4865                }
4866
4867                setTimeout(function(){
4868                    $j("nav.popup_menu ul.sub_menu").slideUp(200, function(){
4869                        $j('nav.popup_menu').getNiceScroll().resize();
4870                    });
4871                },400);
4872
4873            }
4874        });
4875
4876        //logic for open sub menus in popup menu
4877        $j(".popup_menu > ul > li.has_sub > a, .popup_menu > ul > li.has_sub > h6").on('tap click', function (e) {
4878            e.preventDefault();
4879
4880            if ($j(this).closest('li.has_sub').find("> ul.sub_menu").is(":visible")){
4881                $j(this).closest('li.has_sub').find("> ul.sub_menu").slideUp(200, function(){
4882                    $j('.popup_menu_holder_outer').getNiceScroll().resize();
4883                });
4884                $j(this).closest('li.has_sub').removeClass('open_sub');
4885            } else {
4886                $j(this).closest('li.has_sub').addClass('open_sub');
4887                $j(this).closest('li.has_sub').find("> ul.sub_menu").slideDown(200, function(){
4888                    $j('.popup_menu_holder_outer').getNiceScroll().resize();
4889                });
4890            }
4891
4892            return false;
4893        });
4894
4895	    $j(".popup_menu > ul > li.has_sub > ul.sub_menu > li.has_sub > a, .popup_menu > ul > li.has_sub > ul.sub_menu > li.has_sub > h6").click(function () {
4896           if ($j(this).parent().find("ul.sub_menu").is(":visible")){
4897               $j(this).parent().find("ul.sub_menu").slideUp(200);
4898               $j(this).parent().removeClass('open_sub');
4899           } else {
4900               $j(this).parent().addClass('open_sub');
4901               $j(this).parent().find("ul.sub_menu").slideDown(200);
4902           }
4903       });
4904
4905        //if link has no submenu and if it's not dead, than open that link
4906        $j(".popup_menu ul li:not(.has_sub) a").click(function () {
4907            if(($j(this).attr('href') !== "http://#") && ($j(this).attr('href') !== "#")){
4908                $j('a.popup_menu').removeClass('opened');
4909                $j('body').removeClass('popup_menu_opened').css('overflow','visible');
4910                $j("nav.popup_menu ul.sub_menu").slideUp(200, function(){
4911                    $j('nav.popup_menu').getNiceScroll().resize();
4912                });
4913                qodeEnableScroll();
4914            }else{
4915                return false;
4916            }
4917        });
4918    }
4919}
4920
4921/*
4922 **	Image Gallery Slider with no space initialization
4923 */
4924function initImageGallerySliderNoSpace(){
4925    "use strict";
4926
4927    if($j('.qode_image_gallery_no_space').length){
4928        $j('.qode_image_gallery_no_space').each(function(){
4929            $j(this).animate({'opacity': 1},1000);
4930            $j(this).find('.qode_image_gallery_holder').lemmonSlider({infinite: true});
4931        });
4932
4933        //disable click on non active image
4934
4935
4936        if (!$j(".qode_image_gallery_no_space").hasClass("link_all")) {
4937            $j('.qode_image_gallery_no_space').on('click', 'li:not(.active) a', function () {
4938                if (window.innerWidth > 800) {
4939                    return false;
4940                }
4941                else {
4942                    return true;
4943                }
4944            });
4945        }
4946    }
4947}
4948
4949function initFullScreenTemplate(){
4950    "use strict";
4951
4952    if($j('.full_screen_section_slide').length){
4953        $j('.full_screen_section_slide').closest('.full_screen_section').addClass('full_screen_section_slides');
4954    }
4955
4956    if($j('.full_screen_holder').length && $window_width > 600){
4957
4958        $j('.full_screen_preloader').css('height', ($window_height));
4959
4960        $j('#up_fs_button').on('click', function() {
4961            $j.fn.fullpage.moveSectionUp();
4962            return false;
4963        });
4964
4965        $j('#down_fs_button').on('click', function() {
4966            $j.fn.fullpage.moveSectionDown();
4967            return false;
4968        });
4969
4970        var $header_height = 0;
4971        if($j('header.page_header').length){
4972            if($window_width > 1400){
4973                $header_height = $j('header.page_header').height() + 45; //45 is default distance
4974            } else {
4975                $header_height = $j('header.page_header').height() + 10; //10 is distance for responsive
4976            }
4977        }
4978
4979        $j('.full_screen_navigation_holder.up_arrow').css('top',$header_height);
4980
4981        var section_number = $j('.full_screen_inner > .full_screen_section').length;
4982        $j('.full_screen_inner').fullpage({
4983            sectionSelector: '.full_screen_section',
4984            slideSelector: '.full_screen_section_slide',
4985            scrollOverflow: true,
4986            afterLoad: function(anchorLink, index){
4987                checkActiveArrowsOnFullScrrenTemplate(section_number, index);
4988            },
4989            afterRender: function(){
4990                checkActiveArrowsOnFullScrrenTemplate(section_number, 1);
4991                $j('.full_screen_holder').find('.full_screen_navigation_holder').css('visibility','visible');
4992                $j('.full_screen_holder').find('.full_screen_inner').css('visibility','visible');
4993                $j('.full_screen_preloader').hide();
4994                if($j('.full_screen_holder video.full_screen_sections_video').length){
4995                    $j('.full_screen_holder video.full_screen_sections_video').each(function(){
4996                        $j(this).get(0).play();
4997                    });
4998                }
4999            }
5000        });
5001    }
5002}
5003
5004function checkActiveArrowsOnFullScrrenTemplate(section_number, index){
5005    "use strict";
5006
5007    if(index == '1'){
5008        $j('.full_screen_navigation_holder.up_arrow').hide();
5009        $j('.full_screen_navigation_holder.down_arrow').hide();
5010        if(index != section_number){
5011            $j('.full_screen_navigation_holder.down_arrow').show();
5012        }
5013    }else if(index == section_number){
5014        $j('.full_screen_navigation_holder.down_arrow').hide();
5015        if(section_number == '2'){
5016            $j('.full_screen_navigation_holder.up_arrow').show();
5017        }
5018    }else{
5019        $j('.full_screen_navigation_holder.up_arrow').show();
5020        $j('.full_screen_navigation_holder.down_arrow').show();
5021    }
5022}
5023
5024function alterWPMLSwitcherHeaderBottom() {
5025    "use strict";
5026
5027    if($j('.header_bottom li.menu-item-language').length) {
5028        var langDropdown = $j('.header_bottom .menu-item-language').find('.submenu-languages');
5029
5030        if(typeof langDropdown !== 'undefined') {
5031            langDropdown.parent('li').addClass('narrow');
5032            langDropdown.wrap('<div class="second"><div class="inner"></div></div>');
5033            langDropdown.show();
5034        }
5035
5036
5037    }
5038}
5039
5040/*
5041 **	Init testimonials shortcode
5042 */
5043function initTwitterShortcode(){
5044    "use strict";
5045
5046    if($j('.qode_twitter_shortcode').length){
5047        $j('.qode_twitter_shortcode').each(function(){
5048            $j(this).appear(function() {
5049                $j(this).css('visibility','visible');
5050            },{accX: 0, accY: -100});
5051
5052            var interval = 5000;
5053            if(typeof $j(this).data('auto-rotate-slides') !== 'undefined' && $j(this).data('auto-rotate-slides') !== false) {
5054                interval = parseFloat($j(this).data('auto-rotate-slides')) * 1000;
5055            }
5056
5057            var slideshow = true;
5058            if(interval === 0) {
5059                slideshow = false;
5060            }
5061
5062            var animation = 'fade';
5063            if(typeof $j(this).data('animation-type') !== 'undefined' && $j(this).data('animation-type') !== false) {
5064                animation = $j(this).data('animation-type');
5065            }
5066
5067            var controlNav = true;
5068            if(typeof $j(this).data('show-navigation') !== 'undefined') {
5069                controlNav = $j(this).data('show-navigation') == 'no' ? false : true;
5070            }
5071
5072            var directionNav = true;
5073            if(typeof $j(this).data('show-arrows') !== 'undefined') {
5074                directionNav = $j(this).data('show-arrows') == 'no' ? false : true;
5075            }
5076
5077            var animationSpeed = 600;
5078            if(typeof $j(this).data('animation-speed') !== 'undefined' && $j(this).data('animation-speed') !== false) {
5079                animationSpeed = $j(this).data('animation-speed');
5080            }
5081
5082            $j(this).flexslider({
5083                animationLoop: true,
5084                controlNav: controlNav,
5085                directionNav: directionNav,
5086                prevText: "<span class='arrow_carrot-left'></span>",
5087                nextText: "<span class='arrow_carrot-right'></span>",
5088                useCSS: false,
5089                pauseOnAction: true,
5090                pauseOnHover: false,
5091                slideshow: slideshow,
5092                animation: animation,
5093                itemMargin: 25,
5094                minItems: 1,
5095                maxItems: 1,
5096                animationSpeed: animationSpeed,
5097                slideshowSpeed: interval,
5098                start: function(slider){
5099                    initParallax();
5100                }
5101            });
5102        });
5103
5104    }
5105}
5106
5107/*
5108 ** Sticky info on portfolio single
5109 */
5110var headerOffset = 0;
5111function stickyInfoPortfolio($scroll, stickyInfoTopOffset, stickyInfoHeight){
5112    "use strict";
5113
5114    if($j('.portfolio_single_sticky').length){
5115
5116        if($j('.portfolio_single.fixed-left').length){
5117            var info_width = $j('.portfolio_single_sticky').parent().innerWidth();
5118        }
5119
5120        if($j('header.page_header').hasClass('regular') || $j(window).width() <= 1000){
5121            headerOffset =0;
5122        }else if($j('header.page_header').hasClass('fixed_top_header')){
5123            headerOffset = $j('header.page_header .top_header').height();
5124        }else if($j('header.page_header').hasClass('stick') || $j('header.page_header').hasClass('stick_with_left_right_menu')) {
5125            if(sticky_amount > stickyInfoTopOffset) {
5126                if (sticky_amount >= $scroll) {
5127                    headerOffset = 0;
5128                    // check if scroll is going up or down because timeout removes class as soon as it is added
5129                    if ($scroll_direction == 'down'){
5130                        $j('.portfolio_single_sticky').removeClass('portfolio_single_sticky_animate_top');
5131                    } else {
5132                        setTimeout(function () {
5133                            $j('.portfolio_single_sticky').removeClass('portfolio_single_sticky_animate_top');
5134                        }, 330); //because this needs delay until animation in css is finished (0.2s)
5135                    }
5136
5137                } else {
5138                    headerOffset = $j('header.page_header').height();
5139                    $j('.portfolio_single_sticky').addClass('portfolio_single_sticky_animate_top');
5140
5141                }
5142            }else {
5143                headerOffset = $j('header.page_header').height();
5144            }
5145        } else{
5146            headerOffset = $j('header.page_header').height();
5147        }
5148
5149        var containerInnerPadding = parseInt($j('.content .container .container_inner.default_template_holder').css('padding-top'));
5150        if($scroll >= stickyInfoTopOffset - headerOffset - containerInnerPadding){
5151            var infoPosition= headerOffset + containerInnerPadding; //is for container top padding  for top padding
5152            $j('.portfolio_single_sticky').addClass('stick');
5153            $j('.portfolio_single_sticky.stick').css('top',infoPosition + 'px');
5154
5155            if($j('.portfolio_single.fixed-left').length){
5156                $j('.portfolio_single.fixed-left .column2').css('padding-left',info_width + 'px');
5157            }
5158
5159            //move sidebar up when hits the footer
5160
5161            var footer_in_viewport =0;
5162            var uncover_footer=0;
5163            if($j('.uncover').length && (($j('.no-touch').length && $j(window).width() > 1000) || ($j('.touch').length && $j(window).width() > 1300))){
5164                uncover_footer = parseInt($j('.content').css('margin-bottom'));
5165                footer_in_viewport = $j(document).height() - $window_height - uncover_footer;
5166            }else{
5167                footer_in_viewport = $j('footer').offset().top - $window_height;
5168            }
5169
5170            var info_from_bottom_of_screen = $window_height - (stickyInfoHeight + infoPosition + 130); // 130 is for bottom margin and navigation
5171
5172            if($scroll - footer_in_viewport > info_from_bottom_of_screen){
5173                $j('.portfolio_single_sticky.stick').css('margin-top', -($scroll - footer_in_viewport - info_from_bottom_of_screen));
5174            }else{
5175                $j('.portfolio_single_sticky.stick').css('margin-top',0);
5176            }
5177
5178        } else{
5179            $j('.portfolio_single_sticky').removeClass('stick');
5180            $j('.portfolio_single_sticky').css('top','0');
5181            if($j('.portfolio_single.fixed-left').length){
5182                $j('.portfolio_single.fixed-left .column2').css('padding-left','0');
5183            }
5184            $j('.portfolio_single_sticky').css('margin-top',0);
5185        }
5186    }
5187}
5188
5189/*
5190 ** Sticky portfolio info  width
5191 */
5192
5193function stickyInfoPortfolioWidth(){
5194    "use strict";
5195    if($j('.portfolio_single_sticky').length){
5196        var info_width = $j('.portfolio_single_sticky').parent().width();
5197        $j('.portfolio_single_sticky').css('width',info_width + 'px');
5198    }
5199}
5200
5201function removeStickyInfoPortfolioClass(){
5202    "use strict";
5203    if($j('.portfolio_single_sticky').length){
5204        if($j(window).width() <= 600){
5205            if($j('.portfolio_single_sticky').hasClass('stick')){
5206                $j('.portfolio_single_sticky').removeClass('stick portfolio_single_sticky_animate_top');
5207                $j('.portfolio_single_sticky').css('width','auto');
5208                $j('.portfolio_single_sticky').css('top','auto');
5209                $j('.portfolio_single_sticky').css('margin-top',0);
5210                if($j('.portfolio_single.fixed-left').length){
5211                    $j('.portfolio_single.fixed-left .column2').css('padding-left','0');
5212                }
5213            }
5214        }
5215    }
5216}
5217
5218// disabling scroll function
5219// left: 37, up: 38, right: 39, down: 40,
5220// spacebar: 32, pageup: 33, pagedown: 34, end: 35, home: 36
5221var keys = [37, 38, 39, 40];
5222
5223function preventDefaultValue(e) {
5224    "use strict";
5225    e = e || window.event;
5226    if (e.preventDefault)
5227        e.preventDefault();
5228    e.returnValue = false;
5229}
5230
5231
5232function disableKeydown(e) {
5233    "use strict";
5234    for (var i = keys.length; i--;) {
5235        if (e.keyCode === keys[i]) {
5236            preventDefaultValue(e);
5237            return;
5238        }
5239    }
5240}
5241
5242function disableWheel(e) {
5243    "use strict";
5244    preventDefaultValue(e);
5245}
5246
5247function qodeDisableScroll() {
5248    "use strict";
5249    if (window.addEventListener) {
5250        window.addEventListener('DOMMouseScroll', disableWheel, false);
5251    }
5252
5253    window.onmousewheel = document.onmousewheel = disableWheel;
5254    document.onkeydown = disableKeydown;
5255
5256    if($j('body').hasClass('smooth_scroll')){
5257        window.removeEventListener('mousedown', mousedown, false);
5258        window.removeEventListener('mousewheel', wheel, false);
5259    }
5260}
5261
5262function qodeEnableScroll() {
5263    "use strict";
5264    if (window.removeEventListener) {
5265        window.removeEventListener('DOMMouseScroll', disableWheel, false);
5266    }
5267    window.onmousewheel = document.onmousewheel = document.onkeydown = null;
5268
5269    if($j('body').hasClass('smooth_scroll')){
5270        window.addEventListener('mousedown', mousedown, false);
5271        window.addEventListener('mousewheel', wheel, false);
5272    }
5273}
5274
5275/**
5276 * Initializes load more data params
5277 * @param container with defined data params
5278 * return array
5279 */
5280function getLoadMoreData(container){
5281    var dataList = container.data(),
5282        returnValue = {};
5283
5284    for (var property in dataList) {
5285        if (dataList.hasOwnProperty(property)) {
5286            if (typeof dataList[property] !== 'undefined' && dataList[property] !== false) {
5287                returnValue[property] = dataList[property];
5288            }
5289        }
5290    }
5291
5292    return returnValue;
5293}
5294
5295/**
5296 * Sets load more data params for ajax function
5297 * @param container with defined data params
5298 * return array
5299 */
5300function setLoadMoreAjaxData(container, action){
5301    var returnValue = {
5302        action: action
5303    };
5304
5305    for (var property in container) {
5306        if (container.hasOwnProperty(property)) {
5307
5308            if (typeof container[property] !== 'undefined' && container[property] !== false) {
5309                returnValue[property] = container[property];
5310            }
5311        }
5312    }
5313
5314    return returnValue;
5315}
5316
5317/**
5318 * Init Owl Carousel
5319 */
5320function qodeOwlSlider() {
5321    var sliders = $j('.qode-owl-slider');
5322
5323    if (sliders.length) {
5324        sliders.each(function(){
5325            var slider = $j(this),
5326                slideItemsNumber = slider.children().length,
5327                numberOfItems = 1,
5328                loop = true,
5329                autoplay = true,
5330                autoplayHoverPause = true,
5331                sliderSpeed = 5000,
5332                sliderSpeedAnimation = 600,
5333                margin = 0,
5334                responsiveMargin = 0,
5335                stagePadding = 0,
5336                stagePaddingEnabled = false,
5337                center = false,
5338                autoWidth = false,
5339                animateInClass = false, // keyframe css animation
5340                animateOut = false, // keyframe css animation
5341                navigation = true,
5342                pagination = false,
5343                sliderIsPortfolio = !!slider.hasClass('qode-pl-is-slider'),
5344                sliderDataHolder = sliderIsPortfolio ? slider.parent() : slider;  // this is condition for portfolio slider
5345
5346            if (typeof slider.data('number-of-items') !== 'undefined' && slider.data('number-of-items') !== false && !sliderIsPortfolio) {
5347                numberOfItems = slider.data('number-of-items');
5348            }
5349            if (typeof sliderDataHolder.data('number-of-columns') !== 'undefined' && sliderDataHolder.data('number-of-columns') !== false && sliderIsPortfolio) {
5350                numberOfItems = sliderDataHolder.data('number-of-columns');
5351            }
5352            if (sliderDataHolder.data('enable-loop') === 'no') {
5353                loop = false;
5354            }
5355            if (sliderDataHolder.data('enable-autoplay') === 'no') {
5356                autoplay = false;
5357            }
5358            if (sliderDataHolder.data('enable-autoplay-hover-pause') === 'no') {
5359                autoplayHoverPause = false;
5360            }
5361            if (typeof sliderDataHolder.data('slider-speed') !== 'undefined' && sliderDataHolder.data('slider-speed') !== false) {
5362                sliderSpeed = sliderDataHolder.data('slider-speed');
5363            }
5364            if (typeof sliderDataHolder.data('slider-speed-animation') !== 'undefined' && sliderDataHolder.data('slider-speed-animation') !== false) {
5365                sliderSpeedAnimation = sliderDataHolder.data('slider-speed-animation');
5366            }
5367            if(slider.parent().hasClass('qode-normal-space')) {
5368                margin = 30;
5369            } else if (slider.parent().hasClass('qode-small-space')) {
5370                margin = 20;
5371            } else if (slider.parent().hasClass('qode-tiny-space')) {
5372                margin = 10;
5373            }
5374            if (sliderDataHolder.data('slider-padding') === 'yes') {
5375                stagePaddingEnabled = true;
5376                stagePadding = parseInt(slider.outerWidth() * 0.28);
5377                margin = 50;
5378            }
5379            if (typeof sliderDataHolder.data('slider-margin') !== 'undefined' && sliderDataHolder.data('slider-margin') !== false) {
5380                margin = sliderDataHolder.data('slider-margin');
5381            }
5382            if (sliderDataHolder.data('enable-center') === 'yes') {
5383                center = true;
5384            }
5385            if (sliderDataHolder.data('enable-auto-width') === 'yes') {
5386                autoWidth = true;
5387            }
5388            if (typeof sliderDataHolder.data('slider-animate-in') !== 'undefined' && sliderDataHolder.data('slider-animate-in') !== false) {
5389                animateInClass = sliderDataHolder.data('slider-animate-in');
5390            }
5391            if (typeof sliderDataHolder.data('slider-animate-out') !== 'undefined' && sliderDataHolder.data('slider-animate-out') !== false) {
5392                animateOut = sliderDataHolder.data('slider-animate-out');
5393            }
5394            if (sliderDataHolder.data('enable-navigation') === 'no') {
5395                navigation = false;
5396            }
5397            if (sliderDataHolder.data('enable-pagination') === 'yes') {
5398                pagination = true;
5399            }
5400
5401            if(navigation && pagination) {
5402                slider.addClass('qode-slider-has-both-nav');
5403            }
5404
5405            if (slideItemsNumber <= 1) {
5406                loop       = false;
5407                autoplay   = false;
5408                navigation = false;
5409                pagination = false;
5410            }
5411
5412            var responsiveNumberOfItems1 = 1,
5413                responsiveNumberOfItems2 = 2,
5414                responsiveNumberOfItems3 = 3,
5415                responsiveNumberOfItems4 = numberOfItems;
5416
5417            if (numberOfItems < 3) {
5418                responsiveNumberOfItems2 = numberOfItems;
5419                responsiveNumberOfItems3 = numberOfItems;
5420            }
5421
5422            if (numberOfItems > 4) {
5423                responsiveNumberOfItems4 = 4;
5424            }
5425
5426            if (stagePaddingEnabled || margin > 0) {
5427                responsiveMargin = 20;
5428            }
5429
5430            slider.owlCarousel({
5431                items: numberOfItems,
5432                loop: loop,
5433                autoplay: autoplay,
5434                autoplayHoverPause: autoplayHoverPause,
5435                autoplayTimeout: sliderSpeed,
5436                smartSpeed: sliderSpeedAnimation,
5437                margin: margin,
5438                stagePadding: stagePadding,
5439                center: center,
5440                autoWidth: autoWidth,
5441                animateInClass: animateInClass,
5442                animateOut: animateOut,
5443                dots: pagination,
5444                nav: navigation,
5445                navText: [
5446                    '<span class="qode-prev-icon fa fa-angle-left"></span>',
5447                    '<span class="qode-next-icon fa fa-angle-right"></span>'
5448                ],
5449                responsive: {
5450                    0: {
5451                        items: responsiveNumberOfItems1,
5452                        margin: responsiveMargin,
5453                        stagePadding: 0,
5454                        center: false,
5455                        autoWidth: false
5456                    },
5457                    681: {
5458                        items: responsiveNumberOfItems2
5459                    },
5460                    769: {
5461                        items: responsiveNumberOfItems3
5462                    },
5463                    1025: {
5464                        items: responsiveNumberOfItems4
5465                    },
5466                    1281: {
5467                        items: numberOfItems
5468                    }
5469                },
5470                onInitialize: function () {
5471                    slider.css('visibility', 'visible');
5472                }
5473            });
5474        });
5475    }
5476}
5477
5478/**
5479 *  Animate blog lists shortcode
5480 */
5481function qodeInitBlogListShortcodeAppear() {
5482    var blogList = $j('.qode-simple-blog-list.qode-sbl-animated');
5483
5484    if(blogList.length){
5485        blogList.each(function(){
5486            var thisBlogList = $j(this),
5487                item = thisBlogList.find('.qode-sbl-post'),
5488                animateCycle = 0, // rewind delay
5489                animateCycleCounter = 0;
5490
5491            item.each(function(){
5492                var currentItem = $j(this);
5493
5494                if ($j(this).offset().top == item.first().offset().top) { //find the number of articles in the same row
5495                    animateCycle ++
5496                }
5497
5498                currentItem.appear(function(){
5499
5500                    if (animateCycleCounter == animateCycle) {
5501                        animateCycleCounter = 0;
5502                    }
5503
5504                    setTimeout(function(){
5505                        currentItem.addClass('qode-appear');
5506
5507                        currentItem.one('webkitTransitionEnd otransitionend oTransitionEnd msTransitionEnd transitionend', function(){
5508                            currentItem.addClass('qode-appeared');
5509                        });
5510                    },animateCycleCounter * 250);
5511
5512                    animateCycleCounter++;
5513                });
5514            });
5515        });
5516    }
5517}
5518
5519/**
5520 *  Animate image with overlapping info shortcode
5521 */
5522function qodeInitImageWithOverlappingInfo() {
5523    var overlappingImage = $j('.qode-image-with-overlapping-info');
5524
5525    if(overlappingImage.length){
5526        overlappingImage.each(function(){
5527            var thisOverlappingImage = $j(this),
5528                image = thisOverlappingImage.find('.qode-iwoi-image-holder'),
5529                text  = thisOverlappingImage.find('.qode-iwoi-info-holder');
5530
5531            thisOverlappingImage.appear(function(){
5532                setTimeout(function(){
5533                    image.addClass('qode-appear');
5534                }, 250);
5535
5536                setTimeout(function(){
5537                    text.addClass('qode-appear');
5538                }, 500);
5539            }
5539, {accX: 0, accY: -300});
5540        });
5541    }
5542}
5543
5544/*
5545 **	Show Google Map
5546 */
5547function qodeShowGoogleMap(){
5548    var googleMap = $j('.qode-google-map');
5549
5550    if(googleMap.length){
5551        googleMap.each(function(){
5552            var element = $j(this);
5553
5554            var predefinedStyle = false;
5555            if(typeof element.data('predefined-style') !== 'undefined' && element.data('predefined-style') === 'yes') {
5556                predefinedStyle = true;
5557            }
5558
5559            var customMapStyle;
5560            if(typeof element.data('custom-map-style') !== 'undefined') {
5561                customMapStyle = element.data('custom-map-style');
5562            }
5563
5564            var colorOverlay;
5565            if(typeof element.data('color-overlay') !== 'undefined' && element.data('color-overlay') !== false) {
5566                colorOverlay = element.data('color-overlay');
5567            }
5568
5569            var saturation;
5570            if(typeof element.data('saturation') !== 'undefined' && element.data('saturation') !== false) {
5571                saturation = element.data('saturation');
5572            }
5573
5574            var lightness;
5575            if(typeof element.data('lightness') !== 'undefined' && element.data('lightness') !== false) {
5576                lightness = element.data('lightness');
5577            }
5578
5579            var zoom;
5580            if(typeof element.data('zoom') !== 'undefined' && element.data('zoom') !== false) {
5581                zoom = element.data('zoom');
5582            }
5583
5584            var pin;
5585            if(typeof element.data('pin') !== 'undefined' && element.data('pin') !== false) {
5586                pin = element.data('pin');
5587            }
5588
5589            var mapHeight;
5590            if(typeof element.data('height') !== 'undefined' && element.data('height') !== false) {
5591                mapHeight = element.data('height');
5592            }
5593
5594            var uniqueId;
5595            if(typeof element.data('unique-id') !== 'undefined' && element.data('unique-id') !== false) {
5596                uniqueId = element.data('unique-id');
5597            }
5598
5599            var scrollWheel;
5600            if(typeof element.data('scroll-wheel') !== 'undefined') {
5601                scrollWheel = element.data('scroll-wheel');
5602            }
5603            var addresses;
5604            if(typeof element.data('addresses') !== 'undefined' && element.data('addresses') !== false) {
5605                addresses = element.data('addresses');
5606            }
5607
5608            var map = "map_"+ uniqueId;
5609            var geocoder = "geocoder_"+ uniqueId;
5610            var holderId = "qode-map-"+ uniqueId;
5611
5612            qodeInitializeGoogleMap(predefinedStyle, customMapStyle, colorOverlay, saturation, lightness, scrollWheel, zoom, holderId, mapHeight, pin,  map, geocoder, addresses);
5613        });
5614    }
5615}
5616
5617/*
5618 **	Init Google Map
5619 */
5620function qodeInitializeGoogleMap(predefinedStyle, customMapStyle, color, saturation, lightness, wheel, zoom, holderId, height, pin,  map, geocoder, data){
5621
5622    if(typeof google !== 'object') {
5623        return;
5624    }
5625
5626    var mapStyles = [];
5627    if(predefinedStyle) {
5628        mapStyles = [
5629            {
5630                "featureType": "administrative",
5631                "elementType": "labels.text.fill",
5632                "stylers": [
5633                    {
5634                        "color": "#444444"
5635                    }
5636                ]
5637            },
5638            {
5639                "featureType": "landscape",
5640                "elementType": "all",
5641                "stylers": [
5642                    {
5643                        "color": "#f2f2f2"
5644                    }
5645                ]
5646            },
5647            {
5648                "featureType": "landscape",
5649                "elementType": "geometry.fill",
5650                "stylers": [
5651                    {
5652                        "saturation": "23"
5653                    },
5654                    {
5655                        "color": "#ffffff"
5656                    },
5657                    {
5658                        "visibility": "on"
5659                    }
5660                ]
5661            },
5662            {
5663                "featureType": "landscape",
5664                "elementType": "geometry.stroke",
5665                "stylers": [
5666                    {
5667                        "visibility": "on"
5668                    }
5669                ]
5670            },
5671            {
5672                "featureType": "landscape",
5673                "elementType": "labels.text",
5674                "stylers": [
5675                    {
5676                        "visibility": "on"
5677                    }
5678                ]
5679            },
5680            {
5681                "featureType": "landscape",
5682                "elementType": "labels.text.fill",
5683                "stylers": [
5684                    {
5685                        "color": "#8396d7"
5686                    }
5687                ]
5688            },
5689            {
5690                "featureType": "landscape",
5691                "elementType": "labels.text.stroke",
5692                "stylers": [
5693                    {
5694                        "hue": "#ff0000"
5695                    },
5696                    {
5697                        "visibility": "off"
5698                    }
5699                ]
5700            },
5701            {
5702                "featureType": "poi",
5703                "elementType": "all",
5704                "stylers": [
5705                    {
5706                        "visibility": "off"
5707                    }
5708                ]
5709            },
5710            {
5711                "featureType": "road",
5712                "elementType": "all",
5713                "stylers": [
5714                    {
5715                        "saturation": -100
5716                    },
5717                    {
5718                        "lightness": 45
5719                    }
5720                ]
5721            },
5722            {
5723                "featureType": "road",
5724                "elementType": "geometry.fill",
5725                "stylers": [
5726                    {
5727                        "color": "#efe0c3"
5728                    },
5729                    {
5730                        "visibility": "on"
5731                    }
5732                ]
5733            },
5734            {
5735                "featureType": "road",
5736                "elementType": "labels.text.fill",
5737                "stylers": [
5738                    {
5739                        "color": "#85a1ca"
5740                    },
5741                    {
5742                        "visibility": "on"
5743                    }
5744                ]
5745            },
5746            {
5747                "featureType": "road",
5748                "elementType": "labels.icon",
5749                "stylers": [
5750                    {
5751                        "invert_lightness": true
5752                    }
5753                ]
5754            },
5755            {
5756                "featureType": "road.highway",
5757                "elementType": "labels",
5758                "stylers": [
5759                    {
5760                        "visibility": "on"
5761                    }
5762                ]
5763            },
5764            {
5765                "featureType": "road.highway",
5766                "elementType": "labels.icon",
5767                "stylers": [
5768                    {
5769                        "invert_lightness": true
5770                    }
5771                ]
5772            },
5773            {
5774                "featureType": "road.arterial",
5775                "elementType": "labels.icon",
5776                "stylers": [
5777                    {
5778                        "visibility": "off"
5779                    }
5780                ]
5781            },
5782            {
5783                "featureType": "transit",
5784                "elementType": "all",
5785                "stylers": [
5786                    {
5787                        "visibility": "off"
5788                    }
5789                ]
5790            },
5791            {
5792                "featureType": "water",
5793                "elementType": "all",
5794                "stylers": [
5795                    {
5796                        "color": "#c9e4f3"
5797                    },
5798                    {
5799                        "visibility": "on"
5800                    }
5801                ]
5802            }
5803        ];
5804    } else {
5805        mapStyles = [
5806            {
5807                stylers: [
5808                    {hue: color },
5809                    {saturation: saturation},
5810                    {lightness: lightness},
5811                    {gamma: 1}
5812                ]
5813            }
5814        ];
5815    }
5816
5817    var googleMapStyleId;
5818
5819    if(predefinedStyle || customMapStyle === 'yes'){
5820        googleMapStyleId = 'qode-style';
5821    } else {
5822        googleMapStyleId = google.maps.MapTypeId.ROADMAP;
5823    }
5824
5825    if(wheel === 'yes'){
5826        wheel = true;
5827    } else {
5828        wheel = false;
5829    }
5830
5831    var qoogleMapType = new google.maps.StyledMapType(mapStyles, {name: "Qode Google Map"});
5832
5833    geocoder = new google.maps.Geocoder();
5834    var latlng = new google.maps.LatLng(-34.397, 150.644);
5835
5836    if (!isNaN(height)){
5837        height = height + 'px';
5838    }
5839
5840    var myOptions = {
5841        zoom: zoom,
5842        scrollwheel: wheel,
5843        center: latlng,
5844        zoomControl: true,
5845        zoomControlOptions: {
5846            style: google.maps.ZoomControlStyle.SMALL,
5847            position: google.maps.ControlPosition.RIGHT_CENTER
5848        },
5849        scaleControl: false,
5850        scaleControlOptions: {
5851            position: google.maps.ControlPosition.LEFT_CENTER
5852        },
5853        streetViewControl: false,
5854        streetViewControlOptions: {
5855            position: google.maps.ControlPosition.LEFT_CENTER
5856        },
5857        panControl: false,
5858        panControlOptions: {
5859            position: google.maps.ControlPosition.LEFT_CENTER
5860        },
5861        mapTypeControl: false,
5862        mapTypeControlOptions: {
5863            mapTypeIds: [google.maps.MapTypeId.ROADMAP, 'qode-style'],
5864            style: google.maps.MapTypeControlStyle.HORIZONTAL_BAR,
5865            position: google.maps.ControlPosition.LEFT_CENTER
5866        },
5867        mapTypeId: googleMapStyleId
5868    };
5869
5870    map = new google.maps.Map(document.getElementById(holderId), myOptions);
5871    map.mapTypes.set('qode-style', qoogleMapType);
5872
5873    var index;
5874
5875    for (index = 0; index < data.length; ++index) {
5876        qodeInitializeGoogleAddress(data[index], pin, map, geocoder);
5877    }
5878
5879    var holderElement = document.getElementById(holderId);
5880    holderElement.style.height = height;
5881}
5882
5883/*
5884 **	Init Google Map Addresses
5885 */
5886function qodeInitializeGoogleAddress(data, pin, map, geocoder){
5887    if (data === '') {
5888        return;
5889    }
5890
5891    var contentString = '<div id="content">'+
5892        '<div id="siteNotice">'+
5893        '</div>'+
5894        '<div id="bodyContent">'+
5895        '<p>'+data+'</p>'+
5896        '</div>'+
5897        '</div>';
5898
5899    var infowindow = new google.maps.InfoWindow({
5900        content: contentString
5901    });
5902
5903    geocoder.geocode( { 'address': data}, function(results, status) {
5904        if (status === google.maps.GeocoderStatus.OK) {
5905            map.setCenter(results[0].geometry.location);
5906            var marker = new google.maps.Marker({
5907                map: map,
5908                position: results[0].geometry.location,
5909                icon:  pin,
5910                title: data.store_title
5911            });
5912            google.maps.event.addListener(marker, 'click', function() {
5913                infowindow.open(map,marker);
5914            });
5915
5916            google.maps.event.addDomListener(window, 'resize', function() {
5917                map.setCenter(results[0].geometry.location);
5918            });
5919        }
5920    });
5921}
5922
5923function qodeInitClosedSideAreaMenuWidget(){
5924    if($j('.side_menu').length){
5925
5926        var widgets = $j(".side_menu").find('.widget_nav_menu');
5927
5928        widgets.each(function () {
5929            var widget = $j(this);
5930            widget.find('.menu-item').each(function () {
5931                var menuItem = $j(this);
5932
5933                if(menuItem.hasClass('menu-item-has-children')){
5934                    menuItem.children('a').on('click', function (e) {
5935                        e.preventDefault();
5936                        e.stopPropagation();
5937                        if(menuItem.children('.qode-sub-menu-closed').hasClass('qode-sub-menu-opened')){
5938                            menuItem.children('.qode-sub-menu-closed').slideUp();
5939                            menuItem.children('.qode-sub-menu-closed').removeClass('qode-sub-menu-opened');
5940                        }else {
5941                            menuItem.children('.qode-sub-menu-closed').slideDown();
5942                            menuItem.children('.qode-sub-menu-closed').addClass('qode-sub-menu-opened')
5943                        }
5944
5945                    })
5946                }
5947            });
5948        })
5949    }
5950}
5951
5952function qodeParallaxHolder() {
5953    var parallaxHolders = $j('.qode-parallax-holder');
5954
5955    if (parallaxHolders.length && !qode_htmlEl.hasClass('touch')) {
5956        ParallaxScroll.init(); //initialzation removed from plugin js file to have it run only on non-touch devices
5957    }
5958}
5959
5960function qodeRowAnimateBackground(){
5961    "use strict";
5962
5963    if($j('.qode-animate-background').length){
5964        $j('.qode-animate-background').each(function() {
5965            var $this = $j(this);
5966            if(!$this.hasClass('animate') && $this.css("background-image") != "" && $this.css("background-image") != "none"){
5967                $this.appear(function() {
5968                    var bg_url = $this.attr('style');
5969                    bg_url = bg_url.match(/url\(["']?([^'")]+)['"]?\)/);
5970                    bg_url = bg_url ? bg_url[1] : "";
5971                    if (bg_url) {
5972                        var backImg = new Image();
5973                        backImg.src = bg_url;
5974                        $j(backImg).load(function(){
5975                            $this.addClass('animate');
5976                        });
5977                    }
5978                },{accX: 0, accY: -$window_height/2});
5979            }
5980        });
5981    }
5982}
5983
5984(function($) {
5985    "use strict";
5986    var popup = {};
5987    qode.modules.popup = popup;
5988
5989    $(document).ready(qodeOnDocumentReady);
5990
5991    /*
5992     All functions to be called on $(document).ready() should be in this function
5993     */
5994    function qodeOnDocumentReady() {
5995        qodePopup();
5996    }
5997
5998    function qodePopup() {
5999        var popupOpener = $('a.qode-popup-opener'),
6000            popupClose = $( '.qode-popup-close' );
6001
6002        popupOpener.click( function(e) {
6003
6004            e.preventDefault();
6005            if ( qode_body.hasClass( 'qode-popup-opened' ) ) {
6006                qode_body.removeClass('qode-popup-opened');
6007                if(!qode_body.hasClass('page-template-full_screen-php')){
6008                    qode.modules.common.qodeEnableScroll();
6009                }
6010            } else {
6011                qode_body.addClass('qode-popup-opened');
6012                if(!qode_body.hasClass('page-template-full_screen-php')){
6013                    qode.modules.common.qodeDisableScroll();
6014                }
6015            }
6016            popupClose.click( function(e) {
6017                e.preventDefault();
6018                qode_body.removeClass('qode-popup-opened');
6019                if(!qode_body.hasClass('page-template-full_screen-php')){
6020                    qode.modules.common.qodeEnableScroll();
6021                }
6022            });
6023            //Close on escape
6024            $(document).keyup(function(e){
6025                if (e.keyCode == 27 ) { //KeyCode for ESC button is 27
6026                    qode_body.removeClass('qode-popup-opened');
6027                    if(!qode_body.hasClass('page-template-full_screen-php')){
6028                        qode.modules.common.qodeEnableScroll();
6029                    }
6030                }
6031            });
6032        });
6033    }
6034
6035
6036})(jQuery);

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.