The small Manfrotto Maxi range are ok as long as you are only using the D40 with a small lens but as soon as you start putting bigger bodies or larger lenses on there then you are going to get a bit of creep on the tripod head.
Unfortunately you cant get a tripod (to my knowledge) that is small when folded, large when unfolder, cheap and that will hold a DSLR.