// JScript File
// Written by Luc Hamonic for the Vanessa Scott-Thompson website
// Copyright 2005,2006 by Luc Hamonic
// Unauthorized use will result in a supreme ass whoopin

var maxImages = 1;
var iCurrentGallery = 0; // This points to the default image
var iCurrentImage = 1;
//var GalleryPrefix; // this is temporary, later this will be set in the page itself

// Load the gallery information
// we'll still do this here for now
// the number of gallery names *must* match the entries for MaxImages

//var arrGalleryNames = ["","Knickers!","Lu Cozma","Edison","Boys of Summer","Squat","Alpha II","Paddington with MCK","On the Pull with MCK"]
//var arrGalleryMaxImages = [1,6,4,10,9,3,5,6,5]
LoadGallery(GalleryPrefix)

// do not modify below this line

var maxGalleries = arrGalleryNames.length;

var user
var domain
var suffix

function ShowAvatar()
{
    document.write('<img alt="MCK+VST Photography" src="' + AvatarImage + '" />');

}

function emailto(user, domain, suffix)
{
    // this is a no harvester for the email address so that it will not show
    // up in the html page itself
    location.href='mailto:' + user + '@' + domain + '.' + suffix

}

function jemail1(user, domain, suffix)
{
    // this is a no harvester for the email address so that it will not show
    // up in the html page itself
    document.write('<a href="' + 'mailto:' + user + '@' + domain + '.' + suffix + '">');
}
function jemail2()
{
    document.write('</a>');
}

function SetGallery(GalleryNumber)
{
    // this chooses the gallery based on the link clicked
    iCurrentGallery = GalleryNumber;
    iCurrentImage = 1;
    if ( GalleryNumber == 99 )
    {
        // 99 is the contact details
        maxImages = 1;
    }
    else if ( GalleryNumber == 98 )
    {
        // 98 is the MCK+VST information image
        maxImages = 1;
    }
    else
    {
        maxImages = arrGalleryMaxImages[GalleryNumber];
    }
    swap();
}

function ShowGalleryList()
{
    // this will generate the links for the gallery list based on the 
    // contents of the arrays
    for (var loop = 1; loop < maxGalleries; loop++)
    {
        var elementid = 'gallerylink' + loop;
        document.write('<span style="cursor: hand;" onmouseover="SetBold(' + loop + ')"  onmouseout="UnSetBold(' + loop + ')" id="' + elementid + '" onclick="SetGallery(' + loop + ')">' + arrGalleryNames[loop]+ '</span><br>');
    }
}

function SetBold(GalleryNumberID)
{
    if (document.getElementById)
    {
        document.getElementById('gallerylink' + GalleryNumberID).style.fontWeight = 'bold';
    }
}

function UnSetBold(GalleryNumberID)
{
    if (document.getElementById)
    {
        document.getElementById('gallerylink' + GalleryNumberID).style.fontWeight = 'normal';
    }
}

function NextImage()
{
    // This will select the next image and also checks for the max image
    // If we're looking at Gallery 99, that means we're looking at the contact details and
    // we should redirect to the mailto:
    if ( iCurrentGallery == 99 )
    {
        // set the email link here
        // this is the contact image
        // emailto("vanessa","vscott-thompson", "com")
        emailto("info","mck-vst","com")
    }
    else if ( iCurrentGallery == 98 )
    {
        // set the email link here
        // this is the contact image
        // emailto("vanessa","vscott-thompson", "com")
        location.href("main.html");
    }
    else
    {
        var tempNewImage = iCurrentImage + 1;
        if ( tempNewImage > maxImages )
        {
            tempNewImage = 1;
        }
        iCurrentImage = tempNewImage;
        swap();
    }
}
function gohome() {
        location.href("main.html");

}
function swap() {
    // This changes the Image and updates the text for the image
    var tempText;
    var tempImage;
    if ( iCurrentGallery == 99 )
    {
        // the contact mage
        tempImage = "images/contact2.jpg";    
        tempText = "Contact Details";
    }
    else if ( iCurrentGallery == 98 )
    {
        if ( GalleryPrefix == 'j' )
        {
        // the MCK+VST information image
        tempImage = "images/blurb.jpg";    
        tempText = "About MCK+VST";
        }
        if ( GalleryPrefix == 'm' )
        {
        location.href("main.html");
        }
        if ( GalleryPrefix == 'v' )
        {
        location.href("main.html");
        }
        
    }
    else
    {
        // everything else that comes though
        tempImage = "gallery_" + GalleryPrefix + "/"+ GalleryPrefix + iCurrentGallery + "_" + iCurrentImage + ".jpg";
        tempText = arrGalleryNames[iCurrentGallery] + ' Image ' + iCurrentImage + ' of ' + maxImages;
    }
    document['imgMain'].src = tempImage;
    document.getElementById("gallerycount").firstChild.nodeValue=tempText;
}

//-->
