
var shrinkinc = 75;
var shrinkint = 50;
var maxwidth = 615;
var growingscroll = 0;
var scrolling = false;

function ShowScroll(sheet)
	{
	if (!scrolling) {
	//First shrink any that are showing
	for (var i=1;i<=14;i++)
		{
			var sheetid;
			if (i!=sheet) {
				sheetid='sheetscroll' + i;
				var divwidth = document.getElementById(sheetid).style.width;
				divwidth = divwidth.replace('px','');
				if(isNaN(divwidth) || divwidth=='') divwidth='0';
				if(parseInt(divwidth)>0) ShrinkScroll(i);
				}
		}
	growingscroll = sheet;
	}
}

function ShrinkScroll(sheet)
{
	scrolling=true;
	var sheetid;
	sheetid='sheetscroll' + sheet;
	var divwidth = document.getElementById(sheetid).style.width;
	divwidth = divwidth.replace('px','');
	if(isNaN(divwidth) || divwidth=='') divwidth='0';
	var intwidth = parseInt(divwidth);
	intwidth -= shrinkinc;
	if (intwidth<0) intwidth = 0;
	document.getElementById(sheetid).style.width = intwidth + 'px';
	if (intwidth>0) setTimeout('ShrinkScroll(' + sheet + ')',shrinkint);
	//Check that all are zero
	var allzero = true;
	for (var i=1;i<=14;i++)
		{
		var sheetid;
		sheetid='sheetscroll' + i;
		var divwidth = document.getElementById(sheetid).style.width;
		divwidth = divwidth.replace('px','');
		if(isNaN(divwidth) || divwidth=='') divwidth='0';
		if(parseInt(divwidth)>0) allzero = false;
		}
	if (allzero) GrowScroll(growingscroll);			
}

function GrowScroll(sheet)
{
	var sheetid;
	sheetid='sheetscroll' + sheet;
	var divwidth = document.getElementById(sheetid).style.width;
	divwidth = divwidth.replace('px','');
	if(isNaN(divwidth) || divwidth=='') divwidth='0';
	var intwidth = parseInt(divwidth);
	intwidth += shrinkinc;
	if (intwidth>maxwidth) intwidth = maxwidth;
	document.getElementById(sheetid).style.width = intwidth + 'px';
	if (intwidth<maxwidth) {
		setTimeout('GrowScroll(' + sheet + ')',shrinkint);
	}
	else scrolling=false;
}

function ShowTreasure()
{
	var treasurebox = document.getElementById('treasure');
	treasurebox.className='TreasureOpen';
}
function HideTreasure()
{
	var treasurebox = document.getElementById('treasure');
	treasurebox.className='TreasureClosed';
}
function DownloadBrochure()
{
	var treasurebox = document.getElementById('treasure');
	if(treasurebox.className=='TreasureOpen')
		{
		window.open('./brochure/pdf-brochure.pdf','brochurewindow','width=800,height=600,left=0,top=100,screenX=0,screenY=100');
		treasurebox.className='TreasureClosed';		
}
}