
function content() {
    var	nColumnHeightInEm = nWindowHeight/nPxPerEm - 4.1875;
    
	// Erstellen der Spalte, die die Map enthält
	if(!bIsPrint) {
	    document.getElementById("columne_detail").style.height = nColumnHeightInEm - 2 * 0.625 + "em";
	    document.getElementById("columne_detail").style.width =  10*(nColumns-1) - 1.25 + "em";

    if(document.getElementById("map_canvas")) {
        var nMapOffsetTop = document.getElementById("map_canvas").offsetTop / nPxPerEm;
        if(document.getElementById("map_canvas").offsetParent.id == "content") {
            nMapOffsetTop -= 0.9375; // offsetTop wird bezüglich dem #content berechnet. Darum noch den Abstand zwischen Content und columne_detail abziehen.
        }

        document.getElementById("map_canvas").style.height = nColumnHeightInEm - nMapOffsetTop - 0.625 + "em";
        }
    }

	
	/* Adress-Details */
	
	/* werbung*/
	
	/* google-maps */
	drawTheMap();
}

function updateDataSimple() {
}

      function setMapType(name) {
        var oMapTypes = map.getMapTypes();
        for(var i in oMapTypes ) {
            var mapType = oMapTypes[i];
            if(mapType.getName() == name) {
                map.setMapType(mapType);
            }
        }
      }
      
/**
 * Ändert den Kartentyp. Wird vom entsprechenden Event-Listener aufgerufen.
 */
function onMapTypeChanged() {
	if(searchstate.hdnMapType) {
		searchstate.hdnMapType.value = map.getCurrentMapType().getName();
	}
}


