﻿var min=8;
var max=18;
function increaseFontSize() {
    increaseTag('p');
    increaseTag('h1');
    increaseTag('h2');
}
function decreaseFontSize() {
    decreaseTag('p');
    decreaseTag('h1');
    decreaseTag('h2');
}

function increaseTag(tag) {
  var p = document.getElementsByTagName(tag);
   for(i=0;i<p.length;i++) {
      if(p[i].style.fontSize) {
         var s = parseInt(p[i].style.fontSize.replace("px",""));
      } else {
         var s = 12;
         if(tag=='h1') {
            s = 22;
         }
         if(tag=='h2') {
            s = 18;
         }
      }
      if(s!=max) {
         s += 1;
      }
      p[i].style.fontSize = s+"px"
   }
}
function decreaseTag(tag) {
   var p = document.getElementsByTagName(tag);
   for(i=0;i<p.length;i++) {
      if(p[i].style.fontSize) {
         var s = parseInt(p[i].style.fontSize.replace("px",""));
      } else {
         var s = 12;
         if(tag=='h1') {
            s = 22;
         }
         if(tag=='h2') {
            s = 18;
         }
      }
      if(s!=min) {
         s -= 1;
      }
      p[i].style.fontSize = s+"px"
   }   
}