Now, both Google Directions Web Services and Google Maps JavaScript API include building the routes with Public Transit.

Blog post:

http://googlegeodevelopers.blogspot.com/2012/06/public-transit-routing-and-layer-now.html

API docs:

https://developers.google.com/maps/documentation/directions/#TravelModes

https://developers.google.com/maps/documentation/javascript/directions#TransitOptions

Sample request in St. Petersburg:

http://maps.googleapis.com/maps/api/directions/json?origin=59.94473,30.294254&destination=59.80612,30.308552&sensor=false&departure_time=1346197500&mode=transit