PageSourceSearch

https://www.rwfmuseum.org.uk/p7amm/p7AMMscripts.js

js rwfmuseum.org.uk collected 2026-10-02 11:30:26 UTC 39,866 bytes, 1,564 lines download raw bytes

1
2/* 
3 ================================================
4 PVII Adaptive Menu Magic scripts
5 Copyright (c) 2017-2021 Project Seven Development
6 www.projectseven.com
7 Version: 1.3.5 -build 31
8 ================================================
9 
10 */
11var p7AMM = {
12	ctl: [],
13	once: false,
14	prf: 'none',
15	defAnim: 1,
16	defDuration: 360,
17	defScrollDuration: 800,
18	ie: false,
19	flex: false,
20	throttle: true,
21	adv: [],
22	downKey: null,
23	frameRate: (1000 / 60)
24};
25function P7_AMMset(){
26	var h, hd, sh = '';
27	if (!document.getElementById) {
28		return;
29	}
30	sh += 'li.amm-root-moved {position:absolute !important;top:-9000px !important;left:-9000px !important;}\n';
31	sh += 'div.p7AMM ul.amm-level-0 {width: 100%;}\n';
32	sh += 'div.p7AMM ul ul {position:absolute;top:0px;left:0px;display:none;margin:0px;}\n';
33	sh += 'div.p7AMM ul ul ul {top:0px;left:0px;margin:0px;}\n';
34	sh += '.p7AMM ul li {list-style-type:none;vertical-align:middle;display:inline-block;position:relative;}\n';
35	sh += '.p7AMM ul ul li {display:block;}\n';
36	sh += '.amm-spcr {width:100%;display:none;background:none !important;}\n';
37	sh += '.p7AMM.amm-fixed {position:fixed !important;top:0;left:0;width:100%;}\n';
38	sh += 'div.p7AMM ul ul li a {white-space: nowrap;}\n';
39	hd = document.head || document.getElementsByTagName('head')[0];
40	h = document.createElement('style');
41	h.type = 'text/css';
42	if (h.styleSheet) {
43		h.styleSheet.cssText = sh;
44	} else {
45		h.appendChild(document.createTextNode(sh));
46	}
47	hd.appendChild(h);
48}
49
50P7_AMMset();
51function P7_AMMbb(){
52	P7_AMMshutAll();
53}
54
55function P7_AMMaddLoad(){
56	if (window.addEventListener) {
57		document.addEventListener("DOMContentLoaded", P7_AMMinit, false);
58		window.addEventListener("load", P7_AMMinit, false);
59		window.addEventListener("unload", P7_AMMbb, false);
60		window.addEventListener("scroll", P7_AMMsync, false);
61		window.addEventListener("resize", P7_AMMrsz, false);
62		document.addEventListener("keydown", P7_AMMkey, false);
63	} else if (window.attachEvent) {
64		window.attachEvent("onload", P7_AMMinit);
65		window.attachEvent("onunload", P7_AMMbb);
66		window.attachEvent("onscroll", P7_AMMsync);
67		document.attachEvent("onkeydown", P7_AMMkey);
68		window.attachEvent("onresize", P7_AMMrsz);
69	}
70}
71
72P7_AMMaddLoad();
73function P7_AMMinit(){
74	var i, j, tB, dT, tU, tD, cN, tA, p, pa, el, tx, ob, wns, dv, cl;
75	if (p7AMM.once) {
76		P7_AMMrsz();
77		return;
78	}
79	p7AMM.once = true;
80	p7AMM.prf = P7_AMMgetCSSPre();
81	p7AMM.ie = P7_AMMgetIEver();
82	p7AMMclk = true;
83	if (window.addEventListener) {
84		document.addEventListener("click", P7_AMMbody, false);
85	} else if (window.attachEvent) {
86		window.attachEvent("click", P7_AMMbody, false);
87	}
88	dT = P7_AMMgetByAttribute('data-amm', 'p7AMM');
89	for (j = 0; j < dT.length; j++) {
90		p7AMM.ctl.push(dT[j]);
91		tB = dT[j];
92		tB.ammOpt = tB.getAttribute('data-amm').split(',');
93		P7_AMMremClass(tB, 'amm-noscript');
94		tB.ammShut = true;
95		tB.style.position = 'relative';
96		tB.style.zIndex = tB.ammOpt[2];
97		if (tB.ammOpt[1] > 1 && p7AMM.prf == 'none') {
98			tB.ammOpt[1] = 1;
99		}
100		tB.ammType = 'horiz';
101		if (tB.ammOpt[14] == 1) {
102			tB.ammType = 'vert';
103		}
104		tB.ammPmode = false;
105		tB.ammTrigs = [];
106		tB.ammSections = [];
107		tB.ammActive = null;
108		tU = tB.getElementsByTagName('UL');
109		tB.ammRoot = tU[0];
110		if (tB.ammOpt[11] == 1) {
111			P7_AMMcurrentMark(tB);
112		}
113		tB.ammRoot.setAttribute('role', 'menubar');
114		if (tB.ammOpt[13] == 1) {
115			dv = document.createElement('div');
116			dv.setAttribute('id', tB.id.replace('_', 'spcr_'));
117			dv.className = tB.className;
118			P7_AMMsetClass(dv, 'amm-spcr');
119			tB.parentNode.insertBefore(dv, tB.nextSibling);
120			tB.ammSpacer = dv;
121			dv.ammMenu = tB;
122			if (!wns) {
123				wns = true;
124				if (window.addEventListener) {
125					window.addEventListener('scroll', P7_AMMfixed, false);
126				} else if (window.attachEvent) {
127					window.attachEvent('onscroll', P7_AMMfixed);
128				}
129			}
130		}
131		tD = document.getElementById(tB.id.replace('_', 'tb_'));
132		if (tD) {
133			tD.ammDiv = tB;
134			tB.ammToolbar = tD;
135			cl = tB.ammRoot.className;
136			if (cl && cl !== '' && cl.indexOf('opened') > -1) {
137				tB.ammRoot.ammState = 'open';
138				tD.ammState = 'open';
139				tB.ammState = 'open';
140			} else {
141				P7_AMMremClass(tB.ammToolbar, 'closed');
142				P7_AMMremClass(tB.ammRoot, 'closed');
143				tB.ammToolbarClosed = true;
144				tB.ammToolbar.ammState = 'closed';
145				tB.ammState = 'closed';
146				tB.ammRoot.ammState = 'closed';
147			}
148			tA = tD.getElementsByTagName('A');
149			if (tA && tA[0]) {
150				tA[0].ammDiv = tB;
151				tA[0].ammToolbar = tD;
152				tA[0].onclick = function(){
153					P7_AMMtoolbar(this.ammDiv.id);
154					return false;
155				};
156			}
157		}
158		tB.ammPriority = [];
159		if (tB.ammType == 'horiz') {
160			tB.ammPmode = true;
161			ob = document.createElement('LI');
162			ob.setAttribute('class', 'amm-more amm-root-moved');
163			ob.ammMoreLink = true;
164			ob.ammMoreItem = ob;
165			el = document.createElement('A');
166			tx = document.createTextNode(tB.getAttribute('data-amm-label'));
167			el.appendChild(tx);
168			el.setAttribute('href', '#');
169			el.setAttribute('class', 'amm-more-trigger amm-trigger');
170			ob.appendChild(el);
171			el = document.createElement('UL');
172			tB.ammRoot.appendChild(ob);
173			tB.ammMoreLI = ob;
174			el = document.createElement('UL');
175			ob.appendChild(el);
176			tB.ammMoreUL = el;
177			cN = tU[0].children;
178			for (i = 0; i < cN.length; i++) {
179				if (!cN[i].ammMoreLink) {
180					p = parseInt(cN[i].getAttribute('data-amm-priority'), 10);
181					p = (p > -1) ? p : 0;
182					pa = [cN[i], p];
183					tB.ammPriority.push(pa);
184					el = cN[i].cloneNode(true);
185					tB.ammMoreUL.appendChild(el);
186					cN[i].ammMoreItem = el;
187				}
188			}
189			tB.ammPriority.sort(function(a, b){
190				return a[1] - b[1];
191			});
192		}
193		P7_AMMinitUL(tB, tU[0], 0);
194		tA = tB.ammRoot.getElementsByTagName('A')[0];
195		tA.tabIndex = 0;
196		tB.ammFocusObj = tA;
197		tB.ammRootLI = tA.parentNode;
198		P7_AMMrsPriority(tB);
199		if (tB.ammOpt[10] == 1) {
200			P7_AMMbindPointer(tB);
201			tB.onmouseout = function(evt){
202				var tg, pp, m = true;
203				evt = (evt) ? evt : event;
204				tg = (evt.toElement) ? evt.toElement : evt.relatedTarget;
205				if (this.ammPointer) {
206					return;
207				}
208				if (P7_AMMmenuMode(this) == 'accordion') {
209					return;
210				}
211				if (tg) {
212					pp = tg;
213					while (pp) {
214						if (pp == this) {
215							m = false;
216							break;
217						}
218						if (pp.nodeName && pp.nodeName == 'BODY') {
219							break;
220						}
221						pp = pp.parentNode;
222					}
223				}
224				if (m) {
225					if (this.ammMouseTimer) {
226						clearTimeout(this.ammMouseTimer);
227					}
228					if (m) {
229						this.ammMouseTimer = setTimeout("P7_AMMshut('" + this.id + "')", 160);
230					}
231				}
232			};
233		}
234		if (tB.ammToolbarClosed) {
235			P7_AMMsetClass(tB.ammToolbar, 'closed');
236			P7_AMMsetClass(tB.ammRoot, 'closed');
237		}
238		if (tB.ammOpt[13] == 1) {
239			P7_AMMfixed();
240		}
241		if (tB.ammDefLink && tB.ammDefLink.ammSTE) {
242			P7_AMMclick(tB.ammDefLink);
243		}
244	}
245}
246
247function P7_AMMinitUL(d, ul, lv){
248	var i, li, tA, su, tH, wH, nlv, el;
249	P7_AMMsetClass(ul, 'amm-level-' + lv);
250	ul.ammLevel = lv;
251	ul.ammDiv = d;
252	ul.ammSubPos = 'right';
253	li = ul.childNodes;
254	wH = window.location.href;
255	wH = wH.replace(window.location.hash, '');
256	for (i = 0; i < li.length; i++) {
257		if (li[i].tagName && li[i].tagName == 'LI') {
258			li[i].ammLevel = lv;
259			tA = li[i].getElementsByTagName('A');
260			if (tA && tA[0]) {
261				tA[0].ammState = 'closed';
262				tA[0].ammDiv = d.id;
263				li[i].ammLink = tA[0];
264				tA[0].setAttribute('role', 'menuitem');
265				li[i].setAttribute('role', 'none');
266				tA[0].tabIndex = -1;
267				li[i].ammVis = true;
268				if (/amm-ste/.test(tA[0].getAttribute('class'))) {
269					tH = tA[0].href;
270					tH = tH.replace(tA[0].hash, '');
271					if (tH == wH) {
272						tA[0].ammSTE = true;
273						el = document.getElementById(tA[0].hash.replace('#', ''));
274						if (el && !el.hmyColumn && tA[0].parentNode.ammLevel === 0) {
275							d.ammTrigs.push(tA[0]);
276							d.ammSections.push(el);
277						}
278					}
279				}
280				tA[0].onclick = function(){
281					return P7_AMMclick(this);
282				};
283				if (d.ammOpt[10] == 1) {
284					tA[0].onmouseover = function(){
285						var tB = document.getElementById(this.ammDiv);
286						if (tB.ammMouseTimer) {
287							clearTimeout(tB.ammMouseTimer);
288						}
289						if (this.ammPointer) {
290							return;
291						}
292						if (P7_AMMmenuMode(tB) == 'accordion') {
293							return;
294						}
295						tB.ammMouseTimer = setTimeout(P7_AMMcreateTMR(this), 160);
296					};
297					P7_AMMbindPointer(tA[0]);
298				}
299				su = li[i].getElementsByTagName('UL');
300				if (su && su[0]) {
301					tA[0].ammSub = su[0];
302					su[0].ammTrigger = tA[0];
303					nlv = lv + 1;
304					tA[0].setAttribute('aria-haspopup', 'true');
305					tA[0].setAttribute('aria-expanded', 'false');
306					su[0].setAttribute('role', 'menu');
307					su[0].setAttribute('aria-label', tA[0].firstChild.textContent);
308					P7_AMMinitUL(d, su[0], nlv);
309				}
310			}
311		}
312	}
313}
314
315function P7_AMMcreateTMR(el){
316	return function(){
317		P7_AMMtrig(el);
318	};
319}
320
321function P7_AMMtrig(a){
322	if (a) {
323		if (a.ammPointer) {
324			return;
325		} else {
326			P7_AMMopen(a);
327		}
328	}
329}
330
331function P7_AMMclick(a){
332	var wH, tB, m = false;
333	wH = window.location.href;
334	if (a.href != wH && a.href != wH + '#') {
335		if (a.href.toLowerCase().indexOf('javascript:') == -1) {
336			m = true;
337		}
338	}
339	if (m && a.ammSub && a.ammState == 'closed') {
340		m = false;
341	}
342	tB = document.getElementById(a.ammDiv);
343	if (a.ammSTE) {
344		if (P7_AMMmenuMode(tB) == 'accordion') {
345			P7_AMMtoolbar(a.ammDiv, 'close');
346		}
347		P7_AMMste(a);
348		m = false;
349	}
350	if (a.ammState == 'closed') {
351		P7_AMMopen(a);
352	} else {
353		P7_AMMclose(a);
354	}
355	return m;
356}
357
358function P7_AMMtoolbar(d, ac){
359	var tB = document.getElementById(d);
360	if (tB && tB.ammToolbar) {
361		if ((ac != 'close' && ac != ' open') || !ac) {
362			ac = (tB.ammState == 'closed') ? 'open' : 'close';
363		}
364		if (ac == 'close') {
365			tB.ammState = 'closed';
366			P7_AMMremClass(tB.ammToolbar, 'opened');
367			P7_AMMsetClass(tB.ammToolbar, 'closed');
368			P7_AMMremClass(tB.ammRoot, 'opened');
369			P7_AMMsetClass(tB.ammRoot, 'closed');
370			if (tB.ammFixedOn) {
371				tB.ammSpacer.style.height = tB.ammToolbar.offsetHeight + 'px';
372			}
373		} else {
374			tB.ammState = 'open';
375			P7_AMMremClass(tB.ammToolbar, 'closed');
376			P7_AMMsetClass(tB.ammToolbar, 'opened');
377			P7_AMMremClass(tB.ammRoot, 'closed');
378			P7_AMMsetClass(tB.ammRoot, 'opened');
379		}
380	}
381	return false;
382}
383
384function P7_AMMopen(a, bp){
385	var op, tB, dur, sD, wn, ws, pL, pR, pB, mT, mL, sc;
386	if (a.ammState == 'open') {
387		return;
388	}
389	tB = document.getElementById(a.ammDiv);
390	op = tB.ammOpt[1];
391	dur = tB.ammOpt[0];
392	if (op > 0 && P7_AMMmenuMode(tB) == 'accordion') {
393		op = 99;
394	}
395	P7_AMMtoggle(a, bp);
396	if (a.ammSub) {
397		sD = a.ammSub;
398		a.ammState = 'open';
399		P7_AMMremClass(a, 'closed');
400		P7_AMMsetClass(a, 'open');
401		tB.ammShut = false;
402		a.setAttribute('aria-expanded', 'true');
403		sD.style.visibility = 'hidden';
404		sD.style.height = 'auto';
405		sD.style.display = 'block';
406		sD.style.overflow = 'visible';
407		mT = parseInt(tB.ammOpt[3], 10);
408		if (tB.ammType == 'horiz' & sD.ammLevel == 1) {
409			mT = 0;
410			mL = 0;
411			mT = a.parentNode.offsetHeight;
412			if (tB.ammOpt[7] == 1) {
413				mL = ((sD.offsetWidth - a.parentNode.offsetWidth) / 2) * -1;
414			} else if (tB.ammOpt[7] == 2) {
415				mL = ((sD.offsetWidth - a.parentNode.offsetWidth)) * -1;
416			}
417			mT += parseInt(tB.ammOpt[8], 10);
418			mL += parseInt(tB.ammOpt[9], 10);
419		} else {
420			if (tB.ammOpt[5] == 1) {
421				mL = (sD.offsetWidth * -1) - parseInt(tB.ammOpt[4], 10);
422				sD.ammSubPos = 'left';
423			} else {
424				mL = a.parentNode.offsetWidth + parseInt(tB.ammOpt[4], 10);
425				sD.ammSubPos = 'right';
426			}
427		}
428		if (tB.ammOpt[6] > 0) {
429			ws = P7_AMMgetWinScroll();
430			wn = P7_AMMgetWinDims();
431			var vL, vR, pT;
432			pL = mL + a.parentNode.getBoundingClientRect().left + ws[1];
433			pR = pL + sD.offsetWidth;
434			if (tB.ammType == 'horiz' && tB.ammOpt[6] == 2) {
435				vL = tB.getBoundingClientRect().left + ws[1];
436				vR = vL + tB.offsetWidth;
437				if (pR > vR) {
438					if (sD.ammLevel == 1) {
439						mL = mL - (pR - vR);
440					} else {
441						mL = (sD.offsetWidth * -1) - tB.ammOpt[4];
442						sD.ammSubPos = 'left';
443					}
444				}
445				if (pL < vL) {
446					if (sD.ammLevel == 1) {
447						mL = mL + (vL - pL);
448					} else {
449						mL = a.parentNode.offsetWidth + parseInt(tB.ammOpt[4], 10);
450						sD.ammSubPos = 'right';
451					}
452				}
453				pL = mL + a.parentNode.getBoundingClientRect().left + ws[1];
454				pR = pL + sD.offsetWidth;
455				if (pR > vR) {
456					mL = mL - (pR - vR);
457				}
458			}
459			pL = mL + a.parentNode.getBoundingClientRect().left + ws[1];
460			pR = pL + sD.offsetWidth;
461			vL = ws[1];
462			vR = wn[1];
463			if (pR > vR) {
464				if (tB.ammType == 'horiz' && sD.ammLevel == 1) {
465					mL = mL - (pR - vR);
466				} else {
467					mL = (sD.offsetWidth * -1) - tB.ammOpt[4];
468					sD.ammSubPos = 'left';
469				}
470			}
471			pL = mL + a.parentNode.getBoundingClientRect().left + ws[1];
472			if (pL < vL) {
473				if (tB.ammType == 'horiz' && sD.ammLevel == 1) {
474					mL = mL + (vL - pL);
475				} else {
476					mL = a.parentNode.offsetWidth + parseInt(tB.ammOpt[4], 10);
477					sD.ammSubPos = 'right';
478				}
479			}
480			pL = mL + a.parentNode.getBoundingClientRect().left + ws[1];
481			pR = pL + sD.offsetWidth;
482			if (pR > vR) {
483				mL = mL - (pR - vR);
484			}
485			pB = mT + a.parentNode.getBoundingClientRect().top + sD.offsetHeight;
486			if (pB > wn[0]) {
487				mT = mT - (pB - wn[0] + 2);
488			}
489			pT = mT + a.parentNode.getBoundingClientRect().top;
490			if (pT < 0) {
491				mT = (a.parentNode.getBoundingClientRect().top * -1) + 2;
492			}
493		}
494		sD.style.marginTop = mT + 'px';
495		sD.style.marginLeft = mL + 'px';
496		if (op == 1) {
497			sD.style.visibility = 'hidden';
498			sD.style.display = 'block';
499			P7_AMMfade(sD, 2, 100, dur, 'linear');
500		} else if (op == 2 || op == 3) {
501			sD.style.overflow = 'hidden';
502			sD.style.opacity = (op == 3) ? 0 : 1;
503			if (sD.ammLevel == 1) {
504				sD.style.clip = 'rect(0px auto 0px 0px)';
505			} else {
506				if (sD.ammSubPos == 'right') {
507					sD.style.clip = 'rect(0px 0px auto 0px)';
508				} else {
509					sD.style.clip = 'rect(0px auto auto ' + sD.offsetWidth + 'px)';
510				}
511			}
512			sD.offsetWidth = sD.offsetWidth;
513			sD.style.visibility = 'visible';
514			sD.style[p7AMM.prf + 'transition'] = 'clip ' + dur + 'ms ease, opacity ' + dur + 'ms ease';
515			if (sD.ammLevel == 1) {
516				sD.style.clip = 'rect(0px auto ' + sD.offsetHeight + 'px 0px)';
517			} else {
518				if (sD.ammSubPos == 'right') {
519					sD.style.clip = 'rect(0px ' + sD.offsetWidth + 'px auto 0px)';
520				} else {
521					sD.style.clip = 'rect(0px auto auto 0px)';
522				}
523			}
524			sD.style.opacity = 1;
525			sD.ammAnimC = setTimeout(function(){
526				P7_AMMfinAnim(sD, 'open');
527			}, dur);
528		} else if (op == 4 || op == 5 || op == 6) {
529			sD.style.opacity = 0;
530			sc = '0,0';
531			if (op == 5) {
532				sc = '0,1';
533			} else if (op == 6) {
534				sc = '1,0';
535			}
536			sD.style[p7AMM.prf + 'transform'] = 'scale(' + sc + ')';
537			sD.offsetWidth = sD.offsetWidth;
538			sD.style.display = 'block';
539			sD.style.visibility = 'visible';
540			sD.style[p7AMM.prf + 'transition'] = p7AMM.prf + 'transform ' + dur + 'ms ease, opacity ' + dur + 'ms ease';
541			sD.style[p7AMM.prf + 'transform'] = 'scale(1,1)';
542			sD.style.opacity = 1;
543			sD.ammAnimC = setTimeout(function(){
544				P7_AMMfinAnim(sD, 'open');
545			}, dur);
546		} else if (op == 99) {
547			sD.style.overflow = 'hidden';
548			P7_AMManimate(sD, 'height', 'px', 0, sD.offsetHeight, dur, 'quad', function(){
549				this.style.height = 'auto';
550				this.style.overflow = 'visible';
551			});
552		} else {
553			sD.style.visibility = 'visible';
554			sD.style.display = 'block';
555		}
556	}
557}
558
559function P7_AMMfinAnim(ul, ac){
560	var st = ul.ammTrigger.ammState;
561	if ((ac == 'open' && st == 'open') || (ac == 'closed' && st == 'closed')) {
562		ul.style.overflow = 'visible';
563		ul.style[p7AMM.prf + 'transition'] = null;
564		ul.style[p7AMM.prf + 'transform'] = 'none';
565		ul.style.clip = 'auto';
566		if (ac == 'closed') {
567			ul.style.display = 'none';
568			ul.style.opacity = 1;
569		}
570	}
571}
572
573function P7_AMMclose(a, bp){
574	var op, tB, sD, dur, sc;
575	if (a.ammState == 'closed') {
576		return;
577	}
578	tB = document.getElementById(a.ammDiv);
579	op = tB.ammOpt[1];
580	dur = tB.ammOpt[0];
581	if (op > 0 && P7_AMMmenuMode(tB) == 'accordion') {
582		op = 99;
583	}
584	if (bp == 1) {
585		op = 0;
586	}
587	if (a.ammSub) {
588		sD = a.ammSub;
589		a.ammState = 'closed';
590		P7_AMMremClass(a, 'open');
591		P7_AMMsetClass(a, 'closed');
592		a.setAttribute('aria-expanded', 'false');
593		if (op == 1) {
594			P7_AMMfade(sD, 100, 0, dur, 'linear', function(){
595				this.style.display = 'none';
596				if (this.filters) {
597					this.style.filter = 'alpha(opacity=100)';
598				} else {
599					this.style.opacity = 1;
600				}
601			});
602		} else if (op == 2 || op == 3) {
603			if (op == 2) {
604				sD.style.overflow = 'hidden';
605				if (sD.ammLevel == 1) {
606					sD.style.clip = 'rect(0px auto ' + sD.offsetHeight + 'px 0px)';
607				} else {
608					if (sD.ammSubPos == 'right') {
609						sD.style.clip = 'rect(0px ' + sD.offsetWidth + 'px auto 0px)';
610					} else {
611						sD.style.clip = 'rect(0px auto auto 0px)';
612					}
613				}
614			} else {
615				dur = dur * 1.6;
616			}
617			sD.offsetWidth = sD.offsetWidth;
618			sD.style[p7AMM.prf + 'transition'] = 'clip ' + dur + 'ms ease, opacity ' + dur + 'ms ease';
619			if (op == 2) {
620				if (sD.ammLevel == 1) {
621					sD.style.clip = 'rect(0px auto 0px 0px)';
622				} else {
623					if (sD.ammSubPos == 'right') {
624						sD.style.clip = 'rect(0px 0px auto 0px)';
625					} else {
626						sD.style.clip = 'rect(0px auto auto ' + sD.offsetWidth + 'px)';
627					}
628				}
629			}
630			sD.style.opacity = 0;
631			sD.ammAnimC = setTimeout(function(){
632				P7_AMMfinAnim(sD, 'closed');
633			}, dur);
634		} else if (op == 4 || op == 5 || op == 6) {
635			sD.style.opacity = 1;
636			sD.style[p7AMM.prf + 'transform'] = 'scale(1,1)';
637			sD.offsetWidth = sD.offsetWidth;
638			sD.style[p7AMM.prf + 'transition'] = p7AMM.prf + 'transform ' + dur + 'ms ease, opacity ' + dur + 'ms ease';
639			sc = '0,0';
640			if (op == 5) {
641				sc = '0,1';
642			} else if (op == 6) {
643				sc = '1,0';
644			}
645			sD.style[p7AMM.prf + 'transform'] = 'scale(' + sc + ')';
646			sD.style.opacity = 0;
647			sD.ammAnimC = setTimeout(function(){
648				P7_AMMfinAnim(sD, 'closed');
649			}, dur);
650		} else if (op == 99) {
651			sD.style.overflow = 'hidden';
652			P7_AMManimate(sD, 'height', 'px', sD.offsetHeight, 0, dur, 'quad', function(){
653				this.style.display = 'none';
654			});
655		} else {
656			sD.style.display = 'none';
657		}
658	}
659}
660
661function P7_AMMtoggle(a, bp){
662	var i, pp, tU;
663	pp = a.parentNode;
664	while (pp) {
665		if (pp.tagName && pp.tagName == 'UL') {
666			break;
667		}
668		pp = pp.parentNode;
669	}
670	tU = pp.getElementsByTagName('UL');
671	if (tU && tU.length > 0) {
672		for (i = tU.length - 1; i > -1; i--) {
673			if (tU[i].ammTrigger && tU[i].ammTrigger.ammState == 'open') {
674				if (bp == 1 || (!bp && tU[i].ammTrigger != a)) {
675					P7_AMMclose(tU[i].ammTrigger);
676				}
677			}
678		}
679	}
680}
681
682function P7_AMMshut(d, bp){
683	var i, tB, tU;
684	if (d) {
685		tB = document.getElementById(d);
686		if (tB && !tB.ammShut && tB.ammRoot) {
687			tU = tB.ammRoot.getElementsByTagName('UL');
688			tB.ammShut = true;
689			if (tU && tU.length > 0) {
690				tB.ammFocusObj.tabIndex = -1;
691				tB.ammFocusObj = P7_AMMgetMenuItem(tB.ammRoot, null, 'first');
692				tB.ammFocusObj.tabIndex = 0;
693				for (i = tU.length - 1; i > -1; i--) {
694					if (tU[i].ammTrigger && tU[i].ammTrigger.ammState == 'open') {
695						P7_AMMclose(tU[i].ammTrigger, bp);
696					}
697				}
698			}
699		}
700	}
701}
702
703function P7_AMMshutAll(bp){
704	var i, tB;
705	for (i = 0; i < p7AMM.ctl.length; i++) {
706		tB = p7AMM.ctl[i];
707		if (tB && (!bp || bp != tB.id)) {
708			P7_AMMshut(tB.id);
709		}
710	}
711}
712
713function P7_AMMbody(evt){
714	evt = (evt) ? evt : event;
715	var m = true, pp = (evt.fromElement) ? evt.fromElement : evt.target;
716	while (pp) {
717		if (pp && pp.id && typeof(pp.id) == 'string' && pp.id.indexOf('p7AMM') === 0) {
718			m = false;
719			break;
720		}
721		if (pp && pp.tagName && (pp.tagName == 'BODY' || pp.tagName == 'HTML')) {
722			break;
723		}
724		pp = pp.parentNode;
725	}
726	if (m) {
727		P7_AMMshutAll();
728	}
729}
730
731function P7_AMMfixed(){
732	var i, tB;
733	if (p7AMM.ctl && p7AMM.ctl.length) {
734		for (i = 0; i < p7AMM.ctl.length; i++) {
735			tB = p7AMM.ctl[i];
736			if (tB && tB.ammSpacer) {
737				if (!tB.ammFixedOn && parseInt(tB.getBoundingClientRect().top, 10) < 0) {
738					tB.ammSpacer.style.height = tB.offsetHeight + 'px';
739					tB.ammSpacer.style.display = 'block';
740					P7_AMMsetClass(tB, 'amm-fixed');
741					tB.ammFixedOn = true;
742					P7_AMMrsz();
743				} else if (tB.ammFixedOn && parseInt(tB.ammSpacer.getBoundingClientRect().top, 10) >= 0) {
744					tB.ammSpacer.style.display = 'none';
745					P7_AMMremClass(tB, 'amm-fixed');
746					tB.ammFixedOn = false;
747					P7_AMMrsz();
748				}
749			}
750		}
751	}
752}
753
754function P7_AMManimate(ob, prop, un, fv, tv, dur, typ, cb){
755	if (ob.p7AnimRunning) {
756		ob.p7AnimRunning = false;
757		clearInterval(ob.p7AMManim);
758	}
759	typ = (!typ) ? 'quad' : typ;
760	ob.p7animType = typ;
761	ob.p7animProp = prop;
762	ob.p7animUnit = un;
763	ob.p7animStartVal = fv;
764	ob.p7animCurrentVal = ob.p7animStartVal;
765	ob.p7animFinishVal = tv;
766	ob.style[ob.p7animProp] = ob.p7animCurrentVal + ob.p7animUnit;
767	ob.style.visibility = 'visible';
768	ob.p7animStartTime = P7_AMMgetTime(0);
769	ob.p7animDuration = dur;
770	if (!ob.p7AnimRunning) {
771		ob.p7AnimRunning = true;
772		ob.p7AMManim = setInterval(function(){
773			P7_AMManimator(ob, cb);
774		}, p7AMM.frameRate);
775	}
776}
777
778function P7_AMManimator(el, cb){
779	var et, nv, m = false;
780	et = P7_AMMgetTime(el.p7animStartTime);
781	if (et >= el.p7animDuration) {
782		et = el.p7animDuration;
783		m = true;
784	}
785	if (el.p7animCurrentVal != el.p7animFinishVal) {
786		nv = P7_AMManim(el.p7animType, et, el.p7animStartVal, el.p7animFinishVal - el.p7animStartVal, el.p7animDuration);
787		el.p7animCurrentVal = nv;
788		el.style[el.p7animProp] = nv + el.p7animUnit;
789	}
790	if (m) {
791		el.p7AnimRunning = false;
792		clearInterval(el.p7AMManim);
793		if (cb && typeof(cb) === "function") {
794			cb.call(el);
795		}
796	}
797}
798
799function P7_AMMste(a){
800	var el, h, tb, st, t, tf, bD, sb, se, r;
801	bD = document.body;
802	if (typeof(a) == 'string') {
803		h = a;
804	} else {
805		h = a.hash;
806		if (!h || h === '') {
807			return false;
808		} else {
809			h = h.replace('#', '');
810		}
811	}
812	el = document.getElementById(h);
813	if (!el) {
814		return false;
815	}
816	bD.p7AnimRunning = false;
817	sb = document.body.scrollTop;
818	se = document.documentElement.scrollTop;
819	if (sb.p7STEanim) {
820		sb.p7AnimRunning = false;
821		clearInterval(sb.p7STEanim);
822	}
823	if (se.p7STEanim) {
824		se.p7AnimRunning = false;
825		clearInterval(se.p7STEanim);
826	}
827	st = sb;
828	if (se > sb) {
829		st = se;
830	}
831	t = st + el.getBoundingClientRect().top + 1;
832	tf = parseInt(a.getAttribute('data-top-offset'), 10);
833	if (tf && tf !== '') {
834		t -= tf;
835	}
836	tf = a.getAttribute('data-top-offset-id');
837	if (tf && tf !== '') {
838		tb = document.getElementById(tf);
839		if (tb) {
840			t -= tb.offsetHeight;
841		}
842	}
843	if (p7AMM.defAnim == 1) {
844		bD.p7animType = 'cubic';
845		bD.p7animStartVal = st;
846		bD.p7animCurrentVal = bD.p7animStartVal;
847		bD.p7animFinishVal = t;
848		bD.p7animStartTime = P7_AMMgetTime(0);
849		bD.p7animDuration = p7AMM.defScrollDuration;
850		if (el.hmyScrollDiv) {
851			r = Math.abs(bD.p7animFinishVal - bD.p7animStartVal);
852			if (r < 50) {
853				bD.p7animDuration = 10;
854			}
855		}
856		if (!bD.p7AnimRunning) {
857			bD.p7AnimRunning = true;
858			bD.p7STEanim = setInterval(function(){
859				P7_AMMsteA(bD, el);
860			}, p7AMM.frameRate);
861		}
862	} else {
863		bD.body.scrollTop = t;
864		document.documentElement.scrollTop = t;
865		if (typeof(P7_STTrsz) == 'function') {
866			P7_STTrsz();
867		}
868	}
869	return false;
870}
871
872function P7_AMMsteA(el, sd){
873	var et, nv, m = false;
874	et = P7_AMMgetTime(el.p7animStartTime);
875	if (et >= el.p7animDuration) {
876		et = el.p7animDuration;
877		m = true;
878	}
879	if (el.p7animCurrentVal != el.p7animFinishVal) {
880		nv = P7_AMManim(el.p7animType, et, el.p7animStartVal, el.p7animFinishVal - el.p7animStartVal, el.p7animDuration);
881		el.p7animCurrentVal = nv;
882		el.scrollTop = nv;
883		document.documentElement.scrollTop = nv;
884	}
885	if (m) {
886		el.p7AnimRunning = false;
887		clearInterval(el.p7STEanim);
888		if (typeof(P7_STTrsz) == 'function') {
889			P7_STTrsz();
890		}
891		if (sd.hmyScrollDiv && sd.hmyColumn) {
892			P7_HMYsteH(sd);
893		}
894	}
895}
896
897function P7_AMMgetTime(st){
898	var d = new Date();
899	return d.getTime() - st;
900}
901
902function P7_AMManim(tp, t, b, c, d){
903	if (tp == 'quad') {
904		return -c * (t /= d) * (t - 2) + b;
905	} else if (tp == 'cubic') {
906		return c * ((t = t / d - 1) * t * t + 1) + b;
907	} else {
908		return (c * (t / d)) + b;
909	}
910}
911
912function P7_AMMfade(ob, from, to, dur, typ, cb){
913	if (ob.p7FadeRunning) {
914		clearInterval(ob.p7Fade);
915		ob.p7FadeRunning = false;
916	}
917	typ = (!typ) ? 'quad' : typ;
918	ob.p7fadeType = typ;
919	ob.p7StartFade = from;
920	ob.p7FinishFade = to;
921	ob.p7CurrentFade = ob.p7StartFade;
922	if (ob.filters) {
923		ob.style.filter = 'alpha(opacity=' + ob.p7CurrentFade + ')';
924	} else {
925		ob.style.opacity = ob.p7CurrentFade / 100;
926	}
927	ob.style.visibility = 'visible';
928	ob.fadeStartTime = P7_AMMgetTime(0);
929	ob.fadeDuration = dur;
930	ob.p7FadeRunning = true;
931	ob.p7Fade = setInterval(function(){
932		P7_AMMfader(ob, cb);
933	}, p7AMM.frameRate);
934}
935
936function P7_AMMfader(el, cb){
937	var op, et, m = false;
938	et = P7_AMMgetTime(el.fadeStartTime);
939	if (et >= el.fadeDuration) {
940		et = el.fadeDuration;
941		m = true;
942	}
943	if (el.p7CurrentFade != el.p7FinishFade) {
944		op = P7_AMManim(el.p7fadeType, et, el.p7StartFade, el.p7FinishFade - el.p7StartFade, el.fadeDuration);
945		el.p7CurrentFade = op;
946		if (el.filters) {
947			el.style.filter = 'alpha(opacity=' + el.p7CurrentFade + ')';
948		} else {
949			el.style.opacity = el.p7CurrentFade / 100;
950		}
951	}
952	if (m) {
953		el.p7FadeRunning = false;
954		clearInterval(el.p7Fade);
955		if (cb && typeof(cb) === "function") {
956			cb.call(el);
957		}
958	}
959}
960
961function P7_AMMrsz(){
962	var i, tB;
963	for (i = 0; i < p7AMM.ctl.length; i++) {
964		tB = p7AMM.ctl[i];
965		if (P7_AMMmenuMode(tB) != 'accordion') {
966			P7_AMMshut(tB.id, 1);
967		}
968		if (tB.ammPmode) {
969			P7_AMMrsPriority(tB);
970		}
971	}
972}
973
974function P7_AMMsync(){
975	if (p7AMM.throttle) {
976		p7AMM.throttle = false;
977		P7_AMMsyncA();
978		setTimeout(function(){
979			p7AMM.throttle = true;
980		}, 50);
981	}
982}
983
984function P7_AMMsyncA(){
985	var i, j, tB, wh, br, x = -1, n = -100, cl = 'amm-active';
986	wh = window.innerHeight || document.documentElement.clientHeight || document.body.clientHeight;
987	for (j = 0; j < p7AMM.ctl.length; j++) {
988		tB = p7AMM.ctl[j];
989		if (tB.ammOpt[15] == 1) {
990			if (tB.ammSections && tB.ammSections.length > 0) {
991				for (i = 0; i < tB.ammSections.length; i++) {
992					br = tB.ammSections[i].getBoundingClientRect();
993					if (br.top <= wh && (br.top >= n || br.bottom > 0)) {
994						x = i;
995					}
996					if (br.top > 0 && br.bottom < (wh + 100)) {
997						x = i;
998						break;
999					}
1000					n = (br.top > n) ? br.top : n;
1001				}
1002				if (tB.ammActive) {
1003					P7_AMMremClass(tB.ammActive, cl);
1004				}
1005				if (x > -1) {
1006					tB.ammActive = tB.ammTrigs[x];
1007					P7_AMMsetClass(tB.ammActive, cl);
1008				}
1009			}
1010		}
1011	}
1012}
1013
1014function P7_AMMrsPriority(tB){
1015	var i, w, rw, mv, n, ls, cN, md, k, pw, mw, lw;
1016	if (!tB.ammPmode) {
1017		return;
1018	}
1019	w = 0;
1020	rw = tB.ammRoot.getBoundingClientRect().width;
1021	rw -= 4;
1022	mw = tB.ammMoreLI.getBoundingClientRect().width;
1023	mv = false;
1024	md = P7_AMMmenuMode(tB);
1025	k = -1;
1026	pw = 0;
1027	for (i = 0; i < tB.ammPriority.length; i++) {
1028		if (tB.ammPriority[i][0].ammMoreItem.ammLink) {
1029			lw = tB.ammPriority[i][0].getBoundingClientRect().width;
1030			pw = pw + w + lw;
1031			if (pw > rw) {
1032				k = i;
1033				pw = pw - lw + mw;
1034				break;
1035			}
1036		}
1037	}
1038	if (pw > rw) {
1039		k--;
1040		for (i = k; i > -1; i--) {
1041			lw = tB.ammPriority[i][0].getBoundingClientRect().width;
1042			pw -= lw;
1043			if (pw <= rw) {
1044				k = i;
1045				break;
1046			}
1047		}
1048	}
1049	for (i = 0; i < tB.ammPriority.length; i++) {
1050		if (tB.ammPriority[i][0].ammMoreItem.ammLink) {
1051			P7_AMMremClass(tB.ammPriority[i][0].ammMoreItem.ammLink, 'amm-first');
1052			P7_AMMremClass(tB.ammPriority[i][0].ammMoreItem.ammLink, 'amm-last');
1053			if (md !== 'accordion' && k > -1 && i >= k) {
1054				mv = true;
1055				P7_AMMsetClass(tB.ammPriority[i][0], 'amm-root-moved');
1056				tB.ammPriority[i][0].ammVis = false;
1057				tB.ammPriority[i][0].ammMoreItem.style.display = 'block';
1058				tB.ammPriority[i][0].ammMoreItem.ammShow = true;
1059				tB.ammPriority[i][0].ammMoreItem.ammVis = true;
1060				ls = tB.ammPriority[i][0].ammMoreItem;
1061			} else {
1062				P7_AMMremClass(tB.ammPriority[i][0], 'amm-root-moved');
1063				tB.ammPriority[i][0].ammVis = true;
1064				tB.ammPriority[i][0].ammMoreItem.ammShow = false;
1065				tB.ammPriority[i][0].ammMoreItem.style.display = 'none';
1066				tB.ammPriority[i][0].ammMoreItem.ammVis = false;
1067			}
1068		}
1069	}
1070	cN = tB.ammMoreUL.children;
1071	n = 0;
1072	for (i = 0; i < cN.length; i++) {
1073		if (cN[i].ammShow) {
1074			n++;
1075			if (n == 1) {
1076				P7_AMMsetClass(cN[i].ammLink, 'amm-first');
1077			}
1078			ls = cN[i].ammLink;
1079		}
1080	}
1081	if (n > 0) {
1082		P7_AMMsetClass(ls, 'amm-last');
1083	}
1084	if (mv) {
1085		P7_AMMremClass(tB.ammMoreLI, 'amm-root-moved');
1086		tB.ammMoreLI.ammMoreItem.ammShow = false;
1087		tB.ammMoreLI.ammVis = true;
1088	} else {
1089		P7_AMMsetClass(tB.ammMoreLI, 'amm-root-moved');
1090		tB.ammMoreLI.ammMoreItem.ammShow = true;
1091		tB.ammMoreLI.ammVis = false;
1092	}
1093}
1094
1095function P7_AMMbindPointer(el){
1096	if (typeof el.ontouchstart !== 'undefined') {
1097		el.addEventListener('touchstart', P7_AMMsetPointer, false);
1098	} else if (navigator.maxTouchPoints) {
1099		el.addEventListener('pointerdown', P7_AMMsetPointer, false);
1100		el.addEventListener('mouseover', P7_AMMsetPointer, false);
1101		el.addEventListener('pointerout', P7_AMMsetPointer, false);
1102		el.addEventListener('mouseout', P7_AMMsetPointer, false);
1103	} else if (navigator.msMaxTouchPoints) {
1104		el.addEventListener('MSPointerDown', P7_AMMsetPointer, false);
1105		el.addEventListener('mouseover', P7_AMMsetPointer, false);
1106		el.addEventListener('MSPointerOut', P7_AMMsetPointer, false);
1107		el.addEventListener('mouseout', P7_AMMsetPointer, false);
1108	}
1109}
1110
1111function P7_AMMsetPointer(evt){
1112	if (evt.pointerType) {
1113		if (evt.MSPOINTER_TYPE_TOUCH || evt.pointerType == 'touch') {
1114			this.ammPointer = true;
1115		} else if (evt.MSPOINTER_TYPE_PEN || evt.pointerType == 'pen') {
1116			this.ammPointer = true;
1117		} else {
1118			this.ammPointer = false;
1119		}
1120	} else if (this.ontouchstart !== undefined) {
1121		this.ammPointer = true;
1122	}
1123}
1124
1125function P7_AMMkey(evt){
1126	var tg, ac = '';
1127	evt = (evt) ? evt : event;
1128	tg = (evt.target) ? evt.target : evt.srcElement;
1129	if (tg.ammDiv) {
1130		if (!evt.altKey && !evt.ctrlKey) {
1131			switch (evt.keyCode) {
1132				case 13:
1133					if (tg.ammSub) {
1134						ac = 'RETURN';
1135					}
1136					break;
1137				case 27:
1138					ac = 'ESC';
1139					break;
1140				case 32:
1141					if (tg.ammSub) {
1142					}
1143					break;
1144				case 33:
1145					ac = 'PAGEUP';
1146					break;
1147				case 34:
1148					ac = 'PAGEDOWN';
1149					break;
1150				case 35:
1151					ac = 'END';
1152					break;
1153				case 36:
1154					ac = 'HOME';
1155					break;
1156				case 37:
1157					ac = 'LEFT';
1158					break;
1159				case 38:
1160					ac = 'UP';
1161					break;
1162				case 39:
1163					ac = 'RIGHT';
1164					break;
1165				case 40:
1166					ac = 'DOWN';
1167					break;
1168			}
1169			if (ac !== '') {
1170				P7_AMMsetFocus(tg, ac);
1171				if (evt.preventDefault) {
1172					evt.stopPropagation();
1173					evt.preventDefault();
1174				} else {
1175					evt.returnValue = false;
1176				}
1177			}
1178		}
1179	}
1180}
1181
1182function P7_AMMsetFocus(a, ac){
1183	var tB, li, ob, ul, mt;
1184	tB = document.getElementById(a.ammDiv);
1185	li = a.parentNode;
1186	if (tB.ammType == 'vert') {
1187		mt = 'vert';
1188	} else {
1189		mt = 'horiz';
1190	}
1191	tB.ammFocusObj.tabIndex = -1;
1192	if (ac == 'SPACE' || ac == 'ENTER') {
1193		if (a.ammSub) {
1194			P7_AMMopen(a);
1195			tB.ammFocusObj = P7_AMMgetMenuItem(a.ammSub, a, 'first');
1196		} else {
1197		}
1198	} else if (ac == 'ESC') {
1199		if (li.ammLevel !== 0) {
1200			tB.ammFocusObj = li.parentNode.ammTrigger;
1201			P7_AMMclose(tB.ammFocusObj);
1202		}
1203	} else if (ac == 'RIGHT') {
1204		if (li.ammLevel === 0 && tB.ammType == 'horiz') {
1205			if (a.ammSub) {
1206				P7_AMMclose(a);
1207			}
1208			if (tB.ammFocusObj == P7_AMMgetMenuItem(tB.ammRoot, a, 'last')) {
1209				tB.ammFocusObj = P7_AMMgetMenuItem(tB.ammRoot, a, 'first');
1210			} else {
1211				tB.ammFocusObj = P7_AMMgetMenuItem(tB.ammRoot, a, 'next');
1212			}
1213		} else {
1214			if (a.ammSub) {
1215				P7_AMMopen(a);
1216				tB.ammFocusObj = P7_AMMgetMenuItem(a.ammSub, a, 'first');
1217			} else {
1218				ob = a.parentNode.parentNode.ammTrigger;
1219				P7_AMMclose(ob);
1220				ul = ob.parentNode.parentNode;
1221				if (ob == P7_AMMgetMenuItem(ul, ob, 'last')) {
1222					tB.ammFocusObj = P7_AMMgetMenuItem(ul, ob, 'first');
1223				} else {
1224					tB.ammFocusObj = P7_AMMgetMenuItem(ul, ob, 'next');
1225				}
1226				if (tB.ammFocusObj.ammSub) {
1227					P7_AMMopen(tB.ammFocusObj);
1228				}
1229			}
1230		}
1231	} else if (ac == 'LEFT') {
1232		if (li.ammLevel === 0 && tB.ammType == 'horiz') {
1233			if (a.ammSub) {
1234				P7_AMMclose(a);
1235			}
1236			if (tB.ammFocusObj == P7_AMMgetMenuItem(tB.ammRoot, a, 'first')) {
1237				tB.ammFocusObj = P7_AMMgetMenuItem(tB.ammRoot, a, 'last');
1238			} else {
1239				tB.ammFocusObj = P7_AMMgetMenuItem(tB.ammRoot, a, 'prev');
1240			}
1241		} else {
1242			ob = a.parentNode.parentNode.ammTrigger;
1243			P7_AMMclose(ob);
1244			ul = ob.parentNode.parentNode;
1245			if (ob == P7_AMMgetMenuItem(ul, ob, 'first')) {
1246				tB.ammFocusObj = P7_AMMgetMenuItem(ul, ob, 'last');
1247			} else {
1248				tB.ammFocusObj = P7_AMMgetMenuItem(ul, ob, 'prev');
1249			}
1250			if (tB.ammFocusObj.ammSub) {
1251				P7_AMMopen(tB.ammFocusObj);
1252			}
1253		}
1254	} else if (ac == 'DOWN') {
1255		if (li.ammLevel === 0 && tB.ammType == 'horiz') {
1256			if (a.ammSub) {
1257				P7_AMMopen(a);
1258				tB.ammFocusObj = P7_AMMgetMenuItem(a.ammSub, a, 'first');
1259			}
1260		} else {
1261			ul = a.parentNode.parentNode;
1262			ob = ul.ammTrigger;
1263			P7_AMMclose(a);
1264			if (tB.ammFocusObj == P7_AMMgetMenuItem(ul, a, 'last')) {
1265				tB.ammFocusObj = P7_AMMgetMenuItem(ul, a, 'first');
1266			} else {
1267				tB.ammFocusObj = P7_AMMgetMenuItem(ul, a, 'next');
1268			}
1269		}
1270	} else if (ac == 'UP') {
1271		if (li.ammLevel === 0 && tB.ammType == 'horiz') {
1272			if (a.ammSub) {
1273				P7_AMMopen(a);
1274				tB.ammFocusObj = P7_AMMgetMenuItem(a.ammSub, a, 'last');
1275			}
1276		} else {
1277			ul = a.parentNode.parentNode;
1278			ob = ul.ammTrigger;
1279			P7_AMMclose(a);
1280			if (tB.ammFocusObj == P7_AMMgetMenuItem(ul, a, 'first')) {
1281				tB.ammFocusObj = P7_AMMgetMenuItem(ul, a, 'last');
1282			} else {
1283				tB.ammFocusObj = P7_AMMgetMenuItem(ul, a, 'prev');
1284			}
1285		}
1286	} else if (ac == 'HOME' || ac == 'PAGEUP') {
1287		if (li.ammLevel === 0) {
1288			P7_AMMshut(tB.id);
1289			tB.ammFocusObj = P7_AMMgetMenuItem(tB.ammRoot, a, 'first');
1290		} else {
1291			ul = a.parentNode.parentNode;
1292			ob = ul.ammTrigger;
1293			tB.ammFocusObj = P7_AMMgetMenuItem(ul, a, 'first');
1294			if (a.ammSub) {
1295				P7_AMMclose(a);
1296			}
1297		}
1298	} else if (ac == 'END' || ac == 'PAGEDOWN') {
1299		if (li.ammLevel === 0) {
1300			P7_AMMshut(tB.id);
1301			tB.ammFocusObj = P7_AMMgetMenuItem(tB.ammRoot, a, 'last');
1302		} else {
1303			ul = a.parentNode.parentNode;
1304			ob = ul.ammTrigger;
1305			tB.ammFocusObj = P7_AMMgetMenuItem(ul, a, 'last');
1306			if (a.ammSub) {
1307				P7_AMMclose(a);
1308			}
1309		}
1310	}
1311	tB.ammFocusObj.tabIndex = 0;
1312	tB.ammFocusObj.focus();
1313}
1314
1315function P7_AMMgetMenuItem(ul, a, md){
1316	var newNode, cN, li;
1317	cN = ul.children;
1318	if (md == 'first') {
1319		li = P7_AMMgetNextVis(ul.firstElementChild, 'next');
1320	} else if (md == 'next') {
1321		li = P7_AMMgetNextVis(a.parentNode.nextElementSibling, 'next');
1322	} else if (md == 'last') {
1323		li = P7_AMMgetNextVis(ul.lastElementChild, 'prev');
1324	} else if (md == 'prev') {
1325		li = P7_AMMgetNextVis(a.parentNode.previousElementSibling, 'prev');
1326	}
1327	if (!li) {
1328		li = ul.ammDiv.ammFocusObj.parentNode;
1329	}
1330	newNode = li.ammLink;
1331	return newNode;
1332}
1333
1334function P7_AMMgetNextVis(el, ac){
1335	if (!el.ammVis) {
1336		while (el && !el.ammVis) {
1337			if (ac == 'next') {
1338				el = el.nextElementSibling;
1339			} else {
1340				el = el.previousElementSibling;
1341			}
1342		}
1343	}
1344	return el;
1345}
1346
1347function P7_AMMmark(){
1348	p7AMM.adv.push(arguments);
1349}
1350
1351function P7_AMMcurrentMark(el){
1352	var j, wH, mt = ['', 1, '', ''], op, r1, k, kk, tA, aU, pp, a, x, cm;
1353	wH = window.location.href;
1354	if (el.ammOpt[12] != 1) {
1355		wH = wH.replace(window.location.search, '');
1356	}
1357	if (wH.charAt(wH.length - 1) == '#') {
1358		wH = wH.substring(0, wH.length - 1);
1359	}
1360	for (k = 0; k < p7AMM.adv.length; k++) {
1361		if (p7AMM.adv[k][0] && p7AMM.adv[k][0] == el.id) {
1362			mt = p7AMM.adv[k];
1363			cm = true;
1364			break;
1365		}
1366	}
1367	op = mt[1];
1368	if (op < 1) {
1369		return;
1370	}
1371	r1 = /index\.[\S]*/i;
1372	k = -1;
1373	kk = -1;
1374	tA = el.getElementsByTagName('A');
1375	for (j = 0; j < tA.length; j++) {
1376		aU = tA[j].href.replace(r1, '');
1377		if (op > 0) {
1378			if (tA[j].href == wH || aU == wH) {
1379				k = j;
1380				kk = -1;
1381			}
1382		}
1383		if (op == 2) {
1384			if (tA[j].firstChild) {
1385				if (tA[j].firstChild.nodeValue == mt[2]) {
1386					kk = j;
1387				}
1388			}
1389		}
1390		if (op == 3 && tA[j].href.indexOf(mt[2]) > -1) {
1391			kk = j;
1392		}
1393		if (op == 4) {
1394			for (x = 2; x < mt.length; x += 2) {
1395				if (wH.indexOf(mt[x]) > -1) {
1396					if (tA[j].firstChild && tA[j].firstChild.nodeValue) {
1397						if (tA[j].firstChild.nodeValue == mt[x + 1]) {
1398							kk = j;
1399						}
1400					}
1401				}
1402			}
1403		}
1404	}
1405	k = (kk > k) ? kk : k;
1406	if (k > -1) {
1407		el.ammDefLink = tA[k];
1408		if (tA[k].ammSTE && !tA[k].ammSub) {
1409			P7_AMMclick(tA[k]);
1410		}
1411		pp = tA[k].parentNode;
1412		while (pp) {
1413			if (pp.tagName && pp.tagName == 'LI') {
1414				P7_AMMsetClass(pp, 'current_mark');
1415				a = pp.getElementsByTagName('A');
1416				if (a && a[0]) {
1417					P7_AMMsetClass(a[0], 'current_mark');
1418				}
1419			} else {
1420				if (pp == el) {
1421					break;
1422				}
1423			}
1424			pp = pp.parentNode;
1425		}
1426	}
1427}
1428
1429function P7_AMMgetByAttribute(att, cls){
1430	var i, nL = [], aT, rS = [], cl;
1431	if (document.querySelectorAll) {
1432		nL = document.querySelectorAll('*[' + att + ']');
1433	} else {
1434		if (typeof(document.getElementsByClassName) != 'function') {
1435			aT = document.getElementsByTagName('DIV');
1436			for (i = 0; i < aT.length; i++) {
1437				cl = aT[i].className;
1438				if (cl && cl.indexOf(cls) > -1) {
1439					rS[rS.length] = aT[i];
1440				}
1441			}
1442		} else {
1443			rS = document.getElementsByClassName(cls);
1444		}
1445		for (i = 0; i < rS.length; i++) {
1446			if (rS[i].getAttribute(att)) {
1447				nL[nL.length] = rS[i];
1448			}
1449		}
1450	}
1451	return nL;
1452}
1453
1454function P7_AMMgetCSSPre(){
1455	var i, dV, pre = ['animationDuration', 'WebkitAnimationDuration'];
1456	var c = 'none', cssPre = ['', '-webkit-'];
1457	dV = document.createElement('div');
1458	for (i = 0; i < pre.length; i++) {
1459		if (dV.style[pre[i]] !== undefined) {
1460			c = cssPre[i];
1461			break;
1462		}
1463	}
1464	return c;
1465}
1466
1467function P7_AMMsetClass(ob, cl){
1468	if (ob) {
1469		var cc, nc, r = /\s+/g;
1470		cc = ob.className;
1471		nc = cl;
1472		if (cc && cc.length > 0) {
1473			if (cc.indexOf(cl) == -1) {
1474				nc = cc + ' ' + cl;
1475			} else {
1476				nc = cc;
1477			}
1478		}
1479		nc = nc.replace(r, ' ');
1480		ob.className = nc;
1481	}
1482}
1483
1484function P7_AMMremClass(ob, cl){
1485	if (ob) {
1486		var cc, nc;
1487		cc = ob.className;
1488		cl = cl.replace('-', '\-');
1489		var re = new RegExp('\\b' + cl + '\\b');
1490		if (re.test(cc)) {
1491			nc = cc.replace(re, '');
1492			nc = nc.replace(/\s+/g, ' ');
1493			nc = nc.replace(/\s$/, '');
1494			nc = nc.replace(/^\s/, '');
1495			ob.className = nc;
1496		}
1497	}
1498}
1499
1500function P7_AMMgetStyle(el, s){
1501	if (el.currentStyle) {
1502		s = el.currentStyle[s];
1503	} else if (document.defaultView && document.defaultView.getComputedStyle) {
1504		s = document.defaultView.getComputedStyle(el, "")[s];
1505	} else {
1506		s = el.style[s];
1507	}
1508	return s;
1509}
1510
1511function P7_AMMgetIEver(){
1512	var j, k, v = -1, nv;
1513	nv = navigator.userAgent.toLowerCase();
1514	j = nv.indexOf("msie");
1515	if (j > -1) {
1516		v = parseFloat(nv.substring(j + 4, j + 8));
1517		if (document.documentMode) {
1518			v = document.documentMode;
1519		}
1520		p7AMM.ie = v;
1521	}
1522	j = nv.indexOf('trident/');
1523	if (j > 0) {
1524		k = nv.indexOf('rv:');
1525		if (k && k > 0) {
1526			v = parseInt(nv.substring(k + 3, nv.indexOf('.', k)), 10);
1527		}
1528		p7AMM.ie = v;
1529	}
1530	return v;
1531}
1532
1533function P7_AMMgetWinDims(){
1534	var h, w;
1535	if (document.documentElement && document.documentElement.clientHeight) {
1536		w = document.documentElement.clientWidth;
1537		h = document.documentElement.clientHeight;
1538	} else if (window.innerHeight) {
1539		if (document.documentElement.clientWidth) {
1540			w = document.documentElement.clientWidth;
1541		} else {
1542			w = window.innerWidth;
1543		}
1544		h = window.innerHeight;
1545	} else if (document.body) {
1546		w = document.body.clientWidth;
1547		h = document.body.clientHeight;
1548	}
1549	return [h, w];
1550}
1551
1552function P7_AMMgetWinScroll(){
1553	var t = document.body.parentNode.scrollTop || document.body.scrollTop || window.scrollY || 0;
1554	var l = document.body.parentNode.scrollLeft || document.body.scrollLeft || window.scrollX || 0;
1555	return [t, l];
1556}
1557
1558function P7_AMMmenuMode(el){
1559	var mode = 'normal';
1560	if (P7_AMMgetStyle(el.ammRootLI, 'max-height') == '700777px') {
1561		mode = 'accordion';
1562	}
1563	return mode;
1564}

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.