// ##############################################################################
// #                                                   
// # Nützliche Funktionen
// #                           
// ##############################################################################


// GetXMLHttp - XMLHttpRequest Objekt erzeugen
if(typeof GetXMLHttp == 'undefined') {
	GetXMLHttp = function ()
	{
	    var xmlhttp=false;
	    
	    try 
	    {
	        xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
	    } 
	    catch (e) 
	    {
	        try 
	        {
	            xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
	        }
	        catch (e)
	        {
	            xmlhttp = false;
	        }
	    }
	
	    // Mozilla then?
	    if (!xmlhttp && typeof XMLHttpRequest != 'undefined') {
	       xmlhttp = new XMLHttpRequest();
	    }
	    
	    return xmlhttp;
	}
}



var g_bHttpRequest = true;

function ZAU_Submit(eventId, evPar, evPar1, evPar2, evPar3)
{
	if (evPar) 
		createNewHiddenFormField('EKSUBMITEVENTPAR', evPar);
	if (evPar1)
		createNewHiddenFormField('EKSUBMITEVENTPAR1', evPar1);
	if (evPar2)
		createNewHiddenFormField('EKSUBMITEVENTPAR2', evPar2);
	if (evPar3)
		createNewHiddenFormField('EKSUBMITEVENTPAR3', evPar3);
		
	ekSubmit (eventId, "isyiframe");
}


function ZAU_SubmitSync(eventId, evPar, evPar1, evPar2, evPar3)
{
	if (g_bHttpRequest)
		HttpReqSync(eventId, evPar, evPar1, evPar2, evPar3);
	else
		ZAU_Submit(eventId, evPar, evPar1, evPar2, evPar3);
}


function ZAU_SubmitASync(eventId, evPar, evPar1, evPar2, evPar3)
{
	if (g_bHttpRequest)
		HttpReqASync(eventId, evPar, evPar1, evPar2, evPar3);
	else
		ZAU_Submit(eventId, evPar, evPar1, evPar2, evPar3);
}


function ZAU_StringCrypt(sIn, bEncrypt) {
	try 
	{
		var oRequest = GetXMLHttp();
		var sCmd = bEncrypt ? "StringEncrypt" : "StringDecrypt";
		var sUrl = document.forms[0].action + "?xmlhttpreq=" + sCmd;
		var sPost = "in=" + encodeURIComponent(sIn);
			
		oRequest.open("post", sUrl, false);
		oRequest.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
		oRequest.send(sPost);

		if(oRequest.status == 200) {
			//alert(oRequest.responseText);
			return oRequest.responseText;
		}
	}
	catch(e) {
		//alert(e);
	}
	return "";
}


// Cookie - Hilfsfunktionen
function ZAU_CreateCookie(name,value,days) {
	if (days) {
		var date = new Date();
	    date.setTime(date.getTime()+(days*24*60*60*1000));
		var expires = "; expires="+date.toGMTString();
	}
	else var expires = "";
	document.cookie = name+"="+value+expires+"; path=/";
}

function ZAU_ReadCookie(name) {
	var nameEQ = name + "=";
	var ca = document.cookie.split(';');
	for(var i=0;i < ca.length;i++) {
		var c = ca[i];
		while (c.charAt(0)==' ') c = c.substring(1,c.length);
		if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length);
	}
	return null;
}

function ZAU_EraseCookie(name) {
	ZAU_CreateCookie(name,"",-1);
}



function ZAU_UtilsHasLoginCookie()
{
	var za_uid = ZAU_ReadCookie("za_uid");
	return (za_uid != null);
}

function ZAU_UtilsGetUIDFromLoginCookie()
{
	var za_uid = ZAU_ReadCookie("za_uid") || "";
	return ZAU_StringCrypt(za_uid, false);
}

function ZAU_UtilsGetPWDFromLoginCookie()
{
	var za_pw = ZAU_ReadCookie("za_pw") || "";
	return ZAU_StringCrypt(za_pw, false);
}

function ZAU_UtilsSetLoginCookie(strUserId, strPasswd)
{
	var cryptUserId = ZAU_StringCrypt(strUserId, true);
	var cryptPasswd = ZAU_StringCrypt(strPasswd, true);
	
	ZAU_CreateCookie("za_uid", cryptUserId, 180);
	ZAU_CreateCookie("za_pw", cryptPasswd, 180);
}

function ZAU_UtilsDeleteLoginCookie()
{
	ZAU_EraseCookie("za_uid");
	ZAU_EraseCookie("za_pw");
}





var ZAU_UtilsSaveAsSuffix = "";
var ZAU_UtilsSaveAsUnitCalcHidden = false;

function ZAU_UtilsSaveAsShow (strSuffix)
{
	// Falls schon offen, wieder zumachen
	if (parent.document.getElementById ('IDC_SAVE_AS_GB').style.visibility == "visible" && strSuffix == ZAU_UtilsSaveAsSuffix)
	{
		ZAU_UtilsSaveAsHide ();
		return (false);
	}
	
	// Suffix ablegen
	ZAU_UtilsSaveAsSuffix = strSuffix;

	// Einheitenumrechner zumachen, falls vorhanden und offen
	var oUnitCalc = parent.document.getElementById('UNIT_CALC');
	if (oUnitCalc && oUnitCalc.style.visibility == 'visible')
	{
		oUnitCalc.style.visibility = 'hidden';
		ZAU_UtilsSaveAsUnitCalcHidden = true;
	}
	else
	{
		ZAU_UtilsSaveAsUnitCalcHidden = false;
	}

	// Elemente sichtbar machen
	parent.document.getElementById ('IDC_SAVE_AS_GB').style.visibility = "visible";
	parent.document.getElementById ('IDC_SAVE_AS_GO').style.visibility = "visible";
	parent.document.getElementById ('IDC_SAVE_AS_EDIT').style.visibility = "visible";
	parent.document.getElementById ('IDC_SAVE_AS_IMG').style.visibility = "visible";
	parent.document.getElementById ('IDC_SAVE_AS_LABEL').style.visibility = "visible";
	parent.document.getElementById ('IDC_SAVE_AS_TITLE').style.visibility = "visible";

	parent.document.getElementById ('IDC_SAVE_AS_GB').style.zIndex = 1000001;
	parent.document.getElementById ('IDC_SAVE_AS_GO').style.zIndex = 1000002;
	parent.document.getElementById ('IDC_SAVE_AS_EDIT').style.zIndex = 1000002;
	parent.document.getElementById ('IDC_SAVE_AS_IMG').style.zIndex = 1000002;
	parent.document.getElementById ('IDC_SAVE_AS_LABEL').up('table').style.zIndex = 1000002;
	parent.document.getElementById ('IDC_SAVE_AS_TITLE').up('table').style.zIndex = 1000002;

	// Eingabefeld fokusieren
	parent.document.getElementById ('IDC_SAVE_AS_EDIT').focus();
}

function ZAU_UtilsSaveAsHide ()
{
	// Elemnte unsichbar machen
	parent.document.getElementById ('IDC_SAVE_AS_GO').style.visibility = "hidden";
	parent.document.getElementById ('IDC_SAVE_AS_EDIT').style.visibility = "hidden";
	parent.document.getElementById ('IDC_SAVE_AS_IMG').style.visibility = "hidden";
	parent.document.getElementById ('IDC_SAVE_AS_LABEL').style.visibility = "hidden";
	parent.document.getElementById ('IDC_SAVE_AS_TITLE').style.visibility = "hidden";
	parent.document.getElementById ('IDC_SAVE_AS_GB').style.visibility = "hidden";

	// Einheitenumrechner wieder machen, falls vorhanden, hier geschlossen und immer noch geschlossen
	var oUnitCalc = parent.document.getElementById('UNIT_CALC');
	if (ZAU_UtilsSaveAsUnitCalcHidden && oUnitCalc && oUnitCalc.style.visibility == 'hidden')
	{
		oUnitCalc.style.visibility = 'visible';
		ZAU_UtilsSaveAsUnitCalcHidden = false;
	}
}

function ZAU_UtilsSaveAsSave ()
{
	// Projektname ermitteln
	var strProject = parent.document.getElementById ('IDC_SAVE_AS_EDIT').value;

	if (strProject != "")
	{
		strSuffix = parent.ZAU_UtilsSaveAsSuffix;
		strValue = strProject + strSuffix;

		createNewHiddenFormField('EKSUBMITEVENTPAR', strValue);
		createNewHiddenFormField('EKSUBMITEVENTPAR1', strSuffix);
	
		// Bei Lastprodfil speichern geänderte Werte einsammeln
		if (strSuffix == ".lcl")
		{
			var strGUIValues = ZA_UtilsLPGetValueString ();
			createNewHiddenFormField('EKSUBMITEVENTPAR2', strGUIValues);
		}

		// Eingabefeld löschen, Eingabefelder verstecken
		parent.document.getElementById ('IDC_SAVE_AS_EDIT').value = "";
		parent.ZAU_UtilsSaveAsHide ()
	
		ekSubmit ("IDC_SAVE_FILE_AS", "isyiframe");
		
	}
	else
	{
		// Projektname leer, Eingabefeld erneut fokusieren
		parent.document.getElementById ('IDC_SAVE_AS_EDIT').focus();
	}
}


function ZAU_CheckAusgabeForm ()
{
	bOK = true;
	
	for (i = 0; i < 33; ++i)
	{
		strID = "IDC_OUT_FORM_" + i;
		var aObj = document.getElementById (strID);
		if (aObj)
		{
			if (aObj.ektype == "Edit")
			{
				strLabelID = "IDC_OUT_FORM_" + (i-1);
				aLabel = document.getElementById (strLabelID);
				strLabel = aLabel.innerHTML;
				strValue = aObj.value
				
				if (strLabel.indexOf("*") > 0 && strValue == "")
				{
					bOK = false;
					aObj.focus();
					break;
				}
			}
		}
	}
	
	if (bOK)
	{
		strValues = ZAU_GetAusgabeFormValues ();
		
		createNewHiddenFormField('EKSUBMITEVENTPAR', strValues);
		createNewHiddenFormField('EKSUBMITEVENTPAR1', location.host);
		ekSubmit('IDC_OUT_MAIL_ANFRAGE', "isyiframe");
	}
}


function ZAU_GetAusgabeFormValues ()
{
	var strValues = "";
	
	strValues += "IDC_F_INDEX=" + document.getElementById ("IDC_OUT_FORM_2").value + ";";
	strValues += "IDC_F_ANREDE=" + document.getElementById ("IDC_OUT_FORM_5").value + ";";
	strValues += "IDC_F_TEXT_ANREDE=" + dialog["IDC_OUT_FORM_5"].getSelectedText() + ";";
	strValues += "IDC_F_VORNAME=" + document.getElementById ("IDC_OUT_FORM_7").value + ";";
	strValues += "IDC_F_NAME=" + document.getElementById ("IDC_OUT_FORM_9").value + ";";
	strValues += "IDC_F_FUNKTION=" + document.getElementById ("IDC_OUT_FORM_11").value + ";";
	strValues += "IDC_F_FIRMA=" + document.getElementById ("IDC_OUT_FORM_13").value + ";";
	strValues += "IDC_F_STRASSE=" + document.getElementById ("IDC_OUT_FORM_15").value + ";";
	strValues += "IDC_F_PLZ=" + document.getElementById ("IDC_OUT_FORM_17").value + ";";
	strValues += "IDC_F_STADT=" + document.getElementById ("IDC_OUT_FORM_19").value + ";";
	strValues += "IDC_F_TELEFON=" + document.getElementById ("IDC_OUT_FORM_21").value + ";";
	strValues += "IDC_F_MOBIL=" + document.getElementById ("IDC_OUT_FORM_23").value + ";";
	strValues += "IDC_F_EMAIL=" + document.getElementById ("IDC_OUT_FORM_25").value + ";";
	strValues += "IDC_F_MITTEILUNG=" + document.getElementById ("IDC_OUT_FORM_27").value + ";";

	return (strValues);	
}


function ZAU_ShowAusgabeForm ()
{
	for (i = 0; i < 32; ++i)
	{
		strID = "IDC_OUT_FORM_" + i;
		var aObj = document.getElementById (strID);
		if (aObj)
			aObj.style.visibility = "visible";
		else
			alert ("Obj nicht gefunden : " + strID);		
	}
}

function ZAU_HideAusgabeForm ()
{
	for (i = 0; i < 33; ++i)
	{
		strID = "IDC_OUT_FORM_" + i;
		var aObj = document.getElementById (strID);
		if (aObj)
			aObj.style.visibility = "hidden";		
		else
			alert ("Obj nicht gefunden : " + strID);		
	}
}

function ZAU_AusgabeFormComboEvent (aCB)
{
	strValue = aCB.value;

	createNewHiddenFormField('EKSUBMITEVENTPAR', strValue);
	ekSubmit('IDC_OUT_MAIL_ANFRAGE_CB_CHANGED', "isyiframe");
}

