var IWAllFeeds={};function IWCreateFeed(a){var b=IWAllFeeds[a];if(b==null){b=new IWFeed(a)}return b}var IWFeed=Class.create({initialize:function(a){if(a){if(IWAllFeeds.hasOwnProperty(a)){iWLog("warning -- use IWCreateFeed rather than new IWFeed and you'll get better performance")}this.mURL=a;this.mLoading=false;this.mLoaded=false;this.mCallbacks=[];this.mImageStream=null;IWAllFeeds[a]=this}},sourceURL:function(){return this.mURL},load:function(a,b){if(this.mLoaded&&(b!=null)){b(this.mImageStream)}else{if(b!=null){this.mCallbacks.push(b)}if(this.mLoading==false){this.mLoading=true;this.p_sendRequest(a)}}},p_sendRequest:function(b){var a=this.mURL.toRelativeURL(b);new Ajax.Request(a,{method:"get",onSuccess:this.p_onload.bind(this,b),onFailure:this.p_requestFailed.bind(this,b)})},p_requestFailed:function(b,a){iWLog("There was a problem ("+a.status+") retrieving the feed:\n\r"+a.statusText);if(a.status==500){iWLog("working around status 500 by trying again...");window.setTimeout(this.p_sendRequest.bind(this,b),100)}},p_onload:function(d,c){var b;var e=ajaxGetDocumentElement(c);var a=$A(e.getElementsByTagName("item"));this.mImageStream=this.p_interpretItems(d,a);this.p_postLoadCallbacks(this.mImageStream)},p_postLoadCallbacks:function(a){for(var b=0;b<this.mCallbacks.length;++b){this.mCallbacks[b](a)}this.mLoaded=true},p_applyEntryOrder:function(a,b){var c=[];var f=[];for(var e=0;e<a.length;e++){var g=a[e].guid();if(g){f[g]=e}}for(var e=0;e<b.length;e++){var d=f[b[e]];if(d!==undefined){c.push(a[d])}}(function(){return c.length==b.length}).assert();return c},p_firstElementByTagNameNS:function(b,c,a){var d=null;for(d=b.firstChild;d!=null;d=d.nextSibling){if(d.baseName==a||d.localName==a){if(c==null||c==""||d.namespaceURI==c){break}}}return d}});var IWStreamEntry=Class.create({initialize:function(d,c,b,a){if(arguments.length>0){if(d){this.mThumbnail=IWCreateImage(d)}if(c){this.mTitle=c.stringByEscapingXML().stringByConvertingNewlinesToBreakTags()}if(b){this.mRichTitle=b}if(a){this.mGUID=a}}},setThumbnailURL:function(a){this.mThumbnail=IWCreateImage(a)},loadThumbnail:function(a){this.thumbnail().load(a)},unloadThumbnail:function(){this.thumbnail().unload()},thumbnailNaturalSize:function(){return this.thumbnail().naturalSize()},thumbnail:function(){return this.mThumbnail},micro:function(){return this.thumbnail()},mipThumbnail:function(){return this.thumbnail()},title:function(){return this.mTitle},richTitle:function(){return this.mRichTitle?this.mRichTitle:this.mTitle},metric:function(){return null},guid:function(){return this.mGUID},isMovie:function(){return false},commentGUID:function(){return null},showCommentIndicator:function(){return true},badgeMarkupForRect:function(a){return IWStreamEntryBadgeMarkup(a,this.isMovie(),this.showCommentIndicator()?this.commentGUID():null)},thumbnailMarkupForRect:function(a){return imgMarkup(this.thumbnail().sourceURL(),a.position(),"",this.mTitle)+this.badgeMarkupForRect(a)},didInsertThumbnailMarkupIntoDocument:function(){}});function IWStreamEntryBadgeMarkup(h,b,a){var j=16;var k=16;var m=new IWRect(h.origin.x,h.maxY()-k,h.size.width,k);var l="";if(b){l+='<div style="background-color: black; '+m.position()+iWOpacity(0.75)+'"></div>'}var c=new IWSize(j,k);if(b){var g=IWImageNamed("movie overlay");var f=new IWRect(m.origin,c);l+=imgMarkup(g.sourceURL(),f.position(),'class="badge-overlay"')}var e=new IWPoint(m.maxX()-j,m.origin.y);if(a){var i=IWImageNamed("comment overlay");var d=new IWRect(e,c);l+=imgMarkup(i.sourceURL(),d.position()+"display: none; ",'class="badge-overlay" id="comment-badge-'+a+'"')}return l}var IWCommentableStreamEntry=Class.create(IWStreamEntry,{initialize:function($super,b,f,e,d,c,a){$super(e,d,c,a);this.mAssetURL=b;this.mShowCommentIndicator=f},commentGUID:function(){return this.guid()},showCommentIndicator:function(){return this.mShowCommentIndicator},didInsertThumbnailMarkupIntoDocument:function(){if(this.mAssetURL&&hostedOnDM()){IWCommentCountForURL(this.mAssetURL,this.p_commentCountCallback.bind(this))}else{this.p_commentCountCallback(0)}},commentAssetURL:function(){return this.mAssetURL},p_commentCountCallback:function(a){this.mCommentCount=a;if(this.mCommentCount>0){$("comment-badge-"+this.commentGUID()).show()}}});var IWImageStreamEntry=Class.create(IWCommentableStreamEntry,{initialize:function($super,h,a,b,f,d,i,g,c,e){$super(h,a,f,g,c,e);this.mImage=IWCreateImage(b);if(d){this.mMicro=IWCreateImage(d)}if(i){this.mMIPThumbnail=IWCreateImage(i)}},setImageURL:function(a){this.mImage=IWCreateImage(a)},image:function(){return this.mImage},micro:function(){return this.mMicro?this.mMicro:this.thumbnail()},mipThumbnail:function(){return this.mMIPThumbnail?this.mMIPThumbnail:this.thumbnail()},targetURL:function(){return this.mImage.sourceURL()},slideshowValue:function(b){var a=this[b]();return{image:a,caption:this.title()}}});var IWMovieStreamEntry=Class.create(IWCommentableStreamEntry,{initialize:function($super,g,a,h,e,f,c,b,d){$super(g,a,e,f,c,d);this.mMovieURL=h;this.mMovieParams=b},movieURL:function(){return this.mMovieURL},targetURL:function(){return this.movieURL()},isMovie:function(){return true},setMovieParams:function(a){this.mMovieParams=a},slideshowValue:function(a){return{image:this.thumbnail(),movieURL:this.movieURL(),caption:this.title(),params:this.mMovieParams}}});var IWMediaStreamPageEntry=Class.create(IWStreamEntry,{initialize:function($super,b,e,d,c,a){if(arguments.length>0){$super(e,d,c,a);this.mTargetPageURL=b}},thumbnailNaturalSize:function(){return new IWSize(4000,3000)},targetURL:function(){return this.mTargetPageURL},positionedThumbnailMarkupForRect:function(a){return IWMediaStreamPageEntryPositionedThumbnailMarkupForRect(this.mThumbnail,a)}});function IWMediaStreamPageEntryPositionedThumbnailMarkupForRect(g,b){var a=g.naturalSize();var f=Math.max(b.size.width/a.width,b.size.height/a.height);var c=a.scale(f,f,true);var d=new IWPoint((b.size.width-c.width)/2,(b.size.height-c.height)/2);d=d.scale(1,1,true);var e=new IWRect(d,c);return imgMarkup(g.sourceURL(),e.position())}var IWMediaStreamPhotoPageEntryPrefs={};var IWMediaStreamPhotoPageEntries={};function IWMediaStreamPhotoPageSetPrefs(a){IWMediaStreamPhotoPageEntryPrefs=a}var IWMediaStreamPhotoPageEntryUniqueId=0;var IWMediaStreamPhotoPageEntry=Class.create(IWMediaStreamPageEntry,{initialize:function($super,a,d,e,c,b){$super(d,null,e,null,b);this.mStreamScriptURL=a;this.mContentsFunction=c},loadThumbnail:function(c){this.mThumbnailCallback=c;this.mSlideshowId="gridEntry"+IWMediaStreamPhotoPageEntryUniqueId++;IWMediaStreamPhotoPageEntries[this.mSlideshowId]=this;var a=IWCreateLoadingArea();var b="iFrame_"+new Date().getTime()+IWMediaStreamPhotoPageEntryUniqueId;a.innerHTML="<iframe id="+b+' src="streamloader.html?scriptURL='+this.mStreamScriptURL+"&id="+this.mSlideshowId+'" style="position: absolute; visibility: hidden; "></iframe>'},streamDidLoad:function(a){this.mMedia=a;if(this.mMedia&&this.mMedia.length>0){this.mThumbnail=this.mMedia[0].mipThumbnail();this.mThumbnail.load(this.mThumbnailCallback)}else{this.mThumbnailCallback()}},metric:function(){var a=0;var c=0;if(this.mMedia){for(var b=0;b<this.mMedia.length;++b){if(this.mMedia[b].isMovie()){++c}else{++a}}}return this.mContentsFunction(a,c)},thumbnailMarkupForRect:function(b){var a="";if(this.mThumbnail){a='<div id="'+this.mSlideshowId+'" style="overflow: hidden; '+b.position()+'" onclick="window.location.href = \''+this.targetURL()+"'\">"+this.positionedThumbnailMarkupForRect(b)+'<div id="'+this.mSlideshowId+'-slideshow_placeholder" style="position: absolute; left: 0px; top: 0px; height: 100%; width: 100%; overflow: hidden; "></div></div>'}return a},didInsertThumbnailMarkupIntoDocument:function(){if(this.mThumbnail){if(isiPhone==false){var a=IWMediaStreamPhotoPageEntryPrefs;a.mediaStreamObject={load:function(c,b,d){d(c)}.bind(null,this.mMedia)};new SlideshowGlue(this.mSlideshowId,"../Scripts/Widgets/Slideshow","../Scripts/Widgets/SharedResources","..",a)}}}});function IWMediaStreamPhotoPageSetMediaStream(a,b){a.load(IWMediaStreamPhotoPageEntryPrefs.baseURL,function(d,c){IWMediaStreamPhotoPageEntries[d].streamDidLoad(c)}.bind(null,b))}var IWMediaStreamMediaPageEntryUniqueId=0;var IWMediaStreamMediaPageEntry=Class.create(IWMediaStreamPageEntry,{initialize:function($super,d,f,e,c,b,a){$super(d,f,e,null,a);this.mContents=c;this.mIsMovie=b},isMovie:function(){return this.mIsMovie},metric:function(){return this.mContents},thumbnailMarkupForRect:function(e){var b=new IWRect(new IWPoint(0,0),e.size);var f=this.positionedThumbnailMarkupForRect(e)+this.badgeMarkupForRect(b);var d="";var c="";if(this.isMovie()){this.mPlayButtonId="movieEntry"+IWMediaStreamMediaPageEntryUniqueId++;d='id="'+this.mPlayButtonId+'"';c='<div id="'+this.mPlayButtonId+'-play_button" class="play_button"><div></div></div>'}var a="<div "+d+' style="overflow: hidden; '+e.position()+'" onclick="window.location.href = \''+this.targetURL()+"'\">"+f+c+"</div>";return a},didInsertThumbnailMarkupIntoDocument:function(){if(this.isMovie()){if(isiPhone==false){new PlayButton(this.mPlayButtonId,"../Scripts/Widgets/PlayButton","../Scripts/Widgets/SharedResources","..",{})}}}});var gPhotoFormats=[];var gClipFormats=[];function IWCreateMediaCollection(c,b,a,e,d){var f=IWAllFeeds[c];if(f==null){if(gPhotoFormats.length==0){gPhotoFormats=e}if(gClipFormats.length==0){gClipFormats=d}f=new IWMediaCollection(c,b,a)}return f}var IWMediaCollection=Class.create(IWFeed,{initialize:function($super,c,b,a){$super(c);this.mSlideshowEnabled=b;this.mTransitionIndex=a},p_interpretItems:function(u,l){var g="http://www.apple.com/iweb";var a="urn:iphoto:property";var m=this.mURL.indexOf("?webdav-method=truthget")!=-1;if(m){g=a="urn:iweb:"}if(IWMediaStreamPhotoPageSetPrefs){IWMediaStreamPhotoPageSetPrefs({slideshowEnabled:this.mSlideshowEnabled,fadeIn:true,showOnMouseOver:true,photoDuration:2,startIndex:1,scaleMode:"fill",transitionIndex:this.mTransitionIndex,imageType:"mipThumbnail",movieMode:kPosterFrameOnly,baseURL:u})}var p=[];for(var r=0;r<l.length;++r){var w=l[r];var e=null;if(m){e=this.p_firstElementByTagNameNS(w,g,"link")}if(e==null){e=w.getElementsByTagName("link")[0]}if(e!=null){var j="";var x=w.getElementsByTagName("title")[0];if(x!=null){j=x.firstChild.nodeValue}var n=false;if(m){x=this.p_firstElementByTagNameNS(w,g,"title");if(x!=null){j=x.firstChild.nodeValue}else{n=true}}if(n==false){var k=e.firstChild.nodeValue.toRelativeURL(u);var c=null;var v=w.getElementsByTagName("useritemguid")[0];var o=null;if(v!=null){o=v.firstChild.nodeValue}var y=this.p_firstElementByTagNameNS(w,a,"thumbnail")||w.getElementsByTagName("thumbnail")[0];if(y){var b=transparentGifURL();if(y.firstChild&&y.firstChild.nodeValue){b=y.firstChild.nodeValue.toRelativeURL(u)}var h=null;var t=this.p_firstElementByTagNameNS(w,g,"contents");if(t){h=t.firstChild.nodeValue}var s=false;var f=this.p_firstElementByTagNameNS(w,g,"is-movie");if(f&&f.firstChild&&f.firstChild.nodeValue){s=(f.firstChild.nodeValue=="true")}c=new IWMediaStreamMediaPageEntry(k,b,j,h,s,o)}else{var d=k.lastPathComponent().stringByDeletingPathExtension();var q=k.stringByDeletingLastPathComponent().stringByAppendingPathComponent(d+"_files").stringByAppendingPathComponent(d+".js");c=new IWMediaStreamPhotoPageEntry(q,k,j,albumContentsFunction,o)}p.push(c)}}}return p}});function albumContentsFunction(a,b){var c="";photoFormat=gPhotoFormats[Math.min(a,2)];clipFormat=gClipFormats[Math.min(b,2)];photoFormat=photoFormat.replace(/%d/,a);clipFormat=clipFormat.replace(/%d/,b);if(clipFormat&&clipFormat.length>0&&a==0){c=clipFormat}else{c=photoFormat;if(clipFormat&&clipFormat.length>0){c+=", "+clipFormat}}return c}function IWCreatePhotocast(a,c){var b=IWAllFeeds[a];if(b==null){b=new IWPhotocast(a,c)}return b}var IWPhotocast=Class.create(IWFeed,{initialize:function($super,a,b){$super(a);this.mShowCommentIndicator=b},p_interpretItems:function(baseURL,items){var imageStream=[];for(var i=0;i<items.length;++i){var item=items[i];enclosure=item.getElementsByTagName("enclosure")[0];if(enclosure!=null){var titleText="";var title=item.getElementsByTagName("title")[0];if(title&&title.firstChild&&title.firstChild.nodeValue){titleText=title.firstChild.nodeValue}var iWebNamespace="http://www.apple.com/iweb";var thumbnailNamespace="urn:iphoto:property";var richTitleHTML;var richTitle=this.p_firstElementByTagNameNS(item,iWebNamespace,"richTitle");if(richTitle&&richTitle.firstChild&&richTitle.firstChild.nodeValue){richTitleHTML=richTitle.firstChild.nodeValue.stringByUnescapingXML()}var guidNode=item.getElementsByTagName("guid")[0];var guid=null;if(guidNode!=null){guid=guidNode.firstChild.nodeValue}var thumbnail=this.p_firstElementByTagNameNS(item,thumbnailNamespace,"thumbnail")||item.getElementsByTagName("thumbnail")[0];IWAssert(function(){return thumbnail!=null},"Could not get thumbnail from feed.  Server configuration may have changed.");if(thumbnail){var entry=null;var type=enclosure.getAttribute("type").split("/");var thumbnailURL=thumbnail.firstChild.nodeValue.toRebasedURL(baseURL);if(type[0]=="video"){var movieURL=enclosure.getAttribute("url").toRebasedURL(baseURL);var movieParams=null;var movieParamsElement=this.p_firstElementByTagNameNS(item,iWebNamespace,"movieParams");if(movieParamsElement&&movieParamsElement.firstChild&&movieParamsElement.firstChild.nodeValue){var movieParamsJSON=movieParamsElement.firstChild.nodeValue.stringByUnescapingXML();movieParams=eval("("+movieParamsJSON+")")}var assetURL=movieURL.stringByDeletingLastPathComponent();IWAssert(function(){return assetURL!=null},"could not determine asset URL for movie: "+movieURL);entry=new IWMovieStreamEntry(assetURL,this.mShowCommentIndicator,movieURL,thumbnailURL,titleText,richTitleHTML,movieParams,guid)}else{var imageURL=enclosure.getAttribute("url").toRebasedURL(baseURL);var assetURL=imageURL.urlStringByDeletingQueryAndFragment().stringByDeletingPathExtension();var microURL=null;var micro=this.p_firstElementByTagNameNS(item,iWebNamespace,"micro");if(micro&&micro.firstChild&&micro.firstChild.nodeValue){microURL=micro.firstChild.nodeValue.toRebasedURL(baseURL)}if(!microURL){microURL=(imageURL.urlStringByDeletingQueryAndFragment()+"?derivative=micro").toRebasedURL(baseURL)}var mipThumbnailURL=null;var mipThumbnail=this.p_firstElementByTagNameNS(item,iWebNamespace,"mip-thumbnail");if(mipThumbnail&&mipThumbnail.firstChild&&mipThumbnail.firstChild.nodeValue){mipThumbnailURL=mipThumbnail.firstChild.nodeValue.toRebasedURL(baseURL)}if(!mipThumbnailURL){mipThumbnailURL=(imageURL.urlStringByDeletingQueryAndFragment()+"?derivative=mip&alternate=thumb").toRebasedURL(baseURL)}IWAssert(function(){return assetURL!=null},"could not determine asset URL for image: "+imageURL);entry=new IWImageStreamEntry(assetURL,this.mShowCommentIndicator,imageURL,thumbnailURL,microURL,mipThumbnailURL,titleText,richTitleHTML,guid)}imageStream.push(entry)}}}return imageStream}});var kPhotoViewMovieControllerHeight=16;var kShowMovie=0;var kAutoplayMovie=1;var kPosterFrameOnly=2;function setFrameOptionallyMovingContents(b,e,c){var a=new IWPoint(b.offsetLeft,b.offsetTop);$(b).setStyle({left:px(e.origin.x),top:px(e.origin.y),width:px(e.size.width),height:px(e.size.height)});var d=new IWPoint(a.x-e.origin.x,a.y-e.origin.y);if(c){offsetChildren(b,d,false)}return d}function offsetChildren(b,f,a){for(var c=b.firstChild;c;c=c.nextSibling){var e=parseFloat(c.style.left||0);var d=parseFloat(c.style.top||0);$(c).setStyle({left:px(a?e-f.x:e+f.x),top:px(a?d-f.y:d+f.y)})}}var PhotoViewWaitingForDonePlaying=[];function PhotoViewDonePlaying(a){PhotoViewWaitingForDonePlaying[a]();return false}var PhotoView=Class.create({initialize:function(b,i,f,j,h,g,d){this.scaleMode="fit";this.reflectionHeight=0;this.reflectionOffset=0;this.backgroundColor="black";this.movieMode=kShowMovie;this.captionHeight=0;if(i){this.scaleMode=i}if(f){this.reflectionHeight=f;if(j){this.reflectionOffset=j}if(windowsInternetExplorer){this.reflection=document.createElement("img")}else{this.reflection=document.createElement("canvas")}}if(d){this.captionHeight=d;this.caption=document.createElement("div")}if(h){this.backgroundColor=h}if(g!==undefined){this.movieMode=g}var a=document.createElement("div");var c=document.createElement("canvas");if(c.getContext&&!isOpera){a.appendChild(c);this.canvas=c}else{var e=document.createElement("img");e.src=transparentGifURL();a.appendChild(e);this.img=e}if(this.reflection){a.appendChild(this.reflection)}if(this.caption){a.appendChild(this.caption)}b.appendChild(a);this.box=b;this.div=a;this.initStyle()},boxSize:function(){return{width:this.box.offsetWidth,height:this.box.offsetHeight}},initStyle:function(){var a=this.boxSize();$(this.div).setStyle({position:"absolute",width:px(a.width),height:px(a.height),backgroundColor:this.backgroundColor});if(this.canvas){$(this.canvas).setStyle({position:"absolute",left:0,top:0});$(this.canvas).setAttribute("width",a.width);$(this.canvas).setAttribute("height",a.height-Math.max(this.reflectionHeight+this.reflectionOffset,this.captionHeight));if(!windowsInternetExplorer){this.canvas.style.zIndex="inherit"}}else{if(this.img){this.img.style.position="absolute"}}if(this.reflection){this.reflection.style.position="absolute";if(!windowsInternetExplorer){this.reflection.setAttribute("width",a.width);this.reflection.setAttribute("height",this.reflectionHeight)}}if(this.caption){$(this.caption).setStyle({position:"absolute",top:px(a.height-this.captionHeight*0.6),left:0,width:px(a.width)});this.caption.className="caption"}this.resetSizeAndPosition()},setImage:function(a){if(this.photo!==a){if(this.photo){this.photo.image.allowUnloading();this.photo.image.unload()}if(a){a.image.preventUnloading()}}this.photo=a;this.image=a.image;this.movieURL=null;if(this.movieMode!=kPosterFrameOnly&&a.movieURL){this.movieURL=a.movieURL}if(this.caption){this.caption.innerHTML=a.caption||""}var f=this.boxSize();f.height-=Math.max(this.reflectionHeight+this.reflectionOffset,this.captionHeight);if(this.movieURL&&f.height>kPhotoViewMovieControllerHeight){f.height-=kPhotoViewMovieControllerHeight}var c=f.height/f.width;var i=this.image.naturalSize();var d=i.height/i.width;var m=f.width;var g=f.height;if((d>c&&this.scaleMode=="fit")||(d<c&&this.scaleMode=="fill")){var j=f.height/i.height;if(this.scaleMode=="fit"){j=Math.min(j,1)}m=Math.round(i.width*j);g=Math.round(i.height*j)}else{if((d<c&&this.scaleMode=="fit")||(d>c&&this.scaleMode=="fill")){var j=f.width/i.width;if(this.scaleMode=="fit"){j=Math.min(j,1)}m=Math.round(i.width*j);g=Math.round(i.height*j)}}var l=Math.floor((f.width-m)/2);var k=Math.floor((f.height-g)/2);if(this.canvas){if(this.scaleMode=="fit"){if(this.canvas.width!=m||this.canvas.height!=g){if(true){var e=this.canvas.cloneNode(false);e.setAttribute("width",m);e.setAttribute("height",g);this.canvas.parentNode.replaceChild(e,this.canvas);this.canvas=e}else{this.canvas.setAttribute("width",m);this.canvas.setAttribute("height",g)}$(this.canvas).setStyle({top:px(k),left:px(l)})}if(m>0&&g>0){var b=this.canvas.getContext("2d");b.clearRect(0,0,m,g);b.drawImage(this.image.imgObject(),0,0,m,g)}}else{if(m>0&&g>0){var b=this.canvas.getContext("2d");b.clearRect(0,0,this.canvas.width,this.canvas.height);b.drawImage(this.image.imgObject(),l,k,m,g)}}}else{if(this.img){$(this.img).src=this.image.sourceURL();$(this.img).setStyle({width:px(m),height:px(g),top:px(k),left:px(l)})}}this.updateReflection(l,k,m,g);if(windowsInternetExplorer){setTimeout(this.updateReflection.bind(this,l,k,m,g),0)}if(this.movieURL){this.movieRect=new IWRect(l,k,m,g);this.p_updateMovieRect()}},willAnimate:function(){if(this.caption&&this.caption.parentNode==this.div){this.div.removeChild(this.caption)}},didAnimate:function(){if(this.caption&&this.caption.parentNode!=this.div){this.div.appendChild(this.caption)}},transitionComplete:function(){if(this.movieURL&&this.movieMode!=kPosterFrameOnly){this.p_showMovie()}},updateReflection:function(j,g,k,d){if(this.reflection){var f=0.5;this.reflection.style.top=px(g+d+this.reflectionOffset);if(windowsInternetExplorer){this.reflection.src=this.image.sourceURL();$(this.reflection).setStyle({left:px(j),width:px(k),height:px(d)});this.reflection.style.filter="flipv progid:DXImageTransform.Microsoft.Alpha(opacity="+f*100+", style=1, finishOpacity=0, startx=0, starty=0, finishx=0, finishy="+this.reflectionHeight/d*100+")"}else{if(this.reflection.getContext){if(true){var a=this.reflection.cloneNode(false);a.setAttribute("width",k);this.reflection.parentNode.replaceChild(a,this.reflection);this.reflection=a}else{this.reflection.setAttribute("width",k)}this.reflection.style.left=px(j);if(k>0&&this.reflection.height>0){var c=this.reflection.getContext("2d");c.clearRect(0,0,k,this.reflection.height);c.save();c.translate(0,d-1);c.scale(1,-1);c.drawImage(this.image.imgObject(),0,0,k,d);c.restore();c.save();var i=c.createLinearGradient(0,0,0,this.reflectionHeight);i.addColorStop(1,this.backgroundColor);var b="rgba(0,0,0,"+f+")";var e=this.backgroundColor.toLowerCase().match(/#?([0-9a-f]{2})([0-9a-f]{2})([0-9a-f]{2})/);if(e&&e.length>=4){b="rgba("+parseInt(e[1],16)+", "+parseInt(e[2],16)+", "+parseInt(e[3],16)+", "+f+")"}i.addColorStop(0,b);c.fillStyle=i;if(navigator.appVersion.indexOf("WebKit")!=-1){c.rect(0,0,k,this.reflectionHeight*2);c.fill()}else{c.fillRect(0,0,k,this.reflectionHeight*2)}c.restore()}}}}},updateSize:function(){this.initStyle();if(this.photo){this.photo.image.load(this.setImage.bind(this,this.photo))}},setZIndex:function(a){this.div.style.zIndex=a},upper:function(){this.setZIndex(1)},lower:function(){this.setZIndex(0)},show:function(){this.div.style.visibility="visible"},hide:function(){this.p_destroyMovie();this.div.style.visibility="hidden"},upperShown:function(){this.upper();this.show()},upperHidden:function(){this.hide();this.upper()},lowerShown:function(){this.lower();this.show()},lowerHidden:function(){this.hide();this.lower()},setClipPx:function(d,b,a,c){this.div.style.clip="rect("+d+"px "+b+"px "+a+"px "+c+"px)"},setLeftPx:function(a){this.div.style.left=px(a)},setTopPx:function(a){this.div.style.top=px(a)},setClipToMax:function(){var a=this.boxSize();this.div.style.clip="rect(0px "+a.width+"px "+a.height+"px 0px)"},resetSizeAndPosition:function(){$(this.div).setStyle({left:0,top:0});this.setClipToMax()},setOpacity:function(a){IWSetDivOpacity(this.div,a)},p_appendParamToObject:function(a,b){var c=document.createElement("param");c.name=a;c.value=b;this.object.appendChild(c)},p_stopMovie:function(){var b=this.movieID?document[this.movieID]:null;if(b){var a=null;try{a=b.GetPluginStatus()}catch(c){a=null}if(a==null||a.startsWith("Error:")||a=="Waiting"||a=="Loading"){}else{if(a=="Playable"||a=="Complete"){if(b.GetRate()>0){b.Stop()}}}}},p_destroyMovie:function(){if(this.movieID){this.p_stopMovie();var a=document[this.movieID];if(a){a.style.display="none"}this.div.removeChild(this.object);delete this.object;delete this.movieIndex;delete this.movieID}},p_movieDidFinish:function(){NotificationCenter.postNotification(new IWNotification("PhotoViewMovieDidEnd",this,{}))},p_timeString:function(d){var f=Math.floor(d);var e=(d-f)*30;var b=Math.floor(f/60);var a=Math.floor(b/60);f-=b*60;b-=a*60;if(b<10){b="0"+b}if(f<10){f="0"+f}e=Math.round(e*10)/10;if(e<10){e="0"+e}var c=a+":"+b+":"+f+":"+e;return c},p_movieHeight:function(){var a=this.movieRect.size.height;if(this.photo.params.movieShowController){a+=kPhotoViewMovieControllerHeight}return a},p_updateMovieRect:function(){if(this.object){this.object.setAttribute("width",this.movieRect.size.width);this.object.setAttribute("height",this.p_movieHeight());$(this.object).setStyle({position:"absolute",left:px(this.movieRect.origin.x),top:px(this.movieRect.origin.y)})}},p_showMovie:function(){this.object=document.createElement("object");if(this.object){this.movieIndex=PhotoViewWaitingForDonePlaying.length;this.movieID="photoViewMovie"+this.movieIndex;this.object.id=this.movieID;if(!windowsInternetExplorer){this.object.type="video/quicktime";this.object.setAttribute("data",this.movieURL);this.object.style.zIndex="inherit"}this.p_updateMovieRect();var a=this.movieMode==kAutoplayMovie||this.photo.params.movieAutoPlay;this.p_appendParamToObject("controller",this.photo.params.movieShowController?"true":"false");this.p_appendParamToObject("autoplay",a?"true":"false");this.p_appendParamToObject("scale","tofit");this.p_appendParamToObject("volume","12800");this.p_appendParamToObject("loop",this.photo.params.movieLoop!="SFDMovieNoLoop"?"true":"false");this.p_appendParamToObject("starttime",this.p_timeString(this.photo.params.movieStartTime*this.photo.params.movieDuration));this.p_appendParamToObject("endtime",this.p_timeString(this.photo.params.movieEndTime*this.photo.params.movieDuration));this.p_appendParamToObject("src",this.movieURL);PhotoViewWaitingForDonePlaying[this.movieIndex]=this.p_movieDidFinish.bind(this);this.p_appendParamToObject("qtnext1","<javascript:PhotoViewDonePlaying("+this.movieIndex+");>");this.div.appendChild(this.object);if(windowsInternetExplorer){this.object.classid="clsid:02BF25D5-8C17-4B23-BC80-D3488ABDDC6B";this.object.codebase="http://www.apple.com/qtactivex/qtplugin.cab"}}},setMovieTime:function(b){if(this.object){var a=document[this.movieID];a.Stop();a.SetTime(b*a.GetDuration())}},p_updateMovieParams:function(){if(this.object){var a=document[this.movieID];if(a){var c=$H(this.photo.params);var b=this;c.each(function(d){if(d.key=="movieShowController"){if(a.GetControllerVisible()!=d.value){a.SetControllerVisible(d.value);b.object.setAttribute("height",b.p_movieHeight())}}else{if(d.key=="movieLoop"){a.SetIsLooping(d.value!="SFDMovieNoLoop")}else{if(d.key=="movieAutoPlay"){a.SetAutoPlay(d.value||this.movieMode==kAutoplayMovie)}else{if(d.key=="movieStartTime"){a.SetStartTime(d.value*a.GetDuration())}else{if(d.key=="movieEndTime"){a.SetEndTime(d.value*a.GetDuration())}}}}}})}}},setMovieParams:function(b){var a=this.photo;$H(b).each(function(c){a.params[c.key]=c.value});this.p_updateMovieParams()}});var SimpleAnimation=Class.create({initialize:function(a){this.duration=500;this.from=0;this.to=1;if(a!=null){this.oncomplete=a}},animationComplete:function(){delete this.animation;delete this.animator;this.post();if(this.oncomplete!=null){this.oncomplete()}},stop:function(){if(this.animation!=null){this.animator.stop();this.post();delete this.animation;delete this.animator}},start:function(){this.stop();this.pre();var b=this;var a=new AppleAnimator(this.duration,13);a.oncomplete=function(){b.animationComplete()};this.animator=a;this.framecount=0;var c=function(f,e,g,d){b.update(e);++b.framecount};this.animation=new AppleAnimation(this.from,this.to,c);a.addAnimation(this.animation);a.start()},pre:function(){},post:function(){},update:function(a){}});var TransitionEffect=Class.create({initialize:function(d,b,a,c){this.current=d;this.next=b;this.oncomplete=a;this.shouldTighten=c;this.effects=[{name:"Random",method:"random"},{name:"Jump",method:"jump"},{name:"Fade",method:"fade"},{name:"Wipe",directions:[{name:"Right",method:"wipeRight"},{name:"Left",method:"wipeLeft"},{name:"Down",method:"wipeDown"},{name:"Up",method:"wipeUp"},{name:"In",method:"wipeIn"},{name:"Out",method:"wipeOut"}]},{name:"Close",directions:[{name:"Horizontal",method:"wipeCloseHoriz"},{name:"Vertical",method:"wipeCloseVert"}]},{name:"Open",directions:[{name:"Horizontal",method:"wipeOpenHoriz"},{name:"Vertical",method:"wipeOpenVert"}]},{name:"Reveal",directions:[{name:"Right",method:"slideOffRight"},{name:"Left",method:"slideOffLeft"},{name:"Down",method:"slideOffDown"},{name:"Up",method:"slideOffUp"}]},{name:"Slide On",directions:[{name:"Right",method:"slideOnRight"},{name:"Left",method:"slideOnLeft"},{name:"Down",method:"slideOnDown"},{name:"Up",method:"slideOnUp"}]},{name:"Push",directions:[{name:"Right",method:"pushRight"},{name:"Left",method:"pushLeft"},{name:"Down",method:"pushDown"},{name:"Up",method:"pushUp"}]},{name:"Fade Through Black",method:"fadeThroughBlack"}]},doEffect:function(a){this[a]()},random:function(){var b=[2,6,8,9];var a=Math.floor(Math.random()*b.length);var c=b[a];var d=this.effects[c];var e=d.directions?d.directions[0].method:d.method;this.doEffect(e)},animationComplete:function(){delete this.animation;if(this.oncomplete!=null){this.oncomplete()}},jump:function(){this.stop();this.next.upperShown();this.current.lowerHidden();this.animationComplete()},tighten:function(i,e){if(this.shouldTighten&&(e||i)){var f=99999;var d=99999;var h=0;var a=0;function g(n){for(var m=n.firstChild;m;m=m.nextSibling){var k=m.offsetTop;var j=m.offsetLeft;d=Math.min(d,j);f=Math.min(f,k);h=Math.max(h,j+m.offsetWidth);a=Math.max(a,k+m.offsetHeight)}}g(this.current.div);g(this.next.div);if(e==false||i==false){var c=this.current.boxSize();if(e==false){f=0;a=c.height}if(i==false){d=0;h=c.width}}var b=new IWRect(d,f,h-d,a-f);this.current.originalFrame=new IWRect(this.current.div.offsetLeft,this.current.div.offsetTop,this.current.div.offsetWidth,this.current.div.offsetHeight);this.next.originalFrame=new IWRect(this.next.div.offsetLeft,this.next.div.offsetTop,this.next.div.offsetWidth,this.next.div.offsetHeight);this.current.offset=setFrameOptionallyMovingContents(this.current.div,b,true);this.next.offset=setFrameOptionallyMovingContents(this.next.div,b,true)}},loosen:function(a,b){if(this.shouldTighten&&(a||b)){setFrameOptionallyMovingContents(this.current.div,this.current.originalFrame,false);setFrameOptionallyMovingContents(this.next.div,this.next.originalFrame,false);offsetChildren(this.current.div,this.current.offset,true);offsetChildren(this.next.div,this.next.offset,true)}},fade:function(){this.stop();var a=this;this.animation=new SimpleAnimation(function(){a.animationComplete()});this.animation.pre=function(){a.tighten(true,true);a.current.upperShown();a.next.lowerShown();a.current.setOpacity(1);a.next.setOpacity(1)};this.animation.post=function(){a.loosen(true,true);a.next.upperShown();a.next.setOpacity(1);a.current.lowerHidden();a.current.setOpacity(1)};this.animation.update=function(b){a.current.setOpacity(1-b)};this.animation.start()},fadeThroughBlack:function(){this.stop();var a=this;this.animation=new SimpleAnimation(function(){a.animationComplete()});this.animation.pre=function(){a.tighten(true,true);a.current.upperShown();a.next.lowerShown();a.current.setOpacity(1);a.next.setOpacity(0)};this.animation.post=function(){a.loosen(true,true);a.next.upperShown();a.next.setOpacity(1);a.current.lowerHidden();a.current.setOpacity(1)};this.animation.update=function(b){if(b<0.5){a.current.setOpacity((0.5-b)*2)}else{a.current.lowerHidden();a.next.setOpacity((b-0.5)*2)}};this.animation.start()},doWipe:function(d,c,a,e){this.stop();var b=this;this.animation=new SimpleAnimation(function(){b.animationComplete()});this.animation.pre=function(){b.current.resetSizeAndPosition();b.width=parseInt(b.current.div.style.width);b.height=parseInt(b.current.div.style.height);b.tighten(a,e);if(c){d.call(b,b.animation.from);b.next.upperShown();b.current.lowerShown()}else{b.current.upperShown();b.next.lowerShown()}};this.animation.post=function(){b.loosen(a,e);b.next.upperShown();b.next.resetSizeAndPosition();b.current.lowerHidden();b.current.resetSizeAndPosition()};this.animation.update=function(f){d.call(b,f)};this.animation.start()},wipeRight:function(){this.doWipe(function(a){this.current.setClipPx(0,this.width,this.height,a*this.width)})},wipeLeft:function(){this.doWipe(function(a){this.current.setClipPx(0,this.width-a*this.width,this.height,0)})},wipeDown:function(){this.doWipe(function(a){this.current.setClipPx(a*this.height,this.width,this.height,0)})},wipeUp:function(){this.doWipe(function(a){this.current.setClipPx(0,this.width,this.height-a*this.height,0)})},wipeIn:function(){this.doWipe(function(b){var a=this.width*(1-b)/2;var c=this.height*(1-b)/2;this.next.setClipPx(c,this.width-a,this.height-c,a)},true)},wipeOut:function(){this.doWipe(function(b){var a=this.width*b/2;var c=this.height*b/2;this.current.setClipPx(c,this.width-a,this.height-c,a)})},wipeCloseHoriz:function(){this.doWipe(function(b){var a=this.width*b/2;this.current.setClipPx(0,this.width-a,this.height,a)})},wipeCloseVert:function(){this.doWipe(function(a){var b=this.height*a/2;this.current.setClipPx(b,this.width,this.height-b,0)})},wipeOpenHoriz:function(){this.doWipe(function(b){var a=this.width*(1-b)/2;this.next.setClipPx(0,this.width-a,this.height,a)},true)},wipeOpenVert:function(){this.doWipe(function(a){var b=this.height*(1-a)/2;this.next.setClipPx(b,this.width,this.height-b,0)},true)},slideOffRight:function(){this.doWipe(function(b){var a=b*this.width;this.current.setLeftPx(a+(this.width-parseInt(this.current.div.style.width))/2)},false,true,true)},slideOffLeft:function(){this.doWipe(function(b){var a=b*this.width;this.current.setClipPx(0,this.width,this.height,a);this.current.setLeftPx(-a)})},slideOffDown:function(){this.doWipe(function(a){var b=a*this.height;this.current.setClipPx(0,this.width,this.height-b,0);this.current.setTopPx(b)})},slideOffUp:function(){this.doWipe(function(a){var b=a*this.width;this.current.setClipPx(b,this.width,this.height,0);this.current.setTopPx(-b)})},slideOnRight:function(){this.doWipe(function(b){var a=(1-b)*this.width;this.next.setClipPx(0,this.width,this.height,a);this.next.setLeftPx(-a)},true)},slideOnLeft:function(){this.doWipe(function(b){var a=b*this.width;this.next.setClipPx(0,a,this.height,0);this.next.setLeftPx(this.width-a)},true)},slideOnDown:function(){this.doWipe(function(a){var b=(1-a)*this.height;this.next.setClipPx(b,this.width,this.height,0);this.next.setTopPx(-b)},true)},slideOnUp:function(){this.doWipe(function(a){var b=a*this.height;this.next.setClipPx(0,this.width,b,0);this.next.setTopPx(this.height-b)},true)},pushRight:function(){this.doWipe(function(b){var a=b*this.width;this.current.setLeftPx(a+(this.width-parseInt(this.current.div.style.width))/2);this.next.setLeftPx(a-this.width+(this.width-parseInt(this.current.div.style.width))/2)},false,true,true)},pushLeft:function(){this.doWipe(function(b){var a=b*this.width;this.current.setClipPx(0,this.width,this.height,a);this.current.setLeftPx(-a);this.next.setClipPx(0,a,this.height,0);this.next.setLeftPx(this.width-a)})},pushDown:function(){this.doWipe(function(a){var b=a*this.height;this.current.setClipPx(0,this.width,this.height-b,0);this.current.setTopPx(b);this.next.setClipPx(this.height-b,this.width,this.height,0);this.next.setTopPx(b-this.height)})},pushUp:function(){this.doWipe(function(a){var b=a*this.height;this.current.setClipPx(b,this.width,this.height,0);this.current.setTopPx(-b);this.next.setClipPx(0,this.width,b,0);this.next.setTopPx(this.height-b)})},stop:function(){if(this.animation!=null){this.animation.stop();delete this.animation}}});var Slideshow=Class.create({initialize:function(a,d,c,b){this.reflectionHeight=0;this.reflectionOffset=0;this.backgroundColor="black";this.scaleMode="fit";this.movieMode=kShowMovie;this.advanceAnchor=null;this.captionHeight=0;this.shouldTighten=true;if(b){if(b.reflectionHeight){this.reflectionHeight=parseFloat(b.reflectionHeight)}if(b.reflectionOffset){this.reflectionOffset=parseFloat(b.reflectionOffset)}if(b.backgroundColor){this.backgroundColor=b.backgroundColor}if(b.scaleMode){this.scaleMode=b.scaleMode}if(b.movieMode!==undefined){this.movieMode=b.movieMode}if(b.advanceAnchor!==undefined){this.advanceAnchor=b.advanceAnchor}if(b.captionHeight!==undefined){this.captionHeight=b.captionHeight}if(b.shouldTighten!==undefined){this.shouldTighten=b.shouldTighten}}this.background=new PhotoView(a,this.scaleMode,0,0,this.backgroundColor,false,false,0);this.current={view:new PhotoView(a,this.scaleMode,this.reflectionHeight,this.reflectionOffset,this.backgroundColor,this.movieMode,this.captionHeight)};this.prev={view:new PhotoView(a,this.scaleMode,this.reflectionHeight,this.reflectionOffset,this.backgroundColor,this.movieMode,this.captionHeight)};this.next={view:new PhotoView(a,this.scaleMode,this.reflectionHeight,this.reflectionOffset,this.backgroundColor,this.movieMode,this.captionHeight)};this.current.view.upperShown();this.prev.view.lowerHidden();this.next.view.lowerHidden();this.photos=d;this.onchange=c;this.paused=true;this.photoDuration=5000;this.currentPhotoNumber=0;this.selectedTransition="random";this.lastPhotoChange=new Date()},updateSize:function(){this.background.updateSize();this.current.view.updateSize();this.prev.view.updateSize();this.next.view.updateSize();this.p_updateAnchorSize()},transitionComplete:function(a){this.transition.current.didAnimate();this.transition.next.didAnimate();this.transition.next.transitionComplete();delete this.transition;if(this.onchange!=null){this.onchange(a)}},showPhotoNumber:function(b,a){this.p_showPhotoNumber(b,a,true)},p_updateAnchorSize:function(){if(this.advanceAnchor){var b=this.current.view.boxSize();$(this.advanceAnchor).setStyle({position:"absolute",width:px(b.width),height:px(b.height)});if(windowsInternetExplorer){var a=this.advanceAnchor.firstChild;if(!a){a=document.createElement("img");this.advanceAnchor.appendChild(a)}a.src=transparentGifURL();a.style.width=this.advanceAnchor.style.width;a.style.height=this.advanceAnchor.style.height}}},p_setAdvanceAnchorHandler:function(){if(this.advanceAnchor){if(this.current.photo&&this.current.photo.movieURL){this.advanceAnchor.style.display="none";this.advanceAnchor.href="";this.advanceAnchor.onclick=function(){return false}}else{this.advanceAnchor.style.display="";this.advanceAnchor.href="#"+this.nextPhotoNumber();this.advanceAnchor.onclick=function(a){setTimeout(this.showPhotoNumber.bind(this,a,true),0)}.bind(this,this.nextPhotoNumber())}}},p_showPhotoNumber:function(g,c,d){this.cancelNextPhotoTimer();if(this.transition!=null){this.transition.stop();delete this.transition}var a=500;var h=this.current;var f=this.prev;var e=this.next;if(e.photo==undefined||e.photo!==this.photos[g]){if(f.photo!=undefined&&f.photo===this.photos[g]){e=f}else{if(d){e.photo=this.photos[g]}else{return}}}if(e.photo.image.loaded()==false){e.photo.image.load(arguments.callee.bind(this,g,c,false));return}if(e.view.image==undefined||e.view.image!==e.photo.image){e.view.setImage(e.photo)}var b=this;h.view.willAnimate();e.view.willAnimate();this.transition=new TransitionEffect(h.view,e.view,function(){b.transitionComplete(g)},this.shouldTighten);if(c||(new Date()).getTime()-this.lastPhotoChange.getTime()<a){this.transition.jump()}else{this.transition.doEffect(this.selectedTransition)}this.currentPhotoNumber=g;this.lastPhotoChange=new Date();this.current=e;this.p_setAdvanceAnchorHandler();if(e===f){this.prev=this.next;this.next=h;this.prev.photo=this.photos[this.prevPhotoNumber()];this.prev.photo.image.load(this.prev.view.setImage.bind(this.prev.view,this.prev.photo))}else{this.prev=h;this.next=f;this.next.photo=this.photos[this.nextPhotoNumber()];this.next.photo.image.load(this.next.view.setImage.bind(this.next.view,this.next.photo))}this.startNextPhotoTimer()},start:function(){this.paused=false;this.showPhotoNumber(0)},pause:function(){if(!this.paused){this.paused=true;this.cancelNextPhotoTimer()}},resume:function(){if(this.paused){this.paused=false;this.startNextPhotoTimer()}},inactivate:function(){this.pause();this.current.view.p_stopMovie()},startNextPhotoTimer:function(c){if(this.paused){return}if(this.nextPhotoTimer!=null){(function(){return false}).assert("trying to set overlapping timer");return}var b=this;var a=function(){delete b.nextPhotoTimer;var d=true;if(this.current.view.movieURL!=null){var g=document[this.current.view.movieID];var i=null;try{i=g.GetPluginStatus()}catch(j){i=null}if(i==null||i.startsWith("Error:")){}else{var f=g.GetTime();var h=g.GetDuration();var k=g.GetTimeScale();var l=h-f;var m=l/k*1000;if(i=="Waiting"||i=="Loading"){d=false;this.startNextPhotoTimer(m)}else{if(i=="Playable"||i=="Complete"){if(m>0){d=false;this.startNextPhotoTimer(m)}}}}}if(d){b.advance()}}.bind(this);this.nextPhotoTimer=setTimeout(a,c||this.photoDuration)},cancelNextPhotoTimer:function(){if(this.nextPhotoTimer!=null){clearTimeout(this.nextPhotoTimer);delete this.nextPhotoTimer}},halt:function(){this.cancelNextPhotoTimer()},unhalt:function(){this.startNextPhotoTimer()},nextPhotoNumber:function(){var a=this.currentPhotoNumber+1;if(a>=this.photos.length){a=0}return a},prevPhotoNumber:function(){var a=this.currentPhotoNumber-1;if(a<0){a=this.photos.length-1}return a},advance:function(){this.showPhotoNumber(this.nextPhotoNumber())},goBack:function(){this.showPhotoNumber(this.prevPhotoNumber())},setMovieTime:function(a){this.current.view.setMovieTime(a)},setMovieParams:function(a){this.current.view.setMovieParams(a)},setImage:function(b){var a=this.current;a.photo.image=b;a.photo.image.load(a.view.setImage.bind(a.view,a.photo))},getAvailableTransitions:function(){var a=new TransitionEffect;return a.effects},setTransitionIndex:function(d,e){var c=this.getAvailableTransitions();var b=c[d];if(b!=null){if(b.directions==null){if(b.method!=null){this.selectedTransition=b.method}}else{var a=b.directions[e];if(a!=null&&a.method!=null){this.selectedTransition=a.method}}}}});var IWHorizontalAlignment={kImageAlignLeft:0,kImageAlignCenter:1,kImageAlignRight:2};var IWVerticalAlignment={kImageAlignTop:0,kImageAlignMiddle:1,kImageAlignBottom:2};var IWPhotoGridLayoutConstants={kBorderThickness:6,vTextOffsetFromImage:5,vTextOffsetFromBottom:10,vTopSpacing:5,hMinSpacing:15};var latestImageStream=null;var latestIndex=null;function IWStartSlideshow(c,g,f,h){var d=800;var a=800;if(h){d=screen.availWidth;a=screen.availHeight}else{if(screen.availHeight>975){d=1000;a=950}else{if(screen.availHeight>775){d=800;a=750}else{d=711;a=533}}}d=Math.min(screen.availWidth,d);a=Math.min(screen.availHeight,a);var b=Math.round((screen.availWidth-d)/2);var i=Math.round((screen.availHeight-a)/2)-25;i=Math.max(i,0);var e=window.open(c,"slideshow","scrollbars=no,titlebar=no,location=no,status=no,toolbar=no,resizable=no,width="+d+",height="+a+",top="+i+",left="+b);if(e.screenY&&e.screenY>i){e.screenY=i}latestImageStream=g;latestIndex=f;e.focus();return false}function IWUpdateVerticalAlignment(d){d=$(d);function a(h,g){var i=$(document.createElement("table"));i.setStyle({width:"100%",height:"100%",borderSpacing:0});var j=document.createElement("tr");i.appendChild(j);var k=document.createElement("td");k.setAttribute("valign",g);j.appendChild(k);h.className=h.className.replace(new RegExp("\\bvalign-"+g+"\\b"),"");h.parentNode.replaceChild(i,h);k.appendChild(h);if(windowsInternetExplorer){var f=i.parentElement.innerHTML;i.parentElement.innerHTML=f}}var e=d.select(".valign-middle");for(var c=0;c<e.length;++c){a(e[c],"middle")}var b=d.select(".valign-bottom");for(var c=0;c<b.length;++c){a(b[c],"bottom")}}function IWShowDiv(b,a){b.style.display=a?"inline":"none"}function IWToggleDetailView(j,i,d,k,b,o,n){var a=$(d);var g=$(k);var m=$(b);var h=$(o);var l=!j;function e(){IWShowDiv(a,l);IWShowDiv(g,l);IWShowDiv(m,l);IWShowDiv(h,j)}if(j){var c=widgets[o];function f(){e();c.willShow(i);IWSetSpacerHeight(a,c.height());window.scrollTo(0,0)}if(i!==undefined){c.showPhotoNumber(i,f)}else{f()}}else{e();if(isSafari&&!isEarlyWebKitVersion&&n){$(d).select(".framedImage").each(function(p){var q=n.applyToElement.bind(n,p);IWJobQueue.sharedJobQueue.addJob(q)})}if(a.style.height){IWSetSpacerHeight(a,parseFloat(a.style.height))}}}function IWSetSpacerHeight(e,b){var d=$(e.parentNode);var a=d.select(".spacer");var c=a[a.length-1];if(initialSpacerHeight==0){initialSpacerHeight=parseInt(c.style.height)}var f=Math.max(parseInt(e.style.top)+b-c.offsetTop,initialSpacerHeight);c.style.height=c.style.lineHeight=px(f)}function IWLayoutPhotoGrid(b,E,n,a,w,l,k,g,C,B,z,j,f,m){if(w.length()==0){return}IWJobQueue.sharedJobQueue.clearJobs();function h(H){var i=H.userInfo();IWToggleDetailView(i.showDetailView,i.index,b,z,f,j,l)}var D=undefined;var e=location.hash;if(e.length>1){if(e.match(/^\#(\d+)$/)){var x=RegExp.$1;if(x<a.length){D=parseInt(x)}}}if(isiPhone){B=B.stringByDeletingLastPathComponent().stringByAppendingPathComponent("phoneshow.html")}B=B.stringByAppendingAsQueryString(C);if(j!=null){var F=widgets[j];if(!F.preferenceForKey("mediaStreamObject")){if(D!==undefined){F.setPreferenceForKey(D,"startIndex")}var r={load:function(i,H){H(a)}};F.setPreferenceForKey(r,"mediaStreamObject");NotificationCenter.addObserver(null,h,DetailViewToggleNotification,b);if(C){F.setPlaySlideshowFunction(IWStartSlideshow.bind(null,B,a,0,C.fullScreen))}}}var q=$(b);q.innerHTML="";for(var A=0;A<w.length();++A){var v=$(document.createElement("div"));var o=E.translationForTileAtIndex(A);var y=E.tileSize();v.style.cssText=iWPosition(true,o.x,o.y,y.width,y.height);v.hide();q.appendChild(v)}var p=E.mTextBoxSize;var u=function(ar,ak){var ag=a[ak];var aa=q.childNodes[ar];var ab=E.translationForTextAtIndexWithOffset(ar,null);var I="";if(p.height>0){var L=ag.richTitle();if(L==null){L=ag.title()}var W="";if(k){W=" "+k}var am=ag.metric();if(am!=null&&am.length>0){am='<span class="metric">'+am+"</span>"}else{am=""}var T=m?m.showTitle:true;var Y=m?m.showMetric:true;var af='<div class="caption'+W+'">'+(T?('<span class="title">'+L+"</span>"):"")+((T&&Y)?"<br />":"")+(Y?am:"")+"</div>";var Z="";if(g<0.999){Z=windowsInternetExplorer?" filter: progid:DXImageTransform.Microsoft.Alpha(opacity="+g*100+"); ":" opacity: "+g+"; "}var V="overflow: hidden; ";I='<div style="'+iWPosition(true,ab.x,ab.y,p.width,p.height)+Z+V+'">'+af+"</div>"}var X=ag.thumbnailNaturalSize();var ai=E.p_scaleForImageOfSize(X);var J=X.scale(ai,ai,true);if(Math.abs(J.width-X.width)<=2&&Math.abs(J.height-X.height)<=2){J=X}var ae=n.markupForImageStreamEntry(ag,J);aa.insert(ae);aa.insert(I);if(I.length>0){var S=aa.lastChild;S.style.zIndex=1}IWUpdateVerticalAlignment(aa);var aj=$(aa).selectFirst(".framedImage");var U=E.translationForImageOfSizeAtIndexWithOffset(new IWSize(parseFloat(aj.style.width||0),parseFloat(aj.style.height||0)),ar,null);aj.setStyle({left:px(U.x),top:px(U.y),zIndex:1});if(j){var N=$(document.createElement("a"));N.setStyle({position:"absolute",left:aj.style.left,top:aj.style.top,width:aj.style.width,height:aj.style.height,zIndex:1});N.href="#"+ak;N.onclick=IWToggleDetailView.bind(null,true,ak,b,z,f,j,l);if(windowsInternetExplorer&&(effectiveBrowserVersion>=7)){var R=document.createElement("img");R.src=transparentGifURL();R.style.width=aj.style.width;R.style.height=aj.style.height;N.appendChild(R)}aj.parentNode.insertBefore(N,aj.nextSibling)}IWSetDivOpacity(aj,g);aa.show();if(l){if(windowsInternetExplorer){var al=aj.select("img");var O=0,Q=0;var ao=parseFloat(aj.style.width||0);var H=parseFloat(aj.style.height||0);for(var at=0;at<al.length;++at){var ap=al[at].style;var aq=parseFloat(ap.left||0);var an=parseFloat(ap.top||0);O=Math.min(aq,O);Q=Math.min(an,Q);ao=Math.max(aq+parseFloat(ap.width||0),ao);H=Math.max(an+parseFloat(ap.height||0),H)}aj.setStyle({left:px(parseFloat(aj.style.left||0)+O),top:px(parseFloat(aj.style.top||0)+Q),width:px(ao-O),height:px(H-Q)});var ah=aj.childNodes;for(var au=0;au<ah.length;++au){var P=ah[au];if(P.nodeType==Node.ELEMENT_NODE){P.style.left=px(parseFloat(P.style.left||0)-O);P.style.top=px(parseFloat(P.style.top||0)-Q)}}var K=l.mBlurRadius*0.75;var ac=l.mOffset.x-K;var ad=l.mOffset.y-K;var M=aj.cloneNodeExcludingIDs(true);M.style.left=px(U.x+ac);M.style.top=px(U.y+ad);M.style.filter="progid:DXImageTransform.Microsoft.MaskFilter() progid:DXImageTransform.Microsoft.MaskFilter(color="+l.mColor+") progid:DXImageTransform.Microsoft.Blur(pixelradius="+K+") progid:DXImageTransform.Microsoft.Alpha(opacity="+l.mOpacity*g*100+")";aj.parentNode.insertBefore(M,aj)}else{if(!isEarlyWebKitVersion){l.applyToElement(aj)}}}ag.didInsertThumbnailMarkupIntoDocument();ag.unloadThumbnail()};for(var A=0;A<w.length();++A){var G=w.location()+A;var d=u.bind(null,A,G);a[G].loadThumbnail(IWJobQueue.prototype.addJob.bind(IWJobQueue.sharedJobQueue,d))}var c=widgets[z];if(c){if(C){c.setPlaySlideshowFunction(IWStartSlideshow.bind(null,B,a,0,C.fullScreen))}c.setPreferenceForKey(a.length,"entryCount")}function t(i){var I=$(f);var H=q.offsetTop+i-E.mBottomPadding;I.style.top=px(H)}var s=E.totalHeightForCount(w.length());t(s);IWSetSpacerHeight(q,s);q.style.height=px(s);if(D!==undefined){IWToggleDetailView(true,D,b,z,f,j,l)}}var initialSpacerHeight=0;var IWPhotoGridLayout=Class.create({initialize:function(g,e,f,d,c,b,h,a){this.mColumnCount=g;this.mMaxImageSize=e;this.mTextBoxSize=f;this.mTileSize=d;this.mTopPadding=c;this.mBottomPadding=b;this.mSpacing=h;this.mFramePadding=a;this.mCachedDataValid=true},tileSize:function(){return this.mTileSize},translationForTileAtIndex:function(a){var b=this.mTileSize;var c=this.mColumnCount;var d=new IWPoint(b.width*(a%c)+IWPhotoGridLayoutConstants.kBorderThickness,b.height*Math.floor(a/c)+IWPhotoGridLayoutConstants.kBorderThickness+this.mTopPadding+IWPhotoGridLayoutConstants.vTopSpacing);return d},translationForImageOfSizeAtIndexWithOffset:function(c,a,e){var b=this.mTileSize;var f=new IWPoint(0,0);var d=new IWSize(b.width,b.height-(IWPhotoGridLayoutConstants.vTextOffsetFromImage+this.mTextBoxSize.height+IWPhotoGridLayoutConstants.vTextOffsetFromBottom));f.x+=(d.width-c.width)/2;f.y+=(d.height-c.height);if(e!=null){f.x+=e.translation.width;f.y+=e.translation.height}return f},translationForTextAtIndexWithOffset:function(a,d){var b=this.mTileSize;var c=this.mTextBoxSize;var e=new IWPoint((b.width-c.width)/2,(b.height-c.height)-IWPhotoGridLayoutConstants.vTextOffsetFromBottom);if(d!=null){e.x+=d.translation.width;e.y+=d.translation.height}return e},totalHeightForCount:function(b){if(b==0){b=1}var d=this.mColumnCount;var a=Math.floor((b+d-1)/d);var c=this.mTileSize;return c.height*a+IWPhotoGridLayoutConstants.kBorderThickness*2+this.mTopPadding+this.mBottomPadding},p_scaleForImageOfSize:function(b){var a=this.mMaxImageSize;return Math.min((a.width-this.mFramePadding.width)/b.width,(a.height-this.mFramePadding.height)/b.height)}});var IWJobQueue=Class.create({initialize:function(){this.mJobQueue=[];this.mTimeout=null},addJob:function(a){this.mJobQueue.push(a);this.p_setTimeout()},clearJobs:function(a){this.p_cancelTimeout();this.mJobQueue=[]},p_runQueuedJobs:function(){this.p_cancelTimeout();var a=new Date().getTime();var c=0;while(this.mJobQueue.length>0&&c<100){var b=this.mJobQueue.shift();if(b){b()}c=(new Date().getTime())-a}if(this.mJobQueue.length>0){this.p_setTimeout()}},p_cancelTimeout:function(){if(this.mTimeout!=null){clearTimeout(this.mTimeout);this.mTimeout=null}},p_setTimeout:function(){if(this.mTimeout==null){this.mTimeout=setTimeout(this.p_runQueuedJobs.bind(this),0)}}});IWJobQueue.sharedJobQueue=new IWJobQueue();var AppleAnimator=Class.create({initialize:function(e,c,f,d,b){this.startTime=0;this.duration=e;this.interval=c;this.animations=new Array;this.timer=null;this.oncomplete=null;this._firstTime=true;var a=this;this.animate=function(q){function r(s,i,t){return s<i?i:(s>t?t:s)}var k,h;var j;var h=(new Date).getTime();var g=q.duration;var l;k=r(h-q.startTime,0,g);h=k/g;j=0.5-(0.5*Math.cos(Math.PI*h));l=k>=g;var o=q.animations;var p=o.length;var n=q._firstTime;for(var m=0;m<p;++m){o[m].doFrame(q,j,n,l,h)}if(l){q.stop();if(q.oncomplete!=null){q.oncomplete()}}q._firstTime=false};if(f!==undefined&&d!==undefined&&b!==undefined){this.addAnimation(new AppleAnimation(f,d,b))}},start:function(){if(this.timer==null){var b=(new Date).getTime();var a=this.interval;this.startTime=b-a;this.timer=setInterval(this.animate.bind(null,this),a)}},stop:function(){if(this.timer!=null){clearInterval(this.timer);this.timer=null}},addAnimation:function(a){this.animations[this.animations.length]=a}});var AppleAnimation=Class.create({initialize:function(c,b,a){this.from=c;this.to=b;this.callback=a;this.now=c;this.ease=0;this.time=0},doFrame:function(c,f,e,a,d){var b;if(a){b=this.to}else{b=this.from+(this.to-this.from)*f}this.now=b;this.ease=f;this.time=d;this.callback(c,b,e,a)}});function IWCommentSummaryInfoForURL(b,d){function c(g){var e={};if(g.responseText){var f=g.responseText.match(/.*= ((true)|(false));.*\n.*= (\d+)/);if(f){e.enabled=(f[1]=="true");e.count=Number(f[4])}}d(e)}var a=b+"?wsc=summary.js&ts="+(new Date().getTime());new Ajax.Request(a,{method:"get",onSuccess:c,onFailure:d.bind(null,{})})}function IWCommentCountForURL(a,c){function b(d){if(d.count===undefined){d.count=0}c(d.count)}IWCommentSummaryInfoForURL(a,b)};