PageSourceSearch

https://www.weizmann.ac.il/wsos/sites/feinberg/files/js/js_U1ACOIrblTmoe8HucnHCsI2x497KjJvFjBi-pA2uUbk.js

js weizmann.ac.il collected 2026-10-01 07:32:55 UTC 78,968 bytes, 2,506 lines download raw bytes

vendor: 3,321 bytes, lines 1-158
1/*!
2	Colorbox 1.6.4
3	license: MIT
4	http://www.jacklmoore.com/colorbox
5*/
6(function ($, document, window) {
7	var
8	// Default settings object.
9	// See http://jacklmoore.com/colorbox for details.
10	defaults = {
11		// data sources
12		html: false,
13		photo: false,
14		iframe: false,
15		inline: false,
16
17		// behavior and appearance
18		transition: "elastic",
19		speed: 300,
20		fadeOut: 300,
21		width: false,
22		initialWidth: "600",
23		innerWidth: false,
24		maxWidth: false,
25		height: false,
26		initialHeight: "450",
27		innerHeight: false,
28		maxHeight: false,
29		scalePhotos: true,
30		scrolling: true,
31		opacity: 0.9,
32		preloading: true,
33		className: false,
34		overlayClose: true,
35		escKey: true,
36		arrowKey: true,
37		top: false,
38		bottom: false,
39		left: false,
40		right: false,
41		fixed: false,
42		data: undefined,
43		closeButton: true,
44		fastIframe: true,
45		open: false,
46		reposition: true,
47		loop: true,
48		slideshow: false,
49		slideshowAuto: true,
50		slideshowSpeed: 2500,
51		slideshowStart: "start slideshow",
52		slideshowStop: "stop slideshow",
53		photoRegex: /\.(gif|png|jp(e|g|eg)|bmp|ico|webp|jxr|svg)((#|\?).*)?$/i,
54
55		// alternate image paths for high-res displays
56		retinaImage: false,
57		retinaUrl: false,
58		retinaSuffix: '@2x.$1',
59
60		// internationalization
61		current: "image {current} of {total}",
62		previous: "previous",
63		next: "next",
64		close: "close",
65		xhrError: "This content failed to load.",
66		imgError: "This image failed to load.",
67
68		// accessbility
69		returnFocus: true,
70		trapFocus: true,
71
72		// callbacks
73		onOpen: false,
74		onLoad: false,
75		onComplete: false,
76		onCleanup: false,
77		onClosed: false,
78
79		rel: function() {
80			return this.rel;
81		},
82		href: function() {
83			// using this.href would give the absolute url, when the href may have been inteded as a selector (e.g. '#container')
84			return $(this).attr('href');
85		},
86		title: function() {
87			return this.title;
88		},
89		createImg: function() {
90			var img = new Image();
91			var attrs = $(this).data('cbox-img-attrs');
92
93			if (typeof attrs === 'object') {
94				$.each(attrs, function(key, val){
95					img[key] = val;
96				});
97			}
98
99			return img;
100		},
101		createIframe: function() {
102			var iframe = document.createElement('iframe');
103			var attrs = $(this).data('cbox-iframe-attrs');
104
105			if (typeof attrs === 'object') {
106				$.each(attrs, function(key, val){
107					iframe[key] = val;
108				});
109			}
110
111			if ('frameBorder' in iframe) {
112				iframe.frameBorder = 0;
113			}
114			if ('allowTransparency' in iframe) {
115				iframe.allowTransparency = "true";
116			}
117			iframe.name = (new Date()).getTime(); // give the iframe a unique name to prevent caching
118			iframe.allowFullscreen = true;
119
120			return iframe;
121		}
122	},
123
124	// Abstracting the HTML and event identifiers for easy rebranding
125	colorbox = 'colorbox',
126	prefix = 'cbox',
127	boxElement = prefix + 'Element',
128
129	// Events
130	event_open = prefix + '_open',
131	event_load = prefix + '_load',
132	event_complete = prefix + '_complete',
133	event_cleanup = prefix + '_cleanup',
134	event_closed = prefix + '_closed',
135	event_purge = prefix + '_purge',
136
137	// Cached jQuery Object Variables
138	$overlay,
139	$box,
140	$wrap,
141	$content,
142	$topBorder,
143	$leftBorder,
144	$rightBorder,
145	$bottomBorder,
146	$related,
147	$window,
148	$loaded,
149	$loadingBay,
150	$loadingOverlay,
151	$title,
152	$current,
153	$slideshow,
154	$next,
155	$prev,
156	$close,
157	$groupControls,
158	$events = $('<a/>'), // $({}) would be prefer
vendor: 22,638 bytes, lines 158-985
158red, but there is an issue with jQuery 1.4.2
159
160	// Variables for cached values or use across multiple functions
161	settings,
162	interfaceHeight,
163	interfaceWidth,
164	loadedHeight,
165	loadedWidth,
166	index,
167	photo,
168	open,
169	active,
170	closing,
171	loadingTimer,
172	publicMethod,
173	div = "div",
174	requests = 0,
175	previousCSS = {},
176	init;
177
178	// ****************
179	// HELPER FUNCTIONS
180	// ****************
181
182	// Convenience function for creating new jQuery objects
183	function $tag(tag, id, css) {
184		var element = document.createElement(tag);
185
186		if (id) {
187			element.id = prefix + id;
188		}
189
190		if (css) {
191			element.style.cssText = css;
192		}
193
194		return $(element);
195	}
196
197	// Get the window height using innerHeight when available to avoid an issue with iOS
198	// http://bugs.jquery.com/ticket/6724
199	function winheight() {
200		return window.innerHeight ? window.innerHeight : $(window).height();
201	}
202
203	function Settings(element, options) {
204		if (options !== Object(options)) {
205			options = {};
206		}
207
208		this.cache = {};
209		this.el = element;
210
211		this.value = function(key) {
212			var dataAttr;
213
214			if (this.cache[key] === undefined) {
215				dataAttr = $(this.el).attr('data-cbox-'+key);
216
217				if (dataAttr !== undefined) {
218					this.cache[key] = dataAttr;
219				} else if (options[key] !== undefined) {
220					this.cache[key] = options[key];
221				} else if (defaults[key] !== undefined) {
222					this.cache[key] = defaults[key];
223				}
224			}
225
226			return this.cache[key];
227		};
228
229		this.get = function(key) {
230			var value = this.value(key);
231			return $.isFunction(value) ? value.call(this.el, this) : value;
232		};
233	}
234
235	// Determine the next and previous members in a group.
236	function getIndex(increment) {
237		var
238		max = $related.length,
239		newIndex = (index + increment) % max;
240
241		return (newIndex < 0) ? max + newIndex : newIndex;
242	}
243
244	// Convert '%' and 'px' values to integers
245	function setSize(size, dimension) {
246		return Math.round((/%/.test(size) ? ((dimension === 'x' ? $window.width() : winheight()) / 100) : 1) * parseInt(size, 10));
247	}
248
249	// Checks an href to see if it is a photo.
250	// There is a force photo option (photo: true) for hrefs that cannot be matched by the regex.
251	function isImage(settings, url) {
252		return settings.get('photo') || settings.get('photoRegex').test(url);
253	}
254
255	function retinaUrl(settings, url) {
256		return settings.get('retinaUrl') && window.devicePixelRatio > 1 ? url.replace(settings.get('photoRegex'), settings.get('retinaSuffix')) : url;
257	}
258
259	function trapFocus(e) {
260		if ('contains' in $box[0] && !$box[0].contains(e.target) && e.target !== $overlay[0]) {
261			e.stopPropagation();
262			$box.focus();
263		}
264	}
265
266	function setClass(str) {
267		if (setClass.str !== str) {
268			$box.add($overlay).removeClass(setClass.str).addClass(str);
269			setClass.str = str;
270		}
271	}
272
273	function getRelated(rel) {
274		index = 0;
275
276		if (rel && rel !== false && rel !== 'nofollow') {
277			$related = $('.' + boxElement).filter(function () {
278				var options = $.data(this, colorbox);
279				var settings = new Settings(this, options);
280				return (settings.get('rel') === rel);
281			});
282			index = $related.index(settings.el);
283
284			// Check direct calls to Colorbox.
285			if (index === -1) {
286				$related = $related.add(settings.el);
287				index = $related.length - 1;
288			}
289		} else {
290			$related = $(settings.el);
291		}
292	}
293
294	function trigger(event) {
295		// for external use
296		$(document).trigger(event);
297		// for internal use
298		$events.triggerHandler(event);
299	}
300
301	var slideshow = (function(){
302		var active,
303			className = prefix + "Slideshow_",
304			click = "click." + prefix,
305			timeOut;
306
307		function clear () {
308			clearTimeout(timeOut);
309		}
310
311		function set() {
312			if (settings.get('loop') || $related[index + 1]) {
313				clear();
314				timeOut = setTimeout(publicMethod.next, settings.get('slideshowSpeed'));
315			}
316		}
317
318		function start() {
319			$slideshow
320				.html(settings.get('slideshowStop'))
321				.unbind(click)
322				.one(click, stop);
323
324			$events
325				.bind(event_complete, set)
326				.bind(event_load, clear);
327
328			$box.removeClass(className + "off").addClass(className + "on");
329		}
330
331		function stop() {
332			clear();
333
334			$events
335				.unbind(event_complete, set)
336				.unbind(event_load, clear);
337
338			$slideshow
339				.html(settings.get('slideshowStart'))
340				.unbind(click)
341				.one(click, function () {
342					publicMethod.next();
343					start();
344				});
345
346			$box.removeClass(className + "on").addClass(className + "off");
347		}
348
349		function reset() {
350			active = false;
351			$slideshow.hide();
352			clear();
353			$events
354				.unbind(event_complete, set)
355				.unbind(event_load, clear);
356			$box.removeClass(className + "off " + className + "on");
357		}
358
359		return function(){
360			if (active) {
361				if (!settings.get('slideshow')) {
362					$events.unbind(event_cleanup, reset);
363					reset();
364				}
365			} else {
366				if (settings.get('slideshow') && $related[1]) {
367					active = true;
368					$events.one(event_cleanup, reset);
369					if (settings.get('slideshowAuto')) {
370						start();
371					} else {
372						stop();
373					}
374					$slideshow.show();
375				}
376			}
377		};
378
379	}());
380
381
382	function launch(element) {
383		var options;
384
385		if (!closing) {
386
387			options = $(element).data(colorbox);
388
389			settings = new Settings(element, options);
390
391			getRelated(settings.get('rel'));
392
393			if (!open) {
394				open = active = true; // Prevents the page-change action from queuing up if the visitor holds down the left or right keys.
395
396				setClass(settings.get('className'));
397
398				// Show colorbox so the sizes can be calculated in older versions of jQuery
399				$box.css({visibility:'hidden', display:'block', opacity:''});
400
401				$loaded = $tag(div, 'LoadedContent', 'width:0; height:0; overflow:hidden; visibility:hidden');
402				$content.css({width:'', height:''}).append($loaded);
403
404				// Cache values needed for size calculations
405				interfaceHeight = $topBorder.height() + $bottomBorder.height() + $content.outerHeight(true) - $content.height();
406				interfaceWidth = $leftBorder.width() + $rightBorder.width() + $content.outerWidth(true) - $content.width();
407				loadedHeight = $loaded.outerHeight(true);
408				loadedWidth = $loaded.outerWidth(true);
409
410				// Opens inital empty Colorbox prior to content being loaded.
411				var initialWidth = setSize(settings.get('initialWidth'), 'x');
412				var initialHeight = setSize(settings.get('initialHeight'), 'y');
413				var maxWidth = settings.get('maxWidth');
414				var maxHeight = settings.get('maxHeight');
415
416				settings.w = Math.max((maxWidth !== false ? Math.min(initialWidth, setSize(maxWidth, 'x')) : initialWidth) - loadedWidth - interfaceWidth, 0);
417				settings.h = Math.max((maxHeight !== false ? Math.min(initialHeight, setSize(maxHeight, 'y')) : initialHeight) - loadedHeight - interfaceHeight, 0);
418
419				$loaded.css({width:'', height:settings.h});
420				publicMethod.position();
421
422				trigger(event_open);
423				settings.get('onOpen');
424
425				$groupControls.add($title).hide();
426
427				$box.focus();
428
429				if (settings.get('trapFocus')) {
430					// Confine focus to the modal
431					// Uses event capturing that is not supported in IE8-
432					if (document.addEventListener) {
433
434						document.addEventListener('focus', trapFocus, true);
435
436						$events.one(event_closed, function () {
437							document.removeEventListener('focus', trapFocus, true);
438						});
439					}
440				}
441
442				// Return focus on closing
443				if (settings.get('returnFocus')) {
444					$events.one(event_closed, function () {
445						$(settings.el).focus();
446					});
447				}
448			}
449
450			var opacity = parseFloat(settings.get('opacity'));
451			$overlay.css({
452				opacity: opacity === opacity ? opacity : '',
453				cursor: settings.get('overlayClose') ? 'pointer' : '',
454				visibility: 'visible'
455			}).show();
456
457			if (settings.get('closeButton')) {
458				$close.html(settings.get('close')).appendTo($content);
459			} else {
460				$close.appendTo('<div/>'); // replace with .detach() when dropping jQuery < 1.4
461			}
462
463			load();
464		}
465	}
466
467	// Colorbox's markup needs to be added to the DOM prior to being called
468	// so that the browser will go ahead and load the CSS background images.
469	function appendHTML() {
470		if (!$box) {
471			init = false;
472			$window = $(window);
473			$box = $tag(div).attr({
474				id: colorbox,
475				'class': $.support.opacity === false ? prefix + 'IE' : '', // class for optional IE8 & lower targeted CSS.
476				role: 'dialog',
477				tabindex: '-1'
478			}).hide();
479			$overlay = $tag(div, "Overlay").hide();
480			$loadingOverlay = $([$tag(div, "LoadingOverlay")[0],$tag(div, "LoadingGraphic")[0]]);
481			$wrap = $tag(div, "Wrapper");
482			$content = $tag(div, "Content").append(
483				$title = $tag(div, "Title"),
484				$current = $tag(div, "Current"),
485				$prev = $('<button type="button"/>').attr({id:prefix+'Previous'}),
486				$next = $('<button type="button"/>').attr({id:prefix+'Next'}),
487				$slideshow = $('<button type="button"/>').attr({id:prefix+'Slideshow'}),
488				$loadingOverlay
489			);
490
491			$close = $('<button type="button"/>').attr({id:prefix+'Close'});
492
493			$wrap.append( // The 3x3 Grid that makes up Colorbox
494				$tag(div).append(
495					$tag(div, "TopLeft"),
496					$topBorder = $tag(div, "TopCenter"),
497					$tag(div, "TopRight")
498				),
499				$tag(div, false, 'clear:left').append(
500					$leftBorder = $tag(div, "MiddleLeft"),
501					$content,
502					$rightBorder = $tag(div, "MiddleRight")
503				),
504				$tag(div, false, 'clear:left').append(
505					$tag(div, "BottomLeft"),
506					$bottomBorder = $tag(div, "BottomCenter"),
507					$tag(div, "BottomRight")
508				)
509			).find('div div').css({'float': 'left'});
510
511			$loadingBay = $tag(div, false, 'position:absolute; width:9999px; visibility:hidden; display:none; max-width:none;');
512
513			$groupControls = $next.add($prev).add($current).add($slideshow);
514		}
515		if (document.body && !$box.parent().length) {
516			$(document.body).append($overlay, $box.append($wrap, $loadingBay));
517		}
518	}
519
520	// Add Colorbox's event bindings
521	function addBindings() {
522		function clickHandler(e) {
523			// ignore non-left-mouse-clicks and clicks modified with ctrl / command, shift, or alt.
524			// See: http://jacklmoore.com/notes/click-events/
525			if (!(e.which > 1 || e.shiftKey || e.altKey || e.metaKey || e.ctrlKey)) {
526				e.preventDefault();
527				launch(this);
528			}
529		}
530
531		if ($box) {
532			if (!init) {
533				init = true;
534
535				// Anonymous functions here keep the public method from being cached, thereby allowing them to be redefined on the fly.
536				$next.click(function () {
537					publicMethod.next();
538				});
539				$prev.click(function () {
540					publicMethod.prev();
541				});
542				$close.click(function () {
543					publicMethod.close();
544				});
545				$overlay.click(function () {
546					if (settings.get('overlayClose')) {
547						publicMethod.close();
548					}
549				});
550
551				// Key Bindings
552				$(document).bind('keydown.' + prefix, function (e) {
553					var key = e.keyCode;
554					if (open && settings.get('escKey') && key === 27) {
555						e.preventDefault();
556						publicMethod.close();
557					}
558					if (open && settings.get('arrowKey') && $related[1] && !e.altKey) {
559						if (key === 37) {
560							e.preventDefault();
561							$prev.click();
562						} else if (key === 39) {
563							e.preventDefault();
564							$next.click();
565						}
566					}
567				});
568
569				if ($.isFunction($.fn.on)) {
570					// For jQuery 1.7+
571					$(document).on('click.'+prefix, '.'+boxElement, clickHandler);
572				} else {
573					// For jQuery 1.3.x -> 1.6.x
574					// This code is never reached in jQuery 1.9, so do not contact me about 'live' being removed.
575					// This is not here for jQuery 1.9, it's here for legacy users.
576					$('.'+boxElement).live('click.'+prefix, clickHandler);
577				}
578			}
579			return true;
580		}
581		return false;
582	}
583
584	// Don't do anything if Colorbox already exists.
585	if ($[colorbox]) {
586		return;
587	}
588
589	// Append the HTML when the DOM loads
590	$(appendHTML);
591
592
593	// ****************
594	// PUBLIC FUNCTIONS
595	// Usage format: $.colorbox.close();
596	// Usage from within an iframe: parent.jQuery.colorbox.close();
597	// ****************
598
599	publicMethod = $.fn[colorbox] = $[colorbox] = function (options, callback) {
600		var settings;
601		var $obj = this;
602
603		options = options || {};
604
605		if ($.isFunction($obj)) { // assume a call to $.colorbox
606			$obj = $('<a/>');
607			options.open = true;
608		}
609
610		if (!$obj[0]) { // colorbox being applied to empty collection
611			return $obj;
612		}
613
614		appendHTML();
615
616		if (addBindings()) {
617
618			if (callback) {
619				options.onComplete = callback;
620			}
621
622			$obj.each(function () {
623				var old = $.data(this, colorbox) || {};
624				$.data(this, colorbox, $.extend(old, options));
625			}).addClass(boxElement);
626
627			settings = new Settings($obj[0], options);
628
629			if (settings.get('open')) {
630				launch($obj[0]);
631			}
632		}
633
634		return $obj;
635	};
636
637	publicMethod.position = function (speed, loadedCallback) {
638		var
639		css,
640		top = 0,
641		left = 0,
642		offset = $box.offset(),
643		scrollTop,
644		scrollLeft;
645
646		$window.unbind('resize.' + prefix);
647
648		// remove the modal so that it doesn't influence the document width/height
649		$box.css({top: -9e4, left: -9e4});
650
651		scrollTop = $window.scrollTop();
652		scrollLeft = $window.scrollLeft();
653
654		if (settings.get('fixed')) {
655			offset.top -= scrollTop;
656			offset.left -= scrollLeft;
657			$box.css({position: 'fixed'});
658		} else {
659			top = scrollTop;
660			left = scrollLeft;
661			$box.css({position: 'absolute'});
662		}
663
664		// keeps the top and left positions within the browser's viewport.
665		if (settings.get('right') !== false) {
666			left += Math.max($window.width() - settings.w - loadedWidth - interfaceWidth - setSize(settings.get('right'), 'x'), 0);
667		} else if (settings.get('left') !== false) {
668			left += setSize(settings.get('left'), 'x');
669		} else {
670			left += Math.round(Math.max($window.width() - settings.w - loadedWidth - interfaceWidth, 0) / 2);
671		}
672
673		if (settings.get('bottom') !== false) {
674			top += Math.max(winheight() - settings.h - loadedHeight - interfaceHeight - setSize(settings.get('bottom'), 'y'), 0);
675		} else if (settings.get('top') !== false) {
676			top += setSize(settings.get('top'), 'y');
677		} else {
678			top += Math.round(Math.max(winheight() - settings.h - loadedHeight - interfaceHeight, 0) / 2);
679		}
680
681		$box.css({top: offset.top, left: offset.left, visibility:'visible'});
682
683		// this gives the wrapper plenty of breathing room so it's floated contents can move around smoothly,
684		// but it has to be shrank down around the size of div#colorbox when it's done.  If not,
685		// it can invoke an obscure IE bug when using iframes.
686		$wrap[0].style.width = $wrap[0].style.height = "9999px";
687
688		function modalDimensions() {
689			$topBorder[0].style.width = $bottomBorder[0].style.width = $content[0].style.width = (parseInt($box[0].style.width,10) - interfaceWidth)+'px';
690			$content[0].style.height = $leftBorder[0].style.height = $rightBorder[0].style.height = (parseInt($box[0].style.height,10) - interfaceHeight)+'px';
691		}
692
693		css = {width: settings.w + loadedWidth + interfaceWidth, height: settings.h + loadedHeight + interfaceHeight, top: top, left: left};
694
695		// setting the speed to 0 if the content hasn't changed size or position
696		if (speed) {
697			var tempSpeed = 0;
698			$.each(css, function(i){
699				if (css[i] !== previousCSS[i]) {
700					tempSpeed = speed;
701					return;
702				}
703			});
704			speed = tempSpeed;
705		}
706
707		previousCSS = css;
708
709		if (!speed) {
710			$box.css(css);
711		}
712
713		$box.dequeue().animate(css, {
714			duration: speed || 0,
715			complete: function () {
716				modalDimensions();
717
718				active = false;
719
720				// shrink the wrapper down to exactly the size of colorbox to avoid a bug in IE's iframe implementation.
721				$wrap[0].style.width = (settings.w + loadedWidth + interfaceWidth) + "px";
722				$wrap[0].style.height = (settings.h + loadedHeight + interfaceHeight) + "px";
723
724				if (settings.get('reposition')) {
725					setTimeout(function () {  // small delay before binding onresize due to an IE8 bug.
726						$window.bind('resize.' + prefix, publicMethod.position);
727					}, 1);
728				}
729
730				if ($.isFunction(loadedCallback)) {
731					loadedCallback();
732				}
733			},
734			step: modalDimensions
735		});
736	};
737
738	publicMethod.resize = function (options) {
739		var scrolltop;
740
741		if (open) {
742			options = options || {};
743
744			if (options.width) {
745				settings.w = setSize(options.width, 'x') - loadedWidth - interfaceWidth;
746			}
747
748			if (options.innerWidth) {
749				settings.w = setSize(options.innerWidth, 'x');
750			}
751
752			$loaded.css({width: settings.w});
753
754			if (options.height) {
755				settings.h = setSize(options.height, 'y') - loadedHeight - interfaceHeight;
756			}
757
758			if (options.innerHeight) {
759				settings.h = setSize(options.innerHeight, 'y');
760			}
761
762			if (!options.innerHeight && !options.height) {
763				scrolltop = $loaded.scrollTop();
764				$loaded.css({height: "auto"});
765				settings.h = $loaded.height();
766			}
767
768			$loaded.css({height: settings.h});
769
770			if(scrolltop) {
771				$loaded.scrollTop(scrolltop);
772			}
773
774			publicMethod.position(settings.get('transition') === "none" ? 0 : settings.get('speed'));
775		}
776	};
777
778	publicMethod.prep = function (object) {
779		if (!open) {
780			return;
781		}
782
783		var callback, speed = settings.get('transition') === "none" ? 0 : settings.get('speed');
784
785		$loaded.remove();
786
787		$loaded = $tag(div, 'LoadedContent').append(object);
788
789		function getWidth() {
790			settings.w = settings.w || $loaded.width();
791			settings.w = settings.mw && settings.mw < settings.w ? settings.mw : settings.w;
792			return settings.w;
793		}
794		function getHeight() {
795			settings.h = settings.h || $loaded.height();
796			settings.h = settings.mh && settings.mh < settings.h ? settings.mh : settings.h;
797			return settings.h;
798		}
799
800		$loaded.hide()
801		.appendTo($loadingBay.show())// content has to be appended to the DOM for accurate size calculations.
802		.css({width: getWidth(), overflow: settings.get('scrolling') ? 'auto' : 'hidden'})
803		.css({height: getHeight()})// sets the height independently from the width in case the new width influences the value of height.
804		.prependTo($content);
805
806		$loadingBay.hide();
807
808		// floating the IMG removes the bottom line-height and fixed a problem where IE miscalculates the width of the parent element as 100% of the document width.
809
810		$(photo).css({'float': 'none'});
811
812		setClass(settings.get('className'));
813
814		callback = function () {
815			var total = $related.length,
816				iframe,
817				complete;
818
819			if (!open) {
820				return;
821			}
822
823			function removeFilter() { // Needed for IE8 in versions of jQuery prior to 1.7.2
824				if ($.support.opacity === false) {
825					$box[0].style.removeAttribute('filter');
826				}
827			}
828
829			complete = function () {
830				clearTimeout(loadingTimer);
831				$loadingOverlay.hide();
832				trigger(event_complete);
833				settings.get('onComplete');
834			};
835
836
837			$title.html(settings.get('title')).show();
838			$loaded.show();
839
840			if (total > 1) { // handle grouping
841				if (typeof settings.get('current') === "string") {
842					$current.html(settings.get('current').replace('{current}', index + 1).replace('{total}', total)).show();
843				}
844
845				$next[(settings.get('loop') || index < total - 1) ? "show" : "hide"]().html(settings.get('next'));
846				$prev[(settings.get('loop') || index) ? "show" : "hide"]().html(settings.get('previous'));
847
848				slideshow();
849
850				// Preloads images within a rel group
851				if (settings.get('preloading')) {
852					$.each([getIndex(-1), getIndex(1)], function(){
853						var img,
854							i = $related[this],
855							settings = new Settings(i, $.data(i, colorbox)),
856							src = settings.get('href');
857
858						if (src && isImage(settings, src)) {
859							src = retinaUrl(settings, src);
860							img = document.createElement('img');
861							img.src = src;
862						}
863					});
864				}
865			} else {
866				$groupControls.hide();
867			}
868
869			if (settings.get('iframe')) {
870
871				iframe = settings.get('createIframe');
872
873				if (!settings.get('scrolling')) {
874					iframe.scrolling = "no";
875				}
876
877				$(iframe)
878					.attr({
879						src: settings.get('href'),
880						'class': prefix + 'Iframe'
881					})
882					.one('load', complete)
883					.appendTo($loaded);
884
885				$events.one(event_purge, function () {
886					iframe.src = "//about:blank";
887				});
888
889				if (settings.get('fastIframe')) {
890					$(iframe).trigger('load');
891				}
892			} else {
893				complete();
894			}
895
896			if (settings.get('transition') === 'fade') {
897				$box.fadeTo(speed, 1, removeFilter);
898			} else {
899				removeFilter();
900			}
901		};
902
903		if (settings.get('transition') === 'fade') {
904			$box.fadeTo(speed, 0, function () {
905				publicMethod.position(0, callback);
906			});
907		} else {
908			publicMethod.position(speed, callback);
909		}
910	};
911
912	function load () {
913		var href, setResize, prep = publicMethod.prep, $inline, request = ++requests;
914
915		active = true;
916
917		photo = false;
918
919		trigger(event_purge);
920		trigger(event_load);
921		settings.get('onLoad');
922
923		settings.h = settings.get('height') ?
924				setSize(settings.get('height'), 'y') - loadedHeight - interfaceHeight :
925				settings.get('innerHeight') && setSize(settings.get('innerHeight'), 'y');
926
927		settings.w = settings.get('width') ?
928				setSize(settings.get('width'), 'x') - loadedWidth - interfaceWidth :
929				settings.get('innerWidth') && setSize(settings.get('innerWidth'), 'x');
930
931		// Sets the minimum dimensions for use in image scaling
932		settings.mw = settings.w;
933		settings.mh = settings.h;
934
935		// Re-evaluate the minimum width and height based on maxWidth and maxHeight values.
936		// If the width or height exceed the maxWidth or maxHeight, use the maximum values instead.
937		if (settings.get('maxWidth')) {
938			settings.mw = setSize(settings.get('maxWidth'), 'x') - loadedWidth - interfaceWidth;
939			settings.mw = settings.w && settings.w < settings.mw ? settings.w : settings.mw;
940		}
941		if (settings.get('maxHeight')) {
942			settings.mh = setSize(settings.get('maxHeight'), 'y') - loadedHeight - interfaceHeight;
943			settings.mh = settings.h && settings.h < settings.mh ? settings.h : settings.mh;
944		}
945
946		href = settings.get('href');
947
948		loadingTimer = setTimeout(function () {
949			$loadingOverlay.show();
950		}, 100);
951
952		if (settings.get('inline')) {
953			var $target = $(href).eq(0);
954			// Inserts an empty placeholder where inline content is being pulled from.
955			// An event is bound to put inline content back when Colorbox closes or loads new content.
956			$inline = $('<div>').hide().insertBefore($target);
957
958			$events.one(event_purge, function () {
959				$inline.replaceWith($target);
960			});
961
962			prep($target);
963		} else if (settings.get('iframe')) {
964			// IFrame element won't be added to the DOM until it is ready to be displayed,
965			// to avoid problems with DOM-ready JS that might be trying to run in that iframe.
966			prep(" ");
967		} else if (settings.get('html')) {
968			prep(settings.get('html'));
969		} else if (isImage(settings, href)) {
970
971			href = retinaUrl(settings, href);
972
973			photo = settings.get('createImg');
974
975			$(photo)
976			.addClass(prefix + 'Photo')
977			.bind('error.'+prefix,function () {
978				prep($tag(div, 'Error').html(settings.get('imgError')));
979			})
980			.one('load', function () {
981				if (request !== requests) {
982					return;
983				}
984
985				// A small pause because some browsers will occas
985ionally report a
986				// img.width and img.height of zero immediately after the img.onload fires
987				setTimeout(function(){
988					var percent;
989
990					if (settings.get('retinaImage') && window.devicePixelRatio > 1) {
991						photo.height = photo.height / window.devicePixelRatio;
992						photo.width = photo.width / window.devicePixelRatio;
993					}
994
995					if (settings.get('scalePhotos')) {
996						setResize = function () {
997							photo.height -= photo.height * percent;
998							photo.width -= photo.width * percent;
999						};
1000						if (settings.mw && photo.width > settings.mw) {
1001							percent = (photo.width - settings.mw) / photo.width;
1002							setResize();
1003						}
1004						if (settings.mh && photo.height > settings.mh) {
1005							percent = (photo.height - settings.mh) / photo.height;
1006							setResize();
1007						}
1008					}
1009
1010					if (settings.h) {
1011						photo.style.marginTop = Math.max(settings.mh - photo.height, 0) / 2 + 'px';
1012					}
1013
1014					if ($related[1] && (settings.get('loop') || $related[index + 1])) {
1015						photo.style.cursor = 'pointer';
1016
1017						$(photo).bind('click.'+prefix, function () {
1018							publicMethod.next();
1019						});
1020					}
1021
1022					photo.style.width = photo.width + 'px';
1023					photo.style.height = photo.height + 'px';
1024					prep(photo);
1025				}, 1);
1026			});
1027
1028			photo.src = href;
1029
1030		} else if (href) {
1031			$loadingBay.load(href, settings.get('data'), function (data, status) {
1032				if (request === requests) {
1033					prep(status === 'error' ? $tag(div, 'Error').html(settings.get('xhrError')) : $(this).contents());
1034				}
1035			});
1036		}
1037	}
1038
1039	// Navigates to the next page/image in a set.
1040	publicMethod.next = function () {
1041		if (!active && $related[1] && (settings.get('loop') || $related[index + 1])) {
1042			index = getIndex(1);
1043			launch($related[index]);
1044		}
1045	};
1046
1047	publicMethod.prev = function () {
1048		if (!active && $related[1] && (settings.get('loop') || index)) {
1049			index = getIndex(-1);
1050			launch($related[index]);
1051		}
1052	};
1053
1054	// Note: to use this within an iframe use the following format: parent.jQuery.colorbox.close();
1055	publicMethod.close = function () {
1056		if (open && !closing) {
1057
1058			closing = true;
1059			open = false;
1060			trigger(event_cleanup);
1061			settings.get('onCleanup');
1062			$window.unbind('.' + prefix);
1063			$overlay.fadeTo(settings.get('fadeOut') || 0, 0);
1064
1065			$box.stop().fadeTo(settings.get('fadeOut') || 0, 0, function () {
1066				$box.hide();
1067				$overlay.hide();
1068				trigger(event_purge);
1069				$loaded.remove();
1070
1071				setTimeout(function () {
1072					closing = false;
1073					trigger(event_closed);
1074					settings.get('onClosed');
1075				}, 1);
1076			});
1077		}
1078	};
1079
1080	// Removes changes Colorbox made to the document, but does not remove the plugin.
1081	publicMethod.remove = function () {
1082		if (!$box) { return; }
1083
1084		$box.stop();
1085		$[colorbox].close();
1086		$box.stop(false, true).remove();
1087		$overlay.remove();
1088		closing = false;
1089		$box = null;
1090		$('.' + boxElement)
1091			.removeData(colorbox)
1092			.removeClass(boxElement);
1093
1094		$(document).unbind('click.'+prefix).unbind('keydown.'+prefix);
1095	};
1096
1097	// A method for fetching the current element Colorbox is referencing.
1098	// returns a jQuery object.
1099	publicMethod.element = function () {
1100		return $(settings.el);
1101	};
1102
1103	publicMethod.settings = defaults;
1104
1105}(jQuery, document, window));
1106;
1107/**
1108 * @file
1109 * Colorbox module init js.
1110 */
1111
1112(function ($) {
1113
1114Drupal.behaviors.initColorbox = {
1115  attach: function (context, settings) {
1116    if (!$.isFunction($.colorbox) || typeof settings.colorbox === 'undefined') {
1117      return;
1118    }
1119
1120    if (settings.colorbox.mobiledetect && window.matchMedia) {
1121      // Disable Colorbox for small screens.
1122      var mq = window.matchMedia("(max-device-width: " + settings.colorbox.mobiledevicewidth + ")");
1123      if (mq.matches) {
1124        return;
1125      }
1126    }
1127
1128    // Use "data-colorbox-gallery" if set otherwise use "rel".
1129    settings.colorbox.rel = function () {
1130      if ($(this).data('colorbox-gallery')) {
1131        return $(this).data('colorbox-gallery');
1132      }
1133      else {
1134        return $(this).attr('rel');
1135      }
1136    };
1137
1138    $('.colorbox', context)
1139      .once('init-colorbox')
1140      .colorbox(settings.colorbox);
1141
1142    $(context).bind('cbox_complete', function () {
1143      Drupal.attachBehaviors('#cboxLoadedContent');
1144    });
1145  }
1146};
1147
1148})(jQuery);
1149;
1150/**
1151 * @file
1152 * Colorbox module inline js.
1153 */
1154
1155(function ($) {
1156
1157Drupal.behaviors.initColorboxInline = {
1158  attach: function (context, settings) {
1159    if (!$.isFunction($.colorbox) || typeof settings.colorbox === 'undefined') {
1160      return;
1161    }
1162
1163    if (settings.colorbox.mobiledetect && window.matchMedia) {
1164      // Disable Colorbox for small screens.
1165      var mq = window.matchMedia("(max-device-width: " + settings.colorbox.mobiledevicewidth + ")");
1166      if (mq.matches) {
1167        return;
1168      }
1169    }
1170
1171    $.urlParam = function(name, url){
1172      if (name == 'fragment') {
1173        var results = new RegExp('(#[^&#]*)').exec(url);
1174      }
1175      else {
1176        var results = new RegExp('[\\?&]' + name + '=([^&#]*)').exec(url);
1177      }
1178      if (!results) { return ''; }
1179      return results[1] || '';
1180    };
1181    $('.colorbox-inline', context).once('init-colorbox-inline').colorbox({
1182      transition:settings.colorbox.transition,
1183      speed:settings.colorbox.speed,
1184      opacity:settings.colorbox.opacity,
1185      slideshow:settings.colorbox.slideshow,
1186      slideshowAuto:settings.colorbox.slideshowAuto,
1187      slideshowSpeed:settings.colorbox.slideshowSpeed,
1188      slideshowStart:settings.colorbox.slideshowStart,
1189      slideshowStop:settings.colorbox.slideshowStop,
1190      current:settings.colorbox.current,
1191      previous:settings.colorbox.previous,
1192      next:settings.colorbox.next,
1193      close:settings.colorbox.close,
1194      overlayClose:settings.colorbox.overlayClose,
1195      maxWidth:settings.colorbox.maxWidth,
1196      maxHeight:settings.colorbox.maxHeight,
1197      innerWidth:function(){
1198        return $.urlParam('width', $(this).attr('href'));
1199      },
1200      innerHeight:function(){
1201        return $.urlParam('height', $(this).attr('href'));
1202      },
1203      title:function(){
1204        return decodeURIComponent($.urlParam('title', $(this).attr('href')));
1205      },
1206      iframe:function(){
1207        return $.urlParam('iframe', $(this).attr('href'));
1208      },
1209      inline:function(){
1210        return $.urlParam('inline', $(this).attr('href'));
1211      },
1212      href:function(){
1213        return $.urlParam('fragment', $(this).attr('href'));
1214      }
1215    });
1216  }
1217};
1218
1219})(jQuery);
1220;
1221(function ($) {
1222
1223/**
1224 * A progressbar object. Initialized with the given id. Must be inserted into
1225 * the DOM afterwards through progressBar.element.
1226 *
1227 * method is the function which will perform the HTTP request to get the
1228 * progress bar state. Either "GET" or "POST".
1229 *
1230 * e.g. pb = new progressBar('myProgressBar');
1231 *      some_element.appendChild(pb.element);
1232 */
1233Drupal.progressBar = function (id, updateCallback, method, errorCallback) {
1234  var pb = this;
1235  this.id = id;
1236  this.method = method || 'GET';
1237  this.updateCallback = updateCallback;
1238  this.errorCallback = errorCallback;
1239
1240  // The WAI-ARIA setting aria-live="polite" will announce changes after users
1241  // have completed their current activity and not interrupt the screen reader.
1242  this.element = $('<div class="progress" aria-live="polite"></div>').attr('id', id);
1243  this.element.html('<div class="bar"><div class="filled"></div></div>' +
1244                    '<div class="percentage"></div>' +
1245                    '<div class="message">&nbsp;</div>');
1246};
1247
1248/**
1249 * Set the percentage and status message for the progressbar.
1250 */
1251Drupal.progressBar.prototype.setProgress = function (percentage, message) {
1252  if (percentage >= 0 && percentage <= 100) {
1253    $('div.filled', this.element).css('width', percentage + '%');
1254    $('div.percentage', this.element).html(percentage + '%');
1255  }
1256  $('div.message', this.element).html(message);
1257  if (this.updateCallback) {
1258    this.updateCallback(percentage, message, this);
1259  }
1260};
1261
1262/**
1263 * Start monitoring progress via Ajax.
1264 */
1265Drupal.progressBar.prototype.startMonitoring = function (uri, delay) {
1266  this.delay = delay;
1267  this.uri = uri;
1268  this.sendPing();
1269};
1270
1271/**
1272 * Stop monitoring progress via Ajax.
1273 */
1274Drupal.progressBar.prototype.stopMonitoring = function () {
1275  clearTimeout(this.timer);
1276  // This allows monitoring to be stopped from within the callback.
1277  this.uri = null;
1278};
1279
1280/**
1281 * Request progress data from server.
1282 */
1283Drupal.progressBar.prototype.sendPing = function () {
1284  if (this.timer) {
1285    clearTimeout(this.timer);
1286  }
1287  if (this.uri) {
1288    var pb = this;
1289    // When doing a post request, you need non-null data. Otherwise a
1290    // HTTP 411 or HTTP 406 (with Apache mod_security) error may result.
1291    $.ajax({
1292      type: this.method,
1293      url: this.uri,
1294      data: '',
1295      dataType: 'json',
1296      success: function (progress) {
1297        // Display errors.
1298        if (progress.status == 0) {
1299          pb.displayError(progress.data);
1300          return;
1301        }
1302        // Update display.
1303        pb.setProgress(progress.percentage, progress.message);
1304        // Schedule next timer.
1305        pb.timer = setTimeout(function () { pb.sendPing(); }, pb.delay);
1306      },
1307      error: function (xmlhttp) {
1308        pb.displayError(Drupal.ajaxError(xmlhttp, pb.uri));
1309      }
1310    });
1311  }
1312};
1313
1314/**
1315 * Display errors on the page.
1316 */
1317Drupal.progressBar.prototype.displayError = function (string) {
1318  var error = $('<div class="messages error"></div>').html(string);
1319  $(this.element).before(error).hide();
1320
1321  if (this.errorCallback) {
1322    this.errorCallback(this);
1323  }
1324};
1325
1326})(jQuery);
1327;
1328/**
1329 * @file
1330 *
1331 * Implement a modal form.
1332 *
1333 * @see modal.inc for documentation.
1334 *
1335 * This javascript relies on the CTools ajax responder.
1336 */
1337
1338(function ($) {
1339  // Make sure our objects are defined.
1340  Drupal.CTools = Drupal.CTools || {};
1341  Drupal.CTools.Modal = Drupal.CTools.Modal || {};
1342
1343  /**
1344   * Display the modal
1345   *
1346   * @todo -- document the settings.
1347   */
1348  Drupal.CTools.Modal.show = function(choice) {
1349    var opts = {};
1350
1351    if (choice && typeof choice == 'string' && Drupal.settings[choice]) {
1352      // This notation guarantees we are actually copying it.
1353      $.extend(true, opts, Drupal.settings[choice]);
1354    }
1355    else if (choice) {
1356      $.extend(true, opts, choice);
1357    }
1358
1359    var defaults = {
1360      modalTheme: 'CToolsModalDialog',
1361      throbberTheme: 'CToolsModalThrobber',
1362      animation: 'show',
1363      animationSpeed: 'fast',
1364      modalSize: {
1365        type: 'scale',
1366        width: .8,
1367        height: .8,
1368        addWidth: 0,
1369        addHeight: 0,
1370        // How much to remove from the inner content to make space for the
1371        // theming.
1372        contentRight: 25,
1373        contentBottom: 45
1374      },
1375      modalOptions: {
1376        opacity: .55,
1377        background: '#fff'
1378      },
1379      modalClass: 'default'
1380    };
1381
1382    var settings = {};
1383    $.extend(true, settings, defaults, Drupal.settings.CToolsModal, opts);
1384
1385    if (Drupal.CTools.Modal.currentSettings && Drupal.CTools.Modal.currentSettings != settings) {
1386      Drupal.CTools.Modal.modal.remove();
1387      Drupal.CTools.Modal.modal = null;
1388    }
1389
1390    Drupal.CTools.Modal.currentSettings = settings;
1391
1392    var resize = function(e) {
1393      // When creating the modal, it actually exists only in a theoretical
1394      // place that is not in the DOM. But once the modal exists, it is in the
1395      // DOM so the context must be set appropriately.
1396      var context = e ? document : Drupal.CTools.Modal.modal;
1397
1398      if (Drupal.CTools.Modal.currentSettings.modalSize.type == 'scale') {
1399        var width = $(window).width() * Drupal.CTools.Modal.currentSettings.modalSize.width;
1400        var height = $(window).height() * Drupal.CTools.Modal.currentSettings.modalSize.height;
1401      }
1402      else {
1403        var width = Drupal.CTools.Modal.currentSettings.modalSize.width;
1404        var height = Drupal.CTools.Modal.currentSettings.modalSize.height;
1405      }
1406
1407      // Use the additionol pixels for creating the width and height.
1408      $('div.ctools-modal-content', context).css({
1409        'width': width + Drupal.CTools.Modal.currentSettings.modalSize.addWidth + 'px',
1410        'height': height + Drupal.CTools.Modal.currentSettings.modalSize.addHeight + 'px'
1411      });
1412      $('div.ctools-modal-content .modal-content', context).css({
1413        'width': (width - Drupal.CTools.Modal.currentSettings.modalSize.contentRight) + 'px',
1414        'height': (height - Drupal.CTools.Modal.currentSettings.modalSize.contentBottom) + 'px'
1415      });
1416    };
1417
1418    if (!Drupal.CTools.Modal.modal) {
1419      Drupal.CTools.Modal.modal = $(Drupal.theme(settings.modalTheme));
1420      if (settings.modalSize.type == 'scale') {
1421        $(window).bind('resize', resize);
1422      }
1423    }
1424
1425    resize();
1426
1427    $('span.modal-title', Drupal.CTools.Modal.modal).html(Drupal.CTools.Modal.currentSettings.loadingText);
1428    Drupal.CTools.Modal.modalContent(Drupal.CTools.Modal.modal, settings.modalOptions, settings.animation, settings.animationSpeed, settings.modalClass);
1429    $('#modalContent .modal-content').html(Drupal.theme(settings.throbberTheme)).addClass('ctools-modal-loading');
1430
1431    // Position autocomplete results based on the scroll position of the modal.
1432    $('#modalContent .modal-content').delegate('input.form-autocomplete', 'keyup', function() {
1433      $('#autocomplete').css('top', $(this).position().top + $(this).outerHeight() + $(this).offsetParent().filter('#modal-content').scrollTop());
1434    });
1435  };
1436
1437  /**
1438   * Hide the modal
1439   */
1440  Drupal.CTools.Modal.dismiss = function() {
1441    if (Drupal.CTools.Modal.modal) {
1442      Drupal.CTools.Modal.unmodalContent(Drupal.CTools.Modal.modal);
1443    }
1444  };
1445
1446  /**
1447   * Provide the HTML to create the modal dialog.
1448   */
1449  Drupal.theme.prototype.CToolsModalDialog = function () {
1450    var html = '';
1451    html += '<div id="ctools-modal">';
1452    html += '  <div class="ctools-modal-content">'; // panels-modal-content
1453    html += '    <div class="modal-header">';
1454    html += '      <a class="close" href="#">';
1455    html +=          Drupal.CTools.Modal.currentSettings.closeText + Drupal.CTools.Modal.currentSettings.closeImage;
1456    html += '      </a>';
1457    html += '      <span id="modal-title" class="modal-title">&nbsp;</span>';
1458    html += '    </div>';
1459    html += '    <div id="modal-content" class="modal-content">';
1460    html += '    </div>';
1461    html += '  </div>';
1462    html += '</div>';
1463
1464    return html;
1465  };
1466
1467  /**
1468   * Provide the HTML to create the throbber.
1469   */
1470  Drupal.theme.prototype.CToolsModalThrobber = function () {
1471    var html = '';
1472    html += '<div id="modal-throbber">';
1473    html += '  <div class="modal-throbber-wrapper">';
1474    html +=      Drupal.CTools.Modal.currentSettings.throbber;
1475    html += '  </div>';
1476    html += '</div>';
1477
1478    return html;
1479  };
1480
1481  /**
1482   * Figure out what settings string to use to display a modal.
1483   */
1484  Drupal.CTools.Modal.getSettings = function (object) {
1485    var match = $(object).attr('class').match(/ctools-modal-(\S+)/);
1486    if (match) {
1487      return match[1];
1488    }
1489  };
1490
1491  /**
1492   * Click function for modals that can be cached.
1493   */
1494  Drupal.CTools.Modal.clickAjaxCacheLink = function () {
1495    Drupal.CTools.Modal.show(Drupal.CTools.Modal.getSettings(this));
1496    return Drupal.CTools.AJAX.clickAJAXCacheLink.apply(this);
1497  };
1498
1499  /**
1500   * Handler to prepare the modal for the response
1501   */
1502  Drupal.CTools.Modal.clickAjaxLink = function () {
1503    Drupal.CTools.Modal.show(Drupal.CTools.Modal.getSettings(this));
1504    return false;
1505  };
1506
1507  /**
1508   * Submit responder to do an AJAX submit on all modal forms.
1509   */
1510  Drupal.CTools.Modal.submitAjaxForm = function(e) {
1511    var $form = $(this);
1512    var url = $form.attr('action');
1513
1514    setTimeout(function() { Drupal.CTools.AJAX.ajaxSubmit($form, url); }, 1);
1515    return false;
1516  };
1517
1518  /**
1519   * Bind links that will open modals to the appropriate function.
1520   */
1521  Drupal.behaviors.ZZCToolsModal = {
1522    attach: function(context) {
1523      // Bind links
1524      // Note that doing so in this order means that the two classes can be
1525      // used together safely.
1526      /*
1527       * @todo remimplement the warm caching feature
1528       $('a.ctools-use-modal-cache', context).once('ctools-use-modal', function() {
1529         $(this).click(Drupal.CTools.Modal.clickAjaxCacheLink);
1530         Drupal.CTools.AJAX.warmCache.apply(this);
1531       });
1532        */
1533
1534      $('area.ctools-use-modal, a.ctools-use-modal', context).once('ctools-use-modal', function() {
1535        var $this = $(this);
1536        $this.click(Drupal.CTools.Modal.clickAjaxLink);
1537        // Create a drupal ajax object
1538        var element_settings = {};
1539        if ($this.attr('href')) {
1540          element_settings.url = $this.attr('href');
1541          element_settings.event = 'click';
1542          element_settings.progress = { type: 'throbber' };
1543        }
1544        var base = $this.attr('href');
1545        Drupal.ajax[base] = new Drupal.ajax(base, this, element_settings);
1546      });
1547
1548      // Bind buttons
1549      $('input.ctools-use-modal, button.ctools-use-modal', context).once('ctools-use-modal', function() {
1550        var $this = $(this);
1551        $this.click(Drupal.CTools.Modal.clickAjaxLink);
1552        var button = this;
1553        var element_settings = {};
1554
1555        // AJAX submits specified in this manner automatically submit to the
1556        // normal form action.
1557        element_settings.url = Drupal.CTools.Modal.findURL(this);
1558        if (element_settings.url == '') {
1559          element_settings.url = $(this).closest('form').attr('action');
1560        }
1561        element_settings.event = 'click';
1562        element_settings.setClick = true;
1563
1564        var base = $this.attr('id');
1565        Drupal.ajax[base] = new Drupal.ajax(base, this, element_settings);
1566
1567        // Make sure changes to settings are reflected in the URL.
1568        $('.' + $(button).attr('id') + '-url').change(function() {
1569          Drupal.ajax[base].options.url = Drupal.CTools.Modal.findURL(button);
1570        });
1571      });
1572
1573      // Bind our custom event to the form submit
1574      $('#modal-content form', context).once('ctools-use-modal', function() {
1575        var $this = $(this);
1576        var element_settings = {};
1577
1578        element_settings.url = $this.attr('action');
1579        element_settings.event = 'submit';
1580        element_settings.progress = { 'type': 'throbber' };
1581        var base = $this.attr('id');
1582
1583        Drupal.ajax[base] = new Drupal.ajax(base, this, element_settings);
1584        Drupal.ajax[base].form = $this;
1585
1586        $('input[type=submit], button', this).click(function(event) {
1587          Drupal.ajax[base].element = this;
1588          this.form.clk = this;
1589          // Stop autocomplete from submitting.
1590          if (Drupal.autocompleteSubmit && !Drupal.autocompleteSubmit()) {
1591            return false;
1592          }
1593          // An empty event means we were triggered via .click() and
1594          // in jquery 1.4 this won't trigger a submit.
1595          // We also have to check jQuery version to prevent
1596          // IE8 + jQuery 1.4.4 to break on other events
1597          // bound to the submit button.
1598          if (jQuery.fn.jquery.substr(0, 3) === '1.4' && typeof event.bubbles === "undefined") {
1599            $(this.form).trigger('submit');
1600            return false;
1601          }
1602        });
1603      });
1604
1605      // Bind a click handler to allow elements with the 'ctools-close-modal'
1606      // class to close the modal.
1607      $('.ctools-close-modal', context).once('ctools-close-modal')
1608        .click(function() {
1609          Drupal.CTools.Modal.dismiss();
1610          return false;
1611        });
1612    }
1613  };
1614
1615  // The following are implementations of AJAX responder commands.
1616
1617  /**
1618   * AJAX responder command to place HTML within the modal.
1619   */
1620  Drupal.CTools.Modal.modal_display = function(ajax, response, status) {
1621    var settings = response.settings || ajax.settings || Drupal.settings;
1622    // If the modal does not exist yet, create it.
1623    if ($('#modalContent').length == 0) {
1624      Drupal.CTools.Modal.show(Drupal.CTools.Modal.getSettings(ajax.element));
1625    }
1626    // If the modal exists run detachBehaviors before removing existing content.
1627    else {
1628      Drupal.detachBehaviors($('#modalContent'), settings, 'unload');
1629    }
1630    $('#modal-title').html(response.title);
1631    // Simulate an actual page load by scrolling to the top after adding the
1632    // content. This is helpful for allowing users to see error messages at the
1633    // top of a form, etc.
1634    $('#modal-content').html(response.output).scrollTop(0);
1635    $(document).trigger('CToolsAttachBehaviors', $('#modalContent'));
1636
1637    // Attach behaviors within a modal dialog.
1638    Drupal.attachBehaviors($('#modalContent'), settings);
1639
1640    if ($('#modal-content').hasClass('ctools-modal-loading')) {
1641      $('#modal-content').removeClass('ctools-modal-loading');
1642    }
1643    else {
1644      // If the modal was already shown, and we are simply replacing its
1645      // content, then focus on the first focusable element in the modal.
1646      // (When first showing the modal, focus will be placed on the close
1647      // button by the show() function called above.)
1648      $('#modal-content :focusable:first').focus();
1649    }
1650  };
1651
1652  /**
1653   * AJAX responder command to dismiss the modal.
1654   */
1655  Drupal.CTools.Modal.modal_dismiss = function(command) {
1656    Drupal.CTools.Modal.dismiss();
1657    $('link.ctools-temporary-css').remove();
1658  };
1659
1660  /**
1661   * Display loading
1662   */
1663  //Drupal.CTools.AJAX.commands.modal_loading = function(command) {
1664  Drupal.CTools.Modal.modal_loading = function(command) {
1665    Drupal.CTools.Modal.modal_display({
1666      output: Drupal.theme(Drupal.CTools.Modal.currentSettings.throbberTheme),
1667      title: Drupal.CTools.Modal.currentSettings.loadingText
1668    });
1669  };
1670
1671  /**
1672   * Find a URL for an AJAX button.
1673   *
1674   * The URL for this gadget will be composed of the values of items by
1675   * taking the ID of this item and adding -url and looking for that
1676   * class. They need to be in the form in order since we will
1677   * concat them all together using '/'.
1678   */
1679  Drupal.CTools.Modal.findURL = function(item) {
1680    var url = '';
1681    var url_class = '.' + $(item).attr('id') + '-url';
1682    $(url_class).each(
1683      function() {
1684        var $this = $(this);
1685        if (url && $this.val()) {
1686          url += '/';
1687        }
1688        url += $this.val();
1689      });
1690    return url;
1691  };
1692
1693
1694  /**
1695   * modalContent
1696   * @param content string to display in the content box
1697   * @param css obj of css attributes
1698   * @param animation (fadeIn, slideDown, show)
1699   * @param speed (valid animation speeds slow, medium, fast or # in ms)
1700   * @param modalClass class added to div#modalContent
1701   */
1702  Drupal.CTools.Modal.modalContent = function(content, css, animation, speed, modalClass) {
1703    // If our animation isn't set, make it just show/pop
1704    if (!animation) {
1705      animation = 'show';
1706    }
1707    else {
1708      // If our animation isn't "fadeIn" or "slideDown" then it always is show
1709      if (animation != 'fadeIn' && animation != 'slideDown') {
1710        animation = 'show';
1711      }
1712    }
1713
1714    if (!speed && 0 !== speed) {
1715      speed = 'fast';
1716    }
1717
1718    // Build our base attributes and allow them to be overriden
1719    css = jQuery.extend({
1720      position: 'absolute',
1721      left: '0px',
1722      margin: '0px',
1723      background: '#000',
1724      opacity: '.55'
1725    }, css);
1726
1727    // Add opacity handling for IE.
1728    css.filter = 'alpha(opacity=' + (100 * css.opacity) + ')';
1729    content.hide();
1730
1731    // If we already have modalContent, remove it.
1732    if ($('#modalBackdrop').length) $('#modalBackdrop').remove();
1733    if ($('#modalContent').length) $('#modalContent').remove();
1734
1735    // position code lifted from http://www.quirksmode.org/viewport/compatibility.html
1736    if (self.pageYOffset) { // all except Explorer
1737    var wt = self.pageYOffset;
1738    } else if (document.documentElement && document.documentElement.scrollTop) { // Explorer 6 Strict
1739      var wt = document.documentElement.scrollTop;
1740    } else if (document.body) { // all other Explorers
1741      var wt = document.body.scrollTop;
1742    }
1743
1744    // Get our dimensions
1745
1746    // Get the docHeight and (ugly hack) add 50 pixels to make sure we dont have a *visible* border below our div
1747    var docHeight = $(document).height() + 50;
1748    var docWidth = $(document).width();
1749    var winHeight = $(window).height();
1750    var winWidth = $(window).width();
1751    if( docHeight < winHeight ) docHeight = winHeight;
1752
1753    // Create our divs
1754    $('body').append('<div id="modalBackdrop" class="backdrop-' + modalClass + '" style="z-index: 1000; display: none;"></div><div id="modalContent" class="modal-' + modalClass + '" style="z-index: 1001; position: absolute;">' + $(content).html() + '</div>');
1755
1756    // Get a list of the tabbable elements in the modal content.
1757    var getTabbableElements = function () {
1758      var tabbableElements = $('#modalContent :tabbable'),
1759          radioButtons = tabbableElements.filter('input[type="radio"]');
1760
1761      // The list of tabbable elements from jQuery is *almost* right. The
1762      // exception is with groups of radio buttons. The list from jQuery will
1763      // include all radio buttons, when in fact, only the selected radio button
1764      // is tabbable, and if no radio buttons in a group are selected, then only
1765      // the first is tabbable.
1766      if (radioButtons.length > 0) {
1767        // First, build up an index of which groups have an item selected or not.
1768        var anySelected = {};
1769        radioButtons.each(function () {
1770          var name = this.name;
1771
1772          if (typeof anySelected[name] === 'undefined') {
1773            anySelected[name] = radioButtons.filter('input[name="' + name + '"]:checked').length !== 0;
1774          }
1775        });
1776
1777        // Next filter out the radio buttons that aren't really tabbable.
1778        var found = {};
1779        tabbableElements = tabbableElements.filter(function () {
1780          var keep = true;
1781
1782          if (this.type == 'radio') {
1783            if (anySelected[this.name]) {
1784              // Only keep the selected one.
1785              keep = this.checked;
1786            }
1787            else {
1788              // Only keep the first one.
1789              if (found[this.name]) {
1790                keep = false;
1791              }
1792              found[this.name] = true;
1793            }
1794          }
1795
1796          return keep;
1797        });
1798      }
1799
1800      return tabbableElements.get();
1801    };
1802
1803    // Keyboard and focus event handler ensures only modal elements gain focus.
1804    modalEventHandler = function( event ) {
1805      target = null;
1806      if ( event ) { //Mozilla
1807        target = event.target;
1808      } else { //IE
1809        event = window.event;
1810        target = event.srcElement;
1811      }
1812
1813      var parents = $(target).parents().get();
1814      for (var i = 0; i < parents.length; ++i) {
1815        var position = $(parents[i]).css('position');
1816        if (position == 'absolute' || position == 'fixed') {
1817          return true;
1818        }
1819      }
1820
1821      if ($(target).is('#modalContent, body') || $(target).filter('*:visible').parents('#modalContent').length) {
1822        // Allow the event only if target is a visible child node
1823        // of #modalContent.
1824        return true;
1825      }
1826      else {
1827        getTabbableElements()[0].focus();
1828      }
1829
1830      event.preventDefault();
1831    };
1832    $('body').bind( 'focus', modalEventHandler );
1833    $('body').bind( 'keypress', modalEventHandler );
1834
1835    // Keypress handler Ensures you can only TAB to elements within the modal.
1836    // Based on the psuedo-code from WAI-ARIA 1.0 Authoring Practices section
1837    // 3.3.1 "Trapping Focus".
1838    modalTabTrapHandler = function (evt) {
1839      // We only care about the TAB key.
1840      if (evt.which != 9) {
1841        return true;
1842      }
1843
1844      var tabbableElements = getTabbableElements(),
1845          firstTabbableElement = tabbableElements[0],
1846          lastTabbableElement = tabbableElements[tabbableElements.length - 1],
1847          singleTabbableElement = firstTabbableElement == lastTabbableElement,
1848          node = evt.target;
1849
1850      // If this is the first element and the user wants to go backwards, then
1851      // jump to the last element.
1852      if (node == firstTabbableElement && evt.shiftKey) {
1853        if (!singleTabbableElement) {
1854          lastTabbableElement.focus();
1855        }
1856        return false;
1857      }
1858      // If this is the last element and the user wants to go forwards, then
1859      // jump to the first element.
1860      else if (node == lastTabbableElement && !evt.shiftKey) {
1861        if (!singleTabbableElement) {
1862          firstTabbableElement.focus();
1863        }
1864        return false;
1865      }
1866      // If this element isn't in the dialog at all, then jump to the first
1867      // or last element to get the user into the game.
1868      else if ($.inArray(node, tabbableElements) == -1) {
1869        // Make sure the node isn't in another modal (ie. WYSIWYG modal).
1870        var parents = $(node).parents().get();
1871        for (var i = 0; i < parents.length; ++i) {
1872          var position = $(parents[i]).css('position');
1873          if (position == 'absolute' || position == 'fixed') {
1874            return true;
1875          }
1876        }
1877
1878        if (evt.shiftKey) {
1879          lastTabbableElement.focus();
1880        }
1881        else {
1882          firstTabbableElement.focus();
1883        }
1884      }
1885    };
1886    $('body').bind('keydown', modalTabTrapHandler);
1887
1888    // Create our content div, get the dimensions, and hide it
1889    var modalContent = $('#modalContent').css('top','-1000px');
1890    var $modalHeader = modalContent.find('.modal-header');
1891    var mdcTop = wt + Math.max((winHeight / 2) - (modalContent.outerHeight() / 2), 0);
1892    var mdcLeft = ( winWidth / 2 ) - ( modalContent.outerWidth() / 2);
1893    $('#modalBackdrop').css(css).css('top', 0).css('height', docHeight + 'px').css('width', docWidth + 'px').show();
1894    modalContent.css({top: mdcTop + 'px', left: mdcLeft + 'px'}).hide()[animation](speed);
1895
1896    // Bind a click for closing the modalContent
1897    modalContentClose = function(){close(); return false;};
1898    $('.close', $modalHeader).bind('click', modalContentClose);
1899
1900    // Bind a keypress on escape for closing the modalContent
1901    modalEventEscapeCloseHandler = function(event) {
1902      if (event.keyCode == 27) {
1903        close();
1904        return false;
1905      }
1906    };
1907
1908    $(document).bind('keydown', modalEventEscapeCloseHandler);
1909
1910    // Per WAI-ARIA 1.0 Authoring Practices, initial focus should be on the
1911    // close button, but we should save the original focus to restore it after
1912    // the dialog is closed.
1913    var oldFocus = document.activeElement;
1914    $('.close', $modalHeader).focus();
1915
1916    // Close the open modal content and backdrop
1917    function close() {
1918      // Unbind the events
1919      $(window).unbind('resize',  modalContentResize);
1920      $('body').unbind( 'focus', modalEventHandler);
1921      $('body').unbind( 'keypress', modalEventHandler );
1922      $('body').unbind( 'keydown', modalTabTrapHandler );
1923      $('.close', $modalHeader).unbind('click', modalContentClose);
1924      $(document).unbind('keydown', modalEventEscapeCloseHandler);
1925      $(document).trigger('CToolsCloseModalBehaviors', $('#modalContent'));
1926      $(document).trigger('CToolsDetachBehaviors', $('#modalContent'));
1927
1928      // Closing animation.
1929      switch (animation) {
1930        case 'fadeIn':
1931          modalContent.fadeOut(speed, modalContentRemove);
1932          break;
1933
1934        case 'slideDown':
1935          modalContent.slideUp(speed, modalContentRemove);
1936          break;
1937
1938        case 'show':
1939          modalContent.hide(speed, modalContentRemove);
1940          break;
1941      }
1942    }
1943
1944    // Remove the content.
1945    modalContentRemove = function () {
1946      $('#modalContent').remove();
1947      $('#modalBackdrop').remove();
1948
1949      // Restore focus to where it was before opening the dialog.
1950      $(oldFocus).focus();
1951    };
1952
1953    // Move and resize the modalBackdrop and modalContent on window resize.
1954    modalContentResize = function () {
1955      // Reset the backdrop height/width to get accurate document size.
1956      $('#modalBackdrop').css('height', '').css('width', '');
1957
1958      // Position code lifted from:
1959      // http://www.quirksmode.org/viewport/compatibility.html
1960      if (self.pageYOffset) { // all except Explorer
1961        var wt = self.pageYOffset;
1962      } else if (document.documentElement && document.documentElement.scrollTop) { // Explorer 6 Strict
1963        var wt = document.documentElement.scrollTop;
1964      } else if (document.body) { // all other Explorers
1965        var wt = document.body.scrollTop;
1966      }
1967
1968      // Get our heights
1969      var docHeight = $(document).height();
1970      var docWidth = $(document).width();
1971      var winHeight = $(window).height();
1972      var winWidth = $(window).width();
1973      if( docHeight < winHeight ) docHeight = winHeight;
1974
1975      // Get where we should move content to
1976      var modalContent = $('#modalContent');
1977      var mdcTop = wt + Math.max((winHeight / 2) - (modalContent.outerHeight() / 2), 0);
1978      var mdcLeft = ( winWidth / 2 ) - ( modalContent.outerWidth() / 2);
1979
1980      // Apply the changes
1981      $('#modalBackdrop').css('height', docHeight + 'px').css('width', docWidth + 'px').show();
1982      modalContent.css('top', mdcTop + 'px').css('left', mdcLeft + 'px').show();
1983    };
1984    $(window).bind('resize', modalContentResize);
1985  };
1986
1987  /**
1988   * unmodalContent
1989   * @param content (The jQuery object to remove)
1990   * @param animation (fadeOut, slideUp, show)
1991   * @param speed (valid animation speeds slow, medium, fast or # in ms)
1992   */
1993  Drupal.CTools.Modal.unmodalContent = function(content, animation, speed)
1994  {
1995    // If our animation isn't set, make it just show/pop
1996    if (!animation) { var animation = 'show'; } else {
1997      // If our animation isn't "fade" then it always is show
1998      if (( animation != 'fadeOut' ) && ( animation != 'slideUp')) animation = 'show';
1999    }
2000    // Set a speed if we dont have one
2001    if ( !speed ) var speed = 'fast';
2002
2003    // Unbind the events we bound
2004    $(window).unbind('resize', modalContentResize);
2005    $('body').unbind('focus', modalEventHandler);
2006    $('body').unbind('keypress', modalEventHandler);
2007    $('body').unbind( 'keydown', modalTabTrapHandler );
2008    var $modalContent = $('#modalContent');
2009    var $modalHeader = $modalContent.find('.modal-header');
2010    $('.close', $modalHeader).unbind('click', modalContentClose);
2011    $(document).unbind('keydown', modalEventEscapeCloseHandler);
2012    $(document).trigger('CToolsDetachBehaviors', $modalContent);
2013
2014    // jQuery magic loop through the instances and run the animations or removal.
2015    content.each(function(){
2016      if ( animation == 'fade' ) {
2017        $('#modalContent').fadeOut(speed, function() {
2018          $('#modalBackdrop').fadeOut(speed, function() {
2019            $(this).remove();
2020          });
2021          $(this).remove();
2022        });
2023      } else {
2024        if ( animation == 'slide' ) {
2025          $('#modalContent').slideUp(speed,function() {
2026            $('#modalBackdrop').slideUp(speed, function() {
2027              $(this).remove();
2028            });
2029            $(this).remove();
2030          });
2031        } else {
2032          $('#modalContent').remove();
2033          $('#modalBackdrop').remove();
2034        }
2035      }
2036    });
2037  };
2038
2039$(function() {
2040  Drupal.ajax.prototype.commands.modal_display = Drupal.CTools.Modal.modal_display;
2041  Drupal.ajax.prototype.commands.modal_dismiss = Drupal.CTools.Modal.modal_dismiss;
2042});
2043
2044})(jQuery);
2045;
2046/**
2047* Provide the HTML to create the modal dialog.
2048*/
2049Drupal.theme.prototype.ModalFormsPopup = function () {
2050  var html = '';
2051
2052  html += '<div id="ctools-modal" class="popups-box">';
2053  html += '  <div class="ctools-modal-content modal-forms-modal-content">';
2054  html += '    <div class="popups-container">';
2055  html += '      <div class="modal-header popups-title">';
2056  html += '        <span id="modal-title" class="modal-title"></span>';
2057  html += '        <span class="popups-close close">' + Drupal.CTools.Modal.currentSettings.closeText + '</span>';
2058  html += '        <div class="clear-block"></div>';
2059  html += '      </div>';
2060  html += '      <div class="modal-scroll"><div id="modal-content" class="modal-content popups-body"></div></div>';
2061  html += '    </div>';
2062  html += '  </div>';
2063  html += '</div>';
2064
2065  return html;
2066}
2067;
2068(function($) {
2069Drupal.nagish = Drupal.nagish || {};
2070
2071Drupal.behaviors.nagishZoomIn = {
2072    attach: function(context, settings) {
2073        var currentSize = Drupal.nagish.getSetting('nagish_zoom') || 0;
2074        $("body").removeClass (function (index, css) {
2075            return (css.match (/(^|\s)nagish-zoom-\S+/g) || []).join(' ');
2076        }).addClass('nagish-zoom-' + currentSize);
2077
2078        $('*[data-nagish="zoom"]', context).bind('click', function(e) {
2079            e.preventDefault();
2080
2081            Drupal.nagish.active($(this), 'nagish-zoom');
2082
2083            if($(this).data('nagish_zoom_behaviors') == 'in') {
2084                currentSize++;
2085            }
2086            if($(this).data('nagish_zoom_behaviors') == 'out') {
2087                currentSize--;
2088            }
2089
2090            if (currentSize > 10) {
2091                currentSize = 10;
2092            }
2093            if (currentSize < -10) {
2094                currentSize = -10;
2095            }
2096
2097            $("body").removeClass (function (index, css) {
2098                return (css.match (/(^|\s)nagish-zoom-\S+/g) || []).join(' ');
2099            }).addClass('nagish-zoom-' + currentSize);
2100
2101            Drupal.nagish.setSetting('nagish_zoom', currentSize);
2102        });
2103    }
2104}
2105
2106})(jQuery);
2107;
2108(function($) {
2109
2110Drupal.behaviors.nagishContrast = {
2111    attach: function(context, settings) {
2112        $('*[data-nagish="contrast"]', context).bind('click', function(e) {
2113            e.preventDefault();
2114            Drupal.nagish.active($(this), 'nagish-contrast');
2115        });
2116    }
2117}
2118
2119})(jQuery);;
2120(function($) {
2121
2122Drupal.behaviors.nagishGrayscale = {
2123    attach: function(context, settings) {
2124        $('*[data-nagish="grayscale"]', context).bind('click', function(e) {
2125            e.preventDefault();
2126            Drupal.nagish.active($(this), 'nagish-grayscale');
2127        });
2128    }
2129}
2130
2131})(jQuery);;
2132(function($) {
2133
2134Drupal.behaviors.nagishInvert = {
2135    attach: function(context, settings) {
2136        $('*[data-nagish="invert"]', context).bind('click', function(e) {
2137            e.preventDefault();
2138            Drupal.nagish.active($(this), 'nagish-invert');
2139        });
2140    }
2141}
2142
2143})(jQuery);;
2144(function($) {
2145
2146Drupal.behaviors.nagishReset = {
2147    attach: function(context, settings) {
2148        $('*[data-nagish="reset"]', context).bind('click', function(e) {
2149            e.preventDefault();
2150            $('body').removeClass(Drupal.nagish.getSetting('active'));
2151            Drupal.nagish.resetSettings();
2152            location.reload();
2153        });
2154    }
2155}
2156
2157})(jQuery);;
2158/**
2159 * @file
2160 * Simple responsification of menus.
2161 */
2162(function ($) {
2163  /**
2164   * Handle clicks & toggling the menu.
2165   */
2166  var toggler_click = function() {
2167    $(this).parent().toggleClass('responsive-toggled');
2168  };
2169  /**
2170   * Unbind other mouse events on the menu items.
2171   *
2172   * @todo
2173   *   Not sure if it works 100%.
2174   *   Doesn't restore binds when out-of-responsive (if window dragging).
2175   */
2176  function remove_mouse_events(menuElement) {
2177    // Determine jQuery version and what disable options we have.
2178    var jqVersion = $.fn.jquery;
2179    if (jqVersion < 1.7) {
2180      $(menuElement).die('mouseover mouseout mouseenter mouseleave');
2181      $(menuElement + ' li').die('mouseover mouseout mouseenter mouseleave');
2182      $(menuElement + ' li a').die('mouseover mouseout mouseenter mouseleave');
2183    }
2184    else {
2185      $(menuElement).off('hover');
2186      $(menuElement + ' li').off('hover');
2187      $(menuElement + ' li a').off('hover');
2188    }
2189    $(menuElement).unbind('mouseover mouseout mouseenter mouseleave');
2190    $(menuElement + ' li').unbind('mouseover mouseout mouseenter mouseleave');
2191    $(menuElement + ' li a').unbind('mouseover mouseout mouseenter mouseleave');
2192  }
2193
2194  /**
2195   * Store classes & IDs for restoring later (if window dragging).
2196   */
2197  function store_classes_ids(menuElement) {
2198    if (!$(menuElement).attr('id')) {
2199      $(menuElement).attr('id', 'rm-no-id-main');
2200    }
2201    if (!$(menuElement).attr('class')) {
2202      $(menuElement).attr('class', 'rm-no-class');
2203    }
2204    $(menuElement).data('removeattr', true)
2205      .data('rmids', $(menuElement).attr('id'))
2206      .data('rmclasses', $(menuElement).attr('class'));
2207    // Handle ULs if selector is parent div.
2208    var incr = 0;
2209    $(menuElement).find('ul').each(function() {
2210      incr++;
2211      // Prevent error if there is no id.
2212      if (!$(this).attr('id')) {
2213        $(this).attr('id', 'rm-no-id-' + incr);
2214      }
2215      // Prevent error if there is no class.
2216      if (!$(this).attr('class')) {
2217        $(this).attr('class', 'rm-no-class');
2218      }
2219      $(this).data('removeattr', true)
2220        .data('rmids', $(this).attr('id'))
2221        .data('rmclasses', $(this).attr('class'));
2222    });
2223    // Finally, add our class to the parent.
2224    $(menuElement).addClass('responsive-menus-simple');
2225  }
2226
2227  /**
2228   * Remove classes & IDs from original menu for easier theming.
2229   */
2230  function remove_classes_ids(menuElement) {
2231    // Handle ULs if selector is parent div.
2232    $(menuElement).find('ul').each(function() {
2233      $(this).attr('class', 'rm-removed').attr('id', 'rm-removed');
2234    });
2235    // Remove classes/IDs.
2236    $(menuElement).attr('class', 'responsive-menus-simple').attr('id', 'rm-removed');
2237  }
2238
2239  // Iterate through selectors, check window sizes, add some classes.
2240  Drupal.behaviors.responsive_menus = {
2241    attach: function (context, settings) {
2242      settings.responsive_menus = settings.responsive_menus || {};
2243      $('body').once('responsive-menus-load', function() {
2244        // Only doing this themes that don't include a viewport attribute.
2245        // e.g. Bartik for testing out-of-the-box... yeah, stupid.
2246        if (!$('meta[name=viewport]').length > 0) {
2247          $('head').append('<meta name="viewport" content="width=device-width, initial-scale=1.0">');
2248        }
2249        // Window width with legacy browsers.
2250        var windowWidth = window.innerWidth || document.documentElement.clientWidth || document.body.clientWidth;
2251        $.each(settings.responsive_menus, function(ind, iteration) {
2252          if (iteration.responsive_menus_style != 'responsive_menus_simple') {
2253            return true;
2254          }
2255          if (!iteration.selectors.length) {
2256            return true;
2257          }
2258          var $media_unit = iteration.media_unit || 'px';
2259          if ($media_unit === 'em') {
2260            var $base_font_size = parseFloat($('body').css('font-size'));
2261            var $media_size = iteration.media_size * $base_font_size || 768;
2262          }
2263          else {
2264            var $media_size = iteration.media_size || 768;
2265          }
2266
2267          // Handle clicks & toggling.
2268          var toggler_class = '';
2269          var toggler_text = iteration.toggler_text;
2270          // Iterate through our selectors.
2271          $.each(iteration.selectors, function(index, value) {
2272            // Stop if there is no menu element.
2273            if ($(value).length < 1) {
2274              return true;
2275            }
2276            // Handle nested menus.  Make sure we get the first, but not children.
2277            if ($(value).length > 1) {
2278              $(value).each(function(val_index) {
2279                if (!$(this).parents('ul').length) {
2280                  if (!$(this).hasClass('responsive-menus-simple')) {
2281                    toggler_class = 'responsive-menus-' + ind + '-' + index + '-' + val_index;
2282                    // Store classes & IDs before removing.
2283                    if (iteration.remove_attributes) {
2284                      store_classes_ids(this);
2285                    }
2286                    $(this).wrap('<div data-mediasize="' + $media_size + '" class="responsive-menus ' + toggler_class + '" />');
2287                    $('.' + toggler_class).prepend('<span class="toggler">' + toggler_text + '</span>');
2288                    $('.' + toggler_class + ' .toggler').bind('click', toggler_click);
2289                    // Unbind other mouse events.
2290                    if (iteration.disable_mouse_events) {
2291                      //$(this).data('disablemouse', true);
2292                      remove_mouse_events(this);
2293                    }
2294                    // Use absolute positioning.
2295                    if (iteration.absolute) {
2296                      $('.' + toggler_class).addClass('absolute');
2297                    }
2298                    // Handle first size check.
2299                    if (windowWidth <= $media_size) {
2300                      // Remove attributes setting.
2301                      if (iteration.remove_attributes) {
2302                        remove_classes_ids(this);
2303                      }
2304                      $('.' + toggler_class).addClass('responsified');
2305                    }
2306                  }
2307                }
2308              });
2309            }
2310            else {
2311              // Single level menus.
2312              if (!$(value).hasClass('responsive-menus-simple')) {
2313                toggler_class = 'responsive-menus-' + ind + '-' + index;
2314                // Store classes & IDs before removing.
2315                if (iteration.remove_attributes) {
2316                  store_classes_ids(value);
2317                }
2318                $(value).wrap('<div data-mediasize="' + $media_size + '" class="responsive-menus ' + toggler_class + '" />');
2319                $('.' + toggler_class).prepend('<span class="toggler">' + toggler_text + '</span>');
2320                $('.' + toggler_class + ' .toggler').bind('click', toggler_click);
2321                // Unbind other mouse events.
2322                if (iteration.disable_mouse_events) {
2323                  // @todo For rebinding mouse events.
2324                  /*if ($(value + ' li a').data('events')) {
2325                    $(value).data('tmpevents', $(value + ' li a').data('events'));
2326                  }*/
2327                  remove_mouse_events(value);
2328                }
2329                // Use absolute positioning.
2330                if (iteration.absolute) {
2331                  $('.' + toggler_class).addClass('absolute');
2332                }
2333                // Handle first size check.
2334                if (windowWidth <= $media_size) {
2335                  // Remove attributes setting.
2336                  if (iteration.remove_attributes) {
2337                    remove_classes_ids(value);
2338                  }
2339                  $('.' + toggler_class).addClass('responsified');
2340                }
2341              }
2342            }
2343          });
2344       });
2345        // Handle window resizing.
2346        $(window).resize(function() {
2347          // Window width with legacy browsers.
2348          windowWidth = window.innerWidth || document.documentElement.clientWidth || document.body.clientWidth;
2349          $('.responsive-menus').each(function(menuIndex, menuValue) {
2350            var mediasize = $(this).data('mediasize') || 768;
2351            // Prevent menu from going off the screen.  This only happens in
2352            // non-responsive themes (like Bartik default), but it looks bad.
2353            if ($(this).width() > windowWidth) {
2354              $(this).data('nonresponsive', true);
2355              $(this).width(windowWidth);
2356            }
2357            var menuElement = $(this).find('.responsive-menus-simple');
2358            if (windowWidth >= mediasize) {
2359              if (menuElement.data('removeattr')) {
2360                menuElement.addClass(menuElement.data('rmclasses'));
2361                menuElement.attr('id', menuElement.data('rmids'));
2362                menuElement.find('ul').each(function() {
2363                  $(this).addClass($(this).data('rmclasses'));
2364                  $(this).attr('id', $(this).data('rmids'));
2365                });
2366              }
2367              $(this).removeClass('responsified');
2368            }
2369            if (windowWidth <= mediasize) {
2370              // Now fix repercussions for handling non-responsive themes above.
2371              // Stretch width back out w/ the screen.
2372              if ($(this).data('nonresponsive') && $(this).width() < windowWidth) {
2373                $(this).width(windowWidth);
2374              }
2375              if (menuElement.data('removeattr')) {
2376                remove_classes_ids(menuElement);
2377              }
2378              $(this).addClass('responsified');
2379            }
2380          });
2381        });
2382      });
2383    }
2384  };
2385
2386}(jQuery));
2387;
2388(function($) {
2389  Drupal.behaviors.wrs = {
2390    attach: function(context, settings) {
2391      var pageTitle   = document.title; //HTML page title
2392      var pageUrl     = location.href; //Location of this page
2393      
2394      $('.share-btn-wrp li').click(function(event) {
2395          var shareName = $(this).attr('class').split(' ')[0]; //get the first class name of clicked element
2396
2397          switch (shareName) //switch to different links based on different social name
2398          {
2399              case 'facebook':
2400                  var openLink = 'https://www.facebook.com/sharer/sharer.php?u=' + encodeURIComponent(pageUrl) + '&amp;title=' + encodeURIComponent(pageTitle);
2401                  break;
2402              case 'twitter':
2403                  var openLink = 'http://twitter.com/home?status=' + encodeURIComponent(pageTitle + ' ' + pageUrl);
2404                  break;
2405              case 'digg':
2406                  var openLink = 'http://www.digg.com/submit?phase=2&amp;url=' + encodeURIComponent(pageUrl) + '&amp;title=' + encodeURIComponent(pageTitle);
2407                  break;
2408              case 'stumbleupon':
2409                  var openLink = 'http://www.stumbleupon.com/submit?url=' + encodeURIComponent(pageUrl) + '&amp;title=' + encodeURIComponent(pageTitle);
2410                  break;
2411              case 'delicious':
2412                  var openLink = 'http://del.icio.us/post?url=' + encodeURIComponent(pageUrl) + '&amp;title=' + encodeURIComponent(pageTitle);
2413                  break;
2414              case 'gplus':
2415                  var openLink = 'https://plus.google.com/share?url=' + encodeURIComponent(pageUrl) + '&amp;title=' + encodeURIComponent(pageTitle);
2416                  break;
2417              case 'email':
2418                  var openLink = 'mailto:?subject=' + encodeURIComponent(pageTitle) + '&body=Found this useful link for you : ' + encodeURIComponent(pageUrl);
2419                  break;
2420              case 'whatsapp':
2421                  var openLink = "https://api.whatsapp.com/send?text=" + encodeURIComponent(pageUrl);
2422                  break;
2423          }
2424        
2425        //Parameters for the Popup window
2426        winWidth 	= 650;	
2427        winHeight	= 450;
2428        winLeft   	= ($(window).width()  - winWidth)  / 2,
2429        winTop    	= ($(window).height() - winHeight) / 2,	
2430        winOptions   = 'width='  + winWidth  + ',height=' + winHeight + ',top='    + winTop    + ',left='   + winLeft;
2431        
2432        //open Popup window and redirect user to share website.
2433        window.open(openLink,'Share This Link',winOptions);
2434        return false;
2435      });
2436
2437      $(".share-btn-wrp li").keydown(function (e){
2438        if(e.keyCode == 13){
2439          $(this).click();
2440        }
2441      });
2442     
2443    }
2444  }
2445})(jQuery);
2446;
2447(function ($, Drupal) {
2448
2449    Drupal.behaviors.mobileMenu = {
2450        attach: function(context, settings) {
2451
2452            // $(".main-menu-mobile li a").click(function(e){
2453            //     //e.preventDefault();
2454            //     var item = $(this).parent();
2455            //     var parent = item.parent().parent();
2456            //
2457            //     if(item.hasClass("expanded") && parent.hasClass("main-menu-mobile")){
2458            //         e.preventDefault();
2459            //         if(item.hasClass("active")){
2460            //             item.removeClass("active");
2461            //         }else{
2462            //             item.addClass("active");
2463            //         }
2464            //     }
2465            // });
2466            $(".responsive-menus .toggler").html('<span class="responsive-bottom" role="button" tabindex="1"><span class="responsive-top"><img src="//weizmann.ac.il/feinberg/sites/feinberg/themes/weizmann_theme/images/mobile_menu_white.svg" title="mobile menu" alt="mobile menu" /></span>');
2467
2468
2469        }
2470    };
2471
2472
2473
2474
2475})(jQuery, Drupal);;
2476/**
2477 * Created by semionzaslavsky on 1/20/15.
2478 */
2479(function ($, Drupal, window, document, undefined) {
2480
2481
2482// Place your code here.
2483
2484
2485})(jQuery, Drupal, this, this.document);
2486
2487(function ($) {
2488
2489    $(document).ready(function() {
2490
2491        $(".question-wrapper").bind("keypress mousedown",function() {
2492
2493            //console.log("title: " + $(this).parent(".faq-wrapper").find(".answer-wrapper").hasClass("active"));
2494            if($(this).parent(".faq-wrapper").find(".answer-wrapper").hasClass("active")) {
2495            	$(this).children("h2").attr("aria-expanded","false");
2496                $(this).parent(".faq-wrapper").find(".answer-wrapper").removeClass("active");
2497                $(this).parent(".faq-wrapper").removeClass("active");
2498            }else{
2499            	$(this).children("h2").attr("aria-expanded","true");
2500                $(this).parent(".faq-wrapper").find(".answer-wrapper").addClass("active");
2501                $(this).parent(".faq-wrapper").addClass("active");
2502            }
2503
2504        });
2505    });
2506})(jQuery);;

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