﻿function setFontCookie(name, value) {
    var curCookie = name + "=" + escape(value) + "; expires=Wed, 07-Jun-2023 11:07:25 GMT; path=/; domain=netmester.dk";
    document.cookie = curCookie;
}

function getCookie(name) {
    var dc = document.cookie;
    var prefix = name + "=";
    var begin = dc.indexOf("; " + prefix);
    if (begin == -1) {
	    begin = dc.indexOf(prefix);
	    if (begin != 0) return null;
    } else
	    begin += 2;
    var end = document.cookie.indexOf(";", begin);
    if (end == -1)
	    end = dc.length;
    return unescape(dc.substring(begin + prefix.length, end));
    }

function changeButtonCss(size)
{
	if (document.getElementById('textsize100')) 
	{
		document.getElementById('textsize100').className = (size==100) ? "pagefunctionon" : "pagefunction";
		document.getElementById('sizedownicon').className = (size==100) ? "documentfunctionsizeiconon" : "documentfunctionsizeicon";
	}
	
	if (document.getElementById('textsize120')) 
	{
		document.getElementById('textsize120').className = (size==120) ? "pagefunctionon" : "pagefunction";
		document.getElementById('sizeupicon').className = (size==120) ? "documentfunctionsizeiconon" : "documentfunctionsizeicon";
	}
}

function changeFontSize (fontsize) {
	setFontCookie('fontsize',fontsize);
	if (document.getElementById('dynamiccontent'))
		document.getElementById('dynamiccontent').style.fontSize = fontsize + '%';
	changeButtonCss(fontsize);
}

if (getCookie('fontsize') == null)
{
    var fontsize = 100;
    changeButtonCss(fontsize);
}
else
{
    var fontsize = getCookie('fontsize');
    changeButtonCss(fontsize);
}

document.write('<style type="text/css">');
document.write('#dynamiccontent {font-size:'+fontsize+'%;}');
document.write('<\/style>');