/*
 * (c) Copyright 2006, Klika, all rights reserved.
 *
 * This code is the property of Klika d.o.o. The code 
 * may not be included in, invoked from, or otherwise 
 * used in any software, service, device, or process 
 * which is sold, exchanged for profit, or for which 
 * a license, subscription, or royalty fee is charged.
 *
 * Permission is granted to use this code for personal,
 * educational, research, or commercial purposes, provided 
 * this notice is included, and provided this code is not 
 * used as described in the above paragraph.
 *
 * This code may not be modified without express
 * permission of Klika. You may not delete, disable, or in
 * any manner alter distinctive brand features rendered
 * by the code. The use of this code in derivative work is
 * permitted, provided that the code and this notice are 
 * included in full, and provided that the code is used in
 * accordance with these terms.
 *
 * Email: info at triptracker.net
 * Web:   http://slideshow.triptracker.net
 */
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 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(E,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 D=C;D=D.replace(/yyyy/g,A.getFullYear());D=D.replace(/yy/g,padNumber(A.getFullYear()%100,2));D=D.replace(/MM/g,padNumber(A.getMonth()+1,2));D=D.replace(/M/g,A.getMonth()+1);D=D.replace(/dd/g,padNumber(A.getDate(),2));D=D.replace(/d/g,A.getDate());D=D.replace(/HH/g,padNumber(A.getHours(),2));D=D.replace(/H/g,A.getHours());D=D.replace(/hh/g,padNumber(A.getHours()%12,2));D=D.replace(/h/g,A.getHours()%12);D=D.replace(/mm/g,padNumber(A.getMinutes(),2));D=D.replace(/m/g,A.getMinutes());D=D.replace(/ss/g,padNumber(A.getSeconds(),2));D=D.replace(/s/g,A.getSeconds());var B=(A.getHours()<12?"AM":"PM");D=D.replace(/a/g,B);return D}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 E=A.lastIndexOf(":");if(E!=-1){A=A.substring(0,E)}if(A.indexOf("www.")===0){A=A.substring(4)}if(A===""||A=="localhost"||A=="127.0.0.1"){return true}var B=_DOMAIN.toLowerCase();E=B.indexOf("://");if(E!=-1){B=B.substring(E+3)}E=B.indexOf("/");if(E!=-1){B=B.substring(0,E)}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.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.hideOverlappingElements=hideOverlappingElements;this.showOverlappingElements=showOverlappingElements;this.addContextMenu=addContextMenu;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.enablePhotoLink=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(G,F,A,C,D,E,B){this.id=G;this.src=F;this.w=parseInt(A,10);this.h=parseInt(C,10);this.time=D;this.title=E;this.byline=B}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,E,D,B){var C=typeof A;if(typeof A=="string"){A=new PhotoImg(undefined,A,undefined,undefined,D,E,B)}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.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 showPhoto(H,A,E){if(this.photos.length===0){return true}if(getRootWindow().permissionDenied&&this.badgeMode==undefined&&!getRootWindow().livemode){this.setStartFragmentIdentifier(H);return true}if(H!=undefined){this.index=H}if(this.index<0||this.index>=this.photos.length){log.error("Invalid photo index");return true}var V=this.win.document;var U=false;if(!this.shown){U=true;V.viewer=this;try{this.hideOverlappingElements()}catch(S){}}var O=16384;var I=getWindowSize(this.win);var B=I.w-(this.nopadding?this.borderWidth*2:20);var K=I.h-(this.nopadding?this.borderWidth*2:20);var R=getScrollPos(this.win);var P=R.left;var C=R.top;this.addBackShade(O);this.addByLine(O);this.addBylineCaption();if(this.showToolbar){this.addToolbar(B,O);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}}this.shown=true;var G=(this.nopadding?0:20);var N=-1;var T=-1;if(parseInt(D.w)>B||parseInt(D.h)>K){if(parseInt(D.w)/B>parseInt(D.h)/K){N=B-G;T=parseInt(N*D.h/D.w)}else{T=K-G;N=parseInt(T*D.w/D.h)}}else{N=parseInt(D.w);T=parseInt(D.h)}if(N<=0||T<=0){if(!this.showToolbar){throw"Missing photo dimension"}}if(A==undefined){A=0}var Q=V.createElement("div");Q.id=VIEWER_ID_PHOTO;Q.style.visibility="hidden";Q.style.position="absolute";Q.style.zIndex=O;Q.style.overflow="hidden";Q.style.border=this.borderWidth+"px solid "+this.borderColor;Q.style.textAlign="center";Q.style.backgroundColor=this.backgroundColor;var J=V.createElement("img");J.style.visibility="hidden";J.style.position="relative";J.style.backgroundColor=this.backgroundColor;J.style.border="none";J.style.cursor="pointer";J.style.zIndex=(parseInt(Q.style.zIndex)+1)+"";J.onclick=onClickEvent;J.oncontextmenu=onContextMenuEvent;if(E!=undefined&&this.fadePhotos){var L=(FADE_BORDER?Q:J);setOpacity(L,E)}var F=parseInt((B-N)/2)+(this.nopadding?0:OFFSET_LEFT);Q.style.left=(F+P+A/2)+"px";var M=parseInt((K-T)/2)+(this.nopadding?0:OFFSET_TOP);Q.style.top=(M+C)+"px";J.style.visibility="hidden";Q.style.width=(N-A>0?N-A:N)+"px";Q.style.height=T+"px";J.style.width=N+"px";J.style.height=T+"px";J.src=D.src;Q.style.visibility="visible";J.style.visibility="visible";Q.appendChild(J);V.body.appendChild(Q);if(this.photoDiv!=undefined){try{V.body.removeChild(this.photoDiv)}catch(S){}}this.photoDiv=Q;this.photoImg=J;this.setLoading(false);if(this.showCallback!=undefined){this.showCallback(this.index)}if(U&&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_BACK);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)}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(M,N){var P=this.win.document;var I;if(P.getElementById(VIEWER_ID_TOOLBAR)!=undefined){return}var G=P.createElement("div");G.id=VIEWER_ID_TOOLBAR;setOpacity(G,TOOLBAR_OPACITY);G.style.zIndex=N+1;var F=TOOLBAR_IMG_BACK;if(!isHosted()){F+="-nologo"}if(IE&&!IE7){F+="-indexed"}F+=".png";if(!this.overrideToolbarStyles){var B=10;if(IE&&!(IE7&&STRICT_MODE)){G.style.position="absolute";if(IE7){var O=getWindowSize(this.win).h+getScrollPos(this.win).top;G.style.top=(O-TOOLBAR_H-10)+"px"}else{G.style.bottom=B+"px"}}else{G.style.position="fixed";G.style.bottom=B+"px"}G.style.left=(M-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=P.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.enablePhotoLink&&TOOLBAR_IMG_MASK!=undefined){E=P.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 Q=this.customImageMap;if(Q===undefined){Q=P.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.enablePhotoLink){A.push(["getViewer().permalink()","350",getMessage("photoviewer.toolbar.permalink")])}A.push(["getViewer().close()","402",getMessage("photoviewer.toolbar.close")]);for(I=0;I<A.length;I++){var D=P.createElement("area");D.href="javascript:void(0)";D.alt=A[I][2];D.title=D.alt;D.shape="circle";D.coords=A[I][1]+", 21, 22";D.onclick=buildAreaMapClosure(A[I][0]);Q.appendChild(D)}}Q.name=VIEWER_ID_TOOLBAR_MAP;Q.id=VIEWER_ID_TOOLBAR_MAP;var H=P.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(Q);G.appendChild(H);if(isHosted()){var L=P.createElement("a");L.style.position="absolute";L.style.bottom="0px";L.style.right="0px";L.style.width="25px";L.style.height="25px";L.style.background="none";L.alt="TripTracker.net";L.title=L.alt;L.cursor=L.alt;L.href=TOOLBAR_LINK;L.target="_new";L.alt="TripTracker Slideshow";L.title=L.alt;G.appendChild(L)}var C=P.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(P.createElement("br"));var J=P.createElement("span");J.id=VIEWER_ID_TIME;if(!this.overrideToolbarStyles){J.position="relative";J.style.color=TOOLBAR_FONT_COLOR;J.style.fontFamily=TOOLBAR_FONT_STYLE;J.style.fontSize=this.fontSize+"px";if(STRICT_MODE){J.style.lineHeight=this.fontSize+"px"}if(this.font!=undefined){J.style.font=this.font}J.style.cssFloat="none";J.style.textAlign="right";J.style.padding="0px 10px"}J.appendChild(P.createTextNode(" "));G.appendChild(J);var K=P.createElement("span");K.id=VIEWER_ID_TITLE;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="left";K.style.paddingRight="20px"}K.appendChild(P.createTextNode(" "));G.appendChild(K);P.body.appendChild(G)}function addByLine(C){var B=this.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=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";A.style.bottom=BYLINE_POSITION_BOTTOM+"px";A.style.zIndex=C+1;A.appendChild(B.createTextNode(" "));B.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 C=this.win.document;var D=(A.title!=undefined?A.title:getMessage("photoviewer.email.subject.photo"));var B="mailto:?subject="+D+"&body="+getPhotoURL(A.src);C.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.src)}function favoritePhoto(){var A=this.photos[this.index];var E=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&&(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 I=C.getAttribute("onclick");if(I==undefined){I=C.onclick}if(I!=undefined&&new String(I).indexOf("popupImg")!=-1){var D=/.*popupImg\((.+?),(.+?),(.+?)\).*/;if(D.test(I)){var B,H,G;if(C.photoUrl!=undefined){B=C.photoUrl;H=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)}H=parseInt(RegExp.$2);G=parseInt(RegExp.$3)}var A=new PhotoImg(undefined,B,H,G);var J=false;for(E=0;E<F.photos.length;E++){if(F.photos[E].src==A.src){J=true;break}}if(!J){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(F){var E=getViewer();var C=E.contextMenu;if(!C.visible){return}for(var D=0;D<C.ctxSubMenus.length;D++){C.ctxSubMenus[D].style.visibility="hidden"}var H=this.id+"_sub";var B=document.getElementById(H);var A=this.parentNode.parentNode;var I=getMousePosition(F);var J=getDOMLocation(this);var G=getDOMLocation(A);if(B&&A){B.style.left=(G.x+A.clientWidth)+"px";B.style.top=J.y+"px";B.style.visibility="visible"}};PhotoViewerCtxMenu.prototype.mouseclick=function(D){var G=getViewer();var F=G.contextMenu;var C=undefined;for(var B=0;B<F.items.length;B++){if(F.items[B].DOMElement==this){C=F.items[B];break}var E=false;if(F.items[B].subitems==undefined){continue}for(var A=0;A<F.items[B].subitems.length;A++){if(F.items[B].subitems[A].DOMElement.id===this.id){C=F.items[B].subitems[A];E=true;break}}if(E){break}}if(C!=undefined&&C.callback!=undefined){G.contextMenu.hide();C.callback(G.photos[G.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};
