var tkFragmentBanners = {
  'internet.aerospace': { width: '740', height: '97', flash: false },
  'internet.ainp': { width: '740', height: '97', flash: true },
  'internet.cnb': { width: '740', height: '97', flash: true },
  'internet.kmm': { width: '740', height: '97', flash: true },
  'internet.mtkl': { width: '740', height: '97', flash: true },
  'internet.tkhg': { width: '740', height: '97', flash: true },
  'internet.tkmna': { width: '740', height: '180', flash: true },
  'internet.tkssd': { width: '740', height: '97', flash: true },
  'internet.tksst': { width: '740', height: '97', flash: true },
  'internet.tkxa': { width: '740', height: '97', flash: true },
  'internet.tkxl': { width: '740', height: '97', flash: true },
  'internet.tmxa': { width: '740', height: '97', flash: true },
  'intranet.sap': { width: '964', height: '97', flash: false },
  'intranet.tkhg': { width: '964', height: '97', flash: false }
};

var TkFragmentBanner = Class.create();
TkFragmentBanner.prototype = {
  initialize: function(container, id, assetPath, options) {
    this.container = container;
    this.id = id;
    this.assetPath = tkRootCMS + assetPath;
    this.options = {
      disableFlash: tkDisableFlash || false,
      image: null,
      imageLeft: null,
      imageRight: null,
      site: tkSite
    };
    Object.extend(this.options, options || {});
    if (this.options.image == '') {
      this.options.image = null;
    }
    if (this.options.imageLeft == '') {
      this.options.imageLeft = null;
    }
    if (this.options.imageRight == '') {
      this.options.imageRight = null;
    }
  },

  write: function() {
    var sectionBanner = (this.options.imageLeft != null && this.options.imageRight != null);
    var site = this.options.site;
    var banner = tkFragmentBanners[site];
    if (banner) {
      var width = banner.width;
      var height = banner.height;
      var list = [];
      list.push('<div id="' + this.id + '">');
      if (this.options.image != null) {
        list.push(    '<img style="border: none; width: ' + width + 'px;" src="' + tkRoot + this.options.image + '" alt="Banner" />');
      } else if (sectionBanner) {
        list.push(    '<img style="border: none; height: 97px; width: 182px;" src="' + tkRoot + this.options.imageLeft + '" alt="Banner" />');
        list.push(    '<img style="border: none; height: 97px; width: 558px;" src="' + tkRoot + this.options.imageRight + '" alt="Banner" />');
      } else {
        list.push(    '<img style="border: none; height: ' + height + 'px; width: ' + width + 'px;" src="' + this.assetPath + 'image/' + site + '.jpg" alt="Banner" />');
      }
      list.push('</div>');
      list.each(function(html) { document.write(html) });
      if (!sectionBanner && this.options.image == null && !this.options.disableFlash && banner.flash) {
        var fo = new FlashObject(this.assetPath + 'media/' + site + '.swf', this.id, width, height, '6');
        fo.write('tkFragmentBanner');
      }
    } else {
      Element.hide(this.container);
    }
  }
}
