//<script>
<!--
/*
+-----------------------------------------------------------+
+															+
+	dmenu created by alon valadji (al val)					+
+	contact at alon@a-v.co.il; contact@dwd.co.il			+
+															+
+	visit http://www.dwd.co.il/								+
+	visit http://a-v.co.il/script/							+
+															+
+															+
+	can be used freely as long as this note included		+
+															+
+-----------------------------------------------------------+
*/
window.onload = function() {
	inisializeMenu();
}
			
function mover() {
	var li = this;
	var xy = FindXYWH(li);

	if(li.istop){
		li.sub.style.top = xy.y + xy.h + "px";
		li.sub.style.left = xy.x + "px";
	}else{
	    li.style.background = "#e77d81";
		li.sub.style.top = xy.y - 1 + "px";
		li.sub.style.left = xy.x + li.sub.offsetWidth - 2 + "px";
	}
	
	
	li.sub.style.visibility = "visible";
}
			
function mout() {
	var li = this;
	if(!li.istop){li.style.background = ""};
	li.style.color = "";
	li.sub.style.visibility = "hidden";
	
}
			
function inisializeMenu() {
	var menu = document.getElementById("menu");
	var lis = menu.getElementsByTagName("li");
	for (var i = 0; i < lis.length; i++){
		var li = lis[i];
		var ul = li.getElementsByTagName("ul")[0];
		if(ul){
			li.sub = ul;
			li.onmouseover = mover;
			li.onmouseout = mout;
			li.istop = li.parentNode == menu ? true : false;
			
			for(var a = 0; a < li.childNodes.length; a++) {
				if(li.childNodes[a].nodeName == "A") {					
					li.childNodes[a].className = "hasSubMenu";								
				}
			}
		}
	}
}

function FindXY(obj) {
	var x=0,y=0;
	while (obj){
		x+=obj.offsetLeft - (obj.scrollLeft || 0);
		y+=obj.offsetTop - (obj.scrollTop || 0);
		obj=null;
	}
	return {x:x,y:y};
}

function FindXYWH(obj) {
	if (!obj) return { x:0, y:0, w:0, h:0 };
	var objXY = FindXY(obj);
	return { x:objXY.x, y:objXY.y, w:obj.offsetWidth||0, h:obj.offsetHeight||0 };
}
-->