// JavaScript Document


/* bookit is called when the user clicks the bookmark button in site tools */
function bookit(linkUrl,linkTitle){
   if (!document.all) {
      alert('Please hit ctrl-d to bookmark this page');
   }
   else external.AddFavorite(linkUrl,linkTitle);
   return false;
}


cookie_name="mhtextsize"; 
font1="98%"; font2="126%"; font3="150%";

//putCookie adds the cookie that is used to store the text size settings
function putCookie() {
    if(document.cookie != document.cookie) {index = document.cookie.indexOf(cookie_name);} else { index = -1;}
    if (index == -1){
        document.cookie=cookie_name+"="+mysize+"; expires=Monday, 04-Apr-2010 05:00:00 GMT; path=/";
    } 
}

//    setRule is called to change the size of the font when the user clicks on the link in 
//    the site tools bar in the banner.
function setRule(stylesheet,rule,attribute,value){
    if (!document.styleSheets) return false;
    var lRules = new Array();

    if (document.styleSheets[stylesheet].cssRules) 
        lRules = document.styleSheets[stylesheet].cssRules
    else if (document.styleSheets[stylesheet].rules)
        lRules = document.styleSheets[stylesheet].rules
    else return false;

//    alert(lRules[1].style.fontSize);
     if (value==""){if (lRules[rule].style.fontSize==font1) {value=font2} else {value=font1}    }

    mysize=value; //alert('value is '+value)
    lSuccess = eval("lRules[" + rule + "].style." + attribute + " = value")
    putCookie();
    return lSuccess;
}

//    getCookie reads the cookie from the user and sets the font size accordingly.
function getCookie() {
    if(document.cookie) {
        index = document.cookie.indexOf(cookie_name);
        if (index != -1) {
            namestart = (document.cookie.indexOf("=", index) + 1);
            nameend = document.cookie.indexOf(";", index);
            if (nameend == -1) {nameend = document.cookie.length;}
            mysize = document.cookie.substring(namestart, nameend);
            setRule(0,0,'fontSize',mysize);
        }
    } //else {alert('no cookie')}
}


function MM_callJS(jsStr) { //v2.0
  return eval(jsStr)
}
