See+link

The way that japan has set up their buildings is they absorb the shock waves of an earthquakes. On top of the buildings they created a system that when waves form the earthquake a computer shifts the weight of the building to where ever it is needed. There is also other things to keep the building up like: cross-braces, flexible pipes, active tendon system, base isolators.