
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;
	}
}


if(typeof addPostParam == 'undefined') {
	addPostParam = function(sParams, sParamName, sParamValue)
	{
		if (sParams.length > 0) {
			sParams += "&";
		}
		return sParams + encodeURIComponent(sParamName) + "=" + encodeURIComponent(sParamValue);
	}
}


if(typeof getEl == 'undefined') {
	getEl = function(_ref)
	{
		var ref = _ref || window.event;
		var obj = null;
		
		if (typeof ref == 'object') {
			if (ref.tagName)
				obj = ref;
			else if (ref.target) {
				obj = ref.target.tagName ? ref.target : ref.target.parentNode;
			}
			else if (ref.srcElement) {
				obj = ref.srcElement.tagName ? ref.srcElement : ref.srcElement.parentNode;
			}
		}
		else if (typeof ref == 'string') {
			obj = document.getElementById(ref);
		}
		return obj;
	}
}


if(typeof createInputField == 'undefined') {
	createInputField = function(sType, sName, sValue)
	{
		var oField = document.createElement('input');
		oField.type = sType;
		if (sName) {
			oField.id = sName;
			oField.name = sName;
		}
		if (sValue) {
			oField.value = sValue;
		}
		return oField;
	}
}



// Alle 3min einen Mini-Request zum Server schicken um einen Session Timeout
// zu verhindern und damit der Server erkennt wann das Browser Fenster geschlossen wurde.
var gKeepAliveCount = 0;

function KeepSessionAlive() {
	try 
	{
		var oRequest = GetXMLHttp();
		var bReqAsync = true;
		
		var form = document.forms[0];
		var sUrl = form.action + "?xmlhttpreq=KeepAlive";
		var sPost = addPostParam("", "sessionid", getEl("sessionid").value);
		sPost = addPostParam(sPost, "reqcount", gKeepAliveCount++);
		
		oRequest.open("post", sUrl, bReqAsync);
		oRequest.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
		
		if (!bReqAsync)	// Synchroner Request: Senden und auf Antwort warten.
		{
			oRequest.send(sPost);

			if(oRequest.status == 200) {
				if (oRequest.responseText == "") {
					//alert("Session abgelaufen/ungueltig");
				}
			}
		}
		else			// Asynchroner Request: Senden und direkt weiter im Script.
		{
			oRequest.onreadystatechange = function()
			{
				if (oRequest.readyState == 4 && oRequest.status == 200) {
					if (oRequest.responseText == "") {
						//alert("Session abgelaufen/ungueltig");
					}
				}
			}
			
			oRequest.send(sPost);
		}
	}
	catch (e) {
		//alert(e.message);
	}

	setTimeout("KeepSessionAlive()", 180 * 1000);
}


if (gKeepAliveCount == 0) {
	gKeepAliveCount++;
	
	if (!ek_appmode || ek_appmode != 'ek_cdrom') {
		setTimeout("KeepSessionAlive()", 60 * 1000);
	}
}




function myRuntimeStyle(obj)
{
	if(typeof getComputedStyle == 'function')
	{	// Mozilla, Firefox, ...
		return document.defaultView.getComputedStyle(obj,null);
	}
	else
	{	// IE
		return obj.currentStyle;
	}
}


function findPosX(obj) {
	var curleft = 0;
	if(obj && obj.offsetParent)
		while(1) {
		  curleft += obj.offsetLeft;
		  if(!obj.offsetParent)
			break;
		  obj = obj.offsetParent;
		}
	else if(obj.x)
		curleft += obj.x;
	return curleft;
}

function findPosY(obj) {
	var curtop = 0;
	if(obj && obj.offsetParent)
		while(1)
		{
		  curtop += obj.offsetTop;
		  if(!obj.offsetParent)
			break;
		  obj = obj.offsetParent;
		}
	else if(obj.y)
		curtop += obj.y;
	return curtop;
}


function getDecFromUnitCombo(cbId)
{
	var oCB = getEl(cbId);
	if (!oCB || oCB.nodeName != "SELECT")
		return 0;
		
	var unitId = oCB[oCB.selectedIndex].value;
	
	switch (unitId)
	{
	// Druck (ZA_PRESS)
	case "ZA_PA":	return 0;
	case "ZA_MMWS":	return 2;
	case "ZA_INWG":	return 3;
	
	// Volumenstrom (ZA_VOLFLO)
	case "ZA_M3S":	return 2;
	case "ZA_M3M":	return 1;
	case "ZA_M3H":	return 0;
	case "ZA_LPS":	return 2;
	case "ZA_LPM":	return 1;
	case "ZA_LPH":	return 1;
	case "ZA_CFM":	return 1;
	
	default:		return 0;
	}
}


