/* * (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 */ 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 IMG_ROOT="/jsmap";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 console=undefined;try{console=document.createElement("textarea");console.style.display="none";console.style.position="absolute"; console.style.right="2px";console.style.bottom="2px";console.style.width="23em";console.style.height="40em";console.style.fontFamily="monospace"; console.style.fontSize="9px";console.style.color="#c0c0c0";setOpacity(console,0.7);console.border="1px solid #808080";console.ondblclick=clearLogger;} catch(e){} this.console=console;this.enabled=false;this.logTimeStart=getTimeMillis();} function getLogger(){var log=undefined;var win=window;while(log==undefined){try{log=win.document.log;}catch(e){break;} if(win==win.parent) break;win=win.parent;} if(log==undefined){log=new Logger();document.log=log;} return log;} 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(msg){this.log("DEBUG",msg);} function loggerInfo(msg){this.log("INFO",msg);} function loggerError(msg,e){this.log("ERROR",msg,e);} function loggerLog(level,msg,e){if(!this.enabled||this.console==undefined) return;var millis=(getTimeMillis()-this.logTimeStart)+"";while(millis.length<6) millis+=" ";var m=millis+" ";if(msg!=undefined) m+=msg+" ";if(e!=undefined) m+=e.name+": "+e.message;this.console.value+=m+"\n";} function loggerClear(){if(!this.enabled||this.console==undefined) return;this.console.value="";} function getTimeMillis(){var t=new Date();return Date.UTC(t.getFullYear(),t.getMonth(),t.getDay(),t.getHours(),t.getMinutes(),t.getSeconds(),t.getMilliseconds());} function getEvent(event){return(event!=undefined?event:window.event);} function preventDefault(event){if(event.preventDefault){event.preventDefault();event.stopPropagation();}else{event.returnValue=false;event.cancelBubble=true;}} function getEventTarget(event){if(event.srcElement!=undefined) return event.srcElement;else return event.target;} function getResponse(url,async,getXML,callback,data){var req=undefined;try{req=new ActiveXObject("Msxml2.XMLHTTP");}catch(e1){try{req=new ActiveXObject("Microsoft.XMLHTTP");}catch(e2){req=new XMLHttpRequest();}} if(req==undefined){log.error("Failed to initialize XML/HTTP");return undefined;} req.open("GET",url,async);if(!async){req.send(undefined);if(req.readyState!=4){log.error("Request failed: "+req.readyState);return undefined;} if(!getXML) return req.responseText;else return req.responseXML;}else{req.onreadystatechange=function(){callback(req,data);};req.send(undefined);return undefined;}} function getElementsByTagName(node,tag){if(node==undefined) return undefined;if(tag.indexOf(":")!=-1&&!IE){tag=tag.split(":")[1];return node.getElementsByTagName(tag);}else{return node.getElementsByTagName(tag);}} function getFirstElementsValue(node,tag){if(node==undefined) return undefined;var nodes=getElementsByTagName(node,tag);if(nodes.length===0) return undefined;else return getElementValue(nodes[0]);} function getElementValue(node){var i;var val="";for(i=0;i=this.photos.length){log.error("Invalid photo index");return true;} var doc=this.win.document;if(!this.shown){doc.viewer=this;try{this.hideOverlappingElements();}catch(e){}} this.shown=true;var zIndex=16384;var winSize=getWindowSize(this.win);var availW=winSize.w-20;var availH=winSize.h-20;var scrollPos=getScrollPos(this.win);var scrollLeft=scrollPos.left;var scrollTop=scrollPos.top;this.addBackShade(zIndex);if(this.showToolbar){this.addToolbar(availW,zIndex);this.addCaptions();} var photo=this.photos[this.index];if(isNaN(photo.w)||isNaN(photo.h)){if(photo.preloadImage!=undefined){if(isNaN(photo.w)&&photo.preloadImage.width>0) photo.w=photo.preloadImage.width;if(isNaN(photo.h)&&photo.preloadImage.height>0) photo.h=photo.preloadImage.height;}else{this.index--;this.next();return false;}} var offset=20;var pw=-1;var ph=-1;if(parseInt(photo.w)>availW||parseInt(photo.h)>availH){if(parseInt(photo.w)/availW>parseInt(photo.h)/availH){pw=availW-offset;ph=parseInt(pw*photo.h/photo.w);}else{ph=availH-offset;pw=parseInt(ph*photo.w/photo.h);}}else{pw=parseInt(photo.w);ph=parseInt(photo.h);} if(pw<=0||ph<=0){if(!this.showToolbar) throw"Missing photo dimension";} if(cropWidth==undefined) cropWidth=0;var photoDiv=doc.createElement("div");photoDiv.style.visibility="hidden";photoDiv.style.position="absolute";photoDiv.style.zIndex=zIndex;photoDiv.style.overflow="hidden";photoDiv.style.border=this.borderWidth+"px solid "+this.borderColor;photoDiv.style.textAlign="center";photoDiv.style.backgroundColor=this.backgroundColor;var photoElt=doc.createElement("img");photoElt.style.visibility="hidden";photoElt.style.position="relative";photoElt.style.backgroundColor=this.backgroundColor;photoElt.style.cursor="pointer";photoElt.style.zIndex=(parseInt(photoDiv.style.zIndex)+1)+"";photoElt.onclick=closeViewer;if(opacity!=undefined&&this.fadePhotos){var fadeElt=(FADE_BORDER?photoDiv:photoElt);setOpacity(fadeElt,opacity);} var left=parseInt((availW-pw)/2)+OFFSET_LEFT;photoDiv.style.left=(left+scrollLeft+cropWidth/2)+"px";var top=parseInt((availH-ph)/2)+OFFSET_TOP;photoDiv.style.top=(top+scrollTop)+"px";photoElt.style.visibility="hidden";photoDiv.style.width=(pw-cropWidth)+"px";photoDiv.style.height=ph+"px";photoElt.style.width=pw+"px";photoElt.style.height=ph+"px";photoElt.src=photo.src;photoDiv.style.visibility="visible";photoElt.style.visibility="visible";photoDiv.appendChild(photoElt);doc.body.appendChild(photoDiv);if(this.photoDiv!=undefined){try{doc.body.removeChild(this.photoDiv);}catch(e){}} this.photoDiv=photoDiv;this.photoImg=photoElt;this.setLoading(false);if(this.showCallback!=undefined) this.showCallback(this.index);return false;} function isPhotoShown(){return this.shown;} function closeViewer(){getViewer().close();} function onPhotoLoad(event){var viewer=getViewer();if(viewer!=undefined){if(flickrHack(viewer,viewer.index)){viewer.setLoading(false);viewer.index--;viewer.next();return;} viewer.show();}} function closePhoto(){var win=this.win;if(win==undefined) win=window;var doc=win.document;var elt=this.photoDiv;if(elt!=undefined) doc.body.removeChild(elt);elt=doc.getElementById(VIEWER_ID_BACK);if(elt!=undefined) doc.body.removeChild(elt);elt=doc.getElementById(VIEWER_ID_TOOLBAR);if(elt!=undefined) doc.body.removeChild(elt);this.shown=false;this.slideShowRunning=false;this.slideShowPaused=false;try{this.showOverlappingElements();}catch(e){} if(this.closeCallback!=undefined) this.closeCallback(this.index);} function nextPhoto(n){if(this.isLoading) return;if(n==undefined) n=1;var oldIndex=this.index;if(this.index+n>=this.photos.length){if(n>1) this.index=this.photos.length-1;else return;}else if(this.index+n<0){if(n<-1) this.index=0;else return;}else{this.index+=n;} if(this.index==oldIndex) return;this.slideShowStop();var img=new Image();this.photos[this.index].preloadImage=img;this.setLoading(true);img.onload=onPhotoLoad;img.onerror=onPhotoLoad;img.src=this.photos[this.index].src;} function prevPhoto(n){if(n==undefined) n=1;this.next(-n);} function firstPhoto(){this.prev(this.photos.length);} function lastPhoto(){this.next(this.photos.length);} var slideTimeout;var slidePreloadImageLoaded=false;var slidePreloadTime=undefined;function slideShow(start){var doc=this.win.document;var viewer=this;var photoElt=this.photoImg;if(photoElt==undefined) return;var photoDiv=this.photoDiv;var fadeElt=(FADE_BORDER?photoDiv:photoElt);if(start!=undefined&&start===true){if(this.isLoading){return;} if(this.slideShowPaused){this.slideShowPaused=false;this.setToolbarImage(P_IMG_ROOT+TOOLBAR_IMG_RUNNING);return;}else if(this.slideShowRunning){this.slideShowPaused=true;this.setToolbarImage(P_IMG_ROOT+TOOLBAR_IMG);return;}else{this.slideShowRunning=true;this.slideShowPaused=false;this.slideFirstPhoto=true;this.setToolbarImage(P_IMG_ROOT+TOOLBAR_IMG_RUNNING);}}else if(this.slideShowPaused){window.setTimeout(function(){viewer.slideShow(false);},200);return;}else if(!this.slideShowRunning){this.setToolbarImage(P_IMG_ROOT+TOOLBAR_IMG);return;} var left=0;if(photoElt.leftOffset!=undefined){left=parseFloat(photoElt.leftOffset);} if(left===0){if(this.index-SLIDE_OFFSET){left-=MOVE_STEP;if(-left<=FADE_STEPS){if(fadeElt.style.opacity!=undefined&&parseFloat(fadeElt.style.opacity)<1){if(this.fadePhotos&&this.photos[this.index].src!=undefined) setOpacity(fadeElt,-left/FADE_STEPS);}}else if(left+SLIDE_OFFSETPRELOAD_TIMEOUT) slidePreloadImageLoaded=true;left++;this.setLoading(true);}else{if(this.fadePhotos&&this.photos[this.index].src!=undefined) setOpacity(fadeElt,(left+SLIDE_OFFSET)/FADE_STEPS);}} photoElt.leftOffset=left;if(this.panPhotos&&!this.slideFirstPhoto){photoElt.style.left=left+"px";}}else{if(this.index>=this.photos.length-1){this.slideShowStop();this.close();return;} this.index++;this.slideFirstPhoto=false;this.show(undefined,(this.panPhotos?SLIDE_OFFSET:0),0);fadeElt=(FADE_BORDER?this.photoDiv:this.photoImg);if(this.fadePhotos) setOpacity(fadeElt,0);this.photoImg.leftOffset=0;if(this.panPhotos) this.photoImg.style.left="0px";} var pause=this.slideDuration/SLIDE_OFFSET;if(this.slideFirstPhoto){pause/=2;} slideTimeout=window.setTimeout(function(){viewer.slideShow(false);},pause);} function onSlideLoad(event){var viewer=getViewer();if(viewer!=undefined){if(flickrHack(viewer,viewer.index+1)){var slidePreloadImage=viewer.photos[viewer.index+1].preloadImage;slidePreloadImage.src=viewer.photos[viewer.index+1].src;slidePreloadTime=getTimeMillis();return;} slidePreloadImageLoaded=true;viewer.setLoading(false);}} function slideShowStop(){this.slideShowRunning=false;this.slideShowPaused=false;var doc=this.win.document;var photoElt=this.photoImg;if(photoElt!=undefined){if(this.fadePhotos){var fadeElt=(FADE_BORDER?this.photoDiv:photoElt);setOpacity(fadeElt,1);} photoElt.style.left="0px";}} function addBackShade(zIndex){var doc=this.win.document;if(doc.getElementById(VIEWER_ID_BACK)!=undefined){return;} var photoBack=doc.createElement("div");photoBack.id=VIEWER_ID_BACK;photoBack.style.top="0px";photoBack.style.left="0px";photoBack.style.bottom="0px";photoBack.style.right="0px";photoBack.style.margin="0";photoBack.style.padding="0";photoBack.style.border="none";if(IE){photoBack.style.position="absolute";var docSize=getDocumentSize(this.win);photoBack.style.width=(docSize.w-21)+"px";photoBack.style.height=(docSize.h-4)+"px";}else{photoBack.style.position="fixed";photoBack.style.width="100%";photoBack.style.height="100%";} photoBack.style.zIndex=zIndex-1;photoBack.style.backgroundColor="#ffffff";if(this.backgroundShade) setOpacity(photoBack,0.7);else setOpacity(photoBack,0.0);photoBack.onclick=closeViewer;doc.body.appendChild(photoBack);} function addToolbar(availW,zIndex){var doc=this.win.document;var i;if(doc.getElementById(VIEWER_ID_TOOLBAR)!=undefined) return;var photoToolbar=doc.createElement("div");photoToolbar.id=VIEWER_ID_TOOLBAR;if(IE) photoToolbar.style.position="absolute";else photoToolbar.style.position="fixed";photoToolbar.style.bottom="5px";photoToolbar.style.left=(availW-TOOLBAR_W+10)/2+"px";photoToolbar.style.width=TOOLBAR_W+"px";photoToolbar.style.height=TOOLBAR_H+"px";photoToolbar.style.textAlign="center";setOpacity(photoToolbar,0.7);photoToolbar.style.zIndex=zIndex+1;var imgBack=TOOLBAR_IMG_BACK;if(!isHosted()){imgBack+="-nologo";} if(IE&&!IE7){imgBack+="-indexed";} imgBack+=".png";photoToolbar.style.backgroundImage="url('"+P_IMG_ROOT+imgBack+"')";photoToolbar.style.backgroundPosition="50% 100%";photoToolbar.style.backgroundRepeat="no-repeat";var imgMap=doc.createElement("map");imgMap.name=VIEWER_ID_TOOLBAR_MAP;imgMap.id=VIEWER_ID_TOOLBAR_MAP;var areas=[["document.viewer.first()","17","Go to Start (Home)"],["document.viewer.prev()","68","Previous Photo (Left arrow)"],["document.viewer.slideShow(true)","122","Start/Pause Slide Show (Space)"],["document.viewer.next()","175","Next Photo (Right arrow)"],["document.viewer.last()","227","Go to End (End)"],["document.viewer.email()","300","Email Photo"],["document.viewer.permalink()","350","Link to Photo"],["document.viewer.close()","402","Close (Esc)"]];for(i=0;i