var northNormal='<li><a class="intLnk" onclick=roFunc("north")>+ North Windermere</a></li>' 
var northActive='<li><a class="intLnk" onclick=roFunc("defaultRows")>- North Windermere</a></li>' +
                '<ul class="listType2">' +
				    '<li><a class="intLnk" onclick=flyToLocation("waterHead")>Waterhead</a></li>' +
					'<li><a class="intLnk" onclick=flyToLocation("wansfell")>Wansfell</a></li>' +
					'<li><a class="intLnk" onclick=flyToLocation("wrayCastle")>Wray Castle</a></li>' +
					'<li><a class="intLnk" onclick=flyToLocation("brockhole")>Brockhole</a></li>' +							
				'</ul>';
				
var midNormal='<li><a class="intLnk" onclick=roFunc("mid")>+ Mid Windermere</a></li>' 
var midActive='<li><a class="intLnk" onclick=roFunc("defaultRows")>- Mid Windermere</a></li>' +
                '<ul class="listType2">' +
				    '<li><a class="intLnk" onclick=flyToLocation("windermereTown")>Windermere Town</a></li>' +
					'<li><a class="intLnk" onclick=flyToLocation("bowness")>Bowness on Windermere</a></li>' +
					'<li><a class="intLnk" onclick=flyToLocation("latterbarrow")>Latterbarrow</a></li>' +
					'<li><a class="intLnk" onclick=flyToLocation("claifeHeights")>Claife Heights</a></li>' +
					'<li><a class="intLnk" onclick=flyToLocation("farSawrey")>Far Sawrey</a></li>' +
					'<li><a class="intLnk" onclick=flyToLocation("orrestHead")>Orrest Head</a></li>' +
				    '</ul>';
				
var southNormal='<li><a class="intLnk" onclick=roFunc("south")>+ South Windermere</a></li>' 				 
var southActive='<li><a class="intLnk" onclick=roFunc("defaultRows")>- South Windermere</a></li>' +
                '<ul class="listType2">' +
				    '<li><a class="intLnk" onclick=flyToLocation("graythwaite")>Graythwaite Hall</a></li>' +
					'<li><a class="intLnk" onclick=flyToLocation("bobbinMill")>Stott Park Bobbin Mill</a></li>' +
					'<li><a class="intLnk" onclick=flyToLocation("lakeside")>Lakeside</a></li>' +
					'<li><a class="intLnk" onclick=flyToLocation("gummersHow")>Gummers How</a></li>' +
														
				'</ul>';
				
	
	var pan;
        var wiki; 
	var myLayer;
        var myWikiLayer;
        var map;
        var map_type;
        var osMap;
        var x;
        var y;
        var z;
        

var placemark=new Array();
var fname= new Array();
var vname=new Array();
var tname=new Array();
var latCo= new Array();
var lonCo= new Array();
var descr= new Array();
var loopCount;

        function load() 
	{	
	        buildList(0)
	        document.getElementById("map-container").innerHTML="<div id='map' style='width: 800px; height: 600px; border: 1px solid #213e00;'></div>";
		map_type="googleMap"
                document.form1.map_view[0].checked=true
                document.form1.panPhotos.checked=false
                document.form1.wiki.checked=false
                document.form1.points_of_interest.checked=false
		map = new GMap2(document.getElementById("map"));	   
                map.setCenter(new GLatLng(54.3685, -2.9199), 12);		
		map.setMapType(G_HYBRID_MAP);
		map.setUIToDefault();
                //tx='Lake Windermere'
                //tx=tx+'<br/><a class="intLnk" onclick="">See view in 3d</a>' 
                //document.getElementById("inf").innerHTML=tx;
        }

           
// Google Earth *********************************************************************	
               
function GoogleEarth() 
{
    document.form1.panPhotos.checked=false
    document.form1.wiki.checked=false
    document.form1.points_of_interest.checked=false
    map_type="googleEarth"; 
    buildList(0)
    document.getElementById("map-container").innerHTML="<div id='map3d' style='width: 800px; height: 600px; border: 1px solid #213e00;'></div>";
    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); 
    var la = ge.createCamera('');
    la.set(54.27566, -2.89642, 6000.58671, ge.ALTITUDE_RELATIVE_TO_GROUND,-26.68446,48.52598,0);   
    ge.getView().setAbstractView(la);        
    ge.getOptions().setFlyToSpeed(.25); 
    var navControl = ge.getNavigationControl();
    navControl.setVisibility(ge.VISIBILITY_SHOW);
}

function failureCallback(object) {}      	

