// The function getXMLHttpRequest is contained in the xmlhttp-objects.jsp page // This is included by the gaz_search_inc.jsp page. var ajaxRouteReq = getXMLHttpRequest(); // global "map" variable var mapGoogle; var gMarkers = []; var placeElements = []; var htmlMarkers = []; var routeOverlay; var gdir; var aaMapPage='portrait-route-planner'; /*infowindow route links - required by poi-overlay-v2.js*/ bolRedirectToRP=false; bolShowVia=true; var hc1; // Hierarchical map control var smallcontrol3D; //Zoom control var largecontrol3D; //Zoom control var isPageDefault=true; var routeingDatabase="B"; //default to UK var metresToKilometres = 1000; var metresToMiles = 1609.344; var distanceConversion = metresToKilometres; // Default to km // ====== Array for decoding the Google failure codes ====== var reasons=[]; reasons[G_GEO_SUCCESS] = "Success"; reasons[G_GEO_MISSING_ADDRESS] = "Missing Address: The address was either missing or had no value."; reasons[G_GEO_UNKNOWN_ADDRESS] = "Unknown Address: No corresponding geographic location could be found for the specified address."; reasons[G_GEO_UNAVAILABLE_ADDRESS]= "Unavailable Address: The geocode for the given address cannot be returned due to legal or contractual reasons."; reasons[G_GEO_BAD_KEY] = "Bad Key: The API key is either invalid or does not match the domain for which it was given"; reasons[G_GEO_TOO_MANY_QUERIES] = "Too Many Queries: The daily geocoding quota for this site has been exceeded."; reasons[G_GEO_SERVER_ERROR] = "Server error: The geocoding request could not be successfully processed."; reasons[G_GEO_BAD_REQUEST] = "A directions request could not be successfully parsed."; reasons[G_GEO_MISSING_QUERY] = "No query was specified in the input."; reasons[G_GEO_UNKNOWN_DIRECTIONS] = "Unable to generate route between specified locations."; var loadingImageURI = "/images/routes/ajax-loader.gif"; function createMarker(latlong,i,iconStyle,html) { var marker = new GMarker(latlong, {draggable:false,icon:iconStyle}); GEvent.addListener(marker, "click", function() { marker.openInfoWindowHtml(html); }); gMarkers[i]=marker; mapGoogle.addOverlay(marker); return marker; } function addEncodedRouteOverlay(encPoints, encLevels) { routeOverlay = new GPolyline.fromEncoded({color: '#FF00FF', weight: 10, opacity: 0.5, points: trim(encPoints), levels: trim(encLevels), zoomFactor: 2, numLevels: 18}); mapGoogle.addOverlay(routeOverlay); } //function showMapLocation(lat, long) //{ // // Show the map blowup at the specified point // mapGoogle.showMapBlowup(new GLatLng(lat, long), {mapType:G_NORMAL_MAP, zoomLevel:15} ); //} function showMapLocation(iwtext, lat, lng) { var point = new GLatLng(lat, lng); mapGoogle.panTo(point); if(iwtext!=null&&iwtext!="") { mapGoogle.openInfoWindowHtml(point,'>
' + escape(iwtext) + '
'); } } function showRouteLocationOnMap(parent, lat, lng) { var point = new GLatLng(lat, lng); var instructionHTML = ""; instructionHTML=$(parent).parent().parent().find("div.text-instruction").html(); mapGoogle.openInfoWindowHtml(point,'
 
