
//   '
//   'Global variables for the scrolling new product display
   var showNewProductsMode=4; //0=Reset; 1=Pause; 2=Scroll right in; 3=scroll all; 4=scroll left off
   var showNewProductsCount=0; // The number of counts while in this mode
   var showNewProductsIndex = 0; //Index into the array of new products
   var showNewProductsImageIndex = 0; //The index that sequences through the images
//   'The image URL for each product to display. Any number of products supported.
   var showNewProductsSrc= []; //Array of images to cycle through
//   'The HRef link for each product to display. Positions must match array above.
   var showNewProductsHref= []; //Array of HRefs that match the images
//   'The Title text for each product to display. Not really that easy to read
   var showNewProductsTitle= []; //Array of Title Text that matches the images
//   '
//   'This function initializes the scrolling product display. It pre-loads the last three images from the list.
   function showNewProductsInitialize() {
      document.getElementById('NewProduct1').style.left= -500;
      document.getElementById('NewProduct1').style.top= 0;
      document.getElementById('NewProduct1').src= showNewProductsSrc[showNewProductsSrc.length-1];
      document.getElementById('NewProduct1A').href= showNewProductsHref[showNewProductsHref.length-1];
      document.getElementById('NewProduct1').title= showNewProductsTitle[showNewProductsTitle.length-1];
      document.getElementById('NewProduct2').style.top= 0;
      document.getElementById('NewProduct2').src= showNewProductsSrc[showNewProductsSrc.length-2];
      document.getElementById('NewProduct2A').href= showNewProductsHref[showNewProductsHref.length-2];
      document.getElementById('NewProduct2').title= showNewProductsTitle[showNewProductsTitle.length-2];
      document.getElementById('NewProduct3').style.top= 0;
      document.getElementById('NewProduct3').src= showNewProductsSrc[showNewProductsSrc.length-3];
      document.getElementById('NewProduct3A').href= showNewProductsHref[showNewProductsHref.length-3];
      document.getElementById('NewProduct3').title= showNewProductsTitle[showNewProductsTitle.length-3];
      document.getElementById('NewProduct4').style.top= 0;
      document.getElementById('NewProduct4').src= showNewProductsSrc[showNewProductsSrc.length-4];
      document.getElementById('NewProduct4A').href= showNewProductsHref[showNewProductsHref.length-4];
      document.getElementById('NewProduct4').title= showNewProductsTitle[showNewProductsTitle.length-4];
      document.getElementById('NewProduct5').style.top= 0;
      document.getElementById('NewProduct5').src= showNewProductsSrc[showNewProductsSrc.length-5];
      document.getElementById('NewProduct5A').href= showNewProductsHref[showNewProductsHref.length-5];
      document.getElementById('NewProduct5').title= showNewProductsTitle[showNewProductsTitle.length-5];
      document.getElementById('NewProduct6').style.top= 0;
      document.getElementById('NewProduct6').src= showNewProductsSrc[showNewProductsSrc.length-6];
      document.getElementById('NewProduct6A').href= showNewProductsHref[showNewProductsHref.length-6];
      document.getElementById('NewProduct6').title= showNewProductsTitle[showNewProductsTitle.length-6];
      document.getElementById('NewProduct7').style.top= 0;
      document.getElementById('NewProduct7').src= showNewProductsSrc[showNewProductsSrc.length-7];
      document.getElementById('NewProduct7A').href= showNewProductsHref[showNewProductsHref.length-7];
      document.getElementById('NewProduct7').title= showNewProductsTitle[showNewProductsTitle.length-7];
      document.getElementById('NewProduct8').style.top= 0;
      document.getElementById('NewProduct8').src= showNewProductsSrc[showNewProductsSrc.length-8];
      document.getElementById('NewProduct8A').href= showNewProductsHref[showNewProductsHref.length-8];
      document.getElementById('NewProduct8').title= showNewProductsTitle[showNewProductsTitle.length-8];
      showNewProducts();
      }
