var ie, op, ge;
if(navigator.userAgent.indexOf("MSIE") >= 0){ie=true;}else{ie=false};
if(navigator.userAgent.indexOf("Opera") >= 0) op=true;
if(navigator.userAgent.indexOf("Gecko") >= 0) ge=true;
var current=null;
var active=null;
var submenu=null;
var AllTags;
var c=0;

function ShowActive()
	{
		document.getElementById(submenu).className="show";
	}

function HideActive()
	{
		document.getElementById(submenu).className="hidden";
	}

function f1 (event, id, top, left)
	{
	if(ie)
		{
			current = event.srcElement;
			}else{
			current = event.currentTarget;
		};
	current.onmouseout = f2;
//	document.getElementById(id).style.left = positionLeft(current)-20;
	document.getElementById(id).style.left = left;
	document.getElementById(id).style.top=top;
	if(active != null && active != current)
		{
		HideActive();
		active = current;
		submenu = id;
		ShowActive();
		}else{
		active = current;
		submenu = id;
		ShowActive();
		};
	}

function f2(event)
	{
	if (ie)
		{
		target = window.event.toElement;
		}else{
		if (event.relatedTarget != null) target = (event.relatedTarget.tagName ? event.relatedTarget : event.relatedTarget.parentNode);
		}
		if(!find(submenu, target)) HideActive();
	}
	
function GetAll(obj)
	{
	if (typeof(obj.childNodes) == "undefined") return false;
	if (typeof(obj.childNodes.length) == "undefined") return false;
	Temp[Temp.length] = 0;
	for (Temp[Temp.length-1]=0;Temp[Temp.length-1]<obj.childNodes.length;Temp[Temp.length-1]++) {
	if (typeof(obj.childNodes[Temp[Temp.length-1]]) != "undefined") 
		{
		AllTags[c] = obj.childNodes[Temp[Temp.length-1]];
		c++; 
		GetAll(obj.childNodes[Temp[Temp.length-1]]);
		}
	}
	Temp.length--;
	}

function find(id, target) {
	if(document.getElementById(id)==target) return true;
  AllTags = Array();
  Temp = Array();
  c = 0;
  GetAll(document.getElementById(id));
  for (i=0;i<AllTags.length;i++) 
	{
		if (AllTags[i]==target) return true;
	}
	return false;
}

function positionLeft(element) {
  var x;
  x = element.offsetLeft;
  if (element.offsetParent != null)
    x += positionLeft(element.offsetParent);
  return x;
}
function newwin(src, w, h, title)
{
	if(window.window.myWin) myWin.close();
	myWin = open("", "newWindow2"+Math.floor(Math.random()*500)+"", "width="+w+",height="+h+",status=no,toolbar=no,menubar=no");
	myWin.document.writeln("<html><title>"+title+"</title><body leftmargin=0 topmargin=0 rightmargin=0 bottommargin=0 marginwidth=0 marginheight=0><img src="+src+" width="+w+" height="+h+" border=0></body></html>");
}