function ZAU_HiliteVorauswahlButtons (strId)
{
 	strBGColNormal = "RGB(220,228,237)";
  	strTXColNormal = "RGB(0,75,138)";

	strBGColHilite = "RGB(0,75,138)";
	strTXColHilite = "RGB(220,228,237)";

	document.getElementById ('IDC_WAB').style.backgroundColor = strBGColNormal;
	document.getElementById ('IDC_WAB').style.color = strTXColNormal;

	document.getElementById ('IDC_BAUREIHE').style.backgroundColor = strBGColNormal;
	document.getElementById ('IDC_BAUREIHE').style.color = strTXColNormal;

	document.getElementById ('IDC_BAUFORM').style.backgroundColor = strBGColNormal;
	document.getElementById ('IDC_BAUFORM').style.color = strTXColNormal;

	document.getElementById ('IDC_ZA02_IMG').style.visibility = "hidden"
	
	if (strId != "")
	{
		document.getElementById (strId).style.backgroundColor = strBGColHilite;
		document.getElementById (strId).style.color = strTXColHilite;

		document.getElementById ('IDC_ZA02_IMG').style.visibility = "visible";
		document.getElementById ('IDC_ZA02_IMG').style.zIndex = 10000;
		
		document.getElementById ('IDC_ZA02_IMG').setAttribute('userdata', strId);
	}
}

function ZAU_CloseVAFrame (aObject)
{
	strId = aObject.getAttribute('userdata');
	
	if (strId == "IDC_WAB")
	{
		ZA_UtilsToggleWAB ();
	}
	else if (strId == "IDC_BAUFORM")
	{
		ZA_UtilsToggleBauform ();
	}
	else if (strId == "IDC_BAUREIHE")
	{
		ZA_UtilsToggleBaureihe ();
	}
}



function ZAU_InitZA00 ()
{
	aFlag = document.getElementById ('LOGIN_ERROR_MSG');

	if (aFlag.value != "")
	{
		alert (aFlag.value);
	}

	aFlag = document.getElementById ('LOGIN_VISIBILITY');
	if (aFlag.value != "visible")
	{
		ZA_UtilsShowOrHideLogin ("show")
		var aUserEdit = document.getElementById ('IDC_EDIT_USERID');
		aUserEdit.focus();

	}
	else
	{
		ZA_UtilsShowOrHideLogin ("hide")
	}
	
	if (ZAU_UtilsHasLoginCookie())
	{
		document.getElementById('IDC_EDIT_USERID').value = ZAU_UtilsGetUIDFromLoginCookie();
		document.getElementById("IDC_EDIT_PASSWD").value = ZAU_UtilsGetPWDFromLoginCookie();
	}

	// Kennlinien Viewer Init
	var oCV = document.getElementById("CHART_VIEWER");
	if (oCV.value != "")
	{
		if (aFlag.value != "visible") {
			try {
				var oViewer = eval('(' + oCV.value + ')');
				document.getElementById("IDC_AGB_CHECK").checked = true;
				document.getElementById("IDC_EDIT_USERID").value = oViewer.username;
				document.getElementById("IDC_EDIT_PASSWD").value = oViewer.password;
				oCV.value = ""; // Endlosschleife verhindern
				ZAU_LoginEditChanged();
			}
			catch (e) {}
		}
		else {
			ekSubmit('IDC_GOTO_ZA02');
		}
	}

	createNewHiddenFormField('EKSUBMITEVENTPAR', '');
	ekSubmit('IDC_ZA00_UPDATE', "isyiframe");
}

function ZA_SubmitNextIfLoggedIn ()
{
	aFlag = document.getElementById ('LOGIN_VISIBILITY');

	if (aFlag.value == "visible")
	{
		ekSubmit('IDC_NEXT');
	}
}


// TODO: Wenn es keine Probleme mit der Tabelle (SimTable.js) gibt
// nur noch die simt... Funktionen verwenden.
//
function ZA_GetSelectedZA02Table() 
{
	try {
		return dialog['IDC_ZA02_TABLE'].getSelected();
	}
	catch (e) {
		return simtGetSelectedRow('IDC_ZA02_TABLE');
	}
}

function ZA_IsDisabledZA02Table()
{
	try {
		return dialog["IDC_ZA02_TABLE"].container.disabled;
	}
	catch (e) {
		return simtGetDisabled("IDC_ZA02_TABLE");
	}
}

function ZA_DisableZA02Table()
{
	try {
		dialog["IDC_ZA02_TABLE"].disable();
	}
	catch (e){
		simtSetDisabled("IDC_ZA02_TABLE", true);
	}
}


function ZA_UtilsToggleZBHGruppe (aObj)
{
	strId = aObj.id;
	strSrc = aObj.getAttribute('src');
	strLocalVent = aObj.getAttribute('vent')

	if (strSrc.indexOf("view-resize") >= 0)
	{	
		// Show
		strDisplay = "";
		strSrc = "EKImage/view-restore.png"
	}
	else
	{
		strDisplay = "none";
		strSrc = "EKImage/view-resize.png"
	}


	var aTable = dialog["IDC_ZUB_KONF_TABLE"];	
	for (var i = 1; i < aTable.element.rows.length; ++i)
	{
		var strGruppe = aTable.element.rows[i].getAttribute('group');
		var strVent = aTable.element.rows[i].getAttribute('vent');
		
		if (strGruppe == strId && strVent == strLocalVent)
		{
			aTable.element.rows[i].style.display = strDisplay;
		}
	}
	
	aObj.src = strSrc;	
}

function ZA_UtilsHideZBHGruppen ()
{
	strDisplay = "none";

	var aTable = dialog["IDC_ZUB_KONF_TABLE"];	
	for (var i = 1; i < aTable.element.rows.length; ++i)
	{
		var strGruppe = aTable.element.rows[i].getAttribute('group');
		var strVent = aTable.element.rows[i].getAttribute('vent');

		if (strGruppe != "")
		{
			aTable.element.rows[i].style.display = strDisplay;
		}
	}
}

function ZA_UtilsZBHEditChanged (aEditObj)
{
	strId = aEditObj.id;
	strValue = aEditObj.value;
	
	createNewHiddenFormField('EKSUBMITEVENTPAR', strId);
	createNewHiddenFormField('EKSUBMITEVENTPAR1', strValue);
	ekSubmit('IDC_ZBH_EDIT_CHANGED', "isyiframe");

}

function ZA_UtilsZBHButtonEvent (aButObj)
{
	alert (aButObj.id);
}


function ZA_UtilsZBHShowProdInfo (aTdObj)
{
	strURL = aTdObj.getAttribute('prodinfo');
	
	if (strURL != "")
	{
		self.open(strURL, "FANselect", "width=640 height=530 toolbar=yes scrollbars=yes");
	}
}


function ZA_UtilsShowProduktInfo ()
{
	var aFlag = document.getElementById ('FLAG_ZA02_TABLE_LOADET');

// alert (window.event.ctrlKey);

	if (aFlag.value == "true")
	{
		// Selektierten Typ bestimmen
		var selected = ZA_GetSelectedZA02Table();
		
		if (selected)
		{

			var objRow = $(selected);
			var strURL = objRow.getAttribute('prodinfo');
		
			if (strURL != "")
			{
				// alert (strURL);
				self.open(strURL, "FANselect", "width=640 height=530 toolbar=yes scrollbars=yes");			
			}
		}
	}
}

function ZA_UtilsShowASTFile ()
{
	var aFlag = document.getElementById ('FLAG_ZA02_TABLE_LOADET');

// alert (window.event.ctrlKey);

	if (aFlag.value == "true")
	{
		// Selektierten Typ bestimmen
		var selected = ZA_GetSelectedZA02Table();
		
		if (selected)
		{

			var objRow = $(selected);
			var strURL = objRow.getAttribute('austext');

			if (strURL != "")
			{
				// alert (strURL);
				self.open(strURL, "FANselect", "width=640 height=530 toolbar=yes scrollbars=yes");			
			}
		}
	}
}


var slider_active = false;

function ZAU_InitZA00Slider ()
{
	var sliederObj = document.getElementById ('ZA_SLIDER_DIV');
	sliederObj.scrollLeft = 15;
	slider_active = true;
}


function ZAU_Slide ()
{
	if (slider_active)
	{	
		var sliederObj = document.getElementById ('ZA_SLIDER_DIV');
		var sliederImg = document.getElementById ('ZA_SLIDER_IMAGE');
	
		if (sliederObj.scrollLeft > 15)
		{
			slider_active = false;
			DMU_MoveLogin('ARROW_RIGHT');		
		}
	
		if (sliederObj.scrollLeft < 15)
		{
			slider_active = false;
			DMU_MoveLogin('ARROW_LEFT');		
		}
	}
}

function ZAU_HideEmptyLines ()
{
	var aTable = dialog["IDC_ZA02_TABLE"];	
	for (var i = 1; i < aTable.element.rows.length; ++i)
	{
		var strUserData = aTable.element.rows[i].getAttribute('userdata');
		
		// Leerzeile ?
		if (strUserData == "")
		{
			aTable.element.rows[i].style.display = 'none';
			
			/*
			var cells = aTable.element.rows[i].cells;
			
			// Inhalte löschen (damit wird die Zeile nicht mehr angezeigt)
			for (var j = 0; j < cells.length; ++j)
			{
				if (cells[j].innerHTML = "&nbsp")
				{
					cells[j].innerHTML = "";
				}
			}
			*/
		}	
	}
}

function ZAU_MaximizeMassblatt (aObj)
{
	document.getElementById ('IDC_BACK').hide();
	document.getElementById ('IDC_NEXT').hide();
	document.getElementById ('FLAG_MASSBLATT_LOADET').value = "false";

	createNewHiddenFormField('EKSUBMITEVENTPAR', aObj.id);
	ekSubmit('IDC_LOAD_MASSBLATT_MAXIMIZED', "isyiframe");
}

function ZAU_MaximizeStempeldaten (aObj)
{
	document.getElementById ('IDC_BACK').hide();
	document.getElementById ('IDC_NEXT').hide();
	document.getElementById ('FLAG_STEMPELDATEN_LOADET').value = "false";

	createNewHiddenFormField('EKSUBMITEVENTPAR', aObj.id);
	ekSubmit('IDC_LOAD_STEMPELDATEN_MAXIMIZED', "isyiframe");
}

function ZAU_MaximizeSchaltbild (aObj)
{
	document.getElementById ('IDC_BACK').hide();
	document.getElementById ('IDC_NEXT').hide();
	document.getElementById ('FLAG_STEMPELDATEN_LOADET').value = "false";

	createNewHiddenFormField('EKSUBMITEVENTPAR', aObj.src);
	ekSubmit('IDC_LOAD_SCHALTBILD_MAXIMIZED', "isyiframe");
	
}


function ZAU_FileButtonEvent (aButton)
{
	var strButtonId = aButton.id;

	strSuffix = (strButtonId == "IDC_MERKLIST_LOAD" || strButtonId == "IDC_MERKLIST_SAVE" || strButtonId == "IDC_MERKLIST_DELETE" || strButtonId == "IDC_MERKLIST_SAVE_AS") ? ".mkl" :
				(strButtonId == "IDC_LP_LOAD" || strButtonId == "IDC_LP_SAVE" || strButtonId == "IDC_LP_DELETE" || strButtonId == "IDC_LP_SAVE_AS") ? ".lcl" :
				(strButtonId == "IDC_LCC_LOAD" || strButtonId == "IDC_LCC_SAVE" || strButtonId == "IDC_LCC_DELETE" || strButtonId == "IDC_LCC_SAVE_AS") ? ".lcc" : "";


	strEvent = (strButtonId == "IDC_MERKLIST_LOAD" || strButtonId == "IDC_LP_LOAD" || strButtonId == "IDC_LCC_LOAD") ? "IDC_LOAD_FILE" :
			   (strButtonId == "IDC_MERKLIST_SAVE" || strButtonId == "IDC_LP_SAVE" || strButtonId == "IDC_LCC_SAVE") ? "IDC_SAVE_FILE" :
			   (strButtonId == "IDC_MERKLIST_DELETE" || strButtonId == "IDC_LP_DELETE" || strButtonId == "IDC_LCC_DELETE") ? "IDC_DELETE_FILE" : 
			   (strButtonId == "IDC_MERKLIST_SAVE_AS" || strButtonId == "IDC_LP_SAVE_AS" || strButtonId == "IDC_LCC_SAVE_AS") ? "IDC_SAVE_FILE_AS" : "";

	if (strEvent == "IDC_SAVE_FILE_AS")
	{
		parent.ZAU_UtilsSaveAsShow (strSuffix);
		return (false);
	}

	if (strSuffix == "" || strEvent == "")
	{
		alert ("Fehler in ZAU_FileButtonEvent");
		alert (strButtonId);
		alert (strSuffix);
		alert (strEvent);
		return (false)
	}

	var strValue = "";
	strItems = "";
	strText = "";
	
	if (strSuffix == ".mkl")
	{
		strValue = dialog['IDC_PROJEKTE'].getValue();
		if (strValue != null)
		{
			strText = dialog['IDC_PROJEKTE'].getSelectedText ();
			strItems = dialog['IDC_PROJEKTE'].element.items;
		}
	}
	else if (strSuffix == ".lcl")
	{
		strValue = dialog['IDC_LPS'].getValue();
		if (strValue != null)
		{
			strText = dialog['IDC_LPS'].getSelectedText ();
			strItems = dialog['IDC_LPS'].element.items;
		}
	}
	else if (strSuffix == ".lcc")
	{
		strValue = dialog['IDC_LCCS'].getValue();
		if (strValue != null)
		{
			strText = dialog['IDC_LCCS'].getSelectedText ();
			strItems = dialog['IDC_LCCS'].element.items;
		}
	}

	if (strEvent == "IDC_SAVE_FILE_AS")
	{
		var strText = document.getElementById ('IDC_ENTER_PROJECT_NAME').value;
		strValue = prompt (strText, "");

		if (strValue == null || strValue == "")
		{
			return (false);
		}

		strText = strValue;
	}

	if (strValue != null)
	{
		// Wir sind online

		// Dateiname leer ?
		if (strValue == "")
		{
			return (false);
		}
		
		strItems += "|";
		strTestText = "=" + strText + "|"
	
		// Projekt bereits vorhanden ?
		if ((strText != "") &&
			(strEvent.indexOf("SAVE_FILE") >= 0) &&
			(strItems.indexOf(strTestText) >= 0))
		{
			var strMsgText = document.getElementById ('IDC_OVERWRITE_PROJECT').value;						
			strMsgText = strMsgText.replace (/%s/g, strText);
	
			if (! confirm (strMsgText))
			{
				return (false);
			}
		}
	}	
	else
	{
		// Wir sind offline, Abfrage auf dem Server
		strValue = "";
	}

	if (strEvent == "IDC_SAVE_FILE_AS")
	{
		// Suffix anhängen
		strValue += strSuffix;
	}

	createNewHiddenFormField('EKSUBMITEVENTPAR', strValue);
	createNewHiddenFormField('EKSUBMITEVENTPAR1', strSuffix);

	// Bei Lastprodfil speichern geänderte Werte einsammeln
	if (strSuffix == ".lcl" && (strEvent == "IDC_SAVE_FILE_AS" || strEvent == "IDC_SAVE_FILE"))
	{
		var strGUIValues = ZA_UtilsLPGetValueString ();
		createNewHiddenFormField('EKSUBMITEVENTPAR2', strGUIValues);
	}

	ekSubmit (strEvent, "isyiframe");
}


