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 
var la = ge.createCamera('');
la.set(54.45108, -3.09393,3894.30434, ge.ALTITUDE_RELATIVE_TO_GROUND,-115.31187,45.27659,0);   
ge.getView().setAbstractView(la);        
ge.getOptions().setFlyToSpeed(.25); 
document.getElementById("inf").innerHTML="3D Map of Crinkle Crags.";

// *************************** 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/crinkle-crags.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.44587,  -3.09839,  186.68043, -121.83580, 73.56644,  0,'Start from the Old Dungeon Ghyll Hotel and follow farm track to Stool End.<br/><br/><form action="#" name="myform2"><input type="button" class="bt" value="next" onclick="fire2()"/></form>')} 
function fire2() {test(54.44338,  -3.11303,  354.82691, -134.04380, 60.94890,  0,'Continue through Farm Yard at Stool End and follow path alongside Oxendale Beck.<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.44181,  -3.12399,  336.09636, -161.83511, 71.29159,  0,'Cross Oxendale Beck and start the ascent to Red Tarn.<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.42716,  -3.12224,  672.69362, -91.04137,  50.97241,  0,'At Red Tarn take the path heading West.<br/><br/><form action="#" name="myform3"><input type="button" class="bt" value="next" onclick="fire5()"/><input type="button" class="bt" value="previous" onclick="fire3()"/></form>')}  // **
function fire5() {test(54.43185,  -3.15207,  648.10789, -116.71564, 29.97682,  0,'The first Crinkle.<br/><br/><form action="#" name="myform3"><input type="button" class="bt" value="next" onclick="fire6()"/><input type="button" class="bt" value="previous" onclick="fire4()"/></form>')}  
function fire6() {test(54.43382,  -3.15269,  647.62646, -81.16614,  41.67491,  0,'The second Crinkle is the main summit of Crinkle Crags.  There are a total of five summits altogether along the ridge (six if you include Shelter Crags).<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.44692,  -3.16142,  659.70379,  168.25846, 40.45948,  0,'The ridge then descends to Three Tarns where Crinkle Crags  ends.  <br/><br/><form action="#" name="myform3"><input type="button" class="bt" value="next" onclick="fire8()"/><input type="button" class="bt" value="previous" onclick="fire6()"/></form>')}  
function fire8() {test(54.44770,  -3.17010,  2037.55701, 110.78687, 34.81319,  0,'Take the path heading east, and descend to Great Langdale via the Band.  From Stool End retrace your steps to the Old Dungeon Ghyll.<br/><br/><form action="#" name="myform3"><input type="button" class="bt" value="Start Again?" onclick="fire1()"/><input type="button" class="bt" value="previous" onclick="fire7()"/></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 to Three Tarns. <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.<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.44766, -3.15880,  1052.02106,175.24382,  36.32684,  0,'The hause at the top of the Band is called Three Tarns (although the number of tarns varies according to how wet it has been).  Take the left path going south.  The ascent to Crinkle Crags begins here.<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.43452, -3.14648,  1195.09890,-87.09615,  36.02774,  0,'The ridge and summits of Crinkle Crags.<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.41760, -3.12436,  1323.92360,-50.62816,  50.72714,  0,'At the end of Crinkle Crags, continue along the path as it drops down towards Red Tarn<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.42280, -3.14553,  1219.02902,40.25165,  47.06654,  0,'Just before Red Tarn, take the north (left) path at the top of Browney Gill to descend down to Oxendale Beck and Great Langdale.<br/><br/><form action="#" name="myform3"><input type="button" class="bt" value="next" onclick="fire17()"/><input type="button" class="bt" value="previous" onclick="fire14()"/></form>')}  
function fire17() {test(54.43847, -3.12393,  1042.81299,57.81922,  43.47259,  0,'Continue through the farm yard at Stool End, and make your way back to the Old Dungeon Gill 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="fire15()"/></form>')}  



// from The Three Shires Stone
function fire20() {test(54.41428, -3.11533,   89.02650,  -26.89958,  29.17070,  0,'Route starts from the Three Shires Stone on the Wynose Pass.<br/><br/><form action="#" name="myform2"><input type="button" class="bt" value="next" onclick="fire21()"/></form>')} 
function fire21() {test(54.41135, -3.11949,  237.38376,  5.04704,  65.76901,  0,'Take the North West path leading up to Red Tarn.<br/><br/><form action="#" name="myform3"><input type="button" class="bt" value="next" onclick="fire22()"/><input type="button" class="bt" value="previous" onclick="fire20()"/></form>')}  
function fire22() {test(54.42537,  -3.12538,  475.79262, -93.66563,  44.68672,  0,'Just past Red Tarn, take the left hand path heading West.<br/><br/><form action="#" name="myform3"><input type="button" class="bt" value="next" onclick="fire23()"/><input type="button" class="bt" value="previous" onclick="fire21()"/></form>')}  // **
function fire23() {test(54.43185,  -3.15207,  648.10789, -116.71564, 29.97682,  0,'The first Crinkle.<br/><br/><form action="#" name="myform3"><input type="button" class="bt" value="next" onclick="fire24()"/><input type="button" class="bt" value="previous" onclick="fire22()"/></form>')}  
function fire24() {test(54.43382,  -3.15269,  647.62646, -81.16614,  41.67491,  0,'The second Crinkle is the main summit of Crinkle Crags.  There are a total of five summits altogether along the ridge (six if you include Shelter Crags).<br/><br/><form action="#" name="myform3"><input type="button" class="bt" value="next" onclick="fire25()"/><input type="button" class="bt" value="previous" onclick="fire23()"/></form>')}  
function fire25() {test(54.44692,  -3.16142,  659.70379,  168.25846, 40.45948,  0,'The ridge then descends to Three Tarns where it ends.  You then have the choice to continue north & ascend Bow Fell, or descending NE down The Band, or SW to Lincove Beck.<br/><br/><form action="#" name="myform3"><input type="button" class="bt" value="Start Again?" onclick="fire20()"/><input type="button" class="bt" value="previous" onclick="fire24()"/></form>')}  



// from Cockley Beck
function fire31() {test(54.40706,  -3.16825,  860.52886, -9.36073,   0.00000,  0,'Route starts at the bottom of Hardknott Pass, near Cockley Beck.  Begin by following the path towards Mosedale.<br/><br/><form action="#" name="myform2"><input type="button" class="bt" value="next" onclick="fire32()"/></form>')} 
function fire32() {test(54.41002,  -3.16804,  1119.75425,  89.63944, 15.60045,  0,'Turn right off the main Mosedale Path and cross stream.  Then follow wall on approach to the South Ridge.<br/><br/><form action="#" name="myform3"><input type="button" class="bt" value="next" onclick="fire33()"/><input type="button" class="bt" value="previous" onclick="fire31()"/></form>')}  
function fire33() {test(54.40399,  -3.15842,  326.61791,  5.94726, 74.09550,  0,'Start ascent of South Ridge.<br/><br/><form action="#" name="myform3"><input type="button" class="bt" value="next" onclick="fire34()"/><input type="button" class="bt" value="previous" onclick="fire32()"/></form>')}  
function fire34() {test(54.41651,  -3.15688,  284.52950,  11.34851, 62.99267,  0,'Follow ridge.<br/><br/><form action="#" name="myform3"><input type="button" class="bt" value="next" onclick="fire35()"/><input type="button" class="bt" value="previous" onclick="fire33()"/></form>')}  
function fire35() {test( 54.43022,  -3.15582, 693.20558, -56.15063,  0.00000,  0,'Route now joins with the main Crinkle Crags ridge just before the first summit. Follow ridge NW.<br/><br/><form action="#" name="myform3"><input type="button" class="bt" value="next" onclick="fire36()"/><input type="button" class="bt" value="previous" onclick="fire34()"/></form>')}  
function fire36() {test(54.43382,  -3.15269,  647.62646, -81.16614,  41.67491,  0,'The second Crinkle is the main summit of Crinkle Crags.  There are a total of five summits altogether along the ridge (six if you include Shelter Crags).<br/><br/><form action="#" name="myform3"><input type="button" class="bt" value="next" onclick="fire37()"/><input type="button" class="bt" value="previous" onclick="fire35()"/></form>')}  
function fire37() {test(54.44692,  -3.16142,  659.70379,  168.25846, 40.45948,  0,'The ridge then descends to Three Tarns where it ends.  <br/><br/><form action="#" name="myform3"><input type="button" class="bt" value="next" onclick="fire38()"/><input type="button" class="bt" value="previous" onclick="fire36()"/></form>')}  
function fire38() {test(54.44684,  -3.15559,  1132.08793, -129.18680, 41.39723,  0,'To return to Cockley Beck - descend south west to Lincove Beck, and take the left hand path (SE) back through Mosedale.<br/><br/><form action="#" name="myform3"><input type="button" class="bt" value="next" onclick="fire39()"/><input type="button" class="bt" value="previous" onclick="fire37()"/></form>')}  
function fire39() {test(54.43642,  -3.18621,  919.76296, 158.33828, 56.69436,  0,'Cross low pass into Mosedale.<br/><br/><form action="#" name="myform3"><input type="button" class="bt" value="next" onclick="fire40()"/><input type="button" class="bt" value="previous" onclick="fire38()"/></form>')}  
function fire40() {test(54.42124,  -3.17444,   1250.40705, 169.59785, 36.89648,  0,'Back to start at Cockley Beck.<br/><br/><form action="#" name="myform3"><input type="button" class="bt" value="Start Again?" onclick="fire31()"/><input type="button" class="bt" value="previous" onclick="fire39()"/></form>')}  


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.44766, -3.15880,  1052.02106,175.24382,  36.32684,  0,'Ascend the Crinkle Crags ridge, heading south.<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.43452, -3.14648,  1195.09890,-87.09615,  36.02774,  0,'The ridge and summits of Crinkle Crags.<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.43272, -3.16169,  868.20808,-149.20852,  4.50135,  0,'At the main summit of Crinkle Crags, leave the ridge and descend SW via Adam-a-Cove.<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.42289, -3.18342,  1572.52917,55.52380,  37.78726,  0,'Keep left of Swinsty Gill where it forms a ravine.  The route then drops down to the low pass between Mosedale and Eskdale.<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.42871, -3.18325,   877.32842,-73.17606,  1.80037,  0,'Make the short descent back to the path at Lincove Beck in Eskdale, and then retrace your steps south down the valley.<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.42685, -3.18183,  1187.09523,-137.07490,  49.79364,  0,'The path takes you back to Brotherilkeld where your route started.<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>')}  

	