// Copyright 2009 Google Inc.  All Rights Reserved.

/**
 * @fileoverview Namespace for Google Earth Outreach website.
 * @author Michal Drewniak
 */

/**
 * Namespace for Google Earth website.
 * @type {Object}
 */
earth.outreach = {};


/**
 * Trims leading and trailing spaces around a string.
 * @return {string} String without leading and trailing spaces.
 */
String.prototype.trim = function() {
  return this.replace(/^\s*|\s*$/, '');
};

earth.outreach.setUp = function() {
  var pageId = earth.getPageId();
  earth.dropdown = new goog.web.LangDropdown();
  earth.globals.locale = earth.getLocale();

  switch (pageId) {
    case 'outreach/':
      earth.outreach.hppromo =
          new earth.HomepagePromo('rw1WNpbJlHGXKiUxUO5ExbQ/od6');
      earth.outreach.hp = new earth.outreach.GeoHomepage();
      break;
    case 'outreach/index.html':
      earth.outreach.hppromo =
          new earth.HomepagePromo('rw1WNpbJlHGXKiUxUO5ExbQ/od6');
      earth.outreach.hp = new earth.outreach.GeoHomepage();
      break;
    case 'outreach/developers.html':
      earth.outreach.developers = new earth.outreach.Developers();
      break;
    case 'outreach/showcase.html':
      earth.earthapi = new earth.EarthAPI();
      earth.outreach.showcase = new earth.outreach.Showcase();
      break;
    case 'outreach/tour_maps1.html':
      earth.outreach.slideshow = new earth.outreach.Slideshow();
      break;
    case 'outreach/tour.html':
      resize();
      break;
  }
};

function changeLanguage(dropdown) {
  if (earth.dropdown) {
    earth.dropdown.changeLanguage(dropdown);
  }
}
