function init() {  
google.earth.createInstance("map3d", initCallback, failureCallback);
}
function initCallback(object) {  
ge = object;  ge.getWindow().setVisibility(true);

var oldFlyToSpeed = ge.getOptions().getFlyToSpeed();
//ge.getOptions().setFlyToSpeed(ge.SPEED_TELEPORT); 

// Initial view of Bow Fell
var la = ge.createCamera('');
la.set(54.45626, -3.13792,1870.79704, ge.ALTITUDE_RELATIVE_TO_GROUND,-111.29766,45.89512,0);   
ge.getView().setAbstractView(la);        
ge.getOptions().setFlyToSpeed(.25); 
document.getElementById("inf").innerHTML="3D Map of Bowfell.";

// *************************** Network Link **************************************************
var networkLink = ge.createNetworkLink("");
networkLink.setDescription("NetworkLink open to fetched content");
networkLink.setName("Open NetworkLink");
networkLink.setFlyToView(false);  

// create a Link object
var link = ge.createLink("");
link.setHref("http://english-lake-district.info" +
             "/southern-fells/bowfell.kml");

// attach the Link to the NetworkLink
networkLink.setLink(link);

// add the NetworkLink feature to Earth
ge.getFeatures().appendChild(networkLink);

// *************************** end **************************************************

var navControl = ge.getNavigationControl();
navControl.setVisibility(ge.VISIBILITY_SHOW);

}
//***********************************************************************************

function failureCallback(object) {
}

//************************************************************************************
//************************ hide navigation control ***********************************
function navigationc(){
var navControl = ge.getNavigationControl();
navControl.setVisibility(ge.VISIBILITY_HIDE);
}
//************************************************************************************
//************************* display new views and text *******************************
function test(x,y,ht,hd,an,ds,tx){
 var la = ge.createLookAt('');
la.set(x, y,ht, ge.ALTITUDE_RELATIVE_TO_GROUND, 
     hd,an, ds);
          document.getElementById("inf").innerHTML=tx;
ge.getView().setAbstractView(la);       
}
//************************************************************************************

function vCapture()
{
    var la=ge.getView().copyAsCamera(ge.ALTITUDE_RELATIVE_TO_GROUND)
	var tilt=la.getTilt();
	var lat=la.getLatitude(); 
	var lon=la.getLongitude();
	var al=la.getAltitude();
	var head=la.getHeading()
	//var range=la.getRange()
	var text="Latitude: " + lat.toFixed(5) +  '\n' + "Longitude: " + lon.toFixed(5) + '\n' + "Altitude: "+ al.toFixed(5) + '\n' + "Heading: " + head.toFixed(5) + '\n' + "Tilt: " + tilt.toFixed(5) 
	alert(text)
}
// from via Browney Gill
function fire1() {test(54.44405,  -3.10232,  326.02425, -29.58899, 30.96487,  0,'Route starts from the Old Dungeon Ghyll Hotel.  Take the path heading towards Mickleden (West).<br/><br/><form action="#" name="myform2"><input type="button" class="bt" value="next" onclick="fire2()"/></form>')} 
function fire2() {test(54.44045,  -3.10241,  424.96460, -51.40779, 71.45047,  0,'Continue through Mickleden towards the Rossett Pass.<br/><br/><form action="#" name="myform3"><input type="button" class="bt" value="next" onclick="fire3()"/><input type="button" class="bt" value="previous" onclick="fire1()"/></form>')}  
function fire3() {test(54.45433,  -3.14031,  1992.73195,-79.77089, 27.04781,  0,'Ascend the Rossett Pass.<br/><br/><form action="#" name="myform3"><input type="button" class="bt" value="next" onclick="fire4()"/><input type="button" class="bt" value="previous" onclick="fire2()"/></form>')}  
function fire4() {test(54.45332,  -3.15388,   1243.49928, -116.68192,34.24881,  0,'Half way up you have the option of turning off the path and scrambling up this route to the summit.  It is rough and steep.<br/><br/><form action="#" name="myform3"><input type="button" class="bt" value="next" onclick="fire400()"/><input type="button" class="bt" value="previous" onclick="fire3()"/></form>')}  // **
function fire400() {test(54.45401,  -3.15905, 375.41328, -23.53613,44.70204,  0,'Otherwise continue to the top of the Rossett Pass.<br/><br/><form action="#" name="myform3"><input type="button" class="bt" value="next" onclick="fire5()"/><input type="button" class="bt" value="previous" onclick="fire4()"/></form>')}  // **
function fire5() {test(54.46308,  -3.16738,  212.32251, -168.89293, 73.79760,  0,'Turn off the main path after Angle Tarn and make the steep ascent to Ore Gap.<br/><br/><form action="#" name="myform3"><input type="button" class="bt" value="next" onclick="fire6()"/><input type="button" class="bt" value="previous" onclick="fire400()"/></form>')}  
function fire6() {test(54.45690,  -3.17429,  533.07493, 150.60146,  49.19737,  0,'Turn left at Ore Gap and ascend to the summit of Bowfell.<br/><br/><form action="#" name="myform3"><input type="button" class="bt" value="next" onclick="fire7()"/><input type="button" class="bt" value="previous" onclick="fire5()"/></form>')}  
function fire7() {test(54.45006,  -3.17058,  533.07936,  129.90447, 43.79953,  0,'Bowfell summit.<br/><br/><form action="#" name="myform3"><input type="button" class="bt" value="next" onclick="fire800()"/><input type="button" class="bt" value="previous" onclick="fire6()"/></form>')}  
function fire800() {test(54.44603,-3.16442,  692.83687, 65.55947, 6.79965,  0,'Head South East to descend from the summit.<br/><br/><form action="#" name="myform3"><input type="button" class="bt" value="next" onclick="fire8()"/><input type="button" class="bt" value="previous" onclick="fire7()"/></form>')}  
function fire8() {test(54.44318,  -3.15605,  212.72778, -52.33371, 69.49670,  0,'At Three Tarns take the path heading East and descend The Band.<br/><br/><form action="#" name="myform3"><input type="button" class="bt" value="next" onclick="fire850()"/><input type="button" class="bt" value="previous" onclick="fire800()"/></form>')}  
function fire850() {test(54.44443,-3.16070,  114.38744, 82.96629, 55.50729,  0,'The Band.<br/><br/><form action="#" name="myform3"><input type="button" class="bt" value="next" onclick="fire9()"/><input type="button" class="bt" value="previous" onclick="fire8()"/></form>')}  
function fire9() {test(54.44557,  -3.14731,  2374.04608, 99.32341, 28.38733,  0,'At the bottom of The Band turn left and head through the farm yard at Stool End.  Take the farm track back towards the Old Dungeon Ghyll Hotel.<br/><br/><form action="#" name="myform3"><input type="button" class="bt" value="Start Again?" onclick="fire1()"/><input type="button" class="bt" value="previous" onclick="fire850()"/></form>')}  

