Water damage is a common problem with cell phones that can cause a significant drop in value, and can often void any warranties you may have. Most mobile phones, including the iPhone, have some sort of water damage indicator.
The 3G, 3GS, 4, and 4S have indicators both in the headphone jack, and on the bottom of the dock-connector housing. The new iPhone 5 features one water damage indicator on the inside of the nano SIM card slot. This is located on the right side of the device.
The best way to look at the indicator is by aiming a flashlight or lighted magnifying glass into the jack. If the iPhone has been submerged in liquid, or has liquid damage, this circular indicator would be triggered and colored red or pink. If the indicator has been triggered, the repair is most likely not covered by the warranty.
For more at information see Apple's Support Site.