function mediumFontSize() {
    var titleOfActiveStyle = getActiveStyleSheet("fontsize");
    setActiveStyleSheet("Size:8pt", "fontsize");
}
function decreaseFontSize() {
    var titleOfActiveStyle = getActiveStyleSheet("fontsize");
    if (titleOfActiveStyle == null)
        titleOfActiveStyle = "Size:8pt";
    if (titleOfActiveStyle == "Size:9pt")
        setActiveStyleSheet("Size:8pt", "fontsize");
    
}
function increaseFontSize() {
    var titleOfActiveStyle = getActiveStyleSheet("fontsize");
    if (titleOfActiveStyle == null)
        titleOfActiveStyle = "Size:8pt";
    if (titleOfActiveStyle == "Size:8pt")
        setActiveStyleSheet("Size:9pt", "fontsize");
}
function setActiveStyleSheet(title, type) {
    var i, a, main;
    for (i = 0; (a = document.getElementsByTagName("link")[i]); i++) {
        if (a.getAttribute("rel").indexOf("style") != -1 && a.getAttribute("title") && isStyleSheetType(a.getAttribute("title"), type)) {
            a.disabled = true;
            if (a.getAttribute("title") == title) a.disabled = false;
        }
    }
}
function isStyleSheetType(str, type) {
    if (str == "") { return true; }
    else if (type == "fontsize" && str.match(/^Size/)) { return true; }
    else if (type == "weight" && str.match(/\Font/)) { return true; }
    else if (type == "contrast" && str.match(/^Back/)) { return true; }
    return false;
}
function getActiveStyleSheet(type) {
    var i, a;
    for (i = 0; (a = document.getElementsByTagName("link")[i]); i++) {
        if (a.getAttribute("rel").indexOf("style") != -1 && a.getAttribute("title") && isStyleSheetType(a.getAttribute("title"), type) && !a.disabled) return a.getAttribute("title");
    }
    return null;
}
function getPreferredStyleSheet() {
    var i, a;
    for (i = 0; (a = document.getElementsByTagName("link")[i]); i++) {
        if (a.getAttribute("rel").indexOf("style") != -1
&& a.getAttribute("rel").indexOf("alt") == -1
&& a.getAttribute("title")
) return a.getAttribute("title");
    }
    return null;
} 
