// function printMap() { if ( document.forms.add_form.poi_type.selectedIndex > 0 ) { var center = map.getCenter(); var mapType = map.getCurrentMapType(); var mapBounds = escape(map.getBoundsLatLng()); // getZoom seems to return the inverse of the zoom var mapCurrentZoom = 17 - map.getZoom(); var mapSize = map.getSize(); var page = document.getElementById('page').value; var popwindow = ''; popwindow = window.open('http://www.gonmad.co.uk/satnav/printMap.php?page='+page+'&mWidth='+mapSize.width+'&mHeight='+mapSize.height+'&mZoom='+mapCurrentZoom+'&cLat='+center.lat()+'&cLng='+center.lng()+'&mapBounds='+mapBounds+'&zoom=&poi_type='+document.forms.add_form.poi_type[document.forms.add_form.poi_type.selectedIndex].value,'popwindow','Width=640, Height=620,resizable,scrollbars'); popwindow.focus(); } else { alert("You must select a PoI type before printing a map."); } return(false); } // function screenWidth() { if(navigator.appName == "Netscape"){ var windowwidth = window.innerWidth; }else if(navigator.appName == "Microsoft Internet Explorer"){ var windowwidth = document.body.clientWidth; }else{ var windowwidth = 500; } return windowwidth; } function screenHeight() { if(navigator.appName == "Netscape"){ var windowheight = window.innerHeight; }else if(navigator.appName == "Microsoft Internet Explorer"){ var windowheight = document.body.clientHeight; }else{ var windowwidth = 550; } return windowheight; } function setMapSize() { var newWidth = screenWidth(); var newHeight = screenHeight(); newWidth = newWidth - 460; if(newWidth < 450) { // stop bold in editor with > newWidth = 450; } newWidth = newWidth + "px"; newHeight = newHeight - 70; newHeight = newHeight + "px"; // document.getElementById('map').style.height = newHeight; document.getElementById('map').style.width = newWidth; // map.checkResize() ; } // Initialise the map function load_map() { // Load the map if (!map) { map = new GMap(document.getElementById("map")); // center the map and set wide on UK map.addControl(new GLargeMapControl()); map.addControl(new GMapTypeControl()); map.addControl(new GOverviewMapControl()); map.enableDoubleClickZoom(); map.enableContinuousZoom(); // map.setMapType(G_HYBRID_TYPE); map.setMapType(G_HYBRID_MAP); map.centerAndZoom(new GPoint(-2.05888, 53.64455), 12); // params (e/w,n/s,zoom) } // Add the listener that adds the marker and reads the lat/long info // ??? Is this listener needed or is it this that causes the JS errors ??? // GEvent.addListener(map, 'click', function(overlay, point) { // Set lat and long in form // document.getElementById('latitude').value = point.y; // document.getElementById('longitude').value = point.x; // document.getElementById('edit_latitude').value = point.y; // document.getElementById('edit_longitude').value = point.x; // }); GEvent.addListener(map, 'zoomend', function(oldLevel, newLevel) { oldLevel = 17 - oldLevel; newLevel = 17 - newLevel; // alert("zoomend triggered. old level=" + oldLevel + ", new level=" + newLevel); if ( ( oldLevel >= iconSizeUpperZoomThresh && newLevel < iconSizeUpperZoomThresh ) || ( oldLevel < iconSizeUpperZoomThresh && newLevel >= iconSizeUpperZoomThresh ) || ( oldLevel >= iconSizeLowerZoomThresh && newLevel < iconSizeLowerZoomThresh ) || ( oldLevel < iconSizeLowerZoomThresh && newLevel >= iconSizeLowerZoomThresh ) ){ // zoom level has crossed a threshold for icon size // alert("zoom level has crossed a threshold for icon size. old level=" + oldLevel + ", new level=" + newLevel); type_change(); // sets and loads the new icon size! display_current_pois(); } }); marker = new GMarker(map.getCenter(), {draggable: true}); marker.enableDragging(); // When the marker is moved, center the map on this point // (which in turn updates the form) GEvent.addListener(marker, "dragend", function() { map.panTo(marker.getPoint()); }); map.addOverlay(marker); // When the map is moved, update the form and move the marker GEvent.addListener(map, "moveend", function() { var center = map.getCenter(); document.getElementById("latitude").value = center.lat(); document.getElementById("longitude").value = center.lng(); document.getElementById("edit_latitude").value = center.lat(); document.getElementById("edit_longitude").value = center.lng(); marker.setPoint(center); }); } // Called whenever the File type drop down selection changes function file_type_change() { // Change the button type that gens the file if ( document.forms.add_form.file_type.options[document.forms.add_form.file_type.selectedIndex].value == "att" ) { document.getElementById('addToTomTomButton').style.visibility='visible'; document.getElementById('addToTomTomButton').style.display='block'; document.getElementById('genFileButton').style.visibility='hidden'; document.getElementById('genFileButton').style.display='none'; } else { document.getElementById('genFileButton').style.visibility='visible'; document.getElementById('genFileButton').style.display='block'; document.getElementById('addToTomTomButton').style.visibility='hidden'; document.getElementById('addToTomTomButton').style.display='none'; } // Disable the region selector if file type is add to tomtom (add to tomtom requires all pois) if ( document.forms.add_form.file_type.options[document.forms.add_form.file_type.selectedIndex].value == "att" ) { document.getElementById('fixed_region').style.visibility='visible'; document.getElementById('fixed_region').style.display='block'; document.getElementById('selectable_region').style.visibility='hidden'; document.getElementById('selectable_region').style.display='none'; } else { document.getElementById('selectable_region').style.visibility='visible'; document.getElementById('selectable_region').style.display='block'; document.getElementById('fixed_region').style.visibility='hidden'; document.getElementById('fixed_region').style.display='none'; } } // Called whenever the PoI type drop down selection changes function type_change() { var start_tag = ""; var end_tag = ""; //alert("into type change"); switch (document.forms.add_form.poi_type[document.forms.add_form.poi_type.selectedIndex].value) { case "": document.getElementById('descr_descr').innerHTML = start_tag + end_tag; active_poi_type = ""; document.getElementById('bmp_icon').src = "satnav/bmp_blank.bmp"; document.getElementById('gif_icon').src = "satnav/gif_blank.gif"; document.getElementById('png_icon').src = "satnav/png_blank.png"; document.getElementById('filename').value = ""; break; case "dis_park": //alert("Please enter the number of disabled parking spaces at this location and a brief description of where they are.
e.g. "High Street: 1 place outside WH Smiths", or
"Townsville Station: 2 spaces by station entrance""); document.getElementById('descr_descr').innerHTML = start_tag + "Please enter the number of disabled parking spaces at this location and a brief description of where they are.
e.g. "High Street: 1 place outside WH Smiths", or
"Townsville Station: 2 spaces by station entrance"" + end_tag; document.getElementById('edit_descr_descr').innerHTML = start_tag + "Please enter the number of disabled parking spaces at this location and a brief description of where they are.
e.g. "High Street: 1 place outside WH Smiths", or
"Townsville Station: 2 spaces by station entrance"" + end_tag; active_icon = dis_park_icon; document.getElementById('phone_number_entry_add').style.visibility='hidden'; document.getElementById('phone_number_entry_add').style.display='none'; document.getElementById('phone_number_entry_cur').style.visibility='hidden'; document.getElementById('phone_number_entry_cur').style.display='none'; document.getElementById('phone_number_entry_edit').style.visibility='hidden'; document.getElementById('phone_number_entry_edit').style.display='none'; var zoomLevel = 17 - map.getZoom(); if ( zoomLevel < iconSizeLowerZoomThresh ) { // correct editor display with > // alert("big icon in type change (zoom level = " + zoomLevel + ")"); active_icon = dis_park_icon; } else if ( zoomLevel >= iconSizeLowerZoomThresh && zoomLevel < iconSizeUpperZoomThresh ) { // correct editor display with > // alert("small icon in type change (zoom level = " + zoomLevel + ")"); active_icon = sm_dis_park_icon; } else if ( zoomLevel >= iconSizeUpperZoomThresh ) { // alert("tiny icon in type change (zoom level = " + zoomLevel + ")"); active_icon = tiny_dis_park_icon; } active_poi_type = "dis_park"; // sm_active_icon = sm_dis_park_icon; // tiny_active_icon = tiny_dis_park_icon; document.getElementById('bmp_icon').src = "http://www.gonmad.co.uk/satnav/Disabled_Parking_Places.bmp"; document.getElementById('gif_icon').src = "http://www.gonmad.co.uk/satnav/disabled_parking.gif"; document.getElementById('png_icon').src = "http://www.gonmad.co.uk/satnav/disabled_parking.png"; document.getElementById('filename').value = "Disabled_Parking_Places"; break; case "radar_key": //alert("Please enter a brief description of the facility.
e.g. "Towsnville Station: Accessible toilet on platform 10""); document.getElementById('descr_descr').innerHTML = start_tag + "Please enter a brief description of the facility.
e.g. "Towsnville Station: Accessible toilet on platform 10"" + end_tag; document.getElementById('edit_descr_descr').innerHTML = start_tag + "Please enter a brief description of the facility.
e.g. "Towsnville Station: Accessible toilet on platform 10"" + end_tag; active_icon = radar_key_icon; document.getElementById('phone_number_entry_add').style.visibility='hidden'; document.getElementById('phone_number_entry_add').style.display='none'; document.getElementById('phone_number_entry_cur').style.visibility='hidden'; document.getElementById('phone_number_entry_cur').style.display='none'; document.getElementById('phone_number_entry_edit').style.visibility='hidden'; document.getElementById('phone_number_entry_edit').style.display='none'; var zoomLevel = 17 - map.getZoom(); if ( zoomLevel < iconSizeLowerZoomThresh ) { // correct editor display with > // alert("big icon in type change (zoom level = " + zoomLevel + ")"); active_icon = radar_key_icon; } else if ( zoomLevel >= iconSizeLowerZoomThresh && zoomLevel < iconSizeUpperZoomThresh ) { // correct editor display with > // alert("small icon in type change (zoom level = " + zoomLevel + ")"); active_icon = sm_radar_key_icon; } else if ( zoomLevel >= iconSizeUpperZoomThresh ) { // alert("tiny icon in type change (zoom level = " + zoomLevel + ")"); active_icon = tiny_radar_key_icon; } active_poi_type = "radar_key"; // sm_active_icon = sm_radar_key_icon; // tiny_active_icon = tiny_radar_key_icon; document.getElementById('bmp_icon').src = "http://www.gonmad.co.uk/satnav/Radar_Key_Toilets.bmp"; document.getElementById('gif_icon').src = "http://www.gonmad.co.uk/satnav/radar_toilets.gif"; document.getElementById('png_icon').src = "http://www.gonmad.co.uk/satnav/radar_toilets.png"; document.getElementById('filename').value = "Radar_Key_Toilets"; break; case "shopmobility": //alert("Please enter the town/city and location of the Shopmobility facility.
e.g. "Townsville: Shoparama Shopping Center, Multistory car park""); document.getElementById('descr_descr').innerHTML = start_tag + "Please enter the town/city and location of the Shopmobility facility.
e.g. "Townsville: Shoparama Shopping Center, Multistory car park"" + end_tag; document.getElementById('edit_descr_descr').innerHTML = start_tag + "Please enter the town/city and location of the Shopmobility facility.
e.g. "Townsville: Shoparama Shopping Center, Multistory car park"" + end_tag; active_icon = shopmobility_icon; document.getElementById('phone_number_entry_add').style.visibility='visible'; document.getElementById('phone_number_entry_add').style.display='block'; document.getElementById('phone_number_entry_cur').style.visibility='visible'; document.getElementById('phone_number_entry_cur').style.display='block'; document.getElementById('phone_number_entry_edit').style.visibility='visible'; document.getElementById('phone_number_entry_edit').style.display='block'; var zoomLevel = 17 - map.getZoom(); if ( zoomLevel < iconSizeLowerZoomThresh ) { // correct editor display with > // alert("big icon in type change (zoom level = " + zoomLevel + ")"); active_icon = shopmobility_icon; } else if ( zoomLevel >= iconSizeLowerZoomThresh && zoomLevel < iconSizeUpperZoomThresh ) { // correct editor display with > // alert("small icon in type change (zoom level = " + zoomLevel + ")"); active_icon = sm_shopmobility_icon; } else if ( zoomLevel >= iconSizeUpperZoomThresh ) { // alert("tiny icon in type change (zoom level = " + zoomLevel + ")"); active_icon = tiny_shopmobility_icon; } active_poi_type = "shopmobility"; // sm_active_icon = sm_shopmobility_icon; // tiny_active_icon = tiny_shopmobility_icon; document.getElementById('bmp_icon').src = "http://www.gonmad.co.uk/satnav/Shopmobility_Centre.bmp"; document.getElementById('gif_icon').src = "http://www.gonmad.co.uk/satnav/shopmobility.gif"; document.getElementById('png_icon').src = "http://www.gonmad.co.uk/satnav/shopmobility.png"; document.getElementById('filename').value = "Shopmobility_Centre"; break; case "mway_servs": //alert("Enter the name of the service station and the facilities/shops there."); document.getElementById('descr_descr').innerHTML = start_tag + "Enter the name of the service station and the facilities/shops there." + end_tag; document.getElementById('edit_descr_descr').innerHTML = start_tag + "Enter the name of the service station and the facilities/shops there." + end_tag; active_icon = mway_servs_icon; document.getElementById('phone_number_entry_add').style.visibility='visible'; document.getElementById('phone_number_entry_add').style.display='block'; document.getElementById('phone_number_entry_cur').style.visibility='visible'; document.getElementById('phone_number_entry_cur').style.display='block'; document.getElementById('phone_number_entry_edit').style.visibility='visible'; document.getElementById('phone_number_entry_edit').style.display='block'; var zoomLevel = 17 - map.getZoom(); if ( zoomLevel < iconSizeLowerZoomThresh ) { // correct editor display with > // alert("big icon in type change (zoom level = " + zoomLevel + ")"); active_icon = mway_servs_icon; } else if ( zoomLevel >= iconSizeLowerZoomThresh && zoomLevel < iconSizeUpperZoomThresh ) { // correct editor display with > // alert("small icon in type change (zoom level = " + zoomLevel + ")"); active_icon = sm_mway_servs_icon; } else if ( zoomLevel >= iconSizeUpperZoomThresh ) { // alert("tiny icon in type change (zoom level = " + zoomLevel + ")"); active_icon = tiny_mway_servs_icon; } active_poi_type = "mway_servs"; // sm_active_icon = sm_mway_servs_icon; // tiny_active_icon = tiny_mway_servs_icon; document.getElementById('bmp_icon').src = "http://www.gonmad.co.uk/satnav/Motorway_Services.bmp"; document.getElementById('gif_icon').src = "http://www.gonmad.co.uk/satnav/motorway_services.gif"; document.getElementById('png_icon').src = "http://www.gonmad.co.uk/satnav/motorway_services.png"; document.getElementById('filename').value = "Motorway_Services"; break; case "pubs_and_bars": //alert("Please enter the name of the pub/bar and a brief description.
e.g. "The Horse and Groom: Quiet country pub with typical pub grub and real ales.""); document.getElementById('descr_descr').innerHTML = start_tag + "Please enter the name of the pub/bar and a brief description.
e.g. "The Horse and Groom: Quiet country pub with typical pub grub and real ales."" + end_tag; document.getElementById('edit_descr_descr').innerHTML = start_tag + "Please enter the name of the pub/bar and a brief description.
e.g. "The Horse and Groom: Quiet country pub with typical pub grub and real ales."" + end_tag; active_icon = pubs_and_bars_icon; document.getElementById('phone_number_entry_add').style.visibility='visible'; document.getElementById('phone_number_entry_add').style.display='block'; document.getElementById('phone_number_entry_cur').style.visibility='visible'; document.getElementById('phone_number_entry_cur').style.display='block'; document.getElementById('phone_number_entry_edit').style.visibility='visible'; document.getElementById('phone_number_entry_edit').style.display='block'; var zoomLevel = 17 - map.getZoom(); if ( zoomLevel < iconSizeLowerZoomThresh ) { // correct editor display with > // alert("big icon in type change (zoom level = " + zoomLevel + ")"); active_icon = pubs_and_bars_icon; } else if ( zoomLevel >= iconSizeLowerZoomThresh && zoomLevel < iconSizeUpperZoomThresh ) { // correct editor display with > // alert("small icon in type change (zoom level = " + zoomLevel + ")"); active_icon = sm_pubs_and_bars_icon; } else if ( zoomLevel >= iconSizeUpperZoomThresh ) { // alert("tiny icon in type change (zoom level = " + zoomLevel + ")"); active_icon = tiny_pubs_and_bars_icon; } active_poi_type = "pubs_and_bars"; // sm_active_icon = sm_pubs_and_bars_icon; // tiny_active_icon = tiny_pubs_and_bars_icon; document.getElementById('bmp_icon').src = "http://www.gonmad.co.uk/satnav/Pub_or_Bar.bmp"; document.getElementById('gif_icon').src = "http://www.gonmad.co.uk/satnav/pubs_and_bars.gif"; document.getElementById('png_icon').src = "http://www.gonmad.co.uk/satnav/pubs_and_bars.png"; document.getElementById('filename').value = "Pub_or_Bar"; break; case "horseracing": //alert("Please enter name of race course."); document.getElementById('descr_descr').innerHTML = start_tag + "Please enter name of race course." + end_tag; document.getElementById('edit_descr_descr').innerHTML = start_tag + "Please enter name of race course." + end_tag; active_icon = horseracing_icon; document.getElementById('phone_number_entry_add').style.visibility='visible'; document.getElementById('phone_number_entry_add').style.display='block'; document.getElementById('phone_number_entry_cur').style.visibility='visible'; document.getElementById('phone_number_entry_cur').style.display='block'; document.getElementById('phone_number_entry_edit').style.visibility='visible'; document.getElementById('phone_number_entry_edit').style.display='block'; var zoomLevel = 17 - map.getZoom(); if ( zoomLevel < iconSizeLowerZoomThresh ) { // correct editor display with > // alert("big icon in type change (zoom level = " + zoomLevel + ")"); active_icon = horseracing_icon; } else if ( zoomLevel >= iconSizeLowerZoomThresh && zoomLevel < iconSizeUpperZoomThresh ) { // correct editor display with > // alert("small icon in type change (zoom level = " + zoomLevel + ")"); active_icon = sm_horseracing_icon; } else if ( zoomLevel >= iconSizeUpperZoomThresh ) { // alert("tiny icon in type change (zoom level = " + zoomLevel + ")"); active_icon = tiny_horseracing_icon; } active_poi_type = "horseracing"; // sm_active_icon = sm_horseracing_icon; // tiny_active_icon = tiny_horseracing_icon; document.getElementById('bmp_icon').src = "http://www.gonmad.co.uk/satnav/Horseracing_course.bmp"; document.getElementById('gif_icon').src = "http://www.gonmad.co.uk/satnav/Horseracing_course.gif"; document.getElementById('png_icon').src = "http://www.gonmad.co.uk/satnav/Horseracing_course.png"; document.getElementById('filename').value = "Horseracing_course"; break; case "ga_airfield": //alert("Please enter name of airfield followed by ICAO identifier in brackets ().
e.g. Carlisle (EGNC)"); document.getElementById('descr_descr').innerHTML = start_tag + "Please enter name of airfield followed by ICAO identifier in brackets ().
e.g. Carlisle (EGNC)" + end_tag; document.getElementById('edit_descr_descr').innerHTML = start_tag + "Please enter name of airfield followed by ICAO identifier in brackets ().
e.g. Carlisle (EGNC)" + end_tag; active_icon = ga_airfield_icon; document.getElementById('phone_number_entry_add').style.visibility='visible'; document.getElementById('phone_number_entry_add').style.display='block'; document.getElementById('phone_number_entry_cur').style.visibility='visible'; document.getElementById('phone_number_entry_cur').style.display='block'; document.getElementById('phone_number_entry_edit').style.visibility='visible'; document.getElementById('phone_number_entry_edit').style.display='block'; var zoomLevel = 17 - map.getZoom(); if ( zoomLevel < iconSizeLowerZoomThresh ) { // correct editor display with > // alert("big icon in type change (zoom level = " + zoomLevel + ")"); active_icon = ga_airfield_icon; } else if ( zoomLevel >= iconSizeLowerZoomThresh && zoomLevel < iconSizeUpperZoomThresh ) { // correct editor display with > // alert("small icon in type change (zoom level = " + zoomLevel + ")"); active_icon = sm_ga_airfield_icon; } else if ( zoomLevel >= iconSizeUpperZoomThresh ) { // alert("tiny icon in type change (zoom level = " + zoomLevel + ")"); active_icon = tiny_ga_airfield_icon; } active_poi_type = "ga_airfield"; // sm_active_icon = sm_ga_airfield_icon; // tiny_active_icon = tiny_ga_airfield_icon; document.getElementById('bmp_icon').src = "http://www.gonmad.co.uk/satnav/G_A_Airfield.bmp"; document.getElementById('gif_icon').src = "http://www.gonmad.co.uk/satnav/G_A_Airfield.gif"; document.getElementById('png_icon').src = "http://www.gonmad.co.uk/satnav/G_A_Airfield.png"; document.getElementById('filename').value = "G_A_Airfield"; break; default: document.getElementById('descr_descr').innerHTML = start_tag + end_tag; active_poi_type = ""; document.getElementById('bmp_icon').src = "satnav/bmp_blank.bmp"; document.getElementById('gif_icon').src = "satnav/gif_blank.gif"; document.getElementById('png_icon').src = "satnav/png_blank.png"; document.getElementById('filename').value = ""; break; } } // Create one of our markers at the given point. function createMarker(point, icon) { var new_marker = new GMarker(point, icon); return new_marker; } // used by display_current_pois to add the marker function add_existing_poi_marker(this_poi) { poi_points_markers[this_poi] = createMarker(new GPoint(this_longitude, this_latitude), active_icon); if ( this_poi_type == "dis_park" ) { // include the phone number if valid for this poi_type... or if not empty? if ( this_phone == "" ) { poi_points_html[this_poi] = "

