// function to open the pop-up detail window
function openWindow(SiteName, WindowName) {
  window.open(SiteName,WindowName,'width=600,height=450,scrollbars=1,location=0,menubar=1,resizable=yes'); 
  return}

// function to allow image swaps within the pop-up detail window
function swapImage(WhichImage, TotalImages) {
	document.images['artimage'].src = eval('artimg' + WhichImage + '.src');
 	for(i=1; i<=TotalImages; i++) { 
    document.getElementById('l' + i); 
    }
	document.getElementById('l' + WhichImage);

	var CurrImage = WhichImage;
	return}

// utility function to pad leading zeros
function padDigits(n, totalDigits) { 
  n = n.toString(); 
  var pd = ''; 
  if (totalDigits > n.length) { 
    for (i=0; i < (totalDigits-n.length); i++) { 
      pd += '0'; 
    } 
  } 
  return pd + n.toString(); } 

// Various constants for the thumb functions
var TotalThumbs = 15; // total thumbnails to cycle through
var TimeInterval = 3000; // interval time in milliseconds 
var ThumbCurr = new Image() // declare the image

//function to start thumbnail rotation service
function startThumb() { 
  setInterval("getThumbNail()", TimeInterval); } 
  
//function to select a thumbnail at random  
function getThumbNail() {
  var ThumbNo = Math.floor(Math.random()*TotalThumbs+1)
  ThumbCurr.src = "thumbNails/thumbNail"+padDigits(ThumbNo, 2)+".jpg"
  document["ChangingThumb"].src = ThumbCurr.src
  }
  

