﻿var min = 10;
var max = 16;
var curFontSize = 0;
var stepFont = 1;

function increaseFontSize() {
    if (curFontSize > 0) return;
    curFontSize++;
    var p;    
    p = document.getElementsByTagName('span');
    increaseObjSize(p, 'aplus', 10);
    increaseObjSize(p, 'aplustext', 18);
}
function increaseObjSize(p, sclass, val) {
    for (i = 0; i < p.length; i++) {
        if (p[i].className == sclass) {
            if (p[i].style.fontSize) {
                var s = parseInt(p[i].style.fontSize.replace("px", ""));
            } else {
                var s = val;
            }
            if (s <= max) {
                s += 3;
            }
            p[i].style.fontSize = s + "px"
        }
    }
}
function decreaseFontSize() {
    //window.location.reload();
    if (curFontSize <= 0) return;
    curFontSize--;
    var p;
    p = document.getElementsByTagName('span');
    decreaseObjSize(p, 'aplus', 10);
    decreaseObjSize(p, 'aplustext', 18);
}
function decreaseObjSize(p, sclass, val) {
    for (i = 0; i < p.length; i++) {
        if (p[i].className == sclass) {
            if (p[i].style.fontSize) {
                var s = parseInt(p[i].style.fontSize.replace("px", ""));
            } else {
                var s = val;
            }
            if (s >= min) {
                s -= 3;
            }
            p[i].style.fontSize = s + "px"
        }
    }
}

function disclaimerWnd(s_url) {
    var retorno = confirm("Ao clicar no link a seguir você será direcionado para um website externo, que a Novartis acredita estar relacionado ao assunto de seu interesse. No entanto, a Novartis não se responsabiliza pelo conteúdo e opiniões nele expressos.");
    if (retorno) {
        window.open(s_url, '_blank');            
    }
}

function drawMessage(baseObj, message) {
    var objbase;
    objbase = document.getElementById(baseObj);
    if (!objbase) return;
    objbase.innerHTML = message;
}

function drawRectangle(left, top, width, height, name, message) {
    if (document.getElementById(name)) return;
    if (document.createElement) {
        newdiv = document.createElement("div");
        newdiv.style.position = "absolute";
        newdiv.style.left = left;
        newdiv.style.top = top;
        newdiv.style.width = width + "px";
        newdiv.style.height = height + "px";
        newdiv.style.backgroundColor = 'black';
        newdiv.style.visibility = 'visible';
        newdiv.id = name;
        newdiv.innerHTML = message;
        document.body.appendChild(newdiv);
    }
}

function show(elementid) {
    if (document.getElementById(elementid).style.display == 'none') {
        document.getElementById(elementid).style.display = 'block';
    }
    else {
        document.getElementById(elementid).style.display = 'none';
    }
}
