var PLACES_URL_BASE = '/themes/subjects/military/';
var PLACES_START_ZOOM = 10;
var PLACES_START_LAT = -0.410745;
var PLACES_START_LNG = 51.268285;


var PLACES = 

[{
		LINKS:[
			{name:"Guildford_Unknown_Type_Destroyed_Pillbox",href:"/themes/subjects/military/pillbox_landscape_features2"},
			{name:"Guildford_HER_Number:_6088",href:"/GetRecord/SHHER_6088"}],
		RANK:1,
		EASTING:488900,
		NORTHING:150500,
		IMG:"/assets/userfiles/Pillbox/Mapping_Project/Guildford/A_Brann/HER6088_02.jpg"},


{
		LINKS:[

{name:"Guildford_Unknown_Type_Destroyed_Pillbox",href:"/themes/subjects/military/pillbox_landscape_features2"},
			{name:"Guildford_HER_Number:_6098",href:"/GetRecord/SHHER_6098"}],
		RANK:1,
		EASTING:502400,
		NORTHING:147500,
		IMG:"/assets/userfiles/Pillbox/Mapping_Project/Guildford/A_Brann/HER6098_Chilworth_01.jpg"},
		
	
{
		LINKS:[

{name:"Guildford_Type_26_Pillbox",href:"/themes/subjects/military/pillbox_landscape_features2/pillbox_type_26"},
			{name:"Guildford_HER_Number:_6145",href:"/GetRecord/SHHER_6145"}],
		RANK:1,
		EASTING:504100,
		NORTHING:148280,
		IMG:"/assets/userfiles/Pillbox/Mapping_Project/Guildford/A_Brann/HER6145_Albury_05.jpg"},


{
		LINKS:[

{name:"Guildford_Unknown_Type_Destroyed_Pillbox",href:"/themes/subjects/military/pillbox_landscape_features2"},
			{name:"Guildford_HER_Number:_6312",href:"/GetRecord/SHHER_6312"}],
		RANK:1,
		EASTING:503190,
		NORTHING:147660,
		IMG:"/assets/userfiles/Pillbox/Mapping_Project/Guildford/A_Brann/HER6312_Chilworth_01.jpg"},


{
		LINKS:[

{name:"Guildford_Type_24_Pillbox",href:"/themes/subjects/military/pillbox_landscape_features2/pillbox_type_24"},
			{name:"Guildford_HER_Number:_6475",href:"/GetRecord/SHHER_6475"}],
		RANK:1,
		EASTING:503551,
		NORTHING:148636,
		IMG:"/assets/userfiles/Pillbox/Mapping_Project/Guildford/A_Brann/6475_1_and_6475_2_Combined.jpg"},


{
		LINKS:[

{name:"Guildford_Unknown_Type_Pillbox",href:"/themes/subjects/military/pillbox_landscape_features2"},
			{name:"Guildford_HER_Number:_6476",href:"/GetRecord/SHHER_6476"}],
		RANK:1,
		EASTING:502588,
		NORTHING:147724,
		IMG:"/assets/userfiles/Pillbox/Mapping_Project/Guildford/A_Brann/HER6476_Chilworth_03.jpg"},


{
		LINKS:[

{name:"Guildford_Circular_Drum_Variant_Type_Pillbox",href:"/themes/subjects/military/pillbox_landscape_features2"},
			{name:"Guildford_HER_Number:_6480",href:"/GetRecord/SHHER_6480"}],
		RANK:1,
		EASTING:502820,
		NORTHING:147600,
		IMG:"/assets/userfiles/Pillbox/Mapping_Project/Guildford/A_Brann/HER6480_Chilworth_02.jpg"},


{
		LINKS:[

{name:"Guildford_Type_24_Pillbox",href:"/themes/subjects/military/pillbox_landscape_features2/pillbox_type_24"},
			{name:"Guildford_HER_Number:_6481",href:"/GetRecord/SHHER_6481"}],
		RANK:1,
		EASTING:503110,
		NORTHING:147824,
		IMG:"/assets/userfiles/Pillbox/Mapping_Project/Guildford/A_Brann/6481_10_and_6481_11_Combined.jpg"},


{
		LINKS:[

{name:"Guildford_Unknown_Type_Pillbox",href:"/themes/subjects/military/pillbox_landscape_features2"},
			{name:"Guildford_HER_Number:_6482",href:"/GetRecord/SHHER_6482"}],
		RANK:1,
		EASTING:503085,
		NORTHING:147820,
		IMG:"/assets/userfiles/Pillbox/Mapping_Project/Guildford/A_Brann/HER6482_Chilworth_01.jpg"},


{
		LINKS:[

{name:"Guildford_Type_24_Pillbox",href:"/themes/subjects/military/pillbox_landscape_features2/pillbox_type_24"},
			{name:"Guildford_HER_Number:_6483",href:"/GetRecord/SHHER_6483"}],
		RANK:1,
		EASTING:503215,
		NORTHING:148412,
		IMG:"/assets/userfiles/Pillbox/Mapping_Project/Guildford/A_Brann/6483_04_and_6483_07_Combined.jpg"},


{
		LINKS:[

{name:"Guildford_Type_24_Pillbox",href:"/themes/subjects/military/pillbox_landscape_features2/pillbox_type_24"},
			{name:"Guildford_HER_Number:_6593",href:"/GetRecord/SHHER_6593"}],
		RANK:1,
		EASTING:507188,
		NORTHING:149091,
		IMG:"/assets/userfiles/Pillbox/Mapping_Project/Guildford/6593a.JPG"},


{
		LINKS:[

{name:"Guildford_Type_24_Pillbox",href:"/themes/subjects/military/pillbox_landscape_features2/pillbox_type_24"},
			{name:"Guildford_HER_Number:_6601",href:"/GetRecord/SHHER_6601"}],
		RANK:1,
		EASTING:506738,
		NORTHING:148791,
		IMG:"/assets/userfiles/Pillbox/Mapping_Project/Guildford/6601b_6601d_combined.jpg"},


{
		LINKS:[

{name:"Guildford_Type_24_Pillbox",href:"/themes/subjects/military/pillbox_landscape_features2/pillbox_type_24"},
			{name:"Guildford_HER_Number:_6602",href:"/GetRecord/SHHER_6602"}],
		RANK:1,
		EASTING:507233,
		NORTHING:148509,
		IMG:"/assets/userfiles/Pillbox/Mapping_Project/Guildford/6602a.JPG"},


{
		LINKS:[

{name:"Guildford_Circular_Variant_Type_Pillbox",href:"/themes/subjects/military/pillbox_landscape_features2"},
			{name:"Guildford_HER_Number:_6715",href:"/GetRecord/SHHER_6715"}],
		RANK:1,
		EASTING:502124,
		NORTHING:147818,
		IMG:"/assets/userfiles/Pillbox/Mapping_Project/Guildford/A_Brann/6715_03_and_6715_04_Combined.jpg"},


{
		LINKS:[

{name:"Guildford_Circular_Drum_Variant_Type_Pillbox",href:"/themes/subjects/military/pillbox_landscape_features2"},
			{name:"Guildford_HER_Number:_6716",href:"/GetRecord/SHHER_6716"}],
		RANK:1,
		EASTING:501900,
		NORTHING:147593,
		IMG:"/assets/userfiles/Pillbox/Mapping_Project/Guildford/A_Brann/HER6716_Chilworth_03.jpg"},


{
		LINKS:[

{name:"Guildford_Type_24_Pillbox",href:"/themes/subjects/military/pillbox_landscape_features2/pillbox_type_24"},
			{name:"Guildford_HER_Number:_6726",href:"/GetRecord/SHHER_6726"}],
		RANK:1,
		EASTING:506780,
		NORTHING:148450,
		IMG:"/assets/userfiles/Pillbox/Mapping_Project/Guildford/A_Brann/HER6726_Juniper_Hill_01.jpg"},


{
		LINKS:[

{name:"Guildford_Type_24_Pillbox",href:"/themes/subjects/military/pillbox_landscape_features2/pillbox_type_24"},
			{name:"Guildford_HER_Number:_6769",href:"/GetRecord/SHHER_6769"}],
		RANK:1,
		EASTING:507490,
		NORTHING:148600,
		IMG:"/assets/userfiles/Pillbox/Mapping_Project/Guildford/6769a_6769b_combined.jpg"},


{
		LINKS:[

{name:"Guildford_Type_28_Pillbox",href:"/themes/subjects/military/pillbox_landscape_features2/pillbox_type_28"},
			{name:"Guildford_HER_Number:_6792",href:"/GetRecord/SHHER_6792"}],
		RANK:1,
		EASTING:504098,
		NORTHING:148310,
		IMG:"/assets/userfiles/Pillbox/Mapping_Project/Guildford/A_Brann/6792_02_and_6792_03_Combined.jpg"},


{
		LINKS:[

{name:"Guildford_Circular_Variant_Type_Pillbox",href:"/themes/subjects/military/pillbox_landscape_features2"},
			{name:"Guildford_HER_Number:_6800",href:"/GetRecord/SHHER_6800"}],
		RANK:1,
		EASTING:502397,
		NORTHING:147776,
		IMG:"/assets/userfiles/Pillbox/Mapping_Project/Guildford/A_Brann/6800_02_and_6800_03_Combined.jpg"},

{
		LINKS:[

{name:"Mole_Valley_Type_24_Pillbox",href:"/themes/subjects/military/pillbox_landscape_features2/pillbox_type_24"},
			{name:"Mole_Valley_HER_Number:_6735",href:"/GetRecord/SHHER_6735"}],
		RANK:1,
		EASTING:511260,
		NORTHING:148680,
		IMG:"/assets/userfiles/Pillbox/Mapping_Project/Mole_Valley/6735.JPG"},

{
		LINKS:[

{name:"Mole_Valley_Type_28_Pillbox",href:"/themes/subjects/military/pillbox_landscape_features2/pillbox_type_28"},
			{name:"Mole_Valley_HER_Number:_6789",href:"/GetRecord/SHHER_6789"}],
		RANK:1,
		EASTING:517400,
		NORTHING:151140,
		IMG:"/assets/userfiles/Pillbox/Mapping_Project/Mole_Valley/6789a.JPG"},


{
		LINKS:[

{name:"Reigate_and_Banstead_Type_24_Pillbox",href:"/themes/subjects/military/pillbox_landscape_features2/pillbox_type_24"},
			{name:"Reigate_and_Banstead_HER_Number:_6160",href:"/GetRecord/SHHER_6160"}],
		RANK:1,
		EASTING:526017,
		NORTHING:147120,
		IMG:"/assets/userfiles/Pillbox/Mapping_Project/Reigate_and_Banstead/6160a.JPG"},


{
		LINKS:[

{name:"Reigate_and_Banstead_Type_24_Pillbox",href:"/themes/subjects/military/pillbox_landscape_features2/pillbox_type_24"},
			{name:"Reigate_and_Banstead_HER_Number:_6161",href:"/GetRecord/SHHER_6161"}],
		RANK:1,
		EASTING:526147,
		NORTHING:147155,
		IMG:"/assets/userfiles/Pillbox/Mapping_Project/Reigate_and_Banstead/6161a.JPG"},


{
		LINKS:[

{name:"Reigate_and_Banstead_Type_28_Pillbox",href:"/themes/subjects/military/pillbox_landscape_features2/pillbox_type_28"},
			{name:"Reigate_and_Banstead_HER_Number:_6459",href:"/GetRecord/SHHER_6459"}],
		RANK:1,
		EASTING:525871,
		NORTHING:147132,
		IMG:"/assets/userfiles/Pillbox/Mapping_Project/Reigate_and_Banstead/6459a.JPG"},


{
		LINKS:[

{name:"Reigate_and_Banstead_Type_24_Pillbox",href:"/themes/subjects/military/pillbox_landscape_features2/pillbox_type_24"},
			{name:"Reigate_and_Banstead_HER_Number:_6573",href:"/GetRecord/SHHER_6573"}],
		RANK:1,
		EASTING:523485,
		NORTHING:148213,
		IMG:"/assets/userfiles/Pillbox/Mapping_Project/Reigate_and_Banstead/6573a.JPG"},


{
		LINKS:[

{name:"Reigate_and_Banstead_Type_28_Pillbox",href:"/themes/subjects/military/pillbox_landscape_features2/pillbox_type_28"},
			{name:"Reigate_and_Banstead_HER_Number:_6644",href:"/GetRecord/SHHER_6644"}],
		RANK:1,
		EASTING:523429,
		NORTHING:148307,
		IMG:"/assets/userfiles/Pillbox/Mapping_Project/Reigate_and_Banstead/6644a.JPG"},


{
		LINKS:[

{name:"Tandridge_Type_24_Pillbox",href:"/themes/subjects/military/pillbox_landscape_features2/pillbox_type_24"},
			{name:"Tandridge_HER_Number:_6164",href:"/GetRecord/SHHER_6164"}],
		RANK:1,
		EASTING:534309,
		NORTHING:144386,
		IMG:"/assets/userfiles/Pillbox/Mapping_Project/Tandridge/6164b.JPG"},


{
		LINKS:[

{name:"Tandridge_Type_24_Pillbox",href:"/themes/subjects/military/pillbox_landscape_features2/pillbox_type_24"},
			{name:"Tandridge_HER_Number:_6167",href:"/GetRecord/SHHER_6167"}],
		RANK:1,
		EASTING:532716,
		NORTHING:144379,
		IMG:"/assets/userfiles/Pillbox/Mapping_Project/Tandridge/6167a.JPG"},


{
		LINKS:[

{name:"Tandridge_Type_24_Pillbox",href:"/themes/subjects/military/pillbox_landscape_features2/pillbox_type_24"},
			{name:"Tandridge_HER_Number:_6168",href:"/GetRecord/SHHER_6168"}],
		RANK:1,
		EASTING:536276,
		NORTHING:145212,
		IMG:"/assets/userfiles/Pillbox/Mapping_Project/Tandridge/6168c.JPG"},


{
		LINKS:[

{name:"Tandridge_Type_26_Pillbox",href:"/themes/subjects/military/pillbox_landscape_features2/pillbox_type_26"},
			{name:"Tandridge_HER_Number:_6169",href:"/GetRecord/SHHER_6169"}],
		RANK:1,
		EASTING:536389,
		NORTHING:145227,
		IMG:"/assets/userfiles/Pillbox/Mapping_Project/Tandridge/6169a.JPG"},


{
		LINKS:[

{name:"Tandridge_Type_24_Pillbox",href:"/themes/subjects/military/pillbox_landscape_features2/pillbox_type_24"},
			{name:"Tandridge_HER_Number:_6173",href:"/GetRecord/SHHER_6173"}],
		RANK:1,
		EASTING:538129,
		NORTHING:145207,
		IMG:"/assets/userfiles/Pillbox/Mapping_Project/Tandridge/6173b.JPG"},


{
		LINKS:[

{name:"Tandridge_Type_24_Pillbox",href:"/themes/subjects/military/pillbox_landscape_features2/pillbox_type_24"},
			{name:"Tandridge_HER_Number:_6174",href:"/GetRecord/SHHER_6174"}],
		RANK:1,
		EASTING:538312,
		NORTHING:145526,
		IMG:"/assets/userfiles/Pillbox/Mapping_Project/Tandridge/6174b.JPG"},


{
		LINKS:[

{name:"Tandridge_Type_26_Pillbox",href:"/themes/subjects/military/pillbox_landscape_features2/pillbox_type_26"},
			{name:"Tandridge_HER_Number:_6177",href:"/GetRecord/SHHER_6177"}],
		RANK:1,
		EASTING:539230,
		NORTHING:145056,
		IMG:"/assets/userfiles/Pillbox/Mapping_Project/Tandridge/6177a.JPG"},


{
		LINKS:[

{name:"Tandridge_Type_24_Pillbox",href:"/themes/subjects/military/pillbox_landscape_features2/pillbox_type_24"},
			{name:"Tandridge_HER_Number:_6192",href:"/GetRecord/SHHER_6192"}],
		RANK:1,
		EASTING:533191,
		NORTHING:143937,
		IMG:"/assets/userfiles/Pillbox/Mapping_Project/Tandridge/6192a.JPG"},


{
		LINKS:[

{name:"Tandridge_Type_24_Pillbox",href:"/themes/subjects/military/pillbox_landscape_features2/pillbox_type_24"},
			{name:"Tandridge_HER_Number:_6193",href:"/GetRecord/SHHER_6193"}],
		RANK:1,
		EASTING:533342,
		NORTHING:144177,
		IMG:"/assets/userfiles/Pillbox/Mapping_Project/Tandridge/6193B.JPG"},


{
		LINKS:[

{name:"Tandridge_Type_24_Pillbox",href:"/themes/subjects/military/pillbox_landscape_features2/pillbox_type_24"},
			{name:"Tandridge_HER_Number:_6194",href:"/GetRecord/SHHER_6194"}],
		RANK:1,
		EASTING:533521,
		NORTHING:144281,
		IMG:"/assets/userfiles/Pillbox/Mapping_Project/Tandridge/6194a.JPG"},


{
		LINKS:[

{name:"Tandridge_Type_24_Pillbox",href:"/themes/subjects/military/pillbox_landscape_features2/pillbox_type_24"},
			{name:"Tandridge_HER_Number:_6195",href:"/GetRecord/SHHER_6195"}],
		RANK:1,
		EASTING:533626,
		NORTHING:144018,
		IMG:"/assets/userfiles/Pillbox/Mapping_Project/Tandridge/6195b.JPG"},


{
		LINKS:[

{name:"Tandridge_Type_24_Pillbox",href:"/themes/subjects/military/pillbox_landscape_features2/pillbox_type_24"},
			{name:"Tandridge_HER_Number:_6196",href:"/GetRecord/SHHER_6196"}],
		RANK:1,
		EASTING:539450,
		NORTHING:145760,
		IMG:"/assets/userfiles/Pillbox/Mapping_Project/Tandridge/6196b.JPG"},


{
		LINKS:[

{name:"Tandridge_Type_24_Variant_Pillbox",href:"/themes/subjects/military/pillbox_landscape_features2/pillbox_type_24"},
			{name:"Tandridge_HER_Number:_6201",href:"/GetRecord/SHHER_6201"}],
		RANK:1,
		EASTING:533965,
		NORTHING:144120,
		IMG:"/assets/userfiles/Pillbox/Mapping_Project/Tandridge/6201.JPG"},


{
		LINKS:[

{name:"Tandridge_Type_26_Pillbox",href:"/themes/subjects/military/pillbox_landscape_features2/pillbox_type_26"},
			{name:"Tandridge_HER_Number:_6275",href:"/GetRecord/SHHER_6275"}],
		RANK:1,
		EASTING:537200,
		NORTHING:145100,
		IMG:"/assets/userfiles/Pillbox/Mapping_Project/Tandridge/6275a.JPG"},


{
		LINKS:[

{name:"Tandridge_Type_24_Pillbox",href:"/themes/subjects/military/pillbox_landscape_features2/pillbox_type_24"},
			{name:"Tandridge_HER_Number:_6390",href:"/GetRecord/SHHER_6390"}],
		RANK:1,
		EASTING:542575,
		NORTHING:145090,
		IMG:"/assets/userfiles/Pillbox/Mapping_Project/Tandridge/6390a.JPG"},


{
		LINKS:[

{name:"Tandridge_Type_24_Pillbox",href:"/themes/subjects/military/pillbox_landscape_features2/pillbox_type_24"},
			{name:"Tandridge_HER_Number:_6452",href:"/GetRecord/SHHER_6452"}],
		RANK:1,
		EASTING:536180,
		NORTHING:145027,
		IMG:"/assets/userfiles/Pillbox/Mapping_Project/Tandridge/6452c.JPG"},


{
		LINKS:[

{name:"Tandridge_Type_26_Pillbox",href:"/themes/subjects/military/pillbox_landscape_features2/pillbox_type_26"},
			{name:"Tandridge_HER_Number:_6453",href:"/GetRecord/SHHER_6453"}],
		RANK:1,
		EASTING:536061,
		NORTHING:144980,
		IMG:"/assets/userfiles/Pillbox/Mapping_Project/Tandridge/6453e.JPG"},


{
		LINKS:[

{name:"Tandridge_Type_26_Pillbox",href:"/themes/subjects/military/pillbox_landscape_features2/pillbox_type_26"},
			{name:"Tandridge_HER_Number:_6454",href:"/GetRecord/SHHER_6454"}],
		RANK:1,
		EASTING:536092,
		NORTHING:145005,
		IMG:"/assets/userfiles/Pillbox/Mapping_Project/Tandridge/6454a_6454b_combined.jpg"},


{
		LINKS:[

{name:"Tandridge_Type_26_Pillbox",href:"/themes/subjects/military/pillbox_landscape_features2/pillbox_type_26"},
			{name:"Tandridge_HER_Number:_6455",href:"/GetRecord/SHHER_6455"}],
		RANK:1,
		EASTING:536650,
		NORTHING:145250,
		IMG:"/assets/userfiles/Pillbox/Mapping_Project/Tandridge/6455a.JPG"},


{
		LINKS:[

{name:"Tandridge_Type_28_Pillbox",href:"/themes/subjects/military/pillbox_landscape_features2/pillbox_type_28"},
			{name:"Tandridge_HER_Number:_6459",href:"/GetRecord/SHHER_6459"}],
		RANK:1,
		EASTING:525871,
		NORTHING:147132,
		IMG:"/assets/userfiles/Pillbox/Mapping_Project/Tandridge/6459b.JPG"},


{
		LINKS:[

{name:"Tandridge_Type_26_Pillbox",href:"/themes/subjects/military/pillbox_landscape_features2/pillbox_type_26"},
			{name:"Tandridge_HER_Number:_6497",href:"/GetRecord/SHHER_6497"}],
		RANK:1,
		EASTING:536753,
		NORTHING:145375,
		IMG:"/assets/userfiles/Pillbox/Mapping_Project/Tandridge/6497.JPG"},


{
		LINKS:[

{name:"Tandridge_Type_24_Pillbox",href:"/themes/subjects/military/pillbox_landscape_features2/pillbox_type_24"},
			{name:"Tandridge_HER_Number:_6522",href:"/GetRecord/SHHER_6522"}],
		RANK:1,
		EASTING:536900,
		NORTHING:145028,
		IMG:"/assets/userfiles/Pillbox/Mapping_Project/Tandridge/6522c.JPG"},


{
		LINKS:[

{name:"Tandridge_Type_24_Pillbox",href:"/themes/subjects/military/pillbox_landscape_features2/pillbox_type_24"},
			{name:"Tandridge_HER_Number:_6523",href:"/GetRecord/SHHER_6523"}],
		RANK:1,
		EASTING:536950,
		NORTHING:145027,
		IMG:"/assets/userfiles/Pillbox/Mapping_Project/Tandridge/6523a.JPG"},


{
		LINKS:[

{name:"Tandridge_Type_24_Pillbox",href:"/themes/subjects/military/pillbox_landscape_features2/pillbox_type_24"},
			{name:"Tandridge_HER_Number:_6534",href:"/GetRecord/SHHER_6534"}],
		RANK:1,
		EASTING:534291,
		NORTHING:144226,
		IMG:"/assets/userfiles/Pillbox/Mapping_Project/Tandridge/6534b.JPG"},


{
		LINKS:[

{name:"Tandridge_Type_24_Pillbox",href:"/themes/subjects/military/pillbox_landscape_features2/pillbox_type_24"},
			{name:"Tandridge_HER_Number:_6537",href:"/GetRecord/SHHER_6537"}],
		RANK:1,
		EASTING:531800,
		NORTHING:144016,
		IMG:"/assets/userfiles/Pillbox/Mapping_Project/Tandridge/6537.JPG"},


{
		LINKS:[

{name:"Tandridge_Type_24_Pillbox",href:"/themes/subjects/military/pillbox_landscape_features2/pillbox_type_24"},
			{name:"Tandridge_HER_Number:_6538",href:"/GetRecord/SHHER_6538"}],
		RANK:1,
		EASTING:534654,
		NORTHING:144465,
		IMG:"/assets/userfiles/Pillbox/Mapping_Project/Tandridge/6538.JPG"},


{
		LINKS:[

{name:"Tandridge_Type_24_Pillbox",href:"/themes/subjects/military/pillbox_landscape_features2/pillbox_type_24"},
			{name:"Tandridge_HER_Number:_6541",href:"/GetRecord/SHHER_6541"}],
		RANK:1,
		EASTING:532520,
		NORTHING:144332,
		IMG:"/assets/userfiles/Pillbox/Mapping_Project/Tandridge/6541a.JPG"},


{
		LINKS:[

{name:"Tandridge_Type_24_Pillbox",href:"/themes/subjects/military/pillbox_landscape_features2/pillbox_type_24"},
			{name:"Tandridge_HER_Number:_6542",href:"/GetRecord/SHHER_6542"}],
		RANK:1,
		EASTING:536970,
		NORTHING:145301,
		IMG:"/assets/userfiles/Pillbox/Mapping_Project/Tandridge/6542.JPG"},


{
		LINKS:[

{name:"Tandridge_Type_24_Pillbox",href:"/themes/subjects/military/pillbox_landscape_features2/pillbox_type_24"},
			{name:"Tandridge_HER_Number:_6543",href:"/GetRecord/SHHER_6543"}],
		RANK:1,
		EASTING:536996,
		NORTHING:145641,
		IMG:"/assets/userfiles/Pillbox/Mapping_Project/Tandridge/6543a.JPG"},


{
		LINKS:[

{name:"Tandridge_Type_24_Pillbox",href:"/themes/subjects/military/pillbox_landscape_features2/pillbox_type_24"},
			{name:"Tandridge_HER_Number:_6544",href:"/GetRecord/SHHER_6544"}],
		RANK:1,
		EASTING:537365,
		NORTHING:145411,
		IMG:"/assets/userfiles/Pillbox/Mapping_Project/Tandridge/6544b.JPG"},


{
		LINKS:[

{name:"Tandridge_Type_24_Pillbox",href:"/themes/subjects/military/pillbox_landscape_features2/pillbox_type_24"},
			{name:"Tandridge_HER_Number:_6546",href:"/GetRecord/SHHER_6546"}],
		RANK:1,
		EASTING:538384,
		NORTHING:145345,
		IMG:"/assets/userfiles/Pillbox/Mapping_Project/Tandridge/6546a.JPG"},


{
		LINKS:[

{name:"Tandridge_Type_26_Pillbox",href:"/themes/subjects/military/pillbox_landscape_features2/pillbox_type_26"},
			{name:"Tandridge_HER_Number:_6547",href:"/GetRecord/SHHER_6547"}],
		RANK:1,
		EASTING:528740,
		NORTHING:145210,
		IMG:"/assets/userfiles/Pillbox/Mapping_Project/Tandridge/6547b_6547c_combined.jpg"},


{
		LINKS:[

{name:"Tandridge_Type_24_Pillbox",href:"/themes/subjects/military/pillbox_landscape_features2/pillbox_type_24"},
			{name:"Tandridge_HER_Number:_6553",href:"/GetRecord/SHHER_6553"}],
		RANK:1,
		EASTING:539277,
		NORTHING:145296,
		IMG:"/assets/userfiles/Pillbox/Mapping_Project/Tandridge/6553a.JPG"},


{
		LINKS:[

{name:"Tandridge_Type_24_Pillbox",href:"/themes/subjects/military/pillbox_landscape_features2/pillbox_type_24"},
			{name:"Tandridge_HER_Number:_6554",href:"/GetRecord/SHHER_6554"}],
		RANK:1,
		EASTING:539737,
		NORTHING:145220,
		IMG:"/assets/userfiles/Pillbox/Mapping_Project/Tandridge/6554a.JPG"},


{
		LINKS:[

{name:"Tandridge_Type_24_Pillbox",href:"/themes/subjects/military/pillbox_landscape_features2/pillbox_type_24"},
			{name:"Tandridge_HER_Number:_6555",href:"/GetRecord/SHHER_6555"}],
		RANK:1,
		EASTING:539100,
		NORTHING:145320,
		IMG:"/assets/userfiles/Pillbox/Mapping_Project/Tandridge/6555.JPG"},


{
		LINKS:[

{name:"Tandridge_Type_24_Pillbox",href:"/themes/subjects/military/pillbox_landscape_features2/pillbox_type_24"},
			{name:"Tandridge_HER_Number:_6559",href:"/GetRecord/SHHER_6559"}],
		RANK:1,
		EASTING:541290,
		NORTHING:145100,
		IMG:"/assets/userfiles/Pillbox/Mapping_Project/Tandridge/6559b.JPG"},


{
		LINKS:[

{name:"Tandridge_Type_24_Pillbox",href:"/themes/subjects/military/pillbox_landscape_features2/pillbox_type_24"},
			{name:"Tandridge_HER_Number:_6561",href:"/GetRecord/SHHER_6561"}],
		RANK:1,
		EASTING:541681,
		NORTHING:145242,
		IMG:"/assets/userfiles/Pillbox/Mapping_Project/Tandridge/6561b.JPG"},


{
		LINKS:[

{name:"Tandridge_Type_24_Pillbox",href:"/themes/subjects/military/pillbox_landscape_features2/pillbox_type_24"},
			{name:"Tandridge_HER_Number:_6563",href:"/GetRecord/SHHER_6563"}],
		RANK:1,
		EASTING:542253,
		NORTHING:144954,
		IMG:"/assets/userfiles/Pillbox/Mapping_Project/Tandridge/6563a.JPG"},


{
		LINKS:[

{name:"Tandridge_Type_24_Pillbox",href:"/themes/subjects/military/pillbox_landscape_features2/pillbox_type_24"},
			{name:"Tandridge_HER_Number:_6564",href:"/GetRecord/SHHER_6564"}],
		RANK:1,
		EASTING:542050,
		NORTHING:145590,
		IMG:"/assets/userfiles/Pillbox/Mapping_Project/Tandridge/6564a.JPG"},


{
		LINKS:[

{name:"Tandridge_Type_28_Pillbox",href:"/themes/subjects/military/pillbox_landscape_features2/pillbox_type_28"},
			{name:"Tandridge_HER_Number:_6615",href:"/GetRecord/SHHER_6615"}],
		RANK:1,
		EASTING:529531,
		NORTHING:144673,
		IMG:"/assets/userfiles/Pillbox/Mapping_Project/Tandridge/6615a.JPG"},


{
		LINKS:[

{name:"Tandridge_Type_24_Pillbox",href:"/themes/subjects/military/pillbox_landscape_features2/pillbox_type_24"},
			{name:"Tandridge_HER_Number:_6622",href:"/GetRecord/SHHER_6622"}],
		RANK:1,
		EASTING:532754,
		NORTHING:143854,
		IMG:"/assets/userfiles/Pillbox/Mapping_Project/Tandridge/6622d.JPG"},


{
		LINKS:[

{name:"Tandridge_Type_24_Pillbox",href:"/themes/subjects/military/pillbox_landscape_features2/pillbox_type_24"},
			{name:"Tandridge_HER_Number:_6623",href:"/GetRecord/SHHER_6623"}],
		RANK:1,
		EASTING:533068,
		NORTHING:143878,
		IMG:"/assets/userfiles/Pillbox/Mapping_Project/Tandridge/6623a.JPG"},


{
		LINKS:[

{name:"Tandridge_Type_24_Pillbox",href:"/themes/subjects/military/pillbox_landscape_features2/pillbox_type_24"},
			{name:"Tandridge_HER_Number:_6624",href:"/GetRecord/SHHER_6624"}],
		RANK:1,
		EASTING:533412,
		NORTHING:144335,
		IMG:"/assets/userfiles/Pillbox/Mapping_Project/Tandridge/6624a.JPG"},


{
		LINKS:[

{name:"Tandridge_Type_24_Pillbox",href:"/themes/subjects/military/pillbox_landscape_features2/pillbox_type_24"},
			{name:"Tandridge_HER_Number:_6625",href:"/GetRecord/SHHER_6625"}],
		RANK:1,
		EASTING:533520,
		NORTHING:144306,
		IMG:"/assets/userfiles/Pillbox/Mapping_Project/Tandridge/6625b.JPG"},


{
		LINKS:[

{name:"Tandridge_Type_24_Pillbox",href:"/themes/subjects/military/pillbox_landscape_features2/pillbox_type_24"},
			{name:"Tandridge_HER_Number:_6626",href:"/GetRecord/SHHER_6626"}],
		RANK:1,
		EASTING:539018,
		NORTHING:145162,
		IMG:"/assets/userfiles/Pillbox/Mapping_Project/Tandridge/6626a.JPG"},


{
		LINKS:[

{name:"Tandridge_Type_26_Pillbox",href:"/themes/subjects/military/pillbox_landscape_features2/pillbox_type_26"},
			{name:"Tandridge_HER_Number:_6634",href:"/GetRecord/SHHER_6634"}],
		RANK:1,
		EASTING:521100,
		NORTHING:149200,
		IMG:"/assets/userfiles/Pillbox/Mapping_Project/Tandridge/6634c.JPG"},


{
		LINKS:[

{name:"Tandridge_Type_28_Pillbox",href:"/themes/subjects/military/pillbox_landscape_features2/pillbox_type_28"},
			{name:"Tandridge_HER_Number:_6636",href:"/GetRecord/SHHER_6636"}],
		RANK:1,
		EASTING:534020,
		NORTHING:144120,
		IMG:"/assets/userfiles/Pillbox/Mapping_Project/Tandridge/6636a.JPG"},


{
		LINKS:[

{name:"Tandridge_Type_28_Pillbox",href:"/themes/subjects/military/pillbox_landscape_features2/pillbox_type_28"},
			{name:"Tandridge_HER_Number:_6637",href:"/GetRecord/SHHER_6637"}],
		RANK:1,
		EASTING:535148,
		NORTHING:144293,
		IMG:"/assets/userfiles/Pillbox/Mapping_Project/Tandridge/6637d.JPG"},


{
		LINKS:[

{name:"Tandridge_Type_26_Pillbox",href:"/themes/subjects/military/pillbox_landscape_features2/pillbox_type_26"},
			{name:"Tandridge_HER_Number:_6639",href:"/GetRecord/SHHER_6639"}],
		RANK:1,
		EASTING:532450,
		NORTHING:143950,
		IMG:"/assets/userfiles/Pillbox/Mapping_Project/Tandridge/6639a.JPG"},


{
		LINKS:[

{name:"Tandridge_Type_28_Pillbox",href:"/themes/subjects/military/pillbox_landscape_features2/pillbox_type_28"},
			{name:"Tandridge_HER_Number:_6643",href:"/GetRecord/SHHER_6643"}],
		RANK:1,
		EASTING:538944,
		NORTHING:145228,
		IMG:"/assets/userfiles/Pillbox/Mapping_Project/Tandridge/6643e.JPG"},


{
		LINKS:[

{name:"Tandridge_Type_28_Pillbox",href:"/themes/subjects/military/pillbox_landscape_features2/pillbox_type_28"},
			{name:"Tandridge_HER_Number:_6652",href:"/GetRecord/SHHER_6652"}],
		RANK:1,
		EASTING:533260,
		NORTHING:144005,
		IMG:"/assets/userfiles/Pillbox/Mapping_Project/Tandridge/6652a.JPG"},


{
		LINKS:[

{name:"Tandridge_Type_24_Pillbox",href:"/themes/subjects/military/pillbox_landscape_features2/pillbox_type_24"},
			{name:"Tandridge_HER_Number:_6660",href:"/GetRecord/SHHER_6660"}],
		RANK:1,
		EASTING:534105,
		NORTHING:144311,
		IMG:"/assets/userfiles/Pillbox/Mapping_Project/Tandridge/6660a.JPG"},


{
		LINKS:[

{name:"Tandridge_Type_26_Pillbox",href:"/themes/subjects/military/pillbox_landscape_features2/pillbox_type_26"},
			{name:"Tandridge_HER_Number:_6704",href:"/GetRecord/SHHER_6704"}],
		RANK:1,
		EASTING:537960,
		NORTHING:145220,
		IMG:"/assets/userfiles/Pillbox/Mapping_Project/Tandridge/6704a.JPG"},


{
		LINKS:[

{name:"Tandridge_Type_26_Pillbox",href:"/themes/subjects/military/pillbox_landscape_features2/pillbox_type_26"},
			{name:"Tandridge_HER_Number:_6706",href:"/GetRecord/SHHER_6706"}],
		RANK:1,
		EASTING:538787,
		NORTHING:145313,
		IMG:"/assets/userfiles/Pillbox/Mapping_Project/Tandridge/6706a.JPG"},


{
		LINKS:[

{name:"Tandridge_Type_26_Pillbox",href:"/themes/subjects/military/pillbox_landscape_features2/pillbox_type_26"},
			{name:"Tandridge_HER_Number:_6707",href:"/GetRecord/SHHER_6707"}],
		RANK:1,
		EASTING:538766,
		NORTHING:145321,
		IMG:"/assets/userfiles/Pillbox/Mapping_Project/Tandridge/6707a.JPG"},


{
		LINKS:[

{name:"Tandridge_Type_24_Pillbox",href:"/themes/subjects/military/pillbox_landscape_features2/pillbox_type_24"},
			{name:"Tandridge_HER_Number:_6731",href:"/GetRecord/SHHER_6731"}],
		RANK:1,
		EASTING:532326,
		NORTHING:144285,
		IMG:"/assets/userfiles/Pillbox/Mapping_Project/Tandridge/6731a.JPG"},


{
		LINKS:[

{name:"Tandridge_Type_24_Pillbox",href:"/themes/subjects/military/pillbox_landscape_features2/pillbox_type_24"},
			{name:"Tandridge_HER_Number:_6755",href:"/GetRecord/SHHER_6755"}],
		RANK:1,
		EASTING:534614,
		NORTHING:144550,
		IMG:"/assets/userfiles/Pillbox/Mapping_Project/Tandridge/6755b.JPG"},


{
		LINKS:[

{name:"Tandridge_Type_24_Pillbox",href:"/themes/subjects/military/pillbox_landscape_features2/pillbox_type_24"},
			{name:"Tandridge_HER_Number:_6758",href:"/GetRecord/SHHER_6758"}],
		RANK:1,
		EASTING:539824,
		NORTHING:145466,
		IMG:"/assets/userfiles/Pillbox/Mapping_Project/Tandridge/6758a.JPG"},


{
		LINKS:[

{name:"Tandridge_Type_24_Pillbox",href:"/themes/subjects/military/pillbox_landscape_features2/pillbox_type_24"},
			{name:"Tandridge_HER_Number:_6760",href:"/GetRecord/SHHER_6760"}],
		RANK:1,
		EASTING:531240,
		NORTHING:143920,
		IMG:"/assets/userfiles/Pillbox/Mapping_Project/Tandridge/6760.JPG"},


{
		LINKS:[

{name:"Tandridge_Type_26_Pillbox",href:"/themes/subjects/military/pillbox_landscape_features2/pillbox_type_26"},
			{name:"Tandridge_HER_Number:_6780",href:"/GetRecord/SHHER_6780"}],
		RANK:1,
		EASTING:531454,
		NORTHING:143938,
		IMG:"/assets/userfiles/Pillbox/Mapping_Project/Tandridge/6780e.JPG"},


{
		LINKS:[

{name:"Tandridge_Type_26_Pillbox",href:"/themes/subjects/military/pillbox_landscape_features2/pillbox_type_26"},
			{name:"Tandridge_HER_Number:_6781",href:"/GetRecord/SHHER_6781"}],
		RANK:1,
		EASTING:531560,
		NORTHING:143958,
		IMG:"/assets/userfiles/Pillbox/Mapping_Project/Tandridge/6781a.JPG"},


{
		LINKS:[

{name:"Tandridge_Type_28_Pillbox",href:"/themes/subjects/military/pillbox_landscape_features2/pillbox_type_28"},
			{name:"Tandridge_HER_Number:_6787",href:"/GetRecord/SHHER_6787"}],
		RANK:1,
		EASTING:539447,
		NORTHING:145300,
		IMG:"/assets/userfiles/Pillbox/Mapping_Project/Tandridge/6787c.JPG"},


{
		LINKS:[

{name:"Tandridge_Air_Ministry_Pattern_Pillbox",href:"/themes/subjects/military/pillbox_landscape_features2"},
			{name:"Tandridge_HER_Number:_6844",href:"/GetRecord/SHHER_6844"}],
		RANK:1,
		EASTING:529583,
		NORTHING:148287,
		IMG:"/assets/userfiles/Pillbox/Mapping_Project/Tandridge/6844c_6844b_combined.jpg"},


{
		LINKS:[

{name:"Waverley_Type_24_Pillbox",href:"/themes/subjects/military/pillbox_landscape_features2/pillbox_type_24"},
			{name:"Waverely_HER_Number:_6299",href:"/GetRecord/SHHER_6299"}],
		RANK:1,
		EASTING:487030,
		NORTHING:145519,
		IMG:"/assets/userfiles/Pillbox/Mapping_Project/Waverly/6299A.JPG"},


{
		LINKS:[

{name:"Waverely_Type_28_Pillbox",href:"/themes/subjects/military/pillbox_landscape_features2/pillbox_type_28"},
			{name:"Waverely_HER_Number:_6410",href:"/GetRecord/SHHER_6410"}],
		RANK:1,
		EASTING:493780,
		NORTHING:143724,
		IMG:"/assets/userfiles/Pillbox/Mapping_Project/Waverly/6410d_6410c_combined.jpg"},


{
		LINKS:[

{name:"Waverely_Type_24_Pillbox",href:"/themes/subjects/military/pillbox_landscape_features2/pillbox_type_24"},
			{name:"Waverely_HER_Number:_6582",href:"/GetRecord/SHHER_6582"}],
		RANK:1,
		EASTING:482970,
		NORTHING:148770,
		IMG:"/assets/userfiles/Pillbox/Mapping_Project/Waverly/6582.JPG"},


{
		LINKS:[

{name:"Waverely_Type_24_Pillbox",href:"/themes/subjects/military/pillbox_landscape_features2/pillbox_type_24"},
			{name:"Waverely_HER_Number:_6583",href:"/GetRecord/SHHER_6583"}],
		RANK:1,
		EASTING:482950,
		NORTHING:148720,
		IMG:"/assets/userfiles/Pillbox/Mapping_Project/Waverly/6583.JPG"},


{
		LINKS:[

{name:"Waverely_Type_24_Pillbox",href:"/themes/subjects/military/pillbox_landscape_features2/pillbox_type_24"},
			{name:"Waverely_HER_Number:_6584",href:"/GetRecord/SHHER_6584"}],
		RANK:1,
		EASTING:482910,
		NORTHING:148780,
		IMG:"/assets/userfiles/Pillbox/Mapping_Project/Waverly/6584.JPG"},


{
		LINKS:[

{name:"Waverely_Type_24_Pillbox",href:"/themes/subjects/military/pillbox_landscape_features2/pillbox_type_24"},
			{name:"Waverely_HER_Number:_6589",href:"/GetRecord/SHHER_6589"}],
		RANK:1,
		EASTING:486130,
		NORTHING:146640,
		IMG:"/assets/userfiles/Pillbox/Mapping_Project/Waverly/6589.JPG"},


{
		LINKS:[

{name:"Waverely_Type_25_Pillbox",href:"/themes/subjects/military/pillbox_landscape_features2/pillbox_type_25"},
			{name:"Waverely_HER_Number:_6629",href:"/GetRecord/SHHER_6629"}],
		RANK:1,
		EASTING:487375,
		NORTHING:144680,
		IMG:"/assets/userfiles/Pillbox/Mapping_Project/Waverly/6629b_6629d_combined.jpg"},


{
		LINKS:[

{name:"Waverely_Assault_Training_Pillbox",href:"/themes/subjects/military/pillbox_landscape_features2"},
			{name:"Waverely_HER_Number:_6737",href:"/GetRecord/SHHER_6737"}],
		RANK:1,
		EASTING:487948,
		NORTHING:140522,
		IMG:"/assets/userfiles/Pillbox/Mapping_Project/Waverly/6737a.jpg"},


{
		LINKS:[

{name:"Waverely_Type_22_Pillbox",href:"/themes/subjects/military/pillbox_landscape_features2/pillbox_type_22"},
			{name:"Waverely_HER_Number:_6748",href:"/GetRecord/SHHER_6748"}],
		RANK:1,
		EASTING:494008,
		NORTHING:143634,
		IMG:"/assets/userfiles/Pillbox/Mapping_Project/Waverly/6748a.JPG"},


{
		LINKS:[

{name:"Waverely_Type_24_Variant_Pillbox",href:"/themes/subjects/military/pillbox_landscape_features2/pillbox_type_24"},
			{name:"Waverely_HER_Number:_6764",href:"/GetRecord/SHHER_6764"}],
		RANK:1,
		EASTING:486675,
		NORTHING:146098,
		IMG:"/assets/userfiles/Pillbox/Mapping_Project/Waverly/6764c.JPG"},


{
		LINKS:[

{name:"Woking_Type_26_Pillbox",href:"/themes/subjects/military/pillbox_landscape_features2/pillbox_type_26"},
			{name:"woking_HER_Number:_6368",href:"/GetRecord/SHHER_6368"}],
		RANK:1,
		EASTING:496800,
		NORTHING:157210,
		IMG:"/assets/userfiles/Pillbox/Mapping_Project/Woking___A_Brann_/6368_01_and_6368_02_Combined.jpg"}



];

