var _collectionUrl="http://mslabs-409.vo.llnwd.net/d9/photosynth/M6/collections/d9/68/cc/d968cc86-9d56-4d0d-b268-be045b87b712.dzc",_viewerLatestVersion="2",_psInfo=getPhotosynthInfo(),_initialized=false,_isPhotosynthExpanded=false,_isPhotosynthInstalling=false,_isPhotosynthUpdating=false,_psAtlasLocation="stpeter",_psSavedState=[{"image":"","projector":"","position":"","direction":"","zoom":""},{"image":"","projector":"","position":"","direction":"","zoom":""},{"image":"","projector":"","position":"","direction":"","zoom":""},{"image":"","projector":"","position":"","direction":"","zoom":""},{"image":"","projector":"","position":"","direction":"","zoom":""}],clueImageInfo=[{"id":"earth","imageName":"8E748CCCE2A9A3595F1DC82BFCFC368A.dzi","left":762,"top":2170,"right":2920,"bottom":3670,"ambCollectionUrl":"http://mslabs-533.vo.llnwd.net/d4/photosynth/M6/collections/2b/6a/41/2b6a4182-b360-4e02-ab43-95f15871a300.dzc"},{"id":"air","imageName":"F939DB5048796BE1A6710921CC9DE5E8.dzi","left":790,"top":2100,"right":1290,"bottom":2600,"ambCollectionUrl":"http://mslabs-435.vo.llnwd.net/d5/photosynth/M6/collections/99/74/55/99745538-d95e-4e79-9189-3e02a85a64fd.dzc"},{"id":"fire","imageName":"1E074D578E311CCF52D70C4533FCD076.dzi","left":800,"top":2570,"right":1350,"bottom":3070,"ambCollectionUrl":"http://mslabs-522.vo.llnwd.net/d5/photosynth/m6/collections/50/d0/f7/50d0f797-9525-474d-a921-7d03cb979796.dzc"},{"id":"water","imageName":"1CCF3DED44539F33EE0481B657DF791B.dzi","left":1990,"top":1475,"right":2590,"bottom":1900,"ambCollectionUrl":"http://mslabs-970.vo.llnwd.net/d3/photosynth/M6/collections/06/8e/7b/068e7bf9-7c3a-478e-a671-d1b545f98df8.dzc"}],currentAmbigramCount=-2,keyCodesMap={};function wireUpKeys(){keyCodesMap["37"]="left";keyCodesMap["38"]="in";keyCodesMap["39"]="right";keyCodesMap["40"]="out";keyCodesMap["74"]="down";keyCodesMap["75"]="next";keyCodesMap["85"]="up"}function viewerStartup(){if(_initialized==false){var a=document.getElementById("photosynthContainer");if(a){a.style.visibility="hidden";viewerPageInit();a.style.visibility="visible";wireUpKeys();addEventListeners();_initialized=true}}}function viewerPageInit(){if(isViewerUpToDate()==true){if(currentAmbigramCount==-1)loadCollection(_collectionUrl);else loadCollection(clueImageInfo[currentAmbigramCount].ambCollectionUrl);viewerInit()}}function viewerInit(){a();function a(){var a=document.getElementById("Photosynth");if(a){a.onCollectionLoaded=onPhotoSynthCollectionLoaded;a.onClick=onPhotoSynthClick}}}function onPhotoSynthClick(){if(currentAmbigramCount==-1)return;var e=document.getElementById("Photosynth");if(e){var c=e.image;if(clueImageInfo[currentAmbigramCount].imageName==c.substring(c.lastIndexOf("/")+1,c.length)){var d=getFlashInstance();for(var a=1;a<arguments.length;a+=3)if(e.projector==arguments[a])if(arguments[a+2]!=null){var b=arguments[a+2].split(":");if(b[0]>=clueImageInfo[currentAmbigramCount].left&&b[0]<clueImageInfo[currentAmbigramCount].right&&b[1]>=clueImageInfo[currentAmbigramCount].top&&b[1]<clueImageInfo[currentAmbigramCount].bottom)if(d&&d.itemLocated){d.itemLocated(clueImageInfo[currentAmbigramCount].id);return}}}}}function isViewerUpToDate(){var a=document.cookie.indexOf("LastUpgrade="),c=0;if(a!=-1){a+=12;var b=document.cookie.indexOf(";",a);if(b<1)b=document.cookie.length;c=parseInt(document.cookie.slice(a,b))}if(_psInfo.isPresent==true)return true;if(_psInfo.version>=parseInt(_viewerLatestVersion))return true;if(c>=parseInt(_viewerLatestVersion))alert("A new version of Photosynth has been installed.\r\n\r\nYou must restart your browser.");return false}function photosynthInfoRefresh(){if(_isPhotosynthInstalling){_psInfo=getPhotosynthInfo();if(!_isPhotosynthUpdating&&photosynthInstalled()||_isPhotosynthUpdating&&photosynthLatest()){_isPhotosynthInstalling=false;_isPhotosynthUpdating=false;var a=getFlashInstance();if(a&&a.psInstallComplete)a.psInstallComplete()}else setTimeout("photosynthInfoRefresh()",5000)}}function getFlashInstance(){var a;if(navigator.appName.indexOf("Microsoft")!=-1)a=window["mainFlash"];else if(document["mainFlash"].length)a=document["mainFlash"][1];else a=document["mainFlash"];return a}function startPhotosynthInstallTimer(){if(!_isPhotosynthInstalling){_isPhotosynthInstalling=true;if(_psInfo.isPresent)_isPhotosynthUpdating=true;photosynthInfoRefresh()}}function onPhotoSynthCollectionLoaded(){var a=document.getElementById("Photosynth");if(a){if(_psSavedState[currentAmbigramCount+1].image!=""){a.image=_psSavedState[currentAmbigramCount+1].image;a.projector=_psSavedState[currentAmbigramCount+1].projector;a.position=_psSavedState[currentAmbigramCount+1].position;a.direction=_psSavedState[currentAmbigramCount+1].direction;a.zoom=_psSavedState[currentAmbigramCount+1].zoom}a.modeVisible=false;a.logoVisible=false}}function addEventListeners(){var a=document.getElementById("photosynthContainer");if(a)if(a.attachEvent)a.attachEvent("onkeydown",keyboardEventHandler);else a.addEventListener("onkeydown",keyboardEventHandler,false)}function keyboardEventHandler(c){var a;if(window.event)a=c.keyCode;else if(c.which)a=c.which;if(a){var b=document.getElementById("Photosynth");if(b){if(b.is2D==true){keyCodesMap["38"]="up";keyCodesMap["40"]="down"}else{keyCodesMap["38"]="in";keyCodesMap["40"]="out"}if(a+"" in keyCodesMap){var d=keyCodesMap[a+""];if(d!="")b.goToNeighbor(d)}}}}function photosynthInstalled(){return _psInfo.isPresent}function photosynthSupported(){return _psInfo.isSupported}function photosynthLatest(){return _psInfo.version>=parseInt(_viewerLatestVersion)}function photosynthExpand(b){if(_isPhotosynthExpanded==false){var c=currentAmbigramCount;b=b.toLowerCase();switch(b){case "earth":currentAmbigramCount=0;break;case "air":currentAmbigramCount=1;break;case "fire":currentAmbigramCount=2;break;case "water":currentAmbigramCount=3;break;case "demo":default:currentAmbigramCount=-1}if(currentAmbigramCount!=c)_psAtlasLocation=b=="demo"?"stpeter":b;insertViewer();_initialized=false;setTimeout("viewerStartup()",1000);var a=document.getElementById("photosynthContainer");if(a){if(_psInfo.browser!="ie"){a.style.visibility="visible";a.parentNode.style.visibility="visible"}a.style.zIndex=100;a.parentNode.style.zIndex=100}_isPhotosynthExpanded=true;Atlas.Action("view|synthstart|photosynth|"+_psAtlasLocation);callHeartBeatTracking()}}function photosynthCollapse(){if(_isPhotosynthExpanded==true){var a=document.getElementById("Photosynth");a.slideShowPlaying=false;_psSavedState[currentAmbigramCount+1].image=a.image;_psSavedState[currentAmbigramCount+1].projector=a.projector;_psSavedState[currentAmbigramCount+1].position=a.position;_psSavedState[currentAmbigramCount+1].direction=a.direction;_psSavedState[currentAmbigramCount+1].zoom=a.zoom;var b=document.getElementById("photosynthContainer");if(b){if(_psInfo.browser!="ie"){b.style.visibility="hidden";b.parentNode.style.visibility="hidden"}b.style.zIndex=-100;b.parentNode.style.zIndex=-100}setTimeout("clearPhotosynthContainer()",500);_isPhotosynthExpanded=false;Atlas.Action("click|synthend|photosynth|"+_psAtlasLocation)}}function photosynthSetPosition(c,b){var a=document.getElementById("photosynthContainer");if(a){a.style.top=c+"px";a.style.left=b+"px"}}function photosynthSetSize(c,b){var a=document.getElementById("photosynthContainer");if(a){a.style.width=c+"px";a.style.height=b+"px"}}function callHeartBeatTracking(){if(_isPhotosynthExpanded){Atlas.Action("click|synthplay|photosynth|"+_psAtlasLocation);setTimeout("callHeartBeatTracking()",30000)}}function clearPhotosynthContainer(){var a=document.getElementById("photosynthContainer");if(a){var b=document.getElementById("Photosynth");if(b){b.onCollectionLoaded-=onPhotoSynthCollectionLoaded;b.onClick-=onPhotoSynthClick;a.firstChild.onCollectionLoaded-=onPhotoSynthCollectionLoaded;a.firstChild.onClick-=onPhotoSynthClick;if(b.detachEvent){b.detachEvent("onCollectionLoaded",onPhotoSynthCollectionLoaded);b.detachEvent("onClick",onPhotoSynthClick);a.firstChild.detachEvent("onCollectionLoaded",onPhotoSynthCollectionLoaded);a.firstChild.detachEvent("onClick",onPhotoSynthClick)}else{b.removeEventListener("onCollectionLoaded",onPhotoSynthCollectionLoaded,false);b.removeEventListener("onClick",onPhotoSynthClick,false);a.firstChild.removeEventListener("onCollectionLoaded",onPhotoSynthCollectionLoaded,false);a.firstChild.removeEventListener("onClick",onPhotoSynthClick,false)}delete b;b=null}if(a.detachEvent)a.detachEvent("onkeydown",keyboardEventHandler);else a.removeEventListener("onkeydown",keyboardEventHandler,false);if(a.childNodes.length>0)a.removeChild(a.firstChild);a.innerHTML=""}var d=document.createElement("script");d.type="text/javascript";var c=document.createElement("div");c.id="photosynthContainer";c.appendChild(d);var e=document.getElementById("photosynthParentContainer");e.replaceChild(c,e.firstChild)}