window.onerror = null;
window.defaultStatus = '';

var initialized = 0;
var menus = new Array();
var menustatus = new Array();
var menuovers = new Array();

// Initialize the number of menus and the number of items for each one of them
var menucount = 6;
var menuitems = new Array();
menuitems[0] = 3;
menuitems[1] = 4;
menuitems[2] = 8;
menuitems[3] = 2;
menuitems[4] = 3;
menuitems[5] = 2;
// End Init

function init(){
	initialized = 1;
	menustatus = new Array(menucount);
	for(i=0; i<menucount; i++){
		menustatus[i] = "closed";
	}

	if (parseInt(navigator.appVersion) > 3){
		menuovers = new Array(menucount);
		menus = new Array(menucount);

		if(navigator.appName == "Netscape"){
			for(i=0; i<menucount; i++){
				eval("menuovers[" + i + "] = window.document.menu" + i + "overs;");
				eval("menus[" + i + "] = window.document.menu" + i + ";");
			}
		}
		else {
			for(i=0; i<menucount; i++){
				eval("menuovers[" + i + "] = document.all.menu" + i + "overs.style;");
				eval("menus[" + i + "] = document.all.menu" + i + ".style;");
			}
		}
	}
}

function show(menunumber) {
		if (parseInt(navigator.appVersion) < 4) {}
		else {
			if (menuovers[menunumber]) {
				menuovers[menunumber].visibility = 'visible';
				menuovers[menunumber].zIndex = '310';
			}
			menus[menunumber].visibility = 'visible';
			menus[menunumber].zIndex = '300';
			menustatus[menunumber] = 'open';
		}
}

function kohrkill() {
//alert('kohrkill');
	if (parseInt(navigator.appVersion) > 3) {
		for(i=0; i<menus.length; i++){
			if (menustatus[i] == 'open'){
				if (menuovers[i]){
					menuovers[i].visibility = 'hidden';
					menuovers[i].zIndex = '110';
				}
				menus[i].visibility = 'hidden';
				menus[i].zIndex = '100';
				menustatus[i] = 'closed';
			}
		}
	}

}

function imagerep(imgname, divname){
//alert('imagerep---' + imgname + '---' + divname);
//imgname = "drop_00";
//divname = "menu0overs";


	if (parseInt(navigator.appVersion) > 3){
		if (document.layers) eval("window.document." + divname + ".document.images['" + imgname + "'].src = dropover.src");
		else eval("document['" + imgname + "'].src = dropover.src");
	}
	//else{
	//	if (navigator.appName == "Netscape"){
	//		eval("document['imgmenu" + imgname + "'].src = menu" + imgname + "over.src");
	//		menustatus[imgname] = "open";
	//	}
	//}
}

function eraseimage(imgname, divname){
//alert('eraseimage---' + imgname + '---' + divname);

	if (parseInt(navigator.appVersion) > 3){
		if(document.layers) eval("window.document." + divname + ".document.images['" + imgname + "'].src = blank.src");
		else eval("document['" + imgname + "'].src = blank.src");
	}
	//else {
	//	if(navigator.appName == "Netscape"){
	//		eval("document['imgmenu" + imgname + "'].src = menu" + imgname + "off.src");
	//	}
	//}
//alert("2");
}

function netscapehider(){
//alert('netscapehider');
	if (initialized) kohrkill();
}

function iehider(){
	if (window.event.toElement && window.event.toElement.className != "menu") kohrkill();
}

if (!document.images) {}

else {
	var theCurPath = location.href;
	var i;
	var theRootPath;

	i = theCurPath.indexOf('org');
	i = theCurPath.indexOf('/', i); //after tai.org or hway.net/taiorg
	i = theCurPath.indexOf('/', i+1); //after development or production or whatever
	theRootPath = theCurPath.substring(0, i+1);

/*
	intNode = Math.max(theCurPath.indexOf('/docs/', 0), theCurPath.indexOf('\\docs\\', 0));

	if (intNode != -1)  {
		theCurPath = theCurPath.substring(intNode+1);
		intNode = Math.max(theCurPath.indexOf('/', 0), theCurPath.indexOf('\\', 0));
		while(intNode != -1) {
			theRootPath = theRootPath + "../";
			theCurPath = theCurPath.substring(intNode+1);
			intNode = Math.max(theCurPath.indexOf('/', 0), theCurPath.indexOf('\\', 0));
		}
	}
*/
	var theImgPath = theRootPath + "images/";
	var theDocPath = theRootPath + "docs/";

	var dropover=new Image();dropover.src=theImgPath + "dropover.gif";

	var blank=new Image();
	blank.src=theImgPath + "dot_clear.gif";
}

