var Basic = {

  name: "",
  content: "",

  initialize: function(maps, url, callback) {
    this.maps = maps;
    this.markers = [];
    this.polylines = [];

    $.getJSON(url, $.scope(this, function(data) {
      this._create(this.data = data);
      (callback || function() {}).apply(this);
    }));
  },

  _create: function() {},

  _events: function(markers, index, marker) { return $.scope(this, function(event) {
    var element = $(event.target);
    switch (element.attr("rel")) {
    case "zoom":
      this.setCenter(this.maps.getZoom() > 15 ? markers : (isNaN(index) ? [index] : [markers[index]]));
      break;
    case "more":
      this.maps.getInfoWindow().maximize();
      break;
    case "prev":
    case "next":
      var marker = {};
      var number = 1;
      while (!marker.window) marker = markers[index + number++ * (element.attr("rel") == "prev" ? -1 : 1)];
      this.maps.panTo(marker.getLatLng());
      google.maps.Event.trigger(marker, "click");
      break;
    }
    return false;
  });},

  getMarkers: function() {
    return this.markers;
  },

  getPolylines: function() {
    return this.polylines;
  },

  getOverlays: function() {
    return this.getMarkers().concat(this.getPolylines());
  },

  getAnchors: function() {
    return [];
  },

  setCenter: function(markers) {
    if (this.getMarkers().length == 0) return;
    var bounds = new google.maps.LatLngBounds();
    $.each(markers || this.getMarkers(), function(index, marker) {
      bounds.extend(marker.getLatLng());
    });
    this.maps.setCenter(bounds.getCenter(), this.maps.getBoundsZoomLevel(bounds));
    this.maps.getInfoWindow().hide();
  },

  show: function() {
    $.each(this.getOverlays(), function(index, overlay) { overlay.show(); });
  },

  hide: function() {
    $.each(this.getOverlays(), function(index, overlay) { overlay.hide(); });
  }

};