
var oldMarkerImageIndex = -1;
var ClickCount  = 0;
var frstClik=0;
var marker1="";
var point1="";
var addMore=0;
var ver=0;
var previousPoint;
var routside= new Array();
var lastpoint;
function mapClick(marker, point,i) {
    //alert(marker+ point);

  if(i!=1)
    {
        addMore=0;
        ver=0;
    }
    if(point)
    {
        unsaved=true;
        var longitude = point.lng();
        longitude=-(longitude);
        var latitude =  point.lat();
        var one=longitude-document.getElementById('lan').value;
        var two=latitude-document.getElementById('lat').value;
        document.getElementById('lan').value=longitude;
        document.getElementById('lat').value=latitude;

        if(one>0 && two<0)
            var xyz='left';
        else if(one<0 && two>0)
            var xyz='right';
        else if(one>0 && two>0)
            xyz='left';
        var  xy=document.getElementById('mark').value;
        if(xy==0)
        {
			if(routePoints.length==0)
				//smallIcon.image='images/Hex -Runner R DS.jpg';
				smallIcon.image='images/Country Park.gif';

			else if(xyz=='left')

				//smallIcon.image='images/Hex -Runner L DS.jpg';
				smallIcon.image='images/Country Park.gif';
			else    

				//smallIcon.image='images/Hex -Runner R DS.jpg';
				smallIcon.image='images/Country Park.gif';
		}
		if(xy==1)
		{

			if(routePoints.length==0)
				//smallIcon.image='images/Hex -Walker R DS.jpg';
				smallIcon.image='images/Church or Chapel.gif';

			else if(xyz=='left')

				smallIcon.image='images/Church or Chapel.gif';
			else    

				smallIcon.image='images/Church or Chapel.gif';
		}
		if(xy==2)
		{

			if(routePoints.length==0)
				smallIcon.image='images/Eating.gif';

			else if(xyz=='left')

				smallIcon.image='images/Eating.gif';
			else    

				smallIcon.image='images/Eating.gif';
		}
		if(xy==3)
		{
			if(routePoints.length==0)
				smallIcon.image='images/Entertainment.gif';

			else if(xyz=='left')

				smallIcon.image='images/Entertainment.gif';
			else    

				smallIcon.image='images/Entertainment.gif';
		}

		if(xy==4)
		{
			if(routePoints.length==0)
				smallIcon.image='images/Historical.gif';

			else if(xyz=='left')

				smallIcon.image='images/Historical.gif';
			else    

				smallIcon.image='images/Historical.gif';
		}

		if(xy==5)
		{
			if(routePoints.length==0)
				smallIcon.image='images/Hotel.gif';

			else if(xyz=='left')

				smallIcon.image='images/Hotel.gif';
			else    

				smallIcon.image='images/Hotel.gif';
		}
		if(xy==6)
		{
			if(routePoints.length==0)
				smallIcon.image='images/Industrial.gif';

			else if(xyz=='left')

				smallIcon.image='images/Industrial.gif';
			else    

				smallIcon.image='images/Industrial.gif';
		}

		if(xy==7)
		{
			if(routePoints.length==0)
				smallIcon.image='images/Museum.gif';

			else if(xyz=='left')

				smallIcon.image='images/Museum.gif';
			else    

				smallIcon.image='images/Museum.gif';
		}


		if(xy==8)
		{
			if(routePoints.length==0)
				smallIcon.image='images/NT.gif';

			else if(xyz=='left')

				smallIcon.image='images/NT.gif';
			else    

				smallIcon.image='images/NT.gif';
		}

		if(xy==9)
		{
			if(routePoints.length==0)
				smallIcon.image='images/RockClimbing.gif';

			else if(xyz=='left')

				smallIcon.image='images/RockClimbing.gif';
			else    

				smallIcon.image='images/RockClimbing.gif';
		} 
		if(xy==10)
		{

			if(routePoints.length==0)
				smallIcon.image='images/Ports.gif';

			else if(xyz=='left')

				smallIcon.image='images/Ports.gif';
			else    

				smallIcon.image='images/Ports.gif';

		} 
		if(xy==11)
		{

			if(routePoints.length==0)
				smallIcon.image='images/Cycling.gif';

			else if(xyz=='left')

				smallIcon.image='images/Cycling.gif';
			else    

				smallIcon.image='images/Cycling.gif';

		} 
			//two markers appended By HWS
		if(xy==12)
		{

			if(routePoints.length==0)
				smallIcon.image='images/cliffDangerSignfinal.gif';  //Cliff danger
			else if(xyz=='left')

				smallIcon.image='images/cliffDangerSignfinal.gif';  //Cliff danger
			else    

				smallIcon.image='images/cliffDangerSignfinal.gif';  //Cliff danger

		}	
		if(xy==13)
		{

			if(routePoints.length==0)
				smallIcon.image='images/fastdeepwaterfinal.gif';		//deep water
			else if(xyz=='left')

				smallIcon.image='images/fastdeepwaterfinal.gif';		//deep water
			else    

				smallIcon.image='images/fastdeepwaterfinal.gif';		//deep water
		}
			if(xy==14)
		{
			if(routePoints.length==0)
				smallIcon.image='images/OldMachinery.gif';          //Rowing  

			else if(xyz=='left')

				smallIcon.image='images/OldMachinery.gif';           //Rowing 
			else    

				smallIcon.image='images/OldMachinery.gif';           //Rowing 
		}
		if(xy==15)
		{
			if(routePoints.length==0)
				smallIcon.image='images/Quarry.gif';          //Rowing  

			else if(xyz=='left')

				smallIcon.image='images/Quarry.gif';           //Rowing 
			else    

				smallIcon.image='images/Quarry.gif';           //Rowing 
		}
		if(xy==16)
		{
			if(routePoints.length==0)
				smallIcon.image='images/Railway.gif';          //Rowing  

			else if(xyz=='left')

				smallIcon.image='images/Railway.gif';           //Rowing 
			else    

				smallIcon.image='images/Railway.gif';           //Rowing 
		}
		if(xy==17)
		{
			if(routePoints.length==0)
				smallIcon.image='images/Refreshments10F.gif';          //Rowing  

			else if(xyz=='left')

				smallIcon.image='images/Refreshments10F.gif';           //Rowing 
			else    

				smallIcon.image='images/Refreshments10F.gif';           //Rowing 
		}
		if(xy==18)
		{
			if(routePoints.length==0)
				smallIcon.image='images/Camera view.gif';          //Rowing  

			else if(xyz=='left')

				smallIcon.image='images/Camera view.gif';           //Rowing 
			else    

				smallIcon.image='images/Camera view.gif';           //Rowing 
		}
		if(xy==19)
		{
			if(routePoints.length==0)
				smallIcon.image='images/Watermill.gif';          //Rowing  

			else if(xyz=='left')

				smallIcon.image='images/Watermill.gif';           //Rowing 
			else    

				smallIcon.image='images/Watermill.gif';           //Rowing 
		}
		if(xy==20)
		{
			if(routePoints.length==0)
				smallIcon.image='images/sgrade4.gif';          //Rowing  

			else if(xyz=='left')

				smallIcon.image='images/sgrade4.gif';           //Rowing 
			else    

				smallIcon.image='images/sgrade4.gif';           //Rowing 
		}
		if(xy==21)
		{
			if(routePoints.length==0)
				smallIcon.image='images/Zoo.gif';          //Rowing  

			else if(xyz=='left')

				smallIcon.image='images/Zoo.gif';           //Rowing 
			else    

				smallIcon.image='images/Zoo.gif';           //Rowing 
		}
		if(xy==22)
		{
			if(routePoints.length==0)
				smallIcon.image='images/View.gif';          //Rowing  

			else if(xyz=='left')

				smallIcon.image='images/View.gif';           //Rowing 
			else    

				smallIcon.image='images/View.gif';           //Rowing 
		}
		if(xy==23)
		{
			if(routePoints.length==0)
				smallIcon.image='images/Contact.gif';          //Rowing  

			else if(xyz=='left')

				smallIcon.image='images/Contact.gif';           //Rowing 
			else    

				smallIcon.image='images/Contact.gif';           //Rowing 
		}
		if(xy==24)
		{
			if(routePoints.length==0)
				smallIcon.image='images/Weather.gif';          //Rowing  

			else if(xyz=='left')

				smallIcon.image='images/Weather.gif';           //Rowing 
			else    

				smallIcon.image='images/Weather.gif';           //Rowing 
		}
		if(xy==25)
		{
			if(routePoints.length==0)
				smallIcon.image='images/LifeJacket.gif';          //Rowing  

			else if(xyz=='left')

				smallIcon.image='images/LifeJacket.gif';           //Rowing 
			else    

				smallIcon.image='images/LifeJacket.gif';           //Rowing 
		}
		if(xy==26)
		{
			if(routePoints.length==0)
				smallIcon.image='images/Rocks.gif';          //Rowing  

			else if(xyz=='left')

				smallIcon.image='images/Rocks.gif';           //Rowing 
			else    

				smallIcon.image='images/Rocks.gif';           //Rowing 
		}
		if(xy==27)
		{
			if(routePoints.length==0)
				smallIcon.image='images/FirstAid.gif';          //Rowing  

			else if(xyz=='left')

				smallIcon.image='images/FirstAid.gif';           //Rowing 
			else    

				smallIcon.image='images/FirstAid.gif';           //Rowing 
		}
		if(xy==28)
		{
			if(routePoints.length==0)
				smallIcon.image='images/AirAmbulance.gif';          //Rowing  

			else if(xyz=='left')

				smallIcon.image='images/AirAmbulance.gif';           //Rowing 
			else    

				smallIcon.image='images/AirAmbulance.gif';           //Rowing 
		}
			if(xy==29)
		{
			if(routePoints.length==0)
				smallIcon.image='images/Lifeboat.gif';          //Rowing  

			else if(xyz=='left')

				smallIcon.image='images/Lifeboat.gif';           //Rowing 
			else    

				smallIcon.image='images/Lifeboat.gif';           //Rowing 
		}
				if(xy==30)
		{
			if(routePoints.length==0)
				smallIcon.image='images/Rescue.gif';          //Rowing  

			else if(xyz=='left')

				smallIcon.image='images/Rescue.gif';           //Rowing 
			else    

				smallIcon.image='images/Rescue.gif';           //Rowing 
		}
		if(xy==31)
		{
			if(routePoints.length==0)
					smallIcon.image='images/Accessibility.gif';          //Rowing  

			else if(xyz=='left')

				smallIcon.image='images/Accessibility.gif';           //Rowing 
			else    

				smallIcon.image='images/Accessibility.gif';           //Rowing 
		}
		
		if(xy==32)
		{
			if(routePoints.length==0)
					smallIcon.image='images/BusAndStation.gif';          //Rowing  

			else if(xyz=='left')

				smallIcon.image='images/BusAndStation.gif';           //Rowing 
			else    

				smallIcon.image='images/BusAndStation.gif';           //Rowing 
		}
		
		if(xy==33)
		{
			if(routePoints.length==0)
					smallIcon.image='images/archive library.gif';          //Rowing  

			else if(xyz=='left')

				smallIcon.image='images/archive library.gif';           //Rowing 
			else    

				smallIcon.image='images/archive library.gif';           //Rowing 
		}
		if(xy==34)
		{
			if(routePoints.length==0)
					smallIcon.image='images/boat launch.gif';          //Rowing  

			else if(xyz=='left')

				smallIcon.image='images/boat launch.gif';           //Rowing 
			else    

				smallIcon.image='images/boat launch.gif';           //Rowing 
		}
		if(xy==35)
		{
			if(routePoints.length==0)
					smallIcon.image='images/Boating.gif';          //Rowing  

			else if(xyz=='left')

				smallIcon.image='images/Boating.gif';           //Rowing 
			else    

				smallIcon.image='images/Boating.gif';           //Rowing 
		}
		if(xy==36)
		{
			if(routePoints.length==0)
					smallIcon.image='images/Bus Route.gif';          //Rowing  

			else if(xyz=='left')

				smallIcon.image='images/Bus Route.gif';           //Rowing 
			else    

				smallIcon.image='images/Bus Route.gif';           //Rowing 
		}
		if(xy==37)
		{
			if(routePoints.length==0)
					smallIcon.image='images/Aircraft Museum.gif';          //Rowing  

			else if(xyz=='left')

				smallIcon.image='images/Aircraft Museum.gif';           //Rowing 
			else    

				smallIcon.image='images/Aircraft Museum.gif';           //Rowing 
		}
		if(xy==38)
		{
			if(routePoints.length==0)
					smallIcon.image='images/Camping Site.gif';          //Rowing  

			else if(xyz=='left')

				smallIcon.image='images/Camping Site.gif';           //Rowing 
			else    

				smallIcon.image='images/Camping Site.gif';           //Rowing 
		}
		if(xy==39)
		{
			if(routePoints.length==0)
					smallIcon.image='images/Car Garage.gif';          //Rowing  

			else if(xyz=='left')

				smallIcon.image='images/Car Garage.gif';           //Rowing 
			else    

				smallIcon.image='images/Car Garage.gif';           //Rowing 
		}
		if(xy==40)
		{
			if(routePoints.length==0)
					smallIcon.image='images/Caravan Park.gif';          //Rowing  

			else if(xyz=='left')

				smallIcon.image='images/Caravan Park.gif';           //Rowing 
			else    

				smallIcon.image='images/Caravan Park.gif';           //Rowing 
		}
			if(xy==41)
		{
			if(routePoints.length==0)
					smallIcon.image='images/Hex -Canoeing L DS.gif';          //Rowing  

			else if(xyz=='left')

				smallIcon.image='images/Hex -Canoeing L DS.gif';           //Rowing 
			else    

				smallIcon.image='images/Hex -Canoeing L DS.gif';           //Rowing 
		}
				if(xy==42)
		{
			if(routePoints.length==0)
					smallIcon.image='images/Hex -Car L DS.gif';          //Rowing  

			else if(xyz=='left')

				smallIcon.image='images/Hex -Car L DS.gif';           //Rowing 
			else    

				smallIcon.image='images/Hex -Car L DS.gif';           //Rowing 
		}
		
		if(xy==43)
		{
			if(routePoints.length==0)
					smallIcon.image='images/Cycle Shop.gif';          //Rowing  

			else if(xyz=='left')

				smallIcon.image='images/Cycle Shop.gif';           //Rowing 
			else    

				smallIcon.image='images/Cycle Shop.gif';           //Rowing 
		}
			if(xy==44)
		{
			if(routePoints.length==0)
					smallIcon.image='images/Dogs Allowed.gif';          //Rowing  

			else if(xyz=='left')

				smallIcon.image='images/Dogs Allowed.gif';           //Rowing 
			else    

				smallIcon.image='images/Dogs Allowed.gif';           //Rowing 
		}
		if(xy==45)
		{
			if(routePoints.length==0)
					smallIcon.image='images/Diving.gif';          //Rowing  

			else if(xyz=='left')

				smallIcon.image='images/Diving.gif';           //Rowing 
			else    

				smallIcon.image='images/Diving.gif';           //Rowing 
		}
		if(xy==46)
		{
			if(routePoints.length==0)
					smallIcon.image='images/Hex -Mountainbike L DS.gif';          //Rowing  

			else if(xyz=='left')

				smallIcon.image='images/Hex -Mountainbike L DS.gif';           //Rowing 
			else    

				smallIcon.image='images/Hex -Mountainbike L DS.gif';           //Rowing 
		}
			if(xy==47)
		{
			if(routePoints.length==0)
					smallIcon.image='images/Exercise & Fitness.gif';          //Rowing  

			else if(xyz=='left')

				smallIcon.image='images/Exercise & Fitness.gif';           //Rowing 
			else    

				smallIcon.image='images/Exercise & Fitness.gif';           //Rowing 
		}
			if(xy==48)
		{
			if(routePoints.length==0)
					smallIcon.image='images/Fishing.gif';          //Rowing  

			else if(xyz=='left')

				smallIcon.image='images/Fishing.gif';           //Rowing 
			else    

				smallIcon.image='images/Fishing.gif';           //Rowing 
		}
		
			if(xy==49)
		{
			if(routePoints.length==0)
					smallIcon.image='images/Food Store.gif';          //Rowing  

			else if(xyz=='left')

				smallIcon.image='images/Food Store.gif';           //Rowing 
			else    

				smallIcon.image='images/Food Store.gif';           //Rowing 
		}
		if(xy==50)
		{
			if(routePoints.length==0)
					smallIcon.image='images/Golfing.gif';          //Rowing  

			else if(xyz=='left')

				smallIcon.image='images/Golfing.gif';           //Rowing 
			else    

				smallIcon.image='images/Golfing.gif';           //Rowing 
		}
		if(xy==51)
		{
			if(routePoints.length==0)
					smallIcon.image='images/HandGliding.gif';          //Rowing  

			else if(xyz=='left')

				smallIcon.image='images/HandGliding.gif';           //Rowing 
			else    

				smallIcon.image='images/HandGliding.gif';           //Rowing 
		}
		if(xy==52)
		{
			if(routePoints.length==0)
					smallIcon.image='images/Picnic.gif';          //Rowing  

			else if(xyz=='left')

				smallIcon.image='images/Picnic.gif';           //Rowing 
			else    

				smallIcon.image='images/Picnic.gif';           //Rowing 
		}
		if(xy==53)
		{
			if(routePoints.length==0)
					smallIcon.image='images/HorseRiding.gif';          //Rowing  

			else if(xyz=='left')

				smallIcon.image='images/HorseRiding.gif';           //Rowing 
			else    

				smallIcon.image='images/HorseRiding.gif';           //Rowing 
		}
		if(xy==54)
		{
			if(routePoints.length==0)
					smallIcon.image='images/Hospital.gif';          //Rowing  

			else if(xyz=='left')

				smallIcon.image='images/Hospital.gif';           //Rowing 
			else    

				smallIcon.image='images/Hospital.gif';           //Rowing 
		}
			if(xy==55)
		{
			if(routePoints.length==0)
					smallIcon.image='images/sgrade3.gif';          //Rowing  

			else if(xyz=='left')

				smallIcon.image='images/sgrade3.gif';           //Rowing 
			else    

				smallIcon.image='images/sgrade3.gif';           //Rowing 
		}
		if(xy==56)
		{
			if(routePoints.length==0)
					smallIcon.image='images/Rowing.gif';          //Rowing  

			else if(xyz=='left')

				smallIcon.image='images/Rowing.gif';           //Rowing 
			else    

				smallIcon.image='images/Rowing.gif';           //Rowing 
		}
		if(xy==57)
		{
			if(routePoints.length==0)
					smallIcon.image='images/Information.gif';          //Rowing  

			else if(xyz=='left')

				smallIcon.image='images/Information.gif';           //Rowing 
			else    

				smallIcon.image='images/Information.gif';           //Rowing 
		}
		if(xy==58)
		{
			if(routePoints.length==0)
					smallIcon.image='images/Lighthouse.gif';          //Rowing  

			else if(xyz=='left')

				smallIcon.image='images/Lighthouse.gif';           //Rowing 
			else    

				smallIcon.image='images/Lighthouse.gif';           //Rowing 
		}
		if(xy==59)
		{
			if(routePoints.length==0)
					smallIcon.image='images/Lodgings.gif';          //Rowing  

			else if(xyz=='left')

				smallIcon.image='images/Lodgings.gif';           //Rowing 
			else    

				smallIcon.image='images/Lodgings.gif';           //Rowing 
		}
		if(xy==60)
		{
			if(routePoints.length==0)
					smallIcon.image='images/Litter.gif';          //Rowing  

			else if(xyz=='left')

				smallIcon.image='images/Litter.gif';           //Rowing 
			else    

				smallIcon.image='images/Litter.gif';           //Rowing 
		}
		if(xy==61)
		{
			if(routePoints.length==0)
					smallIcon.image='images/Maritime.gif';          //Rowing  

			else if(xyz=='left')

				smallIcon.image='images/Maritime.gif';           //Rowing 
			else    

				smallIcon.image='images/Maritime.gif';           //Rowing 
		}
		if(xy==62)
		{
			if(routePoints.length==0)
					smallIcon.image='images/Motorcycle.gif';          //Rowing  

			else if(xyz=='left')

				smallIcon.image='images/Motorcycle.gif';           //Rowing 
			else    

				smallIcon.image='images/Motorcycle.gif';           //Rowing 
		}
		if(xy==63)
		{
			if(routePoints.length==0)
					smallIcon.image='images/Hex -Runner L DS.gif';          //Rowing  

			else if(xyz=='left')

				smallIcon.image='images/Hex -Runner L DS.gif';           //Rowing 
			else    

				smallIcon.image='images/Hex -Runner L DS.gif';           //Rowing 
		}
		if(xy==64)
		{
			if(routePoints.length==0)
					smallIcon.image='images/NatureReserve.gif';          //Rowing  

			else if(xyz=='left')

				smallIcon.image='images/NatureReserve.gif';           //Rowing 
			else    

				smallIcon.image='images/NatureReserve.gif';           //Rowing 
		}
		if(xy==65)
		{
			if(routePoints.length==0)
					smallIcon.image='images/Hex -Swimmer L.gif';          //Rowing  

			else if(xyz=='left')

				smallIcon.image='images/Hex -Swimmer L.gif';           //Rowing 
			else    

				smallIcon.image='images/Hex -Swimmer L.gif';           //Rowing 
		}
		if(xy==66)
		{
			if(routePoints.length==0)
					smallIcon.image='images/Underground.gif';          //Rowing  

			else if(xyz=='left')

				smallIcon.image='images/Underground.gif';           //Rowing 
			else    

				smallIcon.image='images/Underground.gif';           //Rowing 
		}
		if(xy==67)
		{
			if(routePoints.length==0)
					smallIcon.image='images/OutdoorPursuitCentre.gif';          //Rowing  

			else if(xyz=='left')

				smallIcon.image='images/OutdoorPursuitCentre.gif';           //Rowing 
			else    

				smallIcon.image='images/OutdoorPursuitCentre.gif';           //Rowing 
		}
		if(xy==68)
		{
			if(routePoints.length==0)
					smallIcon.image='images/Parking.gif';          //Rowing  

			else if(xyz=='left')

				smallIcon.image='images/Parking.gif';           //Rowing 
			else    

				smallIcon.image='images/Parking.gif';           //Rowing 
		}
		if(xy==69)
		{
			if(routePoints.length==0)
					smallIcon.image='images/PathwayAndHeritage.gif';          //Rowing  

			else if(xyz=='left')

				smallIcon.image='images/PathwayAndHeritage.gif';           //Rowing 
			else    

				smallIcon.image='images/PathwayAndHeritage.gif';           //Rowing 
		}
		if(xy==70)
		{
			if(routePoints.length==0)
					smallIcon.image='images/Playground.gif';          //Rowing  

			else if(xyz=='left')

				smallIcon.image='images/Playground.gif';           //Rowing 
			else    

				smallIcon.image='images/Playground.gif';           //Rowing 
		}
		if(xy==71)
		{
			if(routePoints.length==0)
					smallIcon.image='images/Police.gif';          //Rowing  

			else if(xyz=='left')

				smallIcon.image='images/Police.gif';           //Rowing 
			else    

				smallIcon.image='images/Police.gif';           //Rowing 
		}
		if(xy==72)
		{
			if(routePoints.length==0)
					smallIcon.image='images/ViewPoint.gif';          //Rowing  

			else if(xyz=='left')

				smallIcon.image='images/ViewPoint.gif';           //Rowing 
			else    

				smallIcon.image='images/ViewPoint.gif';           //Rowing 
		}
		if(xy==73)
		{
			if(routePoints.length==0)
					smallIcon.image='images/RailTransport.gif';          //Rowing  

			else if(xyz=='left')

				smallIcon.image='images/RailTransport.gif';           //Rowing 
			else    

				smallIcon.image='images/RailTransport.gif';           //Rowing 
		}
				if(xy==74)
		{
			if(routePoints.length==0)
					smallIcon.image='images/Hex -Walker L DS.gif';          //Rowing  

			else if(xyz=='left')

				smallIcon.image='images/Hex -Walker L DS.gif';           //Rowing 
			else    

				smallIcon.image='images/Hex -Walker L DS.gif';           //Rowing 
		}
		if(xy==75)
		{
			if(routePoints.length==0)
					smallIcon.image='images/Refreshments.gif';          //Rowing  

			else if(xyz=='left')

				smallIcon.image='images/Refreshments.gif';           //Rowing 
			else    

				smallIcon.image='images/Refreshments.gif';           //Rowing 
		}
				if(xy==76)
		{
			if(routePoints.length==0)
					smallIcon.image='images/Shipwreck.gif';          //Rowing  

			else if(xyz=='left')

				smallIcon.image='images/Shipwreck.gif';           //Rowing 
			else    

				smallIcon.image='images/Shipwreck.gif';           //Rowing 
		}
	if(xy==77)
		{
			if(routePoints.length==0)
					smallIcon.image='images/SpecialInterest.gif';          //Rowing  

			else if(xyz=='left')

				smallIcon.image='images/SpecialInterest.gif';           //Rowing 
			else    

				smallIcon.image='images/SpecialInterest.gif';           //Rowing 
		}
			if(xy==78)
		{
			if(routePoints.length==0)
					smallIcon.image='images/SportsCentre.gif';          //Rowing  

			else if(xyz=='left')

				smallIcon.image='images/SportsCentre.gif';           //Rowing 
			else    

				smallIcon.image='images/SportsCentre.gif';           //Rowing 
		}
			if(xy==79)
		{
			if(routePoints.length==0)
					smallIcon.image='images/Taxi.gif';          //Rowing  

			else if(xyz=='left')

				smallIcon.image='images/Taxi.gif';           //Rowing 
			else    

				smallIcon.image='images/Taxi.gif';           //Rowing 
		}
					if(xy==80)
		{
			if(routePoints.length==0)
					smallIcon.image='images/sgrade1.gif';          //Rowing  

			else if(xyz=='left')

				smallIcon.image='images/sgrade1.gif';           //Rowing 
			else    

				smallIcon.image='images/sgrade1.gif';           //Rowing 
		}
							if(xy==81)
		{
			if(routePoints.length==0)
					smallIcon.image='images/Flowers.gif';          //Rowing  

			else if(xyz=='left')

				smallIcon.image='images/Flowers.gif';           //Rowing 
			else    

				smallIcon.image='images/Flowers.gif';           //Rowing 
		}
									if(xy==82)
		{
			if(routePoints.length==0)
					smallIcon.image='images/Windmill.gif';          //Rowing  

			else if(xyz=='left')

				smallIcon.image='images/Windmill.gif';           //Rowing 
			else    

				smallIcon.image='images/Windmill.gif';           //Rowing 
		}
											if(xy==83)
		{
			if(routePoints.length==0)
					smallIcon.image='images/Windsurfing.gif';          //Rowing  

			else if(xyz=='left')

				smallIcon.image='images/Windsurfing.gif';           //Rowing 
			else    

				smallIcon.image='images/Windsurfing.gif';           //Rowing 
		}
													if(xy==84)
		{
			if(routePoints.length==0)
					smallIcon.image='images/sgrade2.gif';          //Rowing  

			else if(xyz=='left')

				smallIcon.image='images/sgrade2.gif';           //Rowing 
			else    

				smallIcon.image='images/sgrade2.gif';           //Rowing 
		}
															if(xy==85)
		{
			if(routePoints.length==0)
					smallIcon.image='images/Hex -Watersports L DS.gif';          //Rowing  

			else if(xyz=='left')

				smallIcon.image='images/Hex -Watersports L DS.gif';           //Rowing 
			else    

				smallIcon.image='images/Hex -Watersports L DS.gif';           //Rowing 
		}
		if(xy==86)
		{
			if(routePoints.length==0)
					smallIcon.image='images/Woodland.gif';          //Rowing  

			else if(xyz=='left')

				smallIcon.image='images/Woodland.gif';           //Rowing 
			else    

				smallIcon.image='images/Woodland.gif';           //Rowing 
		}
			if(xy==87)
		{
			if(routePoints.length==0)
					smallIcon.image='images/fire.gif';          //Rowing  

			else if(xyz=='left')

				smallIcon.image='images/fire.gif';           //Rowing 
			else    

				smallIcon.image='images/fire.gif';           //Rowing 
		}
					if(xy==88)
		{
			if(routePoints.length==0)
					smallIcon.image='images/water.gif';          //Rowing  

			else if(xyz=='left')

				smallIcon.image='images/water.gif';           //Rowing 
			else    

				smallIcon.image='images/water.gif';           //Rowing 
		}
							if(xy==89)
		{
			if(routePoints.length==0)
					smallIcon.image='images/solar.gif';          //Rowing  

			else if(xyz=='left')

				smallIcon.image='images/solar.gif';           //Rowing 
			else    

				smallIcon.image='images/solar.gif';           //Rowing 
		}
									if(xy==90)
		{
			if(routePoints.length==0)
					smallIcon.image='images/wind.gif';          //Rowing  

			else if(xyz=='left')

				smallIcon.image='images/wind.gif';           //Rowing 
			else    

				smallIcon.image='images/wind.gif';           //Rowing 
		}



var marker = new GMarker (point, {
            draggable:true,
            icon:smallIcon
        });
        var SSP= document.getElementById('SSP').checked;
		
        if(frstClik==0 && SSP == false)
        {
			
            smallIcon = new GIcon();
            smallIcon.image = "images/GREEN-Start.gif";
            smallIcon.shadow = "http://labs.google.com/ridefinder/images/mm_20_shadow.png";
            smallIcon.iconSize = new GSize(25, 25);
            smallIcon.shadowSize = new GSize(22, 20);
            smallIcon.iconAnchor = new GPoint(6, 20);
            smallIcon.infoWindowAnchor = new GPoint(5, 1);
            var marker=new GMarker (point, {
                draggable:true,
                icon:smallIcon
            });
            map.addOverlay(marker);
			
            frstClik=frstClik+1;
            getHeight_ClickedPoints(point);
            //**********************************************

            marker.enableDragging();
            GEvent.addListener(marker,"dragend", function () {
                dragMarker(this);
            });


            routePoints.push(marker);
            if (routePoints.length>1){
                var markerLine=new GPolyline([routePoints[routePoints.length-2].getPoint(),routePoints[routePoints.length-1].getPoint()],  '#FF0000', 4);
                map.addOverlay(markerLine);
                routeLines.push(markerLine);
                if(FlagOutback==true){
                    DitstArr=new Array();
                    DitstArr[0]=0;
                    FlagOutback=false;
                }
                calcDistance();

                //if (routePoints.length>2){
                //alert(routePoints.length+"comes	1");'
                // --------New-----
                document.getElementById('divOver').style.display='block';
                // --------New-----
                setTimeout("bulidGraph()",500);

                // --------New-----17-11-08
                setTimeout("TransparentMap()",5000);
            

            }

               
        }
        else
        {

            
            
            if(SSP == false)
            {
                if(addMore!=0)
                {
                    point=routeLines.getPoint();
                }

                addMore=0;
                ver=0;
                
                var marker=new GMarker (point, {

                    draggable:true,
                    icon:smallIcon
                });
                if (IsDisplayIcon(xy) == true)
                {
                    map.addOverlay(marker);
                }

                //***calling height Graph Web service***********
                //alert("Point = " + point);
                getHeight_ClickedPoints(point);
                //**********************************************
	
                marker.enableDragging();
                GEvent.addListener(marker,"dragend", function () {
                    dragMarker(this);
                });

                routePoints.push(marker);
        
                if (routePoints.length>1){
                    var markerLine=new GPolyline([routePoints[routePoints.length-2].getPoint(),routePoints[routePoints.length-1].getPoint()],  '#FF0000', 4);
                    map.addOverlay(markerLine);
                    routeLines.push(markerLine);
                    if(FlagOutback==true){
                        DitstArr=new Array();
                        DitstArr[0]=0;
                        FlagOutback=false;
                    }
                    calcDistance();
		  
                    //if (routePoints.length>2){
                    //alert(routePoints.length+"comes	1");'
                    // --------New-----
                    document.getElementById('divOver').style.display='block';
                    // --------New-----
                    setTimeout("bulidGraph()",500);
			 
                    // --------New-----17-11-08
                    setTimeout("TransparentMap()",5000);
                // --------New-----
							
                }
		
                if (document.getElementById('autoPanTick').checked) {
                    map.panTo(point);
                }
               
            }
            else
            {
var horizontal= document.getElementById('horiz').checked;
                if(ver==0)
                {
                    var point2 =new GLatLng(point.lat(),point.lng());
                }
                else if(!horizontal)
                {
                    var point2=new GLatLng(parseFloat(point.lat())+0.002,point.lng());
                }
                else if(horizontal)
                {
                    var point2 =new GLatLng(point.lat(),parseFloat(point.lng())+0.005);
                }
			
                var marker=new GMarker (point2, {

                    draggable:true,
                    icon:smallIcon
                });
                map.addOverlay(marker);
                
                routside.push(marker);
               
                if(ver == 0)
                {
                   
                    // alert(horizontal);
                    if(!horizontal)
                    {
                        ver=1;
                    }
                    else
                    {
                        ver=2
                    }
                   
                    routside.push('marker');
                 
                    getHeight_ClickedPoints(point);
                    //**********************************************

                    marker.enableDragging();
                    GEvent.addListener(marker,"dragend", function () {
                        dragMarker(this);
                    });

                                 

                    if (routePoints.length>1){
                        var markerLine=new GPolyline([routePoints[routePoints.length-2].getPoint(),routePoints[routePoints.length-1].getPoint()],  '#FF0000', 4);
                        //  map.addOverlay(markerLine);
                        routeLines.push(markerLine);
                        if(FlagOutback==true){
                            DitstArr=new Array();
                            DitstArr[0]=0;
                            FlagOutback=false;
                        }
                        calcDistance();

                        //if (routePoints.length>2){
                        //alert(routePoints.length+"comes	1");'
                        // --------New-----
                        document.getElementById('divOver').style.display='block';
                        // --------New-----
                        setTimeout("bulidGraph()",500);

                        // --------New-----17-11-08
                        setTimeout("TransparentMap()",5000);
                    // --------New-----

                    }
                    heightQueue.push([marker.waypointId, point.lat(), point.lng()]);
                    heightQueueStatus=0;

              

                }
                //alert("addMore"+addMore);
                addMore=addMore+1;
                point1=point2;

            }
            
        
        }
	                

            
           
       
    /*User wants to add more than 1 markes on same place.*/
           			
    
    
			
    }
}

