var tz_offset=Math.round((new Date).getTimezoneOffset()/60);function Photo(a,d,c,b){this.map=a;this.exifdata=d;this.trackpoints=c;this.tracktimes=b;this.pmarker=null}
Photo.prototype.locate=function(){var a=this.locateTimeInTracklog(this.exifdata.date+tz_offset*3600);if(a!==null){this.exifdata.lon=a.lng();this.exifdata.lat=a.lat();this.showPhotoMarker();document.getElementById("locateresult").innerHTML=TEXT.comp_coord+": "+TEXT.lat+": "+a.lat().toFixed(5)+" "+TEXT.lon+" : "+a.lng().toFixed(5)+"<br />Flickr Tags: geotagged geo:lat="+a.lat().toFixed(5)+" geo:lon="+a.lng().toFixed(5)+"<br />";document.getElementById("locatedownload").innerHTML='<a href="downloadphoto.php?fileid='+
encodeURIComponent(this.exifdata.fileid)+"&amp;original_name="+encodeURIComponent(this.exifdata.original_name)+"&amp;lat="+a.lat().toFixed(5)+"&amp;lon="+a.lng().toFixed(5)+'">Download</a> '+TEXT.photo_with_tags}else{document.getElementById("locateresult").innerHTML=TEXT.not_within_track+"<br />";document.getElementById("locatedownload").innerHTML=""}};
Photo.prototype.locateTimeInTracklog=function(a){for(var d,c,b=0;b<this.tracktimes.length-1;b++){d=this.tracktimes[b];c=this.tracktimes[b+1];if(a>=d&&a<c)return this.trackpoints[b]}return null};Photo.prototype.changeOffset=function(a){if(tz_offset!==a){tz_offset=a;this.removeMarker();this.locate()}};Photo.prototype.showPhotoMarker=function(){this.pmarker=this.createLocatedPhotoMarker();this.map.addOverlay(this.pmarker);this.map.removeOverlay(this.pmarker);this.map.addOverlay(this.pmarker);this.map.setCenter(this.pmarker.getPoint())};
Photo.prototype.createLocatedPhotoMarker=function(){var a=new GMarker(new GLatLng(this.exifdata.lat,this.exifdata.lon),photoicon),d=this.exifdata.fileid,c='<div class="markerinfo">geo:lat='+this.exifdata.lat.toFixed(5)+" geo:lon="+this.exifdata.lon.toFixed(5)+"<br />",b;if(this.exifdata.time>0){b=new Date(this.exifdata.time*1E3);c+="time created: "+b.toGMTString()}c+="</div>";GEvent.addListener(a,"click",function(){displayThumbnail(d);a.openInfoWindowHtml(c)});return a};
Photo.prototype.removeMarker=function(){this.pmarker&&this.map.removeOverlay(this.pmarker)};
