Foam is a pretty generic term that covers a variety of material from polystyrene to polyethylene. They all have different properties. I think you are looking for a rigid polyurethane foam.
Polyurethane comes in different densities and colors. For your purpose, you will need a minmum 4lb density, but 6lb foam is better (and more expensive).
You can buy it on the web at
http://www.generalplastics.com/products/product_detail.php?pid=19&
Also, check your local Yellow Pages under "Insulation" and ask for polyurethane foam. They will sell it in sheets or cut to size.
I have a place locally that has 3'x4'x3' buns that they run through the bandsaw to any size. I asked them if they ship, and they said they would. If you would like to give them (Wester McArthur)
a call the # is (800) 628-1281 and ask about shipping you some samples.