﻿var min=10;
var max=24;
var ctlList=new Array("div","td","span","p","a","font","strong","input");
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++) 
   {
      if((p[i].id.indexOf('ctlHeader') > -1) || (p[i].id.indexOf('ctlPgSz') > -1))
      {    
        
      } 
      else
      {
      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++) 
   {
   if((p[i].id.indexOf('ctlHeader') > -1) || (p[i].id.indexOf('ctlPgSz') > -1))
      {    
      
      } 
      else
      {
          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)
    }
}
