VirtualTour = 
{
   init: function(dir) 
   {
      if (isTransform3DAvailable()) 
      {
         this.setup(dir);
      }
   },
   setup: function(dir) 
   {
      var container = document.getElementById('vr-container');
      var position = document.getElementById('vr-position');
      var cube = document.getElementById('cube');
      var images;
      var imagesWidth;
      var imagesHeight;

      if (!AC.Detector.isiPhone()) 
      {
         images = [
            "full/front.jpg",
            "full/right.jpg",
            "full/back.jpg",
            "full/left.jpg",
            "full/up.jpg",
            "full/down.jpg"
         ];
         
         imagesWidth = 3000;
         imagesHeight = 3000;
      } 
      else 
      {
         images = [
            "iphone/front.jpg",
            "iphone/right.jpg",
            "iphone/back.jpg",
            "iphone/left.jpg",
            "iphone/up.jpg",
            "iphone/down.jpg"
         ];
         imagesWidth = 600;
         imagesHeight = 600;
      }

      var imageDocumentFragment = document.createDocumentFragment();
      
      for (var i = 0, countI = images.length, img; (imageURL = images[i]); i++) 
      {
         img = new Image();
         img.src = dir + "/" + imageURL;
         img.id = "face" + (i + 1);
         img.className = "face";
         img.width = imagesWidth;
         img.height = imagesHeight;
         imageDocumentFragment.appendChild(img);
      }
      
      cube.appendChild(imageDocumentFragment);

      this._gSpinner = new Spinner(document.getElementById('rotateX'), document.getElementById('rotateY'), 
         document.getElementById('rotor-x'), document.getElementById('rotor-y'), 
         container, position, 
         1000, 400, 3000, 
         -0.2, 0.6);

      container = null;
      imageDocumentFragment = null;
   }
};

