// Funktionen für Energieausweis

function openNewWindow(_page)
{
	infoWin = window.open(_page, "infoWindow", "dependent=yes, width=624, height=700, location=no, menubar=no, toolbar=no, scrollbars=yes");
	infoWin.focus();
}

function openToolWindow(_page)
{
	toolWin = window.open(_page, "toolWindow","dependent=yes, location=no, menubar=no, toolbar=no, scrollbars=yes, resizable=yes");
}

function highlight(_label)
{
	document.getElementById("label_" + _label).className = document.getElementById("label_" + _label).className + " highlighted";
	//document.getElementById("input_" + _label).className = document.getElementById("input_" + _label).className + " highlighted";
	document.getElementById("text_" + _label).className = document.getElementById("text_" + _label).className + " highlightText";
}

function lowLight(_label)
{
	_className = document.getElementById("label_" + _label).className.split(" ");
	document.getElementById("label_" + _label).className = _className[0];

	_className = document.getElementById("text_" + _label).className.split(" ");
	document.getElementById("text_" + _label).className = _className[0];
}

function stepBack(_form)
{
	theForm = document.getElementById(_form);
	if (theForm.id == "ahs_ea_02")
	{
		theForm.action = directions[0];
		theForm.submit();
	}
	if (theForm.id == "ahs_ea_03")
	{
		theForm.action = directions[2];
		theForm.submit();
	}
	if (theForm.id == "ahs_ea_04")
	{
		theForm.action = directions[0];
		theForm.submit();
	}
}

function showErrors(_form)
{
	h=0;
	while (errorStack[h])
	{
		i=0;
		while (errorHighlights[errorStack[h]][i])
		{
			highlight(errorHighlights[errorStack[h]][i]);
			i++;
		}
	h++;
	}
	

	if (errorStack.length < 2)
		{
		_message = messages[_form][errorStack[0]];
		}

	else if (_form == "ahs_ea_02")
		{
		errorStack = new Array("PD01");
		_message = messages[_form][errorStack[0]];
		}
	
	else if (_form == "ahs_ea_03")
		{
		errorStack = new Array("ZD01");
		_message = messages[_form][errorStack[0]];
		}

	else if (_form == "ahs_ea_04")
		{
		errorStack = new Array("KF01");
		_message = messages[_form][errorStack[0]];
		}

	document.getElementById('errorText').innerHTML = _message;
	document.getElementById('errorsegment').style.display='inline';
	document.getElementById('errorText02').innerHTML = _message;
	document.getElementById('errorsegment02').style.display='inline';
}