var lastExpandedId;

function expandGroup(id, force){
	theAnswerTitle = document.getElementById("answer" + id + "_title");
	theAnswerBody = document.getElementById("answer" + id + "_body");
	theLinkDIV = document.getElementById("linkDIV" + id);
	if (theAnswerTitle == null){return;}
	if(force != null){
		theLinkDIV.expanded = !force;
	}
	if((!theLinkDIV.expanded) || (theLinkDIV.expanded == null)){
		theAnswerTitle.style.display = 'block';
		theLinkDIV.expanded = true;
		if (theAnswerBody != null){
			theAnswerBody.style.display = 'block';
		}
		if (theLinkDIV != null){
			theLinkDIV.style.color = '#6699FF';
			if (lastExpandedId > 0){
				if (lastExpandedId != id){
					oldID = lastExpandedId;
					lastExpandedId = -1;
					expandGroup(oldID, false);
				}
			}
			lastExpandedId = id;
		}
		/*if(force == null){
			var loc = new String(location);
			var length = loc.indexOf('.php') + 4;
			var newLocation = loc.substring(0, length) + "#answer" + id;
			//location = newLocation;
		}*/
	}else{
		theAnswerTitle.style.display = 'none';
		theLinkDIV.expanded = false;
		if (theAnswerBody != null){
			theAnswerBody.style.display = 'none';
		}
		if (theLinkDIV != null){
			theLinkDIV.style.color = '#888888';
		}
	}
	
}

function expandAllGroups(totalDivs){
	for(i=1; i<= totalDivs; i++){
		expandGroup(i, true);
	}
}
function closeAllGroups(totalDivs){
	for(i=1; i<= totalDivs; i++){
		expandGroup(i, false);
	}
}


function expandGroup2(id, force){
	theAnswer = document.getElementById("answer" + id);
	if(force != null){
		theAnswer.expanded = !force;
	}
	if (theAnswer == null){return;}
	if((!theAnswer.expanded) || (theAnswer.expanded == null)){
		theAnswer.style.display = 'block';
		theAnswer.expanded = true;
	}else{
		theAnswer.style.display = 'none';
		theAnswer.expanded = false;
	}
}

function closeAllGroupsWhyMT(){
	for(i=1; i<= 5; i++){
		expandGroup2(i, false);
	}
}