/**
 * Initialise the map
 */
var PLACES_MAP;
var PLACES_MGR;
function places_mapInit() 
{
	if (GBrowserIsCompatible()) 
	{
		PLACES_MAP = new GMap2(document.getElementById("map_canvas"));
		PLACES_MAP.addControl(new GLargeMapControl());
		PLACES_MAP.addControl(new GMapTypeControl());
		PLACES_MAP.setCenter(new GLatLng(PLACES_START_LNG,PLACES_START_LAT),PLACES_START_ZOOM);
		PLACES_MAP.setMapType(G_HYBRID_MAP);
		window.setTimeout(places_setupMarkers, 0);
	}
}
function places_setupMarkers() 
{
	PLACES_MGR = new MarkerManager(PLACES_MAP);
	PLACES_MGR.addMarkers(places_getMarkers(1), 3);
	PLACES_MGR.addMarkers(places_getMarkers(2), 11);
	PLACES_MGR.addMarkers(places_getMarkers(3), 12);
	PLACES_MGR.addMarkers(places_getMarkers(4), 13);
	PLACES_MGR.addMarkers(places_getMarkers(5), 14);
	PLACES_MGR.addMarkers(places_getMarkers(6), 15);
	PLACES_MGR.refresh();
}
function places_getMarkers(maxRank)
{
	var batch = [];
	for(var i in PLACES)
	{
		if(PLACES[i].RANK<=maxRank)
		{
			batch.push(places_createMarker(PLACES[i]));
		}
	}
	return batch;
}
function places_createMarker(place)
{	
	var osref = new OSRef(place.EASTING,place.NORTHING);
	var latlng = osref.toLatLng();			
	var point = new GLatLng(latlng.lat,latlng.lng);
    var marker = new GMarker(point);
    GEvent.addListener(marker, "click", function()
	{
		// Initialise local variables
		var html = '';
		var links = [];		
		var imageexists = '&nbsp;';
		
		// Cycle through the array of LINKS
		for(var i=0;i<place.LINKS.length;i++)
		{
			links.push('<a href="' + place.LINKS[i].href + '" class="placeLINK" target = "_blank">' + place.LINKS[i].name + '</a>');
		}	
		// Add to the info window html
		html+= '<ul><li>'+links.join('</li><li>')+'</li></ul>';		
		
		// Insert an image if one is specified
		if(place.IMG!='')
		{
			html+= '<div align=center><img src="'+ place.IMG + '" height="100" /></div>';
		}
		
		// Finish off the html
		html+= '<ul><li class="district"><strong>Click the link above to read more about this type of pillbox</strong></li></ul>';
			
		
		html+= '<div style="clear"></div>';
		
		// Assign the html to the info window
		marker.openInfoWindowHtml(html);
	});
	return marker;
}







































