Files
SIG/Scripts/AjaxControlToolkit/Release/Seadragon.js
rrene 927295c7ba Revert "-- corr"
This reverts commit 5315c47fcd.
2024-11-05 10:55:34 -07:00

1 line
74 KiB
JavaScript

Type.registerNamespace("Sys.Extended.UI.Seadragon");Type.registerNamespace("Seadragon");Seadragon.Utils=function(){function o(n,t){return t&&n!=document.body?document.body:n.offsetParent}var t={UNKNOWN:0,IE:1,FIREFOX:2,SAFARI:3,CHROME:4,OPERA:5};Seadragon.Browser=t;var n=this,u=["Msxml2.XMLHTTP","Msxml3.XMLHTTP","Microsoft.XMLHTTP"],s={bmp:!1,jpeg:!0,jpg:!0,png:!0,tif:!1,wdp:!1},i=t.UNKNOWN,r=0,f=!1,e={};(function(){var h=navigator.appName,w=navigator.appVersion,n=navigator.userAgent,c,y,p,a,u,o,s;if(h!="Microsoft Internet Explorer"||!window.attachEvent||!window.ActiveXObject)if(h!="Netscape"||!window.addEventListener)h!="Opera"||!window.opera||!window.attachEvent||(i=t.OPERA,r=parseFloat(w));else{var v=n.indexOf("Firefox"),l=n.indexOf("Safari"),b=n.indexOf("Chrome");v>=0?(i=t.FIREFOX,r=parseFloat(n.substring(v+8))):l>=0&&(y=n.substring(0,l).lastIndexOf("/"),i=b>=0?t.CHROME:t.SAFARI,r=parseFloat(n.substring(y+1,l)))}else c=n.indexOf("MSIE"),i=t.IE,r=parseFloat(n.substring(c+5,n.indexOf(";",c)));for(p=window.location.search.substring(1),a=p.split("&"),u=0;u<a.length;u++)o=a[u],s=o.indexOf("="),s>0&&(e[o.substring(0,s)]=decodeURIComponent(o.substring(s+1)));f=i==t.IE||i==t.CHROME&&r<2})();this.getBrowser=function(){return i};this.getBrowserVersion=function(){return r};this.getElement=function(n){return typeof n=="string"&&(n=document.getElementById(n)),n};this.getElementPosition=function(t){for(var t=n.getElement(t),i=new Seadragon.Point,r=n.getElementStyle(t).position=="fixed",u=o(t,r);u;)i.x+=t.offsetLeft,i.y+=t.offsetTop,r&&(i=i.plus(n.getPageScroll())),t=u,r=n.getElementStyle(t).position=="fixed",u=o(t,r);return i};this.getElementSize=function(t){var t=n.getElement(t);return new Seadragon.Point(t.clientWidth,t.clientHeight)};this.getElementStyle=function(t){var t=n.getElement(t);if(t.currentStyle)return t.currentStyle;if(window.getComputedStyle)return window.getComputedStyle(t,"");Seadragon.Debug.fail("Unknown element style, no known technique.")};this.getEvent=function(n){return n?n:window.event};this.getMousePosition=function(t){var t=n.getEvent(t),i=new Seadragon.Point;return typeof t.pageX=="number"?(i.x=t.pageX,i.y=t.pageY):typeof t.clientX=="number"?(i.x=t.clientX+document.body.scrollLeft+document.documentElement.scrollLeft,i.y=t.clientY+document.body.scrollTop+document.documentElement.scrollTop):Seadragon.Debug.fail("Unknown event mouse position, no known technique."),i};this.getPageScroll=function(){var n=new Seadragon.Point,t=document.documentElement||{},i=document.body||{};return typeof pageXOffset=="number"?(n.x=window.pageXOffset,n.y=window.pageYOffset):i.scrollLeft||i.scrollTop?(n.x=i.scrollLeft,n.y=i.scrollTop):(t.scrollLeft||t.scrollTop)&&(n.x=t.scrollLeft,n.y=t.scrollTop),n};this.getWindowSize=function(){var n=new Seadragon.Point,t=document.documentElement||{},i=document.body||{};return typeof innerWidth=="number"?(n.x=window.innerWidth,n.y=window.innerHeight):t.clientWidth||t.clientHeight?(n.x=t.clientWidth,n.y=t.clientHeight):i.clientWidth||i.clientHeight?(n.x=i.clientWidth,n.y=i.clientHeight):Seadragon.Debug.fail("Unknown window size, no known technique."),n};this.imageFormatSupported=function(n){var n=n?n:"";return!!s[n.toLowerCase()]};this.makeCenteredNode=function(t){var t=Seadragon.Utils.getElement(t),r=n.makeNeutralElement("div"),i=[],u,f;for(i.push('<div style="display:table; height:100%; width:100%;'),i.push("border:none; margin:0px; padding:0px;"),i.push('#position:relative; overflow:hidden; text-align:left;">'),i.push('<div style="#position:absolute; #top:50%; width:100%; '),i.push("border:none; margin:0px; padding:0px;"),i.push('display:table-cell; vertical-align:middle;">'),i.push('<div style="#position:relative; #top:-50%; width:100%; '),i.push("border:none; margin:0px; padding:0px;"),i.push('text-align:center;"><\/div><\/div><\/div>'),r.innerHTML=i.join(""),r=r.firstChild,u=r,f=r.getElementsByTagName("div");f.length>0;)u=f[0],f=u.getElementsByTagName("div");return u.appendChild(t),r};this.makeNeutralElement=function(n){var i=document.createElement(n),t=i.style;return t.background="transparent none",t.border="none",t.margin="0px",t.padding="0px",t.position="static",i};this.makeTransparentImage=function(u){var e=n.makeNeutralElement("img"),f=null;return i==t.IE&&r<7?(f=n.makeNeutralElement("span"),f.style.display="inline-block",e.onload=function(){f.style.width=f.style.width||e.width+"px";f.style.height=f.style.height||e.height+"px";e.onload=null;e=null},e.src=u,f.style.filter="progid:DXImageTransform.Microsoft.AlphaImageLoader(src='"+u+"', sizingMethod='scale')"):(f=e,f.src=u),f};this.setElementOpacity=function(t,i,r){var t=n.getElement(t),o,u,e;if(r&&f&&(i=Math.round(i)),t.style.opacity=i<1?i:"",i==1){o=t.style.filter||"";t.style.filter=o.replace(/alpha\(.*?\)/g,"");return}u=Math.round(100*i);e=" alpha(opacity="+u+") ";try{t.filters&&t.filters.alpha?t.filters.alpha.opacity=u:t.style.filter+=e}catch(s){t.style.filter+=e}};this.addEvent=function(t,i,r,u){var t=n.getElement(t);t.addEventListener?t.addEventListener(i,r,u):t.attachEvent?(t.attachEvent("on"+i,r),u&&t.setCapture&&t.setCapture()):Seadragon.Debug.fail("Unable to attach event handler, no known technique.")};this.removeEvent=function(t,i,r,u){var t=n.getElement(t);t.removeEventListener?t.removeEventListener(i,r,u):t.detachEvent?(t.detachEvent("on"+i,r),u&&t.releaseCapture&&t.releaseCapture()):Seadragon.Debug.fail("Unable to detach event handler, no known technique.")};this.cancelEvent=function(t){var t=n.getEvent(t);t.preventDefault&&t.preventDefault();t.cancel=!0;t.returnValue=!1};this.stopEvent=function(t){var t=n.getEvent(t);t.stopPropagation&&t.stopPropagation();t.cancelBubble=!0};this.createCallback=function(n,t){for(var r=[],i=2;i<arguments.length;i++)r.push(arguments[i]);return function(){for(var u=r.concat([]),i=0;i<arguments.length;i++)u.push(arguments[i]);return t.apply(n,u)}};this.getUrlParameter=function(n){var t=e[n];return t?t:null};this.makeAjaxRequest=function(n,t){var r=typeof t=="function",i=null,e,t,f;if(r&&(e=t,t=function(){window.setTimeout(Seadragon.Utils.createCallback(null,e,i),1)}),window.ActiveXObject)for(f=0;f<u.length;f++)try{i=new ActiveXObject(u[f]);break}catch(o){continue}else window.XMLHttpRequest&&(i=new XMLHttpRequest);i||Seadragon.Debug.fail("Browser doesn't support XMLHttpRequest.");r&&(i.onreadystatechange=function(){i.readyState==4&&(i.onreadystatechange=new Function,t())});try{i.open("GET",n,r);i.send(null)}catch(o){Seadragon.Debug.log(o.name+" while making AJAX request: "+o.message);i.onreadystatechange=null;i=null;r&&t()}return r?null:i};this.parseXml=function(n){var t=null,r;if(window.ActiveXObject)try{t=new ActiveXObject("Microsoft.XMLDOM");t.async=!1;t.loadXML(n)}catch(i){Seadragon.Debug.log(i.name+" while parsing XML (ActiveX): "+i.message)}else if(window.DOMParser)try{r=new DOMParser;t=r.parseFromString(n,"text/xml")}catch(i){Seadragon.Debug.log(i.name+" while parsing XML (DOMParser): "+i.message)}else Seadragon.Debug.fail("Browser doesn't support XML DOM.");return t}};Seadragon.Utils=new Seadragon.Utils;Sys.Extended.UI.Seadragon.ButtonState=function(){throw Error.invalidOperation();};Sys.Extended.UI.Seadragon.ButtonState.prototype={REST:0,GROUP:1,HOVER:2,DOWN:3};Sys.Extended.UI.Seadragon.ButtonState.registerEnum("Sys.Extended.UI.Seadragon.ButtonState",!1);Sys.Extended.UI.Seadragon.Button=function(){Sys.Extended.UI.Seadragon.Button.initializeBase(this);this._tooltip=null;this._srcRest=null;this._srcGroup=null;this._srcHover=null;this._srcDown=null;this._button=null;this.config=null};Sys.Extended.UI.Seadragon.Button.prototype={initialize:function(){Sys.Extended.UI.Seadragon.Button.callBaseMethod(this,"initialize");this._button=Seadragon.Utils.makeNeutralElement("span");this._currentState=Sys.Extended.UI.Seadragon.ButtonState.GROUP;this._tracker=new Seadragon.MouseTracker(this._button,this.config.clickTimeThreshold,this.config.clickDistThreshold);this._imgRest=Seadragon.Utils.makeTransparentImage(this._srcRest);this._imgGroup=Seadragon.Utils.makeTransparentImage(this._srcGroup);this._imgHover=Seadragon.Utils.makeTransparentImage(this._srcHover);this._imgDown=Seadragon.Utils.makeTransparentImage(this._srcDown);this._fadeDelay=0;this._fadeLength=2e3;this._fadeBeginTime=null;this._shouldFade=!1;this._button.style.display="inline-block";this._button.style.position="relative";this._button.title=this._tooltip;this._button.appendChild(this._imgRest);this._button.appendChild(this._imgGroup);this._button.appendChild(this._imgHover);this._button.appendChild(this._imgDown);var r=this._imgRest.style,i=this._imgGroup.style,n=this._imgHover.style,t=this._imgDown.style;i.position=n.position=t.position="absolute";i.top=n.top=t.top="0px";i.left=n.left=t.left="0px";n.visibility=t.visibility="hidden";Seadragon.Utils.getBrowser()==Seadragon.Browser.FIREFOX&&Seadragon.Utils.getBrowserVersion()<3&&(i.top=n.top=t.top="");this._tracker.enterHandler=Function.createDelegate(this,this._enterHandler);this._tracker.exitHandler=Function.createDelegate(this,this._exitHandler);this._tracker.pressHandler=Function.createDelegate(this,this._pressHandler);this._tracker.releaseHandler=Function.createDelegate(this,this._releaseHandler);this._tracker.clickHandler=Function.createDelegate(this,this._clickHandler);this._tracker.setTracking(!0);this._outTo(Sys.Extended.UI.Seadragon.ButtonState.REST)},dispose:function(){},_scheduleFade:function(){window.setTimeout(Function.createDelegate(this,this._updateFade),20)},_updateFade:function(){if(this._shouldFade){var t=(new Date).getTime(),i=t-this._fadeBeginTime,n=1-i/this._fadeLength;n=Math.min(1,n);n=Math.max(0,n);Seadragon.Utils.setElementOpacity(this._imgGroup,n,!0);n>0&&this._scheduleFade()}},_beginFading:function(){this._shouldFade=!0;this._fadeBeginTime=(new Date).getTime()+this._fadeDelay;window.setTimeout(Function.createDelegate(this,this._scheduleFade),this._fadeDelay)},_stopFading:function(){this._shouldFade=!1;Seadragon.Utils.setElementOpacity(this._imgGroup,1,!0)},_inTo:function(n){n>=Sys.Extended.UI.Seadragon.ButtonState.GROUP&&this._currentState==Sys.Extended.UI.Seadragon.ButtonState.REST&&(this._stopFading(),this._currentState=Sys.Extended.UI.Seadragon.ButtonState.GROUP);n>=Sys.Extended.UI.Seadragon.ButtonState.HOVER&&this._currentState==Sys.Extended.UI.Seadragon.ButtonState.GROUP&&(this._imgHover.style.visibility="",this._currentState=Sys.Extended.UI.Seadragon.ButtonState.HOVER);n>=Sys.Extended.UI.Seadragon.ButtonState.DOWN&&this._currentState==Sys.Extended.UI.Seadragon.ButtonState.HOVER&&(this._imgDown.style.visibility="",this._currentState=Sys.Extended.UI.Seadragon.ButtonState.DOWN)},_outTo:function(n){n<=Sys.Extended.UI.Seadragon.ButtonState.HOVER&&this._currentState==Sys.Extended.UI.Seadragon.ButtonState.DOWN&&(this._imgDown.style.visibility="hidden",this._currentState=Sys.Extended.UI.Seadragon.ButtonState.HOVER);n<=Sys.Extended.UI.Seadragon.ButtonState.GROUP&&this._currentState==Sys.Extended.UI.Seadragon.ButtonState.HOVER&&(this._imgHover.style.visibility="hidden",this._currentState=Sys.Extended.UI.Seadragon.ButtonState.GROUP);this._newState<=Sys.Extended.UI.Seadragon.ButtonState.REST&&this._currentState==Sys.Extended.UI.Seadragon.ButtonState.GROUP&&(this._beginFading(),this._currentState=Sys.Extended.UI.Seadragon.ButtonState.REST)},_enterHandler:function(n,t,i,r){i?(this._inTo(Sys.Extended.UI.Seadragon.ButtonState.DOWN),this._raiseEvent("onEnter",this)):r||this._inTo(Sys.Extended.UI.Seadragon.ButtonState.HOVER)},_exitHandler:function(n,t,i){this._outTo(Sys.Extended.UI.Seadragon.ButtonState.GROUP);i&&this._raiseEvent("onExit",this)},_pressHandler:function(){this._inTo(Sys.Extended.UI.Seadragon.ButtonState.DOWN);this._raiseEvent("onPress",this)},_releaseHandler:function(n,t,i,r){i&&r?(this._outTo(Sys.Extended.UI.Seadragon.ButtonState.HOVER),this._raiseEvent("onRelease",this)):i?this._outTo(Sys.Extended.UI.Seadragon.ButtonState.GROUP):this._inTo(Sys.Extended.UI.Seadragon.ButtonState.HOVER)},_clickHandler:function(n,t,i){i&&this._raiseEvent("onClick",this)},_raiseEvent:function(n,t){var i=this.get_events().getHandler(n);i&&(t||(t=Sys.EventArgs.Empty),i(this,t))},get_element:function(){return this._button},get_tooltip:function(){return this._tooltip},set_tooltip:function(n){this._tooltip=n},get_config:function(){return this.config},set_config:function(n){this.config=n},get_srcRest:function(){return this._srcRest},set_srcRest:function(n){this._srcRest=n},get_srcGroup:function(){return this._srcGroup},set_srcGroup:function(n){this._srcGroup=n},get_srcHover:function(){return this._srcHover},set_srcHover:function(n){this._srcHover=n},get_srcDown:function(){return this._srcDown},set_srcDown:function(n){this._srcDown=n},add_onPress:function(n){this.get_events().addHandler("onPress",n)},remove_onPress:function(n){this.get_events().removeHandler("onPress",n)},add_onClick:function(n){this.get_events().addHandler("onClick",n)},remove_onClick:function(n){this.get_events().removeHandler("onClick",n)},add_onEnter:function(n){this.get_events().addHandler("onEnter",n)},remove_onEnter:function(n){this.get_events().removeHandler("onEnter",n)},add_onRelease:function(n){this.get_events().addHandler("onRelease",n)},remove_onRelease:function(n){this.get_events().removeHandler("onRelease",n)},add_onExit:function(n){this.get_events().addHandler("onExit",n)},remove_onExit:function(n){this.get_events().removeHandler("onExit",n)},notifyGroupEnter:function(){this._inTo(Sys.Extended.UI.Seadragon.ButtonState.GROUP)},notifyGroupExit:function(){this._outTo(Sys.Extended.UI.Seadragon.ButtonState.REST)}};Sys.Extended.UI.Seadragon.Button.registerClass("Sys.Extended.UI.Seadragon.Button",Sys.Component);Sys.Extended.UI.Seadragon.ButtonGroup=function(){Sys.Extended.UI.Seadragon.ButtonGroup.initializeBase(this);this._buttons=null;this._group=null;this.config=null};Sys.Extended.UI.Seadragon.ButtonGroup.prototype={initialize:function(){var i,n,t;for(Sys.Extended.UI.Seadragon.ButtonGroup.callBaseMethod(this,"initialize"),this._group=Seadragon.Utils.makeNeutralElement("span"),i=this._buttons.concat([]),n=new Seadragon.MouseTracker(this._group,this.config.clickTimeThreshold,this.config.clickDistThreshold),this._group.style.display="inline-block",t=0;t<i.length;t++)this._group.appendChild(i[t].get_element());n.enterHandler=Function.createDelegate(this,this._enterHandler);n.exitHandler=Function.createDelegate(this,this._exitHandler);n.releaseHandler=Function.createDelegate(this,this._releaseHandler);n.setTracking(!0)},dispose:function(){},get_buttons:function(){return this._buttons},set_buttons:function(n){this._buttons=n},get_element:function(){return this._group},get_config:function(){return this.config},set_config:function(n){this.config=n},_enterHandler:function(){for(var n=0;n<this._buttons.length;n++)this._buttons[n].notifyGroupEnter()},_exitHandler:function(n,t,i){if(!i)for(var r=0;r<this._buttons.length;r++)this._buttons[r].notifyGroupExit()},_releaseHandler:function(n,t,i,r){if(!r)for(var u=0;u<this._buttons.length;u++)this._buttons[u].notifyGroupExit()},emulateEnter:function(){this._enterHandler()},emulateExit:function(){this._exitHandler()}};Sys.Extended.UI.Seadragon.ButtonGroup.registerClass("Sys.Extended.UI.Seadragon.ButtonGroup",Sys.Component);Sys.Extended.UI.Seadragon.Config=function(){this.debugMode=!0;this.animationTime=1.5;this.blendTime=.5;this.alwaysBlend=!1;this.autoHideControls=!0;this.immediateRender=!1;this.wrapHorizontal=!1;this.wrapVertical=!1;this.minZoomDimension=.8;this.maxZoomPixelRatio=2;this.visibilityRatio=.5;this.springStiffness=5;this.imageLoaderLimit=2;this.clickTimeThreshold=200;this.clickDistThreshold=5;this.zoomPerClick=2;this.zoomPerSecond=2;this.showNavigationControl=!0;this.maxImageCacheCount=100;this.minPixelRatio=.5;this.mouseNavEnabled=!0;this.navImages={zoomIn:{REST:Sys.Extended.UI.Images["Seadragon.ZoomIn-Rest.png"],GROUP:Sys.Extended.UI.Images["Seadragon.ZoomIn-Grouphover.png"],HOVER:Sys.Extended.UI.Images["Seadragon.ZoomIn-Hover.png"],DOWN:Sys.Extended.UI.Images["Seadragon.ZoomIn-Pressed.png"]},zoomOut:{REST:Sys.Extended.UI.Images["Seadragon.ZoomOut-Rest.png"],GROUP:Sys.Extended.UI.Images["Seadragon.ZoomOut-Grouphover.png"],HOVER:Sys.Extended.UI.Images["Seadragon.ZoomOut-Hover.png"],DOWN:Sys.Extended.UI.Images["Seadragon.ZoomOut-Pressed.png"]},home:{REST:Sys.Extended.UI.Images["Seadragon.Home-Rest.png"],GROUP:Sys.Extended.UI.Images["Seadragon.Home-Grouphover.png"],HOVER:Sys.Extended.UI.Images["Seadragon.Home-Hover.png"],DOWN:Sys.Extended.UI.Images["Seadragon.Home-Pressed.png"]},fullpage:{REST:Sys.Extended.UI.Images["Seadragon.Fullscreen-Rest.png"],GROUP:Sys.Extended.UI.Images["Seadragon.Fullscreen-Grouphover.png"],HOVER:Sys.Extended.UI.Images["Seadragon.Fullscreen-Hover.png"],DOWN:Sys.Extended.UI.Images["Seadragon.Fullscreen-Pressed.png"]}}};Sys.Extended.UI.Seadragon.Config.registerClass("Sys.Extended.UI.Seadragon.Config",null,Sys.IDisposable);window.SIGNAL||(window.SIGNAL="----seadragon----");Sys.Extended.UI.Seadragon.ControlAnchor=function(){throw Error.invalidOperation();};Sys.Extended.UI.Seadragon.ControlAnchor.prototype={NONE:0,TOP_LEFT:1,TOP_RIGHT:2,BOTTOM_RIGHT:3,BOTTOM_LEFT:4};Sys.Extended.UI.Seadragon.ControlAnchor.registerEnum("Sys.Extended.UI.Seadragon.ControlAnchor",!1);Seadragon.ControlAnchor=Sys.Extended.UI.Seadragon.ControlAnchor;Sys.Extended.UI.Seadragon.OverlayPlacement=function(){throw Error.invalidOperation();};Sys.Extended.UI.Seadragon.OverlayPlacement.prototype={CENTER:0,TOP_LEFT:1,TOP:2,TOP_RIGHT:3,RIGHT:4,BOTTOM_RIGHT:5,BOTTOM:6,BOTTOM_LEFT:7,LEFT:8};Sys.Extended.UI.Seadragon.OverlayPlacement.registerEnum("Sys.Extended.UI.Seadragon.OverlayPlacement",!1);Seadragon.OverlayPlacement=Sys.Extended.UI.Seadragon.OverlayPlacement;Sys.Extended.UI.Seadragon.NavControl=function(n){this._group=null;this._zooming=!1;this._zoomFactor=null;this._lastZoomTime=null;this._viewer=n;this.config=this._viewer.config;this.elmt=null;this.initialize()};Sys.Extended.UI.Seadragon.NavControl.prototype={initialize:function(){var i=Function.createDelegate(this,this._beginZoomingIn),t=Function.createDelegate(this,this._endZooming),u=Function.createDelegate(this,this._doSingleZoomIn),r=Function.createDelegate(this,this._beginZoomingOut),f=Function.createDelegate(this,this._doSingleZoomOut),e=Function.createDelegate(this,this._onHome),o=Function.createDelegate(this,this._onFullPage),n=this._viewer.config.navImages,s=$create(Sys.Extended.UI.Seadragon.Button,{config:this._viewer.config,tooltip:Seadragon.Strings.getString("Tooltips.ZoomIn"),srcRest:this._resolveUrl(n.zoomIn.REST),srcGroup:this._resolveUrl(n.zoomIn.GROUP),srcHover:this._resolveUrl(n.zoomIn.HOVER),srcDown:this._resolveUrl(n.zoomIn.DOWN)},{onPress:i,onRelease:t,onClick:u,onEnter:i,onExit:t},null,null),h=$create(Sys.Extended.UI.Seadragon.Button,{config:this._viewer.config,tooltip:Seadragon.Strings.getString("Tooltips.ZoomOut"),srcRest:this._resolveUrl(n.zoomOut.REST),srcGroup:this._resolveUrl(n.zoomOut.GROUP),srcHover:this._resolveUrl(n.zoomOut.HOVER),srcDown:this._resolveUrl(n.zoomOut.DOWN)},{onPress:r,onRelease:t,onClick:f,onEnter:r,onExit:t},null,null),c=$create(Sys.Extended.UI.Seadragon.Button,{config:this._viewer.config,tooltip:Seadragon.Strings.getString("Tooltips.Home"),srcRest:this._resolveUrl(n.home.REST),srcGroup:this._resolveUrl(n.home.GROUP),srcHover:this._resolveUrl(n.home.HOVER),srcDown:this._resolveUrl(n.home.DOWN)},{onRelease:e},null,null),l=$create(Sys.Extended.UI.Seadragon.Button,{config:this._viewer.config,tooltip:Seadragon.Strings.getString("Tooltips.FullPage"),srcRest:this._resolveUrl(n.fullpage.REST),srcGroup:this._resolveUrl(n.fullpage.GROUP),srcHover:this._resolveUrl(n.fullpage.HOVER),srcDown:this._resolveUrl(n.fullpage.DOWN)},{onRelease:o},null,null);this._group=$create(Sys.Extended.UI.Seadragon.ButtonGroup,{config:this._viewer.config,buttons:[s,h,c,l]},null,null,null);this.elmt=this._group.get_element();this.elmt[SIGNAL]=!0;this._viewer.add_open(Function.createDelegate(this,this._lightUp))},dispose:function(){},_resolveUrl:function(n){return String.format("{1}",this._viewer.get_prefixUrl(),n)},_beginZoomingIn:function(){this._lastZoomTime=(new Date).getTime();this._zoomFactor=this.config.zoomPerSecond;this._zooming=!0;this._scheduleZoom()},_beginZoomingOut:function(){this._lastZoomTime=(new Date).getTime();this._zoomFactor=1/this.config.zoomPerSecond;this._zooming=!0;this._scheduleZoom()},_endZooming:function(){this._zooming=!1},_scheduleZoom:function(){window.setTimeout(Function.createDelegate(this,this._doZoom),10)},_doZoom:function(){if(this._zooming&&this._viewer.viewport){var n=(new Date).getTime(),t=n-this._lastZoomTime,i=Math.pow(this._zoomFactor,t/1e3);this._viewer.viewport.zoomBy(i);this._viewer.viewport.applyConstraints();this._lastZoomTime=n;this._scheduleZoom()}},_doSingleZoomIn:function(){this._viewer.viewport&&(this._zooming=!1,this._viewer.viewport.zoomBy(this.config.zoomPerClick/1),this._viewer.viewport.applyConstraints())},_doSingleZoomOut:function(){this._viewer.viewport&&(this._zooming=!1,this._viewer.viewport.zoomBy(1/this.config.zoomPerClick),this._viewer.viewport.applyConstraints())},_lightUp:function(){this._group.emulateEnter();this._group.emulateExit()},_onHome:function(){this._viewer.viewport&&this._viewer.viewport.goHome()},_onFullPage:function(){this._viewer.setFullPage(!this._viewer.isFullPage());this._group.emulateExit();this._viewer.viewport&&this._viewer.viewport.applyConstraints()}};Sys.Extended.UI.Seadragon.NavControl.registerClass("Sys.Extended.UI.Seadragon.NavControl",null,Sys.IDisposable);Sys.Extended.UI.Seadragon.Control=function(n,t,i){this.elmt=n;this.anchor=t;this.container=i;this.wrapper=Seadragon.Utils.makeNeutralElement("span");this.initialize()};Sys.Extended.UI.Seadragon.Control.prototype={initialize:function(){this.wrapper=Seadragon.Utils.makeNeutralElement("span");this.wrapper.style.display="inline-block";this.wrapper.appendChild(this.elmt);this.anchor==Seadragon.ControlAnchor.NONE&&(this.wrapper.style.width=this.wrapper.style.height="100%");this.addToAnchor()},addToAnchor:function(){this.anchor==Seadragon.ControlAnchor.TOP_RIGHT||this.anchor==Seadragon.ControlAnchor.BOTTOM_RIGHT?this.container.insertBefore(this.elmt,this.container.firstChild):this.container.appendChild(this.elmt)},destroy:function(){this.wrapper.removeChild(this.elmt);this.container.removeChild(this.wrapper)},isVisible:function(){return this.wrapper.style.display!="none"},setVisible:function(n){this.wrapper.style.display=n?"inline-block":"none"},setOpacity:function(n){this.elmt[SIGNAL]&&Seadragon.Utils.getBrowser()==Seadragon.Browser.IE?Seadragon.Utils.setElementOpacity(this.elmt,n,!0):Seadragon.Utils.setElementOpacity(this.wrapper,n,!0)}};Sys.Extended.UI.Seadragon.Control.registerClass("Sys.Extended.UI.Seadragon.Control",null,Sys.IDisposable);Sys.Extended.UI.Seadragon.Viewer=function(n){Sys.Extended.UI.Seadragon.Viewer.initializeBase(this,[n]);this.config=new Sys.Extended.UI.Seadragon.Config;this._prefixUrl=null;this._controls=[];this._customControls=null;this._overlays=[];this._overlayControls=null;this._container=null;this._canvas=null;this._controlsTL=null;this._controlsTR=null;this._controlsBR=null;this._controlsBL=null;this._bodyWidth=null;this._bodyHeight=null;this._bodyOverflow=null;this._docOverflow=null;this._fsBoundsDelta=null;this._prevContainerSize=null;this._lastOpenStartTime=0;this._lastOpenEndTime=0;this._animating=!1;this._forceRedraw=!1;this._mouseInside=!1;this._xmlPath=null;this.source=null;this.drawer=null;this.viewport=null;this.profiler=null};Sys.Extended.UI.Seadragon.Viewer.prototype={initialize:function(){var i,r,u;Sys.Extended.UI.Seadragon.Viewer.callBaseMethod(this,"initialize");this._container=Seadragon.Utils.makeNeutralElement("div");this._canvas=Seadragon.Utils.makeNeutralElement("div");this._controlsTL=Seadragon.Utils.makeNeutralElement("div");this._controlsTR=Seadragon.Utils.makeNeutralElement("div");this._controlsBR=Seadragon.Utils.makeNeutralElement("div");this._controlsBL=Seadragon.Utils.makeNeutralElement("div");i=new Seadragon.MouseTracker(this._canvas,this.config.clickTimeThreshold,this.config.clickDistThreshold);r=new Seadragon.MouseTracker(this._container,this.config.clickTimeThreshold,this.config.clickDistThreshold);this._bodyWidth=document.body.style.width;this._bodyHeight=document.body.style.height;this._bodyOverflow=document.body.style.overflow;this._docOverflow=document.documentElement.style.overflow;this._fsBoundsDelta=new Sys.Extended.UI.Seadragon.Point(1,1);var n=this._canvas.style,t=this._container.style,f=this._controlsTL.style,e=this._controlsTR.style,o=this._controlsBR.style,s=this._controlsBL.style;for(t.width="100%",t.height="100%",t.position="relative",t.left="0px",t.top="0px",t.textAlign="left",n.width="100%",n.height="100%",n.overflow="hidden",n.position="absolute",n.top="0px",n.left="0px",f.position=e.position=o.position=s.position="absolute",f.top=e.top="0px",f.left=s.left="0px",e.right=o.right="0px",s.bottom=o.bottom="0px",i.clickHandler=Function.createDelegate(this,this._onCanvasClick),i.dragHandler=Function.createDelegate(this,this._onCanvasDrag),i.releaseHandler=Function.createDelegate(this,this._onCanvasRelease),i.setTracking(!0),this.get_showNavigationControl()&&(navControl=new Sys.Extended.UI.Seadragon.NavControl(this).elmt,navControl.style.marginRight="4px",navControl.style.marginBottom="4px",this.addControl(navControl,Sys.Extended.UI.Seadragon.ControlAnchor.BOTTOM_RIGHT)),u=0;u<this._customControls.length;u++)this.addControl(this._customControls[u].id,this._customControls[u].anchor);r.enterHandler=Function.createDelegate(this,this._onContainerEnter);r.exitHandler=Function.createDelegate(this,this._onContainerExit);r.releaseHandler=Function.createDelegate(this,this._onContainerRelease);r.setTracking(!0);window.setTimeout(Function.createDelegate(this,this._beginControlsAutoHide),1);this._container.appendChild(this._canvas);this._container.appendChild(this._controlsTL);this._container.appendChild(this._controlsTR);this._container.appendChild(this._controlsBR);this._container.appendChild(this._controlsBL);this.get_element().appendChild(this._container);this._xmlPath&&this.openDzi(this._xmlPath)},_raiseEvent:function(n,t){var i=this.get_events().getHandler(n);i&&(t||(t=Sys.EventArgs.Empty),i(this,t))},_beginControlsAutoHide:function(){this.config.autoHideControls&&(this._controlsShouldFade=!0,this._controlsFadeBeginTime=(new Date).getTime()+this._controlsFadeDelay,window.setTimeout(Function.createDelegate(this,this._scheduleControlsFade),this._controlsFadeDelay))},_scheduleControlsFade:function(){window.setTimeout(Function.createDelegate(this,this._updateControlsFade),20)},_updateControlsFade:function(){var t;if(this._controlsShouldFade){var i=(new Date).getTime(),r=i-this._controlsFadeBeginTime,n=1-r/this._controlsFadeLength;for(n=Math.min(1,n),n=Math.max(0,n),t=this._controls.length-1;t>=0;t--)this._controls[t].setOpacity(n);n>0&&this._scheduleControlsFade()}},_onCanvasClick:function(n,t,i,r){if(this.viewport&&i){var u=this.config.zoomPerClick,f=r?1/u:u;this.viewport.zoomBy(f,this.viewport.pointFromPixel(t,!0));this.viewport.applyConstraints()}},_onCanvasDrag:function(n,t,i){this.viewport&&this.viewport.panBy(this.viewport.deltaPointsFromPixels(i.negate()))},_onCanvasRelease:function(n,t,i){i&&this.viewport&&this.viewport.applyConstraints()},_onContainerExit:function(n,t,i){i||(this._mouseInside=!1,this._animating||this._beginControlsAutoHide())},_onContainerRelease:function(n,t,i,r){r||(this._mouseInside=!1,this._animating||this._beginControlsAutoHide())},_getControlIndex:function(n){for(var t=this._controls.length-1;t>=0;t--)if(this._controls[t].elmt==n)return t;return-1},_abortControlsAutoHide:function(){this._controlsShouldFade=!1;for(var n=this._controls.length-1;n>=0;n--)this._controls[n].setOpacity(1)},_onContainerEnter:function(){this._mouseInside=!0;this._abortControlsAutoHide()},_updateOnce:function(){var t,n;this.source&&(this.profiler.beginUpdate(),t=Seadragon.Utils.getElementSize(this._container),t.equals(this._prevContainerSize)||(this.viewport.resize(t,!0),this._prevContainerSize=t,this._raiseEvent("resize",this)),n=this.viewport.update(),!this._animating&&n&&(this._raiseEvent("animationstart",self),this._abortControlsAutoHide()),n?(this.drawer.update(),this._raiseEvent("animation",self)):this._forceRedraw||this.drawer.needsUpdate()?(this.drawer.update(),this._forceRedraw=!1):this.drawer.idle(),this._animating&&!n&&(this._raiseEvent("animationfinish",this),this._mouseInside||this._beginControlsAutoHide()),this._animating=n,this.profiler.endUpdate())},_onClose:function(){this.source=null;this.viewport=null;this.drawer=null;this.profiler=null;this._canvas.innerHTML=""},_beforeOpen:function(){return this.source&&this._onClose(),this._lastOpenStartTime=(new Date).getTime(),window.setTimeout(Function.createDelegate(this,function(){this._lastOpenStartTime>this._lastOpenEndTime&&this._setMessage(Seadragon.Strings.getString("Messages.Loading"))}),2e3),this._lastOpenStartTime},_setMessage:function(n){var i=document.createTextNode(n),t;this._canvas.innerHTML="";this._canvas.appendChild(Seadragon.Utils.makeCenteredNode(i));t=i.parentNode.style;t.color="white";t.fontFamily="verdana";t.fontSize="13px";t.fontSizeAdjust="none";t.fontStyle="normal";t.fontStretch="normal";t.fontVariant="normal";t.fontWeight="normal";t.lineHeight="1em";t.textAlign="center";t.textDecoration="none"},_onOpen:function(n,t,i){var u,r;if(this._lastOpenEndTime=(new Date).getTime(),n<this._lastOpenStartTime){Seadragon.Debug.log("Ignoring out-of-date open.");this._raiseEvent("ignore");return}if(!t){this._setMessage(i);this._raiseEvent("error");return}for(this._canvas.innerHTML="",this._prevContainerSize=Seadragon.Utils.getElementSize(this._container),this.source=t,this.viewport=new Sys.Extended.UI.Seadragon.Viewport(this._prevContainerSize,this.source.dimensions,this.config),this.drawer=new Sys.Extended.UI.Seadragon.Drawer(this.source,this.viewport,this._canvas),this.profiler=new Sys.Extended.UI.Seadragon.Profiler,this._animating=!1,this._forceRedraw=!0,this._scheduleUpdate(this._updateMulti),u=0;u<this._overlayControls.length;u++)r=this._overlayControls[u],r.point!=null?this.drawer.addOverlay(r.id,new Sys.Extended.UI.Seadragon.Point(r.point.X,r.point.Y),Sys.Extended.UI.Seadragon.OverlayPlacement.TOP_LEFT):this.drawer.addOverlay(r.id,new Sys.Extended.UI.Seadragon.Rect(r.rect.Point.X,r.rect.Point.Y,r.rect.Width,r.rect.Height),r.placement);this._raiseEvent("open")},_scheduleUpdate:function(n,t){if(this._animating)return window.setTimeout(Function.createDelegate(this,n),1);var i=(new Date).getTime(),t=t?t:i,r=t+1e3/60,u=Math.max(1,r-i);return window.setTimeout(Function.createDelegate(this,n),u)},_updateMulti:function(){if(this.source){var n=(new Date).getTime();this._updateOnce();this._scheduleUpdate(arguments.callee,n)}},_updateOnce:function(){var t,n;this.source&&(this.profiler.beginUpdate(),t=Seadragon.Utils.getElementSize(this._container),t.equals(this._prevContainerSize)||(this.viewport.resize(t,!0),this._prevContainerSize=t,this._raiseEvent("resize")),n=this.viewport.update(),!this._animating&&n&&(this._raiseEvent("animationstart"),this._abortControlsAutoHide()),n?(this.drawer.update(),this._raiseEvent("animation")):this._forceRedraw||this.drawer.needsUpdate()?(this.drawer.update(),this._forceRedraw=!1):this.drawer.idle(),this._animating&&!n&&(this._raiseEvent("animationfinish"),this._mouseInside||this._beginControlsAutoHide()),this._animating=n,this.profiler.endUpdate())},getNavControl:function(){return this._navControl},get_xmlPath:function(){return this._xmlPath},set_xmlPath:function(n){this._xmlPath=n},get_debugMode:function(){return this.config.debugMode},set_debugMode:function(n){this.config.debugMode=n},get_animationTime:function(){return this.config.animationTime},set_animationTime:function(n){this.config.animationTime=n},get_blendTime:function(){return this.config.blendTime},set_blendTime:function(n){this.config.blendTime=n},get_alwaysBlend:function(){return this.config.alwaysBlend},set_alwaysBlend:function(n){this.config.alwaysBlend=n},get_autoHideControls:function(){return this.config.autoHideControls},set_autoHideControls:function(n){this.config.autoHideControls=n},get_immediateRender:function(){return this.config.immediateRender},set_immediateRender:function(n){this.config.immediateRender=n},get_wrapHorizontal:function(){return this.config.wrapHorizontal},set_wrapHorizontal:function(n){this.config.wrapHorizontal=n},get_wrapVertical:function(){return this.config.wrapVertical},set_wrapVertical:function(n){this.config.wrapVertical=n},get_minZoomDimension:function(){return this.config.minZoomDimension},set_minZoomDimension:function(n){this.config.minZoomDimension=n},get_maxZoomPixelRatio:function(){return this.config.maxZoomPixelRatio},set_maxZoomPixelRatio:function(n){this.config.maxZoomPixelRatio=n},get_visibilityRatio:function(){return this.config.visibilityRatio},set_visibilityRatio:function(n){this.config.visibilityRatio=n},get_springStiffness:function(){return this.config.springStiffness},set_springStiffness:function(n){this.config.springStiffness=n},get_imageLoaderLimit:function(){return this.config.imageLoaderLimit},set_imageLoaderLimit:function(n){this.config.imageLoaderLimit=n},get_clickTimeThreshold:function(){return this.config.clickTimeThreshold},set_clickTimeThreshold:function(n){this.config.clickTimeThreshold=n},get_clickDistThreshold:function(){return this.config.clickDistThreshold},set_clickDistThreshold:function(n){this.config.clickDistThreshold=n},get_zoomPerClick:function(){return this.config.zoomPerClick},set_zoomPerClick:function(n){this.config.zoomPerClick=n},get_zoomPerSecond:function(){return this.config.zoomPerSecond},set_zoomPerSecond:function(n){this.config.zoomPerSecond=n},get_maxImageCacheCount:function(){return this.config.maxImageCacheCount},set_maxImageCacheCount:function(n){this.config.maxImageCacheCount=n},get_showNavigationControl:function(){return this.config.showNavigationControl},set_showNavigationControl:function(n){this.config.showNavigationControl=n},get_minPixelRatio:function(){return this.config.minPixelRatio},set_minPixelRatio:function(n){this.config.minPixelRatio=n},get_mouseNavEnabled:function(){return this.config.mouseNavEnabled},set_mouseNavEnabled:function(n){this.config.mouseNavEnabled=n},get_controls:function(){return this._customControls},set_controls:function(n){this._customControls=n},get_overlays:function(){return this._overlayControls},set_overlays:function(n){this._overlayControls=n},get_prefixUrl:function(){return this._prefixUrl},set_prefixUrl:function(n){this._prefixUrl=n},add_open:function(n){this.get_events().addHandler("open",n)},remove_open:function(n){this.get_events().removeHandler("open",n)},add_error:function(n){this.get_events().addHandler("error",n)},remove_error:function(n){this.get_events().removeHandler("error",n)},add_ignore:function(n){this.get_events().addHandler("ignore",n)},remove_ignore:function(n){this.get_events().removeHandler("ignore",n)},add_resize:function(n){this.get_events().addHandler("resize",n)},remove_resize:function(n){this.get_events().removeHandler("resize",n)},add_animationstart:function(n){this.get_events().addHandler("animationstart",n)},remove_animationstart:function(n){this.get_events().removeHandler("animationstart",n)},add_animationend:function(n){this.get_events().addHandler("animationend",n)},remove_animationend:function(n){this.get_events().removeHandler("animationend",n)},addControl:function(n,t){var n=Seadragon.Utils.getElement(n),i;if(!(this._getControlIndex(n)>=0)){i=null;switch(t){case Sys.Extended.UI.Seadragon.ControlAnchor.TOP_RIGHT:i=this._controlsTR;n.style.position="relative";break;case Sys.Extended.UI.Seadragon.ControlAnchor.BOTTOM_RIGHT:i=this._controlsBR;n.style.position="relative";break;case Sys.Extended.UI.Seadragon.ControlAnchor.BOTTOM_LEFT:i=this._controlsBL;n.style.position="relative";break;case Sys.Extended.UI.Seadragon.ControlAnchor.TOP_LEFT:i=this._controlsTL;n.style.position="relative";break;case Sys.Extended.UI.Seadragon.ControlAnchor.NONE:default:i=this._container;n.style.position="absolute"}this._controls.push(new Sys.Extended.UI.Seadragon.Control(n,t,i))}},isOpen:function(){return!!this.source},openDzi:function(n,t){var i=this._beforeOpen();Sys.Extended.UI.Seadragon.DziTileSourceHelper.createFromXml(n,t,Seadragon.Utils.createCallback(null,Function.createDelegate(this,this._onOpen),i))},openTileSource:function(n){var t=this._beforeOpen();window.setTimeout(Function.createDelegate(this,function(){this._onOpen(t,n)}),1)},close:function(){this.source&&this._onClose()},removeControl:function(n){var n=Seadragon.Utils.getElement(n),t=this._getControlIndex(n);t>=0&&(this._controls[t].destroy(),this._controls.splice(t,1))},clearControls:function(){while(this._controls.length>0)this._controls.pop().destroy()},isDashboardEnabled:function(){for(var n=this._controls.length-1;n>=0;n--)if(this._controls[n].isVisible())return!0;return!1},isFullPage:function(){return this._container.parentNode==document.body},isMouseNavEnabled:function(){return this._innerTracker.isTracking()},isVisible:function(){return this._container.style.visibility!="hidden"},setDashboardEnabled:function(n){for(var t=this._controls.length-1;t>=0;t--)this._controls[t].setVisible(n)},setFullPage:function(n){var f,e;if(n!=this.isFullPage()){var o=document.body,t=o.style,u=document.documentElement.style,i=this._container.style,r=this._canvas.style;n?(bodyOverflow=t.overflow,docOverflow=u.overflow,t.overflow="hidden",u.overflow="hidden",bodyWidth=t.width,bodyHeight=t.height,t.width="100%",t.height="100%",r.backgroundColor="black",r.color="white",i.position="fixed",i.zIndex=Sys.Extended.UI.zIndex.SeadragonContainer,o.appendChild(this._container),this._prevContainerSize=Seadragon.Utils.getWindowSize(),this._onContainerEnter()):(t.overflow=bodyOverflow,u.overflow=docOverflow,t.width=bodyWidth,t.height=bodyHeight,r.backgroundColor="",r.color="",i.position="relative",i.zIndex="",this.get_element().appendChild(this._container),this._prevContainerSize=Seadragon.Utils.getElementSize(this.get_element()),this._onContainerExit());this.viewport&&(f=this.viewport.getBounds(),this.viewport.resize(this._prevContainerSize),e=this.viewport.getBounds(),n?this._fsBoundsDelta=new Sys.Extended.UI.Seadragon.Point(e.width/f.width,e.height/f.height):(this.viewport.update(),this.viewport.zoomBy(Math.max(this._fsBoundsDelta.x,this._fsBoundsDelta.y),null,!0)),this._forceRedraw=!0,this._raiseEvent("resize",this),this._updateOnce())}},setMouseNavEnabled:function(n){this._innerTracker.setTracking(n)},setVisible:function(n){this._container.style.visibility=n?"":"hidden"}};Sys.Extended.UI.Seadragon.Viewer.registerClass("Sys.Extended.UI.Seadragon.Viewer",Sys.UI.Control),function(){function o(n){return Seadragon.Utils.getMousePosition(n)}function i(n,t){var i=Seadragon.Utils.getMousePosition(n),r=Seadragon.Utils.getElementPosition(t);return i.minus(r)}function r(n,t){for(var i=document.body;t&&n!=t&&i!=t;)try{t=t.parentNode}catch(r){return!1}return n==t}function s(){u=!0}function h(){u=!1}if(!Seadragon.MouseTracker){var n=Seadragon.Utils.getBrowser()==Seadragon.Browser.IE,u=!1,f=!1,e={},t=[];(function(){n?(Seadragon.Utils.addEvent(document,"mousedown",s,!1),Seadragon.Utils.addEvent(document,"mouseup",h,!1)):(Seadragon.Utils.addEvent(window,"mousedown",s,!0),Seadragon.Utils.addEvent(window,"mouseup",h,!0))})();Seadragon.MouseTracker=function(s,h,c){function lt(){y||(Seadragon.Utils.addEvent(s,"mouseover",nt,!1),Seadragon.Utils.addEvent(s,"mouseout",tt,!1),Seadragon.Utils.addEvent(s,"mousedown",et,!1),Seadragon.Utils.addEvent(s,"mouseup",v,!1),Seadragon.Utils.addEvent(s,"click",ht,!1),y=!0,e[d]=b)}function at(){y&&(Seadragon.Utils.removeEvent(s,"mouseover",nt,!1),Seadragon.Utils.removeEvent(s,"mouseout",tt,!1),Seadragon.Utils.removeEvent(s,"mousedown",et,!1),Seadragon.Utils.removeEvent(s,"mouseup",v,!1),Seadragon.Utils.removeEvent(s,"click",ht,!1),g(),y=!1,delete e[d])}function vt(){a||(n?(Seadragon.Utils.removeEvent(s,"mouseup",v,!1),Seadragon.Utils.addEvent(s,"mouseup",ot,!0),Seadragon.Utils.addEvent(s,"mousemove",ct,!0)):(Seadragon.Utils.addEvent(window,"mouseup",st,!0),Seadragon.Utils.addEvent(window,"mousemove",it,!0)),a=!0)}function g(){a&&(n?(Seadragon.Utils.removeEvent(s,"mousemove",ct,!0),Seadragon.Utils.removeEvent(s,"mouseup",ot,!0),Seadragon.Utils.addEvent(s,"mouseup",v,!1)):(Seadragon.Utils.removeEvent(window,"mousemove",it,!0),Seadragon.Utils.removeEvent(window,"mouseup",st,!0)),a=!1)}function ft(n,t){var i=e;for(var r in i)i.hasOwnProperty(r)&&d!=r&&i[r][n](t)}function yt(){return w}function nt(t){var t=Seadragon.Utils.getEvent(t),e,o;if((n&&a&&!r(t.srcElement,s)&&ft("onMouseOver",t),e=t.target?t.target:t.srcElement,o=t.relatedTarget?t.relatedTarget:t.fromElement,r(s,e)&&!r(s,o))&&(w=!0,typeof l.enterHandler=="function"))try{l.enterHandler(l,i(t,s),p,u)}catch(f){Seadragon.Debug.error(f.name+" while executing enter handler: "+f.message,f)}}function tt(t){var t=Seadragon.Utils.getEvent(t),e,o;if((n&&a&&!r(t.srcElement,s)&&ft("onMouseOut",t),e=t.target?t.target:t.srcElement,o=t.relatedTarget?t.relatedTarget:t.toElement,r(s,e)&&!r(s,o))&&(w=!1,typeof l.exitHandler=="function"))try{l.exitHandler(l,i(t,s),p,u)}catch(f){Seadragon.Debug.error(f.name+" while executing exit handler: "+f.message,f)}}function et(r){var r=Seadragon.Utils.getEvent(r);if(r.button!=2){if(p=!0,k=o(r),ut=k,rt=(new Date).getTime(),typeof l.pressHandler=="function")try{l.pressHandler(l,i(r,s))}catch(u){Seadragon.Debug.error(u.name+" while executing press handler: "+u.message,u)}(l.pressHandler||l.dragHandler)&&Seadragon.Utils.cancelEvent(r);n&&f?n&&t.push(b):(vt(),f=!0,t=[b])}}function v(n){var n=Seadragon.Utils.getEvent(n),r=p,u=w;if(n.button!=2){if(p=!1,typeof l.releaseHandler=="function")try{l.releaseHandler(l,i(n,s),r,u)}catch(t){Seadragon.Debug.error(t.name+" while executing release handler: "+t.message,t)}r&&u&&pt(n)}}function ot(n){var n=Seadragon.Utils.getEvent(n),i,r;if(n.button!=2){for(i=0;i<t.length;i++)if(r=t[i],!r.hasMouse())r.onMouseUp(n);g();f=!1;n.srcElement.fireEvent("on"+n.type,document.createEventObject(n));Seadragon.Utils.stopEvent(n)}}function st(n){w||v(n);g()}function ht(n){l.clickHandler&&Seadragon.Utils.cancelEvent(n)}function pt(n){var n=Seadragon.Utils.getEvent(n);if(n.button!=2){var r=(new Date).getTime()-rt,u=o(n),f=ut.distanceTo(u),e=r<=h&&f<=c;if(typeof l.clickHandler=="function")try{l.clickHandler(l,i(n,s),e,n.shiftKey)}catch(t){Seadragon.Debug.error(t.name+" while executing click handler: "+t.message,t)}}}function it(n){var n=Seadragon.Utils.getEvent(n),r=o(n),u=r.minus(k);if(k=r,typeof l.dragHandler=="function"){try{l.dragHandler(l,i(n,s),u,n.shiftKey)}catch(t){Seadragon.Debug.error(t.name+" while executing drag handler: "+t.message,t)}Seadragon.Utils.cancelEvent(n)}}function ct(n){for(var i=0;i<t.length;i++)t[i].onMouseMove(n);Seadragon.Utils.stopEvent(n)}var l=this,b=null,d=Math.random(),s=Seadragon.Utils.getElement(s),y=!1,a=!1,p=!1,w=!1,k=null,rt=null,ut=null,h=h,c=c;this.target=s;this.enterHandler=null;this.exitHandler=null;this.pressHandler=null;this.releaseHandler=null;this.clickHandler=null;this.dragHandler=null,function(){b={hasMouse:yt,onMouseOver:nt,onMouseOut:tt,onMouseUp:v,onMouseMove:it}}();this.isTracking=function(){return y};this.setTracking=function(n){n?lt():at()}}}}();Seadragon.Point=Sys.Extended.UI.Seadragon.Point=function(n,t){this.x=typeof n=="number"?n:0;this.y=typeof t=="number"?t:0};Sys.Extended.UI.Seadragon.Point.prototype={plus:function(n){return new Sys.Extended.UI.Seadragon.Point(this.x+n.x,this.y+n.y)},minus:function(n){return new Sys.Extended.UI.Seadragon.Point(this.x-n.x,this.y-n.y)},times:function(n){return new Sys.Extended.UI.Seadragon.Point(this.x*n,this.y*n)},divide:function(n){return new Sys.Extended.UI.Seadragon.Point(this.x/n,this.y/n)},negate:function(){return new Sys.Extended.UI.Seadragon.Point(-this.x,-this.y)},distanceTo:function(n){return Math.sqrt(Math.pow(this.x-n.x,2)+Math.pow(this.y-n.y,2))},apply:function(n){return new Sys.Extended.UI.Seadragon.Point(n(this.x),n(this.y))},equals:function(n){return n instanceof Sys.Extended.UI.Seadragon.Point&&this.x===n.x&&this.y===n.y},toString:function(){return"("+this.x+","+this.y+")"}};Sys.Extended.UI.Seadragon.Point.registerClass("Sys.Extended.UI.Seadragon.Point",null,Sys.IDisposable);Sys.Extended.UI.Seadragon.Strings={Errors:{Failure:"Sorry, but Seadragon Ajax can't run on your browser!\nPlease try using IE 7 or Firefox 3.\n",Dzc:"Sorry, we don't support Deep Zoom Collections!",Dzi:"Hmm, this doesn't appear to be a valid Deep Zoom Image.",Xml:"Hmm, this doesn't appear to be a valid Deep Zoom Image.",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",ZoomOut:"Zoom out"},getString:function(n){for(var r,u=n.split("."),t=Sys.Extended.UI.Seadragon.Strings,i=0;i<u.length;i++)t=t[u[i]]||{};return typeof t!="string"&&(t=""),r=arguments,t.replace(/\{\d+\}/g,function(n){var t=parseInt(n.match(/\d+/))+1;return t<r.length?r[t]:""})},setString:function(n,t){for(var r=n.split("."),u=Seadragon.Strings,i=0;i<r.length-1;i++)u[r[i]]||(u[r[i]]={});u=u[r[i]];u[r[i]]=t}};Seadragon.Strings=Sys.Extended.UI.Seadragon.Strings;var QUOTA=100,MIN_PIXEL_RATIO=.5,browser=Seadragon.Utils.getBrowser(),browserVer=Seadragon.Utils.getBrowserVersion(),subpixelRenders=browser==Seadragon.Browser.FIREFOX||browser==Seadragon.Browser.OPERA||browser==Seadragon.Browser.SAFARI&&browserVer>=4||browser==Seadragon.Browser.CHROME&&browserVer>=2,useCanvas=typeof document.createElement("canvas").getContext=="function"&&subpixelRenders;Sys.Extended.UI.Seadragon.Tile=function(n,t,i,r,u,f){this.level=n;this.x=t;this.y=i;this.bounds=r;this.exists=u;this.loaded=!1;this.loading=!1;this.elmt=null;this.image=null;this.url=f;this.style=null;this.position=null;this.size=null;this.blendStart=null;this.opacity=null;this.distance=null;this.visibility=null;this.beingDrawn=!1;this.lastTouchTime=0};Sys.Extended.UI.Seadragon.Tile.prototype={dispose:function(){},toString:function(){return this.level+"/"+this.x+"_"+this.y},drawHTML:function(n){if(!this.loaded){Seadragon.Debug.error("Attempting to draw tile "+this.toString()+" when it's not yet loaded.");return}this.elmt||(this.elmt=Seadragon.Utils.makeNeutralElement("img"),this.elmt.src=this.url,this.style=this.elmt.style,this.style.position="absolute",this.style.msInterpolationMode="nearest-neighbor");var i=this.elmt,t=this.style,r=this.position.apply(Math.floor),u=this.size.apply(Math.ceil);i.parentNode!=n&&n.appendChild(i);t.left=r.x+"px";t.top=r.y+"px";t.width=u.x+"px";t.height=u.y+"px";Seadragon.Utils.setElementOpacity(i,this.opacity)},drawCanvas:function(n){if(!this.loaded){Seadragon.Debug.error("Attempting to draw tile "+this.toString()+" when it's not yet loaded.");return}var t=this.position,i=this.size;n.globalAlpha=this.opacity;n.drawImage(this.image,t.x,t.y,i.x,i.y)},unload:function(){this.elmt&&this.elmt.parentNode&&this.elmt.parentNode.removeChild(this.elmt);this.elmt=null;this.image=null;this.loaded=!1;this.loading=!1}};Sys.Extended.UI.Seadragon.Tile.registerClass("Sys.Extended.UI.Seadragon.Tile",null,Sys.IDisposable);Sys.Extended.UI.Seadragon.Overlay=function(n,t,i){this.elmt=n;this.scales=t instanceof Sys.Extended.UI.Seadragon.Rect;this.bounds=new Sys.Extended.UI.Seadragon.Rect(t.x,t.y,t.width,t.height);this.placement=t instanceof Sys.Extended.UI.Seadragon.Point?i:Sys.Extended.UI.Seadragon.OverlayPlacement.TOP_LEFT;this.position=new Sys.Extended.UI.Seadragon.Point(t.x,t.y);this.size=new Sys.Extended.UI.Seadragon.Point(t.width,t.height);this.style=n.style};Sys.Extended.UI.Seadragon.Overlay.prototype={adjust:function(n,t){switch(this.placement){case Sys.Extended.UI.Seadragon.OverlayPlacement.TOP_LEFT:break;case Sys.Extended.UI.Seadragon.OverlayPlacement.TOP:n.x-=t.x/2;break;case Sys.Extended.UI.Seadragon.OverlayPlacement.TOP_RIGHT:n.x-=t.x;break;case Sys.Extended.UI.Seadragon.OverlayPlacement.RIGHT:n.x-=t.x;n.y-=t.y/2;break;case Sys.Extended.UI.Seadragon.OverlayPlacement.BOTTOM_RIGHT:n.x-=t.x;n.y-=t.y;break;case Sys.Extended.UI.Seadragon.OverlayPlacement.BOTTOM:n.x-=t.x/2;n.y-=t.y;break;case Sys.Extended.UI.Seadragon.OverlayPlacement.BOTTOM_LEFT:n.y-=t.y;break;case Sys.Extended.UI.Seadragon.OverlayPlacement.LEFT:n.y-=t.y/2;break;case Sys.Extended.UI.Seadragon.OverlayPlacement.CENTER:default:n.x-=t.x/2;n.y-=t.y/2}},destroy:function(){var t=this.elmt,n=this.style;t.parentNode&&t.parentNode.removeChild(t);n.top="";n.left="";n.position="";this.scales&&(n.width="",n.height="")},drawHTML:function(n){var u=this.elmt,r=this.style,f=this.scales,t,i;u.parentNode!=n&&n.appendChild(u);f||(this.size=Seadragon.Utils.getElementSize(u));t=this.position;i=this.size;this.adjust(t,i);t=t.apply(Math.floor);i=i.apply(Math.ceil);r.left=t.x+"px";r.top=t.y+"px";r.position="absolute";f&&(r.width=i.x+"px",r.height=i.y+"px")},update:function(n,t){this.scales=n instanceof Sys.Extended.UI.Seadragon.Rect;this.bounds=new Sys.Extended.UI.Seadragon.Rect(n.x,n.y,n.width,n.height);this.placement=n instanceof Sys.Extended.UI.Seadragon.Point?t:Sys.Extended.UI.Seadragon.OverlayPlacement.TOP_LEFT}};Sys.Extended.UI.Seadragon.Overlay.registerClass("Sys.Extended.UI.Seadragon.Overlay",null,Sys.IDisposable);Sys.Extended.UI.Seadragon.Drawer=function(n,t,i){this._container=Seadragon.Utils.getElement(i);this._canvas=Seadragon.Utils.makeNeutralElement(useCanvas?"canvas":"div");this._context=useCanvas?this._canvas.getContext("2d"):null;this._viewport=t;this._source=n;this.config=this._viewport.config;this._imageLoader=new Sys.Extended.UI.Seadragon.ImageLoader(this.config.imageLoaderLimit);this._profiler=new Sys.Extended.UI.Seadragon.Profiler;this._minLevel=n.minLevel;this._maxLevel=n.maxLevel;this._tileSize=n.tileSize;this._tileOverlap=n.tileOverlap;this._normHeight=n.dimensions.y/n.dimensions.x;this._cacheNumTiles={};this._cachePixelRatios={};this._tilesMatrix={};this._tilesLoaded=[];this._coverage={};this._overlays=[];this._lastDrawn=[];this._lastResetTime=0;this._midUpdate=!1;this._updateAgain=!0;this.elmt=this._container;this._init()};Sys.Extended.UI.Seadragon.Drawer.prototype={dispose:function(){},_init:function(){this._canvas.style.width="100%";this._canvas.style.height="100%";this._canvas.style.position="absolute";this._container.style.textAlign="left";this._container.appendChild(this._canvas)},_compareTiles:function(n,t){return n?t.visibility>n.visibility?t:t.visibility==n.visibility&&t.distance<n.distance?t:n:t},_getNumTiles:function(n){return this._cacheNumTiles[n]||(this._cacheNumTiles[n]=this._source.getNumTiles(n)),this._cacheNumTiles[n]},_getPixelRatio:function(n){return this._cachePixelRatios[n]||(this._cachePixelRatios[n]=this._source.getPixelRatio(n)),this._cachePixelRatios[n]},_getTile:function(n,t,i,r,u,f){var h;if(this._tilesMatrix[n]||(this._tilesMatrix[n]={}),this._tilesMatrix[n][t]||(this._tilesMatrix[n][t]={}),!this._tilesMatrix[n][t][i]){var e=(u+t%u)%u,o=(f+i%f)%f,s=this._source.getTileBounds(n,e,o),c=this._source.tileExists(n,e,o),l=this._source.getTileUrl(n,e,o);s.x+=1*(t-e)/u;s.y+=this._normHeight*(i-o)/f;this._tilesMatrix[n][t][i]=new Sys.Extended.UI.Seadragon.Tile(n,t,i,s,c,l)}return h=this._tilesMatrix[n][t][i],h.lastTouchTime=r,h},_loadTile:function(n,t){n.loading=this._imageLoader.loadImage(n.url,Seadragon.Utils.createCallback(null,Function.createDelegate(this,this._onTileLoad),n,t))},_onTileLoad:function(n,t,i){var o,f,u;if(n.loading=!1,this._midUpdate){Seadragon.Debug.error("Tile load callback in middle of drawing routine.");return}if(i){if(t<this._lastResetTime){Seadragon.Debug.log("Ignoring tile "+n+" loaded before reset: "+n.url);return}}else{Seadragon.Debug.log("Tile "+n+" failed to load: "+n.url);n.exists=!1;return}if(n.loaded=!0,n.image=i,o=this._tilesLoaded.length,this._tilesLoaded.length>=QUOTA){var a=Math.ceil(Math.log(this._tileSize)/Math.log(2)),r=null,e=-1;for(f=this._tilesLoaded.length-1;f>=0;f--){if(u=this._tilesLoaded[f],u.level<=this._cutoff||u.beingDrawn)continue;else if(!r){r=u;e=f;continue}var s=u.lastTouchTime,h=r.lastTouchTime,c=u.level,l=r.level;(s<h||s==h&&c>l)&&(r=u,e=f)}r&&e>=0&&(r.unload(),o=e)}this._tilesLoaded[o]=n;this._updateAgain=!0},_clearTiles:function(){this._tilesMatrix={};this._tilesLoaded=[]},_providesCoverage:function(n,t,i){var r,f,u,e;if(!this._coverage[n])return!1;if(t===undefined||i===undefined){r=this._coverage[n];for(f in r)if(r.hasOwnProperty(f)){u=r[f];for(e in u)if(u.hasOwnProperty(e)&&!u[e])return!1}return!0}return this._coverage[n][t]===undefined||this._coverage[n][t][i]===undefined||this._coverage[n][t][i]===!0},_isCovered:function(n,t,i){return t===undefined||i===undefined?this._providesCoverage(n+1):this._providesCoverage(n+1,2*t,2*i)&&this._providesCoverage(n+1,2*t,2*i+1)&&this._providesCoverage(n+1,2*t+1,2*i)&&this._providesCoverage(n+1,2*t+1,2*i+1)},_setCoverage:function(n,t,i,r){if(!this._coverage[n]){Seadragon.Debug.error("Setting coverage for a tile before its level's coverage has been reset: "+n);return}this._coverage[n][t]||(this._coverage[n][t]={});this._coverage[n][t][i]=r},_resetCoverage:function(n){this._coverage[n]={}},_compareTiles:function(n,t){return n?t.visibility>n.visibility?t:t.visibility==n.visibility&&t.distance<n.distance?t:n:t},_getOverlayIndex:function(n){for(var t=this._overlays.length-1;t>=0;t--)if(this._overlays[t].elmt==n)return t;return-1},_updateActual:function(){var t,nt,tt,r,u,b,rt,k,n,ii,f,c,ut;this._updateAgain=!1;for(var l=this._canvas,ft=this._context,ri=this._container,et=useCanvas,h=this._lastDrawn;h.length>0;)n=h.pop(),n.beingDrawn=!1;var ot=this._viewport.getContainerSize(),st=ot.x,ht=ot.y;l.innerHTML="";et&&(l.width=st,l.height=ht,ft.clearRect(0,0,st,ht));var ct=this._viewport.getBounds(!0),e=ct.getTopLeft(),o=ct.getBottomRight();if((this.config.wrapHorizontal||!(o.x<0||e.x>1))&&(this.config.wrapVertical||!(o.y<0||e.y>this._normHeight))){var ui=Math.abs,ki=Math.ceil,lt=Math.floor,a=Math.log,d=Math.max,i=Math.min,fi=this.config.alwaysBlend,at=1e3*this.config.blendTime,ei=this.config.immediateRender,g=this.config.minZoomDimension,di=this.config.minImageRatio,vt=this.config.wrapHorizontal,yt=this.config.wrapVertical;vt||(e.x=d(e.x,0),o.x=i(o.x,1));yt||(e.y=d(e.y,0),o.y=i(o.y,this._normHeight));var v=null,y=!1,p=(new Date).getTime(),oi=this._viewport.pixelFromPoint(this._viewport.getCenter()),si=this._viewport.deltaPixelsFromPoints(this._source.getPixelRatio(0),!1).x,pt=ei?1:si;g=g||64;var w=d(this._minLevel,lt(a(g)/a(2))),hi=this._viewport.deltaPixelsFromPoints(this._source.getPixelRatio(0),!0).x,wt=i(this._maxLevel,lt(a(hi/MIN_PIXEL_RATIO)/a(2)));for(w=i(w,wt),t=wt;t>=w;t--){if(nt=!1,tt=this._viewport.deltaPixelsFromPoints(this._source.getPixelRatio(t),!0).x,!y&&tt>=MIN_PIXEL_RATIO||t==w)nt=!0,y=!0;else if(!y)continue;this._resetCoverage(t);var ci=i(1,(tt-.5)/.5),li=this._viewport.deltaPixelsFromPoints(this._source.getPixelRatio(t),!1).x,ai=pt/ui(pt-li),bt=this._source.getTileAtPoint(t,e),s=this._source.getTileAtPoint(t,o),kt=this._getNumTiles(t),dt=kt.x,gt=kt.y;for(vt||(s.x=i(s.x,dt-1)),yt||(s.y=i(s.y,gt-1)),r=bt.x;r<=s.x;r++)for(u=bt.y;u<=s.y;u++)if((n=this._getTile(t,r,u,p,dt,gt),b=nt,this._setCoverage(t,r,u,!1),n.exists)&&(y&&!b&&(this._isCovered(t,r,u)?this._setCoverage(t,r,u,!0):b=!0),b)){var ni=n.bounds.getTopLeft(),ti=n.bounds.getSize(),vi=this._viewport.pixelFromPoint(ni,!0),it=this._viewport.deltaPixelsFromPoints(ti,!0);this._tileOverlap||(it=it.plus(new Sys.Extended.UI.Seadragon.Point(1,1)));var yi=this._viewport.pixelFromPoint(ni,!1),pi=this._viewport.deltaPixelsFromPoints(ti,!1),wi=yi.plus(pi.divide(2)),bi=oi.distanceTo(wi);n.position=vi;n.size=it;n.distance=bi;n.visibility=ai;n.loaded?(n.blendStart||(n.blendStart=p),rt=p-n.blendStart,k=i(1,rt/at),fi&&(k*=ci),n.opacity=k,h.push(n),k==1?this._setCoverage(t,r,u,!0):rt<at&&(updateAgain=!0)):n.Loading||(v=this._compareTiles(v,n))}if(this._providesCoverage(t))break}for(f=h.length-1;f>=0;f--)n=h[f],et?n.drawCanvas(ft):n.drawHTML(l),n.beingDrawn=!0;for(ii=this._overlays.length,f=0;f<ii;f++)c=this._overlays[f],ut=c.bounds,c.position=this._viewport.pixelFromPoint(ut.getTopLeft(),!0),c.size=this._viewport.deltaPixelsFromPoints(ut.getSize(),!0),c.drawHTML(ri);v&&(this._loadTile(v,p),this._updateAgain=!0)}},addOverlay:function(n,t,i){var n=Seadragon.Utils.getElement(n);this._getOverlayIndex(n)>=0||(this._overlays.push(new Sys.Extended.UI.Seadragon.Overlay(n,t,i)),this._updateAgain=!0)},updateOverlay:function(n,t,i){var n=Seadragon.Utils.getElement(n),r=this._getOverlayIndex(n);r>=0&&(this._overlays[r].update(t,i),this._updateAgain=!0)},removeOverlay:function(n){var n=Seadragon.Utils.getElement(n),t=this._getOverlayIndex(n);t>=0&&(this._overlays[t].destroy(),this._overlays.splice(t,1),this._updateAgain=!0)},clearOverlays:function(){while(this._overlays.length>0)this._overlays.pop().destroy(),this._updateAgain=!0},needsUpdate:function(){return this._updateAgain},numTilesLoaded:function(){return this._tilesLoaded.length},reset:function(){this._clearTiles();this._lastResetTime=(new Date).getTime();this._updateAgain=!0},update:function(){this._profiler.beginUpdate();this._midUpdate=!0;this._updateActual();this._midUpdate=!1;this._profiler.endUpdate()},idle:function(){}};Sys.Extended.UI.Seadragon.Drawer.registerClass("Sys.Extended.UI.Seadragon.Drawer",null,Sys.IDisposable);Sys.Extended.UI.Seadragon.TileSource=function(n,t,i,r,u,f){this.aspectRatio=n/t;this.dimensions=new Sys.Extended.UI.Seadragon.Point(n,t);this.minLevel=u?u:0;this.maxLevel=f?f:Math.ceil(Math.log(Math.max(n,t))/Math.log(2));this.tileSize=i?i:0;this.tileOverlap=r?r:0};Sys.Extended.UI.Seadragon.TileSource.prototype={getLevelScale:function(n){return 1/(1<<this.maxLevel-n)},getNumTiles:function(n){var t=this.getLevelScale(n),i=Math.ceil(t*this.dimensions.x/this.tileSize),r=Math.ceil(t*this.dimensions.y/this.tileSize);return new Sys.Extended.UI.Seadragon.Point(i,r)},getPixelRatio:function(n){var t=this.dimensions.times(this.getLevelScale(n)),i=1/t.x,r=1/t.y;return new Sys.Extended.UI.Seadragon.Point(i,r)},getTileAtPoint:function(n,t){var i=t.times(this.dimensions.x).times(this.getLevelScale(n)),r=Math.floor(i.x/this.tileSize),u=Math.floor(i.y/this.tileSize);return new Sys.Extended.UI.Seadragon.Point(r,u)},getTileBounds:function(n,t,i){var u=this.dimensions.times(this.getLevelScale(n)),o=t===0?0:this.tileSize*t-this.tileOverlap,s=i===0?0:this.tileSize*i-this.tileOverlap,f=this.tileSize+(t===0?1:2)*this.tileOverlap,e=this.tileSize+(i===0?1:2)*this.tileOverlap,r;return f=Math.min(f,u.x-o),e=Math.min(e,u.y-s),r=1/u.x,new Sys.Extended.UI.Seadragon.Rect(o*r,s*r,f*r,e*r)},getTileUrl:function(){throw new Error("Method not implemented.");},tileExists:function(n,t,i){var r=this.getNumTiles(n);return n>=this.minLevel&&n<=this.maxLevel&&t>=0&&i>=0&&t<r.x&&i<r.y}};Sys.Extended.UI.Seadragon.TileSource.registerClass("Sys.Extended.UI.Seadragon.TileSource",null,Sys.IDisposable);Sys.Extended.UI.Seadragon.DziError=function(n){Sys.Extended.UI.Seadragon.DziError.initializeBase(this,[n]);this.message=n};Sys.Extended.UI.Seadragon.DziError.registerClass("Sys.Extended.UI.Seadragon.DziError",Error);Sys.Extended.UI.Seadragon.DziTileSource=function(n,t,i,r,u,f,e){Sys.Extended.UI.Seadragon.DziTileSource.initializeBase(this,[n,t,i,r,null,null]);this._levelRects={};this.tilesUrl=u;this.fileFormat=f;this.displayRects=e;this._init()};Sys.Extended.UI.Seadragon.DziTileSource.prototype={_init:function(){var t,i,n;if(this.displayRects)for(t=this.displayRects.length-1;t>=0;t--)for(i=this.displayRects[t],n=i.minLevel;n<=i.maxLevel;n++)this._levelRects[n]||(this._levelRects[n]=[]),this._levelRects[n].push(i)},getTileUrl:function(n,t,i){return[this.tilesUrl,n,"/",t,"_",i,".",this.fileFormat].join("")},tileExists:function(n,t,i){var u=this._levelRects[n],f,r;if(!u||!u.length)return!0;for(f=u.length-1;f>=0;f--)if(r=u[f],!(n<r.minLevel)&&!(n>r.maxLevel)){var e=this.getLevelScale(n),o=r.x*e,s=r.y*e,h=o+r.width*e,c=s+r.height*e;if(o=Math.floor(o/this.tileSize),s=Math.floor(s/this.tileSize),h=Math.ceil(h/this.tileSize),c=Math.ceil(c/this.tileSize),o<=t&&t<h&&s<=i&&i<c)return!0}return!1}};Sys.Extended.UI.Seadragon.DziTileSource.registerClass("Sys.Extended.UI.Seadragon.DziTileSource",Sys.Extended.UI.Seadragon.TileSource);Sys.Extended.UI.Seadragon._DziTileSourceHelper=function(){};Sys.Extended.UI.Seadragon._DziTileSourceHelper.prototype={createFromXml:function(n,t,i){function f(n,t){try{return n(t,c)}catch(i){if(o)return r=this.getError(i).message,null;throw this.getError(i);}}var o=typeof i=="function",r=null,c,e;if(!n){if(this.error=Seadragon.Strings.getString("Errors.Empty"),o)return window.setTimeout(function(){i(null,r)},1),null;throw new Sys.Extended.UI.Seadragon.DziError(r);}var u=n.split("/"),s=u[u.length-1],h=s.lastIndexOf(".");return(h>-1&&(u[u.length-1]=s.slice(0,h)),c=u.join("/")+"_files/",o)?(t?(e=Function.createDelegate(this,this.processResponse),window.setTimeout(function(){var n=f(e,Seadragon.Utils.parseXml(t));i(n,r)},1)):(e=Function.createDelegate(this,this.processResponse),Seadragon.Utils.makeAjaxRequest(n,function(n){var t=f(e,n);i(t,r)})),null):t?f(Function.createDelegate(this,this.processXml),Seadragon.Utils.parseXml(t)):f(Function.createDelegate(this,this.processResponse),Seadragon.Utils.makeAjaxRequest(n))},processResponse:function(n,t){var r,u,i;if(n){if(n.status!==200&&n.status!==0){r=n.status;u=r==404?"Not Found":n.statusText;throw new Sys.Extended.UI.Seadragon.DziError(Seadragon.Strings.getString("Errors.Status",r,u));}}else throw new Sys.Extended.UI.Seadragon.DziError(Seadragon.Strings.getString("Errors.Security"));return i=null,n.responseXML&&n.responseXML.documentElement?i=n.responseXML:n.responseText&&(i=Seadragon.Utils.parseXml(n.responseText)),this.processXml(i,t)},processXml:function(n,t){var i,r,f;if(!n||!n.documentElement)throw new Sys.Extended.UI.Seadragon.DziError(Seadragon.Strings.getString("Errors.Xml"));if(i=n.documentElement,r=i.tagName,r=="Image")try{return this.processDzi(i,t)}catch(u){f=Seadragon.Strings.getString("Errors.Dzi");throw u instanceof Sys.Extended.UI.Seadragon.DziError?u:new Sys.Extended.UI.Seadragon.DziError(f);}else if(r=="Collection")throw new Sys.Extended.UI.Seadragon.DziError(Seadragon.Strings.getString("Errors.Dzc"));else if(r=="Error")return this.processError(i);throw new Sys.Extended.UI.Seadragon.DziError(Seadragon.Strings.getString("Errors.Dzi"));},processDzi:function(n,t){var u=n.getAttribute("Format"),r,f,i;if(!Seadragon.Utils.imageFormatSupported(u))throw new Sys.Extended.UI.Seadragon.DziError(Seadragon.Strings.getString("Errors.ImageFormat",u.toUpperCase()));var e=n.getElementsByTagName("Size")[0],o=n.getElementsByTagName("DisplayRect"),h=parseInt(e.getAttribute("Width"),10),c=parseInt(e.getAttribute("Height"),10),l=parseInt(n.getAttribute("TileSize")),a=parseInt(n.getAttribute("Overlap")),s=[];for(r=0;r<o.length;r++)f=o[r],i=f.getElementsByTagName("Rect")[0],s.push(new Seadragon.DisplayRect(parseInt(i.getAttribute("X"),10),parseInt(i.getAttribute("Y"),10),parseInt(i.getAttribute("Width"),10),parseInt(i.getAttribute("Height"),10),0,parseInt(f.getAttribute("MaxLevel"),10)));return new Sys.Extended.UI.Seadragon.DziTileSource(h,c,l,a,t,u,s)},processError:function(n){var t=n.getElementsByTagName("Message")[0],i=t.firstChild.nodeValue;throw new Sys.Extended.UI.Seadragon.DziError(i);},getError:function(n){n instanceof DziError||(Seadragon.Debug.error(n.name+" while creating DZI from XML: "+n.message),n=new Sys.Extended.UI.Seadragon.DziError(Seadragon.Strings.getString("Errors.Unknown")))}};Sys.Extended.UI.Seadragon.DziTileSourceHelper=new Sys.Extended.UI.Seadragon._DziTileSourceHelper;Sys.Extended.UI.Seadragon.Rect=function(n,t,i,r){this.x=typeof n=="number"?n:0;this.y=typeof t=="number"?t:0;this.width=typeof i=="number"?i:0;this.height=typeof r=="number"?r:0};Sys.Extended.UI.Seadragon.Rect.prototype={getAspectRatio:function(){return this.width/this.height},getTopLeft:function(){return new Sys.Extended.UI.Seadragon.Point(this.x,this.y)},getBottomRight:function(){return new Sys.Extended.UI.Seadragon.Point(this.x+this.width,this.y+this.height)},getCenter:function(){return new Sys.Extended.UI.Seadragon.Point(this.x+this.width/2,this.y+this.height/2)},getSize:function(){return new Sys.Extended.UI.Seadragon.Point(this.width,this.height)},equals:function(n){return n instanceof Seadragon.Rect&&this.x===n.x&&this.y===n.y&&this.width===n.width&&this.height===n.height},toString:function(){return"["+this.x+","+this.y+","+this.width+"x"+this.height+"]"}};Sys.Extended.UI.Seadragon.Rect.registerClass("Sys.Extended.UI.Seadragon.Rect",null,Sys.IDisposable);Sys.Extended.UI.Seadragon.Job=function(n,t){this._image=null;this._timeout=null;this._src=n;this._callback=t;this.TIMEOUT=5e3};Sys.Extended.UI.Seadragon.Job.prototype={_finish:function(n){this._image.onload=null;this._image.onabort=null;this._image.onerror=null;this._timeout&&window.clearTimeout(this._timeout);var t=this._image,i=this._callback;window.setTimeout(function(){i(this._src,n?t:null)},1)},_onloadHandler:function(){this._finish(!0)},_onerrorHandler:function(){this._finish(!1)},start:function(){this._image=new Image;this._image.onload=Function.createDelegate(this,this._onloadHandler);this._image.onabort=Function.createDelegate(this,this._onerrorHandler);this._image.onerror=Function.createDelegate(this,this._onerrorHandler);this._timeout=window.setTimeout(Function.createDelegate(this,this._onerrorHandler),this.TIMEOUT);this._image.src=this._src}};Sys.Extended.UI.Seadragon.Job.registerClass("Sys.Extended.UI.Seadragon.Job",null,Sys.IDisposable);Sys.Extended.UI.Seadragon.ImageLoader=function(n){this._downloading=0;this.imageLoaderLimit=n};Sys.Extended.UI.Seadragon.ImageLoader.prototype={_onComplete:function(n,t,i){if(this._downloading--,typeof n=="function")try{n(i)}catch(r){Seadragon.Debug.error(r.name+" while executing "+t+" callback: "+r.message,r)}},loadImage:function(n,t){if(this._downloading>=this.imageLoaderLimit)return!1;var i=Seadragon.Utils.createCallback(null,Function.createDelegate(this,this._onComplete),t),r=new Sys.Extended.UI.Seadragon.Job(n,i);return this._downloading++,r.start(),!0}};Sys.Extended.UI.Seadragon.ImageLoader.registerClass("Sys.Extended.UI.Seadragon.ImageLoader",null,Sys.IDisposable);Sys.Extended.UI.Seadragon.Profiler=function(){this._midUpdate=!1;this._numUpdates=0;this._lastBeginTime=null;this._lastEndTime=null;this._minUpdateTime=Infinity;this._avgUpdateTime=0;this._maxUpdateTime=0;this._minIdleTime=Infinity;this._avgIdleTime=0;this._maxIdleTime=0};Sys.Extended.UI.Seadragon.Profiler.prototype={getAvgUpdateTime:function(){return this._avgUpdateTime},getMinUpdateTime:function(){return this._minUpdateTime},getMaxUpdateTime:function(){return this._maxUpdateTime},getAvgIdleTime:function(){return this._avgIdleTime},getMinIdleTime:function(){return this._minIdleTime},getMaxIdleTime:function(){return this._maxIdleTime},isMidUpdate:function(){return this._midUpdate},getNumUpdates:function(){return this._numUpdates},beginUpdate:function(){if(this._midUpdate&&this.endUpdate(),this._midUpdate=!0,this._lastBeginTime=(new Date).getTime(),!(this._numUpdates<1)){var n=this._lastBeginTime-this._lastEndTime;this._avgIdleTime=(this._avgIdleTime*(this._numUpdates-1)+n)/this._numUpdates;n<this._minIdleTime&&(this._minIdleTime=n);n>this._maxIdleTime&&(this._maxIdleTime=n)}},endUpdate:function(){if(this._midUpdate){this._lastEndTime=(new Date).getTime();this._midUpdate=!1;var n=this._lastEndTime-this._lastBeginTime;this._numUpdates++;this._avgUpdateTime=(this._avgUpdateTime*(this._numUpdates-1)+n)/this._numUpdates;n<this._minUpdateTime&&(this._minUpdateTime=n);n>this._maxUpdateTime&&(this._maxUpdateTime=n)}},clearProfile:function(){this._midUpdate=!1;this._numUpdates=0;this._lastBeginTime=null;this._lastEndTime=null;this._minUpdateTime=Infinity;this._avgUpdateTime=0;this._maxUpdateTime=0;this._minIdleTime=Infinity;this._avgIdleTime=0;this._maxIdleTime=0}};Sys.Extended.UI.Seadragon.Profiler.registerClass("Sys.Extended.UI.Seadragon.Profiler",null,Sys.IDisposable);Seadragon.Spring=Sys.Extended.UI.Seadragon.Spring=function(n,t){this._currentValue=typeof n=="number"?n:0;this._startValue=this._currentValue;this._targetValue=this._currentValue;this.config=t;this._currentTime=(new Date).getTime();this._startTime=this._currentTime;this._targetTime=this._currentTime};Sys.Extended.UI.Seadragon.Spring.prototype={_transform:function(n){var t=this.config.springStiffness;return(1-Math.exp(-n*t))/(1-Math.exp(-t))},getCurrent:function(){return this._currentValue},getTarget:function(){return this._targetValue},resetTo:function(n){this._targetValue=n;this._targetTime=this._currentTime;this._startValue=this._targetValue;this._startTime=this._targetTime},springTo:function(n){this._startValue=this._currentValue;this._startTime=this._currentTime;this._targetValue=n;this._targetTime=this._startTime+1e3*this.config.animationTime},shiftBy:function(n){this._startValue+=n;this._targetValue+=n},update:function(){this._currentTime=(new Date).getTime();this._currentValue=this._currentTime>=this._targetTime?this._targetValue:this._startValue+(this._targetValue-this._startValue)*this._transform((this._currentTime-this._startTime)/(this._targetTime-this._startTime))}};Sys.Extended.UI.Seadragon.Spring.registerClass("Sys.Extended.UI.Seadragon.Spring",null,Sys.IDisposable);Sys.Extended.UI.Seadragon.Viewport=function(n,t,i){this.zoomPoint=null;this.config=i;this._containerSize=n;this._contentSize=t;this._contentAspect=t.x/t.y;this._contentHeight=t.y/t.x;this._centerSpringX=new Seadragon.Spring(0,this.config);this._centerSpringY=new Seadragon.Spring(0,this.config);this._zoomSpring=new Seadragon.Spring(1,this.config);this._homeBounds=new Sys.Extended.UI.Seadragon.Rect(0,0,1,this._contentHeight);this.goHome(!0);this.update()};Sys.Extended.UI.Seadragon.Viewport.prototype={_getHomeZoom:function(){var n=this._contentAspect/this.getAspectRatio();return n>=1?1:n},_getMinZoom:function(){var n=this._getHomeZoom(),t;return t=this.config.minZoomDimension?this._contentSize.x<=this._contentSize.y?this.config.minZoomDimension/this._containerSize.x:this.config.minZoomDimension/(this._containerSize.x*this._contentHeight):this.config.minZoomImageRatio*n,Math.min(t,n)},_getMaxZoom:function(){var n=this._contentSize.x*this.config.maxZoomPixelRatio/this._containerSize.x;return Math.max(n,this._getHomeZoom())},getAspectRatio:function(){return this._containerSize.x/this._containerSize.y},getContainerSize:function(){return new Sys.Extended.UI.Seadragon.Point(this._containerSize.x,this._containerSize.y)},getBounds:function(n){var i=this.getCenter(n),t=1/this.getZoom(n),r=t/this.getAspectRatio();return new Sys.Extended.UI.Seadragon.Rect(i.x-t/2,i.y-r/2,t,r)},getCenter:function(n){var t=new Sys.Extended.UI.Seadragon.Point(this._centerSpringX.getCurrent(),this._centerSpringY.getCurrent()),r=new Sys.Extended.UI.Seadragon.Point(this._centerSpringX.getTarget(),this._centerSpringY.getTarget());if(n)return t;if(!this.zoomPoint)return r;var o=this.pixelFromPoint(this.zoomPoint,!0),u=this.getZoom(),i=1/u,f=i/this.getAspectRatio(),e=new Sys.Extended.UI.Seadragon.Rect(t.x-i/2,t.y-f/2,i,f),s=this.zoomPoint.minus(e.getTopLeft()).times(this._containerSize.x/e.width),h=s.minus(o),c=h.divide(this._containerSize.x*u);return r.plus(c)},getZoom:function(n){return n?this._zoomSpring.getCurrent():this._zoomSpring.getTarget()},applyConstraints:function(n){var e=this.getZoom(),o=Math.max(Math.min(e,this._getMaxZoom()),this._getMinZoom()),i;e!=o&&this.zoomTo(o,this.zoomPoint,n);var t=this.getBounds(),s=this.config.visibilityRatio,r=s*t.width,u=s*t.height,h=t.x+t.width,c=1-t.x,l=t.y+t.height,a=this._contentHeight-t.y,f=0;this.config.wrapHorizontal||(h<r?f=r-h:c<r&&(f=c-r));i=0;this.config.wrapVertical||(l<u?i=u-l:a<u&&(i=a-u));(f||i)&&(t.x+=f,t.y+=i,this.fitBounds(t,n))},ensureVisible:function(n){this.applyConstraints(n)},fitBounds:function(n,t){var u=this.getAspectRatio(),f=n.getCenter(),i=new Sys.Extended.UI.Seadragon.Rect(n.x,n.y,n.width,n.height),o;i.getAspectRatio()>=u?(i.height=n.width/u,i.y=f.y-i.height/2):(i.width=n.height*u,i.x=f.x-i.width/2);this.panTo(this.getCenter(!0),!0);this.zoomTo(this.getZoom(!0),null,!0);var r=this.getBounds(),s=this.getZoom(),e=1/i.width;if(e==s||i.width==r.width){this.panTo(f,t);return}o=r.getTopLeft().times(this._containerSize.x/r.width).minus(i.getTopLeft().times(this._containerSize.x/i.width)).divide(this._containerSize.x/r.width-this._containerSize.x/i.width);this.zoomTo(e,o,t)},goHome:function(n){var t=this.getCenter();this.config.wrapHorizontal&&(t.x=(1+t.x%1)%1,this._centerSpringX.resetTo(t.x),this._centerSpringX.update());this.config.wrapVertical&&(t.y=(this._contentHeight+t.y%this._contentHeight)%this._contentHeight,this._centerSpringY.resetTo(t.y),this._centerSpringY.update());this.fitBounds(this._homeBounds,n)},panBy:function(n,t){var i=new Sys.Extended.UI.Seadragon.Point(this._centerSpringX.getTarget(),this._centerSpringY.getTarget());this.panTo(i.plus(n),t)},panTo:function(n,t){t?(this._centerSpringX.resetTo(n.x),this._centerSpringY.resetTo(n.y)):(this._centerSpringX.springTo(n.x),this._centerSpringY.springTo(n.y))},zoomBy:function(n,t,i){this.zoomTo(this._zoomSpring.getTarget()*n,t,i)},zoomTo:function(n,t,i){i?this._zoomSpring.resetTo(n):this._zoomSpring.springTo(n);this.zoomPoint=t instanceof Sys.Extended.UI.Seadragon.Point?t:null},resize:function(n,t){var r=this.getBounds(),i=r,u=n.x/this._containerSize.x;this._containerSize=new Sys.Extended.UI.Seadragon.Point(n.x,n.y);t&&(i.width=r.width*u,i.height=i.width/this.getAspectRatio());this.fitBounds(i,!0)},update:function(){var r=this._centerSpringX.getCurrent(),u=this._centerSpringY.getCurrent(),n=this._zoomSpring.getCurrent(),t;if(this.zoomPoint&&(t=this.pixelFromPoint(this.zoomPoint,!0)),this._zoomSpring.update(),this.zoomPoint&&this._zoomSpring.getCurrent()!=n){var f=this.pixelFromPoint(this.zoomPoint,!0),e=f.minus(t),i=this.deltaPointsFromPixels(e,!0);this._centerSpringX.shiftBy(i.x);this._centerSpringY.shiftBy(i.y)}else this.zoomPoint=null;return this._centerSpringX.update(),this._centerSpringY.update(),this._centerSpringX.getCurrent()!=r||this._centerSpringY.getCurrent()!=u||this._zoomSpring.getCurrent()!=n},deltaPixelsFromPoints:function(n,t){return n.times(this._containerSize.x*this.getZoom(t))},deltaPointsFromPixels:function(n,t){return n.divide(this._containerSize.x*this.getZoom(t))},pixelFromPoint:function(n,t){var i=this.getBounds(t);return n.minus(i.getTopLeft()).times(this._containerSize.x/i.width)},pointFromPixel:function(n,t){var i=this.getBounds(t);return n.divide(this._containerSize.x/i.width).plus(i.getTopLeft())}};Sys.Extended.UI.Seadragon.Viewport.registerClass("Sys.Extended.UI.Seadragon.Viewport",null,Sys.IDisposable);Sys.Extended.UI.Seadragon.DisplayRect=function(n,t,i,r,u,f){Sys.Extended.UI.Seadragon.DisplayRect.initializeBase(this,[n,t,i,r]);this.minLevel=u;this.maxLevel=f};Sys.Extended.UI.Seadragon.DisplayRect.registerClass("Sys.Extended.UI.Seadragon.DisplayRect",Sys.Extended.UI.Seadragon.Rect);