var blocks = new Array();
var tabs = new Array();
var expanded = false;
var expandall;

function infoTabsInit() {

	var cont = document.getElementById('content');
	var nodes = cont.getElementsByTagName('div');

	for (node in nodes) {
		var id = nodes[node].id
		if (id != undefined) {
			if (id.match(/info\d{2}/i)) blocks.push(nodes[node].id);
		}
	}

	var nodes = cont.getElementsByTagName('a');
	for (node in nodes) {
		var id = nodes[node].id;
		if (id != undefined) {
			if (id.match(/tab\d{2}/i)) tabs.push(nodes[node].id);
		}
	}

	var nodes = cont.getElementsByTagName('a');
	for (node in nodes) {
		var cl = nodes[node].className;
		if (cl != undefined) {
			if (cl.match(/expand-all/i)) expandall = nodes[node];
		}
	}
/*
*/
}

function setTabClass(n, c) {
	if (document.getElementById('info' + n) == undefined) return 0;
	if (c == 'On'){
		document.getElementById('info' + n).style.display = 'block';
		document.getElementById('tab' + n).className = 'infotabOn';
	}
	else if (c == 'Off'){
		document.getElementById('info' + n).style.display = 'none';
		document.getElementById('tab' + n).className = 'infotabOff';
	}
}

function toggleTab(n){
	if (document.getElementById('info' + n).style.display != 'block'){
		setTabClass(n, 'On')
	}
	else {
		setTabClass(n, 'Off')
	}
}

function expandAll(){
	if (expanded == false) {
		expandall.style.backgroundPosition = '0px 18px';
		for (n in blocks){
			if (n++ < 9) n = '0' + n;
			setTabClass(n, 'On');
		};
		expanded = true;
	}
	else {
		expandall.style.backgroundPosition = '0px 0px';
		for (n in blocks){
			if (n++ < 9) n = '0' + n;
			if (n != 1) setTabClass(n, 'Off');
		};
		expanded = false;
	}
}
