
function initMainMenu()
{
	if( menu = document.getElementById('bxContentMenu') )
	{
		var el = menu.getElementsByTagName('div');
		if( !el || el.length <= 0 ) return;

		for (var i = 0; i < el.length; i++)
		{
			el[i].onmouseover = function() {
				this.style.backgroundColor	= 'rgb(250,250,250)';
			}
			
			el[i].onmouseout = function() {
				this.style.backgroundColor	= '';
			}
			
			el[i].onclick = function() {
				if( lnk = this.getElementsByTagName('a') )
				{
					if( lnk[0].href != null )
					{
						window.location.href =  lnk[0].href;
						return false;
					}
				}
			}
		}
	}
}

function setOpacity( elm, op )
{
	if(elm)
	{
		elm.style.opacity = op;
		elm.style.filter = 'alpha(opacity=' + ( op * 100 ) + ')';
		elm.style.MozOpacity = op;
		elm.style.KhtmlOpacity = op;
	}
}

function initTopMenu()
{
	if( menu = document.getElementById('bxHeadMenu') )
	{
		var el = menu.getElementsByTagName('div');
		if( !el || el.length <= 0 ) return;

		for (var i = 0; i < el.length; i++)
		{
			setOpacity(el[i],.5);

			el[i].onmouseover = function() {
				setOpacity(this,1);
			}
			
			el[i].onmouseout = function() {
				setOpacity(this,.5);
			}
		}
	}
}

function initContent()
{
	if( menu = document.getElementById('bxHeadMenu') )
	{
		var el = menu.getElementsByTagName('div');
		if( !el || el.length <= 0 ) return;

		for (var i = 0; i < el.length; i++)
		{
			setOpacity(el[i],.5);

			el[i].onmouseover = function() {
				setOpacity(this,1);
			}
			
			el[i].onmouseout = function() {
				setOpacity(this,.5);
			}
		}
	}
}

function processContent()
{
	//var txt_search = /[^\/\/|^www\.]eezeefax/gi;
	var txt_search = /eezeefax/gi;
	var txt_replace = ' <span class="eezee">eezee<span class="fax">FAX</span></span>';
	var tags = new Array( 'p', 'li', 'small' );
	if( ( contentBox = document.getElementById('bxContent') ) != 'undefined' )
	{
		for( i in tags )
		{
			if( content = contentBox.getElementsByTagName(tags[i]) )
			{
				for( i = 0; i < content.length; i++ )
				{
					//content[i].innerHTML = content[i].innerHTML.replace(/<\/?[^>]+>/gi, "");
					var attr = content[i].getAttribute('id');

					if( ( attr == null ) || ( ( attr != null ) && ( attr != 'blocked' ) ) )
					{
						if( ( tmp = content[i].innerHTML.match( txt_search ) ) )
						{
							content[i].innerHTML = content[i].innerHTML.replace( txt_search, txt_replace );
						}
					}
				}
			}
		}
	}
}

function processWords(txt)
{
	var wLinks = new Object();
	wLinks["http://www.eezeefax.de"] = /[^\/\/|^www\.](eezeefax)/gi;
	wLinks["http://en.wikipedia.org/wiki/Wide_Area_Network"] = /[^\/\/|^www\.](\bWAN\b)/gi;
	
	for( word in wLinks )
	{
		if( txt.innerHTML.match(wLinks[word]) )
		{
			var replacement = " <a href=\"" + word + "\" target=\"_blank\">$1</a>";
			txt.innerHTML = txt.innerHTML.replace( wLinks[word], replacement );
		}
	}
}

/*
function processContentImages()
{
	if( ( contentBox = document.getElementById('bxContent') ) != 'undefined' )
	{
		if( images = contentBox.getElementsByTagName('img') )
		{
			for( i = 0; i < images.length; i++ )
			{
				images[i].style.backgroundColor = '#000000';
				setOpacity(images[i],.4);
				
				images[i].onmouseover = function() {
					setOpacity(this,1);
				}
				
				images[i].onmouseout = function() {
					setOpacity(this,.4);
				}
			}
		}
	}
}
*/

function initMenu()
{
	initMainMenu();
	initTopMenu();
	processContent();
//	processContentImages();

}

var pLoad = window.onload;
window.onload = function () { if(pLoad) pLoad (); initMenu(); }

