XML gallery/navigation category

Hi there,

ive been searching the forum for hours but cant exactly find what i need. Im building this navigation/gallery sort a thing and im using KIRUPA’s gallery. I know how this thing works now, but i iwant to try something else. I the navigation ive build in the gallery. On every link i want the gallery to swap to a other category of images. I cant figure it OUT… help please.

here’s my code, so far

//var url = "http://www.cvay.com/new/navigatie/";
function loadXML(loaded) {
 if (loaded) {
  xmlNode = this.firstChild;
  image = [];
  category = [];
  ctotal= xmlNode.childNodes.length;
  total = xmlNode.firstChild.childNodes.length;
  for (i=0; i<total; i++) {
   image* = xmlNode.childNodes[0].childNodes*.firstChild.firstChild.nodeValue; 
  }
  for (i=0; i<ctotal; i++) {
   category* =  xmlNode.childNodes*.nodeName; 
  }
  firstImage();
 } else {
  _parent.nextFrame();
 }
}
var test = new Array(category*);
trace (test)
xmlData = new XML();
xmlData.ignoreWhite = true;
xmlData.onLoad = loadXML;
xmlData.load("nav_images.xml");
/////////////////////////////////////
c = 0; 
function nextCategory(){
 c++;
 trace(c);
 loadXML();
 trace(image)
}
function nextImage() {
 if (p<(total-1)) {
  p++;
  if (loaded == filesize) {
   main._alpha = 0;
   main.loadMovie(image[p]);
  }
 }
 if (p ==(total-1)){
    p = 0-1;
  }
}
function firstImage() {
 p = 0;
 if (loaded == filesize) {
  main._alpha = 0;
  main.loadMovie(image[0], 1);
 }
}
/////////////////////////////////////////////////
// PRELOADER
onEnterFrame = function() {
 filesize = _root.main.getBytesTotal();
 loaded = _root.main.getBytesLoaded();
 var amount:Number = _root.main.getBytesLoaded() / _root.main.getBytesTotal() *100;
 _root.preloader_mc._visible = true;
 if (loaded != filesize) {
  _root.preloader_mc.preload_bar._xscale = 100*loaded/filesize;
  _root.preloader_mc.loadProc_mc._x = preloader_mc.preload_bar._width - preloader_mc.loadProc_mc._width+20;
 } else {
  _root.preloader_mc._visible = false;
  if (_root.main._alpha<100) {
   _root.main.alphaTo(100,1,"linear");
  }
 }
};

heres the XML

<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<images>
 <home>
     <pic>
      <image>home_1.jpg</image>
     </pic>
  <pic>
      <image>home_2.jpg</image>
     </pic>
  <pic>
      <image>home_3.jpg</image>
     </pic>
  <pic>
      <image>home_3.jpg</image>
     </pic>
 </home>
 <villassale>
     <pic>
      <image>villassale_1.jpg</image>
     </pic>
  <pic>
      <image>villassale_2.jpg</image>
     </pic>
  <pic>
      <image>villassale_3.jpg</image>
     </pic>
 </villassale>
</images>

the link for the banner

if someone could explain it to me

thnx