HI bugmenot,
I'm not sure if this is the solution but it's certainly something that might held.
num is set to 1 when the page loads.
Then, when you call the function you are immediately incrementing 1, so the slide show starts at 2.
If you set num to 0 in the initialisation the first image will show.
I'm not sure how that relates to the issue with clicking twice but I trust it helps.
Regards,
David