
	var mItems = new Array();
	var mLoaded = false;

//	===========================================================================

function mItem(id, img1, img2, arg) {
	this.id = id;
	this.msImg1 = new Image();
	this.msImg1.src = img1;
	if (img2) {
		this.msImg2 = new Image();
		this.msImg2.src = img2;
	}
	else {
		this.msImg2 = false;
	}

	var idx = 0;
	this.tekst = new Array();
	this.link = new Array();

	for (var l=3; l<arg.length; l+=2) {
		this.link[idx] = arg[l];
		this.tekst[idx] = arg[l+1];
		idx++;
	}

	this.isOn = false;
}


function anItem(id, img1, img2) {
	var i = mItems.length;
	mItems[i] = new mItem(id, img1, img2, arguments);
	mItems[id] = mItems[i];
}


// ============================================================================

function aLay(id) {
	if (ua_ns4) {
		this.e = document.layers[id];
		this.s = this.e;
	}
	else if (ua_all) {
		this.e = document.all[id];
		this.s = this.e.style;
	}
	else if (ua_dmc) {
		this.e = document.getElementById(id);
		this.s = this.e.style;
	}
}

function clickHandler() {
	alert(1);
	return false;
}

function mInit() {

	var b 	= navigator.userAgent.toLowerCase();
	ua_dmc	= document.getElementById ? true : false;
	ua_all	= document.all ? true : false;
	ua_op	= (b.indexOf("opera")!=-1 && !document.replaceChild) ? true : false;
	ua_ie	= (ua_all && !ua_op);
	ua_ns4	= document.layers ? true : false;

	if (ua_ns4) {
		aLay.prototype.show = function() {this.e.visibility='show';}
		aLay.prototype.hide = function() {this.e.visibility='hide';}
	}
	else {
		aLay.prototype.show = function() {this.s.visibility='visible';}
		aLay.prototype.hide = function() {this.s.visibility='hidden';}
	}

	if (ua_all || ua_op) {
		aLay.prototype.setPos = function(x,y) { this.s.pixelLeft=x; this.s.pixelTop=y; }
	}
	else if (ua_ns4) {
		aLay.prototype.setPos = function(x,y) { this.e.moveTo(x,y); }
	}
	else if (ua_dmc) {
		aLay.prototype.setPos = function(x,y) { this.s.left=x+'px'; this.s.top=y+'px'; }
	}

	if (ua_op) {
		aLay.prototype.getHeight = function() {return this.s.pixelHeight;}
	}
	else if (ua_dmc) {
		aLay.prototype.getHeight = function() {return this.e.offsetHeight;}
	}
	else if (ua_all) {
		aLay.prototype.getHeight = function() {return this.e.offsetHeight;}
	}
	else if (ua_ns4) {
		aLay.prototype.getHeight = function() {return this.e.clip.height;}
	}


	var yp = menuY, id, o, l, a;

	for (var i=0; i<mItems.length; i++) {

		o = mItems[i];
		id = o.id;
		o.m = new aLay(id);
		o.m.id = id;
		o.s = null;

		if (o.link.length>0) {
			o.s = new aLay(id+'s');
			o.s.id = id+'s';

			for (l=0; l<o.link.length; l++) {
				a = ua_ns4 ? o.s.e.document.links[l] :
					ua_dmc ? document.getElementById(id+'_'+l) :
					document.all[id+'_'+l];
				a.lObj = o.link[l];
				a.onclick = gol;
				a.onmouseover = noStatus;
			}
		}
		o.y = yp;

		yp += o.m.getHeight();

		o.p = (typeof document[id+'img']!='undefined') ?
			document[id+'img'] : document[id].document[id+'img']
	}

	mLoaded = true;
	mLineUp();
}

// ============================================================================

function noStatus() {
	return true;
}

hiLink = null;

function gol() {
	if (hiLink) hiLink.className = 'mLnk';
	this.className = 'mLnkOn';
	hiLink = this;
	var p = this.lObj.split(",");
	if (p.length>1) {
		var f = (p[1].toLowerCase=='top') ? top :
			(p[1].toLowerCase=='this') ? self :
			(p[1].toLowerCase=='self') ? self :
			(p[1].toLowerCase=='parent') ? parent :
			parent.frames[p[1]];
		f.location=p[0];
    }
	else {
		parent.frames[defaultFrame].location = p[0];
    }
	return false;
}

function iShow(n,a) {
	if (a.blur) a.blur();
	if (mLoaded) {
		var i = mItems[n];
		if (i.isOn) {
			mLineUp();
		}
		else {
			mLineUp();
		    if (i.msImg2) i.p.src=i.msImg2.src;
		    if (i.link.length==0) return true;
		    mInsSub(n);
		    i.s.show();
		    i.isOn = true;
		}
	}
	return false;
}


function mInsSub(n) {
	var yp = mItems[n].y + mItems[n].m.getHeight();
	mItems[n].s.setPos(menuX+submX,yp);
	mLineUpFrom(n+1,yp + mItems[n].s.getHeight());
}

function mLineUpFrom(n,yp) {
	for (var i=n; i<mItems.length; i++) {
		mItems[i].m.setPos(menuX,yp);
		yp += mItems[i].m.getHeight();
	}
}

function mLineUp() {
	for (var i=0; i<mItems.length; i++) {
		if (mItems[i].isOn) {
			var o = mItems[i];
			o.p.src=o.msImg1.src;
			o.s.hide();
			o.isOn = false;
		}
	}
	mLineUpFrom(0,menuY);
}

function getMenuStr(i) {
	if (mItems[i].link.length==0) return '';

	var s = '';

	s += '<div id="' + mItems[i].id + 's" style="" class="aSub">\n';
	s += '<table width=110 cellspacing="0" cellpadding="0" border="0"><tr><td background="'+subBgImg+'">\n';

	for (var l=0; l<mItems[i].link.length; l++) {
		s += '<a id=' + mItems[i].id + '_' + l +
				' class=mLnk href="#">' + mItems[i].tekst[l] + '</a><br>\n';
	}

	s += '</td></tr><tr><td class=klein height='+subBottImgHeight+'><img src="'+subBottomImg+
			'" width='+subBottImgWidth+' height='+subBottImgHeight+' border=0 alt="">';

	s += '</td></tr></table></div>';

	return s;
}
