adsense map ad unit formats

Format the ad unit to be put on the map.

var adUnit;

var SAMPLE_AD_STYLES = {
  \'default\': {
    \'color_bg\': \'#c4d4f3\',
    \'color_border\': \'#e5ecf9\',
    \'color_link\': \'#0000cc\',
    \'color_text\': \'#000000\',
    \'color_url\': \'#009900\',
  },
  \'modern\': {
    \'color_bg\': \'#ffffff\',
    \'color_border\': \'#000000\',
    \'color_link\': \'#1155cc\',
    \'color_text\': \'#000000\',
    \'color_url\': \'#009900\',
  },
  \'plain\': {
    \'color_bg\': \'#f5f5f5\',
    \'color_border\': \'#cccccc\',
    \'color_link\': \'#1155cc\',
    \'color_text\': \'#333333\',
    \'color_url\': \'#009900\',
  },
  \'kennedy\': {
    \'color_bg\': \'#f1f1f1\',
    \'color_border\': \'#dd4b39\',
    \'color_link\': \'#4d90fe\',
    \'color_text\': \'#222222\',
    \'color_url\': \'#3d9400\',
  },
  \'flamingo\': {
    \'color_bg\': \'#feeeff\',
    \'color_border\': \'#d1d1ed\',
    \'color_link\': \'#5577ee\',
    \'color_text\': \'#000000\',
    \'color_url\': \'#44bbbb\',
  },
  \'monochrome\': {
    \'color_bg\': \'#eeeeee\',
    \'color_border\': \'#666666\',
    \'color_link\': \'#333333\',
    \'color_text\': \'#666666\',
    \'color_url\': \'#999999\',
  },
  \'barbecue\': {
    \'color_bg\': \'#666666\',
    \'color_border\': \'#555555\',
    \'color_link\': \'#ffcc00\',
    \'color_text\': \'#808080\',
    \'color_url\': \'#e8ab00\',
  },
  \'miami\': {
    \'color_bg\': \'#d6f8ff\',
    \'color_border\': \'#89d1ff\',
    \'color_link\': \'#3b8aeb\',
    \'color_text\': \'#333333\',
    \'color_url\': \'#53be05\',
  },
  \'shamrock\': {
    \'color_bg\': \'#f5ffe9\',
    \'color_border\': \'#449944\',
    \'color_link\': \'#009900\',
    \'color_text\': \'#596659\',
    \'color_url\': \'#779977\',
  }
};

function initialize() {
  var mapOptions = {
    center: new google.maps.LatLng(36.5987, -121.8950),
    zoom: 12,
    mapTypeId: google.maps.MapTypeId.ROADMAP
  };
  var map = new google.maps.Map(document.getElementById(\'map-canvas\'),
      mapOptions);

  var adUnitDiv = document.createElement(\'div\');
  var adUnitOptions = {
    format: google.maps.adsense.AdFormat.HALF_BANNER,
    position: google.maps.ControlPosition.TOP_CENTER,
    backgroundColor: \'#c4d4f3\',
    borderColor: \'#e5ecf9\',
    titleColor: \'#0000cc\',
    textColor: \'#000000\',
    urlColor: \'#009900\',
    publisherId: \'ca-google-maps_apidocs\',
    map: map,
    visible: true
  };
  var adUnit = new google.maps.adsense.AdUnit(adUnitDiv, adUnitOptions);

  var format = document.getElementById(\'format\');
  google.maps.event.addDomListener(format, \'change\', function() {
    adUnit.setFormat(google.maps.adsense.AdFormat[this.value]);
  });

  var style = document.getElementById(\'style\');
  google.maps.event.addDomListener(style, \'change\', function() {
    var adStyle = SAMPLE_AD_STYLES[this.value];
    adUnit.setBackgroundColor(adStyle[\'color_bg\']);
    adUnit.setBorderColor(adStyle[\'color_border\']);
    adUnit.setTitleColor(adStyle[\'color_link\']);
    adUnit.setTextColor(adStyle[\'color_text\']);
    adUnit.setUrlColor(adStyle[\'color_url\']);
  });

  var position = document.getElementById(\'position\');
  google.maps.event.addDomListener(position, \'change\', function() {
    adUnit.setPosition(google.maps.ControlPosition[this.value]);
  });
}

google.maps.event.addDomListener(window, \'load\', initialize);