Hi,
Here is a client-side solution:
You can name the files from 0 to 6: 0.jpg, 1.jpg, 2.jpg, ..., 6.jpg or you can go for the array option, but let's stick to the first solution now.
Now, your javascript should look like this:
<script language="javascript">
<!--
var date = new...