' + instructionHTML + '
'); addMiniMap(lat,lng); } var arrMiniMap=new Array(); function addMiniMap($element,lat, lng) { var point = new GLatLng(lat, lng); var dminiMapDiv = $element.get(0); $element.css("display","block"); $element.css("overflow","hidden"); $element.css("height","248px"); $element.css("width","248px"); var mini_map=new GMap2(dminiMapDiv, {mapTypes:[G_NORMAL_MAP,G_SATELLITE_MAP,G_HYBRID_MAP,G_PHYSICAL_MAP]}); mini_map.checkResize(); mini_map.setCenter(point,15); // Add the controls mini_map.addControl(new GSmallZoomControl3D()); // Copy the markers for (var markerIndex = 0; markerIndex < gMarkers.length; markerIndex++) { mini_map.addOverlay(new GMarker(gMarkers[markerIndex].getLatLng(), {icon: gMarkers[markerIndex].getIcon()})); } //add POI markers //iterate through non-indexed array var miniPOImgr=new MarkerManager(mini_map); var item; var tmpPOITypeID; var tmppoiMarker; var tmppoiMediumMarker; var tmppoiSmallMarker; //var tmpPOILmarker=[]; //var tmpPOIMmarker=[]; //var tmpPOISmarker=[]; for (item in aaPOIMarkers) { //only for speed cameras //new Array(poiID,poiTypeID,poiTitle,point,poiMarker,poiMediumMarker,poiSmallMarker); var tmpPOITypeID=aaPOIMarkers[item][1]; if(tmpPOITypeID==-1) { tmppoiMarker = createPOIMarker(aaPOIMarkers[item][3],aaPOIMarkers[item][0],'l',tmpPOITypeID,aaPOIMarkers[item][2]); //actual icon tmppoiMediumMarker=createPOIMarker(aaPOIMarkers[item][3],aaPOIMarkers[item][0],'m',tmpPOITypeID,aaPOIMarkers[item][2]); //med icons tmppoiSmallMarker=createPOIMarker(aaPOIMarkers[item][3],aaPOIMarkers[item][0],'s',tmpPOITypeID,aaPOIMarkers[item][2]); //small icons miniPOImgr.addMarker(tmppoiMarker,11,17); miniPOImgr.addMarker(tmppoiMediumMarker,8,10); miniPOImgr.addMarker(tmppoiSmallMarker,0,7); } } miniPOImgr.refresh(); // Copy the line of route var poly2 = routeOverlay.copy(); mini_map.addOverlay(poly2); //disable infowindow mini_map.disableInfoWindow(); /* var CopyrightDiv = dminiMapDiv.firstChild.nextSibling; var CopyrightImg = dminiMapDiv.firstChild.nextSibling.nextSibling; CopyrightDiv.style.display = "none"; CopyrightImg.style.display = "none"; */ } function removeMiniMap(element) { } function setMapBounds(minY, minX, maxY, maxX) { // Set up a bounds from our route extent var bounds = new GLatLngBounds(new GLatLng(minY,minX), new GLatLng(maxY,maxX)); // determine the zoom level from the bounds mapGoogle.setZoom(mapGoogle.getBoundsZoomLevel(bounds)); // determine the centre from the bounds mapGoogle.setCenter(bounds.getCenter()); } function loadGoogleMap() { // This function should be fired on page load to set up the initial google map if (GBrowserIsCompatible()) { // Display the map, with our selection of map types mapGoogle = new GMap2(document.getElementById("map"), {mapTypes:[G_NORMAL_MAP,G_SATELLITE_MAP,G_HYBRID_MAP,G_PHYSICAL_MAP]}); //mapGoogle.addMapType(G_PHYSICAL_MAP); //hc1 = new GHierarchicalMapTypeControl(); /*mapGoogle.addControl(new GScaleControl());*/ /*disabled for minimap*/ //mapGoogle.addControl(hc1); smallcontrol3D=new GSmallZoomControl3D(); largecontrol3D=new GLargeMapControl3D(); mapGoogle.addControl(smallcontrol3D); // Set any old centre to start off with - could use database as initial location mapGoogle.setCenter(new GLatLng(54.522005, -3.083582), 4); // allow mouse zoom mapGoogle.enableScrollWheelZoom(); /*thumbnail map button*/ var $overlayMapButton= $("#overlayMapButton"); if ($overlayMapButton.length!=0) { var pos = new GControlPosition(G_ANCHOR_BOTTOM_RIGHT, new GSize(0,0)); pos.apply($overlayMapButton.get(0)); mapGoogle.getContainer().appendChild($overlayMapButton.get(0)); $overlayMapButton.addClass("noprintdispblock"); } var $overlayMapMessage= $("#overlayMapMessage"); if ($overlayMapMessage.length!=0) { var pos = new GControlPosition(G_ANCHOR_TOP_LEFT, new GSize(0,0)); pos.apply($overlayMapMessage.get(0)); mapGoogle.getContainer().appendChild($overlayMapMessage.get(0)); } /*if infowindow opened, then change to largescale map*/ GEvent.addListener(mapGoogle,"infowindowopen", function() { // toggle to large map showLargeMap("mapcontainer",false) }); //set up poi overlays aaPOImgr=new MarkerManager(mapGoogle); // Set up the stuff for Google routeing gdir = new GDirections(null, null); GEvent.addListener(gdir, "error", function() { var code = gdir.getStatus().code; var reason="Error Code: " + code; if (reasons[code]) { reason = reasons[code]; } var routeSummaryElement = document.getElementById('routeSummary'); routeSummaryElement.innerHTML = '
' + reason + '
'; hideLoading(); }); GEvent.addListener(gdir, "load", function() { // Display the line of route routeOverlay = gdir.getPolyline(); mapGoogle.addOverlay(routeOverlay); //routeOverlay.setStrokeStyle({color:'#FF00FF', weight: 10, opacity: 0.5}); // Set the extent var bounds = gdir.getBounds(); mapGoogle.setCenter(bounds.getCenter(), mapGoogle.getBoundsZoomLevel(bounds)); // Display the summary displayGoogleRouteSummary(gdir.getDistance().meters, gdir.getDuration().seconds, true); // Display the route directions displayGoogleRouteDirections(); hideLoading(); }); //add class so IE6 prints properly $('#map>div:first').addClass('firstChild'); /*var CopyrightDiv = document.getElementById("map").firstChild.nextSibling.nextSibling; CopyrightDiv.style.overflow = "hidden"; CopyrightDiv.style.backgroundcolor = "#cc0000"; */ } } function onGetNewRoute(clearMapFlag, switchUnits, setDatabaseFlag) { // Get a new route from the stuff selected from the gazetteer drop downs var checkAvoidMotorways = document.getElementById("avoidMotorways"); var checkAvoidTolls = document.getElementById("avoidTolls"); var i; var dbUsedForGaz = getDatabase(); var bAvoidMWays = checkAvoidMotorways == null ? false : checkAvoidMotorways.checked; var bAvoidTolls = checkAvoidTolls == null ? false : checkAvoidTolls.checked; if (ajaxRouteReq == null) { alert('Sorry, no ajax support'); return; } showLoading(); if (setDatabaseFlag) setRouteingDatabase(dbUsedForGaz); // Remove the current route directions and summary var routeSummaryElement = document.getElementById('routeSummary'); var routeDirectionsElement = document.getElementById('routeDirections'); routeSummaryElement.innerHTML = '
Hold on, we’re just working out your route.
'; routeDirectionsElement.innerHTML = ' '; // Remove the curent route/markers.info window from the map if (clearMapFlag) { if (routeOverlay != null) mapGoogle.removeOverlay(routeOverlay); for (i = 0; i < gMarkers.length; i++) { mapGoogle.removeOverlay(gMarkers[i]); } gMarkers.length = 0; } // Remove the info window mapGoogle.getInfoWindow().hide(); // Remove poi markers clearAllPOIMarkers(); if (dbUsedForGaz == 'E') getGoogleRoute(); else getAARoute(bAvoidMWays, bAvoidTolls, switchUnits); // Remove poi markers clearAllPOIMarkers(); } function getAARoute(bAvoidMWays, bAvoidTolls, switchUnits) { // Format the route request for a GB/Ireland route var selectFrom = document.getElementById("confirmFrom"); var selectTo = document.getElementById("confirmTo"); var sourceArea = document.getElementById("sourceArea"); var clientId = document.getElementById("clientid"); var i; var baseRequest = '/aaservlet/RouteRequest'; var baseParameters = 'database=' + getRouteingDatabase() + '&fromPlaceId=' + escape(selectFrom.value) + '&toPlaceId=' + escape(selectTo.value); // Add the vias (if any) if (viaCountDropDown > 0) { var dropDownId; var selectVia; // Add the via count baseParameters += '&noOfVias=' + viaCountDropDown; // Add each via for (i = 0; i < viaCountDropDown; i++) { dropDownId = "viaChoice" + i.toString(); selectVia = document.getElementById(dropDownId); baseParameters += '&viaPlaceId' + i + '=' + escape(selectVia.value); } } // Add the route options if (bAvoidMWays) baseParameters += '&avoidMotorWay=1' else baseParameters += '&avoidMotorWay=0' if (bAvoidTolls) baseParameters += '&avoidTolls=1' else baseParameters += '&avoidTolls=0' if (switchUnits.length > 0) { baseParameters += '&distanceUnits=' + switchUnits; } if( sourceArea != null ) { baseParameters += '&sourceArea='+escape(sourceArea.value) ; } if( clientId != null ) { baseParameters += '&clientid='+escape(clientId.value) ; } baseParameters+='&xsl=P'; var theRequest=baseRequest+"?"+baseParameters; ajaxRouteReq.open('GET', theRequest); ajaxRouteReq.onreadystatechange = ajaxRouteReady; ajaxRouteReq.send(null); } function ajaxRouteReady() { // Displays the new AA route // Get the DIV elements that will hold the summary and directions var routeSummaryElement = document.getElementById('routeSummary'); var routeDirectionsElement = document.getElementById('routeDirections'); var i; if (ajaxRouteReq.readyState != 4) return; // Check that we have a good status code if (ajaxRouteReq.status != 200) { routeSummaryElement.innerHTML = '
Sorry, this service is temporarily unavailable. Please try again later.
'; return; } var result = eval("("+ajaxRouteReq.responseText+")"); if(result.errors != null && result.errors.length > 0) { // Show the error var error = result.errors; routeSummaryElement.innerHTML = '

