var eind=new Array();
var tourism=new Array();
var a=0, b=0;
function CalculateDistance()
{
	if (frmDist.lstFrom.options[frmDist.lstFrom.selectedIndex].value == "-" || frmDist.lstTo.options[frmDist.lstTo.selectedIndex].value=="-")
	{
		divDistance.innerHTML="Please select both From and To City.";
		return false;
	}
	else
	{
		eind=frmDist.lstFrom.options[frmDist.lstFrom.selectedIndex].value.split("/");
		tourism=frmDist.lstTo.options[frmDist.lstTo.selectedIndex].value.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);
		divDistance.innerHTML="Distance Measured is : " + Math.round(a*1.6094) +" Kms.";
		return false;
   }
}