if( typeof gCEXTENDEDPTVMAP == 'undefined' ){
  var gCEXTENDEDPTVMAP = 'defined';
  var gCExtendedPTVMapInstanceCounter = 0;
  var gCExtendedPTVMapInstances = new Array;
  var CExtendedPTVMap = Class.create();
  CExtendedPTVMap.prototype = Object.extend(new APTVMap(), {
    initialize: function( aMapDivName, aMapParams ) {
      gCExtendedPTVMapInstances[gCExtendedPTVMapInstanceCounter]=this;
      this.instance=gCExtendedPTVMapInstanceCounter++;
      this.classtype="CExtendedPTVMap";
      this.mapDivName = aMapDivName;
      this.mapDiv = $(aMapDivName);
      this.mapParams = aMapParams;
      this.content=new Hash();
      this.contcount = 0;
      this.activeTimeout=null;
    },
    additionalMapInitialisations:function(){
       this.map.setAllowMouseWheelZoom(true);

       var MyRequestBuilder=new com.ptvag.webcomponent.map.RequestBuilder(this.map,true);
       MyRequestBuilder.defaultRB=new com.ptvag.webcomponent.map.RequestBuilder(this.map,true);
       MyRequestBuilder.buildRequest = function(left,top,right,bottom,width,height,loginfo,mapVersion){
         var r=this.defaultRB.buildRequest(left,top,right,bottom,width,height,loginfo,mapVersion);
         var OSMdiff = Math.abs(left - right);
         var OSMzoom = 33 - Math.round(Math.log(OSMdiff) / Math.log(Math.pow(4, (1 / 3))));
         var OSMfold = Math.round((20015087 + Math.round(left)) / OSMdiff);
         var OSMimg = Math.round((20015085 + Math.round(bottom)) / OSMdiff);
         r.url="http://gis-sitkol-01.hafas.de/tiles/poland/ptv/"+OSMzoom+"/"+OSMfold+"/"+OSMimg+".png";
         return r;
         };
       var MyTiles=new com.ptvag.webcomponent.map.layer.TileMapLayer(MyRequestBuilder);
       MyTiles.setLayerOpacity(1.0);
       if(typeof MyTiles.setRemoveUnusedElements!='undefined') {
         MyTiles.setRemoveUnusedElements(true);
       }
       MyTiles.setIsRelative(true);        
       MyTiles.setNeedsOpacityHack(true);  
       this.map.addLayer(MyTiles,"myLayer",0,this.map.getLayer("label"));
    }
  });
}


