//*******		FILENAME:  PageTurner.js (Top Window Code) 	*******//

//*******	Artware Button Management										*******//
//*******			Copyright 2005 by Artware Studios, Inc.  			*******//
//*******		Include in mainMenu.php									*******//
//###																					#####
//#####--->>>	Standard Package: Not Customized.						#####
//###																					#####

var archiveFileIndex = 0;
var galleryFileIndex = 0;
var onGallery = true;
var files;

function NextImage() 
{//Called by Next button in contentFrame.
    if(onGallery == true) {
    fileIndex = galleryFileIndex;
    }
    else {
    fileIndex = archiveFileIndex;
    }
    if(fileIndex + 1 >= files.length) {
    fileIndex = 0;
    }
    else {
    fileIndex++;
    }
    parent.contentFrame.document.images['Picture'].src = files[fileIndex];
    if(onGallery == true) {
    galleryFileIndex = fileIndex;
    }
    else {
    archiveFileIndex = fileIndex;
    }
}//function NextImage()

function PreviousImage() 
{//Called by Previous button in contentFrame.
    if(onGallery == true) {
    fileIndex = galleryFileIndex;
    }
    else {
    fileIndex = archiveFileIndex;
    }
    if(fileIndex - 1 < 0) {
    fileIndex = files.length - 1;
    }
    else {
    fileIndex--;
    }
    parent.contentFrame.document.images['Picture'].src = files[fileIndex];
    if(onGallery == true) {
    galleryFileIndex = fileIndex;
    }
    else {
    archiveFileIndex = fileIndex;
    }
}//function PreviousImage()

function initPageTurner() 
{//Called onload from main menu.
    files = GalleryFiles;
    onGallery = true;
}//function initPageTurner()

function GallerySelect() {
    files = GalleryFiles;  // should copy by reference
    onGallery = true;
//  	 parent.contentFrame.location.href = "GalleryContent.html";
}

//function loadGalleryImage()	//needed???
//{
//    parent.GalleryContentFrame.location.href = ("blank.php?name=" + theFiles[galleryIndex]);
//}

function ArchiveSelect() 
{//Called from Archive button in main menu.
    files = ArchiveFiles;  // should copy by reference
    onGallery = false;
//  	 parent.contentFrame.location.href = "ArchiveContent.html";
}//function ArchiveSelect()

function showImage(imageName) 
{//Called from index page.
  onGallery = false;
  files = ArchiveFiles;
  imageName = "images/archive/" + imageName;
  for(var x = 0; x < ArchiveFiles.length; x++)
  {
     if(ArchiveFiles[x] == imageName) 
	  {
        archiveFileIndex = x;
     }
  }
  doClick(ARCHIVE);
  parent.contentFrame.location.href = "ArchiveContent.html";
}//function showImage(imageName)

//*******	Artware Button Management										*******//

