An example of R code that tests for a mediation relationship.
Resources on statistical mediation curated by David MacKinnon. Very thorough.
David Kenny's homepage. Especially useful for resources related to mediation and moderation, but also full of stuff on other sorts of statistical modelling techniques