var popUpWin = 0;

//
// change the image source
//
function changeImage(imageName, changeTo) {
	document.getElementById(imageName).src=changeTo
}

//
// show photo in a new window
//
function showPhoto(collection, imageDir, whichPhoto) {
	parent.picture.aPhoto.src = imageDir + '/' + whichPhoto;
	parent.picture.aPhotoName.innerHTML = collection + ' : ' + whichPhoto;
}

//
// refresh the thumbnail with a new collection
//
function loadCollection() {
	parent.photos.location = parent.picture.myPhotoCollections.value;
}

//
// create a popup photo album window
//
function showAlbumWindow(URLStr)
{
	popUpCentralWindow(URLStr, screen.width - 100, screen.height - 100, 'yes');
}

//
// create a popup slideshow window
//
function showSlideshow(slideshow, width, height)
{
	popUpCentralWindow('slideshow.html?id=' + slideshow + '&width=' + width + '&height=' + height, width + 50, height + 80, 'no');
}

//
// create a popup window
//
function popUpWindow(URLStr, left, top, width, height, resize)
{
  if (popUpWin)
  {
    if (!popUpWin.closed) popUpWin.close();
  }
  scrollBar = "no";
  if (resize == "yes")
     scrollBar = "yes";
  popUpWin = open(URLStr, 'popUpWin', 'toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars='+scrollBar+',resizable='+resize+',copyhistory=yes,width='+width+',height='+height+',left='+left+', top='+top+',screenX='+left+',screenY='+top+'');
}

//
// create a popup window in the middle of the browser screen
//
function popUpCentralWindow(URLStr, width, height, resize)
{
	leftTopX = 0;
	if (screen.width > width)
		leftTopX = (screen.width - width) / 2;
	leftTopY = 0;
	if (screen.height > height)
		leftTopY = (screen.height - height) / 2;
	popUpWindow(URLStr, leftTopX, leftTopY, width, height, resize);
}

//
// display church map direction
//
function popUpMapDirectionWindow()
{
	popUpCentralWindow('direction.html', 560, 480, 'no');
}