// **********************************************************************************	
	
	function photographs()			
    {
        if (map_type=="googleMap")
        {
	    pan= document.form1.panPhotos.checked;
		
		if (pan==true)
		{
	            myLayer = new GLayer("com.panoramio.all");
    		    map.addOverlay(myLayer);
		}
		else
		{
		map.removeOverlay(myLayer);
		}
         }
         else
         {
         alert("Sorry, the Panaramio layer is just intended for the Google Map. \n However, you can view the Points of Interest Layer OR you can select the Google Map using the radio button in the left side bar.")
         document.form1.panPhotos.checked=false
         }
    }

        function wikipedia()			
    {

        if (map_type=="googleMap")
        {

	        wiki= document.form1.wiki.checked;
		
		if (wiki==true)
		{
	            var myWikiLayer = new GLayer("org.wikipedia.en");
    		    map.addOverlay(myWikiLayer);
		}
		else
		{                
		var location=map.getCenter();
		var cLat = location.lat();
                var cLon = location.lng();
		var zoom=map.getZoom();
                document.getElementById("map-container").innerHTML="<div id='map' style='width: 800px; height: 600px; border: 1px solid #213e00;'></div>";
		map_type="googleMap"
                document.form1.map_view[0].checked=true
                document.form1.panPhotos.checked=false
                document.form1.wiki.checked=false
                document.form1.points_of_interest.checked=false
		map = new GMap2(document.getElementById("map"));	   
                map.setCenter(new GLatLng(cLat, cLon), zoom);		
		map.setMapType(G_HYBRID_MAP);
		map.setUIToDefault();
		}
          }
         else
         {
         alert("Sorry, the Wikipedia layer is just intended for the Google Map.\n However, you can view the Points of Interest Layer OR you can select the Google Map using the radio button in the left side bar.")
         document.form1.wiki.checked=false
         }

    }
	
	
	
	function poi()
	{
	    var points_box= document.form1.points_of_interest.checked;
            if (points_box==true)
            {
	        pLab1();
            }
	    else
	    {
                 switch (map_type)
                 {
                      case "googleMap":
                              delete_Gmarkers();
                              break;
                      case "googleEarth":
                              delete_placemarks();
                              break;
                      case "ordnanceSurvey":
                              delete_osMarkers();
                              break;
                      default:
                              break;
                 }
	    }
		
	}

	function sZoom()
        {
        var location=map.getCenter();
	var cLat = location.lat();
        var cLon = location.lng();
	var zoom=map.getZoom();
        osMap.setCenter(new OpenSpace.MapPoint(cLon, cLat), 2);
        }


	function myLocation()
	{
	    switch (map_type)
            {
                case "ordnanceSurvey":
                    alert("get os center");
                    osLocation();
                    break;
                case "googleMap":
	            var location=map.getCenter();
		    var cLat = location.lat();
                    var cLon = location.lng();
		    var zoom=map.getZoom();	
		    alert("center: " + location + " \n Zoom: " + zoom + "\n Lat: " + cLat + "\n Lon: " + cLon);
                    break;
                default:
                    break;
            }
	}

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)
  
//document.getElementById("inf").innerHTML=text;
}	
	function hybrid()
	{
                    if (map_type=="ordnanceSurvey")
                    {
                        document.getElementById("map-container").innerHTML="<div id='map' style='width: 800px; height: 600px; border: 1px solid #213e00;'></div>";
                        load();
                    }
                    else
                    { 
                        alert("testing else condition")
		        map.addMapType(G_HYBRID_MAP);
		        map.setMapType(G_HYBRID_MAP);	
	    	        map.removeMapType(G_SATELLITE_3D_MAP);
                    }
	}
		
    function earthCamera(x,y,ht,hd,an,ds,tx){
 			var la = ge.createCamera('');
			la.set(x, y,ht, ge.ALTITUDE_RELATIVE_TO_GROUND,hd,an,ds);
          	document.getElementById("inf").innerHTML=tx;
			ge.getView().setAbstractView(la);       
	}	

 
       function init()
       {
           document.form1.panPhotos.checked=false
           document.form1.wiki.checked=false
           document.form1.points_of_interest.checked=false
           map_type="ordnanceSurvey";
	   buildList(0);
           document.getElementById("map-container").innerHTML="<div id='map1' style='width: 800px; height: 600px; border: 1px solid #213e00;'></div>";
           var options = {resolutions: [50, 25, 10, 5]}
           osMap = new OpenSpace.Map('map1', options);
		  
           osMap.setCenter(new OpenSpace.MapPoint(340332, 497389), 0);
  
           
  		   
       } 

       function qMapType()
       {
            alert(map_type);
       }
function mapView(x, y, z, tx)
{        
           map.setCenter(new GLatLng(x, y), z);            
           document.getElementById("inf").innerHTML=tx;  
}

function osLocation()
{
    a=osMap.getCenter();
    alert(a);

    var gridProjection = new OpenSpace.GridProjection();
    
        
    var pos = gridProjection.getLonLatFromMapPoint(a);
    alert(pos)
}

function osView1(x,y,z,tx)
{
        var gridProjection = new OpenSpace.GridProjection();
        var lonlat = new OpenLayers.LonLat(y,x);
        var pos = gridProjection.getMapPointFromLonLat(lonlat);
        var a=pos.getEasting();
        var b=pos.getNorthing();

        

        osMap.setCenter(new OpenSpace.MapPoint(a,b), z);
        document.getElementById("inf").innerHTML=tx;
        
}

function osView(x, y, z, tx)
{        
           osMap.setCenter(new OpenSpace.MapPoint(x, y), z);
           document.getElementById("inf").innerHTML=tx;  
}
//************************************************************************************