//via The Band
function fire10() {test(54.44587, -3.09839,  186.68043, -121.83580, 73.56644,  0,'Start from the Old Dungeon Ghyll Hotel. Follow farm track to Stool End.<br/><br/><form action="#" name="myform2"><input type="button" class="bt" value="next" onclick="fire11()"/></form>')} 
function fire11() {test(54.43935, -3.11206,  282.84428, -69.97014,  72.90338,  0,'Pass through the farm yard at Stool End.   After walking a short distance you see a path on your right.  Take this path to ascend The Band.<br/><br/><form action="#" name="myform3"><input type="button" class="bt" value="next" onclick="fire12()"/><input type="button" class="bt" value="previous" onclick="fire10()"/></form>')}  
function fire12() {test(54.44045, -3.12105,  1076.17063,-73.79805,  57.19394,  0,'The Band. Take the right hand branch in the path where The Band becomes a grassy plateau.<br/><br/><form action="#" name="myform3"><input type="button" class="bt" value="next" onclick="fire13()"/><input type="button" class="bt" value="previous" onclick="fire11()"/></form>')}  
function fire13() {test(54.44844, -3.15587,  344.43854,-104.42638,  54.19848,  0,'This section of the route is called the Climbers Traverse.  It is the route Julia Bradbury took on the Bow Fell section of the Wainwright Walks TV Series.<br/><br/><form action="#" name="myform3"><input type="button" class="bt" value="next" onclick="fire14()"/><input type="button" class="bt" value="previous" onclick="fire12()"/></form>')}  
function fire14() {test(54.44962, -3.16299,  258.63685,172.72711,  33.73396,  0,'The route turns off the Climbers Traverse at the Great Slab.  Follow the band of boulders between The Great Slab and Cambridge Crag.<br/><br/><form action="#" name="myform3"><input type="button" class="bt" value="next" onclick="fire15()"/><input type="button" class="bt" value="previous" onclick="fire13()"/></form>')}  
function fire15() {test(54.44732, -3.16316,  299.41814,-81.97303,  26.23382,  0,'Make your way up to the summit of Bowfell.<br/><br/><form action="#" name="myform3"><input type="button" class="bt" value="next" onclick="fire16()"/><input type="button" class="bt" value="previous" onclick="fire14()"/></form>')}  
function fire16() {test(54.45439, -3.17055,  922.11862,69.22096,  5.83452,  0,'Take the path down to Ore Gap and turn right to make the steep descent to Angle Tarn and the top of the Rossett Pass.<br/><br/><form action="#" name="myform3"><input type="button" class="bt" value="next" onclick="fire17()"/><input type="button" class="bt" value="previous" onclick="fire15()"/></form>')}  
function fire17() {test(54.45711, -3.16075,  1324.42750,102.97892,  8.83014,  0,'Descend the Rossett Pass to Mickleden.<br/><br/><form action="#" name="myform3"><input type="button" class="bt" value="next" onclick="fire18()"/><input type="button" class="bt" value="previous" onclick="fire16()"/></form>')}  
function fire18() {test(54.45110, -3.13883,  2114.31532,104.34676,  36.71910,  0,'Take the Mickleden path back to the Old Dungeon Ghyll Hotel.<br/><br/><form action="#" name="myform3"><input type="button" class="bt" value="Start Again?" onclick="fire10()"/><input type="button" class="bt" value="previous" onclick="fire17()"/></form>')}  