Disabled Parking

" + this_descr + "

Longitude: " + poi_points_longs[this_poi] + "
Latitude: " + poi_points_lats[this_poi] + "

"; } else { poi_points_html[this_poi] = "

Disabled Parking

" + this_descr + "

T: +" + this_phone + "

Longitude: " + poi_points_longs[this_poi] + "
Latitude: " + poi_points_lats[this_poi] + "

"; } } else if ( this_poi_type == "radar_key" ) { // include the phone number if valid for this poi_type... or if not empty? if ( this_phone == "" ) { poi_points_html[this_poi] = "

Radar Key Toilet

" + this_descr + "

Longitude: " + poi_points_longs[this_poi] + "
Latitude: " + poi_points_lats[this_poi] + "

"; } else { poi_points_html[this_poi] = "

Radar Key Toilet

" + this_descr + "

T: +" + this_phone + "

Longitude: " + poi_points_longs[this_poi] + "
Latitude: " + poi_points_lats[this_poi] + "

"; } } else if ( this_poi_type == "shopmobility" ) { // include the phone number if valid for this poi_type... or if not empty? if ( this_phone == "" ) { poi_points_html[this_poi] = "

Shopmobility Centre

" + this_descr + "

Longitude: " + poi_points_longs[this_poi] + "
Latitude: " + poi_points_lats[this_poi] + "

