/** *C 2007 IMAGIS Sp. z o.o., wszelkie prawa zastrzeżone *IMAGIS jest zastrzeżonym znakiem towarowym. *Jeśli chcesz użyć mapGO API na swojej stronie zapoznaj się z warunkami *umieszczonymi na www.mapGO.pl, kontakt kontakt@mapgo.pl. *C 2007 IMAGIS Sp. z o.o., all rights reserved *IMAGIS is a registered trade mark. *If you like to use mapGO API on your site, please read Terms of Use on *www.mapGO.pl, contact kontakt@mapgo.pl. */var __isIE6=(navigator.userAgent.indexOf("MSIE 6.")!=-1);var __isIE=(navigator.userAgent.indexOf("MSIE")!=-1);var __isFF=(navigator.userAgent.indexOf("Firefox")!=-1);var _mapgo_BrowserDetect={init:function(){this.browser=this.searchString(this.dataBrowser)||"An unknown browser";this.version=this.searchVersion(navigator.userAgent)||this.searchVersion(navigator.appVersion)||"an unknown version";this.OS=this.searchString(this.dataOS)||"an unknown OS";},searchString:function(data){for(var i=0;i0){obj.raiseEvent("RetryDelay",obj);startTime=new Date().getTime();while(new Date().getTime()-startTime0) setTimeout(obj._onTimeout,obj.timeout);if(typeof obj.xmlHttpRequest.setRequestHeader!="undefined") if(obj.method=="POST"&&typeof obj.xmlHttpRequest.setRequestHeader!="undefined"){obj.xmlHttpRequest.setRequestHeader("Content-type","application/x-www-form-urlencoded");obj.xmlHttpRequest.send(obj.queryString);}else if(obj.method=="GET") obj.xmlHttpRequest.send('');};obj.handleArguments=function(args){if(typeof args.form=="object"&&args.form!=null){obj.form=args.form;obj.appendForm();} for(a in args){if(typeof obj[a]=="undefined") obj.parameters[a]=args[a];else{if(a!="parameters"&&a!="headers") obj[a]=args[a];else for(b in args[a]) obj[a][b]=args[a][b];}} obj.method=obj.method.toUpperCase();};obj.switchForm=function(enable){if(typeof obj.form!="object"||obj.form==null) return;with(obj.form) for(var nr=0;nr=0) obj.addParameter(e.name,e.options[e.selectedIndex].value);break;case"select-multiple":for(var nr2=0;nr2=0;i--){if(dontclusterall=='undefined'||!dontclusterall) this.all_features[i].cluster=true;if(this.all_features[i].cluster) this.all_features[i].visible=this.isIconInMap(this.all_features[i]);} this._clusterMarkers=[];var _gmarkers=[];var center=0;this.makeCandidatesToGroup(this.all_features);var allg=0;for(var i=this._clusterMarkers.length-1;i>=0;i--){allg+=this._clusterMarkers[i].length;center=this.makeGroupCenter(this._clusterMarkers[i],this.all_features);_gmarkers.push(center);} var l=this.addGroupedMarkers(_gmarkers);l.cluster=true;return l;} this.addGroupedMarkers=function(cxylist){var clusteredIcons=[];var unclusteredIcons=[];for(var i=cxylist.length-1;i>=0;i--){var clusterMarker=new MapgoIcon();clusterMarker.image=this.clustered_icon.image;clusterMarker.show_tip_state=0;clusterMarker.descr=this.makeClusterTip(cxylist[i].grp);clusterMarker.stamp=cxylist[i].grp.length+'';clusterMarker.tip_width=180;clusterMarker.tip_height=170;clusterMarker.width=this.clustered_icon.width;clusterMarker.height=this.clustered_icon.height;clusterMarker.icon_offx=this.clustered_icon.icon_offx;clusterMarker.icon_offy=this.clustered_icon.icon_offy;clusterMarker.dragable=this.clustered_icon.dragable;clusterMarker.onclick_function=this.clustered_icon.onclick_function;clusterMarker.lon=cxylist[i].cx;clusterMarker.lat=cxylist[i].cy;clusterMarker.clustered=true;clusteredIcons.push(clusterMarker);} for(var i=this.all_features.length-1;i>=0;i--){if(!this.all_features[i].clustered&&this.all_features[i].visible){clusteredIcons.push(this.all_features[i]);}} var l=_mmapgoobj.addIconsToMap(clusteredIcons,this.name,false,this.scale_from,this.scale_to,this.hide_when_move,this.POI);l.all_features=this.all_features;l.clustered_icon=this.clustered_icon;return l;} this.makeAddIconCode=function(icon){var outc="_mmapgoobj.hideLayerByName('"+this.name+"');_mmapgoobj.removeLayer('__single_poi');";outc+="icon1=new"+" "+"MapgoIcon();";if(icon.id&&icon.id!='') {outc+="icon1.id="+icon.id+";";} outc+="icon1.tip_width="+icon.tip_width+";";outc+="icon1.tip_height="+icon.tip_height+";";outc+="icon1.image='"+icon.image+"';";outc+="icon1.width="+icon.width+";";outc+="icon1.height="+icon.height+";";outc+="icon1.icon_offx="+icon.icon_offx+";";outc+="icon1.icon_offy="+icon.icon_offy+";";outc+="icon1.lon="+icon.lon+";";outc+="icon1.lat="+icon.lat+";";if(this.POI) outc+="icon1.descr='[]';";else outc+="icon1.descr='"+icon.descr+"';";outc+="var objl=[];";outc+="objl.push(icon1);";outc+="var l=_mmapgoobj.searchLayer('__single_poi');if (l) _mmapgoobj.addIconsToLayer(objl,'__single_poi',false,true);" outc+="else _mmapgoobj.addIconsToMap(objl,'__single_poi',false,3,20,false,true);_mmapgoobj.block_events=false;";return outc;} this.makeClusterTip=function(objects){var retv='
';var opis='';for(var i=objects.length-1;i>=0;i--){opis='
';if(objects[i].cluster_descr.length==0) opis+='X='+objects[i].lon+',Y='+objects[i].lat;else opis+=objects[i].cluster_descr;retv=retv+opis+'
';} retv+='
';return retv;} this.checkIntersect=function(icon1,icon2){var tempCoords1=_mmapgoobj.przeliczCalkPiksel(icon1.lon,icon1.lat);var tempCoords2=_mmapgoobj.przeliczCalkPiksel(icon2.lon,icon2.lat);var tempX11=tempCoords1.x+icon1.icon_offx;var tempY11=tempCoords1.y+icon1.icon_offy;var tempX21=tempCoords2.x+icon2.icon_offx;var tempY21=tempCoords2.y+icon2.icon_offy;var tempX12=tempX11+icon1.width;var tempY12=tempY11+icon1.height;var tempX22=tempX21+icon2.width;var tempY22=tempY21+icon2.height;if(tempX11>tempX22||tempX21>tempX12||tempY11>tempY22||tempY21>tempY12) return false;else return true;} this.makeGroupCenter=function(group,objects){var minx,miny,maxx,maxy;minx=9999999;miny=9999999;maxx=0;maxy=0;var groupedicons=[];for(var i=group.length-1;i>=0;i--){groupedicons.push(objects[group[i]]);objects[group[i]].clustered=true;if(objects[group[i]].lonmaxx) maxx=objects[group[i]].lon;if(objects[group[i]].lat>maxy) maxy=objects[group[i]].lat;} var cx=minx+(maxx-minx)/2;var cy=miny+(maxy-miny)/2;return{"cx":cx,"cy":cy,"cnt":group.length,"grp":groupedicons};} this.isIconInMap=function(icon1){if(icon1.lon>=this.mapCoordsTopLeft.lon&&icon1.lon=this.mapCoordsBottomRight.lat) return true;else return false;} this.makeCandidatesToGroup=function(objects){var clusterGroup=[];for(i=objects.length-1;i>=0;i--){objects[i].clustered=false;if(objects[i].visible&&objects[i].cluster){clusterGroup=[];for(var j=i-1;j>=0;j--){if(objects[j].visible&&this.checkIntersect(objects[i],objects[j])) clusterGroup.push(j);} if(clusterGroup.length!=0){clusterGroup.push(i);for(var j=clusterGroup.length-1;j>=0;j--) objects[clusterGroup[j]].visible=false;this._clusterMarkers.push(clusterGroup);}}}}} function MapgoPline(){this.id=0;this.layer=0;this.type=2;this.coords=0;this.color=0;this.opacity=0;this.weight=0;this.dashstyle=0;this.descr='';this.feature=0;this.visible=true;this.cchangedx=1;this.setDisplayParams=function(color,opacity,weight,dashstyle){this.feature.div.style.visibility='hidden';var pline_object=new MapgoPline();var pnts=[];for(var i=this.coords.length-1;i>=0;i--) pnts[i]=this.coords[i];pline_object.coords=pnts;pline_object.color=color;pline_object.opacity=opacity;pline_object.dashstyle=dashstyle;pline_object.weight=weight;pline_object.id=this.id;pline_object.layer=this.layer;_mmapgoobj.removeObjectFromLayer(this.layer,this);_mmapgoobj.addPlineToLayer(pline_object,this.layer.name,false);} this.setCoords=function(coords){this.feature.div.style.visibility='hidden';var pline_object=new MapgoPline();pline_object.coords=coords;pline_object.color=this.color;pline_object.opacity=this.opacity;pline_object.dashstyle=this.dashstyle;pline_object.weight=this.weight;pline_object.id=this.id;_mmapgoobj.removeObjectFromLayer(this.layer,this);_mmapgoobj.addPlineToLayer(pline_object,this.layer.name,false);this.coords=coords;}} function MapgoPolygon(){this.layer=0;this.id=0;this.type=3;this.coords=0;this.color=0;this.opacity=0;this.descr='';this.feature=0;this.visible=true;this.cchangedx=1;this.setDisplayParams=function(color,opacity){this.feature.div.style.visibility='hidden';var poly_object=new MapgoPolygon();poly_object.color=color;poly_object.opacity=opacity;poly_object.id=this.id;var pnts=[];for(var i=this.coords.length-1;i>=0;i--) pnts[i]=this.coords[i];poly_object.coords=pnts;_mmapgoobj.removeObjectFromLayer(this.layer,this);_mmapgoobj.addPolygonToLayer(poly_object,this.layer.name,false);} this.setCoords=function(coords){this.feature.div.style.visibility='hidden';var poly_object=new MapgoPolygon();poly_object.coords=coords;poly_object.color=this.color;poly_object.opacity=this.opacity;poly_object.id=this.id;poly_object.coords=coords;_mmapgoobj.removeObjectFromLayer(this.layer,this);_mmapgoobj.addPolygonToLayer(poly_object,this.layer.name,false);this.coords=coords;}} function MapgoPoiQuery(){var query="POI_QUERY";var lon=0;var lat=0;var idcat="";var idsubcat="";var idsubcatbrand="";var cnt=0;var type=0;var minx=99999;var miny=99999;var maxx=99999;var maxy=99999;} function MapgoObject(){this._mapgo_response='';this.upperTilesDir='';this.map_posx=0;this.map_posy=0;this._131='';this.state_founded=0;this.position_started=false;this.ICON_LAYER=1;this.PLINE_LAYER=2;this.___trasa=new Array();this.dragging_rubber=false;this.last_g_x=0;this.last_g_y=0;this.LayersIds=new Array();this.start_centercalkx=0;this.start_centercalky=0;this.curr_centercalkx=0;this.curr_centercalky=0;this.routePoints=0;this.lost_focus=false;this.choosedCityId='';this.choosedStreetId='';this.offx=0;this.offy=0;this.roznicax=0;this.roznicay=0;this.route_offx=0;this.route_offy=0;this.route_x=0;this.route_y=0;this.block_events=false;this.map_width=0;this.map_height=0;this.opera_browser=false;this.curr_center_lon=0;this.curr_center_lat=0;this.lost_mouse_x=0;this.lost_mouse_y=0;this.min_scale=3;this.max_scale=20;this.kafelx=2910;this.kafely=1230;this.minx=2910;this.miny=1230;this.maxx=2969;this.maxy=1289;this.sectionWidth=30;this.sectionHeight=30;this.scalex=new Array(6,9,12,18,24,36,48,72,96,144,192,384,768,1536,3072,6144,12288,24576,49152,98304);this.scaley=new Array(4,6,8,12,16,24,32,48,64,96,128,256,512,1024,2048,4096,8192,16384,32768,65536);this.currscale=1;this.imageViewerObject=0;this.tileDirG='';this.tileSizeG=0;this.moving=false;this.changetiles=true;this.pilotpl=true;this._curr_route_startx=0;this._curr_route_starty=0;this._curr_route_endx=0;this._curr_route_endy=0;this.mapLayers=[];this.IFrameObj;this.mainOffX=-200000;this.mainOffY=-200000;this.OmainOffX=-4200;this.OmainOffY=-4200;this.mainWidth=(-2)*this.mainOffX;this.mainHeight=(-2)*this.mainOffY;this.featureClicked=false;this.setIconPos=function(lon,lat,mapgo_icon){if(mapgo_icon){this.hideTip();var calk_coordsc=this.przeliczCalkPiksel(this.curr_center_lon,this.curr_center_lat);var screen_coords=this.makeScreenRouteCoord(lon,lat,calk_coordsc.x,calk_coordsc.y);mapgo_icon.feature.x=screen_coords.x;mapgo_icon.feature.y=screen_coords.y;mapgo_icon.feature.lon=lon;mapgo_icon.feature.lat=lat;mapgo_icon.feature.div.style.left=(mapgo_icon.feature.x+mapgo_icon.feature.icon_offx)+'px';mapgo_icon.feature.div.style.top=(mapgo_icon.feature.y+mapgo_icon.feature.icon_offy)+'px';return{"x":(mapgo_icon.feature.x+mapgo_icon.feature.icon_offx),"y":(mapgo_icon.feature.y+mapgo_icon.feature.icon_offy)};}} this.setUpperTilesDir=function(tdir){this.upperTilesDir=tdir;} this.changeUpperTilesDir=function(tdir){this.upperTilesDir=tdir;this.imageViewerObject.dimensions.tileDir1=tdir;this.reloadTiles(this.imageViewerObject.start.x,this.imageViewerObject.start.y,true);} this.getEvent=function(event) {if(!event){return window.event;} else return event;} this.setCursorMode=function(mode,listener_function){mode=mode.toLowerCase();if(mode=='rubber'){this.setRubber();} if(mode=='hand'){this.setMoveMap();this.dragging_rubber=false;} if(mode=='ageo'){this.setAgeo();if(listener_function) this._callback_ageo_resp_function=listener_function;}} this.localizeCoordinates=function(imageViewer,client) {if(document.documentElement&&document.documentElement.scrollTop){client.y=client.y+document.documentElement.scrollTop;client.x=client.x+document.documentElement.scrollLeft;} else if(document.body&&document.body.scrollTop){client.y=client.y+document.body.scrollTop;client.x=client.x+document.body.scrollLeft;} var local={'x':client.x,'y':client.y};for(var node=imageViewer;node;node=node.offsetParent){local.x-=node.offsetLeft;local.y-=node.offsetTop;} return local;} this._mapgo_stop_move_map=false;this.setStopMoveMap=function(flag){this._mapgo_stop_move_map=flag;} this.resize=function(nwidth,nheight){if(this.imageViewerObject&&nwidth>100&&nheight>100){var ckafel=this.getCenterKafel(this.imageViewerObject.dimensions.width/2,this.imageViewerObject.dimensions.height/2);var convlonlat=this.screenToLonLat(this.currscale,ckafel.x,ckafel.y,ckafel.kx,ckafel.ky);this.imageViewerObject.style.width=''+nwidth+'px';this.imageViewerObject.style.height=''+nheight+'px';this.imageViewerObject.dimensions.width=nwidth;this.imageViewerObject.dimensions.height=nheight;this.removeTiles();this.prepareTiles(this.imageViewerObject);this.centerTo(convlonlat.lon,convlonlat.lat,this.currscale);this.recalculateLayersCoords();document.getElementById("_mapgo_powered_txt").style.left=(this.map_posx+nwidth-225)+'px';document.getElementById("_mapgo_powered_txt").style.top=(this.map_posy+nheight-21)+'px';document.getElementById("_mapgo_warunki_txt").style.left=(this.map_posx+nwidth-325)+'px';document.getElementById("_mapgo_warunki_txt").style.top=(this.map_posy+nheight-20)+'px';document.getElementById("_mapgo_logo").style.left=(this.map_posx+1)+'px';document.getElementById("_mapgo_logo").style.top=(this.map_posy+nheight-41)+'px';}} this.getTipStyle=function(){return document.getElementById('mapgo_tip_txt').style;} this.centerMap=function(lon,lat,scale){if(!scale){if(this.currscale!=0) this.centerTo(lon,lat,this.currscale);else this.centerTo(lon,lat,17);} else this.centerTo(lon,lat,scale);this.recalculateLayersCoords();} this.__change_scale_callback=0;this.__move_map_callback=0;this.setChangeScaleCallback=function(callback_fn){this.__change_scale_callback=callback_fn;} this.setMoveMapCallback=function(callback_fn){this.__move_map_callback=callback_fn;} this.centerTo=function(lon,lat,scale){var cscale=this.currscale;_mmapgoobj.hideTip();if(Math.abs(lon)<100) lon=Math.floor(lon*1000000+0.5);if(lat<100) lat=Math.floor(lat*1000000+0.5);this.imageViewerObject=document.body.imageViewers[0];if(this.imageViewerObject){if(scalethis.max_scale) scale=this.max_scale;if(scale==this.max_scale){lon=19500000;lat=52250000;} this.curr_center_lon=lon;this.curr_center_lat=lat;if(scale) this.currscale=scale;var calk_coordsc=this.przeliczCalkPiksel(this.curr_center_lon,this.curr_center_lat);this.curr_centercalkx=parseInt(calk_coordsc.x);this.curr_centercalky=parseInt(calk_coordsc.y);this.start_centercalkx=this.curr_centercalkx;this.start_centercalky=this.curr_centercalky;var positions=this.lonLatToScreen(lon,lat,scale);this.kafelx=positions.kx;this.kafely=positions.ky;this.imageViewerObject.start={'x':0,'y':0};this.imageViewerObject.dimensions.x=Math.floor(this.imageViewerObject.dimensions.width/2)-positions.x;this.imageViewerObject.dimensions.y=Math.floor(this.imageViewerObject.dimensions.height/2-this.tileSizeG)+positions.y;if(this.pilotpl==true) this.changetiles=true;this.positionTiles(this.imageViewerObject,{'x':0,'y':0});this.manageLayersVisibility();this.manageLayersClustering();if(cscale!=scale&&this.__change_scale_callback&&!this.block_events) this.__change_scale_callback();}} this.hideLayersWhenMove=function(){for(var i=this.mapLayers.length-1;i>=0;i--){if(this.mapLayers[i].hide_when_move&&this.mapLayers[i].visible){this.mapLayers[i].h_w_m=true;this.mapLayers[i].div.style.visibility='hidden';this.mapLayers[i].label_div.style.visibility='hidden';}}} this.showLayersWhenMove=function(){for(var i=this.mapLayers.length-1;i>=0;i--){if(this.mapLayers[i].h_w_m&&this.mapLayers[i].visible&&(this.mapLayers[i].scale_from<=this.currscale&&this.mapLayers[i].scale_to>=this.currscale)){this.mapLayers[i].h_w_m=false;this.mapLayers[i].div.style.visibility='visible';this.mapLayers[i].label_div.style.visibility='visible';}}} this.manageLayersVisibility=function(){for(var i=this.mapLayers.length-1;i>=0;i--){if(this.currscalethis.mapLayers[i].scale_to){this.mapLayers[i].div.style.visibility='hidden';this.mapLayers[i].label_div.style.visibility='hidden';} else if(this.mapLayers[i].visible){this.showLayerByName(this.mapLayers[i].name);}}} this.manageLayersClustering=function(){for(var i=this.mapLayers.length-1;i>=0;i--){if(this.mapLayers[i].cluster) this.mapLayers[i].clusterIcons(true);}} this.moveLeft=function(cnt){_mmapgoobj.hideTip();_mmapgoobj.hideLayersWhenMove();var temp=cnt;this.moving=true;var wsp=0;if(cnt>6) wsp=0.4;else wsp=0.2;var halfw=Math.floor(this.imageViewerObject.dimensions.width/2);this.imageViewerObject=document.body.imageViewers[0];this.imageViewerObject.start=this.localizeCoordinates(this.imageViewerObject,{'x':halfw,'y':0});if(this.imageViewerObject&&temp>0&&this.imageViewerObject.pressed==false){var mouse=this.localizeCoordinates(this.imageViewerObject,{'x':halfw+wsp*halfw,'y':0});this.positionTiles(this.imageViewerObject,{'x':mouse.x,'y':mouse.y},true);this.moveStraight(wsp*halfw,0);temp--;this.imageViewerObject.dimensions.x+=0.2*halfw;window.setTimeout("_mmapgoobj.moveLeft("+temp+")",1);} else{this.moving=false;} if(this.pilotpl==true&&temp==0){this.reloadTiles(this.imageViewerObject.start.x,this.imageViewerObject.start.y,true);var ncenter=this.convertScreenToGeo(this.imageViewerObject.dimensions.width/2,this.imageViewerObject.dimensions.height/2);this.curr_center_lon=ncenter.lon;this.curr_center_lat=ncenter.lat;} if(!this.moving&&_mmapgoobj.__move_map_callback&&!_mmapgoobj.block_events) _mmapgoobj.__move_map_callback();if(!this.moving){_mmapgoobj.manageLayersClustering();_mmapgoobj.showLayersWhenMove();}} this.moveRight=function(cnt){_mmapgoobj.hideTip();_mmapgoobj.hideLayersWhenMove();var temp=cnt;this.moving=true;var halfw=Math.floor(this.imageViewerObject.dimensions.width/2);var wsp=0;this.imageViewerObject=document.body.imageViewers[0];this.imageViewerObject.start=this.localizeCoordinates(this.imageViewerObject,{'x':halfw,'y':0});if(cnt>6) wsp=0.4;else wsp=0.2;if(this.imageViewerObject&&temp>0&&this.imageViewerObject.pressed==false){var mouse=this.localizeCoordinates(this.imageViewerObject,{'x':halfw-wsp*halfw,'y':0});this.positionTiles(this.imageViewerObject,{'x':mouse.x,'y':mouse.y},true);this.moveStraight(-wsp*halfw,0);temp--;this.imageViewerObject.dimensions.x-=0.2*halfw;window.setTimeout("_mmapgoobj.moveRight("+temp+")",1);} else{this.moving=false;} if(this.pilotpl==true&&temp==0){this.reloadTiles(this.imageViewerObject.start.x,this.imageViewerObject.start.y,true);var ncenter=this.convertScreenToGeo(this.imageViewerObject.dimensions.width/2,this.imageViewerObject.dimensions.height/2);this.curr_center_lon=ncenter.lon;this.curr_center_lat=ncenter.lat;} if(!this.moving&&_mmapgoobj.__move_map_callback&&!_mmapgoobj.block_events) _mmapgoobj.__move_map_callback();if(!this.moving){_mmapgoobj.manageLayersClustering();_mmapgoobj.showLayersWhenMove();}} this.moveDown=function(cnt){var temp=cnt;_mmapgoobj.hideTip();_mmapgoobj.hideLayersWhenMove();this.moving=true;var wsp=0;if(cnt>6) wsp=0.4;else wsp=0.2;var halfh=Math.floor(this.imageViewerObject.dimensions.height/2);this.imageViewerObject=document.body.imageViewers[0];this.imageViewerObject.start=this.localizeCoordinates(this.imageViewerObject,{'x':0,'y':halfh});if(this.imageViewerObject&&temp>0&&this.imageViewerObject.pressed==false){var mouse=this.localizeCoordinates(this.imageViewerObject,{'x':0,'y':halfh-wsp*halfh});this.positionTiles(this.imageViewerObject,{'x':mouse.x,'y':mouse.y},true);this.moveStraight(0,-wsp*halfh);temp--;this.imageViewerObject.dimensions.y-=0.2*halfh;window.setTimeout("_mmapgoobj.moveDown("+temp+")",1);} else this.moving=false;if(this.pilotpl==true&&temp==0){this.reloadTiles(this.imageViewerObject.start.x,this.imageViewerObject.start.y,true);var ncenter=this.convertScreenToGeo(this.imageViewerObject.dimensions.width/2,this.imageViewerObject.dimensions.height/2);this.curr_center_lon=ncenter.lon;this.curr_center_lat=ncenter.lat;} if(!this.moving&&_mmapgoobj.__move_map_callback&&!_mmapgoobj.block_events) _mmapgoobj.__move_map_callback();if(!this.moving){_mmapgoobj.manageLayersClustering();_mmapgoobj.showLayersWhenMove();}} this.moveUp=function(cnt){var temp=cnt;_mmapgoobj.hideTip();_mmapgoobj.hideLayersWhenMove();this.moving=true;var wsp=0;if(cnt>6) wsp=0.4;else wsp=0.2;var halfh=Math.floor(this.imageViewerObject.dimensions.height/2);this.imageViewerObject=document.body.imageViewers[0];this.imageViewerObject.start=this.localizeCoordinates(this.imageViewerObject,{'x':0,'y':halfh});if(this.imageViewerObject&&temp>0&&this.imageViewerObject.pressed==false){var mouse=this.localizeCoordinates(this.imageViewerObject,{'x':0,'y':halfh+wsp*halfh});this.positionTiles(this.imageViewerObject,{'x':mouse.x,'y':mouse.y},true);this.moveStraight(0,wsp*halfh);temp--;this.imageViewerObject.dimensions.y+=0.2*halfh;window.setTimeout("_mmapgoobj.moveUp("+temp+")",1);} else this.moving=false;if(this.pilotpl==true&&temp==0){this.reloadTiles(this.imageViewerObject.start.x,this.imageViewerObject.start.y,true);var ncenter=this.convertScreenToGeo(this.imageViewerObject.dimensions.width/2,this.imageViewerObject.dimensions.height/2);this.curr_center_lon=ncenter.lon;this.curr_center_lat=ncenter.lat;} if(!this.moving&&_mmapgoobj.__move_map_callback&&!_mmapgoobj.block_events) _mmapgoobj.__move_map_callback();if(!this.moving){_mmapgoobj.manageLayersClustering();_mmapgoobj.showLayersWhenMove();}} this.splitStreetNo=function(streetno){var street='';var no='';streetno=streetno.replace(',',' ');streetno=streetno.toLowerCase();if(streetno.lastIndexOf(" ")>0){var tmp=streetno.substring(streetno.lastIndexOf(" ")+1);if(!parseInt(tmp)) return{'street':streetno,'no':1};street=streetno.substring(0,streetno.lastIndexOf(" "));if(street=='ulica') street='xfsggxbs';no=streetno.substring(streetno.lastIndexOf(" ")+1);} else{street=streetno;no='1';} return{'street':street,'no':no};} this.lonLatToScreen=function(lon,lat,scale_num){scale_num-=1;if(Math.abs(lon)<100) lon=Math.floor(lon*1000000+0.5);if(lat<100) lat=Math.floor(lat*1000000+0.5);var px=0;if(lon>=0) px=Math.floor((lon-(-12000000))/this.scalex[scale_num]);else px=Math.floor((12000000+lon)/this.scalex[scale_num]);var py=Math.floor((lat-34000000)/this.scaley[scale_num]);var outv=new Array();outv[0]=Math.floor(px/250);outv[1]=Math.floor(py/250);outv[2]=px-outv[0]*250;outv[3]=py-outv[1]*250;return{'kx':Math.floor(px/250),'ky':Math.floor(py/250),'x':(px-outv[0]*250),'y':(py-outv[1]*250)};} this.screenToLonLat=function(scale_num,x,y,kafelx,kafely){scale_num-=1;var px=kafelx*250+x;var py=kafely*250+y;var outv=new Array();outv[0]=px*this.scalex[scale_num]+(-12000000);outv[1]=py*this.scaley[scale_num]+34000000;return{'lon':(px*this.scalex[scale_num]+(-12000000)),'lat':(py*this.scaley[scale_num]+34000000)};} this.changeScale=function(scale_num){if(scale_numthis.max_scale) scale_num=this.max_scale;scale_num-=1;var tiles=this.imageViewerObject.tiles;var dim=this.imageViewerObject.dimensions;if(scale_num>=0&&scale_num<=20&&(scale_num+1)!=this.currscale){var convlonlat=_mmapgoobj.convertScreenToGeo(this.imageViewerObject.dimensions.width/2,this.imageViewerObject.dimensions.height/2);this.centerTo(convlonlat.lon,convlonlat.lat,scale_num+1);this.recalculateLayersCoords();}} this.convertScreenToGeo=function(screenx,screeny){var coords=this.getCenterKafel(screenx,screeny);if(coords){var convlonlat=this.screenToLonLat(this.currscale,coords.x,coords.y,coords.kx,coords.ky);convlonlat.lon=convlonlat.lon/1000000;convlonlat.lat=convlonlat.lat/1000000;return convlonlat;}else return{"lon":0,"lat":0};} this.convertGeoToScreen=function(lon,lat){if(Math.abs(lon)<100) lon=Math.floor(lon*1000000+0.5);if(lat<100) lat=Math.floor(lat*1000000+0.5);var mapscrx=this.imageViewerObject.dimensions.width/2;var mapscry=this.imageViewerObject.dimensions.height/2;var loc_center={"x":mapscrx,"y":mapscry};var calk_coordsc=this.przeliczCalkPiksel(this.curr_center_lon,this.curr_center_lat);var screenc=this.przeliczCalkPiksel(lon,lat);screenc.x=screenc.x-calk_coordsc.x;screenc.y=screenc.y-calk_coordsc.y;screenc.x=loc_center.x+screenc.x;screenc.y=loc_center.y-screenc.y;return{"x":Math.round(screenc.x),"y":Math.round(screenc.y)};} this.prepareViewer=function(imageViewer,tileDir,tileDir1,tileSize,nsectionWidth,nsectionHeight,w,h) {this.imageViewerObject=imageViewer;this.sectionWidth=nsectionWidth;this.sectionHeight=nsectionHeight;this.tileSizeG=tileSize;this.tileDirG=tileDir;for(var child=imageViewer.firstChild;child;child=child.nextSibling){if(child.className=='mapgosurface'){imageViewer.activeSurface=child;child.imageViewer=imageViewer;}else if(child.className=='mapgowell'){imageViewer.tileWell=child;child.imageViewer=imageViewer;}else if(child.className=='status'){imageViewer.status=child;child.imageViewer=imageViewer;}} var width=w;var height=h;var zoomLevel=-1;var fullSize=tileSize*Math.pow(2,zoomLevel);do{zoomLevel+=1;fullSize*=2;}while(fullSize0) for(var c=0;c=0;i--){for(var j=object_list[i].coords.length-1;j>=0;j--){if(Math.abs(object_list[i].coords[j].lon)<100) object_list[i].coords[j].lon=Math.floor(object_list[i].coords[j].lon*1000000+0.5);if(object_list[i].coords[j].lat<100) object_list[i].coords[j].lat=Math.floor(object_list[i].coords[j].lat*1000000+0.5);}} var lid=this.createLayerId();if(position_map) this.positionMap(object_list);var l=this.createLayer(lid,layer_name,this.PLINE_LAYER,scale_from,scale_to,hide_when_move);this.imageViewerObject.activeSurface.appendChild(l.div);if(l){this.mapLayers.push(l);var id=0;for(var i=0;inazwa : "+json_ans.n1+"
adres : "+json_ans.a+"
miejscowość : "+json_ans.kp+"
tel. : "+json_ans.t+"
www : "+json_ans.www+"
info : "+json_ans.i;document.getElementById("mapgo_tip_txt").innerHTML=descr;}}} this.createIconFeature=function(id,width,height,descr,lon,lat,imgsrc,classname,type,icon_offx,icon_offy,tip_w,tip_h,onclick_function,icon_id,dragable,afterdrag_function,mapgo_icon,POI){var feature={'icon_id':icon_id,'id':'_f_'+id,'width':width,'height':height,'descr':descr,'lon':lon,'lat':lat,'x':-1,'y':-1,'offx':0,'offy':0,'imgsrc':imgsrc,'classname':classname,'img':document.createElement('img'),'div':document.createElement('div'),'descr':document.createElement('div'),'imageViewer':this.imageViewerObject,'type':1,'kafelx':0,'kafel':0,'xink':0,'yink':0,'icon_offx':icon_offx,'icon_offy':icon_offy,'mapgoicon':mapgo_icon,'label_div':0,'label_pos':mapgo_icon.label_pos};var screenc=this.convertGeoToScreen(lon,lat);feature.x=screenc.x;feature.y=screenc.y;feature.img.style.position='relative';feature.img.style.left='0px';feature.img.style.top='0px';feature.img.style.border=0;feature.img.border=0;feature.img.style.width=width+'px';feature.img.style.height=height+'px';feature.img.id=''+icon_id;feature.img.src=imgsrc;feature.img.style.zIndex=5000;if(__isIE6){feature.img.src='http://www.mapgo.pl/portal/blank.gif';feature.img.style.filter="progid:DXImageTransform.Microsoft.AlphaImageLoader(src='"+imgsrc+"',sizingMethod='scale')";} feature.div.id=feature.id;feature.div.style.position='absolute';feature.div.style.left=(feature.x+feature.icon_offx)+'px';feature.div.style.top=(feature.y+feature.icon_offy)+'px';feature.div.style.width=width+'px';feature.div.style.height=height+'px';feature.descr.id='d_'+feature.id;feature.div.style.cursor='pointer';feature.div.onmousedown=function(evt){if(feature.mapgoicon.dragable) {_mmapgoobj.featureClicked=true;_mmapgoobj._mapgo_moved_icon=feature;_mmapgoobj.startDragIcon(evt,afterdrag_function);}else {if(mapgo_icon.show_tip_state==1&&descr.length>0) {if(tip_w&&tip_h&&tip_w>0&&tip_h>0){if(POI!=undefined&&POI){if(_mmapgoobj.last_div_tip!=this) {_mmapgoobj.hideTip();if(!_mmapgoobj.dragging_rubber) {_mmapgoobj.makeTip('',tip_w,tip_h);_mmapgoobj.positionTip(this);} _mmapgoobj.last_div_tip=this;_mmapgoobj.queryPoiInfo(id);if(_mmapgoobj._after_show_tip_callback!=0) _mmapgoobj._after_show_tip_callback(feature.mapgoicon);}} else{if(_mmapgoobj.last_div_tip!=this) {_mmapgoobj.hideTip();if(!_mmapgoobj.dragging_rubber) {_mmapgoobj.makeTip(descr,tip_w,tip_h);_mmapgoobj.positionTip(this);} _mmapgoobj.last_div_tip=this;if(_mmapgoobj.__mapgo_poi_info_query!=0&&!mapgo_icon.clustered) _mmapgoobj.__mapgo_poi_info_query(id);if(_mmapgoobj._after_show_tip_callback!=0) _mmapgoobj._after_show_tip_callback(feature.mapgoicon);}}} else {if(_mmapgoobj.last_div_tip!=this) {_mmapgoobj.hideTip();if(!_mmapgoobj.dragging_rubber) {_mmapgoobj.makeTip(descr);_mmapgoobj.positionTip(this);} _mmapgoobj.last_div_tip=this;if(_mmapgoobj._after_show_tip_callback!=0) _mmapgoobj._after_show_tip_callback(feature.mapgoicon);}}}} _mmapgoobj.featureClicked=true;if(onclick_function) {_mmapgoobj._onclick_ended=true;onclick_function(feature.mapgoicon);} return false;} feature.div.onmouseup=function(evt){if(!feature.mapgoicon.dragable) _mmapgoobj.featureClicked=false;} if(mapgo_icon.show_tip_state==0&&descr.length>0){if(tip_w&&tip_h&&tip_w>0&&tip_h>0){if(POI!=undefined&&POI) feature.div.onmouseover=function(){if(_mmapgoobj.last_div_tip!=this) {_mmapgoobj.hideTip();if(!_mmapgoobj.dragging_rubber) {_mmapgoobj.makeTip('',tip_w,tip_h);_mmapgoobj.positionTip(this);} _mmapgoobj.last_div_tip=this;_mmapgoobj.queryPoiInfo(id);if(_mmapgoobj._after_show_tip_callback!=0) _mmapgoobj._after_show_tip_callback(feature.mapgoicon);}};else feature.div.onmouseover=function(){if(_mmapgoobj.last_div_tip!=this) {_mmapgoobj.hideTip();if(!_mmapgoobj.dragging_rubber) {_mmapgoobj.makeTip(descr,tip_w,tip_h);_mmapgoobj.positionTip(this);} _mmapgoobj.last_div_tip=this;if(_mmapgoobj.__mapgo_poi_info_query!=0&&!mapgo_icon.clustered) _mmapgoobj.__mapgo_poi_info_query(id);if(_mmapgoobj._after_show_tip_callback!=0) _mmapgoobj._after_show_tip_callback(feature.mapgoicon);}};} else feature.div.onmouseover=function() {if(_mmapgoobj.last_div_tip!=this) {_mmapgoobj.hideTip();if(!_mmapgoobj.dragging_rubber) {_mmapgoobj.makeTip(descr);_mmapgoobj.positionTip(this);} _mmapgoobj.last_div_tip=this;if(_mmapgoobj._after_show_tip_callback!=0) _mmapgoobj._after_show_tip_callback(feature.mapgoicon);}}} if(mapgo_icon.stamp&&mapgo_icon.stamp.length>0){var ddiv=document.createElement('div');ddiv.style.position="absolute";ddiv.style.left="0px";ddiv.style.top="-10px";ddiv.style.fontFamily="trebuchet ms";ddiv.style.fontSize="9px";ddiv.style.background="transparent";ddiv.style.color="#eeeeee";ddiv.style.width=25+'px';ddiv.style.height=10+'px';ddiv.innerHTML='

'+mapgo_icon.stamp+'

';var p=ddiv.firstChild;p.style.margin="2px 2px 2px 2px";p.style.padding="2px 0px 2px 2px";p.style.lineHeight="8px";p.style.backgroundColor="#505050";feature.div.appendChild(ddiv);} if(mapgo_icon.label&&mapgo_icon.label.length>0){var ddiv=document.createElement('div');ddiv.style.position="absolute";ddiv.style.left=(feature.x+feature.icon_offx+width)+'px';if(mapgo_icon.label_pos==0) ddiv.style.top=(feature.y-10+feature.icon_offy)+'px';else if(mapgo_icon.label_pos==1) ddiv.style.top=(feature.y+height+feature.icon_offy)+'px';ddiv.id=feature.id+'_label';ddiv.style.fontFamily="trebuchet ms";ddiv.style.fontSize="9px";ddiv.style.zIndex=5001;ddiv.style.border="1px solid #c0c0c0";ddiv.style.color="#0f0f0f";ddiv.style.height=11+'px';ddiv.style.backgroundColor="#FFFF00";mapgo_icon.label=mapgo_icon.label.replace(' ',' ');ddiv.innerHTML='

'+mapgo_icon.label+'

';var p=ddiv.firstChild;p.style.margin="1px 1px 1px 1px";p.style.padding="0px 0px 0px 0px";p.style.lineHeight="8px";p.style.backgroundColor="#FFFF00";feature.label_div=ddiv;} feature.div.appendChild(feature.img);mapgo_icon.feature=feature;return feature;} this.makeObjDescr=function(opis){var outxt='
'+opis+'
';} this.recalculateFeatureCoords=function(feature){switch(feature.type){case 1:var calk_coordsc=this.przeliczCalkPiksel(this.curr_center_lon,this.curr_center_lat);var screen_coords=this.makeScreenRouteCoord(feature.lon,feature.lat,calk_coordsc.x,calk_coordsc.y);feature.x=screen_coords.x;feature.y=screen_coords.y;feature.div.style.left=(feature.x+feature.icon_offx)+'px';feature.div.style.top=(feature.y+feature.icon_offy)+'px';if(feature.label_div) {if(feature.label_pos==0){feature.label_div.style.top=(feature.y-10+feature.icon_offy)+'px';} else if(feature.label_pos==1){feature.label_div.style.top=(feature.y+parseInt(feature.div.style.height)+feature.icon_offy)+'px';} feature.label_div.style.left=(feature.x+feature.icon_offx+parseInt(feature.div.style.width))+'px';} break;case 2:case 3:var calk_coordsc=this.przeliczCalkPiksel(this.curr_center_lon,this.curr_center_lat);var spt='';if(document.all&&!this.opera_browser){spt=this.makeScreenRouteCoords1(feature.coords,calk_coordsc.x,calk_coordsc.y,0,0,true);var opl=feature.div.childNodes[0];opl.points.value=spt;} else{if(this.opera_browser) spt=this.makeScreenRouteCoords1(feature.coords,calk_coordsc.x,calk_coordsc.y,this.OmainOffX,this.OmainOffY,false);else spt=this.makeScreenRouteCoords1(feature.coords,calk_coordsc.x,calk_coordsc.y,this.mainOffX,this.mainOffY,false);var opl=feature.div.childNodes[0].childNodes[0];opl.setAttribute("points",spt);} break;}} this.recalculateLayersCoords=function(){for(var i=0;i=0;j--) this.recalculateFeatureCoords(this.mapLayers[i].features[j]);}} this.recalculateHiddenLayersCoords=function(){for(var i=0;i=0;j--) this.recalculateFeatureCoords(this.mapLayers[i].features[j]);}} this.recalculatePlines=function(){for(var i=0;i=0;j--) if(this.mapLayers[i].features[j].type==2) {this.recalculatePlineCoords(this.mapLayers[i].features[j]);}}} this.checkFeatureVisible=function(feature){var tiles=this.imageViewerObject.tiles;for(var c=0;c=0;j--) this.recalculateFeatureCoords(this.mapLayers[i].features[j]);this.mapLayers[i].div.style.visibility='visible';this.mapLayers[i].label_div.style.visibility='visible';}}} this.removeLayerByName=function(name){_mmapgoobj.hideTip();for(var i=0;i=0;t--){this.mapLayers[i].features[t].div.onmousedown=null;this.mapLayers[i].features[t].div.onmouseup=null this.mapLayers[i].features[t].div.onmouseover=null;this.mapLayers[i].div.removeChild(this.mapLayers[i].features[t].div);if(this.mapLayers[i].features[t].label_div) {this.mapLayers[i].label_div.removeChild(this.mapLayers[i].features[t].label_div);}} this.mapLayers[i].features.splice(0,this.mapLayers[i].features.length);this.mapLayers[i].features=null;this.imageViewerObject.activeSurface.removeChild(this.mapLayers[i].div);this.mapLayers[i].div=null;this.mapLayers.splice(i,1);}}} this.discardElement=function(element){var garbageBin=document.getElementById('_mapgo_IELeakGarbageBin');if(!garbageBin){garbageBin=document.createElement('DIV');garbageBin.id='_mapgo_IELeakGarbageBin';garbageBin.style.display='none';document.body.appendChild(garbageBin);} garbageBin.appendChild(element);garbageBin.innerHTML='';garbageBin=null;} this.createLayer=function(id,name,type,sfrom,sto,hide_when_move,POI){var layer=new MapgoLayer();layer.id=id;layer.POI=POI;layer.type=type;layer.name=name;layer.features=[];layer.hide_when_move=hide_when_move;layer.div=document.createElement('div');layer.label_div=document.createElement('div');layer.scale_from=sfrom;layer.scale_to=sto;layer.div.id=layer.id;layer.div.style.position='absolute';layer.div.style.textalign='left !important';layer.label_div.id=layer.id+'_label';layer.label_div.style.position='absolute';layer.div.style.textalign='left !important';return layer;} this.reloadTiles=function(cx,cy,reload){this.changetiles=true;this.positionTiles(this.imageViewerObject,{'x':cx,'y':cy},true);this.changetiles=false;} this.moveStraight=function(wx,wy){for(var i=0;i=0;j--){var f=l.features[j];f.x+=wx;f.y+=wy;if(f.type==1){f.div.style.left=(f.x+f.icon_offx)+'px';f.div.style.top=(f.y+f.icon_offy)+'px';if(f.label_div) {if(f.label_pos==0){f.label_div.style.top=(f.y-10+f.icon_offy)+'px';} else if(f.label_pos==1){f.label_div.style.top=(f.y+parseInt(f.div.style.height)+f.icon_offy)+'px';} f.label_div.style.left=(f.x+f.icon_offx+parseInt(f.div.style.width))+'px';}} if(f.type==2||f.type==3){if(document.all&&!this.opera_browser){var opl=f.div.childNodes[0];opl.style.left=f.x+'px';opl.style.top=f.y+'px';} else{var opl=f.div;if(this.opera_browser){opl.style.left=f.x+this.OmainOffX+'px';opl.style.top=f.y+this.OmainOffY+'px';} else{opl.style.left=f.x+this.mainOffX+'px';opl.style.top=f.y+this.mainOffY+'px';}}}}}} this.positionTilesLayer=function(tiles,dim,start,cmx,cmy,tileDir,type,trans){for(var c=0;cdim.width){do{tile.c-=tiles.length;tile.nx=tile.nx-1;tile.x=(tile.c*dim.tileSize)+dim.x+(cmx-start.x);wrappedAround=true;}while(tile.x>dim.width);}else{while(tile.x<(-1*dim.tileSize)){tile.c+=tiles.length;tile.nx=tile.nx+1;tile.x=(tile.c*dim.tileSize)+dim.x+(cmx-start.x);wrappedAround=true;}} if(tile.y>dim.height){do{tile.r-=tiles[c].length;tile.ny=tile.ny-1;tile.y=(tile.r*dim.tileSize)+dim.y+(cmy-start.y);wrappedAround=true;}while(tile.y>dim.height);}else{while(tile.y<(-1*dim.tileSize)){tile.r+=tiles[c].length;tile.ny=tile.ny+1;tile.y=(tile.r*dim.tileSize)+dim.y+(cmy-start.y);wrappedAround=true;}}} if(this.changetiles){if(!trans) this.setTileImage(tile,true,tileDir,type,trans);this.setTileImage(tile,false,tileDir,type,trans);} tile.img.style.top=tile.y+'px';tile.img.style.left=tile.x+'px';}}} this.positionTiles=function(imageViewer,mouse,reload) {this.position_started=true;var cmousex=0;var cmousey=0;var tiles=imageViewer.tiles;var dim=imageViewer.dimensions;var start=imageViewer.start;var cmx=0;var cmy=0;cmx=mouse.x;cmy=mouse.y;if(this.pilotpl==false) this.changetiles=true;this.positionTilesLayer(tiles,dim,start,cmx,cmy,dim.tileDir,'t01',false);if(dim.tileDir1&&dim.tileDir1.length>0){this.positionTilesLayer(imageViewer.tiles1,dim,start,cmx,cmy,dim.tileDir1,'t02',true);} if(!reload){for(var i=0;itilemax.maxx||((-1)*tile.r+this.kafely)>tilemax.maxy){src='http://www.mapgo.pl/portal/brak.png';} else src=tileDir+'/'+type+'/s'+this.addZeros(this.currscale,2)+'/x'+tsx+'/'+'y'+tsy+'/'+type+'s'+this.addZeros(this.currscale,2)+'x'+this.addZeros((tile.c+this.kafelx),8)+'y'+this.addZeros(((-1)*tile.r+this.kafely),8)+'.png';if(nullOverride&&trans) src='http://www.mapgo.pl/portal/white.png';else if(tile.img.src!=src){if(nullOverride&&!trans) src='http://www.mapgo.pl/portal/brak.png';if(trans&&document.all&&!this.opera_browser&&!this.ie7browser){tile.img.src='http://www.mapgo.pl/portal/blank.gif';tile.img.style.filter="progid:DXImageTransform.Microsoft.AlphaImageLoader(src='"+src+"',sizingMethod='scale')";} else tile.img.src=src;} tile.kx=tile.c+this.kafelx;tile.ky=((-1)*tile.r+this.kafely);} this.moveViewer=function(event) {if(_mmapgoobj.imageViewerObject.pressed){_mmapgoobj.hideTip();var ev=_mmapgoobj.getEvent(event);var imageViewer=_mmapgoobj.imageViewerObject;var mouse=_mmapgoobj.localizeCoordinates(imageViewer,{'x':ev.clientX,'y':ev.clientY});if(ev.clientX<0||ev.clientY<0) _mmapgoobj.releaseViewer(event);else _mmapgoobj.positionTiles(imageViewer,{'x':mouse.x,'y':mouse.y});}} this.getCenterKafel=function(cx,cy){if(cx>0&&cy>0&&cx=img_left&¢er.y>=img_top&¢er.y<=(img_top+this.tileSizeG)){return{'kx':tile.kx,'ky':tile.ky,'x':(center.x-x0),'y':((y0+this.tileSizeG)-center.y)};}}}} else{var rx=cx-(this.imageViewerObject.dimensions.width/2);var ry=cy-(this.imageViewerObject.dimensions.height/2);var px=this.curr_centercalkx+rx;var py=this.curr_centercalky-ry;var x0=parseInt(px/250);var y0=parseInt(py/250);var x1=x0+this.tileSizeG;var y1=y0-this.tileSizeG;var rpx=px-(x0*250);var rpy=py-(y0*250);return{'kx':x0,'ky':y0,'x':rpx,'y':rpy};}} this.pressViewer=function(event) {if(_mmapgoobj._mapgo_stop_move_map) return;if(_mmapgoobj._onclick_ended&&(!document.all||this.opera_browser)){_mmapgoobj._onclick_ended=false;return;} if(!_mmapgoobj.featureClicked) _mmapgoobj.hideTip();if(!_mmapgoobj.featureClicked){_mmapgoobj.hideLayersWhenMove();_mmapgoobj._onclick_ended=false;if(_mmapgoobj.pilotpl==true) _mmapgoobj.changetiles=false;if(!_mmapgoobj.moving){var imageViewer=_mmapgoobj.imageViewerObject;var dim=imageViewer.dimensions;var ev=_mmapgoobj.getEvent(event);var mouse=_mmapgoobj.localizeCoordinates(imageViewer,{'x':ev.clientX,'y':ev.clientY});imageViewer.pressed=true;for(var i=0;i<_mmapgoobj.mapLayers.length;i++){var l=_mmapgoobj.mapLayers[i];if(l) for(var j=l.features.length-1;j>=0;j--){var f=l.features[j];f.offx=f.x;f.offy=f.y;}} imageViewer.start={'x':mouse.x,'y':mouse.y};document.body.onmouseup=_mmapgoobj.releaseViewer;document.body.onmouseout=_mmapgoobj.mouseOutWindow;document.body.onmousemove=_mmapgoobj.moveViewer;}}else _mmapgoobj.featureClicked=false;} this.hideAllLayers=function(){for(var i=0;i=0;j--){var f=l.features[j];f.offx=0;f.offy=0;}} if(_mmapgoobj.pilotpl==true){_mmapgoobj.reloadTiles(imageViewer.start.x,imageViewer.start.y);var ncenter=_mmapgoobj.convertScreenToGeo(_mmapgoobj.imageViewerObject.dimensions.width/2,_mmapgoobj.imageViewerObject.dimensions.height/2);_mmapgoobj.curr_center_lon=ncenter.lon;_mmapgoobj.curr_center_lat=ncenter.lat;var calk_coordsc=_mmapgoobj.przeliczCalkPiksel(_mmapgoobj.curr_center_lon,_mmapgoobj.curr_center_lat);_mmapgoobj.curr_centercalkx=parseInt(calk_coordsc.x);_mmapgoobj.curr_centercalky=parseInt(calk_coordsc.y);if(_mmapgoobj.__move_map_callback&&!_mmapgoobj.block_events) _mmapgoobj.__move_map_callback();_mmapgoobj.manageLayersClustering();_mmapgoobj.showLayersWhenMove();_mmapgoobj.recalculateHiddenLayersCoords();}}}}} this.resetTiles=function(){var tiles=this.imageViewerObject.tiles;for(var c=0;c=0) px=(x-(-12000000))/this.scalex[this.currscale-1];else px=(12000000+x)/this.scalex[this.currscale-1];var py=(y-34000000)/this.scaley[this.currscale-1];return{"x":px,"y":py};} this.przeliczAllCalkPiksel=function(coords){var out=new Array();for(var i=0;i0){if(this._mapgo_reset_route) this.removeLayerByName('mapgo_trasa');var trasa=this.skladajTrase(json_ans);this._mapgo_route_points=trasa;var pline_object={'type':2,'coords':trasa,'color':{'R':0,'G':234,'B':255},'opacity':0.6,'weight':8,'descr':'trasa'};var object_list=new Array();object_list.push(pline_object);if(this.searchLayer('mapgo_trasa')!=null) this.addPlineToLayer(object_list[0],'mapgo_trasa',this._position_map_route);else this.addPlinesToMap(object_list,'mapgo_trasa',this._position_map_route,3,20);} if(this._callback_route_resp_function) this._callback_route_resp_function(json_ans,trasa);}} this._callback_poi_resp_function=0;this.fnWhenPoiDone=function(ans){ans=JSON.stringify(_mmapgoobj._mapgo_response);if(ans!=''){var json_ans=JSON.parse(ans);if(json_ans1=undefined){} if(this._callback_poi_resp_function) this._callback_poi_resp_function(json_ans);}} this.fnWhenAgeoDone=function(ans){ans=JSON.stringify(_mmapgoobj._mapgo_response);if(ans!=''){var json_ans=JSON.parse(ans);if(this._callback_ageo_resp_function) this._callback_ageo_resp_function(json_ans);}} this.fnWhenRegionsDone=function(ans){ans=JSON.stringify(_mmapgoobj._mapgo_response);if(ans!=''){var json_ans=JSON.parse(ans);if(this._callback_regions_resp_function) this._callback_regions_resp_function(json_ans);}} this.makeScreenRouteCoords=function(trasa,cx,cy){var screenc=0;var screenCoords=new Array();var mapscrx=this.imageViewerObject.dimensions.width/2;var mapscry=this.imageViewerObject.dimensions.height/2;var loc_center={"x":mapscrx,"y":mapscry};for(var i=0;ibx*(-1)&&lastxby*(-1)&&lastybx*(-1)&&screenc.xby*(-1)&&screenc.ymaxx) maxx=coords[i].X;if(coords[i].Xmaxy) maxy=coords[i].Y;if(coords[i].Ymaxx) maxx=coords[i].lon;if(coords[i].lonmaxy) maxy=coords[i].lat;if(coords[i].lat=0;j--) var ft=this.mapLayers[i].features[j];var idtxt=ft.id;if(idtxt.indexOf(id_obj)>=0){var type=ft.type;if(type==2||type==3){ft.coords.splice(0,ft.coords.length-1) ft.coords.length=0;} layer.features.splice(j,1);if(layer.type==1){for(var k=layer.all_features.length-1;k>=0;k--) if(layer.all_features[k].id==object.id){layer.all_features.splice(k,1);break;}} break;}}} if(document.getElementById(id_obj)) layer.div.removeChild(document.getElementById(id_obj));} this.addClusteredIconsToMap=function(object_list,layer_name,positionmap,scale_from,scale_to,cluster_icon,hide_when_move,POI){var lid=this.createLayerId();if(positionmap) this.positionMap(object_list);var l=this.createLayer(lid,layer_name,this.ICON_LAYER,scale_from,scale_to,hide_when_move,POI);var ret_layer=0;if(l){if(cluster_icon) l.clustered_icon=cluster_icon;l.all_features=object_list;ret_layer=l.clusterIcons();} return ret_layer;} this.addIconsToMap=function(object_list,layer_name,positionmap,scale_from,scale_to,hide_when_move,POI){var lid=this.createLayerId();if(positionmap) this.positionMap(object_list);var l=this.createLayer(lid,layer_name,this.ICON_LAYER,scale_from,scale_to,hide_when_move);if(l){this.mapLayers.push(l);this.imageViewerObject.activeSurface.appendChild(l.label_div);this.imageViewerObject.activeSurface.appendChild(l.div);var id=0;for(var i=object_list.length-1;i>=0;i--){if(object_list[i].id==0) id=i;else id=object_list[i].id;object_list[i].id=id;var poi=0;if(POI!='undefined'&&POI) poi=!object_list[i].clustered;var icon=this.createIconFeature(id,object_list[i].width,object_list[i].height,object_list[i].descr,object_list[i].lon,object_list[i].lat,object_list[i].image,'img',0,object_list[i].icon_offx,object_list[i].icon_offy,object_list[i].tip_width,object_list[i].tip_height,object_list[i].onclick_function,object_list[i].id,object_list[i].dragable,object_list[i].afterdrag_function,object_list[i],poi);this.addFeatureToLayer(l.id,icon);}} this.manageLayersVisibility();return l;} this.addIconsToLayer=function(object_list,layer_name,position_map,POI){var layer=0;for(var j=0;j=0;i--){object_list[i].cluster=false;layer.all_features.push(object_list[i]);} return layer;} this.addIconToLayer=function(icon,layer_name,position_map,POI){var layer=0;for(var j=0;j0){var type=object_list[0].type;switch(type){case 1:if(object_list.length==1) this.centerTo(object_list[0].lon,object_list[0].lat,8);else{var mbr=this.findObjectsMBR(object_list);var center=this.findCenterMBR(mbr);var cscale=this.findCorrectScale(mbr);cscale--;if(cscale<3) cscale=3;this.centerTo(center.cx,center.cy,cscale);} break;case 2:case 3:var allmbr=new Array();for(var i=object_list.length-1;i>=0;i--){var mbr=this.findObjectsMBR(object_list[i].coords);allmbr.push({'lon':mbr.minx,'lat':mbr.miny});allmbr.push({'lon':mbr.maxx,'lat':mbr.maxy});} var ambr=this.findObjectsMBR(allmbr);var center=this.findCenterMBR(ambr);var cscale=this.findCorrectScale(ambr);this.centerTo(center.cx,center.cy,cscale);break;} this.recalculateLayersCoords();}} this.findMBR=function(obj_list){var minx=99999999;var miny=99999999;var maxx=0;var maxy=0;for(var i=obj_list.b_list.length-1;i>=0;i--){obj_list.b_list[i].x=Math.floor(obj_list.b_list[i].x*1000000+0.5);obj_list.b_list[i].y=Math.floor(obj_list.b_list[i].y*1000000+0.5);if(obj_list.b_list[i].x>maxx) maxx=obj_list.b_list[i].x;if(obj_list.b_list[i].xmaxy) maxy=obj_list.b_list[i].y;if(obj_list.b_list[i].ymaxx) maxx=this.last_g_x;if(this.last_g_xmaxy) maxy=this.last_g_y;if(this.last_g_y=(this.max_scale-1)) scale_cnt=this.max_scale-1;return(scale_cnt);} scale_cnt++;} if(scale_cnt>=(this.max_scale-1)) scale_cnt=this.max_scale-1;return(scale_cnt);} this.last_street='';this.last_city='';this.last_nr='';this.last_city_list=0;this.last_street_list=0;this.last_city_id=24;this.chooseCity=function(citynr){if(this.last_street=="") this.last_street="sdfsdfsdfss";this.choosedCityId=this.last_city_list[citynr].city_id;var gquery=this.makeGeocodeQObj1("",this.last_street,this.last_nr,"","0",this.choosedCityId);var qstring="key="+this._131+"&type=app&gq="+JSON.stringify(gquery);this.callToServer(qstring,'_mmapgoobj.fnWhenGeoDone');} this.chooseStreet=function(streetnr){var gquery=this.makeGeocodeQObj1(this.last_city,"",this.last_nr,"","0",this.choosedCityId,this.last_street_list[streetnr].street_id,this.last_street_list[streetnr].cnt);var qstring="key="+this._131+"&type=app&gq="+JSON.stringify(gquery);this.callToServer(qstring,'_mmapgoobj.fnWhenGeoDone');} this.makeGeocodeQObj1=function(city,street,nr,zip,woj_nr,cityid,streetid,streetcnt){if(cityid) cityid+='';if(streetid) streetid+='';if(nr=="") nr="1";var gobj={"city_name":city,"street_name":street,"zip":zip,"woj_nr":woj_nr,"city_id":cityid,"street_id":streetid,"cnt":streetcnt,"house_nr":nr};return gobj;} this.makeRouterQuery=function(road_type,vehicle_type,search_type,sLon,sLat,eLon,eLat,qid){var robj={"vehicle_type":vehicle_type,"search_type":search_type,"road_type":road_type,"point_list":[{"X":sLon,"Y":sLat,"type":"0"},{"X":eLon,"Y":eLat,"type":"1"}]};return robj;} this.PointEqualFilter=function(points) {var xy=new Object();xy.x=new Array();xy.y=new Array();var p1=new Object();var p2=new Object();p1.x=0;p2.x=0;p1.y=0;p2.y=0;var j=0;p1.x=points[0].x;p1.y=points[0].y;for(var i=1;i0){if(p1.x!=points[i].x||p1.y!=points[i].y){xy.x[j]=p1.x;xy.y[j]=p1.y;j++ p1.x=points[i].x;p1.y=points[i].y;}}} xy.x[j]=points[i-1].x;xy.y[j]=points[i-1].y;return xy;} this.XYtoSTR=function(xy) {var sxy="";var startx=0;var starty=0;var endx=0;var endy=0;var jest_dod=0;for(i=0;i0&&h1>0){if(xy1.x>=_mmapgoobj.map_posx+_mmapgoobj.imageViewerObject.dimensions.width) w1=_mmapgoobj.imageViewerObject.dimensions.width-(parseInt(r.style.left)-_mmapgoobj.map_posx);if(xy1.y>=_mmapgoobj.map_posy+_mmapgoobj.imageViewerObject.dimensions.height) h1=_mmapgoobj.imageViewerObject.dimensions.height-(parseInt(r.style.top)-_mmapgoobj.map_posy);r.style.width=w1+'px';r.style.height=h1+'px';} return false;} this.fromCalkToLonLat=function(cx,cy){var lon=cx*this.scalex[this.currscale-1]+(-12000000);var lat=cy*this.scaley[this.currscale-1]+34000000;return{'lon':lon,'lat':lat};} this.stopRubber=function(evt){_mmapgoobj.dragging_rubber=false;var r=document.getElementById('_mapgo_rubberBand');r.style.visibility='hidden';document.body.onmousemove=null;document.body.onmouseup=null;var calk=_mmapgoobj.przeliczCalkPiksel(_mmapgoobj.curr_center_lon,_mmapgoobj.curr_center_lat);var x1=parseInt(r.style.left);var y1=parseInt(r.style.top);var x2=parseInt(r.style.left)+parseInt(r.style.width);var y2=parseInt(r.style.top)+parseInt(r.style.height);var lc1x=x1-_mmapgoobj.imageViewerObject.dimensions.width/2;var lc1y=y1-_mmapgoobj.imageViewerObject.dimensions.height/2;var lc1calkcx=calk.x+lc1x;var lc1calkcy=calk.y+lc1y*(-1);var lc1conv_lonlat=_mmapgoobj.fromCalkToLonLat(lc1calkcx,lc1calkcy);var lc2x=x2-_mmapgoobj.imageViewerObject.dimensions.width/2;var lc2y=y2-_mmapgoobj.imageViewerObject.dimensions.height/2;var lc2calkcx=calk.x+lc2x;var lc2calkcy=calk.y+lc2y*(-1);var lc2conv_lonlat=_mmapgoobj.fromCalkToLonLat(lc2calkcx,lc2calkcy);var scale_cnt=_mmapgoobj.currscale-1;var stx=(lc1conv_lonlat.lon-lc2conv_lonlat.lon);if(stx<0) stx=-1*stx;var sty=(lc1conv_lonlat.lat-lc2conv_lonlat.lat);if(sty<0) sty=-1*sty;var tempx=0;var tempy=0;if(parseInt(r.style.width)<3||parseInt(r.style.height)<3){scale_cnt--;} else while(scale_cnt>=(_mmapgoobj.min_scale-1)){tempx=_mmapgoobj.imageViewerObject.dimensions.width*_mmapgoobj.scalex[scale_cnt];tempy=_mmapgoobj.imageViewerObject.dimensions.height*_mmapgoobj.scaley[scale_cnt];if(stx>=tempx&&sty>=tempy){break;} scale_cnt--;} if(scale_cnt<=(_mmapgoobj.min_scale-1)) scale_cnt=_mmapgoobj.min_scale;else scale_cnt++;var cx=x1+parseInt(r.style.width)/2;var cy=y1+parseInt(r.style.height)/2;var ncx1=cx-_mmapgoobj.imageViewerObject.dimensions.width/2;var ncy1=cy-_mmapgoobj.imageViewerObject.dimensions.height/2;var calkcx=calk.x+ncx1;var calkcy=calk.y+ncy1*(-1);var conv_lonlat=_mmapgoobj.fromCalkToLonLat(calkcx,calkcy);_mmapgoobj.centerTo(conv_lonlat.lon,conv_lonlat.lat,scale_cnt);_mmapgoobj.recalculateLayersCoords();} this._mapgo_default_cursor=false;this._mapgo_cursor_current='url(http://www.mapgo.pl/portal/gfx/hand32.cur),pointer';this.showDefaultCursor=function(flag){_mmapgoobj._mapgo_default_cursor=flag;if(flag){_mmapgoobj.imageViewerObject.activeSurface.style.cursor='default';} else _mmapgoobj.imageViewerObject.activeSurface.style.cursor=_mmapgoobj._mapgo_cursor_current;} this.setRubber=function(){_mmapgoobj.imageViewerObject.activeSurface.onmousedown=_mmapgoobj.startRubber;if(!_mmapgoobj._mapgo_default_cursor){_mmapgoobj.imageViewerObject.activeSurface.style.cursor='crosshair';_mmapgoobj._mapgo_cursor_current='crosshair';}} this.setAgeo=function(){_mmapgoobj.imageViewerObject.activeSurface.onmousedown=_mmapgoobj.startAntygeo;if(!_mmapgoobj._mapgo_default_cursor){_mmapgoobj.imageViewerObject.activeSurface.style.cursor='help';_mmapgoobj._mapgo_cursor_current='help';}} this._mapgo_coords_tool_callback=0;this.setCoordsTool=function(callback_function){_mmapgoobj.imageViewerObject.activeSurface.onmousedown=_mmapgoobj.startCoordsTool;_mmapgoobj._mapgo_coords_tool_callback=callback_function;if(!_mmapgoobj._mapgo_default_cursor){_mmapgoobj.imageViewerObject.activeSurface.style.cursor='crosshair';_mmapgoobj._mapgo_cursor_current='crosshair';}} this.setMeter=function(callback_function,resetDrawnLines){_mmapgoobj.imageViewerObject.activeSurface.onmousedown=_mmapgoobj.startMeter;if(!_mmapgoobj._mapgo_default_cursor){_mmapgoobj.imageViewerObject.activeSurface.style.cursor='crosshair';_mmapgoobj._mapgo_cursor_current='crosshair';} _mmapgoobj.meter_handler=callback_function;_mmapgoobj.remove_meter_layer=resetDrawnLines;} this.resetMeter=function(){_mmapgoobj.meter_click_cnt_all=0;_mmapgoobj.meter_dist_all=0;_mmapgoobj.removeLayerByName('_mapgo_icon_meter');_mmapgoobj.removeLayerByName('_mapgo_pline_meter');} this.setMoveMap=function(){_mmapgoobj.imageViewerObject.activeSurface.onmousedown=_mmapgoobj.pressViewer;if(!_mmapgoobj._mapgo_default_cursor){this.imageViewerObject.activeSurface.style.cursor='url(http://www.mapgo.pl/portal/gfx/hand32.cur),pointer';_mmapgoobj._mapgo_cursor_current='url(http://www.mapgo.pl/portal/gfx/hand32.cur),pointer';}} this.showToolbar=function(){document.getElementById("_mapgo_toolbar").style.visibility='visible';document.getElementById("_mapgo_toolbar").style.display='block';} this.hideToolbar=function(){document.getElementById("_mapgo_toolbar").style.visibility='hidden';} this.checkPosition=function(obj_top,obj_left,obj_width,obj_height,tip_width,tip_height,mainminx,mainminy,mainwidth,mainheight){obj_top=parseInt(obj_top);obj_left=parseInt(obj_left);obj_width=parseInt(obj_width);obj_height=parseInt(obj_height);if((obj_left+obj_width+tip_width)<=(mainminx+mainwidth)&&(obj_top-tip_height>=mainminy)) return{"x":(obj_left+obj_width),"y":(obj_top-tip_height)};if((obj_top-tip_height>=mainminy)&&((obj_left-tip_width)>=mainminx)) return{"y":(obj_top-tip_height),"x":(obj_left-tip_width)};if((obj_left+obj_width+tip_width)<=(mainminx+mainwidth)&&(obj_top+obj_height+tip_height)<=(mainminy+mainheight)) return{"x":(obj_left+obj_width),"y":(obj_top+obj_height)};if(((obj_left-tip_width)>=mainminx)&&(obj_top+obj_height+tip_height)<=(mainminy+mainheight)) return{"x":(obj_left-tip_width),"y":(obj_top+obj_height)};} this.hideUpperLayer=function(){var tiles=this.imageViewerObject.tiles1;for(var c=0;c
';this.swapTipClose=function(type){if(type==1) document.getElementById('mapgo_tip_tip_tr').style.backgroundImage='url('+this.baseTipUrl+'tip_tr_actv.png)';else document.getElementById('mapgo_tip_tip_tr').style.backgroundImage='url('+this.baseTipUrl+'tip_tr.png)';} this.initMap=function(x,y,scale,w,h,posx,posy,tiles_dir){if(__isIE){if(!document.documentMode||document.documentMode<8) document.createStyleSheet().addRule('v\\:*',"behavior: url (#default#VML);");document.writeln('<'+'?import namespace="v" implementation="#default#VML" ?>');} var img1=new Image();img1.src='http://www.mapgo.pl/portal/tip4/tip_tr.png';if(_mapgo_BrowserDetect.browser.indexOf('Opera')>=0){this.opera_browser=true;} if(!posx) posx=0;if(!posy) posy=0;this.map_posx=posx;this.map_posy=posy;this.map_width=w;this.map_height=h;document.write('');if(document.all&&!this.opera_browser) document.write('
Copyright (c) 2010 Imagis S.A.
');else document.write('
Copyright (c) 2010 Imagis S.A.
');this.disableSelection(document.getElementById("_mapgo_root"));this.disableSelection(document.getElementById("_mapgo_toolbar"));this.disableSelection(document.getElementById("_mapgo_powered_txt"));this.disableSelection(document.getElementById("_mapgo_warunki_txt"));this.disableSelection(document.getElementById("_mapgo_logo"));if(this._131=='99601825-01ec-496f-a588-40ad0d2a911a') document.getElementById("_mapgo_logo").style.visibility='hidden'; document.getElementById("_mapgo_warunki_txt").style.left=(w-325)+'px';document.getElementById("_mapgo_warunki_txt").style.top=(h-20)+'px'; document.getElementById("_mapgo_powered_txt").style.left=(w-225)+'px';document.getElementById("_mapgo_powered_txt").style.top=(h-21)+'px'; /*if(document.all&&!this.opera_browser){var logo_img=document.getElementById('_mapgo_logo_img');logo_img.src='http://www.mapgo.pl/portal/blank.gif'; logo_img.style.filter="progid:DXImageTransform.Microsoft.AlphaImageLoader(src='http://www.mapgo.pl/mapgoapi/gfx/logo_mapgo.png',sizingMethod='image')";} */ document.getElementById("_mapgo_logo").style.left=(1)+'px';document.getElementById("_mapgo_logo").style.top=(h-41)+'px';document.getElementById("_mapgo_toolbar").style.left=(5)+'px';document.getElementById("_mapgo_toolbar").style.top=(5)+'px';document.getElementById("_mapgo_toolbar").style.zIndex=5500;if(document.all&&!this.opera_browser) this.prepareTipIE();if(tiles_dir&&tiles_dir!='') this.prepareViewer(document.getElementById("_mapgo_root"),tiles_dir,this.upperTilesDir,250,30,30,w,h);else this.prepareViewer(document.getElementById("_mapgo_root"),'http://zszr.zdm.waw.pl/kafle2010',this.upperTilesDir,250,30,30,w,h);this.centerTo(x,y,scale);this.start_centercalkx=this.curr_centercalkx;this.start_centercalky=this.curr_centercalky;var object_list=new Array();var icon1=new MapgoIcon();icon1.descr='';icon1.image='http://www.mapgo.pl/portal/gfx/kropka.png';icon1.width=7;icon1.height=6;icon1.icon_offx=-3;icon1.icon_offy=-2;icon1.lon=x;icon1.lat=y;object_list.push(icon1);this.addIconsToMap(object_list,"_mapgo_icon_meter");this.removeLayerByName('_mapgo_icon_meter');var lldiv=document.createElement('div');lldiv.style.position='absolute';lldiv.style.width='1px';lldiv.style.height='1px';this.imageViewerObject.activeSurface.appendChild(lldiv);window.onscroll=_mmapgoobj.scroll;} this.city1='';this.street1='';this.no1='';this.city2='';this.street2='';this.no2='';this.AddressOneFounded=0;this.startPoint={"X":0,"Y":0};this.endPoint={"X":0,"Y":0};this._startroutedescr="";this._stoproutedescr="";this._trasa_dlugosc=' ';this._trasa_czas=' ';this._curr_address='';this.setAllPoland=function(){this.centerTo(19000000,52250000,17);this.recalculateLayersCoords();} this.findAddress=function(city,str_no,listener_function,country_id){var strn=this.splitStreetNo(str_no);this.queryGeocoder(city,strn.street,strn.no,'','0',listener_function,country_id);} this.getTimeDescr=function(time){var minutes=Math.round(time/600);var hours=Math.floor(minutes/60);minutes=minutes-hours*60;if(hours>0) return hours+'h'+minutes+'m';else return minutes+'m';} this.addRouteIcons=function(slon,slat,elon,elat,sdescr,edescr){var objs=new Array();var sobj={'type':1,'lon':slon,'lat':slat,'descr':sdescr,'width':46,'height':34,'image':'http://www.mapgo.pl/portal/gfx/start.png','icon_offx':-23,'icon_offy':-34};var eobj={'type':1,'lon':elon,'lat':elat,'descr':edescr,'width':46,'height':34,'image':'http://www.mapgo.pl/portal/gfx/meta.png','icon_offx':-23,'icon_offy':-34};objs.push(sobj);objs.push(eobj);this.addIconsToMap(objs,'ikony_trasa',false);} this.zoom_in=function() {_mmapgoobj.changeScale(_mmapgoobj.currscale-1);} this.zoom_out=function() {_mmapgoobj.changeScale(_mmapgoobj.currscale+1);} this.makeTipFrames=function(w,h){document.getElementById("mapgo_tip_tip_t").style.width=w+0+'px';document.getElementById("mapgo_tip_tip_tr").style.left=(w+5+0)+'px';document.getElementById("mapgo_tip_tip_r").style.left=(w+5+0)+'px';document.getElementById("mapgo_tip_tip_r").style.height=h+'px';document.getElementById("mapgo_tip_tip_br").style.top=(h+5)+'px';document.getElementById("mapgo_tip_tip_br").style.left=(w+5+0)+'px';document.getElementById("mapgo_tip_tip_b").style.top=(h+5)+'px';document.getElementById("mapgo_tip_tip_b").style.width=w+'px';document.getElementById("mapgo_tip_tip_bl").style.top=(h+5)+'px';document.getElementById("mapgo_tip_tip_l").style.height=h+'px';document.getElementById("mapgo_tip_txt").style.width=w+'px';document.getElementById("mapgo_tip_txt").style.height=h+'px';} this.makeTip=function(tekst,w,h){document.getElementById("mapgo_tip_txt").innerHTML=tekst;if(w&&h) _mmapgoobj.makeTipFrames(w,h);else{document.getElementById("mapgo_tip_txt").style.width='';document.getElementById("mapgo_tip_txt").style.height='';_mmapgoobj.makeTipFrames(document.getElementById("mapgo_tip_txt").offsetWidth,document.getElementById("mapgo_tip_txt").offsetHeight);}} this.fillTipTxt=function(){} this._dymek_lb=document.createElement('img');this._dymek_rb=document.createElement('img');this._dymek_lt=document.createElement('img');this._dymek_rt=document.createElement('img');this.prepareTipIE=function(){var foot_img=document.getElementById("mapgo_tip_foot_img") var imgsrc=foot_img.src;var _blank='http://www.mapgo.pl/portal/blank.gif';foot_img.src=_blank;foot_img.style.filter="progid:DXImageTransform.Microsoft.AlphaImageLoader(src='"+imgsrc+"',sizingMethod='image')";var _base='http://www.mapgo.pl/portal/tip4/';this._dymek_lb.src=_blank;this._dymek_lb.style.filter="progid:DXImageTransform.Microsoft.AlphaImageLoader(src='"+_base+"foot_d.png',sizingMethod='image')";this._dymek_rb.src=_blank;this._dymek_rb.style.filter="progid:DXImageTransform.Microsoft.AlphaImageLoader(src='"+_base+"foot_c.png',sizingMethod='image')";this._dymek_lt.src=_blank;this._dymek_lt.style.filter="progid:DXImageTransform.Microsoft.AlphaImageLoader(src='"+_base+"foot_a.png',sizingMethod='image')";this._dymek_rt.src=_blank;this._dymek_rt.style.filter="progid:DXImageTransform.Microsoft.AlphaImageLoader(src='"+_base+"foot_b.png',sizingMethod='image')";} this.positionDymek=function(w,h,type){w=parseInt(w);h=parseInt(h);var _base='http://www.mapgo.pl/portal/tip4/';var foot=document.getElementById("mapgo_tip_foot");var foot_img=document.getElementById("mapgo_tip_foot_img");foot.style.verticalalign='none';foot_img.style.verticalalign='none';switch(type){case 1:if(document.all&&!this.opera_browser){foot.removeChild(foot_img);this._dymek_lb.id="mapgo_tip_foot_img";foot.appendChild(this._dymek_lb);} else foot_img.src=_base+'foot_d.png';foot.style.left=(parseInt(document.getElementById("mapgo_tip_tip_bl").style.left))+'px';var roznica=(parseInt(foot.offsetHeight)-parseInt(foot.style.height))/2;document.getElementById("mapgo_tip_foot_img").style.top='0px';foot.style.top=parseInt(document.getElementById("mapgo_tip_tip_b").style.top)+(9-roznica)+'px';break;case 0:if(document.all&&!this.opera_browser){foot.removeChild(foot_img);this._dymek_rb.id="mapgo_tip_foot_img";foot.appendChild(this._dymek_rb);} else foot_img.src=_base+'foot_c.png';foot.style.left=(parseInt(document.getElementById("mapgo_tip_tip_bl").style.left)+w-27)+'px';var roznica=(parseInt(foot.offsetHeight)-parseInt(foot.style.height))/2;document.getElementById("mapgo_tip_foot_img").style.top='0px';foot.style.top=(parseInt(document.getElementById("mapgo_tip_tip_b").style.top)+(9-roznica))+'px';break;case 2:if(document.all&&!this.opera_browser){foot.removeChild(foot_img);this._dymek_lt.id="mapgo_tip_foot_img";foot.appendChild(this._dymek_lt);} else foot_img.src=_base+'foot_a.png';foot.style.left=(parseInt(document.getElementById("mapgo_tip_tip_tl").style.left))+'px';document.getElementById("mapgo_tip_foot_img").style.top='0px';var roznica=(parseInt(foot.offsetHeight)-parseInt(foot.style.height))/2;var img=document.getElementById('mapgo_tip_foot_img');foot.style.top=(parseInt(document.getElementById("mapgo_tip_tip_t").style.top)-(9+roznica))+'px';break;case 3:if(document.all&&!this.opera_browser){foot.removeChild(foot_img);this._dymek_rt.id="mapgo_tip_foot_img";foot.appendChild(this._dymek_rt);} else foot_img.src=_base+'foot_b.png';foot.style.left=(parseInt(document.getElementById("mapgo_tip_tip_tl").style.left)+w-27)+'px';var roznica=(parseInt(foot.offsetHeight)-parseInt(foot.style.height))/2;document.getElementById("mapgo_tip_foot_img").style.top='0px';foot.style.top=(parseInt(document.getElementById("mapgo_tip_tip_t").style.top)-(9+roznica))+'px';break;default:if(document.all&&!this.opera_browser){foot.removeChild(foot_img);this._dymek_lb.id="mapgo_tip_foot_img";foot.appendChild(this._dymek_lb);} else foot_img.src=_base+'foot_d.png';foot.style.left=(parseInt(document.getElementById("mapgo_tip_tip_bl").style.left))+'px';foot.style.top=parseInt(document.getElementById("mapgo_tip_tip_b").style.top)+4+'px';break;} foot.style.visibility='visible';} this.positionTip=function(e){var tipobj=document.getElementById("_mapgo_tip");var _mw=parseInt(this.imageViewerObject.style.width);var _mh=parseInt(this.imageViewerObject.style.height);var minx=0;var miny=0;var mainwidth=_mw;var mainheight=_mh;var mw=parseInt(document.getElementById("mapgo_tip_txt").style.width)+10;var mh=parseInt(document.getElementById("mapgo_tip_txt").style.height)+10;var xy=_mmapgoobj.checkPosition(e.style.top,e.style.left,e.offsetWidth,e.offsetHeight,mw,mh,minx,miny,mainwidth,mainheight);tipobj.style.left=(xy.x)+'px';if(xy.type==1||xy.type==0){tipobj.style.top=(xy.y)+'px';if(document.all&&!this.opera_browser) document.getElementById("mapgo_tip_txt").style.top=(parseInt(document.getElementById("mapgo_tip_tip_tl").style.top)+5)+'px';} else tipobj.style.top=(xy.y)+'px';tipobj.style.top=parseInt(tipobj.style.top)+'px';tipobj.style.visibility='visible';_mmapgoobj.positionDymek(document.getElementById("mapgo_tip_txt").style.width,document.getElementById("mapgo_tip_txt").style.height,xy.type);if(!_mmapgoobj.tip_corrected){_mmapgoobj.tip_corrected=true;}} this.tip_corrected=false;this.checkPosition=function(obj_top,obj_left,obj_width,obj_height,tip_width,tip_height,mainminx,mainminy,mainwidth,mainheight){obj_top=parseInt(obj_top);obj_left=parseInt(obj_left);obj_width=parseInt(obj_width);obj_height=parseInt(obj_height);if((obj_left+obj_width+tip_width)<=(mainminx+mainwidth)&&(obj_top-tip_height>=mainminy)) return{"x":(obj_left+obj_width),"y":(obj_top-tip_height),"type":1};if((obj_top-tip_height>=mainminy)&&((obj_left-tip_width)>=mainminx)) return{"y":(obj_top-tip_height),"x":(obj_left-tip_width),"type":0};if((obj_left+obj_width+tip_width)<=(mainminx+mainwidth)&&(obj_top+obj_height+tip_height)<=(mainminy+mainheight)) return{"x":(obj_left+obj_width),"y":(obj_top+obj_height),"type":2};if(((obj_left-tip_width)>=mainminx)&&(obj_top+obj_height+tip_height)<=(mainminy+mainheight)) return{"x":(obj_left-tip_width),"y":(obj_top+obj_height),"type":3};return{"x":(obj_left+obj_width),"y":(obj_top-tip_height),"type":1};} this.hideTip=function(){document.getElementById("_mapgo_tip").style.visibility='hidden';document.getElementById("_mapgo_tip").style.top='40px';document.getElementById("_mapgo_tip").style.left='100px';document.getElementById("mapgo_tip_foot").style.visibility='hidden';_mmapgoobj.tip_corrected=false;this.last_div_tip=0;} this.replaceLetters=function(desc){desc=desc.replace('Ä™','e');desc=desc.replace('Ăł','o');desc=desc.replace('ę','e');desc=desc.replace('Ę','E');desc=desc.replace('Ę','E');desc=desc.replace('ó','o');desc=desc.replace('Ă“','O');desc=desc.replace('Ó','O');desc=desc.replace('Ä„','A');desc=desc.replace('Ą','A');desc=desc.replace('Ä…','a');desc=desc.replace('ą','a');desc=desc.replace('ś','s');desc=desc.replace('Ĺ›','s');desc=desc.replace('Ĺš','S');desc=desc.replace('Ś','S');desc=desc.replace('Ĺ‚','l');desc=desc.replace('ł','l');desc=desc.replace('Ł','L');desc=desc.replace('Ł','L');desc=desc.replace('Ĺ»','Z');desc=desc.replace('Ż','Z');desc=desc.replace('ĹĽ','z');desc=desc.replace('ż','z');desc=desc.replace('Ż','Z');desc=desc.replace('Ĺş','z');desc=desc.replace('ź','z');desc=desc.replace('Ĺą','z');desc=desc.replace('Ź','z');desc=desc.replace('ć','c');desc=desc.replace('ć','c');desc=desc.replace('Ć','C');desc=desc.replace('Ć','C');desc=desc.replace('Ĺ„','n');desc=desc.replace('ń','n');desc=desc.replace('Ń','N');desc=desc.replace('Ń','N');desc=desc.replace('ü','u');desc=desc.replace('ö','o');desc=desc.replace('š','s');desc=desc.replace('á','a');desc=desc.replace('ë','e');desc=desc.replace('Ê','E');desc=desc.replace('ê','e');desc=desc.replace('¡','A');desc=desc.replace('±','a');desc=desc.replace('¦','S');desc=desc.replace('¶','s');desc=desc.replace('£','L');desc=desc.replace('³','l');desc=desc.replace('¯','Z');desc=desc.replace('¿','z');desc=desc.replace('¬','Z');desc=desc.replace('¼','z');desc=desc.replace('Æ','C');desc=desc.replace('æ','c');desc=desc.replace('Ñ','N');desc=desc.replace('ñ','n');desc=desc.replace('%EA','e');desc=desc.replace('%F3','o');desc=desc.replace('%B1','a');desc=desc.replace('%B6','s');desc=desc.replace('%B3','l');desc=desc.replace('%BF','z');desc=desc.replace('%BC','z');desc=desc.replace('%E6','c');desc=desc.replace('%F1','n');return desc;} this.qid="";this.callToServer=function(querystring,callbackFunction){querystring=this.replaceLetters(querystring);querystring=this.replaceLetters(querystring);var URL='http://api.mapgo.pl/api.php?'+querystring+'&callb='+callbackFunction;cdAJAX.get({url:URL,onSuccess:function(obj){}});return false;} this.callToServerUrl=function(querystring,callbackFunction,url){var URL=url+'?'+querystring+'&callb='+callbackFunction+'&qid='+this.qid;cdAJAX.get({url:URL,onSuccess:function(obj){}});return false;} this.callToServerUrlPost=function(querystring,callbackFunction,url){var URL=url;var qstring=querystring+'&callb='+callbackFunction+'&qid='+this.qid;cdAJAX.post({url:URL,params:qstring});return false;} this.disableSelection=function(target){if(typeof target.onselectstart!="undefined") target.onselectstart=function(){return false} else if(typeof target.style.MozUserSelect!="undefined") target.style.MozUserSelect="none" else target.onmousedown=function(){return false} target.style.cursor="default"}}