function ZA_UtilsLCCZoomChart (aButton)
{
	strButtonId = aButton.id;
	createNewHiddenFormField('EKSUBMITEVENTPAR', strButtonId);

	ekSubmit("IDC_LCC_ZOOM_CHART", "isyiframe");
}


function ZA_UtilsLCCShowChart (strButtonId)
{
	strChartTyp = (strButtonId == "IDC_LINIES") ? "LINIEN" : 
				  (strButtonId == "IDC_BALKEN") ? "BALKEN" : "";
	var strValues = ZA_UtilsLPGetValueString ();

	createNewHiddenFormField('EKSUBMITEVENTPAR', strChartTyp);
	createNewHiddenFormField('EKSUBMITEVENTPAR1', strValues);

	ekSubmit("IDC_LCC_SHOW_CHART", "isyiframe");

}


function ZA_UtilsLPGetValueString ()
{
	strStunden0 = document.getElementById ('IDC_ZA13_LP_01').value;
	strProzent0 = document.getElementById ('IDC_ZA13_LP_02').value;
	strStunden1 = document.getElementById ('IDC_ZA13_LP_11').value;
	strProzent1 = document.getElementById ('IDC_ZA13_LP_12').value;
	strStunden2 = document.getElementById ('IDC_ZA13_LP_21').value;
	strProzent2 = document.getElementById ('IDC_ZA13_LP_22').value;
	strStunden3 = document.getElementById ('IDC_ZA13_LP_31').value;
	strProzent3 = document.getElementById ('IDC_ZA13_LP_32').value;
	strStrompreis = document.getElementById ('IDC_ZA13_LP_52').value;
	strTeuerungszuschlag = document.getElementById ('IDC_ZA13_LP_62').value;

	var ResultString = "";
	ResultString += "STUNDEN_0=" + strStunden0 + ";"; 
	ResultString += "PROZENT_0=" + strProzent0 + ";"; 
	ResultString += "STUNDEN_1=" + strStunden1 + ";"; 
	ResultString += "PROZENT_1=" + strProzent1 + ";"; 
	ResultString += "STUNDEN_2=" + strStunden2 + ";"; 
	ResultString += "PROZENT_2=" + strProzent2 + ";"; 
	ResultString += "STUNDEN_3=" + strStunden3 + ";"; 
	ResultString += "PROZENT_3=" + strProzent3 + ";"; 
	ResultString += "PREIS=" + strStrompreis + ";"; 
	ResultString += "TZSCHL=" + strTeuerungszuschlag + ";"; 

	return (ResultString);
}



function ZA_UtilsLPEditChanged (aEdit)
{
	if (isNaN(aEdit.value)) 
	{	
		aEdit.value = "";
	}
	else if (aEdit.value == " ")
	{
		aEdit.value = "";
	}

	// Restalufzeit bestimmen		
	var strN1 = document.getElementById ('IDC_ZA13_LP_01').value;
	var strN2 = document.getElementById ('IDC_ZA13_LP_11').value;
	var strN3 = document.getElementById ('IDC_ZA13_LP_21').value;
	var strN4 = document.getElementById ('IDC_ZA13_LP_31').value;

	var nN1 = (isNaN(strN1) || strN1 == "") ? 0 : parseInt(strN1);
	var nN2 = (isNaN(strN2) || strN2 == "") ? 0 : parseInt(strN2);
	var nN3 = (isNaN(strN3) || strN3 == "") ? 0 : parseInt(strN3);
	var nN4 = (isNaN(strN4) || strN4 == "") ? 0 : parseInt(strN4);

	var nVerbrauchSonstige = (aEdit.id == "IDC_ZA13_LP_01") ? nN2 + nN3 + nN4 :
							 (aEdit.id == "IDC_ZA13_LP_11") ? nN1 + nN3 + nN4 :
							 (aEdit.id == "IDC_ZA13_LP_21") ? nN1 + nN2 + nN4 : nN1 + nN2 + nN3;

	var nVerbrauchSelbst = (aEdit.id == "IDC_ZA13_LP_01") ? nN1 :
						   (aEdit.id == "IDC_ZA13_LP_11") ? nN2 :
						   (aEdit.id == "IDC_ZA13_LP_21") ? nN3 : nN4;

	var nRest;

	if ((nVerbrauchSonstige + nVerbrauchSelbst) > parseInt ("8760"))
	{
		nRest = 0;
		aEdit.value = (parseInt ("8760") - nVerbrauchSonstige);
	}
	else
	{
		nRest = parseInt ("8760") - (nN1 + nN2 + nN3 + nN4);
	}
		
	document.getElementById ('IDC_ZA13_LP_41').value = nRest;
}

function ZA_UtilsLCCModify (aObj)
{
	strId = aObj.id;
	createNewHiddenFormField('EKSUBMITEVENTPAR', strId);

	ekSubmit("IDC_MODIFY_LCC", "isyiframe");
}


function ZA_UtilsLCCModifyDone (aObj)
{
	strId = aObj.id;
	createNewHiddenFormField('EKSUBMITEVENTPAR', strId);
	strTableID = document.getElementById ('IDC_LCC_EDIT_0').value;

	if (strId == "IDC_LCC_OK")
	{
		// Daten einsammeln
		aCB = document.getElementById ('IDC_LCC_REGELER_CB');
		strRegelung = aCB.value;

		strAnzahlVents = document.getElementById ('IDC_LCC_EDIT_11').value;
		strEinzelpreisVents = document.getElementById ('IDC_LCC_EDIT_12').value;
		strAnzahlRegler = document.getElementById ('IDC_LCC_EDIT_21').value;
		strEinzelpreisRegeler = document.getElementById ('IDC_LCC_EDIT_22').value;
		strInstallation = document.getElementById ('IDC_LCC_EDIT_31').value;

		var ResultString = "";
		ResultString += "SEL_REGLER=" + strRegelung + ";"; 
		ResultString += "ANZ_VENTS=" + strAnzahlVents + ";"; 
		ResultString += "EPREIS_VENTS=" + strEinzelpreisVents + ";"; 
		ResultString += "ANZ_REGLER=" + strAnzahlRegler + ";"; 
		ResultString += "EPREIS_REGLER=" + strEinzelpreisRegeler + ";"; 
		ResultString += "INSTALLATION=" + strInstallation + ";"; 

		if (strTableID == "BUT_LCC_MODIFY_FT")
		{
			strBezeichnung = document.getElementById ('IDC_LCC_EDIT_111').value;
			strQVBEINMAX = document.getElementById ('IDC_LCC_EDIT_112').value;
			strPSFBEINMAX = document.getElementById ('IDC_LCC_EDIT_113').value;
			strPLBEINMAX = document.getElementById ('IDC_LCC_EDIT_114').value;
			strNMAX = document.getElementById ('IDC_LCC_EDIT_115').value;

			ResultString += "QVBEINM=" + strQVBEINMAX + ";"; 
			ResultString += "PSFBEINM=" + strPSFBEINMAX + ";"; 
			ResultString += "PLBEINM=" + strPLBEINMAX + ";"; 
			ResultString += "NMAX=" + strNMAX + ";"; 
			ResultString += "BEZEICHNUNG=" + strBezeichnung + ";"; 
		}
		
		createNewHiddenFormField('EKSUBMITEVENTPAR1', ResultString);
	}
	if (strId == "IDC_LCC_DEL")
	{
		createNewHiddenFormField('EKSUBMITEVENTPAR1', strTableID);
	}		
	
	ekSubmit("IDC_MODIFY_LCC_DONE", "isyiframe");
}


function ZA_UtilsBauformSelected (aObj)
{
	strBauform = aObj.getAttribute('userdata');
	createNewHiddenFormField('EKSUBMITEVENTPAR', strBauform);

	ZA_DisableZA02Table();
	
	ekSubmit("IDC_ZA02_BAUFORM_SELECTED", "isyiframe");
}

function ZA_UtilsBBCheck ()
{
	strBBChecked = dialog['IDC_BB_CHECK'].isChecked() ? "true" : "false";
	createNewHiddenFormField('EKSUBMITEVENTPAR', strBBChecked);
	
	ekSubmit("IDC_ZA02_BB_CHECK", "isyiframe");
}

function ZA_UtilsToggleBauform ()
{
	var strOptionen = "";
	strOptionen += ZA_UtilsCollectEditValues ("IDC_ZA02_BP_TABLE");
	strOptionen += ZA_UtilsCollectEditValues ("IDC_ZA02_WAB_TABLE");
	strBBChecked = dialog['IDC_BB_CHECK'].isChecked() ? "true" : "false";

	createNewHiddenFormField('EKSUBMITEVENTPAR', strOptionen);
	createNewHiddenFormField('EKSUBMITEVENTPAR1', strBBChecked);
	
	ekSubmit("IDC_ZA02_TOGGLE_BAUFORM", "isyiframe");
}

function ZA_UtilsToggleBaureihe ()
{
	var strOptionen = "";
	strOptionen += ZA_UtilsCollectEditValues ("IDC_ZA02_BP_TABLE");
	strOptionen += ZA_UtilsCollectEditValues ("IDC_ZA02_WAB_TABLE");

	createNewHiddenFormField('EKSUBMITEVENTPAR', strOptionen);
	ekSubmit("IDC_ZA02_TOGGLE_BAUREIHE", "isyiframe");
}


function DMU_ToggleBPDruck ()
{
	var strOptionen = "";
	strOptionen += ZA_UtilsCollectEditValues ("IDC_ZA02_BP_TABLE");

	ZAU_SubmitASync("IDC_ZA02_TOGGLE_BP_DRUCK", strOptionen);
}

function DMU_ToggleBPDichte ()
{
	//ekSubmit("IDC_ZA02_TOGGLE_BP_DICHTE", "isyiframe");
	ZAU_SubmitASync("IDC_ZA02_TOGGLE_BP_DICHTE");
}

function DMU_DrawAcusticChanged (aCB)
{
	strId = aCB.id;
	strValue = aCB.getValue();

	createNewHiddenFormField('EKSUBMITEVENTPAR', strId);
	createNewHiddenFormField('EKSUBMITEVENTPAR1', strValue);
	ekSubmit("IDC_DRAW_ACUSTIC_CHANGED", "isyiframe");
}

function DMU_ToggleSFPKlassen ()
{
	var aFlag = document.getElementById ('FLAG_DRAW_SPF_KLASSEN');

	aFlag.value = (aFlag.value == "true") ? "false" : "true";

	//ekSubmit("IDC_TOGGLE_SFP_KLASSEN", "isyiframe");
	ZAU_SubmitASync("IDC_TOGGLE_SFP_KLASSEN");
}

function DMU_ToggleUeberspKl ()
{
	var aFlag = document.getElementById ('FLAG_DRAW_UEBERSP_KL');

	aFlag.value = (aFlag.value == "true") ? "false" : "true";

	//ekSubmit("IDC_TOGGLE_UEBERSP_KL", "isyiframe");
	ZAU_SubmitASync("IDC_TOGGLE_UEBERSP_KL");
}

// Obsolet
function DMU_ShowOrHideSFPKlassenLegende ()
{
	var aFlag = document.getElementById ('FLAG_DRAW_SPF_KLASSEN');

	for (var i = 1; i < 8; ++i)
	{
		strId = "IDC_SPF" + i;
		if (aFlag.value == "true")
			document.getElementById (strId).show();
		else
			document.getElementById (strId).hide();		
	}
}

function ZA_UtilsMerklistEventTextarea (aObject)
{

	var strName = aObject.name;
	var strIndex = aObject.userdata;
	var strText = aObject.value;

	strText.replace ("\r", "");
	strText.replace ("\n", "<br>");

	createNewHiddenFormField('EKSUBMITEVENTPAR', strIndex);
	createNewHiddenFormField('EKSUBMITEVENTPAR1', strText);

	ekSubmit("IDC_MERKL_TEXTAREA", "isyiframe");
	
}

