Before going with the code, let's see what you should know about accessibility.
I found the easiest way to build an accessible web application is by following the hints found at the Google I/O 2011 presentation:
Use clean HTML and use standard tags whenever possible
Add key handlers
Add ARIA for screen readers
Remember also to download and use additional software (such as the ones you can find at: http://www.w3.org/WAI/ER/tools/) to check the code you write for the accessibility.