var dist = [
['Ottawa',[]],
['Toronto',[450]],
['Montreal',[200,550]],
['Halifax',[1450,1800,1250]],
['Edmonton',[3550,3450,3775,5000]],
['Calgary',[3550,3450,3750,4975,300]],
['Vancouver',[4650,4500,4800,6070,1250,1050]],
['San Francisco',[4650,4250,4780,6070,2650,2400,100]],
['New York',[715,800,625,1370,4050,4000,4800,4726]],
['Paris',[5666,6015,5521,4900,7155,7395,7950,8977,5844]],
['New Delhi',[11362,11653,11284,10973,10842,11107,11152,12377,11772,6601]],
['Winnipeg',[1680,1520,1828,2585,1192,1205,1869,2419,2075,6649,11292]],
['Victoria',[3585,3397,3735,4487,901,730,91,1185,3946,8033,11230,1907]],
['Saskatoon',[2374,2231,2514,3246,480,527,1204,2018,2787,6960,11047,713,1257]],
['London (UK)',[5379,5728,5238,4640,6815,7055,7608,8641,5579,343,6724,6323,7692,6624]],
['Sydney (Australia)',[15856,15562,16022,16815,13287,13155,12481,11930,15992,16968,10423,14283,12425,13681,16998]],
['Singapore',[14821,15006,14806,14757,13018,13188,12838,13597,15336,10729,4128,13986,12876,13426,10846,6316]],
['Los Angeles',[3815,3511,3982,4771,2200,1920,1726,549,3961,9110,12874,2466,1645,2217,8781,12051,14126]]
];

// Distance Calculator
// copyright 23rd 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 km = 0;if (v1 != v2) km = dist[Math.max(v1,v2)][1][Math.min(v1,v2)];document.getElementById('k').value = km;document.getElementById('m').value = Math.round(km/1.60934);}function start() {setOptions('ca');setOptions('cb');}window.onload=start;