function roFunc(features){
    switch (features){
	    case "north":
		    listCode=1;
                    var flyToStr="northWindermere";
	            break;
		case "mid":
                     var flyToStr="midWindermere";
		     listCode=2;
		     break;
		case "south":
		    listCode=3;
                    flyToStr="southWindermere";
		    break;
                case "defaultRows":
                        var flyToStr="defaultView";
                        listCode=0;
                        break;
		default:                                               
                        break;
	}
	buildList(listCode);
	flyToLocation(flyToStr);
}

function buildList(listCode){
    switch (listCode){
	    case 1:
	        var listBuild=northActive + midNormal + southNormal;			
			break;
		case 2:
		    var listBuild=northNormal + midActive + southNormal;
			break;
		case 3:
		    var listBuild=northNormal + midNormal + southActive;
			break;
		default:
		    var listBuild='<div class="cap-text"><b>Map Navigation</b></div>' + northNormal + midNormal + southNormal;
	}
        document.getElementById("listShell").innerHTML = listBuild;	       
}

function flyToLocation(locationKey)
{
    
	switch (locationKey)
        {
	    case "defaultView":
			switch (map_type)
                        {
			case "googleMap":
				 mapView(54.3685, -2.9199, 12,  'Lake Windermere');
				 break;
			case "googleEarth":
				 earthCamera( 54.27566, -2.89642, 6000.58671, -26.68446,48.52598,0, 'Lake Windermere');
				 break;
			case "ordnanceSurvey":
				 osView1(54.3685, -2.9199, 0,  'Lake Windermere');
				 break;
                        }			 
			break;

            case "midWindermere":
			switch (map_type)
                        {
			case "googleMap":
				 mapView(54.36287777715071, -2.9277569585226955, 13,  'Middle Section of Windermere');
				 break;
			case "googleEarth":
				 earthCamera( 54.35432, -2.93675, 277.90185,  0.75153,68.90922,0, 'Middle Section of Windermere');
				 break;
			case "ordnanceSurvey":
				 osView1(54.36287777715071, -2.9277569585226955, 2,  'Middle Section of Windermere');
				 break;
                        }			 
			break;

               
            case "southWindermere":
			switch (map_type){
			case "googleMap":
				 mapView(54.30231815340957, -2.9488308702549855, 13,  'The South section of Windermere');
				 break;
			case "googleEarth":
				 earthCamera( 54.27217, -2.95688, 262.40985,  13.64178, 68.67375,0, 'The South section of Windermere');
				 break;
			case "ordnanceSurvey":
				 osView1(54.30231815340957, -2.9488308702549855, 2,  'The South section of Windermere');
				 break;
                        }			 
			break;

            case "northWindermere":
			switch (map_type){
			case "googleMap":
				 mapView(54.40619105028771, -2.951486020578758, 13,  'The North section of Lake Windermere');
				 break;
			case "googleEarth":
				 earthCamera( 54.37743, -2.96080, 1665.0,  11.06209, 57.51318,0, 'The North section of Lake Windermere');
				 break;
			case "ordnanceSurvey":
				 osView1(54.40619105028771, -2.951486020578758, 2,  'The North section of Lake Windermere');
				 break;
                        }			 
			break;
            
             case "waterHead":
			switch (map_type){
			case "googleMap":
				 mapView(54.42109, -2.96306, 15,  'Waterhead');
				 break;
			case "googleEarth":
				 earthCamera( 54.41730, -2.96849, 661.21511,  55.92728, 32.97303,0, 'Waterhead');
				 break;
			case "ordnanceSurvey":
				 osView1(54.42109, -2.96306, 3,  'Waterhead');
				 break;
                        }			 
			break;

            case "wansfell":
			switch (map_type){
			case "googleMap":
				 mapView(54.42929, -2.93576, 15,  'Wansfell');
				 break;
			case "googleEarth":
				 earthCamera( 54.44878, -2.92723, 1185.33048,  -163.63413, 68.04931,0, 'Wansfell');
				 break;
			case "ordnanceSurvey":
				 osView1(54.42929, -2.93576, 3,  'Wansfell');
				 break;
                        }			 
			break;

            case "wrayCastle":
			switch (map_type){
			case "googleMap":
				 mapView(54.40100, -2.96438, 15,  'Wray Castle');
				 break;
			case "googleEarth":
				 earthCamera(54.40370, -2.96025, 743.12032, -135.65848, 24.48635, 0, 'Wray Castle');
				 break;
			case "ordnanceSurvey":
				 osView1(54.40100, -2.96438, 3,  'Wray Castle');
				 break;
                        }			 
			break;

            case "brockhole":
			switch (map_type){
			case "googleMap":
				 mapView(54.40094, -2.94142, 15,  'Brockhole National Park Centre');
				 break;
			case "googleEarth":
				 earthCamera( 54.40086, -2.94747, 595.98922,  117.70137, 24.78700,0, 'Brockhole National Park Centre');
				 break;
			case "ordnanceSurvey":
				 osView1(54.40094, -2.94142, 3,  'Brockhole National Park Centre');
				 break;
                        }			 
			break;
           
            case "windermereTown":
			switch (map_type){
			case "googleMap":
				 mapView(54.38079, -2.90693, 15,  'Windermere Town');
				 break;
			case "googleEarth":
				 earthCamera( 54.36930, -2.88957, 1918.57226,  -42.90198, 40.97447,0, 'Windermere Town');
				 break;
			case "ordnanceSurvey":
				 osView1(54.38079, -2.90693, 3,  'Windermere Town');
				 break;
                        }			 
			break;

            case "bowness":
			switch (map_type){
			case "googleMap":
				 mapView(54.36472, -2.91954, 15,  'Bowness-on-Windermere');
				 break;
			case "googleEarth":
				 earthCamera(54.35943, -2.90873, 983.90363,  -42.91756, 40.98211,0, 'Bowness-on-Windermere');
				 break;
			case "ordnanceSurvey":
				 osView1(54.36472, -2.91954, 3,  'Bowness-on-Windermere');
				 break;
                        }			 
			break;

            case "latterbarrow":
			switch (map_type){
			case "googleMap":
				 mapView(54.38337, -2.97578, 15,  'Latterbarrow');
				 break;
			case "googleEarth":
				 earthCamera( 54.38307, -2.99199, 731.87747,  88.86824,  61.98383,0, 'Latterbarrow');
				 break;
			case "ordnanceSurvey":
				 osView1(54.38337, -2.97578, 3,  'Latterbarrow');
				 break;
                        }			 
			break;




            case "claifeHeights":
			switch (map_type){
			case "googleMap":
				 mapView(54.36976, -2.95674, 15,  'Claife Heights');
				 break;
			case "googleEarth":
				 earthCamera( 54.39856, -2.93451, 2209.29754,  -142.49000, 48.25369,0, 'Claife Heights');
				 break;
			case "ordnanceSurvey":
				 osView1(54.36976, -2.95674, 3,  'Claife Heights');
				 break;
                        }			 
			break;
 

            case "farSawrey":
			switch (map_type){
			case "googleMap":
				 mapView(54.35070, -2.95707, 15,  'Far Sawrey');
				 break;
			case "googleEarth":
				 earthCamera( 54.34700, -2.97631, 1926.52126,  70.43099, 44.57861,0, 'Far Sawrey');
				 break;
			case "ordnanceSurvey":
				 osView1(54.35070, -2.95707, 3,  'Far Sawrey');
				 break;
                        }			 
			break;

            case "orrestHead":
			switch (map_type){
			case "googleMap":
				 mapView(54.38634, -2.90349, 15,  'Orrest Head');
				 break;
			case "googleEarth":
				 earthCamera(54.39321, -2.89307, 1046.32341,  -138.14723, 54.19826, 0, 'Orrest Head');
				 break;
			case "ordnanceSurvey":
				 osView1(54.38634, -2.90349, 8,  'Orrest Head');
				 break;
                        }			 
			break;

            case "graythwaite":
			switch (map_type){
			case "googleMap":
				 mapView(54.31263, -2.96900, 15,  'Graythwaite Hall');
				 break;
			case "googleEarth":
				 earthCamera(54.31758, -2.97366, 539.50754, 150.23746, 54.20414, 0, 'Graythwaite Hall');
				 break;
			case "ordnanceSurvey":
				 osView1(54.31263, -2.96900, 3,  'Graythwaite Hall');
				 break;
                        }			 
			break;

            case "bobbinMill":
			switch (map_type){
			case "googleMap":
				 mapView(54.28549, -2.96554, 15,  'Stott Park Bobbin Mill');
				 break;
			case "googleEarth":
				 earthCamera(54.28238, -2.96664,  232.72537, 10.29293, 65.00920,0, 'Stott Park Bobbin Mill');
				 break;
			case "ordnanceSurvey":
				 osView1(54.28549, -2.96554, 3,  'Stott Park Bobbin Mill');
				 break;
                        }			 
			break;

            case "lakeside":
			switch (map_type){
			case "googleMap":
				 mapView(54.27858, -2.95590, 15,  'Lakeside');
				 break;
			case "googleEarth":
				 earthCamera(54.27474, -2.95990, 296.99494,  30.79358,  66.21736, 0, 'Lakeside');
				 break;
			case "ordnanceSurvey":
				 osView1(54.27858, -2.95590, 3,  'Lakeside');
				 break;
                        }			 
			break;

            case "gummersHow":
			switch (map_type){
			case "googleMap":
				 mapView(54.28836, -2.93791, 15,  'Gummers How');
				 break;
			case "googleEarth":
				 earthCamera( 54.28280, -2.93926,  229.33541,  -2.48966, 68.01556,0, 'Gummers How');
				 break;
			case "ordnanceSurvey":
				 osView1(54.28836, -2.93791, 3,  'Gummers How');
				 break;
                        }			 
			break;






            default:
                     alert("error");            
		     break;
        }
}


