title: Check if a point is in polygon (maps)
body: <p>I'm trying to check if a point is in polygon.<br>
  At the moment I have try with this function   </p>
  
  <pre><code>pointInPolygon:function (point,polygon){
      var i;
      var j=polygon.length-1;
      var inPoly=false;
      var lon = point.longitude;
      var lat = point.latitude;
      for (i=0; i&lt;polygon.length; i++)
      {
          if (polygon[i][0]&lt;lon &amp;&amp; polygon[j][0]&gt;=lon|| polygon[j][0]&lt;lon &amp;&amp; polygon[i][0]&gt;=lon){
              if (polygon[i][0]+(lon-polygon[i][0])/(polygon[j][0]-polygon[i][0])*(polygon[j][1]-polygon[i][1])&lt;lat){
                  inPoly=!inPoly;
              }
          }
          j=i;
      }
      return inPoly;
  }
  </code></pre>
  
  <p>... this function is seems to work on simple polygon ( <a href="http://jsfiddle.net/zTmr7/3/" rel="nofollow">http://jsfiddle.net/zTmr7/3/</a> ) but it won't work for me...
  here is sample data of a polygon:  </p>
  
  <pre><code>polygon: Array[14]
  Array[2]
          0: "-120.190625"
          1: "29.6614549946937"
  Array[2]
          0: "-116.87275390625"
          1: "32.6320990313992"
  Array[2]
          0: "-116.60908203125"
          1: "34.0363970332393"
  Array[2]
          0: "-120.89375"
          1: "41.9203747676428"
  Array[2]
          0: "-114.74140625"
          1: "45.784484644005"
  Array[2]
          0: "-115.971875"
          1: "48.6489780115889"
  Array[2]
          0: "-132.758984375"
          1: "59.9891712248332"
  Array[2]
          0: "-162.5099609375"
          1: "68.919753529737"
  Array[2]
          0: "-168.6623046875"
          1: "68.9828872543805"
  Array[2]
          0: "-168.4865234375"
          1: "64.2551601036027"
  Array[2]
          0: "-179.874356794357"
          1: "51.0915874974707"
  Array[2]
          0: "-179.999916362762"
          1: "13.1823178795562"
  Array[2]
          0: "-143.8771484375"
          1: "19.9962034117847"
  Array[2]
          0: "-120.190625"
          1: "29.6614549946937"  
  </code></pre>
  
  <p>Maybe you can help... thanks in advance  </p>
  
  <p>PS. solution must be especially for Bing maps or universal solution...</p>