google.load("earth", "1");
var ge = null;
var b;
var x;
var z;


function init() {
  google.earth.createInstance("map3d", initCallback, failureCallback);
}

function initCallback(object) {
  ge = object;
  ge.getWindow().setVisibility(true);
  var options = ge.getOptions();
  setOptions();
  geW()
}

function failureCallback(object) {
}

function setOptions(){
 options = ge.getOptions();
 options.setFlyToSpeed(0.15);
 options.setStatusBarVisibility(true);
 ge.getNavigationControl().setVisibility(ge.VISIBILITY_SHOW);
 ge.getLayerRoot().enableLayerById(ge.LAYER_BUILDINGS, false);
 ge.getLayerRoot().enableLayerById(ge.LAYER_BORDERS, true);
 ge.getLayerRoot().enableLayerById(ge.LAYER_TERRAIN, true);
 ge.getLayerRoot().enableLayerById(ge.LAYER_ROADS, true);
}

function geW(){
  var kml = "http://www.raumbezug.eu/downloads/google_earth/osm1stunde.kml";
  x = 10;
  y = 50;
  z = 6000000;


 google.earth.fetchKml(ge, kml, finished);

}


function finished(object) {
  if (!object) {
    alert('bad or NULL kml');
    return;
  }
  ge.getFeatures().appendChild(object);
  var la = ge.createLookAt('');
  la.set(y, x, z, ge.ALTITUDE_RELATIVE_TO_GROUND,0, 0, 500);
  ge.getView().setAbstractView(la);
}
