﻿var currentLink =  null
var _initialLoad = new Object();

function initialLoad(name,description,id,zoomTo,href)
{
      _initialLoad.name = name;
      _initialLoad.desctiption = description;
      _initialLoad.id = id;
      _initialLoad.zoomTo = zoomTo;
      _initialLoad.href = href;
      _dataLoader = true;      
}


function appView(e){
      e.blur(); 
      moveGE(38.5,-98.6,15000, 0, 0, 3800000, .2)      
      return false;
}

function NetWorkLink(name,description,id,zoomTo,href)
{
      var networkLink = ge.createNetworkLink(id);
      networkLink.setDescription(description);
      networkLink.setName(name);
      networkLink.setFlyToView(zoomTo);  
      var link = ge.createLink("");
      link.setHref(href);
      networkLink.setLink(link);            
      ge.getFeatures().appendChild(networkLink);
}

function NetWorkLinkGroup(name,description,id,zoomTo,href)
{
      if (currentLink == null)
      {
             var networkLink = ge.createNetworkLink(id);
            networkLink.setDescription(description);
            networkLink.setName(name);
            networkLink.setFlyToView(zoomTo);  
            var link = ge.createLink("");
            link.setHref(href);
            networkLink.setLink(link);            
            ge.getFeatures().appendChild(networkLink);
           //alert('loaded');
            currentLink = networkLink;
      }
      else
      {
            currentLink.setDescription(description);
            currentLink.setName(name);
            currentLink.setFlyToView(zoomTo);
            var link = ge.createLink("");
            link.setHref(href);
            currentLink.setLink(link);     
      }

}

function showView()
{

      var la = ge.getView().copyAsLookAt(ge.ALTITUDE_RELATIVE_TO_GROUND); 
      var lat = la.getLatitude();
      var lng = la.getLongitude();
      var alt = la.getRange();
      var tilt = la.getTilt();
      var range = la.getRange();
      
      // open the window 
      win3 = window.open("", "Window3", "width=320,height=210,scrollbars=yes,screenX=600,screenY=600");
     

      // write to window
      var msg = "<h4>Current Google Earth View</h4><br/><hr/>" +
                        "Latitude: " + lat + "<br/>" +  "Longitude : " + lng + "<br/>Tilt: " + tilt + "<br/>Range: " + range;
      win3.document.writeln(msg); 
}