var dist = [['Berg-en-Dal', [], []],['Crocodile Bridge and Gate', [149], ["6:00"]],['Letaba', [234,196], ["9:25","7:50"]],['Lower Sabie', [113,34,162], ["4:30","1:20","6:30"]],['Malelane', [12,141,226,105], ["0:30","5:40","9:00","4:10"]],['Mopane', [281,243,47,209,272], ["11:15","9:45","1:55","8:20","10:55"]],['Numbi Gate', [97,130,216,95,94,263], ["3:50","5:10","8:40","3:50","3:50","10:30"]],['Phabeni Gate', [90,115,200,81,82,247,22], ["3:36","4:36","8:00","3:14","3:17","9:53","0:53"]],['Olifants', [219,181,32,147,210,86,201,185], ["8:45","7:15","1:20","5:55","8:25","3:25","8:00","7:24"]],['Orpen', [213,175,117,141,204,164,195,175,102], ["8:30","7:00","4:40","5:40","8:10","6:35","7:50","7:00","4:05"]],['Pafuri Gate', [453,415,218,380,444,172,434,418,250,335], ["18:10","16:35","8:45","15:10","17:45","6:55","17:20","16:43","10:00","13:25"]],['Paul Kruger Gate', [83,88,173,53,74,220,65,34,158,152,392], ["3:20","3:30","6:55","2:10","3:00","8:50","2:35","1:22","6:20","6:05","15:40"]],['Phalaborwa Gate', [285,246,51,213,277,74,267,251,83,167,246,224], ["11:25","9:50","2:00","8:30","11:05","3:00","10:40","10:02","3:20","6:40","9:50","9:00"]],['Pretoriuskop', [92,125,211,90,85,258,9,24,195,184,438,60,261], ["3:40","5:00","8:25","3:35","3:25","10:20","0:20","0:58","7:50","7:20","17:30","2:25","10:25"]],['Punda Maria', [415,377,176,342,408,130,396,380,212,297,76,354,201,389], ["16:35","15:05","7:00","13:40","16:20","5:10","15:50","15:12","8:30","11:55","3:00","14:10","8:00","15:35"]],['Satara', [165,127,69,93,156,116,147,131,54,48,287,104,119,140,245], ["6:35","5:05","2:45","3:45","6:15","4:40","5:55","5:14","2:10","1:55","11:30","4:10","4:45","5:35","9:50"]],['Shingwedzi', [344,306,109,271,333,63,325,309,141,226,109,283,137,318,71,178], ["13:45","12:15","4:20","10:50","13:20","2:30","13:00","12:22","5:40","9:00","4:20","11:20","5:30","12:45","2:50","7:10"]],['Skukuza', [72,77,162,43,64,209,54,39,147,137,380,12,213,49,342,93,271], ["2:55","3:05","6:30","1:45","2:35","8:20","2:10","1:34","5:55","5:30","15:10","0:30","8:30","2:00","13:40","3:45","10:50"]]];// Distance Calculator with Times Times at average speed of 25km/h// 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('m').value = dst/1.6;document.getElementById('k').value = dst; document.getElementById('t').value = tme;}function start() {setOptions('ca');setOptions('cb');}window.onload=start;                  
