<!--
var nWrapperWidth = 693;
var nItemWidth = 95;
var nImagePadding = 6; // image padding + border
var nStep = 5;
var nSpeed = 20;
var cCurrentBorderColor = "#999";

var nIntervalID;
var nDirection;

function ScrollLeft()
{
    nDirection = nStep;
    nIntervalID = window.setInterval(StartScroll, nSpeed);
}

function ScrollRight()
{
    nDirection = nStep * -1;
    nIntervalID =  window.setInterval(StartScroll, nSpeed);
}

function StartScroll()
{
    var nXPos = 0;
    if(parseInt(document.getElementById('GalleryWrapper').style.left, 10))
    {
        nXPos = parseInt(document.getElementById('GalleryWrapper').style.left, 10); 
    }
    
    if((nDirection < 0 && nXPos > nGalleryLeft) || (nDirection > 0 && nXPos < 0))
    {        
        document.getElementById('GalleryWrapper').style.left = (nXPos + nDirection) + "px";
    }
    else
    {
        if(nDirection < 0 && nXPos < nGalleryLeft)
        {
            document.getElementById('GalleryWrapper').style.left = nGalleryLeft + "px";
        }
        if(nDirection > 0 && nXPos > 0)
        {
            document.getElementById('GalleryWrapper').style.left = "0px";
        }
        StopScroll();
    }
}

function StopScroll()
{
    window.clearInterval(nIntervalID);
}
var nGalleryWidth = 0;
function InitGallery(nCurrentPosition)
{
    nCountItems = 0;
    for(var i=0; i<document.getElementById('GalleryWrapper').childNodes.length; i++)
    {
        if(document.getElementById('GalleryWrapper').childNodes[i].nodeName == "A")
        {
            nGalleryWidth = nGalleryWidth + nItemWidth + nImagePadding;
            nCountItems++;
            if(nCurrentPosition == nCountItems)
            {
                document.getElementById('GalleryWrapper').childNodes[i].childNodes[0].style.borderColor = cCurrentBorderColor;
            }
        }
    }
    nGalleryLeft = (nGalleryWidth - nWrapperWidth) * -1;
    
    if(nCountItems > 7 && nCurrentPosition > 4)
    {        
        nXPosition = ((nCurrentPosition - 4) * (nItemWidth + nImagePadding)) * -1;
        if(nXPosition < nGalleryLeft)
        {
            nXPosition = nGalleryLeft;
        }
        document.getElementById('GalleryWrapper').style.left = nXPosition + "px";
    }
}
// -->