//--------------------------------------------------------------------------
// JScoord
// jscoord.js
//
// (c) 2005 Jonathan Stott
//
// Created on 21-Dec-2005
//
// 1.1.1 - 16 Jan 2006
//  - Fixed radix bug in getOSRefFromSixFigureReference that would return
//    the incorrect reference if either the northing or the easting started
//    with a leading zero.
// 1.1 - 23 Dec 2005
//  - Added getOSRefFromSixFigureReference function.
// 1.0 - 11 Aug 2005
//  - Initial version created from PHPcoord v1.1
//--------------------------------------------------------------------------


// ================================================================== LatLng

function LatLng(lat, lng) {
  this.lat = lat;
  this.lng = lng;
     
  this.distance = LatLngDistance;
      
  this.toOSRef = LatLngToOSRef;
  this.toUTMRef = LatLngToUTMRef;
      
  this.WGS84ToOSGB36 = WGS84ToOSGB36;
  this.OSGB36ToWGS84 = OSGB36ToWGS84;
      
  this.toString = LatLngToString;
}

function LatLngToString() {
  return "(" + this.lat + ", " + this.lng + ")";
}


// =================================================================== OSRef

// References given with OSRef are accurate to 1m.
function OSRef(easting, northing) {
  this.easting  = easting;
  this.northing = northing;
    
  this.toLatLng = OSRefToLatLng;
    
  this.toString = OSRefToString;
  this.toSixFigureString = OSRefToSixFigureString;
}