// **********************************************************************************

function pLab1()
{

fname[1]="Wansfell Pike"
latCo[1]=54.42929
lonCo[1]=-2.93576
descr[1]='<div class=cap-text>Wansfell pike is a 488 meter fell at the northern end of Lake Windermere, not far from Ambleside.  It offers some great views down the lake.</div>'


fname[2]="Gummers How"
latCo[2]=54.28836 
lonCo[2]=-2.93791
descr[2]='<div class=cap-text>Gummers How is a 321 meter fell at the Southern end of Windermere.  There are great views of the Lake and surrounding area.</div>'

fname[3]="Orrest Head"
latCo[3]=54.38634
lonCo[3]=-2.90349
descr[3]='<div class=cap-text>One of the lower fells at 238 meters.  It was the first fell Alfred Wainwright experienced in the Lake District, and the view affected him quite profoundly.</div>'

fname[4]="Latterbarrow"
latCo[4]=54.38337
lonCo[4]=-2.97578
descr[4]='<div class=cap-text>A 240 meter fell in the Claife Heights range of hills on the western side of Lake Windermere</div>'


			
// **** view features ****

vname[100]="Lake Windermere"
latCo[100]=54.37597
lonCo[100]=-2.93270
descr[100]='<div class=cap-text>At 10.5 miles (16.9km)long, Windermere is the largest natural lake in England. It is referred to as a ribbon lake, long in length, but relatively short across (just 1 mile at its widest point).  At its deepest point Windermere is 220 feet (67 meters).</div>'

vname[101]="Belle Isle"
latCo[101]=54.36248
lonCo[101]=-2.93421
descr[101]='<div class=cap-text>Belle Isle is the largest Island on the lake, and the only one to have been inhabited</div>'

vname[102]="Claife Heights"
latCo[102]=54.36976
lonCo[102]=-2.95674
descr[102]='<div class=cap-text>A scenic area of low hills west of Lake Windermere.  Much of it is wooded and there are a number of tarns in the area.</div>'

														
// **** Towns and buildings

tname[200]="Waterhead"
latCo[200]=54.42109 
lonCo[200]=-2.96306
descr[200]='<div class=cap-text>Waterhead is the part of Ambleside adjacent to the lake.  Ferry cruises leave from the pier near the Youth Hostel.</div>'

tname[201]="Windermere (town)"
latCo[201]=54.38079
lonCo[201]=-2.90693
descr[201]='<div class=cap-text>The town of Windermere.</div>'

tname[202]="Bowness-on-Windermere"
latCo[202]=54.36472
lonCo[202]=-2.91954
descr[202]='<div class=cap-text>The holiday town of Bowness on Windermere.</div>'

tname[203]="Ambleside"
latCo[203]=54.43244
lonCo[203]=-2.96321
descr[203]='<div class=cap-text>The picturesque town of Ambleside.</div>'

tname[204]="Lakeside"
latCo[204]=54.27858
lonCo[204]=-2.95590
descr[204]='<div class=cap-text>Lakeside is located at the southern tip of Lake Windermere.  This is where the Ferry leaves for Bowness and Ambleside.  There is also a steam train that leaves for Haverthwaite.</div>'

tname[205]="Brockhole (National Park Centre)"
latCo[205]=54.40094 
lonCo[205]=-2.94142
descr[205]='<div class=cap-text>Brockhole is the National Park Centre for the English Lake District.</div>'

tname[206]="Wray Castle"
latCo[206]=54.40100 
lonCo[206]=-2.96438
descr[206]='<div class=cap-text>The grounds are owned by the National Trust and are open to the public, although the castle itself is privately owned.</div>'

tname[207]="Far Sawrey"
latCo[207]=54.35070 
lonCo[207]=-2.95707
descr[207]='<div class=cap-text>A small village West of Windermere. There is a car ferry across to Bowness nearby.</div>'

tname[208]="Graythwaite Hall"
latCo[208]=54.31263 
lonCo[208]=-2.96900
descr[208]='<div class=cap-text>The grounds are open to the public although the Hall itself is private.</div>'

tname[209]="Stott Park Bobbin Mill"
latCo[209]=54.28549
lonCo[209]=-2.96554
descr[209]='<div class=cap-text>Stott Park Bobbin Mill is owned by National Heritage and open to the public.</div>'

switch (map_type)
{
    case "googleMap":
        map_marker();
        break;
    case "ordnanceSurvey":
        os_markers();
        break;
    case "googleEarth":
        ge_placemarks();
        break;
    default:
        break;
}
}


