New line for loaded XML thumbnails

I have created a gallery with thumbnails (using various tutorials) howver the thumbnails all load on one line… I would like to able to brake up the thumbnails so that after say 4 tbm load the next 4 will go below I have tried various methods. Here is my script

images = new Array ();
xml_file = (“Gallery/Range/images.xml”);
//xml_file = “images.xml”;
xmlload = new XML ();
xmlload.ignoreWhite = true;
xmlload.onLoad = function (ok) {
if (ok) {
count = this.firstChild.childNodes.length;
for (var i = 0; i < count; i++) {
curNode = this.firstChild.childNodes*;
images* = {caption:curNode.childNodes[0].firstChild.nodeValue, path:curNode.childNodes[1].firstChild.nodeValue};
}
boot ();
} else {
trace ("Could not load " + xml_file + “.”);
}
};
xmlload.load (xml_file);
// ------------------------------------------------------------
spacing = 5;
boot = function () {
for (var i = 0; i < images.length; i++) {
mc = container.attachMovie (“thumbMC”, “thumb” + i, i);
mc._x = i * (95 + spacing);
mc.path = “Gallery/Range/thumbs/” + images*.path + “.jpg”;
mc.link = “Gallery/Range/images/” + images*.path + “.jpg”;
mc.caption = images*.caption;
}
this._parent.picture._alpha = 0;
this._parent.caption._alpha = 0;
this._parent.picture.loadMovie (“images/” + images[0].path + “.jpg”);
this._parent.caption.txt = images[0].caption;
setRollOver ();
};

I have tried…

for <var i = 0; i<4; i++)
for <var j = 0; j<4; i++){
mc = container.attachMovie (“thumbMC”, “thumb” + i, i);
mc._x = gridxi (95 + spacing);
mc._y = gridy
j (95 + spacing);

This didn’t work can anyone help me