var mItem = [];
var mTime = [];
var mWait = 250;
var mSub = false;
var navTop;
function mSet(ul) {
	var navM;
	if (document.getElementById(ul)) {
	 navM = document.getElementById(ul);
	 navTop = navM.offsetTop;
/*	 navm = document.getElementById(ul);
	 ul = navm.getElementsByTagName('ul');
	 var i, j, e, a, f, b;
	 var subid, pclass;
	 var m = mItem.length;
	 for (i = 0; i < ul.length; i++) {
		 if (ul[i].getAttribute('id') == null || ul[i].getAttribute('id') == undefined) {
			 crnt = 0;
			 e=	ul[i].getAttribute('id');	
			 pclass = ul[i].parentNode.getAttribute('class');
			 subid=pclass.replace("page_item page-item-", "sub");
			 crnt = subid.indexOf(' current');
			if (crnt >0) {
				subid = subid.substring(0, crnt);
			}
			mItem[m] = subid;
			e = ul[i];
			ul[i].setAttribute("id", subid);
/*			 e.className = c;
			 f = new Function('mShow(\'' + mItem[m] + '\',' + e.offsetTop +',' + e.offsetLeft +');');
			 b = new Function('mBlur(\'' + mItem[m] + '\');');
			 sf = new Function('mKeep(\'' + mItem[m] + '\');');
			 sc = new Function('mClear(\'' + mItem[m] + '\');');
			 sr = new Function('mRelease(\'' + mItem[m] + '\');');*/
/*			 e.onmouseover = f;
			 e.onmouseout = b;*/
/*			window.alert(ul[i].getAttribute('id'));*/
/*			 a = e.getElementsByTagName('li');
			 for (j = 0; j < a.length; j++) {
				 a[j].onfocus = f;
				 a[j].onblur = b;
				 a[j].onmouseover = f;
			 }
			subn = document.getElementById(mItem[m]);
			subn.onmouseover = sf;
			subn.onfocus = sf;
			subn.onclick = sc;
*						 
			 m++;
		 }
	 }*/
}}


function mShow(id) {
	var top, left;
	if(document.getElementById(id)){
		submenu  = document.getElementById(id);
		prnt = submenu.parentNode;
		top = getY(prnt);
		left = getX(prnt);
	var browser=navigator.appName;
	var b_version=navigator.appVersion;
	var version=parseFloat(b_version);
	if (browser=="Microsoft Internet Explorer" && version>=4){
		left = left -0;
	}
		mSub = false;
		for (var i = 0; i < mItem.length; i++) {
			if (document.getElementById(mItem[i]).style.display != 'none') {
				if (mItem[i] != id) mHide(mItem[i]);
				else mClear(mItem[i]);
			}
		}
		document.getElementById(id).style.top = top + 'px';
		document.getElementById(id).style.left = left + 'px';
	
		document.getElementById(id).style.display = 'block';
	}
}


function mHide(id) {
if(document.getElementById(id)){

	if(!mSub){
		mClear(id);
		document.getElementById(id).style.display = 'none';
	}
}
}


function mBlur(id) {
	if(!mSub){
	mTime[id] = setTimeout('mHide(\'' + id + '\');', mWait);
	}
}

function mClear(id) {
	if (mTime[id]) {
		clearTimeout(mTime[id]);
		mTime[id] = null;
	}
}
function getY( oElement )
{
	var iReturnValue = 0;
	while( oElement != null ) {
		iReturnValue += oElement.offsetTop;
		oElement = oElement.offsetParent;
	}
	return iReturnValue;
}
function getX( oElement )
{
	var iReturnValue = 0;
	while( oElement != null ) {
		iReturnValue += oElement.offsetLeft;
		oElement = oElement.offsetParent;
	}
	return iReturnValue;
}
