var menu_roz = null;
var m_tm = null;
var menu_zaznaczone = null;

function Browser() {
 
  var ua, s, i;
 
  this.isIE    = false;  // Internet Explorer
  this.isOP    = false;  // Opera
  this.isNS    = false;  // Netscape
  this.version = null;
 
  ua = navigator.userAgent;
 
  s = "Opera";
  if ((i = ua.indexOf(s)) >= 0) {
    this.isOP = true;
    this.version = parseFloat(ua.substr(i + s.length));
    return;
  }
 
  s = "Netscape6/";
  if ((i = ua.indexOf(s)) >= 0) {
    this.isNS = true;
    this.version = parseFloat(ua.substr(i + s.length));
    return;
  }
 
  s = "Gecko";
  if ((i = ua.indexOf(s)) >= 0) {
    this.isNS = true;
    this.version = 6.1;
    return;
  }
 
  s = "MSIE";
  if ((i = ua.indexOf(s))) {
    this.isIE = true;
    this.version = parseFloat(ua.substr(i + s.length));
    return;
  }
}
var browser = new Browser();
//-----------
//
//

function hidem_delay()
{
if(m_tm !=null)
{
clearTimeout(m_tm);
}
m_tm = setTimeout("hide_m()",150);
}


function stopm()
{
if(m_tm!=null)
{
clearTimeout(m_tm);
}
}



function hide_m()
{
if( menu_roz != null )
{
 menu_roz.style.visibility = "hidden";
 menu_roz.style.left = 0;
 menu_roz.style.top = 0;

 //glowne.className='menu';
}
show_select()

if(menu_zaznaczone!=null && menu_zaznaczone.id!='menu_x')
{
  menu_zaznaczone.style.backgroundColor = '#ffffff';
  menu_zaznaczone.style.color = '#000080';
}


/*
if(menu_std!=null)
{
menu_std.style.backgroundColor = '#0F3074';
menu_std.style.color = '#ffffff';
}
*/

}

function give_pos(obj)
{
	var curleft = curtop = 0;
	if (obj.offsetParent) {
		curleft = obj.offsetLeft
		curtop = obj.offsetTop
		while (obj = obj.offsetParent) {
			curleft += obj.offsetLeft
			curtop += obj.offsetTop
		}
	}
	return [curleft,curtop];
}

function hide_select()
{
    var s = document.getElementsByTagName("select");
    var y=s.length;

	var x=0;
	var y = s.length;
	for (x=0;x<y;x++) 
	{
	s[x].style.visibility = "hidden";
	}
	return ;
}

function show_select()
{
    var s = document.getElementsByTagName("select");
    var y=s.length;
	//alert(y);
	var x=0;
	for (x=0;x<s.length;x++) 
	{
	s[x].style.visibility = "visible";
	}
	return ;
}

function show_m( b , event , a )
{
var button,x = 0,y = 0;

hide_m();
stopm();


if(browser.isIE)
{
button = window.event.srcElement;
}
else
{
button = event.currentTarget;
}


pos = give_pos(button);

(browser.isNS) ? y = pos[1] + button.offsetHeight : y = pos[1] + button.offsetHeight  ;
x = pos[0] ;

hide_select();

var m = document.getElementById(a)
m.style.left = x + "px";
m.style.top = y + "px";
m.style.visibility = "visible";
menu_roz = m;


 if(b.className=='menu_lnk' && b.id!='menu_x')
 {
 b.style.backgroundColor = '#d4e3ff';
 b.style.color = '#000000';
 }
menu_zaznaczone = b;
}