"; } else { poi_points_html[this_poi] = "

Shopmobility Centre

" + this_descr + "

T: +" + this_phone + "

Longitude: " + poi_points_longs[this_poi] + "
Latitude: " + poi_points_lats[this_poi] + "

"; } } else if ( this_poi_type == "mway_servs" ) { // include the phone number if valid for this poi_type... or if not empty? if ( this_phone == "" ) { poi_points_html[this_poi] = "

Motorway Service Station

" + this_descr + "

Longitude: " + poi_points_longs[this_poi] + "
Latitude: " + poi_points_lats[this_poi] + "

"; } else { poi_points_html[this_poi] = "

Motorway Service Station

" + this_descr + "

T: +" + this_phone + "

Longitude: " + poi_points_longs[this_poi] + "
Latitude: " + poi_points_lats[this_poi] + "

"; } } else if ( this_poi_type == "pubs_and_bars" ) { // include the phone number if valid for this poi_type... or if not empty? if ( this_phone == "" ) { poi_points_html[this_poi] = "

Pub or Bar

" + this_descr + "

Longitude: " + poi_points_longs[this_poi] + "
Latitude: " + poi_points_lats[this_poi] + "

"; } else { poi_points_html[this_poi] = "

Pub or Bar

" + this_descr + "

T: +" + this_phone + "

