Note - Some time after I wrote this code, Google added a full screen option to the Google Maps API. So this code is generally redundant.
You may have noticed that most of the maps on this site have a 'Full screen' option. Here is the code that supports this functionality, that you can add to your own Google Maps application.
Next, add a reference to the file in your HTML like so
map.controls[google.maps.ControlPosition.TOP_RIGHT].push( FullScreenControl(map, [optional text to use for full screen message], [optional text to use for exit full screen message]));
Your map should now look something like the one below.
The object returned from the FullScreenControl method has two methods, goFullScreen and exitFullScreen, that you can call to programatically go full screen or exit full screen.
There is some scenarios where it still can be useful. If you want to programmatically switch to full screen view, the Google Maps API full screen option won't work, but this approach can still be used. Also, Google Maps removes the full screen button in some environments so this approach can be used.
The code has been tested in most browsers, but it's possible it may not work for particular page layouts.