Photoalbum with categories

I have created a photo album with categories. but i have to click “category1” button two times to load the thumbnail. on first click it hide the thumbnail and 2nd click it shows the thumbnail.

flowing is the code and let me know where i am doing wrong.
CODE:-

info.text = “Loading…”;
my_xml = new XML ();
my_xml.ignoreWhite = true;
my_xml.load (“images.xml”);
_root.image = 0;
LastitemTotal = 0;
category = “Its Me”;
my_xml.onLoad = function (status)
{
if (status)
{
_root.levelChild = this.firstChild;
category_fn (category);
var mcl:MovieClipLoader = new MovieClipLoader ();
var picListener:Object = new Object ();
mcl.addListener (picListener);
mcl.loadClip (info_xml[0].attributes.source, pic1);
info.text = info_xml[0].attributes.title;
picListener.onLoadInit = function (mc:MovieClip)
{
setPicture (image);
};
}
ZoomOut._visible = false;
ZoomOutText._visible = false;
ZoomInText._visible = true;
};

function setPicture (image)
{
this.onEnterFrame = function ()
{
if (pic1._width > 0)
{
var mcl:MovieClipLoader = new MovieClipLoader ();
var picListener:Object = new Object ();
mcl.addListener (picListener);
mcl.loadClip (info_xml[image].attributes.source, pic1);
info.text = info_xml[image].attributes.title;
picListener.onLoadInit = function (mc:MovieClip)
{
if (mc._height > mc._width)
{
mc._height = 520;
mc._width = 420;
stageWidth = 640;
stageHeight = 560;
mc._x = 27 + (stageWidth - mc._width) / 2;
mc._y = 40 + (stageHeight - mc._height) / 2;
pic1._alpha = 100;
}
else
{
mc._height = 520;
mc._width = 620;
mc._x = 32;
mc._y = 55;
}
};
ZoomInText._visible = true;
ZoomIn._visible = true;
ZoomOutText._visible = false;
ZoomOut._visible = false;
Frame._visible = true;
delete my_xml;
delete this.onEnterFrame;
_root.image = image;
}
};
}
ZoomIn.onRelease = function ()
{
image = _root.image;
var mcl:MovieClipLoader = new MovieClipLoader ();
var picListener:Object = new Object ();
mcl.addListener (picListener);
mcl.loadClip (info_xml[image].attributes.source, pic1);
info.text = info_xml[image].attributes.title;
picListener.onLoadInit = function (mc:MovieClip)
{
ZoomIn._visible = false;
ZoomInText._visible = false;
ZoomOutText._visible = true;
ZoomOut._visible = true;
Frame._visible = false;
thumbnail_mc.enabled = false;
thumbnail_mc._visible = false;
if (mc._height > mc._width)
{
mc._height = 575;
mc._width = 450;
stageWidth = 800;
stageHeight = 600;
mc._x = 2 + (stageWidth - mc._width) / 2;
mc._y = 2 + (stageHeight - mc._height) / 2;
pic1._alpha = 100;
}
else
{
mc._height = 550;
mc._width = 750;
stageWidth = 800;
stageHeight = 600;
mc._x = 10 + ((stageWidth - mc._width) / 2);
mc._y = 10 + ((stageHeight - mc._height) / 2);
}
};
delete my_xml;
delete this.onEnterFrame;
};
ZoomOut.onRelease = function ()
{
delete this.onEnterFrame;
setPicture (image);
ZoomInText._visible = true;
ZoomIn._visible = true;
ZoomOutText._visible = false;
ZoomOut._visible = false;
thumbnail_mc.enabled = true;
thumbnail_mc._visible = true;
};
function thumbNailScroller ()
{
// thumbnail code!
this.createEmptyMovieClip (“tscroller”, 1000);
scroll_speed = 10;
tscroller.onEnterFrame = function ()
{
if ((_root._xmouse >= thumbnail_mc._x) && (_root._xmouse <= thumbnail_mc._x + thumbnail_mc._width))
{
if ((_root._ymouse >= (hit_right._y - 40)) && (thumbnail_mc.hitTest (hit_right)))
{
thumbnail_mc._y -= scroll_speed;
}
else if ((_root._ymouse <= 100) && (thumbnail_mc.hitTest (hit_left)))
{
thumbnail_mc._y += scroll_speed;
}
}
else
{
delete tscroller.onEnterFrame;
}
};
}
Category0.onRelease = function ()
{
category_fn (“Gods”);
setPicture (0);
};
Category1.onRelease = function ()
{
category_fn (“Its Me”);
setPicture (0);
};
function category_fn (category)
{

Total = _root.levelChild.childNodes.length;
for (attr = 0; attr &lt; Total; attr++)
{
    if (_root.levelChild.childNodes[attr].attributes.Menu == category)
    {
        //then count and loop through items in category until found specific item
        itemTotal = _root.levelChild.childNodes[attr].childNodes.length;
        info_xml = _root.levelChild.childNodes[attr].childNodes;
        thumbnails = new Array ();
        if (itemTotal &lt; LastitemTotal)
        {
            unloadclips ();
        }
        for (i = 0; i &lt; itemTotal; i++)
        {
            thumbnails* = info_xml*.attributes.thumbnail;
            thumbnails_fn (i);
        }
    }
}
LastitemTotal = itemTotal;

}
function unloadclips ()
{
thumbnail_mc.unloadMovie ();
LastitemTotal = itemTotal - 1;
image_mcl = new MovieClipLoader ();
image_mcl.loadClip (thumbnails, thumbnail_mc);
this.thumbnail_mc.refresh;
this.clear;
}
function thumbnails_fn (k)
{
thumbnail_mc.createEmptyMovieClip (“t” + k, thumbnail_mc.getNextHighestDepth ());
tlistener = new Object ();
tlistener.onLoadInit = function (target_mc)
{
target_mc._y = hit_left._y + (eval (“thumbnail_mc.t” + k)._height + 5) * k;
target_mc.pictureValue = k;
target_mc.onRelease = function ()
{
p = this.pictureValue;
// Draw Picture
setPicture §;
};
target_mc.onRollOver = function ()
{
this._alpha = 50;
thumbNailScroller ();
};
target_mc.onRollOut = function ()
{
this._alpha = 100;
};
};
image_mcl = new MovieClipLoader ();
image_mcl.addListener (tlistener);
image_mcl.loadClip (thumbnails[k], “thumbnail_mc.t” + k);
}