I need help adding an additional function to some existing java script code I already have. In addition to the functions already on this js, I want make it so the banner displays one of the images randomly on each new page load. I have an external js file that this page also links too. Not sure if I need to post that also. I was hoping to just add to this code. Any help is greatly appreciated

<script type="text/javascript" src="js/homepage-banners/simplegallery.js">
</script>

<script type="text/javascript">

var mygallery=new simpleGallery({
wrapperid: "simplegallery1",
dimensions: [250, 180],
imagearray: [
["img/headers/automotive.jpg", "http://www.visionsystem.com/applications/automotive_metal.php", "", ""],
["img/headers/electrical.jpg", "http://www.visionsystem.com/applications/electronics.php", "", ""],
["img/headers/food-packaging.jpg", "http://www.visionsystem.com/applications/food_pharmaceutical.php", "", ""],
["img/headers/medical-pharmaceutical.jpg", "http://www.visionsystem.com/applications/food_pharmaceutical.php", "", ""],
["img/headers/semiconductor.jpg", "http://www.visionsystem.com/applications/electronics.php", "", ""],
["img/headers/automation.jpg", "http://www.visionsystem.com/applications/food_pharmaceutical.php", "", ""]
],

autoplay: [false, 2500, 2],
persist: false,
fadeduration: 500,
oninit:function(){
},
onslide:function(curslide, i){
}
})

</script>