Longitude: " + poi_points_longs[this_poi] + "
Latitude: " + poi_points_lats[this_poi] + "

"; } } else if ( this_poi_type == "horseracing" ) { // include the phone number if valid for this poi_type... or if not empty? if ( this_phone == "" ) { poi_points_html[this_poi] = "

Horse Racing Course

" + this_descr + "

Longitude: " + poi_points_longs[this_poi] + "
Latitude: " + poi_points_lats[this_poi] + "

"; } else { poi_points_html[this_poi] = "

Horse Racing Course

" + this_descr + "

T: +" + this_phone + "

Longitude: " + poi_points_longs[this_poi] + "
Latitude: " + poi_points_lats[this_poi] + "

"; } } else if ( this_poi_type == "ga_airfield" ) { // include the phone number if valid for this poi_type... or if not empty? if ( this_phone == "" ) { poi_points_html[this_poi] = "

G.A. Airfield

" + this_descr + "

Longitude: " + poi_points_longs[this_poi] + "
Latitude: " + poi_points_lats[this_poi] + "

"; } else { poi_points_html[this_poi] = "

G.A. Airfield

" + this_descr + "

T: +" + this_phone + "

Longitude: " + poi_points_longs[this_poi] + "
Latitude: " + poi_points_lats[this_poi] + "

"; } } // Add the link to zoom to this PoI poi_points_html[this_poi] += "

"; poi_points_html[this_poi] += "Zoom to this PoI"; poi_points_html[this_poi] += " | "; poi_points_html[this_poi] += "Edit this PoI"; poi_points_html[this_poi] += " | "; poi_points_html[this_poi] += "Delete this PoI"; poi_points_html[this_poi] += "

