var _G3dHyperlink = null;
function initializeGoogleEarth() {
    google.earth.createInstance('map3d', function (instance) {
      ge = instance;
      instance.getWindow().setVisibility(true);
      ge.getLayerRoot().enableLayerById(ge.LAYER_BUILDINGS, true);
      ge.getLayerRoot().enableLayerById(ge.LAYER_TERRAIN, true);
      ge.getNavigationControl().setVisibility(ge.VISIBILITY_AUTO);
      geZoom();
  });

  //Add hyperlink to open in new window
}

function geZoom() {
   // Update the view in Google Earth
   var lookAt = ge.getView().copyAsLookAt(ge.ALTITUDE_RELATIVE_TO_GROUND);
   lookAt.setLatitude(geLL.y ? geLL.y : map.extent.getCenter().y);
   lookAt.setLongitude(geLL.x ? geLL.x : map.extent.getCenter().x);


   lookAt.setRange(50);
   lookAt.setTilt(45);
   ge.getView().setAbstractView(lookAt);

}

var geLL;
function geReZoom(point) {
    geLL = esri.geometry.webMercatorToGeographic(point);

    try {
        // Update the view in Google Earth
        var lookAt = ge.getView().copyAsLookAt(ge.ALTITUDE_RELATIVE_TO_GROUND);

        lookAt.setLatitude(geLL.y ? geLL.y : map.extent.getCenter().y);
        lookAt.setLongitude(geLL.x ? geLL.x : map.extent.getCenter().x);
        lookAt.setRange(50);
        lookAt.setTilt(45);
        ge.getView().setAbstractView(lookAt);


    } catch (e) {

    }
}
/////////////////////////////////////////////////////////////////////////////////////

