Depression is mainly due to two factors: biological factors and catastrophic thoughts. The
Wikipedia article on depression has a good overview.
These articles are also very good at describing the basis for depression:
http://www.kuro5hin.org/story/2005/5/9/83936/58483 http://www.kuro5hin.org/story/2005/5/16/81428/8007
If you want an inexpensive way to treat depression, I recommend the following steps:
1. Change your diet to include a wide variety of fruits and vegetables. Also, reduce the amount of processed foods in your diet (such as products made with sugar and white flour).
2. Take omega 3 supplements, especially fish oil. Magnesium supplements may also be helpful.
3. Read about cognitive behavioral therapy. This will teach you to identify and deal with depressive thoughts.
4. Try to go outside for ten to twenty minutes each day. A lack of sunlight leads to a lack of vitamin D production in the body, which can cause depression.
The Wikipedia article I linked to at the beginning of this message also has a variety of potential treatments.
If these don't work, or if you feel suicidal, you may want to see a clinical psychiatrist.