﻿function getCookie(name)
{
    var cname = name + "=";
    var dc = document.cookie;
    if (dc.length > 0)
    {
        begin = dc.indexOf(cname);
        if (begin != -1)
        {
            begin += cname.length;end = dc.indexOf(";", begin);
            if (end == -1) end = dc.length;
            return unescape(dc.substring(begin, end));
    }   }
    return null;
}

function setCookie(name, value, expires, path, domain, secure)
{
    document.cookie = name + "=" + escape(value) +((expires == null) ? "" : "; expires=" + expires.toGMTString()) +((path == null) ? "" : "; path=" + path) +((domain == null) ? "" : "; domain=" + domain) +((secure == null) ? "" : "; secure");
}

function delCookie (name,path,domain)
{
    if (getCookie(name)) 
    {
        document.cookie = name + "=" +((path == null) ? "" : "; path=" + path) +((domain == null) ? "" : "; domain=" + domain) +"; expires=Thu, 01-Jan-70 00:00:01 GMT";
    }
}

var firstCall = true;
function changeFontsize(fSize, increment)
{
    if (firstCall)
    {
        firstCall = false;if (increment != "")changeFontsize('11', '');
    }
    if (document.getElementsByTagName)
    {
        tags = new Array ( "p", "li", "h2", "h3", "h4", "h5", "h6", "td", "input", "select", "textarea" );
        for (j=0; j<tags.length; j++)
        {
            var getElement = document.getElementsByTagName(tags[j]);
            var eachElement, currentFontSize, fontIncrease, newFontSize;
            for (i=0; i<getElement.length; i++)
            {
                eachElement = getElement[i];
                if (increment != "")
                {
                    currentFontSize = parseInt(eachElement.style.fontSize);
                    fontIncrease = parseInt(increment);
                    newFontSize = currentFontSize + fontIncrease;
                }
                else if (fSize != "")newFontSize = parseInt(fSize);
                if (tags[j] == "li")eachElement.style.lineHeight = Math.round(newFontSize*1.2) + "px";
                else eachElement.style.lineHeight = Math.round(newFontSize*1.5) + "px";
                if (fSize != "")
                {
                    switch(tags[j])
                    {
                        case "h2": newFontSize += 3;
                        break;
                        case "h3": newFontSize += 2;
                        break;
                        case "h4": newFontSize += 1;
                        break;
                        case "h5": newFontSize += 1;
                        break;
                        case "h6": newFontSize += 1;
                }   }
            eachElement.style.fontSize = newFontSize + "px";
            setCookie('fontSize', newFontSize);
}   }   }   }

function HideIt(objNameStr, documentObj)
{
    if (documentObj)
    {
        if (typeof documentObj == "object")
        {
            documentObj.getElementById(objNameStr).style.display = "none";
    }   }
    else
    {
        if (document.getElementById(objNameStr))
        {
            document.getElementById(objNameStr).style.display = "none";
}   }   }

function ShowIt(objNameStr, documentObj)
{
    if (documentObj)
    {
        if (typeof documentObj == "object")
        {
            documentObj.getElementById(objNameStr).style.display = "block";
    }   }
    else
    {
        if (document.getElementById(objNameStr))
        {
            document.getElementById(objNameStr).style.display = "block";
}   }   }

function fnSubmit(ctlHide, ctlShow)
{
    HideIt(ctlHide);ShowIt(ctlShow)
}