PageSourceSearch

https://www.legislation.gov.uk/scripts/chrome.js

js legislation.gov.uk collected 2026-09-24 06:54:35 UTC 67,428 bytes, 1,977 lines download raw bytes

1/*
2(c)  Crown copyright
3
4You may use and re-use this code free of charge under the terms of the Open Government Licence v3.0
5
6http://www.nationalarchives.gov.uk/doc/open-government-licence/version/3
7
8*/
9/*
10
11Legislation.gov.uk Chrome Initialisation
12
13** The file ../chrome.js is created by Ant concatenation of
14** all files within the leg directory with the ChromeInit.js
15** file containing all initialisation scripts. Only edits
16** scripts withing the Leg directory.
17
18One-liner: All script initialisation for UI viewing is placed here
19Requirements:
20	jQuery framework: http://jquery.com/
21	jquery.cookie.js
22	leg/ExpandCollapse.js
23	leg/ToCExpandCollapse.js
24	leg/GeoExtent.js
25	leg/InterfaceOptions.js
26	leg/ModalWin.js
27	leg/TocExpandCollapse.js
28	leg/HelpItem.js
29
30History:
31v0.01	GM	Created
32v0.02	GM	2010-03-13	ToC scripts changed to reflect positioning changes and added global expand/collapse
33v0.03	GM	2010-03-14	Status warning box: moved open/close element for static positioning, added logic when to add
34						the open/close link.
35v0.04	GM	2010-03-15	Added functionality for the Legislation interface options
36v0.05	GM	2010-03-15	Changed open/close text from 'open' to 'more'
37v0.05	GM	2010-03-23	Added breadcrumb expand and collapse
38v0.06	GM	2010-03-25	Added test modal window links, added preloadBg animation
39v0.07	GM	2010-03-25	Added logic to ToC script so expand all only initialised if class is available onload
40v0.08	GM	2010-04-01	Amended StatusWarningOptions to only appear if #statusWarningSubSections are available
41v0.09	GM	2010-04-08	Added div to Open/Close links to fix IE layout
42v0.10	GM	2010-04-19	Added page variables and implemented ToC persistance
43v0.11	GM	2010-04-26	Added basic GeoExtent functionality
44v0.12	GM	2010-04-30	Enabled help items
45v0.13	TE 	2010-06-22	Added persistance using cookie to legExpandCollapse
46v0.14	GM	2010-07-05	Scripts of a similar type placed into seperated document.ready functions to prevent single
47						script failure preventing other scripts from loading.
48
49*/
50
51var legGlobals = window.legGlobals = window.legGlobals || {};
52$(document).ready(function(){
53	initGlobals();
54});
55
56function initGlobals (){
57
58	// Page variables - currently used for ToC persistance
59	// Uses the content URI to find the legislation number for basic unique ID
60	// Added to the legGlobals object for Global Access outside of the document.ready function
61
62	var contentUri, regExpForToCId, legPageId, cookieId, legCookieExpire, legTocType, tocCookieId;
63	legPageId = []; // initialise the variable as array
64
65	// find if the page is a Toc page and if so what type, can be used for tests
66	if ($("#layout2.legToc").length){
67		legTocType = "leg";
68	} else if($("#layout2.legEnToc").length){
69		legTocType = "en";
70	}
71
72	// Only populate on ToC page
73	if (legTocType){
74		if ($("#legContentLink a").length){
75			contentUri     = $("#legContentLink a").attr("href");
76	  		regExpForToCId = /^\/([a-z]*)\/([^\/]*)\/([^\/]*)/i;
77			legPageId      = contentUri.match(regExpForToCId);
78
79			// Creates a toc cookie id in format:
80			// toc_typeOfLeg_Year/Geo_UniqueNum
81			tocCookieId	   = "toc"+"_"+legPageId[1]+"_"+legPageId[2]+"_"+legPageId[3];
82        } else {
83			legTocType = "";
84		}
85	}
86	legCookieExpire = 5;  //days to keep persistance
87
88	// Add the class .js to swtich JavaScript styles on
89	$("#layout1")
90	.addClass("js");
91
92	// Asign values to the global object:
93	if (legTocType)
94		legGlobals.legTocType = legTocType;
95	if (tocCookieId)
96		legGlobals.tocCookieId = tocCookieId;
97	legGlobals.legCookieExpire = legCookieExpire;
98	// global object to hold legExpandCollapse values
99	legGlobals.expandCollapseState = new Object();
100}
101
102
103
104$(document).ready(function(){
105
106  $("#quickSearch").children().filter("a")
107	.addClass("expandCollapseLink")
108	.legExpandCollapse(['<span>' + config.quickSearch.expandCollapseLink.message1[LANG] + '<span class="accessibleText">' + config.quickSearch.expandCollapseLink.message2[LANG] + '</span></span>','<span>' + config.quickSearch.expandCollapseLink.message1[LANG] + '<span class="accessibleText">' +config.quickSearch.expandCollapseLink.message3[LANG] + '</span></span>','<span>'], {
109		state: legGlobals.expandCollapseState,
110		expires: legGlobals.legCookieExpire,
111		open: "open"
112	});
113	// Status warning box, only add open/close link if there is more than intro text or there are div children
114	// Use .length to get conditional value rather than getElementById so we can use the jQuery framework selectors and
115	// use the object further if needed.
116	if ($("#statusWarningSubSections").length) {
117		var $target = $("#statusWarningSubSections");
118    var $link = $target.siblings('a').first();
119    var isValidLink = $link.length && $link.attr('href').slice(1) === $target.attr('id')
120
121    if (isValidLink) {
122      var showText = $link.text(); // Default init
123      var hideText = config.statusWarningSubSections.expandCollapseLink.message4[LANG];
124      var a11yText = config.statusWarningSubSections.expandCollapseLink.message3[LANG];
125
126      if ($link.hasClass('js-IsRevisedEUPDFOnly')) {
127        showText = config.statusWarningSubSections.expandCollapseLink.message1[LANG];
128      }else{
129        showText = config.statusWarningSubSections.expandCollapseLink.message2[LANG];
130      }
131
132      $link.wrap("<div class='linkContainer'></div>");
133
134      // use as CONFIG the data-* attributes expected on it
135      $link
136        .addClass('expandCollapseLink')
137        .legExpandCollapse([
138          showText + '<span class="accessibleText">' + a11yText + '</span>',
139          hideText + '<span class="accessibleText">' + a11yText + '</span>'
140        ]);
141
142    }
143
144		// if (typeof linkText === 'string') {
145    //   linkText = linkText.trim(); // take out any spurious whitespace
146    //   if ( linkText ) {
147    //     $link.attr('data-'+LANG+'-expand', linkText); // Provided text should override data-* attrib
148    //   }else if ( !linkText && $link.attr('data-'+LANG+'-expand') ) {
149    //     $link.text( $link.attr('data-'+LANG+'-expand') ); // if it can be helped, make sure link text isn't empty by default
150    //   }
151		// }
152
153
154    // $("p.intro:first", "#statusWarning")
155    // .after($("<div/>").addClass("linkContainer"));
156
157		// $("<a/>")
158		// .attr('href', '#statusWarningSubSections')
159		// .appendTo("#statusWarning .title:first .linkContainer")
160		// .addClass("expandCollapseLink")
161		// .legExpandCollapse([config.statusWarning.expandCollapseLink.message1[LANG] + '<span class="accessibleText">' + config.statusWarning.expandCollapseLink.message2[LANG] + '</span>', config.statusWarning.expandCollapseLink.message3[LANG] + '<span class="accessibleText">' + config.statusWarning.expandCollapseLink.message2[LANG] +'</span>']);
162	}
163
164	// Effects to be applied
165	$("<div/>").addClass("linkContainer").appendTo("#statusEffectsAppliedSection .title");
166
167	$("<a/>")
168	.attr('href', '#statusEffectsAppliedContent')
169	.appendTo("#statusEffectsAppliedSection .title .linkContainer")
170	.addClass("expandCollapseLink")
171	.legExpandCollapse([config.statusEffectsAppliedSection.expandCollapseLink.message1[LANG] + '<span class="accessibleText">' + config.statusEffectsAppliedSection.expandCollapseLink.message2[LANG] + '</span>', config.statusEffectsAppliedSection.expandCollapseLink.message3[LANG] + '<span class="accessibleText">' +  config.statusEffectsAppliedSection.expandCollapseLink.message2[LANG] + '</span>']);
172
173	// EU outstanding references
174	$("<a/>")
175		.attr('href', '#outstandingRefsContent')
176		.addClass("expandCollapseLink")
177		.appendTo("#outstandingRefs .title")
178		.legExpandCollapse([
179			config.outstandingRefsContent.expandCollapseLink.show[LANG],
180			config.outstandingRefsContent.expandCollapseLink.hide[LANG]
181		], {
182			open: true
183		});
184
185	$("<a/>")
186		.attr('href', '#outstandingRefs')
187		.insertBefore("#outstandingRefs")
188		.addClass("expandCollapseLink")
189		.legExpandCollapse([config.outstandingRefs.expandCollapseLink.show[LANG], config.outstandingRefs.expandCollapseLink.hide[LANG]]);
190
191	// Changes to be applied
192	$("<div/>").addClass("linkContainer").appendTo("#changesAppliedSection .title");
193
194	$("<a/>")
195	.attr('href', '#changesAppliedContent')
196	.appendTo("#changesAppliedSection .title .linkContainer")
197	.addClass("expandCollapseLink")
198	.legExpandCollapse([config.changesAppliedContent.expandCollapseLink.message1[LANG] + '<span class="accessibleText">' + config.changesAppliedContent.expandCollapseLink.message2[LANG] + '</span>', config.changesAppliedContent.expandCollapseLink.message3[LANG]+  '<span class="accessibleText">' + config.changesAppliedContent.expandCollapseLink.message2[LANG] + '</span>']);
199
200	// Commencement orders to be applied
201	$("<div/>").addClass("linkContainer").appendTo("#commencementAppliedSection .title");
202
203	$("<a/>")
204	.attr('href', '#commencementAppliedContent')
205	.appendTo("#commencementAppliedSection .title .linkContainer")
206	.addClass("expandCollapseLink")
207	.legExpandCollapse([config.commencementAppliedContent.expandCollapseLink.message1[LANG] + '<span class="accessibleText">'+ config.commencementAppliedContent.expandCollapseLink.message2[LANG]+'</span>',  config.commencementAppliedContent.expandCollapseLink.message3[LANG] + '<span class="accessibleText">' + config.commencementAppliedContent.expandCollapseLink.message2[LANG]+ '</span>']);
208});
209
210$(document).ready(function(){
211	// ToC Scripts -----------------------------------------
212	// Create the links that expand/collapse the small trees
213	if (legGlobals.legTocType) {
214
215		// create unique ids for all parts, required for persistance
216		var idCount = 0;
217		$("li.tocDefaultExpanded, li.tocDefaultCollapse").each(function () {
218			 $(this).attr("id", "id" + idCount);
219			 idCount++;
220			 });
221
222		$("<a/>")
223		.attr('href', '#')
224		.addClass("expandCollapseTocLink userFunctionalElement")
225		.prependTo("li.tocDefaultExpanded")
226		.legTocExpandCollapse(legGlobals.tocCookieId, legGlobals.legCookieExpire);
227
228		$("<a/>")
229		.attr('href', '#')
230		.addClass("expandCollapseTocLink userFunctionalElement")
231		.prependTo("li.tocDefaultCollapse")
232		.legTocExpandCollapse(legGlobals.tocCookieId, legGlobals.legCookieExpire);
233
234		// Create the area to hold the expand all/collapse all scripts only if tocControlsAdded.
235		if ($("#tocControlsAdded").length != 0){
236			$('<ul class="tocGlobalControls"><li></li></ul>')
237			.prependTo("div.LegContents");
238
239			/*$("<a/>")
240			.attr('href', '#')
241			.addClass("userFunctionalElement tocCollapseAll")
242			.appendTo(".tocGlobalControls li:first")
243			.html("Collapse all")
244			.click(function(event){
245							event.preventDefault();
246							$("a.expandCollapseTocLink").removeClass("expand").nextAll("ol").hide();
247							});
248
249			*/
250
251			// custom implementation of toggle since it is deprecated
252			$.fn.toggleClick = function () {
253				var functions = arguments;
254		
255				return this.each(function () {
256					var iteration = 0;
257		
258					$(this).on('click', function () {
259						functions[iteration].apply(this, arguments);
260						iteration = (iteration + 1) % functions.length;
261					});
262				});
263			}
264
265			$("<a/>")
266			.attr('href', '#')
267			.addClass("userFunctionalElement tocExpandAll")
268			.appendTo($(".tocGlobalControls li").last())
269			.html(config.links.message1[LANG])
270			.toggleClick(function (event) {
271					$(this).html(config.links.message2[LANG]);
272					event.preventDefault();
273					$("a.expandCollapseTocLink").removeClass("expand").nextAll("ol").hide();
274			},
275				function (event) {
276					$(this).html(config.links.message1[LANG]);
277					event.preventDefault();
278					$("a.expandCollapseTocLink").removeClass("expand").addClass("expand").nextAll("ol").show();
279			});
280		}
281	}
282});
283
284$(document).ready(function(){
285	// Interface control buttons
286	$("a", "#breadcrumbControl").legInterfaceOptions();
287	$(".print a", "#viewPrintControl").legInterfaceOptions();
288});
289
290$(document).ready(function(){
291	// Modal windows for interface controls, only functions on a link if the class 'warning' is present
292	$(".warning", "#printOptions").legModalWin();
293	$(".warning", "#openingOptions").legModalWin();
294});
295
296
297//  $(document).ready(function(){
298//	$(this).showModalDialog();
299//});
300
301$(document).ready(function(){
302	// Slightly different way of adding the links, wrap the <a> element around the <h2> inner HTML
303	var $openingOptionsTitle = $(".title", "#openingOptions")
304    .first()
305    .children("h2");
306	var openingOptionsTitleTxt = $openingOptionsTitle.html();
307	// Reset the inner HTML to nothing as added when open/close link is added
308	$openingOptionsTitle.html("");
309
310	$("<a/>")
311	.attr('href', '#openingOptionsContent')
312	.addClass("expandCollapseLink")
313	.appendTo($openingOptionsTitle)
314	.legExpandCollapse([openingOptionsTitleTxt+'<span class="accessibleText">Expand opening options</span>',openingOptionsTitleTxt+'<span class="accessibleText">Collapse opening options</span>'], {
315		state: legGlobals.expandCollapseState,
316		expires: 5
317	});
318});
319
320// 'PDF Versions' section
321$(document).ready(function(){
322	var pdfVersion = [
323		{
324			title: '#pdfVersions',
325			target: '#pdfVersionsContent',
326			textExpand: 'Expand PDF versions',
327			textCollapse: 'Collapse PDF versions'
328		},
329		{
330			title: '#pdfVersionsSub',
331			target: '#pdfVersionsSubContent',
332			textExpand: 'Expand PDFs from EUR-Lex',
333			textCollapse: 'Collapse PDFs from EUR-Lex'
334		}
335	];
336
337	// Slightly different way of adding the links, wrap the <a> element around the <h2> inner HTML
338	$.each(pdfVersion, function(index, item) {
339		// The assumption here is that the first 'item' (i.e. of index '0') is the only title with a 'h2' element -
340		// the rest (i.e. subtitles) are assumed to be 'h3'
341		var $title = $(".title", item.title)
342		.first()
343		.children(index === 0 ? "h2" : "h3");
344		var titleText = $title.html();
345		// Reset the inner HTML to nothing as added when open/close link is added
346		$title.html("");
347
348		$("<a/>")
349		.attr('href', item.target)
350		.addClass("expandCollapseLink")
351		.appendTo($title)
352		.legExpandCollapse(
353			[
354			titleText+'<span class="accessibleText">'+ item.textExpand+'</span>',
355			titleText+'<span class="accessibleText">'+ item.textCollapse+'</span>'
356			],
357			{
358			state: legGlobals.expandCollapseState,
359			expires: 5
360			});
361	});
362});
363
364// 'dct:alternative' Show/Hide
365$(document).ready(function(){
366	var TITLE, TOGGLER_TEXT_STATUS, $titleToggler, $pageTitle, $fullTitle;
367	$fullTitle = $('.fullTitle').first();
368
369	if ( $fullTitle.length > 0 ) {
370		// ===< Variables init >===
371		$pageTitle = $('.pageTitle').first();
372		$titleToggler = $pageTitle.find('.pageTitleToggleLink');
373		TITLE = {
374			full: $fullTitle.text(),
375			alt: $pageTitle.find('span').text()
376		};
377		TOGGLER_TEXT_STATUS = {
378			full: $titleToggler.text() === "Dangos y teitl llawn" ? "Cuddio’r teitl llawn" :"Hide full title",
379			alt: $titleToggler.text()
380		}
381
382		$pageTitle.attr('data-title-type', 'alt'); // Default
383
384		$titleToggler.on('click', function(e) {
385			togglePageTitle( $pageTitle.attr('data-title-type') );
386			toggleTogglerText( $pageTitle.attr('data-title-type') );
387		});
388	}
389
390
391		function togglePageTitle(currentTitleType) {
392			// Toggle titles
393			if ( currentTitleType === 'alt') {
394				$pageTitle.find('span').text(TITLE.full);
395				$pageTitle.attr('data-title-type', 'full');
396
397			}else {
398				$pageTitle.find('span').text(TITLE.alt);
399				$pageTitle.attr('data-title-type', 'alt');
400			}
401		}
402
403		function toggleTogglerText( currentPageTitleType ) {
404			// Toggle toggler-link text, AFTER THE PAGE TITLE HAS BEEN TOGGLED!
405			$titleToggler.text( TOGGLER_TEXT_STATUS[currentPageTitleType] );
406		}
407});
408
409
410$(document).ready(function(){
411	// Geographical extent show/hide
412	function legGeoExt(){
413		// load the control into a variable for continued use
414		var $chkBox = $("input#geoExt");
415
416		$chkBox.on('click', function(event){
417			$(".LegExtentRestriction").toggle();
418		});
419
420		$chkBox = ""; // release memory from control
421	}
422	legGeoExt(); // initialise function
423});
424
425$(document).ready(function(){
426	// Helpbox popups
427	$("a.helpItemToTop").legHelpBox({horizBoxPos: 'middle', vertiBoxPos: 'top'});
428	$("a.helpItemToBot").legHelpBox({horizBoxPos: 'middle', vertiBoxPos: 'bottom'});
429	$("a.helpItemToMidLeft").legHelpBox({horizBoxPos: 'left', vertiBoxPos: 'middle'});
430	$("a.helpItemToMidRight").legHelpBox({horizBoxPos: 'right',	vertiBoxPos: 'middle'});
431	$("a.helpItemToLeft").legHelpBox({horizBoxPos: 'left',vertiBoxPos: 'top'});
432	$("a.helpItemToRight").legHelpBox({horizBoxPos: 'right',	vertiBoxPos: 'top'});
433	$("a.hover").legHelpBox({horizBoxPos: 'left', vertiBoxPos: 'middle', hover: "yes"});
434});
435
436$(document).ready(function(){
437	// Img replacement
438	$(".userFeedbackImg").imgReplace();
439});
440
441$(document).ready(function(){
442	//Text search matches skip links - only should be added if a match ID exists
443	if ($('#match-1').length) {
444		previousNextTextMatchLinks();
445	}
446});
447
448$(document).ready(function(){
449	if (document.location.hash !== '') {
450		//After a search, use the hash of the document location to add a query to the ToC link
451		$('#legTocLink a').each(function () {
452			$(this).attr('href', $(this).attr('href') + '?' + encodeURI(document.location.hash.substring(1)));
453		});
454		//and preserve the hash through links to other views of the document
455		$('.prevNextNav a').each(function () {
456			$(this).attr('href', $(this).attr('href') + '#' + encodeURIComponent(document.location.hash.substring(1)));
457		});
458		$('#openingOptionsContent a').each(function () {
459			$(this).attr('href', $(this).attr('href') + '#' + encodeURIComponent(document.location.hash.substring(1)));
460		});
461	}
462});
463
464$(document).ready(function () {
465	//PiT form hide/show
466	if($('#PiTselector .text strong').length > 0) {
467        var text = $('#PiTselector .text strong')[0].innerText;
468        $('#PiTselector .text strong').replaceWith(
469            $('<a href="#pitSearch" class="expandCollapseLink"/>')
470                .legExpandCollapse([text + ' <span class="accessibleText">, hide form</span>', text + ' <span class="accessibleText">, show Form</span>'], {
471                    state: legGlobals.expandCollapseState,
472                    expires: 5
473                })
474        );
475    }
476});
477
478// Banners
479//New Site Design Banner
480$(function () {
481	window.legGlobals.addionalJobBanner = function () {
482		var NEW_DESIGN_COOKIE_NAME = 'new_design_banner';
483		var NEW_DESIGN_BANNER_HTML = {
484			en: '<div class="content">' +
485				'<h2>This is our new legislation.gov.uk design</h2>' +
486				'<p>The website has the same content and the same functionality, but an improved design to make it more accessible and easier to use.</p>' +
487				'<p>Find out more about <a href="/new-design#Whywehavechangedthedesign">why we have made these changes</a> and the improvements they bring.</p>' +
488				'<button class="new-site-design-close">Close</button>' +
489				'</div>',
490			cy: '<div class="content">' +
491				'<h2>This is our new legislation.gov.uk design</h2>' +
492				'<p>The website has the same content and the same functionality, but an improved design to make it more accessible and easier to use.</p>' +
493				'<p>Find out more about <a href="/new-design#Whywehavechangedthedesign">why we have made these changes</a> and the improvements they bring.</p>' +
494				'<button class="new-site-design-close">Close</button>' +
495				'</div>'
496		}
497
498		$(NEW_DESIGN_BANNER_HTML[LANG]).simpleBanner({
499			id: 'new-design-banner',
500			closeBtnSelector: '.new-site-design-close',
501			doShow: function () {
502				// By default the banner is shown unless the user has allowed cookies.
503				// Check the cookie to see if the banner has been closed before and hide
504				// if it has.
505				var show = true;
506				var cookie;
507
508				if (window.legGlobals.cookiePolicy.settings) {
509					cookie = $.cookie(NEW_DESIGN_COOKIE_NAME);
510
511					if (cookie && cookie === 'Yes') {
512						show = false;
513					}
514				} else {
515					$.removeCookie(NEW_DESIGN_COOKIE_NAME, { path: '/' });
516				}
517
518				return show;
519			},
520			onClose: function () {
521				if (window.legGlobals.cookiePolicy.settings) {
522					$.cookie(NEW_DESIGN_COOKIE_NAME, 'Yes', { expire: 365, path: '/' });
523				}
524			}
525		});
526	}
527
528});
529
530$(function () {
531
532	var RECRUITMENT_URL = "https://www.civilservicejobs.service.gov.uk/csr/jobs.cgi?jcode=1980615";
533	/*var Job_Message = "If you’d like to join the legislation.gov.uk team, we’re currently recruiting for a Platform Product Manager.";*/
534	var Job_Message = "Would you like to join the legislation.gov.uk team? We’re currently recruiting for a Data Manager.";
535/*
536	var RECRUITMENT_BANNER_HTML = {
537		en: '<div class="bannercontent">' +
538			'<div class="recruit-main">' +
539			'<span class="heading">Join the team</span>' +
540			'<br/>' +
541			'<span>' + Job_Message + '</span>' +
542			'</div>' +
543			'<ul>' +
544			'<li><a href="' + RECRUITMENT_URL + '" target="_blank" class="join">Click here to apply</a></li>' +
545			'<li><a href="#" class="recruitment-close">Close</a></li>' +
546			'</ul>' +
547			'</div>',
548		cy: '<div class="bannercontent">' +
549			'<div class="recruit-main">' +
550			'<span class="heading">Join the team</span>' +
551			'<br/>' +
552			'<span>' + Job_Message + '</span>' +
553			'</div>' +
554			'<ul>' +
555			'<li><a href="' + RECRUITMENT_URL + '" target="_blank" class="join">Click here to apply</a></li>' +
556			'<li><a href="#" class="recruitment-close">Close</a></li>' +
557			'</ul>' +
558			'</div>'
559	};
560
561	var RECRUITMENT_COOKIE_NAME = 'recruitment_banner';
562	$(RECRUITMENT_BANNER_HTML[LANG]).simpleBanner({
563		id: 'recruitment-banner',
564		closeBtnSelector: '.recruitment-close',
565		doShow: function () {
566			// By default the banner is shown unless the user has allowed cookies.
567			// Check the cookie to see if the banner has been closed before and hide
568			// if it has.
569			var show = true;
570			var cookie;
571
572			if (window.legGlobals.cookiePolicy.settings) {
573				cookie = $.cookie(RECRUITMENT_COOKIE_NAME);
574
575				if (cookie && cookie === 'Yes') {
576					show = false;
577				}
578			} else {
579				$.removeCookie(RECRUITMENT_COOKIE_NAME, {path: '/'});
580			}
581
582			return show;
583		},
584		onClose: function () {
585			if (window.legGlobals.cookiePolicy.settings) {
586				$.cookie(RECRUITMENT_COOKIE_NAME, 'Yes', {expire: 20, path: '/'});
587			}
588		}
589	});
590*/
591
592	//var COVID_BANNER_HTML = {
593	//	en: '<div class="bannercontent">' +
594	//		'<h2 class="accessibleText">Coronavirus</h2> ' +
595	//		'<span class="legislation">' +
596	//		'<strong>' +
597	//		'<a href="/coronavirus" class="link">Browse Coronavirus legislation</a>' +
598	//		'</strong>' +
599	//		' on legislation.gov.uk</span>' +
600	//		'<span class="extents">' +
601			
602	//		'Get Coronavirus guidance for the ' +
603	//		'<strong>' +
604	//		'<a href="https://www.gov.uk/coronavirus" class="link" target="_blank">UK</a>, ' +
605	//		'<a href="https://www.gov.scot/coronavirus-covid-19" class="link" target="_blank">Scotland</a>, ' +
606	//		'<a href="https://gov.wales/coronavirus" class="link" target="_blank">Wales</a>, and ' +
607	//		'<a href="https://www.nidirect.gov.uk/campaigns/coronavirus-covid-19" class="link" target="_blank">Northern Ireland</a>' +
608	//		'</strong>' +
609	//		'</span>' +
610	//		'</div>',
611	//	cy: '<div class="bannercontent">' +
612	//		'<h2 class="accessibleText">Coronafeirws</h2> ' +
613	//		'<span class="legislation">' +
614	//		'<strong>' +
615	//		'<a href="/coronavirus" class="link">Pori deddfwriaeth Coronafeirws</a>' +
616	//		'</strong>' +
617	//		' ar ddeddfwriaeth.gov.uk' +
618	//		'</span>' +
619	//		'<span class="extents">' +			 
620	//		' Cael cyngor Coronafeirws ar gyfer y ' +
621	//		'<strong>' +
622	//		'<a href="https://www.gov.uk/coronavirus" class="link" target="_blank">DU</a>, ' +
623	//		'<a href="https://www.gov.scot/coronavirus-covid-19" class="link" target="_blank">Yr Alban</a>, ' +
624	//		'<a href="https://llyw.cymru/coronavirus" class="link" target="_blank">Cymru</a>, a ' +
625	//		'<a href="https://www.nidirect.gov.uk/campaigns/coronavirus-covid-19" class="link" target="_blank">Gogledd Iwerddon</a>' +
626	//		'</strong>' +
627	//		'</span>'+
628	//		'</div>'
629	//}
630
631	// If the coronavirus banner already exists on the page via HTML then do not add the JS version
632	//if (!$('#coronavirus-banner').length) {
633	//	$(COVID_BANNER_HTML[LANG]).simpleBanner({id: 'coronavirus-banner'});
634	//}
635	
636	// New Site Design Banner
637	//window.legGlobals.addNewDesignBanner();
638	// The banners are added *after* the ID '#top' so should be called in the opposite order to how they should appear.
639	// Uncomment to add survey banner
640	//window.legGlobals.addSurvey();
641	
642})
643/*
644(c)  Crown copyright
645
646You may use and re-use this code free of charge under the terms of the Open Government Licence v3.0
647
648http://www.nationalarchives.gov.uk/doc/open-government-licence/version/3
649
650*/
651/**
652 * Legislation Expand and Collapse jQuery plugin.
653 *
654 * Expand and collapse box with the controlling link being created by another function, e.g.:
655 * $(link).legExpandCollapse(['More', 'Close'], {state:, expires: 0});
656 *
657 * Notes:
658 * CSS - position: relative on the expanding element causes problems with IE by rendering all child
659 * elements after the animation, avoid if possible. By using on a child element that element is
660 * rendered before the animation has begun and could look confusing.
661 * CookieArray is an object used to store cookie key value pairs. If it isnt passed, will default to contracted
662 *
663 * @param {array} htmlValues
664 *   Values to use for the HTML text, e.g. ['More', 'Close'].
665 * @param {{state: [], expires: null|number, open: string}} options
666 *   Options for initialisation.
667 * @returns {void | jQuery}
668 *   jQuery chaining/fluent interface.
669 */
670$.fn.legExpandCollapse = function (htmlValues, options) {
671
672    var href = $(this).attr('href');
673    var $this = $(this);
674    var $target = $($this.attr('href'));
675
676    // Set any supplied options
677    var openByDefault = options && options.open !== undefined ? options.open : false;
678    var cookieArray = options && options.state !== undefined ? options.state : {};
679    var expires = options && options.expires !== undefined ? options.expires : 0;
680
681    // We can only persist state if the user has allowed the use of cookies.
682    var useCookies = function () {
683        return window.legGlobals.cookiePolicy.settings && !!cookieArray;
684    }
685
686    // Check to see if any values have been passed to overwrite the defaults
687    var htmlContracted = htmlValues ? htmlValues[0] : 'More';
688    var htmlExpanded = htmlValues ? htmlValues[1] : 'Close';
689
690    if (useCookies()) {
691        readCookie('legExpandCollapse', cookieArray);
692    } else {
693        eraseCookie('legExpandCollapse');
694    }
695
696    // default is to hide the element
697    if (href && useCookies() && (cookieArray[href.substring(1)] === 'show')) {
698        $this.html(htmlExpanded).addClass('close');
699        $target.show();
700    } else if (href && useCookies() && (cookieArray[href.substring(1)] === 'hide')) {
701        $this.html(htmlContracted)
702        $target.hide();
703    } else if (openByDefault) {
704        $this.html(htmlExpanded).addClass('close');
705        $target.show();
706    } else {
707        $this.html(htmlContracted);
708        $target.hide();
709    }
710
711    // Event Handlers
712    return $this.on('click', function (e) {
713        e.preventDefault();
714
715        if (!$this.hasClass('close')) {
716            $target.slideDown(400);
717            $this.html(htmlExpanded).toggleClass('close');
718            if (useCookies()) {
719                updateIdInCookie('legExpandCollapse', cookieArray, href.substring(1), 'show', expires);
720            }
721        } else {
722            $target.slideUp(400);
723            $this.html(htmlContracted).toggleClass('close');
724            if (useCookies()) {
725                updateIdInCookie('legExpandCollapse', cookieArray, href.substring(1), 'hide', expires);
726            }
727        }
728    });
729
730    // ------------------------------
731    // Cookie functions
732    // ------------------------------
733
734    /**
735     * Update the cookie value for item with given ID.
736     *
737     * @param {string} cookieName
738     * @param {object} cookieContents
739     * @param {string} id
740     * @param {string} value
741     * @param {number} cookieExpire
742     */
743    function updateIdInCookie(cookieName, cookieContents, id, value, cookieExpire) {
744        cookieContents[id] = value;
745        updateCookie(cookieName, cookieContents, cookieExpire);
746    }
747
748    /**
749     * Persist data to cookie by serializing object into a string.
750     *
751     * @param {string} cookieName
752     * @param {object} cookieContents
753     * @param {number|null} cookieExpire
754     */
755    function updateCookie(cookieName, cookieContents, cookieExpire) {
756        var contentAsString = '';
757
758        for (var i in cookieContents) {
759            contentAsString += (i + '#' + cookieContents[i] + ';');
760        }
761
762        if (!cookieExpire) {
763            cookieExpire = null;
764        }
765
766        $.cookie(cookieName, contentAsString, {path: '/', expires: cookieExpire});
767    }
768
769    /**
770     * Deserializes the cookie string into an object.
771     *
772     * Cookie string format is id#page;id#page
773     *
774     * @param {string} cookieName
775     * @param {object} cookieContents
776     * @returns {object}
777     */
778    function readCookie(cookieName, cookieContents) {
779        var cookie = $.cookie(cookieName);
780        if (cookie) {
781            var elements = cookie.split(';');
782
783            for (var i = 0; i < elements.length; i++) {
784                if (elements[i] != '') {
785                    var value = elements[i].split('#');
786                    var page = value[0];
787                    var value = value[1];
788                    cookieContents[page] = value;
789                }
790            }
791        }
792
793        return cookieContents;
794    }
795
796    /**
797     * Remove persisted cookie.
798     *
799     * @param {string} cookieName
800     */
801    function eraseCookie(cookieName) {
802        if ($.cookie(cookieName)) {
803            $.removeCookie(cookieName, {path: '/'});
804        }
805    }
806};
807/*
808(c)  Crown copyright
809 
810You may use and re-use this code free of charge under the terms of the Open Government Licence v3.0
811 
812http://www.nationalarchives.gov.uk/doc/open-government-licence/version/3
813
814*/
815/*
816
817Legislation HelpBox
818
819One-liner: Adds floating helpbox when help link clicked
820Requirements: jQuery framework: http://jquery.com/
821helpItem - The link that activated popup
822help - The popup contents
823
824Notes:
825
826
827History:
828v0.01	TE Created
829v0.02	2010-04-27	GE	Modified close link to reference box rather than 'this' hierachy so it will close box in any position
830v0.03	2010-04-27	GE	Added options to position where the box appears
831v0.04 2010-09-16	TE	Added hover functionality
832
833*/
834
835$.fn.legHelpBox = function(helpBoxOptions) {
836		
837	$(this).each(function () {		
838			// retrieve helpbox associated with link
839			var helpbox = $($(this).attr('href'));
840			
841			// Config area
842			var defaults = {
843				horizBoxPos: 'right', 
844				vertiBoxPos: 'top',
845				hover: "no"	
846			}
847			
848			var option = $.extend(defaults, helpBoxOptions); // overwrite defaults if options were passed during init
849			
850			//set initial state			
851			helpbox.css({display: "none", position: "absolute"});
852			
853			$(this).parent().append(helpbox);
853 // fix tab order
854			
855			// enable helpbox images
856			// enable helpbox arrow
857			$(".icon", $(this)).css({
858				display: "block"
859				});
860			
861			if (option.hover == "no")
862				$(".close", helpbox).show();
863			else
864				$(".close", helpbox).css("display", "none");
865			
866			$(".close", helpbox).on('click', function(e) {
867				e.preventDefault(); // disable anchor link
868				helpbox.animate({opacity: "hide"}, "fast");
869			});
870			
871			var popup = function(e){
872								var offset = $(this).position(); // offset from parent element
873								
874								/*
875								-------- Set the position based on the config and add classes to show arrows -----------
876								Use outerWidth() to include padding in measurements as width() does not find this.
877							    Include the link height in calculations to get absolute middle
878							    The calculation order cascades down with the later conditionals taking precedent over the first
879								*/
880								// Set the options for vertically positioned top and bottom boxes
881								(option.horizBoxPos == 'left') ? leftPosition = 0-(helpbox.outerWidth()) : leftPosition = 20;
882								(option.vertiBoxPos == 'top') ?  topShowPosition = 0-(helpbox.outerHeight()+10) : topShowPosition = 15;
883								
884								// Set the options for middle positioned boxes
885								if (option.horizBoxPos == 'middle')
886									leftPosition = 0-(helpbox.outerWidth()/2)+$(this).outerWidth()/2;
887								
888								// Set the options for to the side top positioned boxes
889								if (option.horizBoxPos != 'middle' && option.vertiBoxPos == 'top')
890									topShowPosition = -15;
891									
892								// Set the options for to the side middle positioned boxes
893								if (option.horizBoxPos != 'middle' && option.vertiBoxPos == 'middle')
894									topShowPosition = 0-(helpbox.outerHeight()/2)+$(this).outerHeight()/2;									
895									
896								topHidePosition = 0;
897								
898								addClasses();
899								
900								e.preventDefault(); // disable anchor link		
901								
902								// fix for IE7 - z-index is reset for positioned list elements. Ensures popup's parent has higher z-index than its siblings
903								$(this).parent('li').css('z-index', 5).siblings('li').css('z-index',1);
904								
905								if (helpbox.css("display") == "none")
906								{
907									$(".help").animate({opacity: "hide"}, "fast"); // hide other helpboxes
908									
909									// topShowPosition,topHidePosition & leftPosition from inialisation
910									helpbox.css({left: offset["left"] + leftPosition, top: offset["top"] + topHidePosition} ); //reset position
911									
912									helpbox.animate({opacity: "show", left: offset["left"] + leftPosition, top: offset["top"] + topShowPosition}, "fast", function() {
913												
914																																								   });
915								}
916								else
917								{
918									helpbox.animate({opacity: "hide", left: offset["left"] + leftPosition, top: offset["top"] + topHidePosition}, "fast");
919								}
920			
921					
922				
923				function addClasses() {
924					/* This function decides the class that gets added to the box
925					   Format is helpTo[horizontalPosition][verticalPosition]		   
926					   Usually this is to add an arrow in the right position, add side highlighting, etc.		
927					*/
928					
929					// Use shorter var names for easier reading
930					var opH = option.horizBoxPos;
931					var opV = option.vertiBoxPos
932					
933					if (opH == 'left' && opV =='top'){
934						helpbox.addClass('helpToLeftTop');		
935					} else if (opH == 'left' && opV =='middle') {
936						helpbox.addClass('helpToLeftMid');	
937					} else if (opH == 'left' && opV =='bottom') {
938						helpbox.addClass('helpToLeftBot');	
939					} else if (opH == 'right' && opV =='top') {
940						helpbox.addClass('helpToRightTop');	
941					} else if (opH == 'right' && opV =='middle') {
942						helpbox.addClass('helpToRightMid');	
943					} else if (opH == 'right' && opV =='bottom') {
944						helpbox.addClass('helpToRightBot');	
945					} else if (opH == 'middle' && opV =='top') {
946						helpbox.addClass('helpToMidBot');			
947						// Middle Middle can't exist as it would put it over the link itself
948					} else if (opH == 'middle' && opV =='bottom') {
949						helpbox.addClass('helpToMidTop');	
950					}
951				}
952			};
953			
954			// fade popup in/out on help link click
955			$(this)
956			.on('click', popup);
957			
958			if (option.hover == "yes")
959			{
960				$(this)
961				.on('mouseenter', popup)
962				.on('mouseleave', function () {
963					helpbox.animate({opacity: "hide"}, "fast");
964				});
965			}
966			
967	});
968};
969/*
970(c)  Crown copyright
971 
972You may use and re-use this code free of charge under the terms of the Open Government Licence v3.0
973 
974http://www.nationalarchives.gov.uk/doc/open-government-licence/version/3
975
976*/
977/*
978
979Legislation Img Replace
980
981One-liner: Progressive enhancement image swap
982Usage: html: <a href="#"><img src="basename_default" class="userFeedbackImg"></a>
983		$(".userFeedbackImg").imgReplace();
984		the script looks for all elements with this class in a page and applies the appropriate event listeners
985		and image preloaders.
986Requirements: jQuery framework: http://jquery.com/
987
988History:
989v0.01	2010_21_06	GM	Created
990
991*/
992$.fn.imgReplace = function(){
993	
994	$(this).each(function () {
995		
996		// Load images for preload
997		var defaultImg 	= this.src;
998		var hoverImg 	= this.src.replace("_default","_hover");	
999		var disabledImg = this.src.replace("_default","_disabled");	
1000		//$.preloadImages(defaultImg, hoverImg);
1001		
1002		
1003			// Add event handlers
1004			$(this).on('mouseenter',
1005				function()
1006				 {
1007					 // Only run if the link/img is not disabled
1008					 if(!$(this).parent().hasClass("disabled"))
1009					 	this.src = hoverImg;
1010				 },)
1011				 .on('mouseleave',
1012				 function()
1013				 {
1014						this.src = defaultImg;
1015				 }
1016			);	
1017	});
1018	
1019	// return this to keep chaining alive
1020	return this;
1021};
1022/*
1023(c)  Crown copyright
1024 
1025You may use and re-use this code free of charge under the terms of the Open Government Licence v3.0
1026 
1027http://www.nationalarchives.gov.uk/doc/open-government-licence/version/3
1028
1029*/
1030/*
1031
1032Legislation interface options
1033
1034One-liner: Opens the interface options boxes when the resepective userInterfaceElement is clicked
1035Requirements: jQuery framework: http://jquery.com/
1036
1037Notes:
1038Tab index cannot be improved upon for accessibility without potentially overlaying other UI items
1039such as the 'previous' or 'next' buttons.
1040CSS - the .js class is used to initially hide the boxes within the CSS file, not a JS function. This
1041is to reduce the client processing on loadup.
1042
1043History:
1044v0.01	GM	2010-03-15 Created
1045v0.02	GM	2010-03-24 Changed to overlay and made into a generic plugin rather than code specific function
1046v0.03	GM	2010-03-25 Corrected the 'return' so that chaining works correctly
1047v0.04	GM	2010-04-15 Simplified the 'close link into a function to prevent the duplication of code
1048
1049*/
1050
1051$.fn.legInterfaceOptions = function() {
1052	// Apply to each item in the array
1053	this.each(function () {
1054		// create a jQuery control with the link that was clicked
1055		var legIntControlLink = $(this);
1056		
1057		// retrieve helpbox associated with link as a jQuery obj
1058		var intOption = $($(this).attr('href'));
1059		
1060		// insert via DOM injection above content
1061		$("#content div").first().before($($(intOption))); 			
1062			
1063		// insert close link inside the intOption
1064		$("<a/>")
1065		.attr("href", "#")
1066		.html('<img src="/images/chrome/closeIcon.gif" alt="Close" />')
1067		.addClass("closeLink")
1068		.prependTo(intOption)
1069		.on('click', function(e) {
1070			// event handler to close the intOption box
1071			e.preventDefault();  // disable anchor link
1072			intOption.slideUp(400);
1073			
1074			// Remove all other userFunctionalElement highlighting
1075			removeControlHighlights();
1076		});
1077			
1078		// Open/close the box on click		
1079		return $(this).on('click', function(e){
1080			e.preventDefault(); // disable anchor link	
1081			
1082			// Remove all other userFunctionalElement highlighting
1083			removeControlHighlights();
1084			
1085			// Find all the interface options, this variable is used later
1086			// to find out if all the 'close' animations have finished
1087			var legIntAllOptions = $(".interfaceOptions").length;
1088			
1089			if (intOption.css("display") == "none")
1090			{	
1091				// OPEN the intOption box
1092			
1093				// Create the animation count variable
1094				var legIntOptAnimationCount = 0;
1095								
1096				// hide other interface options
1097				$(".interfaceOptions").slideUp(400, function(){													 
1098					
1099					// Count the closing animations
1100					legIntOptAnimationCount++;
1101					
1102					// once the hiding animation has finished, open up the new option
1103					if (legIntOptAnimationCount === legIntAllOptions){	
1104						// add the class to show that the controlling link has been activated
1105						legIntControlLink.removeClass("close").addClass("close");
1106						intOption.slideDown(400);
1107					}
1108				});	
1109			} else {
1110				// CLOSE the intOption box
1111				intOption.slideUp(400);
1112			}
1113		});
1114	});
1115	
1116	function removeControlHighlights(){
1117			// Remove userFunctionalElement highlighting
1118			$(".interface a").removeClass("close");		
1119	}
1120	
1121	return this;
1122};
1123/*
1124(c)  Crown copyright
1125 
1126You may use and re-use this code free of charge under the terms of the Open Government Licence v3.0
1127 
1128http://www.nationalarchives.gov.uk/doc/open-government-licence/version/3
1129
1130*/
1131/*
1132
1133Legislation Modal Window
1134
1135One-liner: Overlays a div on top of the main content
1136
1137Usage: $(.linkClass).legModalWin()
1138
1139Requirements: 
1140jQuery framework- http://jquery.com/
1141<div id="modalBg"> to be attached to the XHTML document
1142CSS to control z-index for overlays
1143Div acting as modal window to already have been loaded
1144
1145Notes:
1146Parts of this function are taken from 
1147http://www.queness.com/post/77/simple-jquery-modal-window-tutorial
1148The initial link @href needs to contain the id of the modal window that it will initialise for this script to work.
1149
1150History:
1151v0.01	GM	Created
1152v0.02	2010-03-25	GM	Changed to work with adjustments made to layout, now picks up the link href target as the modal window
1153v0.03	Bug fixed: added jQuery chaining ability
1154v0.04	Fixed Google Chrome positioning bug by making W3C window size method the first, jQuery method second
1155
1156*/
1157
1158$.fn.legModalWin = function(options){
1159	// required for chaining, refer to jQuery API for more details
1160	$(this).each(function () {
1161						   
1162		// Create variables and constants for storage, these can be over
1162written in the normal jQuery way
1163		var modalWinJquery_str;
1164		var settings = {  
1165		 type: 'defaultWin',
1166		 fadeLength: 400,  
1167		 bgJqueryStr: '#modalBg',
1168		 closeLinkId_str: '#',
1169		 closeLinkIdJQuery_str: '#',  
1170		 closeLinkTxt: 'Cancel'
1171		};  
1172		var option = $.extend(settings, options);
1173		
1174		if (option.type == 'defaultWin'){			
1175			// The default modal window is a link to a pre-existing disalogue box
1176			modalWinJquery_str = $($(this).attr('href'));
1177			// Create a close this window link and attach to the modal window, along with the event handler
1178			$("<li/>")
1179			.addClass('cancel')
1180			.html('<a href="#" class="userFunctionalElement"><span class="btl"></span><span class="btr"></span>'+option.closeLinkTxt+'<span class="bbl"></span><span class="bbr"></span></a>')
1181			.prependTo(
1182				$(modalWinJquery_str)
1183					.children("div")
1184					.last()
1185					.children("ul")
1186			)
1187			.on('click', function(event){
1188				event.preventDefault();		
1189				closeModWin();	
1190			});
1191			
1192			// Once user clicks continue, the modalwin closes
1193			$("li.continue a", modalWinJquery_str).on('click', closeModWin());
1194		}
1195		else if(option.type=='testingModal'){
1196			modalWinJquery_str = option.parentDiv;
1197			// Create a close this window link and attach to the modal window, along with the event handler
1198			var close= modalWinJquery_str.find('.close')
1199			.on('click', function(event){
1200				event.preventDefault();		
1201				closeModWin();
1202			});
1203			
1204		}
1205		// When the link that opens the modal win is clicked
1206		$(this).on('click', function(event){	
1207				event.preventDefault();	
1208				
1209				//Get the window height and width  
1210				var winH = window.innerHeight; // get W3C val for browsers that can handle it
1211				if (!winH)
1212					winH = $(window).height(); // use jQuery if they can't 
1213				var winW = window.innerWidth;
1214				if (!winW)	
1215					winW = $(window).width();
1216				
1217				// Work out centering of the window and special functions
1218				var topPos, leftPos, height, width;
1219				if (option.type == 'defaultWin'){
1220					// The default option requires minor positioning
1221					topPos  = winH/2-$(modalWinJquery_str).height()/2;
1222					leftPos = winW/2-$(modalWinJquery_str).width()/2;
1223					height  = 'auto'
1224				} 
1225				else {	
1226					// The previewImg type of modal window is a link from a thumbnail or preview image
1227					
1228					// Find the Image URI and create the SRC attribute for iFrame
1229					var modalWinIframeSrc = 'http://www.legislation.gov.uk/tools/displayimage?URL=' + $(this).attr('href');
1230			
1231					// As this <div> isn;t embedded into the XHTML the modal win needs to be created here
1232					$('<div>')
1233					.attr('id', 'previewImgWin')
1234					.addClass('modWin')
1235					.appendTo('#leg')					
1236					
1237					modalWinJquery_str = '#previewImgWin'; // Set this to apply css and event handlers
1238								
1239					// Add the iframe and pass the URi as an argument for the destination HTML to parse
1240					$(modalWinJquery_str)
1241					.html('<iframe src="' + modalWinIframeSrc + '"></iframe>')
1242					.prepend('<a href="#" class="closeLink"><img src="/images/chrome/closeIcon.gif" alt="Close"/></a>')
1243					.prepend('<h2 class="title">Large image view</h2>')
1244					
1245					// If the closelink is pressed, close the window
1246					$('a', modalWinJquery_str)
1247					.on('click', function(e) {
1248					  e.preventDefault();
1249					  closeModWin()
1250					});
1251					
1252					// Set the width and height as large as the viewable window
1253					height  = 0.9 * winH
1254					width   = 0.9 * winW
1255					
1256					// Set the positioning
1257					topPos  = $(window).scrollTop() + (0.0125 * winH);
1258					leftPos = winW/2-width/2;
1259					
1260					// Remove scrollbars from the bg					
1261					$('body').css('overflow', 'hidden');
1262				}
1263				
1264				// Legacy browser detection is no longer avialable since new jquery doesnot suppot $.browser
1265				// // IE6 doesn't support fixed position
1266				// if ($.browser.msie && parseInt($.browser.version) < 7) {
1267				// 	var position = "absolute";
1268				// } else if (option.type == 'previewImg') {
1269				// 	var position = "absolute";
1270				// } else {
1271				// 	var position = "fixed";
1272				// }
1273
1274				const isOldIE = (ua => ua.indexOf('MSIE ') > 0 ? parseInt(ua.substring(ua.indexOf('MSIE ') + 5, ua.indexOf('.', ua.indexOf('MSIE ')))) < 7 : false)(window.navigator.userAgent);
1275				
1276				// IE6 doesn't support fixed position
1277				if (isOldIE) {
1278					var position = "absolute";
1279				} else if (option.type == 'previewImg') {
1280					var position = "absolute";
1281				} else {
1282					var position = "fixed";
1283				}
1284				
1285				// Apply the popup window to center and style elements within
1286				$(modalWinJquery_str).css({'top': topPos, 'position': position, 'height': height, 'width': width, 'left': leftPos}); 
1287				$('iframe', modalWinJquery_str).css({height: '90%', width: '98%'}).hide // used for image option
1288				
1289				// Set the background width to the window width so that there's no
1290				// horizontal nav bars
1291				$(option.bgJqueryStr).css({'width':$(document).width(),'height':$(document).height()});
1292				
1293				// Show animation
1294				$(modalWinJquery_str).show(option.fadeLength);
1295				$(option.bgJqueryStr).fadeTo(option.fadeLength, 0.8).css({'width':$(document).width(),'height':$(document).height()});	
1296				
1297				$('iframe', modalWinJquery_str).fadeIn("slow");
1298
1299				
1300			});
1301		
1302			// Escape key also closes the modalwin
1303			$(document).on('keypress', function(e) {
1304				if (e.keyCode == 27) {
1305					closeModWin()
1306				}
1307			});
1308			
1309			// Close function
1310			function closeModWin() {
1311				if (option.type == 'previewImg') {
1312					$(modalWinJquery_str).remove();
1313					$('body').css('overflow', 'visible');
1314				} else {
1315					$(modalWinJquery_str).hide(option.fadeLength);
1316				}
1317				$(option.bgJqueryStr).fadeOut(option.fadeLength);		
1318			}
1319	});
1320		
1321	
1322	// return this to keep chaining alive
1323	return this;				   
1324};
1325/*
1326(c)  Crown copyright
1327
1328You may use and re-use this code free of charge under the terms of the Open Government Licence v3.0
1329
1330http://www.nationalarchives.gov.uk/doc/open-government-licence/version/3
1331
1332*/
1333/**
1334 * Small banner plugin to add banners to the main site.
1335 *
1336 * Optionally can have onClose() and onClick() handlers passed to allow for c
1336ookie persistence management.
1337 *
1338 * The option.doShow() function should return a boolean value to determine if the banner is shown or not.
1339 *
1340 * @param {[{[id]: string, [closeBtnSelector]: string, [doShow]: function|boolean, [onClose]: function, [onClick]: function}]} options
1341 *   Options for the plugin.
1342 * @returns {[]|jQuery|HTMLElement}
1343 *   jQuery chaining/fluent interface.
1344 */
1345$.fn.simpleBanner = function (options) {
1346
1347    return $(this).each(function () {
1348
1349        var defaultOptions = {
1350            closeBtnSelector: '.banner-close',
1351            doShow: function () {
1352                return true;
1353            }
1354        };
1355
1356        options = options || {};
1357        options = $.extend(defaultOptions, options);
1358
1359        var $banner = $('<div class="banner" />');
1360        var context = this;
1361
1362        if (options.id) {
1363            $banner.attr('id', options.id);
1364        }
1365
1366        $banner.append(this);
1367
1368        if (options.doShow && options.doShow()) {
1369            $('#top').after($banner);
1370        } else {
1371            return;
1372        }
1373
1374        if (options.closeBtnSelector) {
1375
1376            var $button = $banner.find(options.closeBtnSelector);
1377
1378            $button.on('click', function (e) {
1379                e.preventDefault();
1380                options.onClose(e);
1381                context.close();
1382            });
1383        }
1384
1385        if (options.onClick) {
1386            $banner.on('click', function (event) {
1387                options.onClick.call(context, event);
1388            });
1389        }
1390
1391        this.close = function () {
1392            $banner.slideUp(500, function () {
1393                $banner.remove();
1394            });
1395        }
1396    });
1397
1398}
1399/*
1400(c)  Crown copyright
1401
1402You may use and re-use this code free of charge under the terms of the Open Government Licence v3.0
1403
1404http://www.nationalarchives.gov.uk/doc/open-government-licence/version/3
1405
1406*/
1407/**
1408 * Legislation Table of Contents (ToC) Expand and Collapse.
1409 *
1410 * Used to add expand/collapse functionality to a ToC link element (that is created by another process), e.g.:
1411 * $(link).legTocExpandCollapse('pageId', 5);
1412 *
1413 * @param {string} pageId
1414 *   Uniquely identifiable page name.
1415 * @param {number} cookieExpire
1416 *   How long to persist the cookie.
1417 * @returns {jQuery}
1418 *   jQuery chaining/fluent interface.
1419 */
1420$.fn.legTocExpandCollapse = function (pageId, cookieExpire) {
1421
1422    var COOKIE_ID = 'legTocExpandCollapse';
1423    var state = {};
1424    var $this = $(this);
1425    var useCookies = function () {
1426        return window.legGlobals.cookiePolicy.settings;
1427    };
1428
1429    if (useCookies()) {
1430        state = readCookie();
1431    } else {
1432        eraseCookie();
1433    }
1434
1435    // Using this method for inserting text and relying on CSS to show correct attribute as less intensive on DOM.
1436    // The divider is made available in case CSS is disabled.
1437    $this
1438        .html('<span class="tocExpandText">' + config.links.message3[LANG] + '</span>' +
1439            '<span class="tocTextDivider">/</span>' +
1440            '<span class="tocCollapseText">' + config.links.message4[LANG] + '</span>');
1441
1442    // if cookie stored for related id, expand part
1443    $this.each(function () {
1444        var $link = $(this);
1445        var $part = $link.parent();
1446
1447        // if saved and default expanded, collapse. Saved and default collapsed, expand
1448        if (readIdInState($part.attr('id'))) {
1449            if ($part.is('.tocDefaultExpanded')) {
1450                $link.nextAll('ol').slideUp(0);
1451            } else {
1452                $link.addClass('expand');
1453            }
1454        } else {
1455            // default expanded: expand. default collapsed: collapse
1456            if ($part.is('.tocDefaultExpanded')) {
1457                $link.addClass('expand');
1458            } else {
1459                $link.nextAll('ol').slideUp(0);
1460            }
1461        }
1462    });
1463
1464    // toggle between expand and collapse. State appended to cookie if different from default
1465    $this.each(function () {
1466
1467        $(this).on('click', function (e) {
1468            var $link = $(this);
1469
1470            // disable anchor link
1471            e.preventDefault();
1472
1473            var $part = $link.parent();
1474
1475            $link.toggleClass('expand');
1476            $link.nextAll('ol').slideToggle(400).toggleClass('expanded');
1477
1478            if ($part.is('.tocDefaultExpanded') && !$link.is('.expand')) {
1479                updateId($part.attr('id'));
1480            } else if ($part.is('.tocDefaultCollapse') && $link.is('.expand')) {
1481                updateId($part.attr('id'));
1482            } else {
1483                deleteId($part.attr('id'));
1484            }
1485        });
1486    });
1487
1488    /**
1489     * Update the state with the value of the ID.
1490     *
1491     * @param {string} id
1492     */
1493    function updateId(id) {
1494        state[id] = '';
1495
1496        if (useCookies()) {
1497            updateCookie();
1498        }
1499    }
1500
1501    /**
1502     * Delete the ID from the state.
1503     *
1504     * @param {string} id
1505     */
1506    function deleteId(id) {
1507        delete state[id];
1508
1509        if (useCookies()) {
1510            updateCookie();
1511        }
1512    }
1513
1514    // ------------------------------
1515    // Cookie functions
1516    // ------------------------------
1517
1518    /**
1519     * Write state contents to cookie.
1520     */
1521    function updateCookie() {
1522
1523        var cookieContents = pageId + ';';
1524        for (var i in state) {
1525            cookieContents += (i + '#');
1526        }
1527
1528        $.cookie(COOKIE_ID, cookieContents, {path: '/', expires: cookieExpire});
1529    }
1530
1531    /**
1532     * Read and deserialize the cookie values into an object.
1533     *
1534     * @returns {{}}
1535     *   Values by ID key.
1536     */
1537    function readCookie() {
1538        var associative = {};
1539
1540        var name = $.cookie(COOKIE_ID);
1541        if (name) {
1542            var split = name.split(';');
1543
1544            if (split.length > 1 && split[0] === pageId) {
1545                 var values = split[1].split('#');
1546
1547                 for (var i = 0; i < values.length; i++) {
1548                     if (values[i] !== '') {
1549                         associative[values[i]] = '';
1550                     }
1551                 }
1552             }
1553        }
1554
1555        return associative;
1556    }
1557
1558    /**
1559     * Read the value of the passed ID.
1560     *
1561     * @param {string} id
1562     * @returns {*|null}
1563     */
1564    function readIdInState(id) {
1565        return state && state[id] === '';
1566    }
1567
1568    /**
1569     * Delete the cookie used for persistence.
1570     */
1571    function eraseCookie() {
1572        if ($.cookie(COOKIE_ID)) {
1573            $.removeCookie(COOKIE_ID, {path: '/'});
1574        }
1575    }
1576
1577    return $this;
1578};
1579/**
1580 * Injecting images into code to perform server-side analytics in case of GTM failures.
1581 */
1582$(function () {
1583
1584    function isStringRgb(strToCheck) {
1585        return strToCheck[0] === 'r';
1586    }
1587
1588    /**
1589     * Check whether the status update banner is red/green for revised legislation only.
1590     *
1591     * Ignores Points in Time (which are yellow) and as enacted legislation.
1592     */
1593    function checkForChanges() {
1594
1595        var colours = {
1596            'rgb(255, 200, 0)': 'PiT',
1597            'rgb(0, 200, 50)': 'upToDate',
1598            'rgb(240, 0, 100)': 'outstandingChanges'
1599        };
1600
1601        var borderColour = $updateBanner.css('border-color').toLowerCase();
1602
1603        // The browser is giving strange results and therefore is ignored.
1604        if (!isStringRgb(borderColour)) {
1605            return;
1606        }
1607
1608        var status = colours[borderColour];
1609
1610        // End early if the colour does not exist or if a Point in Time
1611        if (!status || status === 'PiT') {
1612            return;
1613        }
1614
1615        // Inject an image depending on status.
1616        var $img = $('<img alt="" />');
1617        $img.attr('src', '/images/analytics/' + status + '.gif');
1618        $img.appendTo('body');
1619
1620    }
1621
1622    var $updateBanner = $('#statusWarning');
1623    if ($updateBanner.length) {
1624        checkForChanges();
1625    }
1626
1627})
1628/*
1629(c)  Crown copyright
1630 
1631You may use and re-use this code free of charge under the terms of the Open Government Licence v3.0
1632 
1633http://www.nationalarchives.gov.uk/doc/open-government-licence/version/3
1634
1635*/
1636function previousNextTextMatchLinks(){
1637		
1638	// Add the skip links
1639	$("#viewLegContents").prepend('<ul id="skipLinks"><li><a href="" id="previous">' + config.viewLegContents.previous[LANG] + '</a></li><li><a href="" id="next">' + config.viewLegContents.next[LANG] + '</a></li></ul>');
1640	
1641	// If the referrer is a text search, add a button back to search
1642	if (document.referrer.match(/^http:\/\/www\.legislation\.gov\.uk\/.*(\?|&)text=.*/)){
1643		$('#skipLinks li').first().after('<li><a href="javascript:history.back()" id="backToSearch">' + config.viewLegContents.backToSearch[LANG] + '</a></li>');
1644	}
1645
1646	
1647	var previousLink = 0;
1648	// Test if anchor is for next/previous links
1649	// var currentLink  = window.location.hash.match(/match-[0-9]*/) ? window.location.hash.split('-')[1] : 1;
1650	var currentLink = 1;
1651
1652	var match = window.location.hash.match(/match-([0-9]+)/);
1653	if (match) {
1654		currentLink = parseInt(match[1], 10);
1655	}			
1656	// Find the number of matches for comparisons
1657	// var lastMatchNum = $('.LegSearchResult').last().attr('id').split('-')[1];
1658	var lastMatchNum = 1;
1659
1660	var $lastMatch = $('.LegSearchResult').last();
1661	if ($lastMatch.length) {
1662		var lastId = $lastMatch.attr('id');
1663
1664		if (lastId && lastId.includes('-')) {
1665			lastMatchNum = parseInt(lastId.split('-')[1], 10);
1666		}
1667	}
1668	// If the next match is higher than the total, reset to the highest
1669	if (currentLink > lastMatchNum) {
1670		currentLink = lastMatchNum;	
1671	}		
1672	var nextLink     = Number(currentLink)+1;
1673	var $nextLink 	 = $('#next');
1674	var $prevLink 	 = $('#previous');		
1675	
1676	// Initialise the next/previous links
1677	setPreviouslink();
1678	setNextLink();
1679	
1680	// Event handlers
1681	$nextLink.on('click', function(e) {	
1682		e.preventDefault();    	
1683		var matchAnchor = $(this).attr('href');
1684		$('html').stop().animate({scrollTop: $(matchAnchor).offset().top}, 500);
1685		
1686		// add limit logic
1687		if (currentLink<lastMatchNum) {
1688			currentLink++;
1689		}
1690		
1691		setPreviouslink();
1692		setNextLink();	
1693	});
1694	
1695	$prevLink.on('click', function(e) {	
1696		e.preventDefault();			
1697		var matchAnchor = $(this).attr('href');
1698		$('html').stop().animate({scrollTop: $(matchAnchor).offset().top}, 500);
1699		
1700		// add limit logic
1701		if (currentLink>1) {
1702			currentLink--;
1703		}
1704		
1705		setPreviouslink();
1706		setNextLink();				
1707	});
1708	
1709	// Private functions
1710	function setPreviouslink(){
1711		previousLink = Number(currentLink) - 1;
1712		
1713		// Check the limits, if there are no previous links, then amend the html
1714		if (previousLink<1) {
1715			$prevLink.html('First match').attr('href', '#match-1');
1716		} else {
1717			$prevLink.html('Previous match').attr('href', '#match-' + previousLink);
1718		}
1719	}
1720	
1721	function setNextLink(){
1722		nextLink = Number(currentLink) + 1;
1723		
1724		// Check the limits, if the nextLink is out of the limit then amend the html
1725		if (nextLink<=lastMatchNum) {
1726			$nextLink.html('Next match').attr('href', '#match-' + nextLink);
1727		} else {
1728			$nextLink.html('Last match').attr('href', '#match-'+lastMatchNum);
1729		}
1730	}
1731};
1732
1733/*
1734(c)  Crown copyright
1735 
1736You may use and re-use this code free of charge under the terms of the Open Government Licence v3.0
1737 
1738http://www.nationalarchives.gov.uk/doc/open-government-licence/version/3
1739
1740*/
1741/*
1742
1743Legislation Modal Window
1744
1745One-liner: Overlays a div on top of the main content containing useful information to be displayed
1746
1747Usage: $(.linkClass).showModalDialog()
1748
1749Requirements: 
1750jQuery framework- http://jquery.com/
1751<div id="modalBg"> to be attached to the XHTML document
1752CSS to control z-index for overlays
1753Div acting as modal window to already have been loaded
1754
1755
1756*/
1757/*$.fn.showModalDialog = function(options) {
1758	
1759		var defaults = {
1760			classes: {
1761				modalWindow: 'modWin',
1762				messageTitle: 'title webWarningTitle',
1763				message: 'content',
1764				messageINterface: 'interface'
1765			},
1766			modalId: 'invitationToSurvey',
1767			titleText: 'Invitiation to survey',
1768			textLine1: 'Thank you for using legislation.gov.uk',
1769			textLine2: 'Can you help us to better understand how users read and interact with legislation by taking our survey? ',
1770			textLine3: 'Survey closes on 22 September 2012.',
1771			debug: false,
1772			continueURL: function() {return '/'}
1773		},
1774		cfg = $.extend(defaults, options),
1775
1776		$modalDialog = $('<div />').addClass(cfg.classes.modalWindow).attr('id', cfg.modalId)
1777		
1778		$('<div />').addClass(cfg.classes.messageTitle)
1779				.append( $('<div /> ').addClass(cfg.classes.message)
1780						.append('<h3>' + cfg.textLine1+ '</h3>')
1781							.append ('<p>' + cfg.textLine2 + '</p>')
1782									.append('<p>' + cfg.textLine3 + '</p>')	)
1783											.append('<div class="interface"><ul><li class="close">	<a class="userFunctionalElement" href="#"><span class="btl"></span>	<span class="btr"></span>Close<span class="bbl"></span>	<span class="bbr"></span></a></li><li class="continue">	<a class="userFunctionalElement" href="http://www.surveygizmo.co.uk/s3/987479/legislation-survey-0812" target="new"><span class="btl"></span>	<span class="btr"></span>Ok<span class="bbl"></span>	<span class="bbr"></span></a></li></ul></div>')
1784												.appendTo($modalDialog);
1785			var homePage= $("body").find("#siteLinks");
1786			if(homePage.length)console.log("home");
1787		 $("#siteLinks").append($modalDialog);
1788
1789
1790		 var parentDiv= $("body").find('#invitationToSurvey');
1791		 
1792		 var continueUrl =window.location.pathname.split('/');
1793		 var welsh =  continueUrl[1];
1794			if($("body").attr('id') != 'error'){
1795			//	if((welsh == 'mwa') || (welsh == 'anaw') || (welsh == 'wsi') || (welsh == 'wdsi'))
1796			//	{
1797			//		if(($("body").find('#layout2').attr('class') == "legToc") && ($("body").find('#layout2').attr('class') != undefined) && ($("body").find('#layout2').attr('class') != '')){
1798						
1799			//			$(this).legModalWinOnce({type: 'testingModal', closeLinkTxt: 'Close', parentDiv: parentDiv});
1800			//		}
1801			//	}
1802			}
1803};
1804*/
1805
1806/*
1807 * Opens the modal window to display a message on page load, this function does not require any click event to trigger itself.
1808 * 
1809 */
1810$.fn.legModalWinOnce = function(options){
1811	// required for chaining, refer to jQuery API for more details
1812
1813						   
1814		// Create variables and constants for storage, these can be over
1814written in the normal jQuery way
1815		var modalWinJquery_str;
1816		var settings = {  
1817		 type: 'defaultWin',
1818		 fadeLength: 400,  
1819		 bgJqueryStr: '#modalBg',
1820		 closeLinkId_str: '#',
1821		 closeLinkIdJQuery_str: '#',  
1822		 closeLinkTxt: 'Cancel'
1823		};  
1824		var option = $.extend(settings, options);
1825		
1826		if (option.type == 'defaultWin'){			
1827			// The default modal window is a link to a pre-existing disalogue box
1828			modalWinJquery_str = $($(this).attr('href'));
1829			// Create a close this window link and attach to the modal window, along with the event handler
1830			$("<li/>")
1831			.addClass('cancel')
1832			.html('<a href="#" class="userFunctionalElement"><span class="btl"></span><span class="btr"></span>'+option.closeLinkTxt+'<span class="bbl"></span><span class="bbr"></span></a>')
1833			.prependTo($(modalWinJquery_str).children("div").last().children("ul"))
1834			.on('click', function(event){
1835				event.preventDefault();		
1836				closeModWin();	
1837			});
1838			
1839			// Once user clicks continue, the modalwin closes
1840			$("li.continue a", modalWinJquery_str).on('click', closeModWin);
1841		}
1842	/*	else if(option.type=='testingModal'){
1843			modalWinJquery_str = option.parentDiv;
1844			// Create a close this window link and attach to the modal window, along with the event handler
1845			var close= modalWinJquery_str.find('.close')
1846			close.click(function(event){
1847				event.preventDefault();		
1848				closeModWin();
1849			});
1850			var survey =modalWinJquery_str.find('.continue a');
1851			survey.click(function(event){
1852				event.preventDefault();	
1853				closeModWin();				
1854				window.open("http://www.surveygizmo.co.uk/s3/987479/legislation-survey-0812");
1855				
1856			});
1857		}
1858		*/
1859		// When the link that opens the modal win is clicked
1860
1861				
1862				//Get the window height and width  
1863				var winH = window.innerHeight; // get W3C val for browsers that can handle it
1864				if (!winH)
1865					winH = $(window).height(); // use jQuery if they can't 
1866				var winW = window.innerWidth;
1867				if (!winW)	
1868					winW = $(window).width();
1869				
1870				// Work out centering of the window and special functions
1871				var topPos, leftPos, height, width;
1872				if (option.type == 'defaultWin'){
1873					// The default option requires minor positioning
1874					topPos  = winH/2-$(modalWinJquery_str).height()/2;
1875					leftPos = winW/2-$(modalWinJquery_str).width()/2;
1876					height  = 'auto'
1877				} else if (option.type == 'testingModal'){
1878					topPos  = winH/2-$(modalWinJquery_str).height()/2;
1879					leftPos = winW/2-$(modalWinJquery_str).width()/2;
1880					height  = 'auto'	
1881				}
1882				
1883				else {	
1884					// The previewImg type of modal window is a link from a thumbnail or preview image
1885					
1886					// Find the Image URI and create the SRC attribute for iFrame
1887					var modalWinIframeSrc = 'http://www.legislation.gov.uk/tools/displayimage?URL=' + $(this).attr('href');
1888			
1889					// As this <div> isn;t embedded into the XHTML the modal win needs to be created here
1890					$('<div>')
1891					.attr('id', 'previewImgWin')
1892					.addClass('modWin')
1893					.appendTo('#leg')					
1894					
1895					modalWinJquery_str = '#previewImgWin'; // Set this to apply css and event handlers
1896								
1897					// Add the iframe and pass the URi as an argument for the destination HTML to parse
1898					$(modalWinJquery_str)
1899					.html('<iframe src="' + modalWinIframeSrc + '"></iframe>')
1900					.prepend('<a href="#" class="closeLink"><img src="/images/chrome/closeIcon.gif" alt="Close"/></a>')
1901					.prepend('<h2 class="title">'+ config.modalwin.title[LANG] + '</h2>')
1902					
1903					// If the closelink is pressed, close the window
1904					$('a', modalWinJquery_str)
1905					.on('click', function(e) {
1906					  e.preventDefault();
1907					  closeModWin()
1908					});
1909					
1910					// Set the width and height as large as the viewable window
1911					height  = 0.9 * winH
1912					width   = 0.9 * winW
1913					
1914					// Set the positioning
1915					topPos  = $(window).scrollTop() + (0.0125 * winH);
1916					leftPos = winW/2-width/2;
1917					
1918					// Remove scrollbars from the bg					
1919					$('body').css('overflow', 'hidden');
1920				}
1921				// Legacy browser detection is no longer avialable since new jquery doesnot suppot $.browser
1922				// // IE6 doesn't support fixed position
1923				// if ($.browser.msie && parseInt($.browser.version) < 7) {
1924				// 	var position = "absolute";
1925				// } else if (option.type == 'previewImg') {
1926				// 	var position = "absolute";
1927				// } else {
1928				// 	var position = "fixed";
1929				// }	
1930				
1931				const isOldIE = (ua => ua.indexOf('MSIE ') > 0 ? parseInt(ua.substring(ua.indexOf('MSIE ') + 5, ua.indexOf('.', ua.indexOf('MSIE ')))) < 7 : false)(window.navigator.userAgent);
1932
1933				// IE6 doesn't support fixed position
1934				if (isOldIE) {
1935					var position = "absolute";
1936				} else if (option.type == 'previewImg') {
1937					var position = "absolute";
1938				} else {
1939					var position = "fixed";
1940				}	
1941				
1942				// Apply the popup window to center and style elements within
1943				$(modalWinJquery_str).css({'top': topPos, 'position': position, 'height': height, 'width': width, 'left': leftPos}); 
1944				$('iframe', modalWinJquery_str).css({height: '90%', width: '98%'}).hide // used for image option
1945				
1946				// Set the background width to the window width so that there's no
1947				// horizontal nav bars
1948				$(option.bgJqueryStr).css({'width':$(document).width(),'height':$(document).height()});
1949				
1950				// Show animation
1951				$(modalWinJquery_str).show(option.fadeLength);
1952				$(option.bgJqueryStr).fadeTo(option.fadeLength, 0.8).css({'width':$(document).width(),'height':$(document).height()});	
1953				
1954				$('iframe', modalWinJquery_str).fadeIn("slow");
1955
1956		
1957			// Escape key also closes the modalwin
1958			$(document).on('keypress', function(e) {
1959				if (e.keyCode == 27) {
1960					closeModWin()
1961				}
1962			});
1963			
1964			// Close function
1965			function closeModWin() {
1966				if (option.type == 'previewImg') {
1967					$(modalWinJquery_str).remove();
1968					$('body').css('overflow', 'visible');
1969				} else {
1970					$(modalWinJquery_str).hide(option.fadeLength);
1971				}
1972				$(option.bgJqueryStr).fadeOut(option.fadeLength);		
1973			}
1974			   
1975};
1976
1977

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.