if(!window.Microsoft){window.Microsoft={};window.Microsoft.Photosynth={};window.Microsoft.Photosynth.Math={}}Microsoft.Photosynth.Config={minimumSilverlightVersion:"3.0.40818.0",maxImageDimension:512,xapSource:"http://photosynth.net/silverlight/photosynth.xap",psWebService:"http://photosynth.net/",silverlightInstallUrl:"http://www.microsoft.com/silverlight/resources/install.aspx",clickToViewImageUrl:"http://photosynth.net/inc/images/view_synth_btn.png",backgroundTexture:"http://photosynth.net/api/slbackground_black.png",useLeftPadding:false};Microsoft.Photosynth.Strings={ClickToView:"Click to view the synth",PleaseRefresh:"When the Silverlight installation is finished<br>reload this page to view the synth.",PleaseRestart:"When the Silverlight installation is finished<br>restart the browser to view the synth."};Microsoft.Photosynth.viewers=[];Microsoft.Photosynth._nextId=0;Microsoft.Photosynth.NavigationType={Immediate:0,Direct:1,DefaultPath:2};Microsoft.Photosynth.DisplayMode={TwoD:1,ThreeD:2};Microsoft.Photosynth.PointCloudMode={ImagesOnly:1,ImagesAndPointCloud:2,PointCloudOnly:3};Microsoft.Photosynth.viewerLoadCollectionCompletedCallback=function(b){var a=Microsoft.Photosynth._getViewerInstance(b.id);if(a==null)return;a._onLoadCollectionCompleted(b)};Microsoft.Photosynth.openSilverlightInfoWindow=function(){window.open(Microsoft.Photosynth.Config.silverlightInstallUrl,"_blank")};Microsoft.Photosynth._getNextId=function(){Microsoft.Photosynth._nextId++;return Microsoft.Photosynth._nextId};Microsoft.Photosynth._getViewerInstance=function(b){for(var a in Microsoft.Photosynth.viewers)if(Microsoft.Photosynth.viewers[a].id==b)return Microsoft.Photosynth.viewers[a];return null};Microsoft.Photosynth.registerViewer=function(a){a.id="photosynth_viewer_"+Microsoft.Photosynth._getNextId();Microsoft.Photosynth.viewers.push(a)};Microsoft.Photosynth.delayLoadClicked=function(b){var a=Microsoft.Photosynth._getViewerInstance(b);if(a==null)return;a.onDelayLoadClicked()};Microsoft.Photosynth.installClicked=function(){for(var a in Microsoft.Photosynth.viewers)Microsoft.Photosynth.viewers[a].onInstallClicked()};Microsoft.Photosynth.resizeImageToParent=function(n,o,p,h){var d=document.getElementById(o),m=document.getElementById(p),i=5,e=d.width,c=d.height,b=m.offsetWidth-i*2,k=m.offsetHeight-i*2,a=1;if(e>b)a=b/e;if(c*a>k)a=k/c;var g=e>c?e*a:c*a;if(g>h)a=a*(h/g);d.width=d.width*a;d.style.visibility="visible";var f=document.getElementById(n+"_messageDisplay"),q=document.location.href;if(f!=null){var l="0",j="0";if(a>0)l=c*a-80;f.style.paddingTop=l+"px";if(Microsoft.Photosynth.Config.useLeftPadding==true){if(b/2-b>0)j=b/2-b;f.style.paddingLeft=j+"px"}}};Microsoft.Photosynth.Viewer=function(b){var a=this;this._init=function(){a.id="";Microsoft.Photosynth.registerViewer(a);a._viewerInstance=null;a.viewport3D=null;a._ownerId=b;a._owner=document.getElementById(a._ownerId);a.loadCollectionCompleted=null;a.displayModeChanged=null;a.pointCloudModeChanged=null;a.moveToImageCompleted=null;a.beforeToggleFullScreen=null};this._onLoadCollectionCompleted=function(b){a._viewerInstance=b;a._viewerInstance.content.api.registerViewer(a);a.viewport3D=a._viewerInstance.content.api.viewport3D;a._viewerInstance.content.api.displayModeChanged=a._onDisplayModeChanged;a._viewerInstance.content.api.pointCloudModeChanged=a._onPointCloudModeChanged;a._viewerInstance.content.api.moveToImageCompleted=a._onMoveToImageCompleted;a._viewerInstance.content.api.beforeToggleFullScreen=a._onBeforeToggleFullScreen;a.loadCollectionCompleted!=null&&a.loadCollectionCompleted(a)};this._onDisplayModeChanged=function(b){a.displayModeChanged!=null&&a.displayModeChanged(b)};this._onPointCloudModeChanged=function(b){a.pointCloudModeChanged!=null&&a.pointCloudModeChanged(b)};this._onMoveToImageCompleted=function(b){a.moveToImageCompleted!=null&&a.moveToImageCompleted(b)};this._onBeforeToggleFullScreen=function(b,c){a.beforeToggleFullScreen!=null&&a.beforeToggleFullScreen(b,c)};this.getPoseState=function(){if(a._viewerInstance==null)return "";return a._viewerInstance.content.api.getPoseState()};this.setFromPoseState=function(b){if(a._viewerInstance==null)return;a._viewerInstance.content.api.setFromPoseState(b)};this.getPointCloudMode=function(){if(a._viewerInstance==null)return;return a._viewerInstance.content.api.pointCloudMode};this.setPointCloudMode=function(b){if(a._viewerInstance==null)return;a._viewerInstance.content.api.pointCloudMode=b};this.setSlideshowInterval=function(b){if(a._viewerInstance==null)return;a._viewerInstance.content.api.setSlideshowInterval(b)};this.isSlideshowRunning=function(){if(a._viewerInstance==null)return;return a._viewerInstance.content.api.isSlideshowRunning()};this.toggleSlideshow=function(b){if(a._viewerInstance==null)return;a._viewerInstance.content.api.toggleSlideshow(b)};this.getCurrentDisplayMode=function(){if(a._viewerInstance==null)return -1;return a._viewerInstance.content.api.currentDisplayMode};this.getSelectedImageId=function(){if(a._viewerInstance==null)return -1;return a._viewerInstance.content.api.selectedImageId};this.moveToImage=function(b,c){if(a._viewerInstance==null)return;a._viewerInstance.content.api.moveToImage(b,c)};this.loadCollectionAsync=function(c){if(a._loadParameters!=null)throw"Load can only be called once on a viewer instance";a._loadParameters=c;var b;if(c.delayLoad&&Silverlight.isInstalled(Microsoft.Photosynth.Config.minimumSilverlightVersion))b=a.onCreateDelayLoadHtml();else b=a._createViewerHtml();this.setContainerHtml(b)};this.setContainerHtml=function(b){a._owner.innerHTML=b};this.onInstallClicked=function(){var b=null;if(Silverlight.isBrowserRestartRequired)b=document.getElementById(a.id+"_restartMessageDisplay");else b=document.getElementById(a.id+"_refreshMessageDisplay");if(b!=null){b.style.display="block";var d=document.getElementById(a.id+"_installMessageDisplay");if(d!=null)d.style.display="none";var c=document.getElementById(a.id+"_installLink");if(c!=null){c.onclick="";c.style.cursor="cross"}}Silverlight.getSilverlight(Microsoft.Photosynth.Config.minimumSilverlightVersion)};this.onDelayLoadClicked=function(){var b=a._createViewerHtml();a._owner.innerHTML=b};this.onCreateInstallHtml=function(){var c=a._getHtmlTemplate(),b='<div style="width:410px" id="'+a.id+'_installMessageDisplay"><img id="'+this.id+'imgClick" alt="'+Microsoft.Photosynth.Strings.ClickToView+'" title="'+Microsoft.Photosynth.Strings.ClickToView+'" src="'+Microsoft.Photosynth.Config.clickToViewImageUrl+'" />                             <p style="color:#ffffff;font-size:10px;cursor:default;background-image:url('+Microsoft.Photosynth.Config.backgroundTexture+'); padding:4px;margin:20px;margin-top: 10px;border-style:none;">                                 You\'ll be installing <span style="cursor:pointer;text-decoration:underline;" onclick="Microsoft.Photosynth.openSilverlightInfoWindow(); if (event.stopPropagation) {event.stopPropagation();} else {event.cancelBubble = true;};"><b>Microsoft Silverlight</b></span>. It\'s small and fast.                             </p></div>                             <div style="width:410px; display:none;" id="'+a.id+'_restartMessageDisplay"><p style="color:#ffffff;font-size:16px;cursor:default;background-image:url('+Microsoft.Photosynth.Config.backgroundTexture+');padding:4px;margin:20px;border-style:none;">'+Microsoft.Photosynth.Strings.PleaseRestart+'</p></div>                             <div style="width:410px; display:none;" id="'+a.id+'_refreshMessageDisplay"><p style="color:#ffffff;font-size:16px;cursor:default;background-image:url('+Microsoft.Photosynth.Config.backgroundTexture+');padding:4px;margin:20px;border-style:none;">'+Microsoft.Photosynth.Strings.PleaseRefresh+"</p></div>";return c.replace("##OVERLAY_CONTENT##",b).replace("##ONCLICK##","onclick=\"Microsoft.Photosynth.installClicked('"+a.id+"');\"")};this.onCreateDelayLoadHtml=function(){var c=a._getHtmlTemplate(),b='<div style="width:410px"><img id="'+a.id+'imgClick" alt="'+Microsoft.Photosynth.Strings.ClickToView+'" title="'+Microsoft.Photosynth.Strings.ClickToView+'" src="'+Microsoft.Photosynth.Config.clickToViewImageUrl+'" /></div>';return c.replace("##OVERLAY_CONTENT##",b).replace("##ONCLICK##"," onclick=\"Microsoft.Photosynth.delayLoadClicked('"+a.id+"');\"")};this._getHtmlTemplate=function(){return '<div id="'+a.id+'_mainDiv" style="cursor:pointer;font-family:Verdana,Arial,Helvetica;z-index:0;min-height:100%;position:relative;width:100%;height:100%;overflow:hidden;margin:0;padding:0;background-color:#000000;" ##ONCLICK## >                     <div style="z-index:0;min-height:100%;position:absolute;width:100%;height:100%;margin:0;padding:0;border:0;background-color:#000000;">                         <table width="100%" style="height:100%;margin:0;padding:0;border:0;">                             <tr>                                 <td width="100%" height="100%" style="margin:0;padding:0;border:0;" align="center">                                     <img onload="Microsoft.Photosynth.resizeImageToParent(\''+a.id+"', '"+a.id+"_holdingImage', '"+a.id+"_mainDiv', "+Microsoft.Photosynth.Config.maxImageDimension+');" style="visibility:hidden;" id="'+a.id+'_holdingImage" alt="'+Microsoft.Photosynth.Strings.ClickToView+'" title="'+Microsoft.Photosynth.Strings.ClickToView+'" src="'+a._loadParameters.holdingImageUrl+'" />                                 </td>                             </tr>                         </table>                     </div>                     <div style="z-index:1;min-height:100%;position:absolute;width:100%;height:100%;margin:0;padding:0;border:0;background-color:Transparent;">                         <table border="0" style="height:100%;margin-left:auto;margin-right:auto;padding:0;border:0" align="center">                             <tr>                                 <td height="100%" style="margin:0;padding:0 auto; border:0;" align="center">                                     <div id="'+a.id+'_messageDisplay">                                         ##OVERLAY_CONTENT##                                     </div>                                 </td>                             </tr>                         </table>                     </div>                 </div>'};this._createViewerHtml=function(){var e=null,d=this._loadParameters.autoPlay?"true":"false",b="false";if(this._loadParameters.suppressFirstUsePanel!=undefined)b=this._loadParameters.suppressFirstUsePanel?"true":"false";var c=Silverlight.createObject(Microsoft.Photosynth.Config.xapSource,e,a.id,{version:Microsoft.Photosynth.Config.minimumSilverlightVersion,alt:a.onCreateInstallHtml(),width:"100%",height:"100%",background:"#000000",enableHtmlAccess:"true",autoUpgrade:"true",allowHtmlPopupWindow:"true"},{},"psWebService="+Microsoft.Photosynth.Config.psWebService+",autoPlay="+d+",suppressFirstUsePanel="+b+",cid="+a._loadParameters.collectionId,a);return c};a._init()};Microsoft.Photosynth.Viewer.LoadParameters=function(c,b,d,e,a){this.collectionId=c;this.holdingImageUrl=b;this.delayLoad=d;this.autoPlay=e;this.suppressFirstUsePanel=a};Microsoft.Photosynth.Math.Quaternion=function(b,c,d,a){this._init=function(a,c,d,b){if(a){this.x=a;this.y=c;this.z=d;this.w=b}else{this.x=0;this.y=0;this.z=0;this.w=1}};this._init(b,c,d,a)};Microsoft.Photosynth.Math.Vector3D=function(a,b,c){this._init=function(a,b,c){if(a){this.x=a;this.y=b;this.z=c}else{this.x=0;this.y=0;this.z=0}};this._init(a,b,c)};