function UltraMarker(b,a){this.latlng=b;if(!a){a={}}this.zIndex=a.zIndex;this.preventClick=a.preventClick;this.htmlClass=a.htmlClass;this.height_=a.height||32;this.width_=a.width||32;this.image_=a.image;this.imageOver_=a.imageOver;this.clicked_=0;this.link_=a.link;this.alwaysOnTop=a.alwaysOnTop||false}UltraMarker.prototype=new GOverlay();UltraMarker.prototype.initialize=function(c){var b=this;var a=document.createElement(this.link_?"a":"div");if(this.link_){a.href=this.link_}if(this.preventClick){a.onclick=function(){return false}}a.className="transparent";if(this.htmlClass){a.className+=" "+this.htmlClass}a.style.position="absolute";a.style.paddingLeft="0px";a.style.cursor="pointer";a.style.display="block";a.style.backgroundImage='url("'+this.image_+'")';a.style.backgroundPosition="center center";a.style.backgroundRepeat="no-repeat";GEvent.addDomListener(a,"click",function(d){b.clicked_=1;GEvent.trigger(b,"click");if(!d){var d=window.event}d.cancelBubble=true;if(d.stopPropagation){d.stopPropagation()}if(d.preventDefault){d.preventDefault()}});GEvent.addDomListener(a,"mouseover",function(d){GEvent.trigger(b,"mouseover")});GEvent.addDomListener(a,"mouseout",function(d){GEvent.trigger(b,"mouseout")});c.getPane(G_MAP_MARKER_PANE).appendChild(a);this.map_=c;this.div_=a};UltraMarker.prototype.remove=function(){this.div_.parentNode.removeChild(this.div_)};UltraMarker.prototype.copy=function(){var a={};a.color=this.color_;a.height=this.height_;a.width=this.width_;a.image=this.image_;a.imageOver=this.image_;return new UltraMarker(this.latlng,a)};UltraMarker.prototype.redraw=function(a){if(!a){return}var b=this.map_.fromLatLngToDivPixel(this.latlng);this.div_.style.width=this.width_+"px";this.div_.style.left=(b.x-this.width_/2)+"px";this.div_.style.height=(this.height_)+"px";this.div_.style.top=(b.y-this.height_/2)+"px";this.div_.style.zIndex=""+this.getZIndex()};UltraMarker.prototype.getZIndex=function(a){if(this.zIndex){return this.zIndex}var b=GOverlay.getZIndex(this.getPoint().lat());return this.alwaysOnTop?b+9999:b};UltraMarker.prototype.getPoint=function(){return this.latlng};UltraMarker.prototype.setStyle=function(a){for(s in a){this.div_.style[s]=a[s]}};UltraMarker.prototype.setImage=function(a){this.div_.style.backgroundImage='url("'+a+'")'};UltraMarker.prototype.getLatLng=function(){return this.latlng};UltraMarker.prototype.getSize=function(){return new GSize(this.width_,this.height_)};UltraMarker.prototype.getIcon=function(){var a=this;return{iconSize:a.getSize(),iconAnchor:new GPoint(a.width_/2,a.height_/2)}};function PlaceMarker(c,b,a){UltraMarker.call(this,c,b);this.name=a;this.placeClass=b.placeClass}PlaceMarker.prototype=new UltraMarker();PlaceMarker.prototype.constructor=PlaceMarker;PlaceMarker.prototype.initialize=function(c){UltraMarker.prototype.initialize.call(this,c);var b=document.createElement("div");var a=document.createElement("div");b.appendChild(a);a.className="inner";b.className="placeLabel";b.style.position="absolute";b.style.display="block";a.innerHTML="<nobr>"+this.name+"</nobr>";c.getPane(G_MAP_MARKER_PANE).appendChild(b);this.placeLabel=b};PlaceMarker.prototype.getZIndex=function(a){return this.getPoint().lng()*100};PlaceMarker.prototype.redraw=function(a){if(!a){return}UltraMarker.prototype.redraw.call(this,a);this.placeLabel.style.top=""+(parseInt(this.div_.style.top)+18)+"px";this.placeLabel.style.left=""+(parseInt(this.div_.style.left)+25)+"px";this.div_.style.zIndex=""+parseInt(this.getZIndex());this.placeLabel.style.zIndex=""+(parseInt(this.div_.style.zIndex)-10)};PlaceMarker.prototype.remove=function(){this.div_.parentNode.removeChild(this.div_);this.placeLabel.parentNode.removeChild(this.placeLabel)};(function(a){a.fn.extend({find_pos:function(){if(!this.tagName&&this.length){obj=this[0]}else{return[0,0]}var b=curtop=0;if(obj.offsetParent){b=obj.offsetLeft;curtop=obj.offsetTop;while(obj=obj.offsetParent){b+=obj.offsetLeft;curtop+=obj.offsetTop}}return[b,curtop]}});a.MapTips=function(c){var b=this;var d=c;this.add_tooltip=function(e,f){e.tooltip=f;GEvent.addListener(e,"mouseover",b.show_tooltip);GEvent.addListener(e,"mouseout",b.hide_tooltip)};this.show_tooltip=function(k){var r=d.fromLatLngToContainerPixel(this.getLatLng());var i=null;i=document.getElementById("tipDiv");if(!i){i=document.createElement("div");i.className="maptip";i.id="tipDiv";document.body.appendChild(i)}i.style.display="block";i.innerHTML=this.tooltip;var l=a(d.getContainer()).find_pos();var n=l[0];var m=l[0]+a(d.getContainer()).width();var e=l[1];var j=this.getIcon().iconSize;l[0]+=r.x-j.width/2;l[1]+=r.y-j.height/2;var g=i.offsetHeight+5;var h=i.offsetWidth/2;var q=l[0]-h;var p=l[1]-g;var o=l[0]-h;var f=l[0]-h+i.offsetWidth;if(n>=o){q+=n-o+3}else{if(m<=f){q-=f-m+3}}if(e>=p){p+=g+j.height+10}i.style.top=""+p+"px";i.style.left=""+q+"px"};this.hide_tooltip=function(){var e=document.getElementById("tipDiv");if(e){e.style.display="none"}}}})(jQuery);function ClusterMarker(b,a){this.zIndex=a.zIndex;this._map=b;this._mapMarkers=[];this._iconBounds=[];this._clusterMarkers=[];this._eventListeners=[];if(typeof(a)==="undefined"){a={}}this.borderPadding=(a.borderPadding)?a.borderPadding:256;this.clusteringEnabled=(a.clusteringEnabled===false)?false:true;if(a.clusterMarkerClick){this.clusterMarkerClick=a.clusterMarkerClick}if(a.clusterMarkerMouseOver){this.clusterMarkerMouseOver=a.clusterMarkerMouseOver}if(a.clusterMarkerMouseOut){this.clusterMarkerMouseOut=a.clusterMarkerMouseOut}if(a.clusterMarkerIcon){this.clusterMarkerIcon=a.clusterMarkerIcon}else{this.clusterMarkerIcon=new GIcon();this.clusterMarkerIcon.image="http://maps.google.com/mapfiles/arrow.png";this.clusterMarkerIcon.iconSize=new GSize(39,34);this.clusterMarkerIcon.iconAnchor=new GPoint(9,31);this.clusterMarkerIcon.infoWindowAnchor=new GPoint(9,31);this.clusterMarkerIcon.shadow="http://www.google.com/intl/en_us/mapfiles/arrowshadow.png";this.clusterMarkerIcon.shadowSize=new GSize(39,34)}this.clusterMarkerTitle=(a.clusterMarkerTitle)?a.clusterMarkerTitle:"";if(a.fitMapMaxZoom){this.fitMapMaxZoom=a.fitMapMaxZoom}this.intersectPadding=(a.intersectPadding)?a.intersectPadding:0;if(a.markers){this.addMarkers(a.markers)}GEvent.bind(this._map,"moveend",this,this._moveEnd);GEvent.bind(this._map,"zoomend",this,this._zoomEnd);GEvent.bind(this._map,"maptypechanged",this,this._mapTypeChanged)}ClusterMarker.prototype.addMarkers=function(b){var a;if(!b[0]){var c=[];for(a in b){c.push(b[a])}b=c}for(a=b.length-1;a>=0;a--){b[a]._isVisible=false;b[a]._isActive=false;b[a]._makeVisible=false}this._mapMarkers=this._mapMarkers.concat(b)};ClusterMarker.prototype._clusterMarker=function(b){var j=this;function a(n,i,m){var l={icon:i,title:m};if(j.zIndex){l.zIndexProcess=function(){return j.zIndex}}return new GMarker(n,l)}var h=new GLatLngBounds(),d,e,g=[],k,f=this,c=this._mapMarkers;for(d=b.length-1;d>=0;d--){k=c[b[d]];k.index=b[d];h.extend(k.getLatLng());g.push(k)}e=a(h.getCenter(),this.clusterMarkerIcon,this.clusterMarkerTitle.replace(/%count/gi,b.length));e.clusterGroupBounds=h;this._eventListeners.push(GEvent.addListener(e,"click",function(){f.clusterMarkerClick({clusterMarker:e,clusteredMarkers:g})}));this._eventListeners.push(GEvent.addListener(e,"mouseover",function(){f.clusterMarkerMouseOver({clusterMarker:e,clusteredMarkers:g})}));this._eventListeners.push(GEvent.addListener(e,"mouseout",function(){f.clusterMarkerMouseOut({clusterMarker:e,clusteredMarkers:g})}));e._childIndexes=b;for(d=b.length-1;d>=0;d--){c[b[d]]._parentCluster=e}return e};ClusterMarker.prototype.clusterMarkerClick=function(a){this._map.setCenter(a.clusterMarker.getLatLng(),this._map.getBoundsZoomLevel(a.clusterMarker.clusterGroupBounds))};ClusterMarker.prototype._filterActiveMapMarkers=function(){var k=this.borderPadding,j=this._map.getZoom(),q=this._map.getCurrentMapType().getProjection(),o,c,m,h,n,d,b=this._map.getBounds(),f,p,e=[],l,a=this._mapMarkers,g=this._iconBounds;if(k){o=q.fromLatLngToPixel(b.getSouthWest(),j);c=new GPoint(o.x-k,o.y+k);m=q.fromPixelToLatLng(c,j);h=q.fromLatLngToPixel(b.getNorthEast(),j);n=new GPoint(h.x+k,h.y-k);d=q.fromPixelToLatLng(n,j);b.extend(m);b.extend(d)}this._activeMarkersChanged=false;if(typeof(g[j])==="undefined"){this._iconBounds[j]=[];this._activeMarkersChanged=true;for(f=a.length-1;f>=0;f--){p=a[f];p._isActive=b.containsLatLng(p.getLatLng())?true:false;p._makeVisible=p._isActive;if(p._isActive){e.push(f)}}}else{for(f=a.length-1;f>=0;f--){p=a[f];l=p._isActive;p._isActive=b.containsLatLng(p.getLatLng())?true:false;p._makeVisible=p._isActive;if(!this._activeMarkersChanged&&l!==p._isActive){this._activeMarkersChanged=true}if(p._isActive&&typeof(g[j][f])==="undefined"){e.push(f)}}}return e};ClusterMarker.prototype._filterIntersectingMapMarkers=function(){var e,d,b,a=this._map.getZoom(),f=this._mapMarkers,c=this._iconBounds;for(d=f.length-1;d>0;d--){if(f[d]._makeVisible){e=[];for(b=d-1;b>=0;b--){if(f[b]._makeVisible&&c[a][d].intersects(c[a][b])){e.push(b)}}if(e.length!==0){e.push(d);for(b=e.length-1;b>=0;b--){f[e[b]]._makeVisible=false}this._clusterMarkers.push(this._clusterMarker(e))}}}};ClusterMarker.prototype.getMarkers=function(){return this._mapMarkers||[]};ClusterMarker.prototype.fitMapToMarkers=function(){var f=this._mapMarkers,b=new GLatLngBounds(),g;for(g=f.length-1;g>=0;g--){b.extend(f[g].getLatLng())}var c=b.getSouthWest();var d=b.getNorthEast();var j=Math.abs(c.lat()-d.lat());var h=Math.abs(c.lng()-d.lng());var a=j/10;var k=h/10;c=new GLatLng(c.lat()-a,c.lng()+a);d=new GLatLng(d.lat()+a,d.lng()-a);b.extend(c);b.extend(d);var e=this._map.getBoundsZoomLevel(b);if(this.fitMapMaxZoom&&e>this.fitMapMaxZoom){e=this.fitMapMaxZoom}this._map.setCenter(b.getCenter(),e);this.refresh()};ClusterMarker.prototype._mapTypeChanged=function(){this.refresh(true)};ClusterMarker.prototype._moveEnd=function(){if(!this._cancelMoveEnd){this.refresh()}else{this._cancelMoveEnd=false}};ClusterMarker.prototype._preCacheIconBounds=function(c,h){var n=this._map.getCurrentMapType().getProjection(),g,o,e,a,j,l,f,k,d,m=this.intersectPadding,b=this._mapMarkers;for(g=c.length-1;g>=0;g--){o=b[c[g]];e=o.getIcon().iconSize;a=n.fromLatLngToPixel(o.getLatLng(),h);j=o.getIcon().iconAnchor;l=new GPoint(a.x-j.x-m,a.y-j.y+e.height+m);f=new GPoint(a.x-j.x+e.width+m,a.y-j.y-m);k=n.fromPixelToLatLng(l,h);d=n.fromPixelToLatLng(f,h);this._iconBounds[h][c[g]]=new GLatLngBounds(k,d)}};ClusterMarker.prototype.refresh=function(d){var c,b,e=this._map.getZoom(),a=this._filterActiveMapMarkers();if(this._activeMarkersChanged||d){this._removeClusterMarkers();if(this.clusteringEnabled&&e<this._map.getCurrentMapType().getMaximumResolution()){if(a.length>0){this._preCacheIconBounds(a,e)}this._filterIntersectingMapMarkers()}for(c=this._clusterMarkers.length-1;c>=0;c--){this._map.addOverlay(this._clusterMarkers[c])}for(c=this._mapMarkers.length-1;c>=0;c--){b=this._mapMarkers[c];if(!b._isVisible&&b._makeVisible){this._map.addOverlay(b);b._isVisible=true}if(b._isVisible&&!b._makeVisible){this._map.removeOverlay(b);b._isVisible=false}}}};ClusterMarker.prototype._removeClusterMarkers=function(){var d,b,g=this._map,a=this._eventListeners,f=this._clusterMarkers,c,e=this._mapMarkers;for(d=f.length-1;d>=0;d--){c=f[d]._childIndexes;for(b=c.length-1;b>=0;b--){delete e[c[b]]._parentCluster}g.removeOverlay(f[d])}for(d=a.length-1;d>=0;d--){GEvent.removeListener(a[d])}this._clusterMarkers=[];this._eventListeners=[]};ClusterMarker.prototype.removeMarkers=function(){var a,b=this._mapMarkers,c=this._map;for(a=b.length-1;a>=0;a--){if(b[a]._isVisible){c.removeOverlay(b[a])}delete b[a]._isVisible;delete b[a]._isActive;delete b[a]._makeVisible}this._removeClusterMarkers();this._mapMarkers=[];this._iconBounds=[]};ClusterMarker.prototype.triggerClick=function(h){var k=this._mapMarkers[h];if(k._isVisible){GEvent.trigger(k,"click")}else{if(k._isActive){var f=k._parentCluster._childIndexes,b=true,c,d,g=this._map.getZoom(),j,e=this._iconBounds,a=this._map.getCurrentMapType().getMaximumResolution();while(b&&g<a){b=false;g++;if(typeof(e[g])==="undefined"){e[g]=[];this._preCacheIconBounds(f,g)}else{c=[];for(d=f.length-1;d>=0;d--){if(typeof(e[g][f[d]])==="undefined"){c.push(f[d])}}if(c.length>=1){this._preCacheIconBounds(c,g)}}for(d=f.length-1;d>=0;d--){j=f[d];if(j!==h&&e[g][j].intersects(e[g][h])){b=true;break}}}this._map.setCenter(k.getLatLng(),g);this.triggerClick(h)}else{this._map.setCenter(k.getLatLng());this.triggerClick(h)}}};ClusterMarker.prototype._zoomEnd=function(){this._cancelMoveEnd=true;this.refresh(true)};(function(c){c.fitMapToMarkers=function(g,l){if(l.length==0){return}var q=new GLatLngBounds(),m;for(m=l.length-1;m>=0;m--){q.extend(l[m].getLatLng())}var j=q.getSouthWest();var k=q.getNorthEast();var o=Math.abs(j.lat()-k.lat());var n=Math.abs(j.lng()-k.lng());var f=o/10;var p=n/10;j=new GLatLng(j.lat()-f,j.lng()+f);k=new GLatLng(k.lat()+f,k.lng()-f);q.extend(j);q.extend(k);var h=g.getBoundsZoomLevel(q);if(h>15){h=15}g.setCenter(q.getCenter(),h)};c.fn.positionBy=function(l,k){l=c(l);if(l.length==0){return this}var n=null;var g=l.parents();var j=0;while(!n){var m=c(g[j]);if(m.css("position")=="relative"){n=m}j++}var f=l.offset();var h=n.offset();f.right=f.left+l.width();f.bottom=f.top+l.height();h.right=h.left+n.width();h.bottom=h.top+n.height();return c(this).each(function(){var i=c(this);c.each(["top","left","bottom","right"],function(p,o){if(k[o]!=null){k[o]=Math.abs(h[o]-f[o])+k[o]}});i.css(k)})};c.addTooltip=function(h,g,i){g.itemData=i;var k="";var f="";if(i.main_photo_url&&i.premium){f="content_with_photo";photoStyle="background-image: url("+i.main_photo_url+")";k+='<div class="photo" style="'+photoStyle+'"></div>'}k+='<div class="content '+f+'">';k+=i.name;if(i.average_rating){var l=Math.round((i.average_rating/5)*(10))*10;k+='<div class="ratings"><span class="label">ocena:</span> <div class="stars"><div class="inner" style="width: '+l+'%"></div></div><span class="number">'+c.roundNumber(i.average_rating,1)+"</span></div>"}if(BrowserDetect.browser=="Explorer"&&BrowserDetect.version==6){var j=""}else{var j="Aby otworzyć stronę lokalu w nowej karcie kliknij na gwiazdkę środkowym przyciskiem myszy."}k+='<div class="clear"></div><span class="dbclick_notice">'+j+"</span></div>";h.add_tooltip(g,k)};function d(){c("#map_loading").positionBy("#map_container",{right:0,top:0}).show();c("#tipDiv, #middleClickOverlay").hide()}function b(){c("#map_loading").hide();c("#tipDiv, #middleClickOverlay").hide()}function a(g,f){return Math.floor((f-g-1)*Math.random())+g}function e(h,i,f){if(f<i){var g=f;f=i;i=g}return h<=f&&h>=i}c.gmaps=c.gmaps||{};c.gmaps.filtering=c.gmaps.filtering||{};c.gmaps.consts={earth_radius_in_miles:3963.19,earth_radius_in_kms:6376.77271};c.gmaps.deg2rad=function(f){return f/180*Math.PI};c.gmaps.cut=function(g,f){if(g>f){return f}else{if(g<-f){return -f}else{return g}}};c.gmaps.removeMarkersOutsideBounds=function(l,k){var j=[];for(var g=0;g<l.length;g++){var f=l[g];var h=f.getLatLng();if(k.containsLatLng(h)){j.push(f)}}return j};c.gmaps.getParams=function(f){f=f||{};var g={};if(f.bounds){g=c.extend(g,{lat1:f.bounds.getSouthWest().lat(),lat2:f.bounds.getNorthEast().lat(),lng1:f.bounds.getSouthWest().lng(),lng2:f.bounds.getNorthEast().lng()})}return g};c.fn.gMap=function(f){f=f||{};f=c.extend({},{clusterer:true,startingLongitude:19.2,startingLatitude:52,startingZoom:10,url:"/map/map.json",resourceName:"item",distanceLimit:false,distance:0.02,intersectPadding:0,citiesViewZoom:10,disablePlaces:false,zoomOutOnMarkersOutsideBounds:false},f,c(this).metadata());var g;var h=true;if(f.citiesViewZoom>10){f.citiesViewZoom=10}return c(this).each(function(){var t=c(this);var p=new GLatLng(f.startingLatitude,f.startingLongitude);var u=G_DEFAULT_MAP_TYPES;for(var x=0;x<u.length;x++){u[x].getMaximumResolution=function(i){return 19};u[x].getMinimumResolution=function(i){return 5}}var v=null;var m=null;var D=new GMap2(this);if(f.smallMap){D.addControl(new GSmallMapControl())}else{D.addControl(new GLargeMapControl())}D.setCenter(p,f.startingZoom);D.enableDoubleClickZoom();D.disableScrollWheelZoom();g=new c.MapTips(D);var B=null;var o=false;GEvent.addListener(D,"moveend",function(){if(o){o=false;return}B=setTimeout(function(){t.trigger("gmap.reload")},100)});GEvent.addListener(D,"move",function(){clearTimeout(B)});GEvent.addListener(D,"movestart",function(){clearTimeout(B)});GEvent.addListener(D,"zoomend",function(){console.log(D.getZoom())});var z=[];var y;var w=new GIcon();w.image="/images/map-group.png";w.iconSize=new GSize(25,29);w.iconAnchor=new GPoint(12,14);var r=new GIcon(w);r.iconSize=new GSize(26,28);r.iconAnchor=new GPoint(13,14);r.image="/images/map-main-star.png";if(f.clusterer){function q(E){if(!E.clusterMarker.tooltip){var F='<span class="list">';var G=E.clusteredMarkers.length>4?4:E.clusteredMarkers.length;for(x=0;x<G;x++){var i=E.clusteredMarkers[x];F+=i.itemData.name+"<br/>"}if(E.clusteredMarkers.length>4){var H=(E.clusteredMarkers.length-4);F+="... i "+H+" "+c.pluralize(H,{one:"inny lokal",few:"inne lokale",many:"innych lokali"})+"<br/>"}F+='</span><span class="click_to_zoom">Kliknij żeby powiększyć</span>';E.clusterMarker.tooltip=F}if(!(E.clusterMarker.isInfoWindowOpen)&&!(E.clusterMarker.isHidden())){g.show_tooltip.call(E.clusterMarker,E.clusterMarker)}}function k(i){g.hide_tooltip.call(i.clusterMarker)}function l(i){y.defaultClickAction=function(){D.setCenter(i.clusterMarker.getLatLng(),D.getBoundsZoomLevel(i.clusterMarker.clusterGroupBounds));delete y.defaultClickAction};g.hide_tooltip.call(i.clusterMarker);y.defaultClickAction()}y=new ClusterMarker(D,{clusterMarkerMouseOver:q,clusterMarkerMouseOut:k,clusterMarkerClick:l,clusterMarkerTitle:"",intersectPadding:f.intersectPadding,clusterMarkerIcon:w,intersectPadding:2})}if(c(this).hasClass("disablePlaces")){f.disablePlaces=true}var C=[];var A=[];c.data(this,"map",D);c.data(this,"options",f);var n=null;var j=this;c(this).bind("gmap.loadItems",function(F,H){var i=this;var G=[];if(c(this).hasClass("filters")){G.push(c("#filters form").serialize())}if(f.distanceLimit){G.push("latitude1="+(f.startingLatitude-f.distance));G.push("latitude2="+(f.startingLatitude+f.distance));G.push("longitude1="+(f.startingLongitude-f.distance));G.push("longitude2="+(f.startingLongitude+f.distance))}if(c(this).hasClass("reloadable")){G.push(jQuery.param(c.gmaps.getParams({bounds:D.getBounds()})))}G.push("latitude="+D.getCenter().lat());G.push("longitude="+D.getCenter().lng());var E=D.getZoom();if(E<=8&&m=="voivodeships"&&!H&&!f.disablePlaces){}else{if(E<=8&&!f.disablePlaces){console.log("Województwa");m="voivodeships";if(n){n.abort()}n=c.ajax({url:"/map/voivodeships.json",dataType:"json",type:"GET",data:G.join("&"),beforeSend:function(){d()},complete:function(){b()},success:function(I,K){D.clearOverlays();if(f.clusterer){y.removeMarkers()}if(BrowserDetect.browser=="Explorer"&&BrowserDetect.version==6){var J="gif"}else{var J="png"}c.each(I,function(M,N){N=N.voivodeship;var L=new PlaceMarker(new GLatLng(N.latitude,N.longitude),{image:"/images/big-star."+J,link:"restauracje/wojewodztwo/"+N.slug,preventClick:true,width:40,height:40},N.name);GEvent.addListener(L,"click",function(){D.setZoom(9);D.setCenter(this.getLatLng())});D.addOverlay(L)})}})}else{if(E<=f.citiesViewZoom&&!f.disablePlaces){console.log("Miasta");m="cities";D.clearOverlays();if(n){n.abort()}n=c.ajax({url:"/map/cities.json",dataType:"json",data:G.join("&"),type:"GET",beforeSend:function(){d()},complete:function(){b()},success:function(I,K){if(BrowserDetect.browser=="Explorer"&&BrowserDetect.version==6){var J="gif"}else{var J="png"}c.each(I,function(M,P){var O=P.matches_count==1?"/images/map-star."+J:"/images/map-group."+J;var L=new UltraMarker(new GLatLng(P.latitude,P.longitude),{image:O,link:"/restauracje/"+P.slug,preventClick:true,width:25,height:29});GEvent.addListener(L,"click",function(){D.setZoom(11);D.setCenter(this.getLatLng())});var N=P.name+"<br/>znaleziono "+P.matches_count+" "+c.pluralize(P.matches_count,{one:"lokal",few:"lokale",many:"lokali"});g.add_tooltip(L,N);D.addOverlay(L)})}})}else{console.log("Punkty");m="restaurants";if(n){n.abort()}A=[];n=c.ajax({url:f.url,dataType:"json",data:G.join("&"),type:"POST",beforeSend:function(){d()},complete:function(){b()},success:function(O,J){bounds=D.getBounds();if(BrowserDetect.browser=="Explorer"&&BrowserDetect.version==6){var K="gif"}else{var K="png"}var M=[];var I=new Date().getTime();var Q=null;if(f.mainStar){Q=f.mainStar.item.id}var P=0;for(P=0;P<O.length;P++){var R=O[P].item;if(R.latitude&&R.longitude&&R.id!=Q){var N=new UltraMarker(new GLatLng(R.latitude,R.longitude),{image:"/images/map-star."+K,link:"/"+(R.to_param||R.id),width:18,height:21,alwaysOnTop:R.premium});c.addTooltip(g,N,R);GEvent.addListener(N,"click",function(){var S=this;window.location="/"+(S.itemData.to_param||S.itemData.id)});if(R.premium){M.push(N)}else{A.push(N)}}}A=A.slice(-700);if(f.clusterer){y.removeMarkers()}D.clearOverlays();if(f.clusterer){console.log("Aktualna ilość markerów: "+A.length);y.addMarkers(A);for(var P=0;P<M.length;P++){D.addOverlay(M[P])}}else{for(var P=0;P<A.length;P++){D.addOverlay(A[P])}for(var P=0;P<M.length;P++){D.addOverlay(M[P])}}if(f.clusterer){y.refresh();if(f.fitMap&&h&&(M.length!=0||A.length!=0)){o=true;h=false;c.fitMapToMarkers(D,M.concat(A))}}if(f.mainStar){var N=new GMarker(new GLatLng(f.mainStar.item.latitude,f.mainStar.item.longitude),{icon:r,zIndexProcess:function(){return GOverlay.getZIndex(f.mainStar.latitude)-99999}});c.addTooltip(g,N,f.mainStar.item);D.addOverlay(N)}var L=new Date().getTime();if(h&&f.zoomOutOnMarkersOutsideBounds&&A.length==0&&M.length==0&&!f.mainStar){h=false;D.zoomOut()}h=false}})}}}}).bind("gmap.setCenter",function(E,i){D.setCenter(i,15)}).bind("gmap.reload",function(){if(!c(this).hasClass("reloadable")){return false}c(this).trigger("gmap.loadItems")})})}})(jQuery);(function(a){a("#map_wrapper .search form").livequery("submit",function(){var b=a("input[type=text]",this).val();if(a("#city").hasClass("voivodeship")||a("#city").hasClass("city")){b=b+", "+a("h2 > span > a").html()}console.log(b);var c=new GClientGeocoder();c.getLatLng(b,function(d){if(!d){a.facebox("Adres nie został znaleziony")}else{a("#map").trigger("gmap.setCenter",[d])}});return false});a("#map").livequery(function(){a(this).gMap({url:"/map/map.json"});if(!a.getParamsFromHash().filters){a("#map").trigger("gmap.loadItems")}})})(jQuery);