//--------------------------------------------------------------------------------------------------
// All material contained within this and associated downloaded pages is the property of 4thorder(TM) 
// Copyright © 2005.  All rights reserved.
//
// Author: Michael Falatine || Authors email: 4thorder@4thorder.us
//
// USAGE: You may use this script for commercial or personal use, however, the copyright is retained-
// by 4thorder (TM).
//
// For other free Scripts visit: http://www.4thorder.us/Scripts/
//---------------------------------------------------------------------------------------------------
// :::::::::::::::::::::::::
// ::: Initialize Page ::::
// :::::::::::::::::::::::::

window.onload=InitializePage;

function InitializePage()
{
    setIDs();
}

// Set ID's for all table cells
function setIDs()
{
    ContainerElement = document.getElementById('ImageContainer');
    
    if (ContainerElement == null)
    {
        return;
    }
    
    TDCol = ContainerElement.getElementsByTagName('TD');
    
    if (TDCol != null)
	{
	    for (i=0; i<TDCol.length; i++)
	    {
	        TDCol.item(i).style.width = '150px';
	        TDCol.item(i).setAttribute('id',i);
	    }
	}
}

function moveLeft()
{
    ContainerElement = document.getElementById("ImageContainer");
    firstTD = document.getElementById("0");
    dupfirstTD = firstTD.cloneNode(false);
    dupfirstTD.innerHTML = firstTD.innerHTML;
    dupfirstTD.style.width = '150px';
    ContainerElement.removeChild(firstTD);
    ContainerElement.appendChild(dupfirstTD);
    setIDs();
}

function moveRight()
{
    lastTD = document.getElementById(TDCol.length-1);
    duplastTD = lastTD.cloneNode(false)
    duplastTD.innerHTML = lastTD.innerHTML
    firstTD = document.getElementById("0");
    ContainerElement = document.getElementById("ImageContainer");
    ContainerElement.insertBefore(duplastTD,firstTD);
    firstTD.style.width = '150px';
    ContainerElement.removeChild(lastTD);
    setIDs();
}

function skip_right()
{
    for (a = 0; a < 3; a++)
    {
        moveRight();
    }
    load_prettyphotos();
}

function skip_left()
{
    for (a =0; a < 3; a++)
    {
        moveLeft();
    }
    load_prettyphotos();
}