	function generateCatArray() {
	catheights = [totalcats];
	for(x = 0; x < totalcats; x++) {
	catid = catids[x];
	catheight = document.getElementById('cat'+catid).offsetHeight;
	catheights[x] = catheight;
	}
	}

	
	function getCatHeight(catid) {
		for(x = 0; x < totalcats; x++) {
		if(catid == catids[x]) {
		catheight = catheights[x];
		}
		}
		return catheight;
	}

	
	function toggleCat(catid,mode) {
	catelement = document.getElementById('cat'+catid);
	cattitle = document.getElementById('cattitle'+catid);
	catheight = getCatHeight(catid);
	catclose = new Tween(catelement.style,'height',Tween.strongEaseInOut,catheight,0,0.7,'px');
	catopen = new Tween(catelement.style,'height',Tween.strongEaseInOut,0,catheight,0.7,'px');
	catclose.onMotionFinished = function() { catstatus = "closed"; toggle('cat'+catid,'sym'+catid,'off'); }
	catclose.onMotionStarted = function() {  cattitle.className = "artcatinactive"; }
	catopen.onMotionFinished = function() { catstatus = "open"; }
	catopen.onMotionStarted = function() { toggle('cat'+catid,'sym'+catid,'on');  cattitle.className = "";  }
	if(mode == "close") {
	if(catelement.offsetHeight > 0) {
	catclose.start();
	}
	} else if(mode == "open") {
	if(catelement.offsetHeight == 0) {
	catopen.start();
	}
	} else {
	if(catelement.offsetHeight == 0) {
	catopen.start();
	} else {
	catclose.start();
	}
	}
}


	function toggleCats(catid) {
		catelement = document.getElementById('cat'+catid);
		if(catelement.offsetHeight == 0) {
			toggleCat(catid,'open');
		}
		for(x = 0; x < totalcats; x++) {
		if(catid != catids[x]) {
		setTimeout("toggleCat("+catids[x]+",'close')",10);
		}
		}
	}
	
	function showAllCats() {
			for(x = 0; x < totalcats; x++) {
		setTimeout("toggleCat("+catids[x]+",'open')",10);
		}
	}
	
		function hideAllCats() {
			for(x = 0; x < totalcats; x++) {
		setTimeout("toggleCat("+catids[x]+",'close')",10);
		}
	}
	
	function initialiseCats(startingcat) {
		generateCatArray();
		for(x = 0; x < totalcats; x++) {
		catelement = document.getElementById('cat'+catids[x]);
		cattitle = document.getElementById('cattitle'+catids[x]);
		toggle('cat'+catids[x],'sym'+catids[x],'off');
		
		catelement.style.height = "0px";
		if(catids[x] != startingcat) {
		cattitle.className = "artcatinactive";
		}
		if(catids[x] == startingcat) {
		setTimeout("toggleCat("+catids[x]+",'open')",10);
		}
		}
	}
