			function errorMsg() {
				alert ("Error: Invalid UK map reference. Ensure that you use a predefined location from the menu. If you wish to use your own OS map reference ensure that it is a map reference on the mainland UK and full 3 digit eastings and northings are entered") ;
					}

			window.onerror = errorMsg;

			function testForm() {
					result = "fail" ;
					if (test_mountain != "") {
						result = "pass" ;
						}
					if (test_region != "NONE" && test_easting != "000" && test_northing != "000" && test_easting.charAt(2) != "" && test_northing.charAt(2) != "") {
						result = "pass" ;
						}
				}	

			function compute(form) {

				result = "notdone" ;
				test_mountain = form.mountain.value
				test_region = form.region.value
				test_easting = form.easting.value
				test_northing = form.northing.value
				testForm() ;
												
				url_1 = "http://www.streetmap.co.uk/newmap.srf?x=" ;
				url_3 = "&y=" ;
				url_5 = "&z=3"
				url_6 = "&sv="
				url_7 = ","
				url_8 = "&st=4&tl=Map+from+www.walkhigh.co.uk&bi=background=http://www.walkhigh.co.uk/acatalog/biglogo.gif&lu=N&ar=Y" ;

				if (form.mountain.value == "") {
					bigy = eval(form.region.value.substring(0,2)) ;
					bigx = form.region.value.charAt(3) ;
					url_2 = bigx + form.easting.value +"00";
					url_4 = bigy + form.northing.value +"00";
					targeturl = url_1 + url_2 + url_3 + url_4 + url_5 + url_6 + url_2 + url_7 + url_4 + url_8; 
					}

				else 	{
					url_2 = form.mountain.value.substring(0,6);
					url_4 = form.mountain.value.substring(6,12);
					targeturl = url_1 + url_2 + url_3 + url_4 + url_5 + url_6 + url_2 + url_7 + url_4 + url_8; 
					}

				if (result != "pass" ) {
					errorMsg() ;
					}

				else	{
					popupwindow=window.open(targeturl,"Map","height=500,width=800,top=50,left=50,scrollbars=yes")
					}
					
			return ;
			}