function ge_placemarks()
{


//** Placemarks for peaks
for (loopCount=1; loopCount<=fname.length-1; loopCount ++)
{

placemark[loopCount] = ge.createPlacemark('');

placemark[loopCount].setName(fname[loopCount]);
placemark[loopCount].setDescription(descr[loopCount]);
ge.getFeatures().appendChild(placemark[loopCount]);

// Create style map for placemark
var normal = ge.createIcon('');
normal.setHref('http://maps.google.com/mapfiles/kml/shapes/triangle.png');
var iconNormal = ge.createStyle('');
iconNormal.getIconStyle().setIcon(normal);
var highlight = ge.createIcon('');
highlight.setHref('http://maps.google.com/mapfiles/kml/shapes/triangle.png');
var iconHighlight = ge.createStyle('');
iconHighlight.getIconStyle().setIcon(highlight);
var styleMap = ge.createStyleMap('');
styleMap.setNormalStyle(iconNormal);
styleMap.setHighlightStyle(iconHighlight);
placemark[loopCount].setStyleSelector(styleMap);
  
// Create point
var la = ge.getView().copyAsLookAt(ge.ALTITUDE_RELATIVE_TO_GROUND);
var point = ge.createPoint('');
point.setLatitude(latCo[loopCount]);
point.setLongitude(lonCo[loopCount]);
placemark[loopCount].setGeometry(point);  
}	  

//***********************************************************************************

//****************************Placemarks for features********************************
//***********************************************************************************

for (loopCount1=100; loopCount1<=vname.length-1; loopCount1 ++)
{
placemark[loopCount1] = ge.createPlacemark('');

placemark[loopCount1].setName(vname[loopCount1]);
placemark[loopCount1].setDescription(descr[loopCount1]);
ge.getFeatures().appendChild(placemark[loopCount1]);

// Create style map for placemark
var normal1 = ge.createIcon('');
normal1.setHref('http://maps.google.com/mapfiles/kml/shapes/star.png');
var iconNormal1 = ge.createStyle('');
iconNormal1.getIconStyle().setIcon(normal1);
var highlight1 = ge.createIcon('');
highlight1.setHref('http://maps.google.com/mapfiles/kml/shapes/star.png');
var iconHighlight1 = ge.createStyle('');
iconHighlight1.getIconStyle().setIcon(highlight1);
var styleMap1 = ge.createStyleMap('');
styleMap1.setNormalStyle(iconNormal1);
styleMap1.setHighlightStyle(iconHighlight1);
placemark[loopCount1].setStyleSelector(styleMap1);
  
// Create point
//var la1 = ge.getView().copyAsLookAt(ge.ALTITUDE_RELATIVE_TO_GROUND);
var point1 = ge.createPoint('');
point1.setLatitude(latCo[loopCount1]);
point1.setLongitude(lonCo[loopCount1]);
placemark[loopCount1].setGeometry(point1);  
}

// ****** Placemarks for Towns and buildings *********************
// ***************************************************************

for (loopCount2=200; loopCount2<=tname.length-1; loopCount2 ++)
{
placemark[loopCount2] = ge.createPlacemark('');

placemark[loopCount2].setName(tname[loopCount2]);
placemark[loopCount2].setDescription(descr[loopCount2]);
ge.getFeatures().appendChild(placemark[loopCount2]);

// Create style map for placemark
var normal2 = ge.createIcon('');
normal2.setHref('http://maps.google.com/mapfiles/kml/shapes/square.png');
var iconNormal2 = ge.createStyle('');
iconNormal2.getIconStyle().setIcon(normal2);
var highlight2 = ge.createIcon('');
highlight2.setHref('http://maps.google.com/mapfiles/kml/shapes/square.png');
var iconHighlight2 = ge.createStyle('');
iconHighlight2.getIconStyle().setIcon(highlight2);
var styleMap2 = ge.createStyleMap('');
styleMap2.setNormalStyle(iconNormal2);
styleMap2.setHighlightStyle(iconHighlight2);
placemark[loopCount2].setStyleSelector(styleMap2);
  
// Create point
var la2 = ge.getView().copyAsLookAt(ge.ALTITUDE_RELATIVE_TO_GROUND);
var point2 = ge.createPoint('');
point2.setLatitude(latCo[loopCount2]);
point2.setLongitude(lonCo[loopCount2]);
placemark[loopCount2].setGeometry(point2);

}
}