function drawTheMap() {
        if(!document.getElementById("map_canvas"))
            return;
        if (GBrowserIsCompatible()) {
        
          // Create and Center a Map
          map = new GMap2(document.getElementById("map_canvas"));

          if (oBounds)
            {
                map.setCenter(oBounds.getCenter(), map.getBoundsZoomLevel(oBounds));
                setMapType(oType);
            }
          else if(oCenter)
            {
                map.setCenter(oCenter, oZoom);
                setMapType(oType);
            }
          else
            {
                map.setCenter(oAddressPosition, oZoom);
                  if(searchstate.hdnMapType.value != "") {
                    setMapType(searchstate.hdnMapType.value);
                  }
            }

          map.addControl(new GLargeMapControl());
          map.addControl(new GMapTypeControl());
          
        // Open info window closes by a click everywhere on the map
        GEvent.addListener(map, "click", function() { 
		    if(map.activeOverlay) {
			    map.removeOverlay(map.activeOverlay);
			    map.activeOverlay = 0;
		    }
	    });

 		GEvent.addListener(map, 'maptypechanged', onMapTypeChanged);

          // Create a base icon for all markers
          var baseIcon = new GIcon();
          baseIcon.iconSize = new GSize(15, 15); /* Grösse der Marker in Pixel hier angeben */
          baseIcon.iconAnchor = new GPoint(8, 8); /* Position der icons */

    function createMarker(point, infoWindowText) {
	    var markerIcon = new GIcon(baseIcon);
	    markerIcon.image = "/images/pin_red.gif";
    	
	    // Set up our GMarkerOptions object
	    markerOptions = { icon:markerIcon };
    	
	    var marker = new GMarker(point, markerOptions);
    	
	    GEvent.addListener(marker, "mouseover", function() {
		    if(map.activeOverlay) {
			    map.removeOverlay(map.activeOverlay);
			    map.activeOverlay = 0;
		    }
            var infoWindow = new Rectangle(point, infoWindowText)
		    map.addOverlay( infoWindow );
		    map.activeOverlay = infoWindow;
	    });
    	
	    return marker;
    }

            var infoWindowContent = "<div class='top_left'>" +
                                          "<div class='top_right'><img src='/images/transparent.gif' /></div>" +
                                      "</div>" +
                                      "<div class='infoWindowContent'>" +
                                          infoWindowText +
                                      "</div>" +
                                      "<div class='bottom_left'>" +
                                          "<div class='bottom_right'><img src='/images/transparent.gif' /></div>" +
                                      "</div>";

          
          if(infoWindowText)
              map.addOverlay( createMarker(oAddressPosition, infoWindowContent) );
        }
      }
      

    function printPage()
    {
        if(typeof map != "undefined")
            {
            var center = map.getCenter();
            printPageParam("&lng="+center.lng()+"&lat="+center.lat()+"&zoom="+map.getZoom()+"&type="+map.getCurrentMapType().getName());
            }
        else
            {
            printPageParam("");
            }

    }

    // A Rectangle is a simple overlay that outlines a lat/lng bounds on the
    // map. It has a border of the given weight and color and can optionally
    // have a semi-transparent background color.
    function Rectangle(point, content) {
      this.point_ = point;
      this.content_ = content;
    }
    //Rectangle.prototype = new GOverlay();
    

    // Creates the DIV representing this rectangle.
    Rectangle.prototype.initialize = function(map) {
      // Create the DIV containing the infoWindow
      var div = document.createElement("div");
      div.className = "infoWindow" ;
      // Create the DIV containing the infoWindow content
      var triangleDiv = document.createElement("div")
      triangleDiv.className = "infoWindowTriangle";
      triangleDiv.innerHTML = "&nbsp;" ;
      // Create the DIV containing the infoWindow triangle of de "bubble"
      var innerDiv = document.createElement("div")
      innerDiv.className = "infoWindowInnerDiv";
      innerDiv.innerHTML = this.content_ ;

      // Our rectangle is flat against the map, so we add our selves to the
      // MAP_PANE pane, which is at the same z-index as the map itself (i.e.,
      // below the marker shadows)
      div.appendChild(innerDiv);
      map.getPane(G_MAP_FLOAT_PANE).appendChild(div);
      map.getPane(G_MAP_FLOAT_PANE).appendChild(triangleDiv);

      this.map_ = map;
      this.div_ = div;
      this.triangleDiv_ = triangleDiv;
      
      GEvent.bindDom(this.div_, 'mousedown', this, this.onClick_);
      GEvent.bindDom(this.div_, 'dblclick', this, this.onClick_);
      GEvent.bindDom(this.div_, 'DOMMouseScroll', this, this.onClick_);
      GEvent.bindDom(this.triangleDiv_, 'mousedown', this, this.onClick_);
      GEvent.bindDom(this.triangleDiv_, 'dblclick', this, this.onClick_);
      GEvent.bindDom(this.triangleDiv_, 'DOMMouseScroll', this, this.onClick_);
    }

    // Remove the main DIV from the map pane
    Rectangle.prototype.remove = function() {
      this.div_.parentNode.removeChild(this.div_);
      this.triangleDiv_.parentNode.removeChild(this.triangleDiv_);
    }

    // Copy our data to a new Rectangle
    Rectangle.prototype.copy = function() {
      return new Rectangle(this.point_, this.content_, this.cssClass_);
    }

    // Redraw the rectangle based on the current projection and zoom level
    Rectangle.prototype.redraw = function(force) {
      // We only need to redraw if the coordinate system has changed
      if (!force) return;

      // Calculate the DIV coordinates of two opposite corners of our bounds to
      // get the size and position of our rectangle

      // Now position our DIV based on the DIV coordinates of our bounds
      /* Karteneckpunkt unten links in px */
      var oSouthWest = this.map_.fromLatLngToDivPixel( this.map_.getBounds().getSouthWest() );
      /* Karteneckpunkt oben rechts in px */
      var oNorthEast = this.map_.fromLatLngToDivPixel( this.map_.getBounds().getNorthEast() );
      /* Map width in px */
      /* var pxPerEm = (oNorthEast.x - oSouthWest.x) / 27 ;  /* Breite der Karte ist mit 27em im Stylesheet angegeben */
   	  var nPxPerEm = document.getElementById("hundred_em_as_reference").clientWidth/100.0;
//      var nPxPerEm = document.PxPerEm;
      var nInfoWindowWidthInEm = 11.5;
      var nMaxHeightInEm = 12.5; /* the total (expected) height of the window including the triangle */
      var nTriangleWidthInEm = 1.3;
      var nTriangleHeightInEm = 2;
      /* Calculate the size of the div-Containers */
      this.div_.style.width = (nInfoWindowWidthInEm * nPxPerEm ) + "px";
      this.div_.style.height = (3 * nPxPerEm ) + "px";
      this.triangleDiv_.style.width = (nTriangleWidthInEm * nPxPerEm ) + "px";
      this.triangleDiv_.style.height = (nTriangleHeightInEm * nPxPerEm ) + "px";
      /* Point of the marker in px */
      var oPointInPixel = this.map_.fromLatLngToDivPixel( this.point_ );

      if(oNorthEast.x - oPointInPixel.x > (nInfoWindowWidthInEm * nPxPerEm) ) {
        this.div_.style.left = oPointInPixel.x + "px";
        this.triangleDiv_.style.left = oPointInPixel.x + "px";
      } else {
        this.div_.style.left = oPointInPixel.x - (nInfoWindowWidthInEm * nPxPerEm) + "px";
        this.div_.className += "Left";
        this.triangleDiv_.style.left = oPointInPixel.x - (nTriangleWidthInEm * nPxPerEm) + "px";
        this.triangleDiv_.className += "Left";
      }
      if(oPointInPixel.y - oNorthEast.y < nMaxHeightInEm * nPxPerEm ) {
        this.div_.style.top = oPointInPixel.y + (nTriangleHeightInEm * nPxPerEm) + "px";
        this.div_.className += "Bottom";
        this.triangleDiv_.style.top = oPointInPixel.y + "px";
        this.triangleDiv_.className += "Bottom";
      } else {
        this.div_.style.top = oPointInPixel.y - (nTriangleHeightInEm * nPxPerEm) - (3 * nPxPerEm) + "px";
        this.triangleDiv_.style.top = oPointInPixel.y - (nTriangleHeightInEm * nPxPerEm) + "px";
      }
    }
    
    /**
     * Private function to steal mouse click events to prevent it from returning to the map.
     * Without this links in the ExtInfoWindow would not work, and you could click to zoom or drag 
     * the map behind it.
     * @private
     * @param {MouseEvent} e The mouse event caught by this function
     */
    Rectangle.prototype.onClick_ = function(e) {
      if(navigator.userAgent.toLowerCase().indexOf('msie') != -1 && document.all) {
        window.event.cancelBubble = true;
        window.event.returnValue = false;
      } else {
        //e.preventDefault();
        e.stopPropagation();
      }
    };

nMinHeight=42;