"; // Create a listener for the go marker click GEvent.addListener(poi_points_markers[this_poi], "click", function() { // only show the info window if below upper zoom threshold var zoomLevel = 17 - map.getZoom(); if ( zoomLevel < iconSizeUpperZoomThresh ) { // extra > for editor poi_points_markers[this_poi].openInfoWindowHtml(poi_points_html[this_poi]); } document.getElementById('latitude').value = poi_points_lats[this_poi]; document.getElementById('longitude').value = poi_points_longs[this_poi]; document.getElementById('descr').value = poi_points_descrs[this_poi]; document.getElementById('phone').value = poi_points_phones[this_poi]; document.getElementById('edit_latitude').value = poi_points_lats[this_poi]; document.getElementById('edit_longitude').value = poi_points_longs[this_poi]; document.getElementById('edit_descr').value = poi_points_descrs[this_poi]; document.getElementById('edit_phone').value = poi_points_phones[this_poi]; document.getElementById('cur_edit_latitude').value = poi_points_lats[this_poi]; document.getElementById('cur_edit_longitude').value = poi_points_longs[this_poi]; document.getElementById('cur_edit_descr').value = poi_points_descrs[this_poi]; document.getElementById('cur_edit_phone').value = poi_points_phones[this_poi]; document.getElementById('del_latitude').value = poi_points_lats[this_poi]; document.getElementById('del_longitude').value = poi_points_longs[this_poi]; document.getElementById('del_descr').value = poi_points_descrs[this_poi]; }); map.addOverlay(poi_points_markers[this_poi]); } // display the PoIs for the current selected type function display_current_pois() { //alert("into display curren pois"); map.clearOverlays(); // Put the 'new point' marker back after the removal map.addOverlay(marker); if ( document.forms.add_form.poi_type.selectedIndex > 0 ) { var numb_pois = poi_points_lats.length; var this_poi = 0; for (this_poi=0 ; this_poi < numb_pois ; this_poi++ ) { this_latitude = poi_points_lats[this_poi]; this_longitude = poi_points_longs[this_poi]; this_descr = poi_points_descrs[this_poi]; this_phone = poi_points_phones[this_poi]; this_poi_type = poi_points_types[this_poi]; if ( this_poi_type == active_poi_type ) { add_existing_poi_marker(this_poi); } } } } // Used when adding a PoI. This func checks that all values are entered and then submits new PoI via AJAX function add_check_values() { if ( document.forms.add_form.poi_type.selectedIndex > 0 ) { if ( descrIsOK("add") == true ) { if ( map.getZoomLevel() > 0 ) { alert("STOP!\n\nYou should zoom the map to the maximum amount\nto ensure accurate positioning of your PoI before\nclicking the 'Add this PoI' button.\n\nSee the 'Help' tab on the main screen below if you are unsure of how to do that.") } else { if ( document.getElementById('latitude').value == "" || document.getElementById('longitude').value == "" || document.getElementById('descr').value == "" ) { alert("You must position the marker on the map\nto generate valid longitude, latitude\nand you must enter a description."); return false; // Check long and lat are within range for the region // } else if ( document.getElementById('latitude').value < 49.95 || document.getElementById('latitude').value > 60.8 || document.getElementById('longitude').value < -10.66 || document.getElementById('longitude').value > 1.77 ) { // alert("Point appears to be outside of the UK.\nOnly UK PoIs are accepted."); // return false; } else { ajaxAddPOI(); return false; } } } } else { alert("You must select a PoI type before trying to add a PoI."); } } // Check if description is within limits depending if phone number included function descrIsOK(checkType) { var maxLength = 63; var thisLength = 0; var overLength = 0; switch (document.forms.add_form.poi_type[document.forms.add_form.poi_type.selectedIndex].value) { case "": thisLength = 0; break; case "dis_park": if ( checkType == "add" ) { thisLength = document.forms.add_form.descr.value.length; } else { thisLength = document.forms.add_form.edit_descr.value.length; } break; case "radar_key": if ( checkType == "add" ) { thisLength = document.forms.add_form.descr.value.length; } else { thisLength = document.forms.add_form.edit_descr.value.length; } break; case "shopmobility": // descr + phone number + 2 for the space and chevron added in tomtom descriptions if ( checkType == "add" ) { thisLength = document.forms.add_form.descr.value.length + document.forms.add_form.phone.value.length + 2; } else { thisLength = document.forms.add_form.edit_descr.value.length + document.forms.add_form.edit_phone.value.length + 2; } break; case "mway_servs": // descr + phone number + 2 for the space and chevron added in tomtom descriptions if ( checkType == "add" ) { thisLength = document.forms.add_form.descr.value.length + document.forms.add_form.phone.value.length + 2; } else { thisLength = document.forms.add_form.edit_descr.value.length + document.forms.add_form.edit_phone.value.length + 2; } break; case "pubs_and_bars": // descr + phone number + 2 for the space and chevron added in tomtom descriptions if ( checkType == "add" ) { thisLength = document.forms.add_form.descr.value.length + document.forms.add_form.phone.value.length + 2; } else { thisLength = document.forms.add_form.edit_descr.value.length + document.forms.add_form.edit_phone.value.length + 2; } break; case "horseracing": // descr + phone number + 2 for the space and chevron added in tomtom descriptions if ( checkType == "add" ) { thisLength = document.forms.add_form.descr.value.length + document.forms.add_form.phone.value.length + 2; } else { thisLength = document.forms.add_form.edit_descr.value.length + document.forms.add_form.edit_phone.value.length + 2; } break; case "ga_airfield": // descr + phone number + 2 for the space and chevron added in tomtom descriptions if ( checkType == "add" ) { thisLength = document.forms.add_form.descr.value.length + document.forms.add_form.phone.value.length + 2; } else { thisLength = document.forms.add_form.edit_descr.value.length + document.forms.add_form.edit_phone.value.length + 2; } break; default: thisLength = 0; break; } //alert("combined length = " + thisLength); if ( thisLength <= maxLength ) { // extra > for editor return true; } else { overLength = thisLength - maxLength; alert("Description is too long, please shorten by " + overLength + " character(s)."); return false; } } // Used when updating a PoI. This func checks that all values are entered and then submits new PoI via AJAX function update_check_values() { if ( document.forms.add_form.poi_type.selectedIndex > 0 ) { if ( descrIsOK("edit") == true ) { if ( map.getZoomLevel() > 0 ) { alert("STOP!\n\nYou should zoom the map to the maximum amount\nto ensure accurate positioning of your PoI before\nclicking the 'Update this PoI' button.\n\nSee the 'Help' tab on the main screen below if you are unsure of how to do that.") } else { if ( document.getElementById('edit_latitude').value == "" || document.getElementById('edit_longitude').value == "" || document.getElementById('edit_descr').value == "" ) { alert("You must position the marker on the map\nto generate valid longitude, latitude\nand you must enter a description."); return false; // Check long and lat are within range for the region // } else if ( document.getElementById('edit_latitude').value < 49.95 || document.getElementById('edit_latitude').value > 60.8 || document.getElementById('edit_longitude').value < -10.66 || document.getElementById('edit_longitude').value > 1.77 ) { // alert("New position appears to be outside of the UK.\nOnly UK PoIs are accepted."); // return false; } else { ajaxUpdatePOI(); return false; } } } } else { alert("You must select a PoI type before trying to edit a PoI."); } } // Used when deleting a PoI. This func checks that all values are entered and then submits new PoI via AJAX function del_check_values() { if ( document.forms.add_form.poi_type.selectedIndex > 0 ) { if ( document.getElementById('del_latitude').value == "" || document.getElementById('del_longitude').value == "" ) { alert("You must click and exiting PoI to retrieve it's longitude\nand latitude into the delete tab to delete a PoI."); return false; } else { ajaxDeletePOI(); return false; } } else { alert("You must select a PoI type before trying to delete a PoI."); } } // Create an AJAX object for use in other AJAX functions function createAJAX() { var phpRequest = null; if (window.XMLHttpRequest) { phpRequest = new XMLHttpRequest(); } if (window.ActiveXObject) { phpRequest = new ActiveXObject("Microsoft.XMLHTTP"); } return(phpRequest); } // Add the new PoI without reloading by using an AJAX request function ajaxAddPOI() { var phpRequest = createAJAX(); var add_type = document.forms.add_form.poi_type.options[document.forms.add_form.poi_type.selectedIndex].value; var add_latitude = document.getElementById('latitude').value; var add_longitude = document.getElementById('longitude').value; var add_descr = document.getElementById('descr').value; var add_phone = document.getElementById('phone').value; var currentTime = new Date(); document.getElementById('add_button').disabled = true; document.getElementById('status_text').innerHTML = "Adding PoI..."; var add_url = "http://www.gonmad.co.uk/satnav/add_poi_for_ajax.php?poi_type=" + add_type + "&latitude=" + add_latitude + "&longitude=" + add_longitude + "&descr=" + add_descr + "&phone=" + add_phone + "&rnd=" + currentTime.getMilliseconds(); phpRequest.onreadystatechange = function() { if (phpRequest.readyState == 4) { if (phpRequest.status == 200) { document.getElementById('status_text').innerHTML = "" + phpRequest.responseText + ""; ajaxLoadCurrentPois(phpRequest.responseText); display_current_pois(); document.getElementById('add_button').disabled = false; } } } phpRequest.open("GET", add_url, true); phpRequest.send(null); } // Update a PoI without reloading by using an AJAX request function ajaxUpdatePOI() { //alert("into ajaxUpdatePOI"); var phpRequest = createAJAX(); var update_type = document.forms.add_form.poi_type.options[document.forms.add_form.poi_type.selectedIndex].value; var update_latitude = document.getElementById('edit_latitude').value; var update_longitude = document.getElementById('edit_longitude').value; var update_descr = document.getElementById('edit_descr').value; var update_phone = document.getElementById('edit_phone').value; var update_cur_latitude = document.getElementById('cur_edit_latitude').value; var update_cur_longitude = document.getElementById('cur_edit_longitude').value; var update_cur_descr = document.getElementById('cur_edit_descr').value; var currentTime = new Date(); document.getElementById('edit_button').disabled = true; document.getElementById('status_text').innerHTML = "Updating PoI..."; var update_url = "http://www.gonmad.co.uk/satnav/update_poi_for_ajax.php?poi_type=" + update_type + "&cur_latitude=" + update_cur_latitude + "&cur_longitude=" + update_cur_longitude + "&cur_descr=" + update_cur_descr + "&latitude=" + update_latitude + "&longitude=" + update_longitude + "&descr=" + update_descr + "&phone=" + update_phone + "&rnd=" + currentTime.getMilliseconds(); // alert("update url = " + update_url); // window.open(update_url); phpRequest.onreadystatechange = function() { if (phpRequest.readyState == 4) { if (phpRequest.status == 200) { document.getElementById('status_text').innerHTML = "" + phpRequest.responseText + ""; ajaxLoadCurrentPois(phpRequest.responseText); display_current_pois(); document.getElementById('edit_button').disabled = false; } } } phpRequest.open("GET", update_url, true); phpRequest.send(null); } // Mark a PoI for deletion without reloading by using an AJAX request function ajaxDeletePOI() { var phpRequest = createAJAX(); var del_type = document.forms.add_form.poi_type.options[document.forms.add_form.poi_type.selectedIndex].value; var del_latitude = document.getElementById('del_latitude').value; var del_longitude = document.getElementById('del_longitude').value; var del_descr = document.getElementById('del_descr').value; var currentTime = new Date(); document.getElementById('del_button').disabled = true; document.getElementById('status_text').innerHTML = "Marking PoI for deletion..."; var del_url = "http://www.gonmad.co.uk/satnav/del_poi_for_ajax.php?poi_type=" + del_type + "&latitude=" + del_latitude + "&longitude=" + del_longitude + "&descr=" + del_descr + "&rnd=" + currentTime.getMilliseconds(); //window.open(del_url); phpRequest.onreadystatechange = function() { if (phpRequest.readyState == 4) { if (phpRequest.status == 200) { document.getElementById('status_text').innerHTML = "" + phpRequest.responseText + ""; ajaxLoadCurrentPois(phpRequest.responseText); display_current_pois(); document.getElementById('del_button').disabled = false; } } } phpRequest.open("GET", del_url, true); phpRequest.send(null); } // Load the existing PoIs into the PoI arrays from dbase via AJAX request on the fly function ajaxLoadCurrentPois(prepend_text) { var phpRequest = createAJAX(); var get_type = document.forms.add_form.poi_type.options[document.forms.add_form.poi_type.selectedIndex].value; var doing_latitude; var doing_longitude; var doing_descr; var doing_type; var count; var records_array = new Array(); var currentTime = new Date(); var get_url = "http://www.gonmad.co.uk/satnav/get_all_pois_for_ajax.php?poi_type=" + get_type + "&rnd=" + currentTime.getMilliseconds(); document.getElementById('status_text').innerHTML = "Loading PoIs"; phpRequest.onreadystatechange = function() { if (phpRequest.readyState == 4) { if (phpRequest.status == 200) { records_array = phpRequest.responseText.split("\n"); for(count=0;count to correct editor var doing_record_array = new Array(); doing_record_array = records_array[count].split("||"); poi_points_types[count]=doing_record_array[0]; poi_points_lats[count]=doing_record_array[1]; poi_points_longs[count]=doing_record_array[2]; poi_points_descrs[count]=doing_record_array[3]; poi_points_phones[count]=doing_record_array[4]; document.getElementById('status_text').innerHTML = "" + prepend_text + " " + (records_array.length - 1) + " PoIs loaded from database OK."; } display_current_pois(); } } } phpRequest.open("GET", get_url, true); phpRequest.send(null); } function isAlpha(char) { var chars = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTVWXYZ"; if ( char.length == 1 ) { if ( chars.indexOf(char) != -1 ) { return true; } else { return false; } } else { return false; } } function isDigit(char) { var chars = "0123456789"; if ( char.length == 1 ) { if ( chars.indexOf(char) != -1 ) { return true; } else { return false; } } else { return false; } } function getPostcodeOutcode(postcode) { // var postcode=document.getElementById('postcode').value; // remove anything after a space var space_posn = postcode.indexOf(' '); if ( space_posn != -1 ) { postcode = postcode.substr(0,space_posn); } // If the string is longer than 4 chars, strip off the last 3 chars // This assumes a full postcode has been entered if ( postcode.length > 4 ) { postcode = postcode.substr(0,postcode.length-3); } var pc_last_char = postcode.charAt(postcode.length-1) // If last char is a letter then remove it as geonames database does not include these letters if ( isAlpha(pc_last_char) ) { postcode = postcode.substr(0,postcode.length-1); } // alert("postcode = \"" + postcode + "\""); // alert("last char = " + pc_last_char); return(postcode); } function postcodeOrPlaceLookup() { var searchTerm = document.getElementById('postcode').value = document.getElementById('postcode').value; var hasDigits = 0; for ( i=0; i if ( isDigit(searchTerm.charAt(i)) ) { hasDigits++; } } if ( hasDigits > 0 ) { // alert("Lookup postcode"); ajaxPostcodeLookup(); } else { // alert("Lookup place"); ajaxPlaceLookup(); } } function change_search_form(newSearchArea) { if (newSearchArea == "uk") { document.getElementById('search_rest_div').style.visibility='hidden'; document.getElementById('search_rest_div').style.display='none'; document.getElementById('search_uk_div').style.visibility='visible'; document.getElementById('search_uk_div').style.display='block'; } else { document.getElementById('search_uk_div').style.visibility='hidden'; document.getElementById('search_uk_div').style.display='none'; document.getElementById('search_rest_div').style.visibility='visible'; document.getElementById('search_rest_div').style.display='block'; } } function IntlPostcodeOrPlaceLookup() { alert("International search not yet implemented, sorry.\nCheck back soon."); exit; var searchTerm = document.getElementById('postcode').value = document.getElementById('postcode').value; var hasDigits = 0; for ( i=0; i if ( isDigit(searchTerm.charAt(i)) ) { hasDigits++; } } if ( hasDigits > 0 ) { // alert("Lookup postcode"); ajaxPostcodeLookup(); } else { // alert("Lookup place"); ajaxPlaceLookup(); } } function ajaxPostcodeLookup() { var currentTime = new Date(); // Change Postcode to upper case in form document.getElementById('postcode').value = document.getElementById('postcode').value.toUpperCase(); // Get postcode from form var postcode=document.getElementById('postcode').value; // Get the outcode part of the postcode postcode = getPostcodeOutcode(postcode); // Build the URL for AJAX to use var postcodeURL = "/satnav/geonames_proxy.php?postcode=" + postcode; // The AJAX bit (create the AJAX object) var phpRequest = createAJAX(); // Change the status bar document.getElementById('status_text').innerHTML = "Looking up postcode " + postcode + "..."; document.getElementById('pc_srch_but').value = "Searching..."; document.getElementById('pc_srch_but').disabled=true; // Lazy - used lookup_url variable instead of postcodeURL... var lookup_url = postcodeURL; // var lookup_url = "http://localhost/WWW/topfun.co.uk/www/satnav/postcode_test_xml.php"; phpRequest.onreadystatechange = function() { if (phpRequest.readyState == 4) { if (phpRequest.status == 200) { var returnedXML = phpRequest.responseXML; var returnedString = phpRequest.responseText; //alert("returned string = " + returnedString) if ( returnedString != "" && returnedString != "error") { var resultsCount = returnedXML.getElementsByTagName("totalResultsCount").item(0).firstChild.data; //alert("Results Count = " + resultsCount); if ( parseFloat(resultsCount) > parseFloat(0) ) { // If got a valid location for postcode update status bar document.getElementById('status_text').innerHTML = "Centering on postcode " + postcode + "..."; //alert("Text = " + phpRequest.responseText); var max_lat = 0; var min_lat = 0; var max_lng = 0; var min_lng = 0; for ( i=0; i parseFloat(max_lat) || i == 0 ) { max_lat = lat; } if ( parseFloat(lng) > parseFloat(max_lng) || i == 0 ) { max_lng = lng; } if ( parseFloat(lat) < parseFloat(min_lat) || i == 0 ) { min_lat = lat; } if ( parseFloat(lng) < parseFloat(min_lng) || i == 0 ) { min_lng = lng; } } //alert("min lat = " + min_lat); //alert("max lat = " + max_lat); //alert("min lng = " + min_lng); //alert("max lng = " + max_lng); // Work out the average long and lat values var avg_lat = (parseFloat(min_lat) + parseFloat(max_lat)) / 2; var avg_lng = (parseFloat(min_lng) + parseFloat(max_lng)) / 2; // Recenter on new long and lat position using usual function map.centerAndZoom(new GPoint(avg_lng, avg_lat), 5); // params (e/w,n/s,zoom) document.getElementById('pc_srch_but').value = "Search..."; document.getElementById('pc_srch_but').disabled = false; document.getElementById('status_text').innerHTML = "Centered on postcode " + postcode + "..."; } else { // If NOT got a valid location for postcode update status bar document.getElementById('status_text').innerHTML = "Postcode (" + postcode + ") not found"; document.getElementById('pc_srch_but').value = "Search..."; document.getElementById('pc_srch_but').disabled = false; } } else { // If NOT got a valid location for postcode update status bar document.getElementById('status_text').innerHTML = "Error looking up postcode."; document.getElementById('pc_srch_but').value = "Search..."; document.getElementById('pc_srch_but').disabled = false; } } } } phpRequest.open("GET", lookup_url, true); phpRequest.send(null); } function ajaxPlaceLookup() { var currentTime = new Date(); // Change Postcode to upper case in form // document.getElementById('postcode').value = document.getElementById('postcode').value.toUpperCase(); // Get postcode from form var searchPlace=document.getElementById('postcode').value; // Build the URL for AJAX to use var postcodeURL = "/satnav/geonames_proxy.php?placename=" + searchPlace; // The AJAX bit (create the AJAX object) var phpRequest = createAJAX(); // Change the status bar document.getElementById('status_text').innerHTML = "Looking up placename " + searchPlace + "..."; document.getElementById('pc_srch_but').value = "Searching..."; document.getElementById('pc_srch_but').disabled=true; // Lazy - used lookup_url variable instead of postcodeURL... // Use this to switch between live and test!!! var lookup_url = postcodeURL; // var lookup_url = "http://localhost/WWW/topfun.co.uk/www/satnav/postcode_test_xml.php"; phpRequest.onreadystatechange = function() { if (phpRequest.readyState == 4) { if (phpRequest.status == 200) { var returnedXML = phpRequest.responseXML; var returnedString = phpRequest.responseText; //alert("returned string = " + returnedString) if ( returnedString != "" && returnedString != "error") { var resultsCount = returnedXML.getElementsByTagName("totalResultsCount").item(0).firstChild.data; //alert("Results Count = " + resultsCount); if ( parseFloat(resultsCount) > parseFloat(1) ) { // If got a valid location for postcode update status bar document.getElementById('status_text').innerHTML = "Centering on postcode " + postcode + "..."; //alert("Text = " + phpRequest.responseText); var popupWidth = 270; var popupHeight = 100 + ( resultsCount * 14 ); if ( popupHeight > 400 ) { popupHeight = 400; } //alert("popup height =" + popupHeight) var the_popup_window = window.open('./satnav/placename_selection_headers.php', 'place_choice', 'width=' + popupWidth + ',height=' + popupHeight + ',scrollbars=yes,resizable=no') the_popup_window.document.write("\n\nSelect Placename\n"); the_popup_window.document.title = "Select Placename"; the_popup_window.document.write("\n"); the_popup_window.document.write("\n\n"); the_popup_window.document.write("Please select the place from below:
\n\n"); the_popup_window.document.write("\n\n\n"); document.getElementById('pc_srch_but').value = "Search..."; document.getElementById('pc_srch_but').disabled = false; document.getElementById('status_text').innerHTML = "Multiple matches found, please select in popup..."; } else if ( parseFloat(resultsCount) == parseFloat(1) ) { var lat = returnedXML.getElementsByTagName("lat").item(0).firstChild.data; var lng = returnedXML.getElementsByTagName("lng").item(0).firstChild.data; var postcode = returnedXML.getElementsByTagName("postalcode").item(0).firstChild.data; var name = returnedXML.getElementsByTagName("name").item(0).firstChild.data; var country = returnedXML.getElementsByTagName("countryCode").item(0).firstChild.data; var place_descr = name + ", " + country + " (" + postcode + ")"; map.centerAndZoom(new GPoint(lng,lat), 5); document.getElementById('pc_srch_but').value = "Search..."; document.getElementById('pc_srch_but').disabled = false; document.getElementById('status_text').innerHTML = "Centered on " + place_descr + "..."; } else { // If NOT got a valid location for postcode update status bar document.getElementById('status_text').innerHTML = "Placename (" + postcode + ") not found"; document.getElementById('pc_srch_but').value = "Search..."; document.getElementById('pc_srch_but').disabled = false; } } else { // If NOT got a valid location for postcode update status bar document.getElementById('status_text').innerHTML = "Error looking up UK placename."; document.getElementById('pc_srch_but').value = "Search..."; document.getElementById('pc_srch_but').disabled = false; } } } } phpRequest.open("GET", lookup_url, true); phpRequest.send(null); } function remoteCenterMap(lng,lat,zoomLevel,text) { // alert("rCM, lng=" + lng + ", lat=" + lat + ", zoom=" + zoomLevel + ", descr=" + text); map.centerAndZoom(new GPoint(lng,lat), zoomLevel); document.getElementById('status_text').innerHTML = "Centered on " + text + "..."; } // Add, Edit, Delete, Help menu tab click function clicktab(tab) { if ( tab == "add_form" ) { document.getElementById('add_form_panel').style.visibility='visible'; document.getElementById('edit_form_panel').style.visibility='hidden'; document.getElementById('delete_form_panel').style.visibility='hidden'; document.getElementById('help_page_panel').style.visibility='hidden'; document.getElementById('add_form_panel').style.display='block'; document.getElementById('edit_form_panel').style.display='none'; document.getElementById('delete_form_panel').style.display='none'; document.getElementById('help_page_panel').style.display='none'; document.getElementById('add_tab').className='tab_selected'; document.getElementById('edit_tab').className='tab_not_selected'; document.getElementById('delete_tab').className='tab_not_selected'; document.getElementById('help_tab').className='tab_not_selected'; } else if ( tab == "edit_form" ) { document.getElementById('add_form_panel').style.visibility='hidden'; document.getElementById('edit_form_panel').style.visibility='visible'; document.getElementById('delete_form_panel').style.visibility='hidden'; document.getElementById('help_page_panel').style.visibility='hidden'; document.getElementById('add_form_panel').style.display='none'; document.getElementById('edit_form_panel').style.display='block'; document.getElementById('delete_form_panel').style.display='none'; document.getElementById('help_page_panel').style.display='none'; document.getElementById('add_tab').className='tab_not_selected'; document.getElementById('edit_tab').className='tab_selected'; document.getElementById('delete_tab').className='tab_not_selected'; document.getElementById('help_tab').className='tab_not_selected'; } else if ( tab == "delete_form" ) { document.getElementById('add_form_panel').style.visibility='hidden'; document.getElementById('edit_form_panel').style.visibility='hidden'; document.getElementById('delete_form_panel').style.visibility='visible'; document.getElementById('help_page_panel').style.visibility='hidden'; document.getElementById('add_form_panel').style.display='none'; document.getElementById('edit_form_panel').style.display='none'; document.getElementById('delete_form_panel').style.display='block'; document.getElementById('help_page_panel').style.display='none'; document.getElementById('add_tab').className='tab_not_selected'; document.getElementById('edit_tab').className='tab_not_selected'; document.getElementById('delete_tab').className='tab_selected'; document.getElementById('help_tab').className='tab_not_selected'; } else if ( tab == "help_form" ) { document.getElementById('add_form_panel').style.visibility='hidden'; document.getElementById('edit_form_panel').style.visibility='hidden'; document.getElementById('delete_form_panel').style.visibility='hidden'; document.getElementById('help_page_panel').style.visibility='visible'; document.getElementById('add_form_panel').style.display='none'; document.getElementById('edit_form_panel').style.display='none'; document.getElementById('delete_form_panel').style.display='none'; document.getElementById('help_page_panel').style.display='block'; document.getElementById('add_tab').className='tab_not_selected'; document.getElementById('edit_tab').className='tab_not_selected'; document.getElementById('delete_tab').className='tab_not_selected'; document.getElementById('help_tab').className='tab_selected'; } } // Show the correct help page in the help tab function show_help(what) { var start_tag = "
"; var end_tag = "
"; var help_content = ""; switch (what) { case "quick": help_content = "
  1. Double click the map to zoom and position the 'new point' marker. To fine tune the position you can drag the marker as well.
  2. Use the zoom ladder on the left to zoom into the map (the map always zooms to the centre point of the displayed map).
  3. Repeat this procedure until the marker is positioned where you wish to add the Point of Interest.
  4. Then click the 'Add' tab if you haven't already and fill in a descriptiption according to the instructions below the description box.
  5. Then just click the 'Add this PoI' button.