function ZA_UtilsMerklistEventCheck (aObject)
{
	strObjId = aObject.id;
	strChekBoxSuffix = (strObjId == "IDC_CHECK_AUSGABE") ? "AUSGABE" :
					   (strObjId == "IDC_CHECK_DELETE") ? "DELETE" : "";

	if (strChekBoxSuffix != "")
	{
		// Alle selektieren oder deselektieren
		bChecked = aObject.checked;
	
		// Alle Checkboxen durchgehen
		var aTable = dialog["IDC_MERKL_TABLE"];	
		for (var i = 0; i < aTable.element.rows.length; ++i)
		{
			var strUserData = aTable.element.rows[i].getAttribute('userdata');
			// alert (strUserData);	
	
			if (strUserData != "")
			{
				// Datenzeile
				strRowId = aTable.element.rows[i].id;
				
				strCheckBoxId = strRowId + "_" + strChekBoxSuffix;
				// alert (strCheckBoxId);
	
				var aCheckBox = document.getElementById (strCheckBoxId);
	
				aCheckBox.checked = bChecked;
			}
		}
	}
	else if (strObjId.indexOf ("VERGLEICH") >= 0)
	{
		bChecked = aObject.checked;
		iIndex = 0;

		// Farben anpassen, Prüfung auf maximal 3 angecklicked

		// Alle Checkboxen durchgehen
		var aTable = dialog["IDC_MERKL_TABLE"];	
		for (var i = 0; i < aTable.element.rows.length; ++i)
		{
			var strUserData = aTable.element.rows[i].getAttribute('userdata');
			// alert (strUserData);	
	
			if (strUserData != "")
			{
				// Datenzeile
				strRowId = aTable.element.rows[i].id;
				
				strCheckBoxId = strRowId + "_VERGLEICH";
	
				var aCheckBox = document.getElementById (strCheckBoxId);
	
				bChecked = aCheckBox.checked;
				strColor = "white";
				strTextColor = "rgb(0,0,0)";
				
				if (iIndex >= 3)
				{
					aCheckBox.checked = false;
				}
				else if (bChecked)
				{
					// strColor = (iIndex == 0) ? "rgb(153,204,255)" : (iIndex ==1) ? "rgb(204,255,204)" : "rgb(255,204,153)";
					strColor = (iIndex == 0) ? "rgb(226,0,122)" : (iIndex ==1) ? "rgb(0,75,138)" : "rgb(241,174,31)";
					strTextColor = "rgb(255,255,255)";

					iIndex++;					
				}

				aTD = document.getElementById (strRowId + "_3");
				aTextArea = document.getElementById (strRowId + "_TEXTAREA");
				
				if (aTD)
				{
					aTD.style.backgroundColor = strColor;
					aTD.style.color = strTextColor;
				}				
				if (aTextArea)
				{
					aTextArea.style.backgroundColor = strColor;
					aTextArea.style.color = strTextColor;
				}				
			}
		}
	}
}

function ZA_UtilsMerklistEvent (aObject)
{
	// alert (aObject.id);

	strChekBoxSuffix = (aObject.id == "IDC_VERGLEICH") ? "VERGLEICH" :
					   (aObject.id == "IDC_AUSGABE") ? "AUSGABE" :
					   (aObject.id == "IDC_DELETE") ? "DELETE" : "";

	if (strChekBoxSuffix == "")
	{
		return;
	}

	var strCheckedRowIds = "";
	
	// Alle Checkboxen durchgehen
	var aTable = dialog["IDC_MERKL_TABLE"];	
	for (var i = 0; i < aTable.element.rows.length; ++i)
	{
		var strUserData = aTable.element.rows[i].getAttribute('userdata');
		// alert (strUserData);	

		if (strUserData != "")
		{
			// Datenzeile
			strRowId = aTable.element.rows[i].id;
			
			strCheckBoxId = strRowId + "_" + strChekBoxSuffix;
			// alert (strCheckBoxId);

			var aCheckBox = document.getElementById (strCheckBoxId);

			if (aCheckBox.checked)
			{
				if (strCheckedRowIds != "")
				{
					strCheckedRowIds += "|";
				}
				
				strCheckedRowIds += strUserData;
			}
			
		}
	}

	if (strCheckedRowIds != "")
	{
		if (aObject.id == "IDC_DELETE")
		{
			createNewHiddenFormField('EKSUBMITEVENTPAR', strCheckedRowIds);
			ekSubmit("IDC_DELETE_FROM_MERKL", "isyiframe");
		}
		else if (aObject.id == "IDC_VERGLEICH" || aObject.id == "IDC_AUSGABE")
		{

			parent.closeIFrame ('IF_MERKLISTE');
			
			if (aObject.id == "IDC_VERGLEICH")
			{
				parent.ZA_UtilsNavigationCheckTrefferliste();
				
				parent.document.getElementById ('FLAG_DETAILS_LOADET').value = "true";
				parent.document.getElementById ('FLAG_AUSGABE_LOADET').value = "true";
				parent.document.getElementById ('FLAG_KENNLINIE_LOADET').value = "false";
				parent.document.getElementById ('FLAG_MASSBLATT_LOADET').value = "false";
				parent.document.getElementById ('FLAG_LCC_LOADET').value = "false";
				parent.document.getElementById ('FLAG_KL_VERGLEICH_LOADET').value = "false";
				parent.document.getElementById ('FLAG_STEMPELDATEN_LOADET').value = "false";

				parent.createNewHiddenFormField('EKSUBMITEVENTPAR', strCheckedRowIds);
				parent.ekSubmit("IDC_LOAD_DETAILS_BY_LCC_IDS", "isyiframe");
				return;

				// parent.ZA_UtilsNavigationGoTo ('IDC_TAB_DETAILS', 'IDC_TAB_LCC');
			}
			else
			{
				parent.createNewHiddenFormField('EKSUBMITEVENTPAR', strCheckedRowIds);
				parent.ekSubmit("IDC_INIT_AUSGABE_BY_MERKLIST_IDS", "isyiframe");

				// parent.ZA_UtilsNavigationGoTo ('IDC_TAB_AUSGABE', '');
			}
		}
	}
}


function ZA_UtilsLoadMerklist ()
{
// alert ("ZA_UtilsLoadMerklist");

	parent.ekSubmit("IDC_SHOW_MERKL", "isyiframe");
}

function ZA_UtilsAddToMerklist ()
{
// alert ("ZA_UtilsAddToMerklist");

	var selected = 	ZA_GetSelectedZA02Table();
	
	if (selected)
	{
		var objRow = $(selected);
		var strUserData = objRow.getAttribute('userdata');

		document.getElementById ('FLAG_LCC_LOADET').value="false";
		document.getElementById ('FLAG_MERKLIST_LOADET').value="false";

		createNewHiddenFormField('EKSUBMITEVENTPAR', strUserData);
		ekSubmit("IDC_ADD_TO_MERKL", "isyiframe");
	}
}

function DMU_MenuItemClicked (strId)
{
	if (strId == "IDC_UNIT_CALC")
	{
		dialog['IDC_MENU'].hide();
		ekSubmit(strId, "isyiframe");
	}
	else if (strId == "IDC_SAVE_OPTIONS")
	{
		dialog['IDC_MENU'].hide();
		ekSubmit(strId, "isyiframe");
	}
	else if (strId == "IDC_SAVE_PRECOND")
	{

		var strOptionen = "";
	
		strOptionen += ZA_UtilsCollectEditValues ("IDC_ZA02_BP_TABLE");
		strOptionen += ZA_UtilsCollectEditValues ("IDC_ZA02_WAB_TABLE");
		strOptionen += "SUCHTOLERANZ=" + document.getElementById('IDC_ZA01_ED_ST').value + ";";
		strOptionen += "ST_TYPE_CB=" + document.getElementById('IDC_ZA01_CB_ST').value + ";";
		if (document.getElementById('ZA_BG_COMP'))
		{
			strOptionen += "ZA_BG_COMP_VALUE=" + document.getElementById('ZA_BG_COMP').value + ";";
		}

		dialog['IDC_MENU'].hide();
		
		createNewHiddenFormField('EKSUBMITEVENTPAR', strOptionen);
		ekSubmit(strId, "isyiframe");
	}
	else if (strId == "IDC_DELETE_PRECOND" || strId == "IDC_PRECOND_LOAD")
	{
		// Fenster neu laden
		ekSubmit(strId);
	}
	else
	{
		// aktuelle Tab-Pagees bestimmen
		var strTabSelected = dialog['IDC_ZA_TABS'].getSelected ();
		var strTabDetailsSelected = dialog['IDC_TC_DETAILS'].getSelected ();
		var strTabVergleichSelected = "";
	
		// Selektion in der Trefferliste bestimmen
		ZA_UtilsNavigationCheckTrefferliste ();
		var aIndex = document.getElementById ('INDEX_LAST_SELECTED_TREFFER').value;	
	
		createNewHiddenFormField('EKSUBMITEVENTPAR', strTabSelected);
		createNewHiddenFormField('EKSUBMITEVENTPAR1', strTabDetailsSelected);
		createNewHiddenFormField('EKSUBMITEVENTPAR2', strTabVergleichSelected);
		createNewHiddenFormField('EKSUBMITEVENTPAR3', aIndex);
		
		// Fenster neu laden
		ekSubmit(strId);
	}
}

function DMU_ShowPicture (aImage)
{
	// alert (aImage.src);
	self.open(aImage.src, "FANselect", "width=800 height=600 toolbar=no");
}


function DMU_LanComboChanged (aCB)
{
	strEvent = "IDC_LAN_" + aCB.getValue();
	ekSubmit(strEvent);
}

function DMU_ModeComboChanged (aCB)
{
	strMode = aCB.getValue();

	createNewHiddenFormField('EKSUBMITEVENTPAR', strMode);

	ekSubmit("INTERPOL_MODE_CHANGED", "isyiframe");
}

function DMU_ModeComboChanged01 (aCB)
{
	strMode = aCB.getValue();

	createNewHiddenFormField('EKSUBMITEVENTPAR', strMode);

	ekSubmit("COMPUTE_MODE_CHANGED", "isyiframe");
}



function DMU_MoveLogin (strDircetion) 
{

	// Update auf Bilder und werblichen Text
	createNewHiddenFormField('EKSUBMITEVENTPAR', strDircetion);
	ekSubmit('IDC_ZA00_UPDATE', "isyiframe");

}

function DMU_Reset () 
{
	// aktuelle Tab-Page bestimmen
	var strTabSelected = dialog['IDC_ZA_TABS'].getSelected ();

	if (strTabSelected == "IDC_TAB_PRODUKTSPEKTRUM")
	{
		ekSubmit("IDC_ZA01_TAB_RESET", "isyiframe");
	}
	else if (strTabSelected == "IDC_TAB_VENTILATORAUSWAHL")
	{
		document.getElementById ('FLAG_ZA01_TABLE_LOADET').value = "false";
		ekSubmit("IDC_ZA02_TAB_RESET", "isyiframe");
	}
	else if (strTabSelected == "IDC_TAB_DETAILS")	
	{
		document.getElementById ('INDEX_LAST_SELECTED_TREFFER').value = "";

		ekSubmit("IDC_DETAILS_RESET", "isyiframe");
	}
	else if (strTabSelected == "IDC_TAB_ZUBEHOER")
	{
		ekSubmit("IDC_ZBH_RESET", "isyiframe");
	}
	
}

function DMU_StopEvent (e)
{
	if (window.event)
	{
		Event.stop(window.event);
	}
	else
	{
		Event.stop (e);
	}
}


function DMU_MyGroupAndBRChanged (e)
{
	var bCntrlKey;
	var strId;

	if (window.event)
	{
		bCntrlKey = window.event.ctrlKey;
		aObj = window.event.srcElement;

		// Workaround für das Problem der Markierung mit Strg-Taste in der Baureihenauswahl
		if (Prototype.Browser.IE)
		{		
			// ...mal kurz den Focus umswitchen (blur funktioniert nicht)
			document.getElementById ('IDC_ZA01_ED_ST').focus();
			document.getElementById (aObj.id).focus();
		}
	}
	else
	{
		bCntrlKey = e.ctrlKey;
		aObj = e.target;
	}

//	alert (bCntrlKey);
//	alert (aObj.id);

	var strGroup = aObj.getAttribute('id_gruppe');
	var strBR = aObj.getAttribute('id_baureihe');

//	alert (strGroup);
//	alert (strBR);

	if (strGroup != "")
	{
		// dialog.disable();
		ZA_UtilsShowWaitAnim ();
		DMU_GroupAndBRChanged (strGroup, strBR, bCntrlKey);
	}
} 


function DMU_AddBaureihenEventHanddler ()
{
	var aTable = document.getElementById ('IDC_ZA02_WAB_SUB_TABLE');	

	if (aTable)
	{
		for (var i = 1; i < aTable.rows.length; ++i)
		{
			var strTabRow = aTable.rows[i];
			
			if (strTabRow && strTabRow.addEventListener)
			{
				strTabRow.addEventListener ("click", DMU_MyGroupAndBRChanged, true);
			}
			else if (strTabRow && strTabRow.attachEvent)
			{
				strTabRow.attachEvent ("onclick", DMU_MyGroupAndBRChanged);
			}
		}
	}
} 


