<!-- ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: -->
<!-- :::                                                                         ::: -->
<!-- :::  This routine calculates the distance between two points (given the     ::: -->
<!-- :::  latitude/longitude of those points). It is being used to calculate     ::: -->
<!-- :::  the distance between two ZIP Codes.                                    ::: -->
<!-- :::                                                                         ::: -->
<!-- :::  Definitions:                                                           ::: -->
<!-- :::    South latitudes are negative, east longitudes are positive           ::: -->
<!-- :::                                                                         ::: -->
<!-- :::  Passed to function:                                                    ::: -->
<!-- :::    lat1, lon1 = Latitude and Longitude of point 1 (in decimal degrees)  ::: -->
<!-- :::    lat2, lon2 = Latitude and Longitude of point 2 (in decimal degrees)  ::: -->
<!-- :::                                                                         ::: -->
<!-- :::  United States ZIP Code                                                 ::: -->
<!-- :::  databases with latitude & longitude are available at                   ::: -->
<!-- :::  http://www.zipwise.com                                                 ::: -->
<!-- :::                                                                         ::: -->
<!-- ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: -->

<cfset radlat1 = ((pi() * lat1)/180)>
<cfset radlat2 = ((pi() * lat2)/180)>
<cfset radlon1 = ((pi() * lon1)/180)>
<cfset radlon2 = ((pi() * lon2)/180)>
<cfset theta = lon1-lon2>
<cfset radtheta = ((pi() * theta)/180)>
<cfset dist = ((60 * 1.1515) * (180 / pi()) * (ACos((Sin(radlat1) * Sin(radlat2)) + (Cos(radlat1) * Cos(radlat2) * Cos(radtheta)))))>