function IsKennlinienVergleich(obj)
{
	var oIsVergleich = !obj ? null : getEl(obj.id + '_VERGLEICH');
	var bVergl = oIsVergleich && oIsVergleich.value == "true";
	return bVergl;
}


// Graphical Functions

function ShowCrosshair(evt, leftMg, rightMg, topMg, bottomMg) {
	var oImg = getEl(evt);
	if (!oImg)
		return;

	var xImg = findPosX(oImg), yImg = findPosY(oImg);
	var wImg = parseInt(oImg.offsetWidth), hImg = parseInt(oImg.offsetHeight);
	var clientX = evt.clientX + document.documentElement.scrollLeft;
	var clientY = evt.clientY + document.documentElement.scrollTop;
	var xPos = clientX - xImg - 1, yPos = clientY - yImg - 1;
	var rCh = 6;

	var oChX1 = getEl(oImg.id + '_CHX1');
	if (oChX1) {
		oChX1.style.left = (oImg.offsetLeft + leftMg) + "px";
		oChX1.style.top = (oImg.offsetTop + yPos) + "px";
		oChX1.style.width = Math.max(xPos - leftMg - rCh, 0) + "px";
		oChX1.style.height = "1px";
		oChX1.style.display = 'inline';
	}

	var oChX2 = getEl(oImg.id + '_CHX2');
	if (oChX2) {
		oChX2.style.left = (oImg.offsetLeft + xPos + rCh) + "px";
		oChX2.style.top = (oImg.offsetTop + yPos) + "px";
		oChX2.style.width = Math.max(wImg - xPos - rightMg - rCh, 0) + "px";
		oChX2.style.height = "1px";
		oChX2.style.display = 'inline';
	}
	
	var oChY1 = getEl(oImg.id + '_CHY1');
	if (oChY1) {
		oChY1.style.left = (oImg.offsetLeft + xPos) + "px";
		oChY1.style.top = (oImg.offsetTop + topMg) + "px";
		oChY1.style.width = "1px";
		oChY1.style.height = Math.max(yPos - topMg - rCh, 0) + "px";
		oChY1.style.display = 'inline';
	}
	
	var oChY2 = getEl(oImg.id + '_CHY2');
	if (oChY2) {
		oChY2.style.left = (oImg.offsetLeft + xPos) + "px";
		oChY2.style.top = (oImg.offsetTop + yPos + rCh) + "px";
		oChY2.style.width = "1px";
		oChY2.style.height = Math.max(hImg - yPos - bottomMg - rCh, 0) + "px";
		oChY2.style.display = 'inline';
	}
}

function HideCrosshair(oImg) {
	if (!oImg)
		return;
	var oChX1, oChX2, oChY1, oChY2;
	
	if (oChX1 = getEl(oImg.id + '_CHX1'))
		oChX1.style.display = 'none';
		
	if (oChX2 = getEl(oImg.id + '_CHX2'))
		oChX2.style.display = 'none';
		
	if (oChY1 = getEl(oImg.id + '_CHY1'))
		oChY1.style.display = 'none';
		
	if (oChY2 = getEl(oImg.id + '_CHY2'))
		oChY2.style.display = 'none';
}


function StartShowCoordinates(_evt) {
	var evt = _evt || window.event;
	var obj = getEl(evt);

	if (IsKennlinienVergleich(obj))
		return;

	var oVolst = getEl("IDC_EDIT_QV"), oDruck = getEl("IDC_EDIT_PSF");
	var oChartId = getEl('*.DV.DETAILS.CHART_ID');
	
	if (oVolst && oDruck && oChartId && (!oChartId.value || oChartId.value == "DRUCK")) {

		if (!oVolst.hasAttribute("savedValue")) {
			oVolst.setAttribute("savedValue", oVolst.value);
			oDruck.setAttribute("savedValue", oDruck.value);
		}
		addEvent(obj, "mousemove", ShowChartCoordinates, false);
	}
}

function StopShowCoordinates(_evt) {
	var evt = _evt || window.event;
	var obj = getEl(evt);
	
	var oChartId = getEl('*.DV.DETAILS.CHART_ID');
	
	if (oChartId && (!oChartId.value || oChartId.value == "DRUCK"))
		ShowChartCoordinates(evt, obj, true);
}