function DMU_GroupAndBRChanged (strGroup, strBR, bCntrlKey) 
{

	if (bCntrlKey)
	{
		// Mehrfachauswahl
		strOldGroup = document.getElementById ('ID_SELECTED_GRUPPE').value;
		strOldBR = document.getElementById ('ID_SELECTED_BAUREIHE').value;

		if (strGroup == strOldGroup)
		{
			var strFindWhat = "|" + strBR + "|";
			var strInWhat = "|" + strOldBR + "|";
			
			if (strInWhat.indexOf(strFindWhat) >= 0)
			{
				// Selektion aufheben
				strBR = strOldBR.replace (strBR, "").replace ("||", "|");
				if (strBR.indexOf("|") == 0)
					strBR = strBR.substr(1);
			}
			else
			{
				// Selektion dazunehmen
				strBR = strOldBR + "|" + strBR;
			}
		}
	}

	// Gruppe und Baureihen ablegen
	document.getElementById ('ID_SELECTED_GRUPPE').value = strGroup;	
	document.getElementById ('ID_SELECTED_BAUREIHE').value = strBR;	
	document.getElementById ('FLAG_SELECTED_BAUREIHE_CHANGED').value = "true";	

	ZA_DisableZA02Table();

	// Seite neu laden
	// ZA_UtilsNavigationInitTabPage ("IDC_TAB_VENTILATORAUSWAHL", "");
	createNewHiddenFormField('EKSUBMITEVENTPAR', strGroup);
	createNewHiddenFormField('EKSUBMITEVENTPAR1', strBR);
	createNewHiddenFormField('EKSUBMITEVENTPAR2', "NORESET");
	ekSubmit("IDC_ZA02_INIT", "isyiframe");
}

function DMU_MyEKSubTableSelect (aObj) 
{

	var nLength = aObj.length;
	var strIdGruppe = aObj.name;
	var strId = "";
	var strIds = "";

	// Falls kein Wert selektiert ist, "Alle" selektieren
	for (i = 0; i < nLength; ++i)
	{
		if (aObj.options[i].selected == true)
		{
			if (strIds != "")
			{
				strIds += "|";
			}
			strIds += aObj.options[i].value;
			strId = aObj.options[i].value;			
		}
	}

	if (strIds == "")
	{
		aObj.options[0].selected = true;
	}
	else
	{
		aObj.options[0].selected = false;
	}

	// Alle übrigen Selektionen aufheben
	var aTable = dialog["IDC_ZA01_TABLE"];	
	for (var i = 0; i < aTable.element.rows.length; ++i)
	{
		var strCurrGruppe = aTable.element.rows[i].getAttribute('userdata');
		if (strCurrGruppe != strIdGruppe)
		{			
			var aSubObj = document.getElementById(strCurrGruppe);
			for (j = 0; j < aSubObj.length; ++j)
			{
				if (aSubObj.options[j].selected == true)
				{
					aSubObj.options[j].selected = false;
				}
			}
			
			// document.getElementById ("BUTTON_" + strCurrGruppe).disabled = true;;
		}
		else
		{
			// document.getElementById ("BUTTON_" + strCurrGruppe).disabled = false;;
		}
	}

	// Gruppe und Baureihen ablegen
	document.getElementById ('ID_SELECTED_GRUPPE').value = strIdGruppe;	
	document.getElementById ('ID_SELECTED_BAUREIHE').value = strIds;	
	document.getElementById ('FLAG_SELECTED_BAUREIHE_CHANGED').value = "true";	

	// Update auf Bild und werblichen Text
	createNewHiddenFormField('EKSUBMITEVENTPAR', strId);
	createNewHiddenFormField('EKSUBMITEVENTPAR1', strIdGruppe);
	//ekSubmit('IDC_ZA01_UPDATE_ENTRY', "isyiframe");
	
	document.forms[0].EKSUBMITEVENT.value = 'IDC_ZA01_UPDATE_ENTRY';
	
	// Hier einen Ajax Request machen
	var ajax = new Ajax.Request("/", {
		parameters: Form.serialize( document.forms[0] )
		,onComplete: function(transport) {
			var response = transport.responseText.evalJSON();
			$(response.textId).update(response.text);
			$(response.imageId).down().src = response.imageSrc;
		}
	});
}

function ZAU_InitLanMenu (strMenuId, strPic)
{
	aMenu = document.getElementById (strMenuId);

	strInnerHTML = aMenu.innerHTML;

	strInnerHTML = "<img src='" + strPic + "' class='LAN_BILD'>&nbsp;" + strInnerHTML;

	aMenu.innerHTML = strInnerHTML;

}


function ZAU_InitZA01 ()
{
	// Flaggen in das Sprach-Menu reinschießen
	// Funktioniert im Safari nur mit setTimeout, keiner weiss genau warum
	// ZAU_InitLanMenu ("IDC_LAN_DE", "EKImage/LAN/de.gif");

	setTimeout( 'ZAU_InitLanMenu ("IDC_LAN_DE", "EKImage/LAN/de.gif")', 50 );
	setTimeout( 'ZAU_InitLanMenu ("IDC_LAN_EN", "EKImage/LAN/en.gif")', 50 );;
	setTimeout( 'ZAU_InitLanMenu ("IDC_LAN_US", "EKImage/LAN/us.gif")', 50 );;
	setTimeout( 'ZAU_InitLanMenu ("IDC_LAN_IT", "EKImage/LAN/it.gif")', 50 );;
	setTimeout( 'ZAU_InitLanMenu ("IDC_LAN_ES", "EKImage/LAN/es.gif")', 50 );;
	setTimeout( 'ZAU_InitLanMenu ("IDC_LAN_NL", "EKImage/LAN/nl.gif")', 50 );;
	setTimeout( 'ZAU_InitLanMenu ("IDC_LAN_CS", "EKImage/LAN/cz.gif")', 50 );;
	setTimeout( 'ZAU_InitLanMenu ("IDC_LAN_PL", "EKImage/LAN/pl.gif")', 50 );;
	setTimeout( 'ZAU_InitLanMenu ("IDC_LAN_DA", "EKImage/LAN/dk.gif")', 50 );;
	setTimeout( 'ZAU_InitLanMenu ("IDC_LAN_SV", "EKImage/LAN/se.gif")', 50 );;
	setTimeout( 'ZAU_InitLanMenu ("IDC_LAN_FR", "EKImage/LAN/fr.gif")', 50 );;
	setTimeout( 'ZAU_InitLanMenu ("IDC_LAN_FI", "EKImage/LAN/fi.gif")', 50 );;
	setTimeout( 'ZAU_InitLanMenu ("IDC_LAN_ZH", "EKImage/LAN/cn.gif")', 50 );;
	setTimeout( 'ZAU_InitLanMenu ("IDC_LAN_RU", "EKImage/LAN/ru.gif")', 50 );;
	setTimeout( 'ZAU_InitLanMenu ("IDC_LAN_TR", "EKImage/LAN/tr.gif")', 50 );;
	setTimeout( 'ZAU_InitLanMenu ("IDC_LAN_PT", "EKImage/LAN/pt.gif")', 50 );;
	setTimeout( 'ZAU_InitLanMenu ("IDC_LAN_JA", "EKImage/LAN/jp.gif")', 50 );;
	setTimeout( 'ZAU_InitLanMenu ("IDC_LAN_HU", "EKImage/LAN/hu.gif")', 50 );;
	
	dialog['IDC_MENU'].hide();
	
	// Die Tab-Header des Details-TabCntrl entfernen
	nLength =  dialog['IDC_TC_DETAILS'].tabs.length;

	for (i = 0; i < nLength; ++i)
	{
		dialog['IDC_TC_DETAILS'].tabs[i].hide();
	}	

	InitAusgabeCH ();

	var aTabCntrl = dialog['IDC_ZA_TABS'];
	var selTab = aTabCntrl.getSelected();
	var selSubTab = (selTab == "IDC_TAB_DETAILS") ? dialog['IDC_TC_DETAILS'].getSelected() : "";

	ZA_UtilsNavigationInitTabPage (selTab, selSubTab)
}


// Dummy Submit für den Browser zur Speicherung von Username/Password
function ZAU_RememberLoginSubmit(sEvent, sTarget_)
{
	var form = document.forms[0];
	var loginForm = document.createElement('form');
	loginForm.name = 'login';
	loginForm.method = 'post';
	loginForm.target = 'isyiframe';
	loginForm.action = form.action + "?xmlhttpreq=KeepAlive";

	var oUser = document.getElementById('IDC_EDIT_USERID');
	var oPass = document.getElementById('IDC_EDIT_PASSWD');
	
	// Die Funktion appendChild erzeugt keine Kopien vorhander Elemente.
	document.body.appendChild(loginForm);
	loginForm.appendChild(oUser);
	loginForm.appendChild(oPass);
	loginForm.submit();
	
	try { // IE
		window.external.AutoCompleteSaveForm(loginForm);
	}
	catch (e) {
		//alert(e.message);
	}

	// Form wiederherstellen und echten ekSubmit senden.
	var sTarget = sTarget_ || "";
	form.appendChild(oUser);
	form.appendChild(oPass);
	document.body.removeChild(loginForm);
	ekSubmit(sEvent, sTarget);
}


function ZAU_LoginEditChanged ()
{
	var strUserId = document.getElementById('IDC_EDIT_USERID').value;
	var strPassWd = document.getElementById('IDC_EDIT_PASSWD').value;
	
	if (strUserId != "" && strPassWd != "")
	{
		if (dialog.id == "IDD_ZA01")
		{
			// aktuelle Tab-Pagees bestimmen
			var strTabSelected = dialog['IDC_ZA_TABS'].getSelected ();
			var strTabDetailsSelected = dialog['IDC_TC_DETAILS'].getSelected ();
			var strTabVergleichSelected = "";
		
			// Selektion in der Trefferliste bestimmen
			ZA_UtilsNavigationCheckTrefferliste ();
			var aIndex = document.getElementById ('INDEX_LAST_SELECTED_TREFFER').value;	

			strParams = "";
			strParams += "PAR0=" + strTabSelected + ";";
			strParams += "PAR1=" + strTabDetailsSelected + ";";
			strParams += "PAR2=" + strTabVergleichSelected + ";";
			strParams += "PAR3=" + aIndex + ";";
		
			createNewHiddenFormField('EKSUBMITEVENTPAR', strUserId);
			createNewHiddenFormField('EKSUBMITEVENTPAR1', strPassWd);
			createNewHiddenFormField('EKSUBMITEVENTPAR2', strParams);

			// Login aus IDD_ZA01, Fenster neu laden (kommt nicht vor)
			ZAU_RememberLoginSubmit("IDC_LOGIN");
		}
		else if (dialog.id = "IDD_ZA00")
		{
			createNewHiddenFormField('EKSUBMITEVENTPAR', strUserId);
			createNewHiddenFormField('EKSUBMITEVENTPAR1', strPassWd);
		
			document.getElementById ('IDC_WAIT_ANIM').style.visibility = "visible";

			// Login aus IDD_ZA00
			// Wg. Wait-Anim
			ZAU_RememberLoginSubmit("IDC_LOGIN", "isyiframe");
		}
	}
}


function ZAU_UpdateDichteInfo(obj)
{
	var strOptionen = ZA_UtilsCollectEditValues ("IDC_ZA02_WAB_TABLE");

	ZAU_SubmitASync("IDC_ZA02_UPDATE_WAB_DICHTE_INFO", strOptionen);
}


function ZAU_AttributeEditChanged (strObj)
{
	strAttr = strObj.getAttribute('userdata');
	strValue = strObj.value;

	// Edeit-Felder können Min/Max-Werte enthalten
	strMin = strObj.getAttribute('min_value');
	strMax = strObj.getAttribute('max_value');
	strUnit = strObj.getAttribute('unit_id');
	bCompare = true;

	if (strUnit != "" && (strMin != "" || strMax != ""))
	{
		strEditId = strObj.id
		strUnidObjId = strEditId.replace ("_EDIT", "_UNIT");
		
		oUnit = document.getElementById (strUnidObjId)
		if (oUnit)
		{
			strSelectedUnit = oUnit.value;
			if (strSelectedUnit != "" && strSelectedUnit != strUnit)
			{
				bCompare = false;
			}
		}
	}

	if (bCompare)
	{
		if (strMin != "" && parseFloat(strValue) < parseFloat(strMin))
		{
			strMsg = document.getElementById ('IDC_MSG_MIN_ERROR').value;
			alert (strMsg + " " + strMin);
			strObj.value = strMin;
			strValue = strMin;
		}
		else if (strMax != "" && parseFloat(strValue) > parseFloat(strMax))
		{
			strMsg = document.getElementById ('IDC_MSG_MAX_ERROR').value;
			alert (strMsg + " " + strMax);
			strObj.value = strMax;
			strValue = strMax;
		}
	}

	// Hier soll die Trefferliste gelöscht werden.
	ZA_DisableZA02Table();

/*
	createNewHiddenFormField('EKSUBMITEVENTPAR', strAttr);
	createNewHiddenFormField('EKSUBMITEVENTPAR1', strValue);
	ekSubmit("IDC_ATTR_EDIT_CHANGED", "isyiframe");
*/
}


function ZAU_UnitComboChanged (strObj)
{
	var strAttr = strObj.getAttribute('userdata');
	var strUnit = strObj.getValue();

	var strTabSelected = dialog['IDC_ZA_TABS'].getSelected ();
	var strTabDetailsSelected = dialog['IDC_TC_DETAILS'].getSelected ();

	createNewHiddenFormField('EKSUBMITEVENTPAR', strAttr);
	createNewHiddenFormField('EKSUBMITEVENTPAR1', strUnit);
	createNewHiddenFormField('EKSUBMITEVENTPAR2', strTabSelected);
	createNewHiddenFormField('EKSUBMITEVENTPAR3', strTabDetailsSelected);

	ekSubmit("IDC_UNIT_COMBO_CHANGED", "isyiframe");
}