function delete_placemarks()
{
    for (loopCount=1; loopCount<=fname.length-1; loopCount ++)
    {
	    ge.getFeatures().removeChild(placemark[loopCount]);
	}
	for (loopCount1=100; loopCount1<=vname.length-1; loopCount1 ++)
    {
        ge.getFeatures().removeChild(placemark[loopCount1]);
    }
    for (loopCount2=200; loopCount2<=tname.length-1; loopCount2 ++)
    {
        ge.getFeatures().removeChild(placemark[loopCount2]);
	}
}

function delete_Gmarkers()
{
    for (loopCount=1; loopCount<=fname.length-1; loopCount ++)
	{
	    map.removeOverlay(placemark[loopCount])
	}
	for (loopCount=100; loopCount<=vname.length-1; loopCount ++)
	{
	    map.removeOverlay(placemark[loopCount])
	}
	for (loopCount=200; loopCount<=tname.length-1; loopCount ++)
	{
	    map.removeOverlay(placemark[loopCount])
	}

}

function delete_osMarkers()
{
    for (loopCount=1; loopCount<=fname.length-1; loopCount ++)
	{
	     osMap.removeMarker(placemark[loopCount])
	}
	for (loopCount=100; loopCount<=vname.length-1; loopCount ++)
	{
	     osMap.removeMarker(placemark[loopCount])
	}
	for (loopCount=200; loopCount<=tname.length-1; loopCount ++)
	{
	     osMap.removeMarker(placemark[loopCount])
	}

}


function restoreDefaultView()
{
    map.setCenter(new GLatLng(54.3685, -2.9199), 12);
}

