﻿function changeFontSize(pct){
	globalFontSize = parseInt(globalFontSize) + parseInt(pct);
	setFontSize(globalFontSize);
}
function setFontSize(pct){
	if( pct >= globalFontSizeMin && pct <= globalFontSizeMax ){
	var bod = document.getElementsByTagName('body')[0];
	bod.style.fontSize = pct+"%";
	globalFontSize = pct;
	WM_killCookie("fontSize","/",".uwhealth.org");
	//one year
	WM_setCookie("fontSize",pct,8760,"/",".uwhealth.org",false);
	}

}


var min = 8;
var max = 18;
function increaseFontSize() {
    var p = document.getElementsByTagName('p');
    for (i = 0; i < p.length; i++) {
        if (p[i].style.fontSize) {
            var s = parseInt(p[i].style.fontSize.replace("px", ""));
        } else {
            var s = 12;
        }
        if (s != max) {
            s += 1;
        }
        p[i].style.fontSize = s + "px"
    }
}
function decreaseFontSize() {
    var p = document.getElementsByTagName('p');
    for (i = 0; i < p.length; i++) {
        if (p[i].style.fontSize) {
            var s = parseInt(p[i].style.fontSize.replace("px", ""));
        } else {
            var s = 12;
        }
        if (s != min) {
            s -= 1;
        }
        p[i].style.fontSize = s + "px"
    }
}

function normalizeFontSize() {
    var p = document.getElementsByTagName('p');
    for (i = 0; i < p.length; i++) {
        if (p[i].style.fontSize) {
            var s = parseInt(p[i].style.fontSize.replace("px", ""));
        } else {
            var s = 12;
        }
        if (s != min) {
            s = 12;
        }
        else {
            s = 12;

        }
        p[i].style.fontSize = s + "px"
    }

}