// Eskdale route
function fire41() {test(54.40326, -3.21437,  1471.22440,14.90177, 0.00000,  0,'Start route from Brotherilkeld at the bottom of the Hardknott Pass (Eskdale).<br/><br/><form action="#" name="myform2"><input type="button" class="bt" value="next" onclick="fire42()"/></form>')} 
function fire42() {test(54.40953, -3.20551,  97.15925, 36.90720,  75.29286,  0,'Follow path up through the valley.  The River Esk is on your left. Hardknott (the fell) is on your right.<br/><br/><form action="#" name="myform3"><input type="button" class="bt" value="next" onclick="fire43()"/><input type="button" class="bt" value="previous" onclick="fire41()"/></form>')}  
function fire43() {test(54.42041, -3.19362,  110.41042,31.51687,  62.99039,  0,'Continue along path past Lincove Bridge. Here the river Esk branches off to the left(NW), but your path follows Lincove Beck, heading NE.  Remain on the eastern bank of this stream.<br/><br/><form action="#" name="myform3"><input type="button" class="bt" value="next" onclick="fire44()"/><input type="button" class="bt" value="previous" onclick="fire42()"/></form>')}  
function fire44() {test(54.42448, -3.18521,  311.05326,29.07403,  71.59031,  0,'Follow the bend in the river as it heads north. The western side of Crinkle Crags is now on your right.  The route then starts to branch right, away from the stream.   You now begin the climb up to Three Tarns on the north side of Crinkle Crags. <br/><br/><form action="#" name="myform3"><input type="button" class="bt" value="next" onclick="fire45()"/><input type="button" class="bt" value="previous" onclick="fire43()"/></form>')}  
function fire45() {test(54.43598, -3.18346,  222.32745,64.17750,  74.30139,  0,'Ascend to Three Tarns.  Three Tarns is located in the hause between Crinkle Crags and Bowfell.<br/><form action="#" name="myform3"><input type="button" class="bt" value="next" onclick="fire46()"/><input type="button" class="bt" value="previous" onclick="fire44()"/></form>')}  
function fire46() {test(54.44178, -3.15998,  141.19111,-19.95340, 71.60159,  0,'Turn left at Three Tarns and ascend Bowfell.<br/><br/><form action="#" name="myform3"><input type="button" class="bt" value="next" onclick="fire47()"/><input type="button" class="bt" value="previous" onclick="fire45()"/></form>')}  
function fire47() {test(54.44396, -3.16350,  549.78916,-21.75626, 48.20121,  0,'Bowfell summit.<br/><form action="#" name="myform3"><input type="button" class="bt" value="next" onclick="fire48()"/><input type="button" class="bt" value="previous" onclick="fire46()"/></form>')}  
function fire48() {test( 54.45655,-3.17256,  921.23472,-145.51363,28.69958,  0,'Follow the path down to the depression at Ore Gap.  Continue as the path rises on the way to Esk Pike.  Turn off the path and head south east.  Your descent is via the Esk Pike South Ridge.<br/><br/><form action="#" name="myform3"><input type="button" class="bt" value="next" onclick="fire49()"/><input type="button" class="bt" value="previous" onclick="fire47()"/></form>')}  
function fire49() {test(54.45087, -3.17365,  367.91979,-134.54738,52.49760,  0,'Section of descent at Yestyrigg Crags.<br/><br/><form action="#" name="myform3"><input type="button" class="bt" value="next" onclick="fire50()"/><input type="button" class="bt" value="previous" onclick="fire48()"/></form>')}  
function fire50() {test(54.43328, -3.18116,  1430.13706,-130.95348,23.69878,  0,'Cross back over stream at Lincove Bridge.<br/><br/><form action="#" name="myform3"><input type="button" class="bt" value="next" onclick="fire51()"/><input type="button" class="bt" value="previous" onclick="fire49()"/></form>')}  
function fire51() {test(54.41539, -3.19529,  1161.35862,-137.08584,49.79884,  0,'The path takes you back to Brotherilkeld where your route began.<br/><br/><form action="#" name="myform3"><input type="button" class="bt" value="Start Again?" onclick="fire41()"/><input type="button" class="bt" value="previous" onclick="fire50()"/></form>')}  

	