/*
Author: Dirk Strothmann
Copyright(C) 2007 Dirk Strothmann (www.web4map.com). All rights reserved.
Duplication or redistribution prohibited without written permission of the author.
*/
 function getpolylength(plist,mmode){ var i; var le=0; var plength=plist.getVertexCount(); var first=plist.getVertex(0); var second; for (i=1;i<plength;i++){ second=plist.getVertex(i); le+=x70(first,second,mmode); first=second; }; return(le); }; function x70(point1,point2,mmode){ return x71(point1.lng(),point1.lat(),point2.lng(),point2.lat(),mmode); }; function x71(lon1,lat1,lon2,lat2,mmode) { if (mmode==0) return 6377.83 * Math.acos(Math.sin(lat1/57.2958) * Math.sin(lat2/57.2958) + Math.cos(lat1/57.2958) * Math.cos(lat2/57.2958) * Math.cos(lon2/57.2958 - lon1/57.2958)); else return 3963 * Math.acos(Math.sin(lat1/57.2958) * Math.sin(lat2/57.2958) + Math.cos(lat1/57.2958) * Math.cos(lat2/57.2958) * Math.cos(lon2/57.2958 - lon1/57.2958)); }; function x72(point,mmode) { if (mmode==0) return 6377.83 * Math.acos( Math.cos(point.lat()/57.2958) * Math.cos(point.lng()/57.2958)); else return 3963 * Math.acos(Math.cos(point.lat()/57.2958) * Math.cos(point.lng()/57.2958)); }; 