if (typeof ie == 'undefined') var ie = 0;

function getAbsPos(obj) {
	var x = obj.offsetLeft;
	var y = obj.offsetTop;
	while( obj = obj.offsetParent ){
		x += obj.offsetLeft;
		y += obj.offsetTop;
	}
	return {'x':x,'y':y};
}

function highlight() {	
	debug = '---<br>'
	
	var menu = document.getElementById("menu").childNodes
	var x = getAbsPos(document.getElementById("menu"))['x'] - 40
	var y = 0
	
	debug+='x:'+x+'<br>'
	debug+='location.href: '+location.href
	
	for (var i=1-ie; i<menu.length; i=i+2-ie) {
		debug+=i+' '+menu[i].childNodes[0]
		menuitemhref=String(menu[i].childNodes[0])
		if (menu[i].childNodes[0] == location.href ||  menu[i].childNodes[0]+'/' == location.href || location.href.split('/')[3] == menuitemhref.split('/')[3] || location.href.split('/')[3] == 'ng'+menuitemhref.split('/')[3]) {
			y = getAbsPos(menu[i])['y'] - 25
			debug+='      <--------------'
		}
		debug+='<br />'
	}
		
	//document.URL
	document.getElementById("highlight").style.left = x + 'px'
	document.getElementById("highlight").style.top  = y + 'px'
	document.getElementById("highlight").style.display  = 'block'

	//document.getElementById("content").innerHTML = debug
}
// function highlight1() {
// 	debug = ''
// 	x = document.getElementById("menu").offsetLeft - 40
// 	//debug+=x
// 	
// 	menu = document.getElementById("menu").childNodes
// 	for (var i=1; i<menu.length; i+=2) {
// 		debug+=menu[i].offsetTop+'px '
// 		debug+=(i+1)/2+' '+menu[i].childNodes[0]
// 		if (menu[i].childNodes[0] == location.href) {
// 			y = menu[i].offsetTop+10
// 			debug+='      <--------------'
// 		}
// 		debug+='<br />'
// 	}
// 	//document.URL
// 	document.getElementById("highlight").style.left = x + 'px'
// 	document.getElementById("highlight").style.top  = y + 'px'
// 	
// 	document.getElementById("content").innerHTML = debug
// }

