

var bilh = new BILH();

function BILH(){
	this.ver = navigator.appVersion
	this.dom = (document.getElementById)? 1 : 0
	
	this.ie5 = ((this.ver.indexOf("MSIE 5") >= 0) && this.dom)? 1 : 0;
	this.ie4 = (document.all && !this.dom)? 1 : 0;
    this.ns6 = (this.dom && parseInt(this.ver) >= 6)? 1 : 0;
	this.ns5 = (this.dom && parseInt(this.ver) >= 5)? 1 : 0;
	this.ns4 = (document.layers && !this.dom)? 1 : 0;
		
	this.refs = new Object();
	
	this.useMenu = true;
	this.current = "";
	this.timerID = null;
	this.navImgID = "";
	this.defaultMenu = "";
}

BILH.prototype.register = function() {
	var layerID, i;
	
	if (arguments.length > 0) 
		for (i=0; i < arguments.length; i++) {
			if (typeof (arguments[i]) == "string") {
				layerID = arguments[i];
				this.refs[layerID] = new Object();
				
				this.refs[layerID].name = layerID;
				this.refs[layerID].layer = (this.dom)? document.getElementById(layerID) : (this.ie4)? document.all[layerID] : (this.ns4)?  document[layerID] : 0;
				this.refs[layerID].style = (this.dom)? document.getElementById(layerID).style : (this.ie4)? document.all[layerID].style : (this.ns4)?  document[layerID] : 0;
			}
		}
		
	return;
}

BILH.prototype.show = function(layerID) {
	if (typeof(this.refs[layerID]) != "undefined") {
		this.refs[layerID].style.visibility = (this.ns4)? "show" : "visible";
		this.refs[layerID].style.display = "inline";
		if (this.useMenu) this.current = layerID;
	}
	
	return;
}

BILH.prototype.hide = function(layerID) {
	if (typeof(this.refs[layerID]) != "undefined") {
		this.refs[layerID].style.visibility = (this.ns4)? "hide" : "hidden";
		this.refs[layerID].style.display = "none";		
	}
	
	return;
}

BILH.prototype.hideMenu = function(layerID, hideDefault) {
	if (this.useMenu) {
		this.timerID = setTimeout("bilh.hideMenuAll(" + hideDefault + ");", 250);
	}
	
	return;
}

BILH.prototype.hideMenuAll = function(hideDefault) {
	var item;
	
	if (re && (this.navImgID != "")) re.setOff(this.navImgID);
	
	if (this.useMenu) {
		if (typeof(swap) != "undefined") stuntSwap(0); 
		
		for (item in this.refs) {
			//alert(item);
			this.hide(this.refs[item].name);
		}

		if ((this.defaultMenu != "") && !hideDefault) this.show(this.defaultMenu);
	}
	
	return;
}

BILH.prototype.showMenu = function(layerID, navImgID) {
	if (this.useMenu) {
		clearTimeout(this.timerID);
		
		this.hideMenuAll(true);
		if (typeof(swap) != "undefined") stuntSwap(1); 
		
		if ((layerID != "") && (typeof(this.refs[layerID]) != "undefined")) this.show(layerID);
		
		if (re && re.useOnState && (typeof(navImgID) != "undefined")) {
			re.setOn(navImgID);
			this.navImgID = navImgID;
		}

		if (re && re.useOverState && (typeof(navImgID) != "undefined")) {
			re.setOver(navImgID);
			this.navImgID = navImgID;
		}
	}
	
	return;
}

BILH.prototype.getContent = function(layerID) {	
	return (this.refs[layerID].layer.innerHTML)? this.refs[layerID].layer.innerHTML : "";
}

BILH.prototype.setContent = function(layerID, str) {	
	if(document.all) {
		this.refs[layerID].layer.innerHTML = str;
		//eval(this.alias + ".innerHTML = str;");
	} else {	// even if NS 4, store the text as innerHTML for
		// later retrieval by getContent()	
		this.refs[layerID].layer.innerHTML = str;

		if(document.layers) {
			with(this.refs[layerID].layer.document) {
				open();
				write(str);
				close();
			}
		}
	}
}