Hi Brian,
yes, you need a visa to enter Brazil. Here are a few links that can help you with the requirements and the actual process.
http://www.neosoft.com/~cgbrahou/vitur.htm
http://www.brasilemb.org/consular/tourist.htm
Beware that some consulate would issue a 3 month visa instead of a five year visa for the same price. Talk to the clerk beforehand and request a five year visa.
You can also obtain a hotel reservation by booking a hotel in Brazil (do not ever give them your credit card information). You don't have to stay in the hotel and in case Immigration Officers request a
reservation, you'll have one. Beware that you have to put the address information of the hotel on the immigration form
There is no restriction on how long you need to have the passport before you can apply for the visa. The only restriction I am aware of is that the passport has to expire more then six months from the date of the application.
Good Luck!
Boris