code: function(obj, type) {
          var valid = false;
          switch(type) {
              case "Geometry":
                  if(OpenLayers.Util.indexOf(
                      ["Point", "MultiPoint", "LineString", "MultiLineString",
                       "Polygon", "MultiPolygon", "Box", "GeometryCollection"],
                      obj.type) == -1) {
                      // unsupported geometry type
                      OpenLayers.Console.error("Unsupported geometry type: " +
                                                obj.type);
                  } else {
                      valid = true;
                  }
                  break;
              case "FeatureCollection":
                  // allow for any type to be converted to a feature collection
                  valid = true;
                  break;
              default:
                  // for Feature types must match
                  if(obj.type == type) {
                      valid = true;
                  } else {
                      OpenLayers.Console.error("Cannot convert types from " +
                                                obj.type + " to " + type);
                  }
          }
          return valid;
      }
docs: Method: isValidType
  Check if a GeoJSON object is a valid representative of the given type.
  
  Returns:
  {Boolean} The object is valid GeoJSON object of the given type.