In any case, the code is horribly over-complex and could and should be simplified:
function blink( )
for ( var b = 1; b < 9999; ++b )
var div = document.getElementById("agent" + b )
if ( div == null ) return;
div.style.visibility = ( div.style.visibility == "hidden" ) ? "visible" : "hidden";
setInterval( blink, 3000 );
Now it works with any number of "agentNN" divs (or spans or whatever) *and* with any initial visibility per agentNN (provided the style is code inline).
That is, you could add
<span id="agent3" style="visibility: hidden;">wowser!</span>
And it would autmatically be blinked, as well, but in opposition to the blinks for agent1 and agent2, as given.