﻿var min=13;
var max=24;
var ctlList=new Array("div","td","span","p","a","font","strong");
function $S(ele,name) 
{
    var style = ele.currentStyle?ele.currentStyle:document.defaultView.getComputedStyle(ele,null);
    return style[name];
}

function increaseFontSize(tagName) 
{
   var p = document.getElementsByTagName(tagName);
   for(i=0;i<p.length;i++) 
   {
      var temp = $S(p[i], "fontSize");
      if(temp && temp != '' && temp.length > 0) 
      {
         var s = parseInt(temp.replace("px",""));
         if(s<max) 
            s += 1;       
         if( s > 0 )
            p[i].style.fontSize = s+"px";
      } 
   }
}

function increaseFontSizeForFrame(tagName, frameName) 
{
   var p = window.frames[frameName].document.getElementsByTagName(tagName);

   for(i=0;i<p.length;i++) 
   {
      var temp = $S(p[i], "fontSize");
      if(temp && temp != '' && temp.length > 0) 
      {
         var s = parseInt(temp.replace("px",""));
         if(s<max) 
            s += 1;       
         if( s > 0 )
            p[i].style.fontSize = s+"px";
      } 
   }
}

function decreaseFontSize(tagName) 
{
   var p = document.getElementsByTagName(tagName);
   for(i=0;i<p.length;i++) 
   {
      var temp = $S(p[i], "fontSize");
      if(temp && temp != '' && temp.length > 0) 
      {
         var s = parseInt(temp.replace("px",""));
         if(s>min) 
            s -= 1;
         if( s > 0 )
            p[i].style.fontSize = s+"px"   
      } 
   }   
}

function decreaseFontSizeForFrame(tagName, frameName)
{
   var p = window.frames[frameName].document.getElementsByTagName(tagName);
   for(i=0;i<p.length;i++) 
   {
      var temp = $S(p[i], "fontSize");
      if(temp && temp != '' && temp.length > 0) 
      {
         var s = parseInt(temp.replace("px",""));
         if(s>min) 
            s -= 1;
         if( s > 0 )
            p[i].style.fontSize = s+"px"   
      } 
   }   
}

function DecreaseSize()
{
    for (x in ctlList)
    {
        decreaseFontSize(ctlList[x])
    }
}

function IncreaseSize()
{
    for (x in ctlList)
    {
        increaseFontSize(ctlList[x])
    }
}

function DecreaseSizeForFrame(frameName)
{
    for (x in ctlList)
    {
        decreaseFontSizeForFrame(ctlList[x], frameName)
    }
}

function IncreaseSizeForFrame(frameName)
{
    for (x in ctlList)
    {
        increaseFontSizeForFrame(ctlList[x], frameName)
    }
}