<!--
przesWysokosc  = -4;
CenterMenu = 1;
DivUpdate  = 15; 
MenuBorder = 100;
Minimum    = 50;
TimeCheck  = 250;
czasAktualiz = 15;

function initDHTML(obj)
{ 
	if (navigator.userAgent.match(/Mozilla\/5\../))
	{
		ustawObjOffsetTop(obj, undefined);
	}
}

function mojeOknoOffsetTop()
{
	if (window.innerHeight)
	{
		return window.pageYOffset;
	}
	else if (document.body)
	{
		return document.body.scrollTop;
	}
}

function pobierzElementClip (Clip, Element)
{
	Clip = Clip.substr(Clip.indexOf('(') + 1); 
	Clip = Clip.substr(0, Clip.length - 1);
	Clippers = Clip.split (" "); 
	for (i = 0; i < Clippers.length; i++)
	{ 
		if (Clippers[i] != 'auto') 
		{
			Clippers[i] = Clippers[i].replace (/D/g, "");
		}
	}
	TopClip = Number(Clippers[0]); 
	RightClip = Number(Clippers[1]); 
	BottomClip = Number(Clippers[2]);
	LeftClip = Number(Clippers[3]); 
	if (Element == 'Top')
	{
		return TopClip;
	}
	else if (Element == 'Right')
	{
		return RightClip;
	}
	else if (Element == 'Bottom')
	{
		return BottomClip;
	}
	else if (Element == 'Left')
	{
		return LeftClip;
	}
	else
	{
		return undefined;
	}
}

function pobierzObiekt (nazwa)
{
	if (document.all)
	{
		return document.all[nazwa];
	}
	else if ((document.documentElement) || (window.opera))
	{
		return document.getElementById (nazwa);
	}
	else if (document.layers)
	{
		return document.layers[nazwa];
	}
}

function pobierzObiektOffsetTop(obj)
{
	initDHTML(obj);
	if (obj.offsetTop)
	{
		return obj.offsetTop;
	}
	else if (document.layers)
	{
		return obj.top;
	}
	else if (obj.style)
	{
		return obj.style.top;
	}
}

function pobierzObjOffsetLeft(obj)
{
//alert(obj.style.left);
	if (obj.offsetLeft)
	{
		return obj.offsetLeft;
	}
	else if (obj.pageX)
	{
		return obj.pageX;
	}
}

function pobierzWysOkna()
{
	if (window.innerHeight)
	{
		return window.innerHeight;
	}
	else if (document.body)
	{
		return document.body.clientHeight;
	}
}

function pobierzWysObiektu(obj)
{
	initDHTML(obj);
	if ((document.all || document.documentElement) && (!window.opera))
	{
		Clip = obj.style.clip;
		if (! Clip)
		{
			return obj.offsetHeight;
		}
		else
		{
			return pobierzElementClip (Clip, 'Bottom');
		}
	}
	else if (document.layers)
	{
		return obj.clip.height;
	}
	else if (window.opera)
	{
		return 200;
	}
}

function ustawObjOffsetTop(obj, Offset)
{
	if (obj.style)
	{
		obj.style.top = Offset;
	}
	else if (obj.top)
	{
		obj.top = Offset;
	}
}

function ustawObjOffsetLeft(obj, Offset)
{
	if (obj.style)
	{
		obj.style.left = Offset;
	}
	else if (obj.left)
	{
		obj.left = Offset;
	}
}

function przewinMenu()
{
	Menu = pobierzObiekt('menuGlowne');
//	pozycja = 20 + (MM_strSzer - 777) / 2;
//	if (pozycja < 25) pozycja = 25;
	pozycja = 686;
	ustawObjOffsetLeft(Menu, pozycja);

	WinTop = mojeOknoOffsetTop();
	WinHeight = pobierzWysOkna() + przesWysokosc;
	MenuTop = pobierzObiektOffsetTop(Menu);
	MenuHeight = pobierzWysObiektu (Menu);
	MenuNew = (CenterMenu) ? Math.round (WinTop + (WinHeight - MenuHeight) / 4) : WinTop + MenuBorder;
	if (MenuNew < Minimum)
	{
		MenuNew = Minimum;
	}
	if (MenuTop != MenuNew)
	{
		if ((MenuTop + MenuHeight) < WinTop || MenuTop > (WinTop + WinHeight))
		{
			ustawObjOffsetTop (Menu, (MenuTop < MenuNew) ? (WinTop - MenuHeight) : (WinTop + WinHeight));
		}
		else
		{
			roznica = (MenuTop < MenuNew) ? 6 : 5;
			ustawObjOffsetTop (Menu, MenuTop + Math.round((MenuNew - MenuTop) / DivUpdate) + roznica);
		}
	}
	window.setTimeout('przewinMenu()', (pobierzObiektOffsetTop(Menu) == MenuNew) ? TimeCheck : czasAktualiz); 
}

