/*
	Show the submenu navigation bar with the appropriate links
	args 	: 	idmenu	submenu navigation ID
	return 	:	NULL
*/
function showSubMenu(idmenu){
	var tabdd = $ES('dd','mainmenu');
	tabdd.forEach(function(dd){
		dd.style.display = "none";
	});
	$(idmenu).style.display = "block";
}


/*
	Automatically change the photo in the 'featured articles' box on the landing page
	args	:	id	Image ID
	return	:	NULL
*/
var f = {
	'pics' : [
		{
			'pic' : "montana_brown_trout_02.jpg",
			'boldText' : "Montana Rainbow Trout",
			'normalText' : ""
		},
		{
			'pic' : "a_new_day_is_dawning.jpg",
			'boldText' : "A New Day Is Dawning",
			'normalText' : ""
		},
		{
			'pic' : "womack_family_rv2.jpg",
			'boldText' : "Womack Family",
			'normalText' : ""
		},
		{
			'pic' : "stephen_shobe_on_the_rock.jpg",
			'boldText' : "Stephen shobe",
			'normalText' : "on the rock"
		},
	]
};
function changeSrc(id){
	/* List of pictures defined just before */
	var liste = f['pics'];
	/* Number of pictures */
	var nbImg = liste.length;
	
	/* image link */
	$('featuredArticlesImage').src = "./images/home/"+liste[id]['pic'];
	/* image */
	var link = "./index.php?mod=1&art="+id;
	$('featuredArticlesImageLink').href = link;
	/* image's caption */
	$('imageCaption').innerHTML = "<strong>"+liste[id]['boldText'].toUpperCase()+"&nbsp;</strong>"+liste[id]['normalText'];
	/* featured articles box */
	$('featuredArticles').onclick = function(){
		window.location = link;
	}
	
	/* Next picture */
	var nextid = (parseInt(id)+1)%nbImg;
	setTimeout("changeSrc("+nextid+",'bold','normal')",10000);
}


/*
	Change the article in the featured article section -----> NOT USED
	args	:	articleId	box which contain the article we would like to display
	return	:	NULL
*/
function showArticle(articleId){
	/* container which display the articles content */
	var to = $('articlebody');
	/* container which contain the article to display */
	var from = $("article"+articleId);
	
	to.innerHTML = from.innerHTML;
}


/*
	Allow people to click on a box in the landing page
*/
function boxlink(mod){
	window.location = "index.php?mod="+mod;
}