The code I wrote to do this effect stays "fixed" on top or on bottom. I did it the manual hard-coded way and wanted some advice on the best way to write something like this.
<script type="text/javascript">
function toggle_visibility(id) {
if (id == 'firstDivHeader')
{
document.getElementById('firstDivResults').style.display = 'block';
document.getElementById('firstDivHeader').style.top = '0';
document.getElementById('firstDivHeader').style.position = 'fixed';
document.getElementById('secondDivResults').style.display = 'none';
document.getElementById('secondDivHeader').style.top = '';
document.getElementById('secondDivHeader').style.bottom = '82px';
document.getElementById('secondDivHeader').style.position = 'fixed';
document.getElementById('thirdDivResults').style.display = 'none';
document.getElementById('thirdDivHeader').style.top = '';
document.getElementById('thirdDivHeader').style.bottom = '41px';
document.getElementById('thirdDivHeader').style.position = 'fixed';
document.getElementById('forthDivResults').style.display = 'none';
document.getElementById('forthDivHeader').style.top = '';
document.getElementById('forthDivHeader').style.bottom = '0px';
document.getElementById('forthDivHeader').style.position = 'fixed';
} else if (id == 'secondDivHeader')
{
document.getElementById('firstDivResults').style.display = 'none';
document.getElementById('firstDivHeader').style.top = '0';
document.getElementById('firstDivHeader').style.position = 'fixed';
document.getElementById('secondDivResults').style.display = 'block';
document.getElementById('secondDivHeader').style.top = '41px';
document.getElementById('secondDivHeader').style.bottom = '';
document.getElementById('secondDivHeader').style.position = 'fixed';
document.getElementById('thirdDivResults').style.display = 'none';
document.getElementById('thirdDivHeader').style.top = '';
document.getElementById('thirdDivHeader').style.bottom = '41px';
document.getElementById('thirdDivHeader').style.position = 'fixed';
document.getElementById('forthDivResults').style.display = 'none';
document.getElementById('forthDivHeader').style.top = '';
document.getElementById('forthDivHeader').style.bottom = '0px';
document.getElementById('forthDivHeader').style.position = 'fixed';
} else if (id == 'thirdDivHeader')
{
document.getElementById('firstDivResults').style.display = 'none';
document.getElementById('firstDivHeader').style.top = '0';
document.getElementById('firstDivHeader').style.bottom = '';
document.getElementById('firstDivHeader').style.position = 'fixed';
document.getElementById('secondDivResults').style.display = 'none';
document.getElementById('secondDivHeader').style.top = '41px';
document.getElementById('secondDivHeader').style.bottom = '';
document.getElementById('secondDivHeader').style.position = 'fixed';
document.getElementById('thirdDivResults').style.display = 'block';
document.getElementById('thirdDivHeader').style.top = '82px';
document.getElementById('thirdDivHeader').style.bottom = '0';
document.getElementById('thirdDivHeader').style.position = 'fixed';
document.getElementById('forthDivResults').style.display = 'none';
document.getElementById('forthDivHeader').style.top = '';
document.getElementById('forthDivHeader').style.bottom = '0px';
document.getElementById('forthDivHeader').style.position = 'fixed';
} else if (id == 'forthDivHeader')
{
document.getElementById('firstDivResults').style.display = 'none';
document.getElementById('firstDivHeader').style.top = '0';
document.getElementById('firstDivHeader').style.bottom = '';
document.getElementById('firstDivHeader').style.position = 'fixed';
document.getElementById('secondDivResults').style.display = 'none';
document.getElementById('secondDivHeader').style.top = '41px';
document.getElementById('secondDivHeader').style.bottom = '';
document.getElementById('secondDivHeader').style.position = 'fixed';
document.getElementById('thirdDivResults').style.display = 'none';
document.getElementById('thirdDivHeader').style.top = '82px';
document.getElementById('thirdDivHeader').style.bottom = '';
document.getElementById('thirdDivHeader').style.position = 'fixed';
document.getElementById('forthDivResults').style.display = 'block';
document.getElementById('forthDivHeader').style.top = '123px';
document.getElementById('forthDivHeader').style.bottom = '';
document.getElementById('forthDivHeader').style.position = 'fixed';
}
}
</script>
<div id=menuContainer>
<a href="#" onclick="toggle_visibility('firstDivHeader');"> <div id="firstDivHeader" style="z-index: 100; width: 100%; height: 30px; background-color: #560000; border-width: 0px 0px 1px 0px; border-style: solid; border-color: black; color: white; font-weight: bold; font-size: 14px;padding-top: 10px; text-align: center;">
First Div
</div>
</a>
<div class=item id="firstDivResults" style="display: none;">
blah<br />
blah<br />
blah<br />
blah<br />
blah<br />
blah<br />
blah<br />
blah<br />
blah<br />
blah<br />
blah<br />
blah<br />
blah<br />
blah<br />
blah<br />
blah<br />
blah<br />
blah<br />
blah<br />
blah<br />
blah<br />
blah<br />
blah<br />
blah<br />
blah<br />
blah<br />
blah<br />
blah<br />
blah<br />
blah<br />
blah<br />
blah<br />
blah<br />
blah<br />
blah<br />
blah<br />
blah<br />
blah<br />
blah<br />
blah<br />
blah<br />
blah<br />
blah<br />
blah<br />
blah<br />
blah<br />
blah<br />
blah<br />
blah<br />
blah<br />
blah<br />
blah<br />
blah<br />
blah<br />
blah<br />
blah<br />
blah<br />
blah<br />
blah<br />
blah<br />
blah<br />
blah<br />
blah<br />
blah<br />
blah<br />
blah<br />
blah<br />
blah<br />
blah<br />
blah<br />
blah<br />
blah<br />
blah<br />
blah<br />
blah<br />
</div>
<a href="#" onclick="toggle_visibility('secondDivHeader');"> <div id="secondDivHeader" style="z-index: 100; width: 100%; height: 30px; background-color: #560000; border-width: 0px 0px 1px 0px; border-style: solid; border-color: black; color: white; font-weight: bold; font-size: 14px;padding-top: 10px; text-align: center;">
Second Div
</div>
</a>
<div class=item id="secondDivResults" style="display: none;">
blah<br />
blah<br />
blah<br />
blah<br />
blah<br />
blah<br />
blah<br />
blah<br />
blah<br />
blah<br />
blah<br />
blah<br />
blah<br />
blah<br />
blah<br />
blah<br />
blah<br />
blah<br />
blah<br />
blah<br />
blah<br />
blah<br />
blah<br />
blah<br />
blah<br />
blah<br />
blah<br />
blah<br />
blah<br />
blah<br />
blah<br />
blah<br />
blah<br />
blah<br />
blah<br />
blah<br />
blah<br />
blah<br />
blah<br />
blah<br />
blah<br />
blah<br />
blah<br />
blah<br />
blah<br />
blah<br />
blah<br />
blah<br />
blah<br />
blah<br />
blah<br />
blah<br />
blah<br />
blah<br />
blah<br />
blah<br />
blah<br />
blah<br />
blah<br />
blah<br />
blah<br />
blah<br />
blah<br />
blah<br />
blah<br />
blah<br />
blah<br />
blah<br />
blah<br />
blah<br />
blah<br />
blah<br />
blah<br />
blah<br />
blah<br />
blah<br />
blah<br />
</div>
<a href="#" onclick="toggle_visibility('thirdDivHeader');"> <div id="thirdDivHeader" style="z-index: 100; width: 100%; height: 30px; background-color: #560000; border-width: 0px 0px 1px 0px; border-style: solid; border-color: black; color: white; font-weight: bold; font-size: 14px;padding-top: 10px; text-align: center;">
third Div
</div>
</a>
<div class=item id="thirdDivResults" style="display: none;">blah<br />
blah<br />
blah<br />
blah<br />
blah<br />
blah<br />
blah<br />
blah<br />
blah<br />
blah<br />
blah<br />
blah<br />
blah<br />
blah<br />
blah<br />
blah<br />
blah<br />
blah<br />
blah<br />
blah<br />
blah<br />
blah<br />
blah<br />
blah<br />
blah<br />
blah<br />
blah<br />
blah<br />
blah<br />
blah<br />
blah<br />
blah<br />
blah<br />
blah<br />
blah<br />
blah<br />
blah<br />
blah<br />
blah<br />
blah<br />
blah<br />
blah<br />
blah<br />
blah<br />
blah<br />
blah<br />
blah<br />
blah<br />
blah<br />
blah<br />
blah<br />
blah<br />
blah<br />
blah<br />
blah<br />
blah<br />
blah<br />
blah<br />
blah<br />
blah<br />
blah<br />
blah<br />
blah<br />
blah<br />
blah<br />
blah<br />
blah<br />
blah<br />
blah<br />
blah<br />
</div>
<a href="#" onclick="toggle_visibility('forthDivHeader');"> <div id="forthDivHeader" style="z-index: 100; width: 100%; height: 30px; background-color: #560000; border-width: 0px 0px 1px 0px; border-style: solid; border-color: black; color: white; font-weight: bold; font-size: 14px;padding-top: 10px; text-align: center;">
Fourth Div
</div>
</a>
<div class=item id="forthDivResults" style="display: none;">
blah<br />
blah<br />
blah<br />
blah<br />
blah<br />
blah<br />
blah<br />
blah<br />
blah<br />
blah<br />
blah<br />
blah<br />
blah<br />
blah<br />
blah<br />
blah<br />
blah<br />
blah<br />
blah<br />
blah<br />
blah<br />
blah<br />
blah<br />
blah<br />
blah<br />
blah<br />
blah<br />
blah<br />
blah<br />
blah<br />
blah<br />
blah<br />
blah<br />
blah<br />
blah<br />
blah<br />
blah<br />
blah<br />
blah<br />
blah<br />
blah<br />
blah<br />
blah<br />
blah<br />
blah<br />
blah<br />
blah<br />
blah<br />
blah<br />
blah<br />
blah<br />
blah<br />
blah<br />
blah<br />
blah<br />
blah<br />
blah<br />
blah<br />
blah<br />
blah<br />
blah<br />
blah<br />
blah<br />
blah<br />
blah<br />
blah<br />
blah<br />
blah<br />
blah<br />
blah<br />
blah<br />
blah<br />
blah<br />
blah<br />
blah<br />
blah<br />
blah<br />
blah<br />
</div>
</div>
blah
separated by line breaks? \$\endgroup\$