				 //global variables
				 var setEndCoord = "";
				 var setCtoCStartCoord = "";
				 var setVia1Coord = "";
				 var setVia2Coord = "";
				 var setVia3Coord = "";
				 var gEndSiteName = "";
				 var gEndRegionName = "";
				 var gCtoCSiteName = "";
				 var gCtoCRegionName = "";
				 var gVia1SiteName = "";
				 var gVia1RegionName = "";
				 var gVia2SiteName = "";
				 var gVia2RegionName = "";
				 var gVia3SiteName = "";
				 var gVia3RegionName = "";
				 
				 var id1CurrProd = "camp";
				 var id2CurrProd = "camp";
				 var id4CurrProd = "camp";
				 var id5CurrProd = "camp";
				 var idv1CurrProd = "camp";
				 var idv2CurrProd = "camp";
				 var idv3CurrProd = "camp";
				 
				
				 function conversionsBeforeSearch(){

					//append global vars with coordinates of the stops, to be used in the icons layer
					var formElements = document.forms['itisearch_form'].elements;
					//start setEndCoord options
					if (formElements['id1'].value != ""){
					setEndCoord = formElements['id1'].value;
					}
					if (formElements['id2'].value != ""){
					setEndCoord = formElements['id2'].value;
					}
					if (formElements['id5'].value != ""){
					setEndCoord = formElements['id5'].value;
					}
					//end setEndCoord options
					if (formElements['id4'].value != ""){
					setCtoCStartCoord = formElements['id4'].value;
					}
					if (formElements['idv1'].value != ""){
					setVia1Coord = formElements['idv1'].value;
					}
					if (formElements['idv2'].value != ""){
					setVia2Coord = formElements['idv2'].value;
					}
					if (formElements['idv3'].value != ""){
					setVia3Coord = formElements['idv3'].value;
					}
					  

					//alert(setEndCoord);
					//start retrieving addresses and search
					startLocation();
				 }
				 
					/* Convert the start address into coordinates by calling the VMGeocoder */ 
         function startLocation(){
            document.getElementById('result_action').style.display = 'none';
            document.getElementById('youritidiv').style.display = 'none';
            Start_geocoder = new VMGeocoder();
            startAddress = new VMAddress();
						      
            var formElements = 
               document.forms['itisearch_form'].elements;
            startAddress.address = formElements['startStreet'].value;
            startAddress.zipCode = formElements['startPostCode'].value;
            startAddress.city = formElements['startCity'].value;
            startAddress.countryISOCode = formElements['startCountry'].value;
            Start_geocoder.addEventHandler("onCallBack",intermediateLocation1);
            Start_geocoder.search(startAddress);
						
         }



/* Convert the going via address into coordinates by calling the VMGeocoder  */
         function intermediateLocation1(){
            if (document.forms['itisearch_form'].elements['via1Street'].value != "" || document.forms['itisearch_form'].elements['via1Postcode'].value != "" || document.forms['itisearch_form'].elements['via1City'].value != ""){
						   Step1_geocoder = new VMGeocoder();
              intermediateAddress = new VMAddress();
               var formElements = 
                  document.forms['itisearch_form'].elements;
              intermediateAddress.address = formElements['via1Street'].value;
              intermediateAddress.zipCode = formElements['via1Postcode'].value;
              intermediateAddress.city = formElements['via1City'].value;
              intermediateAddress.countryISOCode = formElements['via1Country'].value;
               Step1_geocoder.addEventHandler("onCallBack",intermediateLocation2);
               Step1_geocoder.search(intermediateAddress);
            } else {
						// No going via address so go straight to the search 
               intermediateLocation2();
            }
         }

/* Convert the going via address into coordinates by calling the VMGeocoder  */
         function intermediateLocation2(){
            if (document.forms['itisearch_form'].elements['via2Street'].value != "" || document.forms['itisearch_form'].elements['via2Postcode'].value != "" || document.forms['itisearch_form'].elements['via2City'].value != ""){
               Step2_geocoder = new VMGeocoder();
              intermediateAddress = new VMAddress();
               var formElements = 
                  document.forms['itisearch_form'].elements;
              intermediateAddress.address = formElements['via2Street'].value;
              intermediateAddress.zipCode = formElements['via2Postcode'].value;
              intermediateAddress.city = formElements['via2City'].value;
              intermediateAddress.countryISOCode = formElements['via2Country'].value;
               Step2_geocoder.addEventHandler("onCallBack",intermediateLocation3);
               Step2_geocoder.search(intermediateAddress);
            } else {
						// No going via address so go straight to the search 
               intermediateLocation3();
            }
         }

/* Convert the going via address into coordinates by calling the VMGeocoder  */
         function intermediateLocation3(){
            if (document.forms['itisearch_form'].elements['via3Street'].value != "" || document.forms['itisearch_form'].elements['via3Postcode'].value != "" || document.forms['itisearch_form'].elements['via3City'].value != ""){
               Step3_geocoder = new VMGeocoder();
              intermediateAddress = new VMAddress();
               var formElements = 
                  document.forms['itisearch_form'].elements;
              intermediateAddress.address = formElements['via3Street'].value;
              intermediateAddress.zipCode = formElements['via3Postcode'].value;
              intermediateAddress.city = formElements['via3City'].value;
              intermediateAddress.countryISOCode = formElements['via3Country'].value;
               Step3_geocoder.addEventHandler("onCallBack",search_iti);
               Step3_geocoder.search(intermediateAddress);
            } else {
						// No going via address so go straight to the search 
               search_iti();
            }
         }

/* Convert the destination address into coordinates by calling the VMGeocoder */ 
         function destinationLocation(){
            Stop_geocoder = new VMGeocoder();
            destinationAddress = new VMAddress();
            var formElements = 
                  document.forms['itisearch_form'].elements;
            destinationAddress.address = formElements['destinationStreet'].value;
            destinationAddress.zipCode = formElements['destinationPostcode'].value;
            destinationAddress.city = formElements['destinationCity'].value;
            destinationAddress.countryISOCode = formElements['destinationCountry'].value;
            Stop_geocoder.addEventHandler("onCallBack",search_iti);
            Stop_geocoder.search(destinationAddress);
         }

				 
				 
					/*function testVML(){
						var testLonLat = document.getElementById('startPoint').value;
						var testArrLonLat = testLonLat.split( "," );
						var testArrPos0 = testArrLonLat[0];
						var testArrPos1 = testArrLonLat[1];
						
						coords = new VMLonLat(testArrPos0,testArrPos1);
						alert(coords.lon);
						alert(coords.lat);
					}*/



