var MESSAGES={"format.date":"MM/dd/yyyy","format.time":"h:mm a","photoviewer.toolbar.first":"Go to Start (Home)","photoviewer.toolbar.prev":"Previous Photo (Left arrow)","photoviewer.toolbar.slideShow":"Start/Pause Slide Show (Space)","photoviewer.toolbar.next":"Next Photo (Right arrow)","photoviewer.toolbar.last":"Go to End (End)","photoviewer.toolbar.email":"Email Photo","photoviewer.toolbar.permalink":"Link to Photo","photoviewer.toolbar.close":"Close (Esc)","photoviewer.email.subject.photo":"Photo","gallery.nophotos":"No photos","gallery.thumbs.start":"Start","gallery.thumbs.end":"End","gallery.toolbar.first":"First Photo","gallery.toolbar.prev":"Previous Photo","gallery.toolbar.view":"View Photo","gallery.toolbar.next":"Next Photo","gallery.toolbar.last":"Last Photo","gallery.view.full":"Maximize Window","gallery.view.photo":"Show Photo Only","gallery.view.text":"Show Description Only","gallery.view.close":"Close Window"},agent=navigator.userAgent.toLowerCase(),IE=agent.indexOf("msie")!=-1&&agent.indexOf("opera")==-1,IE7=agent.indexOf("msie 7")!=-1,OPERA=agent.indexOf("opera")!=-1,SAFARI=agent.indexOf("safari")!=-1,FIREFOX=agent.indexOf("gecko")!=-1,STRICT_MODE=document.compatMode=="CSS1Compat",_DOMAIN=undefined,GALLERY_W=650,GALLERY_H=530;if(USE_GOOGLE_MAPS==undefined)var USE_GOOGLE_MAPS=true;var USE_OLD_MAPS=!USE_GOOGLE_MAPS,TESTING=false,log=getLogger();document.location.href.indexOf("#jslog")!=-1&&log.enable();function Logger(){var b=this;b.enable=loggerEnable;b.clear=loggerClear;b.log=loggerLog;b.debug=loggerDebug;b.info=loggerInfo;b.error=loggerError;var a=undefined;try{a=document.createElement("textarea");a.style.display="none";a.style.position="absolute";a.style.right="2px";a.style.bottom="2px";a.style.width="23em";a.style.height="40em";a.style.fontFamily="monospace";a.style.fontSize="9px";a.style.color="#000000";setOpacity(a,.7);a.border="1px solid #808080";a.ondblclick=clearLogger}catch(c){}b.console=a;b.enabled=false;b.logTimeStart=getTimeMillis()}function getLogger(){var a=undefined,b=window;while(a==undefined){try{a=b.document.log}catch(c){break}if(b==b.parent)break;b=b.parent}if(a==undefined){a=new Logger;document.log=a}return a}function clearLogger(){getLogger().clear()}function loggerEnable(){var a=this;if(a.enabled||a.console==undefined)return;if(window.document.body!=undefined){window.document.body.appendChild(a.console);a.console.style.display="";a.enabled=true}}function loggerDebug(a){this.log("DEBUG",a)}function loggerInfo(a){this.log("INFO",a)}function loggerError(a,b){this.log("ERROR",a,b)}function loggerLog(f,e,c){var a=this;if(!a.enabled||a.console==undefined)return;var b=getTimeMillis()-a.logTimeStart+"";while(b.length<6)b+=" ";var d=b+" ";if(e!=undefined)d+=e+" ";if(c!=undefined)d+=c.name+": "+c.message;a.console.value+=d+"\n"}function loggerClear(){if(!this.enabled||this.console==undefined)return;this.console.value=""}function getTimeMillis(){var a=new Date;return Date.UTC(a.getFullYear(),a.getMonth(),a.getDay(),a.getHours(),a.getMinutes(),a.getSeconds(),a.getMilliseconds())}function getEvent(a){return a!=undefined?a:window.event}function preventDefault(a){a.stopEvent&&a.stopEvent();if(a.preventDefault){a.preventDefault();a.stopPropagation()}else{a.returnValue=false;a.cancelBubble=true}}function getEventTarget(a){if(a==undefined)return undefined;if(a.srcElement!=undefined)return a.srcElement;else return a.target}function getMousePosition(c){c=getEvent(c);var a=window.pageXOffset;if(a==undefined||a===0)a=window.document.documentElement.scrollLeft;if(a==undefined||a===0)a=window.document.body.scrollLeft;var b=window.pageYOffset;if(b==undefined||b===0)b=window.document.documentElement.scrollTop;if(b==undefined||b===0)b=window.document.body.scrollTop;var d=c.clientX+a,e=c.clientY+b;return {x:d,y:e}}function getResponse(f,b,d,c,e){var a=undefined;try{a=new ActiveXObject("Msxml2.XMLHTTP")}catch(g){try{a=new ActiveXObject("Microsoft.XMLHTTP")}catch(h){a=new XMLHttpRequest}}if(a==undefined){log.error("Failed to initialize XML/HTTP");return undefined}a.open("GET",f,b);if(!b){a.send(undefined);if(a.readyState!=4){log.error("Request failed: "+a.readyState);return undefined}if(!d)return a.responseText;else return a.responseXML}else{pollResponse(a,c,e);a.send(undefined);return undefined}}function pollResponse(a,b,c){if(a.readyState!=4)window.setTimeout(function(){pollResponse(a,b,c)},100);else b(a,c)}function getDOMLocation(a){var b=a.offsetLeft,c=a.offsetTop;while(a.offsetParent){b=b+a.offsetParent.offsetLeft;c=c+a.offsetParent.offsetTop;if(a==document.getElementsByTagName("body")[0])break;else a=a.offsetParent}return {x:b,y:c}}function getElementsByTagName(b,a){if(b==undefined)return undefined;if(IE)return b.getElementsByTagName(a);if(a.indexOf(":")!=-1)a=a.split(":")[1];return b.getElementsByTagNameNS("*",a)}function getFirstElementsValue(b,c){if(b==undefined)return undefined;var a=getElementsByTagName(b,c);if(a.length===0)return undefined;else return getElementValue(a[0])}function findDOMElement(c){var b=undefined,a=window;while(b==undefined){try{b=a.document.getElementById(c)}catch(d){break}if(a===a.parent)break;a=a.parent}return b}function getElementValue(b){for(var c="",a=0;a<b.childNodes.length;a++)if(b.childNodes[a].nodeValue!==null)c+=b.childNodes[a].nodeValue;return c}function trim(a){if(a==undefined)return undefined;return a.replace(/^\s*([\s\S]*\S+)\s*$|^\s*$/,"$1")}function trimToLen(a,b){if(a==undefined)return undefined;if(a.length>b)a=a.substring(0,b)+"...";return a}function getRootWindow(){var a=window;while(a!=undefined)try{if(a===a.parent)break;else if(a.parent!=undefined&&a.parent.document.location.href.indexOf("/selenium-server/")!=-1)break;a=a.parent}catch(b){a.permissionDenied=true;break}return a}function getURLParams(){var a,g=[],c=window.location.search;if(c==undefined||c.length===0)return undefined;c=c.substring(1);var b=c.replace(/\+/g," ").split("&");for(a=0;a<b.length;a++){var d,f,e=b[a].indexOf("=");if(e!=-1){d=b[a].substring(0,e);f=unescape(b[a].substring(e+1))}else{d=b[a];f=undefined}g[d]=f}return g}function joinLists(b,c){var a,e=0,d=[];if(b!=undefined&&b.length>0){for(a=0;a<b.length;a++)d[a]=b[a];e=b.length}if(c!=undefined&&c.length>0)for(a=0;a<c.length;a++)d[a+e]=c[a];return d}function setCookie(d,c,a){var b=a==undefined?"":"; expires="+a.toGMTString();document.cookie=d+"="+c+b}function getCookie(d){if(document.cookie==undefined||document.cookie.length===0)return undefined;var c=d+"=",a=document.cookie.indexOf(c);if(a!=-1){a+=c.length;var b=document.cookie.indexOf(";",a);if(b==-1)b=document.cookie.length;return unescape(document.cookie.substring(a,b))}}function removeCookie(c){var b=new Date,a=new Date;a.setTime(b.getTime()-1);setCookie(c,"",a)}function getMessage(a){if(MESSAGES[a]==undefined)return "("+a+")";else return MESSAGES[a]}function localizeNodeAttribs(a){var b;if(a==undefined)return;if(a.alt!=undefined&&a.alt.indexOf("#")===0)a.alt=getMessage(a.alt.substring(1));if(a.title!=undefined&&a.title.indexOf("#")===0)a.title=getMessage(a.title.substring(1));if(a.childNodes!=undefined)for(b=0;b<a.childNodes.length;b++)localizeNodeAttribs(a.childNodes[b])}function padNumber(a,b){a=a+"";while(a.length<b)a="0"+a;return a}function isArray(a){if(a instanceof Array)return true;else return false}function simpleDateFormatter(b,c){var a=c;a=a.replace(/yyyy/g,b.getFullYear());a=a.replace(/yy/g,padNumber(b.getFullYear()%100,2));a=a.replace(/MM/g,padNumber(b.getMonth()+1,2));a=a.replace(/M/g,b.getMonth()+1);a=a.replace(/dd/g,padNumber(b.getDate(),2));a=a.replace(/d/g,b.getDate());a=a.replace(/HH/g,padNumber(b.getHours(),2));a=a.replace(/H/g,b.getHours());a=a.replace(/hh/g,padNumber(b.getHours()%12,2));a=a.replace(/h/g,b.getHours()%12);a=a.replace(/mm/g,padNumber(b.getMinutes(),2));a=a.replace(/m/g,b.getMinutes());a=a.replace(/ss/g,padNumber(b.getSeconds(),2));a=a.replace(/s/g,b.getSeconds());var d=b.getHours()<12?"AM":"PM";a=a.replace(/a/g,d);return a}function formatDateTime(a){if(a==undefined)return undefined;return formatDate(a)+" "+formatTime(a)}function formatDate(b){var a=getMessage("format.date");return simpleDateFormatter(b,a)}function formatTime(b){var a=getMessage("format.time");return simpleDateFormatter(b,a)}function parseISOTime(a){if(a==undefined)return undefined;var b=/^(\d{4})-(\d\d)-(\d\d)T(\d\d):(\d\d):(\d\d)(\.\d{3})?([Z+-])?(\d\d)?:?(\d\d)?$/;if(!b.test(a))return undefined;else return new Date(RegExp.$1,RegExp.$2-1,RegExp.$3,RegExp.$4,RegExp.$5,RegExp.$6)}function setOpacity(b,a){if(IE)b.style.filter="alpha(opacity="+parseInt(a*100)+")";b.style.KhtmlOpacity=a;b.style.opacity=a}function validCoordinates(a,b){if(Math.abs(a)>90||Math.abs(b)>180)return false;if(a===0&&b===0)return false;return true}function isHosted(){var a=document.location.host;if(a==undefined)a="";return (a.indexOf("triptracker.net")==-1||a.indexOf("slideshow.triptracker.net")!=-1)&&a.indexOf("rtvslo.si")==-1&&a!="localhost"&&!checkDomain()}function checkDomain(){var d=true;try{if(_DOMAIN==undefined)return false;var e=document.location.protocol;if(e==undefined)e="http:";var a=document.location.host;if(a==undefined)a="";a=a.toLowerCase();if(e.toLowerCase().indexOf("file")===0)return d;var c=a.lastIndexOf(":");if(c!=-1)a=a.substring(0,c);if(a.indexOf("www.")===0)a=a.substring(4);if(a===""||a=="localhost"||a=="127.0.0.1")return d;var b=_DOMAIN.toLowerCase();c=b.indexOf("://");if(c!=-1)b=b.substring(c+3);c=b.indexOf("/");if(c!=-1)b=b.substring(0,c);if(b.indexOf("www.")===0)b=b.substring(4);if(a==b)return d;else if((new RegExp(b)).test(a))return d;return false}catch(f){return d}}function getWindowSize(c){var b=c.innerWidth;if(b==undefined||b===0||isNaN(b))b=c.document.documentElement.clientWidth;if(b==undefined||b===0||isNaN(b))b=c.document.body.clientWidth;var a=c.innerHeight;if(a==undefined||a===0||isNaN(a))a=c.document.documentElement.clientHeight;if(a==undefined||a===0||isNaN(a))a=c.document.body.clientHeight;return {w:b,h:a}}function getDocumentSize(a){var e=getWindowSize(a),d=getScrollPos(a),c=e.w+d.left,b=e.h+d.top;c=Math.max(c,a.document.body.offsetWidth);b=Math.max(b,a.document.body.offsetHeight);c=Math.max(c,a.document.body.scrollWidth);b=Math.max(b,a.document.body.scrollHeight);return {w:c,h:b}}function getScrollPos(c){var b=c.pageYOffset;if(b==undefined||b===0)b=c.document.documentElement.scrollTop;if(b==undefined||b===0)b=c.document.body.scrollTop;var a=c.pageXOffset;if(a==undefined||a===0)a=c.document.documentElement.scrollLeft;if(a==undefined||a===0)a=c.document.body.scrollLeft;return {top:b,left:a}}var CLEAR_EVENTS=["onclick","ondblclick","onkeydown","onkeypress","onmousedown","onmouseup","onmousemove","onmouseover","onmouseout","onmousewheeldown","oncontextmenu"];function clearEvents(){var a,b,c=0;if(document.all==undefined)return;for(a=0;a<document.all.length;a++)for(b=0;b<CLEAR_EVENTS.length;b++){var d=document.all[a][CLEAR_EVENTS[b]];if(d!=undefined){document.all[a][CLEAR_EVENTS[b]]=null;c++}}}window.attachEvent&&window.attachEvent("onunload",clearEvents);function getGallery(){var b=undefined,a=window;while(b==undefined){try{b=a.document.gallery}catch(d){break}var c=a;a=a.parent;if(c===a)break}return b}function getMap(){if(this.map!=undefined)return this.map;try{if(document.map!=undefined)return document.map}catch(a){}try{if(window.parent.document.map!=undefined)return window.parent.document.map}catch(a){}return undefined}function viewerCloseCallback(f){for(var c,e=0,a=getGallery(),b=0;b<a.sets.length;b++)for(c=0;c<a.sets[b].photos.length;c++){var d=a.sets[b].photos[c];if(d==undefined||d.orig==undefined||d.orig.src==undefined)continue;if(e==f){a.setIndex=b;a.photoIndex=c;a.renderPhotos();a.win.focus();return}e++}}var VIEWER_INDEX=0,SLIDE_DURATION=4e3,SLIDE_OFFSET=50,SLIDE_PHOTOS=true,FADE_BORDER=false,FADE_STEPS=10,MOVE_STEP=1,PRELOAD_TIMEOUT=6e4,BORDER_WIDTH=5,FONT_SIZE=10,LINE_HEIGHT="0.7em",OFFSET_LEFT=0,OFFSET_TOP=0,REST_URL="/rest/",P_IMG_ROOT="images/slide",TOOLBAR_IMG="toolbar.png",TOOLBAR_IMG_RUNNING="toolbar2.png",TOOLBAR_IMG_BACK="toolbar-back",TOOLBAR_IMG_MASK="toolbar-mask.png",TOOLBAR_IMG_LOADING="loading-anim.gif",TOOLBAR_W=440,TOOLBAR_H=75,TOOLBAR_IMG_W=420,TOOLBAR_IMG_H=44,TOOLBAR_LINK="http://slideshow.triptracker.net",TOOLBAR_OPACITY=.7,TOOLBAR_FONT_COLOR="#c0c0c0",TOOLBAR_FONT_STYLE="tahoma, verdana, arial, helvetica, sans-serif",BYLINE_FONT_COLOR=TOOLBAR_FONT_COLOR,BYLINE_FONT_STYLE=TOOLBAR_FONT_STYLE,BYLINE_POSITION_RIGHT=5,BYLINE_POSITION_BOTTOM=5,VIEWER_ID_PREFIX="PhotoViewer",VIEWER_ID_BACK=VIEWER_ID_PREFIX+"Back",VIEWER_ID_TOOLBAR=VIEWER_ID_PREFIX+"Toolbar",VIEWER_ID_TOOLBAR_MAP=VIEWER_ID_PREFIX+"ToolbarMap",VIEWER_ID_TOOLBAR_IMG=VIEWER_ID_PREFIX+"ToolbarImg",VIEWER_ID_LOADING=VIEWER_ID_PREFIX+"Loading",VIEWER_ID_TIME=VIEWER_ID_PREFIX+"Time",VIEWER_ID_TITLE=VIEWER_ID_PREFIX+"Title",VIEWER_ID_BYLINE=VIEWER_ID_PREFIX+"Byline",VIEWER_ID_PHOTO=VIEWER_ID_PREFIX+"Photo",VIEWER_ID_CTXMENU=VIEWER_ID_PREFIX+"CtxMenu",TITLE_MAX_LENGTH=140,TOOLBAR_IMG_LOADING_LEFT=273,TOOLBAR_IMG_LOADING_TOP=24;function PhotoViewer(e,d){var c="#000000",b=true,a=this;a.setImageRoot=setImageRoot;a.add=addPhoto;a.show=showPhoto;a.close=closePhoto;a.randomize=randomize;a.isShown=isPhotoShown;a.setBackground=setPhotoBackground;a.setShowToolbar=setShowToolbar;a.setToolbarImage=setToolbarImage;a.setShowCallback=setShowCallback;a.setCloseCallback=setCloseCallback;a.setEndCallback=setEndCallback;a.setLoading=setPhotoLoading;a.addBackShade=addBackShade;a.addToolbar=addToolbar;a.addCaptions=addCaptions;a.addByLine=addByLine;a.addBylineCaption=addBylineCaption;a.next=nextPhoto;a.prev=prevPhoto;a.first=firstPhoto;a.last=lastPhoto;a.slideShow=slideShow;a.slideShowStop=slideShowStop;a.startSlideShow=startSlideShow;a.handleKey=viewerHandleKey;a.checkStartFragmentIdentifier=checkStartFragmentIdentifier;a.checkStopFragmentIdentifier=checkStopFragmentIdentifier;a.setStartFragmentIdentifier=setStartFragmentIdentifier;a.setStopFragmentIdentifier=setStopFragmentIdentifier;a.email=emailPhoto;a.favorite=favoritePhoto;a.permalink=linkPhoto;a.setBackgroundColor=setBackgroundColor;a.setBorderWidth=setBorderWidth;a.setSlideDuration=setSlideDuration;a.disablePanning=disablePanning;a.enablePanning=enablePanning;a.disableFading=disableFading;a.enableFading=enableFading;a.disableShade=disableShade;a.enableShade=enableShade;a.setShadeColor=setShadeColor;a.setShadeOpacity=setShadeOpacity;a.setFontSize=setFontSize;a.setFont=setFont;a.enableAutoPlay=enableAutoPlay;a.disableAutoPlay=disableAutoPlay;a.enableEmailLink=enableEmailLink;a.disableEmailLink=disableEmailLink;a.enablePhotoLink=enablePhotoLink;a.disablePhotoLink=disablePhotoLink;a.setOnClickEvent=setOnClickEvent;a.setOnRightclickEvent=setOnRightclickEvent;a.enableLoop=enableLoop;a.disableLoop=disableLoop;a.enableToolbarAnimator=enableToolbarAnimator;a.disableToolbarAnimator=disableToolbarAnimator;a.enableToolbar=enableToolbar;a.disableToolbar=disableToolbar;a.setControlsImageMap=setControlsImageMap;a.setOverrideToolbarStyles=setOverrideToolbarStyles;a.setNoPadding=setNoPadding;a.hideOverlappingElements=hideOverlappingElements;a.showOverlappingElements=showOverlappingElements;a.addContextMenu=addContextMenu;a.setEmailAddress=setEmailAddress;a.id=VIEWER_ID_PREFIX+VIEWER_INDEX;VIEWER_INDEX++;a.photos=[];a.index=0;a.win=e!=undefined?e:window;a.shown=false;a.showToolbar=b;a.backgroundColor=c;a.shadeColor=c;a.shadeOpacity=.7;a.borderColor=c;a.shadeColor=c;a.shadeOpacity=.7;a.borderWidth=BORDER_WIDTH;a.backgroundShade=b;a.fadePhotos=b;a.autoPlay=false;a.enableEmailLink=b;a.enablePhotoLink=b;a.slideDuration=SLIDE_DURATION;a.panPhotos=SLIDE_PHOTOS;a.fontSize=FONT_SIZE;a.font=undefined;if((d==undefined||d)&&!VIEWER_KEY_EVENT_ADDED){if(a.win.addEventListener)a.win.addEventListener("keydown",viewerHandleKey,false);else a.win.document.attachEvent("onkeydown",viewerHandleKey);VIEWER_KEY_EVENT_ADDED=b}a.win.document.viewer=a;OPERA&&a.disableFading()}var VIEWER_KEY_EVENT_ADDED=false;function PhotoImg(f,e,h,g,d,c,b){var a=this;a.id=f;a.src=e;a.w=parseInt(h,10);a.h=parseInt(g,10);a.time=d;a.title=c;a.byline=b}function getViewer(){var b=undefined,a=window;while(b==undefined){try{b=a.document.viewer}catch(c){break}if(a===a.parent)break;a=a.parent}return b}function setImageRoot(a){P_IMG_ROOT=a}function addPhoto(a,c,d,b){var e=typeof a;if(typeof a=="string")a=new PhotoImg(undefined,a,undefined,undefined,d,c,b);this.photos.push(a)}function randomize(){for(var a=this.photos,c,d,b=a.length;b;c=parseInt(Math.random((new Date).getSeconds())*b,10),d=a[--b],a[b]=a[c],a[c]=d);}function setPhotoBackground(c,b,a){if(c!=undefined)this.backgroundColor=c;if(b!=undefined)this.borderColor=b;if(a!=undefined)this.backgroundShade=a}function setPhotoLoading(a){this.isLoading=a;var b=this.win.document.getElementById(VIEWER_ID_LOADING);if(b==undefined)return;b.style.display=a?"":"none"}function setBackgroundColor(a){this.backgroundColor=a;this.borderColor=a}function setBorderWidth(a){this.borderWidth=a}function setSlideDuration(a){this.slideDuration=a}function disableShade(){this.backgroundShade=false}function enableShade(){this.backgroundShade=true}function setShadeColor(a){this.shadeColor=a}function setShadeOpacity(a){this.shadeOpacity=a}function disableFading(){this.fadePhotos=false}function enableFading(){this.fadePhotos=true}function disablePanning(){this.panPhotos=false}function enablePanning(){this.panPhotos=true}function setFontSize(a){this.fontSize=a}function setFont(a){this.font=a}function enableAutoPlay(){this.autoPlay=true}function disableAutoPlay(){this.autoPlay=false}function enableEmailLink(){this.enableEmailLink=true}function disableEmailLink(){this.enableEmailLink=false}function enablePhotoLink(){this.enablePhotoLink=true}function disablePhotoLink(){this.enablePhotoLink=false}function setOnClickEvent(a){this.customOnClickEvent=a}function setOnRightclickEvent(a){this.customOnRightclickEvent=a}function enableLoop(){this.loop=true}function disableLoop(){this.loop=false}function enableToolbar(){this.showToolbar=true}function disableToolbar(){this.showToolbar=false}function enableToolbarAnimator(){this.toolbarAnimator=new ToolbarAnimator(this)}function disableToolbarAnimator(){if(this.toolbarAnimator!=undefined){this.toolbarAnimator.reset();this.toolbarAnimator=undefined}}function setControlsImageMap(a){this.customImageMap=a}function setOverrideToolbarStyles(a){this.overrideToolbarStyles=a}function setNoPadding(a){this.nopadding=a}function setEmailAddress(a){this.emailAddress=a}function showPhoto(p,i,s){var h="px",m="hidden",l=false,g=true,a=this;if(a.photos.length===0)return g;if(getRootWindow().permissionDenied&&a.badgeMode==undefined&&!getRootWindow().livemode){a.setStartFragmentIdentifier(p);return g}if(p!=undefined)a.index=p;if(a.index<0||a.index>=a.photos.length){log.error("Invalid photo index");return g}var k=a.win.document,q=l;if(!a.shown){q=g;k.viewer=a;try{a.hideOverlappingElements()}catch(v){}}var o=16384,t=getWindowSize(a.win),j=t.w-(a.nopadding?a.borderWidth*2:20),n=t.h-(a.nopadding?a.borderWidth*2:20),r=getScrollPos(a.win),w=r.left,x=r.top;a.addBackShade(o);a.addByLine(o);a.addBylineCaption();if(a.showToolbar){a.addToolbar(j,o);a.addCaptions()}var b=a.photos[a.index];if(isNaN(b.w)||isNaN(b.h))if(b.preloadImage!=undefined){if(isNaN(b.w)&&b.preloadImage.width>0)b.w=b.preloadImage.width;if(isNaN(b.h)&&b.preloadImage.height>0)b.h=b.preloadImage.height}else{a.index--;a.next();return l}a.shown=g;var u=a.nopadding?0:20,e=-1,f=-1;if(parseInt(b.w)>j||parseInt(b.h)>n)if(parseInt(b.w)/j>parseInt(b.h)/n){e=j-u;f=parseInt(e*b.h/b.w)}else{f=n-u;e=parseInt(f*b.w/b.h)}else{e=parseInt(b.w);f=parseInt(b.h)}if(e<=0||f<=0)if(!a.showToolbar)throw"Missing photo dimension";if(i==undefined)i=0;var c=k.createElement("div");c.id=VIEWER_ID_PHOTO;c.style.visibility=m;c.style.position="absolute";c.style.zIndex=o;c.style.overflow=m;c.style.border=a.borderWidth+"px solid "+a.borderColor;c.style.textAlign="center";c.style.backgroundColor=a.backgroundColor;var d=k.createElement("img");d.style.visibility=m;d.style.position="relative";d.style.backgroundColor=a.backgroundColor;d.style.border="none";d.style.cursor="pointer";d.style.zIndex=parseInt(c.style.zIndex)+1+"";d.onclick=onClickEvent;d.oncontextmenu=onContextMenuEvent;if(s!=undefined&&a.fadePhotos){var y=FADE_BORDER?c:d;setOpacity(y,s)}var z=parseInt((j-e)/2)+(a.nopadding?0:OFFSET_LEFT);c.style.left=z+w+i/2+h;var A=parseInt((n-f)/2)+(a.nopadding?0:OFFSET_TOP);c.style.top=A+x+h;d.style.visibility=m;c.style.width=(e-i>0?e-i:e)+h;c.style.height=f+h;d.style.width=e+h;d.style.height=f+h;d.src=b.src;c.style.visibility="visible";d.style.visibility="visible";c.appendChild(d);k.body.appendChild(c);if(a.photoDiv!=undefined)try{k.body.removeChild(a.photoDiv)}catch(v){}a.photoDiv=c;a.photoImg=d;a.setLoading(l);a.showCallback!=undefined&&a.showCallback(a.index);q&&a.autoPlay&&a.slideShow(g);return l}function isPhotoShown(){return this.shown}function closeViewer(){getViewer().close()}function onPhotoLoad(){var a=getViewer();if(a!=undefined){if(flickrHack(a,a.index)){a.setLoading(false);a.index--;a.next();return}a.show()}}function closePhoto(){var a=this,d=a.win;if(d==undefined)d=window;var c=d.document,b=a.photoDiv;b!=undefined&&c.body.removeChild(b);b=c.getElementById(VIEWER_ID_BACK);b!=undefined&&c.body.removeChild(b);b=c.getElementById(VIEWER_ID_TOOLBAR);b!=undefined&&c.body.removeChild(b);b=c.getElementById(VIEWER_ID_BYLINE);b!=undefined&&c.body.removeChild(b);a.shown=false;a.slideShowRunning=false;a.slideShowPaused=false;try{a.showOverlappingElements()}catch(e){log.error(e)}a.toolbarAnimator!=undefined&&a.toolbarAnimator.reset();a.closeCallback!=undefined&&a.closeCallback(a.index);a.contextMenu!=undefined&&a.contextMenu.hide()}function nextPhoto(b){var a=this;a.contextMenu!=undefined&&a.contextMenu.visible&&a.contextMenu.hide();if(a.isLoading)return;if(b==undefined)b=1;var d=a.index;if(a.index+b>=a.photos.length)if(a.loop&&b!=a.photos.length)a.index=0;else a.index=a.photos.length-1;else if(a.index+b<0)if(b<-1)a.index=0;else if(a.loop)a.index=a.photos.length-1;else return;else a.index+=b;if(a.index==d)return;a.slideShowStop();var c=new Image;a.photos[a.index].preloadImage=c;a.setLoading(true);c.onload=onPhotoLoad;c.onerror=onPhotoLoad;if(a.photos[a.index].src!=undefined)c.src=a.photos[a.index].src;else onPhotoLoad()}function prevPhoto(b){var a=this;a.contextMenu!=undefined&&a.contextMenu.visible&&a.contextMenu.hide();if(b==undefined)b=1;a.next(-b)}function firstPhoto(){var a=this;a.contextMenu!=undefined&&a.contextMenu.visible&&a.contextMenu.hide();a.prev(a.photos.length)}function lastPhoto(){var a=this;a.contextMenu!=undefined&&a.contextMenu.visible&&a.contextMenu.hide();a.next(a.photos.length)}function startSlideShow(){this.contextMenu!=undefined&&this.contextMenu.visible&&this.contextMenu.hide();getViewer().slideShow(true)}var slideTimeout,slidePreloadImageLoaded=false,slidePreloadTime=undefined;function slideShow(l){var c=false,f=true,e="/",a=this;a.toolbarAnimator!=undefined&&a.toolbarAnimator.slideshowAction();var d=a.index+1;if(d>=a.photos.length)if(a.loop)d=0;else if(!a.slideShowPaused&&!a.slideShowRunning){a.setToolbarImage(P_IMG_ROOT+e+TOOLBAR_IMG);return}var n=a.win.document,j=a,g=a.photoImg;if(g==undefined)return;var m=a.photoDiv,h=FADE_BORDER?m:g;if(l!=undefined&&l===f){if(a.slideShowPaused){a.slideShowPaused=c;a.setToolbarImage(P_IMG_ROOT+e+TOOLBAR_IMG_RUNNING);a.contextMenu!=undefined&&a.contextMenu.visible&&a.contextMenu.hide();return}else if(a.slideShowRunning){a.slideShowPaused=f;a.setToolbarImage(P_IMG_ROOT+e+TOOLBAR_IMG);return}else{a.contextMenu!=undefined&&a.contextMenu.visible&&a.contextMenu.hide();a.slideShowRunning=f;a.slideShowPaused=c;a.slideFirstPhoto=f;a.setToolbarImage(P_IMG_ROOT+e+TOOLBAR_IMG_RUNNING)}if(a.isLoading||a.index>a.photos.length-1)return}else if(a.slideShowPaused){window.setTimeout(function(){j.slideShow(c)},200);return}else if(!a.slideShowRunning){a.setToolbarImage(P_IMG_ROOT+e+TOOLBAR_IMG);return}var b=0;if(g.leftOffset!=undefined)b=parseFloat(g.leftOffset);if(b===0)if(d<a.photos.length){slidePreloadImageLoaded=c;var i=new Image;a.photos[d].preloadImage=i;slidePreloadTime=getTimeMillis();i.onload=onSlideLoad;i.onerror=onSlideLoad;i.src=a.photos[d].src}if(b>-SLIDE_OFFSET){b-=MOVE_STEP;if(-b<=FADE_STEPS){if(h.style.opacity!=undefined&&parseFloat(h.style.opacity)<1)a.fadePhotos&&a.photos[a.index].src!=undefined&&setOpacity(h,-b/FADE_STEPS)}else if(b+SLIDE_OFFSET<FADE_STEPS)if(d<a.photos.length&&!slidePreloadImageLoaded){if(slidePreloadTime!=undefined&&getTimeMillis()-slidePreloadTime>PRELOAD_TIMEOUT)slidePreloadImageLoaded=f;b++;a.setLoading(f)}else d<a.photos.length&&a.fadePhotos&&a.photos[a.index].src!=undefined&&setOpacity(h,(b+SLIDE_OFFSET)/FADE_STEPS);g.leftOffset=b;if(a.panPhotos&&!a.slideFirstPhoto)g.style.left=b+"px"}else{if(d>=a.photos.length){a.slideShowRunning=c;a.slideShowPaused=c;a.setToolbarImage(P_IMG_ROOT+e+TOOLBAR_IMG);a.toolbarAnimator!=undefined&&a.toolbarAnimator.reset();a.endCallback!=undefined&&a.endCallback();return}a.index=d;a.slideFirstPhoto=c;a.show(undefined,a.panPhotos?SLIDE_OFFSET:0,0);h=FADE_BORDER?a.photoDiv:a.photoImg;a.fadePhotos&&setOpacity(h,0);a.photoImg.leftOffset=0;if(a.panPhotos)a.photoImg.style.left="0px"}var k=a.slideDuration/SLIDE_OFFSET;if(a.slideFirstPhoto)k/=2;slideTimeout=window.setTimeout(function(){j.slideShow(c)},k)}function onSlideLoad(){var a=getViewer();if(a!=undefined){if(flickrHack(a,a.index+1)){var b=a.photos[a.index+1].preloadImage;b.src=a.photos[a.index+1].src;slidePreloadTime=getTimeMillis();return}slidePreloadImageLoaded=true;a.setLoading(false)}}function slideShowStop(){var a=this;a.slideShowRunning=false;a.slideShowPaused=false;var d=a.win.document,b=a.photoImg;if(b!=undefined){if(a.fadePhotos){var c=FADE_BORDER?a.photoDiv:b;setOpacity(c,1)}b.style.left="0px"}}function addBackShade(f){var c="0px",b=this,d=b.win.document;if(d.getElementById(VIEWER_ID_BACK)!=undefined)return;var a=d.createElement("div");a.id=VIEWER_ID_BACK;a.style.top=c;a.style.left=c;a.style.bottom=c;a.style.right=c;a.style.margin="0";a.style.padding="0";a.style.border="none";a.style.cursor="pointer";if(IE&&!(IE7&&STRICT_MODE)){a.style.position="absolute";var e=getDocumentSize(b.win);a.style.width=e.w-21+"px";a.style.height=e.h-4+"px"}else{a.style.position="fixed";a.style.width="100%";a.style.height="100%"}a.style.zIndex=f-1;a.style.backgroundColor=b.shadeColor;if(b.backgroundShade)setOpacity(a,b.shadeOpacity);else setOpacity(a,0);a.onclick=onClickEvent;d.body.appendChild(a)}function addToolbar(v,w){var t="relative",l="none",r="0px",q="img",f="px",p="absolute",b=this,e=b.win.document,o;if(e.getElementById(VIEWER_ID_TOOLBAR)!=undefined)return;var a=e.createElement("div");a.id=VIEWER_ID_TOOLBAR;setOpacity(a,TOOLBAR_OPACITY);a.style.zIndex=w+1;var s=TOOLBAR_IMG_BACK;if(!isHosted())s+="-nologo";if(IE&&!IE7)s+="-indexed";s+=".png";if(!b.overrideToolbarStyles){var u=10;if(IE&&!(IE7&&STRICT_MODE)){a.style.position=p;if(IE7){var x=getWindowSize(b.win).h+getScrollPos(b.win).top;a.style.top=x-TOOLBAR_H-10+f}else a.style.bottom=u+f}else{a.style.position="fixed";a.style.bottom=u+f}a.style.left=(v-TOOLBAR_W+10)/2+f;a.style.width=TOOLBAR_W+f;a.style.height=TOOLBAR_H+f;a.style.textAlign="center";a.style.backgroundImage="url('"+P_IMG_ROOT+"/"+s+"')";a.style.backgroundPosition="50% 0%";a.style.backgroundRepeat="no-repeat";a.style.lineHeight=LINE_HEIGHT}var d=undefined;if(!b.enableEmailLink&&TOOLBAR_IMG_MASK!=undefined){d=e.createElement(q);d.style.position=p;d.style.width=44;d.style.height=44;d.style.left="289px";d.style.top=r;d.src=P_IMG_ROOT+"/"+TOOLBAR_IMG_MASK;a.appendChild(d)}if(!b.enablePhotoLink&&TOOLBAR_IMG_MASK!=undefined){d=e.createElement(q);d.style.position=p;d.style.width=44;d.style.height=44;d.style.left="339px";d.style.top=r;d.src=P_IMG_ROOT+"/"+TOOLBAR_IMG_MASK;a.appendChild(d)}var n=b.customImageMap;if(n===undefined){n=e.createElement("map");var i=[];i.push(["getViewer().first()","17",getMessage("photoviewer.toolbar.first")]);i.push(["getViewer().prev()","68",getMessage("photoviewer.toolbar.prev")]);i.push(["getViewer().slideShow(true)","122",getMessage("photoviewer.toolbar.slideShow")]);i.push(["getViewer().next()","175",getMessage("photoviewer.toolbar.next")]);i.push(["getViewer().last()","227",getMessage("photoviewer.toolbar.last")]);b.enableEmailLink&&i.push(["getViewer().email()","300",getMessage("photoviewer.toolbar.email")]);b.enablePhotoLink&&i.push(["getViewer().permalink()","350",getMessage("photoviewer.toolbar.permalink")]);i.push(["getViewer().close()","402",getMessage("photoviewer.toolbar.close")]);for(o=0;o<i.length;o++){var m=e.createElement("area");m.href="javascript:void(0)";m.alt=i[o][2];m.title=m.alt;m.shape="circle";m.coords=i[o][1]+", 21, 22";m.onclick=buildAreaMapClosure(i[o][0]);n.appendChild(m)}}n.name=VIEWER_ID_TOOLBAR_MAP;n.id=VIEWER_ID_TOOLBAR_MAP;var k=e.createElement(q);k.id=VIEWER_ID_TOOLBAR_IMG;k.src=P_IMG_ROOT+"/"+TOOLBAR_IMG;k.width=TOOLBAR_IMG_W;k.height=TOOLBAR_IMG_H;k.style.border=l;k.style.background=l;if(STRICT_MODE)k.style.margin="4px 0px 0px 0px";else k.style.margin="4px";k.useMap="#"+VIEWER_ID_TOOLBAR_MAP;a.appendChild(n);a.appendChild(k);if(isHosted()){var c=e.createElement("a");c.style.position=p;c.style.bottom=r;c.style.right=r;c.style.width="25px";c.style.height="25px";c.style.background=l;c.alt="TripTracker.net";c.title=c.alt;c.cursor=c.alt;c.href=TOOLBAR_LINK;c.target="_new";c.alt="TripTracker Slideshow";c.title=c.alt;a.appendChild(c)}var j=e.createElement(q);j.id=VIEWER_ID_LOADING;j.width=16;j.height=16;j.style.display=l;j.style.position=p;j.style.left=TOOLBAR_IMG_LOADING_LEFT-8+f;j.style.top=TOOLBAR_IMG_LOADING_TOP-8+f;j.src=P_IMG_ROOT+"/"+TOOLBAR_IMG_LOADING;j.style.border=l;j.style.background=l;a.appendChild(j);a.appendChild(e.createElement("br"));var h=e.createElement("span");h.id=VIEWER_ID_TIME;if(!b.overrideToolbarStyles){h.position=t;h.style.color=TOOLBAR_FONT_COLOR;h.style.fontFamily=TOOLBAR_FONT_STYLE;h.style.fontSize=b.fontSize+f;if(STRICT_MODE)h.style.lineHeight=b.fontSize+f;if(b.font!=undefined)h.style.font=b.font;h.style.cssFloat=l;h.style.textAlign="right";h.style.padding="0px 10px"}h.appendChild(e.createTextNode(" "));a.appendChild(h);var g=e.createElement("span");g.id=VIEWER_ID_TITLE;if(!b.overrideToolbarStyles){g.position=t;g.style.color=TOOLBAR_FONT_COLOR;g.style.fontFamily=TOOLBAR_FONT_STYLE;g.style.fontSize=b.fontSize+f;if(STRICT_MODE)g.style.lineHeight=b.fontSize+f;if(b.font!=undefined)g.style.font=b.font;g.style.cssFloat=l;g.style.textAlign="left";g.style.paddingRight="20px"}g.appendChild(e.createTextNode(" "));a.appendChild(g);e.body.appendChild(a)}function addByLine(d){var c=this,b=c.win.document;if(b.getElementById(VIEWER_ID_BYLINE)!=undefined)return;var a=b.createElement("div");a.appendChild(b.createTextNode(""));a.style.color=BYLINE_FONT_COLOR;a.style.fontFamily=BYLINE_FONT_STYLE;a.style.fontSize=c.fontSize+"px";if(c.font!=undefined)a.style.font=c.font;a.id=VIEWER_ID_BYLINE;a.style.position="absolute";a.style.right=BYLINE_POSITION_RIGHT+"px";a.style.bottom=BYLINE_POSITION_BOTTOM+"px";a.style.zIndex=d+1;a.appendChild(b.createTextNode(" "));b.body.appendChild(a)}function buildAreaMapClosure(func){return function(event){eval(func);blurElement(event);return false}}function blurElement(b){var a=getEventTarget(getEvent(b));a!=undefined&&a.blur()}function setToolbarImage(c){var b=this.win.document,a=b.getElementById(VIEWER_ID_TOOLBAR_IMG);if(a!=undefined)a.src=c}function setShowToolbar(a){this.showToolbar=a}function addCaptions(){var c=this,d=c.photos[c.index],f=c.win.document,g=f.getElementById(VIEWER_ID_TIME),b=f.getElementById(VIEWER_ID_TITLE),e=c.index+1+"/"+c.photos.length;if(d.time!=undefined)e+=" ["+d.time+"]";g.firstChild.nodeValue=e;var a=d.title!=undefined?d.title:"";b.title="";b.alt="";if(a.length>TITLE_MAX_LENGTH){b.title=a;b.alt=a;a=a.substring(0,TITLE_MAX_LENGTH)+" ..."}if(a.indexOf("\n")!==0){a=a.replace("\n","<br />");b.innerHTML=a}else b.nodeValue=a}function addBylineCaption(){var a=this.photos[this.index],c=this.win.document,b=c.getElementById(VIEWER_ID_BYLINE);if(a.byline!=undefined&&a.byline.length>0)b.firstChild.nodeValue=a.byline;else b.firstChild.nodeValue=""}function setCloseCallback(a){this.closeCallback=a}function setShowCallback(a){this.showCallback=a}function setEndCallback(a){this.endCallback=a}function emailPhoto(){var a=this,b=a.photos[a.index],f=a.win.document,e=b.title!=undefined?b.title:getMessage("photoviewer.email.subject.photo"),c=a.emailAddress!==undefined?a.emailAddress:"",d="mailto:"+c+"?subject="+e+"&body="+getPhotoURL(b.src);f.location.href=d}function getPhotoURL(b){var a=document.location;if(/\w+:\/\/.+/.test(b))return b;else if(b.indexOf("/")===0)return a.protocol+"//"+a.host+b;else{var c=a.pathname,d=c.lastIndexOf("/");if(d!=-1)c=c.substring(0,d);return a.protocol+"//"+a.host+c+"/"+b}}function linkPhoto(){var a=this.photos[this.index];window.open(a.src)}function favoritePhoto(){var b=this.photos[this.index],d=this.win.document,a=REST_URL+"markfeatured?id"+b.id;try{var e=getResponse(a,false,true)}catch(c){return}}function hideOverlappingElements(a){var b=this;if(a==undefined){a=b.win.document.body;b.hideOverlappingElements(a);return}if(a.style!=undefined&&a.style.visibility!="hidden"){var c=a.nodeName.toLowerCase();if(a.className!=undefined&&a.className.indexOf("SlideshowDoHide")!=-1||(IE||FIREFOX)&&(c=="select"||c=="object"||c=="embed")){a.style.visibility="hidden";if(b.hiddenElements==undefined)b.hiddenElements=[];b.hiddenElements.push(a)}}if(a.childNodes!=undefined)for(var d=0;d<a.childNodes.length;d++)b.hideOverlappingElements(a.childNodes[d])}function showOverlappingElements(){var a=this,b;if(a.hiddenElements!=undefined){for(b=0;b<a.hiddenElements.length;b++)a.hiddenElements[b].style.visibility="visible";a.hiddenElements=[]}}function viewerHandleKey(b){var c=true;if(typeof getViewer=="undefined"||!getViewer)return c;var a=getViewer();if(a==undefined||!a.shown)return c;b=getEvent(b);if(b.ctrlKey||b.altKey)return c;var d=b.keyCode;switch(d){case 37:case 38:a.prev();break;case 39:case 40:a.next();break;case 33:a.prev(10);break;case 34:a.next(10);break;case 36:a.first();break;case 35:a.last();break;case 32:case 13:a.slideShow(c);break;case 27:a.close();break;default:return c}preventDefault(b);return false}function flickrHack(b,c){if(b.photos[c]!=undefined){var a=b.photos[c].preloadImage;if(a!=undefined&&a.width==500&&a.height==375){var d=/.+static\.flickr\.com.+_b\.jpg/;if(d.test(a.src)){b.photos[c].src=b.photos[c].src.replace(/_b\.jpg/,"_o.jpg");return true}}}return false}function findPhotosTT(e,a){var c;if(a.nodeName.toLowerCase()=="a"){var d=a.getAttribute("onclick");if(d==undefined)d=a.onclick;if(d!=undefined&&(new String(d)).indexOf("popupImg")!=-1){var j=/.*popupImg\((.+?),(.+?),(.+?)\).*/;if(j.test(d)){var b,g,f;if(a.photoUrl!=undefined){b=a.photoUrl;g=a.photoW;f=a.photoH}else{b=RegExp.$1;if(b.charAt(0)=="'"&&b.charAt(b.length-1)=="'")b=b.substring(1,b.length-1);g=parseInt(RegExp.$2);f=parseInt(RegExp.$3)}var i=new PhotoImg(undefined,b,g,f),h=false;for(c=0;c<e.photos.length;c++)if(e.photos[c].src==i.src){h=true;break}!h&&e.add(i)}}}if(a.childNodes!=undefined)for(c=0;c<a.childNodes.length;c++)findPhotosTT(e,a.childNodes[c])}var defaultViewer=undefined;function popupImg(d,f,e,b,c){var a;if(defaultViewer==undefined)defaultViewer=new PhotoViewer;else{defaultViewer.photos=[];defaultViewer.index=0}b!=undefined&&defaultViewer.setBackground(b,b,false);if(c==undefined||c){findPhotosTT(defaultViewer,window.document.body);for(a=0;a<defaultViewer.photos.length;a++)defaultViewer.photos[a].src==d&&defaultViewer.show(a)}if(defaultViewer.photos===undefined||defaultViewer.photos.length===0){defaultViewer.setShowToolbar(false);defaultViewer.add(new PhotoImg(undefined,d,f,e));defaultViewer.show()}return false}function onClickEvent(){var a=getViewer();if(a.contextMenu!=undefined&&a.contextMenu.visible){a.contextMenu.hide();return}a.toolbarAnimator!=undefined&&a.toolbarAnimator.reset();if(a.customOnClickEvent!=undefined)a.customOnClickEvent();else closeViewer()}function onContextMenuEvent(b){var a=getViewer(),c=getEvent(b);if(a.contextMenu==undefined&&a.customOnRightclickEvent==undefined)return true;c.cancelBubble=true;a.customOnRightclickEvent!=undefined&&a.customOnRightclickEvent(b);a.contextMenu!=undefined&&(!a.slideShowRunning||a.slideShowPaused)&&a.contextMenu.show(getMousePosition(b));return false}function setupFragmentIdentifierModePhotoViewer(d,e,c){var a=new PhotoViewer;a.origRootLocation=document.location.href;a.origIFrameLocation=d;a.iframename=e;a.setCloseCallback(a.setStopFragmentIdentifier);for(var b=0;b<c.length;b++)a.add(c[b].url,c[b].title,c[b].date,c[b].byline);window.frames[a.iframename].location=a.origIFrameLocation+"#"+a.origRootLocation;a.checkStartFragmentIdentifier()}function checkStartFragmentIdentifier(){var b=document.location.href;if(b.indexOf("#startphoto=")==-1)window.setTimeout(checkStartFragmentIdentifier,500);else{var c=parseInt(b.substring(b.lastIndexOf("=")+1)),a=getViewer();if(a.origRootLocation.indexOf("#")==-1)a.origRootLocation+="#";if(FIREFOX)window.history.back();else document.location.href=a.origRootLocation;a.show(c)}}function setStopFragmentIdentifier(a){window.frames[getViewer().iframename].location=this.origIFrameLocation+"#stopphoto="+a;checkStartFragmentIdentifier()}function setStartFragmentIdentifier(d){var a=this,b=getRootWindow();if(a.origIFrameLocation==undefined)a.origIFrameLocation=b.location.href.substring(0,b.location.href.indexOf("#"));if(a.origRootLocation==undefined)a.origRootLocation=b.location.href.substring(b.location.href.indexOf("#")+1);a.checkStopFragmentIdentifier();var c="#startphoto="+d;b.parent.location=a.origRootLocation+c}function checkStopFragmentIdentifier(){var b=getRootWindow().location.href;if(b.indexOf("#stopphoto")==-1)window.setTimeout(checkStopFragmentIdentifier,500);else{var a=getViewer(),c=b.substring(b.lastIndexOf("=")+1);if(a.origIFrameLocation.indexOf("#")==-1)a.origIFrameLocation+="#";if(FIREFOX)window.history.back();else getRootWindow().location.href=a.origIFrameLocation;viewerCloseCallback(c)}}function ToolbarAnimator(a){this.viewer=a}ToolbarAnimator.prototype.initialize=function(){var e=this,d=findDOMElement(VIEWER_ID_BACK),c=findDOMElement(VIEWER_ID_PHOTO),b=findDOMElement(VIEWER_ID_TOOLBAR);if(d!=undefined&&c!=undefined&&b!=undefined){var a=function(){e.mouseAction()};d.onmousemove=a;c.onmousemove=a;b.onmousemove=a;b.onclick=a;this.initialized=true}};ToolbarAnimator.prototype.reset=function(){var a=null;this.stop();var d=findDOMElement(VIEWER_ID_BACK),c=findDOMElement(VIEWER_ID_PHOTO),b=findDOMElement(VIEWER_ID_TOOLBAR);if(d!=undefined&&c!=undefined&&b!=undefined){d.onmousemove=a;c.onmousemove=a;b.onmousemove=a;b.onclick=a}this.initialized=false};ToolbarAnimator.prototype.stop=function(){var a=this,b=a;if(a.hiderID!=undefined){window.clearTimeout(a.hiderID);a.hiderID=undefined}a.hidden&&a.showToolbar()};ToolbarAnimator.prototype.mouseAction=function(){this.stop()};ToolbarAnimator.prototype.slideshowAction=function(){var a=this,b=a;if(a.viewer.slideShowRunning&&!a.viewer.slideShowPaused&&a.hiderID==undefined){!a.initialized&&a.initialize();a.hiderID=window.setTimeout(function(){b.hideToolbar()},5e3)}else a.viewer.slideShowPaused&&a.reset()};ToolbarAnimator.prototype.hideToolbar=function(){var c=this,b=findDOMElement(VIEWER_ID_TOOLBAR);if(b==undefined)return;var a=b.style.KhtmlOpacity;if(a==undefined)a=b.style.opacity;if(a===0){b.style.display="none";return}a=a-.05;setOpacity(b,a>0?a:0);this.hidden=true;this.hiderID=window.setTimeout(function(){c.hideToolbar()},100)};ToolbarAnimator.prototype.showToolbar=function(){var a=findDOMElement(VIEWER_ID_TOOLBAR);if(a!=undefined){a.style.display="block";setOpacity(a,TOOLBAR_OPACITY)}this.hidden=false};function addContextMenu(a){if(isHosted()||getViewer().contextMenu!=undefined)return;this.contextMenu=a;this.contextMenu.initialize()}function PhotoViewerCtxMenuItem(b,a){this.text=b;this.callback=a}function PhotoViewerCtxMenu(a){this.cssClass=a;this.items=[];this.ctxSubMenus=[]}PhotoViewerCtxMenu.prototype.mouseover=function(i){var h=getViewer(),b=h.contextMenu;if(!b.visible)return;for(var d=0;d<b.ctxSubMenus.length;d++)b.ctxSubMenus[d].style.visibility="hidden";var e=this.id+"_sub",a=document.getElementById(e),c=this.parentNode.parentNode,j=getMousePosition(i),f=getDOMLocation(this),g=getDOMLocation(c);if(a&&c){a.style.left=g.x+c.clientWidth+"px";a.style.top=f.y+"px";a.style.visibility="visible"}};PhotoViewerCtxMenu.prototype.mouseclick=function(g){for(var d=getViewer(),b=d.contextMenu,c=undefined,a=0;a<b.items.length;a++){if(b.items[a].DOMElement==this){c=b.items[a];break}var f=false;if(b.items[a].subitems==undefined)continue;for(var e=0;e<b.items[a].subitems.length;e++)if(b.items[a].subitems[e].DOMElement.id===this.id){c=b.items[a].subitems[e];f=true;break}if(f)break}if(c!=undefined&&c.callback!=undefined){d.contextMenu.hide();c.callback(d.photos[d.index].src,g)}};PhotoViewerCtxMenu.prototype.add=function(a,b){a.subitems=b;this.items.push(a)};PhotoViewerCtxMenu.prototype.initialize=function(){var a=getViewer(),b=a.win.document;this.createMenu(b,a);this.initialized=true};PhotoViewerCtxMenu.prototype.createMenu=function(e,h){var a=this,c=e.createElement("div");c.id=VIEWER_ID_CTXMENU;c.style.visibility="hidden";c.style.position="absolute";c.style.zIndex=999999;for(var f=e.createElement("ul"),d=0;d<a.items.length;d++){var b=e.createElement("li");b.appendChild(e.createTextNode(a.items[d].text));b.onclick=a.mouseclick;b.id=VIEWER_ID_CTXMENU+"_"+d;b.onmouseover=a.mouseover;a.items[d].DOMElement=b;f.appendChild(b);if(a.items[d].subitems!=undefined){b.className="ctxmenu_expanded";var g=b.id+"_sub";a.createSubMenu(e,h,a.items[d].subitems,g)}}c.appendChild(f);c.className=a.cssClass;e.body.appendChild(c);a.ctxMenuDOM=c};PhotoViewerCtxMenu.prototype.createSubMenu=function(c,h,e,g){var a=c.createElement("div");a.id=g;a.style.visibility="hidden";a.style.position="absolute";a.style.zIndex=999999;for(var f=c.createElement("ul"),d=0;d<e.length;d++){var b=c.createElement("li");b.id=g+"_"+d;b.appendChild(c.createTextNode(e[d].text));b.onclick=this.mouseclick;e[d].DOMElement=b;f.appendChild(b)}a.appendChild(f);a.className=this.cssClass;c.body.appendChild(a);this.ctxSubMenus.push(a)};PhotoViewerCtxMenu.prototype.show=function(c){var a=this;!a.initialized&&a.initialize();for(var b=0;b<a.ctxSubMenus.length;b++)a.ctxSubMenus[b].style.visibility="hidden";a.ctxMenuDOM.style.left=c.x+"px";a.ctxMenuDOM.style.top=c.y+"px";a.ctxMenuDOM.style.visibility="visible";a.visible=true};PhotoViewerCtxMenu.prototype.hide=function(){var a=this;a.ctxMenuDOM.style.visibility="hidden";for(var b=0;b<a.ctxSubMenus.length;b++)a.ctxSubMenus[b].style.visibility="hidden";a.visible=false};
