var currShowSubConts = -1;
var prevNum = -1;
var currActive = -1;

function chClass(num){
	if(prevNum != num && prevNum != -1)
		hideAll(prevNum);
	else if(prevNum != -1) {
		currShowSubConts = num;
	return;
	}

	var item = document.getElementById("mn" + num);

	if(item == null) {
		item = document.getElementById("mn" + num + "-a");
		currActive = num;
	}

	if(num != currActive) {
		item.src = "_img/menu" + num + "_a.gif";
		var id_p = num - 1;
		var id_n = num;
	
		var lp = document.getElementById("r" + id_p)
		if(lp)
		lp.style.backgroundColor = "#b3b9bf";

		var rp = document.getElementById("r" + id_n)
		if(rp)
		rp.style.backgroundColor = "#b3b9bf";
	}

	currShowSubConts = num;
	prevNum = num;

	var subconts = document.getElementById("subcont" + num);
	if(subconts) {
		if(typeof(window.getSelection) == "undefined") {
			if(currShowSubConts ==  num  && prevNum ==  num) { 
			document.getElementById("subcont"+ num).style.display = "";
			
			}
		} 
		else {
		setTimeout("if(currShowSubConts == " + num + " && prevNum == " + num + ") { document.getElementById(\"subcont"+ num +"\").style.display = \"\"; }",200);
		}	
	}

}

function chClassO(num) {

currShowSubConts = -1;
setTimeout("if(currShowSubConts != " + num + " && prevNum == " + num + ")hideAll(" + num + ");",150);
}

function hideAll(num) {

if(num != currActive) {
document.getElementById("mn" + num).src = "_img/menu" + num + ".gif";;

var id_p = num - 1;
var id_n = num;
var id_nn = num+1;

var lp = document.getElementById("r" + id_p)
if(lp)
lp.style.backgroundColor = "#818b94";

var rp = document.getElementById("r" + id_n)
var rpp = document.getElementById("r" + id_nn)
if(rp && rpp){
rp.style.backgroundColor = "#818b94";}
else {rp.style.backgroundColor = "#576470";}
}

var subconts = document.getElementById("subcont" + num);
if(subconts)
subconts.style.display = "none";

prevNum = -1;
}

function hideSubconts(num,inTree) {
var stayClass = false;
if(typeof(inTree) != "undefined")
stayClass = inTree;

chClassO(num,stayClass);
}

function clickText(sNum)
{
obj_div=document.getElementById("info" + sNum);
if (obj_div.style.display=="block")
obj_div.style.display="none";
else
obj_div.style.display="block";
}