//Google Map
    var mapG;
    var aiticonLatSpan = 50.11845930325431;
    var aiticonLngSpan = 8.63124132156372;
    var aiticonPos = new GLatLng(aiticonLatSpan,aiticonLngSpan);
    var centerLatSpan = 50.1203854841345;
    var centerLngSpan = 8.63199234008789;
    var centerPos = new GLatLng(centerLatSpan,centerLngSpan);
    var gm2_controls = new Array();
    var aiticonMarker;
    var gm2_anfahrt_seite = true;
    
    var gm2_sv0_style = 'display:block';
    var gm2_sv1_style = 'display:none';
    var gm2_sv2_style = 'display:none';
    var gm2_sv3_style = 'display:none';
    
    var gm2_blueIcon = new GIcon(G_DEFAULT_ICON);
    gm2_blueIcon.image = "/assets/images_system/blue-dot.png";
    gm2_blueIcon.iconSize = new GSize(20, 34);
    gm2_markerOptions = { draggable: false ,icon:gm2_blueIcon};   
    

    //====>NEU    
    var gm2_route_formularFrom = null;
    var gm2_route_formularTo = null;
    var last_search_typ = 0;
    
    var aiticonHtml =  gm2_getPointHtml();
    var extInfoWindowId = 'simple_example_window';
    var gdir = null;
     
    
    //Icon - Type3 - AITICON ICON
    var gm2_pointIcon = new GIcon(G_DEFAULT_ICON);
    gm2_pointIcon.image = "/assets/images_system/aiticon_dot.png";
    
    gm2_pointIcon.shadow = "/assets/images_system/aiticon_dot_shadow.png";
    gm2_pointIcon.shadowSize = new GSize(93, 55);
    gm2_pointIcon.iconSize = new GSize(37, 55);
    gm2_pointIcon.iconAnchor = new GPoint(0,55);
    gm2_pointIcon.infoWindowAnchor = new GPoint(61,10);
    gm2_pointIcon.imageMap = new Array(1,1, 33,1, 36,50, 0,54);
    var PointMarkerOptions = { draggable: false ,icon:gm2_pointIcon};    
    //<====NEU
    
    
    
    function gm2_load() {
      if (GBrowserIsCompatible()) {
        var map = new GMap2(document.getElementById("gm2_map"));
        mapG = map;
        map.setCenter(centerPos, 15);
        
        // Map types: G_NORMAL_MAP, G_SATELLITE_MAP, G_HYBRID_MAP, G_DEFAULT_MAP_TYPES
        map.setMapType(G_NORMAL_MAP);
        
        gm2_showAiticonMarker(map);
        //gm2_addControl();     
        
        //Route
        gdir = new GDirections(map, document.getElementById("directions"));
        GEvent.addListener(gdir, "load", gm2_onGDirectionsLoad);
        GEvent.addListener(gdir, "error", gm2_onGDirectionsError);
        //zoomslider
        zs.init(mapG, 'zoomslider', 'zoomsliderrail', 6, 17);
        
        //map control
        zs.addEvent( d_obj('opt_button_01'), 'click', function(){ gm2_setActiveButtonMTC('opt_button_01'); mapG.setMapType(G_NORMAL_MAP); } );
        zs.addEvent( d_obj('opt_button_02'), 'click', function(){ gm2_setActiveButtonMTC('opt_button_02');mapG.setMapType(G_SATELLITE_MAP); } );
        zs.addEvent( d_obj('opt_button_03'), 'click', function(){ gm2_setActiveButtonMTC('opt_button_03');mapG.setMapType(G_HYBRID_MAP); } );
        //map events
        GEvent.addListener(mapG,"dblclick", function(overlay,point) {     
          
          if (overlay == null) { //if map event
            var pos = new GLatLng(point.lat() ,point.lng());
            var zoom = map.getZoom()+1;
            if ((zoom>=zs.zoomLevelMin) && (zoom<=zs.zoomLevelMax)){ 
                zs.zoomFromSlider = false;
                mapG.setCenter(pos, zoom);
            } 
          }
          
        });
        
        return map;
      }
    }
    function gm2_showAiticonMarker(map){
      aiticonMarker = new GMarker(new GLatLng(aiticonLatSpan,aiticonLngSpan),PointMarkerOptions);
      map.addOverlay(aiticonMarker);
      var extInfoWindowHtml = '<div class="extIWContent">'+aiticonHtml+'</div>';
      GEvent.addListener(aiticonMarker, "click", function() {
          aiticonMarker.openExtInfoWindow( mapG, extInfoWindowId, extInfoWindowHtml, {beakOffset: 0, paddingX: 10, paddingY: 10});   
      });
      aiticonMarker.openExtInfoWindow( mapG, extInfoWindowId, extInfoWindowHtml, {beakOffset: 0, paddingX: 10, paddingY: 10});   
    }
    
    function gm2_addControl () {
      gm2_controls[gm2_controls.length] = new GSmallMapControl();
      mapG.addControl(gm2_controls[gm2_controls.length-1]);
      gm2_controls[gm2_controls.length] = new GMapTypeControl();
      mapG.addControl(gm2_controls[gm2_controls.length-1]);
    }
    
    function gm2_unload(){
        if (gm2_anfahrt_seite == true) GUnload();
    }
    