function map_marker()
{
 	for (loopCount=1; loopCount<=fname.length-1; loopCount ++)
	{	 
		 
    	 var center = new GLatLng(latCo[loopCount], lonCo[loopCount]);
    	 placemark[loopCount] = new GMarker(center);
		 temp_placemark=placemark[loopCount];
		 temp_name=fname[loopCount];   	 
    	 map.addOverlay(placemark[loopCount]);
	}
    
	for (loopCount=100; loopCount<=vname.length-1; loopCount ++)
	{	 
		 
    	 var center = new GLatLng(latCo[loopCount], lonCo[loopCount]);
    	 placemark[loopCount] = new GMarker(center);
		 temp_placemark=placemark[loopCount];    	 
    	 map.addOverlay(placemark[loopCount]);
	}
	
	for (loopCount=200; loopCount<=tname.length-1; loopCount ++)
	{	 
		 
    	 var center = new GLatLng(latCo[loopCount], lonCo[loopCount]);
    	 placemark[loopCount] = new GMarker(center);
		 temp_placemark=placemark[loopCount];    	 
    	 map.addOverlay(placemark[loopCount]);
	}
	
	GEvent.addListener(placemark[1], "mouseover", function(){	
	    placemark[1].openInfoWindowHtml('<b>' + fname[1]  + '</b>' +'<br/>' + descr[1] + '<br/><a class="intLnk" onclick="restoreDefaultView()">Restore default map view</a>');
		 });
	GEvent.addListener(placemark[1], "click", function(){  
	               map.setCenter(new GLatLng(latCo[1],lonCo[1]), 17);	   		   
         });
	GEvent.addListener(placemark[2], "mouseover", function(){  
	               placemark[2].openInfoWindowHtml('<b>' +fname[2] +'</b>' + '<br/>' + descr[2] + '<br/><a class="intLnk" onclick="restoreDefaultView()">Restore default map view</a>');			   		   
         });
	GEvent.addListener(placemark[2], "click", function(){  
	               map.setCenter(new GLatLng(latCo[2],lonCo[2]), 17);			   		   
         });	 
	GEvent.addListener(placemark[3], "mouseover", function(){  
	               placemark[3].openInfoWindowHtml('<b>' + fname[3] + '</b>' + '<br/>' + descr[3] + '<br/><a class="intLnk" onclick="restoreDefaultView()">Restore default map view</a>');				   			   		   
         });	
	GEvent.addListener(placemark[3], "click", function(){  
	               map.setCenter(new GLatLng(latCo[3],lonCo[3]), 17);			   		   
         });
		 
    GEvent.addListener(placemark[4], "mouseover", function(){  
	               placemark[4].openInfoWindowHtml('<b>' +fname[4] +'</b>' + '<br/>' + descr[4]+ '<br/><a class="intLnk" onclick="restoreDefaultView()">Restore default map view</a>');		   		   
         });
	GEvent.addListener(placemark[4], "click", function(){  
	               map.setCenter(new GLatLng(latCo[4],lonCo[4]), 17);			   		   
         });
		 
	// *** view features event listeners
	
	GEvent.addListener(placemark[100], "mouseover", function(){  
	               placemark[100].openInfoWindowHtml('<b>' +vname[100]+ '</b>' +'<br/>' + descr[100]+ '<br/><a class="intLnk" onclick="restoreDefaultView()">Restore default map view</a>');	   		   
         });
	GEvent.addListener(placemark[100], "click", function(){  
	               map.setCenter(new GLatLng(latCo[100],lonCo[100]), 14);			   		   
         });
		 
	GEvent.addListener(placemark[101], "mouseover", function(){  
	               placemark[101].openInfoWindowHtml('<b>' +vname[101]+ '</b>' +'<br/>' + descr[101]+ '<br/><a class="intLnk" onclick="restoreDefaultView()">Restore default map view</a>');		   		   
         });
	GEvent.addListener(placemark[101], "click", function(){  
	               map.setCenter(new GLatLng(latCo[101],lonCo[101]), 16);			   		   
         });
		 
	GEvent.addListener(placemark[102], "mouseover", function(){  
	               placemark[102].openInfoWindowHtml('<b>' +vname[102]+ '</b>' +'<br/>' + descr[102]+ '<br/><a class="intLnk" onclick="restoreDefaultView()">Restore default map view</a>');		   		   
         });
	GEvent.addListener(placemark[102], "click", function(){  
	               map.setCenter(new GLatLng(latCo[102],lonCo[102]), 14);			   		   
         });
		 
	// *** towns and building event listeners ***
	
	GEvent.addListener(placemark[200], "mouseover", function(){  
	               placemark[200].openInfoWindowHtml('<b>' +tname[200]+ '</b>' +'<br/>' + descr[200]+ '<br/><a class="intLnk" onclick="restoreDefaultView()">Restore default map view</a>');	   		   
         });
	GEvent.addListener(placemark[200], "click", function(){  
	               map.setCenter(new GLatLng(latCo[200],lonCo[200]), 16);			   		   
         });
	
	GEvent.addListener(placemark[201], "mouseover", function(){  
	               placemark[201].openInfoWindowHtml('<b>' +tname[201]+'</b>' + '<br/>' + descr[201]+ '<br/><a class="intLnk" onclick="restoreDefaultView()">Restore default map view</a>');		  			   		   
         });
	GEvent.addListener(placemark[201], "click", function(){  
	               map.setCenter(new GLatLng(latCo[201],lonCo[201]), 16);		   		   
         });	
	
	GEvent.addListener(placemark[202], "mouseover", function(){  
	               placemark[202].openInfoWindowHtml('<b>' +tname[202]+ '</b>' +'<br/>' + descr[202]+ '<br/><a class="intLnk" onclick="restoreDefaultView()">Restore default map view</a>');		  			   		   
         });
	GEvent.addListener(placemark[202], "click", function(){  
	               map.setCenter(new GLatLng(latCo[202],lonCo[202]), 16);			   		   
         });
			 
	GEvent.addListener(placemark[203], "mouseover", function(){  
	               placemark[203].openInfoWindowHtml('<b>' +tname[203]+ '</b>' +'<br/>' + descr[203]+ '<br/><a class="intLnk" onclick="restoreDefaultView()">Restore default map view</a>');		  			   		   
         });
	GEvent.addListener(placemark[203], "click", function(){  
	               map.setCenter(new GLatLng(latCo[203],lonCo[203]), 16);			   		   
         });
		 
	GEvent.addListener(placemark[204], "mouseover", function(){  
	               placemark[204].openInfoWindowHtml('<b>' +tname[204]+'</b>' + '<br/>' + descr[204]+ '<br/><a class="intLnk" onclick="restoreDefaultView()">Restore default map view</a>');		  			   		   
         });
	GEvent.addListener(placemark[204], "click", function(){  
	               map.setCenter(new GLatLng(latCo[204],lonCo[204]), 17);		   		   
         });	
		 
	GEvent.addListener(placemark[205], "mouseover", function(){  
	               placemark[205].openInfoWindowHtml('<b>' +tname[205]+'</b>' + '<br/>' + descr[205]+ '<br/><a class="intLnk" onclick="restoreDefaultView()">Restore default map view</a>');		  			   		   
         });
	GEvent.addListener(placemark[205], "click", function(){  
	               map.setCenter(new GLatLng(latCo[205],lonCo[205]), 17);			   		   
         });
		 
	GEvent.addListener(placemark[206], "mouseover", function(){  
	               placemark[206].openInfoWindowHtml('<b>' +tname[206]+'</b>' + '<br/>' + descr[206] + '<br/><a class="intLnk" onclick="restoreDefaultView()">Restore default map view</a>');		  			   		   
         }); 
	GEvent.addListener(placemark[206], "click", function(){  
	               map.setCenter(new GLatLng(latCo[206],lonCo[206]), 17);			   		   
         });	
		 
	GEvent.addListener(placemark[207], "mouseover", function(){  
	               placemark[207].openInfoWindowHtml(tname[207]+ '<br/>' + descr[207]+ '<br/><a class="intLnk" onclick="restoreDefaultView()">Restore default map view</a>');		  			   		   
         });
	GEvent.addListener(placemark[207], "click", function(){  
	               map.setCenter(new GLatLng(latCo[207],lonCo[207]), 17);	   		   
         });  
		 
	GEvent.addListener(placemark[208], "mouseover", function(){  
	               placemark[208].openInfoWindowHtml('<b>' +tname[208]+'</b>' + '<br/>' + descr[208]+ '<br/><a class="intLnk" onclick="restoreDefaultView()">Restore default map view</a>');		  			   		   
         });
	GEvent.addListener(placemark[208], "click", function(){  
	               map.setCenter(new GLatLng(latCo[208],lonCo[208]), 17);		   		   
         });
		 
	GEvent.addListener(placemark[209], "mouseover", function(){  
	               placemark[209].openInfoWindowHtml('<b>' +tname[209] + '</b>' +'<br/>' + descr[209]+ '<br/><a class="intLnk" onclick="restoreDefaultView()">Restore default map view</a>');		  			   		   
         });
	GEvent.addListener(placemark[209], "click", function(){  
	               map.setCenter(new GLatLng(latCo[209],lonCo[209]), 17);			   		   
         });
		 
}

