﻿// JScript File

//variable that will increment through the images
<!--

var gStep=0;
var gIconPath, gImagePath;

function slideit()
{
    var maxvalue = gMyImages.length;

    //if browser does not support the image object, exit.
    if (!document.images)
    return;
    

    gStep++;
    if (gStep<maxvalue)
        showstep(gStep);
    else
        gStep=0;
    //call function "slideit()" every 8 seconds
    var temp = "slideit()";
    setTimeout(temp,8000);
}

function showstep( value )
{
    if (!document.images)
    return;

    var maxvalue = gMyImages.length;
    gStep = value;
    
    if ( gStep >= 0 && gStep < maxvalue )
    {   
        var newimage = new Image();
        newimage.src = gImagePath + gMyImages[gStep];
        document.images.slide.src = newimage.src; 
        document.getElementById("divNext").style.display = 'block';
        document.getElementById("divPrevious").style.display = 'block';
        
        if (gStep == 0)
        {
            document.getElementById("divPrevious").style.display = 'none';
        }
        
        if (gStep == maxvalue - 1)
        {
            document.getElementById("divNext").style.display = 'none';
        }
    }
  
}


function shownextstep( )
{
    showstep(gStep + 1);
}

function showpreviousstep(  )
{
    showstep(gStep-1);
}



function displaythumbnails( iconpath, imagepath )
{
    gIconPath = iconpath;
    gImagePath = imagepath;
    var maxvalue = gMyImages.length;
    
    if (gStep == 0)
    {
        document.getElementById("divPrevious").style.display = 'none';
    }
    
    if (gStep == maxvalue - 1)
    {
        document.getElementById("divNext").style.display = 'none';
    }
    
    var displaytext;
    for ( i=0; i < maxvalue; i++ )
    {
        displaytext = '<dd><a href="javascript:showstep(' + i + ');"><img alt="" src="' + iconpath + gMyImages[i] + '" /></a></dd>';
        document.write(displaytext);
        if( (i+1) % 5 == 0 && i != 0 && i != maxvalue -1 )
            document.write('</dl><dl>');
    }
    
}


//-->