function onOverChange(objID,colorOver,loopID){for(i=1;i<=4;i++){if(document.getElementById('TR'+loopID+'_'+i)){document.getElementById('TR'+loopID+'_'+i).style.background='#FFB565'}}objID.style.cursor='pointer'}function onOutChange(objID,colorOut,loopID){for(i=1;i<=4;i++){if(document.getElementById('TR'+loopID+'_'+i)){document.getElementById('TR'+loopID+'_'+i).style.background=colorOut}}objID.style.background=colorOut}Clusterer=function(map){this.map=map;this.markers=[];this.clusters=[];this.timeout=null;this.currentZoomLevel=map.getZoom();this.maxVisibleMarkers=Clusterer.defaultMaxVisibleMarkers;this.gridSize=Clusterer.defaultGridSize;this.minMarkersPerCluster=Clusterer.defaultMinMarkersPerCluster;this.maxLinesPerInfoBox=Clusterer.defaultMaxLinesPerInfoBox;this.icon=Clusterer.defaultIcon;GEvent.addListener(map,'zoomend',Clusterer.MakeCaller(Clusterer.Display,this));GEvent.addListener(map,'moveend',Clusterer.MakeCaller(Clusterer.Display,this));GEvent.addListener(map,'infowindowclose',Clusterer.MakeCaller(Clusterer.PopDown,this))};Clusterer.defaultMaxVisibleMarkers=150;Clusterer.defaultGridSize=10;Clusterer.defaultMinMarkersPerCluster=5;Clusterer.defaultMaxLinesPerInfoBox=400;Clusterer.defaultIcon=new GIcon();Clusterer.defaultIcon.image='http://www.acme.com/resources/images/markers/blue_large.PNG';Clusterer.defaultIcon.shadow='http://www.acme.com/resources/images/markers/shadow_large.PNG';Clusterer.defaultIcon.iconSize=new GSize(30,51);Clusterer.defaultIcon.shadowSize=new GSize(56,51);Clusterer.defaultIcon.iconAnchor=new GPoint(13,34);Clusterer.defaultIcon.infoWindowAnchor=new GPoint(13,3);Clusterer.defaultIcon.infoShadowAnchor=new GPoint(27,37);Clusterer.prototype.SetIcon=function(icon){this.icon=icon};Clusterer.prototype.AddMarker=function(marker,title,id){if(marker.setMap!=null)marker.setMap(this.map);marker.title=title;marker.onMap=false;marker.inw_id=id;this.markers.push(marker);this.DisplayLater()};Clusterer.prototype.RemoveMarker=function(marker){for(var i=0;i<this.markers.length;++i)if(this.markers[i]==marker){if(marker.onMap)this.map.removeOverlay(marker);for(var j=0;j<this.clusters.length;++j){var cluster=this.clusters[j];if(cluster!=null){for(var k=0;k<cluster.markers.length;++k)if(cluster.markers[k]==marker){cluster.markers[k]=null;--cluster.markerCount;break}if(cluster.markerCount==0){this.ClearCluster(cluster);this.clusters[j]=null}else if(cluster==this.poppedUpCluster)Clusterer.RePop(this)}}this.markers[i]=null;break}this.DisplayLater()};Clusterer.prototype.DisplayLater=function(){if(this.timeout!=null)clearTimeout(this.timeout);this.timeout=setTimeout(Clusterer.MakeCaller(Clusterer.Display,this),50)};Clusterer.Display=function(clusterer){var i,j,marker,cluster;clearTimeout(clusterer.timeout);var newZoomLevel=clusterer.map.getZoom();if(newZoomLevel!=clusterer.currentZoomLevel){for(i=0;i<clusterer.clusters.length;++i)if(clusterer.clusters[i]!=null){clusterer.ClearCluster(clusterer.clusters[i]);clusterer.clusters[i]=null}clusterer.clusters.length=0;clusterer.currentZoomLevel=newZoomLevel}var bounds=clusterer.map.getBounds();var sw=bounds.getSouthWest();var ne=bounds.getNorthEast();var dx=ne.lng()-sw.lng();var dy=ne.lat()-sw.lat();dx*=0.10;dy*=0.10;bounds=new GLatLngBounds(new GLatLng(sw.lat()-dy,sw.lng()-dx),new GLatLng(ne.lat()+dy,ne.lng()+dx));var visibleMarkers=[];var nonvisibleMarkers=[];for(i=0;i<clusterer.markers.length;++i){marker=clusterer.markers[i];if(marker!=null)if(bounds.contains(marker.getPoint()))visibleMarkers.push(marker);else nonvisibleMarkers.push(marker)}for(i=0;i<nonvisibleMarkers.length;++i){marker=nonvisibleMarkers[i];if(marker.onMap){clusterer.map.removeOverlay(marker);marker.onMap=false}}for(i=0;i<clusterer.clusters.length;++i){cluster=clusterer.clusters[i];if(cluster!=null&&!bounds.contains(cluster.marker.getPoint())&&cluster.onMap){clusterer.map.removeOverlay(cluster.marker);cluster.onMap=false}}if(visibleMarkers.length>clusterer.maxVisibleMarkers){var latRange=bounds.getNorthEast().lat()-bounds.getSouthWest().lat();var latInc=latRange/clusterer.gridSize;var lngInc=latInc/Math.cos((bounds.getNorthEast().lat()+bounds.getSouthWest().lat())/2.0*Math.PI/180.0);for(var lat=bounds.getSouthWest().lat();lat<=bounds.getNorthEast().lat();lat+=latInc)for(var lng=bounds.getSouthWest().lng();lng<=bounds.getNorthEast().lng();lng+=lngInc){cluster=new Object();cluster.clusterer=clusterer;cluster.bounds=new GLatLngBounds(new GLatLng(lat,lng),new GLatLng(lat+latInc,lng+lngInc));cluster.markers=[];cluster.markerCount=0;cluster.onMap=false;cluster.marker=null;clusterer.clusters.push(cluster)}for(i=0;i<visibleMarkers.length;++i){marker=visibleMarkers[i];if(marker!=null&&!marker.inCluster){for(j=0;j<clusterer.clusters.length;++j){cluster=clusterer.clusters[j];if(cluster!=null&&cluster.bounds.contains(marker.getPoint())){cluster.markers.push(marker);++cluster.markerCount;marker.inCluster=true}}}}for(i=0;i<clusterer.clusters.length;++i)if(clusterer.clusters[i]!=null&&clusterer.clusters[i].markerCount<clusterer.minMarkersPerCluster){clusterer.ClearCluster(clusterer.clusters[i]);clusterer.clusters[i]=null}for(i=clusterer.clusters.length-1;i>=0;--i)if(clusterer.clusters[i]!=null)break;else--clusterer.clusters.length;for(i=0;i<clusterer.clusters.length;++i){cluster=clusterer.clusters[i];if(cluster!=null){for(j=0;j<cluster.markers.length;++j){marker=cluster.markers[j];if(marker!=null&&marker.onMap){clusterer.map.removeOverlay(marker);marker.onMap=false}}}}for(i=0;i<clusterer.clusters.length;++i){cluster=clusterer.clusters[i];if(cluster!=null&&cluster.marker==null){var xTotal=0.0,yTotal=0.0;for(j=0;j<cluster.markers.length;++j){marker=cluster.markers[j];if(marker!=null){xTotal+=(+marker.getPoint().lng());yTotal+=(+marker.getPoint().lat())}}var location=new GLatLng(yTotal/cluster.markerCount,xTotal/cluster.markerCount);marker=new GMarker(location,grupaIcon);cluster.marker=marker;GEvent.addListener(marker,'click',Clusterer.MakeCaller(Clusterer.PopUp,cluster))}}}for(i=0;i<visibleMarkers.length;++i){marker=visibleMarkers[i];if(marker!=null&&!marker.onMap&&!marker.inCluster){clusterer.map.addOverlay(marker);if(marker.addedToMap!=null)marker.addedToMap();marker.onMap=true}}for(i=0;i<clusterer.clusters.length;++i){cluster=clusterer.clusters[i];if(cluster!=null&&!cluster.onMap&&bounds.contains(cluster.marker.getPoint())){clusterer.map.addOverlay(cluster.marker);cluster.onMap=true}}Clusterer.RePop(clusterer)};Clusterer.PopUp=function(cluster){var clusterer=cluster.clusterer;var html='<div style="height: 200px; overflow: auto; overflow-x: hidden; width: 340px;"><table width="300">';var n=0;for(var i=0;i<cluster.markers.length;++i){var marker=cluster.markers[i];if(marker!=null){++n;html+='<tr><td>';if(marker.getIcon().smallImage!=null)html+='<img src="'+marker.getIcon().smallImage+'">';else html+='<img src="'+marker.getIcon().image+'" width="'+(marker.getIcon().iconSize.width/2)+'" height="'+(marker.getIcon().iconSize.height/2)+'">';html+='</td><td><a href="javascript:void(0);" onClick="gotoMapClick('+marker.inw_id+');">'+marker.title+'</a></td></tr>';if(n==clusterer.maxLinesPerInfoBox-1&&cluster.markerCount>clusterer.maxLinesPerInfoBox){html+='<tr><td colspan="2">...i '+(cluster.markerCount-n)+' więcej</td></tr>';break}}}html+='</table></div>';clusterer.map.closeInfoWindow();cluster.marker.openInfoWindowHtml(html);clusterer.poppedUpCluster=cluster};Clusterer.RePop=function(clusterer){if(clusterer.poppedUpCluster!=null)Clusterer.PopUp(poppedUpCluster)};Clusterer.PopDown=function(clusterer){clusterer.poppedUpCluster=null};Clusterer.prototype.ClearCluster=function(cluster){var i,marker;for(i=0;i<cluster.markers.length;++i)if(cluster.markers[i]!=null){cluster.markers[i].inCluster=false;cluster.markers[i]=null}cluster.markers.length=0;cluster.markerCount=0;if(cluster==this.poppedUpCluster)this.map.closeInfoWindow();if(cluster.onMap){this.map.removeOverlay(cluster.marker);cluster.onMap=false}};Clusterer.MakeCaller=function(func,arg){return function(){func(arg)}};GMarker.prototype.setMap=function(map){this.map=map};GMarker.prototype.addedToMap=function(){this.map=null};GMarker.prototype.origOpenInfoWindow=GMarker.prototype.openInfoWindow;GMarker.prototype.openInfoWindow=function(node,opts){if(this.map!=null)return this.map.openInfoWindow(this.getPoint(),node,opts);else return this.origOpenInfoWindow(node,opts)};GMarker.prototype.origOpenInfoWindowHtml=GMarker.prototype.openInfoWindowHtml;GMarker.prototype.openInfoWindowHtml=function(html,opts){if(this.map!=null)return this.map.openInfoWindowHtml(this.getPoint(),html,opts);else return this.origOpenInfoWindowHtml(html,opts)};GMarker.prototype.origOpenInfoWindowTabs=GMarker.prototype.openInfoWindowTabs;GMarker.prototype.openInfoWindowTabs=function(tabNodes,opts){if(this.map!=null)return this.map.openInfoWindowTabs(this.getPoint(),tabNodes,opts);else return this.origOpenInfoWindowTabs(tabNodes,opts)};GMarker.prototype.origOpenInfoWindowTabsHtml=GMarker.prototype.openInfoWindowTabsHtml;GMarker.prototype.openInfoWindowTabsHtml=function(tabHtmls,opts){if(this.map!=null)return this.map.openInfoWindowTabsHtml(this.getPoint(),tabHtmls,opts);else return this.origOpenInfoWindowTabsHtml(tabHtmls,opts)};GMarker.prototype.origShowMapBlowup=GMarker.prototype.showMapBlowup;GMarker.prototype.showMapBlowup=function(opts){if(this.map!=null)return this.map.showMapBlowup(this.getPoint(),opts);else return this.origShowMapBlowup(opts)};function GZoomControl(oOptions){GZoomControl.G.style={nOpacity:.2,sColor:"#000",sBorder:"2px solid blue"};var style=GZoomControl.G.style;for(var s in oOptions){style[s]=oOptions[s]};var aStyle=style.sBorder.split(' ');style.nOutlineWidth=parseInt(aStyle[0].replace(/D/g,''));style.sOutlineColor=aStyle[2];style.sIEAlpha='alpha(opacity='+(style.nOpacity*100)+')'}GZoomControl.prototype=new GControl();GZoomControl.G={bDragging:false,mct:null,mcr:null,mcb:null,mcl:null,oMapPos:null,oOutline:null,nMapWidth:0,nMapHeight:0,nMapRatio:0,nStartX:0,nStartY:0,nBorderCorrect:0};GZoomControl.prototype.initialize=function(oMap){var oMC=oMap.getContainer();var oButton=document.createElement('div');oButton.appendChild(document.createTextNode('zoom...'));oButton.id='gzoom-control';acl.style([oButton],{width:'52px',cursor:'pointer',background:'#FFF',border:'1px solid black',padding:'0px 5px 1px 5px',zIndex:200});oMC.appendChild(oButton);var o=document.createElement("div");o.id='gzoom-map-cover';o.innerHTML='<div id="gzoom-outline" style="position:absolute;display:none;"></div><div id="gzoom-mct" style="position:absolute;display:none;"></div><div id="gzoom-mcl" style="position:absolute;display:none;"></div><div id="gzoom-mcr" style="position:absolute;display:none;"></div><div id="gzoom-mcb" style="position:absolute;display:none;"></div>';acl.style([o],{position:'absolute',display:'none',overflow:'hidden',cursor:'crosshair',zIndex:101});oMC.appendChild(o);GEvent.addDomListener(oButton,'click',GZoomControl.prototype.initCover_);GEvent.addDomListener(o,'mousedown',GZoomControl.prototype.coverMousedown_);GEvent.addDomListener(document,'mousemove',GZoomControl.prototype.drag_);GEvent.addDomListener(document,'mouseup',GZoomControl.prototype.mouseup_);var G=GZoomControl.G;G.oMapPos=acl.getElementPosition(oMap.getContainer());G.oOutline=$id("gzoom-outline");G.oButton=$id("gzoom-control");G.mc=$id("gzoom-map-cover");G.mct=$id("gzoom-mct");G.mcr=$id("gzoom-mcr");G.mcb=$id("gzoom-mcb");G.mcl=$id("gzoom-mcl");G.oMap=oMap;G.nBorderCorrect=G.style.nOutlineWidth*2;this.setDimensions_();this.initStyles_();debug("Finished Initializing gzoom control");return oButton};GZoomControl.prototype.getDefaultPosition=function(){return new GControlPosition(G_ANCHOR_TOP_LEFT,new GSize(3,120))};GZoomControl.prototype.coverMousedown_=function(e){var G=GZoomControl.G;var oPos=GZoomControl.prototype.getRelPos_(e);debug("Mouse down at "+oPos.left+", "+oPos.top);G.nStartX=oPos.left;G.nStartY=oPos.top;acl.style([G.mc],{background:'transparent',opacity:1,filter:'alpha(opacity=100)'});acl.style([G.oOutline],{left:G.nStartX+'px',top:G.nStartY+'px',display:'block',width:'1px',height:'1px'});G.bDragging=true;G.mct.style.top=(G.nStartY-G.nMapHeight)+'px';G.mct.style.display='block';G.mcl.style.left=(G.nStartX-G.nMapWidth)+'px';G.mcl.style.top=(G.nStartY)+'px';G.mcl.style.display='block';G.mcr.style.left=(G.nStartX)+'px';G.mcr.style.top=(G.nStartY)+'px';G.mcr.style.display='block';G.mcb.style.left=(G.nStartX)+'px';G.mcb.style.top=(G.nStartY)+'px';G.mcb.style.width='0px';G.mcb.style.display='block';debug("mouse down done");return false};GZoomControl.prototype.drag_=function(e){var G=GZoomControl.G;if(G.bDragging){var oPos=GZoomControl.prototype.getRelPos_(e);oRec=GZoomControl.prototype.getRectangle_(G.nStartX,G.nStartY,oPos,G.nMapRatio);G.oOutline.style.width=oRec.nWidth+"px";G.oOutline.style.height=oRec.nHeight+"px";G.mcr.style.left=(oRec.nEndX+G.nBorderCorrect)+'px';G.mcb.style.top=(oRec.nEndY+G.nBorderCorrect)+'px';G.mcb.style.width=(oRec.nWidth+G.nBorderCorrect)+'px';return false}};GZoomControl.prototype.mouseup_=function(e){var G=GZoomControl.G;if(G.bDragging){var oPos=GZoomControl.prototype.getRelPos_(e);G.bDragging=false;var oRec=GZoomControl.prototype.getRectangle_(G.nStartX,G.nStartY,oPos,G.nMapRatio);debug("mouse up at "+oRec.nEndX+", "+oRec.nEndY+". Height/width="+oRec.nWidth+","+oRec.nHeight);GZoomControl.prototype.resetDragZoom_();sw=G.oMap.fromContainerPixelToLatLng(new GPoint(oRec.nStartX,oRec.nEndY));ne=G.oMap.fromContainerPixelToLatLng(new GPoint(oRec.nEndX,oRec.nStartY));nw=G.oMap.fromContainerPixelToLatLng(new GPoint(oRec.nStartX,oRec.nStartY));se=G.oMap.fromContainerPixelToLatLng(new GPoint(oRec.nEndX,oRec.nEndY));var oZoomArea=new GPolyline([nw,ne,se,sw,nw],G.style.sOutlineColor,G.style.nOutlineWidth+1,.4);try{G.oMap.addOverlay(oZoomArea);setTimeout(function(){G.oMap.removeOverlay(oZoomArea)},6000)}catch(e){jslog.error("error adding zoomarea overlay:"+e.message)}oBounds=new GLatLngBounds(sw,ne);nZoom=G.oMap.getBoundsZoomLevel(oBounds);oCenter=oBounds.getCenter();G.oMap.setCenter(oCenter,nZoom)}};GZoomControl.prototype.setDimensions_=function(){var G=GZoomControl.G;var oSize=G.oMap.getSize();G.nMapWidth=oSize.width;G.nMapHeight=oSize.height;G.nMapRatio=G.nMapHeight/G.nMapWidth;acl.style([G.mc,G.mct,G.mcr,G.mcb,G.mcl],{width:G.nMapWidth+'px',height:G.nMapHeight+'px'})};GZoomControl.prototype.initStyles_=function(){var G=GZoomControl.G;acl.style([G.mc,G.mct,G.mcr,G.mcb,G.mcl],{filter:G.style.sIEAlpha,opacity:G.style.nOpacity,background:G.style.sColor});G.oOutline.style.border=G.style.sBorder;debug("done initStyles_")};GZoomControl.prototype.initCover_=function(){var G=GZoomControl.G;if(G.mc.style.display=='block'){GZoomControl.prototype.resetDragZoom_()}else{G.oButton.innerHTML='Zaznacz region na mapie';G.oButton.style.background='#ff0';acl.style([G.mc],{display:'block',background:G.style.sColor});debug("done initCover_")}};GZoomControl.prototype.getRelPos_=function(e){var oPos=acl.getMousePosition(e);var G=GZoomControl.G;return{top:(oPos.top-G.oMapPos.top),left:(oPos.left-G.oMapPos.left)}};GZoomControl.prototype.getRectangle_=function(nStartX,nStartY,oPos,nRatio){var dX=oPos.left-nStartX;var dY=oPos.top-nStartY;if(dX<0)dX=dX*-1;if(dY<0)dY=dY*-1;delta=dX>dY?dX:dY;return{nStartX:nStartX,nStartY:nStartY,nEndX:nStartX+delta,nEndY:nStartY+parseInt(delta*nRatio),nWidth:delta,nHeight:parseInt(delta*nRatio)}};GZoomControl.prototype.resetDragZoom_=function(){var G=GZoomControl.G;acl.style([G.mc,G.mct,G.mcr,G.mcb,G.mcl],{display:'none',opacity:G.style.nOpacity,filter:G.style.sIEAlpha});G.oOutline.style.display='none';G.oButton.innerHTML='zoom...';G.oButton.style.background='white';debug("done with reset drag zoom")};function $id(sId){return document.getElementById(sId)}if(!window['acldefined']){var acl={};window['acldefined']=true}acl.getMousePosition=function(e){var posx=0;var posy=0;if(!e)var e=window.event;if(e.pageX||e.pageY){posx=e.pageX;posy=e.pageY}else if(e.clientX||e.clientY){posx=e.clientX+(document.documentElement.scrollLeft?document.documentElement.scrollLeft:document.body.scrollLeft);posy=e.clientY+(document.documentElement.scrollTop?document.documentElement.scrollTop:document.body.scrollTop)}return{left:posx,top:posy}};acl.getElementPosition=function(eElement){var nLeftPos=eElement.offsetLeft;var nTopPos=eElement.offsetTop;var eParElement=eElement.offsetParent;while(eParElement!=null){nLeftPos+=eParElement.offsetLeft;nTopPos+=eParElement.offsetTop;eParElement=eParElement.offsetParent}return{left:nLeftPos,top:nTopPos}};acl.style=function(a,o){if(typeof(a)=='string'){a=acl.getManyElements(a)}for(var i=0;i<a.length;i++){for(var s in o){a[i].style[s]=o[s]}}};acl.getManyElements=function(s){t=s.split(',');a=[];for(var i=0;i<t.length;i++){a[a.length]=$id(t[i])};return a};var jslog={debug:function(){},info:function(){},warning:function(){},error:function(){},text:function(){}};var debug=function(){};if(location.href.match(/enablejslog/)){document.write('<script type="text/javascript" src="http://earthcode.com/include/javascripts/jslog.js"></script>')};