var StrHeight=0;
function getHeight_ClickedPoints(point)
{ 
    //alert(point.lat()+"		:	"+point.lng());
    var script = document.createElement('script');
    document.body.appendChild(script);
    //http://ws.geonames.org/gtopo30JSON?lat=47.01&lng=10.2

    script.src = ' http://ws.geonames.org/gtopo30JSON?lat=' + point.lat() + '&lng=' +point.lng()+ '&callback=loadJSON';
    document.getElementById('ResultHe').value = 'Sending request to ' + script.src;
//StrHeight=StrHeight+",";
}
var MapHeightArr=new Array();
var indexHeight=0;
var heightvv=0;
function loadJSON(ResultHe) 
{
    /*We might be receiving this value late, so overright it with the dummy value which we inserted earlier
	 * in buildGraph function*/
    /* -------New--------*/
    TransparentMap();
    /* -------New--------*/
    if (DitstArr.length == MapHeightArr.length)
    {
        indexHeight = indexHeight - 1;
    }
    var mainStr,str;
    mainStr=JSON.stringify(ResultHe);
    //alert(mainStr);
    document.getElementById('ResultHe').value=ResultHe.gtopo30;
    //alert("Value 1		:	"+ResultHe.gtopo30);
    if(ResultHe.gtopo30 != -9999)			//here -9999 means null value returned
    {
        //MapHeightArr[indexHeight]=ResultHe.gtopo30*3.28*3.28;
        MapHeightArr[indexHeight]=ResultHe.gtopo30*3.28;
        document.getElementById('ResultHe').value="";
    }
    else //if((ResultHe.gtopo30=="")||(ResultHe.gtopo30==null)||(ResultHe.gtopo30==-99999))
    {
        MapHeightArr[indexHeight]=0;
    }
    indexHeight=indexHeight+1;
	
    bulidGraph();
//setTimeout("bulidGraph()",500);
//alert("Value 2		:	"+ResultHe.gtopo30*3.28);
}

