var fileLoadingImage="images/loading.gif";var fileBottomNavCloseImage="images/closelabel.gif";var filePrevLinkImage="images/prevsmall.gif";var fileNextLinkImage="images/nextsmall.gif";var resizeSpeed=7;var borderSize=10;var panoramaWidth=640;var panoramaHeight=512;
function getViewer(){return document.viewer.getSubApplet()}function getModelHTML(a){return'<table width=100 height=100 frame=1 rules="all" bgcolor="#eeeeee"><tr><td align="middle"><center><a href="javascript:getViewer().addModel(\''+a+'\');"><img src="snaps/'+a+'.jpg" align="middle" border="1"></a></center></td></tr></table>'}var controlsCode='<div class="text"><FORM NAME="options"><INPUT TYPE="CHECKBOX" NAME="AA" VALUE="AA" onclick="getViewer().toggleAntialiasing();">Anti Aliasing<br><INPUT TYPE="CHECKBOX" NAME="WF" VALUE="WF" onclick="getViewer().toggleWireframe();">Wire Frame<br><INPUT TYPE="CHECKBOX" NAME="FS" VALUE="FS" onclick="getViewer().toggleFlatshading();">Flat shading<br><INPUT TYPE="CHECKBOX" NAME="TX" VALUE="TX" onclick="getViewer().toggleTexture();" CHECKED>Texture<br></FORM></div>';var AppletCode='<applet name="viewer" code="com.sun.opengl.util.JOGLAppletLauncher" width="512" height="512" codebase="." archive="jogl.jar,gluegen-rt.jar,JOGLTexMesh3D.jar"><param name="subapplet.classname" value="JOGLTexMesh3D"><param name="subapplet.displayname" value="The JOGLTexMesh3D Applet"><param name="cache_archive" value="jogl.jar, JOGLTexMesh3D.jar"><param name="cache_archive_ex" value="jogl.jar;preload, JOGLTexMesh3D.jar;preload"><param name="model" value="gormley"><param name="progressbar" value="true"></applet>';var panoramaAppletCode="<table><tr><td>"+getModelHTML("gormley")+"<br>"+getModelHTML("ocean")+"<br>"+getModelHTML("elgin")+"<br>"+controlsCode+"</td><td>"+AppletCode+"</td></tr></table>";var panoramaHelpText="";var imageArray=new Array;var activeImage;if(resizeSpeed>10){resizeSpeed=10}if(resizeSpeed<1){resizeSpeed=1}resizeDuration=(11-resizeSpeed)*0.15;Object.extend(Element,{getWidth:function(a){a=$(a);return a.offsetWidth},setWidth:function(b,a){b=$(b);b.style.width=a+"px"},setHeight:function(a,b){a=$(a);a.style.height=b+"px"},setTop:function(b,a){b=$(b);b.style.top=a+"px"},setSrc:function(a,b){a=$(a);a.src=b},setHref:function(b,a){b=$(b);b.href=a},setInnerHTML:function(a,b){a=$(a);a.innerHTML=b}});Array.prototype.removeDuplicates=function(){for(i=1;i<this.length;i++){if(this[i][0]==this[i-1][0]){this.splice(i,1)}}};Array.prototype.empty=function(){for(i=0;i<=this.length;i++){this.shift()}};var Lightbox=Class.create();Lightbox.prototype={initialize:function(){if(!document.getElementsByTagName){return}var p=document.getElementsByTagName("a");for(var v=0;v<p.length;v++){var h=p[v];var x=String(h.getAttribute("rel"));if(h.getAttribute("href")&&(x.toLowerCase().match("lightbox"))){h.onclick=function(){myLightbox.start(this);return false}}}var y=document.getElementsByTagName("body").item(0);var j=document.createElement("div");j.setAttribute("id","overlay");j.style.display="none";j.onclick=function(){myLightbox.end();return false};y.appendChild(j);var o=document.createElement("div");o.setAttribute("id","lightbox");o.style.display="none";y.appendChild(o);var w=document.createElement("div");w.setAttribute("id","outerImageContainer");o.appendChild(w);var n=document.createElement("div");n.setAttribute("id","imageContainer");w.appendChild(n);var e=document.createElement("div");e.setAttribute("id","lightboxPanorama");n.appendChild(e);var u=document.createElement("div");u.setAttribute("id","loading");n.appendChild(u);var a=document.createElement("a");a.setAttribute("id","loadingLink");a.setAttribute("href","#");a.onclick=function(){myLightbox.end();return false};u.appendChild(a);var m=document.createElement("img");m.setAttribute("src",fileLoadingImage);a.appendChild(m);var f=document.createElement("div");f.setAttribute("id","imageDataContainer");f.className="clearfix";o.appendChild(f);var d=document.createElement("div");d.setAttribute("id","imageData");f.appendChild(d);var r=document.createElement("div");r.setAttribute("id","imageDetails");d.appendChild(r);var k=document.createElement("span");k.setAttribute("id","caption");r.appendChild(k);var z=document.createElement("span");z.setAttribute("id","navigation");r.appendChild(z);var b=document.createElement("span");b.setAttribute("id","numberDisplay");z.appendChild(b);var s=document.createElement("a");s.setAttribute("id","prevLink");s.setAttribute("href","#");s.setAttribute("title","Previous Panorama");z.appendChild(s);var t=document.createElement("img");t.setAttribute("src",filePrevLinkImage);s.appendChild(t);var c=document.createElement("a");c.setAttribute("id","nextLink");c.setAttribute("href","#");c.setAttribute("title","Next Panorama");z.appendChild(c);var g=document.createElement("img");g.setAttribute("src",fileNextLinkImage);c.appendChild(g);var q=document.createElement("div");q.setAttribute("id","bottomNav");d.appendChild(q);var A=document.createElement("a");A.setAttribute("id","bottomNavClose");A.setAttribute("href","#");A.onclick=function(){myLightbox.end();return false};q.appendChild(A);var l=document.createElement("img");l.setAttribute("src",fileBottomNavCloseImage);A.appendChild(l)},start:function(g){hideSelectBoxes();var c=getPageSize();Element.setHeight("overlay",c[1]);new Effect.Appear("overlay",{duration:0.2,from:0,to:0.8});imageArray=[];imageNum=0;if(!document.getElementsByTagName){return}var e=document.getElementsByTagName("a");if((g.getAttribute("rel")=="lightbox")){imageArray.push(new Array(g.getAttribute("href"),g.getAttribute("title"),g.getAttribute("additionalParams")))}else{for(var d=0;d<e.length;d++){var b=e[d];if(b.getAttribute("href")&&(b.getAttribute("rel")==g.getAttribute("rel"))){imageArray.push(new Array(b.getAttribute("href"),b.getAttribute("title"),b.getAttribute("additionalParams")))}}imageArray.removeDuplicates();while(imageArray[imageNum][0]!=g.getAttribute("href")){imageNum++}}var c=getPageSize();var a=getPageScroll();var f=a[1]+(c[3]/15);Element.setTop("lightbox",f);Element.show("lightbox");this.changeImage(imageNum)},startById:function(a){var b=document.getElementById(a);if(b!=null){myLightbox.start(b)}},changeImage:function(a){Element.setInnerHTML("lightboxPanorama","");activeImage=a;Element.show("loading");Element.hide("lightboxPanorama");Element.hide("navigation");Element.hide("prevLink");Element.hide("nextLink");Element.hide("imageDataContainer");Element.hide("numberDisplay");myLightbox.resizeImageContainer(panoramaWidth,panoramaHeight);var b=panoramaAppletCode;b=b.replace(/@panoramaWidth@/g,panoramaWidth);b=b.replace(/@panoramaHeight@/g,panoramaHeight);b=b.replace(/@panoramaFile@/g,imageArray[activeImage][0]);b=b.replace(/@additionalParams@/g,imageArray[activeImage][2]);Element.setInnerHTML("lightboxPanorama",b)},resizeImageContainer:function(b,a){this.wCur=Element.getWidth("outerImageContainer");this.hCur=Element.getHeight("outerImageContainer");this.xScale=((b+(borderSize*2))/this.wCur)*100;this.yScale=((a+(borderSize*2))/this.hCur)*100;wDiff=(this.wCur-borderSize*2)-b;hDiff=(this.hCur-borderSize*2)-a;if(!(hDiff==0)){new Effect.Scale("outerImageContainer",this.yScale,{scaleX:false,duration:resizeDuration,queue:"front"})}if(!(wDiff==0)){new Effect.Scale("outerImageContainer",this.xScale,{scaleY:false,delay:resizeDuration,duration:resizeDuration})}if((hDiff==0)&&(wDiff==0)){if(navigator.appVersion.indexOf("MSIE")!=-1){pause(250)}else{pause(100)}}Element.setWidth("imageDataContainer",b+(borderSize*2));this.showImage()},showImage:function(){Element.hide("loading");new Effect.Appear("lightboxPanorama",{duration:0.5,queue:"end",afterFinish:function(){myLightbox.updateDetails()}})},updateDetails:function(){Element.show("caption");Element.setInnerHTML("caption",imageArray[activeImage][1]+panoramaHelpText);if(imageArray.length>1){Element.show("numberDisplay");Element.setInnerHTML("numberDisplay","Panorama "+eval(activeImage+1)+" of "+imageArray.length)}new Effect.Parallel([new Effect.SlideDown("imageDataContainer",{sync:true,duration:resizeDuration+0.25,from:0,to:1}),new Effect.Appear("imageDataContainer",{sync:true,duration:1})],{duration:0.65,afterFinish:function(){myLightbox.updateNav()}})},updateNav:function(){Element.show("navigation");if(activeImage!=0){Element.show("prevLink");document.getElementById("prevLink").onclick=function(){myLightbox.changeImage(activeImage-1);return false}}if(activeImage!=(imageArray.length-1)){Element.show("nextLink");document.getElementById("nextLink").onclick=function(){myLightbox.changeImage(activeImage+1);return false}}this.enableKeyboardNav()},enableKeyboardNav:function(){document.onkeydown=this.keyboardAction},disableKeyboardNav:function(){document.onkeydown=""},keyboardAction:function(a){if(a==null){keycode=event.keyCode}else{keycode=a.which}key=String.fromCharCode(keycode).toLowerCase();if((key=="x")||(key=="o")||(key=="c")){myLightbox.end()}else{if(key=="p"){if(activeImage!=0){myLightbox.disableKeyboardNav();myLightbox.changeImage(activeImage-1)}}else{if(key=="n"){if(activeImage!=(imageArray.length-1)){myLightbox.disableKeyboardNav();myLightbox.changeImage(activeImage+1)}}}}},end:function(){this.disableKeyboardNav();Element.hide("lightbox");new Effect.Fade("overlay",{duration:0.2});showSelectBoxes()}};function getPageScroll(){var a;if(self.pageYOffset){a=self.pageYOffset}else{if(document.documentElement&&document.documentElement.scrollTop){a=document.documentElement.scrollTop}else{if(document.body){a=document.body.scrollTop}}}arrayPageScroll=new Array("",a);return arrayPageScroll}function getPageSize(){var c,a;if(window.innerHeight&&window.scrollMaxY){c=document.body.scrollWidth;a=window.innerHeight+window.scrollMaxY}else{if(document.body.scrollHeight>document.body.offsetHeight){c=document.body.scrollWidth;a=document.body.scrollHeight}else{c=document.body.offsetWidth;a=document.body.offsetHeight}}var b,d;if(self.innerHeight){b=self.innerWidth;d=self.innerHeight}else{if(document.documentElement&&document.documentElement.clientHeight){b=document.documentElement.clientWidth;d=document.documentElement.clientHeight}else{if(document.body){b=document.body.clientWidth;d=document.body.clientHeight}}}if(a<d){pageHeight=d}else{pageHeight=a}if(c<b){pageWidth=b}else{pageWidth=c}arrayPageSize=new Array(pageWidth,pageHeight,b,d);return arrayPageSize}function getKey(a){if(a==null){keycode=event.keyCode}else{keycode=a.which}key=String.fromCharCode(keycode).toLowerCase();if(key=="x"){}}function listenKey(){document.onkeypress=getKey}function showSelectBoxes(){selects=document.getElementsByTagName("select");for(i=0;i!=selects.length;i++){selects[i].style.visibility="visible"}}function hideSelectBoxes(){selects=document.getElementsByTagName("select");for(i=0;i!=selects.length;i++){selects[i].style.visibility="hidden"}}function pause(b){var a=new Date();var c=a.getTime()+b;while(true){a=new Date();if(a.getTime()>c){return}}}function initLightbox(){myLightbox=new Lightbox();var e="";var f=window.document.URL.toString();if(f.indexOf("?")>0){var b=f.split("?");var d=b[1].split("&");var c=0;for(c=0;c<d.length;c++){var a=d[c].split("=");if(a[0]=="panotoshow"&&a[1]!=""){e=unescape(a[1])}}}if(e!=""){myLightbox.startById(e)}}Event.observe(window,"load",initLightbox,false);
