// JavaScript Document
var base_presa=false;
var c=16;
var carat_dim=c;
function carat(t,b,d, m){
tt = new Array(5);//tipo tag elements da modificare dim carattere

tt[1]="h1";
tt[2]="h2";
tt[3]="h3";
tt[4]="h4";
tt[5]="p";
tt[6]="table";
tt[7]="td";
tt[8]="div";
tt[9]="li";


  if (m==1){base_presa=false;}
  if (!base_presa){carat_dim=b; base_presa=true;}
  
  
  
  
  
  if (d==0){
  carat_dim=carat_dim+1;
  }else
  {carat_dim=carat_dim-1;}
  if (t=='NE' || t=='ne'){//non č pasaato un tag alla funzione,tutti i tags verranno ridimensionati
        for (y=1;y<tt.length;y++){
          var tags = document.getElementsByTagName(tt[y]);
          
          for (ty=0;ty<tags.length;ty++){
          tagel=tags[ty];
          tagel.style.fontSize=carat_dim;
          } 
        }
  document.carattere.dimcarat.selectedIndex=carat_dim-10;
  carattere.dimensioni.value=carat_dim;; 
  
  }
  else
  {//un tag č stato passato alla funzione, č il solo che verrā ridimensionato
  var tags = document.getElementsByTagName(t);
  for (ty=0;ty<tags.length;ty++){
  tagel=tags[ty];
  tagel.style.fontSize=carat_dim;
  }
  document.carattere.dimcarat.selectedIndex=carat_dim-10;
  carattere.dimensioni.value=carat_dim;; 
  }

    
}



function ricevi_car(){

carat_dim=document.carattere.dimcarat.selectedIndex;

var c1=carat_dim-1;
c1=c1+12;
carat('td',c1,1,1);
carattere.dimensioni.value=carat_dim;
}

function ricevi_tipo_car(){

var cart=document.carattere.tipocarat.selectedIndex;
cart=cart+1;
tc = new Array(5);
tc[1]="Arial";
tc[2]="Verdana";
tc[3]="Courier New";
tc[4]="Lucida Console";
tc[5]="times New Roman";

var tags = document.getElementsByTagName('td')
for (var i=0;i<tags.length;i++){

var f=tags[i];

f.style.fontFamily=tc[cart];

}
//td.style.fontFamily=tc[cart];


}

function input_text(){
var c1=carattere.dimensioni.value;
carat('td',c1,1,1);
document.carattere.dimcarat.selectedIndex=c1-10;
}
