FontResize = Class.create();
FontResize.prototype = {

fsize: {
  'small':  {'id': 'font-small',  'size': '64.75%'},
  'normal': {'id': 'font-normal', 'size': '74.75%'},
  'large':  {'id': 'font-large',  'size': '84.25%'}
},                                        

initialize: function(option, table) {
  this.props = { target: 'content', expire: 0 };
  if(option) for(var key in option) this.props[key] = option[key];
  this.cookiemgr = 
    new CookieManager({expire: this.props.expire});
  this.currentFontSize = 'normal';

  if (table) this.fsize = table;
  for (key in this.fsize)
    $(this.fsize[key]['id']).observe(
      'click', function(k){this.resizeFont(k);}.bind(this,key)
    ).addClassName('normal').style['cursor'] = 'pointer';
  var cookieValue = this.cookiemgr.getCookie("currentFontSize");
  if (cookieValue) this.currentFontSize = cookieValue;
  this.resizeFont(this.currentFontSize);
},

resizeFont: function(size) {
  for (key in this.fsize)
    $(this.fsize[key]['id']).removeClassName('select');
  var obj = this.fsize[size];
  $(this.props.target).style.fontSize = obj['size'];
  $(obj['id']).addClassName('select');
  this.cookiemgr.setCookie("currentFontSize", size);
}
}//prototype

