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