// Ausgeschaltet, aber ganz hübsch
function ZA_UtilsMoveObjectSlowlyDown (strId, strToY)
{
	var strPosY = document.getElementById (strId).style.top;
	
	if (parseInt (strPosY) < parseInt (strToY))
	{
		strMyToY = parseInt (strPosY) + 4;
		strMyToYpx = strMyToY + "px";
		document.getElementById (strId).style.top = strMyToYpx;

		strTimeOut = "ZA_UtilsMoveObjectSlowlyDown ('" + strId + "', '" +  strToY + "');";
		setTimeout(strTimeOut, 1);		
	}
}



function ZA_UtilsMoveObject (strId, strToX, strToY)
{
	document.getElementById (strId).style.left = strToX;
	document.getElementById (strId).style.top = strToY;
}

function ZA_UtilsSizeObject (strId, strWidth, strHeight)
{
	document.getElementById (strId).style.width = strWidth;
	document.getElementById (strId).style.height = strHeight;
}


function ZA_UtilsToggleWAB ()
{	
	var strOptionen = "";
	strOptionen += ZA_UtilsCollectEditValues ("IDC_ZA02_BP_TABLE");
	strOptionen += ZA_UtilsCollectEditValues ("IDC_ZA02_WAB_TABLE");

	createNewHiddenFormField('EKSUBMITEVENTPAR', strOptionen);
	ekSubmit("IDC_ZA02_TOGGLE_WAB", "isyiframe");
}

function ZA_UtilsRefreshWAB ()
{
	var strOptionen = "";
	strOptionen += ZA_UtilsCollectEditValues ("IDC_ZA02_BP_TABLE");
	strOptionen += ZA_UtilsCollectEditValues ("IDC_ZA02_WAB_TABLE");

	createNewHiddenFormField('EKSUBMITEVENTPAR', strOptionen);
	ekSubmit("IDC_ZA02_UPDATE_WAB", "isyiframe");
}

function ZAU_MyEKTableSelect (strId)
{
	alert ("ZAU_MyEKTableSelect : " + strId)
}

function ZAU_MyEKTableDblClick (strId)
{
	alert ("ZAU_MyEKTableDblClick : " + strId)
}


function ZAU_SetInnerHTML (strId, strHTML)
{
	var aObj = parent.document.getElementById (strId);

	if (aObj)
	{
		aObj.innerHTML = strHTML;
	}
	else
	{		
		alert ("ZAU_SetInnerHTML : Object " + strId + " not found");
	}
}

function ZAU_LoginCheckEvent ()
{

	var oObjLogin5 = document.getElementById ('IDC_AGB_CHECK');
	var oObjLogin6 = document.getElementById ('IDC_AGB_OK');

	bChecked = oObjLogin5.checked;
	
	if (bChecked)
	{
		oObjLogin6.style.visibility = "visible";
	}
	else
	{
		oObjLogin6.style.visibility = "hidden";
	}
}

function ZA_UtilsZA00Event (strWho)
{
	if (strWho == "IDC_AGB_OK")
	{
		ZA_UtilsShowOrHideLogin ("hide");
		
		var oObjLogin = document.getElementById ('IDC_SHOW_PASSWD');
		if (oObjLogin)
		{
			oObjLogin.hide();
		}

		var oObjLogin8 = document.getElementById ('IDC_COOKIE');
		if (oObjLogin8.checked)
		{
			ZA_UtilsShowOrHideCookieHint ("show");	
		}
		else
		{
			ZAU_LoginEditChanged();		
		}
	}
	else if (strWho == "IDC_COOKIE_OK" || strWho == "IDC_COOKIE_CANCEL")
	{
		ZA_UtilsShowOrHideCookieHint ("hide");	

		if (strWho == "IDC_COOKIE_OK")
		{
			strUserId = document.getElementById('IDC_EDIT_USERID').value;
			strPassWd = document.getElementById("IDC_EDIT_PASSWD").value
			ZAU_UtilsSetLoginCookie(strUserId, strPassWd);
		}

		ZAU_LoginEditChanged();
	}
	else if (strWho == "IDC_LOGOUT")
	{
		ekSubmit(strWho);
	}
}


function ZA_UtilsShowOrHideLogin (strWhat)
{
	var oObjLogin1 = document.getElementById ('IDC_USERID');
	var oObjLogin2 = document.getElementById ('IDC_EDIT_USERID');
	var oObjLogin3 = document.getElementById ('IDC_PASSWD');
	var oObjLogin4 = document.getElementById ('IDC_EDIT_PASSWD');
	var oObjLogin5 = document.getElementById ('IDC_AGB_CHECK');
	var oObjLogin6 = document.getElementById ('IDC_AGB_OK');
	var oObjLogin7 = document.getElementById ('IDC_AGB_TEXT');
	var oObjLogin8 = document.getElementById ('IDC_COOKIE');
	var oObjLogin9 = document.getElementById ('IDC_COOKIE_TEXT');
	
	if (strWhat == "show")
	{
		if (oObjLogin1) 
			oObjLogin1.style.visibility = "visible";
		if (oObjLogin2) 
			oObjLogin2.style.visibility = "visible";
		if (oObjLogin3) 
			oObjLogin3.style.visibility = "visible";
		if (oObjLogin4) 
			oObjLogin4.style.visibility = "visible";
		if (oObjLogin5)
		{ 
			oObjLogin5.style.visibility = "visible";
			oObjLogin5.checked = false;
		}
		if (oObjLogin6) 
			oObjLogin6.style.visibility = "hidden";
		if (oObjLogin7) 
			oObjLogin7.style.visibility = "visible";
		if (oObjLogin8) 
			oObjLogin8.style.visibility = "visible";
		if (oObjLogin9) 
			oObjLogin9.style.visibility = "visible";
	}
	else if (strWhat == "hide")
	{
		if (oObjLogin1) 
			oObjLogin1.style.visibility = "hidden";
		if (oObjLogin2) 
			oObjLogin2.style.visibility = "hidden";
		if (oObjLogin3) 
			oObjLogin3.style.visibility = "hidden";
		if (oObjLogin4) 
			oObjLogin4.style.visibility = "hidden";
		if (oObjLogin5)
			oObjLogin5.style.visibility = "hidden";
		if (oObjLogin6) 
			oObjLogin6.style.visibility = "hidden";
		if (oObjLogin7) 
			oObjLogin7.style.visibility = "hidden";
		if (oObjLogin8) 
			oObjLogin8.style.visibility = "hidden";
		if (oObjLogin9) 
			oObjLogin9.style.visibility = "hidden";
	}
}


function ZA_UtilsShowOrHideCookieHint (strWhat)
{
	var oObjLogin1 = document.getElementById ('IDC_COOKIE_GB_TL');
	var oObjLogin2 = document.getElementById ('IDC_COOKIE_HINT');
	var oObjLogin3 = document.getElementById ('IDC_COOKIE_OK');
	var oObjLogin4 = document.getElementById ('IDC_COOKIE_CANCEL');

	if (strWhat == "show")
	{
		if (oObjLogin1) 
			oObjLogin1.style.visibility = "visible";
		if (oObjLogin2) 
			oObjLogin2.style.visibility = "visible";
		if (oObjLogin3) 
			oObjLogin3.style.visibility = "visible";
		if (oObjLogin4) 
			oObjLogin4.style.visibility = "visible";
	}
	else if (strWhat == "hide")
	{
		if (oObjLogin1) 
			oObjLogin1.style.visibility = "hidden";
		if (oObjLogin2) 
			oObjLogin2.style.visibility = "hidden";
		if (oObjLogin3) 
			oObjLogin3.style.visibility = "hidden";
		if (oObjLogin4) 
			oObjLogin4.style.visibility = "hidden";
	}
}


function ZA_UtilsTextEvent(aObjId)
{
	var strLan = document.getElementById ('EKCURRENTLANGUAGE').value;

	if (aObjId == "IDC_SHOW_PASSWD")
	{

		var aLanCB = document.getElementById ('IDC_CB_LANGUAGE');
		if (aLanCB)
		{
			aLanCB.style.visibility = "hidden";
		}

		var aMenu = dialog['IDC_MENU'];
		if (aMenu && aMenu.element.style.visibility == "visible")
		{
		  	aMenu.element.style.visibility = "hidden"
			aMenu.hide();
		}

		var aPWEdit = document.getElementById ('IDC_EDIT_PASSWD');

// alert (aPWEdit.style.visibility);

		if (aPWEdit.style.visibility == "visible")
		{
			ZA_UtilsShowOrHideLogin ("hide");
		}
		else
		{
			aPWEdit.show();
			
			ZA_UtilsShowOrHideLogin ("show");
			
			var aUserEdit = document.getElementById ('IDC_EDIT_USERID');
			aUserEdit.focus();
		}		
	}
	else if (aObjId == "IDC_SHOW_LAN")
	{
		var aLanCB = document.getElementById ('IDC_CB_LANGUAGE');
		
// alert (aLanCB.style.visibility);
		
		if (aLanCB.style.visibility == "visible")
		{
			aLanCB.style.visibility = "hidden";
		}
		else
		{
			aLanCB.style.visibility = "visible"
			ZA_UtilsShowOrHideLogin ("hide");
		}
		
	}
	else if (aObjId == "IDC_SHOW_OPT")
	{
		var aMenu = dialog['IDC_MENU'];
		
 // alert (aMenu.element.style.visibility);
 
 		if (aMenu.element.style.visibility == "hidden")
 		{
 			ZA_UtilsShowOrHideLogin ("hide");
			aMenu.element.style.visibility = "visible"
 			aMenu.show();
 		}
 		else
 		{
  			aMenu.element.style.visibility = "hidden"
			aMenu.hide();
 		}
 	}
	else if (aObjId == "IDC_HELP")
	{
		// Position in den Tab-Reitern bestimmen

		var aTabCntrl = dialog['IDC_ZA_TABS'];
		var selTab = aTabCntrl.getSelected();
		var selSubTab = "";

		if (selTab == "IDC_TAB_DETAILS")
		{
			var aSubTabCntrl = dialog['IDC_TC_DETAILS'];
			selSubTab = aSubTabCntrl.getSelected();
		}

		// Einsprung-URL bestimmen
		strHelpFileUrl = document.getElementById ('HELP_FILE_URL').value;
				
		strURL = strHelpFileUrl + "#" + selTab;
		if (selSubTab != "")
		{
			strURL += "_" + selSubTab;
		}

		// Korrektur BTS 0009225: Hilfe-PopUp nicht variabel
		self.open(strURL, "FANselect", "width=640 height=530 toolbar=yes scrollbars=yes resizable=yes");
	}
	else if (aObjId == "IDC_AGB_TEXT")
	{
		strURL = document.getElementById ('AGB_FILE_URL').value;
		self.open(strURL, "FANselect", "width=640 height=530 toolbar=yes scrollbars=yes resizable=yes");
	}
}

function ZA_UtilsNavigation (aObj)
{
	var aObjId = aObj.id;

	// Feststellen, wo wir uns befinden
	var aTabCntrl = dialog['IDC_ZA_TABS'];
	var selTab = aTabCntrl.getSelected();

	if (selTab == "IDC_TAB_PRODUKTSPEKTRUM")
	{
		if (aObjId == "IDC_BACK")
		{
				ekSubmit(aObjId);
		}
		else if (aObjId == "IDC_NEXT")
		{
			// Auslesen der selektierten Baureihen
			
			// Weiter mit Ventilatorauswahl
			ZA_UtilsNavigationGoTo ("IDC_TAB_VENTILATORAUSWAHL", "");
		}
	}
	else if (selTab == "IDC_TAB_VENTILATORAUSWAHL")
	{
		if (aObjId == "IDC_BACK")
		{
			ZA_UtilsNavigationGoTo ("IDC_TAB_PRODUKTSPEKTRUM", "");
		}
		else if (aObjId == "IDC_NEXT")
		{
			ZA_UtilsNavigationGoTo ("IDC_TAB_DETAILS", "IDC_TAB_KENNLINIE");
		}
	}
	else if (selTab == "IDC_TAB_DETAILS")
	{
		if (aObjId == "IDC_BACK")
		{
			ZA_UtilsNavigationGoTo ("IDC_TAB_VENTILATORAUSWAHL", "");
		}
		else if (aObjId == "IDC_NEXT")
		{
			ZA_UtilsNavigationGoTo ("IDC_TAB_ZUBEHOER", "");
		}
	}
	else if (selTab == "IDC_TAB_VERGLEICH")
	{
		if (aObjId == "IDC_BACK")
		{
			ZA_UtilsNavigationGoTo ("IDC_TAB_DETAILS", "");
		}
		else if (aObjId == "IDC_NEXT")
		{
			ZA_UtilsNavigationGoTo ("IDC_TAB_ZUBEHOER", "");
		}
	}
	else if (selTab == "IDC_TAB_ZUBEHOER")
	{
		if (aObjId == "IDC_BACK")
		{
			ZA_UtilsNavigationGoTo ("IDC_TAB_DETAILS", "");
		}
		else if (aObjId == "IDC_NEXT")
		{
			ZA_UtilsNavigationGoTo ("IDC_TAB_AUSGABE", "");
		}
	}
	else if (selTab == "IDC_TAB_AUSGABE")
	{
		if (aObjId == "IDC_BACK")
		{
			ZA_UtilsNavigationGoTo ("IDC_TAB_ZUBEHOER", "");
		}
	}
}


function ZA_UtilsDelayedNavigationGoTo (strTabId, strSubTabId, strSubTabInfo)
{
	strTabId = "IDC_TAB_DETAILS";
	strSubTabId = "IDC_TAB_KENNLINIE";
	setTimeout("ZA_UtilsCheckNavigationGoTo('" + strTabId + "', '" + strSubTabId + "', '" + strSubTabInfo + "')", 100);
}

