    
    function drucken(){
        // aktuellen Extent ermitteln, um ihn an den mapserver zu schicken
        var currentExtent = mapnik.getExtent();
        
        var current_bl_x = currentExtent.left;
        var current_bl_y = currentExtent.bottom;
        var current_tr_x = currentExtent.right;
        var current_tr_y = currentExtent.top;
        var anfrage = "";
        //Alle gid, die das routing zurueckgeliefert hat, geeignet fuer mapserver abspeichern
        for (var i = 1; i < kanten.length - 1; i++) {
            if (i == kanten.length - 2) 
                anfrage = anfrage + kanten[i];
            else 
                anfrage = anfrage + kanten[i] + ",";
        }
        //ab hier: ekelhafter code.. muss wohl nochmal auf schoenheit ueberarbeitet werden 
        //-------------Fuer: wenn nur ein Marker, oder keine Route berechnet    
        if (startPoint_x == null || stopPoint_x == null) {
            //alert("salat");
            if (startPoint_x == null && stopPoint_x != null) {
                startPoint_x = -2079951.69324;
                startPoint_y = 10199066.19180;
            }
            if (startPoint_x != null && stopPoint_x == null) {
                stopPoint_x = -2079951.69324;
                stopPoint_y = 10199066.19180;
            }
            if (startPoint_x == null && stopPoint_x == null) {
                startPoint_x = -2079951.69324;
                startPoint_y = 10199066.19180;
                stopPoint_x = -2079951.69324;
                stopPoint_y = 10199066.19180;
            }
            anfrage = "1944";
            erstesundletztes[0] = 'LINESTRING(-2079951.69324 10199066.19180, -2079954.69324 10199069.19180)';
            erstesundletztes[1] = 'LINESTRING(-2079951.69324 10199066.19180, -2079954.69324 10199069.19180)';
        }
        else {
            if (anfrage == "") {
                anfrage = "1944";
                erstesundletztes[0] = 'LINESTRING(-2079951.69324 10199066.19180, -2079954.69324 10199069.19180)';
                erstesundletztes[1] = 'LINESTRING(-2079951.69324 10199066.19180, -2079954.69324 10199069.19180)';
            }
        }
        //-------------ENDE: wenn nur ein Marker, oder keine Route berechnet; Ende ekelhaftes..
        
        
        //--------Popup mit Inhalt fuellen-------------------------------------------- 	
        info_window = window.open('', '', "width=800,status=0,location=0,height=600,left=100,top=100,scrollbars=yes");
        info_window.document.write("<button onclick=\"window.print();\">Drucken!</button>");
        //var info_text = info_window.document.write("<img src=\"./images/fahrradani.gif\">");			
        info_window.document.write("<h3>Fahrradies.net - Druckansicht</h3>");
        var w_anpassung = 650;
        var h_anpassung = map.getSize().h / (map.getSize().w / w_anpassung);
        info_window.document.write("<img border=\'1\' src=\"http://igf-project.igf.uni-osnabrueck.de/cgi-bin/mapserv?map=/home/studienprojekt/public_html/druckwms/print.map&VERSION=1.1.1&REQUEST=GetMap&SRS=EPSG:900913&BBOX=" + current_bl_x + ',' + current_bl_y + ',' + current_tr_x + ',' + current_tr_y + "&layers=osm&WIDTH=" + w_anpassung + "&Height=" + h_anpassung + "&FORMAT=image/jpeg&SERVICE=wms&anfrage=" + anfrage + "&start_x=" + startPoint_x + "&start_y=" + startPoint_y + "&ende_x=" + stopPoint_x + "&ende_y=" + stopPoint_y + "&erstes=" + erstesundletztes[0] + "&letztes=" + erstesundletztes[1] + "\"> ");
        info_window.document.write('<div id="beschreibung" style="width:500px; float:left; font-size:10pt"><br /><br />' + document.getElementById('routenbeschreibung').innerHTML + "</div>");
        info_window.document.write("<br /><div style='float:left;'><input type=\"checkbox\"  onclick=\"if(this.checked==false)getElementById('bild').style.display = 'none';else getElementById('bild').style.display = 'block'\">Hoehenprofil</div>");
        info_window.document.write("<br /><div id='bild' style='display:none;float:left;'><img src=\"../tmp/" + zufallsname + ".png\"></div>");
        
        //-------------Fortsetzung: wenn nur ein Marker, oder keine Route berechnet..beginn ekelhaftes
        if (startPoint_x == -2079951.69324 || stopPoint_x == -2079951.69324) {
            if (startPoint_x == -2079951.69324 && stopPoint_x != -2079951.69324) {
                startPoint_x = null;
                startPoint_y = null;
            }
            if (startPoint_x != -2079951.69324 && stopPoint_x == -2079951.69324) {
                stopPoint_x = null;
                stopPoint_y = null;
            }
            if (startPoint_x == -2079951.69324 && stopPoint_x == -2079951.69324) {
                startPoint_x = null;
                stopPoint_x = null;
            }
        }
        info_window.document.close();
    }
    
    
    
    function druckenHoehenprofil(){
        //--------Popup mit Inhalt fuellen-------------------------------------------- 	
        info_window = window.open('', '', "width=800,status=0,location=0,height=600,left=100,top=100,scrollbars=yes");
        info_window.document.write("<button onclick=\"window.print();\">Drucken!</button>");
        //var info_text = info_window.document.write("<img src=\"./images/fahrradani.gif\">");			
        info_window.document.write("<h3>Fahrradies.net - Druckansicht</h3>");
        var w_anpassung = 600;
        var h_anpassung = map.getSize().h / (map.getSize().w / w_anpassung);
        info_window.document.write("<img src=\"../test/" + zufallsname + ".png\"> ");
        
        info_window.document.close();
    }
    
    
    
    
    /*  
      function printInfo(){
          info_window = window.open('print.php?x1=' + startPoint_x + '&y1=' + startPoint_y + '&x2=' + stopPoint_x + '&y2=' + stopPoint_y + '&navi=' + navi, "Test", "width=800,height=800,left=0,top=0,scrollbars=yes");
          
      }

  */

      function printInfo(){
          //--------Popup mit Inhalt fuellen-------------------------------------------- 	
          info_window = window.open('', '', "width=800,status=0,location=0,height=600,left=100,top=100,scrollbars=yes");
          info_window.document.write("<button onclick=\"window.print();\">Drucken!</button>");
          info_window.document.write('<div style="width:500px; float:left; font-size:10pt"><br /><br />' + document.getElementById('map')+ "</div>");
          info_window.document.write('<div style="width:500px; float:left; font-size:10pt"><br /><br />' + document.getElementById('routenbeschreibung').innerHTML + "</div>");
          

          info_window.document.close();
      }
