﻿function expandText(expandBtn, clearElipsis)
{
    // remove hidden class from text
    var ns = expandBtn.nextSibling;
    while (ns.nodeType != 1)
    {
        ns = ns.nextSibling;
        if (!ns)
            return; // html error
    }
    ns.className = ns.className.replace(/hidden/, "");
    ns.className += "newlyRevealed";
    
    setTimeout(function() { lightenText(ns); }, 500);
    
    // remove preceding elipsis
    var ps = expandBtn.previousSibling;
    if (clearElipsis)
    {
        while (ps && ps.nodeType != 1)
        {
            ps = ps.previousSibling;
        }
        
        if (ps)
            ps.parentNode.removeChild(ps);
    }
    
    // remove expand button
    expandBtn.parentNode.removeChild(expandBtn);
}

function lightenText(text)
{
    text.className = text.className.replace(/newlyRevealed/, "fullyRevealed");
}