I have 3 Galleries on a website controlled by on each of the seperate pages by <body onLoad="photoGallery()"> with the function detail for each of the galleries in the <head> section of the individual pages.... and everything worked fine!

When I seek to collect all my Javascripts bits into a .js file the Galleries no longer work! The .js file connects with the pages fine as all the other javascripts work.

I am using
var c=0
var s
function photoGallery()
if (c%3==0){document.getElementById('photo-gallery').src = "sequence1.jpg";}
if (c%3==1){document.getElementById('photo-gallery').src = "sequence2.jpg";}
if (c%3==2){document.getElementById('photo-gallery').src = "sequence3.jpg";}

I have tried different things to give the Galleries a different identity but cannot get to work! Is there a way around this or do I have to keep the function script in the head sections?