/* Request a route plan by calling the VMItinerary service. */
         function search_iti(){
				 
				/* alert(id1CurrProd);
				 alert(id2CurrProd);
				 alert(id4CurrProd);
				 alert(id5CurrProd);
				 alert(idv1CurrProd);
				 alert(idv2CurrProd);
				 alert(idv3CurrProd);
				 */
            myiti = new VMItinerary();
						myiti.setDistanceUnit("mi");
						
				 //GET the stops - adding them is later
				 //get UK Ferry Port coords from dropdown and convert into VMLonLat so the api can read them
						var ukFPLonLat = document.getElementById('ukFerryPort').value;
						
						var ukFPArrLonLat = ukFPLonLat.split( "," );
						var ukFPArrPos0 = ukFPArrLonLat[0];
						var ukFPArrPos1 = ukFPArrLonLat[1];
						ukFPCoords = new VMLonLat(ukFPArrPos0,ukFPArrPos1);
				 //get Arrival Ferry Port coords from dropdown and convert into VMLonLat so the api can read them
						var aFPLonLat = document.getElementById('arrivalFerryPort').value;
						var aFPArrLonLat = aFPLonLat.split( "," );
						var aFPArrPos0 = aFPArrLonLat[0];
						var aFPArrPos1 = aFPArrLonLat[1];
						aFPCoords = new VMLonLat(aFPArrPos0,aFPArrPos1);
				 //get (start) Arrival Airport/Rail coords from dropdown and convert into VMLonLat so the api can read them
						if (document.getElementById('arrivalAirRail').value != ""){
						var aARLonLat = document.getElementById('arrivalAirRail').value;
						}
						if (document.getElementById('id4').value != ""){
						//var aARLonLat = document.getElementById('id4').value;
						var tmpIndex = document.getElementById('id4').value;
							if (id4CurrProd == "camp"){
								var tmpData = arsites[tmpIndex].split("|");
							}
							if (id4CurrProd == "ap"){
								var tmpData = arresorts[tmpIndex].split("|");
							}
						var aARLonLat = tmpData[0];
						}
						//alert(aARLonLat);
						var aARArrLonLat = aARLonLat.split( "," );
						var aARArrPos0 = aARArrLonLat[0];
						var aARArrPos1 = aARArrLonLat[1];
						aARCoords = new VMLonLat(aARArrPos0,aARArrPos1);
						//alert(aARCoords);
				 //get End coords from dropdown and convert into VMLonLat so the api can read them
						/*if (document.getElementById('fromHome').style.visible == true){
						var endLonLat = document.getElementById('endPoint1').value;
						} else {
						var endLonLat = document.getElementById('endPoint').value;
						}*/
						if (document.getElementById('id2').value != ""){
						//var endLonLat = document.getElementById('id2').value;
						var tmpIndex = document.getElementById('id2').value;
							if (id2CurrProd == "camp"){
								var tmpData = arsites[tmpIndex].split("|");
							}
							if (id2CurrProd == "ap"){
								var tmpData = arresorts[tmpIndex].split("|");
							}
						var endLonLat = tmpData[0];
						}
						if (document.getElementById('id1').value != ""){
						//var endLonLat = document.getElementById('id1').value;
						var tmpIndex = document.getElementById('id1').value;
							if (id1CurrProd == "camp"){
								var tmpData = arsites[tmpIndex].split("|");
							}
							if (id1CurrProd == "ap"){
								var tmpData = arresorts[tmpIndex].split("|");
							}
						var endLonLat = tmpData[0];
						}
						if (document.getElementById('id5').value != ""){
						var tmpIndex = document.getElementById('id5').value;
							if (id5CurrProd == "camp"){
								var tmpData = arsites[tmpIndex].split("|");
							}
							if (id5CurrProd == "ap"){
								var tmpData = arresorts[tmpIndex].split("|");
							}
						var endLonLat = tmpData[0];
						
						}
						//alert(endLonLat);
						var endArrLonLat = endLonLat.split( "," );
						var endArrPos0 = endArrLonLat[0];
						var endArrPos1 = endArrLonLat[1];
						endCoords = new VMLonLat(endArrPos0,endArrPos1);
						//alert(endCoords);
					// get via stop 1b coords from dropdown
            var formElements = 
               document.forms['itisearch_form'].elements;
						if (formElements['idv1'].value != ""){
						var tmpIndex1 = document.getElementById('idv1').value;
							if (idv1CurrProd == "camp"){
								var tmpData1 = arsites[tmpIndex1].split("|");
							}
							if (idv1CurrProd == "ap"){
								var tmpData1 = arresorts[tmpIndex1].split("|");
							}
						var via1bLonLat = tmpData1[0];
						var via1bArrLonLat = via1bLonLat.split( "," );
						var via1bArrPos0 = via1bArrLonLat[0];
						var via1bArrPos1 = via1bArrLonLat[1];
						via1bCoords = new VMLonLat(via1bArrPos0,via1bArrPos1);
						}
					// get via stop 2b coords from dropdown
						if (formElements['idv2'].value != ""){
						var tmpIndex2 = document.getElementById('idv2').value;
							if (idv2CurrProd == "camp"){
								var tmpData2 = arsites[tmpIndex2].split("|");
							}
							if (idv2CurrProd == "ap"){
								var tmpData2 = arresorts[tmpIndex2].split("|");
							}
						var via2bLonLat = tmpData2[0];
						var via2bArrLonLat = via2bLonLat.split( "," );
						var via2bArrPos0 = via2bArrLonLat[0];
						var via2bArrPos1 = via2bArrLonLat[1];
						via2bCoords = new VMLonLat(via2bArrPos0,via2bArrPos1);
						}
					// get via stop 3b coords from dropdown
						if (formElements['idv3'].value != ""){
						var tmpIndex3 = document.getElementById('idv3').value;
							if (idv3CurrProd == "camp"){
								var tmpData3 = arsites[tmpIndex3].split("|");
							}
							if (idv3CurrProd == "ap"){
								var tmpData3 = arresorts[tmpIndex3].split("|");
							}
						var via3bLonLat = tmpData3[0];
						var via3bArrLonLat = via3bLonLat.split( "," );
						var via3bArrPos0 = via3bArrLonLat[0];
						var via3bArrPos1 = via3bArrLonLat[1];
						via3bCoords = new VMLonLat(via3bArrPos0,via3bArrPos1);
				 		}
						
				 //ADD the stops
					//add start point if valid				 
            var formElements = 
               document.forms['itisearch_form'].elements;
            if (formElements['startStreet'].value != "" 
               || formElements['startPostCode'].value != "" 
               || formElements['startCity'].value != ""){
               myiti.addStopOver(Start_geocoder.result);
							 // add the UK port coords if required
							if (formElements['arrivalFerryPort'].value !=0)
								{
						 			 ukFPArrPos0 = aFPArrLonLat[2];
									 ukFPArrPos1 = aFPArrLonLat[3];
									 var ukFPCoords = new VMLonLat(ukFPArrPos0,ukFPArrPos1);
										myiti.addStopOver(ukFPCoords);
									}
            }
						
					//add ferry ports if valid						
						var formElements = 
               document.forms['itisearch_form'].elements;
						/*if (formElements['ukFerryPort'].value != 0){
						
							myiti.addStopOver(ukFPCoords);
						}*/
						if (formElements['arrivalFerryPort'].value != 0){
						myiti.addStopOver(aFPCoords);
						}
					//add Fly/Rail Drive start if valid
						if (formElements['arrivalAirRail'].value != 0
						|| formElements['id4'].value != 0){
						myiti.addStopOver(aARCoords);
						}
						
					//add Via 1 address
            var formElements = 
               document.forms['itisearch_form'].elements;
            if (formElements['via1Street'].value != "" 
               || formElements['via1Postcode'].value != "" 
               || formElements['via1City'].value != ""){
               myiti.addStopOver(Step1_geocoder.result);
            }
					//add via 1 from dropdowns					
						if (formElements['idv1'].value != 0){
							myiti.addStopOver(via1bCoords);
						}
					//add Via 2 address
            var formElements = 
               document.forms['itisearch_form'].elements;
            if (formElements['via2Street'].value != "" 
               || formElements['via2Postcode'].value != "" 
               || formElements['via2City'].value != ""){
               myiti.addStopOver(Step2_geocoder.result);
            }
					//add via 2 from dropdowns					
						if (formElements['idv2'].value != 0){
						myiti.addStopOver(via2bCoords);
						}
					//add Via 3 address
            var formElements = 
               document.forms['itisearch_form'].elements;
            if (formElements['via3Street'].value != "" 
               || formElements['via3Postcode'].value != "" 
               || formElements['via3City'].value != ""){
               myiti.addStopOver(Step3_geocoder.result);
            }
					//add via 3 from dropdowns					
						if (formElements['idv3'].value != 0){
						myiti.addStopOver(via3bCoords);
						}
						
					//add end point
            myiti.addStopOver(endCoords);
				 
				 //other trip info	
            var formElements = 
               document.forms['itisearch_form'].elements;
            myiti.setItineraryType(formElements['itinType'].value);
            myiti.setItineraryVehicleType(formElements['vehicleType'].value);
            myiti.setCarType(formElements['vehicleCategory'].value);
            myiti.setFuelType(formElements['vehicleFuelType'].value);
						myiti.setFuelCost(convertToEuro(formElements['fuelPrice'].value));
            myiti.addEventHandler("onCallBack",iti_found);
            myiti.search();
						document.getElementById('searching').style.display = 'block';
         }

  function reverse_iti(){
				 
				/* alert(id1CurrProd);
				 alert(id2CurrProd);
				 alert(id4CurrProd);
				 alert(id5CurrProd);
				 alert(idv1CurrProd);
				 alert(idv2CurrProd);
				 alert(idv3CurrProd);
				 */
            myiti = new VMItinerary();
						myiti.setDistanceUnit("mi");
					  var formElements = document.forms['itisearch_form'].elements;
				 //get Arrival Ferry Port coords from dropdown and convert into VMLonLat so the api can read them
						var aFPLonLat = document.getElementById('arrivalFerryPort').value;
						var aFPArrLonLat = aFPLonLat.split( "," );
						var aFPArrPos0 = aFPArrLonLat[0];
						var aFPArrPos1 = aFPArrLonLat[1];
						aFPCoords = new VMLonLat(aFPArrPos0,aFPArrPos1);

						//get End coords from dropdown and convert into VMLonLat so the api can read them
						/*if (document.getElementById('fromHome').style.visible == true){
						var endLonLat = document.getElementById('endPoint1').value;
						} else {
						var endLonLat = document.getElementById('endPoint').value;
						}*/
						if (document.getElementById('id2').value != ""){
						//var endLonLat = document.getElementById('id2').value;
						var tmpIndex = document.getElementById('id2').value;
							if (id2CurrProd == "camp"){
								var tmpData = arsites[tmpIndex].split("|");
							}
							if (id2CurrProd == "ap"){
								var tmpData = arresorts[tmpIndex].split("|");
							}
						var endLonLat = tmpData[0];
						}
						if (document.getElementById('id1').value != ""){
						//var endLonLat = document.getElementById('id1').value;
						var tmpIndex = document.getElementById('id1').value;
							if (id1CurrProd == "camp"){
								var tmpData = arsites[tmpIndex].split("|");
							}
							if (id1CurrProd == "ap"){
								var tmpData = arresorts[tmpIndex].split("|");
							}
						var endLonLat = tmpData[0];
						}
						if (document.getElementById('id5').value != ""){
						var tmpIndex = document.getElementById('id5').value;
							if (id5CurrProd == "camp"){
								var tmpData = arsites[tmpIndex].split("|");
							}
							if (id5CurrProd == "ap"){
								var tmpData = arresorts[tmpIndex].split("|");
							}
						var endLonLat = tmpData[0];
						
						}
						var endArrLonLat = endLonLat.split( "," );
						var endArrPos0 = endArrLonLat[0];
						var endArrPos1 = endArrLonLat[1];
						endCoords = new VMLonLat(endArrPos0,endArrPos1);
						//alert(endCoords);
					//add start point
            myiti.addStopOver(endCoords);


					// Vias
					// get via stop 3b coords from dropdown
						if (formElements['idv3'].value != ""){
						var tmpIndex3 = document.getElementById('idv3').value;
							if (idv3CurrProd == "camp"){
								var tmpData3 = arsites[tmpIndex3].split("|");
							}
							if (idv3CurrProd == "ap"){
								var tmpData3 = arresorts[tmpIndex3].split("|");
							}
						var via3bLonLat = tmpData3[0];
						var via3bArrLonLat = via3bLonLat.split( "," );
						var via3bArrPos0 = via3bArrLonLat[0];
						var via3bArrPos1 = via3bArrLonLat[1];
						via3bCoords = new VMLonLat(via3bArrPos0,via3bArrPos1);
				 		}
 					 if (formElements['via3Street'].value != "" 
               || formElements['via3Postcode'].value != "" 
               || formElements['via3City'].value != ""){
               myiti.addStopOver(Step3_geocoder.result);
            }
					//add via 3 from dropdowns					
						if (formElements['idv3'].value != 0){
						myiti.addStopOver(via3bCoords);
						}
						// get via stop 2b coords from dropdown
						if (formElements['idv2'].value != ""){
						var tmpIndex2 = document.getElementById('idv2').value;
							if (idv2CurrProd == "camp"){
								var tmpData2 = arsites[tmpIndex2].split("|");
							}
							if (idv2CurrProd == "ap"){
								var tmpData2 = arresorts[tmpIndex2].split("|");
							}
						var via2bLonLat = tmpData2[0];
						var via2bArrLonLat = via2bLonLat.split( "," );
						var via2bArrPos0 = via2bArrLonLat[0];
						var via2bArrPos1 = via2bArrLonLat[1];
						via2bCoords = new VMLonLat(via2bArrPos0,via2bArrPos1);
						}
						   if (formElements['via2Street'].value != "" 
               || formElements['via2Postcode'].value != "" 
               || formElements['via2City'].value != ""){
               myiti.addStopOver(Step2_geocoder.result);
            }
					//add via 2 from dropdowns					
						if (formElements['idv2'].value != 0){
						myiti.addStopOver(via2bCoords);
						}
						// get via stop 1b coords from dropdown
						if (formElements['idv1'].value != ""){
						var tmpIndex1 = document.getElementById('idv1').value;
							if (idv1CurrProd == "camp"){
								var tmpData1 = arsites[tmpIndex1].split("|");
							}
							if (idv1CurrProd == "ap"){
								var tmpData1 = arresorts[tmpIndex1].split("|");
							}
						var via1bLonLat = tmpData1[0];
						var via1bArrLonLat = via1bLonLat.split( "," );
						var via1bArrPos0 = via1bArrLonLat[0];
						var via1bArrPos1 = via1bArrLonLat[1];
						via1bCoords = new VMLonLat(via1bArrPos0,via1bArrPos1);
						}
						//add Via 1 address
           
            if (formElements['via1Street'].value != "" 
               || formElements['via1Postcode'].value != "" 
               || formElements['via1City'].value != ""){
               myiti.addStopOver(Step1_geocoder.result);
            }
					//add via 1 from dropdowns					
						if (formElements['idv1'].value != 0){
							myiti.addStopOver(via1bCoords);
						}


					//add ferry crossing
						if (formElements['arrivalFerryPort'].value != 0){
						myiti.addStopOver(aFPCoords);
						// add the UK port coords if required
						 			 ukFPArrPos0 = aFPArrLonLat[2];
									 ukFPArrPos1 = aFPArrLonLat[3];
									 var ukFPCoords = new VMLonLat(ukFPArrPos0,ukFPArrPos1);
										myiti.addStopOver(ukFPCoords);
									}

					//add Fly/Rail Drive start if valid
						if (formElements['arrivalAirRail'].value != 0
						|| formElements['id4'].value != 0){
						myiti.addStopOver(aARCoords);
						}

					// if we need to go to the uk set the uk address
					     if (formElements['startStreet'].value != "" 
               || formElements['startPostCode'].value != "" 
               || formElements['startCity'].value != ""){
               myiti.addStopOver(Start_geocoder.result);
						}
					
						myiti.setItineraryType(formElements['itinType'].value);
            myiti.setItineraryVehicleType(formElements['vehicleType'].value);
            myiti.setCarType(formElements['vehicleCategory'].value);
            myiti.setFuelType(formElements['vehicleFuelType'].value);
						myiti.setFuelCost(convertToEuro(formElements['fuelPrice'].value));
            myiti.addEventHandler("onCallBack",iti_found);
            myiti.search();
						document.getElementById('searching').style.display = 'block';

// End of reverse_iti function
}

         function iti_found(){
					 
				 		document.getElementById('searching').style.display = 'none';
						document.getElementById('Notes').style.display = 'none';
            //alert('Itinerary found');
            document.getElementById('result_action').style.display = '';
						display_onmap();
         }



