var isDOM = (document.getElementById ? true : false);
var isIE4 = ((document.all && !isDOM) ? true : false);
var isNS4 = (document.layers ? true : false);
var isNS = navigator.appName == "Netscape";

function getRef(id) {
	if (isDOM) return document.getElementById(id);
	if (isIE4) return document.all[id];
	if (isNS4) return document.layers[id];
}

function b_show_menu(){ 
	if(active<-1) active=-1;
	if(active>m_l) active=m_l;
	for(var i=1; i<=m_l; i++) {
		if((getRef(i).className == "menuHover")&&!(i==active)){
			getRef(i).className = "menuNormal"; 
			getRef("sm"+i).className = "menuNormal"; 
		}
		if(!(i==active)){
			if(i==1) {getRef("m_border_right").className="m_right_on"}
			if(i==m_l) {getRef("m_border_left").className="m_left_on"}
		}
		if((i==active)&&!(active==-1)){
			getRef(i).className = "menuHover"; 
			getRef("sm"+i).className = "menuHover"; 
			if(active==1) {getRef("m_border_right").className="m_right_off"}
			if(active==m_l) {getRef("m_border_left").className="m_left_off"}
		}
		if(!(s_active==-1)) {getRef("sml"+active+s_active).className = "menuitemactive";}
	}
}

function b_expand(s){
	curent=s.id;
	if(active<-1) active=-1;
	if(active>m_l) active=m_l;
	for(var i=1; i<=m_l; i++){ 
		if((getRef(i).className == "menuHover")&&!(i==curent)&&!(i==active)){
			getRef(i).className = "menuNormal"; 
			getRef("sm"+i).className = "menuNormal"; 
		}
		if(!(i==active)&&!(i==curent)){
			if(i==1) {getRef("m_border_right").className="m_right_on"}
			if(i==m_l) {getRef("m_border_left").className="m_left_on"}
		}
		if(i==curent){
			if(!(active==-1)) {getRef("sm"+active).className = "menuNormal";}
			getRef(i).className = "menuHover"; 
			getRef("sm"+i).className = "menuHover"; 
			if(curent==1) {getRef("m_border_right").className="m_right_off"}
			if(curent==m_l) {getRef("m_border_left").className="m_left_off"}
		}
		if((i==active)&&!(active==-1)){ 
			getRef(i).className = "menuHover"; 
			if(active==1) {getRef("m_border_right").className="m_right_off"}
			if(active==m_l) {getRef("m_border_left").className="m_left_off"}
		}
	}
}

function b_collapse(){ 
	for(var i=1; i<=m_l; i++) {
		if((getRef(i).className == "menuHover")&&!(i==active)){
			getRef(i).className = "menuNormal"; 
			getRef("sm"+i).className = "menuNormal";

			if(i==1) {getRef("m_border_right").className="m_right_on"}
			if(i==m_l) {getRef("m_border_left").className="m_left_on"}
		}
		if((i==active)&&!(active==-1)){ 
			getRef(i).className = "menuHover"; 
			getRef("sm"+i).className = "menuHover"; 
			if(i==1) {getRef("m_border_right").className="m_right_off"}
			if(i==m_l) {getRef("m_border_left").className="m_left_off"}
		}
	}
}

function wopen(id){
	if(id == 2) window.open("./","_self");
	else if(id == 6) window.open("?mod=martor","_self");
	else window.open("?cat="+id,"_self"); 
} 
function b_wopen(id){
	window.open("?p=2&c="+id+"&sc=-1","_self"); 
}