PageSourceSearch

https://www.ciht.org.uk/assets/scripts/main.js?v=123

js ciht.org.uk collected 2026-09-24 09:24:39 UTC 35,950 bytes, 1,198 lines download raw bytes

1$(function () {
2	$(document).ajaxError(function (e, xhr) {
3		if (xhr.status === 403 || xhr.status === 401) {
4			var response = $.parseJSON(xhr.responseText);
5			if (response.Error === "NotAuthorized")
6				window.location = "/account/dashboard/?ReturnUrl=" + window.location;
7		}
8	});
9});
10
11(function ($) {
12	$.fn.goTo = function () {
13		$('html, body').animate({
14			scrollTop: $(this).offset().top - 250 + 'px'
15		}, 'fast');
16		return this; // for chaining...
17	}
18})(jQuery);
19
20function isBreakpoint(alias) {
21	return $('.device-' + alias).is(':visible');
22}
23
24function contentToggle(element, target) {
25	$(element).on('click', function () {
26		var element = $(this);
27		if ($(this).hasClass('active')) {
28			$(element).next(target).slideUp();
29			$(this).removeClass('active');
30		} else {
31			$(element).next(target).slideDown();
32			$(this).addClass('active');
33		}
34	});
35}
36
37$(function () {
38	$('[data-toggle="tooltip"]').tooltip();
39});
40
41$(document).ready(function () {
42
43	$("form").validate({
44		focusInvalid: false,
45		invalidHandler: function (form, validator) {
46
47			if (!validator.numberOfInvalids())
48				return;
49
50			$(validator.errorList[0].element).goTo();
51		}
52	});
53
54	$(".umbraco-forms-field").addClass("contourField");
55
56	$(document).on("click", '.hideText', function () {
57		$(this).parent().parent().parent().find(".showMore").slideDown("slow");
58		$(this).addClass("showText");
59		$(this).removeClass("hideText");
60		$(this).text('Show Less');
61
62	});
63	$(document).on("click", '.showText', function () {
64
65		$(this).parent().parent().parent().find(".showMore").slideUp("slow");
66		$(this).removeClass("showText");
67		$(this).addClass("hideText");
68		$(this).text($(this).attr("data-buttonText"));
69
70
71	});
72
73
74	$("input[name$='membershipRadio']").click(function () {
75		var val = $(this).val();
76
77		$("#prices").show();
78		$(".prices-table").hide();
79		$("#prices_table_" + val).show();
80	});
81
82	$(".accordionMenu").click(function () {
83
84		$(this).toggleClass("accordMenuActive", "slow");
85		$(this).closest('div').find('.menuPanel').slideToggle();
86
87	});
88	$(".whiteSecWrap").find(".accordionMenu:last").css("border-bottom", "1px solid #cacaca");
89	$(".whiteSecWrap").find(".menuPanel:last").css("border-bottom", "1px solid #cacaca");
90	$(".whiteSecWrap").find(".menuPanel:last").css("border-top", "none");
91
92	$('.accordionMenuItem').each(function () {
93		$(this).next('div:not(.accordionMenuItem)').prev('.accordionMenuItem').find(".accordionMenu").css("border-bottom", "1px solid #cacaca");
94		$(this).next('div:not(.accordionMenuItem)').prev('.accordionMenuItem').find(".menuPanel:last").css("border-bottom", "1px solid #cacaca");
95		$(this).next('div:not(.accordionMenuItem)').prev('.accordionMenuItem').find(".menuPanel:last").css("border-top", "none");
96	});
97
98
99	$(".show-well").click(function () {
100		console.log("test");
101		$(this).closest('div').find('.well-toggle').toggle(600);
102	});
103
104	if ($("#changeEmailPassword").length > 0) {
105		var emailField = $("#email");
106		var passwordField = $("#changeEmailPassword #password");
107		var emailValidationField = $("#emailValidation");
108		var passwordRequiredField = $("#changeEmailPassword #passwordRequired");
109		var emailRegex = /^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/;
110
111		passwordField.on('input', function () {
112			if ($(this).val().length == 0) {
113				passwordRequiredField.show();
114			} else {
115				passwordRequiredField.hide();
116			}
117		});
118
119		emailField.on('input', function () {
120			var currentEmail = $("#currentEmail").val();
121			var email = $(this).val();
122			if (email != currentEmail) {
123				$("#changeEmailPassword").show();
124				passwordField.attr('required', 'required');
125				if (email.match(emailRegex) == null) {
126					emailValidationField.show();
127				} else {
128					emailValidationField.hide();
129				}
130			} else {
131				$("#changeEmailPassword").hide();
132				passwordField.removeAttr('required');
133			}
134		});
135
136		if ($("#updateEmailError").length > 0) {
137			$("#updateEmailError").goTo();
138		}
139	}
140
141	$(".member-country--js #countryCode").each(function () {
142		if ($(this).val() == 'US') {
143			$(".member-state--js").show();
144			$(".member-county--js").hide();
145		} else {
146			$(".member-state--js").hide();
147			$(".member-county--js").show();
148		}
149
150		if ($(this).val() == 'GB') {
151			$(".member-county--js").children("label").text("County:");
152		}
153		else {
154			$(".member-county--js").children("label").text("State / Province / Region:");
155		}
156
157		//if ($(this).val() == 'GB') {
158		//    $(".member-county--js").show();
159		//} else {
160		//    $(".member-county--js").hide();
161		//}
162	}).on('change', function () {
163		if ($(this).val() == 'US') {
164			$(".member-state--js").show();
165			$(".member-county--js").hide();
166		} else {
167			$(".member-state--js").hide();
168			$(".member-county--js").show();
169		}
170
171		if ($(this).val() == 'GB') {
172
173			$(".member-county--js").children("label").text("County:");
174		}
175		else {
176			$(".member-county--js").children("label").text("State / Province / Region:");
177		}
178
179		//if ($(this).val() == 'GB') {
180		//    $(".member-county--js").show();
181		//} else {
182		//    $(".member-county--js").hide();
183		//}
184	});
185	if ($('#darkBG').is('.modal-backdrop fade in')) {
186		$("#darkBG").removeClass("modal-backdrop fade in");
187	}
188	$('li.navigation-item').hover(
189
190		function () {
191			$("#darkBG").addClass("modal-backdrop fade in");
192		}, function () {
193			$("#darkBG").removeClass("modal-backdrop fade in");
194		}
195	);
196});
197
198function submitMemberUpdateForm() {
199	var emailValidationField = $("#emailValidation");
200	var passwordRequiredField = $("#changeEmailPassword #passwordRequired");
201	if (emailValidationField.is(':visible') || passwordRequiredField.is(':visible')) {
202		$("#email").goTo();
203		return false;
204	}
205	return true;
206}
207
208$(document).on('change', '.memberAddressListSelect', function () {
209	var selectedAddress = $(this).find(':selected');
210
211	var address = selectedAddress.data("address");
212	var company = selectedAddress.data("company");
213	var town = selectedAddress.data("town");
214	var county = selectedAddress.data("county");
215	var country = selectedAddress.data("country");
216
217	$(".memberStreet").val((company != null ? company + "\n" : "") + address);
218	$(".memberTown").val(town);
219	$(".memberCounty").val(county);
220	//$("#Country").val(country);
221
222
223	$(".memberTown").change();//simulate change event to pass values
224	$(".memberCounty").change();//simulate change event to pass values
225
226	$(".memberAddressListSelect").slideUp();
227});
228
229$(document).on('keyup', '.memberPostcode', function () {
230	var currentPostcode = $(this);
231	var defaultAddressDiv = $(".defaultaddressDiv");
232	var foreignAddressDiv = $(".foreaignaddressDiv");
233	var Country = $("#countryCode");
234
235	$(".memberAddressListDiv").slideUp("slow");
236	var options = $(".memberAddressListSelect");
237	options.html('');
238	var postcode = currentPostcode.val();
239	postcode = postcode.replace(/\s/g,'');
240	if (/^[a-zA-Z][a-zA-Z0-9 ]*[a-zA-Z]$/.test(postcode) && postcode.length >= 5 && postcode.length <= 7) {
241		$.ajax({
242			url: '/umbraco/api/autocompleteservice/SearchForAddress?query=' + currentPostcode.val(),
243			type: 'POST',
244			dataType: 'json',
245			beforeSend: function () {
246				$(".loader").css("display", "none");
247				currentPostcode.addClass("loadinggif");
248			},
249			success: function (data) {
250				//console.log(data);
251				if (data && data !== '') {
252					$.each(data, function () {
253						options.append($('<option data-company="' + this.Company + '" data-address="' + this.Address + '" data-town="' + this.Town + '" data-county="' + this.County + '" />')
254							.val(this.Address).text((this.Company ? this.Company + ", " : "") + this.Address + ", " + this.Town + (this.County ? ", " + this.County : "")));
255					});
256					//defaultAddressDiv.removeClass("hideMe");
257					$(".memberAddressListDiv").slideDown("slow");
258					$(".memberAddressListSelect").css("width", "auto");
259				}
260				currentPostcode.removeClass("loadinggif");
261			},
262			error: function (xhr, textStatus, error) {
263				console.log(xhr.statusText);
264				console.log(textStatus);
265				console.log(error);
266			}
267		});
268	}
269	else {
270		//defaultAddressDiv.addClass("hideMe");
271		$(".memberAddressListDiv").slideUp("slow");
272	}
273
274	if (currentPostcode.val() && Country.val() === 'GB') {
275		defaultAddressDiv.slideDown();
276		foreignAddressDiv.slideUp();
277	}
278	else {
279		defaultAddressDiv.slideUp();
280	}
281});
282
283function populateDropDownAsync(controlIdOrClassName, apiMethodname, enablefreetext, methodToInvokeOnSuccess) {
284	var input = $(controlIdOrClassName);
285	var autodata = null;
286
287	$.ajax({
288		url: apiMethodname,
289		type: 'GET',
290		async: false,
291		dataType: 'json',
292		beforeSend: function () {
293		},
294		success: function (result) {
295			autodata = $.map(result, function (item) {
296				return {
297					data: item.Value,
298					value: item.Text
299				}
300			});
301
302			if (typeof methodToInvokeOnSuccess !== "undefined")
303				methodToInvokeOnSuccess();
304		},
305		error: function (xhr) {
306			console.log("Error occured.please try again");
307		}
308	});
309
310	$(controlIdOrClassName.toString()).autocomplete({
311		lookup: autodata,
312		width: 400,
313		zIndex: 999,
314		onSelect: function (suggestion) {
315			$(this).next().val(suggestion.data);
316
317		}
318	});
319
320	$(document).on('propertychange change', controlIdOrClassName.toString(), function () {
321		var currentHF = $(this).next();
322		var currentObj = $(this);
323		var currentValue = $(this).val();
324
325		var valueExists = false;
326		$.each(autodata, function (index) {
327			if (currentValue.toLowerCase() === this.value.toLowerCase()) {
328				valueExists = true;
329				currentHF.val(this.data);
330				return false;
331			}
332		});
333
334		if (enablefreetext) {
335			if (!valueExists) {
336				currentHF.val(currentObj.val());
337			}
338		}
339	});
340}
341
342function megamenu(element, parentClass, toggleClass, toggleActiveClass) {
343	$('.' + element + ' ul').each(function () {
344		$(this).siblings('a, span')
345			.wrap('<span class="' + parentClass + '"></span>')
346			.parent().append('<span class="' + toggleClass + '"></span>');
347	});
348	$('.' + toggleClass).on('click', function () {
349		if ($('.' + element + ' ul').is(":animated")) {
350			return false;
351		}
352		var toggleParent = $(this).parent();
353		toggleParent.parent().siblings('li').children('ul').slideUp();
354		$(this).toggleClass(toggleActiveClass);
355		toggleParent.siblings('ul').slideToggle();
356	});
357}
358
359$(document).ready(function () {
360	if (isBreakpoint('xs') || isBreakpoint('sm')) {
361		megamenu('site-navigation', 'has-toggle', 'toggle', 'active');
362	}
363
364	contentToggle('.accordion-item-toggle', '.accordion-item-content');
365
366
367	//Standard tabs
368	$('.tab-container').each(function () {
369		if ($(this).closest('.modal').length == 0) {
370			var element = $(this);
371			var tabClass = '.tab-container';
372			var tabUl = '.tabs';
373			var tabTarget = '.tabs-target';
374			var tabContent = '.tab-item';
375			if ($(element).hasClass('vertical-tab') || $(element).find('.vertical-tab').length != 0) {
376			} else {
377				//var initialHeight = $(this).find(tabContent + '.active').outerHeight();
378				//$(this).find('> ' + tabTarget).css({ 'height': initialHeight });
379			};
380			$(this).find('> ' + tabUl + ' li').off().on('click', function (e) {
381				$(this).siblings('li').removeClass('active');
382				$(this).addClass('active');
383				var tabIndex = $(this).index();
384				$(this).closest(tabClass).find('> ' + tabTarget + ' > ' + tabContent).removeClass('active');
385				$(this).closest(tabClass).find('> ' + tabTarget + ' > ' + tabContent).eq(tabIndex).addClass('active');
386				e.preventDefault();
387				if ($(element).hasClass('vertical-tab') || $(element).find('.vertical-tab').length != 0) {
388				} else {
389					var activeTabHeight = $(this).closest(tabClass).find('> ' + tabTarget + ' > ' + tabContent).eq(tabIndex).outerHeight();
390					$(this).closest(tabClass).find('> ' + tabTarget).css({ 'height': activeTabHeight });
391				};
392			});
393		};
394	});
395
396	//Tab width
397	$('.tabs').each(function () {
398		var children = $(this).children().length;
399		$(this).addClass('tabs-children-' + children);
400		if ($(this).closest('.modal').length == 0) {
401			var height = 0
402			$(this).find('> li > a').each(function () {
403				if ($(this).height() > height) height = $(this).height();
404			}).height(height);
405		};
406	});
407
408	//Standard tabs and tab height in modals :(
409	$('*[data-toggle="modal"]').on('click', function () {
410		setTimeout(function () {
411			$('.modal .tab-container').each(function () {
412				var element = $(this);
413				var tabClass = '.tab-container';
414				var tabUl = '.tabs';
415				var tabTarget = '.tabs-target';
416				var tabContent = '.tab-item';
417				if ($(element).hasClass('vertical-tab') || $(element).find('.vertical-tab').length != 0) {
418				} else {
419					var initialHeight = $(this).find(tabContent + '.active').outerHeight();
420					$(this).find('> ' + tabTarget).css({ 'height': initialHeight });
421				};
422				$(this).find('> ' + tabUl + ' li').off().on('click', function (e) {
423					$(this).siblings('li').removeClass('active');
424					$(this).addClass('active');
425					var tabIndex = $(this).index();
426					$(this).closest(tabClass).find('> ' + tabTarget + ' > ' + tabContent).removeClass('active');
427					$(this).closest(tabClass).find('> ' + tabTarget + ' > ' + tabContent).eq(tabIndex).addClass('active');
428					e.preventDefault();
429					if ($(element).hasClass('vertical-tab') || $(element).find('.vertical-tab').length != 0) {
430					} else {
431						var activeTabHeight = $(this).closest(tabClass).find('> ' + tabTarget + ' > ' + tabContent).eq(tabIndex).outerHeight();
432						$(this).closest(tabClass).find('> ' + tabTarget).css({ 'height': activeTabHeight });
433					};
434				});
435			});
436
437			//Tab width
438			$('.tabs').each(function () {
439				var children = $(this).children().length;
440				var height = 0
441				$(this).find('> li > a').each(function () {
442					if ($(this).height() > height) height = $(this).height();
443				}).height(height);
444			});
445
446		}, 400);
447	});
448
449
450
451
452	//Event filter
453	$('.tag-filter a').on('click', function (e) {
454		var element = $(this);
455		var parent = $(this).closest('.tag-filter');
456		if (parent.hasClass('tag-filter-multiple')) {
457			$(element).toggleClass('active');
458		} else {
459			$(element).closest('.tag-filter').find('a').removeClass('active');
460			$(element).addClass('active');
461		};
462		e.preventDefault();
463	});
464
465	//Event tab
466	$('.tag-tab').each(function (e) {
467		/*$(this).find('.grid-view').on('click',function(e) {
468			$('.calendar-view').removeClass('active');
469			$(this).addClass('active');
470			$('#er-view-calendar').hide();
471			$('#er-view-grid').show();
472			e.preventDefault()
473		});*/
474		$(this).find('.calendar-view').on('click', function (e) {
475			//$('.grid-view').removeClass('active');
476			$(this).toggleClass('active');
477			$('#er-view-grid').toggle();
478			$('#er-view-calendar').toggle();
479			e.preventDefault()
480		});
481	});
482
483	//Equal height 'well' divs. Add class 'equal-height-wells' to the containing .row
484	if (isBreakpoint('md') || isBreakpoint('lg')) {
485		setTimeout(function () {
486			$('.equal-height-well').each(function () {
487				var maxheight = 0;
488				$(this).find('.well').each(function () {
489					maxheight = ($(this).outerHeight() > maxheight ? $(this).outerHeight() : maxheight);
490				});
491				$(this).find('.well').css({ 'min-height': maxheight });
492			});
493		}, 100);
494	}
495
496	//Banner slider
497	$('.banner-slides').each(function () {
498		var element = $(this);
499		if ($(element).children().length > 1) {
500			$(element).bxSlider({
501				auto: true,
502
503				minSlides: 1,
504				maxSlides: 1,
505				moveSlides: 1,
506				controls: true,
507				pager: true,
508				speed: 1000,
509				pause: 10000,
510				nextSelector: '#slider-next',
511				prevSelector: '#slider-prev',
512				nextText: '<img src="/images/sldArrow2.png" height="144" width="50"/>',
513				prevText: '<img src="/images/sldArrow1.png" height="144" width="50"/>',
514				onSliderLoad: function () {
515					$(element).css({ 'visibility': 'visible' });
516				}
517			});
518		} else {
519			$(element).css({ 'visibility': 'visible' }).removeClass('banner-slides').addClass('no-slider');
520		}
521	});
522
523	//footerlider
524	$('.footer-slides').each(function () {
525		var element = $(this);
526		if ($(element).children().length > 1) {
527			$(element).bxSlider({
528				auto: true,
529
530				minSlides: 1,
531				maxSlides: 1,
532				moveSlides: 1,
533				controls: true,
534				pager: false,
535				speed: 1000,
536				pause: 10000,
537				nextSelector: '#slider-next-footer',
538				prevSelector: '#slider-prev-footer',
539				nextText: '<img src="/images/sldArrow2.png" height="144" width="50"/>',
540				prevText: '<img src="/images/sldArrow1.png" height="144" width="50"/>',
541				onSliderLoad: function () {
542					$(element).css({ 'visibility': 'visible' });
543				}
544			});
545		} else {
546			$(element).css({ 'visibility': 'visible' }).removeClass('footer-slides').addClass('no-slider');
547		}
548	});
549
550
551
552	//Competency check/cross
553	$('.competency-true-false').each(function () {
554		var element = $(this);
555		$(element).find('.ctf-true, .ctf-false').on('click', function () {
556			$(this).siblings('div').removeClass('active');
557			$(this).addClass('active');
558
559			var tabIndex = $(this).closest('.tab-item').index();
560			var tabContainer = $(this).closest('.tab-container');
561			$(tabContainer).find('.tabs li').removeClass('completed');
562			$(tabContainer).find('.tabs li:eq(' + tabIndex + ')').addClass('completed');
563			$(tabContainer).find('.tabs li:lt(' + tabIndex + ')').addClass('completed');
564		});
565
566		$(element).find('.ctf-true').on('click', function () {
567			var tabIndex = $(this).closest('.tab-item').index();
568			var tabContainer = $(this).closest('.tab-container');
569
570			$(tabContainer).find('.tabs li:eq(' + tabIndex + ')').next('li').trigger('click');
571			$(tabContainer).find('.tab-item:gt(' + tabIndex + ')').find('.ctf-true, .ctf-false').removeClass('active');
572			$(tabContainer).find('.tab-item:lt(' + tabIndex + ')').find('.ctf-true').addClass('active');
573		});
574
575		$(element).find('.ctf-false').on('click', function () {
576			var tabIndex = $(this).closest('.tab-item').index();
577			var tabContainer = $(this).closest('.tab-container');
578
579			$(tabContainer).find('.tab-item:gt(' + tabIndex + ')').find('.ctf-true, .ctf-false').removeClass('active');
580		});
581	});
582	//Reset competency
583	/*$('.competency-reset').on('click',function(e) {
584		var element = $(this);
585		$(element).closest('.competency-tab-container').find('.ctf-true, .ctf-false').removeClass('active');
586		$(element).closest('.competency-tab-container').find('.competency-tab .tabs li:eq(0)').trigger('click');
587		$(element).closest('.competency-tab-container').find('> .tabs li:eq(0)').trigger('click');
588		$(element).closest('.competency-message-popup').hide();
589		e.preventDefault();
590	});*/
591
592	//Competency tabs
593	/*$('.ctf-true, .ctf-false').on('click',function() {
594		var element = $(this);
595		var tabIndex =  $(element).closest('.tab-item').index();
596		var targetNextTab = $(element).closest('.competency-tab').find('.tabs li:eq(' + tabIndex + ')').next('li');
597		var tabContainerActive = $(element).closest('.competency-tab-container').find('> .tabs li.active').next('li');
598
599		if ( (tabContainerActive).length == 0  ) {
600			$(element).closest('.competency-tab-container').find('.competency-message-popup').show();
601		}
602	});*/
603
604	//Membership
605	$('.mr-reject').on('click', function () {
606		var element = $(this);
607		$(element).closest('.membership-recommended').hide();
608		$(element).closest('.membership-select').find('.membership-options').show();
609	});
610
611	//Toggle text
612	$('.text-toggle').on('click', function (e) {
613		var origText = $(this).data('text-orig');
614		var newText = $(this).data('text-toggle');
615		var conditionText = $(this).text() == origText ? newText : origText;
616
617		$(this).text(conditionText);
618
619		//console.log(origText + newText);
620		e.preventDefault();
621	});
622
623	//Comments listing
624	$('.comments-listing-toggle').on('click', function (e) {
625		$(this).closest('.comments-overview').next('.comments-listing').slideToggle();
626		e.preventDefault();
627	});
628
629	//Member avatar listing 
630	$('.member-avatar-listing').each(function () {
631		var element = $(this);
632		var clickToggle = $(element).find('.mal-toggle');
633		var clickTarget = $(element).find('.mal-target');
634		setTimeout(function () {
635			var origHeight = $(element).find('.mal-target').outerHeight();
636			var newHeight = $(element).find('.mal-target > ul').outerHeight();
637
638			$(clickToggle).on('click', function () {
639				if ($(clickTarget).hasClass('active')) {
640					$(clickTarget).animate({ height: origHeight }, 200).removeClass('active');
641				} else {
642					$(clickTarget).animate({ height: newHeight }, 200).addClass('active');
643				}
644			});
645		}, 200);
646	});
647
648	//Listing item
649	$('.listing-item-reveal-toggle').on('click', function (e) {
650		$(this).closest('.listing-item-group').find('.listing-item-reveal').slideToggle();
651		$(this).toggleClass('active');
652		e.preventDefault();
653	});
654
655
656	//Publication slider
657	$('.publication-list-slider > ul').each(function () {
658		var element = $(this);
659		if (isBreakpoint('xs')) {
660			if ($(element).children().length > 2) {
661				$(element).bxSlider({
662					minSlides: 2,
663					maxSlides: 2,
664					moveSlides: 2,
665					slideWidth: 700,
666					pager: false,
667					speed: 1000,
668					nextText: '',
669					prevText: '',
670					onSliderLoad: function () {
671						$(element).css({ 'visibility': 'visible' });
672					}
673				});
674			} else {
675				$(element).css({ 'visibility': 'visible' }).addClass('no-slider');
676			};
677		} else if (isBreakpoint('sm')) {
678			if ($(element).children().length > 4) {
679				$(element).bxSlider({
680					minSlides: 4,
681					maxSlides: 4,
682					moveSlides: 4,
683					slideWidth: 700,
684					pager: false,
685					speed: 1000,
686					nextText: '',
687					prevText: '',
688					onSliderLoad: function () {
689						$(element).css({ 'visibility': 'visible' });
690					}
691				});
692			} else {
693				$(element).css({ 'visibility': 'visible' }).addClass('no-slider');
694			};
695		} else if (isBreakpoint('md')) {
696			if ($(element).children().length > 6) {
697				$(element).bxSlider({
698					minSlides: 6,
699					maxSlides: 6,
700					moveSlides: 6,
701					slideWidth: 700,
702					pager: false,
703					speed: 1000,
704					nextText: '',
705					prevText: '',
706					onSliderLoad: function () {
707						$(element).css({ 'visibility': 'visible' });
708					}
709				});
710			} else {
711				$(element).css({ 'visibility': 'visible' }).addClass('no-slider');
712			};
713		} else if (isBreakpoint('lg')) {
714			if ($(element).children().length > 7) {
715				$(element).bxSlider({
716					minSlides: 7,
717					maxSlides: 7,
718					moveSlides: 7,
719					slideWidth: 700,
720					pager: false,
721					speed: 1000,
722					nextText: '',
723					prevText: '',
724					onSliderLoad: function () {
725						$(element).css({ 'visibility': 'visible' });
726					}
727				});
728			} else {
729				$(element).css({ 'visibility': 'visible' }).addClass('no-slider');
730			};
731		}
732
733	});
734
735});
736
737// Active Tabs
738
739$(document).ready(function () {
740
741	$('#tab-1').click(function () {
742		$('#tab-2').removeClass('active'), $('#tab-3').removeClass('active'), $('#tab-1').addClass('active');
743	});
744
745	$('#tab-2').click(function () {
746		$('#tab-1').removeClass('active'), $('#tab-3').removeClass('active'), $('#tab-2').addClass('active');
747	});
748
749	$('#tab-3').click(function () {
750		$('#tab-2').removeClass('active'), $('#tab-1').removeClass('active'), $('#tab-3').addClass('active');
751	});
752
753});
754
755// End Active Tabs
756
757$('.site-navigation a').hover(function () {
758	$(this).parent().toggleClass('active');
759});
760
761
762// Newsletter Box
763
764$(document).ready(function () {
765	$('#mail-btn').click(function () {
766		$(this).parent().parent().toggleClass('mail-move');
767	});
768
769
770	$('#close-mail').click(function () {
771		$('.mailer-box').removeClass('mail-move');
772	});
773
774	if ($(".memberCompany").length > 0) {
775		populateDropDownAsync(".memberCompany", "/umbraco/api/JoiningApi/GetAllCompanies");
776	}
777});
778
779
780
781
782// Duplication Box      
783
784window.onload = function () {
785
786	//document.getElementById('web-clone').onclick = duplicate;
787
788
789	//var a = 0;
790	//var original = document.getElementById('duplicater');
791	//var mydiv = document.getElementById('mydiv');
792
793	//function duplicate() {
794	//    var clone = original.cloneNode(true); // "deep" clone
795	//    clone.id = "duplicetor" + ++a; // there can only be one element with an ID
796	//    mydiv.appendChild(clone);
797
798	//    $('.fa-close').click(function () {
799	//        $(this).parent().parent().remove();
800	//    })
801	//}
802
803
804
805
806
807	//Qualifications
808
809	$('#q-clone').on('click', duplicate2);
810
811	var e = 0;
812	var originalq = document.getElementById('duplicater2');
813	var mydiv2 = document.getElementById('mydiv2');
814
815	function duplicate2() {
816		console.log('duplicate');
817		var clone2 = originalq.cloneNode(true); // "deep" clone
818		clone2.id = "duplicater2" + ++e; // there can only be one element with an ID
819		mydiv2.appendChild(clone2);
820		$(clone2).css('display', 'block');
821
822		$("*[name^='qual_']", clone2).each(function () {
823			$(this).attr('name', $(this).attr('name') + '_' + e);
824
825			console.log(this);
826		});
827
828		$("input[name='qual_0_seq_" + e + "']", this).val(e);
829
830		$('.re-box').click(function () {
831			$(this).parent().parent().parent().remove();
832		});
833
834		$(".input-datepicker", clone2).removeClass('hasDatepicker');
835		$(".input-datepicker", clone2).removeAttr('id');
836
837
838		$(".input-datepicker", clone2).datepicker({
839			changeMonth: true,
840			changeYear: true,
841			yearRange: '-120:+0',
842			dateFormat: 'dd/mm/yy'
843		});
844
845
846
847		$('.input-datepicker-icon', clone2).on('click', function () {
848			$(this).siblings('.input-datepicker').datepicker().focus();
849		});
850
851
852	}
853
854
855	//Pro Associations
856
857
858	$('#p-clone').on('click', duplicate3);
859
860
861	var i = 0;
862	var originalp = document.getElementById('duplicetor3');
863	var mydiv3 = document.getElementById('mydiv3');
864
865	function duplicate3() {
866		var clone3 = originalp.cloneNode(true); // "deep" clone
867		clone3.id = "duplicetor3" + ++i; // there can only be one element with an ID
868		mydiv3.appendChild(clone3);
869
870		$(clone3).css('display', 'block');
871
872		$("*[name^='pro_']", clone3).each(function () {
873			$(this).attr('name', $(this).attr('name') + '_' + e);
874
875			console.log(this);
876		});
877
878		$('.re-box-3').click(function () {
879			$(this).parent().parent().parent().remove();
880		});
881
882		$(".input-datepicker", clone3).removeClass('hasDatepicker');
883		$(".input-datepicker", clone3).removeAttr('id');
884
885		$(".input-datepicker", clone3).datepicker({
886			changeMonth: true,
887			changeYear: true,
888			yearRange: '-120:+0',
889			dateFormat: 'dd/mm/yy'
890		});
891
892		$('.input-datepicker-icon', clone3).on('click', function () {
893			$(this).siblings('.input-datepicker').datepicker().focus();
894		});
895
896	}
897
898
899
900	//Projects
901
902	$('#r-clone').on('click', duplicate4);
903	//document.getElementById('j-clone').onclick = duplicate4;
904
905
906	var o = 0;
907	var originalj = document.getElementById('duplicetor4');
908	var mydiv4 = document.getElementById('mydiv4');
909
910	function duplicate4() {
911		if ($(".ref-item").length < 3) {
912			var clone4 = originalj.cloneNode(true); // "deep" clone
913			clone4.id = "duplicetor4" + ++o; // there can only be one element with an ID
914			mydiv4.appendChild(clone4);
915
916			$(clone4).css('display', 'block');
917
918			$("*[name^='ref_']", clone4).each(function () {
919				$(this).attr('name', $(this).attr('name') + '_' + e);
920
921				console.log(this);
922			});
923
924			$('.re-box-4').click(function () {
925				$(this).parent().parent().parent().remove();
926			});
927		}
928	}
929
930
931	//Refs
932
933
934	//document.getElementById('r-clone').onclick = duplicate5;
935
936
937	var u = 0;
938	var originalr = document.getElementById('duplicater5');
939	var mydiv5 = document.getElementById('mydiv5');
940
941	function duplicate5() {
942		var clone5 = originalr.cloneNode(true); // "deep" clone
943		clone5.id = "duplicetor5" + ++u; // there can only be one element with an ID
944		mydiv5.appendChild(clone5);
945
946		$('.re-box-5').click(function () {
947			$(this).parent().parent().parent().remove();
948		});
949	}
950};
951
952function redirectToSelectedValue(value) {
953	if (value != '') {
954		window.location = value;
955	}
956}
957
958$(document).ready(function () {
959	var btn = $(".standBtn.btn-default.btn");
960	var url = document.referrer;
961	btn.on("click", function () {
962		if (btn[0].innerHTML == "Go Back") {
963			goback(url);
964		}
965	})
966});
967
968function goback(url) {
969	if (url == "") {
970		history.back();
971	}
972	else {
973		location.replace(url);
974	}
975}
976
977
978$(document).ready(function () {
979	var drops = [1, 2, 3, 4, 5]
980	for (z = 0; z < drops.length; z++) {
981
982		$(".drop-" + drops[z]).css("display", "block");
983
984		var COL_COUNT = 4; // set this to however many columns you want
985		var col_heights = [];
986		var MaxHeight = 0;
987		$(".drop-" + drops[z] + " .container .section").each(function () {
988			//console.log($(this).height());
989			col_heights.push($(this).height());
990			MaxHeight += $(this).height();
991		});
992		$(".drop-" + drops[z] + " .container").eq(drops[z]).css("height", MaxHeight + "px");
993		var highest = Math.max.apply(Math, col_heights);
994		var i = 0;
995		$(".drop-" + drops[z] + " .container .section").each(function () {
996			$(this).css("height", col_heights[i] + 10 + "px");
997			i++;
998		});
999		if (col_heights.length > 4) {
1000			var ChangeHeight;
1001			var ChangeInitial;
1002			for (i = 0; i < 3; i++) {
1003				var J = [];
1004				switch (i) {
1005					case 0:
1006						J = [1, 2, 3]; break;
1007					case 1:
1008						J = [2, 3]; break;
1009					case 2:
1010						J = [3]; break;
1011				}
1012				for (H = 0; H < J.length; H++) {
1013					var Difference = col_heights[i] - col_heights[J[H]];
1014					if (Difference <= 50 && Difference > 0) {
1015						var Diff = col_heights[J[H]] + col_heights[4];
1016						//console.log(Diff);
1017						if (col_heights[i] - Diff < 0) {
1018							ChangeHeight = col_heights[i];
1019							ChangeInitial = J[H];
1020							//console.log(ChangeHeight + "sdas" + ChangeInitial);
1021							var initial = ChangeInitial;
1022							$(".drop-" + drops[z] + " .container .section").eq(initial).css("height", ChangeHeight);
1023							col_heights[initial] = ChangeHeight;
1024
1025						}
1026					}
1027
1028				}
1029			}
1030		}
1031		var ContCount = 0;
1032		$(".drop-" + drops[z] + " .container .section").each(function () {
1033			ContCount++;
1034		});
1035		var FourArray = [1, 2, 3, 4];
1036		if (ContCount > 4) {
1037			for (var cont = 5; cont <= ContCount; cont++) {
1038
1039				//console.log($(".drop-" + drops[z] + " .container .section").eq(cont));
1040
1041				var Offsetter = $(".drop-" + drops[z] + " .container .section").eq(cont - 1).offset();
1042				for (var four = 0;
1042 four < FourArray.length; four++) {
1043
1044					var BaseOffset = $(".drop-" + drops[z] + " .container .section").eq(four).offset();
1045					//console.log(Offsetter);
1046					if (BaseOffset.left === Offsetter.left) {
1047						var TopOffset = BaseOffset.top + col_heights[four] + 20;
1048						//console.log("TOP " + TopOffset);
1049						//console.log(BaseOffset.top + col_heights[four] + 20);
1050						var Topper = Offsetter.top - TopOffset;
1051						//console.log("Topper" + Topper);
1052						if ($(".drop-" + drops[z] + " .container .section .title").eq(cont - 1).html().indexOf('MyCIHT') < 0) {
1053
1054							if (Topper > 10) {
1055								$(".drop-" + drops[z] + " .container .section").eq(cont - 1).css("margin-top", "-" + Topper + "px");
1056
1057							}
1058
1059						}
1060					}
1061
1062				}
1063			}
1064
1065
1066		}
1067
1068		$(".drop-" + drops[z]).css("display", "none");
1069	};
1070
1071
1072	var heightPB = $('.ProgressBar').height();
1073	var twPB = '20';
1074	var ProgressBarHeight = parseInt(heightPB) + parseInt(twPB);
1075	$(".greySecWrap .container-mid").css('min-height', ProgressBarHeight);
1076
1077	var eventlinking = window.location.href.split('/')[3];
1078	if (eventlinking == 'event' || eventlinking == 'events-listing') {
1079		$('.red .lvl1').addClass("selected");
1080	}
1081	$(".SUBWAN").each(function () {
1082		$(this).click(function () {
1083			if (this.getAttribute("href").charAt(0) == "#") {
1084				$(this).attr("href", window.location.href.split("#")[0] + this.hash);
1085			}
1086		});
1087	});
1088	$(".NavOpen").click(function () {
1089		$(this).attr("style", "display:none !important");
1090		$(".closebtn").attr("style", "display:block !important");
1091		$("#darkBG").addClass("modal-backdrop fade in");
1092	});
1093	$(".closebtn").click(function () {
1094		$(this).attr("style", "display:none !important");
1095		$(".NavOpen").attr("style", "display:block !important");
1096		$("#darkBG").removeClass("modal-backdrop fade in");
1097	});
1098
1099
1100	var show = !show;
1101	$('.SUBWAN').each(function (index) {
1102		$(this).click(function () {
1103			if (show == show) {
1104				$(this).next('.SUBWANSHOW').toggleClass('visible');
1105				$(this).toggleClass('RotatedSubwan');
1106			}
1107			else {
1108				$(this).next('.SUBWANSHOW').toggleClass('visible');
1109				$(this).toggleClass('RotatedSubwan');
1110			}
1111			show = !show
1112		});
1113	});
1114
1115});
1116
1117function openNav() {
1118	$("#mySidenav").attr("style", "max-height:100%;");
1119}
1120
1121function closeNav() {
1122	$("#mySidenav").attr("style", "max-height:0%;");
1123}
1124
1125$(document).ready(function () {
1126	if ($(".site-navigation .navigation-item .selected").parent().attr('class') == "navigation-item red") {
1127		$(".main-container .secon-nav-wrap").attr('class', 'secon-nav-wrap red');
1128		//console.log("RED");
1129	}
1130	else if ($(".site-navigation .navigation-item .selected").parent().attr('class') == "navigation-item green") {
1131		$(".main-container .secon-nav-wrap").attr('class', 'secon-nav-wrap green');
1132		//console.log("Green");
1133	}
1134	else if ($(".site-navigation .navigation-item .selected").parent().attr('class') == "navigation-item purple") {
1135		$(".main-container .secon-nav-wrap").attr('class', 'secon-nav-wrap purple');
1136		//console.log("Purple");
1137	}
1138	else if ($(".site-navigation .navigation-item .selected").parent().attr('class') == "navigation-item orange") {
1139		$(".main-container .secon-nav-wrap").attr('class', 'secon-nav-wrap orange');
1140		//console.log("Orange");
1141	}
1142	else if ($(".site-navigation .navigation-item .selected").parent().attr('class') == "navigation-item blue") {
1143		$(".main-container .secon-nav-wrap").attr('class', 'secon-nav-wrap blue');
1144		//console.log("Blue");
1145	}
1146	else {
1147		//console.log("No colors Selected");
1148	}
1149	$(".NewsLeft").hide();
1150	$(".BlogsLeft").hide();
1151	$(".DiscoverLeft").hide();
1152	$(document).on("click", ".NewsLeft", function () {
1153		$(this).hide();
1154		$(".NewsRight").show();
1155		console.log("clicked");
1156	});
1157	$(document).on("click", ".NewsRight", function () {
1158		$(this).hide();
1159		$(".NewsLeft").show();
1160		console.log("clicked");
1161	});
1162	$(document).on("click", ".DiscoverLeft", function () {
1163		$(this).hide();
1164		$(".DiscoverRight").show();
1165		console.log("clicked");
1166	});
1167	$(document).on("click", ".DiscoverRight", function () {
1168		$(this).hide();
1169		$(".DiscoverLeft").show();
1170		console.log("clicked");
1171	});
1172	$(document).on("click", ".BlogsLeft", function () {
1173		$(this).hide();
1174		$(".BlogsRight").show();
1175		console.log("clicked");
1176	});
1177	$(document).on("click", ".BlogsRight", function () {
1178		$(this).hide();
1179		$(".BlogsLeft").show();
1180		console.log("clicked");
1181	});
1182
1183	//hide main Breadcrumbs on specific pages
1184	if (window.location.pathname.indexOf("/search-results") > -1 ||
1185		window.location.pathname.indexOf("/myciht/information") > -1 ||
1186		window.location.pathname.indexOf("/myciht/event-booking") > -1 ||
1187		window.location.pathname.indexOf("/myciht/financials/") > -1 ||
1188		window.location.pathname.indexOf("/myciht/payment") > -1 ||
1189		window.location.pathname.indexOf("/myciht-corporate/corporate-info") > -1 ||
1190		window.location.pathname.indexOf("/myciht-corporate/event-booking") > -1 ||
1191		window.location.pathname.indexOf("/myciht-corporate/financials") > -1 ||
1192		window.location.pathname.indexOf("/myciht-corporate/payment") > -1) {
1193		$('#main-Breadcrumbs').hide();
1194	}
1195});
1196
1197
1198// JavaScript Document

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.