/* This function displays the route plan as a set of driving directions */
         function display_roadsheet(){
            if (typeof(myiti)!="undefined"){
							document.getElementById('youritidivouter').style.display = 'block';
						   document.getElementById('youritidiv').style.display = '';
							 document.getElementById('youritidiv').innerHTML = myiti.roadSheet.getHTML(mymap);
							
							 if ((document.getElementById('arrivalFerryPort').value != 0)&&((document.getElementById('startPostCode').value != '')||(document.getElementById('startCity').value != '')))
							 	{
							 			 document.getElementById('crossingWarning').style.display = 'block';
							 	}
								else
									{
										 document.getElementById('crossingWarning').style.display = 'none';
									}
            } else {
               alert('No Itinerary loaded');
            }
         }



/* This function displays a map with the route marked on it */
         function display_onmap(){
            if (typeof(myiti)!="undefined"){
										 //alert('Working 1');
               if (typeof(mymap)!="undefined"){
							 //alert('Working 2');
									document.getElementById('yourmapouterdiv').style.display = 'block';
                  document.getElementById('yourmapdiv').innerHTML = "";
                  mymap = new VMMap(document.getElementById("yourmapdiv"));
                  mymap.addLayer(myiti.getItiAsVMComplexLayer("#63b03d",7,0.5));
                  mymap.drawMapFromLayers();  
               } else {
									document.getElementById('yourmapouterdiv').style.display = 'block';
                  mymap = new VMMap(document.getElementById("yourmapdiv"));
                  mymap.addLayer(myiti.getItiAsVMComplexLayer("#63b03d",7,0.5));
                  mymap.drawMapFromLayers();
               }
               mymap.addLayer(myiti.roadSheet.getLayer());
							 mymap.showMapTools(3); 
							 mymap.activateSatelliteHybrid(true);
							 display_informations();
							 display_roadsheet();
						//Add Eurocamp icons to the map - find a way of only displaying visiting campsites
						
						if (setEndCoord != ""){
						
						var tmpIdx = setEndCoord;
						
						if (id1CurrProd != ""){
						 
							if (id1CurrProd == "camp"){

								var tmpLonLat = arsites[setEndCoord].split("|");
							}
							if (id1CurrProd == "ap"){
								var tmpLonLat = arresorts[setEndCoord].split("|");
							}
						}
						if (id2CurrProd != ""){
							if (id2CurrProd == "camp"){
								var tmpLonLat = arsites[setEndCoord].split("|");
							}
							if (id2CurrProd == "ap"){
								var tmpLonLat = arresorts[setEndCoord].split("|");
							}

						}							
						if (id5CurrProd != ""){
							if (id5CurrProd == "camp"){
								var tmpLonLat = arsites[setEndCoord].split("|");
							}
							if (id5CurrProd == "ap"){
								var tmpLonLat = arresorts[setEndCoord].split("|");
							}

						}
							
							
						ECLonLat  = tmpLonLat[0];

						gEndSiteName = tmpLonLat[4];
						gEndRegionName = tmpLonLat[6];
						var ECLonLatArr = ECLonLat.split( "," );
						var ECLonLatArrPos0 = ECLonLatArr[0];
						var ECLonLatArrPos1 = ECLonLatArr[1];
						iconEndCoords = new VMLonLat(ECLonLatArrPos0,ECLonLatArrPos1);
						
						}
						if (setVia1Coord != ""){
						var tmpIdx = setVia1Coord;
							if (idv1CurrProd == "camp"){
								var tmpLonLat = arsites[setVia1Coord].split("|");
							}
							if (idv1CurrProd == "ap"){
								var tmpLonLat = arresorts[setVia1Coord].split("|");
							}
						V1LonLat = tmpLonLat[0];
						gVia1SiteName = tmpLonLat[4];
						gVia1RegionName = tmpLonLat[6];
						var V1LonLatArr = V1LonLat.split( "," );
						var V1LonLatArrPos0 = V1LonLatArr[0];
						var V1LonLatArrPos1 = V1LonLatArr[1];
						iconV1Coords = new VMLonLat(V1LonLatArrPos0,V1LonLatArrPos1);
						}
						if (setVia2Coord != ""){
						var tmpIdx = setVia2Coord;
							if (idv2CurrProd == "camp"){
								var tmpLonLat = arsites[setVia2Coord].split("|");
							}
							if (idv2CurrProd == "ap"){
								var tmpLonLat = arresorts[setVia2Coord].split("|");
							}
						V2LonLat = tmpLonLat[0];
						gVia2SiteName = tmpLonLat[4];
						gVia2RegionName = tmpLonLat[6];
						var V2LonLatArr = V2LonLat.split( "," );
						var V2LonLatArrPos0 = V2LonLatArr[0];
						var V2LonLatArrPos1 = V2LonLatArr[1];
						iconV2Coords = new VMLonLat(V2LonLatArrPos0,V2LonLatArrPos1);
						}
						if (setVia3Coord != ""){
						var tmpIdx = setVia3Coord;
							if (idv3CurrProd == "camp"){
								var tmpLonLat = arsites[setVia3Coord].split("|");
							}
							if (idv3CurrProd == "ap"){
								var tmpLonLat = arresorts[setVia3Coord].split("|");
							}
						V3LonLat = tmpLonLat[0];
						gVia3SiteName = tmpLonLat[4];
						gVia3RegionName = tmpLonLat[6];
						var V3LonLatArr = V3LonLat.split( "," );
						var V3LonLatArrPos0 = V3LonLatArr[0];
						var V3LonLatArrPos1 = V3LonLatArr[1];
						iconV3Coords = new VMLonLat(V3LonLatArrPos0,V3LonLatArrPos1);
						}
						if (setCtoCStartCoord != ""){
						var tmpIdx = setCtoCStartCoord;
							if (id4CurrProd == "camp"){
								var tmpLonLat = arsites[setCtoCStartCoord].split("|");
							}
							if (id4CurrProd == "ap"){
								var tmpLonLat = arresorts[setCtoCStartCoord].split("|");
							}						
						CtoCLonLat = tmpLonLat[0];
						gCtoCSiteName = tmpLonLat[4];
						gCtoCRegionName = tmpLonLat[6];
						var CtoCLonLatArr = CtoCLonLat.split( "," );
						var CtoCLonLatArrPos0 = CtoCLonLatArr[0];
						var CtoCLonLatArrPos1 = CtoCLonLatArr[1];
						CtoCStartCoords = new VMLonLat(CtoCLonLatArrPos0,CtoCLonLatArrPos1);
						}
						//+ Raguenes Plage + "</B><br/>Western Brittany</td></tr><tr><td>&nbsp;</td></tr><tr><td colspan='2'><b>Note:</b>&nbsp;Your destination is depicted by<br/>the Red Flag.</td></tr></table>"
						
						myicon = new VMIcon("../images/pointer.gif",-1,-40);
						var myIconString = "<table><tr><td><img src='../images/ecsmall.gif'/></td><td><B>" ;
						
						//Add End Point Icon
						myIconString = myIconString + gEndSiteName;
						myIconString = myIconString + "</B><br>";
						myIconString = myIconString + gEndRegionName;
						myIconString = myIconString + "</td></tr><tr><td>&nbsp;</td></tr><tr><td colspan='2'><b>Note:</b>&nbsp;Your destination is depicted by<br/>the Red Flag.</td></tr></table>";
						myiconlayer1 = new VMIconLayer((iconEndCoords), myicon, myIconString);
						mymap.addLayer(myiconlayer1);
						
						//Add Via Point 1 Icon
						if (setVia1Coord != ""){
						var myIconString1 = "<table><tr><td><img src='../images/ecsmall.gif'/></td><td><B>" ;
						myIconString1 = myIconString1 + gVia1SiteName;
						myIconString1 = myIconString1 + "</B><br>";
						myIconString1 = myIconString1 + gVia1RegionName;
						myIconString1 = myIconString1 + "</td></tr><tr><td>&nbsp;</td></tr><tr><td colspan='2'><b>Note:</b>&nbsp;This 'Via' point is depicted by<br/>the Purple Flag.</td></tr></table>";
						myiconlayer2 = new VMIconLayer((iconV1Coords), myicon, myIconString1);
						mymap.addLayer(myiconlayer2);
						}
						
						//Add Via Point 2 Icon
						if (setVia2Coord != ""){
						var myIconString2 = "<table><tr><td><img src='../images/ecsmall.gif'/></td><td><B>" ;
						myIconString2 = myIconString2 + gVia2SiteName;
						myIconString2 = myIconString2 + "</B><br>";
						myIconString2 = myIconString2 + gVia2RegionName;
						myIconString2 = myIconString2 + "</td></tr><tr><td>&nbsp;</td></tr><tr><td colspan='2'><b>Note:</b>&nbsp;This 'Via' point is depicted by<br/>the Purple Flag.</td></tr></table>";
						myiconlayer3 = new VMIconLayer((iconV2Coords), myicon, myIconString2);
						mymap.addLayer(myiconlayer3);
						}
						
						//Add Via Point 3 Icon
						if (setVia3Coord != ""){
						var myIconString3 = "<table><tr><td><img src='../images/ecsmall.gif'/></td><td><B>" ;
						myIconString3 = myIconString3 + gVia3SiteName;
						myIconString3 = myIconString3 + "</B><br>";
						myIconString3 = myIconString3 + gVia3RegionName;
						myIconString3 = myIconString3 + "</td></tr><tr><td>&nbsp;</td></tr><tr><td colspan='2'><b>Note:</b>&nbsp;This 'Via' point is depicted by<br/>the Purple Flag.</td></tr></table>";
						myiconlayer4 = new VMIconLayer((iconV3Coords), myicon, myIconString3);
						mymap.addLayer(myiconlayer4);
						}
						
						//Add Campsite 2 Campsite Start Point Icon
						if (setCtoCStartCoord != ""){
						var myIconString4 = "<table><tr><td><img src='../images/ecsmall.gif'/></td><td><B>" ;
						myIconString4 = myIconString4 + gCtoCSiteName;
						myIconString4 = myIconString4 + "</B><br>";
						myIconString4 = myIconString4 + gCtoCRegionName;
						myIconString4 = myIconString4 + "</td></tr><tr><td>&nbsp;</td></tr><tr><td colspan='2'><b>Note:</b>&nbsp;Your campsite start point is depicted<br/>by the Green Flag.</td></tr></table>";
						myiconlayer5 = new VMIconLayer((CtoCStartCoords), myicon, myIconString4);
						mymap.addLayer(myiconlayer5);
						}
						/*myiconlayer2 = new VMIconLayer(new VMLonLat(-3.47541,48.82631), myicon, "<table><tr><td><img src='../../ecuk/images/ecsmall.gif'/></td><td><B>Perros Guirec</B><br/>Northern Brittany</td></tr><tr><td>&nbsp;</td></tr><tr><td colspan='2'><b>Note:</b>&nbsp;Your destination is depicted by<br/>the Red Flag.</td></tr></table>");
						mymap.addLayer(myiconlayer2);
						myiconlayer3 = new VMIconLayer(new VMLonLat(6.49396,43.83921), myicon, "<table><tr><td><img src='../../ecuk/images/ecsmall.gif'/></td><td><B>Castellane</B><br/>Provence</td></tr><tr><td>&nbsp;</td></tr><tr><td colspan='2'><b>Note:</b>&nbsp;Your destination is depicted by<br/>the Red Flag.</td></tr></table>");
						mymap.addLayer(myiconlayer3);*/
						
            } else {
               alert('No Itinerary loaded');
            }      
         }
				 
				 

