/**
 * $Id$
 * $RCSfile$
 * $Revision$
 * $Author$
*/

function menu_inic() {

  m_a_mservices = dg('mnu_mservices');
  m_a_sales = dg('mnu_sales');
  m_a_helpdesk = dg('mnu_helpdesk');
  m_a_press = dg('mnu_press');
  m_a_company = dg('mnu_company');

   m_a_mservices.onclick = function() { return false; }
   m_a_sales.onclick = function() { return false; }
   m_a_helpdesk.onclick = function() { return false; }
   m_a_press.onclick = function() { return false; }
   m_a_company.onclick = function() { return false; }

   /*_b = document.getElementsByTagName('body');*/

   window.onresize = function() {  menu_inic(); }

	menupontok();
}
function addEvent(obj, evType, fn) {


  if (obj.attachEvent) {
		var r = obj.attachEvent('on'+evType, fn);
		return r;
	}	else if (obj.addEventListener) {
		obj.addEventListener(evType, fn, true);
		return true;
	}
	else
  {
		return false;
  }
}

function balpoz(obj) {
	var xpos = obj.offsetLeft;
	var temp_l = obj.offsetParent;
	while (temp_l != null) {
		xpos += temp_l.offsetLeft;
		temp_l = temp_l.offsetParent;
	}
	return xpos;
}


function menupontesemenyek(mp, obj) {
	if (!dg(mp))
		return;
	var navItems = dg(mp).getElementsByTagName('div');
	for (var i=0; i<navItems.length; i++) {
		if (navItems[i].className.indexOf('menuparent') > -1) {
			navItems[i].onmouseover = function() { this.cn = this.className; this.className += ' over'; }
			navItems[i].onmouseout = function() { this.className = this.cn; }
		}
	}
	var navItems = dg(mp).getElementsByTagName('a');
	for (var i=0; i<navItems.length; i++) {
		addEvent(navItems[i], 'mouseover', function() { obj.m_over(); });
		addEvent(navItems[i], 'mouseout', function() { obj.m_out(); });
	}
}

function menupont(str, mp) {
	this.id = str;
	this.mp = mp;
	this.obj = this.id + '_obj';
	eval(this.obj + ' = this;');
	this.timer = false;
	if (dg(this.id))
		dg(this.id).style.left = balpoz( dg('mnu_'+this.id) )+'px';

	this.m_over = menu_over;
	this.m_out = menu_out;
	this.megjelenit = menu_megjelenit;
	this.eltuntet = menu_eltuntet;
}

function menu_over() {
	if (this.timer) {
		clearTimeout(this.timer);
		this.timer = false;
	}
}

function menu_out() {
	if (!this.timer)
		this.timer = setTimeout(this.obj + '.eltuntet()', 500);
}

function menu_megjelenit(bal) {
	for (i=0; i<lmenuk.length; i++)
		if (this.id != lmenuk[i]) {
			dg(lmenuk[i]).style.display = 'none';
			//keprol('mnu_'+lmenuk[i]);
		}
	dg(this.id).style.display = 'inline';
}

function menu_eltuntet() {
	if (dg(this.id))
		dg(this.id).style.display = 'none';

}