<!--

function menu(id,x,y) {
	if      (document.getElementById) this.object=document.getElementById(id);
	else if (document.all)            this.object=document.all[id];
	else if (document.layers)         this.object=document.layers[id];
	
	if (x || y) {
		this.x=x;
		this.y=y;
	} else {
		this.x=-32767;
		this.y=-32767;
	}
	
	this.addItem=_addItem;
	this.addSubmenu=_addSubmenu;
	this.showMenu=_showMenu;
	this.hideMenu=_hideMenu;

	this.n=0;
	this.parent;
	this.id=new Array();
	this.fader=new Array();
	this.lct=new Array();
	this.iy=new Array();
	this.sub=new Array();
	this.hide=new Array();

	this.overItem=_overItem;
	this.outItem=_outItem;
	this.clickItem=_clickItem;

	this.init=-1;
	this.current=-1;

	if      (document.layers)   this.object.visibility="hide";
	else if (this.object.style) this.object.style.visibility="hidden";
	else                        this.object.visibility="hidden";

	this.objectId="__menu"+id;
	eval(this.objectId+"=this");
	return this;
}

function _addItem(id,fader,lct,init) {
	this.id[this.n]=id;
	this.fader[this.n]=fader;
	this.lct[this.n]=lct;

	if (this.n < 1) {
		if (document.getElementById)
			this.iy[0]=document.getElementById(id).offsetHeight;
		else if (document.all)
			this.iy[0]=document.all[id].offsetHeight;
		else if (document.layers)
			this.iy[0]=this.object.document.layers[id].document.height;
		else
			this.iy[0]=20;	
	} else {
		if (document.getElementById)
			this.iy[this.n]=this.iy[this.n-1]+document.getElementById(id).offsetHeight;
		else if (document.all)
			this.iy[this.n]=this.iy[this.n-1]+document.all[id].offsetHeight;
		else if (document.layers)
			this.iy[this.n]=this.iy[this.n-1]+this.object.document.layers[id].document.height;
		else
			this.iy[this.n]=this.iy[this.n-1]+20;	
	}


	if (init) this.init=this.n;

	this.n++;
}

function _addSubmenu(id,sub,hide,dx,dy) {
	var menuItem;

	for (var i=0; i < this.n; i++)
		if (this.id[i] == id) {
			this.sub[i]=sub;

			if (hide == 'hide') this.hide[i]=1;
			else                this.hide[i]=0;

			sub.parent=this.object;

			if (sub.x == -32767 && sub.y == -32767) {
				sub.x=dx;
				sub.y=this.iy[i]+dy;
			}
			break;
		}
}

function _showMenu(click) {
	var x,y;

	if (this.object) {
		if (this.x != -32767 || this.y != -32767) {
			if (this.parent) {
				if (this.object.style) {
					x=parseInt(this.parent.style.left)+this.x;
					y=parseInt(this.parent.style.top)+this.y;
				} else {
					x=this.parent.left+this.x;
					y=this.parent.top+this.y;
				}
			} else {
				x=this.x;
				y=this.y;
			}

			if (document.layers) {
				this.object.moveTo(x,y);
			} else if (this.object.style) {
				this.object.style.left=x+"px";
				this.object.style.top=y+"px";
			} else {
				this.object.left=x;
				this.object.top=y;
			}
		}	

		if      (document.layers)   this.object.visibility="show";
		else if (this.object.style) this.object.style.visibility="visible";
		else                        this.object.visibility="visible";
	}

	if (click) {
		if (this.current >= 0)   this.clickItem(this.id[this.current]);
		else if (this.init >= 0) this.clickItem(this.id[this.init]);
	}

	if (this.current >= 0) {
		if (this.fader[this.current]) this.fader[this.current].fadeIn();
		if (this.sub[this.current])   this.sub[this.current].showMenu(click);
	}
}

function _hideMenu() { 
	if (this.current >= 0) {
		if (this.sub[this.current])   this.sub[this.current].hideMenu();
		if (this.fader[this.current]) this.fader[this.current].fadeOut();
	}

	if (this.object) {
		if      (document.layers)   this.object.visibility="hide";
		else if (this.object.style) this.object.style.visibility="hidden";
		else                        this.object.visibility="hidden";
	}
}

function _overItem(id) {
	for (var i=0; i < this.n; i++)
		if (this.id[i] == id) {
			if (i != this.current) {
				if (this.current >= 0) {
					if (this.sub[this.current] && this.hide[this.current]) this.sub[this.current].hideMenu();
					if (this.fader[this.current])                          this.fader[this.current].fadeOut();
				}

				if (this.fader[i]) this.fader[i].fadeIn();
			}
			break;
		}
}

function _outItem(id) {
	for (var i=0; i < this.n; i++)
		if (this.id[i] == id) {
			if (i != this.current) {
				if (this.fader[i]) this.fader[i].fadeOut();

				if (this.current >= 0) {
					if (this.fader[this.current]) this.fader[this.current].fadeIn();
					if (this.sub[this.current])   this.sub[this.current].showMenu();
				}
			}
			break;
		}
}

function _clickItem(id) {
	var i;

	if (id) {
		for (i=0; i < this.n && this.id[i] != id; i++);
	} else if (this.current >= 0) {
		i=this.current;
		this.current=-1;
	} else {
		i=0;
	}

	if (i < this.n) {
		if (i != this.current) {
			if (this.current >= 0) {
				if (this.sub[this.current])   this.sub[this.current].hideMenu();
				if (this.fader[this.current]) this.fader[this.current].fadeOut();
			}

			if (this.fader[i]) this.fader[i].fadeIn();
			if (this.sub[i])   this.sub[i].showMenu('click');

			this.current=i;
		}
	}
	
	if (this.current >= 0 && this.lct[this.current])
		parent.frames.bodyKluver.location=this.lct[this.current];
}

//-->