function OSRefToString() {
  return "(" + this.easting + ", " + this.northing + ")";
}


function OSRefToSixFigureString() {
  var hundredkmE = Math.floor(this.easting / 100000);
  var hundredkmN = Math.floor(this.northing / 100000);
  var firstLetter = "";
  if (hundredkmN < 5) {
    if (hundredkmE < 5) {
      firstLetter = "S";
    } else {
      firstLetter = "T";
    }
  } else if (hundredkmN < 10) {
    if (hundredkmE < 5) {
      firstLetter = "N";
    } else {
      firstLetter = "O";
    }
  } else {
    firstLetter = "H";
  }

  var secondLetter = "";
  var index = 65 + ((4 - (hundredkmN % 5)) * 5) + (hundredkmE % 5);
  var ti = index;
  if (index >= 73) index++;
  secondLetter = chr(index);

  var e = Math.floor((this.easting - (100000 * hundredkmE)) / 100);
  var n = Math.floor((this.northing - (100000 * hundredkmN)) / 100);
  var es = e;
  if (e < 100) es = "0" + es;
  if (e < 10)  es = "0" + es;
  var ns = n;
  if (n < 100) ns = "0" + ns;
  if (n < 10)  ns = "0" + ns;

  return firstLetter + secondLetter + es + ns;
}


