var orangetop = "true"; var bluetop = "true"; var greentop = "true"; var targetloc; setId = 0; var inprogress = "false";
function unfold(what){
	if(what == "orange" && orangetop == "true" && inprogress == "false"){ setId= setInterval("movedown('orange')", 20); }
	if(what == "green" && greentop == "true" && inprogress == "false"){ setId= setInterval("movedown('green')", 20); }
	if(what == "orange" && orangetop == "false" && inprogress == "false"){ setId= setInterval("moveup('orange')", 20); }
	if(what == "blue" && bluetop == "false" && inprogress == "false"){ setId= setInterval("moveup('blue')", 20); }
}
function movedown(whichcolor){
	inprogress = "true";
	if(whichcolor == "orange"){
		var moeit2 = document.getElementById('bluetab'); var moeit2top = parseInt(moeit2.offsetTop, 10);
		if(moeit2top < 540){
			moeit2.style.height = (parseInt(moeit2.offsetHeight, 10) - 10) + 'px';
			moeit2.style.top = (moeit2top + 10) + 'px';
		}
		else {
			clearInterval(setId); bluetop = "false";
			moeit2.style.height = '37px'; moeit2.style.top = '540px';
			inprogress = "false";
		}
	}
	if(whichcolor == "green"){
		var moeit = document.getElementById('yellowtab'); var moeittop = parseInt(moeit.offsetTop, 10);
		var moeit2 = document.getElementById('bluetab'); var moeit2top = parseInt(moeit2.offsetTop, 10);
		if(moeit2top < 540){
			moeit2.style.height = (parseInt(moeit2.offsetHeight, 10) - 10) + 'px';
			moeit2.style.top = (moeit2top + 10) + 'px';
		}
		else {
			moeit2.style.height = '37px'; moeit2.style.top = '540px'; bluetop = "false";
			if(moeittop < 503){
				moeit.style.height = (parseInt(moeit.offsetHeight, 10) - 10) + 'px';
				moeit.style.top = (moeittop + 10) + 'px';
			}
			else {
				clearInterval(setId); inprogress = "false";
				orangetop = "false";
				moeit.style.height = '37px'; moeit.style.top = '503px';
			}
		}
	}
}
function moveup(whichcolor){
	inprogress = "true";
	if(whichcolor == "orange"){
		bluetop = "true";
		var moeit2 = document.getElementById('yellowtab'); var moeit2top = parseInt(moeit2.offsetTop, 10);
		if(moeit2top > 68){
			moeit2.style.height = (parseInt(moeit2.offsetHeight, 10) + 10) + 'px';
			moeit2.style.top = (moeit2top - 10) + 'px';
		}
		else {
			clearInterval(setId); inprogress = "false";
			orangetop = "true"; bluetop = "false";
			moeit2.style.height = '508px'; moeit2.style.top = '68px';
		}
	}
	if(whichcolor == "blue" && bluetop == "false"){
		var moeit = document.getElementById('yellowtab'); var moeittop = parseInt(moeit.offsetTop, 10);
		var moeit2 = document.getElementById('bluetab'); var moeit2top = parseInt(moeit2.offsetTop, 10);
		if(moeittop > 68){
			moeit.style.height = (parseInt(moeit.offsetHeight, 10) + 10) + 'px';
			moeit.style.top = (moeittop - 10) + 'px';
		}
		else {
			orangetop = "true";
			moeit.style.height = '508px'; moeit.style.top = '68px';
			if(moeit2top > 104){
				moeit2.style.height = (parseInt(moeit2.offsetHeight, 10) + 10) + 'px';
				moeit2.style.top = (moeit2top - 10) + 'px';
			}
			else {
				clearInterval(setId); inprogress = "false";
				bluetop = "true";
				moeit2.style.height = '472px'; moeit2.style.top = '104px';
			}
		}
	}
}