function link_nad(ktory)
{
  ktory.style.backgroundColor = '#354990';
  ktory.style.cursor = 'pointer';
}

function link_poza(ktory)
{
  ktory.style.backgroundColor = '';
  ktory.style.cursor = 'default';
}

function idz_do(adres)
{
  window.top.location.href = adres;
}

var href = 'mti:loa';
href = href.replace(/(.)(.)(.)(.)(.)(.)(.)/, '$1$7$3$5$2$6$4');

function dekoduj_pocztowe()
{
	var linki = document.getElementsByTagName('a');
	for (i = 0, ile = linki.length; i < ile; i++)
	{
		var opis = linki[i].firstChild;
		if (opis.nodeName == '#text' && opis.nodeValue.match(/!\ (.+?)\ #\ (.+?)/))
		{
			opis.nodeValue = opis.nodeValue.replace(/^! (.+?) # (.+?)$/, '$2@$1');
			opis.nodeValue = opis.nodeValue.replace(/\^/g, '.');
			linki[i].href = href + opis.nodeValue;
		}
	}
}

function elId(id)
{
	return document.getElementById(id);
}

function zadaj_pytanie()
{
	var jzk = location.pathname.match(/\/[a-z]{2}\//);
	jzk = jzk[0];
	var temat = document.title.replace(/([^/]+) \/ .+/, '$1');
	if (temat.length > 85)
		temat = temat.substr(0, 80) + '...';
	window.open('../pytanie.php?temat=' + temat + '&jzk=' + jzk.substr(1, 2), '', 'width=600,height=500');
}

function sprawdz_formularz_pytania()
{	
	elId('wyslij').value = '2';

	return true;
}

function hover_img(link, hover)
{
	var podrzedne = link.childNodes;
	for (i = 0; i < podrzedne.length; i++)
		if (podrzedne[i].nodeType == 1 && podrzedne[i].tagName == 'IMG')
			if (hover)
				podrzedne[i].className += ' hover';
			else
				podrzedne[i].className = podrzedne[i].className.substr(0, podrzedne[i].className.length - 5);
}

function ie_pasek()
{
	var pasek_menu = elId('pasek_menu');

	pasek_menu.style.position = 'absolute';
	
	var czasomierz = self.setInterval("ie_pasek_petla();", 500);
}

function ie_pasek_petla()
{
	var pasek_menu = elId('pasek_menu');

	pasek_menu.style.top = document.body.scrollTop + document.body.clientHeight - 24 + 'px';
}

