LATEST CODE - http://jsfiddle.net/YsQdh/88/ -
THIS VERSION USES gDouglasPe
The latest answer - http://jsfiddle.net/YsQdh/94/
This contains the gDouglasPeuker algorithm
var theArrayofLatLng = path.j;
var ArrayforPolygontoUse= GDouglasPeucker(theArrayofLatLng,50);
console.log("ArrayforPolygontoUse", ArrayforPolygontoUse);
var polyOptions = {
map: map,
fillColor: '#0099FF',
fillOpacity: 0.7,
strokeColor: '#AA2143',
strokeWeight: 2,
clickable: false,
zIndex: 1,
path:ArrayforPolygontoUse,
editable: false
}