    function addBookmark(title,url) {
        if( window.opera && window.print ) {
            return true;
        } else if (window.sidebar) {
            window.sidebar.addPanel(title, url,"");
        } else if( document.all ) {
            window.external.AddFavorite( url, title);
        } else {
            alert ("Not able to set bookmark.");
        }
    }

    function showRoute(obj){
        if(obj==1){
            var strAddr = document.getElementById('address').value;
            var strAddrTmp = strAddr.replace(/ /,"+");
            document.getElementById('dvGoogle').style.display="block";
            initialize2(strAddrTmp);
        }else{
            document.getElementById('dvGoogle').style.display="none";
            document.getElementById('dvRoute').innerHTML = "";
        }
    }

    var map;
    var directionsPanel;
    var directions;
    var geocoder = null;

    function initialize2(objTo) {
        map = new GMap2(document.getElementById("dvMap"));
        map.addControl(new GSmallMapControl());
        directionsPanel = document.getElementById("dvRoute");
        directions = new GDirections(map, directionsPanel);
        GEvent.addListener(directions, "error", handleErrors);
        geocoder = new GClientGeocoder();

        directions.load("from: "+objTo+" to: "+strAddress);
    }

    var map = null;
    var geocoder = null;

    function initialize() {
      if (GBrowserIsCompatible()) {
        map = new GMap2(document.getElementById("dvMapSmall"));
        map.addControl(new GSmallMapControl());
        /*map.addControl(new GMapTypeControl());*/
        geocoder = new GClientGeocoder();
        showAddress(strAddress);
      }
    }

    function showAddress(address) {
      if (geocoder) {
        geocoder.getLatLng(
          address,
          function(point) {
            if (!point) {
              alert(address + " not found");
            } else {
              map.setCenter(point, 13);
              var marker = new GMarker(point);
              map.addOverlay(marker);
            }
          }
        );
      }
    }

    function handleErrors(){
        if (directions.getStatus().code == G_GEO_UNKNOWN_ADDRESS)
            alert("Address can not be found by Google.\nAddress-format: address town\nPlease check your spelling.");
        else if (directions.getStatus().code == G_GEO_SERVER_ERROR)
            alert("Address is not searchable.");

        else if (directions.getStatus().code == G_GEO_MISSING_QUERY)
            alert("Address can not be found by Google.\nAddress-format: address town\nPlease check your spelling.");

        else if (directions.getStatus().code == G_GEO_BAD_KEY)
            alert("Internal error");

        else if (directions.getStatus().code == G_GEO_BAD_REQUEST)
            alert("Calculation not possible.");

        else alert("An unknown error occured.");
        
        showRoute('');
        document.getElementById('address').focus();
    }

