recomend checking out the Prototype library which makes this kind of
thing easer. Using Prototype you might do something like
<div id='thisPanel'>this is some text</div>
<a href="#" onClick="$('thisPanel').show(); return false;">show</a>
<a href="#" onClick="$('thisPanel').hide(); return false;">hide</a>
Clicking the links will hide and show the 'thisPanel' div. Expanding
and contracting is similarly achieved but really depends on the type
of effect you want.