var eind=new Array();
var tourism=new Array();
var a=0;
var b=0;
function DoCalc() {
	
var w = document.xyz.abc.selectedIndex;
var selected_text = document.xyz.abc.options[w].value;
//var to = document.xyz.pqr.selectedIndex;
var to = document.getElementById("pqr").value;
var selected_text_dest = document.getElementById("pqr").value
//document.xyz.pqr.options[to].value;

if (selected_text == null || selected_text_dest==null) {
alert("Please enter both an Originating and a terminal place.");
}
else {
eind=selected_text.split("/");
tourism=selected_text_dest.split("/");
d=Math.acos(Math.sin(eind[2])
*Math.sin(tourism[2])
+Math.cos(eind[2])
*Math.cos(tourism[2])
*Math.cos(eind[4]-tourism[4]));
a=Math.round(3956.073*d);
if (Math.sin(tourism[4]-eind[4]) < 0) {
b=Math.acos((Math.sin(tourism[2])
-Math.sin(eind[2])*Math.cos(d))
/(Math.sin(d)*Math.cos(eind[2])));
} 
else { 
b=2*Math.PI
-Math.acos((Math.sin(tourism[2])
-Math.sin(eind[2])
*Math.cos(d))/(Math.sin(d)
*Math.cos(eind[2])));
}
b=b*(180/Math.PI);
//alert("Distance measured is:" +" " + Math.round(a*3.2900) +" "+ "kms.");
//document.getElementById('distance_div').style.visibility = 'visible';
//document.getElementById('distance_div').style.display = 'block';
document.getElementById('distance').value=Math.round(a*3.2900) +" "+ "kms";

   }
}
