I'd like to use a simple script to load outside javascript files asynchronously, so pages don't hang when calling something from facebook or another server. This scripts is from the facebook developer site and quirksmode.org.

For some reason, firebug is telling me "reference error" the two function parameters are undefined. Can someone fill me in on what I'm missing? The test was using firebug and some breakpoints in the anon-function, a little out of my league.

Thanks for any help.

Code:
whales.asyncLoad = function(scriptUrl, appendTo)
{
	(function() {
		var e = document.createElement('script'); e.async = true; 
		e.src = scriptUrl;
		alert( scriptUrl +'\n'+ appendTo); //THE VARS ARE DEFINED HERE THO?!
		if(appendTo && document.getElementById(appendTo)) {
			document.getElementById(appendTo).appendChild(e); }
		else {
			document.getElementById('content').appendChild(e); }
	}());
}