Sorry, there was a problem. Please check your entries and try again.

' + error + '

'; //replace loader with button hideLoading(); return; } /*set up route page*/ /*only need to do this once...*/ if(isPageDefault) { setupRoutePageFromDefault(); } // Check if we have got a route summary block if (result.routeSummaryHTML != null && result.routeSummaryHTML.length > 0) { var summaryHTML = result.routeSummaryHTML; routeSummaryElement.innerHTML = '
' + summaryHTML + '
'; } // Check if we have got the route directions block if (result.routeDirectionsHTML != null && result.routeDirectionsHTML.length > 0) { var directionsHTML = result.routeDirectionsHTML; routeDirectionsElement.innerHTML = directionsHTML; } //setURLHistory(); if (result.routeDistance != null) { distance = result.routeDistance; units = result.routeDistanceUnits; //updateMileagePanel(distance, units); } // Check if we have an extent - there must be 4 parts for it if (result.routeExtent != null && result.routeExtent.length == 4) { setMapBounds(result.routeExtent[0], result.routeExtent[1], result.routeExtent[2], result.routeExtent[3]); } // Check if we have some places if (result.routePlaces != null && result.routePlaces.length >= 2) { var gIconType; var placeName; var routePlace; for (i = 0; i < result.routePlaces.length; i++) { // Check that each place contains the correct elements routePlace = result.routePlaces[i]; if (routePlace.length == 5) { createMarker(new GLatLng(routePlace[1], routePlace[2]), i, eval(routePlace[3]), routePlace[4]); } } } // Check if we have a route overlay if (result.routeOverlay != null && result.routeOverlay.length == 2) { addEncodedRouteOverlay(result.routeOverlay[0], result.routeOverlay[1]); } // Check if we have speed cameras if (result.speedCameras != null) { var arrCameras=new Array(); var camPos; for(i=0;i < result.speedCameras.length; i++ ) { // camPos=result.speedCameras[i]; arrCameras[i]=new Array(camPos[0],camPos[1]); } addMarkersFromLatLngArray(arrCameras,-1); //-1 = speedcamera poiTypeID } hideLoading(); } function routeSwitchUnits(unit) { onGetNewRoute(false, unit, false); } function getGoogleRoute() { var i, a, b, c; var placeHTML; var placeValue; var placeLatLong; var selectFrom = document.getElementById("confirmFrom"); var selectTo = document.getElementById("confirmTo"); var fromPlaceValue = selectFrom.options[selectFrom.selectedIndex].value; var toPlaceValue = selectTo.options[selectTo.selectedIndex].value; var routeSummaryElement = document.getElementById('routeSummary'); i = 0; placeElements.length = 0; // Set the start marker if (fromPlaceValue != null && fromPlaceValue != "") { placeValue = fromPlaceValue.split('|'); placeHTML = "Start:
" + placeValue[1]; //placeLatLong = new GLatLng(placeValue[4], placeValue[3]); //createMarker(placeLatLong, i, G_START_ICON, placeHTML); a = "from: " + placeValue[1] + "@" + placeValue[4] + "," + placeValue[3]; var placeElementEntry = new Array(); placeElementEntry[0] = placeValue[1]; placeElementEntry[1] = new Array(); placeElementEntry[1][0] = placeValue[4]; placeElementEntry[1][1] = placeValue[3]; placeElementEntry[2] = G_START_ICON; placeElementEntry[3] = placeHTML; placeElements[i++] = placeElementEntry; } else { routeSummaryElement.innerHTML = '
' + reasons[G_GEO_MISSING_QUERY] + '
'; return; } b = ""; // Add the vias (if any) if (viaCountDropDown > 0) { var dropDownId; var selectVia; var viaIndex; var viaPlaceName; var viaPlaceValue; for (viaIndex = 0; viaIndex < viaCountDropDown; viaIndex++) { dropDownId = "viaChoice" + viaIndex.toString(); selectVia = document.getElementById(dropDownId); viaPlaceValue = selectVia.options[selectVia.selectedIndex].value; if (viaPlaceValue != null && viaPlaceValue != "") { placeValue = viaPlaceValue.split('|'); placeHTML = "Via:
" + placeValue[1]; // createMarker(new GLatLng(latlong[0], latlong[1]), // i, G_PAUSE_ICON, placeHTML); b += " to: " + placeValue[1] + "@" + placeValue[4] + "," + placeValue[3]; var placeElementEntry = new Array(); placeElementEntry[0] = placeValue[1]; placeElementEntry[1] = new Array(); placeElementEntry[1][0] = placeValue[4]; placeElementEntry[1][1] = placeValue[3]; placeElementEntry[2] = G_PAUSE_ICON; placeElementEntry[3] = placeHTML; placeElements[i++] = placeElementEntry; } else { routeSummaryElement.innerHTML = '
' + reasons[G_GEO_MISSING_QUERY] + '
'; return; } } } // Set the end marker if (toPlaceValue != null && toPlaceValue != "") { placeValue = toPlaceValue.split('|'); placeHTML = "End:
" + placeValue[1]; c = " to: " + placeValue[1] + "@" + placeValue[4] + "," + placeValue[3]; var placeElementEntry = new Array(); placeElementEntry[0] = placeValue[1]; placeElementEntry[1] = new Array(); placeElementEntry[1][0] = placeValue[4]; placeElementEntry[1][1] = placeValue[3]; placeElementEntry[2] = G_END_ICON; placeElementEntry[3] = placeHTML; placeElements[i++] = placeElementEntry; } else { routeSummaryElement.innerHTML = '
' + reasons[G_GEO_MISSING_QUERY] + '
'; return; } /*set up route page*/ /*only need to do this once...*/ if(isPageDefault) { setupRoutePageFromDefault(); } //set URL //setURLHistory() a = a + b + c; gdir.load(a, {getPolyline:true, getSteps:true}); } function displayGoogleRouteSummary(metres, seconds, bAddMarkers) { var distance = metres / distanceConversion; var timeHours = Math.floor(seconds / 3600); var timeMinutes = Math.floor((seconds - (timeHours * 3600)) / 60); var distanceUnits = distanceConversion == metresToKilometres ? "km" : "miles"; var switchDistanceUnits = distanceConversion == metresToKilometres ? "miles" : "km"; var summaryHTML = ""; var lastElementIndex = placeElements.length - 1; var routeSummary = document.getElementById('routeSummary'); var i; //updateMileagePanel(distance, distanceUnits); summaryHTML = '

