﻿//author: Blake Anderson
//	7/25/05
// copyright 2005 Blaqware Productions

currentImage = 0;
imageDirectory = "images/gallery/seniors/";

function GalleryBar( imageMargin )
{
    for( x=0; x<ImageList.length; x++ )
    {
	Thumbnail = getThumbnail( ImageList[x] );
	onclickf="setNewGalleryImage("+x+")"
	document.write( "<img style='cursor: pointer; margin: "+imageMargin+"' src="+Thumbnail+" onclick="+onclickf+" >" );
    }
}

function PrevNextButtons( )
{
    document.write( "<span onClick='previousImage()' onSelectStart='return false' style='cursor: pointer'>prev</span> | <span onClick='nextImage()' onSelectStart='return false' style='cursor: pointer'>next</span>" )
}

function setNewGalleryImage( theImage )
{
    currentImage = theImage;
    temp = imageDirectory+ImageList[theImage];
    theScreenImage = "url( "+temp+" )";
    theScreen = document.getElementById( "thescreen" );
    theScreen.style.backgroundImage=theScreenImage
	theScreen.style.width = w[theImage]-2;
    theScreen.style.height= h[theImage];
    
    //if( navigator.userAgent.indexOf("Firefox") > -1 )
    if( navigator.appName == "Netscape" )
    {
	document.getElementById( "title" ).innerHTML = title[theImage];
    }
    else
    {
	document.getElementById( "title" ).innerText = title[theImage];
    }
    
}

function GalleryScreen( )
{
    document.write( "<table border=1 onSelectStart='return false'><tr><td id='thescreen'></td></tr></table>" );
}
	
function SetGalleryFile( GalleryFile )
{
    document.write("<script src="+GalleryFile+"></script>");
}

function getThumbnail( theImage )
{
    theImage = theImage.substring( 0, theImage.length-4 );
    //must be a jpg image
    return imageDirectory+theImage+"_t.jpg";
}

function previousImage( )
{
    currentImage--;
    if( currentImage < 0 )
	currentImage = ImageList.length-1;
    setNewGalleryImage( currentImage );
}

function nextImage( )
{
    currentImage++;
    if( currentImage > ImageList.length-1 )
	currentImage = 0;
    setNewGalleryImage( currentImage );
}
