// JScript source code
function swapDivs(folderDiv, showDiv, hideDiv)
{	
	var show = document.getElementById(showDiv);
	var hide = document.getElementById(hideDiv);
	
	document.getElementById(folderDiv).style.height = show.clientHeight + 15;
	
	show.style.visibility = 'visible';
	hide.style.visibility = 'hidden';
}

function positionDivs()
{	var index =0;
	var folder = document.getElementById(('folderDIV' + index.toString()));
	
	while(folder != null)
	{	var info = document.getElementById(('summaryDIV' + index.toString()));
		var test = document.getElementById(('moreInfoDIV' + index.toString()));
		folder.style.height = (info.clientHeight + 15);
		
		info.style.top = 0;
		info.style.left = '47px';
		if(test != null)
		{
			test.style.top =0;
			test.style.left = '47px';
		}
		folder.style.visibility = 'visible';
		
		index++;
		folder = document.getElementById(('folderDIV' + index.toString()));	
	}
	
	if(document.all)
	{	document.getElementById('contentDiv').style.height = '100%';
	}
}

function openNewWindow(URLtoOpen, windowName, width, height) 
{
	if(document.all)
	{	width += 8;
		height += 15;
	}
		
	var parameters = "width=" + (width+45) + ", height=" + (height+45) + ", toolbar=no, scrollbars=no, status=no, screenX=50, screenY=50, left=50, top=50";
	
	if(document.all)
	{
		var newWindow=window.open(URLtoOpen, "_blank", parameters);
	}
	else
	{
		var newWindow=window.open(URLtoOpen, windowName, parameters);
	}
	
}

function newWin(URL)
{
	window.open(URL, "_blank");
}

function nextImage()
{
	if(numImages == 0)
	{	return;
	}
	if(imageIndex+1 >= numImages)
	{	imageIndex=0;
	}
	else			
		imageIndex++;
	setImage();
}
		
function lastImage()
{
	if(numImages == 0)
	{	return;
	}
	if(imageIndex-1 < 0)
	{	imageIndex = numImages-1;
	}
	else			
		imageIndex--;
	setImage();
}

var loadTimer = null;
		
function setImage()
{	
	var image = document.getElementById('ssImage');
	var anchor = document.getElementById('imageAnchor');
			
	if(image != null && anchor != null)
	{	try
		{	loadTimer = window.setTimeout("showLoading()",100);
		}
		catch(e)
		{}
		image.src = imageList[imageIndex];
		anchor.href = hrefList[imageIndex];
		
		document.getElementById('indexText').innerHTML = "Image " + (imageIndex+1) + " of " + numImages;
	}
}

function showLoading()
{	document.getElementById('loadingDIV').style.visibility = 'visible';
	loadTimer = null;
}

function stopTimer()
{
	document.getElementById('loadingDIV').style.visibility = 'hidden';
	if(loadTimer != null)
	{	window.clearTimeout(loadTimer);
		loadTimer = null;
	}
}

