var defaultsize = 15;

var min = new Array();
var max = new Array();

min['p']=13;
min['h1']=32;
min['h2']=26;
min['h3']=20;
min['ul']=13;

max['p']=21;
max['h1']=40;
max['h2']=34;
max['h3']=28;
max['ul']=19;

function increaseFontSize() {

   var p = document.getElementsByTagName('p');
   for(i=0;i<p.length;i++) {
      if(p[i].style.fontSize) {
         var s = parseInt(p[i].style.fontSize.replace("px",""));
      } else {
         var s = 17;
      }
      if(s<max['p']) {
         s += 2;
      }
      p[i].style.fontSize = s+"px"
   }
   
   var h1 = document.getElementsByTagName('h1');
   for(i=0;i<h1.length;i++) {
      if(h1[i].style.fontSize) {
         var s = parseInt(h1[i].style.fontSize.replace("px",""));
      } else {
         var s = 36;
      }
      if(s<max['h1']) {
         s += 2;
      }
      h1[i].style.fontSize = s+"px"
   }   
   
   var h2 = document.getElementsByTagName('h2');
   for(i=0;i<h2.length;i++) {
      if(h2[i].style.fontSize) {
         var s = parseInt(h2[i].style.fontSize.replace("px",""));
      } else {
         var s = 30;
      }
      if(s<max['h2']) {
         s += 2;
      }
      h2[i].style.fontSize = s+"px"
   }   
   
   var h3 = document.getElementsByTagName('h3');
   for(i=0;i<h3.length;i++) {
      if(h3[i].style.fontSize) {
         var s = parseInt(h3[i].style.fontSize.replace("px",""));
      } else {
         var s = 24;
      }
      if(s<max['h3']) {
         s += 2;
      }
      h3[i].style.fontSize = s+"px"
   }   

   var ul = document.getElementsByTagName('ul');
   for(i=0;i<ul.length;i++) {
      if(ul[i].style.fontSize) {
         var s = parseInt(ul[i].style.fontSize.replace("px",""));
      } else {
         var s = 17;
      }
      if(s<max['ul']) {
         s += 2;
      }
      ul[i].style.fontSize = s+"px"
   }   
}


function decreaseFontSize() {
	
   var p = document.getElementsByTagName('p');
   for(i=0;i<p.length;i++) {
      if(p[i].style.fontSize) {
         var s = parseInt(p[i].style.fontSize.replace("px",""));
      } else {
         var s = 17;
      }
      if(s!=min['p']) {
         s -= 2;
      }
      p[i].style.fontSize = s+"px"
   }
   
   var h1 = document.getElementsByTagName('h1');
   for(i=0;i<h1.length;i++) {
      if(h1[i].style.fontSize) {
         var s = parseInt(h1[i].style.fontSize.replace("px",""));
      } else {
         var s = 36;
      }
      if(s>min['h1']) {
         s -= 2;
      }
      h1[i].style.fontSize = s+"px"
   }   
   
   var h2 = document.getElementsByTagName('h2');
   for(i=0;i<h2.length;i++) {
      if(h2[i].style.fontSize) {
         var s = parseInt(h2[i].style.fontSize.replace("px",""));
      } else {
         var s = 30;
      }
      if(s>min['h2']) {
         s -= 2;
      }
      h2[i].style.fontSize = s+"px"
   } 
   
   var h3 = document.getElementsByTagName('h3');
   for(i=0;i<h3.length;i++) {
      if(h3[i].style.fontSize) {
         var s = parseInt(h3[i].style.fontSize.replace("px",""));
      } else {
         var s = 24;
      }
      if(s>min['h3']) {
         s -= 2;
      }
      h3[i].style.fontSize = s+"px"
   }   
    
   var ul = document.getElementsByTagName('ul');
   for(i=0;i<ul.length;i++) {
      if(ul[i].style.fontSize) {
         var s = parseInt(ul[i].style.fontSize.replace("px",""));
      } else {
         var s = 17;
      }
      if(s>min['ul']) {
         s -= 2;
      }
      ul[i].style.fontSize = s+"px"
   }        
}
