if (ROLL_Images == null)
  var ROLL_Images = new Array();

var ROLL_CurIndex = 0, ROLL_NumOfImages = 0, ROLL_Timeout;
var ROLL_id = 0;

function ROLL_Change()
{
  if (ROLL_CurIndex >= ROLL_NumOfImages - 1)
    ROLL_CurIndex = 0;
  else
    ROLL_CurIndex++;
  if (!DIMG_Images[ROLL_id].IsChanged)
    document.images[ROLL_id].src = ROLL_Images[ROLL_CurIndex];
  setTimeout("ROLL_Change()", ROLL_Timeout);
}
/*function ROLL_GetStart()
{
  ROLL_StartIndex = DIMG_Images.length;
}

function ROLL_GetEnd()
{
  ROLL_EndIndex = DIMG_Images.length - 1;
}*/

function ROLL_Register( name )
{
  ROLL_Images[ROLL_NumOfImages++] = new String(name);
} 


function ROLL_Start( id, timeout )
{
  ROLL_CurIndex = Math.ceil(Math.random()*ROLL_NumOfImages);
  ROLL_Timeout = timeout;
  ROLL_id = id;
  ROLL_Change();
}
