// JavaScript Document

elementi = Array('td', 'div', 'span', 'p', 'a', 'li');


function piugrande() {
  document.cookie = "fontsize=grande";
  for(el in elementi) {
    a_el = document.getElementsByTagName(elementi[el]);
    for(i = 0; i <= a_el.length - 1; i++) {
      if(a_el[i].className != "") {
        if(a_el[i].className.substring(a_el[i].className.length - 4, a_el[i].className.length) == "Gran" || a_el[i].className.substring(a_el[i].className.length - 4, a_el[i].className.length) == "Picc") {
          a_el[i].className = a_el[i].className.substring(0, a_el[i].className.length - 4) + "Gran";
        } else {
          a_el[i].className = a_el[i].className + "Gran";
        }
      }
    }
  }
}

function piupiccolo() {
  document.cookie = "fontsize=piccolo";
  for(el in elementi) {
    a_el = document.getElementsByTagName(elementi[el]);
    for(i = 0; i <= a_el.length - 1; i++) {
      if(a_el[i].className != "")
        if(a_el[i].className.substring(a_el[i].className.length - 4, a_el[i].className.length) == "Gran" || a_el[i].className.substring(a_el[i].className.length - 4, a_el[i].className.length) == "Picc") {
          a_el[i].className = a_el[i].className.substring(0, a_el[i].className.length - 4) + "Picc";
        } else {
          a_el[i].className = a_el[i].className + "Picc";
        }
    }
  }
}


////////////////////////////////////////////////////////////////////////////////////

function setFontSize(value) {
   var nor = null;
   var pic = null;


    if(value=='small'){
    pic = '9';
	nor = '11';
	}else{
    pic = '11';
	nor = '14';
	}
	
	var table = document.getElementById("table_content");
	
	for(i=0; i<table.getElementsByTagName('td').length; i++){
	    var class_name = table.getElementsByTagName('td')[i].className;
		var td = table.getElementsByTagName('td')[i];
		if((class_name !="") && (td.className=="testo_piccolo_grigio")){
		td.style.fontSize = pic + 'px';
		}
		if((class_name !="") && (td.className=="testo_normale_grigio")){
		td.style.fontSize = nor + 'px';
		}
	}


}