﻿    // Javascript File
    var markers = [];
    var wpoints = [];
    var wp_nr = 0;
    var waypoints = [];
    var map;
    var points = [];
    var geocoder = null;

    function profileOver() {
      //document.getElementById('center_mark').style.visibility = 'visible';
      //document.getElementById('alti_line').style.visibility = 'visible';
    }
    
    function profileOut() {
      //document.getElementById('center_mark').style.visibility = 'visible';
      //document.getElementById('alti_line').style.visibility = 'visible';
    }
    
    function profileClick(img) {
      //alert(img);
    }
    
    function initMap() {
        map = new GMap2(document.getElementById("map"));
        map.addControl(new GScaleControl());
        map.addControl(new GLargeMapControl());
        map.addControl(new GOverviewMapControl(), new GControlPosition(G_ANCHOR_TOP_RIGHT, new GSize(10, 10)));
        map.addControl(new GMapTypeControl());
        map.addMapType(G_PHYSICAL_MAP);
        geocoder = new GClientGeocoder();
   }
   
    function initMapAz() {
        map = new GMap2(document.getElementById("map"));
        map.addControl(new GScaleControl());
        map.addControl(new GLargeMapControl());
        map.addControl(new GOverviewMapControl(), new GControlPosition(G_ANCHOR_TOP_RIGHT, new GSize(10, 10)));
        map.addControl(new GMapTypeControl());
        map.addMapType(G_PHYSICAL_MAP);
        geocoder = new GClientGeocoder();
   }
   
   function initMapSmall() {
        map = new GMap2(document.getElementById("map"));
        map.addControl(new GScaleControl());
        map.addControl(new GSmallMapControl());
        map.addMapType(G_PHYSICAL_MAP);
        geocoder = new GClientGeocoder();
   }
   
   function initMapSmallLoc() {
        map = new GMap2(document.getElementById("maplocwindow"));
        map.addControl(new GScaleControl());
        map.addControl(new GLargeMapControl());
        map.addControl(new GMapTypeControl());
        map.addMapType(G_PHYSICAL_MAP);
        geocoder = new GClientGeocoder();
   }
    
     
    function profileMove(event) {
      //event.offsetY;
      var offset;
      var nrPoints = points.length;
      var width = 540;
      if (typeof event.layerX == 'undefined') {
        offset = event.offsetX;
        
      } else {
        offset = event.layerX;
        //document.getElementById('alti_line').style.left = 540 + 'px';
        //document.getElementById('center_mark').style.top = '247px';
      }
      document.getElementById('alti_line').style.left = offset + 'px';
      var point_nr = Math.floor(offset*nrPoints/width);
      
      map.setCenter(points[point_nr]);
      center_point = points[point_nr];
      
    }

    function createMarker(point, title, nr) {
      var marker = new GMarker(point);
      // Show this marker's index in the info window when it is clicked
      var html = "Waypoint: <b>" + title + "</b><br><a href='#' onClick='markers[" + nr + "].showMapBlowup(14,G_SATELLITE_MAP);return false;'>Zoom</a>";
      GEvent.addListener(marker, "click", function() {
        marker.openInfoWindowHtml(html);
        //marker.showMapBlowup(3,_SATELLITE_TYPE);
      });
    
      return marker;
    }
 
    // Create a base icon for all of our markers that specifies the
    // shadow, icon dimensions, etc.
    var baseIcon = new GIcon();
    baseIcon.shadow = "http://www.google.com/mapfiles/shadow50.png";
    baseIcon.iconSize = new GSize(20, 34);
    baseIcon.shadowSize = new GSize(37, 34);
    baseIcon.iconAnchor = new GPoint(9, 34);
    baseIcon.infoWindowAnchor = new GPoint(9, 2);
    baseIcon.infoShadowAnchor = new GPoint(18, 25);
    
    
    // Create a base icon for all of our markers that specifies the
    // shadow, icon dimensions, etc.
    var baseAdrIcon = new GIcon();
    baseAdrIcon.shadow = "http://www.google.com/mapfiles/shadow50.png";
    baseAdrIcon.image = "http://www.hunderttausend.de/shared/gfx/icon/webcal/icon_address.gif";  
    baseAdrIcon.iconSize = new GSize(13, 13);
    baseAdrIcon.shadowSize = new GSize(13, 13);
    baseAdrIcon.iconAnchor = new GPoint(7, 7);
    baseAdrIcon.infoWindowAnchor = new GPoint(0, 0);
    baseAdrIcon.infoShadowAnchor = new GPoint(0, 0);
    
    // Creates a marker whose info window displays the letter corresponding
    // to the given index.
    function createMarkerAnzeige(address, id, type) {
      if (geocoder) {
          geocoder.getLatLng(
          address,
          function(point) {
              if (!point) {
                  return ("false");
              } else {
                  var icon = new GIcon(baseAdrIcon);
                  var marker = new GMarker(point, icon);

                  GEvent.addListener(marker, "click", function() {
                      marker.openInfoWindowHtml("<iframe  src='../anzeigenm/az_view_list.aspx?templ=az_detail_map.xslt&ID=" + id + "' width=\"250\" height=\"200\" id=\"werbungextra\" marginwidth=\"0\" marginheight=\"0\" frameborder=\"0\" scrolling=\"no\">");
                  });

                  map.addOverlay(marker);
              }
          }
        );
      }
    } 
     
    function showAddressAnzeige(address,id) {
      if (geocoder) {
        geocoder.getLatLng(
          address,
          function(point) {
            if (!point) {
              return false;
            } else {
              map.setCenter(point, 13);
              var marker = new GMarker(point);
              map.addOverlay(marker);
              marker.openInfoWindowHtml("<iframe  src='../anzeigenm/az_view_list.aspx?templ=az_detail_map.xslt&ID=" + id + "' width=\"350\" height=\"250\" id=\"werbungextra\" marginwidth=\"0\" marginheight=\"0\" frameborder=\"0\" scrolling=\"yes\">");
            }
          }
        );
      }
    }
     
     
    // Creates a marker whose info window displays the letter corresponding
    // to the given index.
    function showAddress(address) {
      var point;
      
      if (geocoder) {
        geocoder.getLatLng(
          address,
          function(point) {
            if (!point) {
             
              return false;
            } else {
             
              map.setCenter(point, 13);
              var marker = new GMarker(point);
              map.addOverlay(marker);
              marker.openInfoWindowHtml(address);
            }
          }
        );
      }
    }
               
   // JScript File
   var initMap = 0;

   function openMapLocWindowT(titel, adr, height, width, animationdirectionelement) {

       var ScrollTop = AJS.getScrollTop();
       Dialog1.Show('Dialog1', 'Dialog1', 'Kartenfenster', 250, ScrollTop + 30);

   //    alert('TopScrollTop' + ScrollTop);
            
       Dialog1.Width = (width + 165) + 'px';
       Dialog1.set_animationDirectionElement(animationdirectionelement);
       Dialog1.set_title(titel);
       
       var cHead = document.getElementById("DialogHead");
       cHead.style.width = (width + 85) + 'px';

       var cBody = document.getElementById("DialogBody");
       cBody.style.width = (width + 85) + 'px';
       cBody.style.height = (height + 50) + 'px';

       var cFood = document.getElementById("DialogFoot");
       cFood.style.width = (width + 85) + 'px';

       var maplocwindow = document.getElementById("maplocwindow");
       maplocwindow.style.visibility = "visible";

       var FrameDialog = document.getElementById("FrameDialog");
       FrameDialog.style.visibility = "hidden";

       maplocwindow.style.height = (height + 50) + 'px';
       maplocwindow.style.width = (width + 50) + 'px';

       HiddenAd();

       LoadLocWindow();  
       
       showAddress(decodeURI(adr));
   }            
               
   function LoadLocWindow()
   {
      if (GBrowserIsCompatible()) {
        initMapSmallLoc();     
        map.setCenter(new GLatLng(49.748801,6.704778),11);
        // Add a polyline with five random points. Sort the points by
        // longitude so that the line does not intersect itself.
      }
    }
        
    function closeMapLocWindow() {
        
        var maps = document.getElementById("mappa");
        maps.style.top = 1 + 'px';
        maps.style.height = 1 + 'px';
        maps.style.width = 1 + 'px';
        maps.style.visibility = "hidden";
        
        var maplocwindow = document.getElementById("maplocwindow");
        maplocwindow.style.visibility = "hidden";
        maplocwindow.style.top = 1 + 'px';
        maplocwindow.style.height = 1 + 'px';
        maplocwindow.style.width = 1 + 'px';
            
        SwitchBgOff();
    }
    
 