What caused the earthquake - and why did it cause a building in Bangkok to collapse?

The size of the earthquake and the length of the fault line it occurred on contributed to the devastation.