Is there any way to check if a post has a gallery? I'm using a plugin that adds a jquery thickbox to galleries.. but it loads jQuery and the thickbox scripts on every page even though posts with galleries are the only pages that will use those javascripts. I don't want my users to download something they might not need during their visit

I was thinking of doing something like:

Code PHP:
if (do_shortcode('[gallery]')) {
 //load javascripts
}

or

Code PHP:
$checkgallery = do_shortcode('[gallery]');
if (!empty($checkgallery) {
 //load javascripts
}