/* This function displays summary information about the journey */
         function display_informations(){
						strHTML =
                    "<span class='journeyTitle'>Journey Summary</span>"
										+"<table class='tblText' width='630'><tr><td width='310'><img src='../images/icon_totmile.gif'>&nbsp;Total distance: "
                    //+(myiti.getTotalDistance()/1000)+"km<br>"
										+roundNumber2dp((myiti.getTotalDistance()/1609))+" Miles</td>"
                    + "<td><img src='../images/icon_tottime.gif'>&nbsp;Total time: "
                    +convertSeconds(myiti.getTotalTime())+"</td></tr>"
                    + "<tr><td><img src='../images/icon_totmway.gif'>&nbsp;Distance on motorway: "
                    //+(myiti.getDistanceOnMotorway()/1000)+"km<br>"
										+roundNumber2dp((myiti.getDistanceOnMotorway()/1609))+" Miles</td>"
                    + "<td><img src='../images/icon_timemway.gif'>&nbsp;Time on motorway: "
                    +convertSeconds(myiti.getTimeOnMotorway())+"</td></tr>"
                    + "<tr><td><img src='../images/icon_mwaycost.gif'>&nbsp;Motorway toll cost: "
                    +"&pound;"+roundNumber2dp(convertToGBP(myiti.getTollCost())) +" / "+ myiti.getTollCost() +"&euro; </td>"	
                    + "<td></td></tr>"																			
                    + "<tr><td><img src='../images/icon_fuelcost.gif'>&nbsp;Fuel cost: "
                    +"&pound;"+roundNumber2dp(convertToGBP(myiti.getTotalGasConsumption())) +" / "+ myiti.getTotalGasConsumption() +"&euro; </td></tr></table>"
            document.getElementById('youritiresumediv').style.display = '';
            document.getElementById('youritiresumediv').innerHTML = strHTML;
         }
				 /*This is from 6 lines above directly between the <TD> tags, currently commented due to viaMichelin fixing Road Tax Problem: <img src='ecuk/images/icon_roadtax.gif'>&nbsp;Road Tax cost: "
                    +"&pound;"+roundNumber2dp(convertToGBP(myiti.getRoadTaxCost())) +" / "+ myiti.getRoadTaxCost() +"&euro;*/
				 
								 
				 /* Not used - another way of showing bubbles on map
				 function setBubbleTemplate(){
				 var html = '<div style="padding: 5px 10px; background: #EEE">' +
										'<p align="right" id="VMBubbleClose" style="padding: 0; margin: 0;"><small>Fermer</small></p>' +
										'<div id="VMBubbleContent" style="background: #DDD; white-space: nowrap; padding: 20px;">Hello World</div>' +
										'</div>';
				 mymap.setBubbleTemplate(html);
				 }*/
				 
				 /*function addIconToMap(){
						myicon = new VMIcon("http://www.viamichelin.com/b2b2c/maf/images/poi/num/076.png",-12,-12);
						map = new VMMap(document.getElementById("yourmapdiv"));
						map.drawMap(new VMLonLat(2.334109831366178,48.86142864093333),15);
						myiconlayer = new VMIconLayer(new VMLonLat(2.334109831366178,48.86142864093333), myicon, "Hello World Custom Icon!<textarea>Hello Custom Expand Layer</textarea>");
						map.addLayer(myiconlayer);
				 }*/


					// End of viaMichelin functions
					// Start of user defined functions
					
					function moveNorth(){
					mymap.moveNorth();
					}
					function moveEast(){
					mymap.moveEast();
					}
					function moveSouth(){
					mymap.moveSouth();
					}
					function moveWest(){
					mymap.moveWest();
					}

				 function convertSeconds(duration){
				 	/* VM returns journey times in seconds, this function converts to hours and minutes - discarding any seconds left over */
					var temp = Math.floor(duration/60);
					var outputDuration = Math.floor(temp/60) + " Hours " + Math.floor(temp % 60) + " Minutes";
					return outputDuration;
				 }
				 
				 /*The convert to GBP/Euro functions are used for the summary and fuel workings out as VM uses Euro's,
				 these converts the input of fuel price to euro's so VM can process it, then once it returns,
				 converts it back into gbp.*/
				 function convertToGBP(euroAmount){
				 	var outputGBP = (euroAmount*0.8);
					return outputGBP;
				 }
				 function convertToEuro(gbpAmount){
				 	var outputEuro = (gbpAmount*1.2);
					return outputEuro;
				 }
				 /*Used for rounding up prices and distance etc*/
				 function roundNumber2dp(inputNum){
				 var outputNum = Math.round(inputNum*100)/100;
				 return outputNum;
				 }
				 
				 function setFerryOn(){
						document.itisearch_form.ukFerryPort.disabled=false;
						document.getElementById("UKFPon").checked = true;
						document.getElementById("UKFPoff").checked = false;
				 }
				 function setFerryOff(){
				 		document.itisearch_form.ukFerryPort.value=0;
						document.itisearch_form.ukFerryPort.disabled=true;
						document.getElementById("UKFPoff").checked = true;
						document.getElementById("UKFPon").checked = false;
				 }
				 
				 function setArrFerryOn(){
						document.itisearch_form.arrivalFerryPort.disabled=false;
						document.getElementById("arrFPon").checked = true;
						document.getElementById("arrFPoff").checked = false;
				 }
				 function setArrFerryOff(){
				 		document.itisearch_form.arrivalFerryPort.value=0;
						document.itisearch_form.arrivalFerryPort.disabled=true;
						document.getElementById("arrFPoff").checked = true;
						document.getElementById("arrFPon").checked = false;
				 }
				 
				 //The route option dropdown calls this, if 'walking or bike' then set vehicle dropdowns disabled
				 function routeSelect(){
				 	if (document.getElementById("itinType").value == 5 || document.getElementById("itinType").value == 6){
						document.itisearch_form.vehicleType.disabled=true;
						document.itisearch_form.vehicleCategory.disabled=true;
					} else {
						document.itisearch_form.vehicleType.disabled=false;
						document.itisearch_form.vehicleCategory.disabled=false;
						
							if (document.getElementById("vehicleType").value != 0){
								document.itisearch_form.vehicleCategory.disabled=true;
							}
					}
				 }
				 
				 //Car type dropdown calls this, if not a car then disable vehicle category
				 function carSelect(){
				 	if (document.getElementById("vehicleType").value != 0){
						document.itisearch_form.vehicleCategory.disabled=true;
					} else {
						document.itisearch_form.vehicleCategory.disabled=false;
					}
				 }
				 
				 //Sets the tabbing to From home
				 function setFromHome(){
				 	document.getElementById('fromHome').style.display = 'block';
					document.getElementById('homeNotes').style.display = 'block';
					document.getElementById('fromArrival').style.display = 'none';
					document.getElementById('fromCampsite').style.display = 'none';
					document.getElementById('viaArrival').style.display = 'none';
					document.getElementById('airNotes').style.display = 'none';
					document.getElementById('siteNotes').style.display = 'none';
					document.getElementById('extraOptions').style.display = 'none';
					document.getElementById('subOpt1').innerHTML = "<p><a href='javascript:showOptions();'>Show Options&nbsp;<img src='../images/downArrow.gif'></a></p>";
				 	document.getElementById('subOpt2').innerHTML = "<p><a href='javascript:showOptions();'>Show Options&nbsp;<img src='../images/downArrow.gif'></a></p>";
					//document.getElementById('subOpt3').innerHTML = "<p><a href='javascript:showOptions();'>Show Options&nbsp;<img src='../images/downArrow.gif'></a></p>";
					document.itisearch_form.arrivalAirRail.value=0;
					document.itisearch_form.region2.value="";
					document.itisearch_form.id2.value="";
					document.itisearch_form.via1Street.value="";
					document.itisearch_form.via1Postcode.value="";
					document.itisearch_form.via1City.value="";
					document.itisearch_form.via2Street.value="";
					document.itisearch_form.via2Postcode.value="";
					document.itisearch_form.via2City.value="";
					document.itisearch_form.via3Street.value="";
					document.itisearch_form.via3Postcode.value="";
					document.itisearch_form.via3City.value="";
					document.itisearch_form.id4.value="";
					document.itisearch_form.id5.value="";
					document.itisearch_form.idv1.value="";
					document.itisearch_form.idv2.value="";
					document.itisearch_form.idv3.value="";
					document.getElementById('youritidivouter').style.display = 'none';
					document.getElementById('yourmapouterdiv').style.display = 'none';
					document.getElementById('youritiresumediv').style.display = 'none';

				 }
				 //Set the tabbing to Fly/Rail drive
				 function setFromArrival(){
				 	document.getElementById('fromArrival').style.display = 'block';
					document.getElementById('fromHome').style.display = 'none';
					document.getElementById('fromCampsite').style.display = 'none';
					document.getElementById('viaArrival').style.display = 'block';
					document.getElementById('extraOptions').style.display = 'none';
					document.getElementById('homeNotes').style.display = 'none';
					document.getElementById('airNotes').style.display = 'block';
					document.getElementById('siteNotes').style.display = 'none';
					document.getElementById('subOpt1').innerHTML = "<p><a href='javascript:showOptions();'>Show Options&nbsp;<img src='../images/downArrow.gif'></a></p>";
				 	document.getElementById('subOpt2').innerHTML = "<p><a href='javascript:showOptions();'>Show Options&nbsp;<img src='../images/downArrow.gif'></a></p>";
					//document.getElementById('subOpt3').innerHTML = "<p><a href='javascript:showOptions();'>Show Options&nbsp;<img src='../images/downArrow.gif'></a></p>";
					document.itisearch_form.startStreet.value='';
					document.itisearch_form.startPostCode.value='';
					document.itisearch_form.startCity.value='';
					document.itisearch_form.region1.value="";
					document.itisearch_form.id1.value="";
					document.itisearch_form.ukFerryPort.value=0;
					document.itisearch_form.arrivalFerryPort.value=0;
					document.itisearch_form.id4.value="";
					document.itisearch_form.id5.value="";
					document.getElementById('youritidivouter').style.display = 'none';
					document.getElementById('yourmapouterdiv').style.display = 'none';
					document.getElementById('youritiresumediv').style.display = 'none';

				 }
				 //Set the tabbing to Campsite to Campsite
				 function setCtoC(){
				 	document.getElementById('fromCampsite').style.display = 'block';
				 	document.getElementById('fromArrival').style.display = 'none';
					document.getElementById('fromHome').style.display = 'none';
					document.getElementById('viaArrival').style.display = 'none';
					document.getElementById('homeNotes').style.display = 'none';
					document.getElementById('airNotes').style.display = 'none';
					document.getElementById('siteNotes').style.display = 'block';
					document.getElementById('extraOptions').style.display = 'none';
					document.getElementById('subOpt1').innerHTML = "<p><a href='javascript:showOptions();'>Show Options&nbsp;<img src='../images/downArrow.gif'></a></p>";
				 	document.getElementById('subOpt2').innerHTML = "<p><a href='javascript:showOptions();'>Show Options&nbsp;<img src='../images/downArrow.gif'></a></p>";
					//document.getElementById('subOpt3').innerHTML = "<p><a href='javascript:showOptions();'>Show Options&nbsp;<img src='../images/downArrow.gif'></a></p>";
					document.itisearch_form.startStreet.value='';
					document.itisearch_form.startPostCode.value='';
					document.itisearch_form.startCity.value='';
					document.itisearch_form.region1.value="";
					document.itisearch_form.id1.value="";
					document.itisearch_form.ukFerryPort.value=0;
					document.itisearch_form.arrivalFerryPort.value=0;
					//added from setFromHome to wipe forms when this div is set active
					document.itisearch_form.arrivalAirRail.value=0;
					document.itisearch_form.region2.value="";
					document.itisearch_form.id2.value="";
					document.itisearch_form.via1Street.value="";
					document.itisearch_form.via1Postcode.value="";
					document.itisearch_form.via1City.value="";
					document.itisearch_form.via2Street.value="";
					document.itisearch_form.via2Postcode.value="";
					document.itisearch_form.via2City.value="";
					document.itisearch_form.via3Street.value="";
					document.itisearch_form.via3Postcode.value="";
					document.itisearch_form.via3City.value="";
					document.itisearch_form.idv1.value="";
					document.itisearch_form.idv2.value="";
					document.itisearch_form.idv3.value="";
					document.getElementById('youritidivouter').style.display = 'none';
					document.getElementById('yourmapouterdiv').style.display = 'none';
					document.getElementById('youritiresumediv').style.display = 'none';

				 }
				 function addViaPoint1(){
				 	document.getElementById('viaPoint1').style.display = 'block';
					document.getElementById('fromArrival').style.background='url(../images/box_bkg2_bot2.gif)';
					document.getElementById('fromArrival').style.height='358px';
					document.getElementById('addVia').innerHTML = "<br><br><strong>Add Via</strong>&nbsp;<a href='javascript:addViaPoint2();'><img src='../Images/plusSymbol2.gif' alt='Add Via Point'></a><br>";
				 }
				 function addViaPoint2(){
				 	document.getElementById('viaPoint2').style.display = 'block';
					document.getElementById('addVia').innerHTML = "<br><br><strong>Add Via</strong>&nbsp;<a href='javascript:addViaPoint3();'><img src='../Images/plusSymbol2.gif' alt='Add Via Point'></a><br>";
				 }
				 function addViaPoint3(){
				 	document.getElementById('viaPoint3').style.display = 'block';
					document.getElementById('addVia').innerHTML = "<br><br><strong>Maximum number of Via's reached</strong><br>";
				 }
				 function viaType1a(){
				 	document.getElementById('viaPoint1a').style.display = 'block';
					document.getElementById('viaPoint1b').style.display = 'none';
					document.getElementById("via1Typeb").checked = false;
					document.itisearch_form.idv1.value="";
				 }
				 function viaType1b(){
				 	document.getElementById('viaPoint1a').style.display = 'none';
					document.getElementById('viaPoint1b').style.display = 'block';
					document.getElementById("via1Typea").checked = false;
					document.itisearch_form.via1Street.value="";
					document.itisearch_form.via1Postcode.value="";
					document.itisearch_form.via1City.value="";
				 }
				 function viaType2a(){
				 	document.getElementById('viaPoint2a').style.display = 'block';
					document.getElementById('viaPoint2b').style.display = 'none';
					document.getElementById("via2Typeb").checked = false;
					document.itisearch_form.idv2.value="";
				 }
				 function viaType2b(){
				 	document.getElementById('viaPoint2a').style.display = 'none';
					document.getElementById('viaPoint2b').style.display = 'block';
					document.getElementById("via2Typea").checked = false;
					document.itisearch_form.via2Street.value="";
					document.itisearch_form.via2Postcode.value="";
					document.itisearch_form.via2City.value="";
				 }
				 function viaType3a(){
				 	document.getElementById('viaPoint3a').style.display = 'block';
					document.getElementById('viaPoint3b').style.display = 'none';
					document.getElementById("via3Typeb").checked = false;
					document.itisearch_form.idv3.value="";
				 }
				 function viaType3b(){
				 	document.getElementById('viaPoint3a').style.display = 'none';
					document.getElementById('viaPoint3b').style.display = 'block';
					document.getElementById("via3Typea").checked = false;
					document.itisearch_form.via3Street.value="";
					document.itisearch_form.via3Postcode.value="";
					document.itisearch_form.via3City.value="";
				 }
				 function deleteStop(divToHide){
				 var divID = divToHide;
				 	document.getElementById(divID).style.display = 'none';
				 }
				 function checkPostcode(){
					 if (document.itisearch_form.via1Country.value == "GBR"){
							var noalpha = /[a-zA-Z]/;
							if (noalpha.test(document.itisearch_form.via1Postcode.value) || noalpha.test(document.itisearch_form.via2Postcode.value) || noalpha.test(document.itisearch_form.via3Postcode.value)) {
							alert("Please enter at least one number in the Postcode field.");
							return false;
							}
					 }
				 }
				 function formReset(){
				 	document.itisearch_form.reset();
					document.getElementById('addVia').innerHTML = "<br><br><strong>Add Via</strong>&nbsp;<a href='javascript:addViaPoint1();'><img src='../Images/plusSymbol2.gif' alt='Add Via Point'></a><br>";
					document.getElementById('viaPoint1').style.display = 'none';
					document.getElementById('viaPoint2').style.display = 'none';
					document.getElementById('viaPoint3').style.display = 'none';
					document.getElementById('viaPoint1a').style.display = 'none';
					document.getElementById('viaPoint2a').style.display = 'none';
					document.getElementById('viaPoint3a').style.display = 'none';
					document.getElementById('viaPoint1b').style.display = 'none';
					document.getElementById('viaPoint2b').style.display = 'none';
					document.getElementById('viaPoint3b').style.display = 'none';

					document.getElementById('youritidivouter').style.display = 'none';
					document.getElementById('yourmapouterdiv').style.display = 'none';
					document.getElementById('youritiresumediv').style.display = 'none';
					document.getElementById('Notes').style.display = 'block';

				 setVia1Coord = "";
				  setVia2Coord = "";
				  setVia3Coord = "";
				 }
				 function showOptions(){
				 	document.getElementById('extraOptions').style.display = 'block';
					document.getElementById('subOpt1').innerHTML = "<a href='javascript:hideOptions();'>Hide Options&nbsp;<img src='../images/upArrow.gif'></a>";
				 	document.getElementById('subOpt2').innerHTML = "<a href='javascript:hideOptions();'>Hide Options&nbsp;<img src='../images/upArrow.gif'></a>";
				 	//document.getElementById('subOpt3').innerHTML = "<p><a href='javascript:hideOptions();'>Hide Options&nbsp;<img src='../images/upArrow.gif'></a></p>";
				 }
				 function hideOptions(){
				 	document.getElementById('extraOptions').style.display = 'none';
					document.getElementById('subOpt1').innerHTML = "<a href='javascript:showOptions();'>Show Options&nbsp;<img src='../images/downArrow.gif'></a>";
				 	document.getElementById('subOpt2').innerHTML = "<a href='javascript:showOptions();'>Show Options&nbsp;<img src='../images/downArrow.gif'></a>";
				 //	document.getElementById('subOpt3').innerHTML = "<p><a href='javascript:showOptions();'>Show Options&nbsp;<img src='../images/downArrow.gif'></a></p>";
				 }				 
				function checkLongCrossings(){
				var isLong = false;
				var isFromHome = false;
				
				if ((document.itisearch_form.startStreet != '')||(document.itisearch_form.startAddress != '')||(document.itisearch_form.startPostCode != ''))
					{
					
						isFromHome = true;
				}
								if ((document.itisearch_form.arrivalFerryPort.selectedIndex == 12)||(document.itisearch_form.arrivalFerryPort.selectedIndex == 13))
					{
					
						isLong = true;
					}

				if ((isFromHome == true)&&(isLong == true))
					{
						alert("Please note that it is only possible to generate a route from a UK address via Portsmouth-Bilbao or Plymouth-Santander if you choose the Shortest Route option from the Show Options menu. Alternatively, please remove the UK Start Address and include the chosen ferry crossing.");
					}
				}
				