function menuClick(e)
{
	var o = e.target ? e.target : e.srcElement;
	var oLi = o.parentNode;
	var oUl = oLi.getElementsByTagName("ul")[0];
	
	if ("closed" == oLi.className)
	{
		oLi.className = "open";
		oUl.className = oUl.className.replace(/\shidden/g, "");
	}
	else if ("open" == oLi.className)
	{
		oLi.className = "closed";
		oUl.className += " hidden";
	}
}

function initMenu2()
{
	if (document.getElementById("main_menu"))
	{
		var o = document.getElementById("main_menu");
		var cA = o.getElementsByTagName("a");
		var oA;
		
		for (var i = 0, ii = cA.length; i < ii; i++)
		{
			oA = cA[i];
			if (window.attachEvent)
			{
				oA.attachEvent("onclick", menuClick);
			}
			else
			{
				oA.addEventListener("click", menuClick, false);
			}
		}
	}
}

if (window.attachEvent)
{
	window.attachEvent("onload", initMenu2);
}
if (window.addEventListener)
{
	window.addEventListener("load", initMenu2, false);
}


function opensizedwin(link,w, h)  {
	popupWinex = window.open('http://www.digiterm.eu/' + link,'','scrollbars=auto, width=' + (w+20) + ', height=' + (h+20) + ', left=' + ((screen.width/2)-w/2) + ', top=' + ((screen.height/2)-h/2));
	popupWinex.document.title = 'Digiterm';
}

/*************************************************/
function show_lang()  { // alert('show_lang');
	clearTimeout(this.timer);
	this.timer=setTimeout('show_lang_div()','1');
}

function hide_lang()  { // alert('hide_lang');
	clearTimeout(this.timer);
	this.timer=setTimeout('hide_lang_div()','800');
}

function show_lang_div()  { // alert('show_lang');
	document.getElementById('lang_div').style.display = 'block';
}

function hide_lang_div()  { // alert('show_lang');
	document.getElementById('lang_div').style.display = 'none';
}

/*************************************************/

function color_over(id)  { // alert('show_lang');
	for (i= 2;i<=5;i++)
		if (i == id)
			document.getElementById('a_' + i).style.color = '#333333';
}


function color_out(id)  { // alert('show_lang');
	for (i= 2;i<=5;i++)
		if (i == id)
			document.getElementById('a_' + i).style.color = '#959595';
}


function color_over2()  { // alert('show_lang');
	document.getElementById('AktLangA').style.color = '#333333';
}


function color_out2()  { // alert('show_lang');
	document.getElementById('AktLangA').style.color = '#959595';
}

function checknumber(id){
	var x=document.getElementById(id).value
	var anum=/(^\d+$)|(^\d+\.\d+$)/

	if (anum.test(x)) {
		if ( x >= 1  && x <= 10 ) {
			testresult=true
		}
		else {
			document.getElementById(id).value = '';
			alert("Please input a valid number and between 1 and 10!");
			testresult=false;
		}
	}
	else {
		document.getElementById(id).value = '';
		alert("Please input a valid number and between 1 and 10!");
		testresult=false;
	}
	return (testresult)
}


