var ns=(document.layers)?1:0;
function lib_bwcheck(){
	this.ver=navigator.appVersion
	this.agent=navigator.userAgent
	this.dom=document.getElementById?1:0
	this.opera5=this.agent.indexOf("Opera 5")>-1
	this.ie5=(this.ver.indexOf("MSIE 5")>-1 && this.dom && !this.opera5)?1:0; 
	this.ie6=(this.ver.indexOf("MSIE 6")>-1 && this.dom && !this.opera5)?1:0;
	this.ie7=(this.ver.indexOf("MSIE 7")>-1)?1:0;
	this.ie8=(this.ver.indexOf("MSIE 8")>-1)?1:0;
	this.ie4=(document.all && !this.dom && !this.opera5)?1:0;
	this.ie=this.ie4||this.ie5||this.ie6||this.ie7||this.ie8;
	this.mac=this.agent.indexOf("Mac")>-1
	this.ns6=(this.dom && parseInt(this.ver) >= 5) ?1:0; 
	this.ns4=(document.layers && !this.dom)?1:0;
	this.bw=(this.ie || this.ns4 || this.ns6 || this.opera5)
	return this
}
var bw=new lib_bwcheck()
var px = bw.ns4||window.opera?"":"px";
//Opera 5 resize fix.
if(navigator.userAgent.indexOf('Opera')>-1 && document.getElementById){ 
	scrX= innerWidth; scrY= innerHeight;
	document.onmousemove= function(){
		if(scrX<innerWidth-10 || scrY<innerHeight-10 || scrX>innerWidth+10 || scrY>innerHeight+10){
			scrX = innerWidth;
			scrY = innerHeight;
			menuinit();
		}
	};
}
function getMenu(id,nest){
	if(bw.ns4)nest= (!nest)?"document":'document.'+nest+'.document';
	else nest="document";
	if (document.layers) return eval(nest+".layers[id]");
	else if (document.all) return document.all[id];
	else return document.getElementById(id);
}
function getFoTop(id, nest){
	if (bw.ns4) return getMenu(id, nest).top;
	else if (bw.opera5) return getMenu(id, nest).style.pixelTop;
	else return getMenu(id, nest).offsetTop;
}
function getAlHeight(id, nest){
	if (bw.ns4) return getMenu(id,nest).clip.height;
	else if (bw.opera5) return getMenu(id,nest).style.pixelHeight;
	else return getMenu(id,nest).offsetHeight;
}
function setFoTop(id, nest, num){
	if (bw.ns4) getMenu(id, nest).top = num+px;
	else getMenu(id, nest).style.top = num+px;
}
function setFoHeight(id, num, w){
	if (bw.opera5) getMenu(id).style.pixelHeight = num+px;
	else if (bw.ns4) getMenu(id).clip.bottom = num+px;
	else getMenu(id).style.clip="rect(0,"+w+","+num+",0)";
}
function setWidth(id, nest, num, h){
	if (bw.opera5) getMenu(id, nest).style.pixelWidth = num+px;
	else if (bw.ns4){ getMenu(id, nest).clip.right=num+px;
	getMenu(id, nest).clip.bottom = h+px;}
	else {getMenu(id, nest).style.clip="rect(0,"+num+","+h+",0)";
		getMenu(id, nest).style.width=num;}
}
function setLeft(id, nest, num){
	if (bw.ns4) getMenu(id, nest).left = num+px;
	else getMenu(id, nest).style.left = num+px;
}
function setVisible(id, bVisible){
	if (bw.ns4) getMenu(id).visibility=bVisible;
	else getMenu(id).style.visibility=bVisible;
	}
function menuinit(){
	if (bw.bw){
	oFo = new Array()
	for (var i=0; i<13; i++){
		oFo[i] = new getMenu('divFo'+i);}
	collapse();
	}
}
var yFo=new Array(0,2,2,22,42,62,82,102,122,142,162,182,280)
var bCollapsed=true;
var numExp=0;
function collapse() {
	for (var i=1; i<13; i++){
		setFoTop("divFo"+i,"",yFo[i]+138);
		if (i!=12)
		setFoHeight("divFo"+i, 18, 210);
		setVisible("divFo"+i,"visible")
		if (document.getElementById("divAl"+i)=="[object]")
			setVisible("divAl"+i,"hidden")
	}
			bCollapsed=true
}
function expand(num)
{
	collapse()
	var alHeight=getAlHeight("divAl"+num, "divFo"+num);
	for (var i=12; i>num; i--){
		var h=yFo[i]+alHeight;
		setFoTop("divFo"+i,"",h+138);
		setVisible("divFo"+i,"visible")
		}
	setVisible("divAl"+num,"visible")
	setFoHeight("divFo"+num, 80, 210);
		
	for (i=num; i>=0; i--)
	{
		setFoTop("divFo"+i,"",yFo[i]+138)
	}
	bCollapsed=false;
	numExp=num;
	return false
}	
