How to preload images from an external js file

In Dreamweaver theres a javascript that loads images after the page has finished. Which images is being set in the body tag. I wonder if it is possible to move the code to a external javascript file. The code looks like this


<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>Preload images</title>
<script type="text/javascript">
<!--
function MM_preloadImages() { //v3.0
var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
if (a*.indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a*;}}
}
//-->
</script>
</head>

<body onLoad="MM_preloadImages('image_1.jpg','image_2.jp g','image_3.jpg')">
</body>
</html>