The most common cause of vibration issues during agitation and spin cycles is an unlevel washer. The washer needs to be properly leveled front-to-back and side-to-side and be placed on a firm foundation in order to prevent vibration. The following link can give you some added pointers on how to level your washer:http://www.fixya.com/support/r3868923-level_whirlpool_top_loading_washer
Whirlpool manufactured top loaders have an auto-leveling mechanism on the rear feet that needs to be adjusted first. Once the rear feet are set, adjust the front to match the back, by turning the front feet. Make sure you check the level side-to-side as well. DO NOT place the level on the washer lid when checking the level as the washer lid is usually bowed and will not give you an accurate reading. Place the level on a flat area of the top panel frame. Once you have the washer leveled, you can place nuts on the front feet to lock them in place and prevent them from becoming unleveled. The rear mechanism should be rechecked periodically by following the procedures in the link I provided.
If you verify the washer is level and still have problems, you may need to check and see if the suspension springs and counterweight springs are all still intact and in place. The springs help keep the tub leveled and are supposed to prevent it from banging along the sides of the washer cabinet. The following illustration shows where the springs are located:
The springs are listed as items 3 and 15. There are a set of 3 each and are located around the base frame under the wash tub. To access, you need to remove the exterior cabinet of the washer for a full view of the washer internal components. DO NOT lay this washer on its back. The gearcase (transmission) is full of oil and laying it on its back can cause the oil to leak out of the breather vent on top of the gearcase. The following link explains how to remove the cabinet:
The suspension plate (item 17) is another cause of vibrations. The plate has replaceable pads (item 16) that wear out sometimes and require replacement. If the pads are worn down, it can cause the plate to sit unlevel and cause vibrations. This is not as common as a loose suspension spring or unleveled washer, and it requires the removal of the wash tub in order to access. I would begin by verifying if your washer is level, first.
NOTE: The tubs on these washers generally have a capacity of 33 gallons, which is about 275 lbs of water, plus the weight of clothes under a full load. If the floor is weak under the washer and flexes, the washer will begin to vibrate and walk. Upstairs laundry rooms and mobile homes are the worst when it comes to weak floor structures in a laundry room. An inexpensive way to reinforce a laundry room floor is to install a 4 x 8 sheet of heavy plywood under the washer. The plywood has to be a minimum of 3/4 inches thick and needs to be secured (screwed down) to the existing floor. This distributes the weight of the washer better. You can also safely fit BOTH the washer and dryer on top of it. A lot of people don't like this idea, because they feel it wrecks the look of the existing floor. I have seen homeowners install a reinforcement this manner and add paint, trim molding, and even tile to give it that "supposed to be there" look.
You may get mixed reviews about this, but I have seen it work for homeowners. Plus, its a less expensive option than hiring a contractor to firm up your sub-flooring or joists.
I hope you find this information informative and helpful. If you have questions, please let me know.