//####################
//START MENU FUNCTIONS
//####################
var lastMenuOn = new String("primeiroAno");
var lastBtRef = new Object();
var displayStyle = new String("block");

function openSubMenu(id, btRef) {	
	if (this.lastMenuOn == null) var old = null
	else var old = document.getElementById(this.lastMenuOn);
	
	var neu = document.getElementById(id);
	
	//Caso novo ID seja igual ao antigo.
	if (id == this.lastMenuOn) {
		if (old.style.display == this.displayStyle) submenuOff(old, btRef);
		else submenuOn(old, btRef);
	}	
	//Caso novo ID seja diferente do antigo.
	else {
		if (old != null) submenuOff(old, btRef);
		submenuOn(neu, btRef);
		
		this.lastMenuOn = id;
	}	
}

function submenuOn(ref, btRef) {
	ref.style.display = this.displayStyle;
	btRef.className = "aberto";
	if (this.lastBtRef != btRef) this.lastBtRef.className = "fechado";
	this.lastBtRef = btRef;
}
function submenuOff(ref, btRef) {
	ref.style.display = "none";
	btRef.className = "fechado";
}
//##################
//END MENU FUNCTIONS
//##################





//##############################
//START IMPRENSA POSTS FUNCTIONS
//##############################
var lastPostOn = new String(null);
var lastPsRef = new Object();
var displayStylePS = new String("block");

function openPost(id, btRef) {	
	if (this.lastPostOn == null) var oldPS = null
	else var oldPS = document.getElementById(this.lastPostOn);
	
	var neuPS = document.getElementById(id);
	
	//Caso novo ID seja igual ao antigo.
	if (id == this.lastPostOn) {
		if (oldPS.style.display == this.displayStylePS) postOff(oldPS, btRef);
		else postOn(oldPS, btRef);
	}	
	//Caso novo ID seja diferente do antigo.
	else {
		if (oldPS != null) postOff(oldPS, btRef);
		postOn(neuPS, btRef);
		
		this.lastPostOn = id;
	}	
}

function postOn(ref, btRef) {
	ref.style.display = this.displayStylePS;
	btRef.className = "aberto";
	if (this.lastPsRef != btRef) this.lastPsRef.className = "fechado";
	this.lastPsRef = btRef;
}
function postOff(ref, btRef) {
	ref.style.display = "none";
	btRef.className = "fechado";
}
//############################
//END IMPRENSA POSTS FUNCTIONS
//############################