This is a very comprehensive JavaScript calculator. Although the source code can get quite confusing, it works.