
/*This code goes onto the index page 
<div class="center">
<noscript>
<img src="/images/rotating_images/01.jpg" alt="" id="rotating_image" />
</noscript>
<script language="javascript" type="text/javascript" src="/hhs/rotating_images/rotating_images.js">
</script></div>*/





// Enter the settings in the fields below.

number_of_images       =      7;  //(the total number of images to choose from)
transition_interval    =      5;  //(the interval between transitions in seconds)
random_or_consecutive  =      1;  //(behavior of transitions; 1=random, 0=consecutive)
file_extention         =  "jpg";  //(extention of image files; "png", "jpg", "gif", etc.)





/////////////////////////////////
// DO NOT EDIT BELOW THIS LINE //
/////////////////////////////////

// Script by Morgan Brackett

// Set a random image for a starting point
today=new Date();
jran=(today.getTime()*9301+49297) % 233280;
n=Math.ceil((jran/(233280*1.0))*number_of_images);
document.write("<img src='images/rotating_images/"+n+"."+file_extention+"' alt='' id='rotating_image' />");
// Function to rotate image after it's set
if (random_or_consecutive==1) {
  function rotate() {
    init=n;
    while (n==init) {
      today=new Date();
      jran=(today.getTime()*9301+49297) % 233280;
      n=Math.ceil((jran/(233280*1.0))*number_of_images);
    }
    document.getElementById('rotating_image').src='images/rotating_images/'+n+"."+file_extention;
  }
} else {
  function rotate() {
    if (n<number_of_images) { n++; } else { n=1; }
    document.getElementById('rotating_image').src='images/rotating_images/'+n+"."+file_extention;
  }
}

function preload() {
  // Preload images
  for (i=1;i<=number_of_images;i++) {
    pic=new Image();
    pic.src="/images/rotating_images/"+i+"."+file_extention;
  }
  // Initiate rotation interval
  setInterval("rotate()", transition_interval*1000);
}

document.images.onLoad = preload();