Load will automatically filter out all but the body tag in the document. If you have your javascript in the head of the document, it won't be loaded with the document. Try moving your javascript into the body tag and see if that works.
In jQuery 1.2 you can now specify a
jQuery selector in the URL. Doing so
will filter the incoming HTML
document, only injecting the elements
that match the selector. The syntax
looks something like "url #some >
selector". Default selector "body>*"
always applies. If the URL contains a
space it should be escape()d. See the
examples for more information.
Updated based on comments
You'll need to load your CSS with your base page. Since the link tag must be in the head element, there isn't any (easy) way to load it via AJAX. You could add a link to the head of your document, but getting the href for the link would probably require a separate call or changing to return the link and html wrapped as a json object. Better to just include the CSS in the main document.
I think if you returned just the following content from your AJAX call it ought to work.
<ul id="gallery">
<li><span class="panel-overlay">This is an overlay</span><img src="img1.jpg" alt="test1" title="test1" /></li>
<li><span class="panel-overlay">This is an overlay</span><img src="img2.jpg" alt="test2" title="test2" /></li>
<li><span class="panel-overlay">This is an overlay</span><img src="img3.jpg" alt="test3" title="test3" /></li>
<li><span class="panel-overlay">This is an overlay</span><img src="img4.jpg" alt="test4" title="test4" /></li>
</ul>
<script type="text/javascript">
$(function() {
$('#gallery').galleryView(
{
panel_width: 474,
panel_height: 353,
frame_width: 50,
frame_height: 50,
transition_speed: 350,
easing: 'easeInOutQuad',
transition_interval: 0
});
});
</script>