
function loadSmall(a,b) {
  if (GBrowserIsCompatible()) {
    var map = new GMap2(document.getElementById("block-googlemaps-small"));
    map.setCenter(new GLatLng(a,b), 15);
    map.addControl(new GSmallMapControl());
    map.addControl(new GMapTypeControl());
  }
}

function loadLarge(a,b,c) {
  if (GBrowserIsCompatible()) {
    var map = new GMap2(document.getElementById("block-googlemaps-large"));
    map.setCenter(new GLatLng(a,b), 15);
    map.addControl(new GSmallMapControl());
    map.addControl(new GMapTypeControl());
    map.openInfoWindowHtml(map.getCenter(), c);
  }
}

function chkRoutForm() {
 if(document.routform.rstrasse.value == "") {
   alert("Bitte eine Strasse angeben!");
   document.routform.rstrasse.focus();
   return false;
  }
 if(document.routform.rort.value == "") {
   alert("Bitte einen Ort angeben!");
   document.routform.rort.focus();
   return false;
  }
}

function setDirections(fromAddress, toAddress, locale) {
   gdir.load("from: " + fromAddress + " to: " + toAddress, { "locale": locale });
 }

function handleErrors(){
 if (gdir.getStatus().code == G_GEO_UNKNOWN_ADDRESS)
   alert("Die angegebene Adresse konnte nicht gefunden werden.\nError code: " + gdir.getStatus().code);
 else if (gdir.getStatus().code == G_GEO_SERVER_ERROR)
   alert("Die angegebene Adresse konnte nicht gefunden werden.\n Error code: " + gdir.getStatus().code);
 else if (gdir.getStatus().code == G_GEO_MISSING_QUERY)
   alert("Bitte eine Start- und eine Zieladresse angeben.\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("In der Start- und der Zieladresse sind keine Sonderzeichen zugelassen.\n Error code: " + gdir.getStatus().code);
 else alert("Bitte eine Start- und eine Zieladresse angeben.");
}

function onGDirectionsLoad(){ 
  // Use this function to access information about the latest load()
  // results.
  // e.g.
  // document.getElementById("getStatus").innerHTML = gdir.getStatus().code;
}

function printRoute(from,to,id) {
 a = "/tools/printRoute.cfm?from=" + from + "&to=" + to + "&id=" + id;
 ubbWin('printRoute',a,720,800,'yes','no');
}

