function fontresizeStart() {
  StyleActivate( CookieGet('preferences_fontsize') );
}

function CookieGet( name ) {
  var name = name + "=";
  var cs = document.cookie.split(';');
  for (var i=0; i<cs.length; i++) {
    var c = cs[i];
    while (c.charAt(0)==' ') c = c.substring(1,c.length);
    if (c.indexOf(name) == 0) return c.substring(name.length,c.length);
  }
  return null;
}


function StyleActivate( value ) {
  if (value == '') { return; }
  var i, lnk;
  for( i = 0; (lnk = document.getElementsByTagName("link")[i]); i++ ) {
    if ( lnk.getAttribute('rel').indexOf('style') != -1 && lnk.getAttribute('title') ) {
      lnk.disabled = true;
      if ( lnk.getAttribute('title') == value ) {
          lnk.disabled = false;
        }
    }
  }
}

function CookieSet(name,value) {
  document.cookie=name + "=" + escape(value) +
    ";expires=Thu Feb 10 2028 12:00:00 GMT+0100;path=/;domain=" + document.domain;
}

function StyleActual( prefix ) {
  var i, lnk;
  for( i = 0; (lnk = document.getElementsByTagName("link")[i]); i++ ) {
    if ( lnk.getAttribute('rel').indexOf('style') != -1 &&
         lnk.getAttribute('title') &&
        !lnk.disabled ) {
        return lnk.getAttribute('title');
    }
  }
  return null;
}

function fontresizeEnd() {
  CookieSet( 'preferences_fontsize', StyleActual() );
}