There are 82 errors and 15 warnings in the code you showed us. You should always clean up your code before asking for help because the clean code may eliminate the problem.
You can check the code here:
W3 Validator
Frankie is right that you are generally looking for a scripting solution. Javascript can do this easily, but your clients may turn off javascript. Another solution is doing it on the server with something like PHP. I recently saw an all CSS solution right here. You might want to find that thread.