﻿/* Style Switcher. fonte http://www.stichpunkt.de/css/switch.html
 rispetto allo script originale, sono stati solo cambiati i nomi delle variabili
 che erano in tedesco, e aggiunta una istruzione fondamentale per il corretto
 funzionamento. */

/*---------------------------------------------------------------------
                        dimensionetesto
---------------------------------------------------------------------*/

window.onerror = HandleError;function HandleError() {return true}

function dimensionetesto(misura) {
if (!document.getElementsByTagName) {return}
var standard = "xs";
var misure_ = {
  "xs": "0.8em",
  "s": "1.1em",
  "m": "1.3em"
};
if (!misura) {
  var cookie = getCookie("dimensionetesto");
  misura = cookie ? cookie : standard;
}
document.getElementsByTagName('html')[0].style.fontSize = misure_[misura];
setCookie("dimensionetesto", misura, 365);
  for(i=0; (a = document.getElementsByTagName('link')[i]); i++) {
    if(a.getAttribute('rel').indexOf('style') != -1 && a.getAttribute('title')) {
      if(a.getAttribute('title') == "default") a.disabled = true;
        if(a.getAttribute('title') == "default") a.disabled = false;
    }
  } 
}

window.onload = function(e) {
  dimensionetesto();
  loadStyle()
}
dimensionetesto();
loadStyle()