﻿// JScript File

/* 
    function addSize(add)
    increases the size of the document font by 'add', negative values make the 
    font smaller.
*/

function addSize(add)
{
    if(!document.layers)
    {
        doc = document.getElementsByTagName('*').item(0);
        size = parseInt(doc.style.fontSize)+add;
        doc.style.fontSize=size+'%';                        

        if(nosave==false)  
        {
            storeSize();
        }
    }
}
/* 
    function SetSize(add)
    sets the font size of the document.
*/
function setSize(add)
{
    if(!document.layers)
    {
        document.getElementsByTagName('*').item(0).style.fontSize=add+'%';
        if(nosave==false) 
        {                    
            storeSize();    
        }
    }
}

/* 
    function storeSize()
    saves the current settings of the document in a cookie
*/
function storeSize()
{
    var exp = new Date();
    exp.setTime(exp.getTime() + 24*60*60*90*1000);
    size=document.getElementsByTagName('*').item(0).style.fontSize;
    font=document.getElementsByTagName('*').item(0).style.fontFamily;
    setCookie('dynfontsize',size+':'+font,exp);
}
/* 
    function setCookie()
    sets the cookie
*/
function setCookie(name, value, expires, path, domain, secure) 
{ 
    var curCookie = name + '=' + escape(value) + 
    ((expires) ? '; expires=' + expires.toGMTString() : '') + 
    ((path) ? '; path=' + path : '') + 
    ((domain) ? '; domain=' + domain : '') + 
    ((secure) ? '; secure' : '') ;
    document.cookie = curCookie;
} 
/* 
    function getCookie()
    reads the cookie
*/
function getCookie(name) 
{ 
    var prefix = name + '=';
    var cookieStartIndex = document.cookie.indexOf(prefix) ;
    if(cookieStartIndex == -1) 
    {
        return null;
    }
    var cookieEndIndex = document.cookie.indexOf(';', cookieStartIndex + 
    prefix.length); 

    if(cookieEndIndex == -1) 
    {
        cookieEndIndex = document.cookie.length;
    }

    return unescape(document.cookie.substring(cookieStartIndex + 
    prefix.length, 
    cookieEndIndex)) ;
} 