var x = 0;
 
// Duration of crossfade (seconds)
var crossFadeDuration = 2;
 
// Specify the image files
var Caption = new Array();
var Pic = new Array();
// Specify the categories  // must match the images
var catArray = new Array();
 
// to add more images, just continue
// the pattern, adding to the array below
Caption[0]  = "Pierced Rings";
Pic[0] = 'images/piercedRings.jpg';
catArray[0] = 'products.php?cat=21';  // corresponse to image array

Caption[1]  = "Gold Body Jewelry";
Pic[1] = 'images/goldBodyJewelry.jpg';
catArray[1] = 'products.php?cat=28';  // corresponse to image array

Caption[2]  = "Logo Eyebrow";
Pic[2] = 'images/eyebrow.jpg';
catArray[2] = 'products.php?cat=24';  // corresponse to image array



/*
Caption[3]  = "Gold Body Jewelry";
Pic[3] = 'images/mutiRing.jpg';
catArray[3] = 'products.php?cat=28';  // corresponse to image array
*/
 
// preload images
t=null;
var p = Pic.length;
var preLoad = new Array();
for (i = 0; i < p; i++){
   preLoad[i] = new Image();
   preLoad[i].src = Pic[i];
}
 
function rotate(num){
 x=num%preLoad.length;
 if(x<0){x=preLoad.length-1};
 if (document.all){
      document.images.show.style.filter="blendTrans(duration=2)"
      document.images.show.style.filter="blendTrans(duration=crossFadeDuration)"
      document.images.show.filters.blendTrans.Apply()      
   }
   if (document.getElementById) document.getElementById("CaptionBox").innerHTML= Caption[x];
   document.images.show.src=preLoad[x].src
 if (document.all){
      document.images.show.filters.blendTrans.Play()
   }
}
 
function apRotate() {
  rotate(++x);
  clearTimeout(t);
  t=window.setTimeout("apRotate()", 10000);
}
 
function viewCategory(x){
 location.href=catArray[x];
}