// ================================================================== UTMRef

function UTMRef(easting, northing, latZone, lngZone) {
  this.easting  = easting;
  this.northing = northing;
  this.latZone  = latZone;
  this.lngZone  = lngZone;
    
  this.toLatLng = UTMRefToLatLng;
    
  this.toString = UTMRefToString;
}


function UTMRefToString() {
  return this.lngZone + this.latZone + " " +
         this.easting + " " + this.northing;
}


// ================================================================== RefEll

function RefEll(maj, min) {
  this.maj = maj;
  this.min = min;
  this.ecc = ((maj * maj) - (min * min)) / (maj * maj);
}


// ================================================== Mathematical Functions

function sinSquared(x) {
  return Math.sin(x) * Math.sin(x);
}

function cosSquared(x) {
  return Math.cos(x) * Math.cos(x);
}

function tanSquared(x) {
  return Math.tan(x) * Math.tan(x);
}

function sec(x) {
  return 1.0 / Math.cos(x);
}
  
function deg2rad(x) {
  return x * (Math.PI / 180);
}
  
function rad2deg(x) {
  return x * (180 / Math.PI);
}
  
function chr(x) {
  var h = x.toString (16);
  if (h.length == 1)
    h = "0" + h;
  h = "%" + h;
  return unescape (h);
}
  
