Guest User

Untitled

a guest
Nov 5th, 2013
220
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 78.48 KB | None | 0 0
  1. (function($)
  2. {
  3. "use strict";
  4.  
  5. $(document).ready(function()
  6. {
  7.  
  8. $.avia_utilities = $.avia_utilities || {};
  9.  
  10. avia_responsive_menu();
  11.  
  12. //Resize menu if logo is overlapped by th menu items
  13. //check if user uses IE7 - if yes don't execute the function or the menu will break
  14. if(navigator.appVersion.indexOf("MSIE 7.") == -1)
  15. avia_resize_menu();
  16.  
  17. // decreases header size when user scrolls down
  18. avia_header_size();
  19.  
  20. //show scroll top button
  21. avia_scroll_top_fade();
  22.  
  23. //creates search tooltip
  24. new $.AviaTooltip({"class": 'avia-search-tooltip',data: 'avia-search-tooltip', event:'click', position:'bottom', scope: "body", attach:'element'});
  25.  
  26. //creates relate posts tooltip
  27. new $.AviaTooltip({"class": 'avia-related-tooltip', data: 'avia-related-tooltip', scope: ".related_posts", attach:'element', delay:0});
  28.  
  29. //creates ajax search
  30. new $.AviaAjaxSearch({scope:'#header'});
  31.  
  32.  
  33. // actiavte portfolio sorting
  34. if($.fn.avia_iso_sort)
  35. $('.grid-sort-container').avia_iso_sort();
  36.  
  37. //activates the mega menu javascript
  38. if($.fn.aviaMegamenu)
  39. $(".main_menu .menu").aviaMegamenu({modify_position:true});
  40.  
  41.  
  42. $('a.avianolink').on('click', function(){return false;});
  43. $('a.aviablank').attr('target', '_blank');
  44.  
  45. $.avia_utilities.avia_ajax_call();
  46. });
  47.  
  48. $.avia_utilities = $.avia_utilities || {};
  49.  
  50. $.avia_utilities.avia_ajax_call = function(container)
  51. {
  52. if(typeof container == 'undefined'){ container = 'body';};
  53.  
  54. //activates the prettyphoto lightbox
  55. $(container).avia_activate_lightbox({callback:'avia_lightbox_callback'});
  56.  
  57. //scrollspy for main menu. must be located before smoothscrolling
  58. if($.fn.avia_scrollspy)
  59. {
  60. if(container == 'body')
  61. {
  62. $('body').avia_scrollspy({target:'.main_menu .menu li > a'});
  63. }
  64. else
  65. {
  66. $('body').avia_scrollspy('refresh');
  67. }
  68. }
  69.  
  70. //smooth scrooling
  71. if($.fn.avia_smoothscroll)
  72. $('a[href*=#]', container).avia_smoothscroll();
  73.  
  74. avia_small_fixes(container);
  75.  
  76. avia_hover_effect(container);
  77.  
  78. avia_iframe_fix(container);
  79.  
  80. //activate html5 video player
  81. if($.fn.avia_html5_activation && $.fn.mediaelementplayer)
  82. $(".avia_video, .avia_audio", container).avia_html5_activation({ratio:'16:9'});
  83.  
  84.  
  85.  
  86.  
  87. }
  88.  
  89.  
  90.  
  91. // -------------------------------------------------------------------------------------------
  92. // modified SCROLLSPY by bootstrap
  93. // -------------------------------------------------------------------------------------------
  94.  
  95.  
  96. function AviaScrollSpy(element, options)
  97. {
  98. var self = this;
  99.  
  100. var process = $.proxy(self.process, self)
  101. , refresh = $.proxy(self.refresh, self)
  102. , $element = $(element).is('body') ? $(window) : $(element)
  103. , href
  104. self.$body = $('body')
  105. self.options = $.extend({}, $.fn.avia_scrollspy.defaults, options)
  106. self.selector = (self.options.target
  107. || ((href = $(element).attr('href')) && href.replace(/.*(?=#[^\s]+$)/, '')) //strip for ie7
  108. || '')
  109.  
  110. self.activation_true = false;
  111.  
  112. if(self.$body.find(self.selector + "[href*=#]").length)
  113. {
  114. self.$scrollElement = $element.on('scroll.scroll-spy.data-api', process);
  115. self.$body.on('av_resize_finished', refresh);
  116. self.activation_true = true;
  117. self.checkFirst()
  118.  
  119. setTimeout(function()
  120. {
  121. self.refresh()
  122. self.process()
  123.  
  124. },100);
  125. }
  126.  
  127. }
  128.  
  129. AviaScrollSpy.prototype = {
  130.  
  131. constructor: AviaScrollSpy
  132. , checkFirst: function () {
  133.  
  134. var current = window.location.href.split('#')[0],
  135. matching_link = this.$body.find(this.selector + "[href='"+current+"']").attr('href',current+'#top');
  136. }
  137. , refresh: function () {
  138.  
  139. if(!this.activation_true) return;
  140.  
  141. var self = this
  142. , $targets
  143.  
  144. this.offsets = $([])
  145. this.targets = $([])
  146.  
  147. $targets = this.$body
  148. .find(this.selector)
  149. .map(function () {
  150. var $el = $(this)
  151. , href = $el.data('target') || $el.attr('href')
  152. , $href = /^#\w/.test(this.hash) && $(this.hash)
  153.  
  154. return ( $href
  155. && $href.length
  156. && [[ $href.position().top + (!$.isWindow(self.$scrollElement.get(0)) && self.$scrollElement.scrollTop()), href ]] ) || null
  157. })
  158. .sort(function (a, b) { return a[0] - b[0] })
  159. .each(function () {
  160. self.offsets.push(this[0])
  161. self.targets.push(this[1])
  162. })
  163. }
  164.  
  165. , process: function () {
  166.  
  167. if(!this.offsets) return;
  168.  
  169. var scrollTop = this.$scrollElement.scrollTop() + this.options.offset
  170. , scrollHeight = this.$scrollElement[0].scrollHeight || this.$body[0].scrollHeight
  171. , maxScroll = scrollHeight - this.$scrollElement.height()
  172. , offsets = this.offsets
  173. , targets = this.targets
  174. , activeTarget = this.activeTarget
  175. , i
  176.  
  177. if (scrollTop >= maxScroll) {
  178. return activeTarget != (i = targets.last()[0])
  179. && this.activate ( i )
  180. }
  181.  
  182. for (i = offsets.length; i--;) {
  183. activeTarget != targets[i]
  184. && scrollTop >= offsets[i]
  185. && (!offsets[i + 1] || scrollTop <= offsets[i + 1])
  186. && this.activate( targets[i] )
  187. }
  188. }
  189.  
  190. , activate: function (target) {
  191. var active
  192. , selector
  193.  
  194. this.activeTarget = target
  195.  
  196. $(this.selector)
  197. .parent('.' + this.options.applyClass)
  198. .removeClass(this.options.applyClass)
  199.  
  200. selector = this.selector
  201. + '[data-target="' + target + '"],'
  202. + this.selector + '[href="' + target + '"]'
  203.  
  204. active = $(selector)
  205. .parent('li')
  206. .addClass(this.options.applyClass)
  207.  
  208. if (active.parent('.dropdown-menu').length) {
  209. active = active.closest('li.dropdown').addClass(this.options.applyClass)
  210. }
  211.  
  212. active.trigger('activate')
  213. }
  214.  
  215. }
  216.  
  217.  
  218. /* AviaScrollSpy PLUGIN DEFINITION
  219. * =========================== */
  220.  
  221. $.fn.avia_scrollspy = function (option) {
  222. return this.each(function () {
  223. var $this = $(this)
  224. , data = $this.data('scrollspy')
  225. , options = typeof option == 'object' && option
  226. if (!data) $this.data('scrollspy', (data = new AviaScrollSpy(this, options)))
  227. if (typeof option == 'string') data[option]()
  228. })
  229. }
  230.  
  231. $.fn.avia_scrollspy.Constructor = AviaScrollSpy
  232.  
  233. $.fn.avia_scrollspy.defaults = {
  234. offset: (parseInt($('.fixed_header #header').height(), 10)) + parseInt($('html').css('margin-top'),10),
  235. applyClass: 'current-menu-item'
  236. }
  237.  
  238.  
  239.  
  240.  
  241.  
  242.  
  243. // -------------------------------------------------------------------------------------------
  244. // responsive menu function
  245. // -------------------------------------------------------------------------------------------
  246.  
  247. function avia_responsive_menu()
  248. {
  249. var win = $(window), header = $('.responsive #header');
  250.  
  251. if(!header.length) return;
  252.  
  253. var menu = header.find('.main_menu ul:eq(0)'),
  254. first_level_items = menu.find('>li').length,
  255. bottom_menu = $('html').is('.bottom_nav_header'),
  256. switchWidth = 767;
  257.  
  258. if(first_level_items > 7 + header.find('#menu-item-search').length && !bottom_menu)
  259. {
  260. switchWidth = 989;
  261. header.addClass('mobile_menu_tablet');
  262. }
  263.  
  264. if(header.is('.mobile_drop_down'))
  265. {
  266. menu.mobileMenu({
  267. switchWidth: switchWidth, //width (in px to switch at)
  268. topOptionText: jQuery('.main_menu').data('selectname'), //first option text
  269. indentString: 'ontouchstart' in document.documentElement ? '- ' : "&nbsp;&nbsp;&nbsp;"//string for indenting nested items
  270. });
  271. }
  272. else
  273. {
  274. var container = $('#wrap_all'),
  275. show_menu = $('#advanced_menu_toggle'),
  276. hide_menu = $('#advanced_menu_hide'),
  277. mobile_advanced = menu.clone().attr({id:"mobile-advanced", "class":""}),
  278. menu_added = false;
  279.  
  280. mobile_advanced.find('.noMobile').remove();
  281.  
  282. jQuery(document).on('click', '#mobile-advanced li a[href*=#]', function()
  283. {
  284. container.removeClass('show_mobile_menu');
  285. container.css({'height':"auto"});
  286. });
  287.  
  288. show_menu.click(function()
  289. {
  290. if(container.is('.show_mobile_menu'))
  291. {
  292. container.removeClass('show_mobile_menu');
  293. container.css({'height':"auto"});
  294. }
  295. else
  296. {
  297. container.addClass('show_mobile_menu');
  298. set_height();
  299. }
  300. return false;
  301. });
  302.  
  303. hide_menu.click(function()
  304. {
  305. container.removeClass('show_mobile_menu');
  306. container.css({'height':"auto"});
  307. return false;
  308. });
  309.  
  310.  
  311. var set_visibility = function()
  312. {
  313. if(win.width() > switchWidth)
  314. {
  315. header.removeClass('mobile_active');
  316. container.removeClass('show_mobile_menu');
  317. container.css({'height':"auto"});
  318. }
  319. else
  320. {
  321. header.addClass('mobile_active');
  322. if(!menu_added)
  323. {
  324.  
  325. var after_menu = $('#header .logo');
  326. show_menu.insertAfter(after_menu);
  327. mobile_advanced.prependTo(container);
  328. hide_menu.prependTo(container);
  329. menu_added = true;
  330. }
  331.  
  332. if(container.is('.show_mobile_menu'))
  333. {
  334. set_height();
  335. }
  336. }
  337. },
  338.  
  339. set_height = function()
  340. {
  341. var height = mobile_advanced.css({position:'relative'}).outerHeight(true),
  342. win_h = win.height();
  343.  
  344. if(height < win_h) height = win_h;
  345. mobile_advanced.css({position:'absolute'});
  346. container.css({'height':height});
  347. };
  348.  
  349. win.on("debouncedresize", set_visibility);
  350. set_visibility();
  351. }
  352. }
  353.  
  354.  
  355. // -------------------------------------------------------------------------------------------
  356. //Calculate the width of the header container which contains the logo and the menu, if logo + menu exceed the container size try to reduce the menu item padding and resize the logo
  357. // -------------------------------------------------------------------------------------------
  358.  
  359. function avia_resize_menu()
  360. {
  361. var win = $(window), header = $('#header:not( .bottom_nav_header #header)');
  362. if(!header.length) return;
  363.  
  364. var menu = header.find('.main_menu ul:eq(0)'),
  365. menu_container = header.find('.main_menu'),
  366. logo = header.find('.logo'),
  367. logo_selector = $('#header:not( .bottom_nav_header #header) .logo, #header:not( .bottom_nav_header #header) .logo a img'),
  368. original_item_padding_right = new Array(),
  369. original_item_padding_left = new Array(),
  370. original_menu_width = $(menu).outerWidth(true),
  371. original_logo_width = logo.outerWidth(true),
  372. header_position_changed = 0,
  373. store_menu_data = function()
  374. {
  375. $(menu.find('>li>a').each(function(index,value){
  376. original_item_padding_right[index] = parseInt($(this).css('padding-right').replace("px", ""));
  377. original_item_padding_left[index] = parseInt($(this).css('padding-left').replace("px", ""));
  378. }));
  379.  
  380. $('#header .logo a img').load(function() {
  381. original_logo_width = logo.outerWidth(true);
  382. });
  383. },
  384.  
  385. adjust_menu_width = function()
  386. {
  387. /*
  388. Calculate the width of the header container which contains the logo and the menu, then calculate the logo and menu width and check if we need to take care of an offset
  389. */
  390. var headercontainer = header.find('.container'),
  391. header_width = headercontainer.innerWidth(),
  392. logo_width = logo.outerWidth(true),
  393. menu_width = $(menu).outerWidth(true),
  394. headercontainer_offset = headercontainer.offset(),
  395. logo_offset = logo.offset(),
  396. menu_offset = menu.offset();
  397.  
  398. if(typeof logo_offset == "undefined" || typeof menu_offset == "undefined")
  399. {
  400. var offset_right = 0,
  401. offset_left = 0;
  402. }
  403. else if(logo_offset.left < menu_offset.left)
  404. {
  405. var offset_left = logo_offset.left - headercontainer_offset.left,
  406. offset_right = header_width - (menu_offset.left - headercontainer_offset.left + menu_width);
  407. }
  408. else
  409. {
  410. var offset_left = menu_offset.left - headercontainer_offset.left,
  411. offset_right = header_width - (logo_offset.left - headercontainer_offset.left + logo_width);
  412. }
  413.  
  414. var remaining_space = header_width - (menu_width + offset_left + offset_right + logo_width);
  415.  
  416. if(!header.hasClass('mobile_active'))
  417. {
  418. /*
  419. ok, now try to reduce the padding left/right a bit. Maybe then the logo & menu have enough space
  420. */
  421. var menu_item = $(menu.find('>li>a')),
  422. item_padding_right = new Array(),
  423. item_padding_left = new Array(),
  424. item_ratio = new Array(),
  425. item_ratio_left = new Array(),
  426. item_ratio_right = new Array(),
  427. reduction_space_left = 0,
  428. reduction_space_right = 0;
  429.  
  430. $(menu_item.each(function(index,value){
  431. item_padding_right[index] = parseInt($(this).css('padding-right').replace("px", ""));
  432. item_padding_left[index] = parseInt($(this).css('padding-left').replace("px", ""));
  433. }));
  434.  
  435. $.each(item_padding_right, function(index,value){
  436. reduction_space_right = reduction_space_right + value;
  437. });
  438.  
  439. $.each(item_padding_left, function(index,value){
  440. reduction_space_left = reduction_space_left + value;
  441. });
  442.  
  443. $(menu_item.each(function(index,value){
  444. item_ratio_left[index] = item_padding_left[index] / (item_padding_left[index] + item_padding_right[index]);
  445. item_ratio_right[index] = item_padding_right[index] / (item_padding_left[index] + item_padding_right[index]);
  446. item_ratio[index] = (item_padding_left[index] + item_padding_right[index]) / (reduction_space_right + reduction_space_left);
  447. }));
  448.  
  449. if(original_logo_width > 0) logo_selector.css({'max-width':original_logo_width+'px', 'width':'auto'});
  450.  
  451. if((original_menu_width + original_logo_width + offset_left + offset_right) <= header_width)
  452. {
  453. $(menu_item.each(function(index,value){
  454. $(this).css({"padding-right":original_item_padding_right[index]+"px", "padding-left":original_item_padding_left[index]+"px"});
  455. }));
  456. }
  457. else
  458. {
  459. var total_padding = 0,
  460. left_padding = 0,
  461. right_padding = 0,
  462. new_remaining_space = remaining_space + reduction_space_left + reduction_space_right;
  463.  
  464. $(menu_item.each(function(index,value){
  465. total_padding = new_remaining_space * item_ratio[index];
  466. right_padding = total_padding * item_ratio_right[index];
  467. left_padding = total_padding * item_ratio_left[index];
  468.  
  469. if(original_item_padding_right[index] < right_padding && original_item_padding_left[index] < left_padding)
  470. {
  471. right_padding = original_item_padding_right[index];
  472. left_padding =original_item_padding_left[index];
  473. }
  474. else if(original_item_padding_right[index] < right_padding)
  475. {
  476. right_padding = original_item_padding_right[index];
  477. left_padding = total_padding - right_padding;
  478. }
  479. else if(original_item_padding_left[index] < left_padding)
  480. {
  481. left_padding = original_item_padding_left[index];
  482. right_padding = total_padding - left_padding;
  483. }
  484. else if(right_padding < 6 || left_padding < 6)
  485. {
  486. if(right_padding < 6) right_padding = 6;
  487. if(left_padding < 6) left_padding = 6;
  488. }
  489.  
  490. $(this).css({"padding-right":Math.floor(right_padding)+"px", "padding-left":Math.floor(left_padding)+"px"});
  491. }));
  492.  
  493. if(!header.hasClass('header-scrolled'))
  494. {
  495. logo_width = (header_width - ($(menu).outerWidth(true) + offset_left + offset_right));
  496. if(original_logo_width > 0 && logo_width > original_logo_width) logo_width = original_logo_width;
  497. logo_selector.css({'max-width':logo_width+'px', 'width':'auto'});
  498. }
  499. else
  500. {
  501. logo_selector.css({'max-width':'none', 'width':'auto'});
  502. }
  503.  
  504. }
  505. }
  506. else
  507. {
  508. logo_selector.css({'max-width':'none', 'width':'auto'});
  509. }
  510. },
  511.  
  512. check_header_position_change = function()
  513. {
  514. if(header_position_changed > 0 && !header.hasClass('header-scrolled'))
  515. {
  516. adjust_menu_width();
  517. header_position_changed = 0;
  518. }
  519. else if(header_position_changed == 0 && header.hasClass('header-scrolled'))
  520. {
  521. adjust_menu_width();
  522. header_position_changed = 1;
  523. }
  524. }
  525.  
  526. if(!($('body').hasClass('avia_deactivate_menu_resize')))
  527. {
  528. store_menu_data();
  529. win.on("debouncedresize", adjust_menu_width);
  530. adjust_menu_width();
  531. var check_header_position_change = self.setInterval(check_header_position_change, 500);
  532. //win.on('scroll', adjust_menu_width);
  533. }
  534. }
  535.  
  536.  
  537. // -------------------------------------------------------------------------------------------
  538. // html 5 videos
  539. // -------------------------------------------------------------------------------------------
  540. $.fn.avia_html5_activation = function(options)
  541. {
  542. var defaults =
  543. {
  544. ratio: '16:9'
  545. };
  546.  
  547. var options = $.extend(defaults, options);
  548.  
  549. return this.each(function()
  550. {
  551. var fv = $(this),
  552. id_to_apply = '#' + fv.attr('id'),
  553. posterImg = fv.attr('poster');
  554.  
  555.  
  556. fv.mediaelementplayer({
  557. // if the <video width> is not specified, this is the default
  558. defaultVideoWidth: 480,
  559. // if the <video height> is not specified, this is the default
  560. defaultVideoHeight: 270,
  561. // if set, overrides <video width>
  562. videoWidth: -1,
  563. // if set, overrides <video height>
  564. videoHeight: -1,
  565. // width of audio player
  566. audioWidth: 400,
  567. // height of audio player
  568. audioHeight: 30,
  569. // initial volume when the player starts
  570. startVolume: 0.8,
  571. // useful for <audio> player loops
  572. loop: false,
  573. // enables Flash and Silverlight to resize to content size
  574. enableAutosize: true,
  575. // the order of controls you want on the control bar (and other plugins below)
  576. features: ['playpause','progress','current','duration','tracks','volume','fullscreen'],
  577. // Hide controls when playing and mouse is not over the video
  578. alwaysShowControls: false,
  579. // force iPad's native controls
  580. iPadUseNativeControls: false,
  581. // force iPhone's native controls
  582. iPhoneUseNativeControls: false,
  583. // force Android's native controls
  584. AndroidUseNativeControls: false,
  585. // forces the hour marker (##:00:00)
  586. alwaysShowHours: false,
  587. // show framecount in timecode (##:00:00:00)
  588. showTimecodeFrameCount: false,
  589. // used when showTimecodeFrameCount is set to true
  590. framesPerSecond: 25,
  591. // turns keyboard support on and off for this instance
  592. enableKeyboard: true,
  593. // when this player starts, it will pause other players
  594. pauseOtherPlayers: true,
  595. // array of keyboard commands
  596. keyActions: []
  597.  
  598. });
  599. });
  600. }
  601.  
  602.  
  603.  
  604. // -------------------------------------------------------------------------------------------
  605. // hover effect for images
  606. // -------------------------------------------------------------------------------------------
  607. function avia_hover_effect(container)
  608. {
  609. if(container == 'body')
  610. {
  611. var elements = $('#main a img').parents('a').not('.noLightbox, .noLightbox a, .avia-gallery-thumb a, .avia-layerslider a, .noHover, .noHover a').add('#main .avia-hover-fx');
  612. }
  613. else
  614. {
  615. var elements = $('a img', container).parents('a').not('.noLightbox, .noLightbox a, .avia-gallery-thumb a, .avia-layerslider a, .noHover, .noHover a').add('.avia-hover-fx', container);
  616. }
  617.  
  618. var overlay = "", isMobile = 'ontouchstart' in document.documentElement;
  619.  
  620. if(isMobile) return; //hover overlay for mobile device doesnt really make sense. in addition it often slows done the click event
  621.  
  622. elements.each(function(e)
  623. {
  624. var link = $(this), current = link.find('img:first');
  625.  
  626. if(current.hasClass('alignleft')) link.addClass('alignleft').css({float:'left', margin:0, padding:0});
  627. if(current.hasClass('alignright')) link.addClass('alignright').css({float:'right', margin:0, padding:0});
  628. if(current.hasClass('aligncenter')) link.addClass('aligncenter').css({float:'none','text-align':'center', margin:0, padding:0});
  629.  
  630. if(current.hasClass('alignnone'))
  631. {
  632. link.addClass('alignnone').css({margin:0, padding:0});;
  633. if(!link.css('display') || link.css('display') == 'inline') { link.css({display:'inline-block'}); }
  634. }
  635. });
  636.  
  637. elements.on('mouseenter', function(e)
  638. {
  639. var link = $(this),
  640. current = link.find('img:first'),
  641. url = link.attr('href'),
  642. span_class = "overlay-type-video",
  643. opa = link.data('opacity') || 0.7;
  644.  
  645. overlay = link.find('.image-overlay');
  646.  
  647. if(!overlay.length)
  648. {
  649. if(current.outerHeight() > 100)
  650. {
  651. if(link.height() == 0) { link.addClass(current.get(0).className); current.get(0).className = ""; }
  652. if(!link.css('position') || link.css('position') == 'static') { link.css({position:'relative', overflow:'hidden'}); }
  653. if(!link.css('display') || link.css('display') == 'inline') { link.css({display:'block'}); }
  654.  
  655. if(url)
  656. {
  657. if( url.match(/(jpg|gif|jpeg|png|tif)/) ) span_class = "overlay-type-image";
  658. if(!url.match(/(jpg|gif|jpeg|png|\.tif|\.mov|\.swf|vimeo\.com|youtube\.com)/) ) span_class = "overlay-type-extern";
  659. }
  660.  
  661. overlay = $("<span class='image-overlay "+span_class+"' style='opacity: 0;'><span class='image-overlay-inside'></span></span>").appendTo(link);
  662. }
  663. }
  664.  
  665. if(current.outerHeight() > 100)
  666. {
  667. overlay.css({left:current.position().left + parseInt(current.css("margin-left"),10), top:current.position().top + parseInt(current.css("margin-top"),10)})
  668. .css({display:'block','height':current.outerHeight(),'width':current.outerWidth()}).stop().animate({opacity:opa}, 400);
  669. }
  670. else
  671. {
  672. overlay.css({display:"none"});
  673. }
  674.  
  675. }).on('mouseleave', elements, function(){
  676.  
  677. if(overlay.length)
  678. {
  679. overlay.stop().animate({opacity:0}, 400);
  680. }
  681. });
  682.  
  683. }
  684.  
  685.  
  686.  
  687.  
  688.  
  689.  
  690.  
  691.  
  692. // -------------------------------------------------------------------------------------------
  693. // Smooth scrooling when clicking on anchor links
  694. // -------------------------------------------------------------------------------------------
  695.  
  696. (function($)
  697. {
  698. $.fn.avia_smoothscroll = function(variables)
  699. {
  700. var fixedMainPadding = parseInt($('.fixed_header #main').css('padding-top'),10) / 2 || 0;
  701. fixedMainPadding += parseInt($('html').css('margin-top'),10);
  702.  
  703.  
  704. return this.each(function()
  705. {
  706. $(this).click(function(e) {
  707.  
  708. var newHash = this.hash,
  709. clicked = $(this),
  710. data = clicked.data();
  711.  
  712. if(newHash != '' && newHash != '#' && newHash != '#prev' && newHash != '#next' && !$(this).is('.comment-reply-link, #cancel-comment-reply-link, .no-scroll'))
  713. {
  714. var container = $(this.hash);
  715.  
  716. if(container.length)
  717. {
  718. var target = container.offset().top - fixedMainPadding,
  719. oldLocation=window.location.href.replace(window.location.hash, ''),
  720. newLocation=this,
  721. duration= data.duration || 800,
  722. easing= data.easing || 'easeOutQuint';
  723.  
  724. // make sure it's the same location
  725. if(oldLocation+newHash==newLocation)
  726. {
  727. // animate to target and set the hash to the window.location after the animation
  728. $('html:not(:animated),body:not(:animated)').animate({ scrollTop: target }, duration, easing, function() {
  729.  
  730. // add new hash to the browser location
  731. //window.location.href=newLocation;
  732. if(window.history.replaceState)
  733. window.history.replaceState("", "", newLocation);
  734. });
  735.  
  736. // cancel default click action
  737. e.preventDefault();
  738. }
  739. }
  740. }
  741. });
  742. });
  743. };
  744. })(jQuery);
  745.  
  746.  
  747. // -------------------------------------------------------------------------------------------
  748. // iframe fix for firefox and ie so they get proper z index
  749. // -------------------------------------------------------------------------------------------
  750. function avia_iframe_fix(container)
  751. {
  752. var iframe = jQuery('iframe[src*="youtube.com"]', container),
  753. youtubeEmbed = jQuery('iframe[src*="youtube.com"] object, iframe[src*="youtube.com"] embed', container).attr('wmode','opaque');
  754.  
  755. iframe.each(function()
  756. {
  757. var current = jQuery(this),
  758. src = current.attr('src');
  759.  
  760. if(src)
  761. {
  762. if(src.indexOf('?') !== -1)
  763. {
  764. src += "&wmode=opaque";
  765. }
  766. else
  767. {
  768. src += "?wmode=opaque";
  769. }
  770.  
  771. current.attr('src', src);
  772. }
  773. });
  774. }
  775.  
  776. // -------------------------------------------------------------------------------------------
  777. // small js fixes for pixel perfection :)
  778. // -------------------------------------------------------------------------------------------
  779. function avia_small_fixes(container)
  780. {
  781. if(!container) container = document;
  782.  
  783. //make sure that iframes do resize correctly. uses css padding bottom iframe trick
  784. var win = jQuery(window),
  785. iframes = jQuery('.avia-iframe-wrap iframe:not(.avia-slideshow iframe):not( iframe.no_resize):not(.avia-video iframe)', container),
  786. adjust_iframes = function()
  787. {
  788. iframes.each(function(){
  789.  
  790. var iframe = jQuery(this), parent = iframe.parent(), proportions = 56.25;
  791.  
  792. if(this.width && this.height)
  793. {
  794. proportions = (100/ this.width) * this.height;
  795. parent.css({"padding-bottom":proportions+"%"});
  796. }
  797. });
  798. };
  799.  
  800. adjust_iframes();
  801.  
  802. }
  803.  
  804. // -------------------------------------------------------------------------------------------
  805. // Ligthbox activation
  806. // -------------------------------------------------------------------------------------------
  807.  
  808. (function($)
  809. {
  810. $.fn.avia_activate_lightbox = function(variables)
  811. {
  812. var defaults =
  813. {
  814. autolinkElements: 'a[rel^="prettyPhoto"], a[rel^="lightbox"], a[href$=jpg], a[href$=png], a[href$=gif], a[href$=jpeg], a[href$=".mov"] , a[href$=".swf"] , a[href*="vimeo.com"] , a[href*="youtube.com/watch"] , a[href*="screenr.com"]'
  815. };
  816.  
  817. var options = $.extend(defaults, variables),
  818. win = $(window),
  819. ww = parseInt(win.width(),10) * 0.8, //controls the default lightbox width: 80% of the window size
  820. wh = (ww/16)*9; //controls the default lightbox height (16:9 ration for videos. images are resized by the lightbox anyway)
  821.  
  822.  
  823. return this.each(function()
  824. {
  825. var elements = $(options.autolinkElements, this).not('.noLightbox, .noLightbox a, .fakeLightbox'),
  826. lastParent = "",
  827. counter = 0;
  828.  
  829. elements.each(function()
  830. {
  831. var el = $(this),
  832. rel = el.data('rel'),
  833. parentPost = el.parents('.content:eq(0)'),
  834. group = 'auto_group';
  835.  
  836. if(parentPost.get(0) != lastParent)
  837. {
  838. lastParent = parentPost.get(0);
  839. counter ++;
  840. }
  841.  
  842. if(rel != "" && typeof rel != 'undefined')
  843. {
  844. el.attr('rel','lightbox['+rel+']');
  845. }
  846.  
  847. if((el.attr('rel') == undefined || el.attr('rel') == '') && !el.hasClass('noLightbox'))
  848. {
  849. if(elements.length > 1)
  850. {
  851. el.attr('rel','lightbox['+group+counter+']');
  852. }
  853. else
  854. {
  855. el.attr('rel','lightbox');
  856. }
  857. }
  858. });
  859.  
  860. if(options.callback) var callbackfn = window[options.callback];
  861.  
  862. if(typeof(callbackfn) !== 'undefined' && typeof(callbackfn) === "function")
  863. {
  864. callbackfn(elements,ww,wh);
  865. }
  866. else
  867. {
  868. if($.fn.prettyPhoto)
  869. elements.prettyPhoto({ social_tools:'',slideshow: 5000, deeplinking: false, overlay_gallery:false, default_width: ww, default_height: wh });
  870. }
  871.  
  872. });
  873. };
  874. })(jQuery);
  875.  
  876.  
  877.  
  878. // -------------------------------------------------------------------------------------------
  879. // Avia Menu
  880. // -------------------------------------------------------------------------------------------
  881.  
  882. (function($)
  883. {
  884. $.fn.aviaMegamenu = function(variables)
  885. {
  886. var defaults =
  887. {
  888. modify_position:true,
  889. delay:300
  890. };
  891.  
  892. var options = $.extend(defaults, variables);
  893.  
  894. return this.each(function()
  895. {
  896. var left_menu = $('html:first').is('.bottom_nav_header'),
  897. isMobile = 'ontouchstart' in document.documentElement,
  898. menu = $(this),
  899. menuItems = menu.find(">li"),
  900. megaItems = menuItems.find(">div").parent().css({overflow:'hidden'}),
  901. menuActive = menu.find('>.current-menu-item>a, >.current_page_item>a'),
  902. dropdownItems = menuItems.find(">ul").parent(),
  903. parentContainer = menu.parent(),
  904. mainMenuParent = menu.parents('.main_menu').eq(0),
  905. parentContainerWidth = parentContainer.width(),
  906. delayCheck = {},
  907. mega_open = [];
  908.  
  909. if(!menuActive.length){ menu.find('.current-menu-ancestor:eq(0) a:eq(0), .current_page_ancestor:eq(0) a:eq(0)').parent().addClass('active-parent-item')}
  910.  
  911. menuItems.on('click' ,'a', function()
  912. {
  913. if(this.href == window.location.href + "#" || this.href == window.location.href + "/#")
  914. return false;
  915. });
  916.  
  917. menuItems.each(function()
  918. {
  919. var item = $(this),
  920. pos = item.position(),
  921. megaDiv = item.find("div:first").css({opacity:0, display:"none"}),
  922. normalDropdown = "";
  923.  
  924. //check if we got a mega menu
  925. if(!megaDiv.length)
  926. {
  927. normalDropdown = item.find(">ul").css({display:"none"});
  928. }
  929.  
  930. //if we got a mega menu or dropdown menu add the arrow beside the menu item
  931. if(megaDiv.length || normalDropdown.length)
  932. {
  933. var link = item.addClass('dropdown_ul_available').find('>a');
  934. link.append('<span class="dropdown_available"></span>');
  935.  
  936. //is a mega menu main item doesnt have a link to click use the default cursor
  937. if(typeof link.attr('href') != 'string' || link.attr('href') == "#"){ link.css('cursor','default').click(function(){return false;}); }
  938. }
  939.  
  940.  
  941. //correct position of mega menus
  942. if(options.modify_position && megaDiv.length)
  943. {
  944. if(!left_menu)
  945. {
  946. if(pos.left + megaDiv.width() < parentContainerWidth)
  947. {
  948. megaDiv.css({right: -megaDiv.outerWidth() + item.outerWidth() });
  949. //item.css({position:'static'});
  950. }
  951. else if(pos.left + megaDiv.width() > parentContainerWidth)
  952. {
  953. megaDiv.css({right: -mainMenuParent.outerWidth() + (pos.left + item.outerWidth() ) });
  954. }
  955. }
  956. else
  957. {
  958. if(megaDiv.width() > pos.left + item.outerWidth())
  959. {
  960. megaDiv.css({left: (pos.left* -1)});
  961. }
  962. else if(pos.left + megaDiv.width() > parentContainerWidth)
  963. {
  964. megaDiv.css({left: (megaDiv.width() - pos.left) * -1 });
  965. }
  966. }
  967. }
  968.  
  969.  
  970.  
  971. });
  972.  
  973.  
  974. function megaDivShow(i)
  975. {
  976. if(delayCheck[i] == true)
  977. {
  978. var item = megaItems.filter(':eq('+i+')').css({overflow:'visible'}).find("div:first"),
  979. link = megaItems.filter(':eq('+i+')').find("a:first");
  980. mega_open["check"+i] = true;
  981.  
  982. item.stop().css('display','block').animate({opacity:1},300);
  983.  
  984. if(item.length)
  985. {
  986. link.addClass('open-mega-a');
  987. }
  988. }
  989. }
  990.  
  991. function megaDivHide (i)
  992. {
  993. if(delayCheck[i] == false)
  994. {
  995. megaItems.filter(':eq('+i+')').find(">a").removeClass('open-mega-a');
  996.  
  997. var listItem = megaItems.filter(':eq('+i+')'),
  998. item = listItem.find("div:first");
  999.  
  1000.  
  1001. item.stop().css('display','block').animate({opacity:0},300, function()
  1002. {
  1003. $(this).css('display','none');
  1004. listItem.css({overflow:'hidden'});
  1005. mega_open["check"+i] = false;
  1006. });
  1007. }
  1008. }
  1009.  
  1010. if(isMobile)
  1011. {
  1012. megaItems.each(function(i){
  1013.  
  1014. $(this).bind('click', function()
  1015. {
  1016. if(mega_open["check"+i] != true) return false;
  1017. });
  1018. });
  1019. }
  1020.  
  1021.  
  1022. //bind event for mega menu
  1023. megaItems.each(function(i){
  1024.  
  1025. $(this).hover(
  1026.  
  1027. function()
  1028. {
  1029. delayCheck[i] = true;
  1030. setTimeout(function(){megaDivShow(i); },options.delay);
  1031. },
  1032.  
  1033. function()
  1034. {
  1035. delayCheck[i] = false;
  1036. setTimeout(function(){megaDivHide(i); },options.delay);
  1037. }
  1038. );
  1039. });
  1040.  
  1041.  
  1042. // bind events for dropdown menu
  1043. dropdownItems.find('li').andSelf().each(function()
  1044. {
  1045. var currentItem = $(this),
  1046. sublist = currentItem.find('ul:first'),
  1047. showList = false;
  1048.  
  1049. if(sublist.length)
  1050. {
  1051. sublist.css({display:'block', opacity:0, visibility:'hidden'});
  1052. var currentLink = currentItem.find('>a');
  1053.  
  1054. currentLink.bind('mouseenter', function()
  1055. {
  1056. sublist.stop().css({visibility:'visible'}).animate({opacity:1});
  1057. });
  1058.  
  1059. currentItem.bind('mouseleave', function()
  1060. {
  1061. sublist.stop().animate({opacity:0}, function()
  1062. {
  1063. sublist.css({visibility:'hidden'});
  1064. });
  1065. });
  1066.  
  1067. }
  1068.  
  1069. });
  1070.  
  1071. });
  1072. };
  1073. })(jQuery);
  1074.  
  1075.  
  1076.  
  1077.  
  1078. // -------------------------------------------------------------------------------------------
  1079. //Portfolio sorting
  1080. // -------------------------------------------------------------------------------------------
  1081.  
  1082. $.fn.avia_iso_sort = function(options)
  1083. {
  1084. $.extend( $.Isotope.prototype, {
  1085. _customModeReset : function() {
  1086.  
  1087. this.fitRows = {
  1088. x : 0,
  1089. y : 0,
  1090. height : 0
  1091. };
  1092.  
  1093. },
  1094. _customModeLayout : function( $elems ) {
  1095.  
  1096. var instance = this,
  1097. containerWidth = this.element.width(),
  1098. props = this.fitRows,
  1099. percentBase = this.element.data('margin_base') || 6,
  1100. margin = this.element.is('.no_margin-container') ? 0 : (containerWidth / 100) * percentBase, //margin based on %
  1101. extraRange = 2; // adds a little range for % based calculation error in some browsers
  1102.  
  1103. $elems.each( function() {
  1104. var $this = $(this),
  1105. atomW = $this.outerWidth() ,
  1106. atomH = $this.outerHeight(true);
  1107.  
  1108. if ( props.x !== 0 && atomW + props.x > containerWidth + extraRange ) {
  1109. // if this element cannot fit in the current row
  1110. props.x = 0;
  1111. props.y = props.height;
  1112. }
  1113.  
  1114. //webkit gets blurry elements if position is a float value
  1115. props.x = Math.round(props.x);
  1116. props.y = Math.round(props.y);
  1117.  
  1118. // position the atom
  1119. instance._pushPosition( $this, props.x, props.y );
  1120.  
  1121. props.height = Math.max( props.y + atomH, props.height );
  1122. props.x += atomW + margin;
  1123.  
  1124.  
  1125. });
  1126.  
  1127. },
  1128. _customModeGetContainerSize : function() {
  1129.  
  1130. return { height : this.fitRows.height };
  1131.  
  1132. },
  1133. _customModeResizeChanged : function() {
  1134.  
  1135. return true;
  1136.  
  1137. }
  1138. });
  1139.  
  1140.  
  1141.  
  1142. return this.each(function()
  1143. {
  1144. var the_body = $('body'),
  1145. container = $(this),
  1146. portfolio_id = container.data('portfolio-id'),
  1147. parentContainer = container.parents('.entry-content-wrapper'),
  1148. filter = parentContainer.find('.sort_width_container[data-portfolio-id="' + portfolio_id + '"]').find('#js_sort_items').css({visibility:"visible", opacity:0}),
  1149. links = filter.find('a'),
  1150. imgParent = container.find('.grid-image'),
  1151. isoActive = false,
  1152. items = $('.post-entry', container);
  1153.  
  1154. function applyIso()
  1155. {
  1156. container.addClass('isotope_activated').isotope({
  1157. layoutMode : 'customMode', itemSelector : '.flex_column'
  1158. }, function()
  1159. {
  1160. container.css({overflow:'visible'});
  1161. the_body.trigger('av_resize_finished');
  1162. });
  1163.  
  1164. isoActive = true;
  1165. setTimeout(function(){ parentContainer.addClass('avia_sortable_active'); }, 0);
  1166. };
  1167.  
  1168. links.bind('click',function()
  1169. {
  1170. var current = $(this),
  1171. selector = current.data('filter');
  1172.  
  1173. links.removeClass('active_sort');
  1174. current.addClass('active_sort');
  1175. container.attr('id', 'grid_id_'+selector);
  1176.  
  1177. parentContainer.find('.open_container .ajax_controlls .avia_close').trigger('click');
  1178. //container.css({overflow:'hidden'})
  1179. container.isotope({ layoutMode : 'customMode', itemSelector : '.flex_column' , filter: '.'+selector}, function()
  1180. {
  1181. container.css({overflow:'visible'});
  1182. the_body.trigger('av_resize_finished');
  1183. });
  1184.  
  1185. return false;
  1186. });
  1187.  
  1188. // update columnWidth on window resize
  1189. $(window).smartresize(function()
  1190. {
  1191. applyIso();
  1192. });
  1193.  
  1194. $.avia_utilities.preload({container: container, single_callback: function()
  1195. {
  1196. filter.animate({opacity:1}, 400); applyIso();
  1197.  
  1198. //call a second time to for the initial resizing
  1199. setTimeout(function(){ applyIso(); });
  1200.  
  1201. imgParent.css({height:'auto'}).each(function(i)
  1202. {
  1203. var currentLink = $(this);
  1204.  
  1205. setTimeout(function()
  1206. {
  1207. currentLink.animate({opacity:1},1500);
  1208. }, (100 * i));
  1209. });
  1210. }
  1211. });
  1212.  
  1213. });
  1214. };
  1215.  
  1216.  
  1217.  
  1218.  
  1219. //check if the browser supports element rotation
  1220. function avia_header_size()
  1221. {
  1222. var win = $(window),
  1223. header = $('.fixed_header #header'),
  1224. //logo = header.find('.logo img'),
  1225. logo = $('#header_main .container .logo img, #header_main .container .logo a'),
  1226. elements = $('#header_main .container, .main_menu ul:first-child > li > a:not(.avia_mega_div a)'),
  1227. el_height = $(elements).filter(':first').height(),
  1228. isMobile = 'ontouchstart' in document.documentElement,
  1229. scroll_top = $('#scroll-top-link'),
  1230. set_height = function()
  1231. {
  1232. var st = win.scrollTop(), newH = 0;
  1233.  
  1234. if(st < el_height/2)
  1235. {
  1236. newH = el_height - st;
  1237. header.removeClass('header-scrolled');
  1238. }
  1239. else
  1240. {
  1241. newH = el_height/2;
  1242. header.addClass('header-scrolled');
  1243. }
  1244.  
  1245. elements.css({'height': newH + 'px', 'lineHeight': newH + 'px'});
  1246. logo.css({'maxHeight': newH + 'px'});
  1247. }
  1248.  
  1249. if(!header.length) return false;
  1250.  
  1251. if(isMobile)
  1252. {
  1253. return false;
  1254. }
  1255.  
  1256. win.scroll(set_height);
  1257. set_height();
  1258. }
  1259.  
  1260.  
  1261. //check if the browser supports element rotation
  1262. function avia_scroll_top_fade()
  1263. {
  1264. var win = $(window),
  1265. timeo = false,
  1266. scroll_top = $('#scroll-top-link'),
  1267. set_status = function()
  1268. {
  1269. var st = win.scrollTop();
  1270.  
  1271. if(st < 500)
  1272. {
  1273. scroll_top.removeClass('avia_pop_class');
  1274. }
  1275. else if(!scroll_top.is('.avia_pop_class'))
  1276. {
  1277. scroll_top.addClass('avia_pop_class');
  1278. }
  1279. };
  1280.  
  1281. win.scroll(set_status);
  1282. set_status();
  1283. }
  1284.  
  1285.  
  1286.  
  1287.  
  1288. $.AviaAjaxSearch = function(options)
  1289. {
  1290. var defaults = {
  1291. delay: 300, //delay in ms until the user stops typing.
  1292. minChars: 3, //dont start searching before we got at least that much characters
  1293. scope: 'body'
  1294.  
  1295. }
  1296.  
  1297. this.options = $.extend({}, defaults, options);
  1298. this.scope = $(this.options.scope);
  1299. this.timer = false;
  1300. this.lastVal = "";
  1301.  
  1302. this.bind_events();
  1303. }
  1304.  
  1305.  
  1306. $.AviaAjaxSearch.prototype =
  1307. {
  1308. bind_events: function()
  1309. {
  1310. this.scope.on('keyup', '#s:not(".av_disable_ajax_search #s")' , $.proxy( this.try_search, this));
  1311. },
  1312.  
  1313. try_search: function(e)
  1314. {
  1315. clearTimeout(this.timer);
  1316.  
  1317. //only execute search if chars are at least "minChars" and search differs from last one
  1318. if(e.currentTarget.value.length >= this.options.minChars && this.lastVal != $.trim(e.currentTarget.value))
  1319. {
  1320. //wait at least "delay" miliseconds to execute ajax. if user types again during that time dont execute
  1321. this.timer = setTimeout($.proxy( this.do_search, this, e), this.options.delay);
  1322. }
  1323. },
  1324.  
  1325. do_search: function(e)
  1326. {
  1327. var obj = this,
  1328. currentField = $(e.currentTarget).attr( "autocomplete", "off" ),
  1329. form = currentField.parents('form:eq(0)'),
  1330. results = form.find('.ajax_search_response'),
  1331. loading = $('<div class="ajax_load"><span class="ajax_load_inner"></span></div>'),
  1332. action = form.attr('action'),
  1333. values = form.serialize();
  1334. values += '&action=avia_ajax_search';
  1335.  
  1336. //check if the form got get parameters applied and also apply them
  1337. if(action.indexOf('?') != -1)
  1338. {
  1339. action = action.split('?');
  1340. values += "&" + action[1];
  1341. }
  1342.  
  1343. if(!results.length) results = $('<div class="ajax_search_response"></div>').appendTo(form);
  1344.  
  1345. //return if we already hit a no result and user is still typing
  1346. if(results.find('.ajax_not_found').length && e.currentTarget.value.indexOf(this.lastVal) != -1) return;
  1347.  
  1348. this.lastVal = e.currentTarget.value;
  1349.  
  1350. $.ajax({
  1351. url: avia_framework_globals.ajaxurl,
  1352. type: "POST",
  1353. data:values,
  1354. beforeSend: function()
  1355. {
  1356. loading.insertAfter(currentField);
  1357. },
  1358. success: function(response)
  1359. {
  1360. if(response == 0) response = "";
  1361. results.html(response);
  1362. },
  1363. complete: function()
  1364. {
  1365. loading.remove();
  1366. }
  1367. });
  1368. }
  1369. }
  1370.  
  1371.  
  1372.  
  1373.  
  1374.  
  1375.  
  1376.  
  1377.  
  1378.  
  1379.  
  1380. $.AviaTooltip = function(options)
  1381. {
  1382. var defaults = {
  1383. delay: 1500, //delay in ms until the tooltip appears
  1384. delayOut: 300, //delay in ms when instant showing should stop
  1385. "class": "avia-tooltip", //tooltip classname for css styling and alignment
  1386. scope: "body", //area the tooltip should be applied to
  1387. data: "avia-tooltip", //data attribute that contains the tooltip text
  1388. attach:"body", //either attach the tooltip to the "mouse" or to the "element" // todo: implement mouse, make sure that it doesnt overlap with screen borders
  1389. event: 'mouseenter', //mousenter and leave or click and leave
  1390. position:'top' //top or bottom
  1391. }
  1392.  
  1393. this.options = $.extend({}, defaults, options);
  1394. this.body = $('body');
  1395. this.scope = $(this.options.scope);
  1396. this.tooltip = $('<div class="'+this.options['class']+' avia-tt"><span class="avia-arrow-wrap"><span class="avia-arrow"></span></span></div>');
  1397. this.inner = $('<div class="inner_tooltip"></div>').prependTo(this.tooltip);
  1398. this.open = false;
  1399. this.timer = false;
  1400. this.active = false;
  1401.  
  1402. this.bind_events();
  1403. }
  1404.  
  1405. $.AviaTooltip.openTTs = [];
  1406. $.AviaTooltip.prototype =
  1407. {
  1408. bind_events: function()
  1409. {
  1410. this.scope.on(this.options.event + ' mouseleave', '[data-'+this.options.data+']', $.proxy( this.start_countdown, this) );
  1411.  
  1412. if(this.options.event != 'click')
  1413. {
  1414. this.scope.on('mouseleave', '[data-'+this.options.data+']', $.proxy( this.hide_tooltip, this) );
  1415. }
  1416. else
  1417. {
  1418. this.body.on('mousedown', $.proxy( this.hide_tooltip, this) );
  1419. }
  1420. },
  1421.  
  1422. start_countdown: function(e)
  1423. {
  1424. clearTimeout(this.timer);
  1425.  
  1426. if(e.type == this.options.event)
  1427. {
  1428. var delay = this.options.event == 'click' ? 0 : this.open ? 0 : this.options.delay;
  1429.  
  1430. this.timer = setTimeout($.proxy( this.display_tooltip, this, e), delay);
  1431. }
  1432. else if(e.type == 'mouseleave')
  1433. {
  1434. this.timer = setTimeout($.proxy( this.stop_instant_open, this, e), this.options.delayOut);
  1435. }
  1436. e.preventDefault();
  1437. },
  1438.  
  1439. reset_countdown: function(e)
  1440. {
  1441. clearTimeout(this.timer);
  1442. this.timer = false;
  1443. },
  1444.  
  1445. display_tooltip: function(e)
  1446. {
  1447. var element = $(e.currentTarget),
  1448. text = element.data(this.options.data),
  1449. newTip = element.data('avia-created-tooltip'),
  1450. attach = this.options.attach == 'element' ? element : this.body,
  1451. offset = this.options.attach == 'element' ? element.position() : element.offset();
  1452.  
  1453. this.inner.html(text);
  1454. newTip = typeof newTip != 'undefined' ? $.AviaTooltip.openTTs[newTip] : this.options.attach == 'element' ? this.tooltip.clone().insertAfter(attach) : this.tooltip.clone().appendTo(attach);
  1455. this.open = true;
  1456. this.active = newTip;
  1457.  
  1458. if((newTip.is(':animated:visible') && e.type == 'click') || element.is('.'+this.options['class']) || element.parents('.'+this.options['class']).length != 0) return;
  1459.  
  1460.  
  1461. var real_top = offset.top - newTip.outerHeight(),
  1462. real_left = (offset.left + (element.outerWidth() / 2)) - (newTip.outerWidth() / 2);
  1463.  
  1464. if(this.options.position == 'bottom')
  1465. {
  1466. real_top = offset.top + element.outerHeight();
  1467. }
  1468.  
  1469. newTip.css({opacity:0, display:'block', top: real_top - 10, left: real_left }).stop().animate({top: real_top, opacity:1},200);
  1470. newTip.find('input, textarea').focus();
  1471. $.AviaTooltip.openTTs.push(newTip);
  1472. element.data('avia-created-tooltip', $.AviaTooltip.openTTs.length - 1);
  1473.  
  1474. },
  1475.  
  1476. hide_tooltip: function(e)
  1477. {
  1478. var element = $(e.currentTarget) , newTip, animateTo;
  1479.  
  1480. if(this.options.event == 'click')
  1481. {
  1482. element = $(e.target);
  1483.  
  1484. if(!element.is('.'+this.options['class']) && element.parents('.'+this.options['class']).length == 0)
  1485. {
  1486. if(this.active.length) { newTip = this.active; this.active = false;}
  1487. }
  1488. }
  1489. else
  1490. {
  1491. newTip = element.data('avia-created-tooltip');
  1492. newTip = typeof newTip != 'undefined' ? $.AviaTooltip.openTTs[newTip] : false;
  1493. }
  1494.  
  1495. if(newTip)
  1496. {
  1497. animateTo = parseInt(newTip.css('top'),10) - 10;
  1498. newTip.animate({top: animateTo, opacity:0},200, function()
  1499. {
  1500. newTip.css({display:'none'});
  1501.  
  1502. });
  1503. }
  1504. },
  1505.  
  1506. stop_instant_open: function(e)
  1507. {
  1508. this.open = false;
  1509. }
  1510. }
  1511.  
  1512.  
  1513. })( jQuery );
  1514.  
  1515.  
  1516.  
  1517. (function($){
  1518.  
  1519. //variable for storing the menu count when no ID is present
  1520. var menuCount = 0;
  1521.  
  1522. //plugin code
  1523. $.fn.mobileMenu = function(options){
  1524.  
  1525. //plugin's default options
  1526. var settings = {
  1527. switchWidth: 768,
  1528. topOptionText: 'Select a page',
  1529. indentString: '&nbsp;&nbsp;&nbsp;'
  1530. };
  1531.  
  1532.  
  1533. //function to check if selector matches a list
  1534. function isList($this){
  1535. return $this.is('ul, ol');
  1536. }
  1537.  
  1538.  
  1539. //function to decide if mobile or not
  1540. function isMobile(){
  1541. var header = $('.responsive #header');
  1542.  
  1543. if($(window).width() < settings.switchWidth)
  1544. {
  1545. header.addClass('mobile_active');
  1546. return true;
  1547. }
  1548. else
  1549. {
  1550. header.removeClass('mobile_active');
  1551. return false;
  1552. }
  1553. }
  1554.  
  1555.  
  1556. //check if dropdown exists for the current element
  1557. function menuExists($this){
  1558.  
  1559. //if the list has an ID, use it to give the menu an ID
  1560. if($this.attr('id')){
  1561. return ($('#mobileMenu_'+$this.attr('id')).length > 0);
  1562. }
  1563.  
  1564. //otherwise, give the list and select elements a generated ID
  1565. else {
  1566. menuCount++;
  1567. $this.attr('id', 'mm'+menuCount);
  1568. return ($('#mobileMenu_mm'+menuCount).length > 0);
  1569. }
  1570. }
  1571.  
  1572.  
  1573. //change page on mobile menu selection
  1574. function goToPage($this){
  1575. if($this.val() !== null){document.location.href = $this.val()}
  1576. }
  1577.  
  1578.  
  1579. //show the mobile menu
  1580. function showMenu($this){
  1581. $this.css('display', 'none');
  1582. $('#mobileMenu_'+$this.attr('id')).show();
  1583. }
  1584.  
  1585.  
  1586. //hide the mobile menu
  1587. function hideMenu($this){
  1588. $this.css('display', '');
  1589. $('#mobileMenu_'+$this.attr('id')).hide();
  1590. }
  1591.  
  1592.  
  1593. //create the mobile menu
  1594. function createMenu($this){
  1595. if(isList($this)){
  1596.  
  1597. //generate select element as a string to append via jQuery
  1598. var selectString = '<select id="mobileMenu_'+$this.attr('id')+'" class="mobileMenu">';
  1599.  
  1600. //create first option (no value)
  1601. selectString += '<option value="">'+settings.topOptionText+'</option>';
  1602.  
  1603. //loop through list items
  1604. var active_found = false;
  1605.  
  1606. $this.find('li').each(function(){
  1607.  
  1608. //when sub-item, indent
  1609. var levelStr = '', disabled = '', selected = '', skip = false, current = $(this);
  1610. var len = current.parents('ul, ol').length;
  1611. for(i=1;i<len;i++){levelStr += settings.indentString;}
  1612.  
  1613. //get url and text for option
  1614. var link = current.find('a:first-child').attr('href');
  1615. var the_clone = current.clone();
  1616.  
  1617. if(!active_found)
  1618. {
  1619. if(the_clone.is('.current-menu-item') || the_clone.is('.current_page_item'))
  1620. {
  1621. selected = ' selected = "selected"';
  1622. active_found = true;
  1623. }
  1624. }
  1625.  
  1626. if(the_clone.find('.avia_mega_text_block').length && the_clone.find('li:not(.avia_mega_text_block)').length == 0)
  1627. {
  1628. skip = true;
  1629. }
  1630.  
  1631. if(the_clone.is('.noMobile'))
  1632. {
  1633. skip = true;
  1634. }
  1635.  
  1636. if(the_clone.is('.disabled'))
  1637. {
  1638. disabled = 'disabled="disabled"';
  1639. }
  1640.  
  1641. if(!skip)
  1642. {
  1643. var element = the_clone.children('ul, ol, .avia_mega_div').remove().end();
  1644. var text = levelStr + element.text();
  1645.  
  1646. if($.trim( element.text() ) == "")
  1647. {
  1648. skip = true;
  1649. }
  1650.  
  1651. if(element.find('.mega_menu_title').length > 0 || link == "" || link == '#')
  1652. {
  1653. disabled = 'disabled="disabled"';
  1654. }
  1655.  
  1656. if(element.is('.avia_mega_text_block'))
  1657. {
  1658. skip = true;
  1659. }
  1660.  
  1661. //add option
  1662. if(!skip) selectString += '<option '+disabled+selected+' value="'+link+'">'+text+'</option>';
  1663. }
  1664. });
  1665.  
  1666. selectString += '</select>';
  1667.  
  1668. //append select element to ul/ol's container
  1669. $this.parent().append(selectString);
  1670.  
  1671. //add change event handler for mobile menu
  1672. $('#mobileMenu_'+$this.attr('id')).change(function(){
  1673. goToPage($(this));
  1674. });
  1675.  
  1676. //hide current menu, show mobile menu
  1677. showMenu($this);
  1678. } else {
  1679. alert('mobileMenu will only work with UL or OL elements!');
  1680. }
  1681. }
  1682.  
  1683.  
  1684. //plugin functionality
  1685. function run($this){
  1686.  
  1687. //menu doesn't exist
  1688. if(isMobile() && !menuExists($this)){
  1689. createMenu($this);
  1690. }
  1691.  
  1692. //menu already exists
  1693. else if(isMobile() && menuExists($this)){
  1694. showMenu($this);
  1695. }
  1696.  
  1697. //not mobile browser
  1698. else if(!isMobile() && menuExists($this)){
  1699. hideMenu($this);
  1700. }
  1701.  
  1702. }
  1703.  
  1704. //run plugin on each matched ul/ol
  1705. //maintain chainability by returning "this"
  1706. return this.each(function() {
  1707.  
  1708. //override the default settings if user provides some
  1709. if(options){$.extend(settings, options);}
  1710.  
  1711. //cache "this"
  1712. var $this = $(this);
  1713.  
  1714. //bind event to browser resize
  1715. $(window).resize(function(){run($this);});
  1716.  
  1717. //run plugin
  1718. run($this);
  1719.  
  1720. });
  1721.  
  1722. };
  1723.  
  1724. })(jQuery);
  1725.  
  1726.  
  1727. /**
  1728. * Isotope v1.5.25
  1729. * An exquisite jQuery plugin for magical layouts
  1730. * http://isotope.metafizzy.co
  1731. *
  1732. * Commercial use requires one-time license fee
  1733. * http://metafizzy.co/#licenses
  1734. *
  1735. * Copyright 2012 David DeSandro / Metafizzy
  1736. */
  1737. (function(a,b,c){"use strict";var d=a.document,e=a.Modernizr,f=function(a){return a.charAt(0).toUpperCase()+a.slice(1)},g="Moz Webkit O Ms".split(" "),h=function(a){var b=d.documentElement.style,c;if(typeof b[a]=="string")return a;a=f(a);for(var e=0,h=g.length;e<h;e++){c=g[e]+a;if(typeof b[c]=="string")return c}},i=h("transform"),j=h("transitionProperty"),k={csstransforms:function(){return!!i},csstransforms3d:function(){var a=!!h("perspective");if(a){var c=" -o- -moz- -ms- -webkit- -khtml- ".split(" "),d="@media ("+c.join("transform-3d),(")+"modernizr)",e=b("<style>"+d+"{#modernizr{height:3px}}"+"</style>").appendTo("head"),f=b('<div id="modernizr" />').appendTo("html");a=f.height()===3,f.remove(),e.remove()}return a},csstransitions:function(){return!!j}},l;if(e)for(l in k)e.hasOwnProperty(l)||e.addTest(l,k[l]);else{e=a.Modernizr={_version:"1.6ish: miniModernizr for Isotope"};var m=" ",n;for(l in k)n=k[l](),e[l]=n,m+=" "+(n?"":"no-")+l;b("html").addClass(m)}if(e.csstransforms){var o=e.csstransforms3d?{translate:function(a){return"translate3d("+a[0]+"px, "+a[1]+"px, 0) "},scale:function(a){return"scale3d("+a+", "+a+", 1) "}}:{translate:function(a){return"translate("+a[0]+"px, "+a[1]+"px) "},scale:function(a){return"scale("+a+") "}},p=function(a,c,d){var e=b.data(a,"isoTransform")||{},f={},g,h={},j;f[c]=d,b.extend(e,f);for(g in e)j=e[g],h[g]=o[g](j);var k=h.translate||"",l=h.scale||"",m=k+l;b.data(a,"isoTransform",e),a.style[i]=m};b.cssNumber.scale=!0,b.cssHooks.scale={set:function(a,b){p(a,"scale",b)},get:function(a,c){var d=b.data(a,"isoTransform");return d&&d.scale?d.scale:1}},b.fx.step.scale=function(a){b.cssHooks.scale.set(a.elem,a.now+a.unit)},b.cssNumber.translate=!0,b.cssHooks.translate={set:function(a,b){p(a,"translate",b)},get:function(a,c){var d=b.data(a,"isoTransform");return d&&d.translate?d.translate:[0,0]}}}var q,r;e.csstransitions&&(q={WebkitTransitionProperty:"webkitTransitionEnd",MozTransitionProperty:"transitionend",OTransitionProperty:"oTransitionEnd otransitionend",transitionProperty:"transitionend"}[j],r=h("transitionDuration"));var s=b.event,t=b.event.handle?"handle":"dispatch",u;s.special.smartresize={setup:function(){b(this).bind("resize",s.special.smartresize.handler)},teardown:function(){b(this).unbind("resize",s.special.smartresize.handler)},handler:function(a,b){var c=this,d=arguments;a.type="smartresize",u&&clearTimeout(u),u=setTimeout(function(){s[t].apply(c,d)},b==="execAsap"?0:100)}},b.fn.smartresize=function(a){return a?this.bind("smartresize",a):this.trigger("smartresize",["execAsap"])},b.Isotope=function(a,c,d){this.element=b(c),this._create(a),this._init(d)};var v=["width","height"],w=b(a);b.Isotope.settings={resizable:!0,layoutMode:"masonry",containerClass:"isotope",itemClass:"isotope-item",hiddenClass:"isotope-hidden",hiddenStyle:{opacity:0,scale:.001},visibleStyle:{opacity:1,scale:1},containerStyle:{position:"relative",overflow:"hidden"},animationEngine:"best-available",animationOptions:{queue:!1,duration:800},sortBy:"original-order",sortAscending:!0,resizesContainer:!0,transformsEnabled:!0,itemPositionDataEnabled:!1},b.Isotope.prototype={_create:function(a){this.options=b.extend({},b.Isotope.settings,a),this.styleQueue=[],this.elemCount=0;var c=this.element[0].style;this.originalStyle={};var d=v.slice(0);for(var e in this.options.containerStyle)d.push(e);for(var f=0,g=d.length;f<g;f++)e=d[f],this.originalStyle[e]=c[e]||"";this.element.css(this.options.containerStyle),this._updateAnimationEngine(),this._updateUsingTransforms();var h={"original-order":function(a,b){return b.elemCount++,b.elemCount},random:function(){return Math.random()}};this.options.getSortData=b.extend(this.options.getSortData,h),this.reloadItems(),this.offset={left:parseInt(this.element.css("padding-left")||0,10),top:parseInt(this.element.css("padding-top")||0,10)};var i=this;setTimeout(function(){i.element.addClass(i.options.containerClass)},0),this.options.resizable&&w.bind("smartresize.isotope",function(){i.resize()}),this.element.delegate("."+this.options.hiddenClass,"click",function(){return!1})},_getAtoms:function(a){var b=this.options.itemSelector,c=b?a.filter(b).add(a.find(b)):a,d={position:"absolute"};return c=c.filter(function(a,b){return b.nodeType===1}),this.usingTransforms&&(d.left=0,d.top=0),c.css(d).addClass(this.options.itemClass),this.updateSortData(c,!0),c},_init:function(a){this.$filteredAtoms=this._filter(this.$allAtoms),this._sort(),this.reLayout(a)},option:function(a){if(b.isPlainObject(a)){this.options=b.extend(!0,this.options,a);var c;for(var d in a)c="_update"+f(d),this[c]&&this[c]()}},_updateAnimationEngine:function(){var a=this.options.animationEngine.toLowerCase().replace(/[ _\-]/g,""),b;switch(a){case"css":case"none":b=!1;break;case"jquery":b=!0;break;default:b=!e.csstransitions}this.isUsingJQueryAnimation=b,this._updateUsingTransforms()},_updateTransformsEnabled:function(){this._updateUsingTransforms()},_updateUsingTransforms:function(){var a=this.usingTransforms=this.options.transformsEnabled&&e.csstransforms&&e.csstransitions&&!this.isUsingJQueryAnimation;a||(delete this.options.hiddenStyle.scale,delete this.options.visibleStyle.scale),this.getPositionStyles=a?this._translate:this._positionAbs},_filter:function(a){var b=this.options.filter===""?"*":this.options.filter;if(!b)return a;var c=this.options.hiddenClass,d="."+c,e=a.filter(d),f=e;if(b!=="*"){f=e.filter(b);var g=a.not(d).not(b).addClass(c);this.styleQueue.push({$el:g,style:this.options.hiddenStyle})}return this.styleQueue.push({$el:f,style:this.options.visibleStyle}),f.removeClass(c),a.filter(b)},updateSortData:function(a,c){var d=this,e=this.options.getSortData,f,g;a.each(function(){f=b(this),g={};for(var a in e)!c&&a==="original-order"?g[a]=b.data(this,"isotope-sort-data")[a]:g[a]=e[a](f,d);b.data(this,"isotope-sort-data",g)})},_sort:function(){var a=this.options.sortBy,b=this._getSorter,c=this.options.sortAscending?1:-1,d=function(d,e){var f=b(d,a),g=b(e,a);return f===g&&a!=="original-order"&&(f=b(d,"original-order"),g=b(e,"original-order")),(f>g?1:f<g?-1:0)*c};this.$filteredAtoms.sort(d)},_getSorter:function(a,c){return b.data(a,"isotope-sort-data")[c]},_translate:function(a,b){return{translate:[a,b]}},_positionAbs:function(a,b){return{left:a,top:b}},_pushPosition:function(a,b,c){b=Math.round(b+this.offset.left),c=Math.round(c+this.offset.top);var d=this.getPositionStyles(b,c);this.styleQueue.push({$el:a,style:d}),this.options.itemPositionDataEnabled&&a.data("isotope-item-position",{x:b,y:c})},layout:function(a,b){var c=this.options.layoutMode;this["_"+c+"Layout"](a);if(this.options.resizesContainer){var d=this["_"+c+"GetContainerSize"]();this.styleQueue.push({$el:this.element,style:d})}this._processStyleQueue(a,b),this.isLaidOut=!0},_processStyleQueue:function(a,c){var d=this.isLaidOut?this.isUsingJQueryAnimation?"animate":"css":"css",f=this.options.animationOptions,g=this.options.onLayout,h,i,j,k;i=function(a,b){b.$el[d](b.style,f)};if(this._isInserting&&this.isUsingJQueryAnimation)i=function(a,b){h=b.$el.hasClass("no-transition")?"css":d,b.$el[h](b.style,f)};else if(c||g||f.complete){var l=!1,m=[c,g,f.complete],n=this;j=!0,k=function(){if(l)return;var b;for(var c=0,d=m.length;c<d;c++)b=m[c],typeof b=="function"&&b.call(n.element,a,n);l=!0};if(this.isUsingJQueryAnimation&&d==="animate")f.complete=k,j=!1;else if(e.csstransitions){var o=0,p=this.styleQueue[0],s=p&&p.$el,t;while(!s||!s.length){t=this.styleQueue[o++];if(!t)return;s=t.$el}var u=parseFloat(getComputedStyle(s[0])[r]);u>0&&(i=function(a,b){b.$el[d](b.style,f).one(q,k)},j=!1)}}b.each(this.styleQueue,i),j&&k(),this.styleQueue=[]},resize:function(){this["_"+this.options.layoutMode+"ResizeChanged"]()&&this.reLayout()},reLayout:function(a){this["_"+this.options.layoutMode+"Reset"](),this.layout(this.$filteredAtoms,a)},addItems:function(a,b){var c=this._getAtoms(a);this.$allAtoms=this.$allAtoms.add(c),b&&b(c)},insert:function(a,b){this.element.append(a);var c=this;this.addItems(a,function(a){var d=c._filter(a);c._addHideAppended(d),c._sort(),c.reLayout(),c._revealAppended(d,b)})},appended:function(a,b){var c=this;this.addItems(a,function(a){c._addHideAppended(a),c.layout(a),c._revealAppended(a,b)})},_addHideAppended:function(a){this.$filteredAtoms=this.$filteredAtoms.add(a),a.addClass("no-transition"),this._isInserting=!0,this.styleQueue.push({$el:a,style:this.options.hiddenStyle})},_revealAppended:function(a,b){var c=this;setTimeout(function(){a.removeClass("no-transition"),c.styleQueue.push({$el:a,style:c.options.visibleStyle}),c._isInserting=!1,c._processStyleQueue(a,b)},10)},reloadItems:function(){this.$allAtoms=this._getAtoms(this.element.children())},remove:function(a,b){this.$allAtoms=this.$allAtoms.not(a),this.$filteredAtoms=this.$filteredAtoms.not(a);var c=this,d=function(){a.remove(),b&&b.call(c.element)};a.filter(":not(."+this.options.hiddenClass+")").length?(this.styleQueue.push({$el:a,style:this.options.hiddenStyle}),this._sort(),this.reLayout(d)):d()},shuffle:function(a){this.updateSortData(this.$allAtoms),this.options.sortBy="random",this._sort(),this.reLayout(a)},destroy:function(){var a=this.usingTransforms,b=this.options;this.$allAtoms.removeClass(b.hiddenClass+" "+b.itemClass).each(function(){var b=this.style;b.position="",b.top="",b.left="",b.opacity="",a&&(b[i]="")});var c=this.element[0].style;for(var d in this.originalStyle)c[d]=this.originalStyle[d];this.element.unbind(".isotope").undelegate("."+b.hiddenClass,"click").removeClass(b.containerClass).removeData("isotope"),w.unbind(".isotope")},_getSegments:function(a){var b=this.options.layoutMode,c=a?"rowHeight":"columnWidth",d=a?"height":"width",e=a?"rows":"cols",g=this.element[d](),h,i=this.options[b]&&this.options[b][c]||this.$filteredAtoms["outer"+f(d)](!0)||g;h=Math.floor(g/i),h=Math.max(h,1),this[b][e]=h,this[b][c]=i},_checkIfSegmentsChanged:function(a){var b=this.options.layoutMode,c=a?"rows":"cols",d=this[b][c];return this._getSegments(a),this[b][c]!==d},_masonryReset:function(){this.masonry={},this._getSegments();var a=this.masonry.cols;this.masonry.colYs=[];while(a--)this.masonry.colYs.push(0)},_masonryLayout:function(a){var c=this,d=c.masonry;a.each(function(){var a=b(this),e=Math.ceil(a.outerWidth(!0)/d.columnWidth);e=Math.min(e,d.cols);if(e===1)c._masonryPlaceBrick(a,d.colYs);else{var f=d.cols+1-e,g=[],h,i;for(i=0;i<f;i++)h=d.colYs.slice(i,i+e),g[i]=Math.max.apply(Math,h);c._masonryPlaceBrick(a,g)}})},_masonryPlaceBrick:function(a,b){var c=Math.min.apply(Math,b),d=0;for(var e=0,f=b.length;e<f;e++)if(b[e]===c){d=e;break}var g=this.masonry.columnWidth*d,h=c;this._pushPosition(a,g,h);var i=c+a.outerHeight(!0),j=this.masonry.cols+1-f;for(e=0;e<j;e++)this.masonry.colYs[d+e]=i},_masonryGetContainerSize:function(){var a=Math.max.apply(Math,this.masonry.colYs);return{height:a}},_masonryResizeChanged:function(){return this._checkIfSegmentsChanged()},_fitRowsReset:function(){this.fitRows={x:0,y:0,height:0}},_fitRowsLayout:function(a){var c=this,d=this.element.width(),e=this.fitRows;a.each(function(){var a=b(this),f=a.outerWidth(!0),g=a.outerHeight(!0);e.x!==0&&f+e.x>d&&(e.x=0,e.y=e.height),c._pushPosition(a,e.x,e.y),e.height=Math.max(e.y+g,e.height),e.x+=f})},_fitRowsGetContainerSize:function(){return{height:this.fitRows.height}},_fitRowsResizeChanged:function(){return!0},_cellsByRowReset:function(){this.cellsByRow={index:0},this._getSegments(),this._getSegments(!0)},_cellsByRowLayout:function(a){var c=this,d=this.cellsByRow;a.each(function(){var a=b(this),e=d.index%d.cols,f=Math.floor(d.index/d.cols),g=(e+.5)*d.columnWidth-a.outerWidth(!0)/2,h=(f+.5)*d.rowHeight-a.outerHeight(!0)/2;c._pushPosition(a,g,h),d.index++})},_cellsByRowGetContainerSize:function(){return{height:Math.ceil(this.$filteredAtoms.length/this.cellsByRow.cols)*this.cellsByRow.rowHeight+this.offset.top}},_cellsByRowResizeChanged:function(){return this._checkIfSegmentsChanged()},_straightDownReset:function(){this.straightDown={y:0}},_straightDownLayout:function(a){var c=this;a.each(function(a){var d=b(this);c._pushPosition(d,0,c.straightDown.y),c.straightDown.y+=d.outerHeight(!0)})},_straightDownGetContainerSize:function(){return{height:this.straightDown.y}},_straightDownResizeChanged:function(){return!0},_masonryHorizontalReset:function(){this.masonryHorizontal={},this._getSegments(!0);var a=this.masonryHorizontal.rows;this.masonryHorizontal.rowXs=[];while(a--)this.masonryHorizontal.rowXs.push(0)},_masonryHorizontalLayout:function(a){var c=this,d=c.masonryHorizontal;a.each(function(){var a=b(this),e=Math.ceil(a.outerHeight(!0)/d.rowHeight);e=Math.min(e,d.rows);if(e===1)c._masonryHorizontalPlaceBrick(a,d.rowXs);else{var f=d.rows+1-e,g=[],h,i;for(i=0;i<f;i++)h=d.rowXs.slice(i,i+e),g[i]=Math.max.apply(Math,h);c._masonryHorizontalPlaceBrick(a,g)}})},_masonryHorizontalPlaceBrick:function(a,b){var c=Math.min.apply(Math,b),d=0;for(var e=0,f=b.length;e<f;e++)if(b[e]===c){d=e;break}var g=c,h=this.masonryHorizontal.rowHeight*d;this._pushPosition(a,g,h);var i=c+a.outerWidth(!0),j=this.masonryHorizontal.rows+1-f;for(e=0;e<j;e++)this.masonryHorizontal.rowXs[d+e]=i},_masonryHorizontalGetContainerSize:function(){var a=Math.max.apply(Math,this.masonryHorizontal.rowXs);return{width:a}},_masonryHorizontalResizeChanged:function(){return this._checkIfSegmentsChanged(!0)},_fitColumnsReset:function(){this.fitColumns={x:0,y:0,width:0}},_fitColumnsLayout:function(a){var c=this,d=this.element.height(),e=this.fitColumns;a.each(function(){var a=b(this),f=a.outerWidth(!0),g=a.outerHeight(!0);e.y!==0&&g+e.y>d&&(e.x=e.width,e.y=0),c._pushPosition(a,e.x,e.y),e.width=Math.max(e.x+f,e.width),e.y+=g})},_fitColumnsGetContainerSize:function(){return{width:this.fitColumns.width}},_fitColumnsResizeChanged:function(){return!0},_cellsByColumnReset:function(){this.cellsByColumn={index:0},this._getSegments(),this._getSegments(!0)},_cellsByColumnLayout:function(a){var c=this,d=this.cellsByColumn;a.each(function(){var a=b(this),e=Math.floor(d.index/d.rows),f=d.index%d.rows,g=(e+.5)*d.columnWidth-a.outerWidth(!0)/2,h=(f+.5)*d.rowHeight-a.outerHeight(!0)/2;c._pushPosition(a,g,h),d.index++})},_cellsByColumnGetContainerSize:function(){return{width:Math.ceil(this.$filteredAtoms.length/this.cellsByColumn.rows)*this.cellsByColumn.columnWidth}},_cellsByColumnResizeChanged:function(){return this._checkIfSegmentsChanged(!0)},_straightAcrossReset:function(){this.straightAcross={x:0}},_straightAcrossLayout:function(a){var c=this;a.each(function(a){var d=b(this);c._pushPosition(d,c.straightAcross.x,0),c.straightAcross.x+=d.outerWidth(!0)})},_straightAcrossGetContainerSize:function(){return{width:this.straightAcross.x}},_straightAcrossResizeChanged:function(){return!0}},b.fn.imagesLoaded=function(a){function h(){a.call(c,d)}function i(a){var c=a.target;c.src!==f&&b.inArray(c,g)===-1&&(g.push(c),--e<=0&&(setTimeout(h),d.unbind(".imagesLoaded",i)))}var c=this,d=c.find("img").add(c.filter("img")),e=d.length,f="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///ywAAAAAAQABAAACAUwAOw==",g=[];return e||h(),d.bind("load.imagesLoaded error.imagesLoaded",i).each(function(){var a=this.src;this.src=f,this.src=a}),c};var x=function(b){a.console&&a.console.error(b)};b.fn.isotope=function(a,c){if(typeof a=="string"){var d=Array.prototype.slice.call(arguments,1);this.each(function(){var c=b.data(this,"isotope");if(!c){x("cannot call methods on isotope prior to initialization; attempted to call method '"+a+"'");return}if(!b.isFunction(c[a])||a.charAt(0)==="_"){x("no such method '"+a+"' for isotope instance");return}c[a].apply(c,d)})}else this.each(function(){var d=b.data(this,"isotope");d?(d.option(a),d._init(c)):b.data(this,"isotope",new b.Isotope(a,this,c))});return this}})(window,jQuery);
  1738.  
  1739.  
  1740.  
  1741. /*
  1742. jQuery Waypoints - v2.0.2
  1743. Copyright (c) 2011-2013 Caleb Troughton
  1744. Dual licensed under the MIT license and GPL license.
  1745. https://github.com/imakewebthings/jquery-waypoints/blob/master/licenses.txt
  1746. */
  1747. (function(){var t=[].indexOf||function(t){for(var e=0,n=this.length;e<n;e++){if(e in this&&this[e]===t)return e}return-1},e=[].slice;(function(t,e){if(typeof define==="function"&&define.amd){return define("waypoints",["jquery"],function(n){return e(n,t)})}else{return e(t.jQuery,t)}})(this,function(n,r){var i,o,l,s,f,u,a,c,h,d,p,y,v,w,g,m;i=n(r);c=t.call(r,"ontouchstart")>=0;s={horizontal:{},vertical:{}};f=1;a={};u="waypoints-context-id";p="resize.waypoints";y="scroll.waypoints";v=1;w="waypoints-waypoint-ids";g="waypoint";m="waypoints";o=function(){function t(t){var e=this;this.$element=t;this.element=t[0];this.didResize=false;this.didScroll=false;this.id="context"+f++;this.oldScroll={x:t.scrollLeft(),y:t.scrollTop()};this.waypoints={horizontal:{},vertical:{}};t.data(u,this.id);a[this.id]=this;t.bind(y,function(){var t;if(!(e.didScroll||c)){e.didScroll=true;t=function(){e.doScroll();return e.didScroll=false};return r.setTimeout(t,n[m].settings.scrollThrottle)}});t.bind(p,function(){var t;if(!e.didResize){e.didResize=true;t=function(){n[m]("refresh");return e.didResize=false};return r.setTimeout(t,n[m].settings.resizeThrottle)}})}t.prototype.doScroll=function(){var t,e=this;t={horizontal:{newScroll:this.$element.scrollLeft(),oldScroll:this.oldScroll.x,forward:"right",backward:"left"},vertical:{newScroll:this.$element.scrollTop(),oldScroll:this.oldScroll.y,forward:"down",backward:"up"}};if(c&&(!t.vertical.oldScroll||!t.vertical.newScroll)){n[m]("refresh")}n.each(t,function(t,r){var i,o,l;l=[];o=r.newScroll>r.oldScroll;i=o?r.forward:r.backward;n.each(e.waypoints[t],function(t,e){var n,i;if(r.oldScroll<(n=e.offset)&&n<=r.newScroll){return l.push(e)}else if(r.newScroll<(i=e.offset)&&i<=r.oldScroll){return l.push(e)}});l.sort(function(t,e){return t.offset-e.offset});if(!o){l.reverse()}return n.each(l,function(t,e){if(e.options.continuous||t===l.length-1){return e.trigger([i])}})});return this.oldScroll={x:t.horizontal.newScroll,y:t.vertical.newScroll}};t.prototype.refresh=function(){var t,e,r,i=this;r=n.isWindow(this.element);e=this.$element.offset();this.doScroll();t={horizontal:{contextOffset:r?0:e.left,contextScroll:r?0:this.oldScroll.x,contextDimension:this.$element.width(),oldScroll:this.oldScroll.x,forward:"right",backward:"left",offsetProp:"left"},vertical:{contextOffset:r?0:e.top,contextScroll:r?0:this.oldScroll.y,contextDimension:r?n[m]("viewportHeight"):this.$element.height(),oldScroll:this.oldScroll.y,forward:"down",backward:"up",offsetProp:"top"}};return n.each(t,function(t,e){return n.each(i.waypoints[t],function(t,r){var i,o,l,s,f;i=r.options.offset;l=r.offset;o=n.isWindow(r.element)?0:r.$element.offset()[e.offsetProp];if(n.isFunction(i)){i=i.apply(r.element)}else if(typeof i==="string"){i=parseFloat(i);if(r.options.offset.indexOf("%")>-1){i=Math.ceil(e.contextDimension*i/100)}}r.offset=o-e.contextOffset+e.contextScroll-i;if(r.options.onlyOnScroll&&l!=null||!r.enabled){return}if(l!==null&&l<(s=e.oldScroll)&&s<=r.offset){return r.trigger([e.backward])}else if(l!==null&&l>(f=e.oldScroll)&&f>=r.offset){return r.trigger([e.forward])}else if(l===null&&e.oldScroll>=r.offset){return r.trigger([e.forward])}})})};t.prototype.checkEmpty=function(){if(n.isEmptyObject(this.waypoints.horizontal)&&n.isEmptyObject(this.waypoints.vertical)){this.$element.unbind([p,y].join(" "));return delete a[this.id]}};return t}();l=function(){function t(t,e,r){var i,o;r=n.extend({},n.fn[g].defaults,r);if(r.offset==="bottom-in-view"){r.offset=function(){var t;t=n[m]("viewportHeight");if(!n.isWindow(e.element)){t=e.$element.height()}return t-n(this).outerHeight()}}this.$element=t;this.element=t[0];this.axis=r.horizontal?"horizontal":"vertical";this.callback=r.handler;this.context=e;this.enabled=r.enabled;this.id="waypoints"+v++;this.offset=null;this.options=r;e.waypoints[this.axis][this.id]=this;s[this.axis][this.id]=this;i=(o=t.data(w))!=null?o:[];i.push(this.id);t.data(w,i)}t.prototype.trigger=function(t){if(!this.enabled){return}if(this.callback!=null){this.callback.apply(this.element,t)}if(this.options.triggerOnce){return this.destroy()}};t.prototype.disable=function(){return this.enabled=false};t.prototype.enable=function(){this.context.refresh();return this.enabled=true};t.prototype.destroy=function(){delete s[this.axis][this.id];delete this.context.waypoints[this.axis][this.id];return this.context.checkEmpty()};t.getWaypointsByElement=function(t){var e,r;r=n(t).data(w);if(!r){return[]}e=n.extend({},s.horizontal,s.vertical);return n.map(r,function(t){return e[t]})};return t}();d={init:function(t,e){var r;if(e==null){e={}}if((r=e.handler)==null){e.handler=t}this.each(function(){var t,r,i,s;t=n(this);i=(s=e.context)!=null?s:n.fn[g].defaults.context;if(!n.isWindow(i)){i=t.closest(i)}i=n(i);r=a[i.data(u)];if(!r){r=new o(i)}return new l(t,r,e)});n[m]("refresh");return this},disable:function(){return d._invoke(this,"disable")},enable:function(){return d._invoke(this,"enable")},destroy:function(){return d._invoke(this,"destroy")},prev:function(t,e){return d._traverse.call(this,t,e,function(t,e,n){if(e>0){return t.push(n[e-1])}})},next:function(t,e){return d._traverse.call(this,t,e,function(t,e,n){if(e<n.length-1){return t.push(n[e+1])}})},_traverse:function(t,e,i){var o,l;if(t==null){t="vertical"}if(e==null){e=r}l=h.aggregate(e);o=[];this.each(function(){var e;e=n.inArray(this,l[t]);return i(o,e,l[t])});return this.pushStack(o)},_invoke:function(t,e){t.each(function(){var t;t=l.getWaypointsByElement(this);return n.each(t,function(t,n){n[e]();return true})});return this}};n.fn[g]=function(){var t,r;r=arguments[0],t=2<=arguments.length?e.call(arguments,1):[];if(d[r]){return d[r].apply(this,t)}else if(n.isFunction(r)){return d.init.apply(this,arguments)}else if(n.isPlainObject(r)){return d.init.apply(this,[null,r])}else if(!r){return n.error("jQuery Waypoints needs a callback function or handler option.")}else{return n.error("The "+r+" method does not exist in jQuery Waypoints.")}};n.fn[g].defaults={context:r,continuous:true,enabled:true,horizontal:false,offset:0,triggerOnce:false};h={refresh:function(){return n.each(a,function(t,e){return e.refresh()})},viewportHeight:function(){var t;return(t=r.innerHeight)!=null?t:i.height()},aggregate:function(t){var e,r,i;e=s;if(t){e=(i=a[n(t).data(u)])!=null?i.waypoints:void 0}if(!e){return[]}r={horizontal:[],vertical:[]};n.each(r,function(t,i){n.each(e[t],function(t,e){return i.push(e)});i.sort(function(t,e){return t.offset-e.offset});r[t]=n.map(i,function(t){return t.element});return r[t]=n.unique(r[t])});return r},above:function(t){if(t==null){t=r}return h._filter(t,"vertical",function(t,e){return e.offset<=t.oldScroll.y})},below:function(t){if(t==null){t=r}return h._filter(t,"vertical",function(t,e){return e.offset>t.oldScroll.y})},left:function(t){if(t==null){t=r}return h._filter(t,"horizontal",function(t,e){return e.offset<=t.oldScroll.x})},right:function(t){if(t==null){t=r}return h._filter(t,"horizontal",function(t,e){return e.offset>t.oldScroll.x})},enable:function(){return h._invoke("enable")},disable:function(){return h._invoke("disable")},destroy:function(){return h._invoke("destroy")},extendFn:function(t,e){return d[t]=e},_invoke:function(t){var e;e=n.extend({},s.vertical,s.horizontal);return n.each(e,function(e,n){n[t]();return true})},_filter:function(t,e,r){var i,o;i=a[n(t).data(u)];if(!i){return[]}o=[];n.each(i.waypoints[e],function(t,e){if(r(i,e)){return o.push(e)}});o.sort(function(t,e){return t.offset-e.offset});return n.map(o,function(t){return t.element})}};n[m]=function(){var t,n;n=arguments[0],t=2<=arguments.length?e.call(arguments,1):[];if(h[n]){return h[n].apply(null,t)}else{return h.aggregate.call(null,n)}};n[m].settings={resizeThrottle:100,scrollThrottle:30};return i.load(function(){return n[m]("refresh")})})}).call(this);
Add Comment
Please, Sign In to add comment