/* JavaScript generated with CSS-Menu-Generator by Andy Tandler */

function lmInitMenu()
{
	if ( browser.isDOM1
	&& !( browser.isMac && browser.isIE )
	&& !( browser.Opera && browser.versionMajor < 7 )
	&& !( browser.isIE && browser.versionMajor < 5 ) )
	{
		// get some element
		var menu = document.getElementById('language-menu');
		if (menu == null) return;
    var lis = menu.getElementsByTagName('li');

		// change the style of the menu
		menu.className="language-menu";

		// i am searching for ul element in li element
		for ( var i=0; i<lis.length; i++ )
		{
			// is there a ul element ?
			if ( lis.item(i).getElementsByTagName('ul')[0] )
			{
				// improve keyboard navigation with IE
				if ( browser.isIE )
				{
					lmAddAnEvent(lis.item(i),'keyup',lmVisible);
				}

				// apply the method to DOM compliant browsers
				lmAddAnEvent(lis.item(i),'mouseover',lmVisible);
				lmAddAnEvent(lis.item(i),'mouseout',lmHidden);
				lmAddAnEvent(lis.item(i),'blur',lmHidden);
				lmAddAnEvent(lis.item(i),'focus',lmVisible);
			}
		}
	}
}

function lmAddAnEvent( target, eventName, functionName )
{
	// apply the method to IE
	if ( browser.isIE )
	{
		//target.attachEvent( 'on'+eventName, functionName ); // dont work properly with this
		eval('target.on'+eventName+'=functionName');
	}
	// apply the method to DOM compliant browsers
	else
	{
		target.addEventListener( eventName , functionName , true ); // true is important for Opera7
	}
}

/* hide the first ul element of the current element */
function lmHidden()
{
	/* setAttribute dont work correctly with IE */
	this.getElementsByTagName('ul')[0].style.visibility = "hidden";
}

/* show the first ul element of the current element */
function lmVisible()
{
	this.getElementsByTagName('ul')[0].style.visibility = "visible";
}

/* used to improve keyboard navigation with IE */
function lmHiddenUl( ul )
{
	if ( browser.isIE )
	{
		var uls = ul.getElementsByTagName('ul');
		for ( var i=0; i<uls.length; i++ )
		{
			uls.item(i).style.visibility = "hidden";
		}
		ul.style.visibility = "hidden";
	}
}

// not very clean but simple
// the function can be run in the HTML for faster display
window.onload=lmInitMenu;

function lmHideload () {
if (document.getElementById('language-menu-navi'))
{
 	var div_obj = document.getElementById('language-menu-navi') ;
	div_obj.style.display = "block" ;
}
return true;
}

