Drupal.locale = { 'pluralFormula': function ($n) { return Number(($n!=1)); }, 'strings': {"":{"An AJAX HTTP error occurred.":"Ocorreu um erro HTTP no Ajax.","HTTP Result Code: !status":"C\u00f3digo de Resultado HTTP: !status","An AJAX HTTP request terminated abnormally.":"Um pedido HTTP Ajax terminou com anomalia.","Debugging information follows.":"Segue informa\u00e7\u00e3o para depura\u00e7\u00e3o.","Path: !uri":"Caminho: !uri","StatusText: !statusText":"Texto de Estado: !statusText","ResponseText: !responseText":"Texto de Resposta: !responsetext","ReadyState: !readyState":"ReadyState: !readyState","Loading":"A carregar","(active tab)":"(separador ativo)","@title dialog":"Di\u00e1logo @title","Please wait...":"Aguarde...","Configure":"Configurar","Re-order rows by numerical weight instead of dragging.":"Re-ordenar linhas por peso num\u00e9rico em vez de as arrastar.","Show row weights":"Mostrar coluna de pesos","Hide row weights":"Ocultar coluna de pesos","Drag to re-order":"Arraste para reordenar.","Changes made in this table will not be saved until the form is submitted.":"As altera\u00e7\u00f5es efectuadas nesta tabela n\u00e3o ir\u00e3o ser guardadas at\u00e9 que o formul\u00e1rio seja enviado.","Hide":"Esconder","Show":"Mostrar","Edit":"Editar","Select all rows in this table":"Marcar todas as colunas nesta tabela.","Deselect all rows in this table":"Desmarcar todas as colunas nesta tabela.","Not published":"N\u00e3o publicado","Not in book":"Inexistente em livro","New book":"Novo livro","By @name on @date":"Por @name em @date","By @name":"Por @name","Not in menu":"N\u00e3o presente no menu","Alias: @alias":"Caminho alternativo: @alias","No alias":"Nenhum caminho alternativo","New revision":"Nova revis\u00e3o","No revision":"Nenhuma revis\u00e3o","@number comments per page":"@number coment\u00e1rios por p\u00e1gina","Requires a title":"Requer um t\u00edtulo","Hide summary":"Ocultar sum\u00e1rio","Edit summary":"Editar sum\u00e1rio","Don't display post information":"N\u00e3o mostrar a informa\u00e7\u00e3o do artigo","The selected file %filename cannot be uploaded. Only files with the following extensions are allowed: %extensions.":"O ficheiro selecionado %filename n\u00e3o pode ser carregado. Apenas ficheiros com as seguintes extens\u00f5es s\u00e3o permitidos: %extensions.","Autocomplete popup":"Pop-up de preenchimento autom\u00e1tico","Searching for matches...":"Procurando por correspond\u00eancias...","Automatic alias":"Caminho alternativo autom\u00e1tico"}} };;
// ColorBox v1.3.16 - a full featured, light-weight, customizable lightbox based on jQuery 1.3+
// Copyright (c) 2011 Jack Moore - jack@colorpowered.com
// Licensed under the MIT license: http://www.opensource.org/licenses/mit-license.php
(function ($, document, window) {
	var
	// ColorBox Default Settings.	
	// See http://colorpowered.com/colorbox for details.
	defaults = {
		transition: "elastic",
		speed: 300,
		width: false,
		initialWidth: "600",
		innerWidth: false,
		maxWidth: false,
		height: false,
		initialHeight: "450",
		innerHeight: false,
		maxHeight: false,
		scalePhotos: true,
		scrolling: true,
		inline: false,
		html: false,
		iframe: false,
		fastIframe: true,
		photo: false,
		href: false,
		title: false,
		rel: false,
		opacity: 0.9,
		preloading: true,
		current: "image {current} of {total}",
		previous: "previous",
		next: "next",
		close: "close",
		open: false,
		returnFocus: true,
		loop: true,
		slideshow: false,
		slideshowAuto: true,
		slideshowSpeed: 2500,
		slideshowStart: "start slideshow",
		slideshowStop: "stop slideshow",
		onOpen: false,
		onLoad: false,
		onComplete: false,
		onCleanup: false,
		onClosed: false,
		overlayClose: true,		
		escKey: true,
		arrowKey: true
	},
	
	// Abstracting the HTML and event identifiers for easy rebranding
	colorbox = 'colorbox',
	prefix = 'cbox',
	
	// Events	
	event_open = prefix + '_open',
	event_load = prefix + '_load',
	event_complete = prefix + '_complete',
	event_cleanup = prefix + '_cleanup',
	event_closed = prefix + '_closed',
	event_purge = prefix + '_purge',
	
	// Special Handling for IE
	isIE = $.browser.msie && !$.support.opacity, // feature detection alone gave a false positive on at least one phone browser and on some development versions of Chrome.
	isIE6 = isIE && $.browser.version < 7,
	event_ie6 = prefix + '_IE6',

	// Cached jQuery Object Variables
	$overlay,
	$box,
	$wrap,
	$content,
	$topBorder,
	$leftBorder,
	$rightBorder,
	$bottomBorder,
	$related,
	$window,
	$loaded,
	$loadingBay,
	$loadingOverlay,
	$title,
	$current,
	$slideshow,
	$next,
	$prev,
	$close,
	$groupControls,

	// Variables for cached values or use across multiple functions
	settings = {},
	interfaceHeight,
	interfaceWidth,
	loadedHeight,
	loadedWidth,
	element,
	index,
	photo,
	open,
	active,
	closing = false,
	
	publicMethod,
	boxElement = prefix + 'Element';
	
	// ****************
	// HELPER FUNCTIONS
	// ****************

	// jQuery object generator to reduce code size
	function $div(id, cssText) { 
		var div = document.createElement('div');
		if (id) {
            div.id = prefix + id;
        }
		div.style.cssText = cssText || false;
		return $(div);
	}

	// Convert % values to pixels
	function setSize(size, dimension) {
		dimension = dimension === 'x' ? $window.width() : $window.height();
		return (typeof size === 'string') ? Math.round((/%/.test(size) ? (dimension / 100) * parseInt(size, 10) : parseInt(size, 10))) : size;
	}
	
	// Checks an href to see if it is a photo.
	// There is a force photo option (photo: true) for hrefs that cannot be matched by this regex.
	function isImage(url) {
		return settings.photo || /\.(gif|png|jpg|jpeg|bmp)(?:\?([^#]*))?(?:#(\.*))?$/i.test(url);
	}
	
	// Assigns function results to their respective settings.  This allows functions to be used as values.
	function process(settings) {
		for (var i in settings) {
			if ($.isFunction(settings[i]) && i.substring(0, 2) !== 'on') { // checks to make sure the function isn't one of the callbacks, they will be handled at the appropriate time.
			    settings[i] = settings[i].call(element);
			}
		}
		settings.rel = settings.rel || element.rel || 'nofollow';
		settings.href = $.trim(settings.href || $(element).attr('href'));
		settings.title = settings.title || element.title;
	}

	function trigger(event, callback) {
		if (callback) {
			callback.call(element);
		}
		$.event.trigger(event);
	}

	// Slideshow functionality
	function slideshow() {
		var
		timeOut,
		className = prefix + "Slideshow_",
		click = "click." + prefix,
		start,
		stop,
		clear;
		
		if (settings.slideshow && $related[1]) {
			start = function () {
				$slideshow
					.text(settings.slideshowStop)
					.unbind(click)
					.bind(event_complete, function () {
						if (index < $related.length - 1 || settings.loop) {
							timeOut = setTimeout(publicMethod.next, settings.slideshowSpeed);
						}
					})
					.bind(event_load, function () {
						clearTimeout(timeOut);
					})
					.one(click + ' ' + event_cleanup, stop);
				$box.removeClass(className + "off").addClass(className + "on");
				timeOut = setTimeout(publicMethod.next, settings.slideshowSpeed);
			};
			
			stop = function () {
				clearTimeout(timeOut);
				$slideshow
					.text(settings.slideshowStart)
					.unbind([event_complete, event_load, event_cleanup, click].join(' '))
					.one(click, start);
				$box.removeClass(className + "on").addClass(className + "off");
			};
			
			if (settings.slideshowAuto) {
				start();
			} else {
				stop();
			}
		}
	}

	function launch(elem) {
		if (!closing) {
			
			element = elem;
			
			process($.extend(settings, $.data(element, colorbox)));
			
			$related = $(element);
			
			index = 0;
			
			if (settings.rel !== 'nofollow') {
				$related = $('.' + boxElement).filter(function () {
					var relRelated = $.data(this, colorbox).rel || this.rel;
					return (relRelated === settings.rel);
				});
				index = $related.index(element);
				
				// Check direct calls to ColorBox.
				if (index === -1) {
					$related = $related.add(element);
					index = $related.length - 1;
				}
			}
			
			if (!open) {
				open = active = true; // Prevents the page-change action from queuing up if the visitor holds down the left or right keys.
				
				$box.show();
				
				if (settings.returnFocus) {
					try {
						element.blur();
						$(element).one(event_closed, function () {
							try {
								this.focus();
							} catch (e) {
								// do nothing
							}
						});
					} catch (e) {
						// do nothing
					}
				}
				
				// +settings.opacity avoids a problem in IE when using non-zero-prefixed-string-values, like '.5'
				$overlay.css({"opacity": +settings.opacity, "cursor": settings.overlayClose ? "pointer" : "auto"}).show();
				
				// Opens inital empty ColorBox prior to content being loaded.
				settings.w = setSize(settings.initialWidth, 'x');
				settings.h = setSize(settings.initialHeight, 'y');
				publicMethod.position(0);
				
				if (isIE6) {
					$window.bind('resize.' + event_ie6 + ' scroll.' + event_ie6, function () {
						$overlay.css({width: $window.width(), height: $window.height(), top: $window.scrollTop(), left: $window.scrollLeft()});
					}).trigger('resize.' + event_ie6);
				}
				
				trigger(event_open, settings.onOpen);
				
				$groupControls.add($title).hide();
				
				$close.html(settings.close).show();
			}
			
			publicMethod.load(true);
		}
	}

	// ****************
	// PUBLIC FUNCTIONS
	// Usage format: $.fn.colorbox.close();
	// Usage from within an iframe: parent.$.fn.colorbox.close();
	// ****************
	
	publicMethod = $.fn[colorbox] = $[colorbox] = function (options, callback) {
		var $this = this, autoOpen;
		
		if (!$this[0] && $this.selector) { // if a selector was given and it didn't match any elements, go ahead and exit.
			return $this;
		}
		
		options = options || {};
		
		if (callback) {
			options.onComplete = callback;
		}
		
		if (!$this[0] || $this.selector === undefined) { // detects $.colorbox() and $.fn.colorbox()
			$this = $('<a/>');
			options.open = true; // assume an immediate open
		}
		
		$this.each(function () {
			$.data(this, colorbox, $.extend({}, $.data(this, colorbox) || defaults, options));
			$(this).addClass(boxElement);
		});
		
		autoOpen = options.open;
		
		if ($.isFunction(autoOpen)) {
			autoOpen = autoOpen.call($this);
		}
		
		if (autoOpen) {
			launch($this[0]);
		}
		
		return $this;
	};

	// Initialize ColorBox: store common calculations, preload the interface graphics, append the html.
	// This preps colorbox for a speedy open when clicked, and lightens the burdon on the browser by only
	// having to run once, instead of each time colorbox is opened.
	publicMethod.init = function () {
		// Create & Append jQuery Objects
		$window = $(window);
		$box = $div().attr({id: colorbox, 'class': isIE ? prefix + (isIE6 ? 'IE6' : 'IE') : ''});
		$overlay = $div("Overlay", isIE6 ? 'position:absolute' : '').hide();
		
		$wrap = $div("Wrapper");
		$content = $div("Content").append(
			$loaded = $div("LoadedContent", 'width:0; height:0; overflow:hidden'),
			$loadingOverlay = $div("LoadingOverlay").add($div("LoadingGraphic")),
			$title = $div("Title"),
			$current = $div("Current"),
			$next = $div("Next"),
			$prev = $div("Previous"),
			$slideshow = $div("Slideshow").bind(event_open, slideshow),
			$close = $div("Close")
		);
		$wrap.append( // The 3x3 Grid that makes up ColorBox
			$div().append(
				$div("TopLeft"),
				$topBorder = $div("TopCenter"),
				$div("TopRight")
			),
			$div(false, 'clear:left').append(
				$leftBorder = $div("MiddleLeft"),
				$content,
				$rightBorder = $div("MiddleRight")
			),
			$div(false, 'clear:left').append(
				$div("BottomLeft"),
				$bottomBorder = $div("BottomCenter"),
				$div("BottomRight")
			)
		).children().children().css({'float': 'left'});
		
		$loadingBay = $div(false, 'position:absolute; width:9999px; visibility:hidden; display:none');
		
		$('body').prepend($overlay, $box.append($wrap, $loadingBay));
		
		$content.children()
		.hover(function () {
			$(this).addClass('hover');
		}, function () {
			$(this).removeClass('hover');
		}).addClass('hover');
		
		// Cache values needed for size calculations
		interfaceHeight = $topBorder.height() + $bottomBorder.height() + $content.outerHeight(true) - $content.height();//Subtraction needed for IE6
		interfaceWidth = $leftBorder.width() + $rightBorder.width() + $content.outerWidth(true) - $content.width();
		loadedHeight = $loaded.outerHeight(true);
		loadedWidth = $loaded.outerWidth(true);
		
		// Setting padding to remove the need to do size conversions during the animation step.
		$box.css({"padding-bottom": interfaceHeight, "padding-right": interfaceWidth}).hide();
		
                // Setup button events.
                $next.click(function () {
                        publicMethod.next();
                });
                $prev.click(function () {
                        publicMethod.prev();
                });
                $close.click(function () {
                        publicMethod.close();
                });
		
		$groupControls = $next.add($prev).add($current).add($slideshow);
		
		// Adding the 'hover' class allowed the browser to load the hover-state
		// background graphics.  The class can now can be removed.
		$content.children().removeClass('hover');
		
		$('.' + boxElement).live('click', function (e) {
			// checks to see if it was a non-left mouse-click and for clicks modified with ctrl, shift, or alt.
			if (!((e.button !== 0 && typeof e.button !== 'undefined') || e.ctrlKey || e.shiftKey || e.altKey)) {
				e.preventDefault();
				launch(this);
			}
		});
		
		$overlay.click(function () {
			if (settings.overlayClose) {
				publicMethod.close();
			}
		});
		
		// Set Navigation Key Bindings
		$(document).bind('keydown.' + prefix, function (e) {
                        var key = e.keyCode;
			if (open && settings.escKey && key === 27) {
				e.preventDefault();
				publicMethod.close();
			}
			if (open && settings.arrowKey && $related[1]) {
				if (key === 37) {
					e.preventDefault();
					$prev.click();
				} else if (key === 39) {
					e.preventDefault();
					$next.click();
				}
			}
		});
	};
	
	publicMethod.remove = function () {
		$box.add($overlay).remove();
		$('.' + boxElement).die('click').removeData(colorbox).removeClass(boxElement);
	};

	publicMethod.position = function (speed, loadedCallback) {
		var
		animate_speed,
		// keeps the top and left positions within the browser's viewport.
		posTop = Math.max(document.documentElement.clientHeight - settings.h - loadedHeight - interfaceHeight, 0) / 2 + $window.scrollTop(),
		posLeft = Math.max($window.width() - settings.w - loadedWidth - interfaceWidth, 0) / 2 + $window.scrollLeft();
		
		// setting the speed to 0 to reduce the delay between same-sized content.
		animate_speed = ($box.width() === settings.w + loadedWidth && $box.height() === settings.h + loadedHeight) ? 0 : speed;
		
		// this gives the wrapper plenty of breathing room so it's floated contents can move around smoothly,
		// but it has to be shrank down around the size of div#colorbox when it's done.  If not,
		// it can invoke an obscure IE bug when using iframes.
		$wrap[0].style.width = $wrap[0].style.height = "9999px";
		
		function modalDimensions(that) {
			// loading overlay height has to be explicitly set for IE6.
			$topBorder[0].style.width = $bottomBorder[0].style.width = $content[0].style.width = that.style.width;
			$loadingOverlay[0].style.height = $loadingOverlay[1].style.height = $content[0].style.height = $leftBorder[0].style.height = $rightBorder[0].style.height = that.style.height;
		}
		
		$box.dequeue().animate({width: settings.w + loadedWidth, height: settings.h + loadedHeight, top: posTop, left: posLeft}, {
			duration: animate_speed,
			complete: function () {
				modalDimensions(this);
				
				active = false;
				
				// shrink the wrapper down to exactly the size of colorbox to avoid a bug in IE's iframe implementation.
				$wrap[0].style.width = (settings.w + loadedWidth + interfaceWidth) + "px";
				$wrap[0].style.height = (settings.h + loadedHeight + interfaceHeight) + "px";
				
				if (loadedCallback) {
					loadedCallback();
				}
			},
			step: function () {
				modalDimensions(this);
			}
		});
	};

	publicMethod.resize = function (options) {
		if (open) {
			options = options || {};
			
			if (options.width) {
				settings.w = setSize(options.width, 'x') - loadedWidth - interfaceWidth;
			}
			if (options.innerWidth) {
				settings.w = setSize(options.innerWidth, 'x');
			}
			$loaded.css({width: settings.w});
			
			if (options.height) {
				settings.h = setSize(options.height, 'y') - loadedHeight - interfaceHeight;
			}
			if (options.innerHeight) {
				settings.h = setSize(options.innerHeight, 'y');
			}
			if (!options.innerHeight && !options.height) {				
				var $child = $loaded.wrapInner("<div style='overflow:auto'></div>").children(); // temporary wrapper to get an accurate estimate of just how high the total content should be.
				settings.h = $child.height();
				$child.replaceWith($child.children()); // ditch the temporary wrapper div used in height calculation
			}
			$loaded.css({height: settings.h});
			
			publicMethod.position(settings.transition === "none" ? 0 : settings.speed);
		}
	};

	publicMethod.prep = function (object) {
		if (!open) {
			return;
		}
		
		var speed = settings.transition === "none" ? 0 : settings.speed;
		
		$window.unbind('resize.' + prefix);
		$loaded.remove();
		$loaded = $div('LoadedContent').html(object);
		
		function getWidth() {
			settings.w = settings.w || $loaded.width();
			settings.w = settings.mw && settings.mw < settings.w ? settings.mw : settings.w;
			return settings.w;
		}
		function getHeight() {
			settings.h = settings.h || $loaded.height();
			settings.h = settings.mh && settings.mh < settings.h ? settings.mh : settings.h;
			return settings.h;
		}
		
		$loaded.hide()
		.appendTo($loadingBay.show())// content has to be appended to the DOM for accurate size calculations.
		.css({width: getWidth(), overflow: settings.scrolling ? 'auto' : 'hidden'})
		.css({height: getHeight()})// sets the height independently from the width in case the new width influences the value of height.
		.prependTo($content);
		
		$loadingBay.hide();
		
		// 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.
		//$(photo).css({'float': 'none', marginLeft: 'auto', marginRight: 'auto'});
		
                $(photo).css({'float': 'none'});
                
		// Hides SELECT elements in IE6 because they would otherwise sit on top of the overlay.
		if (isIE6) {
			$('select').not($box.find('select')).filter(function () {
				return this.style.visibility !== 'hidden';
			}).css({'visibility': 'hidden'}).one(event_cleanup, function () {
				this.style.visibility = 'inherit';
			});
		}
		
		function setPosition(s) {
			publicMethod.position(s, function () {
				var prev, prevSrc, next, nextSrc, total = $related.length, iframe, complete;
				
				if (!open) {
					return;
				}
				
				complete = function () {
					$loadingOverlay.hide();
					trigger(event_complete, settings.onComplete);
				};
				
				if (isIE) {
					//This fadeIn helps the bicubic resampling to kick-in.
					if (photo) {
						$loaded.fadeIn(100);
					}
				}
				
				$title.html(settings.title).add($loaded).show();
				
				if (total > 1) { // handle grouping
					if (typeof settings.current === "string") {
						$current.html(settings.current.replace(/\{current\}/, index + 1).replace(/\{total\}/, total)).show();
					}
					
					$next[(settings.loop || index < total - 1) ? "show" : "hide"]().html(settings.next);
					$prev[(settings.loop || index) ? "show" : "hide"]().html(settings.previous);
					
					prev = index ? $related[index - 1] : $related[total - 1];
					next = index < total - 1 ? $related[index + 1] : $related[0];
					
					if (settings.slideshow) {
						$slideshow.show();
					}
					
					// Preloads images within a rel group
					if (settings.preloading) {
						nextSrc = $.data(next, colorbox).href || next.href;
						prevSrc = $.data(prev, colorbox).href || prev.href;
						
						nextSrc = $.isFunction(nextSrc) ? nextSrc.call(next) : nextSrc;
						prevSrc = $.isFunction(prevSrc) ? prevSrc.call(prev) : prevSrc;
						
						if (isImage(nextSrc)) {
							$('<img/>')[0].src = nextSrc;
						}
						
						if (isImage(prevSrc)) {
							$('<img/>')[0].src = prevSrc;
						}
					}
				} else {
					$groupControls.hide();
				}
				
				if (settings.iframe) {
					iframe = $('<iframe/>').addClass(prefix + 'Iframe')[0];
					
					if (settings.fastIframe) {
						complete();
					} else {
						$(iframe).load(complete);
					}
					iframe.name = prefix + (+new Date());
					iframe.src = settings.href;
					
					if (!settings.scrolling) {
						iframe.scrolling = "no";
					}
					
					if (isIE) {
                        iframe.frameBorder=0;
						iframe.allowTransparency = "true";
					}
					
					$(iframe).appendTo($loaded).one(event_purge, function () {
						iframe.src = "//about:blank";
					});
				} else {
					complete();
				}
				
				if (settings.transition === 'fade') {
					$box.fadeTo(speed, 1, function () {
						$box[0].style.filter = "";
					});
				} else {
                     $box[0].style.filter = "";
				}
				
				$window.bind('resize.' + prefix, function () {
					publicMethod.position(0);
				});
			});
		}
		
		if (settings.transition === 'fade') {
			$box.fadeTo(speed, 0, function () {
				setPosition(0);
			});
		} else {
			setPosition(speed);
		}
	};

	publicMethod.load = function (launched) {
		var href, setResize, prep = publicMethod.prep;
		
		active = true;
		
		photo = false;
		
		element = $related[index];
		
		if (!launched) {
			process($.extend(settings, $.data(element, colorbox)));
		}
		
		trigger(event_purge);
		
		trigger(event_load, settings.onLoad);
		
		settings.h = settings.height ?
				setSize(settings.height, 'y') - loadedHeight - interfaceHeight :
				settings.innerHeight && setSize(settings.innerHeight, 'y');
		
		settings.w = settings.width ?
				setSize(settings.width, 'x') - loadedWidth - interfaceWidth :
				settings.innerWidth && setSize(settings.innerWidth, 'x');
		
		// Sets the minimum dimensions for use in image scaling
		settings.mw = settings.w;
		settings.mh = settings.h;
		
		// Re-evaluate the minimum width and height based on maxWidth and maxHeight values.
		// If the width or height exceed the maxWidth or maxHeight, use the maximum values instead.
		if (settings.maxWidth) {
			settings.mw = setSize(settings.maxWidth, 'x') - loadedWidth - interfaceWidth;
			settings.mw = settings.w && settings.w < settings.mw ? settings.w : settings.mw;
		}
		if (settings.maxHeight) {
			settings.mh = setSize(settings.maxHeight, 'y') - loadedHeight - interfaceHeight;
			settings.mh = settings.h && settings.h < settings.mh ? settings.h : settings.mh;
		}
		
		href = settings.href;
		
		$loadingOverlay.show();

		if (settings.inline) {
			// Inserts an empty placeholder where inline content is being pulled from.
			// An event is bound to put inline content back when ColorBox closes or loads new content.
			$div().hide().insertBefore($(href)[0]).one(event_purge, function () {
				$(this).replaceWith($loaded.children());
			});
			prep($(href));
		} else if (settings.iframe) {
			// IFrame element won't be added to the DOM until it is ready to be displayed,
			// to avoid problems with DOM-ready JS that might be trying to run in that iframe.
			prep(" ");
		} else if (settings.html) {
			prep(settings.html);
		} else if (isImage(href)) {
			$(photo = new Image())
			.addClass(prefix + 'Photo')
			.error(function () {
				settings.title = false;
				prep($div('Error').text('This image could not be loaded'));
			})
			.load(function () {
				var percent;
				photo.onload = null; //stops animated gifs from firing the onload repeatedly.
				
				if (settings.scalePhotos) {
					setResize = function () {
						photo.height -= photo.height * percent;
						photo.width -= photo.width * percent;	
					};
					if (settings.mw && photo.width > settings.mw) {
						percent = (photo.width - settings.mw) / photo.width;
						setResize();
					}
					if (settings.mh && photo.height > settings.mh) {
						percent = (photo.height - settings.mh) / photo.height;
						setResize();
					}
				}
				
				if (settings.h) {
					photo.style.marginTop = Math.max(settings.h - photo.height, 0) / 2 + 'px';
				}
				
				if ($related[1] && (index < $related.length - 1 || settings.loop)) {
					photo.style.cursor = 'pointer';
					photo.onclick = function () {
                                                publicMethod.next();
                                        };
				}
				
				if (isIE) {
					photo.style.msInterpolationMode = 'bicubic';
				}
				
				setTimeout(function () { // A pause because Chrome will sometimes report a 0 by 0 size otherwise.
					prep(photo);
				}, 1);
			});
			
			setTimeout(function () { // A pause because Opera 10.6+ will sometimes not run the onload function otherwise.
				photo.src = href;
			}, 1);
		} else if (href) {
			$loadingBay.load(href, function (data, status, xhr) {
				prep(status === 'error' ? $div('Error').text('Request unsuccessful: ' + xhr.statusText) : $(this).contents());
			});
		}
	};
        
	// Navigates to the next page/image in a set.
	publicMethod.next = function () {
		if (!active && $related[1] && (index < $related.length - 1 || settings.loop)) {
			index = index < $related.length - 1 ? index + 1 : 0;
			publicMethod.load();
		}
	};
	
	publicMethod.prev = function () {
		if (!active && $related[1] && (index || settings.loop)) {
			index = index ? index - 1 : $related.length - 1;
			publicMethod.load();
		}
	};

	// Note: to use this within an iframe use the following format: parent.$.fn.colorbox.close();
	publicMethod.close = function () {
		if (open && !closing) {
			
			closing = true;
			
			open = false;
			
			trigger(event_cleanup, settings.onCleanup);
			
			$window.unbind('.' + prefix + ' .' + event_ie6);
			
			$overlay.fadeTo(200, 0);
			
			$box.stop().fadeTo(300, 0, function () {
                                
				$box.add($overlay).css({'opacity': 1, cursor: 'auto'}).hide();
				
				trigger(event_purge);
				
				$loaded.remove();
				
				setTimeout(function () {
					closing = false;
					trigger(event_closed, settings.onClosed);
				}, 1);
			});
		}
	};

	// A method for fetching the current element ColorBox is referencing.
	// returns a jQuery object.
	publicMethod.element = function () {
		return $(element);
	};

	publicMethod.settings = defaults;

	// Initializes ColorBox when the DOM has loaded
	$(publicMethod.init);

}(jQuery, document, this));;
(function ($) {

Drupal.behaviors.initColorbox = {
  attach: function (context, settings) {
    if (!$.isFunction($.colorbox)) {
      return;
    }
    $('a, area, input', context)
      .filter('.colorbox')
      .once('init-colorbox-processed')
      .colorbox(settings.colorbox);
  }
};

{
  $(document).bind('cbox_complete', function () {
    Drupal.attachBehaviors('#cboxLoadedContent');
  });
}

})(jQuery);
;
(function ($) {

Drupal.behaviors.initColorboxDefaultStyle = {
  attach: function (context, settings) {
    $(document).bind('cbox_complete', function () {
      // Only run if there is a title.
      if ($('#cboxTitle:empty', context).length == false) {
        setTimeout(function () { $('#cboxTitle', context).slideUp() }, 1500);
        $('#cboxLoadedContent img', context).bind('mouseover', function () {
          $('#cboxTitle', context).slideDown();
        });
        $('#cboxOverlay', context).bind('mouseover', function () {
          $('#cboxTitle', context).slideUp();
        });
      }
      else {
        $('#cboxTitle', context).hide();
      }
    });
  }
};

})(jQuery);
;
(function ($) {

Drupal.behaviors.initColorboxLoad = {
  attach: function (context, settings) {
    if (!$.isFunction($.colorbox)) {
      return;
    }
    $.urlParams = function (url) {
      var p = {},
          e,
          a = /\+/g,  // Regex for replacing addition symbol with a space
          r = /([^&=]+)=?([^&]*)/g,
          d = function (s) { return decodeURIComponent(s.replace(a, ' ')); },
          q = url.split('?');
      while (e = r.exec(q[1])) {
        e[1] = d(e[1]);
        e[2] = d(e[2]);
        switch (e[2].toLowerCase()) {
          case 'true':
          case 'yes':
            e[2] = true;
            break;
          case 'false':
          case 'no':
            e[2] = false;
            break;
        }
        if (e[1] == 'width') { e[1] = 'innerWidth'; }
        if (e[1] == 'height') { e[1] = 'innerHeight'; }
        p[e[1]] = e[2];
      }
      return p;
    };
    $('a, area, input', context)
      .filter('.colorbox-load')
      .once('init-colorbox-load-processed', function () {
        var params = $.urlParams($(this).attr('href'));
        $(this).colorbox($.extend({}, settings.colorbox, params));
      });
  }
};

})(jQuery);
;
(function ($) {

Drupal.behaviors.initColorboxInline = {
  attach: function (context, settings) {
    if (!$.isFunction($.colorbox)) {
      return;
    }
    $.urlParam = function(name, url){
      if (name == 'fragment') {
        var results = new RegExp('(#[^&#]*)').exec(url);
      }
      else {
        var results = new RegExp('[\\?&]' + name + '=([^&#]*)').exec(url);
      }
      if (!results) { return ''; }
      return results[1] || '';
    };
    $('a, area, input', context).filter('.colorbox-inline').once('init-colorbox-inline-processed').colorbox({
      transition:settings.colorbox.transition,
      speed:settings.colorbox.speed,
      opacity:settings.colorbox.opacity,
      slideshow:settings.colorbox.slideshow,
      slideshowAuto:settings.colorbox.slideshowAuto,
      slideshowSpeed:settings.colorbox.slideshowSpeed,
      slideshowStart:settings.colorbox.slideshowStart,
      slideshowStop:settings.colorbox.slideshowStop,
      current:settings.colorbox.current,
      previous:settings.colorbox.previous,
      next:settings.colorbox.next,
      close:settings.colorbox.close,
      overlayClose:settings.colorbox.overlayClose,
      maxWidth:settings.colorbox.maxWidth,
      maxHeight:settings.colorbox.maxHeight,
      innerWidth:function(){
        return $.urlParam('width', $(this).attr('href'));
      },
      innerHeight:function(){
        return $.urlParam('height', $(this).attr('href'));
      },
      title:function(){
        return decodeURIComponent($.urlParam('title', $(this).attr('href')));
      },
      iframe:function(){
        return $.urlParam('iframe', $(this).attr('href'));
      },
      inline:function(){
        return $.urlParam('inline', $(this).attr('href'));
      },
      href:function(){
        return $.urlParam('fragment', $(this).attr('href'));
      }
    });
  }
};

})(jQuery);
;
(function($, Drupal, undefined){
  /**
   * When set to enable mediaelement for all audio/video files add it to the page.
   */
  Drupal.behaviors.mediaelement = {
    attach: function(context, settings) {
      if (settings.mediaelement !== undefined) {
        // @todo Remove anonymous function.
        $.each(settings.mediaelement, function(selector, options) {
          var opts;
          $(selector, context).once('mediaelement', function() {
            if (options.controls) {
              $(this).mediaelementplayer(options.opts);
            }
            else {
              $(this).mediaelement();
            }
          });
        });
      }
      // The global option is seperate from the other selectors as it should be
      // run after any other selectors.
      if (settings.mediaelementAll !== undefined) {
        $('video,audio', context).once('mediaelement', function() {
          $(this).mediaelementplayer();
        });
      }
    }
  };
})(jQuery, Drupal);;

(function ($) {
  Drupal.Panels = {};

  Drupal.Panels.autoAttach = function() {
    if ($.browser.msie) {
      // If IE, attach a hover event so we can see our admin links.
      $("div.panel-pane").hover(
        function() {
          $('div.panel-hide', this).addClass("panel-hide-hover"); return true;
        },
        function() {
          $('div.panel-hide', this).removeClass("panel-hide-hover"); return true;
        }
      );
      $("div.admin-links").hover(
        function() {
          $(this).addClass("admin-links-hover"); return true;
        },
        function(){
          $(this).removeClass("admin-links-hover"); return true;
        }
      );
    }
  };

  $(Drupal.Panels.autoAttach);
})(jQuery);
;
(function ($) {
  Drupal.viewsSlideshow = Drupal.viewsSlideshow || {};

  /**
   * Views Slideshow Controls
   */
  Drupal.viewsSlideshowControls = Drupal.viewsSlideshowControls || {};

  /**
   * Implement the play hook for controls.
   */
  Drupal.viewsSlideshowControls.play = function (options) {
    // Route the control call to the correct control type.
    // Need to use try catch so we don't have to check to make sure every part
    // of the object is defined.
    try {
      if (typeof Drupal.settings.viewsSlideshowControls[options.slideshowID].top.type != "undefined" && typeof Drupal[Drupal.settings.viewsSlideshowControls[options.slideshowID].top.type].play == 'function') {
        Drupal[Drupal.settings.viewsSlideshowControls[options.slideshowID].top.type].play(options);
      }
    }
    catch(err) {
      // Don't need to do anything on error.
    }

    try {
      if (typeof Drupal.settings.viewsSlideshowControls[options.slideshowID].bottom.type != "undefined" && typeof Drupal[Drupal.settings.viewsSlideshowControls[options.slideshowID].bottom.type].play == 'function') {
        Drupal[Drupal.settings.viewsSlideshowControls[options.slideshowID].bottom.type].play(options);
      }
    }
    catch(err) {
      // Don't need to do anything on error.
    }
  };

  /**
   * Implement the pause hook for controls.
   */
  Drupal.viewsSlideshowControls.pause = function (options) {
    // Route the control call to the correct control type.
    // Need to use try catch so we don't have to check to make sure every part
    // of the object is defined.
    try {
      if (typeof Drupal.settings.viewsSlideshowControls[options.slideshowID].top.type != "undefined" && typeof Drupal[Drupal.settings.viewsSlideshowControls[options.slideshowID].top.type].pause == 'function') {
        Drupal[Drupal.settings.viewsSlideshowControls[options.slideshowID].top.type].pause(options);
      }
    }
    catch(err) {
      // Don't need to do anything on error.
    }

    try {
      if (typeof Drupal.settings.viewsSlideshowControls[options.slideshowID].bottom.type != "undefined" && typeof Drupal[Drupal.settings.viewsSlideshowControls[options.slideshowID].bottom.type].pause == 'function') {
        Drupal[Drupal.settings.viewsSlideshowControls[options.slideshowID].bottom.type].pause(options);
      }
    }
    catch(err) {
      // Don't need to do anything on error.
    }
  };


  /**
   * Views Slideshow Text Controls
   */

  // Add views slieshow api calls for views slideshow text controls.
  Drupal.behaviors.viewsSlideshowControlsText = {
    attach: function (context) {

      // Process previous link
      $('.views_slideshow_controls_text_previous:not(.views-slideshow-controls-text-previous-processed)', context).addClass('views-slideshow-controls-text-previous-processed').each(function() {
        var uniqueID = $(this).attr('id').replace('views_slideshow_controls_text_previous_', '');
        $(this).click(function() {
          Drupal.viewsSlideshow.action({ "action": 'previousSlide', "slideshowID": uniqueID });
          return false;
        });
      });

      // Process next link
      $('.views_slideshow_controls_text_next:not(.views-slideshow-controls-text-next-processed)', context).addClass('views-slideshow-controls-text-next-processed').each(function() {
        var uniqueID = $(this).attr('id').replace('views_slideshow_controls_text_next_', '');
        $(this).click(function() {
          Drupal.viewsSlideshow.action({ "action": 'nextSlide', "slideshowID": uniqueID });
          return false;
        });
      });

      // Process pause link
      $('.views_slideshow_controls_text_pause:not(.views-slideshow-controls-text-pause-processed)', context).addClass('views-slideshow-controls-text-pause-processed').each(function() {
        var uniqueID = $(this).attr('id').replace('views_slideshow_controls_text_pause_', '');
        $(this).click(function() {
          if (Drupal.settings.viewsSlideshow[uniqueID].paused) {
            Drupal.viewsSlideshow.action({ "action": 'play', "slideshowID": uniqueID, "force": true });
          }
          else {
            Drupal.viewsSlideshow.action({ "action": 'pause', "slideshowID": uniqueID, "force": true });
          }
          return false;
        });
      });
    }
  };

  Drupal.viewsSlideshowControlsText = Drupal.viewsSlideshowControlsText || {};

  /**
   * Implement the pause hook for text controls.
   */
  Drupal.viewsSlideshowControlsText.pause = function (options) {
    var pauseText = Drupal.theme.prototype['viewsSlideshowControlsPause'] ? Drupal.theme('viewsSlideshowControlsPause') : '';
    $('#views_slideshow_controls_text_pause_' + options.slideshowID + ' a').text(pauseText);
  };

  /**
   * Implement the play hook for text controls.
   */
  Drupal.viewsSlideshowControlsText.play = function (options) {
    var playText = Drupal.theme.prototype['viewsSlideshowControlsPlay'] ? Drupal.theme('viewsSlideshowControlsPlay') : '';
    $('#views_slideshow_controls_text_pause_' + options.slideshowID + ' a').text(playText);
  };

  // Theme the resume control.
  Drupal.theme.prototype.viewsSlideshowControlsPause = function () {
    return Drupal.t('Resume');
  };

  // Theme the pause control.
  Drupal.theme.prototype.viewsSlideshowControlsPlay = function () {
    return Drupal.t('Pause');
  };

  /**
   * Views Slideshow Pager
   */
  Drupal.viewsSlideshowPager = Drupal.viewsSlideshowPager || {};

  /**
   * Implement the transitionBegin hook for pagers.
   */
  Drupal.viewsSlideshowPager.transitionBegin = function (options) {
    // Route the pager call to the correct pager type.
    // Need to use try catch so we don't have to check to make sure every part
    // of the object is defined.
    try {
      if (typeof Drupal.settings.viewsSlideshowPager[options.slideshowID].top.type != "undefined" && typeof Drupal[Drupal.settings.viewsSlideshowPager[options.slideshowID].top.type].transitionBegin == 'function') {
        Drupal[Drupal.settings.viewsSlideshowPager[options.slideshowID].top.type].transitionBegin(options);
      }
    }
    catch(err) {
      // Don't need to do anything on error.
    }

    try {
      if (typeof Drupal.settings.viewsSlideshowPager[options.slideshowID].bottom.type != "undefined" && typeof Drupal[Drupal.settings.viewsSlideshowPager[options.slideshowID].bottom.type].transitionBegin == 'function') {
        Drupal[Drupal.settings.viewsSlideshowPager[options.slideshowID].bottom.type].transitionBegin(options);
      }
    }
    catch(err) {
      // Don't need to do anything on error.
    }
  };

  /**
   * Implement the goToSlide hook for pagers.
   */
  Drupal.viewsSlideshowPager.goToSlide = function (options) {
    // Route the pager call to the correct pager type.
    // Need to use try catch so we don't have to check to make sure every part
    // of the object is defined.
    try {
      if (typeof Drupal.settings.viewsSlideshowPager[options.slideshowID].top.type != "undefined" && typeof Drupal[Drupal.settings.viewsSlideshowPager[options.slideshowID].top.type].goToSlide == 'function') {
        Drupal[Drupal.settings.viewsSlideshowPager[options.slideshowID].top.type].goToSlide(options);
      }
    }
    catch(err) {
      // Don't need to do anything on error.
    }

    try {
      if (typeof Drupal.settings.viewsSlideshowPager[options.slideshowID].bottom.type != "undefined" && typeof Drupal[Drupal.settings.viewsSlideshowPager[options.slideshowID].bottom.type].goToSlide == 'function') {
        Drupal[Drupal.settings.viewsSlideshowPager[options.slideshowID].bottom.type].goToSlide(options);
      }
    }
    catch(err) {
      // Don't need to do anything on error.
    }
  };

  /**
   * Implement the previousSlide hook for pagers.
   */
  Drupal.viewsSlideshowPager.previousSlide = function (options) {
    // Route the pager call to the correct pager type.
    // Need to use try catch so we don't have to check to make sure every part
    // of the object is defined.
    try {
      if (typeof Drupal.settings.viewsSlideshowPager[options.slideshowID].top.type != "undefined" && typeof Drupal[Drupal.settings.viewsSlideshowPager[options.slideshowID].top.type].previousSlide == 'function') {
        Drupal[Drupal.settings.viewsSlideshowPager[options.slideshowID].top.type].previousSlide(options);
      }
    }
    catch(err) {
      // Don't need to do anything on error.
    }

    try {
      if (typeof Drupal.settings.viewsSlideshowPager[options.slideshowID].bottom.type != "undefined" && typeof Drupal[Drupal.settings.viewsSlideshowPager[options.slideshowID].bottom.type].previousSlide == 'function') {
        Drupal[Drupal.settings.viewsSlideshowPager[options.slideshowID].bottom.type].previousSlide(options);
      }
    }
    catch(err) {
      // Don't need to do anything on error.
    }
  };

  /**
   * Implement the nextSlide hook for pagers.
   */
  Drupal.viewsSlideshowPager.nextSlide = function (options) {
    // Route the pager call to the correct pager type.
    // Need to use try catch so we don't have to check to make sure every part
    // of the object is defined.
    try {
      if (typeof Drupal.settings.viewsSlideshowPager[options.slideshowID].top.type != "undefined" && typeof Drupal[Drupal.settings.viewsSlideshowPager[options.slideshowID].top.type].nextSlide == 'function') {
        Drupal[Drupal.settings.viewsSlideshowPager[options.slideshowID].top.type].nextSlide(options);
      }
    }
    catch(err) {
      // Don't need to do anything on error.
    }

    try {
      if (typeof Drupal.settings.viewsSlideshowPager[options.slideshowID].bottom.type != "undefined" && typeof Drupal[Drupal.settings.viewsSlideshowPager[options.slideshowID].bottom.type].nextSlide == 'function') {
        Drupal[Drupal.settings.viewsSlideshowPager[options.slideshowID].bottom.type].nextSlide(options);
      }
    }
    catch(err) {
      // Don't need to do anything on error.
    }
  };


  /**
   * Views Slideshow Pager Fields
   */

  // Add views slieshow api calls for views slideshow pager fields.
  Drupal.behaviors.viewsSlideshowPagerFields = {
    attach: function (context) {
      // Process pause on hover.
      $('.views_slideshow_pager_field:not(.views-slideshow-pager-field-processed)', context).addClass('views-slideshow-pager-field-processed').each(function() {
        // Parse out the location and unique id from the full id.
        var pagerInfo = $(this).attr('id').split('_');
        var location = pagerInfo[2];
        pagerInfo.splice(0, 3);
        var uniqueID = pagerInfo.join('_');

        // Add the activate and pause on pager hover event to each pager item.
        if (Drupal.settings.viewsSlideshowPagerFields[uniqueID][location].activatePauseOnHover) {
          $(this).children().each(function(index, pagerItem) {
            var mouseIn = function() {
              Drupal.viewsSlideshow.action({ "action": 'goToSlide', "slideshowID": uniqueID, "slideNum": index });
              Drupal.viewsSlideshow.action({ "action": 'pause', "slideshowID": uniqueID });
            }
            
            var mouseOut = function() {
              Drupal.viewsSlideshow.action({ "action": 'play', "slideshowID": uniqueID });
            }
          
            if (jQuery.fn.hoverIntent) {
              $(pagerItem).hoverIntent(mouseIn, mouseOut);
            }
            else {
              $(pagerItem).hover(mouseIn, mouseOut);
            }
            
          });
        }
        else {
          $(this).children().each(function(index, pagerItem) {
            $(pagerItem).click(function() {
              Drupal.viewsSlideshow.action({ "action": 'goToSlide', "slideshowID": uniqueID, "slideNum": index });
            });
          });
        }
      });
    }
  };

  Drupal.viewsSlideshowPagerFields = Drupal.viewsSlideshowPagerFields || {};

  /**
   * Implement the transitionBegin hook for pager fields pager.
   */
  Drupal.viewsSlideshowPagerFields.transitionBegin = function (options) {
    for (pagerLocation in Drupal.settings.viewsSlideshowPager[options.slideshowID]) {
      // Remove active class from pagers
      $('[id^="views_slideshow_pager_field_item_' + pagerLocation + '_' + options.slideshowID + '"]').removeClass('active');

      // Add active class to active pager.
      $('#views_slideshow_pager_field_item_'+ pagerLocation + '_' + options.slideshowID + '_' + options.slideNum).addClass('active');
    }

  };

  /**
   * Implement the goToSlide hook for pager fields pager.
   */
  Drupal.viewsSlideshowPagerFields.goToSlide = function (options) {
    for (pagerLocation in Drupal.settings.viewsSlideshowPager[options.slideshowID]) {
      // Remove active class from pagers
      $('[id^="views_slideshow_pager_field_item_' + pagerLocation + '_' + options.slideshowID + '"]').removeClass('active');

      // Add active class to active pager.
      $('#views_slideshow_pager_field_item_' + pagerLocation + '_' + options.slideshowID + '_' + options.slideNum).addClass('active');
    }
  };

  /**
   * Implement the previousSlide hook for pager fields pager.
   */
  Drupal.viewsSlideshowPagerFields.previousSlide = function (options) {
    for (pagerLocation in Drupal.settings.viewsSlideshowPager[options.slideshowID]) {
      // Get the current active pager.
      var pagerNum = $('[id^="views_slideshow_pager_field_item_' + pagerLocation + '_' + options.slideshowID + '"].active').attr('id').replace('views_slideshow_pager_field_item_' + pagerLocation + '_' + options.slideshowID + '_', '');

      // If we are on the first pager then activate the last pager.
      // Otherwise activate the previous pager.
      if (pagerNum == 0) {
        pagerNum = $('[id^="views_slideshow_pager_field_item_' + pagerLocation + '_' + options.slideshowID + '"]').length() - 1;
      }
      else {
        pagerNum--;
      }

      // Remove active class from pagers
      $('[id^="views_slideshow_pager_field_item_' + pagerLocation + '_' + options.slideshowID + '"]').removeClass('active');

      // Add active class to active pager.
      $('#views_slideshow_pager_field_item_' + pagerLocation + '_' + options.slideshowID + '_' + pagerNum).addClass('active');
    }
  };

  /**
   * Implement the nextSlide hook for pager fields pager.
   */
  Drupal.viewsSlideshowPagerFields.nextSlide = function (options) {
    for (pagerLocation in Drupal.settings.viewsSlideshowPager[options.slideshowID]) {
      // Get the current active pager.
      var pagerNum = $('[id^="views_slideshow_pager_field_item_' + pagerLocation + '_' + options.slideshowID + '"].active').attr('id').replace('views_slideshow_pager_field_item_' + pagerLocation + '_' + options.slideshowID + '_', '');
      var totalPagers = $('[id^="views_slideshow_pager_field_item_' + pagerLocation + '_' + options.slideshowID + '"]').length();

      // If we are on the last pager then activate the first pager.
      // Otherwise activate the next pager.
      pagerNum++;
      if (pagerNum == totalPagers) {
        pagerNum = 0;
      }

      // Remove active class from pagers
      $('[id^="views_slideshow_pager_field_item_' + pagerLocation + '_' + options.slideshowID + '"]').removeClass('active');

      // Add active class to active pager.
      $('#views_slideshow_pager_field_item_' + pagerLocation + '_' + options.slideshowID + '_' + slideNum).addClass('active');
    }
  };


  /**
   * Views Slideshow Slide Counter
   */

  Drupal.viewsSlideshowSlideCounter = Drupal.viewsSlideshowSlideCounter || {};

  /**
   * Implement the transitionBegin for the slide counter.
   */
  Drupal.viewsSlideshowSlideCounter.transitionBegin = function (options) {
    $('#views_slideshow_slide_counter_' + options.slideshowID + ' .num').text(options.slideNum + 1);
  };

  /**
   * This is used as a router to process actions for the slideshow.
   */
  Drupal.viewsSlideshow.action = function (options) {
    // Set default values for our return status.
    var status = {
      'value': true,
      'text': ''
    }

    // If an action isn't specified return false.
    if (typeof options.action == 'undefined' || options.action == '') {
      status.value = false;
      status.text =  Drupal.t('There was no action specified.');
      return error;
    }

    // If we are using pause or play switch paused state accordingly.
    if (options.action == 'pause') {
      Drupal.settings.viewsSlideshow[options.slideshowID].paused = 1;
      // If the calling method is forcing a pause then mark it as such.
      if (options.force) {
        Drupal.settings.viewsSlideshow[options.slideshowID].pausedForce = 1;
      }
    }
    else if (options.action == 'play') {
      // If the slideshow isn't forced pause or we are forcing a play then play
      // the slideshow.
      // Otherwise return telling the calling method that it was forced paused.
      if (!Drupal.settings.viewsSlideshow[options.slideshowID].pausedForce || options.force) {
        Drupal.settings.viewsSlideshow[options.slideshowID].paused = 0;
        Drupal.settings.viewsSlideshow[options.slideshowID].pausedForce = 0;
      }
      else {
        status.value = false;
        status.text += ' ' + Drupal.t('This slideshow is forced paused.');
        return status;
      }
    }

    // We use a switch statement here mainly just to limit the type of actions
    // that are available.
    switch (options.action) {
      case "goToSlide":
      case "transitionBegin":
      case "transitionEnd":
        // The three methods above require a slide number. Checking if it is
        // defined and it is a number that is an integer.
        if (typeof options.slideNum == 'undefined' || typeof options.slideNum !== 'number' || parseInt(options.slideNum) != (options.slideNum - 0)) {
          status.value = false;
          status.text = Drupal.t('An invalid integer was specified for slideNum.');
        }
      case "pause":
      case "play":
      case "nextSlide":
      case "previousSlide":
        // Grab our list of methods.
        var methods = Drupal.settings.viewsSlideshow[options.slideshowID]['methods'];

        // if the calling method specified methods that shouldn't be called then
        // exclude calling them.
        var excludeMethodsObj = {};
        if (typeof options.excludeMethods !== 'undefined') {
          // We need to turn the excludeMethods array into an object so we can use the in
          // function.
          for (var i=0; i < excludeMethods.length; i++) {
            excludeMethodsObj[excludeMethods[i]] = '';
          }
        }

        // Call every registered method and don't call excluded ones.
        for (i = 0; i < methods[options.action].length; i++) {
          if (Drupal[methods[options.action][i]] != undefined && typeof Drupal[methods[options.action][i]][options.action] == 'function' && !(methods[options.action][i] in excludeMethodsObj)) {
            Drupal[methods[options.action][i]][options.action](options);
          }
        }
        break;

      // If it gets here it's because it's an invalid action.
      default:
        status.value = false;
        status.text = Drupal.t('An invalid action "!action" was specified.', { "!action": options.action });
    }
    return status;
  };
})(jQuery);
;
// $Id: extlink.js,v 1.8 2010/05/26 01:25:56 quicksketch Exp $
(function ($) {

function extlinkAttach(context) {
  // Strip the host name down, removing ports, subdomains, or www.
  var pattern = /^(([^\/:]+?\.)*)([^\.:]{4,})((\.[a-z]{1,4})*)(:[0-9]{1,5})?$/;
  var host = window.location.host.replace(pattern, '$3$4');
  var subdomain = window.location.host.replace(pattern, '$1');

  // Determine what subdomains are considered internal.
  if (Drupal.settings.extlink.extSubdomains) {
    var subdomains = "([^/]*\\.)?";
  }
  else if (subdomain == 'www.' || subdomain == '') {
    var subdomains = "(www\\.)?";
  }
  else {
    var subdomains = subdomain.replace(".", "\\.");
  }

  // Build regular expressions that define an internal link.
  var internal_link = new RegExp("^https?://" + subdomains + host, "i");

  // Extra internal link matching.
  var extInclude = false;
  if (Drupal.settings.extlink.extInclude) {
    extInclude = new RegExp(Drupal.settings.extlink.extInclude.replace(/\\/, '\\'));
  }

  // Extra external link matching.
  var extExclude = false;
  if (Drupal.settings.extlink.extExclude) {
    extExclude = new RegExp(Drupal.settings.extlink.extExclude.replace(/\\/, '\\'));
  }

  // Find all links which are NOT internal and begin with http (as opposed
  // to ftp://, javascript:, etc. other kinds of links.
  // When operating on the 'this' variable, the host has been appended to
  // all links by the browser, even local ones.
  // In jQuery 1.1 and higher, we'd use a filter method here, but it is not
  // available in jQuery 1.0 (Drupal 5 default).
  var external_links = new Array();
  var mailto_links = new Array();
  $("a:not(." + Drupal.settings.extlink.extClass + ", ." + Drupal.settings.extlink.mailtoClass + ")", context).each(function(el) {
    try {
      var url = this.href.toLowerCase();
      if (url.indexOf('http') == 0 && (!url.match(internal_link) || (extInclude && url.match(extInclude))) && !(extExclude && url.match(extExclude))) {
        external_links.push(this);
      }
      else if (url.indexOf('mailto:') == 0) {
        mailto_links.push(this);
      }
    }
    // IE7 throws errors often when dealing with irregular links, such as:
    // <a href="node/10"></a> Empty tags.
    // <a href="http://user:pass@example.com">example</a> User:pass syntax.
    catch(error) {
      return false;
    }
  });

  if (Drupal.settings.extlink.extClass) {
    // Apply the "ext" class to all links not containing images.
    if (parseFloat($().jquery) < 1.2) {
      $(external_links).not('[img]').addClass(Drupal.settings.extlink.extClass).each(function() { if ($(this).css('display') == 'inline') $(this).after('<span class=' + Drupal.settings.extlink.extClass + '></span>'); });
    }
    else {
      $(external_links).not($(external_links).find('img').parents('a')).addClass(Drupal.settings.extlink.extClass).each(function() { if ($(this).css('display') == 'inline') $(this).after('<span class=' + Drupal.settings.extlink.extClass + '></span>'); });
    }
  }

  if (Drupal.settings.extlink.mailtoClass) {
    // Apply the "mailto" class to all mailto links not containing images.
    if (parseFloat($().jquery) < 1.2) {
      $(mailto_links).not('[img]').addClass(Drupal.settings.extlink.mailtoClass).each(function() { if ($(this).css('display') == 'inline') $(this).after('<span class=' + Drupal.settings.extlink.mailtoClass + '></span>'); });
    }
    else {
      $(mailto_links).not($(mailto_links).find('img').parents('a')).addClass(Drupal.settings.extlink.mailtoClass).each(function() { if ($(this).css('display') == 'inline') $(this).after('<span class=' + Drupal.settings.extlink.mailtoClass + '></span>'); });
    }
  }

  if (Drupal.settings.extlink.extTarget) {
    // Apply the target attribute to all links.
    $(external_links).attr('target', Drupal.settings.extlink.extTarget);
  }

  if (Drupal.settings.extlink.extAlert) {
    // Add pop-up click-through dialog.
    $(external_links).click(function(e) {
     return confirm(Drupal.settings.extlink.extAlertText);
    });
  }

  // Work around for Internet Explorer box model problems.
  if (($.support && !($.support.boxModel === undefined) && !$.support.boxModel) || ($.browser.msie && parseInt($.browser.version) <= 7)) {
    $('span.ext, span.mailto').css('display', 'inline-block');
  }
}

Drupal.behaviors.extlink = {
  attach: function(context){
    extlinkAttach(context);
  }
}

})(jQuery);
;
(function($) {
  Drupal.behaviors.deepzoom = {
    attach: function(context) {
      $('.deepzoom').each(function() {
        id = $(this).attr('id').split('-');
        Seadragon.Utils.addEvent(window, 'load', function() {
          viewer = new Seadragon.Viewer('deepzoom-' + id[1]);
          viewer.openDzi(Drupal.settings.deepzoom + '/' + id[1] + '.dzi');
        });
      });
    }
  }
})(jQuery);
;
/**
 * Seadragon Ajax 0.8.9 (build 64702 on 2011-01-28)
 * http://gallery.expression.microsoft.com/SeadragonAjax
 * This code is distributed under the license agreement at:
 * http://go.microsoft.com/fwlink/?LinkId=164943
 */
(function(h,r,g,N){var l="100%",p=10,w="absolute",u="relative",o="hidden",L=" while executing ",f="function",D="mousewheel",k="px",C="inline-block",F="span",j="0px",B="none",s="div",H="fixed",J="undefined",z=",",n="number",d="",I="string",b=null,a=true,t=.5,c=false;if(!h.Seadragon)h.Seadragon={};var v=h.Seadragon,i=v.Config;(function(){if(i)return;i=v.Config={debugMode:c,animationTime:1.5,blendTime:t,alwaysBlend:c,autoHideControls:a,constrainDuringPan:a,immediateRender:c,logarithmicZoom:a,wrapHorizontal:c,wrapVertical:c,wrapOverlays:c,transformOverlays:c,minZoomDimension:b,minZoomImageRatio:.8,maxZoomPixelRatio:2,visibilityRatio:.8,springStiffness:5,imageLoaderLimit:2,clickTimeThreshold:200,clickDistThreshold:5,zoomPerClick:2,zoomPerScroll:g.pow(2,1/3),zoomPerSecond:2,proxyUrl:b,imagePath:"img/"}})();var x=v.Strings;(function(){var a="Hmm, this doesn't appear to be a valid Deep Zoom Image.";if(x)return;x=v.Strings={Errors:{Failure:"Sorry, but Seadragon Ajax can't run on your browser!\nPlease try using IE 8 or Firefox 3.\n",Dzc:"Sorry, we don't support Deep Zoom Collections!",Dzi:a,Xml:a,Empty:"You asked us to open nothing, so we did just that.",ImageFormat:"Sorry, we don't support {0}-based Deep Zoom Images.",Security:"It looks like a security restriction stopped us from loading this Deep Zoom Image.",Status:"This space unintentionally left blank ({0} {1}).",Unknown:"Whoops, something inexplicably went wrong. Sorry!"},Messages:{Loading:"Loading..."},Tooltips:{FullPage:"Toggle full page",Home:"Go home",ZoomIn:"Zoom in (you can also use your mouse's scroll wheel)",ZoomOut:"Zoom out (you can also use your mouse's scroll wheel)"}};x.getString=function(f){for(var c=f.split("."),a=x,b=0;b<c.length;b++)a=a[c[b]]||{};if(typeof a!=I)a=d;var e=arguments;return a.replace(/\{\d+\}/g,function(b){var a=parseInt(b.match(/\d+/))+1;return a<e.length?e[a]:d})};x.setString=function(e,d){for(var c=e.split("."),b=x,a=0;a<c.length-1;a++){if(!b[c[a]])b[c[a]]={};b=b[c[a]]}b[c[a]]=d}})();var q=function(){this.log=function(c,d){var a=h.console||{},b=i.debugMode;if(b&&a.log)a.log(c);else b&&d&&alert(c)};this.error=function(b,d){var c=h.console||{},a=i.debugMode;if(a&&c.error)c.error(b);else a&&alert(b);if(a)throw d||new Error(b)};this.fail=function(a){alert(x.getString("Errors.Failure"));throw new Error(a)}};q=v.Debug=new q;var U=v.Profiler=function(){var d=this,o=d,f=c,e=0,h=b,l=b,j=Infinity,g=0,i=0,n=Infinity,k=0,m=0;d.getAvgUpdateTime=function(){return g};d.getMinUpdateTime=function(){return j};d.getMaxUpdateTime=function(){return i};d.getAvgIdleTime=function(){return k};d.getMinIdleTime=function(){return n};d.getMaxIdleTime=function(){return m};d.isMidUpdate=function(){return f};d.getNumUpdates=function(){return e};d.beginUpdate=function(){f&&o.endUpdate();f=a;h=(new Date).getTime();if(e<1)return;var b=h-l;k=(k*(e-1)+b)/e;if(b<n)n=b;if(b>m)m=b};d.endUpdate=function(){if(!f)return;l=(new Date).getTime();f=c;var a=l-h;e++;g=(g*(e-1)+a)/e;if(a<j)j=a;if(a>i)i=a};d.clearProfile=function(){f=c;e=0;h=b;l=b;j=Infinity;g=0;i=0;n=Infinity;k=0;m=0}},m=v.Point;(function(){if(m)return;m=v.Point=function(a,b){this.x=typeof a==n?a:0;this.y=typeof b==n?b:0};var a=m.prototype;a.plus=function(a){return new m(this.x+a.x,this.y+a.y)};a.minus=function(a){return new m(this.x-a.x,this.y-a.y)};a.times=function(a){return new m(this.x*a,this.y*a)};a.divide=function(a){return new m(this.x/a,this.y/a)};a.negate=function(){return new m(-this.x,-this.y)};a.distanceTo=function(a){return g.sqrt(g.pow(this.x-a.x,2)+g.pow(this.y-a.y,2))};a.apply=function(a){return new m(a(this.x),a(this.y))};a.equals=function(a){return a instanceof m&&this.x===a.x&&this.y===a.y};a.toString=function(){return "("+this.x+z+this.y+")"}})();var y=v.Rect;(function(){if(y)return;y=v.Rect=function(d,e,c,b){var a=this;a.x=typeof d==n?d:0;a.y=typeof e==n?e:0;a.width=typeof c==n?c:0;a.height=typeof b==n?b:0};var a=y.prototype;a.getAspectRatio=function(){return this.width/this.height};a.getTopLeft=function(){return new m(this.x,this.y)};a.getBottomRight=function(){var a=this;return new m(a.x+a.width,a.y+a.height)};a.getCenter=function(){var a=this;return new m(a.x+a.width/2,a.y+a.height/2)};a.getSize=function(){return new m(this.width,this.height)};a.equals=function(a){var b=this;return a instanceof y&&b.x===a.x&&b.y===a.y&&b.width===a.width&&b.height===a.height};a.toString=function(){var a=this;return "["+a.x+z+a.y+z+a.width+"x"+a.height+"]"}})();var Q=v.Spring=function(j){var c=this,d=typeof j==n?j:0,e=d,b=d,a=(new Date).getTime(),h=a,f=a;function k(b){var a=i.springStiffness;return (1-g.exp(-b*a))/(1-g.exp(-a))}c.getCurrent=function(){return d};c.getTarget=function(){return b};c.resetTo=function(c){b=c;f=a;e=b;h=f};c.springTo=function(c){e=d;h=a;b=c;f=h+1e3*i.animationTime};c.shiftBy=function(a){e+=a;b+=a};c.update=function(){a=(new Date).getTime();d=a>=f?b:e+(b-e)*k((a-h)/(f-h))}},A=v.Browser={UNKNOWN:0,IE:1,FIREFOX:2,SAFARI:3,CHROME:4,OPERA:5},e=function(){var t="DOMMouseScroll",l=this,o=l,x=["Msxml2.XMLHTTP","Msxml3.XMLHTTP","Microsoft.XMLHTTP"],z={bmp:c,jpeg:a,jpg:a,png:a,tif:c,wdp:c},u=A.UNKNOWN,p=0,v=c,y={};(function(){var d=navigator.appName,o=navigator.appVersion,a=navigator.userAgent;if(d=="Microsoft Internet Explorer"&&!!h.attachEvent&&!!h.ActiveXObject){var i=a.indexOf("MSIE");u=A.IE;p=parseFloat(a.substring(i+5,a.indexOf(";",i)));var j=r.documentMode;if(typeof j!==J)p=j}else if(d=="Netscape"&&!!h.addEventListener){var g=a.indexOf("Firefox"),b=a.indexOf("Safari"),l=a.indexOf("Chrome");if(g>=0){u=A.FIREFOX;p=parseFloat(a.substring(g+8))}else if(b>=0){var n=a.substring(0,b).lastIndexOf("/");u=l>=0?A.CHROME:A.SAFARI;p=parseFloat(a.substring(n+1,b))}}else if(d=="Opera"&&!!h.opera&&!!h.attachEvent){u=A.OPERA;p=parseFloat(o)}for(var m=h.location.search.substring(1),k=m.split("&"),f=0;f<k.length;f++){var c=k[f],e=c.indexOf("=");if(e>0)y[c.substring(0,e)]=decodeURIComponent(c.substring(e+1))}v=u==A.IE&&p<9||u==A.CHROME&&p<2})();function w(a,b){if(b&&a!=r.body)return r.body;else return a.offsetParent}l.getBrowser=function(){return u};l.getBrowserVersion=function(){return p};l.getElement=function(a){if(typeof a==I)a=r.getElementById(a);return a};l.getElementPosition=function(a){var a=o.getElement(a),b=new m,c=o.getElementStyle(a).position==H,d=w(a,c);while(d){b.x+=a.offsetLeft;b.y+=a.offsetTop;if(c)b=b.plus(o.getPageScroll());a=d;c=o.getElementStyle(a).position==H;d=w(a,c)}return b};l.getElementSize=function(a){var a=o.getElement(a);return new m(a.clientWidth,a.clientHeight)};l.getElementStyle=function(a){var a=o.getElement(a);if(a.currentStyle)return a.currentStyle;else if(h.getComputedStyle)return h.getComputedStyle(a,d);else q.fail("Unknown element style, no known technique.")};l.getEvent=function(a){return a?a:h.event};l.getMousePosition=function(a){var a=o.getEvent(a),b=new m;if(a.type==t&&u==A.FIREFOX&&p<3){b.x=a.screenX;b.y=a.screenY}else if(typeof a.pageX==n){b.x=a.pageX;b.y=a.pageY}else if(typeof a.clientX==n){b.x=a.clientX+r.body.scrollLeft+r.documentElement.scrollLeft;b.y=a.clientY+r.body.scrollTop+r.documentElement.scrollTop}else q.fail("Unknown event mouse position, no known technique.");return b};l.getMouseScroll=function(b){var b=o.getEvent(b),a=0;if(typeof b.wheelDelta==n)a=b.wheelDelta;else if(typeof b.detail==n)a=b.detail*-1;else q.fail("Unknown event mouse scroll, no known technique.");return a?a/g.abs(a):0};l.getPageScroll=function(){var a=new m,b=r.documentElement||{},c=r.body||{};if(typeof h.pageXOffset==n){a.x=h.pageXOffset;a.y=h.pageYOffset}else if(c.scrollLeft||c.scrollTop){a.x=c.scrollLeft;a.y=c.scrollTop}else if(b.scrollLeft||b.scrollTop){a.x=b.scrollLeft;a.y=b.scrollTop}return a};l.getWindowSize=function(){var a=new m,b=r.documentElement||{},c=r.body||{};if(typeof h.innerWidth==n){a.x=h.innerWidth;a.y=h.innerHeight}else if(b.clientWidth||b.clientHeight){a.x=b.clientWidth;a.y=b.clientHeight}else if(c.clientWidth||c.clientHeight){a.x=c.clientWidth;a.y=c.clientHeight}else q.fail("Unknown window size, no known technique.");return a};l.imageFormatSupported=function(a){var a=a?a:d;return !!z[a.toLowerCase()]};l.makeCenteredNode=function(h){var b="border:none; margin:0px; padding:0px;",h=e.getElement(h),c=o.makeNeutralElement(s),a=[];a.push('<div style="display:table; height:100%; width:100%;');a.push(b);a.push('#position:relative; overflow:hidden; text-align:left;">');a.push('<div style="#position:absolute; #top:50%; width:100%; ');a.push(b);a.push('display:table-cell; vertical-align:middle;">');a.push('<div style="#position:relative; #top:-50%; width:100%; ');a.push(b);a.push('text-align:center;"></div></div></div>');c.innerHTML=a.join(d);c=c.firstChild;var g=c,f=c.getElementsByTagName(s);while(f.length>0){g=f[0];f=g.getElementsByTagName(s)}g.appendChild(h);return c};l.makeNeutralElement=function(c){var b=r.createElement(c),a=b.style;a.background="transparent none";a.border=B;a.margin=j;a.padding=j;a.position="static";return b};l.makeTransparentImage=function(d){var c=o.makeNeutralElement("img"),a=b;if(u==A.IE&&p<7){a=o.makeNeutralElement(F);a.style.display=C;c.onload=function(){a.style.width=a.style.width||c.width+k;a.style.height=a.style.height||c.height+k;c.onload=b;c=b};c.src=d;a.style.filter="progid:DXImageTransform.Microsoft.AlphaImageLoader(src='"+d+"', sizingMethod='scale')"}else{a=c;a.src=d}return a};l.setElementOpacity=function(b,a,f){var b=o.getElement(b);if(f&&v)a=g.round(a);if(a<1)b.style.opacity=a;else b.style.opacity=d;var c=b.style.filter||d;b.style.filter=c.replace(/[\s]*alpha\(.*?\)[\s]*/g,d);if(a>=1)return;var e=g.round(100*a),h=" alpha(opacity="+e+") ";b.style.filter+=h};l.addEvent=function(a,c,d,b){var a=o.getElement(a);if(a.addEventListener){c==D&&a.addEventListener(t,d,b);a.addEventListener(c,d,b)}else if(a.attachEvent){a.attachEvent("on"+c,d);b&&a.setCapture&&a.setCapture()}else q.fail("Unable to attach event handler, no known technique.")};l.removeEvent=function(a,c,d,b){var a=o.getElement(a);if(a.removeEventListener){c==D&&a.removeEventListener(t,d,b);a.removeEventListener(c,d,b)}else if(a.detachEvent){a.detachEvent("on"+c,d);b&&a.releaseCapture&&a.releaseCapture()}else q.fail("Unable to detach event handler, no known technique.")};l.cancelEvent=function(b){var b=o.getEvent(b);b.preventDefault&&b.preventDefault();b.cancel=a;b.returnValue=c};l.stopEvent=function(b){var b=o.getEvent(b);b.stopPropagation&&b.stopPropagation();b.cancelBubble=a};l.createCallback=function(d,c){for(var b=[],a=2;a<arguments.length;a++)b.push(arguments[a]);return function(){for(var e=b.concat([]),a=0;a<arguments.length;a++)e.push(arguments[a]);return c.apply(d,e)}};l.getUrlParameter=function(c){var a=y[c];return a?a:b};l.makeAjaxRequest=function(j,d){var c=typeof d==f,a=b;if(c)var l=d,d=function(){h.setTimeout(e.createCallback(b,l,a),1)};if(h.ActiveXObject)for(var k=0;k<x.length;k++)try{a=new ActiveXObject(x[k]);break}catch(g){continue}else if(h.XMLHttpRequest)a=new XMLHttpRequest;!a&&q.fail("Browser doesn't support XMLHttpRequest.");if(i.proxyUrl)j=i.proxyUrl+j;if(c)a.onreadystatechange=function(){if(a.readyState==4){a.onreadystatechange=new Function;d()}};try{a.open("GET",j,c);a.send(b)}catch(g){q.log(g.name+" while making AJAX request: "+g.message);a.onreadystatechange=b;a=b;c&&d()}return c?b:a};l.parseXml=function(e){var d=b;if(h.ActiveXObject)try{d=new ActiveXObject("Microsoft.XMLDOM");d.async=c;d.loadXML(e)}catch(a){q.log(a.name+" while parsing XML (ActiveX): "+a.message)}else if(h.DOMParser)try{var f=new DOMParser;d=f.parseFromString(e,"text/xml")}catch(a){q.log(a.name+" while parsing XML (DOMParser): "+a.message)}else q.fail("Browser doesn't support XML DOM.");return d}};e=v.Utils=new e;var M=v.MouseTracker;(function(){var d="mouseup",j="mousedown";if(M)return;var l=e.getBrowser()==A.IE&&e.getBrowserVersion()<9,o=c,t=c,s={},m=[];function p(a){return e.getMousePosition(a)}function k(b,d){var c=e.getMousePosition(b),a=e.getElementPosition(d);return c.minus(a)}function n(b,a){var d=r.body;while(a&&b!=a&&d!=a)try{a=a.parentNode}catch(e){return c}return b==a}function u(){o=a}function w(){o=c}(function(){if(l){e.addEvent(r,j,u,c);e.addEvent(r,d,w,c)}else{e.addEvent(h,j,u,a);e.addEvent(h,d,w,a)}})();M=v.MouseTracker=function(u){var w="mousemove",z="mouseout",y="mouseover",x=this,v=x,H=b,M=g.random(),u=e.getElement(u),F=c,A=c,C=c,E=c,G=b,O=b,N=b;x.target=u;x.enterHandler=b;x.exitHandler=b;x.pressHandler=b;x.releaseHandler=b;x.clickHandler=b;x.dragHandler=b;x.scrollHandler=b;function X(){if(!F){e.addEvent(u,y,K,c);e.addEvent(u,z,L,c);e.addEvent(u,j,U,c);e.addEvent(u,d,B,c);e.addEvent(u,D,R,c);e.addEvent(u,"click",T,c);F=a;s[M]=H}}function Z(){if(F){e.removeEvent(u,y,K,c);e.removeEvent(u,z,L,c);e.removeEvent(u,j,U,c);e.removeEvent(u,d,B,c);e.removeEvent(u,D,R,c);e.removeEvent(u,"click",T,c);I();F=c;delete s[M]}}function Y(){if(!A){if(l){e.removeEvent(u,d,B,c);e.addEvent(u,d,V,a);e.addEvent(u,w,Q,a)}else{e.addEvent(h,d,P,a);e.addEvent(h,w,J,a)}A=a}}function I(){if(A){if(l){e.removeEvent(u,w,Q,a);e.removeEvent(u,d,V,a);e.addEvent(u,d,B,c)}else{e.removeEvent(h,w,J,a);e.removeEvent(h,d,P,a)}A=c}}function S(c,d){var b=s;for(var a in b)b.hasOwnProperty(a)&&M!=a&&b[a][c](d)}function ab(){return E}function K(b){var b=e.getEvent(b);l&&A&&!n(b.srcElement,u)&&S("onMouseOver",b);var g=b.target?b.target:b.srcElement,d=b.relatedTarget?b.relatedTarget:b.fromElement;if(!n(u,g)||n(u,d))return;E=a;if(typeof v.enterHandler==f)try{v.enterHandler(v,k(b,u),C,o)}catch(c){q.error(c.name+" while executing enter handler: "+c.message,c)}}function L(a){var a=e.getEvent(a);l&&A&&!n(a.srcElement,u)&&S("onMouseOut",a);var d=a.target?a.target:a.srcElement,g=a.relatedTarget?a.relatedTarget:a.toElement;if(!n(u,d)||n(u,g))return;E=c;if(typeof v.exitHandler==f)try{v.exitHandler(v,k(a,u),C,o)}catch(b){q.error(b.name+" while executing exit handler: "+b.message,b)}}function U(b){var b=e.getEvent(b);if(b.button==2)return;C=a;G=p(b);N=G;O=(new Date).getTime();if(typeof v.pressHandler==f)try{v.pressHandler(v,k(b,u))}catch(c){q.error(c.name+" while executing press handler: "+c.message,c)}(v.pressHandler||v.dragHandler)&&e.cancelEvent(b);if(!l||!t){Y();t=a;m=[H]}else l&&m.push(H)}function B(a){var a=e.getEvent(a),g=C,d=E;if(a.button==2)return;C=c;if(typeof v.releaseHandler==f)try{v.releaseHandler(v,k(a,u),g,d)}catch(b){q.error(b.name+" while executing release handler: "+b.message,b)}g&&d&&W(a)}function V(a){var a=e.getEvent(a);if(a.button==2)return;for(var b=0;b<m.length;b++){var d=m[b];!d.hasMouse()&&d.onMouseUp(a)}I();t=c;a.srcElement.fireEvent("on"+a.type,r.createEventObject(a));e.stopEvent(a)}function P(a){!E&&B(a);I()}function T(a){v.clickHandler&&e.cancelEvent(a)}function W(a){var a=e.getEvent(a);if(a.button==2)return;var h=(new Date).getTime()-O,d=p(a),c=N.distanceTo(d),g=h<=i.clickTimeThreshold&&c<=i.clickDistThreshold;if(typeof v.clickHandler==f)try{v.clickHandler(v,k(a,u),g,a.shiftKey)}catch(b){q.error(b.name+" while executing click handler: "+b.message,b)}}function J(a){var a=e.getEvent(a),c=p(a),d=c.minus(G);G=c;if(typeof v.dragHandler==f){try{v.dragHandler(v,k(a,u),d,a.shiftKey)}catch(b){q.error(b.name+" while executing drag handler: "+b.message,b)}e.cancelEvent(a)}}function Q(b){for(var a=0;a<m.length;a++)m[a].onMouseMove(b);e.stopEvent(b)}function R(a){var a=e.getEvent(a),c=e.getMouseScroll(a);if(typeof v.scrollHandler==f){if(c)try{v.scrollHandler(v,k(a,u),c,a.shiftKey)}catch(b){q.error(b.name+" while executing scroll handler: "+b.message,b)}e.cancelEvent(a)}}(function(){H={hasMouse:ab,onMouseOver:K,onMouseOut:L,onMouseUp:B,onMouseMove:J}})();x.isTracking=function(){return F};x.setTracking=function(a){if(a)X();else Z()}}})();var W=v.EventManager=function(){var b=this,a={};b.addListener=function(b,c){if(typeof c!=f)return;if(!a[b])a[b]=[];a[b].push(c)};b.removeListener=function(e,d){var b=a[e];if(typeof d!=f)return;else if(!b)return;for(var c=0;c<b.length;c++)if(d==b[c]){b.splice(c,1);return}};b.clearListeners=function(b){if(a[b])delete a[b]};b.trigger=function(e){var d=a[e],f=[];if(!d)return;for(var b=1;b<arguments.length;b++)f.push(arguments[b]);for(var b=0;b<d.length;b++)try{d[b].apply(h,f)}catch(c){q.error(c.name+L+e+" handler: "+c.message,c)}}},S;(function(){var d=15000;function g(i,j){var e=b,f=b;function g(a){e.onload=b;e.onabort=b;e.onerror=b;f&&h.clearTimeout(f);h.setTimeout(function(){j(i,a?e:b)},1)}this.start=function(){e=new Image;var j=function(){g(a)},b=function(){g(c)},k=function(){q.log("Image timed out: "+i);g(c)};e.onload=j;e.onabort=b;e.onerror=b;f=h.setTimeout(k,d);e.src=i}}S=v.ImageLoader=function(){var d=0;function h(b,e,c){d--;if(typeof b==f)try{b(c)}catch(a){q.error(a.name+L+e+" callback: "+a.message,a)}}this.loadImage=function(l,f){if(d>=i.imageLoaderLimit)return c;var j=e.createCallback(b,h,f),k=new g(l,j);d++;k.start();return a}}})();var O,R;(function(){var i={REST:0,GROUP:1,HOVER:2,DOWN:3};O=v.Button=function(W,V,S,T,U,y,q,v,x,z){var l=e.makeNeutralElement(F),k=i.GROUP,m=new M(l),H=e.makeTransparentImage(V),r=e.makeTransparentImage(S),s=e.makeTransparentImage(T),t=e.makeTransparentImage(U),y=typeof y==f?y:b,q=typeof q==f?q:b,v=typeof v==f?v:b,x=typeof x==f?x:b,z=typeof z==f?z:b,G=0,P=2e3,D=b,B=c;this.elmt=l;function E(){h.setTimeout(R,20)}function R(){if(B){var c=(new Date).getTime(),d=c-D,b=1-d/P;b=g.min(1,b);b=g.max(0,b);e.setElementOpacity(r,b,a);b>0&&E()}}function N(){B=a;D=(new Date).getTime()+G;h.setTimeout(E,G)}function Q(){B=c;e.setElementOpacity(r,1,a)}function p(a){if(a>=i.GROUP&&k==i.REST){Q();k=i.GROUP}if(a>=i.HOVER&&k==i.GROUP){s.style.visibility=d;k=i.HOVER}if(a>=i.DOWN&&k==i.HOVER){t.style.visibility=d;k=i.DOWN}}function n(a){if(a<=i.HOVER&&k==i.DOWN){t.style.visibility=o;k=i.HOVER}if(a<=i.GROUP&&k==i.HOVER){s.style.visibility=o;k=i.GROUP}if(a<=i.REST&&k==i.GROUP){N();k=i.REST}}function K(d,c,a,b){if(a){p(i.DOWN);x&&x()}else!b&&p(i.HOVER)}function O(d,c,a){n(i.GROUP);a&&z&&z()}function L(){p(i.DOWN);y&&y()}function I(d,c,a,b){if(a&&b){n(i.HOVER);q&&q()}else if(a)n(i.GROUP);else p(i.HOVER)}function J(c,b,a){v&&a&&v()}this.notifyGroupEnter=function(){p(i.GROUP)};this.notifyGroupExit=function(){n(i.REST)};(function(){l.style.display=C;l.style.position=u;l.title=W;l.appendChild(H);l.appendChild(r);l.appendChild(s);l.appendChild(t);var g=H.style,f=r.style,b=s.style,c=t.style;f.position=b.position=c.position=w;f.top=b.top=c.top=j;f.left=b.left=c.left=j;b.visibility=c.visibility=o;if(e.getBrowser()==A.FIREFOX&&e.getBrowserVersion()<3)f.top=b.top=c.top=d;m.enterHandler=K;m.exitHandler=O;m.pressHandler=L;m.releaseHandler=I;m.clickHandler=J;m.setTracking(a);n(i.REST)})()};R=v.ButtonGroup=function(b){var d=e.makeNeutralElement(F),b=b.concat([]),c=new M(d);this.elmt=d;function f(){for(var a=0;a<b.length;a++)b[a].notifyGroupEnter()}function g(f,e,c){if(!c)for(var a=0;a<b.length;a++)b[a].notifyGroupExit()}function h(f,e,d,c){if(!c)for(var a=0;a<b.length;a++)b[a].notifyGroupExit()}this.emulateEnter=function(){f()};this.emulateExit=function(){g()};(function(){d.style.display=C;for(var e=0;e<b.length;e++)d.appendChild(b[e].elmt);c.enterHandler=f;c.exitHandler=g;c.releaseHandler=h;c.setTracking(a)})()}})();var T=v.TileSource=function(d,c,i,e,h,f){var b=this,a=b,j=c/d;b.width=d;b.height=c;b.aspectRatio=d/c;b.dimensions=new m(d,c);b.minLevel=h?h:0;b.maxLevel=f?f:g.ceil(g.log(g.max(d,c))/g.log(2));b.tileSize=i?i:0;b.tileOverlap=e?e:0;b.getLevelScale=function(b){return 1/(1<<a.maxLevel-b)};b.getNumTiles=function(e){var b=a.getLevelScale(e),f=g.ceil(b*d/a.tileSize),h=g.ceil(b*c/a.tileSize);return new m(f,h)};b.getPixelRatio=function(c){var b=a.dimensions.times(a.getLevelScale(c)),d=1/b.x,e=1/b.y;return new m(d,e)};b.getTileAtPoint=function(h,d){var b=a.dimensions.times(a.getLevelScale(h)),c=d.times(b.x),e,f;if(d.x>=0&&d.x<=1)e=g.floor(c.x/a.tileSize);else e=g.ceil(b.x/a.tileSize)*g.floor(c.x/b.x)+g.floor((b.x+c.x%b.x)%b.x/a.tileSize);if(d.y>=0&&d.y<=j)f=g.floor(c.y/a.tileSize);else f=g.ceil(b.y/a.tileSize)*g.floor(c.y/b.y)+g.floor((b.y+c.y%b.y)%b.y/a.tileSize);return new m(e,f)};b.getTileBounds=function(k,f,h){var c=a.dimensions.times(a.getLevelScale(k)),i=f===0?0:a.tileSize*f-a.tileOverlap,j=h===0?0:a.tileSize*h-a.tileOverlap,d=a.tileSize+(f===0?1:2)*a.tileOverlap,e=a.tileSize+(h===0?1:2)*a.tileOverlap;d=g.min(d,c.x-i);e=g.min(e,c.y-j);var b=1/c.x;return new y(i*b,j*b,d*b,e*b)};b.getTileUrl=function(){throw new Error("Method not implemented.")};b.tileExists=function(b,d,e){var c=a.getNumTiles(b);return b>=a.minLevel&&b<=a.maxLevel&&d>=0&&e>=0&&d<c.x&&e<c.y}},P=v.DisplayRect=function(e,f,d,c,b,a){y.apply(this,arguments);this.minLevel=b;this.maxLevel=a};P.prototype=new y;var K=v.DziTileSource=function(m,l,e,j,k,i,f){var b=this;T.apply(b,[m,l,e,j]);var n=b,h={};b.fileFormat=i;b.tileFormat=i;b.displayRects=f;(function(){if(!f)return;for(var c=f.length-1;c>=0;c--)for(var b=f[c],a=b.minLevel;a<=b.maxLevel;a++){if(!h[a])h[a]=[];h[a].push(b)}})();b.getTileUrl=function(a,b,c){return [k,a,"/",b,"_",c,".",i].join(d)};b.tileExists=function(d,p,q){var f=h[d];if(!f||!f.length)return a;for(var i=n.getLevelScale(d),o=f.length-1;o>=0;o--){var b=f[o];if(d<b.minLevel||d>b.maxLevel)continue;var j=b.x*i,k=b.y*i,l=j+b.width*i,m=k+b.height*i;j=g.floor(j/e);k=g.floor(k/e);l=g.ceil(l/e);m=g.ceil(m/e);if(j<=p&&p<l&&k<=q&&q<m)return a}return c}};K.prototype=new T;(function(){var c="Errors.Empty";function a(a){Error.apply(this,arguments);this.message=a}a.prototype=new Error;function i(b){if(!(b instanceof a)){q.error(b.name+" while creating DZI from XML: "+b.message);b=new a(x.getString("Errors.Unknown"))}return b}function d(d){var a=d.split("/"),b=a[a.length-1],c=b.lastIndexOf(".");if(c>-1)a[a.length-1]=b.slice(0,c);return a.join("/")+"_files/"}function j(c,i){if(!c)throw new a(x.getString("Errors.Security"));else if(c.status!==200&&c.status!==0){var f=c.status,h=f==404?"Not Found":c.statusText;throw new a(x.getString("Errors.Status",f,h))}var d=b;if(c.responseXML&&c.responseXML.documentElement)d=c.responseXML;else if(c.responseText)d=e.parseXml(c.responseText);return g(d,i)}function g(d,g){var b="Errors.Dzi";if(!d||!d.documentElement)throw new a(x.getString("Errors.Xml"));var e=d.documentElement,c=e.tagName;if(c=="Image")try{return l(e,g)}catch(f){var h=x.getString(b);throw f instanceof a?f:new a(h)}else if(c=="Collection")throw new a(x.getString("Errors.Dzc"));else if(c=="Error")return k(e);throw new a(x.getString(b))}function l(b,m){var f=b.getAttribute("Format");if(!e.imageFormatSupported(f))throw new a(x.getString("Errors.ImageFormat",f.toUpperCase()));for(var j=b.getElementsByTagName("Size")[0],h=b.getElementsByTagName("DisplayRect"),o=parseInt(j.getAttribute("Width"),p),n=parseInt(j.getAttribute("Height"),p),l=parseInt(b.getAttribute("TileSize")),k=parseInt(b.getAttribute("Overlap")),i=[],g=0;g<h.length;g++){var d=h[g],c=d.getElementsByTagName("Rect")[0];i.push(new P(parseInt(c.getAttribute("X"),p),parseInt(c.getAttribute("Y"),p),parseInt(c.getAttribute("Width"),p),parseInt(c.getAttribute("Height"),p),parseInt(d.getAttribute("MinLevel"),p),parseInt(d.getAttribute("MaxLevel"),p)))}return new K(o,n,l,k,m,f,i)}function k(c){var b=c.getElementsByTagName("Message")[0],d=b.firstChild.nodeValue;throw new a(d)}K.getTilesUrl=d;K.createFromJson=function(q,o){var r=typeof o==f,m,k,g=q;if(!g||!g.url&&!g.tilesUrl)k=new a(x.getString(c));else try{var l=g.displayRects;if(l&&l.length)for(var n=0,s=l.length;n<s;n++){var j=l[n];l[n]=new P(j.x||j[0],j.y||j[1],j.width||j[2],j.height||j[3],j.minLevel||j[4],j.maxLevel||j[5])}m=new K(g.width,g.height,g.tileSize,g.tileOverlap,g.tilesUrl||d(g.url),g.tileFormat,g.displayRects);m.xmlUrl=g.url}catch(p){k=i(p)}if(r)h.setTimeout(e.createCallback(b,o,m,k&&k.message),1);else if(k)throw k;else return m};K.createFromXml=function(l,m,n){var p=typeof n==f,k=b;if(!l){k=x.getString(c);if(p){h.setTimeout(function(){n(b,k)},1);return b}throw new a(k)}var q=d(l);function o(d,e){try{var c=d(e,q);c.xmlUrl=l;return c}catch(a){if(p){k=i(a).message;return b}else throw i(a)}}if(p){if(m)h.setTimeout(function(){var a=o(g,e.parseXml(m));n(a,k)},1);else e.makeAjaxRequest(l,function(b){var a=o(j,b);n(a,k)});return b}if(m)return o(g,e.parseXml(m));else return o(j,e.makeAjaxRequest(l))}})();var X=v.Viewport=function(e,n){var d=this,c=d,e=new m(e.x,e.y),s=n.x/n.y,o=n.y/n.x,h=new Q(0),j=new Q(0),l=new Q(i.logarithmicZoom?0:1),f=b,k=new y(0,0,1,o),q=k.getCenter(),A=g.LN2;function z(){c.goHome(a);c.update()}function u(a){return g.log(a)/A}function w(a){return g.pow(2,a)}function r(c,b,a){return g.min(g.max(c,b),a)}function x(b,a){var d=b.x,f=b.y,c=r(d,a.x,a.x+a.width),e=r(f,a.y,a.y+a.height);return d===c&&f===e?b:new m(c,e)}function p(h){var k=c.getZoom(h),g=1/k,j=g/c.getAspectRatio(),f=i.visibilityRatio,d=(f-t)*g,e=(f-t)*j,a=1-2*d,b=o-2*e;if(a<0){d+=t*a;a=0}if(b<0){e+=t*b;b=0}return new v.Rect(d,e,a,b)}d.getHomeBounds=function(){var b=c.getAspectRatio(),a=new y(k.x,k.y,k.width,k.height);if(s>=b){a.height=k.width/b;a.y=q.y-a.height/2}else{a.width=k.height*b;a.x=q.x-a.width/2}return a};d.getHomeCenter=function(){return q};d.getHomeZoom=function(){var a=s/c.getAspectRatio();return a>=1?1:a};d.getMinCenter=function(a){return p(a).getTopLeft()};d.getMaxCenter=function(a){return p(a).getBottomRight()};d.getMinZoom=function(){var a=c.getHomeZoom();if(i.minZoomDimension)var b=n.x<=n.y?i.minZoomDimension/e.x:i.minZoomDimension/(e.x*o);else var b=i.minZoomImageRatio*a;return g.min(b,a)};d.getMaxZoom=function(){var a=n.x*i.maxZoomPixelRatio/e.x;return g.max(a,c.getHomeZoom())};d.getAspectRatio=function(){return e.x/e.y};d.getContainerSize=function(){return new m(e.x,e.y)};d.getBounds=function(b){var d=c.getCenter(b),a=1/c.getZoom(b),e=a/c.getAspectRatio();return new y(d.x-a/2,d.y-e/2,a,e)};d.getCenter=function(r){var b=new m(h.getCurrent(),j.getCurrent()),g=new m(h.getTarget(),j.getTarget());if(r)return b;else if(!f)return g;var l=c.getZoom(),d=1/l,k=d/c.getAspectRatio(),i=new y(b.x-d/2,b.y-k/2,d,k),q=c.pixelFromPoint(f,a),p=f.minus(i.getTopLeft()).times(e.x/i.width),n=p.minus(q),o=n.divide(e.x*l);return g.plus(o)};d.getZoom=function(b){var a;if(b){a=l.getCurrent();return i.logarithmicZoom?w(a):a}else{a=l.getTarget();return i.logarithmicZoom?w(a):a}};d.applyConstraints=function(g){var h=c.getZoom(),d=r(h,c.getMinZoom(),c.getMaxZoom());h!=d&&c.zoomTo(d,f,g);var b=c.getCenter(),a=x(b,p());if(i.wrapHorizontal)a.x=b.x;if(i.wrapVertical)a.y=b.y;if(!b.equals(a)){var e=1/d,j=e/c.getAspectRatio();c.fitBounds(new y(a.x-t*e,a.y-t*j,e,j),g)}};d.ensureVisible=function(a){c.applyConstraints(a)};d.fitBounds=function(f,j){var h=c.getAspectRatio(),i=f.getCenter(),d=new y(f.x,f.y,f.width,f.height);if(d.getAspectRatio()>=h){d.height=f.width/h;d.y=i.y-d.height/2}else{d.width=f.height*h;d.x=i.x-d.width/2}c.panTo(c.getCenter(a),a);c.zoomTo(c.getZoom(a),b,a);var g=c.getBounds(),m=c.getZoom(),k=1/d.width;if(k==m||d.width==g.width){c.panTo(i,j);return}var l=g.getTopLeft().times(e.x/g.width).minus(d.getTopLeft().times(e.x/d.width)).divide(e.x/g.width-e.x/d.width);c.zoomTo(k,l,j)};d.goHome=function(b){var a=c.getCenter();if(i.wrapHorizontal){a.x=(1+a.x%1)%1;h.resetTo(a.x);h.update()}if(i.wrapVertical){a.y=(o+a.y%o)%o;j.resetTo(a.y);j.update()}c.fitBounds(k,b)};d.panBy=function(b,a){c.panTo(c.getCenter().plus(b),a)};d.panTo=function(b,q){if(q){h.resetTo(b.x);j.resetTo(b.y);return}if(!f){h.springTo(b.x);j.springTo(b.y);return}var l=c.getZoom(),d=1/l,k=d/c.getAspectRatio(),i=new y(h.getCurrent()-d/2,j.getCurrent()-k/2,d,k),p=c.pixelFromPoint(f,a),o=f.minus(i.getTopLeft()).times(e.x/i.width),m=o.minus(p),n=m.divide(e.x*l),g=b.minus(n);h.springTo(g.x);j.springTo(g.y)};d.zoomBy=function(d,b,a){c.zoomTo(c.getZoom()*d,b,a)};d.zoomTo=function(a,c,d){if(d)l.resetTo(i.logarithmicZoom?u(a):a);else l.springTo(i.logarithmicZoom?u(a):a);f=c instanceof m?c:b};d.resize=function(d,h){var f=c.getBounds(),b=f,g=d.x/e.x;e=new m(d.x,d.y);if(h){b.width=f.width*g;b.height=b.width/c.getAspectRatio()}c.fitBounds(b,a)};d.update=function(){var m=h.getCurrent(),n=j.getCurrent(),e=l.getCurrent();if(f)var k=c.pixelFromPoint(f,a);l.update();if(f&&l.getCurrent()!=e){var i=c.pixelFromPoint(f,a),g=i.minus(k),d=c.deltaPointsFromPixels(g,a);h.shiftBy(d.x);j.shiftBy(d.y)}else f=b;h.update();j.update();return h.getCurrent()!=m||j.getCurrent()!=n||l.getCurrent()!=e};d.deltaPixelsFromPoints=function(a,b){return a.times(e.x*c.getZoom(b))};d.deltaPointsFromPixels=function(a,b){return a.divide(e.x*c.getZoom(b))};d.pixelFromPoint=function(d,b){var a=c.getBounds(b);return d.minus(a.getTopLeft()).times(e.x/a.width)};d.pointFromPixel=function(d,b){var a=c.getBounds(b);return d.divide(e.x/a.width).plus(a.getTopLeft())};z()},V,E;(function(){var n="progid:DXImageTransform.Microsoft.Matrix(",j=" when it's not yet loaded.",h="Attempting to draw tile ",W=100,G=t,u=e.getBrowser(),P=e.getBrowserVersion(),bb=navigator.userAgent,R=!!r.createElement("canvas").getContext,T=r.documentElement||{},H=T.style||{},C=c,K=["msTransform","WebkitTransform","MozTransform"],f,B;while(f=K.shift())if(typeof H[f]!==J){C=a;B=/webkit/i.test(f);break}var X="-webkit-transform",L="WebkitTransition",Z=typeof H[L]!==J,O="progid:DXImageTransform.Microsoft.Matrix",Y=new RegExp(O+"\\(.*?\\)","g"),ab=function(){try{return u==A.IE&&!!r.documentElement.filters}catch(a){return c}}(),Q=u==A.SAFARI&&P<4||u==A.CHROME,p=R&&!Q,F=!p&&C,I=c,M=typeof r.documentMode!==J?"bicubic":"nearest-neighbor";function o(f,h,i,d,e,g){var a=this;a.level=f;a.x=h;a.y=i;a.bounds=d;a.exists=e;a.url=g;a.elmt=b;a.image=b;a.loaded=c;a.loading=c;a.style=b;a.position=b;a.size=b;a.blendStart=b;a.opacity=b;a.distance=b;a.visibility=b;a.beingDrawn=c;a.lastDrawnTime=0;a.lastTouchTime=0}o.prototype.toString=function(){return this.level+"/"+this.x+"_"+this.y};o.prototype.drawHTML=function(l){var a=this;if(!a.loaded){q.error(h+a.toString()+j);return}if(!a.elmt){a.elmt=e.makeNeutralElement("img");a.elmt.src=a.url;a.style=a.elmt.style;a.style.position=w;a.style.msInterpolationMode=M;if(F)a.style[f+"Origin"]="0px 0px"}var m=a.elmt,r=a.image,c=a.style,b=a.position,i=a.size;m.parentNode!=l&&l.appendChild(m);if(F)c[f]=["matrix(",(i.x/r.width).toFixed(8),",0,0,",(i.y/r.height).toFixed(8),z,b.x.toFixed(8),B?z:"px,",b.y.toFixed(8),B?")":"px)"].join(d);else if(I){var p=l.clientWidth,o=l.clientHeight;c.width=p+k;c.height=o+k;c.filter=[n,"M11=",(i.x/p).toFixed(8),",M22=",(i.y/o).toFixed(8),",Dx=",b.x.toFixed(8),",Dy=",b.y.toFixed(8),")"].join(d)}else{b=b.apply(g.floor);i=i.apply(g.ceil);c.left=b.x+k;c.top=b.y+k;c.width=i.x+k;c.height=i.y+k}e.setElementOpacity(m,a.opacity)};o.prototype.drawCanvas=function(c){var a=this;if(!a.loaded){q.error(h+a.toString()+j);return}var b=a.position,d=a.size;c.globalAlpha=a.opacity;c.drawImage(a.image,b.x,b.y,d.x,d.y)};o.prototype.unload=function(){var a=this;a.elmt&&a.elmt.parentNode&&a.elmt.parentNode.removeChild(a.elmt);a.elmt=b;a.image=b;a.loaded=c;a.loading=c};E=v.OverlayPlacement={CENTER:0,TOP_LEFT:1,TOP:2,TOP_RIGHT:3,RIGHT:4,BOTTOM_RIGHT:5,BOTTOM:6,BOTTOM_LEFT:7,LEFT:8};function D(a){switch(a){case E.TOP_LEFT:return function(){};case E.TOP:return function(a,b){a.x-=b.x/2};case E.TOP_RIGHT:return function(a,b){a.x-=b.x};case E.RIGHT:return function(a,b){a.x-=b.x;a.y-=b.y/2};case E.BOTTOM_RIGHT:return function(a,b){a.x-=b.x;a.y-=b.y};case E.BOTTOM:return function(a,b){a.x-=b.x/2;a.y-=b.y};case E.BOTTOM_LEFT:return function(a,b){a.y-=b.y};case E.LEFT:return function(a,b){a.y-=b.y/2};case E.CENTER:default:return function(a,b){a.x-=b.x/2;a.y-=b.y/2}}}function x(c,a,d){var b=this;b.elmt=c;b.scales=a instanceof y;b.bounds=new y(a.x,a.y,a.width,a.height);b.adjust=D(a instanceof m?d:E.TOP_LEFT);b.position=new m(a.x,a.y);b.size=new m(a.width,a.height);b.style=c.style;b.naturalSize=new m(c.clientWidth,c.clientHeight)}x.prototype.destroy=function(){var b=this.elmt,a=this.style;b.parentNode&&b.parentNode.removeChild(b);a.top=d;a.left=d;a.position=d;if(this.scales){a.width=d;a.height=d}};x.prototype.drawHTML=function(m){var h=this,c=h.elmt,a=h.style,o=h.scales,j=h.naturalSize;if(c.parentNode!=m){m.appendChild(c);a.position=w;j.x=c.clientWidth;j.y=c.clientHeight}var e=h.position,b=h.size;if(!o){b.x=j.x=j.x||c.clientWidth;b.y=j.y=j.y||c.clientHeight}h.adjust(e,b);if(i.transformOverlays&&C){a[f+"Origin"]="0px 0px";a[f]=["translate(",e.x.toFixed(8),"px,",e.y.toFixed(8),"px)"].join(d);if(o){if(!c.clientWidth)a.width=l;if(!c.clientHeight)a.height=l;a[f]+=[" scale(",(b.x/c.clientWidth).toFixed(8),z,(b.y/c.clientHeight).toFixed(8),")"].join(d)}}else if(i.transformOverlays&&I){var q=m.clientWidth,p=m.clientHeight;a.width=q+k;a.height=p+k;a.filter=[n,"M11=",(b.x/q).toFixed(8),",M22=",(b.y/p).toFixed(8),",Dx=",e.x.toFixed(8),",Dy=",e.y.toFixed(8),")"].join(d)}else{e=e.apply(g.floor);b=b.apply(g.ceil);a.left=e.x+k;a.top=e.y+k;if(o){a.width=b.x+k;a.height=b.y+k}}};x.prototype.update=function(a,b){this.scales=a instanceof y;this.bounds=new y(a.x,a.y,a.width,a.height);this.adjust=D(a instanceof m?b:E.TOP_LEFT)};V=v.Drawer=function(f,C,ib){var h=this,B=e.getElement(ib),z=e.makeNeutralElement(p?"canvas":s),gb=p?z.getContext("2d"):b,T=new S,J=new U,eb=f.minLevel,db=f.maxLevel,fb=f.tileSize,X=f.tileOverlap,H=f.height/f.width,F={},D={},r={},v=[],k={},n=[],bb=[],K=0,L=0,I=c,j=a;h.elmt=B;h.profiler=J;(function(){z.style.width=l;z.style.height=l;z.style.position=w;B.style.textAlign="left";B.appendChild(z)})();function R(a){if(!F[a])F[a]=f.getNumTiles(a);return F[a]}function M(a){if(!D[a])D[a]=f.getPixelRatio(a);return D[a]}function hb(a,b,c,l,d,e){if(!r[a])r[a]={};if(!r[a][b])r[a][b]={};if(!r[a][b][c]){var g=(d+b%d)%d,h=(e+c%e)%e,i=f.getTileBounds(a,g,h),k=f.tileExists(a,g,h),m=f.getTileUrl(a,g,h);i.x+=1*(b-g)/d;i.y+=H*(c-h)/e;r[a][b][c]=new o(a,b,c,i,k,m)}var j=r[a][b][c];j.lastTouchTime=l;return j}function cb(a,c){a.loading=T.loadImage(a.url,e.createCallback(b,Z,a,c))}function Z(d,s,n){d.loading=c;if(I){q.error("Tile load callback in middle of drawing routine.");return}else if(!n){q.log("Tile "+d+" failed to load: "+d.url);d.exists=c;return}else if(s<L){q.log("Ignoring tile "+d+" loaded before reset: "+d.url);return}d.loaded=a;d.image=n;var k=v.length;if(v.length>=W){for(var r=g.ceil(g.log(fb)/g.log(2)),e=b,i=-1,h=v.length-1;h>=0;h--){var f=v[h];if(f.level<=r||f.beingDrawn)continue;else if(!e){e=f;i=h;continue}var m=f.lastTouchTime,l=e.lastTouchTime,p=f.level,o=e.level;if(m<l||m==l&&p>o){e=f;i=h}}if(e&&i>=0){e.unload();k=i}}v[k]=d;j=a}function Y(){r={};v=[]}function y(b,d,g){if(!k[b])return c;if(d===N||g===N){var f=k[b];for(var h in f)if(f.hasOwnProperty(h)){var e=f[h];for(var i in e)if(e.hasOwnProperty(i)&&!e[i])return c}return a}return k[b][d]===N||k[b][d][g]===N||k[b][d][g]===a}function ab(a,b,c){if(b===N||c===N)return y(a+1);else return y(a+1,2*b,2*c)&&y(a+1,2*b,2*c+1)&&y(a+1,2*b+1,2*c)&&y(a+1,2*b+1,2*c+1)}function V(a,b,d,c){if(!k[a]){q.error("Setting coverage for a tile before its level's coverage has been reset: "+a);return}if(!k[a][b])k[a][b]={};k[a][b][d]=c}function O(a){k[a]={}}function P(b,a){if(!b)return a;if(a.visibility>b.visibility)return a;else if(a.visibility==b.visibility)if(a.distance<b.distance)return a;return b}function E(b){for(var a=n.length-1;a>=0;a--)if(n[a].elmt==b)return a;return -1}function Q(){j=c;var Q=z,Fb=gb,gc=B,xb=p,D=bb;while(D.length>0){var e=D.pop();e.beingDrawn=c}var ub=C.getContainerSize(),sb=ub.x,rb=ub.y;if(xb){Q.width=sb;Q.height=rb;Fb.clearRect(0,0,sb,rb)}else Q.innerHTML=d;var qb=C.getBounds(a),s=qb.getTopLeft(),r=qb.getBottomRight();if(!i.wrapHorizontal&&(r.x<0||s.x>1))return;else if(!i.wrapVertical&&(r.y<0||s.y>H))return;var Rb=R,F=M,cc=hb,Yb=ab,I=V,Ob=O,Kb=y,Sb=X,Nb=K,bc=u===A.CHROME,ec=g.abs,hc=g.ceil,jb=g.floor,T=g.log,lb=g.max,k=g.min,q=C.deltaPixelsFromPoints,E=C.pixelFromPoint,pb=f.getTileAtPoint,Tb=i.alwaysBlend,U=1e3*i.blendTime,Lb=i.immediateRender,Y=i.minZoomDimension,fc=i.minImageRatio,W=i.wrapHorizontal,Z=i.wrapVertical,vb=i.wrapOverlays;if(!W){s.x=lb(s.x,0);r.x=k(r.x,1)}if(!Z){s.y=lb(s.y,0);r.y=k(r.y,H)}var S=b,L=c,v=(new Date).getTime(),mb=C.getCenter(),Ib=E(mb),Xb=q(F(0),c).x,nb=Lb?1:Xb;Y=Y||64;var J=lb(eb,jb(T(Y)/T(2))),Wb=q(F(0),a).x,tb=k(db,jb(T(Wb/G)/T(2)));J=k(J,tb);for(var h=tb;h>=J;h--){var zb=c,ob=q(F(h),a).x;if(!L&&ob>=G||h==J){zb=a;L=a}else if(!L)continue;Ob(h);var Pb=k(1,(ob-t)/t),Jb=q(F(h),c).x,Mb=nb/ec(nb-Jb),Hb=pb(h,s),w=pb(h,r),Eb=Rb(h),Ab=Eb.x,Bb=Eb.y;if(!W)w.x=k(w.x,Ab-1);if(!Z)w.y=k(w.y,Bb-1);for(var l=Hb.x;l<=w.x;l++)for(var o=Hb.y;o<=w.y;o++){var e=cc(h,l,o,v,Ab,Bb),fb=zb;I(h,l,o,c);if(!e.exists)continue;if(L&&!fb)if(Yb(h,l,o))I(h,l,o,a);else fb=a;if(!fb)continue;var Db=e.bounds.getTopLeft(),wb=e.bounds.getSize(),Zb=E(Db,a),kb=q(wb,a);if(!Sb)kb=kb.plus(new m(1,1));var ac=E(Db,c),dc=q(wb,c),Vb=ac.plus(dc.divide(2)),Qb=Ib.distanceTo(Vb);e.position=Zb;e.size=kb;e.distance=Qb;e.visibility=Mb;if(e.loaded){if(!e.blendStart)e.blendStart=v;var yb=v-e.blendStart,ib=U===0?1:k(1,yb/U);if(Tb)ib*=Pb;e.opacity=ib;D.push(e);if(ib>=1){I(h,l,o,a);bc&&e.lastDrawnTime!==Nb&&I(h,l,o,c)}else if(yb<U)j=a;e.lastDrawnTime=v}else if(!e.loading)S=P(S,e)}if(Kb(h))break}for(var x=D.length-1;x>=0;x--){var e=D[x];if(xb)e.drawCanvas(Fb);else e.drawHTML(Q);e.beingDrawn=a}for(var Ub=n.length,x=0;x<Ub;x++){var N=n[x],Gb=N.bounds,Cb=Gb.getTopLeft();if(vb&&W)Cb.x+=jb(mb.x);if(vb&&Z);N.position=E(Cb,a);N.size=q(Gb.getSize(),a);N.drawHTML(B)}if(S){cb(S,v);j=a}K=v}h.addOverlay=function(b,d,c){var b=e.getElement(b);if(E(b)>=0)return;n.push(new x(b,d,c));j=a};h.updateOverlay=function(b,f,d){var b=e.getElement(b),c=E(b);if(c>=0){n[c].update(f,d);j=a}};h.removeOverlay=function(c){var c=e.getElement(c),b=E(c);if(b>=0){n[b].destroy();n.splice(b,1);j=a}};h.clearOverlays=function(){while(n.length>0){n.pop().destroy();j=a}};h.needsUpdate=function(){return j};h.numTilesLoaded=function(){return v.length};h.reset=function(){Y();L=(new Date).getTime();j=a};h.update=function(){J.beginUpdate();I=a;Q();I=c;J.endUpdate()};h.idle=function(){}}})();var Y,G;(function(){var L="----seadragon----",Q=e.getBrowser();G=v.ControlAnchor={NONE:0,TOP_LEFT:1,TOP_RIGHT:2,BOTTOM_RIGHT:3,BOTTOM_LEFT:4};function P(c,b,a){if(b==G.TOP_RIGHT||b==G.BOTTOM_RIGHT)a.insertBefore(c,a.firstChild);else a.appendChild(c)}function f(f,c,d){var b=this,a=e.makeNeutralElement(F);b.elmt=f;b.anchor=c;b.container=d;b.wrapper=a;a.style.display=C;a.appendChild(f);if(c==G.NONE)a.style.width=a.style.height=l;P(a,c,d)}f.prototype.destroy=function(){var a=this;a.wrapper.removeChild(a.elmt);a.container.removeChild(a.wrapper)};f.prototype.isVisible=function(){return this.wrapper.style.display!=B};f.prototype.setVisible=function(a){this.wrapper.style.display=a?C:B};f.prototype.setOpacity=function(b){if(this.elmt[L]&&Q==A.IE)e.setElementOpacity(this.elmt,b,a);else e.setElementOpacity(this.wrapper,b,a)};var k="fullpage",E="home",t="zoomin",n="zoomout",J="_rest.png",y="_grouphover.png",z="_hover.png",D="_pressed.png";function N(d){var j=b,f=c,q=b,l=b;function H(){d.viewport&&d.viewport.goHome()}function w(){d.setFullPage(!d.isFullPage());j.emulateExit();d.viewport&&d.viewport.applyConstraints()}function s(){l=(new Date).getTime();q=i.zoomPerSecond;f=a;o()}function r(){l=(new Date).getTime();q=1/i.zoomPerSecond;f=a;o()}function m(){f=c}function o(){h.setTimeout(F,p)}function F(){if(f&&d.viewport){var a=(new Date).getTime(),c=a-l,b=g.pow(q,c/1e3);d.viewport.zoomBy(b);d.viewport.applyConstraints();l=a;o()}}function v(){if(d.viewport){f=c;d.viewport.zoomBy(i.zoomPerClick/1);d.viewport.applyConstraints()}}function u(){if(d.viewport){f=c;d.viewport.zoomBy(1/i.zoomPerClick);d.viewport.applyConstraints()}}function B(){j.emulateEnter();j.emulateExit()}function e(b,a){return i.imagePath+b+a}var I=new O(x.getString("Tooltips.ZoomIn"),e(t,J),e(t,y),e(t,z),e(t,D),s,m,v,s,m),C=new O(x.getString("Tooltips.ZoomOut"),e(n,J),e(n,y),e(n,z),e(n,D),r,m,u,r,m),G=new O(x.getString("Tooltips.Home"),e(E,J),e(E,y),e(E,z),e(E,D),b,H,b,b,b),A=new O(x.getString("Tooltips.FullPage"),e(k,J),e(k,y),e(k,z),e(k,D),b,w,b,b,b);j=new R([I,C,G,A]);j.elmt[L]=a;d.addEventListener("open",B);return j.elmt}Y=v.Viewer=function(v){var n=this,t=n,P=e.getElement(v),v=e.makeNeutralElement(s),E=e.makeNeutralElement(s),eb=e.makeNeutralElement(s),fb=e.makeNeutralElement(s),db=e.makeNeutralElement(s),cb=e.makeNeutralElement(s),A=b,J=b,k=b,O=b,z=new W,D=new M(E),S=new M(v),y=[],ab=a,ib=b,L=b,kb=1e3,Ab=2e3,ib=b,ab=c,yb=r.body.style.width,wb=r.body.style.height,tb=r.body.style.overflow,ub=r.documentElement.style.overflow,bb=new m(1,1),C=b,R=0,nb=0,qb=b,ob=b,F=c,T=c,Y=c;n.container=P;n.elmt=v;n.source=b;n.drawer=b;n.viewport=b;n.profiler=b;n.tracker=D;function Jb(){var c=E.style,b=v.style,g=eb.style,i=fb.style,f=db.style,e=cb.style;b.width=l;b.height=l;b.position=u;b.left=j;b.top=j;b.textAlign="left";c.width=l;c.height=l;c.overflow=o;c.position=w;c.top=j;c.left=j;g.position=i.position=f.position=e.position=w;g.top=i.top=j;g.left=e.left=j;i.right=f.right=j;e.bottom=f.bottom=j;D.clickHandler=Fb;D.pressHandler=Gb;D.dragHandler=Hb;D.releaseHandler=Db;D.scrollHandler=Eb;D.setTracking(a);L=N(t);L.style.marginRight="4px";L.style.marginBottom="4px";t.addControl(L,G.BOTTOM_RIGHT);S.enterHandler=lb;S.exitHandler=pb;S.releaseHandler=Bb;S.setTracking(a);h.setTimeout(Q,1);v.appendChild(E);v.appendChild(eb);v.appendChild(fb);v.appendChild(db);v.appendChild(cb);P.innerHTML=d;P.appendChild(v)}function Z(f){var a="normal",c=r.createTextNode(f);E.innerHTML=d;E.appendChild(e.makeCenteredNode(c));var b=c.parentNode.style;b.fontFamily="verdana";b.fontSize="13px";b.fontSizeAdjust=B;b.fontStyle=a;b.fontStretch=a;b.fontVariant=a;b.fontWeight=a;b.lineHeight="1em";b.textAlign="center";b.textDecoration=B}function vb(){A&&zb();R=(new Date).getTime();h.setTimeout(function(){R>nb&&Z(x.getString("Messages.Loading"))},2e3);return R}function gb(g,b,f){nb=(new Date).getTime();if(g<R){q.log("Ignoring out-of-date open.");z.trigger("ignore",t);return}else if(!b){Z(f);z.trigger("error",t);return}E.innerHTML=d;C=e.getElementSize(v);if(C.x===0||C.y===0){h.setTimeout(function(){gb(g,b,f)},p);return}A=b;k=new X(C,A.dimensions);J=new V(A,k,E);O=new U;t.source=A;t.viewport=k;t.drawer=J;t.profiler=O;F=c;T=a;rb(Ib);z.trigger("open",t)}function zb(){t.source=A=b;t.viewport=k=b;t.drawer=J=b;t.profiler=O=b;E.innerHTML=d}function rb(c,a){if(F)return h.setTimeout(c,1);var b=(new Date).getTime(),a=a?a:b,d=a+1e3/60,e=g.max(1,d-b);return h.setTimeout(c,e)}function xb(){if(!A)return;O.beginUpdate();var b=e.getElementSize(v);if(!b.equals(C)&&b.x>0&&b.y>0){k.resize(b,a);C=b;z.trigger("resize",t)}var d=k.update();if(!F&&d){z.trigger("animationstart",t);hb()}if(d){J.update();z.trigger("animation",t)}else if(T||J.needsUpdate()){J.update();T=c}else J.idle();if(F&&!d){z.trigger("animationfinish",t);!Y&&Q()}F=d;O.endUpdate()}function Ib(){if(!A)return;var a=(new Date).getTime();xb();rb(arguments.callee,a)}function mb(b){for(var a=y.length-1;a>=0;a--)if(y[a].elmt==b)return a;return -1}function jb(){h.setTimeout(Cb,20)}function Cb(){if(ab){var c=(new Date).getTime(),d=c-ib,a=1-d/Ab;a=g.min(1,a);a=g.max(0,a);for(var b=y.length-1;b>=0;b--)y[b].setOpacity(a);a>0&&jb()}}function hb(){ab=c;for(var a=y.length-1;a>=0;a--)y[a].setOpacity(1)}function Q(){if(!i.autoHideControls)return;ab=a;ib=(new Date).getTime()+kb;h.setTimeout(jb,kb)}function lb(){Y=a;hb()}function pb(e,d,a){if(!a){Y=c;!F&&Q()}}function Bb(e,d,b,a){if(!a){Y=c;!F&&Q()}}function Fb(g,c,e,f){if(k&&e){var b=i.zoomPerClick,d=f?1/b:b;k.zoomBy(d,k.pointFromPixel(c,a));k.applyConstraints()}}function Gb(b,a){if(k){qb=a;ob=k.getCenter()}}function Hb(f,d,e){if(k)if(i.constrainDuringPan){var b=d.minus(qb),c=k.deltaPointsFromPixels(b.negate(),a);k.panTo(ob.plus(c));k.applyConstraints()}else k.panBy(k.deltaPointsFromPixels(e.negate(),a))}function Db(d,c,a){a&&k&&k.applyConstraints()}function Eb(e,b,d){if(k){var c=g.pow(i.zoomPerScroll,d);k.zoomBy(c,k.pointFromPixel(b,a));k.applyConstraints()}}function sb(a){a=e.getEvent(a);a.keyCode===27&&t.setFullPage(c)}n.isOpen=function(){return !!A};n.openDzi=function(a,f){var d=vb(),c=e.createCallback(b,gb,d);switch(typeof a){case I:K.createFromXml(a,f,c);break;default:K.createFromJson(a,c)}};n.openTileSource=function(b){var a=vb();h.setTimeout(function(){gb(a,b)},1)};n.close=function(){if(!A)return;zb()};n.addControl=function(a,d){var a=e.getElement(a);if(mb(a)>=0)return;var c=b;switch(d){case G.TOP_RIGHT:c=fb;a.style.position=u;break;case G.BOTTOM_RIGHT:c=db;a.style.position=u;break;case G.BOTTOM_LEFT:c=cb;a.style.position=u;break;case G.TOP_LEFT:c=eb;a.style.position=u;break;case G.NONE:default:c=v;a.style.position=w}y.push(new f(a,d,c))};n.removeControl=function(b){var b=e.getElement(b),a=mb(b);if(a>=0){y[a].destroy();y.splice(a,1)}};n.clearControls=function(){while(y.length>0)y.pop().destroy()};n.getNavControl=function(){return L};n.isDashboardEnabled=function(){for(var b=y.length-1;b>=0;b--)if(y[b].isVisible())return a;return c};n.isFullPage=function(){return v.parentNode==r.body};n.isMouseNavEnabled=function(){return D.isTracking()};n.isVisible=function(){return v.style.visibility!=o};n.setDashboardEnabled=function(b){for(var a=y.length-1;a>=0;a--)y[a].setVisible(b)};n.setFullPage=function(j){if(j==t.isFullPage())return;var q=r.body,c=q.style,i=r.documentElement.style,f=v.style,h=E.style;if(j){tb=c.overflow;ub=i.overflow;c.overflow=o;i.overflow=o;yb=c.width;wb=c.height;c.width=l;c.height=l;h.backgroundColor="black";h.color="white";f.position=H;f.zIndex="99999999";q.appendChild(v);C=e.getWindowSize();e.addEvent(r,"keydown",sb);lb()}else{c.overflow=tb;i.overflow=ub;c.width=yb;c.height=wb;h.backgroundColor=d;h.color=d;f.position=u;f.zIndex=d;P.appendChild(v);C=e.getElementSize(P);e.removeEvent(r,"keydown",sb);pb()}if(k){var p=k.getBounds();k.resize(C);var n=k.getBounds();if(j)bb=new m(n.width/p.width,n.height/p.height);else{k.update();k.zoomBy(g.max(bb.x,bb.y),b,a)}T=a;z.trigger("resize",t);xb()}};n.setMouseNavEnabled=function(a){D.setTracking(a)};n.setVisible=function(a){v.style.visibility=a?d:o};n.showMessage=function(a,b){if(!b){Z(a);return}h.setTimeout(function(){!t.isOpen()&&Z(a)},b)};n.addEventListener=function(a,b){z.addListener(a,b)};n.removeEventListener=function(a,b){z.removeListener(a,b)};Jb()}})()})(window,document,Math);;