function os_markers()
{
    
    for (loopCount=1; loopCount<=fname.length-1; loopCount ++)
    {     
        var gridProjection = new OpenSpace.GridProjection();
        var lonlat = new OpenLayers.LonLat(lonCo[loopCount], latCo[loopCount]);
        
        var pos = gridProjection.getMapPointFromLonLat(lonlat);
    
        var content='<b>' + fname[loopCount] + '</b><br/>' + descr[loopCount];
        placemark[loopCount]=osMap.createMarker(pos,null,content);
    }
    for (loopCount=100; loopCount<=vname.length-1; loopCount ++)
    {     
        var gridProjection = new OpenSpace.GridProjection();
        var lonlat = new OpenLayers.LonLat(lonCo[loopCount], latCo[loopCount]);
        
        var pos = gridProjection.getMapPointFromLonLat(lonlat);
    
        var content='<b>' + vname[loopCount] + '</b><br/>' + descr[loopCount];
        placemark[loopCount]=osMap.createMarker(pos,null,content);
    }  
    for (loopCount=200; loopCount<=tname.length-1; loopCount ++)
    {     
        var gridProjection = new OpenSpace.GridProjection();
        var lonlat = new OpenLayers.LonLat(lonCo[loopCount], latCo[loopCount]);
        
        var pos = gridProjection.getMapPointFromLonLat(lonlat);
    
        var content='<b>' + tname[loopCount] + '</b><br/>' + descr[loopCount];
        placemark[loopCount]=osMap.createMarker(pos,null,content);
    }  

}
 
 
