if(Drupal.jsEnabled) {

Drupal.extend({
  fontsizeSetStyleSheet:
  function(title) {
    var path = 'head link[@rel="alternate stylesheet"][@title]';
    var count = $(path).size();
    for(var i=0; i < count; i++) {
      domObj = $(path).get(i);
      if($(path).eq(i).attr('title') == title) {
        domObj.disabled = false;
      } else {
        domObj.disabled = true;
      }
    }
    $.cookie('Drupal_fontsize', title, {expires: 7, path: '/'});
  }
});

$(document).ready(function() {
  switch($.cookie('Drupal_fontsize')) {
    case '0':
      Drupal.fontsizeSetStyleSheet('normal');
    break;
    case 'normal':
    case 'smaller':
    case 'larger':
      Drupal.fontsizeSetStyleSheet($.cookie('Drupal_fontsize'));
    break;
    default:
      $.cookie('Drupal_fontsize', 'normal', {expires: 7, path: '/'});
    break;
  }
  $('a.fontsize').removeAttr('href').click(function(){
    Drupal.fontsizeSetStyleSheet($(this).attr('title'));
  });
});

}