// @todo to remove when 2001 pages used.
function switcherOnglets(elementID) {

	var article_onglet_1 = document.getElementById('article_onglet_1');
	var article_onglet_2 = document.getElementById('article_onglet_2');
	var article_onglet_1_titre = document.getElementById('article_onglet_1_titre');
	var article_onglet_2_titre = document.getElementById('article_onglet_2_titre');

	if (elementID == 'article_onglet_1') {

		article_onglet_1.style.display = '';
		article_onglet_2.style.display = 'none';
	}
	else {

		article_onglet_1.style.display = 'none';
		article_onglet_2.style.display = '';
	}
}

function switchDisplay(baliseid) {

	var balise = document.getElementById(baliseid);

	if(baliseid.display == "none") baliseid.display = "";
	else baliseid.display = "none";
}

/* @param 	array 			array containing all tabs.
 * @param 	string			tab to display.
 * @param 	boolean			do not modify the address bar.
 */
function switchTabs(tabs, tabtd, dnmab) {

	var tabswitched = false;

	for(i = 0; i < tabs.length; i++) {

		if(tabs[i] == tabtd) {

			document.getElementById(tabtd).style.display = '';
			tabswitched = true;
			if(!dnmab) location.hash = tabtd;
		}
		else document.getElementById(tabs[i]).style.display = 'none';
	}

	return tabswitched;
}

/* @param 	array 			array containing all tabs.
 * @param 	array				array containing all parent tabs.
 * @param 	string 			parent tab name where the current tab is located.
 */
function initializeTab(tabs, tabsp, tabsptd) {

	var anchor = location.hash;

	if(anchor != "" && switchTabs(tabs, anchor.replace("#", ""))) {

		if(tabsp != '' && tabsptd != '') switchTabs(tabsp, tabsptd, true);
	}
}

