﻿
function load() 
{
  if (GBrowserIsCompatible()) 
  {
    mapdiv = document.getElementById("map"); 
    map = new GMap2(mapdiv);
    map.addMapType(G_SATELLITE_3D_MAP);    
    map.setCenter(new GLatLng(0, 0), 1, G_SATELLITE_3D_MAP);
    
  //  GEvent.addDomListener(mapdiv, "DOMMouseScroll", map.wheelZoom); // Firefox 
  //  GEvent.addDomListener(mapdiv, "mousewheel", map.wheelZoom); // IE 

    map.getEarthInstance(getEarthInstanceCB);
  }
}

function getEarthInstanceCB(object) 
{
  gEarth = object;
  if (gEarth != null)
  {
    //gEarth.getOptions().setFlyToSpeed(1);
    gEarth.getOptions().setMapType(gEarth.MAP_TYPE_SKY);
    var opt = gEarth.getOptions();
    opt.setStatusBarVisibility(true);
    
    //var lookAt = gEarth.getView().copyAsLookAt(gEarth.ALTITUDE_RELATIVE_TO_GROUND); 
    //lookAt.set(41.28509187215, -169.2448684551622, 0, gEarth.ALTITUDE_RELATIVE_TO_GROUND, 262.87, 0, 162401);
    
    //lookAt.setTilt(45); 
    //setTimeout(function() { gEarth.getView().setAbstractView(lookAt)}, 100); 
    
setTimeout(function() {
    var oldFlyToSpeed = gEarth.getOptions().getFlyToSpeed();
    gEarth.getOptions().setFlyToSpeed(.2); 
    var lookAt = gEarth.getView().copyAsLookAt(gEarth.ALTITUDE_RELATIVE_TO_GROUND);
    lookAt.set(41.28509187215, -169.2448684551622, 0, 
               gEarth.ALTITUDE_RELATIVE_TO_GROUND, 262.87, 0, 162401);
    gEarth.getView().setAbstractView(lookAt);
    gEarth.getOptions().setFlyToSpeed(oldFlyToSpeed);
  }, 1000);      

  }
}

function pageLoad()
{
  load();
}   
    
function pageUnload()
{
  GUnload();
}

if (typeof(Sys) !== "undefined") Sys.Application.notifyScriptLoaded();


