
var bw;

function checkBrowser(){

	this.ver=navigator.appVersion
	this.dom=document.getElementById?1:0
	this.ie6=(this.ver.indexOf("MSIE 6")>-1 && this.dom)?1:0;
	this.ie5=(this.ver.indexOf("MSIE 5")>-1 && this.dom)?1:0;
	this.ie4=(document.all && !this.dom)?1:0;
	this.ns5=(this.dom && parseInt(this.ver) >= 5) ?1:0;
	this.ns4=(document.layers && !this.dom)?1:0;
	this.bw=(this.ie5 || this.ie6 || this.ie4 || this.ns4 || this.ns5)
	this.mac=(this.ver.indexOf("Mac")>-1)?1:0;
	this.win=(this.ver.indexOf("Win")>-1)?1:0;
	return this
}

bw=new checkBrowser();

ns = (bw.ns4 == 1 || bw.ns5 == 1)? true:false
ie = (bw.ie4 == 1 || bw.ie5 == 1 || bw.ie6)? true:false

//if ((navigator.appVersion.indexOf("MSIE 5")>-1 && document.getElementById) || (document.all && !document.getElementById)) 

var stayFolded=false

// for resizing events in Netscape Bug
// for more detail of bug explanation, goto http://www.webreference.com/dhtml/diner/resize/resize3.html
var strNS4 = navigator.appName;
var _expandList;

if (strNS4.indexOf("Netscape") >= 0) {

	origWidth = innerWidth;

    origHeight = innerHeight;

}

foldImg=0;

var exImg=new Image();
var unImg=new Image();

exImg.src='/images/arrow-down.gif';
unImg.src='/images/arrow-right.gif';

function makeMenu(obj,nest){
	nest=(!nest) ? '':'document.'+nest+'.'										
   	this.css=bw.dom? document.getElementById(obj).style:bw.ie4?document.all[obj].style:bw.ns4?eval(nest+"document.layers." +obj):0;		
	this.el=bw.dom?document.getElementById(obj):bw.ie4?document.all[obj]:bw.ns4?eval(nest+'document.'+obj):0;	
	this.ref=bw.dom || bw.ie4? document:bw.ns4?eval(nest+"document.layers." +obj+".document"):0;		
	this.x=(bw.ns4 || bw.ns5)? this.css.left:this.css.pixelLeft;
	this.y=(bw.ns4 || bw.ns5)? this.css.top:this.css.pixelTop;		
	this.height=bw.ns4?this.ref.height:this.el.offsetHeight;		
	this.hideIt=b_hideIt; this.showIt=b_showIt; this.vis=b_vis; this.moveIt=b_moveIt											
	return this
}


function b_showIt(){this.css.visibility="visible"}

function b_hideIt(){this.css.visibility="hidden"}

function b_vis(){if(this.css.visibility=="hidden" || this.css.visibility=="hide") return true;}

function b_moveIt(x,y){this.x=x; this.y=y; this.css.left=this.x; this.css.top=this.y}

function init(intFolder) {
	oTop=new Array()
	oTop[0]=new makeMenu('divTop1','divCont')
	oTop[1]=new makeMenu('divTop2','divCont')
	oTop[2]=new makeMenu('divTop3','divCont')
	oTop[3]=new makeMenu('divTop4','divCont')
	oTop[4]=new makeMenu('divTop5','divCont')
	oTop[5]=new makeMenu('divTop6','divCont')
	oTop[6]=new makeMenu('divTop7','divCont')
	oTop[7]=new makeMenu('divTop8','divCont')
	oTop[8]=new makeMenu('divTop9','divCont')
	oTop[9]=new makeMenu('divTop10','divCont')
	oTop[10]=new makeMenu('divTop11','divCont')
	oTop[11]=new makeMenu('divTop12','divCont')
	oTop[12]=new makeMenu('divTop13','divCont')
	oTop[13]=new makeMenu('divTop14','divCont')
	oSub=new Array()
	oSub[0]=new makeMenu('divSub1','divCont.document.divTop1')
	oSub[1]=new makeMenu('divSub2','divCont.document.divTop2')
	oSub[2]=new makeMenu('divSub3','divCont.document.divTop3')
	oSub[3]=new makeMenu('divSub4','divCont.document.divTop4')
	oSub[4]=new makeMenu('divSub5','divCont.document.divTop5')
	oSub[5]=new makeMenu('divSub6','divCont.document.divTop6')
	oSub[6]=new makeMenu('divSub7','divCont.document.divTop7')
	oSub[7]=new makeMenu('divSub8','divCont.document.divTop8')
	oSub[8]=new makeMenu('divSub9','divCont.document.divTop9')
	oSub[9]=new makeMenu('divSub10','divCont.document.divTop10')
	oSub[10]=new makeMenu('divSub11','divCont.document.divTop11')
	oSub[11]=new makeMenu('divSub12','divCont.document.divTop12')
	oSub[12]=new makeMenu('divSub13','divCont.document.divTop13')
	oSub[13]=new makeMenu('divSub14','divCont.document.divTop14')
   for(i=0;i<oSub.length;i++){ oSub[i].hideIt() }
	for(i=1;i<oTop.length;i++){ oTop[i].moveIt(0,oTop[i-1].y+oTop[i-1].height) }
  	oCont=new makeMenu('divCont')
  	oCont.showIt()
 	if (intFolder >= 0) {
	  	menu(intFolder);
	}
}

/*
function expandList(intList) {
	_expandList = intList;
	alert(_expandList);
}
*/
function menu(num){
	foldImg=(bw.ns4||bw.ns5)?0:1;
	// NO IMAGES
	foldImg = 0;
	if(bw.bw){
		if(!stayFolded){
			for(i=0;i<oSub.length;i++){
				if(i!=num){
					oSub[i].hideIt()
					if(foldImg)oTop[i].ref["imgA"+i].src=unImg.src
				}
			}
			
			for(i=1;i<oTop.length;i++){
				oTop[i].moveIt(0,oTop[i-1].y+oTop[i-1].height)
			}
		}
		
		if(oSub[num].vis()){
			oSub[num].showIt()
			if(foldImg)oTop[num].ref["imgA"+num].src=exImg.src
		}else{
			oSub[num].hideIt()
			if(foldImg)oTop[num].ref["imgA"+num].src=unImg.src
		}
		for(i=1;i<oTop.length;i++){ 
			if(!oSub[i-1].vis()) oTop[i].moveIt(0,oTop[i-1].y+oTop[i-1].height+oSub[i-1].height) 
			else oTop[i].moveIt(0,oTop[i-1].y+oTop[i-1].height)
		}
	}
}

function handleResize() {
	location.reload();
	return false;
}

function handleResizeNS40() {
	if (innerWidth == origWidth && innerHeight == origHeight) return
		origWidth = innerWidth; origHeight = innerHeight;
	location.reload();
	return;
}

function handleResizeNew() {
	diffWidth = Math.abs(innerWidth - origWidth);
	diffHeight = Math.abs(innerHeight - origHeight);
//alert('before:oW='+origWidth+'\niW='+innerWidth+'\noH='+origHeight+'\niH='+innerHeight+'\ndW='+diffWidth+'\ndH='+diffHeight);
	if (diffWidth >= 20 || diffHeight >= 20) {
		origWidth = innerWidth;
		origHeight = innerHeight;
//alert('before:oW='+origWidth+'\niW='+innerWidth+'\noH='+origHeight+'\niH='+innerHeight+'\ndW='+diffWidth+'\ndH='+diffHeight);
		location.reload();
	} 
	setTimeout("handleResizeNew()",500);
}

	
//if(bw.bw) onload=init;
