var dist = [
['Annapolis Royal', [], []],
['Aylesford', [39], [46]],
['Berwick', [52,5], [62,7]],
['Bridgetown', [16,26,34], [18,30,40]],
['Digby', [23,54,68,37], [27,65,82,44]],
['Hantsport', [83,33,34,65,99], [99,39,40,78,119]],
['Kentville', [64,17,15,45,80,24], [77,19,18,54,96,28]],
['Kingston', [32,7,12,19,47,39,23], [38,8,14,26,58,46,27]],
['Middleton', [33,13,22,15,51,52,34,6], [39,15,26,18,61,62,40,7]],
['New Minas', [57,19,22,44,83,14,3,25,31], [69,26,26,54,101,17,6,28,37]],
['Windsor', [86,34,37,68,102,7,26,40,55,17], [103,40,44,81,123,83,30,47,66,19]],
['Wolfville', [71,23,21,53,88,13,10,29,40,4,16], [85,27,24,63,105,15,12,35,48,7,18]]
];

// Distance Calculator with Times
// copyright 27th April 2006, by Stephen Chapman
// permission to use this Javascript on your web page is granted
// provided that all of the code below in this script (including these
// comments) is used without any alteration
function reverse(a, b){if (a>b) return -1;if (a <b) return 1;return 0;}function setOptions(id) {var selbox = document.getElementById(id);selbox.options.length = 0;var ct = []; for (var i = dist.length - 1; i >= 0; i--) {ct[i] = dist[i][0]+','+i;} ct.sort(reverse); for (var i = dist.length - 1; i >= 0; i--) {var c = ct[i].split(','); selbox.options[selbox.options.length] = new Option(c[0],c[1]);}}function calc() {var v1 = document.getElementById('ca').value;var v2 =  document.getElementById('cb').value;var dst = 0;if (v1 != v2) {dst =dist[Math.max(v1,v2)][1][Math.min(v1,v2)];tme = dist[Math.max(v1,v2)][2][Math.min(v1,v2)];}
// change the following line to allow both miles and km if required
document.getElementById('k').value = dst*1.60934; 
document.getElementById('t').value = tme;}function start() {setOptions('ca');setOptions('cb');}window.onload=start;
                  
