/* MAPS
------------------------------------------------------------------ */
var Map = {
  
  load_map: function(latitude, longitude, target) {
    if (GBrowserIsCompatible()) {
      this.latlong = new GLatLng(latitude, longitude);
      this.map = new GMap2(document.getElementById(target));
      this.map.removeMapType(G_SATELLITE_MAP);
      this.map.addControl(new GSmallZoomControl());
      this.map.addControl(new GMapTypeControl());
      this.map.setCenter(this.latlong, 15);
      this.map.addOverlay(new GMarker(this.latlong));
      $('.content_map > .enlarge').click(this.handle_enlarge);
    }
  },
  
  handle_enlarge: function(e) {
    e.preventDefault();
    if ($('.content_map').height() < 200) {
      $('a', this).text('Shrink map');
      $('#event_place_map').animate({height:400}, 500, this.re_center_map);
    }
    else {
      $('a', this).text('Enlarge map');
      $('#event_place_map').animate({height:150}, 500, this.re_center_map);
    }
  },
  
  re_center_map: function(e) {
    this.map.checkResize();
    this.map.panTo(this.latlong);
  }
}


/* ON LOAD
------------------------------------------------------------------ */
$(function() {
  avatar_init();
  daypart_init();
  module_init();
  nav_init();
  popup_init();
  share_init();
  sidebar_calendar_init();
  video_player_init();
  search_init();
  tabbed_content_init();
  
  $('#nav > ul').menu();
  
  $('.carousel_show_one').carousel({show: 1, showPageControls:true});
  $('.carousel_show_two').carousel({show: 2, showPageControls:true});
  
  $('.content_search').bind('submit', function(e) {
    $('button', this).addClass('submitted');
  });
});