Xml duplicates issues

I’m working on this xm thumbnail grid gallery and I encounter some problems that might need some help from you guys. Here are some scripts I’m having fixing. Its basically between the pictures loaded in side some duplicate mc.

function dupHolder() {
for (i=0; i<20; i++) {
nav.duplicateMovieClip(“nav”+i, i, {_x:50+(i%columns)*spacex, _y:Math.floor(i/columns)*spacey});
/*with (eval(“nav”+i)) {
_xscale = _yscale=Math.random()300;
}
/
//will not be using the script temporarily cause still learning whats its functions.
}
}
dupHolder();

For function dupHolder(), I tried to use for (i=0; i<total; i++), but it wouldn’t work, so i use for (i=0; i<20; i++), but somehow, its like missing 10 mc. Even i put a higher number, sure there is some mc missing.

For function duplicate():

function duplicate() {
for (var i = 0; i<total; i++) {
var clip = drawSquare(this, i);
// var clip = drawSquare(tn, i); for another testing files
// tn is the place where the xml pics will be loaded in
clip._x = (i%columns)*spacex;
clip._y = Math.floor(i/columns)*spacey;
var clap = clip.createEmptyMovieClip(“btn”, 1);
clap._x = 50;
clap._y = Stage.height-90;
cliparray.push(clap);
clip3.onRollOver = function() {
navigation.play();
navigation.rewind = false;
};
clip.onRollOut = function() {
navigation.rewind = true;
};
}
startload();
}

for “clip = drawSquare(this, i)”, I used “clip = drawSquare(tn, i);” at one of my testing, and it could run and load the pictures, into the mc. but not the currently 1.

And, for the rollover functions, is there anywhere I could make it auto like
clip3, will interact with navigation3, and clip6 with navigation6 for example?

I’m actually trying to combine both script cause I think both actually are doing similar things, or am I wrong for combining both things that are actually doing different actions?