function showheight(strheight)
{
    document.getElementById('txtheightbox').value=strheight;
}

function IsDisplayIcon(pathIndex) 
{
    var retVal = false;
    if (pathIndex == oldMarkerImageIndex)
    {
        /*This is same marker so add a count and check if we should add a new marker or not*/
        var x= map.getZoom();
        //    alert("zoom="+x);
        if (x==14 && ClickCount == 20)
        {
            retVal = true;
            ClickCount = 1;   //Updated By HWS
        }
        else
        {
            ClickCount = ClickCount + 1;
        }
    }
    else
    {
        /*It is a new image so we need to show it and set the ClickCount to 1 */
        oldMarkerImageIndex = pathIndex;
        retVal = true;
        ClickCount = 1;
    }
    return retVal;
}
function getCoordinate(point) { 

} 
/*function  _CreateXMLHttpRequest_() {
   try { return new ActiveXObject("Msxml2.XMLHTTP"); } catch (e) {}
   try { return new ActiveXObject("Microsoft.XMLHTTP"); } catch (e) {}
   try { return new XMLHttpRequest(); } catch(e) {}
   alert("XMLHttpRequest not supported");
   return null;
}

function _SetupRequestEvent_(req, event, details) {
    req.onreadystatechange = function() {
        var responseState = new Object();
        responseState.responseText=(req.readyState == 4 ? req.responseText : '');
        responseState.readyState=req.readyState;
        responseState.responseHeaders=(req.readyState == 4 ? req.getAllResponseHeaders() : '');
        responseState.status=(req.readyState == 4 ? req.status : 0);
        responseState.statusText=(req.readyState == 4 ? req.statusText : '');
        if (details['onreadystatechange']) {
            setTimeout(function(){details['onreadystatechange'](responseState);}, 0);
        }
        if (details['onerror']) {
            if (responseState.readyState==4 && responseState.status!=200) {
                setTimeout(function(){details['onerror'](responseState);}, 0);
            }
        }
        if (details['onload']) {
            if (responseState.readyState==4 && responseState.status==200) {
                setTimeout(function(){details['onload'](responseState);}, 0);
            }
        }
    }
}*/

/*function _xmlhttpRequest(details) {
   var url = details.url;
   var xhReq=_CreateXMLHttpRequest_();
   _SetupRequestEvent_(xhReq, "onreadystatechange", details);
   xhReq.open(details.method, url, true);
   if (details.headers) {
      for (var prop in details.headers) {
         xhReq.setRequestHeader(prop, details.headers[prop]);
      }
   }
   xhReq.send(details.data);
}*/

//function receiveError(xmlHttp) {
//alert('Error : '+xmlHttp.responseText);
//}
var map;
var smallIcon;
var routePoints = new Array;
var routeLines = new Array;
var routeHeight = new Array;
var editPoints = new Array;
var unsaved=false;
var heightQueue=[];
var heightQueueStatus=1;


var loggedin=false;

var FlagOutback=false;

var distanceUnits='miles';
var heightGraphUnits='ft / mile';
var earthRadius=3959;
var heightUnit=1;
var unitHeight=3.28084;
var DitstArr=new Array();
DitstArr[0]=0;
getDistance = function(p1, p2) {
    return Math.acos(Math.sin(p1.latRadians())*Math.sin(p2.latRadians()) + Math.cos(p1.latRadians())*Math.cos(p2.latRadians())*Math.cos(p2.lngRadians()-p1.lngRadians())) * earthRadius;
  
}

var distance=0.0;
var distance1=0.0;
//var str;
var FlagDistType=false; //miles
calcDistance = function()
{
    distance=0.0;
    distance1=0.0;
    // alert(routePoints.length);
    for (var i=0; i<(routePoints.length-1); i++)
    {
		
        //  dist=dist*1.6
        /*if(document.getElementById('rdMi').checked == true)
{

			distance+=getDistance(routePoints[i].getPoint(), routePoints[i+1].getPoint()); //Total Distance in Mi
			distanceUnits='miles';
		}
		else
		{
			distanceUnits="Km";
			distance+=getDistance(routePoints[i].getPoint(), routePoints[i+1].getPoint())*1.6;  //Total Distance in KM
		}
		
		if(FlagOutback==false)
		{ */
        if(document.getElementById('rdMi').checked == true)
        {
		
            distanceUnits='miles';
            distance1+=getDistance(routePoints[i].getPoint(), routePoints[i+1].getPoint());
        }
        else
        {
            distance1+=getDistance(routePoints[i].getPoint(), routePoints[i+1].getPoint())*1.6;
            distanceUnits='Km';
        }
        DitstArr[i+1]=distance1.toFixed(2);
    //}
    }
    //alert("distance="+distance1);
    //alert("DitstArr="+DitstArr);
    //document.getElementById('totalDistance').value=distance.toFixed(2)+' '+distanceUnits ;  // ''Total Distance : '<br>
    //document.getElementById('dist').value=distance.toFixed(2);
    document.getElementById('totalDistance').value=distance1.toFixed(2)+' '+distanceUnits ;  // ''Total Distance : '<br>
    document.getElementById('dist').value=distance1.toFixed(2);
}


function distanceTo(j) 
{
    d=0.0;
    for (var i=0; i<j; i++)
    {
        d+=getDistance(routePoints[i].getPoint(), routePoints[i+1].getPoint());
    }
    return d;
}



function heightError(xmlHttp) {
    routeHeight.push(0);
    drawHeightGraph();
}

function changeMapType() {
    var mapTypeName={
        'Map':0,
        'Satellite':1,
        'Hybrid':2,
        'Contour':3
    };
    document.getElementById("defaultmap").value=mapTypeName[map.getCurrentMapType().getName()];
}

function dragMarker(m) {
    heightQueue.push([m.waypointId, m.getPoint().lat(), m.getPoint().lng()]);
    heightQueueStatus=0;
    if (m.waypointId>0){
        var prevLine=routeLines[m.waypointId-1];
        map.removeOverlay(prevLine);
        var newPrevLine=new GPolyline([routePoints[m.waypointId-1].getPoint(),routePoints[m.waypointId].getPoint()],  '#FF0000', 4);
        map.addOverlay(newPrevLine);
        routeLines[m.waypointId-1]=newPrevLine;
    }
    if (m.waypointId<(routePoints.length-1)){
        var nextLine=routeLines[m.waypointId];
        map.removeOverlay(nextLine);
        var newNextLine=new GPolyline([routePoints[m.waypointId].getPoint(),routePoints[m.waypointId+1].getPoint()],  '#FF0000', 4);
        map.addOverlay(newNextLine);
        routeLines[m.waypointId]=newNextLine;
    }
    calcDistance();
}




/*function getHeights(ontimer){
    if (ontimer) {
      setTimeout("getHeights(1)",20000);
      if (document.getElementById('autoHeightTick').checked==false) {return false;}
    }
	//alert(routeHeight);
    r='';
    while(heightQueue.length>0) {
      var p=heightQueue.pop();
      
      r+=''+p[0]+','+p[1]+','+p[2]+';';
    }
    if (r!='') {
	//	alert("seconds");
      document.getElementById("heightGraphP").innerHTML="Height Graph(...calculating...)<br>[Note	:	Height graph is still under development] ";
   //   _xmlhttpRequest({method: 'POST', url: '/newroute/elevation/batch/', data:r, onload : addBatchHeights, onerror : heightError});
    }
//    document.getElementById("heightGraphP").innerHTML="Height Graph";
	return false;
}

function addHeight(xmlhttp){
  var h=parseInt(xmlhttp.responseText);

 if (isNaN(h)) h=0;
  if (h<0) h=0;
  if (h>32000) h=0;
  if (editPoints.length>0) {
    routeHeight[editPoints.pop()]=h*unitHeight;
  } else {
    routeHeight.push(h*unitHeight);
  }

 //document.routeForm.routeContent.value=routeHeight;
 //drawHeightGraph();
}

function addBatchHeights(xmlhttp){
	
eval(xmlhttp.responseText);


}

function processHeights(hlist) {
  for (var i=0; i<hlist.length; i++) {
    if (routePoints[hlist[i][0]]!=null) {	
      routeHeight[hlist[i][0]]=hlist[i][1]*unitHeight;      
    }
  }
 // alert("routeheight hhh	:	"+routeHeight);
  drawHeightGraph();
  heightQueueStatus=1;
}*/

