var menuTableEvent = new Object();
menuTableEvent[0] = new Object();
menuTableEvent[1] = new Object();

function top_menu_over(obj,maxH,table)
{
try
{
	var elem = obj.childNodes.item(1);
	if (elem!=null)
	{
		if (menuTableEvent[table]['current']!='') menuTableEvent[table][menuTableEvent[table]['current']] = 'out';
		
		if (menuTableEvent[table][elem.id] != 'over')
		{
			menuTableEvent[table]['current'] = elem.id;
			menuTableEvent[table][elem.id] = 'over';

			var curH = Number(elem.style.height.replace('px',''));
			setTimeout('expandMenu(getById("'+elem.id+'"),'+maxH+','+curH+','+table+')',15);
			setTimeout('shrinkMenu(getById("'+elem.id+'"),'+curH+','+table+')',15);
		}
	}
}
catch (ex)
{
}
}
function top_menu_out(obj,table)
{	
try
{
	var elem = obj.childNodes.item(1);
	if (elem!=null) menuTableEvent[table][elem.id] = 'out';
}
catch (ex)
{
}
}

function expandMenu(obj,maxH,curHdouble,table)
{
	try
	{
		if (menuTableEvent[table][obj.id] == 'over')
		{
			obj.style.overflow = 'hidden';
			obj.style.display = 'block';
			curHdouble = curHdouble*1.5;
			var curH = Math.round(curHdouble);
			if (curH>=maxH)
			{
				obj.style.overflow = 'visible';
				obj.style.height = maxH+'px';
				return;
			}
			obj.style.height = curH+'px';
			setTimeout('expandMenu(getById("'+obj.id+'"),'+maxH+','+curHdouble+','+table+')',15);
		}
	}
	catch(ex)
	{
	}
}

function shrinkMenu(obj,curHdouble,table)
{
	try
	{
		if (menuTableEvent[table][obj.id] != 'over')
		{
				obj.style.overflow = 'hidden';
				curHdouble = curHdouble*0.5;
				var curH = Math.round(curHdouble);
				
				if (curH<1)
				{
					obj.style.overflow = 'visible';
					obj.style.display = 'none';
					obj.style.height = '1px';
					menuTableEvent[obj.id] = '';
					return;
				}
				
				obj.style.height = curH+'px';
			setTimeout('shrinkMenu(getById("'+obj.id+'"),'+curHdouble+','+table+')',25);
		}
		else
		{
			setTimeout('shrinkMenu(getById("'+obj.id+'"),'+Number(obj.style.height.replace('px',''))+','+table+')',25);
		}
	
	}
	catch (ex)
	{
	}
}


function getById(id)
{
	if (document.getElementById) return document.getElementById(id);
	else if (document.all) return document.all[id];
	return null;
}

function wo(plik, w, h)
{
	return wo(plik, w, h, "no", "no");
}

function wo(plik, w, h, scroll)
{
	return wo(plik, w, h, scroll, "no");
}

function wo(plik, w, h, scroll, resizable)
{
	// IceCube: po tunning`u
	var aw = 640;
	var ah = 450;
	if (window.screen)
	{
		aw = screen.availwidth;
		ah = screen.availheight;
		if (!(aw > 0))
		{
			aw = screen.width;
			ah = screen.height;
		}
	}
	var ustawienia =
	"left="+(aw-w)/2+","
	+"top="+(ah-h)/2+","
	+"screenX="+(aw-w)/2+","
	+"screenY="+(ah-h)/2+","
	+"width="+w+","
	+"height="+h+","
	+"toolbar=no,"
	+"location=no,"
	+"directories=no,"
	+"status=np,"
	+"menubar=no,"
	+"scrollbars="+scroll+","
	+"name="+plik+","
	+"resizable="+resizable;
	return window.open(plik,('o_' + Math.random (100)).replace ('.','_'),ustawienia);
}

function dict(code)
{
	if (code != '' && code != undefined)
	{
		wo('/dictionary.dhtml?code='+code, 260, 260, 'auto');
	}
}

function pokaz(link)
{
	wo(link,800,600,'auto','yes');
}
mailValidator = /^[a-zA-Z0-9._-]+\@([a-zA-Z0-9_-]+\.){1,}[\w]{1,4}$/;
