You can try Google Closure compiler. It has different settings and you can also remove dead code automatically. You can try it here: http://closure-compiler.appspot.com/home
For more info read here: http://code.google.com/closure/compiler/docs/compilation_levels.html