function ord(x) {
  var c = x.charAt(0);
  var i;
  for (i = 0; i < 256; ++ i) {
    var h = i.toString (16);
    if (h.length == 1)
      h = "0" + h;
    h = "%" + h;
    h = unescape (h);
    if (h == c)
      break;
  }
  return i;
}


// ========================================================= Other Functions

function LatLngDistance(to) {
  var er = 6366.707;

  var latFrom = deg2rad(this.lat);
  var latTo   = deg2rad(to.lat);
  var lngFrom = deg2rad(this.lng);
  var lngTo   = deg2rad(to.lng);

  var x1 = er * Math.cos(lngFrom) * Math.sin(latFrom);
  var y1 = er * Math.sin(lngFrom) * Math.sin(latFrom);
  var z1 = er * Math.cos(latFrom);

  var x2 = er * Math.cos(lngTo) * Math.sin(latTo);
  var y2 = er * Math.sin(lngTo) * Math.sin(latTo);
  var z2 = er * Math.cos(latTo);

  var d = Math.sqrt((x1-x2)*(x1-x2)+(y1-y2)*(y1-y2)+(z1-z2)*(z1-z2));

  return d;
}


// ==================================================== Conversion Functions

function OSGB36ToWGS84() {
  var airy1830 = new RefEll(6377563.396, 6356256.909);
  var a        = airy1830.maj;
  var b        = airy1830.min;
  var eSquared = airy1830.ecc;
  var phi = deg2rad(this.lat);
  var lambda = deg2rad(this.lng);
  var v = a / (Math.sqrt(1 - eSquared * sinSquared(phi)));
  var H = 0; // height
  var x = (v + H) * Math.cos(phi) * Math.cos(lambda);
  var y = (v + H) * Math.cos(phi) * Math.sin(lambda);
  var z = ((1 - eSquared) * v + H) * Math.sin(phi);

  var tx =        446.448;
  var ty =       -124.157;
  var tz =        542.060;
  var s  =         -0.0000204894;
  var rx = deg2rad( 0.00004172222);
  var ry = deg2rad( 0.00006861111);
  var rz = deg2rad( 0.00023391666);

  var xB = tx + (x * (1 + s)) + (-rx * y)     + (ry * z);
  var yB = ty + (rz * x)      + (y * (1 + s)) + (-rx * z);
  var zB = tz + (-ry * x)     + (rx * y)      + (z * (1 + s));

  var wgs84 = new RefEll(6378137.000, 6356752.3141);
  a        = wgs84.maj;
  b        = wgs84.min;
  eSquared = wgs84.ecc;

  var lambdaB = rad2deg(Math.atan(yB / xB));
  var p = Math.sqrt((xB * xB) + (yB * yB));
  var phiN = Math.atan(zB / (p * (1 - eSquared)));
  for (var i = 1; i < 10; i++) {
    v = a / (Math.sqrt(1 - eSquared * sinSquared(phiN)));
    phiN1 = Math.atan((zB + (eSquared * v * Math.sin(phiN))) / p);
    phiN = phiN1;
  }

  var phiB = rad2deg(phiN);
    
  this.lat = phiB;
  this.lng = lambdaB;
}

