PageSourceSearch

https://baplaza.com/js/script.js

js baplaza.com collected 2026-10-04 01:58:55 UTC 39,214 bytes, 2,885 lines download raw bytes

1/**************************************************************************
2
3 * One page template main javascript file
4
5 * @version: 1.1 (19.05.2015)
6
7 * @author Olegnax
8
9 * @website http://olegnax.com
10
11 **************************************************************************/
12
13(function ($) {
14
15	"use strict";
16
17//Global variables
18
19	var $window, root,
20
21			touch = Modernizr.touch,
22
23			responsive = 993,
24
25			loaderCounter = 0,
26
27//	Array of javascrripts plugins, support external URLs also
28
29			loadScriptsDefault = [
30
31				'/js/imagesloaded.pkgd.min.js',
32
33				'/js/bootstrap.min.js',
34
35				'/js/isotope.min.js',
36
37				'/js/jquery.cycle2.min.js',
38
39				'/js/jquery.cycle2.swipe.min.js',
40
41				'/js/jquery.flexslider-min.js',
42
43				'/js/jquery.themepunch.tools.min.js',
44
45				'/js/jquery.themepunch.revolution.min.js',
46
47				'/js/jquery.validate.min.js',
48
49				'/js/jquery.velocity.min.js',
50
51				'/js/jquery.magnific-popup.min.js',
52
53				'/js/parallax.min.js',
54
55				'/js/smoothScroll.min.js',
56
57				'/js/superfish.min.js',
58
59				'/js/tweets.min.js',
60
61				'/js/waypoints.min.js',
62
63				'/js/jquery.countTo.min.js'
64
65			],
66
67			loadScripts = (typeof loadPageScripts === "undefined") ? loadScriptsDefault : loadPageScripts,
68
69			loaderMaxCounter = loadScripts.length + jQuery("body img").length,
70
71			sitePath = window.location.origin,
72
73			hash = window.location.hash.replace("#", ""),
74
75			flexslides = {},
76
77			ajaxportfolios = {},
78
79			intervals = {},
80
81			started = 0,
82
83			viewportH,
84
85			fileprotocol = (window.location.protocol == 'file:') ? true : false;
86
87
88	
89
90	if (fileprotocol) {
91
92		sitePath = 'http://family.olegnax.com'; //if somebody load html via file protocol
93
94	}
95
96
97
98
99
100//Easing function
101
102	jQuery.extend(jQuery.easing, {
103
104		easeOutExpo: function (x, t, b, c, d) {
105
106			return (t == d) ? b + c : c * (-Math.pow(2, -10 * t / d) + 1) + b;
107
108		}
109
110	});
111
112
113
114//Old IE animation fix
115
116	jQuery(document).on("skipAnimation", ".animated", function (e) {
117
118		if (!Modernizr.cssanimations) {
119
120
121
122			jQuery(this).trigger('notAnimated');
123
124		}
125
126	});
127
128
129
130
131
132// Core
133
134	var Core = {
135
136		init: function () {
137
138
139
140			$window = $(window);
141
142			root = $('html, body');
143
144			touch = touch;
145
146
147
148			$window.on('ready scroll', function () {
149
150				//			init ToTop function
151
152				SmoothScrollTo.totop();
153
154			});
155
156
157
158		}
159
160	};
161
162
163
164
165
166// Loader
167
168	var Loader = {
169
170		el: jQuery('.loader'),
171
172		bar: jQuery('.loader').find('.bar'),
173
174		//	Site preloader animation
175
176		init: function (callback) {
177
178			if (!touch) {
179
180			jQuery('[data-animation]').css({
181
182				'opacity': 0
183
184			});
185
186			}
187
188			viewportH = jQuery(window).height();
189
190			var margin = (viewportH / 2 - Loader.bar.height() / 2);
191
192			if (Loader.el.length) {
193
194				Loader.bar.css({
195
196					'margin-top': margin + 'px',
197
198					'visibility': 'visible'
199
200				}).addClass('animated fadeInDown fast').one('webkitAnimationEnd mozAnimationEnd MSAnimationEnd oanimationend animationend notAnimated', function () {
201
202
203
204					jQuery(this).find('.progress').css({
205
206						'visibility': 'visible'
207
208					}).addClass('animated fadeIn faster').one('webkitAnimationEnd mozAnimationEnd MSAnimationEnd oanimationend animationend notAnimated', function () {
209
210
211
212						Loader.resize();
213
214						$(window).on('load ready resize', function () {
215
216							Loader.resize();
217
218						});
219
220						callback();
221
222					}).trigger('skipAnimation');
223
224				}).trigger('skipAnimation');
225
226			} else {
227
228				callback();
229
230			}
231
232		},
233
234		resize: function () {
235
236			viewportH = jQuery(window).height();
237
238			var margin = (viewportH / 2 - Loader.bar.height() / 2);
239
240			Loader.bar.css('margin-top', margin + 'px');
241
242		},
243
244		progressEl: jQuery('.loader .progress span'),
245
246		updateProgress: function (value) {
247
248			this.progressEl.css({
249
250				width: value + '%'
251
252			});
253
254			if (value === 100) {
255
256				setTimeout(function () {
257
258					Loader.hide();
259
260				}, 800);
261
262			}
263
264
265
266		},
267
268		hide: function () {
269
270
271
272			if (Loader.el.length) {
273
274				Loader.bar.find('.progress').addClass('fadeOut faster').one('webkitAnimationEnd mozAnimationEnd MSAnimationEnd oanimationend animationend notAnimated', function () {
275
276					Loader.bar.addClass('fadeOutDown fast').one('webkitAnimationEnd mozAnimationEnd MSAnimationEnd oanimationend animationend notAnimated', function () {
277
278						setTimeout(function () {
279
280							Loader.el.addClass('animated fadeOut faster').one('webkitAnimationEnd mozAnimationEnd MSAnimationEnd oanimationend animationend notAnimated', function () {
281
282								jQuery(this).remove();
283
284								if (typeof (jQuery.fn.waypoint) !== 'undefined') {
285
286									Waypoints.animation();
287
288								}
289
290							}).trigger('skipAnimation');
291
292
293
294						}, 500);
295
296					}).trigger('skipAnimation');
297
298				}).trigger('skipAnimation');
299
300			} else {
301
302				if (typeof (jQuery.fn.waypoint) !== 'undefined') {
303
304					Waypoints.animation();
305
306				}
307
308			}
309
310		},
311
312		//	Inline preloader
313
314		inlineLoader: {
315
316			loader: '<div class="inline-loader"><svg height="40" width="40" ><circle cx="20" cy="20" r="19" stroke="rgba(190,190,190,.5)" stroke-width="2" fill="none" /></svg><svg height="40" width="40" class="top"><circle cx="20" cy="20" r="19" stroke="#a2a851" stroke-width="2" fill="none" stroke-dasharray="25 160" stroke-dashoffset="-8"/></svg><div>',
317
318			init: function (idName) {
319
320				jQuery(idName).each(function () {
321
322					jQuery(this).append(Loader.inlineLoader.loader);
323
324					Loader.inlineLoader.animate(idName);
325
326				});
327
328			},
329
330			animate: function (idName) {
331
332				var angle = 360;
333
334				if (typeof (jQuery.fn.velocity) !== 'undefined') {
335
336					jQuery(idName + ' .top').velocity({
337
338						rotateZ: angle
339
340					}, {
341
342						duration: 900,
343
344						easing: 'linear'
345
346					});
347
348				}
349
350				intervals[idName] = setInterval(function () {
351
352					angle = angle + 360;
353
354					if (typeof (jQuery.fn.velocity) !== 'undefined') {
355
356						jQuery(idName + ' .top').velocity({
357
358							rotateZ: angle
359
360						}, {
361
362							duration: 900,
363
364							easing: 'linear'
365
366						});
367
368					}
369
370
371
372				}, 800);
373
374			},
375
376			hide: function (idName) {
377
378				jQuery(idName).find('.inline-loader').remove();
379
380				clearInterval(intervals[idName]);
381
382
383
384			}
385
386		}
387
388	};
389
390
391
392//Count loading progress for site loader
393
394	var UpdateLoaderCounter = function (url) {
395
396		loaderCounter++;
397
398		var percentage = parseInt(loaderCounter / loaderMaxCounter * 100);
399
400
401
402		if (percentage.toString().length == 1) {
403
404			percentage = '  ' + percentage;
405
406		} else if (percentage.toString().length == 2) {
407
408			percentage = ' ' + percentage;
409
410		}
411
412
413
414		Loader.updateProgress(percentage);
415
416
417
418		if (loaderCounter === loadScripts.length) {
419
420			InitJS();
421
422		}
423
424
425
426	};
427
428
429
430// AJAX loading of javascripts plugins
431
432	var LoadJS = function () {
433
434
435
436		var url = [];
437
438
439
440		jQuery.each(loadScripts, function (i)
441
442		{
443
444
445
446			if (/(^http:\/\/)|(^https:\/\/)|(^\/\/)|(^www.)/.test(loadScripts[i])) {
447
448				url[i] = loadScripts[i];
449
450		} else {
451
452				url[i] = sitePath + loadScripts[i]
453
454		}
455
456
457
458		jQuery.ajax({
459
460				url: url[i],
461
462			dataType: "script",
463
464				cache: true,
465
466				success: function () {
467
468					UpdateLoaderCounter(url[i]);
469
470			}
471
472		});
473
474
475
476
477
478
479
480
481
482		});
483
484
485
486	}
487
488
489
490// Smooth anchor scrolling
491
492	var SmoothScrollTo = {
493
494
495		scroll: function ($target) {
496
497			if (typeof (jQuery.fn.waypoint) !== 'undefined') {
498
499				jQuery('.waypoint').waypoint('destroy');
500
501			}
502
503
504
505			var offset;
506
507
508
509			if ($target.offset().top > jQuery('body>header').height() - 27 && window.innerWidth >= responsive) {
510
511				offset = $target.offset().top - jQuery('body>header').height() - 27;
512
513			} else {
514
515				offset = $target.offset().top;
516
517			}
518
519
520
521			root.stop().animate({
522
523				'scrollTop': offset
524
525			}, 500, 'easeOutExpo', function () {
526
527				setTimeout(function () {
528
529					if (typeof (jQuery.fn.waypoint) !== 'undefined') {
530
531						Waypoints.init();
532
533					}
534
535				}, 500);
536
537
538
539			});
540
541		},
542
543		hash: function () {
544
545			if (jQuery('*[data-hash="' + hash + '"]').length) {
546
547				SmoothScrollTo.scroll(jQuery('*[data-hash="' + hash + '"]'));
548
549			} else {
550
551				if (typeof (jQuery.fn.waypoint) !== 'undefined') {
552
553					Waypoints.init();
554
555				}
556
557			}
558
559		},
560
561		links: function () {
562
563			jQuery("a[href^='#']").on({
564
565				click: function (e) {
566
567					e.preventDefault();
568
569					if (this.hash.length && (jQuery(this.hash).length || jQuery('*[data-hash="' + this.hash.replace("#", "") + '"]').length)) {
570
571
572
573						var $target = (jQuery(this.hash).length) ? jQuery(this.hash) : jQuery('*[data-hash="' + this.hash.replace("#", "") + '"]');
574
575
576
577						if (jQuery('nav.main-menu').css('display') === 'block') {
578
579							jQuery('nav.main-menu>div').addClass('collapsed');
580
581							jQuery('.navbar-collapse').removeClass('in');
582
583							jQuery('.navbar-header').toggleClass('selected');
584
585						}
586
587
588
589						SmoothScrollTo.scroll($target);
590
591
592
593					}
594
595				},
596
597			});
598
599		},
600
601		//ToTop link show/hide
602
603		totop: function () {
604
605			if (jQuery(window).scrollTop() > 100) {
606
607				jQuery('a#toTop').show();
608
609			} else {
610
611				jQuery('a#toTop').hide();
612
613			}
614
615		}
616
617	}
618
619
620
621
622
623
624
625//Full screen section
626
627	var FullScreenSection = {
628
629		init: function () {
630
631			$window.on('ready resize', function () {
632
633				var contentH;
634
635				jQuery('section.fullscreen').each(function () {
636
637
638
639					contentH = jQuery(this).outerHeight();
640
641
642
643					if (typeof (jQuery(this).data('heightO')) == 'undefined') {
644
645						jQuery(this).data('heightO', contentH);
646
647					} else {
648
649						contentH = jQuery(this).data('heightO');
650
651					}
652
653
654
655					if (contentH < viewportH) {
656
657						jQuery(this).height(viewportH);
658
659						jQuery(this).find('.container').css('margin-top', (viewportH - contentH) / 2 + 'px');
660
661					}
662
663				});
664
665			});
666
667		}
668
669	}
670
671
672
673
674
675// Isotope gallery
676
677	var IsotopeGallery = {
678
679		init: function () {
680
681			IsotopeGallery.isotope('.portfolioContainer');
682
683		},
684
685		isotope: function (idName) {
686
687			jQuery(idName).each(function () {
688
689				var $container = jQuery(this);
690
691
692
693				$container.isotope({
694
695					transformsEnabled: true,
696
697					masonry: {
698
699						columnWidth: $container.find('article')[0]
700
701					}
702
703				});
704
705
706
707				IsotopeGallery.isotopeFilters($container);
708
709				IsotopeGallery.isotopeResize($container);
710
711				IsotopeGallery.isotopeLoadMore($container);
712
713
714
715				$window.on('load ready resize', function () {
716
717					setTimeout(function () {
718
719						IsotopeGallery.isotopeResize($container);
720
721					}, 150);
722
723				});
724
725			});
726
727		},
728
729		isotopeFilters: function (container) {
730
731			var filterContainer = container.closest('div.portfolio').find('.filters');
732
733			if (filterContainer.length) {
734
735				filterContainer.find('ul').remove();
736
737				var filters = [];
738
739				container.find('article').each(function () {
740
741					var cat = jQuery(this).data('category');
742
743					cat = cat.replace(/\s*,\s*/g, ',');
744
745					cat = cat.replace(/,{2,}/g, ',');
746
747					cat = cat.replace(/,+$/g, '');
748
749					cat = cat.replace(/^,+/g, '');
750
751					cat = cat.split(',');
752
753					filters = jQuery.unique(jQuery.merge(filters, cat).sort());
754
755				});
756
757
758
759				var list = '<ul><li><a  data-filter="" href="#" class="current">All</a></li>';
760
761				jQuery.each(filters, function (index, value) {
762
763					list = list + '<li><a  data-filter="' + value + '" href="#">' + value + '</a></li>';
764
765				});
766
767				list = list + '</ul>';
768
769				if (typeof (jQuery.fn.velocity) !== 'undefined') {
770
771					filterContainer.append(list).velocity({
772
773						opacity: 1
774
775					}, 1000);
776
777				} else {
778
779					filterContainer.append(list).css('opacity', 1);
780
781				}
782
783
784
785
786
787				filterContainer.find('li a').on("click", function (e) {
788
789					e.preventDefault();
790
791
792
793					jQuery(this).closest('ul').find('.current').removeClass('current');
794
795					jQuery(this).addClass('current');
796
797
798
799					var selector = jQuery(this).attr('data-filter');
800
801
802
803					container.isotope({
804
805						filter: function () {
806
807							var itemcat = jQuery(this).data('category');
808
809							return itemcat.match(selector);
810
811						}
812
813					});
814
815
816
817
818
819					SmoothScrollTo.scroll(jQuery('#ajaxed_content'));
820
821					setTimeout(function () {
822
823						jQuery("#ajaxed_content #ajax-content").slideUp(500);
824
825						jQuery("#ajaxed_content").html('');
826
827						$window.trigger('resize');
828
829					}, 500);
830
831
832
833
834
835				});
836
837			}
838
839		},
840
841		isotopeResize: function (container) {
842
843
844
845			var $colW = container.width() / (100 / parseInt(container.find('article').css('max-width')));
846
847
848
849			container.find('article').each(function () {
850
851				jQuery(this).width($colW).find('img').width(parseFloat($colW));
852
853			});
854
855
856
857			container.isotope('layout');
858
859
860
861			container.isotope('on', 'layoutComplete', function () {
862
863
864
865				General.bodyresize();
866
867				jQuery.waypoints('refresh');
868
869			});
870
871
872
873		},
874
875		isotopeLoadMore: function (container) {
876
877			container.closest('div.portfolio').find('.portfolio_load_more').click(function () {
878
879
880
881				var url = jQuery(this).attr('href');
882
883
884
885				var $button = jQuery(this);
886
887				jQuery.ajax({
888
889					url: url,
890
891					dataType: "html",
892
893					beforeSend: function () {
894
895						$button.html('');
896
897						Loader.inlineLoader.init('.portfolio_load_more');
898
899					},
900
901					success: function (response) {
902
903						setTimeout(function () {
904
905							Loader.inlineLoader.hide(('.portfolio_load_more'));
906
907
908
909							$button.remove();
910
911							var elems = jQuery(response).find('.portfolioContainer article');
912
913							container.append(elems).isotope('appended', elems);
914
915							container.isotope({
916
917								filter: ''
918
919							});
920
921							IsotopeGallery.isotopeFilters(container);
922
923							$window.trigger('resize');
924
925							setTimeout(function () {
926
927								$window.trigger('resize');
928
929							}, 1000);
930
931						}, 2500);
932
933					}
934
935
936
937				});
938
939				return false;
940
941			});
942
943		}
944
945	}
946
947
948
949//Main menu
950
951	var MainMenu = {
952
953		init: function () {
954
955			jQuery('ul.sf-menu').superfish({
956
957				hoverClass: 'sfHover',
958
959				delay: 300,
960
961				animation: {
962
963					opacity: 'show',
964
965					height: 'auto'
966
967				},
968
969				speed: '1',
970
971				autoArrows: false,
972
973				dropShadows: false,
974
975				disableHI: true
976
977			}).supposition();
978
979
980
981			jQuery('ul.sf-menu li.dropdown > a').append('<em>+</em>');
982
983			jQuery('ul.sf-menu li.dropdown > a em').click(function () {
984
985				if (jQuery(this).text() == '+') {
986
987					jQuery(this).parent().parent().addClass('opened');
988
989					jQuery(this).parent().next().show();
990
991					jQuery(this).text('-');
992
993				} else {
994
995					jQuery(this).parent().parent().removeClass('opened');
996
997					jQuery(this).parent().next().hide();
998
999					jQuery(this).text('+');
1000
1001				}
1002
1003				return false;
1004
1005			});
1006
1007
1008
1009			jQuery(".navbar-header").click(function () {
1010
1011				jQuery(this).toggleClass('selected');
1012
1013			});
1014
1015			$window.on('ready resize', function () {
1016
1017				MainMenu.absolute();
1018
1019			});
1020
1021
1022
1023
1024
1025		},
1026
1027//	adjustments for section under menu if menu with absolute position
1028
1029		absolute: function () {
1030
1031
1032
1033			var headerH = jQuery('header:not(".without-absolute")').height(),
1034
1035					content = jQuery('header:not(".without-absolute")').next().find('.container');
1036
1037
1038
1039			setTimeout(function () {
1040
1041				if (content.length) {
1042
1043					var contentMT = (content.outerHeight(true) - content.height()) / 2;
1044
1045
1046
1047					if (headerH > contentMT) {
1048
1049						content.css('padding-top', headerH - contentMT + 'px');
1050
1051					}
1052
1053				}
1054
1055			}, 200);
1056
1057		}
1058
1059	}
1060
1061
1062
1063
1064
1065
1066
1067//Sticky header
1068
1069	var StickyHeader = {
1070
1071		head_top: jQuery('body>header').height(),
1072
1073		head_height: jQuery('body>header').outerHeight(true),
1074
1075		init: function () {
1076
1077			$window.on('ready load resize scroll', function () {
1078
1079				if (jQuery('body>header').hasClass('without-absolute') && !touch) {
1080
1081					jQuery('body>header').removeClass('without-absolute').css('position', 'fixed').before('<section class="header_push"></section>');
1082
1083					jQuery('section.header_push').height(StickyHeader.head_height);
1084
1085
1086
1087				}
1088
1089				setTimeout(function () {
1090
1091					if ((jQuery('body>header').hasClass('sticky') && $window.scrollTop() <= StickyHeader.head_top)) {
1092
1093						jQuery('body>header').removeClass('sticky');
1094
1095					} else if (!jQuery('body>header').hasClass('sticky') && $window.scrollTop() > StickyHeader.head_top) {
1096
1097						jQuery('body>header').addClass('sticky');
1098
1099					}
1100
1101				}, 100);
1102
1103				jQuery('header.alt.sticky .navbar-collapse').css('max-height', viewportH - 34);
1104
1105			});
1106
1107		}
1108
1109	}
1110
1111
1112
1113
1114
1115//Twitter feed
1116
1117	var TwitterFeed = {
1118
1119		el: {
1120
1121			widget: jQuery('.twitterWidget'),
1122
1123			twitterList: jQuery('.twitterWidget').find(".twitterList")
1124
1125		},
1126
1127		utils: {
1128
1129			username: jQuery('.twitterWidget').data("user"),
1130
1131			currentIndex: 0,
1132
1133			callback: function () {
1134
1135				jQuery(window).resize();
1136
1137			},
1138
1139			isReady: false,
1140
1141			height: 0,
1142
1143			text_specify: "'You need to specify a username",
1144
1145			text_error: "There was an error connecting to your Twitter account",
1146
1147			text_follow: "",
1148
1149			text_on_twitter: ""
1150
1151		},
1152
1153		init: function () {
1154
1155			getTweets(this.el, this.utils);
1156
1157		}
1158
1159
1160
1161	}
1162
1163
1164
1165
1166
1167//Google MAP
1168
1169	var GMap = {
1170
1171		geocoder: function (idName) {
1172
1173			var geocoder = new google.maps.Geocoder(),
1174
1175					m_location,
1176
1177					address = jQuery(idName).data('address');
1178
1179			if (jQuery(idName).length) {
1180
1181				geocoder.geocode({
1182
1183					'address': address
1184
1185				}, function (results, status) {
1186
1187					if (status == google.maps.GeocoderStatus.OK) {
1188
1189						m_location = results[0].geometry.location;
1190
1191					} else {
1192
1193						m_location = new google.maps.LatLng(-33.86938, 151.204834);
1194
1195					}
1196
1197					GMap.map(m_location, address);
1198
1199				});
1200
1201			}
1202
1203		},
1204
1205		map: function (m_location, address) {
1206
1207			var myOptions = {
1208
1209				zoom: 14,
1210
1211				center: m_location,
1212
1213				scrollwheel: false,
1214
1215				scaleControl: false,
1216
1217				disableDefaultUI: false,
1218
1219				mapTypeId: google.maps.MapTypeId.ROADMAP,
1220
1221				styles: [
1222
1223					{
1224
1225						"stylers": [
1226
1227							{
1228
1229								"hue": "#a2a851"
1230
1231							},
1232
1233							{
1234
1235								"invert_lightness": true
1236
1237							},
1238
1239							{
1240
1241								"saturation": -50
1242
1243							},
1244
1245							{
1246
1247								"lightness": 70
1248
1249							},
1250
1251							{
1252
1253								"gamma": 0.2
1254
1255							}
1256
1257						]
1258
1259					},
1260
1261					{
1262
1263						"featureType": "water",
1264
1265						"elementType": "geometry",
1266
1267						"stylers": [
1268
1269							{
1270
1271								"color": "#1d1d1d"
1272
1273							}
1274
1275						]
1276
1277					}
1278
1279				]
1280
1281			};
1282
1283			var map = new google.maps.Map(document.getElementById("mapheader"), myOptions);
1284
1285
1286
1287			var image = "http://placehold.it/70x78";
1288
1289			var marker = new google.maps.Marker({
1290
1291				map: map,
1292
1293				icon: image,
1294
1295				position: map.getCenter()
1296
1297			});
1298
1299
1300
1301			var contentString = address;
1302
1303			var infowindow = new google.maps.InfoWindow({
1304
1305				content: contentString
1306
1307			});
1308
1309
1310
1311			if (touch) {
1312
1313				map.setOptions({
1314
1315					draggable: false
1316
1317				});
1318
1319			} else {
1320
1321				map.setOptions({
1322
1323					draggable: true
1324
1325				});
1326
1327			}
1328
1329
1330
1331			google.maps.event.addListener(marker, "click", function () {
1332
1333				infowindow.open(map, marker);
1334
1335			});
1336
1337			google.maps.event.addDomListener(window, "resize", function () {
1338
1339				var center = map.getCenter();
1340
1341				google.maps.event.trigger(map, "resize");
1342
1343				map.setCenter(center);
1344
1345
1346
1347				if (touch) {
1348
1349					map.setOptions({
1350
1351						draggable: false
1352
1353					});
1354
1355				} else {
1356
1357					map.setOptions({
1358
1359						draggable: true
1360
1361					});
1362
1363				}
1364
1365			});
1366
1367		},
1368
1369		load: function () {
1370
1371			var script = document.createElement('script');
1372
1373			script.type = 'text/javascript';
1374
1375			script.src = '//maps.googleapis.com/maps/api/js?v=3.exp&' +
1376
1377					'callback=gmap';
1378
1379			if (fileprotocol) {
1380
1381				script.src = 'http://maps.googleapis.com/maps/api/js?v=3.exp&' +
1382
1383						'callback=gmap';
1384
1385			}
1386
1387			document.body.appendChild(script);
1388
1389		},
1390
1391		init: function () {
1392
1393			GMap.geocoder('#mapheader');
1394
1395		}
1396
1397	}
1398
1399
1400
1401	window.gmap = function gmap() {
1402
1403		GMap.init();
1404
1405	}
1406
1407
1408
1409
1410
1411//Waypoints for menu and hashtags
1412
1413	var Waypoints = {
1414
1415		init: function () {
1416
1417			jQuery('.waypoint').waypoint(function (direction) {
1418
1419				var $active = jQuery(this);
1420
1421
1422
1423				if (direction === "up") {
1424
1425					$active = $active.waypoint('prev');
1426
1427				}
1428
1429
1430
1431				window.location.hash = $active.data('hash');
1432
1433				jQuery('.waypoint').removeClass('active-hash');
1434
1435				$active.addClass('active-hash');
1436
1437
1438
1439				if (jQuery('#top-main-menu a[href="#' + $active.data('hash') + '"]').length) {
1440
1441					jQuery('#top-main-menu li').each(function () {
1442
1443						jQuery(this).removeClass('current-menu-item');
1444
1445					});
1446
1447					jQuery('#top-main-menu a[href="#' + $active.data('hash') + '"]').each(function () {
1448
1449						jQuery(this).closest('li').addClass('current-menu-item');
1450
1451					});
1452
1453				}
1454
1455
1456
1457			}, {
1458
1459				offset: function () {
1460
1461					return jQuery('body>header').outerHeight();
1462
1463				}
1464
1465			});
1466
1467
1468
1469
1470
1471
1472
1473		},
1474
1475		//Content on appear animation. Added animate.css classes to each element with data "animation"
1476
1477		animation: function () {
1478
1479			jQuery('[data-animation]').waypoint({
1480
1481				triggerOnce: true,
1482
1483				offset: '95%',
1484
1485				handler: function () {
1486
1487
1488
1489					var ele = jQuery(this);
1490
1491
1492
1493					if (ele.hasClass('bars')) {
1494
1495						General.progressbars.init();
1496
1497					}
1498
1499
1500
1501					if (ele.hasClass('milestone-counter')) {
1502
1503						if (typeof (jQuery.fn.countTo) !== 'undefined') {
1504
1505							ele.find('.counter').countTo();
1506
1507						}
1508
1509					}
1510
1511
1512
1513					if (ele.hasClass('google-map')) {
1514
1515						GMap.load();
1516
1517					}
1518
1519
1520
1521
1522
1523					if (!touch) {
1524
1525					var fx = ele.attr('data-animation');
1526
1527					var delay = ele.attr('data-delay');
1528
1529
1530
1531
1532
1533					if (typeof delay === "undefined") {
1534
1535						delay = 0;
1536
1537					} else {
1538
1539						delay = parseFloat(delay.replace(",", "."));
1540
1541					}
1542
1543
1544
1545
1546
1547
1548
1549					setTimeout(function () {
1550
1551						ele.addClass('animated ' + fx).one('webkitAnimationEnd mozAnimationEnd MSAnimationEnd oanimationend animationend notAnimated', function () {
1552
1553							ele.css({
1554
1555								'opacity': 1
1556
1557							}).removeClass('animated ' + fx);
1558
1559						}).trigger('skipAnimation');
1560
1561
1562
1563					}, delay * 1000);
1564
1565				}
1566
1567				}
1568
1569			});
1570
1571		}
1572
1573
1574
1575	}
1576
1577
1578
1579
1580
1581// Flexslider carousels
1582
1583	var Flexsliders = {
1584
1585		init: function () {
1586
1587			Flexsliders.flexcarousel('awards', 140, 60);
1588
1589		},
1590
1591		flexcarousel: function (idName, iWidthOrigin, iMargin) {
1592
1593			if (jQuery('#' + idName).length) {
1594
1595				var cWidth = jQuery('#' + idName).width();
1596
1597				var iCount = Math.ceil(cWidth / (iWidthOrigin + iMargin));
1598
1599				var iWidth = parseFloat((cWidth - iMargin * (iCount - 1)) / iCount);
1600
1601
1602
1603				jQuery('#' + idName).flexslider({
1604
1605					animation: "slide",
1606
1607					animationLoop: false,
1608
1609					itemWidth: iWidth,
1610
1611					itemMargin: iMargin,
1612
1613					minItems: iCount,
1614
1615					maxItems: iCount,
1616
1617					prevText: "&larr",
1618
1619					nextText: "&rarr",
1620
1621					controlNav: false,
1622
1623					directionNav: false,
1624
1625					slideshowSpeed: 7000,
1626
1627					start: function (slider) {
1628
1629						flexslides[idName] = slider;
1630
1631						$window.on('load ready resize', function () {
1632
1633							Flexsliders.flexcarouselResize(idName, iWidthOrigin, iMargin);
1634
1635						});
1636
1637						jQuery(window).resize();
1638
1639					}
1640
1641				});
1642
1643			}
1644
1645		},
1646
1647		flexcarouselResize: function (idName, iWidthOrigin, iMargin) {
1648
1649			if (jQuery('#' + idName).length) {
1650
1651				var cWidth = jQuery('#' + idName).width();
1652
1653				var iCount = Math.ceil(cWidth / (iWidthOrigin + iMargin));
1654
1655				var iWidth = parseFloat((cWidth - iMargin * (iCount - 1)) / iCount);
1656
1657				jQuery('#' + idName + ' .slides > li').width(iWidth);
1658
1659
1660
1661				flexslides[idName].vars.maxItems = iCount;
1662
1663				flexslides[idName].vars.minItems = iCount;
1664
1665				flexslides[idName].flexAnimate(0);
1666
1667				flexslides[idName].update(flexslides[idName].pagingCount);
1668
1669				flexslides[idName].setProps();
1670
1671			}
1672
1673		}
1674
1675	}
1676
1677
1678
1679
1680
1681// Revolution slider
1682
1683	var RevolutionSliders = {
1684
1685		init: function () {
1686
1687			RevolutionSliders.revslider('.tp-banner-fullwidth-fullscreen');
1688
1689			RevolutionSliders.revslider('.tp-banner-fullwidth', {
1690
1691				delay: 7000,
1692
1693				startwidth: 1170,
1694
1695				startheight: 790,
1696
1697				hideThumbs: 10,
1698
1699				forceFullWidth: "on",
1700
1701				soloArrowLeftHOffset: 0,
1702
1703				soloArrowRightHOffset: 0,
1704
1705				soloArrowLeftValign: "center",
1706
1707				soloArrowRightValign: "center",
1708
1709				navigationType: "none",
1710
1711				onHoverStop: "on"
1712
1713			});
1714
1715		},
1716
1717		defaultOpt: {
1718
1719			delay: 7000,
1720
1721			startwidth: 1170,
1722
1723			startheight: 790,
1724
1725			hideThumbs: 10,
1726
1727			fullScreen: "on",
1728
1729			soloArrowLeftHOffset: 0,
1730
1731			soloArrowRightHOffset: 0,
1732
1733			soloArrowLeftValign: "center",
1734
1735			soloArrowRightValign: "center",
1736
1737			navigationType: "none",
1738
1739			onHoverStop: "off"
1740
1741		},
1742
1743		revslider: function (idName, opt) {
1744
1745			opt = (typeof opt === "undefined") ? RevolutionSliders.defaultOpt : opt;
1746
1747			jQuery(idName).revolution(opt);
1748
1749		}
1750
1751	}
1752
1753
1754
1755
1756
1757//Forms validation
1758
1759	var FormValidation = {
1760
1761		init: function () {
1762
1763			FormValidation.validation("#contact_form");
1764
1765		},
1766
1767		validation: function (idName) {
1768
1769			if (jQuery(idName).length) {
1770
1771				jQuery(idName).validate({
1772
1773					submitHandler: function (form) {
1774
1775						jQuery(form).find('button.send').attr('disabled', 'disabled');
1776
1777						FormValidation.AJAXprocess(form);
1778
1779					},
1780
1781					rules: {
1782
1783						email: "required email",
1784
1785						message: "required",
1786
1787						name: "required",
1788
1789						website: "url"
1790
1791					},
1792
1793					messages: {
1794
1795						name: "Please specify your name.",
1796
1797						message: "Please enter your message.",
1798
1799						website: "Please enter full URL",
1800
1801						email: {
1802
1803							required: "We need your email address to contact you.",
1804
1805							email: "Your email address must be in the format of [email protected]"
1806
1807						}
1808
1809					}
1810
1811				});
1812
1813			}
1814
1815		},
1816
1817		AJAXprocess: function (theForm) {
1818
1819			/* AJAX function for forms */
1820
1821			var $ = jQuery;
1822
1823			var formData = $(theForm).serialize();
1824
1825
1826
1827			$.ajax({
1828
1829				type: "POST",
1830
1831				url: $(theForm).attr('action'),
1832
1833				data: formData,
1834
1835				success: function (response) {
1836
1837					if (typeof (jQuery.fn.velocity) !== 'undefined') {
1838
1839						$(theForm).velocity({
1840
1841							opacity: 0
1842
1843						}, 500, function () {
1844
1845							if (response === 'success') {
1846
1847								$(theForm).before('<p class="note">Your message has been successfully sent to us!</p>').slideDown('fast'); //success text
1848
1849							} else {
1850
1851								$(theForm).before('<p class="note">Something going wrong with sending mail...</p>').slideDown('fast'); // error text when php mail() function failed
1852
1853							}
1854
1855						});
1856
1857					}
1858
1859					setTimeout(function () {
1860
1861						$(theForm).prev('.note').html('').slideUp('fast');
1862
1863						$(theForm).find("button").removeAttr('disabled');
1864
1865						$(theForm).find("input, textarea").val('');
1866
1867						if (typeof (jQuery.fn.velocity) !== 'undefined') {
1868
1869							$(theForm).velocity({
1870
1871								opacity: 1
1872
1873							}, 500);
1874
1875						} else {
1876
1877							$(theForm).css('opacity', 1);
1878
1879						}
1880
1881					}, 3000);
1882
1883				},
1884
1885				error: function () {
1886
1887					if (typeof (jQuery.fn.velocity) !== 'undefined') {
1888
1889						$(theForm).velocity({
1890
1891							opacity: 0
1892
1893						}, 500, function () {
1894
1895							$(theForm).before('<p class="note">Something going wrong with connection...</p>').fadeIn(500); //error text when ajax didn't send data to php processor
1896
1897						});
1898
1899						setTimeout(function () {
1900
1901							$(theForm).prev('.note').html('').slideUp('fast');
1902
1903							$(theForm).find("button").removeAttr('disabled');
1904
1905							$(theForm).find("input, textarea").val('');
1906
1907							if (typeof (jQuery.fn.velocity) !== 'undefined') {
1908
1909								$(theForm).velocity({
1910
1911									opacity: 1
1912
1913								}, 500);
1914
1915							} else {
1916
1917								$(theForm).css('opacity', 1);
1918
1919							}
1920
1921						}, 3000);
1922
1923					}
1924
1925				}
1926
1927			});
1928
1929
1930
1931			return false;
1932
1933		}
1934
1935	}
1936
1937
1938
1939
1940
1941//General functions
1942
1943	var General = {
1944
1945		init: function () {
1946
1947			General.flips('.flip-container');
1948
1949			if (!touch)
1950
1951				General.parallax('.parallax-section');
1952
1953			General.jcycle2('.testimonials-slideshow');
1954
1955			General.waypoints();
1956
1957			$window.on('load ready resize', function () {
1958
1959				General.bodyresize();
1960
1961			});
1962
1963		},
1964
1965		flips: function (idName) {
1966
1967
1968
1969			if (touch) {
1970
1971				jQuery(idName).on('click', function (e) {
1972
1973					if (jQuery(e.target).prop("tagName") !== 'A') {
1974
1975						jQuery(this).toggleClass('hover');
1976
1977					}
1978
1979				});
1980
1981			} else {
1982
1983				jQuery(idName).on('mouseenter mouseleave', function (e) {
1984
1985					if (jQuery(e.target).prop("tagName") !== 'A') {
1986
1987						jQuery(this).toggleClass('hover');
1988
1989					}
1990
1991				});
1992
1993				jQuery(document).on({
1994
1995					mouseenter: function () {
1996
1997						if (!jQuery(this).hasClass('hover'))
1998
1999							jQuery(this).addClass('hover');
2000
2001					},
2002
2003					mouseleave: function () {
2004
2005						jQuery(this).removeClass('hover');
2006
2007					}
2008
2009				}, idName);
2010
2011			}
2012
2013
2014
2015		},
2016
2017		parallax: function (idName) {
2018
2019			jQuery(idName).each(function () {
2020
2021				if (typeof (jQuery.fn.parallax) !== 'undefined') {
2022
2023					jQuery(this).parallax();
2024
2025				}
2026
2027			});
2028
2029		},
2030
2031		jcycle2: function (idName) {
2032
2033			if (typeof (jQuery.fn.cycle) !== 'undefined') {
2034
2035				jQuery(idName).on('cycle-initialized', function (e, opts) {
2036
2037					if (opts.slideCount > 1) {
2038
2039						jQuery(idName).addClass('jcycled');
2040
2041					}
2042
2043				});
2044
2045				jQuery(idName).cycle();
2046
2047			}
2048
2049		},
2050
2051		progressbars: {
2052
2053			init: function () {
2054
2055				General.progressbars.progress('.progressbar');
2056
2057			},
2058
2059			progress: function (idName) {
2060
2061				if (jQuery(idName).length) {
2062
2063					jQuery(idName).each(function (i) {
2064
2065						var $progress = jQuery(this).find('.progress');
2066
2067
2068
2069						$progress.find('.progressbar-title').css('width', $progress.data('percent') + '%');
2070
2071
2072
2073
2074
2075						if ($progress.length && $progress.hasClass('animate_progress')) {
2076
2077							General.progressbars.animate($progress.data('percent'), jQuery(this), (i + 1) * 200);
2078
2079						} else {
2080
2081							$progress.find('.bar').css('width', $progress.data('percent') + '%')
2082
2083						}
2084
2085					});
2086
2087				}
2088
2089			},
2090
2091			animate: function (percent, $element, timeout) {
2092
2093				setTimeout(function () {
2094
2095					$element.find('.bar').stop().animate({
2096
2097						width: percent + '%'
2098
2099					}, 1000, 'swing');
2100
2101				}, timeout);
2102
2103			}
2104
2105
2106
2107		},
2108
2109		waypoints: function () {
2110
2111			var waypoints = 1;
2112
2113			waypoints += jQuery('body>.waypoint').length;
2114
2115			jQuery('body>.waypoint').each(function () {
2116
2117				jQuery(this).css({
2118
2119					'z-index': waypoints,
2120
2121					'position': 'relative'
2122
2123				});
2124
2125				waypoints--;
2126
2127			});
2128
2129		},
2130
2131		bodyresize: function () {
2132
2133			var bodyH = 0;
2134
2135			setTimeout(function () {
2136
2137				jQuery('body>section').each(function () {
2138
2139					bodyH += jQuery(this).outerHeight();
2140
2141				});
2142
2143				jQuery('body').height(bodyH - 1);
2144
2145			}, 150);
2146
2147		}
2148
2149	}
2150
2151
2152
2153
2154
2155//Lightbox
2156
2157	var MPopup = {
2158
2159		init: function () {
2160
2161			MPopup.video('a.play.video');
2162
2163			MPopup.self_hosted_video('a.play.video.self-hosted');
2164
2165			MPopup.image('.portfolioContainer');
2166
2167		},
2168
2169		video: function (idName) {
2170
2171			jQuery(idName).magnificPopup({
2172
2173				mainClass: 'mfp-fade',
2174
2175				items: {
2176
2177					src: jQuery(idName).attr('href')
2178
2179				},
2180
2181				iframe: {
2182
2183					markup: '<div class="mfp-iframe-scaler">' +
2184
2185							'<iframe class="mfp-iframe" frameborder="0" allowfullscreen></iframe>' +
2186
2187							'<div class="mfp-close"></div>' +
2188
2189							'</div>', // HTML markup of popup, `mfp-close` will be replaced by the close button
2190
2191				},
2192
2193				type: 'iframe'
2194
2195			});
2196
2197		},
2198
2199		self_hosted_video: function (idName) {
2200
2201			jQuery(idName).magnificPopup({
2202
2203				mainClass: 'mfp-fade',
2204
2205				type: 'inline'
2206
2207			});
2208
2209		},
2210
2211		image: function (idName) {
2212
2213			jQuery(idName).magnificPopup({
2214
2215				mainClass: 'mfp-fade',
2216
2217				delegate: 'article:not(".ajaxed") a:visible',
2218
2219				gallery: {
2220
2221					enabled: true,
2222
2223					navigateByImgClick: true,
2224
2225					preload: [0, 1] // Will preload 0 - before current, and 1 after the current image
2226
2227				},
2228
2229				callbacks: {
2230
2231					buildControls: function () {
2232
2233						if (jQuery.magnificPopup.instance.items.length > 1)
2234
2235							this.contentContainer.append(this.arrowLeft.add(this.arrowRight));
2236
2237					},
2238
2239					open: function () {
2240
2241						jQuery('.mfp-description').append(this.currItem.el.data('title'));
2242
2243					},
2244
2245					change: function () {
2246
2247						var mfp = jQuery.magnificPopup.instance;
2248
2249						var container = jQuery(mfp.container);
2250
2251
2252
2253						if (mfp.index >= mfp.items.length - 1)
2254
2255							container.addClass('mfp-last');
2256
2257						else
2258
2259							container.removeClass('mfp-last');
2260
2261						if (mfp.index == 0)
2262
2263							container.addClass('mfp-first');
2264
2265						else
2266
2267							container.removeClass('mfp-first');
2268
2269					},
2270
2271					afterChange: function () {
2272
2273						jQuery('.mfp-description').empty().append(this.currItem.el.data('title'));
2274
2275					}
2276
2277				},
2278
2279				image: {
2280
2281					verticalFit: true,
2282
2283					markup: '<div class="mfp-figure   mfp-with-anim">' +
2284
2285							'<div class="mfp-img"></div>' +
2286
2287							'<div class="mfp-bottom-bar">' +
2288
2289							'<div class="mfp-description"></div>' +
2290
2291							'<div class="mfp-close"></div>' +
2292
2293							'</div>' +
2294
2295							'</div>'
2296
2297				},
2298
2299				type: 'image',
2300
2301				closeOnContentClick: false,
2302
2303				midClick: true,
2304
2305			});
2306
2307
2308
2309		}
2310
2311	}
2312
2313
2314
2315//Background responsive video
2316
2317	var BackgroundVideo = {
2318
2319		init: function () {
2320
2321			$window.on('load ready resize', function () {
2322
2323				setTimeout(function () {
2324
2325					BackgroundVideo.resize('.background-video');
2326
2327				}, 150);
2328
2329			});
2330
2331		},
2332
2333		resize: function (idName) {
2334
2335			jQuery(idName).each(function () {
2336
2337				var $video = jQuery(this),
2338
2339						contW = $video.parent().width(),
2340
2341						contH = $video.parent().outerHeight(),
2342
2343						videoW = $video.width(),
2344
2345						videoH = $video.height(),
2346
2347						videoRatio = videoW / videoH,
2348
2349						contRatio = contW / contH,
2350
2351						videoTop, videoLeft;
2352
2353
2354
2355				if (touch) {
2356
2357					videoRatio = 1.778504672897196;
2358
2359					var src = $video.attr('poster');
2360
2361					if (src) {
2362
2363						$video.after("<img src='" + src + "' class='" + idName.replace(/\./gi, "") + "' />").remove();
2364
2365					}
2366
2367				}
2368
2369
2370
2371				if ((contRatio > videoRatio)) {
2372
2373					videoW = parseInt(contW);
2374
2375					videoH = parseInt(videoW / videoRatio);
2376
2377					videoTop = parseInt((contH - videoH) / 2);
2378
2379					videoLeft = 0;
2380
2381				} else {
2382
2383					videoH = contH;
2384
2385					videoW = parseInt(videoH * videoRatio);
2386
2387					videoTop = 0;
2388
2389					videoLeft = parseInt((contW - videoW) / 2);
2390
2391				}
2392
2393
2394
2395				$video.css({
2396
2397					'top': videoTop + 'px',
2398
2399					'left': videoLeft + 'px',
2400
2401					'width': videoW + 'px',
2402
2403					'height': videoH + 'px'
2404
2405				});
2406
2407			});
2408
2409		}
2410
2411	}
2412
2413
2414
2415
2416
2417//AJAX portfolio item load
2418
2419	var AJAXportfolio = {
2420
2421		init: function () {
2422
2423			AJAXportfolio.build('article.portfolios_listing.ajaxed:visible');
2424
2425		},
2426
2427		build: function (idName) {
2428
2429			ajaxportfolios[idName] = [];
2430
2431			jQuery(idName).each(function (i) {
2432
2433				ajaxportfolios[idName][i] = (jQuery(this).find('a'));
2434
2435			});
2436
2437
2438
2439			jQuery.each(ajaxportfolios[idName], function (key, valueObj) {
2440
2441				jQuery(valueObj).unbind('click');
2442
2443				jQuery(valueObj).on('click', function (e) {
2444
2445					e.preventDefault();
2446
2447					AJAXportfolio.init();
2448
2449					AJAXportfolio.prepare(valueObj, ajaxportfolios[idName], key);
2450
2451				});
2452
2453			});
2454
2455		},
2456
2457		prepare: function (valueObj, idName, key) {
2458
2459
2460
2461			jQuery("#ajaxed_content #ajax-content").slideUp(500);
2462
2463			SmoothScrollTo.scroll(jQuery('#ajaxed_content'));
2464
2465			setTimeout(function () {
2466
2467				jQuery('#ajaxed_content').html('');
2468
2469				AJAXportfolio.load(valueObj, idName, key);
2470
2471			}, 500);
2472
2473
2474
2475		},
2476
2477		load: function (idName, portfolioObj, key) {
2478
2479			var portfoliosLength = portfolioObj.length,
2480
2481					prev, next;
2482
2483			jQuery.ajax({
2484
2485				url: jQuery(idName).attr('href'),
2486
2487				dataType: "html",
2488
2489				beforeSend: function () {
2490
2491					jQuery('#ajaxed_content').velocity({height: '140px'}, {duration: 600}).velocity("stop").css({'padding-bottom': '140px', 'height': ''});
2492
2493					Loader.inlineLoader.init('#ajaxed_content');
2494
2495					jQuery('#ajaxed_content .inline-loader').velocity({opacity: 1}, {duration: 600, display: 'block'});
2496
2497				},
2498
2499				success: function (response) {
2500
2501
2502
2503					setTimeout(function () {
2504
2505						Loader.inlineLoader.hide('#ajaxed_content');
2506
2507
2508
2509						var content = jQuery(response);
2510
2511						jQuery("#ajaxed_content").html(content.find('section'));
2512
2513
2514
2515						jQuery("#ajaxed_content #ajax-content").slideDown(500);
2516
2517						jQuery("#ajaxed_content").delay(500).css({'padding-bottom': 0});
2518
2519
2520
2521						//
2522
2523						jQuery('#ajaxed_content #ajax-content [data-animation]').css({
2524
2525							'opacity': 0
2526
2527						});
2528
2529
2530
2531						jQuery("#ajaxed_content #ajax-content [data-animation]").each(function () {
2532
2533
2534
2535							var ele = jQuery(this);
2536
2537							var fx = ele.attr('data-animation');
2538
2539							var delay = ele.attr('data-delay');
2540
2541
2542
2543
2544
2545							if (typeof delay === "undefined") {
2546
2547								delay = 0;
2548
2549							} else {
2550
2551								delay = parseFloat(delay.replace(",", "."));
2552
2553							}
2554
2555
2556
2557							setTimeout(function () {
2558
2559								ele.addClass('animated ' + fx).one('webkitAnimationEnd mozAnimationEnd MSAnimationEnd oanimationend animationend notAnimated', function () {
2560
2561									ele.css({
2562
2563										'opacity': 1
2564
2565									}).removeClass('animated ' + fx);
2566
2567
2568
2569								}).trigger('skipAnimation');
2570
2571
2572
2573							}, delay * 1000);
2574
2575						});
2576
2577						//
2578
2579
2580
2581
2582
2583						prev = portfolioObj[key - 1];
2584
2585						next = portfolioObj[key + 1];
2586
2587
2588
2589						if (key == 0 && key == portfoliosLength - 1) {
2590
2591							prev = false;
2592
2593							next = false;
2594
2595						} else if (key == portfoliosLength - 1) {
2596
2597							next = false;
2598
2599						} else if (key == 0) {
2600
2601							prev = false;
2602
2603						}
2604
2605
2606
2607
2608
2609						if (prev) {
2610
2611							AJAXportfolio.prev(prev, portfolioObj, key - 1);
2612
2613						} else {
2614
2615							jQuery('#ajaxed_content .prev.page-number').css('visibility', 'hidden');
2616
2617						}
2618
2619
2620
2621						if (next) {
2622
2623							AJAXportfolio.next(next, portfolioObj, key + 1);
2624
2625						} else {
2626
2627							jQuery('#ajaxed_content .next.page-number').css('visibility', 'hidden');
2628
2629						}
2630
2631						AJAXportfolio.close();
2632
2633						setTimeout(function () {
2634
2635							$window.trigger('resize');
2636
2637						}, 1000);
2638
2639
2640
2641					}, 2500);
2642
2643				}
2644
2645
2646
2647
2648
2649			});
2650
2651		},
2652
2653		next: function (idName, portfolioObj, key) {
2654
2655			jQuery('#ajaxed_content .next.page-number').on('click', function (e) {
2656
2657				e.preventDefault();
2658
2659
2660
2661
2662
2663
2664
2665				AJAXportfolio.prepare(idName, portfolioObj, key);
2666
2667
2668
2669
2670
2671			});
2672
2673		},
2674
2675		prev: function (idName, portfolioObj, key) {
2676
2677			jQuery('#ajaxed_content .prev.page-number').on('click', function (e) {
2678
2679				e.preventDefault();
2680
2681
2682
2683				AJAXportfolio.prepare(idName, portfolioObj, key);
2684
2685
2686
2687			});
2688
2689		},
2690
2691		close: function () {
2692
2693			jQuery('#ajaxed_content .close-ajax').on('click', function (e) {
2694
2695				e.preventDefault();
2696
2697				jQuery("#ajaxed_content #ajax-content").slideUp(500);
2698
2699				SmoothScrollTo.scroll(jQuery('#ajaxed_content'));
2700
2701				setTimeout(function () {
2702
2703					jQuery("#ajaxed_content").html('');
2704
2705					$window.trigger('resize');
2706
2707				}, 500);
2708
2709
2710
2711			});
2712
2713		}
2714
2715	}
2716
2717
2718
2719
2720
2721// Init all functions
2722
2723	var InitJS = function (callback) {
2724
2725
2726
2727
2728
2729		// check if imagesloaded.pkgd.min.js loaded
2730
2731		if (typeof (jQuery.fn.imagesLoaded) !== 'undefined') {
2732
2733				jQuery('body').imagesLoaded().progress(function (instance, image ) {
2734
2735					UpdateLoaderCounter(image.img.src);
2736
2737			});
2738
2739		} else {
2740
2741			Loader.updateProgress('100');
2742
2743		}
2744
2745
2746
2747
2748
2749		Core.init();
2750
2751
2752
2753
2754
2755
2756
2757		General.init();
2758
2759		// check if waypoints.min.js loaded
2760
2761		if (typeof (jQuery.fn.waypoint) !== 'undefined') {
2762
2763			Waypoints.init();
2764
2765		}
2766
2767		// check if superfish.min.js loaded
2768
2769		if (typeof (jQuery.fn.superfish) !== 'undefined') {
2770
2771			MainMenu.init();
2772
2773		}
2774
2775
2776
2777		StickyHeader.init();
2778
2779
2780
2781		FullScreenSection.init();
2782
2783
2784
2785
2786
2787		// check if isotope.min.js loaded
2788
2789		if (typeof (jQuery.fn.isotope) !== 'undefined') {
2790
2791			IsotopeGallery.init();
2792
2793		}
2794
2795
2796
2797		// check if jquery.flexslider-min.js loaded
2798
2799		if (typeof (jQuery.fn.flexslider) !== 'undefined') {
2800
2801			Flexsliders.init();
2802
2803		}
2804
2805
2806
2807		// check if tweets.min.js loaded
2808
2809		if (typeof (getTweets) == 'function') {
2810
2811			TwitterFeed.init();
2812
2813		}
2814
2815
2816
2817		// check if jquery.validate.min.js loaded
2818
2819		if (typeof (jQuery.fn.validate) !== 'undefined') {
2820
2821			FormValidation.init();
2822
2823		}
2824
2825
2826
2827		// check if jquery.themepunch.revolution.min.js and jquery.themepunch.tools.min.js loaded
2828
2829		if (typeof (jQuery.fn.revolution) !== 'undefined' && typeof (punchgs) == 'object') {
2830
2831			RevolutionSliders.init();
2832
2833		}
2834
2835
2836
2837		// check if jquery.magnific-popup.min.js loaded
2838
2839		if (typeof (jQuery.fn.magnificPopup) !== 'undefined') {
2840
2841			MPopup.init();
2842
2843		}
2844
2845
2846
2847		BackgroundVideo.init();
2848
2849
2850
2851		AJAXportfolio.init();
2852
2853
2854
2855		$window.trigger('resize');
2856
2857	};
2858
2859
2860
2861
2862
2863
2864
2865// START
2866
2867	jQuery(function () {
2868
2869		Loader.init(function () {
2870
2871
2872
2873		if (started !== 1)
2874
2875			LoadJS();
2876
2877			started = 1;
2878
2879		});
2880
2881	});
2882
2883
2884
2885})(jQuery);

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.