I found a pretty good example while browsing through some technical blogs on the web. As of late, with the migration to ASP.NET 2.0, I've found that using javascript with Master Pages, it a real pain in the... well you know. At any rate here is the link to the example.

Master Page & Javascript Example