PageSourceSearch

https://www.bearingnet.net/js/bnPublic-2.js?220915

js bearingnet.net collected 2026-10-04 21:55:05 UTC 56,848 bytes, 1,934 lines download raw bytes

1//"use strict";
2
3// main global object for settings and functions
4var APP;
5var cdnPath = "https://c.bearingnet.net";
6
7// forEach loop implementation for some browsers (IE8)
8if (!Array.prototype.forEach) {
9	Array.prototype.forEach = function(callback, thisArg) {
10		var T, k;
11		if (this === null) {
12			throw new TypeError(' this is null or not defined');
13		}
14		var O = Object(this);
15		var len = O.length >>> 0;
16		if (typeof callback !== "function") {
17			throw new TypeError(callback + ' is not a function');
18		}
19		if (arguments.length > 1) {
20			T = thisArg;
21		}
22		k = 0;
23		while (k < len) {
24			var kValue;
25			if (k in O) {
26				kValue = O[k];
27				callback.call(T, kValue, k, O);
28			}
29			k++;
30		}
31	};
32}
33
34
35
36(function () {
37 
38// main global object for settings and functions
39	APP = {
40		imgs: [],
41		countriesArr: [], // countries for the members map
42		q: function(selector) { // pure js jQuery similar selector
43			return document.querySelectorAll(selector);
44		},
45		check: function(selector) { // check if element exists on the page to run scripts on defined elements/pages only
46			var x = false;
47
48			try {
49				selector.forEach(function(element, index, array) {
50					if (document.querySelector(element) !== null) {
51						x = true;
52						return;
53					}
54				}, this);
55			} catch(e) {
56				console.warn(e.message);
57				x = true;
58			}
59
60			if(x) {
61				return x;
62			}
63		},
64		smallScreen: function(argument) {
65			if (window.innerWidth <= 1040) {
66				return true;
67			} else {
68				return false;
69			}
70		},
71		loadCountries: function() { // load countries to the select box
72			APP.countriesArr.sort(function(a, b){
73				if(a.name < b.name) return -1;
74				if(a.name > b.name) return 1;
75				return 0;
76			});
77
78			for (i=0; i<APP.countriesArr.length; i++) {
79				if(APP.countriesArr[i].id !== 12) {
80					var sel = (APP.countriesArr[i].id == 77) ? "selected" : "";
81					$("#country").append("<option value='"+APP.countriesArr[i].id+"' "+sel+">"+APP.countriesArr[i].name+"</option>");
82				}
83			}
84
85			$("#country").trigger("systemChange");
86		},
87		countryClicked:	function(countryId) { // change selected country on click on the map
88			$("#country option[value='"+countryId+"']").prop("selected", "selected");
89			$("#country").trigger("change");
90		}
91			
92	};
93
94    APP.plugins = {
95        qtip: {
96            css: cdnPath + "/js/qtip/jquery.qtip.min.css",
97            js: cdnPath + "/js/qtip/jquery.qtip.min.js"
98        },
99        lightcase: {
100            css: cdnPath + "/js/lightcase/src/css/lightcase.css",
101            js: cdnPath + "/js/lightcase/lightcase.js"
102        },
103        datatables: {
104            css: "/bundles/DataTablesCSS",
105            js: "/bundles/DataTablesJS"
106        },
107		jquery: {
108			js: cdnPath + "/js/jquery-3.5.1.min.js"
109		},
110		jqueryui: {
111			js: cdnPath + "/js/jquery-ui-1.11.2-full.min.js"
112		},
113		bxslider: {
114			js: cdnPath + "/js/jquery.bxslider/jquery.bxslider.min.js"
115		},
116		edge6: {
117			js: cdnPath + "/js/edge.6.0.0.min.js"
118		},
119		cycle: {
120			js: cdnPath + "/js/jquery.cycle.js"
121		},
122		jcountdown: {
123			js: cdnPath + "/js/jquery.jcountdown.js"
124		},
125		tn3: {
126			js: cdnPath + "/js/jquery.tn3.min.js"
127		},
128		slick: {
129			js: cdnPath + "/js/slick/slick.min.js"
130		},
131		pagetransitions: {
132			js: cdnPath + "/js/pagetransitions/pagetransitions.js"
133		},
134		placeholder: {
135			js: cdnPath + "/js/jquery.placeholder.js"
136		},
137		d3: {
138			js: cdnPath + "/js/d3.v3.min.js"
139		},
140		d3geo: {
141			js: cdnPath + "/js/d3.geo.projection.v0.min.js"
142		},
143		d3topo: {
144			js: cdnPath + "/js/topojson.v1.min.js"
145		}
146    };
147
148    APP.loadCSS = function (url) {
149        // Adding the script tag to the head
150        var head = document.head;
151        var link = document.createElement("link");
152        link.type = "text/css";
153        link.href = url;
154
155        link.rel = "stylesheet";
156        link.media = "screen, print";
157
158        // Fire the loading
159        head.appendChild(link);
160    };
161
162    APP.loadScript = function (url, callback) {
163        // Adding the script tag to the body
164        var body = document.body;
165        var script = document.createElement('script');
166        script.type = 'text/javascript';
167		script.src = url;
168		script.async = false;
169
170        // Then bind the event to the callback function.
171        // There are several events for cross browser compatibility.
172        script.onreadystatechange = callback;
173        script.onload = callback;
174
175        // Fire the loading
176        body.appendChild(script);
177    };
178
179	// loads required plugin with a name = "plugin-name" and function in a callback
180    APP.loadPlugin = function (name, callback = null) {
181        if (APP.plugins[name] !== undefined) {
182            if (APP.plugins[name].css && document.querySelectorAll("[href*='" + APP.plugins[name].css + "']").length <= 0) {
183                APP.loadCSS(APP.plugins[name].css);
184            }
185
186            if (APP.plugins[name].js && document.querySelectorAll("[src*='" + APP.plugins[name].js +"']").length <= 0) {
187                APP.loadScript(APP.plugins[name].js, callback);
188            }
189            else {
190            	if(callback !== null) {
191	                callback();
192	            }
193            }
194        } else {
195            console.warn("No plugin with name " + name);
196            try {
197            	if(callback !== null) {
198	                callback();
199	            }
200            } catch (e) {
201                console.warn("Can not execute plugin callback");
202            }
203        }
204    };
205
206	// accepts name as array of plugins (like requirejs) or single str
206ing name
207    APP.loadRequired = function (name, callback) { 
208    	if(Array.isArray(name)) {
209	    	for(var i = 0; i < name.length; i++) {
210	    		try {
211	            	if(i === name.length-1 && callback !== null) {
212	    				APP.loadPlugin(name[i], callback);
213		            } else {
214	    				APP.loadPlugin(name[i]);
215		            }
216	    		} catch(e) {
217	    			console.warn(e);
218	    		}
219	    	}
220	    } else {
221			if (typeof name === "string" && name !== "") {
222				APP.loadPlugin(name, callback);
223			} else {
224				try {
225					callback();
226				} catch (e) {
227					console.warn(e);
228				}
229			}
230	    }
231    };
232
233	// jQuery only
234	APP.loadRequired(['jquery'], function() {
235		try {
236			$.support.cors = true;
237		} catch(e) {
238			console.warn(e.message);
239		}
240
241		if((typeof oldBrowser !== "undefined") && (oldBrowser === true)) { // show info about outdated browser
242			if(localStorage.getItem('updateBrowser') !== 'true') {
243				$('.old-browser').slideDown(500);
244			}
245			$('.close, .old-browser').on('click', function(){
246				if(typeof(Storage) !== "undefined") {
247					localStorage.setItem('updateBrowser', 'true');
248				}
249				$('.old-browser').slideUp(500, function(){
250					$('.old-browser').remove();
251				});
252			});
253		}
254		
255		// Listeners
256		$(document)
257			// Scroll to the element on the same page (by ID or NAME)
258			// Class 'control' is to prevent scrolling - e.g for button 'show-more'
259			.on('click systemClick', 'a[href^="#"]:not(.control, .alert-close, .read-more, [href="#"])', function(e) {
260				e.preventDefault();
261				var target = $(this).attr('href');
262				if(target.split("#")[1] == "") {
263					return false;
264				}
265				if(!$(target).length) {
266					target = '[name="' + target.split("#")[1] + '"]';
267				}
268				$(target).addClass('target');
269				$('html, body').animate({scrollTop: $(target).offset().top - 50}, 'slow', 'swing', function() {
270					$(target).removeClass('target');
271				});
272			})
273			// Close alert
274			.on('click', '.alert-close', function(e){
275				e.preventDefault();
276				$(this).parent('.alert-tooltip').slideUp();
277			})
278			.on("submit", ".block-on-submit", function () {
279				var isValid = true;
280
281				try {
282					isValid = $(this).valid();
283				} catch (e) {
284					console.warn("No form validation.");
285				}
286
287				if (isValid) {
288					$(this).addClass("ajax-loading");
289				}
290			});
291
292
293		//hover states on the static widgets
294		$('#dialog_link, ul#icons li').hover(
295			function () {
296				$(this).addClass('ui-state-hover');
297			},
298			function () {
299				$(this).removeClass('ui-state-hover');
300			}
301		);
302
303	    // show cards on hover
304		$('.manex-section').hover(function(){
305			$(this).find('.show-on-hover').stop(true, true).slideDown();
306		}, function () {
307			$(this).find('.show-on-hover').stop(true, true).slideUp();
308		});
309
310	    // show "read more" content
311		$('.link-read-more').on("click", function(e){
312			var $content = $(this).parents('.manex-public-content').find('.show-on-hover');
313				e.preventDefault();
314
315			if($content.is(":hidden")) {
316				$content.slideToggle();
317			}
318		});
319
320		$(document).on("click", ".add-spinner", function () {
321			var el = $(this);
322			var spinnerEl = el.data("spinner-element");
323
324			if (spinnerEl === undefined) {
325				if (el.hasClass("btn")) {
326					el.addClass("btn-loading");
327				} else {
328					el.addClass("ajax-loading");
329				}
330			} else {
331				$("#" + spinnerEl).addClass("ajax-loading");
332			}
333		});
334
335		// Members list page
336		if (APP.check(["#manexMain"])) {
337
338			// manufacturers logotypes scrolling
339			var zoomBoxes = document.querySelectorAll('.detail-view');
340
341			// Extract the URL
342			zoomBoxes.forEach(function(image) {
343				var imageCss = window.getComputedStyle(image, false),
344				imageUrl = imageCss.backgroundImage
345									.slice(4, -1).replace(/['"]/g, '');
346
347				// Get the original source image
348				var imageSrc = new Image();
349				imageSrc.onload = function() {
350				var imageWidth = imageSrc.naturalWidth,
351					imageHeight = imageSrc.naturalHeight,
352					ratio = imageHeight / imageWidth;
353				// Adjust the box to fit the image and to adapt responsively
354				// var percentage = ratio * 100 + '%';
355				// image.style.paddingBottom = percentage;
356
357				// Zoom and scan on mousemove
358				image.onmousemove = function(e) {
359					// Get the width of the thumbnail
360				var boxWidth = image.clientWidth,
361					boxHeight = image.clientHeight,
362					// Get the cursor position, minus element offset
363					x = e.offsetX,
364					y = e.offsetY,
365					// Convert coordinates to % of elem. width & height
366					xPercent = (x / (boxWidth / 100)).toFixed(2) + '%',
367					yPercent = (y / (boxHeight / 100)).toFixed(2) + '%';
368
369					// Update styles w/actual size
370					Object.assign(image.style, {
371					backgroundPosition: xPercent + ' ' + yPercent,
372					backgroundSize: imageWidth + 'px'
373					});
374				};
375
376				// Reset when mouse leaves
377				image.onmouseleave = function(e) {
378					Object.assign(image.style, {
379					backgroundPosition: 'center',
380					backgroundSize: '100%'
381					});
382				};
383				}
384				imageSrc.src = imageUrl;
385	        });
386
387		}
388
389	    // members map
390		if (APP.check(["#map-members-list"])) {
391				// http://c.bearingnet.net/js/test_data/members-list.json
392				// $.getJSON('/WS/getML', function(data) {
393				// 	APP.companiesJsonData = data;
394				// 	$("#country").trigger("systemChange");
395				// });
396				
397				function getCompaniesByCountryId(countryId) {
398					try {
399						var result = $.grep(APP.companiesJsonData, function(e){ return e.id == countryId; });
400						return result[0];
401					} catch(e) {
402						console.log("ML not loaded.");
403					}
404				}
405				
406				function getCompaniesByName(companyName) {
407					var result = [];
408					for(i=0; i<APP.companiesJsonData.length; i++) {
409						for(j=0; j<APP.companiesJsonData[i].list.length; j++) {
410							if(APP.companiesJsonData[i].list[j].name === companyName) {
411								result.push(APP.companiesJsonData[i].list[j].name);
412							}
413						}
414					}
415					return result;
416				}
417
418	            // on country change - select or map click
419				$(document).on("change systemChange", "#country", function (e) {
420					// $("#company-name-filter").val("");
421					try {
422						var currentCountry = getCompaniesByCountryId($(this).val());
423						
424						$("#members-list-header").text(currentCountry.name);
425						$("#members-list-flag").prop("src", currentCountry.flag);
426						$("#members-list").html("");
427
428						var coList = currentCountry.list.map(function (elem) {
429							var mLength = "";
430							if (elem.age >= 25) {
431								mLength = "<i class='fas fa-certificate age' data-age='25' title='Membership length'></i>";
432							} else
433								if (elem.age >= 20) {
434									mLength = "<i class='fas fa-certificate age' data-age='20' title='Membership length'></i>";
435								} else
436									if (elem.age >= 15) {
437										mLength = "<i class='fas fa-certificate age' data-age='15' title='Membership length'></i>";
438									} else
439										if (elem.age >= 10) {
440											mLength = "<i class='fas fa-certificate age' data-age='10' title='Membership length'></i>";
441										}
442
443							return "<li><span class='name'>" + elem.name + "</span>&nbsp;" + mLength + "</li>";
444						}).join("");
445						console.log(coList);
446
447						$("#members-list").html(coList);
448
449						if(e.type !== "systemChange") {
450							$('html, body').animate({
451								scrollTop: $("#box-list").offset().top - 50
452							}, 1000);
453						}
454					} catch(e) {
455						console.log("ML not loaded.");
456					}
457					
458	            });
459
460	            // live filtering companies list
461				// $(document).on("keyup", "#company-name-filter", function (e) {
462				// 	if($(this).val().length >=3) {
463				// 		console.log($(this).val());
464				// 		var filteredCompanies = getCompaniesByName($(this).val());
465				// 		console.log(filteredCompanies);
466				// 		$("#members-list").html("<li>"+filteredCompanies.join("</li><li>")+"</li>");
467				// 	}
468				// });
469
470
471
472				
473				if (APP.check([".ie7", ".ie8"])) {
474					$.getJSON("/Ws/getML", function( data ) {
475						window.parent.APP.companiesJsonData = data;
476
477						var max = 0;
478						for(i=0; i < data.length; i++) {
479							if (data[i].companies > max) {
480								max = data[i].companies;
481							}
482							window.parent.APP.countriesArr[i] = {"id" : data[i].id, "name" : data[i].name};
483
484							if (i == data.length - 1) {
485								window.parent.APP.loadCountries();
486							}
487						}
488
489					}).error(function(jqXHR, textStatus, errorThrown) { alert($.support.cors); alert(errorThrown); });
490				}
491		}
492
493	    // scroll overflowing/hidden text on mouse hover
494		if (APP.check([".req-marquee", ".marquee"])) { 
495			$('.marquee').on("mouseenter", function () {
496				var overflow = $(this).parent().width() - $(this).width();
497				if (overflow < 0) {
498					var txt = $(this).text();
499					var speed = (Math.abs(overflow) + 50) * 10;
500					$(this).stop().css("position", "absolute").animate({ left: overflow + 'px' }, speed);
501					//$(this).html('<marquee>' + txt + '</marquee>');
502				}
503			}).on("mouseleave", function () {
504				var txt = $(this).text();
505				var overflow = $(this).parent().width() - $(this).width();
506				var speed = (Math.abs(overflow) + 50) * 10;
507				$(this).stop().animate({ left: '0px' }, speed, function () {
508					$(this).css("position", "relative");
509				});
510			});
511		}
512
513
514		// Trial form
515	    /*
516	    if (APP.check([".ftform", "#ftform"])) {
517			var jQuery = $;
518
519			validateStage1 = function(argument) {
520				var isValid = true;
521	            $("[data-val-required]").each(function(i, el) {
522					if($(el).val() == "") {
523						$(el).addClass("invalid-empty");
524	                    isValid = false;
525	                    console.log("invalid");
526					} else {
527						$(el).removeClass("invalid-empty");
528					}
529	            });
530
531	            if (isValid && $("#contact-form").length) {
532	                document.querySelector('#go-to-contact').click();
533	                document.getElementById("contact-form").classList.add("form-sent");
534	                var cn1 = document.getElementById("fullName");
535	                cn1.setAttribute("disabled", true); 
536	            }
537	            
538	            return isValid;
539	        }
540	        $(".first-stage-continue").on("click", function(e) {
541				validateStage1();
542			});
543		}
544	    */
545
546	    // Lightbox
547		if (APP.check([".req-lightbox", ".lightbox_trigger"])) {
548			
549			$('.lightbox_trigger').each(function (argument) {
550				APP.imgs.push(this.href);
551			});
552
553			$('.lightbox_trigger').on("click", function (e) {
554				e.preventDefault();
555				var image_href = $(this).attr("href");
556				if ($('#lightbox').length > 0) {
557					//lightbox exists insert img tag with clicked link href as src value
558					$('#lightbox_img').attr('src', image_href);
559					// show lightbox window and transition
560					$('#lightbox').fadeIn(300);
561				}
562
563				else {
564					//lightbox does not exist
565					//create html markup for lightbox window
566					var lightbox =
567						'<div id="lightbox">' +
568						'<p>Click to close</p>' +
569						'<div id="lightbox_content">' + //insert clicked image href
570						'<img id="lightbox_img" src="' + image_href + '" />' +
571						'</div>' +
572						'</div>';
573					//insert lightbox html into page
574					$('body').append(lightbox);
575				}
576			});
577			//click anywhere to close window
578			$('body').on('click', '#lightbox', function () {
579				$('#lightbox').fadeOut(300);
580				$('#lightbox_img').attr('src', "");
581			});
582
583	        // keyboard navigation
584	        $(document).on("keyup", function (e) {
585	            var current;
586				if (e.keyCode == 27) { // esc keycode
587					$('#lightbox').fadeOut(300);
588					$('#lightbox_img').attr('src', "");
589				}
590				if (e.keyCode == 39) { // next
591					current = $.inArray($('#lightbox_img').attr("src"), APP.imgs);
592					if(current == APP.imgs.length - 1) {
593						current = -1;
594					}
595					$('#lightbox_img').stop(true, false).fadeOut(300, function (argument) {
596						$(this).attr("src", APP.imgs[current+1]).on("load", function () {
597							$(this).fadeIn(300);
598						});
599					});
600				}
601				if (e.keyCode == 37) { // prev
602					current = $.inArray($('#lightbox_img').attr("src"), APP.imgs);
603					if(current == 0) {
604						current = APP.imgs.length;
605					}
606					$('#lightbox_img').stop(true, false).fadeOut(300, function (argument) {
607						$(this).attr("src", APP.imgs[current-1]).on("load", function () {
608							$(this).fadeIn(300);
609						});
610					});
611				}
612			});
613		}
614
615
616
617
618
619
620	// functions for mobile devices
621
622	    // show mobile menu
623		function show_menu() {
624			$(".modal").fadeOut(500);
625			$("#overlay").fadeIn(500);
626			$("#menu").show().find("ul").stop().animate({
627				top: "0px"
628			}, 500, function() {
629			});
630			$("#menu-btn").addClass("active");
631		}
632
633	    // hide mobile menu
634		function hide_menu(overlay) {
635			overlay = overlay || 1;
636			if (overlay == 1) {
637				$("#overlay").fadeOut(500);
638			}
639			var h = $("#menu > ul").height();
640			$("#menu ul").stop().animate({
641				top: - (h + 20) + "px"
642			}, 500, function() {
643				$("#menu").hide(); 
644			});
645			$("#menu-btn").removeClass("active");
646		}
647		
648		init();
649		function init() {
650			try {
651
652				// $("a").on("click", function(e){ e.preventDefault(); });
653
654				$("footer h2").on("click", function(e){
655					//$("footer h2 + div").slideUp(300);
656					$(this).siblings().slideToggle(300);
657				});
658
659	            // show/hide more text
660				$(".readmore-btn").on("click", function(e){
661					e.preventDefault();
662					$(this).siblings(".readmore-block").slideDown(300);
663					$(this).slideUp(300);
664				});
665
666	            // login form
667				$(".login-btn").on("click", function(e){
668					e.stopPropagation();
669					if (APP.smallScreen()) {
670						hide_menu(2);
671					}
672					if($("#overlay:not(:visible)").length) {
673						$("#overlay").fadeIn(300);
674					}
675					$("#register-form").fadeOut(300);
676					$("#login-form").fadeIn(300);
677				});
678
679	            // free trial form
680				$(".free-trial").on("click", function(e){
681					e.stopPropagation();
682					if (APP.smallScreen()) {
683						hide_menu(2);
684					}
685					$("#login-form").fadeOut(300);
686					if($("#overlay:not(:visible)").length) {
687						$("#overlay").fadeIn(300);
688					}
689					$("#register-form").fadeIn(300);
690				});
691
692	            // overlay for forms and other modal elements
693				$("#overlay").on("click", function(e){
694					e.stopPropagation();
695					$("#register-form").fadeOut(300);
696					$("#login-form").fadeOut(300);
697
698					if ($("#video-modal").hasClass("visible")) {
699						$("#video-modal").slideUp(300).removeClass("visible");
700						$('#video-modal iframe').each(function(){
701							this.contentWindow.postMessage('{"event":"command","func":"' + 'pauseVideo' + '","args":""}', '*');
702						});
703					}
704
705					$("#overlay").fadeOut(300);
706				});
707
708	            // map video in modal
709				$(".man-news-video, .basic-search-video").on("click", function(e){
710					e.stopPropagation();
711					$("#video-modal").addClass("visible")
712					$("#overlay").fadeIn(300);
713					$('#video-modal iframe').each(function(){
714						this.contentWindow.postMessage('{"event":"command","func":"' + 'playVideo' + '","args":""}', '*');
715						// var requestFullScreen = this.requestFullScreen || this.mozRequestFullScreen || this.webkitRequestFullScreen;
716						// if (requestFullScreen) {
717						// requestFullScreen.bind(this)();
718						// }
719					});
720
721					var videolink = $(this).data("video");
722					if ($("#video-modal iframe").attr("src") !== videolink) {
723						$("#video-modal iframe").attr("src", videolink);
724					}
725					$("#video-modal").stop().slideDown(300);
726				});
727
728				var winw = window.innerWidth;
729
730				if (winw <= 1040) {
731					// changing images in MAP section on the home page
732					$(".man-news-small:not(.no-hover)").on("click", function (e) {
733						e.stopPropagation();
734						if ($(this).hasClass("banad")) {
735							//console.log("banad");
736							$(".demo-img img").hide().attr("src", "");
737							$(".demo-img .banners").addClass("visible");
738							$(".demo-img").stop().css("background-image", "").addClass("src-set").show();
739						} else
740							if ($(this).hasClass("default-view")) {
741								//console.log("def-view");
742								$(".demo-img").hide().removeClass("src-set");
743								$(".demo-img .banners").removeClass("visible");
744							} else {
745								//console.log("else");
746								$(".demo-img .banners").removeClass("visible");
747								var src = $(this).data("demo");
748								var srcSmall = $(this).data("demo-small");
749								srcSmall = (typeof srcSmall !== "undefined") ? srcSmall : src;
750								$(".demo-img").stop().css("background-image", "url(" + srcSmall + ")").addClass("src-set").show();//.find("img").attr("src", src).end().show();
751								$(".demo-img").data("src-big", src);
752
753								if ($(this).hasClass("zoomable")) {
754									$(".demo-img").addClass("zoomable");
755									$(".demo-img img").attr("src", srcSmall);
756
757								} else {
758									$(".demo-img").removeClass("zoomable");
759									$(".demo-img img").attr("src", "");
760								}
761							}
762					});
763
764					$("body").on("click", function (e) {
765						if (!$(this).hasClass("man-news-small")) {
766							$(".demo-img").hide().removeClass("src-set");
767							$(".demo-img .banners").removeClass("visible");
768						}
769					});
770				} else {
771					$(".man-news-small:not(.no-hover)").hover(function (e) {
772						e.stopPropagation();
773						if ($(this).hasClass("banad")) {
774							//console.log("banad");
775							$(".demo-img img").hide().attr("src", "");
776							$(".demo-img .banners").addClass("visible");
777							$(".demo-img").stop().css("background-image", "").addClass("src-set").show();
778						} else
779							if ($(this).hasClass("default-view")) {
780								//console.log("def-view");
781								$(".demo-img").hide().removeClass("src-set");
782								$(".demo-img .banners").removeClass("visible");
783							} else {
784								//console.log("else");
785								$(".demo-img .banners").removeClass("visible");
786								var src = $(this).data("demo");
787								var srcSmall = $(this).data("demo-small");
788								srcSmall = (typeof srcSmall !== "undefined") ? srcSmall : src;
789								$(".demo-img").stop().css("background-image", "url(" + srcSmall + ")").addClass("src-set").show();//.find("img").attr("src", src).end().show();
790								$(".demo-img").data("src-big", src);
791
792								if ($(this).hasClass("zoomable")) {
793									$(".demo-img").addClass("zoomable");
794									$(".demo-img img").attr("src", srcSmall);
795
796								} else {
797									$(".demo-img").removeClass("zoomable");
798									$(".demo-img img").attr("src", "");
799								}
800							}
801					}, function (e) {
802						$(".demo-img").hide().removeClass("src-set");
803						$(".demo-img .banners").removeClass("visible");
804					});
805				}
806
807	            // show demo img in full screen
808	            /*
809				$(".demo-img").on("click", function(){
810					if($(this).hasClass("zoomable")) {
811						$(this).toggleClass("full-screen");
812						var src = $(this).data("src-big");
813						if (typeof src !== "undefined") {
814							$(this).css("background-image", "url(" + src + ")");
815						}
816					}
817				});
818	            */
819
820	            // close fullscreen demo img
821	            /*
822				$(document).mouseup(function (e) {
823					var container = $(".man-news-small:not(:last-of-type), .demo-img");
824
825					if (!container.is(e.target) // if the target of the click isn't the container...
826					&& container.has(e.target).length === 0) // ... nor a descendant of the container
827					{
828						$(".demo-img").fadeOut(300).removeClass("src-set");//.find("img").attr("src", "");
829					}
830				});
831	            */
832
833	            // show/hide menu
834				$("#menu-btn").on("click", function(e) {
835					if(!$(this).hasClass("active")) {
836						show_menu();
837					} else {
838						hide_menu();
839					}
840				});
841
842				if(APP.smallScreen()) {
843	                // hide menu on option click
844					$("#menu").on("click", function(e) {
845						hide_menu();
846					});
847
848	                // show search form
849					$(".show-searchbox").on("click", function(e){
850						e.stopPropagation();
851						hide_menu();
852						$(".modal, #overlay").fadeOut(300);
853						if($("body").scrollTop() >= 140) {
854							$("#rightblock").slideDown(300);
855							$('html, body').animate({scrollTop: 0}, 'slow', 'swing', function() {});
856							$(".search-input").focus();
857						} else {
858							$("#rightblock").slideToggle(300);
859							$(".search-input").focus();
860						}
861					});
862
863	                // show login form
864					$(".login-btn").on("click", function(e){
865						e.stopPropagation();
866						hide_menu(2);
867	                    $(".modal").fadeOut(300);
868	                    if ($("#overlay:not(:visible)").length) {
869							$("#overlay").fadeIn(300);
870						}
871						$("#login-form").fadeIn(300);
872					});
873
874	                // show free trial form
875					$(".free-trial").on("click", function(e){
876						e.stopPropagation();
877						hide_menu(2);
878						$(".modal").fadeOut(300);
879						if($("#overlay:not(:visible)").length) {
880							$("#overlay").fadeIn(300);
881						}
882						$("#register-form").fadeIn(300);
883	                });
884
885	                // hide modal
886					$("#overlay").on("click tap", function(e){
887						e.stopPropagation();
888
889						if ($("#video-modal").hasClass("visible")) {
890							$("#video-modal").slideUp(300).removeClass("visible");
891							$('#video-modal iframe').each(function(){
892								this.contentWindow.postMessage('{"event":"command","func":"' + 'pauseVideo' + '","args":""}', '*');
893							});
894						}
895
896						$(".modal").fadeOut(300);
897						hide_menu();
898
899						$("#overlay").fadeOut(300);
900					});
901
902				}
903
904	            // show offers modal on mouse hover
905				$(".show-offers").on("mouseenter", function(e){
906					e.stopPropagation();
907					var $offersBlock = $(this).children(".offers-block"),
908						dataLink = $offersBlock.data("link"),
909						loaded = $offersBlock.data("loaded"),
910						jsonOffers;
911					
912
913					if(!loaded) {
914						// $.getJSON(dataLink, function(data) {
915						// 	jsonOffers = data;
916						// });
917						
918						var tbl_body = document.createElement("tbody");
919
920						$.getJSON(dataLink , function(data) {
921							$.each(data, function() {
922								var tbl_row = tbl_body.insertRow();
923								$.each(this, function(k , v) {
924									var cell = tbl_row.insertCell();
925									cell.appendChild(document.createTextNode(v.toString()));
926								});
927							})
928							$offersBlock.find("table")[0].appendChild(tbl_body);
929							$offersBlock.data("loaded", true);
930						});
931					}
932					$offersBlock.stop().fadeIn(300);
933				}).on("mouseleave", function(e){
934					e.stopPropagation();
935					$(this).children(".offers-block").stop().fadeOut(300);
936				});
937
938	            // menu scrolling
939				$('#menu').bind('mousewheel DOMMouseScroll', function (e) {
940					var e0 = e.originalEvent,
941						delta = e0.wheelDelta || -e0.detail;
942
943					$("#menu ul").scrollTop($("#menu ul").scrollTop() + ( -delta ));
944					e.preventDefault();
945				});
946
947	            // scrolling offers table in modal
948				$('.offers-block').bind('mousewheel DOMMouseScroll', function (e) {
949					var e0 = e.originalEvent,
950						delta = e0.wheelDelta || -e0.detail;
951					if(!APP.smallScreen()) {
952						$(".offers").scrollTop($(".offers").scrollTop() + ( -delta ));
953						e.preventDefault();
954					}
955				});
956
957			} catch(e) {
958				console.error(e.message);
959			}
960
961		}
962
963	});
964
965	// Placeholder old browsers
966	if (APP.check([".old-ie"])) {
967		if (APP.check(["input", "textarea"])) {
968			APP.loadRequired(['placeholder'], function() {
969				$('input, textarea').placeholder();
970			});
971		}
972	};
973
974	// Manex page transitions
975	if (APP.check([".page-transitions"])) {
976		APP.loadRequired(['pagetransitions'], function() {
977			
978			var links = ["#","#summary","#promote","#news","#network","#pricing","#contact"];
979			
980			$(document).ready(function(e) {
981				$(".pt-trigger-next").trigger("systemClick");
982
983				try {
984					var linkIndex = links.indexOf(location.hash);
985
986					if(linkIndex > 0) {
987						$(".pt-page-current, .pt-page-" + (linkIndex+1)).toggleClass("pt-page-current");
988						$("#manexMain").data("current", linkIndex).trigger("pageChanged");
989					}
990
991				} catch(e) {
992					console.log(e.message);
993				}
994			});
995
996			try {
997				$(document).on("click tap", ".pt-trigger-next", function() {
998					var next = $("#manexMain").data("current");
999					location.hash = links[next] || links[0];
1000
1001					if($(".pt-page-4.pt-page-current").length) {
1002						if(typeof $("#ytplayer").attr("src") == "undefined") {
1003							$("#ytplayer").attr("src", $("#ytplayer").data("src"));
1004						}
1005					}
1006				});
1007				$(document).on("click tap", ".pt-trigger-prev", function() {
1008					var prev = $("#manexMain").data("current");
1009					location.hash = links[prev] || links.slice(-1)[0];
1010
1011					if($(".pt-page-6.pt-page-current").length) {
1012						if(typeof $("#ytplayer").attr("src") == "undefined") {
1013							$("#ytplayer").attr("src", $("#ytplayer").data("src"));
1014						}
1015					}
1016				});
1017			} catch(e) {
1018				console.log(e.message);
1019			}
1020
1021			// $(".pt-trigger").on("click", function(e) {
1022			// 	$(".pt-trigger").fadeOut(150);
1023			// });
1024			$("#manexMain").on("pageChanged", function(e) {
1025				if($(".pt-page-5.pt-page-current").length) {
1026					if(typeof $("#ytplayer").attr("src") == "undefined") {
1027						$("#ytplayer").attr("src", $("#ytplayer").data("src"));
1028					}
1029				}
1030
1031				var prev = $(".pt-page-current").data("prev"),
1032					next = $(".pt-page-current").data("next");
1033
1034				$(".pt-trigger-prev span").html(prev);
1035				$(".pt-trigger-next span").html(next);
1036				// $(".pt-trigger").fadeIn().css("display","inline-block");
1037			});
1038		});
1039	};
1040
1041	// D3 - Members list map
1042	if (APP.check([".map-members-list", ".map-search", ".d3v3"])) {
1043		if ((document.querySelector(".ie7") === null) && (document.querySelector(".ie8") === null)) {
1044			APP.loadRequired("", function () { // ['d3', 'd3topo', 'd3geo']
1045
1046				var width = 1230,
1047					height = 500,
1048					radius = 3.546,
1049					dx = radius * 2 * 7 * 2 * Math.sin(Math.PI / 3),
1050					dy = radius * 2 * 11 * 1.5,
1051					centered,
1052					active = null,
1053					zoomScale = 1,
1054					fontSize = ".25em",
1055					pointLocation,
1056					pointsOn = false,
1057					maxlat = 83;
1058
1059				var color;
1060
1061				var zoom = d3.behavior.zoom()
1062					.size([width, height]);
1063
1064				var projection = d3.geo.equirectangular()
1065						.rotate([-11, 0])
1066						.scale((width + 1) / 2 / Math.PI)
1067						.translate([width / 2, (height / 2)+40])
1068						.precision(.1);
1069
1070				// Different 
1071				// var projection = d3.geo.mercator()
1072				// 		 .scale((width + 1) / 2 / Math.PI)
1073				// 		 .translate([width / 2, (height / 2) + 40])
1074				// 		 .precision(.1);
1075
1076
1077				var path = d3.geo.path().projection(projection);
1078
1079				// var transform = d3.geo.transform({point: projectPoint});
1080
1081				// var d3path = d3.geo.path().projection(transform);
1082
1083
1084
1085				var graticule = d3.geo.graticule();
1086
1087				if(document.getElementsByTagName('form').length) {
1088					var svg = d3.select("form").append("svg")
1089						.attr("width", width)
1090						.attr("height", height);
1091				} else {
1092					var svg = d3.select("body").append("svg")
1093						.attr("width", width)
1094						.attr("height", height);				
1095				}
1096
1097				var g = svg.append("g");
1098
1099				var mapGroup = g.append('g');
1100				var arcGroup = g.append('g');
1101				var sonarGroup = g.append('g');
1102				var imageGroup = g.append('g');
1103
1104				// GRID
1105				// svg.append("path")
1106				//		 .datum(graticule)
1107				//		 .attr("class", "graticule")
1108				//		 .attr("d", path);
1109
1110				// var div = d3.select("body").append("div").attr("class", "map-tooltip");
1111				var mapTooltip = d3.select('body').append('div').attr('class', 'map-tooltip');
1112
1113
1114
1115				d3.json("//c.bearingnet.net/js/test_data/world-topo-min.json", function(error, world) {
1116					if (error) throw error;
1117
1118
1119					var countries = topojson.feature(world, world.objects.countries).features,
1120						neighbors = topojson.neighbors(world.objects.countries.geometries);
1121
1122					mapGroup.selectAll("path")
1123						.data(countries)
1124						.enter().insert("path", ".graticule")
1125						.attr("class", function(d, i) { return "country" + " country" + i; })
1126						.attr("data-name", function(d, i) { return d.properties.name; })
1127						.attr("d", path)
1128						.style("fill", "#535353");	// #535353
1129
1130				// Hover & Tooltip
1131					mapGroup.selectAll("path")
1132						.on("mouseenter", showTooltip)
1133						.on("mousemove", moveTooltip)
1134						.on("mouseleave", hideTooltip)
1135						.on("click", showCountry);
1136
1137					mapGroup.insert("path", ".graticule")
1138						.datum(topojson.mesh(world, world.objects.countries, function(a, b) { return a !== b; }))
1139						.attr("class", "boundary")
1140						.attr("stroke-width", .2)
1141						.attr("d", path);
1142
1143					// Start drawing data
1144					drawing();
1145				});
1146
1147
1148				var amount;
1149
1150				function drawing() {
1151					// colour countries
1152					// http://c.bearingnet.net/js/test_data/members-list.json
1153					d3.json("/Ws/getML", function(error, data) {
1154						if (error) throw error;
1155
1156						window.parent.APP.companiesJsonData = data;
1157
1158						var el, max = 0, errorShown = false;
1159
1160						for(i=0; i < data.length; i++) {
1161							if (data[i].companies > max) {
1162								max = data[i].companies;
1163							}
1164							window.parent.APP.countriesArr[i] = {"id" : data[i].id, "name" : data[i].name};
1165
1166							if (i == data.length - 1) {
1167								window.parent.APP.loadCountries();
1168							}
1169						}
1170
1171						// color = d3.scale.linear().domain([0, max]).range(['#00bcdf', '#007186']);
1172
1173						for(i=0; i < data.length; i++) {
1174							if(data[i].id !== null) {
1175								el = document.querySelector(".country" + data[i].id);
1176								el.dataset = {};
1177								el.dataset.id = data[i].id;
1178								el.dataset.companies = data[i].companies;
1179								el.dataset.parts = data[i].parts;
1180								if(data[i].companies < 35) {
1181									el.style.fill = "#00abd9";
1182									try {	
1183										el.classList.add('fewer35members');
1184									} catch(e) {
1185										if(!errorShown) {
1186											console.warn("ClassList of SVG not supported.");
1187											errorShown = true;
1188										}
1189									}
1190								} else {
1191									el.style.fill = "#007186";
1192									try {	
1193										el.classList.add('more35members');
1194									} catch(e) {
1195										if(!errorShown) {
1196											console.warn("ClassList of SVG not supported.");
1197											errorShown = true;
1198										}
1199									}
1200								}
1201								// el.style.fill = color(data[i].companies);
1202							}
1203						}
1204					});
1205				}
1206
1207				var textLine1 = "", textLine2, companiesCount = 0;
1208
1209				function showTooltip(){
1210					if ((typeof d3.select(this)[0][0].dataset !== "undefined") && (typeof d3.select(this)[0][0].dataset.companies !== "undefined")) {
1211						companiesCount = d3.select(this)[0][0].dataset.companies;
1212						textLine2 = "<br>(" + companiesCount + " companies)";
1213						mapTooltip.classed('tooltip-nomembers', false);
1214					} else {
1215						companiesCount = 0;
1216						textLine2 = "";
1217						mapTooltip.classed('tooltip-nomembers', true);
1218					}
1219
1220					textLine1 = d3.select(this).attr("data-name");
1221
1222					d3.select(this)
1223						.attr('fill-opacity','0.8');
1224
1225					mapTooltip.classed('tooltip-active', true).html(textLine1 + textLine2);
1226				}
1227
1228				function moveTooltip(){
1229					var mouse = d3.mouse(svg.node()).map(function(d) {
1230						return parseInt(d);
1231					});
1232
1233					var marLeft, posTop, 
1234						tooltipWidth = parseInt(mapTooltip.style("width")) + 30,
1235						tooltipHeight = parseInt(mapTooltip.style("height")) + 20;
1236
1237					if(mouse[0] > parseInt(svg.style("width")) - tooltipWidth - 35) {
1238						marLeft = parseInt(svg.style("width")) - parseInt(mouse[0]) - tooltipWidth - 35;
1239					} else {
1240						marLeft = 0;
1241					}
1242
1243					if(mouse[1] < tooltipHeight + 25) {
1244						posTop = 5;
1245					} else {
1246						posTop = mouse[1] - tooltipHeight - 20;
1247					}
1248					
1249					mapTooltip.attr('style', 'left:' + (mouse[0] + 20) + 'px; top:' + posTop + 'px; margin-left:' + marLeft + 'px');
1250				}
1251
1252				function hideTooltip(){
1253					d3.select(this)
1254						.attr('fill-opacity','1');
1255
1256					mapTooltip.classed('tooltip-active', false);
1257				}
1258
1259				function showDesc(country, data) {
1260
1261
1262					if(data !== undefined) {	
1263					
1264						document.querySelector("#country-desc").style.display = "block";
1265						document.querySelector("#country-desc .country").innerText = country;
1266					
1267						document.querySelector("#country-desc .companies span").innerText = data.companies;
1268						document.querySelector("#country-desc .brands span").innerText = data.brands;
1269						document.querySelector("#country-desc .parts span").innerText = data.parts;
1270					} else {
1271						document.querySelector("#country-desc").className = "empty";
1272					}
1273				}
1274
1275				function hideDesc() {
1276					document.querySelector("#country-desc").style.display = "none";
1277					document.querySelector("#country-desc").className = null;
1278					document.querySelector("#country-desc .country").innerText = null;
1279				}
1280
1281				function randomize(min, max) {
1282					Math.floor((Math.random() * min) + max);
1283				}
1284
1285				function translateCircle(datum, index) {
1286					return "translate(" +	projection([datum[0].lon, datum[0].lat]) + ")";
1287				}
1288
1289				function sonar(sp, text){
1290					sonarGroup.append("circle")
1291						.attr("class", "ring")
1292						.attr("transform", translateCircle(sp))
1293						.attr("r", 2)
1294						.attr("fill", "#00abd9")
1295						.attr("fill-opacity", 1);
1296				}
1297
1298				function showAmount(amount, sp){
1299					sonarGroup.append("text")
1300						.text("10")
1301						.attr("text-anchor", "middle")
1302						.attr("class", "search-text")
1303						.attr("transform", translateCircle(sp))
1304						.attr("font-size", "1em")
1305						.attr("fill", "#00abd9")
1306						.attr("fill-opacity", 1);
1307				}	
1308
1309				function showCountry(){
1310					if(typeof d3.select(this)[0][0].dataset !== "undefined") {	
1311						var countryId = d3.select(this)[0][0].dataset.id;
1312						window.parent.APP.countryClicked(countryId);
1313					}
1314				}
1315
1316				d3.select(self.frameElement).style("height", height + "px");
1317
1318			});
1319		}
1320	};
1321
1322
1323
1324	// D3 - graphs, charts
1325	if (APP.check([".req-d3", ".d3", ".show-chart", ".chart"])) {
1326		if ((document.querySelector(".ie7") === null) && (document.querySelector(".ie8") === null)) {
1327			APP.loadRequired(['d3'], function() {
1328				try {
1329					// $("a").on("click", function(e){ e.preventDefault(); });
1330					if(APP.smallScreen()) {
1331
1332						$(".show-chart").on("click tap", function(e){
1333							e.stopPropagation();
1334							var $that = $(this);
1335							$(".chart-block").stop().fadeOut(300, function(e) {
1336								$that.after( $(".chart-block") );
1337								$(".chart-block").stop().fadeIn(300);
1338							});
1339
1340							var dataLink = $(this).data("link"),
1341								title = $(this).data("title");
1342
1343							$(".chart-block .title").text(title);
1344							// updateData(dataLink, title);
1345
1346						});
1347					} else {
1348						$(".show-chart").on("mouseenter", function(e){
1349							e.stopPropagation();
1350							$(".chart-block").stop().fadeIn(300);
1351
1352							var dataLink = $(this).data("link"),
1353								title = $(this).data("title");
1354							
1355							$(".chart-block .title").text(title);
1356							// updateData(dataLink, title);
1357
1358						}).on("mouseleave", function(e){
1359							e.stopPropagation();
1360							$(".chart-block").stop().fadeOut(300);
1361						});
1362					}
1363
1364
1365					// window.addEventListener('DOMContentLoaded', init, false);
1366					
1367					var addEvent = function(object, type, callback) {
1368						if (object == null || typeof(object) == 'undefined') return;
1369						if (object.addEventListener) {
1370							object.addEventListener(type, callback, false);
1371						} else if (object.attachEvent) {
1372							object.attachEvent("on" + type, callback);
1373						} else {
1374							object["on"+type] = callback;
1375						}
1376					}
1377
1378					var winw = window.innerWidth,
1379						winh = window.innerHeight;
1380
1381					addEvent(window, "resize", function(event) {
1382						winw = window.innerWidth;
1383						winh = window.innerHeight;
1384					});
1385
1386					if (winw <= 1040) {
1387						// Set the dimensions of the canvas / graph on mobile
1388						if (winw > 720) winw = 720;
1389						var margin = {top: 50, right: 25, bottom: 50, left: 80},
1390							width = winw - margin.left - margin.right - 40,
1391							height = 260 - margin.top - margin.bottom;
1392					} else {
1393						// Set the dimensions of the canvas / graph
1394						var margin = {top: 50, right: 20, bottom: 50, left: 80},
1395							width = 600 - margin.left - margin.right,
1396							height = 400 - margin.top - margin.bottom;
1397					}
1398
1399					// Parse the date / time
1400					//var parseDate = d3.time.format("%d-%b-%y").parse;
1401					var parseDate = d3.time.format("%d-%m-%Y").parse;
1402
1403					// Set the ranges
1404					var x = d3.time.scale().range([0, width]);
1405					var y = d3.scale.linear().range([height, 0]);
1406
1407					// Define the axes
1408					var xAxis = d3.svg.axis().scale(x)
1409						.orient("bottom").tickFormat(d3.time.format("%a %d"));
1410
1411					var yAxis = d3.svg.axis().scale(y)
1412						.orient("left").ticks(5);
1413
1414					// Define the line
1415					var valueline = d3.svg.line()
1416						.x(function(d) { return x(d.date); })
1417						.y(function(d) { return y(d.close); });
1418						
1419					// Adds the svg canvas
1420					var svg = d3.select(".chart-block")
1421						.append("svg")
1422							.attr("width", width + margin.left + margin.right)
1423							.attr("height", height + margin.top + margin.bottom)
1424						.append("g")
1425							.attr("transform", 
1426								  "translate(" + margin.left + "," + margin.top + ")");
1427
1428					// Get the data
1429					d3.csv("/WS/getSC", function (error, data) {
1430						data.forEach(function (d) {
1431							d.date = parseDate(d.date);
1432							d.close = +d.close;
1433						});
1434
1435						// Scale the range of the data
1436						x.domain(d3.extent(data, function(d) { return d.date; }));
1437						y.domain([0, d3.max(data, function(d) { return d.close; })]);
1438
1439						// Add the valueline path.
1440						svg.append("path")
1441							.attr("class", "line")
1442							.attr("d", valueline(data));
1443
1444						// Add the X Axis
1445						svg.append("g")
1446							.attr("class", "x axis")
1447							.attr("transform", "translate(0," + height + ")")
1448							.call(xAxis)
1449							.selectAll("text")
1450								.style("text-anchor", "end")
1451								.attr("dx", "-.2em")
1452								.attr("dy", "-.2em")
1453								.attr("transform", "rotate(-65)");
1454
1455						// Add the Y Axis
1456						svg.append("g")
1457							.attr("class", "y axis")
1458							.call(yAxis);
1459
1460					});
1461
1462
1463					// ** Update data section (Called from the onclick)
1464					function updateData(dataLink, title) {
1465						try {
1466							// Get the data again
1467							d3.csv(dataLink, function(error, data) {
1468								data.forEach(function(d) {
1469									d.date = parseDate(d.date);
1470									d.close = +d.close;
1471								});
1472
1473								// Scale the range of the data again 
1474								x.domain(d3.extent(data, function(d) { return d.date; }));
1475								y.domain([0, d3.max(data, function(d) { return d.close; })]);
1476
1477							// Select the section we want to apply our changes to
1478							var svg = d3.select(".chart-block").transition();
1479
1480							// Make the changes
1481								svg.select(".line")   // change the line
1482									.duration(750)
1483									.attr("d", valueline(data));
1484								svg.select(".x.axis") // change the x axis
1485									.duration(750)
1486									.call(xAxis);
1487								svg.select(".y.axis") // change the y axis
1488									.duration(750)
1489									.call(yAxis);
1490
1491							});
1492
1493							$(".chart-block .title").text(title);
1494						} catch(e) {
1495							console.warn(e.message);
1496						}
1497
1498					}
1499				} catch(e) {
1500					console.error(e.message);
1501				}
1502			});
1503		}
1504	}
1505
1506	// BX Slider - image sliders
1507	if (APP.check([".req-bxslider", ".bxslider", "#topSlider", ".bx-slider", ".manex-public-topslider", ".mygallery", ".default-top-slider", ".page-index.page-home", ".manex-logos-ticker", ".testimonials-slider", ".top-slider", ".page-industrialparts"])) {
1508		APP.loadRequired(['bxslider'], function() {
1509			var jQuery = $;
1510			
1511			$('.bxslider').bxSlider({
1512				auto: true,
1513				autoControls: true,
1514				speed: 1000,
1515				pause: 8000,
1516				autoHover: true,
1517				startSlide: 0
1518			});
1519
1520			$('.tn3.album').bxSlider({
1521				auto: true,
1522				controls: true,
1523				autoControls: true,
1524				autoControlsCombine: true,
1525				speed: 400,
1526				pause: 5000,
1527				autoHover: true,
1528				startSlide: 0,
1529				preloadImages: 'visible'
1530			});
1531
1532			$('#topSlider').bxSlider({
1533				auto: true,
1534				autoControls: false,
1535				speed: 1000,
1536				pause: 7000,
1537				autoHover: true,
1538				startSlide: 0,
1539				mode: 'fade',
1540				pager: true,
1541				controls: false
1542			});
1543
1544			var elWidth = $(".home-page section.slider").innerWidth();
1545			var maxSlides = Math.floor((elWidth - 60) / 380);
1546			var slideWidth = maxSlides > 1 ? elWidth / maxSlides : 0;
1547			//console.log("maxSlides:");
1548			//console.log(maxSlides);
1549			try {
1550				setTimeout(function () {
1551					$('.default-top-slider').bxSlider({
1552						auto: true,
1553						autoControls: false,
1554						speed: 500,
1555						pause: 8000,
1556						autoHover: true,
1557						//startSlide: 0,
1558						////mode: "fade",
1559						//minSlides: 1,
1560						maxSlides: maxSlides,
1561						slideWidth: slideWidth,
1562						//slideMargin: 20,
1563						onSlideBefore: function ($slideElement) {
1564							var $lazy = $slideElement.find(".lazy")
1565							var $load = $lazy.attr("data-src");
1566							$lazy.attr("src", $load).removeClass("lazy");
1567							//console.log(JSON.stringify($lazy));
1568						}
1569					});
1570				}, 1000);
1571			} catch (e) {
1572				console.error(e);
1573			}
1574
1575	         $('.manex-logos-ticker').bxSlider({
1576				minSlides: 8,
1577				maxSlides: 8,
1578				slideMargin: 20,
1579				ticker: true,
1580				speed: 50000,
1581				autoHover: true
1582	         });
1583
1584			try {
1585				$('.part-types-ticker').bxSlider({
1586					minSlides: 5,
1587					maxSlides: 15,
1588					slideMargin: 20,
1589					ticker: true,
1590					speed: 50000,
1591					autoHover: true
1592				});
1593			} catch (e) {
1594				console.warn("Part Types ticker issue");
1595			}
1596
1597			try {
1598				var minSlides = Math.max(Math.round($(".members-logos").width() / 250), 2);
1599				$('.members-logos-ticker').bxSlider({
1600					minSlides: minSlides,
1601					maxSlides: 5,
1602					slideMargin: 40,
1603					ticker: true,
1604					speed: 50000,
1605					autoHover: false
1606				});
1607			} catch (e) {
1608				console.error(e);
1609			}
1610
1611			var slider = $('.manex-public-topslider').bxSlider({
1612				auto: true,
1613				pause: 10000,
1614				speed: 1000,
1615				onSliderLoad: function(currentIndex){
1616				},
1617				onSlideBefore: function($slideElement, oldIndex, newIndex){
1618					$($slideElement.prevObject[oldIndex]).removeClass('current-slide');
1619				},
1620				onSlideAfter: function($slideElement, oldIndex, newIndex){
1621					$slideElement.addClass('current-slide');
1622					$(document).trigger('hover', '.initial-hover');
1623				}
1624			});
1625			
1626			try {
1627				if($(".manex-public-topslider").length) {
1628					slider.getCurrentSlideElement().addClass('current-slide');
1629				}
1630			} catch(e) {
1631				console.error(e);
1632			}
1633
1634			APP.sliders = {};
1635
1636			try {
1637				APP.sliders.topMapSlider = $('.top-slider').bxSlider({
1638					auto: true,
1639					autoControls: false,
1640					controls: false,
1641					speed: 1000,
1642					pause: 6000,
1643					autoHover: true,
1644					startSlide: 0,
1645					mode: "fade",
1646					preloadImages: "all"
1647				});
1648			} catch (e) {
1649				console.error("top-slider issue");
1650			}
1651
1652			try {
1653				var slidesCount = document.querySelectorAll("#testimonialsPager a").length;
1654				APP.sliders.testimonialsSlider = $('.testimonials-slider').bxSlider({
1655					auto: true,
1656					autoControls: false,
1657					controls: false,
1658					speed: 500,
1659					pause: slidesCount <= 1 ? 990000 : 10000,
1660					autoHover: true,
1661					startSlide: 0,
1662					mode: "fade",
1663					keyboardEnabled: true,
1664					preloadImages: "all",
1665					pagerCustom: "#testimonialsPager"
1666				});
1667			} catch (e) {
1668				console.warn("testimonials-slider issue");
1669			}
1670
1671			try {
1672				APP.sliders.opportunitiesSlider = $('.opportunities-slider').bxSlider({
1673					auto: true,
1674					autoControls: false,
1675					controls: false,
1676					speed: 500,
1677					pause: 10000,
1678					autoHover: true,
1679					startSlide: 0,
1680					mode: "horizontal",
1681					keyboardEnabled: true,
1682					preloadImages: "all",
1683					pagerCustom: "#opportunitiesPager"
1684				});
1685			} catch (e) {
1686				console.warn("opportunities-slider issue");
1687			}
1688		});
1689	}
1690
1691	// Slick - ticker
1692	if (APP.check([".req-slick", ".slick", ".slick-ticker"])) {
1693		APP.loadRequired(['slick'], function() {
1694			$('.slick').slick({
1695				infinite: true,
1696				slidesToShow: 1,
1697				slidesToScroll: 1,
1698				autoplay: true,
1699				autoplaySpeed: 5000,
1700				//fade: true,
1701				slide: 'li',
1702				speed: 1000
1703			});
1704
1705			$('.slick-ticker').slick({
1706				infinite: true,
1707				slidesToShow: 4,
1708				slidesToScroll: 5,
1709				autoplay: true,
1710				autoplaySpeed: 0,
1711				arrows: false,
1712				cssEase: 'linear',
1713				pauseOnHover: false,
1714				slide: 'li',
1715				speed: 10000,
1716				variableWidth: true
1717			});
1718		});
1719	}
1720
1721	// jQuery TN3 slider/gallery
1722	if (APP.check([".req-tn3", ".mygalleryX"])) { // it's turned off for .mygallery
1723		APP.loadRequired(['tn3'], function() {
1724			var jQuery = $;
1725
1726			var tn1 = $('.mygallery').tn3({
1727				skinDir: "/events/skins",
1728				autoplay: "true",
1729				width: 700,
1730				delay: 5000,
1731				skin: ["tn3e", "bullets"],
1732				imageClick: "url",
1733				image: {
1734					transitions: [{
1735						type: "blinds",
1736						duration: 300
1737					},
1738					{
1739						type: "grid",
1740						duration: 160,
1741						gridX: 9,
1742						gridY: 7,
1743						easing: "easeInCubic",
1744						sort: "circle"
1745					}, {
1746						type: "slide",
1747						duration: 430,
1748						easing: "easeInOutExpo"
1749					}]
1750				},
1751				thumbnailer: {
1752					align: 2,
1753					mode: "bullets"
1754				}
1755			});
1756		});
1757	}
1758
1759	// jQuery Cycle
1760	if (APP.check([".req-cycle", "#MainBanner", "#Scroller"])) {
1761		APP.loadRequired(['cycle'], function() {
1762			var jQuery = $;
1763
1764			$('#MainBanner').cycle({
1765				fx: 'scrollLeft',
1766				pager: '#nav'
1767			});
1768
1769			$('#Scroller').cycle({
1770				autoMode: 'loop'
1771			});
1772		});
1773	}
1774
1775	// jQuery jCounter
1776	if (APP.check([".req-jcountdown", "#time"])) {
1777		APP.loadRequired(['jcountdown'], function() {
1778			var jQuery = $;
1779			$("#time").countdown({
1780				date: "March, 03 2016",
1781				//htmlTemplate: "%{h} <span class=\"cd-time\">hours</span> %{m} <span class=\"cd-time\">mins</span> %{s} <span class=\"cd-time\">sec</span>",
1782				offset: 1,
1783				onChange: function (event, timer) {
1784				},
1785				onComplete: function (event) {
1786					//$(this).html("Completed");
1787					$(this).html("0 <span class=\"cd-time\">days</span> 0 <span class=\"cd-time\">hours</span> 0 <span class=\"cd-time\">mins</span>");
1788				},
1789				onPause: function (event, timer) {
1790					$(this).html("Pause");
1791				},
1792				onResume: function (event) {
1793					$(this).html("Resumed");
1794				},
1795				leadingZero: true
1796			});
1797		});
1798	}
1799
1800	// Tooltips from title attribute
1801	APP.titleTooltip = function () {
1802		try {
1803			$('[title]:not(area)').tooltip({
1804				show: 200,
1805				hide: 200,
1806				position: { my: "center bottom-10", at: "center top" }
1807				//track: true
1808			});
1809		} catch (e) {
1810			console.warn(e.message);
1811		}
1812	};
1813
1814	// jQuery UI
1815	if (APP.check([".req-jqueryui", "#tabs", ".accordion", "[title]:not(area)"])) {
1816		APP.loadRequired(['jqueryui'], function () {
1817			// Tabs
1818			$('#tabs').tabs();
1819			// Accordion
1820			$('.accordion').accordion({ heightStyle: "content", collapsible: true });
1821			//Tooltips
1822			APP.titleTooltip();
1823		});
1824	}
1825
1826
1827
1828	function page(pageName) {
1829	    try {
1830	        return document.getElementsByTagName("body")[0].classList.contains("page-" + pageName);
1831	    } catch (e) {
1832	        console.warn(e.message);
1833	    }
1834	}
1835
1836	// Pricing page
1837	if (APP.check([".page-pricing"])) {
1838	    var pricingData = {},
1839	        selectRegion = document.getElementById("select-region");
1840
1841	    // get JSON data with ajax
1842	    var getAjax = function getAjax(url, success) {
1843	        var xhr = window.XMLHttpRequest ? new XMLHttpRequest() : new ActiveXObject('Microsoft.XMLHTTP');
1844	        xhr.open('GET', url);
1845	        xhr.onreadystatechange = function () {
1846	            if (xhr.readyState > 3 && xhr.status == 200) {
1847	                success(xhr.responseText);
1848	            } else
1849	                if (xhr.readyState > 3) {
1850	                    var xhrdone = true;
1851	                }
1852	        };
1853	        xhr.setRequestHeader('X-Requested-With', 'XMLHttpRequest');
1854	        xhr.send();
1855	        return xhr;
1856	    }
1857
1858	    // update price for choosen options
1859	    var updatePrice = function () {
1860	        var region = selectRegion.value,
1861	            level = getLevel();
1862	        var priceA = pricingData.Annual[region][level],
1863	            priceQ = pricingData.Quarterly[region][level];
1864	        var currency = pricingData.Annual[region][0];
1865
1866	        //document.getElementById("priceQ").innerHTML = priceQ + "&nbsp;" + currency;
1867	        document.getElementById("priceA").innerHTML = priceA + "&nbsp;" + currency;
1868	    }
1869
1870	    // get choosen level (1 = 5000, 2 = 10000, 3 = unlimited)
1871	    var getLevel = function () {
1872	        var radios = document.getElementsByName('level');
1873
1874	        for (var i = 0; i < radios.length; i++) {
1875	            if (radios[i].checked) {
1876	                return parseInt(radios[i].value);
1877	            }
1878	        }
1879	    }
1880
1881	    // fill form with data from JSON and set listeners
1882	    var fillForm = function (pricingData) {
1883	        var regions = "";
1884	        // get all regions from JSON
1885	        for (var region in pricingData.Annual) {
1886	            if (pricingData.Annual.hasOwnProperty(region)) {
1887	                regions += "<option value='" + region + "'>
1887" + region + "</option>";
1888	            }
1889	        }
1890
1891	        // fill select box with regions
1892	        selectRegion.innerHTML = regions;
1893
1894	        // set listener if radio is clicked
1895	        var radios = document.getElementsByName('level');
1896	        for (var i = 0; i < radios.length; i++) {
1897	            radios[i].addEventListener("click", function (e) {
1898	                updatePrice();
1899	            }, false);
1900	        }
1901
1902	        // set listener if region is changed
1903	        selectRegion.addEventListener("change", function (e) {
1904	            updatePrice();
1905	        }, false);
1906
1907	        // set initial price for the first region and level on the list
1908	        updatePrice();
1909	    }
1910
1911
1912	    // url for the pricing data 
1913	    var url = window.location.origin + '/prr';
1914
1915	    // get JSON data from server
1916	    getAjax(url, function (data) {
1917	        var prr = JSON.parse(data);
1918
1919	        // remap worthless JSON structure to something usable
1920	        for (var i = 0; i < prr.length; i++) {
1921	            var pr = prr[i];
1922
1923	            if (!pricingData.hasOwnProperty(pr.pd)) {
1924	                pricingData[pr.pd] = {};
1925	            }
1926	            pricingData[pr.pd][pr.rg] = [pr.cu, pr.l1, pr.l2, pr.l3];
1927	        }
1928
1929	        // fill form with received data
1930	        fillForm(pricingData);
1931	    });
1932	}
1933
1934})();

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.