/*

	JavaScript Functions For txtForum 0.7.0 by Lauri Kasvandik 
	(menu bgcolor swaping js-code ripped from damn.to website)

*/
var bNetscape4     = false;
var bNetscape6     = false;
var bExplorer4plus = false;
var bOpera5        = false;
var bOpera6        = false;

if ( (navigator.userAgent.indexOf("Opera 5") > -1) || (navigator.userAgent.indexOf("Opera/5") > -1) )
	bOpera5 = true;
else if ( navigator.userAgent.indexOf("Opera 6") > -1 )
	bOpera6 = true;
else if ( navigator.appName == "Microsoft Internet Explorer" && navigator.appVersion.substring(0,1) >= "4" )
	bExplorer4plus = true;
else if ( navigator.appName == "Netscape" && navigator.appVersion.substring(0,1) == "4" )
	bNetscape4 = true;
else if ( navigator.appName == "Netscape" && navigator.appVersion.substring(0,1) >= "5" )
	bNetscape6 = true;

function add2post(str)
{
	document.posting.posting_content.value += str;
}

function change_forum()
{	
	fid = document.hopform.forums_list.value;
	//document.write (document.location.pathname)
	if (fid != -1)
	{
		url='forum.php?action=topics&fid=' + fid;
		parent.location.href = url;
	}
}

function onMenuMouseOver( evn, bOn )
{
	if ( !bExplorer4plus && !bNetscape6 && !bOpera6 )
		return;
		
	var bkColor = bOn ? "#ddba83" : "#e5cea6";
	var element = bExplorer4plus ? event.srcElement : evn.target;
	
	if ( element.tagName == "TR" || element.tagName == "TABLE" )
		return;

	while ( element.tagName != "TD" && element.tagName != "HTML" )
		element = bExplorer4plus ? element.parentElement : element.parentNode;

	if ( element.tagName == "HTML" )
		return;
	
	if ( !bOn )
	{
		if ( bExplorer4plus && element.contains(event.toElement) )
			return;
		else if ( bNetscape6 || bOpera6 )
		{
			var contained = evn.relatedTarget;
			while( contained.parentNode )
			{
				if ( (contained = contained.parentNode) == element )
					return;
			}
		}
	}

	if ( element.style.backgroundColor != bkColor )
		element.style.backgroundColor = bkColor;
}
