Put on your rubber gloves. In a bucket, mix 1/2 cup TSP with a gallon of warm water. Thoroughly scrub the woodwork with a scrub brush. Rinse it with a sponge and clean water. Let it dry completely.
Sand the surface of the trim with 120-grit sandpaper, folding the paper around the contours of the trim and using quick, short strokes. Dull the whole surface of any gloss or shine. Wipe off the dust with a dry cloth.
Set painter's tape around the borders of the trim, protecting the wall, floor and any other areas that won't be painted.
Apply a coat of sealing primer to the trim, with a paint brush. Brush it on in the direction of the trim, starting at the highest points and working down. Make sure all parts of the surface are covered, but that the coat is kept thin, smooth and free of drips. Let it dry overnight.
Brush on the first coat of gloss paint in the same way as the primer, starting at the top and keeping it very thin and smooth. Don't worry if the primer shows through the first coat of gloss paint.
Let the first coat of gloss paint dry to the touch. Sand it very lightly 220-grit sandpaper, just enough to dull the shine of the surface so the second coat will stick. Wipe away the dust.
Apply a second and final coat of gloss paint in the same manner as the first. Remove the painter's tape.