var briQFrontend = new Class({
  headings: null,

  initialize: function ()
  {
    this.headings = new Hash({
      'h1': new Hash({
        'color': 'FFFFFF',
        'size':  '14'}),
      'h2': new Hash({
        'color': 'FFFFFF',
        'size':  '14'}),
      'h3': new Hash({
        'color': 'FFFFFF',
        'size':  '14'}),
      'h4': new Hash({
        'color': 'FFFFFF',
        'size':  '14'})
    });
    this.imageize();
  },

  imageize: function ()
  {
    $each( $$('h1','h2','h3','h4'), function( element ) {
      if( !element.hasClass('leaveMeAlone') ) {
        var plainText = element.get('text');
        if ( plainText.match('<img') ) return; // Allready imageText
        plainText = escape( plainText );
        if ( plainText.length == 0 ) return;
        element.set('html', '<img src="/service/html/Image/text/' + plainText + '/' + this.headings[element.get('tag')].size + '/2/0/' + this.headings[element.get('tag')].color + '/FFFFFF" alt="' + plainText.replace(/\%20/g, ' ') + '"/>');
      }
    }.bind(this));
  }
});
window.addEvent('domready', function(){ var briQfrontend = new briQFrontend() });