"; break; case "map": help_content = "The map can be moved and zoomed simulatneously by double-clicking on the map itself. The marker can also be moved by dragging it with the mouse. The map itself can be moved by dragging it with the mouse or by using the arrows in the top left.

It can be zoomed in or out by using the 'zoom bar' (looks a bit like a ladder) on the left of the map. Up = more detail, so the top of the slider is max zoom/detail.

The map may be centered on a point by double clicking that point or moving the marker to that point.

A road map, aerial photos or hybrid (road map superimposed on aerial photos) version of the map may be displayed by clicking the buttons in the top right of the map.

If the map display says that no imagery is availble at a particular zoom level, switch to map only view rather than satellite or hybrid.
"; break; case "add": help_content = "Once you have positioned the orange 'new PoI marker' in the correct place, ensure that the correct PoI type is selected in the drop down menu (at the top of the panel left of the map).

Ensure the 'Add' tab is selected and add a descripton of the PoI in the format specified below the description box.

When you are happy that the details are correct click the 'Add this PoI' button.

Your PoI will be added and the map will refresh with your point shown with the correct icon.
"; break; case "edit": help_content = "With the 'Edit' tab selected, click on the PoI you wish to edit. Its current information will be displayed in the upper boxes which you cannot edit. (Ensure the correct data is displayed in the boxes - it should match what is displayed in the markers popup info bubble)

