
// Section constants
var TITLE_OUTLINE               = 0;
var INTRODUCTION                = 1;
var MARKET_OPPORTUNITY          = 2;
var LANDFILL_GAS_APPLICATION    = 3;
var POTENTIAL_APPLICATIONS      = 4;
var PROPOSED_FINANCING          = 5;
var NEXT_STEPS                  = 6;
var FORWARD_LOOKING_STATEMENT   = 7;

var titleOutlineImages = new Array(
    "slides/slide00.jpg",
    "slides/slide01.jpg"
);

var introductionImages = new Array(
    "slides/slide02.jpg",
    "slides/slide03.jpg",
    "slides/slide04.jpg",
    "slides/slide05.jpg",
    "slides/slide06.jpg",
    "slides/slide07.jpg"
);

var marketOpportunityImages = new Array(
    "slides/slide08.jpg",
    "slides/slide09.jpg",
    "slides/slide10.jpg",
    "slides/slide11.jpg",
    "slides/slide12.jpg",
    "slides/slide13.jpg"
);

var landfillGasApplicationImages = new Array(
    "slides/slide14.jpg",
    "slides/slide15.jpg",
    "slides/slide16.jpg",
    "slides/slide17.jpg",
    "slides/slide18.jpg",
    "slides/slide19.jpg",
    "slides/slide20.jpg",
    "slides/slide21.jpg",
    "slides/slide22.jpg",
    "slides/slide23.jpg",
    "slides/slide24.jpg",
    "slides/slide25.jpg",
    "slides/slide26.jpg"
);

var potentialApplicationsImages = new Array(
    "slides/slide27.jpg",
    "slides/slide28.jpg",
    "slides/slide29.jpg"
);

var proposedFinancingImages = new Array(
    "slides/slide30.jpg",
    "slides/slide31.jpg",
    "slides/slide32.jpg",
    "slides/slide33.jpg"
);

var nextStepsImages = new Array(
    "slides/slide34.jpg"
);

var forwardLookStatementImages = new Array(
    "slides/slide35.jpg"
);


// Sections
var sections = new Array(
    titleOutlineImages,
    introductionImages,
    marketOpportunityImages,
    landfillGasApplicationImages,
    potentialApplicationsImages,
    proposedFinancingImages,
    nextStepsImages,
    forwardLookStatementImages
);

var curSectionIndex = 0;
var curImageIndex = 0;


function first_image()
{
    set_section( 0 );
    select_section( 0 );
}

function prev_image()
{
    decrement_image_index();
    draw_image();
}

function next_image()
{
    increment_image_index();
    draw_image();
}

function set_section( sectionIndex )
{
    curSectionIndex = sectionIndex;
    curImageIndex = 0;
    draw_image();
}

function select_section( sectionIndex )
{
    document.getElementById("sectionSelect").selectedIndex = sectionIndex;
}

///////////////////////////////////////////////////////////////////////////////

function prev_button_click()
{
    prev_image();
    return false;
}

function next_button_click()
{
    next_image();
    return false;
}

function section_changed()
{
    sectionCtrl = document.getElementById("sectionSelect");
    set_section( sectionCtrl.options[sectionCtrl.selectedIndex].value );
}

///////////////////////////////////////////////////////////////////////////////

function increment_image_index()
{
    if( curImageIndex < sections[ curSectionIndex ].length - 1 )
    {
        curImageIndex++;
    }
    else
    {
        increment_section_index();
    }
}

function decrement_image_index()
{
    if( curImageIndex > 0 )
    {
        curImageIndex--;
    }
    else
    {
        decrement_section_index();
    }
}

function increment_section_index()
{
    if( curSectionIndex < sections.length - 1 )
    {
        curSectionIndex++;
        curImageIndex = 0;
        select_section( curSectionIndex );
    }
}

function decrement_section_index()
{
    if( curSectionIndex > 0 )
    {
        curSectionIndex--;
        curImageIndex = sections[ curSectionIndex ].length - 1;
        select_section( curSectionIndex );
    }
}

function draw_image()
{
    document.imagepanel.src = sections[curSectionIndex][curImageIndex];
}

