
// Cameron Gregory - http://www.bloke.com/
// http://www.bloke.com/javascript/RandomBackground/
// This line and about must remain .. then you can use it for free...
//
// Sat May 29 13:32:01 EDT 1999
// created from Random/

// Usage:
//  RandomBackground(images,bodyTags)
//     images		is space or comma separated file list
//     bodyTags		addition tags to <body>

function RandomBackground(images,btags)
{
/* si: start index
** i: current index
** ei: end index
** cc: current count
*/
 si = 0;
 ci=0;
 cc=0;
 imageSet = new Array();
 ei = images.length;
  for (i=1;i<ei;i++) {
    if (images.charAt(i) == ' ' || images.charAt(i) == ',') {
      imageSet[cc] = images.substring(si,i);
      cc++;
      si=i+1;
      }
    }
  ind = Math.floor(Math.random() *cc);
  document.writeln("<body "+btags+" background=\""+imageSet[ind]+"\">");
}

//function RandomBackground(images)
//{
  //RandomBackground(images,"");
//}


