var ids_dibujados_pan=new Array();var marker_dibujados_pan=new Array();var marker_sel=null;function PanoramioLayerCallback(e,a){for(var d=0;d<e.photos.length;d++){var c=e.photos[d];if(ids_dibujados_pan[c.photo_id]!=1){var b=this.createMarker(c,a.markerIcon);map.addOverlay(b);ids_dibujados_pan[c.photo_id]=1;marker_dibujados_pan[c.photo_id]=b}}}PanoramioLayerCallback.prototype.formImgUrl=function(a,b){return"http://www.panoramio.com/photos/"+b+"/"+a+".jpg"};PanoramioLayerCallback.prototype.formPageUrl=function(a){return"http://www.panoramio.com/photo/"+a};PanoramioLayerCallback.prototype.createMarker=function(c,e){var a=new GIcon(e);a.image=this.formImgUrl(c.photo_id,"mini_square");var b=new GMarker(new GLatLng(c.latitude,c.longitude),{icon:a,title:c.photo_title});if(c.photo_title.length>33){c.photo_title=c.photo_title.substring(0,33)+"&#8230;"}var d="<div id='infowin' style='height:320px; width:240px;'><p><a href='http://www.panoramio.com/' target='_blank'><img src='http://www.panoramio.com/img/logo-small.gif' border='0' width='119px' height='25px' alt='Panoramio logo' /></a></p><a id='photo_infowin' target='_blank' href='"+c.photo_url+"'><img border='0' width='"+c.width+"' height='"+c.height+"' src='"+c.photo_file_url+"'/></a><div style='overflow: hidden; width: 240px;'><p><a target='_blank' class='photo_title' href='"+c.photo_url+"'><strong>"+c.photo_title+"</strong></a></p><p>Posted by <a target='_blank' href='"+c.owner_url+"'>"+c.owner_name+"</a></p></div></div>";b.html=d;GEvent.addListener(b,"click",function(){b.openInfoWindow(b.html)});GEvent.addListener(b,"infowindowopen",function(){marker_sel=b});GEvent.addListener(b,"infowindowclose",function(){marker_sel=null});return b};function PanoramioLayer(c,d){var b=this;b.ids={};ids_dibujados_pan={};marker_dibujados_pan={};var a=new GIcon();a.image="http://www.panoramio.com/img/panoramio-marker.png";a.shadow="";a.iconSize=new GSize(24,24);a.shadowSize=new GSize(22,22);a.iconAnchor=new GPoint(9,9);a.infoWindowAnchor=new GPoint(9,0);b.markerIcon=a;b.enabled=false;GEvent.addListener(c,"moveend",function(){if(b.enabled){var g=c.getBounds();var f=g.getSouthWest();var e=g.getNorthEast();b.load(b,{maxy:e.lat(),miny:f.lat(),maxx:e.lng(),minx:f.lng()})}})}PanoramioLayer.prototype.enable=function(){this.enabled=true;for(id_m in ids_dibujados_pan){if(id_m>0){marker_dibujados_pan[id_m].show()}}GEvent.trigger(map,"moveend")};PanoramioLayer.prototype.disable=function(){this.enabled=false;if(marker_sel!=null){marker_sel.closeInfoWindow()}for(id_m in ids_dibujados_pan){if(id_m>0){marker_dibujados_pan[id_m].hide()}}};PanoramioLayer.prototype.getEnabled=function(){return this.enabled};PanoramioLayer.prototype.load=function(panoLayer,userOptions){var options={order:"popularity",set:"public",from:"0",to:"15",minx:"-180",miny:"-90",maxx:"180",maxy:"90",size:"small"};for(optionName in userOptions){if(userOptions.hasOwnProperty(optionName)){options[optionName]=userOptions[optionName]}}var url="http://www.panoramio.com/map/get_panoramas.php?";var uniqueID="";for(optionName in options){if(options.hasOwnProperty(optionName)){var optionVal=""+options[optionName]+"";url+=optionName+"="+optionVal+"&";uniqueID+=optionVal.replace(/[^\w]+/g,"")}}var callbackName="PanoramioLayerCallback.loader"+uniqueID;eval(callbackName+" = function(json) { var pa = new PanoramioLayerCallback(json, panoLayer);}");var script=document.createElement("script");script.setAttribute("src",url+"callback="+callbackName);script.setAttribute("id","jsonScript");script.setAttribute("type","text/javascript");document.documentElement.firstChild.appendChild(script)};