function ZA_UtilsCheckNavigationGoTo (strTabId, strSubTabId, strSubTabInfo)
{
	if (ZA_IsDisabledZA02Table())
		return;
	ZA_UtilsNavigationGoTo (strTabId, strSubTabId, strSubTabInfo);
}


function ZA_UtilsNavigationGoTo (strTabId, strSubTabId, strSubTabInfo)
{
	var aTabCntrl = dialog['IDC_ZA_TABS'];
	aTabCntrl.switchTab (strTabId);
	var strTitle = "FANselect " + document.getElementById(strTabId).getAttribute('text');
	var strChartState = "", strChartId = "";

	if (strTabId == "IDC_TAB_PRODUKTSPEKTRUM")
	{
		strSrc = "EKImage/iPW_image_Vpro.png";
		document.getElementById('LOGO_UNTEN').src = strSrc;
	}

	if (strTabId == "IDC_TAB_VENTILATORAUSWAHL")
	{
		strSrc = "EKImage/iPW_image_ZA.png";
		document.getElementById('LOGO_UNTEN').src = strSrc;
	}

	if (strTabId == "IDC_TAB_DETAILS")
	{
		strSrc = "EKImage/iPW_image_FN.png";
		document.getElementById('LOGO_UNTEN').src = strSrc;

		ZA_UtilsNavigationCheckTrefferliste ();
		
		var aSubTabCntrl = dialog['IDC_TC_DETAILS'];
		
		if (strSubTabId != "")
		{
			aSubTabCntrl.switchTab (strSubTabId);

			strButtonId = (strSubTabId == "IDC_TAB_KENNLINIE") ? "IDC_DET_KL" : 
						  (strSubTabId == "IDC_TAB_KENNLINIE_SIZED") ? "IDC_DET_KL" : 
						  (strSubTabId == "IDC_TAB_LCC") ? "IDC_DET_LCC" : 
						  (strSubTabId == "IDC_TAB_MASSBLATT") ? "IDC_DET_MASSBL" : 
						  (strSubTabId == "IDC_TAB_STEMPELDATEN") ? "IDC_DET_STEMPELDATEN" : "";

			if (strButtonId != "")
			{
				strTitle += " " + document.getElementById(strButtonId).getAttribute('text');
			}
			
			if (strSubTabId == "IDC_TAB_KENNLINIE_SIZED") {
				strChartId = strSubTabInfo;
				strChartState = "SIZED";
			}
		}
	}

	if (strTabId == "IDC_TAB_ZUBEHOER" || strTabId == "IDC_TAB_AUSGABE")
	{
		ZA_UtilsNavigationCheckTrefferliste ();
	}

	document.title = strTitle;
	
	if (strChartState == "" || (strChartState == "SIZED" && strChartId != ""))
	{
		document.getElementById('*.DV.DETAILS.CHART_ID').value = strChartId;
		document.getElementById('*.DV.DETAILS.CHART_STATE').value = strChartState;
	}

ZA_UtilsNavigationInitTabPage (strTabId, strSubTabId);
}


var g_lastNavigationTabId, g_lastNavigationSubTabId;

function ZA_UtilsNavigationInitTabPage (strTabId, strSubTabId)
{

	document.getElementById ('IDC_BACK').show();
	document.getElementById ('IDC_NEXT').show();

	if (strTabId == "IDC_TAB_PRODUKTSPEKTRUM")
	{
		// Details laden, falls notwendig
		var aFlag = document.getElementById ('FLAG_ZA01_TABLE_LOADET');

		if (aFlag.value != "true")
		{
			aFlag.value = "true";
			ekSubmit("IDC_ZA01_TAB_RELOAD", "isyiframe");
		}
	}

	if (strTabId == "IDC_TAB_VENTILATORAUSWAHL")
	{
		// Auswahl neu laden, falls notwendig
		var aFlag = document.getElementById ('FLAG_SELECTED_BAUREIHE_CHANGED');

		if (aFlag.value != "false")
		{
			aFlag.value = "false";

			strGruppenId = document.getElementById ('ID_SELECTED_GRUPPE').value;
			strIdsBR = document.getElementById ('ID_SELECTED_BAUREIHE').value;

			createNewHiddenFormField('EKSUBMITEVENTPAR', strGruppenId);
			createNewHiddenFormField('EKSUBMITEVENTPAR1', strIdsBR);
			createNewHiddenFormField('EKSUBMITEVENTPAR2', "RESET");
			ekSubmit("IDC_ZA02_INIT", "isyiframe");
		}
	}

	if (strTabId == "IDC_TAB_DETAILS")
	{
		var aFlag = document.getElementById ('FLAG_DETAILS_LOADET');
		var aFlag1 = document.getElementById ('FLAG_IS_VERGLEICH');

		// BTS 0008571: ID 235 (M4): Bei Vergleich soll der Betriebspunkt unter der Typentabelle unsichbar gemacht werden
		strBPVisible = (aFlag1.value == "true") ? "hidden" : "visible";
		parent.document.getElementById('IDC_DETAILS_QV').style.visibility = strBPVisible;
		parent.document.getElementById('IDC_DETAILS_PSF').style.visibility = strBPVisible;
		parent.document.getElementById('IDC_CB_QV').style.visibility = strBPVisible;
		parent.document.getElementById('IDC_CB_PSF').style.visibility = strBPVisible;
		parent.document.getElementById('IDC_EDIT_QV').style.visibility = strBPVisible;
		parent.document.getElementById('IDC_EDIT_PSF').style.visibility = strBPVisible;
		
		if (aFlag.value != "true")
		{
			aFlag.value = "true";
			
			if (aFlag1.value == "true")
			{
				aFlag1.value == "";

				parent.document.getElementById ('FLAG_DETAILS_LOADET').value = "true";
				parent.document.getElementById ('FLAG_AUSGABE_LOADET').value = "true";
				parent.document.getElementById ('FLAG_ZUBEHOER_LOADET').value = "true";

				// Sonderfall Laden nach Sprachumschaltung
				createNewHiddenFormField('EKSUBMITEVENTPAR', "");
				ekSubmit('IDC_LOAD_DETAILS_BY_LCC_IDS', "isyiframe");
			}
			else
			{
				createNewHiddenFormField('EKSUBMITEVENTPAR', document.getElementById ('INDEX_LAST_SELECTED_TREFFER').value);
				ekSubmit('IDC_LOAD_DETAILS_BY_VENT_INDEX', "isyiframe");
			}
			return;
		}
		/*else if (g_lastNavigationTabId == "IDC_TAB_VENTILATORAUSWAHL")
		{
			createNewHiddenFormField('EKSUBMITEVENTPAR', document.getElementById ('INDEX_LAST_SELECTED_TREFFER').value);
			ekSubmit('IDC_LOAD_DETAILS_BY_VENT_INDEX', "isyiframe");
		}*/
		
		document.getElementById ('IDC_SFP').hide();
		document.getElementById ('IDC_USKL').hide();
		document.getElementById ('IDC_CB_MODE').hide();
	}

	if (strTabId == "IDC_TAB_ZUBEHOER")
	{
		var aFlag = document.getElementById ('FLAG_ZUBEHOER_LOADET');
		var aFlag1 = document.getElementById ('FLAG_IS_VERGLEICH');

		if (aFlag.value != "true" && aFlag1.value != "true")
		{
			aFlag.value = "true";
			createNewHiddenFormField('EKSUBMITEVENTPAR', document.getElementById ('INDEX_LAST_SELECTED_TREFFER').value);
			ekSubmit("IDC_INIT_ZUBEHOER", "isyiframe");
		}
		else
		{
			ekSubmit("IDC_SHOW_ZUBEHOER", "isyiframe");
		}
	}

	if (strTabId == "IDC_TAB_AUSGABE")
	{
		var aFlagA = document.getElementById ('FLAG_AUSGABE_LOADET');
		var aFlagV = document.getElementById ('FLAG_IS_VERGLEICH');
		var aFlagKL = document.getElementById ('FLAG_KENNLINIE_LOADET');
		var eventOld = document.getElementById ('EKSUBMITEVENT').value;

		document.getElementById ('IDC_NEXT').hide();

		if (/*aFlagA.value != "true" &&*/ aFlagV.value != "true" &&
			eventOld != "IDC_INIT_AUSGABE_BY_MERKLIST_IDS")
		{
			aFlagA.value = "true";
			
			var sParam = (aFlagKL.value == "true") ? 'DETAILS' :  // BP aus Detailansicht uebernehmen.
				document.getElementById ('INDEX_LAST_SELECTED_TREFFER').value;
			
			createNewHiddenFormField('EKSUBMITEVENTPAR', sParam);
			ekSubmit("IDC_INIT_AUSGABE", "isyiframe");
		}
		else
		{
			ekSubmit("IDC_SHOW_AUSGABE", "isyiframe");
		}
	}

	if (strTabId == "IDC_TAB_DETAILS")
	{

	  	strBGColNormal = "RGB(220,228,237)";
	  	strTXColNormal = "RGB(0,75,138)";

  		strBGColHilite = "RGB(0,75,138)";
  		strTXColHilite = "RGB(220,228,237)";

		document.getElementById ('IDC_DET_KL').style.backgroundColor = strBGColNormal;
		document.getElementById ('IDC_DET_KL').style.color = strTXColNormal;

		document.getElementById ('IDC_DET_LCC').style.backgroundColor = strBGColNormal;
		document.getElementById ('IDC_DET_LCC').style.color = strTXColNormal;

		document.getElementById ('IDC_DET_MASSBL').style.backgroundColor = strBGColNormal;
		document.getElementById ('IDC_DET_MASSBL').style.color = strTXColNormal;

		document.getElementById ('IDC_DET_STEMPELDATEN').style.backgroundColor = strBGColNormal;
		document.getElementById ('IDC_DET_STEMPELDATEN').style.color = strTXColNormal;

		strButtonId = (strSubTabId == "IDC_TAB_KENNLINIE" || strSubTabId == "IDC_TAB_KENNLINIE_SIZED") ? "IDC_DET_KL" :
					  (strSubTabId == "IDC_TAB_LCC") ? "IDC_DET_LCC" :
					  (strSubTabId == "IDC_TAB_MASSBLATT") ? "IDC_DET_MASSBL" :
					  (strSubTabId == "IDC_TAB_STEMPELDATEN") ? "IDC_DET_STEMPELDATEN" : "";

		if (strButtonId != "")
		{
			document.getElementById (strButtonId).style.backgroundColor = strBGColHilite;
			document.getElementById (strButtonId).style.color = strTXColHilite;
		}		
	}

	if (strTabId == "IDC_TAB_DETAILS" && strSubTabId == "IDC_TAB_MASSBLATT")
	{
		// Massblatt laden, falls notwendig
		var aFlag = document.getElementById ('FLAG_MASSBLATT_LOADET');
		
		if (aFlag.value != "true")
		{
			aFlag.value = "true";

			dialog["IDC_TC_DETAILS"].switchTab("IDC_TAB_KENNLINIE_SIZED");
			dialog["IDC_TC_DETAILS"].switchTab("IDC_TAB_MASSBLATT");

			createNewHiddenFormField('EKSUBMITEVENTPAR', document.getElementById ('INDEX_LAST_SELECTED_TREFFER').value);
			ekSubmit('IDC_LOAD_MASSBLATT', "isyiframe");
		}
		
		dDetFTLine = document.getElementById ('IDC_DETAILS_TYPE_TABLE_FT');
		
		if (dDetFTLine)
		{
			dDetFTLine.hide();
		}
	}
	else if (strTabId == "IDC_TAB_DETAILS" && strSubTabId == "IDC_TAB_KENNLINIE")
	{
		// Kennlinie laden, falls notwendig
		var aFlag = document.getElementById ('FLAG_KENNLINIE_LOADET');

		if (aFlag.value != "true")
		{
			aFlag.value = "true";

			// BTS 0008033 : Eingabefelder bei LCC-Vergleich
			// Workaround, Ursache ist bislang noch unbekannt
			dialog["IDC_TC_DETAILS"].switchTab("IDC_TAB_KENNLINIE_SIZED");
			dialog["IDC_TC_DETAILS"].switchTab("IDC_TAB_KENNLINIE");

			ZAU_SubmitASync('IDC_LOAD_KENNLINIE', document.getElementById('INDEX_LAST_SELECTED_TREFFER').value);
		}

		dDetFTLine = document.getElementById ('IDC_DETAILS_TYPE_TABLE_FT');
		
		if (dDetFTLine)
		{
			dDetFTLine.hide();
		}
		
		document.getElementById ('IDC_SFP').show();

		strHiVoPCVisible = document.getElementById ('ZABK_HIVOPC_VISIBLE').value;
		strSplineVisible = document.getElementById ('ZABK_SPLINE_VISIBLE').value;
		
		if (strHiVoPCVisible == "visible")
		{
			document.getElementById ('IDC_USKL').show();
		}

		if (strSplineVisible == "visible")
		{
			document.getElementById ('IDC_CB_MODE').show();
		}

	}
	else if (strTabId == "IDC_TAB_DETAILS" && strSubTabId == "IDC_TAB_LCC")
	{
		// LCC Typenliste laden, falls notwendig
		var aFlag = document.getElementById ('FLAG_LCC_LOADET');
		
		if (aFlag.value != "true")
		{
			aFlag.value = "true";

			ekSubmit('IDC_SHOW_LCC', "isyiframe");
		}

		dDetFTLine = document.getElementById ('IDC_DETAILS_TYPE_TABLE_FT');
		
		if (dDetFTLine)
		{
			dDetFTLine.show();
		}
	}
	else if (strTabId == "IDC_TAB_DETAILS" && strSubTabId == "IDC_TAB_STEMPELDATEN")
	{
		// Stempeldaten laden, falls notwendig
		var aFlag = document.getElementById ('FLAG_STEMPELDATEN_LOADET');
		
		if (aFlag.value != "true")
		{
			aFlag.value = "true";

			ekSubmit('IDC_LOAD_STEMPELDATEN', "isyiframe");
		}

		dDetFTLine = document.getElementById ('IDC_DETAILS_TYPE_TABLE_FT');

		if (dDetFTLine)
		{
			dDetFTLine.hide();
		}
	}
	else if (strTabId == "IDC_TAB_DETAILS" && strSubTabId == "IDC_TAB_KENNLINIE_SIZED")
	{
		// Grosse Darstellung der Kennlinie
		// Hier sollte man sich noch merken. welche Darstellung gewünscht wird
		document.getElementById ('IDC_BACK').hide();
		document.getElementById ('IDC_NEXT').hide();

		document.getElementById ('IDC_SFP').show();

		strHiVoPCVisible = document.getElementById ('ZABK_HIVOPC_VISIBLE').value;
		strSplineVisible = document.getElementById ('ZABK_SPLINE_VISIBLE').value;
		
		if (strHiVoPCVisible == "visible")
		{
			document.getElementById ('IDC_USKL').show();
		}

		if (strSplineVisible == "visible")
		{
			document.getElementById ('IDC_CB_MODE').show();
		}

		ZAU_SubmitASync('IDC_LOAD_KENNLINIE_SIZED');
	}
	
	g_lastNavigationTabId = strTabId;
	g_lastNavigationSubTabId = strSubTabId;
}

