In general, how do you compute the algebraic values of the modular j-function at quadratic imaginary points? (In other words, how do you compute the algebraic values of singular moduli?)

For instance, the Mathematica website (http://mathworld.wolfram.com/j-Function.html) gives the standard nine integral examples that result when the class number $h_k=1$, but then it gives 18 examples for when the class number is 2 without any specific references. How does one compute these? More importantly, can you also do it for higher degree cases? Or even just find the defining degree-$h_k$ polynomial?