Slideshow hangs

I have a banner that runs a slideshow. It works fine for a while but after some time it hangs.
Here’s the AS:


delay = 13000;
delay1 = 12000;
delay2 = 14000;
delay3 = 10000;
//-----------------------
clearInterval(myInterval);
clearInterval(myInterval2);
clearInterval(myInterval3);
clearInterval(myInterval4);
////--------------
function loadXML(loaded) {
if (loaded) {
xmlNode = this.firstChild.firstChild;
image = [];
total = xmlNode.childNodes.length;
for (i=0; i<total; i++) {
image* = xmlNode.childNodes*.childNodes[0].nodeValue;
}
firstImage();
} else {
content = "file not loaded!";
}
}
function loadXML1(loaded1) {
if (loaded1) {
xmlNode1 = xmlNode.nextSibling;
image1 = [];
total1 = xmlNode1.childNodes.length;
for (i=0; i<total1; i++) {
image1* = xmlNode1.childNodes*.childNodes[0].nodeValue;
}
firstImage1();
} else {
content = "file not loaded!";
}
}
function loadXML2(loaded2) {
if (loaded2) {
xmlNode2 = xmlNode1.nextSibling;
image2 = [];
total2 = xmlNode2.childNodes.length;
for (i=0; i<total2; i++) {
image2* = xmlNode2.childNodes*.childNodes[0].nodeValue;
}
firstImage2();
} else {
content = "file not loaded!";
}
}
function loadXML3(loaded3) {
if (loaded3) {
xmlNode3 = xmlNode2.nextSibling;
image3 = [];
total3 = xmlNode3.childNodes.length;
for (i=0; i<total3; i++) {
image3* = xmlNode3.childNodes*.childNodes[0].nodeValue;
}
firstImage3();
} else {
content = "file not loaded!";
}
}
xmlData = new XML();
xmlData1 = new XML();
xmlData2 = new XML();
xmlData3 = new XML();
xmlData.ignoreWhite = true;
xmlData1.ignoreWhite = true;
xmlData2.ignoreWhite = true;
xmlData3.ignoreWhite = true;
xmlData.onLoad = loadXML;
xmlData1.onLoad = loadXML1;
xmlData2.onLoad = loadXML2;
xmlData3.onLoad = loadXML3;
xmlData.load("XML/images.xml");
xmlData1.load("XML/images.xml");
xmlData2.load("XML/images.xml");
xmlData3.load("XML/images.xml");
p = 0;
c = 0;
d = 0;
n = 0;
a = 0;
this.onEnterFrame = function() {
filesize = container01.getBytesTotal();
loaded = container01.getBytesLoaded();
if (container01._alpha<100) {
container01._alpha += 2;
}
filesize1 = container02.getBytesTotal();
loaded1 = container02.getBytesLoaded();
if (container02._alpha<100) {
container02._alpha += 2;
}
filesize3 = container03.getBytesTotal();
loaded3 = container03.getBytesLoaded();
if (container03._alpha<100) {
container03._alpha += 2;
}
filesize4 = container04.getBytesTotal();
loaded4 = container04.getBytesLoaded();
if (container04._alpha<100) {
container04._alpha += 2;
}
};
function nextImage() {
if (p<(total-1)) {
p++;
if (loaded == filesize) {
container01._alpha = 0;
container01.loadMovie(image[p], 1);
slideshow();
}
}
}
function nextImage1() {
if (c<(total1-1)) {
c++;
if (loaded1 == filesize1) {
container02._alpha = 0;
container02.loadMovie(image1[c], 1);
slideshow1();
}
}
}
function nextImage2() {
if (d<(total2-1)) {
d++;
if (loaded2 == filesize2) {
container03._alpha = 0;
container03.loadMovie(image2[d], 1);
slideshow2();
}
}
}
function nextImage3() {
if (n<(total3-1)) {
n++;
if (loaded3 == filesize3) {
container04._alpha = 0;
container04.loadMovie(image3[n], 1);
slideshow3();
}
}
}
function firstImage() {
if (loaded == filesize) {
container01._alpha = 0;
container01.loadMovie(image[0], 1);
slideshow();
}
}
function firstImage1() {
if (loaded1 == filesize1) {
container02._alpha = 0;
container02.loadMovie(image1[0], 1);
slideshow1();
}
}
function firstImage2() {
if (loaded2 == filesize2) {
container03._alpha = 0;
container03.loadMovie(image2[0], 1);
slideshow2();
}
}
function firstImage3() {
if (loaded3 == filesize3) {
container04._alpha = 0;
container04.loadMovie(image3[0], 1);
slideshow3();
}
}
function slideshow() {
myInterval = setInterval(pause_slideshow, delay);
function pause_slideshow() {
clearInterval(myInterval);
if (p == (total-1)) {
p = 0;
firstImage();
} else {
nextImage();
}
}
}
function slideshow1() {
myInterval2 = setInterval(pause_slideshow1, delay1);
function pause_slideshow1() {
clearInterval(myInterval1);
if (c == (total1-1)) {
c = 0;
firstImage1();
} else {
nextImage1();
}
}
}
function slideshow2() {
myInterval2 = setInterval(pause_slideshow2, delay2);
function pause_slideshow2() {
clearInterval(myInterval2);
if (d == (total2-1)) {
d = 0;
firstImage2();
} else {
nextImage2();
}
}
}
function slideshow3() {
myInterval3 = setInterval(pause_slideshow3, delay3);
function pause_slideshow3() {
clearInterval(myInterval3);
if (n == (total3-1)) {
n = 0;
firstImage3();
} else {
nextImage3();
}
}
} 

Does anyone know where I might have gone wrong? To make it more simple to analyse, this AS is based on Scotty’s Slideshow tutorual’s AS.
Here’s the link to the tutorial:
http://www.kirupa.com/developer/mx2004/xml_slideshow.htm
Would appreciate any help on this!