From ' + placeElements[0][0] + ' '; for (i = 1; i < lastElementIndex; i++) { summaryHTML += 'via ' + placeElements[i][0] + ' '; } summaryHTML += 'to ' + placeElements[lastElementIndex][0] + '

'; summaryHTML+='

' summaryHTML+='Distance: ' + distance.toFixed(1) + ' ' + distanceUnits + ' (show in ' + switchDistanceUnits + ') | ' + 'Time: ' + formatSummaryTime(seconds) + '

'; routeSummary.innerHTML = summaryHTML; // Add the markers to the map if (bAddMarkers) { for (i = 0; i <= lastElementIndex; i++) { createMarker(new GLatLng(placeElements[i][1][0], placeElements[i][1][1]), i, placeElements[i][2], placeElements[i][3]); } } } function displayGoogleRouteDirections() { var i, j; var groute; var sectionTime; var totalTime = 0; var accumDistanceMetres = 0; var accumDistance; var gstep; var routeDirections = document.getElementById('routeDirections'); var glatlng; var routeDirectionsText = '' + '' + '' + '' + '' + ''; // Loop through each route in the GDirections object for (i = 0; i < gdir.getNumRoutes(); i++) { groute = gdir.getRoute(i); sectionTime = 0; // Loop through all the steps in the route for (j = 0; j < groute.getNumSteps(); j++) { gstep = groute.getStep(j); // Convert the accumulated distance accumDistance = accumDistanceMetres / distanceConversion; // Add the manoeuvre time to the section time sectionTime += gstep.getDuration().seconds; glatlng = gstep.getLatLng(); // Add a row to the table routeDirectionsText += ''; // Add the distance cell routeDirectionsText += ''; // Add the instructions cell routeDirectionsText += '' +''; routeDirectionsText += ''; // Add the manoeuvre distance to the accumulated distance ready for the next instruction accumDistanceMetres += gstep.getDistance().meters; } // Add a row for the arrival instruction routeDirectionsText += ''; // Add the distance cell accumDistance = accumDistanceMetres / distanceConversion; routeDirectionsText += ''; // Add the instructions cell routeDirectionsText += '' +''; // Display the section and total time totalTime += sectionTime; routeDirectionsText += ''; // Add the distance cell routeDirectionsText += ''; // Add the instructions cell routeDirectionsText += ''; routeDirectionsText += ''; } routeDirectionsText += '
Total distance' + 'Directions 
' + accumDistance.toFixed(1) + ''; if (j ==0) routeDirectionsText += 'Start: '; routeDirectionsText += gstep.getDescriptionHtml(); //summary maps routeDirectionsText += '
' +'
' +'
&#nbsp;
' +'
' +'
'; // onclick="showMapLocation(this,' + glatlng.lat() + ',' + glatlng.lng() + ')" routeDirectionsText +='
' +'Show map' +'Hide map' +'
' + accumDistance.toFixed(1) + 'Arrive at ' + placeElements[i+1][0]; //summary maps routeDirectionsText += '
' +'
' +'
&#nbsp;
' +'
' +'
' +'
' +'Show map' +'Hide map' +'
 ' + "Section time: " + formatSectionTime(sectionTime) + ", Total time: " + formatSectionTime(totalTime) + ' 