function ShowChartCoordinates(_evt, oImg, removeHandler) {
	var evt = _evt || window.event;
	if (!oImg)
		oImg = getEl(evt);
	if (!oImg)
		return;

	if (oImg.id.indexOf("_CHX") > -1 || oImg.id.indexOf("_CHY") > -1)
		oImg = getEl(oImg.id.substring(0, oImg.id.length - 5));

	var xImg = findPosX(oImg), yImg = findPosY(oImg);
	var wImg = parseInt(oImg.offsetWidth), hImg = parseInt(oImg.offsetHeight);
	var clientX = evt.clientX + document.documentElement.scrollLeft;
	var clientY = evt.clientY + document.documentElement.scrollTop;
	var xPos = clientX - xImg, yPos = clientY - yImg;

	var leftMg = parseInt(getEl(oImg.id + '_LEFT_MARGIN').value);
	var rightMg = parseInt(getEl(oImg.id + '_RIGHT_MARGIN').value);
	var topMg = parseInt(getEl(oImg.id + '_TOP_MARGIN').value);
	var bottomMg = parseInt(getEl(oImg.id + '_BOTTOM_MARGIN').value);

	var maxX = parseFloat(getEl(oImg.id + '_CHART_MAX_X').value);
	var maxY = parseFloat(getEl(oImg.id + '_CHART_MAX_Y').value);

	yPos = hImg - yPos - bottomMg;
	xPos = xPos - leftMg;

	xPos = xPos * (maxX / (wImg - leftMg - rightMg));
	yPos = yPos * (maxY / (hImg - topMg - bottomMg));

	if(yPos >= 0 && xPos >= 0 && yPos <= maxY && xPos <= maxX) {
		var oVolst = getEl("IDC_EDIT_QV"), oDruck = getEl("IDC_EDIT_PSF");
		
		var volstDec = getDecFromUnitCombo("IDC_CB_QV");
		var druckDec = getDecFromUnitCombo("IDC_CB_PSF");

		oVolst.value = xPos.toFixed(volstDec);
		oDruck.value = yPos.toFixed(druckDec);
		
		ShowCrosshair(evt, leftMg, rightMg, topMg, bottomMg);
	}
	else {
		var oVolst = getEl("IDC_EDIT_QV"), oDruck = getEl("IDC_EDIT_PSF");
		var qv = oVolst.getAttribute("savedValue");
		var psf = oDruck.getAttribute("savedValue");

		if (parseFloat(qv) > 0 && parseFloat(psf) > 0) {
			oVolst.value = qv;
			oDruck.value = psf;
		}
		else {
			oVolst.value = "";
			oDruck.value = "";
		}
	
		if (removeHandler) {
			removeEvent(oImg, "mousemove", ShowChartCoordinates, false);
			oVolst.removeAttribute("savedValue");
			oDruck.removeAttribute("savedValue");
		}
		HideCrosshair(oImg);
	}
}


function SubmitCoords(obj)
{
	if (IsKennlinienVergleich(obj)) {
		CheckRestoreDefaultCharts(obj);
		return;
	}

	var oVolst = getEl("IDC_EDIT_QV"), oDruck = getEl("IDC_EDIT_PSF");
	var oChartId = getEl('*.DV.DETAILS.CHART_ID');
	
	if (oVolst && oDruck && oChartId && (!oChartId.value || oChartId.value == "DRUCK")) {
		var xPos = parseFloat(oVolst.value.replace(",", "."));
		var yPos = parseFloat(oDruck.value.replace(",", "."));
		
		var maxX = parseFloat(getEl(obj.id + '_CHART_MAX_X').value);
		var maxY = parseFloat(getEl(obj.id + '_CHART_MAX_Y').value);
		
		//alert("xPos = " + xPos + ", yPos = " + yPos + ", maxX = " + maxX + ", maxY = " + maxY);

		if(yPos >= 0 && xPos >= 0 && yPos <= maxY && xPos <= maxX) {
			var sParam = "{X:" + xPos + ", Y:" + yPos + "}";
			
			HttpReqASync("KENNLINIE_BP_CHANGED", sParam);
		}
	}
	else {
		CheckRestoreDefaultCharts(obj);
	}
}


