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

<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*;}}

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