function confirmExit() {
    if (unsaved) {
        return "Your route has not been saved, and will be lost if you leave this page";
    }
}


function load() {

    if (GBrowserIsCompatible()) {
	
        var imageurl = "http://landscape-guides.co.uk/images/padarn.png";
        var imageurl = "http://landscape-guides.co.uk/images/padarn.png";
	
        map = new GMap2(document.getElementById("map"), {
            draggableCursor:'crosshair',
            draggingCursor:'hand'
        });
        map.addControl(new GLargeMapControl());
        map.addControl(new GScaleControl(),new GControlPosition(G_ANCHOR_BOTTOM_LEFT, new GSize(100,0)))
        map.addControl(new GMapTypeControl(),new GControlPosition(G_ANCHOR_TOP_RIGHT, new GSize(2,2)));
        map.enableScrollWheelZoom();
        map.setCenter(new GLatLng(53.125453,-4.117126), 14);
		  

       
        //earlier code
	   
        /*smallIcon = new GIcon();
      document.getElementById('radio1').checked=1
//document.getElementById('radio2').checked=1
    smallIcon.image = "images/Hex -Runner R DS.jpg";
	smallIcon.shadow = "http://labs.google.com/ridefinder/images/mm_20_shadow.png";
	smallIcon.iconSize = new GSize(25, 25);
	smallIcon.shadowSize = new GSize(22, 20);            
	smallIcon.iconAnchor = new GPoint(6, 20);
	smallIcon.infoWindowAnchor = new GPoint(5, 1);
	document.getElementById('mark').value=0;*/
	
	   
        smallIcon = new GIcon();
        //document.getElementById('radio1').checked=1
        document.getElementById('radio2').checked=1
        //smallIcon.image = "images/Hex -Runner R DS.jpg";
        smallIcon.image="images/Hex -Walker R DS.gif";
	
        smallIcon.shadow = "http://labs.google.com/ridefinder/images/mm_20_shadow.png";
        smallIcon.iconSize = new GSize(25, 25);
        smallIcon.shadowSize = new GSize(22, 20);
        smallIcon.iconAnchor = new GPoint(6, 20);
        smallIcon.infoWindowAnchor = new GPoint(5, 1);
        //	document.getElementById('mark').value=0;
        document.getElementById('mark').value=1;
	   
	   
	   
	   
        var searchFormElement = document.getElementById("searchcontrol");
        var drawOptions = new GdrawOptions();
        drawOptions.setDrawMode(GSearchControl.DRAW_MODE_LINEAR);
		
		
        var searchControl = new GSearchControl();
        var localSearch = new GlocalSearch();
        var options = new GsearcherOptions();
        options.setExpandMode(GSearchControl.EXPAND_MODE_CLOSED);
        searchControl.addSearcher(localSearch, options);
        localSearch.setCenterPoint(map);
        searchControl.draw(document.getElementById("searchcontrol"));
        //searchControl.draw(searchFormElement, drawOptions);
        searchControl.setSearchCompleteCallback(this, function(sc, s) {
            if (map.getZoom()<13) map.setZoom(13);
            //alert(s.results.length + " / " +  s.results[0].lat + " / " + s.results[0].lng)
            if(s.results.length > 0){
                map.setCenter(new GLatLng(parseFloat(s.results[0].lat), parseFloat(s.results[0].lng)));
                if(ie4)
                    ;//searchControl.draw(document.getElementById("searchcontrol"));
            }
        });

        GEvent.addListener(map, "maptypechanged", changeMapType);

        GEvent.addListener(map, "click", mapClick);

       
    }


    CustomGetTileUrl=function(a,b){
        var c=Math.pow(2,b); var d=a.x; var e=a.y; var f="t"; for(var g=0;g<b;g++){
            c=c/2; if(e<c){
                if(d<c){
                    f+="q";
                } else{
                    f+="r"; d-=c;
                }
            }
            else{
                if(d<c){
                    f+="t"; e-=c;
                } else{
                    f+="s"; d-=c; e-=c;
                }
            }
        }
        var tileid = f; var tileLen = tileid.length; var i = 0; var tilePath = ""; while(i+3 < tileLen) { 
            tilePath += tileid.substr(i,3); tilePath += '/'; i += 3;
        } tilePath += tileid.substr(i);
        tilePath += '.png'; return "http://www.earthtools.org/tiles/" + tilePath;
    }
    function ContourIntervalControl() { }
    ContourIntervalControl.prototype = new GControl();
    ContourIntervalControl.prototype.initialize = function(map) {
        var c = document.createElement("div"); var d = document.createElement("div"); this.setButtonStyle_(d); c.appendChild(d); d.appendChild(document.createTextNode("Contour Interval: 10m")); d.id = "ciDiv"; map.getContainer().appendChild(c); return c;
    }
    ContourIntervalControl.prototype.getDefaultPosition = function() {
        return new GControlPosition(G_ANCHOR_BOTTOM_LEFT, new GSize(2, 35));
    }
    ContourIntervalControl.prototype.setButtonStyle_ = function(button) {
        button.style.color = "#ffffff"; button.style.backgroundColor = "transparent"; button.style.font
        = "small Arial"; button.style.border = "0px"; button.style.padding = "0px"; button.style.marginBottom = "0px"; button.style.textAlign = "left";
    }

    var tilelayers = [new GTileLayer(new GCopyrightCollection(""),0,17)];
    tilelayers[0].getTileUrl = CustomGetTileUrl;
    tilelayers[0].getCopyright = function(a,b) {
        return "Contour maps &copy;2006 earthtools.org";
    }
    tilelayers[0].getCopyright = function(a,b) {
        return {
            prefix:"Contour map: &copy; ",
            copyrightTexts:["2006 earthtools.org"]
        };
    }
    var _mMapError =  null;
    var htilelayers = [G_NORMAL_MAP.getTileLayers()[0], tilelayers[0]];
    var custommap2 = new GMapType(htilelayers, G_NORMAL_MAP.getProjection(), "Contour", {
        maxResolution:14,
        minResolution:0,
        errorMessage:_mMapError
    });
    map.addMapType(custommap2);

    tilelayers[0].getOpacity = function (){
        if (map.getCurrentMapType() == G_NORMAL_MAP) {
            return 0.35;
        } else {
            return 0.35;
        }
    }

    var mapType = "Map";
    if (mapType == "Satellite") {
        map.setMapType(G_SATELLITE_MAP);
    } else if (mapType == "Hybrid") {
        map.setMapType(G_HYBRID_MAP);
    } else if (mapType == "Contour") {
        map.setMapType(custommap2);
    } else {
        map.setMapType(G_NORMAL_MAP);
    }
    
}

function NewMap()
{

    if(routside.length)
    {
 
        while(routside.length > 0)
        {
            var  marker=routside.pop();
            map.removeOverlay(marker);
        }
   
    }
   
if(routePoints.length)
    {
    while(routePoints.length>0)
    {
        undoLastMarker();
    }
}
 if(routeLines.length)
     {
 while(routeLines.length>0)
    {
        if (routeLines.length>0){
            var markerLine=routeLines.pop();
            map.removeOverlay(markerLine);
        }
    }
     }
   // map.clearOverlay();
    ClickCount = 0;
    oldMarkerImageIndex = -1;
    MapHeightArr=new Array();		//re seting the values for hight graph
    DitstArr=new Array();
	
    indexHeight=0;
    DitstArr[0]=0;
	
    //alert("routePoints.length="+routePoints.length);
    // for first marker
    frstClik=0;
    var d2=new Array();
    FinalHeight=new Array();
    Finaldist=new Array();
    ArrayY=new Array();
    ArrayX=new Array();
    s=0;
	
    ResetGraph();
	
//setTimeout("MakeNewGraph();", 500);
//setTimeout("bulidGraph();", 500);
}


function ResetGraph()
{

    /*	var d2=new Array();
	FinalHeight=new Array();
	Finaldist=new Array();
	ArrayY=new Array();
	ArrayX=new Array();
	s=0;*/
	

  
    document.getElementById('placeholder').innerHTML="";
    document.getElementById('placeholder').innerHTML="<br> <br> <br> <br> <strong>Click-on 'Show Profile Graph' for Automatic Profile to appear</strong>";
    document.getElementById('divOver').style.display='none';
	
//setTimeout("bulidGraph()",100);
//	bulidGraph();
	
	

}





function undoLastMarker(){

   if(routePoints.length)
    {
        var marker=routePoints.pop();

        map.removeOverlay(marker);
    }

    if (routeLines.length){
        var markerLine=routeLines.pop();
        map.removeOverlay(markerLine);
    }
    
    if(routside.length)
    {
    var marker=routside.pop();
    while(marker !='marker')
        {
           
            map.removeOverlay(marker);
            if(routside.length)
                {
            marker=routside.pop();
                }
                else
                    {
                        break;
                    }
            

        }
    }

    if (ClickCount > 0)
    {
        ClickCount = ClickCount - 1;
    //*********************undo/removing points from last element in the stack***********************
    //DitstArr[DitstArr.length]=null;
    //MapHeightArr[DitstArr.length]=null;
    //alert("undo.....");
    //undoPointsFromArray();
    //***********************************************************************************************
    }
    calcDistance();
    if (heightQueue.length>0) {
        heightQueue.pop();
        undoPointsFromArray();
    } else {
        routeHeight.pop();
        undoPointsFromArray();
    }
 
    return false;
}

function undoPointsFromArray()
{
    if(DitstArr.length>1)
    {
        /*alert("MapHeightArr="+MapHeightArr);
			alert("DitstArr="+DitstArr);
			 alert("ArrayX="+ArrayX);
			 alert("ArrayY="+ArrayY);*/
        DitstArr.splice(DitstArr.length-1,1);
        MapHeightArr.splice(MapHeightArr.length-1,1);
        indexHeight=indexHeight-1;
        /* d2=new Array();
	FinalHeight=new Array();
	Finaldist=new Array();
	ArrayY=new Array();
	ArrayX=new Array();
	s=0;*/
			
        /*alert("MapHeightArr[MapHeightArr.length-1]="+MapHeightArr[MapHeightArr.length-1]);
			alert("ArrayY[ArrayY.length-1]="+ArrayY[ArrayY.length-1]);
    
	   alert("DitstArr[DitstArr.length-1]="+DitstArr[DitstArr.length-1]);
alert("ArrayX[ArrayX.length-1]="+ArrayX[ArrayX.length-1]);*/
        if(ArrayX[ArrayX.length-2]>DitstArr[DitstArr.length-1])
        {
            //alert("ArrayX="+ArrayX);
            ArrayX.splice(ArrayX.length-1,1);
        }
        if(DitstArr[DitstArr.length-1]<ArrayX[ArrayX.length-1])
        {
			
            //alert("ArrayX="+ArrayX);
            ArrayX[ArrayX.length-1]=DitstArr[DitstArr.length-1];
            //alert("ArrayX="+ArrayX);
            //alert("ArrayY="+ArrayY);
            // ArrayY.splice(ArrayY.length-1,1);
            //alert("ArrayY="+ArrayY);
            ArrayY[ArrayY.length-1]=MapHeightArr[MapHeightArr.length-1];
        // alert("ArrayY="+ArrayY);
        }
		
		
    /*ArrayY.splice(ArrayY.length-1,1);
			alert("ArrayY="+ArrayY);
	     ArrayX.splice(ArrayX.length-1,1);
			FinalHeight.splice(FinalHeight.length-1,1);
	Finaldist.splice(Finaldist.length-1,1);
	alert("MapHeightArr="+MapHeightArr);
	alert("DitstArr="+DitstArr);
	alert("ArrayX="+ArrayX);
	alert("FinalHeight="+FinalHeight);
	alert("Finaldist="+Finaldist);*/
    //ResetGraph();
    //bulidGraph();
    //setTimeout("bulidGraph();", 100);
			
    }
    else
    {
        MapHeightArr=new Array();
        DitstArr=new Array();
        indexHeight=0;
        DitstArr[0]=0;
        ResetGraph();
			
    }
}

function outAndBack(){
    var inRoutes=routePoints.length-2;
    unsaved=true;
    //alert("out anb back 1"+routePoints.length)
    for (var i=inRoutes; i>=0; i--) {
        var point=routePoints[i].getPoint();
        var marker=new GMarker (point, {
            draggable:true,
            icon:smallIcon
        });
   
        marker.waypointId=routePoints.length;
        //map.addOverlay(marker);
        marker.enableDragging();
        GEvent.addListener(marker,"dragend", function () {
            dragMarker(this);
        });

        routePoints.push(marker);
        getHeight_ClickedPoints(point);
        if (routePoints.length>1){
            var markerLine=new GPolyline([routePoints[routePoints.length-2].getPoint(),routePoints[routePoints.length-1].getPoint()],  '#FF0000', 4);
            map.addOverlay(markerLine);
            routeLines.push(markerLine);
            FlagOutback=true;
            calcDistance();
	 
            bulidGraph();
	
        }
    //heightQueue.push([marker.waypointId, point.lat(), point.lng()]);
    //heightQueueStatus=0;
    }
    //alert("out anb back 2"+routePoints.length)
    if (document.getElementById('autoPanTick').checked) {
        map.panTo(point);
    }
	
    oldMarkerImageIndex = -1;
    ClickCount  = 0;
    return false;
}

/*function loginUserForm() {
  document.getElementById('userlogin').style.visibility='visible';
  document.getElementById('userlogin').style.display='block';
  document.getElementById('userlogin').style['height']='200px';
  return false;
}

function loginUser() {
  if (!document.getElementById('tandc').checked) {
    document.getElementById('loginMessage').innerHTML="<b>Please accept the terms and conditions</b>";
    return false;
  }
  document.getElementById('loginMessage').innerHTML="Please wait...";
  var username=document.getElementById('username').value;
  var password=document.getElementById('password').value;
  var email=document.getElementById('email').value;
  _xmlhttpRequest({method: 'POST', url: '/register/login/', data:'username='+escape(username)+'&password='+escape(password)+'&email='+escape(email), onload : loginUserResult, onerror : heightError});
  return false;
}

function loginUserResult(xmlhttp) {
  if (document.getElementById('sessi').value=='yes') {
    loggedin=true;
    saveRoute();
  } else {
    document.getElementById('loginMessage').innerHTML=xmlhttp.responseText;
  }
}*/