function gm2_showVar0(){
   mapG.closeExtInfoWindow();
   gm2_sv0_style = 'display:block';
   gm2_sv1_style = 'display:none';
   gm2_sv2_style = 'display:none';
   gm2_sv3_style = 'display:none';
   extInfoWindowHtml = '<div class="extIWContent">'+gm2_getPointHtml()+'</div>';
   aiticonMarker.openExtInfoWindow( mapG,extInfoWindowId, extInfoWindowHtml, {beakOffset: 5, paddingX: 0, paddingY: 0});
   //setMarginTopIE6();
}
function gm2_showVar1(){
   mapG.closeExtInfoWindow();
   gm2_sv0_style = 'display:none';
   gm2_sv1_style = 'display:block';
   gm2_sv2_style = 'display:none';
   gm2_sv3_style = 'display:none';
   extInfoWindowHtml = '<div class="extIWContent">'+gm2_getPointHtml()+'</div>';
   aiticonMarker.openExtInfoWindow( mapG,extInfoWindowId, extInfoWindowHtml, {beakOffset: 5, paddingX: 0, paddingY: 0});
   //setMarginTopIE6();
}
function gm2_showVar2(){
   mapG.closeExtInfoWindow();
   gm2_sv0_style = 'display:none';
   gm2_sv1_style = 'display:none';
   gm2_sv2_style = 'display:block';
   gm2_sv3_style = 'display:none';
   extInfoWindowHtml = '<div class="extIWContent">'+gm2_getPointHtml()+'</div>';
   aiticonMarker.openExtInfoWindow( mapG,extInfoWindowId, extInfoWindowHtml, {beakOffset: 5, paddingX: 0, paddingY: 0});
   //setMarginTopIE6();
}
    
function gm2_getPointHtml(){
    var pointHtml = '<span class="firm_name"><b>aiticon GmbH</b></span><br />Solmsstrasse 41<br/>D-60486 Frankfurt am Main<br /><a href="http://www.aiticon.de">www.aiticon.de</a><br />';
    pointHtml += gm2_getRouteSearchFormHtml_iw();
    return pointHtml;
}

function gm2_getRouteSearchFormHtml_iw() {
  var pointHtml = '';
  pointHtml    = pointHtml + '<div id="routesearchbox">';
  
  pointHtml    = pointHtml + '<div id="search_menu" style="' + gm2_sv0_style + '">';
  pointHtml    = pointHtml + 'Route berechnen:<br /><a href="javascript:void(0)" onclick="gm2_showVar1()">Hierher</a> - <a href="javascript:void(0)" onclick="gm2_showVar2()">Von hier</a>';
  pointHtml    = pointHtml + '</div>'; //search_menu
  pointHtml    = pointHtml + '<div id="search_var1" style="' + gm2_sv1_style + '">';
  pointHtml    = pointHtml + '<form name="gm2_route_formular" action="#" onsubmit="last_search_typ = 1;saveValues(this.from.value, this.to.value);gm2_setDirections(this.from.value, this.to.value, \'de_DE\');return false" method="post">';
  pointHtml    = pointHtml + 'Route berechnen:<br />Hierher - <a href="javascript:void(0)" onclick="gm2_showVar2()">Von hier</a><br /><span class="fieldlabel">Startadresse</span><br />';
  pointHtml    = pointHtml + '<input name="from" type="text" class="fieldsearch" value="'+getFromFormValue()+'" /><input class="button_los" type="image" value="Los" src="z_system_images/button_search_submit.gif" />';
  pointHtml    = pointHtml + '<input name="to" type="hidden" value="aiticon GmbH @'+aiticonLatSpan+','+aiticonLngSpan+'" />';
  pointHtml    = pointHtml + '<input name="hl" type="hidden" value="de" /><p class="clr">&nbsp;</p>';
  pointHtml    = pointHtml + '</form>';
  pointHtml    = pointHtml + '<a href="javascript:void(0)" class="wizardpop" onclick="gm2_showVar0()">&laquo; Zur&uuml;ck</a>';
  pointHtml    = pointHtml + '</div>'; //search_v1
  pointHtml    = pointHtml + '<div id="search_var2" style="' + gm2_sv2_style + '">';
  pointHtml    = pointHtml + '<form name="gm2_route_formular" action="#" onsubmit="last_search_typ = 2;saveValues(this.from.value, this.to.value); gm2_setDirections(this.from.value, this.to.value, \'de_DE\'); return false"  method="post">';
  pointHtml    = pointHtml + 'Route berechnen:<br /><a href="javascript:void(0)" onclick="gm2_showVar1()">Hierher</a> - Von hier<br /><span class="fieldlabel">Zieladresse</span><br />';
  pointHtml    = pointHtml + '<input name="to" type="text" class="fieldsearch" value="'+getToFormValue()+'" /><input class="button_los" type="image" value="Los" src="z_system_images/button_search_submit.gif" />';
  pointHtml    = pointHtml + '<input name="from" type="hidden" value="aiticon GmbH @'+aiticonLatSpan+','+aiticonLngSpan+'" />';
  pointHtml    = pointHtml + '<input name="hl" type="hidden" value="de" /><p class="clr">&nbsp;</p>';
  pointHtml    = pointHtml + '</form>';
  pointHtml    = pointHtml + '<a href="javascript:void(0)" class="wizardpop" onclick="gm2_showVar0()">&laquo; Zur&uuml;ck</a>';
  pointHtml    = pointHtml + '</div>'; //search_v2
  
  pointHtml    = pointHtml + '</div>'; //routesearchbox
  
  return pointHtml;
}