//   '
//   'This function does the scrolling new product display animation.
   function showNewProducts() {
      switch(showNewProductsMode) {
//         'Pause so that the user can see the three tiles ont he display
         case 1:
           if (showNewProductsCount>=750) {
              showNewProductsMode= 2;
              showNewProductsCount= 0;
              }
           break;
//         'Scroll in the left-hand tile
         case 2:
            document.getElementById('NewProduct1').style.left=showNewProductsCount-100;
            if (showNewProductsCount>=50) {
               showNewProductsMode= 3;
               showNewProductsCount= 0;
               }
            break;
//         'Scroll all tiles to the next position
         case 3:
            document.getElementById('NewProduct1').style.left=showNewProductsCount-50;
            document.getElementById('NewProduct2').style.left=showNewProductsCount+50;
            document.getElementById('NewProduct3').style.left=showNewProductsCount+150;
            document.getElementById('NewProduct4').style.left=showNewProductsCount+250;
            document.getElementById('NewProduct5').style.left=showNewProductsCount+350;
            document.getElementById('NewProduct6').style.left=showNewProductsCount+450;
            document.getElementById('NewProduct7').style.left=showNewProductsCount+550;
            document.getElementById('NewProduct8').style.left=showNewProductsCount+650;
//            'The following must be set to the image width
            if (showNewProductsCount>=100) {
               showNewProductsMode= 4;
               showNewProductsCount= 0;
               }
            break;
//         'Scroll out the end tile
         case 4:
            document.getElementById('NewProduct8').style.left=showNewProductsCount+750;
            if (showNewProductsCount>=50) {
               showNewProductsMode=0;
               showNewProductsCount=0;
               }
            break;
//         'Reset things for the next new tile
         default:
//            ' Shift all of the images down one position
//            ' Product 8
            document.getElementById('NewProduct8').src= document.getElementById('NewProduct7').src;
            document.getElementById('NewProduct8').style.left= 650;
            document.getElementById('NewProduct8A').href= document.getElementById('NewProduct7A').href;
            document.getElementById('NewProduct8').title= document.getElementById('NewProduct7').title;
//            ' Product 7
            document.getElementById('NewProduct7').src= document.getElementById('NewProduct6').src;
            document.getElementById('NewProduct7').style.left= 550;
            document.getElementById('NewProduct7A').href= document.getElementById('NewProduct6A').href;
            document.getElementById('NewProduct7').title= document.getElementById('NewProduct6').title;
//            ' Product 6
            document.getElementById('NewProduct6').src= document.getElementById('NewProduct5').src;
            document.getElementById('NewProduct6').style.left= 450;
            document.getElementById('NewProduct6A').href= document.getElementById('NewProduct5A').href;
            document.getElementById('NewProduct6').title= document.getElementById('NewProduct5').title;
//            ' Product 5
            document.getElementById('NewProduct5').src= document.getElementById('NewProduct4').src;
            document.getElementById('NewProduct5').style.left= 350;
            document.getElementById('NewProduct5A').href= document.getElementById('NewProduct4A').href;
            document.getElementById('NewProduct5').title= document.getElementById('NewProduct4').title;
//            ' Product 4
            document.getElementById('NewProduct4').src= document.getElementById('NewProduct3').src;
            document.getElementById('NewProduct4').style.left= 250;
            document.getElementById('NewProduct4A').href= document.getElementById('NewProduct3A').href;
            document.getElementById('NewProduct4').title= document.getElementById('NewProduct3').title;
//            ' Product 3
            document.getElementById('NewProduct3').src=document.getElementById('NewProduct2').src;
            document.getElementById('NewProduct3').style.left= 150;
            document.getElementById('NewProduct3A').href= document.getElementById('NewProduct2A').href;
            document.getElementById('NewProduct3').title= document.getElementById('NewProduct2').title;
//            ' Product 2
            document.getElementById('NewProduct2').src= document.getElementById('NewProduct1').src;
            document.getElementById('NewProduct2').style.left= 50;
            document.getElementById('NewProduct2A').href= document.getElementById('NewProduct1A').href;
            document.getElementById('NewProduct2').title= document.getElementById('NewProduct1').title;
//            ' Product 1 (New image to introduce)
            document.getElementById('NewProduct1').style.left= -150;
            document.getElementById('NewProduct1').src= showNewProductsSrc[showNewProductsImageIndex];
            document.getElementById('NewProduct1A').href= showNewProductsHref[showNewProductsImageIndex];
            document.getElementById('NewProduct1').title= showNewProductsTitle[showNewProductsImageIndex];
//            ' If this is the last image,then wrap around on the list of them.
            showNewProductsImageIndex++;
            if (showNewProductsImageIndex>(showNewProductsSrc.length-1)) {
               showNewProductsImageIndex= 0;
               }
            showNewProductsMode= 1;
            showNewProductsCount= 0;
         }
//      'Set the number of pixels to shift the images each update. 100 must divide by this number with no remainder to aboid jerkyness
      showNewProductsCount+= 5;
//      'Set the time of the next refresh. Cannot be too small or can error.
      setTimeout('showNewProducts()',25);
      }
