// product_rotator.js //////////////////////////////////////////////////////////////////////////////////////////////////
// rotates through an array of products in intervals of 5 seconds
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

var products = new Array();
var counter = 0;

// initiate toggling
window.onload = function () {

   try {
      runSlideShow();
   } catch(err){}

   // get all divs, then push product divs into array
   var divs = document.getElementsByTagName('div');
   for(var i = 0; i < divs.length; i++) {
      if(divs[i].className == 'property') {
         this.products.push(divs[i]);
      }
   }

   // display first piece of merchandise
   this.products[0].style.display = 'block';

   // toggles property
   setInterval('toggle()',10000);
}

// toggles the display property of an element
function toggle()
{
   this.products[this.counter].style.display = 'none';
   this.counter++;

   // reset counter
   if(this.counter == this.products.length) {
      this.counter = 0;
   }

   this.products[this.counter].style.display = 'block';
}