animation-related JavaScript for iFrames wrapped in function