function showSelectedPhoto(path) {
	document.getElementById('prodImg').src = path;
	return false;
}

function updatePhoto(imgIndex)
{
    filename = photos[imgIndex];
		var d = new Date();
    str = rootDir + filename + '?t=' + d.getTime();
    document.getElementById('prodImg').src = str;
}

function handle_btnNext()
{
    if (photos.length < 1) return false

    imgIndex++

    if (imgIndex == photos.length)
    {
        imgIndex = 0
    }

    updatePhoto(imgIndex)
}
///////////////////////////////////////////
function handle_btnPrevious()
{
    if (photos.length < 1) return false

    imgIndex--

    if (imgIndex < 0)
    {
        imgIndex = photos.length -1
    }

    updatePhoto(imgIndex)
}

var imgIndex = 0;

btn1 = document.getElementById('btnPrevious');
if (btn1)
{
	btn1.onclick = handle_btnPrevious;
}

btn2 = document.getElementById('btnNext');
if (btn2)
{
	btn2.onclick = handle_btnNext;
}