function saveValues(from,to){
  gm2_route_formularFrom = from;
  gm2_route_formularTo = to;
}
function getFromFormValue(){
    if (gm2_route_formularFrom == null) return '';
    if (last_search_typ == 1) return gm2_route_formularFrom.replace('"', '' );
    return '';
}
function getToFormValue(){
    if (gm2_route_formularTo == null) return '';
    if (last_search_typ == 2) return gm2_route_formularTo.replace('"', '' );
    return '';
}

//Routeplaner
function gm2_setDirections(fromAddress, toAddress, locale) {
  mapG.closeExtInfoWindow();
  gdir.load("from: " + fromAddress + " to: " + toAddress,
            { "locale": locale });
}
function gm2_onGDirectionsError(){
   document.getElementById('directions').style.display = 'none';
   gm2_route_formularFrom = null;
   gm2_route_formularTo = null;
   
   d_style('print_button').display = 'none';
   d_style('separator').display = 'none';
   
  if (gdir.getStatus().code == G_GEO_UNKNOWN_ADDRESS)
    alert("No corresponding geographic location could be found for one of the specified addresses. This may be due to the fact that the address is relatively new, or it may be incorrect.\nError code: " + gdir.getStatus().code);
  else if (gdir.getStatus().code == G_GEO_SERVER_ERROR)
    alert("A geocoding or directions request could not be successfully processed, yet the exact reason for the failure is not known.\n Error code: " + gdir.getStatus().code);
  
  else if (gdir.getStatus().code == G_GEO_MISSING_QUERY)
    alert("The HTTP q parameter was either missing or had no value. For geocoder requests, this means that an empty address was specified as input. For directions requests, this means that no query was specified in the input.\n Error code: " + gdir.getStatus().code);
  
  //   else if (gdir.getStatus().code == G_UNAVAILABLE_ADDRESS)  <--- Doc bug... this is either not defined, or Doc is wrong
  //     alert("The geocode for the given address or the route for the given directions query cannot be returned due to legal or contractual reasons.\n Error code: " + gdir.getStatus().code);
    
  else if (gdir.getStatus().code == G_GEO_BAD_KEY)
    alert("The given key is either invalid or does not match the domain for which it was given. \n Error code: " + gdir.getStatus().code);
  
  else if (gdir.getStatus().code == G_GEO_BAD_REQUEST)
    alert("A directions request could not be successfully parsed.\n Error code: " + gdir.getStatus().code);
   
  else alert("An unknown error occurred.");
}
function gm2_onGDirectionsLoad(){ 
  document.getElementById('directions').innerHTML = "<div id=\"route_results\" class=\"gm2_block_header\">Route</div>";
  document.getElementById('directions').style.display = 'block';
  d_style('print_button').display = 'inline';
  d_style('separator').display = 'inline';
}
function gm2_setActiveButtonMTC(id){
    var obj_parent = d_obj(id).parentNode;
    var child_count = obj_parent.childNodes.length;
    for (var i=0; i<child_count; i++){
        if ((obj_parent.childNodes[i].nodeType == 1) && obj_parent.childNodes[i].nodeName == 'A')
        {
            obj_parent.childNodes[i].className = 'cnt_mt_button';
            if (obj_parent.childNodes[i].id == id) obj_parent.childNodes[i].className += ' active';
        }
    }
}
//Fuer Drucken-Function
function gm2_printPage(){
    if ((gm2_route_formularFrom != null) && (gm2_route_formularTo != null)) {
        openwindow("http://maps.google.com/maps?f=d&saddr="+gm2_route_formularFrom+"&daddr="+gm2_route_formularTo+"&hl=de&geocode=&mra=ls&sll=&sspn=1.271431,2.471924&ie=UTF8&z=8&pw=2", 1, 800, 800, 0);
    } else {
        alert("A directions request could not be successfully parsed.");
    }
}