/************************\
  CSS Document 
  Fot Allahviranloo.com
**************************
  Auther: Saber Kazempur
  E-mail: Send@sorna.net
\************************/
var DtaMN=null;
var DtaMNUrl=null;
var DtaMNParent=null;

window.attachEvent("onload", DtaMNInit);

function DtaMNInit()
{
	DtaMN = document.getElementById("DtaMnu");
	DtaMNUrl = DtaMN.getAttribute("url");
	DtaMNParent = DtaMN.getAttribute("parent");
//	alert(DtaMNUrl);
	DtaMNAttach(DtaMN);
}

function DtaMNAttach(el)
{
//	el.attachEvent("onmouseenter", alert("mnpMenuEnter"));
//	el.attachEvent("onmouseleave", alert("mnpMenuLeave"));
	var divs = el.getElementsByTagName("DIV");
	for (var i=0; i < divs.length; i++)
	{
		var div = divs.item(i);
		if (div.className == "DtaMnuRow")
		{
			div.attachEvent("onmouseenter", mnpMenuMouseover);
			div.attachEvent("onmouseleave", mnpMenuMouseout);
			div.attachEvent("onmousedown", mnpMenuMousedown);
			div.attachEvent("onmouseup", mnpMenuMouseup);
			div.setAttribute("save-background", div.style.background);
			div.setAttribute("save-border", div.style.borderColor);
			
			var a = div.getElementsByTagName("A");
			if (a.length > 0)
			{
				var a0 = a[0];
				if (a0.getAttribute("aoff"))
					a0.outerHTML = a0.innerHTML;
				else
				{
					div.setAttribute("status", a0.href);
					div.attachEvent("onclick", mnpMenuClick);
				}
			}}}}

function mnpMenuMouseover()
{
	var div = window.event.srcElement;
	var status = div.getAttribute("status");
	if (status) window.status = status;
	div.style.background = "#DBE7FF";
//	div.style.borderColor = "#898989";
}

function mnpMenuMouseout()
{
	var div = window.event.srcElement;
	window.status = "";
	var menu = div.getAttribute("menu");
	if (menu != null && menu == div.parentElement.parentElement.getAttribute("currentMenu"))
	{
		div.style.background = "#CCCCCC";
		div.style.borderColor = "#CCCCCC";
	}
	else
	{
		div.style.background = div.getAttribute("save-background");
		div.style.borderColor = div.getAttribute("save-border");
	}
}

function mnpMenuMousedown()
{
	var div = window.event.srcElement;
	if (div.tagName != "DIV") div = div.parentElement;
	div.style.background = "#B6C9F3";
}

function mnpMenuMouseup()
{
	var div = window.event.srcElement;
	if (div.tagName != "DIV") div = div.parentElement;
	div.style.background = div.getAttribute("save-background");
}

function mnpMenuClick()
{
	var div = window.event.srcElement;
	var a = div.getElementsByTagName("A");
	if (a.length == 0) return;
	if (window.event.shiftKey)
	{
		var target = a[0].target;
		a[0].target = "_new";
		a[0].click();
		a[0].target = target;
	}
	else
		a[0].click();
}