Move the orange marker to the correct location if required, and update the description in the lower box.

If the location of the marker does not need to be changed, ensure that both current and new longitude and latitude values are the same, re-clicking the existing marker if necessary.

When you are happy that everything is correct, click the 'Update this PoI' button. Our database will be updated and the map will refresh with the new info."; break; case "del": help_content = "With the 'Delete' tab selected, click on the PoI you wish to delete. The information about this PoI will be displayed in a pop up bubble and in the boxes in the delete panel.

When you are sure that the PoI you have selected is one that does not exist, click the 'Delete this PoI' button.

The PoI may not be instantly deleted, but it will be marked for future deletion in our database.
"; break; case "use": help_content = "
TomTom Home (AddToTomTom):
These files will automatically install on your TomTom device if you have TomTom Home software v2 or higher installed on your PC (see www.TomTom.com/home/ for more info).
TomTom Zip and PoI files(.zip and .ov2):
These files can be saved to your map directory (Great_Britain_Map or Great_Britain_PLUS_Map) on your TomTom device (unzip the zip file to you rdevice rather than just saving it) along with the BMP icon displayed below (.zip files include the .bmp files already).
These .ov2 files are ready for use in your TomTom device.
Other files (.csv and .asc):
These files are CSV (comma separated variable) text files which can be loaded into a number of applications and converted for use in other Satellite Navigation and similar systems.

