Pull and use id from link?

<div class="artbox"><a id="thumb4" href="javascript:void();" onclick="document.getElementById('underlay').style.display='block'; document.getElementById('lightbox').style.display='block';" title="thumb4"><span>Berry Motorsports - 3D Intake Rendering via Solidworks Photoview 360</span></a></div>

I’m a pretty terrible at javascript, and am wondering if I could get a little help on how to do something. I need to know how I can get the id “thumb4” out of the link for use inside the div that gets displayed. I’d like to be able to input information dependent upon which id I have.