dir=true // true = up false = down
speed=2
imageSize=100  // %
fixedWidth=100 // set a fixed width
fixedHeight=100 // set a fixed height

popupLeft= 100 // pixels
popupTop= 100 // pixels

biggest=0
ieBorder=0
sv3Timer=null

var scroll1 = new Object()
var scroll2 = new Object()

preload=new Array()
for(var i=0;i<myImages.length;i++)
{
	preload[i]=new Image()
	preload[i].src=myImages[i][0]
}

function initVS3()
{
	scroll1=document.getElementById("scroller1")
	scroll2=document.getElementById("scroller2")

	for(var j=0;j<myImages.length;j++)
	{
		scroll1.innerHTML+='<img id="pic'+j+'" src="'+preload[j].src+'" alt="'+myImages[j][2]+'" onclick="showBigPic('+j+')"><br>'
		scroll2.innerHTML+='<img id="pic'+j+'" src="'+preload[j].src+'" alt="'+myImages[j][2]+'" onclick="showBigPic('+j+')"><br>'

		if(imageSize!=0)
		{
			// use percentage size
			newWidth=preload[j].width/100*imageSize
			newHeight=preload[j].height/100*imageSize
		}
		else
		{
			// use fixed size
			newWidth=fixedWidth
			newHeight=fixedHeight
		}

		document.getElementById("pic"+j).style.width=newWidth+"px"
		document.getElementById("pic"+j).style.height=newHeight+"px"

		if(document.getElementById("pic"+j).offsetWidth>biggest) biggest=document.getElementById("pic"+j).offsetWidth
	}

	
	//if(document.getElementById&&document.all) ieBorder=parseInt(document.getElementById("scrollbox").style.borderTopWidth)*2
	//alert(ieBorder)
	//document.getElementById("scrollbox").style.width=biggest+ieBorder+"px"
	
	//scroll2.innerHTML=scroll1.innerHTML

	if(dir) speed= -speed
	scrollVS3()
}

function scrollVS3()
{
	if(paused==1){return}
	clearTimeout(sv3Timer)

	scroll1Pos=parseInt(scroll1.style.top)
	scroll2Pos=parseInt(scroll2.style.top)

	scroll1Pos+=speed
	scroll2Pos+=speed

	scroll1.style.top=scroll1Pos
	scroll2.style.top=scroll2Pos
	
	sv3Timer=setTimeout("scrollVS3()",60)

	if(dir)
	{
		if(scroll1Pos< -scroll1.offsetHeight) scroll1.style.top=scroll1.offsetHeight
		if(scroll2Pos< -scroll1.offsetHeight*2)	scroll2.style.top=0
	}

	if(!dir)
	{
		if(scroll1Pos>parseInt(document.getElementById("scrollbox").style.height)) scroll1.style.top=scroll2Pos+"px"
		if(scroll2Pos>0) scroll2.style.top=scroll1Pos - (scroll2.offsetHeight*2)+"px"
	}

}

st=null

function pause()
{
	clearTimeout(sv3Timer)
	clearTimeout(st)
}

function reStartVS3()
{
	clearTimeout(st)
	st=setTimeout("scrollVS3()",100)
}

paused=0
picWin=null

function showBigPic(p)
{

	if(myImages[p][1]!="")
	{
		paused=1

		if(picWin&&picWin.open&&!picWin.closed){picWin.close()} // if picWin exists close it

		picWin=window.open(myImages[p][1])
	}

}

window.onfocus=function()
{
	paused=0
	scrollVS3()
}