Heart Valves FunctionCredit: http://commons.wikimedia.org/wiki/File:Diagram_of_the_human_heart_%28valves_improved%29.svgThe blood in the heart knows only one direction and that is from the atria to the ventricles. The blood then enters the great arteries and leaves through the superior part of the heart. This single direction is made possible by the four valves of the heart.
Atrioventricular ValvesAtrioventricular Valves FunctionCredit: http://webanatomy.net/histology/cardiac_histology.htm
There are two atrioventricular or AV valves distributed evenly in every junction of the atria and the ventricle. They function to prevent the blood from flowing back or creating a two traffic when the ventricles contract. 
The atrioventricular valve found on the right side of heart is known as the tricuspid valve. The tricuspid valve has a distinctive three flexible cusps. These cusps are endocardium projections which are reinforced by the connective tissues in the heart. The counterpart of the tricuspid valve on the left part of the heart is called the mitral valve. It only has two flaps hence sometimes it is referred to as the bicuspid valve. 
FunctionFunction of Atrioventricular ValvesCredit: http://health.yahoo.net/human-body-maps/mitral-valve
During the relaxation of the heart, the valves are also relaxed thus allowing the flow of blood in one way, from the atrium to the ventricles. During the contraction of the ventricles, pressure increases and the blood build up. The valves then close, in response to the rising pressure, by the meeting of the edges.  
The chordae tendineae are the ones responsible for keeping the cusps connected to the papillary muscles. Working together, the papillary muscles and chordae tendineae makes sure that the valves remain close during contraction. Without a strong support base, the cusps will be turned inside upside down and backflow of blood will occur. 
Semilunar Valves
 Semilunar Valves FunctionCredit: http://legacy.owensboro.kctcs.edu/gcaplan/anat2/notes/APIINotes5%20Anatomy%20of%20the%20Heart.htm
The pulmonary and aortic valves serve as gateways at the base of the large arteries that originate from ventricles of the heart. This mechanism prevents the blood from flowing back to their respective ventricles. The name semilunar came from the shape of the valves which forms similar to a crescent moon. The shape if formed from the cusps located at the base of the pulmonary and aorta trunk. These valves share the same goal with the AV valves, and that is to prevent the flow of blood backwards. 
FunctionFunction of Semilunar ValvesCredit: http://www.hcc.bcu.ac.uk/physiology/circulation02.htm
The only difference that the AV and the SL valves have is their action is response to pressure. In the case of the AV valves, the rising pressure causes the valve to close. The scene is different when it comes to the SL valve. The pressure exerted as the ventricles contract causes the semilunar valve to open, allowing the blood to flow. When the ventricle relaxes, the SL valve closes thereby preventing the flow of blood back to the ventricles.  
With all the mechanisms in place to prevent the blood backflow, it is important to note that no valves exist in the entrance of the vena cava. Furthermore there’s also no valve in the pulmonary veins. In these areas, small amounts of blood do flow back but it is only minimal since the inertia and force of the blood rushing forward is greater.