
//========================================================================
//  DEFINE ARRAYS
//========================================================================
var ImageFilePath = new Array()
var ImageURL = new Array()
 
//========================================================================
//  A.J. : MODIFY THIS SECTION
//========================================================================
var PixelsWide = 500;
var TotalImages = 5;
 
// these are the URL's to the images that will be displayed
 
ImageFilePath[0] = "images/LeatherSlideshow1.jpg";
ImageFilePath[1] = "images/LeatherSlideshow2.jpg";
ImageFilePath[2] = "images/LeatherSlideshow4.jpg";
ImageFilePath[3] = "images/LeatherSlideshow3.jpg";
ImageFilePath[4] = "images/LeatherSlideshow5.jpg";
 
// these are the URL's to the web pages we're linking to
 
ImageURL[0] = "images/LeatherSlideshow1.jpg";
ImageURL[1] = "images/LeatherSlideshow2.jpg";
ImageURL[2] = "images/LeatherSlideshow3.jpg";
ImageURL[3] = "images/LeatherSlideshow4.jpg";
ImageURL[4] = "images/LeatherSlideshow5.jpg";
 
 
 
 
 
//========================================================================
//========================================================================
// 
//
//          DO NOT ALTER ANYTHING BELOW THIS!!!!!!
//
//
//========================================================================
//========================================================================
var TimeToFade = 20;
var FadeValue = 0;
var CurrentImage = 0;
 
//========================================================================
//  BUILD CSS
//========================================================================
function BuildCSS()
    {
    Style = "<STYLE type=\"text/css\">";
    Style += ".slideshowframe { font: normal 10pt Arial, Helvetica, sans-serif; color:white; width:" + PixelsWide + "px; background-color:white; text-align:right; padding-bottom:10px; }";
    Style += ".slideshowframe a { font: normal 10pt Arial, Helvetica, sans-serif; color:black; text-decoration: none; border:solid 1px silver; padding-left:5px; padding-right:5px; margin-left:2px; margin-right:2px;background-color:white;  } ";
    Style += ".slideshowframe a:visited { color:black; text-decoration: none; } ";
    Style += ".slideshowframe a:hover { color:white; text-decoration: none; background-color:#777777; } ";
    Style += ".slideshow { padding-bottom:10px; -moz-opacity:1.0; opacity:1.0; filter:alpha(opacity:100); text-align:left;}";
    Style += ".slideshow a { background-color:white; border:none 0px white;  } ";
    Style += ".slideshow a:visited { text-decoration: none; } ";
    Style += ".slideshow a:hover { text-decoration: none; background-color:white; } ";   
    Style += "</style>";   
   
    return Style;
    }
 

//========================================================================
//  SHOW PREV
//========================================================================
function ShowPrev()
    {
    if (CurrentImage == 0)
        {
        CurrentImage = TotalImages - 1;
        }
    else
        {
        CurrentImage = CurrentImage - 1;
        }
               
    ShowImage(CurrentImage);
    }
 

//========================================================================
//  SHOW NEXT
//========================================================================
function ShowNext()
    {
    if (CurrentImage == (TotalImages-1))
        {
        CurrentImage = 0;
        }
    else
        {
        CurrentImage = CurrentImage + 1;
        }
               
    ShowImage(CurrentImage);
    }
 

//========================================================================
//  SHOW IMAGE
//========================================================================
function ShowImage(X)
    {
    try
        {
        CurrentImage = X;
       
        IPath = ImageFilePath[X];
        IURL = ImageURL[X];
        //Link = "<a href=\"" + IURL + "\"><img id=\"slideshowimage\" src=\"" + IPath + "\" border=0></a>"; // PHOTO WITH LINK
        Link = "<img id=\"slideshowimage\" src=\"" + IPath + "\" border=0>"; // PHOTO WITHOUT LINK
        document.getElementById("slideshowcode").innerHTML = Link;                
         
        document.getElementById("slideshowimage").style.opacity = 0;
        document.getElementById("slideshowimage").style.MozOpacity = 0;
        document.getElementById("slideshowimage").style.KhtmlOpacity = 0;
        document.getElementById("slideshowimage").style.filter = "alpha(opacity=0)";
                        
        FadeValue = 0;
        setTimeout("MyFade('slideshowimage')", TimeToFade);
                         
        }
    catch(e)
        {
        alert(e);
        }
    }
 

//========================================================================
//  MY FADE
//========================================================================
function MyFade(id)
    {
    try
        {
        if (FadeValue < 40)
            {
            FadeValue = FadeValue + 2;
            }
        else
            {
            FadeValue = FadeValue + 5;
            }
           
       
        if (FadeValue > 100)
            {
            return;
            }
        else
            {   
            document.getElementById(id).style.opacity = (FadeValue/100);
            document.getElementById(id).style.MozOpacity = (FadeValue/100);
            document.getElementById(id).style.KhtmlOpacity = (FadeValue/100);
            document.getElementById(id).style.filter = "alpha(opacity=" + FadeValue + ")";  
            setTimeout("MyFade('" + id + "')", TimeToFade);
            }
        }
    catch(e)
        {
        alert(e);
        }
    }
 
 
 
//========================================================================
//  BUILD SLIDE SHOW
//========================================================================
function BuildSlideShow()
    {
    try
        {
        // init variables
        HTMLMenu = "";
        HTMLCode = "";
        HiddenImages = "";
       
        // loop thru image data
        for(X = 0; X < TotalImages; X++)
            {
            IPath = ImageFilePath[X];
            IURL = ImageURL[X];
            HTMLMenu += "<a href=\"javascript:ShowImage(" + X + ")\">" + (X+1) + "</a>";           
            HiddenImages += "<img src=\"" + ImageFilePath[X] + "\" border=0 id=\"img\"" + X + "\">"
            }
           
        HTMLMenu = "<a href=\"javascript:ShowPrev()\"><</a>" + HTMLMenu + "<a href=\"javascript:ShowNext()\">></a>"; 
           
        // render images
        document.write("<div style=\"display:none;\">" + HiddenImages + "</div>");
        var TT = setTimeout("", 8000);
        clearTimeout(TT);
               
        HTMLCode += BuildCSS();
        HTMLCode += "<div class=\"slideshowframe\">";
        HTMLCode += "<div class=\"slideshow\" id=\"slideshowcode\" >";
        //HTMLCode += "<a href=\"" + ImageURL[0] + "\"><img id=\"slideshowimage\" src=\"" + ImageFilePath[0] + "\" border=0></a>";
        HTMLCode += "<div id=\"slideshowimage\"></div>";
        HTMLCode += "</div>";
        HTMLCode += HTMLMenu;
        HTMLCode += "</div>";
       
        HTMLCode += "<script>ShowImage(0);</script>";
        document.write(HTMLCode);
        }
    catch(e)
        {
        }
    }





//========================================================================
//  RUN CODE
//========================================================================
BuildSlideShow();