/* 
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 *   Created on : 6/Dez/2011, 9:55:40
 *   Author     : MSSousa
 */


function fadeOut(id, time) {
    fade(id, time, 100, 0);
}

function fadeIn(id, time) {
    fade(id, time, 0, 100);
}

function fade(id, time, ini, fin) {
    var target = document.getElementById(id);
    var alpha = ini;
    var inc;
    if (fin >= ini) {
        inc = 2;
    } else {
        inc = -2;
    }
    timer = (time * 1000) / 50;
    var i = setInterval(
        function() {
            if ((inc > 0 && alpha >= fin) || (inc < 0 && alpha <= fin)) {
                clearInterval(i);
            }
            setAlpha(target, alpha);
            alpha += inc;
        }, timer);
}

function setAlpha(target, alpha) {
    target.style.filter = "alpha(opacity="+ alpha +")";
    target.style.opacity = alpha/100;
}

    function abrePalavraAno() {
           fadeIn("palavraAnoDiv", 2.1);
    }
//fechar sticker...
    function closePalavraAno() {
           fadeOut("palavraAnoDiv", 1.1);
    }

