Here is an awesome video showing office towers swaying in Tokyo during the earthquake of March 11th, 2011:
Engineers in Japan design buildings so that they will sway sideways during the lateral motion of an earthquake to reduce stresses that would overwhelm a structure's integrity if the building were structurally stiff. Having just visited Japan, it is amazing how many tall office buildings are located throughout Tokyo, particularly in Shinjuku where I stayed on the 43rd floor of a hotel.
While no building is 100 percent earthquake-proof, engineers design buildings so that they will retain their structural integrity and allow their occupants to leave safely after an earthquake. Engineers must also understand how the soil that contains the buildings foundation will act during an earthquake; during the shaking motion in the most recent earthquake in Christchurch, New Zealand, the earth liquified causing foundations to fail and building to topple.
Having said all of that, it must be terribly frightening to see 50 story office towers swaying like trees in the wind!