function OnChartClick(_evt) {
	var evt = _evt || window.event;
	var oImg = getEl(evt);
	
	if (oImg.id.indexOf("_CHX") > -1 || oImg.id.indexOf("_CHY") > -1)
		oImg = getEl(oImg.id.substring(0, oImg.id.length - 5));

	var xImg = findPosX(oImg), yImg = findPosY(oImg);
	var wImg = parseInt(oImg.offsetWidth), hImg = parseInt(oImg.offsetHeight);
	var clientX = evt.clientX + document.documentElement.scrollLeft;
	var clientY = evt.clientY + document.documentElement.scrollTop;
	var xPos = clientX - xImg, yPos = clientY - yImg;

	var leftMg = parseInt(getEl(oImg.id + '_LEFT_MARGIN').value);
	var rightMg = parseInt(getEl(oImg.id + '_RIGHT_MARGIN').value);
	var topMg = parseInt(getEl(oImg.id + '_TOP_MARGIN').value);
	var bottomMg = parseInt(getEl(oImg.id + '_BOTTOM_MARGIN').value);

	var maxX = parseFloat(getEl(oImg.id + '_CHART_MAX_X').value);
	var maxY = parseFloat(getEl(oImg.id + '_CHART_MAX_Y').value);

	yPos = hImg - yPos - bottomMg;
	xPos = xPos - leftMg;

	xPos = xPos * (maxX / (wImg - leftMg - rightMg));
	yPos = yPos * (maxY / (hImg - topMg - bottomMg));
	
	//alert("clientX = " + clientX + ", clientY = " + clientY + ", xImg = " + xImg + ", yImg = " + yImg + ", wImg = " + wImg + ", hImg = " + hImg + ", xPos = " + xPos + ", yPos = " + yPos + ", maxX = " + maxX + ", maxY = " + maxY);

	if (yPos >= 0 && xPos >= 0 && yPos <= maxY && xPos <= maxX) {
		var oVolst = getEl("IDC_EDIT_QV"), oDruck = getEl("IDC_EDIT_PSF");
		
		var volstDec = getDecFromUnitCombo("IDC_CB_QV");
		var druckDec = getDecFromUnitCombo("IDC_CB_PSF");

		oVolst.value = xPos.toFixed(volstDec);
		oDruck.value = yPos.toFixed(druckDec);

		SubmitCoords(oImg);
	}
}


function SubmitOnClickCoords(oImg)
{
	var evt = window.event;
	OnChartClick(evt);
}


function SubmitEditCoords(obj)
{
	var obj = getEl("CHART1");
	SubmitCoords(obj);
}


function UpdateCoords(xPos, yPos)
{
	var oVolst = getEl("IDC_EDIT_QV"), oDruck = getEl("IDC_EDIT_PSF");
	
	if (parseFloat(xPos) > 0 && parseFloat(yPos) > 0) {
		oVolst.setAttribute("savedValue", xPos);
		oDruck.setAttribute("savedValue", yPos);
		
		oVolst.value = xPos;
		oDruck.value = yPos;
	}
	else {
		oVolst.setAttribute("savedValue", "");
		oDruck.setAttribute("savedValue", "");
	
		oVolst.value = "";
		oDruck.value = "";
	}
}



function SetChartOpt(obj, sType, sVal1, sVal2, sVal3)
{
	switch (sType) {
		case "LEISTUNG":
			RedrawChart('', 'DRAW_LEISTUNG_TYP', sVal1);
			break;
		case "WIRKUNGSGRAD":
			RedrawChart('', 'DRAW_WIRKUNGSGRAD_TYP', sVal1);
			break;
		case "AKUSTIK":
			RedrawChart('', 'DRAW_AKUSTIK_TYP', sVal1);
			//RedrawChart('', 'DRAW_AKUSTIK_SEITE', sVal1, 'DRAW_AKUSTIK_BEWERTUNG', sVal2);
	}
}


function SetChartUnit(obj, sName)
{
	if (!obj || obj.nodeName != "SELECT" || obj.selectedIndex < 0)
		return;

	var sUnit = obj[obj.selectedIndex].value;
	RedrawChart("CHANGE_UNIT", sName, sUnit);
}


function RestoreDefaultCharts(obj)
{
	getEl('CHART_SIZED').style.display = "none";
	getEl('CHART2_SIZED').style.display = "none";

	var oChartId = getEl('*.DV.DETAILS.CHART_ID');
	
	if (oChartId && oChartId.value == "DRUCK") {
		ZA_UtilsNavigationGoTo('IDC_TAB_DETAILS', 'IDC_TAB_KENNLINIE');
		HttpReqASync("KENNLINIE_RESTORE");
	}
	else {
		ZA_UtilsNavigationGoTo('IDC_TAB_DETAILS', 'IDC_TAB_KENNLINIE');
		RedrawChart('');
	}
}

