if( typeof gAPTVMAP == 'undefined' ){
  var gAPTVMAP = 'defined';

  var sizeCenterZoom2BBox = function(width, height, center, zoom) {
    var supp = com.ptvag.webcomponent.map.CoordUtil.getSmartUnitsPerPixel(zoom);
    var bb = {left:center.x - supp*width/2, top:center.y + supp*height/2,
    right:center.x + supp*width/2, bottom:center.y - supp*height/2};
    return bb;
  }

  var sizeCenterZoomInSUPP2BBox = function(width, height, center, supp) {
    var bb = {left:center.x - supp*width/2, top:center.y + supp*height/2,
    right:center.x + supp*width/2, bottom:center.y - supp*height/2};
    return bb;
  }
  var APTVMap = Class.create();
  APTVMap.prototype = Object.extend(new AAjaxMap(), {
    localurl : gJSMapImagePath+"APTVMap/",
    getURLParams: function(){
      var par=
        "&REQMapWidth="+this.mapDiv.clientWidth+
        "&REQMapHeight="+this.mapDiv.clientHeight+
        "&REQMapCenterX="+this.getCenter().getLon()+
        "&REQMapCenterY="+this.getCenter().getLat()+
        "&REQMapScaling="+this.getZoom();
      var r=0;
      for(var c=this.contcount;c>0;c--){
        var p=this.content.get(c.toString());
        if(typeof p != 'undefined') {
          if(p.show){
            if(p.type=='polyline' || p.type=='route'){
              par+="&REQMapRoute"+r+".DisplayMode=POLYGON";
              par+="&REQMapRoute"+r+".Color="+this.getColorFFFFFF(p.color);
              par+="&REQMapRoute"+r+".LineWidth="+p.width;
              for(var l=0;l<p.coords.length;l++){
                par+="&REQMapRoute"+r+".Location"+l+".X="+p.coords[l].getLon();
                par+="&REQMapRoute"+r+".Location"+l+".Y="+p.coords[l].getLat();
                if(l==0||l==p.coords.length-1)
                  par+="&REQMapRoute"+r+".Location"+l+".Marker=TRANSPARENT";
              }
              r++;
            }
            else if(p.type=='location'){
              par+="&REQMapRoute"+r+".DisplayMode=LOCATIONS";
              par+="&REQMapRoute"+r+".Location0.X="+p.coord.getLon();
              par+="&REQMapRoute"+r+".Location0.Y="+p.coord.getLat();
  //            par+="&REQMapRoute"+r+".Location0.Name="+p.text;
              var imageptv=p.imageurl.substring(p.imageurl.lastIndexOf("/")+1,p.imageurl.lastIndexOf(".")).toUpperCase();
              par+="&REQMapRoute"+r+".Location0.Marker="+imageptv;
              r++;
            }
        }
        }
      }
      return par;
    },
    additionalMapInitialisations:function(){
    },
    setMouseWheelZoom:function(){
      this.map.setAllowMouseWheelZoom(false);
    },
    setDoubleClickZoom:function(boolval){
      this.map.setAllowDoubleClickZoom(boolval);
    },
    setAllowedZoomLevels:function(min,max){
      if(com.ptvag.webcomponent.map.CoordUtil.ZOOM_LEVEL_FACTOR == 2) // Google Zoom Stufen
        com.ptvag.webcomponent.map.CoordUtil.useGoogleZoomLevels(min,max);
      else
        com.ptvag.webcomponent.map.CoordUtil.usePTVZoomLevels(min,max);
      this.mapParams.zoomLimit.min = min;
      this.mapParams.zoomLimit.max = max;
    },
    decodeUniCode:function(u){
      var d=this.addElem("div","dummy",{display:"none"},this.mapDiv);
      d.innerHTML=u;
      var a=d.innerHTML;
      this.mapDiv.removeChild(d);
      return a;
    },
    updateToolbarButton: function(but,imgurl,next,width,height,tooltip,clickHandler){
      var b=this.toolbar.removeElement(but);
      b.imgUrl=imgurl;
      b.width=width;
      b.height=height;
      if(tooltip!=null) b.tooltip=this.decodeUniCode(tooltip);
      if(clickHandler!=null) b.clickHandler=clickHandler;
      this.toolbar.addElement(b,next);
    },
    newToolbarButton: function(imgurl,next,width,height,tooltip,clickHandler,enabled,id){
      this.toolbar.addElement({width:2,id:"spacing_after_"+id},next);
      var b={imgUrl:imgurl,width:width,height:height,tooltip:this.decodeUniCode(tooltip),enabled:enabled,id:id,clickHandler:clickHandler};
      this.toolbar.addElement(b,"spacing_after_"+id);
    },
    removeToolbarElements: function(e){
      for(var i=0;i<e.length;i++)this.toolbar.removeElement(e[i]);
    },
    show: function() {
      var w=(typeof this.mapParams.width!='undefined'?this.mapParams.width:this.mapDiv.clientWidth);
      var h=(typeof this.mapParams.height!='undefined'?this.mapParams.height:this.mapDiv.clientHeight);
      var bbox = sizeCenterZoom2BBox( w,h,
                                      this.CCoord2SmartUnit(this.mapParams.coord),
                                      this.AjaxMap2PTVZoom( this.mapParams.zoom ) );
      if(typeof this.mapParams.zoomLimit != 'undefined') {
          this.setAllowedZoomLevels(this.mapParams.zoomLimit.min,this.mapParams.zoomLimit.max);
      }
      // Karte mit Custom-Profile laden
      if(typeof this.mapParams.profileGroup != 'undefined') {
        this.map = new com.ptvag.webcomponent.map.Map( this.mapDiv, bbox, true, this.mapParams.profileGroup );
      // Karte mit Standard Profil laden
      }else{
      this.map = new com.ptvag.webcomponent.map.Map( this.mapDiv, bbox );
      }
      this.toolbar=this.map.getLayer("toolbar");
      this.toolbar.switchToMoveMode();
      this.toolbar.setAreaOpacity(0.01);
      this.toolbar.setBlendingOpacityOut(0.01);
      this.toolbar.setBlendingOpacityOver(0.3);
      this.toolbar.setButtonOpacityDisabled(0.4);
      this.toolbar.setButtonOpacityOut(0.7);
      this.toolbar.setButtonOpacityOver(1.0);
      this.drawmode = false;

      this.updateToolbarButton("zoom-out",this.localurl+"zoomout.png","spacing-between-zoom",20,20,this.mapParams.tZoomOut,null);
      this.updateToolbarButton("zoom-in",this.localurl+"zoomin.png","spacing-after-zoom",20,20,this.mapParams.tZoomIn,null);


      this.map.setAnimate(true);
      this.map.removeLayer("scale");

      if(typeof this.mapParams.mode!='undefined'&&this.mapParams.mode=="simple"){
        this.removeToolbarElements(["hybrid-view","spacing-between-view-1","aerial-view","spacing-between-view-2","map-view","spacing-after-view"]);
        this.removeToolbarElements(["spacing-after-zoom","zoom-mode","spacing-between-mode","move-mode","spacing-after-mode",
                                    "measurement","spacing-after-measurement","spacing-after-address-lookup","overview","spacing-after-overview",
                                    "reset","spacing-after-reset","history-back","spacing-between-history","history-forward"]);
        this.map.removeLayer("zoomslider");
        this.map.removeLayer("scale");
        this.map.removeLayer("compass");
      }else{
        if(typeof this.mapParams.profileGroup == 'undefined') {
        this.map.setProfileGroup("terrain");
        }
        this.map.getLayer("position").setEnabled(true);
        this.updateToolbarButton("zoom-mode",this.localurl+"lupe.png","spacing-between-mode",20,20,this.mapParams.tZoomMode,function(){
          this.toolbar.switchToZoomMode();
          this.updateToolbarButton("move-mode",this.localurl+"hand.png","spacing-after-mode",20,20,null,null);
          this.updateToolbarButton("zoom-mode",this.localurl+"lupe1.png","spacing-between-mode",20,20,null,null);
          return false;
        }.bind(this));
        this.updateToolbarButton("move-mode",this.localurl+"hand1.png","spacing-after-mode",20,20,this.mapParams.tMoveMode,function(){
          this.toolbar.switchToMoveMode();
          this.updateToolbarButton("move-mode",this.localurl+"hand1.png","spacing-after-mode",20,20,null,null);
          this.updateToolbarButton("zoom-mode",this.localurl+"lupe.png","spacing-between-mode",20,20,null,null);
          return false;
        }.bind(this));
        this.removeToolbarElements(["hybrid-view","spacing-between-view-1","aerial-view","spacing-between-view-2","map-view","spacing-after-view"]);
/*        this.updateToolbarButton("map-view",this.localurl+"standardview1.png","spacing-between-view-1",20,20,null,function(){
          this.toolbar.switchToPlainView();
          this.updateToolbarButton("map-view",this.localurl+"standardview1.png","spacing-between-view-1",20,20,null,null);
          this.updateToolbarButton("hybrid-view",this.localurl+"hybridview.gif","spacing-between-view-2",20,20,null,null);
          this.updateToolbarButton("aerial-view",this.localurl+"aerialview.png","spacing-after-view",20,20,null,null);
          return false;
        }.bind(this));
        this.updateToolbarButton("hybrid-view",this.localurl+"hybridview.gif","spacing-between-view-2",20,20,null,function(){
          this.toolbar.switchToHybridView();
          this.updateToolbarButton("map-view",this.localurl+"standardview.png","spacing-between-view-1",20,20,null,null);
          this.updateToolbarButton("hybrid-view",this.localurl+"hybridview1.gif","spacing-between-view-2",20,20,null,null);
          this.updateToolbarButton("aerial-view",this.localurl+"aerialview.png","spacing-after-view",20,20,null,null);
          return false;
        }.bind(this));
        this.updateToolbarButton("aerial-view",this.localurl+"aerialview.png","spacing-after-view",20,20,null,function(){
          this.toolbar.switchToAerialView();
          this.updateToolbarButton("map-view",this.localurl+"standardview.png","spacing-between-view-1",20,20,null,null);
          this.updateToolbarButton("hybrid-view",this.localurl+"hybridview.gif","spacing-between-view-2",20,20,null,null);
          this.updateToolbarButton("aerial-view",this.localurl+"aerialview1.png","spacing-after-view",20,20,null,null);
          return false;
        }.bind(this));*/
        this.updateToolbarButton("measurement",this.localurl+"measure.png","spacing-after-address-lookup",20,20,this.mapParams.tMeasurement,function(){
          this.toolbar.toggleMeasurement();
          if(typeof this.map.getLayer("measurement")!='undefined'&&this.map.getLayer("measurement").isEnabled())
            this.updateToolbarButton("measurement",this.localurl+"measure1.png","spacing-after-address-lookup",20,20,null,null);
          else
            this.updateToolbarButton("measurement",this.localurl+"measure.png","spacing-after-address-lookup",20,20,null,null);
          return false;
        }.bind(this));
        this.updateToolbarButton("overview",this.localurl+"minimap.png","spacing-after-overview",20,20,this.mapParams.tOverview,function(){
          this.toolbar.toggleOverview();
          if(typeof this.map.getLayer("overview")!='undefined'&&this.map.getLayer("overview").isEnabled())
            this.updateToolbarButton("overview",this.localurl+"nominimap.png","spacing-after-overview",20,20,null,null);
          else
            this.updateToolbarButton("overview",this.localurl+"minimap.png","spacing-after-overview",20,20,null,null);
          return false;
        }.bind(this));
        this.updateToolbarButton("reset",this.localurl+"reset.png","spacing-after-reset",20,20,this.mapParams.tReset,null);
        this.updateToolbarButton("history-back",this.localurl+"left.png","spacing-between-history",20,20,this.mapParams.tHistoryBack,null);
        this.updateToolbarButton("history-forward",this.localurl+"right.png",null,20,20,this.mapParams.tHistoryForward,null);
        this.map.getLayer("overview").setAreaWidth(0.25);
        this.map.getLayer("overview").setAreaHeight(0.25);
        this.map.getLayer("overview").setAreaRight(1);
        this.map.getLayer("overview").setAreaBottom(1);
        this.map.getLayer("overview").setAreaLeft(null);
        this.map.getLayer("overview").setLayerOpacity(0.95);
        this.map.getLayer("overview").setAreaBorderWidth(1);
        this.map.getLayer("zoomslider").setAreaRight(null);
        this.map.getLayer("zoomslider").setAreaLeft(7);
        //this.map.getLayer("scale").setAreaRight(null);
        //this.map.getLayer("scale").setAreaLeft(84);
        //this.map.getLayer("scale").setAreaBottom(1);
      }
      if(typeof this.mapParams.language=='undefined')this.mapParams.language="d";

      if(typeof this.mapParams.wheelZoom != 'undefined') {
        this.map.setAllowMouseWheelZoom(this.mapParams.wheelZoom);
      }else{
        this.map.setAllowMouseWheelZoom(true);
      }
      this.cbLeftClickTimeout = null;
      this.setDoubleClickZoom(true);
      //this.map.getLayer('debug').setEnabled(true);
//      this.InfoBoxFactory = com.ptvag.webcomponent.map.vector.InfoBoxElementFactoryRound.getInstance();
      this.InfoBoxFactory = com.ptvag.webcomponent.map.vector.InfoBoxElementFactoryDefault.getInstance();
      /*********************************************************************/
      /* InfoBox Funktion überschreiben -> zusätzlicher Parameter fixBottom*/
      /*********************************************************************/
      qxp.OO.defineClass("com.ptvag.webcomponent.map.vector.InfoBox",com.ptvag.webcomponent.map.vector.VectorElement,function(x,y,text,alignment,priority,id,isPositionFlexible,fixBottom){com.ptvag.webcomponent.map.vector.VectorElement.call(this,priority,id,isPositionFlexible);
      if(typeof fixBottom == 'undefined') {
         fixBottom = true;
      }
      var self=this;
      var map=com.ptvag.webcomponent.map;
      var mInfoBoxElement=null;
      var mInfoBoxElementCreator=null;
      var closeWidgetHandler=function(){var customHandler=self.getCloseWidgetHandler();
      if(customHandler==null){self.getVectorLayer().removeElement(self.getId());
      }else{customHandler(self);
      }};
      var positionBox=function(){if(mInfoBoxElement!=null){mInfoBoxElementCreator.positionInfoBoxElement(mInfoBoxElement,self.getRealX(),self.getRealY());
      }};
      self.usesCanvas=function(){return false;
      };
      self.draw=function(container,topLevelContainer,ctx,mapLeft,mapTop,mapZoom){var suPoint={x:self.getX(),y:self.getY()};
      var pixCoords=map.CoordUtil.smartUnit2Pixel(suPoint,mapZoom);
      var realX=pixCoords.x-mapLeft+self.getFlexX();
      var realY=mapTop-pixCoords.y+self.getFlexY();
      self.setRealX(realX);
      self.setRealY(realY);
      if(mInfoBoxElement==null){mInfoBoxElementCreator=self.getInfoBoxElementFactory();
      if(mInfoBoxElementCreator==null){mInfoBoxElementCreator=com.ptvag.webcomponent.map.vector.InfoBoxElementFactory;
      };mInfoBoxElement=mInfoBoxElementCreator.createInfoBoxElement(realX,realY,{text:self.getText(),background:self.getBackground()},topLevelContainer,true,null,self.getAllowWrap(),fixBottom);
      if(self.getShowCloseWidget()){mInfoBoxElementCreator.activateCloseWidget(mInfoBoxElement,closeWidgetHandler);
      };mInfoBoxElement.style.zIndex=2000000000+self.getPriority();
      }else{positionBox();
      }};
      self.clear=function(){if(mInfoBoxElement!=null){mInfoBoxElementCreator.destroyInfoBoxElement(mInfoBoxElement);
      mInfoBoxElement=null;
      mInfoBoxElementCreator=null;
      }};
      if(x!=null){self.setX(x);
      };if(y!=null){self.setY(y);
      };if(text!=null){self.setText(text);
      };if(alignment!=null){self.setAlignment(alignment);
      };self.refreshOn("x","y","text","alignment","showCloseWidget","infoBoxElementFactory","background");
      });
      qxp.OO.addProperty({name:"x",type:qxp.constant.Type.NUMBER,allowNull:false,defaultValue:4355664});
      qxp.OO.addProperty({name:"y",type:qxp.constant.Type.NUMBER,allowNull:false,defaultValue:5464867});
      qxp.OO.addProperty({name:"realX",type:qxp.constant.Type.NUMBER,allowNull:false});
      qxp.OO.addProperty({name:"realY",type:qxp.constant.Type.NUMBER,allowNull:false});
      qxp.OO.addProperty({name:"text",type:qxp.constant.Type.STRING,allowNull:false,defaultValue:""});
      qxp.OO.addProperty({name:"alignment",type:qxp.constant.Type.NUMBER,allowNull:false,defaultValue:66});
      qxp.OO.addProperty({name:"showCloseWidget",type:qxp.constant.Type.BOOLEAN,allowNull:false,defaultValue:false});
      qxp.OO.addProperty({name:"closeWidgetHandler",type:qxp.constant.Type.FUNCTION,allowNull:true,defaultValue:null});
      qxp.OO.addProperty({name:"infoBoxElementFactory",type:qxp.constant.Type.OBJECT,allowNull:true,defaultValue:null});
      qxp.OO.addProperty({name:"background",type:qxp.constant.Type.STRING,allowNull:false,defaultValue:"#ffffff"});
      qxp.OO.addProperty({name:"allowWrap",type:qxp.constant.Type.BOOLEAN});
      /* CREATE INFO BOX METHODE ÜBERSCHREIBEN, zusätzlicher Parameter */
      var factory = com.ptvag.webcomponent.map.vector.InfoBoxElementFactory;
      var origCreateInfoBoxElement = factory.createInfoBoxElement;
      factory.createInfoBoxElement = function (x, y, content, container, visible, reuseElement, allowWrap, fixBottom) {
      if(typeof fixBottom == 'undefined') {
         fixBottom = true;
      }
    var self = this;
    var paddingLeft = self.getPaddingLeft();
    var paddingRight = self.getPaddingRight();
    var paddingTop = self.getPaddingTop();
    var paddingBottom = self.getPaddingBottom();
    if (content.text == null) {
        content = {text: content, background: "#ffffff"};
    }
    var initialWidth = null;
    var infoBoxElement = reuseElement;
    if (infoBoxElement == null) {
        infoBoxElement = document.createElement("div");
        infoBoxElement.style.position = "absolute";
    } else {
        initialWidth = infoBoxElement.childNodes[0].style.width;
        if (initialWidth != null) {
            initialWidth = parseInt(initialWidth);
        }
    }
    var MapUtil = com.ptvag.webcomponent.map.MapUtil;
    var top = 0;
    var infoBoxHTML = "";
    infoBoxHTML += "<table cellpadding=\"0\" cellspacing=\"0\" border=\"0\"" + " style=\"position:absolute;left:0px;top:" + top + "px" + (initialWidth != null ? ";width:" + initialWidth + "px" : "") + "\">" + "<tr>" + "<td></td>" + "<td align=\"left\" style=\"font-size:1px\">" + "<div style=\"width:11px;height:19px\"></div>" + "</td>" + "<td></td>" + "</tr>" + "<tr>" + "<td style=\"font-size:1px\">" + "<div style=\"width:19px;height:11px\"></div>" + "</td>" + self.createContentBox(content.text, content.background, allowWrap) + "<td style=\"font-size:1px\">" + "<div style=\"width:19px;height:11px\"></div>" + "</td>" + "</tr>" + "<tr>" + "<td></td>" + "<td align=\"left\" style=\"font-size:1px\">" + "<div style=\"width:11px;height:19px\"></div>" + "</td>" + "<td></td>" + "</tr>" + "</table>";
    infoBoxHTML += "<img src=\"" + MapUtil.rewriteURL("img/com/ptvag/webcomponent/map/line2left.gif", true) + "\" height=\"11\" width=\"20\" style=\"left:0px;top:19px;position:absolute;display:none\"/>";
    infoBoxHTML += "<img src=\"" + MapUtil.rewriteURL("img/com/ptvag/webcomponent/map/line2right.gif", true) + "\" height=\"11\" width=\"20\" style=\"right:0px;top:19px;position:absolute;display:none\"/>";
    infoBoxHTML += "<img src=\"" + MapUtil.rewriteURL("img/com/ptvag/webcomponent/map/line2up.gif", true) + "\" height=\"20\" width=\"11\" style=\"" + (initialWidth != null ? ";left:" + Math.round((initialWidth - 11) / 2) + "px" : "") + ";position:absolute;top:0px;display:none\"/>";
    infoBoxHTML += "<img src=\"" + MapUtil.rewriteURL("img/com/ptvag/webcomponent/map/line2.gif", true) + "\" height=\"20\" width=\"11\" style=\"" + (initialWidth != null ? ";left:" + Math.round((initialWidth - 11) / 2) + "px" : "") + ";position:absolute;bottom:0px\"/>";
    infoBoxHTML += "<img src=\"" + MapUtil.rewriteURL("img/com/ptvag/webcomponent/map/closebox.gif", true) + "\" width=\"7\" height=\"7\" style=\"position:absolute;top:19px;right:19px;display:none\"/>";
    infoBoxElement.innerHTML = infoBoxHTML;
    if (!reuseElement) {
        infoBoxElement.style.visibility = "hidden";
        container.appendChild(infoBoxElement);
    }
    var table = infoBoxElement.childNodes[0];
    var width = table.offsetWidth;
    var height = table.offsetHeight;
    mouseHandlerElement = table.getElementsByTagName("tr")[1].childNodes[1];
    mouseHandlerElement._ignoreMouseDown = true;
    mouseHandlerElement._ignoreMouseUp = true;
    mouseHandlerElement._allowSelection = true;
    mouseHandlerElement._ignoreMouseWheel = self.getAllowMouseWheel();
    table.style.width = width + "px";
    infoBoxElement.style.width = width + "px";
    infoBoxElement.style.height = height + "px";
    infoBoxElement._ptv_map_printBackground = true;
    infoBoxElement._ptv_map_printBackgroundHeight = height - 40;
    infoBoxElement._ptv_map_printBackgroundWidth = width - 40;
    infoBoxElement._ptv_map_printBackgroundLeft = 20;
    infoBoxElement._ptv_map_printBackgroundTop = 20;
    var imgElements = infoBoxElement.getElementsByTagName("img");
    var imgElementCount = imgElements.length;
    var imgElement1 = imgElements[imgElementCount - 2];
    imgElement1._ignoreMouseDown = true;
    var imgElement2 = imgElements[imgElementCount - 3];
    imgElement2._ignoreMouseDown = true;
    imgElement2 = imgElements[imgElementCount - 4];
    imgElement2._ignoreMouseDown = true;
    imgElement2 = imgElements[imgElementCount - 5];
    imgElement2._ignoreMouseDown = true;
    var closeboxElement = imgElements[imgElementCount - 1];
    closeboxElement._ignoreMouseDown = true;
    closeboxElement._ignoreMouseUp = true;
    closeboxElement._ignoreMouseWheel = self.getAllowMouseWheel();
    infoBoxElement._width = width;
    infoBoxElement._height = height;
    infoBoxElement._containerWidth = container.offsetWidth;
    infoBoxElement._containerHeight = container.offsetHeight;
    self.positionInfoBoxElement(infoBoxElement, x, y,fixBottom);
    if (visible) {
        infoBoxElement.style.visibility = "visible";
    }
    return infoBoxElement;
     }

    com.ptvag.webcomponent.map.vector.InfoBoxElementFactory.positionInfoBoxElement = function (infoBoxElement, x, y,fixBottom) {
    var self = this;
    var imgElements = infoBoxElement.getElementsByTagName("img");
    var imgElementCount = imgElements.length;
    var leftImgElement = imgElements[imgElementCount - 5];
    var rightImgElement = imgElements[imgElementCount - 4];
    var topImgElement = imgElements[imgElementCount - 3];
    var bottomImgElement = imgElements[imgElementCount - 2];
    var clearLeft = self.getClearLeft();
    var clearRight = self.getClearRight();
    var clearTop = self.getClearTop();
    var clearBottom = self.getClearBottom();
    var freeSpaceTop = y - infoBoxElement._height + 19 - clearTop;
    var freeSpaceBottom = infoBoxElement._containerHeight - clearBottom - (y + infoBoxElement._height - 19);
    var freeSpaceLeft = x - infoBoxElement._width + 19 - clearLeft;
    var freeSpaceRight = infoBoxElement._containerWidth - clearRight - (x + infoBoxElement._width - 19);
    infoBoxElement._borderLeft = 19;
    infoBoxElement._borderRight = 19;
    infoBoxElement._borderTop = 19;
    infoBoxElement._borderBottom = 19;
    if (freeSpaceTop >= 0 ||
        freeSpaceBottom < 0 && freeSpaceLeft < 0 && freeSpaceRight < 0) {
        var tipToShow = bottomImgElement;
        infoBoxElement._borderBottom = 0;
    } else if (freeSpaceBottom >= 0) {
        tipToShow = topImgElement;
        infoBoxElement._borderTop = 0;
    } else if (freeSpaceLeft >= 0) {
        tipToShow = rightImgElement;
        infoBoxElement._borderRight = 0;
    } else {
        tipToShow = leftImgElement;
        infoBoxElement._borderLeft = 0;
    }
    if(fixBottom) {
      tipToShow = topImgElement;
    }
    for (var i = imgElementCount - 5; i <= imgElementCount - 2; ++i) {
        var imgElement = imgElements[i];
        if (imgElement == tipToShow) {
            imgElement.style.display = "";
        } else {
            imgElement.style.display = "none";
        }
    }
    var tipWidth = self.getTipWidth();
    var tipMargin = self.getTipMargin();
    if (tipToShow == bottomImgElement || tipToShow == topImgElement) {
        var left = x - infoBoxElement._width / 2;
        var width = infoBoxElement._width;
        var containerWidth = infoBoxElement._containerWidth - clearRight;
        if (left + width - 19 > containerWidth) {
            left = containerWidth - width + 19;
        }
        if (left < -19 + clearLeft) {
            left = -19 + clearLeft;
        }
        var imgMargin = x - left - tipWidth / 2;
        if (imgMargin - 19 < tipMargin) {
            left += imgMargin - tipMargin - 19;
            imgMargin = tipMargin + 19;
        } else if (imgMargin > width - 19 - tipWidth - tipMargin) {
            left += imgMargin - (width - 19 - tipWidth - tipMargin);
            imgMargin = width - 19 - tipWidth - tipMargin;
        }
        var top = y - infoBoxElement._height;
        if (tipToShow == topImgElement) {
            top = y;
            topImgElement.style.left = Math.round(imgMargin) + "px";
        } else {
            bottomImgElement.style.left = Math.round(imgMargin) + "px";
        }
        infoBoxElement.style.left = Math.round(left) + "px";
        infoBoxElement.style.top = Math.round(top) + "px";
    } else {
        var top = y - infoBoxElement._height / 2;
        var height = infoBoxElement._height;
        var containerHeight = infoBoxElement._containerHeight - clearBottom;
        if (top + height - 19 > containerHeight) {
            top = containerHeight - height + 19;
        }
        if (top < -19 + clearTop) {
            top = -19 + clearTop;
        }
        var imgMargin = y - top - tipWidth / 2;
        if (imgMargin - 19 < tipMargin) {
            top += imgMargin - tipMargin - 19;
            imgMargin = tipMargin + 19;
        } else if (imgMargin > height - 19 - tipWidth - tipMargin) {
            top += imgMargin - (height - 19 - tipWidth - tipMargin);
            imgMargin = height - 19 - tipWidth - tipMargin;
        }
        var left = x - infoBoxElement._width;
        if (tipToShow == leftImgElement) {
            left = x;
            leftImgElement.style.top = Math.round(imgMargin) + "px";
        } else {
            rightImgElement.style.top = Math.round(imgMargin) + "px";
        }
        infoBoxElement.style.top = Math.round(top) + "px";
        infoBoxElement.style.left = Math.round(left) + "px";
    }
}

      this.InfoBoxFactory.setAllowWrap(true);
      var factory = com.ptvag.webcomponent.map.vector.InfoBoxElementFactory;
      com.ptvag.webcomponent.map.vector.InfoBoxElementFactory = this.InfoBoxFactory;

      this.addTileLayers(this.mapParams.layers);
      this.additionalMapInitialisations();
      this.map.addEventListener("changeZoom", this.cbChangeZoom.bind(this));
      this.map.addEventListener("changeCenter", this.cbChangeCenter.bind(this));
      this.vectorlayer=this.map.getLayer('vector');
      // OnMouseMove sichern
      this.normalMouseMove = this.vectorlayer.onMouseMove;
      // Drawmode
      this.drawMouseMove = function(evt){
       var scr = {x:evt.relMouseX,y:evt.relMouseY};
       var tmpCoord = this.scr2geo(scr);
       if(typeof this.mapParams.onMouseMove == 'function') {
         this.mapParams.onMouseMove(evt,tmpCoord);
       }
     }.bind(this);
      //this.vectorlayer.onMouseMove = this.drawMouseMove;

      this.leftclickarea=new com.ptvag.webcomponent.map.vector.ClickArea(null,null, null, 0,
        this.cbLeftClick.bind(this));
      this.rightclickarea=new com.ptvag.webcomponent.map.vector.RightClickArea(null,null, null, 0,
        this.cbRightClick.bind(this));
      this.vectorlayer.addElement(this.leftclickarea);
      this.vectorlayer.addElement(this.rightclickarea);

      if(typeof this.mapParams.onshow!='undefined')
        this.mapParams.onshow();

    },
    setDrawMode: function(bool){
       if(bool) {
         this.vectorlayer.onMouseMove = this.drawMouseMove;
       }else{
         this.vectorlayer.onMouseMove = this.normalMouseMove;
       }
    },
    formatter:function(descr){
        return descr.split(":")[0];
    },
    addRemoveCustomXML:function(){
        //alert(qxp.core.ServerSettings.serverPathPrefix + "/example_lu.xml" + qxp.core.ServerSettings.serverPathSuffix);
        //this.map.getServerDrawnObjectManager().addPOICategory("xml", qxp.core.ServerSettings.serverPathPrefix + "/example_lu.xml" + qxp.core.ServerSettings.serverPathSuffix);
        //this.map.getServerDrawnObjectManager().addPOICategory("xml","http://kronos.local.hacon.de/bin/rmv-3.0.1/query.exe/dnl?L=vs_ptv&performLocating=2&tpl=stop2json&look_maxno=150&look_nv=get_stopweight|yes&look_maxdist=2088642&look_stopclass=2&&look_maxx=9796006&look_maxy=50606421&look_minx=7433945&look_miny=49366809");
        this.map.getServerDrawnObjectManager().addPOICategory("xml", gBaseUrl + gUrlTravelPlannerJSON  + "l?L=vs_ptv&performLocating=2&tpl=stop2json&look_maxno=150&look_maxdist=2088642&look_stopclass=2&&look_maxx=9796006&look_maxy=50606421&look_minx=7433945&look_miny=49366809&");
        var self = this;
        window.setTimeout(function(){
                self.map.getServerDrawnObjectManager().removePOICategory("xml", "Stops");
        },3000);
        //self.map.getServerDrawnObjectManager().addPOICategory("xml", gBaseUrl + gUrlTravelPlannerJSON  + "l?L=vs_ptv&performLocating=2&tpl=stop2json&look_maxno=150&look_maxdist=2088642&look_stopclass=512&&look_maxx=9796006&look_maxy=50606421&look_minx=7433945&look_miny=49366809&");
        //this.map.getServerDrawnObjectManager().addPOICategory("xml", "http://kronos.local.hacon.de/bin/rmv-3.0.1/query.exe/dnl?L=vs_ptv&performLocating=2&tpl=stop2json"); //&look_maxno=150&look_nv=get_stopweight|yes&look_maxdist=2088642&look_stopclass=2&&look_maxx=9796006&look_maxy=50606421&look_minx=7433945&look_miny=49366809");
        //this.map.getServerDrawnObjectManager().addPOICategory("xml", "http://demo.hafas.de/ptvxml/example_poi.xml");
        //    map.getServerDrawnObjectManager().addPOICategory("xml", qxp.core.ServerSettings.serverPathPrefix + "/example_lu.xml" + qxp.core.ServerSettings.serverPathSuffix);
        //    customXMLActive = true;
        this.map.getServerDrawnObjectManager().setStaticPOIFormatter(this.formatter);
        this.map.getServerDrawnObjectManager().addEventListener(com.ptvag.webcomponent.map.ServerDrawnObjectManager.STATIC_POI_CLICKED,this.staticPOICallback);
    },
    staticPOICallback:function(evt) {
        var poi = evt.getData();

        //  var pois = evt.getData();
        //  var alertString = pois.length + " POIs available";
        //  if (pois.length > 0) {
        //      alertString += "; first POI: " + pois[0].x +
        //                     "/" + pois[0].y + "/" + pois[0].description;
        //  }
        //  alert(alertString);
    },
    addTileLayers:function(layerdescriptions){
      if(typeof layerdescriptions!='undefined' && layerdescriptions!=null){
        this.toolbar.addElement({width:6,id:"spacing_after_ptv"},null);
        for(var l=0;l<layerdescriptions.length;l++){
          if(typeof layerdescriptions[l].viewtyp=='undefined') layerdescriptions[l].viewtyp='static';
          if(layerdescriptions[l].viewtyp=='static')
            this.addTileLayer(layerdescriptions[l],l);
          else
            this.addTileLayerButton(layerdescriptions[l],l);
        }
      }
    },
    addTileLayerButton:function(desc,l){
      if(typeof desc.imgfile=='undefined')desc.imgfile="layer.png";
      if(typeof desc.img1file=='undefined')desc.img1file="layer1.png";
      if(typeof desc.imgwidth=='undefined')desc.imgwidth=20;
      if(typeof desc.imgheight=='undefined')desc.imgheight=20;
      this.newToolbarButton(this.localurl+desc.imgfile,null,desc.imgwidth,desc.imgheight,desc.name,function(){
        if(typeof this.map.getLayer(desc.id)=='undefined'){
          this.updateToolbarButton(desc.id,this.localurl+desc.img1file,"spacing_after_"+desc.id,desc.imgwidth,desc.imgheight,null,null);
          this.addTileLayer(desc,l);
        }
        else{
          this.updateToolbarButton(desc.id,this.localurl+desc.imgfile,"spacing_after_"+desc.id,desc.imgwidth,desc.imgheight,null,null);
          this.removeTileLayer(desc.id);
        }
        return false;
      }.bind(this),true,desc.id);
    },
    removeTileLayer:function(name){
      if(typeof this.map.getLayer(name)=='undefined' || this.map.getLayer(name)==null) return;
      this.map.removeLayer(name);
    },
     toggleTMC:function(){
      if(!this.tmclayer){
        this.sdo_manager = this.map.getServerDrawnObjectManager();
        this.sdo_manager.setStaticPOIDelimiter("#");
        this.sdo_manager.setStaticPOIFormatter(function(text){
            return "<div class='tooltipTmcMsg'>"+text.replace(/(\d+)#/,"")+"</div>";
        });
        if( this.sdo_manager ) {
           this.sdo_manager.addPOICategory("xpoidb","traffic.ptv-traffic");
           this.tmclayer = true;
        }
      }else{
         this.sdo_manager.removePOICategory("xpoidb","traffic.ptv-traffic");
         this.tmclayer = false;
      }

    },
    addTileLayer:function(desc,l){
      if(typeof desc.url=='undefined') return;
      if(typeof desc.urlsubpath=='undefined')desc.urlsubpath='';
      if(typeof desc.tiletyp=='undefined') desc.tiletyp='static';
      if(typeof desc.opacity=='undefined') desc.opacity=1.0;
      if(typeof desc.id=='undefined') desc.id='MyTileLayer'+l.toString();
      if(typeof desc.name=='undefined') desc.name=desc.id;
      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 diff = Math.abs(left - right);
        if(com.ptvag.webcomponent.map.CoordUtil.ZOOM_LEVEL_FACTOR == 2) // Google Zoom Stufen
		{
			var z = 25 - Math.round(Math.log(diff) / Math.log(2));
			var y = Math.round(Math.pow(2, z) - (20015085 + Math.round(bottom)) / diff)-1;
		}
        else
		{
			var z = 33 - Math.round(Math.log(diff) / Math.log(Math.pow(4, (1 / 3))));
			var y = Math.round((20015085 + Math.round(bottom)) / diff);
		}
        var x = Math.round((20015087 + Math.round(left)) / diff);
        if(desc.tiletyp=='static')
          r.url=desc.url+gStaticTileDirPTV+desc.urlsubpath+z+"/"+x+"/"+y+".png";
        else
          r.url=desc.url+gDynamicTileParameterPTV+"z="+z+"&x="+x+"&y="+y;
        return r;
        };
      var MyTiles=new com.ptvag.webcomponent.map.layer.TileMapLayer(MyRequestBuilder);
      MyTiles.setLayerOpacity(desc.opacity);
      if(typeof MyTiles.setRemoveUnusedElements!='undefined') {
        MyTiles.setRemoveUnusedElements(true);
      }
      MyTiles.setIsRelative(true);
      MyTiles.setNeedsOpacityHack(true);
      this.map.addLayer(MyTiles,desc.id,0,this.map.getLayer("label"));
      window.setTimeout(function(){MyTiles.setLayerOpacity(desc.opacity);},200);
      //this.map.getLayer(desc.name).setLayerOpacity(desc.opacity);
    },
    addContentLayer:function(name){
      if(typeof this.map.getLayer(name)!='undefined' && this.map.getLayer(name)!=null) return;
      l=new com.ptvag.webcomponent.map.layer.VectorLayer(this.map.getLayer("floater"));
      this.map.addLayer(l, name, 0, this.map.getLayer("overview") );
    },
    addCustomImageMap:function(url,name){
       this.addTileLayer({url:url+"&",tiletyp:'dyn', opacity:1.0,id:name});
       this.map.getLayer('background').setEnabled(false);
       this.map.getLayer('label').setEnabled(false);
    },
    removeCustomImageMap:function(url,name){
       this.removeTileLayer(name);
       this.map.getLayer('background').setEnabled(true);
       this.map.getLayer('label').setEnabled(true);
    },
    removeLayer:function(name){
      if(typeof this.map.getLayer(name)=='undefined' || this.map.getLayer(name)==null) return;
      this.map.getLayer(name).removeAllElements ();
      this.map.removeLayer(name);
    },
    geo2scr:function(g){
      var su = this.CCoord2SmartUnit(g);
      var zoom = this.map.getZoom();
      var pix = com.ptvag.webcomponent.map.CoordUtil.smartUnit2Pixel( su, zoom );
      var ctrpix = this.map.getCenterInPixel();
      pix.x = (this.map.getWidth()/2) + pix.x - ctrpix.x;
      pix.y = (this.map.getHeight()/2) + ctrpix.y - pix.y;
      return pix;
    }
    ,scr2geo:function(scr){
       var ctrpix = this.map.getCenterInPixel();
       var newscrx = ctrpix.x - (this.map.getWidth()/2) + scr.x;
       var newscry = (this.map.getHeight()/2) - scr.y + ctrpix.y;
       var newscr = {x: newscrx, y: newscry};
       var zoom = this.map.getZoom();
       var su = com.ptvag.webcomponent.map.CoordUtil.pixel2SmartUnit(newscr, zoom);
       var coord = this.SmartUnit2CCoord(su);
       return coord;
    },
    updateSize:function(){
        if((typeof this.map != 'undefined') && this.map != null)
           this.map.updateSize();
    },
    setOnChange: function(listener){
      if(typeof this.mapParams.onchange=='undefined')
        this.mapParams.onchange=new Array;
      this.mapParams.onchange[this.mapParams.onchange.length]=listener;
    },
    setOnZoom: function(listener){
      if(typeof this.mapParams.onzoom=='undefined')
        this.mapParams.onzoom=new Array;
      this.mapParams.onzoom[this.mapParams.onzoom.length]=listener;
    },
    cbonViewChange: function(){
      this.activeTimeoutChange=null;
      if(typeof this.mapParams.onchange!='undefined'){
        for(var i=0;i<this.mapParams.onchange.length;i++){
          this.mapParams.onchange[i]();
        }
      }
    },
    cbonZoom: function(){
      this.activeTimeoutZoom=null;
      if(typeof this.mapParams.onzoom!='undefined'){
        for(var i=0;i<this.mapParams.onzoom.length;i++){
          this.mapParams.onzoom[i]();
        }
      }
    },
    cbChangeZoom: function(){
      window.clearTimeout(this.activeTimeoutChange);
      this.activeTimeoutChange=window.setTimeout("g"+this.classtype+"Instances["+this.instance+"].cbonViewChange()",500);
      window.clearTimeout(this.activeTimeoutZoom);
      this.activeTimeoutZoom=window.setTimeout("g"+this.classtype+"Instances["+this.instance+"].cbonZoom()",200);
    },
    cbChangeCenter: function(){
      window.clearTimeout(this.activeTimeoutChange);
      this.activeTimeoutChange=window.setTimeout("g"+this.classtype+"Instances["+this.instance+"].cbonViewChange()",500);
    },
    setBoundingBox: function( gbb ){
      var lu = this.CCoord2SmartUnit(gbb.sw);
      var ro = this.CCoord2SmartUnit(gbb.ne);
      this.map.setRect( lu.x, ro.y, ro.x, lu.y );
    },
    getBoundingBox: function(){
      var bb = this.map.getRect();
      return {
        sw:this.SmartUnit2CCoord({x:bb.left,y:bb.bottom}),
        ne:this.SmartUnit2CCoord({x:bb.right,y:bb.top})
      }
    },
    isPointInBoundingBox: function(point){
       var currentBB = this.getBoundingBox();
       if((point.getLon() > currentBB.sw.getLon()) && (point.getLon() < currentBB.ne.getLon()) && (point.getLat() > currentBB.sw.getLat()) && (point.getLat() < currentBB.ne.getLat())) {
          return true;
       }else{
          return false;
       }
    },
    showInfoboxGeo:function(geo,titletext,content){
      this.showInfoboxSU(this.CCoord2SmartUnit(geo),titletext,content);
    },
    showInfoboxSU:function(su,titletext,content, titelid, contentid){
      this.hideAllInfoBoxes();
      if(typeof titelid=='undefined')titelid='PTVInfoBoxTitle';
      var title    = titletext.replace(/\ /g,'&nbsp;');
      var titlebut = "<img id='PTVInfoboxClosebuttonImage_"+this.instance+"' src='" +
                     this.localurl+"closebutton.png' width='14' height='14' "+
                     "onclick='g"+this.classtype+"Instances["+this.instance+"].hideAllInfoBoxes();return false'/>";
      var extcontent = "<div class='ptvinfoboxcontent'>"+content+"</div>";
      var allcontent = "<div id='infoBoxContentId' style='display:none;'>"+contentid+"</div><table class='ptvinfobox' cellspacing='0' width='100%'><tr>"+
                       "<td id='"+titelid+"' class='ptvinfoboxtitle' width='100%'>"+title+"</td>"+
                       "<td class='ptvinfoboxtitle' style='width:16px'>"+titlebut+"</td></tr>"+
                       "<tr><td colspan='2'>"+extcontent+"</td></tr></table>";
      this.currentInfoBox=new com.ptvag.webcomponent.map.vector.InfoBox(
                        su.x, su.y,allcontent, 34, 1, "Infobox", false,false);
      this.vectorlayer.addElement(this.currentInfoBox);
      this.map.getLayer("floater").setSwallowHoverEvents(true);
    },
    replaceCurrentInfoboxTitle: function(TitelContainerId,newTitle){
      var c=document.getElementById(TitelContainerId);
       if(typeof c!='undefined' && c!= null){
         c.innerHTML = newTitle.replace(/\ /g,'&nbsp;');
         // Leider wird die Infobox nicht neu platziert. 1. gescheiterter Versuch :
//        alert("x:"+this.currentInfoBox.getX()+",y:"+this.currentInfoBox.getY());
//        this.InfoBoxFactory.positionInfoBoxElement(this.currentInfoBox,this.currentInfoBox.getX(),this.currentInfoBox.getY());
//        this.InfoBoxFactory.positionInfoBoxElement(this.vectorlayer.getElement("Infobox"),this.currentInfoBox.getX(),this.currentInfoBox.getY());
      }
    },
    cbLeftClick: function(p){
      if(p.detail > 1) {
         if(this.cbLeftClickTimeout != null) {
           window.clearTimeout(this.cbLeftClickTimeout);
         }
      }else{
          this.cbLeftClickTimeout = window.setTimeout(function(){
          var geo=this.SmartUnit2CCoord({x:p.clickX,y:p.clickY});
          if(typeof this.mapParams.leftinfoclicktitle!='undefined' && this.drawmode == false){
            var titelid="PTVInfoboxTitelContainer_"+geo.getLon()+"_"+geo.getLat();
            this.showInfoboxSU({x:p.clickX,y:p.clickY},
                                this.mapParams.leftinfoclicktitle,
                                this.mapParams.leftinfoclickcontent({map:this,x:geo.getLon(),y:geo.getLat(),titleid:titelid}),
                                titelid );
          }
          if(typeof this.mapParams.onleftclick!='undefined' && this.drawmode == false){
            this.mapParams.onleftclick(geo);
          }
          if(this.drawmode == true) {
            this.drawmodefunc({x:geo.getLon(),y:geo.getLat()});
          }
         }.bind(this),200);
      }
    },
    cbRightClick: function(p){
      var geo=this.SmartUnit2CCoord({x:p.clickX,y:p.clickY});
      if(typeof this.mapParams.rightinfoclicktitle!='undefined'){
        var titelid="PTVInfoboxTitelContainer_"+geo.getLon()+"_"+geo.getLat();
        this.showInfoboxSU({x:p.clickX,y:p.clickY},
                            this.mapParams.rightinfoclicktitle,
                            this.mapParams.rightinfoclickcontent({map:this,x:geo.getLon(),y:geo.getLat(),titleid:titelid}),
                            titelid );
      }
    },
    // @mgab drawMode
    enableDrawMode:function(func){
       this.drawmode = true;
       this.drawmodefunc = func;
    },
    disableDrawMode:function(){
       this.drawmode = false;
    },
    isCoordVisible:function(c){
      var bb = this.map.getRect();
      var s = this.CCoord2SmartUnit(c);
      return s.x>=bb.left&&s.x<=bb.right&&s.y>=bb.bottom&&s.y<=bb.top;
    },
    getCenter: function(){
      return this.SmartUnit2CCoord(this.map.getCenter());
    },
    centerToGeo:function(g){
      this.map.setCenter(this.CCoord2SmartUnit(g));
    },
    setZoom:function(zoom){
		this.map.setZoom(this.AjaxMap2PTVZoom( zoom ));
    },
    createContent:function(params){
      if(typeof params.type=='undefined')return null;
      this.contcount++;
      var cc=this.contcount.toString();
      var p=this.clone_contentparams(params)
      p.cc=cc;
      p.show = false;
      this.content.set(cc,p);
      if(typeof p.layername=='undefined')
        p.layername='vector';
      p.vectorlayer = this.map.getLayer(p.layername);
      if(typeof p.vectorlayer == 'undefined' || p.vectorlayer==null)
        p.vectorlayer = this.map.getLayer('vector');
      switch(p.type){
      case 'location':this.createLocation(p);break;
      case 'route':
      case 'point':this.createPoint(p);break;
      case 'polyline':this.createPolyline(p);break;
      case 'polygon':this.createPolygon(p);break;
      case 'circle':this.createCircle(p);break;
      case 'container':this.createContainer(p);break;
      default:return null;
      }
      return cc;
    },updateContent:function(content, paramsPrev, paramsNext){
      if(typeof content=='undefined')return;
      if(content==null)return;
      var p=this.content.get(content);
      if(typeof p=='undefined')return;
      var contentNext = this.createContent(paramsNext);
      if(contentNext==null)return;
      var pNext = this.content.get(contentNext);
      if(typeof pNext=='undefined')return;
      switch(p.type){
       case 'location':this.updateImage(p,pNext);break;
       case 'polyline': this.updatePolyline(p,pNext);break;
       case 'container': this.updateContainer(p,pNext);break;
      }
      this.removeContent(contentNext);
    },
    showContent:function(content){
      if(typeof content=='undefined')return;
      if(content==null)return;
      var p=this.content.get(content);
      if(typeof p=='undefined')return;
      switch(p.type){
      case 'location':this.showLocation(p);break;
      case 'route':
      case 'point':this.showPoint(p);break;
      case 'polyline':this.showPolyline(p);break;
      case 'polygon':this.showPolygon(p);break;
      case 'circle':this.showCircle(p);break;
      case 'container':this.showContainer(p);break;
      }
      p.show = true;
    },
    hideContent:function(content){
      if(typeof content=='undefined')return;
      if(content==null)return;
      var p=this.content.get(content);
      if(typeof p=='undefined')return;
      p.show = false;
      switch(p.type){
      case 'location':this.hideLocation(p);break;
      case 'point':
      case 'circle':
        this.hideContent(p._poly);
        break;
      case 'route':
      case 'polyline':
      case 'polygon':
      case 'container':
        if(typeof this.vectorlayer.removeElement!='undefined'){
           p.vectorlayer.removeElement(p.cc);
           if(typeof p.lineTooltip != 'undefined') {
              p.vectorlayer.removeElement(p.cc + 'polylinetooltip');
           }
           if(typeof p.clickArea != 'undefined') {
              p.vectorlayer.removeElement(p.cc + 'polylineclickarea');
           }
        }else{
           p.vectorlayer.hideElement(p.cc);
           if(typeof p.lineTooltip != 'undefined') {
              p.vectorlayer.hideElement(p.cc + 'polylinetooltip');
           }
           if(typeof p.clickArea != 'undefined') {
              p.vectorlayer.hideElement(p.cc + 'polylineclickarea');
           }

        }
        delete p.content;
        break;
      }
    },
    removeContent:function(content){
      if(typeof content=='undefined')return;
      if(content==null)return;
      var p=this.content.get(content);
      if(typeof p=='undefined')return;
      switch(p.type){
      case 'location':
      case 'route':
      case 'polyline':
      case 'polygon':
      case 'container':
        break;
      case 'circle':
      case 'point':
        this.removeContent(p._poly);
        break;
      }
      this.content.unset(content);
      delete this.content[content];
    },
    centerToContent: function(content){
      if(typeof content=='undefined')return;
      if(content==null)return;
      var par=this.content.get(content);
      switch(par.type){
      case "circle":
      case "point":
        this.map.setCenter(this.CCoord2SmartUnit(par.coord));
        this.map.setZoom(this.AjaxMap2PTVZoom(this.mincenterzoom));
      case "location":
        this.map.setCenter(this.CCoord2SmartUnit(par.coord));
        this.map.setZoom(this.AjaxMap2PTVZoom(this.mincenterzoom));
        break;
      case "polyline":
      case "polygon":
      case "route":
        if(typeof par.su != 'undefined')
          this.map.setViewToPoints(par.su, false, false);
        break;
      }
    },
    openContentInfobox: function(content){
      if(typeof content=='undefined')return;
      if(content==null)return;
      var par=this.content.get(content);
      if(typeof par.onshowinfobox!='undefined')
        this.showInfoboxSU(par.su,par.infotitle,par.infocontent);
    },

    // Hilfsmethoden
    createIconHTML:function(par){
      par.shad = false;
      if( typeof par.shadowheight!='undefined' &&
          typeof par.shadowwidth!='undefined' &&
          typeof par.shadowurl!='undefined' ){
          par.shad = true;
        if(typeof par.shadowhotspot == 'undefined') {
          par.shadowhotspot = new Object;
          par.shadowhotspot.x = 0;
          par.shadowhotspot.y = 0;
        }
      }
      var w = par.shad?Math.max( par.shadowwidth,par.imagewidth ):par.imagewidth;
      var h = par.shad?Math.max( par.shadowheight,par.imageheight ):par.imageheight;
      par.html = "<div style='width:auto;'><div id='ptvlocation"+par.cc+"maindiv' style='position:absolute;" +
          "width:" + w + "px;" +
          "height:" + h + "px;" +
          "left:" + (-par.hotspot.x).toString() + "px;" +
          "top:" + (-par.hotspot.y).toString() + "px;" +
          "'>";
      if(par.shad){

        par.html+= "<img id='ptvlocation"+par.cc+"shadowimg' style='left:" + (-par.shadowhotspot.x) + "px;top:"+ (-par.shadowhotspot.y) +"px;position:absolute;" +
          "' " +
          "src='" + par.shadowurl + "' " +
          "width='" + par.shadowwidth + "' " +
          "height='" + par.shadowheight + "' />";
      }
      par.html+="<img id='ptvlocation"+par.cc+"iconimg' style='border:1px;position:absolute;" +
          "' " +
          "src='" + par.imageurl + "' " +
          "width='" + par.imagewidth + "' " +
          "height='" + par.imageheight + "' />"+
          "</div>";

      //      this.setOnZoom(this.resizeLocation.bind(this,par));
    },
    resizeLocation: function(par){
      var maindiv=$('ptvlocation'+par.cc+'maindiv');
      if(typeof maindiv=='undefined'||maindiv)return;
      var w = shad?Math.max( par.shadowwidth,par.imagewidth ):par.imagewidth;
      var h = shad?Math.max( par.shadowheight,par.imageheight ):par.imageheight;
      maindiv.style.width="10px";
      maindiv.style.height="10px";
      var iconimg=$('ptvlocation'+par.cc+'iconimg');
      if(typeof iconimg=='undefined'||iconimg)return;
      iconimg.width="10";
      iconimg.height="10";
      var shadowimg=$('ptvlocation'+par.cc+'shadowimg');
      if(typeof shadowimg!='undefined'&&shadowimg){
        shadowimg.width="10";
        shadowimg.height="10";
      }
    },
    createLocation: function( par ){
      this.createIconHTML(par);
      if(typeof par.flexible=='undefined')par.flexible=false;
      par.su=this.CCoord2SmartUnit(par.coord);
      par.su.x+=0.0001*parseInt(par.cc)%100-0.005;
    },
    changeTooltip: function(content,param){
      var par=this.content.get(content);
      par.text=param.text;
      if(typeof par.tooltip!='undefined'){
        var t=this.vectorlayer.getElement(par.cc+"_tooltip");
        t.setText(par.text.replace(/\ /g,'&nbsp;'));
      }
    },
    changeInfo: function(content,param){
      var par=this.content.get(content);
      par.infotitle=param.infotitle;
      par.infocontent=param.infocontent;
      par.onshowinfobox=function(){
        this.showInfoboxSU(par.su,par.infotitle,par.infocontent);
      };
      var t=this.vectorlayer.getElement(par.cc+"_clickarea");
      t.setHandler(par.onshowinfobox.bind(this));
    },
    changeIcon: function(content,param){
      if(typeof com.ptvag.webcomponent.map.vector.HTML!='undefined'){
        var par=this.content.get(content);
        this.vectorlayer.removeElement(par.cc);
        par.shadowheight= param.shadowheight;
        par.shadowwidth = param.shadowwidth;
        par.shadowurl   = param.shadowurl;
        par.imageheight = param.imageheight;
        par.imagewidth  = param.imagewidth;
        par.imageurl    = param.imageurl;
        this.createIconHTML(par);
        par.content=new com.ptvag.webcomponent.map.vector.HTML(
          par.su.x, par.su.y, 17, par.html, null, par.cc, par.flexible);
      }
    },
    changeHTML: function(par,image){
       var w = par.imagewidth;
       var h = par.imageheight;
       par.html = "<div style='position:absolute;width:" + w + "px;height:" + h + "px;left:" + (-par.hotspot.x).toString() + "px;top:" + (-par.hotspot.y).toString() + "px;'>";
       par.html +="<img style='position:absolute;" + "' src='" + image + "' width='" + par.imagewidth + "' height='" + par.imageheight + "'/></div>";
       return par.html;
    },
    updateImage: function(par, parNext){
      var updateX = null;
      var updateY = null;
      var updateHTML = null;
      var updateAlign = null;

      if (par.su.x != parNext.su.x)
      {
         updateX  = parNext.su.x;
         par.su.x = parNext.su.x;
      }
      if (par.su.y != parNext.su.y)
      {
        updateY  = parNext.su.y;
        par.su.y = parNext.su.y;
      }
      if (par.html != parNext.html)
      {
         updateHTML = parNext.html;
         par.html   = parNext.html;
      }
      if(typeof par.clickArea != 'undefined'){
        par.clickArea.setX(parNext.su.x);
        par.clickArea.setY(parNext.su.y);
      }

      if(typeof par.tooltip != 'undefined') {
        par.tooltip.setX(parNext.su.x);
        par.tooltip.setY(parNext.su.y);
      }
      if ((updateX == null) && (updateY == null) && (updateHTML==null))
         return;
      par.content.updateProperties(updateX, updateY, null, updateHTML);
    },hideImage: function(p){
      if(typeof this.vectorlayer.removeElement!='undefined')
        p.vectorlayer.removeElement(p.cc);
      else
        p.vectorlayer.hideElement(p.cc);
      delete p.content;
    },
/*    createLocation: function( par ){
      var shad = false;
      if( typeof par.shadowheight!='undefined' &&
          typeof par.shadowwidth!='undefined' &&
          typeof par.shadowurl!='undefined' )
        shad = true;
      var w = shad?Math.max( par.shadowwidth,par.imagewidth ):par.imagewidth;
      var h = shad?Math.max( par.shadowheight,par.imageheight ):par.imageheight;
      par.html = "<div style='position:absolute;" +
          "width:" + w + "px;" +
          "height:" + h + "px;" +
          "left:" + (-par.hotspot.x).toString() + "px;" +
          "top:" + (-par.hotspot.y).toString() + "px;" +
          "'>";
      if(shad)
        par.html+= "<img style='position:absolute;" +
          "' " +
          "src='" + par.shadowurl + "' " +
          "width='" + par.shadowwidth + "' " +
          "height='" + par.shadowheight + "' />";
      par.html+="<img style='position:absolute;" +
          "' " +
          "src='" + par.imageurl + "' " +
          "width='" + par.imagewidth + "' " +
          "height='" + par.imageheight + "' " +
          "</div>";
      if(typeof par.flexible=='undefined')par.flexible=false;
      par.su=this.CCoord2SmartUnit(par.coord);
      par.su.x+=0.0001*parseInt(par.cc)%100-0.005;
    },          */
    moveLocation: function(locOld,locNew){
       var content = this.content.get(locOld);
       var newsu = this.CCoord2SmartUnit(locNew);
       if(typeof content != 'undefined') {
         this.updateImage(content,{
            su:newsu,
            html:content.html
         });
       }
    },
    showLocation: function( par ){
      // Marker
      if(typeof com.ptvag.webcomponent.map.vector.HTML!='undefined'){
        par.content=new com.ptvag.webcomponent.map.vector.HTML(
            par.su.x, par.su.y, 17, par.html, null, par.cc, par.flexible);
      }else{
        par.content=new com.ptvag.webcomponent.map.vector.ImageMarker(
            par.su.x, par.su.y, par.imageurl,34, null, par.cc, par.flexible);
      }
      par.vectorlayer.addElement(par.content);

      // HoverArea for draggable items
      par.hoverArea = new com.ptvag.webcomponent.map.vector.HoverArea(par.su.x,par.su.y,null,5,par.hover,par.unhover,0,par.cc+"_hoverArea", par.flexible);
      par.vectorlayer.addElement(par.hoverArea);

      // Tooltip (on hover)
      if ( typeof par.htmlText!='undefined') {
        par.tooltip=new com.ptvag.webcomponent.map.vector.Tooltip(
          par.su.x, par.su.y, 17, Math.max(par.imagewidth,par.imageheight),
          par.htmlText, 34, 2, par.cc+"_tooltip", par.flexible);
        par.vectorlayer.addElement(par.tooltip);
      }
      else if ( typeof par.text!='undefined') {
        par.tooltip=new com.ptvag.webcomponent.map.vector.Tooltip(
          par.su.x, par.su.y, 17, Math.max(par.imagewidth,par.imageheight),
          "<div style='white-space:nowrap;'>"+par.text+"</div>", 34, 2, par.cc+"_tooltip", par.flexible);
        par.vectorlayer.addElement(par.tooltip);
      }
      if ( typeof par.onclick!='undefined') {
        par.clickArea=new com.ptvag.webcomponent.map.vector.ClickArea(
            par.su.x, par.su.y, null, Math.max(par.imagewidth,par.imageheight), function(){par.onclick(par)}, 0, par.cc+"_clickArea", par.flexible);
        par.vectorlayer.addElement(par.clickArea);
      }
      // Infobox (on left click)
      if( typeof par.infotitle!='undefined'&&typeof par.infocontent!='undefined') {
        par.onshowinfobox=function(){
          this.showInfoboxSU(par.su,par.infotitle,par.infocontent,null,par.cc);
          par.tooltip.clear();
        };
        par.clickarea=new com.ptvag.webcomponent.map.vector.ClickArea(
          par.su.x, par.su.y, null, Math.max(par.imagewidth,par.imageheight),
          par.onshowinfobox.bind(this), 0, par.cc+"_clickarea", par.flexible);
        par.vectorlayer.addElement(par.clickarea,true);
      }
      else if ( typeof par.info!='undefined') {
        par.onshowinfobox=function(){
          this.hideAllInfoBoxes();
          var infotop = "<div style='float:right;text-align:right'>" +
                        "<img id='PTVInfoboxClosebuttonImage_"+this.instance+"' src='" +
                        this.localurl+"closebutton.png' width='16' height='16' "+
                        "onclick='g"+this.classtype+"Instances["+this.instance+"].hideAllInfoBoxes();return false'/></div>";
          this.currentInfoBox=new com.ptvag.webcomponent.map.vector.InfoBox(
            par.su.x, par.su.y, infotop+par.info, 34, 1, "Infobox", false);
          par.vectorlayer.addElement(this.currentInfoBox);
        };
        par.clickarea=new com.ptvag.webcomponent.map.vector.ClickArea(
          par.su.x, par.su.y, null, Math.max(par.imagewidth,par.imageheight),
          par.onshowinfobox.bind(this), 0, par.cc+"_clickarea", par.flexible);
        par.vectorlayer.addElement(par.clickarea);
      }
    },
    hideLocation: function(p){
      this.hideAllInfoBoxes();
      if(typeof this.vectorlayer.removeElement!='undefined')
      {
        p.vectorlayer.removeElement(p.cc);
        p.vectorlayer.removeElement(p.cc+"_tooltip");
        p.vectorlayer.removeElement(p.cc+"_clickarea");
        p.vectorlayer.removeElement(p.cc+"_clickArea");
        p.vectorlayer.removeElement(p.cc+"_hoverArea");
      }
      else
      {
        p.vectorlayer.hideElement(p.cc);
        p.vectorlayer.hideElement(p.cc+"_tooltip");
        p.vectorlayer.hideElement(p.cc+"_clickarea");
        p.vectorlayer.hideElement(p.cc+"_clickArea");
        p.vectorlayer.hideElement(p.cc+"_hoverArea");
      }
      delete p.content;
      delete p.tooltip;
      delete p.clickarea;
      delete p.clickArea;
      delete p.hoverArea;
    },
    hideAllInfoBoxes: function(){
      if(this.currentInfoBox!=null){
        if(typeof this.vectorlayer.removeElement!='undefined')
          this.vectorlayer.removeElement("Infobox");
        else
          this.vectorlayer.hideElement("Infobox");
        delete this.currentInfoBox;
        this.currentInfoBox=null;
        this.map.getLayer("floater").setSwallowHoverEvents(false);
      }
    },
    createCircle: function( par ){
      if(typeof par.color=='undefined')par.color="red";
      if(typeof par.opacity=='undefined')par.opacity=0.7;
      if(typeof par.radius=='undefined')par.radius=16;
      if(typeof par.flexible=='undefined')par.flexible=false;
//      this.vectorlayer = this.map.getLayer('vector');
//      par.su=this.CCoord2SmartUnit(par.coord);
//      par.rgba=this.getRGBA(par.color,par.opacity);
      // Create polyline
      var lat = par.coord.getLat();
      var lon = par.coord.getLon();
      var radfact = Math.PI/180;
      var latoff = par.radius / 60 / 1852 * 1e6;
      var lonoff = par.radius / 60 / 1852 * 1e6 / Math.cos(lat/1e6*radfact);
      var n = 32;
      var crds = [];
      for( var i=0; i<n; i++ ) {
        var rad = 360 * i / n * radfact;
        var latfact = Math.cos(rad);
        var lonfact = Math.sin(rad);
        crds[i] = new CCoord({ lat: lat+latfact*latoff, lon: lon+lonfact*lonoff });
      }
      crds.push(crds[0]);
      par._poly = this.createContent({
        type: 'polyline',
        coords: crds,
        color: par.color,
        width: 4
      });
    },
    showCircle: function( par ){
      this.showContent( par._poly );
    },
    createPoint: function( par ){
      if(typeof par.color=='undefined')par.color="red";
      if(typeof par.opacity=='undefined')par.opacity=0.7;
      if(typeof par.radius=='undefined')par.radius=16;
      if(typeof par.flexible=='undefined')par.flexible=false;
      var lat = par.coord.getLat();
      var lon = par.coord.getLon();
      var radfact = Math.PI/180;
      var latoff = par.radius / 60 / 1852 * 1e6;
      var lonoff = par.radius / 60 / 1852 * 1e6 / Math.cos(lat/1e6*radfact);
      var n = 16;
      var crds = [];
      for( var i=0; i<n; i++ ) {
        var rad = 360 * i / n * radfact;
        var latfact = Math.cos(rad);
        var lonfact = Math.sin(rad);
        crds[i] = new CCoord({ lat: lat+latfact*latoff, lon: lon+lonfact*lonoff });
      }
      crds.push(crds[0]);
      par._poly = this.createContent({
        type: 'polygon',
        coords: crds,
        color: par.color,
        opacity: par.opacity,
        width: 1
      });
    },
    showPoint: function( par ){
      this.showContent( par._poly );
    },
    createPolyline: function( par ){
      if(typeof par.color=='undefined')par.color="blue";
      if(typeof par.opacity=='undefined')par.opacity=0.7;
      if(typeof par.width=='undefined')par.width=4;
      par.su=new Array();
      if(typeof par.coords != 'undefined') {
        for(var i=0;i<par.coords.length;i++)
          par.su[i]=this.CCoord2SmartUnit(par.coords[i]);
      }
      par.rgba=this.getRGBA(par.color,par.opacity);
    },
    showPolyline: function( par ){
      par.content=new com.ptvag.webcomponent.map.vector.Line(
          par.rgba, par.width, par.su, null, par.cc);
      par.vectorlayer.addElement(par.content);
      if(typeof par.displacement != 'undefined') {
        par.content.setDisplacement(par.displacement);
      }
      /* Tooltip für Polyline*/
      if(typeof par.text=='undefined') {

      }else{
        par.lineTooltip = new com.ptvag.webcomponent.map.vector.Tooltip();
        par.lineTooltip.setText(par.text);
        par.lineTooltip.setAttachedElement(par.content);
        par.lineTooltip.setId(par.cc + 'polylinetooltip');
        par.vectorlayer.addElement(par.lineTooltip);
      }
      if(typeof par.onclick != 'undefined') {
         par.clickArea=new com.ptvag.webcomponent.map.vector.ClickArea(null,null,null,null,function(evt){
            var suCoords = this.map.translateMouseCoords(evt);
            this.showInfoboxSU(suCoords,par.infotitle,par.infocontent,null,par.cc);
         }.bind(this));
         par.clickArea.setAttachedElement(par.content);
         par.clickArea.setId(par.cc + 'polylineclickarea');
         par.vectorlayer.addElement(par.clickArea);
      }

    }
    ,updatePolyline: function (p,params){
        if(typeof params.opacity == 'undefined') {
          params.opacity = 1.0;
        }
        if(typeof params.color != 'undefined'){ p.content.setColor(this.getRGBA(params.color,params.opacity))}
        if(typeof params.width != 'undefined'){ p.content.setPixelSize(params.width);}
        if(typeof params.displacement != 'undefined') { p.content.setDisplacement(params.displacement); }
        if(typeof params.coords != 'undefined') {
           params.su = new Array();
           for(var i=0;i<params.coords.length;i++){
              params.su[i]=this.CCoord2SmartUnit(params.coords[i]);
           }
           p.content.setCoordinates(params.su);
        }
    },
    createPolygon: function( par ){
      if(typeof par.color=='undefined')par.color="green";
      if(typeof par.opacity=='undefined')par.opacity=0.3;
      par.su=new Array();
      for(var i=0;i<par.coords.length;i++)
        par.su[i]=this.CCoord2SmartUnit(par.coords[i]);
      par.rgba=this.getRGBA(par.color,par.opacity);
    },
    showPolygon: function( par ){
      par.content=new com.ptvag.webcomponent.map.vector.Poly(
          par.rgba, par.su, null, par.cc);
      par.vectorlayer.addElement(par.content);
    },
    createContainer: function( par ){
      par.su=this.CCoord2SmartUnit(par.coord);
      par.html = '<div style="position:absolute; left:' +
        (-par.hotspot.x) + 'px; top:' + (-par.hotspot.y) + 'px;">' +
        par.html + '</div>';
    },
    updateContainer: function(p,pNext){
      var x = pNext.su.x;
      var y = pNext.su.y;
      p.content.updateProperties(x,y,null,pNext.html);
    },
    showContainer: function( par ){
      par.content=new com.ptvag.webcomponent.map.vector.HTML(
          par.su.x, par.su.y, 2, par.html, null, par.cc, par.flexible);
      par.vectorlayer.addElement(par.content);
      if(typeof par.toplevel != 'undefined') {
        par.content.setTopLevel(par.toplevel);
      }
    },
    CCoord2SmartUnit: function( coord ){
      return com.ptvag.webcomponent.map.CoordUtil.geoDecimal2SmartUnit(
        {x:coord.getLon()/10, y:coord.getLat()/10});
    },
    SmartUnit2CCoord: function( su ){
      var gd = com.ptvag.webcomponent.map.CoordUtil.smartUnit2GeoDecimal(su);
      return new CCoord({lon:Math.round(gd.x*10),lat:Math.round(gd.y*10)});
    },
    AjaxMap2PTVZoom: function( aZoom ){
      if (typeof aZoom == 'undefined') {
        return 10;
      }
      var maxpix = Math.max( this.mapDiv.clientWidth, this.mapDiv.clientHeight );
	  return Math.max( 0, Math.min( 23, Math.round( Math.log( aZoom/(maxpix * 0.3) ) / Math.log(com.ptvag.webcomponent.map.CoordUtil.ZOOM_LEVEL_FACTOR) )));
    },
    PTV2AjaxMapZoom: function( aPTVZoom ){
      if (typeof aPTVZoom == 'undefined') {
        return 10000;
      }
      var maxpix = Math.max( this.mapDiv.clientWidth, this.mapDiv.clientHeight );
      return Math.round( Math.exp(aPTVZoom*Math.log(1.59)) * (maxpix * 0.3) );
    },
    getZoom: function(){
      return this.PTV2AjaxMapZoom( this.map.getZoom() );
    },
    getRGBA: function(c,o){
      if(typeof o=='undefined')o=1;
      if(typeof c=='undefined')c="red";
      if(c.length == 6)
        {
        var rV = parseInt(c.substring(0,2),16);
        var gV = parseInt(c.substring(2,4),16);
        var bV = parseInt(c.substring(4),16);
        if(!(isNaN(rV*gV*bV)))
           return 'rgba('+rV+','+gV+','+bV+','+o+')';
        }
      switch(c){
      case 'red':return 'rgba(188,6,0,'+o+')';
      case 'green':return 'rgba(0,255,0,'+o+')';
      case 'blue':return 'rgba(0,45,109,'+o+')';
      case 'yellow':return 'rgba(255,255,0,'+o+')';
      case 'cyan':return 'rgba(0,255,255,'+o+')';
      case 'purple':return 'rgba(255,0,255,'+o+')';
      case 'white':return 'rgba(255,255,255,'+o+')';
      case 'black':return 'rgba(0,0,0,'+o+')';
      case 'grey':return 'rgba(128,128,128,'+o+')';
      default:return 'rgba(255,0,0,'+o+')';
      }
    },
    getColorFFFFFF: function(c){
      if(typeof c=='undefined')c="red";
      switch(c){
      case 'red':return 'bc0600';
      case 'green':return '00FF00';
      case 'blue':return '002d6d';
      case 'yellow':return 'FFFF00';
      case 'cyan':return '00FFFF';
      case 'purple':return 'FF00FF';
      case 'white':return 'FFFFFF';
      case 'black':return '000000';
      case 'grey':return '888888';
      default:return 'FF0000';
      }
    },
    getPTVMapType: function( type ){
      switch( type ){
      case "satellite":
        return G_SATELLITE_MAP;
      case "road":
        return G_NORMAL_MAP;
      case "hybrid":
        return G_HYBRID_MAP;
      default:
        return G_NORMAL_MAP;
      };
    },
    getMousePixelCoords: function( e ){
        if(!e){
           //e = window.event;
        }
        if(typeof e.relMouseX == 'undefined') {
          var realX = e.screenX;
          var realY = e.screenY;
        }else{
          var realX = e.relMouseX;
          var realY = e.relMouseY;
        }
        if(window.document.compatMode && window.document.compatMode == "CSS1Compat"){
           var body = window.document.documentElement;
        }else{
           var body = window.document.body;
        }
        var mousey = e.pageY ? e.pageY : realY + body.scrollTop;
        var mousex = e.pageX ? e.pageX : realX + body.scrollLeft;
        return {x:(mousex-Position.cumulativeOffset($('ajaxmap'))[0]),y:(mousey-Position.cumulativeOffset($('ajaxmap'))[1])};
      },
    unload:function(){
       if((typeof this.map != 'undefined') && (this.map != null))
          this.map.dispose();
    }
  });
}