function WGS84ToOSGB36() {
  var wgs84 = new RefEll(6378137.000, 6356752.3141);
  var a        = wgs84.maj;
  var b        = wgs84.min;
  var eSquared = wgs84.ecc;
  var phi = deg2rad(this.lat);
  var lambda = deg2rad(this.lng);
  var v = a / (Math.sqrt(1 - eSquared * sinSquared(phi)));
  var H = 0; // height
  var x = (v + H) * Math.cos(phi) * Math.cos(lambda);
  var y = (v + H) * Math.cos(phi) * Math.sin(lambda);
  var z = ((1 - eSquared) * v + H) * Math.sin(phi);

  var tx =       -446.448;
  var ty =        124.157;
  var tz =       -542.060;
  var s  =          0.0000204894;
  var rx = deg2rad(-0.00004172222);
  var ry = deg2rad(-0.00006861111);
  var rz = deg2rad(-0.00023391666);

  var xB = tx + (x * (1 + s)) + (-rx * y)     + (ry * z);
  var yB = ty + (rz * x)      + (y * (1 + s)) + (-rx * z);
  var zB = tz + (-ry * x)     + (rx * y)      + (z * (1 + s));

  var airy1830 = new RefEll(6377563.396, 6356256.909);
  a        = airy1830.maj;
  b        = airy1830.min;
  eSquared = airy1830.ecc;

  var lambdaB = rad2deg(Math.atan(yB / xB));
  var p = Math.sqrt((xB * xB) + (yB * yB));
  var phiN = Math.atan(zB / (p * (1 - eSquared)));
  for (var i = 1; i < 10; i++) {
    v = a / (Math.sqrt(1 - eSquared * sinSquared(phiN)));
    phiN1 = Math.atan((zB + (eSquared * v * Math.sin(phiN))) / p);
    phiN = phiN1;
  }

  var phiB = rad2deg(phiN);
    
  this.lat = phiB;
  this.lng = lambdaB;
}

function OSRefToLatLng() {
  var airy1830 = new RefEll(6377563.396, 6356256.909);
  var OSGB_F0  = 0.9996012717;
  var N0       = -100000.0;
  var E0       = 400000.0;
  var phi0     = deg2rad(49.0);
  var lambda0  = deg2rad(-2.0);
  var a        = airy1830.maj;
  var b        = airy1830.min;
  var eSquared = airy1830.ecc;
  var phi      = 0.0;
  var lambda   = 0.0;
  var E        = this.easting;
  var N        = this.northing;
  var n        = (a - b) / (a + b);
  var M        = 0.0;
  var phiPrime = ((N - N0) / (a * OSGB_F0)) + phi0;
  do {
    M =
      (b * OSGB_F0)
        * (((1 + n + ((5.0 / 4.0) * n * n) + ((5.0 / 4.0) * n * n * n))
          * (phiPrime - phi0))
          - (((3 * n) + (3 * n * n) + ((21.0 / 8.0) * n * n * n))
            * Math.sin(phiPrime - phi0)
            * Math.cos(phiPrime + phi0))
          + ((((15.0 / 8.0) * n * n) + ((15.0 / 8.0) * n * n * n))
            * Math.sin(2.0 * (phiPrime - phi0))
            * Math.cos(2.0 * (phiPrime + phi0)))
          - (((35.0 / 24.0) * n * n * n)
            * Math.sin(3.0 * (phiPrime - phi0))
            * Math.cos(3.0 * (phiPrime + phi0))));
    phiPrime += (N - N0 - M) / (a * OSGB_F0);
  } while ((N - N0 - M) >= 0.001);
  var v = a * OSGB_F0 * Math.pow(1.0 - eSquared * sinSquared(phiPrime), -0.5);
  var rho =
    a
      * OSGB_F0
      * (1.0 - eSquared)
      * Math.pow(1.0 - eSquared * sinSquared(phiPrime), -1.5);
  var etaSquared = (v / rho) - 1.0;
  var VII = Math.tan(phiPrime) / (2 * rho * v);
  var VIII =
    (Math.tan(phiPrime) / (24.0 * rho * Math.pow(v, 3.0)))
      * (5.0
        + (3.0 * tanSquared(phiPrime))
        + etaSquared
        - (9.0 * tanSquared(phiPrime) * etaSquared));
  var IX =
    (Math.tan(phiPrime) / (720.0 * rho * Math.pow(v, 5.0)))
      * (61.0
        + (90.0 * tanSquared(phiPrime))
        + (45.0 * tanSquared(phiPrime) * tanSquared(phiPrime)));
  var X = sec(phiPrime) / v;
  var XI =
    (sec(phiPrime) / (6.0 * v * v * v))
      * ((v / rho) + (2 * tanSquared(phiPrime)));
  var XII =
    (sec(phiPrime) / (120.0 * Math.pow(v, 5.0)))
      * (5.0
        + (28.0 * tanSquared(phiPrime))
        + (24.0 * tanSquared(phiPrime) * tanSquared(phiPrime)));
  var XIIA =
    (sec(phiPrime) / (5040.0 * Math.pow(v, 7.0)))
      * (61.0
        + (662.0 * tanSquared(phiPrime))
        + (1320.0 * tanSquared(phiPrime) * tanSquared(phiPrime))
        + (720.0
          * tanSquared(phiPrime)
          * tanSquared(phiPrime)
          * tanSquared(phiPrime)));
  phi =
    phiPrime
      - (VII * Math.pow(E - E0, 2.0))
      + (VIII * Math.pow(E - E0, 4.0))
      - (IX * Math.pow(E - E0, 6.0));
  lambda =
    lambda0
      + (X * (E - E0))
      - (XI * Math.pow(E - E0, 3.0))
      + (XII * Math.pow(E - E0, 5.0))
      - (XIIA * Math.pow(E - E0, 7.0));

  return new LatLng(rad2deg(phi), rad2deg(lambda));
}


/**
 * Convert a latitude and longitude into an OSGB grid reference
 *
 * @param latitudeLongitude the latitude and longitude to convert
 * @return the OSGB grid reference
 * @since 0.1
 */
function LatLngToOSRef() {
  var airy1830 = new RefEll(6377563.396, 6356256.909);
  var OSGB_F0  = 0.9996012717;
  var N0       = -100000.0;
  var E0       = 400000.0;
  var phi0     = deg2rad(49.0);
  var lambda0  = deg2rad(-2.0);
  var a        = airy1830.maj;
  var b        = airy1830.min;
  var eSquared = airy1830.ecc;
  var phi = deg2rad(this.lat);
  var lambda = deg2rad(this.lng);
  var E = 0.0;
  var N = 0.0;
  var n = (a - b) / (a + b);
  var v = a * OSGB_F0 * Math.pow(1.0 - eSquared * sinSquared(phi), -0.5);
  var rho =
    a * OSGB_F0 * (1.0 - eSquared) * Math.pow(1.0 - eSquared * sinSquared(phi), -1.5);
  var etaSquared = (v / rho) - 1.0;
  var M =
    (b * OSGB_F0)
      * (((1 + n + ((5.0 / 4.0) * n * n) + ((5.0 / 4.0) * n * n * n))
        * (phi - phi0))
        - (((3 * n) + (3 * n * n) + ((21.0 / 8.0) * n * n * n))
          * Math.sin(phi - phi0)
          * Math.cos(phi + phi0))
        + ((((15.0 / 8.0) * n * n) + ((15.0 / 8.0) * n * n * n))
          * Math.sin(2.0 * (phi - phi0))
          * Math.cos(2.0 * (phi + phi0)))
        - (((35.0 / 24.0) * n * n * n)
          * Math.sin(3.0 * (phi - phi0))
          * Math.cos(3.0 * (phi + phi0))));
  var I = M + N0;
  var II = (v / 2.0) * Math.sin(phi) * Math.cos(phi);
  var III =
    (v / 24.0)
      * Math.sin(phi)
      * Math.pow(Math.cos(phi), 3.0)
      * (5.0 - tanSquared(phi) + (9.0 * etaSquared));
  var IIIA =
    (v / 720.0)
      * Math.sin(phi)
      * Math.pow(Math.cos(phi), 5.0)
      * (61.0 - (58.0 * tanSquared(phi)) + Math.pow(Math.tan(phi), 4.0));
  var IV = v * Math.cos(phi);
  var V = (v / 6.0) * Math.pow(Math.cos(phi), 3.0) * ((v / rho) - tanSquared(phi));
  var VI =
    (v / 120.0)
      * Math.pow(Math.cos(phi), 5.0)
      * (5.0
        - (18.0 * tanSquared(phi))
        + (Math.pow(Math.tan(phi), 4.0))
        + (14 * etaSquared)
        - (58 * tanSquared(phi) * etaSquared));

  N =
    I
      + (II * Math.pow(lambda - lambda0, 2.0))
      + (III * Math.pow(lambda - lambda0, 4.0))
      + (IIIA * Math.pow(lambda - lambda0, 6.0));
  E =
    E0
      + (IV * (lambda - lambda0))
      + (V * Math.pow(lambda - lambda0, 3.0))
      + (VI * Math.pow(lambda - lambda0, 5.0));

  return new OSRef(E, N);
}


/**
 * Convert an UTM reference to a latitude and longitude
 *
 * @param ellipsoid A reference ellipsoid to use
 * @param utm the UTM reference to convert
 * @return the converted latitude and longitude
 * @since 0.2
 */
