apds.SlideShow=function(){this.activeIndex=null;this.listeners=[];this.descAnim=null};apds.SlideShow.IMG_WIDTH=500;apds.SlideShow.IMG_HEIGHT=333;apds.SlideShow.PhotoData=function(b,a){this.src=b;this.desc=a};apds.SlideShow.prototype.setPhotoDataArray=function(a){this.photos=a};apds.SlideShow.prototype.setContainerId=function(a){this.cntrId=a};apds.SlideShow.prototype.setDescriptionIdandClass=function(b,a){this.descId=b;this.descClass=a};apds.SlideShow.prototype.setDescriptionMaxOpacity=function(a){this.descMaxOpacity=a};apds.SlideShow.prototype.setPreloaderId=function(a){this.pldrId=a};apds.SlideShow.prototype.addListener=function(a){this.listeners.push(a)};apds.SlideShow.prototype.notify=function(a){for(var b=0;b<this.listeners.length;b++){this.listeners[b].photoChanged(a)}};apds.SlideShow.prototype.nextFromActive=function(){if(this.activeIndex==null){return 0}return(this.activeIndex+1)%this.photos.length};apds.SlideShow.prototype.previousFromActive=function(){if(this.activeIndex==null){return 0}var a=(this.activeIndex-1)%this.photos.length;if(a<0){a+=this.photos.length}return a};apds.SlideShow.prototype.requestPhoto=function(d){if(this.activeIndex!=null&&this.activeIndex==d){return}var c=this.photos[d];var b=new Image();this.lastRequestedIndex=d;var e=d;var a=this;b.onload=function(){if(a.lastRequestedIndex!=e){return}a._setDescription(c);a._hidePreloader();a._setCntrImage(c);a.activeIndex=e;a.notify(a.activeIndex)};b.onerror=b.onabort=function(){a._hidePreloader()};this._showPreloader();b.src=c.src};apds.SlideShow.prototype.descAnimComplete=function(){this._pruneDescription();this.descAnim=null};apds.SlideShow.prototype._setDescription=function(b){var d=document.getElementById(this.descId);var a=document.createElement("DIV");a.className=this.descClass;a.innerHTML=b.desc;if(this.descAnim){this.descAnim.cancel();this.descAnim=null;while(d.firstChild){d.removeChild(d.firstChild)}d.appendChild(a);apds.util.setOpacity(a,this.descMaxOpacity)}else{var c=this._firstDescription();d.appendChild(a);this.descAnim=new apds.SlideShow.DescAnim();this.descAnim.addListener(this);this.descAnim.setMaxOpacity(this.descMaxOpacity);if(c){this.descAnim.crossFade(c,a)}else{this.descAnim.fadeIn(a)}}};apds.SlideShow.prototype._firstDescription=function(){var b=document.getElementById(this.descId);for(var a=0;a<b.childNodes.length;a++){var c=b.childNodes[a];if(c.nodeType==1&&c.className==this.descClass){return c}}return null};apds.SlideShow.prototype._pruneDescription=function(){var b=document.getElementById(this.descId);var d=[];for(var a=0;a<b.childNodes.length;a++){var c=b.childNodes[a];if(c.nodeType==1&&c.className==this.descClass){d.push(c)}}if(d.length>1){d[0].parentNode.removeChild(d[0])}};apds.SlideShow.prototype._showPreloader=function(){var a=document.getElementById(this.pldrId);a.style.visibility="visible"};apds.SlideShow.prototype._hidePreloader=function(){var a=document.getElementById(this.pldrId);a.style.visibility="hidden"};apds.SlideShow.prototype._setCntrImage=function(b){var f=document.getElementById(this.cntrId);var e=document.createElement("IMG");e.alt="";e.src=b.src;var a=f.getElementsByTagName("IMG");if(a.length==0){e.className="first";f.appendChild(e);this.animFirst=new apds.SlideShow.Anim(e);this.animFirst.fadeIn(e)}else{var c=a[0];f.insertBefore(e,c);e=a[0];e.src=b.src;var d=new apds.SlideShow.Anim(c);this.animFirst.cancel();d.slideOut()}};apds.SlideShow.DescAnim=function(){this.listeners=[]};apds.SlideShow.DescAnim.FRAME_RATE=42;apds.SlideShow.DescAnim.ANIM_TIME=500;apds.SlideShow.DescAnim.prototype.fadeIn=function(b){var a=this;this.tStart=apds.util.getTime();this.ival=window.setInterval(function(){a._fadeInAnimFrame(b)},this.constructor.FRAME_RATE)};apds.SlideShow.DescAnim.prototype.crossFade=function(b,c){var a=this;this.tStart=apds.util.getTime();this.ival=window.setInterval(function(){a._crossFadeAnimFrame(b,c)},this.constructor.FRAME_RATE)};apds.SlideShow.DescAnim.prototype._fadeInAnimFrame=function(b){var c=apds.util.getTime();var a=(c-this.tStart)/this.constructor.ANIM_TIME;if(a>=1||a<0){apds.util.setOpacity(b,this.maxOpacity);this.cancel();this.notify()}else{apds.util.setOpacity(b,this.maxOpacity*a)}};apds.SlideShow.DescAnim.prototype._crossFadeAnimFrame=function(c,d){var e=apds.util.getTime();var b=(e-this.tStart)/this.constructor.ANIM_TIME;if(b>=1||b<0){apds.util.setOpacity(d,this.maxOpacity);apds.util.setOpacity(c,0);this.cancel();this.notify()}else{var a=this.maxOpacity*b;apds.util.setOpacity(d,a);apds.util.setOpacity(c,this.maxOpacity-a)}};apds.SlideShow.DescAnim.prototype.cancel=function(){if(this.ival){window.clearInterval(this.ival);this.ival=null}};apds.SlideShow.DescAnim.prototype.addListener=function(a){this.listeners.push(a)};apds.SlideShow.DescAnim.prototype.setMaxOpacity=function(a){this.maxOpacity=a};apds.SlideShow.DescAnim.prototype.notify=function(){for(var a=0;a<this.listeners.length;a++){this.listeners[a].descAnimComplete()}};apds.SlideShow.Anim=function(a){this.imgEl=a};apds.SlideShow.Anim.FRAME_RATE=42;apds.SlideShow.Anim.ANIM_TIME=500;apds.SlideShow.Anim.MAX_X=200;apds.SlideShow.Anim.MAX_Y=500;apds.SlideShow.Anim.prototype.slideOut=function(){var a=this;this.tStart=apds.util.getTime();this.ival=window.setInterval(function(){a._slideOutAnimFrame()},this.constructor.FRAME_RATE)};apds.SlideShow.Anim.prototype.fadeIn=function(){var a=this;this.tStart=apds.util.getTime();this.ival=window.setInterval(function(){a._fadeInAnimFrame()},this.constructor.FRAME_RATE)};apds.SlideShow.Anim.prototype.cancel=function(){if(this.ival){window.clearInterval(this.ival);this.ival=null}};apds.SlideShow.Anim.prototype._slideOutAnimFrame=function(){var d=apds.util.getTime();var a=(d-this.tStart)/this.constructor.ANIM_TIME;if(a>=1||a<0){this.cancel();this.ival=null;this.imgEl.parentNode.removeChild(this.imgEl)}else{apds.util.setOpacity(this.imgEl,1-a);var c=Math.ceil(a*this.constructor.MAX_X);var b=-Math.ceil(a*this.constructor.MAX_Y);this.imgEl.style.left=c+"px";this.imgEl.style.top=b+"px"}};apds.SlideShow.Anim.prototype._fadeInAnimFrame=function(){var b=apds.util.getTime();var a=(b-this.tStart)/this.constructor.ANIM_TIME;if(a>=1||a<0){apds.util.setOpacity(this.imgEl,1);this.cancel()}else{apds.util.setOpacity(this.imgEl,a)}};apds.ThumbMan=function(){};apds.ThumbMan._onmouseover=function(a){var b=_targetOf(a,"A");apds.util.addClassAttr(b,"hovered")};apds.ThumbMan._onmouseout=function(a){var b=_targetOf(a,"A");apds.util.removeClassAttr(b,"hovered")};apds.ThumbMan._onfocus=function(a){var b=_targetOf(a,"A");apds.util.addClassAttr(b,"focused")};apds.ThumbMan._onblur=function(a){var b=_targetOf(a,"A");apds.util.removeClassAttr(b,"focused")};apds.ThumbMan.prototype.setContainerId=function(a){this.contId=a};apds.ThumbMan.prototype.setSlideShowObj=function(a){this.sshow=a};apds.ThumbMan.prototype.init=function(){this._removeDOM0ClickHandlers();this._addStateHandlers();this._addClickHandlers()};apds.ThumbMan.prototype.photoChanged=function(a){var c=this._getAnchors();for(var b=0;b<c.length;b++){apds.util.removeClassAttr(c[b],"selected")}apds.util.addClassAttr(c[a],"selected")};apds.ThumbMan.prototype._getAnchors=function(){var a=document.getElementById(this.contId);return a.getElementsByTagName("A")};apds.ThumbMan.prototype._removeDOM0ClickHandlers=function(){var b=this._getAnchors();for(var a=0;a<b.length;a++){b[a].href="#";b[a].onclick=null}};apds.ThumbMan.prototype._addStateHandlers=function(){var b=this._getAnchors();for(var a=0;a<b.length;a++){this._addStateHandlersForAnchor(b[a])}};apds.ThumbMan.prototype._addStateHandlersForAnchor=function(a){_addEventListener(a,"mouseover",this.constructor._onmouseover,false);_addEventListener(a,"mouseout",this.constructor._onmouseout,false);_addEventListener(a,"focus",this.constructor._onfocus,false);_addEventListener(a,"blur",this.constructor._onblur,false)};apds.ThumbMan.prototype._generateClickHandler=function(){var a=this;var b=function(f){var g=_targetOf(f,"A");var d=a._getAnchors();for(var c=0;c<d.length;c++){if(g==d[c]){break}}a.sshow.requestPhoto(c);_preventDefault(f)};return b};apds.ThumbMan.prototype._addClickHandlers=function(){var a=this._generateClickHandler();var c=this._getAnchors();for(var b=0;b<c.length;b++){this._addClickHandlerForAnchor(c[b],a)}};apds.ThumbMan.prototype._addClickHandlerForAnchor=function(b,a){_addEventListener(b,"click",a,false)};apds.LinkMan=function(){};apds.LinkMan.prototype.setContainerId=function(a){this.cntrId=a};apds.LinkMan.prototype.setSlideShowObj=function(a){this.sshow=a};apds.LinkMan.prototype.setPrevLinkId=function(a){this.prevId=a};apds.LinkMan.prototype.setNextLinkId=function(a){this.nextId=a};apds.LinkMan.prototype.init=function(){var c=document.getElementById(this.prevId);var b=document.getElementById(this.nextId);c.onclick=b.onclick=null;var d=this.sshow;var a=function(f){d.requestPhoto(d.previousFromActive());_preventDefault(f)};var e=function(f){d.requestPhoto(d.nextFromActive());_preventDefault(f)};_addEventListener(c,"click",a,false);_addEventListener(b,"click",e,false)};apds._TourPhotos=[new apds.SlideShow.PhotoData("images/show/slides/main_entrance.jpg","<h2>Main Entrance </h2><p>Located in College Park with an indoor connection to College subway station.  Neighbouring restaurants, services, and underground parking available.</p>"),new apds.SlideShow.PhotoData("images/show/slides/reception.jpg","<h2>Reception </h2><p>A greeting and business area provided to help manage your therapeutic needs.</p>"),new apds.SlideShow.PhotoData("images/show/slides/waiting_area.jpg","<h2>Waiting Area </h2><p>Comfortable seating and reading materials to help pass the wait &#8212; which is usually quick!</p>"),new apds.SlideShow.PhotoData("images/show/slides/treatment_area_front.jpg","<h2>Treatment Area (front) </h2><p>A large open work area surrounded by high quality exercise equipment and several treatment stations.</p>"),new apds.SlideShow.PhotoData("images/show/slides/treatment_area_back.jpg","<h2>Treatment Area (back) </h2><p>Additional exercise equipment and treatment stations for your benefit.</p>"),new apds.SlideShow.PhotoData("images/show/slides/examination_room_a.jpg","<h2>Examination Room A </h2><p>A private examination room to discuss your needs and administer care.</p>"),new apds.SlideShow.PhotoData("images/show/slides/examination_room_b.jpg","<h2>Examination Room B </h2><p>Another examination room to accomodate your health care needs.</p>"),new apds.SlideShow.PhotoData("images/show/slides/massage_room.jpg","<h2>Massage Room </h2><p>A private massage room to provide you with relaxation and relief from pain.</p>"),new apds.SlideShow.PhotoData("images/show/slides/change_room.jpg","<h2>Change Room </h2><p>Seperate men and woman&#39;s change rooms.  Each with a privacy lock, shower, and lockers.</p>")];apds._oldwinload=window.onload;window.onload=function(){if(apds._oldwinload){apds._oldwinload()}var a=document.getElementById("load_message");a.style.display="none";var d=document.getElementById("introtext");d.style.visibility="visible";var c=new apds.SlideShow();var e=new apds.ThumbMan();var b=new apds.LinkMan();c.setContainerId("picframe");c.setPreloaderId("ploader");c.setDescriptionIdandClass("picdesc_box","picdesc");c.setDescriptionMaxOpacity(0.7);c.setPhotoDataArray(apds._TourPhotos);c.addListener(e);e.setContainerId("thumbnails");e.setSlideShowObj(c);b.setContainerId("slideshow_links");b.setSlideShowObj(c);b.setPrevLinkId("ss_prev");b.setNextLinkId("ss_next");e.init();b.init()};