"; break; default: } document.getElementById('help_text').innerHTML = start_tag + help_content + end_tag; } function gen_file() { if ( document.forms.add_form.poi_type.selectedIndex > 0 ) { // alert("satnav/gen_file.php?file_type=" + document.forms.add_form.file_type.options[document.forms.add_form.file_type.selectedIndex].value + "&poi_type=" + document.forms.add_form.poi_type.options[document.forms.add_form.poi_type.selectedIndex].value + "&filename=" + document.getElementById('filename').value + "®ion=" + document.forms.add_form.region.options[document.forms.add_form.region.selectedIndex].value); if ( document.forms.add_form.file_type.options[document.forms.add_form.file_type.selectedIndex].value == "att" ) { addToTomTomURL = "http://addto.tomtom.com/api/home/v2/content?action=install&apikey=da2b3925-7395-484c-99e3-780d99b237b9"; // addToTomTomURL = addToTomTomURL + "&uri=http%3A//www.gonmad.co.uk/satnav/gettomtom/TomTomDisk/" + document.forms.add_form.region.options[document.forms.add_form.region.selectedIndex].value + "/" + document.getElementById('filename').value + ".xml"; // always use region all for addtotomtom as selectig map to install to not supported addToTomTomURL = addToTomTomURL + "&uri=http%3A//www.gonmad.co.uk/satnav/gettomtom/TomTomDisk/all/" + document.getElementById('filename').value + ".xml"; // addToTomTomURL = addToTomTomURL + "&source=http%3A//www.gonmad.co.uk/satnav/"; addToTomTomURL = addToTomTomURL + "&attribution=GonMad.co.uk+/+BlueBadgeParking.com"; // addToTomTomURL = addToTomTomURL + "&logo"; // alert("link = " + addToTomTomURL); // document.location = addToTomTomURL; window.open (addToTomTomURL, "TomTomHomeOpener","location=1,status=1,scrollbars=1, width=680,height=430"); } else { document.location = "satnav/gen_file.php?file_type=" + document.forms.add_form.file_type.options[document.forms.add_form.file_type.selectedIndex].value + "&poi_type=" + document.forms.add_form.poi_type.options[document.forms.add_form.poi_type.selectedIndex].value + "&filename=" + document.getElementById('filename').value + "®ion=" + document.forms.add_form.region.options[document.forms.add_form.region.selectedIndex].value; } } else { alert("You must select a PoI type before generating a PoI file."); } }