function UTMRefToLatLng() {
  var wgs84 = new RefEll(6378137, 6356752.314);
  var UTM_F0   = 0.9996;
  var a = wgs84.maj;
  var eSquared = wgs84.ecc;
  var ePrimeSquared = eSquared / (1.0 - eSquared);
  var e1 = (1 - Math.sqrt(1 - eSquared)) / (1 + Math.sqrt(1 - eSquared));
  var x = this.easting - 500000.0;;
  var y = this.northing;
  var zoneNumber = this.lngZone;
  var zoneLetter = this.latZone;

  var longitudeOrigin = (zoneNumber - 1.0) * 6.0 - 180.0 + 3.0;

  // Correct y for southern hemisphere
  if ((ord(zoneLetter) - ord("N")) < 0) {
    y -= 10000000.0;
  }

  var m = y / UTM_F0;
  var mu =
    m
      / (a
        * (1.0
          - eSquared / 4.0
          - 3.0 * eSquared * eSquared / 64.0
          - 5.0
            * Math.pow(eSquared, 3.0)
            / 256.0));

  var phi1Rad =
    mu
      + (3.0 * e1 / 2.0 - 27.0 * Math.pow(e1, 3.0) / 32.0) * Math.sin(2.0 * mu)
      + (21.0 * e1 * e1 / 16.0 - 55.0 * Math.pow(e1, 4.0) / 32.0)
        * Math.sin(4.0 * mu)
      + (151.0 * Math.pow(e1, 3.0) / 96.0) * Math.sin(6.0 * mu);

  var n =
    a
      / Math.sqrt(1.0 - eSquared * Math.sin(phi1Rad) * Math.sin(phi1Rad));
  var t = Math.tan(phi1Rad) * Math.tan(phi1Rad);
  var c = ePrimeSquared * Math.cos(phi1Rad) * Math.cos(phi1Rad);
  var r =
    a
      * (1.0 - eSquared)
      / Math.pow(
        1.0 - eSquared * Math.sin(phi1Rad) * Math.sin(phi1Rad),
        1.5);
  var d = x / (n * UTM_F0);

  var latitude = (
    phi1Rad
      - (n * Math.tan(phi1Rad) / r)
        * (d * d / 2.0
          - (5.0
            + (3.0 * t)
            + (10.0 * c)
            - (4.0 * c * c)
            - (9.0 * ePrimeSquared))
            * Math.pow(d, 4.0)
            / 24.0
          + (61.0
            + (90.0 * t)
            + (298.0 * c)
            + (45.0 * t * t)
            - (252.0 * ePrimeSquared)
            - (3.0 * c * c))
            * Math.pow(d, 6.0)
            / 720.0)) * (180.0 / Math.PI);

  var longitude = longitudeOrigin + (
    (d
      - (1.0 + 2.0 * t + c) * Math.pow(d, 3.0) / 6.0
      + (5.0
        - (2.0 * c)
        + (28.0 * t)
        - (3.0 * c * c)
        + (8.0 * ePrimeSquared)
        + (24.0 * t * t))
        * Math.pow(d, 5.0)
        / 120.0)
      / Math.cos(phi1Rad)) * (180.0 / Math.PI);

  return new LatLng(latitude, longitude);
}


/**
 * Convert a latitude and longitude to an UTM reference
 *
 * @param ellipsoid A reference ellipsoid to use
 * @param latitudeLongitude The latitude and longitude to convert
 * @return the converted UTM reference
 * @since 0.2
 */
function LatLngToUTMRef() {
  var wgs84 = new RefEll(6378137, 6356752.314);
  var UTM_F0   = 0.9996;
  var a = wgs84.maj;
  var eSquared = wgs84.ecc;
  var longitude = this.lng;
  var latitude = this.lat;

  var latitudeRad = latitude * (Math.PI / 180.0);
  var longitudeRad = longitude * (Math.PI / 180.0);
  var longitudeZone = Math.floor((longitude + 180.0) / 6.0) + 1;

  // Special zone for Norway
  if (latitude >= 56.0
    && latitude < 64.0
    && longitude >= 3.0
    && longitude < 12.0) {
    longitudeZone = 32;
  }

  // Special zones for Svalbard
  if (latitude >= 72.0 && latitude < 84.0) {
    if (longitude >= 0.0 && longitude < 9.0) {
      longitudeZone = 31;
    } else if (longitude >= 9.0 && longitude < 21.0) {
      longitudeZone = 33;
    } else if (longitude >= 21.0 && longitude < 33.0) {
      longitudeZone = 35;
    } else if (longitude >= 33.0 && longitude < 42.0) {
      longitudeZone = 37;
    }
  }

  var longitudeOrigin = (longitudeZone - 1) * 6 - 180 + 3;
  var longitudeOriginRad = longitudeOrigin * (Math.PI / 180.0);

  var UTMZone = getUTMLatitudeZoneLetter(latitude);

  ePrimeSquared = (eSquared) / (1 - eSquared);

  var n = a / Math.sqrt(1 - eSquared * Math.sin(latitudeRad) * Math.sin(latitudeRad));
  var t = Math.tan(latitudeRad) * Math.tan(latitudeRad);
  var c = ePrimeSquared * Math.cos(latitudeRad) * Math.cos(latitudeRad);
  var A = Math.cos(latitudeRad) * (longitudeRad - longitudeOriginRad);

  var M =
    a
      * ((1
        - eSquared / 4
        - 3 * eSquared * eSquared / 64
        - 5 * eSquared * eSquared * eSquared / 256)
        * latitudeRad
        - (3 * eSquared / 8
          + 3 * eSquared * eSquared / 32
          + 45 * eSquared * eSquared * eSquared / 1024)
          * Math.sin(2 * latitudeRad)
        + (15 * eSquared * eSquared / 256
          + 45 * eSquared * eSquared * eSquared / 1024)
          * Math.sin(4 * latitudeRad)
        - (35 * eSquared * eSquared * eSquared / 3072)
          * Math.sin(6 * latitudeRad));

  var UTMEasting =
    (UTM_F0
      * n
      * (A
        + (1 - t + c) * Math.pow(A, 3.0) / 6
        + (5 - 18 * t + t * t + 72 * c - 58 * ePrimeSquared)
          * Math.pow(A, 5.0)
          / 120)
      + 500000.0);

  var UTMNorthing =
    (UTM_F0
      * (M
        + n
          * Math.tan(latitudeRad)
          * (A * A / 2
            + (5 - t + (9 * c) + (4 * c * c)) * Math.pow(A, 4.0) / 24
            + (61 - (58 * t) + (t * t) + (600 * c) - (330 * ePrimeSquared))
              * Math.pow(A, 6.0)
              / 720)));

  // Adjust for the southern hemisphere
  if (latitude < 0) {
    UTMNorthing += 10000000.0;
  }

  return new UTMRef(UTMEasting, UTMNorthing, UTMZone, longitudeZone);
}

/**
 * Take a string formatted as a six-figure OS grid reference (e.g.
 * "TG514131") and return a reference to an OSRef object that represents
 * that grid reference. The first character must be H, N, S, O or T.
 * The second character can be any uppercase character from A through Z
 * excluding I.
 *
 * @param ref
 * @return
 * @since 1.1
 */
function getOSRefFromSixFigureReference(ref) {
  var char1 = ref.substring(0, 1);
  var char2 = ref.substring(1, 2);
  // Thanks to Nick Holloway for pointing out the radix bug here
  var east  = parseInt(ref.substring(2, 5), 10) * 100;
  var north = parseInt(ref.substring(5, 8), 10) * 100;
  if (char1 == 'H') {
    north += 1000000;
  } else if (char1 == 'N') {
    north += 500000;
  } else if (char1 == 'O') {
    north += 500000;
    east  += 500000;
  } else if (char1 == 'T') {
    east += 500000;
  }
  var char2ord = ord(char2);
  if (char2ord > 73) char2ord--; // Adjust for no I
  var nx = ((char2ord - 65) % 5) * 100000;
  var ny = (4 - Math.floor((char2ord - 65) / 5)) * 100000;
  return new OSRef(east + nx, north + ny);
}


/**
 *  Work out the UTM latitude zone from the latitude
 *
 * @param latitude
 * @return
 * @since 0.2
 */
function getUTMLatitudeZoneLetter(latitude) {
  if ((84 >= latitude) && (latitude >= 72)) return "X";
  else if (( 72 > latitude) && (latitude >=  64)) return "W";
  else if (( 64 > latitude) && (latitude >=  56)) return "V";
  else if (( 56 > latitude) && (latitude >=  48)) return "U";
  else if (( 48 > latitude) && (latitude >=  40)) return "T";
  else if (( 40 > latitude) && (latitude >=  32)) return "S";
  else if (( 32 > latitude) && (latitude >=  24)) return "R";
  else if (( 24 > latitude) && (latitude >=  16)) return "Q";
  else if (( 16 > latitude) && (latitude >=   8)) return "P";
  else if ((  8 > latitude) && (latitude >=   0)) return "N";
  else if ((  0 > latitude) && (latitude >=  -8)) return "M";
  else if (( -8 > latitude) && (latitude >= -16)) return "L";
  else if ((-16 > latitude) && (latitude >= -24)) return "K";
  else if ((-24 > latitude) && (latitude >= -32)) return "J";
  else if ((-32 > latitude) && (latitude >= -40)) return "H";
  else if ((-40 > latitude) && (latitude >= -48)) return "G";
  else if ((-48 > latitude) && (latitude >= -56)) return "F";
  else if ((-56 > latitude) && (latitude >= -64)) return "E";
  else if ((-64 > latitude) && (latitude >= -72)) return "D";
  else if ((-72 > latitude) && (latitude >= -80)) return "C";
  else return 'Z';
}
