Removing _root from code

I need some help in getting rid of “_root” in this code.

thanks


maxImage = 13;
colWidth = 50;
rowHeight = 50;
colGap = 30;
rowGap = 30;
cols = 5;
rows = 3;
counter = 1;
initX = 25;
initY = 25;

for (row = 0; row < rows; row++)
{
    for (col = 0; col < cols; col++)
    {
        if (counter <= maxImage)
        {
            _root.createEmptyMovieClip("cont" + counter, 1000 + counter);
            _root["cont" + counter].loadMovie("thumbnails/image_" + counter + ".jpg");
            _root["cont" + counter].attachMovie("border","border1",1)
            _root["cont" + counter]._x = col * (colWidth + colGap) + initX;
            _root["cont" + counter]._y = row * (rowHeight + rowGap) + initY;
            _root.createEmptyMovieClip("tmp" + counter, 2000 + counter);
            _root["tmp" + counter].idx = counter;
            _root["tmp" + counter].onEnterFrame = function ()
            {
                var l = _root["cont" + this.idx].getBytesLoaded();
                var t = _root["cont" + this.idx].getBytesTotal();
                trace(this.idx + " == " + l + " : " + t);
                if ((l >= t) && (l > 1) && (_root["cont" + this.idx]._width > 1))
                {
                    trace("Fully loaded!!!");
                    delete this.onEnterFrame;
                    _root["cont" + this.idx].idx = this.idx;
                    _root["cont" + this.idx].onPress = function ()
                    {
                        trace("Pressed ... " + this.idx);
                        _root.sel_txt.text = "Selected menu : " + this.idx;
                    }
                    this.removeMovieClip();
                }
            }
            ++counter;
        }
    }
}