/*******************************************************************************
Object Constuctors
*******************************************************************************/

function slideShowWindow(imgID)
{
    this.img = cb_getElementById(imgID);
    this.images = new Array;
    this.nextImg = 0;

    this.preLoadImages = preLoadImages;
    this.loadNextImg = loadNextImg;
}
    
function slideShowPanel()
{
    this.name = "slideShowPanelVar";
    eval(this.name + " = this");
    this.windows = new Array;
    this.freq = 5000;
    this.fadeDuration = 2;
    this.timer = null;

    this.changeImages = changeImages;
}
    
/*******************************************************************************
Funtions
*******************************************************************************/

function preLoadImages()
{
    for (i = 0; i < preLoadImages.arguments.length; i++)
    {
        this.images[i] = new Image();
        this.images[i].src = preLoadImages.arguments[i];
    }
}

function loadNextImg(fadeDuration)
{
    if (document.all)
    {
        this.img.style.filter = "blendTrans(duration = " + fadeDuration + ")";
        this.img.filters.blendTrans.Apply();
    }

    this.img.src = this.images[this.nextImg].src;

    if (document.all)
    {
        this.img.filters.blendTrans.Play();
    }

    ++this.nextImg;

    if (this.nextImg >= this.images.length)
    {
        this.nextImg = 0;
    }
}

function changeImages()
{
    for (i = 0; i < this.windows.length; ++i)
    {
        this.windows[i].loadNextImg(this.fadeDuration);
    }

    this.timer = setTimeout(this.name  + ".changeImages()", this.freq);
}

/*******************************************************************************
Custom Funtions
*******************************************************************************/

function startSlideShow()
{
    slideShowPanel = new slideShowPanel();
    slideShowPanel.windows[0] = new slideShowWindow("window1Img");
    slideShowPanel.windows[0].preLoadImages(
        "Images/Application_ArmUavProgram_Home.jpg",
        "Images/Application_FighterAircraftC2Enhancement(1)_Home.jpg",
        "Images/Application_FighterAircraftC2Enhancement(2).jpg",
        "Images/Application_BlueForceTracking_Home.jpg",
        "Images/Application_DRMEC.jpg",
        "Images/Application_AAAV_Home.jpg");
    slideShowPanel.windows[1] = new slideShowWindow("window2Img");
    slideShowPanel.windows[1].preLoadImages(
        "Images/Product_RFID_Home.jpg",
        "Images/Product_9522B_Home.jpg",
        "Images/Product_9601-DG_Home.jpg",
        "Images/Product_Multi-Channel_Home.jpg",
        "Images/Product_A3LA-X_Home.jpg",
        "Images/Product_9601-DGSM_Home.jpg");
    slideShowPanel.windows[2] = new slideShowWindow("window3Img");
    slideShowPanel.windows[2].preLoadImages(
        "Images/Application_SnowGooseUnmannedAerialVehicle_Home.jpg",
        "Images/Application_AutonomousGroundSensor(2).jpg",
        "Images/Application_HunterUnmannedAerialVehicle(2).jpg",
        "Images/Application_HighAltitudeBalloon_Home.jpg",
        "Images/Application_Humvee.jpg",
        "Images/Application_DataCommunicationSystem_Home.jpg");
    slideShowPanel.changeImages();
}