PageSourceSearch

https://www.tsugumi0402.com/shared/js/common.js

js tsugumi0402.com collected 2026-10-08 23:14:58 UTC 148,193 bytes, 3,958 lines download raw bytes

1/*!
2 * ScriptName: common.js
3 * Version: 3.0.8
4 */
5
6/*
7 * Catch errors
8 *
9 */
10
11window.onerror = function (message, url, line, column, error) {
12  if (message.indexOf('Script error.') > -1) return;
13
14  if ($('html').hasClass('fc-debugger')) {
15    var uid = md5(message + url + line + column),
16      filename = url,
17      consoleHTML = '',
18      msg = '',
19      total = 0,
20      $blkConsole = $("#fc-console .console-main > .console-block:first-child[data-uid='" + uid + "']");
21
22    consoleHTML += '<div id="fc-console">';
23    consoleHTML += '<div class="console-title">FC Console</div>';
24    consoleHTML += '<div class="console-clear">Clear</div>';
25    consoleHTML += '<div class="console-main">';
26    consoleHTML += '</div>';
27    consoleHTML += '</div>';
28
29    if ($('#fc-console').length < 1) $('body').append(consoleHTML);
30
31    if (typeof url !== 'undefined') {
32      var fname = url.replace('\\', '/'); // correct slashes
33      if (fname.lastIndexOf('/')) fname = fname.substr(fname.lastIndexOf('/') + 1);
34      filename = fname.substr(0, fname.lastIndexOf('.')) + '.' + fname.substr(fname.lastIndexOf('.') + 1);
35      if (filename.length < 3) filename = url;
36    }
37
38    msg += '<div class="console-block" data-uid="' + uid + '" data-count="1">';
39    msg += '<div class="console-message">' + message + '</div>';
40    msg += '<div class="console-stacktrace">';
41    msg += '<div class="console-file">Script: <a href="' + url + '" target="_blank">' + filename + '</a></div>';
42    msg += '<div class="console-line">Line: <strong>' + line + '</strong></div>';
43    msg += '<div class="console-column">Column: <strong>' + column + '</strong></div>';
44    msg += '</div>';
45    msg += '<div class="console-error">' + error + '</div>';
46    msg += '</div>';
47
48    if ($blkConsole.length > 0) {
49      var count = $blkConsole.attr('data-count');
50      if (count !== undefined && !isNaN(count) && Number(count) >= 0) {
51        count = Number(count);
52        count++;
53
54        $blkConsole.attr('data-count', count);
55      } else $blkConsole.attr('data-count', 1);
56    } else $('#fc-console .console-main').prepend(msg);
57
58    $('#fc-console .console-main > .console-block').each(function () {
59      var count = $(this).attr('data-count');
60      if (count !== undefined && !isNaN(count) && Number(count) >= 0) total += Number(count);
61      else total++;
62    });
63
64    $('#fc-console .console-title').attr('data-total', total);
65  }
66};
67
68/*
69 * Switch fonts to Noto Serif
70 *
71 */
72
73if ('ontouchstart' in document.documentElement || navigator.maxTouchPoints > 0 || navigator.msMaxTouchPoints > 0) {
74  // remove all :hover stylesheets
75  try {
76    // prevent exception on browsers not supporting DOM styleSheets properly
77    for (var si in document.styleSheets) {
78      var styleSheet = document.styleSheets[si];
79
80      if (!styleSheet.rules) continue;
81
82      for (var ri = styleSheet.rules.length - 1; ri >= 0; ri--) {
83        if (!styleSheet.rules[ri].cssText || !styleSheet.rules[ri].style || !styleSheet.rules[ri].style.fontFamily) continue;
84
85        var fontFamily = styleSheet.rules[ri].style.fontFamily;
86        if (/^\s*(游明朝|Yu-?Mincho|ヒラギノ明朝|Hiragino[\s|-]*Mincho|(MS|MS)[\s|-]*明朝)/i.test(fontFamily)) {
87          // styleSheet.rules[ri].style.fontFamily = fontFamily.replace(fontFamily, "'Noto Serif JP', " + fontFamily);
88          $(styleSheet.rules[ri].selectorText).css('font-family', "'Noto Serif JP', " + fontFamily);
89        }
90      }
91    }
92  } catch (ex) {}
93}
94
95document.addEventListener('DOMContentLoaded', function () {
96  var lazyloadImages = document.querySelectorAll('img.lazy');
97
98  var lazyloadThrottleTimeout;
99
100  function lazyload() {
101    if (lazyloadThrottleTimeout) {
102      clearTimeout(lazyloadThrottleTimeout);
103    }
104
105    lazyloadThrottleTimeout = setTimeout(function () {
106      var scrollTop = window.pageYOffset;
107      lazyloadImages.forEach(function (img) {
108        if (img.offsetTop < window.innerHeight + scrollTop + 500) {
109          img.src = img.dataset.src;
110          img.classList.remove('lazy');
111        }
112      });
113      if (lazyloadImages.length == 0) {
114        document.removeEventListener('scroll', lazyload);
115        window.removeEventListener('resize', lazyload);
116        window.removeEventListener('orientationChange', lazyload);
117      }
118    }, 20);
119  }
120
121  document.addEventListener('scroll', lazyload);
122  window.addEventListener('resize', lazyload);
123  window.addEventListener('orientationChange', lazyload);
124});
125
126+(function ($) {
127  'use strict';
128  var transitionEnd = function () {
129      var el = document.createElement('fcvndev');
130
131      var transitionEndEventNames = {
132        transition: 'transitionend',
133        OTransition: 'oTransitionEnd',
134        MozTransition: 'transitionend',
135        WebkitTransition: 'webkitTransitionEnd',
136      };
137
138      for (var name in transitionEndEventNames) {
139        if (el.style[name] !== undefined) {
140          return {
141            end: transitionEndEventNames[name],
142          };
143        }
144      }
145
146      return false;
147    },
148    animationEnd = function () {
149      var el = document.createElement('fcvndev');
150
151      var animationEndEventNames = {
152        animation: 'animationend',
153        OAnimation: 'oAnimationEnd',
154        MozAnimation: 'animationend',
155        WebkitAnimation: 'webkitAnimationEnd',
156      };
157
158      for (var name in animationEndEventNames) {
159        if (el.style[name] !== undefined) {
160          return {
161            end: animationEndEventNames[name],
162          };
163        }
164      }
165
166      return false;
167    };
168
169  $(function () {
170    $.support.transition = transitionEnd();
171
172    $.support.animation = animationEnd();
173  });
174})(jQuery);
175
176$(document).ready(function () {
177  var UA = navigator.userAgent;
178  if (UA.indexOf('iPhone') < 0 && UA.indexOf('Android') < 0) $('.telhref').contents().unwrap(); // remove link [tel] on desktop
179
180  if (/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent))
181    $('html.mobile-no-animate').addClass('noanimated'); // to remove transition
182  else $('html.mobile-no-animate').removeClass('noanimated');
183
184  // fix bg parallax on mobile
185  if (isMobile.any()) $('.bg-parallax').css('background-attachment', 'inherit');
186  else $('.bg-parallax').css('background-attachment', '');
187
188  /*
189	if ((UA.indexOf("iPad") > -1) || (UA.indexOf("iPhone") > -1) || (UA.indexOf("iPod") > -1)) { // iOS
190		window.onpageshow = function(e) {
191			if (e.persisted || window.performance && window.performance.navigation.type == 2) window.location.reload(); // go back by hit back button
192		};
193	}
194	*/
195
196  // forcing a page to reload when the back button is clicked
197  window.onpageshow = function (event) {
198    if (event.persisted && $('body').hasClass('reload-on-back')) window.location.reload();
199  };
200  /*
201		if(navigator.userAgent.match(/Trident\/7\./)) {
202		  $('body').on("mousewheel", function () {
203			  event.preventDefault();
204			  var wd = event.wheelDelta;
205			  var csp = window.pageYOffset;
206			  window.scrollTo(0, csp - wd);
207		  });
208		}
209	*/
210  var clipboardData = new ClipboardJS('.copy', {
211    // container: $(".copy").get(0),
212    text: function (trigger) {
213      var _text_ = '{TITLE} {URL}',
214        _viewport_ = $("meta[name='viewport']").last().attr('content');
215
216      if ($(trigger).attr('data-copy') && $(trigger).attr('data-copy').length > 0) _text_ = $(trigger).attr('data-copy');
217
218      // if (_viewport_ && /(?:user-scalable\s*=\s*yes)/i.test(_viewport_)) $("meta[name='viewport']").last().attr("content", _viewport_.replace(/(?:user-scalable\s*=\s*yes)/i, "user-scalable=no")); // disabled zoom
219      if (_viewport_) {
220        // disabled zoom
221        var _vpt_ = _viewport_.replace(/(?:user-scalable\s*=\s*yes)/i, 'user-scalable=no'),
222          _spt_ = _vpt_.split(','),
223          _arr_ = [];
224
225        for (var i in _spt_) {
226          if (!/initial-scale/i.test(_spt_[i])) _arr_.push(_spt_[i].trim());
227        }
228        _arr_.push('initial-scale=1');
229
230        $("meta[name='viewport']").last().attr('content', _arr_.join(', ')); // disabled zoom
231      }
232
233      if ($(trigger).attr('data-replace-text')) $(trigger).html($(trigger).attr('data-replace-text'));
234      else if ($(trigger).attr('data-replace-image')) {
235        var _imgReplace_ = $(trigger).attr('data-replace-image');
236
237        if ($(trigger).children('picture').length > 0) {
238          $(trigger).children('picture').addClass('copy-change');
239          $(trigger)
240            .children('picture')
241            .children()
242            .each(function () {
243              if ($(this).prop('tagName').toLowerCase() == 'img') $(this).attr('src', _imgReplace_).removeClass('btn');
244              else if ($(this).prop('tagName').toLowerCase() == 'source') $(this).attr('srcset', $(this).attr('src-replace') ? $(this).attr('src-replace') : _imgReplace_);
245            });
246        } else if ($(trigger).children('img').length > 0) {
247          if ($(trigger).children('img').hasClass('btn')) {
248            $(trigger).children('img').addClass('copy-change');
249
250            _imgReplace_ = _imgReplace_.replace(/^(.*?)(_on)?\.(.*?)$/, '$1_on.$3');
251          }
252
253          $(trigger).children('img').attr('src', _imgReplace_);
254        } else $(trigger).html('<img src="' + _imgReplace_ + '" />');
255      }
256
257      $(trigger).addClass('copied');
258
259      if (_viewport_) $("meta[name='viewport']").last().attr('content', _viewport_); // enabled zoom
260
261      _text_ = _text_.replace('{TITLE}', document.title).replace('{URL}', location.href);
262
263      return _text_;
264    },
265  });
266
267  clipboardData
268    .on('success', function () {
269      var offsetX = window.scrollX || window.pageXOffset || window.document.documentElement.scrollLeft,
270        offsetY = window.scrollY || window.pageYOffset || window.document.documentElement.scrollTop;
271
272      // firefox jump - fixed
273      window.scroll(offsetX, offsetY); // started
274
275      setTimeout(function () {
276        // step 1
277        window.scroll(offsetX, offsetY);
278      }, 20);
279
280      setTimeout(function () {
281        // step 2
282        window.scroll(offsetX, offsetY);
283      }, 15);
284
285      setTimeout(function () {
286        // step 3
287        window.scroll(offsetX, offsetY);
288      }, 10);
289
290      setTimeout(function () {
291        // step 4
292        window.scroll(offsetX, offsetY);
293      }, 5);
294
295      setTimeout(function () {
296        // step 5
297        window.scroll(offsetX, offsetY);
298      }, 0);
299
300      window.scroll(offsetX, offsetY); // final
301    })
302    .on('error', function () {});
303
304  $('body')
305    .on('click', '#fc-console .console-title', function () {
306      $(this).parents('#fc-console').toggleClass('active');
307    })
308    .on('click', '#fc-console .console-clear', function () {
309      $('#fc-console').removeClass('active');
310      $('#fc-console .console-main').empty();
311      $('#fc-console .console-title').removeAttr('data-total');
312    })
313    .on('click', '.copy', function (e) {
314      e.preventDefault();
315
316      $(this).removeAttr('data-clipboard-text');
317    })
318    .on('click', '.hamburger', function (e) {
319      e.preventDefault();
320
321      if ($(this).hasClass('is-active')) {
322        $('body').removeClass('nav--opened');
323        $(this).removeClass('is-active');
324      } else {
325        $('body').addClass('nav--opened');
326        $(this).addClass('is-active');
327      }
328    });
329
330  // BEGIN: slide fading
331  if ($('.slide-fade').length > 0) {
332    $('.slide-fade').each(function () {
333      var $this = $(this),
334        __idx__ = $('.slide-fade').index($this),
335        $duration = typeof $this.attr('data-duration') != 'undefined' ? parseInt($this.attr('data-duration')) : 1000,
336        $timer = typeof $this.attr('data-timer') != 'undefined' ? parseInt($this.attr('data-timer')) : 4000,
337        $delay = typeof $this.attr('data-delay') != 'undefined' ? parseInt($this.attr('data-delay')) : false;
338
339      if ($timer < $duration) $timer = $duration * 2;
340
341      if (!$this.children('.active').length > 0) {
342        $this.children().hide();
343        $this.children().eq(0).show().addClass('active');
344
345        if ($this.siblings('.slide-page').length > 0) $this.siblings('.slide-page').children().eq(0).addClass('active');
346      } else {
347        if ($this.siblings('.slide-page').length > 0) $this.siblings('.slide-page').children().eq($this.children('.active').index()).addClass('active');
348      }
349
350      if ($(this).siblings('.slide-page').length > 0) {
351        $(this)
352          .siblings('.slide-page')
353          .children()
354          .each(function (i) {
355            $(this).attr('data', i);
356          });
357      }
358
359      if (!$(this).hasClass('stop')) {
360        // $slideFadeTimer[__idx__] = setInterval(function() {
361        // slideFade($this, $duration);
362        // }, $timer);
363
364        $(this).parents('.slideParent').addClass('move-start').attr('data', $this.children('.active').index());
365
366        if ($slideFadeTimer[__idx__]) clearTimeout($slideFadeTimer[__idx__]);
367        $slideFadeTimer[__idx__] = setTimeout(
368          function () {
369            slideFade($this, $duration);
370          },
371          $delay ? $delay : $timer,
372        );
373      }
374    });
375
376    /*
377     * TODO:
378     * --- removeClass/addClass
379     * .move-next
380     * .move-prev
381     * .move-first
382     * .move-last
383     *
384     */
385
386    $('body').on('click', '.slide-btn > .slide-next', function () {
387      var $btn = $(this),
388        $this = $btn.parent().siblings('.slide-fade'),
389        __idx__ = $('.slide-fade').index($this),
390        $duration = typeof $this.attr('data-duration') != 'undefined' ? parseInt($this.attr('data-duration')) : 1000,
391        $timer = typeof $this.attr('data-timer') != 'undefined' ? parseInt($this.attr('data-timer')) : 4000;
392
393      if ($timer < $duration) $timer = $duration * 2;
394
395      if (!$btn.hasClass('clicked') && !$this.hasClass('stop')) {
396        // if ($slideFadeTimer[__idx__]) clearInterval($slideFadeTimer[__idx__]);
397        if ($slideFadeTimer[__idx__]) clearTimeout($slideFadeTimer[__idx__]);
398
399        $btn.addClass('clicked');
400
401        $this
402          .children('.active')
403          .stop()
404          .fadeOut($duration, function () {
405            $(this).removeClass('active').removeAttr('style').hide();
406          });
407
408        if ($this.children('.active').next().length) {
409          $this
410            .children('.active')
411            .next()
412            .stop()
413            .fadeIn($duration, function () {
414              $(this).addClass('active').removeAttr('style').show();
415              $btn.removeClass('clicked');
416
417              // $slideFadeTimer[__idx__] = setInterval(function() {
418              $slideFadeTimer[__idx__] = setTimeout(function () {
419                $this.siblings('.slide-btn').children('.slide-next').click();
420              }, $timer);
421            });
422        } else {
423          if (!$this.hasClass('once')) {
424            $this
425              .children()
426              .eq(0)
427              .stop()
428              .fadeIn($duration, function () {
429                $(this).addClass('active').removeAttr('style').show();
430                $btn.removeClass('clicked');
431
432                // $slideFadeTimer[__idx__] = setInterval(function() {
433                $slideFadeTimer[__idx__] = setTimeout(function () {
434                  $this.siblings('.slide-btn').children('.slide-next').click();
435                }, $timer);
436              });
437          }
438        }
439      }
440    });
441    $('body').on('click', '.slide-btn > .slide-prev', function () {
442      var $btn = $(this),
443        $this = $btn.parent().siblings('.slide-fade'),
444        __idx__ = $('.slide-fade').index($this),
445        $duration = typeof $this.attr('data-duration') != 'undefined' ? parseInt($this.attr('data-duration')) : 1000,
446        $timer = typeof $this.attr('data-timer') != 'undefined' ? parseInt($this.attr('data-timer')) : 4000;
447
448      if ($timer < $duration) $timer = $duration * 2;
449
450      if (!$btn.hasClass('clicked') && !$this.hasClass('stop')) {
451        // if ($slideFadeTimer[__idx__]) clearInterval($slideFadeTimer[__idx__]);
452        if ($slideFadeTimer[__idx__]) clearTimeout($slideFadeTimer[__idx__]);
453
454        $btn.addClass('clicked');
455
456        $this
457          .children('.active')
458          .stop()
459          .fadeOut($duration, function () {
460            $(this).removeClass('active').removeAttr('style').hide();
461          });
462
463        if ($this.children('.active').prev().length) {
464          $this
465            .children('.active')
466            .prev()
467            .stop()
468            .fadeIn($duration, function () {
469              $(this).addClass('active').removeAttr('style').show();
470              $btn.removeClass('clicked');
471
472              // $slideFadeTimer[__idx__] = setInterval(function() {
473              $slideFadeTimer[__idx__] = setTimeout(function () {
474                $this.siblings('.slide-btn').children('.slide-next').click();
475              }, $timer);
476            });
477        } else {
478          $this
479            .children()
480            .last()
481            .stop()
482            .fadeIn($duration, function () {
483              $(this).addClass('active').removeAttr('style').show();
484              $btn.removeClass('clicked');
485
486              // $slideFadeTimer[__idx__] = setInterval(function() {
487              $slideFadeTimer[__idx__] = setTimeout(function () {
488                $this.siblings('.slide-btn').children('.slide-next').click();
489              }, $timer);
490            });
491        }
492      }
493    });
494
495    $('body').on('click', '.slide-page > *', function () {
496      var $page = $(this).parent(),
497        $idx = $(this).index(),
498        $this = $(this).parents('.slideParent').length ? $(this).parents('.slideParent').find('.slide-fade') : $(this).siblings('.slide-fade'),
499        __idx__ = $('.slide-fade').index($this),
500        $duration = typeof $this.attr('data-duration') != 'undefined' ? parseInt($this.attr('data-duration')) : 1000,
501        $timer = typeof $this.attr('data-timer') != 'undefined' ? parseInt($this.attr('data-timer')) : 4000;
502
503      if ($timer < $duration) $timer = $duration * 2;
504
505      if ($this.length) {
506        if (!$page.hasClass('clicked') && !$this.hasClass('stop')) {
507          if ($(this).siblings('.active').length > 0) {
508            var idxOld = parseInt($(this).siblings('.active').attr('data')),
509              idxNew = parseInt($(this).attr('data')),
510              beside = idxOld - idxNew === 1 || idxNew - idxOld === 1;
511
512            $(this).parents('.slideParent').removeClass('move-start move-next move-prev move-first move-last');
513
514            if (idxNew > idxOld) {
515              $(this).parents('.slideParent').addClass('move-next').attr('data', idxNe
515w);
516
517              if ($(this).is(':last-child')) $(this).parents('.slideParent').addClass('move-last');
518            } else {
519              $(this).parents('.slideParent').addClass('move-prev').attr('data', idxNew);
520
521              if ($(this).is(':first-child')) $(this).parents('.slideParent').addClass('move-first');
522            }
523          }
524
525          if ($this.children().eq($idx).length > 0) {
526            if ($slideFadeTimer[__idx__]) clearTimeout($slideFadeTimer[__idx__]);
527
528            $this.siblings('.slide-page').children('.active').removeClass('active');
529            $(this).addClass('active');
530
531            $page.addClass('clicked');
532
533            $this
534              .children('.active')
535              .stop()
536              .fadeOut($duration, function () {
537                $(this).removeClass('active').removeAttr('style').hide();
538              });
539
540            $this
541              .children()
542              .eq($idx)
543              .stop()
544              .fadeIn($duration, function () {
545                $(this).addClass('active').removeAttr('style').show();
546                $page.removeClass('clicked');
547
548                // $slideFadeTimer[__idx__] = setInterval(function() {
549                // slideFade($this, $duration);
550                // }, $timer);
551
552                $slideFadeTimer[__idx__] = setTimeout(function () {
553                  slideFade($this, $duration);
554                }, $timer);
555              });
556          } else console.info('Slide not found');
557        }
558      } else console.info('.slideParent or .slide-fade not found!');
559    });
560
561    $('.slide-fade').on('touchstart', function (e) {
562      var touch = e.originalEvent.touches[0];
563      $(this).data('startX', touch.pageX);
564    });
565
566    $('.slide-fade').on('touchmove', function (e) {
567      var touch = e.originalEvent.touches[0];
568      var startX = $(this).data('startX');
569      var moveX = touch.pageX;
570
571      if (Math.abs(startX - moveX) > 50) {
572        if (startX > moveX) {
573          var $this = $(this).closest('.slideParent').find('.slide-fade');
574          var __idx__ = $('.slide-fade').index($this);
575
576          if ($slideFadeTimer[__idx__]) clearTimeout($slideFadeTimer[__idx__]);
577
578          $(this).closest('.slideParent').find('.slide-btn .slide-next').click();
579        } else {
580          var $this = $(this).closest('.slideParent').find('.slide-fade');
581          var __idx__ = $('.slide-fade').index($this);
582
583          if ($slideFadeTimer[__idx__]) clearTimeout($slideFadeTimer[__idx__]);
584
585          $(this).closest('.slideParent').find('.slide-btn .slide-prev').click();
586        }
587      }
588    });
589
590    $('.slide-fade').on('touchend', function (e) {
591      $(this).on('touchmove', function (e) {});
592    });
593  }
594  // BEGIN: slide fading
595
596  // navigation animate
597  if ($('.nav-animate').length) {
598    $('.nav-animate').each(function () {
599      var $timerNav,
600        $navNull = $(this).hasClass('nav-null'),
601        $navWidth = $(this).find('li').first().outerWidth(),
602        $navPosX = $navNull ? 0 : $(this).find('li').first().position().left,
603        // $navML = 0,
604        $navMR = 0;
605
606      if ($(this).find('li.active').length) {
607        (($navWidth = $(this).find('li.active').outerWidth()), ($navPosX = $(this).find('li.active').position().left));
608
609        // $navML = $(this).find("li.active").next().length ? parseInt($(this).find("li.active").next().css("margin-left"), 10),
610        $navMR = $(this).find('li.active').prev().length ? parseInt($(this).find('li.active').prev().css('margin-right'), 10) : 0;
611      } else {
612        if (!$navNull) $(this).find('li').first().addClass('active');
613
614        // $navML = parseInt($(this).find("li").first().css("margin-left"), 10),
615        // $navMR = parseInt($(this).find("li").first().css("margin-right"), 10);
616      }
617
618      $navWidth += $navMR;
619      $navPosX -= $navMR;
620
621      $(this).children('span').css({
622        width: $navWidth,
623        left: $navPosX,
624      });
625
626      if ($navNull) $(this).children('span').css('opacity', 0);
627
628      $(this)
629        .find('li')
630        .mouseover(function () {
631          var $navW = $(this).outerWidth(),
632            $navX = $(this).position().left,
633            // $nML = $(this).next().length ? parseInt($(this).next().css("margin-left"), 10),
634            $nMR = $(this).prev().length ? parseInt($(this).prev().css('margin-right'), 10) : 0;
635
636          if ($navNull) {
637            clearTimeout($timerNav);
638
639            $navPosX = $navX - $nMR;
640
641            $(this).parents('.nav-animate').children('span').css('opacity', 1);
642            console.log($navPosX);
643          }
644
645          $(this)
646            .parents('.nav-animate')
647            .children('span')
648            .stop()
649            .animate(
650              {
651                width: $navW + $nMR,
652                left: $navX - $nMR,
653              },
654              'fast',
655            );
656        })
657        .mouseleave(function () {
658          var $span = $(this).parents('.nav-animate').children('span');
659
660          if ($navNull) {
661            clearTimeout($timerNav);
662            $timerNav = setTimeout(function () {
663              console.log($navPosX);
664              $span.stop().fadeOut(100, function () {
665                $(this).removeAttr('style').css({
666                  opacity: 0,
667                  width: $navWidth,
668                  left: $navPosX,
669                });
670              });
671            }, 500);
672          } else {
673            $span.stop().animate(
674              {
675                width: $navWidth,
676                left: $navPosX,
677              },
678              'fast',
679            );
680          }
681        });
682    });
683  }
684
685  // BEGIN: toggle
686  if ($('.toggle').length > 0) {
687    $('body').on('click', '.toggle-link', function () {
688      var $toggleDuration = 500,
689        $toggleElm = $(this).parents('.toggle').first();
690
691      if (typeof $toggleElm.attr('data-duration') != 'undefined') {
692        if ($.inArray($toggleElm.attr('data-duration'), ['slow', 'normal', 'fast']) >= 0) $toggleDuration = $toggleElm.attr('data-duration');
693        else $toggleDuration = parseInt($toggleElm.attr('data-duration'));
694      }
695
696      if ($(this).parents('.single').length > 0) {
697        $(this)
698          .parents('.single')
699          .find('.toggle-main')
700          .stop()
701          .slideUp($toggleDuration, function () {
702            $(this).removeAttr('style');
703            $(this).parents('.toggle').first().removeClass('active');
704          });
705      }
706
707      if ($(this).parents('.toggle').first().hasClass('active')) {
708        $(this)
709          .siblings('.toggle-main')
710          .stop()
711          .slideUp($toggleDuration, function () {
712            $(this).removeAttr('style');
713            $(this).parents('.toggle').first().removeClass('active');
714          });
715      } else {
716        $(this)
717          .siblings('.toggle-main')
718          .stop()
719          .slideDown($toggleDuration, function () {
720            $(this).removeAttr('style');
721            $(this).parents('.toggle').first().addClass('active');
722
723            // if ($(this).find("[class*=heightLine]").length) heightLine();
724
725            $(window).trigger('resize');
726          });
727
728        if ($(this).siblings('.toggle-main').find('[class*=heightLine]').length) heightLine();
729      }
730    });
731  }
732  // END: toggle
733
734  // BEGIN: tabs - switch
735  if ($('.tabs-switch').length) {
736    $('.tabs-switch').each(function () {
737      var $tabsSwitch = $(this),
738        $tabLink = $tabsSwitch.find('.tab-link'),
739        $tabContent = $tabsSwitch.find('.tab-content');
740
741      $tabLink.children().each(function () {
742        if ($(this).find('img').length > 0 && $(this).find('img').hasClass('btn')) {
743          $(this).data('src', $(this).find('img').attr('src'));
744
745          $(this)
746            .find('img')
747            .attr('src')
748            .match(/^(.*)(\.{1}.*)/g);
749          $(this).data('active', RegExp.$1 + '_on' + RegExp.$2);
750        }
751      });
752
753      $tabContent.children().hide();
754
755      if (!$tabsSwitch.hasClass('stop')) {
756        $tabLink.each(function () {
757          // TODO: active by [data-active]
758          var hash = window.location.hash || location.hash;
759          if (hash) {
760            if ($(this).children("[data-tab-anchor='" + hash + "']").length)
761              $(this)
762                .children("[data-tab-anchor='" + hash + "']")
763                .addClass('active');
764            else $(this).children().first().addClass('active');
765          } else if (!$(this).children('.active').length) $(this).children().first().addClass('active');
766
767          $(this).children('.active').find('img').attr('src', $(this).children('.active').data('active')).removeClass('btn');
768        });
769
770        if ($tabLink.children('.active').hasClass('all')) $tabContent.children().show();
771        else $tabContent.children().eq($tabLink.children('.active').index()).show();
772      }
773
774      if ($('.bx-wrapper').length > 0) $(window).trigger('resize');
775    });
776
777    $('body').on('click', '.tabs-switch-close', function () {
778      var $content = $(this).parents('.tab-content').first(),
779        $switch = $(this).parents('.tabs-switch').first();
780
781      if ($content.length > 0 && $switch.length > 0) {
782        var $tabMode = $.inArray($switch.attr('data'), ['fade', 'slide', 'block']) >= 0 ? $switch.attr('data') : 'block',
783          $tabDuration = $switch.attr('data-duration') ? parseInt($switch.attr('data-duration')) : 300;
784
785        if ($tabMode == 'fade') $content.children().stop().fadeOut($tabDuration);
786        else if ($tabMode == 'slide') $content.children().stop().slideUp($tabDuration);
787        else $content.children().stop().hide($tabDuration);
788      }
789    });
790
791    $('body').on('click', '.tab-link .tab-item, .tab-link > *', function () {
792      var $itemMode = $(this).hasClass('tab-item'),
793        $this = $itemMode ? $(this, '.tab-item') : $(this),
794        $idxAll = $this.parents('.tab-link').first().children('.all').length > 0 ? $this.parents('.tab-link').first().children('.all').index() : false,
795        $idx = $itemMode ? $this.parents('.tab-link').first().find('.tab-item').index($this) : $this.parents('.tab-link').first().children().index($this),
796        $act = $itemMode ? $this.parents('.tab-link').first().find('.tab-item.active') : $this.parents('.tab-link').first().children('.active'),
797        $tabMode = $.inArray($this.parents('.tabs-switch').first().attr('data'), ['fade', 'slide', 'block']) >= 0 ? $this.parents('.tabs-switch').first().attr('data') : 'block',
798        $tabDuration = $this.parents('.tabs-switch').first().attr('data-duration') ? parseInt($this.parents('.tabs-switch').first().attr('data-duration')) : 300,
799        $tabContent = $this.parents('.tabs-switch').first().children('.tab-content'),
800        $tabIdx = $this.attr('data-active') ? $this.attr('data-active') : false,
801        $autoScroll = $.inArray($this.parents('.tabs-switch').first().attr('data-scroll'), ['true', 'on', 'enable', 'enabled', '1']) >= 0 ? true : false,
802        $itself = $.inArray($this.parents('.tabs-switch').first().attr('data-toggle'), ['true', 'on', 'enable', 'enabled', '1']) >= 0 && $this.hasClass('active') ? true : false,
803        $itHide = $tabContent.children().eq($idx).is(':hidden');
804
805      if ($tabIdx) {
806        $this
807          .parents('.tabs-switch')
808          .first()
809          .find('.tab-link')
810          .each(function () {
811            var $tabBtn = $itemMode ? $(this).find(".tab-item[data-active='" + $tabIdx + "']") : $(this).children("[data-active='" + $tabIdx + "']"),
812              $elmActive = $itemMode ? $(this).find('.tab-item.active') : $(this).children('.active');
813
814            $elmActive.find('img').attr('src', $elmActive.data('src'));
815            $elmActive.removeClass('active');
816
817            if ($itself) {
818              if ($itHide) $tabBtn.addClass('active');
819              else $tabBtn.removeClass('active');
820            } else $tabBtn.addClass('active');
821
822            // if (!$tabBtn.find("img").hasClass("active")) $tabBtn.find("img").attr("src", $tabBtn.data("active"));
823            if ($tabBtn.find('img').hasClass('btn')) $tabBtn.find('img').attr('src', $tabBtn.data('active')).removeClass('btn');
824          });
825      } else {
826        if (/^(.*?)_on\.(.*?)$/.test($act.find('img').attr('src'))) $act.find('img').addClass('btn');
827
828        $act.find('img').attr('src', $act.data('src'));
829        $act.removeClass('active');
830
831        if ($itself) {
832          if ($itHide) $this.addClass('active');
833          else $this.removeClass('active');
834        } else $this.addClass('active');
835
836        // if (!$this.find("img").hasClass("active")) $this.find("img").attr("src", $this.data("active"));
837        if ($this.find('img').hasClass('btn')) $this.find('img').attr('src', $this.data('active')).removeClass('btn');
838      }
839
840      if (!$this.parents('.tab-link').first().hasClass('clicked')) {
841        $this.parents('.tab-link').first().addClass('clicked');
842
843        if ($this.hasClass('all')) {
844          if ($tabMode == 'fade') {
845            $tabContent
846              .children()
847              .stop()
848              .fadeIn($tabDuration, function () {
849                $(this).removeAttr('style').show();
850
851                if ($(this).find('[class*=heightLine]').length) heightLine();
852
853                if ($this.children('a').length) $this.children('a').click();
854
855                $tabContent.css({
856                  minHeight: '',
857                });
858
859                $(window).trigger('resize');
860
861                $this.parents('.tab-link').first().removeClass('clicked');
862              });
863          } else if ($tabMode == 'slide') {
864            $tabContent.children().slideDown($tabDuration, function () {
865              $(this).removeAttr('style').show();
866
867              if ($(this).find('[class*=heightLine]').length) heightLine();
868
869              if ($this.children('a').length) $this.children('a').click();
870
871              $(window).trigger('resize');
872
873              $this.parents('.tab-link').first().removeClass('clicked');
874            });
875          } else {
876            $tabDuration = $(this).parents('.tabs-switch').first().attr('data-duration') ? parseInt($(this).parents('.tabs-switch').first().attr('data-duration')) : 0;
877
878            $tabContent
879              .children()
880              .stop()
881              .show($tabDuration, function () {
882                $(this).removeAttr('style').show();
883
884                if ($(this).find('[class*=heightLine]').length) heightLine();
885
886                if ($this.children('a').length) $this.children('a').click();
887
888                $(window).trigger('resize');
889
890                $this.parents('.tab-link').first().removeClass('clicked');
891              });
892          }
893        } else {
894          if ($idxAll !== false && $idxAll >= 0 && $idx >= $idxAll) $idx -= 1;
895
896          if ($tabMode == 'fade') {
897            if ($itself) {
898              $tabContent
899                .children()
900                .eq($idx)
901                .stop()
902                .fadeToggle($tabDuration, function () {
903                  if ($itHide) $(this).removeAttr('style').show();
904                  else $(this).removeAttr('style').hide();
905
906                  if ($(this).find('[class*=heightLine]').length) heightLine();
907
908                  if ($this.children('a').length) $this.children('a').click();
909
910                  $tabContent.css({
911                    minHeight: '',
912                  });
913
914                  $(window).trigger('resize');
915
916                  $this.parents('.tab-link').first().removeClass('clicked');
917                });
918            } else {
919              $tabContent.css({
920                minHeight: $tabContent.outerHeight(),
921              });
922
923              $tabContent
924                .children()
925                .stop()
926                .fadeOut($tabDuration, function () {
927                  $(this).removeAttr('style').hide();
928                });
929              $tabContent
930                .children()
931                .eq($idx)
932                .stop()
933                .delay($tabDuration)
934                .fadeIn($tabDuration, function () {
935                  $(this).removeAttr('style').show();
936
937                  if ($(this).find('[class*=heightLine]').length) heightLine();
938
939                  if ($this.children('a').length) $this.children('a').click();
940
941                  $tabContent.css({
942                    minHeight: '',
943                  });
944
945                  $(window).trigger('resize');
946
947                  $this.parents('.tab-link').first().remove
947Class('clicked');
948                });
949            }
950          } else if ($tabMode == 'slide') {
951            if ($itself) {
952              $tabContent
953                .children()
954                .eq($idx)
955                .stop()
956                .slideToggle($tabDuration, function () {
957                  if ($itHide) $(this).removeAttr('style').show();
958                  else $(this).removeAttr('style').hide();
959
960                  if ($(this).find('[class*=heightLine]').length) heightLine();
961
962                  if ($this.children('a').length) $this.children('a').click();
963
964                  $(window).trigger('resize');
965
966                  $this.parents('.tab-link').first().removeClass('clicked');
967                });
968            } else {
969              $tabContent
970                .children()
971                .stop()
972                .slideUp($tabDuration, function () {
973                  $(this).removeAttr('style').hide();
974                })
975                .siblings()
976                .eq($idx)
977                .stop()
978                .slideDown($tabDuration, function () {
979                  $(this).removeAttr('style').show();
980
981                  if ($(this).find('[class*=heightLine]').length) heightLine();
982
983                  if ($this.children('a').length) $this.children('a').click();
984
985                  $(window).trigger('resize');
986
987                  $this.parents('.tab-link').first().removeClass('clicked');
988                });
989            }
990          } else {
991            $tabDuration = $this.parents('.tabs-switch').first().attr('data-duration') ? parseInt($this.parents('.tabs-switch').first().attr('data-duration')) : 0;
992
993            if ($itself) {
994              $tabContent
995                .children()
996                .eq($idx)
997                .stop()
998                .toggle($tabDuration, function () {
999                  if ($itHide) $(this).removeAttr('style').show();
1000                  else $(this).removeAttr('style').hide();
1001
1002                  if ($(this).find('[class*=heightLine]').length) heightLine();
1003
1004                  if ($this.children('a').length) $this.children('a').click();
1005
1006                  $(window).trigger('resize');
1007
1008                  $this.parents('.tab-link').first().removeClass('clicked');
1009                });
1010            } else {
1011              $tabContent
1012                .children()
1013                .stop()
1014                .hide($tabDuration, function () {
1015                  $(this).removeAttr('style').hide();
1016                })
1017                .siblings()
1018                .eq($idx)
1019                .stop()
1020                .show($tabDuration, function () {
1021                  $(this).removeAttr('style').show();
1022
1023                  if ($(this).find('[class*=heightLine]').length) heightLine();
1024
1025                  if ($this.children('a').length) $this.children('a').click();
1026
1027                  $(window).trigger('resize');
1028
1029                  $this.parents('.tab-link').first().removeClass('clicked');
1030                });
1031            }
1032          }
1033        }
1034
1035        setTimeout(function () {
1036          $this.parents('.tab-link').first().removeClass('clicked');
1037        }, $tabDuration);
1038
1039        if ($('.slick-slider').length > 0) {
1040          $(window).trigger('resize');
1041        }
1042
1043        if ($('.bx-wrapper').length > 0) {
1044          setTimeout(function () {
1045            $(window).trigger('resize');
1046          }, 1);
1047        }
1048
1049        if ($autoScroll) {
1050          var $offsetY = $tabContent.offset().top,
1051            $navOffset = 0;
1052
1053          if ($('.nav-fixed').length) $navOffset = typeof $('.nav-fixed').attr('data-height') != 'undefined' ? parseInt($('.nav-fixed').attr('data-height')) : $('.nav-fixed').outerHeight();
1054
1055          if ($('.nav-target').length) {
1056            if ($('.nav-fixed').length) $navOffset = typeof $('.nav-fixed').attr('data-height') != 'undefined' ? parseInt($('.nav-fixed').attr('data-height')) : $('.nav-fixed').outerHeight();
1057
1058            $('html, body')
1059              .stop()
1060              .animate(
1061                {
1062                  scrollTop: $offsetY - $navOffset,
1063                },
1064                500,
1065              );
1066          } else {
1067            $('html, body')
1068              .stop()
1069              .animate(
1070                {
1071                  scrollTop: $offsetY - $navOffset,
1072                },
1073                500,
1074              );
1075          }
1076        }
1077      }
1078    });
1079  }
1080  // END: tabs - switch
1081
1082  // BEGIN: gmap
1083  if (typeof gmap === 'object' && isObjectVar(gmap)) {
1084    var _dialogs_ = [],
1085      _dialogsOpen_ = true;
1086
1087    function init() {
1088      var errorsMap = {
1089          mapDiv: false,
1090          latLong: false,
1091        },
1092        objData = {}; // single || multiMap || multiPoint
1093
1094      // checking
1095      if (typeof gmap.maps != 'undefined' && Object.keys(gmap.maps).length > 0) {
1096        // multi map
1097        if (typeof gmap.maps[0] == 'undefined') {
1098          // associative array
1099          if (typeof gmap.maps.mapDiv == 'undefined' || gmap.maps.mapDiv == '') errorsMap.mapDiv = 1;
1100          else if ((typeof gmap.maps.latitude == 'undefined' && typeof gmap.maps.latitude != 'number') || (typeof gmap.maps.longitude == 'undefined' && typeof gmap.maps.longitude != 'number')) errorsMap.latLong = 1;
1101        } else {
1102          // object
1103          for (var s in gmap.maps) {
1104            // loop
1105            if (typeof gmap.maps[s].mapDiv == 'undefined' || gmap.maps[s].mapDiv == '') {
1106              errorsMap.mapDiv = 2;
1107              break;
1108            } else if ((typeof gmap.maps[s].latitude == 'undefined' && typeof gmap.maps[s].latitude != 'number') || (typeof gmap.maps[s].longitude == 'undefined' && typeof gmap.maps[s].longitude != 'number')) {
1109              errorsMap.latLong = 2;
1110              break;
1111            }
1112          }
1113        }
1114      } else {
1115        // single map
1116        if (typeof gmap.mapDiv == 'undefined' || gmap.mapDiv == '') errorsMap.mapDiv = 3;
1117        else if ((typeof gmap.latitude == 'undefined' && typeof gmap.latitude != 'number') || typeof gmap.longitude == 'undefined' || typeof gmap.longitude != 'number') errorsMap.latLong = 3;
1118      }
1119
1120      if (errorsMap.mapDiv || errorsMap.latLong) {
1121        console.info('ERROR', errorsMap);
1122        return false;
1123      } else {
1124        // if ()
1125        var init = initMap(gmap);
1126        // console.log(init);
1127      }
1128
1129      /*
1130       * initialize
1131       *
1132       */
1133
1134      function initMap(data) {
1135        var dataMap = {
1136          mapDiv: false,
1137          latitude: false,
1138          longitude: false,
1139
1140          center: false,
1141
1142          zoom: 17,
1143          minZoom: 2,
1144          zoomControl: true,
1145          disableDoubleClickZoom: true,
1146          mapTypeControl: true,
1147          scaleControl: true,
1148          scrollwheel: false,
1149          panControl: true,
1150          streetViewControl: true,
1151          draggable: true,
1152          overviewMapControl: true,
1153
1154          styles: false,
1155          style: false,
1156
1157          name: false,
1158          desc: false,
1159          tel: false,
1160          email: false,
1161
1162          url: false,
1163          logo: false,
1164          size: false,
1165          scale: false,
1166          origin: false,
1167          anchor: false,
1168          optimized: false,
1169
1170          clickable: false,
1171          hover: false,
1172          html: false,
1173
1174          multi: false,
1175        };
1176
1177        // BEGIN: configs default
1178        if (typeof data.zoom != 'undefined' && typeof data.zoom == 'number') dataMap.zoom = data.zoom;
1179        if (typeof data.minZoom != 'undefined' && typeof data.minZoom == 'number') dataMap.minZoom = data.minZoom;
1180        if (typeof data.zoomControl != 'undefined' && typeof data.zoomControl == 'boolean') dataMap.zoomControl = data.zoomControl;
1181        if (typeof data.disableDoubleClickZoom != 'undefined' && typeof data.disableDoubleClickZoom == 'boolean') dataMap.disableDoubleClickZoom = data.disableDoubleClickZoom;
1182        if (typeof data.mapTypeControl != 'undefined' && typeof data.mapTypeControl == 'boolean') dataMap.mapTypeControl = data.mapTypeControl;
1183        if (typeof data.scaleControl != 'undefined' && typeof data.scaleControl == 'boolean') dataMap.scaleControl = data.scaleControl;
1184        if (typeof data.scrollwheel != 'undefined' && typeof data.scrollwheel == 'boolean') dataMap.scrollwheel = data.scrollwheel;
1185        if (typeof data.panControl != 'undefined' && typeof data.panControl == 'boolean') dataMap.panControl = data.panControl;
1186        if (typeof data.streetViewControl != 'undefined' && typeof data.streetViewControl == 'boolean') dataMap.streetViewControl = data.streetViewControl;
1187        if (typeof data.draggable != 'undefined' && typeof data.draggable == 'boolean') dataMap.draggable = data.draggable;
1188        if (typeof data.overviewMapControl != 'undefined' && typeof data.overviewMapControl == 'boolean') dataMap.overviewMapControl = data.overviewMapControl;
1189
1190        if (typeof data.name != 'undefined' && data.name != '') dataMap.name = data.name;
1191        if (typeof data.desc != 'undefined' && data.desc != '') dataMap.desc = data.desc;
1192        if (typeof data.tel != 'undefined' && data.tel != '') dataMap.tel = data.tel;
1193        if (typeof data.email != 'undefined' && data.email != '') dataMap.email = data.email;
1194        if (typeof data.url != 'undefined' && data.url != '') dataMap.url = data.url;
1195        if (typeof data.logo != 'undefined' && data.logo != '') dataMap.logo = data.logo;
1196        if (typeof data.size != 'undefined' && typeof data.size.width != 'undefined' && data.size.width != '') dataMap.sizeWidth = data.size.width;
1197        if (typeof data.size != 'undefined' && typeof data.size.height != 'undefined' && data.size.height != '') dataMap.sizeHeight = data.size.height;
1198        if (typeof data.scale != 'undefined' && typeof data.scale.width != 'undefined' && data.scale.width != '') dataMap.scaleWidth = data.scale.width;
1199        if (typeof data.scale != 'undefined' && typeof data.scale.height != 'undefined' && data.scale.height != '') dataMap.scaleHeight = data.scale.height;
1200        if (typeof data.origin != 'undefined' && typeof data.origin.x != 'undefined' && data.origin.x != '') dataMap.originX = data.origin.x;
1201        if (typeof data.origin != 'undefined' && typeof data.origin.y != 'undefined' && data.origin.y != '') dataMap.originY = data.origin.y;
1202        if (typeof data.anchor != 'undefined' && typeof data.anchor.x != 'undefined' && data.anchor.x != '') dataMap.anchorX = data.anchor.x;
1203        if (typeof data.anchor != 'undefined' && typeof data.anchor.y != 'undefined' && data.anchor.y != '') dataMap.anchorY = data.anchor.y;
1204        if (typeof data.optimized != 'undefined' && data.optimized != '') dataMap.optimized = data.optimized;
1205
1206        if (typeof data.clickable != 'undefined' && data.clickable != '') dataMap.clickable = data.clickable;
1207        if (typeof data.html != 'undefined' && data.html != '') dataMap.html = data.html;
1208        if (typeof data.hover != 'undefined' && typeof data.hover == 'boolean') dataMap.hover = data.hover;
1209
1210        if (typeof data.multi != 'undefined' && Object.keys(data.multi).length > 0) dataMap.multi = data.multi;
1211
1212        if (typeof data.styles != 'undefined') dataMap.styles = data.styles;
1213        else if (typeof data.style != 'undefined') {
1214          dataMap.style = {};
1215          if (typeof data.style.hue != 'undefined') dataMap.style.hue = data.style.hue;
1216          if (typeof data.style.gamma != 'undefined') dataMap.style.gamma = data.style.gamma;
1217          if (typeof data.style.lightness != 'undefined') dataMap.style.lightness = data.style.lightness;
1218          if (typeof data.style.saturation != 'undefined') dataMap.style.saturation = data.style.saturation;
1219        }
1220        // END: configs default
1221
1222        dataMap.mapDiv = data.mapDiv;
1223        dataMap.latitude = data.latitude;
1224        dataMap.longitude = data.longitude;
1225
1226        if (typeof data.maps != 'undefined' && Object.keys(data.maps).length > 0) {
1227          // multi map
1228          var objMap = {};
1229          if (typeof data.maps[0] == 'undefined')
1230            objMap[0] = data.maps; // object
1231          else objMap = data.maps; // array
1232
1233          for (var g in objMap) {
1234            // loop
1235            var obj = objMap[g];
1236
1237            // BEGIN: override configs
1238            if (typeof obj.zoom != 'undefined' && typeof obj.zoom == 'number') dataMap.zoom = obj.zoom;
1239            if (typeof obj.minZoom != 'undefined' && typeof obj.minZoom == 'number') dataMap.minZ
1239oom = obj.minZoom;
1240            if (typeof obj.zoomControl != 'undefined' && typeof obj.zoomControl == 'boolean') dataMap.zoomControl = obj.zoomControl;
1241            if (typeof obj.disableDoubleClickZoom != 'undefined' && typeof obj.disableDoubleClickZoom == 'boolean') dataMap.disableDoubleClickZoom = obj.disableDoubleClickZoom;
1242            if (typeof obj.mapTypeControl != 'undefined' && typeof obj.mapTypeControl == 'boolean') dataMap.mapTypeControl = obj.mapTypeControl;
1243            if (typeof obj.scaleControl != 'undefined' && typeof obj.scaleControl == 'boolean') dataMap.scaleControl = obj.scaleControl;
1244            if (typeof obj.scrollwheel != 'undefined' && typeof obj.scrollwheel == 'boolean') dataMap.scrollwheel = obj.scrollwheel;
1245            if (typeof obj.panControl != 'undefined' && typeof obj.panControl == 'boolean') dataMap.panControl = obj.panControl;
1246            if (typeof obj.streetViewControl != 'undefined' && typeof obj.streetViewControl == 'boolean') dataMap.streetViewControl = obj.streetViewControl;
1247            if (typeof obj.draggable != 'undefined' && typeof obj.draggable == 'boolean') dataMap.draggable = obj.draggable;
1248            if (typeof obj.overviewMapControl != 'undefined' && typeof obj.overviewMapControl == 'boolean') dataMap.overviewMapControl = obj.overviewMapControl;
1249
1250            if (typeof obj.styles != 'undefined') dataMap.styles = obj.styles;
1251            else if (typeof obj.style != 'undefined') {
1252              dataMap.style = {};
1253              if (typeof obj.style.hue != 'undefined') dataMap.style.hue = obj.style.hue;
1254              if (typeof obj.style.gamma != 'undefined') dataMap.style.gamma = obj.style.gamma;
1255              if (typeof obj.style.lightness != 'undefined') dataMap.style.lightness = obj.style.lightness;
1256              if (typeof obj.style.saturation != 'undefined') dataMap.style.saturation = obj.style.saturation;
1257            }
1258
1259            if (typeof obj.name != 'undefined' && obj.name != '') dataMap.name = obj.name;
1260            if (typeof obj.desc != 'undefined' && obj.desc != '') dataMap.desc = obj.desc;
1261            if (typeof obj.tel != 'undefined' && obj.tel != '') dataMap.tel = obj.tel;
1262            if (typeof obj.email != 'undefined' && obj.email != '') dataMap.email = obj.email;
1263            if (typeof obj.url != 'undefined' && obj.url != '') dataMap.url = obj.url;
1264            if (typeof obj.logo != 'undefined' && obj.logo != '') dataMap.logo = obj.logo;
1265            if (typeof obj.sizeWidth != 'undefined' && obj.sizeWidth != '') dataMap.sizeWidth = obj.sizeWidth;
1266            if (typeof obj.sizeHeight != 'undefined' && obj.sizeHeight != '') dataMap.sizeHeight = obj.sizeHeight;
1267            if (typeof obj.scaleWidth != 'undefined' && obj.scaleWidth != '') dataMap.scaleWidth = obj.scaleWidth;
1268            if (typeof obj.scaleHeight != 'undefined' && obj.scaleHeight != '') dataMap.scaleHeight = obj.scaleHeight;
1269            if (typeof obj.originX != 'undefined' && obj.originX != '') dataMap.originX = obj.originX;
1270            if (typeof obj.originY != 'undefined' && obj.originY != '') dataMap.originY = obj.originY;
1271            if (typeof obj.anchorX != 'undefined' && obj.anchorX != '') dataMap.anchorX = obj.anchorX;
1272            if (typeof obj.anchorY != 'undefined' && obj.anchorY != '') dataMap.anchorY = obj.anchorY;
1273            if (typeof obj.optimized != 'undefined' && obj.optimized != '') dataMap.optimized = obj.optimized;
1274            // END: override configs
1275
1276            if (typeof obj.clickable != 'undefined' && obj.clickable != '') dataMap.clickable = obj.clickable;
1277            if (typeof obj.html != 'undefined' && obj.html != '') dataMap.html = obj.html;
1278            if (typeof obj.hover != 'undefined' && typeof obj.hover == 'boolean') dataMap.hover = obj.hover;
1279            if (typeof obj.multi != 'undefined' && Object.keys(obj.multi).length > 0) dataMap.multi = obj.multi;
1280
1281            dataMap.mapDiv = obj.mapDiv;
1282            dataMap.latitude = obj.latitude;
1283            dataMap.longitude = obj.longitude;
1284
1285            if (typeof obj.center != 'undefined') {
1286              dataMap.center = {};
1287              if (typeof obj.center.latitude != 'undefined') dataMap.center.latitude = obj.center.latitude;
1288              if (typeof obj.center.longitude != 'undefined') dataMap.center.longitude = obj.center.longitude;
1289            } else {
1290              dataMap.center = {
1291                latitude: obj.latitude,
1292                longitude: obj.longitude,
1293              };
1294            }
1295
1296            loadMap(dataMap);
1297          }
1298        } else {
1299          // single map
1300          if (typeof data.center != 'undefined') {
1301            dataMap.center = {};
1302            if (typeof data.center.latitude != 'undefined') dataMap.center.latitude = data.center.latitude;
1303            if (typeof data.center.longitude != 'undefined') dataMap.center.longitude = data.center.longitude;
1304          } else {
1305            dataMap.center = {
1306              latitude: data.latitude,
1307              longitude: data.longitude,
1308            };
1309          }
1310
1311          loadMap(dataMap);
1312        }
1313
1314        return dataMap;
1315      }
1316
1317      function loadMap(data) {
1318        var elm = data.mapDiv;
1319
1320        elm = elm.substring(0, 1) == '#' ? elm.substring(1) : elm; // remove hash
1321
1322        var mapElement = document.getElementById(elm),
1323          styleOptions = [],
1324          mapOptions = {
1325            center: new google.maps.LatLng(data.center.latitude, data.center.longitude),
1326            zoom: data.zoom,
1327            minZoom: data.minZoom,
1328            zoomControl: data.zoomControl,
1329            zoomControlOptions: {
1330              style: google.maps.ZoomControlStyle.DEFAULT,
1331            },
1332            disableDoubleClickZoom: data.disableDoubleClickZoom,
1333            scaleControl: data.scaleControl,
1334            scrollwheel: data.scrollwheel,
1335            panControl: data.panControl,
1336            streetViewControl: data.streetViewControl,
1337            draggable: data.draggable,
1338            mapTypeControl: data.mapTypeControl,
1339            mapTypeControlOptions: {
1340              style: google.maps.MapTypeControlStyle.HORIZONTAL_BAR,
1341            },
1342            mapTypeId: google.maps.MapTypeId.ROADMAP,
1343            overviewMapControl: data.overviewMapControl,
1344            overviewMapControlOptions: {
1345              opened: false,
1346            },
1347          },
1348          googleMap = new google.maps.Map(mapElement, mapOptions);
1349
1350        if (data.multi === false) {
1351          var arr = {};
1352
1353          if (typeof data['name'] != 'undefined') arr['name'] = data['name'];
1354          if (typeof data['desc'] != 'undefined') arr['desc'] = data['desc'];
1355          if (typeof data['tel'] != 'undefined') arr['tel'] = data['tel'];
1356          if (typeof data['email'] != 'undefined') arr['email'] = data['email'];
1357          if (typeof data['url'] != 'undefined') arr['url'] = data['url'];
1358          if (typeof data['logo'] != 'undefined') arr['logo'] = data['logo'];
1359          if (typeof data['sizeWidth'] != 'undefined') arr['sizeWidth'] = data['sizeWidth'];
1360          if (typeof data['sizeHeight'] != 'undefined') arr['sizeHeight'] = data['sizeHeight'];
1361          if (typeof data['scaleWidth'] != 'undefined') arr['scaleWidth'] = data['scaleWidth'];
1362          if (typeof data['scaleHeight'] != 'undefined') arr['scaleHeight'] = data['scaleHeight'];
1363          if (typeof data['originX'] != 'undefined') arr['originX'] = data['originX'];
1364          if (typeof data['originY'] != 'undefined') arr['originY'] = data['originY'];
1365          if (typeof data['anchorX'] != 'undefined') arr['anchorX'] = data['anchorX'];
1366          if (typeof data['anchorY'] != 'undefined') arr['anchorY'] = data['anchorY'];
1367          if (typeof data['optimized'] != 'undefined') arr['optimized'] = data['optimized'];
1368          if (typeof data['clickable'] != 'undefined') arr['clickable'] = data['clickable'];
1369          if (typeof data['html'] != 'undefined') arr['html'] = data['html'];
1370          if (typeof data['hover'] != 'undefined') arr['hover'] = data['hover'];
1371
1372          arr['longitude'] = data['longitude'];
1373          arr['latitude'] = data['latitude'];
1374
1375          setMaps(arr, googleMap, data.center);
1376        } else {
1377          for (var i = 0; i < Object.keys(data.multi).length; i++) {
1378            var arr = data.multi[i];
1379
1380            if (typeof data['clickable'] != 'undefined') arr['clickable'] = data.clickable;
1381            if (typeof data['html'] != 'undefined') arr['html'] = data.html;
1382            if (typeof data['hover'] != 'undefined') arr['hover'] = data.hover;
1383
1384            if (typeof arr['size'] != 'undefined') {
1385              if (typeof arr['size']['width'] != 'undefined') arr['sizeWidth'] = arr['size']['width'];
1386              if (typeof arr['size']['height'] != 'undefined') arr['sizeHeight'] = arr['size']['height'];
1387
1388              delete arr['size'];
1389            }
1390            if (typeof arr['scale'] != 'undefined') {
1391              if (typeof arr['scale']['width'] != 'undefined') arr['scaleWidth'] = arr['scale']['width'];
1392              if (typeof arr['scale']['height'] != 'undefined') arr['scaleHeight'] = arr['scale']['height'];
1393
1394              delete arr['scale'];
1395            }
1396            if (typeof arr['origin'] != 'undefined') {
1397              if (typeof arr['origin']['x'] != 'undefined') arr['originX'] = arr['origin']['x'];
1398              if (typeof arr['origin']['y'] != 'undefined') arr['originY'] = arr['origin']['y'];
1399
1400              delete arr['origin'];
1401            }
1402            if (typeof arr['anchor'] != 'undefined') {
1403              if (typeof arr['anchor']['x'] != 'undefined') arr['anchorX'] = arr['anchor']['x'];
1404              if (typeof arr['anchor']['y'] != 'undefined') arr['anchorY'] = arr['anchor']['y'];
1405
1406              delete arr['anchor'];
1407            }
1408            if (typeof arr['optimized'] != 'undefined') arr['optimized'] = arr['optimized'];
1409            setMaps(arr, googleMap, data.center);
1410          }
1411        }
1412
1413        // stylers
1414        if (data.styles !== false) styleOptions = data.styles;
1415        else if (data.style !== false) {
1416          if (typeof data.style.hue != 'undefined' || typeof data.style.gamma != 'undefined' || typeof data.style.lightness != 'undefined' || typeof data.style.saturation != 'undefined') {
1417            if (typeof styleOptions[0] == 'undefined') styleOptions[0] = {};
1418            if (typeof styleOptions[0].stylers == 'undefined') styleOptions[0].stylers = [];
1419          }
1420
1421          if (typeof data.style.hue != 'undefined') {
1422            styleOptions[0].stylers.push({
1423              hue: data.style.hue,
1424            });
1425          }
1426          if (typeof data.style.gamma != 'undefined') {
1427            styleOptions[0].stylers.push({
1428              gamma: data.style.gamma,
1429            });
1430          }
1431          if (typeof data.style.lightness != 'undefined') {
1432            styleOptions[0].stylers.push({
1433              lightness: data.style.lightness,
1434            });
1435          }
1436          if (typeof data.style.saturation != 'undefined') {
1437            styleOptions[0].stylers.push({
1438              saturation: data.style.saturation,
1439            });
1440          }
1441        }
1442
1443        var styledMapOptions = {
1444            name: 'MAP',
1445          },
1446          sampleType = new google.maps.StyledMapType(styleOptions, styledMapOptions);
1447
1448        googleMap.mapTypes.set('sample', sampleType);
1449        googleMap.setMapTypeId('sample');
1450
1451        // force reset
1452        googleMap.setZoom(data.zoom);
1453        googleMap.setCenter(new google.maps.LatLng(data.center.latitude, data.center.longitude));
1454      }
1455      function setMaps(obj, map, center) {
1456        var options = {};
1457
1458        if (obj['html'] !== false) {
1459          if (typeof obj['name'] != 'undefined') options['title'] = obj['name'];
1460          if (typeof obj['desc'] != 'undefined') options['desc'] = obj['desc'];
1461          if (typeof obj['tel'] != 'undefined') options['tel'] = obj['tel'];
1462          if (typeof obj['email'] != 'undefined') options['email'] = obj['email'];
1463          if (typeof obj['url'] != 'undefined') options['web'] = obj['url'];
1464        }
1465
1466        if (typeof obj['logo'] != 'undefined') {
1467          var optIcon = {};
1468
1469          optIcon['url'] = obj['logo'];
1470
1471          if (typeof obj['sizeWidth'] != 'undefined' && typeof obj['sizeHeight'] != 'undefined' && Number.isInteger(obj['sizeWidth']) && Number.isInteger(obj['sizeHeight'])) optIcon['size'] = new google.maps.Size(obj['sizeWidth'], obj['sizeHeight']);
1472
1473          if (typeof obj['scaleWidth'] != 'undefined' && typeof obj['scaleHeight'] != 'undefined' && Number.isInteger(obj['scaleWidth']) && Number.isInteger(obj['scaleHeight'])) optIcon['scaledSize'] = new google.maps.Size(obj['scaleWidth'], obj['scaleHeight']);
1474
1475          if (typeof obj['originX'] != 'undefined' && typeof obj['originY'] != 'undefined' && Number.isInteger(obj['originX']) && Number.isInteger(obj['originY'])) optIcon['origin'] = new google.maps.Point(obj['originX'], obj['originY']);
1476
1477          if (typeof obj['anchorX'] != 'undefined' && typeof obj['anchorY'] != 'undefined' && Number.isInteger(obj['anchorX']) && Number.isInteger(obj['anchorY'])) optIcon['anchor'] = new google.maps.Point(obj['anchorX'], obj['anchorY']);
1478
1479          if (typeof obj['optimized'] != 'undefined') optIcon['optimized'] = obj['optimized'];
1480
1481          if (typeof optIcon['size'] != 'undefined' && typeof optIcon['origin'] != 'undefined' && typeof optIcon['anchor'] != 'undefined') options['icon'] = optIcon;
1482          else options['icon'] = obj['logo'] ? new google.maps.MarkerImage(obj['logo']) : null;
1483        }
1484
1485        options['position'] = new google.maps.LatLng(obj['latitude'], obj['longitude']);
1486        options['map'] = map;
1487
1488        var marker = new google.maps.Marker(options);
1489        gmarkers[gnum] = marker;
1490        gnum++;
1491
1492        if (obj['clickable'] == 'js') {
1493          google.maps.event.addListener(marker, 'click', function () {
1494            if (obj['click'].constructor == Function) obj['click'].apply(this, [].concat(Array.prototype.slice.call(arguments)));
1495          });
1496        }
1497
1498        if (obj['html'] !== false) {
1499          var dialog = new google.maps.InfoWindow(),
1500            infoWindowVisible = (function () {
1501              var currentlyVisible = false;
1502              return function (visible) {
1503                for (var z in visible) {
1504                  if (/closure_uid/i.test(z)) {
1505                    currentlyVisible = visible[z];
1506
1507                    break;
1508                  }
1509                }
1510
1511                return currentlyVisible;
1512
1513                if (visible !== undefined) currentlyVisible = visible;
1514                return currentlyVisible;
1515              };
1516            })(),
1517            dialogShow = (function () {
1518              return function () {
1519                var vCheck = infoWindowVisible(marker);
1520                if (vCheck == _dialogsOpen_) {
1521                  dialog.close();
1522                  _dialogsOpen_ = true;
1523                } else {
1524                  var tpl = {};
1525                  tpl['name'] = typeof obj['name'] != 'undefined' ? obj['name'] : '';
1526                  tpl['desc'] = typeof obj['desc'] != 'undefined' ? obj['desc'] : '';
1527                  tpl['tel'] = typeof obj['tel'] != 'undefined' ? obj['tel'] : '';
1528                  tpl['email'] = typeof obj['email'] != 'undefined' ? obj['email'] : '';
1529                  tpl['url'] = typeof obj['url'] != 'undefined' ? obj['url'] : '';
1530
1531                  var html = obj['html']
1532                    .replace(/{name}/gi, tpl['name'])
1533                    .replace(/{title}/gi, tpl['name'])
1534
1535                    .replace(/{txt}/gi, tpl['desc'])
1536                    .replace(/{text}/gi, tpl['desc'])
1537                    .replace(/{desc}/gi, tpl['desc'])
1538                    .replace(/{description}/gi, tpl['desc'])
1539
1540                    .replace(/{tel}/gi, tpl['tel'])
1541                    .replace(/{telephone}/gi, tpl['tel'])
1542                    .replace(/{phone}/gi, tpl['tel'])
1543                    .replace(/{moible}/gi, tpl['tel'])
1544
1545                    .replace(/{mail}/gi, tpl['email'])
1546                    .replace(/{email}/gi, tpl['email'])
1547
1548                    .replace(/{url}/gi, tpl['url'])
1549                    .replace(/{web}/gi, tpl['url'])
1550                    .replace(/{website}/gi, tpl['url']);
1551
1552                  _dialogs_.forEach(function (d, ix) {
1553                    google.maps.event.trigger(d, 'closeclick');
1554                    d.close(map, marker);
1555                  });
1556
1557                  dialog = new google.maps.InfoWindow({
1558                    content: html,
1559                  });
1560
1561                  // reset
1562                  _dialogs_ = [];
1563                  _dialogs_.push(dialog);
1564
1565                  dialog.open(map, marker);
1566                  _dialogsOpen_ = vCheck;
1567                }
1568              };
1569            })();
1570
1571          // _dialogs_.push(dialog);
1572
1573          // events
1574          google.maps.event.addListener(marker, 'click', function () {
1575            if (obj['clickable'] == 'link' && typeof obj['url'] != 'undefined' && obj['url'] != '') {
1576              if (!isExternal(obj['url']) && $(obj['url']).length) {
1577                $('html, body')
1578                  .stop()
1579                  .animate(
1580                    {
1581                      scrollTop: $(obj['url']).offset().top,
1582                    },
1583                    500,
1584                  );
1585              } else window.open(obj['url'], '_parent');
1586            } else if (obj['clickable'] == 'popup' && isHTML(obj.html)) {
1587              map.panTo(marker.getPosition());
1588              dialogShow();
1589            }
1590          });
1591          google.maps.event.addListener(dialog, 'closeclick', function () {
1592            infoWindowVisible(marker);
1593          });
1594
1595          if (obj['hover'] === true && obj['clickable'] == 'link') {
1596            google.maps.event.addListener(marker, 'mouseover', function () {
1597              dialogShow();
1598            });
1599
1600            google.maps.event.addListener(marker, 'mouseout', function () {
1601              dialog.close();
1602              infoWindowVisible(false);
1603            });
1604          }
1605        }
1606
1607        /*
1608				window.onresize = function(event) {
1609					google.maps.event.trigger(map, "resize");
1610					map.setCenter(new google.maps.LatLng(center.latitude, center.longitude));
1611				};
1612				*/
1613
1614        // always center
1615        google.maps.event.addDomListener(window, 'resize', function () {
1616          var center = map.getCenter();
1617          google.maps.event.trigger(map, 'resize');
1618          // map.setCenter(new google.maps.LatLng(center.latitude, center.longitude));
1619          map.setCenter(center);
1620        });
1621
1622        google.maps.event.addListenerOnce(map, 'idle', function () {
1623          google.maps.event.trigger(map, 'resize');
1624          map.setCenter(new google.maps.LatLng(center.latitude, center.longitude));
1625        });
1626
1627        // google.maps.event.trigger(map, "resize"); // onload
1628
1629        $(window).resize(function () {
1630          google.maps.event.trigger(map, 'resize');
1631        });
1632      }
1633    }
1634    google.maps.event.addDomListener(window, 'load', init);
1635  }
1636  // END: gmap
1637
1638  // BEGIN: rollover button
1639  $('body').on(
1640    {
1641      click: function () {
1642        $(this).parents('.bxSlider-pager').find('img.btn').trigger('mouseout');
1643
1644        if (UA.indexOf('iPad') < 0 && UA.indexOf('iPhone') < 0 && UA.indexOf('iPod') < 0) $(this).trigger('mouseout').trigger('mouseover'); // not iOS
1645      },
1646      touchstart: function () {
1647        $(this).trigger('click');
1648      },
1649      mouseover: function () {
1650        if (UA.indexOf('iPad') < 0 && UA.indexOf('iPhone') < 0 && UA.indexOf('iPod') < 0) {
1651          // not iOS
1652          if (!$(this).data('src-original')) $(this).data('src-original', $(this).attr('src'));
1653
1654          $(this)
1655            .attr('src')
1656            .match(/^(.*)(\.{1}.*)/g);
1657
1658          var $src = RegExp.$1 + '_on' + RegExp.$2;
1659
1660          $(this).attr('src', $src); // update src
1661        }
1662      },
1663      mouseout: function () {
1664        if (UA.indexOf('iPad') < 0 && UA.indexOf('iPhone') < 0 && UA.indexOf('iPod') < 0) {
1665          // not iOS
1666          if ($(this).hasClass('copy-change')) {
1667            var _src_ = $(this).attr('src');
1668
1669            _src_ = _src_.replace(/^(.*?)_on\.(.*)$/, '$1.$2');
1670
1671            $(this)
1672              .attr('src', _src_) // update src
1673              .removeClass('copy-change');
1674          } else if ($(this).data('src-original')) $(this).attr('src', $(this).data('src-original')); // update src
1675
1676          $(this).removeData('src-original');
1677        }
1678      },
1679    },
1680    'img.btn',
1681  );
1682
1683  $('body').on(
1684    {
1685      click: function () {
1686        $(this).parents('.bxSlider-pager').find('picture.btn').trigger('mouseout');
1687
1688        $(this).trigger('mouseout').trigger('mouseover');
1689      },
1690      touchstart: function () {
1691        $(this).trigger('click');
1692      },
1693      mouseover: function () {
1694        $(this)
1695          .children()
1696          .each(function () {
1697            var _attr_ = false;
1698            if ($(this).prop('tagName').toLowerCase() == 'img') _attr_ = 'src';
1699            else if ($(this).prop('tagName').toLowerCase() == 'source') _attr_ = 'srcset';
1700
1701            if (_attr_ && $(this).attr(_attr_)) {
1702              if (!$(this).data('src-original')) $(this).data('src-original', $(this).attr(_attr_));
1703
1704              $(this)
1705                .attr(_attr_)
1706                .match(/^(.*)(\.{1}.*)/g);
1707
1708              var $src = RegExp.$1 + '_on' + RegExp.$2;
1709
1710              $(this).attr(_attr_, $src); // update src
1711            }
1712          });
1713      },
1714      mouseout: function () {
1715        var $picture = $(this);
1716
1717        $picture.children().each(function () {
1718          var _attr_ = false;
1719          if ($(this).prop('tagName').toLowerCase() == 'img') _attr_ = 'src';
1720          else if ($(this).prop('tagName').toLowerCase() == 'source') _attr_ = 'srcset';
1721
1722          if (_attr_ && $(this).attr(_attr_)) {
1723            if ($picture.hasClass('copy-change')) {
1724              var _src_ = $(this).attr(_attr_);
1725
1726              _src_ = _src_.replace(/^(.*?)_on\.(.*)$/, '$1.$2');
1727
1728              $(this)
1729                .attr(_attr_, _src_) // update src
1730                .removeClass('copy-change');
1731            } else if ($(this).data('src-original')) $(this).attr(_attr_, $(this).data('src-original')); // update src
1732
1733            $(this).removeData('src-original');
1734          }
1735        });
1736      },
1737    },
1738    'picture.btn',
1739  );
1740  // END: rollover button
1741
1742  // BEGIN: smooth scroll
1743  // $("body").on("click", "a[href*='#']:not([href='#'])", function(e) {
1744  // $("body").on("click", "a[*|href*='#']:not([href='#'])", function(e) {
1745  $('body').on('click', "a[href*='#']:not([href='#']), a[xlink\\:href*='#']:not([xlink\\:href='#'])", function (e) {
1746    var parseURL = function (url) {
1747        var tag = document.createElement('a');
1748        tag.href = url;
1749
1750        return tag;
1751      },
1752      parser = null;
1753
1754    if ($(this).attr('href')) parser = parseURL($(this).attr('href'));
1755    else if ($(this).attr('xlink:href')) parser = parseURL($(this).attr('xlink:href'));
1756
1757    // .nav-fixed: elm sẽ cố định
1758    // .nav-target: tọa độ sẽ tính
1759    // .nav-pin: elm sẽ gắn .fixed
1760    if (parser && location.pathname.replace(/^\//, '') == parser.pathname.replace(/^\//, '') && location.hostname == parser.hostname && !$(this).hasClass('unsmooth')) {
1761      var _hash_ = this.hash || $(this).attr('href') || $(this).attr('xlink:href'),
1762        ptnHash = /([;?%&,+*~\':"!^$[\]()=>|\/@])/g, // [storage] FCBase.regex.trimHash
1763        trimHash = _hash_.replace(ptnHash, '\\$1'),
1764        $anchor = $(trimHash);
1765
1766      $anchor = $anchor.length > 0 ? $anchor : $('[name=' + trimHash.slice(1) + ']');
1767
1768      if ($anchor.length) {
1769        e.preventDefault();
1770
1771        if ($anchor.parents('.tab-content').first().length > 0) $anchor = $anchor.parents('.tab-content').first();
1772
1773        var $offsetY = $anchor.offset().top,
1774          $navOffset = 0;
1775
1776        if ($('.nav-fixed').length) $navOffset = typeof $('.nav-fixed').attr('data-height') != 'undefined' ? parseInt($('.nav-fixed').attr('data-height')) : $('.nav-fixed').outerHeight();
1777
1778        if ($('.tabs-switch').length) {
1779          $('.tabs-switch').each(function () {
1780            var $tabsSwitch = $(this),
1781              $tabLink = $tabsSwitch.children('.tab-link');
1782
1783            if ($tabLink.children("[data-tab-anchor='" + trimHash + "']").length) $tabLink.children("[data-tab-anchor='" + trimHash + "']").click(); // trigger for set active tab
1784          });
1785        }
1786
1787        if ($('.nav-target').length) {
1788          // $("html, body").stop().animate({
1789          // scrollTop: $(".nav-target").offset().top + 10
1790          // }, 100, function() {
1791          if ($('.nav-fixed').length) $navOffset = typeof $('.nav-fixed').attr('data-height') != 'undefined' ? parseInt($('.nav-fixed').attr('data-height')) : $('.nav-fixed').outerHeight();
1792
1793          $('html, body')
1794            .stop()
1795            .animate(
1796              {
1797                scrollTop: $offsetY - $navOffset + 1,
1798              },
1799              500,
1800            );
1801          // });
1802        } else {
1803          $('html, body')
1804            .stop()
1805            .animate(
1806              {
1807                scrollTop: $offsetY - $navOffset + 1,
1808              },
1809              500,
1810            );
1811        }
1812
1813        if ($('.nav-main').length) {
1814          // $("html, body").stop().animate({
1815          // scrollTop: $(".nav-target").offset().top + 10
1816          // }, 100, function() {
1817          if ($('.nav-g').length) $navOffset = typeof $('.nav-g').attr('data-height') != 'undefined' ? parseInt($('.nav-g').attr('data-height')) : $('.nav-g').outerHeight();
1818          if ($(window).width() < 767) {
1819            $('html, body')
1820              .stop()
1821              .animate(
1822                {
1823                  scrollTop: $offsetY - $navOffset + 1 + $('.nav-g').outerHeight(),
1824                },
1825                500,
1826              );
1827          } else {
1828            $('html, body')
1829              .stop()
1830              .animate(
1831                {
1832                  scrollTop: $offsetY - $navOffset,
1833                },
1834                500,
1835              );
1836          }
1837
1838          // });
1839        } else {
1840          $('html, body')
1841            .stop()
1842            .animate(
1843              {
1844                scrollTop: $offsetY - $navOffset + 1,
1845              },
1846              500,
1847            );
1848        }
1849
1850        // window.location.hash = trimHash; // update location
1851
1852        return false;
1853      } else console.log('[smooth-scroll] Anchor element not found');
1854    }
1855  });
1856  // END: smooth scroll
1857
1858  // BEGIN: scroll to top
1859  if ($(window).scrollTop() > 0) $('#pagetop').addClass('visible');
1860  else $('#pagetop').removeClass('visible');
1861
1862  $('body').on('click', '#pagetop', function () {
1863    if (!$(this).hasClass('in-scroll')) {
1864      $(this).addClass('in-scroll');
1865
1866      var $scrollDuration = $.inArray($(this).attr('data-duration'), ['slow', 'normal', 'fast']) >= 0 || parseInt($(this).attr('data-duration')) > 0 ? $(this).attr('data-duration') : 'slow';
1867
1868      $('html, body')
1869        .stop()
1870        .animate(
1871          {
1872            scrollTop: 0,
1873          },
1874          $scrollDuration,
1875          function () {
1876            $('#pagetop').removeClass('in-scroll');
1877          },
1878        );
1879    }
1880  });
1881  // END: scroll to top
1882
1883  // BEGIN: text vertical
1884  $('.txt-vertical').each(function () {
1885    if (!$(this).hasClass('all-str')) {
1886      var $regex = /(\d{1,2})/g;
1887
1888      if ($(this).hasClass('per-line')) $regex = /(\d)/g;
1889
1890      $(this).html(function (idx, val) {
1891        return val.replace($regex, '<span class="int">$1</span>');
1892      });
1893    }
1894
1895    if ($(this).children('.txt-normal').length) {
1896      $(this)
1897        .children('.txt-normal')
1898        .html(function (idx, val) {
1899          var $characters = $.trim(val).split('');
1900          return '<span class="int">' + $characters.join('</span><span class="int">') + '</span>';
1901        });
1902    }
1903  });
1904  $('.txt-vertical-x').each(function () {
1905    $(this).html($(this).text().replace(/(.)/g, '<span>$1</span>'));
1906  });
1907  // END: text vertical
1908
1909  // BEGIN: social button
1910  $(document).ready(function () {
1911    function reloadLineButton() {
1912      const existingScript = document.querySelector('script[src*="loader.min.js"]');
1913      if (existingScript) {
1914        existingScript.remove();
1915      }
1916
1917      const script = document.createElement('script');
1918      script.src = 'https://www.line-website.com/social-plugins/js/thirdparty/loader.min.js';
1919      script.async = true;
1920      script.defer = true;
1921      script.onload = function () {
1922        window.LineIt.loadButton();
1923      };
1924      document.body.appendChild(script);
1925    }
1926    var loadsns = false;
1927
1928    var __socialsHTML__ = '',
1929      __socialsLang = $('html').attr('lang') !== undefined && $.trim($('html').attr('lang')).length == 2 ? $.trim($('html').attr('lang')).toLowerCase() : 'ja',
1930      $socialsLine = '',
1931      $socialsTwitter = '',
1932      $socialsFacebook = '',
1933      locationURL = window.location.href || location.href;
1934
1935    $socialsTwitter += '<div class="social-twitter">';
1936    $socialsTwitter += '<a href="https://twitter.com/share" class="twitter-share-button">Tweet</a>';
1937    $socialsTwitter += '<script type="text/javascript">!function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0];if(!d.getElementById(id)){js=d.createElement(s);js.id=id;js.src="https://platform.twitter.com/widgets.js";fjs.parentNode.insertBefore(js,fjs);}}(document,"script","twitter-wjs");</script>';
1938    $socialsTwitter += '</div>';
1939
1940    $socialsFacebook += '<div class="social-facebook">';
1941    $socialsFacebook += '<div class="fb-share-button" data-href="' + locationURL + '" data-layout="button_count" data-size="small"></div>';
1942    $socialsFacebook += '</div>';
1943
1944    $socialsLine += '<div class="social-line">';
1945    $socialsLine += '<div class="line-it-button" data-lang="' + __socialsLang + '" data-type="like" data-url="' + locationURL + '" data-share="true">';
1946
1947    $socialsLine += '</div>';
1948    $socialsLine += '</div>';
1949
1950    function CheckForDisplay() {
1951      var element = document.getElementById('socialbuttons');
1952
1953      if (elementInViewport(element) && loadsns == false) {
1954        if ($('#socialbuttons').length) {
1955          var $socialsOrder = typeof $('#socialbuttons').attr('data') != 'undefined' ? $('#socialbuttons').attr('data').split('') : false;
1956
1957          if (typeof $socialsOrder == 'object' && $socialsOrder.length) {
1958            for (var socialsType in $socialsOrder) {
1959              if ($.trim(socialsType).length > 0) {
1960                socialsType = socialsType.toLowerCase();
1961
1962                if ($socialsOrder[socialsType].toLocaleLowerCase() === 'f') __socialsHTML__ += $socialsFacebook;
1963                else if ($socialsOrder[socialsType].toLocaleLowerCase() === 't') __socialsHTML__ += $socialsTwitter;
1964                else if ($socialsOrder[socialsType].toLocaleLowerCase() === 'l') __socialsHTML__ += $socialsLine;
1965              }
1966            }
1967          } else {
1968            __socialsHTML__ += $socialsTwitter;
1969            __socialsHTML__ += $socialsFacebook;
1970            __socialsHTML__ += $socialsLine;
1971          }
1972
1973          $('#socialbuttons').html(__socialsHTML__);
1974          if (typeof window.LineIt !== 'undefined' && window.LineIt.loadButton) {
1975            window.LineIt.loadButton();
1976          }
1977        }
1978
1979        loadsns = true;
1980
1981        // facebook
1982        var fbRoot = document.getElementById('fb-root');
1983        if (fbRoot) {
1984          var fbScript = document.createElement('script'),
1985            fbScriptContent = '',
1986            fbVersion = fbRoot.getAttribute('data-version') ? fbRoot.getAttribute('data-version') : 'v2.12',
1987            fbLanguage = fbRoot.getAttribute('data-language') ? fbRoot.getAttribute('data-language') : 'ja_JP';
1988
1989          fbVersion = fbVersion.substr(0, 1).toLowerCase() == 'v' ? fbVersion.substr(1) : fbVersion;
1990
1991          fbScriptContent += '(function(d, s, id) {';
1992          fbScriptContent += 'var js, fjs = d.getElementsByTagName(s)[0];';
1993          fbScriptContent += 'if (d.getElementById(id)) return;';
1994          fbScriptContent += 'js = d.createElement(s);';
1995          fbScriptContent += 'js.id = id;';
1996          fbScriptContent += 'js.src = "https://connect.facebook.net/' + fbLanguage + '/sdk.js#xfbml=1&version=v' + fbVersion + '";';
1997          fbScriptContent += 'fjs.parentNode.insertBefore(js, fjs);';
1998          fbScriptContent += '}(document, "script", "facebook-jssdk"));';
1999
2000          fbScript.innerHTML = fbScriptContent;
2001          document.body.appendChild(fbScript);
2002        }
2003
2004        const lineButton = document.querySelector('.line-it-button');
2005        const observer = new IntersectionObserver((entries) => {
2006          entries.forEach((entry) => {
2007            if (entry.isIntersecting) {
2008              reloadLineButton();
2009              observer.unobserve(lineButton);
2010            }
2011          });
2012        });
2013
2014        observer.observe(lineButton);
2015      }
2016    }
2017
2018    function elementInViewport(el) {
2019      if (!el) return false;
2020      var rect = el.getBoundingClientRect();
2021      return rect.top >= 0 && rect.left >= 0 && rect.bottom <= window.innerHeight && rect.right <= window.innerWidth;
2022    }
2023    $(window).on('resize', CheckForDisplay).on('scroll', CheckForDisplay);
2024  });
2025  // END: social button
2026
2027  /* fix smoothscroll on IE - jumpy fixed background */
2028  if (navigator.userAgent.match(/MSIE 10/i) || navigator.userAgent.match(/Trident\/7\./) || navigator.userAgent.match(/Edge\/12\./)) {
2029    $('.ie-smoothscroll').on('mousewheel', function (e) {
2030      if (event.preventDefault) event.preventDefault();
2031      else event.returnValue = false;
2032
2033      var delta = null,
2034        offsetX = window.scrollX || window.pageXOffset || window.document.documentElement.scrollLeft,
2035        offsetY = window.scrollY || window.pageYOffset || window.document.documentElement.scrollTop;
2036
2037      if (e.wheelDelta) delta = e.wheelDelta;
2038      else if (e.originalEvent) {
2039        if (e.originalEvent.wheelDelta) delta = e.originalEvent.wheelDelta;
2040        else if (e.originalEvent.deltaY) delta = 0 - e.originalEvent.deltaY;
2041        else if (e.originalEvent.detail) delta = e.originalEvent.detail * -40;
2042      } else if (event.originalEvent) {
2043        if (event.originalEvent.wheelDelta) delta = event.originalEvent.wheelDelta;
2044        else if (event.originalEvent.deltaY) delta = 0 - event.originalEvent.deltaY;
2045        else if (event.originalEvent.detail) delta = event.originalEvent.detail * -40;
2046      }
2047
2048      if (delta !== null) window.scrollTo(0, offsetY - delta);
2049    });
2050  }
2051
2052  // scrollBefore(); // smoothscroll before page loaded
2053
2054  $('body').on(
2055    {
2056      mouseup: function () {
2057        // $("html").addClass("break-jump");
2058        $(this).removeClass('scrollable');
2059      },
2060      mousedown: function () {
2061        // $("html").addClass("break-jump");
2062        $(this).addClass('scrollable');
2063      },
2064      mouseleave: function () {
2065        // $("html").addClass("break-jump");
2066        $(this).removeClass('scrollable');
2067      },
2068    },
2069    '.gmap',
2070  );
2071
2072  // BEGIN: .pagination
2073  $('.pagination').each(function () {
2074    initPager($(this));
2075  });
2076
2077  $('.pagination')
2078    .on('click', '.page-link .page-first', function () {
2079      var $pagination = $(this).parents('.pagination').first(),
2080        $pageContent = $pagination.children('.page-content'),
2081        $pageLink = $pagination.children('.page-link'),
2082        mode = $pagination.attr('data-mode') !== 'undefined' && $.inArray($pagination.attr('data-mode'), ['fade', 'slide', 'block']) >
2082= 0 ? $pagination.attr('data-mode') : 'block',
2083        duration = typeof $pagination.attr('data-duration') !== 'undefined' && $pagination.attr('data-duration').length > 0 ? parseInt($pagination.attr('data-duration'), 10) : mode == 'block' ? 0 : 300,
2084        scrollable = typeof $pagination.attr('data-scroll') !== 'undefined' && $.inArray($pagination.attr('data-scroll'), ['true', 'on', 'enable', 'enabled', '1']) >= 0 ? true : false,
2085        navOffset = 0;
2086
2087      if (!$pagination.hasClass('clicked')) {
2088        $pagination.addClass('clicked');
2089
2090        if ($('.nav-fixed').length > 0) navOffset = typeof $('.nav-fixed').attr('data-height') != 'undefined' ? parseInt($('.nav-fixed').attr('data-height')) : $('.nav-fixed').outerHeight();
2091
2092        if (mode == 'fade') {
2093          if ($pageContent.children().length > 1) {
2094            $pageContent
2095              .children()
2096              .stop()
2097              .fadeOut(duration, function () {
2098                $(this).removeAttr('style').removeClass('active');
2099              })
2100              .siblings()
2101              .first()
2102              .stop()
2103              .delay(duration)
2104              .fadeIn(duration, function () {
2105                $(this).removeAttr('style').addClass('active');
2106
2107                if (scrollable) {
2108                  $('body, html')
2109                    .stop()
2110                    .animate(
2111                      {
2112                        scrollTop: $pagination.offset().top - navOffset,
2113                      },
2114                      300,
2115                    );
2116                }
2117
2118                $pagination.removeClass('clicked');
2119              });
2120          } else {
2121            $pageContent
2122              .children()
2123              .first()
2124              .stop()
2125              .fadeIn(duration, function () {
2126                $(this).removeAttr('style').addClass('active');
2127
2128                if (scrollable) {
2129                  $('body, html')
2130                    .stop()
2131                    .animate(
2132                      {
2133                        scrollTop: $pagination.offset().top - navOffset,
2134                      },
2135                      300,
2136                    );
2137                }
2138
2139                $pagination.removeClass('clicked');
2140              });
2141          }
2142        } else if (mode == 'slide') {
2143          if ($pageContent.children().length > 1) {
2144            $pageContent
2145              .children()
2146              .stop()
2147              .slideUp(duration, function () {
2148                $(this).removeAttr('style').removeClass('active');
2149              })
2150              .siblings()
2151              .first()
2152              .stop()
2153              .delay(duration)
2154              .slideDown(duration, function () {
2155                $(this).removeAttr('style').addClass('active');
2156
2157                if (scrollable) {
2158                  $('body, html')
2159                    .stop()
2160                    .animate(
2161                      {
2162                        scrollTop: $pagination.offset().top - navOffset,
2163                      },
2164                      300,
2165                    );
2166                }
2167
2168                $pagination.removeClass('clicked');
2169              });
2170          } else {
2171            $pageContent
2172              .children()
2173              .first()
2174              .stop()
2175              .slideDown(duration, function () {
2176                $(this).removeAttr('style').addClass('active');
2177
2178                if (scrollable) {
2179                  $('body, html')
2180                    .stop()
2181                    .animate(
2182                      {
2183                        scrollTop: $pagination.offset().top - navOffset,
2184                      },
2185                      300,
2186                    );
2187                }
2188
2189                $pagination.removeClass('clicked');
2190              });
2191          }
2192        } else {
2193          if ($pageContent.children().length > 1) {
2194            $pageContent
2195              .children()
2196              .stop()
2197              .hide(duration, function () {
2198                $(this).removeAttr('style').removeClass('active');
2199              })
2200              .siblings()
2201              .first()
2202              .stop()
2203              .delay(duration)
2204              .show(duration, function () {
2205                $(this).removeAttr('style').addClass('active');
2206
2207                if (scrollable) {
2208                  $('body, html')
2209                    .stop()
2210                    .animate(
2211                      {
2212                        scrollTop: $pagination.offset().top - navOffset,
2213                      },
2214                      300,
2215                    );
2216                }
2217
2218                $pagination.removeClass('clicked');
2219              });
2220          } else {
2221            $pageContent
2222              .children()
2223              .first()
2224              .stop()
2225              .show(duration, function () {
2226                $(this).removeAttr('style').addClass('active');
2227
2228                if (scrollable) {
2229                  $('body, html')
2230                    .stop()
2231                    .animate(
2232                      {
2233                        scrollTop: $pagination.offset().top - navOffset,
2234                      },
2235                      300,
2236                    );
2237                }
2238
2239                $pagination.removeClass('clicked');
2240              });
2241          }
2242        }
2243
2244        $pageLink.find('.page-item.active').removeClass('active');
2245        $pageLink.each(function () {
2246          $(this).find('.page-item').first().addClass('active');
2247        });
2248      }
2249    })
2250    .on('click', '.page-link .page-last', function () {
2251      var $pagination = $(this).parents('.pagination').first(),
2252        $pageContent = $pagination.children('.page-content'),
2253        $pageLink = $pagination.children('.page-link'),
2254        mode = $pagination.attr('data-mode') !== 'undefined' && $.inArray($pagination.attr('data-mode'), ['fade', 'slide', 'block']) >
2254= 0 ? $pagination.attr('data-mode') : 'block',
2255        duration = typeof $pagination.attr('data-duration') !== 'undefined' && $pagination.attr('data-duration').length > 0 ? parseInt($pagination.attr('data-duration'), 10) : mode == 'block' ? 0 : 300,
2256        scrollable = typeof $pagination.attr('data-scroll') !== 'undefined' && $.inArray($pagination.attr('data-scroll'), ['true', 'on', 'enable', 'enabled', '1']) >= 0 ? true : false,
2257        navOffset = 0;
2258
2259      if (!$pagination.hasClass('clicked')) {
2260        $pagination.addClass('clicked');
2261
2262        if ($('.nav-fixed').length > 0) navOffset = typeof $('.nav-fixed').attr('data-height') != 'undefined' ? parseInt($('.nav-fixed').attr('data-height')) : $('.nav-fixed').outerHeight();
2263
2264        if (mode == 'fade') {
2265          if ($pageContent.children().length > 1) {
2266            $pageContent
2267              .children()
2268              .stop()
2269              .fadeOut(duration, function () {
2270                $(this).removeAttr('style').removeClass('active');
2271              })
2272              .siblings()
2273              .last()
2274              .stop()
2275              .delay(duration)
2276              .fadeIn(duration, function () {
2277                $(this).removeAttr('style').addClass('active');
2278
2279                if (scrollable) {
2280                  $('body, html')
2281                    .stop()
2282                    .animate(
2283                      {
2284                        scrollTop: $pagination.offset().top - navOffset,
2285                      },
2286                      300,
2287                    );
2288                }
2289
2290                $pagination.removeClass('clicked');
2291              });
2292          } else {
2293            $pageContent
2294              .children()
2295              .last()
2296              .stop()
2297              .fadeIn(duration, function () {
2298                $(this).removeAttr('style').addClass('active');
2299
2300                if (scrollable) {
2301                  $('body, html')
2302                    .stop()
2303                    .animate(
2304                      {
2305                        scrollTop: $pagination.offset().top - navOffset,
2306                      },
2307                      300,
2308                    );
2309                }
2310
2311                $pagination.removeClass('clicked');
2312              });
2313          }
2314        } else if (mode == 'slide') {
2315          if ($pageContent.children().length > 1) {
2316            $pageContent
2317              .children()
2318              .stop()
2319              .slideUp(duration, function () {
2320                $(this).removeAttr('style').removeClass('active');
2321              })
2322              .siblings()
2323              .last()
2324              .stop()
2325              .delay(duration)
2326              .slideDown(duration, function () {
2327                $(this).removeAttr('style').addClass('active');
2328
2329                if (scrollable) {
2330                  $('body, html')
2331                    .stop()
2332                    .animate(
2333                      {
2334                        scrollTop: $pagination.offset().top - navOffset,
2335                      },
2336                      300,
2337                    );
2338                }
2339
2340                $pagination.removeClass('clicked');
2341              });
2342          } else {
2343            $pageContent
2344              .children()
2345              .last()
2346              .stop()
2347              .slideDown(duration, function () {
2348                $(this).removeAttr('style').addClass('active');
2349
2350                if (scrollable) {
2351                  $('body, html')
2352                    .stop()
2353                    .animate(
2354                      {
2355                        scrollTop: $pagination.offset().top - navOffset,
2356                      },
2357                      300,
2358                    );
2359                }
2360
2361                $pagination.removeClass('clicked');
2362              });
2363          }
2364        } else {
2365          if ($pageContent.children().length > 1) {
2366            $pageContent
2367              .children()
2368              .stop()
2369              .hide(duration, function () {
2370                $(this).removeAttr('style').removeClass('active');
2371              })
2372              .siblings()
2373              .last()
2374              .stop()
2375              .delay(duration)
2376              .show(duration, function () {
2377                $(this).removeAttr('style').addClass('active');
2378
2379                if (scrollable) {
2380                  $('body, html')
2381                    .stop()
2382                    .animate(
2383                      {
2384                        scrollTop: $pagination.offset().top - navOffset,
2385                      },
2386                      300,
2387                    );
2388                }
2389
2390                $pagination.removeClass('clicked');
2391              });
2392          } else {
2393            $pageContent
2394              .children()
2395              .last()
2396              .stop()
2397              .show(duration, function () {
2398                $(this).removeAttr('style').addClass('active');
2399
2400                if (scrollable) {
2401                  $('body, html')
2402                    .stop()
2403                    .animate(
2404                      {
2405                        scrollTop: $pagination.offset().top - navOffset,
2406                      },
2407                      300,
2408                    );
2409                }
2410
2411                $pagination.removeClass('clicked');
2412              });
2413          }
2414        }
2415
2416        $pageLink.find('.page-item.active').removeClass('active');
2417        $pageLink.each(function () {
2418          $(this).find('.page-item').last().addClass('active');
2419        });
2420      }
2421    })
2422    .on('click', '.page-link .page-next', function () {
2423      var $pagination = $(this).parents('.pagination').first(),
2424        navOffset = 0;
2425
2426      if (!$pagination.hasClass('clicked')) {
2427        $pagination.addClass('clicked');
2428
2429        if ($('.nav-fixed').length > 0) navOffset = typeof $('.nav-fixed').attr('data-height') != 'undefined' ? parseInt($('.nav-fixed').attr('data-height')) : $('.nav-fixed').outerHeight();
2430
2431        var $pageContent = $pagination.children('.page-content'),
2432          $pageLink = $pagination.children('.page-link'),
2433          mode = $pagination.attr('data-mode') !== 'undefined' && $.inArray($pagination.attr('data-mode'), ['fade', 'slide', 'block']) >= 0 ? $pagination.attr('data-mode') : 'block',
2434          duration = typeof $pagination.attr('data-duration') !== 'undefined' && $pagination.attr('data-duration').length > 0 ? parseInt($pagination.attr('data-duration'), 10) : mode == 'block' ? 0 : 300,
2435          scrollable = typeof $pagination.attr('data-scroll') !== 'undefined' && $.inArray($pagination.attr('data-scroll'), ['true', 'on', 'enable', 'enabled', '1']) >= 0 ? true : false,
2436          $pageCurrent = $pageLink.find('.page-item.active'),
2437          $pageClone = $pageLink.clone(),
2438          idx = 0;
2439
2440        $pageClone.find('.page-first, .page-last, .page-next, .page-prev, .page-ellipse').remove();
2441
2442        idx = $pageClone.find('.page-item.active').index();
2443
2444        $pageLink.find('.page-item.active').removeClass('active');
2445
2446        if ($pageClone.find('.page-item.active').next('.page-item').length > 0) {
2447          if (mode == 'fade') {
2448            if ($pageContent.children().length > 1) {
2449              $pageContent
2450                .children()
2451                .stop()
2452                .fadeOut(duration, function () {
2453                  $(this).removeAttr('style').removeClass('active');
2454                })
2455                .siblings()
2456                .eq(idx + 1)
2457                .stop()
2458                .delay(duration)
2459                .fadeIn(duration, function () {
2460                  $(this).removeAttr('style').addClass('active');
2461
2462                  if (scrollable) {
2463                    $('body, html')
2464                      .stop()
2465                      .animate(
2466                        {
2467                          scrollTop: $pagination.offset().top - navOffset,
2468                        },
2469                        300,
2470                      );
2471                  }
2472
2473                  $pagination.removeClass('clicked');
2474                });
2475            } else {
2476              $pageContent
2477                .children()
2478                .eq(idx + 1)
2479                .stop()
2480                .fadeIn(duration, function () {
2481                  $(this).removeAttr('style').addClass('active');
2482
2483                  if (scrollable) {
2484                    $('body, html')
2485                      .stop()
2486                      .animate(
2487                        {
2488                          scrollTop: $pagination.offset().top - navOffset,
2489                        },
2490                        300,
2491                      );
2492                  }
2493
2494                  $pagination.removeClass('clicked');
2495                });
2496            }
2497          } else if (mode == 'slide') {
2498            if ($pageContent.children().length > 1) {
2499              $pageContent
2500                .children()
2501                .stop()
2502                .slideUp(duration, function () {
2503                  $(this).removeAttr('style').removeClass('active');
2504                })
2505                .siblings()
2506                .eq(idx + 1)
2507                .stop()
2508                .delay(duration)
2509                .slideDown(duration, function () {
2510                  $(this).removeAttr('style').addClass('active');
2511
2512                  if (scrollable) {
2513                    $('body, html')
2514                      .stop()
2515                      .animate(
2516                        {
2517                          scrollTop: $pagination.offset().top - navOffset,
2518                        },
2519                        300,
2520                      );
2521                  }
2522
2523                  $pagination.removeClass('clicked');
2524                });
2525            } else {
2526              $pageContent
2527                .children()
2528                .eq(idx + 1)
2529                .stop()
2530                .slideDown(duration, function () {
2531                  $(this).removeAttr('style').addClass('active');
2532
2533                  if (scrollable) {
2534                    $('body, html')
2535                      .stop()
2536                      .animate(
2537                        {
2538                          scrollTop: $pagination.offset().top - navOffset,
2539                        },
2540                        300,
2541                      );
2542                  }
2543
2544                  $pagination.removeClass('clicked');
2545                });
2546            }
2547          } else {
2548            if ($pageContent.children().length > 1) {
2549              $pageContent
2550                .children()
2551                .stop()
2552                .hide(duration, function () {
2553                  $(this).removeAttr('style').removeClass('active');
2554                })
2555                .siblings()
2556                .eq(idx + 1)
2557                .stop()
2558                .delay(duration)
2559                .show(duration, function () {
2560                  $(this).removeAttr('style').addClass('active');
2561
2562                  if (scrollable) {
2563                    $('body, html')
2564                      .stop()
2565                      .animate(
2566                        {
2567                          scrollTop: $pagination.offset().top - navOffset,
2568                        },
2569                        300,
2570                      );
2571                  }
2572
2573                  $pagination.removeClass('clicked');
2574                });
2575            } else {
2576              $pageContent
2577                .children()
2578                .eq(idx + 1)
2579                .stop()
2580                .show(duration, function () {
2581                  $(this).removeAttr('style').addClass('active');
2582
2583                  if (scrollable) {
2584                    $('body, html')
2585                      .stop()
2586                      .animate(
2587                        {
2588                          scrollTop: $pagination.offset().top - navOffset,
2589                        },
2590                        300,
2591                      );
2592                  }
2593
2594                  $pagination.removeClass('clicked');
2595                });
2596            }
2597          }
2598
2599          $pageCurrent.next('.page-item').addClass('active');
2600        } else {
2601          if (mode == 'fade') {
2602            if ($pageContent.children().length > 1) {
2603              $pageContent
2604                .children()
2605                .stop()
2606                .fadeOut(duration, function () {
2607                  $(this).removeAttr('style').removeClass('active');
2608                })
2609                .siblings()
2610                .first()
2611                .stop()
2612                .delay(duration)
2613                .fadeIn(duration, function () {
2614                  $(this).removeAttr('style').addClass('active');
2615
2616                  if (scrollable) {
2617                    $('body, html')
2618                      .stop()
2619                      .animate(
2620                        {
2621                          scrollTop: $pagination.offset().top - navOffset,
2622                        },
2623                        300,
2624                      );
2625                  }
2626
2627                  $pagination.removeClass('clicked');
2628                });
2629            } else {
2630              $pageContent
2631                .children()
2632                .first()
2633                .stop()
2634                .fadeIn(duration, function () {
2635                  $(this).removeAttr('style').addClass('active');
2636
2637                  if (scrollable) {
2638                    $('body, html')
2639                      .stop()
2640                      .animate(
2641                        {
2642                          scrollTop: $pagination.offset().top - navOffset,
2643                        },
2644                        300,
2645                      );
2646                  }
2647
2648                  $pagination.removeClass('clicked');
2649                });
2650            }
2651          } else if (mode == 'slide') {
2652            if ($pageContent.children().length > 1) {
2653              $pageContent
2654                .children()
2655                .stop()
2656                .slideUp(duration, function () {
2657                  $(this).removeAttr('style').removeClass('active');
2658                })
2659                .siblings()
2660                .first()
2661                .stop()
2662                .delay(duration)
2663                .slideDown(duration, function () {
2664                  $(this).removeAttr('style').addClass('active');
2665
2666                  if (scrollable) {
2667                    $('body, html')
2668                      .stop()
2669                      .animate(
2670                        {
2671                          scrollTop: $pagination.offset().top - navOffset,
2672                        },
2673                        300,
2674                      );
2675                  }
2676
2677                  $pagination.removeClass('clicked');
2678                });
2679            } else {
2680              $pageContent
2681                .children()
2682                .first()
2683                .stop()
2684                .slideDown(duration, function () {
2685                  $(this).removeAttr('style').addClass('active');
2686
2687                  if (scrollable) {
2688                    $('body, html')
2689                      .stop()
2690                      .animate(
2691                        {
2692                          scrollTop: $pagination.offset().top - navOffset,
2693                        },
2694                        300,
2695                      );
2696                  }
2697
2698                  $pagination.removeClass('clicked');
2699                });
2700            }
2701          } else {
2702            if ($pageContent.children().length > 1) {
2703              $pageContent
2704                .children()
2705                .stop()
2706                .hide(duration, function () {
2707                  $(this).removeAttr('style').removeClass('active');
2708                })
2709                .siblings()
2710                .first()
2711                .stop()
2712                .delay(duration)
2713                .show(duration, function () {
2714                  $(this).removeAttr('style').addClass('active');
2715
2716                  if (scrollable) {
2717                    $('body, html')
2718                      .stop()
2719                      .animate(
2720                        {
2721                          scrollTop: $pagination.offset().top - navOffset,
2722                        },
2723                        300,
2724                      );
2725                  }
2726
2727                  $pagination.removeClass('clicked');
2728                });
2729            } else {
2730              $pageContent
2731                .children()
2732                .first()
2733                .stop()
2734                .show(duration, function () {
2735                  $(this).removeAttr('style').addClass('active');
2736
2737                  if (scrollable) {
2738                    $('body, html')
2739                      .stop()
2740                      .animate(
2741                        {
2742                          scrollTop: $pagination.offset().top - navOffset,
2743                        },
2744                        300,
2745                      );
2746                  }
2747
2748                  $pagination.removeClass('clicked');
2749                });
2750            }
2751          }
2752
2753          $pageLink.each(function () {
2754            $(this).find('.page-item').first().addClass('active');
2755          });
2756        }
2757      }
2758    })
2759    .on('click', '.page-link .page-prev', function () {
2760      var $pagination = $(this).parents('.pagination').first(),
2761        navOffset = 0;
2762
2763      if (!$pagination.hasClass('clicked')) {
2764        $pagination.addClass('clicked');
2765
2766        if ($('.nav-fixed').length > 0) navOffset = typeof $('.nav-fixed').attr('data-height') != 'undefined' ? parseInt($('.nav-fixed').attr('data-height')) : $('.nav-fixed').outerHeight();
2767
2768        var $pageContent = $pagination.children('.page-content'),
2769          $pageLink = $pagination.children('.page-link'),
2770          mode = $pagination.attr('data-mode') !== 'undefined' && $.inArray($pagination.attr('data-mode'), ['fade', 'slide', 'block']) >= 0 ? $pagination.attr('data-mode') : 'block',
2771          duration = typeof $pagination.attr('data-duration') !== 'undefined' && $pagination.attr('data-duration').length > 0 ? parseInt($pagination.attr('data-duration'), 10) : mode == 'block' ? 0 : 300,
2772          scrollable = typeof $pagination.attr('data-scroll') !== 'undefined' && $.inArray($pagination.attr('data-scroll'), ['true', 'on', 'enable', 'enabled', '1']) >= 0 ? true : false,
2773          $pageCurrent = $pageLink.find('.page-item.active'),
2774          $pageClone = $pageLink.clone(),
2775          idx = 0;
2776
2777        $pageClone.find('.page-first, .page-last, .page-next, .page-prev, .page-ellipse').remove();
2778
2779        idx = $pageClone.find('.page-item.active').index();
2780
2781        $pageLink.find('.page-item.active').removeClass('active');
2782
2783        if ($pageClone.find('.page-item.active').prev('.page-item').length > 0) {
2784          if (mode == 'fade') {
2785            if ($pageContent.children().length > 1) {
2786              $pageContent
2787                .children()
2788                .stop()
2789                .fadeOut(duration, function () {
2790                  $(this).removeAttr('style').removeClass('active');
2791                })
2792                .siblings()
2793                .eq(idx - 1)
2794                .stop()
2795                .delay(duration)
2796                .fadeIn(duration, function () {
2797                  $(this).removeAttr('style').addClass('active');
2798
2799                  if (scrollable) {
2800                    $('body, html')
2801                      .stop()
2802                      .animate(
2803                        {
2804                          scrollTop: $pagination.offset().top - navOffset,
2805                        },
2806                        300,
2807                      );
2808                  }
2809
2810                  $pagination.removeClass('clicked');
2811                });
2812            } else {
2813              $pageContent
2814                .children()
2815                .eq(idx - 1)
2816                .stop()
2817                .fadeIn(duration, function () {
2818                  $(this).removeAttr('style').addClass('active');
2819
2820                  if (scrollable) {
2821                    $('body, html')
2822                      .stop()
2823                      .animate(
2824                        {
2825                          scrollTop: $pagination.offset().top - navOffset,
2826                        },
2827                        300,
2828                      );
2829                  }
2830
2831                  $pagination.removeClass('clicked');
2832                });
2833            }
2834          } else if (mode == 'slide') {
2835            if ($pageContent.children().length > 1) {
2836              $pageContent
2837                .children()
2838                .stop()
2839                .slideUp(duration, function () {
2840                  $(this).removeAttr('style').removeClass('active');
2841                })
2842                .siblings()
2843                .eq(idx - 1)
2844                .stop()
2845                .delay(duration)
2846                .slideDown(duration, function () {
2847                  $(this).removeAttr('style').addClass('active');
2848
2849                  if (scrollable) {
2850                    $('body, html')
2851                      .stop()
2852                      .animate(
2853                        {
2854                          scrollTop: $pagination.offset().top - navOffset,
2855                        },
2856                        300,
2857                      );
2858                  }
2859
2860                  $pagination.removeClass('clicked');
2861                });
2862            } else {
2863              $pageContent
2864                .children()
2865                .eq(idx - 1)
2866                .stop()
2867                .slideDown(duration, function () {
2868                  $(this).removeAttr('style').addClass('active');
2869
2870                  if (scrollable) {
2871                    $('body, html')
2872                      .stop()
2873                      .animate(
2874                        {
2875                          scrollTop: $pagination.offset().top - navOffset,
2876                        },
2877                        300,
2878                      );
2879                  }
2880
2881                  $pagination.removeClass('clicked');
2882                });
2883            }
2884          } else {
2885            if ($pageContent.children().length > 1) {
2886              $pageContent
2887                .children()
2888                .stop()
2889                .hide(duration, function () {
2890                  $(this).removeAttr('style').removeClass('active');
2891                })
2892                .siblings()
2893                .eq(idx - 1)
2894                .stop()
2895                .delay(duration)
2896                .show(duration, function () {
2897                  $(this).removeAttr('style').addClass('active');
2898
2899                  if (scrollable) {
2900                    $('body, html')
2901                      .stop()
2902                      .animate(
2903                        {
2904                          scrollTop: $pagination.offset().top - navOffset,
2905                        },
2906                        300,
2907                      );
2908                  }
2909
2910                  $pagination.removeClass('clicked');
2911                });
2912            } else {
2913              $pageContent
2914                .children()
2915                .eq(idx - 1)
2916                .stop()
2917                .show(duration, function () {
2918                  $(this).removeAttr('style').addClass('active');
2919
2920                  if (scrollable) {
2921                    $('body, html')
2922                      .stop()
2923                      .animate(
2924                        {
2925                          scrollTop: $pagination.offset().top - navOffset,
2926                        },
2927                        300,
2928                      );
2929                  }
2930
2931                  $pagination.removeClass('clicked');
2932                });
2933            }
2934          }
2935
2936          $pageCurrent.prev('.page-item').addClass('active');
2937        } else {
2938          if (mode == 'fade') {
2939            if ($pageContent.children().length > 1) {
2940              $pageContent
2941                .children()
2942                .stop()
2943                .fadeOut(duration, function () {
2944                  $(this).removeAttr('style').removeClass('active');
2945                })
2946                .siblings()
2947                .last()
2948                .stop()
2949                .delay(duration)
2950                .fadeIn(duration, function () {
2951                  $(this).removeAttr('style').addClass('active');
2952
2953                  if (scrollable) {
2954                    $('body, html')
2955                      .stop()
2956                      .animate(
2957                        {
2958                          scrollTop: $pagination.offset().top - navOffset,
2959                        },
2960                        300,
2961                      );
2962                  }
2963
2964                  $pagination.removeClass('clicked');
2965                });
2966            } else {
2967              $pageContent
2968                .children()
2969                .last()
2970                .stop()
2971                .fadeIn(duration, function () {
2972                  $(this).removeAttr('style').addClass('active');
2973
2974                  if (scrollable) {
2975                    $('body, html')
2976                      .stop()
2977                      .animate(
2978                        {
2979                          scrollTop: $pagination.offset().top - navOffset,
2980                        },
2981                        300,
2982                      );
2983                  }
2984
2985                  $pagination.removeClass('clicked');
2986                });
2987            }
2988          } else if (mode == 'slide') {
2989            if ($pageContent.children().length > 1) {
2990              $pageContent
2991                .children()
2992                .stop()
2993                .slideUp(duration, function () {
2994                  $(this).removeAttr('style').removeClass('active');
2995                })
2996                .siblings()
2997                .last()
2998                .stop()
2999                .delay(duration)
3000                .slideDown(duration, function () {
3001                  $(this).removeAttr('style').addClass('active');
3002
3003                  if (scrollable) {
3004                    $('body, html')
3005                      .stop()
3006                      .animate(
3007                        {
3008                          scrollTop: $pagination.offset().top - navOffset,
3009                        },
3010                        300,
3011                      );
3012                  }
3013
3014                  $pagination.removeClass('clicked');
3015                });
3016            } else {
3017              $pageContent
3018                .children()
3019                .last()
3020                .stop()
3021                .slideDown(duration, function () {
3022                  $(this).removeAttr('style').addClass('active');
3023
3024                  if (scrollable) {
3025                    $('body, html')
3026                      .stop()
3027                      .animate(
3028                        {
3029                          scrollTop: $pagination.offset().top - navOffset,
3030                        },
3031                        300,
3032                      );
3033                  }
3034
3035                  $pagination.removeClass('clicked');
3036                });
3037            }
3038          } else {
3039            if ($pageContent.children().length > 1) {
3040              $pageContent
3041                .children()
3042                .stop()
3043                .hide(duration, function () {
3044                  $(this).removeAttr('style').removeClass('active');
3045                })
3046                .siblings()
3047                .last()
3048                .stop()
3049                .delay(duration)
3050                .show(duration, function () {
3051                  $(this).removeAttr('style').addClass('active');
3052
3053                  if (scrollable) {
3054                    $('body, html')
3055                      .stop()
3056                      .animate(
3057                        {
3058                          scrollTop: $pagination.offset().top - navOffset,
3059                        },
3060                        300,
3061                      );
3062                  }
3063
3064                  $pagination.removeClass('clicked');
3065                });
3066            } else {
3067              $pageContent
3068                .children()
3069                .last()
3070                .stop()
3071                .show(duration, function () {
3072                  $(this).removeAttr('style').addClass('active');
3073
3074                  if (scrollable) {
3075                    $('body, html')
3076                      .stop()
3077                      .animate(
3078                        {
3079                          scrollTop: $pagination.offset().top - navOffset,
3080                        },
3081                        300,
3082                      );
3083                  }
3084
3085                  $pagination.removeClass('clicked');
3086                });
3087            }
3088          }
3089
3090          $pageLink.each(function () {
3091            $(this).find('.page-item').last().addClass('active');
3092          });
3093        }
3094      }
3095    })
3096    .on('click', '.page-link .page-item', function () {
3097      var $pagination = $(this).parents('.pagination').first(),
3098        navOffset = 0;
3099
3100      if (!$pagination.hasClass('clicked')) {
3101        $pagination.addClass('clicked');
3102
3103        if ($('.nav-fixed').length > 0) navOffset = typeof $('.nav-fixed').attr('data-height') != 'undefined' ? parseInt($('.nav-fixed').attr('data-height')) : $('.nav-fixed').outerHeight();
3104
3105        $(this).addClass('current');
3106
3107        var $pageContent = $pagination.children('.page-content'),
3108          mode = $pagination.attr('data-mode') !== 'undefined' && $.inArray($pagination.attr('data-mode'), ['fade', 'slide', 'block']) >= 0 ? $pagination.attr('data-mode') : 'block',
3109          duration = typeof $pagination.attr('data-duration') !== 'undefined' && $pagination.attr('data-duration').length > 0 ? parseInt($pagination.attr('data-duration'), 10) : mode == 'block' ? 0 : 300,
3110          scrollable = typeof $pagination.attr('data-scroll') !== 'undefined' && $.inArray($pagination.attr('data-scroll'), ['true', 'on', 'enable', 'enabled', '1']) >= 0 ? true : false,
3111          $pageClone = $pagination.children('.page-link').find('.page-item.current').parents('.page-link').first().clone(),
3112          idx = 0;
3113
3114        $pageClone.find('.page-first, .page-last, .page-next, .page-prev, .page-ellipse').remove();
3115
3116        idx = $pageClone.find('.page-item.current').index();
3117
3118        if (mode == 'fade') {
3119          if ($pageContent.children().length > 1) {
3120            $pageContent
3121              .children()
3122              .stop()
3123              .fadeOut(duration, function () {
3124                $(this).removeAttr('style').removeClass('active');
3125              })
3126              .siblings()
3127              .eq(idx)
3128              .stop()
3129              .delay(duration)
3130              .fadeIn(duration, function () {
3131                $(this).removeAttr('style').addClass('active');
3132
3133                if (scrollable) {
3134                  $('body, html')
3135                    .stop()
3136                    .animate(
3137                      {
3138                        scrollTop: $pagination.offset().top - navOffset,
3139                      },
3140                      300,
3141                    );
3142                }
3143
3144                $pagination.removeClass('clicked');
3145              });
3146          } else {
3147            $pageContent
3148              .children()
3149              .eq(idx)
3150              .stop()
3151              .fadeIn(duration, function () {
3152                $(this).removeAttr('style').addClass('active');
3153
3154                if (scrollable) {
3155                  $('body, html')
3156                    .stop()
3157                    .animate(
3158                      {
3159                        scrollTop: $pagination.offset().top - navOffset,
3160                      },
3161                      300,
3162                    );
3163                }
3164
3165                $pagination.removeClass('clicked');
3166              });
3167          }
3168        } else if (mode == 'slide') {
3169          if ($pageContent.children().length > 1) {
3170            $pageContent
3171              .children()
3172              .stop()
3173              .slideUp(duration, function () {
3174                $(this).removeAttr('style').removeClass('active');
3175              })
3176              .siblings()
3177              .eq(idx)
3178              .stop()
3179              .delay(duration)
3180              .slideDown(duration, function () {
3181                $(this).removeAttr('style').addClass('active');
3182
3183                if (scrollable) {
3184                  $('body, html')
3185                    .stop()
3186                    .animate(
3187                      {
3188                        scrollTop: $pagination.offset().top - navOffset,
3189                      },
3190                      300,
3191                    );
3192                }
3193
3194                $pagination.removeClass('clicked');
3195              });
3196          } else {
3197            $pageContent
3198              .children()
3199              .eq(idx)
3200              .stop()
3201              .slideDown(duration, function () {
3202                $(this).removeAttr('style').addClass('active');
3203
3204                if (scrollable) {
3205                  $('body, html')
3206                    .stop()
3207                    .animate(
3208                      {
3209                        scrollTop: $pagination.offset().top - navOffset,
3210                      },
3211                      300,
3212                    );
3213                }
3214
3215                $pagination.removeClass('clicked');
3216              });
3217          }
3218        } else {
3219          if ($pageContent.children().length > 1) {
3220            $pageContent
3221              .children()
3222              .stop()
3223              .hide(duration, function () {
3224                $(this).removeAttr('style').removeClass('active');
3225              })
3226              .siblings()
3227              .eq(idx)
3228              .stop()
3229              .delay(duration)
3230              .show(duration, function () {
3231                $(this).removeAttr('style').addClass('active');
3232
3233                if (scrollable) {
3234                  $('body, html')
3235                    .stop()
3236                    .animate(
3237                      {
3238                        scrollTop: $pagination.offset().top - navOffset,
3239                      },
3240                      300,
3241                    );
3242                }
3243
3244                $pagination.removeClass('clicked');
3245              });
3246          } else {
3247            $pageContent
3248              .children()
3249              .eq(idx)
3250              .stop()
3251              .show(duration, function () {
3252                $(this).removeAttr('style').addClass('active');
3253
3254                if (scrollable) {
3255                  $('body, html')
3256                    .stop()
3257                    .animate(
3258                      {
3259                        scrollTop: $pagination.offset().top - navOffset,
3260                      },
3261                      300,
3262                    );
3263                }
3264
3265                $pagination.removeClass('clicked');
3266              });
3267          }
3268        }
3269
3270        $pagination.children('.page-link').find('.page-item.current').removeClass('current');
3271        $pagination.children('.page-link').find('.page-item.active').removeClass('active');
3272        $pagination.children('.page-link').each(function () {
3273          $(this).find('.page-item').eq(idx).addClass('active');
3274        });
3275      }
3276    })
3277    .on('click', '.page-link li.disabled', function () {});
3278  // END: .pagination
3279});
3280
3281// user agents
3282var isMobile = {
3283  Android: function () {
3284    return navigator.userAgent.match(/Android/i);
3285  },
3286  BlackBerry: function () {
3287    return navigator.userAgent.match(/BlackBerry/i);
3288  },
3289  iOS: function () {
3290    return navigator.userAgent.match(/iPhone|iPad|iPod/i);
3291  },
3292  Opera: function () {
3293    return navigator.userAgent.match(/Opera Mini/i);
3294  },
3295  Windows: function () {
3296    return navigator.userAgent.match(/IEMobile/i);
3297  },
3298  any: function () {
3299    return isMobile.Android() || isMobile.BlackBerry() || isMobile.iOS() || isMobile.Opera() || isMobile.Windows();
3300  },
3301};
3302
3303var fbTimer = null,
3304  fbCodes = {},
3305  fbPage = document.querySelectorAll('.fb-page');
3306
3307if (fbPage.length > 0) {
3308  for (var i in fbPage) {
3309    if (fbPage[i].constructor === HTMLDivElement) fbCodes[i] = fbPage[i].outerHTML;
3310  }
3311}
3312
3313$(window)
3314  .resize(function () {
3315    // fix bg parallax on mobile
3316    if (isMobile.any()) $('.bg-parallax').css('background-attachment', 'inherit');
3317    else $('.bg-parallax').css('background-attachment', '');
3318
3319    $('.pagination').removeClass('clicked');
3320
3321    if ($('#fb-root').attr('data-resize')) {
3322      if (fbTimer != null) clearTimeout(fbTimer);
3323
3324      // delay for document is loaded
3325      fbTimer = setTimeout(function () {
3326        if (typeof FB !== 'undefined') {
3327          $('.fb-page').each(function (i) {
3328            if (fbCodes[i]) $(this).replaceWith(fbCodes[i]);
3329          });
3330
3331          FB.XFBML.parse(document, function () {
3332            if ($('#fb-root').attr('data-resize') == 'once') $('#fb-root').removeAttr('data-resize');
3333          });
3334        }
3335      }, 1000);
3336    }
3337  })
3338  .on('scroll resize', function () {
3339    if ($(this).scrollTop() > 0) $('#pagetop').addClass('visible');
3340    else $('#pagetop').removeClass('visible');
3341
3342    if ($('.nav-fixed').length) {
3343      var $navPinY = $('.nav-target').length ? $('.nav-target').offset().top - $('.nav-fixed').outerHeight() - 1 : $('.nav-fixed').offset().top;
3344      if ($(this).scrollTop() > $navPinY || ($navPinY < 0 && $(this).scrollTop() > 0)) {
3345        if ($('.nav-pin').length) $('.nav-pin').addClass('fixed');
3346        else $('.nav-fixed').addClass('fixed');
3347      } else {
3348        if ($('.nav-pin').length) $('.nav-pin').removeClass('fixed');
3349        else $('.nav-fixed').removeClass('fixed');
3350      }
3351    }
3352  })
3353  .on('load', function () {
3354    // scrollBefore();
3355  });
3356
3357var scrollBefore = function () {
3358  var hash = window.location.hash || location.hash,
3359    ptnHash = /([;?%&,+*~\':"!^$[\]()=>|\/@])/g;
3360
3361  if (hash) {
3362    hash = hash.replace(ptnHash, '\\$1');
3363    if ($(hash).length > 0) {
3364      if ($('.tabs-switch').length > 0) {
3365        if ($(hash).length > 0 && $(hash).parents('.tab-content').first().length > 0) {
3366          var tabChild = $(hash);
3367          $(hash)
3368            .parents()
3369            .each(function () {
3370              if ($(this).attr('class') !== undefined && $.inArray('tab-content', $(this).attr('class').split(' ')) >= 0) return false;
3371              else tabChild = $(this);
3372            });
3373
3374          setTimeout(function () {
3375            tabChild.parents('.tabs-switch').first().children('.tab-link').children().eq(tabChild.index()).click(); // trigger tab in multiple dim
3376          }, 10);
3377        } else {
3378          $('.tabs-switch').each(function () {
3379            var $tabLink = $(this).children('.tab-link');
3380
3381            if ($tabLink.children(hash).length > 0) {
3382              setTimeout(function () {
3383                $tabLink.children(hash).click(); // trigger for set active tab
3384              }, 10);
3385            }
3386          });
3387        }
3388      }
3389
3390      if ($('.bx-wrapper').length > 0) $(window).trigger('resize');
3391
3392      setTimeout(function () {
3393        if ($('.nav-fixed').length > 0) {
3394          var offsetY = $(hash).offset().top,
3395            navHeight = typeof $('.nav-fixed').attr('data-height') != 'undefined' ? parseInt($('.nav-fixed').attr('data-height'), 10) : $('.nav-fixed').outerHeight();
3396
3397          // if ($(".nav-pin").length > 0) offsetY -= $(".nav-pin").outerHeight();
3398
3399          window.scroll(0, offsetY - navHeight);
3400
3401          // re-updated offset
3402          if ($('.nav-target').length > 0) {
3403            var reupdated = true;
3404            $(window).scroll(function () {
3405              if (reupdated && $(this).scrollTop() >= $('.nav-target').offset().top) {
3406                reupdated = false;
3407
3408                navHeight = typeof $('.nav-fixed').attr('data-height') != 'undefined' ? parseInt($('.nav-fixed').attr('data-height'), 10) : $('.nav-fixed').outerHeight();
3409
3410                window.scroll(0, $(hash).offset().top - navHeight);
3411              }
3412            });
3413          }
3414        } else window.scrollTo(0, $(hash).offset().top);
3415      }, 10);
3416
3417      $("a[href='" + hash + "']").click();
3418    } // else window.scrollTo(0, _offsetY);
3419  }
3420};
3421
3422scrollBefore(); // DOM loaded
3423
3424/*
3425 * Plugins/Functions
3426 *
3427 */
3428
3429// check object is variable or DOM elements
3430function isObjectVar(obj) {
3431  return typeof obj != 'undefined' && typeof obj === 'object' && obj.nodeType !== 1 && typeof obj.ownerDocument !== 'object';
3432}
3433
3434(function ($) {
3435  // BEGIN: $.fcvScroll
3436  $.fn.fcvScroll = function (options) {
3437    var options = $.extend(
3438      {
3439        selector: '.section', // selector
3440        delay: 50, // time delay (ms)
3441        duration: 400, // time duration (ms)
3442        reference: 0.9,
3443      },
3444      options,
3445    );
3446
3447    if (options.selector) {
3448      var $wrapper = $(this),
3449        $offsetSelectors = [],
3450        $scrollDown = true,
3451        $scrollPos = $(window).scrollTop(),
3452        $scrollTimer = null;
3453
3454      $wrapper.find(options.selector).each(function (i) {
3455        $offsetSelectors.push($(this).offset().top); // offsetY fined
3456      });
3457
3458      $(window)
3459        .scroll(function () {
3460          $scrollDown = $(window).scrollTop() >= $scrollPos;
3461          $scrollPos = $(window).scrollTop();
3462
3463          clearTimeout($scrollTimer);
3464
3465          if ($.inArray($(window).scrollTop(), $offsetSelectors) < 0) {
3466            // not in area fined
3467            $scrollTimer = setTimeout(function () {
3468              // fcv-snap
3469              var $scrollTop = $(window).scrollTop(),
3470                $posY = $(window).height() * options.reference,
3471                $position = 0,
3472                $target;
3473
3474              if ($scrollDown) {
3475                // direction down
3476                $position = $scrollTop + $posY - 1;
3477                $wrapper.find(options.selector).each(function () {
3478                  var $offsetY = $(this).offset().top;
3479                  if ($offsetY > $scrollTop && $offsetY <= $position) {
3480                    $target = $(this);
3481                    return false;
3482                  }
3483                });
3484              } else {
3485                // direction up
3486                $position = $scrollTop - $posY + 1;
3487                $wrapper.find(options.selector).each(function () {
3488                  var $offsetY = $(this).offset().top;
3489                  if ($offsetY < $scrollTop && $offsetY >= $position) {
3490                    $target = $(this);
3491                    return false;
3492                  }
3493                });
3494              }
3495
3496              if ($target) {
3497                $('html, body')
3498                  .stop()
3499                  .animate(
3500                    {
3501                      scrollTop: $target.offset().top,
3502                    },
3503                    options.duration,
3504                    function () {
3505                      clearTimeout($scrollTimer);
3506                    },
3507                  );
3508              }
3509            }, options.delay);
3510          }
3511        })
3512        .resize(function () {
3513          if ($(options.selector).hasClass('minHeight')) {
3514            $(options.selector).css({
3515              minHeight: $(window).height(),
3516            });
3517          } else {
3518            $(options.selector).css({
3519              height: $(window).height(),
3520            });
3521          }
3522        })
3523        .trigger('resize');
3524    } else console.error('Missing selector');
3525
3526    return this;
3527  };
3528  // END: $.fcvScroll
3529})(jQuery);
3530
3531var gmarkers = [],
3532  gnum = 0;
3533
3534// BEGIN: heightLine
3535function heightLine() {
3536  this.className = 'heightLine';
3537  this.parentClassName = 'heightLineParent';
3538  reg = new RegExp(this.className + '-([a-zA-Z0-9-_]+)', 'i');
3539  objCN = new Array();
3540  var objAll = document.getElementsByTagName ? document.getElementsByTagName('*') : document.all;
3541  for (var i = 0; i < objAll.length; i++) {
3542    if (typeof objAll[i].className == 'string') {
3543      var eltClass = objAll[i].className.split(/\s+/);
3544      for (var j = 0; j < eltClass.length; j++) {
3545        if (eltClass[j] == this.className) {
3546          if (!objCN['main CN']) objCN['main CN'] = new Array();
3547          objCN['main CN'].push(objAll[i]);
3548          break;
3549        } else if (eltClass[j] == this.parentClassName) {
3550          if (!objCN['parent CN']) objCN['parent CN'] = new Array();
3551          objCN['parent CN'].push(objAll[i]);
3552          break;
3553        } else if (eltClass[j].match(reg)) {
3554          var OCN = eltClass[j].match(reg);
3555          if (!objCN[OCN]) objCN[OCN] = new Array();
3556          objCN[OCN].push(objAll[i]);
3557          break;
3558        }
3559      }
3560    }
3561  }
3562
3563  //check font size
3564  var e = document.createElement('div');
3565  var s = document.createTextNode('S');
3566  e.appendChild(s);
3567  e.style.classname = 'check-fontsize';
3568  e.style.visibility = 'hidden';
3569  e.style.position = 'absolute';
3570  e.style.top = '0';
3571  document.body.appendChild(e);
3572  var defHeight = e.offsetHeight;
3573
3574  changeBoxSize = function () {
3575    for (var key in objCN) {
3576      if (objCN.hasOwnProperty(key)) {
3577        //parent type
3578        if (key == 'parent CN') {
3579          for (var i = 0; i < objCN[key].length; i++) {
3580            var max_height = 0;
3581            var CCN = objCN[key][i].childNodes;
3582            for (var j = 0; j < CCN.length; j++) {
3583              if (CCN[j] && CCN[j].nodeType == 1) {
3584                CCN[j].style.height = 'auto';
3585                max_height = max_height > CCN[j].offsetHeight ? max_height : CCN[j].offsetHeight;
3586              }
3587            }
3588            for (var j = 0; j < CCN.length; j++) {
3589              if (CCN[j].style) {
3590                var stylea = CCN[j].currentStyle || document.defaultView.getComputedStyle(CCN[j], '');
3591                var newheight = max_height;
3592                if (stylea.paddingTop) newheight -= stylea.paddingTop.replace('px', '');
3593                if (stylea.paddingBottom) newheight -= stylea.paddingBottom.replace('px', '');
3594                if (stylea.borderTopWidth && stylea.borderTopWidth != 'medium') newheight -= stylea.borderTopWidth.replace('px', '');
3595                if (stylea.borderBottomWidth && stylea.borderBottomWidth != 'medium') newheight -= stylea.borderBottomWidth.replace('px', '');
3596                CCN[j].style.height = newheight + 'px';
3597              }
3598            }
3599          }
3600        } else {
3601          var max_height = 0;
3602          for (var i = 0; i < objCN[key].length; i++) {
3603            objCN[key][i].style.height = 'auto';
3604            max_height = max_height > objCN[key][i].offsetHeight ? max_height : objCN[key][i].offsetHeight;
3605          }
3606          for (var i = 0; i < objCN[key].length; i++) {
3607            if (objCN[key][i].style) {
3608              var stylea = objCN[key][i].currentStyle || document.defaultView.getComputedStyle(objCN[key][i], '');
3609              var newheight = max_height;
3610              if (stylea.paddingTop) newheight -= stylea.paddingTop.replace('px', '');
3611              if (stylea.paddingBottom) newheight -= stylea.paddingBottom.replace('px', '');
3612              if (stylea.borderTopWidth && stylea.borderTopWidth != 'medium') newheight -= stylea.borderTopWidth.replace('px', '');
3613              if (stylea.borderBottomWidth && stylea.borderBottomWidth != 'medium') newheight -= stylea.borderBottomWidth.replace('px', '');
3614              objCN[key][i].style.height = newheight + 'px';
3615            }
3616          }
3617        }
3618      }
3619    }
3620  };
3621
3622  checkBoxSize = function () {
3623    if (defHeight != e.offsetHeight) {
3624      changeBoxSize();
3625      defHeight = e.offsetHeight;
3626    }
3627
3628    // var elm = document.querySelector(".check-fontsize");
3629    // if (elm) elm.parentNode.removeChild(elm);
3630  };
3631  changeBoxSize();
3632  setInterval(checkBoxSize, 1000);
3633  window.onresize = changeBoxSize;
3634}
3635
3636function addEvent(elm, listener, fn) {
3637  try {
3638    elm.addEventListener(listener, fn, false);
3639  } catch (e) {
3640    elm.attachEvent('on' + listener, fn);
3641  }
3642}
3643addEvent(window, 'load', heightLine);
3644// END: heightLine
3645
3646(function () {
3647  // DOM loaded
3648
3649  // WOW js
3650  if (typeof window['WOW'] === 'function') {
3651    var wowData = {
3652        boxClass: typeof $('body').attr('data-wow-box') != 'undefined' ? $('body').attr('data-wow-box') : 'wow',
3653        animateClass: typeof $('body').attr('data-wow-animate') != 'undefined' ? $('body').attr('data-wow-animate') : 'animated',
3654        offset: typeof $('body').attr('data-wow-offset') != 'undefined' ? parseInt($('body').attr('data-wow-offset')) : 0,
3655        mobile: $.inArray($('body').attr('data-wow-mobile'), ['fal
3655se', 'off', 'disable', 'disabled', '0']) >= 0 ? false : true,
3656        live: $.inArray($('body').attr('data-wow-live'), ['false', 'off', 'disable', 'disabled', '0']) >= 0 ? false : true,
3657        resetAnimation: $.inArray($('body').attr('data-wow-reset'), ['false', 'off', 'disable', 'disabled', '0']) >= 0 ? false : true,
3658        callback: function (box) {},
3659        scrollContainer: null,
3660      },
3661      _wow_ = new WOW(wowData);
3662
3663    _wow_.init();
3664  }
3665})();
3666
3667// conflicts
3668if (!Object.keys) {
3669  Object.keys = (function () {
3670    'use strict';
3671    var hasOwnProperty = Object.prototype.hasOwnProperty,
3672      hasDontEnumBug = !{
3673        toString: null,
3674      }.propertyIsEnumerable('toString'),
3675      dontEnums = ['toString', 'toLocaleString', 'valueOf', 'hasOwnProperty', 'isPrototypeOf', 'propertyIsEnumerable', 'constructor'],
3676      dontEnumsLength = dontEnums.length;
3677
3678    return function (obj) {
3679      if (typeof obj !== 'object' && (typeof obj !== 'function' || obj === null)) {
3680        throw new TypeError('Object.keys called on non-object');
3681      }
3682
3683      var result = [],
3684        prop,
3685        i;
3686
3687      for (prop in obj) {
3688        if (hasOwnProperty.call(obj, prop)) {
3689          result.push(prop);
3690        }
3691      }
3692
3693      if (hasDontEnumBug) {
3694        for (i = 0; i < dontEnumsLength; i++) {
3695          if (hasOwnProperty.call(obj, dontEnums[i])) {
3696            result.push(dontEnums[i]);
3697          }
3698        }
3699      }
3700      return result;
3701    };
3702  })();
3703}
3704
3705function isHTML(str) {
3706  var a = document.createElement('div');
3707  a.innerHTML = str;
3708  for (var child = a.childNodes, i = child.length; i--; ) {
3709    if (child[i].nodeType == 1) return true;
3710  }
3711  return false;
3712}
3713
3714// BEGIN: slide fading
3715var $slideFadeTimer = {};
3716
3717function slideFadeStart(elm) {
3718  var $this = elm,
3719    __idx__ = $('.slide-fade').index($this),
3720    $duration = typeof $this.attr('data-duration') != 'undefined' ? parseInt($this.attr('data-duration')) : 1000,
3721    $timer = typeof $this.attr('data-timer') != 'undefined' ? parseInt($this.attr('data-timer')) : 4000,
3722    $delay = typeof $this.attr('data-delay') != 'undefined' ? parseInt($this.attr('data-delay')) : false;
3723
3724  if ($timer < $duration) $timer = $duration * 2;
3725
3726  $this.removeClass('stop');
3727  if (!$this.children('.active').length) {
3728    $this.children().hide();
3729    $this.children().eq(0).show().addClass('active');
3730
3731    if ($this.siblings('.slide-page').length) $this.siblings('.slide-page').children().eq(0).addClass('active');
3732  } else {
3733    if ($this.siblings('.slide-page').length) $this.siblings('.slide-page').children().eq($this.children('.active').index()).addClass('active');
3734  }
3735
3736  // $slideFadeTimer[__idx__] = setInterval(function() {
3737  // slideFade($this, $duration);
3738  // }, $timer);
3739
3740  $this.parents('.slideParent').addClass('move-start').attr('data', $this.children('.active').index());
3741
3742  if ($slideFadeTimer[__idx__]) clearTimeout($slideFadeTimer[__idx__]);
3743  $slideFadeTimer[__idx__] = setTimeout(
3744    function () {
3745      slideFade($this, $duration);
3746    },
3747    $delay ? $delay : $timer,
3748  );
3749}
3750
3751function slideFade(elm, duration) {
3752  var elmActive = elm.children('.active'),
3753    slideContinue = elm.hasClass('stop') || (elm.hasClass('once') && elmActive.next().length < 1) ? false : true;
3754
3755  if (slideContinue) {
3756    var __idx__ = $('.slide-fade').index(elm),
3757      timer = typeof elm.attr('data-timer') != 'undefined' ? parseInt(elm.attr('data-timer')) : 4000;
3758
3759    if (elmActive.next().length) {
3760      if (typeof elmActive.next().attr('data-duration') != 'undefined') duration = parseInt(elmActive.next().attr('data-duration'));
3761    } else {
3762      if (typeof elm.children().eq(0).attr('data-duration') != 'undefined') duration = parseInt(elm.children().eq(0).attr('data-duration'));
3763    }
3764
3765    if ($slideFadeTimer[__idx__]) clearTimeout($slideFadeTimer[__idx__]);
3766
3767    elmActive.stop().fadeOut(duration, function () {
3768      $(this).removeClass('active').removeAttr('style').hide();
3769    });
3770
3771    elm.parents('.slideParent').removeClass('move-start move-next move-prev move-first move-last');
3772
3773    if (elmActive.next().length > 0) {
3774      if (typeof elmActive.next().attr('data-timer') != 'undefined') t
3774imer = parseInt(elmActive.next().attr('data-timer'));
3775      if (timer < duration) timer = duration * 2;
3776
3777      if (elm.siblings('.slide-page').length > 0) {
3778        elm.siblings('.slide-page').children('.active').removeClass('active');
3779        elm.siblings('.slide-page').children().eq(elmActive.next().index()).addClass('active');
3780      }
3781
3782      elm.parents('.slideParent').addClass('move-next').attr('data', elmActive.next().index());
3783      if (elmActive.next().is(':last-child')) elm.parents('.slideParent').addClass('move-last');
3784
3785      elmActive
3786        .next()
3787        .stop()
3788        .fadeIn(duration, function () {
3789          $(this).addClass('active').removeAttr('style').show();
3790
3791          if (elm.siblings('.slide-btn').hasClass('clicked')) elm.siblings('.slide-btn.clicked').removeClass('clicked');
3792          if (elm.siblings('.slide-page').hasClass('clicked')) elm.siblings('.slide-page.clicked').removeClass('clicked');
3793
3794          if ($(this).next().length < 1 && elm.hasClass('once')) elm.addClass('slide-finished');
3795
3796          $slideFadeTimer[__idx__] = setTimeout(function () {
3797            slideFade(elm, duration);
3798          }, timer);
3799        });
3800    } else {
3801      if (typeof elm.children().eq(0).attr('data-timer') != 'undefined') timer = parseInt(elm.children().eq(0).attr('data-timer'));
3802      if (timer < duration) timer = duration * 2;
3803
3804      if (elm.siblings('.slide-page').length > 0) {
3805        elm.siblings('.slide-page').children('.active').removeClass('active');
3806        elm.siblings('.slide-page').children().eq(0).addClass('active');
3807      }
3808
3809      elm.parents('.slideParent').addClass('move-first').attr('data', 0);
3810
3811      elm
3812        .children()
3813        .eq(0)
3814        .stop()
3815        .fadeIn(duration, function () {
3816          $(this).addClass('active').removeAttr('style').show();
3817
3818          if (elm.siblings('.slide-btn').hasClass('clicked')) elm.siblings('.slide-btn.clicked').removeClass('clicked');
3819          if (elm.siblings('.slide-page').hasClass('clicked')) elm.siblings('.slide-page.clicked').removeClass('clicked');
3820
3821          if ($(this).next().length < 1 && elm.hasClass('once')) elm.addClass('slide-finished');
3822
3823          $slideFadeTimer[__idx__] = setTimeout(function () {
3824            slideFade(elm, duration);
3825          }, timer);
3826        });
3827    }
3828  } else elm.addClass('slide-finished');
3829}
3830// END: slide fading
3831
3832// BEGIN: .pagination
3833function reloadPager(elm) {
3834  if (elm) {
3835    if (elm instanceof jQuery && elm.length > 0) {
3836      elm.each(function () {
3837        initPager($(this));
3838      });
3839    }
3840  } else {
3841    $('.pagination').each(function () {
3842      initPager($(this));
3843    });
3844  }
3845}
3846function initPager(elm) {
3847  // if (elm.children(".page-content").children().length > 0) {
3848  var $pagination = elm,
3849    $pageContent = $pagination.children('.page-content'),
3850    total = $pageContent.children().length;
3851
3852  var dataPage = {
3853    first: typeof $pagination.attr('data-first') !== 'undefined' && $pagination.attr('data-first').length > 0 ? $pagination.attr('data-first') : false,
3854    last: typeof $pagination.attr('data-last') !== 'undefined' && $pagination.attr('data-last').length > 0 ? $pagination.attr('data-last') : false,
3855    next: typeof $pagination.attr('data-next') !== 'undefined' && $pagination.attr('data-next').length > 0 ? $pagination.attr('data-next') : false,
3856    prev: typeof $pagination.attr('data-prev') !== 'undefined' && $pagination.attr('data-prev').length > 0 ? $pagination.attr('data-prev') : false,
3857    active: typeof $pagination.attr('data-active') !== 'undefined' && $pagination.attr('data-active').length > 0 ? parseInt($pagination.attr('data-active'), 10) : 1,
3858    max: typeof $pagination.attr('data-max') !== 'undefined' && $pagination.attr('data-max').length > 0 ? parseInt($pagination.attr('data-max'), 10) : false,
3859    page: typeof $pagination.attr('data-page') !== 'undefined' && $.inArray($pagination.attr('data-page'), ['top', 'bottom', 'both']) >= 0 ? $pagination.attr('data-page') : false,
3860  };
3861
3862  if (dataPage.active > total) dataPage.active = 1;
3863
3864  if (dataPage.max) {
3865    // && $pageContent.children().length > 0
3866    if ($pageContent.children('.page-wrap').length > 0) {
3867      if ($pageContent.children('.page-wrap').children().length > 0) $pageContent.children('.page-wrap').children().unwrap();
3868      else $pageContent.children('.page-wrap').remove();
3869    }
3870
3871    $pageContent
3872      .children()
3873      .not('.page-wrap')
3874      .each(function (i) {
3875        if (i % dataPage.max === 0) $pageContent.append('<div class="page-wrap" />');
3876
3877        $(this).appendTo($pageContent.children('.page-wrap').last());
3878      });
3879
3880    total = $pageContent.children().length;
3881  }
3882
3883  if ($pagination.children('.page-link').length > 0) $pagination.children('.page-link').remove();
3884
3885  if (dataPage.page && total > 0) {
3886    if (dataPage.page == 'top') $pagination.prepend('<div class="page-link" />');
3887    else if (dataPage.page == 'bottom') $pagination.append('<div class="page-link" />');
3888    else {
3889      $pagination.prepend('<div class="page-link" />');
3890      $pagination.append('<div class="page-link" />');
3891    }
3892
3893    $pagination.children('.page-link').each(function (p) {
3894      var $pageLink = $(this);
3895
3896      var htmlItem = [];
3897      htmlItem.push('<ul>');
3898      if (dataPage.first) htmlItem.push('<li class="page-first">' + dataPage.first + '</li>');
3899      if (dataPage.prev) htmlItem.push('<li class="page-prev">' + dataPage.prev + '</li>');
3900      for (var i = 1; i <= total; i++) {
3901        // if (i == dataPage.active) htmlItem.push('<li class="page-item active">' + i + '</li>');
3902        // else htmlItem.push('<li class="page-item">' + i + '</li>');
3903        htmlItem.push('<li class="page-item">' + i + '</li>');
3904      }
3905      if (dataPage.next) htmlItem.push('<li class="page-next">' + dataPage.next + '</li>');
3906      if (dataPage.last) htmlItem.push('<li class="page-last">' + dataPage.last + '</li>');
3907      htmlItem.push('</ul>');
3908
3909      htmlItem = htmlItem.join('\n');
3910      $pageLink.html(htmlItem);
3911
3912      var scrollable = $pagination.attr('data-scroll'),
3913        duration = $pagination.attr('data-duration'),
3914        modeable = $pagination.attr('data-mode');
3915
3916      $pagination.attr('data-scroll', false); // off scroll on first loaded
3917      $pagination.attr('data-duration', 0); // off duration on first loaded
3918      $pagination.attr('data-mode', false); // off mode on first loaded
3919
3920      if (p >= $pagination.children('.page-link').length - 1) {
3921        // last
3922        setTimeout(function () {
3923          $pageLink
3924            .find('.page-item')
3925            .eq(dataPage.active - 1)
3926            .click();
3927        }, 1);
3928      }
3928 // else $pageLink.find(".page-item").eq(dataPage.active - 1).addClass("active");
3929    });
3930
3931    // re-setting for data-scroll
3932    if (typeof scrollable === 'undefined') $pagination.removeAttr('data-scroll');
3933    else $pagination.attr('data-scroll', scrollable);
3934
3935    // re-setting for data-duration
3936    if (typeof duration === 'undefined') $pagination.removeAttr('data-duration');
3937    else $pagination.attr('data-duration', duration);
3938
3939    // re-setting for data-mode
3940    if (typeof modeable === 'undefined') $pagination.removeAttr('data-mode');
3941    else $pagination.attr('data-mode', modeable);
3942  } else {
3943    $pageContent.children('.page-wrap').first().addClass('active'); // show
3944  }
3945  // }
3946}
3947// END: .pagination
3948
3949var checkDomain = function (url) {
3950  if (url.indexOf('//') === 0) url = location.protocol + url;
3951  return url
3952    .toLowerCase()
3953    .replace(/([a-z])?:\/\//, '$1')
3954    .split('/')[0];
3955};
3956var isExternal = function (url) {
3957  return (url.indexOf(':') > -1 || url.indexOf('//') > -1) && checkDomain(location.href) !== checkDomain(url);
3958};

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.