// Class change function. Both params are strings
 function classChange( id, newclass )
  {
    element = document.getElementById(id);
    if(element)
      element.className = newclass ;
  }


// A random number generator with bounds set by parameters
function getRandomNum(lbound, ubound) {
  return (Math.round(Math.random() * (ubound - lbound)) + lbound);
}

function PopupPic(sPicURL,caption){
	var newStr = sPicURL;
	//alert("Input string = " + sPicURL);
	//alert("Output string = " + newStr);
	//alert("Caption = " + caption);
	  popupWin=window.open("./popup.html?"+newStr, "", 
	  "resizable=1,scrollbars=0,HEIGHT=100,WIDTH=100");
	   popupWin.document.title=caption
	}

function myopen(filename,windowname,properties) {
    mywindow = window.open(filename,windowname,properties);
}
	

// copyright 1998 Idocs, Inc. http://www.idocs.com/tags/
// Distribute this script freely, but please keep this 
// notice with the code.

// var image information object
var mloi=new Object();

// set the image for swapping
function setswap()
{
if (! document.images)return;
var imgInfo=new Object();
imgInfo.defaultImg = new Image();
imgInfo.defaultImg.src = document.images[arguments[0]].src;
imgInfo.opts = new Object();
for (var i=1; i < arguments.length; i=i+3)
   {
   imgInfo.opts[arguments[i]]=new Image();
   imgInfo.opts[arguments[i]].src = arguments[i+1];
   imgInfo.opts[arguments[i]].link = arguments[i+2];
   }
mloi[arguments[0]] = imgInfo;
}

// set up the link for swapping
function swap(link,imgName,optName)
{
if (! document.images)return;
if (! link.swapReady)
   {   
   link.imgName    = imgName;
//   link.onmouseout = swapBack;
   link.swapReady  = true;
   }
document.images[imgName].src=mloi[imgName].opts[optName].src;
linkaddress=mloi[imgName].opts[optName].link;
//alert('linkaddress = ',linkaddress)
}

function swapBack()
{return}
//{document.images[this.imgName].src=mloi[this.imgName].defaultImg.src}

function gotopage()  // go to the page associated with the current thumbnail image
{
	//alert('Go to webpage ' + linkaddress);
	window.open(linkaddress)
	//location.href = linkaddress
}



function makeArray() {
	 for (i = 0; i<makeArray.arguments.length; i++)
		  this[i + 1] = makeArray.arguments[i];
}

function formatDate(theDate) {
//	document.write('<BR><BR><BR>' + "Running formatDate on: " + theDate + '<BR>');
	var day  = theDate.getDate();
//	document.write("day = " + day + '<BR>');
	var month = theDate.getMonth() + 1;
//	document.write("month = " + month + '<BR>');
	var yy = theDate.getYear();
//	document.write("yy = " + yy + '<BR>');
	var year = (yy < 1000) ? yy + 1900 : yy;
//	document.write("year = " + year + '<BR>');
	return day + " " + months[month] + " " + year
}

var months = new makeArray('January','February','March',
	'April','May','June','July','August','September',
	'October','November','December');