function copysaveRoute() {
    var rData="";
    var startDay=document.getElementById("startDay");
    var startMonth=document.getElementById("startMonth");
    var startYear=document.getElementById("startYear");
    var startHour=document.getElementById("startHour");
    var startMinute=document.getElementById("startMinute");
    var durationHour=document.getElementById("durationHour");
    var durationMinute=document.getElementById("durationMinute");
    var durationSecond=document.getElementById("durationSecond");
    var totalSeconds=(parseInt(durationSecond.options[durationSecond.selectedIndex].value))+(60*parseInt(durationMinute.options[durationMinute.selectedIndex].value))+(60*60*parseInt(durationHour.options[durationHour.selectedIndex].value));

    var startDate=new Date();
    startDate.setYear(parseInt(startYear.options[startYear.selectedIndex].value));
    startDate.setMonth(parseInt(startMonth.options[startMonth.selectedIndex].value)-1);
    startDate.setDate(parseInt(startDay.options[startDay.selectedIndex].value));
    startDate.setHours(parseInt(startHour.options[startHour.selectedIndex].value));
    startDate.setMinutes(parseInt(startMinute.options[startMinute.selectedIndex].value));
    startDate.setSeconds(0);

    var t=startDate.getTime()/1000;
    var x=0;
    var y=0;

    var d=0;
    var j=0;
    var xarr=new Array;
    var yarr=new Array;
    for (var i=0; i<(routePoints.length); i++){
        t=totalSeconds+(startDate.getTime()/1000);
        xarr[i]=routePoints[i].getPoint().lat();
        yarr[i]=routePoints[i].getPoint().lng();
    }

    for (var i=0,j=1; i<(routePoints.length-1); i++,j++){
        t=totalSeconds+(startDate.getTime()/1000);
        x=69.1*((xarr[j])-(routePoints[i].getPoint().lat()));
        y=69.1*((yarr[j])-(routePoints[i].getPoint().lng()))*Math.cos(routePoints[i].getPoint().lat()/57.3);
        d=Math.sqrt(x*x+y*y);
	 
        if (i==routePoints.length-2)
        {
            d=d*10;
            rData+=5*d;
        }
        else
        {
            d=d*10;
            rData+=5*d+',';
        }
        unsaved=false;
    }
    document.getElementById("routeContent").value=rData;
//document.getElementsByName("routeContent")[0].value=rData;
}





function saveRoute() {
    if (document.getElementById('sessi').value=='yes')
        loggedin=true;
    if (!loggedin)
        return loginUserForm();
    if (heightQueueStatus!=1) {
        if (heightQueueStatus==0) {
            //getHeights();
            heightQueueStatus=2;
        } else {
            heightQueueStatus=heightQueueStatus+1;
        }
        if (heightQueueStatus<100) {
            setTimeout("saveRoute()", 300);
            return false;
        }
    }
    var routeData="";
    var startDay=document.getElementById("startDay");
    var startMonth=document.getElementById("startMonth");
    var startYear=document.getElementById("startYear");
    var startHour=document.getElementById("startHour");
    var startMinute=document.getElementById("startMinute");
    var durationHour=document.getElementById("durationHour");
    var durationMinute=document.getElementById("durationMinute");
    var durationSecond=document.getElementById("durationSecond");
    var totalSeconds=(parseInt(durationSecond.options[durationSecond.selectedIndex].value))+(60*parseInt(durationMinute.options[durationMinute.selectedIndex].value))+(60*60*parseInt(durationHour.options[durationHour.selectedIndex].value));

    var startDate=new Date();
    startDate.setYear(parseInt(startYear.options[startYear.selectedIndex].value));
    startDate.setMonth(parseInt(startMonth.options[startMonth.selectedIndex].value)-1);
    startDate.setDate(parseInt(startDay.options[startDay.selectedIndex].value));
    startDate.setHours(parseInt(startHour.options[startHour.selectedIndex].value));
    startDate.setMinutes(parseInt(startMinute.options[startMinute.selectedIndex].value));
    startDate.setSeconds(0);
  
    var t=startDate.getTime()/1000;

    var d=0;
    for (var i=1; i<(routePoints.length); i++){
        d=getDistance(routePoints[i-1].getPoint(), routePoints[i].getPoint());
        t+=(totalSeconds*(d/distance));
        if (i==routePoints.length-1) {
            t=totalSeconds+(startDate.getTime()/1000);
        }
        routeData+=''+t.toFixed(1)+','+routePoints[i].getPoint().lat()+','+routePoints[i].getPoint().lng()+','+routeHeight[i]/unitHeight+'M, 0\n';
        rData+=''+t.toFixed(1)+','+routePoints[i].getPoint().lat()+','+routePoints[i].getPoint().lng();
    }
    unsaved=false;
    document.routeForm.routeContent.value=routeData;
    document.getElementById("routeContentData").value=routeData;
    document.getElementById("routeForm").submit();
    return false;
}

function showTimings(v) {
    if (v==1) {
        document.getElementById('timings').style.visibility='visible';
        document.getElementById('timings').style.display='block';
        document.getElementById('timings').style['height']='105px';
        document.getElementById('istimed').checked=1;
        document.getElementById('untimed').checked=0;
        document.getElementById('timedValue').value='1;'
    } else {
        document.getElementById('timings').style.visibility='hidden';
        document.getElementById('timings').style.display='none';
        document.getElementById('timings').style['height']='0px';
        document.getElementById('untimed').checked=1;
        document.getElementById('istimed').checked=0;
        document.getElementById('timedValue').value='0';
    }
    return true;
}

/*function findAddress() {
  var a=document.getElementById('address').value;
  _xmlhttpRequest({method: 'POST', url: '/newroute/address/', data:'a:'+escape(a), onload : showAddress, onerror : heightError});
  return false;
}

function showAddress(xmlhttp) {
  alert(xmlhttp.responseText);
}*/


