
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;
  }

  // Treat any other "Gecko" browser as Netscape 6.1.

  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 getPageOffsetLeft(el) {

  var x;

  // Return the x coordinate of an element relative to the page.

  x = el.offsetLeft;
  if (el.offsetParent != null)
    x += getPageOffsetLeft(el.offsetParent);

  return x;
}

function getPageOffsetTop(el) {

  var y;

  // Return the x coordinate of an element relative to the page.

  y = el.offsetTop;
  if (el.offsetParent != null)
    y += getPageOffsetTop(el.offsetParent);

  return y;
}

var actMenu = null;
var menu_timeout = 0;


function hide_submenu(obj)
{
	obj.style.display="none";
	actMenu = null;
}

function chk_submenu()
{
if(actMenu==null || menu_timeout==0) return;
menu_timeout++;
if(menu_timeout==3) {hide_submenu(actMenu); menu_timeout=0;return}
window.setTimeout("chk_submenu()", 1000);
}



function show_submenu(id, par)
{
 if(actMenu!=null) {hide_submenu(actMenu);}
menu_timeout = 0;
x = getPageOffsetLeft(par);
y = getPageOffsetTop(par)+par.offsetHeight-8;

var smenu = document.getElementById('sm'+id);
		
  // For IE, adjust position.

  if (browser.isIE) {
    x += smenu.offsetParent.clientLeft;
    y += smenu.offsetParent.clientTop;
  }

  smenu.style.left = x;
  smenu.style.top  = y;
smenu.style.display = "inline";
actMenu = smenu;
	
}

function sitem_over(id)
{
	document.getElementById('i'+id).src = "img/smenu_l_a.gif";
	document.getElementById('s'+id).className = "s_item_a";
}

function sitem_out(id)
{
	document.getElementById('i'+id).src = "img/smenu_l.gif";
	document.getElementById('s'+id).className = "s_item";
}

