
//========================================================================
//  DEFINE ARRAYS
//========================================================================
var ImageFilePath = new Array()
var ImageURL = new Array()

//========================================================================
//  A.J. : MODIFY THIS SECTION
//========================================================================
var PixelsWide = 520;
var TotalImages = 30;

// these are the URL's to the images that will be displayed

ImageFilePath[0] = "images/2011MainMetalTable.jpg";
ImageFilePath[1] = "images/2011MainCosgrove.jpg";
ImageFilePath[2] = "images/2011MainVintage.jpg";
ImageFilePath[3] = "images/2011MainPillows.jpg";
ImageFilePath[4] = "images/2011MainBlog.jpg";
ImageFilePath[5] = "images/2011MainModernTables.jpg";
ImageFilePath[6] = "images/2011MainConsole.jpg";
ImageFilePath[7] = "images/2011MainPfeiferFinds.gif";
ImageFilePath[8] = "images/2011MainWasteBins.jpg";
ImageFilePath[9] = "images/2011MainCustom.jpg";
ImageFilePath[10] = "images/2011MainPoufs.jpg";
ImageFilePath[11] = "images/2011MainPlacitas.jpg";
ImageFilePath[12] = "images/2011MainEcoStools.jpg";
ImageFilePath[13] = "images/2011MainAlison.jpg";
ImageFilePath[14] = "images/2011MainMetPillows.jpg";
ImageFilePath[15] = "images/2011MainBamileke.jpg";
ImageFilePath[16] = "images/2011MainShop.jpg";
ImageFilePath[17] = "images/2011MainGiftsForHer.jpg";
ImageFilePath[18] = "images/2011MainKuba.jpg";
ImageFilePath[19] = "images/2011MainSaddleBlanket.jpg";
ImageFilePath[20] = "images/2011MainBasketWoven.jpg";
ImageFilePath[21] = "images/2011MainNoren.jpg";
ImageFilePath[22] = "images/2011MainRoundTray.jpg";
ImageFilePath[23] = "images/2011MainLacLogs.jpg";
ImageFilePath[24] = "images/2011MainCocktail.jpg";
ImageFilePath[25] = "images/2011MainPineCubes.jpg";
ImageFilePath[26] = "images/2011MainMoroccanTea.jpg";
ImageFilePath[27] = "images/2011MainLighting.jpg";
ImageFilePath[28] = "images/2011MainElephant.jpg";
ImageFilePath[29] = "images/2011MainSpotCow.jpg";


// these are the URL's to the web pages we're linking to

ImageURL[0] = "detail.aspx?ID=620&Name=Reclaimed-Metal-Occasional-Table";
ImageURL[1] = "SearchResult.aspx?CategoryID=104";
ImageURL[2] = "SearchResult.aspx?CategoryID=44";
ImageURL[3] = "SearchResult.aspx?CategoryID=107";
ImageURL[4] = "blogs.aspx";
ImageURL[5] = "searchresult.aspx?CategoryID=75";
ImageURL[6] = "detail.aspx?ID=5&Name=Narrow-Console";
ImageURL[7] = "SearchResult.aspx?CategoryID=13";
ImageURL[8] = "SearchResult.aspx?CategoryID=82";
ImageURL[9] = "customdesign.aspx";
ImageURL[10] = "detail.aspx?ID=460&Name=Moroccan-Leather-Pouf";
ImageURL[11] = "detail.aspx?ID=578&Name=Placitas-Side-Table";
ImageURL[12] = "detail.aspx?ID=444&Name=Eco-Friendly-Stool-Table";
ImageURL[13] = "detail.aspx?ID=552&Name=Alison-Occasional-Table";
ImageURL[14] = "detail.aspx?ID=554&Name=Metallic-Leather-Pillow";
ImageURL[15] = "detail.aspx?ID=526&Name=Bamileke-Stool-Table";
ImageURL[16] = "ourshop.aspx";
ImageURL[17] = "searchresult.aspx?CategoryID=50%20";
ImageURL[18] = "detail.aspx?ID=415&Name=Kuba-Cloth-Pillow";
ImageURL[19] = "detail.aspx?ID=396&Name=Saddle-Blanket";
ImageURL[20] = "detail.aspx?ID=339&Name=Basket-Woven-Leather-Pillow---Chocolate";
ImageURL[21] = "detail.aspx?ID=175&Name=Japanese-Noren";
ImageURL[22] = "detail.aspx?ID=34&Name=Modern-Round-Wood-Serving-Tray";
ImageURL[23] = "detail.aspx?ID=442&Name=Lacquered-Log-Tables";
ImageURL[24] = "detail.aspx?ID=364&Name=Leather-Cocktail-Table";
ImageURL[25] = "detail.aspx?ID=489&Name=Solid-Pine-Cube-Table";
ImageURL[26] = "detail.aspx?ID=537&Name=Moroccan-Tea-Glass";
ImageURL[27] = "searchresult.aspx?CategoryID=54";
ImageURL[28] = "product/517/Handmade-Elephant-Quilt";
ImageURL[29] = "detail.aspx?ID=618&Name=Spotted-Cowhide-Pillow";





//========================================================================
//========================================================================
//  
//
//          DO NOT ALTER ANYTHING BELOW THIS!!!!!!
//
//
//========================================================================
//========================================================================
var TimeToFade = 15;
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:left; 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>";
        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();
