//
// Rutina per ajustar tamany de lletra segons vulgui l'usuari
//
// Deseu aquest script al directori principal del lloc web i afegiu:
//
//   <SCRIPT SRC="/fsize.js" TYPE="text/javascript"></SCRIPT>
//
// on vulgueu que apareguin les opcions de tamany de lletra.
//
  var difSize=0;
  function fSize(INC) {
    if (INC==0) {
      INC=-difSize;
    }
    //
    // aplica canvi a tots els estils
    //
    for (var I=0; I<document.styleSheets.length; I++){
      var ESTIL;
      if (document.styleSheets[I].cssRules) {
        //
        // nScape
        //
        ESTIL=document.styleSheets[I].cssRules;
      } else {
        //
        // iExplorer
        //
        ESTIL=document.styleSheets[I].rules;
      }
      //
      // verifica que no hi hagi valors zero o negatius
      //
      var VERR=false;
      if (INC<0) {
        for (var J=0; J<ESTIL.length; J++) {
          if (ESTIL[J].style.fontSize) {
            if (parseFloat(ESTIL[J].style.fontSize)+INC<1) {
              VERR=true; break;
            }
          }
        }
      }
      //
      // canvia valors tamany de lletra si no hi ha negatius
      //
      if (!VERR) {
        for (var J=0; J<ESTIL.length; J++) {
          if (ESTIL[J].style.fontSize) {
            ESTIL[J].style.fontSize=parseFloat(ESTIL[J].style.fontSize)+INC+'pt';
          }
        }
        //
        // desa diferencial tamany lletra a cookies (res si lletra normal)
        //
        if (INC) {
          difSize+=INC;
        }
        var FAN;
        if (difSize) {
          FAN="Tue, 31-Dec-69 23:59:59 GMT";
        } else {
          FAN="Tue, 01-Jan-80 00:00:00 GMT";
        }
        document.cookie="fSize="+difSize+"; expires="+FAN+"; path=/";
      }
    }
    return false;
  }
  //
  // recupera tamany seleccionat a cookies
  //
  var X=document.cookie.split(";"),Y;
  for (var I=0; I<X.length; I++) {
    Y=X[I].split("=",2);
    while (Y[0].charAt(0)==" ") {
      Y[0]=Y[0].substr(1,Y[0].length);
    }
    if (Y[0]=="fSize") {
      fSize(Y[1]*1); break;
    }
  }
  X=null; Y=null;
  document.write("<TABLE STYLE=\"border-collapse: collapse; margin: 0;\">");
  document.write("<CAPTION STYLE=\"text-align: center; width: 90px; font-size: 10pt; background: #ffffff; color: #000000;\">");
  document.write("<ACRONYM TITLE=\"ACCESSIBILITAT\">");
  document.write("ACCESSIBILITAT");
  document.write("</ACRONYM>");
  document.write("</CAPTION><TR>");
  document.write("<TD STYLE=\"border: solid 3px black; text-align: center; vertical-align: middle; width: 30px; font-size:  6pt; background: #ffffff;\"><A STYLE=\"width: 100%; text-decoration: none; color: #000000; background: #ffffff;\" HREF=\"\" ONCLICK=\"javascript:fSize(-1);return false;\" ALT=\"REDUIR TAMANY LLETRA\"   >-A</A></TD>");
  document.write("<TD STYLE=\"border: solid 3px black; text-align: center; vertical-align: middle; width: 30px; font-size: 10pt; background: #ffffff;\"><A STYLE=\"width: 100%; text-decoration: none; color: #000000; background: #ffffff;\" HREF=\"\" ONCLICK=\"javascript:fSize( 0);return false;\" ALT=\"TAMANY LLETRA ORIGINAL\" >.A</A></TD>");
  document.write("<TD STYLE=\"border: solid 3px black; text-align: center; vertical-align: middle; width: 30px; font-size: 14pt; background: #ffffff;\"><A STYLE=\"width: 100%; text-decoration: none; color: #000000; background: #ffffff;\" HREF=\"\" ONCLICK=\"javascript:fSize(+1);return false;\" ALT=\"AUGMENTAR TAMANY LLETRA\">+A</A></TD>");
  document.write("</TR></TABLE>");