function CheckRestoreDefaultCharts(obj)
{
	if (obj && obj.id && obj.id.indexOf("_SIZED") > -1) {
		var oChartId = getEl('*.DV.DETAILS.CHART_ID');

		if (oChartId.value != "DRUCK")
			RestoreDefaultCharts(obj);
	}
}


function RedrawChart(sCmd, sId1, sVal1, sId2, sVal2, sId3, sVal3)
{
	var sPar = "{";
	if (sCmd)
		sPar += "cmd: \"" + sCmd + "\",";
	if (sId1)
		sPar += "id1: \"" + sId1 + "\", val1: \"" + sVal1 + "\",";
	if (sId2)
		sPar += "id2: \"" + sId2 + "\", val2: \"" + sVal2 + "\",";
	if (sId3)
		sPar += "id3: \"" + sId2 + "\", val3: \"" + sVal2 + "\",";
	sPar += "}";
	
	HttpReqASync("KENNLINIE_REDRAW_CHART", sPar);
}


// Kennlinien Viewer Init
function InitViewerMode() {
	try
	{
		var obj;
		if (obj = getEl("CHART_SIZED_RESTORE"))		obj.style.display = 'none';
		if (obj = getEl("IDC_DET_LCC"))				obj.style.display = 'none';
		if (obj = getEl("IDC_DET_MASSBL"))			obj.style.display = 'none';
		if (obj = getEl("IDC_DET_STEMPELDATEN"))	obj.style.display = 'none';
		if (obj = getEl("IDC_RESET"))				obj.style.display = 'none';
		if (obj = getEl("IDC_BACK"))				obj.style.display = 'none';
		if (obj = getEl("IDC_NEXT"))				obj.style.display = 'none';

		if (obj = getEl("IDC_SHOW_MERKL"))			obj.style.display = 'none';
		if (obj = getEl("IDC_SHOW_OPT"))			obj.style.display = 'none';

		var aTabCntrl = dialog['IDC_ZA_TABS'];
		if (getEl("IDC_TAB_PRODUKTSPEKTRUM"))		aTabCntrl.hideTab("IDC_TAB_PRODUKTSPEKTRUM");
		if (getEl("IDC_TAB_VENTILATORAUSWAHL"))		aTabCntrl.hideTab("IDC_TAB_VENTILATORAUSWAHL");
		if (getEl("IDC_TAB_ZUBEHOER"))				aTabCntrl.hideTab("IDC_TAB_ZUBEHOER");
		if (getEl("IDC_TAB_AUSGABE"))				aTabCntrl.hideTab("IDC_TAB_AUSGABE");
		
		var oVolst = getEl("IDC_EDIT_QV"), oDruck = getEl("IDC_EDIT_PSF");
		if (!oVolst.value || !oDruck) {
			var oCV = getEl("CHART_VIEWER");
			
			if (oCV && oCV.value != "") {
				var oViewer = eval('(' + oCV.value + ')');
				oVolst.value = oViewer.qv;
				oDruck.value = oViewer.psf;
			}
		}
	}
	catch (e) {
	}
}


function InitAusgabeCH()
{
	var oAD = getEl("*.DV.AUSGABE.IDC_OUT_CH_AD");
	var oKL = getEl("*.DV.AUSGABE.IDC_OUT_CH_KL");
	var oLC = getEl("*.DV.AUSGABE.IDC_OUT_CH_LC");
	var oMB = getEl("*.DV.AUSGABE.IDC_OUT_CH_MB");
	var oPD = getEl("*.DV.AUSGABE.IDC_OUT_CH_PD");
	var oSB = getEl("*.DV.AUSGABE.IDC_OUT_CH_SB");
	var oST = getEl("*.DV.AUSGABE.IDC_OUT_CH_ST");
	var oVD = getEl("*.DV.AUSGABE.IDC_OUT_CH_VD");
	var oZB = getEl("*.DV.AUSGABE.IDC_OUT_CH_ZB");
	var oKU = getEl("*.DV.AUSGABE.IDC_OUT_CH_KU");
	var oAT = getEl("*.DV.AUSGABE.IDC_OUT_CH_AT");

	if (oKU) {
		var bDisable = oKU.checked;
	
		if (oAD) oAD.disabled = bDisable;
		if (oKL) oKL.disabled = bDisable;
		if (oLC) oLC.disabled = bDisable;
		if (oMB) oMB.disabled = bDisable;
		if (oPD) oPD.disabled = bDisable;
		if (oSB) oSB.disabled = bDisable;
		if (oST) oST.disabled = bDisable;
		if (oVD) oVD.disabled = bDisable;
		if (oZB) oZB.disabled = bDisable;
		if (oAT) oAT.disabled = bDisable;
	}
}



