    // This script is copywrited and is the soleproperty of Your Store Wizards, www.yourstorewizards.com
    // It may not be used, copied, sold or reproduced in any form without the express written consent of Your Store Wizards, www.yourstorewizards.com

var startItem = 0;
var randNumbers=new Array();
var randShow = 0;
var randSeconds = 0;
var randMove = 0;
var randCount = 0;
var randloop = 0;

function randOrd(a, b)
  { return (Math.round(Math.random())-0.5); } 

function randSetup()
{

  for (randloop=0; randloop<randCount; randloop++)
  {
     randNumbers[randloop]=randloop;
  }

  randNumbers.sort( randOrd );

  for (randloop=0; randloop<randShow; randloop++)
  {
     if (document.getElementById('ysw-random-'+randloop)) {
     document.getElementById('ysw-random-'+randloop).innerHTML = randItems[randNumbers[randloop]];
     }
     if (document.getElementById('ysw-random-2-'+randloop)) {
     document.getElementById('ysw-random-2-'+randloop).innerHTML = randItems2[randNumbers[randloop]];
     }
  }  
  if (randSeconds > 0) 
  {
     setTimeout("randNext(randMove,1)",randSeconds * 1000);
  }
}

function randNext(numberToMove, autoMove)
{
  startItem = startItem + numberToMove; 
  for (randloop=0; randloop<randShow; randloop++)
  {
     if ((startItem+randloop) >= randCount)
     {
        startItem = startItem - randCount;
     }
     if ((startItem+randloop) < 0)
     {
        startItem = startItem + randCount;
     }

     if (document.getElementById('ysw-random-'+randloop)) {
     document.getElementById('ysw-random-'+randloop).innerHTML = randItems[randNumbers[startItem+randloop]];
     }
     if (document.getElementById('ysw-random-2-'+randloop)) {
     document.getElementById('ysw-random-2-'+randloop).innerHTML = randItems2[randNumbers[startItem+randloop]];
     }
  }  
  if (autoMove == 1 && randSeconds > 0) {
     setTimeout("randNext(randMove,1)",randSeconds * 1000);
  }
  else {
    setTimeout("",0);
  }
}

function randPrev(numberToMove)
{
  startItem = startItem - numberToMove; 
  for (randloop=0; randloop<randShow; randloop++)
  {
     if ((startItem+randloop) >= randCount)
     {
        startItem = startItem - randCount;
     }
     if ((startItem+randloop) < 0)
     {
        startItem = startItem + randCount;
     }

     if (document.getElementById('ysw-random-'+randloop)) {
     document.getElementById('ysw-random-'+randloop).innerHTML = randItems[randNumbers[startItem+randloop]];
     }
     if (document.getElementById('ysw-random-2-'+randloop)) {
     document.getElementById('ysw-random-2-'+randloop).innerHTML = randItems2[randNumbers[startItem+randloop]];
     }
  }  
}