'; routeDirections.innerHTML = routeDirectionsText; } function switchGoogleDistanceUnits() { // Redisplay the route in the switched units if (distanceConversion == metresToKilometres) distanceConversion = metresToMiles; else distanceConversion = metresToKilometres; displayGoogleRouteSummary(gdir.getDistance().meters, gdir.getDuration().seconds, false); displayGoogleRouteDirections(); } function formatSummaryTime(seconds) { return formatTime(seconds, " hr ", " min"); } function formatSectionTime(seconds) { return formatTime(seconds, ":", ""); } function formatTime(seconds, delim1, delim2) { var timeHours = Math.floor(seconds / 3600); var timeMinutes = Math.floor((seconds - (timeHours * 3600)) / 60); var strMinutes = timeMinutes.toString(); if (strMinutes.length == 1) strMinutes = '0' + strMinutes; return timeHours + delim1 + strMinutes + delim2; } function trim(str) { return str.replace(/^\s\s*/, '').replace(/\s\s*$/, ''); } function toggleClassName(element, className) { var classPattern = new RegExp('(^|\\s)' + className + '(\\s|$)'); if ((typeof element == 'string') && document.getElementById) element = document.getElementById(element); if (element) if (classPattern.test(element.className)) element.className = element.className.replace(classPattern, ' '); else element.className += ' ' + className; } function setRouteingDatabase(db){ routeingDatabase=db; } function getRouteingDatabase(){ return routeingDatabase } /** hide the "Get route" button and show the swirl image **/ function showLoading() { var routeBtn = $('.getRoute'); routeBtn.hide("fast"); if(routeBtn.parent().find("#ldImg").length==0) { routeBtn.parent().append($("")); } } /** hide the swirl image and show the Get Route button **/ function hideLoading() { var routeBtn = $('.getRoute'); routeBtn.show("fast"); $('#ldImg').remove(); } function setupRoutePageFromDefault() { $("#default-right-col").remove(); $("#route").css("display","block"); $("#route-sponsor").addClass("noprintdispblock").removeClass("noprintdisphidden"); $("#route-right-col").addClass("noprintdispblock").removeClass("noprintdisphidden"); $("#routeFooter").addClass("noprintdispblock").removeClass("noprintdisphidden"); $("#internal-ad-footer").css("display","none"); $("#mapcontainer").parent().removeAttr("style"); $("#routeSummary").removeAttr("class"); //$("#route-planner-features").hide(); $("#routelinkscontainer").addClass("noprintdispblock").removeClass("noprintdisphidden"); showSmallMap("mapcontainer"); isPageDefault=false; } function setURLHistory() { //only for simple routes currently if(viaCount==0) { //set hash values var tmpFromPlace=$('select#confirmFrom option:selected').text(); var tmpToPlace=$('select#confirmTo option:selected').text(); if(tmpFromPlace!=""&&tmpFromPlace!=null) { //check current hash value!=new has value var currentHashvalue=decodeURI(window.location.hash); var curhashfromPlace=''; var curhashtoPlace=''; try{ if(currentHashvalue.indexOf("|")!=-1&¤tHashvalue.indexOf("toPlace")!=-1&¤tHashvalue.indexOf("fromPlace")!=-1) { curhashfromPlace=currentHashvalue.substring(currentHashvalue.indexOf("fromPlace")+10,currentHashvalue.indexOf("|")); curhashtoPlace=currentHashvalue.substring(currentHashvalue.indexOf("toPlace")+8,currentHashvalue.length); } } catch(e){ return; } //prevent infinite loops if(curhashfromPlace!=tmpFromPlace||curhashtoPlace!=tmpToPlace) { var hashValue=encodeURI("fromPlace=" + tmpFromPlace + "|" + "toPlace=" + tmpToPlace); window.location.hash = hashValue; } } } } // Updates the shell mileage panel //function updateMileagePanel(distance, units) //{ //var mapDistanceElement = document.getElementById('mapDistance'); //if (mapDistanceElement != null) //{ //var newInnerHtml = "" + parseFloat(distance).toFixed(1) + " " + units; //mapDistanceElement.innerHTML = newInnerHtml; //} //}