function HttpReqSync(eventId, evPar, evPar1, evPar2, evPar3)
{
    var oRequest = GetXMLHttp();
	var form = document.forms[0];
    var sUrl = form.action + "?xmlhttpreq=Update";
	var oEvent = getEl("EKSUBMITEVENT");
	if (oEvent && oEvent.value)
		oEvent.value = eventId;
	var sPost = Form.serialize(form);
	
	try
	{
		oRequest.open("post", sUrl, false);
		oRequest.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
		sPost = sPost.replace("&EKSUBMITEVENTPAR", "&__SUBMITEVENTPAR");
		
		sPost = addPostParam(sPost, "EKSUBMITEVENT", eventId || "");
		sPost = addPostParam(sPost, "EKSUBMITEVENTPAR", !evPar ? "" : evPar);
		sPost = addPostParam(sPost, "EKSUBMITEVENTPAR1", !evPar1 ? "" : evPar1);
		sPost = addPostParam(sPost, "EKSUBMITEVENTPAR2", !evPar2 ? "" : evPar2);
		sPost = addPostParam(sPost, "EKSUBMITEVENTPAR3", !evPar3 ? "" : evPar3);

		oRequest.send(sPost);

		if(oRequest.status==200 && oRequest.responseText != "") {
			//alert(oRequest.responseText);
			eval(oRequest.responseText);
		}
	}
	catch (e) {
		//alert(e.message);
	}
}


function HttpReqASync(eventId, evPar, evPar1, evPar2, evPar3)
{
    var oRequest = GetXMLHttp();
	var form = document.forms[0];
    var sUrl = form.action + "?xmlhttpreq=Update";
	var oEvent = getEl("EKSUBMITEVENT");
	if (oEvent && oEvent.value)
		oEvent.value = eventId;
	var sPost = Form.serialize(form);
	
	try
	{
		oRequest.open("post", sUrl, true);
		oRequest.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
		sPost = sPost.replace("&EKSUBMITEVENTPAR", "&__SUBMITEVENTPAR");
		
		sPost = addPostParam(sPost, "EKSUBMITEVENT", eventId || "");
		sPost = addPostParam(sPost, "EKSUBMITEVENTPAR", !evPar ? "" : evPar);
		sPost = addPostParam(sPost, "EKSUBMITEVENTPAR1", !evPar1 ? "" : evPar1);
		sPost = addPostParam(sPost, "EKSUBMITEVENTPAR2", !evPar2 ? "" : evPar2);
		sPost = addPostParam(sPost, "EKSUBMITEVENTPAR3", !evPar3 ? "" : evPar3);

		oRequest.onreadystatechange = function()
		{
			if (oRequest.readyState == 4 &&
				oRequest.status == 200 && 
				oRequest.responseText != "")
			{
				//alert(oRequest.responseText);
				eval(oRequest.responseText);
			}
		}
		
		oRequest.send(sPost);
	}
	catch (e) {
		//alert(e.message);
	}
}




function OpenAusgabeDoc(eventId)
{
    var oRequest = GetXMLHttp();
	var form = document.forms[0];
    var sUrl = form.action + "?xmlhttpreq=OpenAusgabeDoc";
	var oEvent = getEl("EKSUBMITEVENT");
	if (oEvent && oEvent.value)
		oEvent.value = eventId;
	var sPost = Form.serialize(form);
	
	try
	{
		oRequest.open("post", sUrl, false); // Sync. Request wegen Pop-Blockern
		oRequest.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
		sPost = addPostParam(sPost, "EKSUBMITEVENT", eventId);
		
		oRequest.send(sPost);
		
		if (oRequest.status==200 && oRequest.responseText != "") {
			//alert(oRequest.responseText);

			if (oRequest.responseText.indexOf(".rtf") > -1) {
				window.open(oRequest.responseText);
			}
			else if (oRequest.responseText.indexOf(".pdf") > -1) {
				//window.open(oRequest.responseText, "_blank", "width=800 height=730"); // Direkt Öffnen
				window.open(oRequest.responseText + "?download"); // Speichern oder Öffnen Dialog
			}
			else {
				window.open(oRequest.responseText + "?download"); // Speichern oder Öffnen Dialog
			}
		}
	}
	catch (e) {
		//alert(e.message);
	}
}
