function displayPhoto(i)
{
    var p = i.parentNode.getElementsByTagName('a')
    for ( j=0; j<p.length; j++ ) if ( p[j] == i) break;

    var p = document.getElementById('photo')
    p.alt = 'Loading...'
    p.src = '/images/site/blank.gif'
    if ( i.getAttribute('imgwidth') != '' )
    {
        p.style.width = i.getAttribute('imgwidth') + 'px'
        p.style.height = i.getAttribute('imgheight') + 'px'
    }

    var oImage = new Image;
    oImage.onload = function() { p.src = oImage.src }   
    oImage.src = i.href

    p.setAttribute('imgno', j)
    return false;
}

function previousImage(e)
{
    var p = document.getElementById('photo')
    var imgno = parseInt(p.getAttribute('imgno'))
    if ( imgno != null)
    {
        if ( imgno > 0 )
        {
            var i = document.getElementById('photographer-thumbs').getElementsByTagName('a')[imgno-1]
	        p.style.backgroundImage = 'url(\''+ i.href +'\')'
            p.style.width = i.getAttribute('imgwidth') + 'px'
            p.style.height = i.getAttribute('imgheight') + 'px'
            p.setAttribute('imgno', imgno-1)
        }
    }
    e.parentNode.getElementsByTagName('A')[1].style.visibility = 'visible'
    e.style.visibility = (imgno > 1)?'visible':'hidden'
    return false;
}

function nextImage(e)
{
    var p = document.getElementById('photo')
    var imgno = parseInt(p.getAttribute('imgno'))
    if ( imgno != null)
    {
        if ( imgno < document.getElementById('photographer-thumbs').getElementsByTagName('a').length-2 )
        {
            var i = document.getElementById('photographer-thumbs').getElementsByTagName('a')[imgno+1]
	        p.style.backgroundImage = 'url(\''+ i.href +'\')'
            p.style.width = i.getAttribute('imgwidth') + 'px'
            p.style.height = i.getAttribute('imgheight') + 'px'
            p.setAttribute('imgno', imgno+1)
        }
    }
    e.parentNode.getElementsByTagName('A')[0].style.visibility = 'visible'
    e.style.visibility = (imgno < document.getElementById('photographer-thumbs').getElementsByTagName('a').length-2)?'visible':'hidden'
    return false;
}