Clarification: Initialize the Image objects inside a loop with a statement like
ads[x].src="ad"+x+".gif";