// Navigation Functions

var articlesTimeout = null;
var adviceTimeout = null;
var articlesPlaying = false;
var advicePlaying = false;

function showArticles() {
	clearTimeout(articlesTimeout);
	if($('advicelist').style.display == 'block') {
		killAdvice();
	}
	if($('articleslist').style.display == 'none' && articlesPlaying == false) {
		articlesPlaying = true;
		new Effect.SlideDown('articleslist', { queue: { position: 'end', scope: 'articles', limit: 1 }, duration: 0.3 });
		setTimeout("articlesPlaying = false", 1000);
		articlesTimeout = setTimeout("hideArticles()", 1500);
	}
}

function hideArticles() {
	if(!articlesPlaying) {
		articlesTimeout = setTimeout("killArticles()", 200);
	}
}

function killArticles() {
	new Effect.SlideUp('articleslist', { queue: { position: 'front', scope: 'articles', limit: 1 }, duration: 0.1 });
}

function showAdvice() {
	clearTimeout(adviceTimeout);
	if($('articleslist').style.display == 'block') {
		killArticles();
	}
	if($('advicelist').style.display == 'none' && advicePlaying == false) {
		advicePlaying = true;
		new Effect.SlideDown('advicelist', { queue: { position: 'end', scope: 'advice', limit: 1 }, duration: 0.3 });
		setTimeout("advicePlaying = false", 1000);
		adviceTimeout = setTimeout("killAdvice()", 1500);
	}
}

function hideAdvice() {
	if(!advicePlaying) {
		adviceTimeout = setTimeout("killAdvice()", 200);
	}
}

function killAdvice() {
	new Effect.SlideUp('advicelist', { queue: { position: 'front', scope: 'advice', limit: 1 }, duration: 0.1 });
}