function getWinParams()
{
	if (document.all)
	{
		MM_strSzer = document.body.clientWidth;
		MM_strWys = document.body.clientHeight;
	}
	else
	{
		MM_strSzer = window.innerWidth;
		MM_strWys = window.innerHeight;
	}
}

/* Dodatek */

function brak(val)
{
	return typeof(val) == 'undefined';
}

if (brak(window.MyTimers)) window.MyTimers = [];

function pokaz(name, val, przesun)
{
	val = ((val == 1) ? 'visible' : 'hidden');

	var obj = pobierzObiekt(name);
	ustawObjOffsetTop(obj, pobierzObiektOffsetTop(pobierzObiekt('menuGlowne')) + przesun);

	if (val == 'hidden')
	{
		ukryj(name);
	}
	else
	{
		if (window.MyOldTimers && window.MyOldTimers != null)
		{
			upokaz(window.MyOldTimers);
		}

		if (obj.style)
		{
			freeTimeout(name);
			obj.style.visibility = val; // IE, Opera, Mozilla
		}
		else if (obj.visibility)
		{
			freeTimeout(name);
			obj.visibility = val; // NS
		}
	}
}

function ukryj(name)
{
	window.MyTimers[name] = setTimeout("upokaz('" + name + "')", 500);
	window.MyOldTimers = name;
	return true;
}

function upokaz(name)
{
	var obj = pobierzObiekt(name);

	if (obj.style)
	{
		obj.style.visibility = 'hidden'; // IE, Opera, Mozilla
	}
	else if (obj.visibility)
	{
		obj.visibility = 'hidden'; // NS
	}
	return true;
}

function freeTimeout(name)
{
	if (window.MyTimers[name] != null)
	{
		window.clearTimeout(window.MyTimers[name]);
		window.MyTimers[name] = null;
		window.MyOldTimers = null;
	}
	return true;
}

function robDiv(name, content)
{
	return (document.layers && !document.getElementById) ?
			'<div id="' + name + '"><layer width="100%" onmouseover="freeTimeout(\'' + name + '\');" onmouseout="ukryj(\'' + name + '\');">' + content + '</layer></div>' :
			'<div id="' + name + '" onmouseover="freeTimeout(this.id);" onmouseout="ukryj(this.id);">' + content + '</div>';
}

function GenerujMenu()
{
	var text = "";
	for (i = 0; i < arrUslugi.length; i++)
	{
		text += '<tr><td><a href="' + arrUslugi[i][1] + '" class="link">' + arrUslugi[i][0] + '</a></td></tr>';
	}
	text = '<table cellspacing="3" cellpadding="0" border="0" width="100%">' + text + '</table>';
	text = ZrobRamke(ZrobRamke(ZrobRamke(text, '991a1a', 1), 'ffffff', 1), '000000', 1);
	document.write(robDiv('menuUslugi','<table cellpadding="0" cellspacing="0" border="0" bgcolor="#ffffff" width="90"><tr><td>' + text + '</td></tr></table>'));

	text = "";
	for (i = 0; i < arrPortfolio.length; i++)
	{
		text += '<tr><td><a href="' + arrPortfolio[i][1] + '" class="link">' + arrPortfolio[i][0] + '</a></td></tr>';
	}
	text = '<table cellspacing="3" cellpadding="0" border="0" width="100%">' + text + '</table>';
	text = ZrobRamke(ZrobRamke(ZrobRamke(text, '991a1a', 1), 'ffffff', 1), '000000', 1);
	document.write(robDiv('menuPortfolio','<table cellpadding="0" cellspacing="0" border="0" bgcolor="#ffffff" width="90"><tr><td>' + text + '</td></tr></table>'));
}

function ZrobRamke(val, kolor, grubosc)
{
	return '<table cellpadding="0" cellspacing="' + grubosc + '" border="0" bgcolor="#' + kolor + '" width="100%"><tr><td>' + val + '</td></tr></table>';
}
//-->