
    var ge;
    
    google.load("earth", "1");
    
    function init() {
      google.earth.createInstance('map3d', initCallback, failureCallback);
    }
    
    function initCallback(instance) {
      ge = instance;
      ge.getWindow().setVisibility(true);
    
      // add a navigation control
      ge.getNavigationControl().setVisibility(ge.VISIBILITY_AUTO);
    
      // add some layers
      ge.getLayerRoot().enableLayerById(ge.LAYER_BORDERS, true);
      ge.getLayerRoot().enableLayerById(ge.LAYER_ROADS, true);
    
      // in this sample we will attempt
      // to fetch a  KML file and show it
    
      function finished(object) {
        if (!object) {
          // wrap alerts in API callbacks and event handlers
          // in a setTimeout to prevent deadlock in some browsers
          setTimeout(function() {
            alert('Bad or null KML.');
          }, 0);
          return;
        }
        ge.getFeatures().appendChild(object);
        var la = ge.createLookAt('');
            la.set(-0.3218,31.7560, 5, ge.ALTITUDE_RELATIVE_TO_GROUND,
                   0, 80, 12);
        ge.getView().setAbstractView(la);
      }
    
      // fetch the KML
      var url = 'http://sketchup.google.com/' +
                '3dwarehouse/download?mid=bb2508f6f23c61d7c63580399839b2c&rtyp=ks&fn=boys+home+3DWarehouse&ctyp=other&prevstart=0&ts=1268391240000';
      google.earth.fetchKml(ge, url, finished);
    
      document.getElementById('installed-plugin-version').innerHTML =
        ge.getPluginVersion().toString();
    }
    
    function failureCallback(errorCode) {
    }
    
