﻿//addLoadEvent(articlePageOnload);

function articlePageOnload() {
    if (document.getElementById && document.getElementById("CurrentSize") != null) {
        if (document.getElementById("CurrentSize").value == "")
            resetCurrentsize();
        else
            setCurrentsize(document.getElementById("CurrentSize").value);

        /*document.getElementById("textSizer").style.cssText = "display: block; float: right;";*/
    }
}

function getCurrentsize() {
    return currentSize;
}

function setCurrentsize(newsize) {
    currentSize = newsize;
    if (document.getElementById) {
        document.getElementById("resizeableText").style.cssText = "font-size:" + currentSize + "pt";
        /*document.getElementById("textSizer").style.cssText = "display: block;";*/
    }
}

function resetCurrentsize() {
    currentSize = 10;
    if (typeof (preDefaultSize) != "undefined") {
        currentSize = preDefaultSize;
    }
    document.getElementById("CurrentSize").value = currentSize;
    if (document.getElementById) {
        document.getElementById("resizeableText").style.cssText = "font-size:" + currentSize + "pt";
    }
}

function sizeUp() {
    articlePageOnload();
    if (document.getElementById) {
        if (currentSize <= 13) {
            currentSize++;
            document.getElementById("CurrentSize").value = currentSize;
            document.getElementById("resizeableText").style.cssText = "font-size:" + currentSize + "pt";
        }
    }
}


function sizeDown() {
    articlePageOnload();
    if (document.getElementById) {
        if (currentSize >= 10) {
            currentSize--;
            document.getElementById("CurrentSize").value = currentSize;
            document.getElementById("resizeableText").style.cssText = "font-size:" + currentSize + "pt";
        }
    }
}

function commonPopup(url, width, height, toolsInd, wname) {
    var options = "width=" + width + ",height=" + height + ",top=" + ((screen.height - height) / 4).toString() + ",left=" + ((screen.width - width) / 2).toString();

    switch (toolsInd) {
        case 1:
            options += ",toolbar=no,status=no,resizable=no,scrollbars=yes";
            break;
        case 2:
            options += ",menubar=yes,toolbar=yes,status=yes,resizable=yes,location=yes,scrollbars=yes";
            break;
        case 3:
            options += ",top=50,left=50,resizable=yes,scrollbars=yes,status=no,menubar=no,toolbar=no,location=yes";
            break;
        case 4:
            options += ",top=50,left=50,resizable=yes,scrollbars=no,status=no,menubar=no,toolbar=no,location=yes";
            break;
        default:
            //do nothing
            break;
    }

    if (!wname) {
        wname = "macroplanPopup";
    }

    popupWindow = window.open(url, wname, options);

    if (popupWindow) {
        popupWindow.focus();
    }
}


