var arrT = Array(null, null, null);
var arrnavid = new Array();
var arrnavli = new Array();

function showsub(subnavid, subnavli, sublevel){
var t = getobj(subnavid);
var s = getobj(subnavli);
	
	if(t.style.display=='none'){
		t.style.display='';
		s.className='navmin';
		try{
			getobj(arrnavid[sublevel]).style.display='none';
			getobj(arrnavli[sublevel]).className='navplus';
			for(var j=sublevel;j<arrnavid.length;j++){
				getobj(arrnavid[j]).style.display='none';
				getobj(arrnavli[j]).className='navplus';
				arrnavid[j] = null;
				arrnavli[j] = null;
			}
		}
		catch(e){
		}
		arrnavid[sublevel] = subnavid;
		arrnavli[sublevel] = subnavli;
	}else{
		t.style.display='none';
		s.className='navplus';
		arrnavid[sublevel] = null;
		arrnavli[sublevel] = null;
	}
}

function getobj(id){
	return document.getElementById(id);
}

function moveon(object,level){
	switch(level){
		case 0:
			try{
				arrT[0].className = '';
			}
			catch(e){
			}
			break;
		case 1:
			try{
				arrT[1].className = '';
			}
			catch(e){
			}
			break;
		case 2:
			try{
				arrT[2].className = '';
			}
			catch(e){
			}
			break;
	}
	//object.className = 'selected';
	arrT[level] = object;
}

function moveoff(object, level){
	//object.className = '';
}

function setHeight(){
var topmenu = getobj('topmenu');
var content = getobj('content');
var footer = getobj('footer');
var targetheight = getHeight() - topmenu.clientHeight - footer.clientHeight;
	
	content.style.height = targetheight + 'px';
	window.onresize = setHeight;
}

function getHeight(){
	var myHeight=0;
	
	if(typeof(window.innerWidth)=='number'){
		myHeight = window.innerHeight;
	}else if(document.documentElement&&( document.documentElement.clientWidth||document.documentElement.clientHeight)){
		myHeight = document.documentElement.clientHeight;
	}else if(document.body&&(document.body.clientWidth||document.body.clientHeight)){
		myHeight = document.body.clientHeight;
	}
	return myHeight;
}

function disableRightClick(){
	isIE=document.all;
	isNN=!document.all&&document.getElementById;
	isN4=document.layers;
	
	if(isIE||isNN){
		document.oncontextmenu=checkV;
	}else{
		document.captureEvents(Event.MOUSEDOWN || Event.MOUSEUP);
		document.onmousedown=checkVNS4;
	} 
}

function checkVNS4(e){
	if(e.which==2||e.which==3){
		return !checkElement(e);
	}	
}

function checkV(e){
	return !checkElement(e);
}

function checkElement(e){
var targ;
	if(!e) var e = window.event;
	if(e.target){
		targ = e.target;
	}
	else if(e.srcElement){
		targ = e.srcElement;
	}
	if(targ.nodeType == 3) targ = targ.parentNode;
	
	if(targ){
		return (targ.tagName=='IMG');
	}else{
		return false;
	}
}

disableRightClick();