var lastSelectedSize = 1;

var sizeOne = 90;
var sizeTwo = 98;
var sizeThree = 100;

var buttons = new Array('sizeButtonOne', 'sizeButtonTwo', 'sizeButtonThree');

function selectMe(objdiv){
  if (objdiv.className == 'buttonActive'){
    return;
  }
  else{
    for (i = 0; i < buttons.length; i++){
      document.getElementById(buttons[i]).className = 'button';
    }
    objdiv.className = 'buttonActive';
  }
}
function hoverMe(objdiv){
  if (objdiv.className == 'buttonActive'){
    return;
  }
  if (objdiv.className == 'buttonOver'){
    objdiv.className = 'button';
  }
  else{
    objdiv.className = 'buttonOver';
  }
}

/**
* Adds current page to favorites. Works only in IE4.x+. In other browser it
* does nothing.
*/
function addToFavorites(){
  if (window.external){
   window.external.AddFavorite(document.location.href, document.title);
  }
}


/**
* Changes the font size of the article body and lead text.
* @param intValue The percent to set the font size to.
*/
function changeSize(intSize){
    if(intSize == lastSelectedSize) {
        return;
    }

    //lead is +3 percent compared to body.
    setFontSize(".ArticleLead", (intSize + 5));
    setFontSize(".ArticleBody", intSize);
    lastSelectedSize = intSize;
}

/**
* Changes the font size of desired stylesheet rule.
* @param stringRuleName Name of the stylesheet rule.
* @param intNewSize New font size, in percent.
*/
function setFontSize(stringRuleName, intNewSize){
    var ruleToChange = getStyleRuleByName(stringRuleName);
    if (ruleToChange != null){
      ruleToChange.style.fontSize = intNewSize + "%";
    }
}

/**
* Get a stylesheet rule, for manipulation or whatever, by it's name.
* @param stringName Name of the stylesheet rule.
* @return The stylesheet rule with a matching name. Else null.
*/
function getStyleRuleByName(stringName){
	if (!document.styleSheets)
          return;

	var theRules = new Array();
        for (i = 0; i < document.styleSheets.length; i++){
                if (document.styleSheets[i].cssRules){
                        theRules = document.styleSheets[i].cssRules
                }
                else if (document.styleSheets[i].rules){
                        theRules = document.styleSheets[i].rules
                }
            for (j = 0; j < theRules.length; j++){
        	  if (theRules[j].selectorText.toLowerCase() == stringName.toLowerCase()){
                    return theRules[j];
        	  }
            }
        }
        return null;
}
/* $Id: articletoolbar.js,v 1.8 2005/02/15 09:01:35 henmat Exp $ */