function newload(x)
{
		
//alert(x);
	if(x==0)
	{
		document.getElementById('radio1').checked=1;

		if(document.getElementById('radio1').checked=1)
		{
			smallIcon = new GIcon();
			document.getElementById('radio1').checked=1
				smallIcon.image = "images/Country Park.gif";
			smallIcon.shadow = "http://labs.google.com/ridefinder/images/mm_20_shadow.png";
			smallIcon.iconSize = new GSize(25, 25);
			smallIcon.shadowSize = new GSize(22, 20);
			smallIcon.iconAnchor = new GPoint(6, 20);
			smallIcon.infoWindowAnchor = new GPoint(5, 1);
		}
	}
	if(x==1)
	{

		document.getElementById('radio2').checked=1;

		if(document.getElementById('radio2').checked=1)
		{


			smallIcon = new GIcon();
			smallIcon.image = "images/Church or Chapel.gif";
			smallIcon.shadow = "http://labs.google.com/ridefinder/images/mm_20_shadow.png";
			smallIcon.iconSize = new GSize(25, 25);
			smallIcon.shadowSize = new GSize(22, 20);
			smallIcon.iconAnchor = new GPoint(6, 20);
			smallIcon.infoWindowAnchor = new GPoint(5, 1);
		}
	}
	if(x==2)
	{

		document.getElementById('radio3').checked=1;
		if(document.getElementById('radio3').checked=1)
		{
			smallIcon = new GIcon();
			document.getElementById('radio3').checked=1
				smallIcon.image = "images/Eating.gif";
			smallIcon.shadow = "http://labs.google.com/ridefinder/images/mm_20_shadow.png";
			smallIcon.iconSize = new GSize(25, 25);
			smallIcon.shadowSize = new GSize(22, 20);
			smallIcon.iconAnchor = new GPoint(6, 20);
			smallIcon.infoWindowAnchor = new GPoint(5, 1);
		}
	}
	if(x==3)
	{

		document.getElementById('radio4').checked=1;
		if(document.getElementById('radio4').checked=1)
		{
			smallIcon = new GIcon();

			smallIcon.image = "images/Entertainment.gif";
			smallIcon.shadow = "http://labs.google.com/ridefinder/images/mm_20_shadow.png";
			smallIcon.iconSize = new GSize(25, 25);
			smallIcon.shadowSize = new GSize(22, 20);
			smallIcon.iconAnchor = new GPoint(6, 20);
			smallIcon.infoWindowAnchor = new GPoint(5, 1);
		}
	}
	if(x==4)
	{

		document.getElementById('radio5').checked=1;
		if(document.getElementById('radio5').checked=1)
		{
			smallIcon = new GIcon();

			smallIcon.image = "images/Historical.gif";
			smallIcon.shadow = "http://labs.google.com/ridefinder/images/mm_20_shadow.png";
			smallIcon.iconSize = new GSize(25, 25);
			smallIcon.shadowSize = new GSize(22, 20);
			smallIcon.iconAnchor = new GPoint(6, 20);
			smallIcon.infoWindowAnchor = new GPoint(5, 1);
		}
	}



	if(x==5)
	{

		document.getElementById('radio6').checked=1;
		if(document.getElementById('radio6').checked=1)
		{
			smallIcon = new GIcon();

			smallIcon.image = "images/Hotel.gif";
			smallIcon.shadow = "http://labs.google.com/ridefinder/images/mm_20_shadow.png";
			smallIcon.iconSize = new GSize(25, 25);
			smallIcon.shadowSize = new GSize(22, 20);
			smallIcon.iconAnchor = new GPoint(6, 20);
			smallIcon.infoWindowAnchor = new GPoint(5, 1);
		}
	}



	if(x==6)
	{

		document.getElementById('radio7').checked=1;
		if(document.getElementById('radio7').checked=1)
		{
			smallIcon = new GIcon();

			smallIcon.image = "images/Industrial.gif";
			smallIcon.shadow = "http://labs.google.com/ridefinder/images/mm_20_shadow.png";
			smallIcon.iconSize = new GSize(25, 25);
			smallIcon.shadowSize = new GSize(22, 20);
			smallIcon.iconAnchor = new GPoint(6, 20);
			smallIcon.infoWindowAnchor = new GPoint(5, 1);
		}
	}


	if(x==7)
	{

		document.getElementById('radio8').checked=1;
		if(document.getElementById('radio8').checked=1)
		{
			smallIcon = new GIcon();

			smallIcon.image = "images/Museum.gif";
			smallIcon.shadow = "http://labs.google.com/ridefinder/images/mm_20_shadow.png";
			smallIcon.iconSize = new GSize(25, 25);
			smallIcon.shadowSize = new GSize(22, 20);
			smallIcon.iconAnchor = new GPoint(6, 20);
			smallIcon.infoWindowAnchor = new GPoint(5, 1);
		}
	}
	if(x==8)
	{

		document.getElementById('radio9').checked=1;
		if(document.getElementById('radio9').checked=1)
		{
			smallIcon = new GIcon();

			smallIcon.image = "images/NT.gif";
			smallIcon.shadow = "http://labs.google.com/ridefinder/images/mm_20_shadow.png";
			smallIcon.iconSize = new GSize(25, 25);
			smallIcon.shadowSize = new GSize(22, 20);
			smallIcon.iconAnchor = new GPoint(6, 20);
			smallIcon.infoWindowAnchor = new GPoint(5, 1);
		}
	}
	if(x==9)
	{

		document.getElementById('radio10').checked=1;
		if(document.getElementById('radio10').checked=1)
		{
			smallIcon = new GIcon();

			smallIcon.image = "images/RockClimbing.gif";
			smallIcon.shadow = "http://labs.google.com/ridefinder/images/mm_20_shadow.png";
			smallIcon.iconSize = new GSize(25, 25);
			smallIcon.shadowSize = new GSize(22, 20);
			smallIcon.iconAnchor = new GPoint(6, 20);
			smallIcon.infoWindowAnchor = new GPoint(5, 1);
		}
	}
	if(x==10)
	{

		document.getElementById('radio11').checked=1;
		if(document.getElementById('radio11').checked=1)
		{
			smallIcon = new GIcon();

			smallIcon.image = "images/Ports.gif";
			smallIcon.shadow = "http://labs.google.com/ridefinder/images/mm_20_shadow.png";
			smallIcon.iconSize = new GSize(25, 25);
			smallIcon.shadowSize = new GSize(22, 20);
			smallIcon.iconAnchor = new GPoint(6, 20);
			smallIcon.infoWindowAnchor = new GPoint(5, 1);
		}
	}

	if(x==11)
	{

		document.getElementById('radio12').checked=1;
		if(document.getElementById('radio12').checked=1)
		{
			smallIcon = new GIcon();

			smallIcon.image = "images/Cycling.gif";
			smallIcon.shadow = "http://labs.google.com/ridefinder/images/mm_20_shadow.png";
			smallIcon.iconSize = new GSize(25, 25);
			smallIcon.shadowSize = new GSize(22, 20);
			smallIcon.iconAnchor = new GPoint(6, 20);
			smallIcon.infoWindowAnchor = new GPoint(5, 1);
		}
	}
	//************new Icon added by HWS********************************************
	if(x==12)
	{
	
		document.getElementById('radio13').checked=1;
		if(document.getElementById('radio13').checked=1)
		{
			smallIcon = new GIcon();

			smallIcon.image = "images/cliffDangerSignfinal.gif";
			smallIcon.shadow = "http://labs.google.com/ridefinder/images/mm_20_shadow.png";
			smallIcon.iconSize = new GSize(25, 25);
			smallIcon.shadowSize = new GSize(22, 20);
			smallIcon.iconAnchor = new GPoint(6, 20);
			smallIcon.infoWindowAnchor = new GPoint(5, 1);
		}
	//alert("12"+smallIcon.image);
	}
	if(x==13)
	{

		document.getElementById('radio14').checked=1;
		if(document.getElementById('radio14').checked=1)
		{
			smallIcon = new GIcon();

			smallIcon.image = "images/fastdeepwaterfinal.gif";
			smallIcon.shadow = "http://labs.google.com/ridefinder/images/mm_20_shadow.png";
			smallIcon.iconSize = new GSize(25, 25);
			smallIcon.shadowSize = new GSize(22, 20);
			smallIcon.iconAnchor = new GPoint(6, 20);
			smallIcon.infoWindowAnchor = new GPoint(5, 1);
		}
		//alert("13"+smallIcon.image);
	}
	//	*****************new icon added by bhavna for Rowing
if(x==14)
	{

		document.getElementById('radio15').checked=1;
		if(document.getElementById('radio15').checked=1)
		{
			smallIcon = new GIcon();

			smallIcon.image = "images/OldMachinery.gif";
			smallIcon.shadow = "http://labs.google.com/ridefinder/images/mm_20_shadow.png";
			smallIcon.iconSize = new GSize(25, 25);
			smallIcon.shadowSize = new GSize(22, 20);
			smallIcon.iconAnchor = new GPoint(6, 20);
			smallIcon.infoWindowAnchor = new GPoint(5, 1);
		}
	}
if(x==15)
	{

		document.getElementById('radio16').checked=1;
		if(document.getElementById('radio16').checked=1)
		{
			smallIcon = new GIcon();

			smallIcon.image = "images/Quarry.gif";
			smallIcon.shadow = "http://labs.google.com/ridefinder/images/mm_20_shadow.png";
			smallIcon.iconSize = new GSize(25, 25);
			smallIcon.shadowSize = new GSize(22, 20);
			smallIcon.iconAnchor = new GPoint(6, 20);
			smallIcon.infoWindowAnchor = new GPoint(5, 1);
		}
	}
if(x==16)
	{

		document.getElementById('radio17').checked=1;
		if(document.getElementById('radio17').checked=1)
		{
			smallIcon = new GIcon();

			smallIcon.image = "images/Railway.gif";
			smallIcon.shadow = "http://labs.google.com/ridefinder/images/mm_20_shadow.png";
			smallIcon.iconSize = new GSize(25, 25);
			smallIcon.shadowSize = new GSize(22, 20);
			smallIcon.iconAnchor = new GPoint(6, 20);
			smallIcon.infoWindowAnchor = new GPoint(5, 1);
		}
	}
	if(x==17)
	{

		document.getElementById('radio18').checked=1;
		if(document.getElementById('radio18').checked=1)
		{
			smallIcon = new GIcon();

			smallIcon.image = "images/Refreshments10F.gif";
			smallIcon.shadow = "http://labs.google.com/ridefinder/images/mm_20_shadow.png";
			smallIcon.iconSize = new GSize(25, 25);
			smallIcon.shadowSize = new GSize(22, 20);
			smallIcon.iconAnchor = new GPoint(6, 20);
			smallIcon.infoWindowAnchor = new GPoint(5, 1);
		}
	}
	if(x==18)
	{

		document.getElementById('radio19').checked=1;
		if(document.getElementById('radio19').checked=1)
		{
			smallIcon = new GIcon();

			smallIcon.image = "images/Camera view.gif";
			smallIcon.shadow = "http://labs.google.com/ridefinder/images/mm_20_shadow.png";
			smallIcon.iconSize = new GSize(25, 25);
			smallIcon.shadowSize = new GSize(22, 20);
			smallIcon.iconAnchor = new GPoint(6, 20);
			smallIcon.infoWindowAnchor = new GPoint(5, 1);
		}
	}
	if(x==19)
	{

		document.getElementById('radio20').checked=1;
		if(document.getElementById('radio20').checked=1)
		{
			smallIcon = new GIcon();

			smallIcon.image = "images/Watermill.gif";
			smallIcon.shadow = "http://labs.google.com/ridefinder/images/mm_20_shadow.png";
			smallIcon.iconSize = new GSize(25, 25);
			smallIcon.shadowSize = new GSize(22, 20);
			smallIcon.iconAnchor = new GPoint(6, 20);
			smallIcon.infoWindowAnchor = new GPoint(5, 1);
		}
	}
	
if(x==20)
	{

		document.getElementById('radio21').checked=1;
		if(document.getElementById('radio21').checked=1)
		{
			smallIcon = new GIcon();

			smallIcon.image = "images/sgrade4.gif";
			smallIcon.shadow = "http://labs.google.com/ridefinder/images/mm_20_shadow.png";
			smallIcon.iconSize = new GSize(25, 25);
			smallIcon.shadowSize = new GSize(22, 20);
			smallIcon.iconAnchor = new GPoint(6, 20);
			smallIcon.infoWindowAnchor = new GPoint(5, 1);
		}
	}
	if(x==21)
	{

		document.getElementById('radio22').checked=1;
		if(document.getElementById('radio22').checked=1)
		{
			smallIcon = new GIcon();

			smallIcon.image = "images/Zoo.gif";
			smallIcon.shadow = "http://labs.google.com/ridefinder/images/mm_20_shadow.png";
			smallIcon.iconSize = new GSize(25, 25);
			smallIcon.shadowSize = new GSize(22, 20);
			smallIcon.iconAnchor = new GPoint(6, 20);
			smallIcon.infoWindowAnchor = new GPoint(5, 1);
		}
	}
	if(x==22)
	{

		document.getElementById('radio23').checked=1;
		if(document.getElementById('radio23').checked=1)
		{
			smallIcon = new GIcon();

			smallIcon.image = "images/View.gif";
			smallIcon.shadow = "http://labs.google.com/ridefinder/images/mm_20_shadow.png";
			smallIcon.iconSize = new GSize(25, 25);
			smallIcon.shadowSize = new GSize(22, 20);
			smallIcon.iconAnchor = new GPoint(6, 20);
			smallIcon.infoWindowAnchor = new GPoint(5, 1);
		}
	}
	if(x==23)
	{

		document.getElementById('radio24').checked=1;
		if(document.getElementById('radio24').checked=1)
		{
			smallIcon = new GIcon();

			smallIcon.image = "images/Contact.gif";
			smallIcon.shadow = "http://labs.google.com/ridefinder/images/mm_20_shadow.png";
			smallIcon.iconSize = new GSize(25, 25);
			smallIcon.shadowSize = new GSize(22, 20);
			smallIcon.iconAnchor = new GPoint(6, 20);
			smallIcon.infoWindowAnchor = new GPoint(5, 1);
		}
	}
	if(x==24)
	{

		document.getElementById('radio25').checked=1;
		if(document.getElementById('radio25').checked=1)
		{
			smallIcon = new GIcon();

			smallIcon.image = "images/Weather.gif";
			smallIcon.shadow = "http://labs.google.com/ridefinder/images/mm_20_shadow.png";
			smallIcon.iconSize = new GSize(25, 25);
			smallIcon.shadowSize = new GSize(22, 20);
			smallIcon.iconAnchor = new GPoint(6, 20);
			smallIcon.infoWindowAnchor = new GPoint(5, 1);
		}
	}
	if(x==25)
	{

		document.getElementById('radio26').checked=1;
		if(document.getElementById('radio26').checked=1)
		{
			smallIcon = new GIcon();

			smallIcon.image = "images/LifeJacket.gif";
			smallIcon.shadow = "http://labs.google.com/ridefinder/images/mm_20_shadow.png";
			smallIcon.iconSize = new GSize(25, 25);
			smallIcon.shadowSize = new GSize(22, 20);
			smallIcon.iconAnchor = new GPoint(6, 20);
			smallIcon.infoWindowAnchor = new GPoint(5, 1);
		}
	}
	if(x==26)
	{

		document.getElementById('radio27').checked=1;
		if(document.getElementById('radio27').checked=1)
		{
			smallIcon = new GIcon();

			smallIcon.image = "images/Rocks.gif";
			smallIcon.shadow = "http://labs.google.com/ridefinder/images/mm_20_shadow.png";
			smallIcon.iconSize = new GSize(25, 25);
			smallIcon.shadowSize = new GSize(22, 20);
			smallIcon.iconAnchor = new GPoint(6, 20);
			smallIcon.infoWindowAnchor = new GPoint(5, 1);
		}
	}
	if(x==27)
	{

		document.getElementById('radio28').checked=1;
		if(document.getElementById('radio28').checked=1)
		{
			smallIcon = new GIcon();

			smallIcon.image = "images/FirstAid.gif";
			smallIcon.shadow = "http://labs.google.com/ridefinder/images/mm_20_shadow.png";
			smallIcon.iconSize = new GSize(25, 25);
			smallIcon.shadowSize = new GSize(22, 20);
			smallIcon.iconAnchor = new GPoint(6, 20);
			smallIcon.infoWindowAnchor = new GPoint(5, 1);
		}
	}
	if(x==28)
	{

		document.getElementById('radio29').checked=1;
		if(document.getElementById('radio29').checked=1)
		{
			smallIcon = new GIcon();

			smallIcon.image = "images/AirAmbulance.gif";
			smallIcon.shadow = "http://labs.google.com/ridefinder/images/mm_20_shadow.png";
			smallIcon.iconSize = new GSize(25, 25);
			smallIcon.shadowSize = new GSize(22, 20);
			smallIcon.iconAnchor = new GPoint(6, 20);
			smallIcon.infoWindowAnchor = new GPoint(5, 1);
		}
	}
	if(x==29)
	{

		document.getElementById('radio30').checked=1;
		if(document.getElementById('radio30').checked=1)
		{
			smallIcon = new GIcon();

			smallIcon.image = "images/Lifeboat.gif";
			smallIcon.shadow = "http://labs.google.com/ridefinder/images/mm_20_shadow.png";
			smallIcon.iconSize = new GSize(25, 25);
			smallIcon.shadowSize = new GSize(22, 20);
			smallIcon.iconAnchor = new GPoint(6, 20);
			smallIcon.infoWindowAnchor = new GPoint(5, 1);
		}
	}
		if(x==30)
	{

		document.getElementById('radio31').checked=1;
		if(document.getElementById('radio31').checked=1)
		{
			smallIcon = new GIcon();

			smallIcon.image = "images/Rescue.gif";
			smallIcon.shadow = "http://labs.google.com/ridefinder/images/mm_20_shadow.png";
			smallIcon.iconSize = new GSize(25, 25);
			smallIcon.shadowSize = new GSize(22, 20);
			smallIcon.iconAnchor = new GPoint(6, 20);
			smallIcon.infoWindowAnchor = new GPoint(5, 1);
		}
	}
	
	if(x==31)
	{
        
		document.getElementById('radio32').checked=1;
		if(document.getElementById('radio32').checked=1)
		{
			smallIcon = new GIcon();

			smallIcon.image = "images/Accessibility.gif";
			smallIcon.shadow = "http://labs.google.com/ridefinder/images/mm_20_shadow.png";
			smallIcon.iconSize = new GSize(25, 25);
			smallIcon.shadowSize = new GSize(22, 20);
			smallIcon.iconAnchor = new GPoint(6, 20);
			smallIcon.infoWindowAnchor = new GPoint(5, 1);
		}
	}
	if(x==32)
	{

		document.getElementById('radio33').checked=1;
		if(document.getElementById('radio33').checked=1)
		{
			smallIcon = new GIcon();

			smallIcon.image = "images/BusAndStation.gif";
			smallIcon.shadow = "http://labs.google.com/ridefinder/images/mm_20_shadow.png";
			smallIcon.iconSize = new GSize(25, 25);
			smallIcon.shadowSize = new GSize(22, 20);
			smallIcon.iconAnchor = new GPoint(6, 20);
			smallIcon.infoWindowAnchor = new GPoint(5, 1);
		}
	}
	if(x==33)
	{

		document.getElementById('radio34').checked=1;
		if(document.getElementById('radio34').checked=1)
		{
			smallIcon = new GIcon();

			smallIcon.image = "images/archive library.gif";
			smallIcon.shadow = "http://labs.google.com/ridefinder/images/mm_20_shadow.png";
			smallIcon.iconSize = new GSize(25, 25);
			smallIcon.shadowSize = new GSize(22, 20);
			smallIcon.iconAnchor = new GPoint(6, 20);
			smallIcon.infoWindowAnchor = new GPoint(5, 1);
		}
	}
	if(x==34)
	{

		document.getElementById('radio35').checked=1;
		if(document.getElementById('radio35').checked=1)
		{
			smallIcon = new GIcon();

			smallIcon.image = "images/boat launch.gif";
			smallIcon.shadow = "http://labs.google.com/ridefinder/images/mm_20_shadow.png";
			smallIcon.iconSize = new GSize(25, 25);
			smallIcon.shadowSize = new GSize(22, 20);
			smallIcon.iconAnchor = new GPoint(6, 20);
			smallIcon.infoWindowAnchor = new GPoint(5, 1);
		}
	}
	if(x==35)
	{

		document.getElementById('radio36').checked=1;
		if(document.getElementById('radio36').checked=1)
		{
			smallIcon = new GIcon();

			smallIcon.image = "images/Boating.gif";
			smallIcon.shadow = "http://labs.google.com/ridefinder/images/mm_20_shadow.png";
			smallIcon.iconSize = new GSize(25, 25);
			smallIcon.shadowSize = new GSize(22, 20);
			smallIcon.iconAnchor = new GPoint(6, 20);
			smallIcon.infoWindowAnchor = new GPoint(5, 1);
		}
	}
	if(x==36)
	{

		document.getElementById('radio37').checked=1;
		if(document.getElementById('radio37').checked=1)
		{
			smallIcon = new GIcon();

			smallIcon.image = "images/Bus Route.gif";
			smallIcon.shadow = "http://labs.google.com/ridefinder/images/mm_20_shadow.png";
			smallIcon.iconSize = new GSize(25, 25);
			smallIcon.shadowSize = new GSize(22, 20);
			smallIcon.iconAnchor = new GPoint(6, 20);
			smallIcon.infoWindowAnchor = new GPoint(5, 1);
		}
	}
	if(x==37)
	{

		document.getElementById('radio38').checked=1;
		if(document.getElementById('radio38').checked=1)
		{
			smallIcon = new GIcon();

			smallIcon.image = "images/Aircraft Museum.gif";
			smallIcon.shadow = "http://labs.google.com/ridefinder/images/mm_20_shadow.png";
			smallIcon.iconSize = new GSize(25, 25);
			smallIcon.shadowSize = new GSize(22, 20);
			smallIcon.iconAnchor = new GPoint(6, 20);
			smallIcon.infoWindowAnchor = new GPoint(5, 1);
		}
	}
	if(x==38)
	{

		document.getElementById('radio39').checked=1;
		if(document.getElementById('radio39').checked=1)
		{
			smallIcon = new GIcon();

			smallIcon.image = "images/Camping Site.gif";
			smallIcon.shadow = "http://labs.google.com/ridefinder/images/mm_20_shadow.png";
			smallIcon.iconSize = new GSize(25, 25);
			smallIcon.shadowSize = new GSize(22, 20);
			smallIcon.iconAnchor = new GPoint(6, 20);
			smallIcon.infoWindowAnchor = new GPoint(5, 1);
		}
	}
	if(x==39)
	{

		document.getElementById('radio40').checked=1;
		if(document.getElementById('radio40').checked=1)
		{
			smallIcon = new GIcon();

			smallIcon.image = "images/Car Garage.gif";
			smallIcon.shadow = "http://labs.google.com/ridefinder/images/mm_20_shadow.png";
			smallIcon.iconSize = new GSize(25, 25);
			smallIcon.shadowSize = new GSize(22, 20);
			smallIcon.iconAnchor = new GPoint(6, 20);
			smallIcon.infoWindowAnchor = new GPoint(5, 1);
		}
	}
	if(x==40)
	{

		document.getElementById('radio41').checked=1;
		if(document.getElementById('radio41').checked=1)
		{
			smallIcon = new GIcon();

			smallIcon.image = "images/Caravan Park.gif";
			smallIcon.shadow = "http://labs.google.com/ridefinder/images/mm_20_shadow.png";
			smallIcon.iconSize = new GSize(25, 25);
			smallIcon.shadowSize = new GSize(22, 20);
			smallIcon.iconAnchor = new GPoint(6, 20);
			smallIcon.infoWindowAnchor = new GPoint(5, 1);
		}
	}
	if(x==41)
	{

		document.getElementById('radio42').checked=1;
		if(document.getElementById('radio42').checked=1)
		{
			smallIcon = new GIcon();

			smallIcon.image = "images/Hex -Canoeing L DS.gif";
			smallIcon.shadow = "http://labs.google.com/ridefinder/images/mm_20_shadow.png";
			smallIcon.iconSize = new GSize(25, 25);
			smallIcon.shadowSize = new GSize(22, 20);
			smallIcon.iconAnchor = new GPoint(6, 20);
			smallIcon.infoWindowAnchor = new GPoint(5, 1);
		}
	}
	if(x==42)
	{

		document.getElementById('radio43').checked=1;
		if(document.getElementById('radio43').checked=1)
		{
			smallIcon = new GIcon();

			smallIcon.image = "images/Hex -Car L DS.gif";
			smallIcon.shadow = "http://labs.google.com/ridefinder/images/mm_20_shadow.png";
			smallIcon.iconSize = new GSize(25, 25);
			smallIcon.shadowSize = new GSize(22, 20);
			smallIcon.iconAnchor = new GPoint(6, 20);
			smallIcon.infoWindowAnchor = new GPoint(5, 1);
		}
	}
	if(x==43)
	{

		document.getElementById('radio44').checked=1;
		if(document.getElementById('radio44').checked=1)
		{
			smallIcon = new GIcon();

			smallIcon.image = "images/Cycle Shop.gif";
			smallIcon.shadow = "http://labs.google.com/ridefinder/images/mm_20_shadow.png";
			smallIcon.iconSize = new GSize(25, 25);
			smallIcon.shadowSize = new GSize(22, 20);
			smallIcon.iconAnchor = new GPoint(6, 20);
			smallIcon.infoWindowAnchor = new GPoint(5, 1);
		}
	}
	if(x==44)
	{

		document.getElementById('radio45').checked=1;
		if(document.getElementById('radio45').checked=1)
		{
			smallIcon = new GIcon();

			smallIcon.image = "images/Dogs Allowed.gif";
			smallIcon.shadow = "http://labs.google.com/ridefinder/images/mm_20_shadow.png";
			smallIcon.iconSize = new GSize(25, 25);
			smallIcon.shadowSize = new GSize(22, 20);
			smallIcon.iconAnchor = new GPoint(6, 20);
			smallIcon.infoWindowAnchor = new GPoint(5, 1);
		}
	}
	if(x==45)
	{

		document.getElementById('radio46').checked=1;
		if(document.getElementById('radio46').checked=1)
		{
			smallIcon = new GIcon();

			smallIcon.image = "images/Diving.gif";
			smallIcon.shadow = "http://labs.google.com/ridefinder/images/mm_20_shadow.png";
			smallIcon.iconSize = new GSize(25, 25);
			smallIcon.shadowSize = new GSize(22, 20);
			smallIcon.iconAnchor = new GPoint(6, 20);
			smallIcon.infoWindowAnchor = new GPoint(5, 1);
		}
	}
	if(x==46)
	{

		document.getElementById('radio47').checked=1;
		if(document.getElementById('radio47').checked=1)
		{
			smallIcon = new GIcon();

			smallIcon.image = "images/Hex -Mountainbike L DS.gif";
			smallIcon.shadow = "http://labs.google.com/ridefinder/images/mm_20_shadow.png";
			smallIcon.iconSize = new GSize(25, 25);
			smallIcon.shadowSize = new GSize(22, 20);
			smallIcon.iconAnchor = new GPoint(6, 20);
			smallIcon.infoWindowAnchor = new GPoint(5, 1);
		}
	}
	if(x==47)
	{

		document.getElementById('radio48').checked=1;
		if(document.getElementById('radio48').checked=1)
		{
			smallIcon = new GIcon();

			smallIcon.image = "images/Exercise & Fitness.gif";
			smallIcon.shadow = "http://labs.google.com/ridefinder/images/mm_20_shadow.png";
			smallIcon.iconSize = new GSize(25, 25);
			smallIcon.shadowSize = new GSize(22, 20);
			smallIcon.iconAnchor = new GPoint(6, 20);
			smallIcon.infoWindowAnchor = new GPoint(5, 1);
		}
	}
	if(x==48)
	{

		document.getElementById('radio49').checked=1;
		if(document.getElementById('radio49').checked=1)
		{
			smallIcon = new GIcon();

			smallIcon.image = "images/Fishing.gif";
			smallIcon.shadow = "http://labs.google.com/ridefinder/images/mm_20_shadow.png";
			smallIcon.iconSize = new GSize(25, 25);
			smallIcon.shadowSize = new GSize(22, 20);
			smallIcon.iconAnchor = new GPoint(6, 20);
			smallIcon.infoWindowAnchor = new GPoint(5, 1);
		}
	}
	if(x==49)
	{

		document.getElementById('radio50').checked=1;
		if(document.getElementById('radio50').checked=1)
		{
			smallIcon = new GIcon();

			smallIcon.image = "images/Food Store.gif";
			smallIcon.shadow = "http://labs.google.com/ridefinder/images/mm_20_shadow.png";
			smallIcon.iconSize = new GSize(25, 25);
			smallIcon.shadowSize = new GSize(22, 20);
			smallIcon.iconAnchor = new GPoint(6, 20);
			smallIcon.infoWindowAnchor = new GPoint(5, 1);
		}
	}
	if(x==50)
	{

		document.getElementById('radio51').checked=1;
		if(document.getElementById('radio51').checked=1)
		{
			smallIcon = new GIcon();

			smallIcon.image = "images/Golfing.gif";
			smallIcon.shadow = "http://labs.google.com/ridefinder/images/mm_20_shadow.png";
			smallIcon.iconSize = new GSize(25, 25);
			smallIcon.shadowSize = new GSize(22, 20);
			smallIcon.iconAnchor = new GPoint(6, 20);
			smallIcon.infoWindowAnchor = new GPoint(5, 1);
		}
	}
	if(x==51)
	{

		document.getElementById('radio52').checked=1;
		if(document.getElementById('radio52').checked=1)
		{
			smallIcon = new GIcon();

			smallIcon.image = "images/HandGliding.gif";
			smallIcon.shadow = "http://labs.google.com/ridefinder/images/mm_20_shadow.png";
			smallIcon.iconSize = new GSize(25, 25);
			smallIcon.shadowSize = new GSize(22, 20);
			smallIcon.iconAnchor = new GPoint(6, 20);
			smallIcon.infoWindowAnchor = new GPoint(5, 1);
		}
	}
		if(x==52)
	{

		document.getElementById('radio53').checked=1;
		if(document.getElementById('radio53').checked=1)
		{
			smallIcon = new GIcon();

			smallIcon.image = "images/Picnic.gif";
			smallIcon.shadow = "http://labs.google.com/ridefinder/images/mm_20_shadow.png";
			smallIcon.iconSize = new GSize(25, 25);
			smallIcon.shadowSize = new GSize(22, 20);
			smallIcon.iconAnchor = new GPoint(6, 20);
			smallIcon.infoWindowAnchor = new GPoint(5, 1);
		}
	}
	
			if(x==53)
	{

		document.getElementById('radio54').checked=1;
		if(document.getElementById('radio54').checked=1)
		{
			smallIcon = new GIcon();

			smallIcon.image = "images/HorseRiding.gif";
			smallIcon.shadow = "http://labs.google.com/ridefinder/images/mm_20_shadow.png";
			smallIcon.iconSize = new GSize(25, 25);
			smallIcon.shadowSize = new GSize(22, 20);
			smallIcon.iconAnchor = new GPoint(6, 20);
			smallIcon.infoWindowAnchor = new GPoint(5, 1);
		}
	}

			if(x==54)
	{

		document.getElementById('radio55').checked=1;
		if(document.getElementById('radio55').checked=1)
		{
			smallIcon = new GIcon();

			smallIcon.image = "images/Hospital.gif";
			smallIcon.shadow = "http://labs.google.com/ridefinder/images/mm_20_shadow.png";
			smallIcon.iconSize = new GSize(25, 25);
			smallIcon.shadowSize = new GSize(22, 20);
			smallIcon.iconAnchor = new GPoint(6, 20);
			smallIcon.infoWindowAnchor = new GPoint(5, 1);
		}
	}
				if(x==55)
	{

		document.getElementById('radio56').checked=1;
		if(document.getElementById('radio56').checked=1)
		{
			smallIcon = new GIcon();

			smallIcon.image = "images/sgrade3.gif";
			smallIcon.shadow = "http://labs.google.com/ridefinder/images/mm_20_shadow.png";
			smallIcon.iconSize = new GSize(25, 25);
			smallIcon.shadowSize = new GSize(22, 20);
			smallIcon.iconAnchor = new GPoint(6, 20);
			smallIcon.infoWindowAnchor = new GPoint(5, 1);
		}
	}
					if(x==56)
	{

		document.getElementById('radio57').checked=1;
		if(document.getElementById('radio57').checked=1)
		{
			smallIcon = new GIcon();

			smallIcon.image = "images/Rowing.gif";
			smallIcon.shadow = "http://labs.google.com/ridefinder/images/mm_20_shadow.png";
			smallIcon.iconSize = new GSize(25, 25);
			smallIcon.shadowSize = new GSize(22, 20);
			smallIcon.iconAnchor = new GPoint(6, 20);
			smallIcon.infoWindowAnchor = new GPoint(5, 1);
		}
	}
						if(x==57)
	{

		document.getElementById('radio58').checked=1;
		if(document.getElementById('radio58').checked=1)
		{
			smallIcon = new GIcon();

			smallIcon.image = "images/Information.gif";
			smallIcon.shadow = "http://labs.google.com/ridefinder/images/mm_20_shadow.png";
			smallIcon.iconSize = new GSize(25, 25);
			smallIcon.shadowSize = new GSize(22, 20);
			smallIcon.iconAnchor = new GPoint(6, 20);
			smallIcon.infoWindowAnchor = new GPoint(5, 1);
		}
	}
							if(x==58)
	{

		document.getElementById('radio59').checked=1;
		if(document.getElementById('radio59').checked=1)
		{
			smallIcon = new GIcon();

			smallIcon.image = "images/Lighthouse.gif";
			smallIcon.shadow = "http://labs.google.com/ridefinder/images/mm_20_shadow.png";
			smallIcon.iconSize = new GSize(25, 25);
			smallIcon.shadowSize = new GSize(22, 20);
			smallIcon.iconAnchor = new GPoint(6, 20);
			smallIcon.infoWindowAnchor = new GPoint(5, 1);
		}
	}
								if(x==59)
	{

		document.getElementById('radio60').checked=1;
		if(document.getElementById('radio60').checked=1)
		{
			smallIcon = new GIcon();

			smallIcon.image = "images/Lodgings.gif";
			smallIcon.shadow = "http://labs.google.com/ridefinder/images/mm_20_shadow.png";
			smallIcon.iconSize = new GSize(25, 25);
			smallIcon.shadowSize = new GSize(22, 20);
			smallIcon.iconAnchor = new GPoint(6, 20);
			smallIcon.infoWindowAnchor = new GPoint(5, 1);
		}
	}
									if(x==60)
	{

		document.getElementById('radio61').checked=1;
		if(document.getElementById('radio61').checked=1)
		{
			smallIcon = new GIcon();

			smallIcon.image = "images/Litter.gif";
			smallIcon.shadow = "http://labs.google.com/ridefinder/images/mm_20_shadow.png";
			smallIcon.iconSize = new GSize(25, 25);
			smallIcon.shadowSize = new GSize(22, 20);
			smallIcon.iconAnchor = new GPoint(6, 20);
			smallIcon.infoWindowAnchor = new GPoint(5, 1);
		}
	}
									if(x==61)
	{

		document.getElementById('radio62').checked=1;
		if(document.getElementById('radio62').checked=1)
		{
			smallIcon = new GIcon();

			smallIcon.image = "images/Maritime.gif";
			smallIcon.shadow = "http://labs.google.com/ridefinder/images/mm_20_shadow.png";
			smallIcon.iconSize = new GSize(25, 25);
			smallIcon.shadowSize = new GSize(22, 20);
			smallIcon.iconAnchor = new GPoint(6, 20);
			smallIcon.infoWindowAnchor = new GPoint(5, 1);
		}
	}
										if(x==62)
	{

		document.getElementById('radio63').checked=1;
		if(document.getElementById('radio63').checked=1)
		{
			smallIcon = new GIcon();

			smallIcon.image = "images/Motorcycle.gif";
			smallIcon.shadow = "http://labs.google.com/ridefinder/images/mm_20_shadow.png";
			smallIcon.iconSize = new GSize(25, 25);
			smallIcon.shadowSize = new GSize(22, 20);
			smallIcon.iconAnchor = new GPoint(6, 20);
			smallIcon.infoWindowAnchor = new GPoint(5, 1);
		}
	}
											if(x==63)
	{

		document.getElementById('radio64').checked=1;
		if(document.getElementById('radio64').checked=1)
		{
			smallIcon = new GIcon();

			smallIcon.image = "images/Hex -Runner L DS.gif";
			smallIcon.shadow = "http://labs.google.com/ridefinder/images/mm_20_shadow.png";
			smallIcon.iconSize = new GSize(25, 25);
			smallIcon.shadowSize = new GSize(22, 20);
			smallIcon.iconAnchor = new GPoint(6, 20);
			smallIcon.infoWindowAnchor = new GPoint(5, 1);
		}
	}
												if(x==64)
	{

		document.getElementById('radio65').checked=1;
		if(document.getElementById('radio65').checked=1)
		{
			smallIcon = new GIcon();

			smallIcon.image = "images/NatureReserve.gif";
			smallIcon.shadow = "http://labs.google.com/ridefinder/images/mm_20_shadow.png";
			smallIcon.iconSize = new GSize(25, 25);
			smallIcon.shadowSize = new GSize(22, 20);
			smallIcon.iconAnchor = new GPoint(6, 20);
			smallIcon.infoWindowAnchor = new GPoint(5, 1);
		}
	}
													if(x==65)
	{

		document.getElementById('radio66').checked=1;
		if(document.getElementById('radio66').checked=1)
		{
			smallIcon = new GIcon();

			smallIcon.image = "images/Hex -Swimmer L.gif";
			smallIcon.shadow = "http://labs.google.com/ridefinder/images/mm_20_shadow.png";
			smallIcon.iconSize = new GSize(25, 25);
			smallIcon.shadowSize = new GSize(22, 20);
			smallIcon.iconAnchor = new GPoint(6, 20);
			smallIcon.infoWindowAnchor = new GPoint(5, 1);
		}
	}
														if(x==66)
	{

		document.getElementById('radio67').checked=1;
		if(document.getElementById('radio67').checked=1)
		{
			smallIcon = new GIcon();

			smallIcon.image = "images/Underground.gif";
			smallIcon.shadow = "http://labs.google.com/ridefinder/images/mm_20_shadow.png";
			smallIcon.iconSize = new GSize(25, 25);
			smallIcon.shadowSize = new GSize(22, 20);
			smallIcon.iconAnchor = new GPoint(6, 20);
			smallIcon.infoWindowAnchor = new GPoint(5, 1);
		}
	}
															if(x==67)
	{

		document.getElementById('radio68').checked=1;
		if(document.getElementById('radio68').checked=1)
		{
			smallIcon = new GIcon();

			smallIcon.image = "images/OutdoorPursuitCentre.gif";
			smallIcon.shadow = "http://labs.google.com/ridefinder/images/mm_20_shadow.png";
			smallIcon.iconSize = new GSize(25, 25);
			smallIcon.shadowSize = new GSize(22, 20);
			smallIcon.iconAnchor = new GPoint(6, 20);
			smallIcon.infoWindowAnchor = new GPoint(5, 1);
		}
	}
																if(x==68)
	{

		document.getElementById('radio69').checked=1;
		if(document.getElementById('radio69').checked=1)
		{
			smallIcon = new GIcon();

			smallIcon.image = "images/Parking.gif";
			smallIcon.shadow = "http://labs.google.com/ridefinder/images/mm_20_shadow.png";
			smallIcon.iconSize = new GSize(25, 25);
			smallIcon.shadowSize = new GSize(22, 20);
			smallIcon.iconAnchor = new GPoint(6, 20);
			smallIcon.infoWindowAnchor = new GPoint(5, 1);
		}
	}
																	if(x==69)
	{

		document.getElementById('radio70').checked=1;
		if(document.getElementById('radio70').checked=1)
		{
			smallIcon = new GIcon();

			smallIcon.image = "images/PathwayAndHeritage.gif";
			smallIcon.shadow = "http://labs.google.com/ridefinder/images/mm_20_shadow.png";
			smallIcon.iconSize = new GSize(25, 25);
			smallIcon.shadowSize = new GSize(22, 20);
			smallIcon.iconAnchor = new GPoint(6, 20);
			smallIcon.infoWindowAnchor = new GPoint(5, 1);
		}
	}
																	if(x==70)
	{

		document.getElementById('radio71').checked=1;
		if(document.getElementById('radio71').checked=1)
		{
			smallIcon = new GIcon();

			smallIcon.image = "images/Playground.gif";
			smallIcon.shadow = "http://labs.google.com/ridefinder/images/mm_20_shadow.png";
			smallIcon.iconSize = new GSize(25, 25);
			smallIcon.shadowSize = new GSize(22, 20);
			smallIcon.iconAnchor = new GPoint(6, 20);
			smallIcon.infoWindowAnchor = new GPoint(5, 1);
		}
	}
																	if(x==71)
	{

		document.getElementById('radio72').checked=1;
		if(document.getElementById('radio72').checked=1)
		{
			smallIcon = new GIcon();

			smallIcon.image = "images/Police.gif";
			smallIcon.shadow = "http://labs.google.com/ridefinder/images/mm_20_shadow.png";
			smallIcon.iconSize = new GSize(25, 25);
			smallIcon.shadowSize = new GSize(22, 20);
			smallIcon.iconAnchor = new GPoint(6, 20);
			smallIcon.infoWindowAnchor = new GPoint(5, 1);
		}
	}
																		if(x==72)
	{

		document.getElementById('radio73').checked=1;
		if(document.getElementById('radio73').checked=1)
		{
			smallIcon = new GIcon();

			smallIcon.image = "images/ViewPoint.gif";
			smallIcon.shadow = "http://labs.google.com/ridefinder/images/mm_20_shadow.png";
			smallIcon.iconSize = new GSize(25, 25);
			smallIcon.shadowSize = new GSize(22, 20);
			smallIcon.iconAnchor = new GPoint(6, 20);
			smallIcon.infoWindowAnchor = new GPoint(5, 1);
		}
	}
																			if(x==73)
	{

		document.getElementById('radio74').checked=1;
		if(document.getElementById('radio74').checked=1)
		{
			smallIcon = new GIcon();

			smallIcon.image = "images/RailTransport.gif";
			smallIcon.shadow = "http://labs.google.com/ridefinder/images/mm_20_shadow.png";
			smallIcon.iconSize = new GSize(25, 25);
			smallIcon.shadowSize = new GSize(22, 20);
			smallIcon.iconAnchor = new GPoint(6, 20);
			smallIcon.infoWindowAnchor = new GPoint(5, 1);
		}
	}
																				if(x==74)
	{

		document.getElementById('radio75').checked=1;
		if(document.getElementById('radio75').checked=1)
		{
			smallIcon = new GIcon();

			smallIcon.image = "images/Hex -Walker L DS.gif";
			smallIcon.shadow = "http://labs.google.com/ridefinder/images/mm_20_shadow.png";
			smallIcon.iconSize = new GSize(25, 25);
			smallIcon.shadowSize = new GSize(22, 20);
			smallIcon.iconAnchor = new GPoint(6, 20);
			smallIcon.infoWindowAnchor = new GPoint(5, 1);
		}
	}
																					if(x==75)
	{

		document.getElementById('radio76').checked=1;
		if(document.getElementById('radio76').checked=1)
		{
			smallIcon = new GIcon();

			smallIcon.image = "images/Refreshments.gif";
			smallIcon.shadow = "http://labs.google.com/ridefinder/images/mm_20_shadow.png";
			smallIcon.iconSize = new GSize(25, 25);
			smallIcon.shadowSize = new GSize(22, 20);
			smallIcon.iconAnchor = new GPoint(6, 20);
			smallIcon.infoWindowAnchor = new GPoint(5, 1);
		}
	}
																						if(x==76)
	{

		document.getElementById('radio77').checked=1;
		if(document.getElementById('radio77').checked=1)
		{
			smallIcon = new GIcon();

			smallIcon.image = "images/Shipwreck.gif";
			smallIcon.shadow = "http://labs.google.com/ridefinder/images/mm_20_shadow.png";
			smallIcon.iconSize = new GSize(25, 25);
			smallIcon.shadowSize = new GSize(22, 20);
			smallIcon.iconAnchor = new GPoint(6, 20);
			smallIcon.infoWindowAnchor = new GPoint(5, 1);
		}
	}
																							if(x==77)
	{

		document.getElementById('radio78').checked=1;
		if(document.getElementById('radio78').checked=1)
		{
			smallIcon = new GIcon();

			smallIcon.image = "images/SpecialInterest.gif";
			smallIcon.shadow = "http://labs.google.com/ridefinder/images/mm_20_shadow.png";
			smallIcon.iconSize = new GSize(25, 25);
			smallIcon.shadowSize = new GSize(22, 20);
			smallIcon.iconAnchor = new GPoint(6, 20);
			smallIcon.infoWindowAnchor = new GPoint(5, 1);
		}
	}
																								if(x==78)
	{

		document.getElementById('radio79').checked=1;
		if(document.getElementById('radio79').checked=1)
		{
			smallIcon = new GIcon();

			smallIcon.image = "images/SportsCentre.gif";
			smallIcon.shadow = "http://labs.google.com/ridefinder/images/mm_20_shadow.png";
			smallIcon.iconSize = new GSize(25, 25);
			smallIcon.shadowSize = new GSize(22, 20);
			smallIcon.iconAnchor = new GPoint(6, 20);
			smallIcon.infoWindowAnchor = new GPoint(5, 1);
		}
	}
																									if(x==79)
	{

		document.getElementById('radio80').checked=1;
		if(document.getElementById('radio80').checked=1)
		{
			smallIcon = new GIcon();

			smallIcon.image = "images/Taxi.gif";
			smallIcon.shadow = "http://labs.google.com/ridefinder/images/mm_20_shadow.png";
			smallIcon.iconSize = new GSize(25, 25);
			smallIcon.shadowSize = new GSize(22, 20);
			smallIcon.iconAnchor = new GPoint(6, 20);
			smallIcon.infoWindowAnchor = new GPoint(5, 1);
		}
	}

																									if(x==80)
	{

		document.getElementById('radio81').checked=1;
		if(document.getElementById('radio81').checked=1)
		{
			smallIcon = new GIcon();

			smallIcon.image = "images/sgrade1.gif";
			smallIcon.shadow = "http://labs.google.com/ridefinder/images/mm_20_shadow.png";
			smallIcon.iconSize = new GSize(25, 25);
			smallIcon.shadowSize = new GSize(22, 20);
			smallIcon.iconAnchor = new GPoint(6, 20);
			smallIcon.infoWindowAnchor = new GPoint(5, 1);
		}
	}
																										if(x==81)
	{

		document.getElementById('radio82').checked=1;
		if(document.getElementById('radio82').checked=1)
		{
			smallIcon = new GIcon();

			smallIcon.image = "images/Flowers.gif";
			smallIcon.shadow = "http://labs.google.com/ridefinder/images/mm_20_shadow.png";
			smallIcon.iconSize = new GSize(25, 25);
			smallIcon.shadowSize = new GSize(22, 20);
			smallIcon.iconAnchor = new GPoint(6, 20);
			smallIcon.infoWindowAnchor = new GPoint(5, 1);
		}
	}
																										if(x==82)
	{

		document.getElementById('radio83').checked=1;
		if(document.getElementById('radio83').checked=1)
		{
			smallIcon = new GIcon();

			smallIcon.image = "images/Windmill.gif";
			smallIcon.shadow = "http://labs.google.com/ridefinder/images/mm_20_shadow.png";
			smallIcon.iconSize = new GSize(25, 25);
			smallIcon.shadowSize = new GSize(22, 20);
			smallIcon.iconAnchor = new GPoint(6, 20);
			smallIcon.infoWindowAnchor = new GPoint(5, 1);
		}
	}
																if(x==83)
	{

		document.getElementById('radio84').checked=1;
		if(document.getElementById('radio84').checked=1)
		{
			smallIcon = new GIcon();

			smallIcon.image = "images/Windsurfing.gif";
			smallIcon.shadow = "http://labs.google.com/ridefinder/images/mm_20_shadow.png";
			smallIcon.iconSize = new GSize(25, 25);
			smallIcon.shadowSize = new GSize(22, 20);
			smallIcon.iconAnchor = new GPoint(6, 20);
			smallIcon.infoWindowAnchor = new GPoint(5, 1);
		}
	}

																if(x==84)
	{

		document.getElementById('radio85').checked=1;
		if(document.getElementById('radio85').checked=1)
		{
			smallIcon = new GIcon();

			smallIcon.image = "images/sgrade2.gif";
			smallIcon.shadow = "http://labs.google.com/ridefinder/images/mm_20_shadow.png";
			smallIcon.iconSize = new GSize(25, 25);
			smallIcon.shadowSize = new GSize(22, 20);
			smallIcon.iconAnchor = new GPoint(6, 20);
			smallIcon.infoWindowAnchor = new GPoint(5, 1);
		}
	}
																	if(x==85)
	{

		document.getElementById('radio86').checked=1;
		if(document.getElementById('radio86').checked=1)
		{
			smallIcon = new GIcon();

			smallIcon.image = "images/Hex -Watersports L DS.gif";
			smallIcon.shadow = "http://labs.google.com/ridefinder/images/mm_20_shadow.png";
			smallIcon.iconSize = new GSize(25, 25);
			smallIcon.shadowSize = new GSize(22, 20);
			smallIcon.iconAnchor = new GPoint(6, 20);
			smallIcon.infoWindowAnchor = new GPoint(5, 1);
		}
	}
	if(x==86)
	{

		document.getElementById('radio87').checked=1;
		if(document.getElementById('radio87').checked=1)
		{
			smallIcon = new GIcon();

			smallIcon.image = "images/Woodland.gif";
			smallIcon.shadow = "http://labs.google.com/ridefinder/images/mm_20_shadow.png";
			smallIcon.iconSize = new GSize(25, 25);
			smallIcon.shadowSize = new GSize(22, 20);
			smallIcon.iconAnchor = new GPoint(6, 20);
			smallIcon.infoWindowAnchor = new GPoint(5, 1);
		}
	}
	if(x==87)
	{

		document.getElementById('radio88').checked=1;
		if(document.getElementById('radio88').checked=1)
		{
			smallIcon = new GIcon();

			smallIcon.image = "images/fire.gif";
			smallIcon.shadow = "http://labs.google.com/ridefinder/images/mm_20_shadow.png";
			smallIcon.iconSize = new GSize(25, 25);
			smallIcon.shadowSize = new GSize(22, 20);
			smallIcon.iconAnchor = new GPoint(6, 20);
			smallIcon.infoWindowAnchor = new GPoint(5, 1);
		}
	}
	if(x==88)
	{

		document.getElementById('radio89').checked=1;
		if(document.getElementById('radio89').checked=1)
		{
			smallIcon = new GIcon();

			smallIcon.image = "images/water.gif";
			smallIcon.shadow = "http://labs.google.com/ridefinder/images/mm_20_shadow.png";
			smallIcon.iconSize = new GSize(25, 25);
			smallIcon.shadowSize = new GSize(22, 20);
			smallIcon.iconAnchor = new GPoint(6, 20);
			smallIcon.infoWindowAnchor = new GPoint(5, 1);
		}
	}
		if(x==89)
	{

		document.getElementById('radio90').checked=1;
		if(document.getElementById('radio90').checked=1)
		{
			smallIcon = new GIcon();

			smallIcon.image = "images/solar.gif";
			smallIcon.shadow = "http://labs.google.com/ridefinder/images/mm_20_shadow.png";
			smallIcon.iconSize = new GSize(25, 25);
			smallIcon.shadowSize = new GSize(22, 20);
			smallIcon.iconAnchor = new GPoint(6, 20);
			smallIcon.infoWindowAnchor = new GPoint(5, 1);
		}
	}
			if(x==90)
	{

		document.getElementById('radio91').checked=1;
		if(document.getElementById('radio91').checked=1)
		{
			smallIcon = new GIcon();

			smallIcon.image = "images/wind.gif";
			smallIcon.shadow = "http://labs.google.com/ridefinder/images/mm_20_shadow.png";
			smallIcon.iconSize = new GSize(25, 25);
			smallIcon.shadowSize = new GSize(22, 20);
			smallIcon.iconAnchor = new GPoint(6, 20);
			smallIcon.infoWindowAnchor = new GPoint(5, 1);
		  }
    }

    if(addMore < 6 && addMore != 0)
    {
        document.getElementById('mark').value=x;
		
        mapClick(null, point1,'1');
    }
    else
    {
        ver=0;
        addMore=0;
        document.getElementById('mark').value=x;
    }
}




