var image_path            = "images/";
var product_images        = new Array();
var product_images_large  = new Array();
var preloadedImages       = new Array();
var preloadedImages_large = new Array();
var counter               = 0;

function loadPhotos(photos, photos_large)
{
   for(var i=0; i< photos.length; i++)
   {
      product_images[i]       = photos[i];
      product_images_large[i] = photos_large[i];
   }
}

function preloadImages()
{
   for (i=0;i<photos.length;i++)
   {
      preloadedImages[i]           = new Image();
      preloadedImages_large[i]     = new Image();
      preloadedImages[i].src       = image_path + product_images[i];
      preloadedImages_large[i].src = image_path + product_images_large[i];
   }
}

function moreImages()
{
   loadPhotos(photos, photos_large);
   preloadImages();

   if (counter < preloadedImages.length-1)
   {
      counter++;
      document.images.productImage.src                 = preloadedImages[counter].src;
      document.getElementById('productImageLg').href   = preloadedImages_large[counter].src;
   }

   if(counter == preloadedImages.length-1)
   {
     counter = -1;
   }

}
