// Enlarge/Shrink font-sizes script  ** version 1.2 **
var fontSizes = new Array ( 68.75, 75, 87.5, 100, 118.75, 143.75, 168.75 ); // Percent values intended only for IE/Win browsers
var currentFontSize = 1; // ~ 12px

function enlargeFont() { resizeFont(1); return; }
function shrinkFont() { resizeFont(-1); return; }

function resizeFont(delta)
{
  var newSize = currentFontSize + delta;
  if ((newSize < 0) || (newSize >= fontSizes.length)) { newSize = currentFontSize; }
  setCookie("fontSize", newSize, "/");
  setFontSize();
  return;
}

function setFontSize()
{
  currentFontSize = getFontCookie();
  var pixelSize = (fontSizes[currentFontSize]/100) * 16;
  if ( (pixelSize - parseInt(pixelSize)) >= .5 ) { pixelSize++ }
  document.body.style.fontSize = (is_ie && !is_mac) ? fontSizes[currentFontSize] + "%" : pixelSize + "px";
}


function getFontCookie() {
  if (getCookieValue("fontSize"))
  {
    var cookieFontSize = parseInt( getCookieValue("fontSize") );
    if (cookieFontSize != "NaN")
    {
      cookieFontSize = (cookieFontSize > 10) ? currentFontSize : (cookieFontSize > fontSizes.length) ? fontSizes.length : cookieFontSize;
      return cookieFontSize;
    }
  }
  return currentFontSize;
}


// -----------------------------------------------------------------

function setCSS(theURL)
{
  cssSwitch(theURL)
  setCookie("CSSfile", theURL, "/");
}


function cssSwitch(theURL)
{
  if (document.getElementsByTagName && theURL && (theURL != ""))
  {
    var cssLinks = getCssLinks();
    for (var i = 0; i < cssLinks.length; i++)
    {
      var link = cssLinks[i];
      if ( (link.rel != null) && (link.rel.indexOf("stylesheet") > -1) && ( (link.media.indexOf("screen") > -1) || (link.media == null) ) )
      {
        link.disabled = true;
        if (stripHref(link.href) == stripHref(theURL))
        {
          link.disabled = false;
        }
       }
    }
  }
  return false;
};


function getCssLinks(theMedia)
{
  if (document.getElementsByTagName)
  {
    if (theMedia == null) { theMedia = "screen"; }
    var theLinks = new Array();

    var allLinks = document.getElementsByTagName("link");
    for (var i = 0; i < allLinks.length; i++)
    {
      var link = allLinks[i];
      if ( (link.rel != null) && (link.rel.indexOf("stylesheet") > -1) && ( (link.media.indexOf(theMedia) > -1) || (link.media == null) ) )
      {
        theLinks[theLinks.length] = link;
      }
    }
    return theLinks;
  }
  return null;
}




// Depends on utils_1.0.js