function ZA_UtilsNavigationCheckTrefferliste ()
{
	var aFlag = document.getElementById ('FLAG_ZA02_TABLE_LOADET');

	if (aFlag.value == "true")
	{
		// Selektierten Typ bestimmen
		var selected = ZA_GetSelectedZA02Table();

		if (selected)
		{
			var aIndex = document.getElementById ('INDEX_LAST_SELECTED_TREFFER').value;
	
			var objRow = $(selected);
			var strUserData = objRow.getAttribute('userdata');
	
			if (aIndex != strUserData)
			{
				document.getElementById ('INDEX_LAST_SELECTED_TREFFER').value = strUserData;
				
				document.getElementById ('FLAG_DETAILS_LOADET').value = "false";
				document.getElementById ('FLAG_AUSGABE_LOADET').value = "false";
				document.getElementById ('FLAG_ZUBEHOER_LOADET').value = "false";
				document.getElementById ('FLAG_KENNLINIE_LOADET').value = "false";
				document.getElementById ('FLAG_STEMPELDATEN_LOADET').value = "false";
				document.getElementById ('FLAG_MASSBLATT_LOADET').value = "false";					
				document.getElementById ('FLAG_LCC_LOADET').value = "false";					

				document.getElementById ('FLAG_IS_VERGLEICH').value = "false";					
			}
		}
		else
		{
			document.getElementById ('INDEX_LAST_SELECTED_TREFFER').value = "";
			
			document.getElementById ('FLAG_DETAILS_LOADET').value = "true";
			document.getElementById ('FLAG_KENNLINIE_LOADET').value = "false";
			document.getElementById ('FLAG_MASSBLATT_LOADET').value = "false";					
			document.getElementById ('FLAG_STEMPELDATEN_LOADET').value = "false";
			document.getElementById ('FLAG_LCC_LOADET').value = "false";					
		}
	}
}



function ZA_UtilsNavigationRefreshDetails ()
{
	var aTabCntrl = dialog['IDC_ZA_TABS'];
	var selTab = aTabCntrl.getSelected();

	var aSubTabCntrl = dialog['IDC_TC_DETAILS'];
	var selSubTab = aSubTabCntrl.getSelected();

	if (selTab == "IDC_TAB_DETAILS")
	{
		document.getElementById ('FLAG_KENNLINIE_LOADET').value = "false";
		document.getElementById ('FLAG_LCC_LOADET').value = "false";
		document.getElementById ('FLAG_MASSBLATT_LOADET').value = "false";					
		document.getElementById ('FLAG_STEMPELDATEN_LOADET').value = "false";

		ZA_UtilsNavigationInitTabPage (selTab, selSubTab);
	}
}

function ZA_UtilsUpdateTrefferListe ()
{
	document.getElementById ('INDEX_LAST_SELECTED_TREFFER').value = "";

	document.getElementById ("IDC_ZA02_GB_WAB").style.visibility="hidden"
	dialog["IDC_ZA02_WAB_TABLE"].hide();
	dialog["IDC_ZA02_BAU_TABLE"].hide();
	dialog["IDC_LIST_EMPTY"].hide();

	ZA_DisableZA02Table();
	ZA_UtilsShowWaitAnim ();
		
	ekSubmit('IDC_ZA02_UPDATE_LIST', "isyiframe");
}

function ZA_UtilsShowWaitAnim ()
{
	document.getElementById ('IDC_WAIT_ANIM').style.visibility="visible";

	// Grafik soll über der Tabelle liegen
	var nZindex = parseInt(document.getElementById ('IDC_ZA02_TABLE').style.zIndex);
	nZindex++;
	document.getElementById ('IDC_WAIT_ANIM').style.zIndex = nZindex;
}

function ZA_UtilsHideWaitAnim ()
{
	document.getElementById ('IDC_WAIT_ANIM').style.visibility="hidden";
}

function ZA_UtilsButtonEvent (aObj)
{
// alert (aObj.id);

	if (aObj.id == "IDC_SEARCH")
	{
		var strOptionen = "";
	
		strOptionen += ZA_UtilsCollectEditValues ("IDC_ZA02_BP_TABLE");
		strOptionen += ZA_UtilsCollectEditValues ("IDC_ZA02_WAB_TABLE");
	
		// strOptionen += "MT_RESERVE=" + document.getElementById('IDC_ZA01_ED_MR').value + ";";
		// strOptionen += "LL_RESERVE=" + document.getElementById('IDC_ZA01_ED_LL').value + ";";
		strOptionen += "SUCHTOLERANZ=" + document.getElementById('IDC_ZA01_ED_ST').value + ";";
	
		// strOptionen += "MT_TYPE_CB=" + document.getElementById('IDC_ZA01_CB_MR').value + ";";
		// strOptionen += "LL_TYPE_CB=" + document.getElementById('IDC_ZA01_CB_LL').value + ";";
		strOptionen += "ST_TYPE_CB=" + document.getElementById('IDC_ZA01_CB_ST').value + ";";
		if (document.getElementById('ZA_BG_COMP'))
		{
			strOptionen += "ZA_BG_COMP_VALUE=" + document.getElementById('ZA_BG_COMP').value + ";";
		}

		ZAU_HiliteVorauswahlButtons ("");
		
		ZAU_SubmitASync("IDC_ZA02_SHOW_INFO_AND_UPDATE_LIST", strOptionen);
	}
}


function ZA_UtilsCollectEditValues (strID)
{
	strResult = "";
	
	var aTable = dialog[strID];	
	for (var i = 0; i < aTable.element.rows.length; ++i)
	{
		var strId = aTable.element.rows[i].getAttribute('id');

		strPrefix = strID + "_";

		strAttribut = strId.replace (strPrefix, "");

 
//		alert (strId);
//		alert (strAttribut);

		aEditObj = document.getElementById (strAttribut + "_EDIT");
		aUnitObj = document.getElementById (strAttribut + "_UNIT");
		strEditValue = "";
		strUnitValue = "";
		
		// Zuerst die Einheit, dann der Wert
		if (aUnitObj)
		{
			strUnitValue = aUnitObj.value;
			strResult += strAttribut + "_UNIT=" + strUnitValue + ";"
		}

		if (aEditObj)
		{
			strEditValue = aEditObj.value;
			
			strResult += strAttribut + "_VALUE=" + strEditValue + ";"
		}
	}	

	return (strResult);
}



var ZoomIn=false;
var ZoomOut=false;

function ZAU_StartAnimImage (aObj)
{

	if (aObj.id == "AXIAL_BILD")
	{
		// Animiert
		aObj.src = "EKImage/product-group-axial-animiert.gif";
	}
	else if (aObj.id == "RADIAL_BILD")
	{		
		ZoomOut = true;

		strTimeOut = "ZAU_Zoom ();";
		setTimeout(strTimeOut, 10);
	}
	else if (aObj.id == "AXIAL_BILD1" || aObj.id == "RADIAL_BILD1")
	{		
		// Fest Vergrößert
		ZAU_ZoomSimple (aObj, 30, 30)
	}		
	else if (aObj.id == "AXIAL_BILD2")
	{		
		// Bunt
		aObj.src = "EKImage/product-group-axial.gif";
	}		
	else if (aObj.id == "RADIAL_BILD2")
	{		
		// Bunt
		aObj.src = "EKImage/product-group-centrifugal.gif";
	}		

}

function ZAU_StopAnimImage (aObj)
{

	if (aObj.id == "AXIAL_BILD")
	{
		aObj.src = "EKImage/product-group-axial.gif";
	}
	else if (aObj.id == "RADIAL_BILD")
	{
		ZoomIn = true;
		
		if (ZoomOut)
		{
			ZoomOut = false;
		}
		else
		{
			strTimeOut = "ZAU_Zoom ();";
			setTimeout(strTimeOut, 10);
		}
	}
	else if (aObj.id == "AXIAL_BILD1" || aObj.id == "RADIAL_BILD1")
	{
		// Fest Verkleinern
		ZAU_ZoomSimple (aObj, -30, -30)
	}	
	else if (aObj.id == "AXIAL_BILD2")
	{		
		// SW
		aObj.src = "EKImage/product-group-axial_SW.gif";
	}		
	else if (aObj.id == "RADIAL_BILD2")
	{		
		// SW
		aObj.src = "EKImage/product-group-centrifugal_SW.gif";
	}		
}

function ZAU_ZoomSimple (aObj, dWidthDiff, dHeightDiff)
{
	dWidth = parseInt (aObj.style.width);
	dHeight = parseInt (aObj.style.height);
	dLeft = parseInt (aObj.style.left);
	dTop = parseInt (aObj.style.top);

	dCenterX = dLeft + dWidth/2;
	dCenterY = dTop + dHeight/2;

	dWidth += dWidthDiff;
	dHeight += dHeightDiff;
	
	dLeft = dCenterX - dWidth/2;
	dTop = dCenterY - dHeight/2;
		
	aObj.style.width = dWidth + "px";
	aObj.style.height = dHeight + "px";
	aObj.style.left = dLeft + "px";
	aObj.style.top = dTop + "px";
}


function ZAU_Zoom ()
{
	aObj = document.getElementById('RADIAL_BILD');
	
	dWidth = parseInt (aObj.style.width);
	dHeight = parseInt (aObj.style.height);

	dLeftCenter = 792;
	dTopCenter = 445;
	
	dWidthMax = 306;
	dWidthMin = 153;
	dHeightMax = 300;
	dHeightMin = 150;

	dLeftCenter = 717;
	dTopCenter = 300;

	if (ZoomOut && dWidth == dWidthMin)
	{
		// Kurz kleiner machen, sieht besser aus
		dWidth -= 6;
		dHeight -= 6;
		dLeft = dLeftCenter - dWidth/2;
		dTop = dTopCenter - dHeight/2;
	
		aObj.style.width = dWidth + "px";
		aObj.style.height = dHeight + "px";
		aObj.style.left = dLeft + "px";
		aObj.style.top = dTop + "px";

		strTimeOut = "ZAU_Zoom ();";
		setTimeout(strTimeOut, 150);
	}
	else if (ZoomOut && dWidth < dWidthMax)
	{
		dWidth += 8;
		dHeight += 8;
		dLeft = dLeftCenter - dWidth/2;
		dTop = dTopCenter - dHeight/2;
	
		aObj.style.width = dWidth + "px";
		aObj.style.height = dHeight + "px";
		aObj.style.left = dLeft + "px";
		aObj.style.top = dTop + "px";

		strTimeOut = "ZAU_Zoom ();";
		setTimeout(strTimeOut, 10);
	}
	else if (ZoomOut && dWidth >= dWidthMax)
	{
		dWidth = dWidthMax;
		dHeight = dHeightMax;
		dLeft = dLeftCenter - dWidth/2;
		dTop = dTopCenter - dHeight/2;
	
		aObj.style.width = dWidth + "px";
		aObj.style.height = dHeight + "px";
		aObj.style.left = dLeft + "px";
		aObj.style.top = dTop + "px";

		ZoomOut = false;
	}
	else if (ZoomIn && dWidth > dWidthMin)
	{
		dWidth -= 16;
		dHeight -= 16;
		dLeft = dLeftCenter - dWidth/2;
		dTop = dTopCenter - dHeight/2;
	
		aObj.style.width = dWidth + "px";
		aObj.style.height = dHeight + "px";
		aObj.style.left = dLeft + "px";
		aObj.style.top = dTop + "px";

		strTimeOut = "ZAU_Zoom ();";
		setTimeout(strTimeOut, 10);
	}
	else if (ZoomIn && dWidth <= dWidthMin)
	{
		dWidth = dWidthMin;
		dHeight = dHeightMin;
		dLeft = dLeftCenter - dWidth/2;
		dTop = dTopCenter - dHeight/2;
	
		aObj.style.width = dWidth + "px";
		aObj.style.height = dHeight + "px";
		aObj.style.left = dLeft + "px";
		aObj.style.top = dTop + "px";

		ZoomIn = false;
	}
}
