PageSourceSearch

https://otterbeckbuilders.com/js/custom.js

js otterbeckbuilders.com collected 2026-09-25 23:53:06 UTC 41,369 bytes, 1,113 lines download raw bytes

1var enable_sticky_menu, sticky_menu_touchscreen;
2
3// When DOM is fully loaded
4jQuery(document).ready(function($) {
5
6	/* ---------------------------------------------------------------------- */
7	/*	Detect Touch Screen Devices
8	/* ---------------------------------------------------------------------- */
9	
10	(function() {
11		if (isTouchScreenDevice) {
12			$('body').addClass('touch-screen');
13		} else {
14			$('body').addClass('no-touch-screen');
15		}
16		if (isAndroid) {
17			$('body').addClass('android-device');
18		}
19	})();
20	
21
22	/* ---------------------------------------------------------------------- */
23	/*	Main Navigation
24	/* ---------------------------------------------------------------------- */
25	/*
26	* jQuery Superfish Menu Plugin - v1.7.4
27	* Copyright (c) 2013 Joel Birch
28	*
29	* Dual licensed under the MIT and GPL licenses:
30	*	http://www.opensource.org/licenses/mit-license.php
31	*	http://www.gnu.org/licenses/gpl.html
32	*/
33	
34	;(function(e){"use strict";var s=function(){var s={bcClass:"sf-breadcrumb",menuClass:"sf-js-enabled",anchorClass:"sf-with-ul",menuArrowClass:"sf-arrows"},o=function(){var s=/iPhone|iPad|iPod/i.test(navigator.userAgent);return s&&e(window).load(function(){e("body").children().on("click",e.noop)}),s}(),n=function(){var e=document.documentElement.style;return"behavior"in e&&"fill"in e&&/iemobile/i.test(navigator.userAgent)}(),t=function(e,o){var n=s.menuClass;o.cssArrows&&(n+=" "+s.menuArrowClass),e.toggleClass(n)},i=function(o,n){return o.find("li."+n.pathClass).slice(0,n.pathLevels).addClass(n.hoverClass+" "+s.bcClass).filter(function(){return e(this).children(n.popUpSelector).hide().show().length}).removeClass(n.pathClass)},r=function(e){e.children("a").toggleClass(s.anchorClass)},a=function(e){var s=e.css("ms-touch-action");s="pan-y"===s?"auto":"pan-y",e.css("ms-touch-action",s)},l=function(s,t){var i="li:has("+t.popUpSelector+")";e.fn.hoverIntent&&!t.disableHI?s.hoverIntent(u,p,i):s.on("mouseenter.superfish",i,u).on("mouseleave.superfish",i,p);var r="MSPointerDown.superfish";o||(r+=" touchend.superfish"),n&&(r+=" mousedown.superfish"),s.on("focusin.superfish","li",u).on("focusout.superfish","li",p).on(r,"a",t,h)},h=function(s){var o=e(this),n=o.siblings(s.data.popUpSelector);n.length>0&&n.is(":hidden")&&(o.one("click.superfish",!1),"MSPointerDown"===s.type?o.trigger("focus"):e.proxy(u,o.parent("li"))())},u=function(){var s=e(this),o=d(s);clearTimeout(o.sfTimer),s.siblings().superfish("hide").end().superfish("show")},p=function(){var s=e(this),n=d(s);o?e.proxy(f,s,n)():(clearTimeout(n.sfTimer),n.sfTimer=setTimeout(e.proxy(f,s,n),n.delay))},f=function(s){s.retainPath=e.inArray(this[0],s.$path)>-1,this.superfish("hide"),this.parents("."+s.hoverClass).length||(s.onIdle.call(c(this)),s.$path.length&&e.proxy(u,s.$path)())},c=function(e){return e.closest("."+s.menuClass)},d=function(e){return c(e).data("sf-options")};return{hide:function(s){if(this.length){var o=this,n=d(o);if(!n)return this;var t=n.retainPath===!0?n.$path:"",i=o.find("li."+n.hoverClass).add(this).not(t).removeClass(n.hoverClass).children(n.popUpSelector),r=n.speedOut;s&&(i.show(),r=0),n.retainPath=!1,n.onBeforeHide.call(i),i.stop(!0,!0).animate(n.animationOut,r,function(){var s=e(this);n.onHide.call(s)})}return this},show:function(){var e=d(this);if(!e)return this;var s=this.addClass(e.hoverClass),o=s.children(e.popUpSelector);return e.onBeforeShow.call(o),o.stop(!0,!0).animate(e.animation,e.speed,function(){e.onShow.call(o)}),this},destroy:function(){return this.each(function(){var o,n=e(this),i=n.data("sf-options");return i?(o=n.find(i.popUpSelector).parent("li"),clearTimeout(i.sfTimer),t(n,i),r(o),a(n),n.off(".superfish").off(".hoverIntent"),o.children(i.popUpSelector).attr("style",function(e,s){return s.replace(/display[^;]+;?/g,"")}),i.$path.removeClass(i.hoverClass+" "+s.bcClass).addClass(i.pathClass),n.find("."+i.hoverClass).removeClass(i.hoverClass),i.onDestroy.call(n),n.removeData("sf-options"),void 0):!1})},init:function(o){return this.each(function(){var n=e(this);if(n.data("sf-options"))return!1;var h=e.extend({},e.fn.superfish.defaults,o),u=n.find(h.popUpSelector).parent("li");h.$path=i(n,h),n.data("sf-options",h),t(n,h),r(u),a(n),l(n,h),u.not("."+s.bcClass).superfish("hide",!0),h.onInit.call(this)})}}}();e.fn.superfish=function(o){return s[o]?s[o].apply(this,Array.prototype.slice.call(arguments,1
34)):"object"!=typeof o&&o?e.error("Method "+o+" does not exist on jQuery.fn.superfish"):s.init.apply(this,arguments)},e.fn.superfish.defaults={popUpSelector:"ul,.sf-mega",hoverClass:"sfHover",pathClass:"overrideThisToUse",pathLevels:1,delay:800,animation:{opacity:"show"},animationOut:{opacity:"hide"},speed:"normal",speedOut:"fast",cssArrows:!0,disableHI:!1,onInit:e.noop,onBeforeShow:e.noop,onShow:e.noop,onBeforeHide:e.noop,onHide:e.noop,onIdle:e.noop,onDestroy:e.noop},e.fn.extend({hideSuperfishUl:s.hide,showSuperfishUl:s.show})})(jQuery);
35	
36	// Correct the position of those submenus that overlap the right margin of a page
37	(function() {
38		
39		var menuItemPadding = parseInt($('#main-menu').children('li').find('a').css('padding-left')),
40			menuWidth = $('#primary-nav').width() + menuItemPadding,
41			mWidth = menuWidth,
42			overlapWidth = 3;
43		
44		$('#main-menu > li').each(function() {
45			// needed to determine the correct width of submenu with arrows before menu plugin initialization
46			$(this).find('ul>li').has('ul').children('a').addClass('sf-with-ul');
47			
48			var $liTop = $(this),
49				topItemWidth = $liTop.width(),
50				submenuWidth = $liTop.children('ul').width();
51			if (submenuWidth > mWidth) {
52				$liTop.children('ul').css('left', (mWidth - submenuWidth) + 'px');
53			}
54			
55			$liTop.find('>ul>li').has('ul').each(function(){
56				var $liSub = $(this),
57					submenu2Width = $liSub.children('ul').width(),
58					submenu2Left;
59				if (submenuWidth > mWidth || (submenuWidth + submenu2Width - overlapWidth) > mWidth) {
60					submenu2Left = -submenu2Width + overlapWidth;
61				} else {
62					submenu2Left = submenuWidth - overlapWidth;
63				}
64				$liSub.children('ul').css('left', submenu2Left + 'px');
65				
66				$liSub.find('>ul>li').has('ul').each(function(){
67					var $liSub2 = $(this),
68						submenu3Width = $liSub2.children('ul').width(),
69						submenu3Left;
70					if ((submenu2Left + submenu2Width + submenu3Width - overlapWidth) > mWidth) {
71						submenu3Left = -submenu3Width + 2 * overlapWidth;
72					} else {
73						submenu3Left = submenu2Width - overlapWidth;
74					}
75					$liSub2.children('ul').css('left', submenu3Left + 'px');
76				});
77				
78			});
79			
80			// megamenu: set width and position
81			if ($liTop.attr('class') == 'sf-mega-parent') {
82				var $megaMenu = $liTop.find('.sf-mega'),
83					$megaMenuTable = $liTop.find('.sf-mega-table'),
84					megaWidth = 0,
85					megaWidthFull,
86					megaPadding = parseInt($megaMenu.css('padding-left')),
87					sectionClassWidth;
88				$megaMenuTable.children('.sf-mega-section').each(function(){
89					var $this = $(this);
90					sectionClassWidth = parseInt($this.attr('class').replace(/[^0-9]/g, ''));
91					megaWidth += isNaN(sectionClassWidth) ? $this.width() : sectionClassWidth;
92				});
93				$megaMenu.css('width', megaWidth + 'px');
94				megaWidthFull = megaWidth + 2 * megaPadding;
95				if (megaWidthFull > mWidth) {
96					$megaMenu.css({'left': 'auto', 'right': -menuItemPadding + 'px'});
97				} else {
98					$megaMenu.css('left', (menuWidth - mWidth) + 'px');
99				}
100			}
101			
102			mWidth -= topItemWidth;
103		});
104		
105	})();
106	
107	// Initialise plugin
108	$('#main-menu').superfish({
109		delay: 200,									// delay on mouseout 
110		animation: {opacity:'show'},				// fade-in (opacity:'show') and slide-down (height:'show') animation
111		speed: 'fast',								// animation speed
112		cssArrows: true,							// enable/disable generation of arrow mark-up
113		onInit: function(){
114			
115			// compensate the reverse action of the toggleAnchorClass function
116			$('#main-menu > li').find('ul>li').has('ul').children('a').addClass('sf-with-ul');
117			
118			// do nothing when clicking the menu items with "#" href attribute
119			$('a[href="#"]', this).on('click', function(e) {
120				return false;
121			});
122			
123			if (isTouchScreenDevice && $(window).width() >= 768) {
124				hideOnTouchOutside();
125			}
126		}
127	});
128	
129	// (For touch screens) Hide opened submenus when user clicks outside the menu's area
130	function hideOnTouchOutside() {
131		$('html').on('touchend', function(e) {
132			$('#main-menu > li.sfHover').mouseout();
133		});
134		$('#main-menu').on('touchstart touchend', function(e){
135			e.stopPropagation();
136		});
137	}
138	
139	// Responsive menu
140	(function() {
141		selectnav('main-menu', {
142			activeclass: 'current',
143			autoselect: false,
144			nested: true,
145			indent: '-',
146			label: 'Select a page...'
147		});		
148	})();
149	
150	// Position menu if it is too wide
151	(function() {
152		
153		var navMarginTop = $('#navigation').css('margin-top');
154		
155		function positionMainMenu() {
156			
157			if ($(window).width() >= 768) {
158				var headerWidth = $('#header .container').width() - 20,
159					logoWidth = $('#logo img').css('display') == 'none' ? $('#logo').width() : $('#logo img').width(),
160					menuWidth = 0;
161					
162				$('#main-menu > li').each(function() {
163					menuWidth += $(this).width();
164				});
165				
166				if (logoWidth + menuWidth > headerWidth) {
167					$('#navigation').css('margin-left', logoWidth + 'px');
168				} else {
169					$('#navigation').css('margin-left', '');
170				}
171			} else {
172				$('#navigation').css('margin-left', '');
173			}
174		}
175	
176		positionMainMenu();
177		
178		$(window).load(function() {
179			positionMainMenu();
180		});
181		
182		$(window).on('resize', function() {
183			positionMainMenu();
184		});
185		
186		$(window).on('scroll', function() {
187			positionMainMenu();
188		});
189		
190	})();
191	// ***
192	
193	$('.ie8 #primary-nav ul ul li:last-child').css('border-bottom', 'none');
194	$('.ie8 #primary-nav > ul > li:last-child > a').css('padding-right', '0');
195	
196	
197	/* ---------------------------------------------------------------------- */
198	/*	Sticky Menu
199	/* ---------------------------------------------------------------------- */
200	
201	(function() {
202		
203		enable_sticky_menu = true; // enable sticky menu mode
204		sticky_menu_touchscreen = true; // enable sticky menu mode on touchscreen devices
205		
206		var $header = $('#header'),
207			$topBar = $('#top-bar'),
208			$logo = $('#logo'),
209			headerHeight = $header.height(),
210			topBarHeight = $topBar.length ? $topBar.outerHeight() : 0,
211			headerYPos = $header.hasClass('extended') ? -39 : -20 - topBarHeight,
212			minScroll = headerHeight + 105;
213		
214		window.adjustStickyMenu = function () {
215			if (enable_sticky_menu) {
216				if (!isTouchScreenDevice || (isTouchScreenDevice && sticky_menu_touchscreen)) {
217					if ($(window).scrollTop() > minScroll && $(window).width() >= 768) {
218						if ($('body').hasClass('sticky-menu-active')) {
219							return false;
220						}
221						$('body').addClass('sticky-menu-active');
222						$('#logo').on('click', function() {
223							$('html, body').animate({scrollTop: 0}, 400, 'easeInOutQuint');
224							return false;
225						});
226						$('body').css('padding-top', headerHeight);
227						$header.animate({top: headerYPos}, 200, function() {});
228					} else {
229						if ($('body').hasClass('sticky-menu-active')) {
230							$('body').removeClass('sticky-menu-active').css('padding-top', 0);
231							$('#logo').off('click');
232							$header.css('top', '');
233						}
234					}
235				}
236			}
237		};
238
239		adjustStickyMenu();
240		
241		$(window).on('resize', function() {
242			adjustStickyMenu();
243		});
244		
245		$(window).on('scroll', function() {
246			adjustStickyMenu();
247		});
248	
249	})();
250	
251	
252	/* ---------------------------------------------------------------------- */
253	/*	Sticky Footer
254	/* ---------------------------------------------------------------------- */
255	/*
256	* Sticks the footer to the bottom of the page if the page content is less than the browser window height
257	*/
258	
259	(function() {
260		
261		window.positionFooter = function () {
262			
263			var $footer = $('#footer'),
264				$footerBottom = $('#footer-bottom'),
265				bwfHeight = $('#header').height() + $('#main').height(), // body without footers
266				fTop = 0;
267			
268			$('#page-content .columns-wrapper').css('height', '');
269			
270			// set the height value for sidebar
271			if ($('#sidebar').length && $('#main-content').length) {
272				if ($(window).width() >= 768) {
273					if ($(document.body).height() < $(window).height()) {
274						var wrapperHeight = $(window).height() - $('#header').height() - $('#page-title').height() - $footer.outerHeight(true) - $footerBottom.innerHeight();
275						$('#page-content .columns-wrapper').css('height', wrapperHeight + 'px');
276					}
277				}
278			}
279			
280			// set the position value for footer
281			if (((bwfHeight + $footer.outerHeight(true) + $footerBottom.innerHeight()) < $(window).height() && $footer.css('position') == 'fixed') || ($(document.body).height() < $(window).height() && $footer.css('position') != 'fixed')) {
282				fTop = $footerBottom.innerHeight() + 'px';
283				$footerBottom.css({'position': 'fixed', 'bottom': '0', 'left': '0'});
284				$footer.css({position: 'fixed', 'bottom': fTop, 'left': '0'});
285			} else {
286				if ($footer.css('position') == 'fixed') {
287					$footer.css({'position': 'relative', 'bottom': 'auto', 'left': 'auto'});
288					$footerBottom.css({'position': 'relative', 'bottom': 'auto', 'left': 'auto'});
289				}
290			}
291		};
292		
293		$(window).load(function() {
294			positionFooter();
295		});
296		
297		$(window).on('resize', function() {
298			positionFooter();
299		});
300		
301		$('html').on('click', function() {
302			positionFooter();
303		});
304		
305		
306	})();
307	
308	
309	/* ---------------------------------------------------------------------- */
310	/*	Scroll Top
311	/* ---------------------------------------------------------------------- */
312	
313	$('span.scroll-top').click(function() {
314		$('html, body').animate({scrollTop: 0}, 400, 'easeInOutQuint');
315		return false;
316	});
317	
318	
319	/* ---------------------------------------------------------------------- */
320	/*	Home Intro Title
321	/* ---------------------------------------------------------------------- */
322	(function() {
323		
324		function adjustTitle() {
325			if ($(window).width() < 960) {
326				$('#home-intro h1').html(titleMod);
327				
328				// IE8 correction
329				$('.ie8 .intro-content .divider-pattern:last-child, .ie8 .intro-content .divider-line:last-child, .ie8 .intro-content .divider-dashline:last-child').css('display', 'none');
330			} else {
331				$('#home-intro h1').html(titleOrig);
332				
333				// IE8 correction
334				$('.ie8 .intro-content .divider-pattern:last-child, .ie8 .intro-content .divider-line:last-child, .ie8 .intro-content .divider-dashline:last-child').css('display', '');
335			}
336		}
337		
338		if ($('#home-intro').length) {
339			var titleOrig = $('#home-intro h1').html(),
340				titleMod = titleOrig.replace(/<br>/i, ' ');
341				
342			adjustTitle();
343			
344			$(window).on('resize', function() {
345				adjustTitle();
346			});
347		}
348	})();
349	
350	/* ---------------------------------------------------------------------- */
351	/*	Image Overlay Functionality (for touch screens)
352	/* ---------------------------------------------------------------------- */
353	
354	(function() {
355		
356		if (isTouchScreenDevice) {
357			$('.item-picture').on('touchend', function(e) {
358				var $current = $(this);
359				
360				// not to be applied to image gallery slider or projects carousel
361				if (!$current.parent().parent().is('.flexslider') && !$current.parent().parent().parent().is('#projects-carousel')) {
362					e.stopPropagation();
363					
364					$('.item-picture').each(function(index) {
365						if ($(this)[0] !== $current[0]) {
366							// not to be applied to image gallery slider or projects carousel
367							if (!$(this).parent().parent().is('.flexslider, #projects-carousel')) {
368								$('.image-overlay', this).css('background', 'rgba(0, 0, 0, 0)');
369								$('.image-overlay span', this).css({'display': 'none', 'opacity': '0'});
370							}
371						}
372					});
373					
374					if ($('.image-overlay span', this).css('display') == 'none') {
375						e.preventDefault();
376						$('.image-overlay', this).css('background', 'rgba(0, 0, 0, 0.5)');
377						$('.image-overlay span', this).css({'display': 'block', 'opacity': '1'});
378					}	
379				}
380			});
381			
382			$('html').on('touchend', function() {
383				$('.item-picture').each(function() {
384					// not to be applied to image gallery slider or projects carousel
385					if (!$(this).parent().parent().is('.flexslider') && !$(this).parent().parent().parent().is('#projects-carousel')) {
386						$('.image-overlay', this).css('background', 'rgba(0, 0, 0, 0)');
387						$('.image-overlay span', this).css({'display': 'none', 'opacity': '0'});
388					}
389				});
390			});
391		}
392		
393	})();
394	
395	
396	/* ---------------------------------------------------------------------- */
397	/*	Projects Carousel
398	/* ---------------------------------------------------------------------- */
399
400	(function() {
401		
402		var $carousel = $('#projects-carousel');
403		
404		function getWindowWidth() {
405			if ($(window).width() < 768) { // for small-screen mobile devices
406				visibleSlides = animationStep = 1;
407			} else if ($(window).width() < 960) { // for a width of 768px
408				if (fullWidth && carouselClass != 'two-slides') { visibleSlides = animationStep = 3; }
409				else { visibleSlides = animationStep = 2; }
410			} else if ($(window).width() < 1200) { // for a width of 1024px
411				if (fullWidth && carouselClass == 'four-slides') { visibleSlides = animationStep = 4; }
412				else if (fullWidth && carouselClass == 'two-slides') { visibleSlides = animationStep = 2; }
413				else { visibleSlides = animationStep = 3; }
414			} else { // for a width of 1280px and higher
415				if (carouselClass == 'three-slides') { visibleSlides = animationStep = 3; }
416				else if (carouselClass == 'four-slides') { visibleSlides = animationStep = 4; }
417				else if (fullWidth && carouselClass == 'two-slides') { visibleSlides = animationStep = 2; }
418			}
419		}
420		
421		function adjustCarousel() {
422			getWindowWidth();
423			if (visibleSlides != carousel.settings.visibleSlides) {
424				carousel.update({
425					animation: {step: animationStep},
426					visibleSlides: visibleSlides
427				});
428			}
429		}
430		
431		if ($carousel.length) {
432		
433			var animationStep, visibleSlides, carouselClass,
434				fullWidth = $('#main-content').length ? false : true;
435				
436			if ($carousel.hasClass('two-slides')) { carouselClass = 'two-slides'; }
437			else if ($carousel.hasClass('four-slides')) { carouselClass = 'four-slides'; }
438			else { carouselClass = 'three-slides'; }
439			
440			// Init carousel
441			getWindowWidth();
442			var carousel = new Carousel($carousel, {animation: {step: animationStep}, visibleSlides: visibleSlides});
443			carousel.init();
444			
445			// Window resize event
446			$(window).on('resize', function() {
447				var timer = window.setTimeout(function() {
448					window.clearTimeout(timer);
449					adjustCarousel();
450				}, 30);
451			});
452		}
453
454	})();
455	
456	
457	/* ---------------------------------------------------------------------- */
458	/*	Testimonials Carousel
459	/* ---------------------------------------------------------------------- */
460
461	(function() {
462		
463		var $carousel = $('.testimonials-carousel'),
464			carousel_params = {animation: {duration: 300, step: 1}, visibleSlides: 1, behavior: {autoplay: 0, circular: false}};
465		
466		if ($carousel.length) {
467			
468			var resizeCarousel = function() {
469				$carousel.each(function() {
470					var containerWidth = $(this).parent().parent().parent().width();
471					$(this).children('li').css('width', containerWidth + 'px');
472				});
473			};
474			
475			resizeCarousel();
476			
477			// Window resize event
478			$(window).on('resize', function() {
479				var timer = window.setTimeout(function() {
480					window.clearTimeout(timer);
481					resizeCarousel();
482				}, 30);
483			});
484			
485			// Init carousel
486			if ($carousel.attr('data-autoplay') > 0) { carousel_params.behavior.autoplay = $carousel.attr('data-autoplay'); }
487			if ($carousel.attr('data-circular') == 'yes') { carousel_params.behavior.circular = true; }
488			if ($carousel.attr('data-circular') == 'no') { carousel_params.behavior.circular = false; }
489			
490			var carousel = new Carousel($carousel, carousel_params);
491			carousel.init();
492			
493		}
494
495	})();
496	
497	
498	/* ---------------------------------------------------------------------- */
499	/*	Accordion
500	/* ---------------------------------------------------------------------- */
501
502	(function() {
503
504		var $trigger = $('.accordion .toggle-trigger'),
505			$container = $('.accordion .toggle-container');
506			
507		$container.stop(true,true).hide();
508		$('.accordion .toggle-trigger.active').next().show();
509
510		$trigger.on('click', function(e) {
511			e.preventDefault();
512			var $this = $(this);
513			if ($this.next().is(':hidden')) {
514				$this.siblings('.toggle-trigger').removeClass('active').next().slideUp(300);
515				$this.toggleClass('active').next().slideDown(300);
516			}
517			return false; // IE9 hack
518		});
519		
520	})();
521	
522	
523	/* ---------------------------------------------------------------------- */
524	/*	Toggle
525	/* ---------------------------------------------------------------------- */
526
527	(function() {
528
529		var $trigger = $('.toggle .toggle-trigger'),
530			$container = $('.toggle .toggle-container');
531			
532		$container.stop(true,true).hide();
533		$('.toggle .toggle-trigger.active').next().show();
534
535		$trigger.on('click', function(e) {
536			e.preventDefault();
537			var $this = $(this);
538			$this.toggleClass('active');
539			if ($this.next().is(':hidden')) {
540				$this.next().slideDown(300);
541			} else {
542				$this.next().slideUp(300);
543			}
544			return false; // IE9 hack
545		});
546	})();
547	
548	
549	/* ---------------------------------------------------------------------- */
550	/*	Tabs
551	/* ---------------------------------------------------------------------- */
552	
553	(function() {
554
555		var $tabsNav = $('.tabs-nav'),
556			$tabsNavLis = $tabsNav.children('li'),
557			$tabContent = $('.tab-content');
558
559		$tabsNav.each(function() {
560			var $this = $(this);
561			$this.next().children('.tab-content').stop(true,true).hide();
562			if ($this.children('li').hasClass('active')) {
563				var $li_active = $this.children('li.active');
564				$li_active.parent().next().children('.tab-content').siblings( $li_active.find('a').attr('href') ).show();
565			} else {
566				$this.next().children('.tab-content').first().show();
567				$this.children('li').first().addClass('active').stop(true,true).show();
568			}
569			// for sidebar tabs (if the browser window width is 768px and higher)
570			if ($this.parent().parent().is('#sidebar') && $this.children('li').css('padding-right') == '0px') {
571				$this.children('li.active').prev().find('a').addClass('border-right-colored');
572			}
573		});
574
575		$tabsNavLis.on('click', function(e) {
576			e.preventDefault();
577			var $this = $(this);
578			if ($this.not('.active')) {
579				$this.siblings().removeClass('active').end().addClass('active');
580				$this.parent().next().children('.tab-content').stop(true,true).hide()
581															.siblings( $this.find('a').attr('href') ).show(); // or fadeIn()
582			}
583			// for sidebar tabs (if the browser window width is 768px and higher)
584			if ($this.parent().parent().parent().is('#sidebar') && $this.css('padding-right') == '0px') {
585				$this.siblings().find('a').removeClass('border-right-colored');
586				$this.prev().find('a').addClass('border-right-colored');
587			}
588			return false; // IE9 hack
589		});
590
591	})();
592	
593	
594	/* ---------------------------------------------------------------------- */
595	/*	Message Boxes
596	/* ---------------------------------------------------------------------- */
597	
598	(function() {
599		
600		window.setMsgBoxClosable = function (element) {
601			var msgBox = $(element),
602				closeBtn = $('<a class="close" href="#"></a>');
603			
604			closeBtn.appendTo(element);
605			closeBtn.click(function() {
606				msgBox.fadeTo(300, 0, function() {
607					msgBox.animate({height: 0, padding: 0, margin: 0}, 300);
608				});
609				if ($('html').hasClass('ie8')) {
610					closeBtn.fadeOut(300); // IE8 hack
611				}
612				return false;
613			});
614		};
615		
616		$('.message-box.closable').each(function() {
617			setMsgBoxClosable(this);
618		});
619	
620	})();
621	
622	
623	/* ---------------------------------------------------------------------- */
624	/*	Add iframe with YouTube/Vimeo player to a preview of the video type
625	/*	(for small-screen mobile devices)
626	/* ---------------------------------------------------------------------- */
627	
628	(function() {
629	
630		function getYouTubeParam(name, url) {
631			name = name.replace(/[\[]/,"\\\[").replace(/[\]]/,"\\\]");
632			var regexS = "[\\?&]"+name+"=([^&#]*)",
633				regex = new RegExp( regexS ),
634				results = regex.exec( url );
635			return ( results == null ) ? "" : results[1];
636		}
637	
638		// -- Add iframe with youtube player
639		$('.item-picture[data-type="youtube-video"], .video-preview[data-type="youtube-video"]').each(function() {
640			// regular youtube link
641			var movie_id = getYouTubeParam('v', $('a', this).attr('href'));
642			// youtu.be link
643			if (movie_id == "") {
644				movie_id = $('a', this).attr('href').split('youtu.be/');
645				movie_id = movie_id[1];
646				if (movie_id.indexOf('?') > 0) {
647					movie_id = movie_id.substr(0, movie_id.indexOf('?')); // strip anything after the ?
648				}
649				if (movie_id.indexOf('&') > 0) {
650					movie_id = movie_id.substr(0, movie_id.indexOf('&')); // strip anything after the &
651				}
652			}
653			$('<iframe>', {src: 'http://www.youtube.com/embed/'+movie_id+'?wmode=transparent&amp;rel=0&amp;showinfo=0', frameborder: '0'}).appendTo(this);
654		});
655			
656		// -- Add iframe with vimeo player
657		$('.item-picture[data-type="vimeo-video"], .video-preview[data-type="vimeo-video"]').each(function() {
658			var movie_id = $('a', this).attr('href'),
659				regExp = /http:\/\/(www\.)?vimeo.com\/(\d+)/,
660				match = movie_id.match(regExp);
661			$('<iframe>', {src: 'http://player.vimeo.com/video/'+match[2]+'?title=0&amp;byline=0&amp;portrait=0', frameborder: '0'}).appendTo(this);
662		});
663		
664	})();
665	
666	
667	/* ---------------------------------------------------------------------- */
668	/*	HTML5 Video Resizing
669	/* ---------------------------------------------------------------------- */
670	
671	(function() {
672		
673		var resizeContainer = function() {
674			$('.html5-video-container').each(function() {
675				var containerWidth = $(this).parent().width(),
676					containerHeight,
677					aspectRatio = $(this).attr('data-aspect-ratio');
678					
679				containerHeight = Math.floor(containerWidth/aspectRatio);
680				$(this).css({'width': containerWidth + 'px', 'height': containerHeight + 'px'});
681			});
682		};
683		
684		resizeContainer();
685		
686		// Window resize event
687		$(window).on('resize', function() {
688			var timer = window.setTimeout(function() {
689				window.clearTimeout(timer);
690				resizeContainer();
691			}, 30);
692		});
693		
694	})();
695	
696	/* ---------------------------------------------------------------------- */
697	/*	4 Column Gallery
698	/* ---------------------------------------------------------------------- */
699	
700	(function() {
701		
702		var setGalleryItemHeight = function() {
703			
704			$('.gallery-wrapper.four-cols').each(function() {
705				var imageHeight = $('.one-fourth.columns.gallery-item', this).height();
706				
707				if ($(window).width() >= 768) {
708					if (imageHeight > 0) { $('.one-half.columns.gallery-item', this).css('height', imageHeight + 'px'); }
709				} else {
710					$('.one-half.columns.gallery-item', this).css('height', '');
711				}
712			});
713			
714		};
715		
716		setGalleryItemHeight();
717		
718		// Window load event
719		$(window).load(function() {
720			setGalleryItemHeight();
721		});
722		
723		// Window resize event
724		$(window).on('resize', function() {
725			var timer = window.setTimeout(function() {
726				window.clearTimeout(timer);
727				setGalleryItemHeight();
728			}, 30);
729		});
730		
731	})();
732	
733	
734	/* ---------------------------------------------------------------------- */
735	/*	IE8 correction
736	/* ---------------------------------------------------------------------- */
737	
738	(function() {
739		
740		$('.ie8 .slider-caption *:last-child').css('margin-bottom', '0');
741		$('.ie8 .brief-nav li:last-child').css('padding-right', '0');
742		$('.ie8 .breadcrumb-nav li:last-child').css('padding-right', '0');
743		$('.ie8 #subheader-bar .sub-nav li:last-child').css('margin-right', '0');
744		$('.ie8 .feature-boxes.left-icon-box header + p:last-child').css('margin-bottom', '0');
745		$('.ie8 .feature-boxes.left-icon-box.small-icon.number-type article > div > *:last-child').css('margin-bottom', '0');
746		$('.ie8 #portfolio-filter li:last-child').css('padding-right', '0');
747		$('.ie8 .single-item-details .extra-content #portfolio-wrapper .portfolio-item-preview:last-child').css('margin-bottom', '0');
748		$('.ie8 #footer-bottom .footer-nav li:last-child a').css('padding-right', '0');
749		$('.ie8 .blog .post-meta > span:last-child').css('margin-right', '0');
750		$('.ie8 .blog .post-meta.slash-separated > span:last-child').css('padding-right', '0');
751		$('.ie8 .tabs-nav li:last-child').css('padding-right', '0');
752		$('.ie8 .tweets .tweet_even:last-child, .ie8 .tweets .tweet_odd:last-child').css('margin-bottom', '0');
753		$('.ie8 .social-icons li:last-child, .ie8 .social-icons.round li:last-child').css('margin-right', '0');
754		$('.ie8 .social-icons.small-size li:last-child, .ie8 .social-icons.small-size.round li:last-child').css('margin-right', '0');
755		$('.ie8 ul.feature-nav.inline li:last-child').css('margin-right', '0');
756		$('.ie8 ul.social-share li:last-child').css('margin-right', '0');
757		
758	})();
759	
760	/* ---------------------------------------------------------------------- */
761	/*	Pricing Tables
762	/* ---------------------------------------------------------------------- */
763	
764	(function() {
765	
766		$('html:not(.ie8) .pricing-table .table-column.featured').next().find('.header, .features, .footer').css('border-left', 'none');
767		$('.ie8 .pricing-table .table-column .features').find('li:odd').css('background-color', '#f7f7f7');
768		
769	})();
770	
771	/* ---------------------------------------------------------------------- */
772	/*	Google Maps
773	/* ---------------------------------------------------------------------- */
774	
775	(function() {
776	
777		var $gmap = $('#map');
778
779		if ($gmap.length) {
780			
781			// posType: "coordinates" - use geographical coordinates (latitude and longitude),
782			//          "address" - use geographical address
783			
784			var posType = 'address',
785				address = '1730 San Antonio Ave, Alameda, CA 94501', // map and marker address
786				mapCoords = {lat: 37.7668, lng: -122.2579}, // map coordinates
787				markerCoords = {lat: 37.7668, lng: -122.2579}, // marker coordinates
788				mapZoom = 15,
789				mapScrollwheel = false,
790				infoTitle = 'Some title goes here..',
791				infoString = '<h5 class="gm-title">ABC Ipsum Studios</h5><p>Lorem ipsum dolor sit amet, consectetur adipiscing elit.</p>',
792				infoMaxWidth = 250,
793				mapPosition,
794				markerPosition;
795			
796			// If needed, you can use 2 or more google maps (with separate parameters) on different pages
797			// by setting the value of gm_params object in an html file
798			if (typeof gm_params != 'undefined') {
799				if (gm_params.posType) { posType = gm_params.posType; }
800				if (gm_params.address) { address = gm_params.address; }
801				if (gm_params.mapCoords) { mapCoords = {lat: gm_params.mapCoords.lat, lng: gm_params.mapCoords.lng}; }
802				if (gm_params.markerCoords) { markerCoords = {lat: gm_params.markerCoords.lat, lng: gm_params.markerCoords.lng}; }
803				if (gm_params.infoTitle) { infoTitle = gm_params.infoTitle; }
804				if (gm_params.infoString) { infoString = gm_params.infoString; }
805			}
806			
807			var initialize = function() {
808				
809				var map,
810					mapOptions = {
811						zoom: mapZoom,
812						center: mapPosition,
813						backgroundColor: '#ffffff',
814						mapTypeId: google.maps.MapTypeId.ROADMAP,
815						scrollwheel: mapScrollwheel
816					};
817				map = new google.maps.Map(document.getElementById('map'), mapOptions);
818				
819				var marker = new google.maps.Marker({
820					position: markerPosition,
821					map: map,
822					title: infoTitle
823				});
824				
825				var infowindow = new google.maps.InfoWindow({
826					content: infoString,
827					maxWidth: infoMaxWidth
828				});
829				
830				google.maps.event.addListener(marker, 'click', function() {
831					infowindow.open(map, marker);
832				});
833				
834				// Window resize event
835				$(window).on('resize', function() {
836					var timer = window.setTimeout(function() {
837						window.clearTimeout(timer);
838						map.panTo(marker.getPosition()); // pan back to the marker
839					}, 30);
840				});
841			};
842			
843			google.maps.event.addDomListener(window, 'load', function(results, status) {
844				if (posType == 'coordinates') {
845					mapPosition = new google.maps.LatLng(mapCoords.lat, mapCoords.lng);
846					markerPosition = new google.maps.LatLng(markerCoords.lat, markerCoords.lng);
847					initialize();
848				}
849				if (posType == 'address') {
850					geocoder = new google.maps.Geocoder();
851					geocoder.geocode({'address': address}, function(results, status) {
852						if (status == google.maps.GeocoderStatus.OK) {
853							mapPosition = markerPosition = results[0].geometry.location;
854							initialize();
855						} else {
856							$gmap.text('Geocode was not successful for the following reason: '+status);
857						}
858					});
859				}
860			});
861		}
862		
863	})();
864	
865	
866	/* ---------------------------------------------------------------------- */
867	/*	Blog Post Comments
868	/* ---------------------------------------------------------------------- */
869	
870	(function() {
871		
872		var $commentReplyLink = $('.blog #comments .comment article a.reply'),
873			$messageField = $('.blog #comment-form textarea[name="message"]');
874			
875		$commentReplyLink.on('click', function(e) {
876			e.preventDefault();
877			
878			var $this = $(this),
879				author = $this.parent().find('h5, h6, .title, strong').text(),
880				date = $this.parent().find('.date').text();
881				
882			$messageField.focus().val('').val('Reply to: ' + author + ' (posted on ' + date + ')\n\n');
883			
884			// scroll to the top of the reply form section
885			var topDiff = $('.blog #submit-comment').offset().top - $(window).height();
886			if (topDiff > 0) {
887				$('html, body').animate({ scrollTop: $('.blog #submit-comment').offset().top});
888			}
889			
890			return false; // IE9 hack
891		});
892		
893	})();
894	
895	
896	/* ---------------------------------------------------------------------- */
897	/*	Contact/Comment Form
898	/* ---------------------------------------------------------------------- */
899	
900	(function() {
901		
902		var $form = $('#contact-form, #comment-form');
903		
904		if ($form.length) {
905			var $loader = $('<img>', {src: 'images/icons/ajax-loader.gif', width: '16', height: '11', alt: 'Loading...'})
906						.appendTo('#submit-button', $form).hide(),
907				$messageBox = $('<div class="message-box short">').appendTo($form).hide(),
908				success_msg,
909				error_msg1,
910				error_msg2;
911			
912			// Success and error notification messages for contact form
913			if ($form.attr('id') == 'contact-form') {
914				success_msg = 'Your message has been sent. Thank you!';
915				error_msg1 = 'There was an error sending the email! Please try again later.';
916				error_msg2 = 'Sorry, unexpected error. Please try again later.';
917			}
918			
919			// Success and error notification messages for comment form
920			if ($form.attr('id') == 'comment-form') {
921				success_msg = 'Your comment has been sent and is awaiting moderation. Thank you!';
922				error_msg1 = 'There was an error sending the comment! Please try again later.';
923				error_msg2 = 'Sorry, unexpected error. Please try again later.';
924			}
925			
926			$form.on('click', 'input[type="submit"]', function(e) {
927				e.preventDefault();
928				var hasError = false;
929				
930				// reset error notifications, hide loader and message box
931				$form.find('input, textarea, select').removeClass('error').siblings('label').find('span').removeClass('error');
932				$loader.hide();
933				$messageBox.hide();
934				
935				$form.find('input[type="text"], input[type="email"], input[type="checkbox"], textarea, select').each(function() {
936					var $this = $(this),
937						fieldValue = $.trim($this.val());
938					
939					if ($this.attr('required')) {
940						
941						// check if the checkbox is checked
942						if ($this.attr('type') == 'checkbox' && $this.is(':checked') == false) {
943							hasError = true;
944						}
945						
946						// check if the field has an empty value
947						else if (fieldValue == '' || fieldValue.length < 2) {
948							$this.addClass('error');
949							hasError = true;
950						}
951					}
952					
953					// email address validation
954					if ($this.attr('type') == 'email' && fieldValue.length > 0) {
955						// regex - http://fightingforalostcause.net/misc/2006/compare-email-regex.php
956						var regex=/^[-a-z0-9~!$%^&*_=+}{\'?]+(\.[-a-z0-9~!$%^&*_=+}{\'?]+)*@([a-z0-9_][-a-z0-9_]*(\.[-a-z0-9_]+)*\.(aero|arpa|biz|com|coop|edu|gov|info|int|mil|museum|name|net|org|pro|travel|mobi|[a-z][a-z])|([0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}))(:[0-9]{1,5})?$/i;
957						if (!regex.test(fieldValue)) {
958							$this.addClass('error');
959							hasError = true;
960						}
961					}
962				});
963				
964				// AJAX request 
965				if (!hasError) {
966					var localDate = new Date(),
967						localTimezoneOffset = localDate.getTimezoneOffset(), // in minutes
968						form_data = $form.serialize() + '&timezone_offset=' + localTimezoneOffset;
969					
970					if ($form.attr('id') == 'comment-form') { // for comment form only
971						var postTitle = $('.blog .single-post').find('h2.title, h3.title').text(),
972							postDay = $('.blog .single-post .post-date').find('.day').text(),
973							postMonth = $('.blog .single-post .post-date').find('.month').text(),
974							postYear = $('.blog .single-post .post-date').find('.year').text(),
975							postDate = postDay + ' ' + postMonth + ' ' + postYear;
976						if (!(postDay&&postMonth&&postYear)) {
977							postDate = $('.blog .single-post #post-date').text().replace('|', '');
978						}
979						form_data += '&post_title=' + postTitle + '&post_date=' + postDate;
980					}
981					
982					$loader.show();
983					
984					var request = $.post($form.attr('action'), form_data, function(data) {
985						$loader.hide();
986						if (data.indexOf('success') !== -1) {
987							showMessageBox(success_msg, 'success');
988							$form.find('input[type="text"], input[type="email"], textarea, select').val('').end()
989								.find('input[type="checkbox"]').attr('checked', false);
990						} else if (data.indexOf('error') !== -1) {
991							showMessageBox(error_msg1, 'error');
992						} else {
993							showMessageBox(error_msg2, 'error');
994						}
995					})
996					.fail(function() {
997						$loader.hide();
998						showMessageBox(error_msg2, 'error');
999					});
1000				}
1001				
1002				return false; // IE9 hack
1003				
1004			});
1005			
1006		}
1007		
1008		function showMessageBox(msg, type) {
1009			$messageBox.html('<p>'+msg+'</p>').removeClass('success error').addClass(type).show();
1010			
1011			// scroll to the bottom of the form to show a notification message
1012			var bottomDiff = $form.offset().top + $form.outerHeight() - $(window).height();
1013			if ($(document).scrollTop() < bottomDiff) {
1014				$('html, body').animate({ scrollTop: bottomDiff});
1015			}
1016		}
1017	
1018	})();
1019	
1020	
1021	/* ---------------------------------------------------------------------- */
1022	/*	Subscription Form
1023	/* ---------------------------------------------------------------------- */
1024	
1025	(function() {
1026		
1027		var $form = $('#subscription-form');
1028		
1029		if ($form.length) {
1030			var $emailField = $('input[type="email"]', $form),
1031				$messageBox = $('<div class="footer-message">').appendTo($form.parent()).hide(),
1032				info_msg = 'Enter your email address',
1033				success_msg = 'Your email address has been added to our newsletter mailing list.',
1034				warning_msg1 = 'Please enter the valid email address.',
1035				warning_msg2 = 'Sending... please wait',
1036				error_msg1 = 'There was an error sending the email! Please try again later.',
1037				error_msg2 = 'Sorry, unexpected error. Please try again later.';
1038			
1039			$emailField.val(info_msg);
1040			$emailField.on('blur', function() {
1041				if (this.value == '') { this.value = info_msg; }
1042			});
1043			$emailField.on('focus', function() {
1044				if (this.value == info_msg) { this.value = ''; }
1045			});
1046			
1047			$form.on('click', 'input[type="submit"]', function(e) {
1048				e.preventDefault();
1049				var hasError = false,
1050					fieldValue = $.trim($emailField.val());
1051				
1052				// reset error notification and hide message box
1053				$emailField.removeClass('error');
1054				$messageBox.hide();
1055				
1056				// check if the field has an empty value
1057				if ($emailField.attr('required')) {
1058					if (fieldValue == '' || fieldValue.length < 2) {
1059						$emailField.addClass('error');
1060						hasError = true;
1061					}
1062				}
1063				
1064				// email address validation
1065				if (fieldValue.length > 0) {
1066					// regex - http://fightingforalostcause.net/misc/2006/compare-email-regex.php
1067					var regex=/^[-a-z0-9~!$%^&*_=+}{\'?]+(\.[-a-z0-9~!$%^&*_=+}
1067{\'?]+)*@([a-z0-9_][-a-z0-9_]*(\.[-a-z0-9_]+)*\.(aero|arpa|biz|com|coop|edu|gov|info|int|mil|museum|name|net|org|pro|travel|mobi|[a-z][a-z])|([0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}))(:[0-9]{1,5})?$/i;
1068					if (!regex.test(fieldValue)) {
1069						$emailField.addClass('error');
1070						if (fieldValue != info_msg) { showMessageBox(warning_msg1, 'info'); }
1071						hasError = true;
1072					}
1073				}
1074				
1075				// AJAX request 
1076				if (!hasError) {
1077					var localDate = new Date(),
1078						localTimezoneOffset = localDate.getTimezoneOffset(), // in minutes
1079						form_data = $form.serialize() + '&timezone_offset=' + localTimezoneOffset;
1080					
1081					showMessageBox(warning_msg2, 'info');
1082					
1083					var request = $.post($form.attr('action'), form_data, function(data) {
1084						if (data.indexOf('success') !== -1) {
1085							showMessageBox(success_msg, 'info');
1086							$emailField.val('');
1087						} else if (data.indexOf('error') !== -1) {
1088							showMessageBox(error_msg1, 'error');
1089						} else {
1090							showMessageBox(error_msg2, 'error');
1091						}
1092					})
1093					.fail(function() {
1094						showMessageBox(error_msg2, 'error');
1095					});
1096				}
1097				
1098				return false; // IE9 hack
1099				
1100			});
1101			
1102		}
1103		
1104		function showMessageBox(msg, type) {
1105			$messageBox.html(msg).removeClass('info error').addClass(type).show();
1106			if (type == 'error') {
1107				$emailField.addClass('error');
1108			}
1109		}
1110	
1111	})();
1112	
1113});

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.