since RotateHeaderImages uses the global variable j as index, this variable can be changed by other plugins which are written as bad as this piece of code of yours. When writing modules/plugins/themes you should keep you plugin independent so that no other plugin can interfere (unexpectedly) with it.
It happend to me, that j was set to 120 after page load (due to email-decrypt--for()-loops or whatever which also shouldn't use global variables (imagine image rotation would reset the variable while decrypting is in process (which could be possible in future))) and the image was replaced by image[120] which is 'undefined' which of course was no valid/existing file.
So i changed your code (in JS you can use structures which are like a light version of C-objects) and I would be very glad if you integrated it into atahualpa for all the other users and also accepted the idea and principle for your next and current projects.
Thanks!
Jonny007-MKD
themes/atahualpa/js.php
Code:
[...] <?php if (strpos($bfa_ata['configure_header'],'%image')!== FALSE AND $bfa_ata['header_image_javascript'] != "0" AND $bfa_ata['crossslide_fade'] == "0") { ?> bfa_ata = { HeaderImages: [<?php echo implode(", ", bfa_rotating_header_images()); $init = ''; ?>], t:0, i:0, j:0, p:<? echo count(bfa_rotating_header_images())-1; ?>, <?php if ($bfa_ata['header_image_javascript_preload'] == "Yes") { $init = 'bfa_ata.init(); '; ?> PreLoadImages: [], init: function() { for (var i = 0; i < bfa_ata.p; i++) { bfa_ata.PreLoadImages[i] = new Image(); bfa_ata.PreLoadImages[i].src = HeaderImages[i]; } }, <?php } ?> RotateHeaderImages: function() { if (document.body) { if (!bfa_ata.HeaderImageContainer) bfa_ata.HeaderImageContainer = document.getElementById('imagecontainer'); bfa_ata.HeaderImageContainer.style.background = 'url(' + bfa_ata.HeaderImages[bfa_ata.j] + ') <?php echo $bfa_ata['headerimage_alignment']; ?> no-repeat'; if (++bfa_ata.j > (bfa_ata.p)) {bfa_ata.j = 0;} bfa_ata.t = setTimeout(bfa_ata.RotateHeaderImages, <?php echo $bfa_ata['header_image_javascript']; ?>000); } } }; window.onload = function(){<? echo $init; ?>bfa_ata.RotateHeaderImages()}; <?php } ?>