/* Header */
function showMenu(menuItem)
{
	window.status=menuItem.text;
	parentCord=getObjXY(menuItem.parentNode);
	menuObj=document.getElementById(menuItem.parentNode.id+'01').parentNode.parentNode;
	menuObj.style.display='block';
	menuObj.style.left=(parentCord[0]-2)+'px';
	menuObj.style.top=(parentCord[1]+menuItem.parentNode.offsetHeight)+'px';
	return true;
}

function hideMenu(menuItem)
{
	var menuObj=document.getElementById(menuItem.parentNode.id+'01').parentNode.parentNode;

	if (isIE==true && menuObj.contains(event.toElement))
	{
		return;
	}

	window.status='';
	menuObj.style.display='none';
	return true;
}

function searchCheckHeader(thisForm)
{
	if (thisForm.searchExpression.value=="")
	{
		thisForm.searchExpression.focus();
		alert('Kérem adja meg a keresendő kifejezést!');
		return false;
	}
	if (thisForm.searchExpression.value.length<3)
	{
		thisForm.searchExpression.focus();
		alert('Túl rövid a keresendő kifejezés!');
		return false;
	}
	thisForm.submit();
}


/* Login */
function checkLogin(thisForm)
{
	if (thisForm.loginUserName.value=='')
	{
		thisForm.loginUserName.focus();
		alert('Kérem adja meg a felhasználónevét a belépéshez!');
		return false;
	}

	if (thisForm.loginUserPassword.value=='')
	{
		thisForm.loginUserPassword.focus();
		alert('Kérem adja meg a jelszavát a belépéshez!');
		return false;
	}

	thisForm.submit();
}


/* Article Presenter */
function markGlossary(node)
{
	if (node == null)
	{
		return;
	}

	if (node.hasChildNodes)
	{
		var hi_cn;
		for (hi_cn=0;hi_cn<node.childNodes.length;hi_cn++)
		{
			markGlossary(node.childNodes[hi_cn]);
		}
	}

	if (node.nodeType == 3 && node.parentNode.tagName.toLowerCase()!='script')
	{
		var i;
		var word;
		var tempNodeValFull=node.nodeValue.toLowerCase();

		for (i=0;i<glossaryLength;i++)
		{
			tempNodeVal=tempNodeValFull;
			word=glossary[i][0];
			if (tempNodeVal.indexOf(word) != -1)
			{
				pn = node.parentNode;
				start=0;
				if (pn.className != "GlossaryWord")
				{
					nv = node.nodeValue;
					ni = tempNodeVal.indexOf(word,start);

					do
					{
						nextChar = nv.substr(ni+word.length,1);
						if (nextChar==' ' || nextChar=='<' || nextChar==',')
						{
							before = document.createTextNode(nv.substr(0,ni));
							docWordVal = nv.substr(ni,word.length);
							after = document.createTextNode(nv.substr(ni+word.length));

							hiwordtext = document.createTextNode(docWordVal);

							hiword = document.createElement("span");
							hiword.className = "GlossaryWord";
							eval("hiword.onmouseover=function () { Tip('<div class=\"GlossaryInfo\"><p><b>"+glossary[i][0]+"<\/b><\/p><p>"+glossary[i][1]+"<\/p><\/div>'); };");
							hiword.appendChild(hiwordtext);
							pn.insertBefore(before,node);
							pn.insertBefore(hiword,node);
							pn.insertBefore(after,node);
							pn.removeChild(node);

							markGlossary(pn);
							return;
						}

						start=ni+word.length;
						ni = tempNodeVal.indexOf(word,start);
					} while (ni != -1)
				}
			}
		}
	}
}


/* Show Poker Rooms List */
function markPokerRooms(node)
{
	if (node.hasChildNodes)
	{
		var hi_cn;
		for (hi_cn=0;hi_cn<node.childNodes.length;hi_cn++)
		{
			markPokerRooms(node.childNodes[hi_cn]);
		}
	}

	if (node.nodeType == 3 && node.parentNode.tagName.toLowerCase()!='script')
	{
		var i;
		var word;
		var tempNodeValFull=node.nodeValue.toLowerCase();

		for (i=0;i<pokerRoomsLength;i++)
		{
			tempNodeVal=tempNodeValFull;
			word=pokerRooms[i][0];
			if (tempNodeVal.indexOf(word) != -1)
			{
				pn = node.parentNode;
				start=0;
				if (pn.className != "GlossaryWord")
				{
					nv = node.nodeValue;
					ni = tempNodeVal.indexOf(word,start);

					do
					{
						nextChar = nv.substr(ni+word.length,1);
						if (nextChar==' ' || nextChar=='<' || nextChar==',')
						{
							before = document.createTextNode(nv.substr(0,ni));
							docWordVal = nv.substr(ni,word.length);
							after = document.createTextNode(nv.substr(ni+word.length));

							hiwordtext = document.createTextNode(docWordVal);

							hiword = document.createElement("span");
							hiword.className = "PokerRoomSite";
							eval("hiword.onclick=function () { document.location='"+pokerRooms[i][1]+"'; };");
							hiword.appendChild(hiwordtext);
							pn.insertBefore(before,node);
							pn.insertBefore(hiword,node);
							pn.insertBefore(after,node);
							pn.removeChild(node);

							markPokerRooms(pn);
							return;
						}

						start=ni+word.length;
						ni = tempNodeVal.indexOf(word,start);
					} while (ni != -1)
				}
			}
		}
	}
}

