function hover(element) {
    document.getElementById('attorneys').style.display='block'
    element.style.backgroundColor='#014068'
}

function unhover(element) {
    document.getElementById('attorneys').style.display='none'
    element.style.backgroundColor='#055d96'
}

function doquote(quotenum, state) {
    var nsteps = 10, holdtime = 8000, fadetime = 600
    var doload = true
    
    if (quotenum == -1) {
        quotenum = Math.floor(Math.random()*quotes.length)
        state = nsteps
    } else if (state == 0) {
        quotenum = (quotenum+1)%quotes.length
    } else {
        doload = false
    }

    var fore = state <= nsteps ? state : (nsteps*2 - state)
    var back = nsteps - fore

    var hex = ['0','1','2','3','4','5','6','7',
               '8','9','a','b','c','d','e','f']
    var things = ['text', 'name', 'info', 'link']
    var colors = [
        [0x00,0x00,0x00],[0x15,0x5c,0x86],[0x00,0x00,0x00],[0x15,0x5d,0x86]
    ]

    for (var i = 0; i < 4; i++) {
        var fgcolor = colors[i], thing = things[i]
        var r = Math.floor((fgcolor[0]*fore+0xcc*back)/(fore+back))
        var g = Math.floor((fgcolor[1]*fore+0xcc*back)/(fore+back))
        var b = Math.floor((fgcolor[2]*fore+0xcc*back)/(fore+back))
        var element = document.getElementById('quote'+thing)
        if (doload) {
            element.innerHTML = (thing == 'link') ?
                'Read more' : quotes[quotenum][thing]
        }
        element.style.color =
            '#'+hex[r>>4]+hex[r&15]+hex[g>>4]+hex[g&15]+hex[b>>4]+hex[b&15]
    }
    
    var delay = (state == nsteps) ? holdtime : Math.floor(fadetime/nsteps)
    setTimeout(function(){doquote(quotenum, (state+1)%(nsteps*2+1))}, delay)
}

