var PlanesImgs = new Array( "Planes_01", "Planes_02", "Planes_03", "Planes_04", "Planes_05", "Planes_06", "Planes_07", "Planes_08", "Planes_09", "Planes_10", "Planes_11", "Planes_12", "Planes_13" );

var PortraitsImgs = new Array( "Portraits_01", "Portraits_02", "Portraits_03", "Portraits_04", "Portraits_05", "Portraits_06", "Portraits_07", "Portraits_08", "Portraits_09", "Portraits_10", "Portraits_11", "Portraits_12", "Portraits_13", "Portraits_14", "Portraits_15", "Portraits_16", "Portraits_17" );

var StoriesImgs = new Array( "Stories_01", "Stories_02", "Stories_03", "Stories_04", "Stories_05", "Stories_06", "Stories_07", "Stories_08", "Stories_09", "Stories_10", "Stories_11", "Stories_12", "Stories_13", "Stories_14", "Stories_15", "Stories_16", "Stories_17" );

var TravelImgs = new Array( "Travel_01", "Travel_02", "Travel_03", "Travel_04", "Travel_05", "Travel_06", "Travel_07", "Travel_08", "Travel_09", "Travel_10", "Travel_11", "Travel_12", "Travel_13", "Travel_14", "Travel_15", "Travel_16", "Travel_17", "Travel_18" );

var prevIdx  = 0;
var nextIdx  = 0;
var totalIdx = 0;

function loadData(dataID, startIdx)
{
    if( dataID == "Planes" )
    {
        document.getElementById("IMGcontact_page").style.display = 'none';
        document.getElementById("corePhoto").style.display = 'block';

        totalIdx = PlanesImgs.length;
        if( startIdx == ( totalIdx - 1 ) )
        {
            nextIdx = 0;
        }
        else
        {
            nextIdx = startIdx + 1;
        }

        if( startIdx == 0 )
        {
            prevIdx = totalIdx - 1;
        }
        else
        {
            prevIdx = startIdx - 1;
        }

        // Set the current image.
        document.getElementById("corePhoto").className = PlanesImgs[startIdx];

        // Preload the next image.
        document.getElementById("preLoadPhoto").className = PlanesImgs[nextIdx];

        document.getElementById("arrowNav").innerHTML = '<a href="#prev" id="Link_NextButton" onClick="loadData(\'Planes\', '+prevIdx+');">&lt;</a><span>'+(startIdx+1)+' / '+totalIdx+'</span><a href="#prev" id="Link_PreviousButton" onClick="loadData(\'Planes\', '+nextIdx+');">&gt;</a>';
    }
    else if( dataID == "Portraits" )
    {
        document.getElementById("IMGcontact_page").style.display = 'none';
        document.getElementById("corePhoto").style.display = 'block';

        totalIdx = PortraitsImgs.length;
        if( startIdx == ( totalIdx - 1 ) )
        {
            nextIdx = 0;
        }
        else
        {
            nextIdx = startIdx + 1;
        }

        if( startIdx == 0 )
        {
            prevIdx = totalIdx - 1;
        }
        else
        {
            prevIdx = startIdx - 1;
        }

        // Set the current image.
        document.getElementById("corePhoto").className = PortraitsImgs[startIdx];

        // Preload the next image.
        document.getElementById("preLoadPhoto").className = PortraitsImgs[nextIdx];

        document.getElementById("arrowNav").innerHTML = '<a href="#prev" id="Link_NextButton" onClick="loadData(\'Portraits\', '+prevIdx+');">&lt;</a><span>'+(startIdx+1)+' / '+totalIdx+'</span><a href="#prev" id="Link_PreviousButton" onClick="loadData(\'Portraits\', '+nextIdx+');">&gt;</a>';
    }
    else if( dataID == "Stories" )
    {
        document.getElementById("IMGcontact_page").style.display = 'none';
        document.getElementById("corePhoto").style.display = 'block';

        totalIdx = StoriesImgs.length;
        if( startIdx == ( totalIdx - 1 ) )
        {
            nextIdx = 0;
        }
        else
        {
            nextIdx = startIdx + 1;
        }

        if( startIdx == 0 )
        {
            prevIdx = totalIdx - 1;
        }
        else
        {
            prevIdx = startIdx - 1;
        }

        // Set the current image.
        document.getElementById("corePhoto").className = StoriesImgs[startIdx];

        // Preload the next image.
        document.getElementById("preLoadPhoto").className = StoriesImgs[nextIdx];

        document.getElementById("arrowNav").innerHTML = '<a href="#prev" id="Link_NextButton" onClick="loadData(\'Stories\', '+prevIdx+');">&lt;</a><span>'+(startIdx+1)+' / '+totalIdx+'</span><a href="#prev" id="Link_PreviousButton" onClick="loadData(\'Stories\', '+nextIdx+');">&gt;</a>';
    }
    else if( dataID == "Travel" )
    {
        document.getElementById("IMGcontact_page").style.display = 'none';
        document.getElementById("corePhoto").style.display = 'block';

        totalIdx = TravelImgs.length;
        if( startIdx == ( totalIdx - 1 ) )
        {
            nextIdx = 0;
        }
        else
        {
            nextIdx = startIdx + 1;
        }

        if( startIdx == 0 )
        {
            prevIdx = totalIdx - 1;
        }
        else
        {
            prevIdx = startIdx - 1;
        }

        // Set the current image.
        document.getElementById("corePhoto").className = TravelImgs[startIdx];

        // Preload the next image.
        document.getElementById("preLoadPhoto").className = TravelImgs[nextIdx];

        document.getElementById("arrowNav").innerHTML = '<a href="#prev" id="Link_NextButton" onClick="loadData(\'Travel\', '+prevIdx+');">&lt;</a><span>'+(startIdx+1)+' / '+totalIdx+'</span><a href="#prev" id="Link_PreviousButton" onClick="loadData(\'Travel\', '+nextIdx+');">&gt;</a>';
    }
    else if( dataID == "About" )
    {
        document.getElementById("IMGcontact_page").style.display = 'none';
        document.getElementById("corePhoto").style.display = 'block';
        document.getElementById("corePhoto").className = 'IMGbio_page';
        document.getElementById("arrowNav").innerHTML = '';
    }
    else if( dataID == "Contact" )
    {
        document.getElementById("corePhoto").style.display = 'none';
        document.getElementById("IMGcontact_page").style.display = 'block';
        document.getElementById("arrowNav").innerHTML = '';
    }
}
